Skip to content

Premium Analytics: draw the date triggers with the design system Button - #52500

Merged
retrofox merged 17 commits into
trunkfrom
update/date-controls-trigger-props
Sep 22, 2026
Merged

retrofox merged 17 commits into
trunkfrom
update/date-controls-trigger-props

Conversation

@retrofox

@retrofox retrofox commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #52483, from this review comment.

Proposed changes

The date triggers (period, comparison, and chart interval) were @wordpress/components buttons, or a minimal design system Button, restyled by the shared menu-trigger mixin into a neutral outline box.

The design system Button draws that box itself, so the triggers now use it and the mixin goes.

  • Add triggerProps to DatePeriodDropdown, DateComparisonDropdown and DateIntervalDropdown: the Button's variant, tone, size and className, picked from its own props type and merged over a neutral outline default. DateFiltersPanel takes one and hands it to every trigger in its row.
  • Draw the widget header's date control at the compact size, so it matches the other header fields (the chart type toggle, the 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-weight and --wp-ui-button-font-size.
  • Build the comparison and interval controls on Dropdown, with a design system Button and IconButton as their triggers. The menus stay @wordpress/components menus (see Premium Analytics: build the chart interval menu on the design system Menu #51708), and the ArrowDown shortcut DropdownMenu gave the triggers is kept.
  • Drop _menu-trigger.scss and the comparison and interval stylesheets. Every rule in them either restated the Button's own box or moved into the trigger props.
  • Export DateFiltersPanelProps and DateControlTriggerProps from the ui barrel, replacing five hand-written derivations of the same two types.
  • Drop @wordpress/ui from packages/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

Does this pull request change what data or activity we track or use?

No.

Testing instructions

Setup

  1. Check out this branch and build Premium Analytics: jetpack build --deps packages/premium-analytics.
  2. Open the Premium Analytics dashboard.

Page header (Traffic)

  1. Confirm the period, comparison and chart interval triggers keep their size and border, with the design system hover and focus ring.
  2. Open each menu, pick an option, and confirm it applies and closes.
  3. Focus the comparison and chart interval triggers and press ArrowDown. Confirm their menus open.
  4. Start customizing the dashboard layout. Confirm the three triggers are greyed out, stay focusable, and do not open.

Widget header

  1. On a site with WordAds, open the Ads tab. Confirm the WordAds chart's date control is as tall as the chart type toggle beside it.
  2. Narrow the window below 600px. Confirm the date control's text stays the size of the SelectFields beside it rather than shrinking.
Screen.Recording.2026-09-18.at.7.28.23.PM.mov

Storybook

  1. Open Packages/Premium Analytics/UI/DateFiltersPanel and compare Dashboard Filters with Compact Triggers.

add triggerProps and compact widget header triggers
@retrofox retrofox added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress labels Sep 18, 2026
@retrofox retrofox self-assigned this Sep 18, 2026
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the update/date-controls-trigger-props branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/date-controls-trigger-props
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/date-controls-trigger-props

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Package] Premium Analytics [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics [Plugin] Wpcomsh labels Sep 18, 2026
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

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:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: October 6, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

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.

@retrofox
retrofox marked this pull request as ready for review September 18, 2026 17:10
@retrofox
retrofox requested a review from a team as a code owner September 18, 2026 17:10
@jp-launch-control

jp-launch-control Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/packages/premium-analytics/packages/fields/src/report-params-field/report-params-field.tsx 61/61 (100.00%) 0.00% 0 💚
projects/packages/premium-analytics/packages/ui/src/date-comparison-dropdown/date-comparison-dropdown.tsx 24/24 (100.00%) 0.00% 0 💚
projects/packages/premium-analytics/packages/ui/src/date-interval-dropdown/date-interval-dropdown.tsx 17/17 (100.00%) 0.00% 0 💚

1 file is newly checked for coverage.

File Coverage
projects/packages/premium-analytics/packages/ui/src/utils/date-control-trigger.ts 5/5 (100.00%) 💚

Full summary · PHP report · JS report

@retrofox retrofox added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Sep 18, 2026

@chihsuan chihsuan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice cleanup! @retrofox I tested the three menus on JN, and open, pick and close all work nicely. 👍

I left a few inline notes, mainly to confirm the font choice and the style pass-through. Thanks!

Comment on lines +54 to +57
const WIDGET_HEADER_TRIGGER_PROPS: Parameters< typeof DateFiltersPanel >[ 0 ][ 'triggerProps' ] = {
size: 'compact',
style: {
fontWeight: 'var(--wpds-typography-font-weight-default)',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, so the answer is that it's a temporary solution to maintain visual consistency with Widget Fields until DataViews use the UI component.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Got it, thanks for clarifying!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we drop this one? Nothing in packages/ui imports @wordpress/ui directly, and #50964 removed it on purpose. Is something failing without it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment on lines +1 to +2
// 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment on lines +124 to +125
/** The look of every trigger in the row, e.g. compact in a widget header. */
triggerProps?: DatePeriodDropdownProps[ 'triggerProps' ];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Could we export DateFiltersPanelProps and DateControlTriggerProps from the ui barrel? The panel, fields and stories each derive this type a different way.

it is reached through externals; nothing under packages/ui imports it
replaces five ad-hoc derivations of the same two types
@retrofox
retrofox merged commit d6726d3 into trunk Sep 22, 2026
80 checks passed
@retrofox
retrofox deleted the update/date-controls-trigger-props branch September 22, 2026 15:17
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] Needs Review This PR is ready for review. labels Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Package] Premium Analytics [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics [Plugin] Wpcomsh [Status] UI Changes Add this to PRs that change the UI so documentation can be updated.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants