Overview
Tonic UI v2 has officially been released. The most significant improvement is that it no longer embeds all icons. Instead, you'll need to import individual icon components as needed. This change results in a substantial reduction in bundle size. We conducted a test by comparing the bundle size of a simple React app built with both versions 1.29.2
and 2.0.0
to confirm this improvement.
As illustrated in the graph below, the size of @tonic-ui rendered after tree shaking decreased from 630.01KB to 133.85KB. This reduction saves approximately 500KB for a kickstart app.
@tonic-ui/[email protected]
vite v4.5.3 building for production...
✓ 1032 modules transformed.
output/index.html 2.68 kB │ gzip: 1.22 kB
output/static/index-bad4b52b.js 4.09 kB │ gzip: 1.90 kB
output/static/vendor-48c2906a.js 876.35 kB │ gzip: 265.40 kB
(!) Some chunks are larger than 500 kBs after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 6.76s
root rendered: 1.55MB
@tonic-ui rendered: 630.01KB (39.81%)
@tonic-ui/[email protected]
vite v4.5.3 building for production...
✓ 1504 modules transformed.
output/index.html 2.68 kB │ gzip: 1.22 kB
output/static/index-dc6ba10f.js 4.09 kB │ gzip: 1.90 kB
output/static/vendor-52292424.js 350.35 kB │ gzip: 111.77 kB
✓ built in 5.38s
root rendered: 645.77KB
@tonic-ui rendered: 133.85KB (20.73%)
Migration from v1 to v2
https://trendmicro-frontend.github.io/tonic-ui/react/v2/getting-started/migration-v1-to-v2
What's Changed
- feat: prepare for v2 release by @cheton in #834
- feat: move date picker components from
@tonic-ui/react-lab
to@tonic-ui/react
by @cheton in #858
P2
-
The CSS
fill
andstroke
properties for SVG elements are removed fromstyled-system
-
Prepare a
codemod
migration tool to automate the process of migrating icons from v1 usage to v2 usage in the codebase.npx @tonic-ui/codemod@latest react/v2.0.0/import-react-icons <path>
-
v1 to v2 migration guide
-
Address issues identified in #687 forAlert
,Toast
, andTag
components -
Mark
ToastProvider
anduseToast
as deprecated in v2 and plan for their complete removal in the subsequent major release. Update your code to useToastManager
anduseToastManager
instead. #687 -
AccordionCollapse
will be marked as deprecated in v2 and plan for their complete removal in the subsequent major release. Update your code to useAccordionContent
instead. -
Enhance
Tooltip
component. #701- Support light or dark background colors #754
- Figma: https://www.figma.com/file/bHr2zAshr0D5ROp8vCVPFR/%F0%9F%92%BC-Tonic---Dark-Mode?type=design&node-id=51221-177231&mode=design&t=LsTmDjCmwmIv0zsk-4
- Hide the arrow by default. Note: arrow is required only for icon tooltips.
-
Update default values for the
OverflowTooltip
component:arrow={false}
nextToCursor={true}
-
Table component updates
- Deprecate
TableHeaderRow
and replace it withTableRow
- Deprecate
TableHeaderCell
and replace it withTableCell
- Deprecate
-
Move the
ref
prop to the outermost element forCheckbox
,Radio
, andSwitch
components
If you were using theref
prop to get the checked status, renameref
toinputRef
to retrieve the checked status.- Checkbox
- <Checkbox ref={checkboxRef} /> + <Checkbox inputRef={checkboxRef} />
- Radio
- <Radio ref={radioRef} /> + <Radio inputRef={radioRef} />
- Switch
- <Switch ref={switchRef} /> + <Switch inputRef={switchRef} />
- Checkbox
- Color style refinement
- Figma: https://www.figma.com/file/xqZ6ZSFUg6q6KedXzj4rP1/Tonic---Style-Guidelines?type=design&node-id=13521-5530&mode=design&t=3LNrpa2CyoEpbMhI-4
- Deprecate
severity
color scheme - Add
functional
color scheme - Provide examples for product-specific severity and risk colors
- Tag
- Figma: https://www.figma.com/file/N84ebgxXVKZTMVClV2x0VP/Pattern-guideline?type=design&node-id=19406-59084&mode=design&t=PeX7kEn7mLby1l1l-4
- Limit display to 5 menu items, with a scrollbar if exceeded
- Enable keyboard navigation and operation
- Highlight only the first item with a perfect match
- Deprecated components
AccordionCollapse
is deprecated and will be removed in the next major release. UseAccordionContent
instead.ToastProvider
is deprecated and will be removed in the next major release. UseToastManager
instead.useToast
is deprecated and will be removed in the next major release. UseuseToastManager
instead.
- Changed or removed props
Alert
- Removed
isCloseButtonVisible
prop
- Removed
Badge
- Removed
dotSize
,isHidden
,offset
, andvariantColor
props
- Removed
CheckboxGroup
- Changed
onChange(value, event)
toonChange(value)
- Changed
InputBase
- Removed
isInvalid
prop
- Removed
Menu
- Removed
openMenu
andcloseMenu
props
- Removed
Pagination
- Removed
ellipsisLabel
,firstButton
,lastButton
,prevButton
, andnextButton
props - Changed
onChange(event, value)
toonChange(value)
- Removed
Popover
- Removed
arrowAt
,distance
,hideArrow
, andskidding
props - Removed
PopperArrowComponent
andPopperArrowProps
props fromPopoverContent
- Removed
Popper
- Removed
container
prop
- Removed
Portal
- Removed
container
,isDisabled
, andonRender
props
- Removed
Spinner
- Removed
color
,strokeWidth
, andspeed
props
- Removed
Scrollbar
- Removed
disabled
,minThumbSize
,visibility
,renderView
,renderHorizontalTrack
,renderHorizontalThumb
,renderVerticalTrack
,renderVerticalThumb
, andthumbSize
props
- Removed
Tabs
- Removed
activateOnKeyPress
,isFitted
,isManual
props
- Removed
Table
- Removed
isHoverable
prop TableHeaderRow
is deprecated. UseTableRow
instead.TableHeaderCell
is deprecated. UseTableCell
instead.
- Removed
Tag
- Removed
isCloseButtonVisible
,isInvalid
, andvariantColor
props
- Removed
Toast
- Removed
isCloseButtonVisible
prop.
- Removed
ToastManager
- Removed
container
prop
- Removed
Tooltip
- Removed
PopperArrowComponent
,PopperArrowProps
,arrowAt
,hideArrow
,hideDelay
,showDelay
, andcloseOnMouseDown
props
- Removed
TooltipContent
- Removed
PopperArrowComponent
andPopperArrowProps
props
- Removed
P3
- Move
Calendar
andDateInput
components from@tonic-ui/react-lab
to@tonic-ui/react
-
Review the transition delay configuration for all components #691