From 807f1c75ce8bc295058a87dfbf3f719cc9043509 Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Mon, 11 Nov 2024 14:48:40 +0800 Subject: [PATCH] Rename isRtl to rtl --- .../src/Composite/Root/CompositeRoot.test.tsx | 6 +++--- .../mui-base/src/Composite/Root/CompositeRoot.tsx | 12 ++++++------ .../mui-base/src/Composite/Root/useCompositeRoot.ts | 12 ++++++------ .../ToggleButtonGroup/Root/ToggleButtonGroupRoot.tsx | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/mui-base/src/Composite/Root/CompositeRoot.test.tsx b/packages/mui-base/src/Composite/Root/CompositeRoot.test.tsx index c257c91d1..30f23881b 100644 --- a/packages/mui-base/src/Composite/Root/CompositeRoot.test.tsx +++ b/packages/mui-base/src/Composite/Root/CompositeRoot.test.tsx @@ -97,10 +97,10 @@ describe('Composite', () => { expect(item1).toHaveFocus(); }); - describe('prop: isRtl', () => { + describe('prop: rtl', () => { it('horizontal orientation', async () => { const { getByTestId } = render( - + 1 2 3 @@ -153,7 +153,7 @@ describe('Composite', () => { it('both horizontal and vertical orientation', async () => { const { getByTestId } = render( - + 1 2 3 diff --git a/packages/mui-base/src/Composite/Root/CompositeRoot.tsx b/packages/mui-base/src/Composite/Root/CompositeRoot.tsx index f92635683..0923d0210 100644 --- a/packages/mui-base/src/Composite/Root/CompositeRoot.tsx +++ b/packages/mui-base/src/Composite/Root/CompositeRoot.tsx @@ -25,7 +25,7 @@ const CompositeRoot = React.forwardRef(function CompositeRoot( itemSizes, loop, cols, - isRtl, + rtl, ...otherProps } = props; @@ -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[]; @@ -92,10 +92,6 @@ CompositeRoot.propTypes /* remove-proptypes */ = { * @ignore */ dense: PropTypes.bool, - /** - * @ignore - */ - isRtl: PropTypes.bool, /** * @ignore */ @@ -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 }; diff --git a/packages/mui-base/src/Composite/Root/useCompositeRoot.ts b/packages/mui-base/src/Composite/Root/useCompositeRoot.ts index c7e02e5ad..6f4e468ed 100644 --- a/packages/mui-base/src/Composite/Root/useCompositeRoot.ts +++ b/packages/mui-base/src/Composite/Root/useCompositeRoot.ts @@ -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; @@ -44,7 +44,7 @@ export function useCompositeRoot(params: UseCompositeRootParameters) { const { itemSizes, cols = 1, - isRtl = false, + rtl = false, loop = true, dense = false, orientation = 'both', @@ -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], @@ -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], @@ -206,7 +206,7 @@ export function useCompositeRoot(params: UseCompositeRootParameters) { dense, elementsRef, isGrid, - isRtl, + rtl, itemSizes, loop, onActiveIndexChange, diff --git a/packages/mui-base/src/ToggleButtonGroup/Root/ToggleButtonGroupRoot.tsx b/packages/mui-base/src/ToggleButtonGroup/Root/ToggleButtonGroupRoot.tsx index d92d53577..a0f95d163 100644 --- a/packages/mui-base/src/ToggleButtonGroup/Root/ToggleButtonGroupRoot.tsx +++ b/packages/mui-base/src/ToggleButtonGroup/Root/ToggleButtonGroupRoot.tsx @@ -87,7 +87,7 @@ const ToggleButtonGroupRoot = React.forwardRef(function ToggleButtonGroupRoot( return ( - + ); });