@statistikzh/leu 0.13.0 → 0.14.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/.eslintrc.json +8 -0
- package/.github/workflows/ci.yml +78 -0
- package/.github/workflows/deploy-github-pages.yaml +2 -1
- package/.github/workflows/release-please.yml +2 -1
- package/.nvmrc +1 -0
- package/.prettierignore +1 -0
- package/.storybook/main.js +19 -3
- package/.storybook/static/fonts/Inter-Black.woff2 +0 -0
- package/.storybook/static/fonts/Inter-Regular.woff2 +0 -0
- package/.storybook/static/fonts.css +11 -0
- package/CHANGELOG.md +27 -0
- package/custom-elements-manifest.config.js +2 -2
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.d.ts.map +1 -1
- package/dist/Accordion.js +2 -4
- package/dist/Button.d.ts +2 -2
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +64 -34
- package/dist/ButtonGroup.d.ts +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/Checkbox.d.ts +1 -1
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +2 -3
- package/dist/CheckboxGroup.d.ts +1 -1
- package/dist/CheckboxGroup.d.ts.map +1 -1
- package/dist/CheckboxGroup.js +1 -3
- package/dist/Chip.d.ts +1 -1
- package/dist/Chip.d.ts.map +1 -1
- package/dist/Chip.js +5 -6
- package/dist/ChipGroup.d.ts +1 -1
- package/dist/ChipGroup.d.ts.map +1 -1
- package/dist/ChipGroup.js +2 -2
- package/dist/ChipLink.js +1 -1
- package/dist/ChipRemovable.js +1 -1
- package/dist/ChipSelectable.js +1 -1
- package/dist/Dialog.d.ts +1 -1
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +3 -5
- package/dist/Dropdown.d.ts +1 -1
- package/dist/Dropdown.d.ts.map +1 -1
- package/dist/Dropdown.js +4 -3
- package/dist/Icon.d.ts +2 -98
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +6 -2
- package/dist/Input.d.ts +7 -2
- package/dist/Input.d.ts.map +1 -1
- package/dist/Input.js +15 -8
- package/dist/{LeuElement-874a297c.d.ts → LeuElement-BjGpKQpe.d.ts} +1 -1
- package/dist/LeuElement-BjGpKQpe.d.ts.map +1 -0
- package/dist/{LeuElement-874a297c.js → LeuElement-BjGpKQpe.js} +12 -2
- package/dist/Menu.d.ts +2 -2
- package/dist/Menu.js +1 -1
- package/dist/MenuItem.d.ts +3 -3
- package/dist/MenuItem.js +1 -1
- package/dist/Pagination.d.ts +1 -1
- package/dist/Pagination.js +3 -3
- package/dist/Popup.d.ts +2 -2
- package/dist/Popup.d.ts.map +1 -1
- package/dist/Popup.js +2 -3
- package/dist/Radio.d.ts +1 -1
- package/dist/Radio.d.ts.map +1 -1
- package/dist/Radio.js +1 -3
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +1 -3
- package/dist/Range.d.ts +1 -1
- package/dist/Range.d.ts.map +1 -1
- package/dist/Range.js +17 -19
- package/dist/ScrollTop.d.ts +1 -1
- package/dist/ScrollTop.d.ts.map +1 -1
- package/dist/ScrollTop.js +27 -3
- package/dist/Select.d.ts +3 -3
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +7 -5
- package/dist/Spinner.d.ts +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/Table.d.ts +1 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +3 -4
- package/dist/VisuallyHidden.d.ts +1 -1
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +3 -5
- package/dist/{hasSlotController-dbcac394.d.ts → hasSlotController-DvFw2NdC.d.ts} +1 -1
- package/dist/hasSlotController-DvFw2NdC.d.ts.map +1 -0
- package/dist/{hasSlotController-dbcac394.js → hasSlotController-DvFw2NdC.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -7
- package/dist/leu-accordion.js +1 -1
- package/dist/leu-button-group.js +1 -1
- package/dist/leu-button.js +2 -2
- package/dist/leu-checkbox-group.js +1 -1
- package/dist/leu-checkbox.js +1 -1
- package/dist/leu-chip-group.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/leu-dialog.js +2 -2
- package/dist/leu-dropdown.js +2 -2
- package/dist/leu-icon.js +1 -1
- package/dist/leu-input.js +1 -1
- package/dist/leu-menu-item.js +1 -1
- package/dist/leu-menu.js +1 -1
- package/dist/leu-pagination.js +2 -2
- package/dist/leu-popup.js +1 -1
- package/dist/leu-radio-group.js +1 -1
- package/dist/leu-radio.js +1 -1
- package/dist/leu-range.js +1 -1
- package/dist/leu-scroll-top.js +2 -3
- package/dist/leu-select.js +2 -2
- package/dist/leu-spinner.js +1 -1
- package/dist/leu-table.js +2 -2
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/theme.css +143 -107
- package/dist/vscode.html-custom-data.json +3 -32
- package/dist/vue/index.d.ts +11 -77
- package/dist/web-types.json +246 -242
- package/index.js +1 -1
- package/package.json +55 -51
- package/rollup.config.js +3 -3
- package/scripts/generate-component/generate.js +5 -5
- package/src/components/accordion/test/accordion.test.js +24 -20
- package/src/components/button/Button.js +9 -4
- package/src/components/button/button.css +56 -22
- package/src/components/button/stories/button.stories.js +44 -45
- package/src/components/button/test/button.test.js +13 -13
- package/src/components/button-group/ButtonGroup.js +1 -1
- package/src/components/button-group/stories/button-group.stories.js +2 -2
- package/src/components/checkbox/checkbox.css +1 -0
- package/src/components/chip/ChipSelectable.js +1 -1
- package/src/components/chip/chip.css +4 -3
- package/src/components/chip/stories/chip-group.stories.js +4 -4
- package/src/components/chip/stories/chip-selectable.stories.js +1 -1
- package/src/components/chip/test/chip-group.test.js +25 -33
- package/src/components/chip/test/chip-link.test.js +5 -5
- package/src/components/chip/test/chip-removable.test.js +6 -8
- package/src/components/chip/test/chip-selectable.test.js +9 -11
- package/src/components/dialog/test/dialog.test.js +1 -1
- package/src/components/dropdown/dropdown.css +1 -0
- package/src/components/dropdown/test/dropdown.test.js +12 -13
- package/src/components/icon/icon.css +4 -0
- package/src/components/input/Input.js +25 -17
- package/src/components/input/stories/input.stories.js +0 -2
- package/src/components/input/test/input.test.js +26 -0
- package/src/components/menu/stories/menu-item.stories.js +2 -0
- package/src/components/menu/test/menu-item.test.js +3 -2
- package/src/components/menu/test/menu.test.js +24 -22
- package/src/components/pagination/Pagination.js +1 -1
- package/src/components/pagination/pagination.css +1 -1
- package/src/components/pagination/stories/pagination.stories.js +2 -1
- package/src/components/pagination/test/pagination.test.js +8 -6
- package/src/components/popup/Popup.js +4 -4
- package/src/components/popup/popup.css +1 -0
- package/src/components/popup/test/popup.test.js +6 -8
- package/src/components/radio/RadioGroup.js +2 -2
- package/src/components/range/Range.js +20 -21
- package/src/components/select/Select.js +6 -1
- package/src/components/select/select.css +1 -1
- package/src/components/select/stories/select.stories.js +1 -1
- package/src/components/select/test/select.test.js +19 -16
- package/src/components/table/Table.js +4 -4
- package/src/components/table/test/table.test.js +3 -2
- package/src/components/visually-hidden/test/visually-hidden.test.js +6 -8
- package/src/lib/LeuElement.js +2 -2
- package/src/lib/hasSlotController.js +1 -1
- package/src/styles/common-styles.css +9 -0
- package/src/styles/style.stories.js +3 -1
- package/tsconfig.build.json +4 -3
- package/web-dev-server.config.mjs +1 -0
- package/web-test-runner.config.mjs +2 -1
- package/.github/workflows/test.yml +0 -38
- package/.storybook/preview-head.html +0 -5
- package/dist/Breadcrumb.d.ts +0 -69
- package/dist/Breadcrumb.d.ts.map +0 -1
- package/dist/Breadcrumb.js +0 -391
- package/dist/LeuElement-874a297c.d.ts.map +0 -1
- package/dist/hasSlotController-dbcac394.d.ts.map +0 -1
- package/dist/leu-breadcrumb.d.ts +0 -3
- package/dist/leu-breadcrumb.d.ts.map +0 -1
- package/dist/leu-breadcrumb.js +0 -17
- package/dist/utils-65469421.d.ts +0 -16
- package/dist/utils-65469421.d.ts.map +0 -1
- package/dist/utils-65469421.js +0 -35
- package/src/components/breadcrumb/Breadcrumb.js +0 -324
- package/src/components/breadcrumb/breadcrumb.css +0 -98
- package/src/components/breadcrumb/leu-breadcrumb.js +0 -5
- package/src/components/breadcrumb/stories/breadcrumb.stories.js +0 -73
- package/src/components/breadcrumb/test/breadcrumb.test.js +0 -141
package/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from "./src/components/accordion/Accordion.js"
|
|
2
|
-
export * from "./src/components/breadcrumb/Breadcrumb.js"
|
|
3
2
|
export * from "./src/components/button/Button.js"
|
|
4
3
|
export * from "./src/components/button-group/ButtonGroup.js"
|
|
5
4
|
export * from "./src/components/checkbox/Checkbox.js"
|
|
@@ -15,3 +14,4 @@ export * from "./src/components/radio/Radio.js"
|
|
|
15
14
|
export * from "./src/components/radio/RadioGroup.js"
|
|
16
15
|
export * from "./src/components/select/Select.js"
|
|
17
16
|
export * from "./src/components/table/Table.js"
|
|
17
|
+
export * from "./src/lib/LeuElement.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.
|
|
6
|
+
"version": "0.14.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"web-types": "./dist/web-types.json",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
17
|
},
|
|
18
18
|
"./*": "./dist/*"
|
|
19
19
|
},
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"watch:css": "nodemon --watch 'src/styles/*' -e css --exec npm run build:css",
|
|
32
32
|
"lint": "npm run lint:eslint && npm run lint:prettier",
|
|
33
33
|
"lint:eslint": "eslint --ext .js,.mjs,.html . --ignore-path .gitignore ",
|
|
34
|
-
"lint:prettier": "prettier \"**/*.{js,mjs,md,html,json}\" --check
|
|
34
|
+
"lint:prettier": "prettier \"**/*.{js,mjs,md,html,json}\" --check",
|
|
35
35
|
"lint:stylelint": "stylelint \"**/*.{js,css}\" --ignore-path .gitignore",
|
|
36
36
|
"lint:types": "tsc",
|
|
37
37
|
"format": "npm run format:eslint && npm run format:prettier",
|
|
38
38
|
"format:eslint": "eslint --ext .js,.mjs,.html . --fix --ignore-path .gitignore",
|
|
39
|
-
"format:prettier": "prettier \"**/*.{js,mjs,md,html,json}\" --write
|
|
39
|
+
"format:prettier": "prettier \"**/*.{js,mjs,md,html,json}\" --write",
|
|
40
40
|
"test": "web-test-runner --coverage",
|
|
41
41
|
"test:watch": "web-test-runner --watch",
|
|
42
42
|
"prepare": "husky",
|
|
@@ -45,64 +45,65 @@
|
|
|
45
45
|
"storybook:build": "npm run analyze && npm run build:css && storybook build --output-dir docs"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@floating-ui/dom": "^1.6.
|
|
49
|
-
"lit": "^3.1.4"
|
|
48
|
+
"@floating-ui/dom": "^1.6.13",
|
|
49
|
+
"lit": "^3.1.4",
|
|
50
|
+
"stylelint-config-recommended": "^15.0.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@babel/preset-env": "^7.
|
|
53
|
-
"@commitlint/cli": "^
|
|
54
|
-
"@commitlint/config-conventional": "^
|
|
55
|
-
"@custom-elements-manifest/analyzer": "^0.
|
|
56
|
-
"@open-wc/eslint-config": "^
|
|
53
|
+
"@babel/preset-env": "^7.26.9",
|
|
54
|
+
"@commitlint/cli": "^19.7.1",
|
|
55
|
+
"@commitlint/config-conventional": "^19.7.1",
|
|
56
|
+
"@custom-elements-manifest/analyzer": "^0.10.4",
|
|
57
|
+
"@open-wc/eslint-config": "^12.0.3",
|
|
57
58
|
"@open-wc/testing": "^4.0.0",
|
|
58
59
|
"@rollup/plugin-babel": "^6.0.4",
|
|
59
|
-
"@rollup/plugin-commonjs": "^
|
|
60
|
-
"@rollup/plugin-json": "^6.
|
|
61
|
-
"@rollup/plugin-replace": "^
|
|
62
|
-
"@
|
|
63
|
-
"@storybook/addon-
|
|
64
|
-
"@storybook/addon-
|
|
65
|
-
"@storybook/addon-
|
|
66
|
-
"@storybook/blocks": "^
|
|
67
|
-
"@storybook/
|
|
60
|
+
"@rollup/plugin-commonjs": "^28.0.2",
|
|
61
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
62
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
63
|
+
"@storybook/addon-a11y": "^8.5.8",
|
|
64
|
+
"@storybook/addon-actions": "^8.5.8",
|
|
65
|
+
"@storybook/addon-designs": "^8.2.0",
|
|
66
|
+
"@storybook/addon-essentials": "^8.5.8",
|
|
67
|
+
"@storybook/blocks": "^8.5.8",
|
|
68
|
+
"@storybook/core-events": "^8.5.8",
|
|
69
|
+
"@storybook/manager-api": "^8.5.8",
|
|
70
|
+
"@storybook/theming": "^8.5.8",
|
|
71
|
+
"@storybook/web-components": "^8.5.8",
|
|
68
72
|
"@web/dev-server": "^0.4.6",
|
|
69
73
|
"@web/dev-server-rollup": "^0.6.4",
|
|
70
|
-
"@web/storybook-builder": "^0.1
|
|
71
|
-
"@web/storybook-framework-web-components": "^0.
|
|
72
|
-
"@web/test-runner": "^0.
|
|
74
|
+
"@web/storybook-builder": "^0.2.1",
|
|
75
|
+
"@web/storybook-framework-web-components": "^0.2.0",
|
|
76
|
+
"@web/test-runner": "^0.20.0",
|
|
73
77
|
"@web/test-runner-commands": "^0.9.0",
|
|
74
78
|
"@web/test-runner-playwright": "^0.11.0",
|
|
75
|
-
"@whitespace/storybook-addon-html": "^
|
|
79
|
+
"@whitespace/storybook-addon-html": "^6.1.1",
|
|
76
80
|
"arg": "^5.0.2",
|
|
77
|
-
"custom-element-jet-brains-integration": "^1.
|
|
78
|
-
"custom-element-vs-code-integration": "^1.
|
|
79
|
-
"custom-element-vuejs-integration": "^1.
|
|
80
|
-
"eslint": "^8.
|
|
81
|
-
"eslint-config-prettier": "^
|
|
82
|
-
"eslint-plugin-storybook": "^0.
|
|
83
|
-
"glob": "^
|
|
84
|
-
"husky": "^9.
|
|
85
|
-
"lint-staged": "^15.
|
|
86
|
-
"nodemon": "^3.
|
|
81
|
+
"custom-element-jet-brains-integration": "^1.7.0",
|
|
82
|
+
"custom-element-vs-code-integration": "^1.5.0",
|
|
83
|
+
"custom-element-vuejs-integration": "^1.4.0",
|
|
84
|
+
"eslint": "^8.57.1",
|
|
85
|
+
"eslint-config-prettier": "^10.0.1",
|
|
86
|
+
"eslint-plugin-storybook": "^0.11.3",
|
|
87
|
+
"glob": "^11.0.1",
|
|
88
|
+
"husky": "^9.1.7",
|
|
89
|
+
"lint-staged": "^15.4.3",
|
|
90
|
+
"nodemon": "^3.1.9",
|
|
87
91
|
"postcss": "^8.4.31",
|
|
88
|
-
"postcss-cli": "^
|
|
89
|
-
"postcss-import": "^
|
|
90
|
-
"postcss-lit": "^1.
|
|
91
|
-
"postcss-preset-env": "^
|
|
92
|
-
"prettier": "^
|
|
93
|
-
"react": "^
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"rimraf": "^5.0.5",
|
|
97
|
-
"rollup": "^3.29.4",
|
|
92
|
+
"postcss-cli": "^11.0.0",
|
|
93
|
+
"postcss-import": "^16.1.0",
|
|
94
|
+
"postcss-lit": "^1.2.0",
|
|
95
|
+
"postcss-preset-env": "^10.1.5",
|
|
96
|
+
"prettier": "^3.5.2",
|
|
97
|
+
"react-syntax-highlighter": "^15.6.1",
|
|
98
|
+
"rimraf": "^6.0.1",
|
|
99
|
+
"rollup": "^4.34.8",
|
|
98
100
|
"rollup-plugin-postcss": "^4.0.2",
|
|
99
101
|
"rollup-plugin-postcss-lit": "^2.1.0",
|
|
100
|
-
"sinon": "^
|
|
101
|
-
"storybook": "^
|
|
102
|
-
"stylelint": "^
|
|
103
|
-
"stylelint-config-standard": "^
|
|
104
|
-
"
|
|
105
|
-
"typescript": "^5.4.3"
|
|
102
|
+
"sinon": "^19.0.2",
|
|
103
|
+
"storybook": "^8.5.8",
|
|
104
|
+
"stylelint": "^16.14.1",
|
|
105
|
+
"stylelint-config-standard": "^37.0.0",
|
|
106
|
+
"typescript": "^5.7.3"
|
|
106
107
|
},
|
|
107
108
|
"prettier": {
|
|
108
109
|
"semi": false
|
|
@@ -116,5 +117,8 @@
|
|
|
116
117
|
"prettier --write"
|
|
117
118
|
],
|
|
118
119
|
"*.{md,json}": "prettier --write"
|
|
120
|
+
},
|
|
121
|
+
"overrides": {
|
|
122
|
+
"estree-walker": "2.0.2"
|
|
119
123
|
}
|
|
120
124
|
}
|
package/rollup.config.js
CHANGED
|
@@ -47,8 +47,8 @@ export default {
|
|
|
47
47
|
(file) => [
|
|
48
48
|
path.basename(file, path.extname(file)),
|
|
49
49
|
fileURLToPath(new URL(file, import.meta.url)),
|
|
50
|
-
]
|
|
51
|
-
)
|
|
50
|
+
],
|
|
51
|
+
),
|
|
52
52
|
),
|
|
53
53
|
},
|
|
54
54
|
output: {
|
|
@@ -60,5 +60,5 @@ export default {
|
|
|
60
60
|
babel({ babelHelpers: "bundled" }),
|
|
61
61
|
...plugins.map((p) => p.plugin(...p.args)),
|
|
62
62
|
],
|
|
63
|
-
external: /^lit(\/.*\.js)?$/,
|
|
63
|
+
external: [/^lit(\/.*\.js)?$/, "@floating-ui/dom"],
|
|
64
64
|
}
|
|
@@ -75,7 +75,7 @@ const copyFile = async (sourcePath, targetPath, params, replacements) => {
|
|
|
75
75
|
})
|
|
76
76
|
const formattedTemplateFileContents = formatTemplateFileContents(
|
|
77
77
|
replacements,
|
|
78
|
-
templateFileContents
|
|
78
|
+
templateFileContents,
|
|
79
79
|
)
|
|
80
80
|
await fsPromises.writeFile(targetPath, formattedTemplateFileContents, {
|
|
81
81
|
encoding: "utf8",
|
|
@@ -101,8 +101,8 @@ const copyAllFiles = async (sourcePath, targetPath, params) => {
|
|
|
101
101
|
`${sourcePath}/${fileName}`,
|
|
102
102
|
`${targetPath}/${newFileName}`,
|
|
103
103
|
params,
|
|
104
|
-
replacements
|
|
105
|
-
)
|
|
104
|
+
replacements,
|
|
105
|
+
),
|
|
106
106
|
)
|
|
107
107
|
})
|
|
108
108
|
await Promise.all(fileCopyPromises)
|
|
@@ -136,7 +136,7 @@ const generate = async () => {
|
|
|
136
136
|
|
|
137
137
|
if (![name].concat(components).every((c) => kebabCaseRegex.test(c))) {
|
|
138
138
|
console.log(
|
|
139
|
-
"The name and the components have to be in camel case and can only contain [a-z] letters."
|
|
139
|
+
"The name and the components have to be in camel case and can only contain [a-z] letters.",
|
|
140
140
|
)
|
|
141
141
|
console.log("Example: radio-group")
|
|
142
142
|
process.exit(1)
|
|
@@ -158,7 +158,7 @@ const generate = async () => {
|
|
|
158
158
|
Name: upperCamelCase(component),
|
|
159
159
|
namespace,
|
|
160
160
|
Namespace,
|
|
161
|
-
})
|
|
161
|
+
}),
|
|
162
162
|
)
|
|
163
163
|
|
|
164
164
|
await Promise.all(copyPromises)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { html } from "lit"
|
|
2
|
-
import { fixture, expect
|
|
2
|
+
import { fixture, expect } from "@open-wc/testing"
|
|
3
3
|
|
|
4
4
|
import "../leu-accordion.js"
|
|
5
5
|
|
|
6
6
|
async function defaultFixture() {
|
|
7
|
-
return fixture(
|
|
8
|
-
|
|
9
|
-
)
|
|
7
|
+
return fixture(html`
|
|
8
|
+
<leu-accordion label="Titel des Akkordeons"></leu-accordion>
|
|
9
|
+
`)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
describe("LeuAccordion", () => {
|
|
@@ -66,7 +66,7 @@ describe("LeuAccordion", () => {
|
|
|
66
66
|
const el = await fixture(
|
|
67
67
|
html`<leu-accordion label="Titel des Akkordeons"
|
|
68
68
|
><div slot="content">Das ist der Inhalt</div></leu-accordion
|
|
69
|
-
|
|
69
|
+
>`,
|
|
70
70
|
)
|
|
71
71
|
|
|
72
72
|
const button = el.shadowRoot.querySelector("button")
|
|
@@ -80,30 +80,34 @@ describe("LeuAccordion", () => {
|
|
|
80
80
|
expect(el.open).to.be.false
|
|
81
81
|
})
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
// TODO: `.visible` throws an error:
|
|
84
|
+
// DOMException: HTMLDivElement object could not be cloned.
|
|
85
|
+
// Maybe chai-dom is not compatible with using slots?
|
|
86
|
+
// it("doesn't show the content when it is closed", async () => {
|
|
87
|
+
// const el = await fixture(
|
|
88
|
+
// html`<leu-accordion label="Titel des Akkordeons"
|
|
89
|
+
// ><div slot="content">Das ist der Inhalt</div></leu-accordion
|
|
90
|
+
// >`,
|
|
91
|
+
// )
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
// const button = el.shadowRoot.querySelector("button")
|
|
94
|
+
// const content = el.querySelector("[slot=content]")
|
|
92
95
|
|
|
93
|
-
|
|
96
|
+
// expect(el).to.have.attribute("label", "Titel des Akkordeons")
|
|
97
|
+
// expect(content).not.to.be.visible
|
|
94
98
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
})
|
|
99
|
+
// button.click()
|
|
100
|
+
// await elementUpdated(el)
|
|
101
|
+
// await aTimeout(150)
|
|
102
|
+
// expect(content).to.be.visible
|
|
103
|
+
// })
|
|
100
104
|
|
|
101
105
|
it("shows the label prefix before the label", async () => {
|
|
102
106
|
const el = await fixture(
|
|
103
107
|
html`<leu-accordion
|
|
104
108
|
label-prefix="01"
|
|
105
109
|
label="Titel des Akkordeons"
|
|
106
|
-
></leu-accordion
|
|
110
|
+
></leu-accordion>`,
|
|
107
111
|
)
|
|
108
112
|
|
|
109
113
|
const button = el.shadowRoot.querySelector("button")
|
|
@@ -110,7 +110,7 @@ export class LeuButton extends LeuElement {
|
|
|
110
110
|
|
|
111
111
|
renderExpandingIcon() {
|
|
112
112
|
if (typeof this.expanded !== "undefined" && this.variant === "ghost") {
|
|
113
|
-
return html`<div class="icon-
|
|
113
|
+
return html`<div class="icon-expanded">
|
|
114
114
|
<leu-icon name="angleDropDown" size="24"></leu-icon>
|
|
115
115
|
</div>`
|
|
116
116
|
}
|
|
@@ -138,7 +138,7 @@ export class LeuButton extends LeuElement {
|
|
|
138
138
|
hasTextContent() {
|
|
139
139
|
return Array.from(this.childNodes).some(
|
|
140
140
|
(node) =>
|
|
141
|
-
node.nodeType === node.TEXT_NODE && node.textContent.trim() !== ""
|
|
141
|
+
node.nodeType === node.TEXT_NODE && node.textContent.trim() !== "",
|
|
142
142
|
)
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -170,9 +170,14 @@ export class LeuButton extends LeuElement {
|
|
|
170
170
|
?disabled=${this.disabled}
|
|
171
171
|
type=${this.type}
|
|
172
172
|
>
|
|
173
|
-
<
|
|
173
|
+
<div class="icon-wrapper icon-wrapper--before">
|
|
174
|
+
<slot name="before" class="icon-wrapper__slot"></slot>
|
|
175
|
+
</div>
|
|
174
176
|
<span class="content"><slot></slot></span>
|
|
175
|
-
<
|
|
177
|
+
<div class="icon-wrapper icon-wrapper--after">
|
|
178
|
+
<slot name="after" class="icon-wrapper__slot"></slot>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
176
181
|
${this.renderExpandingIcon()}
|
|
177
182
|
</button>
|
|
178
183
|
`
|
|
@@ -128,6 +128,7 @@ button.ghost {
|
|
|
128
128
|
padding: 0 0.5rem;
|
|
129
129
|
color: var(--leu-color-black-60);
|
|
130
130
|
font-family: var(--leu-font-family-regular);
|
|
131
|
+
height: 2rem;
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
button.ghost:hover {
|
|
@@ -206,49 +207,82 @@ button.ghost.inverted:disabled {
|
|
|
206
207
|
display: block;
|
|
207
208
|
}
|
|
208
209
|
|
|
209
|
-
.
|
|
210
|
-
|
|
210
|
+
.icon-wrapper {
|
|
211
|
+
display: none;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.icon-before .icon-wrapper--before,
|
|
215
|
+
.icon-after .icon-wrapper--after {
|
|
211
216
|
display: block;
|
|
212
|
-
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.ghost .icon-wrapper {
|
|
220
|
+
position: relative;
|
|
221
|
+
width: 2rem;
|
|
222
|
+
padding: 0 0.5rem;
|
|
223
|
+
--_bg: var(--leu-color-black-transp-10);
|
|
224
|
+
--_color: currentcolor;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.ghost .icon-wrapper__slot {
|
|
228
|
+
display: block;
|
|
229
|
+
position: relative;
|
|
230
|
+
z-index: 1;
|
|
231
|
+
color: var(--_color);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.ghost .icon-wrapper::before {
|
|
235
|
+
content: "";
|
|
236
|
+
position: absolute;
|
|
237
|
+
z-index: 0;
|
|
238
|
+
left: 0;
|
|
239
|
+
top: -0.5rem;
|
|
240
|
+
|
|
241
|
+
width: 2rem;
|
|
242
|
+
aspect-ratio: 1;
|
|
213
243
|
border-radius: 50%;
|
|
214
|
-
background: var(--
|
|
244
|
+
background: var(--_bg);
|
|
215
245
|
}
|
|
216
246
|
|
|
217
|
-
.ghost.active
|
|
218
|
-
|
|
219
|
-
|
|
247
|
+
.ghost.active .icon-wrapper {
|
|
248
|
+
--_bg: var(--leu-color-black-100);
|
|
249
|
+
--_color: var(--leu-color-black-0);
|
|
220
250
|
}
|
|
221
251
|
|
|
222
|
-
.ghost:disabled
|
|
223
|
-
|
|
252
|
+
.ghost:disabled .icon-wrapper {
|
|
253
|
+
--_bg: var(--leu-color-black-transp-5);
|
|
224
254
|
}
|
|
225
255
|
|
|
226
256
|
/* inverted */
|
|
227
257
|
|
|
228
|
-
.ghost.inverted
|
|
229
|
-
|
|
258
|
+
.ghost.inverted .icon-wrapper {
|
|
259
|
+
--_bg: var(--leu-color-black-transp-20);
|
|
230
260
|
}
|
|
231
261
|
|
|
232
|
-
.ghost.inverted:hover
|
|
233
|
-
|
|
234
|
-
|
|
262
|
+
.ghost.inverted:hover .icon-wrapper {
|
|
263
|
+
--_bg: var(--leu-color-black-transp-40);
|
|
264
|
+
--_color: var(--leu-color-black-0);
|
|
235
265
|
}
|
|
236
266
|
|
|
237
|
-
.ghost.inverted:disabled
|
|
238
|
-
|
|
239
|
-
|
|
267
|
+
.ghost.inverted:disabled .icon-wrapper {
|
|
268
|
+
--_bg: var(--leu-color-black-transp-20);
|
|
269
|
+
--_color: var(--leu-color-white-transp-70);
|
|
240
270
|
}
|
|
241
271
|
|
|
242
|
-
.ghost.active.inverted
|
|
243
|
-
|
|
244
|
-
|
|
272
|
+
.ghost.active.inverted .icon-wrapper {
|
|
273
|
+
--_bg: var(--leu-color-black-0);
|
|
274
|
+
--_color: var(--leu-color-black-100);
|
|
245
275
|
}
|
|
246
276
|
|
|
247
277
|
/* Expanded icon */
|
|
248
|
-
.icon-
|
|
278
|
+
.icon-expanded leu-icon {
|
|
279
|
+
display: block;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.icon-expanded {
|
|
249
283
|
transition: transform 0.1s ease;
|
|
250
284
|
}
|
|
251
285
|
|
|
252
|
-
:host([expanded="
|
|
286
|
+
:host([expanded="true"]) .icon-expanded {
|
|
253
287
|
transform: rotate(180deg);
|
|
254
288
|
}
|
|
@@ -87,6 +87,7 @@ Regular.argTypes = {
|
|
|
87
87
|
expanded: { control: "radio", options: BUTTON_EXPANDED_OPTIONS },
|
|
88
88
|
disabled: { control: "boolean" },
|
|
89
89
|
round: { control: "boolean" },
|
|
90
|
+
active: { control: "boolean" },
|
|
90
91
|
}
|
|
91
92
|
Regular.args = {
|
|
92
93
|
content: "Click Mich...",
|
|
@@ -285,51 +286,49 @@ function TemplateOverview() {
|
|
|
285
286
|
}
|
|
286
287
|
</style>
|
|
287
288
|
${groups.map(
|
|
288
|
-
(group) =>
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
(item)
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
<p>Click the button to copy the code to the clipboard</p>
|
|
332
|
-
`
|
|
289
|
+
(group) => html`
|
|
290
|
+
<h2>${group.variant + (group.inverted ? " + inverted" : "")}</h2>
|
|
291
|
+
<div
|
|
292
|
+
class=${classMap({
|
|
293
|
+
"main-table": true,
|
|
294
|
+
group: true,
|
|
295
|
+
inverted: group.inverted,
|
|
296
|
+
})}
|
|
297
|
+
>
|
|
298
|
+
${group.sizes.map(
|
|
299
|
+
(size) => html`
|
|
300
|
+
<div>
|
|
301
|
+
<div class=${classMap({ table: true })} data-root>
|
|
302
|
+
${size.items.map(
|
|
303
|
+
(item) => html`
|
|
304
|
+
<leu-button
|
|
305
|
+
label=${ifDefined(item.label)}
|
|
306
|
+
size=${ifDefined(size.size)}
|
|
307
|
+
variant=${ifDefined(group.variant)}
|
|
308
|
+
expanded=${ifDefined(item.expanded)}
|
|
309
|
+
?round=${item.round}
|
|
310
|
+
?active=${item.active}
|
|
311
|
+
?disabled=${item.disabled}
|
|
312
|
+
?inverted=${group.inverted}
|
|
313
|
+
@click=${copyContent}
|
|
314
|
+
>
|
|
315
|
+
${item.icon
|
|
316
|
+
? html` <leu-icon
|
|
317
|
+
slot=${ifDefined(item.iconPosition)}
|
|
318
|
+
name=${item.icon}
|
|
319
|
+
></leu-icon>`
|
|
320
|
+
: nothing}
|
|
321
|
+
${item.content}
|
|
322
|
+
</leu-button>
|
|
323
|
+
`,
|
|
324
|
+
)}
|
|
325
|
+
</div>
|
|
326
|
+
</div>
|
|
327
|
+
`,
|
|
328
|
+
)}
|
|
329
|
+
</div>
|
|
330
|
+
<p>Click the button to copy the code to the clipboard</p>
|
|
331
|
+
`,
|
|
333
332
|
)}`
|
|
334
333
|
}
|
|
335
334
|
|
|
@@ -25,7 +25,7 @@ describe("LeuButton", () => {
|
|
|
25
25
|
const el = await fixture(
|
|
26
26
|
html` <leu-button label="sichern">
|
|
27
27
|
<leu-icon name="download"></leu-icon>
|
|
28
|
-
</leu-button
|
|
28
|
+
</leu-button>`,
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
await expect(el).shadowDom.to.be.accessible()
|
|
@@ -41,7 +41,7 @@ describe("LeuButton", () => {
|
|
|
41
41
|
const el = await fixture(
|
|
42
42
|
html` <leu-button label="Dokument herunterladen"
|
|
43
43
|
><leu-icon name="download"></leu-icon
|
|
44
|
-
></leu-button
|
|
44
|
+
></leu-button>`,
|
|
45
45
|
)
|
|
46
46
|
const button = el.shadowRoot.querySelector("button")
|
|
47
47
|
|
|
@@ -52,14 +52,14 @@ describe("LeuButton", () => {
|
|
|
52
52
|
const el = await fixture(
|
|
53
53
|
html` <leu-button
|
|
54
54
|
><leu-icon name="addBew" slot="before"></leu-icon>Sichern</leu-button
|
|
55
|
-
|
|
55
|
+
>`,
|
|
56
56
|
)
|
|
57
57
|
|
|
58
58
|
const button = el.shadowRoot.querySelector("button")
|
|
59
59
|
|
|
60
60
|
expect(button).dom.to.equal(
|
|
61
|
-
"<button><slot name='before'></slot><span><slot></slot></span><slot name='after'></slot></button>",
|
|
62
|
-
{ ignoreAttributes: ["class", "type"] }
|
|
61
|
+
"<button><div><slot name='before'></slot></div><span><slot></slot></span><div><slot name='after'></slot></div></button>",
|
|
62
|
+
{ ignoreAttributes: ["class", "type"] },
|
|
63
63
|
)
|
|
64
64
|
})
|
|
65
65
|
|
|
@@ -67,14 +67,14 @@ describe("LeuButton", () => {
|
|
|
67
67
|
const el = await fixture(
|
|
68
68
|
html` <leu-button variant="ghost" expanded="true"
|
|
69
69
|
><leu-icon name="addNew" slot="before"></leu-icon>Sichern</leu-button
|
|
70
|
-
|
|
70
|
+
>`,
|
|
71
71
|
)
|
|
72
72
|
|
|
73
73
|
const button = el.shadowRoot.querySelector("button")
|
|
74
74
|
|
|
75
75
|
expect(button).dom.to.equal(
|
|
76
|
-
"<button aria-expanded='true'><slot name='before'></slot><span><slot></slot></span><slot name='after'></slot><div class='icon-
|
|
77
|
-
{ ignoreAttributes: ["class", "type"] }
|
|
76
|
+
"<button aria-expanded='true'><div><slot name='before'></slot></div><span><slot></slot></span><div><slot name='after'></slot></div><div class='icon-expanded'><leu-icon name='angleDropDown' size='24'></leu-icon></div></button>",
|
|
77
|
+
{ ignoreAttributes: ["class", "type"] },
|
|
78
78
|
)
|
|
79
79
|
|
|
80
80
|
el.variant = "primary"
|
|
@@ -82,8 +82,8 @@ describe("LeuButton", () => {
|
|
|
82
82
|
await elementUpdated(el)
|
|
83
83
|
|
|
84
84
|
expect(button).dom.to.equal(
|
|
85
|
-
"<button class='primary regular' aria-expanded='true'><slot name='before'></slot><span><slot></slot></span><slot name='after'></slot></button>",
|
|
86
|
-
{ ignoreAttributes: ["class", "type"] }
|
|
85
|
+
"<button class='primary regular' aria-expanded='true'><div><slot name='before'></slot></div><span><slot></slot></span><div><slot name='after'></slot></div></button>",
|
|
86
|
+
{ ignoreAttributes: ["class", "type"] },
|
|
87
87
|
)
|
|
88
88
|
})
|
|
89
89
|
|
|
@@ -92,7 +92,7 @@ describe("LeuButton", () => {
|
|
|
92
92
|
html` <leu-button variant="ghost" expanded="true" disabled>
|
|
93
93
|
<leu-icon name="addNew" slot="before"></leu-icon>
|
|
94
94
|
Sichern
|
|
95
|
-
</leu-button
|
|
95
|
+
</leu-button>`,
|
|
96
96
|
)
|
|
97
97
|
|
|
98
98
|
const button = el.shadowRoot.querySelector("button")
|
|
@@ -109,7 +109,7 @@ describe("LeuButton", () => {
|
|
|
109
109
|
const el = await fixture(
|
|
110
110
|
html` <leu-button variant="ghost" componentRole="menuitemradio"
|
|
111
111
|
><leu-icon name="addNew" slot="before"></leu-icon>Sichern</leu-button
|
|
112
|
-
|
|
112
|
+
>`,
|
|
113
113
|
)
|
|
114
114
|
|
|
115
115
|
const button = el.shadowRoot.querySelector("button")
|
|
@@ -121,7 +121,7 @@ describe("LeuButton", () => {
|
|
|
121
121
|
const el = await fixture(
|
|
122
122
|
html` <leu-button variant="ghost" componentRole="menuitemradio" active
|
|
123
123
|
><leu-icon name="addNew" slot="before"></leu-icon>Sichern</leu-button
|
|
124
|
-
|
|
124
|
+
>`,
|
|
125
125
|
)
|
|
126
126
|
|
|
127
127
|
const button = el.shadowRoot.querySelector("button")
|