Skip to content

Commit

Permalink
Rename isRtl to rtl
Browse files Browse the repository at this point in the history
  • Loading branch information
mj12albert committed Nov 11, 2024
1 parent dd0c57d commit 807f1c7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions packages/mui-base/src/Composite/Root/CompositeRoot.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ describe('Composite', () => {
expect(item1).toHaveFocus();
});

describe('prop: isRtl', () => {
describe('prop: rtl', () => {
it('horizontal orientation', async () => {
const { getByTestId } = render(
<CompositeRoot isRtl orientation="horizontal">
<CompositeRoot rtl orientation="horizontal">
<CompositeItem data-testid="1">1</CompositeItem>
<CompositeItem data-testid="2">2</CompositeItem>
<CompositeItem data-testid="3">3</CompositeItem>
Expand Down Expand Up @@ -153,7 +153,7 @@ describe('Composite', () => {

it('both horizontal and vertical orientation', async () => {
const { getByTestId } = render(
<CompositeRoot isRtl orientation="both">
<CompositeRoot rtl orientation="both">
<CompositeItem data-testid="1">1</CompositeItem>
<CompositeItem data-testid="2">2</CompositeItem>
<CompositeItem data-testid="3">3</CompositeItem>
Expand Down
12 changes: 6 additions & 6 deletions packages/mui-base/src/Composite/Root/CompositeRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const CompositeRoot = React.forwardRef(function CompositeRoot(
itemSizes,
loop,
cols,
isRtl,
rtl,
...otherProps
} = props;

Expand Down Expand Up @@ -59,7 +59,7 @@ namespace CompositeRoot {
orientation?: 'horizontal' | 'vertical' | 'both';
cols?: number;
loop?: boolean;
isRtl?: boolean;
rtl?: boolean;
activeIndex?: number;
onActiveIndexChange?: (index: number) => void;
itemSizes?: Dimensions[];
Expand Down Expand Up @@ -92,10 +92,6 @@ CompositeRoot.propTypes /* remove-proptypes */ = {
* @ignore
*/
dense: PropTypes.bool,
/**
* @ignore
*/
isRtl: PropTypes.bool,
/**
* @ignore
*/
Expand All @@ -121,6 +117,10 @@ CompositeRoot.propTypes /* remove-proptypes */ = {
* A function to customize rendering of the component.
*/
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
/**
* @ignore
*/
rtl: PropTypes.bool,
} as any;

export { CompositeRoot };
12 changes: 6 additions & 6 deletions packages/mui-base/src/Composite/Root/useCompositeRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import {
export interface UseCompositeRootParameters {
orientation?: 'horizontal' | 'vertical' | 'both';
cols?: number;
// isRtl not yet supported for grids (cols > 1)
isRtl?: boolean;
// rtl not yet supported for grids (cols > 1)
rtl?: boolean;
loop?: boolean;
activeIndex?: number;
onActiveIndexChange?: (index: number) => void;
Expand All @@ -44,7 +44,7 @@ export function useCompositeRoot(params: UseCompositeRootParameters) {
const {
itemSizes,
cols = 1,
isRtl = false,
rtl = false,
loop = true,
dense = false,
orientation = 'both',
Expand Down Expand Up @@ -138,7 +138,7 @@ export function useCompositeRoot(params: UseCompositeRootParameters) {
] as number; // navigated cell will never be nullish
}

const toEndKeys = isRtl
const toEndKeys = rtl
? {
horizontal: [ARROW_LEFT],
vertical: [ARROW_DOWN],
Expand All @@ -150,7 +150,7 @@ export function useCompositeRoot(params: UseCompositeRootParameters) {
both: [ARROW_RIGHT, ARROW_DOWN],
}[orientation];

const toStartKeys = isRtl
const toStartKeys = rtl
? {
horizontal: [ARROW_RIGHT],
vertical: [ARROW_UP],
Expand Down Expand Up @@ -206,7 +206,7 @@ export function useCompositeRoot(params: UseCompositeRootParameters) {
dense,
elementsRef,
isGrid,
isRtl,
rtl,
itemSizes,
loop,
onActiveIndexChange,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const ToggleButtonGroupRoot = React.forwardRef(function ToggleButtonGroupRoot(

return (
<ToggleButtonGroupRootContext.Provider value={contextValue}>
<CompositeRoot render={renderElement()} isRtl={direction === 'rtl'} />
<CompositeRoot render={renderElement()} rtl={direction === 'rtl'} />
</ToggleButtonGroupRootContext.Provider>
);
});
Expand Down

0 comments on commit 807f1c7

Please sign in to comment.