Skip to content

Commit

Permalink
use displayName in dev only
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance committed Jan 27, 2020
1 parent b4b6775 commit 49455b0
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 47 deletions.
14 changes: 9 additions & 5 deletions packages/alert-dialog/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ export const AlertDialogOverlay = forwardRef<HTMLDivElement, AlertDialogProps>(
}
);

AlertDialogOverlay.displayName = "AlertDialogOverlay";
if (__DEV__) {
AlertDialogOverlay.displayName = "AlertDialogOverlay";
AlertDialogOverlay.propTypes = {
isOpen: PropTypes.bool,
onDismiss: PropTypes.func,
Expand Down Expand Up @@ -162,8 +162,8 @@ export type AlertDialogContentProps = {
children: React.ReactNode;
} & DialogContentProps;

AlertDialogContent.displayName = "AlertDialogContent";
if (__DEV__) {
AlertDialogContent.displayName = "AlertDialogContent";
AlertDialogContent.propTypes = {
children: PropTypes.node
};
Expand All @@ -189,7 +189,9 @@ export const AlertDialogLabel: React.FC<React.HTMLAttributes<
return <div {...props} id={labelId} data-reach-alert-dialog-label />;
};

AlertDialogLabel.displayName = "AlertDialogLabel";
if (__DEV__) {
AlertDialogLabel.displayName = "AlertDialogLabel";
}

////////////////////////////////////////////////////////////////////////////////

Expand All @@ -212,7 +214,9 @@ export const AlertDialogDescription: React.FC<React.HTMLAttributes<
);
};

AlertDialogDescription.displayName = "AlertDialogDescription";
if (__DEV__) {
AlertDialogDescription.displayName = "AlertDialogDescription";
}

////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -273,8 +277,8 @@ export type AlertDialogProps = {
children: React.ReactNode;
} & DialogProps;

AlertDialog.displayName = "AlertDialog";
if (__DEV__) {
AlertDialog.displayName = "AlertDialog";
AlertDialog.propTypes = {
isOpen: PropTypes.bool,
onDismiss: PropTypes.func,
Expand Down
2 changes: 1 addition & 1 deletion packages/alert/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export type AlertProps = {
children: React.ReactNode;
} & React.HTMLAttributes<HTMLDivElement>;

Alert.displayName = "Alert";
if (__DEV__) {
Alert.displayName = "Alert";
Alert.propTypes = {
children: PropTypes.node,
type: PropTypes.oneOf(["assertive", "polite"])
Expand Down
26 changes: 19 additions & 7 deletions packages/combobox/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ export type ComboboxProps = {
openOnFocus?: boolean;
};

Combobox.displayName = "Combobox";
if (__DEV__) {
Combobox.displayName = "Combobox";
Combobox.propTypes = {
as: PropTypes.elementType,
onSelect: PropTypes.func,
Expand Down Expand Up @@ -542,7 +542,9 @@ export type ComboboxInputProps = {
value?: ComboboxValue;
};

ComboboxInput.displayName = "ComboboxInput";
if (__DEV__) {
ComboboxInput.displayName = "ComboboxInput";
}

////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -597,7 +599,9 @@ export const ComboboxPopover: ComponentWithForwardedRef<
);
});

ComboboxPopover.displayName = "ComboboxPopover";
if (__DEV__) {
ComboboxPopover.displayName = "ComboboxPopover";
}

export type __ComboboxPopoverProps = {
targetRef?: any;
Expand Down Expand Up @@ -681,7 +685,9 @@ export type ComboboxListProps = {
persistSelection?: boolean;
};

ComboboxList.displayName = "ComboboxList";
if (__DEV__) {
ComboboxList.displayName = "ComboboxList";
}

////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -772,7 +778,9 @@ export type ComboboxOptionProps = {
value: string;
};

ComboboxOption.displayName = "ComboboxOption";
if (__DEV__) {
ComboboxOption.displayName = "ComboboxOption";
}

////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -827,7 +835,9 @@ export function ComboboxOptionText() {
);
}

ComboboxOptionText.displayName = "ComboboxOptionText";
if (__DEV__) {
ComboboxOptionText.displayName = "ComboboxOptionText";
}

////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -869,7 +879,9 @@ export const ComboboxButton = forwardRefWithAs<{}, "button">(
}
);

