From ecd516d40ccbfc6d5a289bf9fc72efeaad9a4e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Andre=CC=81s=20Granero?= Date: Tue, 9 Apr 2024 14:22:41 +0200 Subject: [PATCH] feat: added displayName to several components based on dot notation. --- packages/core/src/components/Badge/Badge.tsx | 3 ++ .../core/src/components/Banner/Banner.tsx | 7 +++++ .../core/src/components/Button/Button.tsx | 8 +++++ .../components/ButtonGroup/ButtonGroup.tsx | 1 - packages/core/src/components/Chip/Chip.tsx | 6 ++++ .../src/components/ChipGroup/ChipGroup.tsx | 1 + .../components/ChoiceGroup/ChoiceGroup.tsx | 1 + .../core/src/components/Collapse/Collapse.tsx | 7 ++++- packages/core/src/components/Field/Field.tsx | 16 ++++++++-- .../FieldsCombiner/FieldsCombiner.tsx | 8 ++++- .../src/components/IconButton/IconButton.tsx | 5 ++++ .../InlineMessage/InlineMessage.tsx | 6 ++++ .../components/InputControl/InputControl.tsx | 6 ++++ .../components/ProgressBar/ProgressBar.tsx | 1 - .../StatusMessage/StatusMessage.tsx | 29 ++++++++++++------- .../core/src/components/Stepper/Stepper.tsx | 4 +++ .../SwitchControl/SwitchControl.tsx | 22 +++++++++----- .../src/components/Calendar/Calendar.tsx | 1 + 18 files changed, 106 insertions(+), 26 deletions(-) diff --git a/packages/core/src/components/Badge/Badge.tsx b/packages/core/src/components/Badge/Badge.tsx index e5fec6328..3ec57ffa7 100644 --- a/packages/core/src/components/Badge/Badge.tsx +++ b/packages/core/src/components/Badge/Badge.tsx @@ -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'; diff --git a/packages/core/src/components/Banner/Banner.tsx b/packages/core/src/components/Banner/Banner.tsx index 6d5af70fd..fc88f9b8d 100644 --- a/packages/core/src/components/Banner/Banner.tsx +++ b/packages/core/src/components/Banner/Banner.tsx @@ -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'; diff --git a/packages/core/src/components/Button/Button.tsx b/packages/core/src/components/Button/Button.tsx index 8b0e9c49a..7eabd1740 100644 --- a/packages/core/src/components/Button/Button.tsx +++ b/packages/core/src/components/Button/Button.tsx @@ -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'; diff --git a/packages/core/src/components/ButtonGroup/ButtonGroup.tsx b/packages/core/src/components/ButtonGroup/ButtonGroup.tsx index b9cc651fa..906c624d2 100644 --- a/packages/core/src/components/ButtonGroup/ButtonGroup.tsx +++ b/packages/core/src/components/ButtonGroup/ButtonGroup.tsx @@ -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'; diff --git a/packages/core/src/components/Chip/Chip.tsx b/packages/core/src/components/Chip/Chip.tsx index d57da43a6..ec7d9babb 100644 --- a/packages/core/src/components/Chip/Chip.tsx +++ b/packages/core/src/components/Chip/Chip.tsx @@ -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'; diff --git a/packages/core/src/components/ChipGroup/ChipGroup.tsx b/packages/core/src/components/ChipGroup/ChipGroup.tsx index 73afa0ba2..f87d2c94f 100644 --- a/packages/core/src/components/ChipGroup/ChipGroup.tsx +++ b/packages/core/src/components/ChipGroup/ChipGroup.tsx @@ -82,3 +82,4 @@ export const ChipGroup = InternalChipGroup as typeof InternalChipGroup & { ChipGroup.Chip = ChipGroupChip; InternalChipGroup.displayName = 'ChipGroup'; +ChipGroup.Chip.displayName = 'ChipGroup.Chip'; diff --git a/packages/core/src/components/ChoiceGroup/ChoiceGroup.tsx b/packages/core/src/components/ChoiceGroup/ChoiceGroup.tsx index 367b356ed..c72da6f26 100644 --- a/packages/core/src/components/ChoiceGroup/ChoiceGroup.tsx +++ b/packages/core/src/components/ChoiceGroup/ChoiceGroup.tsx @@ -69,3 +69,4 @@ export const ChoiceGroup = InternalChoiceGroup as typeof InternalChoiceGroup & { ChoiceGroup.IconButton = ChoiceGroupIconButton; InternalChoiceGroup.displayName = 'ChoiceGroup'; +ChoiceGroup.IconButton.displayName = 'ChoiceGroup.IconButton'; diff --git a/packages/core/src/components/Collapse/Collapse.tsx b/packages/core/src/components/Collapse/Collapse.tsx index 845d28d47..067874f65 100644 --- a/packages/core/src/components/Collapse/Collapse.tsx +++ b/packages/core/src/components/Collapse/Collapse.tsx @@ -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'; diff --git a/packages/core/src/components/Field/Field.tsx b/packages/core/src/components/Field/Field.tsx index cb420db9e..ea22001c4 100644 --- a/packages/core/src/components/Field/Field.tsx +++ b/packages/core/src/components/Field/Field.tsx @@ -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, @@ -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 = ({ +export const InternalField: React.FC = ({ as, children, disabled = false, @@ -122,7 +122,7 @@ export const PartField: React.FC = ({ ); }; -export const Field = PartField as typeof PartField & { +export const Field = InternalField as typeof InternalField & { _Addon: typeof FieldAddon; _Container: typeof FieldContainer; _ControlDistributor: typeof FieldControlDistributor; @@ -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'; diff --git a/packages/core/src/components/FieldsCombiner/FieldsCombiner.tsx b/packages/core/src/components/FieldsCombiner/FieldsCombiner.tsx index a61c72c3b..d730c488d 100644 --- a/packages/core/src/components/FieldsCombiner/FieldsCombiner.tsx +++ b/packages/core/src/components/FieldsCombiner/FieldsCombiner.tsx @@ -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'; diff --git a/packages/core/src/components/IconButton/IconButton.tsx b/packages/core/src/components/IconButton/IconButton.tsx index ea7cef26d..7535b168f 100644 --- a/packages/core/src/components/IconButton/IconButton.tsx +++ b/packages/core/src/components/IconButton/IconButton.tsx @@ -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'; diff --git a/packages/core/src/components/InlineMessage/InlineMessage.tsx b/packages/core/src/components/InlineMessage/InlineMessage.tsx index 058993e8b..0220b86e8 100644 --- a/packages/core/src/components/InlineMessage/InlineMessage.tsx +++ b/packages/core/src/components/InlineMessage/InlineMessage.tsx @@ -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'; diff --git a/packages/core/src/components/InputControl/InputControl.tsx b/packages/core/src/components/InputControl/InputControl.tsx index c9df2f96a..8c633f021 100644 --- a/packages/core/src/components/InputControl/InputControl.tsx +++ b/packages/core/src/components/InputControl/InputControl.tsx @@ -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'; diff --git a/packages/core/src/components/ProgressBar/ProgressBar.tsx b/packages/core/src/components/ProgressBar/ProgressBar.tsx index bd33fc1ce..ea1f302ff 100644 --- a/packages/core/src/components/ProgressBar/ProgressBar.tsx +++ b/packages/core/src/components/ProgressBar/ProgressBar.tsx @@ -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'; diff --git a/packages/core/src/components/StatusMessage/StatusMessage.tsx b/packages/core/src/components/StatusMessage/StatusMessage.tsx index aef93afa6..66184d540 100644 --- a/packages/core/src/components/StatusMessage/StatusMessage.tsx +++ b/packages/core/src/components/StatusMessage/StatusMessage.tsx @@ -31,7 +31,7 @@ export interface StatusMessageProps status?: TGlobalStatus; } -export const InternalStatusMessage = ({ +export const InternalStatusMessage: React.FC = ({ 'aria-describedby': ariaDescribedBy, 'aria-details': ariaDetails, 'aria-label': ariaLabel, @@ -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'; diff --git a/packages/core/src/components/Stepper/Stepper.tsx b/packages/core/src/components/Stepper/Stepper.tsx index 5dccdb429..f5336ec17 100644 --- a/packages/core/src/components/Stepper/Stepper.tsx +++ b/packages/core/src/components/Stepper/Stepper.tsx @@ -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'; diff --git a/packages/core/src/components/SwitchControl/SwitchControl.tsx b/packages/core/src/components/SwitchControl/SwitchControl.tsx index 394691a60..776a0a9da 100644 --- a/packages/core/src/components/SwitchControl/SwitchControl.tsx +++ b/packages/core/src/components/SwitchControl/SwitchControl.tsx @@ -126,13 +126,19 @@ export const InternalSwitchControl: React.FC = ({ 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'; diff --git a/packages/datetime/src/components/Calendar/Calendar.tsx b/packages/datetime/src/components/Calendar/Calendar.tsx index e4167e850..2ec809135 100644 --- a/packages/datetime/src/components/Calendar/Calendar.tsx +++ b/packages/datetime/src/components/Calendar/Calendar.tsx @@ -171,3 +171,4 @@ export const Calendar = InternalCalendar as typeof InternalCalendar & { Calendar.Cell = Cell; InternalCalendar.displayName = 'Calendar'; +Calendar.Cell.displayName = 'Calendar.Cell';