@trendyol/baklava 2.0.0-beta.94 → 2.0.0-beta.95

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/README.md CHANGED
@@ -1,7 +1,8 @@
1
- <p align="center"><img src="https://user-images.githubusercontent.com/127687/194415334-0dc8fbf2-3e87-44ed-b23a-0cc9da767b11.png" alt="Baklava Design System Logo" /></p>
1
+ <p align="center"><img src="https://user-images.githubusercontent.com/127687/233114483-c5b0a8e7-c072-4ced-a7b5-76bce1be4b21.svg" width="200" alt="Baklava Design System Logo" /></p>
2
2
 
3
3
  <h1 align="center">Baklava Design System</h1>
4
4
 
5
+
5
6
  [![npm package stable](https://img.shields.io/npm/v/@trendyol/baklava.svg)](https://www.npmjs.com/package/@trendyol/baklava) [![npm package beta](https://img.shields.io/npm/v/@trendyol/baklava/beta.svg)](https://www.npmjs.com/package/@trendyol/baklava/v/beta) [![License](https://img.shields.io/github/license/trendyol/baklava)](https://github.com/Trendyol/baklava/blob/next/LICENSE) [![jsDelivr hits (npm scoped)](https://img.shields.io/jsdelivr/npm/hm/@trendyol/baklava)](https://www.jsdelivr.com/package/npm/@trendyol/baklava) [![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)
6
7
 
7
8
  Baklava is a design system provided by [Trendyol](https://github.com/trendyol) to create a consistent UI/UX for app users.
package/dist/baklava.js CHANGED
@@ -1,2 +1,2 @@
1
- import{b as S}from"./chunk-N53HXW4A.js";import{a as b}from"./chunk-TQBAGFBF.js";import{a as I}from"./chunk-YTUAZIEF.js";import{a as P}from"./chunk-6FK4ZU5B.js";import{a as g}from"./chunk-YMS5JP47.js";import{a as h}from"./chunk-32HGEMZF.js";import{b as T,d as G}from"./chunk-AXRP3K2X.js";import{b as D}from"./chunk-FSYC7NDP.js";import{a as B}from"./chunk-Y4UXIJSO.js";import{a as m}from"./chunk-QASRATPF.js";import{a as s}from"./chunk-MCS3XLXD.js";import{a as x}from"./chunk-PUNHEAEI.js";import"./chunk-XQN3H7RG.js";import"./chunk-3B64VOWB.js";import{a as w}from"./chunk-4PG6AOX7.js";import"./chunk-ANYJUR6Q.js";import{a as n}from"./chunk-RFAEPGC3.js";import{c,f as i}from"./chunk-VXGOQPWU.js";import{a as r}from"./chunk-6UPKDZRW.js";import{a}from"./chunk-5JHQZCHW.js";import{b as f,e as p}from"./chunk-5AIFOXPM.js";import"./chunk-EPJ347EQ.js";import"./chunk-DJOD4BTL.js";import{a as d}from"./chunk-CI65YME7.js";import{a as u}from"./chunk-AZ42S4YP.js";import{b as l}from"./chunk-KGIPG6EV.js";import"./chunk-OLPYXE2P.js";import"./chunk-KPAWUBRO.js";import{a as o,b as e,c as t}from"./chunk-3SON7X7S.js";import"./chunk-RLMJN536.js";import"./chunk-23UFIOHV.js";import"./chunk-57PTZNIL.js";import"./chunk-NZ3RGSR6.js";export{r as BlAlert,a as BlBadge,l as BlButton,f as BlCheckbox,p as BlCheckboxGroup,d as BlDialog,u as BlDrawer,G as BlDropdown,D as BlDropdownGroup,T as BlDropdownItem,t as BlIcon,x as BlInput,B as BlPagination,w as BlPopover,n as BlProgressIndicator,c as BlRadio,i as BlRadioGroup,m as BlSelect,s as BlSelectOption,S as BlSwitch,I as BlTab,b as BlTabGroup,P as BlTabPanel,g as BlTextarea,h as BlTooltip,e as getIconPath,o as setIconPath};
1
+ import{b as S}from"./chunk-YSAEBLYM.js";import{a as b}from"./chunk-TQBAGFBF.js";import{a as I}from"./chunk-YTUAZIEF.js";import{a as P}from"./chunk-6FK4ZU5B.js";import{a as g}from"./chunk-YMS5JP47.js";import{a as h}from"./chunk-32HGEMZF.js";import{b as T,d as G}from"./chunk-AXRP3K2X.js";import{b as D}from"./chunk-FSYC7NDP.js";import{a as B}from"./chunk-Y4UXIJSO.js";import{a as m}from"./chunk-QASRATPF.js";import{a as s}from"./chunk-MCS3XLXD.js";import{a as x}from"./chunk-PUNHEAEI.js";import"./chunk-XQN3H7RG.js";import"./chunk-3B64VOWB.js";import{a as w}from"./chunk-4PG6AOX7.js";import"./chunk-ANYJUR6Q.js";import{a as n}from"./chunk-RFAEPGC3.js";import{c,f as i}from"./chunk-VXGOQPWU.js";import{a as r}from"./chunk-6UPKDZRW.js";import{a}from"./chunk-5JHQZCHW.js";import{b as f,e as p}from"./chunk-5AIFOXPM.js";import"./chunk-EPJ347EQ.js";import"./chunk-DJOD4BTL.js";import{a as d}from"./chunk-CI65YME7.js";import{a as u}from"./chunk-AZ42S4YP.js";import{b as l}from"./chunk-KGIPG6EV.js";import"./chunk-OLPYXE2P.js";import"./chunk-KPAWUBRO.js";import{a as o,b as e,c as t}from"./chunk-3SON7X7S.js";import"./chunk-RLMJN536.js";import"./chunk-23UFIOHV.js";import"./chunk-57PTZNIL.js";import"./chunk-NZ3RGSR6.js";export{r as BlAlert,a as BlBadge,l as BlButton,f as BlCheckbox,p as BlCheckboxGroup,d as BlDialog,u as BlDrawer,G as BlDropdown,D as BlDropdownGroup,T as BlDropdownItem,t as BlIcon,x as BlInput,B as BlPagination,w as BlPopover,n as BlProgressIndicator,c as BlRadio,i as BlRadioGroup,m as BlSelect,s as BlSelectOption,S as BlSwitch,I as BlTab,b as BlTabGroup,P as BlTabPanel,g as BlTextarea,h as BlTooltip,e as getIconPath,o as setIconPath};
2
2
  //# sourceMappingURL=baklava.js.map
@@ -0,0 +1,14 @@
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-YSAEBLYM.js.map
@@ -0,0 +1,7 @@
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 * @deprecated [--bl-switch-color=--bl-color-primary] Set the checked color. Renamed to --bl-switch-color-on.\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,YAYNC,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,CAtD3B,IAAAC,EAAAC,EAAAC,EAuDI,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
+ }
@@ -4,7 +4,9 @@ export declare const blSwitchTag = "bl-switch";
4
4
  * @tag bl-switch
5
5
  * @summary Baklava Switch component
6
6
  *
7
- * @cssproperty [--bl-switch-color=--bl-color-primary] Set the accent color
7
+ * @deprecated [--bl-switch-color=--bl-color-primary] Set the checked color. Renamed to --bl-switch-color-on.
8
+ * @cssproperty [--bl-switch-color-on=--bl-color-primary] Set the checked color
9
+ * @cssproperty [--bl-switch-color-off=--bl-color-neutral-lighter] Set the unchecked color
8
10
  * @cssproperty [--bl-switch-animation-duration=300ms] Set the animation duration of switch toggle
9
11
  */
10
12
  export default class BlSwitch extends LitElement {
@@ -1 +1 @@
1
- {"version":3,"file":"bl-switch.d.ts","sourceRoot":"","sources":["../../../src/components/switch/bl-switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAMvE,eAAO,MAAM,WAAW,cAAc,CAAC;AAEvC;;;;;;GAMG;AAEH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU;IAC9C,MAAM,KAAK,MAAM,IAAI,cAAc,CAElC;IAED;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,QAAQ,CAAC,sBAAS;IAElB;;OAEG;IACwB,OAAO,CAAC,QAAQ,CAA2B;IAEtE,MAAM;IAON,OAAO,CAAC,aAAa;IAOrB,MAAM,IAAI,cAAc;CAkBzB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;KACzB;CACF"}
1
+ {"version":3,"file":"bl-switch.d.ts","sourceRoot":"","sources":["../../../src/components/switch/bl-switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAMvE,eAAO,MAAM,WAAW,cAAc,CAAC;AAEvC;;;;;;;;GAQG;AAEH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU;IAC9C,MAAM,KAAK,MAAM,IAAI,cAAc,CAElC;IAED;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,QAAQ,CAAC,sBAAS;IAElB;;OAEG;IACwB,OAAO,CAAC,QAAQ,CAA2B;IAEtE,MAAM;IAON,OAAO,CAAC,aAAa;IAOrB,MAAM,IAAI,cAAc;CAkBzB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;KACzB;CACF"}
@@ -1,2 +1,2 @@
1
- import{a,b}from"../../chunk-N53HXW4A.js";import"../../chunk-KPAWUBRO.js";import"../../chunk-23UFIOHV.js";import"../../chunk-57PTZNIL.js";import"../../chunk-NZ3RGSR6.js";export{a as blSwitchTag,b as default};
1
+ import{a,b}from"../../chunk-YSAEBLYM.js";import"../../chunk-KPAWUBRO.js";import"../../chunk-23UFIOHV.js";import"../../chunk-57PTZNIL.js";import"../../chunk-NZ3RGSR6.js";export{a as blSwitchTag,b as default};
2
2
  //# sourceMappingURL=bl-switch.js.map
@@ -1665,10 +1665,15 @@
1665
1665
  "name": "BlSwitch",
1666
1666
  "cssProperties": [
1667
1667
  {
1668
- "description": "Set the accent color",
1669
- "name": "--bl-switch-color",
1668
+ "description": "Set the checked color",
1669
+ "name": "--bl-switch-color-on",
1670
1670
  "default": "--bl-color-primary"
1671
1671
  },
1672
+ {
1673
+ "description": "Set the unchecked color",
1674
+ "name": "--bl-switch-color-off",
1675
+ "default": "--bl-color-neutral-lighter"
1676
+ },
1672
1677
  {
1673
1678
  "description": "Set the animation duration of switch toggle",
1674
1679
  "name": "--bl-switch-animation-duration",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trendyol/baklava",
3
- "version": "2.0.0-beta.94",
3
+ "version": "2.0.0-beta.95",
4
4
  "description": "Trendyol Baklava Design System",
5
5
  "main": "dist/baklava.js",
6
6
  "module": "dist/baklava.js",
@@ -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 a}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,var(--bl-color-primary));background-color:var(--bl-color-neutral-lighter);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{background-color:var(--switch-color)}: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 i,o,l;let e=(l=(o=this.ariaLabel)!=null?o:(i=this.attributes.getNamedItem("aria-label"))==null?void 0:i.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([a({type:Boolean,reflect:!0})],t.prototype,"checked",2),r([a({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-N53HXW4A.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,var(--bl-color-primary));background-color:var(--bl-color-neutral-lighter);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{background-color:var(--switch-color)}: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=--bl-color-primary] Set the accent 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,g6CACfC,EAAQF,ECIR,IAAMG,EAAc,YAUNC,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,CApD3B,IAAAC,EAAAC,EAAAC,EAqDI,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
- }