diff --git a/changelog.txt b/changelog.txt index 51acbb05..f935851c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +Version 1.5.1 - xth x, 2025 +- Improvement - Introduced the `areaChartWrapper` prop in the AreaChart component to allow for better customization options. +- Improvement - Removed the group selector from the Tabs component to simplify style overrides. +- Improvement - Introduced a new prop to handle the Sidebar's default collapse state when collapsible is set to false. +- Fix - Addressed UI inconsistencies in the Switch, Checkbox, and RadioButton components for improved support in RTL (Right-to-Left) layouts. + Version 1.5.0 - 14th March, 2025 - New - Added new Atom, File Preview - to show uploaded file preview. - New - Added new variants in Progress Steps component to show icon and number in the completed step. diff --git a/src/components/area-chart/area-chart.tsx b/src/components/area-chart/area-chart.tsx index d31d4828..f1d484c8 100644 --- a/src/components/area-chart/area-chart.tsx +++ b/src/components/area-chart/area-chart.tsx @@ -12,6 +12,7 @@ import { import ChartLegendContent from './chart-legend-content'; import ChartTooltipContent from './chart-tooltip-content'; import Label from '../label'; +import type { CategoricalChartProps } from 'recharts/types/chart/generateCategoricalChart'; interface DataItem { [key: string]: number | string; // Adjust based on your data structure @@ -75,6 +76,15 @@ interface AreaChartProps { /** Height of the chart container. */ chartHeight?: number; + + /** + * Area chart Wrapper props to apply additional props to the wrapper component. Ex. `margin`, or `onClick` etc. + * @see https://recharts.org/en-US/api/AreaChart + */ + areaChartWrapperProps?: Omit< + CategoricalChartProps, + 'width' | 'height' | 'data' + >; } const AreaChart = ( { @@ -96,6 +106,14 @@ const AreaChart = ( { xAxisFontColor = '#6B7280', chartWidth = 350, chartHeight = 200, + areaChartWrapperProps = { + margin: { + left: 14, + right: 14, + top: 6, + bottom: 6, + }, + }, }: AreaChartProps ) => { const [ width, setWidth ] = useState( chartWidth ); const [ height, setHeight ] = useState( chartHeight ); @@ -157,7 +175,7 @@ const AreaChart = ( { return ( - + { showCartesianGrid && } { showXAxis && ( = ( args ) => { return ( { setSidebarCollapsed( isCollapsed ); } } diff --git a/src/components/sidebar/sidebar.tsx b/src/components/sidebar/sidebar.tsx index bf696f50..8d2e231c 100644 --- a/src/components/sidebar/sidebar.tsx +++ b/src/components/sidebar/sidebar.tsx @@ -38,6 +38,8 @@ export interface SidebarProps extends SidebarCommonProps { collapsible?: boolean; /** Controls whether a border should appear on the right of the Sidebar. */ borderOn?: boolean; + /** Set the sidebar collapse state. This is useful when collapsible is false and you want to use the sidebar as collapsed by default. */ + collapsed?: boolean; } // Sidebar subcomponents props interfaces @@ -54,25 +56,32 @@ export const Sidebar = ( { onCollapseChange, collapsible = true, borderOn = true, + collapsed = false, ...props }: SidebarProps ) => { const sideBarRef = useRef( null ); const [ isCollapsed, setIsCollapsed ] = useState( () => { + if ( ! collapsible && collapsed ) { + return collapsed; + } const storedState = safeLocalStorage.get( 'sidebar-collapsed' ); - const isSmallScreen = window.innerWidth < 1280; if ( storedState ) { return storedState; } + const isSmallScreen = window.innerWidth < 1280; return isSmallScreen; } ); useEffect( () => { - if ( onCollapseChange ) { + if ( typeof onCollapseChange === 'function' ) { onCollapseChange( isCollapsed ); } }, [ isCollapsed, onCollapseChange ] ); useEffect( () => { + if ( ! collapsible && collapsed ) { + return; + } const handleScreenResize = () => { const isSmallScreen = window.innerWidth < 1280; if ( ! collapsible ) { diff --git a/src/components/switch/switch.tsx b/src/components/switch/switch.tsx index f83031e8..168b7633 100644 --- a/src/components/switch/switch.tsx +++ b/src/components/switch/switch.tsx @@ -204,9 +204,9 @@ export const SwitchComponent = ( }, }; const toggleDialHoverClassNames = { - md: 'group-hover/switch:size-5 group-focus-within/switch:size-5 group-focus-within/switch:left-0.5 group-hover/switch:left-0.5', - sm: 'group-hover/switch:size-4 group-focus-within/switch:size-4 group-focus-within/switch:left-0.5 group-hover/switch:left-0.5', - xs: 'group-hover/switch:size-3.25 group-focus-within/switch:size-3.25 group-focus-within/switch:left-0.5 group-hover/switch:left-0.5', + md: 'group-hover/switch:size-5 group-focus-within/switch:size-5 not-rtl:group-focus-within/switch:left-0.5 rtl:group-focus-within/switch:right-0.5 not-rtl:group-hover/switch:left-0.5 rtl:group-hover/switch:right-0.5', + sm: 'group-hover/switch:size-4 group-focus-within/switch:size-4 not-rtl:group-focus-within/switch:left-0.5 rtl:group-focus-within/switch:right-0.5 not-rtl:group-hover/switch:left-0.5 rtl:group-hover/switch:right-0.5', + xs: 'group-hover/switch:size-3.25 group-focus-within/switch:size-3.25 not-rtl:group-focus-within/switch:left-0.5 rtl:group-focus-within/switch:right-0.5 not-rtl:group-hover/switch:left-0.5 rtl:group-hover/switch:right-0.5', }; const disabledClassNames = { @@ -247,7 +247,7 @@ export const SwitchComponent = (