Add quiet reverse button variant for collapsed button groups in grids

This commit is contained in:
Andrew Kingston 2024-09-06 09:20:00 +01:00
parent 7121a0f157
commit 61b82b8817
No known key found for this signature in database
3 changed files with 20 additions and 6 deletions

View File

@ -18,6 +18,7 @@
export let newStyles = true export let newStyles = true
export let id export let id
export let ref export let ref
export let reverse = false
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
</script> </script>
@ -43,6 +44,9 @@
} }
}} }}
> >
{#if $$slots && reverse}
<span class="spectrum-Button-label"><slot /></span>
{/if}
{#if icon} {#if icon}
<svg <svg
class="spectrum-Icon spectrum-Icon--size{size.toUpperCase()}" class="spectrum-Icon spectrum-Icon--size{size.toUpperCase()}"
@ -53,7 +57,7 @@
<use xlink:href="#spectrum-icon-18-{icon}" /> <use xlink:href="#spectrum-icon-18-{icon}" />
</svg> </svg>
{/if} {/if}
{#if $$slots} {#if $$slots && !reverse}
<span class="spectrum-Button-label"><slot /></span> <span class="spectrum-Button-label"><slot /></span>
{/if} {/if}
</button> </button>
@ -93,4 +97,11 @@
.spectrum-Button--secondary.new-styles.is-disabled { .spectrum-Button--secondary.new-styles.is-disabled {
color: var(--spectrum-global-color-gray-500); color: var(--spectrum-global-color-gray-500);
} }
.spectrum-Button .spectrum-Button-label + .spectrum-Icon {
margin-left: var(--spectrum-button-primary-icon-gap);
margin-right: calc(
-1 * (var(--spectrum-button-primary-textonly-padding-left-adjusted) -
var(--spectrum-button-primary-padding-left-adjusted))
);
}
</style> </style>

View File

@ -10,7 +10,7 @@
export let align = "left" export let align = "left"
export let offset export let offset
export let animate export let animate
export let secondary = false export let quiet = false
let anchor let anchor
let popover let popover
@ -25,10 +25,13 @@
bind:ref={anchor} bind:ref={anchor}
{size} {size}
icon="ChevronDown" icon="ChevronDown"
cta={!secondary} {quiet}
{secondary} primary={quiet}
cta={!quiet}
newStyles={!quiet}
on:click={() => popover?.show()} on:click={() => popover?.show()}
on:click on:click
reverse
> >
{text || "Action"} {text || "Action"}
</Button> </Button>

View File

@ -1,6 +1,6 @@
<script> <script>
import { getContext, onMount } from "svelte" import { getContext, onMount } from "svelte"
import { Button, CollapsedButtonGroup } from "@budibase/bbui" import { Button, CollapsedButtonGroup, Select } from "@budibase/bbui"
import GridCell from "../cells/GridCell.svelte" import GridCell from "../cells/GridCell.svelte"
import GridScrollWrapper from "./GridScrollWrapper.svelte" import GridScrollWrapper from "./GridScrollWrapper.svelte"
import { BlankRowID } from "../lib/constants" import { BlankRowID } from "../lib/constants"
@ -98,7 +98,7 @@
align="right" align="right"
offset={5} offset={5}
size="S" size="S"
secondary quiet
animate={false} animate={false}
on:mouseenter={() => ($hoveredRowId = row._id)} on:mouseenter={() => ($hoveredRowId = row._id)}
/> />