@limetech/lime-elements 40.19.0 → 40.20.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/keyboard-navigation-VyqkMDKy.js +152 -0
  3. package/dist/cjs/lime-elements.cjs.js +1 -1
  4. package/dist/cjs/{limel-breadcrumbs_6.cjs.entry.js → limel-badge_7.cjs.entry.js} +33 -0
  5. package/dist/cjs/limel-chart.cjs.entry.js +51361 -269
  6. package/dist/cjs/limel-tab-bar.cjs.entry.js +6 -149
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/collection/components/chart/chart.css +63 -927
  9. package/dist/collection/components/chart/chart.js +330 -288
  10. package/dist/collection/components/chart/options.js +572 -0
  11. package/dist/collection/components/chart/scale.js +193 -0
  12. package/dist/collection/components/chart/theme.js +133 -0
  13. package/dist/collection/components/scroller/scroller.js +1 -1
  14. package/dist/esm/keyboard-navigation-BF7IKmnG.js +147 -0
  15. package/dist/esm/{keycodes-Bu6-QXrA.js → keycodes-DQ5DmW_Y.js} +1 -1
  16. package/dist/esm/lime-elements.js +1 -1
  17. package/dist/esm/{limel-breadcrumbs_6.entry.js → limel-badge_7.entry.js} +36 -4
  18. package/dist/esm/limel-chart.entry.js +51362 -270
  19. package/dist/esm/limel-chip-set.entry.js +1 -1
  20. package/dist/esm/limel-chip_2.entry.js +1 -1
  21. package/dist/esm/limel-pagination-jump.entry.js +1 -1
  22. package/dist/esm/limel-picker.entry.js +2 -2
  23. package/dist/esm/limel-popover_2.entry.js +1 -1
  24. package/dist/esm/limel-resize-handle.entry.js +1 -1
  25. package/dist/esm/limel-select.entry.js +2 -2
  26. package/dist/esm/limel-side-panel.entry.js +1 -1
  27. package/dist/esm/limel-tab-bar.entry.js +2 -145
  28. package/dist/esm/limel-text-editor-link-menu.entry.js +1 -1
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/esm/{typeahead-DOlnT3wh.js → typeahead-B4PwrlM3.js} +1 -1
  31. package/dist/lime-elements/lime-elements.esm.js +1 -1
  32. package/dist/lime-elements/{p-d4702653.entry.js → p-07f3565b.entry.js} +1 -1
  33. package/dist/lime-elements/{p-0910aefc.entry.js → p-22e9e327.entry.js} +1 -1
  34. package/dist/lime-elements/{p-7bf3bf8a.entry.js → p-23067836.entry.js} +1 -1
  35. package/dist/lime-elements/{p-7f0743d6.entry.js → p-56e2fa48.entry.js} +1 -1
  36. package/dist/lime-elements/{p-af7d07fd.entry.js → p-5e408c27.entry.js} +1 -1
  37. package/dist/lime-elements/{p-843886fe.entry.js → p-7fcd48c6.entry.js} +1 -1
  38. package/dist/lime-elements/p-8514480b.entry.js +56 -0
  39. package/dist/lime-elements/{p-fYs7n6yY.js → p-DNYOwOWu.js} +1 -1
  40. package/dist/lime-elements/{p-Bu6-QXrA.js → p-DQ5DmW_Y.js} +1 -1
  41. package/dist/lime-elements/p-_1yBt1pG.js +1 -0
  42. package/dist/lime-elements/p-a807a45f.entry.js +159 -0
  43. package/dist/lime-elements/{p-45572e9d.entry.js → p-c8a34cef.entry.js} +1 -1
  44. package/dist/lime-elements/{p-4834e7c1.entry.js → p-cd479c23.entry.js} +1 -1
  45. package/dist/lime-elements/p-cf2d43c7.entry.js +1 -0
  46. package/dist/lime-elements/{p-94ae27e2.entry.js → p-f3b93ce8.entry.js} +2 -2
  47. package/dist/types/components/chart/chart.d.ts +51 -52
  48. package/dist/types/components/chart/chart.types.d.ts +5 -0
  49. package/dist/types/components/chart/options.d.ts +88 -0
  50. package/dist/types/components/chart/scale.d.ts +101 -0
  51. package/dist/types/components/chart/theme.d.ts +52 -0
  52. package/dist/types/components.d.ts +7 -38
  53. package/package.json +2 -1
  54. package/dist/cjs/limel-badge.cjs.entry.js +0 -37
  55. package/dist/esm/limel-badge.entry.js +0 -35
  56. package/dist/lime-elements/p-02aac2c0.entry.js +0 -1
  57. package/dist/lime-elements/p-38ab193f.entry.js +0 -1
  58. package/dist/lime-elements/p-3ca188f6.entry.js +0 -159
  59. package/dist/lime-elements/p-f7a90228.entry.js +0 -1
