@vonage/vivid-react
Version:
Vivid wrapped for easy React usage & IDE autocomplete support & typescript typings
53 lines (48 loc) • 2.25 kB
TypeScript
import React, { ReactNode, SyntheticEvent } from 'react';
import '@vonage/vwc-radio';
/** This component is an extension of [<mwc-radio>](https://github.com/material-components/material-components-web-components/tree/master/packages/radio)
* @param {boolean} global
* @param {boolean} checked - We define our own getter/setter for `checked` because we need to track
changes to it synchronously.
The order in which the `checked` property is set across radio buttons
within the same group is very important. However, we can't rely on
UpdatingElement's `updated` callback to observe these changes (which is
also what the `@observer` decorator uses), because it batches changes to
all properties.
Consider:
radio1.disabled = true;
radio2.checked = true;
radio1.checked = true;
In this case we'd first see all changes for radio1, and then for radio2,
and we couldn't tell that radio1 was the most recently checked.
* @param {boolean} disabled
* @param {string} value
* @param {string} name
* @param {boolean} reducedTouchTarget - Touch target extends beyond visual boundary of a component by default.
Set to `true` to remove touch target added to the component.
* @param {number} formElementTabIndex - input's tabindex is updated based on checked status.
Tab navigation will be removed from unchecked radios.
* @param {string | undefined} ariaLabel
* @param {string | undefined} ariaLabelledBy
* @param {ShadowRootInit} shadowRootOptions
*/
declare const VwcRadio: (props: {
children?: ReactNode;
slot?: string | undefined;
id?: string | undefined;
style?: React.CSSProperties | undefined;
ref?: React.RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
onChecked?: ((event: SyntheticEvent) => void) | undefined;
onChange?: ((event: SyntheticEvent) => void) | undefined;
global?: boolean | undefined;
checked?: boolean | undefined;
disabled?: boolean | undefined;
value?: string | undefined;
name?: string | undefined;
reducedTouchTarget?: boolean | undefined;
formElementTabIndex?: number | undefined;
ariaLabel?: string | undefined;
ariaLabelledBy?: string | undefined;
shadowRootOptions?: any;
}) => JSX.Element;
export default VwcRadio;