diff --git a/packages/@react-aria/calendar/src/index.ts b/packages/@react-aria/calendar/src/index.ts index 75be3d28cdb..1676e603a42 100644 --- a/packages/@react-aria/calendar/src/index.ts +++ b/packages/@react-aria/calendar/src/index.ts @@ -15,7 +15,7 @@ export {useRangeCalendar} from './useRangeCalendar'; export {useCalendarGrid} from './useCalendarGrid'; export {useCalendarCell} from './useCalendarCell'; -export type {AriaCalendarProps, AriaRangeCalendarProps, CalendarProps, RangeCalendarProps} from '@react-types/calendar'; +export type {AriaCalendarProps, AriaRangeCalendarProps, CalendarProps, DateValue, RangeCalendarProps} from '@react-types/calendar'; export type {CalendarAria} from './useCalendarBase'; export type {AriaCalendarGridProps, CalendarGridAria} from './useCalendarGrid'; export type {AriaCalendarCellProps, CalendarCellAria} from './useCalendarCell'; diff --git a/packages/@react-aria/combobox/src/index.ts b/packages/@react-aria/combobox/src/index.ts index 275f3440e52..8e24d45b144 100644 --- a/packages/@react-aria/combobox/src/index.ts +++ b/packages/@react-aria/combobox/src/index.ts @@ -3,7 +3,7 @@ * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language @@ -11,3 +11,4 @@ */ export {useComboBox} from './useComboBox'; export type {AriaComboBoxOptions, ComboBoxAria} from './useComboBox'; +export type {AriaComboBoxProps} from '@react-types/combobox'; diff --git a/packages/@react-aria/datepicker/src/index.ts b/packages/@react-aria/datepicker/src/index.ts index b691f77391a..5db0fc7368a 100644 --- a/packages/@react-aria/datepicker/src/index.ts +++ b/packages/@react-aria/datepicker/src/index.ts @@ -16,8 +16,8 @@ export {useDateField, useTimeField} from './useDateField'; export {useDateRangePicker} from './useDateRangePicker'; export {useDisplayNames} from './useDisplayNames'; -export type {AriaDatePickerProps, AriaDateRangePickerProps} from '@react-types/datepicker'; -export type {AriaDateFieldProps, DateFieldAria} from './useDateField'; +export type {AriaDateFieldProps, AriaDatePickerProps, AriaDateRangePickerProps, DateRange, DateValue, TimeValue} from '@react-types/datepicker'; +export type {AriaDateFieldOptions, DateFieldAria} from './useDateField'; export type {DatePickerAria} from './useDatePicker'; export type {DateRangePickerAria} from './useDateRangePicker'; export type {DateSegmentAria} from './useDateSegment'; diff --git a/packages/@react-aria/datepicker/src/useDateField.ts b/packages/@react-aria/datepicker/src/useDateField.ts index 99ffe8787e7..a7001615ca5 100644 --- a/packages/@react-aria/datepicker/src/useDateField.ts +++ b/packages/@react-aria/datepicker/src/useDateField.ts @@ -24,7 +24,7 @@ import {useFocusWithin} from '@react-aria/interactions'; import {useLocalizedStringFormatter} from '@react-aria/i18n'; // Allows this hook to also be used with TimeField -export interface AriaDateFieldProps extends Omit, 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue'> {} +export interface AriaDateFieldOptions extends Omit, 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue'> {} export interface DateFieldAria { /** Props for the field's visible label element, if any. */ @@ -57,7 +57,7 @@ export const focusManagerSymbol = '__focusManager_' + Date.now(); * A date field allows users to enter and edit date and time values using a keyboard. * Each part of a date value is displayed in an individually editable segment. */ -export function useDateField(props: AriaDateFieldProps, state: DateFieldState, ref: RefObject): DateFieldAria { +export function useDateField(props: AriaDateFieldOptions, state: DateFieldState, ref: RefObject): DateFieldAria { let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({ ...props, labelElementType: 'span' diff --git a/packages/@react-aria/overlays/src/index.ts b/packages/@react-aria/overlays/src/index.ts index 104779c26e4..50031c0ec0d 100644 --- a/packages/@react-aria/overlays/src/index.ts +++ b/packages/@react-aria/overlays/src/index.ts @@ -28,3 +28,4 @@ export type {DismissButtonProps} from './DismissButton'; export type {AriaPopoverProps, PopoverAria} from './usePopover'; export type {AriaModalOverlayProps, ModalOverlayAria} from './useModalOverlay'; export type {OverlayProps} from './Overlay'; +export type {Placement, PlacementAxis, PositionProps} from '@react-types/overlays'; diff --git a/packages/@react-aria/radio/src/index.ts b/packages/@react-aria/radio/src/index.ts index 683dae47fd4..1b82ecdef0f 100644 --- a/packages/@react-aria/radio/src/index.ts +++ b/packages/@react-aria/radio/src/index.ts @@ -12,5 +12,6 @@ export {useRadio} from './useRadio'; export {useRadioGroup} from './useRadioGroup'; export type {AriaRadioGroupProps, AriaRadioProps} from '@react-types/radio'; +export type {Orientation} from '@react-types/shared'; export type {RadioAria} from './useRadio'; export type {RadioGroupAria} from './useRadioGroup'; diff --git a/packages/@react-aria/select/src/index.ts b/packages/@react-aria/select/src/index.ts index 2f225662f28..3b130c526af 100644 --- a/packages/@react-aria/select/src/index.ts +++ b/packages/@react-aria/select/src/index.ts @@ -3,7 +3,7 @@ * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language @@ -13,3 +13,4 @@ export {useSelect} from './useSelect'; export {useHiddenSelect, HiddenSelect} from './HiddenSelect'; export type {AriaSelectOptions, SelectAria} from './useSelect'; export type {AriaHiddenSelectProps, HiddenSelectProps} from './HiddenSelect'; +export type {AriaSelectProps} from '@react-types/select'; diff --git a/packages/@react-aria/slider/src/index.ts b/packages/@react-aria/slider/src/index.ts index 72d00861dcb..b4d966cd3f4 100644 --- a/packages/@react-aria/slider/src/index.ts +++ b/packages/@react-aria/slider/src/index.ts @@ -14,3 +14,5 @@ export {useSliderThumb} from './useSliderThumb'; export type {AriaSliderProps} from '@react-types/slider'; export type {SliderAria} from './useSlider'; export type {AriaSliderThumbOptions, SliderThumbAria} from './useSliderThumb'; +export type {AriaSliderThumbProps} from '@react-types/slider'; +export type {Orientation} from '@react-types/shared'; diff --git a/packages/@react-aria/tabs/src/index.ts b/packages/@react-aria/tabs/src/index.ts index e43baa620ba..6a75ea01d1a 100644 --- a/packages/@react-aria/tabs/src/index.ts +++ b/packages/@react-aria/tabs/src/index.ts @@ -13,6 +13,7 @@ export {useTab} from './useTab'; export {useTabPanel} from './useTabPanel'; export {useTabList} from './useTabList'; export type {AriaTabListProps, AriaTabPanelProps, AriaTabProps} from '@react-types/tabs'; +export type {Orientation} from '@react-types/shared'; export type {TabAria} from './useTab'; export type {TabPanelAria} from './useTabPanel'; export type {TabListAria} from './useTabList'; diff --git a/packages/@react-stately/table/src/index.ts b/packages/@react-stately/table/src/index.ts index 34ba6e512e3..e16c277a54c 100644 --- a/packages/@react-stately/table/src/index.ts +++ b/packages/@react-stately/table/src/index.ts @@ -22,5 +22,5 @@ export {Column} from './Column'; export {Row} from './Row'; export {Cell} from './Cell'; export {Section} from '@react-stately/collections'; -export {TableCollection} from './TableCollection'; +export {TableCollection, buildHeaderRows} from './TableCollection'; export {TableColumnLayout} from './TableColumnLayout'; diff --git a/packages/dev/docs/src/docs.css b/packages/dev/docs/src/docs.css index 1040ad83c4c..b14eb68382c 100644 --- a/packages/dev/docs/src/docs.css +++ b/packages/dev/docs/src/docs.css @@ -365,6 +365,10 @@ footer li:last-child:after { margin-bottom: 0; } +.propTable td[data-column="CSS Selector"] code { + white-space: nowrap; +} + .type-description { margin-top: 0; } @@ -720,6 +724,10 @@ h2.sectionHeader { main { margin-right: 0; } + + .propTable td[data-column="CSS Selector"] code { + white-space: normal; + } } @define-mixin small-propTable { diff --git a/packages/dev/parcel-transformer-docs/DocsTransformer.js b/packages/dev/parcel-transformer-docs/DocsTransformer.js index 976f4942cc8..f538a8d7610 100644 --- a/packages/dev/parcel-transformer-docs/DocsTransformer.js +++ b/packages/dev/parcel-transformer-docs/DocsTransformer.js @@ -649,12 +649,19 @@ module.exports = new Transformer({ return false; } - if (!t.isMemberExpression(path.node.callee)) { - return path.get('callee').referencesImport(module, name); + let callee = path.node.callee; + let calleePath = path.get('callee'); + if (t.isTSAsExpression(callee)) { + callee = callee.expression; + calleePath = calleePath.get('expression'); } - if (path.get('callee.object').referencesImport(module, 'default')) { - return t.isIdentifier(path.node.callee.property, {name}); + if (!t.isMemberExpression(callee)) { + return calleePath.referencesImport(module, name); + } + + if (calleePath.get('object').referencesImport(module, 'default')) { + return t.isIdentifier(callee.property, {name}); } return false; @@ -664,7 +671,7 @@ module.exports = new Transformer({ if (path.isFunction()) { if ( path.node.returnType && - t.isTSTypeReference(path.node.returnType.typeAnnotation) && + t.isTSTypeReference(path.node.returnType.typeAnnotation) && t.isTSQualifiedName(path.node.returnType.typeAnnotation.typeName) && t.isIdentifier(path.node.returnType.typeAnnotation.typeName.left, {name: 'JSX'}) && t.isIdentifier(path.node.returnType.typeAnnotation.typeName.right, {name: 'Element'}) diff --git a/packages/react-aria-components/docs/Calendar.mdx b/packages/react-aria-components/docs/Calendar.mdx index ea208e2453c..ba96b296379 100644 --- a/packages/react-aria-components/docs/Calendar.mdx +++ b/packages/react-aria-components/docs/Calendar.mdx @@ -382,9 +382,14 @@ If you will use a Calendar in multiple places in your app, you can wrap all of t This example also shows how to use the `errorMessage` slot to render help text in case of a validation error ([see below for details](#error-message)). ```tsx example export=true +import type {CalendarProps, DateValue} from 'react-aria-components'; import {Text} from 'react-aria-components'; -function MyCalendar({errorMessage, ...props}) { +interface MyCalendarProps extends CalendarProps { + errorMessage?: string +} + +function MyCalendar({errorMessage, ...props}: MyCalendarProps) { return (
@@ -468,7 +473,7 @@ The below example displays a `Calendar` in the Hindi language, using the Indian import {I18nProvider} from '@react-aria/i18n'; function Example() { - let [date, setDate] = React.useState(null); + let [date, setDate] = React.useState(null); return ( diff --git a/packages/react-aria-components/docs/Checkbox.mdx b/packages/react-aria-components/docs/Checkbox.mdx index a0a1bd121bf..2aa3e0ebd57 100644 --- a/packages/react-aria-components/docs/Checkbox.mdx +++ b/packages/react-aria-components/docs/Checkbox.mdx @@ -260,7 +260,9 @@ If you will use a Checkbox in multiple places in your app, you can wrap all of t This example wraps `Checkbox` and all of its children together into a single component. It also shows how to use render props to conditionally render a different indicator icon when the checkbox is in an indeterminate state. ```tsx example export=true -function MyCheckbox({children, ...props}) { +import type {CheckboxProps} from 'react-aria-components'; + +function MyCheckbox({children, ...props}: CheckboxProps) { return ( {({isIndeterminate}) => <> diff --git a/packages/react-aria-components/docs/CheckboxGroup.mdx b/packages/react-aria-components/docs/CheckboxGroup.mdx index 1830b64e06e..0f17f4a9b53 100644 --- a/packages/react-aria-components/docs/CheckboxGroup.mdx +++ b/packages/react-aria-components/docs/CheckboxGroup.mdx @@ -341,15 +341,22 @@ If you will use a CheckboxGroup in multiple places in your app, you can wrap all This example wraps `CheckboxGroup` and all of its children together into a single component which accepts a `label` prop, which is passed to the right place. It also shows how to use the `description` and `errorMessage` slots to render help text ([see below for details](#help-text)). ```tsx example export=true +import type {CheckboxGroupProps, CheckboxProps} from 'react-aria-components'; import {Text} from 'react-aria-components'; +interface MyCheckboxGroupProps extends CheckboxGroupProps { + label?: string, + description?: string, + errorMessage?: string +} + function MyCheckboxGroup({ label, description, errorMessage, children, ...props -}) { +}: MyCheckboxGroupProps) { return ( {label} @@ -360,7 +367,7 @@ function MyCheckboxGroup({ ); } -function MyCheckbox({children, ...props}) { +function MyCheckbox({children, ...props}: CheckboxProps) { return (