@@ -0,0 +1,101 @@
1
+ import { ChartItem, ChartType } from './chart.types';
2
+ /**
3
+ * The most steps that an `axisIncrement` may divide a value axis into.
4
+ */
5
+ export declare const MAX_AXIS_STEPS = 100;
6
+ export interface AxisRange {
7
+ minValue: number;
8
+ maxValue: number;
9
+ totalRange: number;
10
+ /** Step between adjacent axis lines, used to render the grid. */
11
+ increment: number;
12
+ }
13
+ /**
14
+ * Whether the items of a chart of this type are parts of one whole.
15
+ * @param type - the chart type
16
+ */
17
+ export declare function isPartOfWhole(type: ChartType): boolean;
18
+ /**
19
+ * Whether a chart of this type draws its value axis in steps of
20
+ * `axisIncrement`.
21
+ * @param type - the chart type
22
+ */
23
+ export declare function usesAxisIncrement(type: ChartType): boolean;
24
+ /**
25
+ * Whether the item has a `[start, end]` range, or an `[x, y]` point in a
26
+ * `scatter` chart, as its value.
27
+ * @param item - the item
28
+ */
29
+ export declare function isRangeItem(item: ChartItem): item is ChartItem<[number, number]>;
30
+ /**
31
+ * The lower end of the item's range, or its value.
32
+ * @param item - the item
33
+ */
34
+ export declare function getMinimumValue(item: ChartItem): number;
35
+ /**
36
+ * The upper end of the item's range, or its value.
37
+ * @param item - the item
38
+ */
39
+ export declare function getMaximumValue(item: ChartItem): number;
40
+ /**
41
+ * The extent of the item's range, or its value measured from zero.
42
+ * @param item - the item
43
+ */
44
+ export declare function getValueSpan(item: ChartItem): number;
45
+ /**
46
+ * The first value of a `scatter` point.
47
+ * @param item - the point
48
+ */
49
+ export declare function getXValue(item: ChartItem): number;
50
+ /**
51
+ * The second value of a `scatter` point.
52
+ * @param item - the point
53
+ */
54
+ export declare function getYValue(item: ChartItem): number;
55
+ /**
56
+ * The value axis of a `bar`, `dot`, `area` or `line` chart. It reaches from
57
+ * zero, or from the smallest value when that is below zero, up to `maxValue`
58
+ * or the largest value. Both ends are rounded outwards to a whole step.
59
+ * Without an `axisIncrement` above zero, or with one that would divide the
60
+ * axis into more than `MAX_AXIS_STEPS` steps, the step divides the axis into
61
+ * about ten.
62
+ * @param items - the items in the chart
63
+ * @param maxValue - the requested upper bound, if any
64
+ * @param axisIncrement - the requested step, if any
65
+ */
66
+ export declare function getAxisRange(items: ChartItem[], maxValue?: number, axisIncrement?: number): AxisRange;
67
+ /**
68
+ * The range of a chart whose items are parts of one whole: `maxValue`
69
+ * when set, otherwise the combined item values or range extents. The value
70
+ * is a scale, not a cap, so the combined size can exceed it. The whole is
71
+ * not rounded to an axis step, since these types draw no axis and an item's
72
+ * size has to be its exact share.
73
+ * @param items - the items in the chart
74
+ * @param maxValue - the whole, if set
75
+ */
76
+ export declare function getWholeRange(items: ChartItem[], maxValue?: number): AxisRange;
77
+ /**
78
+ * The two value axes of a `scatter` chart: `x` for each point's first value
79
+ * and `y` for its second. Each axis derives its own range and step from its
80
+ * own zero-anchored span, so positive, negative, and zero-crossing data all
81
+ * grid sensibly.
82
+ * @param items - the points in the chart
83
+ */
84
+ export declare function getScatterRanges(items: ChartItem[]): {
85
+ x: AxisRange;
86
+ y: AxisRange;
87
+ };
88
+ /**
89
+ * An item's share of the whole, in percent.
90
+ * @param item - the item
91
+ * @param whole - the range from `getWholeRange`
92
+ */
93
+ export declare function getShare(item: ChartItem, whole: AxisRange): number;
94
+ /**
95
+ * The item's value as text: its `formattedValue` when set, otherwise its
96
+ * value, range, or scatter point.
97
+ * @param item - the item
98
+ * @param type - the chart type
99
+ */
100
+ export declare function formatValue(item: ChartItem, type: ChartType): string;
101
+ //# sourceMappingURL=scale.d.ts.map
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The colors, sizes and font a chart is drawn with. ECharts cannot read CSS
3
+ * custom properties, so they are resolved from the chart's styles into plain
4
+ * values.
5
+ */
6
+ export interface ChartTheme {
7
+ itemColor: string;
8
+ /** The line, and the area under it, of `line` and `area` charts. */
9
+ lineColor: string;
10
+ axisLineColor: string;
11
+ textColor: string;
12
+ backgroundColor: string;
13
+ dividerColor: string;
14
+ surfaceColor: string;
15
+ /** In pixels. */
16
+ itemBorderRadius: number;
17
+ /** In pixels. */
18
+ scatterItemSize: number;
19
+ fontFamily: string;
20
+ npsColors: [string, string, string, string];
21
+ animate: boolean;
22
+ }
23
+ /**
24
+ * Reads colors and lengths as the chart's own styles resolve them.
25
+ */
26
+ export interface ThemeReader {
27
+ /**
28
+ * The color as `rgb()` or `rgba()`, or `undefined` when the value is not
29
+ * a color.
30
+ * @param value - any CSS color, which may use custom properties
31
+ */
32
+ color(value: string): string | undefined;
33
+ theme(): ChartTheme;
34
+ dispose(): void;
35
+ }
36
+ /**
37
+ * Creates a reader that resolves values in the given shadow root, where the
38
+ * chart's private custom properties are defined.
39
+ * @param root - the chart's shadow root
40
+ */
41
+ export declare function createThemeReader(root: ShadowRoot): ThemeReader;
42
+ /**
43
+ * Calls back when the theme of the chart may have changed: when the color
44
+ * scheme or the reduced motion preference of the system changes, the
45
+ * `data-theme` attribute of the page does, or the `style` or `class`
46
+ * attribute of the chart does.
47
+ * @param host - the chart
48
+ * @param onChange - called on every change
49
+ * @returns a function that stops watching
50
+ */
51
+ export declare function watchTheme(host: HTMLElement, onChange: () => void): () => void;
52
+ //# sourceMappingURL=theme.d.ts.map
@@ -16,7 +16,7 @@ import { Button } from "./components/button/button.types";
16
16
  import { CalloutType } from "./components/callout/callout.types";
