@statistikzh/leu 0.3.0 → 0.4.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/.github/workflows/deploy-github-pages.yaml +33 -0
- package/.storybook/main.js +27 -1
- package/.storybook/manager-head.html +1 -0
- package/.storybook/manager.js +9 -0
- package/.storybook/preview-head.html +1 -1
- package/.storybook/preview.js +59 -5
- package/.storybook/static/logo.svg +19 -0
- package/.storybook/theme.js +7 -0
- package/CHANGELOG.md +30 -0
- package/README.md +1 -1
- package/dist/Button.js +15 -18
- package/dist/ButtonGroup.js +5 -7
- package/dist/Checkbox.js +101 -84
- package/dist/CheckboxGroup.js +41 -37
- package/dist/{Chip-5f70d04f.js → Chip-dac7337d.js} +5 -1
- package/dist/ChipGroup.js +2 -5
- package/dist/ChipLink.js +4 -7
- package/dist/ChipRemovable.js +4 -7
- package/dist/ChipSelectable.js +4 -7
- package/dist/Dropdown.js +55 -26
- package/dist/Input.js +29 -28
- package/dist/Menu.js +2 -5
- package/dist/MenuItem.js +30 -15
- package/dist/Pagination.js +54 -54
- package/dist/Radio.js +7 -6
- package/dist/RadioGroup.js +41 -39
- package/dist/Select.js +55 -43
- package/dist/Table.js +137 -120
- package/dist/{defineElement-ba770aed.js → _rollupPluginBabelHelpers-20f659f4.js} +1 -15
- package/dist/defineElement-47d4f665.js +15 -0
- package/dist/index.js +29 -19
- package/dist/leu-button-group.js +7 -3
- package/dist/leu-button.js +6 -3
- package/dist/leu-checkbox-group.js +6 -3
- package/dist/leu-checkbox.js +6 -3
- package/dist/leu-chip-group.js +6 -3
- package/dist/leu-chip-link.js +7 -4
- package/dist/leu-chip-removable.js +7 -4
- package/dist/leu-chip-selectable.js +7 -4
- package/dist/leu-dropdown.js +13 -3
- package/dist/leu-input.js +7 -3
- package/dist/leu-menu-item.js +8 -3
- package/dist/leu-menu.js +6 -3
- package/dist/leu-pagination.js +8 -3
- package/dist/leu-popup-4bf6f1f4.js +216 -0
- package/dist/leu-radio-group.js +6 -3
- package/dist/leu-radio.js +6 -3
- package/dist/leu-select.js +14 -3
- package/dist/leu-table.js +9 -3
- package/package.json +24 -12
- package/scripts/generate-component/templates/[Name].js +0 -5
- package/scripts/generate-component/templates/[name].css +1 -1
- package/scripts/generate-component/templates/[namespace]-[name].js +5 -2
- package/src/components/accordion/Accordion.js +0 -6
- package/src/components/accordion/leu-accordion.js +5 -2
- package/src/components/accordion/stories/accordion.stories.js +7 -4
- package/src/components/accordion/test/accordion.test.js +92 -2
- package/src/components/breadcrumb/Breadcrumb.js +310 -0
- package/src/components/breadcrumb/breadcrumb.css +114 -0
- package/src/components/breadcrumb/leu-breadcrumb.js +6 -0
- package/src/components/breadcrumb/stories/breadcrumb.stories.js +73 -0
- package/src/components/breadcrumb/test/breadcrumb.test.js +141 -0
- package/src/components/button/Button.js +10 -15
- package/src/components/button/button.css +3 -3
- package/src/components/button/leu-button.js +5 -2
- package/src/components/button/stories/button.stories.js +58 -37
- package/src/components/button/test/button.test.js +112 -2
- package/src/components/button-group/ButtonGroup.js +1 -7
- package/src/components/button-group/leu-button-group.js +5 -2
- package/src/components/button-group/stories/button-group.stories.js +6 -0
- package/src/components/button-group/test/button-group.test.js +79 -3
- package/src/components/checkbox/Checkbox.js +6 -85
- package/src/components/checkbox/CheckboxGroup.js +8 -38
- package/src/components/checkbox/checkbox-group.css +29 -0
- package/src/components/checkbox/checkbox.css +76 -0
- package/src/components/checkbox/leu-checkbox-group.js +5 -2
- package/src/components/checkbox/leu-checkbox.js +5 -2
- package/src/components/checkbox/stories/checkbox-group.stories.js +44 -21
- package/src/components/checkbox/stories/checkbox.stories.js +7 -1
- package/src/components/checkbox/test/checkbox-group.test.js +124 -0
- package/src/components/checkbox/test/checkbox.test.js +72 -59
- package/src/components/chip/Chip.js +1 -0
- package/src/components/chip/ChipGroup.js +0 -5
- package/src/components/chip/ChipLink.js +1 -6
- package/src/components/chip/ChipRemovable.js +1 -6
- package/src/components/chip/ChipSelectable.js +1 -6
- package/src/components/chip/exports.js +4 -10
- package/src/components/chip/leu-chip-group.js +5 -2
- package/src/components/chip/leu-chip-link.js +5 -2
- package/src/components/chip/leu-chip-removable.js +5 -2
- package/src/components/chip/leu-chip-selectable.js +5 -2
- package/src/components/chip/stories/chip-group.stories.js +18 -6
- package/src/components/chip/stories/chip-link.stories.js +16 -4
- package/src/components/chip/stories/chip-removable.stories.js +15 -4
- package/src/components/chip/stories/chip-selectable.stories.js +13 -3
- package/src/components/chip/test/chip-group.test.js +124 -0
- package/src/components/chip/test/chip-link.test.js +58 -0
- package/src/components/chip/test/chip-removable.test.js +79 -0
- package/src/components/chip/test/chip-selectable.test.js +95 -0
- package/src/components/chip/test/chip.test.js +1 -1
- package/src/components/dropdown/Dropdown.js +52 -24
- package/src/components/dropdown/dropdown.css +1 -2
- package/src/components/dropdown/leu-dropdown.js +5 -2
- package/src/components/dropdown/stories/dropdown.stories.js +11 -5
- package/src/components/dropdown/test/dropdown.test.js +6 -6
- package/src/components/icon/icon.js +1 -1
- package/src/components/icon/test/icon.test.js +66 -0
- package/src/components/input/Input.js +18 -24
- package/src/components/input/input.css +9 -6
- package/src/components/input/leu-input.js +5 -2
- package/src/components/input/stories/input.stories.js +8 -2
- package/src/components/input/test/input.test.js +431 -4
- package/src/components/menu/Menu.js +0 -5
- package/src/components/menu/MenuItem.js +20 -13
- package/src/components/menu/leu-menu-item.js +5 -2
- package/src/components/menu/leu-menu.js +5 -2
- package/src/components/menu/menu-item.css +5 -2
- package/src/components/menu/stories/menu-item.stories.js +13 -4
- package/src/components/menu/stories/menu.stories.js +11 -5
- package/src/components/menu/test/menu-item.test.js +180 -0
- package/src/components/menu/test/menu.test.js +10 -2
- package/src/components/pagination/Pagination.js +53 -65
- package/src/components/pagination/leu-pagination.js +5 -2
- package/src/components/pagination/stories/pagination.stories.js +17 -9
- package/src/components/pagination/test/pagination.test.js +191 -5
- package/src/components/popup/Popup.js +200 -0
- package/src/components/popup/leu-popup.js +6 -0
- package/src/components/popup/popup.css +27 -0
- package/src/components/popup/stories/popup.stories.js +58 -0
- package/src/components/popup/test/popup.test.js +29 -0
- package/src/components/radio/Radio.js +2 -6
- package/src/components/radio/RadioGroup.js +6 -38
- package/src/components/radio/leu-radio-group.js +5 -2
- package/src/components/radio/leu-radio.js +5 -2
- package/src/components/radio/radio-group.css +29 -0
- package/src/components/radio/stories/radio-group.stories.js +38 -19
- package/src/components/radio/stories/radio.stories.js +7 -1
- package/src/components/radio/test/radio-group.test.js +86 -0
- package/src/components/radio/test/radio.test.js +108 -17
- package/src/components/select/Select.js +34 -31
- package/src/components/select/leu-select.js +5 -2
- package/src/components/select/select.css +13 -13
- package/src/components/select/stories/select.stories.js +15 -168
- package/src/components/select/test/fixtures.js +162 -0
- package/src/components/select/test/select.test.js +236 -12
- package/src/components/table/Table.js +43 -118
- package/src/components/table/leu-table.js +5 -2
- package/src/components/table/stories/table.stories.js +20 -10
- package/src/components/table/table.css +99 -0
- package/src/components/table/test/table.test.js +1 -1
- package/src/lib/utils.js +17 -0
- package/{web-dev-server-storybook.config.mjs → web-dev-server.config.mjs} +1 -2
- package/web-test-runner.config.mjs +15 -2
package/dist/CheckboxGroup.js
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { css, LitElement, html } from 'lit';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
|
|
5
|
+
var css_248z = css`:host {
|
|
6
|
+
--group-font-regular: var(--leu-font-regular);
|
|
7
|
+
--group-font-black: var(--leu-font-black);
|
|
8
|
+
|
|
9
|
+
font-family: var(--leu-font-regular);
|
|
10
|
+
|
|
11
|
+
font-family: var(--group-font-regular);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.fieldset {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: flex-start;
|
|
17
|
+
flex-wrap: wrap;
|
|
18
|
+
gap: 0.5rem 1rem;
|
|
19
|
+
|
|
20
|
+
border: none;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.fieldset--vertical {
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: 1rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.legend {
|
|
30
|
+
font-family: var(--group-font-black);
|
|
31
|
+
font-size: 1.125rem;
|
|
32
|
+
line-height: 1.5;
|
|
33
|
+
|
|
34
|
+
margin-bottom: 0.5rem;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
5
38
|
/**
|
|
6
39
|
* @tagname leu-checkbox-group
|
|
7
40
|
*/
|
|
@@ -27,51 +60,22 @@ class LeuCheckboxGroup extends LitElement {
|
|
|
27
60
|
};
|
|
28
61
|
return html`
|
|
29
62
|
<fieldset class=${classMap(fieldsetClasses)}>
|
|
30
|
-
|
|
63
|
+
${this.label ? html`<legend class="legend">${this.label}</legend>` : html``}
|
|
31
64
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
32
65
|
</fieldset>
|
|
33
66
|
`;
|
|
34
67
|
}
|
|
35
68
|
}
|
|
36
|
-
_defineProperty(LeuCheckboxGroup, "styles",
|
|
37
|
-
:host {
|
|
38
|
-
--group-font-regular: var(--leu-font-regular);
|
|
39
|
-
--group-font-black: var(--leu-font-black);
|
|
40
|
-
|
|
41
|
-
font-family: var(--group-font-regular);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.fieldset {
|
|
45
|
-
display: flex;
|
|
46
|
-
align-items: flex-start;
|
|
47
|
-
flex-wrap: wrap;
|
|
48
|
-
gap: 0.5rem 1rem;
|
|
49
|
-
|
|
50
|
-
border: none;
|
|
51
|
-
padding: 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.fieldset--vertical {
|
|
55
|
-
flex-direction: column;
|
|
56
|
-
gap: 1rem;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.legend {
|
|
60
|
-
font-family: var(--group-font-black);
|
|
61
|
-
font-size: 1.125rem;
|
|
62
|
-
line-height: 1.5;
|
|
63
|
-
|
|
64
|
-
margin-bottom: 0.5rem;
|
|
65
|
-
}
|
|
66
|
-
`);
|
|
69
|
+
_defineProperty(LeuCheckboxGroup, "styles", css_248z);
|
|
67
70
|
_defineProperty(LeuCheckboxGroup, "properties", {
|
|
68
71
|
orientation: {
|
|
69
72
|
type: String,
|
|
70
73
|
reflect: true
|
|
74
|
+
},
|
|
75
|
+
label: {
|
|
76
|
+
type: String,
|
|
77
|
+
reflect: true
|
|
71
78
|
}
|
|
72
79
|
});
|
|
73
|
-
function defineCheckboxGroupElements() {
|
|
74
|
-
defineElement("checkbox-group", LeuCheckboxGroup);
|
|
75
|
-
}
|
|
76
80
|
|
|
77
|
-
export { LeuCheckboxGroup
|
|
81
|
+
export { LeuCheckboxGroup };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _defineProperty } from './
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { css, LitElement } from 'lit';
|
|
3
3
|
|
|
4
4
|
var css_248z = css`:host,
|
|
@@ -156,6 +156,10 @@ _defineProperty(LeuChipBase, "properties", {
|
|
|
156
156
|
inverted: {
|
|
157
157
|
type: Boolean,
|
|
158
158
|
reflect: true
|
|
159
|
+
},
|
|
160
|
+
label: {
|
|
161
|
+
type: String,
|
|
162
|
+
reflect: true
|
|
159
163
|
}
|
|
160
164
|
});
|
|
161
165
|
|
package/dist/ChipGroup.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { css, LitElement, html } from 'lit';
|
|
3
3
|
|
|
4
4
|
var css_248z = css`:host {
|
|
@@ -66,8 +66,5 @@ _defineProperty(LeuChipGroup, "properties", {
|
|
|
66
66
|
reflect: true
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
|
-
function defineChipGroupElements() {
|
|
70
|
-
defineElement("chip-group", LeuChipGroup);
|
|
71
|
-
}
|
|
72
69
|
|
|
73
|
-
export { LeuChipGroup, SELECTION_MODES
|
|
70
|
+
export { LeuChipGroup, SELECTION_MODES };
|
package/dist/ChipLink.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { html } from 'lit';
|
|
3
|
-
import { L as LeuChipBase } from './Chip-
|
|
3
|
+
import { L as LeuChipBase } from './Chip-dac7337d.js';
|
|
4
4
|
|
|
5
5
|
const SIZES = {
|
|
6
6
|
regular: "regular",
|
|
@@ -20,7 +20,7 @@ class LeuChipLink extends LeuChipBase {
|
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
22
|
return html`<a href=${this.href} class="button">
|
|
23
|
-
<span class="label"
|
|
23
|
+
<span class="label">${this.label}</span>
|
|
24
24
|
</a>`;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -39,8 +39,5 @@ _defineProperty(LeuChipLink, "properties", {
|
|
|
39
39
|
reflect: true
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
function defineChipLinkElements() {
|
|
43
|
-
defineElement("chip-link", LeuChipLink);
|
|
44
|
-
}
|
|
45
42
|
|
|
46
|
-
export { LeuChipLink, SIZES
|
|
43
|
+
export { LeuChipLink, SIZES };
|
package/dist/ChipRemovable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { html } from 'lit';
|
|
3
|
-
import { L as LeuChipBase } from './Chip-
|
|
3
|
+
import { L as LeuChipBase } from './Chip-dac7337d.js';
|
|
4
4
|
import { I as Icon } from './icon-03e86700.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -24,7 +24,7 @@ class LeuChipRemovable extends LeuChipBase {
|
|
|
24
24
|
}
|
|
25
25
|
render() {
|
|
26
26
|
return html`<button @click=${e => this.handleClick(e)} class="button">
|
|
27
|
-
<span class="label"
|
|
27
|
+
<span class="label">${this.label}</span>
|
|
28
28
|
<div class="icon">${this._removeIcon}</div>
|
|
29
29
|
</button>`;
|
|
30
30
|
}
|
|
@@ -32,8 +32,5 @@ class LeuChipRemovable extends LeuChipBase {
|
|
|
32
32
|
_defineProperty(LeuChipRemovable, "properties", {
|
|
33
33
|
...LeuChipBase.properties
|
|
34
34
|
});
|
|
35
|
-
function defineChipRemovableElements() {
|
|
36
|
-
defineElement("chip-removable", LeuChipRemovable);
|
|
37
|
-
}
|
|
38
35
|
|
|
39
|
-
export { LeuChipRemovable
|
|
36
|
+
export { LeuChipRemovable };
|
package/dist/ChipSelectable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { html } from 'lit';
|
|
3
|
-
import { L as LeuChipBase } from './Chip-
|
|
3
|
+
import { L as LeuChipBase } from './Chip-dac7337d.js';
|
|
4
4
|
|
|
5
5
|
const SIZES = {
|
|
6
6
|
small: "small",
|
|
@@ -50,7 +50,7 @@ class LeuChipSelectable extends LeuChipBase {
|
|
|
50
50
|
class="button"
|
|
51
51
|
aria-selected=${this.selected ? "true" : "false"}
|
|
52
52
|
>
|
|
53
|
-
<span class="label"
|
|
53
|
+
<span class="label">${this.label}</span>
|
|
54
54
|
</button>`;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -86,8 +86,5 @@ _defineProperty(LeuChipSelectable, "properties", {
|
|
|
86
86
|
reflect: true
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
|
-
function defineChipSelectableElements() {
|
|
90
|
-
defineElement("chip-selectable", LeuChipSelectable);
|
|
91
|
-
}
|
|
92
89
|
|
|
93
|
-
export { LeuChipSelectable, SIZES, VARIANTS
|
|
90
|
+
export { LeuChipSelectable, SIZES, VARIANTS };
|
package/dist/Dropdown.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { css, LitElement, html } from 'lit';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import './leu-button.js';
|
|
4
|
+
import './leu-menu.js';
|
|
5
|
+
import './leu-menu-item.js';
|
|
6
|
+
import './leu-popup-4bf6f1f4.js';
|
|
7
|
+
import './defineElement-47d4f665.js';
|
|
8
|
+
import './Button.js';
|
|
6
9
|
import 'lit/directives/class-map.js';
|
|
7
10
|
import './icon-03e86700.js';
|
|
11
|
+
import './Menu.js';
|
|
12
|
+
import './MenuItem.js';
|
|
13
|
+
import 'lit/static-html.js';
|
|
14
|
+
import 'lit/directives/if-defined.js';
|
|
15
|
+
import '@floating-ui/dom';
|
|
8
16
|
|
|
9
17
|
var css_248z = css`:host,
|
|
10
18
|
:host * {
|
|
@@ -20,8 +28,7 @@ var css_248z = css`:host,
|
|
|
20
28
|
box-shadow: var(--leu-box-shadow-short);
|
|
21
29
|
border-radius: 2px;
|
|
22
30
|
|
|
23
|
-
|
|
24
|
-
top: calc(100% + 0.5rem);
|
|
31
|
+
margin-top: 0.5rem;
|
|
25
32
|
}
|
|
26
33
|
`;
|
|
27
34
|
|
|
@@ -31,27 +38,55 @@ var css_248z = css`:host,
|
|
|
31
38
|
class LeuDropdown extends LitElement {
|
|
32
39
|
constructor() {
|
|
33
40
|
super();
|
|
41
|
+
_defineProperty(this, "_handleMenuItemClick", () => {
|
|
42
|
+
this.expanded = false;
|
|
43
|
+
});
|
|
34
44
|
this.label = "";
|
|
35
45
|
this.expanded = false;
|
|
46
|
+
this.menuItems = [];
|
|
36
47
|
}
|
|
37
|
-
|
|
48
|
+
disconnectedCallback() {
|
|
49
|
+
super.disconnectedCallback();
|
|
50
|
+
this._removeMenuItemListeners();
|
|
51
|
+
}
|
|
52
|
+
_handleSlotChange() {
|
|
53
|
+
this._removeMenuItemListeners();
|
|
54
|
+
this.menuItems = [...this.querySelectorAll("leu-menu > leu-menu-item")];
|
|
55
|
+
this.menuItems.forEach(item => item.addEventListener("click", this._handleMenuItemClick));
|
|
56
|
+
}
|
|
57
|
+
_removeMenuItemListeners() {
|
|
58
|
+
this.menuItems.forEach(item => {
|
|
59
|
+
item.removeEventListener("click", this._handleMenuItemClick);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
_handleToggleClick() {
|
|
38
63
|
this.expanded = !this.expanded;
|
|
39
64
|
}
|
|
40
65
|
render() {
|
|
41
66
|
return html`
|
|
42
|
-
<leu-
|
|
43
|
-
icon="download"
|
|
44
|
-
variant="ghost"
|
|
45
|
-
label=${this.label}
|
|
46
|
-
expanded=${this.expanded ? "open" : "closed"}
|
|
47
|
-
aria-expanded=${this.expanded ? "true" : "false"}
|
|
48
|
-
aria-controls="content"
|
|
67
|
+
<leu-popup
|
|
49
68
|
?active=${this.expanded}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
69
|
+
placement="bottom-start"
|
|
70
|
+
shift
|
|
71
|
+
shiftPadding="8"
|
|
72
|
+
autoSize="width"
|
|
73
|
+
autoSizePadding="8"
|
|
74
|
+
>
|
|
75
|
+
<leu-button
|
|
76
|
+
slot="anchor"
|
|
77
|
+
icon="download"
|
|
78
|
+
variant="ghost"
|
|
79
|
+
label=${this.label}
|
|
80
|
+
expanded=${this.expanded ? "open" : "closed"}
|
|
81
|
+
aria-expanded=${this.expanded ? "true" : "false"}
|
|
82
|
+
aria-controls="content"
|
|
83
|
+
?active=${this.expanded}
|
|
84
|
+
@click=${this._handleToggleClick}
|
|
85
|
+
></leu-button>
|
|
86
|
+
<div id="content" class="content" ?hidden=${!this.expanded}>
|
|
87
|
+
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
88
|
+
</div>
|
|
89
|
+
</leu-popup>
|
|
55
90
|
`;
|
|
56
91
|
}
|
|
57
92
|
}
|
|
@@ -66,11 +101,5 @@ _defineProperty(LeuDropdown, "properties", {
|
|
|
66
101
|
reflect: true
|
|
67
102
|
}
|
|
68
103
|
});
|
|
69
|
-
function defineDropdownElements() {
|
|
70
|
-
defineElement("dropdown", LeuDropdown);
|
|
71
|
-
defineButtonElements();
|
|
72
|
-
defineMenuElements();
|
|
73
|
-
defineMenuItemElements();
|
|
74
|
-
}
|
|
75
104
|
|
|
76
|
-
export { LeuDropdown
|
|
105
|
+
export { LeuDropdown };
|
package/dist/Input.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { css, LitElement, nothing, html } from 'lit';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
+
import { live } from 'lit/directives/live.js';
|
|
5
6
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
6
7
|
import { I as Icon } from './icon-03e86700.js';
|
|
7
8
|
|
|
@@ -137,6 +138,7 @@ var css_248z = css`:host,
|
|
|
137
138
|
|
|
138
139
|
/* is size regular AND (has focus OR contains a value) */
|
|
139
140
|
|
|
141
|
+
.input-wrapper--invalid .label,
|
|
140
142
|
:host(:not([size])) .label,
|
|
141
143
|
:host([size="regular"]) .label {
|
|
142
144
|
top: calc(0.75rem - var(--input-border-width));
|
|
@@ -161,20 +163,22 @@ var css_248z = css`:host,
|
|
|
161
163
|
content: "*";
|
|
162
164
|
}
|
|
163
165
|
|
|
166
|
+
/* is not disabled AND has focus AND is empty */
|
|
167
|
+
|
|
168
|
+
:host(:not([disabled]):not(:focus-within)) .input-wrapper--empty .label {
|
|
169
|
+
--input-label-color: var(--input-label-color-empty);
|
|
170
|
+
}
|
|
171
|
+
|
|
164
172
|
/* is empty AND has no focus */
|
|
165
173
|
|
|
166
|
-
:host(:not(:focus-within))
|
|
174
|
+
:host(:not(:focus-within))
|
|
175
|
+
.input-wrapper--empty:not(.input-wrapper--invalid)
|
|
176
|
+
.label {
|
|
167
177
|
font-family: var(--input-font-regular);
|
|
168
178
|
font-size: 1rem;
|
|
169
179
|
top: calc(1.5rem - var(--input-border-width));
|
|
170
180
|
}
|
|
171
181
|
|
|
172
|
-
/* is not disabled AND has focus AND is empty */
|
|
173
|
-
|
|
174
|
-
:host(:not([disabled]):not(:focus-within)) .input-wrapper--empty .label {
|
|
175
|
-
--input-label-color: var(--input-label-color-empty);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
182
|
/* is size small AND has no focus AND is empty */
|
|
179
183
|
|
|
180
184
|
:host(:not(:focus-within)[size="small"]) .input-wrapper--empty .label {
|
|
@@ -335,16 +339,9 @@ class LeuInput extends LitElement {
|
|
|
335
339
|
this.disabled = false;
|
|
336
340
|
this.required = false;
|
|
337
341
|
this.clearable = false;
|
|
338
|
-
this.value = "";
|
|
339
|
-
this.name = "";
|
|
340
|
-
this.error = "";
|
|
341
|
-
this.label = "";
|
|
342
|
-
this.prefix = "";
|
|
343
|
-
this.suffix = "";
|
|
344
342
|
|
|
345
343
|
/** @type {keyof typeof SIZE_TYPES} */
|
|
346
344
|
this.size = SIZE_TYPES.REGULAR;
|
|
347
|
-
this.icon = "";
|
|
348
345
|
this.type = "text";
|
|
349
346
|
this._validity = null;
|
|
350
347
|
this.validationMessages = {};
|
|
@@ -415,7 +412,9 @@ class LeuInput extends LitElement {
|
|
|
415
412
|
* @returns {void}
|
|
416
413
|
*/
|
|
417
414
|
handleChange(event) {
|
|
418
|
-
|
|
415
|
+
if (event.target.validity.valid) {
|
|
416
|
+
this.value = event.target.value;
|
|
417
|
+
}
|
|
419
418
|
const customEvent = new CustomEvent(event.type, event);
|
|
420
419
|
this.dispatchEvent(customEvent);
|
|
421
420
|
}
|
|
@@ -430,6 +429,11 @@ class LeuInput extends LitElement {
|
|
|
430
429
|
*/
|
|
431
430
|
handleInput(event) {
|
|
432
431
|
this.value = event.target.value;
|
|
432
|
+
const customEvent = new CustomEvent("input", {
|
|
433
|
+
bubbles: true,
|
|
434
|
+
composed: true
|
|
435
|
+
});
|
|
436
|
+
this.dispatchEvent(customEvent);
|
|
433
437
|
}
|
|
434
438
|
|
|
435
439
|
/**
|
|
@@ -537,7 +541,7 @@ class LeuInput extends LitElement {
|
|
|
537
541
|
if (this.isInvalid()) {
|
|
538
542
|
return html`<div class="error-icon">${Icon("caution")}</div>`;
|
|
539
543
|
}
|
|
540
|
-
if (this.clearable && this.value
|
|
544
|
+
if (this.clearable && this.value) {
|
|
541
545
|
return html`<button
|
|
542
546
|
class="clear-button"
|
|
543
547
|
@click=${this.clear}
|
|
@@ -547,13 +551,13 @@ class LeuInput extends LitElement {
|
|
|
547
551
|
${this._clearIcon}
|
|
548
552
|
</button>`;
|
|
549
553
|
}
|
|
550
|
-
if (this.icon
|
|
554
|
+
if (this.icon) {
|
|
551
555
|
return html`<div class="icon">${Icon(this.icon)}</div>`;
|
|
552
556
|
}
|
|
553
557
|
return nothing;
|
|
554
558
|
}
|
|
555
559
|
isInvalid() {
|
|
556
|
-
if (this.error
|
|
560
|
+
if (this.error) {
|
|
557
561
|
return true;
|
|
558
562
|
}
|
|
559
563
|
return this._validity === null || this.novalidate ? false : !this._validity.valid;
|
|
@@ -562,7 +566,7 @@ class LeuInput extends LitElement {
|
|
|
562
566
|
const isInvalid = this.isInvalid();
|
|
563
567
|
const inputWrapperClasses = {
|
|
564
568
|
"input-wrapper": true,
|
|
565
|
-
"input-wrapper--empty": this.value
|
|
569
|
+
"input-wrapper--empty": !this.value,
|
|
566
570
|
"input-wrapper--invalid": isInvalid
|
|
567
571
|
};
|
|
568
572
|
|
|
@@ -584,18 +588,18 @@ class LeuInput extends LitElement {
|
|
|
584
588
|
@invalid=${this.handleInvalid}
|
|
585
589
|
?disabled=${this.disabled}
|
|
586
590
|
?required=${this.required}
|
|
591
|
+
.value=${live(this.value ?? "")}
|
|
587
592
|
pattern=${ifDefined(this.pattern)}
|
|
588
593
|
min=${ifDefined(this.min)}
|
|
589
594
|
max=${ifDefined(this.max)}
|
|
590
595
|
maxlength=${ifDefined(this.maxlength)}
|
|
591
596
|
minlength=${ifDefined(this.minlength)}
|
|
592
|
-
.value=${this.value}
|
|
593
597
|
ref=${ref(this._inputRef)}
|
|
594
598
|
aria-invalid=${isInvalid}
|
|
595
599
|
/>
|
|
596
|
-
<label for="input-${this.getId()}" class="label"
|
|
597
|
-
${this.prefix
|
|
598
|
-
${this.suffix
|
|
600
|
+
<label for="input-${this.getId()}" class="label">${this.label}</label>
|
|
601
|
+
${this.prefix ? html`<div class="prefix" .aria-hidden=${true}>${this.prefix}</div>` : nothing}
|
|
602
|
+
${this.suffix ? html`<div class="suffix" .aria-hidden=${true}>${this.suffix}</div>` : nothing}
|
|
599
603
|
${this.renderAfterContent()}
|
|
600
604
|
</div>
|
|
601
605
|
${this.renderErrorMessages()}
|
|
@@ -692,8 +696,5 @@ _defineProperty(LeuInput, "properties", {
|
|
|
692
696
|
state: true
|
|
693
697
|
}
|
|
694
698
|
});
|
|
695
|
-
function defineInputElements() {
|
|
696
|
-
defineElement("input", LeuInput);
|
|
697
|
-
}
|
|
698
699
|
|
|
699
|
-
export { LeuInput, SIZE_TYPES
|
|
700
|
+
export { LeuInput, SIZE_TYPES };
|
package/dist/Menu.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { css, LitElement, html } from 'lit';
|
|
3
3
|
|
|
4
4
|
var css_248z = css`:host,
|
|
@@ -33,8 +33,5 @@ class LeuMenu extends LitElement {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
_defineProperty(LeuMenu, "styles", css_248z);
|
|
36
|
-
function defineMenuElements() {
|
|
37
|
-
defineElement("menu", LeuMenu);
|
|
38
|
-
}
|
|
39
36
|
|
|
40
|
-
export { LeuMenu
|
|
37
|
+
export { LeuMenu };
|
package/dist/MenuItem.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
2
|
-
import { css, LitElement,
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
|
+
import { css, LitElement, nothing } from 'lit';
|
|
3
|
+
import { html, unsafeStatic } from 'lit/static-html.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
3
5
|
import { a as ICON_NAMES, I as Icon } from './icon-03e86700.js';
|
|
4
6
|
|
|
5
7
|
var css_248z = css`:host,
|
|
@@ -11,15 +13,18 @@ var css_248z = css`:host,
|
|
|
11
13
|
--background: var(--leu-color-black-0);
|
|
12
14
|
--background-hover: var(--leu-color-black-10);
|
|
13
15
|
--background-active: var(--leu-color-func-cyan);
|
|
14
|
-
--background-disabled: var(--leu-color-black-0);
|
|
16
|
+
--background-disabled: var(--leu-color-black-black-0);
|
|
15
17
|
--color: var(--leu-color-black-transp-60);
|
|
18
|
+
--color-disabled: var(--leu-color-black-transp-20);
|
|
16
19
|
--font-regular: var(--leu-font-regular);
|
|
17
20
|
--font-black: var(--leu-font-black);
|
|
18
21
|
|
|
19
|
-
font-family: var(--
|
|
22
|
+
font-family: var(--leu-font-regular);
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
.button {
|
|
26
|
+
-webkit-text-decoration: none;
|
|
27
|
+
text-decoration: none;
|
|
23
28
|
-webkit-appearance: none;
|
|
24
29
|
-moz-appearance: none;
|
|
25
30
|
appearance: none;
|
|
@@ -57,6 +62,7 @@ var css_248z = css`:host,
|
|
|
57
62
|
|
|
58
63
|
:host([disabled]) .button {
|
|
59
64
|
--background: var(--background-disabled);
|
|
65
|
+
--color: var(--color-disabled);
|
|
60
66
|
cursor: default;
|
|
61
67
|
}
|
|
62
68
|
|
|
@@ -87,8 +93,6 @@ class LeuMenuItem extends LitElement {
|
|
|
87
93
|
super();
|
|
88
94
|
this.active = false;
|
|
89
95
|
this.disabled = false;
|
|
90
|
-
this.before = "";
|
|
91
|
-
this.after = "";
|
|
92
96
|
|
|
93
97
|
/**
|
|
94
98
|
* A programmatic way to highlight the menu item like it is hovered.
|
|
@@ -106,24 +110,30 @@ class LeuMenuItem extends LitElement {
|
|
|
106
110
|
return name;
|
|
107
111
|
}
|
|
108
112
|
renderBefore() {
|
|
109
|
-
if (this.before
|
|
113
|
+
if (this.before) {
|
|
110
114
|
const content = LeuMenuItem.getIconOrText(this.before);
|
|
111
115
|
return html`<span class="before">${content}</span>`;
|
|
112
116
|
}
|
|
113
117
|
return nothing;
|
|
114
118
|
}
|
|
115
119
|
renderAfter() {
|
|
116
|
-
if (this.after
|
|
120
|
+
if (this.after) {
|
|
117
121
|
const content = LeuMenuItem.getIconOrText(this.after);
|
|
118
122
|
return html`<span class="after">${content}</span>`;
|
|
119
123
|
}
|
|
120
124
|
return nothing;
|
|
121
125
|
}
|
|
126
|
+
getTagName() {
|
|
127
|
+
return this.href ? "a" : "button";
|
|
128
|
+
}
|
|
122
129
|
render() {
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
/* The eslint rules don't recognize html import from lit/static-html.js */
|
|
131
|
+
/* eslint-disable lit/binding-positions, lit/no-invalid-html */
|
|
132
|
+
return html`<${unsafeStatic(this.getTagName())} class="button" href=${ifDefined(this.href)} ?disabled=${this.disabled}>
|
|
133
|
+
${this.renderBefore()}<span class="label">${this.label}</span
|
|
125
134
|
>${this.renderAfter()}
|
|
126
|
-
|
|
135
|
+
</${unsafeStatic(this.getTagName())}>`;
|
|
136
|
+
/* eslint-enable lit/binding-positions, lit/no-invalid-html */
|
|
127
137
|
}
|
|
128
138
|
}
|
|
129
139
|
_defineProperty(LeuMenuItem, "styles", css_248z);
|
|
@@ -164,10 +174,15 @@ _defineProperty(LeuMenuItem, "properties", {
|
|
|
164
174
|
disabled: {
|
|
165
175
|
type: Boolean,
|
|
166
176
|
reflect: true
|
|
177
|
+
},
|
|
178
|
+
label: {
|
|
179
|
+
type: String,
|
|
180
|
+
reflect: true
|
|
181
|
+
},
|
|
182
|
+
href: {
|
|
183
|
+
type: String,
|
|
184
|
+
reflect: true
|
|
167
185
|
}
|
|
168
186
|
});
|
|
169
|
-
function defineMenuItemElements() {
|
|
170
|
-
defineElement("menu-item", LeuMenuItem);
|
|
171
|
-
}
|
|
172
187
|
|
|
173
|
-
export { LeuMenuItem
|
|
188
|
+
export { LeuMenuItem };
|