diff --git a/packages/materialdesign-components/src/Button/Button.svelte b/packages/materialdesign-components/src/Button/Button.svelte
index 7b7880e2ff..6142352280 100644
--- a/packages/materialdesign-components/src/Button/Button.svelte
+++ b/packages/materialdesign-components/src/Button/Button.svelte
@@ -6,6 +6,7 @@
const cb = new ClassBuilder("button", ["primary", "medium", "text"])
+ export let _bb
export let onClick
export let variant = "text"
@@ -20,8 +21,6 @@
export let text = ""
export let disabled = false
- export let _bb
-
onMount(() => {
let ctx = _bb.getContext("BBMD:button:context")
extras = [ctx]
diff --git a/packages/materialdesign-components/src/Card/CardBody.svelte b/packages/materialdesign-components/src/Card/CardBody.svelte
index 08cb549e06..6be83a319e 100644
--- a/packages/materialdesign-components/src/Card/CardBody.svelte
+++ b/packages/materialdesign-components/src/Card/CardBody.svelte
@@ -2,9 +2,11 @@
export let _bb
export let onClick = () => {}
+ export let clicked = () => _bb.call(onClick)
+
let cardBody
$: cardBody && _bb.attachChildren(cardBody)
-
+
diff --git a/packages/materialdesign-components/src/Checkbox/Checkbox.svelte b/packages/materialdesign-components/src/Checkbox/Checkbox.svelte
index ba9cfcf40c..05c057889c 100644
--- a/packages/materialdesign-components/src/Checkbox/Checkbox.svelte
+++ b/packages/materialdesign-components/src/Checkbox/Checkbox.svelte
@@ -6,7 +6,7 @@
import { MDCCheckbox } from "@material/checkbox"
import { generate } from "shortid"
- export let onClick = item => {}
+ export let onChange = item => {}
export let _bb
@@ -59,13 +59,15 @@
function changed(e) {
const val = e.target.checked
checked = val
+ handleOnClick()
if (_bb.isBound(_bb.props.checked)) {
_bb.setStateFromBinding(_bb.props.checked, val)
}
}
function handleOnClick() {
- let item = { _id, label, value }
+ let item = { _id, checked, label, value }
+
if (context === "checkboxgroup") {
let idx = selectedItems.getItemIdx($selectedItems, _id)
if (idx > -1) {
@@ -73,9 +75,8 @@
} else {
selectedItems.addItem(item)
}
- } else {
- onClick(item)
}
+ _bb.call(onChange, item)
}
$: isChecked =
@@ -101,7 +102,6 @@
{id}
disabled={isDisabled}
{isChecked}
- on:click={handleOnClick}
on:change={changed} />