Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make transfer props available to users #534

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/components/Alert/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,14 @@ with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/Alert/Alert.jsx" />
Expand Down
5 changes: 4 additions & 1 deletion src/components/Badge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,14 @@ with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/Badge/Badge.jsx" />
Expand Down
9 changes: 6 additions & 3 deletions src/components/Button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,15 +389,18 @@ animation is made.

In addition to the options below in the [component's API](#api) section, you
can specify **any HTML attribute you like.** All attributes that don't interfere
with the API of the React component are forwarded to the root `<button>` HTML
with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

- [`<button>` HTML element attributes][button-attributes]{:target="_blank"}
For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## Forwarding ref

If you provide [ref], it is forwarded to the native HTML `<button>` element.
Expand Down
5 changes: 4 additions & 1 deletion src/components/ButtonGroup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,14 @@ with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/ButtonGroup/ButtonGroup.jsx"></docoff-react-props>
Expand Down
5 changes: 4 additions & 1 deletion src/components/Card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,14 @@ with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/Card/Card.jsx"></docoff-react-props>
Expand Down
9 changes: 6 additions & 3 deletions src/components/CheckboxField/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,18 @@ Disabled state makes the input unavailable.

In addition to the options below in the [component's API](#api) section, you
can specify **any HTML attribute you like.** All attributes that don't interfere
with the API of the React component are forwarded to the root `<input>` HTML
with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

- [`<input type="checkbox" />` HTML element attributes][checkbox-attributes]{:target="_blank"}
For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## Forwarding ref

If you provide [ref], it is forwarded to the native HTML `<input>` element.
Expand Down
5 changes: 4 additions & 1 deletion src/components/FormLayout/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,14 @@ with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/FormLayout/FormLayout.jsx"></docoff-react-props>
Expand Down
12 changes: 7 additions & 5 deletions src/components/Grid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,18 @@ property. Check [MDN][grid-auto-flow] to fully understand available options.

In addition to the options below in the [component's API](#api) section, you
can specify **any HTML attribute you like.** All attributes that don't interfere
with the API of the React component are forwarded to the root HTML element
of your choice provided by `tag`, which is `<div>` by default. This enables
making the component interactive and helps to improve its accessibility.
with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [any other HTML element][all-html-elements]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/Grid/Grid.jsx"></docoff-react-props>
Expand Down
9 changes: 6 additions & 3 deletions src/components/InputGroup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,18 @@ for the underlying `<fieldset>` element.

In addition to the options below in the [component's API](#api) section, you
can specify **any HTML attribute you like.** All attributes that don't interfere
with the API of the React component are forwarded to the root `<fieldset>` HTML
with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

- [`<fieldset>` HTML element attributes][fieldset-attributes]{:target="_blank"}
For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/InputGroup/InputGroup.jsx"></docoff-react-props>
Expand Down
5 changes: 4 additions & 1 deletion src/components/Paper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/Paper/Paper.jsx"></docoff-react-props>
Expand Down
5 changes: 4 additions & 1 deletion src/components/Popover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,14 @@ with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## Forwarding ref

If you provide [ref], it is forwarded to the root native HTML `<div>` element,
Expand Down
9 changes: 6 additions & 3 deletions src/components/Radio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,18 @@ It's possible to disable just some options or the whole set.

In addition to the options below in the [component's API](#api) section, you
can specify **any HTML attribute you like.** All attributes that don't interfere
with the API of the React component are forwarded to the root `<input>` HTML
with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

- [`<input type="radio" />` HTML element attributes][radio-attributes]{:target="_blank"}
For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/Radio/Radio.jsx"></docoff-react-props>
Expand Down
6 changes: 4 additions & 2 deletions src/components/ScrollView/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ React.createElement(() => {
);
});
```

## Forwarding HTML Attributes

In addition to the options below in the [component's API](#api) section, you
Expand All @@ -485,11 +484,14 @@ with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## Forwarding ref

If you provide [ref], it is forwarded to the scrolling viewport native HTML
Expand Down
9 changes: 6 additions & 3 deletions src/components/SelectField/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -650,15 +650,18 @@ React.createElement(() => {

In addition to the options below in the [component's API](#api) section, you
can specify **any HTML attribute you like.** All attributes that don't interfere
with the API of the React component are forwarded to the root `<select>` HTML
with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

- [`<select>` HTML element attributes][select-attributes]{:target="_blank"}
For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## Forwarding ref

If you provide [ref], it is forwarded to the native HTML `<select>` element.
Expand Down
9 changes: 6 additions & 3 deletions src/components/Table/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,18 @@ React.createElement(() => {

In addition to the options below in the [component's API](#api) section, you
can specify **any HTML attribute you like.** All attributes that don't interfere
with the API of the React component are forwarded to the root `<table>` HTML
with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

- [`<table>` HTML element attributes][table-attributes]{:target="_blank"}
For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/Table/Table.jsx"></docoff-react-props>
Expand Down
9 changes: 6 additions & 3 deletions src/components/TextLink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,18 @@ It's common to use custom function for routing within SPAs. Use the

In addition to the options below in the [component's API](#api) section, you
can specify **any HTML attribute you like.** All attributes that don't interfere
with the API of the React component are forwarded to the root `<a>` HTML
with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

- [`<a>` HTML element attributes][a-attributes]{:target="_blank"}
For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/TextLink/TextLink.jsx"></docoff-react-props>
Expand Down
9 changes: 6 additions & 3 deletions src/components/Toggle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,18 @@ Disabled state makes the input unavailable.

In addition to the options below in the [component's API](#api) section, you
can specify **any HTML attribute you like.** All attributes that don't interfere
with the API of the React component are forwarded to the root `<input>` HTML
with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

- [`<input type="checkbox" />` HTML element attributes][checkbox-attributes]{:target="_blank"}
For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## Forwarding ref

If you provide [ref], it is forwarded to the native HTML `<input>` element.
Expand Down
5 changes: 4 additions & 1 deletion src/components/Toolbar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,14 @@ with the API of the React component are forwarded to the root `<div>` HTML
element. This enables making the component interactive and helps to improve
its accessibility.

👉 For the full list of supported attributes refer to:
👉 For forwarding HTML attributes programmatically, you can use the `transferProps` function. For detailed usage examples, refer to the [TransferProps documentation](/src/docs/js-helpers/transferProps.md).

For the full list of supported attributes, you can also refer to:

- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
- [React common props]{:target="_blank"}


## API

<docoff-react-props src="/components/Toolbar/Toolbar.jsx"></docoff-react-props>
Expand Down
2 changes: 2 additions & 0 deletions src/components/_helpers/transferProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const transferProps = (props) => {
} = props;

if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.log('props', props);
const invalidProps = [
'children', // It is always either handled by the component itself or not supported.
'className', // Classes are set by component authors, changing it arbitrarily might break things.
Expand Down
2 changes: 1 addition & 1 deletion src/docs/js-helpers/classnames.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ And use it:
<div
className={classNames(
'd-inline-block',
Date.now() > 1609455600 && 'text-warning',
Date.now() > 1609455600 && 'text-warning',
Date.now() > 1622498400 ? 'text-secondary' : null,
)}
>
Expand Down
Loading
Loading