From 8b8355ed9ec5fb84dd18e9362589889e4d47364a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 13:31:20 +0000 Subject: [PATCH 1/9] chore(deps): update storybook monorepo to v8.3.6 --- package.json | 28 +++--- yarn.lock | 274 +++++++++++++++++++++++++-------------------------- 2 files changed, 151 insertions(+), 151 deletions(-) diff --git a/package.json b/package.json index be55b56236..f7075a6438 100644 --- a/package.json +++ b/package.json @@ -84,19 +84,19 @@ "@open-wc/lit-helpers": "0.7.0", "@open-wc/testing": "4.0.0", "@sbb-esta/lyne-design-tokens": "1.2.1", - "@storybook/addon-a11y": "8.3.5", - "@storybook/addon-actions": "8.3.5", - "@storybook/addon-essentials": "8.3.5", - "@storybook/addon-interactions": "8.3.5", - "@storybook/addon-links": "8.3.5", - "@storybook/blocks": "8.3.5", - "@storybook/manager-api": "8.3.5", - "@storybook/preview-api": "8.3.5", - "@storybook/test": "8.3.5", - "@storybook/theming": "8.3.5", - "@storybook/types": "8.3.5", - "@storybook/web-components": "8.3.5", - "@storybook/web-components-vite": "8.3.5", + "@storybook/addon-a11y": "8.3.6", + "@storybook/addon-actions": "8.3.6", + "@storybook/addon-essentials": "8.3.6", + "@storybook/addon-interactions": "8.3.6", + "@storybook/addon-links": "8.3.6", + "@storybook/blocks": "8.3.6", + "@storybook/manager-api": "8.3.6", + "@storybook/preview-api": "8.3.6", + "@storybook/test": "8.3.6", + "@storybook/theming": "8.3.6", + "@storybook/types": "8.3.6", + "@storybook/web-components": "8.3.6", + "@storybook/web-components-vite": "8.3.6", "@types/glob": "8.1.0", "@types/mocha": "10.0.9", "@types/node": "20.16.12", @@ -133,7 +133,7 @@ "rollup-plugin-postcss-lit": "2.1.0", "sass": "1.80.2", "sinon": "19.0.2", - "storybook": "8.3.5", + "storybook": "8.3.6", "stylelint": "16.10.0", "stylelint-config-prettier-scss": "1.0.0", "stylelint-config-standard-scss": "13.1.0", diff --git a/yarn.lock b/yarn.lock index 48a788096f..ef90774a5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1227,18 +1227,18 @@ resolved "https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.3.tgz#282046f03e886e352b2d5f5da5eb755e01457f3f" integrity sha512-DE427ROAphMQzU4ENbliGYrBSYPXF+TtLg9S8vzeA+OF4ZKzoDdzfL8sxuMUGS/lgRhM6j1URSk9ghf7Xo1tyA== -"@storybook/addon-a11y@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-a11y/-/addon-a11y-8.3.5.tgz#b40d519013961c87af8c1394253a2651d90793ae" - integrity sha512-/19UO8IXbyfcYK5K8ejSYF+hC+EK79c0bBPHMNeYSFOHSqQM3KoMo+TLIcLsuhuRClmlM+4Zs+VSIYDwc+d3ig== +"@storybook/addon-a11y@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-a11y/-/addon-a11y-8.3.6.tgz#4d4528718b378886b7f5602880162145f819abad" + integrity sha512-EeVzUN+WaLtz/DXVBL3rIGvP8+pTuJXA3lEz9CbTQXRO7QMhzTTXLKmp8xmSA2w5H01a8XpjLcZ5LYjdKrvw0g== dependencies: - "@storybook/addon-highlight" "8.3.5" + "@storybook/addon-highlight" "8.3.6" axe-core "^4.2.0" -"@storybook/addon-actions@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-8.3.5.tgz#03fdb891114439ed47cb7df6ef21826530449db7" - integrity sha512-t8D5oo+4XfD+F8091wLa2y/CDd/W2lExCeol5Vm1tp5saO+u6f2/d7iykLhTowWV84Uohi3D073uFeyTAlGebg== +"@storybook/addon-actions@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-8.3.6.tgz#80c5dbfc2278d72dc461a954bb729165ee1dfecb" + integrity sha512-nOqgl0WoZK2KwjaABaXMoIgrIHOQl9inOzJvqQau0HOtsvnXGXYfJXYnpjZenoZDoZXKbUDl0U2haDFx2a2fJw== dependencies: "@storybook/global" "^5.0.0" "@types/uuid" "^9.0.1" @@ -1246,35 +1246,35 @@ polished "^4.2.2" uuid "^9.0.0" -"@storybook/addon-backgrounds@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-backgrounds/-/addon-backgrounds-8.3.5.tgz#479ecb6181441e7f8429569bd7cefdb74058c12f" - integrity sha512-IQGjDujuw8+iSqKREdkL8I5E/5CAHZbfOWd4A75PQK2D6qZ0fu/xRwTOQOH4jP6xn/abvfACOdL6A0d5bU90ag== +"@storybook/addon-backgrounds@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-backgrounds/-/addon-backgrounds-8.3.6.tgz#81a92ca45e05858f3cee54ce33766de397abb324" + integrity sha512-yBn+a8i5OJzJaX6Bx5MAkfei7c2nvq+RRmvuyvxw11rtDGR6Nz4OBBe56reWxo868wVUggpRTPJCMVe5tDYgVg== dependencies: "@storybook/global" "^5.0.0" memoizerific "^1.11.3" ts-dedent "^2.0.0" -"@storybook/addon-controls@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-controls/-/addon-controls-8.3.5.tgz#d9b7aec16e2673a473ab018b3b453cd114628181" - integrity sha512-2eCVobUUvY1Rq7sp1U8Mx8t44VXwvi0E+hqyrsqOx5TTSC/FUQ+hNAX6GSYUcFIyQQ1ORpKNlUjAAdjxBv1ZHQ== +"@storybook/addon-controls@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-controls/-/addon-controls-8.3.6.tgz#a61449e50077e9f90d2e15d2594b2bcffb4c03b3" + integrity sha512-9IMLHgtWPuFoRCt3hDsIk1FbkK5SlCMDW1DDwtTBIeWYYZLvptS42+vGVTeQ8v5SejmVzZkzuUdzu3p4sb3IcA== dependencies: "@storybook/global" "^5.0.0" dequal "^2.0.2" lodash "^4.17.21" ts-dedent "^2.0.0" -"@storybook/addon-docs@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-docs/-/addon-docs-8.3.5.tgz#df9e3310b7a63355184f5a2a7f2e2aa396588765" - integrity sha512-MOVfo1bY8kXTzbvmWnx3UuSO4WNykFz7Edvb3mxltNyuW7UDRZGuIuSe32ddT/EtLJfurrC9Ja3yBy4KBUGnMA== +"@storybook/addon-docs@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-docs/-/addon-docs-8.3.6.tgz#b03ad160475b7920ef03833bd2674ea62f872d23" + integrity sha512-31Rk1TOhDIzGM2wNCUIB1xKuWtArW0D2Puua9warEXlQ3FtvwmxnPrwbIzw6ufYZDWPwl9phDYTcRh8WqZIoGg== dependencies: "@mdx-js/react" "^3.0.0" - "@storybook/blocks" "8.3.5" - "@storybook/csf-plugin" "8.3.5" + "@storybook/blocks" "8.3.6" + "@storybook/csf-plugin" "8.3.6" "@storybook/global" "^5.0.0" - "@storybook/react-dom-shim" "8.3.5" + "@storybook/react-dom-shim" "8.3.6" "@types/react" "^16.8.0 || ^17.0.0 || ^18.0.0" fs-extra "^11.1.0" react "^16.8.0 || ^17.0.0 || ^18.0.0" @@ -1283,81 +1283,81 @@ rehype-slug "^6.0.0" ts-dedent "^2.0.0" -"@storybook/addon-essentials@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-essentials/-/addon-essentials-8.3.5.tgz#59599a75e3f72d1048d715f3ec35a4c07149b2f8" - integrity sha512-hXTtPuN4/IsXjUrkMPAuz1qKAl8DovdXpjQgjQs7jSAVx3kc4BZaGqJ3gaVenKtO8uDchmA92BoQygpkc8eWhw== - dependencies: - "@storybook/addon-actions" "8.3.5" - "@storybook/addon-backgrounds" "8.3.5" - "@storybook/addon-controls" "8.3.5" - "@storybook/addon-docs" "8.3.5" - "@storybook/addon-highlight" "8.3.5" - "@storybook/addon-measure" "8.3.5" - "@storybook/addon-outline" "8.3.5" - "@storybook/addon-toolbars" "8.3.5" - "@storybook/addon-viewport" "8.3.5" +"@storybook/addon-essentials@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-essentials/-/addon-essentials-8.3.6.tgz#b8a0bbcad10ecd26cddddb517b4a864e4b65de37" + integrity sha512-MQPFvThlGU7wlda1xhBPQCmDh90cSSZ31OsVs1uC5kJh0aLbY2gYXPurq1G54kzrYo8SMfBxsXrCplz8Ir6UTg== + dependencies: + "@storybook/addon-actions" "8.3.6" + "@storybook/addon-backgrounds" "8.3.6" + "@storybook/addon-controls" "8.3.6" + "@storybook/addon-docs" "8.3.6" + "@storybook/addon-highlight" "8.3.6" + "@storybook/addon-measure" "8.3.6" + "@storybook/addon-outline" "8.3.6" + "@storybook/addon-toolbars" "8.3.6" + "@storybook/addon-viewport" "8.3.6" ts-dedent "^2.0.0" -"@storybook/addon-highlight@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-highlight/-/addon-highlight-8.3.5.tgz#62293e7b39844ded33bb4ba7ee79c3c96d997fe2" - integrity sha512-ku0epul9aReCR3Gv/emwYnsqg3vgux5OmYMjoDcJC7s+LyfweSzLV/f5t9gSHazikJElh5TehtVkWbC4QfbGSw== +"@storybook/addon-highlight@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-highlight/-/addon-highlight-8.3.6.tgz#34c28e8ee0f71b2dad579ab11bf66962d5393bf9" + integrity sha512-A7uU+1OPVXGpkklEUJjSl2VEEDLCSNvmffUJlvW1GjajsNFIHOW2CSD+KnfFlQyPxyVbnWAYLqUP4XJxoqrvDw== dependencies: "@storybook/global" "^5.0.0" -"@storybook/addon-interactions@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-interactions/-/addon-interactions-8.3.5.tgz#c971925937aeb6d66bf108dc27a90a4a9cbbf8f4" - integrity sha512-GtTy/A+mG7vDOahQr2avT4dpWtCRiFDSYcWyuQOZm10y8VDDw157HQM+FuhxjV9Owrrohy9F24oBUwRG8H3b5A== +"@storybook/addon-interactions@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-interactions/-/addon-interactions-8.3.6.tgz#ae03320903688e97934c37a211b3f1a45312248c" + integrity sha512-Y0YUJj0oE1+6DFkaTPXM/8+dwTSoy0ltj2Sn2KOTJYzxKQYXBp8TlUv0QOQiGH7o/GKXIWek/VlTuvG/JEeiWw== dependencies: "@storybook/global" "^5.0.0" - "@storybook/instrumenter" "8.3.5" - "@storybook/test" "8.3.5" + "@storybook/instrumenter" "8.3.6" + "@storybook/test" "8.3.6" polished "^4.2.2" ts-dedent "^2.2.0" -"@storybook/addon-links@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-links/-/addon-links-8.3.5.tgz#1621afd8be06af6de5e942644053d5136cc5bb83" - integrity sha512-giRCpn6cfJMYPnVJkojoQDO5ae6098fgY9YgAhwaJej/9dufNcioFdbiyfK1vyzbG6TGeTmJ9ncWCXgWRtzxPQ== +"@storybook/addon-links@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-links/-/addon-links-8.3.6.tgz#2388083f7f53936061cb8cd5d5a40ea116fad785" + integrity sha512-EGEH/kEjndEldbqyiJ8XSASkxqwzL/lgA/+6mHpa6Ljxhk1s5IMGcdA1ymJYJ2BpNdkUxRj/uxAa38eGcQiJ/g== dependencies: "@storybook/csf" "^0.1.11" "@storybook/global" "^5.0.0" ts-dedent "^2.0.0" -"@storybook/addon-measure@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-measure/-/addon-measure-8.3.5.tgz#4eef622137f9ee615eb179e5e2af050ea0f7ab8b" - integrity sha512-6GVehgbHhFIFS69xSfRV+12VK0cnuIAtZdp1J3eUCc2ATrcigqVjTM6wzZz6kBuX6O3dcusr7Wg46KtNliqLqg== +"@storybook/addon-measure@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-measure/-/addon-measure-8.3.6.tgz#874939b2b6aafb29aed23cd74ee7db3c7f338f33" + integrity sha512-VHWeGgYjhzhwb2WAqYW/qyEPqg5pwKR/XqFfd+3tEirUs/64olL1l3lzLwZ8Cm07cJ81T8Z4myywb9kObZfQlw== dependencies: "@storybook/global" "^5.0.0" tiny-invariant "^1.3.1" -"@storybook/addon-outline@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-outline/-/addon-outline-8.3.5.tgz#274a497b9a6b391bf3c47aa61e19ddc28cbae395" - integrity sha512-dwmK6GzjEnQP9Yo0VnBUQtJkXZlXdfjWyskZ/IlUVc+IFdeeCtIiMyA92oMfHo8eXt0k1g21ZqMaIn7ZltOuHw== +"@storybook/addon-outline@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-outline/-/addon-outline-8.3.6.tgz#0c68a26b54a9294ecf6369473c70132c8d1c23a4" + integrity sha512-+VXpM8SIHX2cn30qLlMvER9/6iioFRSn2sAfLniqy4RrcQmcMP+qgE7ZzbzExt7cneJh3VFsYqBS/HElu14Vgg== dependencies: "@storybook/global" "^5.0.0" ts-dedent "^2.0.0" -"@storybook/addon-toolbars@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-toolbars/-/addon-toolbars-8.3.5.tgz#7328fed0f4a24c6828ba23e06b9cddd0d3e00e2b" - integrity sha512-Ml2gc9q8WbteDvmuAZGgBxt5SqWMXzuTkMjlsA8EB53hlkN1w9esX4s8YtBeNqC3HKoUzcdq8uexSBqU8fDbSA== +"@storybook/addon-toolbars@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-toolbars/-/addon-toolbars-8.3.6.tgz#d06068c96f5a80da2040f15f521c0927e8b0c2d4" + integrity sha512-FJH+lRoZXENfpMR/G09ZqB0TmL/k6bv07GN1ysoVs420tKRgjfz6uXaZz5COrhcdISr5mTNmG+mw9x7xXTfX3Q== -"@storybook/addon-viewport@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/addon-viewport/-/addon-viewport-8.3.5.tgz#10f10871eba32cf6c484db199241122184a4324b" - integrity sha512-FSWydoPiVWFXEittG7O1YgvuaqoU9Vb+qoq9XfP/hvQHHMDcMZvC40JaV8AnJeTXaM7ngIjcn9XDEfGbFfOzXw== +"@storybook/addon-viewport@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/addon-viewport/-/addon-viewport-8.3.6.tgz#3b95fc33335f75010f0ba6fd552ada388ab64add" + integrity sha512-bL51v837W1cng/+0pypkoLsWKWmvux96zLOzqLCpcWAQ4OSMhW3foIWpCiFwMG/KY+GanoOocTx6i7j5hLtuTA== dependencies: memoizerific "^1.11.3" -"@storybook/blocks@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/blocks/-/blocks-8.3.5.tgz#35e20efb0c13a235832dd945520ff8ac61f40717" - integrity sha512-8cHTdTywolTHlgwN8I7YH7saWAIjGzV617AwjhJ95AKlC0VtpO1gAFcAgCqr4DU9eMc+LZuvbnaU/RSvA5eCCQ== +"@storybook/blocks@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/blocks/-/blocks-8.3.6.tgz#ac2e4f07a4df23004b3361c592c2cffe6b95464a" + integrity sha512-Oc5jU6EzfsENjrd91KcKyEKBh60RT+8uyLi1RIrymC2C/mzZMTEoNIrbnQt0eIqbjlHxn6y9JMJxHu4NJ4EmZg== dependencies: "@storybook/csf" "^0.1.11" "@storybook/global" "^5.0.0" @@ -1374,12 +1374,12 @@ ts-dedent "^2.0.0" util-deprecate "^1.0.2" -"@storybook/builder-vite@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/builder-vite/-/builder-vite-8.3.5.tgz#2586b3154b9cd1877d6265a724d59287bdda8b5f" - integrity sha512-paGX8tEmAeAKFU5Cnwkq3RAi3LFCnmjAxMJikT09jUi6jDpNa0VzH8jbLxKdjsPMAsz0Wv3mrLvL2b8hyxLWAw== +"@storybook/builder-vite@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/builder-vite/-/builder-vite-8.3.6.tgz#0d76ea94e094c22483297bceff5488a0ed6f4e4d" + integrity sha512-AF4+oFe1mvIHrLvaYsv8B0YSlXQtSlKTKwrXnUbcAbeGRwMmFKA1t3VyAcXV0yB9MtZ8YJsA/uKRkgGEaN7wJQ== dependencies: - "@storybook/csf-plugin" "8.3.5" + "@storybook/csf-plugin" "8.3.6" "@types/find-cache-dir" "^3.2.1" browser-assert "^1.2.1" es-module-lexer "^1.5.0" @@ -1389,15 +1389,15 @@ magic-string "^0.30.0" ts-dedent "^2.0.0" -"@storybook/components@^8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/components/-/components-8.3.5.tgz#6a8e7f95f1b1f45df7ffcbdeeb3eef3c6cce0d3f" - integrity sha512-Rq28YogakD3FO4F8KwAtGpo1g3t4V/gfCLqTQ8B6oQUFoxLqegkWk/DlwCzvoJndXuQJfdSyM6+r1JcA4Nql5A== +"@storybook/components@^8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/components/-/components-8.3.6.tgz#2f5e9a755a964c94f0bab3cd400cc7a71d0489d2" + integrity sha512-TXuoGZY7X3iixF45lXkYOFk8k2q9OHcqHyHyem1gATLLQXgyOvDgzm+VB7uKBNzssRQPEE+La70nfG8bq/viRw== -"@storybook/core@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/core/-/core-8.3.5.tgz#d77c93bb67c2df12e3bf84ae7def4693891b225d" - integrity sha512-GOGfTvdioNa/n+Huwg4u/dsyYyBcM+gEcdxi3B7i5x4yJ3I912KoVshumQAOF2myKSRdI8h8aGWdx7nnjd0+5Q== +"@storybook/core@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/core/-/core-8.3.6.tgz#fb439d4edc0722e3bf6fdaff0469bb21566edab1" + integrity sha512-frwfgf0EJ7QL29DWZ5bla/g0eOOWqJGd14t+VUBlpP920zB6sdDfo7+p9JoCjD9u08lGeFDqbPNKayUk+0qDag== dependencies: "@storybook/csf" "^0.1.11" "@types/express" "^4.17.21" @@ -1413,10 +1413,10 @@ util "^0.12.5" ws "^8.2.3" -"@storybook/csf-plugin@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/csf-plugin/-/csf-plugin-8.3.5.tgz#198946c438be8915b63abde04a19f26610a6d88a" - integrity sha512-ODVqNXwJt90hG7QW8I9w/XUyOGlr0l7XltmIJgXwB/2cYDvaGu3JV5Ybg7O0fxPV8uXk7JlRuUD8ZYv5Low6pA== +"@storybook/csf-plugin@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/csf-plugin/-/csf-plugin-8.3.6.tgz#8e6fd04f1dd4662f85f6c1e8fa56d4331f3be4c7" + integrity sha512-TJyJPFejO6Gyr3+bXqE/+LomQbivvfHEbee/GwtlRj0XF4KQlqnvuEdEdcK25JbD0NXT8AbyncEUmjoxE7ojQw== dependencies: unplugin "^1.3.1" @@ -1444,38 +1444,38 @@ resolved "https://registry.yarnpkg.com/@storybook/icons/-/icons-1.2.12.tgz#3e4c939113b67df7ab17b78f805dbb57f4acf0db" integrity sha512-UxgyK5W3/UV4VrI3dl6ajGfHM4aOqMAkFLWe2KibeQudLf6NJpDrDMSHwZj+3iKC4jFU7dkKbbtH2h/al4sW3Q== -"@storybook/instrumenter@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/instrumenter/-/instrumenter-8.3.5.tgz#ba3c6adcd928ef98859ac4ed1e5addb1164659ea" - integrity sha512-NLDXai5y2t1ITgHVK9chyL0rMFZbICCOGcnTbyWhkLbiEWZKPJ8FuB8+g+Ba6zwtCve1A1Cnb4O2LOWy7TgWQw== +"@storybook/instrumenter@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/instrumenter/-/instrumenter-8.3.6.tgz#0696a8ba1549080c0670109a9e78beece6e358f5" + integrity sha512-0RowbKwoB/s7rtymlnKNiyWN1Z3ZK5mwgzVjlRmzxDL8hrdi5KDjTNExuJTRR3ZaBP2RR0/I3m/n0p9JhHAZvg== dependencies: "@storybook/global" "^5.0.0" "@vitest/utils" "^2.0.5" util "^0.12.4" -"@storybook/manager-api@8.3.5", "@storybook/manager-api@^8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/manager-api/-/manager-api-8.3.5.tgz#73560ffc3774901e503e31aefac91cd4a1579bbb" - integrity sha512-fEQoKKi7h7pzh2z9RfuzatJxubrsfL/CB99fNXQ0wshMSY/7O4ckd18pK4fzG9ErnCtLAO9qsim4N/4eQC+/8Q== +"@storybook/manager-api@8.3.6", "@storybook/manager-api@^8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/manager-api/-/manager-api-8.3.6.tgz#6dfb268a5f1f8228d0bac69fd6e63f6bd2620c2d" + integrity sha512-Xt5VFZcL+G/9uzaHjzWFhxRNrP+4rPhSRKEvCZorAbC9+Hv+ZDs1JSZS5wMb4WKpXBZ0rwDVOLwngqbVtfRHuQ== -"@storybook/preview-api@8.3.5", "@storybook/preview-api@^8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/preview-api/-/preview-api-8.3.5.tgz#d30debc89793a912cdd26aea1e18b92527f2cf76" - integrity sha512-VPqpudE8pmjTLvdNJoW/2//nqElDgUOmIn3QxbbCmdZTHDg5tFtxuqwdlNfArF0TxvTSBDIulXt/Q6K56TAfTg== +"@storybook/preview-api@8.3.6", "@storybook/preview-api@^8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/preview-api/-/preview-api-8.3.6.tgz#7891b0d9f86bfb49c98eb34487c432354710b468" + integrity sha512-/Wxvb7wbI2O2iH63arRQQyyojA630vibdshkFjuC/u1nYdptEV1jkxa0OYmbZbKCn4/ze6uH4hfsKOpDPV9SWg== -"@storybook/react-dom-shim@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/react-dom-shim/-/react-dom-shim-8.3.5.tgz#dda5356d3bf55623b9b1429fac7bf185e59c58fd" - integrity sha512-Hf0UitJ/K0C7ajooooUK/PxOR4ihUWqsC7iCV1Gqth8U37dTeLMbaEO4PBwu0VQ+Ufg0N8BJLWfg7o6G4hrODw== +"@storybook/react-dom-shim@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/react-dom-shim/-/react-dom-shim-8.3.6.tgz#40ce82a4e6559a617c4a7288b532652fefcd271e" + integrity sha512-9BO6VXIdli4GHSfiP/Z0gwAf7oQig3D/yWK2U1+91UWDV8nIAgnNBAi76U4ORC6MiK5MdkDfIikIxnLLeLnahA== -"@storybook/test@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/test/-/test-8.3.5.tgz#0dffc9d4a1eaa9552e69457b16b5085e36883c8a" - integrity sha512-1BXWsUGWk9FiKKelZZ55FDJdeoL8uRBHbjTYBRM2xJLhdNSvGzI4Tb3bkmxPpGn72Ua6AyldhlTxr2BpUFKOHA== +"@storybook/test@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/test/-/test-8.3.6.tgz#a1b92be405004f479319127bba833a52e8d075b1" + integrity sha512-WIc8LzK9jaEw+e3OiweEM2j3cppPzsWod59swuf6gDBf176EQLIyjtVc+Kh3qO4NNkcL+lwmqaLPjOxlBLaDbg== dependencies: "@storybook/csf" "^0.1.11" "@storybook/global" "^5.0.0" - "@storybook/instrumenter" "8.3.5" + "@storybook/instrumenter" "8.3.6" "@testing-library/dom" "10.4.0" "@testing-library/jest-dom" "6.5.0" "@testing-library/user-event" "14.5.2" @@ -1483,35 +1483,35 @@ "@vitest/spy" "2.0.5" util "^0.12.4" -"@storybook/theming@8.3.5", "@storybook/theming@^8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-8.3.5.tgz#c6b807193099a8f9d1afb5d71a59037c0ef54e85" - integrity sha512-9HmDDyC691oqfg4RziIM9ElsS2HITaxmH7n/yeUPtuirkPdAQzqOzhvH/Sa0qOhifzs8VjR+Gd/a/ZQ+S38r7w== +"@storybook/theming@8.3.6", "@storybook/theming@^8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-8.3.6.tgz#57c5789903e50b84844aa8e7ce0e1f031e98a948" + integrity sha512-LQjUk6GXRW9ELkoBKuqzQKFUW+ajfGPfVELcfs3/VQX61VhthJ4olov4bGPc04wsmmFMgN/qODxT485IwOHfPQ== -"@storybook/types@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/types/-/types-8.3.5.tgz#4cc3eee112d9436606f6ce7037666be42f29cac3" - integrity sha512-XWK8tCgoTI1QycQiZCYtAijws2JjbbGANuq1olBRZ1BcZWvc1TkNSipqF1TLMkPGiNq+MxrXAKutUoQK459fTg== +"@storybook/types@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/types/-/types-8.3.6.tgz#8c5c15e8869dd3218a73748db75bb7ef709262b9" + integrity sha512-EY+bjIxxmKkFrL7CyDQb3EXbmy0+Y9OieaPrNNM7QXTfGgp81lXhfqMX3HLMMjplk+rcxVJLyzXSBx0nIn91fQ== -"@storybook/web-components-vite@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/web-components-vite/-/web-components-vite-8.3.5.tgz#5d0caf48643766238947d5457fafaed28f640a37" - integrity sha512-ypHMCBSX9BE3X6lejMmkgIUibmbpgSAL/+N/B5wJ1BUn7A+VQ2M6TehpAtVk3gQGPyUj8hBpHWHYoUW6oupNPQ== +"@storybook/web-components-vite@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/web-components-vite/-/web-components-vite-8.3.6.tgz#8ad40d3cfdabb8aeaa8d07b49b3485e20988eb6f" + integrity sha512-VCJdvgujWfwgIrWDwLL4CSBoVr0RQXoL0Uokjg6CvZtsjE7BbvEjb57/fuR5WkDvc8wIEqeRjIa84pRh5wvJmg== dependencies: - "@storybook/builder-vite" "8.3.5" - "@storybook/web-components" "8.3.5" + "@storybook/builder-vite" "8.3.6" + "@storybook/web-components" "8.3.6" magic-string "^0.30.0" -"@storybook/web-components@8.3.5": - version "8.3.5" - resolved "https://registry.yarnpkg.com/@storybook/web-components/-/web-components-8.3.5.tgz#4855e0edf57026d12f6f0bfd9fc5cb5a050244ca" - integrity sha512-pZW0r5Q8rHIeKpVwQzSy7iqd4VTelW3R62Bj/mgJtS4E7u5WO353pw6Cpsl0Qlj0fSKHSprfmenTCr1XqAgz/Q== +"@storybook/web-components@8.3.6": + version "8.3.6" + resolved "https://registry.yarnpkg.com/@storybook/web-components/-/web-components-8.3.6.tgz#feddff2c7d4f0da72ea7b04c0a0a0e7c9140f5b6" + integrity sha512-IaeRqh2GgGDpJdaNXFT0rPwM6MmV3U3E04fPcFtYq2XlJkaUEkz7rvaozfuRJuGIUwrVODEAgHj8P8iIuSj9Bg== dependencies: - "@storybook/components" "^8.3.5" + "@storybook/components" "^8.3.6" "@storybook/global" "^5.0.0" - "@storybook/manager-api" "^8.3.5" - "@storybook/preview-api" "^8.3.5" - "@storybook/theming" "^8.3.5" + "@storybook/manager-api" "^8.3.6" + "@storybook/preview-api" "^8.3.6" + "@storybook/theming" "^8.3.6" tiny-invariant "^1.3.1" ts-dedent "^2.0.0" @@ -8335,12 +8335,12 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== -storybook@8.3.5: - version "8.3.5" - resolved "https://registry.yarnpkg.com/storybook/-/storybook-8.3.5.tgz#aef0542c08e245b7ac22742c1e1633a125063b8e" - integrity sha512-hYQVtP2l+3kO8oKDn4fjXXQYxgTRsj/LaV6lUMJH0zt+OhVmDXKJLxmdUP4ieTm0T8wEbSYosFavgPcQZlxRfw== +storybook@8.3.6: + version "8.3.6" + resolved "https://registry.yarnpkg.com/storybook/-/storybook-8.3.6.tgz#c5e733504fac26c1a31c527a645c04ec7da4222f" + integrity sha512-9GVbtej6ZzPRUM7KRQ7848506FfHrUiJGqPuIQdoSJd09EmuEoLjmLAgEOmrHBQKgGYMaM7Vh9GsTLim6vwZTQ== dependencies: - "@storybook/core" "8.3.5" + "@storybook/core" "8.3.6" stream-to-array@^2.3.0: version "2.3.0" From bcc44395dfb0829ddbc8545e875653da26b00603 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 23:27:41 +0000 Subject: [PATCH 2/9] chore(deps): update dependency @eslint/js to v9.13.0 --- package.json | 2 +- yarn.lock | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index f7075a6438..581f211474 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "@custom-elements-manifest/analyzer": "0.10.3", "@custom-elements-manifest/to-markdown": "0.1.0", "@eslint/eslintrc": "3.1.0", - "@eslint/js": "9.12.0", + "@eslint/js": "9.13.0", "@lit-labs/observers": "2.0.4", "@lit-labs/router": "0.1.3", "@lit-labs/testing": "0.2.5", diff --git a/yarn.lock b/yarn.lock index ef90774a5e..48f0c48935 100644 --- a/yarn.lock +++ b/yarn.lock @@ -683,6 +683,11 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.12.0.tgz#69ca3ca9fab9a808ec6d67b8f6edb156cbac91e1" integrity sha512-eohesHH8WFRUprDNyEREgqP6beG6htMeUYeCpkEgBCieCMme5r9zFWjzAJp//9S+Kub4rqE+jXe9Cp1a7IYIIA== +"@eslint/js@9.13.0": + version "9.13.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.13.0.tgz#c5f89bcd57eb54d5d4fa8b77693e9c28dc97e547" + integrity sha512-IFLyoY4d72Z5y/6o/BazFBezupzI/taV8sGumxTAVw3lXG9A6md1Dc34T9s1FoD/an9pJH8RHbAxsaEbBed9lA== + "@eslint/object-schema@^2.1.4": version "2.1.4" resolved "https://registry.yarnpkg.com/@eslint/object-schema/-/object-schema-2.1.4.tgz#9e69f8bb4031e11df79e03db09f9dbbae1740843" From 9cf9ea6156037764b2d5605e545ff1e39a37305d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 19 Oct 2024 01:16:18 +0000 Subject: [PATCH 3/9] chore(deps): update dependency eslint to v9.13.0 --- package.json | 2 +- yarn.lock | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 581f211474..b87a12990b 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "custom-elements-manifest": "2.1.0", "date-fns": "4.1.0", "esbuild": "0.24.0", - "eslint": "9.12.0", + "eslint": "9.13.0", "eslint-config-prettier": "9.1.0", "eslint-import-resolver-typescript": "3.6.3", "eslint-plugin-import-x": "4.3.1", diff --git a/yarn.lock b/yarn.lock index 48f0c48935..4008f631b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -658,10 +658,10 @@ debug "^4.3.1" minimatch "^3.1.2" -"@eslint/core@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.6.0.tgz#9930b5ba24c406d67a1760e94cdbac616a6eb674" - integrity sha512-8I2Q8ykA4J0x0o7cg67FPVnehcqWTBehu/lmY+bolPFHGjh49YzGBMXTvpqVgEbBdvNCSxj6iFgiIyHzf03lzg== +"@eslint/core@^0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.7.0.tgz#a1bb4b6a4e742a5ff1894b7ee76fbf884ec72bd3" + integrity sha512-xp5Jirz5DyPYlPiKat8jaq0EmYvDXKKpzTbxXMpT9eqlRJkRKIz9AGMdlvYjih+im+QlhWrpvVjl8IPC/lHlUw== "@eslint/eslintrc@3.1.0", "@eslint/eslintrc@^3.1.0": version "3.1.0" @@ -678,11 +678,6 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.12.0": - version "9.12.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.12.0.tgz#69ca3ca9fab9a808ec6d67b8f6edb156cbac91e1" - integrity sha512-eohesHH8WFRUprDNyEREgqP6beG6htMeUYeCpkEgBCieCMme5r9zFWjzAJp//9S+Kub4rqE+jXe9Cp1a7IYIIA== - "@eslint/js@9.13.0": version "9.13.0" resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.13.0.tgz#c5f89bcd57eb54d5d4fa8b77693e9c28dc97e547" @@ -4414,17 +4409,17 @@ eslint-visitor-keys@^4.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.1.0.tgz#1f785cc5e81eb7534523d85922248232077d2f8c" integrity sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg== -eslint@9.12.0: - version "9.12.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.12.0.tgz#54fcba2876c90528396da0fa44b6446329031e86" - integrity sha512-UVIOlTEWxwIopRL1wgSQYdnVDcEvs2wyaO6DGo5mXqe3r16IoCNWkR29iHhyaP4cICWjbgbmFUGAhh0GJRuGZw== +eslint@9.13.0: + version "9.13.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.13.0.tgz#7659014b7dda1ff876ecbd990f726e11c61596e6" + integrity sha512-EYZK6SX6zjFHST/HRytOdA/zE72Cq/bfw45LSyuwrdvcclb/gqV8RRQxywOBEWO2+WDpva6UZa4CcDeJKzUCFA== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.11.0" "@eslint/config-array" "^0.18.0" - "@eslint/core" "^0.6.0" + "@eslint/core" "^0.7.0" "@eslint/eslintrc" "^3.1.0" - "@eslint/js" "9.12.0" + "@eslint/js" "9.13.0" "@eslint/plugin-kit" "^0.2.0" "@humanfs/node" "^0.16.5" "@humanwhocodes/module-importer" "^1.0.1" From 6b6050c3cbfd7375811309d0f5e51dc353fb4260 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 19 Oct 2024 04:18:56 +0000 Subject: [PATCH 4/9] chore(deps): update dependency @types/node to v20.16.13 --- package.json | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index b87a12990b..d5701a1109 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "@storybook/web-components-vite": "8.3.6", "@types/glob": "8.1.0", "@types/mocha": "10.0.9", - "@types/node": "20.16.12", + "@types/node": "20.16.13", "@types/react": "18.3.11", "@typescript-eslint/eslint-plugin": "8.10.0", "@typescript-eslint/parser": "8.10.0", @@ -146,7 +146,7 @@ "vite-plugin-dts": "4.2.4" }, "resolutions": { - "@types/node": "20.16.12", + "@types/node": "20.16.13", "@webcomponents/template-shadowroot": "0.2.1", "@web/dev-server-core": "0.7.1", "jackspeak": "2.1.1", diff --git a/yarn.lock b/yarn.lock index 4008f631b4..f1cf4dc8a5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1854,10 +1854,10 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.34.tgz#10964ba0dee6ac4cd462e2795b6bebd407303433" integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g== -"@types/node@*", "@types/node@20.16.12", "@types/node@^16.0.0": - version "20.16.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.12.tgz#61cc9be049584b472fa31e465aa0ab3c090dac56" - integrity sha512-LfPFB0zOeCeCNQV3i+67rcoVvoN5n0NVuR2vLG0O5ySQMgchuZlC4lgz546ZOJyDtj5KIgOxy+lacOimfqZAIA== +"@types/node@*", "@types/node@20.16.13", "@types/node@^16.0.0": + version "20.16.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.13.tgz#148c152d757dc73f8d65f0f6f078f39050b85b0c" + integrity sha512-GjQ7im10B0labo8ZGXDGROUl9k0BNyDgzfGpb4g/cl+4yYDWVKcozANF4FGr4/p0O/rAkQClM6Wiwkije++1Tg== dependencies: undici-types "~6.19.2" From d49813d36e648638ee1d4bba4315d3ff771bd047 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 19 Oct 2024 11:03:21 +0000 Subject: [PATCH 5/9] chore(deps): update dependency sass to v1.80.3 (#3161) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d5701a1109..1e83f85c5c 100644 --- a/package.json +++ b/package.json @@ -131,7 +131,7 @@ "prettier": "3.3.3", "react": "18.3.1", "rollup-plugin-postcss-lit": "2.1.0", - "sass": "1.80.2", + "sass": "1.80.3", "sinon": "19.0.2", "storybook": "8.3.6", "stylelint": "16.10.0", diff --git a/yarn.lock b/yarn.lock index f1cf4dc8a5..55fe8cc324 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8079,10 +8079,10 @@ sass-lookup@^6.0.1: dependencies: commander "^12.0.0" -sass@1.80.2: - version "1.80.2" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.80.2.tgz#9d13d85a4f81bb17e09d1dc3e1c0944f7fd7315e" - integrity sha512-9wXY8cGBlUmoUoT+vwOZOFCiS+naiWVjqlreN9ar9PudXbGwlMTFwCR5K9kB4dFumJ6ib98wZyAObJKsWf1nAA== +sass@1.80.3: + version "1.80.3" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.80.3.tgz#3f63dd527647d2b3de35f36acb971bda80517423" + integrity sha512-ptDWyVmDMVielpz/oWy3YP3nfs7LpJTHIJZboMVs8GEC9eUmtZTZhMHlTW98wY4aEorDfjN38+Wr/XjskFWcfA== dependencies: "@parcel/watcher" "^2.4.1" chokidar "^4.0.0" From 1a1d437abe90b05a471a4ed2e8015aea2f73019d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 01:01:55 +0000 Subject: [PATCH 6/9] chore(deps): lock file maintenance --- yarn.lock | 219 ++++++++++++++++++------------------------------------ 1 file changed, 73 insertions(+), 146 deletions(-) diff --git a/yarn.lock b/yarn.lock index 55fe8cc324..80d5fee539 100644 --- a/yarn.lock +++ b/yarn.lock @@ -689,9 +689,9 @@ integrity sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ== "@eslint/plugin-kit@^0.2.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@eslint/plugin-kit/-/plugin-kit-0.2.0.tgz#8712dccae365d24e9eeecb7b346f85e750ba343d" - integrity sha512-vH9PiIMMwvhCx31Af3HiGzsVNULDbyVkHXwlemn/B0TFj/00ho3y55efXrUZTfQipxoHC5u4xq6zblww1zm1Ig== + version "0.2.1" + resolved "https://registry.yarnpkg.com/@eslint/plugin-kit/-/plugin-kit-0.2.1.tgz#cd14fe2db79fa639839dfef4105e83bad1814482" + integrity sha512-HFZ4Mp26nbWk9d/BpvP0YNL6W4UoZF0VFcTw/aPPA8RpOxeFQgK+ClABGgAUXs9Y/RGX/l1vOmrqz1MQt9MNuw== dependencies: levn "^0.4.1" @@ -823,9 +823,9 @@ "@lit-labs/ssr-dom-shim" "^1.2.0" "@mdx-js/react@^3.0.0": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@mdx-js/react/-/react-3.0.1.tgz#997a19b3a5b783d936c75ae7c47cfe62f967f746" - integrity sha512-9ZrPIU4MGf6et1m1ov3zKf+q9+deetI51zprKB1D/z3NOb+rUxxtEl3mCjW5wTGh6VhRdwPueh1oRzi6ezkA8A== + version "3.1.0" + resolved "https://registry.yarnpkg.com/@mdx-js/react/-/react-3.1.0.tgz#c4522e335b3897b9a845db1dbdd2f966ae8fb0ed" + integrity sha512-QjHtSaoameoalGnKDT3FoIl4+9RwyTmo9ZJGBdLOks/YOiWHoRDI3PUwEzOE7kEmGcV3AFcp9K6dYu9rEuKLAQ== dependencies: "@types/mdx" "^2.0.0" @@ -1207,9 +1207,9 @@ type-detect "4.0.8" "@sinonjs/fake-timers@^13.0.1", "@sinonjs/fake-timers@^13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-13.0.2.tgz#3ffe88abb062067a580fdfba706ad00435a0f2a6" - integrity sha512-4Bb+oqXZTSTZ1q27Izly9lv8B9dlV61CROxPiVtywwzv5SnytJqhvYe6FclHYuXml4cd1VHPo1zd5PmTeJozvA== + version "13.0.3" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-13.0.3.tgz#3338263cbdfdb5cd40be61c3c315f360bf4f3a3b" + integrity sha512-golm/Sc4CqLV/ZalIP14Nre7zPgd8xG/S3nHULMTBHMX0llyTNhE1O6nrgbfvLX2o0y849CnLKdu8OE05Ztiiw== dependencies: "@sinonjs/commons" "^3.0.1" @@ -1811,9 +1811,9 @@ "@types/node" "*" "@types/lodash@^4.14.167": - version "4.17.10" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.10.tgz#64f3edf656af2fe59e7278b73d3e62404144a6e6" - integrity sha512-YpS0zzoduEhuOWjAotS6A5AVCva7X4lVlYLF0FYHAY9sdraBfnatttHItlWeZdGhuEkf+OzMNg2ZYAx8t+52uQ== + version "4.17.12" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.12.tgz#25d71312bf66512105d71e55d42e22c36bcfc689" + integrity sha512-sviUmCE8AYdaF/KIHLDJBQgeYzPBI0vf/17NaYehBJfYD1j6/L95Slh07NlyK2iNyBNaEkb3En2jRt+a8y3xZQ== "@types/mdast@^3.0.0": version "3.0.15" @@ -2026,14 +2026,6 @@ "@typescript-eslint/types" "8.10.0" "@typescript-eslint/visitor-keys" "8.10.0" -"@typescript-eslint/scope-manager@8.8.1": - version "8.8.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.8.1.tgz#b4bea1c0785aaebfe3c4ab059edaea1c4977e7ff" - integrity sha512-X4JdU+66Mazev/J0gfXlcC/dV6JI37h+93W9BRYXrSn0hrE64IoWgVkO9MSJgEzoWkxONgaQpICWg8vAN74wlA== - dependencies: - "@typescript-eslint/types" "8.8.1" - "@typescript-eslint/visitor-keys" "8.8.1" - "@typescript-eslint/type-utils@8.10.0": version "8.10.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.10.0.tgz#99f1d2e21f8c74703e7d9c4a67a87271eaf57597" @@ -2059,11 +2051,6 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.10.0.tgz#eb29c4bc2ed23489348c297469c76d28c38fb618" integrity sha512-k/E48uzsfJCRRbGLapdZgrX52csmWJ2rcowwPvOZ8lwPUv3xW6CcFeJAXgx4uJm+Ge4+a4tFOkdYvSpxhRhg1w== -"@typescript-eslint/types@8.8.1": - version "8.8.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.8.1.tgz#ebe85e0fa4a8e32a24a56adadf060103bef13bd1" - integrity sha512-WCcTP4SDXzMd23N27u66zTKMuEevH4uzU8C9jf0RO4E04yVHgQgW+r+TeVTNnO1KIfrL8ebgVVYYMMO3+jC55Q== - "@typescript-eslint/typescript-estree@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" @@ -2091,20 +2078,6 @@ semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/typescript-estree@8.8.1": - version "8.8.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.8.1.tgz#34649f4e28d32ee49152193bc7dedc0e78e5d1ec" - integrity sha512-A5d1R9p+X+1js4JogdNilDuuq+EHZdsH9MjTVxXOdVFfTJXunKJR/v+fNNyO4TnoOn5HqobzfRlc70NC6HTcdg== - dependencies: - "@typescript-eslint/types" "8.8.1" - "@typescript-eslint/visitor-keys" "8.8.1" - debug "^4.3.4" - fast-glob "^3.3.2" - is-glob "^4.0.3" - minimatch "^9.0.4" - semver "^7.6.0" - ts-api-utils "^1.3.0" - "@typescript-eslint/typescript-estree@^7.6.0": version "7.18.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz#b5868d486c51ce8f312309ba79bdb9f331b37931" @@ -2119,7 +2092,7 @@ semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/utils@8.10.0": +"@typescript-eslint/utils@8.10.0", "@typescript-eslint/utils@^8.1.0": version "8.10.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.10.0.tgz#d78d1ce3ea3d2a88a2593ebfb1c98490131d00bf" integrity sha512-Oq4uZ7JFr9d1ZunE/QKy5egcDRXT/FrS2z/nlxzPua2VHFtmMvFNDvpq1m/hq0ra+T52aUezfcjGRIB7vNJF9w== @@ -2143,16 +2116,6 @@ eslint-scope "^5.1.1" semver "^7.3.7" -"@typescript-eslint/utils@^8.1.0": - version "8.8.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.8.1.tgz#9e29480fbfa264c26946253daa72181f9f053c9d" - integrity sha512-/QkNJDbV0bdL7H7d0/y0qBbV2HTtf0TIyjSDTvvmQEzeVx8jEImEbLuOA4EsvE8gIgqMitns0ifb5uQhMj8d9w== - dependencies: - "@eslint-community/eslint-utils" "^4.4.0" - "@typescript-eslint/scope-manager" "8.8.1" - "@typescript-eslint/types" "8.8.1" - "@typescript-eslint/typescript-estree" "8.8.1" - "@typescript-eslint/visitor-keys@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e" @@ -2177,14 +2140,6 @@ "@typescript-eslint/types" "8.10.0" eslint-visitor-keys "^3.4.3" -"@typescript-eslint/visitor-keys@8.8.1": - version "8.8.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.8.1.tgz#0fb1280f381149fc345dfde29f7542ff4e587fc5" - integrity sha512-0/TdC3aeRAsW7MDvYRwEc1Uwm0TIBfzjPFgg60UU2Haj5qsCs9cc3zNgY71edqE3LbWfF/WoZQd3lJoDXFQpag== - dependencies: - "@typescript-eslint/types" "8.8.1" - eslint-visitor-keys "^3.4.3" - "@ungap/structured-clone@^1.0.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" @@ -2207,10 +2162,10 @@ dependencies: tinyrainbow "^1.2.0" -"@vitest/pretty-format@2.1.2": - version "2.1.2" - resolved "https://registry.yarnpkg.com/@vitest/pretty-format/-/pretty-format-2.1.2.tgz#42882ea18c4cd40428e34f74bbac706a82465193" - integrity sha512-FIoglbHrSUlOJPDGIrh2bjX1sNars5HbxlcsFKCtKzu4+5lpsRhOCVcuzp0fEhAGHkPZRIXVNzPcpSlkoZ3LuA== +"@vitest/pretty-format@2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@vitest/pretty-format/-/pretty-format-2.1.3.tgz#48b9b03de75507d1d493df7beb48dc39a1946a3e" + integrity sha512-XH1XdtoLZCpqV59KRbPrIhFCOO0hErxrQCMcvnQete3Vibb9UeIOX02uFPfVn3Z9ZXsq78etlfyhnkmIZSzIwQ== dependencies: tinyrainbow "^1.2.0" @@ -2232,11 +2187,11 @@ tinyrainbow "^1.2.0" "@vitest/utils@^2.0.5": - version "2.1.2" - resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-2.1.2.tgz#222ac35ba02493173e40581256eb7a62520fcdba" - integrity sha512-zMO2KdYy6mx56btx9JvAqAZ6EyS3g49krMPPrgOp1yxGZiA93HumGk+bZ5jIZtOg5/VBYl5eBmGRQHqq4FG6uQ== + version "2.1.3" + resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-2.1.3.tgz#e52aa5745384091b151cbdf79bb5a3ad2bea88d2" + integrity sha512-xpiVfDSg1RrYT0tX6czgerkpcKFmFOF/gCr30+Mve5V2kewCy4Prn1/NDMSRwaSmT7PRaOF83wu+bEtsY1wrvA== dependencies: - "@vitest/pretty-format" "2.1.2" + "@vitest/pretty-format" "2.1.3" loupe "^3.1.1" tinyrainbow "^1.2.0" @@ -2285,7 +2240,7 @@ "@vue/compiler-core" "3.5.12" "@vue/shared" "3.5.12" -"@vue/compiler-sfc@^3.4.27": +"@vue/compiler-sfc@^3.5.12": version "3.5.12" resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.5.12.tgz#6688120d905fcf22f7e44d3cb90f8dabc4dd3cc8" integrity sha512-2k973OGo2JuAa5+ZlekuQJtitI5CgLMOwgl94BzMCsKZCX/xiqzJYzapl4opFogKHqwJk34vfsaKpfEhd1k5nw== @@ -2634,9 +2589,9 @@ acorn@^7.0.0: integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== acorn@^8.12.0, acorn@^8.12.1: - version "8.12.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" - integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + version "8.13.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.13.0.tgz#2a30d670818ad16ddd6a35d3842dacec9e5d7ca3" + integrity sha512-8zSiw54Oxrdym50NlZ9sUusyO1Z1ZchgRLWRaK6c86XJFClyCgFKetdowBg5bKxyp/u+CDBJG4Mpp0m3HLZl9w== agent-base@^7.0.2, agent-base@^7.1.0, agent-base@^7.1.1: version "7.1.1" @@ -2950,11 +2905,11 @@ available-typed-arrays@^1.0.7: possible-typed-array-names "^1.0.0" axe-core@^4.2.0, axe-core@^4.3.3: - version "4.10.0" - resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.10.0.tgz#d9e56ab0147278272739a000880196cdfe113b59" - integrity sha512-Mr2ZakwQ7XUAjp7pAwQWRhhK8mQQ6JAaNWSjmjxil0R8BPioMtQsTLOolGYkji1rcL++3dCqZA3zWqpT+9Ew6g== + version "4.10.1" + resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.10.1.tgz#7d2589b0183f05b0f23e55c2f4cdf97b5bdc66d9" + integrity sha512-qPC9o+kD8Tir0lzNGLeghbOrWMr3ZJpaRlCIb6Uobt/7N4FiEDvqUMnxzCHRHmg8vOg14kr5gVNyScRmbMaJ9g== -b4a@^1.6.4, b4a@^1.6.6: +b4a@^1.6.4: version "1.6.7" resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.6.7.tgz#a99587d4ebbfbd5a6e3b21bdb5d5fa385767abe4" integrity sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg== @@ -3001,11 +2956,10 @@ bare-path@^2.0.0, bare-path@^2.1.0: bare-os "^2.1.0" bare-stream@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/bare-stream/-/bare-stream-2.3.0.tgz#5bef1cab8222517315fca1385bd7f08dff57f435" - integrity sha512-pVRWciewGUeCyKEuRxwv06M079r+fRjAQjBEK2P6OYGrO43O+Z0LrPZZEjlc4mB6C2RpZ9AxJ1s7NLEtOHO6eA== + version "2.3.1" + resolved "https://registry.yarnpkg.com/bare-stream/-/bare-stream-2.3.1.tgz#812d48d5ddcbcbc44f8493d2dd00aa5e3604373b" + integrity sha512-Vm8kAeOcfzHPTH8sq0tHBnUqYrkXdroaBVVylqFT4cF5wnMfKEIxxy2jIGu2zKVNl9P8MAP9XBWwXJ9N2+jfEw== dependencies: - b4a "^1.6.6" streamx "^2.20.0" base64-js@^1.3.1: @@ -3532,11 +3486,11 @@ cookies@~0.9.0: keygrip "~1.1.0" cosmiconfig-typescript-loader@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-5.0.0.tgz#0d3becfe022a871f7275ceb2397d692e06045dc8" - integrity sha512-+8cK7jRAReYkMwMiG+bxhcNKiHJDM6bR9FD/nGBXOWdMLuYawjF5cGrtLilJ+LGd3ZjCXnJjR5DkfWPoIVlqJA== + version "5.1.0" + resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-5.1.0.tgz#d8d02bff04e63faa2dc794d618168bd764c704be" + integrity sha512-7PtBB+6FdsOvZyJtlF3hEPpACq7RQX6BVGsgC7/lfVXnKMvNCu/XY3ykreqG5w/rBNdu2z8LCIKoF3kpHHdHlA== dependencies: - jiti "^1.19.1" + jiti "^1.21.6" cosmiconfig@^9.0.0: version "9.0.0" @@ -3562,14 +3516,6 @@ css-functions-list@^3.2.3: resolved "https://registry.yarnpkg.com/css-functions-list/-/css-functions-list-3.2.3.tgz#95652b0c24f0f59b291a9fc386041a19d4f40dbe" integrity sha512-IQOkD3hbR5KrN93MtcYuad6YPuTSUhntLHDuLEbFWE+ff2/XSZNdZG+LcbbIW5AXKg/WFIfYItIzVoHngHXZzA== -css-tree@2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-2.3.1.tgz#10264ce1e5442e8572fc82fbe490644ff54b5c20" - integrity sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw== - dependencies: - mdn-data "2.0.30" - source-map-js "^1.0.1" - css-tree@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-3.0.0.tgz#079c7b87e465a28cedbc826502f9a227213db0f3" @@ -3873,21 +3819,22 @@ detective-typescript@^13.0.0: node-source-walk "^7.0.0" detective-vue2@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/detective-vue2/-/detective-vue2-2.0.3.tgz#4a9d54de105cf744c05cd7a886c468c17813be51" - integrity sha512-AgWdSfVnft8uPGnUkdvE1EDadEENDCzoSRMt2xZfpxsjqVO617zGWXbB8TGIxHaqHz/nHa6lOSgAB8/dt0yEug== + version "2.1.0" + resolved "https://registry.yarnpkg.com/detective-vue2/-/detective-vue2-2.1.0.tgz#d8744e1d19aa4dcabc2ff9dcce4fbd8adfe3d12b" + integrity sha512-IHQVhwk7dKaJ+GHBsL27mS9NRO1/vLZJPSODqtJgKquij0/UL8NvrbXbADbYeTkwyh1ReW/v9u9IRyEO5dvGZg== dependencies: - "@vue/compiler-sfc" "^3.4.27" + "@dependents/detective-less" "^5.0.0" + "@vue/compiler-sfc" "^3.5.12" detective-es6 "^5.0.0" detective-sass "^6.0.0" detective-scss "^5.0.0" detective-stylus "^5.0.0" detective-typescript "^13.0.0" -devtools-protocol@0.0.1342118: - version "0.0.1342118" - resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1342118.tgz#ea136fc1701572c0830233dcb414dc857e582e0a" - integrity sha512-75fMas7PkYNDTmDyb6PRJCH7ILmHLp+BhrZGeMsa4bCh40DTxgCz2NRy5UDzII4C5KuD0oBMZ9vXKhEl6UD/3w== +devtools-protocol@0.0.1354347: + version "0.0.1354347" + resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1354347.tgz#5cb509610b8f61fc69a31e5c810d5bed002d85ea" + integrity sha512-BlmkSqV0V84E2WnEnoPnwyix57rQxAM5SKJjf4TbYOCGLAWtz8CDH8RIaGOjPgPCXo2Mce3kxSY497OySidY3Q== didyoumean2@4.1.0: version "4.1.0" @@ -4630,9 +4577,9 @@ fast-levenshtein@^2.0.6: integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fast-uri@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.2.tgz#d78b298cf70fd3b752fd951175a3da6a7b48f024" - integrity sha512-GR6f0hD7XXyNJa25Tb9BuIdN0tdr+0BMi6/CJPH3wJO1JjNG3n/VsSw38AwRdKZABm8lGbPfakLRkYzx2V9row== + version "3.0.3" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.3.tgz#892a1c91802d5d7860de728f18608a0573142241" + integrity sha512-aLrHthzCjH5He4Z2H9YZ+v6Ujb9ocRuW6ZzkJQOrTxleEijANq4v1TsaPaVG1PZcuurEzrLcWRyYBYXD5cEiaw== fastest-levenshtein@^1.0.16: version "1.0.16" @@ -5590,7 +5537,7 @@ is-plain-obj@^2.0.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== -is-plain-object@5.0.0, is-plain-object@^5.0.0: +is-plain-object@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== @@ -5757,7 +5704,7 @@ jackspeak@2.1.1, jackspeak@^4.0.1: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" -jiti@^1.19.1: +jiti@^1.21.6: version "1.21.6" resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.6.tgz#6c7f7398dd4b3142767f9a168af2f317a428d268" integrity sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w== @@ -6487,11 +6434,6 @@ mdast-util-to-string@^3.0.0, mdast-util-to-string@^3.1.0: dependencies: "@types/mdast" "^3.0.0" -mdn-data@2.0.30: - version "2.0.30" - resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.30.tgz#ce4df6f80af6cfbe218ecd5c552ba13c4dfa08cc" - integrity sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA== - mdn-data@2.10.0: version "2.10.0" resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.10.0.tgz#701da407f8fbc7a42aa0ba0c149ec897daef8986" @@ -7427,9 +7369,9 @@ pend@~1.2.0: integrity sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg== picocolors@^1.0.0, picocolors@^1.0.1, picocolors@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59" - integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw== + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.3.1: version "2.3.1" @@ -7676,28 +7618,28 @@ punycode@^2.1.0, punycode@^2.3.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== -puppeteer-core@23.5.3, puppeteer-core@^23.2.0: - version "23.5.3" - resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-23.5.3.tgz#f53af458d59d08ec256d56d17689818592d9166a" - integrity sha512-V58MZD/B3CwkYsqSEQlHKbavMJptF04fzhMdUpiCRCmUVhwZNwSGEPhaiZ1f8I3ABQUirg3VNhXVB6Z1ubHXtQ== +puppeteer-core@23.6.0, puppeteer-core@^23.2.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-23.6.0.tgz#a3e1e09c05f47fb8ca2bc9d4ca200d18e3704303" + integrity sha512-se1bhgUpR9C529SgHGr/eyT92mYyQPAhA2S9pGtGrVG2xob9qE6Pbp7TlqiSPlnnY1lINqhn6/67EwkdzOmKqQ== dependencies: "@puppeteer/browsers" "2.4.0" chromium-bidi "0.8.0" debug "^4.3.7" - devtools-protocol "0.0.1342118" + devtools-protocol "0.0.1354347" typed-query-selector "^2.12.0" ws "^8.18.0" puppeteer@^23.2.0: - version "23.5.3" - resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-23.5.3.tgz#aba7fbf39d8d9bb0c8d48a78e26ef169ed812685" - integrity sha512-FghmfBsr/UUpe48OiCg1gV3W4vVfQJKjQehbF07SjnQvEpWcvPTah1nykfGWdOQQ1ydJPIXcajzWN7fliCU3zw== + version "23.6.0" + resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-23.6.0.tgz#7a3c01e7b6a43a950f3e13eb48a335f78a358768" + integrity sha512-l+Fgo8SVFSd51STtq2crz8t1Y3VXowsuR4zfR64qDOn6oggz7YIZauWiNR4IJjczQ6nvFs3S4cgng55/nesxTQ== dependencies: "@puppeteer/browsers" "2.4.0" chromium-bidi "0.8.0" cosmiconfig "^9.0.0" - devtools-protocol "0.0.1342118" - puppeteer-core "23.5.3" + devtools-protocol "0.0.1354347" + puppeteer-core "23.6.0" typed-query-selector "^2.12.0" qs@6.13.0, qs@^6.5.2: @@ -8540,7 +8482,7 @@ stylelint-config-standard@^36.0.0: dependencies: stylelint-config-recommended "^14.0.1" -stylelint-scss@6.8.1: +stylelint-scss@6.8.1, stylelint-scss@^6.4.0: version "6.8.1" resolved "https://registry.yarnpkg.com/stylelint-scss/-/stylelint-scss-6.8.1.tgz#b6554d93f2ea0bf37ffdcae571bbfaa35d79ba8a" integrity sha512-al+5eRb72bKrFyVAY+CLWKUMX+k+wsDCgyooSfhISJA2exqnJq1PX1iIIpdrvhu3GtJgNJZl9/BIW6EVSMCxdg== @@ -8554,19 +8496,6 @@ stylelint-scss@6.8.1: postcss-selector-parser "^6.1.2" postcss-value-parser "^4.2.0" -stylelint-scss@^6.4.0: - version "6.7.0" - resolved "https://registry.yarnpkg.com/stylelint-scss/-/stylelint-scss-6.7.0.tgz#df9c2bcd20c555c5670914f23bb983c94bfbb0e3" - integrity sha512-RFIa2A+pVWS5wjNT+whtK7wsbZEWazyqesCuSaPbPlZ8lh2TujwVJSnCYJijg6ChZzwI8pZPRZS1L6A9aCbXDg== - dependencies: - css-tree "2.3.1" - is-plain-object "5.0.0" - known-css-properties "^0.34.0" - postcss-media-query-parser "^0.2.3" - postcss-resolve-nested-selector "^0.1.6" - postcss-selector-parser "^6.1.2" - postcss-value-parser "^4.2.0" - stylelint@16.10.0: version "16.10.0" resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-16.10.0.tgz#452b42a5d82f2ad910954eb2ba2b3a2ec583cd75" @@ -8714,11 +8643,9 @@ telejson@^7.2.0: memoizerific "^1.11.3" text-decoder@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/text-decoder/-/text-decoder-1.2.0.tgz#85f19d4d5088e0b45cd841bdfaeac458dbffeefc" - integrity sha512-n1yg1mOj9DNpk3NeZOx7T6jchTbyJS3i3cucbNN6FcdPriMZx7NsgrGpWWdWZZGxD7ES1XB+3uoqHMgOKaN+fg== - dependencies: - b4a "^1.6.4" + version "1.2.1" + resolved "https://registry.yarnpkg.com/text-decoder/-/text-decoder-1.2.1.tgz#e173f5121d97bfa3ff8723429ad5ba92e1ead67e" + integrity sha512-x9v3H/lTKIJKQQe7RPQkLfKAnc9lUTkWDypIQgTzPJAq+5/GCDHonmshfvlsNSj58yyshbIJJDLmU15qNERrXQ== text-extensions@^2.0.0: version "2.4.0" @@ -8741,9 +8668,9 @@ tiny-invariant@^1.3.1, tiny-invariant@^1.3.3: integrity sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg== tinyexec@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/tinyexec/-/tinyexec-0.3.0.tgz#ed60cfce19c17799d4a241e06b31b0ec2bee69e6" - integrity sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg== + version "0.3.1" + resolved "https://registry.yarnpkg.com/tinyexec/-/tinyexec-0.3.1.tgz#0ab0daf93b43e2c211212396bdb836b468c97c98" + integrity sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ== tinyrainbow@^1.2.0: version "1.2.0" @@ -8845,9 +8772,9 @@ tslib@^1.8.1: integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== tslib@^2.0.1, tslib@^2.4.0, tslib@^2.6.3: - version "2.7.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" - integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== + version "2.8.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.0.tgz#d124c86c3c05a40a91e6fdea4021bd31d377971b" + integrity sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA== tsscmp@1.0.6: version "1.0.6" From 955708df96c64ce92c13c5a1f852b605f4eb963d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:13:53 +0200 Subject: [PATCH 7/9] chore(deps): update dependency @sbb-esta/lyne-design-tokens to v1.3.0 (#3162) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1e83f85c5c..d64abcb9ca 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "@lit/react": "1.0.6", "@open-wc/lit-helpers": "0.7.0", "@open-wc/testing": "4.0.0", - "@sbb-esta/lyne-design-tokens": "1.2.1", + "@sbb-esta/lyne-design-tokens": "1.3.0", "@storybook/addon-a11y": "8.3.6", "@storybook/addon-actions": "8.3.6", "@storybook/addon-essentials": "8.3.6", diff --git a/yarn.lock b/yarn.lock index 80d5fee539..4ec8007638 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1194,10 +1194,10 @@ argparse "~1.0.9" string-argv "~0.3.1" -"@sbb-esta/lyne-design-tokens@1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@sbb-esta/lyne-design-tokens/-/lyne-design-tokens-1.2.1.tgz#678e560d5c78e03f35c39e07c4e59039938eabf0" - integrity sha512-IcOl5Bm3bUBdO33LmffezBHfcXGAvckzoUGdaD7aoLTivrZy3q8lfjdJJShYBvfmOmb6gRtX6A9XpAhEPFtlTg== +"@sbb-esta/lyne-design-tokens@1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@sbb-esta/lyne-design-tokens/-/lyne-design-tokens-1.3.0.tgz#afd071ad9fe1794eabd433f286796358d10faa24" + integrity sha512-zAG1RrQXwqtO7Tbp4U2DbvX/DWhqNVVzEv6lTmdOS2L3TZYmOD3XGtO3YW3OQAcW0MFCGLriFhoW8k07ikJ/Aw== "@sinonjs/commons@^3.0.1": version "3.0.1" From 552776017c859c6ff19ac2063e4a5f3617919037 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:17:20 +0200 Subject: [PATCH 8/9] chore(main): release 1.13.0 (#3145) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 16 ++++++++++++++++ package.json | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bac44b9758..93247c8524 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,4 +1,4 @@ { "last-release-sha": "fed492ab6cb4e807cffcb07e26bf25ab585f1c6b", - ".": "1.12.1" + ".": "1.13.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 436356e721..1b0b1b17a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,22 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [1.13.0](https://github.com/sbb-design-systems/lyne-components/compare/v1.12.1...v1.13.0) (2024-10-21) + + +### Features + +* **sbb-file-selector:** implement native form support ([#3085](https://github.com/sbb-design-systems/lyne-components/issues/3085)) ([449ee6d](https://github.com/sbb-design-systems/lyne-components/commit/449ee6d27667dcd944a4f17c6b91da0a1d250534)) +* **sbb-header:** introduce active state ([#3154](https://github.com/sbb-design-systems/lyne-components/issues/3154)) ([ffdeec4](https://github.com/sbb-design-systems/lyne-components/commit/ffdeec4e6d844b4af5b521c0af3742df207c0f1d)) +* **sbb-paginator:** add disabled property ([#3130](https://github.com/sbb-design-systems/lyne-components/issues/3130)) ([d43f64c](https://github.com/sbb-design-systems/lyne-components/commit/d43f64c3b306633fd1c663c81e7fc7336dbe1cf3)) +* **sbb-select:** implement native form support ([#3101](https://github.com/sbb-design-systems/lyne-components/issues/3101)) ([b9156ab](https://github.com/sbb-design-systems/lyne-components/commit/b9156ab70ffe14d543606194df305f9e7d4a1375)) + + +### Bug Fixes + +* **sbb-loading-indicator:** center component into his box ([#3144](https://github.com/sbb-design-systems/lyne-components/issues/3144)) ([22978f6](https://github.com/sbb-design-systems/lyne-components/commit/22978f6776598c7a457adcee4e9665229550caed)) +* **sbb-teaser:** css variable typo ([#3143](https://github.com/sbb-design-systems/lyne-components/issues/3143)) ([d3e4fb3](https://github.com/sbb-design-systems/lyne-components/commit/d3e4fb3c527059574195cf58686ca6bf3a599cdc)) + ## [1.12.1](https://github.com/sbb-design-systems/lyne-components/compare/v1.12.0...v1.12.1) (2024-10-03) diff --git a/package.json b/package.json index d64abcb9ca..eae1879abf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sbb-esta/lyne-elements", - "version": "1.12.1", + "version": "1.13.0", "description": "Lyne Design System", "keywords": [ "design system", From e61bca5ccb1c1c339a8e989bb0fd9ad33e27df34 Mon Sep 17 00:00:00 2001 From: Lukas Spirig Date: Mon, 21 Oct 2024 14:18:45 +0200 Subject: [PATCH 9/9] fix: switch to standard decorators and tighten property types (#3121) This PR switches from experimental decorators to standard decorators. It additionally tightens the types of properties and applies `forceType` where necessary. --- eslint.config.js | 2 - package.json | 3 +- .../journey-summary/journey-summary.ts | 22 ++- .../journey-summary/readme.md | 18 +- src/elements-experimental/package.json | 3 +- .../pearl-chain-time/pearl-chain-time.ts | 30 ++- .../pearl-chain-time/readme.md | 14 +- .../pearl-chain-vertical-item.ts | 9 +- .../pearl-chain-vertical-item/readme.md | 4 +- .../pearl-chain-vertical.ts | 3 +- .../pearl-chain/pearl-chain.ts | 10 +- .../pearl-chain/readme.md | 10 +- .../timetable-duration/readme.md | 2 +- .../timetable-duration/timetable-duration.ts | 8 +- .../timetable-row/readme.md | 26 +-- .../timetable-row/timetable-row.ts | 38 ++-- src/elements-experimental/vite.config.ts | 2 +- src/elements/accordion/accordion.ts | 49 +++-- src/elements/action-group/action-group.ts | 13 +- src/elements/alert/alert-group/alert-group.ts | 14 +- src/elements/alert/alert-group/readme.md | 2 +- src/elements/alert/alert/alert.ts | 42 +++-- src/elements/alert/alert/readme.md | 28 +-- ...complete-grid-button.snapshot.spec.snap.js | 2 - .../autocomplete-grid-button.ts | 22 ++- .../autocomplete-grid-button/readme.md | 2 +- ...tocomplete-grid-cell.snapshot.spec.snap.js | 1 - .../autocomplete-grid-cell.ts | 3 +- ...mplete-grid-optgroup.snapshot.spec.snap.js | 1 - .../autocomplete-grid-optgroup.ts | 3 +- .../autocomplete-grid-optgroup/readme.md | 2 +- .../autocomplete-grid-option.ts | 3 +- .../autocomplete-grid-option/readme.md | 12 +- ...utocomplete-grid-row.snapshot.spec.snap.js | 1 - .../autocomplete-grid-row.ts | 3 +- .../autocomplete-grid.snapshot.spec.snap.js | 4 - .../autocomplete-grid/autocomplete-grid.ts | 3 +- .../autocomplete-grid/readme.md | 18 +- .../autocomplete/autocomplete-base-element.ts | 38 +--- src/elements/autocomplete/autocomplete.ts | 3 +- src/elements/autocomplete/readme.md | 18 +- .../breadcrumb-group/breadcrumb-group.ts | 3 +- .../breadcrumb-group.visual.spec.ts | 5 +- .../breadcrumb/breadcrumb/breadcrumb.ts | 5 +- .../breadcrumb/breadcrumb.visual.spec.ts | 10 +- src/elements/breadcrumb/breadcrumb/readme.md | 16 +- .../button/button-link/button-link.ts | 3 +- src/elements/button/button-link/readme.md | 24 +-- .../button/button-static/button-static.ts | 3 +- src/elements/button/button-static/readme.md | 12 +- src/elements/button/button/button.ts | 3 +- src/elements/button/button/readme.md | 22 +-- src/elements/button/common/button-common.ts | 10 +- .../mini-button-group/mini-button-group.ts | 10 +- .../button/mini-button-group/readme.md | 2 +- .../mini-button/mini-button-base-element.ts | 3 +- .../button/mini-button/mini-button.ts | 3 +- src/elements/button/mini-button/readme.md | 20 +- .../button/secondary-button-link/readme.md | 24 +-- .../secondary-button-link.ts | 3 +- .../button/secondary-button-static/readme.md | 12 +- .../secondary-button-static.ts | 3 +- .../button/secondary-button/readme.md | 22 +-- .../secondary-button/secondary-button.ts | 3 +- .../button/tertiary-button-link/readme.md | 24 +-- .../tertiary-button-link.ts | 3 +- .../button/tertiary-button-static/readme.md | 12 +- .../tertiary-button-static.ts | 3 +- src/elements/button/tertiary-button/readme.md | 22 +-- .../button/tertiary-button/tertiary-button.ts | 3 +- .../button/transparent-button-link/readme.md | 24 +-- .../transparent-button-link.ts | 3 +- .../transparent-button-static/readme.md | 12 +- .../transparent-button-static.ts | 3 +- .../button/transparent-button/readme.md | 22 +-- .../transparent-button/transparent-button.ts | 3 +- src/elements/calendar/calendar.ts | 22 ++- src/elements/calendar/readme.md | 18 +- src/elements/card/card-badge/card-badge.ts | 5 +- src/elements/card/card-button/card-button.ts | 3 +- src/elements/card/card-button/readme.md | 14 +- src/elements/card/card-link/card-link.ts | 3 +- src/elements/card/card-link/readme.md | 16 +- src/elements/card/card/card.ts | 14 +- .../card/common/card-action-common.ts | 2 +- .../checkbox/checkbox-group/checkbox-group.ts | 15 +- .../checkbox/checkbox-group/readme.md | 2 +- .../checkbox/checkbox-panel/checkbox-panel.ts | 14 +- src/elements/checkbox/checkbox/checkbox.ts | 18 +- src/elements/checkbox/checkbox/readme.md | 2 +- .../checkbox/common/checkbox-common.ts | 7 +- src/elements/chip/chip.ts | 7 +- src/elements/clock/clock.ts | 5 +- src/elements/container/container/container.ts | 14 +- src/elements/container/sticky-bar/readme.md | 6 +- .../container/sticky-bar/sticky-bar.ts | 5 +- .../core/base-elements/action-base-element.ts | 3 +- .../base-elements/button-base-element.spec.ts | 9 +- .../core/base-elements/button-base-element.ts | 11 +- .../base-elements/link-base-element.spec.ts | 9 +- .../core/base-elements/link-base-element.ts | 25 ++- src/elements/core/decorators.ts | 4 + src/elements/core/decorators/base.ts | 29 +++ src/elements/core/decorators/force-type.ts | 47 +++++ src/elements/core/decorators/get-override.ts | 29 +++ .../core/decorators/handle-distinct-change.ts | 32 ++++ .../core/decorators/omit-empty-converter.ts | 15 ++ src/elements/core/mixins/disabled-mixin.ts | 24 +-- .../mixins/form-associated-checkbox-mixin.ts | 2 +- .../core/mixins/form-associated-mixin.ts | 2 +- .../core/mixins/named-slot-list-mixin.ts | 4 +- src/elements/core/mixins/negative-mixin.ts | 8 +- src/elements/core/mixins/panel-mixin.ts | 17 +- src/elements/core/mixins/required-mixin.ts | 3 +- .../datepicker/common/datepicker-button.ts | 9 +- .../datepicker-next-day.ts | 3 +- .../datepicker/datepicker-next-day/readme.md | 16 +- .../datepicker-previous-day.ts | 3 +- .../datepicker-previous-day/readme.md | 16 +- .../datepicker-toggle/datepicker-toggle.ts | 22 ++- .../datepicker/datepicker-toggle/readme.md | 10 +- .../datepicker/datepicker/datepicker.ts | 24 +-- src/elements/datepicker/datepicker/readme.md | 18 +- .../dialog/dialog-actions/dialog-actions.ts | 3 +- .../dialog/dialog-content/dialog-content.ts | 3 +- .../dialog/dialog-title/dialog-title.ts | 20 +- src/elements/dialog/dialog-title/readme.md | 20 +- src/elements/dialog/dialog/dialog.ts | 6 +- src/elements/dialog/dialog/readme.md | 12 +- src/elements/divider/divider.ts | 5 +- .../expansion-panel-content.ts | 3 +- .../expansion-panel-header.ts | 3 +- .../expansion-panel-header/readme.md | 18 +- .../expansion-panel/expansion-panel.ts | 14 +- .../expansion-panel/expansion-panel/readme.md | 16 +- src/elements/file-selector/file-selector.ts | 27 ++- src/elements/file-selector/readme.md | 6 +- .../flip-card-details/flip-card-details.ts | 3 +- .../flip-card-summary/flip-card-summary.ts | 5 +- src/elements/flip-card/flip-card/flip-card.ts | 10 +- src/elements/flip-card/flip-card/readme.md | 2 +- src/elements/footer/footer.ts | 16 +- src/elements/footer/readme.md | 2 +- src/elements/form-error/form-error.ts | 3 +- .../form-field-clear/form-field-clear.ts | 3 +- .../form-field/form-field-clear/readme.md | 14 +- .../form-field/form-field/form-field.ts | 34 ++-- src/elements/form-field/form-field/readme.md | 6 +- .../header/common/header-action-common.ts | 6 +- .../header/header-button/header-button.ts | 5 +- src/elements/header/header-button/readme.md | 16 +- .../header/header-link/header-link.ts | 3 +- src/elements/header/header-link/readme.md | 18 +- src/elements/header/header/header.ts | 17 +- src/elements/icon/icon-base.ts | 21 ++- src/elements/icon/icon-name-mixin.ts | 7 +- src/elements/icon/icon.ts | 13 +- src/elements/icon/readme.md | 2 +- src/elements/image/image.ts | 60 ++++-- src/elements/image/readme.md | 12 +- src/elements/journey-header/journey-header.ts | 20 +- src/elements/journey-header/readme.md | 16 +- src/elements/lead-container/lead-container.ts | 3 +- .../link-list/common/link-list-base.ts | 13 +- .../link-list-anchor/link-list-anchor.ts | 3 +- .../link-list/link-list-anchor/readme.md | 12 +- src/elements/link-list/link-list/link-list.ts | 7 +- src/elements/link-list/link-list/readme.md | 16 +- .../block-link-button/block-link-button.ts | 3 +- src/elements/link/block-link-button/readme.md | 22 +-- .../block-link-static/block-link-static.ts | 3 +- src/elements/link/block-link-static/readme.md | 12 +- src/elements/link/block-link/block-link.ts | 3 +- src/elements/link/block-link/readme.md | 22 +-- src/elements/link/common/block-link-common.ts | 12 +- src/elements/link/common/link-common.ts | 4 +- src/elements/link/link-button/link-button.ts | 3 +- src/elements/link/link-button/readme.md | 20 +- src/elements/link/link-static/link-static.ts | 3 +- src/elements/link/link/link.ts | 3 +- src/elements/link/link/readme.md | 20 +- .../loading-indicator/loading-indicator.ts | 9 +- src/elements/loading-indicator/readme.md | 10 +- src/elements/logo/logo.ts | 10 +- src/elements/logo/readme.md | 10 +- src/elements/map-container/map-container.ts | 9 +- .../menu/common/menu-action-common.ts | 9 +- src/elements/menu/menu-button/menu-button.ts | 3 +- src/elements/menu/menu-button/readme.md | 20 +- src/elements/menu/menu-link/menu-link.ts | 3 +- src/elements/menu/menu-link/readme.md | 22 +-- src/elements/menu/menu/menu.ts | 8 +- src/elements/menu/menu/readme.md | 2 +- src/elements/message/message.ts | 10 +- src/elements/message/readme.md | 8 +- .../common/navigation-action-common.ts | 4 +- .../navigation-button/navigation-button.ts | 3 +- .../navigation/navigation-button/readme.md | 4 +- .../navigation-link/navigation-link.ts | 5 +- .../navigation/navigation-link/readme.md | 12 +- .../navigation-list/navigation-list.ts | 9 +- .../navigation/navigation-list/readme.md | 6 +- .../navigation-marker/navigation-marker.ts | 5 +- .../navigation/navigation-marker/readme.md | 6 +- .../navigation-section/navigation-section.ts | 19 +- .../navigation/navigation-section/readme.md | 6 +- .../navigation/navigation/navigation.ts | 13 +- src/elements/navigation/navigation/readme.md | 2 +- src/elements/notification/notification.ts | 21 ++- src/elements/notification/readme.md | 2 +- .../optgroup.snapshot.spec.snap.js | 1 - .../option/optgroup/optgroup-base-element.ts | 21 ++- src/elements/option/optgroup/optgroup.ts | 3 +- src/elements/option/optgroup/readme.md | 2 +- .../option/option/option-base-element.ts | 31 ++-- src/elements/option/option/option.ts | 3 +- src/elements/option/option/readme.md | 12 +- src/elements/overlay/overlay-base-element.ts | 5 +- src/elements/overlay/overlay.ts | 25 ++- src/elements/overlay/readme.md | 18 +- src/elements/package.json | 3 +- src/elements/paginator/paginator.ts | 10 +- .../popover-trigger/popover-trigger.ts | 3 +- .../popover/popover-trigger/readme.md | 20 +- src/elements/popover/popover/popover.ts | 47 +++-- src/elements/popover/popover/readme.md | 18 +- .../common/radio-button-common.ts | 17 +- .../radio-button-group/radio-button-group.ts | 20 +- .../radio-button/radio-button-group/readme.md | 4 +- .../radio-button-panel/radio-button-panel.ts | 18 +- .../radio-button/radio-button-panel/readme.md | 2 +- .../radio-button/radio-button/radio-button.ts | 18 +- .../radio-button/radio-button/readme.md | 2 +- .../screen-reader-only/screen-reader-only.ts | 3 +- src/elements/select/readme.md | 2 +- src/elements/select/select.ts | 19 +- .../selection-expansion-panel.ts | 15 +- src/elements/signet/readme.md | 8 +- src/elements/signet/signet.ts | 10 +- src/elements/skiplink-list/readme.md | 8 +- src/elements/skiplink-list/skiplink-list.ts | 11 +- src/elements/slider/readme.md | 6 +- src/elements/slider/slider.ts | 19 +- src/elements/status/readme.md | 12 +- src/elements/status/status.ts | 15 +- src/elements/stepper/step-label/readme.md | 4 +- src/elements/stepper/step-label/step-label.ts | 3 +- src/elements/stepper/step/step.ts | 3 +- src/elements/stepper/stepper/stepper.ts | 12 +- .../table/table-wrapper/table-wrapper.ts | 3 +- src/elements/tabs/tab-group/tab-group.ts | 10 +- src/elements/tabs/tab-label/readme.md | 14 +- src/elements/tabs/tab-label/tab-label.ts | 15 +- src/elements/tabs/tab/tab.ts | 3 +- src/elements/tag/tag-group/readme.md | 2 +- src/elements/tag/tag-group/tag-group.ts | 14 +- src/elements/tag/tag/readme.md | 24 +-- src/elements/tag/tag/tag.ts | 24 ++- src/elements/teaser-hero/readme.md | 20 +- src/elements/teaser-hero/teaser-hero.ts | 17 +- .../common/teaser-product-common.ts | 4 +- .../teaser-product-static.ts | 3 +- .../teaser-product/teaser-product/readme.md | 18 +- .../teaser-product/teaser-product.ts | 5 +- src/elements/teaser/readme.md | 14 +- src/elements/teaser/teaser.ts | 17 +- src/elements/time-input/time-input.ts | 5 +- .../timetable-occupancy-icon/readme.md | 10 +- .../timetable-occupancy-icon.ts | 5 +- src/elements/timetable-occupancy/readme.md | 10 +- .../timetable-occupancy.ts | 11 +- src/elements/title/readme.md | 12 +- src/elements/title/title-base.ts | 12 +- src/elements/title/title.ts | 3 +- src/elements/toast/readme.md | 2 +- src/elements/toast/toast.ts | 17 +- src/elements/toggle-check/readme.md | 22 +-- src/elements/toggle-check/toggle-check.ts | 15 +- src/elements/toggle/toggle-option/readme.md | 12 +- .../toggle/toggle-option/toggle-option.ts | 11 +- src/elements/toggle/toggle/readme.md | 2 +- src/elements/toggle/toggle/toggle.ts | 22 +-- .../train-blocked-passage.ts | 3 +- .../train/train-formation/train-formation.ts | 16 +- src/elements/train/train-wagon/readme.md | 10 +- src/elements/train/train-wagon/train-wagon.ts | 32 ++-- src/elements/train/train/readme.md | 14 +- src/elements/train/train/train.ts | 21 ++- .../visual-checkbox/visual-checkbox.ts | 14 +- src/elements/vite.config.ts | 2 +- src/react-experimental/package.json | 3 +- src/react-experimental/vite.config.ts | 1 + src/react/package.json | 3 +- src/react/vite.config.ts | 8 +- .../src/components/overview/overview.ts | 3 +- .../fullscreen-diff/fullscreen-diff.ts | 8 +- .../test-case/image-diff/image-diff.ts | 14 +- .../test-case-filter/test-case-filter.ts | 5 +- .../src/components/test-case/test-case.ts | 20 +- .../test-title-chip-list.ts | 3 +- src/visual-regression-app/src/main.ts | 5 +- tools/eslint/class-decorator-position-rule.ts | 45 +++++ tools/eslint/decorator-order-rule.ts | 77 ++++++++ tools/eslint/index.ts | 4 + .../missing-component-documentation-rule.ts | 7 +- ...perty-decorator-setter-initializer-rule.ts | 56 ++++++ tools/eslint/property-type-rule.ts | 171 ++++++++++++++++++ tools/node-esm-hook/typescript-hook.js | 119 ++++++++---- tools/vite/index.ts | 1 + tools/vite/package-json-template.ts | 2 + tools/vite/typescript-transform.ts | 42 +++++ tsconfig.json | 6 +- vite.config.ts | 3 + yarn.lock | 5 + 314 files changed, 2451 insertions(+), 1439 deletions(-) create mode 100644 src/elements/core/decorators/base.ts create mode 100644 src/elements/core/decorators/force-type.ts create mode 100644 src/elements/core/decorators/get-override.ts create mode 100644 src/elements/core/decorators/handle-distinct-change.ts create mode 100644 src/elements/core/decorators/omit-empty-converter.ts create mode 100644 tools/eslint/class-decorator-position-rule.ts create mode 100644 tools/eslint/decorator-order-rule.ts create mode 100644 tools/eslint/property-decorator-setter-initializer-rule.ts create mode 100644 tools/eslint/property-type-rule.ts create mode 100644 tools/vite/typescript-transform.ts diff --git a/eslint.config.js b/eslint.config.js index 049e8ec0ee..08674551d4 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -171,8 +171,6 @@ export default [ }, }, ], - // TODO: Activate with standard decorators - 'lyne/property-decorator-accessor-rule': 'off', }, }, { diff --git a/package.json b/package.json index eae1879abf..2954c196a2 100644 --- a/package.json +++ b/package.json @@ -139,6 +139,7 @@ "stylelint-config-standard-scss": "13.1.0", "stylelint-scss": "6.8.1", "ts-lit-plugin": "2.0.2", + "tslib": "2.8.0", "typescript": "5.6.3", "typescript-eslint": "8.10.0", "urlpattern-polyfill": "10.0.0", @@ -161,7 +162,7 @@ }, "lint-staged": { "*.{js,ts,yaml,yml}": [ - "eslint --fix" + "eslint --fix --no-ignore" ], "*.scss": [ "stylelint --fix" diff --git a/src/elements-experimental/journey-summary/journey-summary.ts b/src/elements-experimental/journey-summary/journey-summary.ts index 6bcf6c054a..abd0593ea5 100644 --- a/src/elements-experimental/journey-summary/journey-summary.ts +++ b/src/elements-experimental/journey-summary/journey-summary.ts @@ -1,5 +1,6 @@ import { SbbLanguageController } from '@sbb-esta/lyne-elements/core/controllers.js'; import { defaultDateAdapter } from '@sbb-esta/lyne-elements/core/datetime.js'; +import { forceType } from '@sbb-esta/lyne-elements/core/decorators.js'; import { i18nTripDuration } from '@sbb-esta/lyne-elements/core/i18n.js'; import type { SbbDateLike } from '@sbb-esta/lyne-elements/core/interfaces/types'; import type { SbbTitleLevel } from '@sbb-esta/lyne-elements/title.js'; @@ -35,30 +36,35 @@ export interface InterfaceSbbJourneySummaryAttributes { * * @slot content - Use this slot to add `sbb-button`s or other interactive elements. */ +export @customElement('sbb-journey-summary') -export class SbbJourneySummaryElement extends LitElement { +class SbbJourneySummaryElement extends LitElement { public static override styles: CSSResultGroup = style; /** The trip prop */ - @property({ type: Object }) public trip!: InterfaceSbbJourneySummaryAttributes; + @property({ type: Object }) public accessor trip: InterfaceSbbJourneySummaryAttributes = null!; /** The tripBack prop */ @property({ attribute: 'trip-back', type: Object }) - public tripBack?: InterfaceSbbJourneySummaryAttributes; + public accessor tripBack: InterfaceSbbJourneySummaryAttributes = null!; /** * The RoundTrip prop. This prop controls if one or two arrows are displayed in the header. */ - @property({ attribute: 'round-trip', type: Boolean }) public roundTrip?: boolean; + @forceType() + @property({ attribute: 'round-trip', type: Boolean }) + public accessor roundTrip: boolean = false; /** Heading level of the journey header element (e.g. h1-h6). */ - @property({ attribute: 'header-level' }) public headerLevel: SbbTitleLevel = '3'; + @property({ attribute: 'header-level' }) public accessor headerLevel: SbbTitleLevel = '3'; /** * Per default, the current location has a pulsating animation. You can * disable the animation with this property. */ - @property({ attribute: 'disable-animation', type: Boolean }) public disableAnimation?: boolean; + @forceType() + @property({ attribute: 'disable-animation', type: Boolean }) + public accessor disableAnimation: boolean = false; /** * The Footpath attribute for rendering different icons @@ -66,7 +72,9 @@ export class SbbJourneySummaryElement extends LitElement { * false: render walk-icon * default: render walk-icon */ - @property({ attribute: 'a11y-footpath', type: Boolean }) public a11yFootpath?: boolean; + @forceType() + @property({ attribute: 'a11y-footpath', type: Boolean }) + public accessor a11yFootpath: boolean = false; /** A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. */ @property() diff --git a/src/elements-experimental/journey-summary/readme.md b/src/elements-experimental/journey-summary/readme.md index bce0f640f5..11c6625ef9 100644 --- a/src/elements-experimental/journey-summary/readme.md +++ b/src/elements-experimental/journey-summary/readme.md @@ -24,15 +24,15 @@ This is helpful if you need a specific state of the component. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------------------ | ------------------- | ------- | --------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `a11yFootpath` | `a11y-footpath` | public | `boolean \| undefined` | | The Footpath attribute for rendering different icons true: render a11y-icon false: render walk-icon default: render walk-icon | -| `disableAnimation` | `disable-animation` | public | `boolean \| undefined` | | Per default, the current location has a pulsating animation. You can disable the animation with this property. | -| `headerLevel` | `header-level` | public | `SbbTitleLevel` | `'3'` | Heading level of the journey header element (e.g. h1-h6). | -| `now` | `now` | public | `Date` | `null` | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. | -| `roundTrip` | `round-trip` | public | `boolean \| undefined` | | The RoundTrip prop. This prop controls if one or two arrows are displayed in the header. | -| `trip` | `trip` | public | `InterfaceSbbJourneySummaryAttributes` | | The trip prop | -| `tripBack` | `trip-back` | public | `InterfaceSbbJourneySummaryAttributes \| undefined` | | The tripBack prop | +| Name | Attribute | Privacy | Type | Default | Description | +| ------------------ | ------------------- | ------- | -------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- | +| `a11yFootpath` | `a11y-footpath` | public | `boolean` | `false` | The Footpath attribute for rendering different icons true: render a11y-icon false: render walk-icon default: render walk-icon | +| `disableAnimation` | `disable-animation` | public | `boolean` | `false` | Per default, the current location has a pulsating animation. You can disable the animation with this property. | +| `headerLevel` | `header-level` | public | `SbbTitleLevel` | `'3'` | Heading level of the journey header element (e.g. h1-h6). | +| `now` | `now` | public | `Date` | `null` | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. | +| `roundTrip` | `round-trip` | public | `boolean` | `false` | The RoundTrip prop. This prop controls if one or two arrows are displayed in the header. | +| `trip` | `trip` | public | `InterfaceSbbJourneySummaryAttributes` | `null!` | The trip prop | +| `tripBack` | `trip-back` | public | `InterfaceSbbJourneySummaryAttributes` | `null!` | The tripBack prop | ## Slots diff --git a/src/elements-experimental/package.json b/src/elements-experimental/package.json index d7bee1133d..d7ac52213e 100644 --- a/src/elements-experimental/package.json +++ b/src/elements-experimental/package.json @@ -14,7 +14,8 @@ "@sbb-esta/lyne-elements": "0.0.0-PLACEHOLDER" }, "dependencies": { - "lit": "0.0.0-LIT" + "lit": "0.0.0-LIT", + "tslib": "0.0.0-TSLIB" }, "publishConfig": { "access": "public" diff --git a/src/elements-experimental/pearl-chain-time/pearl-chain-time.ts b/src/elements-experimental/pearl-chain-time/pearl-chain-time.ts index 78cef0ed89..d01b54b99d 100644 --- a/src/elements-experimental/pearl-chain-time/pearl-chain-time.ts +++ b/src/elements-experimental/pearl-chain-time/pearl-chain-time.ts @@ -1,5 +1,6 @@ import { SbbLanguageController } from '@sbb-esta/lyne-elements/core/controllers.js'; import { defaultDateAdapter } from '@sbb-esta/lyne-elements/core/datetime.js'; +import { forceType } from '@sbb-esta/lyne-elements/core/decorators.js'; import { i18nArrival, i18nDeparture, @@ -22,8 +23,9 @@ import '../pearl-chain.js'; /** * Combined with `sbb-pearl-chain`, it displays walk time information. */ +export @customElement('sbb-pearl-chain-time') -export class SbbPearlChainTimeElement extends LitElement { +class SbbPearlChainTimeElement extends LitElement { public static override styles: CSSResultGroup = style; /** @@ -34,28 +36,40 @@ export class SbbPearlChainTimeElement extends LitElement { * to the total travel time. Example: departure 16:30, change at 16:40, * arrival at 17:00. So the change should have a duration of 33.33%. */ - @property({ type: Array }) public legs!: (Leg | PtRideLeg)[]; + @property({ type: Array }) public accessor legs: (Leg | PtRideLeg)[] = []; /** Prop to render the departure time - will be formatted as "H:mm" */ - @property({ attribute: 'departure-time' }) public departureTime?: string; + @forceType() + @property({ attribute: 'departure-time' }) + public accessor departureTime: string = ''; /** Prop to render the arrival time - will be formatted as "H:mm" */ - @property({ attribute: 'arrival-time' }) public arrivalTime?: string; + @forceType() + @property({ attribute: 'arrival-time' }) + public accessor arrivalTime: string = ''; /** Optional prop to render the walk time (in minutes) before departure */ - @property({ attribute: 'departure-walk', type: Number }) public departureWalk?: number; + @forceType() + @property({ attribute: 'departure-walk', type: Number }) + public accessor departureWalk: number = NaN; /** Optional prop to render the walk time (in minutes) after arrival */ - @property({ attribute: 'arrival-walk', type: Number }) public arrivalWalk?: number; + @forceType() + @property({ attribute: 'arrival-walk', type: Number }) + public accessor arrivalWalk: number = NaN; /** * Per default, the current location has a pulsating animation. You can * disable the animation with this property. */ - @property({ attribute: 'disable-animation', type: Boolean }) public disableAnimation?: boolean; + @forceType() + @property({ attribute: 'disable-animation', type: Boolean }) + public accessor disableAnimation: boolean = false; /** Optional prop to render wheelchair-small instead of walk-small */ - @property({ attribute: 'a11y-footpath', type: Boolean }) public a11yFootpath?: boolean; + @forceType() + @property({ attribute: 'a11y-footpath', type: Boolean }) + public accessor a11yFootpath: boolean = false; /** A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. */ @property() diff --git a/src/elements-experimental/pearl-chain-time/readme.md b/src/elements-experimental/pearl-chain-time/readme.md index 27ee28dad8..fb688e25bd 100644 --- a/src/elements-experimental/pearl-chain-time/readme.md +++ b/src/elements-experimental/pearl-chain-time/readme.md @@ -55,11 +55,11 @@ This is helpful if you need a specific state of the component. | Name | Attribute | Privacy | Type | Default | Description | | ------------------ | ------------------- | ------- | ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `a11yFootpath` | `a11y-footpath` | public | `boolean \| undefined` | | Optional prop to render wheelchair-small instead of walk-small | -| `arrivalTime` | `arrival-time` | public | `string \| undefined` | | Prop to render the arrival time - will be formatted as "H:mm" | -| `arrivalWalk` | `arrival-walk` | public | `number \| undefined` | | Optional prop to render the walk time (in minutes) after arrival | -| `departureTime` | `departure-time` | public | `string \| undefined` | | Prop to render the departure time - will be formatted as "H:mm" | -| `departureWalk` | `departure-walk` | public | `number \| undefined` | | Optional prop to render the walk time (in minutes) before departure | -| `disableAnimation` | `disable-animation` | public | `boolean \| undefined` | | Per default, the current location has a pulsating animation. You can disable the animation with this property. | -| `legs` | `legs` | public | `(Leg \| PtRideLeg)[]` | | define the legs of the pearl-chain. Format: `{"legs": \[{"duration": 25}, ...]}` `duration` in minutes. Duration of the leg is relative to the total travel time. Example: departure 16:30, change at 16:40, arrival at 17:00. So the change should have a duration of 33.33%. | +| `a11yFootpath` | `a11y-footpath` | public | `boolean` | `false` | Optional prop to render wheelchair-small instead of walk-small | +| `arrivalTime` | `arrival-time` | public | `string` | `''` | Prop to render the arrival time - will be formatted as "H:mm" | +| `arrivalWalk` | `arrival-walk` | public | `number` | `NaN` | Optional prop to render the walk time (in minutes) after arrival | +| `departureTime` | `departure-time` | public | `string` | `''` | Prop to render the departure time - will be formatted as "H:mm" | +| `departureWalk` | `departure-walk` | public | `number` | `NaN` | Optional prop to render the walk time (in minutes) before departure | +| `disableAnimation` | `disable-animation` | public | `boolean` | `false` | Per default, the current location has a pulsating animation. You can disable the animation with this property. | +| `legs` | `legs` | public | `(Leg \| PtRideLeg)[]` | `[]` | define the legs of the pearl-chain. Format: `{"legs": \[{"duration": 25}, ...]}` `duration` in minutes. Duration of the leg is relative to the total travel time. Example: departure 16:30, change at 16:40, arrival at 17:00. So the change should have a duration of 33.33%. | | `now` | `now` | public | `Date` | `null` | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. | diff --git a/src/elements-experimental/pearl-chain-vertical-item/pearl-chain-vertical-item.ts b/src/elements-experimental/pearl-chain-vertical-item/pearl-chain-vertical-item.ts index f497e68687..c4936efd61 100644 --- a/src/elements-experimental/pearl-chain-vertical-item/pearl-chain-vertical-item.ts +++ b/src/elements-experimental/pearl-chain-vertical-item/pearl-chain-vertical-item.ts @@ -1,3 +1,4 @@ +import { forceType } from '@sbb-esta/lyne-elements/core/decorators.js'; import type { CSSResultGroup, TemplateResult } from 'lit'; import { html, LitElement, nothing } from 'lit'; import { customElement, property } from 'lit/decorators.js'; @@ -28,17 +29,19 @@ export interface PearlChainVerticalItemAttributes { * @slot left - Content of the left side of the item * @slot right - Content of the right side of the item */ +export @customElement('sbb-pearl-chain-vertical-item') -export class SbbPearlChainVerticalItemElement extends LitElement { +class SbbPearlChainVerticalItemElement extends LitElement { public static override styles: CSSResultGroup = style; /** The pearlChainVerticalItemAttributes Prop for styling the bullets and line.*/ @property({ attribute: 'pearl-chain-vertical-item-attributes', type: Object }) - public pearlChainVerticalItemAttributes!: PearlChainVerticalItemAttributes; + public accessor pearlChainVerticalItemAttributes: PearlChainVerticalItemAttributes = null!; /** If true, the position won't be animated. */ + @forceType() @property({ attribute: 'disable-animation', reflect: true, type: Boolean }) - public disableAnimation?: boolean; + public accessor disableAnimation: boolean = false; protected override render(): TemplateResult { const { bulletType, lineType, lineColor, hideLine, minHeight, bulletSize, position } = diff --git a/src/elements-experimental/pearl-chain-vertical-item/readme.md b/src/elements-experimental/pearl-chain-vertical-item/readme.md index 3943bc94ba..3225581a54 100644 --- a/src/elements-experimental/pearl-chain-vertical-item/readme.md +++ b/src/elements-experimental/pearl-chain-vertical-item/readme.md @@ -38,8 +38,8 @@ The slots themselves are unstyled, so that they can be used in various ways. | Name | Attribute | Privacy | Type | Default | Description | | ---------------------------------- | -------------------------------------- | ------- | ---------------------------------- | ------- | --------------------------------------------------------------------------- | -| `disableAnimation` | `disable-animation` | public | `boolean \| undefined` | | If true, the position won't be animated. | -| `pearlChainVerticalItemAttributes` | `pearl-chain-vertical-item-attributes` | public | `PearlChainVerticalItemAttributes` | | The pearlChainVerticalItemAttributes Prop for styling the bullets and line. | +| `disableAnimation` | `disable-animation` | public | `boolean` | `false` | If true, the position won't be animated. | +| `pearlChainVerticalItemAttributes` | `pearl-chain-vertical-item-attributes` | public | `PearlChainVerticalItemAttributes` | `null!` | The pearlChainVerticalItemAttributes Prop for styling the bullets and line. | ## Slots diff --git a/src/elements-experimental/pearl-chain-vertical/pearl-chain-vertical.ts b/src/elements-experimental/pearl-chain-vertical/pearl-chain-vertical.ts index ddc422741f..63d1a48fa9 100644 --- a/src/elements-experimental/pearl-chain-vertical/pearl-chain-vertical.ts +++ b/src/elements-experimental/pearl-chain-vertical/pearl-chain-vertical.ts @@ -9,8 +9,9 @@ import style from './pearl-chain-vertical.scss?lit&inline'; * * @slot - The unnamed slot is used for the `sbb-pearl-chain-vertical-item` component. */ +export @customElement('sbb-pearl-chain-vertical') -export class SbbPearlChainVerticalElement extends LitElement { +class SbbPearlChainVerticalElement extends LitElement { public static override styles: CSSResultGroup = style; protected override render(): TemplateResult { diff --git a/src/elements-experimental/pearl-chain/pearl-chain.ts b/src/elements-experimental/pearl-chain/pearl-chain.ts index f9a459adbe..dc9eae65bf 100644 --- a/src/elements-experimental/pearl-chain/pearl-chain.ts +++ b/src/elements-experimental/pearl-chain/pearl-chain.ts @@ -1,4 +1,5 @@ import { defaultDateAdapter } from '@sbb-esta/lyne-elements/core/datetime.js'; +import { forceType } from '@sbb-esta/lyne-elements/core/decorators.js'; import type { SbbDateLike } from '@sbb-esta/lyne-elements/core/interfaces/types'; import { addMinutes, differenceInMinutes, isAfter, isBefore } from 'date-fns'; import type { CSSResultGroup, TemplateResult } from 'lit'; @@ -21,8 +22,9 @@ type Time = { /** * It visually displays journey information. */ +export @customElement('sbb-pearl-chain') -export class SbbPearlChainElement extends LitElement { +class SbbPearlChainElement extends LitElement { public static override styles: CSSResultGroup = style; /** @@ -33,13 +35,15 @@ export class SbbPearlChainElement extends LitElement { * to the total travel time. Example: departure 16:30, change at 16:40, * arrival at 17:00. So the change should have a duration of 33.33%. */ - @property({ type: Array }) public legs?: (Leg | PtRideLeg)[]; + @property({ type: Array }) public accessor legs: (Leg | PtRideLeg)[] = []; /** * Per default, the current location has a pulsating animation. You can * disable the animation with this property. */ - @property({ attribute: 'disable-animation', type: Boolean }) public disableAnimation?: boolean; + @forceType() + @property({ attribute: 'disable-animation', type: Boolean }) + public accessor disableAnimation: boolean = false; /** A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. */ @property() diff --git a/src/elements-experimental/pearl-chain/readme.md b/src/elements-experimental/pearl-chain/readme.md index 5b0cd0cce2..49acceddd9 100644 --- a/src/elements-experimental/pearl-chain/readme.md +++ b/src/elements-experimental/pearl-chain/readme.md @@ -54,8 +54,8 @@ This is helpful if you need a specific state of the component. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------------------ | ------------------- | ------- | ----------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `disableAnimation` | `disable-animation` | public | `boolean \| undefined` | | Per default, the current location has a pulsating animation. You can disable the animation with this property. | -| `legs` | `legs` | public | `(Leg \| PtRideLeg)[] \| undefined` | | Define the legs of the pearl-chain. Format: `{"legs": \[{"duration": 25}, ...]}` `duration` in minutes. Duration of the leg is relative to the total travel time. Example: departure 16:30, change at 16:40, arrival at 17:00. So the change should have a duration of 33.33%. | -| `now` | `now` | public | `Date \| null` | `null` | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. | +| Name | Attribute | Privacy | Type | Default | Description | +| ------------------ | ------------------- | ------- | ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `disableAnimation` | `disable-animation` | public | `boolean` | `false` | Per default, the current location has a pulsating animation. You can disable the animation with this property. | +| `legs` | `legs` | public | `(Leg \| PtRideLeg)[]` | `[]` | Define the legs of the pearl-chain. Format: `{"legs": \[{"duration": 25}, ...]}` `duration` in minutes. Duration of the leg is relative to the total travel time. Example: departure 16:30, change at 16:40, arrival at 17:00. So the change should have a duration of 33.33%. | +| `now` | `now` | public | `Date \| null` | `null` | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. | diff --git a/src/elements-experimental/timetable-duration/readme.md b/src/elements-experimental/timetable-duration/readme.md index 6d94da5258..3111e3570c 100644 --- a/src/elements-experimental/timetable-duration/readme.md +++ b/src/elements-experimental/timetable-duration/readme.md @@ -7,4 +7,4 @@ here to show the various configuration options to component developers. !! | Name | Attribute | Privacy | Type | Default | Description | | -------- | --------- | ------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| `config` | `config` | public | `string` | | Stringified JSON which defines most of the content of the component. Please check the individual stories to get an idea of the structure. | +| `config` | `config` | public | `string` | `''` | Stringified JSON which defines most of the content of the component. Please check the individual stories to get an idea of the structure. | diff --git a/src/elements-experimental/timetable-duration/timetable-duration.ts b/src/elements-experimental/timetable-duration/timetable-duration.ts index 998ca5a149..dca9e298e6 100644 --- a/src/elements-experimental/timetable-duration/timetable-duration.ts +++ b/src/elements-experimental/timetable-duration/timetable-duration.ts @@ -1,4 +1,5 @@ import { SbbLanguageController } from '@sbb-esta/lyne-elements/core/controllers.js'; +import { forceType } from '@sbb-esta/lyne-elements/core/decorators.js'; import { i18nDurationHour, i18nDurationMinute } from '@sbb-esta/lyne-elements/core/i18n.js'; import type { CSSResultGroup, TemplateResult } from 'lit'; import { html, LitElement } from 'lit'; @@ -9,8 +10,9 @@ import style from './timetable-duration.scss?lit&inline'; /** * Used in `sbb-timetable-row`, it displays information about the trip duration. */ +export @customElement('sbb-timetable-duration') -export class SbbTimetableDurationElement extends LitElement { +class SbbTimetableDurationElement extends LitElement { public static override styles: CSSResultGroup = style; /** @@ -19,7 +21,9 @@ export class SbbTimetableDurationElement extends LitElement { * individual stories to get an idea of the * structure. */ - @property() public config!: string; + @forceType() + @property() + public accessor config: string = ''; private _language = new SbbLanguageController(this); diff --git a/src/elements-experimental/timetable-row/readme.md b/src/elements-experimental/timetable-row/readme.md index 1a776bc3f5..faaf62fa5a 100644 --- a/src/elements-experimental/timetable-row/readme.md +++ b/src/elements-experimental/timetable-row/readme.md @@ -47,16 +47,16 @@ This is helpful if you need a specific state of the component. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ----------------------- | ------------------------ | ------- | ----------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `a11yFootpath` | `a11y-footpath` | public | `boolean \| undefined` | | The Footpath attribute for rendering different icons true: render a11y-icon false: render walk-icon default: render walk-icon | -| `accessibilityExpanded` | `accessibility-expanded` | public | `boolean \| undefined` | | This will be forwarded to the sbb-card component as aria-expanded. | -| `active` | `active` | public | `boolean \| undefined` | | When this prop is true the sbb-card will be in the active state. | -| `boarding` | `boarding` | public | `Boarding \| undefined` | | This will be forwarded to the notices section | -| `cardActionLabel` | `card-action-label` | public | `string \| undefined` | | Hidden label for the card action. It overrides the automatically generated accessibility text for the component. Use this prop to provide custom accessibility information for the component. | -| `disableAnimation` | `disable-animation` | public | `boolean \| undefined` | | This will be forwarded to the sbb-pearl-chain component - if true the position won't be animated. | -| `loadingPrice` | `loading-price` | public | `boolean` | `false` | The loading state - when this is true it will be render skeleton with an idling animation | -| `loadingTrip` | `loading-trip` | public | `boolean` | `false` | The loading state - when this is true it will be render skeleton with an idling animation | -| `now` | `now` | public | `Date` | `null` | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. | -| `price` | `price` | public | `Price \| undefined` | | The price Prop, which consists of the data for the badge. | -| `trip` | `trip` | public | `ITripItem` | | The trip Prop. | +| Name | Attribute | Privacy | Type | Default | Description | +| ----------------------- | ------------------------ | ------- | ----------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `a11yFootpath` | `a11y-footpath` | public | `boolean` | `false` | The Footpath attribute for rendering different icons true: render a11y-icon false: render walk-icon default: render walk-icon | +| `accessibilityExpanded` | `accessibility-expanded` | public | `boolean` | `false` | This will be forwarded to the sbb-card component as aria-expanded. | +| `active` | `active` | public | `boolean` | `false` | When this prop is true the sbb-card will be in the active state. | +| `boarding` | `boarding` | public | `Boarding` | `null!` | This will be forwarded to the notices section | +| `cardActionLabel` | `card-action-label` | public | `string` | `''` | Hidden label for the card action. It overrides the automatically generated accessibility text for the component. Use this prop to provide custom accessibility information for the component. | +| `disableAnimation` | `disable-animation` | public | `boolean` | `false` | This will be forwarded to the sbb-pearl-chain component - if true the position won't be animated. | +| `loadingPrice` | `loading-price` | public | `boolean` | `false` | The loading state - when this is true it will be render skeleton with an idling animation | +| `loadingTrip` | `loading-trip` | public | `boolean` | `false` | The loading state - when this is true it will be render skeleton with an idling animation | +| `now` | `now` | public | `Date` | `null` | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. | +| `price` | `price` | public | `Price` | `null!` | The price Prop, which consists of the data for the badge. | +| `trip` | `trip` | public | `ITripItem` | `null!` | The trip Prop. | diff --git a/src/elements-experimental/timetable-row/timetable-row.ts b/src/elements-experimental/timetable-row/timetable-row.ts index cd0ca8ecd0..df3884459f 100644 --- a/src/elements-experimental/timetable-row/timetable-row.ts +++ b/src/elements-experimental/timetable-row/timetable-row.ts @@ -1,5 +1,6 @@ import { SbbLanguageController } from '@sbb-esta/lyne-elements/core/controllers.js'; import { defaultDateAdapter } from '@sbb-esta/lyne-elements/core/datetime.js'; +import { forceType } from '@sbb-esta/lyne-elements/core/decorators.js'; import { setOrRemoveAttribute } from '@sbb-esta/lyne-elements/core/dom.js'; import { i18nArrival, @@ -203,28 +204,32 @@ export const handleNotices = (notices: Notice[]): Notice[] => { /** * It displays information about the trip, acting as a container for all the `sbb-timetable-*` components. * */ +export @customElement('sbb-timetable-row') -export class SbbTimetableRowElement extends LitElement { +class SbbTimetableRowElement extends LitElement { public static override styles: CSSResultGroup = style; /** The trip Prop. */ - @property({ type: Object }) public trip!: ITripItem; + @property({ type: Object }) public accessor trip: ITripItem = null!; /** The price Prop, which consists of the data for the badge. */ - @property({ type: Object }) public price?: Price; + @property({ type: Object }) public accessor price: Price = null!; /** This will be forwarded to the sbb-pearl-chain component - if true the position won't be animated. */ + @forceType() @property({ attribute: 'disable-animation', reflect: true, type: Boolean }) - public disableAnimation?: boolean; + public accessor disableAnimation: boolean = false; /** This will be forwarded to the notices section */ - @property({ type: Object }) public boarding?: Boarding; + @property({ type: Object }) public accessor boarding: Boarding = null!; /** * The loading state - * when this is true it will be render skeleton with an idling animation */ - @property({ attribute: 'loading-trip', type: Boolean }) public loadingTrip = false; + @forceType() + @property({ attribute: 'loading-trip', type: Boolean }) + public accessor loadingTrip: boolean = false; /** * The Footpath attribute for rendering different icons @@ -232,25 +237,34 @@ export class SbbTimetableRowElement extends LitElement { * false: render walk-icon * default: render walk-icon */ - @property({ attribute: 'a11y-footpath', type: Boolean }) public a11yFootpath?: boolean; + @forceType() + @property({ attribute: 'a11y-footpath', type: Boolean }) + public accessor a11yFootpath: boolean = false; /** * The loading state - * when this is true it will be render skeleton with an idling animation */ - @property({ attribute: 'loading-price', type: Boolean }) public loadingPrice = false; + @forceType() + @property({ attribute: 'loading-price', type: Boolean }) + public accessor loadingPrice: boolean = false; /** * Hidden label for the card action. It overrides the automatically generated accessibility text for the component. Use this prop to provide custom accessibility information for the component. */ - @property({ attribute: 'card-action-label' }) public cardActionLabel?: string; + @forceType() + @property({ attribute: 'card-action-label' }) + public accessor cardActionLabel: string = ''; /** This will be forwarded to the sbb-card component as aria-expanded. */ + @forceType() @property({ attribute: 'accessibility-expanded', type: Boolean }) - public accessibilityExpanded?: boolean; + public accessor accessibilityExpanded: boolean = false; /** When this prop is true the sbb-card will be in the active state. */ - @property({ type: Boolean }) public active?: boolean; + @forceType() + @property({ type: Boolean }) + public accessor active: boolean = false; /** A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. */ @property() @@ -493,7 +507,7 @@ export class SbbTimetableRowElement extends LitElement { ${this.cardActionLabel ? this.cardActionLabel : this._getAccessibilityText(this.trip)} diff --git a/src/elements-experimental/vite.config.ts b/src/elements-experimental/vite.config.ts index eb387561ca..d304b2e59e 100644 --- a/src/elements-experimental/vite.config.ts +++ b/src/elements-experimental/vite.config.ts @@ -62,7 +62,7 @@ export default defineConfig((config) => rollupOptions: { external: (source: string, importer: string | undefined) => { if ( - source.match(/(^lit$|^lit\/|^@lit\/|^@lit-labs\/)/) || + source.match(/(^lit$|^lit\/|^@lit\/|^@lit-labs\/|^tslib$)/) || source.match(/^@sbb-esta\/lyne-elements\/?/) || (!!importer && source.startsWith('../') && !importer.includes('/node_modules/')) || (!!importer && barrelExports.includes(importer) && source.match(/\.\/[a-z-]+/)) diff --git a/src/elements/accordion/accordion.ts b/src/elements/accordion/accordion.ts index edda6ee93e..7e6ab50c03 100644 --- a/src/elements/accordion/accordion.ts +++ b/src/elements/accordion/accordion.ts @@ -3,6 +3,7 @@ import { html, LitElement } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import { SbbConnectedAbortController } from '../core/controllers.js'; +import { forceType, handleDistinctChange } from '../core/decorators.js'; import { SbbHydrationMixin } from '../core/mixins.js'; import { SbbExpansionPanelElement } from '../expansion-panel.js'; import type { SbbTitleLevel } from '../title.js'; @@ -14,42 +15,28 @@ import style from './accordion.scss?lit&inline'; * * @slot - Use the unnamed slot to add `sbb-expansion-panel` elements. */ +export @customElement('sbb-accordion') -export class SbbAccordionElement extends SbbHydrationMixin(LitElement) { +class SbbAccordionElement extends SbbHydrationMixin(LitElement) { public static override styles: CSSResultGroup = style; /** Size variant, either l or s; overrides the size on any projected `sbb-expansion-panel`. */ - @property({ reflect: true }) public size: 's' | 'l' = 'l'; + @property({ reflect: true }) + public accessor size: 's' | 'l' = 'l'; /** * The heading level for the sbb-expansion-panel-headers within the component. * @controls SbbExpansionPanelElement.titleLevel */ + @handleDistinctChange((e) => e._setTitleLevelOnChildren()) @property({ attribute: 'title-level' }) - public set titleLevel(value: SbbTitleLevel | null) { - this._titleLevel = value; - this._setTitleLevelOnChildren(); - } - public get titleLevel(): SbbTitleLevel | null { - return this._titleLevel; - } - private _titleLevel: SbbTitleLevel | null = null; + public accessor titleLevel: SbbTitleLevel | null = null; /** Whether more than one sbb-expansion-panel can be open at the same time. */ + @forceType() + @handleDistinctChange((e, newValue, oldValue) => e._resetExpansionPanels(newValue, !!oldValue)) @property({ type: Boolean }) - public set multi(value: boolean) { - const oldValue = this._multi; - this._multi = value; - this._resetExpansionPanels(this._multi, oldValue); - } - public get multi(): boolean { - return this._multi; - } - private _multi: boolean = false; - - private get _expansionPanels(): SbbExpansionPanelElement[] { - return Array.from(this.querySelectorAll?.('sbb-expansion-panel') ?? []); - } + public accessor multi: boolean = false; private _abort = new SbbConnectedAbortController(this); @@ -63,12 +50,16 @@ export class SbbAccordionElement extends SbbHydrationMixin(LitElement) { ); } + private _expansionPanels(): SbbExpansionPanelElement[] { + return Array.from(this.querySelectorAll?.('sbb-expansion-panel') ?? []); + } + private _closePanels(e: CustomEvent): void { if ((e.target as HTMLElement)?.localName !== 'sbb-expansion-panel' || this.multi) { return; } - this._expansionPanels + this._expansionPanels() .filter((panel) => panel !== e.target) .forEach((panel) => (panel.expanded = false)); } @@ -77,13 +68,15 @@ export class SbbAccordionElement extends SbbHydrationMixin(LitElement) { super.willUpdate(changedProperties); if (changedProperties.has('size')) { - this._expansionPanels.forEach((panel: SbbExpansionPanelElement) => (panel.size = this.size)); + this._expansionPanels().forEach( + (panel: SbbExpansionPanelElement) => (panel.size = this.size), + ); } } private _resetExpansionPanels(newValue: boolean, oldValue: boolean): void { // If it's changing from "multi = true" to "multi = false", open the first panel and close all the others. - const expansionPanels = this._expansionPanels; + const expansionPanels = this._expansionPanels(); if (expansionPanels.length > 1 && oldValue && !newValue) { expansionPanels[0].expanded = true; expansionPanels @@ -93,13 +86,13 @@ export class SbbAccordionElement extends SbbHydrationMixin(LitElement) { } private _setTitleLevelOnChildren(): void { - this._expansionPanels.forEach( + this._expansionPanels().forEach( (panel: SbbExpansionPanelElement) => (panel.titleLevel = this.titleLevel), ); } private _handleSlotchange(): void { - this._expansionPanels.forEach( + this._expansionPanels().forEach( (panel: SbbExpansionPanelElement, index: number, array: SbbExpansionPanelElement[]) => { panel.titleLevel = this.titleLevel; panel.size = this.size; diff --git a/src/elements/action-group/action-group.ts b/src/elements/action-group/action-group.ts index 5f770c85e4..49b7f0332c 100644 --- a/src/elements/action-group/action-group.ts +++ b/src/elements/action-group/action-group.ts @@ -18,41 +18,42 @@ import style from './action-group.scss?lit&inline'; * * @slot - Use the unnamed slot to add `sbb-block-link` or `sbb-button` elements to the `sbb-action-group`. */ +export @customElement('sbb-action-group') -export class SbbActionGroupElement extends LitElement { +class SbbActionGroupElement extends LitElement { public static override styles: CSSResultGroup = style; /** * Set the slotted `` children's alignment. */ @property({ attribute: 'align-group', reflect: true }) - public alignGroup: 'start' | 'center' | 'stretch' | 'end' = 'start'; + public accessor alignGroup: 'start' | 'center' | 'stretch' | 'end' = 'start'; /** * Overrides the behaviour of `orientation` property. */ @property({ attribute: 'horizontal-from', reflect: true }) - public horizontalFrom: SbbHorizontalFrom = 'medium'; + public accessor horizontalFrom: SbbHorizontalFrom = 'medium'; /** * Indicates the orientation of the components inside the ``. */ @property({ reflect: true }) - public orientation: SbbOrientation = 'horizontal'; + public accessor orientation: SbbOrientation = 'horizontal'; /** * Size of the nested sbb-button instances. This will overwrite the size attribute of nested * sbb-button instances. */ @property({ attribute: 'button-size', reflect: true }) - public buttonSize: SbbButtonSize = 'l'; + public accessor buttonSize: SbbButtonSize = 'l'; /** * Size of the nested sbb-block-link instances. This will overwrite the size attribute of nested * sbb-block-link instances. */ @property({ attribute: 'link-size', reflect: true }) - public linkSize: SbbLinkSize = 'm'; + public accessor linkSize: SbbLinkSize = 'm'; protected override willUpdate(changedProperties: PropertyValues): void { super.willUpdate(changedProperties); diff --git a/src/elements/alert/alert-group/alert-group.ts b/src/elements/alert/alert-group/alert-group.ts index cd48a7b026..e41de61d88 100644 --- a/src/elements/alert/alert-group/alert-group.ts +++ b/src/elements/alert/alert-group/alert-group.ts @@ -4,6 +4,7 @@ import { customElement, property, state } from 'lit/decorators.js'; import { html, unsafeStatic } from 'lit/static-html.js'; import { SbbConnectedAbortController } from '../../core/controllers.js'; +import { forceType } from '../../core/decorators.js'; import { EventEmitter } from '../../core/eventing.js'; import { SbbHydrationMixin } from '../../core/mixins.js'; import type { SbbTitleLevel } from '../../title.js'; @@ -19,8 +20,9 @@ import style from './alert-group.scss?lit&inline'; * @event {CustomEvent} didDismissAlert - Emits when an alert was removed from DOM. * @event {CustomEvent} empty - Emits when `sbb-alert-group` becomes empty. */ +export @customElement('sbb-alert-group') -export class SbbAlertGroupElement extends SbbHydrationMixin(LitElement) { +class SbbAlertGroupElement extends SbbHydrationMixin(LitElement) { public static override styles: CSSResultGroup = style; public static readonly events = { didDismissAlert: 'didDismissAlert', @@ -34,17 +36,19 @@ export class SbbAlertGroupElement extends SbbHydrationMixin(LitElement) { * 'alert': sets aria-live to assertive and aria-atomic to true. */ @property({ reflect: true }) - public override role: 'alert' | 'status' | string = 'status'; + public override accessor role: 'alert' | 'status' | string = 'status'; /** Title for this alert group which is only visible for screen reader users. */ - @property({ attribute: 'accessibility-title' }) public accessibilityTitle?: string; + @forceType() + @property({ attribute: 'accessibility-title' }) + public accessor accessibilityTitle: string = ''; /** Level of the accessibility title, will be rendered as heading tag (e.g. h2). Defaults to level 2. */ @property({ attribute: 'accessibility-title-level' }) - public accessibilityTitleLevel: SbbTitleLevel = '2'; + public accessor accessibilityTitleLevel: SbbTitleLevel = '2'; /** Whether the group currently has any alerts. */ - @state() private _hasAlerts?: boolean; + @state() private accessor _hasAlerts: boolean = false; /** Emits when an alert was removed from DOM. */ private _didDismissAlert: EventEmitter = new EventEmitter( diff --git a/src/elements/alert/alert-group/readme.md b/src/elements/alert/alert-group/readme.md index 8bd609bf86..ab440beee0 100644 --- a/src/elements/alert/alert-group/readme.md +++ b/src/elements/alert/alert-group/readme.md @@ -45,7 +45,7 @@ and therefore interrupts screen reader flow, to immediately read out the alert c | Name | Attribute | Privacy | Type | Default | Description | | ------------------------- | --------------------------- | ------- | ------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `accessibilityTitle` | `accessibility-title` | public | `string \| undefined` | | Title for this alert group which is only visible for screen reader users. | +| `accessibilityTitle` | `accessibility-title` | public | `string` | `''` | Title for this alert group which is only visible for screen reader users. | | `accessibilityTitleLevel` | `accessibility-title-level` | public | `SbbTitleLevel` | `'2'` | Level of the accessibility title, will be rendered as heading tag (e.g. h2). Defaults to level 2. | | `role` | `role` | public | `'alert' \| 'status' \| string` | `'status'` | The role attribute defines how to announce alerts to the user. 'status': sets aria-live to polite and aria-atomic to true. 'alert': sets aria-live to assertive and aria-atomic to true. | diff --git a/src/elements/alert/alert/alert.ts b/src/elements/alert/alert/alert.ts index 5f5349fa2b..5c09c0757f 100644 --- a/src/elements/alert/alert/alert.ts +++ b/src/elements/alert/alert/alert.ts @@ -3,6 +3,7 @@ import { customElement, property } from 'lit/decorators.js'; import { type LinkTargetType, SbbOpenCloseBaseElement } from '../../core/base-elements.js'; import { SbbLanguageController } from '../../core/controllers.js'; +import { forceType } from '../../core/decorators.js'; import { EventEmitter } from '../../core/eventing.js'; import { i18nCloseAlert, i18nFindOutMore } from '../../core/i18n.js'; import { SbbIconNameMixin } from '../../icon.js'; @@ -27,8 +28,9 @@ import '../../title.js'; * @event {CustomEvent} didClose - Emits when the closing animation ends. * @event {CustomEvent} dismissalRequested - Emits when dismissal of an alert was requested. */ +export @customElement('sbb-alert') -export class SbbAlertElement extends SbbIconNameMixin(SbbOpenCloseBaseElement) { +class SbbAlertElement extends SbbIconNameMixin(SbbOpenCloseBaseElement) { public static override styles: CSSResultGroup = style; public static override readonly events = { willOpen: 'willOpen', @@ -42,41 +44,57 @@ export class SbbAlertElement extends SbbIconNameMixin(SbbOpenCloseBaseElement) { * Whether the alert is readonly. * In readonly mode, there is no dismiss button offered to the user. */ - @property({ reflect: true, type: Boolean }) public readonly = false; + @forceType() + @property({ reflect: true, type: Boolean }) + public accessor readonly: boolean = false; /** You can choose between `s`, `m` or `l` size. */ - @property({ reflect: true }) public size: 's' | 'm' | 'l' = 'm'; + @property({ reflect: true }) public accessor size: 's' | 'm' | 'l' = 'm'; /** * Name of the icon which will be forward to the nested `sbb-icon`. * Choose the icons from https://icons.app.sbb.ch. * Styling is optimized for icons of type HIM-CUS. */ - @property({ attribute: 'icon-name' }) public override iconName: string = 'info'; + @forceType() + @property({ attribute: 'icon-name' }) + public override accessor iconName: string = 'info'; /** Content of title. */ - @property({ attribute: 'title-content' }) public titleContent?: string; + @forceType() + @property({ attribute: 'title-content' }) + public accessor titleContent: string = ''; /** Level of title, will be rendered as heading tag (e.g. h3). Defaults to level 3. */ - @property({ attribute: 'title-level' }) public titleLevel: SbbTitleLevel = '3'; + @property({ attribute: 'title-level' }) public accessor titleLevel: SbbTitleLevel = '3'; /** Content of the link. */ - @property({ attribute: 'link-content' }) public linkContent?: string; + @forceType() + @property({ attribute: 'link-content' }) + public accessor linkContent: string = ''; /** The href value you want to link to. */ - @property() public href: string | undefined; + @forceType() + @property() + public accessor href: string = ''; /** Where to display the linked URL. */ - @property() public target: LinkTargetType | string | undefined; + @forceType() + @property() + public accessor target: LinkTargetType | string = ''; /** The relationship of the linked URL as space-separated link types. */ - @property() public rel: string | undefined; + @forceType() + @property() + public accessor rel: string = ''; /** This will be forwarded as aria-label to the relevant nested element. */ - @property({ attribute: 'accessibility-label' }) public accessibilityLabel: string | undefined; + @forceType() + @property({ attribute: 'accessibility-label' }) + public accessor accessibilityLabel: string = ''; /** The enabled animations. */ - @property({ reflect: true }) public animation: 'open' | 'close' | 'all' | 'none' = 'all'; + @property({ reflect: true }) public accessor animation: 'open' | 'close' | 'all' | 'none' = 'all'; /** * Emits when dismissal of an alert was requested. diff --git a/src/elements/alert/alert/readme.md b/src/elements/alert/alert/readme.md index 467620b726..cdd26b061f 100644 --- a/src/elements/alert/alert/readme.md +++ b/src/elements/alert/alert/readme.md @@ -82,20 +82,20 @@ As a base rule, opening animations should be active if an alert arrives after th ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| -------------------- | --------------------- | ------- | --------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the relevant nested element. | -| `animation` | `animation` | public | `'open' \| 'close' \| 'all' \| 'none'` | `'all'` | The enabled animations. | -| `href` | `href` | public | `string \| undefined` | | The href value you want to link to. | -| `iconName` | `icon-name` | public | `string \| undefined` | `'info'` | Name of the icon which will be forward to the nested `sbb-icon`. Choose the icons from https://icons.app.sbb.ch. Styling is optimized for icons of type HIM-CUS. | -| `isOpen` | - | public | `boolean` | | Whether the element is open. | -| `linkContent` | `link-content` | public | `string \| undefined` | | Content of the link. | -| `readonly` | `readonly` | public | `boolean` | `false` | Whether the alert is readonly. In readonly mode, there is no dismiss button offered to the user. | -| `rel` | `rel` | public | `string \| undefined` | | The relationship of the linked URL as space-separated link types. | -| `size` | `size` | public | `'s' \| 'm' \| 'l'` | `'m'` | You can choose between `s`, `m` or `l` size. | -| `target` | `target` | public | `LinkTargetType \| string \| undefined` | | Where to display the linked URL. | -| `titleContent` | `title-content` | public | `string \| undefined` | | Content of title. | -| `titleLevel` | `title-level` | public | `SbbTitleLevel` | `'3'` | Level of title, will be rendered as heading tag (e.g. h3). Defaults to level 3. | +| Name | Attribute | Privacy | Type | Default | Description | +| -------------------- | --------------------- | ------- | -------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the relevant nested element. | +| `animation` | `animation` | public | `'open' \| 'close' \| 'all' \| 'none'` | `'all'` | The enabled animations. | +| `href` | `href` | public | `string` | `''` | The href value you want to link to. | +| `iconName` | `icon-name` | public | `string` | `'info'` | Name of the icon which will be forward to the nested `sbb-icon`. Choose the icons from https://icons.app.sbb.ch. Styling is optimized for icons of type HIM-CUS. | +| `isOpen` | - | public | `boolean` | | Whether the element is open. | +| `linkContent` | `link-content` | public | `string` | `''` | Content of the link. | +| `readonly` | `readonly` | public | `boolean` | `false` | Whether the alert is readonly. In readonly mode, there is no dismiss button offered to the user. | +| `rel` | `rel` | public | `string` | `''` | The relationship of the linked URL as space-separated link types. | +| `size` | `size` | public | `'s' \| 'm' \| 'l'` | `'m'` | You can choose between `s`, `m` or `l` size. | +| `target` | `target` | public | `LinkTargetType \| string` | `''` | Where to display the linked URL. | +| `titleContent` | `title-content` | public | `string` | `''` | Content of title. | +| `titleLevel` | `title-level` | public | `SbbTitleLevel` | `'3'` | Level of title, will be rendered as heading tag (e.g. h3). Defaults to level 3. | ## Methods diff --git a/src/elements/autocomplete-grid/autocomplete-grid-button/__snapshots__/autocomplete-grid-button.snapshot.spec.snap.js b/src/elements/autocomplete-grid/autocomplete-grid-button/__snapshots__/autocomplete-grid-button.snapshot.spec.snap.js index 8dd5e818ab..2a5ca2c001 100644 --- a/src/elements/autocomplete-grid/autocomplete-grid-button/__snapshots__/autocomplete-grid-button.snapshot.spec.snap.js +++ b/src/elements/autocomplete-grid/autocomplete-grid-button/__snapshots__/autocomplete-grid-button.snapshot.spec.snap.js @@ -3,7 +3,6 @@ export const snapshots = {}; snapshots["sbb-autocomplete-grid-button renders DOM"] = `): void { super.willUpdate(changedProperties); if (changedProperties.has('disabled')) { - setOrRemoveAttribute(this, 'aria-disabled', `${this.disabled || this._disabledFromGroup}`); + this._updateAriaDisabled(); + } + } + + private _updateAriaDisabled(): void { + if (this.disabled || this._disabledFromGroup) { + this.setAttribute('aria-disabled', 'true'); + } else { + this.removeAttribute('aria-disabled'); } } diff --git a/src/elements/autocomplete-grid/autocomplete-grid-button/readme.md b/src/elements/autocomplete-grid/autocomplete-grid-button/readme.md index efead5ba74..e91815bc20 100644 --- a/src/elements/autocomplete-grid/autocomplete-grid-button/readme.md +++ b/src/elements/autocomplete-grid/autocomplete-grid-button/readme.md @@ -98,7 +98,7 @@ since the focus must always stay on the connected ``. | Name | Attribute | Privacy | Type | Default | Description | | ---------- | ----------- | ------- | ------------------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------- | | `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | | `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | | `option` | - | public | `SbbAutocompleteGridOptionElement \| null` | | Gets the SbbAutocompleteGridOptionElement on the same row of the button. | diff --git a/src/elements/autocomplete-grid/autocomplete-grid-cell/__snapshots__/autocomplete-grid-cell.snapshot.spec.snap.js b/src/elements/autocomplete-grid/autocomplete-grid-cell/__snapshots__/autocomplete-grid-cell.snapshot.spec.snap.js index 1f3d3f632b..a5e3e5d3e1 100644 --- a/src/elements/autocomplete-grid/autocomplete-grid-cell/__snapshots__/autocomplete-grid-cell.snapshot.spec.snap.js +++ b/src/elements/autocomplete-grid/autocomplete-grid-cell/__snapshots__/autocomplete-grid-cell.snapshot.spec.snap.js @@ -4,7 +4,6 @@ export const snapshots = {}; snapshots["sbb-autocomplete-grid-cell renders DOM"] = ` ): void { super.willUpdate(changedProperties); - if (changedProperties.has('origin')) { - this._resetOriginClickListener(this.origin, changedProperties.get('origin')); - } - if (changedProperties.has('trigger')) { - this._resetTriggerClickListener(this.trigger, changedProperties.get('trigger')); + if ( + (changedProperties.has('origin') && this.origin !== changedProperties.get('origin')) || + (changedProperties.has('trigger') && this.trigger !== changedProperties.get('trigger')) + ) { + this._componentSetup(); } if (changedProperties.has('negative')) { this.syncNegative(); @@ -196,26 +198,6 @@ export abstract class SbbAutocompleteBaseElement extends SbbNegativeMixin( return this.triggerElement?.hasAttribute('readonly') ?? false; } - /** Removes trigger click listener on trigger change. */ - private _resetOriginClickListener( - newValue?: string | HTMLElement, - oldValue?: string | HTMLElement, - ): void { - if (newValue !== oldValue) { - this._componentSetup(); - } - } - - /** Removes trigger click listener on trigger change. */ - private _resetTriggerClickListener( - newValue?: string | HTMLElement, - oldValue?: string | HTMLElement, - ): void { - if (newValue !== oldValue) { - this._componentSetup(); - } - } - private _componentSetup(): void { if (isServer) { return; diff --git a/src/elements/autocomplete/autocomplete.ts b/src/elements/autocomplete/autocomplete.ts index 1150d1c795..8dc515d30e 100644 --- a/src/elements/autocomplete/autocomplete.ts +++ b/src/elements/autocomplete/autocomplete.ts @@ -28,11 +28,12 @@ const ariaRoleOnHost = isSafari; * the `z-index` can be overridden by defining this CSS variable. The default `z-index` of the * component is set to `var(--sbb-overlay-default-z-index)` with a value of `1000`. */ +export @customElement('sbb-autocomplete') @hostAttributes({ role: ariaRoleOnHost ? 'listbox' : null, }) -export class SbbAutocompleteElement extends SbbAutocompleteBaseElement { +class SbbAutocompleteElement extends SbbAutocompleteBaseElement { protected overlayId = `sbb-autocomplete-${++nextId}`; protected panelRole = 'listbox'; private _activeItemIndex = -1; diff --git a/src/elements/autocomplete/readme.md b/src/elements/autocomplete/readme.md index 4b1a1efa4c..aed6f6ef8b 100644 --- a/src/elements/autocomplete/readme.md +++ b/src/elements/autocomplete/readme.md @@ -111,15 +111,15 @@ using `aria-activedescendant` to support navigation though the autocomplete opti ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------------------- | --------------------- | ------- | ----------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `isOpen` | - | public | `boolean` | | Whether the element is open. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `origin` | `origin` | public | `string \| HTMLElement \| undefined` | | The element where the autocomplete will attach; accepts both an element's id or an HTMLElement. If not set, it will search for the first 'sbb-form-field' ancestor. | -| `originElement` | - | public | `HTMLElement` | | Returns the element where autocomplete overlay is attached to. | -| `preserveIconSpace` | `preserve-icon-space` | public | `boolean \| undefined` | | Whether the icon space is preserved when no icon is set. | -| `trigger` | `trigger` | public | `string \| HTMLInputElement \| undefined` | | The input element that will trigger the autocomplete opening; accepts both an element's id or an HTMLElement. By default, the autocomplete will open on focus, click, input or `ArrowDown` keypress of the 'trigger' element. If not set, will search for the first 'input' child of a 'sbb-form-field' ancestor. | -| `triggerElement` | - | public | `HTMLInputElement \| undefined` | | Returns the trigger element. | +| Name | Attribute | Privacy | Type | Default | Description | +| ------------------- | --------------------- | ------- | ------------------------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `isOpen` | - | public | `boolean` | | Whether the element is open. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `origin` | `origin` | public | `string \| HTMLElement \| null` | `null` | The element where the autocomplete will attach; accepts both an element's id or an HTMLElement. If not set, it will search for the first 'sbb-form-field' ancestor. | +| `originElement` | - | public | `HTMLElement` | | Returns the element where autocomplete overlay is attached to. | +| `preserveIconSpace` | `preserve-icon-space` | public | `boolean` | `false` | Whether the icon space is preserved when no icon is set. | +| `trigger` | `trigger` | public | `string \| HTMLInputElement \| null` | `null` | The input element that will trigger the autocomplete opening; accepts both an element's id or an HTMLElement. By default, the autocomplete will open on focus, click, input or `ArrowDown` keypress of the 'trigger' element. If not set, will search for the first 'input' child of a 'sbb-form-field' ancestor. | +| `triggerElement` | - | public | `HTMLInputElement \| undefined` | | Returns the trigger element. | ## Methods diff --git a/src/elements/breadcrumb/breadcrumb-group/breadcrumb-group.ts b/src/elements/breadcrumb/breadcrumb-group/breadcrumb-group.ts index b2126a8f76..3e36321920 100644 --- a/src/elements/breadcrumb/breadcrumb-group/breadcrumb-group.ts +++ b/src/elements/breadcrumb/breadcrumb-group/breadcrumb-group.ts @@ -32,11 +32,12 @@ const MIN_BREADCRUMBS_TO_COLLAPSE = 3; * * @slot - Use the unnamed slot to add `sbb-breadcrumb` elements. */ +export @customElement('sbb-breadcrumb-group') @hostAttributes({ role: 'navigation', }) -export class SbbBreadcrumbGroupElement extends SbbNamedSlotListMixin< +class SbbBreadcrumbGroupElement extends SbbNamedSlotListMixin< SbbBreadcrumbElement, typeof LitElement >(LitElement) { diff --git a/src/elements/breadcrumb/breadcrumb-group/breadcrumb-group.visual.spec.ts b/src/elements/breadcrumb/breadcrumb-group/breadcrumb-group.visual.spec.ts index a5ad0e5097..d8cdcad7d4 100644 --- a/src/elements/breadcrumb/breadcrumb-group/breadcrumb-group.visual.spec.ts +++ b/src/elements/breadcrumb/breadcrumb-group/breadcrumb-group.visual.spec.ts @@ -29,10 +29,7 @@ describe('sbb-breadcrumb-group', () => { .fill(undefined) .map( (_, i) => - html` Breadcrumb ${i + 1} `, )} diff --git a/src/elements/breadcrumb/breadcrumb/breadcrumb.ts b/src/elements/breadcrumb/breadcrumb/breadcrumb.ts index cdb74b1ccf..50ba17f493 100644 --- a/src/elements/breadcrumb/breadcrumb/breadcrumb.ts +++ b/src/elements/breadcrumb/breadcrumb/breadcrumb.ts @@ -14,11 +14,12 @@ import style from './breadcrumb.scss?lit&inline'; * @slot - Use the unnamed slot to add content to the breadcrumb. * @slot icon - Use this to display an icon as breadcrumb. */ +export @customElement('sbb-breadcrumb') -export class SbbBreadcrumbElement extends SbbIconNameMixin(SbbHydrationMixin(SbbLinkBaseElement)) { +class SbbBreadcrumbElement extends SbbIconNameMixin(SbbHydrationMixin(SbbLinkBaseElement)) { public static override styles: CSSResultGroup = style; - @state() private _hasText = false; + @state() private accessor _hasText = false; private _handleSlotchange(): void { this._hasText = Array.from(this.childNodes ?? []).some( diff --git a/src/elements/breadcrumb/breadcrumb/breadcrumb.visual.spec.ts b/src/elements/breadcrumb/breadcrumb/breadcrumb.visual.spec.ts index bda102fd03..13b6ce5427 100644 --- a/src/elements/breadcrumb/breadcrumb/breadcrumb.visual.spec.ts +++ b/src/elements/breadcrumb/breadcrumb/breadcrumb.visual.spec.ts @@ -25,7 +25,6 @@ describe('sbb-breadcrumb', () => { ${singleCase.text || nothing} @@ -46,7 +45,7 @@ describe('sbb-breadcrumb', () => { describe('slotted icon', () => { beforeEach(async function () { root = await visualRegressionFixture(html` - + Slotted icon @@ -67,12 +66,7 @@ describe('sbb-breadcrumb', () => { beforeEach(async function () { root = await visualRegressionFixture(html`
- + This label name is so long that it needs ellipsis to fit
diff --git a/src/elements/breadcrumb/breadcrumb/readme.md b/src/elements/breadcrumb/breadcrumb/readme.md index 72968e9ffc..fc296414ce 100644 --- a/src/elements/breadcrumb/breadcrumb/readme.md +++ b/src/elements/breadcrumb/breadcrumb/readme.md @@ -39,14 +39,14 @@ By default, the `sbb-breadcrumb-group` component sets `aria-current="page"` on t ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| -------------------- | --------------------- | ------- | --------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the inner anchor element. | -| `download` | `download` | public | `boolean \| undefined` | | Whether the browser will show the download dialog on click. | -| `href` | `href` | public | `string \| undefined` | | The href value you want to link to. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `rel` | `rel` | public | `string \| undefined` | | The relationship of the linked URL as space-separated link types. | -| `target` | `target` | public | `LinkTargetType \| string \| undefined` | | Where to display the linked URL. | +| Name | Attribute | Privacy | Type | Default | Description | +| -------------------- | --------------------- | ------- | -------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the inner anchor element. | +| `download` | `download` | public | `boolean` | `false` | Whether the browser will show the download dialog on click. | +| `href` | `href` | public | `string` | `''` | The href value you want to link to. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `rel` | `rel` | public | `string` | `''` | The relationship of the linked URL as space-separated link types. | +| `target` | `target` | public | `LinkTargetType \| string` | `''` | Where to display the linked URL. | ## Slots diff --git a/src/elements/button/button-link/button-link.ts b/src/elements/button/button-link/button-link.ts index 714f34ee34..6b0a43165c 100644 --- a/src/elements/button/button-link/button-link.ts +++ b/src/elements/button/button-link/button-link.ts @@ -11,8 +11,9 @@ import { buttonCommonStyle, buttonPrimaryStyle, SbbButtonCommonElementMixin } fr * @slot - Use the unnamed slot to add content to the button-link. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-button-link') -export class SbbButtonLinkElement extends SbbButtonCommonElementMixin( +class SbbButtonLinkElement extends SbbButtonCommonElementMixin( SbbDisabledInteractiveMixin(SbbDisabledMixin(SbbLinkBaseElement)), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonPrimaryStyle]; diff --git a/src/elements/button/button-link/readme.md b/src/elements/button/button-link/readme.md index ab5728e234..8a5aac2318 100644 --- a/src/elements/button/button-link/readme.md +++ b/src/elements/button/button-link/readme.md @@ -72,18 +72,18 @@ Use the accessibility properties in case of an icon-only button to describe the ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| --------------------- | ---------------------- | ------- | --------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the inner anchor element. | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | -| `download` | `download` | public | `boolean \| undefined` | | Whether the browser will show the download dialog on click. | -| `href` | `href` | public | `string \| undefined` | | The href value you want to link to. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `rel` | `rel` | public | `string \| undefined` | | The relationship of the linked URL as space-separated link types. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | -| `target` | `target` | public | `LinkTargetType \| string \| undefined` | | Where to display the linked URL. | +| Name | Attribute | Privacy | Type | Default | Description | +| --------------------- | ---------------------- | ------- | -------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the inner anchor element. | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | +| `download` | `download` | public | `boolean` | `false` | Whether the browser will show the download dialog on click. | +| `href` | `href` | public | `string` | `''` | The href value you want to link to. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `rel` | `rel` | public | `string` | `''` | The relationship of the linked URL as space-separated link types. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | +| `target` | `target` | public | `LinkTargetType \| string` | `''` | Where to display the linked URL. | ## Slots diff --git a/src/elements/button/button-static/button-static.ts b/src/elements/button/button-static/button-static.ts index aa31b7180e..7f37ef8b82 100644 --- a/src/elements/button/button-static/button-static.ts +++ b/src/elements/button/button-static/button-static.ts @@ -11,8 +11,9 @@ import { buttonCommonStyle, buttonPrimaryStyle, SbbButtonCommonElementMixin } fr * @slot - Use the unnamed slot to add content to the button-static. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-button-static') -export class SbbButtonStaticElement extends SbbButtonCommonElementMixin( +class SbbButtonStaticElement extends SbbButtonCommonElementMixin( SbbDisabledMixin(SbbActionBaseElement), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonPrimaryStyle]; diff --git a/src/elements/button/button-static/readme.md b/src/elements/button/button-static/readme.md index ae08037ffe..e9741adf3f 100644 --- a/src/elements/button/button-static/readme.md +++ b/src/elements/button/button-static/readme.md @@ -57,12 +57,12 @@ Use the accessibility properties in case of an icon-only button to describe the ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ---------- | ----------- | ------- | ---------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | +| Name | Attribute | Privacy | Type | Default | Description | +| ---------- | ----------- | ------- | --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | ## Slots diff --git a/src/elements/button/button/button.ts b/src/elements/button/button/button.ts index f956f86828..4eb978e88d 100644 --- a/src/elements/button/button/button.ts +++ b/src/elements/button/button/button.ts @@ -11,8 +11,9 @@ import { buttonCommonStyle, buttonPrimaryStyle, SbbButtonCommonElementMixin } fr * @slot - Use the unnamed slot to add content to the button. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-button') -export class SbbButtonElement extends SbbButtonCommonElementMixin( +class SbbButtonElement extends SbbButtonCommonElementMixin( SbbDisabledTabIndexActionMixin(SbbButtonBaseElement), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonPrimaryStyle]; diff --git a/src/elements/button/button/readme.md b/src/elements/button/button/readme.md index f1894686c5..527c48d04e 100644 --- a/src/elements/button/button/readme.md +++ b/src/elements/button/button/readme.md @@ -79,17 +79,17 @@ guard against such cases in your component. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| --------------------- | ---------------------- | ------- | ---------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | -| `form` | `form` | public | `string \| undefined` | | The
element to associate the button with. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `name` | `name` | public | `string` | | The name of the button element. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | -| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | -| `value` | `value` | public | `string` | | The value of the button element. | +| Name | Attribute | Privacy | Type | Default | Description | +| --------------------- | ---------------------- | ------- | --------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | +| `form` | `form` | public | `string` | `''` | The element to associate the button with. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `name` | `name` | public | `string` | | The name of the button element. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | +| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | +| `value` | `value` | public | `string` | | The value of the button element. | ## Slots diff --git a/src/elements/button/common/button-common.ts b/src/elements/button/common/button-common.ts index 31e8317447..b86ab883a6 100644 --- a/src/elements/button/common/button-common.ts +++ b/src/elements/button/common/button-common.ts @@ -19,10 +19,10 @@ export type SbbButtonSize = 'l' | 'm' | 's'; export declare class SbbButtonCommonElementMixinType implements SbbNegativeMixinType, Partial, Partial { - public size?: SbbButtonSize; - public disabled: boolean; - public iconName?: string; - public negative: boolean; + public accessor size: SbbButtonSize; + public accessor disabled: boolean; + public accessor iconName: string; + public accessor negative: boolean; } // eslint-disable-next-line @typescript-eslint/naming-convention @@ -38,7 +38,7 @@ export const SbbButtonCommonElementMixin = { /** Size variant, either l or m. */ - @property({ reflect: true }) public size?: SbbButtonSize = 'l'; + @property({ reflect: true }) public accessor size: SbbButtonSize = 'l'; protected override renderTemplate(): TemplateResult { return html` diff --git a/src/elements/button/mini-button-group/mini-button-group.ts b/src/elements/button/mini-button-group/mini-button-group.ts index ddcf9a30b6..4715e89960 100644 --- a/src/elements/button/mini-button-group/mini-button-group.ts +++ b/src/elements/button/mini-button-group/mini-button-group.ts @@ -2,6 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit'; import { html, LitElement } from 'lit'; import { customElement, property } from 'lit/decorators.js'; +import { forceType } from '../../core/decorators.js'; import { SbbNamedSlotListMixin, SbbNegativeMixin } from '../../core/mixins.js'; import type { SbbDividerElement } from '../../divider/divider.js'; import type { SbbMiniButtonElement } from '../mini-button/mini-button.js'; @@ -16,18 +17,21 @@ export type SbbMiniButtonGroupSize = 's' | 'm' | 'l' | 'xl'; * * @slot - Use the unnamed slot to add `sbb-mini-button` and `sbb-divider` elements. */ +export @customElement('sbb-mini-button-group') -export class SbbMiniButtonGroupElement extends SbbNegativeMixin( +class SbbMiniButtonGroupElement extends SbbNegativeMixin( SbbNamedSlotListMixin(LitElement), ) { public static override styles: CSSResultGroup = style; protected override readonly listChildLocalNames = ['sbb-mini-button', 'sbb-divider']; /** This will be forwarded as aria-label to the list that contains the buttons. */ - @property({ attribute: 'accessibility-label' }) public accessibilityLabel?: string; + @forceType() + @property({ attribute: 'accessibility-label' }) + public accessor accessibilityLabel: string = ''; /** Size variant, either s, m, l or xl. */ - @property({ reflect: true }) public size: SbbMiniButtonGroupSize = 'm'; + @property({ reflect: true }) public accessor size: SbbMiniButtonGroupSize = 'm'; protected override willUpdate(changedProperties: PropertyValues): void { super.willUpdate(changedProperties); diff --git a/src/elements/button/mini-button-group/readme.md b/src/elements/button/mini-button-group/readme.md index 40cf0f3eea..cdc7b7368d 100644 --- a/src/elements/button/mini-button-group/readme.md +++ b/src/elements/button/mini-button-group/readme.md @@ -33,7 +33,7 @@ to ensure that the button list is read by screen readers with the correct size. | Name | Attribute | Privacy | Type | Default | Description | | -------------------- | --------------------- | ------- | ------------------------ | ------- | --------------------------------------------------------------------------- | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the list that contains the buttons. | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the list that contains the buttons. | | `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | | `size` | `size` | public | `SbbMiniButtonGroupSize` | `'m'` | Size variant, either s, m, l or xl. | diff --git a/src/elements/button/mini-button/mini-button-base-element.ts b/src/elements/button/mini-button/mini-button-base-element.ts index 7d498911ca..31a57fda41 100644 --- a/src/elements/button/mini-button/mini-button-base-element.ts +++ b/src/elements/button/mini-button/mini-button-base-element.ts @@ -5,8 +5,9 @@ import { slotState } from '../../core/decorators.js'; import { SbbNegativeMixin } from '../../core/mixins.js'; import { SbbIconNameMixin } from '../../icon.js'; +export @slotState() -export abstract class SbbMiniButtonBaseElement extends SbbNegativeMixin( +abstract class SbbMiniButtonBaseElement extends SbbNegativeMixin( SbbIconNameMixin(SbbButtonBaseElement), ) { protected override renderTemplate(): TemplateResult { diff --git a/src/elements/button/mini-button/mini-button.ts b/src/elements/button/mini-button/mini-button.ts index a7fd7bb56f..c4ce6c4f71 100644 --- a/src/elements/button/mini-button/mini-button.ts +++ b/src/elements/button/mini-button/mini-button.ts @@ -12,8 +12,9 @@ import style from './mini-button.scss?lit&inline'; * * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-mini-button') -export class SbbMiniButtonElement extends SbbDisabledTabIndexActionMixin(SbbMiniButtonBaseElement) { +class SbbMiniButtonElement extends SbbDisabledTabIndexActionMixin(SbbMiniButtonBaseElement) { public static override styles: CSSResultGroup = style; } diff --git a/src/elements/button/mini-button/readme.md b/src/elements/button/mini-button/readme.md index 8029cbd66d..d9635b9463 100644 --- a/src/elements/button/mini-button/readme.md +++ b/src/elements/button/mini-button/readme.md @@ -87,16 +87,16 @@ guard against such cases in your component. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| --------------------- | ---------------------- | ------- | --------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | -| `form` | `form` | public | `string \| undefined` | | The element to associate the button with. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `name` | `name` | public | `string` | | The name of the button element. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | -| `value` | `value` | public | `string` | | The value of the button element. | +| Name | Attribute | Privacy | Type | Default | Description | +| --------------------- | ---------------------- | ------- | --------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | +| `form` | `form` | public | `string` | `''` | The element to associate the button with. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `name` | `name` | public | `string` | | The name of the button element. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | +| `value` | `value` | public | `string` | | The value of the button element. | ## Slots diff --git a/src/elements/button/secondary-button-link/readme.md b/src/elements/button/secondary-button-link/readme.md index 3fa66b7b58..086b6ab7ae 100644 --- a/src/elements/button/secondary-button-link/readme.md +++ b/src/elements/button/secondary-button-link/readme.md @@ -77,18 +77,18 @@ Use the accessibility properties in case of an icon-only button to describe the ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| --------------------- | ---------------------- | ------- | --------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the inner anchor element. | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | -| `download` | `download` | public | `boolean \| undefined` | | Whether the browser will show the download dialog on click. | -| `href` | `href` | public | `string \| undefined` | | The href value you want to link to. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `rel` | `rel` | public | `string \| undefined` | | The relationship of the linked URL as space-separated link types. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | -| `target` | `target` | public | `LinkTargetType \| string \| undefined` | | Where to display the linked URL. | +| Name | Attribute | Privacy | Type | Default | Description | +| --------------------- | ---------------------- | ------- | -------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the inner anchor element. | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | +| `download` | `download` | public | `boolean` | `false` | Whether the browser will show the download dialog on click. | +| `href` | `href` | public | `string` | `''` | The href value you want to link to. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `rel` | `rel` | public | `string` | `''` | The relationship of the linked URL as space-separated link types. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | +| `target` | `target` | public | `LinkTargetType \| string` | `''` | Where to display the linked URL. | ## Slots diff --git a/src/elements/button/secondary-button-link/secondary-button-link.ts b/src/elements/button/secondary-button-link/secondary-button-link.ts index b3893acfad..499cf3357a 100644 --- a/src/elements/button/secondary-button-link/secondary-button-link.ts +++ b/src/elements/button/secondary-button-link/secondary-button-link.ts @@ -11,8 +11,9 @@ import { buttonCommonStyle, buttonSecondaryStyle, SbbButtonCommonElementMixin } * @slot - Use the unnamed slot to add content to the secondary-button-link. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-secondary-button-link') -export class SbbSecondaryButtonLinkElement extends SbbButtonCommonElementMixin( +class SbbSecondaryButtonLinkElement extends SbbButtonCommonElementMixin( SbbDisabledInteractiveMixin(SbbDisabledMixin(SbbLinkBaseElement)), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonSecondaryStyle]; diff --git a/src/elements/button/secondary-button-static/readme.md b/src/elements/button/secondary-button-static/readme.md index 17d1919cf9..ad9eb30407 100644 --- a/src/elements/button/secondary-button-static/readme.md +++ b/src/elements/button/secondary-button-static/readme.md @@ -60,12 +60,12 @@ Use the accessibility properties in case of an icon-only button to describe the ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ---------- | ----------- | ------- | ---------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | +| Name | Attribute | Privacy | Type | Default | Description | +| ---------- | ----------- | ------- | --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | ## Slots diff --git a/src/elements/button/secondary-button-static/secondary-button-static.ts b/src/elements/button/secondary-button-static/secondary-button-static.ts index d64ec05104..c908687cc0 100644 --- a/src/elements/button/secondary-button-static/secondary-button-static.ts +++ b/src/elements/button/secondary-button-static/secondary-button-static.ts @@ -11,8 +11,9 @@ import { buttonCommonStyle, buttonSecondaryStyle, SbbButtonCommonElementMixin } * @slot - Use the unnamed slot to add content to the secondary-button-static. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-secondary-button-static') -export class SbbSecondaryButtonStaticElement extends SbbButtonCommonElementMixin( +class SbbSecondaryButtonStaticElement extends SbbButtonCommonElementMixin( SbbDisabledMixin(SbbActionBaseElement), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonSecondaryStyle]; diff --git a/src/elements/button/secondary-button/readme.md b/src/elements/button/secondary-button/readme.md index 1797f3daa0..57ca9fb6da 100644 --- a/src/elements/button/secondary-button/readme.md +++ b/src/elements/button/secondary-button/readme.md @@ -84,17 +84,17 @@ guard against such cases in your component. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| --------------------- | ---------------------- | ------- | ---------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | -| `form` | `form` | public | `string \| undefined` | | The element to associate the button with. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `name` | `name` | public | `string` | | The name of the button element. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | -| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | -| `value` | `value` | public | `string` | | The value of the button element. | +| Name | Attribute | Privacy | Type | Default | Description | +| --------------------- | ---------------------- | ------- | --------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | +| `form` | `form` | public | `string` | `''` | The element to associate the button with. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `name` | `name` | public | `string` | | The name of the button element. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | +| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | +| `value` | `value` | public | `string` | | The value of the button element. | ## Slots diff --git a/src/elements/button/secondary-button/secondary-button.ts b/src/elements/button/secondary-button/secondary-button.ts index 415f2d3cdb..67b09e06fa 100644 --- a/src/elements/button/secondary-button/secondary-button.ts +++ b/src/elements/button/secondary-button/secondary-button.ts @@ -11,8 +11,9 @@ import { buttonCommonStyle, buttonSecondaryStyle, SbbButtonCommonElementMixin } * @slot - Use the unnamed slot to add content to the secondary-button. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-secondary-button') -export class SbbSecondaryButtonElement extends SbbButtonCommonElementMixin( +class SbbSecondaryButtonElement extends SbbButtonCommonElementMixin( SbbDisabledTabIndexActionMixin(SbbButtonBaseElement), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonSecondaryStyle]; diff --git a/src/elements/button/tertiary-button-link/readme.md b/src/elements/button/tertiary-button-link/readme.md index f0305783e1..06162ad796 100644 --- a/src/elements/button/tertiary-button-link/readme.md +++ b/src/elements/button/tertiary-button-link/readme.md @@ -77,18 +77,18 @@ Use the accessibility properties in case of an icon-only button to describe the ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| --------------------- | ---------------------- | ------- | --------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the inner anchor element. | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | -| `download` | `download` | public | `boolean \| undefined` | | Whether the browser will show the download dialog on click. | -| `href` | `href` | public | `string \| undefined` | | The href value you want to link to. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `rel` | `rel` | public | `string \| undefined` | | The relationship of the linked URL as space-separated link types. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | -| `target` | `target` | public | `LinkTargetType \| string \| undefined` | | Where to display the linked URL. | +| Name | Attribute | Privacy | Type | Default | Description | +| --------------------- | ---------------------- | ------- | -------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the inner anchor element. | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | +| `download` | `download` | public | `boolean` | `false` | Whether the browser will show the download dialog on click. | +| `href` | `href` | public | `string` | `''` | The href value you want to link to. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `rel` | `rel` | public | `string` | `''` | The relationship of the linked URL as space-separated link types. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | +| `target` | `target` | public | `LinkTargetType \| string` | `''` | Where to display the linked URL. | ## Slots diff --git a/src/elements/button/tertiary-button-link/tertiary-button-link.ts b/src/elements/button/tertiary-button-link/tertiary-button-link.ts index 72cfba79d2..fe9d4b5810 100644 --- a/src/elements/button/tertiary-button-link/tertiary-button-link.ts +++ b/src/elements/button/tertiary-button-link/tertiary-button-link.ts @@ -11,8 +11,9 @@ import { buttonCommonStyle, buttonTertiaryStyle, SbbButtonCommonElementMixin } f * @slot - Use the unnamed slot to add content to the tertiary-button-link. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-tertiary-button-link') -export class SbbTertiaryButtonLinkElement extends SbbButtonCommonElementMixin( +class SbbTertiaryButtonLinkElement extends SbbButtonCommonElementMixin( SbbDisabledInteractiveMixin(SbbDisabledMixin(SbbLinkBaseElement)), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonTertiaryStyle]; diff --git a/src/elements/button/tertiary-button-static/readme.md b/src/elements/button/tertiary-button-static/readme.md index 3154833eea..9c3133deb3 100644 --- a/src/elements/button/tertiary-button-static/readme.md +++ b/src/elements/button/tertiary-button-static/readme.md @@ -60,12 +60,12 @@ Use the accessibility properties in case of an icon-only button to describe the ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ---------- | ----------- | ------- | ---------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | +| Name | Attribute | Privacy | Type | Default | Description | +| ---------- | ----------- | ------- | --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | ## Slots diff --git a/src/elements/button/tertiary-button-static/tertiary-button-static.ts b/src/elements/button/tertiary-button-static/tertiary-button-static.ts index 8b2559a873..2350e6f57b 100644 --- a/src/elements/button/tertiary-button-static/tertiary-button-static.ts +++ b/src/elements/button/tertiary-button-static/tertiary-button-static.ts @@ -11,8 +11,9 @@ import { buttonCommonStyle, buttonTertiaryStyle, SbbButtonCommonElementMixin } f * @slot - Use the unnamed slot to add content to the tertiary-button-static. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-tertiary-button-static') -export class SbbTertiaryButtonStaticElement extends SbbButtonCommonElementMixin( +class SbbTertiaryButtonStaticElement extends SbbButtonCommonElementMixin( SbbDisabledMixin(SbbActionBaseElement), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonTertiaryStyle]; diff --git a/src/elements/button/tertiary-button/readme.md b/src/elements/button/tertiary-button/readme.md index 6c5150dbd8..736a65410d 100644 --- a/src/elements/button/tertiary-button/readme.md +++ b/src/elements/button/tertiary-button/readme.md @@ -84,17 +84,17 @@ guard against such cases in your component. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| --------------------- | ---------------------- | ------- | ---------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | -| `form` | `form` | public | `string \| undefined` | | The element to associate the button with. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `name` | `name` | public | `string` | | The name of the button element. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | -| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | -| `value` | `value` | public | `string` | | The value of the button element. | +| Name | Attribute | Privacy | Type | Default | Description | +| --------------------- | ---------------------- | ------- | --------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | +| `form` | `form` | public | `string` | `''` | The element to associate the button with. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `name` | `name` | public | `string` | | The name of the button element. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | +| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | +| `value` | `value` | public | `string` | | The value of the button element. | ## Slots diff --git a/src/elements/button/tertiary-button/tertiary-button.ts b/src/elements/button/tertiary-button/tertiary-button.ts index 02c656130b..e2bb6e329b 100644 --- a/src/elements/button/tertiary-button/tertiary-button.ts +++ b/src/elements/button/tertiary-button/tertiary-button.ts @@ -11,8 +11,9 @@ import { buttonCommonStyle, buttonTertiaryStyle, SbbButtonCommonElementMixin } f * @slot - Use the unnamed slot to add content to the tertiary-button. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-tertiary-button') -export class SbbTertiaryButtonElement extends SbbButtonCommonElementMixin( +class SbbTertiaryButtonElement extends SbbButtonCommonElementMixin( SbbDisabledTabIndexActionMixin(SbbButtonBaseElement), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonTertiaryStyle]; diff --git a/src/elements/button/transparent-button-link/readme.md b/src/elements/button/transparent-button-link/readme.md index 98c627da08..7a01c1e65f 100644 --- a/src/elements/button/transparent-button-link/readme.md +++ b/src/elements/button/transparent-button-link/readme.md @@ -77,18 +77,18 @@ Use the accessibility properties in case of an icon-only button to describe the ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| --------------------- | ---------------------- | ------- | --------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the inner anchor element. | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | -| `download` | `download` | public | `boolean \| undefined` | | Whether the browser will show the download dialog on click. | -| `href` | `href` | public | `string \| undefined` | | The href value you want to link to. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `rel` | `rel` | public | `string \| undefined` | | The relationship of the linked URL as space-separated link types. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | -| `target` | `target` | public | `LinkTargetType \| string \| undefined` | | Where to display the linked URL. | +| Name | Attribute | Privacy | Type | Default | Description | +| --------------------- | ---------------------- | ------- | -------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the inner anchor element. | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | +| `download` | `download` | public | `boolean` | `false` | Whether the browser will show the download dialog on click. | +| `href` | `href` | public | `string` | `''` | The href value you want to link to. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `rel` | `rel` | public | `string` | `''` | The relationship of the linked URL as space-separated link types. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | +| `target` | `target` | public | `LinkTargetType \| string` | `''` | Where to display the linked URL. | ## Slots diff --git a/src/elements/button/transparent-button-link/transparent-button-link.ts b/src/elements/button/transparent-button-link/transparent-button-link.ts index 7618cf8deb..104b7f1ed0 100644 --- a/src/elements/button/transparent-button-link/transparent-button-link.ts +++ b/src/elements/button/transparent-button-link/transparent-button-link.ts @@ -15,8 +15,9 @@ import { * @slot - Use the unnamed slot to add content to the transparent-button-link. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-transparent-button-link') -export class SbbTransparentButtonLinkElement extends SbbButtonCommonElementMixin( +class SbbTransparentButtonLinkElement extends SbbButtonCommonElementMixin( SbbDisabledInteractiveMixin(SbbDisabledMixin(SbbLinkBaseElement)), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonTransparentStyle]; diff --git a/src/elements/button/transparent-button-static/readme.md b/src/elements/button/transparent-button-static/readme.md index c0f2964c1e..8b750e41b7 100644 --- a/src/elements/button/transparent-button-static/readme.md +++ b/src/elements/button/transparent-button-static/readme.md @@ -60,12 +60,12 @@ Use the accessibility properties in case of an icon-only button to describe the ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ---------- | ----------- | ------- | ---------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | +| Name | Attribute | Privacy | Type | Default | Description | +| ---------- | ----------- | ------- | --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | ## Slots diff --git a/src/elements/button/transparent-button-static/transparent-button-static.ts b/src/elements/button/transparent-button-static/transparent-button-static.ts index 8c60ea781d..48f6b7359c 100644 --- a/src/elements/button/transparent-button-static/transparent-button-static.ts +++ b/src/elements/button/transparent-button-static/transparent-button-static.ts @@ -15,8 +15,9 @@ import { * @slot - Use the unnamed slot to add content to the transparent-button-static. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-transparent-button-static') -export class SbbTransparentButtonStaticElement extends SbbButtonCommonElementMixin( +class SbbTransparentButtonStaticElement extends SbbButtonCommonElementMixin( SbbDisabledMixin(SbbActionBaseElement), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonTransparentStyle]; diff --git a/src/elements/button/transparent-button/readme.md b/src/elements/button/transparent-button/readme.md index a373b33ef9..581d050939 100644 --- a/src/elements/button/transparent-button/readme.md +++ b/src/elements/button/transparent-button/readme.md @@ -84,17 +84,17 @@ guard against such cases in your component. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| --------------------- | ---------------------- | ------- | ---------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | -| `form` | `form` | public | `string \| undefined` | | The element to associate the button with. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `name` | `name` | public | `string` | | The name of the button element. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `size` | `size` | public | `SbbButtonSize \| undefined` | `'l'` | Size variant, either l or m. | -| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | -| `value` | `value` | public | `string` | | The value of the button element. | +| Name | Attribute | Privacy | Type | Default | Description | +| --------------------- | ---------------------- | ------- | --------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | +| `form` | `form` | public | `string` | `''` | The element to associate the button with. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `name` | `name` | public | `string` | | The name of the button element. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `size` | `size` | public | `SbbButtonSize` | `'l'` | Size variant, either l or m. | +| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | +| `value` | `value` | public | `string` | | The value of the button element. | ## Slots diff --git a/src/elements/button/transparent-button/transparent-button.ts b/src/elements/button/transparent-button/transparent-button.ts index b8fbb74862..515c676f24 100644 --- a/src/elements/button/transparent-button/transparent-button.ts +++ b/src/elements/button/transparent-button/transparent-button.ts @@ -15,8 +15,9 @@ import { * @slot - Use the unnamed slot to add content to the transparent-button. * @slot icon - Slot used to display the icon, if one is set */ +export @customElement('sbb-transparent-button') -export class SbbTransparentButtonElement extends SbbButtonCommonElementMixin( +class SbbTransparentButtonElement extends SbbButtonCommonElementMixin( SbbDisabledTabIndexActionMixin(SbbButtonBaseElement), ) { public static override styles: CSSResultGroup = [buttonCommonStyle, buttonTransparentStyle]; diff --git a/src/elements/calendar/calendar.ts b/src/elements/calendar/calendar.ts index 37884e2460..4f0e05243f 100644 --- a/src/elements/calendar/calendar.ts +++ b/src/elements/calendar/calendar.ts @@ -21,6 +21,7 @@ import { YEARS_PER_PAGE, YEARS_PER_ROW, } from '../core/datetime.js'; +import { forceType } from '../core/decorators.js'; import { isBreakpoint } from '../core/dom.js'; import { EventEmitter } from '../core/eventing.js'; import { @@ -91,18 +92,21 @@ export type CalendarView = 'day' | 'month' | 'year'; * * @event {CustomEvent} dateSelected - Event emitted on date selection. */ +export @customElement('sbb-calendar') -export class SbbCalendarElement extends SbbHydrationMixin(LitElement) { +class SbbCalendarElement extends SbbHydrationMixin(LitElement) { public static override styles: CSSResultGroup = style; public static readonly events = { dateSelected: 'dateSelected', } as const; /** If set to true, two months are displayed */ - @property({ type: Boolean }) public wide = false; + @forceType() + @property({ type: Boolean }) + public accessor wide: boolean = false; /** The initial view of the calendar which should be displayed on opening. */ - @property() public view: CalendarView = 'day'; + @property() public accessor view: CalendarView = 'day'; /** The minimum valid date. Takes T Object, ISOString, and Unix Timestamp (number of seconds since Jan 1, 1970). */ @property() @@ -154,7 +158,9 @@ export class SbbCalendarElement extends SbbHydrationMixin(LitElement) private _selectedDate?: T | null; /** A function used to filter out dates. */ - @property({ attribute: 'date-filter' }) public dateFilter?: (date: T | null) => boolean; + @property({ attribute: 'date-filter' }) public accessor dateFilter: + | ((date: T | null) => boolean) + | null = null; private _dateAdapter: DateAdapter = readConfig().datetime?.dateAdapter ?? defaultDateAdapter; @@ -165,10 +171,10 @@ export class SbbCalendarElement extends SbbHydrationMixin(LitElement) ); /** The currently active date. */ - @state() private _activeDate: T = this.now; + @state() private accessor _activeDate: T = this.now; /** The selected date as ISOString. */ - @state() private _selected?: string; + @state() private accessor _selected: string | undefined; /** The current wide property considering property value and breakpoints. From zero to small `wide` has always to be false. */ @state() @@ -179,7 +185,7 @@ export class SbbCalendarElement extends SbbHydrationMixin(LitElement) return this.hasAttribute('data-wide'); } - @state() private _calendarView: CalendarView = 'day'; + @state() private accessor _calendarView: CalendarView = 'day'; private _nextCalendarView: CalendarView = 'day'; @@ -221,7 +227,7 @@ export class SbbCalendarElement extends SbbHydrationMixin(LitElement) private _resetFocus = false; @state() - private _initialized = false; + private accessor _initialized = false; private _abort = new SbbConnectedAbortController(this); private _language = new SbbLanguageController(this).withHandler(() => { diff --git a/src/elements/calendar/readme.md b/src/elements/calendar/readme.md index 47829d412e..2a85d338af 100644 --- a/src/elements/calendar/readme.md +++ b/src/elements/calendar/readme.md @@ -63,15 +63,15 @@ For accessibility purposes, the component is rendered as a native table element ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------------ | ------------- | ------- | ------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- | -| `dateFilter` | `date-filter` | public | `(date: T \| null) => boolean \| undefined` | | A function used to filter out dates. | -| `max` | `max` | public | `T \| null` | | The maximum valid date. Takes T Object, ISOString, and Unix Timestamp (number of seconds since Jan 1, 1970). | -| `min` | `min` | public | `T \| null` | | The minimum valid date. Takes T Object, ISOString, and Unix Timestamp (number of seconds since Jan 1, 1970). | -| `now` | `now` | public | `T` | `null` | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. | -| `selected` | `selected` | public | `T \| null` | | The selected date. Takes T Object, ISOString, and Unix Timestamp (number of seconds since Jan 1, 1970). | -| `view` | `view` | public | `CalendarView` | `'day'` | The initial view of the calendar which should be displayed on opening. | -| `wide` | `wide` | public | `boolean` | `false` | If set to true, two months are displayed | +| Name | Attribute | Privacy | Type | Default | Description | +| ------------ | ------------- | ------- | ---------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- | +| `dateFilter` | `date-filter` | public | `((date: T \| null) => boolean) \| null` | `null` | A function used to filter out dates. | +| `max` | `max` | public | `T \| null` | | The maximum valid date. Takes T Object, ISOString, and Unix Timestamp (number of seconds since Jan 1, 1970). | +| `min` | `min` | public | `T \| null` | | The minimum valid date. Takes T Object, ISOString, and Unix Timestamp (number of seconds since Jan 1, 1970). | +| `now` | `now` | public | `T` | `null` | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. | +| `selected` | `selected` | public | `T \| null` | | The selected date. Takes T Object, ISOString, and Unix Timestamp (number of seconds since Jan 1, 1970). | +| `view` | `view` | public | `CalendarView` | `'day'` | The initial view of the calendar which should be displayed on opening. | +| `wide` | `wide` | public | `boolean` | `false` | If set to true, two months are displayed | ## Methods diff --git a/src/elements/card/card-badge/card-badge.ts b/src/elements/card/card-badge/card-badge.ts index 62a2626125..39076b9474 100644 --- a/src/elements/card/card-badge/card-badge.ts +++ b/src/elements/card/card-badge/card-badge.ts @@ -12,16 +12,17 @@ import style from './card-badge.scss?lit&inline'; * @slot - Use the unnamed slot to add content to the badge. * Content parts should be wrapped in `` tags to achieve correct spacings. */ +export @customElement('sbb-card-badge') @hostAttributes({ slot: 'badge', role: 'text', }) -export class SbbCardBadgeElement extends LitElement { +class SbbCardBadgeElement extends LitElement { public static override styles: CSSResultGroup = style; /** Color of the card badge. */ - @property({ reflect: true }) public color: 'charcoal' | 'white' = 'charcoal'; + @property({ reflect: true }) public accessor color: 'charcoal' | 'white' = 'charcoal'; private _parentElement?: HTMLElement | null; diff --git a/src/elements/card/card-button/card-button.ts b/src/elements/card/card-button/card-button.ts index fdaab1a5a1..681abe201b 100644 --- a/src/elements/card/card-button/card-button.ts +++ b/src/elements/card/card-button/card-button.ts @@ -9,8 +9,9 @@ import { SbbCardActionCommonElementMixin } from '../common.js'; * @slot - Use the unnamed slot to add a descriptive label / title of the button (important!). * This is relevant for SEO and screen readers. */ +export @customElement('sbb-card-button') -export class SbbCardButtonElement extends SbbCardActionCommonElementMixin(SbbButtonBaseElement) { +class SbbCardButtonElement extends SbbCardActionCommonElementMixin(SbbButtonBaseElement) { protected override actionRole: 'link' | 'button' = 'button'; } diff --git a/src/elements/card/card-button/readme.md b/src/elements/card/card-button/readme.md index dd6c18e365..6cdd288b11 100644 --- a/src/elements/card/card-button/readme.md +++ b/src/elements/card/card-button/readme.md @@ -22,13 +22,13 @@ as it is used for search engines and screen-reader users. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| -------- | --------- | ------- | --------------------- | ---------- | ------------------------------------------------ | -| `active` | `active` | public | `boolean` | `false` | Whether the card is active. | -| `form` | `form` | public | `string \| undefined` | | The element to associate the button with. | -| `name` | `name` | public | `string` | | The name of the button element. | -| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | -| `value` | `value` | public | `string` | | The value of the button element. | +| Name | Attribute | Privacy | Type | Default | Description | +| -------- | --------- | ------- | --------------- | ---------- | ------------------------------------------------ | +| `active` | `active` | public | `boolean` | `false` | Whether the card is active. | +| `form` | `form` | public | `string` | `''` | The element to associate the button with. | +| `name` | `name` | public | `string` | | The name of the button element. | +| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | +| `value` | `value` | public | `string` | | The value of the button element. | ## Slots diff --git a/src/elements/card/card-link/card-link.ts b/src/elements/card/card-link/card-link.ts index b248c99d46..d99c5250cf 100644 --- a/src/elements/card/card-link/card-link.ts +++ b/src/elements/card/card-link/card-link.ts @@ -9,8 +9,9 @@ import { SbbCardActionCommonElementMixin } from '../common.js'; * @slot - Use the unnamed slot to add a descriptive label / title of the link (important!). * This is relevant for SEO and screen readers. */ +export @customElement('sbb-card-link') -export class SbbCardLinkElement extends SbbCardActionCommonElementMixin(SbbLinkBaseElement) { +class SbbCardLinkElement extends SbbCardActionCommonElementMixin(SbbLinkBaseElement) { protected override actionRole: 'link' | 'button' = 'link'; } diff --git a/src/elements/card/card-link/readme.md b/src/elements/card/card-link/readme.md index 41657b5fe9..bb545ba6f6 100644 --- a/src/elements/card/card-link/readme.md +++ b/src/elements/card/card-link/readme.md @@ -22,14 +22,14 @@ as it is used for search engines and screen-reader users. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| -------------------- | --------------------- | ------- | --------------------------------------- | ------- | ----------------------------------------------------------------- | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the inner anchor element. | -| `active` | `active` | public | `boolean` | `false` | Whether the card is active. | -| `download` | `download` | public | `boolean \| undefined` | | Whether the browser will show the download dialog on click. | -| `href` | `href` | public | `string \| undefined` | | The href value you want to link to. | -| `rel` | `rel` | public | `string \| undefined` | | The relationship of the linked URL as space-separated link types. | -| `target` | `target` | public | `LinkTargetType \| string \| undefined` | | Where to display the linked URL. | +| Name | Attribute | Privacy | Type | Default | Description | +| -------------------- | --------------------- | ------- | -------------------------- | ------- | ----------------------------------------------------------------- | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the inner anchor element. | +| `active` | `active` | public | `boolean` | `false` | Whether the card is active. | +| `download` | `download` | public | `boolean` | `false` | Whether the browser will show the download dialog on click. | +| `href` | `href` | public | `string` | `''` | The href value you want to link to. | +| `rel` | `rel` | public | `string` | `''` | The relationship of the linked URL as space-separated link types. | +| `target` | `target` | public | `LinkTargetType \| string` | `''` | Where to display the linked URL. | ## Slots diff --git a/src/elements/card/card/card.ts b/src/elements/card/card/card.ts index 669553527d..bb67f1ebb0 100644 --- a/src/elements/card/card/card.ts +++ b/src/elements/card/card/card.ts @@ -11,15 +11,23 @@ import style from './card.scss?lit&inline'; * @slot badge - Use this slot to render a `sbb-card-badge` component. * @slot action - Use this slot to render a `sbb-card-button` or a `sbb-card-link` component. */ +export @customElement('sbb-card') -export class SbbCardElement extends LitElement { +class SbbCardElement extends LitElement { public static override styles: CSSResultGroup = style; /** Size variant, either xs, s, m, l, xl, xxl or xxxl. */ - @property({ reflect: true }) public size: 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl' = 'm'; + @property({ reflect: true }) public accessor size: + | 'xs' + | 's' + | 'm' + | 'l' + | 'xl' + | 'xxl' + | 'xxxl' = 'm'; /** Option to set the component's background color. */ - @property({ reflect: true }) public color: + @property({ reflect: true }) public accessor color: | 'white' | 'milk' | 'transparent-bordered' diff --git a/src/elements/card/common/card-action-common.ts b/src/elements/card/common/card-action-common.ts index 71d14eda96..43e22f4c87 100644 --- a/src/elements/card/common/card-action-common.ts +++ b/src/elements/card/common/card-action-common.ts @@ -14,7 +14,7 @@ import style from './card-action.scss?lit&inline'; import '../../screen-reader-only.js'; export declare class SbbCardActionCommonElementMixinType { - public active: boolean; + public accessor active: boolean; protected actionRole: 'link' | 'button'; } diff --git a/src/elements/checkbox/checkbox-group/checkbox-group.ts b/src/elements/checkbox/checkbox-group/checkbox-group.ts index b26a4150d4..98dcb68c0c 100644 --- a/src/elements/checkbox/checkbox-group/checkbox-group.ts +++ b/src/elements/checkbox/checkbox-group/checkbox-group.ts @@ -4,7 +4,7 @@ import { customElement, property } from 'lit/decorators.js'; import { getNextElementIndex, interactivityChecker, isArrowKeyPressed } from '../../core/a11y.js'; import { SbbConnectedAbortController } from '../../core/controllers.js'; -import { slotState } from '../../core/decorators.js'; +import { forceType, slotState } from '../../core/decorators.js'; import type { SbbHorizontalFrom, SbbOrientation } from '../../core/interfaces.js'; import { SbbDisabledMixin } from '../../core/mixins.js'; import type { SbbCheckboxPanelElement } from '../checkbox-panel.js'; @@ -19,24 +19,27 @@ import style from './checkbox-group.scss?lit&inline'; * @slot - Use the unnamed slot to add `sbb-checkbox` elements to the `sbb-checkbox-group`. * @slot error - Slot used to render a `sbb-form-error` inside the `sbb-checkbox-group`. */ +export @customElement('sbb-checkbox-group') @slotState() -export class SbbCheckboxGroupElement extends SbbDisabledMixin(LitElement) { +class SbbCheckboxGroupElement extends SbbDisabledMixin(LitElement) { public static override styles: CSSResultGroup = style; /** Whether the checkbox group is required. */ - @property({ reflect: true, type: Boolean }) public required = false; + @forceType() + @property({ reflect: true, type: Boolean }) + public accessor required: boolean = false; /** Size variant, either m or s. */ - @property() public size: SbbCheckboxSize = 'm'; + @property() public accessor size: SbbCheckboxSize = 'm'; /** Overrides the behaviour of `orientation` property. */ @property({ attribute: 'horizontal-from', reflect: true }) - public horizontalFrom?: SbbHorizontalFrom; + public accessor horizontalFrom: SbbHorizontalFrom | null = null; /** Indicates the orientation of the checkboxes inside the ``. */ @property({ reflect: true }) - public orientation: SbbOrientation = 'horizontal'; + public accessor orientation: SbbOrientation = 'horizontal'; /** List of contained checkbox elements. */ public get checkboxes(): (SbbCheckboxElement | SbbCheckboxPanelElement)[] { diff --git a/src/elements/checkbox/checkbox-group/readme.md b/src/elements/checkbox/checkbox-group/readme.md index 558bec1bd3..176068080b 100644 --- a/src/elements/checkbox/checkbox-group/readme.md +++ b/src/elements/checkbox/checkbox-group/readme.md @@ -77,7 +77,7 @@ Two values are available, `s` and `m`, which is the default | ---------------- | ----------------- | ------- | --------------------------------------------------- | -------------- | ------------------------------------------------------------------------------ | | `checkboxes` | - | public | `(SbbCheckboxElement \| SbbCheckboxPanelElement)[]` | | List of contained checkbox elements. | | `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `horizontalFrom` | `horizontal-from` | public | `SbbHorizontalFrom \| undefined` | | Overrides the behaviour of `orientation` property. | +| `horizontalFrom` | `horizontal-from` | public | `SbbHorizontalFrom \| null` | `null` | Overrides the behaviour of `orientation` property. | | `orientation` | `orientation` | public | `SbbOrientation` | `'horizontal'` | Indicates the orientation of the checkboxes inside the ``. | | `required` | `required` | public | `boolean` | `false` | Whether the checkbox group is required. | | `size` | `size` | public | `SbbCheckboxSize` | `'m'` | Size variant, either m or s. | diff --git a/src/elements/checkbox/checkbox-panel/checkbox-panel.ts b/src/elements/checkbox/checkbox-panel/checkbox-panel.ts index 50fd83cb53..43abf00d6d 100644 --- a/src/elements/checkbox/checkbox-panel/checkbox-panel.ts +++ b/src/elements/checkbox/checkbox-panel/checkbox-panel.ts @@ -8,7 +8,7 @@ import { } from 'lit'; import { customElement, property } from 'lit/decorators.js'; -import { slotState } from '../../core/decorators.js'; +import { getOverride, slotState } from '../../core/decorators.js'; import { EventEmitter } from '../../core/eventing.js'; import type { SbbCheckedStateChange, @@ -42,9 +42,10 @@ export type SbbCheckboxPanelStateChange = Extract< * @event {Event} change - Event fired on change. * @event {InputEvent} input - Event fired on input. */ +export @customElement('sbb-checkbox-panel') @slotState() -export class SbbCheckboxPanelElement extends SbbPanelMixin( +class SbbCheckboxPanelElement extends SbbPanelMixin( SbbCheckboxCommonElementMixin(SbbUpdateSchedulerMixin(LitElement)), ) { public static override styles: CSSResultGroup = [checkboxCommonStyle, panelCommonStyle]; @@ -58,13 +59,8 @@ export class SbbCheckboxPanelElement extends SbbPanelMixin( /** Size variant. */ @property({ reflect: true }) - public set size(value: SbbPanelSize) { - this._size = value; - } - public get size(): SbbPanelSize { - return this.group?.size ? (this.group.size === 'xs' ? 's' : this.group.size) : this._size; - } - private _size: SbbPanelSize = 'm'; + @getOverride((i, v) => (i.group?.size ? (i.group.size === 'xs' ? 's' : i.group.size) : v)) + public accessor size: SbbPanelSize = 'm'; /** * @internal diff --git a/src/elements/checkbox/checkbox/checkbox.ts b/src/elements/checkbox/checkbox/checkbox.ts index fff6a5cbc1..01afd89802 100644 --- a/src/elements/checkbox/checkbox/checkbox.ts +++ b/src/elements/checkbox/checkbox/checkbox.ts @@ -1,7 +1,7 @@ import { LitElement, html, type CSSResultGroup, type TemplateResult } from 'lit'; import { customElement, property } from 'lit/decorators.js'; -import { slotState } from '../../core/decorators.js'; +import { getOverride, slotState } from '../../core/decorators.js'; import type { SbbIconPlacement } from '../../core/interfaces.js'; import { SbbIconNameMixin } from '../../icon.js'; import { @@ -23,11 +23,10 @@ import '../../visual-checkbox.js'; * @event {Event} change - Event fired on change. * @event {InputEvent} input - Event fired on input. */ +export @customElement('sbb-checkbox') @slotState() -export class SbbCheckboxElement extends SbbCheckboxCommonElementMixin( - SbbIconNameMixin(LitElement), -) { +class SbbCheckboxElement extends SbbCheckboxCommonElementMixin(SbbIconNameMixin(LitElement)) { public static override styles: CSSResultGroup = [checkboxCommonStyle, checkboxStyle]; public static readonly events = { @@ -36,17 +35,12 @@ export class SbbCheckboxElement extends SbbCheckboxCommonElementMixin( /** Size variant. */ @property({ reflect: true }) - public set size(value: SbbCheckboxSize) { - this._size = value; - } - public get size(): SbbCheckboxSize { - return this.group?.size ?? this._size; - } - private _size: SbbCheckboxSize = 'm'; + @getOverride((i, v) => i.group?.size ?? v) + public accessor size: SbbCheckboxSize = 'm'; /** The label position relative to the labelIcon. Defaults to end */ @property({ attribute: 'icon-placement', reflect: true }) - public iconPlacement: SbbIconPlacement = 'end'; + public accessor iconPlacement: SbbIconPlacement = 'end'; protected override render(): TemplateResult { return html` diff --git a/src/elements/checkbox/checkbox/readme.md b/src/elements/checkbox/checkbox/readme.md index ce419ee5ea..9a3e08bbc9 100644 --- a/src/elements/checkbox/checkbox/readme.md +++ b/src/elements/checkbox/checkbox/readme.md @@ -90,7 +90,7 @@ If you don't want the label to appear next to the checkbox, you can use `aria-la | `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | | `form` | - | public | `HTMLFormElement \| null` | | Returns the form owner of the internals of the target element. | | `group` | - | public | `SbbCheckboxGroupElement \| null` | `null` | Reference to the connected checkbox group. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | | `iconPlacement` | `icon-placement` | public | `SbbIconPlacement` | `'end'` | The label position relative to the labelIcon. Defaults to end | | `indeterminate` | `indeterminate` | public | `boolean` | `false` | Whether the checkbox is indeterminate. | | `name` | `name` | public | `string` | | Name of the form element. Will be read from name attribute. | diff --git a/src/elements/checkbox/common/checkbox-common.ts b/src/elements/checkbox/common/checkbox-common.ts index 09f0f6cc2c..4cff2b464c 100644 --- a/src/elements/checkbox/common/checkbox-common.ts +++ b/src/elements/checkbox/common/checkbox-common.ts @@ -1,6 +1,7 @@ import type { LitElement, PropertyValues } from 'lit'; import { property } from 'lit/decorators.js'; +import { forceType } from '../../core/decorators.js'; import { type Constructor, type SbbDisabledMixinType, @@ -16,7 +17,7 @@ export declare class SbbCheckboxCommonElementMixinType extends SbbFormAssociatedCheckboxMixinType implements Partial, Partial { - public indeterminate: boolean; + public accessor indeterminate: boolean; public get group(): SbbCheckboxGroupElement | null; } @@ -30,7 +31,9 @@ export const SbbCheckboxCommonElementMixin = > implements Partial { /** Whether the checkbox is indeterminate. */ - @property({ type: Boolean }) public indeterminate = false; + @forceType() + @property({ type: Boolean }) + public accessor indeterminate: boolean = false; /** Reference to the connected checkbox group. */ public get group(): SbbCheckboxGroupElement | null { diff --git a/src/elements/chip/chip.ts b/src/elements/chip/chip.ts index c6b48403b7..e6725c5e16 100644 --- a/src/elements/chip/chip.ts +++ b/src/elements/chip/chip.ts @@ -9,17 +9,18 @@ import style from './chip.scss?lit&inline'; * * @slot - Use the unnamed slot to add content to the `sbb-chip`. */ +export @customElement('sbb-chip') -export class SbbChipElement extends LitElement { +class SbbChipElement extends LitElement { public static override styles: CSSResultGroup = style; /** Size of the chip. */ @property({ reflect: true }) - public size: 'xxs' | 'xs' | 's' = 'xxs'; + public accessor size: 'xxs' | 'xs' | 's' = 'xxs'; /** Color of the chip. */ @property({ reflect: true }) - public color: 'milk' | 'charcoal' | 'white' | 'granite' = 'milk'; + public accessor color: 'milk' | 'charcoal' | 'white' | 'granite' = 'milk'; protected override render(): TemplateResult { return html` diff --git a/src/elements/clock/clock.ts b/src/elements/clock/clock.ts index c33e9a3b16..004e40cc82 100644 --- a/src/elements/clock/clock.ts +++ b/src/elements/clock/clock.ts @@ -49,15 +49,16 @@ const ADD_EVENT_LISTENER_OPTIONS: AddEventListenerOptions = { /** * It displays an analog clock with the classic SBB face. */ +export @customElement('sbb-clock') -export class SbbClockElement extends LitElement { +class SbbClockElement extends LitElement { public static override styles: CSSResultGroup = style; /** * Define a specific time which the clock should show statically. * @param value HH:MM:ss */ - @property() public now: SbbTime | null = null; + @property() public accessor now: SbbTime | null = null; /** Reference to the hour hand. */ private _clockHandHours!: HTMLElement; diff --git a/src/elements/container/container/container.ts b/src/elements/container/container/container.ts index 6ffdb3e177..1b59cfb468 100644 --- a/src/elements/container/container/container.ts +++ b/src/elements/container/container/container.ts @@ -7,7 +7,7 @@ import { } from 'lit'; import { customElement, property } from 'lit/decorators.js'; -import { slotState } from '../../core/decorators.js'; +import { forceType, slotState } from '../../core/decorators.js'; import style from './container.scss?lit&inline'; @@ -18,20 +18,24 @@ import style from './container.scss?lit&inline'; * @slot sticky-bar - The slot used by the sbb-sticky-bar component. * @slot image - The slot used to slot an `sbb-image` to use as background. */ +export @customElement('sbb-container') @slotState() -export class SbbContainerElement extends LitElement { +class SbbContainerElement extends LitElement { public static override styles: CSSResultGroup = style; /** Whether the container is expanded. */ - @property({ type: Boolean, reflect: true }) public expanded = false; + @forceType() + @property({ type: Boolean, reflect: true }) + public accessor expanded: boolean = false; /** Whether the background color is shown on full container width on large screens. */ + @forceType() @property({ type: Boolean, reflect: true, attribute: 'background-expanded' }) - public backgroundExpanded = false; + public accessor backgroundExpanded: boolean = false; /** Color of the container, like transparent, white etc. */ - @property({ reflect: true }) public color: 'transparent' | 'white' | 'milk' = 'white'; + @property({ reflect: true }) public accessor color: 'transparent' | 'white' | 'milk' = 'white'; protected override willUpdate(changedProperties: PropertyValues): void { super.willUpdate(changedProperties); diff --git a/src/elements/container/sticky-bar/readme.md b/src/elements/container/sticky-bar/readme.md index 9423b17241..c96b9cb93f 100644 --- a/src/elements/container/sticky-bar/readme.md +++ b/src/elements/container/sticky-bar/readme.md @@ -22,9 +22,9 @@ Optionally the user can set the `color` property on the `sbb-sticky-bar` in orde ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------- | --------- | ------- | -------------------------------- | ------- | ---------------------------------------------------- | -| `color` | `color` | public | `'white' \| 'milk' \| undefined` | | Color of the container, like transparent, white etc. | +| Name | Attribute | Privacy | Type | Default | Description | +| ------- | --------- | ------- | --------------------------- | ------- | ---------------------------------------------------- | +| `color` | `color` | public | `'white' \| 'milk' \| null` | `null` | Color of the container, like transparent, white etc. | ## CSS Properties diff --git a/src/elements/container/sticky-bar/sticky-bar.ts b/src/elements/container/sticky-bar/sticky-bar.ts index af2ec52797..e0652eba93 100644 --- a/src/elements/container/sticky-bar/sticky-bar.ts +++ b/src/elements/container/sticky-bar/sticky-bar.ts @@ -23,15 +23,16 @@ import style from './sticky-bar.scss?lit&inline'; * @cssprop [--sbb-sticky-bar-z-index] - To specify a custom stack order, * the `z-index` can be overridden by defining this CSS variable. */ +export @customElement('sbb-sticky-bar') @hostAttributes({ slot: 'sticky-bar', }) -export class SbbStickyBarElement extends LitElement { +class SbbStickyBarElement extends LitElement { public static override styles: CSSResultGroup = style; /** Color of the container, like transparent, white etc. */ - @property({ reflect: true }) public color?: 'white' | 'milk'; + @property({ reflect: true }) public accessor color: 'white' | 'milk' | null = null; private _intersector?: HTMLSpanElement; private _observer = new IntersectionController(this, { diff --git a/src/elements/core/base-elements/action-base-element.ts b/src/elements/core/base-elements/action-base-element.ts index 35798c68fa..2136910fb3 100644 --- a/src/elements/core/base-elements/action-base-element.ts +++ b/src/elements/core/base-elements/action-base-element.ts @@ -13,10 +13,11 @@ type MaybeDisabled = { disabledInteractive?: boolean; }; +export @hostAttributes({ 'data-action': '', }) -export abstract class SbbActionBaseElement extends LitElement { +abstract class SbbActionBaseElement extends LitElement { protected get maybeDisabled(): boolean | undefined { const maybeDisabled = this as MaybeDisabled; return maybeDisabled.disabled || maybeDisabled.formDisabled; diff --git a/src/elements/core/base-elements/button-base-element.spec.ts b/src/elements/core/base-elements/button-base-element.spec.ts index 67006811f1..5f5954eeee 100644 --- a/src/elements/core/base-elements/button-base-element.spec.ts +++ b/src/elements/core/base-elements/button-base-element.spec.ts @@ -3,14 +3,19 @@ import { sendKeys } from '@web/test-runner-commands'; import { html, type TemplateResult } from 'lit'; import { property } from 'lit/decorators.js'; +import { forceType } from '../decorators.js'; import { fixture } from '../testing/private.js'; import { EventSpy, waitForLitRender } from '../testing.js'; import { SbbButtonBaseElement } from './button-base-element.js'; class GenericButton extends SbbButtonBaseElement { - @property() public disabled = false; - @property() public disabledInteractive = false; + @forceType() + @property({ type: Boolean }) + public accessor disabled: boolean = false; + @forceType() + @property({ type: Boolean }) + public accessor disabledInteractive: boolean = false; protected override renderTemplate(): TemplateResult { return html`Button`; diff --git a/src/elements/core/base-elements/button-base-element.ts b/src/elements/core/base-elements/button-base-element.ts index 485bbb0700..a4e4386e6a 100644 --- a/src/elements/core/base-elements/button-base-element.ts +++ b/src/elements/core/base-elements/button-base-element.ts @@ -1,7 +1,7 @@ import { isServer } from 'lit'; import { property } from 'lit/decorators.js'; -import { hostAttributes } from '../decorators.js'; +import { forceType, hostAttributes } from '../decorators.js'; import { isEventPrevented } from '../eventing.js'; import { SbbActionBaseElement } from './action-base-element.js'; @@ -10,14 +10,15 @@ import { SbbActionBaseElement } from './action-base-element.js'; export type SbbButtonType = 'button' | 'reset' | 'submit'; /** Button base class. */ +export @hostAttributes({ role: 'button', tabindex: '0', 'data-button': '', }) -export abstract class SbbButtonBaseElement extends SbbActionBaseElement { +abstract class SbbButtonBaseElement extends SbbActionBaseElement { /** The type attribute to use for the button. */ - @property() public type: SbbButtonType = 'button'; + @property() public accessor type: SbbButtonType = 'button'; /** * The name of the button element. @@ -48,7 +49,9 @@ export abstract class SbbButtonBaseElement extends SbbActionBaseElement { } /** The element to associate the button with. */ - @property() public form?: string; + @forceType() + @property() + public accessor form: string = ''; public constructor() { super(); diff --git a/src/elements/core/base-elements/link-base-element.spec.ts b/src/elements/core/base-elements/link-base-element.spec.ts index 385a992176..43df8064b7 100644 --- a/src/elements/core/base-elements/link-base-element.spec.ts +++ b/src/elements/core/base-elements/link-base-element.spec.ts @@ -3,14 +3,19 @@ import { sendKeys } from '@web/test-runner-commands'; import { html, type TemplateResult } from 'lit'; import { property } from 'lit/decorators.js'; +import { forceType } from '../decorators.js'; import { fixture } from '../testing/private.js'; import { EventSpy, waitForLitRender } from '../testing.js'; import { SbbLinkBaseElement } from './link-base-element.js'; class GenericLink extends SbbLinkBaseElement { - @property() public disabled = false; - @property() public disabledInteractive = false; + @forceType() + @property({ type: Boolean }) + public accessor disabled: boolean = false; + @forceType() + @property({ type: Boolean }) + public accessor disabledInteractive: boolean = false; protected override renderTemplate(): TemplateResult { return html`Link`; diff --git a/src/elements/core/base-elements/link-base-element.ts b/src/elements/core/base-elements/link-base-element.ts index 1ba733007d..2c87979d1c 100644 --- a/src/elements/core/base-elements/link-base-element.ts +++ b/src/elements/core/base-elements/link-base-element.ts @@ -2,7 +2,7 @@ import { html, isServer, nothing, type TemplateResult } from 'lit'; import { property } from 'lit/decorators.js'; import { SbbLanguageController } from '../controllers.js'; -import { hostAttributes } from '../decorators.js'; +import { forceType, hostAttributes } from '../decorators.js'; import { i18nTargetOpensInNewWindow } from '../i18n.js'; import { SbbActionBaseElement } from './action-base-element.js'; @@ -13,24 +13,35 @@ import '../../screen-reader-only.js'; export type LinkTargetType = '_blank' | '_self' | '_parent' | '_top'; /** Link base class. */ +export @hostAttributes({ 'data-link': '', }) -export abstract class SbbLinkBaseElement extends SbbActionBaseElement { +abstract class SbbLinkBaseElement extends SbbActionBaseElement { /** The href value you want to link to. */ - @property() public href?: string; + @forceType() + @property() + public accessor href: string = ''; /** Where to display the linked URL. */ - @property() public target?: LinkTargetType | string; + @forceType() + @property() + public accessor target: LinkTargetType | string = ''; /** The relationship of the linked URL as space-separated link types. */ - @property() public rel?: string; + @forceType() + @property() + public accessor rel: string = ''; /** Whether the browser will show the download dialog on click. */ - @property({ type: Boolean }) public download?: boolean; + @forceType() + @property({ type: Boolean }) + public accessor download: boolean = false; /** This will be forwarded as aria-label to the inner anchor element. */ - @property({ attribute: 'accessibility-label' }) public accessibilityLabel: string | undefined; + @forceType() + @property({ attribute: 'accessibility-label' }) + public accessor accessibilityLabel: string = ''; protected language = new SbbLanguageController(this); diff --git a/src/elements/core/decorators.ts b/src/elements/core/decorators.ts index 1d6b1f57ad..44abf975fa 100644 --- a/src/elements/core/decorators.ts +++ b/src/elements/core/decorators.ts @@ -1,2 +1,6 @@ +export * from './decorators/force-type.js'; +export * from './decorators/get-override.js'; +export * from './decorators/handle-distinct-change.js'; export * from './decorators/host-attributes.js'; +export * from './decorators/omit-empty-converter.js'; export * from './decorators/slot-state.js'; diff --git a/src/elements/core/decorators/base.ts b/src/elements/core/decorators/base.ts new file mode 100644 index 0000000000..08a8c5066c --- /dev/null +++ b/src/elements/core/decorators/base.ts @@ -0,0 +1,29 @@ +import type { ReactiveElement } from 'lit'; + +// Types used from lit: https://github.com/lit/lit/blob/main/packages/reactive-element/src/decorators/property.ts + +/** + * Generates a public interface type that removes private and protected fields. + * This allows accepting otherwise incompatible versions of the type (e.g. from + * multiple copies of the same package in `node_modules`). + */ +export type Interface = { + [K in keyof T]: T[K]; +}; + +// Overloads for property decorator so that TypeScript can infer the correct +// return type when a decorator is used as an accessor decorator or a setter +// decorator. +export type PropertyDecorator = { + // accessor decorator signature + , V>( + target: ClassAccessorDecoratorTarget, + context: ClassAccessorDecoratorContext, + ): ClassAccessorDecoratorResult; + + // setter decorator signature + , V>( + target: (value: V) => void, + context: ClassSetterDecoratorContext, + ): (this: C, value: V) => void; +}; diff --git a/src/elements/core/decorators/force-type.ts b/src/elements/core/decorators/force-type.ts new file mode 100644 index 0000000000..9f3db259bb --- /dev/null +++ b/src/elements/core/decorators/force-type.ts @@ -0,0 +1,47 @@ +import type { ReactiveElement } from 'lit'; + +import type { Interface, PropertyDecorator } from './base.js'; + +/** + * Decorator that forces the value of a property or getter/setter + * to the defined type. + */ +export const forceType = , V>(): PropertyDecorator => { + return ( + target: ClassAccessorDecoratorTarget | ((value: V) => void), + context: ClassAccessorDecoratorContext | ClassSetterDecoratorContext, + ): any => { + const { kind, metadata, name } = context; + + const type = (globalThis.litPropertyMetadata.get(metadata)?.get(name)?.type ?? String) as ( + v: unknown, + ) => V; + let convert = type; + if ((type as unknown) === String) { + // In case of String, we want to handle null/undefined differently + // from the native behavior in that we want to treat these values + // as empty strings. + convert = (v) => (v == null ? '' : String(v)) as V; + } else if ((type as unknown) === Number) { + // In case of Number, we want to handle null differently + // from the native behavior in that we want to treat null as NaN. + convert = (v) => (v == null ? NaN : Number(v)) as V; + } + if (kind === 'accessor') { + return { + set(this: C, value) { + (target as ClassAccessorDecoratorTarget).set.call( + this as unknown as C, + convert(value) as V, + ); + }, + } satisfies ClassAccessorDecoratorResult; + } else if (kind === 'setter') { + return function (value: unknown) { + (target as (value: unknown) => void)(convert(value)); + } satisfies (this: C, value: V) => void; + } + + throw new Error(`Unsupported decorator location: ${kind}`); + }; +}; diff --git a/src/elements/core/decorators/get-override.ts b/src/elements/core/decorators/get-override.ts new file mode 100644 index 0000000000..09c0d92c4b --- /dev/null +++ b/src/elements/core/decorators/get-override.ts @@ -0,0 +1,29 @@ +import type { ReactiveElement } from 'lit'; + +import type { Interface } from './base.js'; + +/** + * Decorator that overrides the underlying getter of the accessor. + */ +export const getOverride = , V>( + callback: (instance: C, innerValue: V) => V, +) => { + return ( + target: ClassAccessorDecoratorTarget, + context: ClassAccessorDecoratorContext, + ): any => { + const { kind } = context; + if (kind === 'accessor') { + return { + get(this: C) { + const innerValue = (target as ClassAccessorDecoratorTarget).get.call( + this as unknown as C, + ); + return callback(this, innerValue); + }, + } satisfies ClassAccessorDecoratorResult; + } + + throw new Error(`Unsupported decorator location: ${kind}`); + }; +}; diff --git a/src/elements/core/decorators/handle-distinct-change.ts b/src/elements/core/decorators/handle-distinct-change.ts new file mode 100644 index 0000000000..4177e4b48f --- /dev/null +++ b/src/elements/core/decorators/handle-distinct-change.ts @@ -0,0 +1,32 @@ +import type { ReactiveElement } from 'lit'; + +import type { Interface } from './base.js'; + +/** + * Decorator that calls the given callback when the value + * of the associated property is changed. + */ +export const handleDistinctChange = , V>( + callback: (instance: C, newValue: V, oldValue: V | undefined) => void, +) => { + return ( + target: ClassAccessorDecoratorTarget, + context: ClassAccessorDecoratorContext, + ): any => { + const { kind } = context; + if (kind === 'accessor') { + return { + set(this: C, value) { + const oldValue = context.access.get(this); + (target as ClassAccessorDecoratorTarget).set.call(this as unknown as C, value); + const newValue = context.access.get(this); + if (newValue !== oldValue) { + callback(this, newValue, oldValue); + } + }, + } satisfies ClassAccessorDecoratorResult; + } + + throw new Error(`Unsupported decorator location: ${kind}`); + }; +}; diff --git a/src/elements/core/decorators/omit-empty-converter.ts b/src/elements/core/decorators/omit-empty-converter.ts new file mode 100644 index 0000000000..2a3c0f4ce8 --- /dev/null +++ b/src/elements/core/decorators/omit-empty-converter.ts @@ -0,0 +1,15 @@ +import { defaultConverter, type ComplexAttributeConverter } from 'lit'; + +/** + * Converts empty values to null, which will not be rendered as attributes. + * e.g. for string properties, an empty value '' will not be rendered as an + * empty attribute, as would be the default with lit. + */ +export const omitEmptyConverter: ComplexAttributeConverter = { + toAttribute(value, type) { + return ((type === String || type === undefined) && value === '') || + (type === Number && isNaN(value as number)) + ? null + : defaultConverter.toAttribute!(value, type); + }, +}; diff --git a/src/elements/core/mixins/disabled-mixin.ts b/src/elements/core/mixins/disabled-mixin.ts index bd4cf3da30..4e1bdd350e 100644 --- a/src/elements/core/mixins/disabled-mixin.ts +++ b/src/elements/core/mixins/disabled-mixin.ts @@ -1,16 +1,17 @@ import type { LitElement, PropertyValues } from 'lit'; import { property } from 'lit/decorators.js'; +import { forceType, getOverride } from '../decorators.js'; + import type { AbstractConstructor } from './constructor.js'; export declare class SbbDisabledMixinType { - public set disabled(value: boolean); - public get disabled(): boolean; + public accessor disabled: boolean; protected isDisabledExternally(): boolean; } export declare class SbbDisabledInteractiveMixinType { - public disabledInteractive: boolean; + public accessor disabledInteractive: boolean; } /** @@ -22,16 +23,10 @@ export const SbbDisabledMixin = >( ): AbstractConstructor & T => { abstract class SbbDisabledElement extends superClass implements Partial { /** Whether the component is disabled. */ + @forceType() @property({ reflect: true, type: Boolean }) - public set disabled(value: boolean) { - // To provide the same behavior as the native disabled state, - // any value is converted to a boolean. - this._disabled = Boolean(value); - } - public get disabled(): boolean { - return this._disabled || this.isDisabledExternally(); - } - private _disabled: boolean = false; + @getOverride((e, v) => v || e.isDisabledExternally()) + public accessor disabled: boolean = false; /** * Will be used as 'or' check to the current disabled state. @@ -59,8 +54,9 @@ export const SbbDisabledInteractiveMixin = < implements Partial { /** Whether disabled buttons should be interactive. */ - @property({ attribute: 'disabled-interactive', type: Boolean }) public disabledInteractive = - false; + @forceType() + @property({ attribute: 'disabled-interactive', type: Boolean }) + public accessor disabledInteractive: boolean = false; } return SbbDisabledInteractiveElement as unknown as AbstractConstructor & diff --git a/src/elements/core/mixins/form-associated-checkbox-mixin.ts b/src/elements/core/mixins/form-associated-checkbox-mixin.ts index d651ee40ed..0d2166cc97 100644 --- a/src/elements/core/mixins/form-associated-checkbox-mixin.ts +++ b/src/elements/core/mixins/form-associated-checkbox-mixin.ts @@ -86,7 +86,7 @@ export const SbbFormAssociatedCheckboxMixin = public get checked(): boolean { return this._checked; } - private _checked = false; + private _checked: boolean = false; protected constructor() { super(); diff --git a/src/elements/core/mixins/form-associated-mixin.ts b/src/elements/core/mixins/form-associated-mixin.ts index eb5c0086c9..1dd4c97fc0 100644 --- a/src/elements/core/mixins/form-associated-mixin.ts +++ b/src/elements/core/mixins/form-associated-mixin.ts @@ -118,7 +118,7 @@ export const SbbFormAssociatedMixin = protected readonly internals: ElementInternals = this.attachInternals(); /** Whenever a surrounding form or fieldset is changing its disabled state. */ - @state() protected formDisabled: boolean = false; + @state() protected accessor formDisabled: boolean = false; public override attributeChangedCallback( name: string, diff --git a/src/elements/core/mixins/named-slot-list-mixin.ts b/src/elements/core/mixins/named-slot-list-mixin.ts index 45e24435e6..530a94630b 100644 --- a/src/elements/core/mixins/named-slot-list-mixin.ts +++ b/src/elements/core/mixins/named-slot-list-mixin.ts @@ -34,7 +34,7 @@ export declare abstract class SbbNamedSlotListMixinType< C extends HTMLElement, > extends SbbHydrationMixinType { protected abstract readonly listChildLocalNames: string[]; - @state() protected listChildren: C[]; + protected accessor listChildren: C[]; protected renderList( attributes?: { class?: string; @@ -73,7 +73,7 @@ export const SbbNamedSlotListMixin = < * This array is only updated if there is an actual change * to the child elements. */ - @state() protected listChildren: C[] = []; + @state() protected accessor listChildren: C[] = []; public override connectedCallback(): void { super.connectedCallback(); diff --git a/src/elements/core/mixins/negative-mixin.ts b/src/elements/core/mixins/negative-mixin.ts index ae053c4a11..ec659d17b6 100644 --- a/src/elements/core/mixins/negative-mixin.ts +++ b/src/elements/core/mixins/negative-mixin.ts @@ -1,10 +1,12 @@ import type { LitElement } from 'lit'; import { property } from 'lit/decorators.js'; +import { forceType } from '../decorators.js'; + import type { AbstractConstructor } from './constructor.js'; export declare class SbbNegativeMixinType { - public negative: boolean; + public accessor negative: boolean; } /** @@ -16,7 +18,9 @@ export const SbbNegativeMixin = >( ): AbstractConstructor & T => { abstract class SbbNegativeElement extends superClass implements SbbNegativeMixinType { /** Negative coloring variant flag. */ - @property({ reflect: true, type: Boolean }) public negative: boolean = false; + @forceType() + @property({ reflect: true, type: Boolean }) + public accessor negative: boolean = false; } return SbbNegativeElement as AbstractConstructor & T; diff --git a/src/elements/core/mixins/panel-mixin.ts b/src/elements/core/mixins/panel-mixin.ts index 447fc9bb96..597b30e00d 100644 --- a/src/elements/core/mixins/panel-mixin.ts +++ b/src/elements/core/mixins/panel-mixin.ts @@ -1,14 +1,15 @@ import type { LitElement } from 'lit'; import { property } from 'lit/decorators.js'; +import { forceType } from '../decorators.js'; import { EventEmitter } from '../eventing.js'; import type { AbstractConstructor } from './constructor.js'; export declare class SbbPanelMixinType { - public color: 'white' | 'milk'; - public borderless: boolean; - public expansionState?: string; + public accessor color: 'white' | 'milk'; + public accessor borderless: boolean; + public accessor expansionState: string; } export type SbbPanelSize = 's' | 'm'; @@ -26,13 +27,17 @@ export const SbbPanelMixin = >( } as const; /** The background color of the panel. */ - @property() public color: 'white' | 'milk' = 'white'; + @property() public accessor color: 'white' | 'milk' = 'white'; /** Whether the unselected panel has a border. */ - @property({ reflect: true, type: Boolean }) public borderless = false; + @forceType() + @property({ reflect: true, type: Boolean }) + public accessor borderless: boolean = false; /** @internal used for accessibility label when in expansion panel */ - @property() public expansionState?: string; + @forceType() + @property() + public accessor expansionState: string = ''; /** * @internal diff --git a/src/elements/core/mixins/required-mixin.ts b/src/elements/core/mixins/required-mixin.ts index b9191a86a5..3d82b98f0c 100644 --- a/src/elements/core/mixins/required-mixin.ts +++ b/src/elements/core/mixins/required-mixin.ts @@ -5,8 +5,7 @@ import type { AbstractConstructor } from './constructor.js'; import type { SbbFormAssociatedMixinType } from './form-associated-mixin.js'; export declare class SbbRequiredMixinType { - public set required(value: boolean); - public get required(): boolean; + public accessor required: boolean; protected isRequiredExternally(): boolean; } diff --git a/src/elements/datepicker/common/datepicker-button.ts b/src/elements/datepicker/common/datepicker-button.ts index 0775daffbf..e77f23784d 100644 --- a/src/elements/datepicker/common/datepicker-button.ts +++ b/src/elements/datepicker/common/datepicker-button.ts @@ -18,10 +18,13 @@ import '../../icon.js'; export abstract class SbbDatepickerButton extends SbbNegativeMixin(SbbButtonBaseElement) { /** Datepicker reference. */ - @property({ attribute: 'date-picker' }) public datePicker?: string | SbbDatepickerElement; + @property({ attribute: 'date-picker' }) public accessor datePicker: + | string + | SbbDatepickerElement + | null = null; /** The boundary date (min/max) as set in the date-picker's input. */ - @state() protected boundary: string | number | null = null; + @state() protected accessor boundary: string | number | null = null; /** Whether the component is disabled due date equals to boundary date. */ private _disabled = false; @@ -59,7 +62,7 @@ export abstract class SbbDatepickerButton extends SbbNegativeMixin(Sbb super.willUpdate(changedProperties); if (changedProperties.has('datePicker')) { - this._init(this.datePicker); + this._init(this.datePicker!); } } diff --git a/src/elements/datepicker/datepicker-next-day/datepicker-next-day.ts b/src/elements/datepicker/datepicker-next-day/datepicker-next-day.ts index cfd6f4af12..54f6643045 100644 --- a/src/elements/datepicker/datepicker-next-day/datepicker-next-day.ts +++ b/src/elements/datepicker/datepicker-next-day/datepicker-next-day.ts @@ -12,11 +12,12 @@ import style from './datepicker-next-day.scss?lit&inline'; /** * Combined with a `sbb-datepicker`, it can be used to move the date ahead. */ +export @customElement('sbb-datepicker-next-day') @hostAttributes({ slot: 'suffix', }) -export class SbbDatepickerNextDayElement extends SbbDatepickerButton { +class SbbDatepickerNextDayElement extends SbbDatepickerButton { public static override styles: CSSResultGroup = style; protected iconName: string = 'chevron-small-right-small'; diff --git a/src/elements/datepicker/datepicker-next-day/readme.md b/src/elements/datepicker/datepicker-next-day/readme.md index fda35f7b1f..bf3781daea 100644 --- a/src/elements/datepicker/datepicker-next-day/readme.md +++ b/src/elements/datepicker/datepicker-next-day/readme.md @@ -35,11 +35,11 @@ both standalone or within the `sbb-form-field`, they must have the same parent e ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------------ | ------------- | ------- | ------------------------------------------------ | ---------- | ------------------------------------------------ | -| `datePicker` | `date-picker` | public | `string \| SbbDatepickerElement \| undefined` | | Datepicker reference. | -| `form` | `form` | public | `string \| undefined` | | The element to associate the button with. | -| `name` | `name` | public | `string` | | The name of the button element. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | -| `value` | `value` | public | `string` | | The value of the button element. | +| Name | Attribute | Privacy | Type | Default | Description | +| ------------ | ------------- | ------- | ------------------------------------------- | ---------- | ------------------------------------------------ | +| `datePicker` | `date-picker` | public | `string \| SbbDatepickerElement \| null` | `null` | Datepicker reference. | +| `form` | `form` | public | `string` | `''` | The element to associate the button with. | +| `name` | `name` | public | `string` | | The name of the button element. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | +| `value` | `value` | public | `string` | | The value of the button element. | diff --git a/src/elements/datepicker/datepicker-previous-day/datepicker-previous-day.ts b/src/elements/datepicker/datepicker-previous-day/datepicker-previous-day.ts index 30cba55bec..65c7e04fc1 100644 --- a/src/elements/datepicker/datepicker-previous-day/datepicker-previous-day.ts +++ b/src/elements/datepicker/datepicker-previous-day/datepicker-previous-day.ts @@ -12,11 +12,12 @@ import style from './datepicker-previous-day.scss?lit&inline'; /** * Combined with a `sbb-datepicker`, it can be used to move the date back. */ +export @customElement('sbb-datepicker-previous-day') @hostAttributes({ slot: 'prefix', }) -export class SbbDatepickerPreviousDayElement extends SbbDatepickerButton { +class SbbDatepickerPreviousDayElement extends SbbDatepickerButton { public static override styles: CSSResultGroup = style; protected iconName: string = 'chevron-small-left-small'; diff --git a/src/elements/datepicker/datepicker-previous-day/readme.md b/src/elements/datepicker/datepicker-previous-day/readme.md index 8653a10686..b3dbf709cd 100644 --- a/src/elements/datepicker/datepicker-previous-day/readme.md +++ b/src/elements/datepicker/datepicker-previous-day/readme.md @@ -35,11 +35,11 @@ both standalone or within the `sbb-form-field`, they must have the same parent e ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------------ | ------------- | ------- | ------------------------------------------------ | ---------- | ------------------------------------------------ | -| `datePicker` | `date-picker` | public | `string \| SbbDatepickerElement \| undefined` | | Datepicker reference. | -| `form` | `form` | public | `string \| undefined` | | The element to associate the button with. | -| `name` | `name` | public | `string` | | The name of the button element. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | -| `value` | `value` | public | `string` | | The value of the button element. | +| Name | Attribute | Privacy | Type | Default | Description | +| ------------ | ------------- | ------- | ------------------------------------------- | ---------- | ------------------------------------------------ | +| `datePicker` | `date-picker` | public | `string \| SbbDatepickerElement \| null` | `null` | Datepicker reference. | +| `form` | `form` | public | `string` | `''` | The element to associate the button with. | +| `name` | `name` | public | `string` | | The name of the button element. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | +| `value` | `value` | public | `string` | | The value of the button element. | diff --git a/src/elements/datepicker/datepicker-toggle/datepicker-toggle.ts b/src/elements/datepicker/datepicker-toggle/datepicker-toggle.ts index 084c1ccec7..71197d28a1 100644 --- a/src/elements/datepicker/datepicker-toggle/datepicker-toggle.ts +++ b/src/elements/datepicker/datepicker-toggle/datepicker-toggle.ts @@ -23,28 +23,30 @@ import '../../button/mini-button.js'; /** * Combined with a `sbb-datepicker`, it can be used to select a date from a `sbb-calendar`. */ +export @customElement('sbb-datepicker-toggle') @hostAttributes({ slot: 'prefix', }) -export class SbbDatepickerToggleElement extends SbbNegativeMixin( - SbbHydrationMixin(LitElement), -) { +class SbbDatepickerToggleElement extends SbbNegativeMixin(SbbHydrationMixin(LitElement)) { public static override styles: CSSResultGroup = style; /** Datepicker reference. */ - @property({ attribute: 'date-picker' }) public datePicker?: string | SbbDatepickerElement; + @property({ attribute: 'date-picker' }) public accessor datePicker: + | string + | SbbDatepickerElement + | null = null; /** The initial view of calendar which should be displayed on opening. */ - @property() public view: CalendarView = 'day'; + @property() public accessor view: CalendarView = 'day'; - @state() private _disabled = false; + @state() private accessor _disabled = false; - @state() private _min: string | number | null | undefined = null; + @state() private accessor _min: string | number | null | undefined = null; - @state() private _max: string | number | null | undefined = null; + @state() private accessor _max: string | number | null | undefined = null; - @state() private _renderCalendar = false; + @state() private accessor _renderCalendar = false; private _datePickerElement: SbbDatepickerElement | null | undefined; private _calendarElement!: SbbCalendarElement; @@ -97,7 +99,7 @@ export class SbbDatepickerToggleElement extends SbbNegativeMixin( super.willUpdate(changedProperties); if (changedProperties.has('datePicker')) { - this._init(this.datePicker); + this._init(this.datePicker!); } } diff --git a/src/elements/datepicker/datepicker-toggle/readme.md b/src/elements/datepicker/datepicker-toggle/readme.md index cfbfd229f2..289948c003 100644 --- a/src/elements/datepicker/datepicker-toggle/readme.md +++ b/src/elements/datepicker/datepicker-toggle/readme.md @@ -36,11 +36,11 @@ both standalone or within the `sbb-form-field`, they must have the same parent e ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------------ | ------------- | ------- | --------------------------------------------- | ------- | ------------------------------------------------------------------ | -| `datePicker` | `date-picker` | public | `string \| SbbDatepickerElement \| undefined` | | Datepicker reference. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `view` | `view` | public | `CalendarView` | `'day'` | The initial view of calendar which should be displayed on opening. | +| Name | Attribute | Privacy | Type | Default | Description | +| ------------ | ------------- | ------- | ---------------------------------------- | ------- | ------------------------------------------------------------------ | +| `datePicker` | `date-picker` | public | `string \| SbbDatepickerElement \| null` | `null` | Datepicker reference. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `view` | `view` | public | `CalendarView` | `'day'` | The initial view of calendar which should be displayed on opening. | ## Methods diff --git a/src/elements/datepicker/datepicker/datepicker.ts b/src/elements/datepicker/datepicker/datepicker.ts index 8a8c735c88..0a9ddf23eb 100644 --- a/src/elements/datepicker/datepicker/datepicker.ts +++ b/src/elements/datepicker/datepicker/datepicker.ts @@ -11,6 +11,7 @@ import { customElement, property, state } from 'lit/decorators.js'; import { readConfig } from '../../core/config.js'; import { SbbConnectedAbortController, SbbLanguageController } from '../../core/controllers.js'; import { type DateAdapter, defaultDateAdapter } from '../../core/datetime.js'; +import { forceType } from '../../core/decorators.js'; import { findInput, findReferencedElement } from '../../core/dom.js'; import { EventEmitter } from '../../core/eventing.js'; import { i18nDateChangedTo, i18nDatePickerPlaceholder } from '../../core/i18n.js'; @@ -177,12 +178,9 @@ export const datepickerControlRegisteredEventFactory = (): CustomEvent => * @event {CustomEvent} datePickerUpdated - Notifies that the attributes of the datepicker have changes. * @event {CustomEvent} validationChange - Emits whenever the internal validation state changes. */ +export @customElement('sbb-datepicker') -export class SbbDatepickerElement extends LitElement { - /* eslint-disable @typescript-eslint/member-ordering -- - * We deactivate member-ordering because of the @property decorated methods dateFilter, dateParser and format. - */ - +class SbbDatepickerElement extends LitElement { public static override styles: CSSResultGroup = style; public static readonly events = { didChange: 'didChange', @@ -193,25 +191,28 @@ export class SbbDatepickerElement extends LitElement { } as const; /** If set to true, two months are displayed. */ - @property({ type: Boolean }) public wide = false; + @forceType() + @property({ type: Boolean }) + public accessor wide: boolean = false; /** A function used to filter out dates. */ - @property({ attribute: false }) public dateFilter: (date: T | null) => boolean = () => true; + @property({ attribute: false }) public accessor dateFilter: (date: T | null) => boolean = () => + true; /** * A function used to parse string value into dates. * @deprecated No longer required. */ - @property({ attribute: false }) public dateParser?: (value: string) => T | undefined; + @property({ attribute: false }) public accessor dateParser: ((value: string) => T) | null = null; /** * A function used to format dates into the preferred string format. * @deprecated No longer required. */ - @property({ attribute: false }) public format?: (date: T) => string; + @property({ attribute: false }) public accessor format: ((date: T) => string) | null = null; /** Reference of the native input connected to the datepicker. */ - @property() public input?: string | HTMLElement; + @property() public accessor input: string | HTMLElement | null = null; // TODO: Change undefined to null as a breaking change. /** A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. */ @@ -276,7 +277,7 @@ export class SbbDatepickerElement extends LitElement { ); @state() - private _inputElement: HTMLInputElement | null = null; + private accessor _inputElement: HTMLInputElement | null = null; private _inputElementPlaceholderMutable = false; private _datePickerController!: AbortController; @@ -487,7 +488,6 @@ export class SbbDatepickerElement extends LitElement { protected override render(): TemplateResult { return html`

