diff --git a/.eslintrc.json b/.eslintrc.json index 63f61a55d..e82d306c2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -190,7 +190,7 @@ "no-restricted-imports": [ "error", { - "paths": ["lodash", "@material-ui/icons/Delete"] + "paths": ["lodash", "@material-ui/icons/Delete", "classnames"] } ] }, diff --git a/package-lock.json b/package-lock.json index 98ecadee2..cf1ffc020 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "@uiw/react-color-material": "^0.1.0", "@uiw/react-color-saturation": "0.0.34", "apollo-upload-client": "^17.0.0", - "classnames": "^2.2.6", + "clsx": "^1.2.1", "color-convert": "^2.0.1", "crc-32": "^1.2.0", "currency-codes": "^2.1.0", @@ -113,7 +113,6 @@ "@testing-library/react": "^12.1.5", "@testing-library/react-hooks": "^8.0.1", "@types/apollo-upload-client": "^17.0.0", - "@types/classnames": "^2.2.9", "@types/color-convert": "^2.0.0", "@types/enzyme": "^3.10.8", "@types/fuzzaldrin": "^2.1.2", @@ -8247,12 +8246,6 @@ "@types/node": "*" } }, - "node_modules/@types/classnames": { - "version": "2.2.11", - "resolved": "https://registry.npmjs.org/@types/classnames/-/classnames-2.2.11.tgz", - "integrity": "sha512-2koNhpWm3DgWRp5tpkiJ8JGc1xTn2q0l+jUNUE7oMKXUf5NpI9AIdC4kbjGNFBdHtcxBD18LAksoudAVhFKCjw==", - "dev": true - }, "node_modules/@types/color-convert": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@types/color-convert/-/color-convert-2.0.0.tgz", @@ -13863,9 +13856,9 @@ } }, "node_modules/clsx": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz", - "integrity": "sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", + "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==", "engines": { "node": ">=6" } @@ -45989,12 +45982,6 @@ "@types/node": "*" } }, - "@types/classnames": { - "version": "2.2.11", - "resolved": "https://registry.npmjs.org/@types/classnames/-/classnames-2.2.11.tgz", - "integrity": "sha512-2koNhpWm3DgWRp5tpkiJ8JGc1xTn2q0l+jUNUE7oMKXUf5NpI9AIdC4kbjGNFBdHtcxBD18LAksoudAVhFKCjw==", - "dev": true - }, "@types/color-convert": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@types/color-convert/-/color-convert-2.0.0.tgz", @@ -50701,9 +50688,9 @@ } }, "clsx": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz", - "integrity": "sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", + "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==" }, "co": { "version": "4.6.0", diff --git a/package.json b/package.json index df442dfdf..f20a85d61 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@uiw/react-color-material": "^0.1.0", "@uiw/react-color-saturation": "0.0.34", "apollo-upload-client": "^17.0.0", - "classnames": "^2.2.6", + "clsx": "^1.2.1", "color-convert": "^2.0.1", "crc-32": "^1.2.0", "currency-codes": "^2.1.0", @@ -120,7 +120,6 @@ "@testing-library/react": "^12.1.5", "@testing-library/react-hooks": "^8.0.1", "@types/apollo-upload-client": "^17.0.0", - "@types/classnames": "^2.2.9", "@types/color-convert": "^2.0.0", "@types/enzyme": "^3.10.8", "@types/fuzzaldrin": "^2.1.2", diff --git a/src/apps/components/AppInstallPage/AppInstallPage.tsx b/src/apps/components/AppInstallPage/AppInstallPage.tsx index 9bbcdacce..4f8946c61 100644 --- a/src/apps/components/AppInstallPage/AppInstallPage.tsx +++ b/src/apps/components/AppInstallPage/AppInstallPage.tsx @@ -10,7 +10,7 @@ import Skeleton from "@saleor/components/Skeleton"; import { AppFetchMutation, AppInstallMutation } from "@saleor/graphql"; import { SubmitPromise } from "@saleor/hooks/useForm"; import { buttonMessages } from "@saleor/intl"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; @@ -60,10 +60,7 @@ export const AppInstallPage: React.FC = ({ ) : (
diff --git a/src/apps/components/AppPage/AppPage.tsx b/src/apps/components/AppPage/AppPage.tsx index 43a3908af..4559585b5 100644 --- a/src/apps/components/AppPage/AppPage.tsx +++ b/src/apps/components/AppPage/AppPage.tsx @@ -8,7 +8,7 @@ import Grid from "@saleor/components/Grid"; import Hr from "@saleor/components/Hr"; import { AppQuery } from "@saleor/graphql"; import { sectionNames } from "@saleor/intl"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; @@ -44,10 +44,7 @@ export const AppPage: React.FC = ({
{data?.name} diff --git a/src/apps/components/AppsInProgress/AppsInProgress.tsx b/src/apps/components/AppsInProgress/AppsInProgress.tsx index c6e24c1cc..442478450 100644 --- a/src/apps/components/AppsInProgress/AppsInProgress.tsx +++ b/src/apps/components/AppsInProgress/AppsInProgress.tsx @@ -19,7 +19,7 @@ import { TooltipMountWrapper, } from "@saleor/macaw-ui"; import { renderCollection } from "@saleor/misc"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; @@ -58,10 +58,7 @@ const AppsInProgress: React.FC = ({ {status === JobStatusEnum.PENDING && ( = ({ )} {status === JobStatusEnum.FAILED && ( { return ( diff --git a/src/components/Accordion/Accordion.tsx b/src/components/Accordion/Accordion.tsx index f12e4ca01..675335aee 100644 --- a/src/components/Accordion/Accordion.tsx +++ b/src/components/Accordion/Accordion.tsx @@ -2,7 +2,7 @@ import { Typography } from "@material-ui/core"; import AddIcon from "@material-ui/icons/Add"; import RemoveIcon from "@material-ui/icons/Remove"; import { IconButton, makeStyles } from "@saleor/macaw-ui"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import Hr from "../Hr"; @@ -54,7 +54,7 @@ const Accordion: React.FC = ({ const [expanded, setExpanded] = React.useState(!!initialExpand); return ( -
+
{title}
diff --git a/src/components/AppLayout/AppLayout.tsx b/src/components/AppLayout/AppLayout.tsx index e8bf3521f..74328c14d 100644 --- a/src/components/AppLayout/AppLayout.tsx +++ b/src/components/AppLayout/AppLayout.tsx @@ -11,7 +11,7 @@ import { useTheme, } from "@saleor/macaw-ui"; import { isDarkTheme } from "@saleor/misc"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import { useIntl } from "react-intl"; import useRouter from "use-react-router"; @@ -212,7 +212,7 @@ const AppLayout: React.FC = ({
diff --git a/src/components/AssignAttributeDialog/AssignAttributeDialog.tsx b/src/components/AssignAttributeDialog/AssignAttributeDialog.tsx index 1aa0662c7..6b1d3db69 100644 --- a/src/components/AssignAttributeDialog/AssignAttributeDialog.tsx +++ b/src/components/AssignAttributeDialog/AssignAttributeDialog.tsx @@ -24,7 +24,7 @@ import useSearchQuery from "@saleor/hooks/useSearchQuery"; import { ConfirmButtonTransitionState, makeStyles } from "@saleor/macaw-ui"; import { maybe, renderCollection } from "@saleor/misc"; import { FetchMoreProps } from "@saleor/types"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import InfiniteScroll from "react-infinite-scroll-component"; import { FormattedMessage, useIntl } from "react-intl"; @@ -212,7 +212,7 @@ const AssignAttributeDialog: React.FC = ({ )} diff --git a/src/components/Attributes/Attributes.tsx b/src/components/Attributes/Attributes.tsx index 16df44ed9..b85f51f7a 100644 --- a/src/components/Attributes/Attributes.tsx +++ b/src/components/Attributes/Attributes.tsx @@ -15,7 +15,7 @@ import { FormsetAtomicData } from "@saleor/hooks/useFormset"; import { ChevronIcon, IconButton, makeStyles } from "@saleor/macaw-ui"; import { FetchMoreProps } from "@saleor/types"; import { RichTextGetters } from "@saleor/utils/richText/useMultipleRichText"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import { defineMessages, FormattedMessage, useIntl } from "react-intl"; @@ -154,7 +154,7 @@ const Attributes: React.FC = ({ data-test-id="attributes-expand" > diff --git a/src/components/Attributes/BasicAttributeRow.tsx b/src/components/Attributes/BasicAttributeRow.tsx index 66598732d..2aeb9126e 100644 --- a/src/components/Attributes/BasicAttributeRow.tsx +++ b/src/components/Attributes/BasicAttributeRow.tsx @@ -2,7 +2,7 @@ import { Typography } from "@material-ui/core"; import HelpOutline from "@material-ui/icons/HelpOutline"; import Grid from "@saleor/components/Grid"; import { Tooltip } from "@saleor/macaw-ui"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import { useBasicAttributeStyles } from "./styles"; @@ -38,7 +38,7 @@ const BasicAttributeRow: React.FC = ({
diff --git a/src/components/CardMenu/CardMenu.tsx b/src/components/CardMenu/CardMenu.tsx index 4928555e7..12c50a606 100644 --- a/src/components/CardMenu/CardMenu.tsx +++ b/src/components/CardMenu/CardMenu.tsx @@ -9,7 +9,7 @@ import { Typography, } from "@material-ui/core"; import { IconButtonProps, makeStyles, SettingsIcon } from "@saleor/macaw-ui"; -import classNames from "classnames"; +import clsx from "clsx"; import React, { useEffect, useRef, useState } from "react"; import { FormattedMessage } from "react-intl"; @@ -180,7 +180,7 @@ const CardMenu: React.FC = props => { button >
diff --git a/src/components/ChannelsAvailabilityCard/Channel/ChannelAvailabilityItemContent.tsx b/src/components/ChannelsAvailabilityCard/Channel/ChannelAvailabilityItemContent.tsx index cdce35a23..1b7b2747b 100644 --- a/src/components/ChannelsAvailabilityCard/Channel/ChannelAvailabilityItemContent.tsx +++ b/src/components/ChannelsAvailabilityCard/Channel/ChannelAvailabilityItemContent.tsx @@ -6,7 +6,7 @@ import RadioSwitchField from "@saleor/components/RadioSwitchField"; import useCurrentDate from "@saleor/hooks/useCurrentDate"; import useDateLocalize from "@saleor/hooks/useDateLocalize"; import { getFormErrors, getProductErrorMessage } from "@saleor/utils/errors"; -import classNames from "classnames"; +import clsx from "clsx"; import React, { useState } from "react"; import { useIntl } from "react-intl"; @@ -244,7 +244,7 @@ const ChannelContent: React.FC = ({ disabled={disabled} label={ <> -

+

{intl.formatMessage(availabilityItemMessages.hideInListings)}

diff --git a/src/components/Chip/Chip.tsx b/src/components/Chip/Chip.tsx index 107ff3484..87c6538c3 100644 --- a/src/components/Chip/Chip.tsx +++ b/src/components/Chip/Chip.tsx @@ -2,7 +2,7 @@ import { Typography } from "@material-ui/core"; import { alpha } from "@material-ui/core/styles"; import CloseIcon from "@material-ui/icons/Close"; import { makeStyles } from "@saleor/macaw-ui"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; export interface ChipProps { @@ -38,7 +38,7 @@ const Chip: React.FC = props => { const classes = useStyles(props); return ( -
+
{label} {onClose && ( diff --git a/src/components/ColumnPicker/ColumnPickerButton.tsx b/src/components/ColumnPicker/ColumnPickerButton.tsx index 314ce3b90..2dd1c5feb 100644 --- a/src/components/ColumnPicker/ColumnPickerButton.tsx +++ b/src/components/ColumnPicker/ColumnPickerButton.tsx @@ -2,7 +2,7 @@ import { alpha } from "@material-ui/core/styles"; import ArrowDropDownIcon from "@material-ui/icons/ArrowDropDown"; import { Button } from "@saleor/components/Button"; import { makeStyles } from "@saleor/macaw-ui"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import { FormattedMessage } from "react-intl"; @@ -42,7 +42,7 @@ const ColumnPickerButton: React.FC = props => { return ( } /> - + = ({ onClick={() => setExpanded(!expanded)} > diff --git a/src/staff/components/StaffList/StaffList.tsx b/src/staff/components/StaffList/StaffList.tsx index 9d97b870f..e47e574e7 100644 --- a/src/staff/components/StaffList/StaffList.tsx +++ b/src/staff/components/StaffList/StaffList.tsx @@ -24,7 +24,7 @@ import { } from "@saleor/staff/urls"; import { ListProps, RelayToFlat, SortPage } from "@saleor/types"; import { getArrowDirection } from "@saleor/utils/sort"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; @@ -141,7 +141,7 @@ const StaffList: React.FC = props => { staffMembers, staffMember => ( = ({ {items.find(({ value }) => value === selectedId)?.label || "-"} diff --git a/src/translations/components/TranslationFields/TranslationFields.tsx b/src/translations/components/TranslationFields/TranslationFields.tsx index 2b99f7845..ad86561b3 100644 --- a/src/translations/components/TranslationFields/TranslationFields.tsx +++ b/src/translations/components/TranslationFields/TranslationFields.tsx @@ -19,7 +19,7 @@ import { TranslationFieldType, } from "@saleor/translations/types"; import { ListProps } from "@saleor/types"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import { FormattedMessage } from "react-intl"; @@ -145,7 +145,7 @@ const TranslationFields: React.FC = props => { onClick={() => setExpandedState(!expanded)} > diff --git a/src/translations/components/TranslationsEntitiesList/TranslationsEntitiesList.tsx b/src/translations/components/TranslationsEntitiesList/TranslationsEntitiesList.tsx index 95d47b147..f9e6bf3f0 100644 --- a/src/translations/components/TranslationsEntitiesList/TranslationsEntitiesList.tsx +++ b/src/translations/components/TranslationsEntitiesList/TranslationsEntitiesList.tsx @@ -9,7 +9,7 @@ import Skeleton from "@saleor/components/Skeleton"; import { TablePaginationWithContext } from "@saleor/components/TablePagination"; import TableRowLink from "@saleor/components/TableRowLink"; import { makeStyles } from "@saleor/macaw-ui"; -import classNames from "classnames"; +import clsx from "clsx"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; @@ -79,7 +79,7 @@ const TranslationsEntitiesList: React.FC = props entities, entity => ( = ({ {intl.formatMessage(commonMessages.status)} - + @@ -81,7 +79,7 @@ const WebhooksList: React.FC = ({ key={webhook ? webhook.id : "skeleton"} > @@ -106,7 +104,7 @@ const WebhooksList: React.FC = ({ )}