feat(file-uploader): add size prop to FileUploaderButton (#1786)

This commit is contained in:
Eric Liu 2023-07-24 06:33:53 -07:00 committed by GitHub
commit 51c281de4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 70 additions and 5 deletions

View file

@ -55,6 +55,12 @@
*/
export let kind = "primary";
/**
* Specify the size of the file uploader button
* @type {import("../Button/Button.svelte").ButtonProps["size"]}
*/
export let size = "small";
/** Specify the button label */
export let buttonLabel = "";
@ -137,6 +143,7 @@
name="{name}"
multiple="{multiple}"
kind="{kind}"
size="{size}"
on:change
on:change="{(e) => {
files = e.detail;

View file

@ -30,6 +30,12 @@
*/
export let kind = "primary";
/**
* Specify the size of the file uploader button
* @type {import("../Button/Button.svelte").ButtonProps["size"]}
*/
export let size = "small";
/** Specify the label text */
export let labelText = "Add file";
@ -67,7 +73,6 @@
for="{id}"
tabindex="{disabled ? '-1' : tabindex}"
class:bx--btn="{true}"
class:bx--btn--sm="{true}"
class:bx--btn--disabled="{disabled}"
class:bx--btn--primary="{kind === 'primary'}"
class:bx--btn--secondary="{kind === 'secondary'}"
@ -76,6 +81,10 @@
class:bx--btn--danger="{kind === 'danger'}"
class:bx--btn--danger-tertiary="{kind === 'danger-tertiary'}"
class:bx--btn--danger-ghost="{kind === 'danger-ghost'}"
class:bx--btn--sm="{size === 'small'}"
class:bx--btn--field="{size === 'field'}"
class:bx--btn--lg="{size === 'lg'}"
class:bx--btn--xl="{size === 'xl'}"
on:keydown
on:keydown="{({ key }) => {
if (key === ' ' || key === 'Enter') {