Skip to content

Commit 8ee13f3

Browse files
3.37 audit (#7092)
* Add some missing docs descriptions * Rename strange interface in props * Fix sizes of pending button spinner * Add docs for --tree-item-level custom property in Tree * fix ts * Require children for disclosures * Make it so Accordion isn't labellable * fix button typescript * narrow test utils exports and future proof * Remove isPending from ActionButton --------- Co-authored-by: Robert Snow <[email protected]> Co-authored-by: GitHub <[email protected]>
1 parent d3c4ffe commit 8ee13f3

File tree

15 files changed

+75
-28
lines changed

15 files changed

+75
-28
lines changed

packages/@react-aria/test-utils/src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*/
1212

1313
export {triggerLongPress} from './events';
14-
export * from './testSetup';
15-
export * from './userEventMaps';
16-
export * from './user';
14+
export {installMouseEvent, installPointerEvent} from './testSetup';
15+
export {pointerMap} from './userEventMaps';
16+
export {User} from './user';
17+
18+
export type {UserOpts} from './user';

packages/@react-spectrum/accordion/src/Accordion.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import styles from '@adobe/spectrum-css-temp/components/accordion/vars.css';
2020
import {useLocale} from '@react-aria/i18n';
2121
import {useProviderProps} from '@react-spectrum/provider';
2222

23-
export interface SpectrumAccordionProps extends Omit<DisclosureGroupProps, 'className' | 'style' | 'children'>, StyleProps, DOMProps, AriaLabelingProps {
23+
export interface SpectrumAccordionProps extends Omit<DisclosureGroupProps, 'className' | 'style' | 'children'>, StyleProps, DOMProps {
2424
/** The disclosures within the accordion group. */
2525
children: React.ReactNode
2626
}
@@ -76,7 +76,7 @@ function DisclosurePanel(props: SpectrumDisclosurePanelProps, ref: DOMRef<HTMLDi
7676
}
7777

7878
export interface SpectrumDisclosureHeaderProps extends DOMProps, AriaLabelingProps {
79-
/**
79+
/**
8080
* The heading level of the disclosure header.
8181
* @default 3
8282
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ interface ToggleButtonStyleProps {
4444
isEmphasized?: boolean
4545
}
4646

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

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
import {baseColor, fontRelative, style} from '../style/spectrum-theme' with {type: 'macro'};
13+
import {baseColor, fontRelative, size as sizeValue, style} from '../style/spectrum-theme' with {type: 'macro'};
1414
import {ButtonRenderProps, ContextValue, Link, LinkProps, OverlayTriggerStateContext, Provider, Button as RACButton, ButtonProps as RACButtonProps} from 'react-aria-components';
1515
import {centerBaseline} from './CenterBaseline';
1616
import {centerPadding, focusRing, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};
@@ -370,8 +370,21 @@ function Button(props: ButtonProps, ref: FocusableRef<HTMLButtonElement>) {
370370
isProgressVisible: 1
371371
}
372372
})({isProgressVisible, isPending})}>
373-
{/* TODO: size based on t-shirt size once ProgressCircle supports custom sizes */}
374-
<ProgressCircle isIndeterminate aria-label={stringFormatter.format('button.pending')} size="S" staticColor={staticColor} UNSAFE_style={{display: 'block'}} />
373+
<ProgressCircle
374+
isIndeterminate
375+
aria-label={stringFormatter.format('button.pending')}
376+
size="S"
377+
staticColor={staticColor}
378+
styles={style({
379+
size: {
380+
size: {
381+
S: sizeValue(14),
382+
M: sizeValue(18),
383+
L: 20,
384+
XL: 24
385+
}
386+
}
387+
})({size})} />
375388
</div>
376389
}
377390
</Provider>
@@ -405,7 +418,8 @@ function LinkButton(props: LinkButtonProps, ref: FocusableRef<HTMLAnchorElement>
405418
variant: props.variant || 'primary',
406419
fillStyle: props.fillStyle || 'fill',
407420
size: props.size || 'M',
408-
staticColor: props.staticColor
421+
staticColor: props.staticColor,
422+
isPending: false
409423
}, props.styles)}>
410424
<Provider
411425
values={[

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import {ContextValue, ProgressBar as RACProgressBar, ProgressBarProps as RACProgressBarProps} from 'react-aria-components';
1414
import {createContext, forwardRef} from 'react';
1515
import {DOMRef, DOMRefValue} from '@react-types/shared';
16-
import {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};
16+
import {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};
1717
import {keyframes} from '../style/style-macro' with {type: 'macro'};
1818
import {style} from '../style/spectrum-theme' with {type: 'macro'};
1919
import {useDOMRef} from '@react-spectrum/utils';
@@ -45,8 +45,7 @@ const wrapper = style<ProgressCircleStyleProps>({
4545
L: 64
4646
}
4747
},
48-
aspectRatio: 'square',
49-
display: 'inline-block'
48+
aspectRatio: 'square'
5049
}, getAllowedOverrides({height: true}));
5150

