Add section setting to field group (#11110)
* Add section setting to field group * Left aligned fix for oneColumn only * Only use section for above label position
This commit is contained in:
parent
a9c5e5e58f
commit
74b3b3dcc3
|
@ -17,6 +17,10 @@
|
||||||
name: "Sidebar with Main",
|
name: "Sidebar with Main",
|
||||||
icon: "ColumnTwoC",
|
icon: "ColumnTwoC",
|
||||||
},
|
},
|
||||||
|
oneColumn: {
|
||||||
|
name: "One column",
|
||||||
|
icon: "LoupeView",
|
||||||
|
},
|
||||||
twoColumns: {
|
twoColumns: {
|
||||||
name: "Two columns",
|
name: "Two columns",
|
||||||
icon: "ColumnTwoA",
|
icon: "ColumnTwoA",
|
||||||
|
|
|
@ -2350,6 +2350,16 @@
|
||||||
"value": "above"
|
"value": "above"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "section",
|
||||||
|
"label": "Type",
|
||||||
|
"key": "type",
|
||||||
|
"defaultValue": "oneColumn",
|
||||||
|
"dependsOn": {
|
||||||
|
"setting": "labelPosition",
|
||||||
|
"value": "above"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
let layoutMap = {
|
let layoutMap = {
|
||||||
mainSidebar: 2,
|
mainSidebar: 2,
|
||||||
sidebarMain: 2,
|
sidebarMain: 2,
|
||||||
|
oneColumn: 1,
|
||||||
twoColumns: 2,
|
twoColumns: 2,
|
||||||
threeColumns: 3,
|
threeColumns: 3,
|
||||||
}
|
}
|
||||||
|
@ -54,6 +55,9 @@
|
||||||
.sidebarMain {
|
.sidebarMain {
|
||||||
grid-template-columns: 1fr 3fr;
|
grid-template-columns: 1fr 3fr;
|
||||||
}
|
}
|
||||||
|
.oneColumn {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
.twoColumns {
|
.twoColumns {
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<script>
|
<script>
|
||||||
import { getContext, setContext } from "svelte"
|
import { getContext, setContext } from "svelte"
|
||||||
|
import Section from "../Section.svelte"
|
||||||
|
|
||||||
export let labelPosition = "above"
|
export let labelPosition = "above"
|
||||||
|
export let type = "oneColumn"
|
||||||
|
|
||||||
const { styleable } = getContext("sdk")
|
const { styleable } = getContext("sdk")
|
||||||
const component = getContext("component")
|
const component = getContext("component")
|
||||||
|
@ -13,7 +15,13 @@
|
||||||
class="spectrum-Form"
|
class="spectrum-Form"
|
||||||
class:spectrum-Form--labelsAbove={labelPosition === "above"}
|
class:spectrum-Form--labelsAbove={labelPosition === "above"}
|
||||||
>
|
>
|
||||||
|
{#if labelPosition === "above" && type !== "oneColumn"}
|
||||||
|
<Section {type}>
|
||||||
<slot />
|
<slot />
|
||||||
|
</Section>
|
||||||
|
{:else}
|
||||||
|
<slot />
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue