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

feat(blade): Changes in components for X migration #2448

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

anuraghazra
Copy link
Member

@anuraghazra anuraghazra commented Dec 17, 2024

Description

Drawer:

  • Changed the drawer's showOverlay behaviour to not mandate the overlay on level2 stacking
  • Exposed ref

RadioGroup:

  • Exposed event in onChange

ButtonGroup:

  • Added styled props
  • Added support for Tooltip inside ButtonGroup

IconButton:

  • Added styledProps

SideNavLink:

  • Added onClick

Component Checklist

  • Update Component Status Page
  • Perform Manual Testing in Other Browsers
  • Add KitchenSink Story
  • Add Interaction Tests (if applicable)
  • Add changeset

Copy link
Contributor

github-actions bot commented Dec 17, 2024

✅ PR title follows Conventional Commits specification.

Copy link

changeset-bot bot commented Dec 17, 2024

⚠️ No Changeset found

Latest commit: 47f20db

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codesandbox-ci bot commented Dec 17, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 47f20db:

Sandbox Source
razorpay/blade: basic Configuration

@rzpcibot
Copy link
Collaborator

rzpcibot commented Dec 17, 2024

Bundle Size Report

Updated Components
Status Component Base Size (kb) Current Size (kb) Diff
Accordion, AccordionItemHeader, AccordionItemBody, AccordionItem 8.147 8.092 -0.055 KB
ActionList, ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection 16.634 16.647 +0.013 KB
Alert 11.535 11.513 -0.022 KB
ButtonGroup 1.206 1.267 +0.061 KB
Card, CardBody, CardHeader, CardHeaderIcon, CardHeaderIconButton, CardHeaderLeading, CardHeaderTrailing, CardFooter, CardFooterLeading, CardFooterTrailing 9.367 9.358 -0.009 KB
Carousel, CarouselItem 7.143 7.158 +0.015 KB
Checkbox 6.381 6.396 +0.015 KB
Chip, ChipGroup 8.508 8.520 +0.012 KB
DatePicker 86.641 86.651 +0.010 KB
Drawer, DrawerBody, DrawerHeader, drawerPadding 17.364 17.507 +0.143 KB
Dropdown, DropdownOverlay, DropdownButton, DropdownLink, DropdownFooter, DropdownHeader 28.830 28.831 +0.001 KB
FileUpload 17.761 17.767 +0.006 KB
Menu, MenuItem, MenuOverlay, MenuDivider, MenuFooter, MenuHeader 29.515 29.503 -0.012 KB
Popover, PopoverInteractiveWrapper 21.421 21.411 -0.010 KB
Radio 5.109 5.128 +0.019 KB
SideNav, SideNavLink, SideNavLevel, SideNavSection, SideNavItem, SideNavFooter, SideNavBody, SIDE_NAV_EXPANDED_L1_WIDTH_BASE, SIDE_NAV_EXPANDED_L1_WIDTH_XL 33.185 33.331 +0.146 KB
SpotlightPopoverTour, SpotlightPopoverTourFooter, SpotlightPopoverTourStep 29.817 29.809 -0.008 KB
Switch 4.861 4.876 +0.015 KB
Table, TableHeader, TableHeaderCell, TableHeaderRow, TableBody, TableCell, TableRow, TableFooter, TableFooterCell, TableFooterRow, TablePagination, TableToolbar, TableToolbarActions, TableEditableCell, TableEditableDropdownCell 66.838 66.851 +0.013 KB
Tabs, TabItem, TabList, TabPanel 7.317 7.331 +0.014 KB
Tag 3.860 3.845 -0.015 KB
ToastContainer, useToast 12.874 12.860 -0.014 KB
Tooltip, TooltipInteractiveWrapper 15.880 15.898 +0.018 KB
IconButton 1.109 1.085 -0.024 KB
CheckboxGroup 5.124 5.138 +0.014 KB
SelectInput, AutoComplete 36.526 36.524 -0.002 KB
OTPInput 30.313 30.328 +0.015 KB
PasswordInput 32.084 32.067 -0.017 KB
PhoneNumberInput 60.801 60.827 +0.026 KB
SearchInput 34.752 34.751 -0.001 KB
TextArea 32.601 32.616 +0.015 KB
TextInput 34.192 34.205 +0.013 KB
RadioGroup 5.100 5.122 +0.022 KB

Generated by 🚫 dangerJS against 47f20db

@@ -108,6 +110,7 @@ const _IconButton: React.ForwardRefRenderFunction<BladeElementRef, IconButtonPro
onTouchEnd={onTouchEnd}
onTouchStart={onTouchStart}
{...makeAnalyticsAttribute(rest)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{...makeAnalyticsAttribute(rest)}

I think we can remove this {...makeAnalyticsAttribute(rest)}, since we are now using ...rest, which handles the analytics attributes.

@@ -121,6 +123,7 @@ const StyledIconButton = React.forwardRef<HTMLButtonElement, StyledIconButtonPro
{...makeAccessible({ label: accessibilityLabel })}
{...metaAttribute({ name: MetaConstants.IconButton, testID })}
{...makeAnalyticsAttribute(rest)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{...makeAnalyticsAttribute(rest)}

componentName: 'ButtonGroup',
children,
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 🤝

);
});

it('should throw error with invalid dropdown children', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this test?

Copy link
Member Author

@anuraghazra anuraghazra Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this test since useVerifyAllowedChildren already handles the logic.

Additionally, the previous check felt overly defensive. It validated nested components like ButtonGroup -> Dropdown -> DropdownButton, which isn’t necessary because anything other than a button inside ButtonGroup is already visually broken. Plus, it complicates composition unnecessarily—for instance, you wouldn’t be able to use <Tooltip><DropdownButton /></Tooltip>

@@ -264,6 +265,8 @@ const SideNavLink = ({
isFirstRender: false,
});
}

onClick?.(e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might have to pass this in isL3Trigger block as well so that onClick is also supported on that collapsible sidenavlink of l3 trigger

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, done.

* Extra data to be passed to `onChange` callback
* Example use case: passing event object to `onChange` callback
*/
extraData?: any,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we not call this "event" itself?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, wanted to keep this param a bit generic, imagine in some component maybe not event but we could pass around any data object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants