Skip to content

Commit

Permalink
fixup! fixup! fixup! UNSAFE classname test
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelklibani committed Jan 30, 2025
1 parent 6b4545f commit 7e26498
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions packages/web-react/src/hooks/styleProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function useStyleProps<T extends StyleProps>(
additionalUtilities?: Record<string, string>,
): StylePropsResult {
const classNamePrefix = useContext(ClassNamePrefixContext);
const { UNSAFE_className, UNSAFE_style, ElementTag, customClassName, ...otherProps } = props;
const { UNSAFE_className, UNSAFE_style, ElementTag, transferClassName, ...otherProps } = props;
const { styleUtilities, props: modifiedProps } = useStyleUtilities(otherProps, classNamePrefix, additionalUtilities);

const style: CSSProperties = { ...UNSAFE_style };
Expand Down Expand Up @@ -58,7 +58,7 @@ export function useStyleProps<T extends StyleProps>(

const styleProps = {
style: Object.keys(style).length > 0 ? style : undefined,
className: classNames(UNSAFE_className, ...styleUtilities, customClassName) || undefined,
className: classNames(UNSAFE_className, ...styleUtilities, transferClassName) || undefined,
};

return {
Expand All @@ -71,7 +71,7 @@ export function useStyleProps<T extends StyleProps>(
styleProps: {
...(UNSAFE_style !== undefined && { UNSAFE_style }),
...((UNSAFE_className !== undefined || styleUtilities !== undefined) && {
UNSAFE_className: classNames(UNSAFE_className, ...styleUtilities, customClassName),
UNSAFE_className: classNames(UNSAFE_className, ...styleUtilities, transferClassName),
}),
},
props: modifiedProps as HTMLAttributes<HTMLElement>,
Expand Down
6 changes: 3 additions & 3 deletions packages/web-react/src/types/shared/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export interface SpacingCSSProperties extends CSSProperties {
[index: `--${string}`]: string | undefined | number;
}

type ElementTagType = string | ElementType;
export type ElementTypeProp = string | ElementType;

export interface StyleProps extends SpacingProps {
customClassName?: string;
ElementTag?: ElementTagType;
ElementTag?: ElementTypeProp;
transferClassName?: string;
// For backward compatibility!
/** Sets the CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. Only use as a **last resort**. Use style props instead. */
UNSAFE_className?: string;
Expand Down
6 changes: 3 additions & 3 deletions packages/web-react/src/types/tooltip.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Placement, Strategy } from '@floating-ui/react';
import { ElementType, ReactNode } from 'react';
import { ChildrenProps, ClickEvent, StyleProps, TransferProps } from './shared';
import { ReactNode } from 'react';
import { ChildrenProps, ClickEvent, ElementTypeProp, StyleProps, TransferProps } from './shared';

export const TOOLTIP_TRIGGER = {
CLICK: 'click',
Expand All @@ -13,7 +13,7 @@ export const TOOLTIP_TRIGGER = {
export type TooltipTriggerType = 'click' | 'hover' | 'manual';

export interface TooltipTriggerProps extends StyleProps, TransferProps {
elementType?: ElementType | string;
elementType?: ElementTypeProp;
children?: string | ReactNode | ((props: { isOpen: boolean }) => ReactNode);
}

Expand Down

0 comments on commit 7e26498

Please sign in to comment.