import {animateTo, prefersReducedMotion} from "../../internal/animate"; import {classMap} from "lit/directives/class-map.js"; import {type CSSResultGroup, unsafeCSS} from 'lit'; import {HasSlotController} from "../../internal/slot"; import {html, literal} from "lit/static-html.js"; import {ifDefined} from "lit/directives/if-defined.js"; import {lockBodyScrolling, unlockBodyScrolling} from "../../internal/scroll"; import {property, query, state} from 'lit/decorators.js'; import {styleMap} from "lit/directives/style-map.js"; import ZincElement from '../../internal/zinc-element'; import ZnIcon from "../icon"; import styles from './thumbnail.scss'; const PREVIEW_DURATION = 260; const PREVIEW_EASING = 'cubic-bezier(0.2, 0, 0.2, 1)'; /** * @summary A captioned image tile — a fixed aspect-ratio preview with a title beneath it, optional * corner badges and actions, and an optional full-screen preview that grows out of the thumbnail. * @documentation https://zinc.style/components/thumbnail * @status experimental * @since 1.0 * * @dependency zn-icon * * @event zn-select - Emitted when an enabled thumbnail is activated by click or keyboard. Cancelable — * call `preventDefault()` to stop the preview from opening and to stop a parent * `zn-thumbnail-group` from changing its selection. * @event zn-show - Emitted when the preview overlay starts opening. * @event zn-close - Emitted once the preview overlay has finished closing. * * @slot - Fallback content rendered in place of the media when no `src` is set. * @slot image - Replaces the built-in `` (e.g. a video, canvas or `zn-icon`). * @slot caption - Replaces the caption text. * @slot badge - Content pinned to the bottom-left of the media (e.g. a play indicator). Badges take * no pointer events and are held back on opacity, so they read as information about the asset * rather than as something to click. * @slot actions - Controls pinned to the bottom-right of the media (e.g. a download button). Each * slotted element becomes its own chip, so several actions read as separate icons on the thumbnail * rather than one grouped pill. This sits outside the thumbnail's link, so buttons and links here * behave normally and never select the thumbnail or follow its `href`. * @slot preview - Replaces the preview media (e.g. a `