diff --git a/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte b/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte index 2ae31385aa..27b5e20b5b 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte +++ b/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte @@ -13,16 +13,18 @@ import Palette from "./Palette.svelte" import ButtonGroup from "./ButtonGroup.svelte" import Input from "./Input.svelte" + import Portal from "./Portal.svelte" export let value = "#3ec1d3ff" + export let open = false; export let swatches = [] //TODO: Safe swatches - limit to 12. warn in console export let disableSwatches = false export let format = "hexa" - export let open = false - + export let style = "" export let pickerHeight = 0 export let pickerWidth = 0 + let colorPicker = null let adder = null let h = null @@ -38,6 +40,10 @@ getRecentColors() } + if(colorPicker) { + colorPicker.focus() + } + if (format) { convertAndSetHSVA() } @@ -50,6 +56,12 @@ } } + function handleEscape(e) { + if(open && e.key === "Escape") { + open = false + } + } + function setRecentColor(color) { if (swatches.length === 12) { swatches.splice(0, 1) @@ -145,85 +157,97 @@ } $: border = v > 90 && s < 5 ? "1px dashed #dedada" : "" - $: style = buildStyle({ background: value, border }) + $: selectedColorStyle = buildStyle({ background: value, border }) $: shrink = swatches.length > 0 + -