@trendyol/baklava 2.1.1-beta.1 → 2.1.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/baklava.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as S}from"./chunk-2XHCYPYW.js";import{a as b}from"./chunk-TQBAGFBF.js";import{a as I}from"./chunk-BZJZ5L6E.js";import{a as P}from"./chunk-6FK4ZU5B.js";import{a as g}from"./chunk-TC7F23WR.js";import{a as w}from"./chunk-II3XNLPM.js";import{b as T,d as G}from"./chunk-GUUZ6VA7.js";import{b as D}from"./chunk-FSYC7NDP.js";import{a as B}from"./chunk-YV4QD44W.js";import{a as m}from"./chunk-V2JRNKNE.js";import{a as s}from"./chunk-WOA7OETR.js";import{a as x}from"./chunk-R7DGXZ46.js";import"./chunk-HGGOQO7A.js";import"./chunk-3B64VOWB.js";import{a as h}from"./chunk-BQULLIU3.js";import"./chunk-ANYJUR6Q.js";import{a as n}from"./chunk-6SBG3DCG.js";import{c,f as i}from"./chunk-PPLGBF5T.js";import{a as r}from"./chunk-UNA6X23I.js";import{a}from"./chunk-U5KSVPW3.js";import{b as f,e as p}from"./chunk-SOBFXTEO.js";import"./chunk-EPJ347EQ.js";import"./chunk-DJOD4BTL.js";import{a as d}from"./chunk-
|
|
1
|
+
import{b as S}from"./chunk-2XHCYPYW.js";import{a as b}from"./chunk-TQBAGFBF.js";import{a as I}from"./chunk-BZJZ5L6E.js";import{a as P}from"./chunk-6FK4ZU5B.js";import{a as g}from"./chunk-TC7F23WR.js";import{a as w}from"./chunk-II3XNLPM.js";import{b as T,d as G}from"./chunk-GUUZ6VA7.js";import{b as D}from"./chunk-FSYC7NDP.js";import{a as B}from"./chunk-YV4QD44W.js";import{a as m}from"./chunk-V2JRNKNE.js";import{a as s}from"./chunk-WOA7OETR.js";import{a as x}from"./chunk-R7DGXZ46.js";import"./chunk-HGGOQO7A.js";import"./chunk-3B64VOWB.js";import{a as h}from"./chunk-BQULLIU3.js";import"./chunk-ANYJUR6Q.js";import{a as n}from"./chunk-6SBG3DCG.js";import{c,f as i}from"./chunk-PPLGBF5T.js";import{a as r}from"./chunk-UNA6X23I.js";import{a}from"./chunk-U5KSVPW3.js";import{b as f,e as p}from"./chunk-SOBFXTEO.js";import"./chunk-EPJ347EQ.js";import"./chunk-DJOD4BTL.js";import{a as d}from"./chunk-HJTOJXMY.js";import{a as u}from"./chunk-U2M2YTSP.js";import{b as l}from"./chunk-I2NSXGH6.js";import"./chunk-OLPYXE2P.js";import"./chunk-KPAWUBRO.js";import{a as o,b as e,c as t}from"./chunk-3SON7X7S.js";import"./chunk-RLMJN536.js";import"./chunk-23UFIOHV.js";import"./chunk-57PTZNIL.js";import"./chunk-NZ3RGSR6.js";export{r as BlAlert,a as BlBadge,l as BlButton,f as BlCheckbox,p as BlCheckboxGroup,d as BlDialog,u as BlDrawer,G as BlDropdown,D as BlDropdownGroup,T as BlDropdownItem,t as BlIcon,x as BlInput,B as BlPagination,h as BlPopover,n as BlProgressIndicator,c as BlRadio,i as BlRadioGroup,m as BlSelect,s as BlSelectOption,S as BlSwitch,I as BlTab,b as BlTabGroup,P as BlTabPanel,g as BlTextarea,w as BlTooltip,e as getIconPath,o as setIconPath};
|
|
2
2
|
//# sourceMappingURL=baklava.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{a as c}from"./chunk-23UFIOHV.js";import{a as h,b as l,f as v,g,h as d,j as n}from"./chunk-57PTZNIL.js";import{a as o}from"./chunk-NZ3RGSR6.js";var b=h`:host{display:contents}.container{--background-color:var(--bl-color-neutral-full);display:flex;flex-direction:column;background:var(--background-color);max-width:calc(100vw - var(--bl-size-4xl));max-height:calc(100vh - var(--bl-size-4xl));min-width:424px;padding:0;border:0;border-radius:var(--bl-border-radius-l)}.dialog,.dialog-polyfill .container{padding:0;border:0;border-radius:var(--bl-border-radius-l)}.dialog-polyfill .container{position:fixed;z-index:var(--bl-index-dialog)}.dialog::backdrop{background-color:#273142b3}.dialog-polyfill{display:none;position:fixed;left:0;top:0;width:100vw;height:100vh;align-items:center;justify-content:center;z-index:var(--bl-index-dialog);background-color:#273142b3}:host([open]) .dialog-polyfill{display:flex}header{display:flex;justify-content:space-between;align-items:center;gap:var(--bl-size-2xs);padding:var(--bl-size-xl) var(--bl-size-xl) 0 var(--bl-size-xl)}header bl-button{margin-left:auto}header h2{font:var(--bl-font-title-1-medium);color:var(--bl-color-neutral-darker);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0;padding:0}.content{padding:var(--bl-size-xl) var(--bl-size-xl) var(--bl-size-m) var(--bl-size-xl);overflow:auto}footer{padding:var(--bl-size-xl);display:flex;flex-flow:row-reverse wrap;gap:var(--bl-size-m)}footer.shadow{/* FIXME: Use variables for sizes */box-shadow:0 -4px 15px #27314226}@media only screen and (max-width: 471px){.container{max-width:calc(100vw - var(--bl-size-2xl));max-height:calc(100vh - var(--bl-size-2xl));min-width:auto;min-height:auto}footer{flex-flow:column wrap}}`,m=b;var t=class extends v{constructor(){super(...arguments);this.open=!1;this.clickOutsideHandler=e=>{e.composedPath().includes(this.container)||this.closeDialog()};this.onKeydown=e=>{e.code==="Escape"&&this.open&&(e.preventDefault(),this.closeDialog())}}static get styles(){return[m]}updated(e){e.has("open")&&this.toggleDialogHandler()}get hasHtmlDialogSupport(){return!!window.HTMLDialogElement}get _hasFooter(){return[...this.childNodes].some(e=>e.nodeName==="BL-BUTTON")}toggleDialogHandler(){var e,a,i,r;this.open?((a=(e=this.dialog)==null?void 0:e.showModal)==null||a.call(e),this.onOpen({isOpen:!0}),document.body.style.overflow="hidden",this.toggleFooterShadow(),window==null||window.addEventListener("keydown",s=>this.onKeydown(s)),window==null||window.addEventListener("resize",()=>this.toggleFooterShadow())):((r=(i=this.dialog)==null?void 0:i.close)==null||r.call(i),this.onClose({isOpen:!1}),document.body.style.overflow="auto",window==null||window.removeEventListener("keydown",this.onKeydown),window==null||window.removeEventListener("resize",this.toggleFooterShadow))}closeDialog(){this.open=!1}toggleFooterShadow(){var e,a,i,r,s,p;((e=this.content)==null?void 0:e.scrollHeight)>((a=this.content)==null?void 0:a.offsetHeight)?(r=(i=this.footer)==null?void 0:i.classList)==null||r.add("shadow"):(p=(s=this.footer)==null?void 0:s.classList)==null||p.remove("shadow")}renderFooter(){return this._hasFooter?l`<footer>
|
|
2
|
+
<slot name="primary-action"></slot>
|
|
3
|
+
<slot name="secondary-action"></slot>
|
|
4
|
+
<slot name="tertiary-action"></slot>
|
|
5
|
+
</footer>`:""}renderContainer(){let e=this.caption?l`<h2 id="dialog-caption">${this.caption}</h2>`:"";return l` <div class="container">
|
|
6
|
+
<header>
|
|
7
|
+
${e}
|
|
8
|
+
<bl-button
|
|
9
|
+
@click="${this.closeDialog}"
|
|
10
|
+
icon="close"
|
|
11
|
+
variant="tertiary"
|
|
12
|
+
kind="neutral"
|
|
13
|
+
></bl-button>
|
|
14
|
+
</header>
|
|
15
|
+
<section class="content"><slot /></section>
|
|
16
|
+
${this.renderFooter()}
|
|
17
|
+
</div>`}render(){return this.hasHtmlDialogSupport?l`
|
|
18
|
+
<dialog
|
|
19
|
+
class="dialog"
|
|
20
|
+
aria-labelledby="dialog-caption"
|
|
21
|
+
@click=${this.clickOutsideHandler}
|
|
22
|
+
>
|
|
23
|
+
${this.renderContainer()}
|
|
24
|
+
</dialog>
|
|
25
|
+
`:l`<div
|
|
26
|
+
class="dialog-polyfill"
|
|
27
|
+
role="dialog"
|
|
28
|
+
aria-labelledby="dialog-caption"
|
|
29
|
+
@click=${this.clickOutsideHandler}
|
|
30
|
+
>
|
|
31
|
+
${this.renderContainer()}
|
|
32
|
+
</div>`}};o([d({type:Boolean,reflect:!0})],t.prototype,"open",2),o([d({type:String})],t.prototype,"caption",2),o([n(".dialog")],t.prototype,"dialog",2),o([n("footer")],t.prototype,"footer",2),o([n(".container")],t.prototype,"container",2),o([n(".content")],t.prototype,"content",2),o([c("bl-dialog-open")],t.prototype,"onOpen",2),o([c("bl-dialog-close")],t.prototype,"onClose",2),t=o([g("bl-dialog")],t);export{t as a};
|
|
33
|
+
//# sourceMappingURL=chunk-HJTOJXMY.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/components/dialog/bl-dialog.css", "../src/components/dialog/bl-dialog.ts"],
|
|
4
|
+
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`:host{display:contents}.container{--background-color:var(--bl-color-neutral-full);display:flex;flex-direction:column;background:var(--background-color);max-width:calc(100vw - var(--bl-size-4xl));max-height:calc(100vh - var(--bl-size-4xl));min-width:424px;padding:0;border:0;border-radius:var(--bl-border-radius-l)}.dialog,.dialog-polyfill .container{padding:0;border:0;border-radius:var(--bl-border-radius-l)}.dialog-polyfill .container{position:fixed;z-index:var(--bl-index-dialog)}.dialog::backdrop{background-color:#273142b3}.dialog-polyfill{display:none;position:fixed;left:0;top:0;width:100vw;height:100vh;align-items:center;justify-content:center;z-index:var(--bl-index-dialog);background-color:#273142b3}:host([open]) .dialog-polyfill{display:flex}header{display:flex;justify-content:space-between;align-items:center;gap:var(--bl-size-2xs);padding:var(--bl-size-xl) var(--bl-size-xl) 0 var(--bl-size-xl)}header bl-button{margin-left:auto}header h2{font:var(--bl-font-title-1-medium);color:var(--bl-color-neutral-darker);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0;padding:0}.content{padding:var(--bl-size-xl) var(--bl-size-xl) var(--bl-size-m) var(--bl-size-xl);overflow:auto}footer{padding:var(--bl-size-xl);display:flex;flex-flow:row-reverse wrap;gap:var(--bl-size-m)}footer.shadow{/* FIXME: Use variables for sizes */box-shadow:0 -4px 15px #27314226}@media only screen and (max-width: 471px){.container{max-width:calc(100vw - var(--bl-size-2xl));max-height:calc(100vh - var(--bl-size-2xl));min-width:auto;min-height:auto}footer{flex-flow:column wrap}}`;\nexport default styles;\n", "import { CSSResultGroup, html, LitElement, PropertyValues, TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { event, EventDispatcher } from '../../utilities/event';\nimport '../button/bl-button';\nimport style from './bl-dialog.css';\n\ntype DialogElement = {\n showModal: () => void;\n close: () => void;\n};\n\n/**\n * @tag bl-dialog\n * @summary Baklava Dialog component\n */\n@customElement('bl-dialog')\nexport default class BlDialog extends LitElement {\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n /**\n * Sets dialog open-close status\n */\n @property({ type: Boolean, reflect: true })\n open = false;\n\n /**\n * Sets the dialog title\n */\n @property({ type: String })\n caption?: string;\n\n @query('.dialog')\n private dialog: HTMLDialogElement & DialogElement;\n\n @query('footer')\n private footer: HTMLElement;\n\n @query('.container')\n private container: HTMLElement;\n\n @query('.content')\n private content: HTMLElement;\n\n /**\n * Fires when the dialog is opened\n */\n @event('bl-dialog-open') private onOpen: EventDispatcher<object>;\n\n /**\n * Fires when the dialog is closed\n */\n @event('bl-dialog-close') private onClose: EventDispatcher<object>;\n\n updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('open')) {\n this.toggleDialogHandler();\n }\n }\n\n private get hasHtmlDialogSupport() {\n return !!window.HTMLDialogElement;\n }\n\n private get _hasFooter() {\n return [...this.childNodes].some(node => node.nodeName === 'BL-BUTTON');\n }\n\n private toggleDialogHandler() {\n if (this.open) {\n this.dialog?.showModal?.();\n this.onOpen({ isOpen: true });\n document.body.style.overflow = 'hidden';\n this.toggleFooterShadow();\n window?.addEventListener('keydown', event => this.onKeydown(event));\n window?.addEventListener('resize', () => this.toggleFooterShadow());\n } else {\n this.dialog?.close?.();\n this.onClose({ isOpen: false });\n document.body.style.overflow = 'auto';\n window?.removeEventListener('keydown', this.onKeydown);\n window?.removeEventListener('resize', this.toggleFooterShadow);\n }\n }\n\n private closeDialog() {\n this.open = false;\n }\n\n private clickOutsideHandler = (event: MouseEvent) => {\n const eventPath = event.composedPath() as HTMLElement[];\n\n if (!eventPath.includes(this.container)) {\n this.closeDialog();\n }\n };\n\n private onKeydown = (event: KeyboardEvent): void => {\n if (event.code === 'Escape' && this.open) {\n event.preventDefault();\n this.closeDialog();\n }\n };\n\n private toggleFooterShadow() {\n if (this.content?.scrollHeight > this.content?.offsetHeight) {\n this.footer?.classList?.add('shadow');\n } else {\n this.footer?.classList?.remove('shadow');\n }\n }\n\n private renderFooter() {\n return this._hasFooter\n ? html`<footer>\n <slot name=\"primary-action\"></slot>\n <slot name=\"secondary-action\"></slot>\n <slot name=\"tertiary-action\"></slot>\n </footer>`\n : '';\n }\n\n private renderContainer() {\n const title = this.caption ? html`<h2 id=\"dialog-caption\">${this.caption}</h2>` : '';\n\n return html` <div class=\"container\">\n <header>\n ${title}\n <bl-button\n @click=\"${this.closeDialog}\"\n icon=\"close\"\n variant=\"tertiary\"\n kind=\"neutral\"\n ></bl-button>\n </header>\n <section class=\"content\"><slot /></section>\n ${this.renderFooter()}\n </div>`;\n }\n\n render(): TemplateResult {\n return this.hasHtmlDialogSupport\n ? html`\n <dialog\n class=\"dialog\"\n aria-labelledby=\"dialog-caption\"\n @click=${this.clickOutsideHandler}\n >\n ${this.renderContainer()}\n </dialog>\n `\n : html`<div\n class=\"dialog-polyfill\"\n role=\"dialog\"\n aria-labelledby=\"dialog-caption\"\n @click=${this.clickOutsideHandler}\n >\n ${this.renderContainer()}\n </div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'bl-dialog': BlDialog;\n }\n}\n"],
|
|
5
|
+
"mappings": "sJACO,IAAMA,EAASC,ojDACfC,EAAQF,ECcf,IAAqBG,EAArB,cAAsCC,CAAW,CAAjD,kCASE,UAAO,GAiEP,KAAQ,oBAAuBC,GAAsB,CACjCA,EAAM,aAAa,EAEtB,SAAS,KAAK,SAAS,GACpC,KAAK,YAAY,CAErB,EAEA,KAAQ,UAAaA,GAA+B,CAC9CA,EAAM,OAAS,UAAY,KAAK,OAClCA,EAAM,eAAe,EACrB,KAAK,YAAY,EAErB,EAtFA,WAAW,QAAyB,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AKA,EACN,CAEQ,iBAAkB,CACxB,IAAMC,EAAQ,KAAK,QAAUD,4BAA+B,KAAK,eAAiB,GAElF,OAAOA;AAAA;AAAA,UAEDC;AAAA;AAAA,oBAEU,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOjB,KAAK,aAAa;AAAA,WAExB,CAEA,QAAyB,CACvB,OAAO,KAAK,qBACRD;AAAA;AAAA;AAAA;AAAA,qBAIa,KAAK;AAAA;AAAA,cAEZ,KAAK,gBAAgB;AAAA;AAAA,UAG3BA;AAAA;AAAA;AAAA;AAAA,mBAIW,KAAK;AAAA;AAAA,YAEZ,KAAK,gBAAgB;AAAA,eAE/B,CACF,EAxIEE,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GARvBf,EASnB,oBAMAc,EAAA,CADCC,EAAS,CAAE,KAAM,MAAO,CAAC,GAdPf,EAenB,uBAGQc,EAAA,CADPE,EAAM,SAAS,GAjBGhB,EAkBX,sBAGAc,EAAA,CADPE,EAAM,QAAQ,GApBIhB,EAqBX,sBAGAc,EAAA,CADPE,EAAM,YAAY,GAvBAhB,EAwBX,yBAGAc,EAAA,CADPE,EAAM,UAAU,GA1BEhB,EA2BX,uBAKyBc,EAAA,CAAhCZ,EAAM,gBAAgB,GAhCJF,EAgCc,sBAKCc,EAAA,CAAjCZ,EAAM,iBAAiB,GArCLF,EAqCe,uBArCfA,EAArBc,EAAA,CADCC,EAAc,WAAW,GACLf",
|
|
6
|
+
"names": ["styles", "i", "bl_dialog_default", "BlDialog", "s", "event", "bl_dialog_default", "changedProperties", "node", "_a", "_b", "_c", "_d", "_e", "_f", "y", "title", "__decorateClass", "e", "i"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-HJTOJXMY.js";import"../../chunk-I2NSXGH6.js";import"../../chunk-OLPYXE2P.js";import"../../chunk-KPAWUBRO.js";import"../../chunk-3SON7X7S.js";import"../../chunk-RLMJN536.js";import"../../chunk-23UFIOHV.js";import"../../chunk-57PTZNIL.js";import"../../chunk-NZ3RGSR6.js";export{a as default};
|
|
2
2
|
//# sourceMappingURL=bl-dialog.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trendyol/baklava",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.1-beta.
|
|
4
|
+
"version": "2.1.1-beta.2",
|
|
5
5
|
"description": "Trendyol Baklava Design System",
|
|
6
6
|
"main": "dist/baklava.js",
|
|
7
7
|
"module": "dist/baklava.js",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"format": "npm-run-all -s format:*",
|
|
41
41
|
"format:code": "eslint --fix ./src && prettier --write ./src",
|
|
42
42
|
"fix": "npm run format && npm run lint",
|
|
43
|
-
"chromatic": "npx chromatic --only-changed --allow-console-errors",
|
|
44
43
|
"ci": "rm -rf node_modules && npm install --frozen-lockfile",
|
|
45
44
|
"clean": "npm-run-all -s clean:*",
|
|
46
45
|
"clean:dist": "rimraf dist",
|
package/dist/chunk-QCPUN6WO.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import{a as c}from"./chunk-23UFIOHV.js";import{a as h,b as l,f as v,g,h as d,j as n}from"./chunk-57PTZNIL.js";import{a as o}from"./chunk-NZ3RGSR6.js";var b=h`.container{--background-color:var(--bl-color-neutral-full);display:flex;flex-direction:column;background:var(--background-color);max-width:calc(100vw - var(--bl-size-4xl));max-height:calc(100vh - var(--bl-size-4xl));min-width:424px;padding:0;border:0;border-radius:var(--bl-border-radius-l)}.dialog,.dialog-polyfill .container{padding:0;border:0;border-radius:var(--bl-border-radius-l)}.dialog-polyfill .container{position:fixed;z-index:var(--bl-index-dialog)}.dialog::backdrop{background-color:#273142b3}.dialog-polyfill{display:none;position:fixed;left:0;top:0;width:100vw;height:100vh;align-items:center;justify-content:center;z-index:var(--bl-index-dialog);background-color:#273142b3}:host([open]) .dialog-polyfill{display:flex}header{display:flex;justify-content:space-between;align-items:center;gap:var(--bl-size-2xs);padding:var(--bl-size-xl) var(--bl-size-xl) 0 var(--bl-size-xl)}header bl-button{margin-left:auto}header h2{font:var(--bl-font-title-1-medium);color:var(--bl-color-neutral-darker);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0;padding:0}.content{padding:var(--bl-size-xl) var(--bl-size-xl) var(--bl-size-m) var(--bl-size-xl);overflow:auto}footer{padding:var(--bl-size-xl);display:flex;flex-flow:row-reverse wrap;gap:var(--bl-size-m)}footer.shadow{/* FIXME: Use variables for sizes */box-shadow:0 -4px 15px #27314226}@media only screen and (max-width: 471px){.container{max-width:calc(100vw - var(--bl-size-2xl));max-height:calc(100vh - var(--bl-size-2xl));min-width:auto;min-height:auto}footer{flex-flow:column wrap}}`,m=b;var t=class extends v{constructor(){super(...arguments);this.open=!1;this.clickOutsideHandler=e=>{e.composedPath().includes(this.container)||this.closeDialog()};this.onKeydown=e=>{e.code==="Escape"&&this.open&&(e.preventDefault(),this.closeDialog())}}static get styles(){return[m]}updated(e){e.has("open")&&this.toggleDialogHandler()}get hasHtmlDialogSupport(){return!!window.HTMLDialogElement}get _hasFooter(){return[...this.childNodes].some(e=>e.nodeName==="BL-BUTTON")}toggleDialogHandler(){var e,a,i,r;this.open?((a=(e=this.dialog)==null?void 0:e.showModal)==null||a.call(e),this.onOpen({isOpen:!0}),document.body.style.overflow="hidden",this.toggleFooterShadow(),window==null||window.addEventListener("keydown",s=>this.onKeydown(s)),window==null||window.addEventListener("resize",()=>this.toggleFooterShadow())):((r=(i=this.dialog)==null?void 0:i.close)==null||r.call(i),this.onClose({isOpen:!1}),document.body.style.overflow="auto",window==null||window.removeEventListener("keydown",this.onKeydown),window==null||window.removeEventListener("resize",this.toggleFooterShadow))}closeDialog(){this.open=!1}toggleFooterShadow(){var e,a,i,r,s,p;((e=this.content)==null?void 0:e.scrollHeight)>((a=this.content)==null?void 0:a.offsetHeight)?(r=(i=this.footer)==null?void 0:i.classList)==null||r.add("shadow"):(p=(s=this.footer)==null?void 0:s.classList)==null||p.remove("shadow")}renderFooter(){return this._hasFooter?l`<footer>
|
|
2
|
-
<slot name="primary-action"></slot>
|
|
3
|
-
<slot name="secondary-action"></slot>
|
|
4
|
-
<slot name="tertiary-action"></slot>
|
|
5
|
-
</footer>`:""}renderContainer(){let e=this.caption?l`<h2 id="dialog-caption">${this.caption}</h2>`:"";return l` <div class="container">
|
|
6
|
-
<header>
|
|
7
|
-
${e}
|
|
8
|
-
<bl-button
|
|
9
|
-
@click="${this.closeDialog}"
|
|
10
|
-
icon="close"
|
|
11
|
-
variant="tertiary"
|
|
12
|
-
kind="neutral"
|
|
13
|
-
></bl-button>
|
|
14
|
-
</header>
|
|
15
|
-
<section class="content"><slot /></section>
|
|
16
|
-
${this.renderFooter()}
|
|
17
|
-
</div>`}render(){return this.hasHtmlDialogSupport?l`
|
|
18
|
-
<dialog
|
|
19
|
-
class="dialog"
|
|
20
|
-
aria-labelledby="dialog-caption"
|
|
21
|
-
@click=${this.clickOutsideHandler}
|
|
22
|
-
>
|
|
23
|
-
${this.renderContainer()}
|
|
24
|
-
</dialog>
|
|
25
|
-
`:l`<div
|
|
26
|
-
class="dialog-polyfill"
|
|
27
|
-
role="dialog"
|
|
28
|
-
aria-labelledby="dialog-caption"
|
|
29
|
-
@click=${this.clickOutsideHandler}
|
|
30
|
-
>
|
|
31
|
-
${this.renderContainer()}
|
|
32
|
-
</div>`}};o([d({type:Boolean,reflect:!0})],t.prototype,"open",2),o([d({type:String})],t.prototype,"caption",2),o([n(".dialog")],t.prototype,"dialog",2),o([n("footer")],t.prototype,"footer",2),o([n(".container")],t.prototype,"container",2),o([n(".content")],t.prototype,"content",2),o([c("bl-dialog-open")],t.prototype,"onOpen",2),o([c("bl-dialog-close")],t.prototype,"onClose",2),t=o([g("bl-dialog")],t);export{t as a};
|
|
33
|
-
//# sourceMappingURL=chunk-QCPUN6WO.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/dialog/bl-dialog.css", "../src/components/dialog/bl-dialog.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`.container{--background-color:var(--bl-color-neutral-full);display:flex;flex-direction:column;background:var(--background-color);max-width:calc(100vw - var(--bl-size-4xl));max-height:calc(100vh - var(--bl-size-4xl));min-width:424px;padding:0;border:0;border-radius:var(--bl-border-radius-l)}.dialog,.dialog-polyfill .container{padding:0;border:0;border-radius:var(--bl-border-radius-l)}.dialog-polyfill .container{position:fixed;z-index:var(--bl-index-dialog)}.dialog::backdrop{background-color:#273142b3}.dialog-polyfill{display:none;position:fixed;left:0;top:0;width:100vw;height:100vh;align-items:center;justify-content:center;z-index:var(--bl-index-dialog);background-color:#273142b3}:host([open]) .dialog-polyfill{display:flex}header{display:flex;justify-content:space-between;align-items:center;gap:var(--bl-size-2xs);padding:var(--bl-size-xl) var(--bl-size-xl) 0 var(--bl-size-xl)}header bl-button{margin-left:auto}header h2{font:var(--bl-font-title-1-medium);color:var(--bl-color-neutral-darker);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0;padding:0}.content{padding:var(--bl-size-xl) var(--bl-size-xl) var(--bl-size-m) var(--bl-size-xl);overflow:auto}footer{padding:var(--bl-size-xl);display:flex;flex-flow:row-reverse wrap;gap:var(--bl-size-m)}footer.shadow{/* FIXME: Use variables for sizes */box-shadow:0 -4px 15px #27314226}@media only screen and (max-width: 471px){.container{max-width:calc(100vw - var(--bl-size-2xl));max-height:calc(100vh - var(--bl-size-2xl));min-width:auto;min-height:auto}footer{flex-flow:column wrap}}`;\nexport default styles;\n", "import { CSSResultGroup, html, LitElement, PropertyValues, TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { event, EventDispatcher } from '../../utilities/event';\nimport '../button/bl-button';\nimport style from './bl-dialog.css';\n\ntype DialogElement = {\n showModal: () => void;\n close: () => void;\n};\n\n/**\n * @tag bl-dialog\n * @summary Baklava Dialog component\n */\n@customElement('bl-dialog')\nexport default class BlDialog extends LitElement {\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n /**\n * Sets dialog open-close status\n */\n @property({ type: Boolean, reflect: true })\n open = false;\n\n /**\n * Sets the dialog title\n */\n @property({ type: String })\n caption?: string;\n\n @query('.dialog')\n private dialog: HTMLDialogElement & DialogElement;\n\n @query('footer')\n private footer: HTMLElement;\n\n @query('.container')\n private container: HTMLElement;\n\n @query('.content')\n private content: HTMLElement;\n\n /**\n * Fires when the dialog is opened\n */\n @event('bl-dialog-open') private onOpen: EventDispatcher<object>;\n\n /**\n * Fires when the dialog is closed\n */\n @event('bl-dialog-close') private onClose: EventDispatcher<object>;\n\n updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('open')) {\n this.toggleDialogHandler();\n }\n }\n\n private get hasHtmlDialogSupport() {\n return !!window.HTMLDialogElement;\n }\n\n private get _hasFooter() {\n return [...this.childNodes].some(node => node.nodeName === 'BL-BUTTON');\n }\n\n private toggleDialogHandler() {\n if (this.open) {\n this.dialog?.showModal?.();\n this.onOpen({ isOpen: true });\n document.body.style.overflow = 'hidden';\n this.toggleFooterShadow();\n window?.addEventListener('keydown', event => this.onKeydown(event));\n window?.addEventListener('resize', () => this.toggleFooterShadow());\n } else {\n this.dialog?.close?.();\n this.onClose({ isOpen: false });\n document.body.style.overflow = 'auto';\n window?.removeEventListener('keydown', this.onKeydown);\n window?.removeEventListener('resize', this.toggleFooterShadow);\n }\n }\n\n private closeDialog() {\n this.open = false;\n }\n\n private clickOutsideHandler = (event: MouseEvent) => {\n const eventPath = event.composedPath() as HTMLElement[];\n\n if (!eventPath.includes(this.container)) {\n this.closeDialog();\n }\n };\n\n private onKeydown = (event: KeyboardEvent): void => {\n if (event.code === 'Escape' && this.open) {\n event.preventDefault();\n this.closeDialog();\n }\n };\n\n private toggleFooterShadow() {\n if (this.content?.scrollHeight > this.content?.offsetHeight) {\n this.footer?.classList?.add('shadow');\n } else {\n this.footer?.classList?.remove('shadow');\n }\n }\n\n private renderFooter() {\n return this._hasFooter\n ? html`<footer>\n <slot name=\"primary-action\"></slot>\n <slot name=\"secondary-action\"></slot>\n <slot name=\"tertiary-action\"></slot>\n </footer>`\n : '';\n }\n\n private renderContainer() {\n const title = this.caption ? html`<h2 id=\"dialog-caption\">${this.caption}</h2>` : '';\n\n return html` <div class=\"container\">\n <header>\n ${title}\n <bl-button\n @click=\"${this.closeDialog}\"\n icon=\"close\"\n variant=\"tertiary\"\n kind=\"neutral\"\n ></bl-button>\n </header>\n <section class=\"content\"><slot /></section>\n ${this.renderFooter()}\n </div>`;\n }\n\n render(): TemplateResult {\n return this.hasHtmlDialogSupport\n ? html`\n <dialog\n class=\"dialog\"\n aria-labelledby=\"dialog-caption\"\n @click=${this.clickOutsideHandler}\n >\n ${this.renderContainer()}\n </dialog>\n `\n : html`<div\n class=\"dialog-polyfill\"\n role=\"dialog\"\n aria-labelledby=\"dialog-caption\"\n @click=${this.clickOutsideHandler}\n >\n ${this.renderContainer()}\n </div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'bl-dialog': BlDialog;\n }\n}\n"],
|
|
5
|
-
"mappings": "sJACO,IAAMA,EAASC,6hDACfC,EAAQF,ECcf,IAAqBG,EAArB,cAAsCC,CAAW,CAAjD,kCASE,UAAO,GAiEP,KAAQ,oBAAuBC,GAAsB,CACjCA,EAAM,aAAa,EAEtB,SAAS,KAAK,SAAS,GACpC,KAAK,YAAY,CAErB,EAEA,KAAQ,UAAaA,GAA+B,CAC9CA,EAAM,OAAS,UAAY,KAAK,OAClCA,EAAM,eAAe,EACrB,KAAK,YAAY,EAErB,EAtFA,WAAW,QAAyB,CAClC,MAAO,CAACC,CAAK,CACf,CAoCA,QAAQC,EAAyC,CAC3CA,EAAkB,IAAI,MAAM,GAC9B,KAAK,oBAAoB,CAE7B,CAE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C;AAAA;AAAA,oBAEU,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOjB,KAAK,aAAa;AAAA,WAExB,CAEA,QAAyB,CACvB,OAAO,KAAK,qBACRD;AAAA;AAAA;AAAA;AAAA,qBAIa,KAAK;AAAA;AAAA,cAEZ,KAAK,gBAAgB;AAAA;AAAA,UAG3BA;AAAA;AAAA;AAAA;AAAA,mBAIW,KAAK;AAAA;AAAA,YAEZ,KAAK,gBAAgB;AAAA,eAE/B,CACF,EAxIEE,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GARvBf,EASnB,oBAMAc,EAAA,CADCC,EAAS,CAAE,KAAM,MAAO,CAAC,GAdPf,EAenB,uBAGQc,EAAA,CADPE,EAAM,SAAS,GAjBGhB,EAkBX,sBAGAc,EAAA,CADPE,EAAM,QAAQ,GApBIhB,EAqBX,sBAGAc,EAAA,CADPE,EAAM,YAAY,GAvBAhB,EAwBX,yBAGAc,EAAA,CADPE,EAAM,UAAU,GA1BEhB,EA2BX,uBAKyBc,EAAA,CAAhCZ,EAAM,gBAAgB,GAhCJF,EAgCc,sBAKCc,EAAA,CAAjCZ,EAAM,iBAAiB,GArCLF,EAqCe,uBArCfA,EAArBc,EAAA,CADCC,EAAc,WAAW,GACLf",
|
|
6
|
-
"names": ["styles", "i", "bl_dialog_default", "BlDialog", "s", "event", "bl_dialog_default", "changedProperties", "node", "_a", "_b", "_c", "_d", "_e", "_f", "y", "title", "__decorateClass", "e", "i"]
|
|
7
|
-
}
|