Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

primitives: update exports and add displayname #686

Merged
merged 3 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add display name to primitives
  • Loading branch information
reesscot committed Nov 11, 2021
commit ff57dc61f9d698eaab7c6b4b65ae760305ae5fb4
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@ export const Alert: Primitive<AlertProps, typeof Flex> = ({
)
);
};

Alert.displayName = 'Alert';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Alert/AlertIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ export const AlertIcon: React.FC<AlertIconProps> = ({
return null;
}
};

AlertIcon.displayName = 'AlertIcon';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ export const Badge: Primitive<BadgeProps, 'span'> = ({
{children}
</View>
);

Badge.displayName = 'Badge';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ export const Button: Primitive<ButtonProps, 'button'> = ({
{isLoading && loadingText ? <span>{loadingText}</span> : children}
</View>
);

Button.displayName = 'Button';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/ButtonGroup/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ export const ButtonGroup: Primitive<ButtonGroupProps, typeof Flex> = ({
})}
</Flex>
);

ButtonGroup.displayName = 'ButtonGroup';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ export const Card: Primitive<CardProps, 'div'> = ({
{children}
</View>
);

Card.displayName = 'Card';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,5 @@ export const Checkbox: Primitive<CheckboxProps, 'input'> = ({
</Flex>
);
};

Checkbox.displayName = 'Checkbox';
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ export const CheckboxField: Primitive<CheckboxFieldProps, 'input'> = ({
</Flex>
);
};

CheckboxField.displayName = 'CheckboxField';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Collection/Collection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,5 @@ export const Collection = <Item,>({
</Flex>
);
};

Collection.displayName = 'Collection';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Divider/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ export const Divider: Primitive<DividerProps, 'hr'> = ({
{...rest}
/>
);

Divider.displayName = 'Divider';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Field/FieldClearButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ export const FieldClearButton: Primitive<FieldClearButtonProps, 'button'> = (
<IconClose size={props.size} />
</FieldGroupIconButton>
);

FieldClearButton.displayName = 'FieldClearButton';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Field/FieldDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ export const FieldDescription: React.FC<FieldDescriptionProps> = ({
</Text>
) : null;
};

FieldDescription.displayName = 'FieldDescription';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Field/FieldErrorMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ export const FieldErrorMessage: React.FC<FieldErrorMessageProps> = ({
</Text>
) : null;
};

FieldErrorMessage.displayName = 'FieldErrorMessage';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/FieldGroup/FieldGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ export const FieldGroup: Primitive<FieldGroupOptions, typeof Flex> = ({
</Flex>
);
};

FieldGroup.displayName = 'FieldGroup';
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ export const FieldGroupIcon: Primitive<FieldGroupIconProps, 'button'> = ({
</View>
) : null;
};

FieldGroupIcon.displayName = 'FieldGroupIcon';
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ export const FieldGroupIconButton: React.FC<FieldGroupIconButtonProps> = ({
{children}
</FieldGroupIcon>
);

FieldGroupIconButton.displayName = 'FieldGroupIconButton';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Flex/Flex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ export const Flex: Primitive<FlexProps, 'div'> = ({
{children}
</View>
);

Flex.displayName = 'Flex';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ export const Grid: Primitive<GridProps, 'div'> = ({
{children}
</View>
);

Grid.displayName = 'Grid';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Heading/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ export const Heading: Primitive<HeadingProps, HeadingTag> = ({
{children}
</View>
);

Heading.displayName = 'Heading';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ export const Icon: Primitive<IconProps, 'svg'> = ({
</View>
);
};

Icon.displayName = 'Icon';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Image/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export const Image: Primitive<ImageProps, 'img'> = ({ className, ...rest }) => (
{...rest}
/>
);

Image.displayName = 'Image';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ export const Input: Primitive<InputProps, 'input'> = ({
{...rest}
/>
);

Input.displayName = 'Input';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Label/Label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ export const Label: Primitive<LabelProps, 'label'> = ({
</View>
);
};

Label.displayName = 'Label';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Link/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ export const Link: Primitive<LinkProps, 'a'> = ({
</View>
);
};

Link.displayName = 'Link';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Loader/Loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@ export const Loader: Primitive<LoaderProps, 'svg'> = ({
</View>
);
};

Loader.displayName = 'Loader';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ export const Menu: Primitive<MenuProps, 'div'> = ({
</DropdownMenuContent>
</DropdownMenu>
);

Menu.displayName = 'Menu';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Menu/MenuButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ export const MenuButton = React.forwardRef<
);
}
);

MenuButton.displayName = 'MenuButton';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Menu/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ export const MenuItem = React.forwardRef<HTMLDivElement, MenuItemProps>(
);
}
);

MenuItem.displayName = 'MenuItem';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ export const Pagination: Primitive<PaginationProps, 'nav'> = ({
</View>
);
};

Pagination.displayName = 'Pagination';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Pagination/PaginationItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,5 @@ export const PaginationItem: React.FC<PaginationItemProps> = ({
}
return <View as="li" />;
};

PaginationItem.displayName = 'PaginationItem';
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ export const PasswordField: Primitive<PasswordFieldProps, 'input'> = ({
/>
);
};

PasswordField.displayName = 'PasswordField';
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ export const ShowPasswordButton: React.FC<ShowPasswordButtonProps> = ({
</Button>
);
};

ShowPasswordButton.displayName = 'ShowPasswordButton';
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ export const CountryCodeSelect: Primitive<CountryCodeSelectProps, 'select'> = ({
</SelectField>
);
};

CountryCodeSelect.displayName = 'CountryCodeSelect';
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ export const PhoneNumberField: Primitive<PhoneNumberFieldProps, 'input'> = ({
/>
);
};

PhoneNumberField.displayName = 'PhoneNumberField';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Placeholder/Placeholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ export const Placeholder: Primitive<PlaceholderProps, 'div'> = ({
/>
);
};

Placeholder.displayName = 'Placeholder';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,5 @@ export const Radio: Primitive<RadioProps, 'input'> = ({
</Flex>
);
};

Radio.displayName = 'Radio';
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ export const RadioGroupField: Primitive<RadioGroupFieldProps, typeof Flex> = ({
</Flex>
);
};

RadioGroupField.displayName = 'RadioGroupField';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Rating/Rating.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ export const Rating: Primitive<RatingProps, typeof Flex> = ({
</Flex>
);
};

Rating.displayName = 'Rating';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Rating/RatingIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ export const RatingIcon: React.FC<RatingIconProps> = ({
</View>
);
};

RatingIcon.displayName = 'RatingIcon';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Rating/RatingMixedIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ export const RatingMixedIcon: React.FC<RatingMixedIconProps> = ({
</View>
);
};

RatingMixedIcon.displayName = 'RatingMixedIcon';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/ScrollView/ScrollView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ export const ScrollView: Primitive<ScrollViewProps, 'div'> = ({
{children}
</View>
);

ScrollView.displayName = 'ScrollView';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/SearchField/SearchField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,5 @@ export const SearchField: Primitive<SearchFieldProps, 'input'> = ({
/>
);
};

SearchField.displayName = 'SearchField';
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export const SearchFieldButton: Primitive<SearchFieldButtonProps, 'button'> = (
</FieldGroupIconButton>
);
};

SearchFieldButton.displayName = 'SearchFieldButton';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ export const Select: Primitive<SelectProps, 'select'> = ({
</View>
);
};

Select.displayName = 'Select';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/SelectField/SelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ export const SelectField: Primitive<SelectFieldProps, 'select'> = (props) => {
</Flex>
);
};

SelectField.displayName = 'SelectField';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/SliderField/SliderField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,5 @@ export const SliderField: Primitive<SliderFieldProps, typeof Root> = ({
</Flex>
);
};

SliderField.displayName = 'SliderField';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/StepperField/StepperField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,5 @@ export const StepperField: Primitive<StepperFieldProps, 'input'> = (props) => {
</Flex>
);
};

StepperField.displayName = 'StepperField';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/SwitchField/SwitchField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,5 @@ export const SwitchField: Primitive<SwitchFieldProps, typeof Flex> = ({
</Flex>
);
};

SwitchField.displayName = 'SwitchField';
11 changes: 6 additions & 5 deletions packages/react/src/primitives/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Flex } from '../Flex';
import { ComponentClassNames } from '../shared/constants';
import classNames from 'classnames';
import { convertStylePropsToStyleObj, prefixer } from '../shared/styleUtils';
import { Primitive } from '../types';

