@statistikzh/leu 0.13.1 → 0.14.1
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/preview.js +11 -0
- package/CHANGELOG.md +27 -0
- package/README.md +0 -67
- package/custom-elements-manifest.config.js +2 -2
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.js +8 -8
- package/dist/Button.d.ts +2 -2
- package/dist/Button.js +2 -2
- 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 +1 -3
- 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.js +3 -3
- package/dist/Icon.d.ts +2 -98
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.d.ts +8 -3
- package/dist/Input.d.ts.map +1 -1
- package/dist/Input.js +18 -12
- package/dist/{LeuElement-b670d77c.d.ts → LeuElement-DH0PPSMq.d.ts} +1 -1
- package/dist/LeuElement-DH0PPSMq.d.ts.map +1 -0
- package/dist/{LeuElement-b670d77c.js → LeuElement-DH0PPSMq.js} +2 -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 +1 -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 -7
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +7 -18
- 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-c09741c5.d.ts → hasSlotController-CYd5tWew.d.ts} +1 -1
- package/dist/hasSlotController-CYd5tWew.d.ts.map +1 -0
- package/dist/{hasSlotController-c09741c5.js → hasSlotController-CYd5tWew.js} +1 -1
- package/dist/index.d.ts +1 -2
- 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 +4 -33
- package/dist/vue/index.d.ts +11 -78
- package/dist/web-types.json +247 -243
- package/index.js +0 -1
- package/package.json +55 -51
- package/rollup.config.js +3 -3
- package/scripts/generate-component/generate.js +5 -5
- package/scripts/generate-component/templates/stories/[name].stories.js +1 -1
- package/src/components/accordion/Accordion.js +1 -1
- package/src/components/accordion/accordion.css +6 -3
- package/src/components/accordion/stories/accordion.stories.js +7 -6
- package/src/components/accordion/test/accordion.test.js +24 -20
- package/src/components/button/Button.js +1 -1
- package/src/components/button/stories/button.stories.js +44 -46
- package/src/components/button/test/button.test.js +10 -10
- package/src/components/button-group/ButtonGroup.js +1 -1
- package/src/components/button-group/stories/button-group.stories.js +3 -3
- package/src/components/checkbox/checkbox.css +1 -0
- package/src/components/checkbox/stories/checkbox-group.stories.js +1 -1
- package/src/components/checkbox/stories/checkbox.stories.js +1 -1
- package/src/components/chip/ChipSelectable.js +1 -1
- package/src/components/chip/stories/chip-group.stories.js +5 -5
- package/src/components/chip/stories/chip-link.stories.js +1 -1
- package/src/components/chip/stories/chip-removable.stories.js +1 -1
- 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/stories/dialog.stories.js +1 -1
- package/src/components/dialog/test/dialog.test.js +1 -1
- package/src/components/dropdown/stories/dropdown.stories.js +1 -1
- package/src/components/dropdown/test/dropdown.test.js +12 -13
- package/src/components/icon/stories/icon.stories.js +1 -1
- package/src/components/input/Input.js +26 -18
- package/src/components/input/input.css +2 -2
- package/src/components/input/stories/input.stories.js +1 -4
- package/src/components/input/test/input.test.js +26 -0
- package/src/components/menu/stories/menu-item.stories.js +3 -1
- package/src/components/menu/stories/menu.stories.js +1 -1
- 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 +3 -2
- package/src/components/pagination/test/pagination.test.js +8 -6
- package/src/components/popup/Popup.js +4 -4
- package/src/components/popup/stories/popup.stories.js +1 -1
- package/src/components/popup/test/popup.test.js +6 -8
- package/src/components/radio/RadioGroup.js +2 -2
- package/src/components/radio/stories/radio-group.stories.js +1 -1
- package/src/components/radio/stories/radio.stories.js +1 -1
- package/src/components/range/Range.js +20 -21
- package/src/components/range/stories/range-slider.stories.js +1 -1
- package/src/components/scroll-top/stories/scroll-top.stories.js +1 -1
- package/src/components/select/Select.js +7 -18
- package/src/components/select/stories/select.stories.js +3 -3
- package/src/components/select/test/select.test.js +18 -16
- package/src/components/spinner/stories/spinner.stories.js +1 -1
- package/src/components/table/Table.js +4 -4
- package/src/components/table/stories/table.stories.js +1 -1
- package/src/components/table/test/table.test.js +3 -2
- package/src/components/visually-hidden/stories/visually-hidden.stories.js +1 -1
- package/src/components/visually-hidden/test/visually-hidden.test.js +6 -8
- package/src/docs/contributing.mdx +154 -0
- package/src/docs/installation.mdx +35 -0
- package/src/docs/theme.mdx +349 -0
- package/src/docs/usage.mdx +73 -0
- package/src/lib/LeuElement.js +2 -2
- package/src/lib/hasSlotController.js +1 -1
- package/src/styles/style.stories.js +4 -2
- package/tsconfig.build.json +4 -3
- package/web-dev-server.config.mjs +1 -0
- package/web-test-runner.config.mjs +1 -1
- package/.github/workflows/test.yml +0 -38
- package/.storybook/preview-head.html +0 -2
- package/dist/Breadcrumb.d.ts +0 -69
- package/dist/Breadcrumb.d.ts.map +0 -1
- package/dist/Breadcrumb.js +0 -391
- package/dist/LeuElement-b670d77c.d.ts.map +0 -1
- package/dist/hasSlotController-c09741c5.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"
|
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.1",
|
|
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,mdx,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,mdx,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)
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
width: 100%;
|
|
28
28
|
background: none;
|
|
29
29
|
padding: 1rem 0;
|
|
30
|
-
margin:
|
|
30
|
+
margin: 0;
|
|
31
31
|
cursor: pointer;
|
|
32
32
|
|
|
33
33
|
border: none;
|
|
@@ -114,6 +114,8 @@
|
|
|
114
114
|
|
|
115
115
|
.contentwrapper[hidden] {
|
|
116
116
|
grid-template-rows: 0fr;
|
|
117
|
+
opacity: 0;
|
|
118
|
+
visibility: hidden;
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
slot[name="content"] {
|
|
@@ -130,7 +132,6 @@ slot[name="content"] {
|
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
.divider {
|
|
133
|
-
|
|
134
135
|
width: 100%;
|
|
135
136
|
height: 1px;
|
|
136
137
|
margin: 0;
|
|
@@ -138,7 +139,9 @@ slot[name="content"] {
|
|
|
138
139
|
border: none;
|
|
139
140
|
background-color: var(--divider-color);
|
|
140
141
|
|
|
141
|
-
transition:
|
|
142
|
+
transition:
|
|
143
|
+
transform var(--transition),
|
|
144
|
+
background-color var(--transition);
|
|
142
145
|
}
|
|
143
146
|
|
|
144
147
|
:host(:not([open])) .heading:is(:hover, :focus-visible) ~ .divider {
|
|
@@ -4,10 +4,10 @@ import { ifDefined } from "lit/directives/if-defined.js"
|
|
|
4
4
|
import "../leu-accordion.js"
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
title: "Accordion",
|
|
7
|
+
title: "Components/Accordion",
|
|
8
8
|
component: "leu-accordion",
|
|
9
9
|
argTypes: {
|
|
10
|
-
|
|
10
|
+
"heading-level": {
|
|
11
11
|
control: "select",
|
|
12
12
|
options: [1, 2, 3, 4, 5, 6],
|
|
13
13
|
},
|
|
@@ -27,9 +27,10 @@ export default {
|
|
|
27
27
|
|
|
28
28
|
function Template(args) {
|
|
29
29
|
return html` <leu-accordion
|
|
30
|
-
heading-level=${ifDefined(args
|
|
30
|
+
heading-level=${ifDefined(args["heading-level"])}
|
|
31
31
|
label=${ifDefined(args.label)}
|
|
32
|
-
label-prefix=${ifDefined(args
|
|
32
|
+
label-prefix=${ifDefined(args["label-prefix"])}
|
|
33
|
+
?open=${args.open}
|
|
33
34
|
>
|
|
34
35
|
<div slot="content">${args.content}</div>
|
|
35
36
|
</leu-accordion>`
|
|
@@ -37,7 +38,7 @@ function Template(args) {
|
|
|
37
38
|
|
|
38
39
|
export const Regular = Template.bind({})
|
|
39
40
|
Regular.args = {
|
|
40
|
-
|
|
41
|
+
"heading-level": 2,
|
|
41
42
|
label:
|
|
42
43
|
"Akkordeontitel der lang und noch länger werden kann und dann umbricht",
|
|
43
44
|
content: `Regular Interessierte können ab sofort die Genauigkeit ihrer Smartphones
|
|
@@ -55,5 +56,5 @@ Regular.args = {
|
|
|
55
56
|
export const Prefix = Template.bind({})
|
|
56
57
|
Prefix.args = {
|
|
57
58
|
...Regular.args,
|
|
58
|
-
|
|
59
|
+
"label-prefix": "01",
|
|
59
60
|
}
|
|
@@ -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")
|
|
@@ -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
|
|
|
@@ -16,7 +16,7 @@ function copyContent(e) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export default {
|
|
19
|
-
title: "Button",
|
|
19
|
+
title: "Components/Button",
|
|
20
20
|
component: "leu-button",
|
|
21
21
|
parameters: {
|
|
22
22
|
design: {
|
|
@@ -286,51 +286,49 @@ function TemplateOverview() {
|
|
|
286
286
|
}
|
|
287
287
|
</style>
|
|
288
288
|
${groups.map(
|
|
289
|
-
(group) =>
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
(item)
|
|
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
|
-
|
|
332
|
-
<p>Click the button to copy the code to the clipboard</p>
|
|
333
|
-
`
|
|
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
|
+
`,
|
|
334
332
|
)}`
|
|
335
333
|
}
|
|
336
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
61
|
"<button><div><slot name='before'></slot></div><span><slot></slot></span><div><slot name='after'></slot></div></button>",
|
|
62
|
-
{ ignoreAttributes: ["class", "type"] }
|
|
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
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"] }
|
|
77
|
+
{ ignoreAttributes: ["class", "type"] },
|
|
78
78
|
)
|
|
79
79
|
|
|
80
80
|
el.variant = "primary"
|
|
@@ -83,7 +83,7 @@ describe("LeuButton", () => {
|
|
|
83
83
|
|
|
84
84
|
expect(button).dom.to.equal(
|
|
85
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"] }
|
|
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")
|
|
@@ -13,7 +13,7 @@ function updateStorybookArgss(id, args) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export default {
|
|
16
|
-
title: "ButtonGroup",
|
|
16
|
+
title: "Components/ButtonGroup",
|
|
17
17
|
component: "leu-button-group",
|
|
18
18
|
parameters: {
|
|
19
19
|
design: {
|
|
@@ -36,10 +36,10 @@ function Template({ items, value }, { id }) {
|
|
|
36
36
|
(i) =>
|
|
37
37
|
html`<leu-button
|
|
38
38
|
variant="secondary"
|
|
39
|
-
?active=${value === i}
|
|
39
|
+
?active=${value === i || value === `${i}-attr`}
|
|
40
40
|
value=${`${i}-attr`}
|
|
41
41
|
>${i}
|
|
42
|
-
</leu-button
|
|
42
|
+
</leu-button>`,
|
|
43
43
|
)}
|
|
44
44
|
</leu-button-group>
|
|
45
45
|
<br />
|