From 431abb53ceb3e05992252adc2898690e8f03a884 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 16 Apr 2021 14:30:33 +0100 Subject: [PATCH] Add radio group spectrum component and update builder --- packages/bbui/package.json | 1 + packages/bbui/src/Form/Checkbox.svench.svx | 67 ------- packages/bbui/src/Form/Core/Checkbox.svelte | 4 +- .../bbui/src/Form/Core/Multiselect.svelte | 4 +- packages/bbui/src/Form/Core/Picker.svelte | 4 +- packages/bbui/src/Form/Core/RadioGroup.svelte | 36 ++++ packages/bbui/src/Form/Core/Select.svelte | 4 +- packages/bbui/src/Form/Core/TextField.svelte | 2 +- packages/bbui/src/Form/Core/index.js | 1 + packages/bbui/src/Form/DataList.svench | 57 ------ packages/bbui/src/Form/Input.svench | 62 ------- packages/bbui/src/Form/Multiselect.svench | 63 ------- packages/bbui/src/Form/Radio.svelte | 140 -------------- packages/bbui/src/Form/Radio.svench.svx | 64 ------- packages/bbui/src/Form/RadioGroup.svelte | 37 ++++ packages/bbui/src/Form/RichText.svench.svx | 40 ---- packages/bbui/src/Form/Select.svench | 62 ------- packages/bbui/src/Form/Slider.svench | 26 --- packages/bbui/src/Form/TextArea.svench | 30 --- packages/bbui/src/Form/Toggle.svench | 21 --- packages/bbui/src/index.js | 3 +- packages/bbui/yarn.lock | 5 + .../DataTable/TableHeader/TableHeader.svelte | 171 ------------------ .../backend/DataTable/TableHeader/index.js | 35 ---- .../TableLoadingOverlay/LoadingOverlay.svelte | 27 --- .../DataTable/TableLoadingOverlay/index.js | 17 -- .../DataTable/modals/CreateEditColumn.svelte | 36 ++-- .../src/forms/BooleanField.svelte | 2 +- .../src/forms/OptionsField.svelte | 2 +- .../src/forms/Picker.svelte | 110 ----------- .../src/forms/RelationshipField.svelte | 2 +- 31 files changed, 109 insertions(+), 1026 deletions(-) delete mode 100644 packages/bbui/src/Form/Checkbox.svench.svx create mode 100644 packages/bbui/src/Form/Core/RadioGroup.svelte delete mode 100644 packages/bbui/src/Form/DataList.svench delete mode 100644 packages/bbui/src/Form/Input.svench delete mode 100644 packages/bbui/src/Form/Multiselect.svench delete mode 100644 packages/bbui/src/Form/Radio.svelte delete mode 100644 packages/bbui/src/Form/Radio.svench.svx create mode 100644 packages/bbui/src/Form/RadioGroup.svelte delete mode 100644 packages/bbui/src/Form/RichText.svench.svx delete mode 100644 packages/bbui/src/Form/Select.svench delete mode 100644 packages/bbui/src/Form/Slider.svench delete mode 100644 packages/bbui/src/Form/TextArea.svench delete mode 100644 packages/bbui/src/Form/Toggle.svench delete mode 100644 packages/builder/src/components/backend/DataTable/TableHeader/TableHeader.svelte delete mode 100644 packages/builder/src/components/backend/DataTable/TableHeader/index.js delete mode 100644 packages/builder/src/components/backend/DataTable/TableLoadingOverlay/LoadingOverlay.svelte delete mode 100644 packages/builder/src/components/backend/DataTable/TableLoadingOverlay/index.js delete mode 100644 packages/standard-components/src/forms/Picker.svelte diff --git a/packages/bbui/package.json b/packages/bbui/package.json index d7fe9d9f26..ed9bba0d35 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -53,6 +53,7 @@ "@spectrum-css/popover": "^3.0.1", "@spectrum-css/progressbar": "^1.0.2", "@spectrum-css/progresscircle": "^1.0.2", + "@spectrum-css/radio": "^3.0.2", "@spectrum-css/table": "^3.0.1", "@spectrum-css/tabs": "^3.0.1", "@spectrum-css/textfield": "^3.0.1", diff --git a/packages/bbui/src/Form/Checkbox.svench.svx b/packages/bbui/src/Form/Checkbox.svench.svx deleted file mode 100644 index b3246ec9d2..0000000000 --- a/packages/bbui/src/Form/Checkbox.svench.svx +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - -## Multiple checkboxes -Use an array and an each block to use multiple checkboxes -```svelte - - -{#each menu as {text, checked}} - - - -{/each} -``` - - -
- {#each menu as {text, checked}} - - - - {/each} -
-
- - \ No newline at end of file diff --git a/packages/bbui/src/Form/Core/Checkbox.svelte b/packages/bbui/src/Form/Core/Checkbox.svelte index 21a79cf0c7..bc9b9a9fc7 100644 --- a/packages/bbui/src/Form/Core/Checkbox.svelte +++ b/packages/bbui/src/Form/Core/Checkbox.svelte @@ -5,7 +5,7 @@ export let value = false export let error = null - export let fieldId = null + export let id = null export let text = null export let disabled = false @@ -24,7 +24,7 @@ on:change={onChange} type="checkbox" class="spectrum-Checkbox-input" - id={fieldId} /> + {id} />
+ {#if options && Array.isArray(options)} + {#each options as option} +
+ + + +
+ {/each} + {/if} +
diff --git a/packages/bbui/src/Form/Core/Select.svelte b/packages/bbui/src/Form/Core/Select.svelte index 15640d93bf..24e8629e44 100644 --- a/packages/bbui/src/Form/Core/Select.svelte +++ b/packages/bbui/src/Form/Core/Select.svelte @@ -3,7 +3,7 @@ import Picker from "./Picker.svelte" export let value = null - export let fieldId = null + export let id = null export let placeholder = "Choose an option" export let disabled = false export let error = null @@ -39,7 +39,7 @@ - import { View } from "svench"; - import Select from "./Select.svelte"; - import DataList from "./DataList.svelte"; - import Spacer from "../Spacer/Spacer.svelte" - - const options = ["Chocolate", "Vanilla", "Strawberry Cheesecake"]; - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - diff --git a/packages/bbui/src/Form/Input.svench b/packages/bbui/src/Form/Input.svench deleted file mode 100644 index 1b95727a1a..0000000000 --- a/packages/bbui/src/Form/Input.svench +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/bbui/src/Form/Multiselect.svench b/packages/bbui/src/Form/Multiselect.svench deleted file mode 100644 index 86ad0de529..0000000000 --- a/packages/bbui/src/Form/Multiselect.svench +++ /dev/null @@ -1,63 +0,0 @@ - - - - - {#each options as option} - - {/each} - - - - -
- - {#each options as option} - - {/each} - -
-
- - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - diff --git a/packages/bbui/src/Form/Radio.svelte b/packages/bbui/src/Form/Radio.svelte deleted file mode 100644 index b4a2637803..0000000000 --- a/packages/bbui/src/Form/Radio.svelte +++ /dev/null @@ -1,140 +0,0 @@ - - -
- -
-
-
-
-
- -
- - diff --git a/packages/bbui/src/Form/Radio.svench.svx b/packages/bbui/src/Form/Radio.svench.svx deleted file mode 100644 index 20d3c58c99..0000000000 --- a/packages/bbui/src/Form/Radio.svench.svx +++ /dev/null @@ -1,64 +0,0 @@ - - - ## Multiple checkboxes - Use an array and an each block to use the radio button. -```svelte - - -{#each menu as flavour} - -{/each} -``` - - - -
- {#each menu as flavour} - - - - {/each} -
-
- - -
- {#each menu as flavour} - - - - {/each} -
-
- - \ No newline at end of file diff --git a/packages/bbui/src/Form/RadioGroup.svelte b/packages/bbui/src/Form/RadioGroup.svelte new file mode 100644 index 0000000000..227555c802 --- /dev/null +++ b/packages/bbui/src/Form/RadioGroup.svelte @@ -0,0 +1,37 @@ + + + + + diff --git a/packages/bbui/src/Form/RichText.svench.svx b/packages/bbui/src/Form/RichText.svench.svx deleted file mode 100644 index 0a0a858866..0000000000 --- a/packages/bbui/src/Form/RichText.svench.svx +++ /dev/null @@ -1,40 +0,0 @@ - - -### Rich Text Component - -This component uses the QuillJS library to add Rich Text editing functionality. - -It exposes a content variable that you can bind to in order to get Markdown out of the component. - -As well as the content you can also pass in an option object that looks like so: - -```js -let options = { - modules: { - toolbar: [ - [{ header: [1, 2, 3, false] }], - ['bold', 'italic', 'underline', 'strike'] - ] - }, - placeholder: 'Type something...', - theme: 'snow' -} -``` - - - - - - - - - - - - diff --git a/packages/bbui/src/Form/Select.svench b/packages/bbui/src/Form/Select.svench deleted file mode 100644 index 750d7224ca..0000000000 --- a/packages/bbui/src/Form/Select.svench +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/bbui/src/Form/Slider.svench b/packages/bbui/src/Form/Slider.svench deleted file mode 100644 index 7ed59f78b8..0000000000 --- a/packages/bbui/src/Form/Slider.svench +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/bbui/src/Form/TextArea.svench b/packages/bbui/src/Form/TextArea.svench deleted file mode 100644 index 549d365b83..0000000000 --- a/packages/bbui/src/Form/TextArea.svench +++ /dev/null @@ -1,30 +0,0 @@ - - - -