@statistikzh/leu 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +27 -2
- package/dist/Button.js +24 -12
- package/dist/Checkbox.js +6 -4
- package/dist/CheckboxGroup.js +2 -1
- package/dist/{Chip-389013ff.js → Chip-5f70d04f.js} +2 -1
- package/dist/ChipGroup.js +2 -1
- package/dist/ChipLink.js +3 -2
- package/dist/ChipRemovable.js +1 -1
- package/dist/ChipSelectable.js +7 -4
- package/dist/Dropdown.js +2 -1
- package/dist/Input.js +38 -15
- package/dist/Menu.js +10 -3
- package/dist/MenuItem.js +4 -2
- package/dist/Pagination.js +4 -2
- package/dist/Radio.js +6 -4
- package/dist/RadioGroup.js +2 -1
- package/dist/Select.js +25 -8
- package/dist/Table.js +10 -5
- package/dist/index.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/theme.css +7 -7
- package/package.json +6 -1
- package/src/components/accordion/Accordion.js +102 -0
- package/src/components/accordion/accordion.css +160 -0
- package/src/components/accordion/leu-accordion.js +3 -0
- package/src/components/accordion/stories/accordion.stories.js +55 -0
- package/src/components/accordion/test/accordion.test.js +22 -0
- package/src/components/button/Button.js +13 -13
- package/src/components/checkbox/Checkbox.js +3 -4
- package/src/components/checkbox/CheckboxGroup.js +1 -1
- package/src/components/chip/Chip.js +1 -1
- package/src/components/chip/ChipGroup.js +1 -1
- package/src/components/chip/ChipLink.js +1 -2
- package/src/components/chip/ChipSelectable.js +3 -3
- package/src/components/dropdown/Dropdown.js +1 -1
- package/src/components/input/Input.js +25 -15
- package/src/components/menu/MenuItem.js +2 -2
- package/src/components/menu/menu.css +9 -3
- package/src/components/pagination/Pagination.js +2 -2
- package/src/components/radio/Radio.js +3 -4
- package/src/components/radio/RadioGroup.js +1 -1
- package/src/components/select/Select.js +29 -9
- package/src/components/table/Table.js +5 -5
- package/src/styles/custom-properties.css +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.0](https://github.com/statistikZH/leu/compare/v0.2.0...v0.3.0) (2023-11-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* refactor component properties to include reflection ([#69](https://github.com/statistikZH/leu/issues/69)) ([cf2992b](https://github.com/statistikZH/leu/commit/cf2992b7c9af76a9e966cae7e4e35f288a155c89))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **checkbox:** remove tabIndex allocation because the property is not used by the component anymore ([4999754](https://github.com/statistikZH/leu/commit/4999754c363bfa996db9c00233845f1f3bab95e5))
|
|
14
|
+
* **radio:** remove tabIndex allocation because the property is not used by the component anymore ([abc9c85](https://github.com/statistikZH/leu/commit/abc9c858e2575600bc3d71a74daf87b333ef509c))
|
|
15
|
+
|
|
16
|
+
## [0.2.0](https://github.com/statistikZH/leu/compare/v0.1.0...v0.2.0) (2023-11-28)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* **accordion:** implement accordion component ([b962d2c](https://github.com/statistikZH/leu/commit/b962d2c51aa17dbb909e8cbcb9ed0436d1b4b84d))
|
|
22
|
+
* **input:** move focus into the input field after clearing the value ([#55](https://github.com/statistikZH/leu/issues/55)) ([ec92026](https://github.com/statistikZH/leu/commit/ec9202689ba2997570531c272162be1da54dc156))
|
|
23
|
+
* **select:** add a more specific label if no options are available ([#57](https://github.com/statistikZH/leu/issues/57)) ([9ed62bf](https://github.com/statistikZH/leu/commit/9ed62bf5eb847c0814a92ff6066313eedf32b44a))
|
|
24
|
+
* **select:** close the select element if a click happens outside of the element ([#58](https://github.com/statistikZH/leu/issues/58)) ([b2df185](https://github.com/statistikZH/leu/commit/b2df18537acc294552984eb539706400305564bb))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* **input:** delegate focus to the actual input field ([ee9b21d](https://github.com/statistikZH/leu/commit/ee9b21de69322b1ebc822ab3a2f3bfb1a0ba6572))
|
|
30
|
+
* **menu:** enforce styles of the hr element with important as they are part of the light dom ([d6d7a3f](https://github.com/statistikZH/leu/commit/d6d7a3f1a2182854747908cf142678f352e1e014))
|
|
31
|
+
* **select:** actually set the filter input ref and use the correct attribute ([ee9b21d](https://github.com/statistikZH/leu/commit/ee9b21de69322b1ebc822ab3a2f3bfb1a0ba6572))
|
|
32
|
+
* **theme:** fix a typo inside the hex notation ([82a6961](https://github.com/statistikZH/leu/commit/82a6961ae44c93826f6d97924a845f4d418b8f3b))
|
|
33
|
+
|
|
3
34
|
## [0.1.0](https://github.com/statistikZH/leu/compare/v0.0.2...v0.1.0) (2023-11-15)
|
|
4
35
|
|
|
5
36
|
|
package/README.md
CHANGED
|
@@ -20,12 +20,37 @@ npm i @statistikzh/leu
|
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
|
+
In order for the components to work, you need to load the theme styles and the font definitions globally.
|
|
24
|
+
The theme file is part of the package (`dist/theme.css`).
|
|
25
|
+
The fonts on the other hand have to be licensed and are therefore not included in the package.
|
|
26
|
+
|
|
27
|
+
If you have an environment that resolves bare module imports, you can use the library like this:
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<link rel="stylesheet" href="@statistikzh/leu/theme.css" />
|
|
31
|
+
<script type="module">
|
|
32
|
+
import "@statistikzh/leu/leu-input.js"
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<leu-input></leu-input>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### CDN
|
|
39
|
+
|
|
40
|
+
Browsers can't resolve bare module imports without import maps. But we can use a CDN to resolve the imports for us.
|
|
41
|
+
This is useful if you're just using plain HTML and JavaScript without any build or transformation steps.
|
|
42
|
+
Also this is applicable in an environment like [Observable](https://observablehq.com).
|
|
43
|
+
|
|
23
44
|
```html
|
|
45
|
+
<link
|
|
46
|
+
rel="stylesheet"
|
|
47
|
+
href="https://esm.run/@statistikzh/leu@0.1/dist/theme.css"
|
|
48
|
+
/>
|
|
24
49
|
<script type="module">
|
|
25
|
-
import "
|
|
50
|
+
import "https://esm.run/@statistikzh/leu@0.1/dist/leu-input.js"
|
|
26
51
|
</script>
|
|
27
52
|
|
|
28
|
-
<leu-
|
|
53
|
+
<leu-input></leu-input>
|
|
29
54
|
```
|
|
30
55
|
|
|
31
56
|
## Linting and formatting
|
package/dist/Button.js
CHANGED
|
@@ -368,40 +368,52 @@ _defineProperty(LeuButton, "shadowRootOptions", {
|
|
|
368
368
|
});
|
|
369
369
|
_defineProperty(LeuButton, "properties", {
|
|
370
370
|
label: {
|
|
371
|
-
type: String
|
|
371
|
+
type: String,
|
|
372
|
+
reflect: true
|
|
372
373
|
},
|
|
373
374
|
icon: {
|
|
374
|
-
type: String
|
|
375
|
+
type: String,
|
|
376
|
+
reflect: true
|
|
375
377
|
},
|
|
376
378
|
iconAfter: {
|
|
377
|
-
type: String
|
|
379
|
+
type: String,
|
|
380
|
+
reflect: true
|
|
378
381
|
},
|
|
379
382
|
size: {
|
|
380
|
-
type: String
|
|
383
|
+
type: String,
|
|
384
|
+
reflect: true
|
|
381
385
|
},
|
|
382
386
|
variant: {
|
|
383
|
-
type: String
|
|
387
|
+
type: String,
|
|
388
|
+
reflect: true
|
|
384
389
|
},
|
|
385
390
|
type: {
|
|
386
|
-
type: String
|
|
391
|
+
type: String,
|
|
392
|
+
reflect: true
|
|
387
393
|
},
|
|
388
394
|
disabled: {
|
|
389
|
-
type: Boolean
|
|
395
|
+
type: Boolean,
|
|
396
|
+
reflect: true
|
|
390
397
|
},
|
|
391
398
|
round: {
|
|
392
|
-
type: Boolean
|
|
399
|
+
type: Boolean,
|
|
400
|
+
reflect: true
|
|
393
401
|
},
|
|
394
402
|
active: {
|
|
395
|
-
type: Boolean
|
|
403
|
+
type: Boolean,
|
|
404
|
+
reflect: true
|
|
396
405
|
},
|
|
397
406
|
inverted: {
|
|
398
|
-
type: Boolean
|
|
407
|
+
type: Boolean,
|
|
408
|
+
reflect: true
|
|
399
409
|
},
|
|
400
410
|
expanded: {
|
|
401
|
-
type: String
|
|
411
|
+
type: String,
|
|
412
|
+
reflect: true
|
|
402
413
|
},
|
|
403
414
|
fluid: {
|
|
404
|
-
type: Boolean
|
|
415
|
+
type: Boolean,
|
|
416
|
+
reflect: true
|
|
405
417
|
}
|
|
406
418
|
});
|
|
407
419
|
function defineButtonElements() {
|
package/dist/Checkbox.js
CHANGED
|
@@ -10,7 +10,6 @@ class LeuCheckbox extends LitElement {
|
|
|
10
10
|
super();
|
|
11
11
|
this.checked = false;
|
|
12
12
|
this.disabled = false;
|
|
13
|
-
this.tabIndex = 0;
|
|
14
13
|
this.checkIcon = Icon("check");
|
|
15
14
|
}
|
|
16
15
|
handleChange(event) {
|
|
@@ -131,13 +130,16 @@ _defineProperty(LeuCheckbox, "properties", {
|
|
|
131
130
|
reflect: true
|
|
132
131
|
},
|
|
133
132
|
identifier: {
|
|
134
|
-
type: String
|
|
133
|
+
type: String,
|
|
134
|
+
reflect: true
|
|
135
135
|
},
|
|
136
136
|
value: {
|
|
137
|
-
type: String
|
|
137
|
+
type: String,
|
|
138
|
+
reflect: true
|
|
138
139
|
},
|
|
139
140
|
name: {
|
|
140
|
-
type: String
|
|
141
|
+
type: String,
|
|
142
|
+
reflect: true
|
|
141
143
|
}
|
|
142
144
|
});
|
|
143
145
|
function defineCheckboxElements() {
|
package/dist/CheckboxGroup.js
CHANGED
package/dist/ChipGroup.js
CHANGED
|
@@ -62,7 +62,8 @@ _defineProperty(LeuChipGroup, "styles", css_248z);
|
|
|
62
62
|
_defineProperty(LeuChipGroup, "properties", {
|
|
63
63
|
selectionMode: {
|
|
64
64
|
type: String,
|
|
65
|
-
attribute: "selection-mode"
|
|
65
|
+
attribute: "selection-mode",
|
|
66
|
+
reflect: true
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
function defineChipGroupElements() {
|
package/dist/ChipLink.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
|
|
2
2
|
import { html } from 'lit';
|
|
3
|
-
import { L as LeuChipBase } from './Chip-
|
|
3
|
+
import { L as LeuChipBase } from './Chip-5f70d04f.js';
|
|
4
4
|
|
|
5
5
|
const SIZES = {
|
|
6
6
|
regular: "regular",
|
|
@@ -31,7 +31,8 @@ _defineProperty(LeuChipLink, "properties", {
|
|
|
31
31
|
* @type {keyof typeof SIZES}
|
|
32
32
|
*/
|
|
33
33
|
size: {
|
|
34
|
-
type: String
|
|
34
|
+
type: String,
|
|
35
|
+
reflect: true
|
|
35
36
|
},
|
|
36
37
|
href: {
|
|
37
38
|
type: String,
|
package/dist/ChipRemovable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
|
|
2
2
|
import { html } from 'lit';
|
|
3
|
-
import { L as LeuChipBase } from './Chip-
|
|
3
|
+
import { L as LeuChipBase } from './Chip-5f70d04f.js';
|
|
4
4
|
import { I as Icon } from './icon-03e86700.js';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/ChipSelectable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
|
|
2
2
|
import { html } from 'lit';
|
|
3
|
-
import { L as LeuChipBase } from './Chip-
|
|
3
|
+
import { L as LeuChipBase } from './Chip-5f70d04f.js';
|
|
4
4
|
|
|
5
5
|
const SIZES = {
|
|
6
6
|
small: "small",
|
|
@@ -62,7 +62,8 @@ _defineProperty(LeuChipSelectable, "properties", {
|
|
|
62
62
|
* @default "regular"
|
|
63
63
|
*/
|
|
64
64
|
size: {
|
|
65
|
-
type: String
|
|
65
|
+
type: String,
|
|
66
|
+
reflect: true
|
|
66
67
|
},
|
|
67
68
|
/**
|
|
68
69
|
* The variant of the chip. Has an effect not only on the visual appearance but also on the behavior.
|
|
@@ -73,14 +74,16 @@ _defineProperty(LeuChipSelectable, "properties", {
|
|
|
73
74
|
* @default "default"
|
|
74
75
|
*/
|
|
75
76
|
variant: {
|
|
76
|
-
type: String
|
|
77
|
+
type: String,
|
|
78
|
+
reflect: true
|
|
77
79
|
},
|
|
78
80
|
selected: {
|
|
79
81
|
type: Boolean,
|
|
80
82
|
reflect: true
|
|
81
83
|
},
|
|
82
84
|
value: {
|
|
83
|
-
type: String
|
|
85
|
+
type: String,
|
|
86
|
+
reflect: true
|
|
84
87
|
}
|
|
85
88
|
});
|
|
86
89
|
function defineChipSelectableElements() {
|
package/dist/Dropdown.js
CHANGED
package/dist/Input.js
CHANGED
|
@@ -443,6 +443,7 @@ class LeuInput extends LitElement {
|
|
|
443
443
|
*/
|
|
444
444
|
clear() {
|
|
445
445
|
this.value = "";
|
|
446
|
+
this._inputRef.value.focus();
|
|
446
447
|
this.dispatchEvent(new CustomEvent("input", {
|
|
447
448
|
bubbles: true,
|
|
448
449
|
composed: true
|
|
@@ -602,6 +603,13 @@ class LeuInput extends LitElement {
|
|
|
602
603
|
}
|
|
603
604
|
}
|
|
604
605
|
_defineProperty(LeuInput, "styles", css_248z);
|
|
606
|
+
/**
|
|
607
|
+
* @internal
|
|
608
|
+
*/
|
|
609
|
+
_defineProperty(LeuInput, "shadowRootOptions", {
|
|
610
|
+
...LitElement.shadowRootOptions,
|
|
611
|
+
delegatesFocus: true
|
|
612
|
+
});
|
|
605
613
|
_defineProperty(LeuInput, "properties", {
|
|
606
614
|
disabled: {
|
|
607
615
|
type: Boolean,
|
|
@@ -616,53 +624,68 @@ _defineProperty(LeuInput, "properties", {
|
|
|
616
624
|
reflect: true
|
|
617
625
|
},
|
|
618
626
|
value: {
|
|
619
|
-
type: String
|
|
627
|
+
type: String,
|
|
628
|
+
reflect: true
|
|
620
629
|
},
|
|
621
630
|
name: {
|
|
622
|
-
type: String
|
|
631
|
+
type: String,
|
|
632
|
+
reflect: true
|
|
623
633
|
},
|
|
624
634
|
error: {
|
|
625
|
-
type: String
|
|
635
|
+
type: String,
|
|
636
|
+
reflect: true
|
|
626
637
|
},
|
|
627
638
|
label: {
|
|
628
|
-
type: String
|
|
639
|
+
type: String,
|
|
640
|
+
reflect: true
|
|
629
641
|
},
|
|
630
642
|
prefix: {
|
|
631
|
-
type: String
|
|
643
|
+
type: String,
|
|
644
|
+
reflect: true
|
|
632
645
|
},
|
|
633
646
|
suffix: {
|
|
634
|
-
type: String
|
|
647
|
+
type: String,
|
|
648
|
+
reflect: true
|
|
635
649
|
},
|
|
636
650
|
size: {
|
|
637
|
-
type: String
|
|
651
|
+
type: String,
|
|
652
|
+
reflect: true
|
|
638
653
|
},
|
|
639
654
|
icon: {
|
|
640
|
-
type: String
|
|
655
|
+
type: String,
|
|
656
|
+
reflect: true
|
|
641
657
|
},
|
|
642
658
|
/* Validation attributes */
|
|
643
659
|
pattern: {
|
|
644
|
-
type: String
|
|
660
|
+
type: String,
|
|
661
|
+
reflect: true
|
|
645
662
|
},
|
|
646
663
|
type: {
|
|
647
|
-
type: String
|
|
664
|
+
type: String,
|
|
665
|
+
reflect: true
|
|
648
666
|
},
|
|
649
667
|
min: {
|
|
650
|
-
type: Number
|
|
668
|
+
type: Number,
|
|
669
|
+
reflect: true
|
|
651
670
|
},
|
|
652
671
|
max: {
|
|
653
|
-
type: Number
|
|
672
|
+
type: Number,
|
|
673
|
+
reflect: true
|
|
654
674
|
},
|
|
655
675
|
maxlength: {
|
|
656
|
-
type: Number
|
|
676
|
+
type: Number,
|
|
677
|
+
reflect: true
|
|
657
678
|
},
|
|
658
679
|
minlength: {
|
|
659
|
-
type: Number
|
|
680
|
+
type: Number,
|
|
681
|
+
reflect: true
|
|
660
682
|
},
|
|
661
683
|
validationMessages: {
|
|
662
684
|
type: Object
|
|
663
685
|
},
|
|
664
686
|
novalidate: {
|
|
665
|
-
type: Boolean
|
|
687
|
+
type: Boolean,
|
|
688
|
+
reflect: true
|
|
666
689
|
},
|
|
667
690
|
/** @type {ValidityState} */
|
|
668
691
|
_validity: {
|
package/dist/Menu.js
CHANGED
|
@@ -10,10 +10,17 @@ var css_248z = css`:host,
|
|
|
10
10
|
--menu-divider-color: var(--leu-color-black-transp-20);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/*
|
|
14
|
+
* Set styles with important as the hr element is part of the
|
|
15
|
+
* light dom and therefore is affected by the global styles.
|
|
16
|
+
*/
|
|
17
|
+
|
|
13
18
|
:host ::slotted(hr) {
|
|
14
|
-
border: 0;
|
|
15
|
-
border-top: 1px solid var(--menu-divider-color);
|
|
16
|
-
margin: 0.5rem 0;
|
|
19
|
+
border: 0 !important;
|
|
20
|
+
border-top: 1px solid var(--menu-divider-color) !important;
|
|
21
|
+
margin: 0.5rem 0 !important;
|
|
22
|
+
padding: 0 !important;
|
|
23
|
+
background: none !important;
|
|
17
24
|
}
|
|
18
25
|
`;
|
|
19
26
|
|
package/dist/MenuItem.js
CHANGED
|
@@ -141,7 +141,8 @@ _defineProperty(LeuMenuItem, "properties", {
|
|
|
141
141
|
* If the value is "EMPTY", an empty placeholder with the size of an icon will be displayed.
|
|
142
142
|
*/
|
|
143
143
|
before: {
|
|
144
|
-
type: String
|
|
144
|
+
type: String,
|
|
145
|
+
reflect: true
|
|
145
146
|
},
|
|
146
147
|
/**
|
|
147
148
|
* Can be either an icon name or a text
|
|
@@ -149,7 +150,8 @@ _defineProperty(LeuMenuItem, "properties", {
|
|
|
149
150
|
* If the value is "EMPTY", an empty placeholder with the size of an icon will be displayed.
|
|
150
151
|
*/
|
|
151
152
|
after: {
|
|
152
|
-
type: String
|
|
153
|
+
type: String,
|
|
154
|
+
reflect: true
|
|
153
155
|
},
|
|
154
156
|
active: {
|
|
155
157
|
type: Boolean,
|
package/dist/Pagination.js
CHANGED
|
@@ -175,10 +175,12 @@ _defineProperty(LeuPagination, "properties", {
|
|
|
175
175
|
reflect: true
|
|
176
176
|
},
|
|
177
177
|
itemsOnAPage: {
|
|
178
|
-
type: Number
|
|
178
|
+
type: Number,
|
|
179
|
+
reflect: true
|
|
179
180
|
},
|
|
180
181
|
dataLength: {
|
|
181
|
-
type: Number
|
|
182
|
+
type: Number,
|
|
183
|
+
reflect: true
|
|
182
184
|
},
|
|
183
185
|
_minPage: {
|
|
184
186
|
type: Number,
|
package/dist/Radio.js
CHANGED
|
@@ -102,7 +102,6 @@ class LeuRadio extends LitElement {
|
|
|
102
102
|
super();
|
|
103
103
|
this.checked = false;
|
|
104
104
|
this.disabled = false;
|
|
105
|
-
this.tabIndex = 0;
|
|
106
105
|
}
|
|
107
106
|
handleChange(event) {
|
|
108
107
|
this.checked = event.target.checked;
|
|
@@ -144,13 +143,16 @@ _defineProperty(LeuRadio, "properties", {
|
|
|
144
143
|
reflect: true
|
|
145
144
|
},
|
|
146
145
|
identifier: {
|
|
147
|
-
type: String
|
|
146
|
+
type: String,
|
|
147
|
+
reflect: true
|
|
148
148
|
},
|
|
149
149
|
value: {
|
|
150
|
-
type: String
|
|
150
|
+
type: String,
|
|
151
|
+
reflect: true
|
|
151
152
|
},
|
|
152
153
|
name: {
|
|
153
|
-
type: String
|
|
154
|
+
type: String,
|
|
155
|
+
reflect: true
|
|
154
156
|
}
|
|
155
157
|
});
|
|
156
158
|
function defineRadioElements() {
|
package/dist/RadioGroup.js
CHANGED
package/dist/Select.js
CHANGED
|
@@ -325,7 +325,8 @@ class LeuSelect extends LitElement {
|
|
|
325
325
|
attribute: "open"
|
|
326
326
|
},
|
|
327
327
|
label: {
|
|
328
|
-
type: String
|
|
328
|
+
type: String,
|
|
329
|
+
reflect: true
|
|
329
330
|
},
|
|
330
331
|
options: {
|
|
331
332
|
type: Array
|
|
@@ -369,6 +370,16 @@ class LeuSelect extends LitElement {
|
|
|
369
370
|
constructor() {
|
|
370
371
|
super();
|
|
371
372
|
_defineProperty(this, "hasSlotController", new HasSlotController(this, ["before", "after"]));
|
|
373
|
+
/**
|
|
374
|
+
* Handles clicks outside of the component to close the dropdown.
|
|
375
|
+
* @internal
|
|
376
|
+
* @param {MouseEvent} event
|
|
377
|
+
*/
|
|
378
|
+
_defineProperty(this, "handleDocumentClick", event => {
|
|
379
|
+
if (!this.contains(event.target) && this.open) {
|
|
380
|
+
this.closeDropdown();
|
|
381
|
+
}
|
|
382
|
+
});
|
|
372
383
|
/**
|
|
373
384
|
* @internal
|
|
374
385
|
* @param {KeyboardEvent} e
|
|
@@ -398,9 +409,17 @@ class LeuSelect extends LitElement {
|
|
|
398
409
|
this.optionFilterRef = createRef();
|
|
399
410
|
this.toggleButtonRef = createRef();
|
|
400
411
|
}
|
|
412
|
+
connectedCallback() {
|
|
413
|
+
super.connectedCallback();
|
|
414
|
+
document.addEventListener("click", this.handleDocumentClick);
|
|
415
|
+
}
|
|
416
|
+
disconnectedCallback() {
|
|
417
|
+
super.disconnectedCallback();
|
|
418
|
+
document.removeEventListener("click", this.handleDocumentClick);
|
|
419
|
+
}
|
|
401
420
|
updated(changedProperties) {
|
|
402
421
|
if (changedProperties.has("open") && this.open) {
|
|
403
|
-
if (this.
|
|
422
|
+
if (this.filterable) {
|
|
404
423
|
this.optionFilterRef.value.focus();
|
|
405
424
|
} else {
|
|
406
425
|
this.menuRef.value.focus();
|
|
@@ -446,11 +465,6 @@ class LeuSelect extends LitElement {
|
|
|
446
465
|
}
|
|
447
466
|
this.emitUpdateEvents();
|
|
448
467
|
}
|
|
449
|
-
clearOptionFilter() {
|
|
450
|
-
// refocus before removing the button, otherwise closeDropdown is triggered
|
|
451
|
-
this.optionFilterRef.value.focus();
|
|
452
|
-
this.optionFilter = "";
|
|
453
|
-
}
|
|
454
468
|
toggleDropdown() {
|
|
455
469
|
if (!this.disabled) {
|
|
456
470
|
this.open = !this.open;
|
|
@@ -525,7 +539,9 @@ class LeuSelect extends LitElement {
|
|
|
525
539
|
>
|
|
526
540
|
${LeuSelect.getOptionLabel(option)}
|
|
527
541
|
</leu-menu-item>`;
|
|
528
|
-
}) : html`<leu-menu-item disabled
|
|
542
|
+
}) : html`<leu-menu-item disabled
|
|
543
|
+
>${this.optionFilter === "" ? "Keine Optionen" : "Keine Resultate"}</leu-menu-item
|
|
544
|
+
>`}
|
|
529
545
|
</leu-menu>
|
|
530
546
|
`;
|
|
531
547
|
}
|
|
@@ -536,6 +552,7 @@ class LeuSelect extends LitElement {
|
|
|
536
552
|
size="small"
|
|
537
553
|
@input=${this.handleFilterInput}
|
|
538
554
|
clearable
|
|
555
|
+
ref=${ref(this.optionFilterRef)}
|
|
539
556
|
>Nach Stichwort filtern</leu-input
|
|
540
557
|
>`;
|
|
541
558
|
}
|
package/dist/Table.js
CHANGED
|
@@ -255,19 +255,24 @@ _defineProperty(LeuTable, "properties", {
|
|
|
255
255
|
type: Array
|
|
256
256
|
},
|
|
257
257
|
firstColumnSticky: {
|
|
258
|
-
type: Boolean
|
|
258
|
+
type: Boolean,
|
|
259
|
+
reflect: true
|
|
259
260
|
},
|
|
260
261
|
itemsOnAPage: {
|
|
261
|
-
type: Number
|
|
262
|
+
type: Number,
|
|
263
|
+
reflect: true
|
|
262
264
|
},
|
|
263
265
|
sortIndex: {
|
|
264
|
-
type: Number
|
|
266
|
+
type: Number,
|
|
267
|
+
reflect: true
|
|
265
268
|
},
|
|
266
269
|
sortOrderAsc: {
|
|
267
|
-
type: Boolean
|
|
270
|
+
type: Boolean,
|
|
271
|
+
reflect: true
|
|
268
272
|
},
|
|
269
273
|
width: {
|
|
270
|
-
type: Number
|
|
274
|
+
type: Number,
|
|
275
|
+
reflect: true
|
|
271
276
|
},
|
|
272
277
|
_shadowLeft: {
|
|
273
278
|
type: Boolean,
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import './defineElement-ba770aed.js';
|
|
|
19
19
|
import 'lit';
|
|
20
20
|
import 'lit/directives/class-map.js';
|
|
21
21
|
import './icon-03e86700.js';
|
|
22
|
-
import './Chip-
|
|
22
|
+
import './Chip-5f70d04f.js';
|
|
23
23
|
import 'lit/directives/if-defined.js';
|
|
24
24
|
import 'lit/directives/ref.js';
|
|
25
25
|
import 'lit/directives/map.js';
|
package/dist/leu-chip-link.js
CHANGED
package/dist/theme.css
CHANGED
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
--leu-color-accent-violet: #7f3da7;
|
|
30
30
|
--leu-color-accent-gray: var(--leu-color-black-60);
|
|
31
31
|
|
|
32
|
-
--leu-color-accent-blue-soft:
|
|
33
|
-
--leu-color-accent-darkblue-soft:
|
|
34
|
-
--leu-color-accent-turquoise-soft:
|
|
35
|
-
--leu-color-accent-green-soft:
|
|
36
|
-
--leu-color-accent-bordeaux-soft:
|
|
37
|
-
--leu-color-accent-magenta-soft:
|
|
38
|
-
--leu-color-accent-violet-soft:
|
|
32
|
+
--leu-color-accent-blue-soft: #edf5fa;
|
|
33
|
+
--leu-color-accent-darkblue-soft: #e0e8ee;
|
|
34
|
+
--leu-color-accent-turquoise-soft: #e8f3f2;
|
|
35
|
+
--leu-color-accent-green-soft: #ebf6eb;
|
|
36
|
+
--leu-color-accent-bordeaux-soft: #f6e3ea;
|
|
37
|
+
--leu-color-accent-magenta-soft: #fcedf3;
|
|
38
|
+
--leu-color-accent-violet-soft: #ece2f1;
|
|
39
39
|
--leu-color-accent-gray-soft: var(--leu-color-black-10);
|
|
40
40
|
|
|
41
41
|
--leu-color-func-cyan: #009ee0;
|
package/package.json
CHANGED
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
"description": "UI component library of the canton of zurich",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "statistikzh",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.3.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/statistikzh/leu.git"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/statistikzh/leu/",
|
|
10
15
|
"scripts": {
|
|
11
16
|
"analyze": "cem analyze --litelement --globs \"src/**/*.js\"",
|
|
12
17
|
"build": "rimraf dist && npm run build:js && npm run build:css",
|