@brightspace-ui/core 3.267.0 → 3.267.3
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/components/alert/alert-toast.js +98 -102
- package/components/alert/alert.js +109 -113
- package/components/backdrop/backdrop-dirty-overlay.js +13 -17
- package/components/backdrop/backdrop-loading.js +105 -109
- package/components/backdrop/backdrop.js +50 -54
- package/components/breadcrumbs/breadcrumb-current-page.js +19 -23
- package/components/breadcrumbs/breadcrumb.js +50 -54
- package/components/breadcrumbs/breadcrumbs.js +34 -38
- package/components/button/button-add.js +156 -164
- package/components/button/button-copy-mixin.js +9 -11
- package/components/button/button-copy.js +15 -19
- package/components/button/button-icon.js +110 -114
- package/components/button/button-move.js +153 -157
- package/components/button/button-split-item.js +16 -20
- package/components/button/button-split.js +70 -74
- package/components/button/button-subtle-copy.js +17 -19
- package/components/button/button-subtle.js +145 -149
- package/components/button/button-toggle.js +25 -29
- package/components/button/button.js +70 -74
- package/components/button/floating-buttons.js +63 -67
- package/components/calendar/calendar.js +244 -248
- package/components/card/card-content-meta.js +13 -15
- package/components/card/card-content-title.js +9 -11
- package/components/card/card-footer-link.js +76 -80
- package/components/card/card-loading-shimmer.js +35 -39
- package/components/card/card.js +188 -192
- package/components/collapsible-panel/collapsible-panel-group.js +17 -21
- package/components/collapsible-panel/collapsible-panel-summary-item.js +27 -31
- package/components/collapsible-panel/collapsible-panel.js +258 -262
- package/components/count-badge/count-badge-icon.js +12 -16
- package/components/count-badge/count-badge-mixin.js +124 -128
- package/components/count-badge/count-badge.js +2 -4
- package/components/description-list/description-list-wrapper.js +27 -31
- package/components/dialog/dialog-confirm.js +55 -59
- package/components/dialog/dialog-fullscreen.js +128 -132
- package/components/dialog/dialog-mixin.js +39 -41
- package/components/dialog/dialog.js +61 -65
- package/components/dropdown/dropdown-button-subtle.js +21 -25
- package/components/dropdown/dropdown-button.js +31 -35
- package/components/dropdown/dropdown-context-menu.js +28 -31
- package/components/dropdown/dropdown-menu.js +27 -31
- package/components/dropdown/dropdown-more.js +23 -26
- package/components/dropdown/dropdown-opener-mixin.js +44 -46
- package/components/dropdown/dropdown-popover-mixin.js +155 -159
- package/components/dropdown/dropdown-tabs.js +5 -7
- package/components/dropdown/dropdown.js +1 -3
- package/components/empty-state/empty-state-action-button.js +18 -22
- package/components/empty-state/empty-state-action-link.js +14 -18
- package/components/empty-state/empty-state-illustrated.js +21 -25
- package/components/empty-state/empty-state-simple.js +8 -12
- package/components/expand-collapse/expand-collapse-content.js +48 -52
- package/components/filter/filter-dimension-set-date-text-value.js +34 -36
- package/components/filter/filter-dimension-set-date-time-range-value.js +45 -47
- package/components/filter/filter-dimension-set-empty-state.js +17 -19
- package/components/filter/filter-dimension-set-value.js +27 -29
- package/components/filter/filter-dimension-set.js +65 -67
- package/components/filter/filter-overflow-group.js +15 -19
- package/components/filter/filter-tags.js +16 -19
- package/components/filter/filter.js +115 -119
- package/components/focus-trap/focus-trap.js +17 -21
- package/components/form/form-element-mixin.js +33 -35
- package/components/form/form-error-summary.js +37 -42
- package/components/form/form.js +33 -37
- package/components/hierarchical-view/hierarchical-view-mixin.js +76 -80
- package/components/hierarchical-view/hierarchical-view.js +5 -7
- package/components/html-block/html-block.js +45 -49
- package/components/icons/icon-custom.js +20 -24
- package/components/icons/icon.js +20 -24
- package/components/icons/slotted-icon-mixin.js +16 -18
- package/components/inputs/input-checkbox-group.js +34 -38
- package/components/inputs/input-checkbox.js +106 -110
- package/components/inputs/input-color.js +142 -148
- package/components/inputs/input-date-range.js +90 -94
- package/components/inputs/input-date-time-range-to.js +70 -74
- package/components/inputs/input-date-time-range.js +110 -115
- package/components/inputs/input-date-time.js +75 -79
- package/components/inputs/input-date.js +101 -105
- package/components/inputs/input-fieldset.js +37 -43
- package/components/inputs/input-group.js +10 -12
- package/components/inputs/input-inline-help.js +4 -6
- package/components/inputs/input-number.js +112 -118
- package/components/inputs/input-percent.js +52 -58
- package/components/inputs/input-radio-group.js +45 -49
- package/components/inputs/input-radio-spacer.js +11 -13
- package/components/inputs/input-radio.js +62 -66
- package/components/inputs/input-search.js +63 -68
- package/components/inputs/input-styles.js +140 -3
- package/components/inputs/input-text.js +245 -251
- package/components/inputs/input-textarea.js +128 -132
- package/components/inputs/input-time-range.js +100 -104
- package/components/inputs/input-time.js +107 -113
- package/components/link/link-mixin.js +37 -41
- package/components/link/link.js +113 -119
- package/components/list/list-controls.js +25 -29
- package/components/list/list-item-button-mixin.js +10 -12
- package/components/list/list-item-checkbox-mixin.js +35 -37
- package/components/list/list-item-content.js +33 -35
- package/components/list/list-item-drag-drop-mixin.js +45 -47
- package/components/list/list-item-drag-handle.js +80 -84
- package/components/list/list-item-drag-image.js +77 -81
- package/components/list/list-item-expand-collapse-mixin.js +17 -19
- package/components/list/list-item-generic-layout.js +222 -226
- package/components/list/list-item-link-mixin.js +10 -12
- package/components/list/list-item-mixin.js +68 -70
- package/components/list/list-item-nav-mixin.js +17 -19
- package/components/list/list-item-placement-marker.js +65 -67
- package/components/list/list-item-role-mixin.js +9 -11
- package/components/list/list-item.js +7 -9
- package/components/list/list.js +121 -125
- package/components/loading-spinner/loading-spinner.js +93 -97
- package/custom-elements.json +1920 -6694
- package/package.json +3 -2
|
@@ -19,138 +19,134 @@ const MODE = {
|
|
|
19
19
|
* A component for quickly adding items to a specific locaiton.
|
|
20
20
|
*/
|
|
21
21
|
class ButtonAdd extends PropertyRequiredMixin(FocusMixin(LocalizeCoreElement(LitElement))) {
|
|
22
|
-
static
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
22
|
+
static properties = {
|
|
23
|
+
/**
|
|
24
|
+
* Display mode of the component. Defaults to `icon` (plus icon is always visible). Other options are `icon-and-text` (plus icon and text are always visible), and `icon-when-interacted` (plus icon is only visible when hover or focus).
|
|
25
|
+
* @type {'icon'|'icon-and-text'|'icon-when-interacted'}
|
|
26
|
+
*/
|
|
27
|
+
mode: { type: String, reflect: true },
|
|
28
|
+
/**
|
|
29
|
+
* ACCESSIBILITY: The text associated with the button. When mode is `icon-and-text` this text is displayed next to the icon, otherwise this text is in a tooltip.
|
|
30
|
+
* @type {string}
|
|
31
|
+
*/
|
|
32
|
+
text: { type: String, required: true }
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
static styles = css`
|
|
36
|
+
:host {
|
|
37
|
+
--d2l-button-add-animation-delay: 0ms;
|
|
38
|
+
--d2l-button-add-animation-duration: 200ms;
|
|
39
|
+
--d2l-button-add-hover-focus-color: var(--d2l-color-celestine-minus-1);
|
|
40
|
+
--d2l-button-add-line-color: var(--d2l-color-mica);
|
|
41
|
+
--d2l-button-add-line-height: 1px;
|
|
42
|
+
--d2l-button-add-hover-focus-line-height: 2px;
|
|
43
|
+
}
|
|
44
|
+
:host([mode="icon-when-interacted"]) {
|
|
45
|
+
--d2l-button-add-animation-delay: 50ms;
|
|
46
|
+
}
|
|
47
|
+
button {
|
|
48
|
+
align-items: center;
|
|
49
|
+
background-color: transparent;
|
|
50
|
+
border: 0;
|
|
51
|
+
box-shadow: none;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
display: flex;
|
|
54
|
+
font-family: inherit;
|
|
55
|
+
height: 11px;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
margin: 6.5px 0; /* (d2l-button-add-icon-text height - line height) / 2 */
|
|
58
|
+
outline: none;
|
|
59
|
+
padding: 0;
|
|
60
|
+
position: relative;
|
|
61
|
+
user-select: none;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
width: 100%;
|
|
64
|
+
z-index: 1; /* needed for button-add to have expected hover behaviour in list (hover from below, tooltip position) */
|
|
65
|
+
}
|
|
66
|
+
:host([mode="icon-and-text"]) button {
|
|
67
|
+
margin: calc((1.5rem - 11px) / 2) 0; /* (d2l-button-add-icon-text height - line height) / 2 */
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.line {
|
|
71
|
+
background: var(--d2l-button-add-line-color);
|
|
72
|
+
height: var(--d2l-button-add-line-height);
|
|
73
|
+
margin: 5px 0;
|
|
74
|
+
width: 100%;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
button:hover .line,
|
|
78
|
+
button:focus .line {
|
|
79
|
+
background: var(--d2l-button-add-hover-focus-color);
|
|
80
|
+
height: var(--d2l-button-add-hover-focus-line-height);
|
|
81
|
+
}
|
|
82
|
+
button:hover d2l-button-add-icon-text,
|
|
83
|
+
button:focus d2l-button-add-icon-text {
|
|
84
|
+
--d2l-button-add-icon-text-color: var(--d2l-button-add-hover-focus-color);
|
|
85
|
+
}
|
|
86
|
+
:host([mode="icon-when-interacted"]) button:hover .line {
|
|
87
|
+
transition-delay: var(--d2l-button-add-animation-delay);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
:host([mode="icon-when-interacted"]) button:not(:focus):not(:hover) d2l-button-add-icon-text {
|
|
91
|
+
position: absolute;
|
|
92
|
+
}
|
|
93
|
+
:host([mode="icon-when-interacted"]) button:hover d2l-button-add-icon-text,
|
|
94
|
+
:host([mode="icon-when-interacted"]) button:focus d2l-button-add-icon-text {
|
|
95
|
+
animation: position-change-animation var(--d2l-button-add-animation-delay); /* add delay in changing position to avoid flash of missing icon space */
|
|
96
|
+
}
|
|
97
|
+
@keyframes position-change-animation {
|
|
98
|
+
0% { position: absolute; }
|
|
99
|
+
100% { position: static; }
|
|
100
|
+
}
|
|
101
|
+
${getFocusRingStyles(pseudoClass => `button:${pseudoClass} d2l-button-add-icon-text`, { extraStyles: css`background-color: white; border-radius: 0.3rem;` })}
|
|
102
|
+
:host([mode="icon-when-interacted"]) button:${unsafeCSS(getFocusPseudoClass())} d2l-button-add-icon-text,
|
|
103
|
+
:host([mode="icon"]) button:${unsafeCSS(getFocusPseudoClass())} d2l-button-add-icon-text {
|
|
104
|
+
border-radius: 0.2rem;
|
|
105
|
+
padding: 0.15rem;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
80
109
|
button:hover .line,
|
|
81
110
|
button:focus .line {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
button:hover d2l-button-add-icon-text,
|
|
86
|
-
button:focus d2l-button-add-icon-text {
|
|
87
|
-
--d2l-button-add-icon-text-color: var(--d2l-button-add-hover-focus-color);
|
|
88
|
-
}
|
|
89
|
-
:host([mode="icon-when-interacted"]) button:hover .line {
|
|
90
|
-
transition-delay: var(--d2l-button-add-animation-delay);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
:host([mode="icon-when-interacted"]) button:not(:focus):not(:hover) d2l-button-add-icon-text {
|
|
94
|
-
position: absolute;
|
|
111
|
+
animation: line-start-animation var(--d2l-button-add-animation-duration) ease-in var(--d2l-button-add-animation-delay) 1 forwards;
|
|
112
|
+
transition: all var(--d2l-button-add-animation-duration) ease-in var(--d2l-button-add-animation-delay);
|
|
95
113
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
animation:
|
|
114
|
+
button:hover .line-end,
|
|
115
|
+
button:focus .line-end {
|
|
116
|
+
animation-name: line-end-animation;
|
|
99
117
|
}
|
|
100
|
-
@keyframes position-change-animation {
|
|
101
|
-
0% { position: absolute; }
|
|
102
|
-
100% { position: static; }
|
|
103
|
-
}
|
|
104
|
-
${getFocusRingStyles(pseudoClass => `button:${pseudoClass} d2l-button-add-icon-text`, { extraStyles: css`background-color: white; border-radius: 0.3rem;` })}
|
|
105
|
-
:host([mode="icon-when-interacted"]) button:${unsafeCSS(getFocusPseudoClass())} d2l-button-add-icon-text,
|
|
106
|
-
:host([mode="icon"]) button:${unsafeCSS(getFocusPseudoClass())} d2l-button-add-icon-text {
|
|
107
|
-
border-radius: 0.2rem;
|
|
108
|
-
padding: 0.15rem;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
112
|
-
button:hover .line,
|
|
113
|
-
button:focus .line {
|
|
114
|
-
animation: line-start-animation var(--d2l-button-add-animation-duration) ease-in var(--d2l-button-add-animation-delay) 1 forwards;
|
|
115
|
-
transition: all var(--d2l-button-add-animation-duration) ease-in var(--d2l-button-add-animation-delay);
|
|
116
|
-
}
|
|
117
|
-
button:hover .line-end,
|
|
118
|
-
button:focus .line-end {
|
|
119
|
-
animation-name: line-end-animation;
|
|
120
|
-
}
|
|
121
118
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
100% {
|
|
128
|
-
background: linear-gradient(to var(--d2l-inline-end, right), var(--d2l-button-add-line-color) 0%, var(--d2l-button-add-line-color) 11%, var(--d2l-button-add-hover-focus-color) 11%) var(--d2l-inline-start, left) center / 113%; /* safari */
|
|
129
|
-
background-position: var(--d2l-inline-end, right);
|
|
130
|
-
}
|
|
119
|
+
@keyframes line-start-animation {
|
|
120
|
+
0% {
|
|
121
|
+
background: linear-gradient(to var(--d2l-inline-end, right), var(--d2l-button-add-line-color) 0%, var(--d2l-button-add-line-color) 11%, var(--d2l-button-add-hover-focus-color) 11%) var(--d2l-inline-start, left) center / 113%;
|
|
122
|
+
opacity: 10%;
|
|
131
123
|
}
|
|
132
|
-
|
|
133
|
-
0%
|
|
134
|
-
|
|
135
|
-
opacity: 10%;
|
|
136
|
-
}
|
|
137
|
-
100% {
|
|
138
|
-
background: linear-gradient(to var(--d2l-inline-start, left), var(--d2l-button-add-line-color) 0%, var(--d2l-button-add-line-color) 11%, var(--d2l-button-add-hover-focus-color) 11%) var(--d2l-inline-end, right) center / 113%; /* safari */
|
|
139
|
-
background-position: var(--d2l-inline-start, left);
|
|
140
|
-
}
|
|
124
|
+
100% {
|
|
125
|
+
background: linear-gradient(to var(--d2l-inline-end, right), var(--d2l-button-add-line-color) 0%, var(--d2l-button-add-line-color) 11%, var(--d2l-button-add-hover-focus-color) 11%) var(--d2l-inline-start, left) center / 113%; /* safari */
|
|
126
|
+
background-position: var(--d2l-inline-end, right);
|
|
141
127
|
}
|
|
142
128
|
}
|
|
143
|
-
@
|
|
144
|
-
|
|
145
|
-
background-color
|
|
129
|
+
@keyframes line-end-animation {
|
|
130
|
+
0% {
|
|
131
|
+
background: linear-gradient(to var(--d2l-inline-start, left), var(--d2l-button-add-line-color) 0%, var(--d2l-button-add-line-color) 11%, var(--d2l-button-add-hover-focus-color) 11%) var(--d2l-inline-end, right) center / 113%;
|
|
132
|
+
opacity: 10%;
|
|
146
133
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
background-
|
|
134
|
+
100% {
|
|
135
|
+
background: linear-gradient(to var(--d2l-inline-start, left), var(--d2l-button-add-line-color) 0%, var(--d2l-button-add-line-color) 11%, var(--d2l-button-add-hover-focus-color) 11%) var(--d2l-inline-end, right) center / 113%; /* safari */
|
|
136
|
+
background-position: var(--d2l-inline-start, left);
|
|
150
137
|
}
|
|
151
138
|
}
|
|
152
|
-
|
|
153
|
-
|
|
139
|
+
}
|
|
140
|
+
@media (prefers-contrast: more) {
|
|
141
|
+
.line {
|
|
142
|
+
background-color: ButtonBorder;
|
|
143
|
+
}
|
|
144
|
+
button:hover .line,
|
|
145
|
+
button:focus .line {
|
|
146
|
+
background-color: Highlight !important;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
154
150
|
|
|
155
151
|
constructor() {
|
|
156
152
|
super();
|
|
@@ -194,49 +190,45 @@ customElements.define('d2l-button-add', ButtonAdd);
|
|
|
194
190
|
* @ignore
|
|
195
191
|
*/
|
|
196
192
|
class ButtonAddIconText extends VisibleOnAncestorMixin(LitElement) {
|
|
197
|
-
static
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
:
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
line-height: 1rem;
|
|
237
|
-
}`
|
|
238
|
-
];
|
|
239
|
-
}
|
|
193
|
+
static properties = {
|
|
194
|
+
text: { type: String }
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
static styles = [visibleOnAncestorStyles, css`
|
|
198
|
+
:host {
|
|
199
|
+
--d2l-focus-ring-offset: 0;
|
|
200
|
+
--d2l-focus-ring-color: var(--d2l-button-add-hover-focus-color);
|
|
201
|
+
--d2l-button-add-icon-text-color: var(--d2l-color-galena);
|
|
202
|
+
align-items: center;
|
|
203
|
+
display: flex;
|
|
204
|
+
stroke: var(--d2l-button-add-icon-text-color);
|
|
205
|
+
stroke-width: 2;
|
|
206
|
+
}
|
|
207
|
+
:host([visible-on-ancestor]),
|
|
208
|
+
:host([text]) {
|
|
209
|
+
--d2l-button-add-icon-text-color: var(--d2l-color-celestine);
|
|
210
|
+
}
|
|
211
|
+
:host([text]) {
|
|
212
|
+
color: var(--d2l-button-add-icon-text-color);
|
|
213
|
+
height: 1.5rem;
|
|
214
|
+
padding: 0 0.3rem;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
:host([text]) svg {
|
|
218
|
+
padding-inline-end: 0.2rem;
|
|
219
|
+
}
|
|
220
|
+
:host(:not([text])) svg {
|
|
221
|
+
margin: -0.15rem; /** hover/click target */
|
|
222
|
+
padding: 0.15rem; /** hover/click target */
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
span {
|
|
226
|
+
font-size: 0.7rem;
|
|
227
|
+
font-weight: 700;
|
|
228
|
+
letter-spacing: 0.2px;
|
|
229
|
+
line-height: 1rem;
|
|
230
|
+
}`
|
|
231
|
+
];
|
|
240
232
|
|
|
241
233
|
render() {
|
|
242
234
|
return html`
|
|
@@ -4,17 +4,15 @@ import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
|
4
4
|
|
|
5
5
|
export const ButtonCopyMixin = (superclass) => class extends LocalizeCoreElement(superclass) {
|
|
6
6
|
|
|
7
|
-
static
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
}
|
|
7
|
+
static properties = {
|
|
8
|
+
/**
|
|
9
|
+
* Disables the button
|
|
10
|
+
* @type {boolean}
|
|
11
|
+
*/
|
|
12
|
+
disabled: { type: Boolean, reflect: true },
|
|
13
|
+
_recentCopySuccessful: { state: true },
|
|
14
|
+
_toastState: { state: true }
|
|
15
|
+
};
|
|
18
16
|
|
|
19
17
|
constructor() {
|
|
20
18
|
super();
|
|
@@ -8,26 +8,22 @@ import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
|
8
8
|
*/
|
|
9
9
|
class ButtonCopy extends FocusMixin(ButtonCopyMixin(LitElement)) {
|
|
10
10
|
|
|
11
|
-
static
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
}
|
|
11
|
+
static properties = {
|
|
12
|
+
/**
|
|
13
|
+
* Description of the content being copied to clipboard
|
|
14
|
+
* @type {string}
|
|
15
|
+
*/
|
|
16
|
+
text: { type: String },
|
|
17
|
+
};
|
|
20
18
|
|
|
21
|
-
static
|
|
22
|
-
|
|
23
|
-
:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
`;
|
|
30
|
-
}
|
|
19
|
+
static styles = css`
|
|
20
|
+
:host {
|
|
21
|
+
display: inline-block;
|
|
22
|
+
}
|
|
23
|
+
:host([hidden]) {
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
31
27
|
|
|
32
28
|
static get focusElementSelector() {
|
|
33
29
|
return 'd2l-button-icon';
|
|
@@ -17,122 +17,118 @@ import { ThemeMixin } from '../../mixins/theme/theme-mixin.js';
|
|
|
17
17
|
*/
|
|
18
18
|
class ButtonIcon extends SlottedIconMixin(PropertyRequiredMixin(ThemeMixin(ButtonMixin(VisibleOnAncestorMixin(LitElement))))) {
|
|
19
19
|
|
|
20
|
-
static
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
button
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
button:hover
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
20
|
+
static properties = {
|
|
21
|
+
/**
|
|
22
|
+
* ACCESSIBILITY: A description to be added to the button for accessibility when text on button does not provide enough context
|
|
23
|
+
* @type {string}
|
|
24
|
+
*/
|
|
25
|
+
description: { type: String },
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Aligns the leading edge of text if value is set to "text" for left-aligned layouts, the trailing edge of text if value is set to "text-end" for right-aligned layouts
|
|
29
|
+
* @type {'text'|'text-end'|''}
|
|
30
|
+
*/
|
|
31
|
+
hAlign: { type: String, reflect: true, attribute: 'h-align' },
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* ACCESSIBILITY: REQUIRED: Accessible text for the button
|
|
35
|
+
* @type {string}
|
|
36
|
+
*/
|
|
37
|
+
text: { type: String, reflect: true, required: true },
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Indicates to display translucent (e.g., on rich backgrounds)
|
|
41
|
+
* @type {boolean}
|
|
42
|
+
*/
|
|
43
|
+
translucent: { type: Boolean, reflect: true }
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
static styles = [super.styles, buttonStyles, visibleOnAncestorStyles,
|
|
47
|
+
css`
|
|
48
|
+
:host {
|
|
49
|
+
--d2l-button-icon-background-color-default: var(--d2l-theme-background-color-interactive-tertiary-default);
|
|
50
|
+
--d2l-button-icon-background-color-hover-default: var(--d2l-theme-background-color-interactive-tertiary-hover);
|
|
51
|
+
--d2l-button-icon-border-radius-default: 0.3rem;
|
|
52
|
+
--d2l-button-icon-min-height-default: calc(2rem + 2px);
|
|
53
|
+
--d2l-button-icon-min-width-default: calc(2rem + 2px);
|
|
54
|
+
--d2l-button-icon-h-align: calc(((2rem + 2px - 0.9rem) / 2) * -1);
|
|
55
|
+
display: inline-block;
|
|
56
|
+
line-height: 0;
|
|
57
|
+
}
|
|
58
|
+
:host([hidden]) {
|
|
59
|
+
display: none;
|
|
60
|
+
}
|
|
61
|
+
:host([translucent]) {
|
|
62
|
+
--d2l-button-icon-background-color-default: var(--d2l-theme-background-color-interactive-translucent-default);
|
|
63
|
+
--d2l-button-icon-background-color-hover-default: var(--d2l-theme-background-color-interactive-translucent-hover);
|
|
64
|
+
--d2l-focus-ring-color: var(--d2l-theme-icon-color-inverted);
|
|
65
|
+
--d2l-focus-ring-offset: -4px;
|
|
66
|
+
--d2l-button-icon-fill-color: var(--d2l-theme-icon-color-inverted);
|
|
67
|
+
--d2l-button-icon-fill-color-hover: var(--d2l-theme-icon-color-inverted);
|
|
68
|
+
}
|
|
69
|
+
:host([theme="dark"]) {
|
|
70
|
+
--d2l-button-icon-background-color-default: transparent;
|
|
71
|
+
--d2l-button-icon-background-color-hover-default: rgba(51, 53, 54, 0.9); /* tungsten @70% @90% */
|
|
72
|
+
--d2l-button-icon-fill-color: var(--d2l-color-sylvite);
|
|
73
|
+
--d2l-button-icon-fill-color-hover: var(--d2l-color-sylvite);
|
|
74
|
+
--d2l-focus-ring-color: var(--d2l-color-celestine-plus-1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
button {
|
|
78
|
+
background-color: var(--d2l-button-icon-background-color, var(--d2l-button-icon-background-color-default));
|
|
79
|
+
border-color: transparent;
|
|
80
|
+
border-radius: var(--d2l-button-icon-border-radius, var(--d2l-button-icon-border-radius-default));
|
|
81
|
+
font-family: inherit;
|
|
82
|
+
min-height: var(--d2l-button-icon-min-height, var(--d2l-button-icon-min-height-default));
|
|
83
|
+
min-width: var(--d2l-button-icon-min-width, var(--d2l-button-icon-min-width-default));
|
|
84
|
+
padding: 0;
|
|
85
|
+
position: relative;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:host([h-align="text"]) button {
|
|
89
|
+
inset-inline-start: var(--d2l-button-icon-h-align);
|
|
90
|
+
}
|
|
91
|
+
:host([h-align="text-end"]) button {
|
|
92
|
+
inset-inline-end: var(--d2l-button-icon-h-align);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Firefox includes a hidden border which messes up button dimensions */
|
|
96
|
+
button::-moz-focus-inner {
|
|
97
|
+
border: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
button:hover:not([disabled]),
|
|
101
|
+
button:focus:not([disabled]),
|
|
102
|
+
:host([active]) button:not([disabled]) {
|
|
103
|
+
--d2l-button-icon-fill-color: var(--d2l-button-icon-fill-color-hover, var(--d2l-theme-icon-color-standard));
|
|
104
|
+
background-color: var(--d2l-button-icon-background-color-hover, var(--d2l-button-icon-background-color-hover-default));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
d2l-icon,
|
|
108
|
+
slot[name="icon"]::slotted(d2l-icon-custom) {
|
|
109
|
+
color: var(--d2l-button-icon-fill-color, var(--d2l-theme-icon-color-standard));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:host([translucent]) button {
|
|
113
|
+
transition-duration: 0.2s, 0.2s;
|
|
114
|
+
transition-property: background-color, box-shadow;
|
|
115
|
+
}
|
|
116
|
+
:host([translucent][visible-on-ancestor]) button {
|
|
117
|
+
transition-duration: 0.4s, 0.4s;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
:host([disabled]) button {
|
|
121
|
+
cursor: default;
|
|
122
|
+
opacity: var(--d2l-theme-opacity-disabled-control);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@media (prefers-reduced-motion: reduce) {
|
|
115
126
|
:host([translucent]) button {
|
|
116
|
-
transition
|
|
117
|
-
transition-property: background-color, box-shadow;
|
|
127
|
+
transition: none;
|
|
118
128
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
:host([disabled]) button {
|
|
124
|
-
cursor: default;
|
|
125
|
-
opacity: var(--d2l-theme-opacity-disabled-control);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
@media (prefers-reduced-motion: reduce) {
|
|
129
|
-
:host([translucent]) button {
|
|
130
|
-
transition: none;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
`
|
|
134
|
-
];
|
|
135
|
-
}
|
|
129
|
+
}
|
|
130
|
+
`
|
|
131
|
+
];
|
|
136
132
|
|
|
137
133
|
constructor() {
|
|
138
134
|
super();
|