@trendyol/baklava 3.3.0-beta.23 → 3.3.0-beta.25
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-react.d.ts +12 -0
- package/dist/baklava-react.d.ts.map +1 -1
- package/dist/baklava-react.js +1 -1
- package/dist/baklava-react.js.map +3 -3
- package/dist/baklava-vue.d.ts +1 -0
- package/dist/baklava.d.ts +1 -0
- package/dist/baklava.d.ts.map +1 -1
- package/dist/baklava.js +1 -1
- package/dist/{chunk-OAF3R4PW.js → chunk-2IJL7HNY.js} +2 -2
- package/dist/chunk-2IJL7HNY.js.map +7 -0
- package/dist/chunk-4BLKAURK.js +16 -0
- package/dist/chunk-4BLKAURK.js.map +7 -0
- package/dist/chunk-7VMGFJ5X.js +2 -0
- package/dist/chunk-7VMGFJ5X.js.map +7 -0
- package/dist/chunk-APLBTZ36.js +24 -0
- package/dist/chunk-APLBTZ36.js.map +7 -0
- package/dist/chunk-DE3A37FL.js +20 -0
- package/dist/chunk-DE3A37FL.js.map +7 -0
- package/dist/chunk-DIGACNOH.js +21 -0
- package/dist/chunk-DIGACNOH.js.map +7 -0
- package/dist/chunk-ERL6CBPO.js +31 -0
- package/dist/chunk-ERL6CBPO.js.map +7 -0
- package/dist/chunk-GFBXJPT6.js +50 -0
- package/dist/chunk-GFBXJPT6.js.map +7 -0
- package/dist/{chunk-5VEXMTA4.js → chunk-H4WETBHJ.js} +2 -2
- package/dist/chunk-H4WETBHJ.js.map +7 -0
- package/dist/chunk-HYBPEELZ.js +5 -0
- package/dist/chunk-HYBPEELZ.js.map +7 -0
- package/dist/chunk-HZV6GUII.js +26 -0
- package/dist/chunk-HZV6GUII.js.map +7 -0
- package/dist/chunk-IDRA37BX.js +59 -0
- package/dist/chunk-IDRA37BX.js.map +7 -0
- package/dist/chunk-LEAVDIGF.js +2 -0
- package/dist/chunk-LEAVDIGF.js.map +7 -0
- package/dist/chunk-MWFGDECP.js +35 -0
- package/dist/chunk-MWFGDECP.js.map +7 -0
- package/dist/chunk-MWG4TBH7.js +27 -0
- package/dist/chunk-MWG4TBH7.js.map +7 -0
- package/dist/chunk-NXVLNG4L.js +65 -0
- package/dist/chunk-NXVLNG4L.js.map +7 -0
- package/dist/chunk-OTAAXK2L.js +84 -0
- package/dist/chunk-OTAAXK2L.js.map +7 -0
- package/dist/chunk-OXHRXOBD.js +32 -0
- package/dist/chunk-OXHRXOBD.js.map +7 -0
- package/dist/{chunk-CAIHRZ24.js → chunk-Q5D7W6YP.js} +2 -2
- package/dist/{chunk-GMVJABPT.js → chunk-QDYWH7BU.js} +2 -2
- package/dist/chunk-QDYWH7BU.js.map +7 -0
- package/dist/chunk-RER7OLAQ.js +22 -0
- package/dist/chunk-RER7OLAQ.js.map +7 -0
- package/dist/chunk-SBCJY5IU.js +34 -0
- package/dist/{chunk-75V3FKJS.js.map → chunk-SBCJY5IU.js.map} +2 -2
- package/dist/chunk-STZJ3LBU.js +37 -0
- package/dist/{chunk-KBNVATXF.js.map → chunk-STZJ3LBU.js.map} +2 -2
- package/dist/{chunk-4BZSILLM.js → chunk-T5MEA7JO.js} +2 -2
- package/dist/chunk-T5MEA7JO.js.map +7 -0
- package/dist/chunk-TUUQIEDI.js +25 -0
- package/dist/chunk-TUUQIEDI.js.map +7 -0
- package/dist/{chunk-BNUJWONI.js → chunk-UOGCEUXK.js} +2 -2
- package/dist/chunk-UOGCEUXK.js.map +7 -0
- package/dist/chunk-WPESQSKX.js +31 -0
- package/dist/chunk-WPESQSKX.js.map +7 -0
- package/dist/chunk-X5XH4HTW.js +17 -0
- package/dist/chunk-X5XH4HTW.js.map +7 -0
- package/dist/{chunk-IGNJQVQF.js → chunk-ZE7GYACV.js} +2 -2
- package/dist/chunk-ZE7GYACV.js.map +7 -0
- package/dist/{chunk-N4GAO7FQ.js → chunk-ZJBBQHF3.js} +2 -2
- package/dist/chunk-ZLJF4SVG.js +4 -0
- package/dist/chunk-ZLJF4SVG.js.map +7 -0
- package/dist/components/accordion-group/accordion/bl-accordion.js +1 -1
- package/dist/components/accordion-group/bl-accordion-group.js +1 -1
- 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/calendar/bl-calendar.d.ts.map +1 -1
- package/dist/components/calendar/bl-calendar.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/datepicker/bl-datepicker.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/group/bl-dropdown-group.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/notification/bl-notification.js +1 -1
- package/dist/components/notification/bl-notification.stories.d.ts.map +1 -1
- package/dist/components/notification/bl-notification.stories.js +30 -196
- package/dist/components/notification/bl-notification.stories.js.map +3 -3
- package/dist/components/notification/card/bl-notification-card.js +1 -1
- package/dist/components/pagination/bl-pagination.js +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/spinner/bl-spinner.js +1 -1
- package/dist/components/split-button/bl-split-button.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/table/table-cell/bl-table-cell.js +1 -1
- package/dist/components/table/table-header/bl-table-header.js +1 -1
- package/dist/components/table/table-header-cell/bl-table-header-cell.js +1 -1
- package/dist/components/table/table-row/bl-table-row.js +1 -1
- package/dist/components/tag/bl-tag.d.ts +52 -0
- package/dist/components/tag/bl-tag.d.ts.map +1 -0
- package/dist/components/tag/bl-tag.js +2 -0
- package/dist/components/tag/bl-tag.js.map +7 -0
- package/dist/components/tag/bl-tag.test.d.ts +2 -0
- package/dist/components/tag/bl-tag.test.d.ts.map +1 -0
- package/dist/components/textarea/bl-textarea.js +1 -1
- package/dist/components/tooltip/bl-tooltip.js +1 -1
- package/dist/custom-elements.json +112 -0
- package/package.json +1 -1
- package/dist/chunk-4BZSILLM.js.map +0 -7
- package/dist/chunk-4QFXDW3W.js +0 -31
- package/dist/chunk-4QFXDW3W.js.map +0 -7
- package/dist/chunk-5VEXMTA4.js.map +0 -7
- package/dist/chunk-73RGV4UX.js +0 -16
- package/dist/chunk-73RGV4UX.js.map +0 -7
- package/dist/chunk-757CMI4A.js +0 -78
- package/dist/chunk-757CMI4A.js.map +0 -7
- package/dist/chunk-75V3FKJS.js +0 -34
- package/dist/chunk-BNUJWONI.js.map +0 -7
- package/dist/chunk-CJDCQC7C.js +0 -50
- package/dist/chunk-CJDCQC7C.js.map +0 -7
- package/dist/chunk-FCEMOH4J.js +0 -27
- package/dist/chunk-FCEMOH4J.js.map +0 -7
- package/dist/chunk-FTQX7CEW.js +0 -35
- package/dist/chunk-FTQX7CEW.js.map +0 -7
- package/dist/chunk-FVBGMXMC.js +0 -17
- package/dist/chunk-FVBGMXMC.js.map +0 -7
- package/dist/chunk-GMVJABPT.js.map +0 -7
- package/dist/chunk-GXDVWGFU.js +0 -32
- package/dist/chunk-GXDVWGFU.js.map +0 -7
- package/dist/chunk-IGNJQVQF.js.map +0 -7
- package/dist/chunk-ILK55FB6.js +0 -65
- package/dist/chunk-ILK55FB6.js.map +0 -7
- package/dist/chunk-J45OQI7D.js +0 -20
- package/dist/chunk-J45OQI7D.js.map +0 -7
- package/dist/chunk-JAZGOWKA.js +0 -2
- package/dist/chunk-JAZGOWKA.js.map +0 -7
- package/dist/chunk-KBNVATXF.js +0 -37
- package/dist/chunk-NGJM4NWA.js +0 -4
- package/dist/chunk-NGJM4NWA.js.map +0 -7
- package/dist/chunk-OAF3R4PW.js.map +0 -7
- package/dist/chunk-QMVEWMEI.js +0 -20
- package/dist/chunk-QMVEWMEI.js.map +0 -7
- package/dist/chunk-S6HEBXIR.js +0 -84
- package/dist/chunk-S6HEBXIR.js.map +0 -7
- package/dist/chunk-T5EQ4OXS.js +0 -2
- package/dist/chunk-T5EQ4OXS.js.map +0 -7
- package/dist/chunk-UZJOCLOO.js +0 -21
- package/dist/chunk-UZJOCLOO.js.map +0 -7
- package/dist/chunk-VU6LRFZR.js +0 -26
- package/dist/chunk-VU6LRFZR.js.map +0 -7
- package/dist/chunk-WXWKIQAK.js +0 -22
- package/dist/chunk-WXWKIQAK.js.map +0 -7
- package/dist/chunk-X73CSBRO.js +0 -24
- package/dist/chunk-X73CSBRO.js.map +0 -7
- package/dist/chunk-YZRAUVUQ.js +0 -31
- package/dist/chunk-YZRAUVUQ.js.map +0 -7
- /package/dist/{chunk-CAIHRZ24.js.map → chunk-Q5D7W6YP.js.map} +0 -0
- /package/dist/{chunk-N4GAO7FQ.js.map → chunk-ZJBBQHF3.js.map} +0 -0
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/utilities/string-to-date-converter.ts", "../src/mixins/datepicker-calendar-mixin/datepicker-calendar-mixin.ts", "../src/utilities/format-to-date-array.ts", "../src/components/calendar/bl-calendar.css", "../src/components/calendar/bl-calendar.ts"],
|
|
4
|
-
"sourcesContent": ["export function stringToDateArray(value: string): Date[] {\n const tempValue: Date[] = [];\n const splitDates = value.split(\",\");\n\n splitDates?.forEach(date => {\n const isDate = new Date(date.trim());\n\n if (!isNaN(isDate.getTime())) {\n tempValue.push(isDate);\n }\n });\n return tempValue;\n}\n", "import { LitElement } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { CalendarType, DayValues } from \"../../components/calendar/bl-calendar.types\";\nimport { stringToDateArray } from \"../../utilities/string-to-date-converter\";\n\nexport default class DatepickerCalendarMixin extends LitElement {\n /**\n * Defines the calendar types, available types are single, multiple and range\n */\n @property()\n type: CalendarType;\n /**\n * Defines the start day of the calendar (1 defines monday)\n */\n @property({ type: Number, attribute: \"start-of-week\", reflect: true })\n startOfWeek: DayValues = 0;\n /**\n * Defines the calendar language\n */\n @property()\n locale: string = document.documentElement.lang || \"en-EN\";\n\n /**\n * Defines the unselectable dates for calendar\n */\n protected _disabledDates: Date[] = [];\n\n get disabledDates(): Date[] {\n return this._disabledDates;\n }\n\n @property({\n attribute: \"disabled-dates\",\n reflect: true,\n })\n set disabledDates(disabledDates: Date[] | string) {\n // Now we are using 1.6.0 version of @lit/reactive-elements and in this version even if our property has property decorator it doesn't run request update inside.\n // We added similar implementations to update when there is a change.\n // When we update the lit to 2.0 or upper versions we can remove the requestUpdate here\n\n let newVal: Date[] = [];\n\n if (typeof disabledDates === \"string\") {\n newVal = stringToDateArray(disabledDates);\n } else if (Array.isArray(disabledDates)) {\n newVal = disabledDates.filter(d => !isNaN(d.getTime()));\n }\n\n this.requestUpdate(\"disabledDates\", newVal);\n this._disabledDates = newVal;\n }\n\n /**\n * Defines the maximum date value for the calendar\n */\n _maxDate: Date;\n\n get maxDate() {\n return this._maxDate;\n }\n\n @property({ type: Date, attribute: \"max-date\", reflect: true })\n set maxDate(maxDate: Date) {\n if (maxDate && isNaN(new Date(maxDate).getTime())) {\n console.warn(\"Invalid maxDate value.\");\n return;\n }\n if (this._minDate && this._minDate >= maxDate) {\n console.warn(\"maxDate cannot be smaller than minDate.\");\n } else {\n this._maxDate = new Date(maxDate);\n this.requestUpdate(\"maxDate\", maxDate);\n }\n }\n\n /**\n * Defines the minimum date value for the calendar\n */\n _minDate: Date;\n\n get minDate() {\n return this._minDate;\n }\n\n @property({ type: Date, attribute: \"min-date\", reflect: true })\n set minDate(minDate: Date) {\n if (minDate && isNaN(new Date(minDate).getTime())) {\n console.warn(\"Invalid minDate value.\");\n return;\n }\n if (this._maxDate && this._maxDate <= minDate) {\n console.warn(\"minDate cannot be greater than maxDate.\");\n } else {\n this._minDate = new Date(minDate);\n this.requestUpdate(\"minDate\", minDate);\n }\n }\n\n @property({ attribute: \"value\", reflect: true })\n set value(value: string | Date | Date[]) {\n const oldValue = this._value;\n\n this._value = value;\n this.requestUpdate(\"value\", oldValue);\n }\n\n get value(): string | Date | Date[] {\n return this._value;\n }\n\n _value: string | Date | Date[] = [];\n}\n", "import { stringToDateArray } from \"./string-to-date-converter\";\n\nexport function formatToDateArray(value: string | Date | Date[]): Date[] {\n if (typeof value === \"string\") {\n return stringToDateArray(value);\n } else if (value instanceof Date) {\n return [value];\n } else {\n return value;\n }\n}\n", "import {css} from 'lit';\nexport const styles = css`.calendar{display:flex;flex-direction:column}.calendar-content{display:flex;padding:var(--bl-size-m);flex-direction:column;align-items:center;gap:var(--bl-size-m);border-radius:var(--bl-border-radius-s);width:fit-content;background:var(--bl-color-neutral-full)}.calendar-header{display:flex;justify-content:space-between;width:100%;align-items:center;padding-bottom:var(--bl-size-s)}.arrow{flex:1}:host([dir=\"rtl\"]) .arrow{transform:scale(-1)}.header-text{flex:3}.header-text-hover{background:var(--bl-color-neutral-lightest);border-radius:var(--bl-border-radius-s)}.days-wrapper{display:flex;flex-direction:column}.day-wrapper{display:flex;align-items:center;justify-content:center}.week-row{display:flex;align-items:center;flex-direction:row;padding-bottom:var(--bl-size-2xs)}.day{display:flex;align-items:center;width:40px;--bl-button-focus-border-color:#000;--bl-font-title-4-medium:var(--bl-font-weight-regular) var(--bl-font-size-m);--bl-size-xl:40px;--bl-border-radius-m:50%;--bl-border-radius-l:50%}.day.today-day{--bl-color-neutral-darker:var(--bl-color-primary);--bl-color-neutral-darkest:var(--bl-color-primary)}.day.other-month-day{--bl-color-neutral-darker:var(--bl-color-neutral-dark)}.day.other-month-day.selected-day{--bl-color-neutral-darker:var(--bl-color-neutral-full)}.day.selected-day{background:var(--bl-color-primary);border-radius:50%;--bl-button-focus-border-color:var(--bl-color-primary);--bl-color-neutral-darker:var(--bl-color-neutral-full)}.range-day{background:var(--bl-color-primary-contrast);--bl-color-neutral-lightest:var(--bl-color-primary-contrast)}.range-end-day,.range-start-day,.selected-day{--bl-color-neutral-lightest:var(--bl-color-primary);--bl-color-neutral-darker:var(--bl-color-neutral-full);--bl-color-neutral-darkest:var(--bl-color-neutral-full) !important}.range-start-day{background:var(--bl-color-primary-contrast);border-start-start-radius:50%;border-end-start-radius:50%}.range-end-day{background:var(--bl-color-primary-contrast);border-start-end-radius:50%;border-end-end-radius:50%}.weekday-text{color:var(--bl-color-neutral-dark);text-align:center;padding:var(--bl-size-2xs) 0;width:40px}.grid-content{display:grid;grid-template-columns:auto auto auto;text-align:center}.grid-item{width:93.33px;--bl-size-3xs:15px}.grid-item:not(:nth-last-child(-n + 3)){padding-bottom:var(--bl-size-2xs)}.calendar-text{font:var(--bl-font-title-3-regular)}`;\nexport default styles;\n", "import { CSSResultGroup, html, PropertyValues } from \"lit\";\nimport { customElement, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { localized } from \"@lit/localize\";\nimport DatepickerCalendarMixin from \"../../mixins/datepicker-calendar-mixin/datepicker-calendar-mixin\";\nimport { setDirectionProperty } from \"../../utilities/direction\";\nimport { event, EventDispatcher } from \"../../utilities/event\";\nimport { formatToDateArray } from \"../../utilities/format-to-date-array\";\nimport \"../button/bl-button\";\nimport \"../icon/bl-icon\";\nimport {\n CALENDAR_TYPES,\n CALENDAR_VIEWS,\n FIRST_MONTH_INDEX,\n LAST_MONTH_INDEX,\n} from \"./bl-calendar.constant\";\nimport style from \"./bl-calendar.css\";\nimport { Calendar, CalendarDay, CalendarView } from \"./bl-calendar.types\";\n\n/**\n * @tag bl-calendar\n * @summary Baklava Calendar component\n **/\n@customElement(\"bl-calendar\")\n@localized()\nexport default class BlCalendar extends DatepickerCalendarMixin {\n @state()\n today = new Date();\n @state()\n _calendarMonth: number = this.today.getMonth();\n @state()\n _calendarYear: number = this.today.getFullYear();\n @state()\n _calendarView: CalendarView = CALENDAR_VIEWS.DAYS;\n @state()\n _calendarYears: number[] = [];\n @state()\n _calendarDays: CalendarDay[] = [];\n @state()\n _dates: Date[] = [];\n /**\n * Fires when date selection changes\n */\n @event(\"bl-calendar-change\") _onBlCalendarChange: EventDispatcher<Date[]>;\n\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n connectedCallback() {\n super.connectedCallback();\n setDirectionProperty(this);\n }\n\n get months() {\n return [...Array(12).keys()].map(month => ({\n name: new Date(0, month + 1, 0).toLocaleString(this.locale, { month: \"long\" }),\n value: month,\n }));\n }\n\n get days() {\n return [...Array(7).keys()].map(day => ({\n name: new Date(0, 0, day).toLocaleString(this.locale, { weekday: \"short\" }),\n value: day,\n }));\n }\n\n public handleClearSelectedDates = () => {\n this._dates = [];\n this._onBlCalendarChange([]);\n this.clearRangePickerStyles();\n };\n\n getDayNumInAMonth(year: number, month: number) {\n return new Date(year, month + 1, 0).getDate();\n }\n\n getWeekDayOfDate(year: number, month: number) {\n return new Date(year, month, 1).getDay();\n }\n\n setPreviousCalendarView() {\n this.clearRangePickerStyles();\n if (this._calendarView === CALENDAR_VIEWS.DAYS) {\n if (this._calendarMonth === FIRST_MONTH_INDEX) {\n this._calendarMonth = LAST_MONTH_INDEX;\n this._calendarYear -= 1;\n } else this._calendarMonth -= 1;\n } else if (this._calendarView === CALENDAR_VIEWS.MONTHS) {\n this._calendarYear -= 1;\n } else if (this._calendarView === CALENDAR_VIEWS.YEARS) {\n const fromYear = this._calendarYears[0];\n\n this._calendarYears = Array.from({ length: 12 }, (_, i) => fromYear - (i + 1));\n }\n if (this.type === CALENDAR_TYPES.RANGE) this.setHoverClass();\n }\n\n setNextCalendarView() {\n this.clearRangePickerStyles();\n if (this._calendarView === CALENDAR_VIEWS.DAYS) {\n if (this._calendarMonth === LAST_MONTH_INDEX) {\n this._calendarMonth = FIRST_MONTH_INDEX;\n this._calendarYear += 1;\n } else this._calendarMonth += 1;\n } else if (this._calendarView === CALENDAR_VIEWS.MONTHS) {\n this._calendarYear += 1;\n } else if (this._calendarView === CALENDAR_VIEWS.YEARS) {\n const fromYear = this._calendarYears[11];\n\n this._calendarYears = Array.from({ length: 12 }, (_, i) => fromYear + (i + 1));\n }\n this.setHoverClass();\n }\n\n setCurrentCalendarView(view: CalendarView) {\n this._calendarView = this._calendarView !== view ? view : CALENDAR_VIEWS.DAYS;\n this.setHoverClass();\n }\n\n setMonthAndCalendarView(month: number) {\n this._calendarMonth = month;\n this._calendarView = CALENDAR_VIEWS.DAYS;\n if (this.type === CALENDAR_TYPES.RANGE) this.setHoverClass();\n }\n\n setYearAndCalendarView(year: number) {\n this._calendarYear = year;\n this._calendarView = CALENDAR_VIEWS.DAYS;\n if (this.type === CALENDAR_TYPES.RANGE) this.setHoverClass();\n }\n\n generateSurroundingYears() {\n if (!this._calendarYears.length) {\n this._calendarYears = Array.from({ length: 12 }, (_, i) => this._calendarYear - 4 + i);\n }\n }\n\n clearRangePickerStyles() {\n this.shadowRoot\n ?.querySelectorAll(\".range-day, .range-start-day, .range-end-day\")\n .forEach(day => day.classList.remove(\"range-day\", \"range-start-day\", \"range-end-day\"));\n }\n\n handleDate(date: Date) {\n if (this.type !== CALENDAR_TYPES.RANGE) {\n const isDateBeforeThanCalendar =\n date.getFullYear() < this._calendarYear ||\n (date.getFullYear() === this._calendarYear && date.getMonth() < this._calendarMonth);\n\n const isDateAfterThanCalendar =\n date.getFullYear() > this._calendarYear ||\n (date.getFullYear() === this._calendarYear && date.getMonth() > this._calendarMonth);\n\n if (isDateBeforeThanCalendar) {\n this.setPreviousCalendarView();\n } else if (isDateAfterThanCalendar) {\n this.setNextCalendarView();\n }\n }\n\n switch (this.type) {\n case CALENDAR_TYPES.SINGLE:\n this.handleSingleSelectCalendar(date);\n break;\n case CALENDAR_TYPES.MULTIPLE:\n this.handleMultipleSelectCalendar(date);\n break;\n case CALENDAR_TYPES.RANGE:\n this.handleRangeSelectCalendar(date);\n break;\n }\n\n this._onBlCalendarChange(this._dates);\n this.requestUpdate();\n }\n\n handleSingleSelectCalendar(calendarDate: Date) {\n this._dates = [calendarDate];\n }\n\n handleMultipleSelectCalendar(calendarDate: Date) {\n const dateExist = this._dates?.some(d => d.getTime() === calendarDate.getTime());\n\n dateExist\n ? this._dates?.splice(\n this._dates?.findIndex(d => d.getTime() === calendarDate.getTime()),\n 1\n )\n : this._dates.push(calendarDate);\n }\n\n handleRangeSelectCalendar(calendarDate: Date) {\n if (!this._dates[0]) {\n this._dates[0] = calendarDate;\n } else if (!this._dates[1]) {\n if (calendarDate.getTime() > this._dates[0].getTime()) {\n this._dates[1] = calendarDate;\n } else {\n const tempEndDate = this._dates[0];\n\n this._dates[0] = calendarDate;\n this._dates[1] = tempEndDate;\n }\n } else {\n this._dates = [];\n this._dates[0] = calendarDate;\n }\n this.setHoverClass();\n }\n\n checkIfSelectedDate(calendarDate: Date) {\n return this._dates?.some(\n date =>\n date.getFullYear() === calendarDate.getFullYear() &&\n date.getMonth() === calendarDate.getMonth() &&\n date.getDate() === calendarDate.getDate()\n );\n }\n\n checkIfDateIsToday(calendarDate: Date) {\n const today = this.today;\n\n return (\n today.getDate() === calendarDate.getDate() &&\n today.getMonth() === calendarDate.getMonth() &&\n today.getFullYear() === calendarDate.getFullYear()\n );\n }\n\n checkIfDateIsDisabled(calendarDate: Date) {\n if (\n calendarDate.getTime() < this.minDate?.getTime() ||\n calendarDate.getTime() > this.maxDate?.getTime()\n ) {\n return true;\n }\n if (this.disabledDates.length > 0) {\n return this.disabledDates?.some(disabledDate => {\n return (\n calendarDate.getDate() === disabledDate.getDate() &&\n calendarDate.getMonth() === disabledDate.getMonth() &&\n calendarDate.getFullYear() === disabledDate.getFullYear()\n );\n });\n }\n return false;\n }\n\n setHoverClass() {\n this.clearRangePickerStyles();\n\n if (this._dates[0] && this._dates[1]) {\n setTimeout(() => {\n const startDateParentElement = this.shadowRoot?.getElementById(\n `${this._dates[0]?.getTime()}`\n )?.parentElement;\n\n startDateParentElement?.classList.add(\"range-start-day\");\n\n const endDateParentElement = this.shadowRoot?.getElementById(\n `${this._dates[1]?.getTime()}`\n )?.parentElement;\n\n endDateParentElement?.classList.add(\"range-end-day\");\n const rangeDays = [...this.createCalendarDays().values()]\n .flat()\n .filter(\n date =>\n date.getTime() > this._dates[0]!.getTime() &&\n date.getTime() < this._dates[1]!.getTime()\n );\n\n for (let i = 0; i < rangeDays.length; i++) {\n const element = this.shadowRoot?.getElementById(\n `${rangeDays[i].getTime()}`\n )?.parentElement;\n\n element?.classList?.add(\"range-day\");\n }\n });\n }\n }\n\n createCalendarDays() {\n const calendar: Calendar = new Map();\n\n this._calendarDays = this.days\n .slice(this.startOfWeek)\n .concat(this.days.slice(0, this.startOfWeek));\n\n const currentMonthStartWeekDay = this.getWeekDayOfDate(this._calendarYear, this._calendarMonth); // 1\n\n const lastMonthDaysCount =\n currentMonthStartWeekDay < this.startOfWeek\n ? 7 - (this.startOfWeek - currentMonthStartWeekDay)\n : currentMonthStartWeekDay - this.startOfWeek;\n\n const previousMonthDayCount = this.getDayNumInAMonth(\n this._calendarYear,\n this._calendarMonth - 1\n );\n\n const currentMonthDayCount = this.getDayNumInAMonth(this._calendarYear, this._calendarMonth);\n\n let dayOfTheWeek = this.startOfWeek; // from sunday\n\n for (\n let lastMonthDaysIterator = lastMonthDaysCount;\n lastMonthDaysIterator > 0;\n lastMonthDaysIterator--\n ) {\n const mod = dayOfTheWeek % 7;\n const date = new Date(\n this._calendarYear,\n this._calendarMonth - 1,\n previousMonthDayCount - lastMonthDaysIterator + 1\n );\n\n calendar.set(this.days[mod].name, [date]);\n\n dayOfTheWeek += 1;\n }\n for (\n let currentMonthDaysIterator = 1;\n currentMonthDaysIterator <= currentMonthDayCount;\n currentMonthDaysIterator++\n ) {\n const mod = dayOfTheWeek % 7;\n const day = new Date(this._calendarYear, this._calendarMonth, currentMonthDaysIterator);\n\n if (calendar.get(this.days[mod].name)) {\n calendar.get(this.days[mod].name)?.push(day);\n } else {\n calendar.set(this.days[mod].name, [day]);\n }\n dayOfTheWeek += 1;\n }\n\n const index = this._calendarDays.findIndex(day => day.value === dayOfTheWeek % 7);\n\n if (index !== 0) {\n for (\n let nextMonthDaysIterator = 1;\n nextMonthDaysIterator <= this._calendarDays.length - index;\n nextMonthDaysIterator++\n ) {\n const mod = dayOfTheWeek % 7;\n const date = new Date(this._calendarYear, this._calendarMonth + 1, nextMonthDaysIterator);\n\n calendar.get(this.days[mod].name)?.push(date);\n\n dayOfTheWeek += 1;\n }\n }\n return calendar;\n }\n\n updated(changedProperties: PropertyValues) {\n if (changedProperties.has(\"value\")) {\n const dates = formatToDateArray(this._value);\n\n if (!dates.length) {\n this._dates = [];\n this._onBlCalendarChange([]);\n } else {\n dates?.forEach(date => {\n this.handleDate(date);\n });\n }\n }\n }\n\n renderCalendarHeader() {\n const showMonthSelected =\n this._calendarView === CALENDAR_VIEWS.MONTHS ? \"header-text-hover\" : \"\";\n const showYearSelected = this._calendarView === CALENDAR_VIEWS.YEARS ? \"header-text-hover\" : \"\";\n\n return html`\n <div class=\"calendar-header\">\n <bl-button\n class=\"arrow\"\n icon=\"arrow_left\"\n variant=\"tertiary\"\n kind=\"neutral\"\n @click=\"${() => this.setPreviousCalendarView()}\"\n ></bl-button>\n <bl-button\n variant=\"tertiary\"\n kind=\"neutral\"\n class=\"header-text ${showMonthSelected}\"\n @click=\"${() => this.setCurrentCalendarView(CALENDAR_VIEWS.MONTHS)}\"\n >${this.months[this._calendarMonth].name}\n </bl-button>\n <bl-button\n variant=\"tertiary\"\n kind=\"neutral\"\n class=\"header-text ${showYearSelected}\"\n @click=\"${() => this.setCurrentCalendarView(CALENDAR_VIEWS.YEARS)}\"\n >${this._calendarYear}\n </bl-button>\n <bl-button\n class=\"arrow\"\n icon=\"arrow_right\"\n variant=\"tertiary\"\n kind=\"neutral\"\n @click=\"${() => this.setNextCalendarView()}\"\n ></bl-button>\n </div>\n `;\n }\n\n renderCalendarDays() {\n const calendarDays = this.createCalendarDays();\n const valuesArray = Array.from(calendarDays.values());\n\n return html`\n <div class=\"week-row\">\n ${[...calendarDays.keys()].map(key => {\n return html` <div class=\"calendar-text weekday-text\">${key}</div> `;\n })}\n </div>\n <div class=\"days-wrapper\">\n ${[...Array(valuesArray[0].length).keys()].map(key => {\n return html` <div class=\"week-row\">\n ${valuesArray.map(values => {\n const date = values[key];\n const isSelectedDay = this.checkIfSelectedDate(date);\n const isDayToday = this.checkIfDateIsToday(date);\n const isDisabledDay = this.checkIfDateIsDisabled(date);\n\n const classes = classMap({\n \"day\": true,\n \"calendar-text\": true,\n \"today-day\": isDayToday,\n \"selected-day\": isSelectedDay,\n \"other-month-day\": values[key].getMonth() !== this._calendarMonth,\n \"disabled-day\": isDisabledDay,\n });\n\n return html`\n <div class=\"day-wrapper\">\n <bl-button\n id=${date.getTime()}\n variant=\"tertiary\"\n kind=\"neutral\"\n size=\"small\"\n class=${classes}\n ?disabled=${isDisabledDay}\n @click=\"${() => !isDisabledDay && this.handleDate(date)}\"\n >\n ${date.getDate()}\n </bl-button>\n </div>\n `;\n })}\n </div>`;\n })}\n </div>\n </div>`;\n }\n\n renderCalendarMonths() {\n return html` <div class=\"grid-content\">\n ${this.months.map((month, index) => {\n const variant = month.value === this._calendarMonth ? \"primary\" : \"tertiary\";\n const neutral = month.value === this._calendarMonth ? \"default\" : \"neutral\";\n\n return html` <bl-button\n variant=${variant}\n kind=${neutral}\n class=\"grid-item\"\n size=\"small\"\n @click=\"${() => this.setMonthAndCalendarView(index)}\"\n ><span class=\"calendar-text\">${month.name}</span></bl-button\n >`;\n })}\n </div>`;\n }\n\n renderCalendarYears() {\n this.generateSurroundingYears();\n return html` <div class=\"grid-content\">\n ${this._calendarYears.map(year => {\n const variant = year === this._calendarYear ? \"primary\" : \"tertiary\";\n const neutral = year === this._calendarYear ? \"default\" : \"neutral\";\n\n return html` <bl-button\n variant=${variant}\n kind=${neutral}\n class=\"grid-item\"\n @click=\"${() => this.setYearAndCalendarView(year)}\"\n ><span class=\"calendar-text\">${year}</span></bl-button\n >`;\n })}\n </div>`;\n }\n\n render() {\n return html`\n <div>\n <div class=\"calendar-content\">\n <div class=\"calendar\">\n ${this.renderCalendarHeader()}\n ${this._calendarView === CALENDAR_VIEWS.DAYS ? this.renderCalendarDays() : \"\"}\n ${this._calendarView === CALENDAR_VIEWS.MONTHS ? this.renderCalendarMonths() : \"\"}\n ${this._calendarView === CALENDAR_VIEWS.YEARS ? this.renderCalendarYears() : \"\"}\n </div>\n </div>\n </div>\n `;\n }\n}\n"],
|
|
5
|
-
"mappings": "mWAAO,SAASA,EAAkBC,EAAuB,CACvD,IAAMC,EAAoB,CAAC,EACrBC,EAAaF,EAAM,MAAM,GAAG,EAElC,OAAAE,GAAA,MAAAA,EAAY,QAAQC,GAAQ,CAC1B,IAAMC,EAAS,IAAI,KAAKD,EAAK,KAAK,CAAC,EAE9B,MAAMC,EAAO,QAAQ,CAAC,GACzBH,EAAU,KAAKG,CAAM,CAEzB,GACOH,CACT,CCPA,IAAqBI,EAArB,cAAqDC,CAAW,CAAhE,kCAUE,iBAAyB,EAKzB,YAAiB,SAAS,gBAAgB,MAAQ,QAKlD,KAAU,eAAyB,CAAC,EAqFpC,YAAiC,CAAC,EAnFlC,IAAI,eAAwB,CAC1B,OAAO,KAAK,cACd,CAMA,IAAI,cAAcC,EAAgC,CAKhD,IAAIC,EAAiB,CAAC,EAElB,OAAOD,GAAkB,SAC3BC,EAASC,EAAkBF,CAAa,EAC/B,MAAM,QAAQA,CAAa,IACpCC,EAASD,EAAc,OAAOG,GAAK,CAAC,MAAMA,EAAE,QAAQ,CAAC,CAAC,GAGxD,KAAK,cAAc,gBAAiBF,CAAM,EAC1C,KAAK,eAAiBA,CACxB,CAOA,IAAI,SAAU,CACZ,OAAO,KAAK,QACd,CAGA,IAAI,QAAQG,EAAe,CACzB,GAAIA,GAAW,MAAM,IAAI,KAAKA,CAAO,EAAE,Q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Dates", "date", "isDate", "DatepickerCalendarMixin", "s", "disabledDates", "newVal", "stringToDateArray", "d", "maxDate", "minDate", "value", "oldValue", "__decorateClass", "e", "formatToDateArray", "value", "stringToDateArray", "styles", "i", "bl_calendar_default", "BlCalendar", "DatepickerCalendarMixin", "bl_calendar_default", "setDirectionProperty", "month", "day", "year", "fromYear", "_", "i", "view", "_a", "date", "isDateBeforeThanCalendar", "isDateAfterThanCalendar", "calendarDate", "_b", "_c", "d", "tempEndDate", "today", "disabledDate", "_d", "_e", "_f", "_g", "_h", "_i", "startDateParentElement", "endDateParentElement", "rangeDays", "element", "calendar", "currentMonthStartWeekDay", "lastMonthDaysCount", "previousMonthDayCount", "currentMonthDayCount", "dayOfTheWeek", "lastMonthDaysIterator", "mod", "currentMonthDaysIterator", "index", "nextMonthDaysIterator", "changedProperties", "dates", "formatToDateArray", "showMonthSelected", "showYearSelected", "x", "calendarDays", "valuesArray", "key", "values", "isSelectedDay", "isDayToday", "isDisabledDay", "classes", "o", "variant", "neutral", "__decorateClass", "t", "event", "e", "localized"]
|
|
7
|
-
}
|
package/dist/chunk-T5EQ4OXS.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-STMCW2R6.js";import{a as r,b as i}from"./chunk-5MOOXA2X.js";import{a as o,b as l,f as s}from"./chunk-4OT5AMS5.js";import{d as t}from"./chunk-IZ2LK5GK.js";var p=o`:host{display:table-header-group}:host([sticky]){position:sticky;top:0;inset-inline-start:0;inset-inline-end:0;z-index:3;transition:top 0.05s ease;box-shadow:0 8px 16px 0 rgb(39 49 66 / 10%)}:host([sticky])::after{content:"";display:block;position:absolute;bottom:0;inset-inline-start:0;inset-inline-end:0;height:1px;background:var(--bl-color-neutral-lighter)}`,n=p;var b="bl-table-header",e=class extends s{constructor(){super(...arguments);this.sticky=!1}static get styles(){return[n]}connectedCallback(){super.connectedCallback(),this.closest(a)||console.warn("bl-table-header is designed to be used inside a bl-table",this)}render(){return l`<slot></slot> `}};t([i({type:Boolean,reflect:!0})],e.prototype,"sticky",2),e=t([r(b)],e);export{b as a,e as b};
|
|
2
|
-
//# sourceMappingURL=chunk-T5EQ4OXS.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/table/table-header/bl-table-header.css", "../src/components/table/table-header/bl-table-header.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`:host{display:table-header-group}:host([sticky]){position:sticky;top:0;inset-inline-start:0;inset-inline-end:0;z-index:3;transition:top 0.05s ease;box-shadow:0 8px 16px 0 rgb(39 49 66 / 10%)}:host([sticky])::after{content:\"\";display:block;position:absolute;bottom:0;inset-inline-start:0;inset-inline-end:0;height:1px;background:var(--bl-color-neutral-lighter)}`;\nexport default styles;\n", "import { CSSResultGroup, html, LitElement, TemplateResult } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport \"element-internals-polyfill\";\nimport { blTableTag } from \"../bl-table\";\nimport type BlTable from \"../bl-table\";\nimport style from \"../table-header/bl-table-header.css\";\n\nexport const blTableHeaderTag = \"bl-table-header\";\n\n/**\n * @tag bl-table-header\n * @summary Baklava Table component\n */\n@customElement(blTableHeaderTag)\nexport default class BlTableHeader extends LitElement {\n static get styles(): CSSResultGroup {\n return [style];\n }\n /**\n * Set table header as sticky\n */\n @property({ type: Boolean, reflect: true })\n sticky = false;\n\n connectedCallback(): void {\n super.connectedCallback();\n if (!this.closest<BlTable>(blTableTag)) {\n console.warn(\"bl-table-header is designed to be used inside a bl-table\", this);\n }\n }\n\n render(): TemplateResult {\n return html`<slot></slot> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [blTableHeaderTag]: BlTableHeader;\n }\n}\n"],
|
|
5
|
-
"mappings": "gLACO,IAAMA,EAASC,4WACfC,EAAQF,ECKR,IAAMG,EAAmB,kBAOXC,EAArB,cAA2C,CAAW,CAAtD,kCAQE,YAAS,GAPT,WAAW,QAAyB,CAClC,MAAO,CAACC,CAAK,CACf,CAOA,mBAA0B,CACxB,MAAM,kBAAkB,EACnB,KAAK,QAAiBC,CAAU,GACnC,QAAQ,KAAK,2DAA4D,IAAI,CAEjF,CAEA,QAAyB,CACvB,OAAOC,iBACT,CACF,EAZEC,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAPvBL,EAQnB,sBARmBA,EAArBI,EAAA,CADCC,EAAcN,CAAgB,GACVC",
|
|
6
|
-
"names": ["styles", "i", "bl_table_header_default", "blTableHeaderTag", "BlTableHeader", "bl_table_header_default", "blTableTag", "x", "__decorateClass", "e"]
|
|
7
|
-
}
|
package/dist/chunk-UZJOCLOO.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-ECPWEUBG.js";import{a as s}from"./chunk-DINNT5P2.js";import{a}from"./chunk-GRL4DWKG.js";import{a as u,b as r}from"./chunk-5MOOXA2X.js";import{a as l,b as i,f as c}from"./chunk-4OT5AMS5.js";import{d as o}from"./chunk-IZ2LK5GK.js";var p=l`:host{display:block}.notification{position:relative;border-radius:var(--bl-border-radius-m);box-shadow:0 5px 30px 0 rgba(39 49 66 / 25%)}.duration{position:absolute;inset-inline-start:0;inset-inline-end:0;bottom:0;height:var(--bl-size-2xs);width:100%}.duration > .remaining{position:absolute;height:100%;width:100%;border-radius:var(--bl-border-radius-s);border-top-left-radius:0;animation-name:to-zero;animation-duration:var(--duration, 7s);animation-timing-function:linear;animation-fill-mode:forwards;animation-play-state:running}.notification.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__ .duration > .remaining,.notification:hover .duration > .remaining{animation-play-state:paused}@keyframes to-zero{to{width:0}}.notification[variant="success"] .duration > .remaining{background-color:var(--bl-color-success)}.notification[variant="warning"] .duration > .remaining{background-color:var(--bl-color-warning)}.notification[variant="danger"] .duration > .remaining{background-color:var(--bl-color-danger)}.notification[variant="info"] .duration > .remaining{background-color:var(--bl-color-info)}`,m=p;var f=(e=>(e.DurationEnded="duration-ended",e.CloseButton="close-button",e))(f||{}),v={info:"info",success:"success",warning:"warning",error:"danger"},t=class extends c{constructor(){super(...arguments);this.caption="";this.variant="info";this.duration=7;this.permanent=!1;this.closed=!1}static get styles(){return[m]}firstUpdated(){this.setupDuration()}async setupDuration(){if(!this.permanent){if(this.duration<=0){this.close("duration-ended");return}setTimeout(()=>{var e,n;(n=(e=this.shadowRoot)==null?void 0:e.querySelector(".remaining"))==null||n.addEventListener("animationend",()=>{this.close("duration-ended")},{once:!0})},0)}}close(e){this.onRequestClose({source:e},{cancelable:!0}).defaultPrevented||(this.onClose({source:e}),this.closed=!0)}handleClose(e){let n=e.target;n.closed=!1,this.close("close-button")}renderProgress(){return this.permanent?null:i`
|
|
2
|
-
<div class="duration">
|
|
3
|
-
<div class="remaining" style="--duration: ${this.duration}s;"></div>
|
|
4
|
-
</div>
|
|
5
|
-
`}render(){let{icon:e=!0,variant:n="info"}=this;return i`
|
|
6
|
-
<bl-alert
|
|
7
|
-
class="notification"
|
|
8
|
-
caption="${s(this.caption)}"
|
|
9
|
-
icon=${e}
|
|
10
|
-
variant=${s(v[n])}
|
|
11
|
-
?closed=${this.closed}
|
|
12
|
-
?closable=${!0}
|
|
13
|
-
@bl-close=${this.handleClose}
|
|
14
|
-
>
|
|
15
|
-
<slot></slot>
|
|
16
|
-
${this.renderProgress()}
|
|
17
|
-
<slot name="primary-action" slot="action"></slot>
|
|
18
|
-
<slot name="secondary-action" slot="action-secondary"></slot>
|
|
19
|
-
</bl-alert>
|
|
20
|
-
`}};o([r({type:String})],t.prototype,"caption",2),o([r({converter:d()})],t.prototype,"icon",2),o([r({reflect:!0})],t.prototype,"variant",2),o([r({type:Number})],t.prototype,"duration",2),o([r({type:Boolean})],t.prototype,"permanent",2),o([r({type:Boolean})],t.prototype,"closed",2),o([a("bl-notification-card-request-close")],t.prototype,"onRequestClose",2),o([a("bl-notification-card-close")],t.prototype,"onClose",2),t=o([u("bl-notification-card")],t);export{f as a,t as b};
|
|
21
|
-
//# sourceMappingURL=chunk-UZJOCLOO.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/notification/card/bl-notification-card.css", "../src/components/notification/card/bl-notification-card.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`:host{display:block}.notification{position:relative;border-radius:var(--bl-border-radius-m);box-shadow:0 5px 30px 0 rgba(39 49 66 / 25%)}.duration{position:absolute;inset-inline-start:0;inset-inline-end:0;bottom:0;height:var(--bl-size-2xs);width:100%}.duration > .remaining{position:absolute;height:100%;width:100%;border-radius:var(--bl-border-radius-s);border-top-left-radius:0;animation-name:to-zero;animation-duration:var(--duration, 7s);animation-timing-function:linear;animation-fill-mode:forwards;animation-play-state:running}.notification.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__ .duration > .remaining,.notification:hover .duration > .remaining{animation-play-state:paused}@keyframes to-zero{to{width:0}}.notification[variant=\"success\"] .duration > .remaining{background-color:var(--bl-color-success)}.notification[variant=\"warning\"] .duration > .remaining{background-color:var(--bl-color-warning)}.notification[variant=\"danger\"] .duration > .remaining{background-color:var(--bl-color-danger)}.notification[variant=\"info\"] .duration > .remaining{background-color:var(--bl-color-info)}`;\nexport default styles;\n", "import { CSSResultGroup, html, LitElement, TemplateResult } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { event, EventDispatcher } from \"../../../utilities/event\";\nimport { stringBooleanConverter } from \"../../../utilities/string-boolean.converter\";\nimport BlAlert, { AlertVariant } from \"../../alert/bl-alert\";\nimport { BaklavaIcon } from \"../../icon/icon-list\";\nimport style from \"./bl-notification-card.css\";\n\nexport enum CloseSource {\n DurationEnded = \"duration-ended\",\n CloseButton = \"close-button\",\n}\n\nexport type NotificationVariant = \"info\" | \"success\" | \"warning\" | \"error\";\n\nconst NOTIFICATION_VARIANT_ALERT_MAP: Readonly<Record<NotificationVariant, AlertVariant>> = {\n info: \"info\",\n success: \"success\",\n warning: \"warning\",\n error: \"danger\",\n};\n\n/**\n * @tag bl-notification-card\n * @summary Baklava Notification Card component\n */\n\n@customElement(\"bl-notification-card\")\nexport default class BlNotificationCard extends LitElement {\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n /**\n * Sets notification caption.\n * @attr caption\n * @type {string}\n * @default \"\"\n */\n @property({ type: String })\n caption = \"\";\n\n /**\n * Allows to customize notification icon.\n * True value will display default icon.\n * False value will hide icon.\n * String value will display icon with specified name.\n * @attr icon\n * @type {boolean | BaklavaIcon}\n * @default true\n */\n @property({ converter: stringBooleanConverter() })\n icon?: boolean | BaklavaIcon;\n\n /**\n * Sets notification variant.\n * @attr variant\n * @type {NotificationVariant}\n * @default \"info\"\n */\n @property({ reflect: true })\n variant: NotificationVariant = \"info\";\n\n /**\n * Sets notification display duration in minutes.\n * Has no effect if permanent is set to true.\n * @attr closed\n * @type {boolean}\n * @default false\n */\n @property({ type: Number })\n duration = 7;\n\n /**\n * Prevents notification from being closed automatically.\n * @attr closed\n * @type {boolean}\n * @default false\n */\n @property({ type: Boolean })\n permanent = false;\n\n /**\n * Indicates whether the notification is closed.\n */\n @property({ type: Boolean })\n closed = false;\n\n /**\n * Dispatches close request event.\n * The notification will not be closed automatically if the event is prevented.\n */\n @event(\"bl-notification-card-request-close\") private onRequestClose: EventDispatcher<{\n source: \"duration-ended\" | \"close-button\";\n }>;\n\n /**\n * Dispatches close event.\n * The notification will hidden after the event is dispatched and the closed property is set to true.\n */\n @event(\"bl-notification-card-close\") private onClose: EventDispatcher<{\n source: \"duration-ended\" | \"close-button\";\n }>;\n\n protected firstUpdated() {\n this.setupDuration();\n }\n\n /**\n * Sets up duration animation.\n * The notification will dispatch a closed event after the animation ends.\n */\n private async setupDuration() {\n if (this.permanent) {\n return;\n }\n\n if (this.duration <= 0) {\n this.close(CloseSource.DurationEnded);\n return;\n }\n\n setTimeout(() => {\n this.shadowRoot?.querySelector(\".remaining\")?.addEventListener(\n \"animationend\",\n () => {\n this.close(CloseSource.DurationEnded);\n },\n { once: true }\n );\n }, 0);\n }\n\n private close(source: CloseSource) {\n const requestCloseEvent = this.onRequestClose({ source }, { cancelable: true });\n\n if (requestCloseEvent.defaultPrevented) {\n return;\n }\n\n this.onClose({ source });\n this.closed = true;\n }\n\n private handleClose(e: CustomEvent<boolean>) {\n const target = e.target as BlAlert;\n\n target.closed = false;\n\n this.close(CloseSource.CloseButton);\n }\n\n private renderProgress() {\n if (this.permanent) {\n return null;\n }\n\n return html`\n <div class=\"duration\">\n <div class=\"remaining\" style=\"--duration: ${this.duration}s;\"></div>\n </div>\n `;\n }\n\n render(): TemplateResult {\n const { icon = true, variant = \"info\" } = this;\n\n return html`\n <bl-alert\n class=\"notification\"\n caption=\"${ifDefined(this.caption)}\"\n icon=${icon}\n variant=${ifDefined(NOTIFICATION_VARIANT_ALERT_MAP[variant])}\n ?closed=${this.closed}\n ?closable=${true}\n @bl-close=${this.handleClose}\n >\n <slot></slot>\n ${this.renderProgress()}\n <slot name=\"primary-action\" slot=\"action\"></slot>\n <slot name=\"secondary-action\" slot=\"action-secondary\"></slot>\n </bl-alert>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bl-notification-card\": BlNotificationCard;\n }\n}\n"],
|
|
5
|
-
"mappings": "gQACO,IAAMA,EAASC,2kCACfC,EAAQF,ECOR,IAAKG,OACVA,EAAA,cAAgB,iBAChBA,EAAA,YAAc,eAFJA,OAAA,IAONC,EAAsF,CAC1F,KAAM,OACN,QAAS,UACT,QAAS,UACT,MAAO,QACT,EAQqBC,EAArB,cAAgDC,CAAW,CAA3D,kCAYE,aAAU,GAqBV,aAA+B,OAU/B,cAAW,EASX,eAAY,GAMZ,YAAS,GAzDT,WAAW,QAAyB,CAClC,MAAO,CAACC,CAAK,CACf,CAyEU,cAAe,CACvB,KAAK,cAAc,CACrB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AM,MAAO,CAAC,GA1CPZ,EA2CnB,wBASAW,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,CAAC,GAnDRZ,EAoDnB,yBAMAW,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,CAAC,GAzDRZ,EA0DnB,sBAMqDW,EAAA,CAApDG,EAAM,oCAAoC,GAhExBd,EAgEkC,8BAQRW,EAAA,CAA5CG,EAAM,4BAA4B,GAxEhBd,EAwE0B,uBAxE1BA,EAArBW,EAAA,CADCC,EAAc,sBAAsB,GAChBZ",
|
|
6
|
-
"names": ["styles", "i", "bl_notification_card_default", "CloseSource", "NOTIFICATION_VARIANT_ALERT_MAP", "BlNotificationCard", "s", "bl_notification_card_default", "_a", "_b", "source", "target", "x", "icon", "variant", "l", "__decorateClass", "e", "stringBooleanConverter", "event"]
|
|
7
|
-
}
|
package/dist/chunk-VU6LRFZR.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import{a as f}from"./chunk-6LT7O7T2.js";import{a as n}from"./chunk-DINNT5P2.js";import{a as y}from"./chunk-GRL4DWKG.js";import{a as v,b as e,c as m,e as g}from"./chunk-5MOOXA2X.js";import{a as u,b as a,f as p}from"./chunk-4OT5AMS5.js";import{d as o}from"./chunk-IZ2LK5GK.js";var _=l=>{if(!(!l.noValidate&&!l.reportValidity())){let b=new SubmitEvent("submit",{bubbles:!0,cancelable:!0});l.dispatchEvent(b),b.defaultPrevented||l.submit()}};var z=u`: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(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button,:host(: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:none}.button:focus-visible{position:relative;outline:none}.button:focus-visible::after{border:2px solid var(--bl-button-focus-border-color, var(--main-color));border-radius:var(--bl-border-radius-l);content:"";position:absolute;inset:-4px}: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 .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"].__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button[aria-disabled="false"],:host([variant="secondary"]:hover) .button[aria-disabled="false"]{--content-color:var(--bl-color-neutral-full);--bg-color:var(--main-hover-color)}:host([variant="tertiary"].__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button[aria-disabled="false"],:host([variant="tertiary"]: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}`,x=z;var t=class extends p{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[x]}get _isActive(){return this.active}connectedCallback(){super.connectedCallback()}caretTemplate(){return a` <bl-icon class="open" name="arrow_up"></bl-icon>
|
|
2
|
-
<bl-icon class="close" name="arrow_down"></bl-icon>`}_handleClick(){if(this.type==="submit"){let r;this.form instanceof HTMLFormElement?r=this.form:typeof this.form=="string"?r=document.getElementById(this.form):r=this.closest("form"),r&&_(r)}this.onClick("Click event fired!")}focus(){this.button.focus()}get _hasIconSlot(){return this.querySelector(':scope > [slot="icon"]')!==null}get _hasDefaultSlot(){return[...this.childNodes].some(i=>{var c;let s=i.nodeType;return s===i.TEXT_NODE&&((c=i.textContent)==null?void 0:c.trim())!==""||s===i.ELEMENT_NODE&&!i.hasAttribute("slot")})}render(){let r=this.loading||this.disabled,i=this.loading&&this.loadingLabel?this.loadingLabel:a`<slot></slot>`,s=!!this.href,c=this.icon?a`<bl-icon name=${this.icon}></bl-icon>`:"",T=a`<bl-spinner
|
|
3
|
-
class="loading-spinner"
|
|
4
|
-
?disabled="${r}"
|
|
5
|
-
size="${this.size}"
|
|
6
|
-
></bl-spinner>`,d=a`<slot name="icon">${this.loading?T:c}</slot>
|
|
7
|
-
<span class="label">${i}</span>`,E=this.dropdown?this.caretTemplate():"",h=f({button:!0,"has-icon":this.icon||this._hasIconSlot,"has-content":this._hasDefaultSlot,active:!s&&this._isActive});return s?a`<a
|
|
8
|
-
class=${h}
|
|
9
|
-
?autofocus=${this.autofocus}
|
|
10
|
-
aria-disabled="${n(r)}"
|
|
11
|
-
aria-label="${n(this.label)}"
|
|
12
|
-
href=${n(this.href)}
|
|
13
|
-
target=${n(this.target)}
|
|
14
|
-
role="button"
|
|
15
|
-
>${d}
|
|
16
|
-
</a>`:a`<button
|
|
17
|
-
class=${h}
|
|
18
|
-
?autofocus=${this.autofocus}
|
|
19
|
-
aria-disabled="${n(r)}"
|
|
20
|
-
aria-label="${n(this.label)}"
|
|
21
|
-
?disabled=${r}
|
|
22
|
-
@click="${this._handleClick}"
|
|
23
|
-
>
|
|
24
|
-
${d} ${E}
|
|
25
|
-
</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([e({type:String})],t.prototype,"form",2),o([m({})],t.prototype,"active",2),o([g(".button")],t.prototype,"button",2),o([y("bl-click")],t.prototype,"onClick",2),t=o([v("bl-button")],t);export{_ as a,t as b};
|
|
26
|
-
//# sourceMappingURL=chunk-VU6LRFZR.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`: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(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button,:host(: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:none}.button:focus-visible{position:relative;outline:none}.button:focus-visible::after{border:2px solid var(--bl-button-focus-border-color, var(--main-color));border-radius:var(--bl-border-radius-l);content:\"\";position:absolute;inset:-4px}: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 .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\"].__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button[aria-disabled=\"false\"],:host([variant=\"secondary\"]:hover) .button[aria-disabled=\"false\"]{--content-color:var(--bl-color-neutral-full);--bg-color:var(--main-hover-color)}:host([variant=\"tertiary\"].__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .button[aria-disabled=\"false\"],:host([variant=\"tertiary\"]: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 \"../icon/bl-icon\";\nimport { BaklavaIcon } from \"../icon/icon-list\";\nimport \"../spinner/bl-spinner\";\nimport style from \"./bl-button.css\";\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?: BaklavaIcon;\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\";\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 * Sets the associated form of the button. Use when `type` is set to `submit` and button is not inside the target form.\n */\n @property({ type: String })\n form: HTMLFormElement | string;\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 connectedCallback() {\n super.connectedCallback();\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\") {\n let targetForm: HTMLFormElement;\n\n if (this.form instanceof HTMLFormElement) {\n targetForm = this.form;\n } else if (typeof this.form === \"string\") {\n targetForm = document.getElementById(this.form) as HTMLFormElement;\n } else {\n targetForm = this.closest(\"form\") as HTMLFormElement;\n }\n\n if (targetForm) {\n submit(targetForm);\n }\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\n return childNodes.some(node => {\n const nodeType = node.nodeType;\n\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 = html`<bl-spinner\n class=\"loading-spinner\"\n ?disabled=\"${isDisabled}\"\n size=\"${this.size}\"\n ></bl-spinner>`;\n const slots = html`<slot name=\"icon\">${this.loading ? loadingIcon : icon}</slot>\n <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 >${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 ${slots} ${caret}\n </button>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bl-button\": BlButton;\n }\n}\n"],
|
|
5
|
-
"mappings": "mRAOO,IAAMA,EAAUC,GAA+B,C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,QAAS,QAAS,EAAK,CAAC,GAtCvBnB,EAuCnB,uBAMAmB,EAAA,CADC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GA5CvBnB,EA6CnB,wBAMAmB,EAAA,CADC,EAAS,CAAE,KAAM,MAAO,CAAC,GAlDPnB,EAmDnB,oBAMAmB,EAAA,CADC,EAAS,CAAE,KAAM,MAAO,CAAC,GAxDPnB,EAyDnB,oBAMAmB,EAAA,CADC,EAAS,CAAE,KAAM,MAAO,CAAC,GA9DPnB,EA+DnB,sBAMAmB,EAAA,CADC,EAAS,CAAE,KAAM,MAAO,CAAC,GApEPnB,EAqEnB,oBAMAmB,EAAA,CADC,EAAS,CAAE,KAAM,OAAQ,CAAC,GA1ERnB,EA2EnB,wBAMAmB,EAAA,CADC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAhFvBnB,EAiFnB,yBAMAmB,EAAA,CADC,EAAS,CAAE,KAAM,MAAO,CAAC,GAtFPnB,EAuFnB,oBAMAmB,EAAA,CADCC,EAAM,CAAC,CAAC,GA5FUpB,EA6FnB,sBAGQmB,EAAA,CADPE,EAAM,SAAS,GA/FGrB,EAgGX,sBAKmBmB,EAAA,CAA1BG,EAAM,UAAU,GArGEtB,EAqGQ,uBArGRA,EAArBmB,EAAA,CADCI,EAAc,WAAW,GACLvB",
|
|
6
|
-
"names": ["submit", "form", "submitEvent", "styles", "i", "bl_button_default", "BlButton", "s", "bl_button_default", "x", "targetForm", "submit", "node", "_a", "nodeType", "isDisabled", "label", "isAnchor", "icon", "loadingIcon", "slots", "caret", "classes", "o", "l", "__decorateClass", "t", "i", "event", "e"]
|
|
7
|
-
}
|
package/dist/chunk-WXWKIQAK.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./chunk-GRL4DWKG.js";import{a as c,b as l,c as p,e as u}from"./chunk-5MOOXA2X.js";import{a as n,b as i,f as a}from"./chunk-4OT5AMS5.js";import{d as o}from"./chunk-IZ2LK5GK.js";var d=n`:host{position:relative}.option-container{--option-font:var(--bl-font-title-3-regular);--option-spacing:var(--bl-size-xs) 0;--option-selected-color:var(--bl-color-primary);--option-hover-color:var(--bl-color-primary-highlight);--option-color:var(--bl-color-neutral-darker);--option-disabled-color:var(--bl-color-neutral-light);--option-separator:1px solid var(--bl-color-neutral-lighter);--option-gap:var(--bl-size-2xs);--option-transition:color 120ms ease-out}.option-container::after{position:absolute;content:"";width:100%;bottom:0;border-bottom:var(--option-separator)}.no-border-bottom::after{border-bottom:none}:host(:last-of-type) .option-container::after{border-bottom:none}.single-option{width:100%;display:block;cursor:pointer;color:var(--option-color);margin:var(--option-spacing);transition:var(--option-transition);font:var(--option-font);user-select:none;position:relative;outline:none}.single-option:focus-visible::after{content:"";position:absolute;inset:calc(var(--bl-size-3xs) * -1);border:var(--bl-size-4xs) solid var(--option-hover-color);border-radius:var(--bl-size-4xs)}:host(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .single-option,:host(:hover) .single-option{color:var(--option-hover-color)}:host([selected]) .single-option{color:var(--option-selected-color)}:host([disabled]){cursor:not-allowed}:host([disabled]) .single-option{color:var(--option-disabled-color);cursor:not-allowed;pointer-events:none}.checkbox-option{width:100%;display:block;color:var(--option-color);padding:var(--option-spacing)}`,h=d;var e=class extends a{constructor(){super(...arguments);this.label="";this.disabled=!1;this.selected=!1;this.multiple=!1}static get styles(){return[h]}get value(){return this._value||this.textContent}set value(t){this._value=t}focus(){this.multiple||(this.focusTarget.tabIndex=0),this.focusTarget.focus(),this.onFocus(this.value)}blur(){this.onBlur(this.value),this.focusTarget.tabIndex=-1}singleOptionTemplate(){return i`<div
|
|
2
|
-
class="single-option focus-target"
|
|
3
|
-
@blur=${this.blur}
|
|
4
|
-
@keydown=${this.handleKeydown}
|
|
5
|
-
@click="${this._onClickOption}"
|
|
6
|
-
role="option"
|
|
7
|
-
aria-selected="${this.selected}"
|
|
8
|
-
>
|
|
9
|
-
<slot></slot>
|
|
10
|
-
</div>`}checkboxOptionTemplate(){return i`<bl-checkbox
|
|
11
|
-
class="checkbox-option focus-target"
|
|
12
|
-
.checked="${this.selected}"
|
|
13
|
-
.disabled="${this.disabled}"
|
|
14
|
-
@bl-checkbox-change="${this._onCheckboxChange}"
|
|
15
|
-
role="option"
|
|
16
|
-
aria-selected="${this.selected}"
|
|
17
|
-
>
|
|
18
|
-
<slot></slot>
|
|
19
|
-
</bl-checkbox>`}render(){return i`<div class="option-container">
|
|
20
|
-
${this.multiple?this.checkboxOptionTemplate():this.singleOptionTemplate()}
|
|
21
|
-
</div>`}handleKeydown(t){(t.code==="Enter"||t.code==="Space")&&(this._onClickOption(),t.preventDefault())}_handleEvent(){this._onSelect(this.value)}_onClickOption(){this.selected=!this.selected,this._handleEvent()}_onCheckboxChange(t){this.selected=t.detail,this._handleEvent()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t,s;this.blSelect=this.closest("bl-select"),this.multiple=((t=this.blSelect)==null?void 0:t.multiple)||!1,(s=this.blSelect)==null||s.registerOption(this)})}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.blSelect)==null||t.unregisterOption(this)}};o([l({})],e.prototype,"value",1),o([l({type:String,reflect:!0,attribute:"label"})],e.prototype,"label",2),o([l({type:Boolean,reflect:!0})],e.prototype,"disabled",2),o([l({type:Boolean,reflect:!0})],e.prototype,"selected",2),o([p()],e.prototype,"multiple",2),o([r("bl-select-option")],e.prototype,"_onSelect",2),o([r("bl-focus")],e.prototype,"onFocus",2),o([r("bl-blur")],e.prototype,"onBlur",2),o([u(".focus-target")],e.prototype,"focusTarget",2),e=o([c("bl-select-option")],e);export{e as a};
|
|
22
|
-
//# sourceMappingURL=chunk-WXWKIQAK.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/select/option/bl-select-option.css", "../src/components/select/option/bl-select-option.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`:host{position:relative}.option-container{--option-font:var(--bl-font-title-3-regular);--option-spacing:var(--bl-size-xs) 0;--option-selected-color:var(--bl-color-primary);--option-hover-color:var(--bl-color-primary-highlight);--option-color:var(--bl-color-neutral-darker);--option-disabled-color:var(--bl-color-neutral-light);--option-separator:1px solid var(--bl-color-neutral-lighter);--option-gap:var(--bl-size-2xs);--option-transition:color 120ms ease-out}.option-container::after{position:absolute;content:\"\";width:100%;bottom:0;border-bottom:var(--option-separator)}.no-border-bottom::after{border-bottom:none}:host(:last-of-type) .option-container::after{border-bottom:none}.single-option{width:100%;display:block;cursor:pointer;color:var(--option-color);margin:var(--option-spacing);transition:var(--option-transition);font:var(--option-font);user-select:none;position:relative;outline:none}.single-option:focus-visible::after{content:\"\";position:absolute;inset:calc(var(--bl-size-3xs) * -1);border:var(--bl-size-4xs) solid var(--option-hover-color);border-radius:var(--bl-size-4xs)}:host(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .single-option,:host(:hover) .single-option{color:var(--option-hover-color)}:host([selected]) .single-option{color:var(--option-selected-color)}:host([disabled]){cursor:not-allowed}:host([disabled]) .single-option{color:var(--option-disabled-color);cursor:not-allowed;pointer-events:none}.checkbox-option{width:100%;display:block;color:var(--option-color);padding:var(--option-spacing)}`;\nexport default styles;\n", "import { CSSResultGroup, html, LitElement } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { FormValue } from \"@open-wc/form-helpers\";\nimport { event, EventDispatcher } from \"../../../utilities/event\";\nimport BlSelect from \"../bl-select\";\nimport style from \"./bl-select-option.css\";\n\n@customElement(\"bl-select-option\")\nexport default class BlSelectOption<ValueType extends FormValue = string> extends LitElement {\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n private _value: ValueType;\n\n /* Declare reactive properties */\n /**\n * Sets the value for the option\n */\n @property({})\n get value(): ValueType {\n return this._value || (this.textContent as ValueType);\n }\n\n set value(val: ValueType) {\n this._value = val;\n }\n\n /**\n * Sets the label for bl-select, and bl-select renders this value instead of the option's textContent\n */\n @property({ type: String, reflect: true, attribute: \"label\" })\n label = \"\";\n\n /**\n * Sets option as disabled\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * Sets option as selected state\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n @state()\n multiple = false;\n\n /**\n * Fires when clicked on the option\n */\n @event(\"bl-select-option\") private _onSelect: EventDispatcher<ValueType | string | null>;\n\n /**\n * Fires when checkbox is focused\n */\n @event(\"bl-focus\") private onFocus: EventDispatcher<ValueType | string | null>;\n\n /**\n * Fires when checkbox is blurred\n */\n @event(\"bl-blur\") private onBlur: EventDispatcher<ValueType | string | null>;\n\n @query(\".focus-target\") private focusTarget: HTMLElement;\n\n /**\n * Focuses this option\n */\n focus() {\n if (!this.multiple) {\n this.focusTarget.tabIndex = 0;\n }\n this.focusTarget.focus();\n this.onFocus(this.value);\n }\n\n /**\n * Blurs from this option\n */\n blur() {\n this.onBlur(this.value);\n this.focusTarget.tabIndex = -1;\n }\n\n private blSelect: BlSelect<ValueType> | null;\n\n private singleOptionTemplate() {\n return html`<div\n class=\"single-option focus-target\"\n @blur=${this.blur}\n @keydown=${this.handleKeydown}\n @click=\"${this._onClickOption}\"\n role=\"option\"\n aria-selected=\"${this.selected}\"\n >\n <slot></slot>\n </div>`;\n }\n\n private checkboxOptionTemplate() {\n return html`<bl-checkbox\n class=\"checkbox-option focus-target\"\n .checked=\"${this.selected}\"\n .disabled=\"${this.disabled}\"\n @bl-checkbox-change=\"${this._onCheckboxChange}\"\n role=\"option\"\n aria-selected=\"${this.selected}\"\n >\n <slot></slot>\n </bl-checkbox>`;\n }\n\n render() {\n return html`<div class=\"option-container\">\n ${this.multiple ? this.checkboxOptionTemplate() : this.singleOptionTemplate()}\n </div>`;\n }\n\n private handleKeydown(event: KeyboardEvent) {\n if (event.code === \"Enter\" || event.code === \"Space\") {\n this._onClickOption();\n event.preventDefault();\n }\n }\n\n private _handleEvent() {\n this._onSelect(this.value);\n }\n\n private _onClickOption() {\n this.selected = !this.selected;\n this._handleEvent();\n }\n\n private _onCheckboxChange(event: CustomEvent) {\n this.selected = event.detail;\n this._handleEvent();\n }\n\n connectedCallback() {\n super.connectedCallback();\n\n this.updateComplete.then(() => {\n this.blSelect = this.closest<BlSelect<ValueType>>(\"bl-select\");\n // FIXME: We should warn when parent is not bl-select\n\n this.multiple = this.blSelect?.multiple || false;\n this.blSelect?.registerOption(this);\n });\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.blSelect?.unregisterOption(this);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bl-select-option\": BlSelectOption;\n }\n}\n"],
|
|
5
|
-
"mappings": "mMACO,IAAMA,EAASC,6/CACfC,EAAQF,ECMf,IAAqBG,EAArB,cAAkFC,CAAW,CAA7F,kCAwBE,WAAQ,GAMR,cAAW,GAMX,cAAW,GAGX,cAAW,GAtCX,WAAW,QAAyB,CAClC,MAAO,CAACC,CAAK,CACf,CASA,IAAI,OAAmB,CACrB,OAAO,KAAK,QAAW,KAAK,WAC9B,CAEA,IAAI,MAAMC,EAAgB,CACxB,KAAK,OAASA,CAChB,CA2CA,OAAQ,CACD,KAAK,WACR,KAAK,YAAY,SAAW,GAE9B,KAAK,YAAY,MAAM,EACvB,KAAK,QAAQ,KAAK,KAAK,CACzB,CAKA,MAAO,CACL,KAAK,OAAO,KAAK,KAAK,EACtB,KAAK,YAAY,SAAW,EAC9B,CAIQ,sBAAuB,CAC7B,OAAOC;AAAA;AAAA,cAEG,KAAK;AAAA,iBACF,KAAK;AAAA,gBACN,KAAK;AAAA;AAAA,uBAEE,KAAK;AAAA;AAAA;AAAA,WAI1B,CAEQ,wBAAyB,CAC/B,OAAOA;AAAA;AAAA,kBAEO,KAAK;AAAA,mBACJ,KAAK;AAAA,6BACK,KAAK;AAAA;AAAA,uBAEX,KAAK;AAAA;AAAA;AAAA,mBAI1B,CAEA,QAAS,CACP,OAAOA;AAAA,QACH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O,sBAEMQ,EAAA,CAA/BG,EAAM,eAAe,GAxDHX,EAwDa,2BAxDbA,EAArBQ,EAAA,CADCC,EAAc,kBAAkB,GACZT",
|
|
6
|
-
"names": ["styles", "i", "bl_select_option_default", "BlSelectOption", "s", "bl_select_option_default", "val", "x", "event", "_a", "_b", "__decorateClass", "e", "t", "i"]
|
|
7
|
-
}
|
package/dist/chunk-X73CSBRO.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-6LT7O7T2.js";import{a as u}from"./chunk-ECPWEUBG.js";import{a as m}from"./chunk-GRL4DWKG.js";import{a as l,b as o,e as i}from"./chunk-5MOOXA2X.js";import{a as s,b as r,f as n}from"./chunk-4OT5AMS5.js";import{d as e}from"./chunk-IZ2LK5GK.js";var p=s`:host{display:block}.accordion{--border:1px solid var(--bl-color-neutral-lighter);--default-radius:var(--bl-size-2xs);--radius-top-left:var(--bl-accordion-radius-top-left, var(--default-radius));--radius-top-right:var(--bl-accordion-radius-top-right, var(--default-radius));--radius-bottom-right:var(--bl-accordion-radius-bottom-right, var(--default-radius));--radius-bottom-left:var(--bl-accordion-radius-bottom-left, var(--default-radius));width:100%}.summary{list-style:none;user-select:none;cursor:pointer;font:var(--bl-font-title-3-medium);display:flex;align-items:center;justify-content:space-between;gap:var(--bl-size-2xs);padding:var(--bl-size-m);background:var(--bl-color-neutral-full);color:var(--bl-color-neutral-darker);border:var(--border);border-bottom:var(--bl-accordion-border-bottom, var(--border));border-radius:var(--radius-top-left) var(--radius-top-right) var(--radius-bottom-right) var(--radius-bottom-left);transition:background-color 200ms}.summary::-webkit-details-marker{display:none}.summary.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__,.summary:hover{background:var(--bl-color-neutral-lightest)}.summary:focus-visible{outline:2px solid var(--bl-color-primary);outline-offset:-1px}.indicator{transition:transform 200ms}.accordion[open] .indicator{transform:rotate(180deg)}.accordion[open] .summary{border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.caption{flex:1}.accordion-content{padding:var(--bl-size-m);background:var(--bl-color-neutral-full);border:var(--border);border-top:0;border-bottom:var(--bl-accordion-border-bottom, var(--border));border-bottom-left-radius:var(--radius-bottom-left);border-bottom-right-radius:var(--radius-bottom-right);font:var(--bl-font-body-text-2-regular)}.disabled .summary{cursor:not-allowed;background:var(--bl-color-neutral-lightest);color:var(--bl-color-neutral-light)}.accordion:not([open]) .accordion-content{display:none}`,c=p;var t=class extends n{constructor(){super(...arguments);this.open=!1;this.disabled=!1;this.animationDuration=250;this._animationStatus=null}static get styles(){return[c]}_animate(a){this._animationStatus=a?0:1;let b=`${this.detailsEl.offsetHeight}px`,h=a?`${this.summaryEl.offsetHeight+this.contentEl.offsetHeight}px`:`${this.summaryEl.offsetHeight}px`;this._animation&&this._animation.cancel(),this._animation=this.detailsEl.animate({height:[b,h]},{duration:this.animationDuration,easing:"ease-out"}),this._animation.onfinish=()=>this._onAnimationFinish(a),this._animation.oncancel=()=>this._animationStatus=null}_onAnimationFinish(a){this.open=a,this._animation=null,this._animationStatus=null,this.detailsEl.style.height=this.detailsEl.style.overflow=""}expand(){this.detailsEl.style.overflow="hidden",this.detailsEl.style.height=`${this.detailsEl.offsetHeight}px`,this.open=!0,this._animate(!0)}collapse(){this._animate(!1)}_clickHandler(a){a.preventDefault(),!this.disabled&&(this._animationStatus===1||!this.open?this.expand():(this._animationStatus===0||this.open)&&this.collapse())}updated(a){if(a.has("open")){if(this.disabled&&this.open){this._onAnimationFinish(!1);return}this._onToggle(this.open)}}render(){let a=this.icon?r`<bl-icon class="icon" name=${this.icon===!0?"info":this.icon}></bl-icon>`:null;return r`<details
|
|
2
|
-
?open=${this.open}
|
|
3
|
-
class=${d({accordion:!0,disabled:this.disabled})}
|
|
4
|
-
>
|
|
5
|
-
<summary
|
|
6
|
-
class="summary"
|
|
7
|
-
@click="${this._clickHandler}"
|
|
8
|
-
aria-expanded=${this.open?"true":"false"}
|
|
9
|
-
aria-controls="content"
|
|
10
|
-
aria-disabled=${this.disabled?"true":"false"}
|
|
11
|
-
tabindex=${this.disabled?"-1":"0"}
|
|
12
|
-
>
|
|
13
|
-
${a}
|
|
14
|
-
<slot name="caption">
|
|
15
|
-
<span class="caption"> ${this.caption} </span>
|
|
16
|
-
</slot>
|
|
17
|
-
<bl-icon name="arrow_down" class="indicator"></bl-icon>
|
|
18
|
-
</summary>
|
|
19
|
-
|
|
20
|
-
<div class="accordion-content" role="region" aria-labelledby="header" id="content">
|
|
21
|
-
<slot></slot>
|
|
22
|
-
</div>
|
|
23
|
-
</details>`}};e([o({reflect:!0,type:Boolean})],t.prototype,"open",2),e([o({reflect:!0})],t.prototype,"caption",2),e([o({converter:u()})],t.prototype,"icon",2),e([o({reflect:!0,type:Boolean})],t.prototype,"disabled",2),e([m("bl-toggle")],t.prototype,"_onToggle",2),e([o({type:Number})],t.prototype,"animationDuration",2),e([i("details")],t.prototype,"detailsEl",2),e([i("summary")],t.prototype,"summaryEl",2),e([i(".accordion-content")],t.prototype,"contentEl",2),t=e([l("bl-accordion")],t);export{t as a};
|
|
24
|
-
//# sourceMappingURL=chunk-X73CSBRO.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/accordion-group/accordion/bl-accordion.css", "../src/components/accordion-group/accordion/bl-accordion.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`:host{display:block}.accordion{--border:1px solid var(--bl-color-neutral-lighter);--default-radius:var(--bl-size-2xs);--radius-top-left:var(--bl-accordion-radius-top-left, var(--default-radius));--radius-top-right:var(--bl-accordion-radius-top-right, var(--default-radius));--radius-bottom-right:var(--bl-accordion-radius-bottom-right, var(--default-radius));--radius-bottom-left:var(--bl-accordion-radius-bottom-left, var(--default-radius));width:100%}.summary{list-style:none;user-select:none;cursor:pointer;font:var(--bl-font-title-3-medium);display:flex;align-items:center;justify-content:space-between;gap:var(--bl-size-2xs);padding:var(--bl-size-m);background:var(--bl-color-neutral-full);color:var(--bl-color-neutral-darker);border:var(--border);border-bottom:var(--bl-accordion-border-bottom, var(--border));border-radius:var(--radius-top-left) var(--radius-top-right) var(--radius-bottom-right) var(--radius-bottom-left);transition:background-color 200ms}.summary::-webkit-details-marker{display:none}.summary.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__,.summary:hover{background:var(--bl-color-neutral-lightest)}.summary:focus-visible{outline:2px solid var(--bl-color-primary);outline-offset:-1px}.indicator{transition:transform 200ms}.accordion[open] .indicator{transform:rotate(180deg)}.accordion[open] .summary{border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.caption{flex:1}.accordion-content{padding:var(--bl-size-m);background:var(--bl-color-neutral-full);border:var(--border);border-top:0;border-bottom:var(--bl-accordion-border-bottom, var(--border));border-bottom-left-radius:var(--radius-bottom-left);border-bottom-right-radius:var(--radius-bottom-right);font:var(--bl-font-body-text-2-regular)}.disabled .summary{cursor:not-allowed;background:var(--bl-color-neutral-lightest);color:var(--bl-color-neutral-light)}.accordion:not([open]) .accordion-content{display:none}`;\nexport default styles;\n", "import { html, LitElement, PropertyValues, TemplateResult } from \"lit\";\nimport { customElement, property, query } from \"lit/decorators.js\";\nimport { CSSResultGroup } from \"lit/development\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { event, EventDispatcher } from \"../../../utilities/event\";\nimport { stringBooleanConverter } from \"../../../utilities/string-boolean.converter\";\nimport \"../../icon/bl-icon\";\nimport { BaklavaIcon } from \"../../icon/icon-list\";\nimport style from \"./bl-accordion.css\";\n\nenum AnimationStatus {\n EXPANDING,\n COLLAPSING,\n}\n\n@customElement(\"bl-accordion\")\nexport default class BlAccordion extends LitElement {\n /**\n * Whether the accordion is expanded\n */\n @property({ reflect: true, type: Boolean })\n open = false;\n\n /**\n * Sets accordion caption.\n */\n @property({ reflect: true })\n caption?: string;\n\n /**\n * Add icon to beginning of the title\n */\n @property({ converter: stringBooleanConverter() })\n icon?: boolean | BaklavaIcon;\n\n /**\n * Whether the accordion is disabled\n */\n @property({ reflect: true, type: Boolean })\n disabled = false;\n\n /**\n * Fires when accordion open state change.\n */\n @event(\"bl-toggle\") private _onToggle: EventDispatcher<boolean>;\n\n @property({ type: Number })\n animationDuration = 250;\n\n private _animation: Animation | null;\n private _animationStatus: AnimationStatus | null = null;\n\n @query(\"details\")\n detailsEl: HTMLDetailsElement;\n\n @query(\"summary\")\n summaryEl: HTMLElement;\n\n @query(\".accordion-content\")\n contentEl: HTMLElement;\n\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n _animate(isExpanding: boolean) {\n this._animationStatus = isExpanding ? AnimationStatus.EXPANDING : AnimationStatus.COLLAPSING;\n\n const startHeight = `${this.detailsEl.offsetHeight}px`;\n const endHeight = isExpanding\n ? `${this.summaryEl.offsetHeight + this.contentEl.offsetHeight}px`\n : `${this.summaryEl.offsetHeight}px`;\n\n if (this._animation) {\n this._animation.cancel();\n }\n\n this._animation = this.detailsEl.animate(\n {\n height: [startHeight, endHeight],\n },\n {\n duration: this.animationDuration,\n easing: \"ease-out\",\n }\n );\n\n this._animation.onfinish = () => this._onAnimationFinish(isExpanding);\n this._animation.oncancel = () => (this._animationStatus = null);\n }\n\n private _onAnimationFinish(open: boolean) {\n this.open = open;\n this._animation = null;\n this._animationStatus = null;\n this.detailsEl.style.height = this.detailsEl.style.overflow = \"\";\n }\n\n expand() {\n this.detailsEl.style.overflow = \"hidden\";\n this.detailsEl.style.height = `${this.detailsEl.offsetHeight}px`;\n this.open = true;\n this._animate(true);\n }\n\n collapse() {\n this._animate(false);\n }\n\n private _clickHandler(e: Event) {\n e.preventDefault();\n\n if (this.disabled) return;\n\n if (this._animationStatus === AnimationStatus.COLLAPSING || !this.open) {\n this.expand();\n } else if (this._animationStatus === AnimationStatus.EXPANDING || this.open) {\n this.collapse();\n }\n }\n\n protected updated(_changedProperties: PropertyValues) {\n if (_changedProperties.has(\"open\")) {\n if (this.disabled && this.open) {\n this._onAnimationFinish(false);\n return;\n }\n\n this._onToggle(this.open);\n }\n }\n\n render(): TemplateResult {\n const icon = this.icon\n ? html`<bl-icon class=\"icon\" name=${this.icon === true ? \"info\" : this.icon}></bl-icon>`\n : null;\n\n return html`<details\n ?open=${this.open}\n class=${classMap({\n accordion: true,\n disabled: this.disabled,\n })}\n >\n <summary\n class=\"summary\"\n @click=\"${this._clickHandler}\"\n aria-expanded=${this.open ? \"true\" : \"false\"}\n aria-controls=\"content\"\n aria-disabled=${this.disabled ? \"true\" : \"false\"}\n tabindex=${this.disabled ? \"-1\" : \"0\"}\n >\n ${icon}\n <slot name=\"caption\">\n <span class=\"caption\"> ${this.caption} </span>\n </slot>\n <bl-icon name=\"arrow_down\" class=\"indicator\"></bl-icon>\n </summary>\n\n <div class=\"accordion-content\" role=\"region\" aria-labelledby=\"header\" id=\"content\">\n <slot></slot>\n </div>\n </details>`;\n }\n}\n"],
|
|
5
|
-
"mappings": "4QACO,IAAMA,EAASC,43DACfC,EAAQF,ECcf,IAAqBG,EAArB,cAAyCC,CAAW,CAApD,kCAKE,UAAO,GAkBP,cAAW,GAQX,uBAAoB,IAGpB,KAAQ,iBAA2C,KAWnD,WAAW,QAAyB,CAClC,MAAO,CAACC,CAAK,CACf,CAEA,SAASC,EAAsB,CAC7B,KAAK,iBAAmBA,EAAc,EAA4B,EAElE,IAAMC,EAAc,GAAG,KAAK,UAAU,iBAChCC,EAAYF,EACd,GAAG,KAAK,UAAU,aAAe,KAAK,UAAU,iBAChD,GAAG,KAAK,UAAU,iBAElB,KAAK,YACP,KAAK,WAAW,OAAO,EAGzB,KAAK,WAAa,KAAK,UAAU,QAC/B,CACE,OAAQ,CAACC,EAAaC,CAAS,CACjC,EACA,CACE,SAAU,KAAK,kBACf,OAAQ,UACV,CACF,EAEA,KAAK,WAAW,SAAW,IAAM,KAAK,mBAAmBF,CAAW,EACpE,KAAK,WAAW,SAAW,IAAO,KAAK,iBAAmB,IAC5D,CAEQ,mBAAmBG,EAAe,CACxC,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EAAuB,CAAE,CAAC,GAhB9Bb,EAiBnB,oBAMAY,EAAA,CADCL,EAAS,CAAE,QAAS,GAAM,KAAM,OAAQ,CAAC,GAtBvBP,EAuBnB,wBAK4BY,EAAA,CAA3BE,EAAM,WAAW,GA5BCd,EA4BS,yBAG5BY,EAAA,CADCL,EAAS,CAAE,KAAM,MAAO,CAAC,GA9BPP,EA+BnB,iCAMAY,EAAA,CADC,EAAM,SAAS,GApCGZ,EAqCnB,yBAGAY,EAAA,CADC,EAAM,SAAS,GAvCGZ,EAwCnB,yBAGAY,EAAA,CADC,EAAM,oBAAoB,GA1CRZ,EA2CnB,yBA3CmBA,EAArBY,EAAA,CADCL,EAAc,cAAc,GACRP",
|
|
6
|
-
"names": ["styles", "i", "bl_accordion_default", "BlAccordion", "s", "bl_accordion_default", "isExpanding", "startHeight", "endHeight", "open", "e", "_changedProperties", "icon", "x", "o", "__decorateClass", "stringBooleanConverter", "event"]
|
|
7
|
-
}
|
package/dist/chunk-YZRAUVUQ.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import{a as c}from"./chunk-GRL4DWKG.js";import{a,b as o,e as s}from"./chunk-5MOOXA2X.js";import{a as r,b as l,f as n}from"./chunk-4OT5AMS5.js";import{d as e}from"./chunk-IZ2LK5GK.js";var v=r`:host{position:relative;display:flex;align-items:center;background-color:var(--bl-color-neutral-full)}.container{--title-padding-vertical:var(--bl-size-m);--title-padding-horizontal:var(--bl-size-xl);--title-color:var(--bl-color-neutral-darker);--caption-color:var(--bl-color-neutral-darker);--icon-color:var(--bl-color-neutral-darker);--border-bottom-width:var(--bl-size-4xs);--border-left-space:var(--bl-size-xl);--font-title:var(--bl-font-title-3-medium);--font-caption:var(--bl-font-title-4-regular);--tab-right-padding:var(--bl-size-xl);--help-container-width:var(--bl-size-2xl);--tab-height:calc(var(--bl-size-3xl) + var(--bl-size-s));display:flex;border:none;cursor:pointer;background-color:initial;width:max-content;height:var(--tab-height);padding:0 var(--tab-right-padding);margin-inline-end:1px}.container::after{position:absolute;content:"";inset-inline-end:0;top:var(--bl-size-m);height:calc(100% - var(--bl-size-2xl));border-inline-end:1px solid var(--bl-color-neutral-lighter)}:host(:last-of-type) .container::after{border-inline-end:none}:host(:focus-visible){outline:none}:host(:focus-visible) .container,.container:focus-visible{outline:2px solid var(--bl-color-primary);outline-offset:calc(-1 * var(--bl-size-3xs));border-radius:var(--bl-border-radius-s)}:host .container::before{content:"";position:absolute;opacity:0;bottom:calc(-1 * var(--bl-size-4xs));inset-inline-start:var(--border-left-space);width:calc(100% - var(--bl-size-4xl));border-bottom:var(--border-bottom-width) solid var(--bl-color-primary)}:host([selected]:not([disabled])) .container::before{opacity:1}:host(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .container,:host([selected]) .container,:host(:hover) .container,:host([selected]) .container{--title-color:var(--bl-color-primary);--icon-color:var(--bl-color-primary)}:host([disabled]) .container{cursor:not-allowed;--title-color:var(--bl-color-neutral-lighter);--caption-color:var(--bl-color-neutral-lighter);--icon-color:var(--bl-color-neutral-lighter)}:host(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) :where(.title, .icon),:host(:hover) :where(.title, .icon){transition:color 120ms ease-out}:host([selected]) .border-bottom{display:inline-block}:host([disabled]) .container.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__,:host([disabled]) .container:hover{cursor:not-allowed}:host([help-text]) button{padding-inline-end:0}.tab-button{width:max-content}.help-container{display:flex;justify-content:center;align-items:center;width:var(--help-container-width);height:100%;font-size:var(--bl-font-size-m);pointer-events:visible;padding-inline-end:var(--tab-right-padding)}bl-tooltip{--bl-tooltip-position:fixed;display:flex}.title{display:flex;align-items:center;justify-content:center;font:var(--font-title);color:var(--title-color);line-height:var(--bl-size-m);white-space:nowrap}.title-container{display:flex;align-items:center;justify-content:center;flex-direction:column;margin:auto}.badge-container{padding-inline-start:var(--bl-size-3xs);display:flex;margin-bottom:1px}.caption{font:var(--font-caption);line-height:var(--bl-size-xs);color:var(--caption-color);text-align:center;margin-top:var(--bl-size-4xs)}.icon{display:flex;color:var(--icon-color);font-size:var(--bl-font-size-l);margin-inline-end:var(--bl-size-3xs);margin-bottom:1px}:host([notify]) .title::after{content:"";height:var(--bl-size-2xs);width:var(--bl-size-2xs);border-radius:var(--bl-size-3xs);margin-inline-start:var(--bl-size-3xs);background-color:var(--bl-color-danger);margin-bottom:1px}`,d=v;var t=class extends n{constructor(){super(...arguments);this.notify=!1;this.badge="";this.selected=!1;this.disabled=!1}static get styles(){return[d]}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var i;this.tabGroup=this.closest("bl-tab-group"),(i=this.tabGroup)==null||i.registerTab(this)})}disconnectedCallback(){var i;super.disconnectedCallback(),(i=this.tabGroup)==null||i.unregisterTab(this)}select(){this.selected=!0}focus(){this.tab.focus()}updated(i){this.tabIndex=this.selected?0:-1,i.has("selected")&&this.selected&&this._onSelect(this.name)}render(){let i=l` <slot></slot>`,b=this.helpText?l` <div class="help-container">
|
|
2
|
-
<bl-tooltip>
|
|
3
|
-
<bl-button
|
|
4
|
-
slot="tooltip-trigger"
|
|
5
|
-
icon="info"
|
|
6
|
-
variant="tertiary"
|
|
7
|
-
kind="neutral"
|
|
8
|
-
label="${this.helpText}"
|
|
9
|
-
></bl-button>
|
|
10
|
-
${this.helpText}
|
|
11
|
-
</bl-tooltip>
|
|
12
|
-
</div>`:null,p=this.icon?l` <div class="icon">
|
|
13
|
-
<bl-icon name="${this.icon}"></bl-icon>
|
|
14
|
-
</div>`:null,h=this.badge?l` <div class="badge-container">
|
|
15
|
-
<bl-badge size="small">${this.badge}</bl-badge>
|
|
16
|
-
</div>`:null,u=this.caption?l` <div class="caption">${this.caption}</div>`:null;return l`
|
|
17
|
-
<button
|
|
18
|
-
?disabled="${this.disabled}"
|
|
19
|
-
role="tab"
|
|
20
|
-
class="container"
|
|
21
|
-
@click="${()=>this.select()}"
|
|
22
|
-
aria-selected="${this.selected}"
|
|
23
|
-
>
|
|
24
|
-
<div class="title-container">
|
|
25
|
-
<div class="title">${p} ${i} ${h}</div>
|
|
26
|
-
${u}
|
|
27
|
-
</div>
|
|
28
|
-
${b}
|
|
29
|
-
</button>
|
|
30
|
-
`}};e([o({type:String})],t.prototype,"caption",2),e([o({type:String,reflect:!0})],t.prototype,"name",2),e([o({type:String,attribute:"help-text",reflect:!0})],t.prototype,"helpText",2),e([o({type:String})],t.prototype,"icon",2),e([o({type:Boolean,reflect:!0})],t.prototype,"notify",2),e([o({type:String})],t.prototype,"badge",2),e([o({type:Boolean,reflect:!0})],t.prototype,"selected",2),e([o({type:Boolean,reflect:!0})],t.prototype,"disabled",2),e([c("bl-tab-selected")],t.prototype,"_onSelect",2),e([s(".container")],t.prototype,"tab",2),t=e([a("bl-tab")],t);export{t as a};
|
|
31
|
-
//# sourceMappingURL=chunk-YZRAUVUQ.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/tab-group/tab/bl-tab.css", "../src/components/tab-group/tab/bl-tab.ts"],
|
|
4
|
-
"sourcesContent": ["import {css} from 'lit';\nexport const styles = css`:host{position:relative;display:flex;align-items:center;background-color:var(--bl-color-neutral-full)}.container{--title-padding-vertical:var(--bl-size-m);--title-padding-horizontal:var(--bl-size-xl);--title-color:var(--bl-color-neutral-darker);--caption-color:var(--bl-color-neutral-darker);--icon-color:var(--bl-color-neutral-darker);--border-bottom-width:var(--bl-size-4xs);--border-left-space:var(--bl-size-xl);--font-title:var(--bl-font-title-3-medium);--font-caption:var(--bl-font-title-4-regular);--tab-right-padding:var(--bl-size-xl);--help-container-width:var(--bl-size-2xl);--tab-height:calc(var(--bl-size-3xl) + var(--bl-size-s));display:flex;border:none;cursor:pointer;background-color:initial;width:max-content;height:var(--tab-height);padding:0 var(--tab-right-padding);margin-inline-end:1px}.container::after{position:absolute;content:\"\";inset-inline-end:0;top:var(--bl-size-m);height:calc(100% - var(--bl-size-2xl));border-inline-end:1px solid var(--bl-color-neutral-lighter)}:host(:last-of-type) .container::after{border-inline-end:none}:host(:focus-visible){outline:none}:host(:focus-visible) .container,.container:focus-visible{outline:2px solid var(--bl-color-primary);outline-offset:calc(-1 * var(--bl-size-3xs));border-radius:var(--bl-border-radius-s)}:host .container::before{content:\"\";position:absolute;opacity:0;bottom:calc(-1 * var(--bl-size-4xs));inset-inline-start:var(--border-left-space);width:calc(100% - var(--bl-size-4xl));border-bottom:var(--border-bottom-width) solid var(--bl-color-primary)}:host([selected]:not([disabled])) .container::before{opacity:1}:host(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) .container,:host([selected]) .container,:host(:hover) .container,:host([selected]) .container{--title-color:var(--bl-color-primary);--icon-color:var(--bl-color-primary)}:host([disabled]) .container{cursor:not-allowed;--title-color:var(--bl-color-neutral-lighter);--caption-color:var(--bl-color-neutral-lighter);--icon-color:var(--bl-color-neutral-lighter)}:host(.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__) :where(.title, .icon),:host(:hover) :where(.title, .icon){transition:color 120ms ease-out}:host([selected]) .border-bottom{display:inline-block}:host([disabled]) .container.__ONLY_FOR_STORYBOOK_DEMONSTRATION_HOVER__,:host([disabled]) .container:hover{cursor:not-allowed}:host([help-text]) button{padding-inline-end:0}.tab-button{width:max-content}.help-container{display:flex;justify-content:center;align-items:center;width:var(--help-container-width);height:100%;font-size:var(--bl-font-size-m);pointer-events:visible;padding-inline-end:var(--tab-right-padding)}bl-tooltip{--bl-tooltip-position:fixed;display:flex}.title{display:flex;align-items:center;justify-content:center;font:var(--font-title);color:var(--title-color);line-height:var(--bl-size-m);white-space:nowrap}.title-container{display:flex;align-items:center;justify-content:center;flex-direction:column;margin:auto}.badge-container{padding-inline-start:var(--bl-size-3xs);display:flex;margin-bottom:1px}.caption{font:var(--font-caption);line-height:var(--bl-size-xs);color:var(--caption-color);text-align:center;margin-top:var(--bl-size-4xs)}.icon{display:flex;color:var(--icon-color);font-size:var(--bl-font-size-l);margin-inline-end:var(--bl-size-3xs);margin-bottom:1px}:host([notify]) .title::after{content:\"\";height:var(--bl-size-2xs);width:var(--bl-size-2xs);border-radius:var(--bl-size-3xs);margin-inline-start:var(--bl-size-3xs);background-color:var(--bl-color-danger);margin-bottom:1px}`;\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 { BaklavaIcon } from \"../../icon/icon-list\";\nimport type BlTabGroup from \"../bl-tab-group\";\nimport style from \"./bl-tab.css\";\n\n/**\n * @tag bl-tab\n * @summary Baklava Tab component\n */\n@customElement(\"bl-tab\")\nexport default class BlTab extends LitElement {\n static get styles(): CSSResultGroup {\n return [style];\n }\n\n private tabGroup: BlTabGroup | null;\n\n connectedCallback() {\n super.connectedCallback();\n\n this.updateComplete.then(() => {\n this.tabGroup = this.closest<BlTabGroup>(\"bl-tab-group\");\n // FIXME: We need to warn if parent is not tab-group\n this.tabGroup?.registerTab(this);\n });\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.tabGroup?.unregisterTab(this);\n }\n\n /**\n * Sets the caption of tab\n */\n @property({ type: String })\n caption: string;\n\n /**\n * Name of the tab that should match `tab-panel`'s `tab` attribute\n */\n @property({ type: String, reflect: true })\n name: string;\n\n /**\n * Set tooltip text. Should be set to display information icon.\n */\n @property({ type: String, attribute: \"help-text\", reflect: true })\n helpText: string;\n\n /**\n * Name of the icon which display on the left side of the tab.\n */\n @property({ type: String })\n icon?: BaklavaIcon;\n\n /**\n * Shows notification dot.\n */\n @property({ type: Boolean, reflect: true })\n notify = false;\n\n /**\n * Sets the content of the badge.\n */\n @property({ type: String })\n badge = \"\";\n\n /**\n * Set `tab` as selected.\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * Set `tab` as disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * Fires when tab is selected.\n */\n @event(\"bl-tab-selected\") private _onSelect: EventDispatcher<string>;\n\n @query(\".container\")\n private tab: HTMLButtonElement;\n\n /**\n * Set tab selected.\n */\n select() {\n this.selected = true;\n }\n\n focus() {\n this.tab.focus();\n }\n\n updated(changedProperties: PropertyValues<this>) {\n this.tabIndex = this.selected ? 0 : -1;\n if (changedProperties.has(\"selected\") && this.selected) {\n this._onSelect(this.name);\n }\n }\n\n render(): TemplateResult {\n const title = html` <slot></slot>`;\n\n const helpTooltip = this.helpText\n ? html` <div class=\"help-container\">\n <bl-tooltip>\n <bl-button\n slot=\"tooltip-trigger\"\n icon=\"info\"\n variant=\"tertiary\"\n kind=\"neutral\"\n label=\"${this.helpText}\"\n ></bl-button>\n ${this.helpText}\n </bl-tooltip>\n </div>`\n : null;\n\n const icon = this.icon\n ? html` <div class=\"icon\">\n <bl-icon name=\"${this.icon}\"></bl-icon>\n </div>`\n : null;\n\n const badge = this.badge\n ? html` <div class=\"badge-container\">\n <bl-badge size=\"small\">${this.badge}</bl-badge>\n </div>`\n : null;\n\n const caption = this.caption ? html` <div class=\"caption\">${this.caption}</div>` : null;\n\n return html`\n <button\n ?disabled=\"${this.disabled}\"\n role=\"tab\"\n class=\"container\"\n @click=\"${() => this.select()}\"\n aria-selected=\"${this.selected}\"\n >\n <div class=\"title-container\">\n <div class=\"title\">${icon} ${title} ${badge}</div>\n ${caption}\n </div>\n ${helpTooltip}\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bl-tab\": BlTab;\n }\n}\n"],
|
|
5
|
-
"mappings": "uLACO,IAAMA,EAASC,u7GACfC,EAAQF,ECUf,IAAqBG,EAArB,cAAmCC,CAAW,CAA9C,kCAkDE,YAAS,GAMT,WAAQ,GAMR,cAAW,GAMX,cAAW,GAnEX,WAAW,QAAyB,CAClC,MAAO,CAACC,CAAK,CACf,CAIA,mBAAoB,CAClB,MAAM,kBAAkB,EAExB,KAAK,eAAe,KAAK,IAAM,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CAAE,KAAM,MAAO,CAAC,GA3CPZ,EA4CnB,oBAMAW,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAjDvBZ,EAkDnB,sBAMAW,EAAA,CADCC,EAAS,CAAE,KAAM,MAAO,CAAC,GAvDPZ,EAwDnB,qBAMAW,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GA7DvBZ,EA8DnB,wBAMAW,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAnEvBZ,EAoEnB,wBAKkCW,EAAA,CAAjCE,EAAM,iBAAiB,GAzELb,EAyEe,yBAG1BW,EAAA,CADPG,EAAM,YAAY,GA3EAd,EA4EX,mBA5EWA,EAArBW,EAAA,CADCC,EAAc,QAAQ,GACFZ",
|
|
6
|
-
"names": ["styles", "i", "bl_tab_default", "BlTab", "s", "bl_tab_default", "_a", "changedProperties", "title", "x", "helpTooltip", "icon", "badge", "caption", "__decorateClass", "e", "event", "i"]
|
|
7
|
-
}
|
|
File without changes
|
|
File without changes
|