@trendyol/baklava 2.1.0-beta.6 → 2.1.0-beta.8
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 +1 -1
- package/dist/chunk-2XHCYPYW.js +16 -0
- package/dist/chunk-2XHCYPYW.js.map +7 -0
- package/dist/{chunk-RFAEPGC3.js → chunk-6SBG3DCG.js} +2 -2
- package/dist/chunk-6SBG3DCG.js.map +7 -0
- package/dist/chunk-BQULLIU3.js +5 -0
- package/dist/chunk-BQULLIU3.js.map +7 -0
- package/dist/chunk-BZJZ5L6E.js +31 -0
- package/dist/chunk-BZJZ5L6E.js.map +7 -0
- package/dist/chunk-I2NSXGH6.js +21 -0
- package/dist/chunk-I2NSXGH6.js.map +7 -0
- package/dist/chunk-II3XNLPM.js +20 -0
- package/dist/chunk-II3XNLPM.js.map +7 -0
- package/dist/chunk-KYRGH4OP.js +52 -0
- package/dist/chunk-KYRGH4OP.js.map +7 -0
- package/dist/chunk-PPLGBF5T.js +17 -0
- package/dist/chunk-PPLGBF5T.js.map +7 -0
- package/dist/{chunk-DIHN2344.js → chunk-QCPUN6WO.js} +2 -2
- package/dist/chunk-QCPUN6WO.js.map +7 -0
- package/dist/chunk-SOBFXTEO.js +24 -0
- package/dist/chunk-SOBFXTEO.js.map +7 -0
- package/dist/chunk-U2M2YTSP.js +26 -0
- package/dist/chunk-U2M2YTSP.js.map +7 -0
- package/dist/chunk-U5KSVPW3.js +5 -0
- package/dist/chunk-U5KSVPW3.js.map +7 -0
- package/dist/{chunk-6UPKDZRW.js → chunk-UNA6X23I.js} +2 -2
- package/dist/chunk-UNA6X23I.js.map +7 -0
- package/dist/chunk-V2JRNKNE.js +42 -0
- package/dist/chunk-V2JRNKNE.js.map +7 -0
- package/dist/chunk-WOA7OETR.js +18 -0
- package/dist/chunk-WOA7OETR.js.map +7 -0
- package/dist/chunk-XO2TAHMZ.js +37 -0
- package/dist/chunk-XO2TAHMZ.js.map +7 -0
- package/dist/{chunk-Y4UXIJSO.js → chunk-YV4QD44W.js} +2 -2
- package/dist/chunk-YV4QD44W.js.map +7 -0
- package/dist/components/alert/bl-alert.js +1 -1
- package/dist/components/badge/bl-badge.js +1 -1
- package/dist/components/button/bl-button.js +1 -1
- package/dist/components/checkbox-group/bl-checkbox-group.js +1 -1
- package/dist/components/checkbox-group/checkbox/bl-checkbox.js +1 -1
- package/dist/components/dialog/bl-dialog.js +1 -1
- package/dist/components/drawer/bl-drawer.js +1 -1
- package/dist/components/dropdown/bl-dropdown.js +1 -1
- package/dist/components/dropdown/item/bl-dropdown-item.js +1 -1
- package/dist/components/input/bl-input.js +1 -1
- package/dist/components/pagination/bl-pagination.js +1 -1
- package/dist/components/popover/bl-popover.d.ts +2 -0
- package/dist/components/popover/bl-popover.d.ts.map +1 -1
- package/dist/components/popover/bl-popover.js +1 -1
- package/dist/components/progress-indicator/bl-progress-indicator.js +1 -1
- package/dist/components/radio-group/bl-radio-group.js +1 -1
- package/dist/components/radio-group/radio/bl-radio.js +1 -1
- package/dist/components/select/bl-select.js +1 -1
- package/dist/components/select/option/bl-select-option.js +1 -1
- package/dist/components/switch/bl-switch.js +1 -1
- package/dist/components/tab-group/bl-tab-group.js +1 -1
- package/dist/components/tab-group/tab/bl-tab.js +1 -1
- package/dist/components/textarea/bl-textarea.js +1 -1
- package/dist/components/tooltip/bl-tooltip.d.ts +5 -9
- package/dist/components/tooltip/bl-tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/bl-tooltip.js +1 -1
- package/dist/custom-elements.json +10 -0
- package/package.json +4 -2
- package/dist/chunk-32HGEMZF.js +0 -15
- package/dist/chunk-32HGEMZF.js.map +0 -7
- package/dist/chunk-5AIFOXPM.js +0 -24
- package/dist/chunk-5AIFOXPM.js.map +0 -7
- package/dist/chunk-5JHQZCHW.js +0 -5
- package/dist/chunk-5JHQZCHW.js.map +0 -7
- package/dist/chunk-6UPKDZRW.js.map +0 -7
- package/dist/chunk-AWKMRQTR.js +0 -5
- package/dist/chunk-AWKMRQTR.js.map +0 -7
- package/dist/chunk-AZ42S4YP.js +0 -26
- package/dist/chunk-AZ42S4YP.js.map +0 -7
- package/dist/chunk-DIHN2344.js.map +0 -7
- package/dist/chunk-KGIPG6EV.js +0 -21
- package/dist/chunk-KGIPG6EV.js.map +0 -7
- package/dist/chunk-LV2MAELO.js +0 -42
- package/dist/chunk-LV2MAELO.js.map +0 -7
- package/dist/chunk-PUNHEAEI.js +0 -46
- package/dist/chunk-PUNHEAEI.js.map +0 -7
- package/dist/chunk-RFAEPGC3.js.map +0 -7
- package/dist/chunk-VDV6ZXM7.js +0 -14
- package/dist/chunk-VDV6ZXM7.js.map +0 -7
- package/dist/chunk-VXGOQPWU.js +0 -17
- package/dist/chunk-VXGOQPWU.js.map +0 -7
- package/dist/chunk-Y4UXIJSO.js.map +0 -7
- package/dist/chunk-YMS5JP47.js +0 -37
- package/dist/chunk-YMS5JP47.js.map +0 -7
- package/dist/chunk-YTUAZIEF.js +0 -31
- package/dist/chunk-YTUAZIEF.js.map +0 -7
- package/dist/chunk-Z7HGXEOH.js +0 -18
- package/dist/chunk-Z7HGXEOH.js.map +0 -7
package/dist/chunk-AZ42S4YP.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-23UFIOHV.js";import{a as o,b as i,f as s,g as l,h as n,i as d}from"./chunk-57PTZNIL.js";import{a as t}from"./chunk-NZ3RGSR6.js";var h=o`.drawer{box-sizing:border-box;position:fixed;display:flex;top:0;right:-100%;bottom:0;width:424px;padding:var(--bl-size-xl);padding-top:max(env(safe-area-inset-top),var(--bl-size-xl));padding-right:max(env(safe-area-inset-right),var(--bl-size-xl));padding-bottom:max(env(safe-area-inset-bottom),var(--bl-size-xl));background:var(--bl-color-neutral-full);box-shadow:var(--bl-size-xs) 0 var(--bl-size-2xl) rgba(0 0 0 / 50%);transition:right var(--bl-drawer-animation-duration,0.25s);z-index:var(--bl-index-sticky)}:host([open]) .drawer{right:0}iframe{height:100%;width:100%;border:0}.container{display:flex;flex-direction:column;gap:var(--bl-size-xl);flex:1;width:100%}header{display:flex;justify-content:space-between;align-items:baseline;gap:var(--bl-size-2xs);background-color:white}header .header-buttons{display:flex;gap:var(--bl-size-xl);margin-left:auto}header h2{font:var(--bl-font-title-1-medium);color:var(--bl-color-neutral-darker);overflow:hidden;margin:0;padding:0}.content{flex:1;overflow-y:scroll}.iframe-content{flex:1}@media only screen and (max-width:424px){:host([open]) .drawer{width:calc(100vw - 24px)}}`,c=h;var e=class extends s{constructor(){super(...arguments);this.open=!1;this.domExistence=!1}static get styles(){return[c]}connectedCallback(){super.connectedCallback(),window==null||window.addEventListener("bl-drawer-open",r=>{r.target!==this&&this.closeDrawer()})}updated(r){r.has("open")&&this.toggleDialogHandler()}toggleDialogHandler(){this.open?(this.domExistenceSchedule&&clearTimeout(this.domExistenceSchedule),this.domExistence=!0,this.onOpen("")):(this.domExistenceSchedule=window.setTimeout(()=>{this.domExistence=!1},1e3),this.onClose(""))}closeDrawer(){this.open=!1}renderContent(){let r=this.embedUrl?i`<iframe src=${this.embedUrl}></iframe>`:i`<slot></slot>`;return i`<section class=${this.embedUrl?"iframe-content":"content"}>
|
|
2
|
-
${r}
|
|
3
|
-
</section>`}renderContainer(){let r=this.caption?i`<h2 id="drawer-caption">${this.caption}</h2>`:"",p=this.externalLink?i`<bl-button
|
|
4
|
-
icon="external_link"
|
|
5
|
-
variant="tertiary"
|
|
6
|
-
kind="neutral"
|
|
7
|
-
size="small"
|
|
8
|
-
href="${this.externalLink}"
|
|
9
|
-
target="_blank"
|
|
10
|
-
></bl-button>`:"";return i`<div class="container">
|
|
11
|
-
<header>
|
|
12
|
-
${r}
|
|
13
|
-
<div class="header-buttons">
|
|
14
|
-
${p}
|
|
15
|
-
<bl-button
|
|
16
|
-
@click="${this.closeDrawer}"
|
|
17
|
-
icon="close"
|
|
18
|
-
size="small"
|
|
19
|
-
variant="tertiary"
|
|
20
|
-
kind="neutral"
|
|
21
|
-
></bl-button>
|
|
22
|
-
</div>
|
|
23
|
-
</header>
|
|
24
|
-
${this.renderContent()}
|
|
25
|
-
</div>`}render(){return this.domExistence?i`<div class="drawer">${this.renderContainer()}</div>`:i``}};t([n({type:Boolean,reflect:!0})],e.prototype,"open",2),t([n({type:String})],e.prototype,"caption",2),t([n({type:String,attribute:"embed-url"})],e.prototype,"embedUrl",2),t([n({type:String,attribute:"external-link"})],e.prototype,"externalLink",2),t([a("bl-drawer-open")],e.prototype,"onOpen",2),t([a("bl-drawer-close")],e.prototype,"onClose",2),t([d()],e.prototype,"domExistence",2),e=t([l("bl-drawer")],e);export{e as a};
|
|
26
|
-
//# sourceMappingURL=chunk-AZ42S4YP.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/drawer/bl-drawer.css", "../src/components/drawer/bl-drawer.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`.drawer{box-sizing:border-box;position:fixed;display:flex;top:0;right:-100%;bottom:0;width:424px;padding:var(--bl-size-xl);padding-top:max(env(safe-area-inset-top),var(--bl-size-xl));padding-right:max(env(safe-area-inset-right),var(--bl-size-xl));padding-bottom:max(env(safe-area-inset-bottom),var(--bl-size-xl));background:var(--bl-color-neutral-full);box-shadow:var(--bl-size-xs) 0 var(--bl-size-2xl) rgba(0 0 0 / 50%);transition:right var(--bl-drawer-animation-duration,0.25s);z-index:var(--bl-index-sticky)}:host([open]) .drawer{right:0}iframe{height:100%;width:100%;border:0}.container{display:flex;flex-direction:column;gap:var(--bl-size-xl);flex:1;width:100%}header{display:flex;justify-content:space-between;align-items:baseline;gap:var(--bl-size-2xs);background-color:white}header .header-buttons{display:flex;gap:var(--bl-size-xl);margin-left:auto}header h2{font:var(--bl-font-title-1-medium);color:var(--bl-color-neutral-darker);overflow:hidden;margin:0;padding:0}.content{flex:1;overflow-y:scroll}.iframe-content{flex:1}@media only screen and (max-width:424px){:host([open]) .drawer{width:calc(100vw - 24px)}}`;\nexport default styles;\n", "import { customElement, property, state } from 'lit/decorators.js';\nimport { CSSResultGroup, html, LitElement, TemplateResult } from 'lit';\nimport { event, EventDispatcher } from '../../utilities/event';\nimport '../button/bl-button';\nimport style from './bl-drawer.css';\nimport { PropertyValues } from 'lit';\n\n/**\n * @tag bl-drawer\n * @summary Baklava Drawer component\n *\n * @cssproperty [--bl-drawer-animation-duration=250ms] Drawer slide in animation duration\n */\n\n@customElement('bl-drawer')\nexport default class BlDrawer extends LitElement {\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n /**\n * Sets drawer open-close status\n */\n @property({ type: Boolean, reflect: true })\n open = false;\n\n /**\n * Sets the drawer title\n */\n @property({ type: String })\n caption?: string;\n\n /**\n * Sets the drawer embed url for iframe\n */\n @property({ type: String, attribute: 'embed-url' })\n embedUrl?: string;\n\n /**\n * Sets the drawer external link\n */\n @property({ type: String, attribute: 'external-link' })\n externalLink?: string;\n\n /**\n * Fires when the drawer is opened\n */\n @event('bl-drawer-open') private onOpen: EventDispatcher<string>;\n\n /**\n * Fires when the drawer is closed\n */\n @event('bl-drawer-close') private onClose: EventDispatcher<string>;\n\n connectedCallback() {\n super.connectedCallback();\n window?.addEventListener('bl-drawer-open', event => {\n if (event.target !== this) this.closeDrawer();\n });\n }\n\n updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('open')) {\n this.toggleDialogHandler();\n }\n }\n\n private domExistenceSchedule: number;\n\n private toggleDialogHandler() {\n if (this.open) {\n if (this.domExistenceSchedule) {\n clearTimeout(this.domExistenceSchedule);\n }\n\n this.domExistence = true;\n // FIXME: Allow events without payload\n this.onOpen('');\n } else {\n // Give some time for exit animation\n this.domExistenceSchedule = window.setTimeout(() => {\n this.domExistence = false;\n }, 1000);\n\n // FIXME: Allow events without payload\n this.onClose('');\n }\n }\n\n @state() private domExistence = false;\n\n private closeDrawer() {\n this.open = false;\n }\n\n private renderContent() {\n const content = this.embedUrl\n ? html`<iframe src=${this.embedUrl}></iframe>`\n : html`<slot></slot>`;\n\n return html`<section class=${this.embedUrl ? 'iframe-content' : 'content'}>\n ${content}\n </section>`;\n }\n\n private renderContainer() {\n const title = this.caption ? html`<h2 id=\"drawer-caption\">${this.caption}</h2>` : '';\n const external_button = this.externalLink\n ? html`<bl-button\n icon=\"external_link\"\n variant=\"tertiary\"\n kind=\"neutral\"\n size=\"small\"\n href=\"${this.externalLink}\"\n target=\"_blank\"\n ></bl-button>`\n : '';\n\n return html`<div class=\"container\">\n <header>\n ${title}\n <div class=\"header-buttons\">\n ${external_button}\n <bl-button\n @click=\"${this.closeDrawer}\"\n icon=\"close\"\n size=\"small\"\n variant=\"tertiary\"\n kind=\"neutral\"\n ></bl-button>\n </div>\n </header>\n ${this.renderContent()}\n </div>`;\n }\n\n render(): TemplateResult {\n if (this.domExistence) {\n return html`<div class=\"drawer\">${this.renderContainer()}</div>`;\n } else {\n return html``;\n }\n }\n}\ndeclare global {\n interface HTMLElementTagNameMap {\n 'bl-drawer': BlDrawer;\n }\n}\n"],
|
|
5
|
-
"mappings": "sJACO,IAAMA,EAASC,qmCACfC,EAAQF,ECaf,IAAqBG,EAArB,cAAsC,CAAW,CAAjD,kCASE,UAAO,GAiEE,KAAQ,aAAe,GAzEhC,WAAW,QAAyB,CAClC,MAAO,CAACC,CAAK,CACf,CAoCA,mBAAoB,CAClB,MAAM,kBAAkB,EACxB,qBAAQ,iBAAiB,iBAAkBC,GAAS,CAC9CA,EAAM,SAAW,MAAM,KAAK,YAAY,CAC9C,EACF,CAEA,QAAQC,EAAyC,CAC3CA,EAAkB,IAAI,MAAM,GAC9B,KAAK,oBAAoB,CAE7B,CAIQ,qBAAsB,CACxB,KAAK,MACH,KAAK,sBACP,aAAa,KAAK,oBAAoB,EAGxC,KAAK,aAAe,GAEpB,KAAK,OAAO,EAAE,IAGd,KAAK,qBAAuB,OAAO,WAAW,IAAM,CAClD,KAAK,aAAe,EACtB,EAAG,GAAI,EAGP,KAAK,QAAQ,EAAE,EAEnB,CAIQ,aAAc,CACpB,KAAK,KAAO,EACd,CAEQ,eAAgB,CACtB,IAAMC,EAAU,KAAK,SACjBC,gBAAmB,KAAK,qBACxBA,iBAEJ,OAAOA,mBAAsB,KAAK,SAAW,iBAAmB;AAAA,QAC5DD;AAAA,eAEN,CAEQ,iBAAkB,CACxB,IAAME,EAAQ,KAAK,QAAUD,4BAA+B,KAAK,eAAiB,GAC5EE,EAAkB,KAAK,aACzBF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKU,KAAK;AAAA;AAAA,uBAGf,GAEJ,OAAOA;AAAA;AAAA,UAEDC;AAAA;AAAA,YAEEC;AAAA;AAAA,sBAEU,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAQnB,KAAK,cAAc;AAAA,WAEzB,CAEA,QAAyB,CACvB,OAAI,KAAK,aACAF,wBAA2B,KAAK,gBAAgB,UAEhDA,GAEX,CACF,EAvHEG,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GARvBT,EASnB,oBAMAQ,EAAA,CADCC,EAAS,CAAE,KAAM,MAAO,CAAC,GAdPT,EAenB,uBAMAQ,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,UAAW,WAAY,CAAC,GApB/BT,EAqBnB,wBAMAQ,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,UAAW,eAAgB,CAAC,GA1BnCT,EA2BnB,4BAKiCQ,EAAA,CAAhCN,EAAM,gBAAgB,GAhCJF,EAgCc,sBAKCQ,EAAA,CAAjCN,EAAM,iBAAiB,GArCLF,EAqCe,uBAqCjBQ,EAAA,CAAhBE,EAAM,GA1EYV,EA0EF,4BA1EEA,EAArBQ,EAAA,CADCC,EAAc,WAAW,GACLT",
|
|
6
|
-
"names": ["styles", "i", "bl_drawer_default", "BlDrawer", "bl_drawer_default", "event", "changedProperties", "content", "y", "title", "external_button", "__decorateClass", "e", "t"]
|
|
7
|
-
}
|
|
@@ -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{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,w/CACfC,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,CAEA,IAAY,sBAAuB,CACjC,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AAK;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
|
-
}
|
package/dist/chunk-KGIPG6EV.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{a as _}from"./chunk-OLPYXE2P.js";import{a as i}from"./chunk-KPAWUBRO.js";import{a as y}from"./chunk-23UFIOHV.js";import{a as p,b as r,f as v,g as m,h as e,i as g,j as f}from"./chunk-57PTZNIL.js";import{a as o}from"./chunk-NZ3RGSR6.js";var x=n=>{if(!(!n.noValidate&&!n.reportValidity())){let d=new SubmitEvent("submit",{bubbles:!0,cancelable:!0});n.dispatchEvent(d),d.defaultPrevented||n.submit()}};var T=p`@keyframes spin{from{transform:rotate(0)}to{transform:rotate(359deg)}}:host{display:var(--bl-button-display,inline-block);max-width:100%;position:relative}.button{--main-color:var(--bl-color-primary);--main-hover-color:var(--bl-color-primary-highlight);--text-hover-color:var(--bl-color-neutral-lightest);--content-color:var(--bl-color-neutral-full);--bg-color:var(--main-color);--border-color:var(--main-color);--padding-vertical:var(--bl-size-2xs);--padding-horizontal:var(--bl-size-m);--margin-icon:var(--padding-vertical);--icon-size:var(--bl-size-m);--font:var(--bl-font-title-3-medium);--height:var(--bl-size-2xl);display:flex;gap:var(--margin-icon);justify-content:var(--bl-button-justify,center);align-items:center;box-sizing:border-box;width:100%;height:var(--height);border:solid 1px var(--border-color);border-radius:var(--bl-border-radius-m);text-decoration:none;padding:var(--padding-vertical) var(--padding-horizontal);cursor:pointer;background-color:var(--bg-color);color:var(--content-color);font:var(--font);font-kerning:none;user-select:none}:host(:hover) .button,:host(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button{--bg-color:var(--main-hover-color);--border-color:var(--main-hover-color)}.label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host([size='small']) .button{--font:var(--bl-font-title-4-medium);--padding-vertical:var(--bl-size-3xs);--padding-horizontal:var(--bl-size-2xs);--icon-size:var(--bl-size-s);--height:var(--bl-size-xl)}:host([size='large']) .button{--font:var(--bl-font-title-3-medium);--padding-vertical:var(--bl-size-xs);--padding-horizontal:var(--bl-size-xl);--margin-icon:var(--bl-size-2xs);--height:var(--bl-size-3xl)}.button:focus{outline:0}.button:focus-visible{position:relative;outline:0}.button:focus-visible::after{border:2px solid var(--main-color);border-radius:var(--bl-border-radius-l);content:'';position:absolute;inset:-4px}.loading-icon{animation:spin 1s linear infinite;font-size:var(--icon-size)}:host ::slotted(bl-icon){font-size:var(--icon-size)}:host([loading]) ::slotted(bl-icon){display:none}:host .has-icon:not(.has-content){--padding-horizontal:var(--padding-vertical);--margin-icon:0}:host([variant='secondary']) .button{--bg-color:transparent;--content-color:var(--main-color)}:host([variant='tertiary']) .button{--content-color:var(--main-color);--border-color:transparent;--bg-color:transparent}:host([kind='neutral']) .button{--main-color:var(--bl-color-neutral-darker);--main-hover-color:var(--bl-color-neutral-darkest)}:host([kind='success']) .button{--main-color:var(--bl-color-success);--main-hover-color:var(--bl-color-success-highlight)}:host([kind='danger']) .button{--main-color:var(--bl-color-danger);--main-hover-color:var(--bl-color-danger-highlight)}:host([disabled]){cursor:not-allowed}:host([loading]){cursor:wait}:host([loading]) bl-icon:not(.loading-icon){display:none}:host .button[aria-disabled='true']{--main-color:var(--bl-color-neutral-lightest);--main-hover-color:var(--bl-color-neutral-lightest);--content-color:var(--bl-color-neutral-lighter);--bg-color:var(--main-color);pointer-events:none;text-decoration:none}:host([variant='tertiary']) .button[aria-disabled='true']{--main-color:transparent}:host([variant='secondary']:hover) .button[aria-disabled='false'],:host([variant='secondary'].__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button[aria-disabled='false']{--content-color:var(--bl-color-neutral-full);--bg-color:var(--main-hover-color)}:host([variant='tertiary']:hover) .button[aria-disabled='false'],:host([variant='tertiary'].__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button[aria-disabled='false']{--content-color:var(--main-hover-color);--bg-color:var(--text-hover-color)}:host([dropdown]) .open{display:none}:host([dropdown]) .active .open{display:inline-block}:host([dropdown]) .active .close{display:none}:host .active.button{--bg-color:var(--main-hover-color);--border-color:var(--main-hover-color)}:host([variant='secondary']) .active.button{--content-color:var(--bl-color-neutral-full);--bg-color:var(--main-hover-color)}:host([variant='tertiary']) .active.button{--content-color:var(--main-color);--bg-color:var(--bl-color-neutral-lightest);--border-color:transparent}`,z=T;var t=class extends v{constructor(){super(...arguments);this.variant="primary";this.kind="default";this.size="medium";this.loading=!1;this.disabled=!1;this.target="_self";this.dropdown=!1;this.autofocus=!1;this.active=!1}static get styles(){return[z]}get _isActive(){return this.active}connectedCallback(){super.connectedCallback(),this.form=this.closest("form")}caretTemplate(){return r` <bl-icon class="open" name="arrow_up"></bl-icon>
|
|
2
|
-
<bl-icon class="close" name="arrow_down"></bl-icon>`}_handleClick(){this.type==="submit"&&this.form&&x(this.form),this.onClick("Click event fired!")}focus(){this.button.focus()}get _hasIconSlot(){return this.querySelector(':scope > [slot="icon"]')!==null}get _hasDefaultSlot(){return[...this.childNodes].some(a=>{var c;let l=a.nodeType;return l===a.TEXT_NODE&&((c=a.textContent)==null?void 0:c.trim())!==""||l===a.ELEMENT_NODE&&!a.hasAttribute("slot")})}render(){let s=this.loading||this.disabled,a=this.loading&&this.loadingLabel?this.loadingLabel:r`<slot></slot>`,l=!!this.href,c=this.icon?r`<bl-icon name=${this.icon}></bl-icon>`:"",b=this.loading?r`<bl-icon class="loading-icon" name="loading"></bl-icon>`:"",h=r`<slot name="icon">${c}</slot> <span class="label">${a}</span>`,O=this.dropdown?this.caretTemplate():"",u=_({button:!0,"has-icon":this.icon||this._hasIconSlot,"has-content":this._hasDefaultSlot,active:!l&&this._isActive});return l?r`<a
|
|
3
|
-
class=${u}
|
|
4
|
-
?autofocus=${this.autofocus}
|
|
5
|
-
aria-disabled="${i(s)}"
|
|
6
|
-
aria-label="${i(this.label)}"
|
|
7
|
-
href=${i(this.href)}
|
|
8
|
-
target=${i(this.target)}
|
|
9
|
-
role="button"
|
|
10
|
-
>${b} ${h}
|
|
11
|
-
</a>`:r`<button
|
|
12
|
-
class=${u}
|
|
13
|
-
?autofocus=${this.autofocus}
|
|
14
|
-
aria-disabled="${i(s)}"
|
|
15
|
-
aria-label="${i(this.label)}"
|
|
16
|
-
?disabled=${s}
|
|
17
|
-
@click="${this._handleClick}"
|
|
18
|
-
>
|
|
19
|
-
${b} ${h} ${O}
|
|
20
|
-
</button>`}};o([e({type:String,reflect:!0})],t.prototype,"variant",2),o([e({type:String,reflect:!0})],t.prototype,"kind",2),o([e({type:String,reflect:!0})],t.prototype,"size",2),o([e({type:String})],t.prototype,"label",2),o([e({type:String,attribute:"loading-label"})],t.prototype,"loadingLabel",2),o([e({type:Boolean,reflect:!0})],t.prototype,"loading",2),o([e({type:Boolean,reflect:!0})],t.prototype,"disabled",2),o([e({type:String})],t.prototype,"href",2),o([e({type:String})],t.prototype,"icon",2),o([e({type:String})],t.prototype,"target",2),o([e({type:String})],t.prototype,"type",2),o([e({type:Boolean})],t.prototype,"dropdown",2),o([e({type:Boolean,reflect:!0})],t.prototype,"autofocus",2),o([g({})],t.prototype,"active",2),o([f(".button")],t.prototype,"button",2),o([y("bl-click")],t.prototype,"onClick",2),t=o([m("bl-button")],t);export{x as a,t as b};
|
|
21
|
-
//# sourceMappingURL=chunk-KGIPG6EV.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../node_modules/@open-wc/form-helpers/src/index.ts", "../src/components/button/bl-button.css", "../src/components/button/bl-button.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Implicitly submit a form by first validating all controls. If the form\n * is valid, issue a submit event and if that event is not prevented, manually\n * call the form's submit method.\n *\n * @param form {HTMLFormElement} - A form to implicitly submit\n */\nexport const submit = (form: HTMLFormElement): void => {\n if (!form.noValidate && !form.reportValidity()) {\n return;\n } else {\n const submitEvent = new SubmitEvent('submit', {\n bubbles: true,\n cancelable: true\n });\n form.dispatchEvent(submitEvent);\n if (!submitEvent.defaultPrevented) {\n form.submit();\n }\n }\n};\n\nexport type FormValue = string|FormData|File|FormValue[];\n\n/**\n * Parse a form and return a set of values based on the name/value pair.\n * If multiple controls of a similar name exist, return an array for those values;\n * otherwise return a single value.\n *\n * @param form {HTMLFormElement} - The form to parse for values\n * @returns {Record<string, any>} - An object representing the form's current values\n */\nexport const formValues = (form: HTMLFormElement): Record<string, FormValue> => {\n const formData = new FormData(form);\n const values: Record<string, FormValue> = {};\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore This does exist in all browsers. TypeScript is wrong\n for (const [key, value] of formData.entries()) {\n if (!values.hasOwnProperty(key)) {\n values[key] = value;\n } else if (Array.isArray(values[key])) {\n const pointer = values[key] as FormValue[];\n pointer.push(value);\n } else {\n values[key] = [values[key], value];\n }\n }\n\n return values;\n};\n\n/**\n * This method takes a form and parses it as an object. If any form control has a `.`\n * in its name, this utility will evaluate that name as a deep key for an object;\n * in other words, if a form has a named control, `name.first` and another, `name.last`\n * it will report back a nested object, name, with first and last properties\n * representing those controls' values.\n *\n * This can be useful when you have a complex model that you are attempting to represent\n * in declaratively in HTML.\n *\n * @param form {HTMLFormElement} - The form to grab values from\n * @returns {Object<string, FormValue>} - An object representation of the form\n */\nexport const parseFormAsObject = (form: HTMLFormElement): Record<string, FormValue> => {\n const data = formValues(form);\n const output: Record<string, FormValue> = {};\n\n Object.entries(data).forEach(([key, value]) => {\n /** If the key has a '.', parse it as an object */\n if (key.includes('.')) {\n const path = key.split('.');\n const destination: string | undefined = path.pop();\n let pointer = output;\n\n while (path.length) {\n const key = path.shift();\n pointer[key as string] = pointer[key as string] || ({} as FormValue);\n pointer = pointer[key as string] as unknown as Record<string, FormValue>;\n }\n\n pointer[destination as string] = value;\n } else {\n output[key] = data[key];\n }\n });\n\n return output;\n};\n", "import {css} from 'lit';\nexport const styles = css`@keyframes spin{from{transform:rotate(0)}to{transform:rotate(359deg)}}:host{display:var(--bl-button-display,inline-block);max-width:100%;position:relative}.button{--main-color:var(--bl-color-primary);--main-hover-color:var(--bl-color-primary-highlight);--text-hover-color:var(--bl-color-neutral-lightest);--content-color:var(--bl-color-neutral-full);--bg-color:var(--main-color);--border-color:var(--main-color);--padding-vertical:var(--bl-size-2xs);--padding-horizontal:var(--bl-size-m);--margin-icon:var(--padding-vertical);--icon-size:var(--bl-size-m);--font:var(--bl-font-title-3-medium);--height:var(--bl-size-2xl);display:flex;gap:var(--margin-icon);justify-content:var(--bl-button-justify,center);align-items:center;box-sizing:border-box;width:100%;height:var(--height);border:solid 1px var(--border-color);border-radius:var(--bl-border-radius-m);text-decoration:none;padding:var(--padding-vertical) var(--padding-horizontal);cursor:pointer;background-color:var(--bg-color);color:var(--content-color);font:var(--font);font-kerning:none;user-select:none}:host(:hover) .button,:host(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button{--bg-color:var(--main-hover-color);--border-color:var(--main-hover-color)}.label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host([size='small']) .button{--font:var(--bl-font-title-4-medium);--padding-vertical:var(--bl-size-3xs);--padding-horizontal:var(--bl-size-2xs);--icon-size:var(--bl-size-s);--height:var(--bl-size-xl)}:host([size='large']) .button{--font:var(--bl-font-title-3-medium);--padding-vertical:var(--bl-size-xs);--padding-horizontal:var(--bl-size-xl);--margin-icon:var(--bl-size-2xs);--height:var(--bl-size-3xl)}.button:focus{outline:0}.button:focus-visible{position:relative;outline:0}.button:focus-visible::after{border:2px solid var(--main-color);border-radius:var(--bl-border-radius-l);content:'';position:absolute;inset:-4px}.loading-icon{animation:spin 1s linear infinite;font-size:var(--icon-size)}:host ::slotted(bl-icon){font-size:var(--icon-size)}:host([loading]) ::slotted(bl-icon){display:none}:host .has-icon:not(.has-content){--padding-horizontal:var(--padding-vertical);--margin-icon:0}:host([variant='secondary']) .button{--bg-color:transparent;--content-color:var(--main-color)}:host([variant='tertiary']) .button{--content-color:var(--main-color);--border-color:transparent;--bg-color:transparent}:host([kind='neutral']) .button{--main-color:var(--bl-color-neutral-darker);--main-hover-color:var(--bl-color-neutral-darkest)}:host([kind='success']) .button{--main-color:var(--bl-color-success);--main-hover-color:var(--bl-color-success-highlight)}:host([kind='danger']) .button{--main-color:var(--bl-color-danger);--main-hover-color:var(--bl-color-danger-highlight)}:host([disabled]){cursor:not-allowed}:host([loading]){cursor:wait}:host([loading]) bl-icon:not(.loading-icon){display:none}:host .button[aria-disabled='true']{--main-color:var(--bl-color-neutral-lightest);--main-hover-color:var(--bl-color-neutral-lightest);--content-color:var(--bl-color-neutral-lighter);--bg-color:var(--main-color);pointer-events:none;text-decoration:none}:host([variant='tertiary']) .button[aria-disabled='true']{--main-color:transparent}:host([variant='secondary']:hover) .button[aria-disabled='false'],:host([variant='secondary'].__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button[aria-disabled='false']{--content-color:var(--bl-color-neutral-full);--bg-color:var(--main-hover-color)}:host([variant='tertiary']:hover) .button[aria-disabled='false'],:host([variant='tertiary'].__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button[aria-disabled='false']{--content-color:var(--main-hover-color);--bg-color:var(--text-hover-color)}:host([dropdown]) .open{display:none}:host([dropdown]) .active .open{display:inline-block}:host([dropdown]) .active .close{display:none}:host .active.button{--bg-color:var(--main-hover-color);--border-color:var(--main-hover-color)}:host([variant='secondary']) .active.button{--content-color:var(--bl-color-neutral-full);--bg-color:var(--main-hover-color)}:host([variant='tertiary']) .active.button{--content-color:var(--main-color);--bg-color:var(--bl-color-neutral-lightest);--border-color:transparent}`;\nexport default styles;\n", "import { CSSResultGroup, html, LitElement, TemplateResult } from 'lit';\nimport { customElement, property, state, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { submit } from '@open-wc/form-helpers';\nimport { event, EventDispatcher } from '../../utilities/event';\nimport style from './bl-button.css';\nimport '../icon/bl-icon';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'tertiary';\nexport type ButtonKind = 'default' | 'neutral' | 'success' | 'danger';\nexport type ButtonSize = 'small' | 'medium' | 'large';\nexport type TargetType = '_blank' | '_parent' | '_self' | '_top';\n\n/**\n * @tag bl-button\n * @summary Baklava Button component\n *\n * @cssproperty [--bl-button-display=inline-block] Sets the display property of button\n * @cssproperty [--bl-button-justify=center] Sets the justify-content property of button\n *\n */\n@customElement('bl-button')\nexport default class BlButton extends LitElement {\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n /**\n * Sets the button variant\n */\n @property({ type: String, reflect: true })\n variant: ButtonVariant = 'primary';\n\n /**\n * Sets the button kind\n */\n @property({ type: String, reflect: true })\n kind: ButtonKind = 'default';\n\n /**\n * Sets the button size\n */\n @property({ type: String, reflect: true })\n size: ButtonSize = 'medium';\n\n /**\n * Sets the button label. Used for accessibility.\n */\n @property({ type: String })\n label: string;\n\n /**\n * Sets the button label for loading status.\n */\n @property({ type: String, attribute: 'loading-label' })\n loadingLabel: string;\n\n /**\n * Sets loading state of button\n */\n @property({ type: Boolean, reflect: true })\n loading = false;\n\n /**\n * Sets button as disabled\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * Set link url. If set, button will be rendered as anchor tag.\n */\n @property({ type: String })\n href?: string;\n\n /**\n * Sets the icon name. Shows icon with bl-icon component\n */\n @property({ type: String })\n icon?: string;\n\n /**\n * Sets the anchor target. Used when `href` is set.\n */\n @property({ type: String })\n target?: TargetType = '_self';\n\n /**\n * Sets the type of the button. Set `submit` to use button as the submitter of parent form.\n */\n @property({ type: String })\n type: 'submit' | null;\n\n /**\n * Sets button type to dropdown\n */\n @property({ type: Boolean })\n dropdown = false;\n\n /**\n * Sets button to get keyboard focus automatically\n */\n @property({ type: Boolean, reflect: true })\n autofocus = false;\n\n /**\n * Active state\n */\n @state({})\n active = false;\n\n @query('.button')\n private button: HTMLAnchorElement | HTMLButtonElement;\n\n /**\n * Fires when button clicked\n */\n @event('bl-click') private onClick: EventDispatcher<string>;\n\n private get _isActive() {\n return this.active;\n }\n\n private form: HTMLFormElement | null;\n\n connectedCallback() {\n super.connectedCallback();\n this.form = this.closest('form');\n }\n\n private caretTemplate(): TemplateResult {\n return html` <bl-icon class=\"open\" name=\"arrow_up\"></bl-icon>\n <bl-icon class=\"close\" name=\"arrow_down\"></bl-icon>`;\n }\n\n private _handleClick() {\n if (this.type === 'submit' && this.form) {\n submit(this.form);\n }\n\n this.onClick('Click event fired!');\n }\n\n focus() {\n this.button.focus();\n }\n\n get _hasIconSlot() {\n return this.querySelector(':scope > [slot=\"icon\"]') !== null;\n }\n\n get _hasDefaultSlot() {\n const childNodes = [...this.childNodes];\n return childNodes.some(node => {\n const nodeType = node.nodeType;\n // has only text node.\n if (nodeType === node.TEXT_NODE && node.textContent?.trim() !== '') {\n return true;\n }\n // has element node, it should not have slot attribute.\n if (nodeType === node.ELEMENT_NODE) {\n if (!(node as HTMLElement).hasAttribute('slot')) {\n return true;\n }\n }\n return false;\n });\n }\n\n render(): TemplateResult {\n const isDisabled = this.loading || this.disabled;\n const label = this.loading && this.loadingLabel ? this.loadingLabel : html`<slot></slot>`;\n const isAnchor = !!this.href;\n const icon = this.icon ? html`<bl-icon name=${this.icon}></bl-icon>` : '';\n const loadingIcon = this.loading\n ? html`<bl-icon class=\"loading-icon\" name=\"loading\"></bl-icon>`\n : '';\n const slots = html`<slot name=\"icon\">${icon}</slot> <span class=\"label\">${label}</span>`;\n const caret = this.dropdown ? this.caretTemplate() : '';\n const classes = classMap({\n 'button': true,\n 'has-icon': this.icon || this._hasIconSlot,\n 'has-content': this._hasDefaultSlot,\n 'active': !isAnchor && this._isActive,\n });\n\n return isAnchor\n ? html`<a\n class=${classes}\n ?autofocus=${this.autofocus}\n aria-disabled=\"${ifDefined(isDisabled)}\"\n aria-label=\"${ifDefined(this.label)}\"\n href=${ifDefined(this.href)}\n target=${ifDefined(this.target)}\n role=\"button\"\n >${loadingIcon} ${slots}\n </a>`\n : html`<button\n class=${classes}\n ?autofocus=${this.autofocus}\n aria-disabled=\"${ifDefined(isDisabled)}\"\n aria-label=\"${ifDefined(this.label)}\"\n ?disabled=${isDisabled}\n @click=\"${this._handleClick}\"\n >\n ${loadingIcon} ${slots} ${caret}\n </button>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'bl-button': BlButton;\n }\n}\n"],
|
|
5
|
-
"mappings": "kPAOO,IAAMA,EAAUC,GAA+B,CACpD,GAAI,GAACA,EAAK,YAAc,CAACA,EAAK,eAAc,GAErC,CACL,IAAMC,EAAc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KAAM,MAAO,CAAC,GAxDPlB,EAyDnB,oBAMAkB,EAAA,CADC,EAAS,CAAE,KAAM,MAAO,CAAC,GA9DPlB,EA+DnB,sBAMAkB,EAAA,CADC,EAAS,CAAE,KAAM,MAAO,CAAC,GApEPlB,EAqEnB,oBAMAkB,EAAA,CADC,EAAS,CAAE,KAAM,OAAQ,CAAC,GA1ERlB,EA2EnB,wBAMAkB,EAAA,CADC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAhFvBlB,EAiFnB,yBAMAkB,EAAA,CADCC,EAAM,CAAC,CAAC,GAtFUnB,EAuFnB,sBAGQkB,EAAA,CADPE,EAAM,SAAS,GAzFGpB,EA0FX,sBAKmBkB,EAAA,CAA1BG,EAAM,UAAU,GA/FErB,EA+FQ,uBA/FRA,EAArBkB,EAAA,CADCI,EAAc,WAAW,GACLtB",
|
|
6
|
-
"names": ["submit", "form", "submitEvent", "styles", "i", "bl_button_default", "BlButton", "s", "bl_button_default", "y", "submit", "node", "_a", "nodeType", "isDisabled", "label", "isAnchor", "icon", "loadingIcon", "slots", "caret", "classes", "o", "l", "__decorateClass", "t", "i", "event", "e"]
|
|
7
|
-
}
|
package/dist/chunk-LV2MAELO.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-3B64VOWB.js";import{b as g,d as y,f as x,g as O,h as _}from"./chunk-ANYJUR6Q.js";import{a as f}from"./chunk-DJOD4BTL.js";import{a as p}from"./chunk-OLPYXE2P.js";import{a as b}from"./chunk-KPAWUBRO.js";import{a as v}from"./chunk-23UFIOHV.js";import{a as c,b as n,f as d,g as u,h as l,i as r,j as a,k as h}from"./chunk-57PTZNIL.js";import{a as i}from"./chunk-NZ3RGSR6.js";var T=c`:host{width:200px;display:inline-block}.select-wrapper{width:100%;position:relative;display:grid;gap:var(--bl-size-3xs);--padding-vertical:var(--bl-size-2xs);--padding-horizontal:var(--bl-size-xs);--label-padding:var(--bl-size-3xs);--border-size:1px;--background-color:var(--bl-color-neutral-full);--border-color:var(--bl-color-neutral-lighter);--border-focus-color:var(--bl-color-primary-highlight);--icon-color:var(--bl-color-neutral-light);--text-color:var(--bl-color-neutral-darker);--label-color:var(--bl-color-neutral-dark);--placeholder-color:var(--bl-color-neutral-light);--height:var(--bl-size-2xl);--menu-padding:0 var(--bl-size-m);--menu-margin-top:var(--bl-size-2xs);--font-size:var(--bl-font-size-m);--disabled-color:var(--bl-color-neutral-lightest);--menu-height:250px;--popover-position:var(--bl-popover-position,fixed)}:host([size='large']) .select-wrapper{--height:var(--bl-size-3xl);--padding-vertical:var(--bl-size-xs);--padding-horizontal:var(--bl-size-m)}:host([size='small']) .select-wrapper{--height:var(--bl-size-xl);--padding-vertical:var(--bl-size-3xs);--padding-horizontal:var(--bl-size-xs);--font-size:var(--bl-font-size-s)}:host([disabled]) .select-wrapper{--placeholder-color:var(--bl-color-neutral-light)}.dirty.invalid{--border-color:var(--bl-color-danger);--border-focus-color:var(--bl-color-danger-highlight);--label-color:var(--bl-color-danger)}.select-input{display:grid;align-items:center;justify-content:space-between;grid-template-columns:1fr max-content max-content;cursor:pointer;box-sizing:border-box;height:var(--height);border:solid 1px var(--border-color);font:var(--bl-font-title-3-regular);padding:0 calc(var(--padding-horizontal) - var(--label-padding) - var(--border-size));border-radius:var(--bl-border-radius-s);color:var(--text-color);background-color:var(--background-color);-webkit-user-select:none;user-select:none;margin:0;width:0;min-width:100%}.placeholder{color:var(--placeholder-color);padding-left:var(--label-padding);white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}.select-wrapper.selected .placeholder,:host([label]:not([label-fixed])) .select-wrapper:not(.select-open) .placeholder{display:none}.remove-all{display:none}.remove-all::after{content:'';position:absolute;left:1.5rem;bottom:4px;height:1rem;border-left:1px solid var(--bl-color-neutral-lighter)}.selected .remove-all{display:block}:host([disabled]) .remove-all,:host([disabled]) .remove-all::after{display:none}.dropdown-icon{font-size:var(--bl-font-size-m)}.dropdown-icon.open{display:none}.select-open .dropdown-icon.open{display:inline-block}.select-open .dropdown-icon.closed{display:none}.selected .dropdown-icon{--icon-color:var(--bl-color-neutral-darker)}:host([disabled]) .dropdown-icon{--icon-color:var(--bl-color-neutral-light)}.select-open .select-input,.select-input:focus-visible{border:solid 1px var(--border-focus-color);outline:0}:host([disabled]){cursor:not-allowed}:host([disabled]) .select-input{pointer-events:none;background-color:var(--disabled-color)}.select-input .selected-options{padding:0;padding-left:var(--label-padding);margin:0;list-style:none;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.selected-options li{display:inline;font-size:var(--font-size);color:var(--text-color)}.selected-options li:not(:last-child)::after{content:', '}.select-input:not(.has-overflowed-options) .additional-selection-count{display:none}:host([disabled]) .selected-options li{color:var(--bl-color-neutral-light)}.select-input .actions{display:flex;align-items:center;justify-content:center;gap:var(--bl-size-2xs);margin-left:var(--bl-size-2xs)}.popover{--left:0;--top:0;position:var(--popover-position);border:solid 1px var(--border-color);background-color:var(--background-color);font:var(--bl-font-title-3-regular);border-radius:var(--bl-border-radius-s);padding:var(--menu-padding);outline:0;box-sizing:border-box;max-height:var(--menu-height);overflow-y:auto;display:none;flex-direction:column;z-index:var(--bl-index-popover);width:100%;top:var(--top);left:var(--left)}.select-open .popover{display:flex;border:solid 1px var(--border-focus-color)}bl-icon{color:var(--icon-color)}legend,label{max-width:max-content;padding:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}label{position:absolute;display:block;top:var(--padding-vertical);left:var(--padding-horizontal);right:calc(var(--bl-size-2xs) + var(--bl-size-m) + var(--bl-size-2xs));transition:all ease-in .1s;pointer-events:none;font:var(--bl-font-title-3-regular);font-size:var(--font-size);color:var(--placeholder-color)}legend{height:0;visibility:hidden;display:none}legend span{padding:0 var(--label-padding);display:inline-block;opacity:0;visibility:visible}:where(.select-open,.selected) label{top:0;transform:translateY(-50%);font:var(--bl-font-caption);color:var(--label-color);pointer-events:initial;right:var(--padding-horizontal)}:host([label]) :where(.select-open,.selected) legend{max-width:100%;font:var(--bl-font-caption);display:block}:host([label-fixed]) label{position:static;padding:0;transition:none;transform:none;pointer-events:initial;font:var(--bl-font-caption);color:var(--label-color)}:host([label-fixed]) legend{display:none}.hint{display:none;font:var(--bl-font-body-text-3)}.hint p{padding:0;margin:0}.error-icon,.invalid-text{display:none}.dirty.invalid label,.invalid-text,.error-icon{color:var(--bl-color-danger)}.help-text{color:var(--bl-color-neutral-dark)}.select-open .help-text,.select-open .invalid-text{visibility:hidden}:host([help-text]) .hint,.dirty.invalid .hint{display:block}.dirty.invalid .invalid-text{display:block}.dirty.invalid .help-text{display:none}`,w=T;var t=class extends f(d){constructor(){super(...arguments);this.size="medium";this.required=!1;this.disabled=!1;this.multiple=!1;this.autofocus=!1;this.labelFixed=!1;this._isPopoverOpen=!1;this._additionalSelectedOptionCount=0;this._connectedOptions=[];this._cleanUpPopover=null;this._selectedOptions=[];this.dirty=!1;this._interactOutsideHandler=e=>{var s;let o=e.composedPath();(s=o==null?void 0:o.find(z=>z.tagName==="BL-SELECT"))!=null&&s.contains(this)||this.close()};this.focusedOptionIndex=-1}static get styles(){return[w]}get value(){return this._value}set value(e){if(this._value=e,Array.isArray(e)){let o=new FormData;e.forEach(s=>o.append(this.name,`${s}`)),this.setValue(o)}else this.setValue(e);this.setOptionsSelected()}shouldFormValueUpdate(){return this.value!==null&&this.value!==""}setOptionsSelected(){this._connectedOptions.forEach(e=>e.selected=this.value===e.value||Array.isArray(this.value)&&this.value.includes(e.value)),this._selectedOptions=[...this.options.filter(e=>e.selected)]}get options(){return this._connectedOptions}get opened(){return this._isPopoverOpen}get selectedOptions(){return this._selectedOptions}get additionalSelectedOptionCount(){return this._additionalSelectedOptionCount}validityCallback(){if(this.customInvalidText)return this.customInvalidText;let e=document.createElement("select");return e.required=this.required,e.validationMessage}reportValidity(){return this.dirty=!0,this.checkValidity()}resetFormControl(){this.value=this._initialValue}open(){this._isPopoverOpen=!0,this._setupPopover(),document.addEventListener("click",this._interactOutsideHandler,!0),document.addEventListener("focus",this._interactOutsideHandler,!0)}close(){this._isPopoverOpen=!1,this.focusedOptionIndex=-1,this._cleanUpPopover&&this._cleanUpPopover(),document.removeEventListener("click",this._interactOutsideHandler,!0),document.removeEventListener("focus",this._interactOutsideHandler,!0)}_setupPopover(){this._cleanUpPopover=O(this._selectInput,this._popover,()=>{_(this._selectInput,this._popover,{placement:"bottom",strategy:"fixed",middleware:[g(),y(8),x({apply(e){Object.assign(e.elements.floating.style,{width:`${e.elements.reference.getBoundingClientRect().width}px`})}})]}).then(({x:e,y:o})=>{this._popover.style.setProperty("--left",`${e}px`),this._popover.style.setProperty("--top",`${o}px`)})})}connectedCallback(){var e;super.connectedCallback(),(e=this.form)==null||e.addEventListener("submit",o=>{this.reportValidity()||o.preventDefault()})}disconnectedCallback(){super.disconnectedCallback(),this._cleanUpPopover&&this._cleanUpPopover()}inputTemplate(){let e=n`<ul class="selected-options">
|
|
2
|
-
${this._selectedOptions.map(s=>n`<li>${s.textContent}</li>`)}
|
|
3
|
-
</ul>`,o=n`<bl-button
|
|
4
|
-
class="remove-all"
|
|
5
|
-
size="small"
|
|
6
|
-
variant="tertiary"
|
|
7
|
-
kind="neutral"
|
|
8
|
-
icon="close"
|
|
9
|
-
@click=${this._onClickRemove}
|
|
10
|
-
></bl-button>`;return n`<fieldset
|
|
11
|
-
class=${p({"select-input":!0,"has-overflowed-options":this._additionalSelectedOptionCount>0})}
|
|
12
|
-
tabindex="${this.disabled?"-1":0}"
|
|
13
|
-
?autofocus=${this.autofocus}
|
|
14
|
-
@click=${this.togglePopover}
|
|
15
|
-
>
|
|
16
|
-
<legend><span>${this.label}</span></legend>
|
|
17
|
-
<span class="placeholder">${this.placeholder}</span>
|
|
18
|
-
${e}
|
|
19
|
-
<span class="additional-selection-count">+${this._additionalSelectedOptionCount}</span>
|
|
20
|
-
<div class="actions">
|
|
21
|
-
${this.multiple?o:null}
|
|
22
|
-
<bl-icon class="dropdown-icon open" name="arrow_up"></bl-icon>
|
|
23
|
-
|
|
24
|
-
<bl-icon class="dropdown-icon closed" name="arrow_down"></bl-icon>
|
|
25
|
-
</div>
|
|
26
|
-
</fieldset>`}render(){let e=this.checkValidity()?"":n`<p id="errorMessage" aria-live="polite" class="invalid-text">
|
|
27
|
-
${this.validationMessage}
|
|
28
|
-
</p>`,o=this.helpText?n`<p class="help-text">${this.helpText}</p>`:"",s=this.label?n`<label>${this.label}</label>`:"";return n`<div
|
|
29
|
-
class=${p({"select-wrapper":!0,"select-open":this.opened,selected:this._selectedOptions.length>0,invalid:!this.validity.valid,dirty:this.dirty})}
|
|
30
|
-
@keydown=${this.handleKeydown}
|
|
31
|
-
>
|
|
32
|
-
${s} ${this.inputTemplate()}
|
|
33
|
-
<div
|
|
34
|
-
class="popover"
|
|
35
|
-
tabindex="${b(this._isPopoverOpen?void 0:"-1")}"
|
|
36
|
-
@bl-select-option=${this._handleSelectOptionEvent}
|
|
37
|
-
>
|
|
38
|
-
<slot></slot>
|
|
39
|
-
</div>
|
|
40
|
-
<div class="hint">${e} ${o}</div>
|
|
41
|
-
</div> `}handleKeydown(e){this.focusedOptionIndex===-1&&["Enter","Space"].includes(e.code)?(this.togglePopover(),e.preventDefault()):this._isPopoverOpen===!1&&["ArrowDown","ArrowUp"].includes(e.code)?(this.open(),e.preventDefault()):e.code==="Escape"?(this.close(),e.preventDefault()):this._isPopoverOpen&&["ArrowDown","ArrowUp"].includes(e.code)&&(e.code==="ArrowDown"&&this.focusedOptionIndex++,e.code==="ArrowUp"&&this.focusedOptionIndex--,this.focusedOptionIndex=Math.max(0,Math.min(this.focusedOptionIndex,this.options.length-1)),this.options[this.focusedOptionIndex].focus(),e.preventDefault())}togglePopover(){this._isPopoverOpen?this.close():this.open()}_handleSelectEvent(){this._onBlSelect(this._selectedOptions.map(e=>({value:e.value,selected:e.selected,text:e.textContent})))}_handleSingleSelect(e){this.value=e.value,this._handleSelectEvent(),this._isPopoverOpen=!1}_handleMultipleSelect(){this.value=this._connectedOptions.filter(e=>e.selected).map(e=>e.value),this._handleSelectEvent()}_handleSelectOptionEvent(e){let o=e.target;this.dirty=!0,this.multiple?this._handleMultipleSelect():this._handleSingleSelect(o)}_onClickRemove(e){e.stopPropagation(),this._connectedOptions.filter(o=>o.selected).forEach(o=>{o.selected=!1}),this.value=null,this._additionalSelectedOptionCount=0,this._handleSelectEvent()}_checkAdditionalItemCount(){if(!this.multiple||!this.selectedOptionsItems||this.selectedOptionsItems.length<2){this._additionalSelectedOptionCount=0;return}let e=[...this.selectedOptionsItems].findIndex(o=>o.offsetLeft>this.selectedOptionsContainer.offsetWidth);e>-1?this._additionalSelectedOptionCount=this.selectedOptionsItems.length-e:this._additionalSelectedOptionCount=0}firstUpdated(){this.value===void 0&&(this.value=""),this._initialValue=this._value}updated(e){e.has("multiple")&&typeof e.get("multiple")=="boolean"&&(this.value=null),this._checkAdditionalItemCount()}registerOption(e){this._connectedOptions.push(e),e.selected&&(this.multiple?(Array.isArray(this.value)||(this.value=[]),this.value=[...this.value,e.value]):this.value=e.value),this.setOptionsSelected(),this.requestUpdate()}unregisterOption(e){this._connectedOptions.splice(this._connectedOptions.indexOf(e),1)}};t.shadowRootOptions={...d.shadowRootOptions,delegatesFocus:!0},t.formControlValidators=[m],i([l()],t.prototype,"name",2),i([l()],t.prototype,"value",1),i([l({reflect:!0})],t.prototype,"label",2),i([l({})],t.prototype,"placeholder",2),i([l({type:String,reflect:!0})],t.prototype,"size",2),i([l({type:Boolean,reflect:!0})],t.prototype,"required",2),i([l({type:Boolean,reflect:!0})],t.prototype,"disabled",2),i([l({type:Boolean})],t.prototype,"multiple",2),i([l({type:Boolean,reflect:!0})],t.prototype,"autofocus",2),i([l({type:Boolean,attribute:"label-fixed",reflect:!0})],t.prototype,"labelFixed",2),i([l({type:String,attribute:"help-text"})],t.prototype,"helpText",2),i([l({type:String,attribute:"invalid-text"})],t.prototype,"customInvalidText",2),i([r()],t.prototype,"_isPopoverOpen",2),i([r()],t.prototype,"_additionalSelectedOptionCount",2),i([a(".selected-options")],t.prototype,"selectedOptionsContainer",2),i([h(".selected-options li")],t.prototype,"selectedOptionsItems",2),i([a(".popover")],t.prototype,"_popover",2),i([a(".select-input")],t.prototype,"_selectInput",2),i([v("bl-select")],t.prototype,"_onBlSelect",2),i([r()],t.prototype,"_selectedOptions",2),i([r()],t.prototype,"dirty",2),i([a(".select-input")],t.prototype,"validationTarget",2),t=i([u("bl-select")],t);export{t as a};
|
|
42
|
-
//# sourceMappingURL=chunk-LV2MAELO.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/select/bl-select.css", "../src/components/select/bl-select.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`:host{width:200px;display:inline-block}.select-wrapper{width:100%;position:relative;display:grid;gap:var(--bl-size-3xs);--padding-vertical:var(--bl-size-2xs);--padding-horizontal:var(--bl-size-xs);--label-padding:var(--bl-size-3xs);--border-size:1px;--background-color:var(--bl-color-neutral-full);--border-color:var(--bl-color-neutral-lighter);--border-focus-color:var(--bl-color-primary-highlight);--icon-color:var(--bl-color-neutral-light);--text-color:var(--bl-color-neutral-darker);--label-color:var(--bl-color-neutral-dark);--placeholder-color:var(--bl-color-neutral-light);--height:var(--bl-size-2xl);--menu-padding:0 var(--bl-size-m);--menu-margin-top:var(--bl-size-2xs);--font-size:var(--bl-font-size-m);--disabled-color:var(--bl-color-neutral-lightest);--menu-height:250px;--popover-position:var(--bl-popover-position,fixed)}:host([size='large']) .select-wrapper{--height:var(--bl-size-3xl);--padding-vertical:var(--bl-size-xs);--padding-horizontal:var(--bl-size-m)}:host([size='small']) .select-wrapper{--height:var(--bl-size-xl);--padding-vertical:var(--bl-size-3xs);--padding-horizontal:var(--bl-size-xs);--font-size:var(--bl-font-size-s)}:host([disabled]) .select-wrapper{--placeholder-color:var(--bl-color-neutral-light)}.dirty.invalid{--border-color:var(--bl-color-danger);--border-focus-color:var(--bl-color-danger-highlight);--label-color:var(--bl-color-danger)}.select-input{display:grid;align-items:center;justify-content:space-between;grid-template-columns:1fr max-content max-content;cursor:pointer;box-sizing:border-box;height:var(--height);border:solid 1px var(--border-color);font:var(--bl-font-title-3-regular);padding:0 calc(var(--padding-horizontal) - var(--label-padding) - var(--border-size));border-radius:var(--bl-border-radius-s);color:var(--text-color);background-color:var(--background-color);-webkit-user-select:none;user-select:none;margin:0;width:0;min-width:100%}.placeholder{color:var(--placeholder-color);padding-left:var(--label-padding);white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}.select-wrapper.selected .placeholder,:host([label]:not([label-fixed])) .select-wrapper:not(.select-open) .placeholder{display:none}.remove-all{display:none}.remove-all::after{content:'';position:absolute;left:1.5rem;bottom:4px;height:1rem;border-left:1px solid var(--bl-color-neutral-lighter)}.selected .remove-all{display:block}:host([disabled]) .remove-all,:host([disabled]) .remove-all::after{display:none}.dropdown-icon{font-size:var(--bl-font-size-m)}.dropdown-icon.open{display:none}.select-open .dropdown-icon.open{display:inline-block}.select-open .dropdown-icon.closed{display:none}.selected .dropdown-icon{--icon-color:var(--bl-color-neutral-darker)}:host([disabled]) .dropdown-icon{--icon-color:var(--bl-color-neutral-light)}.select-open .select-input,.select-input:focus-visible{border:solid 1px var(--border-focus-color);outline:0}:host([disabled]){cursor:not-allowed}:host([disabled]) .select-input{pointer-events:none;background-color:var(--disabled-color)}.select-input .selected-options{padding:0;padding-left:var(--label-padding);margin:0;list-style:none;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.selected-options li{display:inline;font-size:var(--font-size);color:var(--text-color)}.selected-options li:not(:last-child)::after{content:', '}.select-input:not(.has-overflowed-options) .additional-selection-count{display:none}:host([disabled]) .selected-options li{color:var(--bl-color-neutral-light)}.select-input .actions{display:flex;align-items:center;justify-content:center;gap:var(--bl-size-2xs);margin-left:var(--bl-size-2xs)}.popover{--left:0;--top:0;position:var(--popover-position);border:solid 1px var(--border-color);background-color:var(--background-color);font:var(--bl-font-title-3-regular);border-radius:var(--bl-border-radius-s);padding:var(--menu-padding);outline:0;box-sizing:border-box;max-height:var(--menu-height);overflow-y:auto;display:none;flex-direction:column;z-index:var(--bl-index-popover);width:100%;top:var(--top);left:var(--left)}.select-open .popover{display:flex;border:solid 1px var(--border-focus-color)}bl-icon{color:var(--icon-color)}legend,label{max-width:max-content;padding:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}label{position:absolute;display:block;top:var(--padding-vertical);left:var(--padding-horizontal);right:calc(var(--bl-size-2xs) + var(--bl-size-m) + var(--bl-size-2xs));transition:all ease-in .1s;pointer-events:none;font:var(--bl-font-title-3-regular);font-size:var(--font-size);color:var(--placeholder-color)}legend{height:0;visibility:hidden;display:none}legend span{padding:0 var(--label-padding);display:inline-block;opacity:0;visibility:visible}:where(.select-open,.selected) label{top:0;transform:translateY(-50%);font:var(--bl-font-caption);color:var(--label-color);pointer-events:initial;right:var(--padding-horizontal)}:host([label]) :where(.select-open,.selected) legend{max-width:100%;font:var(--bl-font-caption);display:block}:host([label-fixed]) label{position:static;padding:0;transition:none;transform:none;pointer-events:initial;font:var(--bl-font-caption);color:var(--label-color)}:host([label-fixed]) legend{display:none}.hint{display:none;font:var(--bl-font-body-text-3)}.hint p{padding:0;margin:0}.error-icon,.invalid-text{display:none}.dirty.invalid label,.invalid-text,.error-icon{color:var(--bl-color-danger)}.help-text{color:var(--bl-color-neutral-dark)}.select-open .help-text,.select-open .invalid-text{visibility:hidden}:host([help-text]) .hint,.dirty.invalid .hint{display:block}.dirty.invalid .invalid-text{display:block}.dirty.invalid .help-text{display:none}`;\nexport default styles;\n", "import {\n autoUpdate,\n computePosition,\n flip,\n MiddlewareState,\n offset,\n size,\n} from '@floating-ui/dom';\nimport { FormControlMixin, requiredValidator } from '@open-wc/form-control';\nimport { FormValue } from '@open-wc/form-helpers';\nimport 'element-internals-polyfill';\nimport { CSSResultGroup, html, LitElement, PropertyValues } from 'lit';\nimport { customElement, property, query, queryAll, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { event, EventDispatcher } from '../../utilities/event';\nimport '../icon/bl-icon';\nimport style from '../select/bl-select.css';\nimport '../select/option/bl-select-option';\nimport type BlSelectOption from './option/bl-select-option';\n\nexport interface ISelectOption<T = string> {\n value: T;\n text: string;\n selected: boolean;\n}\n\nexport type SelectSize = 'medium' | 'large' | 'small';\n\nexport type CleanUpFunction = () => void;\n\n/**\n * @tag bl-select\n * @summary Baklava Select component\n *\n * @cssproperty [--bl-popover-position=fixed] Sets the positioning strategy of select popover. You can set it as `absolute` if you need to show popover relative to its trigger element.\n */\n@customElement('bl-select')\nexport default class BlSelect<ValueType extends FormValue = string> extends FormControlMixin(\n LitElement\n) {\n static get styles(): CSSResultGroup {\n return [style];\n }\n static shadowRootOptions = {...LitElement.shadowRootOptions, delegatesFocus: true};\n\n static formControlValidators = [requiredValidator];\n\n /**\n * Sets name of the select field\n */\n @property()\n name: string;\n\n private _value: ValueType | ValueType[] | null;\n\n private _initialValue: ValueType | ValueType[] | null;\n\n /**\n * Sets the value of the select\n */\n @property()\n get value(): ValueType | ValueType[] | null {\n return this._value;\n }\n\n set value(val: ValueType | ValueType[] | null) {\n this._value = val;\n\n if (Array.isArray(val)) {\n const formData = new FormData();\n val.forEach(option => formData.append(this.name, `${option}`));\n this.setValue(formData);\n } else {\n this.setValue(val);\n }\n\n this.setOptionsSelected();\n }\n\n shouldFormValueUpdate(): boolean {\n return this.value !== null && this.value !== '';\n }\n\n /* Declare reactive properties */\n /**\n * Sets the label value\n */\n @property({ reflect: true })\n label?: string;\n\n /**\n * Sets the placeholder value. If left blank, the label value (if specified) is set as placeholder.\n */\n @property({})\n placeholder?: string;\n\n /**\n * Sets the size value. Select component's height value will be changed accordingly\n */\n @property({ type: String, reflect: true })\n size: SelectSize = 'medium';\n\n /**\n * When option is not selected, shows component in error state\n */\n @property({ type: Boolean, reflect: true })\n required = false;\n\n /**\n * Shows the component in disabled state.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * Allows multiple options to be selected\n */\n @property({ type: Boolean })\n multiple = false;\n\n /**\n * Sets input to get keyboard focus automatically\n */\n @property({ type: Boolean, reflect: true })\n autofocus = false;\n\n /**\n * Makes label as fixed positioned\n */\n @property({ type: Boolean, attribute: 'label-fixed', reflect: true })\n labelFixed = false;\n\n /**\n * Adds help text\n */\n @property({ type: String, attribute: 'help-text' })\n helpText?: string;\n\n /**\n * Set custom error message\n */\n @property({ type: String, attribute: 'invalid-text' })\n customInvalidText?: string;\n\n /* Declare internal reactive properties */\n @state()\n private _isPopoverOpen = false;\n\n @state()\n private _additionalSelectedOptionCount = 0;\n\n @query('.selected-options')\n private selectedOptionsContainer!: HTMLElement;\n\n @queryAll('.selected-options li')\n private selectedOptionsItems!: NodeListOf<HTMLElement>;\n\n @query('.popover')\n private _popover: HTMLElement;\n\n @query('.select-input')\n private _selectInput: HTMLElement;\n\n /**\n * Fires when selection changes\n */\n @event('bl-select') private _onBlSelect: EventDispatcher<ISelectOption<ValueType>[]>;\n\n private _connectedOptions: BlSelectOption<ValueType>[] = [];\n\n private _cleanUpPopover: CleanUpFunction | null = null;\n\n private setOptionsSelected() {\n this._connectedOptions.forEach(\n option =>\n (option.selected =\n this.value === option.value ||\n (Array.isArray(this.value) && this.value.includes(option.value)))\n );\n\n this._selectedOptions = [...this.options.filter(option => option.selected)];\n }\n\n get options() {\n return this._connectedOptions;\n }\n\n get opened() {\n return this._isPopoverOpen;\n }\n\n @state()\n private _selectedOptions: BlSelectOption<ValueType>[] = [];\n\n @state()\n private dirty = false;\n\n get selectedOptions(): BlSelectOption<ValueType>[] {\n return this._selectedOptions;\n }\n\n get additionalSelectedOptionCount() {\n return this._additionalSelectedOptionCount;\n }\n\n validityCallback(): string | void {\n if (this.customInvalidText) {\n return this.customInvalidText;\n }\n const select = document.createElement('select');\n select.required = this.required;\n\n return select.validationMessage;\n }\n\n reportValidity() {\n this.dirty = true;\n return this.checkValidity();\n }\n\n resetFormControl(): void {\n this.value = this._initialValue;\n }\n\n @query('.select-input')\n validationTarget: HTMLElement;\n\n open() {\n this._isPopoverOpen = true;\n this._setupPopover();\n document.addEventListener('click', this._interactOutsideHandler, true);\n document.addEventListener('focus', this._interactOutsideHandler, true);\n }\n\n close() {\n this._isPopoverOpen = false;\n this.focusedOptionIndex = -1;\n this._cleanUpPopover && this._cleanUpPopover();\n document.removeEventListener('click', this._interactOutsideHandler, true);\n document.removeEventListener('focus', this._interactOutsideHandler, true);\n }\n\n private _interactOutsideHandler = (event: MouseEvent | FocusEvent) => {\n const eventPath = event.composedPath() as HTMLElement[];\n\n if (!eventPath?.find(el => el.tagName === 'BL-SELECT')?.contains(this)) {\n this.close();\n }\n };\n\n private _setupPopover() {\n this._cleanUpPopover = autoUpdate(this._selectInput, this._popover, () => {\n computePosition(this._selectInput, this._popover, {\n placement: 'bottom',\n strategy: 'fixed',\n middleware: [\n flip(),\n offset(8),\n size({\n apply(args: MiddlewareState) {\n Object.assign(args.elements.floating.style, {\n width: `${args.elements.reference.getBoundingClientRect().width}px`,\n });\n },\n }),\n ],\n }).then(({ x, y }) => {\n this._popover.style.setProperty('--left', `${x}px`);\n this._popover.style.setProperty('--top', `${y}px`);\n });\n });\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n\n this.form?.addEventListener('submit', (e: SubmitEvent) => {\n if (!this.reportValidity()) {\n e.preventDefault();\n }\n });\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n\n this._cleanUpPopover && this._cleanUpPopover();\n }\n\n private inputTemplate() {\n const inputSelectedOptions = html`<ul class=\"selected-options\">\n ${this._selectedOptions.map(item => html`<li>${item.textContent}</li>`)}\n </ul>`;\n const removeButton = html`<bl-button\n class=\"remove-all\"\n size=\"small\"\n variant=\"tertiary\"\n kind=\"neutral\"\n icon=\"close\"\n @click=${this._onClickRemove}\n ></bl-button>`;\n\n return html`<fieldset\n class=${classMap({\n 'select-input': true,\n 'has-overflowed-options': this._additionalSelectedOptionCount > 0,\n })}\n tabindex=\"${this.disabled ? '-1' : 0}\"\n ?autofocus=${this.autofocus}\n @click=${this.togglePopover}\n >\n <legend><span>${this.label}</span></legend>\n <span class=\"placeholder\">${this.placeholder}</span>\n ${inputSelectedOptions}\n <span class=\"additional-selection-count\">+${this._additionalSelectedOptionCount}</span>\n <div class=\"actions\">\n ${this.multiple ? removeButton : null}\n <bl-icon class=\"dropdown-icon open\" name=\"arrow_up\"></bl-icon>\n\n <bl-icon class=\"dropdown-icon closed\" name=\"arrow_down\"></bl-icon>\n </div>\n </fieldset>`;\n }\n\n render() {\n const invalidMessage = !this.checkValidity()\n ? html`<p id=\"errorMessage\" aria-live=\"polite\" class=\"invalid-text\">\n ${this.validationMessage}\n </p>`\n : '';\n\n const helpMessage = this.helpText ? html`<p class=\"help-text\">${this.helpText}</p>` : '';\n\n const label = this.label ? html`<label>${this.label}</label>` : '';\n\n return html`<div\n class=${classMap({\n 'select-wrapper': true,\n 'select-open': this.opened,\n 'selected': this._selectedOptions.length > 0,\n 'invalid': !this.validity.valid,\n 'dirty': this.dirty,\n })}\n @keydown=${this.handleKeydown}\n >\n ${label} ${this.inputTemplate()}\n <div\n class=\"popover\"\n tabindex=\"${ifDefined(this._isPopoverOpen ? undefined : '-1')}\"\n @bl-select-option=${this._handleSelectOptionEvent}\n >\n <slot></slot>\n </div>\n <div class=\"hint\">${invalidMessage} ${helpMessage}</div>\n </div> `;\n }\n\n private focusedOptionIndex = -1;\n\n private handleKeydown(event: KeyboardEvent) {\n if (this.focusedOptionIndex === -1 && ['Enter', 'Space'].includes(event.code)) {\n this.togglePopover();\n event.preventDefault();\n } else if (this._isPopoverOpen === false && ['ArrowDown', 'ArrowUp'].includes(event.code)) {\n this.open();\n event.preventDefault();\n } else if (event.code === 'Escape') {\n this.close();\n event.preventDefault();\n } else if (this._isPopoverOpen && ['ArrowDown', 'ArrowUp'].includes(event.code)) {\n event.code === 'ArrowDown' && this.focusedOptionIndex++;\n event.code === 'ArrowUp' && this.focusedOptionIndex--;\n\n // Don't exceed array indexes\n this.focusedOptionIndex = Math.max(\n 0,\n Math.min(this.focusedOptionIndex, this.options.length - 1)\n );\n\n this.options[this.focusedOptionIndex].focus();\n\n event.preventDefault();\n }\n }\n\n private togglePopover() {\n this._isPopoverOpen ? this.close() : this.open();\n }\n\n private _handleSelectEvent() {\n this._onBlSelect(\n this._selectedOptions.map(\n option =>\n ({\n value: option.value,\n selected: option.selected,\n text: option.textContent,\n } as ISelectOption<ValueType>)\n )\n );\n }\n\n private _handleSingleSelect(optionItem: BlSelectOption<ValueType>) {\n this.value = optionItem.value;\n\n this._handleSelectEvent();\n this._isPopoverOpen = false;\n }\n\n private _handleMultipleSelect() {\n this.value = this._connectedOptions\n .filter(option => option.selected)\n .map(option => option.value);\n\n this._handleSelectEvent();\n }\n\n private _handleSelectOptionEvent(e: CustomEvent) {\n const optionItem = e.target as BlSelectOption<ValueType>;\n this.dirty = true;\n\n if (this.multiple) {\n this._handleMultipleSelect();\n } else {\n this._handleSingleSelect(optionItem);\n }\n }\n\n private _onClickRemove(e: MouseEvent) {\n e.stopPropagation();\n\n this._connectedOptions\n .filter(option => option.selected)\n .forEach(option => {\n option.selected = false;\n });\n\n this.value = null;\n this._additionalSelectedOptionCount = 0;\n this._handleSelectEvent();\n }\n\n private _checkAdditionalItemCount() {\n if (!this.multiple || !this.selectedOptionsItems || this.selectedOptionsItems.length < 2) {\n this._additionalSelectedOptionCount = 0;\n return;\n }\n\n const firstNonVisibleItemIndex = [...this.selectedOptionsItems].findIndex(\n item => item.offsetLeft > this.selectedOptionsContainer.offsetWidth\n );\n\n if (firstNonVisibleItemIndex > -1) {\n this._additionalSelectedOptionCount =\n this.selectedOptionsItems.length - firstNonVisibleItemIndex;\n } else {\n this._additionalSelectedOptionCount = 0;\n }\n }\n\n protected firstUpdated(): void {\n if (this.value === undefined) {\n this.value = '' as ValueType;\n }\n\n this._initialValue = this._value;\n }\n\n protected updated(_changedProperties: PropertyValues) {\n if (\n _changedProperties.has('multiple') &&\n typeof _changedProperties.get('multiple') === 'boolean'\n ) {\n this.value = null;\n }\n\n this._checkAdditionalItemCount();\n }\n\n /**\n * This method is used by `bl-select-option` component to register itself to bl-select.\n * @param option BlSelectOption reference to be registered\n */\n registerOption(option: BlSelectOption<ValueType>) {\n this._connectedOptions.push(option);\n\n if (option.selected) {\n if (this.multiple) {\n if (!Array.isArray(this.value)) {\n this.value = [];\n }\n this.value = [...this.value, option.value];\n } else {\n this.value = option.value;\n }\n }\n\n this.setOptionsSelected();\n this.requestUpdate();\n }\n\n /**\n * This method is used by `bl-select-option` component to unregister itself from bl-select.\n * @param option BlSelectOption reference to be unregistered\n */\n unregisterOption(option: BlSelectOption<ValueType>) {\n this._connectedOptions.splice(this._connectedOptions.indexOf(option), 1);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'bl-select': BlSelect;\n }\n}\n"],
|
|
5
|
-
"mappings": "6YACO,IAAMA,EAASC,8hLACfC,EAAQF,ECoCf,IAAqBG,EAArB,cAA4EC,EAC1EC,CACF,CAAE,CAFF,kCA+DE,UAAmB,SAMnB,cAAW,GAMX,cAAW,GAMX,cAAW,GAMX,eAAY,GAMZ,gBAAa,GAgBb,KAAQ,eAAiB,GAGzB,KAAQ,+BAAiC,EAmBzC,KAAQ,kBAAiD,CAAC,EAE1D,KAAQ,gBAA0C,KAsBlD,KAAQ,iBAAgD,CAAC,EAGzD,KAAQ,MAAQ,GA+ChB,KAAQ,wBAA2BC,GAAmC,CAnPxE,IAAAC,EAoPI,IAAMC,EAAYF,EAAM,aAAa,GAEhCC,EAAAC,GAAA,YAAAA,EAAW,KAAKC,GAAMA,EAAG,UAAY,eAArC,MAAAF,EAAmD,SAAS,OAC/D,KAAK,MAAM,CAEf,EA6GA,KAAQ,mBAAqB,GA7T7B,WAAW,QAAyB,CAClC,MAAO,CAACG,CAAK,CACf,CAmBA,IAAI,OAAwC,CAC1C,OAAO,KAA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AAC,GA5FjDpB,EA6FnB,0BAMAiC,EAAA,CADCb,EAAS,CAAE,KAAM,OAAQ,UAAW,WAAY,CAAC,GAlG/BpB,EAmGnB,wBAMAiC,EAAA,CADCb,EAAS,CAAE,KAAM,OAAQ,UAAW,cAAe,CAAC,GAxGlCpB,EAyGnB,iCAIQiC,EAAA,CADPC,EAAM,GA5GYlC,EA6GX,8BAGAiC,EAAA,CADPC,EAAM,GA/GYlC,EAgHX,8CAGAiC,EAAA,CADPE,EAAM,mBAAmB,GAlHPnC,EAmHX,wCAGAiC,EAAA,CADPb,EAAS,sBAAsB,GArHbpB,EAsHX,oCAGAiC,EAAA,CADPE,EAAM,UAAU,GAxHEnC,EAyHX,wBAGAiC,EAAA,CADPE,EAAM,eAAe,GA3HHnC,EA4HX,4BAKoBiC,EAAA,CAA3B9B,EAAM,WAAW,GAjICH,EAiIS,2BA0BpBiC,EAAA,CADPC,EAAM,GA1JYlC,EA2JX,gCAGAiC,EAAA,CADPC,EAAM,GA7JYlC,EA8JX,qBA8BRiC,EAAA,CADCE,EAAM,eAAe,GA3LHnC,EA4LnB,gCA5LmBA,EAArBiC,EAAA,CADCb,EAAc,WAAW,GACLpB",
|
|
6
|
-
"names": ["styles", "i", "bl_select_default", "BlSelect", "FormControlMixin", "s", "event", "_a", "eventPath", "el", "bl_select_default", "val", "formData", "option", "select", "P", "z", "b", "O", "k", "args", "x", "y", "e", "inputSelectedOptions", "item", "removeButton", "o", "invalidMessage", "helpMessage", "label", "l", "optionItem", "firstNonVisibleItemIndex", "_changedProperties", "requiredValidator", "__decorateClass", "t", "i"]
|
|
7
|
-
}
|
package/dist/chunk-PUNHEAEI.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-XQN3H7RG.js";import{a as f}from"./chunk-EPJ347EQ.js";import{a as g}from"./chunk-DJOD4BTL.js";import{a as u}from"./chunk-KGIPG6EV.js";import{a as p}from"./chunk-OLPYXE2P.js";import{a}from"./chunk-KPAWUBRO.js";import{a as n}from"./chunk-23UFIOHV.js";import{a as h,b as o,f as d,g as v,h as i,i as c,j as b}from"./chunk-57PTZNIL.js";import{a as t}from"./chunk-NZ3RGSR6.js";var V=h`:host{display:inline-block;width:200px;position:relative}.wrapper{--border-color:var(--bl-color-neutral-lighter);--icon-color:var(--bl-color-neutral-light);--text-color:var(--bl-color-neutral-darker);--height:var(--bl-size-2xl);--input-font:var(--bl-font-body-text-2);--line-height:var(--bl-font-body-text-2-line-height);--icon-size:var(--line-height);--icon-gap:var(--bl-size-xs);--padding-vertical:calc((var(--height) - var(--line-height)) / 2);--padding-horizontal:var(--bl-size-xs);--autofill-bg-color:var(--bl-color-primary-contrast);--label-padding:var(--bl-size-3xs);--background-color:var(--bl-color-neutral-full);display:grid;position:relative;gap:var(--bl-size-3xs)}.wrapper:focus-within{--border-color:var(--bl-color-primary);--icon-color:var(--bl-color-primary)}.wrapper.dirty.invalid{--border-color:var(--bl-color-danger);--icon-color:var(--bl-color-danger)}:host([size='large']) .wrapper{--height:var(--bl-size-3xl);--padding-vertical:var(--bl-size-xs);--padding-horizontal:var(--bl-size-m);--icon-gap:var(--bl-size-m)}:host([size='small']) .wrapper{--height:var(--bl-size-xl);--input-font:var(--bl-font-body-text-3);--padding-vertical:var(--bl-size-3xs);--icon-size:var(--bl-font-body-text-3-line-height);--icon-gap:var(--bl-size-2xs)}.input-wrapper{--border-size:1px;outline:0;display:flex;box-sizing:border-box;gap:var(--padding-vertical);height:var(--height);border:solid var(--border-size) var(--border-color);padding:0 calc(var(--padding-horizontal) - var(--label-padding) - var(--border-size));background-color:var(--background-color);border-radius:var(--bl-size-3xs);margin:0;width:0;min-width:100%}:host([disabled]) .wrapper{cursor:not-allowed;--background-color:var(--bl-color-neutral-lightest);--text-color:var(--bl-color-neutral-light)}.wrapper:has(input:autofill){--background-color:var(--autofill-bg-color)}.wrapper:has(input:-webkit-autofill){--background-color:var(--autofill-bg-color)}.input-wrapper legend,label{padding:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}label{position:absolute;max-width:max-content;transition:all ease-in .1s;font:var(--input-font);top:var(--padding-vertical);left:var(--padding-horizontal);right:var(--padding-horizontal);pointer-events:none;color:var(--bl-color-neutral-light)}.has-icon label{right:calc(var(--padding-horizontal) + var(--icon-size) + var(--padding-vertical))}.input-wrapper legend{height:0;visibility:hidden;display:none}.input-wrapper legend span{padding:0 var(--label-padding);display:inline-block;opacity:0;visibility:visible}input{width:100%;align-self:stretch;outline:0;border:0;padding:0;padding-left:var(--label-padding);font:var(--input-font);color:var(--text-color);-webkit-text-fill-color:var(--text-color);background-color:transparent}input::-webkit-credentials-auto-fill-button{color:red}:where(.wrapper:focus-within,.wrapper.has-value) input{padding-left:var(--label-padding)}input:disabled{cursor:not-allowed}input:autofill{background-color:var(--autofill-bg-color);box-shadow:0 0 0 40rem var(--autofill-bg-color) inset}input:-webkit-autofill{background-color:var(--autofill-bg-color);box-shadow:0 0 0 40rem var(--autofill-bg-color) inset}.icon{display:flex;align-items:center;gap:var(--icon-gap);flex-basis:var(--icon-size);align-self:center;height:var(--icon-size);margin-right:var(--label-padding)}bl-icon:not(.reveal-icon){font-size:var(--icon-size);color:var(--icon-color);height:var(--icon-size)}.reveal-button bl-icon{display:none}bl-icon[name='eye_on']{display:inline-block}.password-visible bl-icon[name='eye_on']{display:none}.password-visible bl-icon[name='eye_off']{display:inline-block}.wrapper:not(.has-icon) .icon{display:none}.hint{display:none;font:var(--bl-font-body-text-3)}.hint p{padding:0;margin:0}::placeholder{color:var(--bl-color-neutral-light);-webkit-text-fill-color:var(--bl-color-neutral-light)}:host([label]) ::placeholder{color:transparent;-webkit-text-fill-color:transparent;transition:color ease-out .4s}:host([label-fixed]) ::placeholder,:host :focus-within ::placeholder{color:var(--bl-color-neutral-light);-webkit-text-fill-color:var(--bl-color-neutral-light)}:host([label-fixed]) label{position:static;transition:none;transform:none;pointer-events:initial;font:var(--bl-font-caption);color:var(--bl-color-neutral-dark);padding:0}:host([label-fixed]) legend{display:none}:host(:not([label-fixed])) :focus-within label,:host(:not([label-fixed])) .has-value label{top:0;left:calc(var(--padding-horizontal) - var(--label-padding));right:calc(var(--padding-horizontal) - var(--label-padding));transform:translateY(-50%);font:var(--bl-font-caption);color:var(--bl-color-neutral-dark);padding:0 var(--label-padding);pointer-events:initial;z-index:var(--bl-index-base)}:host([label]:not([label-fixed])) :where(:focus-within,.has-value) legend{max-width:100%;font:var(--bl-font-caption);display:block}.error-icon,.invalid-text{display:none}.dirty.invalid label,.invalid-text,.error-icon{color:var(--bl-color-danger)}.help-text{color:var(--bl-color-neutral-dark)}:host([help-text]) .hint,.dirty.invalid .hint{display:block}.dirty.invalid .invalid-text{display:block}.dirty.invalid .help-text{display:none}.dirty.invalid .error-icon{display:inline-block}.dirty.invalid .custom-icon ~ .error-icon{display:none}`,y=V;var e=class extends g(d){constructor(){super(...arguments);this.type="text";this.value="";this.required=!1;this.autofocus=!1;this.size="medium";this.disabled=!1;this.labelFixed=!1;this.onKeydown=r=>{r.code==="Enter"&&this.form&&u(this.form)};this.onError=()=>{this.onInvalid(this.internals.validity)};this.dirty=!1;this.passwordVisible=!1;this.inputId=Math.random().toString(36).substring(2)}static get styles(){return[y]}set customInvalidText(r){this._customInvalidText=r,this.setValue(this.value)}get customInvalidText(){return this._customInvalidText}connectedCallback(){var r;super.connectedCallback(),this.addEventListener("keydown",this.onKeydown),this.addEventListener("invalid",this.onError),(r=this.form)==null||r.addEventListener("submit",()=>{this.reportValidity()})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.onKeydown),this.removeEventListener("invalid",this.onError)}textVisibilityToggle(){this.passwordVisible=!this.passwordVisible}validityCallback(){var r;return this.customInvalidText||((r=this.validationTarget)==null?void 0:r.validationMessage)}forceCustomError(){this.validationTarget.setCustomValidity(this.customInvalidText||"An error occurred"),this.setValue(this.value),this.reportValidity()}clearCustomError(){this.validationTarget.setCustomValidity(""),this.setValue(this.value),this.reportValidity()}reportValidity(){return this.dirty=!0,this.requestUpdate(),this.checkValidity()}inputHandler(r){let l=r.target.value;this.value=l,this.onInput(l)}changeHandler(r){let l=r.target.value;this.dirty=!0,this.value=l,this.onChange(l)}firstUpdated(){this.setValue(this.value)}async updated(r){r.has("value")&&(this.setValue(this.value),await this.validationComplete,this.requestUpdate())}render(){let r=this.checkValidity()?"":o`<p id="errorMessage" aria-live="polite" class="invalid-text">
|
|
2
|
-
${this.validationMessage}
|
|
3
|
-
</p>`,l=this.helpText?o`<p id="helpText" class="help-text">${this.helpText}</p>`:"",x=this.icon?o`<bl-icon class="custom-icon" name="${this.icon}"></bl-icon>`:"",w=this.label?o`<label for=${this.inputId}>${this.label}</label>`:"",s=this.type==="password",k=s?o`<bl-button
|
|
4
|
-
size="small"
|
|
5
|
-
kind="neutral"
|
|
6
|
-
variant="tertiary"
|
|
7
|
-
class="${p({"reveal-button":!0,"password-visible":this.passwordVisible})}"
|
|
8
|
-
aria-label="Toggle password reveal"
|
|
9
|
-
@bl-click="${this.textVisibilityToggle}"
|
|
10
|
-
>
|
|
11
|
-
<bl-icon class="reveal-icon" slot="icon" name="eye_on"></bl-icon>
|
|
12
|
-
<bl-icon class="reveal-icon" slot="icon" name="eye_off"></bl-icon>
|
|
13
|
-
</bl-button>`:"",z={wrapper:!0,dirty:this.dirty,invalid:!this.checkValidity(),"has-icon":s||this.icon||this.dirty&&!this.checkValidity(),"has-value":this.value!==null&&this.value!==""},$=this.passwordVisible?"text":"password",T=s?$:this.type;return o`<div class=${p(z)}>
|
|
14
|
-
${w}
|
|
15
|
-
<fieldset class="input-wrapper">
|
|
16
|
-
<legend><span>${this.label}</span></legend>
|
|
17
|
-
<input
|
|
18
|
-
id=${this.inputId}
|
|
19
|
-
type=${T}
|
|
20
|
-
.value=${f(this.value)}
|
|
21
|
-
inputmode="${a(this.inputmode)}"
|
|
22
|
-
?autofocus=${this.autofocus}
|
|
23
|
-
autocomplete="${a(this.autocomplete)}"
|
|
24
|
-
placeholder="${a(this.placeholder)}"
|
|
25
|
-
minlength="${a(this.minlength)}"
|
|
26
|
-
maxlength="${a(this.maxlength)}"
|
|
27
|
-
min="${a(this.min)}"
|
|
28
|
-
max="${a(this.max)}"
|
|
29
|
-
pattern="${a(this.pattern)}"
|
|
30
|
-
step="${a(this.step)}"
|
|
31
|
-
?required=${this.required}
|
|
32
|
-
?disabled=${this.disabled}
|
|
33
|
-
@change=${this.changeHandler}
|
|
34
|
-
@input=${this.inputHandler}
|
|
35
|
-
aria-invalid=${this.checkValidity()?"false":"true"}
|
|
36
|
-
aria-describedby=${a(this.helpText?"helpText":void 0)}
|
|
37
|
-
aria-errormessage=${a(this.checkValidity()?void 0:"errorMessage")}
|
|
38
|
-
/>
|
|
39
|
-
<div class="icon">
|
|
40
|
-
${k} ${x}
|
|
41
|
-
<bl-icon class="error-icon" name="alert"></bl-icon>
|
|
42
|
-
</div>
|
|
43
|
-
</fieldset>
|
|
44
|
-
<div class="hint">${r} ${l}</div>
|
|
45
|
-
</div>`}};e.shadowRootOptions={...d.shadowRootOptions,delegatesFocus:!0},e.formControlValidators=m,t([b("input")],e.prototype,"validationTarget",2),t([i({reflect:!0})],e.prototype,"name",2),t([i({reflect:!0})],e.prototype,"type",2),t([i({reflect:!0})],e.prototype,"label",2),t([i({reflect:!0})],e.prototype,"placeholder",2),t([i({reflect:!0})],e.prototype,"value",2),t([i({type:Boolean,reflect:!0})],e.prototype,"required",2),t([i({type:Number,reflect:!0})],e.prototype,"minlength",2),t([i({type:Number,reflect:!0})],e.prototype,"maxlength",2),t([i({type:Number,reflect:!0})],e.prototype,"min",2),t([i({type:Number,reflect:!0})],e.prototype,"max",2),t([i({type:String,reflect:!0})],e.prototype,"pattern",2),t([i({type:Number,reflect:!0})],e.prototype,"step",2),t([i({type:String,reflect:!0})],e.prototype,"autocomplete",2),t([i({type:String,reflect:!0})],e.prototype,"inputmode",2),t([i({type:Boolean,reflect:!0})],e.prototype,"autofocus",2),t([i({type:String,reflect:!0})],e.prototype,"icon",2),t([i({type:String,reflect:!0})],e.prototype,"size",2),t([i({type:Boolean,reflect:!0})],e.prototype,"disabled",2),t([i({type:Boolean,attribute:"label-fixed",reflect:!0})],e.prototype,"labelFixed",2),t([i({type:String,attribute:"invalid-text",reflect:!0})],e.prototype,"customInvalidText",1),t([i({type:String,attribute:"help-text",reflect:!0})],e.prototype,"helpText",2),t([n("bl-change")],e.prototype,"onChange",2),t([n("bl-input")],e.prototype,"onInput",2),t([n("bl-invalid")],e.prototype,"onInvalid",2),t([c()],e.prototype,"dirty",2),t([c()],e.prototype,"passwordVisible",2),e=t([v("bl-input")],e);export{e as a};
|
|
46
|
-
//# sourceMappingURL=chunk-PUNHEAEI.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/input/bl-input.css", "../src/components/input/bl-input.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`:host{display:inline-block;width:200px;position:relative}.wrapper{--border-color:var(--bl-color-neutral-lighter);--icon-color:var(--bl-color-neutral-light);--text-color:var(--bl-color-neutral-darker);--height:var(--bl-size-2xl);--input-font:var(--bl-font-body-text-2);--line-height:var(--bl-font-body-text-2-line-height);--icon-size:var(--line-height);--icon-gap:var(--bl-size-xs);--padding-vertical:calc((var(--height) - var(--line-height)) / 2);--padding-horizontal:var(--bl-size-xs);--autofill-bg-color:var(--bl-color-primary-contrast);--label-padding:var(--bl-size-3xs);--background-color:var(--bl-color-neutral-full);display:grid;position:relative;gap:var(--bl-size-3xs)}.wrapper:focus-within{--border-color:var(--bl-color-primary);--icon-color:var(--bl-color-primary)}.wrapper.dirty.invalid{--border-color:var(--bl-color-danger);--icon-color:var(--bl-color-danger)}:host([size='large']) .wrapper{--height:var(--bl-size-3xl);--padding-vertical:var(--bl-size-xs);--padding-horizontal:var(--bl-size-m);--icon-gap:var(--bl-size-m)}:host([size='small']) .wrapper{--height:var(--bl-size-xl);--input-font:var(--bl-font-body-text-3);--padding-vertical:var(--bl-size-3xs);--icon-size:var(--bl-font-body-text-3-line-height);--icon-gap:var(--bl-size-2xs)}.input-wrapper{--border-size:1px;outline:0;display:flex;box-sizing:border-box;gap:var(--padding-vertical);height:var(--height);border:solid var(--border-size) var(--border-color);padding:0 calc(var(--padding-horizontal) - var(--label-padding) - var(--border-size));background-color:var(--background-color);border-radius:var(--bl-size-3xs);margin:0;width:0;min-width:100%}:host([disabled]) .wrapper{cursor:not-allowed;--background-color:var(--bl-color-neutral-lightest);--text-color:var(--bl-color-neutral-light)}.wrapper:has(input:autofill){--background-color:var(--autofill-bg-color)}.wrapper:has(input:-webkit-autofill){--background-color:var(--autofill-bg-color)}.input-wrapper legend,label{padding:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}label{position:absolute;max-width:max-content;transition:all ease-in .1s;font:var(--input-font);top:var(--padding-vertical);left:var(--padding-horizontal);right:var(--padding-horizontal);pointer-events:none;color:var(--bl-color-neutral-light)}.has-icon label{right:calc(var(--padding-horizontal) + var(--icon-size) + var(--padding-vertical))}.input-wrapper legend{height:0;visibility:hidden;display:none}.input-wrapper legend span{padding:0 var(--label-padding);display:inline-block;opacity:0;visibility:visible}input{width:100%;align-self:stretch;outline:0;border:0;padding:0;padding-left:var(--label-padding);font:var(--input-font);color:var(--text-color);-webkit-text-fill-color:var(--text-color);background-color:transparent}input::-webkit-credentials-auto-fill-button{color:red}:where(.wrapper:focus-within,.wrapper.has-value) input{padding-left:var(--label-padding)}input:disabled{cursor:not-allowed}input:autofill{background-color:var(--autofill-bg-color);box-shadow:0 0 0 40rem var(--autofill-bg-color) inset}input:-webkit-autofill{background-color:var(--autofill-bg-color);box-shadow:0 0 0 40rem var(--autofill-bg-color) inset}.icon{display:flex;align-items:center;gap:var(--icon-gap);flex-basis:var(--icon-size);align-self:center;height:var(--icon-size);margin-right:var(--label-padding)}bl-icon:not(.reveal-icon){font-size:var(--icon-size);color:var(--icon-color);height:var(--icon-size)}.reveal-button bl-icon{display:none}bl-icon[name='eye_on']{display:inline-block}.password-visible bl-icon[name='eye_on']{display:none}.password-visible bl-icon[name='eye_off']{display:inline-block}.wrapper:not(.has-icon) .icon{display:none}.hint{display:none;font:var(--bl-font-body-text-3)}.hint p{padding:0;margin:0}::placeholder{color:var(--bl-color-neutral-light);-webkit-text-fill-color:var(--bl-color-neutral-light)}:host([label]) ::placeholder{color:transparent;-webkit-text-fill-color:transparent;transition:color ease-out .4s}:host([label-fixed]) ::placeholder,:host :focus-within ::placeholder{color:var(--bl-color-neutral-light);-webkit-text-fill-color:var(--bl-color-neutral-light)}:host([label-fixed]) label{position:static;transition:none;transform:none;pointer-events:initial;font:var(--bl-font-caption);color:var(--bl-color-neutral-dark);padding:0}:host([label-fixed]) legend{display:none}:host(:not([label-fixed])) :focus-within label,:host(:not([label-fixed])) .has-value label{top:0;left:calc(var(--padding-horizontal) - var(--label-padding));right:calc(var(--padding-horizontal) - var(--label-padding));transform:translateY(-50%);font:var(--bl-font-caption);color:var(--bl-color-neutral-dark);padding:0 var(--label-padding);pointer-events:initial;z-index:var(--bl-index-base)}:host([label]:not([label-fixed])) :where(:focus-within,.has-value) legend{max-width:100%;font:var(--bl-font-caption);display:block}.error-icon,.invalid-text{display:none}.dirty.invalid label,.invalid-text,.error-icon{color:var(--bl-color-danger)}.help-text{color:var(--bl-color-neutral-dark)}:host([help-text]) .hint,.dirty.invalid .hint{display:block}.dirty.invalid .invalid-text{display:block}.dirty.invalid .help-text{display:none}.dirty.invalid .error-icon{display:inline-block}.dirty.invalid .custom-icon ~ .error-icon{display:none}`;\nexport default styles;\n", "import { CSSResultGroup, html, LitElement, TemplateResult, PropertyValues } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { FormControlMixin } from '@open-wc/form-control';\nimport { submit } from '@open-wc/form-helpers';\nimport { live } from 'lit/directives/live.js';\nimport { event, EventDispatcher } from '../../utilities/event';\nimport { innerInputValidators } from '../../utilities/form-control';\nimport 'element-internals-polyfill';\nimport '../icon/bl-icon';\nimport '../button/bl-button';\n\nimport style from './bl-input.css';\n\nexport type InputSize = 'small' | 'medium' | 'large';\n/**\n * @tag bl-input\n * @summary Baklava Input component\n */\n@customElement('bl-input')\nexport default class BlInput extends FormControlMixin(LitElement) {\n static get styles(): CSSResultGroup {\n return [style];\n }\n static shadowRootOptions = {...LitElement.shadowRootOptions, delegatesFocus: true};\n\n static formControlValidators = innerInputValidators;\n\n @query('input')\n validationTarget: HTMLInputElement;\n\n /**\n * Sets name of the input\n */\n @property({ reflect: true })\n name?: string;\n\n /**\n * Type of the input. It's used to set `type` attribute of native input inside. Only `text`, `number` and `password` is supported for now.\n */\n @property({ reflect: true })\n type: 'text' | 'password' | 'number' | 'tel' | 'url' = 'text';\n\n /**\n * Sets label of the input\n */\n @property({ reflect: true })\n label?: string;\n\n /**\n * Sets placeholder of the input\n */\n @property({ reflect: true })\n placeholder?: string;\n\n /**\n * Sets initial value of the input\n */\n @property({ reflect: true })\n value = '';\n\n /**\n * Makes input a mandatory field\n */\n @property({ type: Boolean, reflect: true })\n required = false;\n\n /**\n * Sets minimum length of the input\n */\n @property({ type: Number, reflect: true })\n minlength?: number;\n\n /**\n * Sets maximum length of the input\n */\n @property({ type: Number, reflect: true })\n maxlength?: number;\n\n /**\n * Sets the smallest number can be entered to a `number` input\n */\n @property({ type: Number, reflect: true })\n min?: number;\n\n /**\n * Sets the biggest number can be entered to a `number` input\n */\n @property({ type: Number, reflect: true })\n max?: number;\n\n /**\n * Sets a regex pattern form the input validation\n */\n @property({ type: String, reflect: true })\n pattern?: string;\n\n /**\n * Sets the increase and decrease step to a `number` input\n */\n @property({ type: Number, reflect: true })\n step?: number;\n\n /**\n * Hints browser to autocomplete this field.\n */\n @property({ type: String, reflect: true })\n autocomplete: string;\n\n /**\n * Sets the input mode of the field for asking browser to show the desired keyboard.\n */\n @property({ type: String, reflect: true })\n inputmode: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';\n\n /**\n * Sets input to get keyboard focus automatically\n */\n @property({ type: Boolean, reflect: true })\n autofocus = false;\n\n /**\n * Sets the custom icon name. `bl-icon` component is used to show an icon\n */\n @property({ type: String, reflect: true })\n icon?: string;\n\n /**\n * Sets input size.\n */\n @property({ type: String, reflect: true })\n size?: InputSize = 'medium';\n\n /**\n * Disables the input\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * Makes label as fixed positioned\n */\n @property({ type: Boolean, attribute: 'label-fixed', reflect: true })\n labelFixed = false;\n\n /**\n * Overrides error message. This message will override default error messages\n */\n @property({ type: String, attribute: 'invalid-text', reflect: true })\n set customInvalidText(value: string) {\n this._customInvalidText = value;\n this.setValue(this.value);\n }\n\n get customInvalidText(): string {\n return this._customInvalidText;\n }\n\n private _customInvalidText: string;\n\n /**\n * Adds help text\n */\n @property({ type: String, attribute: 'help-text', reflect: true })\n helpText?: string;\n\n /**\n * Fires when an alteration to the element's value is committed by the user. Unlike the input event, the change event is not necessarily fired for each alteration to an element's value.\n */\n @event('bl-change') private onChange: EventDispatcher<string>;\n\n /**\n * Fires when the value of an input element has been changed.\n */\n @event('bl-input') private onInput: EventDispatcher<string>;\n\n /**\n * Fires when the value of an input element has been changed.\n */\n @event('bl-invalid') private onInvalid: EventDispatcher<ValidityState>;\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('keydown', this.onKeydown);\n this.addEventListener('invalid', this.onError);\n\n this.form?.addEventListener('submit', () => {\n this.reportValidity();\n });\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('keydown', this.onKeydown);\n this.removeEventListener('invalid', this.onError);\n }\n\n private onKeydown = (event: KeyboardEvent): void => {\n if (event.code === 'Enter' && this.form) {\n submit(this.form);\n }\n };\n\n private onError = (): void => {\n this.onInvalid(this.internals.validity);\n };\n\n @state() private dirty = false;\n\n @state() private passwordVisible = false;\n\n private textVisibilityToggle() {\n this.passwordVisible = !this.passwordVisible;\n }\n\n validityCallback(): string | void {\n return this.customInvalidText || this.validationTarget?.validationMessage;\n }\n\n /**\n * Force to set input as in invalid state.\n */\n forceCustomError() {\n this.validationTarget.setCustomValidity(this.customInvalidText || 'An error occurred');\n this.setValue(this.value);\n this.reportValidity();\n }\n\n /**\n * Clear forced invalid state\n */\n clearCustomError() {\n this.validationTarget.setCustomValidity('');\n this.setValue(this.value);\n this.reportValidity();\n }\n\n reportValidity() {\n this.dirty = true;\n this.requestUpdate();\n return this.checkValidity();\n }\n\n private inputHandler(event: Event) {\n const value = (event.target as HTMLInputElement).value;\n\n this.value = value;\n this.onInput(value);\n }\n\n private changeHandler(event: Event) {\n const value = (event.target as HTMLInputElement).value;\n\n this.dirty = true;\n this.value = value;\n this.onChange(value);\n }\n\n firstUpdated() {\n this.setValue(this.value);\n }\n\n protected async updated(changedProperties: PropertyValues) {\n if (changedProperties.has('value')) {\n this.setValue(this.value);\n\n await this.validationComplete;\n\n this.requestUpdate();\n }\n }\n\n private inputId = Math.random().toString(36).substring(2);\n\n render(): TemplateResult {\n const invalidMessage = !this.checkValidity()\n ? html`<p id=\"errorMessage\" aria-live=\"polite\" class=\"invalid-text\">\n ${this.validationMessage}\n </p>`\n : ``;\n const helpMessage = this.helpText\n ? html`<p id=\"helpText\" class=\"help-text\">${this.helpText}</p>`\n : ``;\n\n const icon = this.icon ? html`<bl-icon class=\"custom-icon\" name=\"${this.icon}\"></bl-icon>` : '';\n const label = this.label ? html`<label for=${this.inputId}>${this.label}</label>` : '';\n const passwordInput = this.type === 'password';\n\n const revealButton = passwordInput\n ? html`<bl-button\n size=\"small\"\n kind=\"neutral\"\n variant=\"tertiary\"\n class=\"${classMap({\n 'reveal-button': true,\n 'password-visible': this.passwordVisible,\n })}\"\n aria-label=\"Toggle password reveal\"\n @bl-click=\"${this.textVisibilityToggle}\"\n >\n <bl-icon class=\"reveal-icon\" slot=\"icon\" name=\"eye_on\"></bl-icon>\n <bl-icon class=\"reveal-icon\" slot=\"icon\" name=\"eye_off\"></bl-icon>\n </bl-button>`\n : '';\n\n const classes = {\n 'wrapper': true,\n 'dirty': this.dirty,\n 'invalid': !this.checkValidity(),\n 'has-icon': passwordInput || this.icon || (this.dirty && !this.checkValidity()),\n 'has-value': this.value !== null && this.value !== '',\n };\n\n const passwordType = this.passwordVisible ? 'text' : 'password';\n const inputType = passwordInput ? passwordType : this.type;\n\n return html`<div class=${classMap(classes)}>\n ${label}\n <fieldset class=\"input-wrapper\">\n <legend><span>${this.label}</span></legend>\n <input\n id=${this.inputId}\n type=${inputType}\n .value=${live(this.value)}\n inputmode=\"${ifDefined(this.inputmode)}\"\n ?autofocus=${this.autofocus}\n autocomplete=\"${ifDefined(this.autocomplete)}\"\n placeholder=\"${ifDefined(this.placeholder)}\"\n minlength=\"${ifDefined(this.minlength)}\"\n maxlength=\"${ifDefined(this.maxlength)}\"\n min=\"${ifDefined(this.min)}\"\n max=\"${ifDefined(this.max)}\"\n pattern=\"${ifDefined(this.pattern)}\"\n step=\"${ifDefined(this.step)}\"\n ?required=${this.required}\n ?disabled=${this.disabled}\n @change=${this.changeHandler}\n @input=${this.inputHandler}\n aria-invalid=${this.checkValidity() ? 'false' : 'true'}\n aria-describedby=${ifDefined(this.helpText ? 'helpText' : undefined)}\n aria-errormessage=${ifDefined(this.checkValidity() ? undefined : 'errorMessage')}\n />\n <div class=\"icon\">\n ${revealButton} ${icon}\n <bl-icon class=\"error-icon\" name=\"alert\"></bl-icon>\n </div>\n </fieldset>\n <div class=\"hint\">${invalidMessage} ${helpMessage}</div>\n </div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'bl-input': BlInput;\n }\n}\n"],
|
|
5
|
-
"mappings": "6YACO,IAAMA,EAASC,goKACfC,EAAQF,ECmBf,IAAqBG,EAArB,cAAqCC,EAAiBC,CAAU,CAAE,CAAlE,kCAqBE,UAAuD,OAkBvD,WAAQ,GAMR,cAAW,GAsDX,e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B,EAAA,CADCE,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,QAAS,EAAK,CAAC,GA/I9CxB,EAgJnB,wBAK4BsB,EAAA,CAA3BnB,EAAM,WAAW,GArJCH,EAqJS,wBAKDsB,EAAA,CAA1BnB,EAAM,UAAU,GA1JEH,EA0JQ,uBAKEsB,EAAA,CAA5BnB,EAAM,YAAY,GA/JAH,EA+JU,yBA4BZsB,EAAA,CAAhBG,EAAM,GA3LYzB,EA2LF,qBAEAsB,EAAA,CAAhBG,EAAM,GA7LYzB,EA6LF,+BA7LEA,EAArBsB,EAAA,CADCE,EAAc,UAAU,GACJxB",
|
|
6
|
-
"names": ["styles", "i", "bl_input_default", "BlInput", "FormControlMixin", "s", "event", "submit", "bl_input_default", "value", "_a", "changedProperties", "invalidMessage", "y", "helpMessage", "icon", "label", "passwordInput", "revealButton", "o", "classes", "passwordType", "inputType", "l", "innerInputValidators", "__decorateClass", "i", "e", "t"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/progress-indicator/bl-progress-indicator.css", "../src/components/progress-indicator/bl-progress-indicator.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`.progress-indicator{--max:100;--value:0;--value-color:var(--bl-color-success);--height:var(--bl-size-2xs);--radius:var(--bl-border-radius-s);position:relative;background-color:var(--bl-color-neutral-lightest);height:var(--height);border-radius:var(--radius);width:100%}.progress-indicator::before{content:'';position:absolute;height:100%;width:calc(100% / var(--max) * var(--value));background-color:var(--value-color);border-radius:var(--radius);transition:width ease var(--bl-progress-indicator-transition-duration,.2s)}:host([size='small']) .progress-indicator{--height:var(--bl-size-3xs);--radius:var(--bl-border-radius-xs)}:host([size='large']) .progress-indicator{--height:var(--bl-size-xs);--radius:var(--bl-border-radius-m)}:host([failed]) .progress-indicator{--value-color:var(--bl-color-danger)}`;\nexport default styles;\n", "import { CSSResultGroup, html, LitElement, TemplateResult } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport style from './bl-progress-indicator.css';\n\nexport type ProgressIndicatorSize = 'small' | 'medium' | 'large';\n\n/**\n * @tag bl-progress-indicator\n * @summary Baklava Progress Indicator component\n *\n * @cssproperty [--bl-progress-indicator-transition-duration=.2s] Duration of the transition of progress bar\n * @property {max} [max=100]\n * @property {number} [value=0]\n */\n\n@customElement('bl-progress-indicator')\nexport default class BlProgressIndicator extends LitElement {\n static get styles(): CSSResultGroup {\n return style;\n }\n\n @query('.progress-indicator') private wrapper: HTMLElement;\n\n /**\n * Sets the size\n */\n @property({ type: String, reflect: true })\n size: ProgressIndicatorSize = 'medium';\n\n /**\n * Sets the status\n */\n @property({ type: Boolean, reflect: true })\n failed = false;\n\n /**\n * Sets the max\n */\n @property({ type: Number })\n get max() {\n return this._max;\n }\n set max(max: number) {\n this._max = max;\n this.updateCssVariable();\n }\n\n /**\n * Sets the value\n */\n @property({ type: Number })\n get value() {\n return this._value;\n }\n set value(value: number) {\n this._value = value;\n this.updateCssVariable();\n }\n\n @state() private _max = 100;\n @state() private _value = 0;\n\n async updateCssVariable() {\n await this.updateComplete;\n this.wrapper.style.setProperty('--value', `${this.value}`);\n this.wrapper.style.setProperty('--max', `${this.max}`);\n }\n\n render(): TemplateResult {\n return html`<div\n class=\"progress-indicator\"\n role=\"progressbar\"\n aria-valuemax=\"${this._max}\"\n aria-valuenow=\"${this._value}\"\n ></div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'bl-progress-indicator': BlProgressIndicator;\n }\n}\n"],
|
|
5
|
-
"mappings": "0HACO,IAAMA,EAAS,yyBACfC,EAAQD,ECcf,IAAqBE,EAArB,cAAiDC,CAAW,CAA5D,kCAWE,UAA8B,SAM9B,YAAS,GA0BA,KAAQ,KAAO,IACf,KAAQ,OAAS,EA3C1B,WAAW,QAAyB,CAClC,OAAOC,CACT,CAoBA,IAAI,KAAM,CACR,OAAO,KAAK,IACd,CACA,IAAI,IAAIC,EAAa,CACnB,KAAK,KAAOA,EACZ,KAAK,kBAAkB,CACzB,CAMA,IAAI,OAAQ,CACV,OAAO,KAAK,MACd,CACA,IAAI,MAAMC,EAAe,CACvB,KAAK,OAASA,EACd,KAAK,kBAAkB,CACzB,CAKA,MAAM,mBAAoB,CACxB,MAAM,KAAK,eACX,KAAK,QAAQ,MAAM,YAAY,UAAW,GAAG,KAAK,OAAO,EACzD,KAAK,QAAQ,MAAM,YAAY,QAAS,GAAG,KAAK,KAAK,CACvD,CAEA,QAAyB,CACvB,OAAOC;AAAA;AAAA;AAAA,uBAGY,KAAK;AAAA,uBACL,KAAK;AAAA,YAE1B,CACF,EAvDwCC,EAAA,CAArCC,EAAM,qBAAqB,GALTP,EAKmB,uBAMtCM,EAAA,CADCE,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAVtBR,EAWnB,oBAMAM,EAAA,CADCE,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAhBvBR,EAiBnB,sBAMIM,EAAA,CADHE,EAAS,CAAE,KAAM,MAAO,CAAC,GAtBPR,EAuBf,mBAYAM,EAAA,CADHE,EAAS,CAAE,KAAM,MAAO,CAAC,GAlCPR,EAmCf,qBAQaM,EAAA,CAAhBG,EAAM,GA3CYT,EA2CF,oBACAM,EAAA,CAAhBG,EAAM,GA5CYT,EA4CF,sBA5CEA,EAArBM,EAAA,CADCE,EAAc,uBAAuB,GACjBR",
|
|
6
|
-
"names": ["styles", "bl_progress_indicator_default", "BlProgressIndicator", "s", "bl_progress_indicator_default", "max", "value", "y", "__decorateClass", "i", "e", "t"]
|
|
7
|
-
}
|
package/dist/chunk-VDV6ZXM7.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{a as b}from"./chunk-KPAWUBRO.js";import{a as d}from"./chunk-23UFIOHV.js";import{a as s,b as c,f as h,g as n,h as i}from"./chunk-57PTZNIL.js";import{a as r}from"./chunk-NZ3RGSR6.js";var p=s`:host{display:inline-block;cursor:pointer}span{display:inline-block}.switch{--track-height:var(--bl-size-xl);--track-width:var(--bl-size-4xl);--thumb-offset:var(--bl-size-4xs);--thumb-height:calc(var(--track-height) - calc(2 * var(--thumb-offset)));--thumb-width:var(--thumb-height);--animation-duration:var(--bl-switch-animation-duration,300ms);--switch-color:var(--bl-switch-color-off,var(--bl-color-neutral-lighter));background-color:var(--switch-color);border-radius:var(--bl-border-radius-pill);height:var(--track-height);transition-property:background-color;transition-duration:var(--animation-duration);width:var(--track-width)}.switch::before{content:'';display:inline-block;background-color:white;border-radius:var(--bl-border-radius-circle);height:var(--thumb-height);left:var(--thumb-offset);position:relative;top:var(--thumb-offset);transition:transform;transition-duration:var(--animation-duration);width:var(--thumb-width)}:host([checked]) .switch{--switch-color:var(--bl-switch-color-on,var(--bl-switch-color,var(--bl-color-primary)))}:host([checked]) .switch::before{transform:translateX(calc(var(--track-width) - var(--thumb-width) - calc(2 * var(--thumb-offset))))}:host([disabled]) .switch{opacity:.5}:host([disabled]){cursor:not-allowed}.switch:focus-visible{position:relative;outline:0}.switch:focus-visible::after{border:2px solid var(--switch-color);border-radius:var(--bl-border-radius-pill);content:'';position:absolute;top:-3px;right:-3px;bottom:-3px;left:-3px}`,u=p;var m="bl-switch",t=class extends h{constructor(){super(...arguments);this.checked=!1;this.disabled=!1}static get styles(){return[u]}toggle(){this.disabled||(this.checked=!this.checked,this.onToggle(this.checked))}handleKeyDown(e){(e.code==="Enter"||e.code==="Space")&&(this.toggle(),e.preventDefault())}render(){var a,o,l;let e=(l=(o=this.ariaLabel)!=null?o:(a=this.attributes.getNamedItem("aria-label"))==null?void 0:a.value)!=null?l:void 0;return c`
|
|
2
|
-
<span
|
|
3
|
-
class="switch"
|
|
4
|
-
role="switch"
|
|
5
|
-
aria-checked=${this.checked}
|
|
6
|
-
aria-readonly=${!!this.disabled}
|
|
7
|
-
@click=${this.toggle}
|
|
8
|
-
@keydown=${this.handleKeyDown}
|
|
9
|
-
aria-label=${b(e)}
|
|
10
|
-
tabindex="0"
|
|
11
|
-
>
|
|
12
|
-
</span>
|
|
13
|
-
`}};r([i({type:Boolean,reflect:!0})],t.prototype,"checked",2),r([i({type:Boolean,reflect:!0})],t.prototype,"disabled",2),r([d("bl-switch-toggle")],t.prototype,"onToggle",2),t=r([n(m)],t);export{m as a,t as b};
|
|
14
|
-
//# sourceMappingURL=chunk-VDV6ZXM7.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/switch/bl-switch.css", "../src/components/switch/bl-switch.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`:host{display:inline-block;cursor:pointer}span{display:inline-block}.switch{--track-height:var(--bl-size-xl);--track-width:var(--bl-size-4xl);--thumb-offset:var(--bl-size-4xs);--thumb-height:calc(var(--track-height) - calc(2 * var(--thumb-offset)));--thumb-width:var(--thumb-height);--animation-duration:var(--bl-switch-animation-duration,300ms);--switch-color:var(--bl-switch-color-off,var(--bl-color-neutral-lighter));background-color:var(--switch-color);border-radius:var(--bl-border-radius-pill);height:var(--track-height);transition-property:background-color;transition-duration:var(--animation-duration);width:var(--track-width)}.switch::before{content:'';display:inline-block;background-color:white;border-radius:var(--bl-border-radius-circle);height:var(--thumb-height);left:var(--thumb-offset);position:relative;top:var(--thumb-offset);transition:transform;transition-duration:var(--animation-duration);width:var(--thumb-width)}:host([checked]) .switch{--switch-color:var(--bl-switch-color-on,var(--bl-switch-color,var(--bl-color-primary)))}:host([checked]) .switch::before{transform:translateX(calc(var(--track-width) - var(--thumb-width) - calc(2 * var(--thumb-offset))))}:host([disabled]) .switch{opacity:.5}:host([disabled]){cursor:not-allowed}.switch:focus-visible{position:relative;outline:0}.switch:focus-visible::after{border:2px solid var(--switch-color);border-radius:var(--bl-border-radius-pill);content:'';position:absolute;top:-3px;right:-3px;bottom:-3px;left:-3px}`;\nexport default styles;\n", "import { CSSResultGroup, html, LitElement, TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { customElement, property } from 'lit/decorators.js';\nimport { event, EventDispatcher } from '../../utilities/event';\nimport style from './bl-switch.css';\n\nexport const blSwitchTag = 'bl-switch';\n\n/**\n * @tag bl-switch\n * @summary Baklava Switch component\n *\n * @cssproperty [--bl-switch-color-on=--bl-color-primary] Set the checked color\n * @cssproperty [--bl-switch-color-off=--bl-color-neutral-lighter] Set the unchecked color\n * @cssproperty [--bl-switch-animation-duration=300ms] Set the animation duration of switch toggle\n */\n@customElement(blSwitchTag)\nexport default class BlSwitch extends LitElement {\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n /**\n * Sets the checked state for switch\n */\n @property({ type: Boolean, reflect: true })\n checked = false;\n\n /**\n * Sets the disabled state for switch\n */\n @property({ type: Boolean, reflect: true })\n disabled? = false;\n\n /**\n * Fires whenever user toggles the switch\n */\n @event('bl-switch-toggle') private onToggle: EventDispatcher<boolean>;\n\n toggle() {\n if (this.disabled) return;\n\n this.checked = !this.checked;\n this.onToggle(this.checked);\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n if (event.code === 'Enter' || event.code === 'Space') {\n this.toggle();\n event.preventDefault();\n }\n }\n\n render(): TemplateResult {\n const ariaLabel =\n this.ariaLabel ?? this.attributes.getNamedItem('aria-label')?.value ?? undefined;\n\n return html`\n <span\n class=\"switch\"\n role=\"switch\"\n aria-checked=${this.checked}\n aria-readonly=${!!this.disabled}\n @click=${this.toggle}\n @keydown=${this.handleKeyDown}\n aria-label=${ifDefined(ariaLabel)}\n tabindex=\"0\"\n >\n </span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [blSwitchTag]: BlSwitch;\n }\n}\n"],
|
|
5
|
-
"mappings": "4LACO,IAAMA,EAASC,m9CACfC,EAAQF,ECIR,IAAMG,EAAc,YAWNC,EAArB,cAAsCC,CAAW,CAAjD,kCASE,aAAU,GAMV,cAAY,GAdZ,WAAW,QAAyB,CAClC,MAAO,CAACC,CAAK,CACf,CAmBA,QAAS,CACH,KAAK,WAET,KAAK,QAAU,CAAC,KAAK,QACrB,KAAK,SAAS,KAAK,OAAO,EAC5B,CAEQ,cAAcC,EAAsB,EACtCA,EAAM,OAAS,SAAWA,EAAM,OAAS,WAC3C,KAAK,OAAO,EACZA,EAAM,eAAe,EAEzB,CAEA,QAAyB,CArD3B,IAAAC,EAAAC,EAAAC,EAsDI,IAAMC,GACJD,GAAAD,EAAA,KAAK,YAAL,KAAAA,GAAkBD,EAAA,KAAK,WAAW,aAAa,YAAY,IAAzC,YAAAA,EAA4C,QAA9D,KAAAE,EAAuE,OAEzE,OAAOE;AAAA;AAAA;AAAA;AAAA,uBAIY,KAAK;AAAA,wBACJ,CAAC,CAAC,KAAK;AAAA,iBACd,KAAK;AAAA,mBACH,KAAK;AAAA,qBACHC,EAAUF,CAAS;AAAA;AAAA;AAAA;AAAA,KAKtC,CACF,EA7CEG,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GARvBX,EASnB,uBAMAU,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAdvBX,EAenB,wBAKmCU,EAAA,CAAlCP,EAAM,kBAAkB,GApBNH,EAoBgB,wBApBhBA,EAArBU,EAAA,CADCC,EAAcZ,CAAW,GACLC",
|
|
6
|
-
"names": ["styles", "i", "bl_switch_default", "blSwitchTag", "BlSwitch", "s", "bl_switch_default", "event", "_a", "_b", "_c", "ariaLabel", "y", "l", "__decorateClass", "e"]
|
|
7
|
-
}
|
package/dist/chunk-VXGOQPWU.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{a as f}from"./chunk-DJOD4BTL.js";import{a as m}from"./chunk-OLPYXE2P.js";import{a}from"./chunk-23UFIOHV.js";import{a as s,b as n,f as d,g as c,h as i,i as u,j as v}from"./chunk-57PTZNIL.js";import{a as t}from"./chunk-NZ3RGSR6.js";var y=s`:host{display:flex;flex-direction:row}fieldset{border:0;padding:0}legend{font:var(--bl-font-title-3-medium);color:var(--bl-color-neutral-darker)}.options{display:flex;flex-flow:var(--bl-radio-direction,column) wrap;gap:var(--bl-size-m);margin-block:var(--bl-size-xs)}`,g=y;var p="bl-radio-group",b="bl-radio-change",r=class extends f(d){constructor(){super(...arguments);this.value="";this.required=!1;this.focusedOptionIndex=0}static get styles(){return[g]}get options(){return[].slice.call(this.querySelectorAll(h))}get availableOptions(){return this.options.filter(e=>!e.disabled)}updated(e){e.has("value")&&(this.setValue(this.value),this.onChange(this.value))}handleOptionChecked(e){let o=e.target;this.setValue(o.value),this.onChange(o.value)}handleKeyDown(e){if(["ArrowDown","ArrowRight"].includes(e.key))this.focusedOptionIndex++;else if(["ArrowUp","ArrowLeft"].includes(e.key))this.focusedOptionIndex--;else if([" "].includes(e.key)){this.availableOptions[this.focusedOptionIndex].select();return}else return;this.focusedOptionIndex=Math.max(0,Math.min(this.focusedOptionIndex,this.availableOptions.length-1)),this.availableOptions[this.focusedOptionIndex].focus(),e.preventDefault()}connectedCallback(){super.connectedCallback(),this.tabIndex=0,this.addEventListener("focus",this.handleFocus),this.addEventListener("keydown",this.handleKeyDown)}handleFocus(){this.availableOptions[this.focusedOptionIndex].focus()}render(){return n`<fieldset role="radiogroup" aria-labelledby="label" aria-required=${this.required}>
|
|
2
|
-
<legend>${this.label}</legend>
|
|
3
|
-
<div class="options" @bl-checked=${this.handleOptionChecked}>
|
|
4
|
-
<slot></slot>
|
|
5
|
-
</div>
|
|
6
|
-
</fieldset>`}};t([i({type:String})],r.prototype,"label",2),t([i()],r.prototype,"value",2),t([i({type:Boolean,reflect:!0})],r.prototype,"required",2),t([a("bl-radio-change")],r.prototype,"onChange",2),r=t([c(p)],r);var C=s`:host{display:inline-block;cursor:pointer;outline:0}.wrapper{--size:var(--bl-size-m);outline:0}#label{display:flex;font:var(--bl-font-title-3-regular);height:var(--size);line-height:normal;vertical-align:middle;margin-block:0;color:var(--bl-color-neutral-darker)}#label::before{content:'';display:inline-block;box-sizing:border-box;width:var(--size);height:var(--size);background-color:white;border-radius:var(--bl-border-radius-circle);border:solid 1px var(--bl-color-neutral-lighter);margin-right:var(--bl-size-2xs);vertical-align:middle}.selected #label::before{border-width:var(--bl-size-3xs);border-color:var(--bl-color-primary)}:host(:hover) #label,.selected #label,:host(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) #label,.selected #label{color:var(--bl-color-primary)}:host([disabled]){cursor:not-allowed;pointer-events:none}:host([disabled]) .wrapper{--size:calc(var(--bl-size-m) - 2px)}:host([disabled]) #label{color:var(--bl-color-neutral-light)}:host([disabled]) #label::before{background-color:var(--bl-color-neutral-lightest);border-width:0;box-shadow:0 0 0 1px var(--bl-color-neutral-lighter)}:host([disabled]) .selected #label::before{background-color:var(--bl-color-neutral-light);border-color:var(--bl-color-neutral-lightest);border-width:calc(var(--bl-size-3xs) - 1px)}.wrapper:focus-visible #label::before{box-shadow:0 0 0 1px white,0 0 0 3px var(--bl-color-primary)}`,x=C;var h="bl-radio",W="bl-checked",l=class extends d{constructor(){super(...arguments);this.disabled=!1;this.selected=!1;this.handleFieldValueChange=e=>{let o=e.detail;this.selected=o===this.value}}static get styles(){return[x]}select(){this.selected=!0,this.onChecked(this.value)}get checked(){return this.selected}focus(){this.radioElement.tabIndex=0,this.radioElement.focus(),this.onFocus(this.value)}blur(){this.radioElement.tabIndex=-1,this.onBlur(this.value)}connectedCallback(){var e;super.connectedCallback(),this.field=this.closest(p),this.field||console.warn("bl-radio is designed to be used inside a bl-radio-group",this),(e=this.field)==null||e.addEventListener(b,this.handleFieldValueChange)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.field)==null||e.removeEventListener(b,this.handleFieldValueChange)}render(){let e=m({wrapper:!0,selected:this.selected});return n`<div
|
|
7
|
-
class=${e}
|
|
8
|
-
role="radio"
|
|
9
|
-
aria-labelledby="label"
|
|
10
|
-
aria-disabled=${this.disabled}
|
|
11
|
-
aria-readonly=${this.disabled}
|
|
12
|
-
@blur=${this.blur}
|
|
13
|
-
@click=${this.select}
|
|
14
|
-
>
|
|
15
|
-
<p id="label"><slot></slot></p>
|
|
16
|
-
</div>`}};t([i()],l.prototype,"name",2),t([i()],l.prototype,"value",2),t([i({type:Boolean,reflect:!0})],l.prototype,"disabled",2),t([u()],l.prototype,"selected",2),t([a("bl-checked")],l.prototype,"onChecked",2),t([a("bl-focus")],l.prototype,"onFocus",2),t([a("bl-blur")],l.prototype,"onBlur",2),t([v("[role=radio]")],l.prototype,"radioElement",2),l=t([c(h)],l);export{h as a,W as b,l as c,p as d,b as e,r as f};
|
|
17
|
-
//# sourceMappingURL=chunk-VXGOQPWU.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/radio-group/bl-radio-group.css", "../src/components/radio-group/bl-radio-group.ts", "../src/components/radio-group/radio/bl-radio.css", "../src/components/radio-group/radio/bl-radio.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`:host{display:flex;flex-direction:row}fieldset{border:0;padding:0}legend{font:var(--bl-font-title-3-medium);color:var(--bl-color-neutral-darker)}.options{display:flex;flex-flow:var(--bl-radio-direction,column) wrap;gap:var(--bl-size-m);margin-block:var(--bl-size-xs)}`;\nexport default styles;\n", "import { FormControlMixin } from '@open-wc/form-control';\nimport { CSSResultGroup, html, LitElement, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport 'element-internals-polyfill';\nimport { event, EventDispatcher } from '../../utilities/event';\nimport style from './bl-radio-group.css';\nimport BlRadio, { blRadioTag } from './radio/bl-radio';\n\nexport const blRadioGroupTag = 'bl-radio-group';\n\nexport const blChangeEventName = 'bl-radio-change';\n\n/**\n * @tag bl-radio-group\n * @summary Baklava Button component\n *\n * @cssproperty [--bl-radio-direction=row] Can be used for showing radio options as columns instead of rows. Options are `row` or `column`\n */\n@customElement(blRadioGroupTag)\nexport default class BlRadioGroup extends FormControlMixin(LitElement) {\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n /**\n * Sets the radio group label\n */\n @property({ type: String })\n label: string;\n\n /**\n * Set and gets the actual value of the field\n */\n @property()\n value = '';\n\n /**\n * Sets option as required\n */\n @property({ type: Boolean, reflect: true })\n required = false;\n\n get options(): BlRadio[] {\n return [].slice.call(this.querySelectorAll(blRadioTag));\n }\n\n get availableOptions(): BlRadio[] {\n return this.options.filter(option => !option.disabled);\n }\n\n updated(changedProperties: Map<string, unknown>): void {\n if (changedProperties.has('value')) {\n this.setValue(this.value);\n this.onChange(this.value);\n }\n }\n\n /**\n * Fires when radio group value changed\n */\n @event('bl-radio-change') private onChange: EventDispatcher<string>;\n\n private focusedOptionIndex = 0;\n\n private handleOptionChecked(event: CustomEvent) {\n const checkedOption = event.target as BlRadio;\n this.setValue(checkedOption.value);\n this.onChange(checkedOption.value);\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n // Next option\n if (['ArrowDown', 'ArrowRight'].includes(event.key)) {\n this.focusedOptionIndex++;\n\n // Previous option\n } else if (['ArrowUp', 'ArrowLeft'].includes(event.key)) {\n this.focusedOptionIndex--;\n\n // Select option\n } else if ([' '].includes(event.key)) {\n this.availableOptions[this.focusedOptionIndex].select();\n return;\n } else {\n // Other keys are not our interest here\n return;\n }\n\n // Don't exceed array indexes\n this.focusedOptionIndex = Math.max(\n 0,\n Math.min(this.focusedOptionIndex, this.availableOptions.length - 1)\n );\n\n this.availableOptions[this.focusedOptionIndex].focus();\n\n event.preventDefault();\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n\n this.tabIndex = 0;\n this.addEventListener('focus', this.handleFocus);\n this.addEventListener('keydown', this.handleKeyDown);\n }\n\n private handleFocus() {\n this.availableOptions[this.focusedOptionIndex].focus();\n }\n\n render(): TemplateResult {\n return html`<fieldset role=\"radiogroup\" aria-labelledby=\"label\" aria-required=${this.required}>\n <legend>${this.label}</legend>\n <div class=\"options\" @bl-checked=${this.handleOptionChecked}>\n <slot></slot>\n </div>\n </fieldset>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [blRadioGroupTag]: BlRadioGroup;\n }\n interface HTMLElementEventMap {\n [blChangeEventName]: CustomEvent<string>;\n }\n}\n", "import {css} from 'lit';\nexport const styles = css`:host{display:inline-block;cursor:pointer;outline:0}.wrapper{--size:var(--bl-size-m);outline:0}#label{display:flex;font:var(--bl-font-title-3-regular);height:var(--size);line-height:normal;vertical-align:middle;margin-block:0;color:var(--bl-color-neutral-darker)}#label::before{content:'';display:inline-block;box-sizing:border-box;width:var(--size);height:var(--size);background-color:white;border-radius:var(--bl-border-radius-circle);border:solid 1px var(--bl-color-neutral-lighter);margin-right:var(--bl-size-2xs);vertical-align:middle}.selected #label::before{border-width:var(--bl-size-3xs);border-color:var(--bl-color-primary)}:host(:hover) #label,.selected #label,:host(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) #label,.selected #label{color:var(--bl-color-primary)}:host([disabled]){cursor:not-allowed;pointer-events:none}:host([disabled]) .wrapper{--size:calc(var(--bl-size-m) - 2px)}:host([disabled]) #label{color:var(--bl-color-neutral-light)}:host([disabled]) #label::before{background-color:var(--bl-color-neutral-lightest);border-width:0;box-shadow:0 0 0 1px var(--bl-color-neutral-lighter)}:host([disabled]) .selected #label::before{background-color:var(--bl-color-neutral-light);border-color:var(--bl-color-neutral-lightest);border-width:calc(var(--bl-size-3xs) - 1px)}.wrapper:focus-visible #label::before{box-shadow:0 0 0 1px white,0 0 0 3px var(--bl-color-primary)}`;\nexport default styles;\n", "import { CSSResultGroup, html, LitElement, TemplateResult } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { event, EventDispatcher } from '../../../utilities/event';\nimport type BlRadioGroup from '../bl-radio-group';\nimport { blChangeEventName, blRadioGroupTag } from '../bl-radio-group';\nimport style from './bl-radio.css';\n\nexport const blRadioTag = 'bl-radio';\n\nexport const blCheckedEventName = 'bl-checked';\n\n/**\n * @tag bl-radio\n * @summary Baklava Radio Option component\n */\n@customElement(blRadioTag)\nexport default class BlRadio extends LitElement {\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n @property()\n name: string;\n\n @property()\n value: string;\n\n /**\n * Sets option as disabled\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @state() private selected = false;\n\n /**\n * Fires when radio is checked\n */\n @event('bl-checked') private onChecked: EventDispatcher<string>;\n\n /**\n * Fires when radio is blurred\n */\n @event('bl-focus') private onFocus: EventDispatcher<string>;\n\n /**\n * Fires when radio is blurred\n */\n @event('bl-blur') private onBlur: EventDispatcher<string>;\n\n /**\n * Sets this option selected\n */\n select() {\n this.selected = true;\n this.onChecked(this.value);\n }\n\n /**\n * Readonly property to determine if option is currently checked\n */\n get checked() {\n return this.selected;\n }\n\n @query('[role=radio]') private radioElement: HTMLElement;\n\n /**\n * Focuses this option\n */\n focus() {\n this.radioElement.tabIndex = 0;\n this.radioElement.focus();\n this.onFocus(this.value);\n }\n\n /**\n * Blurs from this option\n */\n blur() {\n this.radioElement.tabIndex = -1;\n this.onBlur(this.value);\n }\n\n private handleFieldValueChange = (event: CustomEvent<string>) => {\n const newValue = event.detail;\n this.selected = newValue === this.value;\n };\n\n private field: BlRadioGroup | null;\n\n connectedCallback(): void {\n super.connectedCallback();\n\n this.field = this.closest<BlRadioGroup>(blRadioGroupTag);\n\n if (!this.field) {\n console.warn('bl-radio is designed to be used inside a bl-radio-group', this);\n }\n\n this.field?.addEventListener(blChangeEventName, this.handleFieldValueChange);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.field?.removeEventListener(blChangeEventName, this.handleFieldValueChange);\n }\n\n render(): TemplateResult {\n const classes = classMap({\n wrapper: true,\n selected: this.selected,\n });\n\n return html`<div\n class=${classes}\n role=\"radio\"\n aria-labelledby=\"label\"\n aria-disabled=${this.disabled}\n aria-readonly=${this.disabled}\n @blur=${this.blur}\n @click=${this.select}\n >\n <p id=\"label\"><slot></slot></p>\n </div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [blRadioTag]: BlRadio;\n }\n interface HTMLElementEventMap {\n [blCheckedEventName]: CustomEvent<string>;\n }\n}\n"],
|
|
5
|
-
"mappings": "6OACO,IAAMA,EAASC,+QACfC,EAAQF,ECMR,IAAMG,EAAkB,iBAElBC,EAAoB,kBASZC,EAArB,cAA0CC,EAAiBC,CAAU,CAAE,CAAvE,kCAeE,WAAQ,GAMR,cAAW,GAsBX,KAAQ,mBAAqB,EA1C7B,WAAW,QAAyB,CAClC,MAAO,CAACC,CAAK,CACf,CAoBA,IAAI,SAAqB,CACvB,MAAO,CAAC,EAAE,MAAM,KAAK,KAAK,iBAAiBC,CAAU,CAAC,CACxD,CAEA,IAAI,kBAA8B,CAChC,OAAO,KAAK,QAAQ,OAAOC,GAAU,CAACA,EAAO,QAAQ,CACvD,CAEA,QAAQC,EAA+C,CACjDA,EAAkB,IAAI,OAAO,IAC/B,KAAK,SAAS,KAAK,KAAK,EACxB,KAAK,SAAS,KAAK,KAAK,EAE5B,CASQ,oBAAoBC,EAAoB,CAC9C,IAAMC,EAAgBD,EAAM,OAC5B,KAAK,SAASC,EAAc,KAAK,EACjC,KAAK,SAASA,EAAc,KAAK,CACnC,CAEQ,cAAcD,EAAsB,CAE1C,GAAI,CAAC,YAAa,YAAY,EAAE,SAASA,EAAM,GAAG,EAChD,KAAK,6BAGI,CAAC,UAAW,WAAW,EAAE,SAASA,EAAM,GAAG,EACpD,KAAK,6BAGI,CAAC,GAAG,EAAE,SAASA,EAAM,GAAG,EAAG,CACpC,KAAK,iBAAiB,KAAK,kBAAkB,EAAE,OAAO,EACtD,WAGA,QAIF,KAAK,mBAAqB,KAAK,IAC7B,EACA,KAAK,IAAI,KAAK,mBAAoB,KAAK,iBAAiB,OAAS,CAAC,CACpE,EAEA,KAAK,iBAAiB,KAAK,kBAAkB,EAAE,MAAM,EAErDA,E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,KAAK,MAAQ,KAAK,QAAsBC,CAAe,EAElD,KAAK,OACR,QAAQ,KAAK,0DAA2D,IAAI,GAG9ED,EAAA,KAAK,QAAL,MAAAA,EAAY,iBAAiBE,EAAmB,KAAK,uBACvD,CAEA,sBAA6B,CAxG/B,IAAAF,EAyGI,MAAM,qBAAqB,GAC3BA,EAAA,KAAK,QAAL,MAAAA,EAAY,oBAAoBE,EAAmB,KAAK,uBAC1D,CAEA,QAAyB,CACvB,IAAMC,EAAUC,EAAS,CACvB,QAAS,GACT,SAAU,KAAK,QACjB,CAAC,EAED,OAAOC;AAAA,cACGF;AAAA;AAAA;AAAA,sBAGQ,KAAK;AAAA,sBACL,KAAK;AAAA,cACb,KAAK;AAAA,eACJ,KAAK;AAAA;AAAA;AAAA,WAIlB,CACF,EAxGEG,EAAA,CADCC,EAAS,GALSZ,EAMnB,oBAGAW,EAAA,CADCC,EAAS,GARSZ,EASnB,qBAMAW,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAdvBZ,EAenB,wBAEiBW,EAAA,CAAhBE,EAAM,GAjBYb,EAiBF,wBAKYW,EAAA,CAA5BT,EAAM,YAAY,GAtBAF,EAsBU,yBAKFW,EAAA,CAA1BT,EAAM,UAAU,GA3BEF,EA2BQ,uBAKDW,EAAA,CAAzBT,EAAM,SAAS,GAhCGF,EAgCO,sBAiBKW,EAAA,CAA9BG,EAAM,cAAc,GAjDFd,EAiDY,4BAjDZA,EAArBW,EAAA,CADCC,EAAcd,CAAU,GACJE",
|
|
6
|
-
"names": ["styles", "i", "bl_radio_group_default", "blRadioGroupTag", "blChangeEventName", "BlRadioGroup", "FormControlMixin", "s", "bl_radio_group_default", "blRadioTag", "option", "changedProperties", "event", "checkedOption", "y", "__decorateClass", "e", "styles", "i", "bl_radio_default", "blRadioTag", "blCheckedEventName", "BlRadio", "s", "event", "newValue", "bl_radio_default", "_a", "blRadioGroupTag", "blChangeEventName", "classes", "o", "y", "__decorateClass", "e", "t", "i"]
|
|
7
|
-
}
|