diff --git a/.github/workflows/auto-dependency-updater.yml b/.github/workflows/auto-dependency-updater.yml index 0e667a0a0b..62518d68a7 100644 --- a/.github/workflows/auto-dependency-updater.yml +++ b/.github/workflows/auto-dependency-updater.yml @@ -13,7 +13,7 @@ jobs: with: fetch-depth: 0 persist-credentials: false - ref: 'develop' + ref: 'release/1.7' # - uses: pnpm/action-setup@v2.2.4 # with: @@ -50,7 +50,7 @@ jobs: ${{ runner.os }}-pnpm-store - name: Create new branch - run: git checkout -b chore/auto-update-deps + run: git checkout -b chore/auto-update-deps-v1 - name: Install tools run: npm i lerna npm-check-updates --no-save - name: Update dependencies @@ -68,5 +68,5 @@ jobs: - uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} - branch: 'chore/auto-update-deps' + branch: 'chore/auto-update-deps-v1' force: true diff --git a/.github/workflows/auto-file-generator.yml b/.github/workflows/auto-file-generator.yml index c86b158c10..a29a6141e3 100644 --- a/.github/workflows/auto-file-generator.yml +++ b/.github/workflows/auto-file-generator.yml @@ -13,7 +13,7 @@ jobs: with: fetch-depth: 0 persist-credentials: false - ref: 'develop' + ref: 'release/1.7' # - uses: pnpm/action-setup@v2.2.4 # with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bee9795ac6..b5ec23d8a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ on: branches: - 'develop' - 'main' + - 'release/*' workflow_dispatch: jobs: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7e0866d55a..20aa1c4b77 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -177,6 +177,6 @@ jobs: env: NODE_AUTH_TOKEN: ${{env.token}} - publish-page: - needs: publish - uses: public-ui/kolibri/.github/workflows/publish-page.yml@develop + # publish-page: + # needs: publish + # uses: public-ui/kolibri/.github/workflows/publish-page.yml@release/1.7 diff --git a/.github/workflows/sync-to-opencode.yml b/.github/workflows/sync-to-opencode.yml index b5299a62ec..f1345194e3 100644 --- a/.github/workflows/sync-to-opencode.yml +++ b/.github/workflows/sync-to-opencode.yml @@ -14,7 +14,7 @@ jobs: with: fetch-depth: 0 persist-credentials: false - ref: 'develop' + ref: 'release/1.7' - name: git-sync run: | git remote add opencode https://OC000005112572:${{ secrets.GITLAB_PERSONAL_ACCESS_TOKEN }}@gitlab.opencode.de/OC000005112572/kolibri.git diff --git a/lerna.json b/lerna.json index 407ded2bf2..e05a704441 100644 --- a/lerna.json +++ b/lerna.json @@ -30,5 +30,5 @@ "packages/tools/visual-tests" ], "useNx": true, - "version": "1.7.2" + "version": "1.7.6-rc.1" } diff --git a/package.json b/package.json index 4c2359eb5f..2a262c0188 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "ncu:minor": "ncu -t minor -u -x rimraf && pnpm -r exec ncu -t minor -u -x rimraf,rxjs,typescript,zone.js", "ncu:patch": "ncu -t patch -u -x rimraf && pnpm -r exec ncu -t patch -u -x rimraf", "pack": "pnpm -r exec pnpm pack", - "postinstall": "pnpm exec playwright install", + "postinstall": "pnpm exec playwright install && echo \"Don't forget to build all packages once: pnpm -r build\"", "prepare:husky": "rimraf .husky && husky install && npm-run-all prepare:husky:*", "prepare:husky:commitlint": "husky add .husky/commit-msg \"npx commitlint --edit $1\"", "prepare:husky:depcheck": "husky add .husky/pre-push \"pnpm -r depcheck\"", @@ -28,18 +28,18 @@ "update": "pnpm ncu:patch && pnpm ncu:minor && pnpm ncu:major" }, "devDependencies": { - "@commitlint/cli": "17.7.2", - "@commitlint/config-conventional": "17.7.0", + "@commitlint/cli": "18.2.0", + "@commitlint/config-conventional": "18.1.0", "@types/node": "ts5.1", "cross-env": "7.0.3", - "depcheck": "1.4.6", + "depcheck": "1.4.7", "husky": "8.0.3", - "lerna": "7.3.0", - "license-report": "6.4.0", - "lint-staged": "14.0.1", - "npm-check-updates": "16.14.4", + "lerna": "7.4.2", + "license-report": "6.5.0", + "lint-staged": "15.0.2", + "npm-check-updates": "16.14.6", "npm-run-all": "4.1.5", - "pnpm": "8.8.0", + "pnpm": "8.10.2", "prettier": "3.0.3", "rimraf": "3.0.2", "ts-node": "10.9.1", diff --git a/packages/adapters/angular/v11/package.json b/packages/adapters/angular/v11/package.json index d77dc33e16..1f0339bdd4 100644 --- a/packages/adapters/angular/v11/package.json +++ b/packages/adapters/angular/v11/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/angular-v11", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -66,11 +66,11 @@ "@angular/compiler": "11.2.14", "@angular/compiler-cli": "11.2.14", "@angular/core": "11.2.14", - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "@types/minimatch": "5.1.2", - "@types/minimist": "1.2.3", + "@types/minimist": "1.2.5", "@types/node": "ts4.1", - "@types/normalize-package-data": "2.4.2", + "@types/normalize-package-data": "2.4.4", "prettier": "3.0.3", "rimraf": "3.0.2", "rxjs": "6.5.5", @@ -80,7 +80,7 @@ }, "peerDependencies": { "@angular/core": "^11", - "@public-ui/components": "1.7.2" + "@public-ui/components": "1.7.6-rc.1" }, "files": [ "dist" diff --git a/packages/adapters/angular/v12/package.json b/packages/adapters/angular/v12/package.json index f30cd82064..de73d8bb88 100644 --- a/packages/adapters/angular/v12/package.json +++ b/packages/adapters/angular/v12/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/angular-v12", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -66,11 +66,11 @@ "@angular/compiler": "12.2.17", "@angular/compiler-cli": "12.2.17", "@angular/core": "12.2.17", - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "@types/minimatch": "5.1.2", - "@types/minimist": "1.2.3", + "@types/minimist": "1.2.5", "@types/node": "ts4.3", - "@types/normalize-package-data": "2.4.2", + "@types/normalize-package-data": "2.4.4", "prettier": "3.0.3", "rimraf": "3.0.2", "rxjs": "7.6.0", @@ -80,7 +80,7 @@ }, "peerDependencies": { "@angular/core": "^12", - "@public-ui/components": "1.7.2" + "@public-ui/components": "1.7.6-rc.1" }, "files": [ "dist" diff --git a/packages/adapters/angular/v13/package.json b/packages/adapters/angular/v13/package.json index 1434786e67..2343df3a22 100644 --- a/packages/adapters/angular/v13/package.json +++ b/packages/adapters/angular/v13/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/angular-v13", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -66,11 +66,11 @@ "@angular/compiler": "13.4.0", "@angular/compiler-cli": "13.4.0", "@angular/core": "13.4.0", - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "@types/minimatch": "5.1.2", - "@types/minimist": "1.2.3", + "@types/minimist": "1.2.5", "@types/node": "ts4.6", - "@types/normalize-package-data": "2.4.2", + "@types/normalize-package-data": "2.4.4", "prettier": "3.0.3", "rimraf": "3.0.2", "rxjs": "7.6.0", @@ -80,7 +80,7 @@ }, "peerDependencies": { "@angular/core": "^13", - "@public-ui/components": "1.7.2" + "@public-ui/components": "1.7.6-rc.1" }, "files": [ "dist" diff --git a/packages/adapters/angular/v14/package.json b/packages/adapters/angular/v14/package.json index 3e1f028b25..6c18d4f90b 100644 --- a/packages/adapters/angular/v14/package.json +++ b/packages/adapters/angular/v14/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/angular-v14", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -66,11 +66,11 @@ "@angular/compiler": "14.3.0", "@angular/compiler-cli": "14.3.0", "@angular/core": "14.3.0", - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "@types/minimatch": "5.1.2", - "@types/minimist": "1.2.3", + "@types/minimist": "1.2.5", "@types/node": "ts4.8", - "@types/normalize-package-data": "2.4.2", + "@types/normalize-package-data": "2.4.4", "prettier": "3.0.3", "rimraf": "3.0.2", "rxjs": "7.6.0", @@ -80,7 +80,7 @@ }, "peerDependencies": { "@angular/core": "^14", - "@public-ui/components": "1.7.2" + "@public-ui/components": "1.7.6-rc.1" }, "files": [ "dist" diff --git a/packages/adapters/angular/v15/package.json b/packages/adapters/angular/v15/package.json index 0df3b17910..1608a5efa2 100644 --- a/packages/adapters/angular/v15/package.json +++ b/packages/adapters/angular/v15/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/angular-v15", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -63,14 +63,14 @@ "import": "./dist/index.js" }, "devDependencies": { - "@angular/compiler": "15.2.9", - "@angular/compiler-cli": "15.2.9", - "@angular/core": "15.2.9", - "@public-ui/components": "1.7.2", + "@angular/compiler": "15.2.10", + "@angular/compiler-cli": "15.2.10", + "@angular/core": "15.2.10", + "@public-ui/components": "1.7.6-rc.1", "@types/minimatch": "5.1.2", - "@types/minimist": "1.2.3", + "@types/minimist": "1.2.5", "@types/node": "ts4.9", - "@types/normalize-package-data": "2.4.2", + "@types/normalize-package-data": "2.4.4", "prettier": "3.0.3", "rimraf": "3.0.2", "rxjs": "7.8.1", @@ -80,7 +80,7 @@ }, "peerDependencies": { "@angular/core": "^15", - "@public-ui/components": "1.7.2" + "@public-ui/components": "1.7.6-rc.1" }, "files": [ "dist" diff --git a/packages/adapters/angular/v16/package.json b/packages/adapters/angular/v16/package.json index 2669ea09d6..66e628e1f8 100644 --- a/packages/adapters/angular/v16/package.json +++ b/packages/adapters/angular/v16/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/angular-v16", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -63,14 +63,14 @@ "import": "./dist/index.js" }, "devDependencies": { - "@angular/compiler": "16.2.7", - "@angular/compiler-cli": "16.2.7", - "@angular/core": "16.2.7", - "@public-ui/components": "1.7.2", + "@angular/compiler": "16.2.12", + "@angular/compiler-cli": "16.2.12", + "@angular/core": "16.2.12", + "@public-ui/components": "1.7.6-rc.1", "@types/minimatch": "5.1.2", - "@types/minimist": "1.2.3", + "@types/minimist": "1.2.5", "@types/node": "ts5.1", - "@types/normalize-package-data": "2.4.2", + "@types/normalize-package-data": "2.4.4", "prettier": "3.0.3", "rimraf": "3.0.2", "rxjs": "7.8.1", @@ -80,7 +80,7 @@ }, "peerDependencies": { "@angular/core": "^16", - "@public-ui/components": "1.7.2" + "@public-ui/components": "1.7.6-rc.1" }, "files": [ "dist" diff --git a/packages/adapters/hydrate/package.json b/packages/adapters/hydrate/package.json index 4ed95f32a4..ea968ff239 100644 --- a/packages/adapters/hydrate/package.json +++ b/packages/adapters/hydrate/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/hydrate", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -46,11 +46,11 @@ "prepack": "npm run build" }, "devDependencies": { - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "rimraf": "3.0.2" }, "peerDependencies": { - "@public-ui/components": "1.7.2" + "@public-ui/components": "1.7.6-rc.1" }, "sideEffects": false, "type": "commonjs", diff --git a/packages/adapters/preact/package.json b/packages/adapters/preact/package.json index 128ec5326c..c04c646ad6 100644 --- a/packages/adapters/preact/package.json +++ b/packages/adapters/preact/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/preact", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -46,10 +46,10 @@ "prepack": "unbuild" }, "dependencies": { - "@public-ui/react": "1.7.2" + "@public-ui/react": "1.7.6-rc.1" }, "devDependencies": { - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "react": "18.2.0", "react-dom": "18.2.0", "typescript": "5.2.2", diff --git a/packages/adapters/react-standalone/kolibri-rock's.html b/packages/adapters/react-standalone/kolibri-rock's.html index d2eda00a3e..f83f1936ee 100644 --- a/packages/adapters/react-standalone/kolibri-rock's.html +++ b/packages/adapters/react-standalone/kolibri-rock's.html @@ -10,8 +10,8 @@ - - + + @@ -23,7 +23,7 @@
diff --git a/packages/adapters/react-standalone/package.json b/packages/adapters/react-standalone/package.json index 217080988b..f300ecf1c7 100644 --- a/packages/adapters/react-standalone/package.json +++ b/packages/adapters/react-standalone/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/react-standalone", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -47,12 +47,12 @@ "prepack": "pnpm build" }, "devDependencies": { - "@public-ui/react": "1.7.2", + "@public-ui/react": "1.7.6-rc.1", "cpy-cli": "5.0.0", "rimraf": "3.0.2" }, "peerDependencies": { - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "react": ">=16.14.0", "react-dom": ">=16.14.0" }, diff --git a/packages/adapters/react/package.json b/packages/adapters/react/package.json index e04e489a02..7032704338 100644 --- a/packages/adapters/react/package.json +++ b/packages/adapters/react/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/react", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -46,20 +46,20 @@ "prepack": "unbuild" }, "devDependencies": { - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "@types/minimatch": "5.1.2", - "@types/minimist": "1.2.3", + "@types/minimist": "1.2.5", "@types/node": "ts5.1", - "@types/normalize-package-data": "2.4.2", - "@types/react": "18.2.23", - "@types/react-dom": "18.2.8", + "@types/normalize-package-data": "2.4.4", + "@types/react": "18.2.37", + "@types/react-dom": "18.2.15", "react": "18.2.0", "react-dom": "18.2.0", "typescript": "5.2.2", "unbuild": "1.2.1" }, "peerDependencies": { - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "react": ">=16.14.0", "react-dom": ">=16.14.0" }, diff --git a/packages/adapters/solid/package.json b/packages/adapters/solid/package.json index 3e37fae70f..627d2967a4 100644 --- a/packages/adapters/solid/package.json +++ b/packages/adapters/solid/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/solid", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -46,17 +46,17 @@ "prepack": "unbuild" }, "devDependencies": { - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "@types/minimatch": "5.1.2", - "@types/minimist": "1.2.3", + "@types/minimist": "1.2.5", "@types/node": "ts5.1", - "@types/normalize-package-data": "2.4.2", - "solid-js": "1.7.12", + "@types/normalize-package-data": "2.4.4", + "solid-js": "1.8.5", "typescript": "5.2.2", "unbuild": "1.2.1" }, "peerDependencies": { - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "solid-js": ">=1.2.0" }, "sideEffects": false, diff --git a/packages/adapters/vue/package.json b/packages/adapters/vue/package.json index 1b906ad0a9..61148103ce 100644 --- a/packages/adapters/vue/package.json +++ b/packages/adapters/vue/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/vue", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -46,18 +46,18 @@ "prepack": "unbuild" }, "devDependencies": { - "@babel/types": "7.23.0", - "@public-ui/components": "1.7.2", + "@babel/types": "7.23.3", + "@public-ui/components": "1.7.6-rc.1", "@types/minimatch": "5.1.2", - "@types/minimist": "1.2.3", + "@types/minimist": "1.2.5", "@types/node": "ts5.1", - "@types/normalize-package-data": "2.4.2", + "@types/normalize-package-data": "2.4.4", "typescript": "5.2.2", "unbuild": "1.2.1", - "vue": "3.3.4" + "vue": "3.3.8" }, "peerDependencies": { - "@public-ui/components": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", "vue": ">=3" }, "sideEffects": false, diff --git a/packages/components/.eslintrc.js b/packages/components/.eslintrc.js index 64529d4609..bbb1d4b2fd 100644 --- a/packages/components/.eslintrc.js +++ b/packages/components/.eslintrc.js @@ -49,6 +49,12 @@ config.overrides.push({ rules: { 'jsx-a11y/no-access-key': 'off', // 'react/no-unused-state': 'error', + 'jsx-a11y/label-has-associated-control': [ + 2, + { + depth: 3, // allow labels deeply nested into spans + }, + ], }, }); config.overrides.push({ diff --git a/packages/components/package.json b/packages/components/package.json index 93001212b3..36341aab6a 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/components", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -67,46 +67,46 @@ "prepack": "npm run build && cp package.json package.bak.json && rimraf dist/collection dist/kolibri/assets/@leanup dist/types/assets/@leanup && node scripts/anonymous.js && node scripts/minify.js" }, "dependencies": { - "@a11y-ui/core": "1.0.7", + "@a11y-ui/core": "1.1.0", "@floating-ui/dom": "1.5.3", - "@public-ui/schema": "1.7.2", - "i18next": "23.5.1", + "@public-ui/schema": "1.7.6-rc.1", + "i18next": "23.6.0", "markdown-it": "13.0.2" }, "devDependencies": { - "@stencil/angular-output-target": "0.8.2", - "@stencil/core": "4.3.0", + "@stencil/angular-output-target": "0.8.3", + "@stencil/core": "4.7.1", "@stencil/postcss": "2.1.0", "@stencil/react-output-target": "0.5.3", "@stencil/solid-output-target": "file:node_martin/stencil-solid-output-target-0.0.1.tgz", - "@stencil/vue-output-target": "0.8.6", - "@types/color-convert": "2.0.1", + "@stencil/vue-output-target": "0.8.7", + "@types/color-convert": "2.0.3", "@types/jest": "26.0.24", - "@types/markdown-it": "13.0.2", - "@types/mustache": "4.2.3", + "@types/markdown-it": "13.0.6", + "@types/mustache": "4.2.5", "@types/node": "ts5.1", - "@types/pug": "2.0.7", - "@types/twig": "1.12.13", - "@types/wcag-contrast": "3.0.1", - "@typescript-eslint/eslint-plugin": "6.7.3", - "@typescript-eslint/parser": "6.7.3", + "@types/pug": "2.0.9", + "@types/twig": "1.12.15", + "@types/wcag-contrast": "3.0.3", + "@typescript-eslint/eslint-plugin": "6.10.0", + "@typescript-eslint/parser": "6.10.0", "autoprefixer": "10.4.16", "clean-css": "5.3.2", "color-convert": "2.0.1", "color-rgba": "2.4.0", "cross-env": "7.0.3", "cssnano": "6.0.1", - "eslint": "8.50.0", + "eslint": "8.53.0", "eslint-config-prettier": "9.0.0", "eslint-plugin-html": "7.1.0", "eslint-plugin-jsdoc": "46.8.2", "eslint-plugin-json": "3.1.0", - "eslint-plugin-jsx-a11y": "6.7.1", + "eslint-plugin-jsx-a11y": "6.8.0", "eslint-plugin-no-loops": "0.3.0", "eslint-plugin-react": "7.33.2", "jest": "26.6.3", "jest-cli": "26.6.3", - "lighthouse": "11.1.0", + "lighthouse": "11.3.0", "mustache": "4.2.0", "postcss": "8.4.31", "postcss-sorting": "8.0.2", @@ -118,12 +118,12 @@ "rimraf": "3.0.2", "rxjs": "7.8.1", "stencil-awesome-test": "1.0.6", - "terser": "5.20.0", + "terser": "5.24.0", "tslib": "2.6.2", "twig": "1.16.0", "typescript": "5.2.2", "wcag-contrast": "3.0.0", - "webpack": "5.88.2", + "webpack": "5.89.0", "workbox-build": "7.0.0" }, "files": [ diff --git a/packages/components/src/components.d.ts b/packages/components/src/components.d.ts index 69afa305ae..75cd474537 100644 --- a/packages/components/src/components.d.ts +++ b/packages/components/src/components.d.ts @@ -64,7 +64,7 @@ import { KoliBriTableDataType, KoliBriTableHeaders, KoliBriTablePaginationProps import { KoliBriTabsCallbacks, TabButtonProps } from "./components/tabs/types"; import { CSSResize } from "./components/textarea/types"; import { KoliBriToastEventCallbacks } from "./types/toast"; -import { Toast, ToastState, ToastStatus } from "./components/toast-container/types"; +import { Toast, ToastState } from "./components/toaster/types"; export { LabelPropType, LabelWithExpertSlotPropType } from "./types/props/label"; export { TooltipAlignPropType } from "./types/props/tooltip-align"; export { HeadingLevel } from "./types/heading-level"; @@ -124,7 +124,7 @@ export { KoliBriTableDataType, KoliBriTableHeaders, KoliBriTablePaginationProps export { KoliBriTabsCallbacks, TabButtonProps } from "./components/tabs/types"; export { CSSResize } from "./components/textarea/types"; export { KoliBriToastEventCallbacks } from "./types/toast"; -export { Toast, ToastState, ToastStatus } from "./components/toast-container/types"; +export { Toast, ToastState } from "./components/toaster/types"; export namespace Components { interface KolAbbr { /** @@ -2566,7 +2566,7 @@ export namespace Components { */ "_variant"?: ButtonVariantPropType; } - interface KolPopover { + interface KolPopoverWc { /** * Defines the alignment of the tooltip, popover or tabs in relation to the element. */ @@ -3097,26 +3097,53 @@ export namespace Components { */ "_value"?: string; } + /** + * @deprecated - Use ToastService - see toaster + */ interface KolToast { + /** + * Defines whether the screen-readers should read out the notification. + */ + "_alert"?: boolean; + /** + * Defines whether the element can be closed. + * @TODO : Change type back to `HasCloserPropType` after Stencil#4663 has been resolved. + */ + "_hasCloser"?: boolean; + /** + * Deprecated: Gibt die Beschriftung der Komponente an. + * @deprecated Use _label. + */ + "_heading"?: string; /** * Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). */ - "_label": LabelPropType; + "_label"?: LabelPropType; /** - * Defines the event callback functions for the component. + * Defines which H-level from 1-6 the heading has. 0 specifies no heading and is shown as bold text. + */ + "_level"?: HeadingLevel; + /** + * Gibt die EventCallback-Function für das Schließen des Toasts an. */ "_on"?: KoliBriToastEventCallbacks; /** - * Defines the current toast status. + * Makes the element show up. + * @TODO : Change type back to `ShowPropType` after Stencil#4663 has been resolved. */ - "_status": ToastStatus; + "_show"?: boolean; + /** + * Gibt an, wie viele Millisekunden der Toast eingeblendet werden soll. + */ + "_showDuration"?: number; /** * Defines either the type of the component or of the components interactive element. */ "_type"?: AlertType; } interface KolToastContainer { - "enqueue": (toast: Toast) => Promise; + "closeAll": () => Promise; + "enqueue": (toast: Toast) => Promise<() => void>; } interface KolTooltipWc { /** @@ -3436,11 +3463,11 @@ declare global { prototype: HTMLKolPaginationElement; new (): HTMLKolPaginationElement; }; - interface HTMLKolPopoverElement extends Components.KolPopover, HTMLStencilElement { + interface HTMLKolPopoverWcElement extends Components.KolPopoverWc, HTMLStencilElement { } - var HTMLKolPopoverElement: { - prototype: HTMLKolPopoverElement; - new (): HTMLKolPopoverElement; + var HTMLKolPopoverWcElement: { + prototype: HTMLKolPopoverWcElement; + new (): HTMLKolPopoverWcElement; }; interface HTMLKolProgressElement extends Components.KolProgress, HTMLStencilElement { } @@ -3514,6 +3541,9 @@ declare global { prototype: HTMLKolTextareaElement; new (): HTMLKolTextareaElement; }; + /** + * @deprecated - Use ToastService - see toaster + */ interface HTMLKolToastElement extends Components.KolToast, HTMLStencilElement { } var HTMLKolToastElement: { @@ -3585,7 +3615,7 @@ declare global { "kol-modal": HTMLKolModalElement; "kol-nav": HTMLKolNavElement; "kol-pagination": HTMLKolPaginationElement; - "kol-popover": HTMLKolPopoverElement; + "kol-popover-wc": HTMLKolPopoverWcElement; "kol-progress": HTMLKolProgressElement; "kol-quote": HTMLKolQuoteElement; "kol-select": HTMLKolSelectElement; @@ -6045,7 +6075,7 @@ declare namespace LocalJSX { */ "_variant"?: ButtonVariantPropType; } - interface KolPopover { + interface KolPopoverWc { /** * Defines the alignment of the tooltip, popover or tabs in relation to the element. */ @@ -6576,19 +6606,45 @@ declare namespace LocalJSX { */ "_value"?: string; } + /** + * @deprecated - Use ToastService - see toaster + */ interface KolToast { + /** + * Defines whether the screen-readers should read out the notification. + */ + "_alert"?: boolean; + /** + * Defines whether the element can be closed. + * @TODO : Change type back to `HasCloserPropType` after Stencil#4663 has been resolved. + */ + "_hasCloser"?: boolean; + /** + * Deprecated: Gibt die Beschriftung der Komponente an. + * @deprecated Use _label. + */ + "_heading"?: string; /** * Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). */ - "_label": LabelPropType; + "_label"?: LabelPropType; /** - * Defines the event callback functions for the component. + * Defines which H-level from 1-6 the heading has. 0 specifies no heading and is shown as bold text. + */ + "_level"?: HeadingLevel; + /** + * Gibt die EventCallback-Function für das Schließen des Toasts an. */ "_on"?: KoliBriToastEventCallbacks; /** - * Defines the current toast status. + * Makes the element show up. + * @TODO : Change type back to `ShowPropType` after Stencil#4663 has been resolved. */ - "_status": ToastStatus; + "_show"?: boolean; + /** + * Gibt an, wie viele Millisekunden der Toast eingeblendet werden soll. + */ + "_showDuration"?: number; /** * Defines either the type of the component or of the components interactive element. */ @@ -6668,7 +6724,7 @@ declare namespace LocalJSX { "kol-modal": KolModal; "kol-nav": KolNav; "kol-pagination": KolPagination; - "kol-popover": KolPopover; + "kol-popover-wc": KolPopoverWc; "kol-progress": KolProgress; "kol-quote": KolQuote; "kol-select": KolSelect; @@ -6752,7 +6808,7 @@ declare module "@stencil/core" { "kol-modal": LocalJSX.KolModal & JSXBase.HTMLAttributes; "kol-nav": LocalJSX.KolNav & JSXBase.HTMLAttributes; "kol-pagination": LocalJSX.KolPagination & JSXBase.HTMLAttributes; - "kol-popover": LocalJSX.KolPopover & JSXBase.HTMLAttributes; + "kol-popover-wc": LocalJSX.KolPopoverWc & JSXBase.HTMLAttributes; "kol-progress": LocalJSX.KolProgress & JSXBase.HTMLAttributes; "kol-quote": LocalJSX.KolQuote & JSXBase.HTMLAttributes; "kol-select": LocalJSX.KolSelect & JSXBase.HTMLAttributes; @@ -6765,6 +6821,9 @@ declare module "@stencil/core" { "kol-table": LocalJSX.KolTable & JSXBase.HTMLAttributes; "kol-tabs": LocalJSX.KolTabs & JSXBase.HTMLAttributes; "kol-textarea": LocalJSX.KolTextarea & JSXBase.HTMLAttributes; + /** + * @deprecated - Use ToastService - see toaster + */ "kol-toast": LocalJSX.KolToast & JSXBase.HTMLAttributes; "kol-toast-container": LocalJSX.KolToastContainer & JSXBase.HTMLAttributes; "kol-tooltip-wc": LocalJSX.KolTooltipWc & JSXBase.HTMLAttributes; diff --git a/packages/components/src/components/a11y.css b/packages/components/src/components/a11y.css index 3f4d37710e..9e5ae6d618 100644 --- a/packages/components/src/components/a11y.css +++ b/packages/components/src/components/a11y.css @@ -6,13 +6,12 @@ * Minimum size of interactive elements. */ --a11y-min-size: 44px; - font-size: inherit; -} -* { /* * Verdana is an accessible font that can be used without requiring additional loading time. */ font-family: Verdana; +} +* { /* * This rule enables the word dividing for all texts. That is important for high zoom levels. */ diff --git a/packages/components/src/components/accordion/component.tsx b/packages/components/src/components/accordion/component.tsx index 6f77c587c4..4eae35bfa0 100644 --- a/packages/components/src/components/accordion/component.tsx +++ b/packages/components/src/components/accordion/component.tsx @@ -1,6 +1,6 @@ // https://codepen.io/mbxtr/pen/OJPOYg?html-preprocessor=haml -import { Component, h, Host, JSX, Prop, State, Watch } from '@stencil/core'; +import { Component, Element, h, Host, JSX, Prop, State, Watch } from '@stencil/core'; import { HeadingLevel } from '../../types/heading-level'; import { LabelPropType, validateLabel } from '../../types/props/label'; @@ -8,6 +8,7 @@ import { OpenPropType, validateOpen } from '../../types/props/open'; import { featureHint } from '../../utils/a11y.tipps'; import { nonce } from '../../utils/dev.utils'; import { setState } from '../../utils/prop.validators'; +import { propagateFocus } from '../../utils/reuse'; import { watchHeadingLevel } from '../heading/validation'; import { API, KoliBriAccordionCallbacks, States } from './types'; @@ -32,8 +33,13 @@ featureHint(`[KolAccordion] Tab-Sperre des Inhalts im geschlossenen Zustand.`); shadow: true, }) export class KolAccordion implements API { + @Element() private readonly host?: HTMLKolDetailsElement; private readonly nonce = nonce(); + private readonly catchRef = (ref?: HTMLKolButtonWcElement) => { + propagateFocus(this.host, ref); + }; + public render(): JSX.Element { return ( @@ -45,6 +51,7 @@ export class KolAccordion implements API { > { - this.ref = ref; - propagateFocus(this.host, this.ref); + propagateFocus(this.host, ref); }; public render(): JSX.Element { diff --git a/packages/components/src/components/button/readme.md b/packages/components/src/components/button/readme.md index a5e2325b80..9088ac1689 100644 --- a/packages/components/src/components/button/readme.md +++ b/packages/components/src/components/button/readme.md @@ -130,7 +130,7 @@ Probleme mit Disabled-Status - [kol-nav](../nav) - [kol-pagination](../pagination) - [kol-table](../table) -- [kol-toast-container](../toast-container) +- [kol-toast-container](../toaster) ### Depends on diff --git a/packages/components/src/components/button/shadow.tsx b/packages/components/src/components/button/shadow.tsx index 06c5d856fd..04ebd05421 100644 --- a/packages/components/src/components/button/shadow.tsx +++ b/packages/components/src/components/button/shadow.tsx @@ -25,11 +25,9 @@ import { Props } from './types'; }) export class KolButton implements Props { @Element() private readonly host?: HTMLKolButtonElement; - private ref?: HTMLKolButtonWcElement; private readonly catchRef = (ref?: HTMLKolButtonWcElement) => { - this.ref = ref; - propagateFocus(this.host, this.ref); + propagateFocus(this.host, ref); }; public render(): JSX.Element { diff --git a/packages/components/src/components/component-list.ts b/packages/components/src/components/component-list.ts index 9b1160dbd4..086cbcf1ff 100644 --- a/packages/components/src/components/component-list.ts +++ b/packages/components/src/components/component-list.ts @@ -57,7 +57,7 @@ import { KolSymbol } from './symbol/component'; import { KolTable } from './table/component'; import { KolTabs } from './tabs/component'; import { KolTextarea } from './textarea/component'; -import { KolToastContainer } from './toast-container/component'; +import { KolToastContainer } from './toaster/component'; import { KolToast } from './toast/component'; import { KolTooltip } from './tooltip/component'; import { KolVersion } from './version/component'; diff --git a/packages/components/src/components/details/DetailsAnimationController.ts b/packages/components/src/components/details/DetailsAnimationController.ts index bb34560aa6..2207b30dac 100644 --- a/packages/components/src/components/details/DetailsAnimationController.ts +++ b/packages/components/src/components/details/DetailsAnimationController.ts @@ -12,7 +12,6 @@ export default class DetailsAnimationController { private handleSummaryClick(event: MouseEvent) { event.preventDefault(); - this.detailsElement.style.overflow = 'hidden'; if (this.isClosing || !this.detailsElement.open) { this.open(); } else if (this.isExpanding || this.detailsElement.open) { @@ -21,33 +20,37 @@ export default class DetailsAnimationController { } public open() { - /** - * The Jest test framework does not support the `offsetHeight` property on the `details` element. - * This is a workaround to make the tests pass (?? 0). - */ - this.detailsElement.style.height = `${this.detailsElement.offsetHeight ?? 0}px`; this.detailsElement.open = true; window.requestAnimationFrame(this.expand.bind(this)); } private expand() { this.isExpanding = true; - this.animateDetailsHeight(this.summaryElement.offsetHeight + this.contentElement.offsetHeight, 'expand'); + this.animateContentHeight('expand'); } private collapse() { this.isClosing = true; - this.animateDetailsHeight(this.summaryElement.offsetHeight, 'collapse'); + this.animateContentHeight('collapse'); } - private animateDetailsHeight(endHeight: number, direction: 'expand' | 'collapse') { - const startHeight = this.detailsElement.offsetHeight; + private animateContentHeight(direction: 'expand' | 'collapse') { + let startHeight = direction === 'expand' ? 0 : this.contentElement.offsetHeight; + let endHeight = direction === 'expand' ? this.contentElement.offsetHeight : 0; + /** + * Override start and end height, when an animation is ongoing. During the animation, offsetHeight reflects the actual current height as it's being animated. + * After canceling the animation, it reverts to the full height of the content container. + */ if (this.animation) { + startHeight = this.contentElement.offsetHeight; this.animation.cancel(); + if (direction === 'expand') { + endHeight = this.contentElement.offsetHeight; + } } - this.animation = this.detailsElement.animate( + this.animation = this.contentElement.animate( { height: [`${startHeight}px`, `${endHeight}px`], }, @@ -82,7 +85,5 @@ export default class DetailsAnimationController { this.animation = undefined; this.isClosing = false; this.isExpanding = false; - this.detailsElement.style.removeProperty('height'); - this.detailsElement.style.removeProperty('overview'); } } diff --git a/packages/components/src/components/details/component.tsx b/packages/components/src/components/details/component.tsx index 8a4b3649d9..d89b6b64a6 100644 --- a/packages/components/src/components/details/component.tsx +++ b/packages/components/src/components/details/component.tsx @@ -6,6 +6,7 @@ import { tryToDispatchKoliBriEvent } from '../../utils/events'; import { setState } from '../../utils/prop.validators'; import DetailsAnimationController from './DetailsAnimationController'; import { API, EventCallbacks, States } from './types'; +import { propagateFocus } from '../../utils/reuse'; /** * @slot - Der Inhalt, der in der Detailbeschreibung angezeigt wird. @@ -23,6 +24,11 @@ export class KolDetails implements API { private summaryElement?: HTMLElement; private contentElement?: HTMLElement; + private readonly catchRef = (ref?: HTMLElement) => { + this.summaryElement = ref; + propagateFocus(this.host, this.summaryElement); + }; + public render(): JSX.Element { return ( @@ -32,11 +38,11 @@ export class KolDetails implements API { }} onToggle={this.handleToggle} > - (this.summaryElement = element)}> + {this.state._open ? : } {this.state._label} -
(this.contentElement = element)}> +
(this.contentElement = element)}> diff --git a/packages/components/src/components/details/style.css b/packages/components/src/components/details/style.css index 2bb69bdb4d..010e4b4997 100644 --- a/packages/components/src/components/details/style.css +++ b/packages/components/src/components/details/style.css @@ -17,6 +17,9 @@ details > summary:hover > span, details[open] > summary > span { border-bottom-color: #000; } +.content { + overflow: hidden; +} details > kol-indented-text { margin: 0.25em 0 0 0.5em; } diff --git a/packages/components/src/components/details/test/html.mock.ts b/packages/components/src/components/details/test/html.mock.ts index 54429a5dc7..44d93dde35 100644 --- a/packages/components/src/components/details/test/html.mock.ts +++ b/packages/components/src/components/details/test/html.mock.ts @@ -18,7 +18,7 @@ export const getDetailsHtml = ( ); return ` - +
${getIconHtml({ _label: '', @@ -28,7 +28,7 @@ export const getDetailsHtml = ( ${props._label! /* TODO v2: Remove non-null assertion after label was converted to required prop */} -
+
diff --git a/packages/components/src/components/image/style.css b/packages/components/src/components/image/style.css index 73aedac2e9..41767094a7 100644 --- a/packages/components/src/components/image/style.css +++ b/packages/components/src/components/image/style.css @@ -1,3 +1,6 @@ +:host { + display: inline-block; +} img { max-height: 100%; max-width: 100%; diff --git a/packages/components/src/components/input-checkbox/component.tsx b/packages/components/src/components/input-checkbox/component.tsx index 76ba26b050..a1cc030309 100644 --- a/packages/components/src/components/input-checkbox/component.tsx +++ b/packages/components/src/components/input-checkbox/component.tsx @@ -30,11 +30,9 @@ import { API, InputCheckboxIconsProp, InputCheckboxVariant, States } from './typ }) export class KolInputCheckbox implements API { @Element() private readonly host?: HTMLKolInputCheckboxElement; - private ref?: HTMLInputElement; private readonly catchRef = (ref?: HTMLInputElement) => { - this.ref = ref; - propagateFocus(this.host, this.ref); + propagateFocus(this.host, ref); }; public render(): JSX.Element { @@ -52,7 +50,7 @@ export class KolInputCheckbox implements API { }} data-role={this.state._variant === 'button' ? 'button' : undefined} onKeyPress={this.state._variant === 'button' ? this.onChange : undefined} - tabIndex={this.state._variant === 'button' ? 0 : undefined} + tabIndex={this.state._variant === 'button' && !this.state._disabled ? 0 : undefined} _alert={this.state._alert} _disabled={this.state._disabled} _error={this.state._error} diff --git a/packages/components/src/components/input-radio/component.tsx b/packages/components/src/components/input-radio/component.tsx index 2d6b74c18b..58ec49feed 100644 --- a/packages/components/src/components/input-radio/component.tsx +++ b/packages/components/src/components/input-radio/component.tsx @@ -31,11 +31,9 @@ import { API, States } from './types'; }) export class KolInputRadio implements API { @Element() private readonly host?: HTMLKolInputRadioElement; - private ref?: HTMLInputElement; private readonly catchRef = (ref?: HTMLInputElement) => { - this.ref = ref; - propagateFocus(this.host, this.ref); + propagateFocus(this.host, ref); }; public render(): JSX.Element { diff --git a/packages/components/src/components/link-button/component.tsx b/packages/components/src/components/link-button/component.tsx index 4925cc503a..06322f8766 100644 --- a/packages/components/src/components/link-button/component.tsx +++ b/packages/components/src/components/link-button/component.tsx @@ -24,11 +24,9 @@ import { Props } from './types'; }) export class KolLinkButton implements Props { @Element() private readonly host?: HTMLKolLinkButtonElement; - private ref?: HTMLKolLinkWcElement; private readonly catchRef = (ref?: HTMLKolLinkWcElement) => { - this.ref = ref; - propagateFocus(this.host, this.ref); + propagateFocus(this.host, ref); }; public render(): JSX.Element { diff --git a/packages/components/src/components/link/readme.md b/packages/components/src/components/link/readme.md index d08739e564..49fc1cd5fe 100644 --- a/packages/components/src/components/link/readme.md +++ b/packages/components/src/components/link/readme.md @@ -33,22 +33,18 @@ Eingabe von Leerzeichen eingefügt werden. Zusätzliche Leerzeichen vergrößern ### Link innerhalb eines Fließtextes mit Icon und Text -

- Ich bin ein Link mit Icon links
- - Ich bin ein Link mit Icon rechts - - Lorem, ipsum dolor sit amet consectetur adipisicing elit. Ea optio deleniti fuga quos molestias, voluptate nobis - nemo, incidunt excepturi facilis, amet ducimus minus quae corporis eligendi cum distinctio. Fugit, repellendus. - Ich bin ein Link mit Icon links. Lorem, ipsum dolor sit amet consectetur adipisicing - elit. Ea optio deleniti fuga quos molestias, voluptate nobis nemo, incidunt excepturi - Ich bin ein Link mit Icon rechts - - facilis, amet ducimus minus quae corporis eligendi cum distinctio. Fugit, repellendus. -

+

+ Ich bin ein Link mit Icon links
+ + Ich bin ein Link mit Icon rechts + + Lorem, ipsum dolor sit amet consectetur adipisicing elit. Ea optio deleniti fuga quos molestias, voluptate nobis + nemo, incidunt excepturi facilis, amet ducimus minus quae corporis eligendi cum distinctio. Fugit, repellendus. + Ich bin ein Link mit Icon links. Lorem, ipsum dolor sit amet consectetur adipisicing + elit. Ea optio deleniti fuga quos molestias, voluptate nobis nemo, incidunt excepturi + Ich bin ein Link mit Icon rechts + facilis, amet ducimus minus quae corporis eligendi cum distinctio. Fugit, repellendus. +

- -## Methods - -### `enqueue(toast: Toast) => Promise` - -#### Returns - -Type: `Promise` - -## Dependencies - -### Depends on - -- [kol-button](../button) -- [kol-toast](../toast) - -### Graph - -```mermaid -graph TD; - kol-toast-container --> kol-button - kol-toast-container --> kol-toast - kol-button --> kol-button-wc - kol-button-wc --> kol-span-wc - kol-button-wc --> kol-tooltip-wc - kol-span-wc --> kol-icon - kol-tooltip-wc --> kol-span-wc - kol-toast --> kol-alert - kol-alert --> kol-alert-wc - kol-alert-wc --> kol-heading-wc - kol-alert-wc --> kol-button-wc - kol-alert-wc --> kol-icon - style kol-toast-container fill:#f9f,stroke:#333,stroke-width:4px -``` - ---- diff --git a/packages/components/src/components/toast-container/style.css b/packages/components/src/components/toast-container/style.css deleted file mode 100644 index dddae75d3c..0000000000 --- a/packages/components/src/components/toast-container/style.css +++ /dev/null @@ -1,9 +0,0 @@ -:host { - display: flex; - flex-direction: column; - position: fixed; - z-index: 200; -} -.close-all { - align-self: flex-end; -} diff --git a/packages/components/src/components/toast/component.tsx b/packages/components/src/components/toast/component.tsx index 1e8c94ced5..02bbe8558a 100644 --- a/packages/components/src/components/toast/component.tsx +++ b/packages/components/src/components/toast/component.tsx @@ -1,37 +1,69 @@ -import { Component, h, JSX, Prop, State, Watch } from '@stencil/core'; +import { Component, h, Host, JSX, Prop, State, Watch } from '@stencil/core'; +import { HeadingLevel } from '../../types/heading-level'; +import { HasCloserPropType, validateHasCloser } from '../../types/props/has-closer'; import { LabelPropType, validateLabel } from '../../types/props/label'; +import { ShowPropType, validateShow } from '../../types/props/show'; import { KoliBriToastEventCallbacks } from '../../types/toast'; -import { setState, watchValidator } from '../../utils/prop.validators'; +import { setState, watchBoolean, watchNumber, watchValidator } from '../../utils/prop.validators'; import { AlertType } from '../alert/types'; -import { ToastStatus, toastStatusOptions } from '../toast-container/types'; +import { watchHeadingLevel } from '../heading/validation'; import { API, States } from './types'; /** * @slot - Der Inhalt der Meldung. + * @deprecated - Use ToastService - see toaster */ @Component({ tag: 'kol-toast', - shadow: true, styleUrls: { default: './style.css', }, + shadow: true, }) export class KolToast implements API { + /** + * Defines whether the screen-readers should read out the notification. + */ + @Prop() public _alert?: boolean = true; + + /** + * Defines whether the element can be closed. + * @TODO: Change type back to `HasCloserPropType` after Stencil#4663 has been resolved. + */ + @Prop() public _hasCloser?: boolean = false; + + /** + * Deprecated: Gibt die Beschriftung der Komponente an. + * @deprecated Use _label. + */ + @Prop() public _heading?: string = ''; + /** * Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). */ - @Prop() public _label!: LabelPropType; + @Prop() public _label?: LabelPropType; + + /** + * Defines which H-level from 1-6 the heading has. 0 specifies no heading and is shown as bold text. + */ + @Prop() public _level?: HeadingLevel = 1; /** - * Defines the event callback functions for the component. + * Gibt die EventCallback-Function für das Schließen des Toasts an. */ @Prop() public _on?: KoliBriToastEventCallbacks; /** - * Defines the current toast status. + * Makes the element show up. + * @TODO: Change type back to `ShowPropType` after Stencil#4663 has been resolved. */ - @Prop() public _status!: ToastStatus; + @Prop({ mutable: true, reflect: true }) public _show?: boolean = true; + + /** + * Gibt an, wie viele Millisekunden der Toast eingeblendet werden soll. + */ + @Prop() public _showDuration?: number = 10000; /** * Defines either the type of the component or of the components interactive element. @@ -39,15 +71,36 @@ export class KolToast implements API { @Prop() public _type?: AlertType = 'default'; @State() public state: States = { - _label: '...', - _status: 'adding', + _alert: true, + _level: 1, + _show: true, }; + @Watch('_alert') + public validateAlert(value?: boolean): void { + watchBoolean(this, '_alert', value); + } + + @Watch('_hasCloser') + public validateHasCloser(value?: HasCloserPropType): void { + validateHasCloser(this, value); + } + + @Watch('_heading') + public validateHeading(value?: string): void { + this.validateLabel(value); + } + @Watch('_label') public validateLabel(value?: LabelPropType): void { validateLabel(this, value); } + @Watch('_level') + public validateLevel(value?: HeadingLevel): void { + watchHeadingLevel(this, value); + } + @Watch('_on') public validateOn(value?: KoliBriToastEventCallbacks): void { if (typeof value === 'object' && (typeof value?.onClose === 'function' || value.onClose === true)) { @@ -55,15 +108,18 @@ export class KolToast implements API { } } - @Watch('_status') - public validateStatus(status?: ToastStatus): void { - watchValidator( - this, - '_status', - (status) => typeof status === 'string' && toastStatusOptions.includes(status), - new Set('String {adding, settled, removing}'), - status - ); + @Watch('_show') + public validateShow(value?: ShowPropType): void { + validateShow(this, value, { hooks: { afterPatch: this.handleShowAndDuration } }); + } + + @Watch('_showDuration') + public validateShowDuration(value?: number): void { + watchNumber(this, '_showDuration', value, { + hooks: { + afterPatch: this.handleShowAndDuration, + }, + }); } @Watch('_type') @@ -78,13 +134,34 @@ export class KolToast implements API { } public componentWillLoad(): void { - this.validateLabel(this._label); + this.validateAlert(this._alert); + this.validateHasCloser(this._hasCloser); + this.validateLabel(this._label || this._heading); + this.validateLevel(this._level); this.validateOn(this._on); - this.validateStatus(this._status); + this.validateShow(this._show); + this.validateShowDuration(this._showDuration); this.validateType(this._type); } + private durationTimeout?: number; + + private readonly handleShowAndDuration = () => { + if (this.state._show === true && typeof this.state._showDuration === 'number' && this.state._showDuration >= 0) { + clearTimeout(this.durationTimeout); + this.durationTimeout = setTimeout(() => { + this.close(); + }, this.state._showDuration) as unknown as number; + } + }; + private readonly close = () => { + this._show = false; + this.state = { + ...this.state, + _show: false, + }; + if (this._on?.onClose !== undefined) { this._on.onClose(new Event('Close')); } @@ -96,11 +173,24 @@ export class KolToast implements API { public render(): JSX.Element { return ( -
- - - -
+ + {this.state._show && ( +
+ + + +
+ )} +
); } } diff --git a/packages/components/src/components/toast/readme.md b/packages/components/src/components/toast/readme.md index 989a6c18db..528eaa159d 100644 --- a/packages/components/src/components/toast/readme.md +++ b/packages/components/src/components/toast/readme.md @@ -1,27 +1,24 @@ # Toast -Mit der **Toast**-Komponente geben Sie ein optisches Feedback an die Nutzer:innen. Sie wird am Kopf des Browserfenster -angezeigt, bis sie geschlossen wird. Werden mehrere Toasts geöffnet, ohne das die bisherigen geschlossen wurden, so werden diese untereinander angezeigt. +Mit der **Toast**-Komponente geben Sie ein optisches Feedback an die Nutzer:innen. Sie wird nur für einen kurzen Zeitraum am Kopf des Browserfenster angezeigt und verschwindet danach automatisch. -## Konstruktion +Ein **Toast** wird nach dem Laden der Webseite am oberen Rand des Browserfenster für zehn Sekunden angezeigt. Mit Ausblenden des **Toasts** wird dieser automatisch aus dem DOM entfernt. Wird er erneut benötigt, muss er z.B. über eine JavaScript-Funktion nachgeladen werden. -Die Toast-Komponente wird nicht direkt verwendet, sondern immer über den ToasterService konstruiert. +## Konstruktion ### Code -```js -import { ToasterService } from '@public-ui/components'; +```html +Hier wird der Erfolg näher beschrieben. +Hier wird der Erfolg näher beschrieben. +``` -// Get the toaster instance for the current HTML document. -const toaster = ToasterService.getInstance(document); +### Beispiel -// Enqueue a new toast to the toaster to display: -toaster.enqueue({ - label: 'This is the title', - description: 'Magna eu sit adipisicing cillum amet esse in aute quis in dolore.', - type: 'info', -}); -``` +
+ Hier wird der Erfolg näher beschrieben. + Hier wird der Erfolg näher beschrieben. +
## Verwendung @@ -29,9 +26,17 @@ toaster.enqueue({ Verwenden Sie das Attribut **`_label`**, um die Überschrift des Toasts zu bestimmen. -### Inhalt +### Größe der Überschrift + +Verwenden Sie das Attribut **`_level`**, um die Überschriftenebene zu setzen. + +### Anzeigen des Toasts + +Verwenden Sie das Attribut **`_show`**, um den Toast manuell anzuzeigen. -Verwenden Sie das Attribut **`_description`**, um den Text-Inhalt des Toasts zu bestimmen. +### Anzeigedauer des Toast + +Verwenden Sie das Attribut **`_showDuration`**, um die Anzeigedauer des Toasts festzulegen. ### Anzeigetyp des Toast @@ -43,16 +48,29 @@ Verwenden Sie das Attribut **`_type`**, um den Typ des Toasts festzulegen. Mögl - `success` - `warning` + + +## Barrierefreiheit + +> **[DEPRECATED]** - Use ToastService - see toaster + ## Properties -| Property | Attribute | Description | Type | Default | -| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- | ----------- | -| `_label` _(required)_ | `_label` | Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). | `string` | `undefined` | -| `_on` | -- | Defines the event callback functions for the component. | `undefined \| { onClose?: EventCallback \| undefined; }` | `undefined` | -| `_status` _(required)_ | `_status` | Defines the current toast status. | `"adding" \| "removing" \| "settled"` | `undefined` | -| `_type` | `_type` | Defines either the type of the component or of the components interactive element. | `"default" \| "error" \| "info" \| "success" \| "warning" \| undefined` | `'default'` | +| Property | Attribute | Description | Type | Default | +| --------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------- | +| `_alert` | `_alert` | Defines whether the screen-readers should read out the notification. | `boolean \| undefined` | `true` | +| `_hasCloser` | `_has-closer` | Defines whether the element can be closed. | `boolean \| undefined` | `false` | +| `_heading` | `_heading` | **[DEPRECATED]** Use \_label.

Deprecated: Gibt die Beschriftung der Komponente an. | `string \| undefined` | `''` | +| `_label` | `_label` | Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). | `string \| undefined` | `undefined` | +| `_level` | `_level` | Defines which H-level from 1-6 the heading has. 0 specifies no heading and is shown as bold text. | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| undefined` | `1` | +| `_on` | -- | Gibt die EventCallback-Function für das Schließen des Toasts an. | `undefined \| { onClose?: EventCallback \| undefined; }` | `undefined` | +| `_show` | `_show` | Makes the element show up. | `boolean \| undefined` | `true` | +| `_showDuration` | `_show-duration` | Gibt an, wie viele Millisekunden der Toast eingeblendet werden soll. | `number \| undefined` | `10000` | +| `_type` | `_type` | Defines either the type of the component or of the components interactive element. | `"default" \| "error" \| "info" \| "success" \| "warning" \| undefined` | `'default'` | ## Slots @@ -62,10 +80,6 @@ Verwenden Sie das Attribut **`_type`**, um den Typ des Toasts festzulegen. Mögl ## Dependencies -### Used by - -- [kol-toast-container](../toast-container) - ### Depends on - [kol-alert](../alert) @@ -83,7 +97,6 @@ graph TD; kol-button-wc --> kol-tooltip-wc kol-span-wc --> kol-icon kol-tooltip-wc --> kol-span-wc - kol-toast-container --> kol-toast style kol-toast fill:#f9f,stroke:#333,stroke-width:4px ``` diff --git a/packages/components/src/components/toast/style.css b/packages/components/src/components/toast/style.css index 24668ade8d..f04c4a8c80 100644 --- a/packages/components/src/components/toast/style.css +++ b/packages/components/src/components/toast/style.css @@ -1 +1,24 @@ -/* Placeholder file to allow theme styles to be applied. */ +@import url(../style.css); +@import url(../host-display-block.css); +:host > div { + background-color: #fff; + /* needed for overlay situations */ + height: 0; + left: 0; + position: fixed; + top: 0; + width: 100%; + z-index: 200; +} +:host > div > kol-alert { + display: block; + margin: auto; + max-width: 750px; +} +:host > div > kol-button-wc { + display: block; + margin: auto; + position: relative; + top: 0; + width: 1em; +} diff --git a/packages/components/src/components/toast/test/html.mock.ts b/packages/components/src/components/toast/test/html.mock.ts index e489679086..e24eaef093 100644 --- a/packages/components/src/components/toast/test/html.mock.ts +++ b/packages/components/src/components/toast/test/html.mock.ts @@ -1,24 +1,37 @@ import { mixMembers } from 'stencil-awesome-test'; -import { Props, States } from '../types'; +import { getAlertHtml } from '../../alert/test/html.mock'; +import { Props } from '../types'; export const getToastHtml = (props: Props): string => { - const state = mixMembers( + props = mixMembers( { - _label: '...', - _status: 'adding', - _type: 'default', + _alert: true, + _level: 1, + _show: true, }, props ); return ` - - -
- - - -
-
+ + + ${ + props._show === true + ? `
+ ${getAlertHtml( + { + _alert: props._alert, + _label: props._label, + _level: props._level, + _type: props._type, + _variant: 'card', + }, + '' + // ' tabindex="0"' + )} +
` + : '' + } +
`; }; diff --git a/packages/components/src/components/toast/test/snapshot.spec.tsx b/packages/components/src/components/toast/test/snapshot.spec.tsx index 9ded42fbf9..bb5c70f0a7 100644 --- a/packages/components/src/components/toast/test/snapshot.spec.tsx +++ b/packages/components/src/components/toast/test/snapshot.spec.tsx @@ -3,7 +3,7 @@ import { executeTests } from 'stencil-awesome-test'; import { h } from '@stencil/core'; import { newSpecPage, SpecPage } from '@stencil/core/testing'; -import { KolToast } from '../component'; +import { COMPONENTS } from '../../component-list'; import { Props } from '../types'; import { getToastHtml } from './html.mock'; @@ -11,15 +11,17 @@ executeTests( 'Toast', async (props): Promise => { const page = await newSpecPage({ - components: [KolToast], // Use the stubbed version of child components to work around https://github.com/ionic-team/stencil/issues/3220 + components: COMPONENTS, template: () => , }); return page; }, { + _alert: [false, true], _label: ['Überschrift'], + _level: [1, 2, 3, 4, 5, 6], + _show: [false, true], _type: ['default', 'error', 'info', 'success', 'warning'], - _status: ['adding', 'settled', 'removing'], }, getToastHtml, { diff --git a/packages/components/src/components/toast/toaster.tsx b/packages/components/src/components/toast/toaster.tsx index f44c8d6f18..ed5e8ff78a 100644 --- a/packages/components/src/components/toast/toaster.tsx +++ b/packages/components/src/components/toast/toaster.tsx @@ -1,13 +1,48 @@ -import { Toast } from '../toast-container/types'; +import { LabelPropType } from '../../types/props/label'; +import { AlertType } from '../alert/types'; +type Toast = { + description: string; + /** + * @deprecated Use label. + */ + heading?: string; + label?: LabelPropType; + type: AlertType; +}; + +/** + * @deprecated Use toast/toaster.tsx + */ export class ToasterService { private static readonly instances: Map = new Map(); - private toastContainerElement?: HTMLKolToastContainerElement; + private toastElement?: HTMLKolToastElement; + + private readonly queue: Set = new Set(); + + private isOpen = false; private constructor(private readonly document: Document) { - this.toastContainerElement = this.document.createElement('kol-toast-container'); - this.document.body.prepend(this.toastContainerElement); + this.toastElement = this.document.createElement('kol-toast'); + this.toastElement.setAttribute('_level', '0'); + this.toastElement.setAttribute('_show', 'false'); + this.toastElement.setAttribute('_show-duration', '-1'); // @deprecated in v2 + this.toastElement.setAttribute('_has-closer', 'true'); + this.toastElement._on = { + onClose: () => { + const next = this.queue.values().next(); + if (next.value) { + this.queue.delete(next.value as Toast); + setTimeout(() => { + this.showToast(next.value as Toast); + }, 200); + } else { + this.isOpen = false; + } + }, + }; + this.document.body.insertBefore(this.toastElement, this.document.body.firstChild); } /** @@ -23,16 +58,48 @@ export class ToasterService { } public dispose() { - const element = this.toastContainerElement; + const element = this.toastElement; if (element) { - this.toastContainerElement = undefined; + this.toastElement = undefined; + this.queue.clear(); element.remove(); + + const on = element._on; + if (on && on.onClose) { + on.onClose(new Event('dispose')); + } } else { console.warn('Toaster service is already disposed.'); } } - public async enqueue(toast: Toast) { - await this.toastContainerElement?.enqueue(toast); + /** + * Reiht einen neuen Toast in die Warteschlange ein, um ihn anzuzeigen. + */ + public enqueue(data: Toast): void { + if (this.isOpen) { + this.queue.add(data); + } else { + this.showToast(data); + } + } + + private showToast(data: Toast): void { + const label = data.label || data.heading; + + if (typeof label === 'undefined') { + // TODO v2: Make label required, remove this check. + throw new Error('Toast requires a label.'); + } + + if (!this.toastElement) { + console.warn('Tried to show a new toast at a disposed toaster service!'); + return; + } + this.toastElement.setAttribute('_label', label); + this.toastElement.setAttribute('_show', 'true'); + this.toastElement.setAttribute('_type', data.type); + this.toastElement.innerText = data.description; + this.isOpen = true; } } diff --git a/packages/components/src/components/toast/types.ts b/packages/components/src/components/toast/types.ts index 7fa687e9c8..cfd5064940 100644 --- a/packages/components/src/components/toast/types.ts +++ b/packages/components/src/components/toast/types.ts @@ -1,17 +1,26 @@ import { Generic } from '@a11y-ui/core'; +import { HeadingLevel } from '../../types/heading-level'; +import { PropHasCloser } from '../../types/props/has-closer'; import { PropLabel } from '../../types/props/label'; +import { PropShow } from '../../types/props/show'; import { KoliBriToastEventCallbacks } from '../../types/toast'; import { AlertType } from '../alert/types'; -import { ToastStatus } from '../toast-container/types'; -type RequiredProps = PropLabel & { - status: ToastStatus; -}; +type RequiredProps = NonNullable; type OptionalProps = { + alert: boolean; + /** + * @deprecated Use label. + */ + heading: string; + level: HeadingLevel; on: KoliBriToastEventCallbacks; + showDuration: number; type: AlertType; -}; +} & PropHasCloser & + PropShow & + PropLabel; export type Props = Generic.Element.Members; type RequiredStates = RequiredProps; diff --git a/packages/components/src/components/toaster/InternalToast.tsx b/packages/components/src/components/toaster/InternalToast.tsx new file mode 100644 index 0000000000..f8c0cac474 --- /dev/null +++ b/packages/components/src/components/toaster/InternalToast.tsx @@ -0,0 +1,32 @@ +import { h } from '@stencil/core'; +import { ToastState } from './types'; + +type Props = { + toastState: ToastState; + onClose: () => void; + key: string; +}; +export const InternalToast = ({ toastState, onClose, key }: Props) => { + const handleRef = (element?: HTMLDivElement) => { + if (typeof toastState.toast.render === 'function' && element) { + toastState.toast.render(element, { close: () => onClose() }); + } + }; + + return ( +
+ +
{typeof toastState.toast.description === 'string' ? toastState.toast.description : null}
+
+
+ ); +}; diff --git a/packages/components/src/components/toast-container/component.tsx b/packages/components/src/components/toaster/component.tsx similarity index 73% rename from packages/components/src/components/toast-container/component.tsx rename to packages/components/src/components/toaster/component.tsx index 9e823dc50a..6f7a673d5a 100644 --- a/packages/components/src/components/toast-container/component.tsx +++ b/packages/components/src/components/toaster/component.tsx @@ -3,6 +3,7 @@ import { Component, Fragment, h, JSX, Method, State } from '@stencil/core'; import { translate } from '../../i18n'; import { nonce } from '../../utils/dev.utils'; import { API, States, Toast, ToastState } from './types'; +import { InternalToast } from './InternalToast'; const TRANSITION_TIMEOUT = 300; @@ -21,7 +22,7 @@ export class KolToastContainer implements API { // Stencil requires async function: // eslint-disable-next-line @typescript-eslint/require-await @Method() - async enqueue(toast: Toast) { + public async enqueue(toast: Toast) { const newToastState: ToastState = { toast, status: 'adding', @@ -36,7 +37,7 @@ export class KolToastContainer implements API { this.state = { ...this.state, _toastStates: this.state._toastStates.map((localToastState) => - localToastState === newToastState + localToastState.id === newToastState.id ? { ...localToastState, status: 'settled', @@ -45,13 +46,17 @@ export class KolToastContainer implements API { ), }; }, TRANSITION_TIMEOUT); + + return () => { + this.handleClose(newToastState); + }; } private handleClose(toastState: ToastState) { this.state = { ...this.state, _toastStates: this.state._toastStates.map((localToastState) => { - if (localToastState === toastState) { + if (localToastState.id === toastState.id) { localToastState.status = 'removing'; } return localToastState; @@ -61,12 +66,14 @@ export class KolToastContainer implements API { setTimeout(() => { this.state = { ...this.state, - _toastStates: this.state._toastStates.filter((localToastState) => localToastState !== toastState), + _toastStates: this.state._toastStates.filter((localToastState) => localToastState.id !== toastState.id), }; }, TRANSITION_TIMEOUT); } - private handleCloseAllClick() { + // eslint-disable-next-line @typescript-eslint/require-await + @Method() + public async closeAll() { this.state = { ...this.state, _toastStates: this.state._toastStates.map((localToastState) => ({ @@ -87,18 +94,18 @@ export class KolToastContainer implements API { return ( {this.state._toastStates.length > 1 && ( - + { + void this.closeAll(); + }, + }} + > )} {this.state._toastStates.map((toastState) => ( - this.handleClose(toastState) }} - key={toastState.id} - > - {toastState.toast.description} - + this.handleClose(toastState)} key={toastState.id} /> ))} ); diff --git a/packages/components/src/components/toaster/readme.md b/packages/components/src/components/toaster/readme.md new file mode 100644 index 0000000000..d62cf3e6a4 --- /dev/null +++ b/packages/components/src/components/toaster/readme.md @@ -0,0 +1,109 @@ +# Toaster + +Mit dem **Toast**-Service geben Sie ein optisches Feedback an die Nutzer:innen. Sie wird am Kopf des Browserfenster +angezeigt, bis sie geschlossen wird. Werden mehrere Toasts geöffnet, ohne das die bisherigen geschlossen wurden, so werden diese untereinander angezeigt. + +## Konstruktion + +Die Toast-Komponenten werden nicht direkt verwendet, sondern immer über den ToasterService konstruiert. + +### Code + +```js +import { ToasterService } from '@public-ui/components'; + +// Get the toaster instance for the current HTML document. +const toaster = ToasterService.getInstance(document); + +// Enqueue a new toast to the toaster to display: +toaster.enqueue({ + label: 'This is the title', + description: 'Magna eu sit adipisicing cillum amet esse in aute quis in dolore.', + type: 'info', +}); +``` + +### Weitere Service-Methoden + +- `closeAll`: Schließt alle Toasts +- `dispose`: Entfernt den Toast Container. Die Toaster-Instanz kann nicht weiter genutzt werden. + +## Verwendung + +### Überschrift + +Verwenden Sie das Attribut **`_label`**, um die Überschrift des Toasts zu bestimmen. + +### Inhalt + +Verwenden Sie das Attribut **`_description`**, um den Text-Inhalt des Toasts zu bestimmen. + +Alternativ zur statischen Description können Sie über das Attribut **`_render`** eine eigene Render-Funktion definieren. Diese wird mit einer Referenz zum +HTMLElement der Toast-Komponente aufgerufen. Zudem wird auch ein Objekt übergeben, das eine `close`-Funktion zum Schließen des Toasts bereitstellt. + +```ts +const closeToast = toaster.enqueue({ + render: (element: HTMLElement, { close }) => { + element.textContent = 'Mein Inhalt'; + const customCloseButton = document.createElement('button'); + customCloseButton.textContent = 'Toast schließen'; + element.appendChild(customCloseButton); + customCloseButton.addEventListener('click', close, { once: true }); + }, +}); + +/* Optional: Toast wieder schließen mit `closeToast()` */ +``` + +### Anzeigetyp des Toast + +Verwenden Sie das Attribut **`_type`**, um den Typ des Toasts festzulegen. Mögliche Werte sind: + +- `default` +- `error` +- `info` +- `success` +- `warning` + + + +## Methods + +### `closeAll() => Promise` + +#### Returns + +Type: `Promise` + +### `enqueue(toast: Toast) => Promise<() => void>` + +#### Returns + +Type: `Promise<() => void>` + +## Dependencies + +### Depends on + +- [kol-button](../button) +- [kol-alert](../alert) + +### Graph + +```mermaid +graph TD; + kol-toast-container --> kol-button + kol-toast-container --> kol-alert + kol-button --> kol-button-wc + kol-button-wc --> kol-span-wc + kol-button-wc --> kol-tooltip-wc + kol-span-wc --> kol-icon + kol-tooltip-wc --> kol-span-wc + kol-alert --> kol-alert-wc + kol-alert-wc --> kol-heading-wc + kol-alert-wc --> kol-button-wc + kol-alert-wc --> kol-icon + style kol-toast-container fill:#f9f,stroke:#333,stroke-width:4px +``` + +--- diff --git a/packages/components/src/components/toaster/style.css b/packages/components/src/components/toaster/style.css new file mode 100644 index 0000000000..1f285155bf --- /dev/null +++ b/packages/components/src/components/toaster/style.css @@ -0,0 +1,12 @@ +@layer kol-component { + :host { + display: flex; + flex-direction: column; + position: fixed; + z-index: 200; + } + + .close-all { + align-self: flex-end; + } +} diff --git a/packages/components/src/components/toaster/toaster.tsx b/packages/components/src/components/toaster/toaster.tsx new file mode 100644 index 0000000000..4082d20a63 --- /dev/null +++ b/packages/components/src/components/toaster/toaster.tsx @@ -0,0 +1,50 @@ +import { Toast } from './types'; + +export class ToasterService { + private static readonly instances: Map = new Map(); + + private toastContainerElement?: HTMLKolToastContainerElement; + + private constructor(private readonly document: Document) { + this.toastContainerElement = this.document.createElement('kol-toast-container'); + this.document.body.prepend(this.toastContainerElement); + } + + /** + * Get a toaster for the specified document environment. Each environment has exactly one instance of the service. + */ + public static getInstance(document: Document) { + let instance = this.instances.get(document); + if (!instance) { + instance = new ToasterService(document); + this.instances.set(document, instance); + } + return instance; + } + + public dispose() { + const element = this.toastContainerElement; + if (element) { + this.toastContainerElement = undefined; + element.remove(); + } else { + console.warn('Toaster service is already disposed.'); + } + } + + public enqueue(toast: Toast): Promise<() => void> | undefined { + /** + * We need this condition for SSR. The toast container is not rendered on the server, + * so we can't enqueue toasts. + */ + if (this.toastContainerElement && typeof this.toastContainerElement.enqueue === 'function') { + return this.toastContainerElement.enqueue(toast); + } + } + + public closeAll(): void { + if (this.toastContainerElement && typeof this.toastContainerElement.closeAll === 'function') { + void this.toastContainerElement.closeAll(); + } + } +} diff --git a/packages/components/src/components/toast-container/types.ts b/packages/components/src/components/toaster/types.ts similarity index 75% rename from packages/components/src/components/toast-container/types.ts rename to packages/components/src/components/toaster/types.ts index f08d5035ca..55d01d822b 100644 --- a/packages/components/src/components/toast-container/types.ts +++ b/packages/components/src/components/toaster/types.ts @@ -3,11 +3,12 @@ import { Generic } from '@a11y-ui/core'; import { LabelPropType } from '../../types/props/label'; import { AlertType } from '../alert/types'; -export const toastStatusOptions = ['adding', 'settled', 'removing'] as const; -export type ToastStatus = (typeof toastStatusOptions)[number]; +const toastStatusOptions = ['adding', 'settled', 'removing'] as const; +type ToastStatus = (typeof toastStatusOptions)[number]; export type Toast = { - description: string; + description?: string; + render?: (nodeRef: HTMLElement, options: { close: () => void }) => void; label: LabelPropType; type: AlertType; }; diff --git a/packages/components/src/index.html b/packages/components/src/index.html index 54c45451f1..339e4e5dc4 100644 --- a/packages/components/src/index.html +++ b/packages/components/src/index.html @@ -81,10 +81,10 @@ _variant="normal" :_on="{ onClick: ()=> showLogin = !showLogin }" > - + Benutzername Passwort - + @@ -238,7 +238,7 @@
- +
@@ -1534,18 +1534,18 @@
- Ich bin oberhalb + Ich bin oberhalb - Ich bin rechts + Ich bin rechts - Ich bin unterhalb + Ich bin unterhalb - Ich bin links + Ich bin links - + Benutzername Passwort - +
@@ -2188,8 +2188,8 @@
- - + +
diff --git a/packages/components/src/index.ts b/packages/components/src/index.ts index 9c46e8a7a7..cd347dc5d2 100644 --- a/packages/components/src/index.ts +++ b/packages/components/src/index.ts @@ -3,7 +3,8 @@ export { register } from './core'; export * from './enums/bund'; export { translations } from './i18n'; export * from './kolibri'; -export { ToasterService } from './components/toast/toaster'; +export { ToasterService as ToasterServiceLegacy } from './components/toast/toaster'; +export { ToasterService } from './components/toaster/toaster'; export { Optgroup, Option, SelectOption } from './types/input/types'; export { configKoliBri } from './utils/dev.utils'; export { KoliBriDevHelper } from './utils/prop.validators'; diff --git a/packages/components/src/utils/dev.utils.ts b/packages/components/src/utils/dev.utils.ts index 25b7ca9f4b..aa3a7724ef 100644 --- a/packages/components/src/utils/dev.utils.ts +++ b/packages/components/src/utils/dev.utils.ts @@ -134,7 +134,7 @@ export const initKoliBri = (): void => { | . ' | .-. | | | ,--. | .-. \\ | .--' ,--. | |\\ \\ | '-' | | | | | | '--' / | | | | \`--' \`--´ \`---´ \`--' \`--' \`------´ \`--' \`--' - 🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io | 1.7.2 + 🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io | 1.7.6-rc.1 `, { forceLog: true, diff --git a/packages/components/stencil.config.ts b/packages/components/stencil.config.ts index 1409398b36..06a2b6a4d6 100644 --- a/packages/components/stencil.config.ts +++ b/packages/components/stencil.config.ts @@ -46,7 +46,6 @@ const TAGS = [ 'kol-modal', 'kol-nav', 'kol-pagination', - 'kol-popover', 'kol-progress', 'kol-quote', 'kol-select', @@ -63,8 +62,8 @@ const TAGS = [ ]; const EXCLUDE_TAGS = [ 'kol-alert-wc', - 'kol-avatar-wc', 'kol-all', + 'kol-avatar-wc', 'kol-button-group-wc', 'kol-button-link-text-switch', 'kol-button-wc', @@ -74,6 +73,7 @@ const EXCLUDE_TAGS = [ 'kol-input', 'kol-input-radio-group', 'kol-link-wc', + 'kol-popover-wc', 'kol-span-wc', 'kol-tooltip-wc', ]; diff --git a/packages/core/package.json b/packages/core/package.json index 9191073b8c..62591d8840 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@public-ui/core", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -51,16 +51,16 @@ "prepack": "unbuild" }, "dependencies": { - "@public-ui/components": "1.7.2" + "@public-ui/components": "1.7.6-rc.1" }, "devDependencies": { - "@a11y-ui/core": "1.0.7", + "@a11y-ui/core": "1.1.0", "@types/node": "ts5.1", - "@typescript-eslint/eslint-plugin": "6.4.1", - "@typescript-eslint/parser": "6.4.1", - "eslint": "8.47.0", + "@typescript-eslint/eslint-plugin": "6.10.0", + "@typescript-eslint/parser": "6.10.0", + "eslint": "8.53.0", "eslint-plugin-no-loops": "0.3.0", - "prettier": "3.0.2", + "prettier": "3.0.3", "ts-prune": "0.10.3", "typescript": "5.2.2", "unbuild": "1.2.1" diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 3d044ad45c..ee343928c6 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,7 +1,7 @@ import { register } from '@public-ui/components'; console.debug( - `The register functions has been moved to the @public-ui/components package and thus the @public-ui/core package is deprecated. Now you can import the register function directly from the @public-ui/components package.` + `The register functions has been moved to the @public-ui/components package and thus the @public-ui/core package is deprecated. Now you can import the register function directly from the @public-ui/components package.`, ); /** diff --git a/packages/create-kolibri/defaults/.npmrc b/packages/create-kolibri/defaults/.npmrc index 300ab9b06b..8fdd3d2740 100644 --- a/packages/create-kolibri/defaults/.npmrc +++ b/packages/create-kolibri/defaults/.npmrc @@ -1,7 +1,9 @@ # - npm legacy-peer-deps=true +save-exact=true # - pnpm auto-install-peers=true +prefer-offline=true shamefully-hoist=true strict-peer-dependencies=false diff --git a/packages/create-kolibri/package.json b/packages/create-kolibri/package.json index 3295902f26..ce3a03c967 100644 --- a/packages/create-kolibri/package.json +++ b/packages/create-kolibri/package.json @@ -1,6 +1,6 @@ { "name": "create-kolibri", - "version": "1.7.2", + "version": "1.7.6-rc.1", "license": "EUPL-1.2", "homepage": "https://public-ui.github.io", "repository": "https://github.com/public-ui/kolibri", @@ -102,7 +102,7 @@ "devDependencies": { "@types/node": "ts5.1", "cross-env": "7.0.3", - "depcheck": "1.4.6", + "depcheck": "1.4.7", "prettier": "3.0.3", "rimraf": "3.0.2", "ts-node": "10.9.1", diff --git a/packages/create-kolibri/templates/angular-app/package.json b/packages/create-kolibri/templates/angular-app/package.json index 6b28c0d064..62e06d6a6c 100644 --- a/packages/create-kolibri/templates/angular-app/package.json +++ b/packages/create-kolibri/templates/angular-app/package.json @@ -30,9 +30,9 @@ "@angular/forms": "16.2.2", "@angular/platform-browser": "16.2.2", "@angular/platform-browser-dynamic": "16.2.2", - "@public-ui/angular-v16": "1.7.2", - "@public-ui/components": "1.7.2", - "@public-ui/themes": "1.7.2", + "@public-ui/angular-v16": "1.7.6-rc.1", + "@public-ui/components": "1.7.6-rc.1", + "@public-ui/themes": "1.7.6-rc.1", "zone.js": "0.13.1" }, "devDependencies": { @@ -41,7 +41,7 @@ "@leanup/stack": "1.3.44", "@leanup/stack-webpack": "1.3.44", "@ngtools/webpack": "16.2.0", - "chromedriver": "116.0.0", + "chromedriver": "119.0.1", "cpy-cli": "5.0.0", "nightwatch-axe-verbose": "2.2.2", "npm-check-updates": "16.13.1", diff --git a/packages/create-kolibri/templates/astro-app/package.json b/packages/create-kolibri/templates/astro-app/package.json index 7cc32f4953..6b464028b5 100644 --- a/packages/create-kolibri/templates/astro-app/package.json +++ b/packages/create-kolibri/templates/astro-app/package.json @@ -27,14 +27,14 @@ "@astrojs/react": "1.2.2", "@astrojs/preact": "1.2.0", "@leanup/stack": "1.3.39", - "@public-ui/components": "1.7.2", - "@public-ui/react": "1.7.2", - "@public-ui/themes": "1.7.2", + "@public-ui/components": "1.7.6-rc.1", + "@public-ui/react": "1.7.6-rc.1", + "@public-ui/themes": "1.7.6-rc.1", "@types/react": "18.0.26", "@types/node": "18.11.17", "@types/react-dom": "18.0.9", - "astro": "1.7.2", - "chromedriver": "116.0.0", + "astro": "1.7.4", + "chromedriver": "119.0.1", "cpy-cli": "5.0.0", "nightwatch-axe-verbose": "2.0.3", "npm-check-updates": "16.6.0", diff --git a/packages/create-kolibri/templates/astro-app/src/layouts/MainLayout.astro b/packages/create-kolibri/templates/astro-app/src/layouts/MainLayout.astro index f72276328f..7187ce636e 100644 --- a/packages/create-kolibri/templates/astro-app/src/layouts/MainLayout.astro +++ b/packages/create-kolibri/templates/astro-app/src/layouts/MainLayout.astro @@ -21,9 +21,9 @@ import Search from '../components/Search';