@react-spectrum/s2 3.0.0-nightly-1457dedc6-250313 → 3.0.0-nightly-9d471e48d-250314
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActionBar.cjs.map +1 -1
- package/dist/ActionBar.css.map +1 -1
- package/dist/ActionBar.mjs.map +1 -1
- package/dist/Add.cjs.map +1 -1
- package/dist/Add.mjs.map +1 -1
- package/dist/Asterisk.cjs.map +1 -1
- package/dist/Asterisk.mjs.map +1 -1
- package/dist/CenterBaseline.cjs.map +1 -1
- package/dist/CenterBaseline.css.map +1 -1
- package/dist/CenterBaseline.mjs.map +1 -1
- package/dist/Checkmark.cjs.map +1 -1
- package/dist/Checkmark.mjs.map +1 -1
- package/dist/Chevron.cjs.map +1 -1
- package/dist/Chevron.mjs.map +1 -1
- package/dist/ColorHandle.cjs.map +1 -1
- package/dist/ColorHandle.css.map +1 -1
- package/dist/ColorHandle.mjs.map +1 -1
- package/dist/ComboBox.cjs.map +1 -1
- package/dist/ComboBox.css.map +1 -1
- package/dist/ComboBox.mjs.map +1 -1
- package/dist/Cross.cjs.map +1 -1
- package/dist/Cross.mjs.map +1 -1
- package/dist/Dash.cjs.map +1 -1
- package/dist/Dash.mjs.map +1 -1
- package/dist/DialogContainer.cjs.map +1 -1
- package/dist/DialogContainer.mjs.map +1 -1
- package/dist/DialogTrigger.cjs.map +1 -1
- package/dist/DialogTrigger.mjs.map +1 -1
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css.map +1 -1
- package/dist/Field.mjs.map +1 -1
- package/dist/ImageCoordinator.cjs.map +1 -1
- package/dist/ImageCoordinator.mjs.map +1 -1
- package/dist/LinkOut.cjs.map +1 -1
- package/dist/LinkOut.mjs.map +1 -1
- package/dist/Menu.cjs.map +1 -1
- package/dist/Menu.css.map +1 -1
- package/dist/Menu.mjs.map +1 -1
- package/dist/Picker.cjs.map +1 -1
- package/dist/Picker.css.map +1 -1
- package/dist/Picker.mjs.map +1 -1
- package/dist/Provider.cjs.map +1 -1
- package/dist/Provider.css.map +1 -1
- package/dist/Provider.mjs.map +1 -1
- package/dist/Slider.cjs.map +1 -1
- package/dist/Slider.css.map +1 -1
- package/dist/Slider.mjs.map +1 -1
- package/dist/Tabs.cjs +1 -0
- package/dist/Tabs.cjs.map +1 -1
- package/dist/Tabs.css.map +1 -1
- package/dist/Tabs.mjs +1 -0
- package/dist/Tabs.mjs.map +1 -1
- package/dist/TabsPicker.cjs.map +1 -1
- package/dist/TabsPicker.css.map +1 -1
- package/dist/TabsPicker.mjs.map +1 -1
- package/dist/Tooltip.cjs.map +1 -1
- package/dist/Tooltip.css.map +1 -1
- package/dist/Tooltip.mjs.map +1 -1
- package/dist/TreeView.cjs.map +1 -1
- package/dist/TreeView.css.map +1 -1
- package/dist/TreeView.mjs.map +1 -1
- package/dist/pressScale.cjs.map +1 -1
- package/dist/pressScale.mjs.map +1 -1
- package/dist/types.d.ts +20 -20
- package/dist/types.d.ts.map +1 -1
- package/icons/Skeleton.cjs.map +1 -1
- package/icons/Skeleton.css.map +1 -1
- package/icons/Skeleton.mjs.map +1 -1
- package/package.json +18 -18
- package/src/ActionBar.tsx +9 -2
- package/src/Calendar.tsx +2 -1
- package/src/CenterBaseline.tsx +1 -1
- package/src/ColorHandle.tsx +2 -2
- package/src/ComboBox.tsx +2 -2
- package/src/DateField.tsx +1 -1
- package/src/DatePicker.tsx +1 -1
- package/src/DateRangePicker.tsx +1 -1
- package/src/DialogContainer.tsx +2 -2
- package/src/DialogTrigger.tsx +2 -1
- package/src/Field.tsx +2 -2
- package/src/ImageCoordinator.tsx +3 -3
- package/src/ListBox.tsx +3 -2
- package/src/Menu.tsx +5 -5
- package/src/Picker.tsx +2 -2
- package/src/Provider.tsx +1 -1
- package/src/RangeCalendar.tsx +2 -1
- package/src/Skeleton.tsx +4 -4
- package/src/Slider.tsx +1 -1
- package/src/Tabs.tsx +4 -3
- package/src/TabsPicker.tsx +1 -1
- package/src/TimeField.tsx +1 -1
- package/src/Toolbar.tsx +2 -1
- package/src/Tooltip.tsx +2 -2
- package/src/TreeView.tsx +2 -2
- package/src/page.macro.ts +3 -3
- package/src/pressScale.ts +1 -1
- package/src/style-utils.ts +2 -2
- package/style/dist/spectrum-theme.cjs.map +1 -1
- package/style/dist/spectrum-theme.mjs.map +1 -1
- package/style/dist/style-macro.cjs.map +1 -1
- package/style/dist/style-macro.mjs.map +1 -1
- package/style/dist/types.d.ts +4 -4
- package/style/dist/types.d.ts.map +1 -1
- package/style/spectrum-theme.ts +5 -5
- package/style/style-macro.ts +3 -3
- package/style/tokens.ts +22 -6
package/src/Calendar.tsx
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
Heading,
|
|
21
21
|
Text
|
|
22
22
|
} from 'react-aria-components';
|
|
23
|
+
import {ReactNode} from 'react';
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
export interface CalendarProps<T extends DateValue>
|
|
@@ -29,7 +30,7 @@ export interface CalendarProps<T extends DateValue>
|
|
|
29
30
|
|
|
30
31
|
export function Calendar<T extends DateValue>(
|
|
31
32
|
{errorMessage, ...props}: CalendarProps<T>
|
|
32
|
-
) {
|
|
33
|
+
): ReactNode {
|
|
33
34
|
return (
|
|
34
35
|
<AriaCalendar {...props}>
|
|
35
36
|
<header>
|
package/src/CenterBaseline.tsx
CHANGED
package/src/ColorHandle.tsx
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {cloneElement, JSX, RefObject, useState} from 'react';
|
|
13
|
+
import {cloneElement, JSX, ReactNode, RefObject, useState} from 'react';
|
|
14
14
|
import {ColorThumb} from 'react-aria-components';
|
|
15
15
|
import {createPortal} from 'react-dom';
|
|
16
16
|
import {keyframes} from '../style/style-macro' with {type: 'macro'};
|
|
@@ -28,7 +28,7 @@ interface ColorHandleProps {
|
|
|
28
28
|
getPosition: () => {x: number, y: number}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export function ColorHandle({containerRef, getPosition}: ColorHandleProps) {
|
|
31
|
+
export function ColorHandle({containerRef, getPosition}: ColorHandleProps): ReactNode {
|
|
32
32
|
return (
|
|
33
33
|
<ColorThumb
|
|
34
34
|
className={style({
|
package/src/ComboBox.tsx
CHANGED
|
@@ -338,7 +338,7 @@ const checkmarkIconSize = {
|
|
|
338
338
|
XL: 'XL'
|
|
339
339
|
} as const;
|
|
340
340
|
|
|
341
|
-
export function ComboBoxItem(props: ComboBoxItemProps) {
|
|
341
|
+
export function ComboBoxItem(props: ComboBoxItemProps): ReactNode {
|
|
342
342
|
let ref = useRef(null);
|
|
343
343
|
let isLink = props.href != null;
|
|
344
344
|
let {size} = useContext(InternalComboboxContext);
|
|
@@ -378,7 +378,7 @@ export function ComboBoxItem(props: ComboBoxItemProps) {
|
|
|
378
378
|
}
|
|
379
379
|
|
|
380
380
|
export interface ComboBoxSectionProps<T extends object> extends SectionProps<T> {}
|
|
381
|
-
export function ComboBoxSection<T extends object>(props: ComboBoxSectionProps<T>) {
|
|
381
|
+
export function ComboBoxSection<T extends object>(props: ComboBoxSectionProps<T>): ReactNode {
|
|
382
382
|
let {size} = useContext(InternalComboboxContext);
|
|
383
383
|
return (
|
|
384
384
|
<>
|
package/src/DateField.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export interface DateFieldProps<T extends DateValue>
|
|
|
31
31
|
|
|
32
32
|
export function DateField<T extends DateValue>(
|
|
33
33
|
{label, description, errorMessage, ...props}: DateFieldProps<T>
|
|
34
|
-
) {
|
|
34
|
+
): ReactNode {
|
|
35
35
|
return (
|
|
36
36
|
<AriaDateField {...props}>
|
|
37
37
|
<Label>{label}</Label>
|
package/src/DatePicker.tsx
CHANGED
|
@@ -38,7 +38,7 @@ export interface DatePickerProps<T extends DateValue>
|
|
|
38
38
|
|
|
39
39
|
export function DatePicker<T extends DateValue>(
|
|
40
40
|
{label, description, errorMessage, ...props}: DatePickerProps<T>
|
|
41
|
-
) {
|
|
41
|
+
): ReactNode {
|
|
42
42
|
return (
|
|
43
43
|
<AriaDatePicker {...props}>
|
|
44
44
|
<Label>{label}</Label>
|
package/src/DateRangePicker.tsx
CHANGED
|
@@ -38,7 +38,7 @@ export interface DateRangePickerProps<T extends DateValue>
|
|
|
38
38
|
|
|
39
39
|
export function DateRangePicker<T extends DateValue>(
|
|
40
40
|
{label, description, errorMessage, ...props}: DateRangePickerProps<T>
|
|
41
|
-
) {
|
|
41
|
+
): ReactNode {
|
|
42
42
|
return (
|
|
43
43
|
<AriaDateRangePicker {...props}>
|
|
44
44
|
<Label>{label}</Label>
|
package/src/DialogContainer.tsx
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {ModalContext, useSlottedContext} from 'react-aria-components';
|
|
14
|
-
import React, {ReactElement, useState} from 'react';
|
|
14
|
+
import React, {ReactElement, ReactNode, useState} from 'react';
|
|
15
15
|
import {SpectrumDialogContainerProps} from '@react-types/dialog';
|
|
16
16
|
|
|
17
17
|
export interface DialogContainerProps extends Omit<SpectrumDialogContainerProps, 'type' | 'isDismissable' | 'isKeyboardDismissDisabled'> {}
|
|
@@ -21,7 +21,7 @@ export interface DialogContainerProps extends Omit<SpectrumDialogContainerProps,
|
|
|
21
21
|
* it in a modal. Useful in cases where there is no trigger element
|
|
22
22
|
* or when the trigger unmounts while the dialog is open.
|
|
23
23
|
*/
|
|
24
|
-
export function DialogContainer(props: DialogContainerProps) {
|
|
24
|
+
export function DialogContainer(props: DialogContainerProps): ReactNode {
|
|
25
25
|
let {
|
|
26
26
|
children,
|
|
27
27
|
onDismiss
|
package/src/DialogTrigger.tsx
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import {DialogTrigger as AriaDialogTrigger, DialogTriggerProps as AriaDialogTriggerProps} from 'react-aria-components';
|
|
14
14
|
import {PressResponder} from '@react-aria/interactions';
|
|
15
|
+
import {ReactNode} from 'react';
|
|
15
16
|
|
|
16
17
|
export interface DialogTriggerProps extends AriaDialogTriggerProps {}
|
|
17
18
|
|
|
@@ -20,7 +21,7 @@ export interface DialogTriggerProps extends AriaDialogTriggerProps {}
|
|
|
20
21
|
* open state with the trigger's press state. Additionally, it allows you to customize the type and
|
|
21
22
|
* positioning of the Dialog.
|
|
22
23
|
*/
|
|
23
|
-
export function DialogTrigger(props: DialogTriggerProps) {
|
|
24
|
+
export function DialogTrigger(props: DialogTriggerProps): ReactNode {
|
|
24
25
|
return (
|
|
25
26
|
<AriaDialogTrigger {...props}>
|
|
26
27
|
{/* RAC sets isPressed via PressResponder when the dialog is open.
|
package/src/Field.tsx
CHANGED
|
@@ -276,7 +276,7 @@ const helpTextStyles = style({
|
|
|
276
276
|
}
|
|
277
277
|
});
|
|
278
278
|
|
|
279
|
-
export function HelpText(props: HelpTextProps & {descriptionRef?: DOMRef<HTMLDivElement>, errorRef?: DOMRef<HTMLDivElement>}) {
|
|
279
|
+
export function HelpText(props: HelpTextProps & {descriptionRef?: DOMRef<HTMLDivElement>, errorRef?: DOMRef<HTMLDivElement>}): ReactNode {
|
|
280
280
|
let domDescriptionRef = useDOMRef(props.descriptionRef || null);
|
|
281
281
|
let domErrorRef = useDOMRef(props.errorRef || null);
|
|
282
282
|
|
|
@@ -308,7 +308,7 @@ export function HelpText(props: HelpTextProps & {descriptionRef?: DOMRef<HTMLDiv
|
|
|
308
308
|
);
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
export function FieldErrorIcon(props: {isDisabled?: boolean}) {
|
|
311
|
+
export function FieldErrorIcon(props: {isDisabled?: boolean}): ReactNode {
|
|
312
312
|
return (
|
|
313
313
|
<Provider
|
|
314
314
|
values={[
|
package/src/ImageCoordinator.tsx
CHANGED
|
@@ -44,7 +44,7 @@ interface State {
|
|
|
44
44
|
loaded: Map<string, boolean>
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
type Action =
|
|
47
|
+
type Action =
|
|
48
48
|
| {type: 'register', url: string}
|
|
49
49
|
| {type: 'unregister', url: string}
|
|
50
50
|
| {type: 'load', url: string}
|
|
@@ -120,7 +120,7 @@ function isAllLoaded(loaded: Map<string, boolean>) {
|
|
|
120
120
|
* An ImageCoordinator coordinates loading behavior for a group of images.
|
|
121
121
|
* Images within an ImageCoordinator are revealed together once all of them have loaded.
|
|
122
122
|
*/
|
|
123
|
-
export function ImageCoordinator(props: ImageCoordinatorProps) {
|
|
123
|
+
export function ImageCoordinator(props: ImageCoordinatorProps): ReactNode {
|
|
124
124
|
// If we are already inside another ImageCoordinator, just pass
|
|
125
125
|
// through children and coordinate loading at the root.
|
|
126
126
|
let ctx = useContext(props.group || DefaultImageGroup);
|
|
@@ -139,7 +139,7 @@ function ImageCoordinatorRoot(props: ImageCoordinatorProps) {
|
|
|
139
139
|
loadStartTime: 0,
|
|
140
140
|
loaded: new Map()
|
|
141
141
|
});
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
let register = useCallback((url: string) => dispatch({type: 'register', url}), []);
|
|
144
144
|
let unregister = useCallback((url: string) => dispatch({type: 'unregister', url}), []);
|
|
145
145
|
let load = useCallback((url: string) => dispatch({type: 'load', url}), []);
|
package/src/ListBox.tsx
CHANGED
|
@@ -16,11 +16,12 @@ import {
|
|
|
16
16
|
ListBoxItemProps,
|
|
17
17
|
ListBoxProps
|
|
18
18
|
} from 'react-aria-components';
|
|
19
|
+
import {ReactNode} from 'react';
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
export function ListBox<T extends object>(
|
|
22
23
|
{children, ...props}: ListBoxProps<T>
|
|
23
|
-
) {
|
|
24
|
+
): ReactNode {
|
|
24
25
|
return (
|
|
25
26
|
<AriaListBox {...props}>
|
|
26
27
|
{children}
|
|
@@ -28,6 +29,6 @@ export function ListBox<T extends object>(
|
|
|
28
29
|
);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
export function ListBoxItem(props: ListBoxItemProps) {
|
|
32
|
+
export function ListBoxItem(props: ListBoxItemProps): ReactNode {
|
|
32
33
|
return <AriaListBoxItem {...props} />;
|
|
33
34
|
}
|
package/src/Menu.tsx
CHANGED
|
@@ -406,7 +406,7 @@ export const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T
|
|
|
406
406
|
return content;
|
|
407
407
|
});
|
|
408
408
|
|
|
409
|
-
export function Divider(props: SeparatorProps) {
|
|
409
|
+
export function Divider(props: SeparatorProps): ReactNode {
|
|
410
410
|
return (
|
|
411
411
|
<Separator
|
|
412
412
|
{...props}
|
|
@@ -429,7 +429,7 @@ export function Divider(props: SeparatorProps) {
|
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
export interface MenuSectionProps<T extends object> extends AriaMenuSectionProps<T> {}
|
|
432
|
-
export function MenuSection<T extends object>(props: MenuSectionProps<T>) {
|
|
432
|
+
export function MenuSection<T extends object>(props: MenuSectionProps<T>): ReactNode {
|
|
433
433
|
// remember, context doesn't work if it's around Section nor inside
|
|
434
434
|
let {size} = useContext(InternalMenuContext);
|
|
435
435
|
return (
|
|
@@ -465,7 +465,7 @@ const linkIconSize = {
|
|
|
465
465
|
XL: 'XL'
|
|
466
466
|
} as const;
|
|
467
467
|
|
|
468
|
-
export function MenuItem(props: MenuItemProps) {
|
|
468
|
+
export function MenuItem(props: MenuItemProps): ReactNode {
|
|
469
469
|
let ref = useRef(null);
|
|
470
470
|
let isLink = props.href != null;
|
|
471
471
|
let isLinkOut = isLink && props.target === '_blank';
|
|
@@ -548,7 +548,7 @@ export function MenuItem(props: MenuItemProps) {
|
|
|
548
548
|
* The MenuTrigger serves as a wrapper around a Menu and its associated trigger,
|
|
549
549
|
* linking the Menu's open state with the trigger's press state.
|
|
550
550
|
*/
|
|
551
|
-
function MenuTrigger(props: MenuTriggerProps) {
|
|
551
|
+
function MenuTrigger(props: MenuTriggerProps): ReactNode {
|
|
552
552
|
// RAC sets isPressed via PressResponder when the menu is open.
|
|
553
553
|
// We don't want press scaling to appear to get "stuck", so override this.
|
|
554
554
|
// For mouse interactions, menus open on press start. When the popover underlay appears
|
|
@@ -591,6 +591,6 @@ export {MenuTrigger, SubmenuTrigger};
|
|
|
591
591
|
// This is purely so that storybook generates the types for both Menu and MenuTrigger
|
|
592
592
|
interface ICombined<T extends object> extends MenuProps<T>, Omit<MenuTriggerProps, 'children'> {}
|
|
593
593
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
594
|
-
export function CombinedMenu<T extends object>(props: ICombined<T>) {
|
|
594
|
+
export function CombinedMenu<T extends object>(props: ICombined<T>): ReactNode {
|
|
595
595
|
return <div />;
|
|
596
596
|
}
|
package/src/Picker.tsx
CHANGED
|
@@ -436,7 +436,7 @@ const checkmarkIconSize = {
|
|
|
436
436
|
XL: 'XL'
|
|
437
437
|
} as const;
|
|
438
438
|
|
|
439
|
-
export function PickerItem(props: PickerItemProps) {
|
|
439
|
+
export function PickerItem(props: PickerItemProps): ReactNode {
|
|
440
440
|
let ref = useRef(null);
|
|
441
441
|
let isLink = props.href != null;
|
|
442
442
|
let {size} = useContext(InternalPickerContext);
|
|
@@ -484,7 +484,7 @@ function DefaultProvider({context, value, children}: {context: React.Context<any
|
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
export interface PickerSectionProps<T extends object> extends SectionProps<T> {}
|
|
487
|
-
export function PickerSection<T extends object>(props: PickerSectionProps<T>) {
|
|
487
|
+
export function PickerSection<T extends object>(props: PickerSectionProps<T>): ReactNode {
|
|
488
488
|
let {size} = useContext(InternalPickerContext);
|
|
489
489
|
return (
|
|
490
490
|
<>
|
package/src/Provider.tsx
CHANGED
|
@@ -50,7 +50,7 @@ export interface ProviderProps extends UnsafeStyles {
|
|
|
50
50
|
|
|
51
51
|
export const ColorSchemeContext = createContext<ColorScheme | 'light dark' | null>(null);
|
|
52
52
|
|
|
53
|
-
export function Provider(props: ProviderProps) {
|
|
53
|
+
export function Provider(props: ProviderProps): ReactNode {
|
|
54
54
|
let result = <ProviderInner {...props} />;
|
|
55
55
|
let parentColorScheme = useContext(ColorSchemeContext);
|
|
56
56
|
let colorScheme = props.colorScheme || parentColorScheme;
|
package/src/RangeCalendar.tsx
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
Heading,
|
|
21
21
|
Text
|
|
22
22
|
} from 'react-aria-components';
|
|
23
|
+
import {ReactNode} from 'react';
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
export interface RangeCalendarProps<T extends DateValue>
|
|
@@ -29,7 +30,7 @@ export interface RangeCalendarProps<T extends DateValue>
|
|
|
29
30
|
|
|
30
31
|
export function RangeCalendar<T extends DateValue>(
|
|
31
32
|
{errorMessage, ...props}: RangeCalendarProps<T>
|
|
32
|
-
) {
|
|
33
|
+
): ReactNode {
|
|
33
34
|
return (
|
|
34
35
|
<AriaRangeCalendar {...props}>
|
|
35
36
|
<header>
|
package/src/Skeleton.tsx
CHANGED
|
@@ -19,7 +19,7 @@ import {style} from '../style' with {type: 'macro'};
|
|
|
19
19
|
import {StyleString} from '../style/types';
|
|
20
20
|
import {useMediaQuery} from '@react-spectrum/utils';
|
|
21
21
|
|
|
22
|
-
export function useLoadingAnimation(isAnimating: boolean) {
|
|
22
|
+
export function useLoadingAnimation(isAnimating: boolean): (element: HTMLElement | null) => void {
|
|
23
23
|
let animationRef = useRef<Animation | null>(null);
|
|
24
24
|
let reduceMotion = useMediaQuery('(prefers-reduced-motion: reduce)');
|
|
25
25
|
return useCallback((element: HTMLElement | null) => {
|
|
@@ -65,7 +65,7 @@ export interface SkeletonProps {
|
|
|
65
65
|
/**
|
|
66
66
|
* A Skeleton wraps around content to render it as a placeholder.
|
|
67
67
|
*/
|
|
68
|
-
export function Skeleton({children, isLoading}: SkeletonProps) {
|
|
68
|
+
export function Skeleton({children, isLoading}: SkeletonProps): ReactNode {
|
|
69
69
|
// Disable all form components inside a skeleton.
|
|
70
70
|
return (
|
|
71
71
|
<SkeletonContext.Provider value={isLoading}>
|
|
@@ -97,7 +97,7 @@ export function useSkeletonText(children: ReactNode, style: CSSProperties | unde
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// Rendered inside <Text> to create skeleton line boxes via box-decoration-break.
|
|
100
|
-
export function SkeletonText({children}) {
|
|
100
|
+
export function SkeletonText({children}: {children: ReactNode}): ReactNode {
|
|
101
101
|
return (
|
|
102
102
|
<span
|
|
103
103
|
// @ts-ignore - compatibility with React < 19
|
|
@@ -114,7 +114,7 @@ export function SkeletonText({children}) {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// Clones the child element and displays it with skeleton styling.
|
|
117
|
-
export function SkeletonWrapper({children}: {children: SkeletonElement}) {
|
|
117
|
+
export function SkeletonWrapper({children}: {children: SkeletonElement}): ReactNode {
|
|
118
118
|
let isLoading = useContext(SkeletonContext);
|
|
119
119
|
let animation = useLoadingAnimation(isLoading || false);
|
|
120
120
|
if (isLoading == null) {
|
package/src/Slider.tsx
CHANGED
|
@@ -317,7 +317,7 @@ export let filledTrack = style({
|
|
|
317
317
|
translateY: '[-50%]'
|
|
318
318
|
});
|
|
319
319
|
|
|
320
|
-
export function SliderBase<T extends number | number[]>(props: SliderBaseProps<T> & {sliderRef: RefObject<HTMLDivElement | null>}) {
|
|
320
|
+
export function SliderBase<T extends number | number[]>(props: SliderBaseProps<T> & {sliderRef: RefObject<HTMLDivElement | null>}): ReactNode {
|
|
321
321
|
let formContext = useContext(FormContext);
|
|
322
322
|
props = useFormProps(props);
|
|
323
323
|
let {
|
package/src/Tabs.tsx
CHANGED
|
@@ -182,12 +182,13 @@ const tablist = style({
|
|
|
182
182
|
flexBasis: '[0%]'
|
|
183
183
|
});
|
|
184
184
|
|
|
185
|
-
export function TabList<T extends object>(props: TabListProps<T>) {
|
|
185
|
+
export function TabList<T extends object>(props: TabListProps<T>): ReactNode | null {
|
|
186
186
|
let {showTabs} = useContext(CollapseContext) ?? {};
|
|
187
187
|
|
|
188
188
|
if (showTabs) {
|
|
189
189
|
return <TabListInner {...props} />;
|
|
190
190
|
}
|
|
191
|
+
return null;
|
|
191
192
|
}
|
|
192
193
|
|
|
193
194
|
function TabListInner<T extends object>(props: TabListProps<T>) {
|
|
@@ -362,7 +363,7 @@ const icon = style({
|
|
|
362
363
|
}
|
|
363
364
|
});
|
|
364
365
|
|
|
365
|
-
export function Tab(props: TabProps) {
|
|
366
|
+
export function Tab(props: TabProps): ReactNode {
|
|
366
367
|
let {density, labelBehavior} = useContext(InternalTabsContext) ?? {};
|
|
367
368
|
|
|
368
369
|
let contentId = useId();
|
|
@@ -421,7 +422,7 @@ const tabPanel = style({
|
|
|
421
422
|
minWidth: 0
|
|
422
423
|
}, getAllowedOverrides({height: true}));
|
|
423
424
|
|
|
424
|
-
export function TabPanel(props: TabPanelProps) {
|
|
425
|
+
export function TabPanel(props: TabPanelProps): ReactNode | null {
|
|
425
426
|
let {showTabs} = useContext(CollapseContext);
|
|
426
427
|
let {selectedKey} = useContext(InternalTabsContext);
|
|
427
428
|
if (showTabs) {
|
package/src/TabsPicker.tsx
CHANGED
|
@@ -305,7 +305,7 @@ function TabLine(props) {
|
|
|
305
305
|
export interface PickerItemProps extends Omit<ListBoxItemProps, 'children' | 'style' | 'className'>, StyleProps {
|
|
306
306
|
children: ReactNode
|
|
307
307
|
}
|
|
308
|
-
export function PickerItem(props: PickerItemProps) {
|
|
308
|
+
export function PickerItem(props: PickerItemProps): ReactNode {
|
|
309
309
|
let ref = useRef(null);
|
|
310
310
|
let isLink = props.href != null;
|
|
311
311
|
const size = 'M';
|
package/src/TimeField.tsx
CHANGED
|
@@ -30,7 +30,7 @@ export interface TimeFieldProps<T extends TimeValue>
|
|
|
30
30
|
|
|
31
31
|
export function TimeField<T extends TimeValue>(
|
|
32
32
|
{label, description, errorMessage, ...props}: TimeFieldProps<T>
|
|
33
|
-
) {
|
|
33
|
+
): ReactNode {
|
|
34
34
|
return (
|
|
35
35
|
<AriaTimeField {...props}>
|
|
36
36
|
<Label>{label}</Label>
|
package/src/Toolbar.tsx
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {Toolbar as RACToolbar, ToolbarProps} from 'react-aria-components';
|
|
14
|
+
import {ReactNode} from 'react';
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
export function Toolbar(props: ToolbarProps) {
|
|
17
|
+
export function Toolbar(props: ToolbarProps): ReactNode {
|
|
17
18
|
return <RACToolbar {...props} />;
|
|
18
19
|
}
|
package/src/Tooltip.tsx
CHANGED
|
@@ -186,7 +186,7 @@ export const Tooltip = forwardRef(function Tooltip(props: TooltipProps, ref: DOM
|
|
|
186
186
|
* the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip
|
|
187
187
|
* relative to the trigger.
|
|
188
188
|
*/
|
|
189
|
-
export function TooltipTrigger(props: TooltipTriggerProps) {
|
|
189
|
+
export function TooltipTrigger(props: TooltipTriggerProps): ReactNode {
|
|
190
190
|
let {
|
|
191
191
|
containerPadding,
|
|
192
192
|
crossOffset,
|
|
@@ -216,6 +216,6 @@ export function TooltipTrigger(props: TooltipTriggerProps) {
|
|
|
216
216
|
// This is purely so that storybook generates the types for both Menu and MenuTrigger
|
|
217
217
|
interface ICombined extends Omit<TooltipProps, 'placement'>, TooltipTriggerProps {}
|
|
218
218
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
219
|
-
export function CombinedTooltip(props: ICombined) {
|
|
219
|
+
export function CombinedTooltip(props: ICombined): ReactNode {
|
|
220
220
|
return <div />;
|
|
221
221
|
}
|
package/src/TreeView.tsx
CHANGED
|
@@ -294,7 +294,7 @@ const treeRowFocusIndicator = raw(`
|
|
|
294
294
|
}`
|
|
295
295
|
);
|
|
296
296
|
|
|
297
|
-
export const TreeViewItem = (props: TreeViewItemProps) => {
|
|
297
|
+
export const TreeViewItem = (props: TreeViewItemProps): ReactNode => {
|
|
298
298
|
let {
|
|
299
299
|
href
|
|
300
300
|
} = props;
|
|
@@ -315,7 +315,7 @@ export interface TreeViewItemContentProps extends Omit<TreeItemContentProps, 'ch
|
|
|
315
315
|
children: ReactNode
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
export const TreeViewItemContent = (props: TreeViewItemContentProps) => {
|
|
318
|
+
export const TreeViewItemContent = (props: TreeViewItemContentProps): ReactNode => {
|
|
319
319
|
let {
|
|
320
320
|
children
|
|
321
321
|
} = props;
|
package/src/page.macro.ts
CHANGED
|
@@ -21,7 +21,7 @@ function weirdColorToken(token: typeof tokens['background-layer-2-color']) {
|
|
|
21
21
|
return `light-dark(${token.sets.light.sets.light.value}, ${token.sets.dark.sets.dark.value})`;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export function generatePageStyles(this: MacroContext | void) {
|
|
24
|
+
export function generatePageStyles(this: MacroContext | void): void {
|
|
25
25
|
if (this && typeof this.addAsset === 'function') {
|
|
26
26
|
this.addAsset({
|
|
27
27
|
type: 'css',
|
|
@@ -55,13 +55,13 @@ export function generatePageStyles(this: MacroContext | void) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
// This generates a low specificity rule to define default values for
|
|
58
|
+
// This generates a low specificity rule to define default values for
|
|
59
59
|
// --lightningcss-light and --lightningcss-dark. This is used when rendering
|
|
60
60
|
// a <Provider> without setting a colorScheme prop, and when page.css is not present.
|
|
61
61
|
// It is equivalent to setting `color-scheme: light dark`, but without overriding
|
|
62
62
|
// the browser default for content outside the provider.
|
|
63
63
|
// Also set defaults for --s2-scale here.
|
|
64
|
-
export function generateDefaultColorSchemeStyles(this: MacroContext | void) {
|
|
64
|
+
export function generateDefaultColorSchemeStyles(this: MacroContext | void): void {
|
|
65
65
|
if (this && typeof this.addAsset === 'function') {
|
|
66
66
|
this.addAsset({
|
|
67
67
|
type: 'css',
|
package/src/pressScale.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import {composeRenderProps} from 'react-aria-components';
|
|
14
14
|
import {CSSProperties, RefObject} from 'react';
|
|
15
15
|
|
|
16
|
-
export function pressScale<R extends {isPressed: boolean}>(ref: RefObject<HTMLElement | null>, style?: CSSProperties | ((renderProps: R) => CSSProperties)) {
|
|
16
|
+
export function pressScale<R extends {isPressed: boolean}>(ref: RefObject<HTMLElement | null>, style?: CSSProperties | ((renderProps: R) => CSSProperties)): (renderProps: R) => CSSProperties {
|
|
17
17
|
return composeRenderProps(style, (style, renderProps: R) => {
|
|
18
18
|
if (renderProps.isPressed && ref.current) {
|
|
19
19
|
let {width = 0, height = 0} = ref.current.getBoundingClientRect() ?? {};
|
package/src/style-utils.ts
CHANGED
|
@@ -124,7 +124,7 @@ export const colorScheme = () => ({
|
|
|
124
124
|
}
|
|
125
125
|
} as const);
|
|
126
126
|
|
|
127
|
-
export function staticColor() {
|
|
127
|
+
export function staticColor(): Record<string, any> {
|
|
128
128
|
return {
|
|
129
129
|
'--s2-container-bg': {
|
|
130
130
|
type: 'backgroundColor',
|
|
@@ -198,6 +198,6 @@ export interface StyleProps extends UnsafeStyles {
|
|
|
198
198
|
styles?: StylesProp
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
export function getAllowedOverrides({width = true, height = false} = {}) {
|
|
201
|
+
export function getAllowedOverrides({width = true, height = false} = {}): string[] {
|
|
202
202
|
return (allowedOverrides as unknown as string[]).concat(width ? widthProperties : []).concat(height ? heightProperties : []);
|
|
203
203
|
}
|