ComboboxButton.displayName = "ComboboxButton";
if (__DEV__) {
ComboboxButton.displayName = "ComboboxButton";
}

////////////////////////////////////////////////////////////////////////////////

Expand Down
8 changes: 4 additions & 4 deletions packages/dialog/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export const DialogOverlay = forwardRef<HTMLDivElement, DialogProps>(
}
);

DialogOverlay.displayName = "DialogOverlay";
if (__DEV__) {
DialogOverlay.displayName = "DialogOverlay";
DialogOverlay.propTypes = {
...overlayPropTypes,
isOpen: PropTypes.bool
Expand Down Expand Up @@ -128,8 +128,8 @@ const DialogInner = forwardRef<HTMLDivElement, DialogProps>(
}
);

DialogOverlay.displayName = "DialogOverlay";
if (__DEV__) {
DialogOverlay.displayName = "DialogOverlay";
DialogOverlay.propTypes = {
...overlayPropTypes
};
Expand Down Expand Up @@ -182,8 +182,8 @@ export type DialogContentProps = {
children?: React.ReactNode;
} & React.HTMLAttributes<HTMLDivElement>;

DialogContent.displayName = "DialogContent";
if (__DEV__) {
DialogContent.displayName = "DialogContent";
DialogContent.propTypes = {
"aria-label": ariaLabelType,
"aria-labelledby": ariaLabelType
Expand Down Expand Up @@ -255,8 +255,8 @@ export type DialogProps = {
initialFocusRef?: React.RefObject<any>;
} & React.HTMLAttributes<HTMLDivElement>;

Dialog.displayName = "Dialog";
if (__DEV__) {
Dialog.displayName = "Dialog";
Dialog.propTypes = {
isOpen: PropTypes.bool,
onDismiss: PropTypes.func,
Expand Down
14 changes: 7 additions & 7 deletions packages/menu-button/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ export interface MenuProps {
id?: string;
}

Menu.displayName = "Menu";
if (__DEV__) {
Menu.displayName = "Menu";
Menu.propTypes = {
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node])
};
Expand Down Expand Up @@ -240,8 +240,8 @@ export type MenuButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
children: React.ReactNode;
};

MenuButton.displayName = "MenuButton";
if (__DEV__) {
MenuButton.displayName = "MenuButton";
MenuButton.propTypes = {
children: PropTypes.node
};
Expand Down Expand Up @@ -518,8 +518,8 @@ export const MenuItem = forwardRefWithAs<MenuItemProps, "div">(
*/
export type MenuItemProps = Omit<MenuItemImplProps, "isLink">;

MenuItem.displayName = "MenuItem";
if (__DEV__) {
MenuItem.displayName = "MenuItem";
MenuItem.propTypes = {
as: PropTypes.any,
onSelect: PropTypes.func.isRequired
Expand Down Expand Up @@ -701,8 +701,8 @@ export type MenuItemsProps = {
children: React.ReactNode;
} & React.HTMLAttributes<HTMLDivElement>;

MenuItems.displayName = "MenuItems";
if (__DEV__) {
MenuItems.displayName = "MenuItems";
MenuItems.propTypes = {
children: PropTypes.node
};
Expand Down Expand Up @@ -753,8 +753,8 @@ export type MenuLinkProps = Omit<MenuItemImplProps, "isLink" | "onSelect"> & {
onSelect?: () => any;
};

MenuLink.displayName = "MenuLink";
if (__DEV__) {
MenuLink.displayName = "MenuLink";
MenuLink.propTypes = {
as: PropTypes.any,
component: PropTypes.any
Expand Down Expand Up @@ -793,8 +793,8 @@ export type MenuListProps = React.HTMLAttributes<HTMLDivElement> & {
children: React.ReactNode;
};

MenuList.displayName = "MenuList";
if (__DEV__) {
MenuList.displayName = "MenuList";
MenuList.propTypes = {
children: PropTypes.node.isRequired
};
Expand Down Expand Up @@ -873,8 +873,8 @@ export type MenuPopoverProps = React.HTMLAttributes<HTMLDivElement> & {
position?: Position;
};

MenuPopover.displayName = "MenuPopover";
if (__DEV__) {
MenuPopover.displayName = "MenuPopover";
MenuPopover.propTypes = {
children: PropTypes.node
};
Expand Down
8 changes: 6 additions & 2 deletions packages/popover/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export type PopoverProps = {
position?: Position;
} & React.HTMLAttributes<HTMLDivElement>;

Popover.displayName = "Popover";
if (__DEV__) {
Popover.displayName = "Popover";
}

export default Popover;

Expand Down Expand Up @@ -69,7 +71,9 @@ const PopoverImpl = forwardRef<HTMLDivElement, PopoverProps>(
}
);

PopoverImpl.displayName = "PopoverImpl";
if (__DEV__) {
PopoverImpl.displayName = "PopoverImpl";
}

////////////////////////////////////////////////////////////////////////////////

Expand Down
4 changes: 3 additions & 1 deletion packages/portal/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export type PortalProps = {
type?: string;
};

Portal.displayName = "Portal";
if (__DEV__) {
Portal.displayName = "Portal";
}

export default Portal;
3 changes: 1 addition & 2 deletions packages/rect/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ export type RectProps = {
children(args: { rect: PRect | null; ref: React.Ref<any> }): JSX.Element;
};

Rect.displayName = "Rect";

if (__DEV__) {
Rect.displayName = "Rect";
Rect.propTypes = {
children: PropTypes.func.isRequired,
observe: PropTypes.bool,
Expand Down
8 changes: 6 additions & 2 deletions packages/skip-nav/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export type SkipNavLinkProps = {
children?: string | JSX.Element;
} & Omit<React.HTMLAttributes<HTMLAnchorElement>, "href">;

SkipNavLink.displayName = "SkipNavLink";
if (__DEV__) {
SkipNavLink.displayName = "SkipNavLink";
}

////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -75,4 +77,6 @@ export type SkipNavContentProps = {
children?: React.ReactNode;
} & Omit<React.HTMLAttributes<HTMLDivElement>, "id">;

SkipNavContent.displayName = "SkipNavContent";
if (__DEV__) {
SkipNavContent.displayName = "SkipNavContent";
}
12 changes: 6 additions & 6 deletions packages/slider/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ export type SliderProps = Omit<
step?: number;
};

Slider.displayName = "Slider";
if (__DEV__) {
Slider.displayName = "Slider";
Slider.propTypes = {
...sliderPropTypes,
children: PropTypes.node
Expand Down Expand Up @@ -529,8 +529,8 @@ export type SliderInputProps = Omit<SliderProps, "children"> & {
children: React.ReactNode | SliderChildrenRender;
};

SliderInput.displayName = "SliderInput";
if (__DEV__) {
SliderInput.displayName = "SliderInput";
SliderInput.propTypes = {
...sliderPropTypes,
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired
Expand Down Expand Up @@ -581,8 +581,8 @@ export type SliderTrackProps = React.HTMLAttributes<HTMLDivElement> & {
children: React.ReactNode;
};

SliderTrack.displayName = "SliderTrack";
if (__DEV__) {
SliderTrack.displayName = "SliderTrack";
SliderTrack.propTypes = {
children: PropTypes.node.isRequired
};
Expand Down Expand Up @@ -628,8 +628,8 @@ export const SliderTrackHighlight = forwardRef<
*/
export type SliderTrackHighlightProps = React.HTMLAttributes<HTMLDivElement>;

SliderTrackHighlight.displayName = "SliderTrackHighlight";
if (__DEV__) {
SliderTrackHighlight.displayName = "SliderTrackHighlight";
SliderTrackHighlight.propTypes = {};
}

Expand Down Expand Up @@ -716,8 +716,8 @@ export const SliderHandle = forwardRef<HTMLDivElement, SliderHandleProps>(
*/
export type SliderHandleProps = React.HTMLAttributes<HTMLDivElement>;

SliderHandle.displayName = "SliderHandle";
if (__DEV__) {
SliderHandle.displayName = "SliderHandle";
SliderHandle.propTypes = {};
}

Expand Down Expand Up @@ -789,8 +789,8 @@ export type SliderMarkerProps = React.HTMLAttributes<HTMLDivElement> & {
value: number;
};

SliderMarker.displayName = "SliderMarker";
if (__DEV__) {
SliderMarker.displayName = "SliderMarker";
SliderMarker.propTypes = {
value: PropTypes.number.isRequired
};
Expand Down
Loading

0 comments on commit 49455b0

Please sign in to comment.