Skip to content

Commit

Permalink
feat: add display names to all components
Browse files Browse the repository at this point in the history
  • Loading branch information
tigranpetrossian committed Jul 4, 2024
1 parent afc6e52 commit d54f7f6
Show file tree
Hide file tree
Showing 22 changed files with 102 additions and 0 deletions.
9 changes: 9 additions & 0 deletions figma-kit/src/components/alert-dialog/alert-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ const Action = React.forwardRef<ActionElement, ActionProps>((props, ref) => {
return <RadixAlertDialog.Action ref={ref} asChild {...props} />;
});

Trigger.displayName = 'AlertDialog.Trigger';
Content.displayName = 'AlertDialog.Content';
Overlay.displayName = 'AlertDialog.Overlay';
Title.displayName = 'AlertDialog.Title';
Description.displayName = 'AlertDialog.Description';
Actions.displayName = 'AlertDialog.Actions';
Cancel.displayName = 'AlertDialog.Cancel';
Action.displayName = 'AlertDialog.Action';

export type {
RootProps,
TriggerProps,
Expand Down
6 changes: 6 additions & 0 deletions figma-kit/src/components/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,11 @@ function useIndeterminateState(indeterminate: boolean | undefined) {
);
}

Root.displayName = 'Checkbox.Root';
Input.displayName = 'Checkbox.Input';
Indicator.displayName = 'Checkbox.Indicator';
Label.displayName = 'Checkbox.Label';
Description.displayName = 'Checkbox.Description';

export type { CheckboxProps };
export { Root, Input, Label, Description };
4 changes: 4 additions & 0 deletions figma-kit/src/components/collapsible/collapsible.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@ const Content = React.forwardRef<ContentElement, ContentProps>((props, ref) => {
return <RadixCollapsible.Content ref={ref} className={cx(className, 'fp-CollapsibleContent')} {...contentProps} />;
});

Root.displayName = 'Collapsible.Root';
Trigger.displayName = 'Collapsible.Trigger';
Content.displayName = 'Collapsible.Content';

export type { RootProps, ContentProps, TriggerProps };
export { Root, Content, Trigger };
10 changes: 10 additions & 0 deletions figma-kit/src/components/context-menu/context-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ const RadioItem = React.forwardRef<RadioItemElement, RadioItemProps>((props, ref
);
});

Content.displayName = 'ContextMenu.Content';
Item.displayName = 'ContextMenu.Item';
Separator.displayName = 'ContextMenu.Separator';
Label.displayName = 'ContextMenu.Label';
Group.displayName = 'ContextMenu.Group';
SubTrigger.displayName = 'ContextMenu.SubTrigger';
SubContent.displayName = 'ContextMenu.SubContent';
CheckboxItem.displayName = 'ContextMenu.CheckboxItem';
RadioItem.displayName = 'ContextMenu.RadioItem';

export type {
RootProps,
TriggerProps,
Expand Down
4 changes: 4 additions & 0 deletions figma-kit/src/components/dialog.base/dialog.base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@ const section = cva('fp-DialogBaseSection', {
},
});

Header.displayName = 'Dialog.Header';
Section.displayName = 'Dialog.Section';
Controls.displayName = 'Dialog.Controls';

export { Header, Section, Controls };
export type { HeaderProps, SectionProps, ControlsProps };
6 changes: 6 additions & 0 deletions figma-kit/src/components/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ const Close = React.forwardRef<CloseElement, CloseProps>((props, ref) => {
);
});

Trigger.displayName = 'Dialog.Trigger';
Content.displayName = 'Dialog.Content';
Overlay.displayName = 'Dialog.Overlay';
Title.displayName = 'Dialog.Title';
Close.displayName = 'Dialog.Close';

export type { RootProps, TriggerProps, PortalProps, ContentProps, OverlayProps, TitleProps, CloseProps };
export { Root, Trigger, Portal, Content, Overlay, Title, Close };
export type { HeaderProps, SectionProps, ControlsProps } from '@components/dialog.base/';
Expand Down
10 changes: 10 additions & 0 deletions figma-kit/src/components/dropdown-menu/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ const RadioItem = React.forwardRef<RadioItemElement, RadioItemProps>((props, ref
);
});