`; } - /* eslint-enable @typescript-eslint/member-ordering */ } declare global { diff --git a/src/elements/datepicker/datepicker/readme.md b/src/elements/datepicker/datepicker/readme.md index dd38f2f290..a8ca76d0c0 100644 --- a/src/elements/datepicker/datepicker/readme.md +++ b/src/elements/datepicker/datepicker/readme.md @@ -104,15 +104,15 @@ Whenever the validation state changes (e.g., a valid value becomes invalid or vi ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------------- | --------- | ------- | ------------------------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------- | -| `dateFilter` | - | public | `(date: T \| null) => boolean` | | A function used to filter out dates. | -| `dateParser` | - | public | `(value: string) => T \| undefined \| undefined` | | A function used to parse string value into dates. | -| `format` | - | public | `(date: T) => string \| undefined` | | A function used to format dates into the preferred string format. | -| `input` | `input` | public | `string \| HTMLElement \| undefined` | | Reference of the native input connected to the datepicker. | -| `now` | `now` | public | `T` | | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. | -| `valueAsDate` | - | public | `T \| null` | | The currently selected date as a Date or custom date provider instance. | -| `wide` | `wide` | public | `boolean` | `false` | If set to true, two months are displayed. | +| Name | Attribute | Privacy | Type | Default | Description | +| ------------- | --------- | ------- | -------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- | +| `dateFilter` | - | public | `(date: T \| null) => boolean` | | A function used to filter out dates. | +| `dateParser` | - | public | `((value: string) => T) \| null` | `null` | A function used to parse string value into dates. | +| `format` | - | public | `((date: T) => string) \| null` | `null` | A function used to format dates into the preferred string format. | +| `input` | `input` | public | `string \| HTMLElement \| null` | `null` | Reference of the native input connected to the datepicker. | +| `now` | `now` | public | `T` | | A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. | +| `valueAsDate` | - | public | `T \| null` | | The currently selected date as a Date or custom date provider instance. | +| `wide` | `wide` | public | `boolean` | `false` | If set to true, two months are displayed. | ## Methods diff --git a/src/elements/dialog/dialog-actions/dialog-actions.ts b/src/elements/dialog/dialog-actions/dialog-actions.ts index 60b4a8ad61..b6c048b7c3 100644 --- a/src/elements/dialog/dialog-actions/dialog-actions.ts +++ b/src/elements/dialog/dialog-actions/dialog-actions.ts @@ -11,8 +11,9 @@ import style from './dialog-actions.scss?lit&inline'; * * @slot - Use the unnamed slot to add `sbb-block-link` or `sbb-button` elements to the `sbb-dialog-actions`. */ +export @customElement('sbb-dialog-actions') -export class SbbDialogActionsElement extends SbbActionGroupElement { +class SbbDialogActionsElement extends SbbActionGroupElement { public static override styles: CSSResultGroup = [SbbActionGroupElement.styles, style]; protected override render(): TemplateResult { diff --git a/src/elements/dialog/dialog-content/dialog-content.ts b/src/elements/dialog/dialog-content/dialog-content.ts index b1143f6308..ddb67269cb 100644 --- a/src/elements/dialog/dialog-content/dialog-content.ts +++ b/src/elements/dialog/dialog-content/dialog-content.ts @@ -9,8 +9,9 @@ import style from './dialog-content.scss?lit&inline'; * * @slot - Use the unnamed slot to provide a dialog content. */ +export @customElement('sbb-dialog-content') -export class SbbDialogContentElement extends LitElement { +class SbbDialogContentElement extends LitElement { public static override styles: CSSResultGroup = style; protected override render(): TemplateResult { diff --git a/src/elements/dialog/dialog-title/dialog-title.ts b/src/elements/dialog/dialog-title/dialog-title.ts index 8740aa302d..41c09d88a6 100644 --- a/src/elements/dialog/dialog-title/dialog-title.ts +++ b/src/elements/dialog/dialog-title/dialog-title.ts @@ -5,6 +5,7 @@ import { html, unsafeStatic } from 'lit/static-html.js'; import { SbbFocusVisibleWithinController } from '../../core/a11y.js'; import { SbbLanguageController } from '../../core/controllers.js'; +import { forceType } from '../../core/decorators.js'; import type { Breakpoint } from '../../core/dom.js'; import { EventEmitter } from '../../core/eventing.js'; import { i18nCloseDialog, i18nGoBack } from '../../core/i18n.js'; @@ -20,8 +21,9 @@ import '../../button/transparent-button.js'; * * @event {CustomEvent} requestBackAction - Emits whenever the back button is clicked. */ +export @customElement('sbb-dialog-title') -export class SbbDialogTitleElement extends SbbTitleBase { +class SbbDialogTitleElement extends SbbTitleBase { public static override styles: CSSResultGroup = [SbbTitleBase.styles, style]; public static readonly events: Record = { backClick: 'requestBackAction', @@ -30,21 +32,23 @@ export class SbbDialogTitleElement extends SbbTitleBase { /** * Whether a back button is displayed next to the title. */ - @property({ attribute: 'back-button', type: Boolean }) public backButton = false; + @forceType() + @property({ attribute: 'back-button', type: Boolean }) + public accessor backButton: boolean = false; /** * This will be forwarded as aria-label to the close button element. */ - @property({ attribute: 'accessibility-close-label' }) public accessibilityCloseLabel: - | string - | undefined; + @forceType() + @property({ attribute: 'accessibility-close-label' }) + public accessor accessibilityCloseLabel: string = ''; /** * This will be forwarded as aria-label to the back button element. */ - @property({ attribute: 'accessibility-back-label' }) public accessibilityBackLabel: - | string - | undefined; + @forceType() + @property({ attribute: 'accessibility-back-label' }) + public accessor accessibilityBackLabel: string = ''; /** * Whether to hide the title up to a certain breakpoint. diff --git a/src/elements/dialog/dialog-title/readme.md b/src/elements/dialog/dialog-title/readme.md index 38190cbbb2..d3738bcb98 100644 --- a/src/elements/dialog/dialog-title/readme.md +++ b/src/elements/dialog/dialog-title/readme.md @@ -42,16 +42,16 @@ If a back button is displayed it emits a `requestBackAction` event on click. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------------------------- | --------------------------- | ------- | ---------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `accessibilityBackLabel` | `accessibility-back-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the back button element. | -| `accessibilityCloseLabel` | `accessibility-close-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the close button element. | -| `backButton` | `back-button` | public | `boolean` | `false` | Whether a back button is displayed next to the title. | -| `hideOnScroll` | `hide-on-scroll` | public | `Breakpoint \| boolean` | `false` | Whether to hide the title up to a certain breakpoint. | -| `level` | `level` | public | `SbbTitleLevel` | `'2'` | Title level | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `visualLevel` | `visual-level` | public | `SbbTitleLevel \| undefined` | `'3'` | Visual level for the title. Optional, if not set, the value of level will be used. | -| `visuallyHidden` | `visually-hidden` | public | `boolean \| undefined` | | Sometimes we need a title in the markup to present a proper hierarchy to the screen readers while we do not want to let that title appear visually. In this case we set visuallyHidden to true. | +| Name | Attribute | Privacy | Type | Default | Description | +| ------------------------- | --------------------------- | ------- | ----------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `accessibilityBackLabel` | `accessibility-back-label` | public | `string` | `''` | This will be forwarded as aria-label to the back button element. | +| `accessibilityCloseLabel` | `accessibility-close-label` | public | `string` | `''` | This will be forwarded as aria-label to the close button element. | +| `backButton` | `back-button` | public | `boolean` | `false` | Whether a back button is displayed next to the title. | +| `hideOnScroll` | `hide-on-scroll` | public | `Breakpoint \| boolean` | `false` | Whether to hide the title up to a certain breakpoint. | +| `level` | `level` | public | `SbbTitleLevel` | `'2'` | Title level | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `visualLevel` | `visual-level` | public | `SbbTitleLevel \| null` | `'3'` | Visual level for the title. Optional, if not set, the value of level will be used. | +| `visuallyHidden` | `visually-hidden` | public | `boolean` | `false` | Sometimes we need a title in the markup to present a proper hierarchy to the screen readers while we do not want to let that title appear visually. In this case we set visuallyHidden to true. | ## Events diff --git a/src/elements/dialog/dialog/dialog.ts b/src/elements/dialog/dialog/dialog.ts index 562e0961ce..2bb07a6cb8 100644 --- a/src/elements/dialog/dialog/dialog.ts +++ b/src/elements/dialog/dialog/dialog.ts @@ -27,12 +27,14 @@ let nextId = 0; * the `z-index` can be overridden by defining this CSS variable. The default `z-index` of the * component is set to `var(--sbb-overlay-default-z-index)` with a value of `1000`. */ +export @customElement('sbb-dialog') -export class SbbDialogElement extends SbbOverlayBaseElement { +class SbbDialogElement extends SbbOverlayBaseElement { public static override styles: CSSResultGroup = style; /** Backdrop click action. */ - @property({ attribute: 'backdrop-action' }) public backdropAction: 'close' | 'none' = 'close'; + @property({ attribute: 'backdrop-action' }) public accessor backdropAction: 'close' | 'none' = + 'close'; // We use a timeout as a workaround to the "ResizeObserver loop completed with undelivered notifications" error. // For more details: diff --git a/src/elements/dialog/dialog/readme.md b/src/elements/dialog/dialog/readme.md index 20712652e3..26162e7ce3 100644 --- a/src/elements/dialog/dialog/readme.md +++ b/src/elements/dialog/dialog/readme.md @@ -90,12 +90,12 @@ The `sbb-dialog` component may visually hide the title thanks to the `hideOnScro ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| -------------------- | --------------------- | ------- | --------------------- | --------- | ----------------------------------------------------------------------------------------------------------- | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the relevant nested element to describe the purpose of the overlay. | -| `backdropAction` | `backdrop-action` | public | `'close' \| 'none'` | `'close'` | Backdrop click action. | -| `isOpen` | - | public | `boolean` | | Whether the element is open. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| Name | Attribute | Privacy | Type | Default | Description | +| -------------------- | --------------------- | ------- | ------------------- | --------- | ----------------------------------------------------------------------------------------------------------- | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the relevant nested element to describe the purpose of the overlay. | +| `backdropAction` | `backdrop-action` | public | `'close' \| 'none'` | `'close'` | Backdrop click action. | +| `isOpen` | - | public | `boolean` | | Whether the element is open. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | ## Methods diff --git a/src/elements/divider/divider.ts b/src/elements/divider/divider.ts index 1200986fb0..970542ce5b 100644 --- a/src/elements/divider/divider.ts +++ b/src/elements/divider/divider.ts @@ -11,15 +11,16 @@ import style from './divider.scss?lit&inline'; /** * It displays a divider between sections. */ +export @customElement('sbb-divider') @hostAttributes({ role: 'separator', }) -export class SbbDividerElement extends SbbNegativeMixin(LitElement) { +class SbbDividerElement extends SbbNegativeMixin(LitElement) { public static override styles: CSSResultGroup = style; /** Orientation property with possible values 'horizontal' | 'vertical'. Defaults to horizontal. */ - @property({ reflect: true }) public orientation: SbbOrientation = 'horizontal'; + @property({ reflect: true }) public accessor orientation: SbbOrientation = 'horizontal'; protected override willUpdate(changedProperties: PropertyValues): void { super.willUpdate(changedProperties); diff --git a/src/elements/expansion-panel/expansion-panel-content/expansion-panel-content.ts b/src/elements/expansion-panel/expansion-panel-content/expansion-panel-content.ts index f75db2825d..2026f69cd6 100644 --- a/src/elements/expansion-panel/expansion-panel-content/expansion-panel-content.ts +++ b/src/elements/expansion-panel/expansion-panel-content/expansion-panel-content.ts @@ -11,12 +11,13 @@ import style from './expansion-panel-content.scss?lit&inline'; * * @slot - Use the unnamed slot to add content to the `sbb-expansion-panel`. */ +export @customElement('sbb-expansion-panel-content') @hostAttributes({ role: 'region', slot: 'content', }) -export class SbbExpansionPanelContentElement extends LitElement { +class SbbExpansionPanelContentElement extends LitElement { public static override styles: CSSResultGroup = style; protected override render(): TemplateResult { diff --git a/src/elements/expansion-panel/expansion-panel-header/expansion-panel-header.ts b/src/elements/expansion-panel/expansion-panel-header/expansion-panel-header.ts index 59ddc3bddb..939653a380 100644 --- a/src/elements/expansion-panel/expansion-panel-header/expansion-panel-header.ts +++ b/src/elements/expansion-panel/expansion-panel-header/expansion-panel-header.ts @@ -18,11 +18,12 @@ import style from './expansion-panel-header.scss?lit&inline'; * @slot icon - Slot used to render the `sbb-expansion-panel-header` icon. * @event {CustomEvent} toggleExpanded - Notifies that the `sbb-expansion-panel` has to expand. */ +export @customElement('sbb-expansion-panel-header') @hostAttributes({ slot: 'header', }) -export class SbbExpansionPanelHeaderElement extends SbbDisabledTabIndexActionMixin( +class SbbExpansionPanelHeaderElement extends SbbDisabledTabIndexActionMixin( SbbIconNameMixin(SbbButtonBaseElement), ) { public static override styles: CSSResultGroup = style; diff --git a/src/elements/expansion-panel/expansion-panel-header/readme.md b/src/elements/expansion-panel/expansion-panel-header/readme.md index 1535bc06b1..6f66c79c3e 100644 --- a/src/elements/expansion-panel/expansion-panel-header/readme.md +++ b/src/elements/expansion-panel/expansion-panel-header/readme.md @@ -35,15 +35,15 @@ When the element is clicked, the `toggleExpanded` event is emitted. ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| --------------------- | ---------------------- | ------- | --------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | -| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | -| `form` | `form` | public | `string \| undefined` | | The element to associate the button with. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `name` | `name` | public | `string` | | The name of the button element. | -| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | -| `value` | `value` | public | `string` | | The value of the button element. | +| Name | Attribute | Privacy | Type | Default | Description | +| --------------------- | ---------------------- | ------- | --------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | +| `disabledInteractive` | `disabled-interactive` | public | `boolean` | `false` | Whether disabled buttons should be interactive. | +| `form` | `form` | public | `string` | `''` | The element to associate the button with. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `name` | `name` | public | `string` | | The name of the button element. | +| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | +| `value` | `value` | public | `string` | | The value of the button element. | ## Events diff --git a/src/elements/expansion-panel/expansion-panel/expansion-panel.ts b/src/elements/expansion-panel/expansion-panel/expansion-panel.ts index e9e9d6d579..f06d268127 100644 --- a/src/elements/expansion-panel/expansion-panel/expansion-panel.ts +++ b/src/elements/expansion-panel/expansion-panel/expansion-panel.ts @@ -4,6 +4,7 @@ import { customElement, property } from 'lit/decorators.js'; import { html, unsafeStatic } from 'lit/static-html.js'; import { SbbConnectedAbortController } from '../../core/controllers.js'; +import { forceType } from '../../core/decorators.js'; import { EventEmitter } from '../../core/eventing.js'; import type { SbbOpenedClosedState } from '../../core/interfaces.js'; import { SbbHydrationMixin } from '../../core/mixins.js'; @@ -24,8 +25,9 @@ let nextId = 0; * @event {CustomEvent} willClose - Emits whenever the `sbb-expansion-panel` begins the closing transition. * @event {CustomEvent} didClose - Emits whenever the `sbb-expansion-panel` is closed. */ +export @customElement('sbb-expansion-panel') -export class SbbExpansionPanelElement extends SbbHydrationMixin(LitElement) { +class SbbExpansionPanelElement extends SbbHydrationMixin(LitElement) { public static override styles: CSSResultGroup = style; public static readonly events = { willOpen: 'willOpen', @@ -35,10 +37,10 @@ export class SbbExpansionPanelElement extends SbbHydrationMixin(LitElement) { } as const; /** Heading level; if unset, a `div` will be rendered. */ - @property({ attribute: 'title-level' }) public titleLevel?: SbbTitleLevel | null; + @property({ attribute: 'title-level' }) public accessor titleLevel: SbbTitleLevel | null = null; /** The background color of the panel. */ - @property() public color: 'white' | 'milk' = 'white'; + @property() public accessor color: 'white' | 'milk' = 'white'; /** Whether the panel is expanded. */ @property({ reflect: true, type: Boolean }) @@ -63,10 +65,12 @@ export class SbbExpansionPanelElement extends SbbHydrationMixin(LitElement) { private _disabled: boolean = false; /** Whether the panel has no border. */ - @property({ reflect: true, type: Boolean }) public borderless = false; + @forceType() + @property({ reflect: true, type: Boolean }) + public accessor borderless: boolean = false; /** Size variant, either l or s. */ - @property({ reflect: true }) public size: 's' | 'l' = 'l'; + @property({ reflect: true }) public accessor size: 's' | 'l' = 'l'; /** * The state of the notification. diff --git a/src/elements/expansion-panel/expansion-panel/readme.md b/src/elements/expansion-panel/expansion-panel/readme.md index 9a0d16f5d4..0b694e49f5 100644 --- a/src/elements/expansion-panel/expansion-panel/readme.md +++ b/src/elements/expansion-panel/expansion-panel/readme.md @@ -86,14 +86,14 @@ This can be achieved by adding an `aria-label`, `aria-labelledby` or `aria-descr ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------------ | ------------- | ------- | ------------------------------------ | --------- | ---------------------------------------------------------------------- | -| `borderless` | `borderless` | public | `boolean` | `false` | Whether the panel has no border. | -| `color` | `color` | public | `'white' \| 'milk'` | `'white'` | The background color of the panel. | -| `disabled` | `disabled` | public | `boolean` | `false` | Whether the panel is disabled, so its expanded state can't be changed. | -| `expanded` | `expanded` | public | `boolean` | `false` | Whether the panel is expanded. | -| `size` | `size` | public | `'s' \| 'l'` | `'l'` | Size variant, either l or s. | -| `titleLevel` | `title-level` | public | `SbbTitleLevel \| null \| undefined` | | Heading level; if unset, a `div` will be rendered. | +| Name | Attribute | Privacy | Type | Default | Description | +| ------------ | ------------- | ------- | ----------------------- | --------- | ---------------------------------------------------------------------- | +| `borderless` | `borderless` | public | `boolean` | `false` | Whether the panel has no border. | +| `color` | `color` | public | `'white' \| 'milk'` | `'white'` | The background color of the panel. | +| `disabled` | `disabled` | public | `boolean` | `false` | Whether the panel is disabled, so its expanded state can't be changed. | +| `expanded` | `expanded` | public | `boolean` | `false` | Whether the panel is expanded. | +| `size` | `size` | public | `'s' \| 'l'` | `'l'` | Size variant, either l or s. | +| `titleLevel` | `title-level` | public | `SbbTitleLevel \| null` | `null` | Heading level; if unset, a `div` will be rendered. | ## Events diff --git a/src/elements/file-selector/file-selector.ts b/src/elements/file-selector/file-selector.ts index 123be51c86..c6d5d6c30d 100644 --- a/src/elements/file-selector/file-selector.ts +++ b/src/elements/file-selector/file-selector.ts @@ -6,7 +6,7 @@ import { html, unsafeStatic } from 'lit/static-html.js'; import type { SbbSecondaryButtonStaticElement } from '../button.js'; import { sbbInputModalityDetector } from '../core/a11y.js'; import { SbbLanguageController } from '../core/controllers.js'; -import { slotState } from '../core/decorators.js'; +import { forceType, slotState } from '../core/decorators.js'; import { EventEmitter, forwardEventToHost } from '../core/eventing.js'; import { i18nFileSelectorButtonLabel, @@ -37,35 +37,44 @@ export type DOMEvent = globalThis.Event; * @event change - An event which is emitted each time the user modifies the value. Unlike the input event, the change event is not necessarily fired for each alteration to an element's value * @event input - An event which is emitted each time the value changes as a direct result of a user action. */ +export @customElement('sbb-file-selector') @slotState() -export class SbbFileSelectorElement extends SbbDisabledMixin(SbbFormAssociatedMixin(LitElement)) { +class SbbFileSelectorElement extends SbbDisabledMixin(SbbFormAssociatedMixin(LitElement)) { public static override styles: CSSResultGroup = style; public static readonly events = { fileChangedEvent: 'fileChanged', } as const; /** Whether the component has a dropzone area or not. */ - @property() public variant: 'default' | 'dropzone' = 'default'; + @property() public accessor variant: 'default' | 'dropzone' = 'default'; /** Size variant, either s or m. */ - @property({ reflect: true }) public size: 's' | 'm' = 'm'; + @property({ reflect: true }) public accessor size: 's' | 'm' = 'm'; /** Whether more than one file can be selected. */ - @property({ type: Boolean }) public multiple: boolean = false; + @forceType() + @property({ type: Boolean }) + public accessor multiple: boolean = false; /** Whether the newly added files should override the previously added ones. */ @property({ attribute: 'multiple-mode' }) - public multipleMode: 'default' | 'persistent' = 'default'; + public accessor multipleMode: 'default' | 'persistent' = 'default'; /** A comma-separated list of allowed unique file type specifiers. */ - @property() public accept?: string; + @forceType() + @property() + public accessor accept: string = ''; /** The title displayed in `dropzone` variant. */ - @property({ attribute: 'title-content' }) public titleContent?: string; + @forceType() + @property({ attribute: 'title-content' }) + public accessor titleContent: string = ''; /** This will be forwarded as aria-label to the native input element. */ - @property({ attribute: 'accessibility-label' }) public accessibilityLabel: string | undefined; + @forceType() + @property({ attribute: 'accessibility-label' }) + public accessor accessibilityLabel: string = ''; /** The path of the first selected file. Empty string ('') if no file is selected */ @property({ attribute: false }) diff --git a/src/elements/file-selector/readme.md b/src/elements/file-selector/readme.md index 38490b1353..e1cdbc1237 100644 --- a/src/elements/file-selector/readme.md +++ b/src/elements/file-selector/readme.md @@ -93,8 +93,8 @@ It's suggested to have a different value for each variant, e.g.: | Name | Attribute | Privacy | Type | Default | Description | | -------------------- | --------------------- | ------- | --------------------------- | ----------- | ----------------------------------------------------------------------------- | -| `accept` | `accept` | public | `string \| undefined` | | A comma-separated list of allowed unique file type specifiers. | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the native input element. | +| `accept` | `accept` | public | `string` | `''` | A comma-separated list of allowed unique file type specifiers. | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the native input element. | | `disabled` | `disabled` | public | `boolean` | `false` | Whether the component is disabled. | | `files` | - | public | `File[]` | `[]` | The list of selected files. | | `form` | - | public | `HTMLFormElement \| null` | | Returns the form owner of the internals of the target element. | @@ -102,7 +102,7 @@ It's suggested to have a different value for each variant, e.g.: | `multipleMode` | `multiple-mode` | public | `'default' \| 'persistent'` | `'default'` | Whether the newly added files should override the previously added ones. | | `name` | `name` | public | `string` | | Name of the form element. Will be read from name attribute. | | `size` | `size` | public | `'s' \| 'm'` | `'m'` | Size variant, either s or m. | -| `titleContent` | `title-content` | public | `string \| undefined` | | The title displayed in `dropzone` variant. | +| `titleContent` | `title-content` | public | `string` | `''` | The title displayed in `dropzone` variant. | | `value` | `value` | public | `string \| null` | `null` | The path of the first selected file. Empty string ('') if no file is selected | | `variant` | `variant` | public | `'default' \| 'dropzone'` | `'default'` | Whether the component has a dropzone area or not. | diff --git a/src/elements/flip-card/flip-card-details/flip-card-details.ts b/src/elements/flip-card/flip-card-details/flip-card-details.ts index 49584d3f47..46556e0d33 100644 --- a/src/elements/flip-card/flip-card-details/flip-card-details.ts +++ b/src/elements/flip-card/flip-card-details/flip-card-details.ts @@ -13,11 +13,12 @@ import style from './flip-card-details.scss?lit&inline'; * * @slot - Use the unnamed slot to provide any kind of content. */ +export @customElement('sbb-flip-card-details') @hostAttributes({ slot: 'details', }) -export class SbbFlipCardDetailsElement extends LitElement { +class SbbFlipCardDetailsElement extends LitElement { public static override styles: CSSResultGroup = style; public constructor() { diff --git a/src/elements/flip-card/flip-card-summary/flip-card-summary.ts b/src/elements/flip-card/flip-card-summary/flip-card-summary.ts index 56b0253931..25539dcb2b 100644 --- a/src/elements/flip-card/flip-card-summary/flip-card-summary.ts +++ b/src/elements/flip-card/flip-card-summary/flip-card-summary.ts @@ -14,16 +14,17 @@ export type SbbFlipCardImageAlignment = 'after' | 'below'; * @slot - Use the unnamed slot to provide a title for the `sbb-flip-card-summary`. * @slot image - Use this slot to provide an image for the `sbb-flip-card-summary`. */ +export @customElement('sbb-flip-card-summary') @hostAttributes({ slot: 'summary', }) -export class SbbFlipCardSummaryElement extends LitElement { +class SbbFlipCardSummaryElement extends LitElement { public static override styles: CSSResultGroup = style; /** The position where to render the image. */ @property({ attribute: 'image-alignment', reflect: true }) - public imageAlignment: SbbFlipCardImageAlignment = 'after'; + public accessor imageAlignment: SbbFlipCardImageAlignment = 'after'; protected override willUpdate(_changedProperties: PropertyValues): void { super.willUpdate(_changedProperties); diff --git a/src/elements/flip-card/flip-card/flip-card.ts b/src/elements/flip-card/flip-card/flip-card.ts index 0d697b0887..e7badb1317 100644 --- a/src/elements/flip-card/flip-card/flip-card.ts +++ b/src/elements/flip-card/flip-card/flip-card.ts @@ -4,6 +4,7 @@ import { until } from 'lit/directives/until.js'; import { IS_FOCUSABLE_QUERY } from '../../core/a11y.js'; import { SbbConnectedAbortController, SbbLanguageController } from '../../core/controllers.js'; +import { forceType } from '../../core/decorators.js'; import { EventEmitter } from '../../core/eventing.js'; import { i18nFlipCard, i18nReverseCard } from '../../core/i18n.js'; import { SbbHydrationMixin } from '../../core/mixins.js'; @@ -22,8 +23,9 @@ import '../../screen-reader-only.js'; * @event {CustomEvent} flip - Emits when the flip card flips. * */ +export @customElement('sbb-flip-card') -export class SbbFlipCardElement extends SbbHydrationMixin(LitElement) { +class SbbFlipCardElement extends SbbHydrationMixin(LitElement) { public static override styles: CSSResultGroup = style; public static readonly events = { flip: 'flip', @@ -33,7 +35,9 @@ export class SbbFlipCardElement extends SbbHydrationMixin(LitElement) { * This will be forwarded as aria-label to the action in the non flipped state. * If not set, the textContent of the `sbb-flip-card-summary` is taken. */ - @property({ attribute: 'accessibility-label' }) public accessibilityLabel: string | undefined; + @forceType() + @property({ attribute: 'accessibility-label' }) + public accessor accessibilityLabel: string = ''; /** Emits whenever the component is flipped. */ protected flip: EventEmitter = new EventEmitter(this, SbbFlipCardElement.events.flip); @@ -54,7 +58,7 @@ export class SbbFlipCardElement extends SbbHydrationMixin(LitElement) { } /** Whether the card is flipped or not. */ - @state() private _flipped = false; + @state() private accessor _flipped = false; private _abort = new SbbConnectedAbortController(this); private _language = new SbbLanguageController(this); diff --git a/src/elements/flip-card/flip-card/readme.md b/src/elements/flip-card/flip-card/readme.md index 41e986a2a7..44483bc260 100644 --- a/src/elements/flip-card/flip-card/readme.md +++ b/src/elements/flip-card/flip-card/readme.md @@ -25,7 +25,7 @@ The `sbb-flip-card` will switch to the flipped state after the user clicks on it | Name | Attribute | Privacy | Type | Default | Description | | -------------------- | --------------------- | ------- | ----------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the action in the non flipped state. If not set, the textContent of the `sbb-flip-card-summary` is taken. | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the action in the non flipped state. If not set, the textContent of the `sbb-flip-card-summary` is taken. | | `details` | - | public | `SbbFlipCardDetailsElement \| null` | | Returns the slotted sbb-flip-card-details. | | `isFlipped` | - | public | `boolean` | | Whether the flip card is flipped. | | `summary` | - | public | `SbbFlipCardSummaryElement \| null` | | Returns the slotted sbb-flip-card-summary. | diff --git a/src/elements/footer/footer.ts b/src/elements/footer/footer.ts index 8cfc9d690b..463734af84 100644 --- a/src/elements/footer/footer.ts +++ b/src/elements/footer/footer.ts @@ -3,6 +3,7 @@ import { LitElement, nothing } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import { html, unsafeStatic } from 'lit/static-html.js'; +import { forceType } from '../core/decorators.js'; import { SbbNegativeMixin } from '../core/mixins.js'; import type { SbbTitleLevel } from '../title.js'; @@ -13,8 +14,9 @@ import style from './footer.scss?lit&inline'; * * @slot - Use the unnamed slot to add elements like `sbb-block-link`, `sbb-link-list`, `sbb-divider` and so on. */ +export @customElement('sbb-footer') -export class SbbFooterElement extends SbbNegativeMixin(LitElement) { +class SbbFooterElement extends SbbNegativeMixin(LitElement) { public static override styles: CSSResultGroup = style; /** @@ -22,20 +24,24 @@ export class SbbFooterElement extends SbbNegativeMixin(LitElement) { * approach. The clock-columns, used a css-grid for displaying the content over different * breakpoints. */ - @property({ reflect: true }) public variant: 'default' | 'clock-columns' = 'default'; + @property({ reflect: true }) public accessor variant: 'default' | 'clock-columns' = 'default'; /** * Whether to allow the footer content to stretch to full width. * By default, the content has the appropriate page size. */ - @property({ reflect: true, type: Boolean }) public expanded = false; + @forceType() + @property({ reflect: true, type: Boolean }) + public accessor expanded: boolean = false; /** Footer title text, visually hidden, necessary for screen readers. */ - @property({ attribute: 'accessibility-title' }) public accessibilityTitle?: string; + @forceType() + @property({ attribute: 'accessibility-title' }) + public accessor accessibilityTitle: string = ''; /** Level of the accessibility title, will be rendered as heading tag (e.g. h1). Defaults to level 1. */ @property({ attribute: 'accessibility-title-level' }) - public accessibilityTitleLevel: SbbTitleLevel = '1'; + public accessor accessibilityTitleLevel: SbbTitleLevel = '1'; protected override render(): TemplateResult { const TITLE_TAG_NAME = `h${this.accessibilityTitleLevel}`; diff --git a/src/elements/footer/readme.md b/src/elements/footer/readme.md index 7c1c5281c9..fe0c262147 100644 --- a/src/elements/footer/readme.md +++ b/src/elements/footer/readme.md @@ -77,7 +77,7 @@ to the content where needed (e.g. `sbb-link-list`, `sbb-link` and `sbb-divider`) | Name | Attribute | Privacy | Type | Default | Description | | ------------------------- | --------------------------- | ------- | ------------------------------ | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `accessibilityTitle` | `accessibility-title` | public | `string \| undefined` | | Footer title text, visually hidden, necessary for screen readers. | +| `accessibilityTitle` | `accessibility-title` | public | `string` | `''` | Footer title text, visually hidden, necessary for screen readers. | | `accessibilityTitleLevel` | `accessibility-title-level` | public | `SbbTitleLevel` | `'1'` | Level of the accessibility title, will be rendered as heading tag (e.g. h1). Defaults to level 1. | | `expanded` | `expanded` | public | `boolean` | `false` | Whether to allow the footer content to stretch to full width. By default, the content has the appropriate page size. | | `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | diff --git a/src/elements/form-error/form-error.ts b/src/elements/form-error/form-error.ts index 48a06ddeac..f3e47452b6 100644 --- a/src/elements/form-error/form-error.ts +++ b/src/elements/form-error/form-error.ts @@ -14,8 +14,9 @@ let nextId = 0; * @slot - Use this slot to display the error message. * @slot icon - Use this slot to override the default error icon. */ +export @customElement('sbb-form-error') -export class SbbFormErrorElement extends SbbNegativeMixin(LitElement) { +class SbbFormErrorElement extends SbbNegativeMixin(LitElement) { public static override styles: CSSResultGroup = style; public override connectedCallback(): void { diff --git a/src/elements/form-field/form-field-clear/form-field-clear.ts b/src/elements/form-field/form-field-clear/form-field-clear.ts index 8878e77692..5dda4be5d6 100644 --- a/src/elements/form-field/form-field-clear/form-field-clear.ts +++ b/src/elements/form-field/form-field-clear/form-field-clear.ts @@ -16,11 +16,12 @@ import '../../icon.js'; /** * Combined with `sbb-form-field`, it displays a button which clears the input value. */ +export @customElement('sbb-form-field-clear') @hostAttributes({ slot: 'suffix', }) -export class SbbFormFieldClearElement extends SbbNegativeMixin(SbbButtonBaseElement) { +class SbbFormFieldClearElement extends SbbNegativeMixin(SbbButtonBaseElement) { public static override styles: CSSResultGroup = style; private _formField?: SbbFormFieldElement | null; diff --git a/src/elements/form-field/form-field-clear/readme.md b/src/elements/form-field/form-field-clear/readme.md index 9ace16a4cb..5f6395457b 100644 --- a/src/elements/form-field/form-field-clear/readme.md +++ b/src/elements/form-field/form-field-clear/readme.md @@ -15,10 +15,10 @@ to provide the possibility to display a clear button which can clear the input v ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ---------- | ---------- | ------- | --------------------- | ---------- | ------------------------------------------------ | -| `form` | `form` | public | `string \| undefined` | | The element to associate the button with. | -| `name` | `name` | public | `string` | | The name of the button element. | -| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | -| `value` | `value` | public | `string` | | The value of the button element. | +| Name | Attribute | Privacy | Type | Default | Description | +| ---------- | ---------- | ------- | --------------- | ---------- | ------------------------------------------------ | +| `form` | `form` | public | `string` | `''` | The element to associate the button with. | +| `name` | `name` | public | `string` | | The name of the button element. | +| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | +| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | +| `value` | `value` | public | `string` | | The value of the button element. | diff --git a/src/elements/form-field/form-field/form-field.ts b/src/elements/form-field/form-field/form-field.ts index 31906d5092..72f3f4aae0 100644 --- a/src/elements/form-field/form-field/form-field.ts +++ b/src/elements/form-field/form-field/form-field.ts @@ -5,7 +5,7 @@ import { customElement, property, state } from 'lit/decorators.js'; import type { SbbInputModality } from '../../core/a11y.js'; import { sbbInputModalityDetector } from '../../core/a11y.js'; import { SbbConnectedAbortController, SbbLanguageController } from '../../core/controllers.js'; -import { slotState } from '../../core/decorators.js'; +import { forceType, slotState } from '../../core/decorators.js'; import { isFirefox, setOrRemoveAttribute } from '../../core/dom.js'; import { i18nOptional } from '../../core/i18n.js'; import { SbbHydrationMixin, SbbNegativeMixin } from '../../core/mixins.js'; @@ -29,9 +29,10 @@ const supportedPopupTagNames = ['sbb-autocomplete', 'sbb-autocomplete-grid', 'sb * @slot suffix - Use this slot to render an icon on the right side of the input. * @slot error - Use this slot to render an error. */ +export @customElement('sbb-form-field') @slotState() -export class SbbFormFieldElement extends SbbNegativeMixin(SbbHydrationMixin(LitElement)) { +class SbbFormFieldElement extends SbbNegativeMixin(SbbHydrationMixin(LitElement)) { public static override styles: CSSResultGroup = style; private readonly _supportedNativeInputElements = ['input', 'select', 'textarea']; @@ -67,40 +68,47 @@ export class SbbFormFieldElement extends SbbNegativeMixin(SbbHydrationMixin(LitE * `reserve` does reserve one row for an error message. */ @property({ attribute: 'error-space', reflect: true }) - public errorSpace?: 'none' | 'reserve' = 'none'; + public accessor errorSpace: 'none' | 'reserve' = 'none'; /** Indicates whether the input is optional. */ - @property({ type: Boolean }) public optional?: boolean; + @forceType() + @property({ type: Boolean }) + public accessor optional: boolean = false; /** Size variant, either l or m. */ - @property({ reflect: true }) public size?: 'l' | 'm' | 's' = 'm'; + @property({ reflect: true }) public accessor size: 'l' | 'm' | 's' = 'm'; /** Whether to display the form field without a border. */ - @property({ reflect: true, type: Boolean }) public borderless = false; + @forceType() + @property({ reflect: true, type: Boolean }) + public accessor borderless: boolean = false; /** Defines the width of the component: * - `default`: the component has defined width and min-width; * - `collapse`: the component adapts itself to its inner input content. */ - @property({ reflect: true }) public width: 'default' | 'collapse' = 'default'; + @property({ reflect: true }) public accessor width: 'default' | 'collapse' = 'default'; /** Whether to visually hide the label. If hidden, screen readers will still read it. */ - @property({ attribute: 'hidden-label', reflect: true, type: Boolean }) public hiddenLabel = false; + @forceType() + @property({ attribute: 'hidden-label', reflect: true, type: Boolean }) + public accessor hiddenLabel: boolean = false; /** Whether the label should float. If activated, the placeholder of the input is hidden. */ - @property({ attribute: 'floating-label', reflect: true, type: Boolean }) public floatingLabel = - false; + @forceType() + @property({ attribute: 'floating-label', reflect: true, type: Boolean }) + public accessor floatingLabel: boolean = false; /** It is used internally to get the `error` slot. */ - @state() private _errorElements: Element[] = []; + @state() private accessor _errorElements: Element[] = []; /** Original aria-describedby value of the slotted input element. */ private _originalInputAriaDescribedby?: string | null; /** Reference to the slotted input element. */ - @state() private _input?: HTMLInputElement | HTMLSelectElement | HTMLElement; + @state() private accessor _input!: HTMLInputElement | HTMLSelectElement | HTMLElement | undefined; /** Reference to the slotted label elements. */ - @state() private _label?: HTMLLabelElement; + @state() private accessor _label!: HTMLLabelElement; /** Returns the input element. */ public get inputElement(): HTMLInputElement | HTMLSelectElement | HTMLElement | undefined { diff --git a/src/elements/form-field/form-field/readme.md b/src/elements/form-field/form-field/readme.md index 262c983270..43d172a7cc 100644 --- a/src/elements/form-field/form-field/readme.md +++ b/src/elements/form-field/form-field/readme.md @@ -151,13 +151,13 @@ technology will announce errors when they appear. | Name | Attribute | Privacy | Type | Default | Description | | --------------- | ---------------- | ------- | ------------------------------------------------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `borderless` | `borderless` | public | `boolean` | `false` | Whether to display the form field without a border. | -| `errorSpace` | `error-space` | public | `'none' \| 'reserve' \| undefined` | `'none'` | Whether to reserve space for an error message. `none` does not reserve any space. `reserve` does reserve one row for an error message. | +| `errorSpace` | `error-space` | public | `'none' \| 'reserve'` | `'none'` | Whether to reserve space for an error message. `none` does not reserve any space. `reserve` does reserve one row for an error message. | | `floatingLabel` | `floating-label` | public | `boolean` | `false` | Whether the label should float. If activated, the placeholder of the input is hidden. | | `hiddenLabel` | `hidden-label` | public | `boolean` | `false` | Whether to visually hide the label. If hidden, screen readers will still read it. | | `inputElement` | - | public | `HTMLInputElement \| HTMLSelectElement \| HTMLElement \| undefined` | | Returns the input element. | | `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. | -| `optional` | `optional` | public | `boolean \| undefined` | | Indicates whether the input is optional. | -| `size` | `size` | public | `'l' \| 'm' \| 's' \| undefined` | `'m'` | Size variant, either l or m. | +| `optional` | `optional` | public | `boolean` | `false` | Indicates whether the input is optional. | +| `size` | `size` | public | `'l' \| 'm' \| 's'` | `'m'` | Size variant, either l or m. | | `width` | `width` | public | `'default' \| 'collapse'` | `'default'` | Defines the width of the component: - `default`: the component has defined width and min-width; - `collapse`: the component adapts itself to its inner input content. | ## Methods diff --git a/src/elements/header/common/header-action-common.ts b/src/elements/header/common/header-action-common.ts index b24a2918ec..0811d7979e 100644 --- a/src/elements/header/common/header-action-common.ts +++ b/src/elements/header/common/header-action-common.ts @@ -12,8 +12,8 @@ import style from './header-action.scss?lit&inline'; export declare class SbbHeaderActionCommonElementMixinType implements Partial { - public expandFrom: SbbHorizontalFrom; - public iconName?: string; + public accessor expandFrom: SbbHorizontalFrom; + public accessor iconName: string; } // eslint-disable-next-line @typescript-eslint/naming-convention @@ -34,7 +34,7 @@ export const SbbHeaderActionCommonElementMixin = < * and hidden for all the others. */ @property({ attribute: 'expand-from', reflect: true }) - public expandFrom: SbbHorizontalFrom = 'medium'; + public accessor expandFrom: SbbHorizontalFrom = 'medium'; protected override renderTemplate(): TemplateResult { return html` diff --git a/src/elements/header/header-button/header-button.ts b/src/elements/header/header-button/header-button.ts index 4d182d15cc..8026958f51 100644 --- a/src/elements/header/header-button/header-button.ts +++ b/src/elements/header/header-button/header-button.ts @@ -9,10 +9,9 @@ import { SbbHeaderActionCommonElementMixin } from '../common.js'; * @slot icon - Slot used to render the button icon. * @slot - Use the unnamed slot to add content to the `sbb-header-button`. */ +export @customElement('sbb-header-button') -export class SbbHeaderButtonElement extends SbbHeaderActionCommonElementMixin( - SbbButtonBaseElement, -) {} +class SbbHeaderButtonElement extends SbbHeaderActionCommonElementMixin(SbbButtonBaseElement) {} declare global { interface HTMLElementTagNameMap { diff --git a/src/elements/header/header-button/readme.md b/src/elements/header/header-button/readme.md index fd22af1175..9140ecbb74 100644 --- a/src/elements/header/header-button/readme.md +++ b/src/elements/header/header-button/readme.md @@ -48,14 +48,14 @@ accepting its associated properties (`type`, `name`, `value` and `form`). ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| ------------ | ------------- | ------- | --------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `expandFrom` | `expand-from` | public | `SbbHorizontalFrom` | `'medium'` | Used to set the minimum breakpoint from which the text is displayed. E.g. if set to 'large', the text will be visible for breakpoints large, wide, ultra, and hidden for all the others. | -| `form` | `form` | public | `string \| undefined` | | The element to associate the button with. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `name` | `name` | public | `string` | | The name of the button element. | -| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | -| `value` | `value` | public | `string` | | The value of the button element. | +| Name | Attribute | Privacy | Type | Default | Description | +| ------------ | ------------- | ------- | ------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `expandFrom` | `expand-from` | public | `SbbHorizontalFrom` | `'medium'` | Used to set the minimum breakpoint from which the text is displayed. E.g. if set to 'large', the text will be visible for breakpoints large, wide, ultra, and hidden for all the others. | +| `form` | `form` | public | `string` | `''` | The element to associate the button with. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `name` | `name` | public | `string` | | The name of the button element. | +| `type` | `type` | public | `SbbButtonType` | `'button'` | The type attribute to use for the button. | +| `value` | `value` | public | `string` | | The value of the button element. | ## Slots diff --git a/src/elements/header/header-link/header-link.ts b/src/elements/header/header-link/header-link.ts index d2099c49aa..a180a03190 100644 --- a/src/elements/header/header-link/header-link.ts +++ b/src/elements/header/header-link/header-link.ts @@ -9,8 +9,9 @@ import { SbbHeaderActionCommonElementMixin } from '../common.js'; * @slot icon - Slot used to render the link icon. * @slot - Use the unnamed slot to add content to the `sbb-header-link`. */ +export @customElement('sbb-header-link') -export class SbbHeaderLinkElement extends SbbHeaderActionCommonElementMixin(SbbLinkBaseElement) {} +class SbbHeaderLinkElement extends SbbHeaderActionCommonElementMixin(SbbLinkBaseElement) {} declare global { interface HTMLElementTagNameMap { diff --git a/src/elements/header/header-link/readme.md b/src/elements/header/header-link/readme.md index b6efd2729f..a3d30fdc29 100644 --- a/src/elements/header/header-link/readme.md +++ b/src/elements/header/header-link/readme.md @@ -43,15 +43,15 @@ accepting its associated properties (`href`, `target`, `rel` and `download`). ## Properties -| Name | Attribute | Privacy | Type | Default | Description | -| -------------------- | --------------------- | ------- | --------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the inner anchor element. | -| `download` | `download` | public | `boolean \| undefined` | | Whether the browser will show the download dialog on click. | -| `expandFrom` | `expand-from` | public | `SbbHorizontalFrom` | `'medium'` | Used to set the minimum breakpoint from which the text is displayed. E.g. if set to 'large', the text will be visible for breakpoints large, wide, ultra, and hidden for all the others. | -| `href` | `href` | public | `string \| undefined` | | The href value you want to link to. | -| `iconName` | `icon-name` | public | `string \| undefined` | | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | -| `rel` | `rel` | public | `string \| undefined` | | The relationship of the linked URL as space-separated link types. | -| `target` | `target` | public | `LinkTargetType \| string \| undefined` | | Where to display the linked URL. | +| Name | Attribute | Privacy | Type | Default | Description | +| -------------------- | --------------------- | ------- | -------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `accessibilityLabel` | `accessibility-label` | public | `string` | `''` | This will be forwarded as aria-label to the inner anchor element. | +| `download` | `download` | public | `boolean` | `false` | Whether the browser will show the download dialog on click. | +| `expandFrom` | `expand-from` | public | `SbbHorizontalFrom` | `'medium'` | Used to set the minimum breakpoint from which the text is displayed. E.g. if set to 'large', the text will be visible for breakpoints large, wide, ultra, and hidden for all the others. | +| `href` | `href` | public | `string` | `''` | The href value you want to link to. | +| `iconName` | `icon-name` | public | `string` | `''` | The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch. | +| `rel` | `rel` | public | `string` | `''` | The relationship of the linked URL as space-separated link types. | +| `target` | `target` | public | `LinkTargetType \| string` | `''` | Where to display the linked URL. | ## Slots diff --git a/src/elements/header/header/header.ts b/src/elements/header/header/header.ts index 16dd91f288..f3627beda6 100644 --- a/src/elements/header/header/header.ts +++ b/src/elements/header/header/header.ts @@ -2,6 +2,7 @@ import { type CSSResultGroup, html, isServer, LitElement, type TemplateResult } import { customElement, property, state } from 'lit/decorators.js'; import { SbbFocusVisibleWithinController } from '../../core/a11y.js'; +import { forceType } from '../../core/decorators.js'; import { findReferencedElement } from '../../core/dom.js'; import { SbbHydrationMixin } from '../../core/mixins.js'; @@ -19,15 +20,18 @@ const IS_MENU_OPENED_QUERY = "[aria-controls][aria-expanded='true']"; * @cssprop [--sbb-header-z-index=10] - Can be used to modify the z-index of the header. * @cssprop [--sbb-header-height=zero-small:var(--sbb-spacing-fixed-14x);medium-ultra:var(--sbb-spacing-fixed-24x)] - Can be used to modify height of the header. */ +export @customElement('sbb-header') -export class SbbHeaderElement extends SbbHydrationMixin(LitElement) { +class SbbHeaderElement extends SbbHydrationMixin(LitElement) { public static override styles: CSSResultGroup = style; /** * Whether to allow the header content to stretch to full width. * By default, the content has the appropriate page size. */ - @property({ reflect: true, type: Boolean }) public expanded = false; + @forceType() + @property({ reflect: true, type: Boolean }) + public accessor expanded: boolean = false; /** The element's id or the element on which the scroll listener is attached. */ @property({ attribute: 'scroll-origin' }) @@ -42,13 +46,14 @@ export class SbbHeaderElement extends SbbHydrationMixin(LitElement) { private _scrollOrigin: string | HTMLElement | Document = !isServer ? document : null!; /** Whether the header should hide and show on scroll. */ - @property({ attribute: 'hide-on-scroll', reflect: true, type: Boolean }) public hideOnScroll = - false; + @forceType() + @property({ attribute: 'hide-on-scroll', reflect: true, type: Boolean }) + public accessor hideOnScroll: boolean = false; /** Size of the header. */ - @property({ reflect: true }) public size: 'm' | 's' = 'm'; + @property({ reflect: true }) public accessor size: 'm' | 's' = 'm'; - @state() private _headerOnTop = true; + @state() private accessor _headerOnTop = true; private _scrollElement: HTMLElement | Document | null | undefined; private _scrollEventsController!: AbortController; diff --git a/src/elements/icon/icon-base.ts b/src/elements/icon/icon-base.ts index f856d7906c..4558de661a 100644 --- a/src/elements/icon/icon-base.ts +++ b/src/elements/icon/icon-base.ts @@ -6,29 +6,32 @@ import type { UnsafeHTMLDirective } from 'lit/directives/unsafe-html.js'; import { unsafeHTML } from 'lit/directives/unsafe-html.js'; import { until } from 'lit/directives/until.js'; -import { hostAttributes } from '../core/decorators.js'; +import { forceType, hostAttributes } from '../core/decorators.js'; import { getSvgContent } from './icon-request.js'; import style from './icon.scss?lit&inline'; +const defaultNamespace = 'default'; + /** * @cssprop [--sbb-icon-svg-width=auto] - Can be used to set a custom width. * @cssprop [--sbb-icon-svg-height=auto] - Can be used to set a custom height. */ +export @hostAttributes({ - 'data-namespace': SbbIconBase._defaultNamespace, + 'data-namespace': defaultNamespace, 'data-empty': '', }) -export abstract class SbbIconBase extends LitElement { +abstract class SbbIconBase extends LitElement { public static override styles: CSSResultGroup = style; - private static readonly _defaultNamespace = 'default'; - @state() private _svgNamespace = SbbIconBase._defaultNamespace; + @state() private accessor _svgNamespace = defaultNamespace; /** * The icon svg content rendered on the page: .... */ - @state() private _svgIcon?: Promise>; + @state() private accessor _svgIcon: Promise> | null = + null; /** * When set to `true`, SVG content that is HTTP fetched will not be checked @@ -36,7 +39,9 @@ export abstract class SbbIconBase extends LitElement { * that start with `on`, such as `onclick`. * @default false */ - @property({ attribute: 'no-sanitize', type: Boolean }) public noSanitize = false; + @forceType() + @property({ attribute: 'no-sanitize', type: Boolean }) + public accessor noSanitize: boolean = false; protected async loadSvgIcon(iconName: string): Promise { if (!iconName) { @@ -68,7 +73,7 @@ export abstract class SbbIconBase extends LitElement { switch (parts.length) { case 1: // Use default namespace if empty. - return [SbbIconBase._defaultNamespace, parts[0]]; + return [defaultNamespace, parts[0]]; case 2: return parts as [string, string]; default: diff --git a/src/elements/icon/icon-name-mixin.ts b/src/elements/icon/icon-name-mixin.ts index 0a960c0b9d..6ffdcb34b5 100644 --- a/src/elements/icon/icon-name-mixin.ts +++ b/src/elements/icon/icon-name-mixin.ts @@ -1,12 +1,13 @@ import { html, type LitElement, nothing, type TemplateResult } from 'lit'; import { property } from 'lit/decorators.js'; +import { forceType, omitEmptyConverter } from '../core/decorators.js'; import type { AbstractConstructor } from '../core/mixins.js'; import './icon.js'; export declare class SbbIconNameMixinType { - public iconName?: string; + public accessor iconName: string; protected renderIconSlot(classname?: string): TemplateResult; } @@ -23,7 +24,9 @@ export const SbbIconNameMixin = >( * from the ui-icons category from here * https://icons.app.sbb.ch. */ - @property({ attribute: 'icon-name', reflect: true }) public iconName?: string; + @forceType() + @property({ attribute: 'icon-name', reflect: true, converter: omitEmptyConverter }) + public accessor iconName: string = ''; protected renderIconSlot(classname?: string): TemplateResult { return html` diff --git a/src/elements/icon/icon.ts b/src/elements/icon/icon.ts index 3fac5b8515..4d048a78e1 100644 --- a/src/elements/icon/icon.ts +++ b/src/elements/icon/icon.ts @@ -1,13 +1,16 @@ import { html, type PropertyValues, type TemplateResult } from 'lit'; import { customElement, property, state } from 'lit/decorators.js'; +import { forceType, omitEmptyConverter } from '../core/decorators.js'; + import { SbbIconBase } from './icon-base.js'; /** * It displays an icon loaded from a registered namespace. */ +export @customElement('sbb-icon') -export class SbbIconElement extends SbbIconBase { +class SbbIconElement extends SbbIconBase { /** * We need to additionally observe the svgicon attribute * for sbb-angular compatibility. @@ -22,7 +25,9 @@ export class SbbIconElement extends SbbIconBase { * If the namespace is missing, the default namespace "sbb" will be used. * E.g. `name` (will use "sbb" as namespace) or `namespace:name`. */ - @property({ reflect: true }) public name!: string; + @forceType() + @property({ reflect: true, converter: omitEmptyConverter }) + public accessor name: string = ''; private _defaultAriaLabel = ''; @@ -31,7 +36,7 @@ export class SbbIconElement extends SbbIconBase { * compatibility with it (as some icons are used internally inside the other sbb-angular * components) we need to check whether the attribute svgicon is used. */ - @state() private _sbbAngularCompatibility = false; + @state() private accessor _sbbAngularCompatibility = false; protected override async fetchSvgIcon(namespace: string, name: string): Promise { // If the icon is changing, and we were using the defaultAriaLabel, reset it @@ -53,7 +58,7 @@ export class SbbIconElement extends SbbIconBase { protected override willUpdate(changedProperties: PropertyValues): void { super.willUpdate(changedProperties); - if (changedProperties.has('name')) { + if (changedProperties.has('name') && this.name) { this.loadSvgIcon(this.name); } } diff --git a/src/elements/icon/readme.md b/src/elements/icon/readme.md index 4b288c74d6..5f5bb38354 100644 --- a/src/elements/icon/readme.md +++ b/src/elements/icon/readme.md @@ -36,7 +36,7 @@ In thinking about accessibility, it is useful to place icon use into one of thre | Name | Attribute | Privacy | Type | Default | Description | | ------------ | ------------- | ------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `name` | `name` | public | `string` | | The provided name consisting of the namespace and the name of the icon. If the namespace is missing, the default namespace "sbb" will be used. E.g. `name` (will use "sbb" as namespace) or `namespace:name`. | +| `name` | `name` | public | `string` | `''` | The provided name consisting of the namespace and the name of the icon. If the namespace is missing, the default namespace "sbb" will be used. E.g. `name` (will use "sbb" as namespace) or `namespace:name`. | | `noSanitize` | `no-sanitize` | public | `boolean` | `false` | When set to `true`, SVG content that is HTTP fetched will not be checked if the response SVG content has any `