Skip to content

Commit

Permalink
feat: added displayName to several components based on dot notation.
Browse files Browse the repository at this point in the history
  • Loading branch information
soslayando committed Apr 9, 2024
1 parent 530bdbd commit ecd516d
Show file tree
Hide file tree
Showing 18 changed files with 106 additions and 26 deletions.
3 changes: 3 additions & 0 deletions packages/core/src/components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,6 @@ Badge._Icon = Icon;
Badge._Text = BadgeText;

InternalBadge.displayName = 'Badge';
Badge._Container.displayName = 'Badge._Container';
Badge._Icon.displayName = 'Badge._Icon';
Badge._Text.displayName = 'Badge._Text';
7 changes: 7 additions & 0 deletions packages/core/src/components/Banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,10 @@ Banner._Heading = BannerHeading;
Banner._Icon = BannerIcon;

InternalBanner.displayName = 'Banner';
Banner._Actions.displayName = 'Banner._Actions';
Banner._Close.displayName = 'Banner._Close';
Banner._Container.displayName = 'Banner._Container';
Banner._Content.displayName = 'Banner._Content';
Banner._ContentContainer.displayName = 'Banner._ContentContainer';
Banner._Heading.displayName = 'Banner._Heading';
Banner._Icon.displayName = 'Banner._Icon';
8 changes: 8 additions & 0 deletions packages/core/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,11 @@ Button._Loader = ButtonLoader;
Button._Selection = ButtonSelection;

InternalButton.displayName = 'Button';
Button._Addon.displayName = 'Button._Addon';
Button._Badge.displayName = 'Button._Badge';
Button._Container.displayName = 'Button._Container';
Button._DropdownIcon.displayName = 'Button._DropdownIcon';
Button._Icon.displayName = 'Button._Icon';
Button._Label.displayName = 'Button._Label';
Button._Loader.displayName = 'Button._Loader';
Button._Selection.displayName = 'Button._Selection';
1 change: 0 additions & 1 deletion packages/core/src/components/ButtonGroup/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ ButtonGroup.IconButton = ButtonGroupIconButton;
ButtonGroup.Item = ButtonGroupItem;

InternalButtonGroup.displayName = 'ButtonGroup';

ButtonGroup.Button.displayName = 'ButtonGroup.Button';
ButtonGroup.IconButton.displayName = 'ButtonGroup.IconButton';
ButtonGroup.Item.displayName = 'ButtonGroup.Item';
6 changes: 6 additions & 0 deletions packages/core/src/components/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,9 @@ Chip._Container = ChipContainer;
Chip._Content = ChipContent;
Chip._HiddenInput = ChipHiddenInput;
Chip._Icon = ChipIcon;

