diff --git a/cypress/utils/steps.ts b/cypress/utils/steps.ts index 527c4de61..ef3561eab 100644 --- a/cypress/utils/steps.ts +++ b/cypress/utils/steps.ts @@ -1,5 +1,5 @@ import 'cypress-real-events'; -import format from 'date-fns/format'; +import { format } from 'date-fns/format'; import { editorStatus, notifications, publishTypes, workflowStatus } from './constants'; diff --git a/lerna.json b/lerna.json index f71b982db..69e41d2a2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,4 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "4.2.0" + "version": "4.3.0" } diff --git a/packages/app/package.json b/packages/app/package.json index e88707846..a9d148dcd 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@staticcms/app", - "version": "4.2.0", + "version": "4.3.0", "license": "MIT", "description": "Static CMS application.", "repository": "https://github.com/StaticJsCMS/static-cms", @@ -39,7 +39,7 @@ "dependencies": { "@babel/eslint-parser": "7.23.3", "@babel/runtime": "7.23.7", - "@staticcms/core": "^4.2.0", + "@staticcms/core": "^4.3.0", "buffer": "6.0.3", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/packages/core/dev-test/config.yml b/packages/core/dev-test/config.yml index 4129b4274..bc894da87 100644 --- a/packages/core/dev-test/config.yml +++ b/packages/core/dev-test/config.yml @@ -19,6 +19,10 @@ i18n: # Optional, defaults to the first item in locales. # The locale to be used for fields validation and as a baseline for the entry. default_locale: en + + # Optional, defaults to true. + # Enforce required fields in non-default locales + enforce_required_non_default: true collections: - name: posts label: Posts diff --git a/packages/core/package.json b/packages/core/package.json index f88527f33..2d2a5191b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@staticcms/core", - "version": "4.2.0", + "version": "4.3.0", "license": "MIT", "description": "Static CMS core application.", "repository": "https://github.com/StaticJsCMS/static-cms", @@ -71,7 +71,7 @@ "@mui/base": "5.0.0-beta.30", "@mui/material": "5.15.3", "@mui/system": "5.15.3", - "@mui/x-date-pickers": "6.18.6", + "@mui/x-date-pickers": "7.3.1", "@reduxjs/toolkit": "1.9.7", "@styled-icons/bootstrap": "10.47.0", "@styled-icons/fa-brands": "10.47.0", @@ -97,7 +97,7 @@ "common-tags": "1.8.2", "copy-text-to-clipboard": "3.2.0", "create-react-class": "15.7.0", - "date-fns": "2.30.0", + "date-fns": "3.6.0", "deepmerge": "4.3.1", "diacritics": "1.3.0", "escape-html": "1.0.3", diff --git a/packages/core/src/actions/__tests__/config.spec.ts b/packages/core/src/actions/__tests__/config.spec.ts index 3b8958b03..626746af7 100644 --- a/packages/core/src/actions/__tests__/config.spec.ts +++ b/packages/core/src/actions/__tests__/config.spec.ts @@ -697,7 +697,12 @@ describe('config', () => { }, ], }).collections[0].i18n, - ).toEqual({ structure: 'multiple_folders', locales: ['en', 'de'], default_locale: 'en' }); + ).toEqual({ + structure: 'multiple_folders', + locales: ['en', 'de'], + default_locale: 'en', + enforce_required_non_default: true, + }); }); it('should not set root i18n on collection when collection i18n is not set', () => { @@ -757,7 +762,12 @@ describe('config', () => { }, ], }).collections[0].i18n, - ).toEqual({ structure: 'multiple_folders', locales: ['en', 'fr'], default_locale: 'fr' }); + ).toEqual({ + structure: 'multiple_folders', + locales: ['en', 'fr'], + default_locale: 'fr', + enforce_required_non_default: true, + }); }); it('should throw when i18n structure is not single_file on files collection', () => { diff --git a/packages/core/src/actions/config.ts b/packages/core/src/actions/config.ts index 39e48a9d9..1d87c91c8 100644 --- a/packages/core/src/actions/config.ts +++ b/packages/core/src/actions/config.ts @@ -92,17 +92,24 @@ function setI18nField(field: T) { function getI18nDefaults( collectionOrFileI18n: boolean | Partial, - { default_locale, locales = ['en'], structure = I18N_STRUCTURE_SINGLE_FILE }: Partial, + { + default_locale, + locales = ['en'], + structure = I18N_STRUCTURE_SINGLE_FILE, + enforce_required_non_default = true, + }: Partial, ): I18nInfo { if (typeof collectionOrFileI18n === 'boolean') { - return { default_locale, locales, structure }; + return { default_locale, locales, structure, enforce_required_non_default }; } else { const mergedI18n: I18nInfo = deepmerge( - { default_locale, locales, structure }, + { default_locale, locales, structure, enforce_required_non_default }, collectionOrFileI18n, ); mergedI18n.locales = collectionOrFileI18n.locales ?? locales; mergedI18n.default_locale = collectionOrFileI18n.default_locale || locales?.[0]; + mergedI18n.enforce_required_non_default = + collectionOrFileI18n.enforce_required_non_default || true; throwOnMissingDefaultLocale(mergedI18n); return mergedI18n; } @@ -202,6 +209,7 @@ function applyCollectionFileDefaults( locales: collectionI18n.locales, default_locale: collectionI18n.default_locale, structure: collectionI18n.structure, + enforce_required_non_default: collectionI18n.enforce_required_non_default, }); file.i18n = fileI18n; } else { @@ -315,6 +323,7 @@ export function applyDefaults( if (i18n) { i18n.default_locale = i18n.default_locale ?? i18n.locales[0]; + i18n.enforce_required_non_default = i18n.enforce_required_non_default ?? true; } throwOnMissingDefaultLocale(i18n); diff --git a/packages/core/src/backends/test/implementation.ts b/packages/core/src/backends/test/implementation.ts index be2a1282a..fe854bbef 100644 --- a/packages/core/src/backends/test/implementation.ts +++ b/packages/core/src/backends/test/implementation.ts @@ -1,6 +1,7 @@ import attempt from 'lodash/attempt'; import isError from 'lodash/isError'; import take from 'lodash/take'; +import trim from 'lodash/trim'; import unset from 'lodash/unset'; import { basename, dirname } from 'path'; import { v4 as uuid } from 'uuid'; @@ -15,7 +16,6 @@ import { isNotEmpty } from '@staticcms/core/lib/util/string.util'; import AssetProxy from '@staticcms/core/valueObjects/AssetProxy'; import AuthenticationPage from './AuthenticationPage'; -import type { WorkflowStatus } from '@staticcms/core/constants/publishModes'; import type { BackendClass, BackendEntry, @@ -29,6 +29,7 @@ import type { UnpublishedEntry, User, } from '@staticcms/core'; +import type { WorkflowStatus } from '@staticcms/core/constants/publishModes'; type RepoFile = { path: string; content: string | AssetProxy; isDirectory?: boolean }; type RepoTree = { [key: string]: RepoFile | RepoTree }; @@ -289,14 +290,14 @@ export default class TestBackend implements BackendClass { } const files = getFolderFiles( window.repoFiles, - mediaFolder.split('/')[0], + trim(mediaFolder, '/').split('/')[0], '', 100, undefined, undefined, folderSupport, ).filter(f => { - return dirname(f.path) === mediaFolder; + return dirname(f.path) === trim(mediaFolder, '/'); }); return files.map(f => ({ diff --git a/packages/core/src/components/collections/Collection.classes.ts b/packages/core/src/components/collections/Collection.classes.ts index 5a8ad50e8..6cad0207f 100644 --- a/packages/core/src/components/collections/Collection.classes.ts +++ b/packages/core/src/components/collections/Collection.classes.ts @@ -12,6 +12,7 @@ const collectionClasses = generateClassNames('Collection', [ 'header-icon', 'header-label', 'new-entry-button', + 'new-entry-button-text', ]); export default collectionClasses; diff --git a/packages/core/src/components/collections/Collection.css b/packages/core/src/components/collections/Collection.css index f751d38eb..ea5c82a68 100644 --- a/packages/core/src/components/collections/Collection.css +++ b/packages/core/src/components/collections/Collection.css @@ -83,5 +83,10 @@ .CMS_Collection_new-entry-button { @apply hidden - md:flex; + md:flex + min-w-0; +} + +.CMS_Collection_new-entry-button-text { + @apply truncate; } diff --git a/packages/core/src/components/collections/CollectionHeader.tsx b/packages/core/src/components/collections/CollectionHeader.tsx index 220c91738..c02c8df34 100644 --- a/packages/core/src/components/collections/CollectionHeader.tsx +++ b/packages/core/src/components/collections/CollectionHeader.tsx @@ -76,9 +76,11 @@ const CollectionHeader: FC = ({ collection }) => { {newEntryUrl ? ( ) : null} diff --git a/packages/core/src/components/collections/entries/EntryCard.tsx b/packages/core/src/components/collections/entries/EntryCard.tsx index f906f4800..c75afa68b 100644 --- a/packages/core/src/components/collections/entries/EntryCard.tsx +++ b/packages/core/src/components/collections/entries/EntryCard.tsx @@ -1,6 +1,6 @@ import { Info as InfoIcon } from '@styled-icons/material-outlined/Info'; -import format from 'date-fns/format'; -import parse from 'date-fns/parse'; +import { format } from 'date-fns/format'; +import { parse } from 'date-fns/parse'; import React, { useEffect, useMemo, useState } from 'react'; import useTranslate from '@staticcms/core/lib/hooks/useTranslate'; diff --git a/packages/core/src/components/collections/entries/EntryListingCardGrid.tsx b/packages/core/src/components/collections/entries/EntryListingCardGrid.tsx index 4b1812d54..0d39e8549 100644 --- a/packages/core/src/components/collections/entries/EntryListingCardGrid.tsx +++ b/packages/core/src/components/collections/entries/EntryListingCardGrid.tsx @@ -3,6 +3,7 @@ import AutoSizer from 'react-virtualized-auto-sizer'; import { VariableSizeGrid as Grid } from 'react-window'; import { + COLLECTION_CARD_DATE_HEIGHT, COLLECTION_CARD_HEIGHT, COLLECTION_CARD_HEIGHT_WITHOUT_IMAGE, COLLECTION_CARD_MARGIN, @@ -64,7 +65,7 @@ const CardWrapper: FC> = ({ } const data = entryData[index]; const cardHeight = - index < cardHeights.length ? cardHeights[index] + COLLECTION_CARD_MARGIN : style.height; + index < cardHeights.length ? cardHeights[index] + COLLECTION_CARD_MARGIN * 2 : style.height; return (
= ({ }, []); const getDefaultHeight = useCallback((data?: CollectionEntryData) => { - return isNotNullish(data?.imageFieldName) + const base = isNotNullish(data?.imageFieldName) ? COLLECTION_CARD_HEIGHT : COLLECTION_CARD_HEIGHT_WITHOUT_IMAGE; + + if (isNotNullish(data?.dateFieldName)) { + return base + COLLECTION_CARD_DATE_HEIGHT; + } + + return base; }, []); const [prevCardHeights, setPrevCardHeight] = useState([]); @@ -185,12 +192,12 @@ const EntryListingCardGrid: FC = ({ } if (cardHeights[i] > rowHeight && cardHeights[i]) { - rowHeight = cardHeights[i] + COLLECTION_CARD_MARGIN; + rowHeight = cardHeights[i] + COLLECTION_CARD_MARGIN * 2; } } if (rowHeight === 0) { - rowHeight = getDefaultHeight() + COLLECTION_CARD_MARGIN; + rowHeight = getDefaultHeight() + COLLECTION_CARD_MARGIN * 2; } return rowHeight; diff --git a/packages/core/src/components/entry-editor/EditorToolbar.css b/packages/core/src/components/entry-editor/EditorToolbar.css index b01dfdc0d..9a59a75a8 100644 --- a/packages/core/src/components/entry-editor/EditorToolbar.css +++ b/packages/core/src/components/entry-editor/EditorToolbar.css @@ -22,6 +22,11 @@ lg:!hidden; } +.CMS_EditorToolbar_discard-button { + @apply flex + lg:!hidden; +} + .CMS_EditorToolbar_delete-button { @apply flex lg:!hidden; diff --git a/packages/core/src/components/entry-editor/EditorToolbar.tsx b/packages/core/src/components/entry-editor/EditorToolbar.tsx index 93c429b83..296de4b8c 100644 --- a/packages/core/src/components/entry-editor/EditorToolbar.tsx +++ b/packages/core/src/components/entry-editor/EditorToolbar.tsx @@ -29,8 +29,8 @@ import MenuGroup from '../common/menu/MenuGroup'; import MenuItemButton from '../common/menu/MenuItemButton'; import EditorWorkflowToolbarButtons from './EditorWorkflowToolbarButtons'; -import type { WorkflowStatus } from '@staticcms/core/constants/publishModes'; import type { CollectionWithDefaults, EditorPersistOptions } from '@staticcms/core'; +import type { WorkflowStatus } from '@staticcms/core/constants/publishModes'; import type { FC, MouseEventHandler } from 'react'; import './EditorToolbar.css'; @@ -41,6 +41,7 @@ export const classes = generateClassNames('EditorToolbar', [ 'more-menu-button', 'more-menu-label-icon', 'preview-toggle', + 'discard-button', 'delete-button', 'publish-button', 'publish-button-icon', @@ -419,14 +420,34 @@ const EditorToolbar: FC = ({ disabled={disabled} /> ) : null} - {canDelete ? ( + {hasChanged ? ( + + ) : canDelete && + (!useOpenAuthoring || hasUnpublishedChanges) && + (!useWorkflow || workflowDeleteLabel) ? ( = ({ (!dirty && !submitted) || disabled || i18nDisabled || - (forList && field.widget === 'object' && field.fields.length === 1) + (forList && field.widget === 'object' && field.fields.length === 1) || + (i18n?.enforceRequiredNonDefault === false && i18n?.currentLocale !== i18n?.defaultLocale) ) { return; } diff --git a/packages/core/src/components/entry-editor/editor-control-pane/EditorControlPane.tsx b/packages/core/src/components/entry-editor/editor-control-pane/EditorControlPane.tsx index 0a6d34c56..e55281bbf 100644 --- a/packages/core/src/components/entry-editor/editor-control-pane/EditorControlPane.tsx +++ b/packages/core/src/components/entry-editor/editor-control-pane/EditorControlPane.tsx @@ -88,11 +88,12 @@ const EditorControlPane: FC = ({ const i18n = useMemo(() => { if (hasI18n(collection)) { - const { locales, default_locale } = getI18nInfo(collection); + const { locales, default_locale, enforce_required_non_default } = getI18nInfo(collection); return { currentLocale: locale ?? locales?.[0], locales, defaultLocale: default_locale, + enforceRequiredNonDefault: enforce_required_non_default, } as I18nSettings; } diff --git a/packages/core/src/constants/configSchema.tsx b/packages/core/src/constants/configSchema.tsx index 314827f49..971f02d1c 100644 --- a/packages/core/src/constants/configSchema.tsx +++ b/packages/core/src/constants/configSchema.tsx @@ -40,6 +40,7 @@ const i18n = { uniqueItems: true, }, default_locale: localeType, + enforce_required_non_default: { type: 'boolean' }, }, }; diff --git a/packages/core/src/constants/views.ts b/packages/core/src/constants/views.ts index ed43bdb6e..75398a9eb 100644 --- a/packages/core/src/constants/views.ts +++ b/packages/core/src/constants/views.ts @@ -8,6 +8,7 @@ export const COLLECTION_CARD_WIDTH = 240; export const COLLECTION_CARD_HEIGHT = 204; export const COLLECTION_CARD_IMAGE_HEIGHT = 140; export const COLLECTION_CARD_HEIGHT_WITHOUT_IMAGE = 56; +export const COLLECTION_CARD_DATE_HEIGHT = 24; export const COLLECTION_CARD_MARGIN = 10; export const EDITOR_SIZE_COMPACT = 'compact'; diff --git a/packages/core/src/interface.ts b/packages/core/src/interface.ts index 47fa3f91c..59ada4a52 100644 --- a/packages/core/src/interface.ts +++ b/packages/core/src/interface.ts @@ -267,6 +267,7 @@ export interface I18nSettings { currentLocale: string; defaultLocale: string; locales: string[]; + enforceRequiredNonDefault?: boolean; } export type Format = keyof typeof formatExtensions; @@ -1306,6 +1307,7 @@ export interface I18nInfo { locales: string[]; default_locale?: string; structure: I18nStructure; + enforce_required_non_default?: boolean; } export interface ProcessedCodeLanguage { diff --git a/packages/core/src/lib/i18n.ts b/packages/core/src/lib/i18n.ts index f5279edb1..08eeffe36 100644 --- a/packages/core/src/lib/i18n.ts +++ b/packages/core/src/lib/i18n.ts @@ -343,6 +343,7 @@ export async function getI18nEntry( i18nInfo = { structure: I18N_STRUCTURE_SINGLE_FILE, locales: [], + enforce_required_non_default: true, }; } diff --git a/packages/core/src/lib/widgets/stringTemplate.ts b/packages/core/src/lib/widgets/stringTemplate.ts index 322572ee7..e335da9d3 100644 --- a/packages/core/src/lib/widgets/stringTemplate.ts +++ b/packages/core/src/lib/widgets/stringTemplate.ts @@ -1,5 +1,5 @@ -import format from 'date-fns/format'; -import parse from 'date-fns/parse'; +import { format } from 'date-fns/format'; +import { parse } from 'date-fns/parse'; import get from 'lodash/get'; import trimEnd from 'lodash/trimEnd'; import truncate from 'lodash/truncate'; diff --git a/packages/core/src/reducers/__tests__/entryDraft.spec.ts b/packages/core/src/reducers/__tests__/entryDraft.spec.ts index 5f24b591a..ca7891e84 100644 --- a/packages/core/src/reducers/__tests__/entryDraft.spec.ts +++ b/packages/core/src/reducers/__tests__/entryDraft.spec.ts @@ -115,6 +115,7 @@ describe('entryDraft', () => { locales: ['en', 'fr', 'es'], defaultLocale: 'en', currentLocale: 'en', + enforceRequiredNonDefault: true, }, isMeta: false, }, @@ -155,6 +156,7 @@ describe('entryDraft', () => { locales: ['en', 'fr', 'es'], defaultLocale: 'en', currentLocale: 'en', + enforceRequiredNonDefault: true, }; let state = entryDraftReducer(startState, { diff --git a/packages/core/src/widgets/datetime/DateTimeControl.tsx b/packages/core/src/widgets/datetime/DateTimeControl.tsx index 0d5d1838b..1a2b099fb 100644 --- a/packages/core/src/widgets/datetime/DateTimeControl.tsx +++ b/packages/core/src/widgets/datetime/DateTimeControl.tsx @@ -1,12 +1,12 @@ import { unstable_useForkRef as useForkRef } from '@mui/utils'; -import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; +import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'; import { DatePicker } from '@mui/x-date-pickers/DatePicker'; import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import { TimePicker } from '@mui/x-date-pickers/TimePicker'; -import formatDate from 'date-fns/format'; -import parse from 'date-fns/parse'; -import parseISO from 'date-fns/parseISO'; +import { formatDate } from 'date-fns/format'; +import { parse } from 'date-fns/parse'; +import { parseISO } from 'date-fns/parseISO'; import React, { useCallback, useMemo, useRef, useState } from 'react'; import Field from '@staticcms/core/components/common/field/FieldWrapper'; @@ -14,7 +14,7 @@ import classNames from '@staticcms/core/lib/util/classNames.util'; import { generateClassNames } from '@staticcms/core/lib/util/theming.util'; import NowButton from './components/NowButton'; import { DEFAULT_DATETIME_FORMAT } from './constants'; -import { useDatetimeFormats } from './datetime.util'; +import { getDateFnsLocale, useDatetimeFormats } from './datetime.util'; import { localToUTC } from './utc.util'; import type { DateTimeField, WidgetControlProps } from '@staticcms/core'; @@ -43,6 +43,7 @@ const DateTimeControl: FC> = ({ errors, hasErrors, forSingleList, + config: { locale }, onChange, }) => { const ref = useRef(null); @@ -194,6 +195,8 @@ const DateTimeControl: FC> = ({ rootRef, ]); + const dateLocale = useMemo(() => (locale ? getDateFnsLocale(locale) : undefined), [locale]); + return ( > = ({ wrapperClassName={classes.wrapper} >
- + {dateTimePicker} getDatetimeFormats(field), [field]); } + +export function getDateFnsLocale(locale: string): Locale { + return (Locales as Record)[locale] ?? Locales.enUS; +} diff --git a/packages/core/src/widgets/datetime/getDefaultValue.ts b/packages/core/src/widgets/datetime/getDefaultValue.ts index 6812d3b5c..3163ebfbe 100644 --- a/packages/core/src/widgets/datetime/getDefaultValue.ts +++ b/packages/core/src/widgets/datetime/getDefaultValue.ts @@ -1,4 +1,4 @@ -import format from 'date-fns/format'; +import { format } from 'date-fns/format'; import { isNotNullish } from '@staticcms/core/lib/util/null.util'; import { DEFAULT_DATETIME_FORMAT, DEFAULT_DATE_FORMAT, DEFAULT_TIME_FORMAT } from './constants'; diff --git a/packages/core/src/widgets/datetime/utc.util.ts b/packages/core/src/widgets/datetime/utc.util.ts index 5ea81ef08..3e7fb4db0 100644 --- a/packages/core/src/widgets/datetime/utc.util.ts +++ b/packages/core/src/widgets/datetime/utc.util.ts @@ -1,4 +1,4 @@ -import addMinutes from 'date-fns/addMinutes'; +import { addMinutes } from 'date-fns/addMinutes'; export function localToUTC(dateTime: Date): Date { return addMinutes(dateTime.getTime(), getTimezoneOffset(dateTime)); diff --git a/packages/docs/content/docs/i18n-support.mdx b/packages/docs/content/docs/i18n-support.mdx index 249db80a5..7645b461d 100644 --- a/packages/docs/content/docs/i18n-support.mdx +++ b/packages/docs/content/docs/i18n-support.mdx @@ -25,6 +25,10 @@ i18n: # Optional, defaults to the first item in locales. # The locale to be used for fields validation and as a baseline for the entry. default_locale: en + + # Optional, defaults to true. + # Enforce required fields in non-default locales + enforce_required_non_default: false ``` ```js @@ -44,7 +48,13 @@ i18n: { * Optional, defaults to the first item in locales. * The locale to be used for fields validation and as a baseline for the entry. */ - default_locale: 'en' + default_locale: 'en', + + /** + * Optional, defaults to true. + * Enforce required fields in non-default locales + */ + enforce_required_non_default: false }, ``` diff --git a/packages/docs/content/releases.json b/packages/docs/content/releases.json index c1828e9e4..16a063155 100644 --- a/packages/docs/content/releases.json +++ b/packages/docs/content/releases.json @@ -1,5 +1,11 @@ { "releases": [ + { + "date": "2024-04-26T10:00:00.000Z", + "version": "v4.3.0", + "type": "minor", + "description": "Add option to make non default locale fields optional" + }, { "date": "2024-04-25T10:00:00.000Z", "version": "v4.2.0", diff --git a/packages/docs/package.json b/packages/docs/package.json index 973330333..7388c5731 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -18,7 +18,7 @@ "@emotion/styled": "11.11.0", "@mui/icons-material": "5.15.3", "@mui/material": "5.15.3", - "date-fns": "2.30.0", + "date-fns": "3.6.0", "gray-matter": "4.0.3", "js-yaml": "4.1.0", "next": "14.0.4", diff --git a/packages/docs/src/components/DateDisplay.tsx b/packages/docs/src/components/DateDisplay.tsx index 95d7996c5..1b28534d1 100644 --- a/packages/docs/src/components/DateDisplay.tsx +++ b/packages/docs/src/components/DateDisplay.tsx @@ -1,6 +1,4 @@ -import addMinutes from 'date-fns/addMinutes'; -import format from 'date-fns/format'; -import parseISO from 'date-fns/parseISO'; +import { addMinutes, format, parseISO } from 'date-fns'; import { useEffect, useState } from 'react'; function formatDate(date: Date, dateFormat: string) { diff --git a/packages/docs/src/components/meta/JsonLdMeta.tsx b/packages/docs/src/components/meta/JsonLdMeta.tsx index 90e94e7f2..4f3be5c71 100644 --- a/packages/docs/src/components/meta/JsonLdMeta.tsx +++ b/packages/docs/src/components/meta/JsonLdMeta.tsx @@ -1,4 +1,4 @@ -import formatISO from 'date-fns/formatISO'; +import { formatISO } from 'date-fns'; import Head from 'next/head'; import { jsonLdScriptProps } from 'react-schemaorg'; diff --git a/packages/docs/src/pages/releases.tsx b/packages/docs/src/pages/releases.tsx index 25c59f696..b9f6cf986 100644 --- a/packages/docs/src/pages/releases.tsx +++ b/packages/docs/src/pages/releases.tsx @@ -3,8 +3,7 @@ import AlertTitle from '@mui/material/AlertTitle'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import { styled } from '@mui/material/styles'; -import format from 'date-fns/format'; -import parseISO from 'date-fns/parseISO'; +import { format, parseISO } from 'date-fns'; import Link from 'next/link'; import { useMemo } from 'react'; diff --git a/yarn.lock b/yarn.lock index 1346a5080..1320b19ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2062,7 +2062,7 @@ resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== -"@babel/runtime@7.23.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.2", "@babel/runtime@^7.23.6": +"@babel/runtime@7.23.7", "@babel/runtime@^7.23.6": version "7.23.7" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.7.tgz#dd7c88deeb218a0f8bd34d5db1aa242e0f203193" integrity sha512-w06OXVOFso7LcbzMiDGt+3X7Rh7Ho8MmgPoWU3rarH+8upf+wSU/grlGbWzQyr3DkdN6ZeuMFjpdwW0Q+HxobA== @@ -2083,6 +2083,13 @@ dependencies: regenerator-runtime "^0.14.0" +"@babel/runtime@^7.23.9", "@babel/runtime@^7.24.0": + version "7.24.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.4.tgz#de795accd698007a66ba44add6cc86542aff1edd" + integrity sha512-dkxf7+hn8mFBwKjs9bvBlArzLVxVbS8usaPUDd5p2a9JCL9tB8OaOVN1isD4+Xyk4ns89/xeOmbQvgdK7IIVdA== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/template@^7.18.10", "@babel/template@^7.20.7", "@babel/template@^7.3.3": version "7.20.7" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.20.7.tgz#a15090c2839a83b02aa996c0b4994005841fd5a8" @@ -2814,6 +2821,13 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.56.0.tgz#ef20350fec605a7f7035a01764731b2de0f3782b" integrity sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A== +"@floating-ui/core@^1.0.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.6.0.tgz#fa41b87812a16bf123122bf945946bae3fdf7fc1" + integrity sha512-PcF++MykgmTj3CIyOQbKA/hDzOAiqI3mhuoN44WRCopIs1sgoDoU4oty4Jtqaj/y3oDU6fnVSm4QG0a3t5i0+g== + dependencies: + "@floating-ui/utils" "^0.2.1" + "@floating-ui/core@^1.2.6": version "1.2.6" resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.2.6.tgz#d21ace437cc919cdd8f1640302fa8851e65e75c0" @@ -2841,6 +2855,14 @@ "@floating-ui/core" "^1.4.1" "@floating-ui/utils" "^0.1.1" +"@floating-ui/dom@^1.6.1": + version "1.6.3" + resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.3.tgz#954e46c1dd3ad48e49db9ada7218b0985cee75ef" + integrity sha512-RnDthu3mzPlQ31Ss/BTwQ1zjzIhr3lk1gZB1OC56h/1vEtaXkESrOqL5fQVMfXpwGtRwX+YsZBdyHtJMQnkArw== + dependencies: + "@floating-ui/core" "^1.0.0" + "@floating-ui/utils" "^0.2.0" + "@floating-ui/react-dom@^1.3.0": version "1.3.0" resolved "https://registry.yarnpkg.com/@floating-ui/react-dom/-/react-dom-1.3.0.tgz#4d35d416eb19811c2b0e9271100a6aa18c1579b3" @@ -2862,6 +2884,13 @@ dependencies: "@floating-ui/dom" "^1.5.1" +"@floating-ui/react-dom@^2.0.8": + version "2.0.8" + resolved "https://registry.yarnpkg.com/@floating-ui/react-dom/-/react-dom-2.0.8.tgz#afc24f9756d1b433e1fe0d047c24bd4d9cefaa5d" + integrity sha512-HOdqOt3R3OGeTKidaLvJKcgg75S6tibQ3Tif4eyd91QnIJWr0NLvoXFpJA/j8HqkFSL68GDca9AuyWEHlhyClw== + dependencies: + "@floating-ui/dom" "^1.6.1" + "@floating-ui/react@^0.22.3": version "0.22.3" resolved "https://registry.yarnpkg.com/@floating-ui/react/-/react-0.22.3.tgz#96effa223f7447e2252216e35818d7f654e71d9a" @@ -2876,6 +2905,11 @@ resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.1.2.tgz#b7e9309ccce5a0a40ac482cb894f120dba2b357f" integrity sha512-ou3elfqG/hZsbmF4bxeJhPHIf3G2pm0ujc39hYEZrfVqt7Vk/Zji6CXc3W0pmYM8BW1g40U+akTl9DKZhFhInQ== +"@floating-ui/utils@^0.2.0", "@floating-ui/utils@^0.2.1": + version "0.2.1" + resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.1.tgz#16308cea045f0fc777b6ff20a9f25474dd8293d2" + integrity sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q== + "@humanwhocodes/config-array@^0.11.13": version "0.11.13" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.13.tgz#075dc9684f40a531d9b26b0822153c1e832ee297" @@ -3534,7 +3568,7 @@ "@types/mdx" "^2.0.0" "@types/react" ">=16" -"@mui/base@5.0.0-beta.30", "@mui/base@^5.0.0-beta.22": +"@mui/base@5.0.0-beta.30": version "5.0.0-beta.30" resolved "https://registry.yarnpkg.com/@mui/base/-/base-5.0.0-beta.30.tgz#8feca6b70f2b9cd4d5cb97799ae9fcb5376c7f83" integrity sha512-dc38W4W3K42atE9nSaOeoJ7/x9wGIfawdwC/UmMxMLlZ1iSsITQ8dQJaTATCbn98YvYPINK/EH541YA5enQIPQ== @@ -3547,6 +3581,19 @@ clsx "^2.0.0" prop-types "^15.8.1" +"@mui/base@^5.0.0-beta.40": + version "5.0.0-beta.40" + resolved "https://registry.yarnpkg.com/@mui/base/-/base-5.0.0-beta.40.tgz#1f8a782f1fbf3f84a961e954c8176b187de3dae2" + integrity sha512-I/lGHztkCzvwlXpjD2+SNmvNQvB4227xBXhISPjEaJUXGImOQ9f3D2Yj/T3KasSI/h0MLWy74X0J6clhPmsRbQ== + dependencies: + "@babel/runtime" "^7.23.9" + "@floating-ui/react-dom" "^2.0.8" + "@mui/types" "^7.2.14" + "@mui/utils" "^5.15.14" + "@popperjs/core" "^2.11.8" + clsx "^2.1.0" + prop-types "^15.8.1" + "@mui/core-downloads-tracker@^5.15.3": version "5.15.3" resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.3.tgz#40fc854d7cf5505a182a4e121149dfe21cd277ef" @@ -3577,6 +3624,15 @@ react-is "^18.2.0" react-transition-group "^4.4.5" +"@mui/private-theming@^5.15.14": + version "5.15.14" + resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-5.15.14.tgz#edd9a82948ed01586a01c842eb89f0e3f68970ee" + integrity sha512-UH0EiZckOWcxiXLX3Jbb0K7rC8mxTr9L9l6QhOZxYc4r8FHUkefltV9VDGLrzCaWh30SQiJvAEd7djX3XXY6Xw== + dependencies: + "@babel/runtime" "^7.23.9" + "@mui/utils" "^5.15.14" + prop-types "^15.8.1" + "@mui/private-theming@^5.15.3": version "5.15.3" resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-5.15.3.tgz#2db0177d847dc6b28721d93308ed05d434a77c53" @@ -3586,6 +3642,16 @@ "@mui/utils" "^5.15.3" prop-types "^15.8.1" +"@mui/styled-engine@^5.15.14": + version "5.15.14" + resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.15.14.tgz#168b154c4327fa4ccc1933a498331d53f61c0de2" + integrity sha512-RILkuVD8gY6PvjZjqnWhz8fu68dVkqhM5+jYWfB5yhlSQKg+2rHkmEwm75XIeAqI3qwOndK6zELK5H6Zxn4NHw== + dependencies: + "@babel/runtime" "^7.23.9" + "@emotion/cache" "^11.11.0" + csstype "^3.1.3" + prop-types "^15.8.1" + "@mui/styled-engine@^5.15.3": version "5.15.3" resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.15.3.tgz#85cb294d701b1a3f197bfc90e87ec0685a0943b2" @@ -3610,12 +3676,41 @@ csstype "^3.1.2" prop-types "^15.8.1" +"@mui/system@^5.15.14": + version "5.15.15" + resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.15.15.tgz#658771b200ce3c4a0f28e58169f02e5e718d1c53" + integrity sha512-aulox6N1dnu5PABsfxVGOZffDVmlxPOVgj56HrUnJE8MCSh8lOvvkd47cebIVQQYAjpwieXQXiDPj5pwM40jTQ== + dependencies: + "@babel/runtime" "^7.23.9" + "@mui/private-theming" "^5.15.14" + "@mui/styled-engine" "^5.15.14" + "@mui/types" "^7.2.14" + "@mui/utils" "^5.15.14" + clsx "^2.1.0" + csstype "^3.1.3" + prop-types "^15.8.1" + "@mui/types@^7.2.12": version "7.2.12" resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.12.tgz#602acbb5aa3eb56a31f569a19f87f75d33de5c01" integrity sha512-3kaHiNm9khCAo0pVe0RenketDSFoZGAlVZ4zDjB/QNZV0XiCj+sh1zkX0VVhQPgYJDlBEzAag+MHJ1tU3vf0Zw== -"@mui/utils@^5.14.16", "@mui/utils@^5.15.3": +"@mui/types@^7.2.14": + version "7.2.14" + resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.14.tgz#8a02ac129b70f3d82f2f9b76ded2c8d48e3fc8c9" + integrity sha512-MZsBZ4q4HfzBsywtXgM1Ksj6HDThtiwmOKUXH1pKYISI9gAVXCNHNpo7TlGoGrBaYWZTdNoirIN7JsQcQUjmQQ== + +"@mui/utils@^5.15.14": + version "5.15.14" + resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.15.14.tgz#e414d7efd5db00bfdc875273a40c0a89112ade3a" + integrity sha512-0lF/7Hh/ezDv5X7Pry6enMsbYyGKjADzvHyo3Qrc/SSlTsQ1VkbDMbH0m2t3OR5iIVLwMoxwM7yGd+6FCMtTFA== + dependencies: + "@babel/runtime" "^7.23.9" + "@types/prop-types" "^15.7.11" + prop-types "^15.8.1" + react-is "^18.2.0" + +"@mui/utils@^5.15.3": version "5.15.3" resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.15.3.tgz#421043be5279d31ca9b221a6398feb7c9d61209b" integrity sha512-mT3LiSt9tZWCdx1pl7q4Q5tNo6gdZbvJel286ZHGuj6LQQXjWNAh8qiF9d+LogvNUI+D7eLkTnj605d1zoazfg== @@ -3625,16 +3720,17 @@ prop-types "^15.8.1" react-is "^18.2.0" -"@mui/x-date-pickers@6.18.6": - version "6.18.6" - resolved "https://registry.yarnpkg.com/@mui/x-date-pickers/-/x-date-pickers-6.18.6.tgz#416e0b83dd2774547e3c864c89bedf2f4ca3e05a" - integrity sha512-pqOrGPUDVY/1xXrM1hofqwgquno/SB9aG9CVS1m2Rs8hKF1VWRC+jYlEa1Qk08xKmvkia5g7NsdV/BBb+tHUZw== +"@mui/x-date-pickers@7.3.1": + version "7.3.1" + resolved "https://registry.yarnpkg.com/@mui/x-date-pickers/-/x-date-pickers-7.3.1.tgz#7be42255d3b83afe894df2cf9782ccafd147db4e" + integrity sha512-ZIZC+/L5ch3+J6EWRWd/rzz1z/9KPZli8sO1g7t30uFgyjpRuMK4GuazRMqDDFq1KIUtk31qJV0sKKvUsVrKRw== dependencies: - "@babel/runtime" "^7.23.2" - "@mui/base" "^5.0.0-beta.22" - "@mui/utils" "^5.14.16" - "@types/react-transition-group" "^4.4.8" - clsx "^2.0.0" + "@babel/runtime" "^7.24.0" + "@mui/base" "^5.0.0-beta.40" + "@mui/system" "^5.15.14" + "@mui/utils" "^5.15.14" + "@types/react-transition-group" "^4.4.10" + clsx "^2.1.0" prop-types "^15.8.1" react-transition-group "^4.4.5" @@ -5288,7 +5384,7 @@ dependencies: "@types/react" "*" -"@types/react-transition-group@^4.4.10", "@types/react-transition-group@^4.4.8": +"@types/react-transition-group@^4.4.10": version "4.4.10" resolved "https://registry.yarnpkg.com/@types/react-transition-group/-/react-transition-group-4.4.10.tgz#6ee71127bdab1f18f11ad8fb3322c6da27c327ac" integrity sha512-hT/+s0VQs2ojCX823m60m5f0sL5idt9SO6Tj6Dg+rdphGPIeJbJ6CxvBYkgkGKrYeDjvIpKTR38UzmtHJOGW3Q== @@ -7755,6 +7851,11 @@ clsx@^2.0.0: resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.0.0.tgz#12658f3fd98fafe62075595a5c30e43d18f3d00b" integrity sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q== +clsx@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.1.tgz#eed397c9fd8bd882bfb18deab7102049a2f32999" + integrity sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA== + cmd-shim@6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-6.0.1.tgz#a65878080548e1dca760b3aea1e21ed05194da9d" @@ -8343,6 +8444,11 @@ csstype@^3.0.2, csstype@^3.1.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b" integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ== +csstype@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81" + integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw== + cypress-plugin-tab@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/cypress-plugin-tab/-/cypress-plugin-tab-1.0.5.tgz#a40714148104004bb05ed62b1bf46bb544f8eb4a" @@ -8430,12 +8536,10 @@ data-urls@^3.0.2: whatwg-mimetype "^3.0.0" whatwg-url "^11.0.0" -date-fns@2.30.0: - version "2.30.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0" - integrity sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw== - dependencies: - "@babel/runtime" "^7.21.0" +date-fns@3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-3.6.0.tgz#f20ca4fe94f8b754951b24240676e8618c0206bf" + integrity sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww== dateformat@^3.0.3: version "3.0.3" @@ -18030,7 +18134,16 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -18170,7 +18283,7 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -18184,6 +18297,13 @@ strip-ansi@^3.0.0: dependencies: ansi-regex "^2.0.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2" @@ -20113,7 +20233,7 @@ workbox-window@6.5.4, workbox-window@^6.5.4: "@types/trusted-types" "^2.0.2" workbox-core "6.5.4" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -20131,6 +20251,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"