diff --git a/.agents/rules/widgets.md b/.agents/rules/widgets.md index 4d8107cf606c..0509713783b3 100644 --- a/.agents/rules/widgets.md +++ b/.agents/rules/widgets.md @@ -18,6 +18,10 @@ directly from a widget: that inlines the entire charting stack (charts, visx, re into the widget's render bundle. If a chart component isn't exposed yet, re-export it from the toolkit's "Charts passthrough" section. +Design-system components (`@wordpress/ui`, `@wordpress/dataviews`, `@automattic/ui`) come +from `@jetpack-premium-analytics/externals`, the passthrough script module, for the same +reason. ESLint enforces both rules; see `packages/externals/README.md`. + The render component is bound by `WidgetRenderProps` from `@wordpress/widget-primitives`: it receives only `{ attributes, setAttributes }`. `attributes` may arrive empty — default it (`= {}`). diff --git a/projects/packages/premium-analytics/AGENTS.md b/projects/packages/premium-analytics/AGENTS.md index 4f15e27547dc..5bfc30722f9e 100644 --- a/projects/packages/premium-analytics/AGENTS.md +++ b/projects/packages/premium-analytics/AGENTS.md @@ -170,10 +170,12 @@ See Automattic/jetpack#50266 for the PR that established this contract. - Don't edit dashboard React in Calypso — it lives here now. - Internal package names use `@jetpack-premium-analytics/*` aliases throughout the package — never `@automattic/jetpack-premium-analytics-*`. -- Never import `@automattic/charts`, `@wordpress/ui`, or `@wordpress/dataviews` directly from a - package that compiles to a script module — go through `@jetpack-premium-analytics/externals`. - A direct import compiles the whole library into that module again; see - `packages/externals/README.md`. +- Never import `@automattic/ui`, `@wordpress/ui`, or `@wordpress/dataviews` directly from + anything under `packages/`, `widgets/`, or `routes/` — go through + `@jetpack-premium-analytics/externals`. A direct import compiles the whole library into that + bundle again; ESLint enforces this. `@automattic/charts` follows the same rule under + `packages/`, but under `widgets/` and `routes/` it must come from + `@jetpack-premium-analytics/widgets-toolkit` instead. See `packages/externals/README.md`. - All source code comments must be in English. ## Widgets diff --git a/projects/packages/premium-analytics/changelog/fix-premium-analytics-ui-externals b/projects/packages/premium-analytics/changelog/fix-premium-analytics-ui-externals new file mode 100644 index 000000000000..a06bf0448bdd --- /dev/null +++ b/projects/packages/premium-analytics/changelog/fix-premium-analytics-ui-externals @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Route the ui, fields, and icons packages through the externals script module so shared third-party libraries are no longer duplicated across their bundles. diff --git a/projects/packages/premium-analytics/eslint.config.mjs b/projects/packages/premium-analytics/eslint.config.mjs index 54ed1d6159c9..306237c47858 100644 --- a/projects/packages/premium-analytics/eslint.config.mjs +++ b/projects/packages/premium-analytics/eslint.config.mjs @@ -124,19 +124,24 @@ export default defineConfig( }, }, { - // The toolkit is a shared script module, so a direct import of one of - // these libraries compiles it *into* the toolkit instead of resolving - // to the externals module — which is what made an unrelated one-line - // change rewrite megabytes of build output (WOOA7S-1836). + // Each package under `packages/` that declares `wpScriptModuleExports` + // is a shared script module, so a direct import of one of these + // libraries compiles it *into* that module instead of resolving to the + // externals module — which is what made an unrelated one-line change + // rewrite megabytes of build output (WOOA7S-1836). // - // Scoped to the toolkit because that is the only module migrated so - // far; `packages/ui`, `widgets/`, and `routes/` still import these - // directly and are the follow-ups tracked in the PR description. - // `packages/externals` is deliberately not covered: it *is* the + // Covers all of `packages/**`, including the packages that are bundled + // from source rather than compiled to their own module: they end up + // inside whichever module imports them, so a direct import there costs + // the same. `widgets/` and `routes/` are covered by the block below, + // which adds the charts-via-toolkit rule on top. + // + // `packages/externals` is deliberately excluded: it *is* the // passthrough, so it has to import them directly. - files: [ - 'packages/widgets-toolkit/**', - 'projects/packages/premium-analytics/packages/widgets-toolkit/**', + files: [ 'packages/**', 'projects/packages/premium-analytics/packages/**' ], + ignores: [ + 'packages/externals/**', + 'projects/packages/premium-analytics/packages/externals/**', ], rules: { 'no-restricted-imports': [ @@ -149,7 +154,8 @@ export default defineConfig( // stylesheet side-effect imports: those are plain // CSS, not the library, so they carry none of the // bundling cost. - regex: '^(@automattic/charts|@wordpress/ui|@wordpress/dataviews)(/(?!.*\\.css$).*)?$', + regex: + '^(@automattic/charts|@automattic/ui|@wordpress/ui|@wordpress/dataviews)(/(?!.*\\.css$).*)?$', message: 'Import these from @jetpack-premium-analytics/externals instead: it compiles them once into a shared script module rather than into every module that imports them. Missing an export? Add it to packages/externals/src/index.ts.', }, @@ -159,21 +165,40 @@ export default defineConfig( }, }, { - // Widgets must reach chart components through the widgets-toolkit - // shared script module: a direct `@automattic/charts` import gets - // silently inlined into that widget's render bundle, dragging the - // whole charting stack (charts, visx, react-spring) along with it. - files: [ 'widgets/**', 'projects/packages/premium-analytics/widgets/**' ], + // Widget render bundles and route bundles are lazy-loaded on their own, + // so a direct import of one of these libraries is inlined into that + // bundle rather than resolved from a shared script module. + // + // Charts are called out separately: they must come through + // widgets-toolkit, which themes them and takes charts from externals + // itself, so a toolkit passthrough costs nothing. Everything else goes + // straight to externals. + // + // Both rules live in one block on purpose — a second `files` entry + // naming `no-restricted-imports` again would replace this rule for + // these paths rather than add to it. + files: [ + 'widgets/**', + 'routes/**', + 'projects/packages/premium-analytics/widgets/**', + 'projects/packages/premium-analytics/routes/**', + ], rules: { 'no-restricted-imports': [ 'error', { patterns: [ { - group: [ '@automattic/charts', '@automattic/charts/*' ], + // Same `.css` exemption as the packages rule above. + regex: '^@automattic/charts(/(?!.*\\.css$).*)?$', message: 'Import chart components from @jetpack-premium-analytics/widgets-toolkit instead: it is a shared script module, so charts is bundled once for the whole dashboard. Missing a component? Re-export it from the toolkit "Charts passthrough" section.', }, + { + regex: '^(@automattic/ui|@wordpress/ui|@wordpress/dataviews)(/(?!.*\\.css$).*)?$', + message: + 'Import these from @jetpack-premium-analytics/externals instead: it compiles them once into a shared script module rather than into every bundle that imports them. Missing an export? Add it to packages/externals/src/index.ts.', + }, ], }, ], diff --git a/projects/packages/premium-analytics/packages/externals/README.md b/projects/packages/premium-analytics/packages/externals/README.md index 24e617211590..d07be2aa7b4a 100644 --- a/projects/packages/premium-analytics/packages/externals/README.md +++ b/projects/packages/premium-analytics/packages/externals/README.md @@ -1,7 +1,7 @@ # `@jetpack-premium-analytics/externals` A passthrough script module for the heavy third-party libraries the dashboard shares: -`@automattic/charts`, `@wordpress/ui`, and `@wordpress/dataviews`. +`@automattic/charts`, `@automattic/ui`, `@wordpress/ui`, and `@wordpress/dataviews`. ## Why this exists @@ -26,13 +26,62 @@ change when the libraries themselves are upgraded. Feature work no longer rewrit invalidates the artifact for everyone, which is exactly what this package exists to avoid. - **Import from here, never from the library directly.** `import { LineChart } from '@automattic/charts'` inside another module bundles charts into that module again and silently - undoes the split. ESLint enforces this for `packages/widgets-toolkit` (`no-restricted-imports` - in `eslint.config.mjs`); stylesheet imports are exempt, since plain CSS carries none of the - bundling cost. The rule is scoped to the toolkit because that is the only module migrated so - far — widen it as `packages/ui`, `widgets/`, and `routes/` follow. + undoes the split. ESLint enforces this across `packages/**`, `widgets/**` and `routes/**` + (`no-restricted-imports` in `eslint.config.mjs`), with `packages/externals` itself excluded — it + *is* the passthrough, so it has to import the libraries directly. Stylesheet imports are exempt + everywhere, since plain CSS carries none of the bundling cost. + + Under `widgets/` and `routes/` the rule splits in two: `@automattic/charts` must come from + `@jetpack-premium-analytics/widgets-toolkit`, which themes the chart components and takes charts + from here itself, so a toolkit passthrough costs nothing; everything else comes straight from + here. Both patterns live in one ESLint block on purpose — a second `files` entry naming + `no-restricted-imports` again would *replace* the rule for those paths rather than add to it. - **Adding an export is cheap; adding a library is not.** A new library only belongs here if more than one module needs it, or if it is large enough that re-emitting it per module hurts. + `@automattic/ui` qualifies on the second count alone: `DateRangeCalendar` is its only consumer + in the package, but it reaches `react-day-picker` behind it, so leaving it in `packages/ui` + re-emitted ~55 KB of vendor code on every edit to that module. + + `date-fns` deliberately stays out. It is imported directly by ~30 files across `data`, + `datetime`, `routing`, `widgets/`, and `routes/`, and it is tree-shaken per function — routing it + through here would mean a barrel that grows every time any consumer needs one more function, + which is exactly the churn this module exists to avoid. + +## What wp-build externalises on its own + +wp-build externalises a `@wordpress/*` import only when that library's own `package.json` declares +one of two fields (see `isScriptModuleImport` in `@wordpress/build/lib/wordpress-externals-plugin.mjs`): + +- `wpScript` — externalised as a classic `wp-` script handle, listed under `dependencies` in + the generated `*.asset.php`. +- `wpScriptModuleExports` — externalised as a script module, listed under `module_dependencies`. + +`@wordpress/components`, `@wordpress/data`, `@wordpress/element`, `@wordpress/i18n`, +`@wordpress/theme` and `@wordpress/compose` all declare `wpScript`, so importing them costs +nothing and they must **not** be routed through here. The same goes for `react` and `react-dom`. + +`@wordpress/ui` and `@wordpress/dataviews` declare **neither**, so esbuild compiles them into every +bundle that imports them. That is the only reason they are in this module: a direct import of +`@wordpress/ui` is not the free externalised reference that a direct import of +`@wordpress/components` is. + +### Revisit this when upstream changes + +**If `@wordpress/ui` or `@wordpress/dataviews` ever ship `wpScript` or `wpScriptModuleExports`, +drop them from here and import them directly again.** At that point wp-build externalises them +natively, this passthrough stops earning its keep for those two, and the extra hop is pure +indirection. Check with: + +```sh +# Run from projects/packages/premium-analytics. +for p in @wordpress/ui @wordpress/dataviews; do + node -p "const j=require('$p/package.json'); + '$p: ' + ((j.wpScript || j.wpScriptModuleExports) ? 'externalised by wp-build — remove from externals' : 'still compiled in — keep here')" +done +``` + +Today both report *still compiled in* (`@wordpress/ui` declares `wpScript: false`, +`@wordpress/dataviews` declares nothing). -Libraries WordPress already registers as script modules or globals (`@wordpress/components`, -`@wordpress/data`, `@wordpress/i18n`, `react`, …) are externalised by wp-build on their own and -must **not** be routed through here. +`@automattic/charts` and `@automattic/ui` are third-party to WordPress and will never gain those +fields, so they stay here regardless. diff --git a/projects/packages/premium-analytics/packages/externals/package.json b/projects/packages/premium-analytics/packages/externals/package.json index 72f150349af2..79e855f04dbc 100644 --- a/projects/packages/premium-analytics/packages/externals/package.json +++ b/projects/packages/premium-analytics/packages/externals/package.json @@ -14,6 +14,7 @@ ], "dependencies": { "@automattic/charts": "workspace:*", + "@automattic/ui": "1.0.2", "@wordpress/dataviews": "17.1.0", "@wordpress/ui": "0.17.0", "react": "18.3.1" diff --git a/projects/packages/premium-analytics/packages/externals/src/index.ts b/projects/packages/premium-analytics/packages/externals/src/index.ts index 7d399294c71c..fe142400be80 100644 --- a/projects/packages/premium-analytics/packages/externals/src/index.ts +++ b/projects/packages/premium-analytics/packages/externals/src/index.ts @@ -9,6 +9,7 @@ * External dependencies */ import '@automattic/charts/style.css'; +import '@automattic/ui/style.css'; /** * Charts @@ -43,13 +44,31 @@ export { export { LineShape, RectShape } from '@automattic/charts/visx/legend'; +/** + * Calendar + * + * `DateRangeCalendar` is the package's only `@automattic/ui` consumer, but it + * reaches `react-day-picker` and `date-fns` behind it — ~55 KB of minified + * vendor code that would otherwise be re-emitted on every edit to the module + * that imports it. + */ +export { DateRangeCalendar } from '@automattic/ui'; + /** * WordPress design system + * + * `Field` is exported as `FormField`: `@wordpress/ui`'s form-field namespace and + * `@wordpress/dataviews`' `Field` type collide under one barrel, and DataViews' + * `Field` is the name consumers already import from here. The alias is still a + * plain re-export — it renames, it does not wrap. */ export { Button, EmptyState, + Field as FormField, + Fieldset, Icon, + Input, Link, SelectControl, Stack, @@ -66,7 +85,10 @@ export { filterSortAndPaginate, type Action, type DataFormControlProps, + type DataViewRenderFieldProps, type Field, + type Option, type SupportedLayouts, type View, + type ViewBaseProps, } from '@wordpress/dataviews'; diff --git a/projects/packages/premium-analytics/packages/fields/package.json b/projects/packages/premium-analytics/packages/fields/package.json index ffbaec0598fa..d16860a0faf8 100644 --- a/projects/packages/premium-analytics/packages/fields/package.json +++ b/projects/packages/premium-analytics/packages/fields/package.json @@ -14,14 +14,13 @@ "dependencies": { "@jetpack-premium-analytics/data": "workspace:*", "@jetpack-premium-analytics/datetime": "workspace:*", + "@jetpack-premium-analytics/externals": "workspace:*", "@jetpack-premium-analytics/routing": "workspace:*", "@jetpack-premium-analytics/ui": "workspace:*", "@wordpress/components": "37.0.0", - "@wordpress/dataviews": "17.1.0", "@wordpress/element": "8.3.0", "@wordpress/icons": "^15.0.0", "@wordpress/private-apis": "1.51.0", - "@wordpress/ui": "0.17.0", "date-fns": "4.1.0", "react": "18.3.1" } diff --git a/projects/packages/premium-analytics/packages/fields/src/field-array-checkbox/array-checkbox-field.tsx b/projects/packages/premium-analytics/packages/fields/src/field-array-checkbox/array-checkbox-field.tsx index f5de8976e061..07577ed00125 100644 --- a/projects/packages/premium-analytics/packages/fields/src/field-array-checkbox/array-checkbox-field.tsx +++ b/projects/packages/premium-analytics/packages/fields/src/field-array-checkbox/array-checkbox-field.tsx @@ -1,17 +1,17 @@ /** * WordPress dependencies */ +import { Button, Fieldset, Icon, Stack } from '@jetpack-premium-analytics/externals'; import { CheckboxControl, privateApis, Spinner } from '@wordpress/components'; import { useCallback } from '@wordpress/element'; import { chevronDown } from '@wordpress/icons'; -import { Button, Fieldset, Icon, Stack } from '@wordpress/ui'; /** * Internal dependencies */ import useElements from '../helpers/use-elements'; import { unlock } from '../lock/unlock'; import styles from './array-checkbox-field.module.css'; -import type { DataFormControlProps } from '@wordpress/dataviews'; +import type { DataFormControlProps } from '@jetpack-premium-analytics/externals'; const { Menu } = unlock( privateApis ); diff --git a/projects/packages/premium-analytics/packages/fields/src/field-select/__tests__/select-field.test.ts b/projects/packages/premium-analytics/packages/fields/src/field-select/__tests__/select-field.test.ts index 9a39d84fa470..f4ed42e54297 100644 --- a/projects/packages/premium-analytics/packages/fields/src/field-select/__tests__/select-field.test.ts +++ b/projects/packages/premium-analytics/packages/fields/src/field-select/__tests__/select-field.test.ts @@ -2,7 +2,7 @@ * Internal dependencies */ import { fromSelectValue, toSelectItems } from '../select-field'; -import type { Option } from '@wordpress/dataviews'; +import type { Option } from '@jetpack-premium-analytics/externals'; const NUMERIC_ELEMENTS: Option[] = [ { value: 10, label: 'Ten' }, diff --git a/projects/packages/premium-analytics/packages/fields/src/field-select/select-field.tsx b/projects/packages/premium-analytics/packages/fields/src/field-select/select-field.tsx index 6388c7530dd8..05f00cfb59a5 100644 --- a/projects/packages/premium-analytics/packages/fields/src/field-select/select-field.tsx +++ b/projects/packages/premium-analytics/packages/fields/src/field-select/select-field.tsx @@ -1,14 +1,14 @@ /** * WordPress dependencies */ +import { SelectControl } from '@jetpack-premium-analytics/externals'; import { Spinner } from '@wordpress/components'; import { useCallback, useMemo } from '@wordpress/element'; -import { SelectControl } from '@wordpress/ui'; /** * Internal dependencies */ import useElements from '../helpers/use-elements'; -import type { DataFormControlProps, Option } from '@wordpress/dataviews'; +import type { DataFormControlProps, Option } from '@jetpack-premium-analytics/externals'; export function toSelectItems( elements: Option[] ) { return elements.map( element => ( { diff --git a/projects/packages/premium-analytics/packages/fields/src/helpers/use-elements.ts b/projects/packages/premium-analytics/packages/fields/src/helpers/use-elements.ts index 262ed4271560..672dba3b8c3e 100644 --- a/projects/packages/premium-analytics/packages/fields/src/helpers/use-elements.ts +++ b/projects/packages/premium-analytics/packages/fields/src/helpers/use-elements.ts @@ -2,7 +2,7 @@ * WordPress dependencies */ import { useEffect, useMemo, useState } from '@wordpress/element'; -import type { Option } from '@wordpress/dataviews'; +import type { Option } from '@jetpack-premium-analytics/externals'; type UseElementsParams = { elements?: Option[]; diff --git a/projects/packages/premium-analytics/packages/fields/src/report-params-field/report-params-field.tsx b/projects/packages/premium-analytics/packages/fields/src/report-params-field/report-params-field.tsx index a8196a6883bd..c52e47c5b671 100644 --- a/projects/packages/premium-analytics/packages/fields/src/report-params-field/report-params-field.tsx +++ b/projects/packages/premium-analytics/packages/fields/src/report-params-field/report-params-field.tsx @@ -12,13 +12,13 @@ import { isPrimaryPreset, type DateRange, } from '@jetpack-premium-analytics/datetime'; +import { Stack } from '@jetpack-premium-analytics/externals'; import { deriveComparisonRange, encodeDateToSearchParam } from '@jetpack-premium-analytics/routing'; import { DateFiltersPanel } from '@jetpack-premium-analytics/ui'; -import { Stack } from '@wordpress/ui'; import { endOfDay } from 'date-fns'; import { useCallback, useMemo, useState } from 'react'; import { getStoreInfo } from '../helpers/store-info'; -import type { DataFormControlProps } from '@wordpress/dataviews'; +import type { DataFormControlProps } from '@jetpack-premium-analytics/externals'; /* * Copied from widgets-toolkit `fields/date-report-params-field` so widget diff --git a/projects/packages/premium-analytics/packages/icons/package.json b/projects/packages/premium-analytics/packages/icons/package.json index 4d1b0949cb5e..4ff69988e245 100644 --- a/projects/packages/premium-analytics/packages/icons/package.json +++ b/projects/packages/premium-analytics/packages/icons/package.json @@ -10,7 +10,7 @@ "@wordpress/primitives": "4.51.0" }, "devDependencies": { - "@storybook/react": "10.4.6", - "@wordpress/ui": "0.17.0" + "@jetpack-premium-analytics/externals": "workspace:*", + "@storybook/react": "10.4.6" } } diff --git a/projects/packages/premium-analytics/packages/icons/src/stories/icons.stories.tsx b/projects/packages/premium-analytics/packages/icons/src/stories/icons.stories.tsx index c3b6f9130aed..bc05b0b25a35 100644 --- a/projects/packages/premium-analytics/packages/icons/src/stories/icons.stories.tsx +++ b/projects/packages/premium-analytics/packages/icons/src/stories/icons.stories.tsx @@ -1,4 +1,4 @@ -import { Icon, Stack } from '@wordpress/ui'; +import { Icon, Stack } from '@jetpack-premium-analytics/externals'; import * as icons from '../index'; import type { Meta, StoryObj } from '@storybook/react'; diff --git a/projects/packages/premium-analytics/packages/ui/package.json b/projects/packages/premium-analytics/packages/ui/package.json index 20b0cb3b61e0..fc7403ec63f3 100644 --- a/projects/packages/premium-analytics/packages/ui/package.json +++ b/projects/packages/premium-analytics/packages/ui/package.json @@ -11,15 +11,13 @@ "*.scss" ], "dependencies": { - "@automattic/ui": "1.0.2", "@jetpack-premium-analytics/datetime": "workspace:*", + "@jetpack-premium-analytics/externals": "workspace:*", "@jetpack-premium-analytics/formatters": "workspace:*", "@wordpress/components": "37.0.0", "@wordpress/compose": "8.4.0", - "@wordpress/dataviews": "17.1.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "clsx": "2.1.1", "react": "18.3.1" }, diff --git a/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/dataviews-drilldown-native.tsx b/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/dataviews-drilldown-native.tsx index 5ac0cafc3147..fd29626ac543 100644 --- a/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/dataviews-drilldown-native.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/dataviews-drilldown-native.tsx @@ -1,7 +1,7 @@ /** * External dependencies */ -import { DataViews, filterSortAndPaginate } from '@wordpress/dataviews'; +import { DataViews, filterSortAndPaginate } from '@jetpack-premium-analytics/externals'; import clsx from 'clsx'; import { useCallback, useMemo, useState } from 'react'; /** @@ -9,7 +9,12 @@ import { useCallback, useMemo, useState } from 'react'; */ import styles from './dataviews-drilldown-native.module.scss'; import { processHierarchyLevels, withHierarchyContext } from './process-hierarchy-levels'; -import type { Field, SupportedLayouts, View, ViewBaseProps } from '@wordpress/dataviews'; +import type { + Field, + SupportedLayouts, + View, + ViewBaseProps, +} from '@jetpack-premium-analytics/externals'; import type { ComponentProps, ReactNode } from 'react'; // Inferred props types from the `DataViews` component. diff --git a/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/drilldown-leaf-cell.tsx b/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/drilldown-leaf-cell.tsx index 37250aeca3d4..d55ffe08b309 100644 --- a/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/drilldown-leaf-cell.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/drilldown-leaf-cell.tsx @@ -1,7 +1,7 @@ /** * External dependencies */ -import { VisuallyHidden } from '@wordpress/ui'; +import { VisuallyHidden } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/stories/dataviews-drilldown-native.stories.tsx b/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/stories/dataviews-drilldown-native.stories.tsx index 01b6dd05119f..bca52194f519 100644 --- a/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/stories/dataviews-drilldown-native.stories.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/dataviews-drilldown-native/stories/dataviews-drilldown-native.stories.tsx @@ -1,6 +1,6 @@ import { DataViewsDrilldownNative } from '../dataviews-drilldown-native'; +import type { DataViewRenderFieldProps, Field } from '@jetpack-premium-analytics/externals'; import type { Meta, StoryObj } from '@storybook/react'; -import type { DataViewRenderFieldProps, Field } from '@wordpress/dataviews'; type ReferrerRow = { id: string; diff --git a/projects/packages/premium-analytics/packages/ui/src/date-comparison-dropdown/date-comparison-dropdown.tsx b/projects/packages/premium-analytics/packages/ui/src/date-comparison-dropdown/date-comparison-dropdown.tsx index 8e0478649f67..f68d33c65910 100644 --- a/projects/packages/premium-analytics/packages/ui/src/date-comparison-dropdown/date-comparison-dropdown.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/date-comparison-dropdown/date-comparison-dropdown.tsx @@ -1,9 +1,9 @@ /** * External dependencies */ +import { SelectControl } from '@jetpack-premium-analytics/externals'; import { formatDateRange } from '@jetpack-premium-analytics/formatters'; import { sprintf, __ } from '@wordpress/i18n'; -import { SelectControl } from '@wordpress/ui'; import clsx from 'clsx'; import { useCallback, useMemo } from 'react'; /** diff --git a/projects/packages/premium-analytics/packages/ui/src/date-filters-panel/date-filters-panel.tsx b/projects/packages/premium-analytics/packages/ui/src/date-filters-panel/date-filters-panel.tsx index d28eb13e882d..f60af7c40970 100644 --- a/projects/packages/premium-analytics/packages/ui/src/date-filters-panel/date-filters-panel.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/date-filters-panel/date-filters-panel.tsx @@ -8,11 +8,11 @@ import { type ComparisonPresetId, type PrimaryPresetId, } from '@jetpack-premium-analytics/datetime'; +import { Stack } from '@jetpack-premium-analytics/externals'; import { formatDateRange } from '@jetpack-premium-analytics/formatters'; import { BaseControl } from '@wordpress/components'; import { useResizeObserver } from '@wordpress/compose'; import { __ } from '@wordpress/i18n'; -import { Stack } from '@wordpress/ui'; import clsx from 'clsx'; import { useMemo, useCallback, useState, useEffect } from 'react'; /** diff --git a/projects/packages/premium-analytics/packages/ui/src/date-filters-panel/preset-row-probe.tsx b/projects/packages/premium-analytics/packages/ui/src/date-filters-panel/preset-row-probe.tsx index c4ae621d2dbc..1da69ceadb79 100644 --- a/projects/packages/premium-analytics/packages/ui/src/date-filters-panel/preset-row-probe.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/date-filters-panel/preset-row-probe.tsx @@ -1,8 +1,8 @@ /** * External dependencies */ +import { Button, Icon } from '@jetpack-premium-analytics/externals'; import { chevronDown } from '@wordpress/icons'; -import { Button, Icon } from '@wordpress/ui'; import { memo, useCallback, useLayoutEffect, useRef } from 'react'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/packages/ui/src/date-range-input/date-range-input.tsx b/projects/packages/premium-analytics/packages/ui/src/date-range-input/date-range-input.tsx index ff47a0b6ea97..f63a4a452a37 100644 --- a/projects/packages/premium-analytics/packages/ui/src/date-range-input/date-range-input.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/date-range-input/date-range-input.tsx @@ -6,8 +6,8 @@ import { formatToTimezoneNaiveString, getDatePart, } from '@jetpack-premium-analytics/datetime'; +import { FormField, Input, Stack } from '@jetpack-premium-analytics/externals'; import { __ } from '@wordpress/i18n'; -import { Field, Input, Stack } from '@wordpress/ui'; import { useCallback, useEffect, useState } from 'react'; /** * Internal dependencies @@ -69,10 +69,10 @@ function DateInput( { label, date, onChange, timeZone }: DateInputProps ) { }, [] ); return ( - - { label } + + { label } - + ); } diff --git a/projects/packages/premium-analytics/packages/ui/src/date-range-popover/date-range-filter.tsx b/projects/packages/premium-analytics/packages/ui/src/date-range-popover/date-range-filter.tsx index bf3676aeee97..b6a3ee6dec92 100644 --- a/projects/packages/premium-analytics/packages/ui/src/date-range-popover/date-range-filter.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/date-range-popover/date-range-filter.tsx @@ -1,16 +1,14 @@ /** * External dependencies */ -import { DateRangeCalendar } from '@automattic/ui'; import { PRESET_CUSTOM, type PrimaryPresetId } from '@jetpack-premium-analytics/datetime'; +import { Button, DateRangeCalendar, Icon, Stack } from '@jetpack-premium-analytics/externals'; import { formatDateRange } from '@jetpack-premium-analytics/formatters'; import { Composite, Dropdown } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { chevronDown } from '@wordpress/icons'; -import { Button, Icon, Stack } from '@wordpress/ui'; import clsx from 'clsx'; import { useState, useCallback, useRef } from 'react'; -import '@automattic/ui/style.css'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/packages/ui/src/date-range-quick-presets/date-range-quick-presets.tsx b/projects/packages/premium-analytics/packages/ui/src/date-range-quick-presets/date-range-quick-presets.tsx index f9b49331bdf5..d1369cd0c3ae 100644 --- a/projects/packages/premium-analytics/packages/ui/src/date-range-quick-presets/date-range-quick-presets.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/date-range-quick-presets/date-range-quick-presets.tsx @@ -8,9 +8,9 @@ import { type PrimaryPresetId, type SelectablePresetId, } from '@jetpack-premium-analytics/datetime'; +import { Button, SelectControl } from '@jetpack-premium-analytics/externals'; import { Composite } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; -import { Button, SelectControl } from '@wordpress/ui'; import { useCallback, useMemo } from 'react'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/packages/ui/src/date-year-filter/date-year-filter.tsx b/projects/packages/premium-analytics/packages/ui/src/date-year-filter/date-year-filter.tsx index 92e3ef2395ce..30fdbe6d6e64 100644 --- a/projects/packages/premium-analytics/packages/ui/src/date-year-filter/date-year-filter.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/date-year-filter/date-year-filter.tsx @@ -8,10 +8,10 @@ import { type PrimaryPresetId, type YearSurfacePresetId, } from '@jetpack-premium-analytics/datetime'; +import { Button, SelectControl } from '@jetpack-premium-analytics/externals'; import { Composite } from '@wordpress/components'; import { useResizeObserver } from '@wordpress/compose'; import { __ } from '@wordpress/i18n'; -import { Button, SelectControl } from '@wordpress/ui'; import { useCallback, useLayoutEffect, useMemo, useState } from 'react'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/packages/ui/src/section-header/section-header.tsx b/projects/packages/premium-analytics/packages/ui/src/section-header/section-header.tsx index e18bfcbe0527..96677c243ddd 100644 --- a/projects/packages/premium-analytics/packages/ui/src/section-header/section-header.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/section-header/section-header.tsx @@ -1,4 +1,4 @@ -import { Stack, Text } from '@wordpress/ui'; +import { Stack, Text } from '@jetpack-premium-analytics/externals'; import { ReactNode } from 'react'; import styles from './section-header.module.scss'; diff --git a/projects/packages/premium-analytics/packages/ui/src/section-tabs/section-tabs.tsx b/projects/packages/premium-analytics/packages/ui/src/section-tabs/section-tabs.tsx index 2aa148b87b48..fb9f404e3940 100644 --- a/projects/packages/premium-analytics/packages/ui/src/section-tabs/section-tabs.tsx +++ b/projects/packages/premium-analytics/packages/ui/src/section-tabs/section-tabs.tsx @@ -1,4 +1,4 @@ -import { Tabs } from '@wordpress/ui'; +import { Tabs } from '@jetpack-premium-analytics/externals'; import clsx from 'clsx'; import { useCallback } from 'react'; import styles from './section-tabs.module.scss'; @@ -111,10 +111,11 @@ export interface SectionTabPanelProps< TabId extends string = string > { /** * A tab panel for `SectionTabs` children. * - * Consumers must use this instead of `Tabs.Panel` from `@wordpress/ui`: routes - * and shared packages can each bundle their own copy of `@wordpress/ui`, and - * Base UI's tabs context does not cross bundle copies. Importing the panel and - * root through the same package specifier guarantees both share one instance. + * Consumers must use this rather than reaching for `Tabs.Panel` themselves: + * Base UI's tabs context does not cross bundle copies, so a panel only finds + * its root when both come from the same `Tabs` instance. Importing `Tabs` from + * `@jetpack-premium-analytics/externals` is what makes that a single shared + * instance for every consumer. * * @param props - Component props. * @param props.value - The tab this panel belongs to. diff --git a/projects/packages/premium-analytics/routes/connect/components/site-not-connected/site-not-connected.tsx b/projects/packages/premium-analytics/routes/connect/components/site-not-connected/site-not-connected.tsx index 1f7e35781d4f..22dde55c8528 100644 --- a/projects/packages/premium-analytics/routes/connect/components/site-not-connected/site-not-connected.tsx +++ b/projects/packages/premium-analytics/routes/connect/components/site-not-connected/site-not-connected.tsx @@ -1,8 +1,8 @@ /** * External dependencies */ +import { Stack } from '@jetpack-premium-analytics/externals'; import { __ } from '@wordpress/i18n'; -import { Stack } from '@wordpress/ui'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/routes/connect/package.json b/projects/packages/premium-analytics/routes/connect/package.json index b008ce686a14..5d7bba04367e 100644 --- a/projects/packages/premium-analytics/routes/connect/package.json +++ b/projects/packages/premium-analytics/routes/connect/package.json @@ -7,8 +7,8 @@ }, "dependencies": { "@automattic/jetpack-script-data": "workspace:*", + "@jetpack-premium-analytics/externals": "workspace:*", "@wordpress/i18n": "^6.9.0", - "@wordpress/route": "0.17.0", - "@wordpress/ui": "0.17.0" + "@wordpress/route": "0.17.0" } } diff --git a/projects/packages/premium-analytics/routes/connect/stage.tsx b/projects/packages/premium-analytics/routes/connect/stage.tsx index 202a7e6742df..8c1f2f3dcc2a 100644 --- a/projects/packages/premium-analytics/routes/connect/stage.tsx +++ b/projects/packages/premium-analytics/routes/connect/stage.tsx @@ -1,7 +1,7 @@ /** * External dependencies */ -import { Stack } from '@wordpress/ui'; +import { Stack } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/routes/dashboard/package.json b/projects/packages/premium-analytics/routes/dashboard/package.json index a5ad483821e7..a94b85f74097 100644 --- a/projects/packages/premium-analytics/routes/dashboard/package.json +++ b/projects/packages/premium-analytics/routes/dashboard/package.json @@ -9,6 +9,7 @@ "@automattic/jetpack-script-data": "workspace:*", "@jetpack-premium-analytics/data": "workspace:*", "@jetpack-premium-analytics/datetime": "workspace:*", + "@jetpack-premium-analytics/externals": "workspace:*", "@jetpack-premium-analytics/routing": "workspace:*", "@jetpack-premium-analytics/ui": "workspace:*", "@wordpress/admin-ui": "2.5.0", @@ -20,7 +21,6 @@ "@wordpress/i18n": "^6.9.0", "@wordpress/preferences": "4.51.0", "@wordpress/route": "0.17.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-dashboard": "0.2.0", "@wordpress/widget-primitives": "0.2.0", "date-fns": "4.1.0", diff --git a/projects/packages/premium-analytics/routes/dashboard/stage.tsx b/projects/packages/premium-analytics/routes/dashboard/stage.tsx index fdac6b8c5edf..fa713c23fde1 100644 --- a/projects/packages/premium-analytics/routes/dashboard/stage.tsx +++ b/projects/packages/premium-analytics/routes/dashboard/stage.tsx @@ -1,4 +1,5 @@ import { GlobalErrorProvider } from '@jetpack-premium-analytics/data'; +import { Stack } from '@jetpack-premium-analytics/externals'; import { useReportDateFilters } from '@jetpack-premium-analytics/routing'; import { DateFiltersPanel, @@ -12,7 +13,6 @@ import { store as coreStore } from '@wordpress/core-data'; import { useSelect } from '@wordpress/data'; import { useMemo, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -import { Stack } from '@wordpress/ui'; import { WidgetDashboard } from '@wordpress/widget-dashboard'; import { type WidgetModuleRecord } from '@wordpress/widget-primitives'; import { resolveWidgetModuleWithI18n, useWidgetTypesWithI18n } from '../widget-module-i18n'; diff --git a/projects/packages/premium-analytics/routes/post-detail/components/post-summary-card/post-summary-card.tsx b/projects/packages/premium-analytics/routes/post-detail/components/post-summary-card/post-summary-card.tsx index 9383bbe06911..a279a3b204aa 100644 --- a/projects/packages/premium-analytics/routes/post-detail/components/post-summary-card/post-summary-card.tsx +++ b/projects/packages/premium-analytics/routes/post-detail/components/post-summary-card/post-summary-card.tsx @@ -1,9 +1,9 @@ /** * External dependencies */ +import { Icon, Text } from '@jetpack-premium-analytics/externals'; import { __, sprintf } from '@wordpress/i18n'; import { page as pageIcon, post as postIcon } from '@wordpress/icons'; -import { Icon, Text } from '@wordpress/ui'; import { format, isValid } from 'date-fns'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/routes/post-detail/package.json b/projects/packages/premium-analytics/routes/post-detail/package.json index 2912b1867d97..a34b482099e3 100644 --- a/projects/packages/premium-analytics/routes/post-detail/package.json +++ b/projects/packages/premium-analytics/routes/post-detail/package.json @@ -9,6 +9,7 @@ "@automattic/jetpack-script-data": "workspace:*", "@jetpack-premium-analytics/data": "workspace:*", "@jetpack-premium-analytics/datetime": "workspace:*", + "@jetpack-premium-analytics/externals": "workspace:*", "@jetpack-premium-analytics/routing": "workspace:*", "@jetpack-premium-analytics/ui": "workspace:*", "@jetpack-premium-analytics/widgets-toolkit": "workspace:*", @@ -20,7 +21,6 @@ "@wordpress/icons": "^15.0.0", "@wordpress/preferences": "4.51.0", "@wordpress/route": "0.17.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-dashboard": "0.2.0", "@wordpress/widget-primitives": "0.2.0", "date-fns": "4.1.0", diff --git a/projects/packages/premium-analytics/routes/post-detail/stage.test.tsx b/projects/packages/premium-analytics/routes/post-detail/stage.test.tsx index aae5d0d13fe3..d9e0aa793de9 100644 --- a/projects/packages/premium-analytics/routes/post-detail/stage.test.tsx +++ b/projects/packages/premium-analytics/routes/post-detail/stage.test.tsx @@ -24,7 +24,25 @@ jest.mock( '@jetpack-premium-analytics/ui', () => ( { jest.mock( '@wordpress/core-data', () => ( { store: {} } ) ); -jest.mock( '@wordpress/data', () => ( { useSelect: () => [] } ) ); +// Falls through to the real module for everything but `useSelect`. Reaching the +// externals passthrough pulls `@wordpress/components` -> `@wordpress/rich-text` +// into the graph, whose store calls `combineReducers` at import time; a +// `useSelect`-only mock leaves that undefined and the suite fails to load. +// `requireActual` has to stay lazy — calling it in the factory body re-enters +// the module while it is still initialising. +jest.mock( + '@wordpress/data', + () => + new Proxy( + { useSelect: () => [] }, + { + get: ( overrides, prop ) => + prop in overrides + ? overrides[ prop as keyof typeof overrides ] + : jest.requireActual( '@wordpress/data' )[ prop ], + } + ) +); jest.mock( '@wordpress/widget-dashboard', () => { const WidgetDashboard = ( { children }: { children: ReactNode } ) => <>{ children }; diff --git a/projects/packages/premium-analytics/routes/post-detail/stage.tsx b/projects/packages/premium-analytics/routes/post-detail/stage.tsx index 98fda43e41d0..674d0764ff39 100644 --- a/projects/packages/premium-analytics/routes/post-detail/stage.tsx +++ b/projects/packages/premium-analytics/routes/post-detail/stage.tsx @@ -1,4 +1,5 @@ import { AnalyticsQueryClientProvider, GlobalErrorProvider } from '@jetpack-premium-analytics/data'; +import { Button } from '@jetpack-premium-analytics/externals'; import { useDashboardLink, useReportDateFilters } from '@jetpack-premium-analytics/routing'; import { DateFiltersPanel, SectionTabPanel, safeHttpUrl } from '@jetpack-premium-analytics/ui'; import { Breadcrumbs, Page } from '@wordpress/admin-ui'; @@ -7,7 +8,6 @@ import { useSelect } from '@wordpress/data'; import { useMemo } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { useParams } from '@wordpress/route'; -import { Button } from '@wordpress/ui'; import { DEFAULT_GRID, ROW_HEIGHT_PRESETS, WidgetDashboard } from '@wordpress/widget-dashboard'; import { type WidgetModuleRecord } from '@wordpress/widget-primitives'; import { resolveWidgetModuleWithI18n, useWidgetTypesWithI18n } from '../widget-module-i18n'; diff --git a/projects/packages/premium-analytics/routes/reports/annual-insights/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/annual-insights/config/fields.tsx index 813415a61a6f..55b39556e728 100644 --- a/projects/packages/premium-analytics/routes/reports/annual-insights/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/annual-insights/config/fields.tsx @@ -4,7 +4,7 @@ import { formatMetricValue } from '@jetpack-premium-analytics/formatters'; import { __ } from '@wordpress/i18n'; import type { StatsInsightsYear } from '@jetpack-premium-analytics/data'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; /** * Format a numeric Annual insights count for display. diff --git a/projects/packages/premium-analytics/routes/reports/authors/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/authors/config/fields.tsx index ba7448efd5d9..e4dbe0a01d6f 100644 --- a/projects/packages/premium-analytics/routes/reports/authors/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/authors/config/fields.tsx @@ -1,17 +1,17 @@ /** * External dependencies */ +import { Stack } from '@jetpack-premium-analytics/externals'; import { DrilldownLeafCell } from '@jetpack-premium-analytics/ui'; import { MetricWithComparison } from '@jetpack-premium-analytics/widgets-toolkit'; import { __, sprintf } from '@wordpress/i18n'; import { Link } from '@wordpress/route'; -import { Stack } from '@wordpress/ui'; /** * Internal dependencies */ import styles from './fields.module.css'; import type { AuthorRow } from './aggregate'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; import type { SyntheticEvent } from 'react'; const UNTRACKED_AUTHORS_SENTINEL = 'Untracked Authors'; diff --git a/projects/packages/premium-analytics/routes/reports/clicks/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/clicks/config/fields.tsx index ef974c5a6d8f..4fbc08787ee5 100644 --- a/projects/packages/premium-analytics/routes/reports/clicks/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/clicks/config/fields.tsx @@ -1,11 +1,11 @@ /** * External dependencies */ +import { Link } from '@jetpack-premium-analytics/externals'; import { DrilldownLeafCell, safeHttpUrl } from '@jetpack-premium-analytics/ui'; import { MetricWithComparison } from '@jetpack-premium-analytics/widgets-toolkit'; import { __ } from '@wordpress/i18n'; -import { Link } from '@wordpress/ui'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; const CLICKS_DATA_FORMAT = { type: 'number', diff --git a/projects/packages/premium-analytics/routes/reports/comment-followers/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/comment-followers/config/fields.tsx index cb961d31fe40..12d0bffc7e02 100644 --- a/projects/packages/premium-analytics/routes/reports/comment-followers/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/comment-followers/config/fields.tsx @@ -2,9 +2,9 @@ * External dependencies */ import { type StatsCommentFollowersItem } from '@jetpack-premium-analytics/data'; +import { type Field } from '@jetpack-premium-analytics/externals'; import { formatMetricValue } from '@jetpack-premium-analytics/formatters'; import { safeHttpUrl } from '@jetpack-premium-analytics/ui'; -import { type Field } from '@wordpress/dataviews'; import { __ } from '@wordpress/i18n'; import { Icon, external } from '@wordpress/icons'; import { Link } from '@wordpress/route'; diff --git a/projects/packages/premium-analytics/routes/reports/comment-followers/page.tsx b/projects/packages/premium-analytics/routes/reports/comment-followers/page.tsx index 4a39ad371b01..a6678dd8e3eb 100644 --- a/projects/packages/premium-analytics/routes/reports/comment-followers/page.tsx +++ b/projects/packages/premium-analytics/routes/reports/comment-followers/page.tsx @@ -2,6 +2,7 @@ * External dependencies */ import { type StatsCommentFollowersItem } from '@jetpack-premium-analytics/data'; +import { EmptyState, Text } from '@jetpack-premium-analytics/externals'; import { useDashboardLink } from '@jetpack-premium-analytics/routing'; import { MetricValue, @@ -19,7 +20,6 @@ import { Breadcrumbs } from '@wordpress/admin-ui'; import { Spinner } from '@wordpress/components'; import { useMemo } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -import { EmptyState, Text } from '@wordpress/ui'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/routes/reports/comments/config/fields.test.tsx b/projects/packages/premium-analytics/routes/reports/comments/config/fields.test.tsx index 288ab5955b49..6f76e9287a48 100644 --- a/projects/packages/premium-analytics/routes/reports/comments/config/fields.test.tsx +++ b/projects/packages/premium-analytics/routes/reports/comments/config/fields.test.tsx @@ -29,30 +29,45 @@ jest.mock( '@wordpress/route', () => ( { ), } ) ); -jest.mock( '@wordpress/ui', () => ( { - Link: ( { - href, - children, - openInNewTab, - variant, - ...props - }: { - href: string; - children: ReactNode; - openInNewTab?: boolean; - variant?: string; - } ) => ( - - { children } - - ), -} ) ); +// The fields import `Link` from the externals passthrough, so the stub has to +// replace it there; the Proxy leaves the rest of the barrel intact for any +// other consumer in the graph. +jest.mock( + '@jetpack-premium-analytics/externals', + () => + new Proxy( + { + Link: ( { + href, + children, + openInNewTab, + variant, + ...props + }: { + href: string; + children: ReactNode; + openInNewTab?: boolean; + variant?: string; + } ) => ( + + { children } + + ), + }, + { + get: ( overrides, prop ) => + prop in overrides + ? overrides[ prop as keyof typeof overrides ] + : jest.requireActual( '@jetpack-premium-analytics/externals' )[ prop ], + } + ) +); /** * Mount the label field's render component for a table row. diff --git a/projects/packages/premium-analytics/routes/reports/comments/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/comments/config/fields.tsx index 563b4916d69e..4532d806234a 100644 --- a/projects/packages/premium-analytics/routes/reports/comments/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/comments/config/fields.tsx @@ -1,16 +1,16 @@ /** * External dependencies */ +import { Link as UiLink } from '@jetpack-premium-analytics/externals'; import { formatMetricValue } from '@jetpack-premium-analytics/formatters'; import { __ } from '@wordpress/i18n'; import { Link as RouteLink } from '@wordpress/route'; -import { Link as UiLink } from '@wordpress/ui'; /** * Internal dependencies */ import styles from './fields.module.css'; import type { CommentReportRow } from './use-report-records'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; /** * Render the label cell for a Comments report row. diff --git a/projects/packages/premium-analytics/routes/reports/count-fields.test.tsx b/projects/packages/premium-analytics/routes/reports/count-fields.test.tsx index 3f641e7e563d..f8cb6d4f6900 100644 --- a/projects/packages/premium-analytics/routes/reports/count-fields.test.tsx +++ b/projects/packages/premium-analytics/routes/reports/count-fields.test.tsx @@ -18,7 +18,7 @@ import { getSearchTermsFields } from './search-terms/config/fields'; import { getTagsFields } from './tags/config/fields'; import { getUtmFields } from './utm/config/fields'; import { getVideosFields } from './videos/config/fields'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; /** * Render a report table's numeric field for one row. diff --git a/projects/packages/premium-analytics/routes/reports/downloads/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/downloads/config/fields.tsx index e95010e24459..4e32e5df67ae 100644 --- a/projects/packages/premium-analytics/routes/reports/downloads/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/downloads/config/fields.tsx @@ -5,7 +5,7 @@ import { safeHttpUrl } from '@jetpack-premium-analytics/ui'; import { MetricWithComparison } from '@jetpack-premium-analytics/widgets-toolkit'; import { __ } from '@wordpress/i18n'; import type { StatsFileDownloadsComparisonItem } from '@jetpack-premium-analytics/data'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; const DOWNLOADS_DATA_FORMAT = { type: 'number', diff --git a/projects/packages/premium-analytics/routes/reports/emails/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/emails/config/fields.tsx index 501facef73c8..8138a04a9b43 100644 --- a/projects/packages/premium-analytics/routes/reports/emails/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/emails/config/fields.tsx @@ -10,7 +10,7 @@ import { Link } from '@wordpress/route'; */ import styles from './fields.module.css'; import type { StatsEmailSummaryItem } from '@jetpack-premium-analytics/data'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; /** * Format a count for display. diff --git a/projects/packages/premium-analytics/routes/reports/locations/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/locations/config/fields.tsx index 7abeb2f95c24..338c980fe412 100644 --- a/projects/packages/premium-analytics/routes/reports/locations/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/locations/config/fields.tsx @@ -7,7 +7,7 @@ import { __, sprintf } from '@wordpress/i18n'; * Internal dependencies */ import styles from './fields.module.css'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; export type LocationRow = { id: string; diff --git a/projects/packages/premium-analytics/routes/reports/locations/page.test.tsx b/projects/packages/premium-analytics/routes/reports/locations/page.test.tsx index 1bcbb2fbbac4..596cc5111354 100644 --- a/projects/packages/premium-analytics/routes/reports/locations/page.test.tsx +++ b/projects/packages/premium-analytics/routes/reports/locations/page.test.tsx @@ -18,7 +18,7 @@ import { useState } from 'react'; import { getLocationFields, useLocationsReportRecords } from './config'; import LocationsReportPage from './page'; import type { LocationRow, ReportLocationsTabId } from './config'; -import type { View } from '@wordpress/dataviews'; +import type { View } from '@jetpack-premium-analytics/externals'; import type { ReactNode } from 'react'; jest.mock( './config', () => { diff --git a/projects/packages/premium-analytics/routes/reports/locations/page.tsx b/projects/packages/premium-analytics/routes/reports/locations/page.tsx index 25c485e743aa..544ada8d9387 100644 --- a/projects/packages/premium-analytics/routes/reports/locations/page.tsx +++ b/projects/packages/premium-analytics/routes/reports/locations/page.tsx @@ -36,7 +36,7 @@ import { type LocationRow, type ReportLocationsTabId, } from './config'; -import type { View } from '@wordpress/dataviews'; +import type { View } from '@jetpack-premium-analytics/externals'; const ROUTE_FROM = route.path; diff --git a/projects/packages/premium-analytics/routes/reports/package.json b/projects/packages/premium-analytics/routes/reports/package.json index b7615a90f68d..65014544c05c 100644 --- a/projects/packages/premium-analytics/routes/reports/package.json +++ b/projects/packages/premium-analytics/routes/reports/package.json @@ -9,18 +9,17 @@ "@automattic/jetpack-script-data": "workspace:*", "@jetpack-premium-analytics/data": "workspace:*", "@jetpack-premium-analytics/datetime": "workspace:*", + "@jetpack-premium-analytics/externals": "workspace:*", "@jetpack-premium-analytics/formatters": "workspace:*", "@jetpack-premium-analytics/routing": "workspace:*", "@jetpack-premium-analytics/ui": "workspace:*", "@jetpack-premium-analytics/widgets-toolkit": "workspace:*", "@wordpress/admin-ui": "2.5.0", "@wordpress/components": "37.0.0", - "@wordpress/dataviews": "14.3.0", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", "@wordpress/route": "0.17.0", - "@wordpress/ui": "0.17.0", "react": "18.3.1" }, "devDependencies": { diff --git a/projects/packages/premium-analytics/routes/reports/posts/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/posts/config/fields.tsx index a37eaf1a3053..234011dd3430 100644 --- a/projects/packages/premium-analytics/routes/reports/posts/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/posts/config/fields.tsx @@ -7,14 +7,14 @@ import { type StatsArchivesItem, type StatsTopPostsComparisonItem, } from '@jetpack-premium-analytics/data'; +import { Link as UiLink } from '@jetpack-premium-analytics/externals'; import { pickReportDateParams } from '@jetpack-premium-analytics/routing'; import { safeHttpUrl } from '@jetpack-premium-analytics/ui'; import { MetricWithComparison, PostTitleLink } from '@jetpack-premium-analytics/widgets-toolkit'; import { __ } from '@wordpress/i18n'; import { useSearch } from '@wordpress/route'; -import { Link as UiLink } from '@wordpress/ui'; import { useMemo } from 'react'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; const VIEWS_DATA_FORMAT = { type: 'number', diff --git a/projects/packages/premium-analytics/routes/reports/referrers/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/referrers/config/fields.tsx index 35714a69f89f..8704a630d0a1 100644 --- a/projects/packages/premium-analytics/routes/reports/referrers/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/referrers/config/fields.tsx @@ -1,16 +1,16 @@ /** * External dependencies */ +import { Link, Stack } from '@jetpack-premium-analytics/externals'; import { DrilldownLeafCell, safeHttpUrl } from '@jetpack-premium-analytics/ui'; import { MetricWithComparison } from '@jetpack-premium-analytics/widgets-toolkit'; import { useCallback, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -import { Link, Stack } from '@wordpress/ui'; /** * Internal dependencies */ import styles from './fields.module.css'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; /** * A flattened referrer group, source, or domain shown in the records table. diff --git a/projects/packages/premium-analytics/routes/reports/report-csv-exports.test.tsx b/projects/packages/premium-analytics/routes/reports/report-csv-exports.test.tsx index 626301f0f2c8..965289aede74 100644 --- a/projects/packages/premium-analytics/routes/reports/report-csv-exports.test.tsx +++ b/projects/packages/premium-analytics/routes/reports/report-csv-exports.test.tsx @@ -110,13 +110,28 @@ jest.mock( '@wordpress/route', () => ( { useSearch: () => ( {} ), } ) ); -jest.mock( '@wordpress/ui', () => ( { - EmptyState: { - Root: ( { children }: { children?: ReactNode } ) => <>{ children }, - Title: ( { children }: { children?: ReactNode } ) => <>{ children }, - }, - Text: ( { children }: { children?: ReactNode } ) => <>{ children }, -} ) ); +// The page imports `EmptyState`/`Text` from the externals passthrough, so the +// stubs have to replace them there; the Proxy leaves the rest of the barrel +// intact for any other consumer in the graph. +jest.mock( + '@jetpack-premium-analytics/externals', + () => + new Proxy( + { + EmptyState: { + Root: ( { children }: { children?: ReactNode } ) => <>{ children }, + Title: ( { children }: { children?: ReactNode } ) => <>{ children }, + }, + Text: ( { children }: { children?: ReactNode } ) => <>{ children }, + }, + { + get: ( overrides, prop ) => + prop in overrides + ? overrides[ prop as keyof typeof overrides ] + : jest.requireActual( '@jetpack-premium-analytics/externals' )[ prop ], + } + ) +); jest.mock( './annual-insights/config', () => ( { getAnnualInsightsFields: () => [], diff --git a/projects/packages/premium-analytics/routes/reports/search-terms/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/search-terms/config/fields.tsx index caa9e6025c76..746ac4c2606d 100644 --- a/projects/packages/premium-analytics/routes/reports/search-terms/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/search-terms/config/fields.tsx @@ -7,7 +7,7 @@ import { __ } from '@wordpress/i18n'; * Internal dependencies */ import type { SearchTermRow } from './aggregate'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; const VIEWS_DATA_FORMAT = { type: 'number', diff --git a/projects/packages/premium-analytics/routes/reports/stage.tsx b/projects/packages/premium-analytics/routes/reports/stage.tsx index 3bb3102bd782..da068e6e5c13 100644 --- a/projects/packages/premium-analytics/routes/reports/stage.tsx +++ b/projects/packages/premium-analytics/routes/reports/stage.tsx @@ -2,11 +2,11 @@ * External dependencies */ import { AnalyticsQueryClientProvider, GlobalErrorProvider } from '@jetpack-premium-analytics/data'; +import { Stack } from '@jetpack-premium-analytics/externals'; import { GlobalChartsProvider, useChartTheme } from '@jetpack-premium-analytics/widgets-toolkit'; import { Spinner } from '@wordpress/components'; import { lazy, Suspense, useMemo } from '@wordpress/element'; import { useParams } from '@wordpress/route'; -import { Stack } from '@wordpress/ui'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/routes/reports/tags/config/fields.test.tsx b/projects/packages/premium-analytics/routes/reports/tags/config/fields.test.tsx index 099d89653dc3..3f9dd0ffa1bc 100644 --- a/projects/packages/premium-analytics/routes/reports/tags/config/fields.test.tsx +++ b/projects/packages/premium-analytics/routes/reports/tags/config/fields.test.tsx @@ -9,31 +9,48 @@ import { getTagsFields } from './fields'; import type { StatsTagsItem } from '@jetpack-premium-analytics/data'; import type { ReactNode } from 'react'; -jest.mock( '@wordpress/ui', () => ( { - Icon: () => null, - Link: ( { - href, - children, - openInNewTab, - variant, - ...props - }: { - href: string; - children: ReactNode; - openInNewTab?: boolean; - variant?: string; - } ) => ( - - { children } - - ), -} ) ); +// The fields import `Icon`/`Link` from the externals passthrough, so the stubs +// have to replace them there. Everything else falls through to the real barrel: +// a plain object would leave the rest of it undefined for any other consumer in +// the graph, and calling `requireActual` eagerly re-enters the module while it +// is still initialising. +jest.mock( + '@jetpack-premium-analytics/externals', + () => + new Proxy( + { + Icon: () => null, + Link: ( { + href, + children, + openInNewTab, + variant, + ...props + }: { + href: string; + children: ReactNode; + openInNewTab?: boolean; + variant?: string; + } ) => ( + + { children } + + ), + }, + { + get: ( overrides, prop ) => + prop in overrides + ? overrides[ prop as keyof typeof overrides ] + : jest.requireActual( '@jetpack-premium-analytics/externals' )[ prop ], + } + ) +); const tag = { label: [ { label: 'Recipes', labelIcon: 'tag' } ], diff --git a/projects/packages/premium-analytics/routes/reports/tags/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/tags/config/fields.tsx index d4f7b36b273d..f26c2a653db4 100644 --- a/projects/packages/premium-analytics/routes/reports/tags/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/tags/config/fields.tsx @@ -1,17 +1,17 @@ /** * External dependencies */ +import { Icon, Link } from '@jetpack-premium-analytics/externals'; import { formatMetricValue } from '@jetpack-premium-analytics/formatters'; import { safeHttpUrl } from '@jetpack-premium-analytics/ui'; import { __ } from '@wordpress/i18n'; import { category, tag as tagGlyph } from '@wordpress/icons'; -import { Icon, Link } from '@wordpress/ui'; /** * Internal dependencies */ import styles from './fields.module.css'; import type { StatsTagsItem } from '@jetpack-premium-analytics/data'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; const rowGlyph = ( labelIcon: string ) => ( labelIcon === 'folder' ? category : tagGlyph ); diff --git a/projects/packages/premium-analytics/routes/reports/utm/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/utm/config/fields.tsx index 51bb1fdc182a..7536643db76d 100644 --- a/projects/packages/premium-analytics/routes/reports/utm/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/utm/config/fields.tsx @@ -10,7 +10,7 @@ import { Link } from '@wordpress/route'; */ import { getUtmTabLabel, type UtmReportTabId } from './tabs'; import type { UtmReportRow } from './aggregate'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; const VIEWS_DATA_FORMAT = { type: 'number' as const, diff --git a/projects/packages/premium-analytics/routes/reports/videos/config/fields.tsx b/projects/packages/premium-analytics/routes/reports/videos/config/fields.tsx index 5b5496176214..6bd25b892b48 100644 --- a/projects/packages/premium-analytics/routes/reports/videos/config/fields.tsx +++ b/projects/packages/premium-analytics/routes/reports/videos/config/fields.tsx @@ -7,7 +7,7 @@ import { __ } from '@wordpress/i18n'; import { useSearch } from '@wordpress/route'; import { useMemo } from 'react'; import type { StatsVideoPlaysComparisonItem } from '@jetpack-premium-analytics/data'; -import type { Field } from '@wordpress/dataviews'; +import type { Field } from '@jetpack-premium-analytics/externals'; const METRIC_DATA_FORMAT = { type: 'number', diff --git a/projects/packages/premium-analytics/routes/syncing/components/syncing/syncing.tsx b/projects/packages/premium-analytics/routes/syncing/components/syncing/syncing.tsx index bef7a02baf34..67295c5d39eb 100644 --- a/projects/packages/premium-analytics/routes/syncing/components/syncing/syncing.tsx +++ b/projects/packages/premium-analytics/routes/syncing/components/syncing/syncing.tsx @@ -1,10 +1,10 @@ /** * External dependencies */ +import { Stack, Button } from '@jetpack-premium-analytics/externals'; import { useSyncStatus } from '@jetpack-premium-analytics/site-sync'; import { ProgressBar } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; -import { Stack, Button } from '@wordpress/ui'; import { useState, useEffect, useRef, useCallback } from 'react'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/routes/syncing/package.json b/projects/packages/premium-analytics/routes/syncing/package.json index 0eaf0154c2ac..14081431ad62 100644 --- a/projects/packages/premium-analytics/routes/syncing/package.json +++ b/projects/packages/premium-analytics/routes/syncing/package.json @@ -7,11 +7,11 @@ }, "dependencies": { "@automattic/jetpack-script-data": "workspace:*", + "@jetpack-premium-analytics/externals": "workspace:*", "@jetpack-premium-analytics/site-sync": "workspace:*", "@wordpress/components": "37.0.0", "@wordpress/i18n": "^6.9.0", "@wordpress/route": "0.17.0", - "@wordpress/ui": "0.17.0", "react": "18.3.1" } } diff --git a/projects/packages/premium-analytics/routes/syncing/stage.tsx b/projects/packages/premium-analytics/routes/syncing/stage.tsx index 6236c5773b9f..75694aadd2d6 100644 --- a/projects/packages/premium-analytics/routes/syncing/stage.tsx +++ b/projects/packages/premium-analytics/routes/syncing/stage.tsx @@ -1,7 +1,7 @@ /** * External dependencies */ -import { Stack } from '@wordpress/ui'; +import { Stack } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/routes/video-detail/components/video-summary-card/video-summary-card.tsx b/projects/packages/premium-analytics/routes/video-detail/components/video-summary-card/video-summary-card.tsx index 940bc44a56f1..0c00ceb7830d 100644 --- a/projects/packages/premium-analytics/routes/video-detail/components/video-summary-card/video-summary-card.tsx +++ b/projects/packages/premium-analytics/routes/video-detail/components/video-summary-card/video-summary-card.tsx @@ -1,8 +1,8 @@ /** * External dependencies */ +import { Text } from '@jetpack-premium-analytics/externals'; import { __, sprintf } from '@wordpress/i18n'; -import { Text } from '@wordpress/ui'; import { format, isValid } from 'date-fns'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/routes/video-detail/package.json b/projects/packages/premium-analytics/routes/video-detail/package.json index f1140fd9a58e..9500924fb868 100644 --- a/projects/packages/premium-analytics/routes/video-detail/package.json +++ b/projects/packages/premium-analytics/routes/video-detail/package.json @@ -8,6 +8,7 @@ "dependencies": { "@automattic/jetpack-script-data": "workspace:*", "@jetpack-premium-analytics/data": "workspace:*", + "@jetpack-premium-analytics/externals": "workspace:*", "@jetpack-premium-analytics/routing": "workspace:*", "@jetpack-premium-analytics/ui": "workspace:*", "@wordpress/admin-ui": "2.5.0", @@ -18,7 +19,6 @@ "@wordpress/icons": "^15.0.0", "@wordpress/preferences": "4.51.0", "@wordpress/route": "0.16.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-dashboard": "0.2.0", "@wordpress/widget-primitives": "0.2.0", "date-fns": "4.1.0", diff --git a/projects/packages/premium-analytics/routes/video-detail/stage.test.tsx b/projects/packages/premium-analytics/routes/video-detail/stage.test.tsx index 6a27b40764ff..f8918ef13505 100644 --- a/projects/packages/premium-analytics/routes/video-detail/stage.test.tsx +++ b/projects/packages/premium-analytics/routes/video-detail/stage.test.tsx @@ -20,9 +20,25 @@ jest.mock( '@wordpress/core-data', () => ( { store: {}, } ) ); -jest.mock( '@wordpress/data', () => ( { - useSelect: () => [], -} ) ); +// Falls through to the real module for everything but `useSelect`. Reaching the +// externals passthrough pulls `@wordpress/components` -> `@wordpress/rich-text` +// into the graph, whose store calls `combineReducers` at import time; a +// `useSelect`-only mock leaves that undefined and the suite fails to load. +// `requireActual` has to stay lazy — calling it in the factory body re-enters +// the module while it is still initialising. +jest.mock( + '@wordpress/data', + () => + new Proxy( + { useSelect: () => [] }, + { + get: ( overrides, prop ) => + prop in overrides + ? overrides[ prop as keyof typeof overrides ] + : jest.requireActual( '@wordpress/data' )[ prop ], + } + ) +); jest.mock( '@wordpress/widget-dashboard', () => { const WidgetDashboard = ( { children }: { children: ReactNode } ) => <>{ children }; diff --git a/projects/packages/premium-analytics/routes/video-detail/stage.tsx b/projects/packages/premium-analytics/routes/video-detail/stage.tsx index e4ce08e11f92..d0073b9c11fe 100644 --- a/projects/packages/premium-analytics/routes/video-detail/stage.tsx +++ b/projects/packages/premium-analytics/routes/video-detail/stage.tsx @@ -2,13 +2,13 @@ * External dependencies */ import { AnalyticsQueryClientProvider, GlobalErrorProvider } from '@jetpack-premium-analytics/data'; +import { Button, Stack, Text } from '@jetpack-premium-analytics/externals'; import { pickReportDateParams, useDashboardLink } from '@jetpack-premium-analytics/routing'; import { Breadcrumbs, Page } from '@wordpress/admin-ui'; import { store as coreStore } from '@wordpress/core-data'; import { useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; import { Link, useParams, useSearch } from '@wordpress/route'; -import { Button, Stack, Text } from '@wordpress/ui'; import { WidgetDashboard } from '@wordpress/widget-dashboard'; import { type WidgetModuleRecord } from '@wordpress/widget-primitives'; /** diff --git a/projects/packages/premium-analytics/widgets/annual-highlights/package.json b/projects/packages/premium-analytics/widgets/annual-highlights/package.json index 07518f885645..18fcc682c0f6 100644 --- a/projects/packages/premium-analytics/widgets/annual-highlights/package.json +++ b/projects/packages/premium-analytics/widgets/annual-highlights/package.json @@ -5,11 +5,11 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/fields": "link:../../packages/fields", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0", "react": "18.3.1" } diff --git a/projects/packages/premium-analytics/widgets/annual-highlights/render.tsx b/projects/packages/premium-analytics/widgets/annual-highlights/render.tsx index 9ecc0d415f09..db883a3432a5 100644 --- a/projects/packages/premium-analytics/widgets/annual-highlights/render.tsx +++ b/projects/packages/premium-analytics/widgets/annual-highlights/render.tsx @@ -25,7 +25,7 @@ import { postList, starEmpty, } from '@wordpress/icons'; -import { Button, Stack, Text } from '@wordpress/ui'; +import { Button, Stack, Text } from '@jetpack-premium-analytics/externals'; import { useCallback, useMemo, useState } from 'react'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/widgets/email-top-row/package.json b/projects/packages/premium-analytics/widgets/email-top-row/package.json index db9791c033d3..25bc928114a3 100644 --- a/projects/packages/premium-analytics/widgets/email-top-row/package.json +++ b/projects/packages/premium-analytics/widgets/email-top-row/package.json @@ -5,11 +5,11 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" } } diff --git a/projects/packages/premium-analytics/widgets/email-top-row/render.tsx b/projects/packages/premium-analytics/widgets/email-top-row/render.tsx index 0732fa6fd718..630ff6d12cae 100644 --- a/projects/packages/premium-analytics/widgets/email-top-row/render.tsx +++ b/projects/packages/premium-analytics/widgets/email-top-row/render.tsx @@ -18,7 +18,7 @@ import { import { useCallback, useMemo } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { envelope, link, people, percent, seen, send } from '@wordpress/icons'; -import { Icon, Stack } from '@wordpress/ui'; +import { Icon, Stack } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/file-downloads/package.json b/projects/packages/premium-analytics/widgets/file-downloads/package.json index 70725ee37e77..42e4cfbc0de9 100644 --- a/projects/packages/premium-analytics/widgets/file-downloads/package.json +++ b/projects/packages/premium-analytics/widgets/file-downloads/package.json @@ -5,11 +5,11 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" } } diff --git a/projects/packages/premium-analytics/widgets/file-downloads/render.tsx b/projects/packages/premium-analytics/widgets/file-downloads/render.tsx index 6c804bd1718e..5ce50ec99a00 100644 --- a/projects/packages/premium-analytics/widgets/file-downloads/render.tsx +++ b/projects/packages/premium-analytics/widgets/file-downloads/render.tsx @@ -12,7 +12,7 @@ import { import { useMemo } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { download } from '@wordpress/icons'; -import { Link } from '@wordpress/ui'; +import { Link } from '@jetpack-premium-analytics/externals'; import { calculateDelta, getCombinedPeriodMax, diff --git a/projects/packages/premium-analytics/widgets/hello-world/package.json b/projects/packages/premium-analytics/widgets/hello-world/package.json index b3c804578c0e..6c90e501e968 100644 --- a/projects/packages/premium-analytics/widgets/hello-world/package.json +++ b/projects/packages/premium-analytics/widgets/hello-world/package.json @@ -4,9 +4,9 @@ "private": true, "type": "module", "dependencies": { + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" }, "devDependencies": { diff --git a/projects/packages/premium-analytics/widgets/hello-world/render.tsx b/projects/packages/premium-analytics/widgets/hello-world/render.tsx index 0d651a4062be..99225ba5cbb4 100644 --- a/projects/packages/premium-analytics/widgets/hello-world/render.tsx +++ b/projects/packages/premium-analytics/widgets/hello-world/render.tsx @@ -2,7 +2,7 @@ * External dependencies */ import { __ } from '@wordpress/i18n'; -import { Stack, Text } from '@wordpress/ui'; +import { Stack, Text } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/hello-world/stories/dashboard-sections-grid.stories.tsx b/projects/packages/premium-analytics/widgets/hello-world/stories/dashboard-sections-grid.stories.tsx index 9f5d8681695e..8a9c48637c95 100644 --- a/projects/packages/premium-analytics/widgets/hello-world/stories/dashboard-sections-grid.stories.tsx +++ b/projects/packages/premium-analytics/widgets/hello-world/stories/dashboard-sections-grid.stories.tsx @@ -1,5 +1,5 @@ import { useState } from '@wordpress/element'; -import { Tabs } from '@wordpress/ui'; +import { Tabs } from '@jetpack-premium-analytics/externals'; import { WidgetDashboard, type DashboardWidget } from '@wordpress/widget-dashboard'; import { DashboardSections } from '../../../routes/dashboard/components'; import styles from '../../../routes/dashboard/stage.module.scss'; diff --git a/projects/packages/premium-analytics/widgets/latest-post/package.json b/projects/packages/premium-analytics/widgets/latest-post/package.json index 747b03f02046..81b60aeca562 100644 --- a/projects/packages/premium-analytics/widgets/latest-post/package.json +++ b/projects/packages/premium-analytics/widgets/latest-post/package.json @@ -5,11 +5,11 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/routing": "link:../../packages/routing", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0", "date-fns": "4.1.0" } diff --git a/projects/packages/premium-analytics/widgets/latest-post/render.tsx b/projects/packages/premium-analytics/widgets/latest-post/render.tsx index 4f9c68dd9ed0..72da981fd9a7 100644 --- a/projects/packages/premium-analytics/widgets/latest-post/render.tsx +++ b/projects/packages/premium-analytics/widgets/latest-post/render.tsx @@ -14,7 +14,7 @@ import { import { useMemo } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; import { postList } from '@wordpress/icons'; -import { Text } from '@wordpress/ui'; +import { Text } from '@jetpack-premium-analytics/externals'; import { format, parseISO } from 'date-fns'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/widgets/locations/package.json b/projects/packages/premium-analytics/widgets/locations/package.json index a11fee9f250c..0040d4548ed9 100644 --- a/projects/packages/premium-analytics/widgets/locations/package.json +++ b/projects/packages/premium-analytics/widgets/locations/package.json @@ -5,12 +5,12 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/icons": "link:../../packages/icons", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" } } diff --git a/projects/packages/premium-analytics/widgets/locations/render.tsx b/projects/packages/premium-analytics/widgets/locations/render.tsx index 6be97e34c1e3..0a154e86e030 100644 --- a/projects/packages/premium-analytics/widgets/locations/render.tsx +++ b/projects/packages/premium-analytics/widgets/locations/render.tsx @@ -26,7 +26,7 @@ import { import { location as locationIcon } from '@jetpack-premium-analytics/icons'; import { useCallback, useEffect, useMemo, useState } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; -import { Stack } from '@wordpress/ui'; +import { Stack } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/most-commented-authors/package.json b/projects/packages/premium-analytics/widgets/most-commented-authors/package.json index 1c5898373855..551312831839 100644 --- a/projects/packages/premium-analytics/widgets/most-commented-authors/package.json +++ b/projects/packages/premium-analytics/widgets/most-commented-authors/package.json @@ -5,11 +5,11 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0", "react": "18.3.1" } diff --git a/projects/packages/premium-analytics/widgets/most-commented-authors/render.tsx b/projects/packages/premium-analytics/widgets/most-commented-authors/render.tsx index 92123ad539a2..307e2cf7ac49 100644 --- a/projects/packages/premium-analytics/widgets/most-commented-authors/render.tsx +++ b/projects/packages/premium-analytics/widgets/most-commented-authors/render.tsx @@ -18,7 +18,7 @@ import { import { useMemo } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { commentAuthorAvatar } from '@wordpress/icons'; -import { Stack } from '@wordpress/ui'; +import { Stack } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/most-commented-posts/package.json b/projects/packages/premium-analytics/widgets/most-commented-posts/package.json index 36f80930ac2e..db1b15a981ab 100644 --- a/projects/packages/premium-analytics/widgets/most-commented-posts/package.json +++ b/projects/packages/premium-analytics/widgets/most-commented-posts/package.json @@ -5,11 +5,11 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0", "react": "18.3.1" } diff --git a/projects/packages/premium-analytics/widgets/most-commented-posts/render.tsx b/projects/packages/premium-analytics/widgets/most-commented-posts/render.tsx index 62caedeaaf7b..786565203551 100644 --- a/projects/packages/premium-analytics/widgets/most-commented-posts/render.tsx +++ b/projects/packages/premium-analytics/widgets/most-commented-posts/render.tsx @@ -18,7 +18,7 @@ import { import { useMemo } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { commentContent } from '@wordpress/icons'; -import { Stack } from '@wordpress/ui'; +import { Stack } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/most-popular-day/package.json b/projects/packages/premium-analytics/widgets/most-popular-day/package.json index 6752de4d9274..78884074bbea 100644 --- a/projects/packages/premium-analytics/widgets/most-popular-day/package.json +++ b/projects/packages/premium-analytics/widgets/most-popular-day/package.json @@ -6,12 +6,12 @@ "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", "@jetpack-premium-analytics/datetime": "link:../../packages/datetime", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/formatters": "link:../../packages/formatters", "@jetpack-premium-analytics/icons": "link:../../packages/icons", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" } } diff --git a/projects/packages/premium-analytics/widgets/most-popular-day/render.tsx b/projects/packages/premium-analytics/widgets/most-popular-day/render.tsx index 9596711953fc..04ac289da85c 100644 --- a/projects/packages/premium-analytics/widgets/most-popular-day/render.tsx +++ b/projects/packages/premium-analytics/widgets/most-popular-day/render.tsx @@ -12,7 +12,7 @@ import { type ReportParamsFieldAttributes, } from '@jetpack-premium-analytics/widgets-toolkit'; import { __, sprintf } from '@wordpress/i18n'; -import { Stack, Text } from '@wordpress/ui'; +import { Stack, Text } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/most-popular-time/package.json b/projects/packages/premium-analytics/widgets/most-popular-time/package.json index 69df8c1eb43f..c25485ee1658 100644 --- a/projects/packages/premium-analytics/widgets/most-popular-time/package.json +++ b/projects/packages/premium-analytics/widgets/most-popular-time/package.json @@ -5,10 +5,10 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" }, "devDependencies": { diff --git a/projects/packages/premium-analytics/widgets/most-popular-time/render.tsx b/projects/packages/premium-analytics/widgets/most-popular-time/render.tsx index 14f23bcd022c..7666e66c5ff4 100644 --- a/projects/packages/premium-analytics/widgets/most-popular-time/render.tsx +++ b/projects/packages/premium-analytics/widgets/most-popular-time/render.tsx @@ -9,7 +9,7 @@ import { } from '@jetpack-premium-analytics/widgets-toolkit'; import { __, sprintf } from '@wordpress/i18n'; import { scheduled } from '@wordpress/icons'; -import { Stack, Text } from '@wordpress/ui'; +import { Stack, Text } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/payment-status/package.json b/projects/packages/premium-analytics/widgets/payment-status/package.json index bc6862c8b2e1..53720ff1496e 100644 --- a/projects/packages/premium-analytics/widgets/payment-status/package.json +++ b/projects/packages/premium-analytics/widgets/payment-status/package.json @@ -5,11 +5,11 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/icons": "link:../../packages/icons", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0", "react": "18.3.1" } diff --git a/projects/packages/premium-analytics/widgets/payment-status/payment-status-widget.tsx b/projects/packages/premium-analytics/widgets/payment-status/payment-status-widget.tsx index e1353514f402..9004d3a0db23 100644 --- a/projects/packages/premium-analytics/widgets/payment-status/payment-status-widget.tsx +++ b/projects/packages/premium-analytics/widgets/payment-status/payment-status-widget.tsx @@ -12,7 +12,7 @@ import { useWidgetRootContext, } from '@jetpack-premium-analytics/widgets-toolkit'; import { __ } from '@wordpress/i18n'; -import { Stack } from '@wordpress/ui'; +import { Stack } from '@jetpack-premium-analytics/externals'; import { useMemo } from 'react'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/widgets/plan-usage/package.json b/projects/packages/premium-analytics/widgets/plan-usage/package.json index d329c7283343..0eeb90c593c3 100644 --- a/projects/packages/premium-analytics/widgets/plan-usage/package.json +++ b/projects/packages/premium-analytics/widgets/plan-usage/package.json @@ -6,12 +6,12 @@ "dependencies": { "@automattic/jetpack-script-data": "workspace:*", "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/formatters": "link:../../packages/formatters", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0", "clsx": "^2.1.1", "react": "18.3.1" diff --git a/projects/packages/premium-analytics/widgets/plan-usage/render.tsx b/projects/packages/premium-analytics/widgets/plan-usage/render.tsx index a7c12eb00cc7..78a3b8781282 100644 --- a/projects/packages/premium-analytics/widgets/plan-usage/render.tsx +++ b/projects/packages/premium-analytics/widgets/plan-usage/render.tsx @@ -12,7 +12,7 @@ import { import { createInterpolateElement } from '@wordpress/element'; import { __, _n, sprintf } from '@wordpress/i18n'; import { percent } from '@wordpress/icons'; -import { Link, Stack, Text } from '@wordpress/ui'; +import { Link, Stack, Text } from '@jetpack-premium-analytics/externals'; import clsx from 'clsx'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/widgets/post-traffic-activity/package.json b/projects/packages/premium-analytics/widgets/post-traffic-activity/package.json index a3e4ad581d35..0ffd90ca669c 100644 --- a/projects/packages/premium-analytics/widgets/post-traffic-activity/package.json +++ b/projects/packages/premium-analytics/widgets/post-traffic-activity/package.json @@ -5,13 +5,13 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/icons": "link:../../packages/icons", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/compose": "8.4.0", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0", "date-fns": "4.1.0" } diff --git a/projects/packages/premium-analytics/widgets/post-traffic-activity/render.tsx b/projects/packages/premium-analytics/widgets/post-traffic-activity/render.tsx index 7250f99b5ca7..22231eb423c4 100644 --- a/projects/packages/premium-analytics/widgets/post-traffic-activity/render.tsx +++ b/projects/packages/premium-analytics/widgets/post-traffic-activity/render.tsx @@ -15,7 +15,7 @@ import { useResizeObserver } from '@wordpress/compose'; import { useMemo, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { chevronLeft, chevronRight } from '@wordpress/icons'; -import { Button, Stack } from '@wordpress/ui'; +import { Button, Stack } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/search-terms/package.json b/projects/packages/premium-analytics/widgets/search-terms/package.json index 5b2f9a14be7d..32fa3f42194e 100644 --- a/projects/packages/premium-analytics/widgets/search-terms/package.json +++ b/projects/packages/premium-analytics/widgets/search-terms/package.json @@ -5,12 +5,12 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/icons": "link:../../packages/icons", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" } } diff --git a/projects/packages/premium-analytics/widgets/search-terms/render.tsx b/projects/packages/premium-analytics/widgets/search-terms/render.tsx index 2b3232374055..0b0ddb9dd6f5 100644 --- a/projects/packages/premium-analytics/widgets/search-terms/render.tsx +++ b/projects/packages/premium-analytics/widgets/search-terms/render.tsx @@ -18,7 +18,7 @@ import { import { search } from '@jetpack-premium-analytics/icons'; import { useMemo } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -import { Stack, Text } from '@wordpress/ui'; +import { Stack, Text } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/shares/package.json b/projects/packages/premium-analytics/widgets/shares/package.json index 80afe91e1639..942b3e83b642 100644 --- a/projects/packages/premium-analytics/widgets/shares/package.json +++ b/projects/packages/premium-analytics/widgets/shares/package.json @@ -5,12 +5,12 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/icons": "link:../../packages/icons", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" } } diff --git a/projects/packages/premium-analytics/widgets/shares/render.tsx b/projects/packages/premium-analytics/widgets/shares/render.tsx index b86814baaf69..bec03f6699b7 100644 --- a/projects/packages/premium-analytics/widgets/shares/render.tsx +++ b/projects/packages/premium-analytics/widgets/shares/render.tsx @@ -12,7 +12,7 @@ import { import { megaphone } from '@jetpack-premium-analytics/icons'; import { useMemo } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -import { Stack, Text } from '@wordpress/ui'; +import { Stack, Text } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/site-overview/package.json b/projects/packages/premium-analytics/widgets/site-overview/package.json index 71c73bd9f3a9..f00bb6c87a20 100644 --- a/projects/packages/premium-analytics/widgets/site-overview/package.json +++ b/projects/packages/premium-analytics/widgets/site-overview/package.json @@ -5,12 +5,12 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/fields": "link:../../packages/fields", "@jetpack-premium-analytics/formatters": "link:../../packages/formatters", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0", "react": "18.3.1" }, diff --git a/projects/packages/premium-analytics/widgets/site-overview/render.tsx b/projects/packages/premium-analytics/widgets/site-overview/render.tsx index 64bbbea1e5c4..f455a1c6f89b 100644 --- a/projects/packages/premium-analytics/widgets/site-overview/render.tsx +++ b/projects/packages/premium-analytics/widgets/site-overview/render.tsx @@ -13,7 +13,7 @@ import { } from '@jetpack-premium-analytics/widgets-toolkit'; import { __ } from '@wordpress/i18n'; import { comment, globe, people, seen, starEmpty } from '@wordpress/icons'; -import { Text } from '@wordpress/ui'; +import { Text } from '@jetpack-premium-analytics/externals'; import { useMemo } from 'react'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/widgets/subscriber-highlights/package.json b/projects/packages/premium-analytics/widgets/subscriber-highlights/package.json index 141cbcb682f7..942802b311f3 100644 --- a/projects/packages/premium-analytics/widgets/subscriber-highlights/package.json +++ b/projects/packages/premium-analytics/widgets/subscriber-highlights/package.json @@ -5,12 +5,12 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/fields": "link:../../packages/fields", "@jetpack-premium-analytics/icons": "link:../../packages/icons", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0", "react": "18.3.1" } diff --git a/projects/packages/premium-analytics/widgets/subscriber-highlights/render.tsx b/projects/packages/premium-analytics/widgets/subscriber-highlights/render.tsx index f6231707d8c3..5233e57c3c40 100644 --- a/projects/packages/premium-analytics/widgets/subscriber-highlights/render.tsx +++ b/projects/packages/premium-analytics/widgets/subscriber-highlights/render.tsx @@ -15,7 +15,7 @@ import { } from '@jetpack-premium-analytics/widgets-toolkit'; import { __ } from '@wordpress/i18n'; import { envelope, payment, people, share } from '@wordpress/icons'; -import { Text } from '@wordpress/ui'; +import { Text } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/tags/package.json b/projects/packages/premium-analytics/widgets/tags/package.json index 89babd5cad77..512ee62cb479 100644 --- a/projects/packages/premium-analytics/widgets/tags/package.json +++ b/projects/packages/premium-analytics/widgets/tags/package.json @@ -5,12 +5,12 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/icons": "link:../../packages/icons", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" } } diff --git a/projects/packages/premium-analytics/widgets/tags/render.tsx b/projects/packages/premium-analytics/widgets/tags/render.tsx index f71563e9d73b..7b1d1b93da67 100644 --- a/projects/packages/premium-analytics/widgets/tags/render.tsx +++ b/projects/packages/premium-analytics/widgets/tags/render.tsx @@ -19,7 +19,7 @@ import { tag as tagIllustration } from '@jetpack-premium-analytics/icons'; import { useEffect, useMemo } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; import { category, tag as tagGlyph } from '@wordpress/icons'; -import { Icon, Link, Stack } from '@wordpress/ui'; +import { Icon, Link, Stack } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */ diff --git a/projects/packages/premium-analytics/widgets/top-platforms/package.json b/projects/packages/premium-analytics/widgets/top-platforms/package.json index fc5348dde15f..afb933ea908b 100644 --- a/projects/packages/premium-analytics/widgets/top-platforms/package.json +++ b/projects/packages/premium-analytics/widgets/top-platforms/package.json @@ -5,11 +5,11 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/icons": "link:../../packages/icons", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" } } diff --git a/projects/packages/premium-analytics/widgets/top-platforms/render.tsx b/projects/packages/premium-analytics/widgets/top-platforms/render.tsx index 2eea7902d631..2a9f0e2b6704 100644 --- a/projects/packages/premium-analytics/widgets/top-platforms/render.tsx +++ b/projects/packages/premium-analytics/widgets/top-platforms/render.tsx @@ -6,7 +6,7 @@ import { device } from '@jetpack-premium-analytics/icons'; * WordPress dependencies */ import { __ } from '@wordpress/i18n'; -import { Stack, Text } from '@wordpress/ui'; +import { Stack, Text } from '@jetpack-premium-analytics/externals'; import { calculateDelta, describeError, diff --git a/projects/packages/premium-analytics/widgets/top-posts/package.json b/projects/packages/premium-analytics/widgets/top-posts/package.json index 0e380bbb5d80..864f3b98b1cb 100644 --- a/projects/packages/premium-analytics/widgets/top-posts/package.json +++ b/projects/packages/premium-analytics/widgets/top-posts/package.json @@ -5,12 +5,12 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/icons": "link:../../packages/icons", "@jetpack-premium-analytics/routing": "link:../../packages/routing", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0", "react": "18.3.1" }, diff --git a/projects/packages/premium-analytics/widgets/top-posts/render.tsx b/projects/packages/premium-analytics/widgets/top-posts/render.tsx index 995f2afef0c5..ce2b126b8c35 100644 --- a/projects/packages/premium-analytics/widgets/top-posts/render.tsx +++ b/projects/packages/premium-analytics/widgets/top-posts/render.tsx @@ -30,7 +30,7 @@ import { type ReportParamsFieldAttributes, } from '@jetpack-premium-analytics/widgets-toolkit'; import { __, sprintf } from '@wordpress/i18n'; -import { Text } from '@wordpress/ui'; +import { Text } from '@jetpack-premium-analytics/externals'; import { useCallback, useEffect, useMemo } from 'react'; /** * Internal dependencies diff --git a/projects/packages/premium-analytics/widgets/utm-insights/package.json b/projects/packages/premium-analytics/widgets/utm-insights/package.json index f7ce05bb8c5a..e895c36f1183 100644 --- a/projects/packages/premium-analytics/widgets/utm-insights/package.json +++ b/projects/packages/premium-analytics/widgets/utm-insights/package.json @@ -5,12 +5,12 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/icons": "link:../../packages/icons", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" } } diff --git a/projects/packages/premium-analytics/widgets/utm-insights/render.tsx b/projects/packages/premium-analytics/widgets/utm-insights/render.tsx index 01893d7ee9b5..e2de108060c1 100644 --- a/projects/packages/premium-analytics/widgets/utm-insights/render.tsx +++ b/projects/packages/premium-analytics/widgets/utm-insights/render.tsx @@ -3,7 +3,7 @@ */ import { useEffect, useMemo } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; -import { Text } from '@wordpress/ui'; +import { Text } from '@jetpack-premium-analytics/externals'; import { calculateDelta, describeError, diff --git a/projects/packages/premium-analytics/widgets/video-detail-embeds/package.json b/projects/packages/premium-analytics/widgets/video-detail-embeds/package.json index e59cced4d446..bc1afae8e1c1 100644 --- a/projects/packages/premium-analytics/widgets/video-detail-embeds/package.json +++ b/projects/packages/premium-analytics/widgets/video-detail-embeds/package.json @@ -5,11 +5,11 @@ "type": "module", "dependencies": { "@jetpack-premium-analytics/data": "link:../../packages/data", + "@jetpack-premium-analytics/externals": "link:../../packages/externals", "@jetpack-premium-analytics/widgets-toolkit": "link:../../packages/widgets-toolkit", "@wordpress/element": "8.3.0", "@wordpress/i18n": "^6.9.0", "@wordpress/icons": "^15.0.0", - "@wordpress/ui": "0.17.0", "@wordpress/widget-primitives": "0.2.0" } } diff --git a/projects/packages/premium-analytics/widgets/video-detail-embeds/render.tsx b/projects/packages/premium-analytics/widgets/video-detail-embeds/render.tsx index 348090238a75..c8e0074e2033 100644 --- a/projects/packages/premium-analytics/widgets/video-detail-embeds/render.tsx +++ b/projects/packages/premium-analytics/widgets/video-detail-embeds/render.tsx @@ -16,7 +16,7 @@ import { } from '@jetpack-premium-analytics/widgets-toolkit'; import { __ } from '@wordpress/i18n'; import { video } from '@wordpress/icons'; -import { Link, Stack } from '@wordpress/ui'; +import { Link, Stack } from '@jetpack-premium-analytics/externals'; /** * Internal dependencies */