InternalChip.displayName = 'Chip';
Chip._Container.displayName = 'Chip._Container';
Chip._Content.displayName = 'Chip._Content';
Chip._HiddenInput.displayName = 'Chip._HiddenInput';
Chip._Icon.displayName = 'Chip._Icon';
1 change: 1 addition & 0 deletions packages/core/src/components/ChipGroup/ChipGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ export const ChipGroup = InternalChipGroup as typeof InternalChipGroup & {
ChipGroup.Chip = ChipGroupChip;

InternalChipGroup.displayName = 'ChipGroup';
ChipGroup.Chip.displayName = 'ChipGroup.Chip';
1 change: 1 addition & 0 deletions packages/core/src/components/ChoiceGroup/ChoiceGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ export const ChoiceGroup = InternalChoiceGroup as typeof InternalChoiceGroup & {
ChoiceGroup.IconButton = ChoiceGroupIconButton;

InternalChoiceGroup.displayName = 'ChoiceGroup';
ChoiceGroup.IconButton.displayName = 'ChoiceGroup.IconButton';
7 changes: 6 additions & 1 deletion packages/core/src/components/Collapse/Collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ export const Collapse = InternalCollapse as typeof InternalCollapse & {
_Heading: typeof CollapseHeading;
};

Collapse._Marker = CollapseMarker;
Collapse._Container = CollapseContainer;
Collapse._Heading = CollapseHeading;
Collapse._Marker = CollapseMarker;

InternalCollapse.displayName = 'Collapse';
Collapse._Container.displayName = 'Collapse._Container';
Collapse._Heading.displayName = 'Collapse._Heading';
Collapse._Marker.displayName = 'Collapse._Marker';
16 changes: 13 additions & 3 deletions packages/core/src/components/Field/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { IField } from './declarations';
import type { TUIColorScheme } from '../../declarations';

import { hasStatus } from '../../utils/validations';
import { FieldContext } from './context';

import {
FieldAddon,
Expand All @@ -17,12 +18,11 @@ import {
FieldRequiredMark,
} from './components';
import { FieldHelper } from './components/FieldHelper';
import { FieldContext } from './context';

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface FieldProps extends IField {}

export const PartField: React.FC<FieldProps> = ({
export const InternalField: React.FC<FieldProps> = ({
as,
children,
disabled = false,
Expand Down Expand Up @@ -122,7 +122,7 @@ export const PartField: React.FC<FieldProps> = ({
);
};

export const Field = PartField as typeof PartField & {
export const Field = InternalField as typeof InternalField & {
_Addon: typeof FieldAddon;
_Container: typeof FieldContainer;
_ControlDistributor: typeof FieldControlDistributor;
Expand All @@ -141,3 +141,13 @@ Field._FloatingHelper = FieldFloatingHelper;
Field._Label = FieldLabel;
Field._LabelDistributor = FieldLabelDistributor;
Field._RequiredMark = FieldRequiredMark;

InternalField.displayName = 'Field';
Field._Addon.displayName = 'Field._Addon';
Field._Container.displayName = 'Field._Container';
Field._ControlDistributor.displayName = 'Field._ControlDistributor';
Field._Helper.displayName = 'Field._Helper';
Field._FloatingHelper.displayName = 'Field._FloatingHelper';
Field._Label.displayName = 'Field._Label';
Field._LabelDistributor.displayName = 'Field._LabelDistributor';
Field._RequiredMark.displayName = 'Field._RequiredMark';
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,10 @@ FieldsCombiner.Input = FieldsCombinerInput;
FieldsCombiner.Select = FieldsCombinerSelect;
FieldsCombiner.Checkbox = FieldsCombinerCheckbox;

FieldsCombiner.displayName = 'FieldsCombiner';
InternalFieldsCombiner.displayName = 'FieldsCombiner';
FieldsCombiner.Button.displayName = 'FieldsCombiner.Button';
FieldsCombiner.IconButton.displayName = 'FieldsCombiner.IconButton';
FieldsCombiner.Item.displayName = 'FieldsCombiner.Item';
FieldsCombiner.Input.displayName = 'FieldsCombiner.Input';
FieldsCombiner.Select.displayName = 'FieldsCombiner.Select';
FieldsCombiner.Checkbox.displayName = 'FieldsCombiner.Checkbox';
5 changes: 5 additions & 0 deletions packages/core/src/components/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ IconButton._Loader = ButtonLoader;
IconButton._Selection = ButtonSelection;

InternalIconButton.displayName = 'IconButton';
IconButton._Badge.displayName = 'IconButton._Badge';
IconButton._Container.displayName = 'IconButton._Container';
IconButton._Icon.displayName = 'IconButtonC._Icon';
IconButton._Loader.displayName = 'IconButton._Loader';
IconButton._Selection.displayName = 'IconButton._Selection';
6 changes: 6 additions & 0 deletions packages/core/src/components/InlineMessage/InlineMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,9 @@ InlineMessage.Arrow = InlineMessageArrow;
InlineMessage.Banner = InlineMessageBanner;
InlineMessage.Panel = InlineMessagePanel;
InlineMessage.Trigger = InlineMessageTrigger;

PartInlineMessage.displayName = 'InlineMessage';
InlineMessage.Arrow.displayName = 'InlineMessage.Arrow';
InlineMessage.Banner.displayName = 'InlineMessage.Banner';
InlineMessage.Panel.displayName = 'InlineMessage.Panel';
InlineMessage.Trigger.displayName = 'InlineMessage.Trigger';
6 changes: 6 additions & 0 deletions packages/core/src/components/InputControl/InputControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,9 @@ InputControl._InnerContainer = InputControlInnerContainer;
InputControl._ShowPassword = InputControlShowPassword;

InternalInputControl.displayName = 'InputControl';
InputControl._Addon.displayName = 'InputControl._Addon';
InputControl._Container.displayName = 'InputControl._Container';
InputControl._Icon.displayName = 'InputControl._Icon';
InputControl._Input.displayName = 'InputControl._Input';
InputControl._InnerContainer.displayName = 'InputControl._InnerContainer';
InputControl._ShowPassword.displayName = 'InputControl._ShowPassword';
1 change: 0 additions & 1 deletion packages/core/src/components/ProgressBar/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ ProgressBar._StandardBar = ProgressBarStandardBar;
ProgressBar._CircularBar = ProgressBarCircularBar;

InternalProgressBar.displayName = 'ProgressBar';

ProgressBar._Container.displayName = 'ProgressBar._Container';
ProgressBar._CustomInfo.displayName = 'ProgressBar._CustomInfo';
ProgressBar._Helper.displayName = 'ProgressBar._Helper';
Expand Down
29 changes: 18 additions & 11 deletions packages/core/src/components/StatusMessage/StatusMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface StatusMessageProps
status?: TGlobalStatus;
}

export const InternalStatusMessage = ({
export const InternalStatusMessage: React.FC<StatusMessageProps> = ({
'aria-describedby': ariaDescribedBy,
'aria-details': ariaDetails,
'aria-label': ariaLabel,
Expand Down Expand Up @@ -108,15 +108,22 @@ export const InternalStatusMessage = ({

export const StatusMessage =
InternalStatusMessage as typeof InternalStatusMessage & {
Buttons: typeof StatusMessageButtons;
Container: typeof StatusMessageContainer;
Description: typeof StatusMessageDescription;
Icon: typeof StatusMessageIcon;
Title: typeof StatusMessageTitle;
_Buttons: typeof StatusMessageButtons;
_Container: typeof StatusMessageContainer;
_Description: typeof StatusMessageDescription;
_Icon: typeof StatusMessageIcon;
_Title: typeof StatusMessageTitle;
};

StatusMessage.Buttons = StatusMessageButtons;
StatusMessage.Container = StatusMessageContainer;
StatusMessage.Description = StatusMessageDescription;
StatusMessage.Icon = StatusMessageIcon;
StatusMessage.Title = StatusMessageTitle;
StatusMessage._Buttons = StatusMessageButtons;
StatusMessage._Container = StatusMessageContainer;
StatusMessage._Description = StatusMessageDescription;
StatusMessage._Icon = StatusMessageIcon;
StatusMessage._Title = StatusMessageTitle;

InternalStatusMessage.displayName = 'StatusMessage';
StatusMessage._Buttons.displayName = 'StatusMessage._Buttons';
StatusMessage._Container.displayName = 'StatusMessage._Container';
StatusMessage._Description.displayName = 'StatusMessage._Description';
StatusMessage._Icon.displayName = 'StatusMessage._Icon';
StatusMessage._Title.displayName = 'StatusMessage._Title';
4 changes: 4 additions & 0 deletions packages/core/src/components/Stepper/Stepper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@ export const Stepper = InternalStepper as typeof InternalStepper & {
};

Stepper.Container = StepperContainer;

InternalStepper.displayName = 'Stepper';
Stepper.Container.displayName = 'Stepper.Container';
Stepper.Item.displayName = 'Stepper.Item';

Check failure on line 72 in packages/core/src/components/Stepper/Stepper.tsx

View workflow job for this annotation

GitHub Actions / test

src/components/Stepper/Stepper.test.tsx

TypeError: Cannot set properties of undefined (setting 'displayName') ❯ src/components/Stepper/Stepper.tsx:72:14 ❯ src/components/Stepper/Stepper.test.tsx:4:31
22 changes: 14 additions & 8 deletions packages/core/src/components/SwitchControl/SwitchControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,19 @@ export const InternalSwitchControl: React.FC<SwitchControlProps> = ({

export const SwitchControl =
InternalSwitchControl as typeof InternalSwitchControl & {
Container: typeof SwitchControlContainer;
Handle: typeof SwitchControlHandle;
Input: typeof SwitchControlInput;
Text: typeof SwitchControlText;
_Container: typeof SwitchControlContainer;
_Handle: typeof SwitchControlHandle;
_Input: typeof SwitchControlInput;
_Text: typeof SwitchControlText;
};

SwitchControl.Container = SwitchControlContainer;
SwitchControl.Handle = SwitchControlHandle;
SwitchControl.Input = SwitchControlInput;
SwitchControl.Text = SwitchControlText;
SwitchControl._Container = SwitchControlContainer;
SwitchControl._Handle = SwitchControlHandle;
SwitchControl._Input = SwitchControlInput;
SwitchControl._Text = SwitchControlText;

InternalSwitchControl.displayName = 'SwitchControl';
SwitchControl._Container.displayName = 'SwitchControl._Container';
SwitchControl._Handle.displayName = 'SwitchControl._Handle';
SwitchControl._Input.displayName = 'SwitchControl._Input';
SwitchControl._Text.displayName = 'SwitchControl._Text';
1 change: 1 addition & 0 deletions packages/datetime/src/components/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,4 @@ export const Calendar = InternalCalendar as typeof InternalCalendar & {
Calendar.Cell = Cell;

InternalCalendar.displayName = 'Calendar';
Calendar.Cell.displayName = 'Calendar.Cell';

0 comments on commit ecd516d

Please sign in to comment.