diff --git a/packages/web-react/src/components/Button/Button.tsx b/packages/web-react/src/components/Button/Button.tsx index 7f90ab883b..889d16f8b3 100644 --- a/packages/web-react/src/components/Button/Button.tsx +++ b/packages/web-react/src/components/Button/Button.tsx @@ -52,4 +52,6 @@ const _Button = ( const Button = forwardRef>(_Button); +Button.isSystemComponent = true; + export default Button; diff --git a/packages/web-react/src/components/Tooltip/TooltipTrigger.tsx b/packages/web-react/src/components/Tooltip/TooltipTrigger.tsx index 95934cf63a..8794d0c186 100644 --- a/packages/web-react/src/components/Tooltip/TooltipTrigger.tsx +++ b/packages/web-react/src/components/Tooltip/TooltipTrigger.tsx @@ -29,11 +29,13 @@ const TooltipTrigger = (props: TooltipTriggerProps) => { id={id} ref={triggerRef} {...getReferenceProps()} - {...(typeof ElementTag !== 'string' && { useUnsafe: typeof ElementTag === 'string' })} + // {...(typeof ElementTag !== 'string' && { useUnsafe: typeof ElementTag === 'string' })} > {typeof children === 'function' ? children({ isOpen }) : children} ); }; +TooltipTrigger.isSystemComponent = true; + export default TooltipTrigger; diff --git a/packages/web-react/src/components/Tooltip/demo/TooltipDefault.tsx b/packages/web-react/src/components/Tooltip/demo/TooltipDefault.tsx index 890e148ddd..61213bbb97 100644 --- a/packages/web-react/src/components/Tooltip/demo/TooltipDefault.tsx +++ b/packages/web-react/src/components/Tooltip/demo/TooltipDefault.tsx @@ -6,13 +6,13 @@ const TooltipDefault = () => { const [open, setOpen] = useState(true); const OutsideComponent = (props: any) => { - return

{props.children}

; + return ; }; return ( {/* */} - + I have a tooltip 😎 Hello there! diff --git a/packages/web-react/src/hooks/styleProps.ts b/packages/web-react/src/hooks/styleProps.ts index 4452723fe6..fefc35c0d0 100644 --- a/packages/web-react/src/hooks/styleProps.ts +++ b/packages/web-react/src/hooks/styleProps.ts @@ -17,16 +17,13 @@ export type StylePropsResult = { export function useStyleProps(props: T): StylePropsResult { const classNamePrefix = useContext(ClassNamePrefixContext); - const { UNSAFE_className, UNSAFE_style, ElementTag, useUnsafe: receivedUseUnsafe, ...otherProps } = props; + const { UNSAFE_className, UNSAFE_style, ElementTag, ...otherProps } = props; const { styleUtilities, props: modifiedProps } = useStyleUtilities(otherProps, classNamePrefix); - console.log('ElementTag:', ElementTag, receivedUseUnsafe); - const style: CSSProperties = { ...UNSAFE_style }; - // console.log('typeof ElementTag:', typeof ElementTag); - // if (typeof ElementTag === 'string' && receivedUseUnsafe == null) { - if (typeof ElementTag === 'string' && !receivedUseUnsafe) { + // @ts-ignore + if (typeof ElementTag === 'string' || !ElementTag?.isSystemComponent) { // Want to check if className prop exists, but not to define it in StyleProps type // @ts-expect-error Property 'className' does not exist on type 'Omit'. if (modifiedProps.className) { @@ -62,21 +59,14 @@ export function useStyleProps(props: T): StylePropsResult return { styleProps, - props: { ...(modifiedProps as HTMLAttributes), props1: 'test' }, + props: { ...(modifiedProps as HTMLAttributes) }, }; } const rimmerProps = { ...modifiedProps, - props2: 'test', }; - if (receivedUseUnsafe === false) { - rimmerProps.useUnsafe = true; - } else if (receivedUseUnsafe === true) { - rimmerProps.useUnsafe = undefined; - } - return { styleProps: { ...(UNSAFE_style !== undefined && { UNSAFE_style }),