diff --git a/.changeset/perfect-otters-help.md b/.changeset/perfect-otters-help.md new file mode 100644 index 00000000..b263a827 --- /dev/null +++ b/.changeset/perfect-otters-help.md @@ -0,0 +1,5 @@ +--- +'@redux-devtools/rtk-query-monitor': major +--- + +Replace jss with Emotion in inspector-monitor. `@emotion/react` is now a required peer dependency. diff --git a/packages/redux-devtools-rtk-query-monitor/.eslintrc.js b/packages/redux-devtools-rtk-query-monitor/.eslintrc.js index 33fb8f94..96aefbef 100644 --- a/packages/redux-devtools-rtk-query-monitor/.eslintrc.js +++ b/packages/redux-devtools-rtk-query-monitor/.eslintrc.js @@ -8,6 +8,9 @@ module.exports = { tsconfigRootDir: __dirname, project: true, }, + rules: { + 'react/no-unknown-property': ['error', { ignore: ['css'] }], + }, }, { files: ['test/**/*.ts', 'test/**/*.tsx'], diff --git a/packages/redux-devtools-rtk-query-monitor/babel.config.esm.json b/packages/redux-devtools-rtk-query-monitor/babel.config.esm.json index d616aff2..df022b0e 100644 --- a/packages/redux-devtools-rtk-query-monitor/babel.config.esm.json +++ b/packages/redux-devtools-rtk-query-monitor/babel.config.esm.json @@ -2,7 +2,8 @@ "presets": [ ["@babel/preset-env", { "targets": "defaults", "modules": false }], "@babel/preset-react", - "@babel/preset-typescript" + "@babel/preset-typescript", + "@emotion/babel-preset-css-prop" ], "plugins": ["@babel/plugin-transform-runtime"] } diff --git a/packages/redux-devtools-rtk-query-monitor/babel.config.json b/packages/redux-devtools-rtk-query-monitor/babel.config.json index 814fca2b..053337b2 100644 --- a/packages/redux-devtools-rtk-query-monitor/babel.config.json +++ b/packages/redux-devtools-rtk-query-monitor/babel.config.json @@ -2,7 +2,8 @@ "presets": [ ["@babel/preset-env", { "targets": "defaults" }], "@babel/preset-react", - "@babel/preset-typescript" + "@babel/preset-typescript", + "@emotion/babel-preset-css-prop" ], "plugins": ["@babel/plugin-transform-runtime"] } diff --git a/packages/redux-devtools-rtk-query-monitor/demo/tsconfig.json b/packages/redux-devtools-rtk-query-monitor/demo/tsconfig.json index 420884ce..a9bce5ae 100644 --- a/packages/redux-devtools-rtk-query-monitor/demo/tsconfig.json +++ b/packages/redux-devtools-rtk-query-monitor/demo/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "resolveJsonModule": true }, - "include": ["../src", "src"] + "include": ["src"] } diff --git a/packages/redux-devtools-rtk-query-monitor/package.json b/packages/redux-devtools-rtk-query-monitor/package.json index ead4ab01..15ef7170 100644 --- a/packages/redux-devtools-rtk-query-monitor/package.json +++ b/packages/redux-devtools-rtk-query-monitor/package.json @@ -50,8 +50,6 @@ "@types/redux-devtools-themes": "^1.0.3", "hex-rgba": "^1.0.2", "immutable": "^4.3.4", - "jss": "^10.10.0", - "jss-preset-default": "^10.10.0", "lodash.debounce": "^4.0.8", "react-base16-styling": "^0.9.1", "react-json-tree": "^0.18.0", @@ -65,6 +63,8 @@ "@babel/preset-env": "^7.23.5", "@babel/preset-react": "^7.23.3", "@babel/preset-typescript": "^7.23.3", + "@emotion/babel-preset-css-prop": "^11.11.0", + "@emotion/react": "^11.11.1", "@redux-devtools/core": "^3.14.0", "@reduxjs/toolkit": "^1.9.7", "@testing-library/jest-dom": "^6.1.5", @@ -91,6 +91,7 @@ "typescript": "~5.3.3" }, "peerDependencies": { + "@emotion/react": "^11.0.0", "@redux-devtools/core": "^3.0.0", "@reduxjs/toolkit": "^1.0.0 || ^2.0.0", "@types/react": "^16.3.0 || ^17.0.0 || ^18.0.0", diff --git a/packages/redux-devtools-rtk-query-monitor/src/components/NoRtkQueryApi.tsx b/packages/redux-devtools-rtk-query-monitor/src/components/NoRtkQueryApi.tsx index f8c19f34..f48be2c6 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/components/NoRtkQueryApi.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/components/NoRtkQueryApi.tsx @@ -1,24 +1,31 @@ import React from 'react'; -import { StyleUtilsContext } from '../styles/createStylingFromTheme'; export function NoRtkQueryApi(): JSX.Element { return ( - - {({ styling }) => ( -
- No rtk-query api found. -
- Make sure to follow{' '} - - the instructions - - . -
- )} -
+
({ + width: '100%', + textAlign: 'center', + color: theme.TEXT_COLOR, + padding: '1.4em', + '& a': { + fontSize: 'inherit', + color: theme.TEXT_COLOR, + textDecoration: 'underline', + }, + })} + > + No rtk-query api found. +
+ Make sure to follow{' '} + + the instructions + + . +
); } diff --git a/packages/redux-devtools-rtk-query-monitor/src/components/QueryForm.tsx b/packages/redux-devtools-rtk-query-monitor/src/components/QueryForm.tsx index 1acdfcb3..b3656694 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/components/QueryForm.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/components/QueryForm.tsx @@ -1,8 +1,9 @@ import React, { ReactNode, FormEvent, MouseEvent, ChangeEvent } from 'react'; import type { DebouncedFunc } from 'lodash'; +import { css } from '@emotion/react'; import { Select } from '@redux-devtools/ui'; import { QueryFormValues } from '../types'; -import { StyleUtilsContext } from '../styles/createStylingFromTheme'; +import { StyleUtilsContext } from '../styles/themes'; import { SelectOption } from '../types'; import debounce from 'lodash.debounce'; import { sortQueryOptions, QueryComparators } from '../utils/comparators'; @@ -10,6 +11,17 @@ import { QueryFilters, filterQueryOptions } from '../utils/filters'; import { SortOrderButton } from './SortOrderButton'; import { RegexIcon } from './RegexIcon'; +const srOnlyCss = css({ + position: 'absolute', + width: 1, + height: 1, + padding: 0, + margin: '-1px', + overflow: 'hidden', + clip: 'rect(0,0,0,0)', + border: 0, +}); + export interface QueryFormProps { values: QueryFormValues; searchQueryRegex: RegExp | null; @@ -125,19 +137,68 @@ export class QueryForm extends React.PureComponent< return ( - {({ styling, base16Theme }) => { + {({ base16Theme }) => { return (
-
-