UNPKG

@sandlada/mdc

Version:

@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.

218 lines (187 loc) 5.38 kB
import{css as e,unsafeCSS as t}from"../../../node_modules/@lit/reactive-element/css-tag.js";import"../../../node_modules/lit/index.js";import{defineVars as n}from"../../../node_modules/@sandlada/jss/dist/define-vars.js";import{defineTokenRefsRecord as r}from"../../../node_modules/@sandlada/jss/dist/define-token-refs.js";import{Color as i}from"../../../utils/tokens/theme.js";import{BasicDialogDefinition as a}from"../../../component-definitions/dialog.definition.js"; /** * @license * Copyright 2025 Kai-Orion & Sandlada * SPDX-License-Identifier: MIT */ const o=r(a,{expandShapes:!1,useBaseFallback:!0,prefix:`--mdc-basic-dialog`}),s=t(n(o,!0).join(``)),c=t(i.Scrim),l=e` @layer mdc.basic-dialog.variable { :host{${s};} } @layer mdc.basic-dialog.base { } :host { display: contents; } dialog { background: transparent; border: none; border-start-start-radius: var(--_container-shape-start-start); border-start-end-radius: var(--_container-shape-start-end); border-end-end-radius: var(--_container-shape-end-end); border-end-start-radius: var(--_container-shape-end-start); flex-direction: column; height: fit-content; margin: auto; max-height: min(560px, calc(100% - 48px)); max-width: min(560px, calc(100% - 48px)); min-height: 140px; min-width: 280px; outline: none; overflow: visible; padding: 0; width: fit-content; } dialog[open] { display: flex; } ::backdrop { background: none; } .scrim { background: ${c}; display: none; inset: 0; opacity: 32%; pointer-events: none; position: fixed; z-index: 1; } :host([open]) .scrim { display: flex; } h2 { all: unset; align-self: stretch; } .headline { align-items: center; color: var(--_enabled-headline-label-color); display: flex; flex-direction: column; font-family: var(--_headline-label-font); font-size: var(--_headline-label-size); line-height: var(--_headline-label-line-height); font-weight: var(--_headline-label-weight); position: relative; } slot[name='headline']::slotted(*) { align-items: center; align-self: stretch; box-sizing: border-box; display: flex; gap: 8px; padding: 24px 24px 0; } .icon { display: flex; } slot[name='icon']::slotted(*) { fill: currentColor; margin-top: 24px; color: var(--_enabled-icon-color); font-size: var(--_icon-size); height: var(--_icon-size); width: var(--_icon-size); } .has-icon slot[name='headline']::slotted(*) { justify-content: center; padding-top: 16px; } .scrollable slot[name='headline']::slotted(*) { padding-bottom: 16px; } .scrollable.has-headline slot[name='content']::slotted(*) { padding-top: 8px; } .container { border-radius: inherit; display: flex; flex-direction: column; flex-grow: 1; overflow: hidden; position: relative; transform-origin: top; } .container::before { background: var(--_enabled-container-color); border-radius: inherit; content: ''; inset: 0; position: absolute; } .scroller { display: flex; flex: 1; flex-direction: column; overflow: hidden; z-index: 1; } .scrollable .scroller { overflow-y: scroll; } .content { color: var(--_enabled-supporting-text-label-color); font-family: var(--_supporting-text-label-font); font-size: var(--_supporting-text-label-size); line-height: var(--_supporting-text-label-line-height); font-weight: var(--_supporting-text-label-weight); flex: 1; height: min-content; position: relative; } slot[name='content']::slotted(*) { display: block; box-sizing: border-box; padding: 16px 24px 24px; } .anchor { position: absolute; } .top.anchor { top: 0; } .bottom.anchor { bottom: 0; } .actions { position: relative; box-sizing: border-box; display: flex; gap: 8px; padding: 16px 24px 24px; justify-content: flex-end; } slot[name='actions']::slotted(*) { box-sizing: border-box; } .has-actions slot[name='content']::slotted(*) { padding-bottom: 8px; } mdc-divider { display: none; position: absolute; } .has-headline.show-top-divider .headline mdc-divider, .has-actions.show-bottom-divider .actions mdc-divider { display: flex; } .headline mdc-divider { bottom: 0; } .actions mdc-divider { top: 0; } .first-focus-trap, .last-focus-trap { position: absolute; width: 0; height: 0; overflow: hidden; } @media (forced-colors: active) { dialog { outline: 2px solid WindowText; } } } `;export{l as basicDialogStyle}; //# sourceMappingURL=dialog.style.js.map