@statistikzh/leu 0.14.4 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +17 -0
- package/dist/Accordion.js +2 -30
- package/dist/Button.d.ts +56 -68
- package/dist/Button.js +74 -52
- package/dist/ButtonGroup.d.ts +9 -9
- package/dist/ButtonGroup.js +30 -20
- package/dist/ChartWrapper.d.ts +38 -0
- package/dist/ChartWrapper.js +164 -0
- package/dist/Checkbox.d.ts +6 -21
- package/dist/Checkbox.js +17 -9
- package/dist/CheckboxGroup.d.ts +13 -14
- package/dist/CheckboxGroup.js +18 -11
- package/dist/Chip.js +1 -1
- package/dist/ChipGroup.js +1 -1
- package/dist/ChipLink.js +1 -1
- package/dist/ChipRemovable.js +1 -1
- package/dist/ChipSelectable.js +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/Dropdown.js +3 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.js +1 -1
- package/dist/{LeuElement-x8UlIDDl.js → LeuElement-B84x5CPL.js} +1 -1
- package/dist/Menu.js +1 -1
- package/dist/MenuItem.js +1 -1
- package/dist/Pagination.d.ts +40 -28
- package/dist/Pagination.js +39 -14
- package/dist/Placeholder.d.ts +27 -0
- package/dist/Placeholder.js +90 -0
- package/dist/Popup.js +1 -1
- package/dist/Radio.d.ts +6 -21
- package/dist/Radio.js +17 -9
- package/dist/RadioGroup.d.ts +28 -23
- package/dist/RadioGroup.js +29 -16
- package/dist/Range.js +1 -1
- package/dist/ScrollTop.d.ts +0 -1
- package/dist/ScrollTop.js +3 -1
- package/dist/Select.js +3 -1
- package/dist/Spinner.js +1 -1
- package/dist/Table.d.ts +0 -1
- package/dist/Table.js +3 -1
- package/dist/VisuallyHidden.js +1 -1
- package/dist/_tslib-CNEFicEt.js +30 -0
- package/dist/components/button/Button.d.ts +55 -67
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/stories/button.stories.d.ts.map +1 -1
- package/dist/components/button-group/ButtonGroup.d.ts +9 -9
- package/dist/components/button-group/ButtonGroup.d.ts.map +1 -1
- package/dist/components/chart-wrapper/ChartWrapper.d.ts +34 -0
- package/dist/components/chart-wrapper/ChartWrapper.d.ts.map +1 -0
- package/dist/components/chart-wrapper/leu-chart-wrapper.d.ts +3 -0
- package/dist/components/chart-wrapper/leu-chart-wrapper.d.ts.map +1 -0
- package/dist/components/chart-wrapper/stories/chart-wrapper.stories.d.ts +47 -0
- package/dist/components/chart-wrapper/stories/chart-wrapper.stories.d.ts.map +1 -0
- package/dist/components/chart-wrapper/test/chart-wrapper.test.d.ts +2 -0
- package/dist/components/chart-wrapper/test/chart-wrapper.test.d.ts.map +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +6 -21
- package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/CheckboxGroup.d.ts +13 -14
- package/dist/components/checkbox/CheckboxGroup.d.ts.map +1 -1
- package/dist/components/icon/stories/icon.stories.d.ts +10 -0
- package/dist/components/icon/stories/icon.stories.d.ts.map +1 -1
- package/dist/components/pagination/Pagination.d.ts +40 -27
- package/dist/components/pagination/Pagination.d.ts.map +1 -1
- package/dist/components/pagination/stories/pagination.stories.d.ts +10 -2
- package/dist/components/pagination/stories/pagination.stories.d.ts.map +1 -1
- package/dist/components/placeholder/Placeholder.d.ts +23 -0
- package/dist/components/placeholder/Placeholder.d.ts.map +1 -0
- package/dist/components/placeholder/leu-placeholder.d.ts +3 -0
- package/dist/components/placeholder/leu-placeholder.d.ts.map +1 -0
- package/dist/components/placeholder/stories/placeholder.stories.d.ts +27 -0
- package/dist/components/placeholder/stories/placeholder.stories.d.ts.map +1 -0
- package/dist/components/placeholder/test/placeholder.test.d.ts +2 -0
- package/dist/components/placeholder/test/placeholder.test.d.ts.map +1 -0
- package/dist/components/radio/Radio.d.ts +6 -21
- package/dist/components/radio/Radio.d.ts.map +1 -1
- package/dist/components/radio/RadioGroup.d.ts +28 -23
- package/dist/components/radio/RadioGroup.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/leu-accordion.js +2 -1
- package/dist/leu-button-group.js +8 -1
- package/dist/leu-button.d.ts +0 -1
- package/dist/leu-button.js +3 -1
- package/dist/leu-chart-wrapper.d.ts +6 -0
- package/dist/leu-chart-wrapper.js +11 -0
- package/dist/leu-checkbox-group.js +5 -1
- package/dist/leu-checkbox.js +3 -1
- package/dist/leu-chip-group.js +1 -1
- package/dist/leu-chip-link.js +1 -1
- package/dist/leu-chip-removable.js +1 -1
- package/dist/leu-chip-selectable.js +1 -1
- package/dist/leu-dialog.js +1 -1
- package/dist/leu-dropdown.js +3 -1
- package/dist/leu-icon.js +1 -1
- package/dist/leu-input.js +1 -1
- package/dist/leu-menu-item.js +1 -1
- package/dist/leu-menu.js +1 -1
- package/dist/leu-pagination.d.ts +0 -1
- package/dist/leu-pagination.js +3 -1
- package/dist/leu-placeholder.d.ts +4 -0
- package/dist/leu-placeholder.js +7 -0
- package/dist/leu-popup.js +1 -1
- package/dist/leu-radio-group.js +4 -1
- package/dist/leu-radio.js +3 -1
- package/dist/leu-range.js +1 -1
- package/dist/leu-scroll-top.d.ts +0 -1
- package/dist/leu-scroll-top.js +3 -1
- package/dist/leu-select.js +3 -1
- package/dist/leu-spinner.js +1 -1
- package/dist/leu-table.d.ts +0 -1
- package/dist/leu-table.js +3 -1
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/lib/a11y.d.ts +2 -2
- package/dist/theme.css +18 -18
- package/dist/vscode.html-custom-data.json +95 -25
- package/dist/vue/index.d.ts +86 -46
- package/dist/web-types.json +222 -80
- package/package.json +1 -1
- package/release-please-config.json +1 -2
- package/scripts/generate-component/templates/stories/[name].stories.ts +17 -4
- package/scripts/postcss-leu-font-styles.cjs +10 -10
- package/src/components/button/Button.ts +95 -79
- package/src/components/button/stories/button.stories.ts +5 -6
- package/src/components/button-group/ButtonGroup.ts +18 -13
- package/src/components/chart-wrapper/ChartWrapper.ts +78 -0
- package/src/components/chart-wrapper/chart-wrapper.css +87 -0
- package/src/components/chart-wrapper/leu-chart-wrapper.ts +5 -0
- package/src/components/chart-wrapper/stories/chart-wrapper.stories.ts +58 -0
- package/src/components/chart-wrapper/test/chart-wrapper.test.ts +77 -0
- package/src/components/checkbox/Checkbox.ts +13 -15
- package/src/components/checkbox/CheckboxGroup.ts +20 -16
- package/src/components/icon/stories/icon.stories.ts +27 -0
- package/src/components/pagination/Pagination.ts +45 -32
- package/src/components/pagination/stories/pagination.stories.ts +28 -17
- package/src/components/placeholder/Placeholder.ts +33 -0
- package/src/components/placeholder/leu-placeholder.ts +5 -0
- package/src/components/placeholder/placeholder.css +59 -0
- package/src/components/placeholder/stories/placeholder.stories.ts +34 -0
- package/src/components/placeholder/test/placeholder.test.ts +31 -0
- package/src/components/radio/Radio.ts +13 -15
- package/src/components/radio/RadioGroup.ts +42 -28
- package/src/docs/contributing.mdx +1 -1
- package/src/index.ts +1 -0
- package/src/lib/a11y.ts +2 -2
- package/src/styles/theme.css +89 -1
- package/src/styles/custom-properties.css +0 -89
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.15.1](https://github.com/statistikZH/leu/compare/leu-v0.15.0...leu-v0.15.1) (2025-07-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **chart-wrapper:** fix directory name and add export ([9ec09fb](https://github.com/statistikZH/leu/commit/9ec09fbd715ee71977f52632627ca10a77115f53))
|
|
9
|
+
* **chart-wrapper:** reset user agent default styling ([f1cd090](https://github.com/statistikZH/leu/commit/f1cd0900a096a7ac5cc60faffc6c56ebf9363909))
|
|
10
|
+
* **theme:** explicitly define a font weight to avoid font synthesis ([2605cc9](https://github.com/statistikZH/leu/commit/2605cc9105c1b0e9439f272d09b5ec7d5f81ba33))
|
|
11
|
+
|
|
12
|
+
## [0.15.0](https://github.com/statistikZH/leu/compare/leu-v0.14.4...leu-v0.15.0) (2025-07-03)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **chart-wrapper:** create a chart wrapper component ([2478fd0](https://github.com/statistikZH/leu/commit/2478fd0d76631d43c650ecb82ae275386243c438))
|
|
18
|
+
* **placeholder:** implement placeholder component ([22aa5e2](https://github.com/statistikZH/leu/commit/22aa5e2cac68bf1fdb0bcbd345307e04cc5b9fad))
|
|
19
|
+
|
|
3
20
|
## [0.14.4](https://github.com/statistikZH/leu/compare/leu-v0.14.3...leu-v0.14.4) (2025-06-18)
|
|
4
21
|
|
|
5
22
|
|
package/dist/Accordion.js
CHANGED
|
@@ -1,36 +1,8 @@
|
|
|
1
|
+
import { _ as __decorate } from './_tslib-CNEFicEt.js';
|
|
1
2
|
import { css, nothing } from 'lit';
|
|
2
3
|
import { unsafeStatic, html } from 'lit/static-html.js';
|
|
3
4
|
import { property } from 'lit/decorators.js';
|
|
4
|
-
import { L as LeuElement } from './LeuElement-
|
|
5
|
-
|
|
6
|
-
/******************************************************************************
|
|
7
|
-
Copyright (c) Microsoft Corporation.
|
|
8
|
-
|
|
9
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
-
purpose with or without fee is hereby granted.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
-
***************************************************************************** */
|
|
20
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
function __decorate(decorators, target, key, desc) {
|
|
24
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
25
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
26
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
27
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
31
|
-
var e = new Error(message);
|
|
32
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
33
|
-
};
|
|
5
|
+
import { L as LeuElement } from './LeuElement-B84x5CPL.js';
|
|
34
6
|
|
|
35
7
|
var css_248z = css`:host {
|
|
36
8
|
--accordion-font-regular: var(--leu-font-family-regular);
|
package/dist/Button.d.ts
CHANGED
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
2
|
import * as lit from 'lit';
|
|
3
|
-
import { nothing } from 'lit';
|
|
4
3
|
import { LeuIcon } from './Icon.js';
|
|
5
4
|
import { L as LeuElement } from './LeuElement.d-BevHqLUu.js';
|
|
6
|
-
import { H as HasSlotController } from './hasSlotController.d-emXwVXWF.js';
|
|
7
5
|
|
|
8
|
-
declare const BUTTON_VARIANTS: string[];
|
|
9
|
-
|
|
10
|
-
declare const BUTTON_SIZES: string[];
|
|
11
|
-
|
|
12
|
-
declare const BUTTON_TYPES: string[];
|
|
13
|
-
|
|
14
|
-
declare const BUTTON_EXPANDED_OPTIONS: string[];
|
|
15
6
|
/**
|
|
16
7
|
* @tagname leu-button
|
|
17
8
|
* @slot before - The icon to display before the label
|
|
18
9
|
* @slot after - The icon to display after the label
|
|
19
10
|
* @slot - The label of the button or the icon if no label is set
|
|
11
|
+
* @see https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=4-1444&mode=design&t=xu5Vii8jXKKCKDez-0
|
|
20
12
|
*/
|
|
21
13
|
declare class LeuButton extends LeuElement {
|
|
22
14
|
static dependencies: {
|
|
23
15
|
"leu-icon": typeof LeuIcon;
|
|
24
16
|
};
|
|
25
17
|
static styles: lit.CSSResultGroup[];
|
|
26
|
-
/**
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
18
|
static shadowRootOptions: {
|
|
30
19
|
delegatesFocus: boolean;
|
|
31
20
|
mode: ShadowRootMode;
|
|
@@ -34,64 +23,63 @@ declare class LeuButton extends LeuElement {
|
|
|
34
23
|
customElements?: CustomElementRegistry;
|
|
35
24
|
registry?: CustomElementRegistry;
|
|
36
25
|
};
|
|
26
|
+
private hasSlotController;
|
|
37
27
|
/**
|
|
38
|
-
*
|
|
28
|
+
* `aria-label` of the underlying button elements.
|
|
29
|
+
* Use it to provide a label when only an icon is visible.
|
|
39
30
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
renderExpandingIcon
|
|
89
|
-
getAriaAttributes
|
|
90
|
-
|
|
91
|
-
label: any;
|
|
92
|
-
};
|
|
93
|
-
hasTextContent(): boolean;
|
|
31
|
+
label: null | string;
|
|
32
|
+
/**
|
|
33
|
+
* The size of the button.
|
|
34
|
+
*/
|
|
35
|
+
size: "regular" | "small";
|
|
36
|
+
/**
|
|
37
|
+
* The visual variant of the button.
|
|
38
|
+
*/
|
|
39
|
+
variant: "primary" | "secondary" | "ghost";
|
|
40
|
+
/**
|
|
41
|
+
* The `type` of the underlying button element.
|
|
42
|
+
*/
|
|
43
|
+
type: "button" | "submit" | "reset";
|
|
44
|
+
/**
|
|
45
|
+
* The `role` of the underlying button element.
|
|
46
|
+
*/
|
|
47
|
+
componentRole?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the button is disabled or not.
|
|
50
|
+
* @type {boolean}
|
|
51
|
+
*/
|
|
52
|
+
disabled: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the button should be round.
|
|
55
|
+
* Can only be applied when the button contains an icon without a visible label.
|
|
56
|
+
* @type {boolean}
|
|
57
|
+
*/
|
|
58
|
+
round: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the button is active or not.
|
|
61
|
+
* Depending on the `componentRole`, it applies `aria-checked` or `aria-selected` to the underlying button element.
|
|
62
|
+
*/
|
|
63
|
+
active: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Wheter the colors should be inverted. For use on dark backgrounds.
|
|
66
|
+
*/
|
|
67
|
+
inverted: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Whether the button is expanded or not.
|
|
70
|
+
* Only has an effect on the variant `ghost` to show an expanding icon.
|
|
71
|
+
* If the property is not set, the icon will not be shown.
|
|
72
|
+
* If it is set, the icon will either show an expanded or collapsed state.
|
|
73
|
+
*/
|
|
74
|
+
expanded?: "true" | "false";
|
|
75
|
+
/**
|
|
76
|
+
* Alters the shape of the button to be full width of its parent container
|
|
77
|
+
*/
|
|
78
|
+
fluid: boolean;
|
|
79
|
+
private renderExpandingIcon;
|
|
80
|
+
private getAriaAttributes;
|
|
81
|
+
private hasTextContent;
|
|
94
82
|
render(): lit_html.TemplateResult<1>;
|
|
95
83
|
}
|
|
96
84
|
|
|
97
|
-
export {
|
|
85
|
+
export { LeuButton };
|
package/dist/Button.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { _ as __decorate } from './_tslib-CNEFicEt.js';
|
|
1
2
|
import { css, html, nothing } from 'lit';
|
|
2
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
3
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
+
import { property } from 'lit/decorators.js';
|
|
4
6
|
import { LeuIcon } from './Icon.js';
|
|
5
|
-
import { L as LeuElement } from './LeuElement-
|
|
7
|
+
import { L as LeuElement } from './LeuElement-B84x5CPL.js';
|
|
6
8
|
import { H as HasSlotController } from './hasSlotController-Bm2tipvG.js';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* All roles that are associated with a aria-checked attribute
|
|
10
|
-
* @
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked
|
|
11
13
|
*/
|
|
12
14
|
const ARIA_CHECKED_ROLES = [
|
|
13
15
|
"checkbox",
|
|
@@ -19,7 +21,7 @@ const ARIA_CHECKED_ROLES = [
|
|
|
19
21
|
];
|
|
20
22
|
/**
|
|
21
23
|
* All roles that are associated with a aria-selected attribute
|
|
22
|
-
* @
|
|
24
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected
|
|
23
25
|
*/
|
|
24
26
|
const ARIA_SELECTED_ROLES = [
|
|
25
27
|
"gridcell",
|
|
@@ -334,60 +336,62 @@ button.ghost.inverted:disabled {
|
|
|
334
336
|
}
|
|
335
337
|
`;
|
|
336
338
|
|
|
337
|
-
/*
|
|
338
|
-
Design: https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=4-1444&mode=design&t=xu5Vii8jXKKCKDez-0
|
|
339
|
-
Live Demo: zh.ch
|
|
340
|
-
*/
|
|
341
|
-
const BUTTON_VARIANTS = ["primary", "secondary", "ghost"];
|
|
342
|
-
Object.freeze(BUTTON_VARIANTS);
|
|
343
|
-
const BUTTON_SIZES = ["regular", "small"];
|
|
344
|
-
Object.freeze(BUTTON_SIZES);
|
|
345
|
-
const BUTTON_TYPES = ["button", "submit", "reset"];
|
|
346
|
-
Object.freeze(BUTTON_TYPES);
|
|
347
|
-
const BUTTON_EXPANDED_OPTIONS = ["true", "false"];
|
|
348
|
-
Object.freeze(BUTTON_EXPANDED_OPTIONS);
|
|
349
339
|
/**
|
|
350
340
|
* @tagname leu-button
|
|
351
341
|
* @slot before - The icon to display before the label
|
|
352
342
|
* @slot after - The icon to display after the label
|
|
353
343
|
* @slot - The label of the button or the icon if no label is set
|
|
344
|
+
* @see https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=4-1444&mode=design&t=xu5Vii8jXKKCKDez-0
|
|
354
345
|
*/
|
|
355
346
|
class LeuButton extends LeuElement {
|
|
356
347
|
constructor() {
|
|
357
|
-
super();
|
|
358
|
-
/**
|
|
359
|
-
* @internal
|
|
360
|
-
*/
|
|
348
|
+
super(...arguments);
|
|
361
349
|
this.hasSlotController = new HasSlotController(this, [
|
|
362
350
|
"before",
|
|
363
351
|
"after",
|
|
364
352
|
"[default]",
|
|
365
353
|
]);
|
|
366
|
-
/**
|
|
354
|
+
/**
|
|
355
|
+
* `aria-label` of the underlying button elements.
|
|
356
|
+
* Use it to provide a label when only an icon is visible.
|
|
357
|
+
*/
|
|
367
358
|
this.label = null;
|
|
368
|
-
/**
|
|
359
|
+
/**
|
|
360
|
+
* The size of the button.
|
|
361
|
+
*/
|
|
369
362
|
this.size = "regular";
|
|
370
|
-
/**
|
|
363
|
+
/**
|
|
364
|
+
* The visual variant of the button.
|
|
365
|
+
*/
|
|
371
366
|
this.variant = "primary";
|
|
372
|
-
/**
|
|
367
|
+
/**
|
|
368
|
+
* The `type` of the underlying button element.
|
|
369
|
+
*/
|
|
373
370
|
this.type = "button";
|
|
374
|
-
/**
|
|
375
|
-
|
|
376
|
-
|
|
371
|
+
/**
|
|
372
|
+
* Whether the button is disabled or not.
|
|
373
|
+
* @type {boolean}
|
|
374
|
+
*/
|
|
377
375
|
this.disabled = false;
|
|
378
|
-
/**
|
|
376
|
+
/**
|
|
377
|
+
* Whether the button should be round.
|
|
378
|
+
* Can only be applied when the button contains an icon without a visible label.
|
|
379
|
+
* @type {boolean}
|
|
380
|
+
*/
|
|
379
381
|
this.round = false;
|
|
380
|
-
/**
|
|
382
|
+
/**
|
|
383
|
+
* Whether the button is active or not.
|
|
384
|
+
* Depending on the `componentRole`, it applies `aria-checked` or `aria-selected` to the underlying button element.
|
|
385
|
+
*/
|
|
381
386
|
this.active = false;
|
|
382
|
-
/**
|
|
387
|
+
/**
|
|
388
|
+
* Wheter the colors should be inverted. For use on dark backgrounds.
|
|
389
|
+
*/
|
|
383
390
|
this.inverted = false;
|
|
384
|
-
/** @type {boolean} - Alters the shape of the button to be full width of its parent container */
|
|
385
|
-
this.fluid = false;
|
|
386
391
|
/**
|
|
387
|
-
*
|
|
388
|
-
* @type {("true" | "false" | undefined)}
|
|
392
|
+
* Alters the shape of the button to be full width of its parent container
|
|
389
393
|
*/
|
|
390
|
-
this.
|
|
394
|
+
this.fluid = false;
|
|
391
395
|
}
|
|
392
396
|
renderExpandingIcon() {
|
|
393
397
|
if (typeof this.expanded !== "undefined" && this.variant === "ghost") {
|
|
@@ -402,6 +406,7 @@ class LeuButton extends LeuElement {
|
|
|
402
406
|
role: this.componentRole,
|
|
403
407
|
label: this.label,
|
|
404
408
|
};
|
|
409
|
+
// TODO: checked and selected roles are not mutually exclusive
|
|
405
410
|
if (this.componentRole) {
|
|
406
411
|
if (ARIA_CHECKED_ROLES.includes(this.componentRole)) {
|
|
407
412
|
attributes.checked = this.active ? "true" : "false";
|
|
@@ -459,25 +464,42 @@ LeuButton.dependencies = {
|
|
|
459
464
|
"leu-icon": LeuIcon,
|
|
460
465
|
};
|
|
461
466
|
LeuButton.styles = [LeuElement.styles, css_248z];
|
|
462
|
-
/**
|
|
463
|
-
* @internal
|
|
464
|
-
*/
|
|
465
467
|
LeuButton.shadowRootOptions = {
|
|
466
468
|
...LeuElement.shadowRootOptions,
|
|
467
469
|
delegatesFocus: true,
|
|
468
470
|
};
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
471
|
+
__decorate([
|
|
472
|
+
property({ type: String, reflect: true })
|
|
473
|
+
], LeuButton.prototype, "label", void 0);
|
|
474
|
+
__decorate([
|
|
475
|
+
property({ type: String, reflect: true })
|
|
476
|
+
], LeuButton.prototype, "size", void 0);
|
|
477
|
+
__decorate([
|
|
478
|
+
property({ type: String, reflect: true })
|
|
479
|
+
], LeuButton.prototype, "variant", void 0);
|
|
480
|
+
__decorate([
|
|
481
|
+
property({ type: String, reflect: true })
|
|
482
|
+
], LeuButton.prototype, "type", void 0);
|
|
483
|
+
__decorate([
|
|
484
|
+
property({ type: String, reflect: true })
|
|
485
|
+
], LeuButton.prototype, "componentRole", void 0);
|
|
486
|
+
__decorate([
|
|
487
|
+
property({ type: Boolean, reflect: true })
|
|
488
|
+
], LeuButton.prototype, "disabled", void 0);
|
|
489
|
+
__decorate([
|
|
490
|
+
property({ type: Boolean, reflect: true })
|
|
491
|
+
], LeuButton.prototype, "round", void 0);
|
|
492
|
+
__decorate([
|
|
493
|
+
property({ type: Boolean, reflect: true })
|
|
494
|
+
], LeuButton.prototype, "active", void 0);
|
|
495
|
+
__decorate([
|
|
496
|
+
property({ type: Boolean, reflect: true })
|
|
497
|
+
], LeuButton.prototype, "inverted", void 0);
|
|
498
|
+
__decorate([
|
|
499
|
+
property({ type: String, reflect: true })
|
|
500
|
+
], LeuButton.prototype, "expanded", void 0);
|
|
501
|
+
__decorate([
|
|
502
|
+
property({ type: Boolean, reflect: true })
|
|
503
|
+
], LeuButton.prototype, "fluid", void 0);
|
|
504
|
+
|
|
505
|
+
export { LeuButton };
|
package/dist/ButtonGroup.d.ts
CHANGED
|
@@ -3,26 +3,26 @@ import * as lit from 'lit';
|
|
|
3
3
|
import { L as LeuElement } from './LeuElement.d-BevHqLUu.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
+
* A radio input-like button group component.
|
|
7
|
+
* It allows only one button to be active at a time.
|
|
6
8
|
* @tagname leu-button-group
|
|
7
9
|
* @slot - Slot for the buttons
|
|
8
|
-
* @prop {string} value - The value of the currenty selected (active) button
|
|
9
10
|
* @fires input - When the value of the group changes by clicking a button
|
|
10
11
|
*/
|
|
11
12
|
declare class LeuButtonGroup extends LeuElement {
|
|
12
13
|
static styles: lit.CSSResultGroup[];
|
|
13
14
|
private _items;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @returns {string}
|
|
16
|
+
* Retrieves the value or the text content of a given LeuButton element.
|
|
17
17
|
*/
|
|
18
|
-
static getButtonValue
|
|
19
|
-
get value(): any;
|
|
20
|
-
set value(newValue: any);
|
|
21
|
-
_handleSlotChange(): void;
|
|
18
|
+
private static getButtonValue;
|
|
22
19
|
/**
|
|
23
|
-
*
|
|
20
|
+
* The value of the currently selected (active) button
|
|
24
21
|
*/
|
|
25
|
-
|
|
22
|
+
get value(): string;
|
|
23
|
+
set value(newValue: string);
|
|
24
|
+
private _handleSlotChange;
|
|
25
|
+
private _handleButtonClick;
|
|
26
26
|
render(): lit_html.TemplateResult<1>;
|
|
27
27
|
}
|
|
28
28
|
|
package/dist/ButtonGroup.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { css, html } from 'lit';
|
|
2
|
-
import { L as LeuElement } from './LeuElement-
|
|
2
|
+
import { L as LeuElement } from './LeuElement-B84x5CPL.js';
|
|
3
|
+
import { LeuButton } from './Button.js';
|
|
4
|
+
import './_tslib-CNEFicEt.js';
|
|
5
|
+
import 'lit/directives/class-map.js';
|
|
6
|
+
import 'lit/directives/if-defined.js';
|
|
7
|
+
import 'lit/decorators.js';
|
|
8
|
+
import './Icon.js';
|
|
9
|
+
import './hasSlotController-Bm2tipvG.js';
|
|
3
10
|
|
|
4
11
|
var css_248z = css`.group {
|
|
5
12
|
display: flex;
|
|
@@ -9,23 +16,37 @@ var css_248z = css`.group {
|
|
|
9
16
|
`;
|
|
10
17
|
|
|
11
18
|
/**
|
|
19
|
+
* A radio input-like button group component.
|
|
20
|
+
* It allows only one button to be active at a time.
|
|
12
21
|
* @tagname leu-button-group
|
|
13
22
|
* @slot - Slot for the buttons
|
|
14
|
-
* @prop {string} value - The value of the currenty selected (active) button
|
|
15
23
|
* @fires input - When the value of the group changes by clicking a button
|
|
16
24
|
*/
|
|
17
25
|
class LeuButtonGroup extends LeuElement {
|
|
18
26
|
constructor() {
|
|
19
27
|
super(...arguments);
|
|
20
28
|
this._items = [];
|
|
29
|
+
this._handleButtonClick = (event) => {
|
|
30
|
+
const button = event.currentTarget;
|
|
31
|
+
if (!button.active) {
|
|
32
|
+
this.value = LeuButtonGroup.getButtonValue(button);
|
|
33
|
+
this.dispatchEvent(new CustomEvent("input", {
|
|
34
|
+
bubbles: true,
|
|
35
|
+
composed: true,
|
|
36
|
+
detail: { value: LeuButtonGroup.getButtonValue(button) },
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
21
40
|
}
|
|
22
41
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @returns {string}
|
|
42
|
+
* Retrieves the value or the text content of a given LeuButton element.
|
|
25
43
|
*/
|
|
26
44
|
static getButtonValue(button) {
|
|
27
|
-
return button.getAttribute("value") ?? button.
|
|
45
|
+
return button.getAttribute("value") ?? button.textContent.trim();
|
|
28
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* The value of the currently selected (active) button
|
|
49
|
+
*/
|
|
29
50
|
get value() {
|
|
30
51
|
const activeButton = this._items.find((item) => item.active);
|
|
31
52
|
return activeButton ? LeuButtonGroup.getButtonValue(activeButton) : null;
|
|
@@ -47,11 +68,13 @@ class LeuButtonGroup extends LeuElement {
|
|
|
47
68
|
item.removeEventListener("click", this._handleButtonClick);
|
|
48
69
|
});
|
|
49
70
|
const slot = this.shadowRoot.querySelector("slot");
|
|
50
|
-
this._items = slot
|
|
71
|
+
this._items = slot
|
|
72
|
+
.assignedElements({ flatten: true })
|
|
73
|
+
.filter((el) => el instanceof LeuButton);
|
|
51
74
|
let foundActiveButtonBefore = false;
|
|
52
75
|
this._items.forEach((item) => {
|
|
53
76
|
/* eslint-disable no-param-reassign */
|
|
54
|
-
item.addEventListener("click",
|
|
77
|
+
item.addEventListener("click", this._handleButtonClick);
|
|
55
78
|
item.componentRole = "menuitemradio";
|
|
56
79
|
/**
|
|
57
80
|
* In case there are multiple active buttons
|
|
@@ -66,19 +89,6 @@ class LeuButtonGroup extends LeuElement {
|
|
|
66
89
|
/* eslint-enable no-param-reassign */
|
|
67
90
|
});
|
|
68
91
|
}
|
|
69
|
-
/**
|
|
70
|
-
* @param {import("../button/Button.js").LeuButton} button
|
|
71
|
-
*/
|
|
72
|
-
_handleButtonClick(button) {
|
|
73
|
-
if (!button.active) {
|
|
74
|
-
this.value = LeuButtonGroup.getButtonValue(button);
|
|
75
|
-
this.dispatchEvent(new CustomEvent("input", {
|
|
76
|
-
bubbles: true,
|
|
77
|
-
composed: true,
|
|
78
|
-
detail: { value: LeuButtonGroup.getButtonValue(button) },
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
92
|
render() {
|
|
83
93
|
return html `
|
|
84
94
|
<div role="menubar" class="group">
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as lit_html from 'lit-html';
|
|
2
|
+
import * as lit from 'lit';
|
|
3
|
+
import { L as LeuElement } from './LeuElement.d-BevHqLUu.js';
|
|
4
|
+
import { H as HasSlotController } from './hasSlotController.d-emXwVXWF.js';
|
|
5
|
+
import { LeuSpinner } from './Spinner.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A wrapper element for charts.
|
|
9
|
+
* @tagname leu-chart-wrapper
|
|
10
|
+
* @slot title - The title of the chart. Use a heading tag (h2-4) depending on your context.
|
|
11
|
+
* @slot description - A description of the chart. Content is wrapped in a `<p>` tag by the component.
|
|
12
|
+
* @slot chart - The actual chart
|
|
13
|
+
* @slot caption - A caption for the chart, e.g. a source or explanation of the data.
|
|
14
|
+
* @slot download - A download button or dropdown to export the chart in different formats.
|
|
15
|
+
*/
|
|
16
|
+
declare class LeuChartWrapper extends LeuElement {
|
|
17
|
+
static styles: lit.CSSResultGroup[];
|
|
18
|
+
static shadowRootOptions: {
|
|
19
|
+
delegatesFocus: boolean;
|
|
20
|
+
mode: ShadowRootMode;
|
|
21
|
+
serializable?: boolean;
|
|
22
|
+
slotAssignment?: SlotAssignmentMode;
|
|
23
|
+
customElements?: CustomElementRegistry;
|
|
24
|
+
registry?: CustomElementRegistry;
|
|
25
|
+
};
|
|
26
|
+
static dependencies: {
|
|
27
|
+
"leu-spinner": typeof LeuSpinner;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Whether the chart is currently loading or not.
|
|
31
|
+
* When set to `true`, a spinner will be shown in the chart container.
|
|
32
|
+
*/
|
|
33
|
+
pending: boolean;
|
|
34
|
+
hasSlotController: HasSlotController;
|
|
35
|
+
render(): lit_html.TemplateResult<1>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { LeuChartWrapper };
|