{"mappings":"AAEA,cAAc,uBAAuB,sBAAiC;AAGtE,OAAO,iBAAkC;;;;;;;;;AAczC,cAwDM,gBAAgB,YAAY;CAChC,AACA;CAEA,AACA;CAEA,AACA;CAEA,AACA;CAEA,UAAU,UAAU,eAAe;CAuBnC,UAAU,QAAQ,mBAAmB;CAOrC,OAAO;CAIP;CAIA;;AAKF,eAAe;AACf,SAAS","names":[],"sources":["../../../../src/web-components/details/component.ts"],"sourcesContent":["import { attr, godown, htmlSlot, styles } from \"@godown/element\";\nimport svgCaretDown from \"../../internal/icons/caret-down.js\";\nimport { type PropertyValueMap, type TemplateResult, css, html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\n\nimport GlobalStyle, { scopePrefix } from \"../../internal/global-style.js\";\n\nconst protoName = \"details\";\n\nconst cssScope = scopePrefix(protoName);\n\n/**\n * {@linkcode Details} similar to `<details>`.\n *\n * @slot summary - Details summary (trigger).\n * @slot - Details content.\n * @fires change - Fires when the open changes.\n * @category display\n */\n@godown(protoName)\n@styles(css`\n  :host {\n    ${cssScope}--icon-deg-open: 0deg;\n    ${cssScope}--icon-deg-close: 90deg;\n    display: block;\n    transition: 0.3s;\n  }\n\n  [part=\"root\"] {\n    position: relative;\n  }\n\n  [part=\"title\"] {\n    direction: ltr;\n    height: 100%;\n    display: grid;\n    align-items: center;\n    justify-content: space-between;\n    grid-template-columns: auto auto;\n    transition: inherit;\n    overflow: hidden;\n  }\n\n  [part=\"details\"] {\n    overflow: hidden;\n    display: grid;\n    grid-template-rows: 0fr;\n    transition: inherit;\n  }\n\n  :host([open]) [part=\"details\"] {\n    grid-template-rows: 1fr;\n  }\n\n  [float] [part=\"details\"] {\n    position: absolute;\n    top: 100%;\n    width: 100%;\n  }\n\n  [part] {\n    transition: inherit;\n    transition-property: transform, grid-template-rows;\n  }\n\n  [part=\"icon\"] {\n    display: flex;\n    backface-visibility: hidden;\n    transform: rotate(var(${cssScope}--icon-deg-close));\n  }\n\n  :host([open]) [part=\"icon\"] {\n    transform: rotate(var(${cssScope}--icon-deg-open));\n  }\n`)\nclass Details extends GlobalStyle {\n  @property({ type: Boolean, reflect: true })\n  open = false;\n\n  @property({ type: Boolean })\n  float = false;\n\n  @property({ type: Boolean })\n  fill = false;\n\n  @property()\n  summary = \"\";\n\n  protected render(): TemplateResult<1> {\n    return html`\n      <dl\n        part=\"root\"\n        ${attr(this.observedRecord)}\n      >\n        <dt\n          part=\"title\"\n          @click=\"${() => this.toggle()}\"\n        >\n          <span part=\"summary\">${htmlSlot(\"summary\", this.summary)}</span>\n          <span part=\"icon\">${htmlSlot(\"icon\", svgCaretDown())}</span>\n        </dt>\n        <dd\n          part=\"details\"\n          @click=${this.fill ? () => this.toggle() : null}\n        >\n          <div style=\"min-height: 0;\">${htmlSlot()}</div>\n        </dd>\n      </dl>\n    `;\n  }\n\n  protected updated(changedProperties: PropertyValueMap<this>): void {\n    const open = changedProperties.get(\"open\");\n    if (open !== undefined) {\n      this.dispatchCustomEvent(\"change\", open);\n    }\n  }\n\n  toggle(to?: boolean): void {\n    this.open = to ?? !this.open;\n  }\n\n  close(): void {\n    this.open = false;\n  }\n\n  show(): void {\n    this.open = true;\n  }\n}\n\nexport default Details;\nexport { Details };\n"],"version":3,"file":"component.d.ts"}