Skip to content

Commit d86c46e

Browse files
committed
Add semantic tone-fill-glass
1 parent e14ed69 commit d86c46e

6 files changed

Lines changed: 45 additions & 5 deletions

File tree

‎frontend/purestack.studio/components/landing/landing-band/landing-band.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Use backgrounds as decoration and keep meaningful image content in a normal imag
143143
</ApiProperty>
144144

145145
<ApiProperty anchor="landing-band-prop-variant" name="variant" valueType="RefOrValue&lt;ComponentVariant&gt;" defaultValue="surfaceAlt">
146-
<p>Visual treatment. Accepts solid, surface, surfaceAlt, spotlight, outlineFill, outline, subtle, subtleBtn, link, sheen, underline, rail, bracket or none.</p>
146+
<p>Visual treatment. Accepts solid, surface, surfaceAlt, spotlight, glass, outlineFill, outline, subtle, subtleBtn, link, sheen, underline, rail, bracket or none.</p>
147147
</ApiProperty>
148148

149149
<ApiProperty anchor="landing-band-prop-variantMode" name="variantMode" valueType="RefOrValue&lt;ComponentVariantMode&gt;" defaultValue="stateless">

‎frontend/purestack.studio/components/layout/panel/panel.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Panel does not add an action or an accessible label. Give content sections a hea
137137
</ApiProperty>
138138

139139
<ApiProperty anchor="panel-prop-variant" name="variant" valueType="RefOrValue&lt;ComponentVariant&gt;" defaultValue="surface">
140-
<p>Visual treatment. Accepts solid, surface, surfaceAlt, spotlight, outlineFill, outline, subtle, subtleBtn, link, sheen, underline, rail, bracket or none.</p>
140+
<p>Visual treatment. Accepts solid, surface, surfaceAlt, spotlight, glass, outlineFill, outline, subtle, subtleBtn, link, sheen, underline, rail, bracket or none.</p>
141141
</ApiProperty>
142142

143143
<ApiProperty anchor="panel-prop-variantMode" name="variantMode" valueType="RefOrValue&lt;ComponentVariantMode&gt;" defaultValue="stateless">

