fix: button variant#224
Open
dumbdevss wants to merge 1 commit into
Open
Conversation
|
@dumbdevss Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Collaborator
|
Please resolve conflicts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
closes #181
Improves the
Buttoncomponent with three additions:icon slot while
childrenstay in place, so short labels (e.g. "Send") nolonger shift or disappear when
loadingis set.iconOnlyprop — renders a square button (equal height/width, nohorizontal padding) sized per
size(sm/md/lg), so icon-only buttonsget the same focus ring and hover states as the rest of the component instead
of relying on raw
<button>elements with ad-hoc classes. While loading, thespinner replaces the icon entirely.
requireConfirm+confirmLabelprops — opt-in two-click confirmationfor dangerous actions. The first click arms the button and swaps the label to
confirmLabel(default "Are you sure?"); the second click firesonClick.The prompt auto-resets on blur. Pairs naturally with
variant="destructive".All three props are optional and default to prior behavior, so existing usages
are unaffected.
Related Issues
Closes #181
Type of Change
not done
Bug fix (non-breaking change which fixes an issue)
done
New feature (non-breaking change which adds functionality)
not done
Breaking change (fix or feature that would cause existing functionality to change)
not done
Documentation update
Testing
Describe how you tested your changes:
done
Component renders correctly
done
Tests added or updated for this change
done
No console errors or warnings
not done
Lint passes (npm run lint)
done
Build succeeds (npm run build)
done
Manual testing completed
Added five tests covering: label-visible-while-loading, square icon-only sizing,
spinner-replaces-icon for iconOnly loading, the two-click confirm flow, and
blur reset. Also fixed two pre-existing assertions that matched the accessible
name exactly ("Submit") where the spinner's sr-only "Loading" text makes the
name "Loading Submit" — switched to a /Submit/ matcher.
tsc --noEmit — passes
npm run build — passes
Button test suite — 17/17 passing
Note: npm run lint was not run for this PR (left unchecked above).
Checklist
done
My code follows the style guidelines of this project
done
I have performed a self-review of my own code
done
I have commented my code, particularly in hard-to-understand areas
not done
I have made corresponding changes to the documentation
done
My changes generate no new warnings