Repository navigation
Premium Analytics: draw the date triggers with the design system Button - #52500
Conversation
add triggerProps and compact widget header triggers
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Premium Analytics plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 3 files.
1 file is newly checked for coverage.
|
lay the controls out with Stack; keep only what the Button lacks
Tweak ReportParamsField yo match with wordpress/components
SelectField wrote a string into the array attribute
the attention fill is isolated on it
| const WIDGET_HEADER_TRIGGER_PROPS: Parameters< typeof DateFiltersPanel >[ 0 ][ 'triggerProps' ] = { | ||
| size: 'compact', | ||
| style: { | ||
| fontWeight: 'var(--wpds-typography-font-weight-default)', |
There was a problem hiding this comment.
Just curious, do we want to override the Button's weight here? If body weight is a design call, could a CSS module set --wp-ui-button-font-weight, so style stays out of the public type?
There was a problem hiding this comment.
The issue is that, on one hand, Widgets natively use Fields declared by DataViews, and, unless I’m mistaken, DataViews still render those Fields using the wordpress/components package.
On the other hand, for the custom fields we implemented in PA, we are using wordpress/ui. My understanding is that DataViews will migrate soon, which indirectly resolves the visual incompatibility we’re facing.
This isn't a new issue; we’ve been dealing with it for quite some time.
There was a problem hiding this comment.
Sorry, so the answer is that it's a temporary solution to maintain visual consistency with Widget Fields until DataViews use the UI component.
There was a problem hiding this comment.
Got it, thanks for clarifying!
There was a problem hiding this comment.
np. It's a fair question, and we need to keep working on it. I see some Fields with the same behavior look different.
| "@wordpress/element": "8.7.0", | ||
| "@wordpress/i18n": "^6.9.0", | ||
| "@wordpress/icons": "^16.0.0", | ||
| "@wordpress/ui": "0.22.0", |
There was a problem hiding this comment.
Should we drop this one? Nothing in packages/ui imports @wordpress/ui directly, and #50964 removed it on purpose. Is something failing without it?
There was a problem hiding this comment.
No, we should remove that. We are externalizing Gutenberg packages by using our package to collect and expose them.
Not ideal, but I think it's necessary until we can better handle package organization across plugins, repos, etc.
| // The box and its states are the Button's own. What stays here is what the | ||
| // Button has no part for: the attention fill, the label's truncation, the seam. |
There was a problem hiding this comment.
Is the new weight and size intended? The description says the 16px phone text and font-weight: inherit were kept, but both are gone, so the triggers now render at 600 / 13px.
| /** The look of every trigger in the row, e.g. compact in a widget header. */ | ||
| triggerProps?: DatePeriodDropdownProps[ 'triggerProps' ]; |
There was a problem hiding this comment.
nit: Could we export DateFiltersPanelProps and DateControlTriggerProps from the ui barrel? The panel, fields and stories each derive this type a different way.
restores the 16px phone size and drops style from the trigger props
it is reached through externals; nothing under packages/ui imports it
replaces five ad-hoc derivations of the same two types
Follow-up to #52483, from this review comment.
Proposed changes
The date triggers (period, comparison, and chart interval) were
@wordpress/componentsbuttons, or aminimaldesign system Button, restyled by the sharedmenu-triggermixin into a neutral outline box.The design system Button draws that box itself, so the triggers now use it and the mixin goes.
triggerPropstoDatePeriodDropdown,DateComparisonDropdownandDateIntervalDropdown: the Button'svariant,tone,sizeandclassName, picked from its own props type and merged over a neutral outline default.DateFiltersPaneltakes one and hands it to every trigger in its row.SelectFields) instead of standing 8px taller, and give it a CSS module that takes their body weight and their 16px phone size through the Button's own--wp-ui-button-font-weightand--wp-ui-button-font-size.Dropdown, with a design systemButtonandIconButtonas their triggers. The menus stay@wordpress/componentsmenus (see Premium Analytics: build the chart interval menu on the design system Menu #51708), and the ArrowDown shortcutDropdownMenugave the triggers is kept._menu-trigger.scssand the comparison and interval stylesheets. Every rule in them either restated the Button's own box or moved into the trigger props.DateFiltersPanelPropsandDateControlTriggerPropsfrom theuibarrel, replacing five hand-written derivations of the same two types.@wordpress/uifrompackages/ui's dependencies. Nothing there imports it: the design system arrives through@jetpack-premium-analytics/externals.Typography now follows the surface. The page header row takes the Button's own emphasis weight, since nothing on that row is an input-layout field. The widget header keeps the body weight and the 16px phone size, because the
SelectFields beside it are input-layout fields and bump to 16px below 600px.Kept on purpose:
_preset-surface.scss, which draws the year filter's segmented control, a component the design system does not have yet.Visible changes to check: the triggers take the design system's hover (a background tint as well as the border) and focus ring, and the comparison and interval menus now share the period menu's item spacing.
Related product discussion/links
@wordpress/components.Does this pull request change what data or activity we track or use?
No.
Testing instructions
Setup
jetpack build --deps packages/premium-analytics.Page header (Traffic)
Widget header
SelectFields beside it rather than shrinking.Screen.Recording.2026-09-18.at.7.28.23.PM.mov
Storybook