fix(button): export hasIconOnly prop

Closes #174
This commit is contained in:
Eric Liu 2020-05-07 18:37:52 -07:00
commit 89ec5fbf41
4 changed files with 9 additions and 2 deletions

3
.gitignore vendored
View file

@ -4,4 +4,5 @@
.DS_Store .DS_Store
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
*.tgz *.tgz
.vscode

View file

@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Selectable/expandable `DataTable` - Selectable/expandable `DataTable`
## [0.6.0](https://github.com/IBM/carbon-components-svelte/releases/tag/v0.6.0) - 2020-05-07
- Fix button with icon bug by manually setting `hasIconOnly` in `Button`. This results in a breaking change for icon-only buttons, which now must include `hasIconOnly`
([Issue #174](https://github.com/IBM/carbon-components-svelte/issues/174))
## [0.5.1](https://github.com/IBM/carbon-components-svelte/releases/tag/v0.5.1) - 2020-05-03 ## [0.5.1](https://github.com/IBM/carbon-components-svelte/releases/tag/v0.5.1) - 2020-05-03
- Fix focus/dispatch bug in `Modal`, `ComposedModal` - Fix focus/dispatch bug in `Modal`, `ComposedModal`

View file

@ -26,6 +26,7 @@
}; };
const iconOnlyProps = { const iconOnlyProps = {
hasIconOnly: true,
kind, kind,
disabled, disabled,
size, size,

View file

@ -6,6 +6,7 @@
export let href = undefined; export let href = undefined;
export let icon = undefined; export let icon = undefined;
export let iconDescription = undefined; export let iconDescription = undefined;
export let hasIconOnly = false;
export let kind = 'primary'; export let kind = 'primary';
export let size = 'default'; export let size = 'default';
export let style = undefined; export let style = undefined;
@ -24,7 +25,6 @@
$: if (ctx && buttonRef) { $: if (ctx && buttonRef) {
ctx.declareRef(buttonRef); ctx.declareRef(buttonRef);
} }
$: hasIconOnly = !!icon && !$$props.$$slots;
$: buttonProps = { $: buttonProps = {
role: 'button', role: 'button',
type: href && !disabled ? undefined : type, type: href && !disabled ? undefined : type,