Content.displayName = 'DropdownMenu.Content';
Item.displayName = 'DropdownMenu.Item';
Separator.displayName = 'DropdownMenu.Separator';
Group.displayName = 'DropdownMenu.Group';
Label.displayName = 'DropdownMenu.Label';
SubTrigger.displayName = 'DropdownMenu.SubTrigger';
SubContent.displayName = 'DropdownMenu.SubContent';
CheckboxItem.displayName = 'DropdownMenu.CheckboxItem';
RadioItem.displayName = 'DropdownMenu.RadioItem';

export type {
RootProps,
TriggerProps,
Expand Down
2 changes: 2 additions & 0 deletions figma-kit/src/components/flex/flex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,7 @@ const Flex = React.forwardRef<FlexElement, FlexProps>((props, ref) => {
);
});

Flex.displayName = 'Flex';

export type { FlexProps };
export { Flex };
2 changes: 2 additions & 0 deletions figma-kit/src/components/icon-button/icon-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,7 @@ const IconButton = React.forwardRef<IconButtonElement, IconButtonProps>((props,
return disableTooltip ? buttonElement : <Tooltip content={tooltipContent ?? ariaLabel}>{buttonElement}</Tooltip>;
});

IconButton.displayName = 'IconButton';

export type { IconButtonProps };
export { IconButton };
2 changes: 2 additions & 0 deletions figma-kit/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ const Input = React.forwardRef<InputElement, InputProps>((props, forwardedRef) =
return <input ref={composedRef} type={type} className={cx(className, 'fp-Input')} {...inputProps} />;
});

Input.displayName = 'Input';

export type { InputProps };
export { Input };
5 changes: 5 additions & 0 deletions figma-kit/src/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ const Close = React.forwardRef<CloseElement, CloseProps>((props, ref) => {
);
});

Trigger.displayName = 'Popover.Trigger';
Content.displayName = 'Popover.Content';
Title.displayName = 'Popover.Title';
Close.displayName = 'Popover.Close';

export type { RootProps, TriggerProps, PortalProps, ContentProps, TitleProps, CloseProps, AnchorProps };
export { Root, Trigger, Content, Portal, Title, Close, Anchor };

Expand Down
4 changes: 4 additions & 0 deletions figma-kit/src/components/radio-group/radio-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,9 @@ const Label = React.forwardRef<LabelElement, LabelProps>((props, ref) => {
);
});

Root.displayName = 'RadioGroup.Root';
Item.displayName = 'RadioGroup.Item';
Label.displayName = 'RadioGroup.Label';

export type { RootProps, ItemProps, LabelProps };
export { Root, Item, Label };
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@ const Text = React.forwardRef<TextElement, TextProps>((props, ref) => {
return <TextPrimitive ref={ref} className={cx(className, 'fp-SegmentedControlText')} {...textProps} />;
});

Root.displayName = 'SegmentedControl.Root';
Item.displayName = 'SegmentedControl.Item';
Text.displayName = 'SegmentedControl.Text';

export type { RootProps, ItemProps, TextProps };
export { Root, Item, Text };
7 changes: 7 additions & 0 deletions figma-kit/src/components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,12 @@ const Group = React.forwardRef<GroupElement, GroupProps>((props, ref) => {
return <RadixSelect.Group ref={ref} className={cx(className, 'fp-MenuGroup')} {...groupProps} />;
});

Trigger.displayName = 'Select.Trigger';
Content.displayName = 'Select.Content';
Item.displayName = 'Select.Item';
Separator.displayName = 'Select.Separator';
Group.displayName = 'Select.Group';
Label.displayName = 'Select.Label';

export type { RootProps, TriggerProps, ContentProps, ItemProps, SeparatorProps, GroupProps, LabelProps };
export { Root, Trigger, Content, Item, Separator, Group, Label, Arrow };
2 changes: 2 additions & 0 deletions figma-kit/src/components/slider/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ const Slider = React.forwardRef<SliderElement, SliderProps>((props, forwardedRef
);
});

