{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "product-card",
  "type": "registry:ui",
  "title": "<ui-product-card>",
  "description": "ui-product-card component. Copied from @purpurabog/ui 2.3.0; the package is the maintained source, this copy is yours to change. Icons from the Carbon Design System (Apache-2.0, © IBM Corp.; see THIRD-PARTY-NOTICES.md in the package).",
  "dependencies": [
    "lit@^3.3.0"
  ],
  "registryDependencies": [
    "@kanok-ui/button",
    "@kanok-ui/core-product-card",
    "@kanok-ui/icon-button",
    "@kanok-ui/layer",
    "@kanok-ui/menu",
    "@kanok-ui/overflow-menu",
    "@kanok-ui/shared-element",
    "@kanok-ui/shared-localize",
    "@kanok-ui/shared-slots",
    "@kanok-ui/tokens"
  ],
  "files": [
    {
      "path": "src/primitives/product-card/expressive-card.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/product-card/expressive-card.ts",
      "content": "import { css, html, nothing, type PropertyValues } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { productCardEnum, type ProductCardMediaPosition, type ProductCardPrimaryKind, type ProductCardSecondaryKind, type ProductCardClickZone, type ProductCardPlacement, type ProductCardTitleSize } from '../../core/product-card.ts';\nimport { ProductCardBase, cardStyles, BOTTOM, TRUE, type UiProductCardEventMap } from './product-card-shared.ts';\nimport '../button/button.ts';\nimport '../icon-button/icon-button.ts';\nimport '../layer/layer.ts';\n\n/**\n * Carbon for IBM Products `ExpressiveCard`: a `$layer` card for content — optional media on top or at the start\n * (`media-position=\"left\"`), a pictogram, a heading-03 title with its label and description, the body, and a footer\n * with the secondary and primary buttons (md; `primary-button-kind` primary | ghost, `secondary-button-kind`\n * secondary | ghost) and small ghost icon buttons (`slot=\"actions\"`). It follows the `<ui-layer>` it sits on.\n * IBM Products' current, prop-driven (legacy-style) card: use it where a screen must match IBM product UIs; for new work\n * prefer `ui-card` (Carbon's parts-based card, the direction of both Carbon and IBM Products' unreleased Card next).\n *\n * `clickable` makes the whole card a button (`ui-click`; Enter, Space or a click): its border turns `border-tile-01`,\n * `layer-hover-01` under the pointer, the focus ring on :focus. The card's button lies under its own controls, which\n * stay separate tab stops and never fire `ui-click`; a link or button you put directly in the body sits above it too.\n *\n * State on the host for styling: `data-has-footer` while the footer shows, `data-has-media` with media.\n *\n * @cssstate has-footer - While the footer shows (also `[data-has-footer]`)\n * @cssstate has-media - With media (also `[data-has-media]`)\n * @slot - The body (body-compact-01)\n * @slot label - Replaces `label`\n * @slot title - Replaces `heading`\n * @slot description - Replaces `description`\n * @slot media - An image or video across the top (or at the start), shown at its own size up to the card's width\n * @slot pictogram - A pictogram above the title, 16px in\n * @slot actions - Icon buttons (`<ui-icon-button label=\"…\">`, ghost); the card makes them sm\n * @slot primary-button-icon - A 16px icon after the primary button's text (Carbon `primaryButtonIcon`)\n * @slot secondary-button-icon - A 16px icon after the secondary button's text\n * @slot decorator - E.g. an AI label, 16px from the top-end corner\n * @fires ui-click - The card was activated (a click, Enter or Space); not while `disabled`\n * @fires ui-primary-button-click - The primary button was activated\n * @fires ui-secondary-button-click - The secondary button was activated\n * @csspart base - The card\n * @csspart click-zone - The card's button (`clickable` only), covering the card\n * @csspart media - The media's box\n * @csspart pictogram - The pictogram's box\n * @csspart content - The header, body and footer\n * @csspart header - The header\n * @csspart label - The label\n * @csspart title - The title (`<h2>` by default)\n * @csspart description - The description\n * @csspart actions - The action icons' box\n * @csspart body - The body\n * @csspart footer - The footer\n * @csspart primary-button - The primary `<ui-button>`\n * @csspart secondary-button - The secondary `<ui-button>`\n * @csspart decorator - The decorator's box\n */\n@customElement('ui-expressive-card')\nexport class UiExpressiveCard extends ProductCardBase {\n    static override hostStates: readonly string[] = ['has-footer', 'has-media'];\n\n    static override readonly styles = [\n        cardStyles,\n        css`\n            /* _expressive-card.scss */\n            .title {\n                font: var(--ui-font-heading-03);\n                letter-spacing: 0;\n            }\n\n            /* _card.scss .c4p--card__icon:hover: the card's layer-hover instead of the ghost button's background-hover\n               (its :active colour doesn't show: the ghost button's icon fill wins) */\n            ::slotted(ui-icon-button[slot='actions']) {\n                --ui-canvas-hover: var(--ui-ghost-hover);\n            }\n        `,\n    ];\n\n    protected readonly productive = false;\n\n    /** Where the media goes: across the top, or at the start with the content beside it. */\n    @property({ reflect: true, attribute: 'media-position' }) mediaPosition: ProductCardMediaPosition = 'top';\n\n    @property({ reflect: true, attribute: 'primary-button-kind' }) primaryButtonKind: ProductCardPrimaryKind = 'primary';\n\n    @property({ reflect: true, attribute: 'secondary-button-kind' }) secondaryButtonKind: ProductCardSecondaryKind = 'secondary';\n\n    protected get clickZoneValue(): ProductCardClickZone {\n        return 'one';\n    }\n\n    protected get actionsPlacementValue(): ProductCardPlacement {\n        return BOTTOM;\n    }\n\n    protected get primaryPlacementValue(): ProductCardPlacement {\n        return BOTTOM;\n    }\n\n    protected get secondaryPlacementValue(): ProductCardPlacement {\n        return BOTTOM;\n    }\n\n    protected get primaryKindValue() {\n        return productCardEnum<ProductCardPrimaryKind>(this.primaryButtonKind, ['primary', 'ghost'], 'primary');\n    }\n\n    protected get secondaryKindValue() {\n        return productCardEnum<ProductCardSecondaryKind>(this.secondaryButtonKind, ['secondary', 'ghost'], 'secondary');\n    }\n\n    protected get titleSizeValue(): ProductCardTitleSize {\n        return 'default';\n    }\n\n    protected get hasOverflow() {\n        return false;\n    }\n\n    protected override updated(changed: PropertyValues<this>) {\n        super.updated(changed);\n        this.toggleAttribute('data-has-media', this.slots.has('media'));\n    }\n\n    override render() {\n        const layout = this.layout();\n        const media = this.slots.has('media');\n        const classes = classMap({ card: true, zone: layout.zone === 'card', 'media-left': media && this.mediaPosition === 'left' });\n        return html`<div class=${classes} part=\"base\" aria-disabled=${this.disabled ? TRUE : nothing}>\n            ${this.renderTrigger(layout.zone, 'card')}${media ? html`<div class=\"media\" part=\"media\"><slot name=\"media\"></slot></div>` : nothing}${this.slots.has('pictogram')\n                ? html`<div class=\"pictogram\" part=\"pictogram\"><slot name=\"pictogram\"></slot></div>`\n                : nothing}${this.renderContent(layout)}\n        </div>`;\n    }\n}\n\n/** Typed listeners for UiExpressiveCard's events (declaration merging with the class). */\nexport interface UiExpressiveCard {\n    addEventListener<K extends keyof UiProductCardEventMap>(type: K, listener: (this: UiExpressiveCard, event: UiProductCardEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;\n    removeEventListener<K extends keyof UiProductCardEventMap>(type: K, listener: (this: UiExpressiveCard, event: UiProductCardEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;\n    removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;\n}\n\ndeclare global {\n    interface HTMLElementTagNameMap {\n        'ui-expressive-card': UiExpressiveCard;\n    }\n}\n"
    },
    {
      "path": "src/primitives/product-card/product-card-shared.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/product-card/product-card-shared.ts",
      "content": "import { css, nothing, html, type PropertyValues, type TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { unsafeStatic, html as staticHtml } from 'lit/static-html.js';\nimport { productCardLayout, productCardHeader, type ProductCardPlacement, type ProductCardClickZone, type ProductCardPrimaryKind, type ProductCardSecondaryKind, type ProductCardTitleSize, type ProductCardLayout, type ProductCardZone } from '../../core/product-card.ts';\nimport { LocalizeController } from '../shared/localize.ts';\nimport { SlotController } from '../shared/slots.ts';\nimport { UiElement } from '../shared/element.ts';\nimport '../button/button.ts';\nimport '../icon-button/icon-button.ts';\nimport '../overflow-menu/overflow-menu.ts';\nimport '../layer/layer.ts';\n\nexport const HEADINGS = new Set(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']);\n\nexport const BOTTOM: ProductCardPlacement = 'bottom';\n\nexport const TRUE = 'true';\n\n/** Carbon for IBM Products' legacy `Card` styles (`_card.scss`), shared by both cards. */\nexport const cardStyles = css`\n    :host {\n        display: block;\n    }\n\n    :host([hidden]) {\n        display: none;\n    }\n\n    /* Carbon's global box-sizing */\n    *,\n    *::before,\n    *::after {\n        box-sizing: border-box;\n    }\n\n    /* _card.scss .c4p--card: 1px transparent border, $layer-01, $text-primary */\n    .card {\n        position: relative;\n        height: 100%;\n        /* the card settings: Carbon a transparent border and square; Kanok a hairline, 12px, media clipped to the corners */\n        border: 1px solid var(--ui-tile-border-color, transparent);\n        border-radius: var(--ui-card-radius, 0);\n        overflow: var(--ui-card-overflow, visible);\n        background-color: var(--ui-card-background, var(--ui-surface-1));\n        color: var(--ui-ink);\n        font-family: var(--ui-font-family);\n    }\n\n    h1,\n    h2,\n    h3,\n    h4,\n    h5,\n    h6,\n    p {\n        margin: 0;\n    }\n\n    /* .c4p--card__clickable: border-tile-01, a pointer, layer-hover-01 under it (110ms with the browser's ease: no easing given) */\n    .zone {\n        position: relative;\n        cursor: pointer;\n        transition: background-color var(--ui-duration-moderate);\n    }\n\n    .card.zone {\n        border-color: var(--ui-border-tile);\n    }\n\n    .zone:hover {\n        background-color: var(--ui-ghost-hover);\n    }\n\n    /* the zone's button: covers the zone under its controls, so the controls stay its siblings, not its content */\n    .trigger {\n        position: absolute;\n        inset: 0;\n        margin: 0;\n        padding: 0;\n        border: 0;\n        background: transparent;\n        color: inherit;\n        cursor: pointer;\n        font: inherit;\n        outline: var(--ui-focus-width, 2px) solid transparent;\n        outline-offset: var(--ui-focus-offset, -2px);\n        /* above the content, which is positioned beside media (.media + .content); the controls come later at z-index 1 */\n        z-index: 1;\n    }\n\n    /* on the card it covers the 1px border too, where Carbon's outline (offset -2px) starts */\n    .card > .trigger {\n        inset: -1px;\n        border-radius: inherit;\n    }\n\n    /* .c4p--card__clickable:focus: focus-outline('outline'), on :focus as Carbon (a click shows it too) */\n    .trigger:focus {\n        outline-color: var(--ui-focus);\n    }\n\n    /* a mouse or touch focus shows no ring in a design that sets --ui-pointer-focus (Kanok: keyboard only) */\n    .trigger:focus:not(:focus-visible) {\n        outline-color: var(--ui-pointer-focus, var(--ui-focus));\n    }\n\n    /* the controls in a clickable zone sit above its button */\n    .actions,\n    .footer-button,\n    .body ::slotted(:is(a, button, input, select, textarea, [tabindex], ui-button, ui-icon-button, ui-link, ui-overflow-menu)) {\n        position: relative;\n        z-index: 1;\n    }\n\n    /* .c4p--card__media-left */\n    .media-left {\n        display: flex;\n        flex-direction: row;\n    }\n\n    .media-left .content {\n        display: flex;\n        flex: 1;\n        flex-direction: column;\n    }\n\n    .media-left .footer {\n        align-self: flex-end;\n        margin-block-start: auto;\n    }\n\n    .media ::slotted(*) {\n        display: block;\n        max-inline-size: 100%;\n    }\n\n    /* .c4p--card__media + .c4p--card__content-container: the decorator places itself under the media */\n    .media + .content {\n        position: relative;\n    }\n\n    /* .c4p--card__header: $spacing-05, nothing at the end (the decorator sits there) */\n    .header {\n        padding: var(--ui-space-md);\n        padding-inline-end: 0;\n    }\n\n    .header.label-only {\n        padding-block-end: var(--ui-space-xs);\n    }\n\n    .header-container {\n        display: flex;\n        flex-direction: row;\n        align-items: center;\n        justify-content: space-between;\n    }\n\n    .header-container.has-actions {\n        padding-inline-end: var(--ui-space-xs);\n    }\n\n    .header-container.has-decorator {\n        inline-size: 100%;\n        padding-inline-end: var(--ui-space-xl);\n    }\n\n    .header-container.has-decorator.has-actions {\n        padding-inline-end: 40px; /* $spacing-08 */\n    }\n\n    .header-container.has-decorator.large-or-label {\n        padding-inline-end: var(--ui-space-xxl);\n    }\n\n    /* label-01 */\n    .label,\n    .description {\n        font: var(--ui-font-caption);\n        line-height: 16px;\n        letter-spacing: var(--ui-tracking-caption);\n    }\n\n    .label {\n        margin-block-end: 2px; /* $spacing-01 */\n    }\n\n    .label-only .label {\n        margin-block-end: 0;\n    }\n\n    .description {\n        margin-block-start: 2px;\n    }\n\n    /* .c4p--card__body: body-compact-01, $spacing-05 except on top */\n    .body {\n        padding: var(--ui-space-md);\n        padding-block-start: 0;\n        font: var(--ui-font-body-sm);\n        line-height: 18px;\n        letter-spacing: var(--ui-tracking-body);\n    }\n\n    .footer {\n        display: flex;\n        justify-content: flex-end;\n    }\n\n    .actions {\n        display: flex;\n        flex-direction: row;\n    }\n\n    /* .c4p--card__pictogram */\n    .pictogram {\n        padding-block-start: var(--ui-space-md);\n        padding-inline-start: var(--ui-space-md);\n        /* Carbon's reset (line-height 1): an inline pictogram's line box, whatever the page sets */\n        line-height: 1;\n    }\n\n    /* .c4p--card__header__inner-wrapper--decorator: 16px from the top and the end */\n    .decorator {\n        position: absolute;\n        z-index: 1;\n        inset-block-start: var(--ui-space-md);\n        inset-inline-end: var(--ui-space-md);\n    }\n\n    @media (forced-colors: active) {\n        .card {\n            border-color: CanvasText;\n        }\n\n        .trigger:focus {\n            outline-color: Highlight;\n        }\n    }\n`;\n\n/**\n * What both cards share (Carbon for IBM Products' legacy `Card`): the header (label, heading, description, actions,\n * decorator), the body, the footer (secondary and primary buttons, actions) and the clickable zone.\n */\nexport abstract class ProductCardBase extends UiElement {\n    /** The title (Carbon `title`; named `heading` because `title` is every element's native tooltip). */\n    @property() heading = '';\n\n    /** The title's element (h1 … h6; Carbon `Heading` in its `Section`, an `<h2>` at the top of a page). */\n    @property({ attribute: 'heading-level' }) headingLevel = 'h2';\n\n    /** Text above the title (label-01). */\n    @property() label = '';\n\n    /** Text below the title (label-01). */\n    @property() description = '';\n\n    /** Makes the card's click zone one button (Carbon: an `onClick`); listen for `ui-click`. */\n    @property({ type: Boolean, reflect: true }) clickable = false;\n\n    /** Announced as disabled (`aria-disabled`, as Carbon); a clickable zone then fires no `ui-click`. No other change, as Carbon. */\n    @property({ type: Boolean, reflect: true }) disabled = false;\n\n    @property({ attribute: 'primary-button-text' }) primaryButtonText = '';\n\n    /** Makes the primary button a link (in the footer; Carbon's button at the top takes no `href`). */\n    @property({ attribute: 'primary-button-href' }) primaryButtonHref = '';\n\n    @property({ type: Boolean, reflect: true, attribute: 'primary-button-disabled' }) primaryButtonDisabled = false;\n\n    @property({ attribute: 'secondary-button-text' }) secondaryButtonText = '';\n\n    /** Makes the secondary button a link. */\n    @property({ attribute: 'secondary-button-href' }) secondaryButtonHref = '';\n\n    @property({ type: Boolean, reflect: true, attribute: 'secondary-button-disabled' }) secondaryButtonDisabled = false;\n\n    protected readonly slots = new SlotController(this);\n    protected readonly localize = new LocalizeController(this);\n\n    /** ProductiveCard (true) or ExpressiveCard (false). */\n    protected abstract readonly productive: boolean;\n\n    protected abstract get clickZoneValue(): ProductCardClickZone;\n    protected abstract get actionsPlacementValue(): ProductCardPlacement;\n    protected abstract get primaryPlacementValue(): ProductCardPlacement;\n    protected abstract get secondaryPlacementValue(): ProductCardPlacement;\n    protected abstract get primaryKindValue(): ProductCardPrimaryKind;\n    protected abstract get secondaryKindValue(): ProductCardSecondaryKind;\n    protected abstract get titleSizeValue(): ProductCardTitleSize;\n    protected abstract get hasOverflow(): boolean;\n\n    protected layout(): ProductCardLayout {\n        return productCardLayout({\n            productive: this.productive,\n            clickable: this.clickable,\n            clickZone: this.clickZoneValue,\n            actionsPlacement: this.actionsPlacementValue,\n            hasActionIcons: this.slots.has('actions'),\n            hasOverflowActions: this.hasOverflow,\n            hasPrimaryButton: !!this.primaryButtonText,\n            primaryButtonPlacement: this.primaryPlacementValue,\n            primaryButtonKind: this.primaryKindValue,\n            hasSecondaryButton: !!this.secondaryButtonText,\n            secondaryButtonPlacement: this.secondaryPlacementValue,\n            secondaryButtonKind: this.secondaryKindValue,\n        });\n    }\n\n    protected override updated(changed: PropertyValues<this>) {\n        super.updated(changed);\n        const layout = this.layout();\n        this.toggleAttribute('data-has-footer', layout.footer);\n        this.toggleAttribute('data-overflow', layout.overflow);\n        this.sizeActions(layout);\n    }\n\n    /** Carbon sizes the action icons itself: productive sm at the top, md at the bottom; expressive sm. */\n    private sizeActions(layout: ProductCardLayout) {\n        const slot = this.renderRoot.querySelector<HTMLSlotElement>('slot[name=\"actions\"]');\n        for (const el of slot?.assignedElements() ?? []) {\n            if (el.localName === 'ui-icon-button' && el.getAttribute('size') !== layout.iconSize) el.setAttribute('size', layout.iconSize);\n        }\n    }\n\n    private readonly onActionsSlotChange = () => this.sizeActions(this.layout());\n\n    private readonly onZoneClick = () => {\n        if (this.disabled) return;\n        this.dispatchEvent(new CustomEvent('ui-click', { bubbles: true, composed: true }));\n    };\n\n    private readonly onPrimaryClick = () => {\n        if (this.primaryButtonDisabled) return;\n        this.dispatchEvent(new CustomEvent('ui-primary-button-click', { bubbles: true, composed: true }));\n    };\n\n    private readonly onSecondaryClick = () => {\n        if (this.secondaryButtonDisabled) return;\n        this.dispatchEvent(new CustomEvent('ui-secondary-button-click', { bubbles: true, composed: true }));\n    };\n\n    protected get hasLabel() {\n        return !!this.label || this.slots.has('label');\n    }\n\n    protected get hasHeading() {\n        return !!this.heading || this.slots.has('title');\n    }\n\n    protected get hasDescription() {\n        return !!this.description || this.slots.has('description');\n    }\n\n    /** The zone's button is named by the title (else the label, else the body); the description describes it. */\n    private triggerName() {\n        if (this.hasHeading) return 'heading';\n        if (this.hasLabel) return 'label';\n        return 'body';\n    }\n\n    /** tabindex=\"0\" as Carbon's role=\"button\" zone: without it Safari neither focuses it on click nor stops on it with Tab. */\n    protected renderTrigger(zone: ProductCardZone | null, where: ProductCardZone) {\n        if (zone !== where) return nothing;\n        return html`<button\n            class=\"trigger\"\n            part=\"click-zone\"\n            type=\"button\"\n            tabindex=\"0\"\n            aria-labelledby=${this.triggerName()}\n            aria-describedby=${this.hasDescription ? 'description' : nothing}\n            aria-disabled=${this.disabled ? TRUE : nothing}\n            @click=${this.onZoneClick}\n        ></button>`;\n    }\n\n    /** The action icons, or the overflow menu instead of them (Carbon's menu is in a level-2 `Layer`). */\n    private renderIcons(layout: ProductCardLayout) {\n        if (layout.overflow) {\n            return html`<ui-layer level=\"2\" class=\"overflow-layer\">\n                <ui-overflow-menu part=\"overflow\" size=${layout.iconSize} placement=${layout.overflowPlacement} label=${this.overflowLabel()}>\n                    <slot name=\"overflow\"></slot>\n                </ui-overflow-menu>\n            </ui-layer>`;\n        }\n        if (!this.slots.has('actions')) return nothing;\n        return html`<slot name=\"actions\" @slotchange=${this.onActionsSlotChange}></slot>`;\n    }\n\n    protected overflowLabel() {\n        return this.localize.t.common.options;\n    }\n\n    private iconSlot(name: string) {\n        return this.slots.has(name) ? html`<slot name=${name} slot=\"suffix\"></slot>` : nothing;\n    }\n\n    /** Carbon `CardHeader`'s ghost sm buttons: secondary, then primary (which takes no href there). */\n    private renderHeaderActions(layout: ProductCardLayout) {\n        if (!layout.headerActions) return nothing;\n        const secondary = layout.headerSecondary\n            ? html`<span class=\"header-button\"\n                  ><ui-button part=\"secondary-button\" kind=\"ghost\" size=\"sm\" href=${this.secondaryButtonHref} ?disabled=${this.secondaryButtonDisabled} @click=${this.onSecondaryClick}\n                      >${this.secondaryButtonText}${this.iconSlot('secondary-button-icon')}</ui-button\n                  ></span\n              >`\n            : nothing;\n        const primary = layout.headerPrimary\n            ? html`<span class=\"header-button\"\n                  ><ui-button part=\"primary-button\" kind=\"ghost\" size=\"sm\" ?disabled=${this.primaryButtonDisabled} @click=${this.onPrimaryClick}\n                      >${this.primaryButtonText}${this.iconSlot('primary-button-icon')}</ui-button\n                  ></span\n              >`\n            : nothing;\n        return html`<div class=\"actions actions-header\" part=\"actions\">${this.renderIcons(layout)}${secondary}${primary}</div>`;\n    }\n\n    private renderTitle() {\n        if (!this.hasHeading) return nothing;\n        const tag = unsafeStatic(HEADINGS.has(this.headingLevel) ? this.headingLevel : 'h2');\n        return staticHtml`<${tag} class=\"title\" id=\"heading\" part=\"title\"><slot name=\"title\">${this.heading}</slot></${tag}>`;\n    }\n\n    protected renderHeader(layout: ProductCardLayout) {\n        const state = productCardHeader({ hasLabel: this.hasLabel, hasTitle: this.hasHeading, hasDescription: this.hasDescription, titleSize: this.titleSizeValue });\n        const decorator = this.slots.has('decorator');\n        const container = classMap({\n            'header-container': true,\n            'has-actions': layout.headerActions,\n            'has-decorator': decorator,\n            'large-or-label': state.largeOrLabel,\n        });\n        return html`<div class=${classMap({ header: true, 'label-only': state.labelOnly, 'has-label': state.hasLabel, 'title-lg': state.large })} part=\"header\">\n            <div class=${container}>\n                <div class=\"title-container\">\n                    ${state.hasLabel ? html`<p class=\"label\" id=\"label\" part=\"label\"><slot name=\"label\">${this.label}</slot></p>` : nothing}${this.renderTitle()}${this.hasDescription\n                        ? html`<p class=\"description\" id=\"description\" part=\"description\"><slot name=\"description\">${this.description}</slot></p>`\n                        : nothing}\n                </div>\n                ${this.renderHeaderActions(layout)}${decorator ? html`<div class=\"decorator\" part=\"decorator\"><slot name=\"decorator\"></slot></div>` : nothing}\n            </div>\n        </div>`;\n    }\n\n    /** Carbon `CardFooter`: secondary, primary (md), then the actions. */\n    protected renderFooter(layout: ProductCardLayout) {\n        if (!layout.footer) return nothing;\n        const secondary = layout.footerSecondary\n            ? html`<ui-button\n                  class=\"footer-button\"\n                  part=\"secondary-button\"\n                  kind=${layout.footerSecondaryKind}\n                  size=\"md\"\n                  href=${this.secondaryButtonHref}\n                  ?disabled=${this.secondaryButtonDisabled}\n                  @click=${this.onSecondaryClick}\n                  >${this.secondaryButtonText}${this.iconSlot('secondary-button-icon')}</ui-button\n              >`\n            : nothing;\n        const primary = layout.footerPrimary\n            ? html`<ui-button\n                  class=\"footer-button\"\n                  part=\"primary-button\"\n                  kind=${layout.footerPrimaryKind}\n                  size=\"md\"\n                  href=${this.primaryButtonHref}\n                  ?disabled=${this.primaryButtonDisabled}\n                  @click=${this.onPrimaryClick}\n                  >${this.primaryButtonText}${this.iconSlot('primary-button-icon')}</ui-button\n              >`\n            : nothing;\n        const actions = layout.footerActions ? html`<div class=\"actions\" part=\"actions\">${this.renderIcons(layout)}</div>` : nothing;\n        return html`<div class=${classMap({ footer: true, 'no-button': layout.footerNoButton })} part=\"footer\">${secondary}${primary}${actions}</div>`;\n    }\n\n    /** The header with the body (the click zone `two`) and the footer. */\n    protected renderContent(layout: ProductCardLayout): TemplateResult {\n        const zone = layout.zone;\n        return html`<div class=\"content\" part=\"content\">\n            <div class=${classMap({ 'header-body': true, zone: zone === 'header-body' })}>\n                ${this.renderTrigger(zone, 'header-body')}\n                <div class=\"header-wrapper\">\n                    ${this.renderHeader(layout)}\n                    <div class=${classMap({ body: true, zone: zone === 'body' })} id=\"body\" part=\"body\">${this.renderTrigger(zone, 'body')}<slot></slot></div>\n                </div>\n            </div>\n            ${this.renderFooter(layout)}\n        </div>`;\n    }\n}\n\nexport interface UiProductCardEventMap extends HTMLElementEventMap {\n    'ui-click': CustomEvent<null>;\n    'ui-primary-button-click': CustomEvent<null>;\n    'ui-secondary-button-click': CustomEvent<null>;\n}\n"
    },
    {
      "path": "src/primitives/product-card/product-card.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/product-card/product-card.ts",
      "content": "// One element per file in this folder; this module is the entry point (package export, React wrappers, index).\nexport * from './productive-card.ts';\nexport * from './expressive-card.ts';\nexport type { UiProductCardEventMap } from './product-card-shared.ts';\nexport type {\n    ProductCardClickZone,\n    ProductCardMediaPosition,\n    ProductCardPlacement,\n    ProductCardPrimaryKind,\n    ProductCardSecondaryKind,\n    ProductCardTitleSize,\n} from '../../core/product-card.ts';\n"
    },
    {
      "path": "src/primitives/product-card/productive-card.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/product-card/productive-card.ts",
      "content": "import { css, html, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { productCardEnum, type ProductCardPlacement, type ProductCardClickZone, type ProductCardTitleSize, type ProductCardPrimaryKind, type ProductCardSecondaryKind } from '../../core/product-card.ts';\nimport { ProductCardBase, cardStyles, BOTTOM, TRUE, type UiProductCardEventMap } from './product-card-shared.ts';\nimport '../button/button.ts';\nimport '../icon-button/icon-button.ts';\nimport '../overflow-menu/overflow-menu.ts';\nimport '../menu/menu.ts';\nimport '../layer/layer.ts';\n\nconst PLACEMENTS: readonly ProductCardPlacement[] = ['top', 'bottom'];\n\n/**\n * Carbon for IBM Products `ProductiveCard`: a `$layer` card for dense product UI — a heading-compact-02 title\n * (`title-size=\"large\"`: heading-03), its label and description, the body, and actions: icon buttons (`slot=\"actions\"`,\n * ghost; the card sizes them sm at the top, md at the bottom) or an overflow menu instead (`<ui-menu-item\n * slot=\"overflow\">`s), at the top (default) or the bottom (`actions-placement`). Primary and secondary buttons are\n * ghost buttons: at the bottom (md, in a footer under a `border-subtle-01` line) or, next to the top actions, at the\n * top (sm). It follows the `<ui-layer>` it sits on.\n * IBM Products' current, prop-driven (legacy-style) card: use it where a screen must match IBM product UIs; for new work\n * prefer `ui-card` (Carbon's parts-based card, the direction of both Carbon and IBM Products' unreleased Card next).\n *\n * `clickable` makes one zone a button (`ui-click`; Enter, Space or a click): `click-zone` one = the card, two = the\n * header with the body, three = the body. Its border turns `border-tile-01`, `layer-hover-01` under the pointer, the\n * focus ring on :focus. The zone's button lies under the card's own controls, which stay separate tab stops and never\n * fire `ui-click`; a link or button you put directly in the body sits above it too.\n *\n * State on the host for styling: `data-has-footer` while the footer shows, `data-overflow` while the overflow menu\n * replaces the action icons.\n *\n * @cssstate has-footer - While the footer shows (also `[data-has-footer]`)\n * @cssstate overflow - While the overflow menu replaces the action icons (also `[data-overflow]`)\n * @cssprop --ui-tile-border-color - Its 1px border, as the selectable tiles (default transparent; Kanok: a hairline)\n * @cssprop --ui-card-background - Its fill (default `--ui-surface-1`; Kanok paper: a cool grey that sets it apart from the page, no border)\n * @cssprop --ui-card-radius / --ui-card-overflow - Corners and clipping, as `<ui-card>` (default square, visible; Kanok: 12px, clipped)\n * @slot - The body (body-compact-01)\n * @slot label - Replaces `label`\n * @slot title - Replaces `heading`\n * @slot description - Replaces `description`\n * @slot actions - Icon buttons (`<ui-icon-button label=\"…\">`); the card sets their `size`\n * @slot overflow - `<ui-menu-item>`s of the overflow menu, shown instead of the action icons\n * @slot primary-button-icon - A 16px icon after the primary button's text (Carbon `primaryButtonIcon`)\n * @slot secondary-button-icon - A 16px icon after the secondary button's text\n * @slot decorator - E.g. an AI label, 16px from the top-end corner\n * @fires ui-click - The click zone was activated (a click, Enter or Space); not while `disabled`\n * @fires ui-primary-button-click - The primary button was activated\n * @fires ui-secondary-button-click - The secondary button was activated\n * @csspart base - The card\n * @csspart click-zone - The clickable zone's button (`clickable` only), covering the zone\n * @csspart content - The header, body and footer\n * @csspart header - The header\n * @csspart label - The label\n * @csspart title - The title (`<h2>` by default)\n * @csspart description - The description\n * @csspart actions - The action icons' (or overflow menu's) box, with the top buttons\n * @csspart overflow - The `<ui-overflow-menu>`\n * @csspart body - The body\n * @csspart footer - The footer\n * @csspart primary-button - The primary `<ui-button>`\n * @csspart secondary-button - The secondary `<ui-button>`\n * @csspart decorator - The decorator's box\n */\n@customElement('ui-productive-card')\nexport class UiProductiveCard extends ProductCardBase {\n    static override hostStates: readonly string[] = ['has-footer', 'overflow'];\n\n    static override readonly styles = [\n        cardStyles,\n        css`\n            /* _productive-card.scss */\n            .card {\n                display: flex;\n                flex-direction: column;\n            }\n\n            .title {\n                font: var(--ui-font-heading-compact-02);\n                letter-spacing: 0;\n            }\n\n            .title-lg .title {\n                font: var(--ui-font-heading-03);\n            }\n\n            .body {\n                padding-block-start: var(--ui-space-xs);\n            }\n\n            .footer {\n                align-items: center;\n                justify-content: space-between;\n                border-block-start: 1px solid var(--ui-row-divider);\n            }\n\n            .footer.no-button {\n                justify-content: flex-end;\n            }\n\n            .actions {\n                margin: 0;\n                min-block-size: var(--ui-space-xl);\n            }\n\n            .actions-header {\n                margin-block-start: calc(-1 * var(--ui-space-xxs));\n            }\n\n            .title-lg .actions-header,\n            .has-label .actions-header {\n                margin-block-start: 0;\n            }\n\n            /* .c4p--card__actions-header-ghost-button: 32px tall, 10px each side, a 24px layer-hover-01 rule before it */\n            .header-button {\n                position: relative;\n                display: inline-flex;\n            }\n\n            .header-button ui-button::part(base) {\n                min-block-size: var(--ui-space-xl);\n                padding-inline: calc(2px + var(--ui-space-xs));\n            }\n\n            .header-button::before {\n                content: '';\n                position: absolute;\n                z-index: 1;\n                inset-block-start: var(--ui-space-xxs);\n                inset-inline-start: 0;\n                block-size: var(--ui-space-lg);\n                inline-size: 0.05rem;\n                background-color: var(--ui-ghost-hover);\n                pointer-events: none;\n            }\n\n            .header-button:hover::before,\n            .header-button:hover + .header-button::before {\n                opacity: 0;\n            }\n\n            .header-button:first-child:not(:last-child)::before {\n                display: none;\n            }\n\n            .header-container {\n                align-items: flex-start;\n            }\n\n            .content {\n                display: flex;\n                flex: 1;\n                flex-direction: column;\n            }\n\n            .header-body {\n                flex: 1;\n            }\n        `,\n    ];\n\n    protected readonly productive = true;\n\n    /** Which zone `clickable` makes one button: one = the card, two = the header with the body, three = the body. */\n    @property({ reflect: true, attribute: 'click-zone' }) clickZone: ProductCardClickZone = 'one';\n\n    /** Where the action icons (or the overflow menu) go. */\n    @property({ reflect: true, attribute: 'actions-placement' }) actionsPlacement: ProductCardPlacement = 'top';\n\n    /** default: heading-compact-02; large: heading-03. */\n    @property({ reflect: true, attribute: 'title-size' }) titleSize: ProductCardTitleSize = 'default';\n\n    /** The overflow menu's name and tooltip (default: the translation's \"Options\", as Carbon's `iconDescription`). */\n    @property({ attribute: 'overflow-aria-label' }) overflowAriaLabel = '';\n\n    /** At the top the primary button joins the top actions (a ghost sm button, without `href`). */\n    @property({ reflect: true, attribute: 'primary-button-placement' }) primaryButtonPlacement: ProductCardPlacement = 'bottom';\n\n    /** At the top the secondary button joins the top actions, only when there are other top actions (as Carbon). */\n    @property({ reflect: true, attribute: 'secondary-button-placement' }) secondaryButtonPlacement: ProductCardPlacement = 'bottom';\n\n    protected get clickZoneValue() {\n        return productCardEnum<ProductCardClickZone>(this.clickZone, ['one', 'two', 'three'], 'one');\n    }\n\n    protected get actionsPlacementValue() {\n        return productCardEnum(this.actionsPlacement, PLACEMENTS, 'top');\n    }\n\n    protected get primaryPlacementValue() {\n        return productCardEnum(this.primaryButtonPlacement, PLACEMENTS, BOTTOM);\n    }\n\n    protected get secondaryPlacementValue() {\n        return productCardEnum(this.secondaryButtonPlacement, PLACEMENTS, BOTTOM);\n    }\n\n    protected get primaryKindValue(): ProductCardPrimaryKind {\n        return 'ghost';\n    }\n\n    protected get secondaryKindValue(): ProductCardSecondaryKind {\n        return 'ghost';\n    }\n\n    protected get titleSizeValue() {\n        return productCardEnum<ProductCardTitleSize>(this.titleSize, ['default', 'large'], 'default');\n    }\n\n    protected get hasOverflow() {\n        return this.slots.has('overflow');\n    }\n\n    protected override overflowLabel() {\n        return this.overflowAriaLabel || super.overflowLabel();\n    }\n\n    override render() {\n        const layout = this.layout();\n        return html`<div class=${classMap({ card: true, zone: layout.zone === 'card' })} part=\"base\" aria-disabled=${this.disabled ? TRUE : nothing}>\n            ${this.renderTrigger(layout.zone, 'card')}${this.renderContent(layout)}\n        </div>`;\n    }\n}\n\n/** Typed listeners for UiProductiveCard's events (declaration merging with the class). */\nexport interface UiProductiveCard {\n    addEventListener<K extends keyof UiProductCardEventMap>(type: K, listener: (this: UiProductiveCard, event: UiProductCardEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;\n    addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;\n    removeEventListener<K extends keyof UiProductCardEventMap>(type: K, listener: (this: UiProductiveCard, event: UiProductCardEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;\n    removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;\n}\n\ndeclare global {\n    interface HTMLElementTagNameMap {\n        'ui-productive-card': UiProductiveCard;\n    }\n}\n"
    }
  ]
}
