@adobe/spectrum-wc-core 2.0.0-beta.2 → 2.0.0-next.20260728161641
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/AccordionItem.base.d.ts +16 -6
- package/dist/components/accordion/AccordionItem.base.js +6 -3
- package/dist/components/accordion/AccordionItem.base.js.map +1 -1
- package/dist/components/badge/Badge.base.d.ts +24 -8
- package/dist/components/badge/Badge.base.js +8 -5
- package/dist/components/badge/Badge.base.js.map +1 -1
- package/dist/components/button/Button.base.d.ts +16 -9
- package/dist/components/button/Button.base.js +7 -5
- package/dist/components/button/Button.base.js.map +1 -1
- package/dist/components/card/Card.base.d.ts +94 -46
- package/dist/components/card/Card.base.js +58 -19
- package/dist/components/card/Card.base.js.map +1 -1
- package/dist/components/card/Card.types.d.ts +1 -0
- package/dist/components/card/Card.types.js +2 -2
- package/dist/components/card/Card.types.js.map +1 -1
- package/dist/components/card/index.js +3 -3
- package/dist/controllers/index.d.ts +2 -0
- package/dist/controllers/index.js +13 -11
- package/dist/controllers/slot-presence-controller/index.d.ts +12 -0
- package/dist/controllers/slot-presence-controller/index.js +2 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.d.ts +57 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js +44 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js.map +1 -0
- package/dist/controllers/slot-text-controller/index.d.ts +12 -0
- package/dist/controllers/slot-text-controller/index.js +2 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.d.ts +92 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.js +53 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.js.map +1 -0
- package/dist/element/index.d.ts +1 -1
- package/dist/element/index.js +2 -2
- package/dist/element/spectrum-element.d.ts +2 -17
- package/dist/element/spectrum-element.js +9 -26
- package/dist/element/spectrum-element.js.map +1 -1
- package/dist/element/version.d.ts +2 -2
- package/dist/element/version.js +1 -1
- package/dist/element/version.js.map +1 -1
- package/dist/mixins/index.d.ts +0 -2
- package/dist/mixins/index.js +4 -6
- package/dist/mixins/linear-progress-mixin.d.ts +1 -2
- package/dist/mixins/linear-progress-mixin.js +5 -5
- package/dist/mixins/linear-progress-mixin.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +10 -9
- package/dist/utils/is-focus-visible-in-tree.d.ts +33 -0
- package/dist/utils/is-focus-visible-in-tree.js +11 -0
- package/dist/utils/is-focus-visible-in-tree.js.map +1 -0
- package/package.json +30 -16
- package/CHANGELOG.md +0 -125
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/defineProperty.js +0 -12
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/toPrimitive.js +0 -14
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/toPropertyKey.js +0 -9
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/typeof.js +0 -11
- package/dist/mixins/observe-slot-presence.d.ts +0 -12
- package/dist/mixins/observe-slot-presence.js +0 -40
- package/dist/mixins/observe-slot-presence.js.map +0 -1
- package/dist/mixins/observe-slot-text.d.ts +0 -11
- package/dist/mixins/observe-slot-text.js +0 -60
- package/dist/mixins/observe-slot-text.js.map +0 -1
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
|
+
import { SlotPresenceController } from '../../controllers/slot-presence-controller/index.js';
|
|
2
3
|
import { SpectrumElement } from '../../element/index.js';
|
|
3
4
|
import { AccordionHeadingLevel, AccordionSize } from './Accordion.types.js';
|
|
4
|
-
declare const AccordionItemBase_base: typeof SpectrumElement & {
|
|
5
|
-
new (...args: any[]): import('../../mixins/observe-slot-presence.js').SlotPresenceObservingInterface;
|
|
6
|
-
prototype: import('../../mixins/observe-slot-presence.js').SlotPresenceObservingInterface;
|
|
7
|
-
};
|
|
8
5
|
/**
|
|
9
6
|
* Base class for accordion item components. Manages open/disabled state,
|
|
10
7
|
* heading level (set by the parent accordion), and the toggle event.
|
|
@@ -19,7 +16,14 @@ declare const AccordionItemBase_base: typeof SpectrumElement & {
|
|
|
19
16
|
* the toggle button so they remain independently interactive.
|
|
20
17
|
* @slot - The panel content revealed when the item is open.
|
|
21
18
|
*/
|
|
22
|
-
export declare abstract class AccordionItemBase extends
|
|
19
|
+
export declare abstract class AccordionItemBase extends SpectrumElement {
|
|
20
|
+
/**
|
|
21
|
+
* Observes whether content is slotted into `[slot="actions"]` so the header
|
|
22
|
+
* can conditionally render the actions container.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
protected slotPresence: SlotPresenceController;
|
|
23
27
|
/**
|
|
24
28
|
* Whether the accordion item panel is expanded.
|
|
25
29
|
*/
|
|
@@ -50,6 +54,13 @@ export declare abstract class AccordionItemBase extends AccordionItemBase_base {
|
|
|
50
54
|
* when the accordion is re-enabled.
|
|
51
55
|
*/
|
|
52
56
|
protected parentDisabled: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
* Whether content is slotted into `[slot="actions"]`. Consumed by the
|
|
60
|
+
* concrete element's `render()` to conditionally render the actions
|
|
61
|
+
* container.
|
|
62
|
+
*/
|
|
63
|
+
protected get hasActions(): boolean;
|
|
53
64
|
/**
|
|
54
65
|
* @internal
|
|
55
66
|
* Whether the item may change `open` (expand or collapse). When false, the
|
|
@@ -83,4 +94,3 @@ export declare abstract class AccordionItemBase extends AccordionItemBase_base {
|
|
|
83
94
|
connectedCallback(): void;
|
|
84
95
|
disconnectedCallback(): void;
|
|
85
96
|
}
|
|
86
|
-
export {};
|
|
@@ -2,11 +2,11 @@ import { SWC_ACCORDION_ITEM_AFTER_CLOSE_EVENT as e, SWC_ACCORDION_ITEM_AFTER_OPE
|
|
|
2
2
|
import { __decorate as a } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js";
|
|
3
3
|
import { property as o, state as s } from "lit/decorators.js";
|
|
4
4
|
import { SpectrumElement as c } from "@adobe/spectrum-wc-core/element/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { SlotPresenceController as l } from "@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js";
|
|
6
6
|
//#region components/accordion/AccordionItem.base.ts
|
|
7
|
-
var u = class extends
|
|
7
|
+
var u = class extends c {
|
|
8
8
|
constructor(...e) {
|
|
9
|
-
super(...e), this.disabled = !1, this._open = !1, this.headingLevel = 3, this.parentDisabled = !1, this.afterEventPending = !1, this.handleTransitionEnd = (e) => {
|
|
9
|
+
super(...e), this.slotPresence = new l(this, "[slot=\"actions\"]"), this.disabled = !1, this._open = !1, this.headingLevel = 3, this.parentDisabled = !1, this.afterEventPending = !1, this.handleTransitionEnd = (e) => {
|
|
10
10
|
e.target !== this.contentPanel || e.propertyName !== "height" || !this.afterEventPending || (this.afterEventPending = !1, this.dispatchAfterEvent(this.open));
|
|
11
11
|
}, this.handleTransitionCancel = (e) => {
|
|
12
12
|
e.target !== this.contentPanel || e.propertyName !== "height" || !this.afterEventPending || (this.afterEventPending = !1, this.dispatchAfterEvent(this.open));
|
|
@@ -20,6 +20,9 @@ var u = class extends l(c, "[slot=\"actions\"]") {
|
|
|
20
20
|
let t = this._open;
|
|
21
21
|
this._open = e, e ? this.setAttribute("open", "") : this.removeAttribute("open"), this.requestUpdate("open", t);
|
|
22
22
|
}
|
|
23
|
+
get hasActions() {
|
|
24
|
+
return this.slotPresence.isPresent;
|
|
25
|
+
}
|
|
23
26
|
mayExpand() {
|
|
24
27
|
return !this.disabled && !this.parentDisabled;
|
|
25
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionItem.base.js","names":[],"sources":["../../../components/accordion/AccordionItem.base.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { ObserveSlotPresence } from '@adobe/spectrum-wc-core/mixins/observe-slot-presence.js';\n\nimport {\n type AccordionHeadingLevel,\n type AccordionSize,\n SWC_ACCORDION_ITEM_AFTER_CLOSE_EVENT,\n SWC_ACCORDION_ITEM_AFTER_OPEN_EVENT,\n SWC_ACCORDION_ITEM_CLOSE_EVENT,\n SWC_ACCORDION_ITEM_OPEN_EVENT,\n SWC_ACCORDION_ITEM_TOGGLE_EVENT,\n} from './Accordion.types.js';\n\n/**\n * Base class for accordion item components. Manages open/disabled state,\n * heading level (set by the parent accordion), and the toggle event.\n *\n * @attribute {boolean} open - Whether the accordion item panel is expanded.\n * @attribute {boolean} disabled - Whether the accordion item is disabled.\n * @attribute {AccordionSize} size - Size of the item. Inherited from the parent\n * accordion when slotted; controls the chevron icon when used standalone.\n *\n * @slot label - The heading text for this accordion item.\n * @slot actions - Optional actions rendered adjacent to the heading, outside\n * the toggle button so they remain independently interactive.\n * @slot - The panel content revealed when the item is open.\n */\nexport abstract class AccordionItemBase extends ObserveSlotPresence(\n SpectrumElement,\n '[slot=\"actions\"]'\n) {\n // ──────────────────\n // PUBLIC API\n // ──────────────────\n\n /**\n * Whether the accordion item panel is expanded.\n */\n @property({ type: Boolean, reflect: true })\n public get open(): boolean {\n return this._open;\n }\n\n public set open(value: boolean) {\n if (this.hasUpdated && !this.mayExpand() && value !== this._open) {\n return;\n }\n if (value === this._open) {\n return;\n }\n const oldValue = this._open;\n this._open = value;\n if (value) {\n this.setAttribute('open', '');\n } else {\n this.removeAttribute('open');\n }\n this.requestUpdate('open', oldValue);\n }\n\n /**\n * Whether the accordion item is disabled. A disabled item keeps its header\n * in the tab order but blocks toggling.\n */\n @property({ type: Boolean, reflect: true })\n public disabled: boolean = false;\n\n /**\n * The size of the item. Inherited from the parent accordion; controls which\n * chevron icon is displayed. Has no effect when the item is used standalone.\n */\n @property({ type: String, reflect: true })\n public size?: AccordionSize;\n\n private _open = false;\n\n // ──────────────────────\n // INTERNAL STATE\n // ──────────────────────\n\n /**\n * @internal\n * Heading level (2–6) propagated by the parent accordion. Defaults to 3\n * for standalone items.\n */\n @state()\n protected headingLevel: AccordionHeadingLevel = 3;\n\n /**\n * @internal\n * Set by the parent accordion when its own `disabled` is true. Causes the\n * item to render as disabled (aria-disabled + inert panel) without clobbering\n * the item's own `disabled` property, so the per-item state is preserved\n * when the accordion is re-enabled.\n */\n @state()\n protected parentDisabled: boolean = false;\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n /**\n * @internal\n * Whether the item may change `open` (expand or collapse). When false, the\n * `open` setter and `toggle()` leave state unchanged.\n */\n protected mayExpand(): boolean {\n return !this.disabled && !this.parentDisabled;\n }\n\n private get contentPanel(): HTMLElement | null {\n return this.shadowRoot?.getElementById('content') ?? null;\n }\n\n private dispatchAfterEvent(isOpen: boolean): void {\n this.dispatchEvent(\n new Event(\n isOpen\n ? SWC_ACCORDION_ITEM_AFTER_OPEN_EVENT\n : SWC_ACCORDION_ITEM_AFTER_CLOSE_EVENT,\n { bubbles: true, composed: true }\n )\n );\n }\n\n // Guards dispatchAfterEvent so only one after-event fires per open/close\n // cycle. transitionend fires once per CSS property; height is the only match.\n private afterEventPending = false;\n\n private readonly handleTransitionEnd = (event: TransitionEvent): void => {\n if (\n event.target !== this.contentPanel ||\n event.propertyName !== 'height' ||\n !this.afterEventPending\n ) {\n return;\n }\n this.afterEventPending = false;\n this.dispatchAfterEvent(this.open);\n };\n\n // Reused for transitioncancel: an externally interrupted transition must still\n // resolve afterEventPending so the after-event is not silently lost.\n private readonly handleTransitionCancel = (event: TransitionEvent): void => {\n if (\n event.target !== this.contentPanel ||\n event.propertyName !== 'height' ||\n !this.afterEventPending\n ) {\n return;\n }\n this.afterEventPending = false;\n this.dispatchAfterEvent(this.open);\n };\n\n /**\n * @internal\n * Toggles the item open state. Guards for disabled, flips `open`, dispatches\n * the toggle event, and reverts if the event is canceled. On success, dispatches\n * `swc-after-open` or `swc-after-close` after the panel height transition ends,\n * or immediately if no transition is active.\n */\n protected toggle(): void {\n if (!this.mayExpand()) {\n return;\n }\n this.open = !this.open;\n const toggleEvent = new Event(SWC_ACCORDION_ITEM_TOGGLE_EVENT, {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n if (!this.dispatchEvent(toggleEvent)) {\n this.open = !this.open;\n return;\n }\n const isOpen = this.open;\n this.dispatchEvent(\n new Event(\n isOpen ? SWC_ACCORDION_ITEM_OPEN_EVENT : SWC_ACCORDION_ITEM_CLOSE_EVENT,\n {\n bubbles: true,\n composed: true,\n }\n )\n );\n const panel = this.contentPanel;\n if (!panel || getComputedStyle(panel).transitionDuration === '0s') {\n this.dispatchAfterEvent(isOpen);\n } else {\n this.afterEventPending = true;\n }\n }\n\n /**\n * @internal\n * Synchronizes parent-managed heading level onto the item.\n */\n public setManagedHeading(heading: AccordionHeadingLevel): void {\n this.headingLevel = heading;\n }\n\n /**\n * @internal\n * Synchronizes parent-managed disabled state onto the item.\n */\n public setManagedParentDisabled(disabled: boolean): void {\n this.parentDisabled = disabled;\n }\n\n protected override firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n this.contentPanel?.addEventListener(\n 'transitionend',\n this.handleTransitionEnd\n );\n this.contentPanel?.addEventListener(\n 'transitioncancel',\n this.handleTransitionCancel\n );\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n if (this.hasUpdated) {\n this.contentPanel?.addEventListener(\n 'transitionend',\n this.handleTransitionEnd\n );\n this.contentPanel?.addEventListener(\n 'transitioncancel',\n this.handleTransitionCancel\n );\n }\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.contentPanel?.removeEventListener(\n 'transitionend',\n this.handleTransitionEnd\n );\n this.contentPanel?.removeEventListener(\n 'transitioncancel',\n this.handleTransitionCancel\n );\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"AccordionItem.base.js","names":[],"sources":["../../../components/accordion/AccordionItem.base.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { SlotPresenceController } from '@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js';\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\n\nimport {\n type AccordionHeadingLevel,\n type AccordionSize,\n SWC_ACCORDION_ITEM_AFTER_CLOSE_EVENT,\n SWC_ACCORDION_ITEM_AFTER_OPEN_EVENT,\n SWC_ACCORDION_ITEM_CLOSE_EVENT,\n SWC_ACCORDION_ITEM_OPEN_EVENT,\n SWC_ACCORDION_ITEM_TOGGLE_EVENT,\n} from './Accordion.types.js';\n\n/**\n * Base class for accordion item components. Manages open/disabled state,\n * heading level (set by the parent accordion), and the toggle event.\n *\n * @attribute {boolean} open - Whether the accordion item panel is expanded.\n * @attribute {boolean} disabled - Whether the accordion item is disabled.\n * @attribute {AccordionSize} size - Size of the item. Inherited from the parent\n * accordion when slotted; controls the chevron icon when used standalone.\n *\n * @slot label - The heading text for this accordion item.\n * @slot actions - Optional actions rendered adjacent to the heading, outside\n * the toggle button so they remain independently interactive.\n * @slot - The panel content revealed when the item is open.\n */\nexport abstract class AccordionItemBase extends SpectrumElement {\n // ──────────────────────\n // CONTROLLERS\n // ──────────────────────\n\n /**\n * Observes whether content is slotted into `[slot=\"actions\"]` so the header\n * can conditionally render the actions container.\n *\n * @internal\n */\n protected slotPresence = new SlotPresenceController(this, '[slot=\"actions\"]');\n\n // ──────────────────\n // PUBLIC API\n // ──────────────────\n\n /**\n * Whether the accordion item panel is expanded.\n */\n @property({ type: Boolean, reflect: true })\n public get open(): boolean {\n return this._open;\n }\n\n public set open(value: boolean) {\n if (this.hasUpdated && !this.mayExpand() && value !== this._open) {\n return;\n }\n if (value === this._open) {\n return;\n }\n const oldValue = this._open;\n this._open = value;\n if (value) {\n this.setAttribute('open', '');\n } else {\n this.removeAttribute('open');\n }\n this.requestUpdate('open', oldValue);\n }\n\n /**\n * Whether the accordion item is disabled. A disabled item keeps its header\n * in the tab order but blocks toggling.\n */\n @property({ type: Boolean, reflect: true })\n public disabled: boolean = false;\n\n /**\n * The size of the item. Inherited from the parent accordion; controls which\n * chevron icon is displayed. Has no effect when the item is used standalone.\n */\n @property({ type: String, reflect: true })\n public size?: AccordionSize;\n\n private _open = false;\n\n // ──────────────────────\n // INTERNAL STATE\n // ──────────────────────\n\n /**\n * @internal\n * Heading level (2–6) propagated by the parent accordion. Defaults to 3\n * for standalone items.\n */\n @state()\n protected headingLevel: AccordionHeadingLevel = 3;\n\n /**\n * @internal\n * Set by the parent accordion when its own `disabled` is true. Causes the\n * item to render as disabled (aria-disabled + inert panel) without clobbering\n * the item's own `disabled` property, so the per-item state is preserved\n * when the accordion is re-enabled.\n */\n @state()\n protected parentDisabled: boolean = false;\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n /**\n * @internal\n * Whether content is slotted into `[slot=\"actions\"]`. Consumed by the\n * concrete element's `render()` to conditionally render the actions\n * container.\n */\n protected get hasActions(): boolean {\n return this.slotPresence.isPresent;\n }\n\n /**\n * @internal\n * Whether the item may change `open` (expand or collapse). When false, the\n * `open` setter and `toggle()` leave state unchanged.\n */\n protected mayExpand(): boolean {\n return !this.disabled && !this.parentDisabled;\n }\n\n private get contentPanel(): HTMLElement | null {\n return this.shadowRoot?.getElementById('content') ?? null;\n }\n\n private dispatchAfterEvent(isOpen: boolean): void {\n this.dispatchEvent(\n new Event(\n isOpen\n ? SWC_ACCORDION_ITEM_AFTER_OPEN_EVENT\n : SWC_ACCORDION_ITEM_AFTER_CLOSE_EVENT,\n { bubbles: true, composed: true }\n )\n );\n }\n\n // Guards dispatchAfterEvent so only one after-event fires per open/close\n // cycle. transitionend fires once per CSS property; height is the only match.\n private afterEventPending = false;\n\n private readonly handleTransitionEnd = (event: TransitionEvent): void => {\n if (\n event.target !== this.contentPanel ||\n event.propertyName !== 'height' ||\n !this.afterEventPending\n ) {\n return;\n }\n this.afterEventPending = false;\n this.dispatchAfterEvent(this.open);\n };\n\n // Reused for transitioncancel: an externally interrupted transition must still\n // resolve afterEventPending so the after-event is not silently lost.\n private readonly handleTransitionCancel = (event: TransitionEvent): void => {\n if (\n event.target !== this.contentPanel ||\n event.propertyName !== 'height' ||\n !this.afterEventPending\n ) {\n return;\n }\n this.afterEventPending = false;\n this.dispatchAfterEvent(this.open);\n };\n\n /**\n * @internal\n * Toggles the item open state. Guards for disabled, flips `open`, dispatches\n * the toggle event, and reverts if the event is canceled. On success, dispatches\n * `swc-after-open` or `swc-after-close` after the panel height transition ends,\n * or immediately if no transition is active.\n */\n protected toggle(): void {\n if (!this.mayExpand()) {\n return;\n }\n this.open = !this.open;\n const toggleEvent = new Event(SWC_ACCORDION_ITEM_TOGGLE_EVENT, {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n if (!this.dispatchEvent(toggleEvent)) {\n this.open = !this.open;\n return;\n }\n const isOpen = this.open;\n this.dispatchEvent(\n new Event(\n isOpen ? SWC_ACCORDION_ITEM_OPEN_EVENT : SWC_ACCORDION_ITEM_CLOSE_EVENT,\n {\n bubbles: true,\n composed: true,\n }\n )\n );\n const panel = this.contentPanel;\n if (!panel || getComputedStyle(panel).transitionDuration === '0s') {\n this.dispatchAfterEvent(isOpen);\n } else {\n this.afterEventPending = true;\n }\n }\n\n /**\n * @internal\n * Synchronizes parent-managed heading level onto the item.\n */\n public setManagedHeading(heading: AccordionHeadingLevel): void {\n this.headingLevel = heading;\n }\n\n /**\n * @internal\n * Synchronizes parent-managed disabled state onto the item.\n */\n public setManagedParentDisabled(disabled: boolean): void {\n this.parentDisabled = disabled;\n }\n\n protected override firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n this.contentPanel?.addEventListener(\n 'transitionend',\n this.handleTransitionEnd\n );\n this.contentPanel?.addEventListener(\n 'transitioncancel',\n this.handleTransitionCancel\n );\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n if (this.hasUpdated) {\n this.contentPanel?.addEventListener(\n 'transitionend',\n this.handleTransitionEnd\n );\n this.contentPanel?.addEventListener(\n 'transitioncancel',\n this.handleTransitionCancel\n );\n }\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.contentPanel?.removeEventListener(\n 'transitionend',\n this.handleTransitionEnd\n );\n this.contentPanel?.removeEventListener(\n 'transitioncancel',\n this.handleTransitionCancel\n );\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
|
+
import { SlotPresenceController } from '../../controllers/slot-presence-controller/index.js';
|
|
3
|
+
import { SlotTextController } from '../../controllers/slot-text-controller/index.js';
|
|
2
4
|
import { SpectrumElement } from '../../element/index.js';
|
|
3
5
|
import { BadgeSize, BadgeVariant, FixedValues } from './Badge.types.js';
|
|
4
6
|
declare const BadgeBase_base: typeof SpectrumElement & {
|
|
5
|
-
new (...args: any[]): import('../../mixins/observe-slot-presence.js').SlotPresenceObservingInterface;
|
|
6
|
-
prototype: import('../../mixins/observe-slot-presence.js').SlotPresenceObservingInterface;
|
|
7
|
-
} & {
|
|
8
|
-
new (...args: any[]): import('../../mixins/observe-slot-text.js').SlotTextObservingInterface;
|
|
9
|
-
prototype: import('../../mixins/observe-slot-text.js').SlotTextObservingInterface;
|
|
10
|
-
} & {
|
|
11
7
|
new (...args: any[]): import('../../mixins/index.js').SizedElementInterface;
|
|
12
8
|
prototype: import('../../mixins/index.js').SizedElementInterface;
|
|
13
9
|
} & import('../../mixins/index.js').SizedElementConstructor;
|
|
@@ -19,8 +15,6 @@ declare const BadgeBase_base: typeof SpectrumElement & {
|
|
|
19
15
|
*
|
|
20
16
|
* @slot - Text label of the badge.
|
|
21
17
|
* @slot icon - Optional icon that appears to the left of the label
|
|
22
|
-
*
|
|
23
|
-
* @todo review the mixin composition here. We currently have 3 levels of mixins on this class, but the mixin composition guide recommends a maximum of 2.
|
|
24
18
|
*/
|
|
25
19
|
export declare abstract class BadgeBase extends BadgeBase_base {
|
|
26
20
|
/**
|
|
@@ -87,12 +81,34 @@ export declare abstract class BadgeBase extends BadgeBase_base {
|
|
|
87
81
|
* Can only be used with semantic variants.
|
|
88
82
|
*/
|
|
89
83
|
outline: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Observes whether an icon is slotted into `[slot="icon"]`.
|
|
86
|
+
*
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
protected slotPresence: SlotPresenceController;
|
|
90
|
+
/**
|
|
91
|
+
* Observes whether the default slot has meaningful text content. The default
|
|
92
|
+
* slot must bind `@slotchange=${this.slotText.handleSlotChange}` for changes
|
|
93
|
+
* after the first render to be tracked.
|
|
94
|
+
*
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
protected slotText: SlotTextController;
|
|
90
98
|
/**
|
|
91
99
|
* @internal
|
|
92
100
|
*
|
|
93
101
|
* Used for rendering gap when the badge has an icon.
|
|
94
102
|
*/
|
|
95
103
|
protected get hasIcon(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the default slot has meaningful text content. Consumed by the
|
|
106
|
+
* concrete element's `render()` to toggle icon-only presentation (the
|
|
107
|
+
* `swc-Badge--no-label` class and its icon-only padding tokens).
|
|
108
|
+
*
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
protected get slotHasContent(): boolean;
|
|
96
112
|
protected update(changedProperties: PropertyValues): void;
|
|
97
113
|
}
|
|
98
114
|
export {};
|
|
@@ -3,18 +3,21 @@ import { BADGE_VALID_SIZES as t, BADGE_VARIANTS_SEMANTIC as n, FIXED_VALUES as r
|
|
|
3
3
|
import { property as i } from "lit/decorators.js";
|
|
4
4
|
import { SpectrumElement as a } from "@adobe/spectrum-wc-core/element/index.js";
|
|
5
5
|
import { SizedMixin as o } from "@adobe/spectrum-wc-core/mixins/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { SlotPresenceController as s } from "@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js";
|
|
7
|
+
import { SlotTextController as c } from "@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js";
|
|
8
8
|
//#region components/badge/Badge.base.ts
|
|
9
|
-
var l, u = class extends o(
|
|
9
|
+
var l, u = class extends o(a, {
|
|
10
10
|
validSizes: t,
|
|
11
11
|
defaultSize: "s"
|
|
12
12
|
}) {
|
|
13
13
|
constructor(...e) {
|
|
14
|
-
super(...e), this.variant = "neutral", this.subtle = !1, this.outline = !1;
|
|
14
|
+
super(...e), this.variant = "neutral", this.subtle = !1, this.outline = !1, this.slotPresence = new s(this, "[slot=\"icon\"]"), this.slotText = new c(this);
|
|
15
15
|
}
|
|
16
16
|
get hasIcon() {
|
|
17
|
-
return this.
|
|
17
|
+
return this.slotPresence.isPresent;
|
|
18
|
+
}
|
|
19
|
+
get slotHasContent() {
|
|
20
|
+
return this.slotText.hasContent;
|
|
18
21
|
}
|
|
19
22
|
update(e) {
|
|
20
23
|
var t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.base.js","names":[],"sources":["../../../components/badge/Badge.base.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport {
|
|
1
|
+
{"version":3,"file":"Badge.base.js","names":[],"sources":["../../../components/badge/Badge.base.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SlotPresenceController } from '@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js';\nimport { SlotTextController } from '@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js';\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\n\nimport {\n BADGE_VALID_SIZES,\n BADGE_VARIANTS_SEMANTIC,\n type BadgeSize,\n type BadgeVariant,\n FIXED_VALUES,\n type FixedValues,\n} from './Badge.types.js';\n\n/**\n * A badge component that displays short, descriptive information about an element.\n * Badges are typically used to indicate status, categories, or provide supplementary information.\n *\n * @attribute {ElementSize} size - The size of the badge.\n *\n * @slot - Text label of the badge.\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport abstract class BadgeBase extends SizedMixin(SpectrumElement, {\n validSizes: BADGE_VALID_SIZES,\n defaultSize: 's',\n}) {\n /**\n * The size of the badge.\n *\n * @default s\n */\n declare public size: BadgeSize;\n\n // ─────────────────────────\n // API TO OVERRIDE\n // ─────────────────────────\n\n /**\n * @internal\n *\n * A readonly array of the valid color variants for the badge.\n *\n * This is an actual internal property, intended not for customer use\n * but for use in internal validation logic, stories, tests, etc.\n *\n * Because S1 and S2 support different color variants, the value of this\n * property must be set in each subclass.\n */\n static readonly VARIANTS_COLOR: readonly string[];\n\n /**\n * @internal\n *\n * A readonly array of all valid variants for the badge.\n *\n * This is an actual internal property, intended not for customer use\n * but for use in internal validation logic, stories, tests, etc.\n *\n * Because S1 and S2 support different variants, the value of this\n * property must be set in each subclass.\n */\n static readonly VARIANTS: readonly string[];\n\n /**\n * @internal\n *\n * The variant of the badge.\n *\n * This is a public property, but its valid values vary between S1 and S2,\n * so the property (and its docs) need to be redefined in each subclass.\n *\n * The type declared here is a union of the valid values for S1 and S2,\n * and should be narrowed in each subclass.\n */\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'neutral';\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * @internal\n */\n static readonly FIXED_VALUES: readonly string[] = FIXED_VALUES;\n\n /**\n * @internal\n */\n static readonly VARIANTS_SEMANTIC: readonly string[] =\n BADGE_VARIANTS_SEMANTIC;\n\n /**\n * The fixed position of the badge.\n */\n @property({ type: String, reflect: true })\n public fixed?: FixedValues;\n\n /**\n * Whether the badge is subtle.\n */\n @property({ type: Boolean, reflect: true })\n public subtle: boolean = false;\n\n /**\n * Whether the badge is outlined.\n *\n * Can only be used with semantic variants.\n */\n @property({ type: Boolean, reflect: true })\n public outline: boolean = false;\n\n // ──────────────────────\n // CONTROLLERS\n // ──────────────────────\n\n /**\n * Observes whether an icon is slotted into `[slot=\"icon\"]`.\n *\n * @internal\n */\n protected slotPresence = new SlotPresenceController(this, '[slot=\"icon\"]');\n\n /**\n * Observes whether the default slot has meaningful text content. The default\n * slot must bind `@slotchange=${this.slotText.handleSlotChange}` for changes\n * after the first render to be tracked.\n *\n * @internal\n */\n protected slotText = new SlotTextController(this);\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n /**\n * @internal\n *\n * Used for rendering gap when the badge has an icon.\n */\n protected get hasIcon(): boolean {\n return this.slotPresence.isPresent;\n }\n\n /**\n * Whether the default slot has meaningful text content. Consumed by the\n * concrete element's `render()` to toggle icon-only presentation (the\n * `swc-Badge--no-label` class and its icon-only padding tokens).\n *\n * @internal\n */\n protected get slotHasContent(): boolean {\n return this.slotText.hasContent;\n }\n\n protected override update(changedProperties: PropertyValues): void {\n if (window.__swc?.DEBUG) {\n const constructor = this.constructor as typeof BadgeBase;\n if (!constructor.VARIANTS.includes(this.variant)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expects the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...constructor.VARIANTS],\n }\n );\n }\n // Check outline property if it exists (S2 only)\n if (\n 'outline' in this &&\n (this as { outline: boolean }).outline === true &&\n !constructor.VARIANTS_SEMANTIC.includes(this.variant)\n ) {\n window.__swc.warn(\n this,\n `<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...constructor.VARIANTS_SEMANTIC],\n }\n );\n }\n }\n super.update(changedProperties);\n }\n}\n"],"mappings":";;;;;;;;OAqCsB,IAAtB,cAAwC,EAAW,GAAiB;CAClE,YAAY;CACZ,aAAa;CACd,CAAC,CAAC;;8BAkD8B,yBA2BN,mBAQC,wBAWD,IAAI,EAAuB,MAAM,kBAAgB,kBASrD,IAAI,EAAmB,KAAK;;CAWjD,IAAc,UAAmB;AAC/B,SAAO,KAAK,aAAa;;CAU3B,IAAc,iBAA0B;AACtC,SAAO,KAAK,SAAS;;CAGvB,OAA0B,GAAyC;;AACjE,OAAA,IAAI,OAAO,UAAA,QAAA,EAAO,OAAO;GACvB,IAAM,IAAc,KAAK;AAYzB,GAXK,EAAY,SAAS,SAAS,KAAK,QAAQ,IAC9C,OAAO,MAAM,KACX,MACA,IAAI,KAAK,UAAU,wEACnB,mFACA,EACE,QAAQ,CAAC,GAAG,EAAY,SAAS,EAClC,CACF,EAID,aAAa,QACZ,KAA8B,YAAY,MAC3C,CAAC,EAAY,kBAAkB,SAAS,KAAK,QAAQ,IAErD,OAAO,MAAM,KACX,MACA,IAAI,KAAK,UAAU,0FACnB,mFACA,EACE,QAAQ,CAAC,GAAG,EAAY,kBAAkB,EAC3C,CACF;;AAGL,QAAM,OAAO,EAAkB;;;wBArGiB,yBAMhD,MAhBD,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA,KAqBzC,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,SAAA,KAAA,EAAA,KAMzC,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,UAAA,KAAA,EAAA,KAQ1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
|
+
import { SlotPresenceController } from '../../controllers/slot-presence-controller/index.js';
|
|
3
|
+
import { SlotTextController } from '../../controllers/slot-text-controller/index.js';
|
|
2
4
|
import { SpectrumElement } from '../../element/index.js';
|
|
3
5
|
import { ButtonSize } from './Button.types.js';
|
|
4
6
|
declare const ButtonBase_base: typeof SpectrumElement & {
|
|
5
|
-
new (...args: any[]): import('../../mixins/index.js').SlotPresenceObservingInterface;
|
|
6
|
-
prototype: import('../../mixins/index.js').SlotPresenceObservingInterface;
|
|
7
|
-
} & {
|
|
8
|
-
new (...args: any[]): import('../../mixins/index.js').SlotTextObservingInterface;
|
|
9
|
-
prototype: import('../../mixins/index.js').SlotTextObservingInterface;
|
|
10
|
-
} & {
|
|
11
7
|
new (...args: any[]): import('../../mixins/index.js').SizedElementInterface;
|
|
12
8
|
prototype: import('../../mixins/index.js').SizedElementInterface;
|
|
13
9
|
} & import('../../mixins/index.js').SizedElementConstructor;
|
|
@@ -22,9 +18,6 @@ declare const ButtonBase_base: typeof SpectrumElement & {
|
|
|
22
18
|
* the `swc-button` visual surface.
|
|
23
19
|
*
|
|
24
20
|
* @attribute {ElementSize} size - The size of the button.
|
|
25
|
-
*
|
|
26
|
-
* @todo We currently have 3 levels of mixins on this class, but the mixin
|
|
27
|
-
* composition guide recommends a maximum of 2. Explore reducing after milestone 2.
|
|
28
21
|
*/
|
|
29
22
|
export declare abstract class ButtonBase extends ButtonBase_base {
|
|
30
23
|
static shadowRootOptions: ShadowRootInit;
|
|
@@ -44,6 +37,20 @@ export declare abstract class ButtonBase extends ButtonBase_base {
|
|
|
44
37
|
* `aria-label`. Required for icon-only buttons, which have no visible text.
|
|
45
38
|
*/
|
|
46
39
|
accessibleLabel?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Observes whether an icon is slotted into `[slot="icon"]`.
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
protected slotPresence: SlotPresenceController;
|
|
46
|
+
/**
|
|
47
|
+
* Observes whether the default slot has a meaningful text label. The default
|
|
48
|
+
* slot must bind `@slotchange=${this.slotText.handleSlotChange}` for changes
|
|
49
|
+
* after the first render to be tracked.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
protected slotText: SlotTextController;
|
|
47
54
|
protected get hasIcon(): boolean;
|
|
48
55
|
protected get hasLabel(): boolean;
|
|
49
56
|
/**
|
|
@@ -2,19 +2,21 @@ import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.124.0/he
|
|
|
2
2
|
import { BUTTON_VALID_SIZES as t } from "./Button.types.js";
|
|
3
3
|
import { property as n } from "lit/decorators.js";
|
|
4
4
|
import { SpectrumElement as r } from "@adobe/spectrum-wc-core/element/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { SizedMixin as i } from "@adobe/spectrum-wc-core/mixins/index.js";
|
|
6
|
+
import { SlotPresenceController as a } from "@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js";
|
|
7
|
+
import { SlotTextController as o } from "@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js";
|
|
6
8
|
//#region components/button/Button.base.ts
|
|
7
|
-
var s, c = class extends
|
|
9
|
+
var s, c = class extends i(r, { validSizes: t }) {
|
|
8
10
|
constructor(...e) {
|
|
9
|
-
super(...e), this.disabled = !1, this.handleClick = (e) => {
|
|
11
|
+
super(...e), this.disabled = !1, this.slotPresence = new a(this, "[slot=\"icon\"]"), this.slotText = new o(this), this.handleClick = (e) => {
|
|
10
12
|
this.disabled && (e.preventDefault(), e.stopImmediatePropagation());
|
|
11
13
|
};
|
|
12
14
|
}
|
|
13
15
|
get hasIcon() {
|
|
14
|
-
return this.
|
|
16
|
+
return this.slotPresence.isPresent;
|
|
15
17
|
}
|
|
16
18
|
get hasLabel() {
|
|
17
|
-
return this.
|
|
19
|
+
return this.slotText.hasContent;
|
|
18
20
|
}
|
|
19
21
|
getForwardedButtonAttributes() {
|
|
20
22
|
return { disabled: this.disabled };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.base.js","names":[],"sources":["../../../components/button/Button.base.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport {
|
|
1
|
+
{"version":3,"file":"Button.base.js","names":[],"sources":["../../../components/button/Button.base.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SlotPresenceController } from '@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js';\nimport { SlotTextController } from '@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js';\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\n\nimport { BUTTON_VALID_SIZES, type ButtonSize } from './Button.types.js';\n\n/**\n * Abstract base class for all button-like components. Owns shared semantic\n * concerns: interaction state, sizing, slot-derived icon/label state,\n * accessible-name resolution, and host-to-internal-button attribute forwarding.\n *\n * Visual API specific to `sp-button` (`variant`, `fill-style`, `static-color`)\n * is intentionally absent so that ActionButton, ClearButton, CloseButton,\n * PickerButton, and InfieldButton can extend this base without inheriting\n * the `swc-button` visual surface.\n *\n * @attribute {ElementSize} size - The size of the button.\n */\nexport abstract class ButtonBase extends SizedMixin(SpectrumElement, {\n validSizes: BUTTON_VALID_SIZES,\n}) {\n static override shadowRootOptions: ShadowRootInit = {\n ...SpectrumElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * The size of the button.\n *\n * @default m\n */\n declare public size: ButtonSize;\n\n /**\n * Whether the button is disabled. Removes focusability and prevents\n * interaction.\n */\n @property({ type: Boolean, reflect: true })\n public disabled: boolean = false;\n\n /**\n * Accessible label forwarded to the internal `<button>` element as\n * `aria-label`. Required for icon-only buttons, which have no visible text.\n */\n @property({ type: String, attribute: 'accessible-label' })\n public accessibleLabel?: string;\n\n // ──────────────────────\n // CONTROLLERS\n // ──────────────────────\n\n /**\n * Observes whether an icon is slotted into `[slot=\"icon\"]`.\n *\n * @internal\n */\n protected slotPresence = new SlotPresenceController(this, '[slot=\"icon\"]');\n\n /**\n * Observes whether the default slot has a meaningful text label. The default\n * slot must bind `@slotchange=${this.slotText.handleSlotChange}` for changes\n * after the first render to be tracked.\n *\n * @internal\n */\n protected slotText = new SlotTextController(this);\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected get hasIcon(): boolean {\n return this.slotPresence.isPresent;\n }\n\n protected get hasLabel(): boolean {\n return this.slotText.hasContent;\n }\n\n /**\n * Returns the set of attributes that should be forwarded to the internal\n * semantic `<button>` element, if not otherwise directly managed.\n *\n * @internal\n */\n protected getForwardedButtonAttributes(): Record<\n string,\n string | boolean | undefined\n > {\n return {\n disabled: this.disabled,\n };\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n // Capture phase so slotted light-DOM clicks are suppressed before host\n // listeners (e.g. Storybook actions) run.\n this.addEventListener('click', this.handleClick, true);\n }\n\n public override disconnectedCallback(): void {\n this.removeEventListener('click', this.handleClick, true);\n super.disconnectedCallback();\n }\n\n /**\n * Suppresses click activation while the button is `disabled`.\n *\n * Slotted icon content lives in the light DOM, so pointer clicks on icons\n * bypass the disabled inner `<button>` and bubble on the host. The host\n * listener (capture) and inner `@click` binding both call this handler.\n */\n protected readonly handleClick = (event: Event): void => {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n\n protected override update(changedProperties: PropertyValues): void {\n super.update(changedProperties);\n if (window.__swc?.DEBUG) {\n if (this.hasIcon && !this.hasLabel && !this.accessibleLabel) {\n window.__swc.warn(\n this,\n `<${this.localName}> with an icon and no label must have an \"accessible-label\" attribute to be accessible.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/#icon-only',\n { issues: ['accessible-label'] }\n );\n }\n }\n }\n}\n"],"mappings":";;;;;;;;OAkCsB,IAAtB,cAAyC,EAAW,GAAiB,EACnE,YAAY,GACb,CAAC,CAAC;;+BAsB0B,wBAkBF,IAAI,EAAuB,MAAM,kBAAgB,kBASrD,IAAI,EAAmB,KAAK,sBAgDf,MAAuB;AACvD,GAAI,KAAK,aACP,EAAM,gBAAgB,EACtB,EAAM,0BAA0B;;;CA7CpC,IAAc,UAAmB;AAC/B,SAAO,KAAK,aAAa;;CAG3B,IAAc,WAAoB;AAChC,SAAO,KAAK,SAAS;;CASvB,+BAGE;AACA,SAAO,EACL,UAAU,KAAK,UAChB;;CAGH,oBAA0C;AAIxC,EAHA,MAAM,mBAAmB,EAGzB,KAAK,iBAAiB,SAAS,KAAK,aAAa,GAAK;;CAGxD,uBAA6C;AAE3C,EADA,KAAK,oBAAoB,SAAS,KAAK,aAAa,GAAK,EACzD,MAAM,sBAAsB;;CAiB9B,OAA0B,GAAyC;;AAEjE,EADA,MAAM,OAAO,EAAkB,GAC/B,IAAI,OAAO,UAAA,QAAA,EAAO,SACZ,KAAK,WAAW,CAAC,KAAK,YAAY,CAAC,KAAK,mBAC1C,OAAO,MAAM,KACX,MACA,IAAI,KAAK,UAAU,0FACnB,qFACA,EAAE,QAAQ,CAAC,mBAAmB,EAAE,CACjC;;;6BAhH6C;CAClD,GAAG,EAAgB;CACnB,gBAAgB;CACjB,KAiBA,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAO1C,EAAS;CAAE,MAAM;CAAQ,WAAW;CAAoB,CAAC,CAAA,EAAA,EAAA,WAAA,mBAAA,KAAA,EAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
2
|
import { SpectrumElement } from '../../element/index.js';
|
|
3
|
+
import { SlotTextController } from '../../controllers/slot-text-controller/index.js';
|
|
3
4
|
import { CardDensity, CardVariant } from './Card.types.js';
|
|
4
5
|
declare const CardBase_base: typeof SpectrumElement & {
|
|
5
6
|
new (...args: any[]): import('../../mixins/index.js').SizedElementInterface;
|
|
@@ -9,20 +10,31 @@ declare const CardBase_base: typeof SpectrumElement & {
|
|
|
9
10
|
* Abstract base class for all card-family components. Owns the semantics
|
|
10
11
|
* shared across every card type: sizing, visual variant, and density.
|
|
11
12
|
*
|
|
12
|
-
* `swc-card`, `swc-user-card`, and `swc-product-card` each extend this base
|
|
13
|
-
* directly and render the shared anatomy via `renderCardTemplate()` in
|
|
14
|
-
* `swc/components/card/card-template.ts`. That template also carries a
|
|
15
|
-
* collection placeholder and an avatar/thumbnail glyph, each supplied
|
|
16
|
-
* per-component via `renderCollection`/`renderGlyph`.
|
|
17
|
-
*
|
|
18
13
|
* @attribute {ElementSize} size - The size of the card.
|
|
19
14
|
*
|
|
15
|
+
* @fires swc-card-click - Dispatched when a `selectable` card is activated (click, Enter, or Space).
|
|
16
|
+
*
|
|
20
17
|
* @slot preview - Primary preview content
|
|
21
18
|
* @slot title - Card title
|
|
22
19
|
* @slot actions - Optional action controls
|
|
23
20
|
* @slot description - Supporting description text
|
|
24
21
|
* @slot footer - Optional footer content
|
|
25
22
|
* @slot - Additional body content
|
|
23
|
+
*
|
|
24
|
+
* @cssprop --swc-card-base-max-inline-size - Maximum inline size of the card. Defaults to 280px, overridden per size.
|
|
25
|
+
* @cssprop --swc-card-base-border-radius - Corner radius of the card. Defaults to the extra-large corner-radius token, overridden per size.
|
|
26
|
+
* @cssprop --swc-card-base-box-shadow - Box shadow (elevation) of the card. Defaults to the emphasized drop-shadow token; overridden by the tertiary variant, selectable focus, and title-as-link/selectable hover.
|
|
27
|
+
* @cssprop --swc-card-base-background-color - Background color of the card. Defaults to the layer-2 background token; overridden by the secondary, tertiary, and quiet variants.
|
|
28
|
+
* @cssprop --swc-card-base-preview-aspect-ratio - Aspect ratio of the preview slot. Defaults to 3/2.
|
|
29
|
+
* @cssprop --swc-card-base-title-font-size - Font size of the title slot. Defaults to the medium font-size token, overridden per size.
|
|
30
|
+
* @cssprop --swc-card-base-title-line-height - Line height of the title slot. Defaults to the medium line-height token, overridden per size.
|
|
31
|
+
* @cssprop --swc-card-base-description-font-size - Font size of the description slot and default slot content. Defaults to a smaller font-size token, overridden per size.
|
|
32
|
+
* @cssprop --swc-card-base-action-component-height - Height used to vertically balance slotted actions content. Defaults to the smallest component-height token, overridden per size.
|
|
33
|
+
* @cssprop --swc-card-base-content-header-gap - Column gap between the title and actions slots. Defaults to the medium base-gap token, overridden per size.
|
|
34
|
+
* @cssprop --swc-card-base-content-padding - Padding of the content region. Defaults to the medium container-padding token; overridden by density.
|
|
35
|
+
* @cssprop --swc-card-base-content-padding-regular - Content padding used at the default (regular) density, per size.
|
|
36
|
+
* @cssprop --swc-card-base-content-padding-compact - Content padding used at compact density, per size.
|
|
37
|
+
* @cssprop --swc-card-base-content-padding-spacious - Content padding used at spacious density, per size.
|
|
26
38
|
*/
|
|
27
39
|
export declare abstract class CardBase extends CardBase_base {
|
|
28
40
|
/**
|
|
@@ -48,75 +60,111 @@ export declare abstract class CardBase extends CardBase_base {
|
|
|
48
60
|
/**
|
|
49
61
|
* Indicates the consumer has wrapped their `title` slot content in a real
|
|
50
62
|
* link. Extends that link's hit area to cover the card surface while
|
|
51
|
-
* leaving navigation entirely consumer-owned
|
|
52
|
-
*
|
|
53
|
-
* @todo Naming, and the `::slotted(a)::after` vs. click-proxy mechanism,
|
|
54
|
-
* are still open. See the card family plan, A11y-3 / Q2.
|
|
63
|
+
* leaving navigation entirely consumer-owned; Card accepts no `href`.
|
|
55
64
|
*/
|
|
56
65
|
titleAsLink: boolean;
|
|
57
66
|
/**
|
|
58
67
|
* Makes the card focusable and captures surface clicks (excluding nested
|
|
59
68
|
* interactive targets) to dispatch a `swc-card-click` event, independent
|
|
60
|
-
* of `titleAsLink`.
|
|
61
|
-
* model without Card owning selected-state UI itself.
|
|
69
|
+
* of `titleAsLink`.
|
|
62
70
|
*
|
|
63
|
-
* @todo
|
|
64
|
-
*
|
|
65
|
-
* @todo No `role` is set when `selectable` is true — deferred rather than
|
|
66
|
-
* defaulting to `role="button"`, since the eventual `CardView` selection
|
|
67
|
-
* model may call for a different role (e.g. `option`/`gridcell`) that
|
|
68
|
-
* `role="button"` would be wrong to have committed to today. See the card
|
|
69
|
-
* family plan, A11y-3 / Q8.
|
|
71
|
+
* @todo No ARIA role is set yet; deferred until a future `CardView`
|
|
72
|
+
* selection model determines the appropriate role.
|
|
70
73
|
*/
|
|
71
74
|
selectable: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Keeps a slotted action control's `size` one step smaller than the
|
|
77
|
+
* card's own `size`.
|
|
78
|
+
*/
|
|
79
|
+
private readonly _sizePropagation;
|
|
80
|
+
/**
|
|
81
|
+
* Observes whether the default slot has meaningful content. Each concrete
|
|
82
|
+
* card's `render()` must bind `@slotchange=${this.slotText.handleSlotChange}`
|
|
83
|
+
* on the default slot (via `renderCardTemplate`'s `onDefaultSlotChange`) for
|
|
84
|
+
* changes after the first render to be tracked.
|
|
85
|
+
*
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
protected slotText: SlotTextController;
|
|
89
|
+
/**
|
|
90
|
+
* Whether the default slot has meaningful content. Consumed by each concrete
|
|
91
|
+
* card's `render()` (through `renderCardTemplate`'s `hasDefaultSlotContent`)
|
|
92
|
+
* to toggle the `--hasDefault` class.
|
|
93
|
+
*
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
protected get slotHasContent(): boolean;
|
|
72
97
|
connectedCallback(): void;
|
|
73
98
|
disconnectedCallback(): void;
|
|
99
|
+
protected firstUpdated(changedProperties: PropertyValues): void;
|
|
74
100
|
protected updated(changedProperties: PropertyValues): void;
|
|
75
101
|
/**
|
|
76
102
|
* @internal
|
|
77
|
-
*
|
|
78
|
-
*
|
|
103
|
+
*
|
|
104
|
+
* The card's own `title` slot element.
|
|
79
105
|
*/
|
|
80
106
|
protected getTitleSlotElement(): HTMLSlotElement | null;
|
|
81
107
|
/**
|
|
82
108
|
* @internal
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
109
|
+
*
|
|
110
|
+
* The card's own `actions` slot element.
|
|
111
|
+
*/
|
|
112
|
+
protected getActionsSlotElement(): HTMLSlotElement | null;
|
|
113
|
+
/**
|
|
114
|
+
* Whether the `actions` slot is supported for this card's current state.
|
|
115
|
+
* `xs` cards don't have room for it. Concrete classes may override this
|
|
116
|
+
* to exclude the slot for other reasons, independent of size.
|
|
117
|
+
*/
|
|
118
|
+
protected get actionsSupported(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* @internal
|
|
121
|
+
*
|
|
122
|
+
* Warns in dev mode when the `actions` slot has content but isn't
|
|
123
|
+
* supported for the current state. Visual suppression is handled in
|
|
124
|
+
* CSS, not here.
|
|
125
|
+
*/
|
|
126
|
+
private checkActionsSupport;
|
|
127
|
+
/**
|
|
128
|
+
* @internal
|
|
129
|
+
*
|
|
130
|
+
* The `title` slot's link: either the assigned element itself
|
|
131
|
+
* (`<a slot="title" href="...">`) or an anchor nested inside a wrapper
|
|
132
|
+
* (`<span slot="title"><a href="...">`). Requires `href`.
|
|
88
133
|
*/
|
|
89
134
|
protected getTitleLinkElement(): HTMLAnchorElement | null;
|
|
90
135
|
/**
|
|
91
136
|
* @internal
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* attribute, excludes `tabindex="-1"` (focusable for scripting, not a
|
|
97
|
-
* click target) and disabled controls, and works for a custom element's
|
|
98
|
-
* internal shadow-DOM control too — `composedPath()` already traverses
|
|
99
|
-
* into other elements' shadow roots for composed events like `click`, so
|
|
100
|
-
* an internal `<button>` inside e.g. `<swc-button>` is inspected directly
|
|
101
|
-
* regardless of which shadow tree it belongs to.
|
|
137
|
+
*
|
|
138
|
+
* Whether `node` has its own interaction/focus semantics, via the
|
|
139
|
+
* `tabIndex` IDL property rather than the `tabindex` attribute; this
|
|
140
|
+
* also correctly excludes `tabindex="-1"` and disabled controls.
|
|
102
141
|
*/
|
|
103
142
|
private static isFocusable;
|
|
143
|
+
/**
|
|
144
|
+
* @internal
|
|
145
|
+
*
|
|
146
|
+
* The size one step below `size` in `CARD_VALID_SIZES`, clamped at the
|
|
147
|
+
* smallest size.
|
|
148
|
+
*/
|
|
149
|
+
private static getSmallerSize;
|
|
150
|
+
/**
|
|
151
|
+
* Re-propagates the `actions` slot's `size` for elements assigned after
|
|
152
|
+
* the initial render, wired to the slot's `slotchange` in
|
|
153
|
+
* `firstUpdated()`.
|
|
154
|
+
*/
|
|
155
|
+
protected readonly handleActionsSlotChange: () => void;
|
|
104
156
|
/**
|
|
105
157
|
* Proxies a qualifying surface click to `titleAsLink`'s link and/or
|
|
106
158
|
* dispatches `swc-card-click` for `selectable`, after filtering out
|
|
107
|
-
* clicks that landed on a nested interactive target
|
|
108
|
-
*
|
|
159
|
+
* clicks that landed on a nested interactive target or followed a
|
|
160
|
+
* text-selection drag.
|
|
109
161
|
*/
|
|
110
162
|
protected readonly handleSurfaceClick: (event: Event) => void;
|
|
111
163
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* link conventionally responds to Enter only: the card's own activation
|
|
117
|
-
* contract (Enter+Space, more button-like) is authoritative once
|
|
118
|
-
* `selectable` makes the card itself the focused target, regardless of
|
|
119
|
-
* what that activation happens to proxy to.
|
|
164
|
+
* Enter and Space both activate the card, even though a bare link
|
|
165
|
+
* conventionally responds to Enter only; the card's own activation
|
|
166
|
+
* contract takes precedence once `selectable` makes it the focused
|
|
167
|
+
* target.
|
|
120
168
|
*/
|
|
121
169
|
protected readonly handleSelectableKeydown: (event: KeyboardEvent) => void;
|
|
122
170
|
}
|