@redvars/peacock 3.3.3 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IndividualComponent-DUINtMGK.js +67 -0
- package/dist/IndividualComponent-DUINtMGK.js.map +1 -0
- package/dist/assets/images/empty-state/no-document.svg +11 -12
- package/dist/assets/images/empty-state/page.svg +15 -9
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/banner.js +202 -0
- package/dist/banner.js.map +1 -0
- package/dist/bottom-sheet.js +238 -0
- package/dist/bottom-sheet.js.map +1 -0
- package/dist/{button-ClzS8JLq.js → button-DMN1dPAg.js} +358 -218
- package/dist/button-DMN1dPAg.js.map +1 -0
- package/dist/button-group-CX9CUUXk.js +435 -0
- package/dist/button-group-CX9CUUXk.js.map +1 -0
- package/dist/button-group.js +11 -6
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +10 -5
- package/dist/button.js.map +1 -1
- package/dist/card-content.js +29 -0
- package/dist/card-content.js.map +1 -0
- package/dist/card.js +428 -44
- package/dist/card.js.map +1 -1
- package/dist/{chart-bar-DbnXQgvS.js → chart-bar-cn6rrna-.js} +2 -2
- package/dist/{chart-bar-DbnXQgvS.js.map → chart-bar-cn6rrna-.js.map} +1 -1
- package/dist/chart-bar.js +5 -4
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-doughnut.js +2 -1
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-pie.js +2 -1
- package/dist/chart-pie.js.map +1 -1
- package/dist/chart-stacked-bar.js +5 -4
- package/dist/chart-stacked-bar.js.map +1 -1
- package/dist/{class-map-59YGWLnx.js → class-map-YU7g0o3B.js} +4 -10
- package/dist/class-map-YU7g0o3B.js.map +1 -0
- package/dist/clock.js +2 -1
- package/dist/clock.js.map +1 -1
- package/dist/code-editor.js +8 -6
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +6 -4
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +6270 -5026
- package/dist/custom-elements.json +5763 -2049
- package/dist/directive-ZPhl09Yt.js +9 -0
- package/dist/directive-ZPhl09Yt.js.map +1 -0
- package/dist/dispatch-event-utils-CuEqjlPT.js +127 -0
- package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -0
- package/dist/fab-C5Nzxk0E.js +497 -0
- package/dist/fab-C5Nzxk0E.js.map +1 -0
- package/dist/fab.js +11 -0
- package/dist/fab.js.map +1 -0
- package/dist/index.js +24 -12
- package/dist/index.js.map +1 -1
- package/dist/{observe-theme-change-pALI5fmV.js → is-dark-mode-DicqGkCJ.js} +8 -3
- package/dist/is-dark-mode-DicqGkCJ.js.map +1 -0
- package/dist/notification.js +417 -0
- package/dist/notification.js.map +1 -0
- package/dist/number-counter.js +4 -3
- package/dist/number-counter.js.map +1 -1
- package/dist/observe-slot-change-BGJfgg2E.js +31 -0
- package/dist/observe-slot-change-BGJfgg2E.js.map +1 -0
- package/dist/peacock-loader.js +59 -10
- package/dist/peacock-loader.js.map +1 -1
- package/dist/property-1psGvXOq.js +10 -0
- package/dist/property-1psGvXOq.js.map +1 -0
- package/dist/search.js +452 -0
- package/dist/search.js.map +1 -0
- package/dist/{radio-b70_Ie9n.js → select-4pl4XBj7.js} +2439 -521
- package/dist/select-4pl4XBj7.js.map +1 -0
- package/dist/side-sheet.js +186 -0
- package/dist/side-sheet.js.map +1 -0
- package/dist/spread-B5cgadZl.js +32 -0
- package/dist/spread-B5cgadZl.js.map +1 -0
- package/dist/src/__base_element/BaseHyperlink.d.ts +20 -0
- package/dist/src/__utils/cache-fetch.d.ts +1 -0
- package/dist/src/__utils/is-dark-mode.d.ts +1 -0
- package/dist/src/__utils/is-in-viewport.d.ts +1 -0
- package/dist/src/__utils/observe-slot-change.d.ts +1 -0
- package/dist/src/__utils/sanitize-svg.d.ts +1 -0
- package/dist/src/__utils/throttle.d.ts +4 -0
- package/dist/src/accordion/accordion-item.d.ts +33 -9
- package/dist/src/accordion/accordion.d.ts +21 -5
- package/dist/src/banner/banner.d.ts +47 -0
- package/dist/src/banner/index.d.ts +1 -0
- package/dist/src/bottom-sheet/bottom-sheet.d.ts +42 -0
- package/dist/src/bottom-sheet/index.d.ts +1 -0
- package/dist/src/button/BaseButton.d.ts +7 -13
- package/dist/src/button/button/button.d.ts +4 -0
- package/dist/src/button/button-group/button-group.d.ts +32 -3
- package/dist/src/button/icon-button/icon-button.d.ts +4 -0
- package/dist/src/card/card-content.d.ts +15 -0
- package/dist/src/card/card.d.ts +37 -3
- package/dist/src/card/index.d.ts +1 -0
- package/dist/src/container/container.d.ts +1 -1
- package/dist/src/empty-state/empty-state.d.ts +1 -1
- package/dist/src/fab/fab.d.ts +111 -0
- package/dist/src/fab/index.d.ts +1 -0
- package/dist/src/focus-ring/focus-ring.d.ts +4 -1
- package/dist/src/index.d.ts +11 -1
- package/dist/src/link/link.d.ts +3 -10
- package/dist/src/menu/menu/menu.d.ts +4 -2
- package/dist/src/menu/menu-item/menu-item.d.ts +0 -1
- package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -0
- package/dist/src/notification/index.d.ts +1 -0
- package/dist/src/notification/notification.d.ts +69 -0
- package/dist/src/pagination/pagination.d.ts +8 -1
- package/dist/src/ripple/ripple.d.ts +19 -3
- package/dist/src/search/index.d.ts +1 -0
- package/dist/src/search/search.d.ts +76 -0
- package/dist/src/segmented-button/index.d.ts +2 -0
- package/dist/src/segmented-button/segmented-button-group.d.ts +46 -0
- package/dist/src/segmented-button/segmented-button.d.ts +65 -0
- package/dist/src/select/index.d.ts +3 -0
- package/dist/src/select/option.d.ts +55 -0
- package/dist/src/select/select.d.ts +114 -0
- package/dist/src/side-sheet/index.d.ts +1 -0
- package/dist/src/side-sheet/side-sheet.d.ts +41 -0
- package/dist/src/slider/slider.d.ts +4 -0
- package/dist/src/snackbar/snackbar.d.ts +14 -1
- package/dist/src/tabs/tab-group.d.ts +0 -1
- package/dist/src/tabs/tab.d.ts +8 -2
- package/dist/src/tabs/tabs.d.ts +13 -1
- package/dist/src/toolbar/index.d.ts +1 -0
- package/dist/src/toolbar/toolbar.d.ts +86 -0
- package/dist/state-DwbEjqVk.js +10 -0
- package/dist/state-DwbEjqVk.js.map +1 -0
- package/dist/{style-map-DcB52w-l.js → style-map-DVmWOuYy.js} +3 -3
- package/dist/{style-map-DcB52w-l.js.map → style-map-DVmWOuYy.js.map} +1 -1
- package/dist/test/search.test.d.ts +1 -0
- package/dist/test/toolbar.test.d.ts +1 -0
- package/dist/throttle-C7ZAPqtu.js +24 -0
- package/dist/throttle-C7ZAPqtu.js.map +1 -0
- package/dist/toolbar.js +306 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-C2r3PyzF.js → unsafe-html-BsGUjx94.js} +3 -3
- package/dist/{unsafe-html-C2r3PyzF.js.map → unsafe-html-BsGUjx94.js.map} +1 -1
- package/package.json +1 -1
- package/readme.md +2 -2
- package/scss/styles.scss +4 -0
- package/src/__base_element/BaseHyperlink.ts +42 -0
- package/src/__base_element/README.md +19 -0
- package/src/__utils/cache-fetch.ts +65 -0
- package/src/{utils → __utils}/dispatch-event-utils.ts +1 -0
- package/src/__utils/is-dark-mode.ts +3 -0
- package/src/__utils/is-in-viewport.ts +6 -0
- package/src/__utils/observe-slot-change.ts +38 -0
- package/src/__utils/sanitize-svg.ts +27 -0
- package/src/__utils/throttle.ts +27 -0
- package/src/accordion/accordion-item.scss +136 -65
- package/src/accordion/accordion-item.ts +117 -44
- package/src/accordion/accordion.scss +24 -5
- package/src/accordion/accordion.ts +29 -23
- package/src/accordion/demo/index.html +74 -35
- package/src/banner/banner.scss +87 -0
- package/src/banner/banner.ts +107 -0
- package/src/banner/index.ts +1 -0
- package/src/bottom-sheet/bottom-sheet.scss +88 -0
- package/src/bottom-sheet/bottom-sheet.ts +135 -0
- package/src/bottom-sheet/index.ts +1 -0
- package/src/button/BaseButton.ts +26 -30
- package/src/button/button/button-colors.scss +90 -19
- package/src/button/button/button-sizes.scss +39 -19
- package/src/button/button/button.scss +117 -116
- package/src/button/button/button.ts +29 -6
- package/src/button/button-group/button-group.scss +25 -22
- package/src/button/button-group/button-group.ts +122 -5
- package/src/button/icon-button/icon-button-sizes.scss +35 -15
- package/src/button/icon-button/icon-button.ts +25 -12
- package/src/card/card-colors.scss +10 -0
- package/src/card/card-content.ts +26 -0
- package/src/card/card.scss +221 -41
- package/src/card/card.ts +251 -8
- package/src/card/index.ts +1 -0
- package/src/chart-bar/chart-bar.ts +1 -1
- package/src/chart-bar/chart-stacked-bar.ts +3 -1
- package/src/chart-doughnut/chart-doughnut.ts +1 -1
- package/src/chart-pie/chart-pie.ts +1 -1
- package/src/checkbox/checkbox.ts +1 -1
- package/src/clock/clock.ts +1 -1
- package/src/code-editor/code-editor.ts +5 -5
- package/src/code-highlighter/code-highlighter.ts +2 -2
- package/src/container/container.ts +1 -1
- package/src/date-picker/date-picker.ts +5 -2
- package/src/divider/divider.ts +3 -1
- package/src/empty-state/empty-state.scss +9 -3
- package/src/empty-state/empty-state.ts +2 -2
- package/src/fab/fab-colors.scss +49 -0
- package/src/fab/fab-sizes.scss +47 -0
- package/src/fab/fab.scss +137 -0
- package/src/fab/fab.ts +285 -0
- package/src/fab/index.ts +1 -0
- package/src/field/field.ts +3 -1
- package/src/focus-ring/focus-ring.ts +37 -19
- package/src/icon/datasource.ts +1 -1
- package/src/icon/icon.ts +3 -1
- package/src/image/image.ts +3 -2
- package/src/index.ts +12 -1
- package/src/input/input.ts +5 -2
- package/src/link/link.ts +2 -15
- package/src/menu/menu/menu.scss +31 -3
- package/src/menu/menu/menu.ts +30 -6
- package/src/menu/menu-item/menu-item.scss +1 -0
- package/src/menu/menu-item/menu-item.ts +1 -9
- package/src/menu/sub-menu/sub-menu.ts +1 -0
- package/src/notification/index.ts +1 -0
- package/src/notification/notification.scss +201 -0
- package/src/notification/notification.ts +206 -0
- package/src/number-counter/number-counter.ts +3 -1
- package/src/number-field/number-field.ts +4 -2
- package/src/pagination/pagination.scss +33 -24
- package/src/pagination/pagination.ts +113 -60
- package/src/peacock-loader.ts +48 -0
- package/src/radio/radio.ts +3 -1
- package/src/ripple/ripple.ts +19 -3
- package/src/search/index.ts +1 -0
- package/src/search/search-colors.scss +14 -0
- package/src/search/search.scss +204 -0
- package/src/search/search.ts +240 -0
- package/src/segmented-button/index.ts +2 -0
- package/src/segmented-button/segmented-button-group.scss +21 -0
- package/src/segmented-button/segmented-button-group.ts +110 -0
- package/src/segmented-button/segmented-button.scss +115 -0
- package/src/segmented-button/segmented-button.ts +175 -0
- package/src/select/index.ts +3 -0
- package/src/select/option.ts +109 -0
- package/src/select/select.scss +125 -0
- package/src/select/select.ts +520 -0
- package/src/side-sheet/index.ts +1 -0
- package/src/side-sheet/side-sheet.scss +79 -0
- package/src/side-sheet/side-sheet.ts +100 -0
- package/src/slider/slider.scss +19 -1
- package/src/slider/slider.ts +30 -19
- package/src/snackbar/snackbar.scss +62 -31
- package/src/snackbar/snackbar.ts +92 -12
- package/src/switch/switch.ts +3 -1
- package/src/table/table.ts +3 -1
- package/src/tabs/demo/index.html +90 -0
- package/src/tabs/tab-group.ts +0 -3
- package/src/tabs/tab.scss +237 -25
- package/src/tabs/tab.ts +91 -14
- package/src/tabs/tabs.scss +37 -3
- package/src/tabs/tabs.ts +118 -2
- package/src/textarea/textarea.ts +4 -2
- package/src/time-picker/time-picker.ts +4 -2
- package/src/toolbar/index.ts +1 -0
- package/src/toolbar/toolbar-colors.scss +16 -0
- package/src/toolbar/toolbar.scss +165 -0
- package/src/toolbar/toolbar.ts +137 -0
- package/dist/IndividualComponent-Dt5xirYG.js +0 -73
- package/dist/IndividualComponent-Dt5xirYG.js.map +0 -1
- package/dist/button-ClzS8JLq.js.map +0 -1
- package/dist/button-group-BMS5WvaF.js +0 -292
- package/dist/button-group-BMS5WvaF.js.map +0 -1
- package/dist/chart-donut.js +0 -309
- package/dist/chart-donut.js.map +0 -1
- package/dist/class-map-59YGWLnx.js.map +0 -1
- package/dist/directive-Cuw6h7YA.js +0 -9
- package/dist/directive-Cuw6h7YA.js.map +0 -1
- package/dist/dispatch-event-utils-B4odODQf.js +0 -277
- package/dist/dispatch-event-utils-B4odODQf.js.map +0 -1
- package/dist/observe-theme-change-pALI5fmV.js.map +0 -1
- package/dist/radio-b70_Ie9n.js.map +0 -1
- package/dist/src/chart-donut/chart-donut.d.ts +0 -53
- package/dist/src/chart-donut/index.d.ts +0 -1
- package/dist/src/styleMixins.css.d.ts +0 -9
- package/dist/src/utils.d.ts +0 -9
- package/src/chart-donut/chart-donut.scss +0 -37
- package/src/chart-donut/chart-donut.ts +0 -287
- package/src/chart-donut/demo/index.html +0 -51
- package/src/chart-donut/index.ts +0 -1
- package/src/styleMixins.css.ts +0 -55
- package/src/utils.ts +0 -193
- /package/dist/src/{spread.d.ts → __directive/spread.d.ts} +0 -0
- /package/dist/src/{utils → __utils}/copy-to-clipboard.d.ts +0 -0
- /package/dist/src/{utils → __utils}/dispatch-event-utils.d.ts +0 -0
- /package/dist/src/{utils → __utils}/observe-theme-change.d.ts +0 -0
- /package/dist/test/{card.test.d.ts → banner.test.d.ts} +0 -0
- /package/src/{spread.ts → __directive/spread.ts} +0 -0
- /package/src/{utils → __utils}/copy-to-clipboard.ts +0 -0
- /package/src/{utils → __utils}/observe-theme-change.ts +0 -0
package/src/card/card.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { LitElement, html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import
|
|
1
|
+
import { LitElement, html, nothing, PropertyValues } from 'lit';
|
|
2
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { dispatchActivationClick, isActivationClick } from '../__utils/dispatch-event-utils.js';
|
|
5
|
+
import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
|
|
6
|
+
import { throttle } from '@/__utils/throttle.js';
|
|
7
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
4
8
|
import styles from './card.scss';
|
|
9
|
+
import colorStyles from './card-colors.scss';
|
|
5
10
|
|
|
6
11
|
type CardVariant = 'elevated' | 'filled' | 'outlined';
|
|
7
|
-
|
|
12
|
+
|
|
8
13
|
/**
|
|
9
14
|
* @label Card
|
|
10
15
|
* @tag wc-card
|
|
@@ -24,15 +29,253 @@ type CardElevation = 0 | 1 | 2 | 3 | 4 | 5;
|
|
|
24
29
|
*/
|
|
25
30
|
@IndividualComponent
|
|
26
31
|
export class Card extends LitElement {
|
|
27
|
-
static styles = [styles];
|
|
32
|
+
static styles = [styles, colorStyles];
|
|
33
|
+
|
|
34
|
+
#id = crypto.randomUUID();
|
|
28
35
|
|
|
29
36
|
@property({ type: String, reflect: true })
|
|
30
37
|
variant: CardVariant = 'elevated';
|
|
31
38
|
|
|
32
|
-
@property({ type:
|
|
33
|
-
|
|
39
|
+
@property({ type: Boolean, reflect: true })
|
|
40
|
+
disabled: boolean = false;
|
|
41
|
+
|
|
42
|
+
@property({ type: Boolean, reflect: true })
|
|
43
|
+
actionable: boolean = false;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* If button is disabled, the reason why it is disabled.
|
|
47
|
+
*/
|
|
48
|
+
@property({ attribute: 'disabled-reason' })
|
|
49
|
+
disabledReason: string = '';
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Hyperlink to navigate to on click.
|
|
53
|
+
*/
|
|
54
|
+
@property({ reflect: true }) href?: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Sets or retrieves the window or frame at which to target content.
|
|
58
|
+
*/
|
|
59
|
+
@property() target: string = '_self';
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
|
|
64
|
+
*/
|
|
65
|
+
@property() throttleDelay = 200;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* States
|
|
69
|
+
*/
|
|
70
|
+
@state()
|
|
71
|
+
isPressed = false;
|
|
72
|
+
|
|
73
|
+
@state()
|
|
74
|
+
private slotHasContent = false;
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@query('.card') readonly cardElement!: HTMLElement | null;
|
|
78
|
+
|
|
79
|
+
@query('slot') readonly contentSlot!: HTMLSlotElement | null;
|
|
80
|
+
|
|
81
|
+
#tabindex?: number = 0;
|
|
82
|
+
|
|
83
|
+
#slottedTabIndexMap = new WeakMap<HTMLElement, string | null>();
|
|
84
|
+
|
|
85
|
+
override firstUpdated() {
|
|
86
|
+
this.__dispatchClickWithThrottle = throttle(
|
|
87
|
+
this.__dispatchClick,
|
|
88
|
+
this.throttleDelay,
|
|
89
|
+
);
|
|
90
|
+
observerSlotChangesWithCallback(
|
|
91
|
+
this.renderRoot.querySelector('slot'),
|
|
92
|
+
hasContent => {
|
|
93
|
+
this.slotHasContent = hasContent;
|
|
94
|
+
this.__syncSlottedChildrenTabIndex();
|
|
95
|
+
this.requestUpdate();
|
|
96
|
+
},
|
|
97
|
+
);
|
|
98
|
+
this.__syncSlottedChildrenTabIndex();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
override updated(changedProperties: PropertyValues<this>) {
|
|
102
|
+
if (changedProperties.has('actionable') || changedProperties.has('href')) {
|
|
103
|
+
this.__syncSlottedChildrenTabIndex();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
__syncSlottedChildrenTabIndex() {
|
|
108
|
+
if (!this.contentSlot) return;
|
|
109
|
+
|
|
110
|
+
const shouldDisableTabbing = this.actionable || this.__isLink();
|
|
111
|
+
const assignedChildren = this.contentSlot.assignedElements({ flatten: true });
|
|
112
|
+
|
|
113
|
+
assignedChildren.forEach(node => {
|
|
114
|
+
if (!(node instanceof HTMLElement)) return;
|
|
115
|
+
|
|
116
|
+
if (shouldDisableTabbing) {
|
|
117
|
+
if (!this.#slottedTabIndexMap.has(node)) {
|
|
118
|
+
this.#slottedTabIndexMap.set(node, node.getAttribute('tabindex'));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (node.getAttribute('tabindex') !== '-1') {
|
|
122
|
+
node.setAttribute('tabindex', '-1');
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const originalTabIndex = this.#slottedTabIndexMap.get(node);
|
|
128
|
+
if (originalTabIndex === null) {
|
|
129
|
+
if (node.hasAttribute('tabindex')) {
|
|
130
|
+
node.removeAttribute('tabindex');
|
|
131
|
+
}
|
|
132
|
+
} else if (originalTabIndex !== undefined) {
|
|
133
|
+
if (node.getAttribute('tabindex') !== originalTabIndex) {
|
|
134
|
+
node.setAttribute('tabindex', originalTabIndex);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
this.#slottedTabIndexMap.delete(node);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
__dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =
|
|
143
|
+
event => {
|
|
144
|
+
this.__dispatchClick(event);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
__dispatchClick = (event: MouseEvent | KeyboardEvent) => {
|
|
148
|
+
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
149
|
+
// prevent the click from propagating to other event listeners as well as
|
|
150
|
+
// prevent the default action.
|
|
151
|
+
if (this.disabled && this.href) {
|
|
152
|
+
event.stopImmediatePropagation();
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (!isActivationClick(event) || !this.cardElement) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
this.focus();
|
|
162
|
+
dispatchActivationClick(this.cardElement);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
__isLink() {
|
|
166
|
+
return !!this.href;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
__getDisabledReasonID() {
|
|
170
|
+
return this.disabled && this.disabledReason
|
|
171
|
+
? `disabled-reason-${this.#id}`
|
|
172
|
+
: nothing;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
__renderDisabledReason() {
|
|
176
|
+
const disabledReasonID = this.__getDisabledReasonID();
|
|
177
|
+
if (disabledReasonID)
|
|
178
|
+
return html`<div
|
|
179
|
+
id="disabled-reason-${this.#id}"
|
|
180
|
+
role="tooltip"
|
|
181
|
+
aria-label=${this.disabledReason}
|
|
182
|
+
class="screen-reader-only"
|
|
183
|
+
>
|
|
184
|
+
${this.disabledReason}
|
|
185
|
+
</div>`;
|
|
186
|
+
return nothing;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
__handlePress = (event: KeyboardEvent | MouseEvent) => {
|
|
190
|
+
if (this.disabled) return;
|
|
191
|
+
if (
|
|
192
|
+
event instanceof KeyboardEvent &&
|
|
193
|
+
event.type === 'keydown' &&
|
|
194
|
+
(event.key === 'Enter' || event.key === ' ')
|
|
195
|
+
) {
|
|
196
|
+
this.isPressed = true;
|
|
197
|
+
} else if (event.type === 'mousedown') {
|
|
198
|
+
this.isPressed = true;
|
|
199
|
+
} else {
|
|
200
|
+
this.isPressed = false;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
34
206
|
|
|
35
207
|
render() {
|
|
36
|
-
|
|
208
|
+
|
|
209
|
+
const isLink = this.__isLink();
|
|
210
|
+
|
|
211
|
+
const cssClasses = {
|
|
212
|
+
card: true,
|
|
213
|
+
'card-element': true,
|
|
214
|
+
[`variant-${this.variant}`]: true,
|
|
215
|
+
actionable: (this.actionable && !this.disabled) || isLink,
|
|
216
|
+
disabled: this.disabled,
|
|
217
|
+
pressed: this.isPressed,
|
|
218
|
+
'has-content': this.slotHasContent,
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
if (!this.actionable && !isLink) {
|
|
222
|
+
return html`<div
|
|
223
|
+
class=${classMap(cssClasses)}
|
|
224
|
+
id="card"
|
|
225
|
+
>
|
|
226
|
+
${this.renderCardContent()}
|
|
227
|
+
</div>`;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (!isLink) {
|
|
231
|
+
return html`<button
|
|
232
|
+
class=${classMap(cssClasses)}
|
|
233
|
+
id="card"
|
|
234
|
+
tabindex=${this.#tabindex}
|
|
235
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
236
|
+
@mousedown=${this.__handlePress}
|
|
237
|
+
@keydown=${this.__handlePress}
|
|
238
|
+
@keyup=${this.__handlePress}
|
|
239
|
+
?aria-describedby=${this.__getDisabledReasonID()}
|
|
240
|
+
aria-disabled=${`${this.disabled}`}
|
|
241
|
+
?disabled=${this.disabled}
|
|
242
|
+
>
|
|
243
|
+
${this.renderCardContent()}
|
|
244
|
+
</button>`;
|
|
245
|
+
}
|
|
246
|
+
return html`<a
|
|
247
|
+
class=${classMap(cssClasses)}
|
|
248
|
+
id="card"
|
|
249
|
+
tabindex=${this.#tabindex}
|
|
250
|
+
href=${this.href}
|
|
251
|
+
target=${this.target}
|
|
252
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
253
|
+
@mousedown=${this.__handlePress}
|
|
254
|
+
@keydown=${this.__handlePress}
|
|
255
|
+
@keyup=${this.__handlePress}
|
|
256
|
+
role="button"
|
|
257
|
+
?aria-describedby=${this.__getDisabledReasonID()}
|
|
258
|
+
aria-disabled=${`${this.disabled}`}
|
|
259
|
+
>
|
|
260
|
+
${this.renderCardContent()}
|
|
261
|
+
</a>`;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
renderCardContent() {
|
|
265
|
+
return html`
|
|
266
|
+
<wc-focus-ring class="focus-ring" .control=${this} .forElement=${this.cardElement}></wc-focus-ring>
|
|
267
|
+
<wc-elevation class="elevation"></wc-elevation>
|
|
268
|
+
<div class="background"></div>
|
|
269
|
+
<div class="outline"></div>
|
|
270
|
+
<wc-ripple class="ripple"></wc-ripple>
|
|
271
|
+
|
|
272
|
+
<div class="card-content">
|
|
273
|
+
|
|
274
|
+
<div class="slot-container">
|
|
275
|
+
<slot @slotchange=${this.__syncSlottedChildrenTabIndex}></slot>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
</div>
|
|
279
|
+
`;
|
|
37
280
|
}
|
|
38
281
|
}
|
package/src/card/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { html, LitElement, PropertyValues } from 'lit';
|
|
2
2
|
import { property, query } from 'lit/decorators.js';
|
|
3
3
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
4
|
-
import IndividualComponent from '
|
|
4
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
5
5
|
import * as d3 from 'd3';
|
|
6
6
|
import styles from './chart-bar.scss';
|
|
7
7
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { html, LitElement, PropertyValues } from 'lit';
|
|
2
2
|
import { property, query } from 'lit/decorators.js';
|
|
3
3
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
4
|
-
import IndividualComponent from 'src/IndividualComponent.js';
|
|
5
4
|
import * as d3 from 'd3';
|
|
5
|
+
|
|
6
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
7
|
+
|
|
6
8
|
import styles from './chart-bar.scss';
|
|
7
9
|
|
|
8
10
|
export type ChartStackedSegment = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html, LitElement, PropertyValues } from 'lit';
|
|
2
2
|
import { property, query } from 'lit/decorators.js';
|
|
3
|
-
import IndividualComponent from '
|
|
3
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
4
4
|
import * as d3 from 'd3';
|
|
5
5
|
import styles from './chart-donut.scss';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html, LitElement, PropertyValues } from 'lit';
|
|
2
2
|
import { property, query } from 'lit/decorators.js';
|
|
3
|
-
import IndividualComponent from '
|
|
3
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
4
4
|
import * as d3 from 'd3';
|
|
5
5
|
import styles from './chart-pie.scss';
|
|
6
6
|
|
package/src/checkbox/checkbox.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { html, LitElement, svg } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
-
import { spread } from '
|
|
4
|
+
import { spread } from '@/__directive/spread.js';
|
|
5
5
|
import styles from './checkbox.scss';
|
|
6
6
|
|
|
7
7
|
/**
|
package/src/clock/clock.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html, LitElement } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
|
-
import IndividualComponent from '
|
|
3
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
4
4
|
import { ClockController } from './ClockController.js';
|
|
5
5
|
|
|
6
6
|
import styles from './clock.scss';
|
|
@@ -2,13 +2,13 @@ import { html, nothing } from 'lit';
|
|
|
2
2
|
import { property, state, query } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import {init} from 'modern-monaco';
|
|
5
|
-
import IndividualComponent from '
|
|
5
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
6
6
|
import BaseInput from '../input/BaseInput.js';
|
|
7
|
-
import { observeThemeChange } from '../
|
|
8
|
-
import { redispatchEvent } from '../
|
|
7
|
+
import { observeThemeChange } from '../__utils/observe-theme-change.js';
|
|
8
|
+
import { redispatchEvent } from '../__utils/dispatch-event-utils.js';
|
|
9
9
|
import {
|
|
10
10
|
isDarkMode,
|
|
11
|
-
} from '
|
|
11
|
+
} from '@/__utils/is-dark-mode.js';
|
|
12
12
|
|
|
13
13
|
import styles from './code-editor.scss';
|
|
14
14
|
|
|
@@ -21,7 +21,7 @@ import styles from './code-editor.scss';
|
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```html
|
|
24
|
-
* <wc-code-editor language="javascript"></wc-code-editor>
|
|
24
|
+
* <wc-code-editor language="javascript" style="width: 80%;--code-editor-height: 9rem;height: 9rem;" ></wc-code-editor>
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
|
|
@@ -12,8 +12,8 @@ import * as prettierPluginEstree from 'prettier/plugins/estree';
|
|
|
12
12
|
|
|
13
13
|
import { BundledLanguage, codeToHtml, ShikiTransformer } from 'shiki';
|
|
14
14
|
|
|
15
|
-
import IndividualComponent from '
|
|
16
|
-
import { copyToClipboard } from '
|
|
15
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
16
|
+
import { copyToClipboard } from '@/__utils/copy-to-clipboard.js';
|
|
17
17
|
import styles from './code-highlighter.scss';
|
|
18
18
|
|
|
19
19
|
const locale = {
|
|
@@ -16,7 +16,7 @@ type ContainerSize = 'max' | 'xl' | 'lg' | 'md' | 'sm' | 'full';
|
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```html
|
|
19
|
-
* <wc-container size="
|
|
19
|
+
* <wc-container style="width: 80%; border: 1px dotted black;" size="md">Content</wc-container>
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
export class Container extends LitElement {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { redispatchEvent } from '@/__utils/dispatch-event-utils.js';
|
|
5
|
+
import { spread } from '@/__directive/spread.js';
|
|
6
|
+
|
|
4
7
|
import BaseInput from '../input/BaseInput.js';
|
|
5
8
|
import styles from './date-picker.scss';
|
|
6
|
-
|
|
9
|
+
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* @label Date Picker
|
package/src/divider/divider.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { html, LitElement } from 'lit';
|
|
2
2
|
import { property, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
|
|
5
|
+
import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
|
|
6
|
+
|
|
4
7
|
import styles from './divider.scss';
|
|
5
|
-
import { observerSlotChangesWithCallback } from '../utils.js';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* @label Divider
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
flex-direction: column;
|
|
39
39
|
justify-content: center;
|
|
40
40
|
|
|
41
|
-
.
|
|
42
|
-
@include mixin.get-typography(headline-medium
|
|
41
|
+
.headline {
|
|
42
|
+
@include mixin.get-typography(headline-medium);
|
|
43
43
|
margin-bottom: var(--spacing-200);
|
|
44
44
|
color: var(--color-on-surface)
|
|
45
45
|
}
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
.empty-state {
|
|
72
72
|
.empty-state-container {
|
|
73
73
|
flex-direction: column;
|
|
74
|
-
gap: var(--spacing-
|
|
74
|
+
gap: var(--spacing-150);
|
|
75
75
|
|
|
76
76
|
.illustration {
|
|
77
77
|
height: auto;
|
|
@@ -79,6 +79,12 @@
|
|
|
79
79
|
justify-content: center;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
|
|
83
|
+
.content {
|
|
84
|
+
.headline {
|
|
85
|
+
@include mixin.get-typography(headline-small);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -12,7 +12,7 @@ import styles from './empty-state.scss';
|
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```html
|
|
15
|
-
* <wc-empty-state headline="No items found"></wc-empty-state>
|
|
15
|
+
* <wc-empty-state style="width:100%" headline="No items found"></wc-empty-state>
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
export class EmptyState extends LitElement {
|
|
@@ -52,7 +52,7 @@ export class EmptyState extends LitElement {
|
|
|
52
52
|
|
|
53
53
|
__renderTitle() {
|
|
54
54
|
if (!this.headline) return nothing;
|
|
55
|
-
return html`<div class="
|
|
55
|
+
return html`<div class="headline">${this.headline}</div>`;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
__renderDescription() {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--tonal-fab-container-color: var(--color-surface-container-high);
|
|
3
|
+
--tonal-fab-label-text-color: var(--color-on-surface);
|
|
4
|
+
|
|
5
|
+
--filled-fab-container-color: var(--color-surface);
|
|
6
|
+
--filled-fab-label-text-color: var(--color-on-surface);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host([color='surface']) {
|
|
10
|
+
--tonal-fab-container-color: var(--color-surface-container-high);
|
|
11
|
+
--tonal-fab-label-text-color: var(--color-on-surface);
|
|
12
|
+
|
|
13
|
+
--filled-fab-container-color: var(--color-surface);
|
|
14
|
+
--filled-fab-label-text-color: var(--color-on-surface);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host([color='primary']) {
|
|
18
|
+
--tonal-fab-container-color: var(--color-primary-container);
|
|
19
|
+
--tonal-fab-label-text-color: var(--color-on-primary-container);
|
|
20
|
+
|
|
21
|
+
--filled-fab-container-color: var(--color-primary);
|
|
22
|
+
--filled-fab-label-text-color: var(--color-on-primary);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([color='secondary']) {
|
|
26
|
+
--tonal-fab-container-color: var(--color-secondary-container);
|
|
27
|
+
--tonal-fab-label-text-color: var(--color-on-secondary-container);
|
|
28
|
+
|
|
29
|
+
--filled-fab-container-color: var(--color-secondary);
|
|
30
|
+
--filled-fab-label-text-color: var(--color-on-secondary);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([color='tertiary']) {
|
|
34
|
+
--tonal-fab-container-color: var(--color-tertiary-container);
|
|
35
|
+
--tonal-fab-label-text-color: var(--color-on-tertiary-container);
|
|
36
|
+
|
|
37
|
+
--filled-fab-container-color: var(--color-tertiary);
|
|
38
|
+
--filled-fab-label-text-color: var(--color-on-tertiary);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.fab.variant-tonal {
|
|
42
|
+
--_fab-container-color: var(--tonal-fab-container-color);
|
|
43
|
+
--_fab-label-text-color: var(--tonal-fab-label-text-color);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.fab.variant-filled {
|
|
47
|
+
--_fab-container-color: var(--filled-fab-container-color);
|
|
48
|
+
--_fab-label-text-color: var(--filled-fab-label-text-color);
|
|
49
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* Small FAB: 40x40dp, shape-corner-medium */
|
|
2
|
+
:host([size='sm']) {
|
|
3
|
+
--fab-container-shape: var(--shape-corner-medium);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:host([size='sm']) .fab {
|
|
7
|
+
width: 2.5rem;
|
|
8
|
+
height: 2.5rem;
|
|
9
|
+
--_fab-icon-size: 1.5rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Standard/Medium FAB: 56x56dp, shape-corner-large (default) */
|
|
13
|
+
:host([size='md']) .fab {
|
|
14
|
+
width: 3.5rem;
|
|
15
|
+
height: 3.5rem;
|
|
16
|
+
--_fab-icon-size: 1.5rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Large FAB: 96x96dp, shape-corner-extra-large */
|
|
20
|
+
:host([size='lg']) {
|
|
21
|
+
--fab-container-shape: var(--shape-corner-extra-large);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([size='lg']) .fab {
|
|
25
|
+
width: 6rem;
|
|
26
|
+
height: 6rem;
|
|
27
|
+
--_fab-icon-size: 2.25rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Extended FAB overrides (height fixed, width auto) */
|
|
31
|
+
:host([size='sm']) .fab.extended {
|
|
32
|
+
width: auto;
|
|
33
|
+
min-width: 4rem;
|
|
34
|
+
height: 2.5rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([size='md']) .fab.extended {
|
|
38
|
+
width: auto;
|
|
39
|
+
min-width: 5rem;
|
|
40
|
+
height: 3.5rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([size='lg']) .fab.extended {
|
|
44
|
+
width: auto;
|
|
45
|
+
min-width: 6rem;
|
|
46
|
+
height: 6rem;
|
|
47
|
+
}
|