@limetech/lime-elements 38.6.0 → 38.7.0
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/CHANGELOG.md +13 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-action-bar-item_2.cjs.entry.js +9 -2
- package/dist/cjs/limel-action-bar-item_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-action-bar_2.cjs.entry.js +35 -4
- package/dist/cjs/limel-action-bar_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-callout.cjs.entry.js +1 -1
- package/dist/cjs/limel-chart.cjs.entry.js +1 -1
- package/dist/cjs/limel-chip_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-file-viewer.cjs.entry.js +1 -1
- package/dist/cjs/limel-file.cjs.entry.js +1 -1
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +1 -1
- package/dist/cjs/limel-linear-progress.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
- package/dist/cjs/limel-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{translations-b5da5dcd.js → translations-15b2de28.js} +25 -1
- package/dist/cjs/translations-15b2de28.js.map +1 -0
- package/dist/collection/components/action-bar/action-bar-item/action-bar-overflow-menu.js +29 -2
- package/dist/collection/components/action-bar/action-bar-item/action-bar-overflow-menu.js.map +1 -1
- package/dist/collection/components/action-bar/action-bar.css +157 -0
- package/dist/collection/components/action-bar/action-bar.js +78 -3
- package/dist/collection/components/action-bar/action-bar.js.map +1 -1
- package/dist/collection/translations/da.js +3 -0
- package/dist/collection/translations/da.js.map +1 -1
- package/dist/collection/translations/de.js +3 -0
- package/dist/collection/translations/de.js.map +1 -1
- package/dist/collection/translations/en.js +3 -0
- package/dist/collection/translations/en.js.map +1 -1
- package/dist/collection/translations/fi.js +3 -0
- package/dist/collection/translations/fi.js.map +1 -1
- package/dist/collection/translations/fr.js +3 -0
- package/dist/collection/translations/fr.js.map +1 -1
- package/dist/collection/translations/nl.js +3 -0
- package/dist/collection/translations/nl.js.map +1 -1
- package/dist/collection/translations/no.js +3 -0
- package/dist/collection/translations/no.js.map +1 -1
- package/dist/collection/translations/sv.js +3 -0
- package/dist/collection/translations/sv.js.map +1 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-action-bar-item_2.entry.js +9 -2
- package/dist/esm/limel-action-bar-item_2.entry.js.map +1 -1
- package/dist/esm/limel-action-bar_2.entry.js +35 -4
- package/dist/esm/limel-action-bar_2.entry.js.map +1 -1
- package/dist/esm/limel-callout.entry.js +1 -1
- package/dist/esm/limel-chart.entry.js +1 -1
- package/dist/esm/limel-chip_2.entry.js +1 -1
- package/dist/esm/limel-file-viewer.entry.js +1 -1
- package/dist/esm/limel-file.entry.js +1 -1
- package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
- package/dist/esm/limel-linear-progress.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
- package/dist/esm/limel-snackbar.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{translations-8b7272f2.js → translations-e90e82a6.js} +25 -1
- package/dist/esm/translations-e90e82a6.js.map +1 -0
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js.map +1 -1
- package/dist/lime-elements/{p-aacbd012.entry.js → p-06b5aa10.entry.js} +2 -2
- package/dist/lime-elements/{p-3479aa66.entry.js → p-0aeff0b6.entry.js} +2 -2
- package/dist/lime-elements/{p-24a46d85.entry.js → p-1c16aa9b.entry.js} +2 -2
- package/dist/lime-elements/{p-5ac99c32.entry.js → p-2078a6e2.entry.js} +2 -2
- package/dist/lime-elements/{p-6de60593.entry.js → p-2793f6d0.entry.js} +2 -2
- package/dist/lime-elements/p-2793f6d0.entry.js.map +1 -0
- package/dist/lime-elements/{p-2ca8f253.entry.js → p-3a605df3.entry.js} +2 -2
- package/dist/lime-elements/p-7db872fd.entry.js +2 -0
- package/dist/lime-elements/p-7db872fd.entry.js.map +1 -0
- package/dist/lime-elements/{p-ac230166.entry.js → p-8900110f.entry.js} +2 -2
- package/dist/lime-elements/p-bf55e816.js +2 -0
- package/dist/lime-elements/p-bf55e816.js.map +1 -0
- package/dist/lime-elements/{p-54710fb8.entry.js → p-c632261b.entry.js} +2 -2
- package/dist/lime-elements/{p-8c15a058.entry.js → p-e329fd1e.entry.js} +2 -2
- package/dist/lime-elements/{p-ae417884.entry.js → p-fa8ea2db.entry.js} +2 -2
- package/dist/types/components/action-bar/action-bar-item/action-bar-overflow-menu.d.ts +7 -1
- package/dist/types/components/action-bar/action-bar.d.ts +18 -0
- package/dist/types/components.d.ts +32 -4
- package/dist/types/translations/da.d.ts +3 -0
- package/dist/types/translations/de.d.ts +3 -0
- package/dist/types/translations/en.d.ts +3 -0
- package/dist/types/translations/fi.d.ts +3 -0
- package/dist/types/translations/fr.d.ts +3 -0
- package/dist/types/translations/nl.d.ts +3 -0
- package/dist/types/translations/no.d.ts +3 -0
- package/dist/types/translations/sv.d.ts +3 -0
- package/package.json +3 -3
- package/dist/cjs/translations-b5da5dcd.js.map +0 -1
- package/dist/esm/translations-8b7272f2.js.map +0 -1
- package/dist/lime-elements/p-6de60593.entry.js.map +0 -1
- package/dist/lime-elements/p-bda61285.entry.js +0 -2
- package/dist/lime-elements/p-bda61285.entry.js.map +0 -1
- package/dist/lime-elements/p-e3d7aba7.js +0 -2
- package/dist/lime-elements/p-e3d7aba7.js.map +0 -1
- /package/dist/lime-elements/{p-aacbd012.entry.js.map → p-06b5aa10.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-3479aa66.entry.js.map → p-0aeff0b6.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-24a46d85.entry.js.map → p-1c16aa9b.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-5ac99c32.entry.js.map → p-2078a6e2.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-2ca8f253.entry.js.map → p-3a605df3.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-ac230166.entry.js.map → p-8900110f.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-54710fb8.entry.js.map → p-c632261b.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-8c15a058.entry.js.map → p-e329fd1e.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-ae417884.entry.js.map → p-fa8ea2db.entry.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["actionBarItemCss","ActionBarButton","constructor","hostRef","this","handleClick","event","stopPropagation","select","emit","item","tooltipId","createRandomString","componentWillLoad","makeEnterClickable","host","componentDidLoad","triggerIconColorWarning","disconnectedCallback","removeEnterClickable","render","isItem","separator","h","id","type","onClick","disabled","isDisabled","class","selected","renderIcon","renderLabel","renderTooltip","isVisible","icon","name","getIconName","color","getIconColor","iconColor","title","getIconTitle","style","iconOnly","text","elementId","label","getTooltipLabel","helperLabel","commandText","iconTitle","tooltipLabel","console","warn","ActionBarOverflowMenu","getOverflowTriggerContent","overFlowIcon","numberOfMenuItems","handleSelect","detail","openDirection","items","onSelect","slot","filter","isMenuItem","length"],"sources":["./src/components/action-bar/action-bar-item/action-bar-item.scss?tag=limel-action-bar-item","./src/components/action-bar/action-bar-item/action-bar-item.tsx","./src/components/action-bar/action-bar-item/action-bar-overflow-menu.tsx"],"sourcesContent":["@use '../../../style/mixins';\n@use '../../../style/functions';\n\nlimel-action-bar-item {\n transition: opacity 0.2s ease-in-out;\n position: relative;\n display: flex;\n align-items: center;\n\n &:not([is-visible]) {\n opacity: 0;\n pointer-events: none;\n }\n}\n\nbutton {\n all: unset;\n\n &:not([disabled]) {\n @include mixins.is-flat-inset-clickable(\n $color: var(--limel-action-bar-item-text-color),\n $color--hovered: var(--limel-action-bar-item-text-color),\n $background-color: var(--action-bar-background-color),\n $background-color--hovered: var(--action-bar-background-color),\n $background-color--inset: var(--action-bar-background-color)\n );\n @include mixins.visualize-keyboard-focus;\n }\n\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n\n width: 100%;\n min-width: var(--action-bar-item-height);\n max-width: var(--action-bar-item-max-width, 10rem);\n height: var(--action-bar-item-height);\n color: var(--limel-action-bar-item-text-color);\n\n border-radius: var(--action-bar-item-height);\n font-size: functions.pxToRem(14);\n padding: 0 0.25rem;\n\n &:has(.text) {\n padding: 0 0.5rem;\n }\n\n &[disabled] {\n opacity: 0.4;\n }\n\n &.is-selected {\n &:not(:hover) {\n box-shadow: var(--button-shadow-inset);\n }\n color: var(--mdc-theme-primary) !important;\n }\n}\n\n.text {\n @include mixins.truncate-text();\n padding: 0 0.25rem;\n}\n\nlimel-icon {\n flex-shrink: 0;\n width: calc(var(--action-bar-item-height) - 0.75rem);\n height: calc(var(--action-bar-item-height) - 0.75rem);\n color: var(\n --action-bar-item-icon-color,\n var(--limel-action-bar-item-text-color)\n );\n}\n\nhr {\n all: unset;\n width: 1px;\n height: 1.5rem;\n border-radius: var(--action-bar-item-height);\n background-color: var(--limel-action-bar-item-text-color);\n opacity: 0.2;\n\n @media (pointer: fine) {\n margin-right: 0.5rem;\n margin-left: 0.5rem;\n }\n}\n\n// 👇 Overflow menu\n\nlimel-menu {\n --notification-badge-background-color: rgb(var(--contrast-600));\n --notification-badge-text-color: rgb(var(--contrast-1200));\n\n &[open] {\n button {\n box-shadow: var(--button-shadow-inset);\n }\n }\n}\n\nbutton[slot='trigger'] {\n animation: fade-in ease-out 0.25s;\n font-size: 0.75rem;\n font-weight: bold;\n transform: translate3d(0, 0, 0);\n}\n\n@keyframes fade-in {\n 0% {\n scale: 0.8;\n opacity: 0;\n }\n 100% {\n scale: 1;\n opacity: 1;\n }\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n} from '@stencil/core';\nimport { ActionBarItem } from '../../action-bar/action-bar.types';\nimport { ListSeparator } from '../../list/list-item.types';\nimport { createRandomString } from '../../../util/random-string';\nimport {\n makeEnterClickable,\n removeEnterClickable,\n} from '../../../util/make-enter-clickable';\nimport {\n getIconColor,\n getIconName,\n getIconTitle,\n} from '../../icon/get-icon-props';\n\n/**\n * @private\n */\n@Component({\n tag: 'limel-action-bar-item',\n shadow: false,\n styleUrl: 'action-bar-item.scss',\n})\nexport class ActionBarButton {\n /**\n * Item that is placed in the action bar.\n */\n @Prop()\n public item!: ActionBarItem | ListSeparator;\n\n /**\n * Fired when a action bar item has been clicked.\n * @public\n */\n @Event()\n public select: EventEmitter<ActionBarItem | ListSeparator>;\n\n /**\n * When the item is displayed in the available width,\n * this will be `false`.\n */\n @Prop({ reflect: true })\n public isVisible: boolean = true;\n\n /**\n * When the item is selected, this will be `true`.\n */\n @Prop({ reflect: true })\n public selected: boolean = false;\n\n @Element()\n private readonly host: HTMLLimelActionBarItemElement;\n\n /**\n * Used to attach the right tooltip to the right button\n */\n private readonly tooltipId: string;\n\n constructor() {\n this.tooltipId = createRandomString();\n }\n\n public componentWillLoad() {\n makeEnterClickable(this.host);\n }\n\n public componentDidLoad() {\n this.triggerIconColorWarning();\n }\n\n public disconnectedCallback() {\n removeEnterClickable(this.host);\n }\n\n public render() {\n if (!this.isItem(this.item) && this.item.separator) {\n return <hr />;\n }\n\n return (\n <button\n id={this.tooltipId}\n type=\"button\"\n onClick={this.handleClick}\n disabled={this.isDisabled()}\n class={{\n 'is-selected': this.isItem(this.item) && this.item.selected,\n }}\n >\n {this.renderIcon()}\n {this.renderLabel()}\n {this.renderTooltip()}\n </button>\n );\n }\n\n private readonly handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.select.emit(this.item);\n };\n\n private isItem(item: ActionBarItem | ListSeparator): item is ActionBarItem {\n return !('separator' in item);\n }\n\n private isDisabled() {\n if (this.isItem(this.item) && this.item.disabled) {\n return true;\n }\n\n if (!this.isVisible) {\n return true;\n }\n }\n\n private renderIcon() {\n if (this.isItem(this.item) && !this.item.icon) {\n return;\n }\n\n if ('icon' in this.item) {\n const name = getIconName(this.item.icon);\n // eslint-disable-next-line sonarjs/deprecation\n const color = getIconColor(this.item.icon, this.item.iconColor);\n const title = getIconTitle(this.item.icon);\n\n return (\n <limel-icon\n name={name}\n aria-label={title}\n aria-hidden={title ? null : 'true'}\n style={{\n '--action-bar-item-icon-color': `${color}`,\n }}\n />\n );\n }\n }\n\n private renderLabel() {\n if (!this.isItem(this.item) || this.item.iconOnly) {\n return;\n }\n\n return <span class=\"text\">{this.item.text}</span>;\n }\n\n private renderTooltip() {\n if (!this.isItem(this.item)) {\n return;\n }\n\n return (\n <limel-tooltip\n elementId={this.tooltipId}\n label={this.getTooltipLabel(this.item)}\n helperLabel={this.item.commandText}\n />\n );\n }\n\n private getTooltipLabel(item: ActionBarItem): string {\n const iconTitle = getIconTitle(item.icon);\n const tooltipLabel = item.text;\n\n if (iconTitle && tooltipLabel) {\n return `${iconTitle} ${tooltipLabel}`;\n }\n\n return tooltipLabel;\n }\n\n private triggerIconColorWarning() {\n // eslint-disable-next-line sonarjs/deprecation\n if (this.isItem(this.item) && this.item.iconColor) {\n /* eslint-disable-next-line no-console */\n console.warn(\n \"The `iconColor` prop is deprecated now! Use the new `Icon` interface and instead of `iconColor: 'color-name'` write `icon {name: 'icon-name', color: 'color-name'}`.\",\n );\n }\n }\n}\n","import { Component, Prop, h, Event, EventEmitter } from '@stencil/core';\nimport { ActionBarItem } from '../../action-bar/action-bar.types';\nimport { ListSeparator } from '../../list/list-item.types';\nimport { MenuItem, OpenDirection } from '../../menu/menu.types';\nimport { LimelMenuCustomEvent } from '../../../components';\nimport { Icon } from '../../../global/shared-types/icon.types';\n\n/**\n * @private\n */\n@Component({\n tag: 'limel-action-bar-overflow-menu',\n shadow: false,\n})\nexport class ActionBarOverflowMenu {\n /**\n * List of the items that should be rendered in the overflow menu.\n */\n @Prop()\n public items: Array<MenuItem | ListSeparator>;\n\n /**\n * Defines the location that the content of the overflow menu\n * appears, in relation to its trigger.\n * It defaults to `bottom-end`, since in normal scenarios\n * (for example when the action bar is not floating at the bottom of the screen)\n * this menu is the right-most item in the user interface of the component.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection = 'bottom-end';\n\n /**\n * Icon to display in the overflow menu trigger.\n * If not provided, the number of items in the overflow menu will be displayed.\n */\n @Prop()\n public overFlowIcon?: Icon;\n\n /**\n * Fired when an item in the action bar overflow menu has been clicked.\n * @public\n */\n @Event()\n public select: EventEmitter<ActionBarItem>;\n\n public render() {\n return [\n <limel-menu\n openDirection={this.openDirection}\n items={this.items}\n onSelect={this.handleSelect}\n >\n <button slot=\"trigger\">\n {this.getOverflowTriggerContent()}\n </button>\n </limel-menu>,\n ];\n }\n\n private getOverflowTriggerContent = () => {\n if (this.overFlowIcon) {\n const { color, name, title } = this.overFlowIcon;\n\n return (\n <limel-icon\n style={{\n color: color,\n }}\n name={name}\n aria-label={title}\n />\n );\n }\n\n return `+${this.numberOfMenuItems}`;\n };\n\n private handleSelect = (event: LimelMenuCustomEvent<MenuItem>) => {\n event.stopPropagation();\n this.select.emit(event.detail);\n };\n\n private get numberOfMenuItems() {\n return this.items.filter((item) => this.isMenuItem(item)).length;\n }\n\n private isMenuItem(item: MenuItem | ListSeparator): item is MenuItem {\n return !('separator' in item);\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t,c as e,h as r}from"./p-443111b3.js";import{t as a}from"./p-e3d7aba7.js";import{c as i}from"./p-96460db3.js";const o='@charset "UTF-8";:host(limel-chart){--chart-axis-line-color:var(\n --limel-chart-axis-line-color,\n rgb(var(--contrast-900))\n );box-sizing:border-box;isolation:isolate;display:flex;width:100%;height:100%;min-width:0;min-height:0;padding:var(--limel-chart-padding)}table{all:unset;border-collapse:collapse;border-spacing:0;empty-cells:show;position:relative;display:flex;width:100%;height:100%;min-width:0;min-height:0}table colgroup,table thead,table tbody,table tr,table th,table td{all:unset}table caption,table colgroup,table thead,table tfoot,table th,table td{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}*,*:before,*:after{box-sizing:border-box}.chart{position:relative;flex-grow:1;width:100%;height:100%;min-height:0;min-width:0}.chart:has(.item:hover) .item,.chart:has(.item:focus-visible) .item{opacity:0.4}.item{transition:background-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.4s ease;cursor:help}.item:focus{outline:none}.item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}.item:focus-visible,.item:hover{opacity:1 !important}.item[role=button]{cursor:pointer}limel-spinner{margin:auto}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart,:host(limel-chart[type=line]) .chart,:host(limel-chart[type=area]) .chart{display:flex;background-color:var(--chart-background-color, transparent)}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item,:host(limel-chart[type=line]) .item,:host(limel-chart[type=area]) .item{position:relative;mix-blend-mode:hard-light}:host(limel-chart[type=bar][orientation=landscape]),:host(limel-chart[type=dot][orientation=landscape]),:host(limel-chart[type=line][orientation=landscape]),:host(limel-chart[type=area][orientation=landscape]){--limel-chart-padding:0.5rem 0.5rem 0.5rem 2rem}:host(limel-chart[type=bar][orientation=landscape]) .chart,:host(limel-chart[type=dot][orientation=landscape]) .chart,:host(limel-chart[type=line][orientation=landscape]) .chart,:host(limel-chart[type=area][orientation=landscape]) .chart{flex-direction:row;align-items:flex-end;overflow:auto hidden;padding:0 0.125rem}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item,:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{min-width:0.5rem;width:inherit}:host(limel-chart[type=bar][orientation=portrait]),:host(limel-chart[type=dot][orientation=portrait]),:host(limel-chart[type=line][orientation=portrait]),:host(limel-chart[type=area][orientation=portrait]){--limel-chart-padding:0.5rem 0.5rem 1rem 0.5rem}:host(limel-chart[type=bar][orientation=portrait]) .chart,:host(limel-chart[type=dot][orientation=portrait]) .chart,:host(limel-chart[type=line][orientation=portrait]) .chart,:host(limel-chart[type=area][orientation=portrait]) .chart{flex-direction:column;overflow:hidden auto;padding:0.125rem 0}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item,:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{min-height:0.5rem;height:inherit}:host(limel-chart[type=pie]) table,:host(limel-chart[type=doughnut]) table,:host(limel-chart[type=ring]) table{min-height:2rem;min-width:2rem}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .chart,:host(limel-chart[type=ring]) .item{aspect-ratio:1;display:flex;margin:auto}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=ring]) .chart{justify-content:center;align-items:center}:host(limel-chart[type=pie]) .chart:before,:host(limel-chart[type=doughnut]) .chart:before,:host(limel-chart[type=ring]) .chart:before{aspect-ratio:1;content:"";position:absolute;z-index:0;inset:0;margin:auto;border-radius:50%;max-width:100%;max-height:100%;background-color:var(--chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .item{max-width:100%;max-height:100%;border-radius:50%;position:absolute;inset:0}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart{gap:0.5rem}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item{display:flex;align-items:center;justify-content:center;border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=bar]) .item{background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item:before,:host(limel-chart[type=dot]) .item:after{content:"";position:absolute;margin:auto;width:0.5rem;height:0.5rem;border-radius:50%}:host(limel-chart[type=dot]) .item::after{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item.has-start-value:before{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item{height:calc(var(--limel-chart-item-size) * 1%);bottom:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=landscape]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=landscape]) .item.has-negative-value-only{height:calc(var(--limel-chart-item-size) * -1%);transform-origin:bottom;transform:rotateX(180deg)}:host(limel-chart[type=dot][orientation=landscape]) .item.has-start-value,:host(limel-chart[type=dot][orientation=landscape]) .item:hover,:host(limel-chart[type=dot][orientation=landscape]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=dot][orientation=landscape]) .item:before{inset:auto 0 0 0;transform:translateY(50%)}:host(limel-chart[type=dot][orientation=landscape]) .item::after{inset:0 0 auto 0;transform:translateY(-50%)}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item{width:calc(var(--limel-chart-item-size) * 1%);left:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=portrait]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=portrait]) .item.has-negative-value-only{width:calc(var(--limel-chart-item-size) * -1%);transform-origin:left;transform:rotateY(180deg)}:host(limel-chart[type=dot][orientation=portrait]) .item.has-start-value,:host(limel-chart[type=dot][orientation=portrait]) .item:hover,:host(limel-chart[type=dot][orientation=portrait]) .item:focus-visible{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/100% 1px no-repeat}:host(limel-chart[type=dot][orientation=portrait]) .item:before{inset:0 auto 0 0;transform:translateX(-50%)}:host(limel-chart[type=dot][orientation=portrait]) .item:after{inset:0 0 0 auto;transform:translateX(50%)}:host(limel-chart[type=area]) .item,:host(limel-chart[type=line]) .item{position:relative}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=line]) .item:after{margin:auto;width:0.5rem;height:0.5rem;border-radius:50%;border:1px solid rgb(var(--contrast-100))}:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:before{inset:0}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:after,:host(limel-chart[type=line]) .item:before{transition:border-color 0.2s ease, opacity 0.4s ease;content:"";position:absolute;background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after,:host(limel-chart[type=line]) .item:hover:after,:host(limel-chart[type=line]) .item:focus-visible:after{border-color:transparent}:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{height:100%}:host(limel-chart[type=line][orientation=landscape]) .item:after,:host(limel-chart[type=area][orientation=landscape]) .item:after{transform:translateX(-50%) translateY(50%);left:0;bottom:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{width:100%}:host(limel-chart[type=line][orientation=portrait]) .item:after,:host(limel-chart[type=area][orientation=portrait]) .item:after{transform:translateX(-50%) translateY(-50%);left:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=area]) .item:after{opacity:0}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after{opacity:1}:host(limel-chart[type=area]) .item:hover:before,:host(limel-chart[type=area]) .item:focus-visible:before{opacity:0.7}:host(limel-chart[type=area][orientation=landscape]){}:host(limel-chart[type=area][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - var(--limel-chart-item-offset)) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%), 100% calc((100 - var(--limel-chart-next-item-offset)) * 1%))}:host(limel-chart[type=area][orientation=portrait]){}:host(limel-chart[type=area][orientation=portrait]) .item:before{clip-path:polygon(calc(var(--limel-chart-item-offset) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%, calc(var(--limel-chart-next-item-offset) * 1%) 100%)}:host(limel-chart[type=line]){--limel-chart-line-thickness:0.125rem}:host(limel-chart[type=line]) .item:hover:before{opacity:0.4}:host(limel-chart[type=line][orientation=landscape]){}:host(limel-chart[type=line][orientation=landscape]) .item:hover{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) left/1px 100% no-repeat}:host(limel-chart[type=line][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%))}:host(limel-chart[type=line][orientation=portrait]){}:host(limel-chart[type=line][orientation=portrait]) .item:hover{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) top/100% 1px no-repeat}:host(limel-chart[type=line][orientation=portrait]) .item:before{clip-path:polygon(calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1% + var(--limel-chart-line-thickness)) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1% + var(--limel-chart-line-thickness)) 100%, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%)}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{background:conic-gradient(transparent 0 calc(var(--limel-chart-item-offset) * 1%), var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) calc(var(--limel-chart-item-offset) * 1%) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), transparent calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%))}:host(limel-chart[type=pie]) .item:focus,:host(limel-chart[type=pie]) .item:focus-visible,:host(limel-chart[type=doughnut]) .item:focus,:host(limel-chart[type=doughnut]) .item:focus-visible{outline:none}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{pointer-events:none}:host(limel-chart[type=doughnut]) .chart:after{aspect-ratio:1;content:"";position:absolute;inset:0;margin:auto;max-width:60%;max-height:60%;border-radius:50%;background-color:rgb(var(--contrast-100))}:host(limel-chart[type=ring]) .chart:after{content:"";position:absolute;inset:0;aspect-ratio:1;border-radius:50%;max-height:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));max-width:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));background-color:var(--limel-chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=ring]) .chart:has(.item:hover) .item,:host(limel-chart[type=ring]) .chart:has(.item:focus-visible) .item{opacity:1;filter:grayscale(1)}:host(limel-chart[type=ring]) .chart:after,:host(limel-chart[type=ring]) .item{margin:auto;border:1px solid var(--limel-chart-background-color, rgb(var(--contrast-400)))}:host(limel-chart[type=ring]) .item{background:conic-gradient(var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) 0 calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), var(--chart-background-color, rgb(var(--contrast-200))) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%));max-width:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1));max-height:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1))}:host(limel-chart[type=ring]) .item:focus-visible,:host(limel-chart[type=ring]) .item:hover{filter:grayscale(0) !important}:host(limel-chart[type=stacked-bar]) .chart{display:flex;border-radius:0.25rem;overflow:hidden;background-color:var(--chart-background-color, rgb(var(--contrast-800), 0.2))}:host(limel-chart[type=stacked-bar]) .item{display:flex;border-radius:var(--chart-item-border-radius, 0);background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=stacked-bar]) .item:last-of-type:not(:focus-visible){box-shadow:none !important}:host(limel-chart[type=stacked-bar][orientation=landscape]) .chart{flex-direction:row}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item{min-height:0.5rem;width:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item:not(:focus-visible){box-shadow:-1px 0 0 0 var(--chart-item-divider-color, rgb(var(--color-white), 0.6)) inset}:host(limel-chart[type=stacked-bar][orientation=portrait]) .chart{flex-direction:column-reverse}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item{min-width:0.5rem;height:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item:not(:focus-visible){box-shadow:0 -1px 0 0 rgb(var(--color-white), 0.6) inset}:host(limel-chart[type=nps]){--limel-chart-nps-gauge-angel:220deg}:host(limel-chart[type=nps]) table{min-height:4rem;min-width:4rem}:host(limel-chart[type=nps]) .chart{position:relative;display:flex;justify-content:center;align-items:center;aspect-ratio:1;margin:auto;width:unset;height:unset;max-width:100%;max-height:100%;rotate:calc(var(--limel-chart-nps-gauge-angel) / 2 * -1);transform:translate(-15%, -5%)}:host(limel-chart[type=nps]) .chart:before,:host(limel-chart[type=nps]) .chart:after{content:"";aspect-ratio:1;position:absolute;border-radius:50%;z-index:-1;min-height:0;min-width:0}:host(limel-chart[type=nps]) .chart:before{height:100%;max-height:100%;background:conic-gradient(rgb(var(--color-coral-default)) 0deg calc(var(--limel-chart-nps-gauge-angel) / 2), rgb(var(--color-amber-light)) calc(var(--limel-chart-nps-gauge-angel) / 2) calc(var(--limel-chart-nps-gauge-angel) * 0.65), rgb(var(--color-lime-light)) calc(var(--limel-chart-nps-gauge-angel) * 0.65) calc(var(--limel-chart-nps-gauge-angel) * 0.85), rgb(var(--color-lime-default)) calc(var(--limel-chart-nps-gauge-angel) * 0.85) var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .chart:after{height:calc(100% - min(3rem, 20%) * 2);max-height:calc(100% - min(3rem, 20%) * 2);background:conic-gradient(var(--chart-background-color, rgb(var(--contrast-100))) 0deg var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .item{display:flex;align-items:flex-start;justify-content:center;border-radius:0.5rem;position:absolute;height:calc(50% - min(3rem, 20%) + 0.5rem);width:0.5rem;transform:translateY(-50%) rotate(calc((var(--limel-chart-item-value) + 100) / 200 * var(--limel-chart-nps-gauge-angel)));transform-origin:bottom}:host(limel-chart[type=nps]) .item:hover,:host(limel-chart[type=nps]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=nps]) .item:before,:host(limel-chart[type=nps]) .item:after{content:"";position:absolute}:host(limel-chart[type=nps]) .item:before{transform:translateY(-60%);width:0.4rem;border-radius:1rem;border-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));border-style:solid;border-bottom-width:1.75rem;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent}:host(limel-chart[type=nps]) .item:after{border-radius:50%;background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));aspect-ratio:1;height:clamp(0.75rem, 10%, 1.25rem);border:0.125rem solid rgb(var(--contrast-100), 0.8);box-shadow:var(--shadow-depth-8)}.axises{position:absolute;display:flex;justify-content:space-between;min-height:100%;min-width:100%;height:100%;width:100%}.axis-line{transition:opacity 0.4s ease;position:relative;opacity:0.2;font-size:0.625rem;border-color:var(--limel-chart-axis-line-color)}.axis-line:hover{opacity:0.6;transition-duration:0.2s}.axis-line.zero-line{opacity:0.6;z-index:1}.axis-line limel-badge{--badge-background-color:transparent;--badge-text-color:currentColor;position:absolute;text-align:right;min-width:2rem}:host(limel-chart[orientation=landscape]) .axises{flex-direction:column-reverse}:host(limel-chart[orientation=landscape]) .axis-line{border-bottom:1px solid;transform:translateY(50%)}:host(limel-chart[orientation=landscape]) .axis-line limel-badge{bottom:0;left:-2rem;transform:translateY(50%)}:host(limel-chart[orientation=portrait]) .axises{flex-direction:row}:host(limel-chart[orientation=portrait]) .axis-line{border-left:1px solid;transform:translateX(-50%)}:host(limel-chart[orientation=portrait]) .axis-line limel-badge{bottom:-1rem;right:-1rem}';const l=100;const n=10;const h=class{constructor(r){t(this,r);this.interact=e(this,"interact",7);this.handleClick=t=>{const e=this.getClickableItem(t.currentTarget);if(!e){return}t.stopPropagation();this.interact.emit(e)};this.handleKeyDown=t=>{if(t.key!=="Enter"&&t.key!==" "){return}const e=this.getClickableItem(t.currentTarget);if(!e){return}t.preventDefault();this.interact.emit(e)};this.language="en";this.accessibleLabel=undefined;this.accessibleItemsLabel=undefined;this.items=undefined;this.type="stacked-bar";this.orientation="landscape";this.maxValue=undefined;this.axisIncrement=undefined;this.loading=false}componentWillLoad(){this.recalculateRangeData()}render(){if(this.loading){return r("limel-spinner",{limeBranded:false})}return r("table",{"aria-busy":this.loading?"true":"false","aria-live":"polite",style:{"--limel-chart-number-of-items":this.items.length.toString()}},this.renderCaption(),this.renderTableHeader(),this.renderAxises(),r("tbody",{class:"chart"},this.renderItems()))}renderCaption(){if(!this.accessibleLabel){return}return r("caption",null,this.accessibleLabel)}renderTableHeader(){return r("thead",null,r("tr",null,r("th",{scope:"col"},this.accessibleItemsLabel),r("th",{scope:"col"},a.get("value",this.language))))}renderAxises(){if(!["bar","dot","area","line"].includes(this.type)){return}const{minValue:t,maxValue:e}=this.range;const a=[];const i=Math.floor(t/this.axisIncrement)*this.axisIncrement;const o=Math.ceil(e/this.axisIncrement)*this.axisIncrement;for(let t=i;t<=o;t+=this.axisIncrement){a.push(r("div",{class:{"axis-line":true,"zero-line":t===0},role:"presentation"},r("limel-badge",{label:t})))}return r("div",{class:"axises",role:"presentation"},a)}renderItems(){var t;if(!((t=this.items)===null||t===void 0?void 0:t.length)){return}let e=0;return this.items.map(((t,a)=>{const o=i();const l=this.calculateSizeAndOffset(t);const n=l.size;let h=l.offset;if(this.type==="pie"||this.type==="doughnut"){h=e;e+=n}return r("tr",{style:this.getItemStyle(t,a,n,h),class:this.getItemClass(t),key:o,id:o,"data-index":a,tabIndex:0,role:t.clickable?"button":null,onClick:this.handleClick,onKeyDown:this.handleKeyDown},r("th",null,this.getItemText(t)),r("td",null,this.getFormattedValue(t)),this.renderTooltip(t,o,n))}))}getItemStyle(t,e,r,a){const i={"--limel-chart-item-offset":`${a}`,"--limel-chart-item-size":`${r}`,"--limel-chart-item-index":`${e}`,"--limel-chart-item-value":`${t.value}`};if(t.color){i["--limel-chart-item-color"]=t.color}if(this.type==="line"||this.type==="area"){const t=this.calculateSizeAndOffset(this.items[e+1]);i["--limel-chart-next-item-size"]=`${t.size}`;i["--limel-chart-next-item-offset"]=`${t.offset}`}return i}getItemClass(t){return{item:true,"has-start-value":Array.isArray(t.value),"has-negative-value-only":this.getMaximumValue(t)<0&&!this.isRangeItem(t)}}calculateSizeAndOffset(t){const{minValue:e,totalRange:r}=this.range;if(!t){return{size:0,offset:0}}let a=0;if(this.isRangeItem(t)){a=this.getMinimumValue(t)}const i=(a-e)/r*l;const o=(this.getMaximumValue(t)-e)/r*l;return{size:o-i,offset:i}}getFormattedValue(t){const{value:e,formattedValue:r}=t;if(r){return r}if(Array.isArray(e)){return`${e[0]} — ${e[1]}`}return`${e}`}getItemText(t){return t.text}renderTooltip(t,e,a){const i=this.getItemText(t);const o=2;const l=this.getFormattedValue(t);const n={label:i,helperLabel:l,elementId:e};if(this.type!=="bar"&&this.type!=="dot"&&this.type!=="nps"){n.label=`${i} (${a.toFixed(o)}%)`}return r("limel-tooltip",Object.assign({},n,{openDirection:this.orientation==="portrait"?"right":"top"}))}calculateRange(){var t;if(this.range){return this.range}const e=Math.min(0,...this.items.map(this.getMinimumValue));const r=Math.max(...this.items.map(this.getMaximumValue));const a=this.items.reduce(((t,e)=>t+this.getMaximumValue(e)),0);let i=(t=this.maxValue)!==null&&t!==void 0?t:r;if((this.type==="pie"||this.type==="doughnut")&&!this.maxValue){i=a}if(!this.axisIncrement){this.axisIncrement=this.calculateAxisIncrement(this.items)}const o=Math.ceil(i/this.axisIncrement)*this.axisIncrement;const l=Math.floor(e/this.axisIncrement)*this.axisIncrement;const n=o-l;return{minValue:l,maxValue:o,totalRange:n}}calculateAxisIncrement(t,e=n){const r=Math.max(...t.map((t=>{const e=t.value;if(Array.isArray(e)){return Math.max(...e)}return e})));const a=r/e;const i=10**Math.floor(Math.log10(a));return Math.ceil(a/i)*i}getMinimumValue(t){const e=t.value;return Array.isArray(e)?Math.min(...e):e}getMaximumValue(t){const e=t.value;return Array.isArray(e)?Math.max(...e):e}isRangeItem(t){return Array.isArray(t.value)}handleChange(){this.range=null;this.recalculateRangeData()}recalculateRangeData(){this.range=this.calculateRange()}getClickableItem(t){const e=t.dataset.index;if(e===undefined){return}const r=this.items[Number(e)];if(!r.clickable){return}return r}static get watchers(){return{items:["handleChange"],axisIncrement:["handleChange"],maxValue:["handleChange"]}}};h.style=o;export{h as limel_chart};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as t,c as e,h as r}from"./p-443111b3.js";import{t as a}from"./p-bf55e816.js";import{c as i}from"./p-96460db3.js";const o='@charset "UTF-8";:host(limel-chart){--chart-axis-line-color:var(\n --limel-chart-axis-line-color,\n rgb(var(--contrast-900))\n );box-sizing:border-box;isolation:isolate;display:flex;width:100%;height:100%;min-width:0;min-height:0;padding:var(--limel-chart-padding)}table{all:unset;border-collapse:collapse;border-spacing:0;empty-cells:show;position:relative;display:flex;width:100%;height:100%;min-width:0;min-height:0}table colgroup,table thead,table tbody,table tr,table th,table td{all:unset}table caption,table colgroup,table thead,table tfoot,table th,table td{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}*,*:before,*:after{box-sizing:border-box}.chart{position:relative;flex-grow:1;width:100%;height:100%;min-height:0;min-width:0}.chart:has(.item:hover) .item,.chart:has(.item:focus-visible) .item{opacity:0.4}.item{transition:background-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.4s ease;cursor:help}.item:focus{outline:none}.item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}.item:focus-visible,.item:hover{opacity:1 !important}.item[role=button]{cursor:pointer}limel-spinner{margin:auto}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart,:host(limel-chart[type=line]) .chart,:host(limel-chart[type=area]) .chart{display:flex;background-color:var(--chart-background-color, transparent)}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item,:host(limel-chart[type=line]) .item,:host(limel-chart[type=area]) .item{position:relative;mix-blend-mode:hard-light}:host(limel-chart[type=bar][orientation=landscape]),:host(limel-chart[type=dot][orientation=landscape]),:host(limel-chart[type=line][orientation=landscape]),:host(limel-chart[type=area][orientation=landscape]){--limel-chart-padding:0.5rem 0.5rem 0.5rem 2rem}:host(limel-chart[type=bar][orientation=landscape]) .chart,:host(limel-chart[type=dot][orientation=landscape]) .chart,:host(limel-chart[type=line][orientation=landscape]) .chart,:host(limel-chart[type=area][orientation=landscape]) .chart{flex-direction:row;align-items:flex-end;overflow:auto hidden;padding:0 0.125rem}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item,:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{min-width:0.5rem;width:inherit}:host(limel-chart[type=bar][orientation=portrait]),:host(limel-chart[type=dot][orientation=portrait]),:host(limel-chart[type=line][orientation=portrait]),:host(limel-chart[type=area][orientation=portrait]){--limel-chart-padding:0.5rem 0.5rem 1rem 0.5rem}:host(limel-chart[type=bar][orientation=portrait]) .chart,:host(limel-chart[type=dot][orientation=portrait]) .chart,:host(limel-chart[type=line][orientation=portrait]) .chart,:host(limel-chart[type=area][orientation=portrait]) .chart{flex-direction:column;overflow:hidden auto;padding:0.125rem 0}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item,:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{min-height:0.5rem;height:inherit}:host(limel-chart[type=pie]) table,:host(limel-chart[type=doughnut]) table,:host(limel-chart[type=ring]) table{min-height:2rem;min-width:2rem}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .chart,:host(limel-chart[type=ring]) .item{aspect-ratio:1;display:flex;margin:auto}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=ring]) .chart{justify-content:center;align-items:center}:host(limel-chart[type=pie]) .chart:before,:host(limel-chart[type=doughnut]) .chart:before,:host(limel-chart[type=ring]) .chart:before{aspect-ratio:1;content:"";position:absolute;z-index:0;inset:0;margin:auto;border-radius:50%;max-width:100%;max-height:100%;background-color:var(--chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .item{max-width:100%;max-height:100%;border-radius:50%;position:absolute;inset:0}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart{gap:0.5rem}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item{display:flex;align-items:center;justify-content:center;border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=bar]) .item{background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item:before,:host(limel-chart[type=dot]) .item:after{content:"";position:absolute;margin:auto;width:0.5rem;height:0.5rem;border-radius:50%}:host(limel-chart[type=dot]) .item::after{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item.has-start-value:before{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item{height:calc(var(--limel-chart-item-size) * 1%);bottom:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=landscape]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=landscape]) .item.has-negative-value-only{height:calc(var(--limel-chart-item-size) * -1%);transform-origin:bottom;transform:rotateX(180deg)}:host(limel-chart[type=dot][orientation=landscape]) .item.has-start-value,:host(limel-chart[type=dot][orientation=landscape]) .item:hover,:host(limel-chart[type=dot][orientation=landscape]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=dot][orientation=landscape]) .item:before{inset:auto 0 0 0;transform:translateY(50%)}:host(limel-chart[type=dot][orientation=landscape]) .item::after{inset:0 0 auto 0;transform:translateY(-50%)}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item{width:calc(var(--limel-chart-item-size) * 1%);left:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=portrait]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=portrait]) .item.has-negative-value-only{width:calc(var(--limel-chart-item-size) * -1%);transform-origin:left;transform:rotateY(180deg)}:host(limel-chart[type=dot][orientation=portrait]) .item.has-start-value,:host(limel-chart[type=dot][orientation=portrait]) .item:hover,:host(limel-chart[type=dot][orientation=portrait]) .item:focus-visible{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/100% 1px no-repeat}:host(limel-chart[type=dot][orientation=portrait]) .item:before{inset:0 auto 0 0;transform:translateX(-50%)}:host(limel-chart[type=dot][orientation=portrait]) .item:after{inset:0 0 0 auto;transform:translateX(50%)}:host(limel-chart[type=area]) .item,:host(limel-chart[type=line]) .item{position:relative}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=line]) .item:after{margin:auto;width:0.5rem;height:0.5rem;border-radius:50%;border:1px solid rgb(var(--contrast-100))}:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:before{inset:0}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:after,:host(limel-chart[type=line]) .item:before{transition:border-color 0.2s ease, opacity 0.4s ease;content:"";position:absolute;background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after,:host(limel-chart[type=line]) .item:hover:after,:host(limel-chart[type=line]) .item:focus-visible:after{border-color:transparent}:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{height:100%}:host(limel-chart[type=line][orientation=landscape]) .item:after,:host(limel-chart[type=area][orientation=landscape]) .item:after{transform:translateX(-50%) translateY(50%);left:0;bottom:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{width:100%}:host(limel-chart[type=line][orientation=portrait]) .item:after,:host(limel-chart[type=area][orientation=portrait]) .item:after{transform:translateX(-50%) translateY(-50%);left:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=area]) .item:after{opacity:0}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after{opacity:1}:host(limel-chart[type=area]) .item:hover:before,:host(limel-chart[type=area]) .item:focus-visible:before{opacity:0.7}:host(limel-chart[type=area][orientation=landscape]){}:host(limel-chart[type=area][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - var(--limel-chart-item-offset)) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%), 100% calc((100 - var(--limel-chart-next-item-offset)) * 1%))}:host(limel-chart[type=area][orientation=portrait]){}:host(limel-chart[type=area][orientation=portrait]) .item:before{clip-path:polygon(calc(var(--limel-chart-item-offset) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%, calc(var(--limel-chart-next-item-offset) * 1%) 100%)}:host(limel-chart[type=line]){--limel-chart-line-thickness:0.125rem}:host(limel-chart[type=line]) .item:hover:before{opacity:0.4}:host(limel-chart[type=line][orientation=landscape]){}:host(limel-chart[type=line][orientation=landscape]) .item:hover{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) left/1px 100% no-repeat}:host(limel-chart[type=line][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%))}:host(limel-chart[type=line][orientation=portrait]){}:host(limel-chart[type=line][orientation=portrait]) .item:hover{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) top/100% 1px no-repeat}:host(limel-chart[type=line][orientation=portrait]) .item:before{clip-path:polygon(calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1% + var(--limel-chart-line-thickness)) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1% + var(--limel-chart-line-thickness)) 100%, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%)}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{background:conic-gradient(transparent 0 calc(var(--limel-chart-item-offset) * 1%), var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) calc(var(--limel-chart-item-offset) * 1%) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), transparent calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%))}:host(limel-chart[type=pie]) .item:focus,:host(limel-chart[type=pie]) .item:focus-visible,:host(limel-chart[type=doughnut]) .item:focus,:host(limel-chart[type=doughnut]) .item:focus-visible{outline:none}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{pointer-events:none}:host(limel-chart[type=doughnut]) .chart:after{aspect-ratio:1;content:"";position:absolute;inset:0;margin:auto;max-width:60%;max-height:60%;border-radius:50%;background-color:rgb(var(--contrast-100))}:host(limel-chart[type=ring]) .chart:after{content:"";position:absolute;inset:0;aspect-ratio:1;border-radius:50%;max-height:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));max-width:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));background-color:var(--limel-chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=ring]) .chart:has(.item:hover) .item,:host(limel-chart[type=ring]) .chart:has(.item:focus-visible) .item{opacity:1;filter:grayscale(1)}:host(limel-chart[type=ring]) .chart:after,:host(limel-chart[type=ring]) .item{margin:auto;border:1px solid var(--limel-chart-background-color, rgb(var(--contrast-400)))}:host(limel-chart[type=ring]) .item{background:conic-gradient(var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) 0 calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), var(--chart-background-color, rgb(var(--contrast-200))) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%));max-width:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1));max-height:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1))}:host(limel-chart[type=ring]) .item:focus-visible,:host(limel-chart[type=ring]) .item:hover{filter:grayscale(0) !important}:host(limel-chart[type=stacked-bar]) .chart{display:flex;border-radius:0.25rem;overflow:hidden;background-color:var(--chart-background-color, rgb(var(--contrast-800), 0.2))}:host(limel-chart[type=stacked-bar]) .item{display:flex;border-radius:var(--chart-item-border-radius, 0);background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=stacked-bar]) .item:last-of-type:not(:focus-visible){box-shadow:none !important}:host(limel-chart[type=stacked-bar][orientation=landscape]) .chart{flex-direction:row}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item{min-height:0.5rem;width:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item:not(:focus-visible){box-shadow:-1px 0 0 0 var(--chart-item-divider-color, rgb(var(--color-white), 0.6)) inset}:host(limel-chart[type=stacked-bar][orientation=portrait]) .chart{flex-direction:column-reverse}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item{min-width:0.5rem;height:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item:not(:focus-visible){box-shadow:0 -1px 0 0 rgb(var(--color-white), 0.6) inset}:host(limel-chart[type=nps]){--limel-chart-nps-gauge-angel:220deg}:host(limel-chart[type=nps]) table{min-height:4rem;min-width:4rem}:host(limel-chart[type=nps]) .chart{position:relative;display:flex;justify-content:center;align-items:center;aspect-ratio:1;margin:auto;width:unset;height:unset;max-width:100%;max-height:100%;rotate:calc(var(--limel-chart-nps-gauge-angel) / 2 * -1);transform:translate(-15%, -5%)}:host(limel-chart[type=nps]) .chart:before,:host(limel-chart[type=nps]) .chart:after{content:"";aspect-ratio:1;position:absolute;border-radius:50%;z-index:-1;min-height:0;min-width:0}:host(limel-chart[type=nps]) .chart:before{height:100%;max-height:100%;background:conic-gradient(rgb(var(--color-coral-default)) 0deg calc(var(--limel-chart-nps-gauge-angel) / 2), rgb(var(--color-amber-light)) calc(var(--limel-chart-nps-gauge-angel) / 2) calc(var(--limel-chart-nps-gauge-angel) * 0.65), rgb(var(--color-lime-light)) calc(var(--limel-chart-nps-gauge-angel) * 0.65) calc(var(--limel-chart-nps-gauge-angel) * 0.85), rgb(var(--color-lime-default)) calc(var(--limel-chart-nps-gauge-angel) * 0.85) var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .chart:after{height:calc(100% - min(3rem, 20%) * 2);max-height:calc(100% - min(3rem, 20%) * 2);background:conic-gradient(var(--chart-background-color, rgb(var(--contrast-100))) 0deg var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .item{display:flex;align-items:flex-start;justify-content:center;border-radius:0.5rem;position:absolute;height:calc(50% - min(3rem, 20%) + 0.5rem);width:0.5rem;transform:translateY(-50%) rotate(calc((var(--limel-chart-item-value) + 100) / 200 * var(--limel-chart-nps-gauge-angel)));transform-origin:bottom}:host(limel-chart[type=nps]) .item:hover,:host(limel-chart[type=nps]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=nps]) .item:before,:host(limel-chart[type=nps]) .item:after{content:"";position:absolute}:host(limel-chart[type=nps]) .item:before{transform:translateY(-60%);width:0.4rem;border-radius:1rem;border-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));border-style:solid;border-bottom-width:1.75rem;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent}:host(limel-chart[type=nps]) .item:after{border-radius:50%;background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));aspect-ratio:1;height:clamp(0.75rem, 10%, 1.25rem);border:0.125rem solid rgb(var(--contrast-100), 0.8);box-shadow:var(--shadow-depth-8)}.axises{position:absolute;display:flex;justify-content:space-between;min-height:100%;min-width:100%;height:100%;width:100%}.axis-line{transition:opacity 0.4s ease;position:relative;opacity:0.2;font-size:0.625rem;border-color:var(--limel-chart-axis-line-color)}.axis-line:hover{opacity:0.6;transition-duration:0.2s}.axis-line.zero-line{opacity:0.6;z-index:1}.axis-line limel-badge{--badge-background-color:transparent;--badge-text-color:currentColor;position:absolute;text-align:right;min-width:2rem}:host(limel-chart[orientation=landscape]) .axises{flex-direction:column-reverse}:host(limel-chart[orientation=landscape]) .axis-line{border-bottom:1px solid;transform:translateY(50%)}:host(limel-chart[orientation=landscape]) .axis-line limel-badge{bottom:0;left:-2rem;transform:translateY(50%)}:host(limel-chart[orientation=portrait]) .axises{flex-direction:row}:host(limel-chart[orientation=portrait]) .axis-line{border-left:1px solid;transform:translateX(-50%)}:host(limel-chart[orientation=portrait]) .axis-line limel-badge{bottom:-1rem;right:-1rem}';const l=100;const n=10;const h=class{constructor(r){t(this,r);this.interact=e(this,"interact",7);this.handleClick=t=>{const e=this.getClickableItem(t.currentTarget);if(!e){return}t.stopPropagation();this.interact.emit(e)};this.handleKeyDown=t=>{if(t.key!=="Enter"&&t.key!==" "){return}const e=this.getClickableItem(t.currentTarget);if(!e){return}t.preventDefault();this.interact.emit(e)};this.language="en";this.accessibleLabel=undefined;this.accessibleItemsLabel=undefined;this.items=undefined;this.type="stacked-bar";this.orientation="landscape";this.maxValue=undefined;this.axisIncrement=undefined;this.loading=false}componentWillLoad(){this.recalculateRangeData()}render(){if(this.loading){return r("limel-spinner",{limeBranded:false})}return r("table",{"aria-busy":this.loading?"true":"false","aria-live":"polite",style:{"--limel-chart-number-of-items":this.items.length.toString()}},this.renderCaption(),this.renderTableHeader(),this.renderAxises(),r("tbody",{class:"chart"},this.renderItems()))}renderCaption(){if(!this.accessibleLabel){return}return r("caption",null,this.accessibleLabel)}renderTableHeader(){return r("thead",null,r("tr",null,r("th",{scope:"col"},this.accessibleItemsLabel),r("th",{scope:"col"},a.get("value",this.language))))}renderAxises(){if(!["bar","dot","area","line"].includes(this.type)){return}const{minValue:t,maxValue:e}=this.range;const a=[];const i=Math.floor(t/this.axisIncrement)*this.axisIncrement;const o=Math.ceil(e/this.axisIncrement)*this.axisIncrement;for(let t=i;t<=o;t+=this.axisIncrement){a.push(r("div",{class:{"axis-line":true,"zero-line":t===0},role:"presentation"},r("limel-badge",{label:t})))}return r("div",{class:"axises",role:"presentation"},a)}renderItems(){var t;if(!((t=this.items)===null||t===void 0?void 0:t.length)){return}let e=0;return this.items.map(((t,a)=>{const o=i();const l=this.calculateSizeAndOffset(t);const n=l.size;let h=l.offset;if(this.type==="pie"||this.type==="doughnut"){h=e;e+=n}return r("tr",{style:this.getItemStyle(t,a,n,h),class:this.getItemClass(t),key:o,id:o,"data-index":a,tabIndex:0,role:t.clickable?"button":null,onClick:this.handleClick,onKeyDown:this.handleKeyDown},r("th",null,this.getItemText(t)),r("td",null,this.getFormattedValue(t)),this.renderTooltip(t,o,n))}))}getItemStyle(t,e,r,a){const i={"--limel-chart-item-offset":`${a}`,"--limel-chart-item-size":`${r}`,"--limel-chart-item-index":`${e}`,"--limel-chart-item-value":`${t.value}`};if(t.color){i["--limel-chart-item-color"]=t.color}if(this.type==="line"||this.type==="area"){const t=this.calculateSizeAndOffset(this.items[e+1]);i["--limel-chart-next-item-size"]=`${t.size}`;i["--limel-chart-next-item-offset"]=`${t.offset}`}return i}getItemClass(t){return{item:true,"has-start-value":Array.isArray(t.value),"has-negative-value-only":this.getMaximumValue(t)<0&&!this.isRangeItem(t)}}calculateSizeAndOffset(t){const{minValue:e,totalRange:r}=this.range;if(!t){return{size:0,offset:0}}let a=0;if(this.isRangeItem(t)){a=this.getMinimumValue(t)}const i=(a-e)/r*l;const o=(this.getMaximumValue(t)-e)/r*l;return{size:o-i,offset:i}}getFormattedValue(t){const{value:e,formattedValue:r}=t;if(r){return r}if(Array.isArray(e)){return`${e[0]} — ${e[1]}`}return`${e}`}getItemText(t){return t.text}renderTooltip(t,e,a){const i=this.getItemText(t);const o=2;const l=this.getFormattedValue(t);const n={label:i,helperLabel:l,elementId:e};if(this.type!=="bar"&&this.type!=="dot"&&this.type!=="nps"){n.label=`${i} (${a.toFixed(o)}%)`}return r("limel-tooltip",Object.assign({},n,{openDirection:this.orientation==="portrait"?"right":"top"}))}calculateRange(){var t;if(this.range){return this.range}const e=Math.min(0,...this.items.map(this.getMinimumValue));const r=Math.max(...this.items.map(this.getMaximumValue));const a=this.items.reduce(((t,e)=>t+this.getMaximumValue(e)),0);let i=(t=this.maxValue)!==null&&t!==void 0?t:r;if((this.type==="pie"||this.type==="doughnut")&&!this.maxValue){i=a}if(!this.axisIncrement){this.axisIncrement=this.calculateAxisIncrement(this.items)}const o=Math.ceil(i/this.axisIncrement)*this.axisIncrement;const l=Math.floor(e/this.axisIncrement)*this.axisIncrement;const n=o-l;return{minValue:l,maxValue:o,totalRange:n}}calculateAxisIncrement(t,e=n){const r=Math.max(...t.map((t=>{const e=t.value;if(Array.isArray(e)){return Math.max(...e)}return e})));const a=r/e;const i=10**Math.floor(Math.log10(a));return Math.ceil(a/i)*i}getMinimumValue(t){const e=t.value;return Array.isArray(e)?Math.min(...e):e}getMaximumValue(t){const e=t.value;return Array.isArray(e)?Math.max(...e):e}isRangeItem(t){return Array.isArray(t.value)}handleChange(){this.range=null;this.recalculateRangeData()}recalculateRangeData(){this.range=this.calculateRange()}getClickableItem(t){const e=t.dataset.index;if(e===undefined){return}const r=this.items[Number(e)];if(!r.clickable){return}return r}static get watchers(){return{items:["handleChange"],axisIncrement:["handleChange"],maxValue:["handleChange"]}}};h.style=o;export{h as limel_chart};
|
|
2
|
+
//# sourceMappingURL=p-3a605df3.entry.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as i,c as t,h as e,H as s,g as n}from"./p-443111b3.js";import{t as a}from"./p-bf55e816.js";import{i as r}from"./p-91741e79.js";import{a as o,E as l}from"./p-aa25f475.js";const h='@charset "UTF-8";:host(limel-action-bar){--action-bar-item-height:2rem;--limel-action-bar-item-text-color:var(\n --action-bar-item-text-color,\n rgb(var(--contrast-1100))\n );box-sizing:border-box;display:inline-flex;align-items:center;padding:0.125rem 0.25rem;max-width:100%;border-radius:var(--action-bar-border-radius);background-color:var(--action-bar-background-color, rgb(var(--contrast-100)));transition:max-width 0.3s ease}:host(limel-action-bar),.items{gap:0.25rem}@media (pointer: coarse){:host(limel-action-bar),.items{gap:0.5rem}}.items{display:inline-flex;max-width:100%;min-width:0}:host(limel-action-bar.is-shrunk) .items{opacity:0}:host(limel-action-bar:not(.is-shrunk)) .items{opacity:1}:host(limel-action-bar.is-full-width){width:100%}:host(limel-action-bar.is-floating){--action-bar-border-radius:100vw;border:1px solid rgb(var(--contrast-400));padding-right:0.125rem;padding-left:0.125rem;max-width:calc(100% - 2rem);box-shadow:var(--shadow-depth-16), var(--shadow-depth-8)}:host(limel-action-bar.is-shrunk){max-width:5rem;transition:max-width 0.3s ease-in-out}:host(limel-action-bar.is-shrunk) .expand-shrink{transition:transform 0.3s ease;transform:rotateY(180deg)}:host(limel-action-bar:not(.is-shrunk)){max-width:100%;transition:max-width 0.3s ease-in-out}:host(limel-action-bar:not(.is-shrunk)) .expand-shrink{transition:transform 0.3s ease;transform:rotateY(0deg)}:host(limel-action-bar.can-be-shrunk.is-full-width) .expand-shrink{margin-left:auto}.expand-shrink{all:unset;box-sizing:border-box;border-radius:50%;transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--mdc-theme-on-surface);background-color:transparent;display:flex;justify-content:center;align-items:center}.expand-shrink:hover,.expand-shrink:focus,.expand-shrink:focus-visible{will-change:color, background-color, box-shadow, transform}.expand-shrink:hover{transform:translate3d(0, 0.01rem, 0);color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}.expand-shrink:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}.expand-shrink:hover,.expand-shrink:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}.expand-shrink:focus{outline:none}.expand-shrink:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}.expand-shrink limel-icon{width:1.5rem;height:1.5rem;padding:0.125rem;color:var(--action-bar-shrink-icon-color, rgb(var(--contrast-1000)))}';const c=class{constructor(s){i(this,s);this.itemSelected=t(this,"itemSelected",7);this.hasRendered=false;this.isFirstIntersectionCheck=true;this.actionBarItems=[];this.renderActionBarItem=(i,t)=>e("limel-action-bar-item",{item:i,onSelect:this.handleSelect,isVisible:this.isVisible(t),role:"gridcell"});this.renderOverflowMenu=i=>{if(!(this.actions.length-this.overflowCutoff)){return}const t={name:"more",color:"rgb(var(--contrast-1000))",title:this.getTranslation("action-bar.actions")};return e("limel-action-bar-overflow-menu",{openDirection:this.openDirection,items:i,onSelect:this.handleSelect,role:"gridcell",overFlowIcon:this.actionBarIsShrunk?t:undefined})};this.handleCollapseExpandClick=()=>{this.actionBarIsShrunk=!this.actionBarIsShrunk};this.handleSelect=i=>{i.stopPropagation();if(r(i.detail)){this.itemSelected.emit(i.detail)}};this.getTranslation=i=>a.get(i,this.language);this.handleIntersection=i=>{const t=i.filter((i=>i.isIntersecting));const e=i.filter((i=>!i.isIntersecting));if(this.isFirstIntersectionCheck){this.overflowCutoff=t.length}else{this.overflowCutoff=this.overflowCutoff+t.length-e.length}this.isFirstIntersectionCheck=false};this.actions=[];this.language=document.documentElement.lang;this.accessibleLabel=undefined;this.layout=undefined;this.collapsible=false;this.openDirection=undefined;this.overflowCutoff=this.actions.length;this.actionBarIsShrunk=false}connectedCallback(){if(this.hasRendered){this.createIntersectionObserver()}}componentDidRender(){var i;if(this.haveItemsChanged()){(i=this.intersectionObserver)===null||i===void 0?void 0:i.disconnect();this.createIntersectionObserver()}}disconnectedCallback(){var i;(i=this.intersectionObserver)===null||i===void 0?void 0:i.disconnect();this.intersectionObserver=undefined;this.actionBarItems=[]}render(){this.hasRendered=true;let i=[];if(this.actions.length){i=this.actions.slice(this.overflowCutoff)}return e(s,{"aria-label":this.accessibleLabel,class:{"is-full-width":this.layout==="fullWidth","is-floating":this.layout==="floating","is-shrunk":this.actionBarIsShrunk&&this.collapsible,"can-be-shrunk":!!this.collapsible},role:"grid"},e("div",{class:"items",role:"rowgroup"},this.actions.map(this.renderActionBarItem)),this.renderOverflowMenu(i),this.renderCollapseExpandButton())}renderCollapseExpandButton(){if(!this.collapsible){return}return e("button",{class:{"expand-shrink":true},"aria-label":this.tooltipLabel,type:"button",onClick:this.handleCollapseExpandClick},e("limel-icon",{name:"double_left",id:"tooltip-expand-shrink-button"}),e("limel-tooltip",{label:this.tooltipLabel,elementId:"tooltip-expand-shrink-button"}))}isVisible(i){return i<this.overflowCutoff}get tooltipLabel(){let i="action-bar.collapse";if(this.actionBarIsShrunk){i="action-bar.expand"}return this.getTranslation(i)}createIntersectionObserver(){const i={root:this.host.shadowRoot.querySelector(".items"),rootMargin:"0px",threshold:1};this.overflowCutoff=this.actions.length;this.isFirstIntersectionCheck=true;this.actionBarItems=[];this.intersectionObserver=new IntersectionObserver(this.handleIntersection,i);this.host.shadowRoot.querySelectorAll("limel-action-bar-item").forEach((i=>{this.observe(i)}))}observe(i){this.intersectionObserver.observe(i);this.actionBarItems.push(i)}haveItemsChanged(){const i=this.actionBarItems.some((i=>!this.host.shadowRoot.contains(i)));const t=Array.from(this.host.shadowRoot.querySelectorAll("limel-action-bar-item")).some((i=>!this.actionBarItems.includes(i)));return i||t}get host(){return n(this)}};c.style=h;const d=":host(limel-text-editor-link-menu){animation:fade 0.2s ease forwards;animation-delay:0.1s;opacity:0;display:flex;flex-direction:column;gap:0.5rem;padding:0.5rem;max-width:calc(100vw - 2rem);border-radius:0.5rem;background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--shadow-depth-16)}.actions{display:flex;justify-content:end;gap:0.5rem}@keyframes fade{0%{scale:0.86;opacity:0}100%{scale:1;opacity:1}}";const m=class{constructor(e){i(this,e);this.cancel=t(this,"cancel",7);this.save=t(this,"save",7);this.linkChange=t(this,"linkChange",7);this.getTranslation=i=>a.get(i,this.language);this.isValid=i=>{try{new URL(i)}catch(i){return false}return true};this.handleKeyDown=i=>{var t;if(i.key!==o){return}if(this.saveButton){this.saveButton.focus()}i.preventDefault();if(this.isValid((t=this.link)===null||t===void 0?void 0:t.href)){this.handleSave(i)}};this.handleCancel=i=>{if(i instanceof KeyboardEvent&&i.key!==l){return}i.stopPropagation();i.preventDefault();this.cancel.emit()};this.handleSave=i=>{i.stopPropagation();this.save.emit()};this.handleLinkInputAction=i=>{window.open(this.link.href,"_blank");i.stopPropagation()};this.handleLinkTitleChange=i=>{var t;this.emitLinkChange(i.detail,(t=this.link)===null||t===void 0?void 0:t.href)};this.handleLinkValueChange=i=>{var t;const e=i.detail;this.emitLinkChange((t=this.link)===null||t===void 0?void 0:t.text,e)};this.emitLinkChange=(i,t)=>{const e={text:i,href:t};this.linkChange.emit(e)};this.link=undefined;this.language="en";this.isOpen=false}connectedCallback(){this.setupGlobalHandlers()}disconnectedCallback(){this.teardownGlobalHandlers()}setupGlobalHandlers(){if(this.isOpen){document.addEventListener("keyup",this.handleCancel)}}teardownGlobalHandlers(){document.removeEventListener("keyup",this.handleCancel)}componentDidLoad(){this.focusOnTextInput()}focusOnTextInput(){if(this.textInput){const i=this.textInput.shadowRoot.querySelector("input");if(i){requestAnimationFrame((()=>{i.focus()}))}}}render(){var i,t;const s=this.isValid(this.link.href);return[e("limel-input-field",{label:this.getTranslation("editor-link-menu.text"),value:((i=this.link)===null||i===void 0?void 0:i.text)||"",leadingIcon:"text_cursor",onChange:this.handleLinkTitleChange,onKeyDown:this.handleKeyDown,ref:i=>this.textInput=i}),e("limel-input-field",{label:this.getTranslation("editor-link-menu.link"),value:((t=this.link)===null||t===void 0?void 0:t.href)||"",type:"text",leadingIcon:"-lime-text-link",trailingIcon:"external_link",invalid:!s,onChange:this.handleLinkValueChange,onAction:this.handleLinkInputAction,onKeyDown:this.handleKeyDown}),e("div",{class:"actions"},e("limel-button",{label:this.getTranslation("cancel"),onClick:this.handleCancel}),e("limel-button",{primary:true,label:this.getTranslation("save"),disabled:!s,onClick:this.handleSave,ref:i=>this.saveButton=i,slot:"button"}))]}};m.style=d;export{c as limel_action_bar,m as limel_text_editor_link_menu};
|
|
2
|
+
//# sourceMappingURL=p-7db872fd.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["actionBarCss","ActionBar","this","hasRendered","isFirstIntersectionCheck","actionBarItems","renderActionBarItem","item","index","h","onSelect","handleSelect","isVisible","role","renderOverflowMenu","items","actions","length","overflowCutoff","shrunkOverFlowIcon","name","color","title","getTranslation","openDirection","overFlowIcon","actionBarIsShrunk","undefined","handleCollapseExpandClick","event","stopPropagation","isItem","detail","itemSelected","emit","key","translate","get","language","handleIntersection","entries","intersectingItems","filter","entry","isIntersecting","notIntersectingItems","document","documentElement","lang","connectedCallback","createIntersectionObserver","componentDidRender","haveItemsChanged","_a","intersectionObserver","disconnect","disconnectedCallback","render","overflowActions","slice","Host","accessibleLabel","class","layout","collapsible","map","renderCollapseExpandButton","tooltipLabel","type","onClick","id","label","elementId","options","root","host","shadowRoot","querySelector","rootMargin","threshold","IntersectionObserver","querySelectorAll","forEach","actionBarItem","observe","push","someItemRemoved","some","contains","someItemAdded","Array","from","includes","editorLinkMenuCss","TextEditorLinkMenu","isValid","href","URL","handleKeyDown","ENTER","saveButton","focus","preventDefault","link","handleSave","handleCancel","KeyboardEvent","ESCAPE","cancel","save","handleLinkInputAction","window","open","handleLinkTitleChange","emitLinkChange","handleLinkValueChange","text","newLink","linkChange","setupGlobalHandlers","teardownGlobalHandlers","isOpen","addEventListener","removeEventListener","componentDidLoad","focusOnTextInput","textInput","inputField","requestAnimationFrame","value","leadingIcon","onChange","onKeyDown","ref","el","_b","trailingIcon","invalid","onAction","primary","disabled","slot"],"sources":["./src/components/action-bar/action-bar.scss?tag=limel-action-bar&encapsulation=shadow","./src/components/action-bar/action-bar.tsx","./src/components/text-editor/link-menu/editor-link-menu.scss?tag=limel-text-editor-link-menu&encapsulation=shadow","./src/components/text-editor/link-menu/editor-link-menu.tsx"],"sourcesContent":["/**\n* @prop --action-bar-item-text-color: Text color of action bar items, defaults to `--contrast-1100`.\n* @prop --action-bar-item-icon-color: Color of the icons displayed on each action bar item. Defaults to the text color. To specify a color for an individual item, use the `iconColor` prop instead.\n* @prop --action-bar-item-max-width: Maximum width of a button in the action bar. Defaults to `10rem`. Keep in mind that the buttons should not appear too big.\n* @prop --action-bar-border-radius: Defines the roundness of the corners of the action bar. Defaults to `0`.\n* @prop --action-bar-background-color: Background color of the whole component. Defaults to `--contrast-100`.\n* @prop --action-bar-shrink-icon-color: Color of the shrink icon. Defaults to `--contrast-1000`.\n\n*/\n\n@use '../../style/mixins';\n\n:host(limel-action-bar) {\n --action-bar-item-height: 2rem;\n\n --limel-action-bar-item-text-color: var(\n --action-bar-item-text-color,\n rgb(var(--contrast-1100))\n );\n\n box-sizing: border-box;\n\n display: inline-flex;\n align-items: center;\n padding: 0.125rem 0.25rem;\n max-width: 100%;\n border-radius: var(--action-bar-border-radius);\n\n background-color: var(\n --action-bar-background-color,\n rgb(var(--contrast-100))\n );\n\n transition: max-width 0.3s ease;\n}\n\n:host(limel-action-bar),\n.items {\n gap: 0.25rem;\n @media (pointer: coarse) {\n gap: 0.5rem;\n }\n}\n\n.items {\n display: inline-flex;\n max-width: 100%;\n min-width: 0;\n}\n\n:host(limel-action-bar.is-shrunk) .items {\n opacity: 0;\n}\n\n:host(limel-action-bar:not(.is-shrunk)) .items {\n opacity: 1;\n}\n\n:host(limel-action-bar.is-full-width) {\n width: 100%;\n}\n\n:host(limel-action-bar.is-floating) {\n --action-bar-border-radius: 100vw;\n border: 1px solid rgb(var(--contrast-400));\n\n padding-right: 0.125rem;\n padding-left: 0.125rem;\n\n max-width: calc(100% - 2rem);\n box-shadow: var(--shadow-depth-16), var(--shadow-depth-8);\n}\n\n:host(limel-action-bar.is-shrunk) {\n max-width: 5rem;\n transition: max-width 0.3s ease-in-out;\n\n .expand-shrink {\n transition: transform 0.3s ease;\n transform: rotateY(180deg);\n }\n}\n\n:host(limel-action-bar:not(.is-shrunk)) {\n max-width: 100%;\n transition: max-width 0.3s ease-in-out;\n\n .expand-shrink {\n transition: transform 0.3s ease;\n transform: rotateY(0deg);\n }\n}\n\n:host(limel-action-bar.can-be-shrunk.is-full-width) {\n .expand-shrink {\n margin-left: auto;\n }\n}\n\n.expand-shrink {\n all: unset;\n box-sizing: border-box;\n border-radius: 50%;\n\n @include mixins.is-flat-clickable();\n @include mixins.visualize-keyboard-focus;\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n limel-icon {\n width: 1.5rem;\n height: 1.5rem;\n padding: 0.125rem;\n color: var(--action-bar-shrink-icon-color, rgb(var(--contrast-1000)));\n }\n}\n","import {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n Element,\n} from '@stencil/core';\nimport { ListSeparator } from '../list/list-item.types';\nimport { MenuItem, OpenDirection } from '../menu/menu.types';\nimport { ActionBarItem } from './action-bar.types';\nimport { Languages } from './../date-picker/date.types';\nimport translate from './../../global/translations';\nimport { isItem } from './isItem';\nimport { Icon } from '../../global/shared-types/icon.types';\n\n/**\n * An action bar is a user interface element commonly found in software applications and websites.\n * It typically appears at the top of the screen or within a specific section\n * and serves as a centralized hub for accessing various actions and commands\n * relevant to the current context or page.\n *\n * The action bar often contains a set of clickable icons or buttons (icons + labels)\n * that represent specific actions, such as saving, deleting, editing, sharing,\n * or bulk operations for selected items.\n *\n * The purpose of an action bar is to provide quick and convenient access to\n * frequently used functionalities, enabling users to perform common tasks efficiently.\n * It enhances usability by organizing important actions in a visually prominent and easily accessible location.\n *\n * The action bar's design and layout can vary based on the platform or application,\n * but its primary goal remains consistent—to\n * empower users to interact with the software and perform desired actions effortlessly.\n *\n * @exampleComponent limel-example-action-bar-basic\n * @exampleComponent limel-example-action-bar-overflow-menu\n * @exampleComponent limel-example-action-bar-selected-item\n * @exampleComponent limel-example-action-bar-colors\n * @exampleComponent limel-example-action-bar-floating\n * @exampleComponent limel-example-action-bar-floating-expand\n * @exampleComponent limel-example-action-bar-styling\n * @exampleComponent limel-example-action-bar-as-primary-component\n * @exampleComponent limel-example-action-bar-icon-title\n */\n@Component({\n tag: 'limel-action-bar',\n shadow: true,\n styleUrl: 'action-bar.scss',\n})\nexport class ActionBar {\n /**\n * Items that are placed in the action bar.\n * These represent primary actions.\n */\n @Prop()\n public actions: Array<ActionBarItem | ListSeparator> = [];\n\n /**\n * Defines the language for translations.\n */\n @Prop({ reflect: true })\n public language: Languages = document.documentElement.lang as Languages;\n\n /**\n * A label used to describe the purpose of the element to users\n * of assistive technologies, like screen readers.\n * Example value: \"toolbar\"\n */\n @Prop({ reflect: true })\n public accessibleLabel?: string;\n\n /**\n * - When set to `fullWidth`, the component will take the\n * entire width of its container.\n * - When set to `floating`, the component will get basic stylings\n * to visualize the floating state.\n * :::note\n * You should still properly position the component\n * according to the structure of your user interface.\n * For example, use an `absolute` or `fixed` position.\n * :::\n */\n @Prop({ reflect: true })\n public layout?: 'fullWidth' | 'floating';\n\n /**\n * When set to `true`, the action bar will be collapsible.\n */\n @Prop({ reflect: true })\n public collapsible = false;\n\n /**\n * Defines the location that the content of the overflow menu\n * appears, in relation to its trigger.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection;\n\n /**\n * Fired when a action bar item has been clicked.\n * @public\n */\n @Event()\n public itemSelected: EventEmitter<ActionBarItem>;\n\n @Element()\n private readonly host: HTMLElement;\n\n @State()\n private overflowCutoff: number = this.actions.length;\n\n /**\n * Indicates whether the action bar is currently in a collapsed state.\n */\n @State()\n private actionBarIsShrunk = false;\n\n private hasRendered = false;\n private intersectionObserver: IntersectionObserver;\n private isFirstIntersectionCheck = true;\n private actionBarItems: HTMLLimelActionBarItemElement[] = [];\n\n public connectedCallback() {\n if (this.hasRendered) {\n this.createIntersectionObserver();\n }\n }\n\n public componentDidRender() {\n if (this.haveItemsChanged()) {\n this.intersectionObserver?.disconnect();\n this.createIntersectionObserver();\n }\n }\n\n public disconnectedCallback() {\n this.intersectionObserver?.disconnect();\n this.intersectionObserver = undefined;\n this.actionBarItems = [];\n }\n\n public render() {\n this.hasRendered = true;\n let overflowActions: Array<MenuItem | ListSeparator> = [];\n if (this.actions.length) {\n overflowActions = this.actions.slice(this.overflowCutoff);\n }\n\n return (\n <Host\n aria-label={this.accessibleLabel}\n class={{\n 'is-full-width': this.layout === 'fullWidth',\n 'is-floating': this.layout === 'floating',\n 'is-shrunk': this.actionBarIsShrunk && this.collapsible,\n 'can-be-shrunk': !!this.collapsible,\n }}\n role=\"grid\"\n >\n <div class=\"items\" role=\"rowgroup\">\n {this.actions.map(this.renderActionBarItem)}\n </div>\n {this.renderOverflowMenu(overflowActions)}\n {this.renderCollapseExpandButton()}\n </Host>\n );\n }\n\n private readonly renderActionBarItem = (\n item: ActionBarItem,\n index: number,\n ) => {\n return (\n <limel-action-bar-item\n item={item}\n onSelect={this.handleSelect}\n isVisible={this.isVisible(index)}\n role=\"gridcell\"\n />\n );\n };\n\n private readonly renderOverflowMenu = (\n items: Array<MenuItem | ListSeparator>,\n ) => {\n if (!(this.actions.length - this.overflowCutoff)) {\n return;\n }\n\n const shrunkOverFlowIcon: Icon = {\n name: 'more',\n color: 'rgb(var(--contrast-1000))',\n title: this.getTranslation('action-bar.actions'),\n };\n\n return (\n <limel-action-bar-overflow-menu\n openDirection={this.openDirection}\n items={items}\n onSelect={this.handleSelect}\n role=\"gridcell\"\n overFlowIcon={\n this.actionBarIsShrunk ? shrunkOverFlowIcon : undefined\n }\n />\n );\n };\n\n private renderCollapseExpandButton() {\n if (!this.collapsible) {\n return;\n }\n\n return (\n <button\n class={{\n 'expand-shrink': true,\n }}\n aria-label={this.tooltipLabel}\n type=\"button\"\n onClick={this.handleCollapseExpandClick}\n >\n <limel-icon\n name=\"double_left\"\n id=\"tooltip-expand-shrink-button\"\n />\n <limel-tooltip\n label={this.tooltipLabel}\n elementId=\"tooltip-expand-shrink-button\"\n />\n </button>\n );\n }\n\n private handleCollapseExpandClick = () => {\n this.actionBarIsShrunk = !this.actionBarIsShrunk;\n };\n\n private isVisible(index: number) {\n return index < this.overflowCutoff;\n }\n\n private readonly handleSelect = (\n event: CustomEvent<ActionBarItem | ListSeparator>,\n ) => {\n event.stopPropagation();\n if (isItem(event.detail)) {\n this.itemSelected.emit(event.detail);\n }\n };\n\n private get tooltipLabel() {\n let key = 'action-bar.collapse';\n if (this.actionBarIsShrunk) {\n key = 'action-bar.expand';\n }\n\n return this.getTranslation(key);\n }\n\n private getTranslation = (key: string) => {\n return translate.get(key, this.language);\n };\n\n private readonly handleIntersection = (\n entries: IntersectionObserverEntry[],\n ) => {\n const intersectingItems = entries.filter(\n (entry) => entry.isIntersecting,\n );\n\n const notIntersectingItems = entries.filter(\n (entry) => !entry.isIntersecting,\n );\n\n if (this.isFirstIntersectionCheck) {\n this.overflowCutoff = intersectingItems.length;\n } else {\n this.overflowCutoff =\n this.overflowCutoff +\n intersectingItems.length -\n notIntersectingItems.length;\n }\n\n this.isFirstIntersectionCheck = false;\n };\n\n private createIntersectionObserver() {\n const options = {\n root: this.host.shadowRoot.querySelector('.items'),\n rootMargin: '0px',\n threshold: 1.0,\n };\n\n this.overflowCutoff = this.actions.length;\n this.isFirstIntersectionCheck = true;\n\n this.actionBarItems = [];\n\n this.intersectionObserver = new IntersectionObserver(\n this.handleIntersection,\n options,\n );\n\n this.host.shadowRoot\n .querySelectorAll('limel-action-bar-item')\n .forEach((actionBarItem) => {\n this.observe(actionBarItem);\n });\n }\n\n private observe(actionBarItem: HTMLLimelActionBarItemElement) {\n this.intersectionObserver.observe(actionBarItem);\n this.actionBarItems.push(actionBarItem);\n }\n\n private haveItemsChanged() {\n const someItemRemoved = this.actionBarItems.some(\n (actionBarItem: HTMLLimelActionBarItemElement) =>\n !this.host.shadowRoot.contains(actionBarItem),\n );\n\n const someItemAdded = Array.from(\n this.host.shadowRoot.querySelectorAll('limel-action-bar-item'),\n ).some(\n (actionBarItem: HTMLLimelActionBarItemElement) =>\n !this.actionBarItems.includes(actionBarItem),\n );\n\n return someItemRemoved || someItemAdded;\n }\n}\n",":host(limel-text-editor-link-menu) {\n animation: fade 0.2s ease forwards;\n animation-delay: 0.1s; // prevents the visual glitch when the link opens\n opacity: 0;\n\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.5rem;\n max-width: calc(100vw - 2rem);\n border-radius: 0.5rem;\n background-color: var(--lime-elevated-surface-background-color);\n box-shadow: var(--shadow-depth-16);\n}\n\n.actions {\n display: flex;\n justify-content: end;\n gap: 0.5rem;\n}\n\n@keyframes fade {\n 0% {\n scale: 0.86;\n opacity: 0;\n }\n 100% {\n scale: 1;\n opacity: 1;\n }\n}\n","import { Component, Prop, h, Event, EventEmitter } from '@stencil/core';\nimport { EditorTextLink } from '../prosemirror-adapter/menu/types';\nimport { Languages } from '../../date-picker/date.types';\nimport translate from '../../../global/translations';\nimport { LimelInputFieldCustomEvent } from '../../../components';\nimport { ENTER, ESCAPE } from '../../../util/keycodes';\n\n/**\n * This component is a menu for editing a link in the text editor.\n * It allows the user to input the text and url for the link.\n * @beta\n * @private\n */\n@Component({\n tag: 'limel-text-editor-link-menu',\n shadow: true,\n styleUrl: 'editor-link-menu.scss',\n})\nexport class TextEditorLinkMenu {\n /**\n * The link\n */\n @Prop({ reflect: true })\n public link: EditorTextLink;\n\n /**\n * Defines the language for translations.\n */\n @Prop({ reflect: true })\n public language: Languages = 'en';\n\n /**\n * Open state of the link-menu dialog\n */\n @Prop({ reflect: true })\n public isOpen: boolean = false;\n\n /**\n * Emitted when the menu is closed from inside the component.\n * (*Not* emitted when the consumer sets the `open`-property to `false`.)\n */\n @Event()\n private cancel: EventEmitter<void>;\n\n /**\n * Emitted when the menu is saved from inside the component.\n */\n @Event()\n private save: EventEmitter<void>;\n\n /**\n * Emitted when the user inputs new values for the link\n */\n @Event()\n private linkChange: EventEmitter<EditorTextLink>;\n\n private textInput: HTMLLimelInputFieldElement;\n private saveButton: HTMLLimelButtonElement;\n\n public connectedCallback() {\n this.setupGlobalHandlers();\n }\n\n public disconnectedCallback() {\n this.teardownGlobalHandlers();\n }\n\n private setupGlobalHandlers() {\n if (this.isOpen) {\n document.addEventListener('keyup', this.handleCancel);\n }\n }\n\n private teardownGlobalHandlers() {\n document.removeEventListener('keyup', this.handleCancel);\n }\n\n public componentDidLoad() {\n this.focusOnTextInput();\n }\n\n private focusOnTextInput() {\n if (this.textInput) {\n const inputField = this.textInput.shadowRoot.querySelector('input');\n if (inputField) {\n requestAnimationFrame(() => {\n inputField.focus();\n });\n }\n }\n }\n\n public render() {\n const isValid = this.isValid(this.link.href);\n\n return [\n <limel-input-field\n label={this.getTranslation('editor-link-menu.text')}\n value={this.link?.text || ''}\n leadingIcon=\"text_cursor\"\n onChange={this.handleLinkTitleChange}\n onKeyDown={this.handleKeyDown}\n ref={(el) =>\n (this.textInput = el as HTMLLimelInputFieldElement)\n }\n />,\n <limel-input-field\n label={this.getTranslation('editor-link-menu.link')}\n value={this.link?.href || ''}\n type=\"text\"\n leadingIcon=\"-lime-text-link\"\n trailingIcon=\"external_link\"\n invalid={!isValid}\n onChange={this.handleLinkValueChange}\n onAction={this.handleLinkInputAction}\n onKeyDown={this.handleKeyDown}\n />,\n <div class=\"actions\">\n <limel-button\n label={this.getTranslation('cancel')}\n onClick={this.handleCancel}\n />\n <limel-button\n primary={true}\n label={this.getTranslation('save')}\n disabled={!isValid}\n onClick={this.handleSave}\n ref={(el) =>\n (this.saveButton = el as HTMLLimelButtonElement)\n }\n slot=\"button\"\n />\n </div>,\n ];\n }\n\n private getTranslation = (key: string) => {\n return translate.get(key, this.language);\n };\n\n private isValid = (href: string): boolean => {\n try {\n new URL(href);\n } catch {\n return false;\n }\n\n return true;\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key !== ENTER) {\n return;\n }\n\n if (this.saveButton) {\n this.saveButton.focus();\n }\n\n event.preventDefault();\n if (this.isValid(this.link?.href)) {\n this.handleSave(event);\n }\n };\n\n private handleCancel = (event: MouseEvent | KeyboardEvent) => {\n if (event instanceof KeyboardEvent && event.key !== ESCAPE) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n this.cancel.emit();\n };\n\n private handleSave = (event: MouseEvent | KeyboardEvent) => {\n event.stopPropagation();\n\n this.save.emit();\n };\n\n private handleLinkInputAction = (\n event: LimelInputFieldCustomEvent<void>,\n ) => {\n window.open(this.link.href, '_blank');\n event.stopPropagation();\n };\n\n private handleLinkTitleChange = (event: CustomEvent<string>) => {\n this.emitLinkChange(event.detail, this.link?.href);\n };\n\n private handleLinkValueChange = (event: CustomEvent<string>) => {\n const href = event.detail;\n\n this.emitLinkChange(this.link?.text, href);\n };\n\n private emitLinkChange = (text: string, href: string) => {\n const newLink: EditorTextLink = {\n text: text,\n href: href,\n };\n\n this.linkChange.emit(newLink);\n };\n}\n"],"mappings":"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"}
|