-
Notifications
You must be signed in to change notification settings - Fork 1
feat(ui): decouple interfaces from external interfaces #1445
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
base: main
Are you sure you want to change the base?
Conversation
|
|
TilmanHaupt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
taymoor89
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care. Good work.
I'd suggest to change public interfaces of the components as less as possible and for standard html attributes extend with React.HTMLElement<HTMLElement> so we don't have to individually specify them.
packages/ui-components/src/components/PopupMenu/PopupMenu.component.tsx
Outdated
Show resolved
Hide resolved
packages/ui-components/src/components/PopupMenu/PopupMenu.component.tsx
Outdated
Show resolved
Hide resolved
packages/ui-components/src/components/PopupMenu/PopupMenu.component.tsx
Outdated
Show resolved
Hide resolved
packages/ui-components/src/components/TabList/TabList.component.tsx
Outdated
Show resolved
Hide resolved
packages/ui-components/src/components/TabPanel/TabPanel.component.tsx
Outdated
Show resolved
Hide resolved
packages/ui-components/src/components/TabPanel/TabPanel.component.tsx
Outdated
Show resolved
Hide resolved
…pupMenu components
…couple-interfaces-from-external-interfaces
Summary
Type leakage in the ui-components package caused by public component interfaces extending types from third-party libraries. These leaked types introduce unintended compile-time dependencies for consumers and break the abstraction boundary of the package.
Changes Made
• Refactored PopupMenu public interfaces:
(PopupMenuProps, PopupMenuToggleProps, PopupMenuItemProps, PopupMenuOptionsProps) to use only our own/React types instead of types from @headlessui/react, while keeping Headless UI as an internal implementation detail.
• Introduced dedicated DateTimePicker type module (types.ts) with DateOption, DateLimit, LocaleKey, CustomLocale, and DateChangeHandler (plus backward-compatible Juno* aliases), and wired DateTimePickerProps to use these types instead of flatpickr types.
• Added internal mappers.ts for DateTimePicker to convert our public types into flatpickr types, ensuring that flatpickr remains fully encapsulated and its types are not exposed from the package.
• Updated Tab, TabList, and TabPanel components to define their own TabProps, TabListProps, and TabPanelProps instead of extending react-tabs types, keeping react-tabs usage internal.
• Adjusted packages/ui-components/src/index.ts exports so consumers import only our public DateTimePicker and PopupMenu/Tab types, with no direct dependency on third-party type definitions.
Related Issues
Testing Instructions
pnpm ipnpm lintpnpm testChecklist
PR Manifesto
Review the PR Manifesto for best practises.