@statistikzh/leu 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release-please.yml +20 -1
- package/CHANGELOG.md +12 -0
- package/babel.config.json +3 -0
- package/dist/{Button-83c6df93.js → Button.js} +58 -50
- package/dist/ButtonGroup.js +75 -0
- package/dist/Checkbox.js +60 -57
- package/dist/CheckboxGroup.js +35 -41
- package/dist/{Chip-60af1402.js → Chip-389013ff.js} +12 -13
- package/dist/ChipGroup.js +27 -34
- package/dist/ChipLink.js +18 -19
- package/dist/ChipRemovable.js +9 -13
- package/dist/ChipSelectable.js +42 -44
- package/dist/Dropdown.js +75 -0
- package/dist/Input.js +112 -122
- package/dist/Menu.js +33 -0
- package/dist/MenuItem.js +171 -0
- package/dist/Pagination.js +193 -0
- package/dist/Radio.js +26 -22
- package/dist/RadioGroup.js +75 -105
- package/dist/Select.js +103 -337
- package/dist/Table.js +294 -8
- package/dist/defineElement-ba770aed.js +44 -0
- package/dist/icon-03e86700.js +136 -0
- package/dist/index.js +14 -9
- package/dist/leu-button-group.js +8 -0
- package/dist/leu-button.js +7 -0
- package/dist/leu-checkbox-group.js +1 -1
- package/dist/leu-checkbox.js +2 -2
- package/dist/leu-chip-group.js +1 -1
- package/dist/leu-chip-link.js +2 -2
- package/dist/leu-chip-removable.js +3 -3
- package/dist/leu-chip-selectable.js +2 -2
- package/dist/leu-dropdown.js +10 -0
- package/dist/leu-input.js +2 -2
- package/dist/leu-menu-item.js +6 -0
- package/dist/leu-menu.js +5 -0
- package/dist/leu-pagination.js +8 -0
- package/dist/leu-radio-group.js +1 -1
- package/dist/leu-radio.js +1 -1
- package/dist/leu-select.js +5 -3
- package/dist/leu-table.js +5 -4
- package/index.js +7 -3
- package/package.json +3 -1
- package/rollup.config.js +26 -9
- package/.github/workflows/publish.yml +0 -19
- package/dist/Table-72d305d7.js +0 -506
- package/dist/defineElement-47d4f665.js +0 -15
- package/dist/icon-b68c7e1e.js +0 -202
|
@@ -7,13 +7,32 @@ permissions:
|
|
|
7
7
|
contents: write
|
|
8
8
|
pull-requests: write
|
|
9
9
|
|
|
10
|
-
name: release
|
|
10
|
+
name: Create release and publish to npm
|
|
11
11
|
|
|
12
12
|
jobs:
|
|
13
13
|
release-please:
|
|
14
14
|
runs-on: ubuntu-latest
|
|
15
15
|
steps:
|
|
16
16
|
- uses: google-github-actions/release-please-action@v3
|
|
17
|
+
id: release
|
|
17
18
|
with:
|
|
18
19
|
release-type: node
|
|
19
20
|
package-name: "@statistikzh/leu"
|
|
21
|
+
# The logic below handles the npm publication:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
# these if statements ensure that a publication only occurs when
|
|
24
|
+
# a new release is created:
|
|
25
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
26
|
+
- uses: actions/setup-node@v3
|
|
27
|
+
with:
|
|
28
|
+
node-version: "20.x"
|
|
29
|
+
registry-url: "https://registry.npmjs.org"
|
|
30
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
31
|
+
- run: npm ci
|
|
32
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
33
|
+
- run: npm run build
|
|
34
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
35
|
+
- run: npm publish --access public
|
|
36
|
+
env:
|
|
37
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
38
|
+
if: ${{ steps.release.outputs.release_created }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.0](https://github.com/statistikZH/leu/compare/v0.0.2...v0.1.0) (2023-11-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* use the transform class property babel plugin for the build ([e582230](https://github.com/statistikZH/leu/commit/e582230ac52bb74babd32cd2a83acea0a3cdd44e))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* build all the available components ([f7c27c5](https://github.com/statistikZH/leu/commit/f7c27c53396c0f46f27285f6e1f529d43dc35588))
|
|
14
|
+
|
|
3
15
|
## [0.0.2](https://github.com/statistikZH/leu/compare/v0.0.1...v0.0.2) (2023-11-15)
|
|
4
16
|
|
|
5
17
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
|
|
1
2
|
import { css, LitElement, html, nothing } from 'lit';
|
|
2
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
3
|
-
import { I as Icon } from './icon-
|
|
4
|
-
import { d as defineElement } from './defineElement-47d4f665.js';
|
|
4
|
+
import { I as Icon } from './icon-03e86700.js';
|
|
5
5
|
|
|
6
6
|
var css_248z = css`:host {
|
|
7
7
|
display: inline-block;
|
|
@@ -266,13 +266,10 @@ Live Demo: zh.ch
|
|
|
266
266
|
|
|
267
267
|
const BUTTON_VARIANTS = ["primary", "secondary", "ghost"];
|
|
268
268
|
Object.freeze(BUTTON_VARIANTS);
|
|
269
|
-
|
|
270
269
|
const BUTTON_SIZES = ["normal", "small"];
|
|
271
270
|
Object.freeze(BUTTON_SIZES);
|
|
272
|
-
|
|
273
271
|
const BUTTON_TYPES = ["button", "submit", "reset"];
|
|
274
272
|
Object.freeze(BUTTON_TYPES);
|
|
275
|
-
|
|
276
273
|
const BUTTON_EXPANDED_OPTIONS = ["open", "closed"];
|
|
277
274
|
Object.freeze(BUTTON_EXPANDED_OPTIONS);
|
|
278
275
|
|
|
@@ -280,32 +277,6 @@ Object.freeze(BUTTON_EXPANDED_OPTIONS);
|
|
|
280
277
|
* @tagname leu-button
|
|
281
278
|
*/
|
|
282
279
|
class LeuButton extends LitElement {
|
|
283
|
-
static styles = css_248z
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* @internal
|
|
287
|
-
*/
|
|
288
|
-
static shadowRootOptions = {
|
|
289
|
-
...LitElement.shadowRootOptions,
|
|
290
|
-
delegatesFocus: true,
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
static properties = {
|
|
294
|
-
label: { type: String },
|
|
295
|
-
icon: { type: String },
|
|
296
|
-
iconAfter: { type: String },
|
|
297
|
-
size: { type: String },
|
|
298
|
-
variant: { type: String },
|
|
299
|
-
type: { type: String },
|
|
300
|
-
|
|
301
|
-
disabled: { type: Boolean },
|
|
302
|
-
round: { type: Boolean },
|
|
303
|
-
active: { type: Boolean },
|
|
304
|
-
inverted: { type: Boolean },
|
|
305
|
-
expanded: { type: String },
|
|
306
|
-
fluid: { type: Boolean },
|
|
307
|
-
}
|
|
308
|
-
|
|
309
280
|
constructor() {
|
|
310
281
|
super();
|
|
311
282
|
/** @type {string} */
|
|
@@ -339,41 +310,33 @@ class LeuButton extends LitElement {
|
|
|
339
310
|
*/
|
|
340
311
|
this.expanded = undefined;
|
|
341
312
|
}
|
|
342
|
-
|
|
343
313
|
getIconSize() {
|
|
344
|
-
return this.size === "small" || this.variant === "ghost" ? 16 : 24
|
|
314
|
+
return this.size === "small" || this.variant === "ghost" ? 16 : 24;
|
|
345
315
|
}
|
|
346
|
-
|
|
347
316
|
renderIconBefore() {
|
|
348
317
|
if (this.icon) {
|
|
349
318
|
return html`<div class="icon-wrapper icon-wrapper--before">
|
|
350
319
|
${Icon(this.icon, this.getIconSize())}
|
|
351
|
-
</div
|
|
320
|
+
</div>`;
|
|
352
321
|
}
|
|
353
|
-
|
|
354
|
-
return nothing
|
|
322
|
+
return nothing;
|
|
355
323
|
}
|
|
356
|
-
|
|
357
324
|
renderIconAfter() {
|
|
358
325
|
if (this.iconAfter && this.label && !this.icon) {
|
|
359
326
|
return html`<div class="icon-wrapper icon-wrapper--after">
|
|
360
327
|
${Icon(this.iconAfter, this.getIconSize())}
|
|
361
|
-
</div
|
|
328
|
+
</div>`;
|
|
362
329
|
}
|
|
363
|
-
|
|
364
|
-
return nothing
|
|
330
|
+
return nothing;
|
|
365
331
|
}
|
|
366
|
-
|
|
367
332
|
renderExpandingIcon() {
|
|
368
333
|
if (typeof this.expanded !== "undefined" && this.variant === "ghost") {
|
|
369
334
|
return html`<div class="icon-wrapper icon-wrapper--expanded">
|
|
370
335
|
${Icon("angleDropDown", 24)}
|
|
371
|
-
</div
|
|
336
|
+
</div>`;
|
|
372
337
|
}
|
|
373
|
-
|
|
374
|
-
return nothing
|
|
338
|
+
return nothing;
|
|
375
339
|
}
|
|
376
|
-
|
|
377
340
|
render() {
|
|
378
341
|
const cssClasses = {
|
|
379
342
|
icon: !this.label && this.icon && !this.iconAfter,
|
|
@@ -381,7 +344,7 @@ class LeuButton extends LitElement {
|
|
|
381
344
|
active: this.active,
|
|
382
345
|
inverted: this.inverted,
|
|
383
346
|
[this.variant]: true,
|
|
384
|
-
[this.size]: true
|
|
347
|
+
[this.size]: true
|
|
385
348
|
};
|
|
386
349
|
return html`
|
|
387
350
|
<button
|
|
@@ -392,12 +355,57 @@ class LeuButton extends LitElement {
|
|
|
392
355
|
${this.renderIconBefore()} ${this.label} ${this.renderIconAfter()}
|
|
393
356
|
${this.renderExpandingIcon()}
|
|
394
357
|
</button>
|
|
395
|
-
|
|
358
|
+
`;
|
|
396
359
|
}
|
|
397
360
|
}
|
|
398
|
-
|
|
361
|
+
_defineProperty(LeuButton, "styles", css_248z);
|
|
362
|
+
/**
|
|
363
|
+
* @internal
|
|
364
|
+
*/
|
|
365
|
+
_defineProperty(LeuButton, "shadowRootOptions", {
|
|
366
|
+
...LitElement.shadowRootOptions,
|
|
367
|
+
delegatesFocus: true
|
|
368
|
+
});
|
|
369
|
+
_defineProperty(LeuButton, "properties", {
|
|
370
|
+
label: {
|
|
371
|
+
type: String
|
|
372
|
+
},
|
|
373
|
+
icon: {
|
|
374
|
+
type: String
|
|
375
|
+
},
|
|
376
|
+
iconAfter: {
|
|
377
|
+
type: String
|
|
378
|
+
},
|
|
379
|
+
size: {
|
|
380
|
+
type: String
|
|
381
|
+
},
|
|
382
|
+
variant: {
|
|
383
|
+
type: String
|
|
384
|
+
},
|
|
385
|
+
type: {
|
|
386
|
+
type: String
|
|
387
|
+
},
|
|
388
|
+
disabled: {
|
|
389
|
+
type: Boolean
|
|
390
|
+
},
|
|
391
|
+
round: {
|
|
392
|
+
type: Boolean
|
|
393
|
+
},
|
|
394
|
+
active: {
|
|
395
|
+
type: Boolean
|
|
396
|
+
},
|
|
397
|
+
inverted: {
|
|
398
|
+
type: Boolean
|
|
399
|
+
},
|
|
400
|
+
expanded: {
|
|
401
|
+
type: String
|
|
402
|
+
},
|
|
403
|
+
fluid: {
|
|
404
|
+
type: Boolean
|
|
405
|
+
}
|
|
406
|
+
});
|
|
399
407
|
function defineButtonElements() {
|
|
400
408
|
defineElement("button", LeuButton);
|
|
401
409
|
}
|
|
402
410
|
|
|
403
|
-
export {
|
|
411
|
+
export { BUTTON_EXPANDED_OPTIONS, BUTTON_SIZES, BUTTON_TYPES, BUTTON_VARIANTS, LeuButton, defineButtonElements };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
|
|
2
|
+
import { css, LitElement, html } from 'lit';
|
|
3
|
+
import { defineButtonElements } from './Button.js';
|
|
4
|
+
import 'lit/directives/class-map.js';
|
|
5
|
+
import './icon-03e86700.js';
|
|
6
|
+
|
|
7
|
+
var css_248z = css`:host,
|
|
8
|
+
:host * {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.group {
|
|
13
|
+
display: flex;
|
|
14
|
+
gap: 0.5rem;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @tagname leu-button-group
|
|
21
|
+
*/
|
|
22
|
+
class LeuButtonGroup extends LitElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
/** @type {Array} */
|
|
26
|
+
this.items = [];
|
|
27
|
+
/** @type {string} */
|
|
28
|
+
this.value = null;
|
|
29
|
+
}
|
|
30
|
+
_setValue(newValue) {
|
|
31
|
+
this.value = newValue;
|
|
32
|
+
this.dispatchEvent(new CustomEvent("input", {
|
|
33
|
+
bubbles: true,
|
|
34
|
+
composed: true,
|
|
35
|
+
detail: {
|
|
36
|
+
value: newValue
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
return html`
|
|
42
|
+
<div role="menubar" class="group">
|
|
43
|
+
${this.items.map(item => html`
|
|
44
|
+
<leu-button
|
|
45
|
+
label=${item}
|
|
46
|
+
variant=${this.value === item ? "primary" : "secondary"}
|
|
47
|
+
@click=${() => {
|
|
48
|
+
this._setValue(item);
|
|
49
|
+
}}
|
|
50
|
+
role="menuitemradio"
|
|
51
|
+
aria-checked=${this.value === item}
|
|
52
|
+
>
|
|
53
|
+
</leu-button>
|
|
54
|
+
`)}
|
|
55
|
+
</div>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
_defineProperty(LeuButtonGroup, "styles", css_248z);
|
|
60
|
+
_defineProperty(LeuButtonGroup, "properties", {
|
|
61
|
+
items: {
|
|
62
|
+
type: Array,
|
|
63
|
+
reflect: true
|
|
64
|
+
},
|
|
65
|
+
value: {
|
|
66
|
+
type: String,
|
|
67
|
+
reflect: true
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
function defineButtonGroupElements() {
|
|
71
|
+
defineButtonElements();
|
|
72
|
+
defineElement("button-group", LeuButtonGroup);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { LeuButtonGroup, defineButtonGroupElements };
|
package/dist/Checkbox.js
CHANGED
|
@@ -1,12 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
|
|
2
|
+
import { css, LitElement, html } from 'lit';
|
|
3
|
+
import { I as Icon } from './icon-03e86700.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @tagname leu-checkbox
|
|
7
7
|
*/
|
|
8
8
|
class LeuCheckbox extends LitElement {
|
|
9
|
-
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.checked = false;
|
|
12
|
+
this.disabled = false;
|
|
13
|
+
this.tabIndex = 0;
|
|
14
|
+
this.checkIcon = Icon("check");
|
|
15
|
+
}
|
|
16
|
+
handleChange(event) {
|
|
17
|
+
this.checked = event.target.checked;
|
|
18
|
+
const customEvent = new CustomEvent(event.type, event);
|
|
19
|
+
this.dispatchEvent(customEvent);
|
|
20
|
+
}
|
|
21
|
+
handleInput(event) {
|
|
22
|
+
this.checked = event.target.checked;
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html`
|
|
26
|
+
<input
|
|
27
|
+
id=${this.identifier}
|
|
28
|
+
class="checkbox"
|
|
29
|
+
type="checkbox"
|
|
30
|
+
name="${this.name}"
|
|
31
|
+
@change=${this.handleChange}
|
|
32
|
+
@input=${this.handleInput}
|
|
33
|
+
.checked=${this.checked}
|
|
34
|
+
?disabled=${this.disabled}
|
|
35
|
+
.value=${this.value}
|
|
36
|
+
/>
|
|
37
|
+
<label for=${this.identifier} class="label"><slot></slot></label>
|
|
38
|
+
<div class="icon">${this.checkIcon}</div>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
_defineProperty(LeuCheckbox, "styles", css`
|
|
10
43
|
:host {
|
|
11
44
|
--checkbox-color: var(--leu-color-black-40);
|
|
12
45
|
--checkbox-color-disabled: var(--leu-color-black-20);
|
|
@@ -83,60 +116,30 @@ class LeuCheckbox extends LitElement {
|
|
|
83
116
|
color: var(--checkbox-tick-color);
|
|
84
117
|
pointer-events: none;
|
|
85
118
|
}
|
|
86
|
-
`
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
`);
|
|
120
|
+
_defineProperty(LeuCheckbox, "shadowRootOptions", {
|
|
121
|
+
...LitElement.shadowRootOptions,
|
|
122
|
+
delegatesFocus: true
|
|
123
|
+
});
|
|
124
|
+
_defineProperty(LeuCheckbox, "properties", {
|
|
125
|
+
checked: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
reflect: true
|
|
128
|
+
},
|
|
129
|
+
disabled: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
reflect: true
|
|
132
|
+
},
|
|
133
|
+
identifier: {
|
|
134
|
+
type: String
|
|
135
|
+
},
|
|
136
|
+
value: {
|
|
137
|
+
type: String
|
|
138
|
+
},
|
|
139
|
+
name: {
|
|
140
|
+
type: String
|
|
108
141
|
}
|
|
109
|
-
|
|
110
|
-
handleChange(event) {
|
|
111
|
-
this.checked = event.target.checked;
|
|
112
|
-
|
|
113
|
-
const customEvent = new CustomEvent(event.type, event);
|
|
114
|
-
this.dispatchEvent(customEvent);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
handleInput(event) {
|
|
118
|
-
this.checked = event.target.checked;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
render() {
|
|
122
|
-
return html`
|
|
123
|
-
<input
|
|
124
|
-
id=${this.identifier}
|
|
125
|
-
class="checkbox"
|
|
126
|
-
type="checkbox"
|
|
127
|
-
name="${this.name}"
|
|
128
|
-
@change=${this.handleChange}
|
|
129
|
-
@input=${this.handleInput}
|
|
130
|
-
.checked=${this.checked}
|
|
131
|
-
?disabled=${this.disabled}
|
|
132
|
-
.value=${this.value}
|
|
133
|
-
/>
|
|
134
|
-
<label for=${this.identifier} class="label"><slot></slot></label>
|
|
135
|
-
<div class="icon">${this.checkIcon}</div>
|
|
136
|
-
`
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
142
|
+
});
|
|
140
143
|
function defineCheckboxElements() {
|
|
141
144
|
defineElement("checkbox", LeuCheckbox);
|
|
142
145
|
}
|
package/dist/CheckboxGroup.js
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
|
|
2
|
+
import { css, LitElement, html } from 'lit';
|
|
2
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
3
|
-
import { d as defineElement } from './defineElement-47d4f665.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @tagname leu-checkbox-group
|
|
7
7
|
*/
|
|
8
8
|
class LeuCheckboxGroup extends LitElement {
|
|
9
|
-
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.orientation = "HORIZONTAL";
|
|
12
|
+
this.items = [];
|
|
13
|
+
}
|
|
14
|
+
get value() {
|
|
15
|
+
return this.items.filter(i => i.checked).map(i => i.value);
|
|
16
|
+
}
|
|
17
|
+
handleSlotChange() {
|
|
18
|
+
this.handleItems();
|
|
19
|
+
}
|
|
20
|
+
handleItems() {
|
|
21
|
+
this.items = [...this.querySelectorAll(":scope > *:not([slot])")];
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
const fieldsetClasses = {
|
|
25
|
+
fieldset: "true",
|
|
26
|
+
"fieldset--vertical": this.orientation === "VERTICAL"
|
|
27
|
+
};
|
|
28
|
+
return html`
|
|
29
|
+
<fieldset class=${classMap(fieldsetClasses)}>
|
|
30
|
+
<legend class="legend"><slot name="legend"></slot></legend>
|
|
31
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
32
|
+
</fieldset>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
_defineProperty(LeuCheckboxGroup, "styles", css`
|
|
10
37
|
:host {
|
|
11
38
|
--group-font-regular: var(--leu-font-regular);
|
|
12
39
|
--group-font-black: var(--leu-font-black);
|
|
@@ -36,45 +63,12 @@ class LeuCheckboxGroup extends LitElement {
|
|
|
36
63
|
|
|
37
64
|
margin-bottom: 0.5rem;
|
|
38
65
|
}
|
|
39
|
-
`
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
constructor() {
|
|
46
|
-
super();
|
|
47
|
-
this.orientation = "HORIZONTAL";
|
|
48
|
-
this.items = [];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get value() {
|
|
52
|
-
return this.items.filter((i) => i.checked).map((i) => i.value)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
handleSlotChange() {
|
|
56
|
-
this.handleItems();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
handleItems() {
|
|
60
|
-
this.items = [...this.querySelectorAll(":scope > *:not([slot])")];
|
|
66
|
+
`);
|
|
67
|
+
_defineProperty(LeuCheckboxGroup, "properties", {
|
|
68
|
+
orientation: {
|
|
69
|
+
type: String
|
|
61
70
|
}
|
|
62
|
-
|
|
63
|
-
render() {
|
|
64
|
-
const fieldsetClasses = {
|
|
65
|
-
fieldset: "true",
|
|
66
|
-
"fieldset--vertical": this.orientation === "VERTICAL",
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return html`
|
|
70
|
-
<fieldset class=${classMap(fieldsetClasses)}>
|
|
71
|
-
<legend class="legend"><slot name="legend"></slot></legend>
|
|
72
|
-
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
73
|
-
</fieldset>
|
|
74
|
-
`
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
71
|
+
});
|
|
78
72
|
function defineCheckboxGroupElements() {
|
|
79
73
|
defineElement("checkbox-group", LeuCheckboxGroup);
|
|
80
74
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ as _defineProperty } from './defineElement-ba770aed.js';
|
|
1
2
|
import { css, LitElement } from 'lit';
|
|
2
3
|
|
|
3
4
|
var css_248z = css`:host,
|
|
@@ -140,23 +141,21 @@ var css_248z = css`:host,
|
|
|
140
141
|
/* Design: https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=21161-184433&mode=design&t=Kjo5VDiqivihn8dh-11 */
|
|
141
142
|
|
|
142
143
|
class LeuChipBase extends LitElement {
|
|
143
|
-
static styles = css_248z
|
|
144
|
-
|
|
145
|
-
/** @internal */
|
|
146
|
-
static shadowRootOptions = {
|
|
147
|
-
...LitElement.shadowRootOptions,
|
|
148
|
-
delegatesFocus: true,
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
static properties = {
|
|
152
|
-
inverted: { type: Boolean },
|
|
153
|
-
}
|
|
154
|
-
|
|
155
144
|
constructor() {
|
|
156
145
|
super();
|
|
157
|
-
|
|
158
146
|
this.inverted = false;
|
|
159
147
|
}
|
|
160
148
|
}
|
|
149
|
+
_defineProperty(LeuChipBase, "styles", css_248z);
|
|
150
|
+
/** @internal */
|
|
151
|
+
_defineProperty(LeuChipBase, "shadowRootOptions", {
|
|
152
|
+
...LitElement.shadowRootOptions,
|
|
153
|
+
delegatesFocus: true
|
|
154
|
+
});
|
|
155
|
+
_defineProperty(LeuChipBase, "properties", {
|
|
156
|
+
inverted: {
|
|
157
|
+
type: Boolean
|
|
158
|
+
}
|
|
159
|
+
});
|
|
161
160
|
|
|
162
161
|
export { LeuChipBase as L };
|
package/dist/ChipGroup.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
|
|
1
2
|
import { css, LitElement, html } from 'lit';
|
|
2
|
-
import { d as defineElement } from './defineElement-47d4f665.js';
|
|
3
3
|
|
|
4
4
|
var css_248z = css`:host {
|
|
5
5
|
display: flex;
|
|
@@ -13,7 +13,7 @@ var css_248z = css`:host {
|
|
|
13
13
|
const SELECTION_MODES = {
|
|
14
14
|
single: "single",
|
|
15
15
|
multiple: "multiple",
|
|
16
|
-
none: "none"
|
|
16
|
+
none: "none"
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -21,57 +21,50 @@ const SELECTION_MODES = {
|
|
|
21
21
|
* @tagname leu-chip-group
|
|
22
22
|
*/
|
|
23
23
|
class LeuChipGroup extends LitElement {
|
|
24
|
-
static styles = css_248z
|
|
25
|
-
|
|
26
|
-
static properties = {
|
|
27
|
-
selectionMode: { type: String, attribute: "selection-mode" },
|
|
28
|
-
}
|
|
29
|
-
|
|
30
24
|
constructor() {
|
|
31
25
|
super();
|
|
32
26
|
|
|
33
27
|
/** @internal */
|
|
28
|
+
/** @internal */
|
|
29
|
+
_defineProperty(this, "handleInput", e => {
|
|
30
|
+
if (this.selectionMode === SELECTION_MODES.single) {
|
|
31
|
+
this.items.forEach(item => {
|
|
32
|
+
item.selected = item === e.target; // eslint-disable-line no-param-reassign
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
/** @internal */
|
|
37
|
+
_defineProperty(this, "handleSlotChange", e => {
|
|
38
|
+
const slot = e.target;
|
|
39
|
+
const items = slot.assignedElements({
|
|
40
|
+
flatten: true
|
|
41
|
+
});
|
|
42
|
+
this.items = items;
|
|
43
|
+
});
|
|
34
44
|
this.items = [];
|
|
35
45
|
}
|
|
36
|
-
|
|
37
46
|
connectedCallback() {
|
|
38
47
|
super.connectedCallback();
|
|
39
|
-
|
|
40
48
|
this.addEventListener("input", this.handleInput);
|
|
41
49
|
}
|
|
42
|
-
|
|
43
50
|
disconnectedCallback() {
|
|
44
51
|
super.disconnectedCallback();
|
|
45
|
-
|
|
46
52
|
this.removeEventListener("input", this.handleInput);
|
|
47
53
|
}
|
|
48
|
-
|
|
49
54
|
get value() {
|
|
50
|
-
return this.items.filter(
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** @internal */
|
|
54
|
-
handleInput = (e) => {
|
|
55
|
-
if (this.selectionMode === SELECTION_MODES.single) {
|
|
56
|
-
this.items.forEach((item) => {
|
|
57
|
-
item.selected = item === e.target; // eslint-disable-line no-param-reassign
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** @internal */
|
|
63
|
-
handleSlotChange = (e) => {
|
|
64
|
-
const slot = e.target;
|
|
65
|
-
const items = slot.assignedElements({ flatten: true });
|
|
66
|
-
|
|
67
|
-
this.items = items;
|
|
55
|
+
return this.items.filter(i => i.selected).map(i => i.value);
|
|
68
56
|
}
|
|
69
|
-
|
|
70
57
|
render() {
|
|
71
|
-
return html`<slot @slotchange=${this.handleSlotChange}></slot
|
|
58
|
+
return html`<slot @slotchange=${this.handleSlotChange}></slot>`;
|
|
72
59
|
}
|
|
73
60
|
}
|
|
74
|
-
|
|
61
|
+
_defineProperty(LeuChipGroup, "styles", css_248z);
|
|
62
|
+
_defineProperty(LeuChipGroup, "properties", {
|
|
63
|
+
selectionMode: {
|
|
64
|
+
type: String,
|
|
65
|
+
attribute: "selection-mode"
|
|
66
|
+
}
|
|
67
|
+
});
|
|
75
68
|
function defineChipGroupElements() {
|
|
76
69
|
defineElement("chip-group", LeuChipGroup);
|
|
77
70
|
}
|