@carbon/web-components 2.63.0-rc.0 → 2.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +645 -0
- package/es/components/big-number/big-number.js +1 -1
- package/es/components/card/card-action.d.ts +27 -0
- package/es/components/card/card-action.d.ts.map +1 -0
- package/es/components/card/card-action.js +52 -0
- package/es/components/card/card-action.js.map +1 -0
- package/es/components/card/card-actions.d.ts +36 -0
- package/es/components/card/card-actions.d.ts.map +1 -0
- package/es/components/card/card-actions.js +171 -0
- package/es/components/card/card-actions.js.map +1 -0
- package/es/components/card/card-body.d.ts +23 -0
- package/es/components/card/card-body.d.ts.map +1 -0
- package/es/components/card/card-body.js +54 -0
- package/es/components/card/card-body.js.map +1 -0
- package/es/components/card/card-context.d.ts +20 -0
- package/es/components/card/card-context.d.ts.map +1 -0
- package/es/components/card/card-context.js +29 -0
- package/es/components/card/card-context.js.map +1 -0
- package/es/components/card/card-footer.d.ts +34 -0
- package/es/components/card/card-footer.d.ts.map +1 -0
- package/es/components/card/card-footer.js +75 -0
- package/es/components/card/card-footer.js.map +1 -0
- package/es/components/card/card-header-media.d.ts +19 -0
- package/es/components/card/card-header-media.d.ts.map +1 -0
- package/es/components/card/card-header-media.js +39 -0
- package/es/components/card/card-header-media.js.map +1 -0
- package/es/components/card/card-header.d.ts +23 -0
- package/es/components/card/card-header.d.ts.map +1 -0
- package/es/components/card/card-header.js +70 -0
- package/es/components/card/card-header.js.map +1 -0
- package/es/components/card/card-media.d.ts +37 -0
- package/es/components/card/card-media.d.ts.map +1 -0
- package/es/components/card/card-media.js +79 -0
- package/es/components/card/card-media.js.map +1 -0
- package/es/components/card/card-title-media.d.ts +19 -0
- package/es/components/card/card-title-media.d.ts.map +1 -0
- package/es/components/card/card-title-media.js +39 -0
- package/es/components/card/card-title-media.js.map +1 -0
- package/es/components/card/card-title.d.ts +52 -0
- package/es/components/card/card-title.d.ts.map +1 -0
- package/es/components/card/card-title.js +144 -0
- package/es/components/card/card-title.js.map +1 -0
- package/es/components/card/card.d.ts +69 -0
- package/es/components/card/card.d.ts.map +1 -0
- package/es/components/card/card.js +185 -0
- package/es/components/card/card.js.map +1 -0
- package/es/components/card/card.scss.js +14 -0
- package/es/components/card/card.scss.js.map +1 -0
- package/es/components/card/defs.d.ts +33 -0
- package/es/components/card/defs.d.ts.map +1 -0
- package/es/components/card/defs.js +46 -0
- package/es/components/card/defs.js.map +1 -0
- package/es/components/card/index.d.ts +17 -0
- package/es/components/card/index.d.ts.map +1 -0
- package/es/components/card/index.js +17 -0
- package/es/components/tile/clickable-tile.js +1 -1
- package/es/components/user-avatar/index.d.ts +8 -0
- package/es/components/user-avatar/index.d.ts.map +1 -0
- package/es/components/user-avatar/index.js +8 -0
- package/es/components/user-avatar/user-avatar.d.ts +84 -0
- package/es/components/user-avatar/user-avatar.d.ts.map +1 -0
- package/es/components/user-avatar/user-avatar.js +151 -0
- package/es/components/user-avatar/user-avatar.js.map +1 -0
- package/es/components/user-avatar/user-avatar.scss.js +14 -0
- package/es/components/user-avatar/user-avatar.scss.js.map +1 -0
- package/es/globals/settings.d.ts +1 -1
- package/es/globals/settings.d.ts.map +1 -1
- package/es/globals/settings.js +1 -0
- package/es/globals/settings.js.map +1 -1
- package/es/index.d.ts +10 -0
- package/es/index.d.ts.map +1 -1
- package/es/index.js +13 -3
- package/es-custom/components/big-number/big-number.js +1 -1
- package/es-custom/components/card/card-action.d.ts +27 -0
- package/es-custom/components/card/card-action.d.ts.map +1 -0
- package/es-custom/components/card/card-action.js +52 -0
- package/es-custom/components/card/card-action.js.map +1 -0
- package/es-custom/components/card/card-actions.d.ts +36 -0
- package/es-custom/components/card/card-actions.d.ts.map +1 -0
- package/es-custom/components/card/card-actions.js +171 -0
- package/es-custom/components/card/card-actions.js.map +1 -0
- package/es-custom/components/card/card-body.d.ts +23 -0
- package/es-custom/components/card/card-body.d.ts.map +1 -0
- package/es-custom/components/card/card-body.js +54 -0
- package/es-custom/components/card/card-body.js.map +1 -0
- package/es-custom/components/card/card-context.d.ts +20 -0
- package/es-custom/components/card/card-context.d.ts.map +1 -0
- package/es-custom/components/card/card-context.js +29 -0
- package/es-custom/components/card/card-context.js.map +1 -0
- package/es-custom/components/card/card-footer.d.ts +34 -0
- package/es-custom/components/card/card-footer.d.ts.map +1 -0
- package/es-custom/components/card/card-footer.js +75 -0
- package/es-custom/components/card/card-footer.js.map +1 -0
- package/es-custom/components/card/card-header-media.d.ts +19 -0
- package/es-custom/components/card/card-header-media.d.ts.map +1 -0
- package/es-custom/components/card/card-header-media.js +39 -0
- package/es-custom/components/card/card-header-media.js.map +1 -0
- package/es-custom/components/card/card-header.d.ts +23 -0
- package/es-custom/components/card/card-header.d.ts.map +1 -0
- package/es-custom/components/card/card-header.js +70 -0
- package/es-custom/components/card/card-header.js.map +1 -0
- package/es-custom/components/card/card-media.d.ts +37 -0
- package/es-custom/components/card/card-media.d.ts.map +1 -0
- package/es-custom/components/card/card-media.js +79 -0
- package/es-custom/components/card/card-media.js.map +1 -0
- package/es-custom/components/card/card-title-media.d.ts +19 -0
- package/es-custom/components/card/card-title-media.d.ts.map +1 -0
- package/es-custom/components/card/card-title-media.js +39 -0
- package/es-custom/components/card/card-title-media.js.map +1 -0
- package/es-custom/components/card/card-title.d.ts +52 -0
- package/es-custom/components/card/card-title.d.ts.map +1 -0
- package/es-custom/components/card/card-title.js +144 -0
- package/es-custom/components/card/card-title.js.map +1 -0
- package/es-custom/components/card/card.d.ts +69 -0
- package/es-custom/components/card/card.d.ts.map +1 -0
- package/es-custom/components/card/card.js +185 -0
- package/es-custom/components/card/card.js.map +1 -0
- package/es-custom/components/card/card.scss.js +14 -0
- package/es-custom/components/card/card.scss.js.map +1 -0
- package/es-custom/components/card/defs.d.ts +33 -0
- package/es-custom/components/card/defs.d.ts.map +1 -0
- package/es-custom/components/card/defs.js +46 -0
- package/es-custom/components/card/defs.js.map +1 -0
- package/es-custom/components/card/index.d.ts +17 -0
- package/es-custom/components/card/index.d.ts.map +1 -0
- package/es-custom/components/card/index.js +17 -0
- package/es-custom/components/tile/clickable-tile.js +1 -1
- package/es-custom/components/user-avatar/index.d.ts +8 -0
- package/es-custom/components/user-avatar/index.d.ts.map +1 -0
- package/es-custom/components/user-avatar/index.js +8 -0
- package/es-custom/components/user-avatar/user-avatar.d.ts +84 -0
- package/es-custom/components/user-avatar/user-avatar.d.ts.map +1 -0
- package/es-custom/components/user-avatar/user-avatar.js +151 -0
- package/es-custom/components/user-avatar/user-avatar.js.map +1 -0
- package/es-custom/components/user-avatar/user-avatar.scss.js +14 -0
- package/es-custom/components/user-avatar/user-avatar.scss.js.map +1 -0
- package/es-custom/globals/settings.d.ts +1 -1
- package/es-custom/globals/settings.d.ts.map +1 -1
- package/es-custom/globals/settings.js +1 -0
- package/es-custom/globals/settings.js.map +1 -1
- package/es-custom/index.d.ts +10 -0
- package/es-custom/index.d.ts.map +1 -1
- package/es-custom/index.js +13 -3
- package/lib/components/card/card-action.d.ts +27 -0
- package/lib/components/card/card-action.d.ts.map +1 -0
- package/lib/components/card/card-actions.d.ts +36 -0
- package/lib/components/card/card-actions.d.ts.map +1 -0
- package/lib/components/card/card-body.d.ts +23 -0
- package/lib/components/card/card-body.d.ts.map +1 -0
- package/lib/components/card/card-context.d.ts +20 -0
- package/lib/components/card/card-context.d.ts.map +1 -0
- package/lib/components/card/card-footer.d.ts +34 -0
- package/lib/components/card/card-footer.d.ts.map +1 -0
- package/lib/components/card/card-header-media.d.ts +19 -0
- package/lib/components/card/card-header-media.d.ts.map +1 -0
- package/lib/components/card/card-header.d.ts +23 -0
- package/lib/components/card/card-header.d.ts.map +1 -0
- package/lib/components/card/card-media.d.ts +37 -0
- package/lib/components/card/card-media.d.ts.map +1 -0
- package/lib/components/card/card-title-media.d.ts +19 -0
- package/lib/components/card/card-title-media.d.ts.map +1 -0
- package/lib/components/card/card-title.d.ts +52 -0
- package/lib/components/card/card-title.d.ts.map +1 -0
- package/lib/components/card/card.d.ts +69 -0
- package/lib/components/card/card.d.ts.map +1 -0
- package/lib/components/card/defs.d.ts +33 -0
- package/lib/components/card/defs.d.ts.map +1 -0
- package/lib/components/card/defs.js +48 -0
- package/lib/components/card/defs.js.map +1 -0
- package/lib/components/card/index.d.ts +17 -0
- package/lib/components/card/index.d.ts.map +1 -0
- package/lib/components/user-avatar/index.d.ts +8 -0
- package/lib/components/user-avatar/index.d.ts.map +1 -0
- package/lib/components/user-avatar/user-avatar.d.ts +84 -0
- package/lib/components/user-avatar/user-avatar.d.ts.map +1 -0
- package/lib/globals/settings.d.ts +1 -1
- package/lib/globals/settings.d.ts.map +1 -1
- package/lib/globals/settings.js +1 -0
- package/lib/globals/settings.js.map +1 -1
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/scss/components/card/card-story.scss +29 -0
- package/scss/components/card/card.scss +212 -0
- package/scss/components/user-avatar/story-styles.scss +53 -0
- package/scss/components/user-avatar/user-avatar.scss +113 -0
- package/telemetry.yml +5 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import "../../globals/settings.js";
|
|
9
|
+
import { carbonElement } from "../../globals/decorators/carbon-element.js";
|
|
10
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
11
|
+
import iconLoader from "../../globals/internal/icon-loader.js";
|
|
12
|
+
import link_default from "../link/link.js";
|
|
13
|
+
import { cardContext, cardDefaultContext } from "./card-context.js";
|
|
14
|
+
import { CARD_DENSITY, CARD_MEDIA_POSITION } from "./defs.js";
|
|
15
|
+
import card_default$1 from "./card.scss.js";
|
|
16
|
+
import { html, nothing } from "lit";
|
|
17
|
+
import { property, state } from "lit/decorators.js";
|
|
18
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
19
|
+
import { provide } from "@lit/context";
|
|
20
|
+
import ArrowRight16 from "@carbon/icons/es/arrow--right/16.js";
|
|
21
|
+
//#region src/components/card/card.ts
|
|
22
|
+
/**
|
|
23
|
+
* Copyright IBM Corp. 2026
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
26
|
+
* LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Card — composable container component.
|
|
30
|
+
*
|
|
31
|
+
* @element cds-card
|
|
32
|
+
* @slot - Default slot for cds-card-header, cds-card-body, cds-card-footer, cds-card-media.
|
|
33
|
+
* @slot decorator - Slot for cds-ai-label. Sets `has-ai-label` attribute when populated.
|
|
34
|
+
* @slot footer-icon - Override the default ArrowRight icon in the clickable footer.
|
|
35
|
+
*/
|
|
36
|
+
let CDSCard = class CDSCard extends link_default {
|
|
37
|
+
constructor(..._args) {
|
|
38
|
+
super(..._args);
|
|
39
|
+
this.cardContext = cardDefaultContext;
|
|
40
|
+
this._hasAILabel = false;
|
|
41
|
+
this.clickable = false;
|
|
42
|
+
this.disabled = false;
|
|
43
|
+
this.density = "productive";
|
|
44
|
+
this.horizontal = false;
|
|
45
|
+
this.mediaPosition = "start";
|
|
46
|
+
}
|
|
47
|
+
connectedCallback() {
|
|
48
|
+
super.connectedCallback();
|
|
49
|
+
if (this.clickable && !this.href && !this.getAttribute("aria-label") && !this.getAttribute("aria-labelledby")) console.error("[cds-card] A clickable card must have an accessible name. Set `aria-label` or `aria-labelledby` on the element.");
|
|
50
|
+
}
|
|
51
|
+
willUpdate(changed) {
|
|
52
|
+
super.willUpdate?.(changed);
|
|
53
|
+
if (changed.has("clickable") || changed.has("disabled") || changed.has("horizontal")) this.cardContext = {
|
|
54
|
+
clickable: this.clickable,
|
|
55
|
+
disabled: this.disabled,
|
|
56
|
+
horizontal: this.horizontal
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
_handleDecoratorSlotChange({ target }) {
|
|
60
|
+
const hasAILabel = target.assignedElements().some((el) => el.matches(`cds-ai-label`));
|
|
61
|
+
this._hasAILabel = hasAILabel;
|
|
62
|
+
if (hasAILabel) this.setAttribute("has-ai-label", "");
|
|
63
|
+
else this.removeAttribute("has-ai-label");
|
|
64
|
+
}
|
|
65
|
+
_handleDefaultSlotChange({ target }) {
|
|
66
|
+
if (target.assignedElements({ flatten: true }).some((el) => el.matches(`cds-card-actions`))) this.setAttribute("has-actions", "");
|
|
67
|
+
else this.removeAttribute("has-actions");
|
|
68
|
+
}
|
|
69
|
+
_handleClick(e) {
|
|
70
|
+
if (this.disabled) {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
_handleKeydown(e) {
|
|
76
|
+
if (this.disabled) return;
|
|
77
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
e.currentTarget.click();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** The BEM class map for the root card div/anchor. */
|
|
83
|
+
get _cardClasses() {
|
|
84
|
+
const { clickable, disabled, density, _hasAILabel, horizontal } = this;
|
|
85
|
+
return classMap({
|
|
86
|
+
[`cds--card`]: true,
|
|
87
|
+
[`cds--card--clickable`]: clickable && !disabled,
|
|
88
|
+
[`cds--card--disabled`]: disabled,
|
|
89
|
+
[`cds--card--${density}`]: true,
|
|
90
|
+
[`cds--card--has-ai-label`]: _hasAILabel,
|
|
91
|
+
[`cds--card--horizontal`]: horizontal
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The card's inner content layout.
|
|
96
|
+
*/
|
|
97
|
+
_renderContent() {
|
|
98
|
+
const { horizontal, mediaPosition } = this;
|
|
99
|
+
if (!horizontal) return html`<slot @slotchange=${this._handleDefaultSlotChange}></slot>`;
|
|
100
|
+
const mediaSlot = html`<slot name="media"></slot>`;
|
|
101
|
+
const contentDiv = html`
|
|
102
|
+
<div class="${"cds"}--card__content">
|
|
103
|
+
<slot @slotchange=${this._handleDefaultSlotChange}></slot>
|
|
104
|
+
</div>
|
|
105
|
+
`;
|
|
106
|
+
return mediaPosition === "end" ? html`${contentDiv}${mediaSlot}` : html`${mediaSlot}${contentDiv}`;
|
|
107
|
+
}
|
|
108
|
+
/** Clickable-footer affordance (aria-hidden, purely decorative). */
|
|
109
|
+
_renderClickableFooter() {
|
|
110
|
+
return html`
|
|
111
|
+
<div class="${"cds"}--card__clickable-footer" aria-hidden="true">
|
|
112
|
+
<slot name="footer-icon">
|
|
113
|
+
${iconLoader(ArrowRight16, { "aria-hidden": "true" })}
|
|
114
|
+
</slot>
|
|
115
|
+
</div>
|
|
116
|
+
`;
|
|
117
|
+
}
|
|
118
|
+
_renderInner() {
|
|
119
|
+
const { clickable } = this;
|
|
120
|
+
return html`
|
|
121
|
+
<div class=${this._cardClasses}>
|
|
122
|
+
${this._renderContent()}
|
|
123
|
+
${clickable ? this._renderClickableFooter() : nothing}
|
|
124
|
+
<slot
|
|
125
|
+
name="decorator"
|
|
126
|
+
@slotchange=${this._handleDecoratorSlotChange}></slot>
|
|
127
|
+
</div>
|
|
128
|
+
`;
|
|
129
|
+
}
|
|
130
|
+
render() {
|
|
131
|
+
return this._renderLink();
|
|
132
|
+
}
|
|
133
|
+
_renderLink() {
|
|
134
|
+
const { href, clickable, disabled } = this;
|
|
135
|
+
if (href) return disabled ? this._renderDisabledLink() : super._renderLink();
|
|
136
|
+
if (clickable) return html`
|
|
137
|
+
<div
|
|
138
|
+
role="button"
|
|
139
|
+
tabindex=${disabled ? -1 : 0}
|
|
140
|
+
aria-disabled=${disabled}
|
|
141
|
+
@click=${this._handleClick}
|
|
142
|
+
@keydown=${this._handleKeydown}>
|
|
143
|
+
${this._renderInner()}
|
|
144
|
+
</div>
|
|
145
|
+
`;
|
|
146
|
+
return html`<div>${this._renderInner()}</div>`;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Selector matching the AI Label element.
|
|
150
|
+
*/
|
|
151
|
+
static get aiLabelItem() {
|
|
152
|
+
return `cds-ai-label`;
|
|
153
|
+
}
|
|
154
|
+
static {
|
|
155
|
+
this.styles = card_default$1;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
__decorate([provide({ context: cardContext }), property({ attribute: false })], CDSCard.prototype, "cardContext", void 0);
|
|
159
|
+
__decorate([state()], CDSCard.prototype, "_hasAILabel", void 0);
|
|
160
|
+
__decorate([property({
|
|
161
|
+
type: Boolean,
|
|
162
|
+
reflect: true
|
|
163
|
+
})], CDSCard.prototype, "clickable", void 0);
|
|
164
|
+
__decorate([property({
|
|
165
|
+
type: Boolean,
|
|
166
|
+
reflect: true
|
|
167
|
+
})], CDSCard.prototype, "disabled", void 0);
|
|
168
|
+
__decorate([property({
|
|
169
|
+
type: String,
|
|
170
|
+
reflect: true
|
|
171
|
+
})], CDSCard.prototype, "density", void 0);
|
|
172
|
+
__decorate([property({
|
|
173
|
+
type: Boolean,
|
|
174
|
+
reflect: true
|
|
175
|
+
})], CDSCard.prototype, "horizontal", void 0);
|
|
176
|
+
__decorate([property({
|
|
177
|
+
attribute: "media-position",
|
|
178
|
+
reflect: true
|
|
179
|
+
})], CDSCard.prototype, "mediaPosition", void 0);
|
|
180
|
+
CDSCard = __decorate([carbonElement(`cds-card`)], CDSCard);
|
|
181
|
+
var card_default = CDSCard;
|
|
182
|
+
//#endregion
|
|
183
|
+
export { CARD_DENSITY, CARD_MEDIA_POSITION, card_default as default };
|
|
184
|
+
|
|
185
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","names":["CDSLink","slot","styles","customElement"],"sources":["../../../src/components/card/card.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, nothing, PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { provide } from '@lit/context';\nimport { prefix } from '../../globals/settings';\nimport CDSLink from '../link/link';\nimport ArrowRight16 from '@carbon/icons/es/arrow--right/16.js';\nimport { iconLoader } from '../../globals/internal/icon-loader';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\nimport {\n cardContext,\n cardDefaultContext,\n type CardContextValue,\n} from './card-context';\nimport { CARD_DENSITY, CARD_MEDIA_POSITION } from './defs';\nimport styles from './card.scss?lit';\n\nexport { CARD_DENSITY, CARD_MEDIA_POSITION };\n\n/**\n * Card — composable container component.\n *\n * @element cds-card\n * @slot - Default slot for cds-card-header, cds-card-body, cds-card-footer, cds-card-media.\n * @slot decorator - Slot for cds-ai-label. Sets `has-ai-label` attribute when populated.\n * @slot footer-icon - Override the default ArrowRight icon in the clickable footer.\n */\n@customElement(`${prefix}-card`)\nclass CDSCard extends CDSLink {\n // ─── Context ──────────────────────────────────────────────────────────────\n\n @provide({ context: cardContext })\n @property({ attribute: false })\n cardContext: CardContextValue = cardDefaultContext;\n\n // ─── Internal state ───────────────────────────────────────────────────────\n\n /** Set to true when a cds-ai-label is found in the decorator slot. */\n @state()\n private _hasAILabel = false;\n\n // ─── Properties / Attributes ──────────────────────────────────────────────\n\n /**\n * Makes the entire card surface interactive.\n */\n @property({ type: Boolean, reflect: true })\n clickable = false;\n\n /**\n * Mutes all interaction.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * Controls heading typography inside the card.\n */\n @property({ type: String, reflect: true })\n density: CARD_DENSITY = CARD_DENSITY.PRODUCTIVE;\n\n /**\n * Side-by-side layout: cds-card-media on one side, other content stacked.\n */\n @property({ type: Boolean, reflect: true })\n horizontal = false;\n\n /**\n * Position of the media column when `horizontal` is true.\n * @default 'start'\n */\n @property({ attribute: 'media-position', reflect: true })\n mediaPosition: CARD_MEDIA_POSITION = CARD_MEDIA_POSITION.START;\n\n // ─── Lifecycle ────────────────────────────────────────────────────────────\n\n connectedCallback() {\n super.connectedCallback();\n\n // Accessible name requirement for clickable (non-link) cards.\n if (\n this.clickable &&\n !this.href &&\n !this.getAttribute('aria-label') &&\n !this.getAttribute('aria-labelledby')\n ) {\n // eslint-disable-next-line no-console\n console.error(\n `[cds-card] A clickable card must have an accessible name. ` +\n `Set \\`aria-label\\` or \\`aria-labelledby\\` on the element.`\n );\n }\n }\n\n willUpdate(changed: PropertyValues) {\n super.willUpdate?.(changed);\n\n if (\n changed.has('clickable') ||\n changed.has('disabled') ||\n changed.has('horizontal')\n ) {\n this.cardContext = {\n clickable: this.clickable,\n disabled: this.disabled,\n horizontal: this.horizontal,\n };\n }\n }\n\n // ─── Slot handlers ────────────────────────────────────────────────────────\n\n private _handleDecoratorSlotChange({ target }: Event) {\n const slot = target as HTMLSlotElement;\n const hasAILabel = slot\n .assignedElements()\n .some((el) => el.matches(`${prefix}-ai-label`));\n\n this._hasAILabel = hasAILabel;\n\n if (hasAILabel) {\n this.setAttribute('has-ai-label', '');\n } else {\n this.removeAttribute('has-ai-label');\n }\n }\n\n private _handleDefaultSlotChange({ target }: Event) {\n const slot = target as HTMLSlotElement;\n const hasActions = slot\n .assignedElements({ flatten: true })\n .some((el) => el.matches(`${prefix}-card-actions`));\n\n if (hasActions) {\n this.setAttribute('has-actions', '');\n } else {\n this.removeAttribute('has-actions');\n }\n }\n\n // ─── Event handlers (non-link clickable mode) ─────────────────────────────\n\n private _handleClick(e: MouseEvent) {\n if (this.disabled) {\n e.stopPropagation();\n e.preventDefault();\n }\n }\n\n private _handleKeydown(e: KeyboardEvent) {\n if (this.disabled) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault(); // prevent Space from scrolling\n (e.currentTarget as HTMLElement).click();\n }\n }\n\n // ─── Render helpers ───────────────────────────────────────────────────────\n\n /** The BEM class map for the root card div/anchor. */\n private get _cardClasses() {\n const { clickable, disabled, density, _hasAILabel, horizontal } = this;\n return classMap({\n [`${prefix}--card`]: true,\n [`${prefix}--card--clickable`]: clickable && !disabled,\n [`${prefix}--card--disabled`]: disabled,\n [`${prefix}--card--${density}`]: true,\n [`${prefix}--card--has-ai-label`]: _hasAILabel,\n [`${prefix}--card--horizontal`]: horizontal,\n });\n }\n\n /**\n * The card's inner content layout.\n */\n private _renderContent() {\n const { horizontal, mediaPosition } = this;\n\n if (!horizontal) {\n return html`<slot @slotchange=${this._handleDefaultSlotChange}></slot>`;\n }\n\n const mediaSlot = html`<slot name=\"media\"></slot>`;\n const contentDiv = html`\n <div class=\"${prefix}--card__content\">\n <slot @slotchange=${this._handleDefaultSlotChange}></slot>\n </div>\n `;\n\n return mediaPosition === CARD_MEDIA_POSITION.END\n ? html`${contentDiv}${mediaSlot}`\n : html`${mediaSlot}${contentDiv}`;\n }\n\n /** Clickable-footer affordance (aria-hidden, purely decorative). */\n private _renderClickableFooter() {\n return html`\n <div class=\"${prefix}--card__clickable-footer\" aria-hidden=\"true\">\n <slot name=\"footer-icon\">\n ${iconLoader(ArrowRight16, { 'aria-hidden': 'true' })}\n </slot>\n </div>\n `;\n }\n\n // ─── CDSLink overrides ────────────────────────────────────────────────────\n protected _renderInner() {\n const { clickable } = this;\n return html`\n <div class=${this._cardClasses}>\n ${this._renderContent()}\n ${clickable ? this._renderClickableFooter() : nothing}\n <slot\n name=\"decorator\"\n @slotchange=${this._handleDecoratorSlotChange}></slot>\n </div>\n `;\n }\n\n render() {\n return this._renderLink();\n }\n\n protected _renderLink() {\n const { href, clickable, disabled } = this;\n\n // Link card — delegate to CDSLink's implementation, but render a <p>\n // (via _renderDisabledLink) when disabled to suppress navigation.\n if (href) {\n return disabled ? this._renderDisabledLink() : super._renderLink();\n }\n\n // Non-link clickable card — div with button semantics.\n if (clickable) {\n return html`\n <div\n role=\"button\"\n tabindex=${disabled ? -1 : 0}\n aria-disabled=${disabled}\n @click=${this._handleClick}\n @keydown=${this._handleKeydown}>\n ${this._renderInner()}\n </div>\n `;\n }\n\n // Static card — plain div, no interaction semantics.\n return html`<div>${this._renderInner()}</div>`;\n }\n\n // ─── Static ───────────────────────────────────────────────────────────────\n\n /**\n * Selector matching the AI Label element.\n */\n static get aiLabelItem() {\n return `${prefix}-ai-label`;\n }\n\n static styles = styles;\n}\n\nexport default CDSCard;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { css } from "lit";
|
|
9
|
+
//#region src/components/card/card.scss?lit
|
|
10
|
+
var card_default = css([".cds--card{position:relative;background-color:var(--cds-layer);color:var(--cds-text-primary,#161616)}.cds--card--clickable{display:block;border:1px solid var(--cds-border-tile-01,#c6c6c6);cursor:pointer;text-decoration:none;transition:background-color .11s cubic-bezier(.2,0,.38,.9)}.cds--card--clickable:hover{background-color:var(--cds-layer-hover)}.cds--card--clickable:focus{outline:2px solid var(--cds-focus,#0f62fe);outline-offset:-2px}@media screen and (prefers-contrast){.cds--card--clickable:focus{outline-style:dotted}}.cds--card--clickable:focus{outline-offset:0}.cds--card--clickable:active{background-color:var(--cds-layer-active)}.cds--card__clickable-footer{display:flex;align-items:center;justify-content:flex-end;padding:1rem;color:var(--cds-icon-interactive,#0f62fe)}.cds--card--disabled .cds--card__clickable-footer{color:var(--cds-icon-disabled,rgba(22,22,22,.25))}.cds--card--disabled{border-color:var(--cds-border-disabled,#c6c6c6);background-color:var(--cds-layer);color:var(--cds-text-disabled,rgba(22,22,22,.25));cursor:not-allowed;pointer-events:none}.cds--card__header{position:relative;display:grid;-moz-column-gap:1rem;column-gap:1rem;grid-template-columns:auto 1fr;row-gap:0}.cds--card__body{font-size:var(--cds-body-compact-01-font-size,.875rem);font-weight:var(--cds-body-compact-01-font-weight,400);line-height:var(--cds-body-compact-01-line-height,1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing,.16px);padding-block:1rem;padding-inline:1rem}.cds--card__body--flush{padding:0}.cds--card__footer{display:flex;align-items:center;padding:1rem}.cds--card__footer:has(>.cds--card__action){overflow:hidden;padding:0;border-block-start:1px solid var(--cds-border-subtle);gap:1px}.cds--card__footer>.cds--card__action:not(:has(.cds--btn--icon-only)){flex:1 0 0;min-inline-size:0}.cds--card__footer>.cds--card__action:not(:has(.cds--btn--icon-only))>*>.cds--btn,.cds--card__footer>.cds--card__action:not(:has(.cds--btn--icon-only))>.cds--btn{inline-size:100%;max-inline-size:none}.cds--card__footer>.cds--card__action:has(.cds--btn--icon-only){flex:0 0 auto;margin-inline-start:auto}.cds--card__footer>.cds--card__action:has(.cds--btn--icon-only)+.cds--card__action:has(.cds--btn--icon-only){margin-inline-start:0}.cds--card__action{display:inline-flex}.cds--card__header-media{display:flex;align-items:flex-start;justify-content:flex-start;grid-column:1/-1;margin-block:1rem;margin-inline:1rem;max-block-size:4rem}.cds--card__media{grid-column:1/-1;inline-size:100%}.cds--card__media:after,.cds--card__media:before{display:none}.cds--card__media.cds--aspect-ratio--16x9{aspect-ratio:16/9}.cds--card__media.cds--aspect-ratio--9x16{aspect-ratio:9/16}.cds--card__media.cds--aspect-ratio--2x1{aspect-ratio:2/1}.cds--card__media.cds--aspect-ratio--1x2{aspect-ratio:1/2}.cds--card__media.cds--aspect-ratio--4x3{aspect-ratio:4/3}.cds--card__media.cds--aspect-ratio--3x4{aspect-ratio:3/4}.cds--card__media.cds--aspect-ratio--3x2{aspect-ratio:3/2}.cds--card__media.cds--aspect-ratio--2x3{aspect-ratio:2/3}.cds--card__media.cds--aspect-ratio--1x1{aspect-ratio:1/1}.cds--card__media>*{position:static;block-size:100%;inline-size:100%;-o-object-fit:cover;object-fit:cover}.cds--card--horizontal{display:flex;flex-direction:row;align-items:stretch}.cds--card__media--horizontal{overflow:hidden;flex-basis:var(--cds--card--media-width,33.33%);flex-shrink:0;align-self:stretch}.cds--card--horizontal>.cds--card__content{display:flex;flex:1 1 0;flex-direction:column;min-inline-size:0}.cds--card--horizontal>.cds--card__content>.cds--card__body{flex:1 0 auto}.cds--card--horizontal>.cds--card__content>.cds--card__footer{margin-block-start:auto}.cds--card__title .cds--card__label{font-size:var(--cds-label-01-font-size,.75rem);font-weight:var(--cds-label-01-font-weight,400);line-height:var(--cds-label-01-line-height,1.33333);letter-spacing:var(--cds-label-01-letter-spacing,.32px);color:var(--cds-text-secondary,#525252)}.cds--card--disabled .cds--card__label{color:var(--cds-text-disabled,rgba(22,22,22,.25))}.cds--card__label--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cds--card__label--truncate-multi{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:var(--cds--card--label-line-clamp);text-overflow:ellipsis}.cds--card__title{display:flex;overflow:hidden;flex-direction:column;gap:.125rem;margin-inline:1rem;min-inline-size:0}.cds--card__header>.cds--card__title{margin-block:1rem}.cds--card--expressive .cds--card__title-text-row{font-size:var(--cds-heading-03-font-size,1.25rem);font-weight:var(--cds-heading-03-font-weight,400);line-height:var(--cds-heading-03-line-height,1.4);letter-spacing:var(--cds-heading-03-letter-spacing,0)}.cds--card--productive .cds--card__title-text-row{font-size:var(--cds-heading-compact-02-font-size,1rem);font-weight:var(--cds-heading-compact-02-font-weight,600);line-height:var(--cds-heading-compact-02-line-height,1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing,0)}.cds--card__title-text-row{display:block}.cds--card__title-text-row--truncate{white-space:nowrap}.cds--card__title-text-row--truncate,.cds--card__title-text-row--truncate-multi{overflow:hidden;max-inline-size:var(--cds--card--title-max-width,100%);text-overflow:ellipsis}.cds--card__title-text-row--truncate-multi{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:var(--cds--card--title-line-clamp)}.cds--card__title-text-row--with-start-icon{display:flex;align-items:flex-start;gap:.5rem}.cds--card__title-text-row--with-end-icon{display:block}.cds--card__title-start-icon{display:flex;flex-shrink:0;margin-block-start:.125rem}.cds--card__title-end-icon{display:inline-flex;align-items:center;margin-inline-start:.5rem;vertical-align:middle}.cds--card__title .cds--card__description{font-size:var(--cds-label-01-font-size,.75rem);font-weight:var(--cds-label-01-font-weight,400);line-height:var(--cds-label-01-line-height,1.33333);letter-spacing:var(--cds-label-01-letter-spacing,.32px);color:var(--cds-text-secondary,#525252)}.cds--card--disabled .cds--card__description{color:var(--cds-text-disabled,rgba(22,22,22,.25))}.cds--card__description--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cds--card__description--truncate-multi{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:var(--cds--card--description-line-clamp);text-overflow:ellipsis}.cds--card__title-media{display:flex;flex-shrink:0;align-items:flex-start;justify-content:center;grid-column:1;margin-block-start:1rem;margin-inline-start:1rem;max-block-size:4rem}.cds--card__header:has(>.cds--card__title-media)>.cds--card__title{grid-column:2;margin-inline-start:0}.cds--card__actions{position:absolute;display:inline-flex;align-items:center;justify-content:flex-end;block-size:2rem;gap:.25rem;inline-size:50%;inset-block-start:.5rem;inset-inline-end:.5rem;max-inline-size:50%}.cds--card--has-ai-label{background:linear-gradient(to top,var(--cds-layer,var(--cds-ai-popover-background,#fff)) 0,var(--cds-ai-aura-start,rgba(69,137,255,.1)) 0,15%,var(--cds-ai-aura-end,hsla(0,0%,100%,0)) 50%) padding-box,linear-gradient(to top,var(--cds-layer,var(--cds-ai-popover-background,#fff)),var(--cds-layer,var(--cds-ai-popover-background,#fff))) padding-box,linear-gradient(to bottom,var(--cds-ai-border-start,rgba(166,200,255,.64)),var(--cds-ai-border-end,#78a9ff)) border-box,linear-gradient(to top,var(--cds-layer,var(--cds-ai-popover-background,#fff)),var(--cds-layer,var(--cds-ai-popover-background,#fff))) border-box;border:1px solid transparent;box-shadow:inset 0 -80px 70px -65px var(--cds-ai-inner-shadow,rgba(69,137,255,.1)),0 4px 10px 2px var(--cds-ai-drop-shadow,rgba(15,98,254,.1))}.cds--card__decorator{position:absolute;z-index:1;display:flex;align-items:center;block-size:2rem;inset-block-start:.5rem;inset-inline-end:.5rem}.cds--card--has-ai-label .cds--card__title{padding-inline-end:3rem}.cds--card--has-ai-label:has(.cds--card__actions) .cds--card__title{padding-inline-end:10rem}.cds--card--has-ai-label .cds--card__label{padding-inline-end:3rem}.cds--card--has-ai-label:has(.cds--card__actions) .cds--card__label{padding-inline-end:10rem}.cds--card--has-ai-label .cds--card__description{padding-inline-end:3rem}.cds--card--has-ai-label:has(.cds--card__actions) .cds--card__description{padding-inline-end:10rem}.cds--card--has-ai-label .cds--card__actions{inset-inline-end:2.5rem}.cds--card--clickable.cds--card--has-ai-label:before{background:linear-gradient(to top,var(--cds-ai-aura-hover-start,rgba(69,137,255,.32)) 0,15%,var(--cds-ai-aura-hover-end,hsla(0,0%,100%,0)) 50%) padding-box,linear-gradient(to top,var(--cds-ai-aura-hover-background,#edf5ff),var(--cds-ai-aura-hover-background,#edf5ff)) padding-box,linear-gradient(to bottom,var(--cds-ai-border-start,rgba(166,200,255,.64)),var(--cds-ai-border-end,#78a9ff)) border-box,linear-gradient(to top,var(--cds-ai-aura-hover-background,#edf5ff),var(--cds-ai-aura-hover-background,#edf5ff)) border-box;position:absolute;display:block;block-size:100%;box-shadow:inset 0 -80px 70px -65px var(--cds-ai-inner-shadow,rgba(69,137,255,.1));content:\"\";inline-size:100%;inset-block-start:0;inset-inline-start:0;opacity:0;transition:opacity .11s cubic-bezier(.2,0,.38,.9)}.cds--card--clickable.cds--card--has-ai-label:hover:before{opacity:1}:host-context(cds-card-header) .cds--card__title{margin-block:1rem}:host(cds-card-title) .cds--card__title-text-row{font-size:var(--cds-heading-compact-02-font-size,1rem);font-weight:var(--cds-heading-compact-02-font-weight,600);line-height:var(--cds-heading-compact-02-line-height,1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing,0)}:host-context(cds-card[density=productive]) .cds--card__title-text-row{font-size:var(--cds-heading-compact-02-font-size,1rem);font-weight:var(--cds-heading-compact-02-font-weight,600);line-height:var(--cds-heading-compact-02-line-height,1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing,0)}:host-context(cds-card[density=expressive]) .cds--card__title-text-row{font-size:var(--cds-heading-03-font-size,1.25rem);font-weight:var(--cds-heading-03-font-weight,400);line-height:var(--cds-heading-03-line-height,1.4);letter-spacing:var(--cds-heading-03-letter-spacing,0)}:host-context(cds-card[disabled]) .cds--card__label{color:var(--cds-text-disabled,rgba(22,22,22,.25))}:host-context(cds-card[disabled]) .cds--card__description{color:var(--cds-text-disabled,rgba(22,22,22,.25))}:host-context(cds-card[horizontal]) .cds--card__body{flex:1 0 auto}:host-context(cds-card[horizontal]) .cds--card__footer{margin-block-start:auto}:host-context(cds-card[has-ai-label]) .cds--card__title{padding-inline-end:3rem}:host-context(cds-card[has-ai-label]) .cds--card__label{padding-inline-end:3rem}:host-context(cds-card[has-ai-label]) .cds--card__description{padding-inline-end:3rem}:host-context(cds-card[has-ai-label][has-actions]) .cds--card__title{padding-inline-end:10rem}:host-context(cds-card[has-ai-label][has-actions]) .cds--card__label{padding-inline-end:10rem}:host-context(cds-card[has-ai-label][has-actions]) .cds--card__description{padding-inline-end:10rem}:host-context(cds-card-header[has-title-media]) .cds--card__title{grid-column:2;margin-inline-start:0}:host(cds-card-footer[has-actions]) .cds--card__footer{overflow:hidden;justify-content:flex-end;padding:0;border-block-start:1px solid var(--cds-border-subtle);gap:1px}:host(cds-card-action:not([icon-only])){flex:1 0 0;min-inline-size:0}:host(cds-card-action:not([icon-only])) .cds--card__action{display:flex;inline-size:100%}:host(cds-card-action:not([icon-only])) .cds--card__action>::slotted(*){inline-size:100%;max-inline-size:none}:host(cds-card-action[icon-only]){flex:0 0 auto}:host(cds-card){display:block}:host(cds-card) a[part=link]{color:inherit;text-decoration:none}:host(cds-card) a[part=link]:active,:host(cds-card) a[part=link]:focus,:host(cds-card) a[part=link]:hover{color:inherit;text-decoration:none}:host(cds-card-header){display:block}:host(cds-card-body){display:block}:host(cds-card-footer){display:block}:host(cds-card-media){display:block}:host(cds-card-header-media){display:flex;align-items:flex-start;justify-content:flex-start;grid-column:1/-1;margin-block:1rem;margin-inline:1rem;max-block-size:4rem}:host(cds-card-header-media) .cds--card__header-media{display:contents}:host(cds-card-title){display:block;min-inline-size:0}:host(cds-card-title-media){display:block}:host(cds-card-header) .cds--card__header ::slotted(cds-card-actions){position:absolute;display:inline-flex;align-items:center;justify-content:flex-end;block-size:2rem;gap:.25rem;inline-size:50%;inset-block-start:.5rem;inset-inline-end:.5rem;max-inline-size:50%}:host(cds-card-actions){position:relative}:host(cds-card-actions) .cds--card__actions-overflow-menu{position:absolute;inset-block-start:0;inset-inline-end:0}:host(cds-card-action){display:block}:host(cds-card-action[data-hidden]){display:none}"]);
|
|
11
|
+
//#endregion
|
|
12
|
+
export { card_default as default };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=card.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.scss.js","names":[],"sources":["../../../src/components/card/card.scss?lit"],"sourcesContent":["//\n// Copyright IBM Corp. 2026\n//\n// This source code is licensed under the Apache-2.0 license found in the\n// LICENSE file in the root directory of this source tree.\n//\n\n$css--plex: true !default;\n\n@use '@carbon/styles/scss/config' as *;\n@use '@carbon/styles/scss/spacing' as *;\n@use '@carbon/styles/scss/theme' as *;\n@use '@carbon/styles/scss/type' as *;\n// `@use` runs the module's `_index.scss` once, which already includes the\n// `card.card` mixin — do not `@include` it again here or every rule from\n// the shared @carbon/styles card mixin gets emitted twice.\n@use '@carbon/styles/scss/components/card' as card;\n\n:host-context(#{$prefix}-card-header) .#{$prefix}--card__title {\n margin-block: $spacing-05;\n}\n\n:host(#{$prefix}-card-title) .#{$prefix}--card__title-text-row {\n // Base / fallback — productive is the default density.\n @include type-style('heading-compact-02');\n}\n\n:host-context(#{$prefix}-card[density='productive'])\n .#{$prefix}--card__title-text-row {\n @include type-style('heading-compact-02');\n}\n\n:host-context(#{$prefix}-card[density='expressive'])\n .#{$prefix}--card__title-text-row {\n @include type-style('heading-03');\n}\n\n:host-context(#{$prefix}-card[disabled]) .#{$prefix}--card__label {\n color: $text-disabled;\n}\n\n:host-context(#{$prefix}-card[disabled]) .#{$prefix}--card__description {\n color: $text-disabled;\n}\n\n:host-context(#{$prefix}-card[horizontal]) .#{$prefix}--card__body {\n flex: 1 0 auto;\n}\n\n:host-context(#{$prefix}-card[horizontal]) .#{$prefix}--card__footer {\n margin-block-start: auto;\n}\n\n:host-context(#{$prefix}-card[has-ai-label]) .#{$prefix}--card__title {\n padding-inline-end: calc($spacing-07 + $spacing-05);\n}\n\n:host-context(#{$prefix}-card[has-ai-label]) .#{$prefix}--card__label {\n padding-inline-end: calc($spacing-07 + $spacing-05);\n}\n\n:host-context(#{$prefix}-card[has-ai-label]) .#{$prefix}--card__description {\n padding-inline-end: calc($spacing-07 + $spacing-05);\n}\n\n:host-context(#{$prefix}-card[has-ai-label][has-actions])\n .#{$prefix}--card__title {\n padding-inline-end: $spacing-13;\n}\n\n:host-context(#{$prefix}-card[has-ai-label][has-actions])\n .#{$prefix}--card__label {\n padding-inline-end: $spacing-13;\n}\n\n:host-context(#{$prefix}-card[has-ai-label][has-actions])\n .#{$prefix}--card__description {\n padding-inline-end: $spacing-13;\n}\n\n:host-context(#{$prefix}-card-header[has-title-media])\n .#{$prefix}--card__title {\n grid-column: 2;\n margin-inline-start: 0;\n}\n\n:host(#{$prefix}-card-footer[has-actions]) .#{$prefix}--card__footer {\n overflow: hidden;\n justify-content: flex-end;\n padding: 0;\n border-block-start: 1px solid $border-subtle;\n gap: 1px;\n}\n\n:host(#{$prefix}-card-action:not([icon-only])) {\n flex: 1 0 0;\n min-inline-size: 0;\n\n .#{$prefix}--card__action {\n display: flex;\n inline-size: 100%;\n }\n\n .#{$prefix}--card__action > ::slotted(*) {\n inline-size: 100%;\n max-inline-size: none;\n }\n}\n\n// Icon-only actions: fixed width. The footer container's justify-content:flex-end\n// pushes the whole group to the trailing edge, so no per-item margin trick needed.\n// Original: .cds--card__footer > .cds--card__action:has(.cds--btn--icon-only)\n\n:host(#{$prefix}-card-action[icon-only]) {\n flex: 0 0 auto;\n}\n\n// ─── Host-level display ───────────────────────────────────────────────────────\n\n:host(#{$prefix}-card) {\n display: block;\n}\n\n:host(#{$prefix}-card) a[part='link'] {\n color: inherit;\n text-decoration: none;\n\n &:hover,\n &:focus,\n &:active {\n color: inherit;\n text-decoration: none;\n }\n}\n\n:host(#{$prefix}-card-header) {\n display: block;\n}\n\n:host(#{$prefix}-card-body) {\n display: block;\n}\n\n:host(#{$prefix}-card-footer) {\n display: block;\n}\n\n:host(#{$prefix}-card-media) {\n display: block;\n}\n\n:host(#{$prefix}-card-header-media) {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n grid-column: 1 / -1;\n margin-block: $spacing-05;\n margin-inline: $spacing-05;\n max-block-size: $spacing-10;\n}\n\n:host(#{$prefix}-card-header-media) .#{$prefix}--card__header-media {\n display: contents;\n}\n\n:host(#{$prefix}-card-title) {\n display: block;\n min-inline-size: 0;\n}\n\n:host(#{$prefix}-card-title-media) {\n display: block;\n}\n\n:host(#{$prefix}-card-header)\n .#{$prefix}--card__header\n ::slotted(#{$prefix}-card-actions) {\n position: absolute;\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n block-size: $spacing-07;\n gap: $spacing-02;\n inline-size: 50%;\n inset-block-start: $spacing-03;\n inset-inline-end: $spacing-03;\n max-inline-size: 50%;\n}\n\n:host(#{$prefix}-card-actions) {\n // Provide a positioning context for the shadow-DOM overflow menu.\n position: relative;\n}\n\n// The overflow menu renders in shadow DOM but visually aligns with the\n// sentinel (which is hidden when not overflowing). `position:absolute` takes\n// it out of flow; the host's `position:relative` is the containing block.\n:host(#{$prefix}-card-actions) .#{$prefix}--card__actions-overflow-menu {\n position: absolute;\n inset-block-start: 0;\n inset-inline-end: 0;\n}\n\n:host(#{$prefix}-card-action) {\n display: block;\n}\n\n// The overflow handler sets data-hidden on items that don't fit.\n// This hides them from view while keeping them in the DOM for measurement.\n:host(#{$prefix}-card-action[data-hidden]) {\n display: none;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Card density.
|
|
9
|
+
*/
|
|
10
|
+
export declare enum CARD_DENSITY {
|
|
11
|
+
/**
|
|
12
|
+
* Productive density — heading-compact-02 typography.
|
|
13
|
+
*/
|
|
14
|
+
PRODUCTIVE = "productive",
|
|
15
|
+
/**
|
|
16
|
+
* Expressive density — heading-03 typography.
|
|
17
|
+
*/
|
|
18
|
+
EXPRESSIVE = "expressive"
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Horizontal card media position.
|
|
22
|
+
*/
|
|
23
|
+
export declare enum CARD_MEDIA_POSITION {
|
|
24
|
+
/**
|
|
25
|
+
* Media on the inline-start side (default).
|
|
26
|
+
*/
|
|
27
|
+
START = "start",
|
|
28
|
+
/**
|
|
29
|
+
* Media on the inline-end side.
|
|
30
|
+
*/
|
|
31
|
+
END = "end"
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=defs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../src/components/card/defs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,oBAAY,YAAY;IACtB;;OAEG;IACH,UAAU,eAAe;IAEzB;;OAEG;IACH,UAAU,eAAe;CAC1B;AAED;;GAEG;AACH,oBAAY,mBAAmB;IAC7B;;OAEG;IACH,KAAK,UAAU;IAEf;;OAEG;IACH,GAAG,QAAQ;CACZ"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
//#region src/components/card/defs.ts
|
|
9
|
+
/**
|
|
10
|
+
* Copyright IBM Corp. 2026
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Card density.
|
|
17
|
+
*/
|
|
18
|
+
let CARD_DENSITY = /* @__PURE__ */ function(CARD_DENSITY) {
|
|
19
|
+
/**
|
|
20
|
+
* Productive density — heading-compact-02 typography.
|
|
21
|
+
*/
|
|
22
|
+
CARD_DENSITY["PRODUCTIVE"] = "productive";
|
|
23
|
+
/**
|
|
24
|
+
* Expressive density — heading-03 typography.
|
|
25
|
+
*/
|
|
26
|
+
CARD_DENSITY["EXPRESSIVE"] = "expressive";
|
|
27
|
+
return CARD_DENSITY;
|
|
28
|
+
}({});
|
|
29
|
+
/**
|
|
30
|
+
* Horizontal card media position.
|
|
31
|
+
*/
|
|
32
|
+
let CARD_MEDIA_POSITION = /* @__PURE__ */ function(CARD_MEDIA_POSITION) {
|
|
33
|
+
/**
|
|
34
|
+
* Media on the inline-start side (default).
|
|
35
|
+
*/
|
|
36
|
+
CARD_MEDIA_POSITION["START"] = "start";
|
|
37
|
+
/**
|
|
38
|
+
* Media on the inline-end side.
|
|
39
|
+
*/
|
|
40
|
+
CARD_MEDIA_POSITION["END"] = "end";
|
|
41
|
+
return CARD_MEDIA_POSITION;
|
|
42
|
+
}({});
|
|
43
|
+
//#endregion
|
|
44
|
+
export { CARD_DENSITY, CARD_MEDIA_POSITION };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=defs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defs.js","names":[],"sources":["../../../src/components/card/defs.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Card density.\n */\nexport enum CARD_DENSITY {\n /**\n * Productive density — heading-compact-02 typography.\n */\n PRODUCTIVE = 'productive',\n\n /**\n * Expressive density — heading-03 typography.\n */\n EXPRESSIVE = 'expressive',\n}\n\n/**\n * Horizontal card media position.\n */\nexport enum CARD_MEDIA_POSITION {\n /**\n * Media on the inline-start side (default).\n */\n START = 'start',\n\n /**\n * Media on the inline-end side.\n */\n END = 'end',\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAUA,IAAY,eAAL,yBAAA,cAAA;;;;CAIL,aAAA,gBAAA;;;;CAKA,aAAA,gBAAA;;AACF,EAAA,CAAA,CAAA;;;;AAKA,IAAY,sBAAL,yBAAA,qBAAA;;;;CAIL,oBAAA,WAAA;;;;CAKA,oBAAA,SAAA;;AACF,EAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import './card';
|
|
8
|
+
import './card-header';
|
|
9
|
+
import './card-body';
|
|
10
|
+
import './card-footer';
|
|
11
|
+
import './card-media';
|
|
12
|
+
import './card-header-media';
|
|
13
|
+
import './card-title';
|
|
14
|
+
import './card-title-media';
|
|
15
|
+
import './card-actions';
|
|
16
|
+
import './card-action';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/card/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,QAAQ,CAAC;AAChB,OAAO,eAAe,CAAC;AACvB,OAAO,aAAa,CAAC;AACrB,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AACtB,OAAO,qBAAqB,CAAC;AAC7B,OAAO,cAAc,CAAC;AACtB,OAAO,oBAAoB,CAAC;AAC5B,OAAO,gBAAgB,CAAC;AACxB,OAAO,eAAe,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import "./card.js";
|
|
9
|
+
import "./card-action.js";
|
|
10
|
+
import "./card-actions.js";
|
|
11
|
+
import "./card-body.js";
|
|
12
|
+
import "./card-footer.js";
|
|
13
|
+
import "./card-header.js";
|
|
14
|
+
import "./card-header-media.js";
|
|
15
|
+
import "./card-media.js";
|
|
16
|
+
import "./card-title.js";
|
|
17
|
+
import "./card-title-media.js";
|
|
@@ -16,8 +16,8 @@ import tile_default from "./tile.scss.js";
|
|
|
16
16
|
import { html } from "lit";
|
|
17
17
|
import { property } from "lit/decorators.js";
|
|
18
18
|
import { classMap } from "lit/directives/class-map.js";
|
|
19
|
-
import AILabel24 from "@carbon/icons/es/ai-label/24.js";
|
|
20
19
|
import ArrowRight16 from "@carbon/icons/es/arrow--right/16.js";
|
|
20
|
+
import AILabel24 from "@carbon/icons/es/ai-label/24.js";
|
|
21
21
|
import Error16 from "@carbon/icons/es/error/16.js";
|
|
22
22
|
//#region src/components/tile/clickable-tile.ts
|
|
23
23
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/user-avatar/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,eAAe,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { LitElement } from 'lit';
|
|
8
|
+
import '../tooltip/index';
|
|
9
|
+
declare const CDSUserAvatar_base: {
|
|
10
|
+
new (...args: any[]): {
|
|
11
|
+
_handles: Set<import("../../globals/internal/handle").default>;
|
|
12
|
+
connectedCallback(): void;
|
|
13
|
+
disconnectedCallback(): void;
|
|
14
|
+
};
|
|
15
|
+
_hostListeners: {
|
|
16
|
+
[listenerName: string]: {
|
|
17
|
+
[type: string]: {
|
|
18
|
+
options?: boolean | AddEventListenerOptions;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
} & typeof LitElement;
|
|
23
|
+
/**
|
|
24
|
+
* User Avatar.
|
|
25
|
+
*
|
|
26
|
+
* @element cds-user-avatar
|
|
27
|
+
*/
|
|
28
|
+
declare class CDSUserAvatar extends CDSUserAvatar_base {
|
|
29
|
+
/**
|
|
30
|
+
* Specify the text of the tooltip.
|
|
31
|
+
* Can be string
|
|
32
|
+
*/
|
|
33
|
+
tooltipText: any;
|
|
34
|
+
/**
|
|
35
|
+
* Specify the alignment of the tooltip.
|
|
36
|
+
*/
|
|
37
|
+
tooltipAlignment: string;
|
|
38
|
+
/**
|
|
39
|
+
* When passing the name prop, either send the initials to be used or the
|
|
40
|
+
* user's full name. The first two capital letters of the user's name will be
|
|
41
|
+
* used as the name.
|
|
42
|
+
*/
|
|
43
|
+
name: any;
|
|
44
|
+
/**
|
|
45
|
+
* Set the size of the avatar circle.
|
|
46
|
+
*/
|
|
47
|
+
size: string;
|
|
48
|
+
/**
|
|
49
|
+
* When passing the image prop, supply a full path to the image to be
|
|
50
|
+
* displayed.
|
|
51
|
+
*/
|
|
52
|
+
image: any;
|
|
53
|
+
/**
|
|
54
|
+
* When passing the image prop use the imageDescription prop to describe the
|
|
55
|
+
* image for screen reader.
|
|
56
|
+
*/
|
|
57
|
+
imageDescription: any;
|
|
58
|
+
/**
|
|
59
|
+
* Specify the background color for UserAvatar.
|
|
60
|
+
*/
|
|
61
|
+
backgroundColor: string;
|
|
62
|
+
/**
|
|
63
|
+
* Set theme in which the component will be rendered.
|
|
64
|
+
*/
|
|
65
|
+
theme: any;
|
|
66
|
+
private _hasRenderIcon;
|
|
67
|
+
private _observerMutation;
|
|
68
|
+
private _handleMutation;
|
|
69
|
+
connectedCallback(): void;
|
|
70
|
+
disconnectedCallback(): void;
|
|
71
|
+
private _onSlotChange;
|
|
72
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
73
|
+
static shadowRootOptions: {
|
|
74
|
+
delegatesFocus: boolean;
|
|
75
|
+
clonable?: boolean;
|
|
76
|
+
customElementRegistry?: CustomElementRegistry | null;
|
|
77
|
+
mode: ShadowRootMode;
|
|
78
|
+
serializable?: boolean;
|
|
79
|
+
slotAssignment?: SlotAssignmentMode;
|
|
80
|
+
};
|
|
81
|
+
static styles: any;
|
|
82
|
+
}
|
|
83
|
+
export default CDSUserAvatar;
|
|
84
|
+
//# sourceMappingURL=user-avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-avatar.d.ts","sourceRoot":"","sources":["../../../src/components/user-avatar/user-avatar.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAOvC,OAAO,kBAAkB,CAAC;;;;;;;;;;uBAaiB,CAAC;;;;;AAP5C;;;;GAIG;AAEH,cACM,aAAc,SAAQ,kBAA6B;IACvD;;;OAGG;IAEH,WAAW,MAAC;IAEZ;;OAEG;IAEH,gBAAgB,SAAY;IAE5B;;;;OAIG;IAEH,IAAI,MAAC;IAEL;;OAEG;IAEH,IAAI,SAAQ;IAEZ;;;OAGG;IAEH,KAAK,MAAC;IAEN;;;OAGG;IAEH,gBAAgB,MAAC;IAEjB;;OAEG;IAEH,eAAe,SAAkB;IAEjC;;OAEG;IAEH,KAAK,MAAC;IAGN,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAO,CAAC,iBAAiB,CAAiC;IAE1D,OAAO,CAAC,eAAe,CAErB;IAEF,iBAAiB;IAYjB,oBAAoB;IAQpB,OAAO,CAAC,aAAa;IAIrB,MAAM;IAiEN,MAAM,CAAC,iBAAiB;;;;;;;MAGtB;IAEF,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,aAAa,CAAC"}
|