1
0
Fork 0
mirror of synced 2024-07-17 04:05:57 +12:00

Update button actions to use new spectrum components

This commit is contained in:
Andrew Kingston 2021-04-19 14:40:51 +01:00
parent 575cb55402
commit 3a15047007
10 changed files with 56 additions and 47 deletions

View file

@ -1,7 +1,7 @@
<script> <script>
import { slide } from "svelte/transition" import { slide } from "svelte/transition"
import Portal from "svelte-portal" import Portal from "svelte-portal"
import ActionButton from '../ActionButton/ActionButton.svelte' import ActionButton from "../ActionButton/ActionButton.svelte"
export let title export let title
@ -84,5 +84,8 @@
} }
.text { .text {
display: flex; display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
} }
</style> </style>

View file

@ -8,17 +8,19 @@
export let error = null export let error = null
export let id = null export let id = null
let focus = false
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const onChange = event => { const onChange = event => {
dispatch("change", event.target.value) dispatch("change", event.target.value)
focus = false
} }
</script> </script>
<div <div
class="spectrum-Textfield spectrum-Textfield--multiline" class="spectrum-Textfield spectrum-Textfield--multiline"
class:is-invalid={!!error} class:is-invalid={!!error}
class:is-disabled={disabled}> class:is-disabled={disabled}
class:is-focused={focus}>
{#if error} {#if error}
<svg <svg
class="spectrum-Icon spectrum-Icon--sizeM spectrum-Textfield-validationIcon" class="spectrum-Icon spectrum-Icon--sizeM spectrum-Textfield-validationIcon"
@ -32,6 +34,7 @@
class="spectrum-Textfield-input" class="spectrum-Textfield-input"
{disabled} {disabled}
{id} {id}
on:focus={() => (focus = true)}
on:blur={onChange}>{value || ''}</textarea> on:blur={onChange}>{value || ''}</textarea>
</div> </div>

View file

@ -0,0 +1,14 @@
<script>
import "@spectrum-css/fieldlabel/dist/index-vars.css"
</script>
<label
class={`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel`}>
<slot />
</label>
<style>
label {
white-space: nowrap;
}
</style>

View file

@ -25,6 +25,7 @@
<ModalContent <ModalContent
title="Create Automation" title="Create Automation"
confirmText="Create" confirmText="Create"
size="L"
onConfirm={createAutomation} onConfirm={createAutomation}
disabled={!valid}> disabled={!valid}>
<Input bind:value={name} label="Name" /> <Input bind:value={name} label="Name" />

View file

@ -109,10 +109,8 @@
<div class="text"> <div class="text">
<TextArea <TextArea
bind:getCaretPosition bind:getCaretPosition
thin
bind:value bind:value
placeholder="Add text, or click the objects on the left to add them to placeholder="Add text, or click the objects on the left to add them to the textbox." />
the textbox." />
{#if !valid} {#if !valid}
<p class="syntax-error"> <p class="syntax-error">
Current Handlebars syntax is invalid, please check the guide Current Handlebars syntax is invalid, please check the guide
@ -145,7 +143,7 @@
font-family: var(--font-sans); font-family: var(--font-sans);
} }
.text :global(textarea) { .text :global(textarea) {
min-height: 100px; min-height: 200px;
} }
.text :global(p) { .text :global(p) {
margin: 0; margin: 0;

View file

@ -7,18 +7,17 @@
export let parameters export let parameters
$: tableOptions = $tables || [] $: tableOptions = $tables.list || []
$: bindings = getBindableProperties($currentAsset, $store.selectedComponentId) $: bindings = getBindableProperties($currentAsset, $store.selectedComponentId)
</script> </script>
<div class="root"> <div class="root">
<Label small>Table</Label> <Label>Table</Label>
<Select thin secondary bind:value={parameters.tableId}> <Select
<option value="" /> bind:value={parameters.tableId}
{#each tableOptions as table} options={tableOptions}
<option value={table._id}>{table.name}</option> getOptionLabel={table => table.name}
{/each} getOptionValue={table => table._id} />
</Select>
<Label small>Row ID</Label> <Label small>Row ID</Label>
<DrawerBindableInput <DrawerBindableInput

View file

@ -24,24 +24,22 @@
} }
</script> </script>
<Label small>Datasource</Label> <Label>Datasource</Label>
<Select thin secondary bind:value={parameters.datasourceId}> <Select
<option value="" /> bind:value={parameters.datasourceId}
{#each $datasources.list as datasource} option={$datasources.list}
<option value={datasource._id}>{datasource.name}</option> getOptionLabel={source => source.name}
{/each} getOptionValue={source => source._id} />
</Select>
<Spacer medium /> <Spacer medium />
{#if parameters.datasourceId} {#if parameters.datasourceId}
<Label small>Query</Label> <Label>Query</Label>
<Select thin secondary bind:value={parameters.queryId}> <Select
<option value="" /> bind:value={parameters.queryId}
{#each $queries.list.filter(query => query.datasourceId === datasource._id) as query} options={$queries.list.filter(query => query.datasourceId === datasource._id)}
<option value={query._id}>{query.name}</option> getOptionLabel={query => query.name}
{/each} getOptionValue={query => query._id} />
</Select>
{/if} {/if}
<Spacer medium /> <Spacer medium />

View file

@ -61,7 +61,7 @@
thin thin
secondary secondary
value={field[0]} value={field[0]}
on:change={event => updateFieldName(idx, event.target.value)} /> on:change={event => updateFieldName(idx, event.detail)} />
{/if} {/if}
<Label small>{valueLabel}</Label> <Label small>{valueLabel}</Label>
<DrawerBindableInput <DrawerBindableInput

View file

@ -75,17 +75,13 @@
{#if automationStatus === AUTOMATION_STATUS.EXISTING} {#if automationStatus === AUTOMATION_STATUS.EXISTING}
<Select <Select
thin
secondary
bind:value={parameters.automationId} bind:value={parameters.automationId}
placeholder="Choose automation"> placeholder="Choose automation"
{#each automations as automation} options={automations}
<option value={automation._id}>{automation.name}</option> getOptionLabel={x => x.name}
{/each} getOptionValue={x => x._id} />
</Select>
{:else} {:else}
<Input <Input
thin
bind:value={parameters.newAutomationName} bind:value={parameters.newAutomationName}
placeholder="Enter automation name" /> placeholder="Enter automation name" />
{/if} {/if}

View file

@ -14,21 +14,18 @@
<div class="root"> <div class="root">
<Label small>Form</Label> <Label small>Form</Label>
<Select thin secondary bind:value={parameters.componentId}> <Select
<option value="" /> bind:value={parameters.componentId}
{#if actionProviders} options={actionProviders}
{#each actionProviders as component} getOptionLabel={x => x._instanceName}
<option value={component._id}>{component._instanceName}</option> getOptionValue={x => x._id} />
{/each}
{/if}
</Select>
</div> </div>
<style> <style>
.root { .root {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: baseline; align-items: center;
max-width: 800px; max-width: 800px;
margin: 0 auto; margin: 0 auto;
} }