@spectrum-web-components/action-group 1.2.0-beta.9 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +10 -1
- package/package.json +7 -7
- package/src/ActionGroup.d.ts +6 -1
- package/src/ActionGroup.dev.js +14 -4
- package/src/ActionGroup.dev.js.map +2 -2
- package/src/ActionGroup.js +2 -2
- package/src/ActionGroup.js.map +3 -3
- package/src/action-group-overrides.css.dev.js +1 -1
- package/src/action-group-overrides.css.dev.js.map +1 -1
- package/src/action-group-overrides.css.js +3 -3
- package/src/action-group-overrides.css.js.map +1 -1
- package/src/action-group.css.dev.js +1 -1
- package/src/action-group.css.dev.js.map +1 -1
- package/src/action-group.css.js +1 -1
- package/src/action-group.css.js.map +1 -1
- package/src/spectrum-action-group.css.dev.js +1 -1
- package/src/spectrum-action-group.css.dev.js.map +1 -1
- package/src/spectrum-action-group.css.js +1 -1
- package/src/spectrum-action-group.css.js.map +1 -1
- package/src/spectrum-config.js +45 -0
- package/test/action-group.test.js +77 -39
- package/test/action-group.test.js.map +2 -2
package/custom-elements.json
CHANGED
|
@@ -32,6 +32,15 @@
|
|
|
32
32
|
}
|
|
33
33
|
],
|
|
34
34
|
"members": [
|
|
35
|
+
{
|
|
36
|
+
"kind": "field",
|
|
37
|
+
"name": "shadowRootOptions",
|
|
38
|
+
"type": {
|
|
39
|
+
"text": "object"
|
|
40
|
+
},
|
|
41
|
+
"static": true,
|
|
42
|
+
"default": "{\n ...SpectrumElement.shadowRootOptions,\n delegatesFocus: true,\n }"
|
|
43
|
+
},
|
|
35
44
|
{
|
|
36
45
|
"kind": "field",
|
|
37
46
|
"name": "buttons",
|
|
@@ -61,7 +70,7 @@
|
|
|
61
70
|
{
|
|
62
71
|
"kind": "field",
|
|
63
72
|
"name": "rovingTabindexController",
|
|
64
|
-
"default": "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 )"
|
|
73
|
+
"default": "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 hostDelegatesFocus: true,\n isFocusableElement: (el: ActionButton) => !el.disabled,\n }\n )"
|
|
65
74
|
},
|
|
66
75
|
{
|
|
67
76
|
"kind": "field",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/action-group",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@lit-labs/observers": "^2.0.2",
|
|
62
|
-
"@spectrum-web-components/action-button": "^1.2.0
|
|
63
|
-
"@spectrum-web-components/base": "^1.2.0
|
|
64
|
-
"@spectrum-web-components/icons-workflow": "^1.2.0
|
|
65
|
-
"@spectrum-web-components/reactive-controllers": "^1.2.0
|
|
62
|
+
"@spectrum-web-components/action-button": "^1.2.0",
|
|
63
|
+
"@spectrum-web-components/base": "^1.2.0",
|
|
64
|
+
"@spectrum-web-components/icons-workflow": "^1.2.0",
|
|
65
|
+
"@spectrum-web-components/reactive-controllers": "^1.2.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@spectrum-css/actiongroup": "6.0.0-s2-foundations.
|
|
68
|
+
"@spectrum-css/actiongroup": "6.0.0-s2-foundations.17"
|
|
69
69
|
},
|
|
70
70
|
"types": "./src/index.d.ts",
|
|
71
71
|
"customElements": "custom-elements.json",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"./sp-*.js",
|
|
74
74
|
"./**/*.dev.js"
|
|
75
75
|
],
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "e4aec7b389e6209984e4df74f9b86b3ee0c485dd"
|
|
77
77
|
}
|
package/src/ActionGroup.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
-
import
|
|
2
|
+
import { ActionButton } from '@spectrum-web-components/action-button';
|
|
3
3
|
import { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';
|
|
4
4
|
declare const ActionGroup_base: typeof SpectrumElement & {
|
|
5
5
|
new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
|
|
@@ -12,6 +12,11 @@ declare const ActionGroup_base: typeof SpectrumElement & {
|
|
|
12
12
|
* @fires change - Announces that selection state has been changed by user
|
|
13
13
|
*/
|
|
14
14
|
export declare class ActionGroup extends ActionGroup_base {
|
|
15
|
+
static shadowRootOptions: {
|
|
16
|
+
delegatesFocus: boolean;
|
|
17
|
+
mode: ShadowRootMode;
|
|
18
|
+
slotAssignment?: SlotAssignmentMode | undefined;
|
|
19
|
+
};
|
|
15
20
|
static get styles(): CSSResultArray;
|
|
16
21
|
set buttons(buttons: ActionButton[]);
|
|
17
22
|
get buttons(): ActionButton[];
|
package/src/ActionGroup.dev.js
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
property,
|
|
19
19
|
query
|
|
20
20
|
} from "@spectrum-web-components/base/src/decorators.js";
|
|
21
|
+
import { ActionButton } from "@spectrum-web-components/action-button";
|
|
21
22
|
import { RovingTabindexController } from "@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";
|
|
22
23
|
import { MutationController } from "@lit-labs/observers/mutation-controller.js";
|
|
23
24
|
import styles from "./action-group.css.js";
|
|
@@ -44,6 +45,7 @@ export class ActionGroup extends SizedMixin(SpectrumElement, {
|
|
|
44
45
|
return elements[firstSelectedIndex] ? firstSelectedIndex : firstEnabledIndex;
|
|
45
46
|
},
|
|
46
47
|
elements: () => this.buttons,
|
|
48
|
+
hostDelegatesFocus: true,
|
|
47
49
|
isFocusableElement: (el) => !el.disabled
|
|
48
50
|
}
|
|
49
51
|
);
|
|
@@ -215,7 +217,8 @@ export class ActionGroup extends SizedMixin(SpectrumElement, {
|
|
|
215
217
|
const selections = [];
|
|
216
218
|
const updates = options.map(async (option) => {
|
|
217
219
|
await option.updateComplete;
|
|
218
|
-
option
|
|
220
|
+
if (option instanceof ActionButton)
|
|
221
|
+
option.setAttribute("role", "radio");
|
|
219
222
|
option.setAttribute(
|
|
220
223
|
"aria-checked",
|
|
221
224
|
option.selected ? "true" : "false"
|
|
@@ -240,7 +243,8 @@ export class ActionGroup extends SizedMixin(SpectrumElement, {
|
|
|
240
243
|
const selections = [];
|
|
241
244
|
const updates = options.map(async (option) => {
|
|
242
245
|
await option.updateComplete;
|
|
243
|
-
option
|
|
246
|
+
if (option instanceof ActionButton)
|
|
247
|
+
option.setAttribute("role", "checkbox");
|
|
244
248
|
option.setAttribute(
|
|
245
249
|
"aria-checked",
|
|
246
250
|
option.selected ? "true" : "false"
|
|
@@ -261,7 +265,8 @@ export class ActionGroup extends SizedMixin(SpectrumElement, {
|
|
|
261
265
|
const selections = [];
|
|
262
266
|
const updates = options.map(async (option) => {
|
|
263
267
|
await option.updateComplete;
|
|
264
|
-
option
|
|
268
|
+
if (option instanceof ActionButton)
|
|
269
|
+
option.setAttribute("role", "button");
|
|
265
270
|
if (option.selected) {
|
|
266
271
|
option.setAttribute("aria-pressed", "true");
|
|
267
272
|
selections.push(option);
|
|
@@ -278,7 +283,8 @@ export class ActionGroup extends SizedMixin(SpectrumElement, {
|
|
|
278
283
|
);
|
|
279
284
|
} else {
|
|
280
285
|
this.buttons.forEach((option) => {
|
|
281
|
-
option
|
|
286
|
+
if (option instanceof ActionButton)
|
|
287
|
+
option.setAttribute("role", "button");
|
|
282
288
|
});
|
|
283
289
|
break;
|
|
284
290
|
}
|
|
@@ -344,6 +350,10 @@ export class ActionGroup extends SizedMixin(SpectrumElement, {
|
|
|
344
350
|
});
|
|
345
351
|
}
|
|
346
352
|
}
|
|
353
|
+
ActionGroup.shadowRootOptions = {
|
|
354
|
+
...SpectrumElement.shadowRootOptions,
|
|
355
|
+
delegatesFocus: true
|
|
356
|
+
};
|
|
347
357
|
__decorateClass([
|
|
348
358
|
property({ type: Boolean, reflect: true })
|
|
349
359
|
], ActionGroup.prototype, "compact", 2);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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;
|
|
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 { 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 static override shadowRootOptions = {\n ...SpectrumElement.shadowRootOptions,\n delegatesFocus: 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 hostDelegatesFocus: true,\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 if (option instanceof ActionButton)\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 if (option instanceof ActionButton)\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 if (option instanceof ActionButton)\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 if (option instanceof ActionButton)\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;AACP,SAAS,oBAA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AAK,YAAY;AAClC,eAAO,WAAW,KAAK,SAAS,SAAS,OAAO,KAAK;AAAA,MACzD;AACA,UACI,KAAK,SACJ,KAAK,SAAS,OACX,QAAO,mCAAS,IAAI,aAAY,cACtC;AACE,eAAO,OAAO,KAAK;AAAA,MACvB;AAAA,IACJ,CAAC;AAAA,EACL;AAqCJ;AAxZa,YAIO,oBAAoB;AAAA,EAChC,GAAG,gBAAgB;AAAA,EACnB,gBAAgB;AACpB;AAyDO;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GA/DjC,YAgEF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAlEjC,YAmEF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GArEjC,YAsEF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAxEjB,YAyEF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GA3EjC,YA4EF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GA9EjB,YA+EF;AAGA;AAAA,EADN,SAAS,EAAE,SAAS,MAAM,WAAW,eAAe,CAAC;AAAA,GAjF7C,YAkFF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GApFjC,YAqFF;AAcH;AAAA,EADH,SAAS,EAAE,MAAM,MAAM,CAAC;AAAA,GAlGhB,YAmGL;AAKJ;AAAA,EADC,MAAM,MAAM;AAAA,GAvGJ,YAwGT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/ActionGroup.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var f=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var a=(d,u,e,s)=>{for(var t=s>1?void 0:s?b(u,e):u,i=d.length-1,l;i>=0;i--)(l=d[i])&&(t=(s?l(u,e,t):l(t))||t);return s&&t&&f(u,e,t),t};import{html as m,SizedMixin as v,SpectrumElement as p}from"@spectrum-web-components/base";import{property as o,query as g}from"@spectrum-web-components/base/src/decorators.js";import{ActionButton as c}from"@spectrum-web-components/action-button";import{RovingTabindexController as y}from"@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";import{MutationController as S}from"@lit-labs/observers/mutation-controller.js";import C from"./action-group.css.js";const h=[];export class ActionGroup extends v(p,{validSizes:["xs","s","m","l","xl"],noDefaultSize:!0}){constructor(){super();this._buttons=[];this._buttonSelector="sp-action-button, sp-action-menu";this.rovingTabindexController=new y(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,hostDelegatesFocus:!0,isFocusableElement:e=>!e.disabled});this.compact=!1;this.emphasized=!1;this.justified=!1;this.label="";this.quiet=!1;this.vertical=!1;this._selected=h;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 S(this,{config:{childList:!0,subtree:!0},callback:()=>{this.manageButtons()},skipInitial:!0})}static get styles(){return[C]}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 r=>{await r.updateComplete,r instanceof c&&r.setAttribute("role","radio"),r.setAttribute("aria-checked",r.selected?"true":"false"),r.selected&&t.push(r)});if(e)break;await Promise.all(i);const l=t.map(r=>r.value);this.setSelected(l||h);break}case"multiple":{this.getAttribute("role")==="radiogroup"&&this.removeAttribute("role");const t=[],i=[],l=s.map(async n=>{await n.updateComplete,n instanceof c&&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 r=t.length?t:h;this.setSelected(r);break}default:if(this.selected.length){const t=[],i=s.map(async l=>{await l.updateComplete,l instanceof c&&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 instanceof c&&t.setAttribute("role","button")});break}}this.hasAttribute("role")||this.setAttribute("role","toolbar")}render(){return m`
|
|
2
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)})}}
|
|
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)})}}ActionGroup.shadowRootOptions={...p.shadowRootOptions,delegatesFocus:!0},a([o({type:Boolean,reflect:!0})],ActionGroup.prototype,"compact",2),a([o({type:Boolean,reflect:!0})],ActionGroup.prototype,"emphasized",2),a([o({type:Boolean,reflect:!0})],ActionGroup.prototype,"justified",2),a([o({type:String})],ActionGroup.prototype,"label",2),a([o({type:Boolean,reflect:!0})],ActionGroup.prototype,"quiet",2),a([o({type:String})],ActionGroup.prototype,"selects",2),a([o({reflect:!0,attribute:"static-color"})],ActionGroup.prototype,"staticColor",2),a([o({type:Boolean,reflect:!0})],ActionGroup.prototype,"vertical",2),a([o({type:Array})],ActionGroup.prototype,"selected",1),a([g("slot")],ActionGroup.prototype,"slotElement",2);
|
|
4
4
|
//# sourceMappingURL=ActionGroup.js.map
|
package/src/ActionGroup.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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,
|
|
6
|
-
"names": ["html", "SizedMixin", "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"]
|
|
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 { 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 static override shadowRootOptions = {\n ...SpectrumElement.shadowRootOptions,\n delegatesFocus: 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 hostDelegatesFocus: true,\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 if (option instanceof ActionButton)\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 if (option instanceof ActionButton)\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 if (option instanceof ActionButton)\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 if (option instanceof ActionButton)\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,kDACP,OAAS,gBAAAC,MAAoB,yCAC7B,OAAS,4BAAAC,MAAgC,sEACzC,OAAS,sBAAAC,MAA0B,6CAEnC,OAAOC,MAAY,wBAEnB,MAAMC,EAA4B,CAAC,EAQ5B,aAAM,oBAAoBR,EAAWC,EAAiB,CACzD,WAAY,CAAC,KAAM,IAAK,IAAK,IAAK,IAAI,EACtC,cAAe,EACnB,CAAC,CAAE,CAwBC,aAAc,CACV,MAAM,EALV,KAAO,SAA2B,CAAC,EAEnC,KAAU,gBAAkB,mCAiB5B,8BAA2B,IAAII,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,mBAAoB,GACpB,mBAAqBE,GAAqB,CAACA,EAAG,QAClD,CACJ,EAGA,KAAO,QAAU,GAGjB,KAAO,WAAa,GAGpB,KAAO,UAAY,GAGnB,KAAO,MAAQ,GAGf,KAAO,MAAQ,GASf,KAAO,SAAW,GAElB,KAAQ,UAAsBJ,EA8R9B,KAAQ,WAAa,GAErB,KAAQ,cAAgB,IAAY,CAChC,GAAI,CAAC,KAAK,YACN,OAKJ,MAAMM,EAHmB,KAAK,YAAY,iBAAiB,CACvD,QAAS,EACb,CAAC,EACgC,OAAO,CAACC,EAAgBH,IAAO,CAC5D,GAAIA,EAAG,QAAQ,KAAK,eAA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CZ,EAAO,WAAa,KAAK,aAEzB,KAAK,aAAeY,GAAA,MAAAA,EAAS,IAAI,kBACjCZ,EAAO,YAAc,KAAK,cAE1B,KAAK,SAAW,CAAC,KAAK,cACtBA,EAAO,SAAW,KAAK,SAAS,SAASA,EAAO,KAAK,GAGrD,KAAK,OACJ,KAAK,OAAS,KACX,OAAOY,GAAA,YAAAA,EAAS,IAAI,UAAY,eAEpCZ,EAAO,KAAO,KAAK,KAE3B,CAAC,CACL,CAqCJ,CAxZa,YAIO,kBAAoB,CAChC,GAAGjB,EAAgB,kBACnB,eAAgB,EACpB,EAyDO8B,EAAA,CADN7B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GA/DjC,YAgEF,uBAGA6B,EAAA,CADN7B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAlEjC,YAmEF,0BAGA6B,EAAA,CADN7B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GArEjC,YAsEF,yBAGA6B,EAAA,CADN7B,EAAS,CAAE,KAAM,MAAO,CAAC,GAxEjB,YAyEF,qBAGA6B,EAAA,CADN7B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GA3EjC,YA4EF,qBAGA6B,EAAA,CADN7B,EAAS,CAAE,KAAM,MAAO,CAAC,GA9EjB,YA+EF,uBAGA6B,EAAA,CADN7B,EAAS,CAAE,QAAS,GAAM,UAAW,cAAe,CAAC,GAjF7C,YAkFF,2BAGA6B,EAAA,CADN7B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GApFjC,YAqFF,wBAcH6B,EAAA,CADH7B,EAAS,CAAE,KAAM,KAAM,CAAC,GAlGhB,YAmGL,wBAKJ6B,EAAA,CADC5B,EAAM,MAAM,GAvGJ,YAwGT",
|
|
6
|
+
"names": ["html", "SizedMixin", "SpectrumElement", "property", "query", "ActionButton", "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
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { css } from "@spectrum-web-components/base";
|
|
3
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)
|
|
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)}
|
|
5
5
|
`;
|
|
6
6
|
export default styles;
|
|
7
7
|
//# sourceMappingURL=action-group-overrides.css.dev.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-group-overrides.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2025 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)
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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)}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";import{css as
|
|
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)
|
|
3
|
-
`;export default
|
|
1
|
+
"use strict";import{css as c}from"@spectrum-web-components/base";const t=c`
|
|
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)}
|
|
3
|
+
`;export default t;
|
|
4
4
|
//# sourceMappingURL=action-group-overrides.css.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-group-overrides.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2025 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)
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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)}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
6
|
"names": ["css", "styles"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { css } from "@spectrum-web-components/base";
|
|
3
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))}
|
|
4
|
+
:host{--spectrum-actiongroup-button-spacing-reset:0;--spectrum-actiongroup-border-radius-reset:0;--spectrum-actiongroup-border-radius:var(--spectrum-corner-radius-100)}:host([size=s]),:host([size=xs]){--spectrum-actiongroup-horizontal-spacing-regular:var(--spectrum-spacing-75);--spectrum-actiongroup-vertical-spacing-regular:var(--spectrum-spacing-75)}:host([size=l]),:host,:host([size=xl]){--spectrum-actiongroup-horizontal-spacing-regular:var(--spectrum-spacing-100);--spectrum-actiongroup-vertical-spacing-regular:var(--spectrum-spacing-100)}: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=true][compact=true])) ::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][vertical]:not([quiet])){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-grow: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)}: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))}:host([justified]) ::slotted(*){flex:1}
|
|
5
5
|
`;
|
|
6
6
|
export default styles;
|
|
7
7
|
//# sourceMappingURL=action-group.css.dev.js.map
|