From 516d163ea2f6683f7dc629e2e1f5f3c18f615313 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 10 May 2022 13:16:21 +0100 Subject: [PATCH 1/4] Close picker on click of listbox --- packages/bbui/src/Form/Core/Picker.svelte | 187 +++++++++++----------- 1 file changed, 94 insertions(+), 93 deletions(-) diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index 143536a60a..2585f11939 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -43,7 +43,7 @@ return } searchTerm = null - open = true + open = !open } const getSortedOptions = (options, getLabel, sort) => { @@ -71,105 +71,73 @@ } - -{#if open} -
(open = false)} - transition:fly|local={{ y: -20, duration: 200 }} - class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open" - class:auto-width={autoWidth} - > - {#if autocomplete} - (searchTerm = event.detail)} - {disabled} - placeholder="Search" - /> - {/if} -
    - {#if placeholderOption} -
  • onSelectOption(null)} - > - {placeholderOption} - -
  • + + {#if open} +
    + {#if autocomplete} + (searchTerm = event.detail)} + {disabled} + placeholder="Search" + /> {/if} - {#if filteredOptions.length} - {#each filteredOptions as option, idx} +
      + {#if placeholderOption}
    • onSelectOption(getOptionValue(option, idx))} + on:click={() => onSelectOption(null)} > - {#if getOptionIcon(option, idx)} - - icon - - {/if} - - {getOptionLabel(option, idx)} - + {placeholderOption}
    • - {/each} - {/if} -
    -
    -{/if} + {/if} + {#if filteredOptions.length} + {#each filteredOptions as option, idx} +
  • onSelectOption(getOptionValue(option, idx))} + > + {#if getOptionIcon(option, idx)} + + icon + + {/if} + + {getOptionLabel(option, idx)} + + +
  • + {/each} + {/if} +
+
+ {/if} + diff --git a/packages/bbui/src/Form/Core/index.js b/packages/bbui/src/Form/Core/index.js index 3c3f9acb4d..96d81855e4 100644 --- a/packages/bbui/src/Form/Core/index.js +++ b/packages/bbui/src/Form/Core/index.js @@ -3,6 +3,7 @@ export { default as CoreSelect } from "./Select.svelte" export { default as CoreMultiselect } from "./Multiselect.svelte" export { default as CoreCheckbox } from "./Checkbox.svelte" export { default as CoreRadioGroup } from "./RadioGroup.svelte" +export { default as CoreCheckboxGroup } from "./CheckboxGroup.svelte" export { default as CoreTextArea } from "./TextArea.svelte" export { default as CoreCombobox } from "./Combobox.svelte" export { default as CoreSwitch } from "./Switch.svelte" diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 4190d7f076..db62d2cb6e 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -2346,6 +2346,43 @@ "key": "disabled", "defaultValue": false }, + { + "type": "select", + "label": "Type", + "key": "optionsType", + "defaultValue": "select", + "placeholder": "Pick an options type", + "options": [ + { + "label": "Select", + "value": "select" + }, + { + "label": "Checkbox buttons", + "value": "checkbox" + } + ] + }, + { + "type": "select", + "label": "Direction", + "key": "direction", + "defaultValue": "vertical", + "options": [ + { + "label": "Horizontal", + "value": "horizontal" + }, + { + "label": "Vertical", + "value": "vertical" + } + ], + "dependsOn": { + "setting": "optionsType", + "value": "checkbox" + } + }, { "type": "select", "label": "Options source", diff --git a/packages/client/src/components/app/forms/MultiFieldSelect.svelte b/packages/client/src/components/app/forms/MultiFieldSelect.svelte index 6bc0970051..55bca89c23 100644 --- a/packages/client/src/components/app/forms/MultiFieldSelect.svelte +++ b/packages/client/src/components/app/forms/MultiFieldSelect.svelte @@ -1,5 +1,5 @@