/**
* DS Card - Web Component
*
* Usage:
*
*
* Title
* Description
*
* Content here
* Footer actions
*
*
* Attributes:
* - interactive: boolean (adds hover effect)
*/
class DsCard extends HTMLElement {
static get observedAttributes() {
return ['interactive'];
}
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.render();
}
disconnectedCallback() {
// Cleanup for consistency with other components
// This card has no event listeners, but disconnectedCallback
// is present for future extensibility and pattern consistency
}
attributeChangedCallback() {
if (this.shadowRoot.innerHTML) {
this.render();
}
}
get interactive() {
return this.hasAttribute('interactive');
}
render() {
const interactiveClass = this.interactive ? 'ds-card--interactive' : '';
this.shadowRoot.innerHTML = `
`;
}
}
class DsCardHeader extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.shadowRoot.innerHTML = `
`;
}
disconnectedCallback() {
// Cleanup for consistency with other components
}
}
class DsCardTitle extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.shadowRoot.innerHTML = `
`;
}
disconnectedCallback() {
// Cleanup for consistency with other components
}
}
class DsCardDescription extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.shadowRoot.innerHTML = `
`;
}
disconnectedCallback() {
// Cleanup for consistency with other components
}
}
class DsCardContent extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.shadowRoot.innerHTML = `
`;
}
disconnectedCallback() {
// Cleanup for consistency with other components
}
}
class DsCardFooter extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.shadowRoot.innerHTML = `
`;
}
disconnectedCallback() {
// Cleanup for consistency with other components
}
}
customElements.define('ds-card', DsCard);
customElements.define('ds-card-header', DsCardHeader);
customElements.define('ds-card-title', DsCardTitle);
customElements.define('ds-card-description', DsCardDescription);
customElements.define('ds-card-content', DsCardContent);
customElements.define('ds-card-footer', DsCardFooter);
export { DsCard, DsCardHeader, DsCardTitle, DsCardDescription, DsCardContent, DsCardFooter };