5251
const track = style<ProgressCircleStyleProps>({
@@ -73,7 +72,10 @@ const fill = style<ProgressCircleStyleProps>({
7372
transformOrigin: 'center'
7473
});
7574

76-
export interface ProgressCircleProps extends Omit<RACProgressBarProps, 'children' | 'style' | 'valueLabel' | 'formatOptions' | 'label' | 'className'>, ProgressCircleStyleProps, StyleProps {}
75+
export interface ProgressCircleProps extends Omit<RACProgressBarProps, 'children' | 'style' | 'valueLabel' | 'formatOptions' | 'label' | 'className'>, ProgressCircleStyleProps, UnsafeStyles {
76+
/** Spectrum-defined styles, returned by the `style()` macro. */
77+
styles?: StylesPropWithHeight
78+
}
7779

7880
const rotationAnimation = keyframes(`
7981
0% {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,13 @@ function SegmentedControlItem(props: SegmentedControlItemProps, ref: FocusableRe
259259
}
260260

261261
/**
262-
* A control items represents an individual control within a segmented control.
262+
* A SegmentedControlItem represents an option within a SegmentedControl.
263263
*/
264264
const _SegmentedControlItem = /*#__PURE__*/ forwardRef(SegmentedControlItem);
265265
export {_SegmentedControlItem as SegmentedControlItem};
266266

267267
/**
268-
* A segmented control is a mutually exclusive group of buttons, with or without a track.
268+
* A SegmentedControl is a mutually exclusive group of buttons used for view switching.
269269
*/
270270
const _SegmentedControl = /*#__PURE__*/ forwardRef(SegmentedControl);
271271
export {_SegmentedControl as SegmentedControl};

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export interface SkeletonProps {
6464
isLoading: boolean
6565
}
6666

67+
/**
68+
* A Skeleton wraps around content to render it as a placeholder.
69+
*/
6770
export function Skeleton({children, isLoading}: SkeletonProps) {
6871
// Disable all form components inside a skeleton.
6972
return (

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export interface SkeletonCollectionProps {
1919
}
2020

2121
let cache = new WeakMap();
22+
23+
/**
24+
* A SkeletonCollection generates placeholder content within a collection component such as CardView.
25+
*/
2226
export const SkeletonCollection = createLeafComponent('skeleton', (props: SkeletonCollectionProps, ref, node) => {
2327
// Cache rendering based on node object identity. This allows the children function to randomize
2428
// its content (e.g. heights) and preserve on re-renders.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ function ToggleButton(props: ToggleButtonProps, ref: FocusableRef<HTMLButtonElem
4848
staticColor: props.staticColor,
4949
size: props.size,
5050
isQuiet: props.isQuiet,
51-
isEmphasized: props.isEmphasized
51+
isEmphasized: props.isEmphasized,
52+
isPending: false
5253
}, props.styles)}>
5354
<Provider
5455
values={[

packages/@react-stately/data/docs/useTreeData.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ as the unique key for that item, and the `items` property as the children. In ad
6262
for the listbox, which will automatically be updated when items are removed from the tree.
6363

6464
```tsx
65-
interface Iitem {
65+
interface ItemValue {
6666
name: string;
67-
items?: Array<Iitem>;
67+
items?: Array<ItemValue>;
6868
}
6969

70-
let tree = useTreeData<Iitem>({
70+
let tree = useTreeData<ItemValue>({
7171
initialItems: [
7272
{
7373
name: 'People',

0 commit comments

Comments
 (0)