‎frontend/purestack.studio/guides/semantic-tones.mdx‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,28 @@ The skin sets the field and the light color; the page decides where the light fa
131131
</Panel>
132132
```
133133

134+
Cards placed on a spotlight should not repeat its field. `tone-fill-glass` lets the field show through, lifted by a faint veil and lit by the same light, so a card reads as a lighter pane rather than a second color. The light follows the nearest `spotlight-from-*`, so cards and their spotlight are lit from the same side. Components accept it as `variant="glass"`. A different tone on a glass card tints it without breaking the field:
135+
136+
<div class="tone--accent tone-fill-spotlight tone-border-surface-alt tone-text-surface-alt b-1 rounded-lg p-3 spotlight-from-top-right">
137+
<Grid columns="1" columnsSm="2" class="gap-3">
138+
<div class="tone-fill-glass tone-border-surface-alt b-1 rounded-md p-3">
139+
<span class="text-eyebrow">Next review</span>
140+
<strong class="d-block">Friday</strong>
141+
</div>
142+
<div class="tone--secondary tone-fill-glass tone-border-surface-alt tone-text-surface-alt b-1 rounded-md p-3">
143+
<span class="text-eyebrow">Open decision</span>
144+
<strong class="d-block">Release date</strong>
145+
</div>
146+
</Grid>
147+
</div>
148+
149+
```mdx
150+
<Panel tone="accent" variant="spotlight" class="spotlight-from-top-right">
151+
<Panel variant="glass">Next review</Panel>
152+
<Panel tone="secondary" variant="glass">Open decision</Panel>
153+
</Panel>
154+
```
155+
134156
## Tone-colored text and clipped fills
135157

136158
Use `tone-text` for the selected tone color. Use `tone-text-bg-button` when you want the button role's background treatment clipped into text. Both examples keep a neutral surrounding surface; the tone changes only for the label:

‎packages/ts-components/src/standard/componentVariant.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export type ComponentVariant =
77
| 'surface'
88
| 'surfaceAlt'
99
| 'spotlight'
10+
| 'glass'
1011
| 'outlineFill'
1112
| 'outline'
1213
| 'subtle'
@@ -43,6 +44,8 @@ const STATELESS_COMPONENT_VARIANT_CLASSES: Record<ComponentVariant, string> = {
4344
'b-1 rounded-md tone-fill-surface-alt tone-border-surface-alt tone-text-surface-alt',
4445
spotlight:
4546
'b-1 rounded-md tone-fill-spotlight tone-border-surface-alt tone-text-surface-alt',
47+
glass:
48+
'b-1 rounded-md tone-fill-glass tone-border-surface-alt tone-text-surface-alt',
4649
outlineFill: 'b-2 rounded-md tone-border-button tone-text',
4750
outline: 'b-2 rounded-md tone-text',
4851
subtle: 'b-0 rounded-md tone-text',

‎packages/ts-ssg/sample-content/index.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ nav:
5858
</div>
5959
</Panel>
6060
<Grid columns="1" columnsSm="2" columnsMd="1" class="wp-side-stack">
61-
<Flex direction="column" class="wp-side-card tone-fill-spotlight tone-text-surface-alt b-1 tone-border-surface rounded-lg position-relative p-4">
61+
<Flex direction="column" class="wp-side-card tone-fill-glass tone-text-surface-alt b-1 tone-border-surface-alt rounded-lg position-relative p-4">
6262
<span class="wp-micro text-subtle mb-0">NEXT REVIEW</span>
6363
<strong>Friday</strong>
6464
<span class="wp-side-meta text-subtle mb-0">10:00 · Project check-in</span>
6565
<Icon name="lucide:arrow-up-right" class="wp-side-icon position-absolute" aria-hidden="true"/>
6666
</Flex>
67-
<Flex direction="column" class="wp-side-card tone--secondary tone-fill-spotlight tone-text-surface-alt b-1 tone-border-surface rounded-lg position-relative p-4">
67+
<Flex direction="column" class="wp-side-card tone--secondary tone-fill-glass tone-text-surface-alt b-1 tone-border-surface-alt rounded-lg position-relative p-4">
6868
<span class="wp-micro text-subtle mb-0">OPEN DECISION</span>
6969
<strong>Release date</strong>
7070
<span class="wp-side-meta text-subtle mb-0">Owner assigned</span>

‎packages/ts-style/src/semanticPresets.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ export function createPresets(
3838
createInset(current, styleBuilder, theme)
3939
}
4040

41+
function spotlightLight(current: ThemePaletteCurrent, reach: string) {
42+
return `radial-gradient(circle at var(${SPOTLIGHT_FROM_VAR}, ${SPOTLIGHT_FROM['top-left']}), ${current.spotlight.light} 0%, transparent ${reach})`
43+
}
44+
45+
function glassVeil(current: ThemePaletteCurrent) {
46+
return `color-mix(in srgb, ${current.spotlight.light} 45%, transparent)`
47+
}
48+
4149
function createSpotlightOrigins(styleBuilder: StyleBuilder, theme: string) {
4250
for (const [name, position] of Object.entries(SPOTLIGHT_FROM)) {
4351
styleBuilder
@@ -186,7 +194,14 @@ function createFills(
186194
},
187195
'tone-fill-spotlight': {
188196
rest: {
189-
background: `radial-gradient(circle at var(${SPOTLIGHT_FROM_VAR}, ${SPOTLIGHT_FROM['top-left']}), ${current.spotlight.light} 0%, transparent 46%), ${current.spotlight.field}`,
197+
background: `${spotlightLight(current, '46%')}, ${current.spotlight.field}`,
198+
},
199+
},
200+
// Glass lets the field behind show through, lifted by a veil and lit by
201+
// the same light, so cards sit on a spotlight without a second color.
202+
'tone-fill-glass': {
203+
rest: {
204+
background: `${spotlightLight(current, '75%')}, linear-gradient(${glassVeil(current)}, ${glassVeil(current)})`,
190205
},
191206
},
192207
'tone-fill-surface': {

0 commit comments

Comments
 (0)