Skip to content

Commit 986d093

Browse files
reidbarberLFDanLu
andauthored
RAC: Additional render props and docs improvements (#4755)
* export new types from RAC index.ts * update RAC Tailwind example app * add more exports * update docs * show optional props for Meter/ProgressBar table * update various render props * remove focus from various components * fix searchfield test * show optional in Checkbox/Combobox * fix table row dragging docs table * add more showOptional * add state table for SliderTrack * revert type updates * add missing state table * actual fix * fix checkbox type --------- Co-authored-by: Daniel Lu <[email protected]>
1 parent f2a1187 commit 986d093

32 files changed

+167
-226
lines changed

examples/rac-tailwind/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ function SliderExample() {
362362
<SliderOutput />
363363
</div>
364364
<SliderTrack className="relative w-full h-7">
365-
{(state) => <>
365+
{({state}) => <>
366366
<div className="absolute h-2 top-[50%] transform translate-y-[-50%] w-full rounded-full bg-white bg-opacity-40" />
367367
<div className="absolute h-2 top-[50%] transform translate-y-[-50%] rounded-full bg-white" style={{width: state.getThumbPercent(0) * 100 + '%'}} />
368368
<SliderThumb className="h-7 w-7 top-[50%] rounded-full border border-purple-800/75 bg-white transition-colors data-[dragging]:bg-purple-100 outline-none data-[focus-visible]:ring-2 data-[focus-visible]:ring-black" />

packages/react-aria-components/docs/Calendar.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,9 @@ The states, selectors, and render props for each component used in a `Calendar`
363363

364364
### Calendar
365365

366-
A `Calendar` can be targeted with the `.react-aria-Calendar` CSS selector, or by overriding with a custom `className`. It provides a <TypeLink links={statelyDocs.links} type={statelyDocs.exports.CalendarState} /> object to its render props, which can be used to customize the `className`, `style`, or `children`.
366+
A `Calendar` can be targeted with the `.react-aria-Calendar` CSS selector, or by overriding with a custom `className`. It supports the following states and render props:
367+
368+
<StateTable properties={docs.exports.CalendarRenderProps.properties} />
367369

368370
### Button
369371

packages/react-aria-components/docs/Checkbox.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ Render props may also be used as children to alter what elements are rendered ba
250250

251251
The states, selectors, and render props for `Checkbox` are documented below.
252252

253-
<StateTable properties={docs.exports.CheckboxRenderProps.properties} />
253+
<StateTable properties={docs.exports.CheckboxRenderProps.properties} showOptional />
254254

255255
## Reusable wrappers
256256

packages/react-aria-components/docs/ComboBox.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,15 +425,17 @@ The states and selectors for each component used in a `ComboBox` are documented
425425

426426
A `ComboBox` can be targeted with the `.react-aria-ComboBox` CSS selector, or by overriding with a custom `className`. It supports the following states:
427427

428-
<StateTable properties={docs.exports.ComboBoxRenderProps.properties} />
428+
<StateTable properties={docs.exports.ComboBoxRenderProps.properties} showOptional />
429429

430430
### Label
431431

432432
A `Label` can be targeted with the `.react-aria-Label` CSS selector, or by overriding with a custom `className`.
433433

434434
### Input
435435

436-
An `Input` within a ComboBox can be targeted with the `.react-aria-Input` CSS selector, or by overriding with a custom `className`. It supports standard CSS pseudo classes such as `:focus` for states. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes#user_action_pseudo-classes) for details.
436+
An `Input` can be targeted with the `.react-aria-Input` CSS selector, or by overriding with a custom `className`. It supports the following states:
437+
438+
<StateTable properties={docs.exports.InputRenderProps.properties} />
437439

438440
### Button
439441

packages/react-aria-components/docs/DateField.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ The states, selectors, and render props for each component used in a `DateField`
280280

281281
### DateField
282282

283-
A `DateField` can be targeted with the `.react-aria-DateField` CSS selector, or by overriding with a custom `className`. It provides a <TypeLink links={statelyDocs.links} type={statelyDocs.exports.DateFieldState} /> object to its render props, which can be used to customize the `className`, `style`, or `children`.
283+
A `DateField` can be targeted with the `.react-aria-DateField` CSS selector, or by overriding with a custom `className`. It supports the following states and render props:
284+
285+
<StateTable properties={docs.exports.DateFieldRenderProps.properties} />
284286

285287
### Label
286288

packages/react-aria-components/docs/DatePicker.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,9 @@ The states, selectors, and render props for each component used in a `DatePicker
645645

646646
### DatePicker
647647

648-
A `DatePicker` can be targeted with the `.react-aria-DatePicker` CSS selector, or by overriding with a custom `className`. It provides a <TypeLink links={statelyDocs.links} type={statelyDocs.exports.DatePickerState} /> object to its render props, which can be used to customize the `className`, `style`, or `children`.
648+
A `DatePicker` can be targeted with the `.react-aria-DatePicker` CSS selector, or by overriding with a custom `className`. It supports the following states and render props:
649+
650+
<StateTable properties={docs.exports.DatePickerRenderProps.properties} />
649651

650652
### Label
651653

packages/react-aria-components/docs/DateRangePicker.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,9 @@ The states, selectors, and render props for each component used in a `DateRangeP
681681

682682
### DateRangePicker
683683

684-
A `DateRangePicker` can be targeted with the `.react-aria-DateRangePicker` CSS selector, or by overriding with a custom `className`. It provides a <TypeLink links={statelyDocs.links} type={statelyDocs.exports.DateRangePickerState} /> object to its render props, which can be used to customize the `className`, `style`, or `children`.
684+
A `DateRangePicker` can be targeted with the `.react-aria-DateRangePicker` CSS selector, or by overriding with a custom `className`. It supports the following states and render props:
685+
686+
<StateTable properties={docs.exports.DateRangePickerRenderProps.properties} />
685687

686688
### Label
687689

packages/react-aria-components/docs/Meter.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ The selectors and render props for each component used in a `Meter` are document
181181

182182
A `Meter` can be targeted with the `.react-aria-Meter` CSS selector, or by overriding with a custom `className`. It supports the following states and render props:
183183

184-
<StateTable properties={docs.exports.MeterRenderProps.properties} />
184+
<StateTable properties={docs.exports.MeterRenderProps.properties} showOptional />
185185

186186
### Label
187187

packages/react-aria-components/docs/NumberField.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ The states, selectors, and render props for each component used in a `NumberFiel
285285

286286
### NumberField
287287

288-
A `NumberField` can be targeted with the `.react-aria-NumberField` CSS selector, or by overriding with a custom `className`. It provides a <TypeLink links={statelyDocs.links} type={statelyDocs.exports.NumberFieldState} /> object to its render props, which can be used to customize the `className`, `style`, or `children`.
288+
A `NumberField` can be targeted with the `.react-aria-NumberField` CSS selector, or by overriding with a custom `className`. It supports the following states:
289+
290+
<StateTable properties={docs.exports.NumberFieldRenderProps.properties} showOptional />
289291

290292
### Label
291293

packages/react-aria-components/docs/ProgressBar.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ The selectors and render props for each component used in a `ProgressBar` are do
197197

198198
A `ProgressBar` can be targeted with the `.react-aria-ProgressBar` CSS selector, or by overriding with a custom `className`. It supports the following states and render props:
199199

200-
<StateTable properties={docs.exports.ProgressBarRenderProps.properties} />
200+
<StateTable properties={docs.exports.ProgressBarRenderProps.properties} showOptional />
201201

202202
### Label
203203

0 commit comments

Comments
 (0)