@limetech/lime-elements 37.62.0 → 37.62.1

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/limel-badge_3.cjs.entry.js +1 -1
  3. package/dist/cjs/limel-badge_3.cjs.entry.js.map +1 -1
  4. package/dist/cjs/limel-dynamic-label_4.cjs.entry.js +1 -1
  5. package/dist/cjs/limel-dynamic-label_4.cjs.entry.js.map +1 -1
  6. package/dist/cjs/limel-icon_2.cjs.entry.js +17 -4
  7. package/dist/cjs/limel-icon_2.cjs.entry.js.map +1 -1
  8. package/dist/collection/components/menu-surface/menu-surface.css +1 -0
  9. package/dist/collection/components/portal/portal.js +17 -4
  10. package/dist/collection/components/portal/portal.js.map +1 -1
  11. package/dist/collection/components/tooltip/tooltip-content.css +0 -12
  12. package/dist/esm/limel-badge_3.entry.js +1 -1
  13. package/dist/esm/limel-badge_3.entry.js.map +1 -1
  14. package/dist/esm/limel-dynamic-label_4.entry.js +1 -1
  15. package/dist/esm/limel-dynamic-label_4.entry.js.map +1 -1
  16. package/dist/esm/limel-icon_2.entry.js +17 -4
  17. package/dist/esm/limel-icon_2.entry.js.map +1 -1
  18. package/dist/lime-elements/lime-elements.css +1 -1
  19. package/dist/lime-elements/lime-elements.esm.js +1 -1
  20. package/dist/lime-elements/{p-d1838cf6.entry.js → p-0b3a043a.entry.js} +2 -2
  21. package/dist/lime-elements/{p-d1838cf6.entry.js.map → p-0b3a043a.entry.js.map} +1 -1
  22. package/dist/lime-elements/{p-441c0259.entry.js → p-5344e8bf.entry.js} +2 -2
  23. package/dist/lime-elements/p-5344e8bf.entry.js.map +1 -0
  24. package/dist/lime-elements/{p-6c74fcaa.entry.js → p-b334b138.entry.js} +2 -2
  25. package/dist/lime-elements/{p-6c74fcaa.entry.js.map → p-b334b138.entry.js.map} +1 -1
  26. package/dist/types/components/portal/portal.d.ts +1 -0
  27. package/package.json +1 -1
  28. package/dist/lime-elements/p-441c0259.entry.js.map +0 -1
@@ -206,6 +206,7 @@
206
206
  }
207
207
 
