fix ButtonGroup not adding classes to children

This commit is contained in:
Keviin Åberg Kultalahti 2021-04-21 14:19:10 +02:00
parent a86c6788da
commit cb3e2fd106
3 changed files with 11 additions and 3 deletions

View File

@ -42,7 +42,7 @@
"@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2",
"@spectrum-css/button": "^3.0.1",
"@spectrum-css/buttongroup": "^3.0.1",
"@spectrum-css/buttongroup": "^3.0.2",
"@spectrum-css/checkbox": "^3.0.2",
"@spectrum-css/dialog": "^3.0.1",
"@spectrum-css/divider": "^1.0.1",

View File

@ -1,7 +1,15 @@
<script>
import "@spectrum-css/buttongroup/dist/index-vars.css"
export let vertical = false
function group(element) {
const buttons = Array.from(element.getElementsByTagName('button'))
buttons.forEach(button => {
button.classList.add('spectrum-ButtonGroup-item')
})
}
</script>
<div class="spectrum-ButtonGroup" class:spectrum-ButtonGroup--vertical={vertical}>
<div use:group class="spectrum-ButtonGroup" class:spectrum-ButtonGroup--vertical={vertical}>
<slot />
</div>

View File

@ -89,7 +89,7 @@
resolved "https://registry.yarnpkg.com/@spectrum-css/button/-/button-3.0.2.tgz#387712641457d3045bcecf77e13854dd59e9c20e"
integrity sha512-sUJuYrrmIL0RCkQpTQ9B5AdoWlu4Y6JatrcOB/OOwdzLbQ9bHw1bHj/y0Ua67hEtLOTjODU+2e5K3UM3KGnMTA==
"@spectrum-css/buttongroup@^3.0.1":
"@spectrum-css/buttongroup@^3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/buttongroup/-/buttongroup-3.0.2.tgz#fd3387973ca3131609e32112de42a1c0400a48d8"
integrity sha512-Wu7B4GJ/SAeVHz9SUGAkeIH8pLaZh4t+w2ykSKOPQIRuK2jCBoudkEClVxviNVwqekccf5XLFXg9GpYF1a3Uaw==