Slider.displayName = 'Slider';

type HintProps = {
hint: number;
baseValue?: number;
Expand Down
2 changes: 2 additions & 0 deletions figma-kit/src/components/switch/switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ const Switch = React.forwardRef<SwitchElement, SwitchProps>((props, ref) => {
);
});

Switch.displayName = 'Switch';

export type { SwitchProps };
export { Switch };
5 changes: 5 additions & 0 deletions figma-kit/src/components/tabs/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,10 @@ const Content = React.forwardRef<ContentElement, ContentProps>((props, ref) => {
return <RadixTabs.Content ref={ref} className={cx(className, 'fp-TabsContent')} {...contentProps} />;
});

Root.displayName = 'Tabs.Root';
List.displayName = 'Tabs.List';
Trigger.displayName = 'Tabs.Trigger';
Content.displayName = 'Tabs.Content';

export type { RootProps, ListProps, TriggerProps, ContentProps };
export { Root, List, Trigger, Content };
8 changes: 8 additions & 0 deletions figma-kit/src/components/text/text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const Text = React.forwardRef<TextElement, TextProps>((props, ref) => {
);
});

Text.displayName = 'Text';

type LabelElement = React.ElementRef<'label'>;
type LabelProps = React.ComponentPropsWithoutRef<'label'> & VariantProps<typeof text>;

Expand All @@ -71,6 +73,8 @@ const Label = React.forwardRef<LabelElement, LabelProps>((props, ref) => {
);
});

Label.displayName = 'Label';

type ParagraphElement = React.ElementRef<'p'>;
type ParagraphProps = React.ComponentPropsWithoutRef<'p'> & VariantProps<typeof text>;

Expand Down Expand Up @@ -98,6 +102,8 @@ type LinkProps = React.ComponentPropsWithoutRef<'a'> &
asChild?: boolean;
};

Paragraph.displayName = 'Paragraph';

const Link = React.forwardRef<LinkElement, LinkProps>((props, ref) => {
const { asChild, className, size, weight, align, block, ...linkProps } = props;
const Element = asChild ? Slot : 'a';
Expand All @@ -120,5 +126,7 @@ const Link = React.forwardRef<LinkElement, LinkProps>((props, ref) => {
);
});

Link.displayName = 'Link';

export type { TextProps, LabelProps, ParagraphProps, LinkProps };
export { Text, Label, Paragraph, Link };
2 changes: 2 additions & 0 deletions figma-kit/src/components/textarea/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ const Textarea = React.forwardRef<TextareaElement, TextareaProps>((props, ref) =
return <TextareaAutoSize className={cx(className, 'fp-textarea')} ref={ref} {...textareaProps} />;
});

Textarea.displayName = 'Textarea';

export type { TextareaProps };
export { Textarea };
2 changes: 2 additions & 0 deletions figma-kit/src/components/tooltip/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@ const Tooltip = React.forwardRef<TooltipElement, TooltipProps>((props, ref) => {
);
});

Tooltip.displayName = 'Tooltip';

export { TooltipProvider, Tooltip };
export type { TooltipProps, TooltipProviderProps };
2 changes: 2 additions & 0 deletions figma-kit/src/components/value-field/value-field-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,7 @@ const Base = <V,>(props: BaseProps<V>) => {
);
};

Base.displayName = 'ValueField.Base';

export type { BaseProps };
export { Base };
4 changes: 4 additions & 0 deletions figma-kit/src/components/value-field/value-field-elements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,9 @@ const Label = React.forwardRef<LabelElement, LabelProps>((props, ref) => {
);
});

Root.displayName = 'ValueField.Root';
Label.displayName = 'ValueField.Label';
Multi.displayName = 'ValueField.Multi';

export type { RootProps, LabelProps, MultiProps };
export { Root, Label, Multi, useValueFieldContext };

0 comments on commit d54f7f6

Please sign in to comment.