@redvars/peacock 3.3.0 → 3.3.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/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-group-DA7xoziD.js +292 -0
- package/dist/button-group-DA7xoziD.js.map +1 -0
- package/dist/button-group.js +6 -107
- package/dist/button-group.js.map +1 -1
- package/dist/{button-BGFJfbT2.js → button-trIfcqC7.js} +2 -3
- package/dist/{button-BGFJfbT2.js.map → button-trIfcqC7.js.map} +1 -1
- package/dist/button.js +2 -3
- package/dist/button.js.map +1 -1
- package/dist/{class-map-DpeNtqCn.js → class-map-hJdvjl-W.js} +9 -3
- package/dist/class-map-hJdvjl-W.js.map +1 -0
- package/dist/code-editor.js +5 -5
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +5 -23
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +4706 -2471
- package/dist/custom-elements.json +3444 -1007
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/peacock-loader.js +26 -496
- package/dist/peacock-loader.js.map +1 -1
- package/dist/src/accordion/accordion-item.d.ts +1 -0
- package/dist/src/breadcrumb/breadcrumb/breadcrumb.d.ts +2 -0
- package/dist/src/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +1 -0
- package/dist/src/button/button-group/button-group.d.ts +4 -0
- package/dist/src/code-editor/code-editor.d.ts +4 -3
- package/dist/src/code-highlighter/code-highlighter.d.ts +4 -7
- package/dist/src/index.d.ts +4 -0
- package/dist/src/menu/index.d.ts +3 -0
- package/dist/src/menu/menu/MenuSurfaceController.d.ts +18 -0
- package/dist/src/menu/menu/menu.d.ts +54 -12
- package/dist/src/menu/menu-item/menu-item.d.ts +12 -5
- package/dist/src/menu/sub-menu/sub-menu.d.ts +36 -0
- package/dist/src/pagination/index.d.ts +1 -0
- package/dist/src/pagination/pagination.d.ts +38 -0
- package/dist/src/popover/PopoverController.d.ts +4 -1
- package/dist/src/table/index.d.ts +1 -0
- package/dist/src/table/table.d.ts +110 -0
- package/dist/src/tabs/tab-group.d.ts +4 -0
- package/dist/src/tabs/tab-panel.d.ts +1 -0
- package/dist/src/tabs/tab.d.ts +1 -0
- package/dist/src/tabs/tabs.d.ts +2 -0
- package/dist/src/tooltip/tooltip.d.ts +1 -3
- package/dist/src/tree-view/index.d.ts +2 -0
- package/dist/src/tree-view/tree-node.d.ts +69 -0
- package/dist/src/tree-view/tree-view.d.ts +40 -0
- package/dist/src/tree-view/wc-tree-view.d.ts +6 -0
- package/dist/test/icon.test.d.ts +1 -1
- package/dist/test/menu.test.d.ts +1 -0
- package/dist/test/sub-menu.test.d.ts +1 -0
- package/dist/test/tree-view.test.d.ts +1 -0
- package/dist/{slider-Dk9CFWTG.js → tree-view-CLolVlU0.js} +3317 -1180
- package/dist/tree-view-CLolVlU0.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/readme.md +40 -40
- package/src/accordion/accordion-item.ts +2 -1
- package/src/breadcrumb/breadcrumb/breadcrumb.ts +3 -0
- package/src/breadcrumb/breadcrumb-item/breadcrumb-item.ts +1 -0
- package/src/button/button-group/button-group.ts +6 -0
- package/src/code-editor/code-editor.ts +4 -3
- package/src/code-highlighter/code-highlighter.ts +4 -22
- package/src/divider/divider.scss +2 -2
- package/src/empty-state/empty-state.scss +1 -1
- package/src/empty-state/empty-state.ts +1 -1
- package/src/index.ts +6 -2
- package/src/menu/index.ts +3 -0
- package/src/menu/menu/MenuSurfaceController.ts +61 -0
- package/src/menu/{menu-list/menu-list.scss → menu/menu.scss} +19 -4
- package/src/menu/menu/menu.ts +389 -81
- package/src/menu/menu-item/menu-item.ts +115 -36
- package/src/menu/sub-menu/sub-menu.scss +7 -0
- package/src/menu/sub-menu/sub-menu.ts +243 -0
- package/src/pagination/index.ts +1 -0
- package/src/pagination/pagination.scss +59 -0
- package/src/pagination/pagination.ts +135 -0
- package/src/peacock-loader.ts +25 -11
- package/src/popover/PopoverController.ts +13 -7
- package/src/table/index.ts +1 -0
- package/src/table/table.scss +174 -0
- package/src/table/table.ts +475 -0
- package/src/tabs/tab-group.ts +12 -6
- package/src/tabs/tab-panel.ts +1 -0
- package/src/tabs/tab.ts +1 -0
- package/src/tabs/tabs.scss +6 -5
- package/src/tabs/tabs.ts +5 -3
- package/src/text/text.css-component.scss +6 -3
- package/src/tooltip/tooltip.scss +16 -13
- package/src/tooltip/tooltip.ts +7 -9
- package/src/tree-view/demo/index.html +57 -0
- package/src/tree-view/index.ts +2 -0
- package/src/tree-view/tree-node.scss +101 -0
- package/src/tree-view/tree-node.ts +268 -0
- package/src/tree-view/tree-view.scss +12 -0
- package/src/tree-view/tree-view.ts +182 -0
- package/src/tree-view/wc-tree-view.ts +9 -0
- package/dist/class-map-DpeNtqCn.js.map +0 -1
- package/dist/slider-Dk9CFWTG.js.map +0 -1
- package/dist/src/menu/menu-list/menu-list.d.ts +0 -22
- package/dist/state-8v48Exzh.js +0 -10
- package/dist/state-8v48Exzh.js.map +0 -1
- package/src/menu/menu-list/menu-list.ts +0 -48
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { i, _ as __decorate, n, c as __classPrivateFieldGet, b, I as IndividualComponent, a as i$1 } from './IndividualComponent-tDnXrOLV.js';
|
|
2
|
+
import { e } from './class-map-hJdvjl-W.js';
|
|
3
|
+
import { c as css_248z$2, a as css_248z$3, b as BaseButton, s as spread, B as Button } from './button-trIfcqC7.js';
|
|
4
|
+
import { t as throttle } from './dispatch-event-utils-B4odODQf.js';
|
|
5
|
+
|
|
6
|
+
var css_248z$1 = i`* {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.screen-reader-only {
|
|
11
|
+
display: none !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.button-group {
|
|
15
|
+
display: flex;
|
|
16
|
+
gap: var(--_button-group-gap);
|
|
17
|
+
}
|
|
18
|
+
.button-group slot::slotted(:first-child) {
|
|
19
|
+
--button-container-shape-start-start: 50%;
|
|
20
|
+
--button-container-shape-end-start: 50%;
|
|
21
|
+
--button-container-shape-start-end: var(--shape-corner-medium);
|
|
22
|
+
--button-container-shape-end-end: var(--shape-corner-medium);
|
|
23
|
+
--button-container-shape-variant: unset;
|
|
24
|
+
}
|
|
25
|
+
.button-group slot::slotted(:last-child) {
|
|
26
|
+
--button-container-shape-end-end: 50%;
|
|
27
|
+
--button-container-shape-start-end: 50%;
|
|
28
|
+
--button-container-shape-end-start: var(--shape-corner-medium);
|
|
29
|
+
--button-container-shape-start-start: var(--shape-corner-medium);
|
|
30
|
+
--button-container-shape-variant: unset;
|
|
31
|
+
}
|
|
32
|
+
.button-group slot::slotted(:only-child) {
|
|
33
|
+
--button-container-shape: 50%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.button-group.size-xs,
|
|
37
|
+
.button-group.size-extra-small {
|
|
38
|
+
--_button-group-gap: 0.125rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.button-group.size-sm,
|
|
42
|
+
.button-group.size-small {
|
|
43
|
+
--_button-group-gap: 0.125rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.button-group.size-md,
|
|
47
|
+
.button-group.size-medium {
|
|
48
|
+
--_button-group-gap: 0.125rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.button-group.size-lg,
|
|
52
|
+
.button-group.size-large {
|
|
53
|
+
--_button-group-gap: 0.125rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.button-group.size-xl {
|
|
57
|
+
--_button-group-gap: 0.125rem;
|
|
58
|
+
}`;
|
|
59
|
+
|
|
60
|
+
var css_248z = i`.button {
|
|
61
|
+
--_container-padding: 0.75rem;
|
|
62
|
+
width: var(--_button-height);
|
|
63
|
+
--_container-padding: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.button.size-xs,
|
|
67
|
+
.button.size-extra-small {
|
|
68
|
+
--_button-height: 2rem;
|
|
69
|
+
--_button-icon-size: 1rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.button.size-sm,
|
|
73
|
+
.button.size-small {
|
|
74
|
+
--_button-height: 2.5rem;
|
|
75
|
+
--_button-icon-size: 1.25rem;
|
|
76
|
+
--_button-icon-label-spacing: 0.5rem;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.button.size-md,
|
|
80
|
+
.button.size-medium {
|
|
81
|
+
--_button-height: 3.5rem;
|
|
82
|
+
--_button-icon-size: 1.5rem;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.button.size-lg,
|
|
86
|
+
.button.size-large {
|
|
87
|
+
--_button-height: 6rem;
|
|
88
|
+
--_button-icon-size: 2rem;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.button.size-xl {
|
|
92
|
+
--_button-height: 8.5rem;
|
|
93
|
+
--_button-icon-size: 2.5rem;
|
|
94
|
+
}`;
|
|
95
|
+
|
|
96
|
+
var _IconButton_id, _IconButton_tabindex;
|
|
97
|
+
/**
|
|
98
|
+
* @label Icon Button
|
|
99
|
+
* @tag wc-icon-button
|
|
100
|
+
* @rawTag icon-button
|
|
101
|
+
*
|
|
102
|
+
* @summary Icon buttons allow users to take actions, and make choices, with a single tap.
|
|
103
|
+
*
|
|
104
|
+
* @overview
|
|
105
|
+
* <p>Icon buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. IconButton labels express what action will occur when the user interacts with it.</p>
|
|
106
|
+
*
|
|
107
|
+
* @cssprop --button-container-shape: Defines the border radius of the button container shape.
|
|
108
|
+
*
|
|
109
|
+
* @cssprop --button-container-shape-start-start: Defines the start position of the button container shape.
|
|
110
|
+
* @cssprop --button-container-shape-start-end: Defines the end position of the button container shape.
|
|
111
|
+
* @cssprop --button-container-shape-end-start: Defines the start position of the button container shape.
|
|
112
|
+
* @cssprop --button-container-shape-end-end: Defines the end position of the button container shape.
|
|
113
|
+
*
|
|
114
|
+
*
|
|
115
|
+
* @cssprop --filled-button-container-color: Color of the filled button container.
|
|
116
|
+
* @cssprop --filled-button-label-text-color: Text color of the filled button label.
|
|
117
|
+
*
|
|
118
|
+
* @cssprop --outlined-button-container-color: Color of the outlined button container.
|
|
119
|
+
* @cssprop --outlined-button-label-text-color: Text color of the outlined button label.
|
|
120
|
+
*
|
|
121
|
+
* @cssprop --text-button-label-text-color: Text color of the text button label.
|
|
122
|
+
*
|
|
123
|
+
* @cssprop --tonal-button-container-color: Color of the tonal button container.
|
|
124
|
+
* @cssprop --tonal-button-label-text-color: Text color of the tonal button label.
|
|
125
|
+
*
|
|
126
|
+
* @cssprop --elevated-button-container-color: Color of the elevated button container.
|
|
127
|
+
* @cssprop --elevated-button-label-text-color: Text color of the elevated button label.
|
|
128
|
+
*
|
|
129
|
+
* @cssprop --neo-button-container-color: Color of the neo button container.
|
|
130
|
+
* @cssprop --neo-button-label-text-color: Text color of the neo button label.
|
|
131
|
+
*
|
|
132
|
+
* @fires {CustomEvent} button:click - Dispatched when the button is clicked.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```html
|
|
136
|
+
* <wc-icon-button name="home"></wc-icon-button>
|
|
137
|
+
* ```
|
|
138
|
+
* @tags display
|
|
139
|
+
*/
|
|
140
|
+
class IconButton extends BaseButton {
|
|
141
|
+
constructor() {
|
|
142
|
+
super(...arguments);
|
|
143
|
+
_IconButton_id.set(this, crypto.randomUUID());
|
|
144
|
+
_IconButton_tabindex.set(this, 0);
|
|
145
|
+
this.provider = 'material-symbols';
|
|
146
|
+
}
|
|
147
|
+
firstUpdated() {
|
|
148
|
+
this.__dispatchClickWithThrottle = throttle(this.__dispatchClick, this.throttleDelay);
|
|
149
|
+
this.__convertTypeToVariantAndColor();
|
|
150
|
+
}
|
|
151
|
+
render() {
|
|
152
|
+
const isLink = this.__isLink();
|
|
153
|
+
const cssClasses = {
|
|
154
|
+
button: true,
|
|
155
|
+
'button-element': true,
|
|
156
|
+
[`size-${this.size}`]: true,
|
|
157
|
+
[`variant-${this.variant}`]: true,
|
|
158
|
+
[`color-${this.color}`]: true,
|
|
159
|
+
disabled: this.disabled || this.softDisabled,
|
|
160
|
+
pressed: this.isPressed,
|
|
161
|
+
skeleton: this.skeleton,
|
|
162
|
+
};
|
|
163
|
+
if (!isLink) {
|
|
164
|
+
return b `<button
|
|
165
|
+
class=${e(cssClasses)}
|
|
166
|
+
id="button"
|
|
167
|
+
tabindex=${__classPrivateFieldGet(this, _IconButton_tabindex, "f")}
|
|
168
|
+
type=${this.htmlType}
|
|
169
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
170
|
+
@mousedown=${this.__handlePress}
|
|
171
|
+
@keydown=${this.__handlePress}
|
|
172
|
+
@keyup=${this.__handlePress}
|
|
173
|
+
?aria-describedby=${(this.disabled || this.softDisabled) &&
|
|
174
|
+
this.disabledReason
|
|
175
|
+
? `disabled-reason-${__classPrivateFieldGet(this, _IconButton_id, "f")}`
|
|
176
|
+
: null}
|
|
177
|
+
aria-disabled=${`${this.disabled || this.softDisabled}`}
|
|
178
|
+
?disabled=${this.disabled}
|
|
179
|
+
${spread(this.configAria)}
|
|
180
|
+
>
|
|
181
|
+
${this.renderButtonContent()}
|
|
182
|
+
</button>
|
|
183
|
+
${this.__renderTooltip()}`;
|
|
184
|
+
}
|
|
185
|
+
return b `<a
|
|
186
|
+
class=${e(cssClasses)}
|
|
187
|
+
id="button"
|
|
188
|
+
tabindex=${__classPrivateFieldGet(this, _IconButton_tabindex, "f")}
|
|
189
|
+
href=${this.href}
|
|
190
|
+
target=${this.target}
|
|
191
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
192
|
+
@mousedown=${this.__handlePress}
|
|
193
|
+
@keydown=${this.__handlePress}
|
|
194
|
+
@keyup=${this.__handlePress}
|
|
195
|
+
role="button"
|
|
196
|
+
aria-describedby=${this.disabled && this.disabledReason
|
|
197
|
+
? `disabled-reason-${__classPrivateFieldGet(this, _IconButton_id, "f")}`
|
|
198
|
+
: null}
|
|
199
|
+
aria-disabled=${`${this.disabled}`}
|
|
200
|
+
${spread(this.configAria)}
|
|
201
|
+
>
|
|
202
|
+
${this.renderButtonContent()}
|
|
203
|
+
</a>
|
|
204
|
+
${this.__renderTooltip()}`;
|
|
205
|
+
}
|
|
206
|
+
renderButtonContent() {
|
|
207
|
+
return b `
|
|
208
|
+
<wc-focus-ring class="focus-ring" .control=${this} element="buttonElement"></wc-focus-ring>
|
|
209
|
+
<wc-elevation class="elevation"></wc-elevation>
|
|
210
|
+
<div class="neo-background"></div>
|
|
211
|
+
<div class="background"></div>
|
|
212
|
+
<div class="outline"></div>
|
|
213
|
+
<wc-ripple class="ripple"></wc-ripple>
|
|
214
|
+
<wc-skeleton class="skeleton"></wc-skeleton>
|
|
215
|
+
|
|
216
|
+
<div class="button-content">
|
|
217
|
+
<wc-icon
|
|
218
|
+
name=${this.name}
|
|
219
|
+
src=${this.src}
|
|
220
|
+
provider=${this.provider}
|
|
221
|
+
></wc-icon>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
${this.__renderDisabledReason()}
|
|
225
|
+
`;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
_IconButton_id = new WeakMap(), _IconButton_tabindex = new WeakMap();
|
|
229
|
+
IconButton.styles = [css_248z$2, css_248z$3, css_248z];
|
|
230
|
+
__decorate([
|
|
231
|
+
n({ type: String, reflect: true })
|
|
232
|
+
], IconButton.prototype, "name", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
n({ type: String, reflect: true })
|
|
235
|
+
], IconButton.prototype, "src", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
n({ type: String })
|
|
238
|
+
], IconButton.prototype, "provider", void 0);
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @label Button Group
|
|
242
|
+
* @tag wc-button-group
|
|
243
|
+
* @rawTag button-group
|
|
244
|
+
*
|
|
245
|
+
* @summary Group a series of buttons together on a single line with the button group, and super-power.
|
|
246
|
+
|
|
247
|
+
* @example
|
|
248
|
+
* ```html
|
|
249
|
+
* <wc-button-group>
|
|
250
|
+
* <wc-icon-button name="home"></wc-icon-button>
|
|
251
|
+
* <wc-icon-button name="alarm"></wc-icon-button>
|
|
252
|
+
* </wc-button-group>
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
255
|
+
* @tags controls
|
|
256
|
+
*/
|
|
257
|
+
let ButtonGroup = class ButtonGroup extends i$1 {
|
|
258
|
+
constructor() {
|
|
259
|
+
super(...arguments);
|
|
260
|
+
/**
|
|
261
|
+
* Button size.
|
|
262
|
+
* Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`.
|
|
263
|
+
*/
|
|
264
|
+
this.size = 'sm';
|
|
265
|
+
}
|
|
266
|
+
render() {
|
|
267
|
+
const cssClasses = {
|
|
268
|
+
'button-group': true,
|
|
269
|
+
[`size-${this.size}`]: true,
|
|
270
|
+
};
|
|
271
|
+
return b `
|
|
272
|
+
<div class=${e(cssClasses)}>
|
|
273
|
+
<slot></slot>
|
|
274
|
+
</div>
|
|
275
|
+
`;
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
// Lit prefers CSS-in-JS for better performance and scoping.
|
|
279
|
+
// If you prefer keeping the SCSS file, you'll need a build tool (like Vite or Webpack)
|
|
280
|
+
// that can import .scss files as lit-css.
|
|
281
|
+
ButtonGroup.styles = [css_248z$1];
|
|
282
|
+
ButtonGroup.Button = Button;
|
|
283
|
+
ButtonGroup.IconButton = IconButton;
|
|
284
|
+
__decorate([
|
|
285
|
+
n()
|
|
286
|
+
], ButtonGroup.prototype, "size", void 0);
|
|
287
|
+
ButtonGroup = __decorate([
|
|
288
|
+
IndividualComponent
|
|
289
|
+
], ButtonGroup);
|
|
290
|
+
|
|
291
|
+
export { ButtonGroup as B, IconButton as I };
|
|
292
|
+
//# sourceMappingURL=button-group-DA7xoziD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-group-DA7xoziD.js","sources":["../../src/button/icon-button/icon-button.ts","../../src/button/button-group/button-group.ts"],"sourcesContent":["import { html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport styles from '../button/button.scss';\nimport colorStyles from '../button/button-colors.scss';\nimport sizeStyles from './icon-button-sizes.scss';\nimport { spread } from '../../spread.js';\nimport { BaseButton } from '../BaseButton.js';\nimport { IconProvider } from '../../icon/icon.js';\nimport { throttle } from '../../utils.js';\n\n/**\n * @label Icon Button\n * @tag wc-icon-button\n * @rawTag icon-button\n *\n * @summary Icon buttons allow users to take actions, and make choices, with a single tap.\n *\n * @overview\n * <p>Icon buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. IconButton labels express what action will occur when the user interacts with it.</p>\n *\n * @cssprop --button-container-shape: Defines the border radius of the button container shape.\n *\n * @cssprop --button-container-shape-start-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-start-end: Defines the end position of the button container shape.\n * @cssprop --button-container-shape-end-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-end-end: Defines the end position of the button container shape.\n *\n *\n * @cssprop --filled-button-container-color: Color of the filled button container.\n * @cssprop --filled-button-label-text-color: Text color of the filled button label.\n *\n * @cssprop --outlined-button-container-color: Color of the outlined button container.\n * @cssprop --outlined-button-label-text-color: Text color of the outlined button label.\n *\n * @cssprop --text-button-label-text-color: Text color of the text button label.\n *\n * @cssprop --tonal-button-container-color: Color of the tonal button container.\n * @cssprop --tonal-button-label-text-color: Text color of the tonal button label.\n *\n * @cssprop --elevated-button-container-color: Color of the elevated button container.\n * @cssprop --elevated-button-label-text-color: Text color of the elevated button label.\n *\n * @cssprop --neo-button-container-color: Color of the neo button container.\n * @cssprop --neo-button-label-text-color: Text color of the neo button label.\n *\n * @fires {CustomEvent} button:click - Dispatched when the button is clicked.\n *\n * @example\n * ```html\n * <wc-icon-button name=\"home\"></wc-icon-button>\n * ```\n * @tags display\n */\nexport class IconButton extends BaseButton {\n static override styles = [styles, colorStyles, sizeStyles];\n\n #id = crypto.randomUUID();\n\n #tabindex?: number = 0;\n\n @property({ type: String, reflect: true }) name?: string;\n\n @property({ type: String, reflect: true }) src?: string;\n\n @property({ type: String }) provider: IconProvider = 'material-symbols';\n\n override firstUpdated() {\n this.__dispatchClickWithThrottle = throttle(\n this.__dispatchClick,\n this.throttleDelay,\n );\n this.__convertTypeToVariantAndColor();\n }\n\n override render() {\n const isLink = this.__isLink();\n\n const cssClasses = {\n button: true,\n 'button-element': true,\n [`size-${this.size}`]: true,\n [`variant-${this.variant}`]: true,\n [`color-${this.color}`]: true,\n disabled: this.disabled || this.softDisabled,\n pressed: this.isPressed,\n skeleton: this.skeleton,\n };\n\n if (!isLink) {\n return html`<button\n class=${classMap(cssClasses)}\n id=\"button\"\n tabindex=${this.#tabindex}\n type=${this.htmlType}\n @click=${this.__dispatchClickWithThrottle}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n ?aria-describedby=${(this.disabled || this.softDisabled) &&\n this.disabledReason\n ? `disabled-reason-${this.#id}`\n : null}\n aria-disabled=${`${this.disabled || this.softDisabled}`}\n ?disabled=${this.disabled}\n ${spread(this.configAria)}\n >\n ${this.renderButtonContent()}\n </button>\n ${this.__renderTooltip()}`;\n }\n return html`<a\n class=${classMap(cssClasses)}\n id=\"button\"\n tabindex=${this.#tabindex}\n href=${this.href}\n target=${this.target}\n @click=${this.__dispatchClickWithThrottle}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n role=\"button\"\n aria-describedby=${this.disabled && this.disabledReason\n ? `disabled-reason-${this.#id}`\n : null}\n aria-disabled=${`${this.disabled}`}\n ${spread(this.configAria)}\n >\n ${this.renderButtonContent()}\n </a>\n ${this.__renderTooltip()}`;\n }\n\n renderButtonContent() {\n return html`\n <wc-focus-ring class=\"focus-ring\" .control=${this} element=\"buttonElement\"></wc-focus-ring>\n <wc-elevation class=\"elevation\"></wc-elevation>\n <div class=\"neo-background\"></div>\n <div class=\"background\"></div>\n <div class=\"outline\"></div>\n <wc-ripple class=\"ripple\"></wc-ripple>\n <wc-skeleton class=\"skeleton\"></wc-skeleton>\n\n <div class=\"button-content\">\n <wc-icon\n name=${this.name}\n src=${this.src}\n provider=${this.provider}\n ></wc-icon>\n </div>\n\n ${this.__renderDisabledReason()}\n `;\n }\n}\n","import { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport IndividualComponent from 'src/IndividualComponent.js';\nimport styles from './button-group.scss';\nimport { Button } from '../button/button.js';\nimport { IconButton } from '../icon-button/icon-button.js';\n\n/**\n * @label Button Group\n * @tag wc-button-group\n * @rawTag button-group\n *\n * @summary Group a series of buttons together on a single line with the button group, and super-power.\n\n * @example\n * ```html\n * <wc-button-group>\n * <wc-icon-button name=\"home\"></wc-icon-button>\n * <wc-icon-button name=\"alarm\"></wc-icon-button>\n * </wc-button-group>\n * ```\n *\n * @tags controls\n */\n@IndividualComponent\nexport class ButtonGroup extends LitElement {\n // Lit prefers CSS-in-JS for better performance and scoping.\n // If you prefer keeping the SCSS file, you'll need a build tool (like Vite or Webpack)\n // that can import .scss files as lit-css.\n static styles = [styles];\n\n static Button = Button;\n\n static IconButton = IconButton;\n\n /**\n * Button size.\n * Possible values are `\"sm\"`, `\"md\"`, `\"lg\"`. Defaults to `\"md\"`.\n */\n @property() size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n render() {\n const cssClasses = {\n 'button-group': true,\n [`size-${this.size}`]: true,\n };\n return html`\n <div class=${classMap(cssClasses)}>\n <slot></slot>\n </div>\n `;\n }\n}\n"],"names":["html","classMap","styles","colorStyles","sizeStyles","property","LitElement"],"mappings":";;;;;;;;;;;;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AAA,CAAE,GAAG,IAAI;SAC5B;AACD,QAAA,OAAON,CAAI,CAAA;mBACIC,CAAQ,CAAC,UAAU,CAAC,CAAA;;;KAGlC;IACH;;AAzBA;AACA;AACA;AACO,WAAA,CAAA,MAAM,GAAG,CAACC,UAAM,CAAC;AAEjB,WAAA,CAAA,MAAM,GAAG,MAAH;AAEN,WAAA,CAAA,UAAU,GAAG,UAAH;AAML,UAAA,CAAA;AAAX,IAAAG,CAAQ;AAAiD,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAd/C,WAAW,GAAA,UAAA,CAAA;IADvB;AACY,CAAA,EAAA,WAAW,CA2BvB;;;;"}
|
package/dist/button-group.js
CHANGED
|
@@ -1,109 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import './IndividualComponent-tDnXrOLV.js';
|
|
2
|
+
import './class-map-hJdvjl-W.js';
|
|
3
|
+
export { B as ButtonGroup } from './button-group-DA7xoziD.js';
|
|
4
|
+
import './button-trIfcqC7.js';
|
|
3
5
|
import './directive-Cuw6h7YA.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.screen-reader-only {
|
|
10
|
-
display: none !important;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.button-group {
|
|
14
|
-
display: flex;
|
|
15
|
-
gap: var(--_button-group-gap);
|
|
16
|
-
}
|
|
17
|
-
.button-group slot::slotted(:first-child) {
|
|
18
|
-
--button-container-shape-start-start: 50%;
|
|
19
|
-
--button-container-shape-end-start: 50%;
|
|
20
|
-
--button-container-shape-start-end: var(--shape-corner-medium);
|
|
21
|
-
--button-container-shape-end-end: var(--shape-corner-medium);
|
|
22
|
-
--button-container-shape-variant: unset;
|
|
23
|
-
}
|
|
24
|
-
.button-group slot::slotted(:last-child) {
|
|
25
|
-
--button-container-shape-end-end: 50%;
|
|
26
|
-
--button-container-shape-start-end: 50%;
|
|
27
|
-
--button-container-shape-end-start: var(--shape-corner-medium);
|
|
28
|
-
--button-container-shape-start-start: var(--shape-corner-medium);
|
|
29
|
-
--button-container-shape-variant: unset;
|
|
30
|
-
}
|
|
31
|
-
.button-group slot::slotted(:only-child) {
|
|
32
|
-
--button-container-shape: 50%;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.button-group.size-xs,
|
|
36
|
-
.button-group.size-extra-small {
|
|
37
|
-
--_button-group-gap: 0.125rem;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.button-group.size-sm,
|
|
41
|
-
.button-group.size-small {
|
|
42
|
-
--_button-group-gap: 0.125rem;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.button-group.size-md,
|
|
46
|
-
.button-group.size-medium {
|
|
47
|
-
--_button-group-gap: 0.125rem;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.button-group.size-lg,
|
|
51
|
-
.button-group.size-large {
|
|
52
|
-
--_button-group-gap: 0.125rem;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.button-group.size-xl {
|
|
56
|
-
--_button-group-gap: 0.125rem;
|
|
57
|
-
}`;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @label Button Group
|
|
61
|
-
* @tag wc-button-group
|
|
62
|
-
* @rawTag button-group
|
|
63
|
-
*
|
|
64
|
-
* @summary Group a series of buttons together on a single line with the button group, and super-power.
|
|
65
|
-
|
|
66
|
-
* @example
|
|
67
|
-
* ```html
|
|
68
|
-
* <wc-button-group>
|
|
69
|
-
* <wc-icon-button name="home"></wc-icon-button>
|
|
70
|
-
* <wc-icon-button name="alarm"></wc-icon-button>
|
|
71
|
-
* </wc-button-group>
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* @tags controls
|
|
75
|
-
*/
|
|
76
|
-
let ButtonGroup = class ButtonGroup extends i$1 {
|
|
77
|
-
constructor() {
|
|
78
|
-
super(...arguments);
|
|
79
|
-
/**
|
|
80
|
-
* Button size.
|
|
81
|
-
* Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`.
|
|
82
|
-
*/
|
|
83
|
-
this.size = 'sm';
|
|
84
|
-
}
|
|
85
|
-
render() {
|
|
86
|
-
const cssClasses = {
|
|
87
|
-
'button-group': true,
|
|
88
|
-
[`size-${this.size}`]: true,
|
|
89
|
-
};
|
|
90
|
-
return b `
|
|
91
|
-
<div class=${e(cssClasses)}>
|
|
92
|
-
<slot></slot>
|
|
93
|
-
</div>
|
|
94
|
-
`;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
// Lit prefers CSS-in-JS for better performance and scoping.
|
|
98
|
-
// If you prefer keeping the SCSS file, you'll need a build tool (like Vite or Webpack)
|
|
99
|
-
// that can import .scss files as lit-css.
|
|
100
|
-
ButtonGroup.styles = [css_248z];
|
|
101
|
-
__decorate([
|
|
102
|
-
n()
|
|
103
|
-
], ButtonGroup.prototype, "size", void 0);
|
|
104
|
-
ButtonGroup = __decorate([
|
|
105
|
-
IndividualComponent
|
|
106
|
-
], ButtonGroup);
|
|
107
|
-
|
|
108
|
-
export { ButtonGroup };
|
|
6
|
+
import './dispatch-event-utils-B4odODQf.js';
|
|
7
|
+
import './query-QBcUV-L_.js';
|
|
109
8
|
//# sourceMappingURL=button-group.js.map
|
package/dist/button-group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.js","sources":[
|
|
1
|
+
{"version":3,"file":"button-group.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { i, _ as __decorate, n, a as i$2, A, c as __classPrivateFieldGet, b, I as IndividualComponent } from './IndividualComponent-tDnXrOLV.js';
|
|
2
|
-
import { r } from './
|
|
3
|
-
import { e as e$2 } from './class-map-DpeNtqCn.js';
|
|
2
|
+
import { r, e as e$2 } from './class-map-hJdvjl-W.js';
|
|
4
3
|
import { i as isActivationClick, d as dispatchActivationClick, t as throttle, o as observerSlotChangesWithCallback } from './dispatch-event-utils-B4odODQf.js';
|
|
5
4
|
import { e, i as i$1, t } from './directive-Cuw6h7YA.js';
|
|
6
5
|
import { e as e$1 } from './query-QBcUV-L_.js';
|
|
@@ -882,4 +881,4 @@ Button = __decorate([
|
|
|
882
881
|
], Button);
|
|
883
882
|
|
|
884
883
|
export { Button as B, css_248z$1 as a, BaseButton as b, css_248z$2 as c, spread as s };
|
|
885
|
-
//# sourceMappingURL=button-
|
|
884
|
+
//# sourceMappingURL=button-trIfcqC7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-BGFJfbT2.js","sources":["../../src/spread.ts","../../src/button/BaseButton.ts","../../src/button/button/button.ts"],"sourcesContent":["import {\n directive,\n Directive,\n ElementPart,\n PartInfo,\n PartType,\n} from 'lit/directive.js';\n\nclass SpreadDirective extends Directive {\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.ELEMENT) {\n throw new Error('spread() can only be used on elements');\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n render(_props: { [key: string]: any } | undefined) {\n return '';\n }\n\n update(part: ElementPart, [props]: [{ [key: string]: any } | undefined]) {\n if (!props) return;\n // eslint-disable-next-line guard-for-in,no-restricted-syntax\n for (const key in props) {\n const value = props[key];\n if (value === undefined || value === null) {\n part.element.removeAttribute(key);\n } else {\n part.element.setAttribute(key, value);\n }\n }\n }\n}\n\nexport const spread = directive(SpreadDirective);\n","import { html, LitElement, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { dispatchActivationClick, isActivationClick } from '../utils/dispatch-event-utils.js';\n\nexport class BaseButton extends LitElement {\n #id = crypto.randomUUID();\n\n @property({ type: String }) htmlType: 'button' | 'submit' | 'reset' =\n 'button';\n\n /**\n * Type is preset of color and variant. Type will be only applied.\n *\n */\n @property({ type: String }) type?: 'primary' | 'secondary' | 'tertiary';\n\n /**\n * The visual style of the button.\n *\n * Possible variant values:\n * `\"filled\"` is a filled button.\n * `\"outlined\"` is an outlined button.\n * `\"text\"` is a transparent button.\n * `\"tonal\"` is a light color button.\n * `\"elevated\"` is elevated button\n */\n @property() variant:\n | 'elevated'\n | 'filled'\n | 'tonal'\n | 'outlined'\n | 'text'\n | 'neo' = 'filled';\n\n /**\n * Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.\n */\n @property({ reflect: true }) color:\n | 'primary'\n | 'success'\n | 'danger'\n | 'warning'\n | 'light'\n | 'dark' = 'primary';\n\n /**\n * Button size.\n * Possible values are `\"sm\"`, `\"md\"`, `\"lg\"`. Defaults to `\"md\"`.\n */\n @property() size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /**\n * If true, the user cannot interact with the button. Defaults to `false`.\n */\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n @property() skeleton: boolean = false;\n\n /**\n * If true, the user cannot interact with the button and the button is visually styled as disabled. But the button is still focusable. Defaults to `false`.\n */\n @property({ reflect: true, attribute: 'soft-disabled' })\n softDisabled: boolean = false;\n\n /**\n * If button is disabled, the reason why it is disabled.\n */\n @property({ attribute: 'disabled-reason' })\n disabledReason: string = '';\n\n /**\n * Hyperlink to navigate to on click.\n */\n @property({ reflect: true }) href?: string;\n\n @property({ reflect: true })\n configAria?: { [key: string]: any };\n\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n @property() target: string = '_self';\n\n @property() selected: boolean = false;\n\n /**\n * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.\n */\n @property() throttleDelay = 200;\n\n @property() tooltip?: string;\n\n /**\n * States\n */\n @state()\n isPressed = false;\n\n @query('.button') readonly buttonElement!: HTMLElement | null;\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\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.isPressed = true;\n } else if (event.type === 'mousedown') {\n this.isPressed = true;\n } else {\n this.isPressed = false;\n }\n };\n\n __isLink() {\n return !!this.href;\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 this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n __convertTypeToVariantAndColor() {\n if (this.type === 'primary') {\n this.color = 'primary';\n this.variant = 'filled';\n } else if (this.type === 'secondary') {\n this.color = 'dark';\n this.variant = 'outlined';\n } else if (this.type === 'tertiary') {\n this.color = 'primary';\n this.variant = 'text';\n } else if (this.type === 'danger') {\n this.color = 'danger';\n this.variant = 'filled';\n }\n }\n\n __getDisabledReasonID() {\n return this.disabled && this.disabledReason\n ? `disabled-reason-${this.#id}`\n : nothing;\n }\n\n __renderDisabledReason() {\n const disabledReasonID = this.__getDisabledReasonID();\n if (disabledReasonID)\n return html`<div\n id=\"disabled-reason-${this.#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 for=\"button\">${this.tooltip}</wc-tooltip>`;\n }\n return nothing;\n }\n}\n","import { html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport IndividualComponent from 'src/IndividualComponent.js';\nimport styles from './button.scss';\nimport colorStyles from './button-colors.scss';\nimport sizeStyles from './button-sizes.scss';\nimport { observerSlotChangesWithCallback, throttle } from '../../utils.js';\nimport { spread } from '../../spread.js';\nimport { BaseButton } from '../BaseButton.js';\n\n/**\n * @label Button\n * @tag wc-button\n * @rawTag button\n *\n * @summary Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post.\n * @overview\n * <p>Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.</p>\n *\n * @cssprop --button-container-shape: Defines the border radius of the button container shape.\n *\n * @cssprop --button-container-shape-start-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-start-end: Defines the end position of the button container shape.\n * @cssprop --button-container-shape-end-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-end-end: Defines the end position of the button container shape.\n *\n *\n * @cssprop --filled-button-container-color: Color of the filled button container.\n * @cssprop --filled-button-label-text-color: Text color of the filled button label.\n *\n * @cssprop --outlined-button-container-color: Color of the outlined button container.\n * @cssprop --outlined-button-label-text-color: Text color of the outlined button label.\n *\n * @cssprop --text-button-label-text-color: Text color of the text button label.\n *\n * @cssprop --tonal-button-container-color: Color of the tonal button container.\n * @cssprop --tonal-button-label-text-color: Text color of the tonal button label.\n *\n * @cssprop --elevated-button-container-color: Color of the elevated button container.\n * @cssprop --elevated-button-label-text-color: Text color of the elevated button label.\n *\n * @cssprop --neo-button-container-color: Color of the neo button container.\n * @cssprop --neo-button-label-text-color: Text color of the neo button label.\n *\n * @fires {MouseEvent} click - Dispatched when the button is clicked.\n *\n * @example\n * ```html\n * <wc-button>Button</wc-button>\n * ```\n * @tags display\n */\n@IndividualComponent\nexport class Button extends BaseButton {\n static override styles = [styles, colorStyles, sizeStyles];\n\n #tabindex?: number = 0;\n\n /**\n * Icon alignment.\n * Possible values are `\"start\"`, `\"end\"`. Defaults to `\"end\"`.\n */\n @property({ attribute: 'icon-align' })\n iconAlign: 'start' | 'end' = 'end';\n\n @state()\n private slotHasContent = false;\n\n override firstUpdated() {\n this.__dispatchClickWithThrottle = throttle(\n this.__dispatchClick,\n this.throttleDelay,\n );\n observerSlotChangesWithCallback(\n this.renderRoot.querySelector('slot'),\n hasContent => {\n this.slotHasContent = hasContent;\n this.requestUpdate();\n },\n );\n\n this.__convertTypeToVariantAndColor();\n }\n\n override render() {\n const isLink = this.__isLink();\n\n const cssClasses = {\n button: true,\n 'button-element': true,\n [`size-${this.size}`]: true,\n [`variant-${this.variant}`]: true,\n [`color-${this.color}`]: true,\n disabled: this.disabled || this.softDisabled,\n pressed: this.isPressed,\n 'has-content': this.slotHasContent,\n 'show-skeleton': this.skeleton,\n [`icon-align-${this.iconAlign}`]: true,\n };\n\n if (!isLink) {\n return html`<button\n class=${classMap(cssClasses)}\n id=\"button\"\n tabindex=${this.#tabindex}\n type=${this.htmlType}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n ?aria-describedby=${this.__getDisabledReasonID()}\n aria-disabled=${`${this.disabled || this.softDisabled}`}\n ?disabled=${this.disabled}\n ${spread(this.configAria)}\n >\n ${this.renderButtonContent()}\n </button>\n ${this.__renderTooltip()}`;\n }\n return html`<a\n class=${classMap(cssClasses)}\n id=\"button\"\n tabindex=${this.#tabindex}\n href=${this.href}\n target=${this.target}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n role=\"button\"\n ?aria-describedby=${this.__getDisabledReasonID()}\n aria-disabled=${`${this.disabled}`}\n ${spread(this.configAria)}\n >\n ${this.renderButtonContent()}\n </a>\n ${this.__renderTooltip()}`;\n }\n\n renderButtonContent() {\n return html`\n <wc-focus-ring class=\"focus-ring\" .control=${this} element=\"buttonElement\"></wc-focus-ring>\n <wc-elevation class=\"elevation\"></wc-elevation>\n <div class=\"neo-background\"></div>\n <div class=\"background\"></div>\n <div class=\"outline\"></div>\n <wc-ripple class=\"ripple\"></wc-ripple>\n <wc-skeleton class=\"skeleton\"></wc-skeleton>\n\n <div class=\"button-content\">\n <div class=\"slot-container\">\n <slot></slot>\n </div>\n\n <slot name=\"icon\"></slot>\n </div>\n\n ${this.__renderDisabledReason()}\n `;\n }\n}\n"],"names":["Directive","PartType","directive","LitElement","nothing","html","property","state","query","classMap","styles","colorStyles","sizeStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,eAAgB,SAAQA,GAAS,CAAA;AACrC,IAAA,WAAA,CAAY,QAAkB,EAAA;QAC5B,KAAK,CAAC,QAAQ,CAAC;QACf,IAAI,QAAQ,CAAC,IAAI,KAAKC,CAAQ,CAAC,OAAO,EAAE;AACtC,YAAA,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC;QAC1D;IACF;;AAGA,IAAA,MAAM,CAAC,MAA0C,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;AAChC,QAAA,EAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;;UAEvB,IAAI,CAAC,mBAAmB,EAAE;;AAE5B,MAAA,EAAA,IAAI,CAAC,eAAe,EAAE,CAAA,CAAE;IAC9B;IAEA,mBAAmB,GAAA;AACjB,QAAA,OAAOJ,CAAI,CAAA;mDACoC,IAAI,CAAA;;;;;;;;;;;;;;;;QAgB/C,IAAI,CAAC,sBAAsB,EAAE;KAChC;IACH;;;AAvGgB,MAAA,CAAA,MAAM,GAAG,CAACK,UAAM,EAAEC,UAAW,EAAEC,QAAU,CAAnC;AAStB,UAAA,CAAA;AADC,IAAAN,CAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE;AACF,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAG3B,UAAA,CAAA;AADP,IAAAC,CAAK;AACyB,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAbpB,MAAM,GAAA,UAAA,CAAA;IADlB;AACY,CAAA,EAAA,MAAM,CAyGlB;;;;"}
|
|
1
|
+
{"version":3,"file":"button-trIfcqC7.js","sources":["../../src/spread.ts","../../src/button/BaseButton.ts","../../src/button/button/button.ts"],"sourcesContent":["import {\n directive,\n Directive,\n ElementPart,\n PartInfo,\n PartType,\n} from 'lit/directive.js';\n\nclass SpreadDirective extends Directive {\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.ELEMENT) {\n throw new Error('spread() can only be used on elements');\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n render(_props: { [key: string]: any } | undefined) {\n return '';\n }\n\n update(part: ElementPart, [props]: [{ [key: string]: any } | undefined]) {\n if (!props) return;\n // eslint-disable-next-line guard-for-in,no-restricted-syntax\n for (const key in props) {\n const value = props[key];\n if (value === undefined || value === null) {\n part.element.removeAttribute(key);\n } else {\n part.element.setAttribute(key, value);\n }\n }\n }\n}\n\nexport const spread = directive(SpreadDirective);\n","import { html, LitElement, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { dispatchActivationClick, isActivationClick } from '../utils/dispatch-event-utils.js';\n\nexport class BaseButton extends LitElement {\n #id = crypto.randomUUID();\n\n @property({ type: String }) htmlType: 'button' | 'submit' | 'reset' =\n 'button';\n\n /**\n * Type is preset of color and variant. Type will be only applied.\n *\n */\n @property({ type: String }) type?: 'primary' | 'secondary' | 'tertiary';\n\n /**\n * The visual style of the button.\n *\n * Possible variant values:\n * `\"filled\"` is a filled button.\n * `\"outlined\"` is an outlined button.\n * `\"text\"` is a transparent button.\n * `\"tonal\"` is a light color button.\n * `\"elevated\"` is elevated button\n */\n @property() variant:\n | 'elevated'\n | 'filled'\n | 'tonal'\n | 'outlined'\n | 'text'\n | 'neo' = 'filled';\n\n /**\n * Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.\n */\n @property({ reflect: true }) color:\n | 'primary'\n | 'success'\n | 'danger'\n | 'warning'\n | 'light'\n | 'dark' = 'primary';\n\n /**\n * Button size.\n * Possible values are `\"sm\"`, `\"md\"`, `\"lg\"`. Defaults to `\"md\"`.\n */\n @property() size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /**\n * If true, the user cannot interact with the button. Defaults to `false`.\n */\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n @property() skeleton: boolean = false;\n\n /**\n * If true, the user cannot interact with the button and the button is visually styled as disabled. But the button is still focusable. Defaults to `false`.\n */\n @property({ reflect: true, attribute: 'soft-disabled' })\n softDisabled: boolean = false;\n\n /**\n * If button is disabled, the reason why it is disabled.\n */\n @property({ attribute: 'disabled-reason' })\n disabledReason: string = '';\n\n /**\n * Hyperlink to navigate to on click.\n */\n @property({ reflect: true }) href?: string;\n\n @property({ reflect: true })\n configAria?: { [key: string]: any };\n\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n @property() target: string = '_self';\n\n @property() selected: boolean = false;\n\n /**\n * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.\n */\n @property() throttleDelay = 200;\n\n @property() tooltip?: string;\n\n /**\n * States\n */\n @state()\n isPressed = false;\n\n @query('.button') readonly buttonElement!: HTMLElement | null;\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\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.isPressed = true;\n } else if (event.type === 'mousedown') {\n this.isPressed = true;\n } else {\n this.isPressed = false;\n }\n };\n\n __isLink() {\n return !!this.href;\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 this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n __convertTypeToVariantAndColor() {\n if (this.type === 'primary') {\n this.color = 'primary';\n this.variant = 'filled';\n } else if (this.type === 'secondary') {\n this.color = 'dark';\n this.variant = 'outlined';\n } else if (this.type === 'tertiary') {\n this.color = 'primary';\n this.variant = 'text';\n } else if (this.type === 'danger') {\n this.color = 'danger';\n this.variant = 'filled';\n }\n }\n\n __getDisabledReasonID() {\n return this.disabled && this.disabledReason\n ? `disabled-reason-${this.#id}`\n : nothing;\n }\n\n __renderDisabledReason() {\n const disabledReasonID = this.__getDisabledReasonID();\n if (disabledReasonID)\n return html`<div\n id=\"disabled-reason-${this.#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 for=\"button\">${this.tooltip}</wc-tooltip>`;\n }\n return nothing;\n }\n}\n","import { html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport IndividualComponent from 'src/IndividualComponent.js';\nimport styles from './button.scss';\nimport colorStyles from './button-colors.scss';\nimport sizeStyles from './button-sizes.scss';\nimport { observerSlotChangesWithCallback, throttle } from '../../utils.js';\nimport { spread } from '../../spread.js';\nimport { BaseButton } from '../BaseButton.js';\n\n/**\n * @label Button\n * @tag wc-button\n * @rawTag button\n *\n * @summary Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post.\n * @overview\n * <p>Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.</p>\n *\n * @cssprop --button-container-shape: Defines the border radius of the button container shape.\n *\n * @cssprop --button-container-shape-start-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-start-end: Defines the end position of the button container shape.\n * @cssprop --button-container-shape-end-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-end-end: Defines the end position of the button container shape.\n *\n *\n * @cssprop --filled-button-container-color: Color of the filled button container.\n * @cssprop --filled-button-label-text-color: Text color of the filled button label.\n *\n * @cssprop --outlined-button-container-color: Color of the outlined button container.\n * @cssprop --outlined-button-label-text-color: Text color of the outlined button label.\n *\n * @cssprop --text-button-label-text-color: Text color of the text button label.\n *\n * @cssprop --tonal-button-container-color: Color of the tonal button container.\n * @cssprop --tonal-button-label-text-color: Text color of the tonal button label.\n *\n * @cssprop --elevated-button-container-color: Color of the elevated button container.\n * @cssprop --elevated-button-label-text-color: Text color of the elevated button label.\n *\n * @cssprop --neo-button-container-color: Color of the neo button container.\n * @cssprop --neo-button-label-text-color: Text color of the neo button label.\n *\n * @fires {MouseEvent} click - Dispatched when the button is clicked.\n *\n * @example\n * ```html\n * <wc-button>Button</wc-button>\n * ```\n * @tags display\n */\n@IndividualComponent\nexport class Button extends BaseButton {\n static override styles = [styles, colorStyles, sizeStyles];\n\n #tabindex?: number = 0;\n\n /**\n * Icon alignment.\n * Possible values are `\"start\"`, `\"end\"`. Defaults to `\"end\"`.\n */\n @property({ attribute: 'icon-align' })\n iconAlign: 'start' | 'end' = 'end';\n\n @state()\n private slotHasContent = false;\n\n override firstUpdated() {\n this.__dispatchClickWithThrottle = throttle(\n this.__dispatchClick,\n this.throttleDelay,\n );\n observerSlotChangesWithCallback(\n this.renderRoot.querySelector('slot'),\n hasContent => {\n this.slotHasContent = hasContent;\n this.requestUpdate();\n },\n );\n\n this.__convertTypeToVariantAndColor();\n }\n\n override render() {\n const isLink = this.__isLink();\n\n const cssClasses = {\n button: true,\n 'button-element': true,\n [`size-${this.size}`]: true,\n [`variant-${this.variant}`]: true,\n [`color-${this.color}`]: true,\n disabled: this.disabled || this.softDisabled,\n pressed: this.isPressed,\n 'has-content': this.slotHasContent,\n 'show-skeleton': this.skeleton,\n [`icon-align-${this.iconAlign}`]: true,\n };\n\n if (!isLink) {\n return html`<button\n class=${classMap(cssClasses)}\n id=\"button\"\n tabindex=${this.#tabindex}\n type=${this.htmlType}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n ?aria-describedby=${this.__getDisabledReasonID()}\n aria-disabled=${`${this.disabled || this.softDisabled}`}\n ?disabled=${this.disabled}\n ${spread(this.configAria)}\n >\n ${this.renderButtonContent()}\n </button>\n ${this.__renderTooltip()}`;\n }\n return html`<a\n class=${classMap(cssClasses)}\n id=\"button\"\n tabindex=${this.#tabindex}\n href=${this.href}\n target=${this.target}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n role=\"button\"\n ?aria-describedby=${this.__getDisabledReasonID()}\n aria-disabled=${`${this.disabled}`}\n ${spread(this.configAria)}\n >\n ${this.renderButtonContent()}\n </a>\n ${this.__renderTooltip()}`;\n }\n\n renderButtonContent() {\n return html`\n <wc-focus-ring class=\"focus-ring\" .control=${this} element=\"buttonElement\"></wc-focus-ring>\n <wc-elevation class=\"elevation\"></wc-elevation>\n <div class=\"neo-background\"></div>\n <div class=\"background\"></div>\n <div class=\"outline\"></div>\n <wc-ripple class=\"ripple\"></wc-ripple>\n <wc-skeleton class=\"skeleton\"></wc-skeleton>\n\n <div class=\"button-content\">\n <div class=\"slot-container\">\n <slot></slot>\n </div>\n\n <slot name=\"icon\"></slot>\n </div>\n\n ${this.__renderDisabledReason()}\n `;\n }\n}\n"],"names":["Directive","PartType","directive","LitElement","nothing","html","property","state","query","classMap","styles","colorStyles","sizeStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAA,gBAAA,EAAA,GAAA,CAAU;AAClB,aAAA,EAAA,IAAI,CAAC,IAAI;AACP,eAAA,EAAA,IAAI,CAAC,MAAM;AACP,mBAAA,EAAA,IAAI,CAAC,aAAa;AACpB,iBAAA,EAAA,IAAI,CAAC,aAAa;AACpB,eAAA,EAAA,IAAI,CAAC,aAAa;;4BAEP,IAAI,CAAC,qBAAqB,EAAE;wBAChC,CAAA,EAAG,IAAI,CAAC,QAAQ,CAAA,CAAE;AAChC,QAAA,EAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;;UAEvB,IAAI,CAAC,mBAAmB,EAAE;;AAE5B,MAAA,EAAA,IAAI,CAAC,eAAe,EAAE,CAAA,CAAE;IAC9B;IAEA,mBAAmB,GAAA;AACjB,QAAA,OAAOJ,CAAI,CAAA;mDACoC,IAAI,CAAA;;;;;;;;;;;;;;;;QAgB/C,IAAI,CAAC,sBAAsB,EAAE;KAChC;IACH;;;AAvGgB,MAAA,CAAA,MAAM,GAAG,CAACK,UAAM,EAAEC,UAAW,EAAEC,QAAU,CAAnC;AAStB,UAAA,CAAA;AADC,IAAAN,CAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE;AACF,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAG3B,UAAA,CAAA;AADP,IAAAC,CAAK;AACyB,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAbpB,MAAM,GAAA,UAAA,CAAA;IADlB;AACY,CAAA,EAAA,MAAM,CAyGlB;;;;"}
|
package/dist/button.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import './IndividualComponent-tDnXrOLV.js';
|
|
2
|
-
import './
|
|
3
|
-
|
|
4
|
-
export { B as Button } from './button-BGFJfbT2.js';
|
|
2
|
+
import './class-map-hJdvjl-W.js';
|
|
3
|
+
export { B as Button } from './button-trIfcqC7.js';
|
|
5
4
|
import './dispatch-event-utils-B4odODQf.js';
|
|
6
5
|
import './directive-Cuw6h7YA.js';
|
|
7
6
|
import './query-QBcUV-L_.js';
|
package/dist/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { E } from './IndividualComponent-tDnXrOLV.js';
|
|
1
|
+
import { n, E } from './IndividualComponent-tDnXrOLV.js';
|
|
2
2
|
import { e as e$1, i, t } from './directive-Cuw6h7YA.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2017 Google LLC
|
|
7
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
|
+
*/function r(r){return n({...r,state:true,attribute:false})}
|
|
9
|
+
|
|
4
10
|
/**
|
|
5
11
|
* @license
|
|
6
12
|
* Copyright 2018 Google LLC
|
|
7
13
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
14
|
*/const e=e$1(class extends i{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter(s=>t[s]).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return E}});
|
|
9
15
|
|
|
10
|
-
export { e };
|
|
11
|
-
//# sourceMappingURL=class-map-
|
|
16
|
+
export { e, r };
|
|
17
|
+
//# sourceMappingURL=class-map-hJdvjl-W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-map-hJdvjl-W.js","sources":["../node_modules/@lit/reactive-element/decorators/state.js","../node_modules/lit-html/directives/class-map.js"],"sourcesContent":["import{property as t}from\"./property.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function r(r){return t({...r,state:!0,attribute:!1})}export{r as state};\n//# sourceMappingURL=state.js.map\n","import{noChange as t}from\"../lit-html.js\";import{directive as s,Directive as i,PartType as r}from\"../directive.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const e=s(class extends i{constructor(t){if(super(t),t.type!==r.ATTRIBUTE||\"class\"!==t.name||t.strings?.length>2)throw Error(\"`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.\")}render(t){return\" \"+Object.keys(t).filter(s=>t[s]).join(\" \")+\" \"}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(\" \").split(/\\s/).filter(t=>\"\"!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)))}return t}});export{e as classMap};\n//# sourceMappingURL=class-map.js.map\n"],"names":["t","s","r"],"mappings":";;;AACA;AACA;AACA;AACA;AACA,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAOA,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAE,CAAC,SAAS,CAAC,KAAE,CAAC,CAAC;;ACJvD;AACA;AACA;AACA;AACA,GAAQ,MAAC,CAAC,CAACC,GAAC,CAAC,cAAc,CAAC,CAAC,WAAW,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,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,OAAOA,CAAC,CAAC,CAAC;;;;","x_google_ignoreList":[0,1]}
|
package/dist/code-editor.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { i, _ as __decorate, n, I as IndividualComponent, A, b } from './IndividualComponent-tDnXrOLV.js';
|
|
2
|
-
import { r } from './
|
|
2
|
+
import { r, e as e$1 } from './class-map-hJdvjl-W.js';
|
|
3
3
|
import { e } from './query-QBcUV-L_.js';
|
|
4
|
-
import { e as e$1 } from './class-map-DpeNtqCn.js';
|
|
5
4
|
import { B as BaseInput, o as observeThemeChange } from './observe-theme-change-BISF-Gl5.js';
|
|
6
5
|
import { a as isDarkMode, r as redispatchEvent } from './dispatch-event-utils-B4odODQf.js';
|
|
7
6
|
import './directive-Cuw6h7YA.js';
|
|
@@ -43717,7 +43716,7 @@ self.MonacoEnvironment = {
|
|
|
43717
43716
|
};
|
|
43718
43717
|
/**
|
|
43719
43718
|
* @label Code Editor
|
|
43720
|
-
* @tag code-editor
|
|
43719
|
+
* @tag wc-code-editor
|
|
43721
43720
|
* @rawTag code-editor
|
|
43722
43721
|
*
|
|
43723
43722
|
* @summary A Monaco-based code editing component with syntax highlighting and theming.
|
|
@@ -43728,12 +43727,13 @@ self.MonacoEnvironment = {
|
|
|
43728
43727
|
*
|
|
43729
43728
|
* @example
|
|
43730
43729
|
* ```html
|
|
43731
|
-
* <code-editor
|
|
43730
|
+
* <wc-code-editor
|
|
43732
43731
|
* language="javascript"
|
|
43732
|
+
* style="width: 100%; --code-editor-height: 10rem;"
|
|
43733
43733
|
* value="function hello() { console.log('Hello'); }"
|
|
43734
43734
|
* lineNumbers="on"
|
|
43735
43735
|
* minimap="false">
|
|
43736
|
-
* </code-editor>
|
|
43736
|
+
* </wc-code-editor>
|
|
43737
43737
|
* ```
|
|
43738
43738
|
* @tags input, editor
|
|
43739
43739
|
*/
|