Skip to content

Commit 61d812a

Browse files
authored
Merge branch 'main' into subdialogs
2 parents 7af516b + 873f6fe commit 61d812a

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

packages/@react-spectrum/s2/api-diff.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ React Spectrum v3 [style props](https://react-spectrum.adobe.com/react-spectrum/
5959
| Prop | Spectrum 2 | RSP v3 | Comments |
6060
|------|------------|--------|----------|
6161
| size | 🟢 `'L' \| 'M' \| 'S' \| 'XL'` || |
62-
| variant | 🟢 `'accent' \| 'blue' \| 'brown' \| 'celery' \| 'charteuse' \| 'cinnamon' \| 'cyan' \| 'fuchsia' \| 'gray' \| 'green' \| 'indigo' \| 'informative' \| 'magenta' \| 'negative' \| 'neutral' \| 'notice' \| 'orange' \| 'pink' \| 'positive' \| 'purple' \| 'red' \| 'seafoam' \| 'silver' \| 'turquoise' \| 'yellow'` | 🔴 `'fuchsia' \| 'indigo' \| 'info' \| 'magenta' \| 'negative' \| 'neutral' \| 'positive' \| 'purple' \| 'seafoam' \| 'yellow'` | |
62+
| variant | 🟢 `'accent' \| 'blue' \| 'brown' \| 'celery' \| 'chartreuse' \| 'cinnamon' \| 'cyan' \| 'fuchsia' \| 'gray' \| 'green' \| 'indigo' \| 'informative' \| 'magenta' \| 'negative' \| 'neutral' \| 'notice' \| 'orange' \| 'pink' \| 'positive' \| 'purple' \| 'red' \| 'seafoam' \| 'silver' \| 'turquoise' \| 'yellow'` | 🔴 `'fuchsia' \| 'indigo' \| 'info' \| 'magenta' \| 'negative' \| 'neutral' \| 'positive' \| 'purple' \| 'seafoam' \| 'yellow'` | |
6363
## Button
6464

6565
| Prop | Spectrum 2 | RSP v3 | Comments |

packages/@react-spectrum/s2/chromatic/Badge.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default meta;
3030
let states = [
3131
{size: ['S', 'M', 'L', 'XL']},
3232
{fillStyle: ['bold', 'subtle', 'outline']},
33-
{variant: ['accent', 'informative', 'neutral', 'positive', 'notice', 'negative', 'gray', 'red', 'orange', 'yellow', 'charteuse', 'celery', 'green', 'seafoam', 'cyan', 'blue', 'indigo', 'purple', 'fuchsia', 'magenta', 'pink', 'turquoise', 'brown', 'cinnamon', 'silver']}
33+
{variant: ['accent', 'informative', 'neutral', 'positive', 'notice', 'negative', 'gray', 'red', 'orange', 'yellow', 'chartreuse', 'celery', 'green', 'seafoam', 'cyan', 'blue', 'indigo', 'purple', 'fuchsia', 'magenta', 'pink', 'turquoise', 'brown', 'cinnamon', 'silver']}
3434
];
3535

3636
let combinations = generatePowerset(states);

packages/@react-spectrum/s2/src/Badge.tsx

+21-6
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,17 @@ export interface BadgeStyleProps {
3535
*
3636
* @default 'neutral'
3737
*/
38-
variant?: 'accent' | 'informative' | 'neutral' | 'positive' | 'notice' | 'negative' | 'gray' | 'red' | 'orange' | 'yellow' | 'charteuse' | 'celery' | 'green' | 'seafoam' | 'cyan' | 'blue' | 'indigo' | 'purple' | 'fuchsia' | 'magenta' | 'pink' | 'turquoise' | 'brown' | 'cinnamon' | 'silver',
38+
variant?: 'accent' | 'informative' | 'neutral' | 'positive' | 'notice' | 'negative' | 'gray' | 'red' | 'orange' | 'yellow' | 'chartreuse' | 'celery' | 'green' | 'seafoam' | 'cyan' | 'blue' | 'indigo' | 'purple' | 'fuchsia' | 'magenta' | 'pink' | 'turquoise' | 'brown' | 'cinnamon' | 'silver',
3939
/**
4040
* The fill of the badge.
4141
* @default 'bold'
4242
*/
43-
fillStyle?: 'bold' | 'subtle' | 'outline'
43+
fillStyle?: 'bold' | 'subtle' | 'outline',
44+
/**
45+
* Sets the text behavior for the contents.
46+
* @default 'wrap'
47+
*/
48+
overflowMode?: 'wrap' | 'truncate'
4449
}
4550

4651
export interface BadgeProps extends DOMProps, AriaLabelingProps, StyleProps, BadgeStyleProps, SlotProps {
@@ -86,7 +91,7 @@ const badge = style<BadgeStyleProps>({
8691
notice: 'black',
8792
orange: 'black',
8893
yellow: 'black',
89-
charteuse: 'black',
94+
chartreuse: 'black',
9095
celery: 'black'
9196
}
9297
},
@@ -108,7 +113,7 @@ const badge = style<BadgeStyleProps>({
108113
red: 'red',
109114
orange: 'orange',
110115
yellow: 'yellow',
111-
charteuse: 'chartreuse',
116+
chartreuse: 'chartreuse',
112117
celery: 'celery',
113118
green: 'green',
114119
seafoam: 'seafoam',
@@ -137,7 +142,7 @@ const badge = style<BadgeStyleProps>({
137142
red: 'red-subtle',
138143
orange: 'orange-subtle',
139144
yellow: 'yellow-subtle',
140-
charteuse: 'chartreuse-subtle',
145+
chartreuse: 'chartreuse-subtle',
141146
celery: 'celery-subtle',
142147
green: 'green-subtle',
143148
seafoam: 'seafoam-subtle',
@@ -191,6 +196,7 @@ export const Badge = forwardRef(function Badge(props: BadgeProps, ref: DOMRef<HT
191196
variant = 'neutral',
192197
size = 'S',
193198
fillStyle = 'bold',
199+
overflowMode = 'wrap',
194200
...otherProps
195201
} = props; // useProviderProps(props) in v3
196202
let domRef = useDOMRef(ref);
@@ -199,7 +205,16 @@ export const Badge = forwardRef(function Badge(props: BadgeProps, ref: DOMRef<HT
199205
return (
200206
<Provider
201207
values={[
202-
[TextContext, {styles: style({paddingY: '--labelPadding', order: 1})}],
208+
[TextContext, {
209+
styles: style({
210+
paddingY: '--labelPadding',
211+
order: 1,
212+
overflowX: 'hidden',
213+
overflowY: 'hidden',
214+
textOverflow: 'ellipsis',
215+
whiteSpace: {overflowMode: {truncate: 'nowrap', wrap: 'normal'}}
216+
})({overflowMode})
217+
}],
203218
[IconContext, {
204219
render: centerBaseline({slot: 'icon', styles: style({order: 0})}),
205220
styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})

0 commit comments

Comments
 (0)