Align fieldset to architecture goals#192
Open
lifeiscontent wants to merge 3 commits into
Open
Conversation
|
📚 Storybook preview: https://pr-192-propel-storybook.vamsi-906.workers.dev |
Add `bordered` variant to `fieldsetVariants` (required, no default) for the
border-visibility axis the designer flagged as adjustable. Add a
`FieldsetDescription` ui part with its own cva variant — description text is
also listed as adjustable and the ui tier had no part for it. Wire both into
the components-tier `Fieldset` convenience component and update all stories.
Fix `CheckboxGroupField` and `RadioGroupField` (the two callers that render
the ui-tier `Fieldset` directly) to pass `bordered={false}`.
Closes #129
The fieldset alignment PR made `bordered` a required prop (no defaultVariants). The three Fieldset usages in radio.stories.tsx were missing it, breaking the whole-package type-check. These groups are inline (no border), so bordered=false.
The fieldset's body — the stack of contained fields with the consistent vertical gap the design spec calls always-the-same — was being done by ad-hoc wrapper divs in stories and consumers rather than an anatomy part. Extract it into a single-element FieldsetBody part with its gap baked into cva, export it, and compose it in the components-tier Fieldset and both stories (registered in subcomponents). Radio stories that render the fieldset as a RadioGroup keep the group's own density as the body spacing, so they compose the ui-tier Fieldset + FieldsetLegend directly.
6425516 to
5cbb697
Compare
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.
Closes #129
What the designer said
From the issue, the designer marked these as always the same (bake in):
<fieldset>/<legend>element pairAnd these as depends (adjustable) — should be exposed as props:
Changes
packages/propel/src/ui/fieldset/variants.tsborderedvariant tofieldsetVariants(trueaddsrounded-md border-sm border-subtle p-4;falseadds nothing). NodefaultVariants— callers must be explicit.fieldsetDescriptionVariantscva for the new description part.packages/propel/src/ui/fieldset/fieldset.tsxFieldsetnow requires aborderedprop (passed through tofieldsetVariants).packages/propel/src/ui/fieldset/fieldset-description.tsx(new)FieldsetDescriptionrenders a<p>styled withfieldsetDescriptionVariants. Uses no Base UI wrapper — there is noFieldset.Descriptionin Base UI; the field-tierFieldDescriptionis context-bound to<Field>and does not apply here.packages/propel/src/ui/fieldset/index.tsxFieldsetDescriptionpart.packages/propel/src/components/fieldset/fieldset.tsxdescriptionprop; rendersFieldsetDescriptionwhen provided.bordered.packages/propel/src/components/fieldset/index.tsxFieldsetDescriptionand its type so consumers can import from one place.Stories — both tiers updated:
Fieldsetusages now passborderedexplicitly.Borderedstory showing a bordered group with a description.Callers fixed (
components/field/):CheckboxGroupFieldandRadioGroupFieldboth render the ui-tierFieldsetdirectly; both now passbordered={false}(semantic grouping, no visible frame).Notes
FieldsetLegendkeeps itsmagnitudeprop. The spec says "consistent weight/size" for the legend font style — that is already true (every magnitude step uses the samefont-medium text-primarybase; only the size token changes). Removingmagnitudewould breakCheckboxGroupFieldandRadioGroupFieldwhere the legend must match the group's control size.