17
17
  import { Image } from "./global/shared-types/image.types";
18
18
  import { ListSeparator as ListSeparator1 } from "./global/shared-types/separator.types";
19
- import { ChartItem } from "./components/chart/chart.types";
19
+ import { ChartItem, ChartType } from "./components/chart/chart.types";
20
20
  import { Label, LabelValue } from "./components/dynamic-label/label.types";
21
21
  import { Link } from "./global/shared-types/link.types";
22
22
  import { Chip, ChipType } from "./components/chip-set/chip.types";
@@ -68,7 +68,7 @@ export { Button } from "./components/button/button.types";
68
68
  export { CalloutType } from "./components/callout/callout.types";
69
69
  export { Image } from "./global/shared-types/image.types";
70
70
  export { ListSeparator as ListSeparator1 } from "./global/shared-types/separator.types";
71
- export { ChartItem } from "./components/chart/chart.types";
71
+ export { ChartItem, ChartType } from "./components/chart/chart.types";
72
72
  export { Label, LabelValue } from "./components/dynamic-label/label.types";
73
73
  export { Link } from "./global/shared-types/link.types";
74
74
  export { Chip, ChipType } from "./components/chip-set/chip.types";
@@ -547,7 +547,6 @@ export namespace Components {
547
547
  * @exampleComponent limel-example-chart-accessibility
548
548
  * @exampleComponent limel-example-chart-axis-labels
549
549
  * @exampleComponent limel-example-chart-styling
550
- * @exampleComponent limel-example-chart-creative-styling
551
550
  * @beta
552
551
  */
553
552
  interface LimelChart {
@@ -564,7 +563,7 @@ export namespace Components {
564
563
  */
565
564
  "accessibleValuesLabel"?: string;
566
565
  /**
567
- * Sets the axis increment for `bar`, `dot`, `area`, and `line` charts. Has no effect on other chart types.
566
+ * Sets the axis increment for `bar`, `dot`, `area`, and `line` charts. When it is not set, or not above zero, the chart works out a step from the values. It also does that when the step would divide the axis into more than 100 parts, so that it does not draw too many lines. Has no effect on other chart types.
568
567
  */
569
568
  "axisIncrement"?: number;
570
569
  /**
@@ -614,16 +613,7 @@ export namespace Components {
614
613
  * Defines how items are visualized in the chart.
615
614
  * @default 'stacked-bar'
616
615
  */
617
- "type"?: | 'area'
618
- | 'bar'
619
- | 'doughnut'
620
- | 'line'
621
- | 'nps'
622
- | 'pie'
623
- | 'ring'
624
- | 'dot'
625
- | 'scatter'
626
- | 'stacked-bar';
616
+ "type"?: ChartType;
627
617
  }
628
618
  /**
629
619
  * The Checkbox component is a classic and essential element in UI design that allows
@@ -5018,7 +5008,6 @@ declare global {
5018
5008
  * @exampleComponent limel-example-chart-accessibility
5019
5009
  * @exampleComponent limel-example-chart-axis-labels
5020
5010
  * @exampleComponent limel-example-chart-styling
5021
- * @exampleComponent limel-example-chart-creative-styling
5022
5011
  * @beta
5023
5012
  */
5024
5013
  interface HTMLLimelChartElement extends Components.LimelChart, HTMLStencilElement {
@@ -7792,7 +7781,6 @@ declare namespace LocalJSX {
7792
7781
  * @exampleComponent limel-example-chart-accessibility
7793
7782
  * @exampleComponent limel-example-chart-axis-labels
7794
7783
  * @exampleComponent limel-example-chart-styling
7795
- * @exampleComponent limel-example-chart-creative-styling
7796
7784
  * @beta
7797
7785
  */
7798
7786
  interface LimelChart {
@@ -7809,7 +7797,7 @@ declare namespace LocalJSX {
7809
7797
  */
7810
7798
  "accessibleValuesLabel"?: string;
7811
7799
  /**
7812
- * Sets the axis increment for `bar`, `dot`, `area`, and `line` charts. Has no effect on other chart types.
7800
+ * Sets the axis increment for `bar`, `dot`, `area`, and `line` charts. When it is not set, or not above zero, the chart works out a step from the values. It also does that when the step would divide the axis into more than 100 parts, so that it does not draw too many lines. Has no effect on other chart types.
7813
7801
  */
7814
7802
  "axisIncrement"?: number;
7815
7803
  /**
@@ -7863,16 +7851,7 @@ declare namespace LocalJSX {
7863
7851
  * Defines how items are visualized in the chart.
7864
7852
  * @default 'stacked-bar'
7865
7853
  */
7866
- "type"?: | 'area'
7867
- | 'bar'
7868
- | 'doughnut'
7869
- | 'line'
7870
- | 'nps'
7871
- | 'pie'
7872
- | 'ring'
7873
- | 'dot'
7874
- | 'scatter'
7875
- | 'stacked-bar';
7854
+ "type"?: ChartType;
7876
7855
  }
7877
7856
  /**
7878
7857
  * The Checkbox component is a classic and essential element in UI design that allows
@@ -12104,16 +12083,7 @@ declare namespace LocalJSX {
12104
12083
  "displayItemText": boolean;
12105
12084
  "displayItemValue": boolean;
12106
12085
  "displayItemPercentage": boolean;
12107
- "type": | 'area'
12108
- | 'bar'
12109
- | 'doughnut'
12110
- | 'line'
12111
- | 'nps'
12112
- | 'pie'
12113
- | 'ring'
12114
- | 'dot'
12115
- | 'scatter'
12116
- | 'stacked-bar';
12086
+ "type": ChartType;
12117
12087
  "orientation": 'landscape' | 'portrait';
12118
12088
  "maxValue": number;
12119
12089
  "axisIncrement": number;
@@ -13018,7 +12988,6 @@ declare module "@stencil/core" {
13018
12988
  * @exampleComponent limel-example-chart-accessibility
13019
12989
  * @exampleComponent limel-example-chart-axis-labels
13020
12990
  * @exampleComponent limel-example-chart-styling
13021
- * @exampleComponent limel-example-chart-creative-styling
13022
12991
  * @beta
13023
12992
  */
13024
12993
  "limel-chart": LocalJSX.IntrinsicElements["limel-chart"] & JSXBase.HTMLAttributes<HTMLLimelChartElement>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "40.19.0",
3
+ "version": "40.20.0",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -76,6 +76,7 @@
76
76
  "cross-env": "^10.1.0",
77
77
  "dayjs": "^1.11.23",
78
78
  "diff": "^9.0.0",
79
+ "echarts": "^6.1.0",
79
80
  "eslint": "^10.13.0",
80
81
  "flatpickr": "^4.6.13",
81
82
  "glob": "^13.0.6",
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('./index-BlsqxTB1.js');
4
- var format = require('./format-D4jZb7Ls.js');
5
- require('./_commonjsHelpers-CFO10eej.js');
6
-
7
- const badgeCss = () => `@charset "UTF-8";:host([hidden]){display:none}:host(limel-badge){--limel-min-badge-size:1rem;display:inline-flex;justify-content:center;align-items:center;flex-shrink:0;min-height:var(--limel-min-badge-size);min-width:var(--limel-min-badge-size);border-radius:var(--limel-min-badge-size)}span{cursor:default;box-sizing:border-box;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:center;font-size:0.6875rem;line-height:var(--limel-min-badge-size);color:var(--badge-text-color, rgb(var(--contrast-1200)));border-radius:var(--limel-min-badge-size);max-height:var(--limel-min-badge-size);min-width:0.5rem;min-height:0.5rem;background-color:var(--badge-background-color, rgb(var(--contrast-500)))}span:not(:empty){min-width:var(--limel-min-badge-size);max-width:var(--badge-max-width, 2.75rem);padding:0 0.28125rem}:host(.has-large-label) span{cursor:help}`;
8
-
9
- const Badge = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- }
13
- render() {
14
- return (index.h(index.Host, { key: 'b5fc1ffc51f34992c6a7e748b22a1c333b980724', title: this.labelIsLarge() ? this.label : '', class: {
15
- 'has-large-label': this.labelIsLarge(),
16
- } }, index.h("span", { key: '37c10595938a038dd7455751b21a949c88245e6a' }, this.renderLabel())));
17
- }
18
- renderLabel() {
19
- if (typeof this.label === 'number') {
20
- return format.abbreviate(this.label);
21
- }
22
- return this.label;
23
- }
24
- labelIsLarge() {
25
- const largeNumericLabel = 999;
26
- const largeStringLabel = 6;
27
- if ((typeof this.label === 'number' &&
28
- this.label > largeNumericLabel) ||
29
- (typeof this.label === 'string' &&
30
- this.label.length > largeStringLabel)) {
31
- return true;
32
- }
33
- }
34
- };
35
- Badge.style = badgeCss();
36
-
37
- exports.limel_badge = Badge;
@@ -1,35 +0,0 @@
1
- import { r as registerInstance, h, H as Host } from './index-BU9IJqli.js';
2
- import { a as abbreviate } from './format-hTrthuPP.js';
3
- import './_commonjsHelpers-B85MJLTf.js';
4
-
5
- const badgeCss = () => `@charset "UTF-8";:host([hidden]){display:none}:host(limel-badge){--limel-min-badge-size:1rem;display:inline-flex;justify-content:center;align-items:center;flex-shrink:0;min-height:var(--limel-min-badge-size);min-width:var(--limel-min-badge-size);border-radius:var(--limel-min-badge-size)}span{cursor:default;box-sizing:border-box;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:center;font-size:0.6875rem;line-height:var(--limel-min-badge-size);color:var(--badge-text-color, rgb(var(--contrast-1200)));border-radius:var(--limel-min-badge-size);max-height:var(--limel-min-badge-size);min-width:0.5rem;min-height:0.5rem;background-color:var(--badge-background-color, rgb(var(--contrast-500)))}span:not(:empty){min-width:var(--limel-min-badge-size);max-width:var(--badge-max-width, 2.75rem);padding:0 0.28125rem}:host(.has-large-label) span{cursor:help}`;
6
-
7
- const Badge = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- }
11
- render() {
12
- return (h(Host, { key: 'b5fc1ffc51f34992c6a7e748b22a1c333b980724', title: this.labelIsLarge() ? this.label : '', class: {
13
- 'has-large-label': this.labelIsLarge(),
14
- } }, h("span", { key: '37c10595938a038dd7455751b21a949c88245e6a' }, this.renderLabel())));
15
- }
16
- renderLabel() {
17
- if (typeof this.label === 'number') {
18
- return abbreviate(this.label);
19
- }
20
- return this.label;
21
- }
22
- labelIsLarge() {
23
- const largeNumericLabel = 999;
24
- const largeStringLabel = 6;
25
- if ((typeof this.label === 'number' &&
26
- this.label > largeNumericLabel) ||
27
- (typeof this.label === 'string' &&
28
- this.label.length > largeStringLabel)) {
29
- return true;
30
- }
31
- }
32
- };
33
- Badge.style = badgeCss();
34
-
35
- export { Badge as limel_badge };
@@ -1 +0,0 @@
1
- import{r as e,h as i,H as r}from"./p-BU9IJqli.js";import{a}from"./p-Bt64o80S.js";import"./p-B85MJLTf.js";const t=class{constructor(i){e(this,i)}render(){return i(r,{key:"b5fc1ffc51f34992c6a7e748b22a1c333b980724",title:this.labelIsLarge()?this.label:"",class:{"has-large-label":this.labelIsLarge()}},i("span",{key:"37c10595938a038dd7455751b21a949c88245e6a"},this.renderLabel()))}renderLabel(){return"number"==typeof this.label?a(this.label):this.label}labelIsLarge(){if("number"==typeof this.label&&this.label>999||"string"==typeof this.label&&this.label.length>6)return!0}};t.style='@charset "UTF-8";:host([hidden]){display:none}:host(limel-badge){--limel-min-badge-size:1rem;display:inline-flex;justify-content:center;align-items:center;flex-shrink:0;min-height:var(--limel-min-badge-size);min-width:var(--limel-min-badge-size);border-radius:var(--limel-min-badge-size)}span{cursor:default;box-sizing:border-box;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:center;font-size:0.6875rem;line-height:var(--limel-min-badge-size);color:var(--badge-text-color, rgb(var(--contrast-1200)));border-radius:var(--limel-min-badge-size);max-height:var(--limel-min-badge-size);min-width:0.5rem;min-height:0.5rem;background-color:var(--badge-background-color, rgb(var(--contrast-500)))}span:not(:empty){min-width:var(--limel-min-badge-size);max-width:var(--badge-max-width, 2.75rem);padding:0 0.28125rem}:host(.has-large-label) span{cursor:help}';export{t as limel_badge}
@@ -1 +0,0 @@
1
- import{r as t,c as e,h as r,a as o}from"./p-BU9IJqli.js";import{i}from"./p-CnpoFRmN.js";import{g as a,b as l}from"./p-CgNJbSP4.js";import{A as n,b as s,H as c,e as b,c as d,d as h}from"./p-Bu6-QXrA.js";import{a as u,b as m,i as v,D as p}from"./p-DVx8ZwG_.js";import{S as g,c as f}from"./p-BqoaAMnl.js";import{b as w}from"./p-BuX-Eb_J.js";import"./p-CK4jS9_E.js";import"./p-xGeCwSnE.js";import"./p-BcJ-TDVt.js";import"./p-BJQylLSL.js";import"./p-BZrtP4vv.js";import"./p-oiMYqRQ0.js";import"./p-rJbGuVxd.js";import"./p-DbBZn7JO.js";import"./p-CZ30nDJE.js";import"./p-DpFfRQwV.js";import"./p-B8VKuhvH.js";import"./p-CzTSYn-I.js";import"./p-B--C3qwe.js";import"./p-9W8bTt2G.js";var x=m((function(t,e){return v(t)?function(t,e){var r=-1,o=u,i=!0,a=t.length,l=[],n=e.length;if(!a)return l;e.length>=200&&(o=f,i=!1,e=new g(e));t:for(;++r<a;){var s=t[r],c=s;if(s=0!==s?s:0,i&&c==c){for(var b=n;b--;)if(e[b]===c)continue t;l.push(s)}else o(e,c,undefined)||l.push(s)}return l}(t,w(e,1,v,!0)):[]}));const k={horizontal:new Map([[d,"previous"],[h,"next"],[c,"first"],[b,"last"]]),vertical:new Map([[n,"previous"],[s,"next"],[c,"first"],[b,"last"]])};function j(t,e){return t>=0&&t<e}function y(t,e){return r=>{var o;return!(null===(o=null==e?void 0:e.isDisabled)||void 0===o?void 0:o.call(e,t[r]))}}function C(t,e,r,o,i){for(let a=0;a<t;a+=1){const l=e+r*a;if(!o&&!j(l,t))break;const n=(l%t+t)%t;if(i(n))return n}return-1}const z=class{constructor(r){t(this,r),this.changeTab=e(this,"changeTab",7),this.reorderTab=e(this,"reorderTab",7),this.tabs=[],this.orientation="horizontal",this.allowTabReorder=!1,this.hasLoaded=!1,this.isLaidOutAgain=!1,this.renderedTabs=[],this.handleReorder=t=>{const e=function(t,e){const{order:r,fromIndex:o,toIndex:a}=e,l=e=>e>=0&&e<t.length;if(!l(o)||!l(a))return;const n=[...r];return n.splice(o,0,...n.splice(a,1)),i(n,t.map((({id:t})=>String(t))))?{tab:t[o],fromIndex:o,toIndex:a}:void 0}(this.tabs,t);if(!e)return;const r=this.tabs.map((({id:t})=>t));r.splice(e.toIndex,0,...r.splice(e.fromIndex,1)),this.tabIdsAfterReorder=r,this.reorderTab.emit(e)},this.handleKeyDown=this.handleKeyDown.bind(this)}async connectedCallback(){this.hasLoaded&&(this.revealedTabId=void 0,this.setUpReordering(),await this.revealActiveTab("auto"))}disconnectedCallback(){var t;null===(t=this.dragToReorder)||void 0===t||t.teardown()}componentDidLoad(){this.hasLoaded=!0,this.triggerIconColorWarning()}componentWillRender(){var t;const e=this.getTabElements().indexOf(this.host.shadowRoot.activeElement);this.tabWithFocus=-1===e?void 0:{id:null===(t=this.renderedTabs[e])||void 0===t?void 0:t.id,button:this.getTabElements()[e]}}async componentDidRender(){this.restoreFocus(),this.renderedTabs=this.tabs,this.setUpReordering();const t=this.isLaidOutAgain;this.isLaidOutAgain=!1,await this.revealActiveTab(!this.hasLoaded||t?"auto":void 0,t)}render(){const t=function(t,e,r){const o=t.length,i=y(t,r);return j(e,o)&&i(e)?e:C(o,0,1,!1,i)}(this.tabs,this.tabs.findIndex((t=>t.active)),this.getNavigationOptions());return r("div",{key:"520c0e3987f3de626ca2c01809b42b504146eb76",role:"tablist","aria-orientation":this.getOrientation(),onKeyDown:this.handleKeyDown},r("limel-scroller",{key:"60512f257f8ef89cc0b6142ac80d515060bbbba0",orientation:this.getOrientation()},this.tabs.map(((e,r)=>this.renderTabOrMovableTab(e,r,r===t)))))}tabsChanged(t=[],e=[]){const r=t.map((t=>t.id)),o=e.map((t=>t.id));if(i(r,o))return;const a=this.tabIdsAfterReorder;this.tabIdsAfterReorder=void 0,i(r,a)||(this.revealedTabId=void 0)}orientationChanged(){this.revealedTabId=void 0,this.isLaidOutAgain=!0}getOrientation(){return"vertical"===this.orientation?"vertical":"horizontal"}getNavigationOptions(){return{orientation:this.getOrientation(),wrap:!0}}restoreFocus(){var t;const e=this.tabWithFocus;if(this.tabWithFocus=void 0,!e||e.button.isConnected)return;const r=this.tabs.findIndex((t=>t.id===e.id));null===(t=this.getTabElements()[r])||void 0===t||t.focus()}getTabElements(){return[...this.host.shadowRoot.querySelectorAll('button[role="tab"]')]}canReorderTabs(){return this.allowTabReorder&&this.tabs.length>1}setUpReordering(){var t,e;if(!this.canReorderTabs())return void(null===(t=this.dragToReorder)||void 0===t||t.teardown());const r=this.host.shadowRoot.querySelector("limel-scroller");r&&(null!==(e=this.dragToReorder)&&void 0!==e||(this.dragToReorder=new p({draggable:"[data-reorder-id]",revertDrop:!0,onReorder:this.handleReorder})),this.dragToReorder.setup(r,this.getOrientation()))}async revealActiveTab(t,e=!1){const r=this.tabs.findIndex((t=>t.active));if(-1===r)return void(this.revealedTabId=void 0);if(this.tabs[r].id===this.revealedTabId)return;this.revealedTabId=this.tabs[r].id;const o=this.getTabElements()[r],i=this.host.shadowRoot.querySelector("limel-scroller");o&&i&&(o.matches(":focus")&&!e||(await i.componentOnReady(),await i.reveal(o,t)))}handleKeyDown(t){const e=this.getNavigationOptions();if(!function(t,e){return!(t.altKey||t.ctrlKey||t.metaKey)&&k[e.orientation].has(t.key)}(t,e))return;const r=this.getTabElements().indexOf(t.target);-1!==r&&(t.preventDefault(),this.activateTab(function(t,e,r,o){const i=k[o.orientation].get(e),a=t.length,l=y(t,o),n=C(a,0,1,!1,l);if(!i||-1===n)return-1;if("first"===i)return n;const s=C(a,a-1,-1,!1,l);if("last"===i)return s;if(!j(r,a))return"next"===i?n:s;const c="next"===i?1:-1,b=C(a,r+c,c,Boolean(o.wrap),l);return-1===b?r:b}(this.tabs,t.key,r,e)))}activateTab(t){if(-1===t)return;if(this.getTabElements()[t].focus(),t===this.tabs.findIndex((t=>t.active)))return;const e=function(t,e){const r=t.findIndex((t=>!0===t.active)),o=[...t];return-1!==r&&(o[r]=Object.assign(Object.assign({},t[r]),{active:!1})),o[e]=Object.assign(Object.assign({},t[e]),{active:!0}),o}(this.tabs,t),r=x(e,this.tabs).sort(this.sortByInactive);for(const t of r)this.changeTab.emit(t);this.tabs=e}sortByInactive(t,e){return Number(t.active)-Number(e.active)}renderIcon(t){if(!t.icon)return;const e=a(t.icon),o=l(t.icon,t.iconColor),i={color:""};return o&&(i.color=o),r("limel-icon",{name:e,style:i,size:"small","aria-hidden":"true"})}renderTabOrMovableTab(t,e,o){return this.canReorderTabs()?r("div",{key:t.id,role:"presentation","data-reorder-id":t.id},this.renderTab(t,e,o),r("limel-drag-handle",{"aria-hidden":"true",dragDirection:this.getOrientation(),tooltipOpenDirection:"vertical"===this.getOrientation()?"right":"bottom"})):this.renderTab(t,e,o)}renderTab(t,e,o){return r("button",{key:t.id,role:"tab","aria-selected":t.active?"true":"false",tabindex:o?0:-1,onClick:()=>this.activateTab(e)},r("span",{class:"content"},this.renderIcon(t),r("span",{class:"text"},t.text),t.badge?r("limel-badge",{label:t.badge}):""))}triggerIconColorWarning(){this.tabs.some((t=>t.iconColor))&&console.warn("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'}`.")}get host(){return o(this)}static get watchers(){return{tabs:[{tabsChanged:0}],orientation:[{orientationChanged:0}]}}};z.style="@charset \"UTF-8\";:host(limel-tab-bar){--limel-tab-background-color:var(--contrast-300);--limel-tab-border-radius:0.625rem;--limel-tab-content-inset:0.25rem;--limel-active-tab-background-color:var( --tab-panel-background-color, rgb(var(--contrast-100)) );--limel-active-tab-color:var( --lime-primary-color, var(--limel-theme-primary-color) );--limel-tab-active-outer-edge-curve-size:0.75rem;--limel-tab-separator-width:0.125rem;--limel-tab-separator-background-color:rgb(var(--contrast-600));isolation:isolate;display:block;position:relative}limel-scroller{--limel-scroller-fade-color:var(--limel-tab-background-color);--limel-scroller-content-padding:0.25rem var(--limel-tab-active-outer-edge-curve-size) 0;background-color:rgb(var(--limel-tab-background-color))}:host(.has-tabs-with-equal-width:not([orientation=vertical])) button[role=tab],:host(.has-tabs-with-equal-width:not([orientation=vertical])) limel-scroller>div{flex:1 0 auto;max-width:var(--tab-bar-horizontal-tab-max-width, none)}limel-scroller>div:has(limel-drag-handle:hover),limel-scroller>div:has(limel-drag-handle:focus-within),limel-scroller>div.is-elevated,limel-scroller>div.sortable-chosen{will-change:transform, box-shadow, border-radius, background-color}limel-scroller>div.sortable-ghost{border-radius:0.5rem;box-shadow:var(--shadow-depth-64), 0 0.65rem 0.75rem -0.425rem rgb(var(--color-black), 0.3)}limel-scroller>div.sortable-chosen{border-radius:0.5rem;background-color:var(--lime-elevated-surface-background-color)}limel-scroller>div.is-elevated[draggable=false]{animation:sit-here 0.8s forwards}@keyframes sit-here{0%{border-radius:0.5rem;background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--shadow-depth-64), 0 0.65rem 0.75rem -0.425rem rgb(var(--color-black), 0.3)}100%{box-shadow:none}}limel-scroller>div{position:relative;display:flex;flex:0 0 auto}limel-scroller>div button[role=tab]{flex:1 1 auto;min-width:0}limel-scroller>div span.content{padding-right:2rem}limel-scroller>div limel-drag-handle{position:absolute;z-index:3;top:0;bottom:0;right:0.25rem}button[role=tab]{appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;text-align:inherit;position:relative;display:flex;box-sizing:border-box;border-radius:0;padding:var(--limel-tab-content-inset);min-width:2.5rem;background-color:transparent;flex:0 0 auto;height:2.5rem;outline:none;cursor:pointer;white-space:nowrap;font-size:var(--limel-theme-default-font-size)}button[role=tab] limel-icon{transition:color 0.2s ease;color:rgb(var(--contrast-800));margin-left:-0.25rem;flex-shrink:0}button[role=tab] span.text{transition:color 0.2s ease;line-height:1.25;overflow:hidden;text-overflow:ellipsis;color:var(--limel-theme-on-surface-color)}button[role=tab]:hover span.text{color:var(--limel-theme-text-primary-on-background-color)}button[role=tab] limel-badge{margin-right:-0.25rem;box-shadow:0 0 0 1px rgb(var(--contrast-600));pointer-events:none;flex-shrink:0}button[role=tab][aria-selected=true]{background-color:var(--limel-active-tab-background-color);z-index:2}button[role=tab][aria-selected=true]:before,button[role=tab][aria-selected=true]:after{content:\"\";display:block;width:var(--limel-tab-active-outer-edge-curve-size);height:var(--limel-tab-active-outer-edge-curve-size);position:absolute;background-color:var(--limel-active-tab-background-color);-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20fill-rule='evenodd'%20stroke-linejoin='round'%20stroke-miterlimit='2'%20clip-rule='evenodd'%20viewBox='0%200%2050%2050'%3E%3Cdefs/%3E%3Cpath%20d='M0%200c0%2027.594%2022.406%2050%2050%2050H0V0z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20fill-rule='evenodd'%20stroke-linejoin='round'%20stroke-miterlimit='2'%20clip-rule='evenodd'%20viewBox='0%200%2050%2050'%3E%3Cdefs/%3E%3Cpath%20d='M0%200c0%2027.594%2022.406%2050%2050%2050H0V0z'/%3E%3C/svg%3E\")}button[role=tab][aria-selected=true] limel-icon{color:var(--limel-active-tab-color)}button[role=tab][aria-selected=true] span.text{color:var(--limel-active-tab-color)}span.content{transition:box-shadow 0.2s ease;display:flex;flex-grow:1;min-width:0;align-items:center;justify-content:center;gap:0.375rem;padding:0 0.75rem;border-radius:calc(var(--limel-tab-border-radius) - var(--limel-tab-content-inset))}button[role=tab]:focus-visible span.content{transition-duration:0.3s;box-shadow:var(--shadow-depth-8-focused)}:host(limel-tab-bar:not([orientation=vertical])) button[role=tab]{max-width:var(--tab-bar-horizontal-tab-max-width, 16rem)}:host(limel-tab-bar:not([orientation=vertical])) button[role=tab]:not([aria-selected=true]):after{content:\"\";display:block;background-color:var(--limel-tab-separator-background-color);width:var(--limel-tab-separator-width);height:1rem;margin:auto;position:absolute;top:0;bottom:0;border-radius:1rem;right:calc(-1 * var(--limel-tab-separator-width))}:host(limel-tab-bar:not([orientation=vertical])) limel-scroller>:last-child:not([aria-selected=true]):after,:host(limel-tab-bar:not([orientation=vertical])) limel-scroller>:last-child>button[role=tab]:not([aria-selected=true]):after{display:none}:host(limel-tab-bar:not([orientation=vertical])) button[role=tab][aria-selected=true]{border-radius:var(--limel-tab-border-radius) var(--limel-tab-border-radius) 0 0}:host(limel-tab-bar:not([orientation=vertical])) button[role=tab][aria-selected=true]:before,:host(limel-tab-bar:not([orientation=vertical])) button[role=tab][aria-selected=true]:after{bottom:0}:host(limel-tab-bar:not([orientation=vertical])) button[role=tab][aria-selected=true]:before{left:calc(-1 * var(--limel-tab-active-outer-edge-curve-size));transform:rotateY(180deg)}:host(limel-tab-bar:not([orientation=vertical])) button[role=tab][aria-selected=true]:after{right:calc(-1 * var(--limel-tab-active-outer-edge-curve-size))}:host(limel-tab-bar[orientation=vertical]){width:var(--tab-bar-vertical-width, 10rem)}:host(limel-tab-bar[orientation=vertical]) div[role=tablist]{height:100%}:host(limel-tab-bar[orientation=vertical]) limel-scroller{--limel-scroller-content-padding:var( --limel-tab-active-outer-edge-curve-size ) 0 var(--limel-tab-active-outer-edge-curve-size) 0.25rem;height:100%}:host(limel-tab-bar[orientation=vertical]) button[role=tab][aria-selected=true]{border-radius:var(--limel-tab-border-radius) 0 0 var(--limel-tab-border-radius)}:host(limel-tab-bar[orientation=vertical]) button[role=tab][aria-selected=true]:before,:host(limel-tab-bar[orientation=vertical]) button[role=tab][aria-selected=true]:after{right:0}:host(limel-tab-bar[orientation=vertical]) button[role=tab][aria-selected=true]:before{bottom:100%;transform:rotateY(180deg)}:host(limel-tab-bar[orientation=vertical]) button[role=tab][aria-selected=true]:after{top:100%;transform:rotate(180deg)}:host(limel-tab-bar[orientation=vertical]) span.content{justify-content:flex-start}:host(limel-tab-bar[orientation=vertical]) span.text{flex-grow:1}";export{z as limel_tab_bar}