Repository navigation
refactor: use one size name per control height - #975
rohanchkrabrty wants to merge 6 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait...
|
commit: |
|
@rohanchkrabrty why micro -> xsmall ? for scale. |
Auto margins stopped a stretched vertical middle line from growing, so it rendered 0px tall. The upgrading note no longer says middle is always longer than half and small.
| |---|---| | ||
| | `size="full"` (default) | `variant="full"` (default) | | ||
| | `size="half"` | `variant="middle"` | | ||
| | `size="small"` | `variant="middle"`, or set the length with a class | |
There was a problem hiding this comment.
suggestion: I think "set the length with a class" won't work as written.
The variant rules are .variant-middle[data-orientation="vertical"] (a class plus an attribute), so a single consumer class loses whatever the load order.
middle also adds insets and sizes from the parent, while small was a fixed 20px line. variant="full" with an inline length gives the old result exactly.
| | `size="small"` | `variant="middle"`, or set the length with a class | | |
| | `size="small"` | `variant="full"` with `style={{ width: 20 }}`, or `height` on a vertical line | |
|
|
||
| /* Size variants */ | ||
| .large { | ||
| .medium { |
There was a problem hiding this comment.
nit: AGENTS.md asks for <prop>-<value> variant classes, and the new Separator classes follow it (variant-full).
Since these selectors are being renamed anyway, what do you think about size-medium and size-small here and in Radio and Switch? Fine as a follow-up too, since the tests read styles.medium directly.
Badge xsmall becomes mini. Tabs small, medium and large become mini, small and medium, so the 32px segmented Tabs list is medium, like Button and Input. Pixel sizes do not change. The DataView view switcher and CalendarPreview scales keep their sizes.
# Conflicts: # apps/www/src/components/dataview-demo.tsx # apps/www/src/components/tag/tag.tsx # apps/www/src/content/docs/(overview)/upgrading.mdx # apps/www/src/content/docs/ai-elements/prompt-input/demo.ts # apps/www/src/content/docs/components/button/props.ts # packages/react/components/command/command-input.tsx # packages/react/components/data-view/components/timeline.tsx # packages/react/components/input/input.module.css # packages/react/components/input/input.tsx # packages/react/components/separator/separator.module.css # packages/react/components/text-area/text-area.tsx
Chip small and large become mini and small, so the 24px chip is small, like Input small. Pixel sizes do not change, and mini is the default. The DataView and DataTable display properties keep their size.
Summary
medium: Buttonnormal, andlargeon Input, TextArea, Search, Combobox.Input, Command.Input, Checkbox, Radio and Switch. Pixel sizes and defaults do not change.microtominiandregulartomedium.smallstays the default.small,mediumandlargetomini,smallandmedium, so the 32px segmented list ismedium, like Button and Input. Pixel sizes do not change, so the default is nowsmall.size(small,half,full) withvariant(full,middle).middleinsets both ends of the line.Decisions where the proposal is silent:
micro,mini,small,mediumandlarge. The size right belowsmallismini, so Badge usesmini, not the proposal'sxsmall.smallandmedium, so TypeScript does not report old Tabs values. The Upgrading page tells readers to check each Tabssize.middleinsets each end by 16px on a horizontal line and 8px on a vertical line, as MUI Dividermiddledoes. The line is centered.halfandsmallboth map tomiddle, so the length of those lines changes (they were 50% and 20px).smallstays 22px, and Badge stays 18, 22 and 28px. These do not match the 24px and 32px rule. They are open items for design.mediumkeep their current sizes..medium,size-medium,badge-mini). The new Separator classes arevariant-fullandvariant-middle.docs/V1-migration.mdkeeps the old names, because it describes the 1.0 release.size="half". The Input playground usesdefaultValue, so the default size is left out of the generated code.Checks run after the merge with main:
pnpm lint,pnpm exec tsc --noEmitinpackages/react, andvitest --runinpackages/react(3899 tests) pass. Before the Tabs rename and the merge, I compared 17 docs pages on a local dev server with the deployed docs in light and dark themes. The computed size, spacing and color of every demo part matched. Only the demo labels and the Separator demos differed. Before the merge, a local page measured the segmented Tabs list at 24, 28 and 32px formini,smallandmedium, next to Buttonsmall(22px) andmedium(32px).