diff --git a/packages/bbui/src/ColorPicker/ColorPicker.svelte b/packages/bbui/src/ColorPicker/ColorPicker.svelte index aeba2eae76..f11718badc 100644 --- a/packages/bbui/src/ColorPicker/ColorPicker.svelte +++ b/packages/bbui/src/ColorPicker/ColorPicker.svelte @@ -8,6 +8,7 @@ import { capitalise } from "../utils/helpers" export let value + export let size = "M" let open = false @@ -110,7 +111,7 @@
(open = true)} /> @@ -178,6 +179,18 @@ cursor: pointer; box-shadow: 0 0 2px 2px var(--spectrum-global-color-gray-300); } + .size--S { + width: 20px; + height: 20px; + } + .size--M { + width: 32px; + height: 32px; + } + .size--L { + width: 48px; + height: 48px; + } .spectrum-Popover { width: 210px; z-index: 999; diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index fe49b19aa7..5ca413409c 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -20,6 +20,7 @@ export let open = false export let readonly = false export let quiet = false + export let autoWidth = false const dispatch = createEventDispatcher() const onClick = () => { @@ -41,7 +42,11 @@ aria-haspopup="listbox" on:mousedown={onClick} > - + {fieldText} {#if error} @@ -67,11 +72,12 @@ use:clickOutside={() => (open = false)} transition:fly={{ y: -20, duration: 200 }} class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open" + class:auto-width={autoWidth} >
    {#if placeholderOption}
  • .spectrum-Popover { max-height: 240px; - width: 100%; z-index: 999; top: 100%; } + .spectrum-Popover:not(.auto-width) { + width: 100%; + } + .spectrum-Popover.auto-width :global(.spectrum-Menu-itemLabel) { + white-space: nowrap; + } .spectrum-Picker { width: 100%; } - .spectrum-Picker-label { + .spectrum-Picker-label:not(.auto-width) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 0; } + .placeholder { + font-style: italic; + } + .spectrum-Picker-label.auto-width.is-placeholder { + padding-right: 2px; + } diff --git a/packages/bbui/src/Form/Core/Select.svelte b/packages/bbui/src/Form/Core/Select.svelte index f449b576e5..93e59e2420 100644 --- a/packages/bbui/src/Form/Core/Select.svelte +++ b/packages/bbui/src/Form/Core/Select.svelte @@ -12,6 +12,7 @@ export let getOptionValue = option => option export let readonly = false export let quiet = false + export let autoWidth = false const dispatch = createEventDispatcher() let open = false @@ -51,6 +52,7 @@ {readonly} {fieldText} {options} + {autoWidth} {getOptionLabel} {getOptionValue} isPlaceholder={value == null || value === ""} diff --git a/packages/bbui/src/Form/Select.svelte b/packages/bbui/src/Form/Select.svelte index 4a6955a97c..808c4c2789 100644 --- a/packages/bbui/src/Form/Select.svelte +++ b/packages/bbui/src/Form/Select.svelte @@ -14,6 +14,7 @@ export let getOptionLabel = option => extractProperty(option, "label") export let getOptionValue = option => extractProperty(option, "value") export let quiet = false + export let autoWidth = false const dispatch = createEventDispatcher() const onChange = e => { @@ -37,6 +38,7 @@ {value} {options} {placeholder} + {autoWidth} {getOptionLabel} {getOptionValue} on:change={onChange} diff --git a/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte b/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte index c624927007..5ae4ac0ddf 100644 --- a/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte +++ b/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte @@ -4,10 +4,13 @@ import iframeTemplate from "./iframeTemplate" import { Screen } from "builderStore/store/screenTemplates/utils/Screen" import { FrontendTypes } from "constants" + import ConfirmDialog from "components/common/ConfirmDialog.svelte" let iframe let layout let screen + let confirmDeleteDialog + let idToDelete // Create screen slot placeholder for use when a page is selected rather // than a screen @@ -73,15 +76,26 @@ // Add listener for events sent by cliebt library in preview iframe.contentWindow.addEventListener("bb-event", event => { const { type, data } = event.detail - if (type === "select-component") { + if (type === "select-component" && data.id) { store.actions.components.select({ _id: data.id }) } else if (type === "update-prop") { store.actions.components.updateProp(data.prop, data.value) + } else if (type === "delete-component" && data.id) { + idToDelete = data.id + confirmDeleteDialog.show() } else { console.log(data) } }) }) + + const deleteComponent = () => { + store.actions.components.delete({ _id: idToDelete }) + idToDelete = null + } + const cancelDeleteComponent = () => { + idToDelete = null + }
    @@ -92,6 +106,14 @@ srcdoc={template} />
    + diff --git a/packages/client/src/components/preview/SettingsPicker.svelte b/packages/client/src/components/preview/SettingsPicker.svelte new file mode 100644 index 0000000000..eb678eda26 --- /dev/null +++ b/packages/client/src/components/preview/SettingsPicker.svelte @@ -0,0 +1,31 @@ + + +
    +