208
208
  .mdc-menu-surface {
209
+ opacity: 1;
209
210
  display: var(--limel-menu-surface-display, block);
210
211
  flex-direction: var(--limel-menu-surface-flex-direction, row);
211
212
  max-height: inherit;
@@ -1,6 +1,8 @@
1
1
  import { h } from '@stencil/core';
2
2
  import { createPopper, } from '@popperjs/core';
3
3
  const IS_VISIBLE_CLASS = 'is-visible';
4
+ const IS_HIDING_CLASS = 'is-hiding';
5
+ const hideAnimationDuration = 300;
4
6
  /**
5
7
  * The portal component provides a way to render children into a DOM node that
6
8
  * exist outside the DOM hierarchy of the parent component.
@@ -100,9 +102,7 @@ export class Portal {
100
102
  this.init();
101
103
  }
102
104
  if (!this.visible) {
103
- this.hideContainer();
104
- this.styleContainer();
105
- this.destroyPopper();
105
+ this.animateHideAndCleanup();
106
106
  return;
107
107
  }
108
108
  this.styleContainer();
@@ -139,7 +139,6 @@ export class Portal {
139
139
  }
140
140
  parent.appendChild(element);
141
141
  });
142
- this.hideContainer();
143
142
  this.container.parentElement.removeChild(this.container);
144
143
  }
145
144
  hideContainer() {
@@ -151,6 +150,20 @@ export class Portal {
151
150
  showContainer() {
152
151
  this.container.classList.add(IS_VISIBLE_CLASS);
153
152
  }
153
+ animateHideAndCleanup() {
154
+ if (!this.container) {
155
+ return;
156
+ }
157
+ this.container.classList.add(IS_HIDING_CLASS);
158
+ this.styleContainer();
159
+ setTimeout(() => {
160
+ this.container.classList.remove(IS_HIDING_CLASS);
161
+ if (!this.visible) {
162
+ this.container.classList.remove(IS_VISIBLE_CLASS);
163
+ this.destroyPopper();
164
+ }
165
+ }, hideAnimationDuration);
166
+ }
154
167
  styleContainer() {
155
168
  this.setContainerWidth();
156
169
  this.setContainerHeight();
@@ -1 +1 @@
1
- {"version":3,"file":"portal.js","sourceRoot":"","sources":["../../../src/components/portal/portal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA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MACb,WAAW,EAAE,UAAU;MACvB,WAAW,EAAE,cAAc;MAC3B,GAAG,EAAE,QAAQ;MACb,SAAS,EAAE,YAAY;MACvB,cAAc,EAAE,WAAW;MAC3B,MAAM,EAAE,KAAK;MACb,YAAY,EAAE,SAAS;KAC1B,CAAC;IAEF,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC;EACrC,CAAC;EAEO,kBAAkB;IACtB,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CACvB,QAAQ,CAAC,eAAe,CAAC,YAAY,IAAI,CAAC,EAC1C,MAAM,CAAC,WAAW,IAAI,CAAC,CAC1B,CAAC;IAEF,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC1D,MAAM,sBAAsB,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAChD,MAAM,sBAAsB,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;IAChE,MAAM,kBAAkB,GAAG,EAAE,CAAC;IAC9B,MAAM,SAAS,GACX,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;MACxD,kBAAkB,CAAC;IAEvB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,SAAS,IAAI,CAAC;EACtD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Element, h, Prop, Watch } from '@stencil/core';\nimport { OpenDirection } from '../menu/menu.types';\nimport {\n createPopper,\n Instance,\n OptionsGeneric,\n Placement,\n} from '@popperjs/core';\nimport { FlipModifier } from '@popperjs/core/lib/modifiers/flip';\n\nconst IS_VISIBLE_CLASS = 'is-visible';\n\n/**\n * The portal component provides a way to render children into a DOM node that\n * exist outside the DOM hierarchy of the parent component.\n *\n * When the limel-portal component is used, it creates a new DOM node (a div element)\n * and appends it to a parent element (by default, the body of the document).\n * The child elements of the limel-portal are then moved from\n * their original location in the DOM to this new div element.\n *\n * This technique is often used to overcome CSS stacking context issues,\n * or to render UI elements like modals, dropdowns, tooltips, etc.,\n * that need to visually \"break out\" of their container.\n *\n * Using this component, we ensure that the content is always rendered in the\n * correct position, and never covers its own trigger, or another component\n * that is opened in the stacking layer. This way, we don't need to worry about\n * z-indexes, or other stacking context issues.\n *\n * :::important\n * There are some caveats when using this component\n *\n * 1. Events might not bubble up as expected since the content is moved out to\n * another DOM node.\n * 2. Any styling that is applied to content from the parent will be lost, if the\n * content is just another web-component it will work without any issues.\n * Alternatively, use the `style=\"\"` html attribute.\n * 3. Any component that is placed inside the container must have a style of\n * `max-height: inherit`. This ensures that its placement is calculated\n * correctly in relation to the trigger, and that it never covers its own\n * trigger.\n * 4. When the node is moved in the DOM, `disconnectedCallback` and\n * `connectedCallback` will be invoked, so if `disconnectedCallback` is used\n * to do any tear-down, the appropriate setup will have to be done again on\n * `connectedCallback`.\n * :::\n *\n * @slot - Content to put inside the portal\n * @private\n * @exampleComponent limel-example-portal-basic\n */\n@Component({\n tag: 'limel-portal',\n shadow: true,\n styleUrl: 'portal.scss',\n})\nexport class Portal {\n /**\n * Decides which direction the portal content should open.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection = 'bottom';\n\n /**\n * Position of the content.\n */\n @Prop({ reflect: true })\n public position: 'fixed' | 'absolute' = 'absolute';\n\n /**\n * A unique ID.\n */\n @Prop({ reflect: true })\n public containerId: string;\n\n /**\n * Dynamic styling that can be applied to the container holding the content.\n */\n @Prop()\n public containerStyle: object = {};\n\n /**\n * The `parent` property specifies the parent element where the content\n * of the portal will be moved to.\n * By default, it is set to `document.body`, meaning the content\n * will be appended as a child of the body element in the DOM.\n * If you want the content to be appended to a different element,\n * you can specify that element by setting this property.\n * Please note that the specified parent element should exist\n * in the DOM at the time of rendering the portal.\n */\n @Prop()\n public parent: HTMLElement = document.body;\n\n /**\n * Used to make a dropdown have the same width as the trigger, for example\n * in `limel-picker`.\n */\n @Prop({ reflect: true })\n public inheritParentWidth = false;\n\n /**\n * True if the content within the portal should be visible.\n *\n * If the content is from within a dialog for instance, this can be set to\n * true from false when the dialog opens to position the content properly.\n */\n @Prop({ reflect: true })\n public visible = false;\n\n /**\n * The element that the content should be positioned relative to.\n * Defaults to the limel-portal element.\n */\n @Prop()\n public anchor?: HTMLElement = null;\n\n @Element()\n private host: HTMLLimelPortalElement;\n\n private parents: WeakMap<HTMLElement, HTMLElement>;\n private container: HTMLElement;\n private popperInstance: Instance;\n private loaded = false;\n private observer: ResizeObserver;\n\n constructor() {\n this.parents = new WeakMap();\n }\n\n public disconnectedCallback() {\n this.removeContainer();\n this.destroyPopper();\n if (this.observer) {\n this.observer.unobserve(this.container);\n }\n }\n\n public connectedCallback() {\n if (!this.loaded) {\n return;\n }\n\n if (this.visible) {\n this.init();\n }\n }\n\n public componentDidLoad() {\n this.loaded = true;\n this.connectedCallback();\n }\n\n private init() {\n this.createContainer();\n this.hideContainer();\n this.attachContainer();\n this.styleContainer();\n\n if (this.visible) {\n this.createPopper();\n this.showContainer();\n }\n\n if ('ResizeObserver' in window) {\n const observer = new ResizeObserver(() => {\n if (this.popperInstance) {\n this.styleContainer();\n this.popperInstance.update();\n }\n });\n observer.observe(this.container);\n }\n }\n\n public render() {\n return <slot />;\n }\n\n @Watch('visible')\n protected onVisible() {\n if (!this.container && this.visible) {\n this.init();\n }\n\n if (!this.visible) {\n this.hideContainer();\n this.styleContainer();\n this.destroyPopper();\n\n return;\n }\n\n this.styleContainer();\n this.createPopper();\n requestAnimationFrame(() => {\n this.showContainer();\n });\n }\n\n private createContainer() {\n const slot: HTMLSlotElement =\n this.host.shadowRoot.querySelector('slot');\n const content =\n (slot.assignedElements && slot.assignedElements()) || [];\n\n this.container = document.createElement('div');\n this.container.setAttribute('id', this.containerId);\n this.container.setAttribute('class', 'limel-portal--container');\n Object.assign(this.container, {\n portalSource: this.host,\n });\n\n content.forEach((element: HTMLElement) => {\n this.parents.set(element, element.parentElement);\n this.container.appendChild(element);\n });\n }\n\n private attachContainer() {\n this.parent.appendChild(this.container);\n }\n\n private removeContainer() {\n if (!this.container) {\n return;\n }\n\n Array.from(this.container.children).forEach((element: HTMLElement) => {\n const parent = this.parents.get(element);\n if (!parent) {\n return;\n }\n\n parent.appendChild(element);\n });\n\n this.hideContainer();\n this.container.parentElement.removeChild(this.container);\n }\n\n private hideContainer() {\n if (!this.container) {\n return;\n }\n\n this.container.classList.remove(IS_VISIBLE_CLASS);\n }\n\n private showContainer() {\n this.container.classList.add(IS_VISIBLE_CLASS);\n }\n\n private styleContainer() {\n this.setContainerWidth();\n this.setContainerHeight();\n this.setContainerStyles();\n }\n\n private setContainerWidth() {\n const hostWidth = this.host.getBoundingClientRect().width;\n\n if (this.inheritParentWidth) {\n const containerWidth = this.getContentWidth(this.container);\n let width = containerWidth;\n if (hostWidth > 0) {\n width = hostWidth;\n }\n\n this.container.style.width = `${width}px`;\n }\n }\n\n private getContentWidth(element: HTMLElement | Element) {\n if (!element) {\n return null;\n }\n\n const width = element.getBoundingClientRect().width;\n if (width !== 0) {\n return width;\n }\n\n const elementContent = element.querySelector('*');\n\n return this.getContentWidth(elementContent);\n }\n\n private setContainerStyles() {\n Object.keys(this.containerStyle).forEach((property) => {\n this.container.style[property] = this.containerStyle[property];\n });\n }\n\n private createPopper() {\n const config = this.createPopperConfig();\n\n this.popperInstance = createPopper(\n this.anchor || this.host,\n this.container,\n config,\n );\n }\n\n private destroyPopper() {\n this.popperInstance?.destroy();\n this.popperInstance = null;\n }\n\n private createPopperConfig(): Partial<\n OptionsGeneric<Partial<FlipModifier>>\n > {\n const placement = this.getPlacement(this.openDirection);\n const flipPlacement = this.getFlipPlacement(this.openDirection);\n\n return {\n strategy: this.position,\n placement: placement,\n modifiers: [\n {\n name: 'flip',\n options: {\n fallbackPlacements: [flipPlacement],\n },\n },\n ],\n };\n }\n\n private getPlacement(direction: OpenDirection): Placement {\n const placements: Record<OpenDirection, Placement> = {\n 'left-start': 'left-start',\n left: 'left',\n 'left-end': 'left-end',\n 'right-start': 'right-start',\n right: 'right',\n 'right-end': 'right-end',\n 'top-start': 'top-start',\n top: 'top',\n 'top-end': 'top-end',\n 'bottom-start': 'bottom-start',\n bottom: 'bottom',\n 'bottom-end': 'bottom-end',\n };\n\n return placements[direction];\n }\n\n private getFlipPlacement(direction: OpenDirection): Placement {\n const flipPlacements: Record<OpenDirection, Placement> = {\n 'left-start': 'right-start',\n left: 'right',\n 'left-end': 'right-end',\n 'right-start': 'left-start',\n right: 'left',\n 'right-end': 'left-end',\n 'top-start': 'bottom-start',\n top: 'bottom',\n 'top-end': 'bottom-end',\n 'bottom-start': 'top-start',\n bottom: 'top',\n 'bottom-end': 'top-end',\n };\n\n return flipPlacements[direction];\n }\n\n private setContainerHeight() {\n const viewHeight = Math.max(\n document.documentElement.clientHeight || 0,\n window.innerHeight || 0,\n );\n\n const { top, bottom } = this.host.getBoundingClientRect();\n const spaceAboveTopOfSurface = Math.max(top, 0);\n const spaceBelowTopOfSurface = Math.max(viewHeight - bottom, 0);\n const extraCosmeticSpace = 16;\n const maxHeight =\n Math.max(spaceAboveTopOfSurface, spaceBelowTopOfSurface) -\n extraCosmeticSpace;\n\n this.container.style.maxHeight = `${maxHeight}px`;\n }\n}\n"]}
1
+ {"version":3,"file":"portal.js","sourceRoot":"","sources":["../../../src/components/portal/portal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EACH,YAAY,GAIf,MAAM,gBAAgB,CAAC;AAGxB,MAAM,gBAAgB,GAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Element, h, Prop, Watch } from '@stencil/core';\nimport { OpenDirection } from '../menu/menu.types';\nimport {\n createPopper,\n Instance,\n OptionsGeneric,\n Placement,\n} from '@popperjs/core';\nimport { FlipModifier } from '@popperjs/core/lib/modifiers/flip';\n\nconst IS_VISIBLE_CLASS = 'is-visible';\nconst IS_HIDING_CLASS = 'is-hiding';\nconst hideAnimationDuration = 300;\n\n/**\n * The portal component provides a way to render children into a DOM node that\n * exist outside the DOM hierarchy of the parent component.\n *\n * When the limel-portal component is used, it creates a new DOM node (a div element)\n * and appends it to a parent element (by default, the body of the document).\n * The child elements of the limel-portal are then moved from\n * their original location in the DOM to this new div element.\n *\n * This technique is often used to overcome CSS stacking context issues,\n * or to render UI elements like modals, dropdowns, tooltips, etc.,\n * that need to visually \"break out\" of their container.\n *\n * Using this component, we ensure that the content is always rendered in the\n * correct position, and never covers its own trigger, or another component\n * that is opened in the stacking layer. This way, we don't need to worry about\n * z-indexes, or other stacking context issues.\n *\n * :::important\n * There are some caveats when using this component\n *\n * 1. Events might not bubble up as expected since the content is moved out to\n * another DOM node.\n * 2. Any styling that is applied to content from the parent will be lost, if the\n * content is just another web-component it will work without any issues.\n * Alternatively, use the `style=\"\"` html attribute.\n * 3. Any component that is placed inside the container must have a style of\n * `max-height: inherit`. This ensures that its placement is calculated\n * correctly in relation to the trigger, and that it never covers its own\n * trigger.\n * 4. When the node is moved in the DOM, `disconnectedCallback` and\n * `connectedCallback` will be invoked, so if `disconnectedCallback` is used\n * to do any tear-down, the appropriate setup will have to be done again on\n * `connectedCallback`.\n * :::\n *\n * @slot - Content to put inside the portal\n * @private\n * @exampleComponent limel-example-portal-basic\n */\n@Component({\n tag: 'limel-portal',\n shadow: true,\n styleUrl: 'portal.scss',\n})\nexport class Portal {\n /**\n * Decides which direction the portal content should open.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection = 'bottom';\n\n /**\n * Position of the content.\n */\n @Prop({ reflect: true })\n public position: 'fixed' | 'absolute' = 'absolute';\n\n /**\n * A unique ID.\n */\n @Prop({ reflect: true })\n public containerId: string;\n\n /**\n * Dynamic styling that can be applied to the container holding the content.\n */\n @Prop()\n public containerStyle: object = {};\n\n /**\n * The `parent` property specifies the parent element where the content\n * of the portal will be moved to.\n * By default, it is set to `document.body`, meaning the content\n * will be appended as a child of the body element in the DOM.\n * If you want the content to be appended to a different element,\n * you can specify that element by setting this property.\n * Please note that the specified parent element should exist\n * in the DOM at the time of rendering the portal.\n */\n @Prop()\n public parent: HTMLElement = document.body;\n\n /**\n * Used to make a dropdown have the same width as the trigger, for example\n * in `limel-picker`.\n */\n @Prop({ reflect: true })\n public inheritParentWidth = false;\n\n /**\n * True if the content within the portal should be visible.\n *\n * If the content is from within a dialog for instance, this can be set to\n * true from false when the dialog opens to position the content properly.\n */\n @Prop({ reflect: true })\n public visible = false;\n\n /**\n * The element that the content should be positioned relative to.\n * Defaults to the limel-portal element.\n */\n @Prop()\n public anchor?: HTMLElement = null;\n\n @Element()\n private host: HTMLLimelPortalElement;\n\n private parents: WeakMap<HTMLElement, HTMLElement>;\n private container: HTMLElement;\n private popperInstance: Instance;\n private loaded = false;\n private observer: ResizeObserver;\n\n constructor() {\n this.parents = new WeakMap();\n }\n\n public disconnectedCallback() {\n this.removeContainer();\n this.destroyPopper();\n if (this.observer) {\n this.observer.unobserve(this.container);\n }\n }\n\n public connectedCallback() {\n if (!this.loaded) {\n return;\n }\n\n if (this.visible) {\n this.init();\n }\n }\n\n public componentDidLoad() {\n this.loaded = true;\n this.connectedCallback();\n }\n\n private init() {\n this.createContainer();\n this.hideContainer();\n this.attachContainer();\n this.styleContainer();\n\n if (this.visible) {\n this.createPopper();\n this.showContainer();\n }\n\n if ('ResizeObserver' in window) {\n const observer = new ResizeObserver(() => {\n if (this.popperInstance) {\n this.styleContainer();\n this.popperInstance.update();\n }\n });\n observer.observe(this.container);\n }\n }\n\n public render() {\n return <slot />;\n }\n\n @Watch('visible')\n protected onVisible() {\n if (!this.container && this.visible) {\n this.init();\n }\n\n if (!this.visible) {\n this.animateHideAndCleanup();\n\n return;\n }\n\n this.styleContainer();\n this.createPopper();\n requestAnimationFrame(() => {\n this.showContainer();\n });\n }\n\n private createContainer() {\n const slot: HTMLSlotElement =\n this.host.shadowRoot.querySelector('slot');\n const content =\n (slot.assignedElements && slot.assignedElements()) || [];\n\n this.container = document.createElement('div');\n this.container.setAttribute('id', this.containerId);\n this.container.setAttribute('class', 'limel-portal--container');\n Object.assign(this.container, {\n portalSource: this.host,\n });\n\n content.forEach((element: HTMLElement) => {\n this.parents.set(element, element.parentElement);\n this.container.appendChild(element);\n });\n }\n\n private attachContainer() {\n this.parent.appendChild(this.container);\n }\n\n private removeContainer() {\n if (!this.container) {\n return;\n }\n\n Array.from(this.container.children).forEach((element: HTMLElement) => {\n const parent = this.parents.get(element);\n if (!parent) {\n return;\n }\n\n parent.appendChild(element);\n });\n\n this.container.parentElement.removeChild(this.container);\n }\n\n private hideContainer() {\n if (!this.container) {\n return;\n }\n\n this.container.classList.remove(IS_VISIBLE_CLASS);\n }\n\n private showContainer() {\n this.container.classList.add(IS_VISIBLE_CLASS);\n }\n\n private animateHideAndCleanup() {\n if (!this.container) {\n return;\n }\n\n this.container.classList.add(IS_HIDING_CLASS);\n this.styleContainer();\n\n setTimeout(() => {\n this.container.classList.remove(IS_HIDING_CLASS);\n if (!this.visible) {\n this.container.classList.remove(IS_VISIBLE_CLASS);\n this.destroyPopper();\n }\n }, hideAnimationDuration);\n }\n\n private styleContainer() {\n this.setContainerWidth();\n this.setContainerHeight();\n this.setContainerStyles();\n }\n\n private setContainerWidth() {\n const hostWidth = this.host.getBoundingClientRect().width;\n\n if (this.inheritParentWidth) {\n const containerWidth = this.getContentWidth(this.container);\n let width = containerWidth;\n if (hostWidth > 0) {\n width = hostWidth;\n }\n\n this.container.style.width = `${width}px`;\n }\n }\n\n private getContentWidth(element: HTMLElement | Element) {\n if (!element) {\n return null;\n }\n\n const width = element.getBoundingClientRect().width;\n if (width !== 0) {\n return width;\n }\n\n const elementContent = element.querySelector('*');\n\n return this.getContentWidth(elementContent);\n }\n\n private setContainerStyles() {\n Object.keys(this.containerStyle).forEach((property) => {\n this.container.style[property] = this.containerStyle[property];\n });\n }\n\n private createPopper() {\n const config = this.createPopperConfig();\n\n this.popperInstance = createPopper(\n this.anchor || this.host,\n this.container,\n config,\n );\n }\n\n private destroyPopper() {\n this.popperInstance?.destroy();\n this.popperInstance = null;\n }\n\n private createPopperConfig(): Partial<\n OptionsGeneric<Partial<FlipModifier>>\n > {\n const placement = this.getPlacement(this.openDirection);\n const flipPlacement = this.getFlipPlacement(this.openDirection);\n\n return {\n strategy: this.position,\n placement: placement,\n modifiers: [\n {\n name: 'flip',\n options: {\n fallbackPlacements: [flipPlacement],\n },\n },\n ],\n };\n }\n\n private getPlacement(direction: OpenDirection): Placement {\n const placements: Record<OpenDirection, Placement> = {\n 'left-start': 'left-start',\n left: 'left',\n 'left-end': 'left-end',\n 'right-start': 'right-start',\n right: 'right',\n 'right-end': 'right-end',\n 'top-start': 'top-start',\n top: 'top',\n 'top-end': 'top-end',\n 'bottom-start': 'bottom-start',\n bottom: 'bottom',\n 'bottom-end': 'bottom-end',\n };\n\n return placements[direction];\n }\n\n private getFlipPlacement(direction: OpenDirection): Placement {\n const flipPlacements: Record<OpenDirection, Placement> = {\n 'left-start': 'right-start',\n left: 'right',\n 'left-end': 'right-end',\n 'right-start': 'left-start',\n right: 'left',\n 'right-end': 'left-end',\n 'top-start': 'bottom-start',\n top: 'bottom',\n 'top-end': 'bottom-end',\n 'bottom-start': 'top-start',\n bottom: 'top',\n 'bottom-end': 'top-end',\n };\n\n return flipPlacements[direction];\n }\n\n private setContainerHeight() {\n const viewHeight = Math.max(\n document.documentElement.clientHeight || 0,\n window.innerHeight || 0,\n );\n\n const { top, bottom } = this.host.getBoundingClientRect();\n const spaceAboveTopOfSurface = Math.max(top, 0);\n const spaceBelowTopOfSurface = Math.max(viewHeight - bottom, 0);\n const extraCosmeticSpace = 16;\n const maxHeight =\n Math.max(spaceAboveTopOfSurface, spaceBelowTopOfSurface) -\n extraCosmeticSpace;\n\n this.container.style.maxHeight = `${maxHeight}px`;\n }\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  :host(limel-tooltip-content) {
2
- animation: display-tooltip 0.2s ease;
3
2
  display: flex;
4
3
  border-radius: 0.25rem;
5
4
  padding: 0.25rem 0.5rem;
@@ -34,15 +33,4 @@ text.has-column-layout .helper-label {
34
33
  }
35
34
  .helper-label:empty {
36
35
  display: none;
37
- }
38
-
39
- @keyframes display-tooltip {
40
- 0% {
41
- opacity: 0;
42
- transform: translate3d(0, 0, 0) scale(0.94);
43
- }
44
- 100% {
45
- opacity: 1;
46
- transform: translate3d(0, 0, 0) scale(1);
47
- }
48
36
  }
@@ -123,7 +123,7 @@ const Tooltip = class {
123
123
  };
124
124
  Tooltip.style = tooltipCss;
125
125
 
126
- const tooltipContentCss = ":host(limel-tooltip-content){animation:display-tooltip 0.2s ease;display:flex;border-radius:0.25rem;padding:0.25rem 0.5rem;background-color:rgb(var(--contrast-1300));box-shadow:var(--shadow-depth-16)}text{font-size:0.875rem;line-height:1.25;display:flex;column-gap:1rem}text.has-column-layout{display:table-cell;width:fit-content;max-width:min(var(--tooltip-max-width-of-text), 80vw)}text.has-column-layout .label{padding-bottom:0.5rem}text.has-column-layout .helper-label{padding-bottom:0.25rem}.label{color:rgb(var(--contrast-200))}.helper-label{color:rgb(var(--contrast-800))}.helper-label:empty{display:none}@keyframes display-tooltip{0%{opacity:0;transform:translate3d(0, 0, 0) scale(0.94)}100%{opacity:1;transform:translate3d(0, 0, 0) scale(1)}}";
126
+ const tooltipContentCss = ":host(limel-tooltip-content){display:flex;border-radius:0.25rem;padding:0.25rem 0.5rem;background-color:rgb(var(--contrast-1300));box-shadow:var(--shadow-depth-16)}text{font-size:0.875rem;line-height:1.25;display:flex;column-gap:1rem}text.has-column-layout{display:table-cell;width:fit-content;max-width:min(var(--tooltip-max-width-of-text), 80vw)}text.has-column-layout .label{padding-bottom:0.5rem}text.has-column-layout .helper-label{padding-bottom:0.25rem}.label{color:rgb(var(--contrast-200))}.helper-label{color:rgb(var(--contrast-800))}.helper-label:empty{display:none}";
127
127
 
128
128
  const TooltipContent = class {
129
129
  constructor(hostRef) {
@@ -1 +1 @@
1
- {"file":"limel-badge.limel-tooltip.limel-tooltip-content.entry.js","mappings":";;;;;AAAA,MAAM,QAAQ,GAAG,w7DAAw7D;;MCgB57D,KAAK;;;;;EAUP,MAAM;IACT,QACI,EAAC,IAAI,IACD,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,EAC5C,KAAK,EAAE;QACH,iBAAiB,EAAE,IAAI,CAAC,YAAY,EAAE;OACzC,IAED,gBAAO,IAAI,CAAC,WAAW,EAAE,CAAQ,CAC9B,EACT;GACL;EAEO,WAAW;IACf,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE;MAChC,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACjC;IAED,OAAO,IAAI,CAAC,KAAK,CAAC;GACrB;EAEO,YAAY;IAChB,MAAM,iBAAiB,GAAG,GAAG,CAAC;IAC9B,MAAM,gBAAgB,GAAG,CAAC,CAAC;IAC3B,IACI,CAAC,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;MAC3B,IAAI,CAAC,KAAK,GAAG,iBAAiB;OACjC,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;QAC3B,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,gBAAgB,CAAC,EAC3C;MACE,OAAO,IAAI,CAAC;KACf;GACJ;;;;SC1DW,eAAe,CAC3B,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5D,CAAC;KACL;IAED,OAAO;MACH,0BAAM,KAAK,EAAE,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,IAAM,KAAK,GAC7D,WAAK,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,KAAK,CAAO,EACrC,WAAK,KAAK,EAAC,cAAc,IAAE,IAAI,CAAC,WAAW,CAAO,CAC/C;KACV,CAAC;GACL;;;;;;","names":[],"sources":["./src/components/badge/badge.scss?tag=limel-badge&encapsulation=shadow","./src/components/badge/badge.tsx","./src/components/tooltip/getOwnerElement.tsx","./src/components/tooltip/tooltipTimer.ts","./src/components/tooltip/tooltip.scss?tag=limel-tooltip&encapsulation=shadow","./src/components/tooltip/tooltip.tsx","./src/components/tooltip/tooltip-content.scss?tag=limel-tooltip-content&encapsulation=shadow","./src/components/tooltip/tooltip-content.tsx"],"sourcesContent":["@use '../../style/functions';\n@use '../../style/internal/lime-theme';\n@use '../../style/mixins';\n\n/**\n * @prop --badge-background-color: badge background color\n * @prop --badge-text-color: badge text color\n */\n\n:host([hidden]) {\n display: none;\n}\n\n:host(limel-badge) {\n --limel-min-badge-size: 1rem;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-height: var(--limel-min-badge-size);\n min-width: var(--limel-min-badge-size);\n}\n\nspan {\n cursor: default;\n box-sizing: border-box;\n\n @include mixins.truncate-text;\n text-align: center;\n font-size: functions.pxToRem(11);\n line-height: var(--limel-min-badge-size);\n\n color: var(--badge-text-color, rgb(var(--contrast-1200)));\n\n border-radius: var(--limel-min-badge-size);\n max-height: var(--limel-min-badge-size);\n min-width: 0.5rem;\n min-height: 0.5rem;\n\n background-color: var(--badge-background-color, rgb(var(--contrast-500)));\n\n &:not(:empty) {\n min-width: var(\n --limel-min-badge-size\n ); // ensures that a badge with only one character rendered as perfect circle\n max-width: 2.75rem;\n padding: 0 functions.pxToRem(4.5);\n }\n}\n\n:host(.has-large-label) {\n span {\n cursor: help;\n }\n}\n","import { Component, Prop, h, Host } from '@stencil/core';\nimport { abbreviate } from './format';\n\n/**\n * The Badge component can be used to display a notification badge,\n * optionally with a number or a text label.\n *\n * @exampleComponent limel-example-badge\n * @exampleComponent limel-example-badge-number\n * @exampleComponent limel-example-badge-string\n */\n@Component({\n tag: 'limel-badge',\n styleUrl: 'badge.scss',\n shadow: true,\n})\nexport class Badge {\n /**\n * Label to display in the badge.\n * Numeric labels larger than 999 will be rounded and abbreviated.\n * String labels get truncated if their length is longer than\n * six characters.\n */\n @Prop({ reflect: true })\n public label?: number | string;\n\n public render() {\n return (\n <Host\n title={this.labelIsLarge() ? this.label : ''}\n class={{\n 'has-large-label': this.labelIsLarge(),\n }}\n >\n <span>{this.renderLabel()}</span>\n </Host>\n );\n }\n\n private renderLabel() {\n if (typeof this.label === 'number') {\n return abbreviate(this.label);\n }\n\n return this.label;\n }\n\n private labelIsLarge() {\n const largeNumericLabel = 999;\n const largeStringLabel = 6;\n if (\n (typeof this.label === 'number' &&\n this.label > largeNumericLabel) ||\n (typeof this.label === 'string' &&\n this.label.length > largeStringLabel)\n ) {\n return true;\n }\n }\n}\n","export function getOwnerElement(\n id: string,\n startingPoint: Node,\n): HTMLElement | undefined {\n let element: Node = startingPoint;\n\n do {\n element = element.parentNode;\n } while (\n element &&\n element.nodeType !== Node.DOCUMENT_FRAGMENT_NODE &&\n element.nodeType !== Node.DOCUMENT_NODE\n );\n\n return (element as ShadowRoot)?.getElementById(id);\n}\n","const DEFAULT_DELAY_FOR_SHOWING = 500;\n\nexport class TooltipTimer {\n private timerHandle: number | null = null;\n private showCallback: Function;\n private hideCallback: Function;\n private delayForShowing: number;\n\n constructor(\n showCallback: Function,\n hideCallback: Function,\n delayForShowing: number = DEFAULT_DELAY_FOR_SHOWING,\n ) {\n this.showCallback = showCallback;\n this.hideCallback = hideCallback;\n this.delayForShowing = delayForShowing;\n }\n\n showAfterDelay(): void {\n if (!this.timerHandle) {\n this.timerHandle = setTimeout(\n this.showCallback,\n this.delayForShowing,\n );\n }\n }\n\n hide(): void {\n clearTimeout(this.timerHandle);\n this.timerHandle = null;\n this.hideCallback();\n }\n}\n","/**\n * @prop --tooltip-z-index: z-index of the tooltip.\n */\n\n:host(limel-tooltip) {\n // Absolutely positioning ensures that this invisible element\n // does not occupy visible space in the UI.\n // Without this, `limel-tooltip` could in many cases\n // mess up the layout, where it is used.\n // For example, inside a `grid` or `flex` section,\n // every instance of the tooltip would take some space,\n // creating gaps and empty holes.\n position: absolute;\n pointer-events: none;\n}\n","import { Component, h, Prop, Element, State } from '@stencil/core';\nimport { JSX } from 'react';\nimport { createRandomString } from '../../util/random-string';\nimport { OpenDirection } from '../menu/menu.types';\nimport { getOwnerElement } from './getOwnerElement';\nimport { TooltipTimer } from './tooltipTimer';\n\nconst DEFAULT_MAX_LENGTH = 50;\n\n/**\n * A tooltip can be used to display a descriptive text for any element.\n * The displayed content must be a brief and supplemental string of text,\n * identifying the element or describing its function for the user,\n * helping them better understand unfamiliar objects that aren't described\n * directly in the UI.\n *\n * ## Interaction\n * The tooltip appears after a slight delay, when the element is hovered;\n * and disappears as soon as the cursor leaves the element.\n * Therefore, users cannot interact with the tip, but if the trigger element\n * itself is interactive, it will remain interactible even with a tooltip bound\n * to it.\n *\n * :::note\n * In order to display the tooltip, the tooltip element and its trigger element\n * must be within the same document or document fragment (the same shadowRoot).\n * Often, it's easiest to just place them next to each other like in the example\n * below, but if you need to, you can place them differently.\n *\n * ```html\n * <limel-button icon=\"search\" id=\"tooltip-example\" />\n * <limel-tooltip label=\"Search\" elementId=\"tooltip-example\" />\n * ```\n * :::\n *\n * ## Usage\n * - Keep in mind that tooltips can be distracting, and can be perceived as an interruption.\n * Use them only when they add significant value.\n * - A good tip is concise, helpful, and informative.\n * Don't explain the obvious or simply repeat what is already on the screen.\n * When used correctly, supplemental info of a tooltip helps to [declutter the UI](/#/DesignGuidelines/decluttering.md/).\n * - If the tip is essential to the primary tasks that the user is performing,\n * such as warnings or important notes, include the information directly in the\n * interface instead.\n * - When a component offers a helper text (e.g. [Input field](/#/component/limel-input-field/)),\n * use that, not a tooltip.\n * - Make sure to use the tooltip on an element that users naturally and\n * effortlessly recognize can be hovered.\n *\n * @exampleComponent limel-example-tooltip-basic\n * @exampleComponent limel-example-tooltip-max-character\n * @exampleComponent limel-example-tooltip-composite\n */\n@Component({\n tag: 'limel-tooltip',\n shadow: true,\n styleUrl: 'tooltip.scss',\n})\nexport class Tooltip {\n /**\n * ID of the owner element that the tooltip should describe.\n * Must be a child within the same document fragment as the tooltip element\n * itself.\n */\n @Prop({ reflect: true })\n public elementId!: string;\n\n /**\n * Short descriptive text of the owner element.\n */\n @Prop({ reflect: true })\n public label!: string;\n\n /**\n * Additional helper text for the element.\n * Example usage can be a keyboard shortcut to activate the function of the\n * owner element.\n */\n @Prop({ reflect: true })\n public helperLabel?: string;\n\n /**\n * The maximum amount of characters before rendering 'label' and\n * 'helperLabel' in two rows.\n */\n @Prop({ reflect: true })\n public maxlength?: number = DEFAULT_MAX_LENGTH;\n\n /**\n * Decides the tooltip's location in relation to its trigger.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection = 'top';\n\n @Element()\n private host: HTMLLimelTooltipElement;\n\n @State()\n private open: boolean;\n\n private portalId: string;\n private tooltipId: string;\n private ownerElement: HTMLElement;\n private tooltipTimer: TooltipTimer;\n\n public constructor() {\n this.portalId = createRandomString();\n this.tooltipId = createRandomString();\n this.tooltipTimer = new TooltipTimer(\n () => (this.open = true),\n () => (this.open = false),\n );\n }\n\n public connectedCallback() {\n this.ownerElement = getOwnerElement(this.elementId, this.host);\n this.setOwnerAriaLabel();\n this.addListeners();\n }\n\n public disconnectedCallback() {\n this.removeListeners();\n }\n\n public render(): JSX.Element {\n const tooltipZIndex = getComputedStyle(this.host).getPropertyValue(\n '--tooltip-z-index',\n );\n\n return (\n <div class=\"trigger-anchor\">\n <limel-portal\n openDirection={this.openDirection}\n visible={this.open}\n containerId={this.portalId}\n containerStyle={{\n 'z-index': tooltipZIndex,\n 'pointer-events': 'none',\n }}\n anchor={this.ownerElement}\n >\n <limel-tooltip-content\n label={this.label}\n helperLabel={this.helperLabel}\n maxlength={this.maxlength}\n role=\"tooltip\"\n aria-hidden={!this.open}\n id={this.tooltipId}\n />\n </limel-portal>\n </div>\n );\n }\n\n private setOwnerAriaLabel() {\n this.ownerElement?.setAttribute('aria-describedby', this.tooltipId);\n }\n\n private addListeners() {\n this.ownerElement?.addEventListener('mouseover', this.showTooltip);\n this.ownerElement?.addEventListener('mouseout', this.hideTooltip);\n this.ownerElement?.addEventListener('focus', this.showTooltip);\n this.ownerElement?.addEventListener('blur', this.hideTooltip);\n }\n\n private removeListeners() {\n this.ownerElement?.removeEventListener('mouseover', this.showTooltip);\n this.ownerElement?.removeEventListener('mouseout', this.hideTooltip);\n this.ownerElement?.removeEventListener('focus', this.showTooltip);\n this.ownerElement?.removeEventListener('blur', this.hideTooltip);\n }\n\n private showTooltip = () => {\n this.tooltipTimer.showAfterDelay();\n };\n\n private hideTooltip = () => {\n this.tooltipTimer.hide();\n };\n}\n",":host(limel-tooltip-content) {\n animation: display-tooltip 0.2s ease;\n display: flex;\n\n border-radius: 0.25rem;\n padding: 0.25rem 0.5rem;\n background-color: rgb(var(--contrast-1300));\n box-shadow: var(--shadow-depth-16);\n}\n\ntext {\n font-size: 0.875rem; // 14px\n line-height: 1.25;\n display: flex;\n column-gap: 1rem;\n\n &.has-column-layout {\n display: table-cell;\n width: fit-content;\n max-width: min(var(--tooltip-max-width-of-text), 80vw);\n .label {\n padding-bottom: 0.5rem;\n }\n .helper-label {\n padding-bottom: 0.25rem;\n }\n }\n}\n\n.label {\n color: rgb(var(--contrast-200));\n}\n\n.helper-label {\n color: rgb(var(--contrast-800));\n\n &:empty {\n display: none;\n }\n}\n\n@keyframes display-tooltip {\n 0% {\n opacity: 0;\n transform: translate3d(0, 0, 0) scale(0.94);\n }\n 100% {\n opacity: 1;\n transform: translate3d(0, 0, 0) scale(1);\n }\n}\n","import { Component, h, Prop } from '@stencil/core';\n\n/**\n * This component is used internally by `limel-tooltip`.\n *\n * @private\n */\n@Component({\n tag: 'limel-tooltip-content',\n shadow: true,\n styleUrl: 'tooltip-content.scss',\n})\nexport class TooltipContent {\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n label!: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n helperLabel?: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n maxlength?: number;\n\n public render() {\n let isLabelsTextLong = false;\n if (this.helperLabel && this.maxlength) {\n isLabelsTextLong =\n this.label.length + this.helperLabel.length > this.maxlength;\n }\n\n const props: any = {};\n if (this.maxlength) {\n props.style = {\n '--tooltip-max-width-of-text': `${this.maxlength}` + 'ch',\n };\n }\n\n return [\n <text class={{ 'has-column-layout': isLabelsTextLong }} {...props}>\n <div class=\"label\">{this.label}</div>\n <div class=\"helper-label\">{this.helperLabel}</div>\n </text>,\n ];\n }\n}\n"],"version":3}
1
+ {"file":"limel-badge.limel-tooltip.limel-tooltip-content.entry.js","mappings":";;;;;AAAA,MAAM,QAAQ,GAAG,w7DAAw7D;;MCgB57D,KAAK;;;;;EAUP,MAAM;IACT,QACI,EAAC,IAAI,IACD,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,EAC5C,KAAK,EAAE;QACH,iBAAiB,EAAE,IAAI,CAAC,YAAY,EAAE;OACzC,IAED,gBAAO,IAAI,CAAC,WAAW,EAAE,CAAQ,CAC9B,EACT;GACL;EAEO,WAAW;IACf,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE;MAChC,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACjC;IAED,OAAO,IAAI,CAAC,KAAK,CAAC;GACrB;EAEO,YAAY;IAChB,MAAM,iBAAiB,GAAG,GAAG,CAAC;IAC9B,MAAM,gBAAgB,GAAG,CAAC,CAAC;IAC3B,IACI,CAAC,OA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M,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC;KACpE;IAED,MAAM,KAAK,GAAQ,EAAE,CAAC;IACtB,IAAI,IAAI,CAAC,SAAS,EAAE;MAChB,KAAK,CAAC,KAAK,GAAG;QACV,6BAA6B,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI;OAC5D,CAAC;KACL;IAED,OAAO;MACH,0BAAM,KAAK,EAAE,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,IAAM,KAAK,GAC7D,WAAK,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,KAAK,CAAO,EACrC,WAAK,KAAK,EAAC,cAAc,IAAE,IAAI,CAAC,WAAW,CAAO,CAC/C;KACV,CAAC;GACL;;;;;;","names":[],"sources":["./src/components/badge/badge.scss?tag=limel-badge&encapsulation=shadow","./src/components/badge/badge.tsx","./src/components/tooltip/getOwnerElement.tsx","./src/components/tooltip/tooltipTimer.ts","./src/components/tooltip/tooltip.scss?tag=limel-tooltip&encapsulation=shadow","./src/components/tooltip/tooltip.tsx","./src/components/tooltip/tooltip-content.scss?tag=limel-tooltip-content&encapsulation=shadow","./src/components/tooltip/tooltip-content.tsx"],"sourcesContent":["@use '../../style/functions';\n@use '../../style/internal/lime-theme';\n@use '../../style/mixins';\n\n/**\n * @prop --badge-background-color: badge background color\n * @prop --badge-text-color: badge text color\n */\n\n:host([hidden]) {\n display: none;\n}\n\n:host(limel-badge) {\n --limel-min-badge-size: 1rem;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-height: var(--limel-min-badge-size);\n min-width: var(--limel-min-badge-size);\n}\n\nspan {\n cursor: default;\n box-sizing: border-box;\n\n @include mixins.truncate-text;\n text-align: center;\n font-size: functions.pxToRem(11);\n line-height: var(--limel-min-badge-size);\n\n color: var(--badge-text-color, rgb(var(--contrast-1200)));\n\n border-radius: var(--limel-min-badge-size);\n max-height: var(--limel-min-badge-size);\n min-width: 0.5rem;\n min-height: 0.5rem;\n\n background-color: var(--badge-background-color, rgb(var(--contrast-500)));\n\n &:not(:empty) {\n min-width: var(\n --limel-min-badge-size\n ); // ensures that a badge with only one character rendered as perfect circle\n max-width: 2.75rem;\n padding: 0 functions.pxToRem(4.5);\n }\n}\n\n:host(.has-large-label) {\n span {\n cursor: help;\n }\n}\n","import { Component, Prop, h, Host } from '@stencil/core';\nimport { abbreviate } from './format';\n\n/**\n * The Badge component can be used to display a notification badge,\n * optionally with a number or a text label.\n *\n * @exampleComponent limel-example-badge\n * @exampleComponent limel-example-badge-number\n * @exampleComponent limel-example-badge-string\n */\n@Component({\n tag: 'limel-badge',\n styleUrl: 'badge.scss',\n shadow: true,\n})\nexport class Badge {\n /**\n * Label to display in the badge.\n * Numeric labels larger than 999 will be rounded and abbreviated.\n * String labels get truncated if their length is longer than\n * six characters.\n */\n @Prop({ reflect: true })\n public label?: number | string;\n\n public render() {\n return (\n <Host\n title={this.labelIsLarge() ? this.label : ''}\n class={{\n 'has-large-label': this.labelIsLarge(),\n }}\n >\n <span>{this.renderLabel()}</span>\n </Host>\n );\n }\n\n private renderLabel() {\n if (typeof this.label === 'number') {\n return abbreviate(this.label);\n }\n\n return this.label;\n }\n\n private labelIsLarge() {\n const largeNumericLabel = 999;\n const largeStringLabel = 6;\n if (\n (typeof this.label === 'number' &&\n this.label > largeNumericLabel) ||\n (typeof this.label === 'string' &&\n this.label.length > largeStringLabel)\n ) {\n return true;\n }\n }\n}\n","export function getOwnerElement(\n id: string,\n startingPoint: Node,\n): HTMLElement | undefined {\n let element: Node = startingPoint;\n\n do {\n element = element.parentNode;\n } while (\n element &&\n element.nodeType !== Node.DOCUMENT_FRAGMENT_NODE &&\n element.nodeType !== Node.DOCUMENT_NODE\n );\n\n return (element as ShadowRoot)?.getElementById(id);\n}\n","const DEFAULT_DELAY_FOR_SHOWING = 500;\n\nexport class TooltipTimer {\n private timerHandle: number | null = null;\n private showCallback: Function;\n private hideCallback: Function;\n private delayForShowing: number;\n\n constructor(\n showCallback: Function,\n hideCallback: Function,\n delayForShowing: number = DEFAULT_DELAY_FOR_SHOWING,\n ) {\n this.showCallback = showCallback;\n this.hideCallback = hideCallback;\n this.delayForShowing = delayForShowing;\n }\n\n showAfterDelay(): void {\n if (!this.timerHandle) {\n this.timerHandle = setTimeout(\n this.showCallback,\n this.delayForShowing,\n );\n }\n }\n\n hide(): void {\n clearTimeout(this.timerHandle);\n this.timerHandle = null;\n this.hideCallback();\n }\n}\n","/**\n * @prop --tooltip-z-index: z-index of the tooltip.\n */\n\n:host(limel-tooltip) {\n // Absolutely positioning ensures that this invisible element\n // does not occupy visible space in the UI.\n // Without this, `limel-tooltip` could in many cases\n // mess up the layout, where it is used.\n // For example, inside a `grid` or `flex` section,\n // every instance of the tooltip would take some space,\n // creating gaps and empty holes.\n position: absolute;\n pointer-events: none;\n}\n","import { Component, h, Prop, Element, State } from '@stencil/core';\nimport { JSX } from 'react';\nimport { createRandomString } from '../../util/random-string';\nimport { OpenDirection } from '../menu/menu.types';\nimport { getOwnerElement } from './getOwnerElement';\nimport { TooltipTimer } from './tooltipTimer';\n\nconst DEFAULT_MAX_LENGTH = 50;\n\n/**\n * A tooltip can be used to display a descriptive text for any element.\n * The displayed content must be a brief and supplemental string of text,\n * identifying the element or describing its function for the user,\n * helping them better understand unfamiliar objects that aren't described\n * directly in the UI.\n *\n * ## Interaction\n * The tooltip appears after a slight delay, when the element is hovered;\n * and disappears as soon as the cursor leaves the element.\n * Therefore, users cannot interact with the tip, but if the trigger element\n * itself is interactive, it will remain interactible even with a tooltip bound\n * to it.\n *\n * :::note\n * In order to display the tooltip, the tooltip element and its trigger element\n * must be within the same document or document fragment (the same shadowRoot).\n * Often, it's easiest to just place them next to each other like in the example\n * below, but if you need to, you can place them differently.\n *\n * ```html\n * <limel-button icon=\"search\" id=\"tooltip-example\" />\n * <limel-tooltip label=\"Search\" elementId=\"tooltip-example\" />\n * ```\n * :::\n *\n * ## Usage\n * - Keep in mind that tooltips can be distracting, and can be perceived as an interruption.\n * Use them only when they add significant value.\n * - A good tip is concise, helpful, and informative.\n * Don't explain the obvious or simply repeat what is already on the screen.\n * When used correctly, supplemental info of a tooltip helps to [declutter the UI](/#/DesignGuidelines/decluttering.md/).\n * - If the tip is essential to the primary tasks that the user is performing,\n * such as warnings or important notes, include the information directly in the\n * interface instead.\n * - When a component offers a helper text (e.g. [Input field](/#/component/limel-input-field/)),\n * use that, not a tooltip.\n * - Make sure to use the tooltip on an element that users naturally and\n * effortlessly recognize can be hovered.\n *\n * @exampleComponent limel-example-tooltip-basic\n * @exampleComponent limel-example-tooltip-max-character\n * @exampleComponent limel-example-tooltip-composite\n */\n@Component({\n tag: 'limel-tooltip',\n shadow: true,\n styleUrl: 'tooltip.scss',\n})\nexport class Tooltip {\n /**\n * ID of the owner element that the tooltip should describe.\n * Must be a child within the same document fragment as the tooltip element\n * itself.\n */\n @Prop({ reflect: true })\n public elementId!: string;\n\n /**\n * Short descriptive text of the owner element.\n */\n @Prop({ reflect: true })\n public label!: string;\n\n /**\n * Additional helper text for the element.\n * Example usage can be a keyboard shortcut to activate the function of the\n * owner element.\n */\n @Prop({ reflect: true })\n public helperLabel?: string;\n\n /**\n * The maximum amount of characters before rendering 'label' and\n * 'helperLabel' in two rows.\n */\n @Prop({ reflect: true })\n public maxlength?: number = DEFAULT_MAX_LENGTH;\n\n /**\n * Decides the tooltip's location in relation to its trigger.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection = 'top';\n\n @Element()\n private host: HTMLLimelTooltipElement;\n\n @State()\n private open: boolean;\n\n private portalId: string;\n private tooltipId: string;\n private ownerElement: HTMLElement;\n private tooltipTimer: TooltipTimer;\n\n public constructor() {\n this.portalId = createRandomString();\n this.tooltipId = createRandomString();\n this.tooltipTimer = new TooltipTimer(\n () => (this.open = true),\n () => (this.open = false),\n );\n }\n\n public connectedCallback() {\n this.ownerElement = getOwnerElement(this.elementId, this.host);\n this.setOwnerAriaLabel();\n this.addListeners();\n }\n\n public disconnectedCallback() {\n this.removeListeners();\n }\n\n public render(): JSX.Element {\n const tooltipZIndex = getComputedStyle(this.host).getPropertyValue(\n '--tooltip-z-index',\n );\n\n return (\n <div class=\"trigger-anchor\">\n <limel-portal\n openDirection={this.openDirection}\n visible={this.open}\n containerId={this.portalId}\n containerStyle={{\n 'z-index': tooltipZIndex,\n 'pointer-events': 'none',\n }}\n anchor={this.ownerElement}\n >\n <limel-tooltip-content\n label={this.label}\n helperLabel={this.helperLabel}\n maxlength={this.maxlength}\n role=\"tooltip\"\n aria-hidden={!this.open}\n id={this.tooltipId}\n />\n </limel-portal>\n </div>\n );\n }\n\n private setOwnerAriaLabel() {\n this.ownerElement?.setAttribute('aria-describedby', this.tooltipId);\n }\n\n private addListeners() {\n this.ownerElement?.addEventListener('mouseover', this.showTooltip);\n this.ownerElement?.addEventListener('mouseout', this.hideTooltip);\n this.ownerElement?.addEventListener('focus', this.showTooltip);\n this.ownerElement?.addEventListener('blur', this.hideTooltip);\n }\n\n private removeListeners() {\n this.ownerElement?.removeEventListener('mouseover', this.showTooltip);\n this.ownerElement?.removeEventListener('mouseout', this.hideTooltip);\n this.ownerElement?.removeEventListener('focus', this.showTooltip);\n this.ownerElement?.removeEventListener('blur', this.hideTooltip);\n }\n\n private showTooltip = () => {\n this.tooltipTimer.showAfterDelay();\n };\n\n private hideTooltip = () => {\n this.tooltipTimer.hide();\n };\n}\n",":host(limel-tooltip-content) {\n display: flex;\n\n border-radius: 0.25rem;\n padding: 0.25rem 0.5rem;\n background-color: rgb(var(--contrast-1300));\n box-shadow: var(--shadow-depth-16);\n}\n\ntext {\n font-size: 0.875rem; // 14px\n line-height: 1.25;\n display: flex;\n column-gap: 1rem;\n\n &.has-column-layout {\n display: table-cell;\n width: fit-content;\n max-width: min(var(--tooltip-max-width-of-text), 80vw);\n .label {\n padding-bottom: 0.5rem;\n }\n .helper-label {\n padding-bottom: 0.25rem;\n }\n }\n}\n\n.label {\n color: rgb(var(--contrast-200));\n}\n\n.helper-label {\n color: rgb(var(--contrast-800));\n\n &:empty {\n display: none;\n }\n}\n","import { Component, h, Prop } from '@stencil/core';\n\n/**\n * This component is used internally by `limel-tooltip`.\n *\n * @private\n */\n@Component({\n tag: 'limel-tooltip-content',\n shadow: true,\n styleUrl: 'tooltip-content.scss',\n})\nexport class TooltipContent {\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n label!: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n helperLabel?: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n maxlength?: number;\n\n public render() {\n let isLabelsTextLong = false;\n if (this.helperLabel && this.maxlength) {\n isLabelsTextLong =\n this.label.length + this.helperLabel.length > this.maxlength;\n }\n\n const props: any = {};\n if (this.maxlength) {\n props.style = {\n '--tooltip-max-width-of-text': `${this.maxlength}` + 'ch',\n };\n }\n\n return [\n <text class={{ 'has-column-layout': isLabelsTextLong }} {...props}>\n <div class=\"label\">{this.label}</div>\n <div class=\"helper-label\">{this.helperLabel}</div>\n </text>,\n ];\n }\n}\n"],"version":3}
@@ -481,7 +481,7 @@ const List = class {
481
481
  };
482
482
  List.style = listCss;
483
483
 
484
- const menuSurfaceCss = ":host(limel-menu-surface){display:block;max-height:inherit}.mdc-menu-surface{display:none;position:absolute;box-sizing:border-box;max-width:calc(100vw - 32px);max-width:var(--mdc-menu-max-width, calc(100vw - 32px));max-height:calc(100vh - 32px);max-height:var(--mdc-menu-max-height, calc(100vh - 32px));margin:0;padding:0;transform:scale(1);transform-origin:top left;opacity:0;overflow:auto;will-change:transform, opacity;z-index:8;transition:opacity 0.03s linear, transform 0.12s cubic-bezier(0, 0, 0.2, 1), height 250ms cubic-bezier(0, 0, 0.2, 1);box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);background-color:#fff;background-color:var(--mdc-theme-surface, #fff);color:#000;color:var(--mdc-theme-on-surface, #000);border-radius:4px;border-radius:var(--mdc-shape-medium, 4px);transform-origin-left:top left;transform-origin-right:top right}.mdc-menu-surface:focus{outline:none}.mdc-menu-surface--animating-open{display:inline-block;transform:scale(0.8);opacity:0}.mdc-menu-surface--open{display:inline-block;transform:scale(1);opacity:1}.mdc-menu-surface--animating-closed{display:inline-block;opacity:0;transition:opacity 0.075s linear}[dir=rtl] .mdc-menu-surface,.mdc-menu-surface[dir=rtl]{transform-origin-left:top right;transform-origin-right:top left;}.mdc-menu-surface--anchor{position:relative;overflow:visible}.mdc-menu-surface--fixed{position:fixed}.mdc-menu-surface--fullwidth{width:100%}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-elevation-overlay{position:absolute;border-radius:inherit;pointer-events:none;opacity:0;opacity:var(--mdc-elevation-overlay-opacity, 0);transition:opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:#fff;background-color:var(--mdc-elevation-overlay-color, #fff)}.mdc-menu{min-width:112px;min-width:var(--mdc-menu-min-width, 112px)}.mdc-menu .mdc-deprecated-list-item__meta{color:rgba(0, 0, 0, 0.87)}.mdc-menu .mdc-deprecated-list-item__graphic{color:rgba(0, 0, 0, 0.87)}.mdc-menu .mdc-deprecated-list{color:rgba(0, 0, 0, 0.87)}.mdc-menu .mdc-deprecated-list,.mdc-menu .mdc-list{position:relative}.mdc-menu .mdc-deprecated-list .mdc-elevation-overlay,.mdc-menu .mdc-list .mdc-elevation-overlay{width:100%;height:100%;top:0;left:0}.mdc-menu .mdc-deprecated-list-divider{margin:8px 0}.mdc-menu .mdc-deprecated-list-item{user-select:none}.mdc-menu .mdc-deprecated-list-item--disabled{cursor:auto}.mdc-menu a.mdc-deprecated-list-item .mdc-deprecated-list-item__text,.mdc-menu a.mdc-deprecated-list-item .mdc-deprecated-list-item__graphic{pointer-events:none}.mdc-menu__selection-group{padding:0;fill:currentColor}.mdc-menu__selection-group .mdc-deprecated-list-item{padding-left:56px;padding-right:16px}[dir=rtl] .mdc-menu__selection-group .mdc-deprecated-list-item,.mdc-menu__selection-group .mdc-deprecated-list-item[dir=rtl]{padding-left:16px;padding-right:56px;}.mdc-menu__selection-group .mdc-menu__selection-group-icon{left:16px;right:initial;display:none;position:absolute;top:50%;transform:translateY(-50%)}[dir=rtl] .mdc-menu__selection-group .mdc-menu__selection-group-icon,.mdc-menu__selection-group .mdc-menu__selection-group-icon[dir=rtl]{left:initial;right:16px;}.mdc-menu-item--selected .mdc-menu__selection-group-icon{display:inline}.mdc-menu-surface{display:var(--limel-menu-surface-display, block);flex-direction:var(--limel-menu-surface-flex-direction, row);max-height:inherit;position:relative;--mdc-menu-max-width:var(\n --menu-surface-width,\n min(calc(100vw - 2rem), 20rem)\n );background-color:var(--lime-elevated-surface-background-color)}:host(limel-menu-surface.has-grid-layout) .mdc-menu-surface{width:var(--menu-surface-width, min(100vw - 2rem, 40rem));max-width:unset}";
484
+ const menuSurfaceCss = ":host(limel-menu-surface){display:block;max-height:inherit}.mdc-menu-surface{display:none;position:absolute;box-sizing:border-box;max-width:calc(100vw - 32px);max-width:var(--mdc-menu-max-width, calc(100vw - 32px));max-height:calc(100vh - 32px);max-height:var(--mdc-menu-max-height, calc(100vh - 32px));margin:0;padding:0;transform:scale(1);transform-origin:top left;opacity:0;overflow:auto;will-change:transform, opacity;z-index:8;transition:opacity 0.03s linear, transform 0.12s cubic-bezier(0, 0, 0.2, 1), height 250ms cubic-bezier(0, 0, 0.2, 1);box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);background-color:#fff;background-color:var(--mdc-theme-surface, #fff);color:#000;color:var(--mdc-theme-on-surface, #000);border-radius:4px;border-radius:var(--mdc-shape-medium, 4px);transform-origin-left:top left;transform-origin-right:top right}.mdc-menu-surface:focus{outline:none}.mdc-menu-surface--animating-open{display:inline-block;transform:scale(0.8);opacity:0}.mdc-menu-surface--open{display:inline-block;transform:scale(1);opacity:1}.mdc-menu-surface--animating-closed{display:inline-block;opacity:0;transition:opacity 0.075s linear}[dir=rtl] .mdc-menu-surface,.mdc-menu-surface[dir=rtl]{transform-origin-left:top right;transform-origin-right:top left;}.mdc-menu-surface--anchor{position:relative;overflow:visible}.mdc-menu-surface--fixed{position:fixed}.mdc-menu-surface--fullwidth{width:100%}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-elevation-overlay{position:absolute;border-radius:inherit;pointer-events:none;opacity:0;opacity:var(--mdc-elevation-overlay-opacity, 0);transition:opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:#fff;background-color:var(--mdc-elevation-overlay-color, #fff)}.mdc-menu{min-width:112px;min-width:var(--mdc-menu-min-width, 112px)}.mdc-menu .mdc-deprecated-list-item__meta{color:rgba(0, 0, 0, 0.87)}.mdc-menu .mdc-deprecated-list-item__graphic{color:rgba(0, 0, 0, 0.87)}.mdc-menu .mdc-deprecated-list{color:rgba(0, 0, 0, 0.87)}.mdc-menu .mdc-deprecated-list,.mdc-menu .mdc-list{position:relative}.mdc-menu .mdc-deprecated-list .mdc-elevation-overlay,.mdc-menu .mdc-list .mdc-elevation-overlay{width:100%;height:100%;top:0;left:0}.mdc-menu .mdc-deprecated-list-divider{margin:8px 0}.mdc-menu .mdc-deprecated-list-item{user-select:none}.mdc-menu .mdc-deprecated-list-item--disabled{cursor:auto}.mdc-menu a.mdc-deprecated-list-item .mdc-deprecated-list-item__text,.mdc-menu a.mdc-deprecated-list-item .mdc-deprecated-list-item__graphic{pointer-events:none}.mdc-menu__selection-group{padding:0;fill:currentColor}.mdc-menu__selection-group .mdc-deprecated-list-item{padding-left:56px;padding-right:16px}[dir=rtl] .mdc-menu__selection-group .mdc-deprecated-list-item,.mdc-menu__selection-group .mdc-deprecated-list-item[dir=rtl]{padding-left:16px;padding-right:56px;}.mdc-menu__selection-group .mdc-menu__selection-group-icon{left:16px;right:initial;display:none;position:absolute;top:50%;transform:translateY(-50%)}[dir=rtl] .mdc-menu__selection-group .mdc-menu__selection-group-icon,.mdc-menu__selection-group .mdc-menu__selection-group-icon[dir=rtl]{left:initial;right:16px;}.mdc-menu-item--selected .mdc-menu__selection-group-icon{display:inline}.mdc-menu-surface{opacity:1;display:var(--limel-menu-surface-display, block);flex-direction:var(--limel-menu-surface-flex-direction, row);max-height:inherit;position:relative;--mdc-menu-max-width:var(\n --menu-surface-width,\n min(calc(100vw - 2rem), 20rem)\n );background-color:var(--lime-elevated-surface-background-color)}:host(limel-menu-surface.has-grid-layout) .mdc-menu-surface{width:var(--menu-surface-width, min(100vw - 2rem, 40rem));max-width:unset}";
485
485
 
486
486
  const MenuSurface = class {
487
487
  constructor(hostRef) {