@statistikzh/leu 0.0.2 → 0.2.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 +30 -0
- package/README.md +27 -2
- 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 +120 -122
- package/dist/Menu.js +40 -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 +125 -343
- 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/dist/theme.css +7 -7
- package/index.js +7 -3
- package/package.json +3 -1
- package/rollup.config.js +26 -9
- 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/input/Input.js +10 -0
- package/src/components/menu/menu.css +9 -3
- package/src/components/select/Select.js +28 -8
- package/src/styles/custom-properties.css +7 -7
- 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
package/dist/leu-chip-group.js
CHANGED
package/dist/leu-chip-link.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineChipRemovableElements } from './ChipRemovable.js';
|
|
2
|
+
import './defineElement-ba770aed.js';
|
|
2
3
|
import 'lit';
|
|
3
|
-
import './
|
|
4
|
-
import './
|
|
5
|
-
import './icon-b68c7e1e.js';
|
|
4
|
+
import './Chip-389013ff.js';
|
|
5
|
+
import './icon-03e86700.js';
|
|
6
6
|
|
|
7
7
|
defineChipRemovableElements();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineDropdownElements } from './Dropdown.js';
|
|
2
|
+
import './defineElement-ba770aed.js';
|
|
3
|
+
import 'lit';
|
|
4
|
+
import './Button.js';
|
|
5
|
+
import 'lit/directives/class-map.js';
|
|
6
|
+
import './icon-03e86700.js';
|
|
7
|
+
import './Menu.js';
|
|
8
|
+
import './MenuItem.js';
|
|
9
|
+
|
|
10
|
+
defineDropdownElements();
|
package/dist/leu-input.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineInputElements } from './Input.js';
|
|
2
|
+
import './defineElement-ba770aed.js';
|
|
2
3
|
import 'lit';
|
|
3
4
|
import 'lit/directives/class-map.js';
|
|
4
5
|
import 'lit/directives/if-defined.js';
|
|
5
6
|
import 'lit/directives/ref.js';
|
|
6
|
-
import './icon-
|
|
7
|
-
import './defineElement-47d4f665.js';
|
|
7
|
+
import './icon-03e86700.js';
|
|
8
8
|
|
|
9
9
|
defineInputElements();
|
package/dist/leu-menu.js
ADDED
package/dist/leu-radio-group.js
CHANGED
package/dist/leu-radio.js
CHANGED
package/dist/leu-select.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { defineSelectElements } from './Select.js';
|
|
2
|
+
import './defineElement-ba770aed.js';
|
|
2
3
|
import 'lit';
|
|
3
4
|
import 'lit/directives/class-map.js';
|
|
4
5
|
import 'lit/directives/map.js';
|
|
5
6
|
import 'lit/directives/if-defined.js';
|
|
6
7
|
import 'lit/directives/ref.js';
|
|
7
|
-
import './icon-
|
|
8
|
-
import './
|
|
9
|
-
import './
|
|
8
|
+
import './icon-03e86700.js';
|
|
9
|
+
import './Button.js';
|
|
10
|
+
import './Menu.js';
|
|
11
|
+
import './MenuItem.js';
|
|
10
12
|
import './Input.js';
|
|
11
13
|
|
|
12
14
|
defineSelectElements();
|
package/dist/leu-table.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineTableElements } from './Table.js';
|
|
2
|
+
import './defineElement-ba770aed.js';
|
|
2
3
|
import 'lit';
|
|
3
4
|
import 'lit/directives/class-map.js';
|
|
4
5
|
import 'lit/directives/style-map.js';
|
|
5
6
|
import 'lit/directives/ref.js';
|
|
6
|
-
import './icon-
|
|
7
|
-
import './
|
|
8
|
-
import './Button
|
|
7
|
+
import './icon-03e86700.js';
|
|
8
|
+
import './Pagination.js';
|
|
9
|
+
import './Button.js';
|
|
9
10
|
|
|
10
11
|
defineTableElements();
|
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/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
export * from "./src/components/button/Button.js"
|
|
2
|
+
export * from "./src/components/button-group/ButtonGroup.js"
|
|
1
3
|
export * from "./src/components/checkbox/Checkbox.js"
|
|
2
4
|
export * from "./src/components/checkbox/CheckboxGroup.js"
|
|
5
|
+
export * from "./src/components/chip/exports.js"
|
|
6
|
+
export * from "./src/components/dropdown/Dropdown.js"
|
|
3
7
|
export * from "./src/components/input/Input.js"
|
|
8
|
+
export * from "./src/components/menu/Menu.js"
|
|
9
|
+
export * from "./src/components/menu/MenuItem.js"
|
|
10
|
+
export * from "./src/components/pagination/Pagination.js"
|
|
4
11
|
export * from "./src/components/radio/Radio.js"
|
|
5
12
|
export * from "./src/components/radio/RadioGroup.js"
|
|
6
13
|
export * from "./src/components/select/Select.js"
|
|
7
|
-
export * from "./src/components/button/Button.js"
|
|
8
|
-
export * from "./src/components/pagination/Pagination.js"
|
|
9
14
|
export * from "./src/components/table/Table.js"
|
|
10
|
-
export * from "./src/components/chip/exports.js"
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "UI component library of the canton of zurich",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "statistikzh",
|
|
6
|
-
"version": "0.0
|
|
6
|
+
"version": "0.2.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
@@ -29,11 +29,13 @@
|
|
|
29
29
|
"lit": "^3.0.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
+
"@babel/preset-env": "^7.23.3",
|
|
32
33
|
"@commitlint/cli": "^17.7.1",
|
|
33
34
|
"@commitlint/config-conventional": "^17.7.0",
|
|
34
35
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
35
36
|
"@open-wc/eslint-config": "^9.2.1",
|
|
36
37
|
"@open-wc/testing": "^3.1.6",
|
|
38
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
37
39
|
"@rollup/plugin-json": "^6.0.0",
|
|
38
40
|
"@web/dev-server": "^0.1.34",
|
|
39
41
|
"@web/dev-server-rollup": "^0.5.2",
|
package/rollup.config.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import postcss from "rollup-plugin-postcss"
|
|
2
2
|
import postcssLit from "rollup-plugin-postcss-lit"
|
|
3
|
+
import { babel } from "@rollup/plugin-babel"
|
|
3
4
|
|
|
4
5
|
export const plugins = [
|
|
5
6
|
{
|
|
@@ -19,12 +20,32 @@ export const plugins = [
|
|
|
19
20
|
export default {
|
|
20
21
|
input: [
|
|
21
22
|
"index.js",
|
|
23
|
+
"./src/components/button/leu-button.js",
|
|
24
|
+
"./src/components/button/Button.js",
|
|
25
|
+
"./src/components/button-group/leu-button-group.js",
|
|
26
|
+
"./src/components/button-group/ButtonGroup.js",
|
|
22
27
|
"./src/components/checkbox/leu-checkbox.js",
|
|
23
28
|
"./src/components/checkbox/leu-checkbox-group.js",
|
|
24
29
|
"./src/components/checkbox/Checkbox.js",
|
|
25
30
|
"./src/components/checkbox/CheckboxGroup.js",
|
|
31
|
+
"./src/components/chip/leu-chip-group.js",
|
|
32
|
+
"./src/components/chip/leu-chip-link.js",
|
|
33
|
+
"./src/components/chip/leu-chip-removable.js",
|
|
34
|
+
"./src/components/chip/leu-chip-selectable.js",
|
|
35
|
+
"./src/components/chip/ChipGroup.js",
|
|
36
|
+
"./src/components/chip/ChipLink.js",
|
|
37
|
+
"./src/components/chip/ChipRemovable.js",
|
|
38
|
+
"./src/components/chip/ChipSelectable.js",
|
|
39
|
+
"./src/components/dropdown/leu-dropdown.js",
|
|
40
|
+
"./src/components/dropdown/Dropdown.js",
|
|
26
41
|
"./src/components/input/leu-input.js",
|
|
27
42
|
"./src/components/input/Input.js",
|
|
43
|
+
"./src/components/menu/leu-menu.js",
|
|
44
|
+
"./src/components/menu/leu-menu-item.js",
|
|
45
|
+
"./src/components/menu/Menu.js",
|
|
46
|
+
"./src/components/menu/MenuItem.js",
|
|
47
|
+
"./src/components/pagination/leu-pagination.js",
|
|
48
|
+
"./src/components/pagination/Pagination.js",
|
|
28
49
|
"./src/components/radio/leu-radio.js",
|
|
29
50
|
"./src/components/radio/leu-radio-group.js",
|
|
30
51
|
"./src/components/radio/Radio.js",
|
|
@@ -33,21 +54,17 @@ export default {
|
|
|
33
54
|
"./src/components/select/Select.js",
|
|
34
55
|
"./src/components/table/leu-table.js",
|
|
35
56
|
"./src/components/table/Table.js",
|
|
36
|
-
"./src/components/chip/leu-chip-group.js",
|
|
37
|
-
"./src/components/chip/leu-chip-link.js",
|
|
38
|
-
"./src/components/chip/leu-chip-removable.js",
|
|
39
|
-
"./src/components/chip/leu-chip-selectable.js",
|
|
40
|
-
"./src/components/chip/ChipGroup.js",
|
|
41
|
-
"./src/components/chip/ChipLink.js",
|
|
42
|
-
"./src/components/chip/ChipRemovable.js",
|
|
43
|
-
"./src/components/chip/ChipSelectable.js",
|
|
44
57
|
],
|
|
45
58
|
output: {
|
|
46
59
|
dir: "./dist/",
|
|
47
60
|
format: "esm",
|
|
48
61
|
entryFileNames: "[name].js",
|
|
49
62
|
},
|
|
50
|
-
plugins:
|
|
63
|
+
plugins: [
|
|
64
|
+
babel({ babelHelpers: "bundled" }),
|
|
65
|
+
...plugins.map((p) => p.plugin(...p.args)),
|
|
66
|
+
],
|
|
67
|
+
external: /^lit(\/.*\.js)?$/,
|
|
51
68
|
}
|
|
52
69
|
|
|
53
70
|
// TODO: add a second config for a bundle with esbuild
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { LitElement, nothing } from "lit"
|
|
2
|
+
import { html, unsafeStatic } from "lit/static-html.js"
|
|
3
|
+
|
|
4
|
+
import { defineElement } from "../../lib/defineElement.js"
|
|
5
|
+
import styles from "./accordion.css"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @tagname leu-accordion
|
|
9
|
+
* @slot content - The content of the accordion. No styles will be applied to the content.
|
|
10
|
+
* @prop {Number} headingLevel - The heading level of the accordion title. Must be between 1 and 6.
|
|
11
|
+
* @prop {Boolean} open - The expanded state of the accordion.
|
|
12
|
+
* @prop {String} label - The label (title) of the accordion.
|
|
13
|
+
* @prop {String} labelPrefix - The prefix of the accordion label. e.g. "01"
|
|
14
|
+
* @attr {Number} heading-level - The heading level of the accordion title. Must be between 1 and 6.
|
|
15
|
+
* @attr {String} label-prefix - The prefix of the accordion label. e.g. "01"
|
|
16
|
+
*/
|
|
17
|
+
export class LeuAccordion extends LitElement {
|
|
18
|
+
static styles = styles
|
|
19
|
+
|
|
20
|
+
/** @internal */
|
|
21
|
+
static shadowRootOptions = {
|
|
22
|
+
...LitElement.shadowRootOptions,
|
|
23
|
+
delegatesFocus: true,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static properties = {
|
|
27
|
+
headingLevel: { type: Number, attribute: "heading-level" },
|
|
28
|
+
open: { type: Boolean, reflect: true },
|
|
29
|
+
label: { type: String },
|
|
30
|
+
labelPrefix: { type: String, attribute: "label-prefix" },
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
constructor() {
|
|
34
|
+
super()
|
|
35
|
+
this.headingLevel = 2
|
|
36
|
+
this.open = false
|
|
37
|
+
this.label = ""
|
|
38
|
+
this.labelPrefix = ""
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Determines the heading tag of the accordion toggle.
|
|
43
|
+
* The headingLevel shouldn't be used directly to render the heading tag
|
|
44
|
+
* in order to avoid XSS issues.
|
|
45
|
+
* @returns {String} The heading tag of the accordion toggle.
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
_getHeadingTag() {
|
|
49
|
+
let level = 2
|
|
50
|
+
if (this.headingLevel > 0 && this.headingLevel < 7) {
|
|
51
|
+
level = this.headingLevel
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return `h${level}`
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Toggles the accordion open state.
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
_handleToggleClick() {
|
|
62
|
+
this.open = !this.open
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
render() {
|
|
66
|
+
const hTag = this._getHeadingTag()
|
|
67
|
+
|
|
68
|
+
/* The eslint rules don't recognize html import from lit/static-html.js */
|
|
69
|
+
/* eslint-disable lit/binding-positions, lit/no-invalid-html */
|
|
70
|
+
return html`<${unsafeStatic(hTag)} class="heading"><button
|
|
71
|
+
id="toggle"
|
|
72
|
+
type="button"
|
|
73
|
+
class="button"
|
|
74
|
+
aria-controls="content"
|
|
75
|
+
aria-expanded="${this.open}"
|
|
76
|
+
@click=${this._handleToggleClick}
|
|
77
|
+
>
|
|
78
|
+
${
|
|
79
|
+
this.labelPrefix
|
|
80
|
+
? html`<span class="label-prefix">${this.labelPrefix}</span>`
|
|
81
|
+
: nothing
|
|
82
|
+
}
|
|
83
|
+
<span class="label">${this.label}</span>
|
|
84
|
+
<div class="plus"></div>
|
|
85
|
+
</button></${unsafeStatic(hTag)}>
|
|
86
|
+
<div
|
|
87
|
+
id="content"
|
|
88
|
+
class="content"
|
|
89
|
+
aria-labelledby="toggle"
|
|
90
|
+
role="region"
|
|
91
|
+
?hidden=${!this.open}
|
|
92
|
+
>
|
|
93
|
+
<slot name="content"></slot>
|
|
94
|
+
</div>
|
|
95
|
+
<hr class="divider" />`
|
|
96
|
+
}
|
|
97
|
+
/* eslint-enable lit/binding-positions, lit/no-invalid-html */
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function defineAccordionElements() {
|
|
101
|
+
defineElement("accordion", LeuAccordion)
|
|
102
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
@import url("../../styles/custom-media.css");
|
|
2
|
+
|
|
3
|
+
:host,
|
|
4
|
+
:host * {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:host {
|
|
9
|
+
--accordion-font-regular: var(--leu-font-regular);
|
|
10
|
+
--accordion-font-black: var(--leu-font-black);
|
|
11
|
+
|
|
12
|
+
--accordion-toggle-font: var(--accordion-font-black);
|
|
13
|
+
|
|
14
|
+
--label-color: var(--leu-color-black-60);
|
|
15
|
+
--label-color-active: var(--leu-color-black-100);
|
|
16
|
+
|
|
17
|
+
--divider-color: var(--leu-color-black-20);
|
|
18
|
+
--divider-color-active: var(--leu-color-black-100);
|
|
19
|
+
|
|
20
|
+
--transition: 0.1s ease;
|
|
21
|
+
|
|
22
|
+
font-family: var(--chip-font-regular);
|
|
23
|
+
|
|
24
|
+
position: relative;
|
|
25
|
+
display: grid;
|
|
26
|
+
grid-template-rows: auto 0fr;
|
|
27
|
+
|
|
28
|
+
transition: grid-template-rows var(--transition);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([open]) {
|
|
32
|
+
grid-template-rows: auto 1fr;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.heading {
|
|
36
|
+
margin: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.button {
|
|
40
|
+
width: 100%;
|
|
41
|
+
background: none;
|
|
42
|
+
padding: 1rem 0;
|
|
43
|
+
margin: none;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
|
|
46
|
+
border: none;
|
|
47
|
+
|
|
48
|
+
color: var(--label-color);
|
|
49
|
+
font-family: var(--accordion-toggle-font);
|
|
50
|
+
font-size: 1rem;
|
|
51
|
+
line-height: 1.5rem;
|
|
52
|
+
text-align: left;
|
|
53
|
+
|
|
54
|
+
display: flex;
|
|
55
|
+
gap: 0.25rem;
|
|
56
|
+
|
|
57
|
+
transition: color var(--transition);
|
|
58
|
+
|
|
59
|
+
@media (--viewport-regular) {
|
|
60
|
+
font-size: 1.125rem;
|
|
61
|
+
gap: 0.8rem;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@media (--viewport-xlarge) {
|
|
65
|
+
font-size: 1.25rem;
|
|
66
|
+
line-height: 1.625rem;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.button:focus-visible {
|
|
71
|
+
outline: 2px solid var(--leu-color-func-cyan);
|
|
72
|
+
outline-offset: 4px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.button:hover,
|
|
76
|
+
.button:focus-visible,
|
|
77
|
+
:host([open]) .button {
|
|
78
|
+
color: var(--label-color-active);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.plus {
|
|
82
|
+
position: relative;
|
|
83
|
+
flex: 0 0 1rem;
|
|
84
|
+
aspect-ratio: 1;
|
|
85
|
+
align-self: center;
|
|
86
|
+
margin-inline: 0.5rem;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.plus::before,
|
|
90
|
+
.plus::after {
|
|
91
|
+
content: "";
|
|
92
|
+
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: calc(50% - 0.0625rem);
|
|
95
|
+
left: 0;
|
|
96
|
+
|
|
97
|
+
display: block;
|
|
98
|
+
width: 1rem;
|
|
99
|
+
height: 0.125rem;
|
|
100
|
+
aspect-ratio: 1 / 0.125;
|
|
101
|
+
background-color: currentcolor;
|
|
102
|
+
transition: transform var(--transition);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.plus::before {
|
|
106
|
+
transform: rotate(90deg);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:host([open]) .plus::before {
|
|
110
|
+
transform: rotate(180deg);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.label {
|
|
114
|
+
display: block;
|
|
115
|
+
flex-grow: 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.content {
|
|
119
|
+
overflow: hidden;
|
|
120
|
+
transition: visibility var(--transition), opacity var(--transition);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.content[hidden] {
|
|
124
|
+
display: block;
|
|
125
|
+
visibility: hidden;
|
|
126
|
+
opacity: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
slot[name="content"] {
|
|
130
|
+
display: block;
|
|
131
|
+
padding: 0.5rem 0 1.5rem;
|
|
132
|
+
|
|
133
|
+
@media (--viewport-medium) {
|
|
134
|
+
padding: 0.75rem 0 1.5rem;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@media (--viewport-xlarge) {
|
|
138
|
+
padding: 1rem 0 2.5rem;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.divider {
|
|
143
|
+
position: absolute;
|
|
144
|
+
top: 100%;
|
|
145
|
+
left: 0;
|
|
146
|
+
|
|
147
|
+
width: 100%;
|
|
148
|
+
height: 1px;
|
|
149
|
+
margin: 0;
|
|
150
|
+
|
|
151
|
+
border: none;
|
|
152
|
+
background-color: var(--divider-color);
|
|
153
|
+
|
|
154
|
+
transition: transform var(--transition), background-color var(--transition);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
:host(:not([open])) .heading:is(:hover, :focus-visible) ~ .divider {
|
|
158
|
+
background-color: var(--divider-color-active);
|
|
159
|
+
transform: scaleY(3);
|
|
160
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { html } from "lit"
|
|
2
|
+
import { ifDefined } from "lit/directives/if-defined.js"
|
|
3
|
+
|
|
4
|
+
import "../leu-accordion.js"
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Accordion",
|
|
8
|
+
component: "leu-accordion",
|
|
9
|
+
argTypes: {
|
|
10
|
+
headingLevel: {
|
|
11
|
+
control: {
|
|
12
|
+
type: "select",
|
|
13
|
+
options: [0, 1, 2, 3, 4, 5, 6],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
content: {
|
|
17
|
+
control: {
|
|
18
|
+
type: "text",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function Template(args) {
|
|
25
|
+
return html` <leu-accordion
|
|
26
|
+
heading-level=${ifDefined(args.headingLevel)}
|
|
27
|
+
label=${ifDefined(args.label)}
|
|
28
|
+
label-prefix=${ifDefined(args.labelPrefix)}
|
|
29
|
+
>
|
|
30
|
+
<div slot="content">${args.content}</div>
|
|
31
|
+
</leu-accordion>`
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Regular = Template.bind({})
|
|
35
|
+
Regular.args = {
|
|
36
|
+
headingLevel: 2,
|
|
37
|
+
label:
|
|
38
|
+
"Akkordeontitel der lang und noch länger werden kann und dann umbricht",
|
|
39
|
+
content: `Regular Interessierte können ab sofort die Genauigkeit ihrer Smartphones
|
|
40
|
+
und Navigationsgeräte überprüfen. Die Baudirektion hat beim Landesmuseum
|
|
41
|
+
in Zürich einen Kontrollpunkt beim Landesmuseum in Zürich einen
|
|
42
|
+
Kontrollpunktfür mobile Geräte eingerichtet – den ersten in der
|
|
43
|
+
Schweiz.P, Helvetic Roman Interessierte können ab sofort die Genauigkeit
|
|
44
|
+
ihrer Smartphones und Navigationsgeräte überprüfen.
|
|
45
|
+
|
|
46
|
+
Die Zürich einen Kontrollpunktfür mobile einen Kontrollpunkt beim
|
|
47
|
+
Landesmuseum in Zürich einen Kontrollpunktfür mobile Geräte eingerichtet
|
|
48
|
+
– den ersten in der Schweiz.`,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const Prefix = Template.bind({})
|
|
52
|
+
Prefix.args = {
|
|
53
|
+
...Regular.args,
|
|
54
|
+
labelPrefix: "01",
|
|
55
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { html } from "lit"
|
|
2
|
+
import { fixture, expect } from "@open-wc/testing"
|
|
3
|
+
|
|
4
|
+
import "../leu-accordion.js"
|
|
5
|
+
|
|
6
|
+
async function defaultFixture() {
|
|
7
|
+
return fixture(html` <leu-accordion /> `)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
describe("LeuAccordion", () => {
|
|
11
|
+
it("is a defined element", async () => {
|
|
12
|
+
const el = await customElements.get("leu-accordion")
|
|
13
|
+
|
|
14
|
+
await expect(el).not.to.be.undefined
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it("passes the a11y audit", async () => {
|
|
18
|
+
const el = await defaultFixture()
|
|
19
|
+
|
|
20
|
+
await expect(el).shadowDom.to.be.accessible()
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -65,6 +65,14 @@ const VALIDATION_MESSAGES = {
|
|
|
65
65
|
export class LeuInput extends LitElement {
|
|
66
66
|
static styles = styles
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
static shadowRootOptions = {
|
|
72
|
+
...LitElement.shadowRootOptions,
|
|
73
|
+
delegatesFocus: true,
|
|
74
|
+
}
|
|
75
|
+
|
|
68
76
|
static properties = {
|
|
69
77
|
disabled: { type: Boolean, reflect: true },
|
|
70
78
|
required: { type: Boolean, reflect: true },
|
|
@@ -223,6 +231,8 @@ export class LeuInput extends LitElement {
|
|
|
223
231
|
clear() {
|
|
224
232
|
this.value = ""
|
|
225
233
|
|
|
234
|
+
this._inputRef.value.focus()
|
|
235
|
+
|
|
226
236
|
this.dispatchEvent(
|
|
227
237
|
new CustomEvent("input", { bubbles: true, composed: true })
|
|
228
238
|
)
|
|
@@ -7,8 +7,14 @@
|
|
|
7
7
|
--menu-divider-color: var(--leu-color-black-transp-20);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
/*
|
|
11
|
+
* Set styles with important as the hr element is part of the
|
|
12
|
+
* light dom and therefore is affected by the global styles.
|
|
13
|
+
*/
|
|
10
14
|
:host ::slotted(hr) {
|
|
11
|
-
border: 0;
|
|
12
|
-
border-top: 1px solid var(--menu-divider-color);
|
|
13
|
-
margin: 0.5rem 0;
|
|
15
|
+
border: 0 !important;
|
|
16
|
+
border-top: 1px solid var(--menu-divider-color) !important;
|
|
17
|
+
margin: 0.5rem 0 !important;
|
|
18
|
+
padding: 0 !important;
|
|
19
|
+
background: none !important;
|
|
14
20
|
}
|