[6.x] Button single variant - #19306
Conversation
Replace the two-axis (variant + appearance) button API with one `variant` property: primary, danger, solid, fill (default), outline, dashed, plain, link, none. `primary`/`danger` are the colored, stable variants; the rest use the neutral palette. Add a boolean `inherit` property (orthogonal to variant) so neutral variants adopt the ambient colorable palette in a [data-color]/callout context, while primary/danger keep their own colors. Rewrites button.styles.ts around the single axis, and updates the stories and docs (combined the variant/appearance stories, added an Inherit demo). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adapt the package to the collapsed button API: - index.ts stops re-exporting the removed ButtonAppearance. - variants.styles.ts swaps the [variant='default'] block for [variant='accent'] and [variant='neutral'] (used by callout/indicator/action-item). - The tokens "Button Matrix" story and FilterHud now use the single variant axis (e.g. ButtonVariant.Fill / ButtonVariant.Primary). Note: the broader app consumer migration (variant/appearance usages across resources/js) is still pending and tracked separately. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
constants/colors.ts and scripts/generate-colors.js each hard-coded the color palette and semantic map, and had drifted (info: blue vs sky, warning: orange vs yellow; accent: red vs blue). Introduce constants/colors.data.ts as the single source of truth. colors.ts builds its Color map + ColorValue/ColorKey from it; generate-colors.js loads it via esbuild (it can't import TS directly). Regenerate colorable.css — the token output is unchanged except accent is corrected from a stale red to blue. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📚 Storybook previews@craftcms/ui — open Storybook Changed components:
resources/js — open Storybook No changed components detected in this Storybook. |
|
@copilot resolve the merge conflicts in this pull request |
…variant # Conflicts: # packages/craftcms-ui/src/components/button/button.ts # resources/js/common/form/InputCombobox.vue Co-authored-by: brianjhanson <1843073+brianjhanson@users.noreply.github.com>
Resolved. Two conflicts were present:
|
…ms into feature/button-single-variant
…ms into feature/button-single-variant
[ci skip]
Previously buttons has two customization axis. You could specify either a
variant(accent,neutralordanger) and anappearance(solid,outline,fill,plain) to determine what your button looked like.After revisiting (and looking at plugin kit, I feel like that's a bit overkill. This flattens
appearanceandvariantinto a singlevariantproperty which can be one of:primary,danger,danger-plain,solid,fill,outline,dashed,plain,linkornone.danger-plainis the only one that bugs me a bit, but I think that wart is better than having the ability to create buttons that may only appear once in the UI.This also refactors the
appearance=inheritproperty on buttons that will allow a button to take on the color of its colorable parent. That behavior is now created by specifying a singleinheritvalue on the button.In this mode
primaryanddangerbuttons retain their normal fill, but other buttons will try to blend in.