@adobe/spectrum-wc-core 2.0.0-beta.2 → 2.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/accordion/Accordion.base.js +28 -22
- package/dist/components/accordion/Accordion.base.js.map +1 -1
- 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/action-group/ActionGroup.base.d.ts +108 -0
- package/dist/components/action-group/ActionGroup.base.js +53 -0
- package/dist/components/action-group/ActionGroup.base.js.map +1 -0
- package/dist/components/action-group/ActionGroup.types.d.ts +17 -0
- package/dist/components/action-group/ActionGroup.types.js +12 -0
- package/dist/components/action-group/ActionGroup.types.js.map +1 -0
- package/dist/components/action-group/index.d.ts +13 -0
- package/dist/components/action-group/index.js +3 -0
- package/dist/components/alert-banner/AlertBanner.base.js +11 -10
- package/dist/components/alert-banner/AlertBanner.base.js.map +1 -1
- package/dist/components/asset/Asset.base.d.ts +89 -10
- package/dist/components/asset/Asset.base.js +117 -12
- package/dist/components/asset/Asset.base.js.map +1 -1
- package/dist/components/asset/Asset.types.d.ts +20 -2
- package/dist/components/asset/Asset.types.js +10 -2
- package/dist/components/asset/Asset.types.js.map +1 -1
- package/dist/components/asset/index.js +3 -3
- package/dist/components/avatar/Avatar.base.js +18 -22
- package/dist/components/avatar/Avatar.base.js.map +1 -1
- package/dist/components/badge/Badge.base.d.ts +24 -8
- package/dist/components/badge/Badge.base.js +22 -17
- package/dist/components/badge/Badge.base.js.map +1 -1
- package/dist/components/button/Button.base.d.ts +20 -10
- package/dist/components/button/Button.base.js +17 -12
- package/dist/components/button/Button.base.js.map +1 -1
- package/dist/components/button-group/ButtonGroup.base.js +19 -12
- package/dist/components/button-group/ButtonGroup.base.js.map +1 -1
- package/dist/components/card/Card.base.d.ts +95 -46
- package/dist/components/card/Card.base.js +71 -23
- 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/components/divider/Divider.base.js +13 -8
- package/dist/components/divider/Divider.base.js.map +1 -1
- package/dist/components/dropzone/Dropzone.base.d.ts +74 -0
- package/dist/components/dropzone/Dropzone.base.js +82 -0
- package/dist/components/dropzone/Dropzone.base.js.map +1 -0
- package/dist/components/dropzone/Dropzone.types.d.ts +43 -0
- package/dist/components/dropzone/Dropzone.types.js +15 -0
- package/dist/components/dropzone/Dropzone.types.js.map +1 -0
- package/dist/components/dropzone/index.d.ts +13 -0
- package/dist/components/dropzone/index.js +3 -0
- package/dist/components/icon/Icon.base.d.ts +11 -7
- package/dist/components/icon/Icon.base.js +13 -20
- package/dist/components/icon/Icon.base.js.map +1 -1
- package/dist/components/illustrated-message/IllustratedMessage.base.d.ts +22 -8
- package/dist/components/illustrated-message/IllustratedMessage.base.js +33 -20
- package/dist/components/illustrated-message/IllustratedMessage.base.js.map +1 -1
- package/dist/components/infield-button/InfieldButton.base.d.ts +28 -0
- package/dist/components/infield-button/InfieldButton.base.js +22 -0
- package/dist/components/infield-button/InfieldButton.base.js.map +1 -0
- package/dist/components/infield-button/InfieldButton.types.d.ts +13 -0
- package/dist/components/infield-button/InfieldButton.types.js +11 -0
- package/dist/components/infield-button/InfieldButton.types.js.map +1 -0
- package/dist/components/infield-button/index.d.ts +13 -0
- package/dist/components/infield-button/index.js +3 -0
- package/dist/components/meter/Meter.base.js +11 -9
- package/dist/components/meter/Meter.base.js.map +1 -1
- package/dist/components/popover/Popover.base.d.ts +1 -21
- package/dist/components/popover/Popover.base.js +57 -77
- package/dist/components/popover/Popover.base.js.map +1 -1
- package/dist/components/progress-circle/ProgressCircle.base.d.ts +0 -1
- package/dist/components/progress-circle/ProgressCircle.base.js +26 -22
- package/dist/components/progress-circle/ProgressCircle.base.js.map +1 -1
- package/dist/components/status-light/StatusLight.base.d.ts +1 -1
- package/dist/components/status-light/StatusLight.base.js +12 -9
- package/dist/components/status-light/StatusLight.base.js.map +1 -1
- package/dist/components/tabs/TabPanel.base.d.ts +1 -1
- package/dist/components/tabs/TabPanel.base.js.map +1 -1
- package/dist/components/tabs/Tabs.base.js +44 -32
- package/dist/components/tabs/Tabs.base.js.map +1 -1
- package/dist/components/tooltip/Tooltip.base.js +57 -22
- package/dist/components/tooltip/Tooltip.base.js.map +1 -1
- package/dist/controllers/color-controller/src/color-controller.js +45 -44
- package/dist/controllers/color-controller/src/color-controller.js.map +1 -1
- package/dist/controllers/drag-and-drop-controller/index.d.ts +12 -0
- package/dist/controllers/drag-and-drop-controller/index.js +2 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.d.ts +68 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js +56 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js.map +1 -0
- package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.d.ts +1 -1
- package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.js.map +1 -1
- package/dist/controllers/index.d.ts +6 -2
- package/dist/controllers/index.js +15 -11
- package/dist/controllers/language-resolution.d.ts +1 -1
- package/dist/controllers/language-resolution.js.map +1 -1
- package/dist/controllers/page-scroll-lock-controller/index.d.ts +12 -0
- package/dist/controllers/page-scroll-lock-controller/index.js +2 -0
- package/dist/controllers/{page-scroll-lock.js → page-scroll-lock-controller/src/page-scroll-lock.js} +1 -1
- package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.js.map +1 -0
- 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/controllers/trigger-press-controller/index.d.ts +12 -0
- package/dist/controllers/trigger-press-controller/index.js +2 -0
- package/dist/controllers/trigger-press-controller/src/trigger-press-controller.d.ts +149 -0
- package/dist/controllers/trigger-press-controller/src/trigger-press-controller.js +43 -0
- package/dist/controllers/trigger-press-controller/src/trigger-press-controller.js.map +1 -0
- package/dist/directives/index.d.ts +1 -1
- package/dist/element/define-element.js +1 -1
- package/dist/element/define-element.js.map +1 -1
- package/dist/element/index.d.ts +1 -1
- package/dist/element/index.js +2 -2
- package/dist/element/spectrum-element.d.ts +58 -15
- package/dist/element/spectrum-element.js +56 -37
- package/dist/element/spectrum-element.js.map +1 -1
- package/dist/element/version.d.ts +3 -3
- 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 +35 -34
- package/dist/mixins/linear-progress-mixin.js.map +1 -1
- package/dist/mixins/pending-mixin.js +12 -11
- package/dist/mixins/pending-mixin.js.map +1 -1
- package/dist/mixins/sized-mixin.d.ts +28 -0
- package/dist/mixins/sized-mixin.js +6 -6
- package/dist/mixins/sized-mixin.js.map +1 -1
- package/dist/utils/dev-validation.d.ts +88 -0
- package/dist/utils/dev-validation.js +33 -0
- package/dist/utils/dev-validation.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +12 -10
- 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/dist/utils/resolve-trigger.js.map +1 -1
- package/package.json +213 -18
- 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/controllers/page-scroll-lock.js.map +0 -1
- 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
- /package/dist/controllers/{page-scroll-lock.d.ts → page-scroll-lock-controller/src/page-scroll-lock.d.ts} +0 -0
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { SlotAttributePropagationController as t } from "../../controllers/slot-attribute-propagation-controller/src/slot-attribute-propagation-controller.js";
|
|
3
|
+
import { SlotTextController as n } from "../../controllers/slot-text-controller/src/slot-text-controller.js";
|
|
4
|
+
import { CARD_DENSITIES as r, CARD_VALID_SIZES as i, CARD_VARIANTS as a, SWC_CARD_CLICK_EVENT as o } from "./Card.types.js";
|
|
5
|
+
import { property as s } from "lit/decorators.js";
|
|
6
|
+
import { SpectrumElement as c } from "@adobe/spectrum-wc-core/element/index.js";
|
|
7
|
+
import { SizedMixin as l } from "@adobe/spectrum-wc-core/mixins/index.js";
|
|
8
|
+
import { isDebug as u, validateEnum as d, warnIf as f } from "@adobe/spectrum-wc-core/utils/index.js";
|
|
6
9
|
//#region components/card/Card.base.ts
|
|
7
|
-
var
|
|
8
|
-
constructor(...
|
|
9
|
-
super(...
|
|
10
|
+
var p, m = class e extends l(c, { validSizes: i }) {
|
|
11
|
+
constructor(...r) {
|
|
12
|
+
super(...r), this.variant = "primary", this.density = "regular", this.titleAsLink = !1, this.selectable = !1, this._sizePropagation = new t(this, {
|
|
13
|
+
attribute: "size",
|
|
14
|
+
getValue: () => e.getSmallerSize(this.size),
|
|
15
|
+
slotName: "actions"
|
|
16
|
+
}), this.slotText = new n(this), this.handleActionsSlotChange = () => {
|
|
17
|
+
this._sizePropagation.propagate(), this.checkActionsSupport();
|
|
18
|
+
}, this.handleSurfaceClick = (t) => {
|
|
10
19
|
var n;
|
|
11
|
-
if (!this.titleAsLink && !this.selectable) return;
|
|
12
|
-
let r = t.composedPath(), i = r.slice(0, r.indexOf(this)), a =
|
|
20
|
+
if (!this.titleAsLink && !this.selectable || t instanceof MouseEvent && ((n = document.getSelection()) == null ? void 0 : n.isCollapsed) === !1) return;
|
|
21
|
+
let r = t.composedPath(), i = r.slice(0, r.indexOf(this)), a = this.getActionsSlotElement();
|
|
13
22
|
if (!(a && i.includes(a) || i.some(e.isFocusable))) {
|
|
14
23
|
if (this.titleAsLink) {
|
|
15
|
-
var
|
|
16
|
-
(
|
|
24
|
+
var s;
|
|
25
|
+
(s = this.getTitleLinkElement()) == null || s.click();
|
|
17
26
|
}
|
|
18
|
-
this.selectable && this.dispatchEvent(new Event(
|
|
27
|
+
this.selectable && this.dispatchEvent(new Event(o, {
|
|
19
28
|
bubbles: !0,
|
|
20
29
|
composed: !0
|
|
21
30
|
}));
|
|
@@ -24,23 +33,58 @@ var s, c = class e extends o(a, { validSizes: n }) {
|
|
|
24
33
|
(e.code === "Enter" || e.code === "Space") && (e.preventDefault(), this.handleSurfaceClick(e));
|
|
25
34
|
};
|
|
26
35
|
}
|
|
36
|
+
get slotHasContent() {
|
|
37
|
+
return this.slotText.hasContent;
|
|
38
|
+
}
|
|
27
39
|
connectedCallback() {
|
|
28
40
|
super.connectedCallback(), this.addEventListener("click", this.handleSurfaceClick);
|
|
29
41
|
}
|
|
30
42
|
disconnectedCallback() {
|
|
31
43
|
this.removeEventListener("click", this.handleSurfaceClick), this.removeEventListener("keydown", this.handleSelectableKeydown), super.disconnectedCallback();
|
|
32
44
|
}
|
|
33
|
-
|
|
45
|
+
firstUpdated(e) {
|
|
34
46
|
var t;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
47
|
+
super.firstUpdated(e), (t = this.renderRoot) == null || (t = t.querySelector("slot[name=\"actions\"]")) == null || t.addEventListener("slotchange", this.handleActionsSlotChange);
|
|
48
|
+
}
|
|
49
|
+
update(e) {
|
|
50
|
+
let { VARIANTS: t, DENSITIES: n } = this.constructor;
|
|
51
|
+
e.has("variant") && d(this, {
|
|
52
|
+
prop: "variant",
|
|
53
|
+
value: this.variant,
|
|
54
|
+
valid: t,
|
|
55
|
+
url: "https://spectrum-web-components.adobe.com/?path=/docs/components-card--docs"
|
|
56
|
+
}), e.has("density") && d(this, {
|
|
57
|
+
prop: "density",
|
|
58
|
+
value: this.density,
|
|
59
|
+
valid: n,
|
|
60
|
+
url: "https://spectrum-web-components.adobe.com/?path=/docs/components-card--docs",
|
|
61
|
+
options: { level: "low" }
|
|
62
|
+
}), super.update(e);
|
|
63
|
+
}
|
|
64
|
+
updated(e) {
|
|
65
|
+
super.updated(e), e.has("selectable") && (this.selectable ? (this.setAttribute("tabindex", "0"), this.addEventListener("keydown", this.handleSelectableKeydown)) : (this.removeAttribute("tabindex"), this.removeEventListener("keydown", this.handleSelectableKeydown))), f(this, e.has("titleAsLink") && this.titleAsLink && !this.getTitleLinkElement(), `<${this.localName}> has "title-as-link" set but no link element was found in the "title" slot.`, "https://spectrum-web-components.adobe.com/?path=/docs/components-card--docs", {
|
|
66
|
+
level: "high",
|
|
67
|
+
issues: ["title-as-link"]
|
|
68
|
+
}), e.has("size") && this.checkActionsSupport();
|
|
39
69
|
}
|
|
40
70
|
getTitleSlotElement() {
|
|
41
71
|
var e, t;
|
|
42
72
|
return (e = (t = this.renderRoot) == null ? void 0 : t.querySelector("slot[name=\"title\"]")) == null ? null : e;
|
|
43
73
|
}
|
|
74
|
+
getActionsSlotElement() {
|
|
75
|
+
var e, t;
|
|
76
|
+
return (e = (t = this.renderRoot) == null ? void 0 : t.querySelector("slot[name=\"actions\"]")) == null ? null : e;
|
|
77
|
+
}
|
|
78
|
+
get actionsSupported() {
|
|
79
|
+
return this.size !== "xs";
|
|
80
|
+
}
|
|
81
|
+
checkActionsSupport() {
|
|
82
|
+
var e, t;
|
|
83
|
+
u() && f(this, !this.actionsSupported && ((e = (t = this.getActionsSlotElement()) == null ? void 0 : t.assignedElements({ flatten: !0 }).length) == null ? 0 : e) > 0, `<${this.localName}> has content in the "actions" slot, but actions are not supported for this card (size="${this.size}").`, "https://spectrum-web-components.adobe.com/?path=/docs/components-card--docs", {
|
|
84
|
+
level: "medium",
|
|
85
|
+
issues: ["actions"]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
44
88
|
getTitleLinkElement() {
|
|
45
89
|
var e;
|
|
46
90
|
let t = (e = this.getTitleSlotElement()) == null ? void 0 : e.assignedElements({ flatten: !0 });
|
|
@@ -54,22 +98,26 @@ var s, c = class e extends o(a, { validSizes: n }) {
|
|
|
54
98
|
static isFocusable(e) {
|
|
55
99
|
return e instanceof HTMLElement && e.tabIndex >= 0;
|
|
56
100
|
}
|
|
101
|
+
static getSmallerSize(e) {
|
|
102
|
+
let t = i.indexOf(e);
|
|
103
|
+
return i[Math.max(t - 1, 0)];
|
|
104
|
+
}
|
|
57
105
|
};
|
|
58
|
-
|
|
106
|
+
p = m, p.VARIANTS = a, p.DENSITIES = r, e([s({
|
|
59
107
|
type: String,
|
|
60
108
|
reflect: !0
|
|
61
|
-
})],
|
|
109
|
+
})], m.prototype, "variant", void 0), e([s({
|
|
62
110
|
type: String,
|
|
63
111
|
reflect: !0
|
|
64
|
-
})],
|
|
112
|
+
})], m.prototype, "density", void 0), e([s({
|
|
65
113
|
type: Boolean,
|
|
66
114
|
reflect: !0,
|
|
67
115
|
attribute: "title-as-link"
|
|
68
|
-
})],
|
|
116
|
+
})], m.prototype, "titleAsLink", void 0), e([s({
|
|
69
117
|
type: Boolean,
|
|
70
118
|
reflect: !0
|
|
71
|
-
})],
|
|
119
|
+
})], m.prototype, "selectable", void 0);
|
|
72
120
|
//#endregion
|
|
73
|
-
export {
|
|
121
|
+
export { m as CardBase };
|
|
74
122
|
|
|
75
123
|
//# sourceMappingURL=Card.base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.base.js","names":[],"sources":["../../../components/card/Card.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 { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\n\nimport {\n CARD_DENSITIES,\n CARD_VALID_SIZES,\n CARD_VARIANTS,\n type CardDensity,\n type CardVariant,\n} from './Card.types.js';\n\n/**\n * Abstract base class for all card-family components. Owns the semantics\n * shared across every card type: sizing, visual variant, and density.\n *\n * `swc-card`, `swc-user-card`, and `swc-product-card` each extend this base\n * directly and render the shared anatomy via `renderCardTemplate()` in\n * `swc/components/card/card-template.ts`. That template also carries a\n * collection placeholder and an avatar/thumbnail glyph, each supplied\n * per-component via `renderCollection`/`renderGlyph`.\n *\n * @attribute {ElementSize} size - The size of the card.\n *\n * @slot preview - Primary preview content\n * @slot title - Card title\n * @slot actions - Optional action controls\n * @slot description - Supporting description text\n * @slot footer - Optional footer content\n * @slot - Additional body content\n */\nexport abstract class CardBase extends SizedMixin(SpectrumElement, {\n validSizes: CARD_VALID_SIZES,\n}) {\n // ─────────────────────────\n // API TO OVERRIDE\n // ─────────────────────────\n\n /**\n * @internal\n */\n static readonly VARIANTS: readonly CardVariant[] = CARD_VARIANTS;\n\n /**\n * @internal\n */\n static readonly DENSITIES: readonly CardDensity[] = CARD_DENSITIES;\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * The visual variant of the card.\n *\n * @default primary\n */\n @property({ type: String, reflect: true })\n public variant: CardVariant = 'primary';\n\n /**\n * The density of the card, controlling internal spacing and gaps.\n *\n * @default regular\n */\n @property({ type: String, reflect: true })\n public density: CardDensity = 'regular';\n\n /**\n * Indicates the consumer has wrapped their `title` slot content in a real\n * link. Extends that link's hit area to cover the card surface while\n * leaving navigation entirely consumer-owned — Card accepts no `href`.\n *\n * @todo Naming, and the `::slotted(a)::after` vs. click-proxy mechanism,\n * are still open. See the card family plan, A11y-3 / Q2.\n */\n @property({ type: Boolean, reflect: true, attribute: 'title-as-link' })\n public titleAsLink = false;\n\n /**\n * Makes the card focusable and captures surface clicks (excluding nested\n * interactive targets) to dispatch a `swc-card-click` event, independent\n * of `titleAsLink`. Lays groundwork for a future `CardView` selection\n * model without Card owning selected-state UI itself.\n *\n * @todo Event name and `tabindex` management details are still open. See\n * the card family plan, A11y-3 / Q3.\n * @todo No `role` is set when `selectable` is true — deferred rather than\n * defaulting to `role=\"button\"`, since the eventual `CardView` selection\n * model may call for a different role (e.g. `option`/`gridcell`) that\n * `role=\"button\"` would be wrong to have committed to today. See the card\n * family plan, A11y-3 / Q8.\n */\n @property({ type: Boolean, reflect: true })\n public selectable = false;\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this.handleSurfaceClick);\n }\n\n public override disconnectedCallback(): void {\n this.removeEventListener('click', this.handleSurfaceClick);\n this.removeEventListener('keydown', this.handleSelectableKeydown);\n super.disconnectedCallback();\n }\n\n protected override updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n\n if (changedProperties.has('selectable')) {\n if (this.selectable) {\n this.setAttribute('tabindex', '0');\n this.addEventListener('keydown', this.handleSelectableKeydown);\n } else {\n this.removeAttribute('tabindex');\n this.removeEventListener('keydown', this.handleSelectableKeydown);\n }\n }\n\n if (window.__swc?.DEBUG) {\n const { VARIANTS, DENSITIES } = this.constructor as typeof CardBase;\n\n if (\n changedProperties.has('variant') &&\n !VARIANTS.includes(this.variant)\n ) {\n window.__swc.warn(\n this,\n `<${this.localName}> received an invalid \"variant\" value of \"${this.variant}\". Valid values are ${VARIANTS.join(', ')}.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/card/',\n { issues: [`variant=\"${this.variant}\"`] }\n );\n }\n\n if (\n changedProperties.has('density') &&\n !DENSITIES.includes(this.density)\n ) {\n window.__swc.warn(\n this,\n `<${this.localName}> received an invalid \"density\" value of \"${this.density}\". Valid values are ${DENSITIES.join(', ')}.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/card/',\n { issues: [`density=\"${this.density}\"`] }\n );\n }\n\n if (\n changedProperties.has('titleAsLink') &&\n this.titleAsLink &&\n !this.getTitleLinkElement()\n ) {\n window.__swc.warn(\n this,\n `<${this.localName}> has \"title-as-link\" set but no link element was found in the \"title\" slot.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/card/',\n { issues: ['title-as-link'] }\n );\n }\n }\n }\n\n /**\n * @internal\n * The card's own `title` slot element, or `null` before the concrete\n * class's `renderCardTemplate()` call has rendered.\n */\n protected getTitleSlotElement(): HTMLSlotElement | null {\n return this.renderRoot?.querySelector('slot[name=\"title\"]') ?? null;\n }\n\n /**\n * @internal\n * The `title` slot's link, supporting both forms consumers reasonably\n * use: the assigned element itself is the anchor (`<a slot=\"title\"\n * href=\"...\">`), or the anchor is nested inside a wrapper (`<span\n * slot=\"title\"><a href=\"...\">`). Requires `href` — a link with no\n * destination can't usefully be clicked-through.\n */\n protected getTitleLinkElement(): HTMLAnchorElement | null {\n const assigned = this.getTitleSlotElement()?.assignedElements({\n flatten: true,\n });\n for (const element of assigned ?? []) {\n if (element instanceof HTMLAnchorElement && element.href) {\n return element;\n }\n const nested = element.querySelector<HTMLAnchorElement>('a[href]');\n if (nested) {\n return nested;\n }\n }\n return null;\n }\n\n /**\n * @internal\n * Whether `node` provides its own interaction/focus semantics. Checking\n * the `tabIndex` IDL property (rather than the `tabindex` attribute or a\n * tag-name list) correctly covers natively-interactive elements\n * (`button`, `input`, `select`, `textarea`, `a[href]`) with no explicit\n * attribute, excludes `tabindex=\"-1\"` (focusable for scripting, not a\n * click target) and disabled controls, and works for a custom element's\n * internal shadow-DOM control too — `composedPath()` already traverses\n * into other elements' shadow roots for composed events like `click`, so\n * an internal `<button>` inside e.g. `<swc-button>` is inspected directly\n * regardless of which shadow tree it belongs to.\n */\n private static isFocusable(node: EventTarget): boolean {\n return node instanceof HTMLElement && node.tabIndex >= 0;\n }\n\n /**\n * Proxies a qualifying surface click to `titleAsLink`'s link and/or\n * dispatches `swc-card-click` for `selectable`, after filtering out\n * clicks that landed on a nested interactive target (see `isFocusable()`\n * and the `actions`-slot exclusion above).\n */\n protected readonly handleSurfaceClick = (event: Event): void => {\n if (!this.titleAsLink && !this.selectable) {\n return;\n }\n const path = event.composedPath();\n const precedingPath = path.slice(0, path.indexOf(this));\n const actionsSlot = this.renderRoot?.querySelector('slot[name=\"actions\"]');\n const hitInteractiveTarget =\n // The `actions` slot is unconditionally excluded, defense-in-depth,\n // since it's contractually for interactive content regardless of\n // whether a given control correctly reflects focusability.\n (actionsSlot && precedingPath.includes(actionsSlot)) ||\n precedingPath.some(CardBase.isFocusable);\n if (hitInteractiveTarget) {\n return;\n }\n if (this.titleAsLink) {\n this.getTitleLinkElement()?.click();\n }\n if (this.selectable) {\n this.dispatchEvent(\n new Event('swc-card-click', { bubbles: true, composed: true })\n );\n }\n };\n\n /**\n * `tabindex` is only ever added alongside this listener (see `updated()`)\n * and removed alongside its removal — a focusable card is never left\n * without keyboard activation. Enter and Space are treated identically\n * and both proxy to `titleAsLink`'s link when set, even though a bare\n * link conventionally responds to Enter only: the card's own activation\n * contract (Enter+Space, more button-like) is authoritative once\n * `selectable` makes the card itself the focused target, regardless of\n * what that activation happens to proxy to.\n */\n protected readonly handleSelectableKeydown = (event: KeyboardEvent): void => {\n if (event.code === 'Enter' || event.code === 'Space') {\n event.preventDefault();\n this.handleSurfaceClick(event);\n }\n };\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Card.base.js","names":[],"sources":["../../../components/card/Card.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 {\n type ElementSize,\n SizedMixin,\n} from '@adobe/spectrum-wc-core/mixins/index.js';\nimport {\n isDebug,\n validateEnum,\n warnIf,\n} from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport { SlotAttributePropagationController } from '../../controllers/slot-attribute-propagation-controller/index.js';\nimport { SlotTextController } from '../../controllers/slot-text-controller/index.js';\nimport {\n CARD_DENSITIES,\n CARD_VALID_SIZES,\n CARD_VARIANTS,\n type CardDensity,\n type CardSize,\n type CardVariant,\n SWC_CARD_CLICK_EVENT,\n} from './Card.types.js';\n\n/**\n * Abstract base class for all card-family components. Owns the semantics\n * shared across every card type: sizing, visual variant, and density.\n *\n * @attribute {ElementSize} size - The size of the card.\n *\n * @fires swc-card-click - Dispatched when a `selectable` card is activated (click, Enter, or Space).\n *\n * @slot preview - Primary preview content\n * @slot title - Card title\n * @slot actions - Optional action controls\n * @slot description - Supporting description text\n * @slot footer - Optional footer content\n * @slot - Additional body content\n *\n * @cssprop --swc-card-base-max-inline-size - Maximum inline size of the card. Defaults to 280px, overridden per size.\n * @cssprop --swc-card-base-border-radius - Corner radius of the card. Defaults to the extra-large corner-radius token, overridden per size.\n * @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.\n * @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.\n * @cssprop --swc-card-base-preview-aspect-ratio - Aspect ratio of the preview slot. Defaults to 3/2.\n * @cssprop --swc-card-base-title-font-size - Font size of the title slot. Defaults to the medium font-size token, overridden per size.\n * @cssprop --swc-card-base-title-line-height - Line height of the title slot. Defaults to the medium line-height token, overridden per size.\n * @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.\n * @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.\n * @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.\n * @cssprop --swc-card-base-content-padding - Padding of the content region. Defaults to the medium container-padding token; overridden by density.\n * @cssprop --swc-card-base-content-padding-regular - Content padding used at the default (regular) density, per size.\n * @cssprop --swc-card-base-content-padding-compact - Content padding used at compact density, per size.\n * @cssprop --swc-card-base-content-padding-spacious - Content padding used at spacious density, per size.\n */\nexport abstract class CardBase extends SizedMixin(SpectrumElement, {\n validSizes: CARD_VALID_SIZES,\n}) {\n // ─────────────────────────\n // API TO OVERRIDE\n // ─────────────────────────\n\n /**\n * @internal\n */\n static readonly VARIANTS: readonly CardVariant[] = CARD_VARIANTS;\n\n /**\n * @internal\n */\n static readonly DENSITIES: readonly CardDensity[] = CARD_DENSITIES;\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * The visual variant of the card.\n *\n * @default primary\n */\n @property({ type: String, reflect: true })\n public variant: CardVariant = 'primary';\n\n /**\n * The density of the card, controlling internal spacing and gaps.\n *\n * @default regular\n */\n @property({ type: String, reflect: true })\n public density: CardDensity = 'regular';\n\n /**\n * Indicates the consumer has wrapped their `title` slot content in a real\n * link. Extends that link's hit area to cover the card surface while\n * leaving navigation entirely consumer-owned; Card accepts no `href`.\n */\n @property({ type: Boolean, reflect: true, attribute: 'title-as-link' })\n public titleAsLink = false;\n\n /**\n * Makes the card focusable and captures surface clicks (excluding nested\n * interactive targets) to dispatch a `swc-card-click` event, independent\n * of `titleAsLink`.\n *\n * @todo No ARIA role is set yet; deferred until a future `CardView`\n * selection model determines the appropriate role.\n */\n @property({ type: Boolean, reflect: true })\n public selectable = false;\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n /**\n * Keeps a slotted action control's `size` one step smaller than the\n * card's own `size`.\n */\n private readonly _sizePropagation = new SlotAttributePropagationController(\n this,\n {\n attribute: 'size',\n getValue: () => CardBase.getSmallerSize(this.size),\n slotName: 'actions',\n }\n );\n\n /**\n * Observes whether the default slot has meaningful content. Each concrete\n * card's `render()` must bind `@slotchange=${this.slotText.handleSlotChange}`\n * on the default slot (via `renderCardTemplate`'s `onDefaultSlotChange`) for\n * changes after the first render to be tracked.\n *\n * @internal\n */\n protected slotText = new SlotTextController(this);\n\n /**\n * Whether the default slot has meaningful content. Consumed by each concrete\n * card's `render()` (through `renderCardTemplate`'s `hasDefaultSlotContent`)\n * to toggle the `--hasDefault` class.\n *\n * @internal\n */\n protected get slotHasContent(): boolean {\n return this.slotText.hasContent;\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this.handleSurfaceClick);\n }\n\n public override disconnectedCallback(): void {\n this.removeEventListener('click', this.handleSurfaceClick);\n this.removeEventListener('keydown', this.handleSelectableKeydown);\n super.disconnectedCallback();\n }\n\n protected override firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n // renderCardTemplate() doesn't take a slotchange callback, so the\n // listener is attached imperatively rather than declaratively in the\n // template; the slot node itself persists across re-renders.\n this.renderRoot\n ?.querySelector('slot[name=\"actions\"]')\n ?.addEventListener('slotchange', this.handleActionsSlotChange);\n }\n\n protected override update(changedProperties: PropertyValues): void {\n const { VARIANTS, DENSITIES } = this.constructor as typeof CardBase;\n\n if (changedProperties.has('variant')) {\n validateEnum(this, {\n prop: 'variant',\n value: this.variant,\n valid: VARIANTS,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-card--docs',\n });\n }\n\n if (changedProperties.has('density')) {\n validateEnum(this, {\n prop: 'density',\n value: this.density,\n valid: DENSITIES,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-card--docs',\n options: { level: 'low' },\n });\n }\n\n super.update(changedProperties);\n }\n\n protected override updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n\n if (changedProperties.has('selectable')) {\n if (this.selectable) {\n this.setAttribute('tabindex', '0');\n this.addEventListener('keydown', this.handleSelectableKeydown);\n } else {\n this.removeAttribute('tabindex');\n this.removeEventListener('keydown', this.handleSelectableKeydown);\n }\n }\n\n warnIf(\n this,\n changedProperties.has('titleAsLink') &&\n this.titleAsLink &&\n !this.getTitleLinkElement(),\n `<${this.localName}> has \"title-as-link\" set but no link element was found in the \"title\" slot.`,\n 'https://spectrum-web-components.adobe.com/?path=/docs/components-card--docs',\n { level: 'high', issues: ['title-as-link'] }\n );\n\n if (changedProperties.has('size')) {\n this.checkActionsSupport();\n }\n }\n\n /**\n * @internal\n *\n * The card's own `title` slot element.\n */\n protected getTitleSlotElement(): HTMLSlotElement | null {\n return this.renderRoot?.querySelector('slot[name=\"title\"]') ?? null;\n }\n\n /**\n * @internal\n *\n * The card's own `actions` slot element.\n */\n protected getActionsSlotElement(): HTMLSlotElement | null {\n return this.renderRoot?.querySelector('slot[name=\"actions\"]') ?? null;\n }\n\n /**\n * Whether the `actions` slot is supported for this card's current state.\n * `xs` cards don't have room for it. Concrete classes may override this\n * to exclude the slot for other reasons, independent of size.\n */\n protected get actionsSupported(): boolean {\n return this.size !== 'xs';\n }\n\n /**\n * @internal\n *\n * Warns in dev mode when the `actions` slot has content but isn't\n * supported for the current state. Visual suppression is handled in\n * CSS, not here.\n */\n private checkActionsSupport(): void {\n if (!isDebug()) {\n return;\n }\n warnIf(\n this,\n !this.actionsSupported &&\n (this.getActionsSlotElement()?.assignedElements({ flatten: true })\n .length ?? 0) > 0,\n `<${this.localName}> has content in the \"actions\" slot, but actions are not supported for this card (size=\"${this.size}\").`,\n 'https://spectrum-web-components.adobe.com/?path=/docs/components-card--docs',\n { level: 'medium', issues: ['actions'] }\n );\n }\n\n /**\n * @internal\n *\n * The `title` slot's link: either the assigned element itself\n * (`<a slot=\"title\" href=\"...\">`) or an anchor nested inside a wrapper\n * (`<span slot=\"title\"><a href=\"...\">`). Requires `href`.\n */\n protected getTitleLinkElement(): HTMLAnchorElement | null {\n const assigned = this.getTitleSlotElement()?.assignedElements({\n flatten: true,\n });\n for (const element of assigned ?? []) {\n if (element instanceof HTMLAnchorElement && element.href) {\n return element;\n }\n const nested = element.querySelector<HTMLAnchorElement>('a[href]');\n if (nested) {\n return nested;\n }\n }\n return null;\n }\n\n /**\n * @internal\n *\n * Whether `node` has its own interaction/focus semantics, via the\n * `tabIndex` IDL property rather than the `tabindex` attribute; this\n * also correctly excludes `tabindex=\"-1\"` and disabled controls.\n */\n private static isFocusable(node: EventTarget): boolean {\n return node instanceof HTMLElement && node.tabIndex >= 0;\n }\n\n /**\n * @internal\n *\n * The size one step below `size` in `CARD_VALID_SIZES`, clamped at the\n * smallest size.\n */\n private static getSmallerSize(size: ElementSize): CardSize {\n const index = CARD_VALID_SIZES.indexOf(size as CardSize);\n return CARD_VALID_SIZES[Math.max(index - 1, 0)];\n }\n\n /**\n * Re-propagates the `actions` slot's `size` for elements assigned after\n * the initial render, wired to the slot's `slotchange` in\n * `firstUpdated()`.\n */\n protected readonly handleActionsSlotChange = (): void => {\n this._sizePropagation.propagate();\n this.checkActionsSupport();\n };\n\n /**\n * Proxies a qualifying surface click to `titleAsLink`'s link and/or\n * dispatches `swc-card-click` for `selectable`, after filtering out\n * clicks that landed on a nested interactive target or followed a\n * text-selection drag.\n */\n protected readonly handleSurfaceClick = (event: Event): void => {\n if (!this.titleAsLink && !this.selectable) {\n return;\n }\n // A text-selection drag still fires `click` on mouseup; a non-collapsed\n // selection at that point means the user was selecting text, not\n // clicking through the card.\n if (\n event instanceof MouseEvent &&\n document.getSelection()?.isCollapsed === false\n ) {\n return;\n }\n const path = event.composedPath();\n const precedingPath = path.slice(0, path.indexOf(this));\n const actionsSlot = this.getActionsSlotElement();\n const hitInteractiveTarget =\n // The actions slot is always excluded, since it's contractually\n // for interactive content regardless of whether a control reflects\n // focusability correctly.\n (actionsSlot && precedingPath.includes(actionsSlot)) ||\n precedingPath.some(CardBase.isFocusable);\n if (hitInteractiveTarget) {\n return;\n }\n if (this.titleAsLink) {\n this.getTitleLinkElement()?.click();\n }\n if (this.selectable) {\n this.dispatchEvent(\n new Event(SWC_CARD_CLICK_EVENT, { bubbles: true, composed: true })\n );\n }\n };\n\n /**\n * Enter and Space both activate the card, even though a bare link\n * conventionally responds to Enter only; the card's own activation\n * contract takes precedence once `selectable` makes it the focused\n * target.\n */\n protected readonly handleSelectableKeydown = (event: KeyboardEvent): void => {\n if (event.code === 'Enter' || event.code === 'Space') {\n event.preventDefault();\n this.handleSurfaceClick(event);\n }\n };\n}\n"],"mappings":"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"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
export declare const CARD_VALID_SIZES: readonly ["xs", "s", "m", "l", "xl"];
|
|
13
13
|
export declare const CARD_VARIANTS: readonly ["primary", "secondary", "tertiary", "quiet"];
|
|
14
14
|
export declare const CARD_DENSITIES: readonly ["compact", "regular", "spacious"];
|
|
15
|
+
export declare const SWC_CARD_CLICK_EVENT: "swc-card-click";
|
|
15
16
|
export type CardSize = (typeof CARD_VALID_SIZES)[number];
|
|
16
17
|
export type CardVariant = (typeof CARD_VARIANTS)[number];
|
|
17
18
|
export type CardDensity = (typeof CARD_DENSITIES)[number];
|
|
@@ -14,8 +14,8 @@ var e = [
|
|
|
14
14
|
"compact",
|
|
15
15
|
"regular",
|
|
16
16
|
"spacious"
|
|
17
|
-
];
|
|
17
|
+
], r = "swc-card-click";
|
|
18
18
|
//#endregion
|
|
19
|
-
export { n as CARD_DENSITIES, e as CARD_VALID_SIZES, t as CARD_VARIANTS };
|
|
19
|
+
export { n as CARD_DENSITIES, e as CARD_VALID_SIZES, t as CARD_VARIANTS, r as SWC_CARD_CLICK_EVENT };
|
|
20
20
|
|
|
21
21
|
//# sourceMappingURL=Card.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.types.js","names":[],"sources":["../../../components/card/Card.types.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 type { ElementSize } from '@adobe/spectrum-wc-core/mixins/index.js';\n\n// ──────────────────\n// SHARED\n// ──────────────────\n\nexport const CARD_VALID_SIZES = [\n 'xs',\n 's',\n 'm',\n 'l',\n 'xl',\n] as const satisfies readonly ElementSize[];\n\nexport const CARD_VARIANTS = [\n 'primary',\n 'secondary',\n 'tertiary',\n 'quiet',\n] as const;\n\nexport const CARD_DENSITIES = ['compact', 'regular', 'spacious'] as const;\n\n// ──────────────────\n// TYPES\n// ──────────────────\n\nexport type CardSize = (typeof CARD_VALID_SIZES)[number];\nexport type CardVariant = (typeof CARD_VARIANTS)[number];\nexport type CardDensity = (typeof CARD_DENSITIES)[number];\n"],"mappings":";AAkBA,IAAa,IAAmB;CAC9B;CACA;CACA;CACA;CACA;CACD,EAEY,IAAgB;CAC3B;CACA;CACA;CACA;CACD,EAEY,IAAiB;CAAC;CAAW;CAAW;CAAW"}
|
|
1
|
+
{"version":3,"file":"Card.types.js","names":[],"sources":["../../../components/card/Card.types.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 type { ElementSize } from '@adobe/spectrum-wc-core/mixins/index.js';\n\n// ──────────────────\n// SHARED\n// ──────────────────\n\nexport const CARD_VALID_SIZES = [\n 'xs',\n 's',\n 'm',\n 'l',\n 'xl',\n] as const satisfies readonly ElementSize[];\n\nexport const CARD_VARIANTS = [\n 'primary',\n 'secondary',\n 'tertiary',\n 'quiet',\n] as const;\n\nexport const CARD_DENSITIES = ['compact', 'regular', 'spacious'] as const;\n\nexport const SWC_CARD_CLICK_EVENT = 'swc-card-click' as const;\n\n// ──────────────────\n// TYPES\n// ──────────────────\n\nexport type CardSize = (typeof CARD_VALID_SIZES)[number];\nexport type CardVariant = (typeof CARD_VARIANTS)[number];\nexport type CardDensity = (typeof CARD_DENSITIES)[number];\n"],"mappings":";AAkBA,IAAa,IAAmB;CAC9B;CACA;CACA;CACA;CACA;CACD,EAEY,IAAgB;CAC3B;CACA;CACA;CACA;CACD,EAEY,IAAiB;CAAC;CAAW;CAAW;CAAW,EAEnD,IAAuB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CARD_DENSITIES as e, CARD_VALID_SIZES as t, CARD_VARIANTS as n } from "./Card.types.js";
|
|
2
|
-
import { CardBase as
|
|
3
|
-
export { e as CARD_DENSITIES, t as CARD_VALID_SIZES, n as CARD_VARIANTS,
|
|
1
|
+
import { CARD_DENSITIES as e, CARD_VALID_SIZES as t, CARD_VARIANTS as n, SWC_CARD_CLICK_EVENT as r } from "./Card.types.js";
|
|
2
|
+
import { CardBase as i } from "./Card.base.js";
|
|
3
|
+
export { e as CARD_DENSITIES, t as CARD_VALID_SIZES, n as CARD_VARIANTS, i as CardBase, r as SWC_CARD_CLICK_EVENT };
|
|
@@ -3,16 +3,21 @@ import { DIVIDER_STATIC_COLORS as t, DIVIDER_VALID_SIZES as n } from "./Divider.
|
|
|
3
3
|
import { property as r } from "lit/decorators.js";
|
|
4
4
|
import { SpectrumElement as i } from "@adobe/spectrum-wc-core/element/index.js";
|
|
5
5
|
import { SizedMixin as a } from "@adobe/spectrum-wc-core/mixins/index.js";
|
|
6
|
+
import { validateEnum as o } from "@adobe/spectrum-wc-core/utils/index.js";
|
|
6
7
|
//#region components/divider/Divider.base.ts
|
|
7
|
-
var
|
|
8
|
+
var s, c = class extends a(i, { validSizes: n }) {
|
|
8
9
|
constructor(...e) {
|
|
9
10
|
super(...e), this.vertical = !1;
|
|
10
11
|
}
|
|
11
12
|
update(e) {
|
|
12
|
-
|
|
13
|
-
if ((t = window.__swc) != null && t.DEBUG) {
|
|
13
|
+
if (this.staticColor !== void 0) {
|
|
14
14
|
let e = this.constructor;
|
|
15
|
-
|
|
15
|
+
o(this, {
|
|
16
|
+
prop: "static-color",
|
|
17
|
+
value: this.staticColor,
|
|
18
|
+
valid: e.STATIC_COLORS,
|
|
19
|
+
url: "https://spectrum-web-components.adobe.com/?path=/docs/components-divider--docs"
|
|
20
|
+
});
|
|
16
21
|
}
|
|
17
22
|
super.update(e);
|
|
18
23
|
}
|
|
@@ -23,15 +28,15 @@ var o, s = class extends a(i, { validSizes: n }) {
|
|
|
23
28
|
super.updated(e), e.has("vertical") && (this.vertical ? this.setAttribute("aria-orientation", "vertical") : this.removeAttribute("aria-orientation"));
|
|
24
29
|
}
|
|
25
30
|
};
|
|
26
|
-
|
|
31
|
+
s = c, s.STATIC_COLORS = t, e([r({
|
|
27
32
|
type: Boolean,
|
|
28
33
|
reflect: !0
|
|
29
|
-
})],
|
|
34
|
+
})], c.prototype, "vertical", void 0), e([r({
|
|
30
35
|
type: String,
|
|
31
36
|
reflect: !0,
|
|
32
37
|
attribute: "static-color"
|
|
33
|
-
})],
|
|
38
|
+
})], c.prototype, "staticColor", void 0);
|
|
34
39
|
//#endregion
|
|
35
|
-
export {
|
|
40
|
+
export { c as DividerBase };
|
|
36
41
|
|
|
37
42
|
//# sourceMappingURL=Divider.base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Divider.base.js","names":[],"sources":["../../../components/divider/Divider.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 { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\n\nimport {\n DIVIDER_STATIC_COLORS,\n DIVIDER_VALID_SIZES,\n type DividerSize,\n type DividerStaticColor,\n} from './Divider.types.js';\n\n/**\n * A divider separates and distinguishes sections of content or groups of menu items.\n *\n * Layout sizing: horizontal dividers fill the **inline size** of the container (`inline-size: 100%`\n * with a minimum track); vertical dividers fill the **block size** (`block-size: 100%` with a minimum\n * track). When the percentage basis does not resolve (for example a lone flex item in a row),\n * set a definite width or height on the host or an ancestor so the line can render predictably.\n *\n * @attribute {ElementSize} size - The size of the divider.\n */\nexport abstract class DividerBase extends SizedMixin(SpectrumElement, {\n validSizes: DIVIDER_VALID_SIZES,\n}) {\n /**\n * The size of the divider.\n *\n * @default m\n */\n declare public size: DividerSize;\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * @internal\n *\n * A readonly array of the valid static color variants for the divider.\n */\n static readonly STATIC_COLORS: readonly string[] = DIVIDER_STATIC_COLORS;\n\n /**\n * Whether the divider is vertical. If false, the divider is horizontal. The default is false.\n */\n @property({ type: Boolean, reflect: true })\n public vertical = false;\n\n /**\n * The static color variant to use for the divider.\n */\n @property({ type: String, reflect: true, attribute: 'static-color' })\n public staticColor?: DividerStaticColor;\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected override update(changedProperties: PropertyValues): void {\n if (
|
|
1
|
+
{"version":3,"file":"Divider.base.js","names":[],"sources":["../../../components/divider/Divider.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 { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\nimport { validateEnum } from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport {\n DIVIDER_STATIC_COLORS,\n DIVIDER_VALID_SIZES,\n type DividerSize,\n type DividerStaticColor,\n} from './Divider.types.js';\n\n/**\n * A divider separates and distinguishes sections of content or groups of menu items.\n *\n * Layout sizing: horizontal dividers fill the **inline size** of the container (`inline-size: 100%`\n * with a minimum track); vertical dividers fill the **block size** (`block-size: 100%` with a minimum\n * track). When the percentage basis does not resolve (for example a lone flex item in a row),\n * set a definite width or height on the host or an ancestor so the line can render predictably.\n *\n * @attribute {ElementSize} size - The size of the divider.\n */\nexport abstract class DividerBase extends SizedMixin(SpectrumElement, {\n validSizes: DIVIDER_VALID_SIZES,\n}) {\n /**\n * The size of the divider.\n *\n * @default m\n */\n declare public size: DividerSize;\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * @internal\n *\n * A readonly array of the valid static color variants for the divider.\n */\n static readonly STATIC_COLORS: readonly string[] = DIVIDER_STATIC_COLORS;\n\n /**\n * Whether the divider is vertical. If false, the divider is horizontal. The default is false.\n */\n @property({ type: Boolean, reflect: true })\n public vertical = false;\n\n /**\n * The static color variant to use for the divider.\n */\n @property({ type: String, reflect: true, attribute: 'static-color' })\n public staticColor?: DividerStaticColor;\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected override update(changedProperties: PropertyValues): void {\n if (typeof this.staticColor !== 'undefined') {\n const constructor = this.constructor as typeof DividerBase;\n validateEnum(this, {\n prop: 'static-color',\n value: this.staticColor,\n valid: constructor.STATIC_COLORS,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-divider--docs',\n });\n }\n super.update(changedProperties);\n }\n\n protected override firstUpdated(changed: PropertyValues<this>): void {\n super.firstUpdated(changed);\n this.setAttribute('role', 'separator');\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed);\n if (changed.has('vertical')) {\n if (this.vertical) {\n this.setAttribute('aria-orientation', 'vertical');\n } else {\n this.removeAttribute('aria-orientation');\n }\n }\n }\n}\n"],"mappings":";;;;;;;OAoCsB,IAAtB,cAA0C,EAAW,GAAiB,EACpE,YAAY,GACb,CAAC,CAAC;;+BAuBiB;;CAYlB,OAA0B,GAAyC;AACjE,MAAW,KAAK,gBAAgB,QAAa;GAC3C,IAAM,IAAc,KAAK;AACzB,KAAa,MAAM;IACjB,MAAM;IACN,OAAO,KAAK;IACZ,OAAO,EAAY;IACnB,KAAK;IACN,CAAC;;AAEJ,QAAM,OAAO,EAAkB;;CAGjC,aAAgC,GAAqC;AAEnE,EADA,MAAM,aAAa,EAAQ,EAC3B,KAAK,aAAa,QAAQ,YAAY;;CAGxC,QAA2B,GAAqC;AAE9D,EADA,MAAM,QAAQ,EAAQ,EAClB,EAAQ,IAAI,WAAW,KACrB,KAAK,WACP,KAAK,aAAa,oBAAoB,WAAW,GAEjD,KAAK,gBAAgB,mBAAmB;;;yBA1CK,MAKlD,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAM1C,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,WAAW;CAAgB,CAAC,CAAA,EAAA,EAAA,WAAA,eAAA,KAAA,EAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { SpectrumElement } from '../../element/index.js';
|
|
2
|
+
import { DropEffect, DropzoneSize } from './Dropzone.types.js';
|
|
3
|
+
declare const DropzoneBase_base: typeof SpectrumElement & {
|
|
4
|
+
new (...args: any[]): import('../../mixins/index.js').SizedElementInterface;
|
|
5
|
+
prototype: import('../../mixins/index.js').SizedElementInterface;
|
|
6
|
+
} & import('../../mixins/index.js').SizedElementConstructor;
|
|
7
|
+
/**
|
|
8
|
+
* Base class for the `<swc-dropzone>` drop zone component.
|
|
9
|
+
*
|
|
10
|
+
* Encapsulates all drag-and-drop event handling, state management, and
|
|
11
|
+
* validation logic. Rendering, ARIA, and CSS are provided by the concrete
|
|
12
|
+
* SWC subclass.
|
|
13
|
+
*
|
|
14
|
+
* @attribute {DropzoneSize} size - Controls the illustrated icon scale and container dimensions.
|
|
15
|
+
*
|
|
16
|
+
* @slot - Slot for the illustrated message and browse control. Hidden automatically when `filled` is true.
|
|
17
|
+
* @slot filled-content - Slot for the uploaded-state content (e.g. an image preview). Shown automatically when `filled` is true; hidden otherwise.
|
|
18
|
+
*
|
|
19
|
+
* @fires swc-dropzone-should-accept - Cancelable event fired on every native `dragover`
|
|
20
|
+
* tick while a drag is over the zone, not just on entry. Cancel to reject the dragged
|
|
21
|
+
* payload and set the cursor to `none`.
|
|
22
|
+
* @fires swc-dropzone-dragover - Fired once when dragged files enter the zone and are
|
|
23
|
+
* accepted; does not repeat on subsequent `dragover` ticks while still hovering.
|
|
24
|
+
* @fires swc-dropzone-dragleave - Fired when an accepted drag leaves the zone after a
|
|
25
|
+
* 100 ms debounce, or immediately when it becomes rejected. Detail is a plain snapshot
|
|
26
|
+
* `{ clientX, clientY, relatedTarget }` captured synchronously from the native event.
|
|
27
|
+
* @fires swc-dropzone-drop - Fired when files are dropped on the zone. `element.dragged`
|
|
28
|
+
* is still `true` when this event fires; it transitions to `false` after dispatch.
|
|
29
|
+
*/
|
|
30
|
+
export declare abstract class DropzoneBase extends DropzoneBase_base {
|
|
31
|
+
/**
|
|
32
|
+
* The size of the drop zone.
|
|
33
|
+
*
|
|
34
|
+
* @default m
|
|
35
|
+
*/
|
|
36
|
+
size: DropzoneSize;
|
|
37
|
+
/**
|
|
38
|
+
* Whether files are currently being dragged over the drop zone.
|
|
39
|
+
* Set automatically by the component; also settable to reflect programmatic state.
|
|
40
|
+
*
|
|
41
|
+
* @attr dragged
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
dragged: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the drop zone has received a file and is in the filled state.
|
|
47
|
+
* Set by consuming code after a successful drop or browse-file selection to
|
|
48
|
+
* switch the zone to its filled visual.
|
|
49
|
+
*
|
|
50
|
+
* @attr filled
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
filled: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The OS drag-cursor feedback shown while a file is held over the zone.
|
|
56
|
+
* Maps directly to `DataTransfer.dropEffect`. Settable via the `drop-effect`
|
|
57
|
+
* attribute, but property changes do not reflect back to the attribute
|
|
58
|
+
* because it controls browser chrome, not component state.
|
|
59
|
+
*
|
|
60
|
+
* @attr drop-effect
|
|
61
|
+
* @type {'copy' | 'move' | 'link' | 'none'}
|
|
62
|
+
* @default 'copy'
|
|
63
|
+
*/
|
|
64
|
+
get dropEffect(): DropEffect;
|
|
65
|
+
set dropEffect(value: DropEffect | null);
|
|
66
|
+
/** @internal */
|
|
67
|
+
private _dropEffect;
|
|
68
|
+
constructor();
|
|
69
|
+
/** @internal */
|
|
70
|
+
private readonly _sizePropagation;
|
|
71
|
+
/** @internal */
|
|
72
|
+
protected handleDefaultSlotChange(): void;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js";
|
|
2
|
+
import { SlotAttributePropagationController as t } from "../../controllers/slot-attribute-propagation-controller/src/slot-attribute-propagation-controller.js";
|
|
3
|
+
import { DragAndDropController as n } from "../../controllers/drag-and-drop-controller/src/drag-and-drop-controller.js";
|
|
4
|
+
import { DROPZONE_DEFAULT_DROP_EFFECT as r, DROPZONE_VALID_SIZES as i, DROP_EFFECTS as a, SWC_DROPZONE_DRAGLEAVE_EVENT as o, SWC_DROPZONE_DRAGOVER_EVENT as s, SWC_DROPZONE_DROP_EVENT as c, SWC_DROPZONE_SHOULD_ACCEPT_EVENT as l } from "./Dropzone.types.js";
|
|
5
|
+
import { property as u } from "lit/decorators.js";
|
|
6
|
+
import { SpectrumElement as d } from "@adobe/spectrum-wc-core/element/index.js";
|
|
7
|
+
import { SizedMixin as f } from "@adobe/spectrum-wc-core/mixins/index.js";
|
|
8
|
+
import { validateEnum as p } from "@adobe/spectrum-wc-core/utils/index.js";
|
|
9
|
+
//#region components/dropzone/Dropzone.base.ts
|
|
10
|
+
var m = class extends f(d, { validSizes: i }) {
|
|
11
|
+
get dropEffect() {
|
|
12
|
+
return this._dropEffect;
|
|
13
|
+
}
|
|
14
|
+
set dropEffect(e) {
|
|
15
|
+
if (e === null) {
|
|
16
|
+
let e = this._dropEffect;
|
|
17
|
+
this._dropEffect = r, this.requestUpdate("dropEffect", e);
|
|
18
|
+
} else if (a.includes(e)) {
|
|
19
|
+
let t = this._dropEffect;
|
|
20
|
+
this._dropEffect = e, this.requestUpdate("dropEffect", t);
|
|
21
|
+
} else p(this, {
|
|
22
|
+
prop: "drop-effect",
|
|
23
|
+
value: e,
|
|
24
|
+
valid: a,
|
|
25
|
+
url: "https://spectrum-web-components.adobe.com/?path=/docs/components-dropzone--docs"
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
constructor() {
|
|
29
|
+
super(), this.dragged = !1, this.filled = !1, this._dropEffect = r, this._sizePropagation = new t(this, {
|
|
30
|
+
attribute: "size",
|
|
31
|
+
getValue: () => this.size,
|
|
32
|
+
selector: "swc-illustrated-message"
|
|
33
|
+
}), new n(this, {
|
|
34
|
+
isDragged: () => this.dragged,
|
|
35
|
+
shouldAccept: (e) => this.dispatchEvent(new CustomEvent(l, {
|
|
36
|
+
bubbles: !0,
|
|
37
|
+
cancelable: !0,
|
|
38
|
+
composed: !0,
|
|
39
|
+
detail: e
|
|
40
|
+
})),
|
|
41
|
+
dropEffect: () => this._dropEffect,
|
|
42
|
+
onDragEnter: (e) => {
|
|
43
|
+
this.dragged = !0, this.dispatchEvent(new CustomEvent(s, {
|
|
44
|
+
bubbles: !0,
|
|
45
|
+
composed: !0,
|
|
46
|
+
detail: e
|
|
47
|
+
}));
|
|
48
|
+
},
|
|
49
|
+
onDragLeave: (e) => {
|
|
50
|
+
this.dragged = !1, this.dispatchEvent(new CustomEvent(o, {
|
|
51
|
+
bubbles: !0,
|
|
52
|
+
composed: !0,
|
|
53
|
+
detail: e
|
|
54
|
+
}));
|
|
55
|
+
},
|
|
56
|
+
onDrop: (e) => {
|
|
57
|
+
this.dispatchEvent(new CustomEvent(c, {
|
|
58
|
+
bubbles: !0,
|
|
59
|
+
composed: !0,
|
|
60
|
+
detail: e
|
|
61
|
+
})), this.dragged = !1;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
handleDefaultSlotChange() {
|
|
66
|
+
this._sizePropagation.propagate();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
e([u({
|
|
70
|
+
type: Boolean,
|
|
71
|
+
reflect: !0
|
|
72
|
+
})], m.prototype, "dragged", void 0), e([u({
|
|
73
|
+
type: Boolean,
|
|
74
|
+
reflect: !0
|
|
75
|
+
})], m.prototype, "filled", void 0), e([u({
|
|
76
|
+
type: String,
|
|
77
|
+
attribute: "drop-effect"
|
|
78
|
+
})], m.prototype, "dropEffect", null);
|
|
79
|
+
//#endregion
|
|
80
|
+
export { m as DropzoneBase };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=Dropzone.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropzone.base.js","names":[],"sources":["../../../components/dropzone/Dropzone.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 { property } from 'lit/decorators.js';\n\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\nimport { validateEnum } from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport { DragAndDropController } from '../../controllers/drag-and-drop-controller/index.js';\nimport { SlotAttributePropagationController } from '../../controllers/slot-attribute-propagation-controller/index.js';\nimport {\n DROP_EFFECTS,\n type DropEffect,\n DROPZONE_DEFAULT_DROP_EFFECT,\n DROPZONE_VALID_SIZES,\n type DropzoneDragLeaveDetail,\n type DropzoneSize,\n SWC_DROPZONE_DRAGLEAVE_EVENT,\n SWC_DROPZONE_DRAGOVER_EVENT,\n SWC_DROPZONE_DROP_EVENT,\n SWC_DROPZONE_SHOULD_ACCEPT_EVENT,\n} from './Dropzone.types.js';\n\n/**\n * Base class for the `<swc-dropzone>` drop zone component.\n *\n * Encapsulates all drag-and-drop event handling, state management, and\n * validation logic. Rendering, ARIA, and CSS are provided by the concrete\n * SWC subclass.\n *\n * @attribute {DropzoneSize} size - Controls the illustrated icon scale and container dimensions.\n *\n * @slot - Slot for the illustrated message and browse control. Hidden automatically when `filled` is true.\n * @slot filled-content - Slot for the uploaded-state content (e.g. an image preview). Shown automatically when `filled` is true; hidden otherwise.\n *\n * @fires swc-dropzone-should-accept - Cancelable event fired on every native `dragover`\n * tick while a drag is over the zone, not just on entry. Cancel to reject the dragged\n * payload and set the cursor to `none`.\n * @fires swc-dropzone-dragover - Fired once when dragged files enter the zone and are\n * accepted; does not repeat on subsequent `dragover` ticks while still hovering.\n * @fires swc-dropzone-dragleave - Fired when an accepted drag leaves the zone after a\n * 100 ms debounce, or immediately when it becomes rejected. Detail is a plain snapshot\n * `{ clientX, clientY, relatedTarget }` captured synchronously from the native event.\n * @fires swc-dropzone-drop - Fired when files are dropped on the zone. `element.dragged`\n * is still `true` when this event fires; it transitions to `false` after dispatch.\n */\nexport abstract class DropzoneBase extends SizedMixin(SpectrumElement, {\n validSizes: DROPZONE_VALID_SIZES,\n}) {\n /**\n * The size of the drop zone.\n *\n * @default m\n */\n declare public size: DropzoneSize;\n\n // ──────────────────────────\n // SHARED API\n // ──────────────────────────\n\n /**\n * Whether files are currently being dragged over the drop zone.\n * Set automatically by the component; also settable to reflect programmatic state.\n *\n * @attr dragged\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public dragged = false;\n\n /**\n * Whether the drop zone has received a file and is in the filled state.\n * Set by consuming code after a successful drop or browse-file selection to\n * switch the zone to its filled visual.\n *\n * @attr filled\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public filled = false;\n\n /**\n * The OS drag-cursor feedback shown while a file is held over the zone.\n * Maps directly to `DataTransfer.dropEffect`. Settable via the `drop-effect`\n * attribute, but property changes do not reflect back to the attribute\n * because it controls browser chrome, not component state.\n *\n * @attr drop-effect\n * @type {'copy' | 'move' | 'link' | 'none'}\n * @default 'copy'\n */\n @property({ type: String, attribute: 'drop-effect' })\n public get dropEffect(): DropEffect {\n return this._dropEffect;\n }\n\n public set dropEffect(value: DropEffect | null) {\n // Lit passes `null` here when the `drop-effect` attribute is removed;\n // treat that as \"reset to the default\" rather than an invalid value.\n if (value === null) {\n const oldValue = this._dropEffect;\n this._dropEffect = DROPZONE_DEFAULT_DROP_EFFECT;\n this.requestUpdate('dropEffect', oldValue);\n } else if ((DROP_EFFECTS as readonly string[]).includes(value)) {\n const oldValue = this._dropEffect;\n this._dropEffect = value;\n this.requestUpdate('dropEffect', oldValue);\n } else {\n validateEnum(this, {\n prop: 'drop-effect',\n value,\n valid: DROP_EFFECTS,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-dropzone--docs',\n });\n }\n }\n\n /** @internal */\n private _dropEffect: DropEffect = DROPZONE_DEFAULT_DROP_EFFECT;\n\n // ──────────────────────────\n // IMPLEMENTATION\n // ──────────────────────────\n\n constructor() {\n super();\n new DragAndDropController(this, {\n isDragged: () => this.dragged,\n shouldAccept: (event) =>\n this.dispatchEvent(\n new CustomEvent<DragEvent>(SWC_DROPZONE_SHOULD_ACCEPT_EVENT, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: event,\n })\n ),\n dropEffect: () => this._dropEffect,\n onDragEnter: (event) => {\n this.dragged = true;\n this.dispatchEvent(\n new CustomEvent<DragEvent>(SWC_DROPZONE_DRAGOVER_EVENT, {\n bubbles: true,\n composed: true,\n detail: event,\n })\n );\n },\n onDragLeave: (snapshot) => {\n this.dragged = false;\n this.dispatchEvent(\n new CustomEvent<DropzoneDragLeaveDetail>(\n SWC_DROPZONE_DRAGLEAVE_EVENT,\n {\n bubbles: true,\n composed: true,\n detail: snapshot,\n }\n )\n );\n },\n onDrop: (event) => {\n // Dispatch before clearing `dragged`; `updated()` handles the status region after `filled` settles.\n this.dispatchEvent(\n new CustomEvent<DragEvent>(SWC_DROPZONE_DROP_EVENT, {\n bubbles: true,\n composed: true,\n detail: event,\n })\n );\n this.dragged = false;\n },\n });\n }\n\n /** @internal */\n private readonly _sizePropagation = new SlotAttributePropagationController(\n this,\n {\n attribute: 'size',\n getValue: () => this.size,\n selector: 'swc-illustrated-message',\n }\n );\n\n /** @internal */\n protected handleDefaultSlotChange(): void {\n this._sizePropagation.propagate();\n }\n}\n"],"mappings":";;;;;;;;;AAwDA,IAAsB,IAAtB,cAA2C,EAAW,GAAiB,EACrE,YAAY,GACb,CAAC,CAAC;CA2CD,IACW,aAAyB;AAClC,SAAO,KAAK;;CAGd,IAAW,WAAW,GAA0B;AAG9C,MAAI,MAAU,MAAM;GAClB,IAAM,IAAW,KAAK;AAEtB,GADA,KAAK,cAAc,GACnB,KAAK,cAAc,cAAc,EAAS;aAChC,EAAmC,SAAS,EAAM,EAAE;GAC9D,IAAM,IAAW,KAAK;AAEtB,GADA,KAAK,cAAc,GACnB,KAAK,cAAc,cAAc,EAAS;QAE1C,GAAa,MAAM;GACjB,MAAM;GACN;GACA,OAAO;GACP,KAAK;GACN,CAAC;;CAWN,cAAc;AAEZ,EADA,OAAO,iBAzDQ,kBAWD,uBAuCkB,2BA0DE,IAAI,EACtC,MACA;GACE,WAAW;GACX,gBAAgB,KAAK;GACrB,UAAU;GACX,CACF,EAzDC,IAAI,EAAsB,MAAM;GAC9B,iBAAiB,KAAK;GACtB,eAAe,MACb,KAAK,cACH,IAAI,YAAuB,GAAkC;IAC3D,SAAS;IACT,YAAY;IACZ,UAAU;IACV,QAAQ;IACT,CAAC,CACH;GACH,kBAAkB,KAAK;GACvB,cAAc,MAAU;AAEtB,IADA,KAAK,UAAU,IACf,KAAK,cACH,IAAI,YAAuB,GAA6B;KACtD,SAAS;KACT,UAAU;KACV,QAAQ;KACT,CAAC,CACH;;GAEH,cAAc,MAAa;AAEzB,IADA,KAAK,UAAU,IACf,KAAK,cACH,IAAI,YACF,GACA;KACE,SAAS;KACT,UAAU;KACV,QAAQ;KACT,CACF,CACF;;GAEH,SAAS,MAAU;AASjB,IAPA,KAAK,cACH,IAAI,YAAuB,GAAyB;KAClD,SAAS;KACT,UAAU;KACV,QAAQ;KACT,CAAC,CACH,EACD,KAAK,UAAU;;GAElB,CAAC;;CAcJ,0BAA0C;AACxC,OAAK,iBAAiB,WAAW;;;GAxHlC,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA,KAW1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,UAAA,KAAA,EAAA,KAa1C,EAAS;CAAE,MAAM;CAAQ,WAAW;CAAe,CAAC,CAAA,EAAA,EAAA,WAAA,cAAA,KAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export type DropzoneSize = 's' | 'm' | 'l';
|
|
13
|
+
export declare const DROPZONE_VALID_SIZES: readonly ["s", "m", "l"];
|
|
14
|
+
/** Valid OS drag-cursor feedback values for the drop zone. */
|
|
15
|
+
export type DropEffect = 'copy' | 'move' | 'link' | 'none';
|
|
16
|
+
export declare const DROP_EFFECTS: readonly ["copy", "move", "link", "none"];
|
|
17
|
+
export declare const DROPZONE_DEFAULT_DROP_EFFECT: "copy";
|
|
18
|
+
/** Fired when files are dragged over the drop zone; cancelable to reject. */
|
|
19
|
+
export declare const SWC_DROPZONE_SHOULD_ACCEPT_EVENT = "swc-dropzone-should-accept";
|
|
20
|
+
/** Fired when files are dragged over the drop zone and accepted. */
|
|
21
|
+
export declare const SWC_DROPZONE_DRAGOVER_EVENT = "swc-dropzone-dragover";
|
|
22
|
+
/** Fired when an accepted drag leaves the drop zone or becomes rejected. */
|
|
23
|
+
export declare const SWC_DROPZONE_DRAGLEAVE_EVENT = "swc-dropzone-dragleave";
|
|
24
|
+
/** Fired when files are dropped on the drop zone. */
|
|
25
|
+
export declare const SWC_DROPZONE_DROP_EVENT = "swc-dropzone-drop";
|
|
26
|
+
/**
|
|
27
|
+
* Detail emitted with `swc-dropzone-dragleave`. Values are captured synchronously
|
|
28
|
+
* from the native `DragEvent` before the 100 ms debounce timer fires, preventing
|
|
29
|
+
* stale reads from a recycled event object.
|
|
30
|
+
*/
|
|
31
|
+
export interface DropzoneDragLeaveDetail {
|
|
32
|
+
clientX: number;
|
|
33
|
+
clientY: number;
|
|
34
|
+
relatedTarget: EventTarget | null;
|
|
35
|
+
}
|
|
36
|
+
declare global {
|
|
37
|
+
interface GlobalEventHandlersEventMap {
|
|
38
|
+
[SWC_DROPZONE_SHOULD_ACCEPT_EVENT]: CustomEvent<DragEvent>;
|
|
39
|
+
[SWC_DROPZONE_DRAGOVER_EVENT]: CustomEvent<DragEvent>;
|
|
40
|
+
[SWC_DROPZONE_DRAGLEAVE_EVENT]: CustomEvent<DropzoneDragLeaveDetail>;
|
|
41
|
+
[SWC_DROPZONE_DROP_EVENT]: CustomEvent<DragEvent>;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region components/dropzone/Dropzone.types.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"s",
|
|
4
|
+
"m",
|
|
5
|
+
"l"
|
|
6
|
+
], t = [
|
|
7
|
+
"copy",
|
|
8
|
+
"move",
|
|
9
|
+
"link",
|
|
10
|
+
"none"
|
|
11
|
+
], n = "copy", r = "swc-dropzone-should-accept", i = "swc-dropzone-dragover", a = "swc-dropzone-dragleave", o = "swc-dropzone-drop";
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as DROPZONE_DEFAULT_DROP_EFFECT, e as DROPZONE_VALID_SIZES, t as DROP_EFFECTS, a as SWC_DROPZONE_DRAGLEAVE_EVENT, i as SWC_DROPZONE_DRAGOVER_EVENT, o as SWC_DROPZONE_DROP_EVENT, r as SWC_DROPZONE_SHOULD_ACCEPT_EVENT };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=Dropzone.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropzone.types.js","names":[],"sources":["../../../components/dropzone/Dropzone.types.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\n// ──────────────────\n// SIZES\n// ──────────────────\n\nexport type DropzoneSize = 's' | 'm' | 'l';\n\nexport const DROPZONE_VALID_SIZES = [\n 's',\n 'm',\n 'l',\n] as const satisfies readonly DropzoneSize[];\n\n// ──────────────────\n// DROP EFFECT\n// ──────────────────\n\n/** Valid OS drag-cursor feedback values for the drop zone. */\nexport type DropEffect = 'copy' | 'move' | 'link' | 'none';\n\nexport const DROP_EFFECTS = [\n 'copy',\n 'move',\n 'link',\n 'none',\n] as const satisfies readonly DropEffect[];\n\nexport const DROPZONE_DEFAULT_DROP_EFFECT =\n 'copy' as const satisfies DropEffect;\n\n// ──────────────────\n// EVENTS\n// ──────────────────\n\n/** Fired when files are dragged over the drop zone; cancelable to reject. */\nexport const SWC_DROPZONE_SHOULD_ACCEPT_EVENT = 'swc-dropzone-should-accept';\n\n/** Fired when files are dragged over the drop zone and accepted. */\nexport const SWC_DROPZONE_DRAGOVER_EVENT = 'swc-dropzone-dragover';\n\n/** Fired when an accepted drag leaves the drop zone or becomes rejected. */\nexport const SWC_DROPZONE_DRAGLEAVE_EVENT = 'swc-dropzone-dragleave';\n\n/** Fired when files are dropped on the drop zone. */\nexport const SWC_DROPZONE_DROP_EVENT = 'swc-dropzone-drop';\n\n/**\n * Detail emitted with `swc-dropzone-dragleave`. Values are captured synchronously\n * from the native `DragEvent` before the 100 ms debounce timer fires, preventing\n * stale reads from a recycled event object.\n */\nexport interface DropzoneDragLeaveDetail {\n clientX: number;\n clientY: number;\n relatedTarget: EventTarget | null;\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n [SWC_DROPZONE_SHOULD_ACCEPT_EVENT]: CustomEvent<DragEvent>;\n [SWC_DROPZONE_DRAGOVER_EVENT]: CustomEvent<DragEvent>;\n [SWC_DROPZONE_DRAGLEAVE_EVENT]: CustomEvent<DropzoneDragLeaveDetail>;\n [SWC_DROPZONE_DROP_EVENT]: CustomEvent<DragEvent>;\n }\n}\n"],"mappings":";AAkBA,IAAa,IAAuB;CAClC;CACA;CACA;CACD,EASY,IAAe;CAC1B;CACA;CACA;CACA;CACD,EAEY,IACX,QAOW,IAAmC,8BAGnC,IAA8B,yBAG9B,IAA+B,0BAG/B,IAA0B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export * from './Dropzone.base.js';
|
|
13
|
+
export * from './Dropzone.types.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DROPZONE_DEFAULT_DROP_EFFECT as e, DROPZONE_VALID_SIZES as t, DROP_EFFECTS as n, SWC_DROPZONE_DRAGLEAVE_EVENT as r, SWC_DROPZONE_DRAGOVER_EVENT as i, SWC_DROPZONE_DROP_EVENT as a, SWC_DROPZONE_SHOULD_ACCEPT_EVENT as o } from "./Dropzone.types.js";
|
|
2
|
+
import { DropzoneBase as s } from "./Dropzone.base.js";
|
|
3
|
+
export { e as DROPZONE_DEFAULT_DROP_EFFECT, t as DROPZONE_VALID_SIZES, n as DROP_EFFECTS, s as DropzoneBase, r as SWC_DROPZONE_DRAGLEAVE_EVENT, i as SWC_DROPZONE_DRAGOVER_EVENT, a as SWC_DROPZONE_DROP_EVENT, o as SWC_DROPZONE_SHOULD_ACCEPT_EVENT };
|