Commit a3780cd
feat: breakpoint & responsive styling support (#1326)
* chore(docs): add chromatic viewport modes baseline
Add VIEWPORT_MODES and viewport options to storybook for chromatic
visual snapshot baselines across breakpoints. Hardcoded values will be
replaced with @seed-design/css/breakpoints when responsive styling lands.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore(docs): apply chromatic viewport modes to layout stories
Add chromatic: { modes: VIEWPORT_MODES } to Box, Flex, Grid, Stack
stories to establish visual snapshot baselines across breakpoints.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat(css, react): add breakpoint constants and ResponsiveValue type
Introduce viewport breakpoint system for responsive styling support:
- Add @seed-design/css/breakpoints with breakpoint names, values, and media queries
- Add ResponsiveValue<T> type and isResponsiveObject type guard in react package
- Export ResponsiveValue type from @seed-design/react public API
Breakpoints: base(0), sm(480), md(768), lg(1280), xl(1440)
DES-1314, DES-1318
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(postcss-responsive): add PostCSS plugin for responsive CSS variable cascade chains
Introduce postcss-responsive plugin that transforms `--responsive` marker
suffixed CSS custom properties into breakpoint-aware cascade chains.
Register in qvism-preset and add markers to 20 Box style properties
(padding, bleed, width/height, display, flexDirection, gap).
Generated CSS includes per-breakpoint fallback vars and @media overrides.
Adapted from Reshaped (MIT) postcss.responsive.mjs
DES-1324, DES-1317
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
# packages/css/all.layered.min.css
# packages/css/all.min.css
* feat(react): add responsive value support to useStyleProps
Extend useStyleProps to accept ResponsiveValue<T> for layout-related
props (width, height, padding, bleed, display, flexDirection, gap).
Single values now output -base suffixed CSS variables to work with
the postcss-responsive cascade chain.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(react): fix StyleProps consumer compatibility for responsive values
- Icon: use UnwrapResponsive<StyleProps["height"]> since --seed-icon-size
is outside the --seed-box-* cascade chain (no responsive icon sizing yet)
- ResponsivePair: replace handleDimension(gap) with var(--seed-box-gap)
CSS variable reference to support responsive gap values
- Export UnwrapResponsive utility type for external consumers
- Unexport handlePaddingWithSafeArea (internal only)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(react): add responsive utility props for layout components
Add responsive Grid columns/rows, hideFrom/showFrom visibility controls
for Box/Flex/Grid, and vStackFrom/hStackFrom direction switching for
Stack components. Export BreakpointThreshold type for consumers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor
* fix(react): move Grid display from .seed-grid CSS to Box's --seed-box-display
Previously .seed-grid hardcoded display:grid, which silently overrode
--seed-box-display and broke <Grid display="none">. Now Grid passes
display="grid" through Box like Flex does, unifying the pattern and
enabling hideFrom/showFrom to work correctly.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(react): add JS runtime responsive hooks
Add useBreakpoint, useBreakpointValue hooks and optional BreakpointProvider
for JS-level responsive behavior (variant switching, conditional rendering).
- Module-level singleton matchMedia store with lazy init and ref counting
- useSyncExternalStore for tearing-safe concurrent mode support
- Hybrid: works without provider, optional BreakpointProvider for SSR defaults
- Cascade resolution matching CSS min-width semantics
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(react): replace resolveDisplay with generic resolveThreshold
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(react): restructure visibility utils with internal resolveThreshold
- resolveThreshold is now a generic internal utility (not exported)
- resolveDisplay wraps it with display-specific API ({base, hideFrom, showFrom})
- hideFrom takes precedence if both hideFrom and showFrom are provided
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(react): implement hideFrom via CSS variable cascade, remove showFrom
- hideFrom now directly injects `--seed-box-display-{bp}: none` into
inline style, leveraging the existing CSS variable cascade chain.
This makes hideFrom completely independent of the user's display prop.
- Remove showFrom from all components (Box, Flex, Grid) due to
fundamental conflict with user's display prop — restoring the
original display value at a breakpoint requires knowing what it is.
- Remove visibility.ts utility (no longer needed).
- Restore Flex/Grid to dev-branch pattern: hardcoded display default
with ...rest spread allowing user override.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(react): allow responsive display values on Flex and Grid
Wrap Flex `display` and Grid `display` prop types with
ResponsiveValue<> so users can pass responsive objects directly:
<Flex display={{ base: "none", md: "flex" }} />
<Grid display={{ base: "none", lg: "grid" }} />
This naturally covers the showFrom use case without a dedicated prop.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(react): remove vStackFrom/hStackFrom from Stack components
Deferred to gradual introduction; users can use Flex with responsive
flexDirection directly for the same effect.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: add comment
* fix: better type ResponsiveObject<T>
* chore: format
* docs
* docs
* test: add tests for multiple viewports
# Conflicts:
# docs/stories/utils/parameters.ts
* test: add nested layout composition stories for Box
Add layout and nested stacks conditions (both static and responsive)
to Box stories for visual regression testing with Chromatic viewport modes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: generate
* fix: fix recipes using box variables
* fix: fix ResponsivePair inline styles
* fix: revert changes in action button recipe since it doesn't have seed-box class
* fix: bleed* can take responsive objects
* fix(css, qvism-preset): use --responsive marker in recipes for style prop override
Recipes that expose style props via Pick<StyleProps, ...> need their own
CSS variable cascade chain so that resolveResponsive's -base suffix
inline styles can override recipe defaults. Without .seed-box class on
these components, the cascade chain from base.css is not available.
Using --responsive marker lets postcss-responsive generate the full
cascade chain (-base, -sm, -md, -lg, -xl + media queries) directly
in each recipe's CSS output.
Affected recipes: skeleton, bottom-sheet, help-bubble, list-item
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: fix reponsivepair
* fix
* docs
* test: remove unrelated case
* feat: add gap fallback to responsivepair
* fix: remove unsafe casting
* test: add ResponsivePair stories
* docs: changeset
* feat(qvism-preset): add breakpoint helper for recipes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
# docs/stories/utils/parameters.ts1 parent 59a6524 commit a3780cd
70 files changed
Lines changed: 3555 additions & 322 deletions
File tree
- .changeset
- docs
- .storybook
- content/react/components
- (foundation)/layout
- concepts
- examples/react/responsive-design
- public/__docs__
- stories
- utils
- ecosystem/postcss-responsive
- src
- packages
- css
- breakpoints
- recipes
- qvism-preset
- src
- recipes
- utils
- react/src
- components
- Box
- Flex
- Grid
- Icon
- ResponsivePair
- hooks
- primitives
- providers
- types
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
5 | 27 | | |
6 | 28 | | |
7 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
Lines changed: 161 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments