Fix ToggleButtonGroup orientation prop not reaching React Aria
orientation was listed in propDefs with dataAttribute: true, which caused useDefinition to extract it from restProps. React Aria's ToggleButtonGroup never received it and defaulted to horizontal. Remove orientation from propDefs and OwnProps so it flows through restProps to React Aria, which handles data-orientation itself. Signed-off-by: Johan Persson <johanopersson@gmail.com>
This commit is contained in:
@@ -2639,9 +2639,6 @@ export const ToggleButtonGroupDefinition: {
|
||||
readonly root: 'bui-ToggleButtonGroup';
|
||||
};
|
||||
readonly propDefs: {
|
||||
readonly orientation: {
|
||||
readonly dataAttribute: true;
|
||||
};
|
||||
readonly className: {};
|
||||
readonly children: {};
|
||||
};
|
||||
@@ -2649,17 +2646,13 @@ export const ToggleButtonGroupDefinition: {
|
||||
|
||||
// @public (undocumented)
|
||||
export type ToggleButtonGroupOwnProps = {
|
||||
orientation?: NonNullable<ToggleButtonGroupProps_2['orientation']>;
|
||||
className?: string;
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ToggleButtonGroupProps
|
||||
extends Omit<
|
||||
ToggleButtonGroupProps_2,
|
||||
'orientation' | 'className' | 'children'
|
||||
>,
|
||||
extends Omit<ToggleButtonGroupProps_2, 'className' | 'children'>,
|
||||
ToggleButtonGroupOwnProps {}
|
||||
|
||||
// @public (undocumented)
|
||||
|
||||
@@ -23,19 +23,14 @@ import { ToggleButtonGroupDefinition } from './definition';
|
||||
/** @public */
|
||||
export const ToggleButtonGroup = forwardRef(
|
||||
(props: ToggleButtonGroupProps, ref: Ref<HTMLDivElement>) => {
|
||||
const { ownProps, restProps, dataAttributes } = useDefinition(
|
||||
const { ownProps, restProps } = useDefinition(
|
||||
ToggleButtonGroupDefinition,
|
||||
props,
|
||||
);
|
||||
const { classes, children } = ownProps;
|
||||
|
||||
return (
|
||||
<AriaToggleButtonGroup
|
||||
className={classes.root}
|
||||
ref={ref}
|
||||
{...dataAttributes}
|
||||
{...restProps}
|
||||
>
|
||||
<AriaToggleButtonGroup className={classes.root} ref={ref} {...restProps}>
|
||||
{children}
|
||||
</AriaToggleButtonGroup>
|
||||
);
|
||||
|
||||
@@ -29,7 +29,6 @@ export const ToggleButtonGroupDefinition =
|
||||
root: 'bui-ToggleButtonGroup',
|
||||
},
|
||||
propDefs: {
|
||||
orientation: { dataAttribute: true },
|
||||
className: {},
|
||||
children: {},
|
||||
},
|
||||
|
||||
@@ -19,15 +19,11 @@ import type { ToggleButtonGroupProps as AriaToggleButtonGroupProps } from 'react
|
||||
|
||||
/** @public */
|
||||
export type ToggleButtonGroupOwnProps = {
|
||||
orientation?: NonNullable<AriaToggleButtonGroupProps['orientation']>;
|
||||
className?: string;
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export interface ToggleButtonGroupProps
|
||||
extends Omit<
|
||||
AriaToggleButtonGroupProps,
|
||||
'orientation' | 'className' | 'children'
|
||||
>,
|
||||
extends Omit<AriaToggleButtonGroupProps, 'className' | 'children'>,
|
||||
ToggleButtonGroupOwnProps {}
|
||||
|
||||
Reference in New Issue
Block a user