From b5ee768cb1f304d4bb5b9700388788288c46fd51 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 29 Apr 2021 15:24:59 +0100 Subject: [PATCH] Fix combobox disabled state and remove unnecessary props --- packages/bbui/src/Form/Checkbox.svelte | 2 +- packages/bbui/src/Form/Combobox.svelte | 4 ++-- packages/bbui/src/Form/Core/Combobox.svelte | 21 ++++++++++++++++----- packages/bbui/src/Form/DatePicker.svelte | 2 +- packages/bbui/src/Form/Dropzone.svelte | 2 +- packages/bbui/src/Form/Field.svelte | 1 - packages/bbui/src/Form/Input.svelte | 2 +- packages/bbui/src/Form/Multiselect.svelte | 2 +- packages/bbui/src/Form/RadioGroup.svelte | 2 +- packages/bbui/src/Form/Search.svelte | 2 +- packages/bbui/src/Form/Select.svelte | 2 +- packages/bbui/src/Form/TextArea.svelte | 2 +- packages/bbui/src/Form/Toggle.svelte | 2 +- 13 files changed, 28 insertions(+), 18 deletions(-) diff --git a/packages/bbui/src/Form/Checkbox.svelte b/packages/bbui/src/Form/Checkbox.svelte index 1f3e439c2a..90a2cddda5 100644 --- a/packages/bbui/src/Form/Checkbox.svelte +++ b/packages/bbui/src/Form/Checkbox.svelte @@ -17,6 +17,6 @@ } - + diff --git a/packages/bbui/src/Form/Combobox.svelte b/packages/bbui/src/Form/Combobox.svelte index 6b1e67a299..380465792b 100644 --- a/packages/bbui/src/Form/Combobox.svelte +++ b/packages/bbui/src/Form/Combobox.svelte @@ -8,7 +8,7 @@ export let disabled = false export let labelPosition = "above" export let error = null - export let placeholder = "Choose an option" + export let placeholder = "Choose an option or type" export let options = [] export let getOptionLabel = option => extractProperty(option, "label") export let getOptionValue = option => extractProperty(option, "value") @@ -26,7 +26,7 @@ } - + { // Always use placeholder if no value if (value == null || value === "") { - return placeholder || "Choose an option" + return placeholder || "Choose an option or type" } // Wait for options to load if there is a value but no options @@ -43,12 +43,19 @@ const onChange = e => { selectOption(e.target.value) } + + $: console.log(disabled) -
+
(focus = false)} on:change={onChange} {value} + {disabled} {placeholder} class="spectrum-Textfield-input spectrum-InputGroup-input" />
@@ -63,7 +71,7 @@ class="spectrum-Picker spectrum-Picker--sizeM spectrum-InputGroup-button" tabindex="-1" aria-haspopup="true" - disabled={!!error} + {disabled} on:click={() => (open = true)}> - + - + diff --git a/packages/bbui/src/Form/Input.svelte b/packages/bbui/src/Form/Input.svelte index e4a155d342..5059eb2543 100644 --- a/packages/bbui/src/Form/Input.svelte +++ b/packages/bbui/src/Form/Input.svelte @@ -19,7 +19,7 @@ } - + - + - + - + - +