diff --git a/packages/materialdesign-components/components.json b/packages/materialdesign-components/components.json
index 27b603aa32..b19715c73e 100644
--- a/packages/materialdesign-components/components.json
+++ b/packages/materialdesign-components/components.json
@@ -28,9 +28,21 @@
"description": "A Material Design button with different variations. It renders as an anchor if href is passed to it.",
"props": {
"onClick": "event",
- "variant": "string",
- "colour": "string",
- "size": "string",
+ "variant": {
+ "type": "options",
+ "options": ["text", "raised", "unelevated", "outlined"],
+ "default": "text"
+ },
+ "colour": {
+ "type": "options",
+ "options": ["primary", "secondary"],
+ "default": "primary"
+ },
+ "size": {
+ "type": "options",
+ "options": ["small", "medium", "large"],
+ "default": "medium"
+ },
"href": "string",
"icon": "string",
"trailingIcon": "bool",
@@ -158,8 +170,7 @@
"props": {
"onClick": "event",
"id": "string",
- "label": "string",
- "names": "string",
+ "label": "string",
"name": "string",
"checked": "bool",
"disabled": "bool",
@@ -190,12 +201,28 @@
"onChange": "event",
"value": "string",
"label": "string",
- "variant": "string",
+ "variant": {
+ "type": "options",
+ "options": ["standard", "outlined", "filled"],
+ "default": "standard"
+ },
"disabled": "bool",
"fullwidth": "bool",
- "colour":"string",
- "size":"string",
- "type": "string",
+ "colour": {
+ "type": "options",
+ "options": ["primary", "secondary"],
+ "default": "primary"
+ },
+ "size":{
+ "type": "options",
+ "options": ["small", "medium", "large"],
+ "default": "medium"
+ },
+ "type": {
+ "type": "options",
+ "options": ["text", "password"],
+ "default": "text"
+ },
"required": "bool",
"minLength": "number",
"maxLength": "number",
diff --git a/packages/materialdesign-components/package.json b/packages/materialdesign-components/package.json
index 22a172766f..02997ee31e 100644
--- a/packages/materialdesign-components/package.json
+++ b/packages/materialdesign-components/package.json
@@ -44,6 +44,7 @@
"@material/checkbox": "^4.0.0",
"@material/data-table": "4.0.0",
"@material/form-field": "^4.0.0",
+ "@material/list": "4.0.0",
"@material/radio": "^4.0.0",
"@material/textfield": "^4.0.0"
}
diff --git a/packages/materialdesign-components/src/Button/Button.svelte b/packages/materialdesign-components/src/Button/Button.svelte
index e4157ea95b..411b99c394 100644
--- a/packages/materialdesign-components/src/Button/Button.svelte
+++ b/packages/materialdesign-components/src/Button/Button.svelte
@@ -4,11 +4,11 @@
import ripple from "../Common/Ripple.js"
import ClassBuilder from "../ClassBuilder.js"
- const cb = new ClassBuilder("button", ["primary", "medium"])
+ const cb = new ClassBuilder("button", ["primary", "medium", "text"])
export let onClick = () => {}
- export let variant = "raised"
+ export let variant = "text"
export let colour = "primary"
export let size = "medium"
diff --git a/packages/materialdesign-components/src/Checkbox/Checkbox.svelte b/packages/materialdesign-components/src/Checkbox/Checkbox.svelte
index 7466e84be2..bfe861f373 100644
--- a/packages/materialdesign-components/src/Checkbox/Checkbox.svelte
+++ b/packages/materialdesign-components/src/Checkbox/Checkbox.svelte
@@ -1,41 +1,73 @@
-
+{#if context !== 'list-item'}
+
+
+
+{:else}
-
+{/if}
diff --git a/packages/materialdesign-components/src/List/List.svelte b/packages/materialdesign-components/src/List/List.svelte
new file mode 100644
index 0000000000..61e19b030c
--- /dev/null
+++ b/packages/materialdesign-components/src/List/List.svelte
@@ -0,0 +1,70 @@
+
+
+
+ {#each items as item, i}
+ handleSelectedItem(item)} />
+ {#if item.divider}
+
+ {/if}
+ {/each}
+
diff --git a/packages/materialdesign-components/src/List/ListItem.svelte b/packages/materialdesign-components/src/List/ListItem.svelte
new file mode 100644
index 0000000000..d2b72b1166
--- /dev/null
+++ b/packages/materialdesign-components/src/List/ListItem.svelte
@@ -0,0 +1,59 @@
+
+
+
+ {#if item.leadingIcon}
+
+ {item.leadingIcon}
+
+ {/if}
+
+ {#if useDoubleLine}
+ {item.text.primary}
+ {#if useSecondaryText}
+ {item.text.secondary}
+ {/if}
+ {:else}{item.text}{/if}
+
+
+ {#if inputElement}
+ {#if inputElement === 'radiobutton'}
+
+ {:else if inputElement === 'checkbox'}
+
+ {/if}
+ {:else if item.trailingIcon}
+
+
+ {item.trailingIcon}
+
+ {/if}
+
diff --git a/packages/materialdesign-components/src/List/_style.scss b/packages/materialdesign-components/src/List/_style.scss
new file mode 100644
index 0000000000..7ebce7254c
--- /dev/null
+++ b/packages/materialdesign-components/src/List/_style.scss
@@ -0,0 +1 @@
+@import "@material/list/mdc-list.scss";
diff --git a/packages/materialdesign-components/src/List/index.js b/packages/materialdesign-components/src/List/index.js
new file mode 100644
index 0000000000..1db72f9273
--- /dev/null
+++ b/packages/materialdesign-components/src/List/index.js
@@ -0,0 +1,2 @@
+import "./_style.scss";
+export { default as List } from "./List.svelte";
diff --git a/packages/materialdesign-components/src/Radiobutton/Radiobutton.svelte b/packages/materialdesign-components/src/Radiobutton/Radiobutton.svelte
index 9ebc5bb7f2..9b4c475241 100644
--- a/packages/materialdesign-components/src/Radiobutton/Radiobutton.svelte
+++ b/packages/materialdesign-components/src/Radiobutton/Radiobutton.svelte
@@ -16,22 +16,50 @@
let instance = null
let radiobtn = null
+ let context = getContext("BBMD:input:context")
+
onMount(() => {
if (!!radiobtn) {
instance = new MDCRadio(radiobtn)
- let fieldStore = getContext("BBMD:field-element")
- fieldStore.setInput(instance)
+ if (context !== "list-item") {
+ let fieldStore = getContext("BBMD:field-element")
+ fieldStore.setInput(instance)
+ }
}
})
+ let extras = null
+
+ if (context === "list-item") {
+ extras = ["mdc-list-item__meta"]
+ }
+
const cb = new ClassBuilder("radio")
let modifiers = { disabled }
- let props = { modifiers }
+ let props = { modifiers, extras }
const blockClass = cb.build({ props })
-
+{#if context !== 'list-item'}
+
+
+
+{:else}
-
+{/if}
diff --git a/packages/materialdesign-components/src/Radiobutton/RadiobuttonGroup.svelte b/packages/materialdesign-components/src/Radiobutton/RadiobuttonGroup.svelte
index 350251549f..c0b083db3c 100644
--- a/packages/materialdesign-components/src/Radiobutton/RadiobuttonGroup.svelte
+++ b/packages/materialdesign-components/src/Radiobutton/RadiobuttonGroup.svelte
@@ -37,7 +37,7 @@
{name}
{alignEnd}
label={item.label}
- checked={item.checked}
+ checked={item.checked || false}
onClick={() => handleOnClick(item)} />
{/each}
diff --git a/packages/materialdesign-components/src/Test/TestApp.svelte b/packages/materialdesign-components/src/Test/TestApp.svelte
index 229f5293e9..6fce993281 100644
--- a/packages/materialdesign-components/src/Test/TestApp.svelte
+++ b/packages/materialdesign-components/src/Test/TestApp.svelte
@@ -13,6 +13,7 @@
Radiobuttongroup,
Datatable,
CustomersIndexTable,
+ List,
} = props
let currentComponent
@@ -33,7 +34,8 @@
Radiobutton,
Radiobuttongroup,
Datatable,
- CustomersIndexTable
+ CustomersIndexTable,
+ List,
],
},
}
diff --git a/packages/materialdesign-components/src/Test/props.js b/packages/materialdesign-components/src/Test/props.js
index 43da839f65..852a845ad6 100644
--- a/packages/materialdesign-components/src/Test/props.js
+++ b/packages/materialdesign-components/src/Test/props.js
@@ -103,4 +103,23 @@ export const props = {
},
CustomersIndexTable: indexDatatable(templateOptions)[0].props,
+ List: {
+ _component: "@budibase/materialdesign-components/List",
+ _children: [],
+ variant: "two-line",
+ singleSelection: true,
+ items: [
+ {
+ text: { primary: "Curry", secondary: "Chicken or Beef" },
+ value: 0,
+ divider: true,
+ },
+ {
+ text: { primary: "Pastie", secondary: "Bap with Mayo" },
+ value: 1,
+ },
+ { text: { primary: "Fish", secondary: "Salmon or Cod" }, value: 2 },
+ ],
+ onSelect: selected => console.log(selected),
+ },
}
diff --git a/packages/materialdesign-components/src/index.js b/packages/materialdesign-components/src/index.js
index 92bdf2ca8e..88ca8190c4 100644
--- a/packages/materialdesign-components/src/index.js
+++ b/packages/materialdesign-components/src/index.js
@@ -15,3 +15,4 @@ export {
DatatableRow,
} from "./Datatable"
export { default as indexDatatable } from "./Templates/indexDatatable"
+export { List } from "./List"