const isTabsType = (child: any): child is React.Component<TabItemProps> => {
return (
Expand All @@ -19,11 +20,8 @@ const isTabsType = (child: any): child is React.Component<TabItemProps> => {
child.props.children != null
);
};
export interface Tabs {
(props: TabsProps): React.ReactComponentElement<any>;
}

export const Tabs: Tabs = ({
export const Tabs: Primitive<TabsProps, typeof Flex> = ({
alignContent,
alignItems,
ariaLabel,
Expand All @@ -39,7 +37,7 @@ export const Tabs: Tabs = ({
justifyContent,
wrap,
...rest
}) => {
}: TabsProps) => {
const tabs = React.Children.map(children, (child) => {
if (!isTabsType(child)) {
console.warn(
Expand Down Expand Up @@ -99,3 +97,6 @@ export const Tabs: Tabs = ({
};

export const TabItem: React.FC<TabItemProps> = () => <></>;

Tabs.displayName = 'Tabs';
TabItem.displayName = 'TabItem';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ export const Text: Primitive<TextProps, 'p'> = ({
{children}
</View>
);

Text.displayName = 'Text';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/TextArea/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ export const TextArea: Primitive<TextAreaProps, 'textarea'> = ({
{...rest}
/>
);

TextArea.displayName = 'TextArea';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/TextField/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,5 @@ export const TextField = <Multiline extends boolean>(
</Flex>
);
};

TextField.displayName = 'TextField';
2 changes: 2 additions & 0 deletions packages/react/src/primitives/ToggleButton/ToggleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ export const ToggleButton: Primitive<ToggleButtonProps, typeof Button> = ({
</Button>
);
};

ToggleButton.displayName = 'ToggleButton';
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ export const ToggleButtonGroup: Primitive<ToggleButtonGroupProps, typeof Flex> =
</Flex>
);
};

ToggleButtonGroup.displayName = 'ToggleButtonGroup';
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ export const VisuallyHidden: Primitive<VisuallyHiddenProps, 'span'> = ({
{children}
</View>
);

VisuallyHidden.displayName = 'VisuallyHidden';