@limetech/lime-elements 37.81.5 → 38.1.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 +26 -0
- package/dist/cjs/keycodes-8e70d9e0.js +25 -0
- package/dist/cjs/keycodes-8e70d9e0.js.map +1 -0
- package/dist/cjs/limel-action-bar_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-breadcrumbs_7.cjs.entry.js +16 -21
- package/dist/cjs/limel-breadcrumbs_7.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-chart.cjs.entry.js +33 -2
- package/dist/cjs/limel-chart.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-chip_2.cjs.entry.js +10 -11
- package/dist/cjs/limel-chip_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-picker.cjs.entry.js +6 -11
- package/dist/cjs/limel-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-popover_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-select.cjs.entry.js +3 -3
- package/dist/cjs/limel-select.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/limel-snackbar.cjs.entry.js.map +1 -1
- package/dist/collection/components/chart/chart.css +16 -36
- package/dist/collection/components/chart/chart.js +55 -1
- package/dist/collection/components/chart/chart.js.map +1 -1
- package/dist/collection/components/chart/chart.types.js.map +1 -1
- package/dist/collection/components/chip/chip.js +2 -3
- package/dist/collection/components/chip/chip.js.map +1 -1
- package/dist/collection/components/chip-set/chip-set-input-helpers.js +9 -9
- package/dist/collection/components/chip-set/chip-set-input-helpers.js.map +1 -1
- package/dist/collection/components/input-field/input-field.js +8 -13
- package/dist/collection/components/input-field/input-field.js.map +1 -1
- package/dist/collection/components/menu/menu.js +7 -7
- package/dist/collection/components/menu/menu.js.map +1 -1
- package/dist/collection/components/menu-surface/menu-surface.js +3 -3
- package/dist/collection/components/menu-surface/menu-surface.js.map +1 -1
- package/dist/collection/components/picker/picker.js +6 -11
- package/dist/collection/components/picker/picker.js.map +1 -1
- package/dist/collection/components/select/select.js +3 -3
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/snackbar/snackbar.css +1 -1
- package/dist/collection/components/snackbar/snackbar.js.map +1 -1
- package/dist/collection/util/keycodes.js +0 -10
- package/dist/collection/util/keycodes.js.map +1 -1
- package/dist/esm/keycodes-e2e44b7e.js +14 -0
- package/dist/esm/keycodes-e2e44b7e.js.map +1 -0
- package/dist/esm/limel-action-bar_2.entry.js +1 -1
- package/dist/esm/limel-breadcrumbs_7.entry.js +16 -21
- package/dist/esm/limel-breadcrumbs_7.entry.js.map +1 -1
- package/dist/esm/limel-chart.entry.js +34 -3
- package/dist/esm/limel-chart.entry.js.map +1 -1
- package/dist/esm/limel-chip_2.entry.js +10 -11
- package/dist/esm/limel-chip_2.entry.js.map +1 -1
- package/dist/esm/limel-picker.entry.js +6 -11
- package/dist/esm/limel-picker.entry.js.map +1 -1
- package/dist/esm/limel-popover_2.entry.js +1 -1
- package/dist/esm/limel-select.entry.js +3 -3
- package/dist/esm/limel-select.entry.js.map +1 -1
- package/dist/esm/limel-snackbar.entry.js +1 -1
- package/dist/esm/limel-snackbar.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-0468e34c.entry.js +2 -0
- package/dist/lime-elements/p-0468e34c.entry.js.map +1 -0
- package/dist/lime-elements/p-0f735cdc.entry.js +266 -0
- package/dist/lime-elements/p-0f735cdc.entry.js.map +1 -0
- package/dist/lime-elements/{p-1d6e22e3.entry.js → p-25fcb5b7.entry.js} +5 -5
- package/dist/lime-elements/p-25fcb5b7.entry.js.map +1 -0
- package/dist/lime-elements/{p-7f0b768e.entry.js → p-54ac08f5.entry.js} +2 -2
- package/dist/lime-elements/p-54b4a06b.entry.js +2 -0
- package/dist/lime-elements/p-54b4a06b.entry.js.map +1 -0
- package/dist/lime-elements/p-aa25f475.js +2 -0
- package/dist/lime-elements/p-aa25f475.js.map +1 -0
- package/dist/lime-elements/p-c5969548.entry.js +2 -0
- package/dist/lime-elements/p-c5969548.entry.js.map +1 -0
- package/dist/lime-elements/p-ddc35d44.entry.js +2 -0
- package/dist/lime-elements/p-ddc35d44.entry.js.map +1 -0
- package/dist/lime-elements/{p-e446b6c9.entry.js → p-ffe954d4.entry.js} +2 -2
- package/dist/types/components/chart/chart.d.ts +9 -0
- package/dist/types/components/chart/chart.types.d.ts +6 -0
- package/dist/types/components/snackbar/snackbar.d.ts +6 -6
- package/dist/types/components.d.ts +12 -0
- package/dist/types/util/keycodes.d.ts +0 -10
- package/package.json +1 -1
- package/dist/cjs/keycodes-3949f425.js +0 -45
- package/dist/cjs/keycodes-3949f425.js.map +0 -1
- package/dist/esm/keycodes-bf11a644.js +0 -24
- package/dist/esm/keycodes-bf11a644.js.map +0 -1
- package/dist/lime-elements/p-0eef63d5.entry.js +0 -2
- package/dist/lime-elements/p-0eef63d5.entry.js.map +0 -1
- package/dist/lime-elements/p-1d6e22e3.entry.js.map +0 -1
- package/dist/lime-elements/p-37dd03bf.entry.js +0 -2
- package/dist/lime-elements/p-37dd03bf.entry.js.map +0 -1
- package/dist/lime-elements/p-6fcb6a4a.entry.js +0 -266
- package/dist/lime-elements/p-6fcb6a4a.entry.js.map +0 -1
- package/dist/lime-elements/p-70adc8a9.entry.js +0 -2
- package/dist/lime-elements/p-70adc8a9.entry.js.map +0 -1
- package/dist/lime-elements/p-e03dfe70.js +0 -2
- package/dist/lime-elements/p-e03dfe70.js.map +0 -1
- package/dist/lime-elements/p-e3f90432.entry.js +0 -2
- package/dist/lime-elements/p-e3f90432.entry.js.map +0 -1
- /package/dist/lime-elements/{p-7f0b768e.entry.js.map → p-54ac08f5.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-e446b6c9.entry.js.map → p-ffe954d4.entry.js.map} +0 -0
|
@@ -64,19 +64,19 @@ export declare class Snackbar {
|
|
|
64
64
|
* Defines the language for translations.
|
|
65
65
|
*/
|
|
66
66
|
language: Languages;
|
|
67
|
-
private host;
|
|
67
|
+
private readonly host;
|
|
68
68
|
/**
|
|
69
69
|
* Emitted when the action button is pressed
|
|
70
70
|
*/
|
|
71
|
-
private action;
|
|
71
|
+
private readonly action;
|
|
72
72
|
/**
|
|
73
73
|
* Emitted when the snackbar hides itself
|
|
74
74
|
*/
|
|
75
|
-
private hide;
|
|
75
|
+
private readonly hide;
|
|
76
76
|
private offset;
|
|
77
77
|
private isOpen;
|
|
78
78
|
private closing;
|
|
79
|
-
private snackbarId;
|
|
79
|
+
private readonly snackbarId;
|
|
80
80
|
private timeoutId?;
|
|
81
81
|
constructor();
|
|
82
82
|
componentDidLoad(): void;
|
|
@@ -88,10 +88,10 @@ export declare class Snackbar {
|
|
|
88
88
|
*/
|
|
89
89
|
show(): Promise<void>;
|
|
90
90
|
handleOpen: () => void;
|
|
91
|
-
private handleClose;
|
|
91
|
+
private readonly handleClose;
|
|
92
92
|
render(): any;
|
|
93
93
|
private setAriaRoles;
|
|
94
|
-
private handleClickAction;
|
|
94
|
+
private readonly handleClickAction;
|
|
95
95
|
private renderActions;
|
|
96
96
|
private renderActionButton;
|
|
97
97
|
private renderDismissButton;
|
|
@@ -431,6 +431,7 @@ export namespace Components {
|
|
|
431
431
|
* @exampleComponent limel-example-chart-multi-axis-with-negative-start-values
|
|
432
432
|
* @exampleComponent limel-example-chart-multi-axis-area-with-negative-start-values
|
|
433
433
|
* @exampleComponent limel-example-chart-axis-increment
|
|
434
|
+
* @exampleComponent limel-example-chart-clickable-items
|
|
434
435
|
* @exampleComponent limel-example-chart-accessibility
|
|
435
436
|
* @exampleComponent limel-example-chart-styling
|
|
436
437
|
* @exampleComponent limel-example-chart-creative-styling
|
|
@@ -2907,6 +2908,10 @@ export interface LimelCardCustomEvent<T> extends CustomEvent<T> {
|
|
|
2907
2908
|
detail: T;
|
|
2908
2909
|
target: HTMLLimelCardElement;
|
|
2909
2910
|
}
|
|
2911
|
+
export interface LimelChartCustomEvent<T> extends CustomEvent<T> {
|
|
2912
|
+
detail: T;
|
|
2913
|
+
target: HTMLLimelChartElement;
|
|
2914
|
+
}
|
|
2910
2915
|
export interface LimelCheckboxCustomEvent<T> extends CustomEvent<T> {
|
|
2911
2916
|
detail: T;
|
|
2912
2917
|
target: HTMLLimelCheckboxElement;
|
|
@@ -3293,6 +3298,7 @@ declare global {
|
|
|
3293
3298
|
* @exampleComponent limel-example-chart-multi-axis-with-negative-start-values
|
|
3294
3299
|
* @exampleComponent limel-example-chart-multi-axis-area-with-negative-start-values
|
|
3295
3300
|
* @exampleComponent limel-example-chart-axis-increment
|
|
3301
|
+
* @exampleComponent limel-example-chart-clickable-items
|
|
3296
3302
|
* @exampleComponent limel-example-chart-accessibility
|
|
3297
3303
|
* @exampleComponent limel-example-chart-styling
|
|
3298
3304
|
* @exampleComponent limel-example-chart-creative-styling
|
|
@@ -4926,6 +4932,7 @@ declare namespace LocalJSX {
|
|
|
4926
4932
|
* @exampleComponent limel-example-chart-multi-axis-with-negative-start-values
|
|
4927
4933
|
* @exampleComponent limel-example-chart-multi-axis-area-with-negative-start-values
|
|
4928
4934
|
* @exampleComponent limel-example-chart-axis-increment
|
|
4935
|
+
* @exampleComponent limel-example-chart-clickable-items
|
|
4929
4936
|
* @exampleComponent limel-example-chart-accessibility
|
|
4930
4937
|
* @exampleComponent limel-example-chart-styling
|
|
4931
4938
|
* @exampleComponent limel-example-chart-creative-styling
|
|
@@ -4960,6 +4967,10 @@ declare namespace LocalJSX {
|
|
|
4960
4967
|
* Specifies the range that items' values could be in. This is used in calculation of the size of the items in the chart. When not provided, the sum of all values in the items will be considered as the range.
|
|
4961
4968
|
*/
|
|
4962
4969
|
"maxValue"?: number;
|
|
4970
|
+
/**
|
|
4971
|
+
* Fired when a chart item with `clickable` set to `true` is clicked
|
|
4972
|
+
*/
|
|
4973
|
+
"onInteract"?: (event: LimelChartCustomEvent<ChartItem>) => void;
|
|
4963
4974
|
/**
|
|
4964
4975
|
* Defines whether the chart is intended to be displayed wide or tall. Does not have any effect on chart types which generate circular forms.
|
|
4965
4976
|
*/
|
|
@@ -7905,6 +7916,7 @@ declare module "@stencil/core" {
|
|
|
7905
7916
|
* @exampleComponent limel-example-chart-multi-axis-with-negative-start-values
|
|
7906
7917
|
* @exampleComponent limel-example-chart-multi-axis-area-with-negative-start-values
|
|
7907
7918
|
* @exampleComponent limel-example-chart-axis-increment
|
|
7919
|
+
* @exampleComponent limel-example-chart-clickable-items
|
|
7908
7920
|
* @exampleComponent limel-example-chart-accessibility
|
|
7909
7921
|
* @exampleComponent limel-example-chart-styling
|
|
7910
7922
|
* @exampleComponent limel-example-chart-creative-styling
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
export declare const TAB_KEY_CODE = 9;
|
|
2
|
-
export declare const ENTER_KEY_CODE = 13;
|
|
3
|
-
export declare const ESCAPE_KEY_CODE = 27;
|
|
4
|
-
export declare const SPACE_KEY_CODE = 32;
|
|
5
|
-
export declare const BACKSPACE_KEY_CODE = 8;
|
|
6
|
-
export declare const DELETE_KEY_CODE = 46;
|
|
7
|
-
export declare const ARROW_UP_KEY_CODE = 38;
|
|
8
|
-
export declare const ARROW_DOWN_KEY_CODE = 40;
|
|
9
|
-
export declare const ARROW_LEFT_KEY_CODE = 37;
|
|
10
|
-
export declare const ARROW_RIGHT_KEY_CODE = 39;
|
|
11
1
|
export declare const TAB = "Tab";
|
|
12
2
|
export declare const ENTER = "Enter";
|
|
13
3
|
export declare const ESCAPE = "Escape";
|
package/package.json
CHANGED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const TAB_KEY_CODE = 9;
|
|
4
|
-
const ENTER_KEY_CODE = 13;
|
|
5
|
-
const ESCAPE_KEY_CODE = 27;
|
|
6
|
-
const SPACE_KEY_CODE = 32;
|
|
7
|
-
const BACKSPACE_KEY_CODE = 8;
|
|
8
|
-
const DELETE_KEY_CODE = 46;
|
|
9
|
-
const ARROW_UP_KEY_CODE = 38;
|
|
10
|
-
const ARROW_DOWN_KEY_CODE = 40;
|
|
11
|
-
const ARROW_LEFT_KEY_CODE = 37;
|
|
12
|
-
const ARROW_RIGHT_KEY_CODE = 39;
|
|
13
|
-
const TAB = 'Tab';
|
|
14
|
-
const ENTER = 'Enter';
|
|
15
|
-
const ESCAPE = 'Escape';
|
|
16
|
-
const SPACE = 'Space';
|
|
17
|
-
const BACKSPACE = 'Backspace';
|
|
18
|
-
const DELETE = 'Delete';
|
|
19
|
-
const ARROW_UP = 'ArrowUp';
|
|
20
|
-
const ARROW_DOWN = 'ArrowDown';
|
|
21
|
-
const ARROW_LEFT = 'ArrowLeft';
|
|
22
|
-
const ARROW_RIGHT = 'ArrowRight';
|
|
23
|
-
|
|
24
|
-
exports.ARROW_DOWN = ARROW_DOWN;
|
|
25
|
-
exports.ARROW_DOWN_KEY_CODE = ARROW_DOWN_KEY_CODE;
|
|
26
|
-
exports.ARROW_LEFT = ARROW_LEFT;
|
|
27
|
-
exports.ARROW_LEFT_KEY_CODE = ARROW_LEFT_KEY_CODE;
|
|
28
|
-
exports.ARROW_RIGHT = ARROW_RIGHT;
|
|
29
|
-
exports.ARROW_RIGHT_KEY_CODE = ARROW_RIGHT_KEY_CODE;
|
|
30
|
-
exports.ARROW_UP = ARROW_UP;
|
|
31
|
-
exports.ARROW_UP_KEY_CODE = ARROW_UP_KEY_CODE;
|
|
32
|
-
exports.BACKSPACE = BACKSPACE;
|
|
33
|
-
exports.BACKSPACE_KEY_CODE = BACKSPACE_KEY_CODE;
|
|
34
|
-
exports.DELETE = DELETE;
|
|
35
|
-
exports.DELETE_KEY_CODE = DELETE_KEY_CODE;
|
|
36
|
-
exports.ENTER = ENTER;
|
|
37
|
-
exports.ENTER_KEY_CODE = ENTER_KEY_CODE;
|
|
38
|
-
exports.ESCAPE = ESCAPE;
|
|
39
|
-
exports.ESCAPE_KEY_CODE = ESCAPE_KEY_CODE;
|
|
40
|
-
exports.SPACE = SPACE;
|
|
41
|
-
exports.SPACE_KEY_CODE = SPACE_KEY_CODE;
|
|
42
|
-
exports.TAB = TAB;
|
|
43
|
-
exports.TAB_KEY_CODE = TAB_KEY_CODE;
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=keycodes-3949f425.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"keycodes-3949f425.js","mappings":";;MAAa,YAAY,GAAG,EAAE;MACjB,cAAc,GAAG,GAAG;MACpB,eAAe,GAAG,GAAG;MACrB,cAAc,GAAG,GAAG;MACpB,kBAAkB,GAAG,EAAE;MACvB,eAAe,GAAG,GAAG;MACrB,iBAAiB,GAAG,GAAG;MACvB,mBAAmB,GAAG,GAAG;MACzB,mBAAmB,GAAG,GAAG;MACzB,oBAAoB,GAAG,GAAG;MAE1B,GAAG,GAAG,MAAM;MACZ,KAAK,GAAG,QAAQ;MAChB,MAAM,GAAG,SAAS;MAClB,KAAK,GAAG,QAAQ;MAChB,SAAS,GAAG,YAAY;MACxB,MAAM,GAAG,SAAS;MAClB,QAAQ,GAAG,UAAU;MACrB,UAAU,GAAG,YAAY;MACzB,UAAU,GAAG,YAAY;MACzB,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/util/keycodes.ts"],"sourcesContent":["export const TAB_KEY_CODE = 9;\nexport const ENTER_KEY_CODE = 13;\nexport const ESCAPE_KEY_CODE = 27;\nexport const SPACE_KEY_CODE = 32;\nexport const BACKSPACE_KEY_CODE = 8;\nexport const DELETE_KEY_CODE = 46;\nexport const ARROW_UP_KEY_CODE = 38;\nexport const ARROW_DOWN_KEY_CODE = 40;\nexport const ARROW_LEFT_KEY_CODE = 37;\nexport const ARROW_RIGHT_KEY_CODE = 39;\n\nexport const TAB = 'Tab';\nexport const ENTER = 'Enter';\nexport const ESCAPE = 'Escape';\nexport const SPACE = 'Space';\nexport const BACKSPACE = 'Backspace';\nexport const DELETE = 'Delete';\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\n"],"version":3}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const TAB_KEY_CODE = 9;
|
|
2
|
-
const ENTER_KEY_CODE = 13;
|
|
3
|
-
const ESCAPE_KEY_CODE = 27;
|
|
4
|
-
const SPACE_KEY_CODE = 32;
|
|
5
|
-
const BACKSPACE_KEY_CODE = 8;
|
|
6
|
-
const DELETE_KEY_CODE = 46;
|
|
7
|
-
const ARROW_UP_KEY_CODE = 38;
|
|
8
|
-
const ARROW_DOWN_KEY_CODE = 40;
|
|
9
|
-
const ARROW_LEFT_KEY_CODE = 37;
|
|
10
|
-
const ARROW_RIGHT_KEY_CODE = 39;
|
|
11
|
-
const TAB = 'Tab';
|
|
12
|
-
const ENTER = 'Enter';
|
|
13
|
-
const ESCAPE = 'Escape';
|
|
14
|
-
const SPACE = 'Space';
|
|
15
|
-
const BACKSPACE = 'Backspace';
|
|
16
|
-
const DELETE = 'Delete';
|
|
17
|
-
const ARROW_UP = 'ArrowUp';
|
|
18
|
-
const ARROW_DOWN = 'ArrowDown';
|
|
19
|
-
const ARROW_LEFT = 'ArrowLeft';
|
|
20
|
-
const ARROW_RIGHT = 'ArrowRight';
|
|
21
|
-
|
|
22
|
-
export { ARROW_UP as A, BACKSPACE as B, DELETE as D, ESCAPE as E, SPACE as S, TAB as T, ENTER as a, TAB_KEY_CODE as b, ESCAPE_KEY_CODE as c, ENTER_KEY_CODE as d, ARROW_UP_KEY_CODE as e, ARROW_DOWN as f, ARROW_DOWN_KEY_CODE as g, SPACE_KEY_CODE as h, DELETE_KEY_CODE as i, BACKSPACE_KEY_CODE as j, ARROW_LEFT as k, ARROW_LEFT_KEY_CODE as l, ARROW_RIGHT as m, ARROW_RIGHT_KEY_CODE as n };
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=keycodes-bf11a644.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"keycodes-bf11a644.js","mappings":"MAAa,YAAY,GAAG,EAAE;MACjB,cAAc,GAAG,GAAG;MACpB,eAAe,GAAG,GAAG;MACrB,cAAc,GAAG,GAAG;MACpB,kBAAkB,GAAG,EAAE;MACvB,eAAe,GAAG,GAAG;MACrB,iBAAiB,GAAG,GAAG;MACvB,mBAAmB,GAAG,GAAG;MACzB,mBAAmB,GAAG,GAAG;MACzB,oBAAoB,GAAG,GAAG;MAE1B,GAAG,GAAG,MAAM;MACZ,KAAK,GAAG,QAAQ;MAChB,MAAM,GAAG,SAAS;MAClB,KAAK,GAAG,QAAQ;MAChB,SAAS,GAAG,YAAY;MACxB,MAAM,GAAG,SAAS;MAClB,QAAQ,GAAG,UAAU;MACrB,UAAU,GAAG,YAAY;MACzB,UAAU,GAAG,YAAY;MACzB,WAAW,GAAG;;;;","names":[],"sources":["./src/util/keycodes.ts"],"sourcesContent":["export const TAB_KEY_CODE = 9;\nexport const ENTER_KEY_CODE = 13;\nexport const ESCAPE_KEY_CODE = 27;\nexport const SPACE_KEY_CODE = 32;\nexport const BACKSPACE_KEY_CODE = 8;\nexport const DELETE_KEY_CODE = 46;\nexport const ARROW_UP_KEY_CODE = 38;\nexport const ARROW_DOWN_KEY_CODE = 40;\nexport const ARROW_LEFT_KEY_CODE = 37;\nexport const ARROW_RIGHT_KEY_CODE = 39;\n\nexport const TAB = 'Tab';\nexport const ENTER = 'Enter';\nexport const ESCAPE = 'Escape';\nexport const SPACE = 'Space';\nexport const BACKSPACE = 'Backspace';\nexport const DELETE = 'Delete';\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\n"],"version":3}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,h as e}from"./p-443111b3.js";import{t as a}from"./p-efd753ba.js";import{c as r}from"./p-96460db3.js";const i='@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, filter 0.2s ease, opacity 0.4s ease;cursor:help}.item:focus-visible,.item:hover{opacity:1 !important}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]) .item:focus,:host(limel-chart[type=dot]) .item:focus,:host(limel-chart[type=line]) .item:focus,:host(limel-chart[type=area]) .item:focus{outline:none}:host(limel-chart[type=bar]) .item:focus-visible,:host(limel-chart[type=dot]) .item:focus-visible,:host(limel-chart[type=line]) .item:focus-visible,:host(limel-chart[type=area]) .item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}: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{outline:none}:host(limel-chart[type=ring]) .item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}: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:focus{outline:none}:host(limel-chart[type=stacked-bar]) .item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limel-chart[type=stacked-bar]) .item:last-of-type{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%);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%);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:focus{outline:none}:host(limel-chart[type=nps]) .item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}: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 o=100;const l=10;const h=class{constructor(e){t(this,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 e("limel-spinner",{limeBranded:false})}return e("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(),e("tbody",{class:"chart"},this.renderItems()))}renderCaption(){if(!this.accessibleLabel){return}return e("caption",null,this.accessibleLabel)}renderTableHeader(){return e("thead",null,e("tr",null,e("th",{scope:"col"},this.accessibleItemsLabel),e("th",{scope:"col"},a.get("value",this.language))))}renderAxises(){if(!["bar","dot","area","line"].includes(this.type)){return}const{minValue:t,maxValue:a}=this.range;const r=[];const i=Math.floor(t/this.axisIncrement)*this.axisIncrement;const o=Math.ceil(a/this.axisIncrement)*this.axisIncrement;for(let t=i;t<=o;t+=this.axisIncrement){r.push(e("div",{class:{"axis-line":true,"zero-line":t===0},role:"presentation"},e("limel-badge",{label:t})))}return e("div",{class:"axises",role:"presentation"},r)}renderItems(){var t;if(!((t=this.items)===null||t===void 0?void 0:t.length)){return}let a=0;return this.items.map(((t,i)=>{const o=r();const l=this.calculateSizeAndOffset(t);const h=l.size;let n=l.offset;if(this.type==="pie"||this.type==="doughnut"){n=a;a+=h}return e("tr",{style:this.getItemStyle(t,i,h,n),class:this.getItemClass(t),key:o,id:o,tabIndex:0},e("th",null,this.getItemText(t)),e("td",null,this.getFormattedValue(t)),this.renderTooltip(t,o,h))}))}getItemStyle(t,e,a,r){const i={"--limel-chart-item-offset":`${r}`,"--limel-chart-item-size":`${a}`,"--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:a}=this.range;if(!t){return{size:0,offset:0}}let r=0;if(this.isRangeItem(t)){r=this.getMinimumValue(t)}const i=(r-e)/a*o;const l=(this.getMaximumValue(t)-e)/a*o;return{size:l-i,offset:i}}getFormattedValue(t){const{value:e,formattedValue:a}=t;if(a){return a}if(Array.isArray(e)){return`${e[0]} — ${e[1]}`}return`${e}`}getItemText(t){return t.text}renderTooltip(t,a,r){const i=this.getItemText(t);const o=2;const l=this.getFormattedValue(t);const h={label:i,helperLabel:l,elementId:a};if(this.type!=="bar"&&this.type!=="dot"&&this.type!=="nps"){h.label=`${i} (${r.toFixed(o)}%)`}return e("limel-tooltip",Object.assign({},h,{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 a=Math.max(...this.items.map(this.getMaximumValue));const r=this.items.reduce(((t,e)=>t+this.getMaximumValue(e)),0);let i=(t=this.maxValue)!==null&&t!==void 0?t:a;if((this.type==="pie"||this.type==="doughnut")&&!this.maxValue){i=r}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 h=o-l;return{minValue:l,maxValue:o,totalRange:h}}calculateAxisIncrement(t,e=l){const a=Math.max(...t.map((t=>{const e=t.value;if(Array.isArray(e)){return Math.max(...e)}return e})));const r=a/e;const i=10**Math.floor(Math.log10(r));return Math.ceil(r/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()}static get watchers(){return{items:["handleChange"],axisIncrement:["handleChange"],maxValue:["handleChange"]}}};h.style=i;export{h as limel_chart};
|
|
2
|
-
//# sourceMappingURL=p-0eef63d5.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["chartCss","PERCENT","DEFAULT_INCREMENT_SIZE","Chart","componentWillLoad","this","recalculateRangeData","render","loading","h","limeBranded","style","items","length","toString","renderCaption","renderTableHeader","renderAxises","class","renderItems","accessibleLabel","scope","accessibleItemsLabel","translate","get","language","includes","type","minValue","maxValue","range","lines","adjustedMinRange","Math","floor","axisIncrement","adjustedMaxRange","ceil","value","push","role","label","_a","cumulativeOffset","map","item","index","itemId","createRandomString","sizeAndOffset","calculateSizeAndOffset","size","offset","getItemStyle","getItemClass","key","id","tabIndex","getItemText","getFormattedValue","renderTooltip","color","nextItem","Array","isArray","getMaximumValue","isRangeItem","totalRange","startValue","getMinimumValue","normalizedStart","normalizedEnd","formattedValue","text","PERCENT_DECIMAL","tooltipProps","helperLabel","elementId","toFixed","Object","assign","openDirection","orientation","calculateRange","minRange","min","maxRange","max","totalSum","reduce","sum","finalMaxRange","calculateAxisIncrement","visualMaxValue","visualMinValue","steps","roughStep","magnitude","log10","handleChange"],"sources":["./src/components/chart/chart.scss?tag=limel-chart&encapsulation=shadow","./src/components/chart/chart.tsx"],"sourcesContent":["@use '../../style/mixins';\n$min-item-size: 0.5rem;\n$default-item-color: var(--chart-item-color, rgb(var(--contrast-1100), 0.8));\n\n/**\n* @prop --chart-background-color: Defines the background color of the chart. Defaults to `transparent` for _most_ chart types.\n* @prop --chart-item-color: If no color is defined for chart items, this color will be use. Defaults to `rgb(var(--contrast-1100), 0.8)`.\n* @prop --chart-item-divider-color: Defines the color that visually separates items in some charts, such as `stacked-bar` chart items. Defaults to `rgb(var(--color-white), 0.6)`.\n* @prop --chart-axis-line-color: Defines color of the axis lines. Defaults to `--contrast-900`. Note that lines have opacity as well, and get opaque on hover.\n* @prop --chart-item-border-radius: Defines the roundness of corners of items in a chart. Defaults to different values depending on the chart type. Does not have any effect on `pie` and `doughnut` types.\n*/\n\n:host(limel-chart) {\n --chart-axis-line-color: var(\n --limel-chart-axis-line-color,\n rgb(var(--contrast-900))\n );\n box-sizing: border-box;\n isolation: isolate;\n\n display: flex;\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n padding: var(--limel-chart-padding);\n}\n\ntable {\n // Since these are mainly \"resets\", no styles should be before them.\n all: unset;\n border-collapse: collapse;\n border-spacing: 0;\n empty-cells: show;\n\n position: relative;\n display: flex;\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n\n colgroup,\n thead,\n tbody,\n tr,\n th,\n td {\n all: unset;\n }\n\n caption,\n colgroup,\n thead,\n tfoot,\n th,\n td {\n @include mixins.visually-hidden;\n }\n}\n\n*,\n*:before,\n*:after {\n box-sizing: border-box;\n}\n\n.chart {\n position: relative;\n flex-grow: 1;\n width: 100%;\n height: 100%;\n min-height: 0;\n min-width: 0;\n\n &:has(.item:hover),\n &:has(.item:focus-visible) {\n .item {\n opacity: 0.4;\n }\n }\n}\n\n.item {\n transition:\n background-color 0.2s ease,\n filter 0.2s ease,\n opacity 0.4s ease;\n cursor: help;\n\n &:focus-visible,\n &:hover {\n opacity: 1 !important;\n }\n}\n\nlimel-spinner {\n margin: auto;\n}\n\n@mixin line(\n $direction: vertical,\n $color: rgb(var(--contrast-800), 0.4),\n $position: center\n) {\n @if $direction == vertical {\n background: linear-gradient(to bottom, $color 0%, $color 100%)\n $position/1px\n 100%\n no-repeat;\n } @else if $direction == horizontal {\n background: linear-gradient(to right, $color 0%, $color 100%)\n $position/100%\n 1px\n no-repeat;\n }\n}\n\n@import './partial-styles/_layout-for-charts-with-x-y-axises';\n@import './partial-styles/_layout-for-charts-with-circular-shape';\n@import './partial-styles/_bar-gantt-dot';\n@import './partial-styles/_area_line';\n@import './partial-styles/_pie-doughnut';\n@import './partial-styles/_ring';\n@import './partial-styles/_stacked-bar';\n@import './partial-styles/_nps';\n@import './partial-styles/_axises';\n","import { Component, h, Prop, Watch } from '@stencil/core';\nimport { Languages } from '../date-picker/date.types';\nimport translate from '../../global/translations';\nimport { createRandomString } from '../../util/random-string';\nimport { ChartItem } from './chart.types';\n\nconst PERCENT = 100;\nconst DEFAULT_INCREMENT_SIZE = 10;\n\n/**\n * A chart is a graphical representation of data, in which\n * visual symbols such as such bars, dots, lines, or slices, represent\n * each data point, in comparison to others.\n *\n * @exampleComponent limel-example-chart-stacked-bar\n * @exampleComponent limel-example-chart-orientation\n * @exampleComponent limel-example-chart-max-value\n * @exampleComponent limel-example-chart-type-bar\n * @exampleComponent limel-example-chart-type-dot\n * @exampleComponent limel-example-chart-type-area\n * @exampleComponent limel-example-chart-type-line\n * @exampleComponent limel-example-chart-type-pie\n * @exampleComponent limel-example-chart-type-doughnut\n * @exampleComponent limel-example-chart-type-ring\n * @exampleComponent limel-example-chart-type-gantt\n * @exampleComponent limel-example-chart-type-nps\n * @exampleComponent limel-example-chart-multi-axis\n * @exampleComponent limel-example-chart-multi-axis-with-negative-start-values\n * @exampleComponent limel-example-chart-multi-axis-area-with-negative-start-values\n * @exampleComponent limel-example-chart-axis-increment\n * @exampleComponent limel-example-chart-accessibility\n * @exampleComponent limel-example-chart-styling\n * @exampleComponent limel-example-chart-creative-styling\n * @beta\n */\n\n@Component({\n tag: 'limel-chart',\n shadow: true,\n styleUrl: 'chart.scss',\n})\nexport class Chart {\n /**\n * Defines the language for translations.\n * Will translate the translatable strings on the components.\n */\n @Prop({ reflect: true })\n public language: Languages = 'en';\n\n /**\n * Helps users of assistive technologies to understand\n * the context of the chart, and what is being displayed.\n */\n @Prop({ reflect: true })\n public accessibleLabel?: string;\n\n /**\n * Helps users of assistive technologies to understand\n * what the items in the chart represent.\n */\n @Prop({ reflect: true })\n public accessibleItemsLabel?: string;\n\n /**\n * List of items in the chart,\n * each representing a data point.\n */\n @Prop()\n public items!: ChartItem[];\n\n /**\n * Defines how items are visualized in the chart.\n */\n @Prop({ reflect: true })\n public type?:\n | 'area'\n | 'bar'\n | 'doughnut'\n | 'line'\n | 'nps'\n | 'pie'\n | 'ring'\n | 'dot'\n | 'stacked-bar' = 'stacked-bar';\n\n /**\n * Defines whether the chart is intended to be displayed wide or tall.\n * Does not have any effect on chart types which generate circular forms.\n */\n @Prop({ reflect: true })\n public orientation?: 'landscape' | 'portrait' = 'landscape';\n\n /**\n * Specifies the range that items' values could be in.\n * This is used in calculation of the size of the items in the chart.\n * When not provided, the sum of all values in the items will be considered as the range.\n */\n @Prop({ reflect: true })\n public maxValue?: number;\n\n /**\n * Specifies the increment for the axis lines.\n */\n @Prop({ reflect: true })\n public axisIncrement?: number;\n\n /**\n * Indicates whether the chart is in a loading state.\n */\n @Prop({ reflect: true })\n public loading: boolean = false;\n\n private range: {\n minValue: number;\n maxValue: number;\n totalRange: number;\n };\n\n public componentWillLoad() {\n this.recalculateRangeData();\n }\n\n public render() {\n if (this.loading) {\n return <limel-spinner limeBranded={false} />;\n }\n\n return (\n <table\n aria-busy={this.loading ? 'true' : 'false'}\n aria-live=\"polite\"\n style={{\n '--limel-chart-number-of-items':\n this.items.length.toString(),\n }}\n >\n {this.renderCaption()}\n {this.renderTableHeader()}\n {this.renderAxises()}\n <tbody class=\"chart\">{this.renderItems()}</tbody>\n </table>\n );\n }\n\n private renderCaption() {\n if (!this.accessibleLabel) {\n return;\n }\n\n return <caption>{this.accessibleLabel}</caption>;\n }\n\n private renderTableHeader() {\n return (\n <thead>\n <tr>\n <th scope=\"col\">{this.accessibleItemsLabel}</th>\n <th scope=\"col\">{translate.get('value', this.language)}</th>\n </tr>\n </thead>\n );\n }\n\n private renderAxises() {\n if (!['bar', 'dot', 'area', 'line'].includes(this.type)) {\n return;\n }\n\n const { minValue, maxValue } = this.range;\n const lines = [];\n const adjustedMinRange =\n Math.floor(minValue / this.axisIncrement) * this.axisIncrement;\n const adjustedMaxRange =\n Math.ceil(maxValue / this.axisIncrement) * this.axisIncrement;\n\n for (\n let value = adjustedMinRange;\n value <= adjustedMaxRange;\n value += this.axisIncrement\n ) {\n lines.push(\n <div\n class={{\n 'axis-line': true,\n 'zero-line': value === 0,\n }}\n role=\"presentation\"\n >\n <limel-badge label={value} />\n </div>,\n );\n }\n\n return (\n <div class=\"axises\" role=\"presentation\">\n {lines}\n </div>\n );\n }\n\n private renderItems() {\n if (!this.items?.length) {\n return;\n }\n\n let cumulativeOffset = 0;\n\n return this.items.map((item, index) => {\n const itemId = createRandomString();\n const sizeAndOffset = this.calculateSizeAndOffset(item);\n const size = sizeAndOffset.size;\n let offset = sizeAndOffset.offset;\n\n if (this.type === 'pie' || this.type === 'doughnut') {\n offset = cumulativeOffset;\n cumulativeOffset += size;\n }\n\n return (\n <tr\n style={this.getItemStyle(item, index, size, offset)}\n class={this.getItemClass(item)}\n key={itemId}\n id={itemId}\n tabIndex={0}\n >\n <th>{this.getItemText(item)}</th>\n <td>{this.getFormattedValue(item)}</td>\n {this.renderTooltip(item, itemId, size)}\n </tr>\n );\n });\n }\n\n private getItemStyle(\n item: ChartItem,\n index: number,\n size: number,\n offset: number,\n ): Record<string, string> {\n const style: Record<string, string> = {\n '--limel-chart-item-offset': `${offset}`,\n '--limel-chart-item-size': `${size}`,\n '--limel-chart-item-index': `${index}`,\n '--limel-chart-item-value': `${item.value}`,\n };\n\n if (item.color) {\n style['--limel-chart-item-color'] = item.color;\n }\n\n if (this.type === 'line' || this.type === 'area') {\n const nextItem = this.calculateSizeAndOffset(this.items[index + 1]);\n\n style['--limel-chart-next-item-size'] = `${nextItem.size}`;\n style['--limel-chart-next-item-offset'] = `${nextItem.offset}`;\n }\n\n return style;\n }\n\n private getItemClass(item: ChartItem) {\n return {\n item: true,\n 'has-start-value': Array.isArray(item.value),\n 'has-negative-value-only':\n this.getMaximumValue(item) < 0 && !this.isRangeItem(item),\n };\n }\n\n private calculateSizeAndOffset(item?: ChartItem) {\n const { minValue, totalRange } = this.range;\n if (!item) {\n return {\n size: 0,\n offset: 0,\n };\n }\n\n let startValue = 0;\n if (this.isRangeItem(item)) {\n startValue = this.getMinimumValue(item);\n }\n\n const normalizedStart =\n ((startValue - minValue) / totalRange) * PERCENT;\n const normalizedEnd =\n ((this.getMaximumValue(item) - minValue) / totalRange) * PERCENT;\n\n return {\n size: normalizedEnd - normalizedStart,\n offset: normalizedStart,\n };\n }\n\n private getFormattedValue(item: ChartItem): string {\n const { value, formattedValue } = item;\n\n if (formattedValue) {\n return formattedValue;\n }\n\n if (Array.isArray(value)) {\n return `${value[0]} — ${value[1]}`;\n }\n\n return `${value}`;\n }\n\n private getItemText(item: ChartItem): string {\n return item.text;\n }\n\n private renderTooltip(item: ChartItem, itemId: string, size: number) {\n const text = this.getItemText(item);\n const PERCENT_DECIMAL = 2;\n const formattedValue = this.getFormattedValue(item);\n\n const tooltipProps: any = {\n label: text,\n helperLabel: formattedValue,\n elementId: itemId,\n };\n\n if (this.type !== 'bar' && this.type !== 'dot' && this.type !== 'nps') {\n tooltipProps.label = `${text} (${size.toFixed(PERCENT_DECIMAL)}%)`;\n }\n\n return (\n <limel-tooltip\n {...tooltipProps}\n openDirection={\n this.orientation === 'portrait' ? 'right' : 'top'\n }\n />\n );\n }\n\n private calculateRange() {\n if (this.range) {\n return this.range;\n }\n\n const minRange = Math.min(0, ...this.items.map(this.getMinimumValue));\n const maxRange = Math.max(...this.items.map(this.getMaximumValue));\n const totalSum = this.items.reduce(\n (sum, item) => sum + this.getMaximumValue(item),\n 0,\n );\n\n let finalMaxRange = this.maxValue ?? maxRange;\n if (\n (this.type === 'pie' || this.type === 'doughnut') &&\n !this.maxValue\n ) {\n finalMaxRange = totalSum;\n }\n\n if (!this.axisIncrement) {\n this.axisIncrement = this.calculateAxisIncrement(this.items);\n }\n\n const visualMaxValue =\n Math.ceil(finalMaxRange / this.axisIncrement) * this.axisIncrement;\n const visualMinValue =\n Math.floor(minRange / this.axisIncrement) * this.axisIncrement;\n const totalRange = visualMaxValue - visualMinValue;\n\n return {\n minValue: visualMinValue,\n maxValue: visualMaxValue,\n totalRange: totalRange,\n };\n }\n\n private calculateAxisIncrement(\n items: ChartItem[],\n steps: number = DEFAULT_INCREMENT_SIZE,\n ) {\n const maxValue = Math.max(\n ...items.map((item) => {\n const value = item.value;\n if (Array.isArray(value)) {\n return Math.max(...value);\n }\n\n return value;\n }),\n );\n\n const roughStep = maxValue / steps;\n // eslint-disable-next-line no-magic-numbers\n const magnitude = 10 ** Math.floor(Math.log10(roughStep));\n\n return Math.ceil(roughStep / magnitude) * magnitude;\n }\n\n private getMinimumValue(item: ChartItem): number {\n const value = item.value;\n\n return Array.isArray(value) ? Math.min(...value) : value;\n }\n\n private getMaximumValue(item: ChartItem): number {\n const value = item.value;\n\n return Array.isArray(value) ? Math.max(...value) : value;\n }\n\n private isRangeItem(item: ChartItem): item is ChartItem<[number, number]> {\n return Array.isArray(item.value);\n }\n\n @Watch('items')\n @Watch('axisIncrement')\n @Watch('maxValue')\n handleChange() {\n this.range = null;\n this.recalculateRangeData();\n }\n\n private recalculateRangeData() {\n this.range = this.calculateRange();\n }\n}\n"],"mappings":"mHAAA,MAAMA,EAAW,+4mBCMjB,MAAMC,EAAU,IAChB,MAAMC,EAAyB,G,MAkClBC,EAAK,M,uCAMe,K,kGAoCP,c,iBAO0B,Y,kEAoBtB,K,CAQnBC,oBACHC,KAAKC,sB,CAGFC,SACH,GAAIF,KAAKG,QAAS,CACd,OAAOC,EAAA,iBAAeC,YAAa,O,CAGvC,OACID,EAAA,qBACeJ,KAAKG,QAAU,OAAS,QAAO,YAChC,SACVG,MAAO,CACH,gCACIN,KAAKO,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B,KAAK8B,cAAgB9B,KAAKuF,uBAAuBvF,KAAKO,M,CAG1D,MAAMiF,EACF5D,KAAKI,KAAKsD,EAAgBtF,KAAK8B,eAAiB9B,KAAK8B,cACzD,MAAM2D,EACF7D,KAAKC,MAAMkD,EAAW/E,KAAK8B,eAAiB9B,KAAK8B,cACrD,MAAMgC,EAAa0B,EAAiBC,EAEpC,MAAO,CACHlE,SAAUkE,EACVjE,SAAUgE,EACV1B,WAAYA,E,CAIZyB,uBACJhF,EACAmF,EAAgB7F,GAEhB,MAAM2B,EAAWI,KAAKsD,OACf3E,EAAMgC,KAAKC,IACV,MAAMP,EAAQO,EAAKP,MACnB,GAAIyB,MAAMC,QAAQ1B,GAAQ,CACtB,OAAOL,KAAKsD,OAAOjD,E,CAGvB,OAAOA,CAAK,KAIpB,MAAM0D,EAAYnE,EAAWkE,EAE7B,MAAME,EAAY,IAAMhE,KAAKC,MAAMD,KAAKiE,MAAMF,IAE9C,OAAO/D,KAAKI,KAAK2D,EAAYC,GAAaA,C,CAGtC5B,gBAAgBxB,GACpB,MAAMP,EAAQO,EAAKP,MAEnB,OAAOyB,MAAMC,QAAQ1B,GAASL,KAAKoD,OAAO/C,GAASA,C,CAG/C2B,gBAAgBpB,GACpB,MAAMP,EAAQO,EAAKP,MAEnB,OAAOyB,MAAMC,QAAQ1B,GAASL,KAAKsD,OAAOjD,GAASA,C,CAG/C4B,YAAYrB,GAChB,OAAOkB,MAAMC,QAAQnB,EAAKP,M,CAM9B6D,eACI9F,KAAKyB,MAAQ,KACbzB,KAAKC,sB,CAGDA,uBACJD,KAAKyB,MAAQzB,KAAK8E,gB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["strings","ARIA_HIDDEN","ROLE","cssClasses","HELPER_TEXT_VALIDATION_MSG","HELPER_TEXT_VALIDATION_MSG_PERSISTENT","MDCSelectHelperTextFoundation","_super","__extends","adapter","call","this","__assign","defaultAdapter","Object","defineProperty","get","enumerable","configurable","addClass","undefined","removeClass","hasClass","setAttr","getAttr","removeAttr","setContent","prototype","getId","isVisible","content","setValidation","isValidation","setValidationMsgPersistent","isPersistent","setValidity","selectIsValid","isValidationMsg","isPersistentValidationMsg","msgShouldDisplay","showToScreenReader","hide","MDCFoundation","MDCSelectHelperText","apply","arguments","attachTo","root","foundation","getDefaultFoundation","_this","className","classList","add","remove","contains","attr","getAttribute","value","setAttribute","removeAttribute","textContent","MDCComponent","SelectTemplate","props","hasValue","hasEmptyText","isMultiple","length","text","isValid","invalid","checkValid","required","disabled","readonly","helperText","h","class","SelectValue","assign","HelperText","SelectDropdown","anchorClassList","isOpen","labelClassList","onClick","open","onKeyPress","onTriggerPress","id","label","getSelectedIcon","getSelectedText","ShowIcon","viewBox","focusable","stroke","points","name","size","trim","native","NativeDropdown","MenuDropdown","items","createMenuItems","options","containerId","visible","inheritParentWidth","containerStyle","dropdownZIndex","onDismiss","close","style","display","width","type","multiple","onChange","onMenuChange","filter","option","map","renderOption","onNativeChange","onFocus","onBlur","selectedOption","key","selected","isSelected","some","o","selectIsRequired","menuOptionFilter","getMenuOptionFilter","separator","secondaryText","getIconName","icon","color","getIconColor","iconColor","emptyReadOnlyOption","isEmptyValue","join","triggerIconColorWarning","forEach","console","warn","selectCss","Select","constructor","hostRef","hasChanged","handleMenuChange","bind","handleNativeChange","handleMenuTriggerKeyPress","openMenu","closeMenu","portalId","createRandomString","connectedCallback","initialize","componentWillLoad","isMobileDevice","host","hasAttribute","componentDidLoad","getOptionsExcludingSeparators","element","shadowRoot","querySelector","mdcFloatingLabel","MDCFloatingLabel","mdcSelectHelperText","disconnectedCallback","destroy","componentDidUpdate","menuOpen","setMenuFocus","render","getComputedStyle","getPropertyValue","watchOpen","newValue","oldValue","setTimeout","list","document","firstItem","_a","focus","setTriggerFocus","trigger","event","stopPropagation","detail","selector","menuSurface","_b","scrollPosition","scrollTop","listItems","item","change","emit","requestAnimationFrame","listItem","emitFirstChangeEvent","isEnter","ENTER","keyCode","ENTER_KEY_CODE","isSpace","SPACE","SPACE_KEY_CODE","preventDefault","Array","optionElement","find"],"sources":["./node_modules/@material/select/helper-text/constants.js","./node_modules/@material/select/helper-text/foundation.js","./node_modules/@material/select/helper-text/component.js","./src/components/select/select.template.tsx","./src/components/select/select.scss?tag=limel-select&encapsulation=shadow","./src/components/select/select.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar strings = {\n ARIA_HIDDEN: 'aria-hidden',\n ROLE: 'role',\n};\nvar cssClasses = {\n HELPER_TEXT_VALIDATION_MSG: 'mdc-select-helper-text--validation-msg',\n HELPER_TEXT_VALIDATION_MSG_PERSISTENT: 'mdc-select-helper-text--validation-msg-persistent',\n};\nexport { strings, cssClasses };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, strings } from './constants';\nvar MDCSelectHelperTextFoundation = /** @class */ (function (_super) {\n __extends(MDCSelectHelperTextFoundation, _super);\n function MDCSelectHelperTextFoundation(adapter) {\n return _super.call(this, __assign(__assign({}, MDCSelectHelperTextFoundation.defaultAdapter), adapter)) || this;\n }\n Object.defineProperty(MDCSelectHelperTextFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCSelectHelperTextFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCSelectHelperTextFoundation, \"defaultAdapter\", {\n /**\n * See {@link MDCSelectHelperTextAdapter} for typing information on parameters and return types.\n */\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n hasClass: function () { return false; },\n setAttr: function () { return undefined; },\n getAttr: function () { return null; },\n removeAttr: function () { return undefined; },\n setContent: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n /**\n * @return The ID of the helper text, or null if none is set.\n */\n MDCSelectHelperTextFoundation.prototype.getId = function () {\n return this.adapter.getAttr('id');\n };\n /**\n * @return Whether the helper text is currently visible.\n */\n MDCSelectHelperTextFoundation.prototype.isVisible = function () {\n return this.adapter.getAttr(strings.ARIA_HIDDEN) !== 'true';\n };\n /**\n * Sets the content of the helper text field.\n */\n MDCSelectHelperTextFoundation.prototype.setContent = function (content) {\n this.adapter.setContent(content);\n };\n /**\n * Sets the helper text to act as a validation message.\n * By default, validation messages are hidden when the select is valid and\n * visible when the select is invalid.\n *\n * @param isValidation True to make the helper text act as an error validation\n * message.\n */\n MDCSelectHelperTextFoundation.prototype.setValidation = function (isValidation) {\n if (isValidation) {\n this.adapter.addClass(cssClasses.HELPER_TEXT_VALIDATION_MSG);\n }\n else {\n this.adapter.removeClass(cssClasses.HELPER_TEXT_VALIDATION_MSG);\n }\n };\n /**\n * Sets the persistency of the validation helper text.\n * This keeps the validation message visible even if the select is valid,\n * though it will be displayed in the normal (grey) color.\n */\n MDCSelectHelperTextFoundation.prototype.setValidationMsgPersistent = function (isPersistent) {\n if (isPersistent) {\n this.adapter.addClass(cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);\n }\n else {\n this.adapter.removeClass(cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);\n }\n };\n /**\n * When acting as a validation message, shows/hides the helper text and\n * triggers alerts as necessary based on the select's validity.\n */\n MDCSelectHelperTextFoundation.prototype.setValidity = function (selectIsValid) {\n var isValidationMsg = this.adapter.hasClass(cssClasses.HELPER_TEXT_VALIDATION_MSG);\n if (!isValidationMsg) {\n // Non-validating helper-text is always displayed and does not participate\n // in validation logic.\n return;\n }\n var isPersistentValidationMsg = this.adapter.hasClass(cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);\n // Validating helper text is displayed if select is invalid, unless it is\n // set as persistent, in which case it always displays.\n var msgShouldDisplay = !selectIsValid || isPersistentValidationMsg;\n if (msgShouldDisplay) {\n this.showToScreenReader();\n // In addition to displaying, also trigger an alert if the select\n // has become invalid.\n if (!selectIsValid) {\n this.adapter.setAttr(strings.ROLE, 'alert');\n }\n else {\n this.adapter.removeAttr(strings.ROLE);\n }\n return;\n }\n // Hide everything.\n this.adapter.removeAttr(strings.ROLE);\n this.hide();\n };\n /**\n * Makes the helper text visible to screen readers.\n */\n MDCSelectHelperTextFoundation.prototype.showToScreenReader = function () {\n this.adapter.removeAttr(strings.ARIA_HIDDEN);\n };\n /**\n * Hides the help text from screen readers.\n */\n MDCSelectHelperTextFoundation.prototype.hide = function () {\n this.adapter.setAttr(strings.ARIA_HIDDEN, 'true');\n };\n return MDCSelectHelperTextFoundation;\n}(MDCFoundation));\nexport { MDCSelectHelperTextFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCSelectHelperTextFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCComponent } from '@material/base/component';\nimport { MDCSelectHelperTextFoundation } from './foundation';\nvar MDCSelectHelperText = /** @class */ (function (_super) {\n __extends(MDCSelectHelperText, _super);\n function MDCSelectHelperText() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCSelectHelperText.attachTo = function (root) {\n return new MDCSelectHelperText(root);\n };\n Object.defineProperty(MDCSelectHelperText.prototype, \"foundationForSelect\", {\n // Provided for access by MDCSelect component\n get: function () {\n return this.foundation;\n },\n enumerable: false,\n configurable: true\n });\n MDCSelectHelperText.prototype.getDefaultFoundation = function () {\n var _this = this;\n // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.\n // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n var adapter = {\n addClass: function (className) { return _this.root.classList.add(className); },\n removeClass: function (className) { return _this.root.classList.remove(className); },\n hasClass: function (className) { return _this.root.classList.contains(className); },\n getAttr: function (attr) { return _this.root.getAttribute(attr); },\n setAttr: function (attr, value) { return _this.root.setAttribute(attr, value); },\n removeAttr: function (attr) { return _this.root.removeAttribute(attr); },\n setContent: function (content) {\n _this.root.textContent = content;\n },\n };\n // tslint:enable:object-literal-sort-keys\n return new MDCSelectHelperTextFoundation(adapter);\n };\n return MDCSelectHelperText;\n}(MDCComponent));\nexport { MDCSelectHelperText };\n//# sourceMappingURL=component.js.map","import { ListItem, ListSeparator } from '../list/list-item.types';\nimport { Option } from '../select/option.types';\nimport { FunctionalComponent, h } from '@stencil/core';\nimport { isMultiple } from '../../util/multiple';\nimport { getIconColor, getIconName } from '../icon/get-icon-props';\n\ninterface SelectTemplateProps {\n disabled?: boolean;\n readonly?: boolean;\n required?: boolean;\n invalid?: boolean;\n options: Array<Option | ListSeparator>;\n value: Option | Option[];\n label?: string;\n helperText?: string;\n multiple?: boolean;\n native: boolean;\n\n onNativeChange: (event: Event) => void;\n\n id: string;\n onMenuChange: (event: CustomEvent<ListItem | ListItem[]>) => void;\n onTriggerPress: (event: KeyboardEvent) => void;\n isOpen: boolean;\n open: () => void;\n close: () => void;\n checkValid: boolean;\n\n dropdownZIndex: string;\n}\n\nexport const SelectTemplate: FunctionalComponent<SelectTemplateProps> = (\n props,\n) => {\n const value = props.value;\n let hasValue = !!props.value;\n let hasEmptyText = true;\n if (isMultiple(value)) {\n hasValue = value.length > 0;\n } else if (hasValue) {\n hasValue = !!value.value;\n hasEmptyText = value.text === '';\n }\n\n let isValid = !props.invalid;\n if (props.checkValid && props.required && !hasValue) {\n isValid = false;\n }\n\n const classList = {\n 'limel-select': true,\n 'mdc-select': true,\n 'mdc-select--outlined': true,\n 'mdc-select--disabled': props.disabled,\n 'limel-select--readonly': props.readonly,\n 'limel-select--required': props.required,\n 'limel-select--invalid': !isValid,\n 'limel-select--empty': !hasValue,\n 'limel-select--with-helper-text': typeof props.helperText === 'string',\n };\n\n return (\n <div class={classList}>\n <SelectValue\n {...props}\n hasValue={hasValue}\n isValid={isValid}\n hasEmptyText={hasEmptyText}\n />\n <HelperText text={props.helperText} isValid={!props.invalid} />\n <SelectDropdown {...props} />\n </div>\n );\n};\n\nconst SelectValue: FunctionalComponent<\n SelectTemplateProps & {\n hasValue: boolean;\n isValid: boolean;\n hasEmptyText: boolean;\n }\n> = (props) => {\n const anchorClassList = {\n 'mdc-select__anchor': true,\n 'limel-select-trigger': true,\n 'limel-select--focused': props.isOpen,\n };\n const labelClassList = {\n 'mdc-floating-label': true,\n 'mdc-floating-label--float-above':\n !props.hasEmptyText ||\n props.isOpen ||\n props.readonly ||\n props.hasValue,\n 'mdc-floating-label--active': props.isOpen,\n };\n\n return (\n <button\n class={anchorClassList}\n onClick={props.open}\n onKeyPress={props.onTriggerPress}\n aria-haspopup=\"listbox\"\n aria-expanded={props.isOpen}\n aria-controls={props.id}\n aria-labelledby=\"s-label s-selected-text\"\n aria-required={props.required}\n disabled={props.disabled || props.readonly}\n >\n <span id=\"s-label\" class={labelClassList}>\n {props.label}\n </span>\n <span class=\"mdc-select__selected-text-container limel-select__selected-option\">\n {getSelectedIcon(props.value)}\n <span\n id=\"s-selected-text\"\n class=\"mdc-select__selected-text limel-select__selected-option__text\"\n >\n {getSelectedText(props.value, props.readonly)}\n </span>\n </span>\n <ShowIcon {...props} isValid={props.isValid} />\n <span class=\"mdc-select__dropdown-icon\">\n <svg\n class=\"mdc-select__dropdown-icon-graphic\"\n viewBox=\"7 10 10 5\"\n focusable=\"false\"\n >\n <polygon\n stroke=\"none\"\n fill-rule=\"evenodd\"\n points=\"7 10 12 15 17 10\"\n ></polygon>\n </svg>\n </span>\n </button>\n );\n};\n\nconst ShowIcon: FunctionalComponent<\n SelectTemplateProps & {\n isValid: boolean;\n }\n> = (props) => {\n if (props.isValid) {\n return;\n }\n\n return (\n <limel-icon name=\"high_importance\" size=\"medium\" class=\"invalid-icon\" />\n );\n};\n\nconst HelperText: FunctionalComponent<{ text: string; isValid: boolean }> = (\n props,\n) => {\n if (typeof props.text !== 'string') {\n return;\n }\n\n return (\n <limel-helper-line\n helperText={props.text.trim()}\n invalid={!props.isValid}\n />\n );\n};\n\nconst SelectDropdown: FunctionalComponent<SelectTemplateProps> = (props) => {\n if (props.native) {\n return <NativeDropdown {...props} />;\n }\n\n return <MenuDropdown {...props} />;\n};\n\nconst MenuDropdown: FunctionalComponent<SelectTemplateProps> = (props) => {\n const items = createMenuItems(props.options, props.value, props.required);\n\n return (\n <limel-portal\n containerId={props.id}\n visible={props.isOpen}\n inheritParentWidth={true}\n containerStyle={{ 'z-index': props.dropdownZIndex }}\n >\n <limel-menu-surface\n open={props.isOpen}\n onDismiss={props.close}\n style={{\n '--mdc-menu-min-width': '100%',\n 'max-height': 'inherit',\n display: 'flex',\n 'min-width': '100%',\n width: 'fit-content',\n }}\n >\n <limel-list\n items={items}\n type={props.multiple ? 'checkbox' : 'selectable'}\n onChange={props.onMenuChange}\n />\n </limel-menu-surface>\n </limel-portal>\n );\n};\n\nconst NativeDropdown: FunctionalComponent<SelectTemplateProps> = (props) => {\n const options = props.options\n .filter((option): option is Option => !('separator' in option))\n .map(renderOption(props.value));\n\n return (\n <select\n required={props.required}\n aria-disabled={props.disabled}\n aria-required={props.required}\n onChange={props.onNativeChange}\n onFocus={props.open}\n onBlur={props.close}\n class=\"limel-select__native-control\"\n disabled={props.disabled}\n multiple={props.multiple}\n >\n {options}\n </select>\n );\n};\n\nconst renderOption = (selectedOption: Option | Option[]) => {\n return (option: Option) => {\n const { value, disabled, text } = option;\n\n return (\n <option\n key={value}\n value={value}\n selected={isSelected(option, selectedOption)}\n disabled={disabled}\n >\n {text}\n </option>\n );\n };\n};\n\nfunction isSelected(option: Option, value: Option | Option[]): boolean {\n if (!value) {\n return false;\n }\n\n if (isMultiple(value)) {\n return value.some((o) => option.value === o.value);\n }\n\n return option.value === value.value;\n}\n\nfunction createMenuItems(\n options: Array<Option | ListSeparator>,\n value: Option | Option[],\n selectIsRequired = false,\n): Array<ListItem<Option> | ListSeparator> {\n const menuOptionFilter = getMenuOptionFilter(selectIsRequired);\n\n return options.filter(menuOptionFilter).map((option) => {\n if ('separator' in option) {\n return {\n text: option.text,\n separator: true,\n };\n }\n\n const selected = isSelected(option, value);\n const { text, secondaryText, disabled } = option;\n const name = getIconName(option.icon);\n // eslint-disable-next-line sonarjs/deprecation\n const color = getIconColor(option.icon, option.iconColor);\n\n if (!name) {\n return {\n text: text,\n secondaryText: secondaryText,\n selected: selected,\n disabled: disabled,\n value: option,\n };\n }\n\n return {\n text: text,\n secondaryText: secondaryText,\n selected: selected,\n disabled: disabled,\n value: option,\n icon: {\n name: name,\n color: color,\n },\n };\n });\n}\n\nfunction getMenuOptionFilter(selectIsRequired: boolean) {\n return (option: Option | ListSeparator) => {\n if (!selectIsRequired) {\n // If the select component is NOT required, we keep all options.\n return true;\n }\n\n if (option.text) {\n // If the select component IS required, we keep only options\n // that are not \"empty\". We only check the text property, because\n // some systems use an \"empty option\" that will have a value for\n // the `value` property, to signify \"no option selected\". Such\n // an option should be treated as \"empty\".\n return true;\n }\n\n if ('separator' in option) {\n return true;\n }\n };\n}\n\nfunction getSelectedText(value: Option | Option[], readonly: boolean): string {\n const emptyReadOnlyOption = <span class=\"readonly-option\">–</span>;\n\n const isEmptyValue = !value || (isMultiple(value) && !value.length);\n if (isEmptyValue) {\n return readonly ? emptyReadOnlyOption : '';\n }\n\n if (isMultiple(value)) {\n return value.map((option) => option.text).join(', ');\n }\n\n if (readonly && (value.value === 'empty' || value.text === '')) {\n return emptyReadOnlyOption;\n }\n\n return value.text;\n}\n\nfunction getSelectedIcon(value: any) {\n if (!value?.icon) {\n return '';\n }\n\n const name = getIconName(value.icon);\n const color = getIconColor(value.icon, value.iconColor);\n const style: any = {};\n if (color) {\n style.color = color;\n }\n\n return (\n <limel-icon\n class=\"limel-select__selected-option__icon\"\n name={name}\n size=\"medium\"\n style={style}\n />\n );\n}\n\nexport function triggerIconColorWarning(options: Option[]) {\n options.forEach((option) => {\n // eslint-disable-next-line sonarjs/deprecation\n if (option.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","@use '../../style/functions';\n@use '../../style/internal/shared_input-select-picker';\n@use '../../style/mixins';\n\n@use '@material/select/styles';\n@use '@material/floating-label';\n@use '@material/floating-label/mdc-floating-label';\n\n// Note! The `--dropdown-z-index` property is used from `select.tsx`.\n/**\n * @prop --dropdown-z-index: z-index of the dropdown menu.\n */\n\n:host {\n display: block;\n position: relative;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.mdc-select--outlined .mdc-floating-label {\n left: functions.pxToRem(16);\n}\n\n.mdc-select__anchor,\n.mdc-floating-label,\n.mdc-select__selected-text {\n // As long as this component is depended on MDC,\n // we need to force it to be font-agnostic.\n // When MDC-dependency is removed, this block can also be removed.\n // However, on removal of MDC-dependency, we should also make sure to check\n // other font-related styles that might be set by MDC,\n // such as `letter-spacing` or `font-size`.\n font-family: inherit;\n}\n\n.mdc-select__dropdown-icon-graphic {\n transition: transform 0.2s ease;\n}\n\n.limel-select__selected-option {\n display: flex;\n align-items: center;\n\n box-sizing: border-box;\n outline: none;\n\n align-self: center;\n min-width: 0; // makes it truncate and prevents the select to grow wider than its container\n padding: 0 0.25rem 0 1rem;\n}\n\n.limel-select__selected-option__icon {\n margin-right: functions.pxToRem(8);\n margin-left: functions.pxToRem(-8);\n flex-shrink: 0;\n}\n\n.limel-select__selected-option__text {\n .mdc-select:not(.mdc-select--disabled) & {\n @include shared_input-select-picker.looks-like-input-label;\n }\n @include mixins.truncate-text;\n}\n\n.limel-select {\n flex-wrap: wrap;\n width: 100%;\n\n &:not(.limel-select--readonly) {\n .limel-select-trigger {\n background-color: shared_input-select-picker.$background-color-focused;\n }\n }\n\n .mdc-select__anchor {\n height: functions.pxToRem(36);\n padding-left: functions.pxToRem(0);\n }\n .limel-select-trigger {\n border: none;\n height: shared_input-select-picker.$height-of-mdc-text-field;\n display: inline-flex;\n align-items: center;\n\n border-radius: functions.pxToRem(5);\n\n .mdc-floating-label {\n color: shared_input-select-picker.$label-color;\n width: calc(\n 100% - #{functions.pxToRem(16)}\n ); //This forces the label to truncate when container is too little.\n &.mdc-floating-label--float-above {\n font-size: shared_input-select-picker.$cropped-label-hack--font-size;\n transform: translateY(functions.pxToRem(-27)) scale(0.75);\n }\n }\n }\n\n .limel-select-trigger,\n .limel-select__selected-option {\n width: 100%;\n }\n\n .mdc-select__dropdown-icon {\n margin-right: 0.25rem;\n margin-left: 0.25rem;\n }\n\n &.mdc-select--disabled:not(.limel-select--readonly) {\n .limel-select-trigger {\n @include shared_input-select-picker.looks-disabled;\n box-shadow: var(--button-shadow-normal);\n }\n .mdc-select__dropdown-icon {\n svg {\n fill: rgb(var(--contrast-800));\n }\n }\n }\n\n &:not(.mdc-select--disabled) {\n .mdc-select__dropdown-icon {\n svg {\n fill: rgb(var(--contrast-1000));\n }\n }\n\n .limel-select-trigger {\n @include mixins.is-elevated-clickable;\n @include mixins.visualize-keyboard-focus;\n\n &.limel-select--focused {\n background-color: shared_input-select-picker.$background-color-focused;\n\n .mdc-floating-label {\n color: var(--mdc-theme-primary);\n }\n\n .mdc-select__dropdown-icon {\n svg {\n fill: var(--mdc-theme-primary);\n }\n }\n\n .mdc-select__dropdown-icon-graphic {\n transform: rotate(-180deg);\n }\n }\n\n &[aria-expanded]:not([aria-expanded='false']),\n &[aria-expanded='true'] {\n box-shadow: var(--button-shadow-inset-pressed);\n }\n }\n }\n\n .readonly-option {\n position: absolute;\n top: 1.145rem;\n }\n\n &.limel-select--required {\n .mdc-floating-label::after {\n content: '*';\n }\n }\n\n &.limel-select--invalid {\n .limel-select__selected-option__text,\n .invalid-icon {\n color: var(--lime-error-text-color);\n }\n .mdc-floating-label:not(.mdc-floating-label--float-above) {\n max-width: calc(\n 100% - #{functions.pxToRem(64)}\n ); // leaves space for the invalid-icon\n }\n }\n}\n\n.invalid-icon {\n flex-shrink: 0;\n}\n\nselect.limel-select__native-control {\n position: absolute;\n top: 0;\n left: 0;\n\n width: 100%;\n height: 100%;\n opacity: 0;\n border: 0;\n}\n\n@import './partial-styles/_readonly';\n@import './partial-styles/_helper-text';\n","import { ListItem, ListSeparator } from '../list/list-item.types';\nimport { Option } from '../select/option.types';\nimport { MDCFloatingLabel } from '@material/floating-label';\nimport { MDCSelectHelperText } from '@material/select/helper-text';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { isMobileDevice } from '../../util/device';\nimport {\n ENTER,\n ENTER_KEY_CODE,\n SPACE,\n SPACE_KEY_CODE,\n} from '../../util/keycodes';\nimport { isMultiple } from '../../util/multiple';\nimport { createRandomString } from '../../util/random-string';\nimport { SelectTemplate, triggerIconColorWarning } from './select.template';\n\n/**\n * @exampleComponent limel-example-select\n * @exampleComponent limel-example-select-with-icons\n * @exampleComponent limel-example-select-with-separators\n * @exampleComponent limel-example-select-with-secondary-text\n * @exampleComponent limel-example-select-multiple\n * @exampleComponent limel-example-select-with-empty-option\n * @exampleComponent limel-example-select-preselected\n * @exampleComponent limel-example-select-change-options\n * @exampleComponent limel-example-select-dialog\n */\n@Component({\n tag: 'limel-select',\n shadow: true,\n styleUrl: 'select.scss',\n})\nexport class Select {\n /**\n * Set to `true` to make the field disabled.\n * and visually shows that the `select` component is editable but disabled.\n * This tells the users that if certain requirements are met,\n * the component may become interactable.\n */\n @Prop({ reflect: true })\n public disabled = false;\n\n /**\n * Set to `true` to make the field read-only.\n * This visualizes the component slightly differently.\n * But shows no visual sign indicating that the component is disabled\n * or can ever become interactable.\n */\n @Prop({ reflect: true })\n public readonly = false;\n\n /**\n * Set to `true` to indicate that the current value of the select is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid: boolean;\n\n /**\n * True if the control requires a value.\n */\n @Prop({ reflect: true })\n public required = false;\n\n /**\n * Text to display next to the select.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Optional helper text to display below the input field when it has focus.\n */\n @Prop({ reflect: true })\n public helperText: string;\n\n /**\n * Currently selected value or values.\n * If `multiple` is `true`, this must be an array. Otherwise it must be a\n * single value.\n */\n @Prop()\n public value: Option | Option[];\n\n /**\n * List of options.\n */\n @Prop()\n public options: Array<Option | ListSeparator> = [];\n\n /**\n * Set to `true` to allow multiple values to be selected.\n */\n @Prop()\n public multiple: boolean = false;\n\n /**\n * Emitted when the value is changed.\n */\n @Event()\n private change: EventEmitter<Option | Option[]>;\n\n @Element()\n private host: HTMLLimelSelectElement;\n\n @State()\n private menuOpen: boolean = false;\n\n private hasChanged: boolean = false;\n private checkValid: boolean = false;\n private mdcSelectHelperText: MDCSelectHelperText;\n private mdcFloatingLabel: MDCFloatingLabel;\n private isMobileDevice: boolean;\n private portalId: string;\n\n constructor() {\n this.handleMenuChange = this.handleMenuChange.bind(this);\n this.handleNativeChange = this.handleNativeChange.bind(this);\n this.handleMenuTriggerKeyPress =\n this.handleMenuTriggerKeyPress.bind(this);\n this.openMenu = this.openMenu.bind(this);\n this.closeMenu = this.closeMenu.bind(this);\n\n this.portalId = createRandomString();\n }\n\n public connectedCallback() {\n this.initialize();\n }\n\n public componentWillLoad() {\n this.isMobileDevice = isMobileDevice();\n\n // It should not be possible to render the native select for consumers, but we still want to make it testable.\n // We can set this attribute in tests to force rendering of the native select\n if (this.host.hasAttribute('data-native')) {\n this.isMobileDevice = true;\n }\n }\n\n public componentDidLoad() {\n this.initialize();\n triggerIconColorWarning(this.getOptionsExcludingSeparators());\n }\n\n private initialize() {\n let element: HTMLElement;\n element = this.host.shadowRoot.querySelector('.mdc-floating-label');\n if (!element) {\n return;\n }\n\n this.mdcFloatingLabel = new MDCFloatingLabel(element);\n\n element = this.host.shadowRoot.querySelector('.mdc-select-helper-text');\n if (element) {\n this.mdcSelectHelperText = new MDCSelectHelperText(element);\n }\n }\n\n public disconnectedCallback() {\n if (this.mdcFloatingLabel) {\n this.mdcFloatingLabel.destroy();\n }\n\n if (this.mdcSelectHelperText) {\n this.mdcSelectHelperText.destroy();\n }\n }\n\n public componentDidUpdate() {\n if (this.menuOpen) {\n this.setMenuFocus();\n }\n }\n\n public render() {\n const dropdownZIndex = getComputedStyle(this.host).getPropertyValue(\n '--dropdown-z-index',\n );\n\n return (\n <SelectTemplate\n id={this.portalId}\n disabled={this.disabled || this.readonly}\n readonly={this.readonly}\n required={this.required}\n invalid={this.invalid}\n label={this.label}\n helperText={this.helperText}\n value={this.value}\n options={this.options}\n onMenuChange={this.handleMenuChange}\n onNativeChange={this.handleNativeChange}\n onTriggerPress={this.handleMenuTriggerKeyPress}\n multiple={this.multiple}\n isOpen={this.menuOpen}\n open={this.openMenu}\n close={this.closeMenu}\n checkValid={this.checkValid}\n native={this.isMobileDevice}\n dropdownZIndex={dropdownZIndex}\n />\n );\n }\n\n @Watch('menuOpen')\n protected watchOpen(newValue: boolean, oldValue: boolean) {\n if (this.checkValid) {\n return;\n }\n\n // Menu was closed for the first time\n if (!newValue && oldValue) {\n this.checkValid = true;\n }\n }\n\n private setMenuFocus() {\n if (this.isMobileDevice) {\n return;\n }\n\n setTimeout(() => {\n const list: HTMLElement = document.querySelector(\n `#${this.portalId} limel-menu-surface limel-list`,\n );\n const firstItem: HTMLElement =\n list?.shadowRoot?.querySelector('[tabindex]');\n\n if (firstItem) {\n firstItem.focus();\n }\n });\n }\n\n private setTriggerFocus() {\n const trigger: HTMLElement = this.host.shadowRoot.querySelector(\n '.limel-select-trigger',\n );\n trigger.focus();\n }\n\n private handleMenuChange(\n event: CustomEvent<Array<ListItem<Option>> | ListItem<Option>>,\n ) {\n event.stopPropagation();\n\n if (isMultiple(event.detail)) {\n const selector = `#${this.portalId} limel-menu-surface`;\n const menuSurface = document\n .querySelector(selector)\n ?.shadowRoot?.querySelector('.mdc-menu-surface');\n const scrollPosition = menuSurface?.scrollTop || 0;\n\n const listItems: ListItem[] = event.detail;\n const options: Option[] = listItems.map((item) => item.value);\n this.change.emit(options);\n\n // Using a single requestAnimationFrame or setTimeout doesn't\n // work. Using two nested `requestAnimationFrame` worked most of\n // the time, but not always. Using `setTimeout` inside the\n // `requestAnimationFrame` seems to work consistently. /Ads\n requestAnimationFrame(() => {\n setTimeout(() => {\n menuSurface.scrollTop = scrollPosition;\n });\n });\n\n return;\n }\n\n if (!event.detail.selected) {\n return;\n }\n\n const listItem: ListItem = event.detail;\n const option: Option = listItem.value;\n if (option.disabled) {\n return;\n }\n\n this.change.emit(option);\n this.menuOpen = false;\n this.setTriggerFocus();\n }\n\n private openMenu() {\n if (this.emitFirstChangeEvent()) {\n this.hasChanged = true;\n this.change.emit(this.getOptionsExcludingSeparators()[0]);\n }\n\n this.menuOpen = true;\n }\n\n private emitFirstChangeEvent() {\n return !this.hasChanged && this.isMobileDevice && !this.value;\n }\n\n private closeMenu() {\n this.menuOpen = false;\n this.setTriggerFocus();\n }\n\n private handleMenuTriggerKeyPress(event: KeyboardEvent) {\n const isEnter = event.key === ENTER || event.keyCode === ENTER_KEY_CODE;\n const isSpace = event.key === SPACE || event.keyCode === SPACE_KEY_CODE;\n\n if (!this.menuOpen && (isSpace || isEnter)) {\n event.stopPropagation();\n event.preventDefault();\n this.menuOpen = true;\n }\n }\n\n private handleNativeChange(event: Event) {\n event.stopPropagation();\n\n const element: HTMLSelectElement = this.host.shadowRoot.querySelector(\n 'select.limel-select__native-control',\n );\n const options = Array.apply(null, element.options) // eslint-disable-line prefer-spread\n .filter((optionElement: HTMLOptionElement) => {\n return !!optionElement.selected;\n })\n .map((optionElement: HTMLOptionElement) => {\n return this.getOptionsExcludingSeparators().find(\n (o) => o.value === optionElement.value,\n );\n });\n\n if (this.multiple) {\n this.change.emit(options);\n\n return;\n }\n\n this.change.emit(options[0]);\n this.menuOpen = false;\n }\n\n private getOptionsExcludingSeparators(): Option[] {\n return this.options.filter(\n (option): option is Option => !('separator' in option),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;GAsBA,IAAIA,EAAU,CACVC,YAAa,cACbC,KAAM,QAEV,IAAIC,EAAa,CACbC,2BAA4B,yCAC5BC,sCAAuC;;;;;;;;;;;;;;;;;;;;;;GCH3C,IAAIC,EAA+C,SAAUC,GACzDC,EAAUF,EAA+BC,GACzC,SAASD,EAA8BG,GACnC,OAAOF,EAAOG,KAAKC,KAAMC,EAASA,EAAS,GAAIN,EAA8BO,gBAAiBJ,KAAaE,IACnH,CACIG,OAAOC,eAAeT,EAA+B,aAAc,CAC/DU,IAAK,WACD,OAAOb,CACnB,EACQc,WAAY,MACZC,aAAc,OAElBJ,OAAOC,eAAeT,EAA+B,UAAW,CAC5DU,IAAK,WACD,OAAOhB,CACnB,EACQiB,WAAY,MACZC,aAAc,OAElBJ,OAAOC,eAAeT,EAA+B,iBAAkB,CA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 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as e,g as r}from"./p-443111b3.js";import{t as a}from"./p-efd753ba.js";import{c as s}from"./p-96460db3.js";class o{constructor(){this.snackbarElements=[]}add(t){const i=this.getPopover(t);i===null||i===void 0?void 0:i.showPopover();this.snackbarElements=[t,...this.snackbarElements];this.emitOffsets()}remove(t){const i=this.getPopover(t);i===null||i===void 0?void 0:i.hidePopover();this.snackbarElements=this.snackbarElements.filter((i=>i!==t));this.emitOffsets()}emitOffsets(){let t=0;this.snackbarElements.forEach((i=>{i.dispatchEvent(new CustomEvent("changeOffset",{detail:t}));t+=this.getPopover(i).getBoundingClientRect().height}))}getPopover(t){return t.shadowRoot.querySelector("[popover]")}}const n="*{box-sizing:border-box}aside{background:none;border:none;inset:unset;overflow:visible;padding:0.5rem 0.5rem 0 0.5rem;right:0;width:var(--limel-snackbar-width, 21rem);top:calc(var(--snackbar-distance-to-top-edge) + env(safe-area-inset-top, 0));transition:opacity var(--limel-snackbar-opacity-transition-speed, 0.2s) ease, top var(--limel-snackbar-top-transition-speed, 0.46s) cubic-bezier(1, 0.09, 0, 0.89), transform var(--limel-snackbar-top-transition-speed, 0.46s) ease;transform:translate3d(0, 0, 0);opacity:1}aside.is-closing{transform:translate3d(2rem, 0, 0);opacity:0;--limel-snackbar-top-transition-speed:0.2s;--limel-snackbar-opacity-transition-speed:0.2s}.surface{overflow:hidden;padding:0.5rem;display:flex;align-items:center;justify-content:flex-start;gap:0.25rem;min-height:3.25rem;border-radius:0.75rem;background-color:rgb(var(--contrast-1400));box-shadow:var(--shadow-depth-8), var(--shadow-depth-16)}.label{color:rgb(var(--contrast-100));-webkit-font-smoothing:antialiased;font-size:0.8125rem;font-weight:400;padding:0 0.25rem;width:100%;flex-grow:1}.actions{display:flex;flex-shrink:0;align-items:center;box-sizing:border-box;gap:0.5rem}.dismiss,.actions{--lime-elevated-surface-background-color:rgb(\n var(--contrast-1300)\n )}.dismiss{--mdc-theme-on-surface:rgb(var(--contrast-100));--icon-background-color:var(--lime-elevated-surface-background-color);--fill-color:var(--mdc-theme-primary);--track-color:rgb(var(--contrast-800), 0.2);transition:opacity 0.1s ease, transform 0.1s ease;position:absolute;top:-0.375rem;left:-0.375rem;transform:scale(0.7);display:flex;align-items:center;justify-content:center}.dismiss svg{position:absolute;transform:rotate(90deg);fill:transparent;stroke-dasharray:100;stroke-linecap:round}aside:popover-open .dismiss svg{animation:timeout var(--snackbar-timeout) linear forwards}.dismiss .is-closing{transform:scale(0.5);opacity:0}.dismiss-button{transform:scale(0.8);margin:0;padding:0}@keyframes timeout{0%{stroke-width:4;stroke-dashoffset:0;opacity:1}100%{stroke-width:1;stroke-dashoffset:-100;opacity:0.7}}.limel-portal--container{font-family:var(--limel-portal-font-family, inherit);opacity:0;display:none}.limel-portal--container.is-visible{opacity:1;display:inline-block}.limel-portal--container.is-visible>*{will-change:opacity, transform}@keyframes fade-in{from{opacity:0;transform:scale(0.94)}to{opacity:1;transform:scale(1) translate3d(0, 0, 0)}}@keyframes fade-out{from{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(0.94) translate3d(0, 0, 0)}}.limel-portal--container>*{animation:fade-in 0.18s cubic-bezier(0.11, 0.59, 0.18, 1.26) forwards}.limel-portal--container.is-hiding>*{animation:fade-out 0.22s ease forwards}.limel-portal--container[data-popper-placement=left-start]>*{transform-origin:right top}.limel-portal--container[data-popper-placement=left]>*{transform-origin:right center}.limel-portal--container[data-popper-placement=left-end]>*{transform-origin:right bottom}.limel-portal--container[data-popper-placement=top-start]>*{transform-origin:left bottom}.limel-portal--container[data-popper-placement=top]>*{transform-origin:center bottom}.limel-portal--container[data-popper-placement=top-end]>*{transform-origin:right bottom}.limel-portal--container[data-popper-placement=right-start]>*{transform-origin:left top}.limel-portal--container[data-popper-placement=right]>*{transform-origin:left center}.limel-portal--container[data-popper-placement=right-end]>*{transform-origin:left bottom}.limel-portal--container[data-popper-placement=bottom-start]>*{transform-origin:left top}.limel-portal--container[data-popper-placement=bottom]>*{transform-origin:center top}.limel-portal--container[data-popper-placement=bottom-end]>*{transform-origin:right top}";const l=new o;const c=300;const p=class{constructor(e){t(this,e);this.action=i(this,"action",7);this.hide=i(this,"hide",7);this.handleOpen=()=>{if(this.isOpen){return}this.isOpen=true;this.closing=false;l.add(this.host);if(this.timeout&&this.timeout!==-1){this.timeoutId=window.setTimeout(this.handleClose,Math.max(this.timeout-c,c))}};this.handleClose=()=>{if(!this.isOpen){return}this.closing=true;if(this.timeoutId){clearTimeout(this.timeoutId);this.timeoutId=undefined}setTimeout((()=>{this.isOpen=false;l.remove(this.host);this.hide.emit();this.offset=0}),c)};this.handleClickAction=()=>{this.action.emit()};this.open=false;this.message=undefined;this.timeout=5e3;this.actionText=undefined;this.dismissible=true;this.multiline=undefined;this.language="en";this.offset=0;this.isOpen=false;this.closing=true;this.snackbarId=s()}componentDidLoad(){if(this.open){requestAnimationFrame(this.handleOpen)}}onChangeIndex(t){t.stopPropagation();this.offset=t.detail}watchOpen(){if(this.open){this.handleOpen()}else{this.handleClose()}this.isOpen=this.open}async show(){console.warn("The `show` method in `limel-snackbar` is deprecated. Please use the `open` property instead.");if(!this.open){this.handleOpen()}}render(){return e("aside",{popover:"manual",style:{"--snackbar-timeout":`${Math.max(this.timeout||0,0)}ms`,"--snackbar-distance-to-top-edge":`${this.offset}px`},class:{open:this.open,"is-closing":this.closing,"limel-portal--parent":true},id:this.snackbarId,role:this.setAriaRoles(),"aria-relevant":this.open?"additions":undefined},e("div",{class:"surface","aria-atomic":"false"},e("div",{class:"label"},this.message),this.renderActions(this.actionText),this.renderDismissButton(this.dismissible)))}setAriaRoles(){if(!this.open){return undefined}if(!this.timeout||this.timeout===-1){return"alertdialog"}return"status"}renderActions(t){if(!t){return}return e("div",{class:"actions","aria-atomic":"true"},this.renderActionButton(t))}renderActionButton(t){if(!t){return}return e("limel-button",{label:t,onClick:this.handleClickAction})}renderDismissButton(t){if(!t){return}const i=a.get("snackbar.dismiss",this.language);return e("div",{class:"dismiss"},this.renderTimeoutVisualization(),e("limel-icon-button",{class:"dismiss-button",icon:"multiply",label:i,onClick:this.handleClose,"aria-controls":this.snackbarId}))}renderTimeoutVisualization(){if(!this.timeout||this.timeout===-1){return}return e("svg",{width:"36",height:"36",viewBox:"0 0 36 36"},e("circle",{r:"18",cx:"18",cy:"18",fill:"var(--track-color)"}),e("path",{class:"track",d:"M 18,18 m -16,0 a 16,16 0 1,0 32,0 a 16,16 0 1,0 -32,0",stroke:"var(--fill-color)"}))}get host(){return r(this)}static get watchers(){return{open:["watchOpen"]}}};p.style=n;export{p as limel_snackbar};
|
|
2
|
-
//# sourceMappingURL=p-37dd03bf.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["SnackbarContainer","constructor","this","snackbarElements","add","snackbar","popover","getPopover","showPopover","emitOffsets","remove","hidePopover","filter","item","offset","forEach","dispatchEvent","CustomEvent","detail","getBoundingClientRect","height","shadowRoot","querySelector","snackbarCss","container","hideAnimationDuration","Snackbar","hostRef","handleOpen","isOpen","closing","host","timeout","timeoutId","window","setTimeout","handleClose","Math","max","clearTimeout","undefined","hide","emit","handleClickAction","action","snackbarId","createRandomString","componentDidLoad","open","requestAnimationFrame","onChangeIndex","event","stopPropagation","watchOpen","async","console","warn","render","h","style","class","id","role","setAriaRoles","message","renderActions","actionText","renderDismissButton","dismissible","renderActionButton","label","onClick","translate","get","language","renderTimeoutVisualization","icon","width","viewBox","r","cx","cy","fill","d","stroke"],"sources":["./src/components/snackbar/container.ts","./src/components/snackbar/snackbar.scss?tag=limel-snackbar&encapsulation=shadow","./src/components/snackbar/snackbar.tsx"],"sourcesContent":["/**\n * Container to keep track of all snackbar elements that gets added to the page.\n * When an element gets added or removed, the container will emit a\n * `changeOffset` event on all elements in the container, letting them know\n * the new offset to where they should position themselves.\n */\nexport class SnackbarContainer {\n private snackbarElements: HTMLLimelSnackbarElement[] = [];\n\n /**\n * Add a new element to the container\n *\n * @param snackbar - element to add\n */\n public add(snackbar: HTMLLimelSnackbarElement) {\n const popover = this.getPopover(snackbar);\n\n // Stencil does not seem to recognise the existance of showPopover\n // @ts-ignore\n popover?.showPopover();\n\n this.snackbarElements = [snackbar, ...this.snackbarElements];\n this.emitOffsets();\n }\n\n /**\n * Remove an element from the container\n *\n * @param snackbar - element to remove\n */\n public remove(snackbar: HTMLLimelSnackbarElement): void {\n const popover = this.getPopover(snackbar);\n\n // Stencil does not seem to recognise the existance of hidePopover\n // @ts-ignore\n popover?.hidePopover();\n\n this.snackbarElements = this.snackbarElements.filter(\n (item) => item !== snackbar,\n );\n this.emitOffsets();\n }\n\n private emitOffsets() {\n let offset = 0;\n this.snackbarElements.forEach((snackbar) => {\n snackbar.dispatchEvent(\n new CustomEvent('changeOffset', {\n detail: offset,\n }),\n );\n offset += this.getPopover(snackbar).getBoundingClientRect().height;\n });\n }\n\n private getPopover(snackbar: HTMLLimelSnackbarElement) {\n return snackbar.shadowRoot.querySelector('[popover]');\n }\n}\n","* {\n box-sizing: border-box;\n}\n\naside {\n background: none;\n border: none;\n inset: unset;\n overflow: visible;\n padding: 0.5rem 0.5rem 0 0.5rem;\n right: 0;\n\n width: var(--limel-snackbar-width, 21rem);\n top: calc(\n var(--snackbar-distance-to-top-edge) + env(safe-area-inset-top, 0)\n );\n\n transition:\n opacity var(--limel-snackbar-opacity-transition-speed, 0.2s) ease,\n top var(--limel-snackbar-top-transition-speed, 0.46s)\n cubic-bezier(1, 0.09, 0, 0.89),\n transform var(--limel-snackbar-top-transition-speed, 0.46s) ease;\n transform: translate3d(0, 0, 0);\n opacity: 1;\n\n &.is-closing {\n transform: translate3d(2rem, 0, 0);\n opacity: 0;\n --limel-snackbar-top-transition-speed: 0.2s;\n --limel-snackbar-opacity-transition-speed: 0.2s;\n }\n}\n\n.surface {\n overflow: hidden;\n\n padding: 0.5rem;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 0.25rem;\n\n min-height: 3.25rem;\n border-radius: 0.75rem;\n\n background-color: rgb(var(--contrast-1400));\n box-shadow: var(--shadow-depth-8), var(--shadow-depth-16);\n}\n\n.label {\n color: rgb(var(--contrast-100));\n\n -webkit-font-smoothing: antialiased;\n font-size: 0.8125rem;\n font-weight: 400;\n padding: 0 0.25rem;\n\n width: 100%;\n flex-grow: 1;\n}\n\n.actions {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n box-sizing: border-box;\n gap: 0.5rem;\n}\n\n.dismiss,\n.actions {\n --lime-elevated-surface-background-color: rgb(\n var(--contrast-1300)\n ); // background color of the buttons\n}\n\n.dismiss {\n --mdc-theme-on-surface: rgb(var(--contrast-100)); // color of the X icon\n --icon-background-color: var(--lime-elevated-surface-background-color);\n --fill-color: var(--mdc-theme-primary);\n --track-color: rgb(var(--contrast-800), 0.2);\n transition:\n opacity 0.1s ease,\n transform 0.1s ease;\n position: absolute;\n top: -0.375rem;\n left: -0.375rem;\n transform: scale(0.7);\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n svg {\n position: absolute;\n transform: rotate(90deg);\n fill: transparent;\n stroke-dasharray: 100;\n stroke-linecap: round;\n\n aside:popover-open & {\n animation: timeout var(--snackbar-timeout) linear forwards;\n }\n }\n\n .is-closing {\n transform: scale(0.5);\n opacity: 0;\n }\n}\n\n.dismiss-button {\n transform: scale(0.8);\n margin: 0;\n padding: 0;\n}\n\n@keyframes timeout {\n 0% {\n stroke-width: 4;\n stroke-dashoffset: 0;\n opacity: 1;\n }\n 100% {\n stroke-width: 1;\n stroke-dashoffset: -100;\n opacity: 0.7;\n }\n}\n\n@import '../portal/partial-styles/portal-container.scss';\n","import { Languages } from '../date-picker/date.types';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Listen,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport translate from '../../global/translations';\nimport { SnackbarContainer } from './container';\nimport { createRandomString } from 'src/util/random-string';\n\nconst container = new SnackbarContainer();\nconst hideAnimationDuration = 300;\n\n/**\n * A Snackbar –also known as \"Toast\"– is used to inform the end user\n * about an action or a process in the system.\n * The information could vary from announcing that a process has just started,\n * is taking place now, has ended, or has been interrupted or canceled.\n *\n * The information that you provide using a snackbar should be:\n * - temporary\n * - contextual\n * - short\n * - and most importantly, ignorable.\n *\n * It means if the user misses the information, it shouldn't be a big deal.\n *\n * :::note\n * If the information you want to display has a higher importance or priority,\n * and you need to make sure that the user takes an action to dismiss it,\n * consider using the [Banner](/#/component/limel-banner/) component instead.\n * For more complex interactions and for delivering more detailed information,\n * [Dialog](/#/component/limel-dialog/) is a better choice.\n * :::\n *\n * @exampleComponent limel-example-snackbar\n * @exampleComponent limel-example-snackbar-with-action\n * @exampleComponent limel-example-snackbar-with-changing-messages\n * @exampleComponent limel-example-snackbar-dismissible\n * @exampleComponent limel-example-snackbar-persistent\n * @exampleComponent limel-example-snackbar-persistent-non-dismissible\n */\n@Component({\n tag: 'limel-snackbar',\n shadow: true,\n styleUrl: 'snackbar.scss',\n})\nexport class Snackbar {\n /**\n * `true` if the snackbar is open, `false` otherwise.\n */\n @Prop({ reflect: true })\n public open: boolean = false;\n\n /**\n * The text message to display.\n */\n @Prop()\n public message: string;\n\n /**\n * The amount of time in milliseconds to show the snackbar.\n * If set to `-1`, the snackbar will be persistent.\n * This means:\n * - either the end user will need to close it manually,\n * which requires the `dismissible` property to be set to `true`.\n * - or the snackbar needs to be closed programmatically.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line no-magic-numbers\n public timeout?: number = 5000;\n\n /**\n * The text to display for the action button.\n */\n @Prop()\n public actionText: string;\n\n /**\n * When `true` displays a dismiss button on the snackbar,\n * allowing users to close it.\n */\n @Prop()\n public dismissible: boolean = true;\n\n /**\n * Whether to show the snackbar with space for multiple lines of text\n * @deprecated Setting this property no longer has any effect. The property will be removed in a future major version.\n */\n @Prop()\n public multiline: boolean;\n\n /**\n * Defines the language for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n @Element()\n private host: HTMLLimelSnackbarElement;\n\n /**\n * Emitted when the action button is pressed\n */\n @Event()\n private action: EventEmitter<void>;\n\n /**\n * Emitted when the snackbar hides itself\n */\n @Event()\n private hide: EventEmitter<void>;\n\n @State()\n private offset: number = 0;\n\n @State()\n private isOpen: boolean = false;\n\n @State()\n private closing: boolean = true;\n\n private snackbarId: string;\n private timeoutId?: number;\n\n public constructor() {\n this.snackbarId = createRandomString();\n }\n\n public componentDidLoad() {\n if (this.open) {\n requestAnimationFrame(this.handleOpen);\n }\n }\n\n @Listen('changeOffset')\n protected onChangeIndex(event: CustomEvent<number>) {\n event.stopPropagation();\n this.offset = event.detail;\n }\n\n @Watch('open')\n protected watchOpen() {\n if (this.open) {\n this.handleOpen();\n } else {\n this.handleClose();\n }\n\n this.isOpen = this.open;\n }\n\n /**\n * Show the snackbar\n * @deprecated Use the `open` property instead.\n */\n @Method()\n public async show() {\n // eslint-disable-next-line no-console\n console.warn(\n 'The `show` method in `limel-snackbar` is deprecated. Please use the `open` property instead.',\n );\n if (!this.open) {\n this.handleOpen();\n }\n }\n\n public handleOpen = () => {\n if (this.isOpen) {\n return;\n }\n\n this.isOpen = true;\n this.closing = false;\n container.add(this.host);\n\n if (this.timeout && this.timeout !== -1) {\n this.timeoutId = window.setTimeout(\n this.handleClose,\n Math.max(\n this.timeout - hideAnimationDuration,\n hideAnimationDuration,\n ),\n );\n }\n };\n\n private handleClose = () => {\n if (!this.isOpen) {\n return;\n }\n\n this.closing = true;\n\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n this.timeoutId = undefined;\n }\n\n setTimeout(() => {\n this.isOpen = false;\n container.remove(this.host);\n this.hide.emit();\n this.offset = 0;\n }, hideAnimationDuration);\n };\n\n public render() {\n return (\n <aside\n popover=\"manual\"\n style={{\n '--snackbar-timeout': `${Math.max(this.timeout || 0, 0)}ms`,\n '--snackbar-distance-to-top-edge': `${this.offset}px`,\n }}\n class={{\n open: this.open,\n 'is-closing': this.closing,\n 'limel-portal--parent': true,\n }}\n id={this.snackbarId}\n role={this.setAriaRoles()}\n aria-relevant={this.open ? 'additions' : undefined}\n >\n <div class=\"surface\" aria-atomic=\"false\">\n <div class=\"label\">{this.message}</div>\n {this.renderActions(this.actionText)}\n {this.renderDismissButton(this.dismissible)}\n </div>\n </aside>\n );\n }\n\n private setAriaRoles() {\n if (!this.open) {\n return undefined;\n }\n\n if (!this.timeout || this.timeout === -1) {\n return 'alertdialog';\n }\n\n return 'status';\n }\n\n private handleClickAction = () => {\n this.action.emit();\n };\n\n private renderActions(actionText: string) {\n if (!actionText) {\n return;\n }\n\n return (\n <div class=\"actions\" aria-atomic=\"true\">\n {this.renderActionButton(actionText)}\n </div>\n );\n }\n\n private renderActionButton(actionText: string) {\n if (!actionText) {\n return;\n }\n\n return (\n <limel-button label={actionText} onClick={this.handleClickAction} />\n );\n }\n\n private renderDismissButton(dismissible: boolean) {\n if (!dismissible) {\n return;\n }\n\n const label = translate.get('snackbar.dismiss', this.language);\n\n return (\n <div class=\"dismiss\">\n {this.renderTimeoutVisualization()}\n <limel-icon-button\n class=\"dismiss-button\"\n icon=\"multiply\"\n label={label}\n onClick={this.handleClose}\n aria-controls={this.snackbarId}\n />\n </div>\n );\n }\n\n private renderTimeoutVisualization() {\n if (!this.timeout || this.timeout === -1) {\n return;\n }\n\n return (\n <svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\">\n <circle r=\"18\" cx=\"18\" cy=\"18\" fill=\"var(--track-color)\" />\n <path\n class=\"track\"\n d=\"M 18,18 m -16,0 a 16,16 0 1,0 32,0 a 16,16 0 1,0 -32,0\"\n stroke=\"var(--fill-color)\"\n />\n </svg>\n );\n }\n}\n"],"mappings":"uIAMaA,EAAbC,cACYC,KAAAC,iBAA+C,E,CAOhDC,IAAIC,GACP,MAAMC,EAAUJ,KAAKK,WAAWF,GAIhCC,IAAO,MAAPA,SAAO,SAAPA,EAASE,cAETN,KAAKC,iBAAmB,CAACE,KAAaH,KAAKC,kBAC3CD,KAAKO,a,CAQFC,OAAOL,GACV,MAAMC,EAAUJ,KAAKK,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