diff --git a/packages/react/components/accordion/Accordion.tsx b/packages/react/components/accordion/Accordion.tsx index 52fe882b..3c7e0379 100644 --- a/packages/react/components/accordion/Accordion.tsx +++ b/packages/react/components/accordion/Accordion.tsx @@ -8,14 +8,16 @@ import { hashClass } from "@/helpers/hashClassesHelpers" * Accordion Component * @param className {string} Additionnal CSS Classes */ -const Accordion = ({ - className, - testId, - ...others -}: AccordionProps): React.JSX.Element => { +const Accordion = React.forwardRef((props: AccordionProps, ref: React.LegacyRef) => { + const { + className, + testId, + ...others + } = props + const { styled } = useTrilogyContext() const classes = hashClass(styled, clsx("accordions", className)) - return
-} + return
+}) export default Accordion diff --git a/packages/react/components/breadcrumb/Breadcrumb.tsx b/packages/react/components/breadcrumb/Breadcrumb.tsx index f69cf5a2..9fa95fb4 100644 --- a/packages/react/components/breadcrumb/Breadcrumb.tsx +++ b/packages/react/components/breadcrumb/Breadcrumb.tsx @@ -11,17 +11,20 @@ import { useTrilogyContext } from "@/context" * - -------------------------- WEB PROPERTIES ------------------------------- * @param className {string} Additionnal CSS Classes */ -const Breadcrumb = ({ - children, - className, - testId, - accessibilityLabel, - ...others -}: BreadcrumbWebProps): JSX.Element => { +const Breadcrumb = React.forwardRef((props: BreadcrumbWebProps, ref: React.LegacyRef) => { + const { + children, + className, + testId, + accessibilityLabel, + ...others + } = props + const { styled } = useTrilogyContext() return ( ) -} +}) export default Breadcrumb diff --git a/packages/react/components/card/Card.tsx b/packages/react/components/card/Card.tsx index 4fb8d399..d05f72ee 100644 --- a/packages/react/components/card/Card.tsx +++ b/packages/react/components/card/Card.tsx @@ -24,26 +24,28 @@ import { useTrilogyContext } from "@/context" * @param fullheight * @param markup {BoxMarkup} Clickable Card => CardMarkup.A Not clickable box => CardMarkup.DIV || null */ -const Card = ({ - className, - background, - backgroundSrc, - inverted, - flat, - horizontal, - floating, - align, - justify, - skeleton, - onClick, - reversed, - testId, - markup, - to, - fullheight, - active, - ...others -}: CardProps): JSX.Element => { +const Card = React.forwardRef((props: CardProps, ref: React.LegacyRef) => { + const { + className, + background, + backgroundSrc, + inverted, + flat, + horizontal, + floating, + align, + justify, + skeleton, + onClick, + reversed, + testId, + markup, + to, + fullheight, + active, + ...others + } = props + const [isLoading, setIsLoading] = useState(skeleton || false) const { styled } = useTrilogyContext() @@ -88,6 +90,7 @@ const Card = ({ }} {...others} className={classes} + ref={ref as React.LegacyRef} /> ) } @@ -99,8 +102,8 @@ const Card = ({ className={classes} style={onClick && { ...hoverStyle }} {...others} + ref={ref as React.LegacyRef} /> ) -} - +}) export default Card diff --git a/packages/react/components/chips/list/ChipsList.tsx b/packages/react/components/chips/list/ChipsList.tsx index bf849a7e..0d30bf3e 100644 --- a/packages/react/components/chips/list/ChipsList.tsx +++ b/packages/react/components/chips/list/ChipsList.tsx @@ -10,11 +10,13 @@ import { useTrilogyContext } from "@/context" * @param children {React.ReactNode} * @param multiple {boolean} Selection Multiple With checked icon */ -const ChipsList = ({ - children, - multiple, - ...others -}: ChipsListProps): JSX.Element => { +const ChipsList = React.forwardRef((props: ChipsListProps, ref: React.LegacyRef) => { + const { + children, + multiple, + ...others + } = props + const { styled } = useTrilogyContext() const classes = hashClass( @@ -23,10 +25,10 @@ const ChipsList = ({ ) return ( -
+
{children}
) -} +}) export default ChipsList diff --git a/packages/react/components/columns/Columns.tsx b/packages/react/components/columns/Columns.tsx index 4b7bd352..933f0593 100644 --- a/packages/react/components/columns/Columns.tsx +++ b/packages/react/components/columns/Columns.tsx @@ -20,19 +20,21 @@ import { useTrilogyContext } from "@/context" * @param mobile {boolean} Responsive mode * @param flex {boolean} Flex direction */ -const Columns = ({ - className, - multiline, - inlined, - mobile, - centered, - verticalCentered, - gapless, - marginSize, - flex, - marginless, - ...others -}: ColumnsProps): JSX.Element => { +const Columns = React.forwardRef((props:ColumnsProps, ref: React.LegacyRef) => { + const { + className, + multiline, + inlined, + mobile, + centered, + verticalCentered, + gapless, + marginSize, + flex, + marginless, + ...others + } = props + const { styled } = useTrilogyContext() const classes = hashClass( @@ -52,7 +54,7 @@ const Columns = ({ ) ) - return
-} + return
+}) export default Columns diff --git a/packages/react/components/columns/item/ColumnsItem.tsx b/packages/react/components/columns/item/ColumnsItem.tsx index 20248b75..ec14ac7c 100644 --- a/packages/react/components/columns/item/ColumnsItem.tsx +++ b/packages/react/components/columns/item/ColumnsItem.tsx @@ -30,28 +30,30 @@ import { getAlignClassName } from "@/objects" * @param fullhdOffset {ColumnsSize} Apply => is-offset-fullhd * @param align { Alignable | AlignableValues} align content */ -const ColumnsItem = ({ - className, - size, - mobileSize, - tabletSize, - touchSize, - desktopSize, - widescreenSize, - fullhdSize, - offset, - mobileOffset, - tabletOffset, - touchOffset, - desktopOffset, - widescreenOffset, - fullhdOffset, - narrow, - verticalCenter, - centered, - align, - ...others -}: ColumnsItemProps): JSX.Element => { +const ColumnsItem = React.forwardRef((props: ColumnsItemProps, ref: React.LegacyRef) => { + const { + className, + size, + mobileSize, + tabletSize, + touchSize, + desktopSize, + widescreenSize, + fullhdSize, + offset, + mobileOffset, + tabletOffset, + touchOffset, + desktopOffset, + widescreenOffset, + fullhdOffset, + narrow, + verticalCenter, + centered, + align, + ...others + } = props + const { styled } = useTrilogyContext() const classes = hashClass( @@ -80,6 +82,7 @@ const ColumnsItem = ({ ) ) - return
-} + return
+}) + export default ColumnsItem diff --git a/packages/react/components/list/List.tsx b/packages/react/components/list/List.tsx index 8510c19d..3f8756ff 100644 --- a/packages/react/components/list/List.tsx +++ b/packages/react/components/list/List.tsx @@ -11,13 +11,15 @@ import { useTrilogyContext } from "@/context" * @param hasIcon {boolean} If Have icon */ -const List = ({ - className, - hasIcon, - children, - testId, - ...others -}: ListProps): JSX.Element => { +const List = React.forwardRef((props: ListProps, ref: React.LegacyRef) => { + const { + className, + hasIcon, + children, + testId, + ...others + } = props + const { styled } = useTrilogyContext() const classes = hashClass( @@ -25,10 +27,10 @@ const List = ({ clsx(hasIcon ? "icon-list" : "list", className) ) return ( -
    +
      {children}
    ) -} +}) export default List diff --git a/packages/react/components/progress/Progress.tsx b/packages/react/components/progress/Progress.tsx index b9c68a28..f63ed766 100644 --- a/packages/react/components/progress/Progress.tsx +++ b/packages/react/components/progress/Progress.tsx @@ -22,19 +22,21 @@ import { useTrilogyContext } from "@/context" * -------------------------- WEB PROPERTIES ------------------------------- * @param className {string} Additionnal CSS classes */ -const Progress = ({ - children, - className, - percent, - maxPercent = 100, - alert, - small, - stacked, - uniqueLegend, - firstExtremLegend, - secondExtremLegend, - ...others -}: ProgressProps): JSX.Element => { +const Progress = React.forwardRef((props: ProgressProps, ref: React.LegacyRef) => { + const { + children, + className, + percent, + maxPercent = 100, + alert, + small, + stacked, + uniqueLegend, + firstExtremLegend, + secondExtremLegend, + ...others + } = props + const { styled } = useTrilogyContext() const classes = hashClass( @@ -55,7 +57,7 @@ const Progress = ({ if (children && stacked) { return ( -
    +
    {children}
    ) @@ -88,6 +90,7 @@ const Progress = ({ )} ) -} + +}) export default Progress diff --git a/packages/react/components/progress/item/ProgressItem.tsx b/packages/react/components/progress/item/ProgressItem.tsx index 869a2078..85494059 100644 --- a/packages/react/components/progress/item/ProgressItem.tsx +++ b/packages/react/components/progress/item/ProgressItem.tsx @@ -17,15 +17,17 @@ import { useTrilogyContext } from "@/context" * -------------------------- WEB PROPERTIES ------------------------------- * @param className {string} Additionnal CSS classes */ -const ProgressItem = ({ - className, - percent, - maxPercent = 100, - minPercent = 0, - alert, - accessibilityLabel, - ...others -}: ProgressItemProps): JSX.Element => { +const ProgressItem = React.forwardRef((props: ProgressItemProps, ref: React.LegacyRef) => { + const { + className, + percent, + maxPercent = 100, + minPercent = 0, + alert, + accessibilityLabel, + ...others + } = props + const { styled } = useTrilogyContext() const classes = hashClass( @@ -40,6 +42,7 @@ const ProgressItem = ({ return (
    ) -} +}) export default ProgressItem diff --git a/packages/react/components/rows/Rows.tsx b/packages/react/components/rows/Rows.tsx index b062b945..8d22f4ff 100644 --- a/packages/react/components/rows/Rows.tsx +++ b/packages/react/components/rows/Rows.tsx @@ -10,11 +10,13 @@ import { useTrilogyContext } from "@/context" * - ------------------- WEB PROPERTIES ------------------------- * @param className {string} additionnal CSS Classes */ -const Rows = ({ className, ...others }: RowsProps): JSX.Element => { +const Rows = React.forwardRef((props: RowsProps, ref: React.LegacyRef) => { + const { className, ...others } = props + const { styled } = useTrilogyContext() return ( -
    +
    ) -} +}) export default Rows diff --git a/packages/react/components/rows/item/RowItem.tsx b/packages/react/components/rows/item/RowItem.tsx index 7bbee9ca..e6b1ee45 100644 --- a/packages/react/components/rows/item/RowItem.tsx +++ b/packages/react/components/rows/item/RowItem.tsx @@ -12,17 +12,19 @@ import { useTrilogyContext } from "@/context" * - -------------------------- WEB PROPERTIES ------------------- * @param className {string} additionnal CSS Classes */ -const RowItem = ({ - className, - narrow, - ...others -}: RowsItemProps): JSX.Element => { +const RowItem = React.forwardRef((props: RowsItemProps, ref: React.LegacyRef) => { + const { + className, + narrow, + ...others + } = props + const { styled } = useTrilogyContext() const classes = hashClass( styled, clsx("row", narrow && is("narrow"), className) ) - return
    -} + return
    +}) export default RowItem diff --git a/packages/react/components/section/Section.tsx b/packages/react/components/section/Section.tsx index 0812a3d1..4804b78d 100644 --- a/packages/react/components/section/Section.tsx +++ b/packages/react/components/section/Section.tsx @@ -17,17 +17,19 @@ import { useTrilogyContext } from '@/context' * @param verticalPaddingless {boolean} remove vertical padding **/ -const Section = ({ - className, - skeleton, - background, - backgroundSrc, - inverted, - paddingless, - verticalPaddingless, - fullwidth, - ...others -}: SectionProps): JSX.Element => { +const Section = React.forwardRef((props: SectionProps, ref: React.LegacyRef) => { + const { + className, + skeleton, + background, + backgroundSrc, + inverted, + paddingless, + verticalPaddingless, + fullwidth, + ...others + } = props + const { styled } = useTrilogyContext() const [isLoading, setIsLoading] = useState(skeleton || false) @@ -52,6 +54,7 @@ const Section = ({ return (
    ) -} +}) export default Section diff --git a/packages/react/components/select/option/SelectOption.tsx b/packages/react/components/select/option/SelectOption.tsx index 4c1cc5f3..7120b3ee 100644 --- a/packages/react/components/select/option/SelectOption.tsx +++ b/packages/react/components/select/option/SelectOption.tsx @@ -16,24 +16,27 @@ import { SelectOptionProps } from './SelectOptionProps' * @param onClick {function} onclick function * @param id {string} Select option custom id */ -const SelectOption = ({ - id, - className, - value, - disabled, - children, - onClick, - label, - iconName, - testId, - ...others -}: SelectOptionProps): JSX.Element => { +const SelectOption = React.forwardRef((allProps: SelectOptionProps, ref: React.LegacyRef) => { + const { + id, + className, + value, + disabled, + children, + onClick, + label, + iconName, + testId, + ...others + } = allProps + const { checked, native, focused, ...props } = others as {checked:boolean, native:boolean, focused:boolean} const selectClasses = React.useMemo(() => clsx(focused && 'focus', className), [focused, className]) if (native) { return (