@spectrum-web-components/action-group 0.0.0-20241209155954
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/README.md +478 -0
- package/package.json +76 -0
- package/sp-action-group.d.ts +6 -0
- package/sp-action-group.dev.js +5 -0
- package/sp-action-group.dev.js.map +7 -0
- package/sp-action-group.js +2 -0
- package/sp-action-group.js.map +7 -0
- package/src/ActionGroup.d.ts +49 -0
- package/src/ActionGroup.dev.js +377 -0
- package/src/ActionGroup.dev.js.map +7 -0
- package/src/ActionGroup.js +4 -0
- package/src/ActionGroup.js.map +7 -0
- package/src/action-group-overrides.css.d.ts +2 -0
- package/src/action-group-overrides.css.dev.js +7 -0
- package/src/action-group-overrides.css.dev.js.map +7 -0
- package/src/action-group-overrides.css.js +4 -0
- package/src/action-group-overrides.css.js.map +7 -0
- package/src/action-group.css.d.ts +2 -0
- package/src/action-group.css.dev.js +7 -0
- package/src/action-group.css.dev.js.map +7 -0
- package/src/action-group.css.js +4 -0
- package/src/action-group.css.js.map +7 -0
- package/src/index.d.ts +1 -0
- package/src/index.dev.js +3 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/spectrum-action-group.css.d.ts +2 -0
- package/src/spectrum-action-group.css.dev.js +7 -0
- package/src/spectrum-action-group.css.dev.js.map +7 -0
- package/src/spectrum-action-group.css.js +4 -0
- package/src/spectrum-action-group.css.js.map +7 -0
- package/src/spectrum-config.js +186 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
html,
|
|
14
|
+
SizedMixin,
|
|
15
|
+
SpectrumElement
|
|
16
|
+
} from "@spectrum-web-components/base";
|
|
17
|
+
import {
|
|
18
|
+
property,
|
|
19
|
+
query
|
|
20
|
+
} from "@spectrum-web-components/base/src/decorators.js";
|
|
21
|
+
import { RovingTabindexController } from "@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";
|
|
22
|
+
import { MutationController } from "@lit-labs/observers/mutation-controller.js";
|
|
23
|
+
import styles from "./action-group.css.js";
|
|
24
|
+
const EMPTY_SELECTION = [];
|
|
25
|
+
export class ActionGroup extends SizedMixin(SpectrumElement, {
|
|
26
|
+
validSizes: ["xs", "s", "m", "l", "xl"],
|
|
27
|
+
noDefaultSize: true
|
|
28
|
+
}) {
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
this._buttons = [];
|
|
32
|
+
this._buttonSelector = "sp-action-button, sp-action-menu";
|
|
33
|
+
this.rovingTabindexController = new RovingTabindexController(
|
|
34
|
+
this,
|
|
35
|
+
{
|
|
36
|
+
focusInIndex: (elements) => {
|
|
37
|
+
let firstEnabledIndex = -1;
|
|
38
|
+
const firstSelectedIndex = elements.findIndex((el, index) => {
|
|
39
|
+
if (!elements[firstEnabledIndex] && !el.disabled) {
|
|
40
|
+
firstEnabledIndex = index;
|
|
41
|
+
}
|
|
42
|
+
return el.selected && !el.disabled;
|
|
43
|
+
});
|
|
44
|
+
return elements[firstSelectedIndex] ? firstSelectedIndex : firstEnabledIndex;
|
|
45
|
+
},
|
|
46
|
+
elements: () => this.buttons,
|
|
47
|
+
isFocusableElement: (el) => !el.disabled
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
this.compact = false;
|
|
51
|
+
this.emphasized = false;
|
|
52
|
+
this.justified = false;
|
|
53
|
+
this.label = "";
|
|
54
|
+
this.quiet = false;
|
|
55
|
+
this.vertical = false;
|
|
56
|
+
this._selected = EMPTY_SELECTION;
|
|
57
|
+
this.hasManaged = false;
|
|
58
|
+
this.manageButtons = () => {
|
|
59
|
+
if (!this.slotElement) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const assignedElements = this.slotElement.assignedElements({
|
|
63
|
+
flatten: true
|
|
64
|
+
});
|
|
65
|
+
const buttons = assignedElements.reduce((acc, el) => {
|
|
66
|
+
if (el.matches(this._buttonSelector)) {
|
|
67
|
+
acc.push(el);
|
|
68
|
+
} else {
|
|
69
|
+
const buttonDescendents = Array.from(
|
|
70
|
+
el.querySelectorAll(`:scope > ${this._buttonSelector}`)
|
|
71
|
+
);
|
|
72
|
+
acc.push(...buttonDescendents);
|
|
73
|
+
}
|
|
74
|
+
return acc;
|
|
75
|
+
}, []);
|
|
76
|
+
this.buttons = buttons;
|
|
77
|
+
if (this.selects || !this.hasManaged) {
|
|
78
|
+
const currentlySelectedButtons = [];
|
|
79
|
+
this.buttons.forEach((button) => {
|
|
80
|
+
if (button.selected) {
|
|
81
|
+
currentlySelectedButtons.push(button.value);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
this.setSelected(this.selected.concat(currentlySelectedButtons));
|
|
85
|
+
}
|
|
86
|
+
this.manageChildren();
|
|
87
|
+
this.manageSelects();
|
|
88
|
+
this.hasManaged = true;
|
|
89
|
+
};
|
|
90
|
+
new MutationController(this, {
|
|
91
|
+
config: {
|
|
92
|
+
childList: true,
|
|
93
|
+
subtree: true
|
|
94
|
+
},
|
|
95
|
+
callback: () => {
|
|
96
|
+
this.manageButtons();
|
|
97
|
+
},
|
|
98
|
+
skipInitial: true
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
static get styles() {
|
|
102
|
+
return [styles];
|
|
103
|
+
}
|
|
104
|
+
set buttons(buttons) {
|
|
105
|
+
if (buttons === this.buttons) return;
|
|
106
|
+
this._buttons = buttons;
|
|
107
|
+
this.rovingTabindexController.clearElementCache();
|
|
108
|
+
}
|
|
109
|
+
get buttons() {
|
|
110
|
+
return this._buttons;
|
|
111
|
+
}
|
|
112
|
+
set selected(selected) {
|
|
113
|
+
this.requestUpdate("selected", this._selected);
|
|
114
|
+
this._selected = selected;
|
|
115
|
+
this.updateComplete.then(() => {
|
|
116
|
+
this.applySelects();
|
|
117
|
+
this.manageChildren();
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
get selected() {
|
|
121
|
+
return this._selected;
|
|
122
|
+
}
|
|
123
|
+
dispatchChange(old) {
|
|
124
|
+
const applyDefault = this.dispatchEvent(
|
|
125
|
+
new Event("change", {
|
|
126
|
+
bubbles: true,
|
|
127
|
+
composed: true,
|
|
128
|
+
cancelable: true
|
|
129
|
+
})
|
|
130
|
+
);
|
|
131
|
+
if (!applyDefault) {
|
|
132
|
+
this.setSelected(old);
|
|
133
|
+
this.buttons.map((button) => {
|
|
134
|
+
button.selected = this.selected.includes(button.value);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
setSelected(selected, announce) {
|
|
139
|
+
if (selected === this.selected) return;
|
|
140
|
+
const old = this.selected;
|
|
141
|
+
this.requestUpdate("selected", old);
|
|
142
|
+
this._selected = selected;
|
|
143
|
+
if (!announce) return;
|
|
144
|
+
this.dispatchChange(old);
|
|
145
|
+
}
|
|
146
|
+
focus(options) {
|
|
147
|
+
this.rovingTabindexController.focus(options);
|
|
148
|
+
}
|
|
149
|
+
deselectSelectedButtons() {
|
|
150
|
+
this.buttons.forEach((button) => {
|
|
151
|
+
if (!button.selected) return;
|
|
152
|
+
button.selected = false;
|
|
153
|
+
button.tabIndex = -1;
|
|
154
|
+
button.setAttribute(
|
|
155
|
+
this.selects ? "aria-checked" : (
|
|
156
|
+
/* c8 ignore */
|
|
157
|
+
"aria-pressed"
|
|
158
|
+
),
|
|
159
|
+
"false"
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
handleActionButtonChange(event) {
|
|
164
|
+
event.stopPropagation();
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
}
|
|
167
|
+
handleClick(event) {
|
|
168
|
+
const target = event.target;
|
|
169
|
+
if (typeof target.value === "undefined") {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
switch (this.selects) {
|
|
173
|
+
case "single": {
|
|
174
|
+
this.deselectSelectedButtons();
|
|
175
|
+
target.selected = true;
|
|
176
|
+
target.tabIndex = 0;
|
|
177
|
+
target.setAttribute("aria-checked", "true");
|
|
178
|
+
this.setSelected([target.value], true);
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
case "multiple": {
|
|
182
|
+
const selected = [...this.selected];
|
|
183
|
+
target.selected = !target.selected;
|
|
184
|
+
target.setAttribute(
|
|
185
|
+
"aria-checked",
|
|
186
|
+
target.selected ? "true" : "false"
|
|
187
|
+
);
|
|
188
|
+
if (target.selected) {
|
|
189
|
+
selected.push(target.value);
|
|
190
|
+
} else {
|
|
191
|
+
selected.splice(this.selected.indexOf(target.value), 1);
|
|
192
|
+
}
|
|
193
|
+
this.setSelected(selected, true);
|
|
194
|
+
this.buttons.forEach((button) => {
|
|
195
|
+
button.tabIndex = -1;
|
|
196
|
+
});
|
|
197
|
+
target.tabIndex = 0;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
default:
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
async applySelects() {
|
|
205
|
+
await this.manageSelects(true);
|
|
206
|
+
}
|
|
207
|
+
async manageSelects(applied) {
|
|
208
|
+
if (!this.buttons.length) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const options = this.buttons;
|
|
212
|
+
switch (this.selects) {
|
|
213
|
+
case "single": {
|
|
214
|
+
this.setAttribute("role", "radiogroup");
|
|
215
|
+
const selections = [];
|
|
216
|
+
const updates = options.map(async (option) => {
|
|
217
|
+
await option.updateComplete;
|
|
218
|
+
option.setAttribute("role", "radio");
|
|
219
|
+
option.setAttribute(
|
|
220
|
+
"aria-checked",
|
|
221
|
+
option.selected ? "true" : "false"
|
|
222
|
+
);
|
|
223
|
+
if (option.selected) {
|
|
224
|
+
selections.push(option);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
if (applied) break;
|
|
228
|
+
await Promise.all(updates);
|
|
229
|
+
const selected = selections.map((button) => {
|
|
230
|
+
return button.value;
|
|
231
|
+
});
|
|
232
|
+
this.setSelected(selected || EMPTY_SELECTION);
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
case "multiple": {
|
|
236
|
+
if (this.getAttribute("role") === "radiogroup") {
|
|
237
|
+
this.removeAttribute("role");
|
|
238
|
+
}
|
|
239
|
+
const selection = [];
|
|
240
|
+
const selections = [];
|
|
241
|
+
const updates = options.map(async (option) => {
|
|
242
|
+
await option.updateComplete;
|
|
243
|
+
option.setAttribute("role", "checkbox");
|
|
244
|
+
option.setAttribute(
|
|
245
|
+
"aria-checked",
|
|
246
|
+
option.selected ? "true" : "false"
|
|
247
|
+
);
|
|
248
|
+
if (option.selected) {
|
|
249
|
+
selection.push(option.value);
|
|
250
|
+
selections.push(option);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
if (applied) break;
|
|
254
|
+
await Promise.all(updates);
|
|
255
|
+
const selected = !!selection.length ? selection : EMPTY_SELECTION;
|
|
256
|
+
this.setSelected(selected);
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
default:
|
|
260
|
+
if (this.selected.length) {
|
|
261
|
+
const selections = [];
|
|
262
|
+
const updates = options.map(async (option) => {
|
|
263
|
+
await option.updateComplete;
|
|
264
|
+
option.setAttribute("role", "button");
|
|
265
|
+
if (option.selected) {
|
|
266
|
+
option.setAttribute("aria-pressed", "true");
|
|
267
|
+
selections.push(option);
|
|
268
|
+
} else {
|
|
269
|
+
option.removeAttribute("aria-pressed");
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
if (applied) break;
|
|
273
|
+
await Promise.all(updates);
|
|
274
|
+
this.setSelected(
|
|
275
|
+
selections.map((button) => {
|
|
276
|
+
return button.value;
|
|
277
|
+
})
|
|
278
|
+
);
|
|
279
|
+
} else {
|
|
280
|
+
this.buttons.forEach((option) => {
|
|
281
|
+
option.setAttribute("role", "button");
|
|
282
|
+
});
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (!this.hasAttribute("role")) {
|
|
287
|
+
this.setAttribute("role", "toolbar");
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
render() {
|
|
291
|
+
return html`
|
|
292
|
+
<slot role="presentation" @slotchange=${this.manageButtons}></slot>
|
|
293
|
+
`;
|
|
294
|
+
}
|
|
295
|
+
firstUpdated(changes) {
|
|
296
|
+
super.firstUpdated(changes);
|
|
297
|
+
this.addEventListener("click", this.handleClick);
|
|
298
|
+
}
|
|
299
|
+
updated(changes) {
|
|
300
|
+
super.updated(changes);
|
|
301
|
+
if (changes.has("selects")) {
|
|
302
|
+
this.manageSelects();
|
|
303
|
+
this.manageChildren();
|
|
304
|
+
if (!!this.selects) {
|
|
305
|
+
this.shadowRoot.addEventListener(
|
|
306
|
+
"change",
|
|
307
|
+
this.handleActionButtonChange
|
|
308
|
+
);
|
|
309
|
+
} else {
|
|
310
|
+
this.shadowRoot.removeEventListener(
|
|
311
|
+
"change",
|
|
312
|
+
this.handleActionButtonChange
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (changes.has("quiet") || changes.has("emphasized") || changes.has("size") || changes.has("staticColor")) {
|
|
317
|
+
this.manageChildren(changes);
|
|
318
|
+
}
|
|
319
|
+
if (changes.has("label") && (this.label || typeof changes.get("label") !== "undefined")) {
|
|
320
|
+
if (this.label.length) {
|
|
321
|
+
this.setAttribute("aria-label", this.label);
|
|
322
|
+
} else {
|
|
323
|
+
this.removeAttribute("aria-label");
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
manageChildren(changes) {
|
|
328
|
+
this.buttons.forEach((button) => {
|
|
329
|
+
if (this.quiet || (changes == null ? void 0 : changes.get("quiet"))) {
|
|
330
|
+
button.quiet = this.quiet;
|
|
331
|
+
}
|
|
332
|
+
if (this.emphasized || (changes == null ? void 0 : changes.get("emphasized"))) {
|
|
333
|
+
button.emphasized = this.emphasized;
|
|
334
|
+
}
|
|
335
|
+
if (this.staticColor || (changes == null ? void 0 : changes.get("staticColor"))) {
|
|
336
|
+
button.staticColor = this.staticColor;
|
|
337
|
+
}
|
|
338
|
+
if (this.selects || !this.hasManaged) {
|
|
339
|
+
button.selected = this.selected.includes(button.value);
|
|
340
|
+
}
|
|
341
|
+
if (this.size && (this.size !== "m" || typeof (changes == null ? void 0 : changes.get("size")) !== "undefined")) {
|
|
342
|
+
button.size = this.size;
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
__decorateClass([
|
|
348
|
+
property({ type: Boolean, reflect: true })
|
|
349
|
+
], ActionGroup.prototype, "compact", 2);
|
|
350
|
+
__decorateClass([
|
|
351
|
+
property({ type: Boolean, reflect: true })
|
|
352
|
+
], ActionGroup.prototype, "emphasized", 2);
|
|
353
|
+
__decorateClass([
|
|
354
|
+
property({ type: Boolean, reflect: true })
|
|
355
|
+
], ActionGroup.prototype, "justified", 2);
|
|
356
|
+
__decorateClass([
|
|
357
|
+
property({ type: String })
|
|
358
|
+
], ActionGroup.prototype, "label", 2);
|
|
359
|
+
__decorateClass([
|
|
360
|
+
property({ type: Boolean, reflect: true })
|
|
361
|
+
], ActionGroup.prototype, "quiet", 2);
|
|
362
|
+
__decorateClass([
|
|
363
|
+
property({ type: String })
|
|
364
|
+
], ActionGroup.prototype, "selects", 2);
|
|
365
|
+
__decorateClass([
|
|
366
|
+
property({ reflect: true, attribute: "static-color" })
|
|
367
|
+
], ActionGroup.prototype, "staticColor", 2);
|
|
368
|
+
__decorateClass([
|
|
369
|
+
property({ type: Boolean, reflect: true })
|
|
370
|
+
], ActionGroup.prototype, "vertical", 2);
|
|
371
|
+
__decorateClass([
|
|
372
|
+
property({ type: Array })
|
|
373
|
+
], ActionGroup.prototype, "selected", 1);
|
|
374
|
+
__decorateClass([
|
|
375
|
+
query("slot")
|
|
376
|
+
], ActionGroup.prototype, "slotElement", 2);
|
|
377
|
+
//# sourceMappingURL=ActionGroup.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["ActionGroup.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport type { ActionButton } from '@spectrum-web-components/action-button';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\nimport { MutationController } from '@lit-labs/observers/mutation-controller.js';\n\nimport styles from './action-group.css.js';\n\nconst EMPTY_SELECTION: string[] = [];\n\n/**\n * @element sp-action-group\n * @slot - the sp-action-button elements that make up the group\n *\n * @fires change - Announces that selection state has been changed by user\n */\nexport class ActionGroup extends SizedMixin(SpectrumElement, {\n validSizes: ['xs', 's', 'm', 'l', 'xl'],\n noDefaultSize: true,\n}) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n public set buttons(buttons: ActionButton[]) {\n /* c8 ignore next 1 */\n if (buttons === this.buttons) return;\n this._buttons = buttons;\n this.rovingTabindexController.clearElementCache();\n }\n\n public get buttons(): ActionButton[] {\n return this._buttons;\n }\n\n public _buttons: ActionButton[] = [];\n\n protected _buttonSelector = 'sp-action-button, sp-action-menu';\n\n constructor() {\n super();\n\n new MutationController(this, {\n config: {\n childList: true,\n subtree: true,\n },\n callback: () => {\n this.manageButtons();\n },\n skipInitial: true,\n });\n }\n\n rovingTabindexController = new RovingTabindexController<ActionButton>(\n this,\n {\n focusInIndex: (elements: ActionButton[]) => {\n let firstEnabledIndex = -1;\n const firstSelectedIndex = elements.findIndex((el, index) => {\n if (!elements[firstEnabledIndex] && !el.disabled) {\n firstEnabledIndex = index;\n }\n return el.selected && !el.disabled;\n });\n return elements[firstSelectedIndex]\n ? firstSelectedIndex\n : firstEnabledIndex;\n },\n elements: () => this.buttons,\n isFocusableElement: (el: ActionButton) => !el.disabled,\n }\n );\n\n @property({ type: Boolean, reflect: true })\n public compact = false;\n\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n @property({ type: Boolean, reflect: true })\n public justified = false;\n\n @property({ type: String })\n public label = '';\n\n @property({ type: Boolean, reflect: true })\n public quiet = false;\n\n @property({ type: String })\n public selects: undefined | 'single' | 'multiple';\n\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'white' | 'black';\n\n @property({ type: Boolean, reflect: true })\n public vertical = false;\n\n private _selected: string[] = EMPTY_SELECTION;\n\n set selected(selected: string[]) {\n this.requestUpdate('selected', this._selected);\n this._selected = selected;\n this.updateComplete.then(() => {\n this.applySelects();\n this.manageChildren();\n });\n }\n\n @property({ type: Array })\n get selected(): string[] {\n return this._selected;\n }\n\n @query('slot')\n slotElement!: HTMLSlotElement;\n\n private dispatchChange(old: string[]): void {\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n if (!applyDefault) {\n this.setSelected(old);\n this.buttons.map((button) => {\n button.selected = this.selected.includes(button.value);\n });\n }\n }\n\n private setSelected(selected: string[], announce?: boolean): void {\n /* c8 ignore next 1 */\n if (selected === this.selected) return;\n\n const old = this.selected;\n this.requestUpdate('selected', old);\n this._selected = selected;\n if (!announce) return;\n this.dispatchChange(old);\n }\n\n public override focus(options?: FocusOptions): void {\n this.rovingTabindexController.focus(options);\n }\n\n private deselectSelectedButtons(): void {\n this.buttons.forEach((button) => {\n if (!button.selected) return;\n\n button.selected = false;\n button.tabIndex = -1;\n button.setAttribute(\n this.selects ? 'aria-checked' : /* c8 ignore */ 'aria-pressed',\n 'false'\n );\n });\n }\n\n private handleActionButtonChange(event: Event): void {\n event.stopPropagation();\n event.preventDefault();\n }\n\n private handleClick(event: Event): void {\n const target = event.target as ActionButton;\n if (typeof target.value === 'undefined') {\n return;\n }\n switch (this.selects) {\n case 'single': {\n this.deselectSelectedButtons();\n target.selected = true;\n target.tabIndex = 0;\n target.setAttribute('aria-checked', 'true');\n this.setSelected([target.value], true);\n break;\n }\n case 'multiple': {\n const selected = [...this.selected];\n target.selected = !target.selected;\n target.setAttribute(\n 'aria-checked',\n target.selected ? 'true' : 'false'\n );\n if (target.selected) {\n selected.push(target.value);\n } else {\n selected.splice(this.selected.indexOf(target.value), 1);\n }\n this.setSelected(selected, true);\n\n this.buttons.forEach((button) => {\n button.tabIndex = -1;\n });\n\n target.tabIndex = 0;\n\n break;\n }\n default:\n break;\n }\n }\n\n private async applySelects(): Promise<void> {\n await this.manageSelects(true);\n }\n\n private async manageSelects(applied?: boolean): Promise<void> {\n if (!this.buttons.length) {\n return;\n }\n\n const options = this.buttons;\n switch (this.selects) {\n case 'single': {\n // single behaves as a radio group\n this.setAttribute('role', 'radiogroup');\n const selections: ActionButton[] = [];\n const updates = options.map(async (option) => {\n await option.updateComplete;\n option.setAttribute('role', 'radio');\n option.setAttribute(\n 'aria-checked',\n option.selected ? 'true' : 'false'\n );\n if (option.selected) {\n selections.push(option);\n }\n });\n if (applied) break;\n await Promise.all(updates);\n\n const selected = selections.map((button) => {\n return button.value;\n });\n\n this.setSelected(selected || EMPTY_SELECTION);\n break;\n }\n case 'multiple': {\n // switching from single to multiple, remove role=\"radiogroup\"\n if (this.getAttribute('role') === 'radiogroup') {\n this.removeAttribute('role');\n }\n const selection: string[] = [];\n const selections: ActionButton[] = [];\n const updates = options.map(async (option) => {\n await option.updateComplete;\n option.setAttribute('role', 'checkbox');\n option.setAttribute(\n 'aria-checked',\n option.selected ? 'true' : 'false'\n );\n if (option.selected) {\n selection.push(option.value);\n selections.push(option);\n }\n });\n if (applied) break;\n await Promise.all(updates);\n const selected = !!selection.length\n ? selection\n : EMPTY_SELECTION;\n this.setSelected(selected);\n break;\n }\n default:\n // if user defines .selected\n if (this.selected.length) {\n const selections: ActionButton[] = [];\n const updates = options.map(async (option) => {\n await option.updateComplete;\n option.setAttribute('role', 'button');\n if (option.selected) {\n option.setAttribute('aria-pressed', 'true');\n selections.push(option);\n } else {\n option.removeAttribute('aria-pressed');\n }\n });\n if (applied) break;\n await Promise.all(updates);\n\n this.setSelected(\n selections.map((button) => {\n return button.value;\n })\n );\n } else {\n this.buttons.forEach((option) => {\n option.setAttribute('role', 'button');\n });\n break;\n }\n }\n\n // When no other role is defined, use role=\"toolbar\", which is appropriate with roving tabindex.\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'toolbar');\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot role=\"presentation\" @slotchange=${this.manageButtons}></slot>\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.addEventListener('click', this.handleClick);\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('selects')) {\n this.manageSelects();\n this.manageChildren();\n if (!!this.selects) {\n this.shadowRoot.addEventListener(\n 'change',\n this.handleActionButtonChange\n );\n } else {\n this.shadowRoot.removeEventListener(\n 'change',\n this.handleActionButtonChange\n );\n }\n }\n if (\n changes.has('quiet') ||\n changes.has('emphasized') ||\n changes.has('size') ||\n changes.has('staticColor')\n ) {\n this.manageChildren(changes);\n }\n // Update `aria-label` when `label` available or not first `updated`\n if (\n changes.has('label') &&\n (this.label || typeof changes.get('label') !== 'undefined')\n ) {\n if (this.label.length) {\n this.setAttribute('aria-label', this.label);\n } else {\n this.removeAttribute('aria-label');\n }\n }\n }\n\n private manageChildren(changes?: PropertyValues): void {\n this.buttons.forEach((button) => {\n if (this.quiet || changes?.get('quiet')) {\n button.quiet = this.quiet;\n }\n if (this.emphasized || changes?.get('emphasized')) {\n button.emphasized = this.emphasized;\n }\n if (this.staticColor || changes?.get('staticColor')) {\n button.staticColor = this.staticColor;\n }\n if (this.selects || !this.hasManaged) {\n button.selected = this.selected.includes(button.value);\n }\n if (\n this.size &&\n (this.size !== 'm' ||\n typeof changes?.get('size') !== 'undefined')\n ) {\n button.size = this.size;\n }\n });\n }\n\n private hasManaged = false;\n\n private manageButtons = (): void => {\n if (!this.slotElement) {\n return;\n }\n const assignedElements = this.slotElement.assignedElements({\n flatten: true,\n });\n const buttons = assignedElements.reduce((acc: unknown[], el) => {\n if (el.matches(this._buttonSelector)) {\n acc.push(el);\n } else {\n const buttonDescendents = Array.from(\n el.querySelectorAll(`:scope > ${this._buttonSelector}`)\n );\n acc.push(...buttonDescendents);\n }\n return acc;\n }, []);\n this.buttons = buttons as ActionButton[];\n if (this.selects || !this.hasManaged) {\n // <select> element merges selected so following paradigm here\n const currentlySelectedButtons: string[] = [];\n this.buttons.forEach((button: ActionButton) => {\n if (button.selected) {\n currentlySelectedButtons.push(button.value);\n }\n });\n this.setSelected(this.selected.concat(currentlySelectedButtons));\n }\n this.manageChildren();\n this.manageSelects();\n this.hasManaged = true;\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EAEA;AAAA,EACA;AAAA,OAEG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAEP,SAAS,gCAAgC;A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cACtC;AACE,eAAO,OAAO,KAAK;AAAA,MACvB;AAAA,IACJ,CAAC;AAAA,EACL;AAqCJ;AApVW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GA1DjC,YA2DF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GA7DjC,YA8DF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAhEjC,YAiEF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAnEjB,YAoEF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAtEjC,YAuEF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAzEjB,YA0EF;AAGA;AAAA,EADN,SAAS,EAAE,SAAS,MAAM,WAAW,eAAe,CAAC;AAAA,GA5E7C,YA6EF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GA/EjC,YAgFF;AAcH;AAAA,EADH,SAAS,EAAE,MAAM,MAAM,CAAC;AAAA,GA7FhB,YA8FL;AAKJ;AAAA,EADC,MAAM,MAAM;AAAA,GAlGJ,YAmGT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";var h=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var r=(c,u,e,s)=>{for(var t=s>1?void 0:s?p(u,e):u,i=c.length-1,l;i>=0;i--)(l=c[i])&&(t=(s?l(u,e,t):l(t))||t);return s&&t&&h(u,e,t),t};import{html as b,SizedMixin as f,SpectrumElement as m}from"@spectrum-web-components/base";import{property as o,query as v}from"@spectrum-web-components/base/src/decorators.js";import{RovingTabindexController as g}from"@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";import{MutationController as y}from"@lit-labs/observers/mutation-controller.js";import S from"./action-group.css.js";const d=[];export class ActionGroup extends f(m,{validSizes:["xs","s","m","l","xl"],noDefaultSize:!0}){constructor(){super();this._buttons=[];this._buttonSelector="sp-action-button, sp-action-menu";this.rovingTabindexController=new g(this,{focusInIndex:e=>{let s=-1;const t=e.findIndex((i,l)=>(!e[s]&&!i.disabled&&(s=l),i.selected&&!i.disabled));return e[t]?t:s},elements:()=>this.buttons,isFocusableElement:e=>!e.disabled});this.compact=!1;this.emphasized=!1;this.justified=!1;this.label="";this.quiet=!1;this.vertical=!1;this._selected=d;this.hasManaged=!1;this.manageButtons=()=>{if(!this.slotElement)return;const s=this.slotElement.assignedElements({flatten:!0}).reduce((t,i)=>{if(i.matches(this._buttonSelector))t.push(i);else{const l=Array.from(i.querySelectorAll(`:scope > ${this._buttonSelector}`));t.push(...l)}return t},[]);if(this.buttons=s,this.selects||!this.hasManaged){const t=[];this.buttons.forEach(i=>{i.selected&&t.push(i.value)}),this.setSelected(this.selected.concat(t))}this.manageChildren(),this.manageSelects(),this.hasManaged=!0};new y(this,{config:{childList:!0,subtree:!0},callback:()=>{this.manageButtons()},skipInitial:!0})}static get styles(){return[S]}set buttons(e){e!==this.buttons&&(this._buttons=e,this.rovingTabindexController.clearElementCache())}get buttons(){return this._buttons}set selected(e){this.requestUpdate("selected",this._selected),this._selected=e,this.updateComplete.then(()=>{this.applySelects(),this.manageChildren()})}get selected(){return this._selected}dispatchChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0,cancelable:!0}))||(this.setSelected(e),this.buttons.map(t=>{t.selected=this.selected.includes(t.value)}))}setSelected(e,s){if(e===this.selected)return;const t=this.selected;this.requestUpdate("selected",t),this._selected=e,s&&this.dispatchChange(t)}focus(e){this.rovingTabindexController.focus(e)}deselectSelectedButtons(){this.buttons.forEach(e=>{e.selected&&(e.selected=!1,e.tabIndex=-1,e.setAttribute(this.selects?"aria-checked":"aria-pressed","false"))})}handleActionButtonChange(e){e.stopPropagation(),e.preventDefault()}handleClick(e){const s=e.target;if(typeof s.value!="undefined")switch(this.selects){case"single":{this.deselectSelectedButtons(),s.selected=!0,s.tabIndex=0,s.setAttribute("aria-checked","true"),this.setSelected([s.value],!0);break}case"multiple":{const t=[...this.selected];s.selected=!s.selected,s.setAttribute("aria-checked",s.selected?"true":"false"),s.selected?t.push(s.value):t.splice(this.selected.indexOf(s.value),1),this.setSelected(t,!0),this.buttons.forEach(i=>{i.tabIndex=-1}),s.tabIndex=0;break}default:break}}async applySelects(){await this.manageSelects(!0)}async manageSelects(e){if(!this.buttons.length)return;const s=this.buttons;switch(this.selects){case"single":{this.setAttribute("role","radiogroup");const t=[],i=s.map(async a=>{await a.updateComplete,a.setAttribute("role","radio"),a.setAttribute("aria-checked",a.selected?"true":"false"),a.selected&&t.push(a)});if(e)break;await Promise.all(i);const l=t.map(a=>a.value);this.setSelected(l||d);break}case"multiple":{this.getAttribute("role")==="radiogroup"&&this.removeAttribute("role");const t=[],i=[],l=s.map(async n=>{await n.updateComplete,n.setAttribute("role","checkbox"),n.setAttribute("aria-checked",n.selected?"true":"false"),n.selected&&(t.push(n.value),i.push(n))});if(e)break;await Promise.all(l);const a=t.length?t:d;this.setSelected(a);break}default:if(this.selected.length){const t=[],i=s.map(async l=>{await l.updateComplete,l.setAttribute("role","button"),l.selected?(l.setAttribute("aria-pressed","true"),t.push(l)):l.removeAttribute("aria-pressed")});if(e)break;await Promise.all(i),this.setSelected(t.map(l=>l.value))}else{this.buttons.forEach(t=>{t.setAttribute("role","button")});break}}this.hasAttribute("role")||this.setAttribute("role","toolbar")}render(){return b`
|
|
2
|
+
<slot role="presentation" @slotchange=${this.manageButtons}></slot>
|
|
3
|
+
`}firstUpdated(e){super.firstUpdated(e),this.addEventListener("click",this.handleClick)}updated(e){super.updated(e),e.has("selects")&&(this.manageSelects(),this.manageChildren(),this.selects?this.shadowRoot.addEventListener("change",this.handleActionButtonChange):this.shadowRoot.removeEventListener("change",this.handleActionButtonChange)),(e.has("quiet")||e.has("emphasized")||e.has("size")||e.has("staticColor"))&&this.manageChildren(e),e.has("label")&&(this.label||typeof e.get("label")!="undefined")&&(this.label.length?this.setAttribute("aria-label",this.label):this.removeAttribute("aria-label"))}manageChildren(e){this.buttons.forEach(s=>{(this.quiet||e!=null&&e.get("quiet"))&&(s.quiet=this.quiet),(this.emphasized||e!=null&&e.get("emphasized"))&&(s.emphasized=this.emphasized),(this.staticColor||e!=null&&e.get("staticColor"))&&(s.staticColor=this.staticColor),(this.selects||!this.hasManaged)&&(s.selected=this.selected.includes(s.value)),this.size&&(this.size!=="m"||typeof(e==null?void 0:e.get("size"))!="undefined")&&(s.size=this.size)})}}r([o({type:Boolean,reflect:!0})],ActionGroup.prototype,"compact",2),r([o({type:Boolean,reflect:!0})],ActionGroup.prototype,"emphasized",2),r([o({type:Boolean,reflect:!0})],ActionGroup.prototype,"justified",2),r([o({type:String})],ActionGroup.prototype,"label",2),r([o({type:Boolean,reflect:!0})],ActionGroup.prototype,"quiet",2),r([o({type:String})],ActionGroup.prototype,"selects",2),r([o({reflect:!0,attribute:"static-color"})],ActionGroup.prototype,"staticColor",2),r([o({type:Boolean,reflect:!0})],ActionGroup.prototype,"vertical",2),r([o({type:Array})],ActionGroup.prototype,"selected",1),r([v("slot")],ActionGroup.prototype,"slotElement",2);
|
|
4
|
+
//# sourceMappingURL=ActionGroup.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["ActionGroup.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport type { ActionButton } from '@spectrum-web-components/action-button';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\nimport { MutationController } from '@lit-labs/observers/mutation-controller.js';\n\nimport styles from './action-group.css.js';\n\nconst EMPTY_SELECTION: string[] = [];\n\n/**\n * @element sp-action-group\n * @slot - the sp-action-button elements that make up the group\n *\n * @fires change - Announces that selection state has been changed by user\n */\nexport class ActionGroup extends SizedMixin(SpectrumElement, {\n validSizes: ['xs', 's', 'm', 'l', 'xl'],\n noDefaultSize: true,\n}) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n public set buttons(buttons: ActionButton[]) {\n /* c8 ignore next 1 */\n if (buttons === this.buttons) return;\n this._buttons = buttons;\n this.rovingTabindexController.clearElementCache();\n }\n\n public get buttons(): ActionButton[] {\n return this._buttons;\n }\n\n public _buttons: ActionButton[] = [];\n\n protected _buttonSelector = 'sp-action-button, sp-action-menu';\n\n constructor() {\n super();\n\n new MutationController(this, {\n config: {\n childList: true,\n subtree: true,\n },\n callback: () => {\n this.manageButtons();\n },\n skipInitial: true,\n });\n }\n\n rovingTabindexController = new RovingTabindexController<ActionButton>(\n this,\n {\n focusInIndex: (elements: ActionButton[]) => {\n let firstEnabledIndex = -1;\n const firstSelectedIndex = elements.findIndex((el, index) => {\n if (!elements[firstEnabledIndex] && !el.disabled) {\n firstEnabledIndex = index;\n }\n return el.selected && !el.disabled;\n });\n return elements[firstSelectedIndex]\n ? firstSelectedIndex\n : firstEnabledIndex;\n },\n elements: () => this.buttons,\n isFocusableElement: (el: ActionButton) => !el.disabled,\n }\n );\n\n @property({ type: Boolean, reflect: true })\n public compact = false;\n\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n @property({ type: Boolean, reflect: true })\n public justified = false;\n\n @property({ type: String })\n public label = '';\n\n @property({ type: Boolean, reflect: true })\n public quiet = false;\n\n @property({ type: String })\n public selects: undefined | 'single' | 'multiple';\n\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'white' | 'black';\n\n @property({ type: Boolean, reflect: true })\n public vertical = false;\n\n private _selected: string[] = EMPTY_SELECTION;\n\n set selected(selected: string[]) {\n this.requestUpdate('selected', this._selected);\n this._selected = selected;\n this.updateComplete.then(() => {\n this.applySelects();\n this.manageChildren();\n });\n }\n\n @property({ type: Array })\n get selected(): string[] {\n return this._selected;\n }\n\n @query('slot')\n slotElement!: HTMLSlotElement;\n\n private dispatchChange(old: string[]): void {\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n if (!applyDefault) {\n this.setSelected(old);\n this.buttons.map((button) => {\n button.selected = this.selected.includes(button.value);\n });\n }\n }\n\n private setSelected(selected: string[], announce?: boolean): void {\n /* c8 ignore next 1 */\n if (selected === this.selected) return;\n\n const old = this.selected;\n this.requestUpdate('selected', old);\n this._selected = selected;\n if (!announce) return;\n this.dispatchChange(old);\n }\n\n public override focus(options?: FocusOptions): void {\n this.rovingTabindexController.focus(options);\n }\n\n private deselectSelectedButtons(): void {\n this.buttons.forEach((button) => {\n if (!button.selected) return;\n\n button.selected = false;\n button.tabIndex = -1;\n button.setAttribute(\n this.selects ? 'aria-checked' : /* c8 ignore */ 'aria-pressed',\n 'false'\n );\n });\n }\n\n private handleActionButtonChange(event: Event): void {\n event.stopPropagation();\n event.preventDefault();\n }\n\n private handleClick(event: Event): void {\n const target = event.target as ActionButton;\n if (typeof target.value === 'undefined') {\n return;\n }\n switch (this.selects) {\n case 'single': {\n this.deselectSelectedButtons();\n target.selected = true;\n target.tabIndex = 0;\n target.setAttribute('aria-checked', 'true');\n this.setSelected([target.value], true);\n break;\n }\n case 'multiple': {\n const selected = [...this.selected];\n target.selected = !target.selected;\n target.setAttribute(\n 'aria-checked',\n target.selected ? 'true' : 'false'\n );\n if (target.selected) {\n selected.push(target.value);\n } else {\n selected.splice(this.selected.indexOf(target.value), 1);\n }\n this.setSelected(selected, true);\n\n this.buttons.forEach((button) => {\n button.tabIndex = -1;\n });\n\n target.tabIndex = 0;\n\n break;\n }\n default:\n break;\n }\n }\n\n private async applySelects(): Promise<void> {\n await this.manageSelects(true);\n }\n\n private async manageSelects(applied?: boolean): Promise<void> {\n if (!this.buttons.length) {\n return;\n }\n\n const options = this.buttons;\n switch (this.selects) {\n case 'single': {\n // single behaves as a radio group\n this.setAttribute('role', 'radiogroup');\n const selections: ActionButton[] = [];\n const updates = options.map(async (option) => {\n await option.updateComplete;\n option.setAttribute('role', 'radio');\n option.setAttribute(\n 'aria-checked',\n option.selected ? 'true' : 'false'\n );\n if (option.selected) {\n selections.push(option);\n }\n });\n if (applied) break;\n await Promise.all(updates);\n\n const selected = selections.map((button) => {\n return button.value;\n });\n\n this.setSelected(selected || EMPTY_SELECTION);\n break;\n }\n case 'multiple': {\n // switching from single to multiple, remove role=\"radiogroup\"\n if (this.getAttribute('role') === 'radiogroup') {\n this.removeAttribute('role');\n }\n const selection: string[] = [];\n const selections: ActionButton[] = [];\n const updates = options.map(async (option) => {\n await option.updateComplete;\n option.setAttribute('role', 'checkbox');\n option.setAttribute(\n 'aria-checked',\n option.selected ? 'true' : 'false'\n );\n if (option.selected) {\n selection.push(option.value);\n selections.push(option);\n }\n });\n if (applied) break;\n await Promise.all(updates);\n const selected = !!selection.length\n ? selection\n : EMPTY_SELECTION;\n this.setSelected(selected);\n break;\n }\n default:\n // if user defines .selected\n if (this.selected.length) {\n const selections: ActionButton[] = [];\n const updates = options.map(async (option) => {\n await option.updateComplete;\n option.setAttribute('role', 'button');\n if (option.selected) {\n option.setAttribute('aria-pressed', 'true');\n selections.push(option);\n } else {\n option.removeAttribute('aria-pressed');\n }\n });\n if (applied) break;\n await Promise.all(updates);\n\n this.setSelected(\n selections.map((button) => {\n return button.value;\n })\n );\n } else {\n this.buttons.forEach((option) => {\n option.setAttribute('role', 'button');\n });\n break;\n }\n }\n\n // When no other role is defined, use role=\"toolbar\", which is appropriate with roving tabindex.\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'toolbar');\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot role=\"presentation\" @slotchange=${this.manageButtons}></slot>\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.addEventListener('click', this.handleClick);\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('selects')) {\n this.manageSelects();\n this.manageChildren();\n if (!!this.selects) {\n this.shadowRoot.addEventListener(\n 'change',\n this.handleActionButtonChange\n );\n } else {\n this.shadowRoot.removeEventListener(\n 'change',\n this.handleActionButtonChange\n );\n }\n }\n if (\n changes.has('quiet') ||\n changes.has('emphasized') ||\n changes.has('size') ||\n changes.has('staticColor')\n ) {\n this.manageChildren(changes);\n }\n // Update `aria-label` when `label` available or not first `updated`\n if (\n changes.has('label') &&\n (this.label || typeof changes.get('label') !== 'undefined')\n ) {\n if (this.label.length) {\n this.setAttribute('aria-label', this.label);\n } else {\n this.removeAttribute('aria-label');\n }\n }\n }\n\n private manageChildren(changes?: PropertyValues): void {\n this.buttons.forEach((button) => {\n if (this.quiet || changes?.get('quiet')) {\n button.quiet = this.quiet;\n }\n if (this.emphasized || changes?.get('emphasized')) {\n button.emphasized = this.emphasized;\n }\n if (this.staticColor || changes?.get('staticColor')) {\n button.staticColor = this.staticColor;\n }\n if (this.selects || !this.hasManaged) {\n button.selected = this.selected.includes(button.value);\n }\n if (\n this.size &&\n (this.size !== 'm' ||\n typeof changes?.get('size') !== 'undefined')\n ) {\n button.size = this.size;\n }\n });\n }\n\n private hasManaged = false;\n\n private manageButtons = (): void => {\n if (!this.slotElement) {\n return;\n }\n const assignedElements = this.slotElement.assignedElements({\n flatten: true,\n });\n const buttons = assignedElements.reduce((acc: unknown[], el) => {\n if (el.matches(this._buttonSelector)) {\n acc.push(el);\n } else {\n const buttonDescendents = Array.from(\n el.querySelectorAll(`:scope > ${this._buttonSelector}`)\n );\n acc.push(...buttonDescendents);\n }\n return acc;\n }, []);\n this.buttons = buttons as ActionButton[];\n if (this.selects || !this.hasManaged) {\n // <select> element merges selected so following paradigm here\n const currentlySelectedButtons: string[] = [];\n this.buttons.forEach((button: ActionButton) => {\n if (button.selected) {\n currentlySelectedButtons.push(button.value);\n }\n });\n this.setSelected(this.selected.concat(currentlySelectedButtons));\n }\n this.manageChildren();\n this.manageSelects();\n this.hasManaged = true;\n };\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EAEA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDAEP,OAAS,4BAAAC,MAAgC,sEACzC,OAAS,sBAAAC,MAA0B,6CAEnC,OAAOC,MAAY,wBAEnB,MAAMC,EAA4B,CAAC,EAQ5B,aAAM,oBAAoBP,EAAWC,EAAiB,CACzD,WAAY,CAAC,KAAM,IAAK,IAAK,IAAK,IAAI,EACtC,cAAe,EACnB,CAAC,CAAE,CAoBC,aAAc,CACV,MAAM,EALV,KAAO,SAA2B,CAAC,EAEnC,KAAU,gBAAkB,mCAiB5B,8BAA2B,IAAIG,EAC3B,KACA,CACI,aAAeI,GAA6B,CACxC,IAAIC,EAAoB,GACxB,MAAMC,EAAqBF,EAAS,UAAU,CAACG,EAAIC,KAC3C,CAACJ,EAASC,CAAiB,GAAK,CAACE,EAAG,WACpCF,EAAoBG,GAEjBD,EAAG,UAAY,CAACA,EAAG,SAC7B,EACD,OAAOH,EAASE,CAAkB,EAC5BA,EACAD,CACV,EACA,SAAU,IAAM,KAAK,QACrB,mBAAqBE,GAAqB,CAACA,EAAG,QAClD,CACJ,EAGA,KAAO,QAAU,GAGjB,KAAO,WAAa,GAGpB,KAAO,UAAY,GAGnB,KAAO,MAAQ,GAGf,KAAO,MAAQ,GASf,KAAO,SAAW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Mixin", "SpectrumElement", "property", "query", "RovingTabindexController", "MutationController", "styles", "EMPTY_SELECTION", "elements", "firstEnabledIndex", "firstSelectedIndex", "el", "index", "buttons", "acc", "buttonDescendents", "currentlySelectedButtons", "button", "selected", "old", "announce", "options", "event", "target", "applied", "selections", "updates", "option", "selection", "changes", "__decorateClass"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{--spectrum-actiongroup-gap-size-compact:var(--system-action-group-gap-size-compact);--spectrum-actiongroup-horizontal-spacing-compact:var(--system-action-group-horizontal-spacing-compact);--spectrum-actiongroup-vertical-spacing-compact:var(--system-action-group-vertical-spacing-compact);--spectrum-actiongroup-button-spacing-reset:var(--system-action-group-button-spacing-reset);--spectrum-actiongroup-border-radius-reset:var(--system-action-group-border-radius-reset);--spectrum-actiongroup-border-radius:var(--system-action-group-border-radius);--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-vertical-spacing-regular)}:host([size=xs]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xs-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xs-vertical-spacing-regular)}:host([size=s]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-s-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-s-vertical-spacing-regular)}:host{--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-m-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-m-vertical-spacing-regular)}:host([size=l]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-l-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-l-vertical-spacing-regular)}:host([size=xl]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xl-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xl-vertical-spacing-regular)}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=action-group-overrides.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-group-overrides.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-actiongroup-gap-size-compact:var(--system-action-group-gap-size-compact);--spectrum-actiongroup-horizontal-spacing-compact:var(--system-action-group-horizontal-spacing-compact);--spectrum-actiongroup-vertical-spacing-compact:var(--system-action-group-vertical-spacing-compact);--spectrum-actiongroup-button-spacing-reset:var(--system-action-group-button-spacing-reset);--spectrum-actiongroup-border-radius-reset:var(--system-action-group-border-radius-reset);--spectrum-actiongroup-border-radius:var(--system-action-group-border-radius);--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-vertical-spacing-regular)}:host([size=xs]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xs-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xs-vertical-spacing-regular)}:host([size=s]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-s-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-s-vertical-spacing-regular)}:host{--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-m-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-m-vertical-spacing-regular)}:host([size=l]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-l-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-l-vertical-spacing-regular)}:host([size=xl]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xl-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xl-vertical-spacing-regular)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";import{css as r}from"@spectrum-web-components/base";const a=r`
|
|
2
|
+
:host{--spectrum-actiongroup-gap-size-compact:var(--system-action-group-gap-size-compact);--spectrum-actiongroup-horizontal-spacing-compact:var(--system-action-group-horizontal-spacing-compact);--spectrum-actiongroup-vertical-spacing-compact:var(--system-action-group-vertical-spacing-compact);--spectrum-actiongroup-button-spacing-reset:var(--system-action-group-button-spacing-reset);--spectrum-actiongroup-border-radius-reset:var(--system-action-group-border-radius-reset);--spectrum-actiongroup-border-radius:var(--system-action-group-border-radius);--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-vertical-spacing-regular)}:host([size=xs]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xs-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xs-vertical-spacing-regular)}:host([size=s]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-s-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-s-vertical-spacing-regular)}:host{--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-m-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-m-vertical-spacing-regular)}:host([size=l]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-l-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-l-vertical-spacing-regular)}:host([size=xl]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xl-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xl-vertical-spacing-regular)}
|
|
3
|
+
`;export default a;
|
|
4
|
+
//# sourceMappingURL=action-group-overrides.css.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-group-overrides.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-actiongroup-gap-size-compact:var(--system-action-group-gap-size-compact);--spectrum-actiongroup-horizontal-spacing-compact:var(--system-action-group-horizontal-spacing-compact);--spectrum-actiongroup-vertical-spacing-compact:var(--system-action-group-vertical-spacing-compact);--spectrum-actiongroup-button-spacing-reset:var(--system-action-group-button-spacing-reset);--spectrum-actiongroup-border-radius-reset:var(--system-action-group-border-radius-reset);--spectrum-actiongroup-border-radius:var(--system-action-group-border-radius);--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-vertical-spacing-regular)}:host([size=xs]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xs-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xs-vertical-spacing-regular)}:host([size=s]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-s-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-s-vertical-spacing-regular)}:host{--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-m-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-m-vertical-spacing-regular)}:host([size=l]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-l-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-l-vertical-spacing-regular)}:host([size=xl]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xl-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xl-vertical-spacing-regular)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{gap:var(--mod-actiongroup-horizontal-spacing-regular,var(--spectrum-actiongroup-horizontal-spacing-regular));flex-wrap:wrap;display:flex}::slotted(*){flex-shrink:0}::slotted(:focus-visible){z-index:3}:host(:not([vertical]):not([compact])) ::slotted(*){flex-shrink:0}:host([vertical]){gap:var(--mod-actiongroup-vertical-spacing-regular,var(--spectrum-actiongroup-vertical-spacing-regular));flex-direction:column;display:inline-flex}:host([compact]){gap:var(--mod-actiongroup-gap-size-compact,var(--spectrum-actiongroup-gap-size-compact))}:host([compact]:not([quiet])){flex-wrap:nowrap}:host([compact]:not([quiet])) ::slotted(*){border-radius:var(--mod-actiongroup-border-radius-reset,var(--spectrum-actiongroup-border-radius-reset));z-index:0;position:relative}:host([compact]:not([quiet])) ::slotted(:first-child){--mod-actionbutton-focus-indicator-border-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0px 0px var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-start-start-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-end-start-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));margin-inline-start:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset))}:host([compact]:not([quiet])) ::slotted(:not(:first-child)){--mod-actionbutton-focus-indicator-border-radius:0px;margin-inline-start:var(--mod-actiongroup-horizontal-spacing-compact,var(--spectrum-actiongroup-horizontal-spacing-compact));margin-inline-end:var(--mod-actiongroup-horizontal-spacing-compact,var(--spectrum-actiongroup-horizontal-spacing-compact))}:host([compact]:not([quiet])) ::slotted(:last-child){--mod-actionbutton-focus-indicator-border-radius:0px var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0px;border-start-end-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-end-end-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));margin-inline-start:var(--mod-actiongroup-horizontal-spacing-compact,var(--spectrum-actiongroup-horizontal-spacing-compact));margin-inline-end:var(--mod-actiongroup-border-radius-reset,var(--spectrum-actiongroup-border-radius-reset))}:host([compact]:not([quiet])) ::slotted([selected]){z-index:1}@media (hover:hover){:host([compact]:not([quiet])) ::slotted(:hover){z-index:2}}:host([compact]:not([quiet])) ::slotted(:focus-visible){z-index:3}:host([compact]:not([quiet])[vertical]){gap:var(--mod-actiongroup-gap-size-compact,var(--spectrum-actiongroup-gap-size-compact))}:host([compact][vertical]:not([quiet])) ::slotted(*){border-radius:var(--mod-actiongroup-border-radius-reset,var(--spectrum-actiongroup-border-radius-reset))}:host([compact][vertical]:not([quiet])) ::slotted(:first-child){--mod-actionbutton-focus-indicator-border-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0px 0px;border-start-start-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-start-end-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));margin-block-start:var(--mod-actiongroup-vertical-spacing-compact,var(--spectrum-actiongroup-vertical-spacing-compact));margin-block-end:var(--mod-actiongroup-vertical-spacing-compact,var(--spectrum-actiongroup-vertical-spacing-compact));margin-inline-end:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset))}:host([compact][vertical]:not([quiet])) ::slotted(:not(:first-child)){margin-block-start:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset));margin-block-end:var(--mod-actiongroup-vertical-spacing-compact,var(--spectrum-actiongroup-vertical-spacing-compact));margin-inline-start:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset));margin-inline-end:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset))}:host([compact][vertical]:not([quiet])) ::slotted(:last-child){--mod-actionbutton-focus-indicator-border-radius:0px 0px var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-end-end-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-end-start-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));margin-block-start:var(--mod-actiongroup-vertical-spacing-compact,var(--spectrum-actiongroup-vertical-spacing-compact));margin-block-end:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset))}:host([justified]) ::slotted(*){flex:1}:host{--spectrum-actiongroup-gap-size-compact:var(--system-action-group-gap-size-compact);--spectrum-actiongroup-horizontal-spacing-compact:var(--system-action-group-horizontal-spacing-compact);--spectrum-actiongroup-vertical-spacing-compact:var(--system-action-group-vertical-spacing-compact);--spectrum-actiongroup-button-spacing-reset:var(--system-action-group-button-spacing-reset);--spectrum-actiongroup-border-radius-reset:var(--system-action-group-border-radius-reset);--spectrum-actiongroup-border-radius:var(--system-action-group-border-radius);--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-vertical-spacing-regular)}:host([size=xs]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xs-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xs-vertical-spacing-regular)}:host([size=s]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-s-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-s-vertical-spacing-regular)}:host{--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-m-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-m-vertical-spacing-regular)}:host([size=l]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-l-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-l-vertical-spacing-regular)}:host([size=xl]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xl-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xl-vertical-spacing-regular)}:host([size=xs]){--spectrum-actiongroup-horizontal-spacing-regular:var(--spectrum-spacing-75);--spectrum-actiongroup-vertical-spacing-regular:var(--spectrum-spacing-75)}:host([dir][compact][vertical]) ::slotted(:nth-child(n)){margin-left:0;margin-right:0}:host([justified]) ::slotted(:not([role])),:host([vertical]) ::slotted(:not([role])){flex-direction:column;align-items:stretch;display:flex}:host([compact]:not([quiet])) ::slotted(:not([role])){--overriden-border-radius:0;--mod-actionbutton-border-radius:var(--overriden-border-radius)}:host([compact][vertical]:not([quiet])) ::slotted(:not([role]):first-child){--overriden-border-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0 0}:host([compact][vertical]:not([quiet])) ::slotted(:not([role]):last-child){--overriden-border-radius:0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}:host([dir=ltr][compact]:not([quiet],[vertical])) ::slotted(:not([role]):first-child){--overriden-border-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}:host([dir=rtl][compact]:not([quiet],[vertical])) ::slotted(:not([role]):first-child){--overriden-border-radius:0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0}:host([dir=ltr][compact]:not([quiet],[vertical])) ::slotted(:not([role]):last-child){--overriden-border-radius:0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0}:host([dir=rtl][compact]:not([quiet],[vertical])) ::slotted(:not([role]):last-child){--overriden-border-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}:host([compact]:not([quiet])) ::slotted(*){--mod-actionbutton-focus-ring-border-radius:0}:host([compact][vertical]:not([quiet])) ::slotted(:first-child){--mod-actionbutton-focus-ring-border-radius:var(--spectrum-alias-component-border-radius)var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0 0}:host([compact][vertical]:not([quiet])) ::slotted(:last-child){--mod-actionbutton-focus-ring-border-radius:0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}:host([dir=ltr][compact]:not([quiet],[vertical])) ::slotted(:first-child){--mod-actionbutton-focus-ring-border-radius:var(--spectrum-alias-component-border-radius)0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}:host([dir=rtl][compact]:not([quiet],[vertical])) ::slotted(:first-child){--mod-actionbutton-focus-ring-border-radius:0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0}:host([dir=ltr][compact]:not([quiet],[vertical])) ::slotted(:last-child){--mod-actionbutton-focus-ring-border-radius:0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0}:host([dir=rtl][compact]:not([quiet],[vertical])) ::slotted(:last-child){--mod-actionbutton-focus-ring-border-radius:var(--spectrum-alias-component-border-radius)0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=action-group.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-group.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{gap:var(--mod-actiongroup-horizontal-spacing-regular,var(--spectrum-actiongroup-horizontal-spacing-regular));flex-wrap:wrap;display:flex}::slotted(*){flex-shrink:0}::slotted(:focus-visible){z-index:3}:host(:not([vertical]):not([compact])) ::slotted(*){flex-shrink:0}:host([vertical]){gap:var(--mod-actiongroup-vertical-spacing-regular,var(--spectrum-actiongroup-vertical-spacing-regular));flex-direction:column;display:inline-flex}:host([compact]){gap:var(--mod-actiongroup-gap-size-compact,var(--spectrum-actiongroup-gap-size-compact))}:host([compact]:not([quiet])){flex-wrap:nowrap}:host([compact]:not([quiet])) ::slotted(*){border-radius:var(--mod-actiongroup-border-radius-reset,var(--spectrum-actiongroup-border-radius-reset));z-index:0;position:relative}:host([compact]:not([quiet])) ::slotted(:first-child){--mod-actionbutton-focus-indicator-border-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0px 0px var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-start-start-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-end-start-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));margin-inline-start:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset))}:host([compact]:not([quiet])) ::slotted(:not(:first-child)){--mod-actionbutton-focus-indicator-border-radius:0px;margin-inline-start:var(--mod-actiongroup-horizontal-spacing-compact,var(--spectrum-actiongroup-horizontal-spacing-compact));margin-inline-end:var(--mod-actiongroup-horizontal-spacing-compact,var(--spectrum-actiongroup-horizontal-spacing-compact))}:host([compact]:not([quiet])) ::slotted(:last-child){--mod-actionbutton-focus-indicator-border-radius:0px var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0px;border-start-end-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-end-end-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));margin-inline-start:var(--mod-actiongroup-horizontal-spacing-compact,var(--spectrum-actiongroup-horizontal-spacing-compact));margin-inline-end:var(--mod-actiongroup-border-radius-reset,var(--spectrum-actiongroup-border-radius-reset))}:host([compact]:not([quiet])) ::slotted([selected]){z-index:1}@media (hover:hover){:host([compact]:not([quiet])) ::slotted(:hover){z-index:2}}:host([compact]:not([quiet])) ::slotted(:focus-visible){z-index:3}:host([compact]:not([quiet])[vertical]){gap:var(--mod-actiongroup-gap-size-compact,var(--spectrum-actiongroup-gap-size-compact))}:host([compact][vertical]:not([quiet])) ::slotted(*){border-radius:var(--mod-actiongroup-border-radius-reset,var(--spectrum-actiongroup-border-radius-reset))}:host([compact][vertical]:not([quiet])) ::slotted(:first-child){--mod-actionbutton-focus-indicator-border-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0px 0px;border-start-start-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-start-end-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));margin-block-start:var(--mod-actiongroup-vertical-spacing-compact,var(--spectrum-actiongroup-vertical-spacing-compact));margin-block-end:var(--mod-actiongroup-vertical-spacing-compact,var(--spectrum-actiongroup-vertical-spacing-compact));margin-inline-end:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset))}:host([compact][vertical]:not([quiet])) ::slotted(:not(:first-child)){margin-block-start:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset));margin-block-end:var(--mod-actiongroup-vertical-spacing-compact,var(--spectrum-actiongroup-vertical-spacing-compact));margin-inline-start:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset));margin-inline-end:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset))}:host([compact][vertical]:not([quiet])) ::slotted(:last-child){--mod-actionbutton-focus-indicator-border-radius:0px 0px var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-end-end-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));border-end-start-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius));margin-block-start:var(--mod-actiongroup-vertical-spacing-compact,var(--spectrum-actiongroup-vertical-spacing-compact));margin-block-end:var(--mod-actiongroup-button-spacing-reset,var(--spectrum-actiongroup-button-spacing-reset))}:host([justified]) ::slotted(*){flex:1}:host{--spectrum-actiongroup-gap-size-compact:var(--system-action-group-gap-size-compact);--spectrum-actiongroup-horizontal-spacing-compact:var(--system-action-group-horizontal-spacing-compact);--spectrum-actiongroup-vertical-spacing-compact:var(--system-action-group-vertical-spacing-compact);--spectrum-actiongroup-button-spacing-reset:var(--system-action-group-button-spacing-reset);--spectrum-actiongroup-border-radius-reset:var(--system-action-group-border-radius-reset);--spectrum-actiongroup-border-radius:var(--system-action-group-border-radius);--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-vertical-spacing-regular)}:host([size=xs]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xs-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xs-vertical-spacing-regular)}:host([size=s]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-s-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-s-vertical-spacing-regular)}:host{--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-m-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-m-vertical-spacing-regular)}:host([size=l]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-l-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-l-vertical-spacing-regular)}:host([size=xl]){--spectrum-actiongroup-horizontal-spacing-regular:var(--system-action-group-size-xl-horizontal-spacing-regular);--spectrum-actiongroup-vertical-spacing-regular:var(--system-action-group-size-xl-vertical-spacing-regular)}:host([size=xs]){--spectrum-actiongroup-horizontal-spacing-regular:var(--spectrum-spacing-75);--spectrum-actiongroup-vertical-spacing-regular:var(--spectrum-spacing-75)}:host([dir][compact][vertical]) ::slotted(:nth-child(n)){margin-left:0;margin-right:0}:host([justified]) ::slotted(:not([role])),:host([vertical]) ::slotted(:not([role])){flex-direction:column;align-items:stretch;display:flex}:host([compact]:not([quiet])) ::slotted(:not([role])){--overriden-border-radius:0;--mod-actionbutton-border-radius:var(--overriden-border-radius)}:host([compact][vertical]:not([quiet])) ::slotted(:not([role]):first-child){--overriden-border-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0 0}:host([compact][vertical]:not([quiet])) ::slotted(:not([role]):last-child){--overriden-border-radius:0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}:host([dir=ltr][compact]:not([quiet],[vertical])) ::slotted(:not([role]):first-child){--overriden-border-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}:host([dir=rtl][compact]:not([quiet],[vertical])) ::slotted(:not([role]):first-child){--overriden-border-radius:0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0}:host([dir=ltr][compact]:not([quiet],[vertical])) ::slotted(:not([role]):last-child){--overriden-border-radius:0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0}:host([dir=rtl][compact]:not([quiet],[vertical])) ::slotted(:not([role]):last-child){--overriden-border-radius:var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}:host([compact]:not([quiet])) ::slotted(*){--mod-actionbutton-focus-ring-border-radius:0}:host([compact][vertical]:not([quiet])) ::slotted(:first-child){--mod-actionbutton-focus-ring-border-radius:var(--spectrum-alias-component-border-radius)var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0 0}:host([compact][vertical]:not([quiet])) ::slotted(:last-child){--mod-actionbutton-focus-ring-border-radius:0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}:host([dir=ltr][compact]:not([quiet],[vertical])) ::slotted(:first-child){--mod-actionbutton-focus-ring-border-radius:var(--spectrum-alias-component-border-radius)0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}:host([dir=rtl][compact]:not([quiet],[vertical])) ::slotted(:first-child){--mod-actionbutton-focus-ring-border-radius:0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0}:host([dir=ltr][compact]:not([quiet],[vertical])) ::slotted(:last-child){--mod-actionbutton-focus-ring-border-radius:0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))0}:host([dir=rtl][compact]:not([quiet],[vertical])) ::slotted(:last-child){--mod-actionbutton-focus-ring-border-radius:var(--spectrum-alias-component-border-radius)0 0 var(--mod-actiongroup-border-radius,var(--spectrum-actiongroup-border-radius))}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|