Skip to content

Commit 2bf4761

Browse files
devongovettGitHub Enterprise
authored andcommitted
Update API diff (#186)
1 parent 60cdad6 commit 2bf4761

16 files changed

+150
-83
lines changed

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

Lines changed: 86 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ React Spectrum v3 [style props](https://react-spectrum.adobe.com/react-spectrum/
109109
|------|------------|--------|----------|
110110
| isDisabled || 🔴 `boolean` | Focusable/interactive Avatars aren't supported in S2 yet. |
111111
| size || 🔴 `'avatar-size-100' \| 'avatar-size-200' \| 'avatar-size-300' \| 'avatar-size-400' \| 'avatar-size-50' \| 'avatar-size-500' \| 'avatar-size-600' \| 'avatar-size-700' \| 'avatar-size-75' \| (string & {<br> <br>}) \| number` | This prop has been removed in favor of providing a size via the `styles` prop. |
112+
## Breadcrumbs
113+
114+
| Prop | Spectrum 2 | RSP v3 | Comments |
115+
|------|------------|--------|----------|
116+
| dependencies | 🟢 `Array<any>` || |
117+
| slot | 🟢 `null \| string` || |
118+
| size | 🟢 `'L' \| 'M'` | 🔴 `'L' \| 'M' \| 'S'` | Small is no longer supported in Spectrum Design. |
119+
| showRoot || 🔴 `boolean` | Not yet implemented in S2. |
120+
| isMultiline || 🔴 `boolean` | Not yet implemented in S2. |
121+
| autoFocusCurrent || 🔴 `boolean` | Not yet implemented in S2. |
112122
## ButtonGroup
113123

114124
| Prop | Spectrum 2 | RSP v3 | Comments |
@@ -127,9 +137,40 @@ React Spectrum v3 [style props](https://react-spectrum.adobe.com/react-spectrum/
127137
| Prop | Spectrum 2 | RSP v3 | Comments |
128138
|------|------------|--------|----------|
129139
| size | 🟢 `'L' \| 'M' \| 'S' \| 'XL'` || |
140+
## ColorArea
141+
142+
| Prop | Spectrum 2 | RSP v3 | Comments |
143+
|------|------------|--------|----------|
144+
| slot | 🟢 `null \| string` || |
145+
| size || 🔴 `DimensionValue` | Set size via `style` macro instead. |
146+
## ColorWheel
147+
148+
| Prop | Spectrum 2 | RSP v3 | Comments |
149+
|------|------------|--------|----------|
150+
| size | 🟢 `number` | 🔴 `DimensionValue` | Use pixel values instead. |
151+
| slot | 🟢 `null \| string` || |
152+
## ColorSlider
153+
154+
| Prop | Spectrum 2 | RSP v3 | Comments |
155+
|------|------------|--------|----------|
156+
| label | 🟢 `string` | 🔴 `ReactNode` | |
157+
| slot | 🟢 `null \| string` || |
158+
| showValueLabel || 🔴 `boolean` | Removed for accessibility reasons. |
159+
## ColorField
160+
161+
| Prop | Spectrum 2 | RSP v3 | Comments |
162+
|------|------------|--------|----------|
163+
| size | 🟢 `'L' \| 'M' \| 'S' \| 'XL'` || |
164+
| isInvalid | 🟢 `boolean` || |
165+
| slot | 🟢 `null \| string` || |
166+
| isQuiet || 🔴 `boolean` | Not supported in S2 design. |
167+
| placeholder || 🔴 `string` | Removed for accessibility reasons. |
168+
| validationState || 🔴 `ValidationState` | Use `isInvalid` instead. |
169+
## ColorSwatch
170+
171+
| Prop | Spectrum 2 | RSP v3 | Comments |
172+
|------|------------|--------|----------|
130173
| slot | 🟢 `null \| string` || |
131-
| contextualHelp || 🔴 `ReactNode` | Not yet implemented in S2. |
132-
| showErrorIcon || 🔴 `boolean` | Removed for accessibility reasons. |
133174
## ComboBox
134175

135176
| Prop | Spectrum 2 | RSP v3 | Comments |
@@ -142,8 +183,12 @@ React Spectrum v3 [style props](https://react-spectrum.adobe.com/react-spectrum/
142183
| loadingState || 🔴 `LoadingState` | Not yet implemented in S2. |
143184
| placeholder || 🔴 `string` | Removed for accessibility reasons. |
144185
| validationState || 🔴 `ValidationState` | Use `isInvalid` instead. |
145-
| contextualHelp || 🔴 `ReactNode` | Not yet implemented in S2. |
146186
| onLoadMore || 🔴 `() => any` | Not yet implemented in S2. |
187+
## ContextualHelp
188+
189+
| Prop | Spectrum 2 | RSP v3 | Comments |
190+
|------|------------|--------|----------|
191+
| size | 🟢 `'S' \| 'XS'` || |
147192
## Dialog
148193

149194
| Prop | Spectrum 2 | RSP v3 | Comments |
@@ -240,7 +285,6 @@ React Spectrum v3 [style props](https://react-spectrum.adobe.com/react-spectrum/
240285
| validationState || 🔴 `ValidationState` | Use `isInvalid` instead. |
241286
| isLoading || 🔴 `boolean` | Not yet implemented in S2. |
242287
| onLoadMore || 🔴 `() => any` | Not yet implemented in S2. |
243-
| contextualHelp || 🔴 `ReactNode` | Not yet implemented in S2. |
244288
## ProgressBar
245289

246290
| Prop | Spectrum 2 | RSP v3 | Comments |
@@ -270,7 +314,6 @@ React Spectrum v3 [style props](https://react-spectrum.adobe.com/react-spectrum/
270314
| slot | 🟢 `null \| string` || |
271315
| validationState || 🔴 `ValidationState` | Use `isInvalid` instead. |
272316
| showErrorIcon || 🔴 `boolean` | Removed for accessibility reasons. |
273-
| contextualHelp || 🔴 `ReactNode` | Not yet implemented in S2. |
274317
## SearchField
275318

276319
| Prop | Spectrum 2 | RSP v3 | Comments |
@@ -282,7 +325,34 @@ React Spectrum v3 [style props](https://react-spectrum.adobe.com/react-spectrum/
282325
| icon || 🔴 `ReactElement \| null` | Not yet implemented in S2. |
283326
| isQuiet || 🔴 `boolean` | Not supported in S2 design. |
284327
| validationState || 🔴 `ValidationState` | Use `isInvalid` instead. |
285-
| contextualHelp || 🔴 `ReactNode` | Not yet implemented in S2. |
328+
## Slider
329+
330+
| Prop | Spectrum 2 | RSP v3 | Comments |
331+
|------|------------|--------|----------|
332+
| size | 🟢 `'L' \| 'M' \| 'S' \| 'XL'` || |
333+
| labelAlign | 🟢 `Alignment` || |
334+
| isEmphasized | 🟢 `boolean` || |
335+
| trackStyle | 🟢 `'thick' \| 'thin'` || |
336+
| thumbStyle | 🟢 `'default' \| 'precise'` || |
337+
| slot | 🟢 `null \| string` || |
338+
| isFilled || 🔴 `boolean` | Always filled in S2 design. |
339+
| trackGradient || 🔴 `Array<string>` | Not supported in S2 design. |
340+
| showValueLabel || 🔴 `boolean` | Removed for accessibility reasons. |
341+
| getValueLabel || 🔴 `(number) => string` | Not yet implemented in S2. |
342+
| orientation || 🔴 `Orientation` | Not yet implemented in S2. |
343+
## RangeSlider
344+
345+
| Prop | Spectrum 2 | RSP v3 | Comments |
346+
|------|------------|--------|----------|
347+
| size | 🟢 `'L' \| 'M' \| 'S' \| 'XL'` || |
348+
| labelAlign | 🟢 `Alignment` || |
349+
| isEmphasized | 🟢 `boolean` || |
350+
| trackStyle | 🟢 `'thick' \| 'thin'` || |
351+
| thumbStyle | 🟢 `'default' \| 'precise'` || |
352+
| slot | 🟢 `null \| string` || |
353+
| showValueLabel || 🔴 `boolean` | Removed for accessibility reasons. |
354+
| getValueLabel || 🔴 `(RangeValue<number>) => string` | Not yet implemented in S2. |
355+
| orientation || 🔴 `Orientation` | Not yet implemented in S2. |
286356
## StatusLight
287357

288358
| Prop | Spectrum 2 | RSP v3 | Comments |
@@ -314,7 +384,6 @@ React Spectrum v3 [style props](https://react-spectrum.adobe.com/react-spectrum/
314384
| actionLabel || 🔴 `string` | Not yet implemented in S2.|
315385
| onAction || 🔴 `() => void` | Not yet implemented in S2. |
316386
| maxRows || 🔴 `number` | Not yet implemented in S2. |
317-
| contextualHelp || 🔴 `ReactNode` | Not yet implemented in S2. |
318387
| validationState || 🔴 `ValidationState` | Use `isInvalid` instead. |
319388
## TextArea
320389

@@ -327,7 +396,6 @@ React Spectrum v3 [style props](https://react-spectrum.adobe.com/react-spectrum/
327396
| isQuiet || 🔴 `boolean` | Not supported in S2 design. |
328397
| placeholder || 🔴 `string` | Removed for accessibility reasons. |
329398
| validationState || 🔴 `ValidationState` | Use `isInvalid` instead. |
330-
| contextualHelp || 🔴 `ReactNode` | Not yet implemented in S2. |
331399
## TextField
332400

333401
| Prop | Spectrum 2 | RSP v3 | Comments |
@@ -339,7 +407,6 @@ React Spectrum v3 [style props](https://react-spectrum.adobe.com/react-spectrum/
339407
| isQuiet || 🔴 `boolean` | Not supported in S2 design. |
340408
| placeholder || 🔴 `string` | Removed for accessibility reasons. |
341409
| validationState || 🔴 `ValidationState` | Use `isInvalid` instead. |
342-
| contextualHelp || 🔴 `ReactNode` | Not yet implemented in S2. |
343410
## Tooltip
344411

345412
| Prop | Spectrum 2 | RSP v3 | Comments |
@@ -354,19 +421,27 @@ React Spectrum v3 [style props](https://react-spectrum.adobe.com/react-spectrum/
354421
| Prop | Spectrum 2 | RSP v3 | Comments |
355422
|------|------------|--------|----------|
356423
| placement | 🟢 `'bottom' \| 'end' \| 'left' \| 'right' \| 'start' \| 'top'` | 🔴 `'bottom' \| 'bottom left' \| 'bottom right' \| 'bottom start' \| 'bottom end' \| 'top' \| 'top left' \| 'top right' \| 'top start' \| 'top end' \| 'left' \| 'left top' \| 'left bottom' \| 'start' \| 'start top' \| 'start bottom' \| 'right' \| 'right top' \| 'right bottom' \| 'end' \| 'end top' \| 'end bottom'` | |
357-
358424
## Item
359425

360426
The v3 `Item` component has been split into multiple components depending on the type of collection it is within. These include:
361427

362428
* MenuItem
429+
* PickerItem
430+
* ComboBoxItem
431+
* Breadcrumb
363432
* Tag
364433

365434
In addition, the `key` prop has been renamed to `id` on all item components.
366435

367436
## Section
368437

369-
The v3 `Section` component used in `Menu` is now named `MenuSection`. This accepts a `Header` as a child instead of a `title` prop. Both a heading and description are now supported within a section header.
438+
The v3 `Section` component has been split into multiple components depending on the type of collection it is within. These include:
439+
440+
* MenuSection
441+
* PickerSection
442+
* ComboBoxSection
443+
444+
The section components accept a `Header` as a child instead of a `title` prop. Both a heading and description are now supported within a section header.
370445

371446
```jsx
372447
<MenuSection>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ interface ToggleButtonStyleProps {
4141
isEmphasized?: boolean
4242
}
4343

44-
export interface ActionButtonProps extends Omit<ButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd'>, StyleProps, ActionButtonStyleProps {
44+
export interface ActionButtonProps extends Omit<ButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, ActionButtonStyleProps {
4545
/** The content to display in the ActionButton. */
4646
children?: ReactNode
4747
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ interface BreadcrumbsStyleProps {
3636
// TODO: showRoot?: boolean,
3737
}
3838

39-
export interface BreadcrumbsProps<T> extends Omit<AriaBreadcrumbsProps<T>, 'children' | 'style' | 'className'>, BreadcrumbsStyleProps, StyleProps {
39+
export interface BreadcrumbsProps<T> extends Omit<AriaBreadcrumbsProps<T>, 'children' | 'items' | 'style' | 'className'>, BreadcrumbsStyleProps, StyleProps {
4040
/** The children of the Breadcrumbs. */
4141
children?: ReactNode
4242
}
@@ -216,7 +216,7 @@ const heading = style({
216216
fontWeight: 'extra-bold'
217217
});
218218

219-
export interface BreadcrumbProps extends Omit<AriaBreadcrumbItemProps, 'children' | 'style' | 'className'>, LinkDOMProps {
219+
export interface BreadcrumbProps extends Omit<AriaBreadcrumbItemProps, 'children' | 'style' | 'className' | 'autoFocus'>, LinkDOMProps {
220220
/** The children of the breadcrumb item. */
221221
children?: ReactNode
222222
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ interface ButtonStyleProps {
4545
staticColor?: 'white' | 'black'
4646
}
4747

48-
export interface ButtonProps extends Omit<RACButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd'>, StyleProps, ButtonStyleProps {
48+
export interface ButtonProps extends Omit<RACButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, ButtonStyleProps {
4949
/** The content to display in the Button. */
5050
children?: ReactNode
5151
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface CheckboxStyleProps {
3535

3636
interface RenderProps extends CheckboxRenderProps, CheckboxStyleProps {}
3737

38-
export interface CheckboxProps extends Omit<AriaCheckboxProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd'>, StyleProps, CheckboxStyleProps {
38+
export interface CheckboxProps extends Omit<AriaCheckboxProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, CheckboxStyleProps {
3939
/** The label for the element. */
4040
children?: ReactNode
4141
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {StylesPropWithHeight, UnsafeStyles, getAllowedOverrides} from './style-u
1818
import {DOMProps, DOMRef} from '@react-types/shared';
1919
import {useDOMRef} from '@react-spectrum/utils';
2020

21-
export interface DropZoneProps extends Omit<RACDropZoneProps, 'className' | 'style' | 'children' | 'isDisabled' | 'onHover' | 'onHoverStart' | 'onHoverEnd'>, UnsafeStyles, DOMProps {
21+
export interface DropZoneProps extends Omit<RACDropZoneProps, 'className' | 'style' | 'children' | 'isDisabled' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, UnsafeStyles, DOMProps {
2222
/** Spectrum-defined styles, returned by the `style()` macro. */
2323
styles?: StylesPropWithHeight,
2424
/** The content to display in the drop zone. */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface LinkStyleProps {
3131
isQuiet?: boolean
3232
}
3333

34-
export interface LinkProps extends Omit<RACLinkProps, 'isDisabled' | 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd'>, StyleProps, LinkStyleProps {
34+
export interface LinkProps extends Omit<RACLinkProps, 'isDisabled' | 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, LinkStyleProps {
3535
children?: ReactNode
3636
}
3737

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
} from 'react-aria-components';
2525
import {useFocusableRef} from '@react-spectrum/utils';
2626

27-
export interface RadioProps extends Omit<AriaRadioProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd'>, StyleProps {
27+
export interface RadioProps extends Omit<AriaRadioProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps {
2828
/**
2929
* The label for the element.
3030
*/

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,29 @@ import {
1414
SliderThumb,
1515
SliderTrack
1616
} from 'react-aria-components';
17-
import {SliderBase, SliderProps, thumb, thumbContainer, thumbHitArea, upperTrack, filledTrack, track} from './Slider';
18-
import {FocusableRef} from '@react-types/shared';
17+
import {SliderBase, SliderBaseProps, thumb, thumbContainer, thumbHitArea, upperTrack, filledTrack, track} from './Slider';
18+
import {FocusableRef, RangeValue} from '@react-types/shared';
1919
import {useRef, forwardRef, useContext} from 'react';
20-
import {forwardRefType} from './types';
2120
import {useFocusableRef} from '@react-spectrum/utils';
2221
import {useLocale} from '@react-aria/i18n';
2322
import {FormContext, useFormProps} from './Form';
2423
import {pressScale} from './pressScale';
2524

26-
export interface RangeSliderProps<T> extends Omit<SliderProps<T>, 'fillOffset' | 'thumbLabel'> {
25+
export interface RangeSliderProps extends Omit<SliderBaseProps<RangeValue<number>>, 'children'> {
2726
/**
28-
* The label for each of the Slider's thumbs.
27+
* The name of the start input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
2928
*/
30-
thumbLabels?: string[]
29+
startName?: string,
30+
/**
31+
* The name of the end input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
32+
*/
33+
endName?: string
3134
}
3235

33-
function RangeSlider<T extends number | number[]>(props: RangeSliderProps<T>, ref: FocusableRef<HTMLDivElement>) {
36+
function RangeSlider(props: RangeSliderProps, ref: FocusableRef<HTMLDivElement>) {
3437
let formContext = useContext(FormContext);
3538
props = useFormProps(props);
3639
let {
37-
thumbLabels,
3840
labelPosition = 'top',
3941
size = 'M',
4042
isEmphasized,
@@ -52,14 +54,19 @@ function RangeSlider<T extends number | number[]>(props: RangeSliderProps<T>, re
5254
return (
5355
<SliderBase
5456
{...props}
57+
value={props.value ? [props.value.start, props.value.end] : undefined}
58+
defaultValue={props.defaultValue ? [props.defaultValue.start, props.defaultValue.end] : undefined}
59+
onChange={v => props.onChange?.({start: v[0], end: v[1]})}
60+
onChangeEnd={v => props.onChangeEnd?.({start: v[0], end: v[1]})}
5561
sliderRef={domRef}>
5662
<SliderTrack
5763
className={track({size, labelPosition, isInForm: !!formContext})}>
5864
{({state, isDisabled}) => (
5965
<>
6066
<div className={upperTrack({isDisabled, trackStyle})} />
6167
<div style={{width: `${Math.abs(state.getThumbPercent(0) - state.getThumbPercent(1)) * 100}%`, [cssDirection]: `${state.getThumbPercent(0) * 100}%`}} className={filledTrack({isDisabled, isEmphasized, trackStyle})} />
62-
<SliderThumb className={thumbContainer} index={0} aria-label={thumbLabels?.[0]} ref={lowerThumbRef} style={(renderProps) => pressScale(lowerThumbRef, {transform: 'translate(-50%, -50%)', zIndex: state.getThumbPercent(0) === 1 ? 1 : undefined})({...renderProps, isPressed: renderProps.isDragging})}>
68+
{/* TODO: translations */}
69+
<SliderThumb className={thumbContainer} index={0} name={props.startName} aria-label="minimum" ref={lowerThumbRef} style={(renderProps) => pressScale(lowerThumbRef, {transform: 'translate(-50%, -50%)', zIndex: state.getThumbPercent(0) === 1 ? 1 : undefined})({...renderProps, isPressed: renderProps.isDragging})}>
6370
{(renderProps) => (
6471
<div className={thumbHitArea({size})}>
6572
<div
@@ -71,7 +78,7 @@ function RangeSlider<T extends number | number[]>(props: RangeSliderProps<T>, re
7178
</div>
7279
)}
7380
</SliderThumb>
74-
<SliderThumb className={thumbContainer} index={1} aria-label={thumbLabels?.[1]} ref={upperThumbRef} style={(renderProps) => pressScale(upperThumbRef, {transform: 'translate(-50%, -50%)'})({...renderProps, isPressed: renderProps.isDragging})}>
81+
<SliderThumb className={thumbContainer} index={1} name={props.endName} aria-label="maximum" ref={upperThumbRef} style={(renderProps) => pressScale(upperThumbRef, {transform: 'translate(-50%, -50%)'})({...renderProps, isPressed: renderProps.isDragging})}>
7582
{(renderProps) => (
7683
<div className={thumbHitArea({size})}>
7784
<div
@@ -90,5 +97,5 @@ function RangeSlider<T extends number | number[]>(props: RangeSliderProps<T>, re
9097
);
9198
}
9299

93-
let _RangeSlider = /*#__PURE__*/ (forwardRef as forwardRefType)(RangeSlider);
100+
let _RangeSlider = /*#__PURE__*/ forwardRef(RangeSlider);
94101
export {_RangeSlider as RangeSlider};

0 commit comments

Comments
 (0)