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

Merged
merged 8 commits into from
Jan 6, 2025
Merged

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

🦋 Changeset detected

Latest commit: f54f105

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@razorpay/blade Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another 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 f54f105:

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.150 8.095 -0.055 KB
ActionList, ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemText, ActionListSection 16.596 16.609 +0.013 KB
Alert 11.535 11.511 -0.024 KB
ButtonGroup 1.206 1.269 +0.063 KB
Card, CardBody, CardHeader, CardHeaderIcon, CardHeaderIconButton, CardHeaderLeading, CardHeaderTrailing, CardFooter, CardFooterLeading, CardFooterTrailing 9.363 9.354 -0.009 KB
Carousel, CarouselItem 7.116 7.129 +0.013 KB
Checkbox 6.343 6.358 +0.015 KB
Chip, ChipGroup 8.464 8.477 +0.013 KB
DatePicker 86.611 86.631 +0.020 KB
Drawer, DrawerBody, DrawerHeader, drawerPadding 17.363 17.503 +0.140 KB
Dropdown, DropdownOverlay, DropdownButton, DropdownLink, DropdownFooter, DropdownHeader 28.813 28.804 -0.009 KB
FileUpload 17.730 17.734 +0.004 KB
Menu, MenuItem, MenuOverlay, MenuDivider, MenuFooter, MenuHeader 29.473 29.477 +0.004 KB
Popover, PopoverInteractiveWrapper 21.380 21.376 -0.004 KB
Radio 5.060 5.079 +0.019 KB
Scale 0.904 0.901 -0.003 KB
SideNav, SideNavLink, SideNavLevel, SideNavSection, SideNavItem, SideNavFooter, SideNavBody, SIDE_NAV_EXPANDED_L1_WIDTH_BASE, SIDE_NAV_EXPANDED_L1_WIDTH_XL 33.177 33.323 +0.146 KB
SpotlightPopoverTour, SpotlightPopoverTourFooter, SpotlightPopoverTourStep 29.782 29.784 +0.002 KB
Switch 4.822 4.837 +0.015 KB
Table, TableHeader, TableHeaderCell, TableHeaderRow, TableBody, TableCell, TableRow, TableFooter, TableFooterCell, TableFooterRow, TablePagination, TableToolbar, TableToolbarActions, TableEditableCell, TableEditableDropdownCell 66.812 66.832 +0.020 KB
Tabs, TabItem, TabList, TabPanel 7.279 7.293 +0.014 KB
Tag 3.861 3.848 -0.013 KB
ToastContainer, useToast 12.876 12.862 -0.014 KB
Tooltip, TooltipInteractiveWrapper 15.879 15.895 +0.016 KB
IconButton 1.107 1.086 -0.021 KB
CheckboxGroup 5.096 5.109 +0.013 KB
SelectInput, AutoComplete 36.535 36.531 -0.004 KB
OTPInput 30.325 30.339 +0.014 KB
PasswordInput 32.093 32.075 -0.018 KB
PhoneNumberInput 60.767 60.805 +0.038 KB
SearchInput 34.754 34.753 -0.001 KB
TextArea 32.568 32.590 +0.022 KB
TextInput 34.153 34.166 +0.013 KB
RadioGroup 5.077 5.099 +0.022 KB

Generated by 🚫 dangerJS against f54f105

@@ -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.

saurabhdaware
saurabhdaware previously approved these changes Jan 2, 2025
Copy link
Member

@saurabhdaware saurabhdaware left a comment

Choose a reason for hiding this comment

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

lgtm

@anuraghazra anuraghazra merged commit e00172b into master Jan 6, 2025
12 of 14 checks passed
@anuraghazra anuraghazra deleted the anu/x-changes branch January 6, 2025 10:40
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