diff --git a/.changeset/empty-rockets-destroy.md b/.changeset/empty-rockets-destroy.md new file mode 100644 index 00000000000..c988264d35b --- /dev/null +++ b/.changeset/empty-rockets-destroy.md @@ -0,0 +1,8 @@ +--- +'@keystone-next/admin-ui-utils': major +'@keystone-next/auth': major +'@keystone-next/keystone': minor +'@keystone-next/fields-document': patch +--- + +Moved `@keystone-next/admin-ui-utils` to `@keystone-next/keystone/admin-ui/utils` diff --git a/packages/admin-ui-utils/package.json b/packages/admin-ui-utils/package.json index 9a0ba81f77b..0057581aee9 100644 --- a/packages/admin-ui-utils/package.json +++ b/packages/admin-ui-utils/package.json @@ -4,21 +4,6 @@ "main": "dist/admin-ui-utils.cjs.js", "module": "dist/admin-ui-utils.esm.js", "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.15.3", - "@emotion/weak-memoize": "^0.2.5", - "@keystone-next/types": "^24.0.0", - "@keystone-ui/core": "^3.1.1", - "@types/react": "^17.0.18", - "fast-deep-equal": "^3.1.3", - "graphql": "^15.5.1" - }, - "peerDependencies": { - "react": "^17.0.2" - }, - "devDependencies": { - "react": "^17.0.2" - }, "engines": { "node": "^12.20 || >= 14.13" }, diff --git a/packages/admin-ui-utils/src/index.ts b/packages/admin-ui-utils/src/index.ts index 98ff24e461c..316949451f5 100644 --- a/packages/admin-ui-utils/src/index.ts +++ b/packages/admin-ui-utils/src/index.ts @@ -1,6 +1,5 @@ -export * from './dataGetter'; -export * from './Fields'; -export * from './getRootGraphQLFieldsFromFieldController'; -export * from './item-form'; -export * from './serialization'; -export * from './useInvalidFields'; +throw new Error( + '`@keystone-next/admin-ui-utils` has been moved to `@keystone-next/keystone/admin-ui/utils`, please import from there instead.' +); + +export {}; diff --git a/packages/auth/package.json b/packages/auth/package.json index 64f4d2486c8..a59a20ccc09 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -10,7 +10,6 @@ "dependencies": { "@babel/runtime": "^7.15.3", "@graphql-tools/schema": "^8.1.1", - "@keystone-next/admin-ui-utils": "^5.0.6", "@keystone-next/types": "^24.0.0", "@keystone-ui/button": "^5.0.0", "@keystone-ui/core": "^3.1.1", diff --git a/packages/auth/src/pages/InitPage.tsx b/packages/auth/src/pages/InitPage.tsx index 57e6dc22c2a..fae7e9e9ffc 100644 --- a/packages/auth/src/pages/InitPage.tsx +++ b/packages/auth/src/pages/InitPage.tsx @@ -18,7 +18,7 @@ import { Fields, serializeValueToObjByFieldKey, useInvalidFields, -} from '@keystone-next/admin-ui-utils'; +} from '@keystone-next/keystone/admin-ui/utils'; import { guessEmailFromValue, validEmail } from '../lib/emailHeuristics'; import { IconTwitter, IconGithub } from '../components/Icons'; import { SigninContainer } from '../components/SigninContainer'; diff --git a/packages/fields-document/package.json b/packages/fields-document/package.json index 1adbe980bec..54cda35faec 100644 --- a/packages/fields-document/package.json +++ b/packages/fields-document/package.json @@ -22,7 +22,6 @@ "@babel/runtime": "^7.15.3", "@braintree/sanitize-url": "^5.0.2", "@emotion/weak-memoize": "^0.2.5", - "@keystone-next/admin-ui-utils": "^5.0.6", "@keystone-next/keystone": "^24.0.0", "@keystone-next/types": "^24.0.0", "@keystone-ui/button": "^5.0.0", diff --git a/packages/keystone/admin-ui/utils/package.json b/packages/keystone/admin-ui/utils/package.json new file mode 100644 index 00000000000..6cbbe144d0c --- /dev/null +++ b/packages/keystone/admin-ui/utils/package.json @@ -0,0 +1,4 @@ +{ + "main": "dist/keystone.cjs.js", + "module": "dist/keystone.esm.js" +} diff --git a/packages/keystone/package.json b/packages/keystone/package.json index 47fbea7e36e..5db3921cf39 100644 --- a/packages/keystone/package.json +++ b/packages/keystone/package.json @@ -29,9 +29,9 @@ "@babel/plugin-transform-modules-commonjs": "^7.15.0", "@babel/runtime": "^7.15.3", "@emotion/hash": "^0.8.0", + "@emotion/weak-memoize": "^0.2.5", "@graphql-tools/schema": "^8.1.1", "@hapi/iron": "^6.0.0", - "@keystone-next/admin-ui-utils": "^5.0.6", "@keystone-next/types": "^24.0.0", "@keystone-next/utils": "^1.0.4", "@keystone-ui/button": "^5.0.0", @@ -151,6 +151,7 @@ "admin-ui/context.tsx", "admin-ui/router.tsx", "admin-ui/image.tsx", + "admin-ui/utils/index.ts", "fields/index.ts", "fields/types/*/views/index.tsx", "fields/types/relationship/views/RelationshipSelect.tsx" diff --git a/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/HomePage/index.tsx b/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/HomePage/index.tsx index a7d1c4830f3..782e58b04cd 100644 --- a/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/HomePage/index.tsx +++ b/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/HomePage/index.tsx @@ -3,11 +3,11 @@ import { ButtonHTMLAttributes, useMemo, useState } from 'react'; import { Center, Inline, Heading, VisuallyHidden, jsx, useTheme } from '@keystone-ui/core'; -import { makeDataGetter } from '@keystone-next/admin-ui-utils'; import { PlusIcon } from '@keystone-ui/icons/icons/PlusIcon'; import { DrawerController } from '@keystone-ui/modals'; import { LoadingDots } from '@keystone-ui/loading'; +import { makeDataGetter } from '../../../../admin-ui/utils'; import { CreateItemDrawer } from '../../../../admin-ui/components/CreateItemDrawer'; import { PageContainer, HEADER_HEIGHT } from '../../../../admin-ui/components/PageContainer'; import { gql, useQuery } from '../../../../admin-ui/apollo'; diff --git a/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ItemPage/index.tsx b/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ItemPage/index.tsx index a49288a34c7..27aad5541dc 100644 --- a/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ItemPage/index.tsx +++ b/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ItemPage/index.tsx @@ -35,7 +35,7 @@ import { useInvalidFields, Fields, useChangedFieldsAndDataForUpdate, -} from '@keystone-next/admin-ui-utils'; +} from '../../../../admin-ui/utils'; import { gql, useMutation, useQuery } from '../../../../admin-ui/apollo'; import { useList } from '../../../../admin-ui/context'; diff --git a/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ListPage/index.tsx b/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ListPage/index.tsx index 172f61fb01e..4d1c517cd78 100644 --- a/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ListPage/index.tsx +++ b/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ListPage/index.tsx @@ -16,7 +16,7 @@ import { DataGetter, DeepNullable, makeDataGetter, -} from '@keystone-next/admin-ui-utils'; +} from '../../../../admin-ui/utils'; import { gql, TypedDocumentNode, useMutation, useQuery } from '../../../../admin-ui/apollo'; import { CellLink } from '../../../../admin-ui/components'; import { CreateItemDrawer } from '../../../../admin-ui/components/CreateItemDrawer'; diff --git a/packages/admin-ui-utils/src/Fields.tsx b/packages/keystone/src/admin-ui/utils/Fields.tsx similarity index 100% rename from packages/admin-ui-utils/src/Fields.tsx rename to packages/keystone/src/admin-ui/utils/Fields.tsx diff --git a/packages/admin-ui-utils/src/dataGetter.ts b/packages/keystone/src/admin-ui/utils/dataGetter.ts similarity index 100% rename from packages/admin-ui-utils/src/dataGetter.ts rename to packages/keystone/src/admin-ui/utils/dataGetter.ts diff --git a/packages/admin-ui-utils/src/getRootGraphQLFieldsFromFieldController.ts b/packages/keystone/src/admin-ui/utils/getRootGraphQLFieldsFromFieldController.ts similarity index 100% rename from packages/admin-ui-utils/src/getRootGraphQLFieldsFromFieldController.ts rename to packages/keystone/src/admin-ui/utils/getRootGraphQLFieldsFromFieldController.ts diff --git a/packages/keystone/src/admin-ui/utils/index.ts b/packages/keystone/src/admin-ui/utils/index.ts new file mode 100644 index 00000000000..98ff24e461c --- /dev/null +++ b/packages/keystone/src/admin-ui/utils/index.ts @@ -0,0 +1,6 @@ +export * from './dataGetter'; +export * from './Fields'; +export * from './getRootGraphQLFieldsFromFieldController'; +export * from './item-form'; +export * from './serialization'; +export * from './useInvalidFields'; diff --git a/packages/admin-ui-utils/src/item-form.ts b/packages/keystone/src/admin-ui/utils/item-form.ts similarity index 100% rename from packages/admin-ui-utils/src/item-form.ts rename to packages/keystone/src/admin-ui/utils/item-form.ts diff --git a/packages/admin-ui-utils/src/serialization.tsx b/packages/keystone/src/admin-ui/utils/serialization.tsx similarity index 100% rename from packages/admin-ui-utils/src/serialization.tsx rename to packages/keystone/src/admin-ui/utils/serialization.tsx diff --git a/packages/admin-ui-utils/src/useInvalidFields.ts b/packages/keystone/src/admin-ui/utils/useInvalidFields.ts similarity index 100% rename from packages/admin-ui-utils/src/useInvalidFields.ts rename to packages/keystone/src/admin-ui/utils/useInvalidFields.ts diff --git a/packages/keystone/src/admin-ui/utils/useLazyMetadata.tsx b/packages/keystone/src/admin-ui/utils/useLazyMetadata.tsx index 3c8f10e9954..3e0c110a8af 100644 --- a/packages/keystone/src/admin-ui/utils/useLazyMetadata.tsx +++ b/packages/keystone/src/admin-ui/utils/useLazyMetadata.tsx @@ -1,8 +1,8 @@ import { GraphQLError } from 'graphql'; import type { AuthenticatedItem, VisibleLists, CreateViewFieldModes } from '@keystone-next/types'; import { useMemo } from 'react'; -import { DeepNullable, makeDataGetter } from '@keystone-next/admin-ui-utils'; import { DocumentNode, useQuery, QueryResult, ServerError, ServerParseError } from '../apollo'; +import { DeepNullable, makeDataGetter } from './dataGetter'; export type { AuthenticatedItem, VisibleLists, CreateViewFieldModes } from '@keystone-next/types'; diff --git a/packages/keystone/src/fields/types/relationship/views/cards/InlineCreate.tsx b/packages/keystone/src/fields/types/relationship/views/cards/InlineCreate.tsx index b4c6d2b90d6..0f2afcc541e 100644 --- a/packages/keystone/src/fields/types/relationship/views/cards/InlineCreate.tsx +++ b/packages/keystone/src/fields/types/relationship/views/cards/InlineCreate.tsx @@ -4,6 +4,8 @@ import { useState } from 'react'; import { jsx, Stack } from '@keystone-ui/core'; import isDeepEqual from 'fast-deep-equal'; import { useToasts } from '@keystone-ui/toast'; +import { Button } from '@keystone-ui/button'; +import { ListMeta } from '@keystone-next/types'; import { ItemData, makeDataGetter, @@ -11,10 +13,8 @@ import { Value, useInvalidFields, serializeValueToObjByFieldKey, -} from '@keystone-next/admin-ui-utils'; -import { Button } from '@keystone-ui/button'; -import { ListMeta } from '@keystone-next/types'; -import { Fields } from '@keystone-next/admin-ui-utils'; + Fields, +} from '../../../../../admin-ui/utils'; import { gql, useMutation } from '../../../../../admin-ui/apollo'; import { GraphQLErrorNotice } from '../../../../../admin-ui/components'; import { useFieldsObj } from './useItemState'; diff --git a/packages/keystone/src/fields/types/relationship/views/cards/InlineEdit.tsx b/packages/keystone/src/fields/types/relationship/views/cards/InlineEdit.tsx index 37c64e9473f..ba14368b595 100644 --- a/packages/keystone/src/fields/types/relationship/views/cards/InlineEdit.tsx +++ b/packages/keystone/src/fields/types/relationship/views/cards/InlineEdit.tsx @@ -1,5 +1,11 @@ /** @jsx jsx */ +import { ListMeta } from '@keystone-next/types'; +import { Button } from '@keystone-ui/button'; +import { jsx, Stack } from '@keystone-ui/core'; +import { useToasts } from '@keystone-ui/toast'; +import { useCallback, useState } from 'react'; +import { Tooltip } from '@keystone-ui/tooltip'; import { deserializeValue, ItemData, @@ -8,13 +14,7 @@ import { useChangedFieldsAndDataForUpdate, makeDataGetter, DataGetter, -} from '@keystone-next/admin-ui-utils'; -import { ListMeta } from '@keystone-next/types'; -import { Button } from '@keystone-ui/button'; -import { jsx, Stack } from '@keystone-ui/core'; -import { useToasts } from '@keystone-ui/toast'; -import { useCallback, useState } from 'react'; -import { Tooltip } from '@keystone-ui/tooltip'; +} from '../../../../../admin-ui/utils'; import { gql, useMutation } from '../../../../../admin-ui/apollo'; import { GraphQLErrorNotice } from '../../../../../admin-ui/components'; import { useFieldsObj } from './useItemState'; diff --git a/packages/keystone/src/fields/types/relationship/views/cards/index.tsx b/packages/keystone/src/fields/types/relationship/views/cards/index.tsx index d7da2c4b576..28456a8230f 100644 --- a/packages/keystone/src/fields/types/relationship/views/cards/index.tsx +++ b/packages/keystone/src/fields/types/relationship/views/cards/index.tsx @@ -17,11 +17,11 @@ import { FieldProps, ListMeta } from '@keystone-next/types'; import { Button } from '@keystone-ui/button'; import { Tooltip } from '@keystone-ui/tooltip'; import { LoadingDots } from '@keystone-ui/loading'; +import { useEffect, useRef, useState } from 'react'; import { getRootGraphQLFieldsFromFieldController, makeDataGetter, -} from '@keystone-next/admin-ui-utils'; -import { useEffect, useRef, useState } from 'react'; +} from '../../../../../admin-ui/utils'; import { Link } from '../../../../../admin-ui/router'; import { gql, useApolloClient } from '../../../../../admin-ui/apollo'; import { controller } from '../index'; diff --git a/packages/keystone/src/fields/types/relationship/views/cards/useItemState.tsx b/packages/keystone/src/fields/types/relationship/views/cards/useItemState.tsx index e814b263426..18031514e67 100644 --- a/packages/keystone/src/fields/types/relationship/views/cards/useItemState.tsx +++ b/packages/keystone/src/fields/types/relationship/views/cards/useItemState.tsx @@ -1,6 +1,6 @@ import { FieldMeta, ListMeta } from '@keystone-next/types'; import { useCallback, useMemo, useState } from 'react'; -import { DataGetter, makeDataGetter } from '@keystone-next/admin-ui-utils'; +import { DataGetter, makeDataGetter } from '../../../../../admin-ui/utils'; import { gql, useQuery } from '../../../../../admin-ui/apollo'; import { controller } from '../index';