@redvars/peacock 3.2.7 → 3.2.9
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/PeacockComponent-CxJc63xj.js +73 -0
- package/dist/PeacockComponent-CxJc63xj.js.map +1 -0
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/button-2MeDq0Yy.js +898 -0
- package/dist/button-2MeDq0Yy.js.map +1 -0
- package/dist/button-group.js +7 -5
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +7 -0
- package/dist/button.js.map +1 -0
- package/dist/{class-map-BmCohX9p.js → class-map-BvQRv7eW.js} +2 -2
- package/dist/{class-map-BmCohX9p.js.map → class-map-BvQRv7eW.js.map} +1 -1
- package/dist/clock.js +26 -24
- package/dist/clock.js.map +1 -1
- package/dist/code-editor.js +43877 -0
- package/dist/code-editor.js.map +1 -0
- package/dist/code-highlighter.js +9 -7
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +561 -0
- package/dist/custom-elements.json +838 -227
- package/dist/{utils-DGMeCC48.js → dispatch-event-utils-vbdiOSeC.js} +19 -2
- package/dist/dispatch-event-utils-vbdiOSeC.js.map +1 -0
- package/dist/image-DK6VQW7N.js +7042 -0
- package/dist/image-DK6VQW7N.js.map +1 -0
- package/dist/index.js +10 -33
- package/dist/index.js.map +1 -1
- package/dist/number-counter.js +7 -5
- package/dist/number-counter.js.map +1 -1
- package/dist/observe-theme-change-NneLARW8.js +51 -0
- package/dist/observe-theme-change-NneLARW8.js.map +1 -0
- package/dist/peacock-loader.js +973 -37
- package/dist/peacock-loader.js.map +1 -1
- package/dist/src/PeacockComponent.d.ts +1 -0
- package/dist/src/code-editor/code-editor.d.ts +45 -0
- package/dist/src/code-editor/index.d.ts +2 -0
- package/dist/src/image/image.d.ts +45 -0
- package/dist/src/image/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/utils/dispatch-event-utils.d.ts +72 -0
- package/dist/src/utils/observe-theme-change.d.ts +3 -0
- package/dist/src/utils.d.ts +1 -72
- package/dist/{state-CV1fRmOT.js → state-B09bP3XH.js} +2 -2
- package/dist/{state-CV1fRmOT.js.map → state-B09bP3XH.js.map} +1 -1
- package/dist/{style-map-CdmclYgz.js → style-map-B8xgVEc9.js} +2 -2
- package/dist/{style-map-CdmclYgz.js.map → style-map-B8xgVEc9.js.map} +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-BS8X6Gto.js → unsafe-html-B-dV3Jps.js} +2 -2
- package/dist/{unsafe-html-BS8X6Gto.js.map → unsafe-html-B-dV3Jps.js.map} +1 -1
- package/package.json +5 -3
- package/readme.md +2 -2
- package/scss/styles.scss +57 -1
- package/scss/tokens.css +1 -0
- package/src/PeacockComponent.ts +3 -0
- package/src/accordion/accordion-item/accordion-item.scss +1 -1
- package/src/button/BaseButton.ts +1 -1
- package/src/button/button/button.ts +3 -1
- package/src/button/button-group/button-group.ts +2 -0
- package/src/clock/clock.ts +4 -1
- package/src/code-editor/code-editor.scss +52 -0
- package/src/code-editor/code-editor.ts +215 -0
- package/src/code-editor/demo/index.html +37 -0
- package/src/code-editor/index.ts +3 -0
- package/src/code-highlighter/code-highlighter.ts +2 -0
- package/src/container/container.scss +1 -1
- package/src/date-picker/date-picker.ts +1 -1
- package/src/image/image.scss +49 -0
- package/src/image/image.ts +135 -0
- package/src/image/index.ts +1 -0
- package/src/index.ts +2 -0
- package/src/input/input.ts +1 -2
- package/src/menu/menu-item/menu-item.scss +5 -4
- package/src/menu/menu-list/menu-list.scss +1 -0
- package/src/number-counter/number-counter.ts +2 -0
- package/src/number-field/number-field.ts +1 -1
- package/src/peacock-loader.ts +7 -0
- package/src/textarea/textarea.ts +1 -1
- package/src/time-picker/time-picker.ts +1 -1
- package/src/utils/dispatch-event-utils.ts +131 -0
- package/src/utils/observe-theme-change.ts +30 -0
- package/src/utils.ts +5 -131
- package/dist/BaseButton.js +0 -209
- package/dist/BaseButton.js.map +0 -1
- package/dist/BaseInput.js +0 -27
- package/dist/BaseInput.js.map +0 -1
- package/dist/accordion-item.js +0 -191
- package/dist/accordion-item.js.map +0 -1
- package/dist/accordion.js +0 -142
- package/dist/accordion.js.map +0 -1
- package/dist/avatar.js +0 -106
- package/dist/avatar.js.map +0 -1
- package/dist/badge.js +0 -84
- package/dist/badge.js.map +0 -1
- package/dist/base-progress.js +0 -33
- package/dist/base-progress.js.map +0 -1
- package/dist/breadcrumb-item.js +0 -160
- package/dist/breadcrumb-item.js.map +0 -1
- package/dist/breadcrumb.js +0 -84
- package/dist/breadcrumb.js.map +0 -1
- package/dist/checkbox.js +0 -530
- package/dist/checkbox.js.map +0 -1
- package/dist/chip.js +0 -303
- package/dist/chip.js.map +0 -1
- package/dist/container.js +0 -135
- package/dist/container.js.map +0 -1
- package/dist/divider.js +0 -126
- package/dist/divider.js.map +0 -1
- package/dist/elevation.js +0 -79
- package/dist/elevation.js.map +0 -1
- package/dist/empty-state.js +0 -171
- package/dist/empty-state.js.map +0 -1
- package/dist/field.js +0 -416
- package/dist/field.js.map +0 -1
- package/dist/focus-ring.js +0 -107
- package/dist/focus-ring.js.map +0 -1
- package/dist/icon.js +0 -183
- package/dist/icon.js.map +0 -1
- package/dist/link.js +0 -91
- package/dist/link.js.map +0 -1
- package/dist/lit-element-CA46RFZ_.js +0 -28
- package/dist/lit-element-CA46RFZ_.js.map +0 -1
- package/dist/menu-item.js +0 -232
- package/dist/menu-item.js.map +0 -1
- package/dist/menu-list.js +0 -108
- package/dist/menu-list.js.map +0 -1
- package/dist/menu.js +0 -117
- package/dist/menu.js.map +0 -1
- package/dist/property-DNVWDdPC.js +0 -45
- package/dist/property-DNVWDdPC.js.map +0 -1
- package/dist/query-QBcUV-L_.js +0 -15
- package/dist/query-QBcUV-L_.js.map +0 -1
- package/dist/ripple.js +0 -128
- package/dist/ripple.js.map +0 -1
- package/dist/skeleton.js +0 -113
- package/dist/skeleton.js.map +0 -1
- package/dist/spinner.js +0 -93
- package/dist/spinner.js.map +0 -1
- package/dist/spread-axRTFMoH.js +0 -32
- package/dist/spread-axRTFMoH.js.map +0 -1
- package/dist/switch-DqxIiVsB.js +0 -2738
- package/dist/switch-DqxIiVsB.js.map +0 -1
- package/dist/tag.js +0 -323
- package/dist/tag.js.map +0 -1
- package/dist/tooltip.js +0 -1857
- package/dist/tooltip.js.map +0 -1
- package/dist/utils-DGMeCC48.js.map +0 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Dispatches a click event to the given element that triggers a native action,
|
|
4
|
+
* but is not composed and therefore is not seen outside the element.
|
|
5
|
+
*
|
|
6
|
+
* This is useful for responding to an external click event on the host element
|
|
7
|
+
* that should trigger an internal action like a button click.
|
|
8
|
+
*
|
|
9
|
+
* Note, a helper is provided because setting this up correctly is a bit tricky.
|
|
10
|
+
* In particular, calling `click` on an element creates a composed event, which
|
|
11
|
+
* is not desirable, and a manually dispatched event must specifically be a
|
|
12
|
+
* `MouseEvent` to trigger a native action.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* hostClickListener = (event: MouseEvent) {
|
|
16
|
+
* if (isActivationClick(event)) {
|
|
17
|
+
* this.dispatchActivationClick(this.buttonElement);
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export function dispatchActivationClick(element: HTMLElement) {
|
|
23
|
+
const event = new MouseEvent('click', { bubbles: true });
|
|
24
|
+
element.dispatchEvent(event);
|
|
25
|
+
return event;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Ignore events for one microtask only.
|
|
29
|
+
let isSquelchingEvents = false;
|
|
30
|
+
async function __squelchEventsForMicrotask() {
|
|
31
|
+
isSquelchingEvents = true;
|
|
32
|
+
// Need to pause for just one microtask.
|
|
33
|
+
// tslint:disable-next-line
|
|
34
|
+
await null;
|
|
35
|
+
isSquelchingEvents = false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// TODO(https://bugzilla.mozilla.org/show_bug.cgi?id=1804576)
|
|
39
|
+
// Remove when Firefox bug is addressed.
|
|
40
|
+
function __squelchEvent(event: Event) {
|
|
41
|
+
const squelched = isSquelchingEvents;
|
|
42
|
+
if (squelched) {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
event.stopImmediatePropagation();
|
|
45
|
+
}
|
|
46
|
+
__squelchEventsForMicrotask();
|
|
47
|
+
return squelched;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns true if the click event should trigger an activation behavior. The
|
|
52
|
+
* behavior is defined by the element and is whatever it should do when
|
|
53
|
+
* clicked.
|
|
54
|
+
*
|
|
55
|
+
* Typically when an element needs to handle a click, the click is generated
|
|
56
|
+
* from within the element and an event listener within the element implements
|
|
57
|
+
* the needed behavior; however, it's possible to fire a click directly
|
|
58
|
+
* at the element that the element should handle. This method helps
|
|
59
|
+
* distinguish these "external" clicks.
|
|
60
|
+
*
|
|
61
|
+
* An "external" click can be triggered in a number of ways: via a click
|
|
62
|
+
* on an associated label for a form associated element, calling
|
|
63
|
+
* `element.click()`, or calling
|
|
64
|
+
* `element.dispatchEvent(new MouseEvent('click', ...))`.
|
|
65
|
+
*
|
|
66
|
+
* Also works around Firefox issue
|
|
67
|
+
* https://bugzilla.mozilla.org/show_bug.cgi?id=1804576 by squelching
|
|
68
|
+
* events for a microtask after called.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* hostClickListener = (event: MouseEvent) {
|
|
72
|
+
* if (isActivationClick(event)) {
|
|
73
|
+
* this.dispatchActivationClick(this.buttonElement);
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
export function isActivationClick(event: Event) {
|
|
79
|
+
// Event must start at the event target.
|
|
80
|
+
if (event.currentTarget !== event.target) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
// Event must not be retargeted from shadowRoot.
|
|
84
|
+
if (event.composedPath()[0] !== event.target) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
// Target must not be disabled; this should only occur for a synthetically
|
|
88
|
+
// dispatched click.
|
|
89
|
+
if ((event.target as EventTarget & { disabled: boolean }).disabled) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
// This is an activation if the event should not be squelched.
|
|
93
|
+
return !__squelchEvent(event);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Re-dispatches an event from the provided element.
|
|
98
|
+
*
|
|
99
|
+
* This function is useful for forwarding non-composed events, such as `change`
|
|
100
|
+
* events.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* class MyInput extends LitElement {
|
|
104
|
+
* render() {
|
|
105
|
+
* return html`<input @change=${this.redispatchEvent}>`;
|
|
106
|
+
* }
|
|
107
|
+
*
|
|
108
|
+
* protected redispatchEvent(event: Event) {
|
|
109
|
+
* redispatchEvent(this, event);
|
|
110
|
+
* }
|
|
111
|
+
* }
|
|
112
|
+
*
|
|
113
|
+
* @param element The element to dispatch the event from.
|
|
114
|
+
* @param event The event to re-dispatch.
|
|
115
|
+
* @return Whether or not the event was dispatched (if cancelable).
|
|
116
|
+
*/
|
|
117
|
+
export function redispatchEvent(element: Element, event: Event) {
|
|
118
|
+
// For bubbling events in SSR light DOM (or composed), stop their propagation
|
|
119
|
+
// and dispatch the copy.
|
|
120
|
+
if (event.bubbles && (!element.shadowRoot || event.composed)) {
|
|
121
|
+
event.stopPropagation();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const copy = Reflect.construct(event.constructor, [event.type, event]);
|
|
125
|
+
const dispatched = element.dispatchEvent(copy);
|
|
126
|
+
if (!dispatched) {
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return dispatched;
|
|
131
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type ThemeChangeCallback = () => void;
|
|
2
|
+
|
|
3
|
+
export const observeThemeChange = (() => {
|
|
4
|
+
const callbacks = new Set<ThemeChangeCallback>();
|
|
5
|
+
|
|
6
|
+
const observer = new MutationObserver((records) => {
|
|
7
|
+
const changed = records.some(
|
|
8
|
+
(r) => r.type === "attributes" && r.attributeName === "data-theme"
|
|
9
|
+
);
|
|
10
|
+
if (!changed) return;
|
|
11
|
+
|
|
12
|
+
for (const callback of callbacks) {
|
|
13
|
+
try {
|
|
14
|
+
callback();
|
|
15
|
+
} catch (err) {
|
|
16
|
+
console.error("[observeThemeChange] callback threw:", err);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
observer.observe(document.documentElement, {
|
|
22
|
+
attributes: true,
|
|
23
|
+
attributeFilter: ["data-theme"],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return (callback: ThemeChangeCallback): (() => void) => {
|
|
27
|
+
callbacks.add(callback);
|
|
28
|
+
return () => callbacks.delete(callback);
|
|
29
|
+
};
|
|
30
|
+
})();
|
package/src/utils.ts
CHANGED
|
@@ -180,140 +180,14 @@ export function throttle(
|
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
/**
|
|
184
|
-
* Dispatches a click event to the given element that triggers a native action,
|
|
185
|
-
* but is not composed and therefore is not seen outside the element.
|
|
186
|
-
*
|
|
187
|
-
* This is useful for responding to an external click event on the host element
|
|
188
|
-
* that should trigger an internal action like a button click.
|
|
189
|
-
*
|
|
190
|
-
* Note, a helper is provided because setting this up correctly is a bit tricky.
|
|
191
|
-
* In particular, calling `click` on an element creates a composed event, which
|
|
192
|
-
* is not desirable, and a manually dispatched event must specifically be a
|
|
193
|
-
* `MouseEvent` to trigger a native action.
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* hostClickListener = (event: MouseEvent) {
|
|
197
|
-
* if (isActivationClick(event)) {
|
|
198
|
-
* this.dispatchActivationClick(this.buttonElement);
|
|
199
|
-
* }
|
|
200
|
-
* }
|
|
201
|
-
*
|
|
202
|
-
*/
|
|
203
|
-
export function dispatchActivationClick(element: HTMLElement) {
|
|
204
|
-
const event = new MouseEvent('click', { bubbles: true });
|
|
205
|
-
element.dispatchEvent(event);
|
|
206
|
-
return event;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// Ignore events for one microtask only.
|
|
210
|
-
let isSquelchingEvents = false;
|
|
211
|
-
async function __squelchEventsForMicrotask() {
|
|
212
|
-
isSquelchingEvents = true;
|
|
213
|
-
// Need to pause for just one microtask.
|
|
214
|
-
// tslint:disable-next-line
|
|
215
|
-
await null;
|
|
216
|
-
isSquelchingEvents = false;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// TODO(https://bugzilla.mozilla.org/show_bug.cgi?id=1804576)
|
|
220
|
-
// Remove when Firefox bug is addressed.
|
|
221
|
-
function __squelchEvent(event: Event) {
|
|
222
|
-
const squelched = isSquelchingEvents;
|
|
223
|
-
if (squelched) {
|
|
224
|
-
event.preventDefault();
|
|
225
|
-
event.stopImmediatePropagation();
|
|
226
|
-
}
|
|
227
|
-
__squelchEventsForMicrotask();
|
|
228
|
-
return squelched;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Returns true if the click event should trigger an activation behavior. The
|
|
233
|
-
* behavior is defined by the element and is whatever it should do when
|
|
234
|
-
* clicked.
|
|
235
|
-
*
|
|
236
|
-
* Typically when an element needs to handle a click, the click is generated
|
|
237
|
-
* from within the element and an event listener within the element implements
|
|
238
|
-
* the needed behavior; however, it's possible to fire a click directly
|
|
239
|
-
* at the element that the element should handle. This method helps
|
|
240
|
-
* distinguish these "external" clicks.
|
|
241
|
-
*
|
|
242
|
-
* An "external" click can be triggered in a number of ways: via a click
|
|
243
|
-
* on an associated label for a form associated element, calling
|
|
244
|
-
* `element.click()`, or calling
|
|
245
|
-
* `element.dispatchEvent(new MouseEvent('click', ...))`.
|
|
246
|
-
*
|
|
247
|
-
* Also works around Firefox issue
|
|
248
|
-
* https://bugzilla.mozilla.org/show_bug.cgi?id=1804576 by squelching
|
|
249
|
-
* events for a microtask after called.
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
* hostClickListener = (event: MouseEvent) {
|
|
253
|
-
* if (isActivationClick(event)) {
|
|
254
|
-
* this.dispatchActivationClick(this.buttonElement);
|
|
255
|
-
* }
|
|
256
|
-
* }
|
|
257
|
-
*
|
|
258
|
-
*/
|
|
259
|
-
export function isActivationClick(event: Event) {
|
|
260
|
-
// Event must start at the event target.
|
|
261
|
-
if (event.currentTarget !== event.target) {
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
// Event must not be retargeted from shadowRoot.
|
|
265
|
-
if (event.composedPath()[0] !== event.target) {
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
// Target must not be disabled; this should only occur for a synthetically
|
|
269
|
-
// dispatched click.
|
|
270
|
-
if ((event.target as EventTarget & { disabled: boolean }).disabled) {
|
|
271
|
-
return false;
|
|
272
|
-
}
|
|
273
|
-
// This is an activation if the event should not be squelched.
|
|
274
|
-
return !__squelchEvent(event);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Re-dispatches an event from the provided element.
|
|
279
|
-
*
|
|
280
|
-
* This function is useful for forwarding non-composed events, such as `change`
|
|
281
|
-
* events.
|
|
282
|
-
*
|
|
283
|
-
* @example
|
|
284
|
-
* class MyInput extends LitElement {
|
|
285
|
-
* render() {
|
|
286
|
-
* return html`<input @change=${this.redispatchEvent}>`;
|
|
287
|
-
* }
|
|
288
|
-
*
|
|
289
|
-
* protected redispatchEvent(event: Event) {
|
|
290
|
-
* redispatchEvent(this, event);
|
|
291
|
-
* }
|
|
292
|
-
* }
|
|
293
|
-
*
|
|
294
|
-
* @param element The element to dispatch the event from.
|
|
295
|
-
* @param event The event to re-dispatch.
|
|
296
|
-
* @return Whether or not the event was dispatched (if cancelable).
|
|
297
|
-
*/
|
|
298
|
-
export function redispatchEvent(element: Element, event: Event) {
|
|
299
|
-
// For bubbling events in SSR light DOM (or composed), stop their propagation
|
|
300
|
-
// and dispatch the copy.
|
|
301
|
-
if (event.bubbles && (!element.shadowRoot || event.composed)) {
|
|
302
|
-
event.stopPropagation();
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const copy = Reflect.construct(event.constructor, [event.type, event]);
|
|
306
|
-
const dispatched = element.dispatchEvent(copy);
|
|
307
|
-
if (!dispatched) {
|
|
308
|
-
event.preventDefault();
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return dispatched;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
183
|
export function isInViewport(element: HTMLElement) {
|
|
315
184
|
const rect = element.getBoundingClientRect();
|
|
316
185
|
return (
|
|
317
186
|
rect.top !== 0 || rect.left !== 0 || rect.bottom !== 0 || rect.right !== 0
|
|
318
187
|
);
|
|
319
188
|
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
export function isDarkMode() {
|
|
192
|
+
return document.documentElement.dataset.theme === 'dark';
|
|
193
|
+
};
|
package/dist/BaseButton.js
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import { _ as __decorate, n, a as __classPrivateFieldGet } from './property-DNVWDdPC.js';
|
|
2
|
-
import { a as i, A, b } from './lit-element-CA46RFZ_.js';
|
|
3
|
-
import { r } from './state-CV1fRmOT.js';
|
|
4
|
-
import { e } from './query-QBcUV-L_.js';
|
|
5
|
-
import { i as isActivationClick, d as dispatchActivationClick } from './utils-DGMeCC48.js';
|
|
6
|
-
|
|
7
|
-
var _BaseButton_id;
|
|
8
|
-
class BaseButton extends i {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
_BaseButton_id.set(this, crypto.randomUUID());
|
|
12
|
-
this.htmlType = 'button';
|
|
13
|
-
/**
|
|
14
|
-
* The visual style of the button.
|
|
15
|
-
*
|
|
16
|
-
* Possible variant values:
|
|
17
|
-
* `"filled"` is a filled button.
|
|
18
|
-
* `"outlined"` is an outlined button.
|
|
19
|
-
* `"text"` is a transparent button.
|
|
20
|
-
* `"tonal"` is a light color button.
|
|
21
|
-
* `"elevated"` is elevated button
|
|
22
|
-
*/
|
|
23
|
-
this.variant = 'filled';
|
|
24
|
-
/**
|
|
25
|
-
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
26
|
-
*/
|
|
27
|
-
this.color = 'primary';
|
|
28
|
-
/**
|
|
29
|
-
* Button size.
|
|
30
|
-
* Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`.
|
|
31
|
-
*/
|
|
32
|
-
this.size = 'sm';
|
|
33
|
-
/**
|
|
34
|
-
* If true, the user cannot interact with the button. Defaults to `false`.
|
|
35
|
-
*/
|
|
36
|
-
this.disabled = false;
|
|
37
|
-
this.skeleton = false;
|
|
38
|
-
/**
|
|
39
|
-
* 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`.
|
|
40
|
-
*/
|
|
41
|
-
this.softDisabled = false;
|
|
42
|
-
/**
|
|
43
|
-
* If button is disabled, the reason why it is disabled.
|
|
44
|
-
*/
|
|
45
|
-
this.disabledReason = '';
|
|
46
|
-
/**
|
|
47
|
-
* Sets or retrieves the window or frame at which to target content.
|
|
48
|
-
*/
|
|
49
|
-
this.target = '_self';
|
|
50
|
-
this.selected = false;
|
|
51
|
-
/**
|
|
52
|
-
* Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
|
|
53
|
-
*/
|
|
54
|
-
this.throttleDelay = 200;
|
|
55
|
-
/**
|
|
56
|
-
* States
|
|
57
|
-
*/
|
|
58
|
-
this.isPressed = false;
|
|
59
|
-
this.__handlePress = (event) => {
|
|
60
|
-
if (this.disabled || this.skeleton || this.softDisabled)
|
|
61
|
-
return;
|
|
62
|
-
if (event instanceof KeyboardEvent &&
|
|
63
|
-
event.type === 'keydown' &&
|
|
64
|
-
(event.key === 'Enter' || event.key === ' ')) {
|
|
65
|
-
this.isPressed = true;
|
|
66
|
-
}
|
|
67
|
-
else if (event.type === 'mousedown') {
|
|
68
|
-
this.isPressed = true;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
this.isPressed = false;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
this.__dispatchClickWithThrottle = event => {
|
|
75
|
-
this.__dispatchClick(event);
|
|
76
|
-
};
|
|
77
|
-
this.__dispatchClick = (event) => {
|
|
78
|
-
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
79
|
-
// prevent the click from propagating to other event listeners as well as
|
|
80
|
-
// prevent the default action.
|
|
81
|
-
if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {
|
|
82
|
-
event.stopImmediatePropagation();
|
|
83
|
-
event.preventDefault();
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (!isActivationClick(event) || !this.buttonElement) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
this.focus();
|
|
90
|
-
dispatchActivationClick(this.buttonElement);
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
focus() {
|
|
94
|
-
this.buttonElement?.focus();
|
|
95
|
-
}
|
|
96
|
-
blur() {
|
|
97
|
-
this.buttonElement?.blur();
|
|
98
|
-
}
|
|
99
|
-
connectedCallback() {
|
|
100
|
-
super.connectedCallback();
|
|
101
|
-
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
102
|
-
window.addEventListener('mouseup', this.__handlePress);
|
|
103
|
-
}
|
|
104
|
-
disconnectedCallback() {
|
|
105
|
-
window.removeEventListener('mouseup', this.__handlePress);
|
|
106
|
-
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
107
|
-
super.disconnectedCallback();
|
|
108
|
-
}
|
|
109
|
-
__isLink() {
|
|
110
|
-
return !!this.href;
|
|
111
|
-
}
|
|
112
|
-
__convertTypeToVariantAndColor() {
|
|
113
|
-
if (this.type === 'primary') {
|
|
114
|
-
this.color = 'primary';
|
|
115
|
-
this.variant = 'filled';
|
|
116
|
-
}
|
|
117
|
-
else if (this.type === 'secondary') {
|
|
118
|
-
this.color = 'dark';
|
|
119
|
-
this.variant = 'outlined';
|
|
120
|
-
}
|
|
121
|
-
else if (this.type === 'tertiary') {
|
|
122
|
-
this.color = 'primary';
|
|
123
|
-
this.variant = 'text';
|
|
124
|
-
}
|
|
125
|
-
else if (this.type === 'danger') {
|
|
126
|
-
this.color = 'danger';
|
|
127
|
-
this.variant = 'filled';
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
__getDisabledReasonID() {
|
|
131
|
-
return this.disabled && this.disabledReason
|
|
132
|
-
? `disabled-reason-${__classPrivateFieldGet(this, _BaseButton_id, "f")}`
|
|
133
|
-
: A;
|
|
134
|
-
}
|
|
135
|
-
__renderDisabledReason() {
|
|
136
|
-
const disabledReasonID = this.__getDisabledReasonID();
|
|
137
|
-
if (disabledReasonID)
|
|
138
|
-
return b `<div
|
|
139
|
-
id="disabled-reason-${__classPrivateFieldGet(this, _BaseButton_id, "f")}"
|
|
140
|
-
role="tooltip"
|
|
141
|
-
aria-label=${this.disabledReason}
|
|
142
|
-
class="screen-reader-only"
|
|
143
|
-
>
|
|
144
|
-
{this.disabledReason}
|
|
145
|
-
</div>`;
|
|
146
|
-
return A;
|
|
147
|
-
}
|
|
148
|
-
__renderTooltip() {
|
|
149
|
-
if (this.tooltip) {
|
|
150
|
-
return b `<base-tooltip for="button">${this.tooltip}</base-tooltip>`;
|
|
151
|
-
}
|
|
152
|
-
return A;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
_BaseButton_id = new WeakMap();
|
|
156
|
-
__decorate([
|
|
157
|
-
n({ type: String })
|
|
158
|
-
], BaseButton.prototype, "htmlType", void 0);
|
|
159
|
-
__decorate([
|
|
160
|
-
n({ type: String })
|
|
161
|
-
], BaseButton.prototype, "type", void 0);
|
|
162
|
-
__decorate([
|
|
163
|
-
n()
|
|
164
|
-
], BaseButton.prototype, "variant", void 0);
|
|
165
|
-
__decorate([
|
|
166
|
-
n({ reflect: true })
|
|
167
|
-
], BaseButton.prototype, "color", void 0);
|
|
168
|
-
__decorate([
|
|
169
|
-
n()
|
|
170
|
-
], BaseButton.prototype, "size", void 0);
|
|
171
|
-
__decorate([
|
|
172
|
-
n({ type: Boolean, reflect: true })
|
|
173
|
-
], BaseButton.prototype, "disabled", void 0);
|
|
174
|
-
__decorate([
|
|
175
|
-
n()
|
|
176
|
-
], BaseButton.prototype, "skeleton", void 0);
|
|
177
|
-
__decorate([
|
|
178
|
-
n({ reflect: true, attribute: 'soft-disabled' })
|
|
179
|
-
], BaseButton.prototype, "softDisabled", void 0);
|
|
180
|
-
__decorate([
|
|
181
|
-
n({ attribute: 'disabled-reason' })
|
|
182
|
-
], BaseButton.prototype, "disabledReason", void 0);
|
|
183
|
-
__decorate([
|
|
184
|
-
n({ reflect: true })
|
|
185
|
-
], BaseButton.prototype, "href", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
n({ reflect: true })
|
|
188
|
-
], BaseButton.prototype, "configAria", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
n()
|
|
191
|
-
], BaseButton.prototype, "target", void 0);
|
|
192
|
-
__decorate([
|
|
193
|
-
n()
|
|
194
|
-
], BaseButton.prototype, "selected", void 0);
|
|
195
|
-
__decorate([
|
|
196
|
-
n()
|
|
197
|
-
], BaseButton.prototype, "throttleDelay", void 0);
|
|
198
|
-
__decorate([
|
|
199
|
-
n()
|
|
200
|
-
], BaseButton.prototype, "tooltip", void 0);
|
|
201
|
-
__decorate([
|
|
202
|
-
r()
|
|
203
|
-
], BaseButton.prototype, "isPressed", void 0);
|
|
204
|
-
__decorate([
|
|
205
|
-
e('.button')
|
|
206
|
-
], BaseButton.prototype, "buttonElement", void 0);
|
|
207
|
-
|
|
208
|
-
export { BaseButton };
|
|
209
|
-
//# sourceMappingURL=BaseButton.js.map
|
package/dist/BaseButton.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseButton.js","sources":["../../src/button/BaseButton.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { dispatchActivationClick, isActivationClick } from '../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`<base-tooltip for=\"button\">${this.tooltip}</base-tooltip>`;\n }\n return nothing;\n }\n}\n"],"names":["LitElement","nothing","html","property","state","query"],"mappings":";;;;;;;AAIM,MAAO,UAAW,SAAQA,CAAU,CAAA;AAA1C,IAAA,WAAA,GAAA;;AACE,QAAA,cAAA,CAAA,GAAA,CAAA,IAAA,EAAM,MAAM,CAAC,UAAU,EAAE,CAAA;QAEG,IAAA,CAAA,QAAQ,GAClC,QAAQ;AAQV;;;;;;;;;AASG;QACS,IAAA,CAAA,OAAO,GAMP,QAAQ;AAEpB;;AAEG;QAC0B,IAAA,CAAA,KAAK,GAMrB,SAAS;AAEtB;;;AAGG;QACS,IAAA,CAAA,IAAI,GAAqC,IAAI;AAEzD;;AAEG;QAEH,IAAA,CAAA,QAAQ,GAAY,KAAK;QAEb,IAAA,CAAA,QAAQ,GAAY,KAAK;AAErC;;AAEG;QAEH,IAAA,CAAA,YAAY,GAAY,KAAK;AAE7B;;AAEG;QAEH,IAAA,CAAA,cAAc,GAAW,EAAE;AAU3B;;AAEG;QACS,IAAA,CAAA,MAAM,GAAW,OAAO;QAExB,IAAA,CAAA,QAAQ,GAAY,KAAK;AAErC;;AAEG;QACS,IAAA,CAAA,aAAa,GAAG,GAAG;AAI/B;;AAEG;QAEH,IAAA,CAAA,SAAS,GAAG,KAAK;AAwBjB,QAAA,IAAA,CAAA,aAAa,GAAG,CAAC,KAAiC,KAAI;YACpD,IAA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AAA,CAAA;IAA1BC,CAAK,CAAC,SAAS;AAA8C,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;;;;"}
|
package/dist/BaseInput.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { _ as __decorate, n } from './property-DNVWDdPC.js';
|
|
2
|
-
import { a as i } from './lit-element-CA46RFZ_.js';
|
|
3
|
-
|
|
4
|
-
class BaseInput extends i {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.disabled = false;
|
|
8
|
-
this.readonly = false;
|
|
9
|
-
this.required = false;
|
|
10
|
-
this.skeleton = false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
__decorate([
|
|
14
|
-
n({ type: Boolean, reflect: true })
|
|
15
|
-
], BaseInput.prototype, "disabled", void 0);
|
|
16
|
-
__decorate([
|
|
17
|
-
n({ type: Boolean, reflect: true })
|
|
18
|
-
], BaseInput.prototype, "readonly", void 0);
|
|
19
|
-
__decorate([
|
|
20
|
-
n({ type: Boolean, reflect: true })
|
|
21
|
-
], BaseInput.prototype, "required", void 0);
|
|
22
|
-
__decorate([
|
|
23
|
-
n({ type: Boolean, reflect: true })
|
|
24
|
-
], BaseInput.prototype, "skeleton", void 0);
|
|
25
|
-
|
|
26
|
-
export { BaseInput as default };
|
|
27
|
-
//# sourceMappingURL=BaseInput.js.map
|
package/dist/BaseInput.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInput.js","sources":["../../src/input/BaseInput.ts"],"sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nexport default abstract class BaseInput extends LitElement {\n value?: any;\n\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n readonly: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n required: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n skeleton = false;\n}\n"],"names":["LitElement","property"],"mappings":";;;AAGc,MAAgB,SAAU,SAAQA,CAAU,CAAA;AAA1D,IAAA,WAAA,GAAA;;QAIE,IAAA,CAAA,QAAQ,GAAY,KAAK;QAGzB,IAAA,CAAA,QAAQ,GAAY,KAAK;QAGzB,IAAA,CAAA,QAAQ,GAAY,KAAK;QAGzB,IAAA,CAAA,QAAQ,GAAG,KAAK;IAClB;AAAC;AAVC,UAAA,CAAA;IADCC,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AACzB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;;;;"}
|