@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
|
@@ -4,15 +4,17 @@ import "../leu-table.js"
|
|
|
4
4
|
export default {
|
|
5
5
|
title: "Table",
|
|
6
6
|
component: "leu-table",
|
|
7
|
+
parameters: {
|
|
8
|
+
design: {
|
|
9
|
+
type: "figma",
|
|
10
|
+
url: "https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=316-2445&mode=design&t=lzVrtq8lxYVJU5TB-11",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
7
13
|
}
|
|
8
14
|
|
|
9
|
-
function Template({
|
|
15
|
+
function Template({ itemsPerPage }) {
|
|
10
16
|
return html`
|
|
11
|
-
<leu-table
|
|
12
|
-
id="table"
|
|
13
|
-
itemsOnAPage=${itemsOnAPage}
|
|
14
|
-
style="max-width:500px;"
|
|
15
|
-
></leu-table>
|
|
17
|
+
<leu-table id="table" itemsPerPage=${itemsPerPage}></leu-table>
|
|
16
18
|
<script>
|
|
17
19
|
{
|
|
18
20
|
const table = document.querySelector("leu-table[id=table]")
|
|
@@ -39,7 +41,10 @@ function Template({ itemsOnAPage }) {
|
|
|
39
41
|
value: (row) => row.menge,
|
|
40
42
|
style: (row) => {
|
|
41
43
|
return {
|
|
42
|
-
color:
|
|
44
|
+
color:
|
|
45
|
+
row.menge > 10
|
|
46
|
+
? "var(--leu-color-func-green)"
|
|
47
|
+
: "var(--leu-color-func-red)",
|
|
43
48
|
}
|
|
44
49
|
},
|
|
45
50
|
sort: {
|
|
@@ -96,7 +101,7 @@ function Template({ itemsOnAPage }) {
|
|
|
96
101
|
|
|
97
102
|
export const Regular = Template.bind({})
|
|
98
103
|
Regular.argTypes = {
|
|
99
|
-
|
|
104
|
+
itemsPerPage: { type: "number" },
|
|
100
105
|
columns: { table: { disable: true } },
|
|
101
106
|
data: { table: { disable: true } },
|
|
102
107
|
_columns: { table: { disable: true } },
|
|
@@ -108,9 +113,14 @@ Regular.argTypes = {
|
|
|
108
113
|
_sortArrowDown: { table: { disable: true } },
|
|
109
114
|
_sortArrowUp: { table: { disable: true } },
|
|
110
115
|
_scrollRef: { table: { disable: true } },
|
|
111
|
-
|
|
116
|
+
_itemsPerPage: { table: { disable: true } },
|
|
112
117
|
_sortedData: { table: { disable: true } },
|
|
113
118
|
}
|
|
114
119
|
Regular.args = {
|
|
115
|
-
|
|
120
|
+
itemsPerPage: null,
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const Pagination = Template.bind({})
|
|
124
|
+
Pagination.args = {
|
|
125
|
+
itemsPerPage: 10,
|
|
116
126
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: block;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
div.scroll {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
width: 100%;
|
|
9
|
+
overflow: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
div.shadow {
|
|
13
|
+
position: absolute;
|
|
14
|
+
left: 0;
|
|
15
|
+
top: 0;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
z-index: 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
div.pagination {
|
|
23
|
+
height: calc(100% - 66px);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
table {
|
|
27
|
+
width: 100%;
|
|
28
|
+
border-spacing: 0;
|
|
29
|
+
color: rgb(0 0 0 / 60%);
|
|
30
|
+
font-size: 16px;
|
|
31
|
+
font-family: var(--leu-font-regular);
|
|
32
|
+
line-height: 1.5;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
td {
|
|
36
|
+
padding: 12px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
th {
|
|
40
|
+
padding: 16px 16px 8px;
|
|
41
|
+
text-align: left;
|
|
42
|
+
font-size: 12px;
|
|
43
|
+
font-weight: normal;
|
|
44
|
+
font-family: var(--leu-font-black);
|
|
45
|
+
background: var(--table-even-row-bg);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
td:first-child,
|
|
49
|
+
th:first-child {
|
|
50
|
+
left: 0;
|
|
51
|
+
background: inherit;
|
|
52
|
+
z-index: 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
tr {
|
|
56
|
+
background: #fff;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
tbody tr:nth-child(odd) {
|
|
60
|
+
background: var(--leu-color-black-5);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
button {
|
|
64
|
+
background: none;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
line-height: 1.5;
|
|
67
|
+
padding: 0;
|
|
68
|
+
border: 0;
|
|
69
|
+
width: 100%;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: flex-center;
|
|
72
|
+
font-size: inherit;
|
|
73
|
+
font-family: inherit;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
thead svg {
|
|
77
|
+
display: inline-block;
|
|
78
|
+
color: var(--leu-color-accent-blue);
|
|
79
|
+
padding: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
table.sticky td:first-child,
|
|
83
|
+
table.sticky th:first-child {
|
|
84
|
+
position: sticky;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
div.shadow-left table.sticky td:first-child,
|
|
88
|
+
div.shadow-left table.sticky th:first-child {
|
|
89
|
+
box-shadow: 0 0 5px rgb(0 0 0 / 50%);
|
|
90
|
+
clip-path: inset(0 -15px 0 0);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
div.shadow-left {
|
|
94
|
+
box-shadow: inset 5px 0 5px -5px rgb(0 0 0 / 50%);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
div.shadow-right {
|
|
98
|
+
box-shadow: inset -5px 0 5px -5px rgb(0 0 0 / 50%);
|
|
99
|
+
}
|
package/src/lib/utils.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrap a Function to nsure that time-consuming tasks do not fire so often
|
|
3
|
+
* @param {Function} func - Your function
|
|
4
|
+
* @param {Number} timeout - Default is 500 ms
|
|
5
|
+
* @returns {Function} - Your function wrapped in a timeout function
|
|
6
|
+
*/
|
|
7
|
+
const debounce = function (func, timeout = 500) {
|
|
8
|
+
let timer = null
|
|
9
|
+
return (...args) => {
|
|
10
|
+
clearTimeout(timer)
|
|
11
|
+
timer = setTimeout(() => {
|
|
12
|
+
func.apply(this, args)
|
|
13
|
+
}, timeout)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { debounce }
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { fromRollup } from "@web/dev-server-rollup"
|
|
2
2
|
import rollupJson from "@rollup/plugin-json"
|
|
3
|
-
import { storybookPlugin } from "@web/dev-server-storybook"
|
|
4
3
|
|
|
5
4
|
import { plugins as rollupPlugins } from "./rollup.config.js"
|
|
6
5
|
|
|
@@ -15,5 +14,5 @@ export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
|
15
14
|
"**/custom-elements.json": "js",
|
|
16
15
|
"src/components/**/*.css": "js",
|
|
17
16
|
},
|
|
18
|
-
plugins: [
|
|
17
|
+
plugins: [...plugins, json()],
|
|
19
18
|
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { playwrightLauncher } from "@web/test-runner-playwright"
|
|
2
|
-
import { plugins as
|
|
2
|
+
import { plugins as wdsPlugins } from "./web-dev-server.config.mjs"
|
|
3
3
|
|
|
4
4
|
const filteredLogs = ["Running in dev mode", "lit-html is in dev mode"]
|
|
5
5
|
|
|
6
6
|
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
7
7
|
/** Test files to run */
|
|
8
8
|
files: "src/components/**/*.test.js",
|
|
9
|
-
plugins:
|
|
9
|
+
plugins: wdsPlugins,
|
|
10
10
|
mimeTypes: {
|
|
11
11
|
"src/components/**/*.css": "js",
|
|
12
12
|
},
|
|
@@ -45,5 +45,18 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
|
45
45
|
// playwrightLauncher({ product: "webkit" }),
|
|
46
46
|
],
|
|
47
47
|
|
|
48
|
+
testRunnerHtml: (testFramework) =>
|
|
49
|
+
`<html>
|
|
50
|
+
<head>
|
|
51
|
+
<meta charset="utf-8" />
|
|
52
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
53
|
+
<link rel="stylesheet" href="dist/theme.css" />
|
|
54
|
+
<link rel="stylesheet" href="https://www.web.statistik.zh.ch/leu/styles/fonts.css" />
|
|
55
|
+
</head>
|
|
56
|
+
<body>
|
|
57
|
+
<script type="module" src="${testFramework}"></script>
|
|
58
|
+
</body>
|
|
59
|
+
</html>`,
|
|
60
|
+
|
|
48
61
|
// See documentation for all available options
|
|
49
62
|
})
|