From bcbb70fb0c345f573d08f0186da6ed6cef54483a Mon Sep 17 00:00:00 2001 From: Robin Pyon Date: Sat, 2 Dec 2023 00:06:37 +0000 Subject: [PATCH 001/163] feat: studio facelift Co-authored by: Pedro Bonamin Co-authored by: Nina Andal Aarvik --- .eslintrc.cjs | 34 +++ dev/design-studio/package.json | 4 +- .../assetSources/imageAssetSource.tsx | 14 +- dev/test-studio/components/formComponents.tsx | 7 + .../actions/TestCustomComponentAction.tsx | 21 +- dev/test-studio/package.json | 4 +- dev/test-studio/sanity.config.ts | 2 + dev/test-studio/schema/book.ts | 12 + examples/ecommerce-studio/package.json | 2 +- .../@sanity/portable-text-editor/package.json | 2 +- packages/@sanity/vision/package.json | 4 +- .../src/components/VisionGui.styled.tsx | 6 +- .../vision/src/components/VisionGui.tsx | 27 +- packages/sanity/package.json | 4 +- .../changeIndicators/ElementWithChangeBar.tsx | 20 +- .../src/core/components/DefaultDocument.tsx | 20 +- .../InsufficientPermissionsMessage.tsx | 6 +- .../src/core/components/IntentButton.tsx | 9 +- .../src/core/components/StatusButton.tsx | 124 +++------ .../src/core/components/TooltipOfDisabled.tsx | 25 +- .../components/collapseMenu/CollapseMenu.tsx | 26 +- .../collapseMenu/CollapseMenuButton.tsx | 6 +- .../collapseMenu/CollapseOverflowMenu.tsx | 3 +- .../__workshop__/CollapseMenuStory.tsx | 15 +- .../collapseTabList/CollapseTabList.tsx | 152 +++++++++++ .../__workshop__/CollapseTabListStory.tsx | 42 +++ .../collapseTabList/__workshop__/index.ts | 14 + .../core/components/collapseTabList/index.ts | 1 + .../__workshop__/KitchenSinkStory.tsx | 3 +- .../commandList/__workshop__/PopoverStory.tsx | 17 +- .../popoverDialog/PopoverDialog.tsx | 18 +- .../components/previewCard/PreviewCard.tsx | 4 - .../__workshop__/GeneralPreviewStory.tsx | 13 +- .../__workshop__/PortableTextPreviewStory.tsx | 11 +- .../previews/_common/Media.styled.ts | 6 +- .../components/previews/_common/Media.tsx | 2 +- .../src/core/components/previews/constants.ts | 51 ++-- .../previews/general/CompactPreview.tsx | 94 +++++++ .../previews/general/DefaultPreview.tsx | 113 ++++---- .../previews/general/DetailPreview.styled.ts | 10 +- .../previews/general/DetailPreview.tsx | 69 ++--- .../previews/general/MediaPreview.styled.ts | 4 +- .../previews/general/MediaPreview.tsx | 66 ++--- .../src/core/components/previews/index.ts | 1 + .../portableText/BlockImagePreview.styled.tsx | 6 +- .../portableText/BlockImagePreview.tsx | 9 +- .../previews/portableText/BlockPreview.tsx | 8 +- .../previews/portableText/InlinePreview.tsx | 4 +- .../previews/template/TemplatePreview.tsx | 6 +- .../src/core/components/previews/types.ts | 2 +- .../__tests__/useRovingFocus.test.tsx | 3 +- .../__workshop__/RovingFocusStory.tsx | 5 +- .../core/components/userAvatar/UserAvatar.tsx | 15 +- .../src/core/config/createDefaultIcon.tsx | 6 +- .../src/core/config/document/actions.ts | 7 +- .../sanity/src/core/config/prepareConfig.ts | 1 + .../sanity/src/core/config/studio/types.ts | 1 + packages/sanity/src/core/config/types.ts | 8 + .../__workshop__/DiffErrorBoundaryStory.tsx | 3 +- .../diff/components/ChangeList.styled.tsx | 10 - .../core/field/diff/components/ChangeList.tsx | 26 +- .../diff/components/ChangeTitleSegment.tsx | 19 +- .../diff/components/DiffInspectWrapper.tsx | 6 +- .../field/diff/components/DiffTooltip.tsx | 17 +- .../diff/components/FieldChange.styled.tsx | 11 +- .../field/diff/components/FieldChange.tsx | 58 +++-- .../diff/components/GroupChange.styled.tsx | 9 - .../field/diff/components/GroupChange.tsx | 39 +-- .../core/field/diff/components/MetaInfo.tsx | 2 +- .../core/field/diff/components/NoChanges.tsx | 2 +- .../diff/components/RevertChangesButton.tsx | 9 +- .../types/boolean/diff/BooleanFieldDiff.tsx | 2 +- .../diff/components/Annotation.tsx | 6 +- .../diff/components/InlineObject.tsx | 6 +- .../__workshop__/_common/FilterFieldInput.tsx | 7 +- .../__workshop__/_common/FormDebugger.tsx | 6 +- .../form/__workshop__/_common/TypeTester.tsx | 7 +- .../_common/resolvePreviewComponent.tsx | 3 +- .../ActivateOnFocus/ActivateOnFocus.tsx | 2 +- .../sanity/src/core/form/components/Alert.tsx | 2 +- .../src/core/form/components/EditPortal.tsx | 7 +- .../form/components/FullscreenSpinner.tsx | 20 -- .../core/form/components/SpinnerWithText.tsx | 15 -- .../formField/FormFieldBaseHeader.tsx | 4 +- .../formField/FormFieldHeaderText.tsx | 4 +- .../components/formField/FormFieldSet.tsx | 2 +- .../formField/FormFieldSetLegend.tsx | 2 +- .../formField/FormFieldValidationStatus.tsx | 18 +- .../form/components/tagInput/tagInput.tsx | 18 +- .../form/field/actions/FieldActionMenu.tsx | 28 +- .../field/actions/FieldActionMenuGroup.tsx | 19 +- .../field/actions/FieldActionMenuItem.tsx | 6 +- .../CrossDatasetReferenceInput.tsx | 24 +- .../CrossDatasetReferencePreview.styled.tsx | 5 - .../CrossDatasetReferencePreview.tsx | 57 ++-- .../DisabledFeatureWarning.tsx | 17 +- .../inputs/DateInputs/base/DateTimeInput.tsx | 9 +- .../DateInputs/base/calendar/Calendar.tsx | 61 +++-- .../InvalidValueInput/InvalidValueInput.tsx | 5 +- .../InvalidValueInput/UntypedValueInput.tsx | 5 +- .../form/inputs/ObjectInput/ObjectInput.tsx | 2 +- .../form/inputs/ObjectInput/UnknownFields.tsx | 3 +- .../ObjectInput/fieldGroups/GroupTab.tsx | 3 +- .../core/form/inputs/PortableText/Editor.tsx | 29 ++- .../form/inputs/PortableText/InvalidValue.tsx | 12 +- .../_common/resolvePreviewComponent.tsx | 3 +- .../customSchema/blockActions.tsx | 27 +- .../inputs/PortableText/object/Annotation.tsx | 8 +- .../object/AnnotationToolbarPopover.tsx | 37 +-- .../PortableText/object/BlockObject.tsx | 9 +- .../object/BlockObjectActionsMenu.tsx | 19 +- .../PortableText/object/InlineObject.tsx | 8 +- .../object/InlineObjectToolbarPopover.tsx | 29 +-- .../object/modals/DialogModal.tsx | 7 +- .../object/modals/PopoverModal.styles.ts | 5 - .../object/modals/PopoverModal.tsx | 7 +- .../inputs/PortableText/text/TextBlock.tsx | 9 +- .../PortableText/toolbar/ActionMenu.tsx | 35 ++- .../PortableText/toolbar/BlockStyleSelect.tsx | 22 +- .../PortableText/toolbar/InsertMenu.tsx | 22 +- .../inputs/PortableText/toolbar/Toolbar.tsx | 45 ++-- .../inputs/ReferenceInput/CreateButton.tsx | 36 ++- .../ReferenceInput/PreviewReferenceValue.tsx | 42 ++- .../inputs/ReferenceInput/ReferenceField.tsx | 65 ++--- .../inputs/ReferenceInput/ReferenceInput.tsx | 3 +- .../inputs/ReferenceInput/ReferenceItem.tsx | 55 +--- .../ReferenceInput/ReferencePreview.tsx | 144 +++------- .../src/core/form/inputs/SelectInput.tsx | 2 +- .../src/core/form/inputs/Slug/SlugInput.tsx | 30 +-- .../ArrayOfObjectsFunctions.tsx | 34 +-- .../ArrayOfObjectsInput/Grid/ErrorItem.tsx | 13 +- .../ArrayOfObjectsInput/Grid/GridItem.tsx | 46 +--- .../Grid/IncompatibleItemType.tsx | 4 +- .../arrays/ArrayOfObjectsInput/InsertMenu.tsx | 3 +- .../ArrayOfObjectsInput/List/ErrorItem.tsx | 15 +- .../List/IncompatibleItemType.tsx | 4 +- .../ArrayOfObjectsInput/List/PreviewItem.tsx | 57 +--- .../ArrayOfPrimitivesFunctions.tsx | 24 +- .../arrays/ArrayOfPrimitivesInput/ItemRow.tsx | 9 +- .../form/inputs/arrays/common/DragHandle.tsx | 20 +- .../common/uploadTarget/uploadTarget.tsx | 2 +- .../form/inputs/arrays/layouts/CellLayout.tsx | 2 +- .../form/inputs/arrays/layouts/RowLayout.tsx | 8 +- .../files/FileInput/FileActionsMenu.tsx | 16 +- .../form/inputs/files/FileInput/FileInput.tsx | 13 +- .../inputs/files/FileInput/FileSkeleton.tsx | 6 +- .../files/FileInput/InvalidFileWarning.tsx | 17 +- .../files/ImageInput/ImageActionsMenu.tsx | 60 ++--- .../inputs/files/ImageInput/ImageInput.tsx | 39 +-- .../files/ImageInput/ImagePreview.styled.tsx | 6 +- .../inputs/files/ImageInput/ImagePreview.tsx | 11 +- .../files/ImageInput/InvalidImageWarning.tsx | 17 +- .../__workshop__/UploadPlaceholderStory.tsx | 3 +- .../form/inputs/files/common/ActionsMenu.tsx | 10 +- .../FileInputButton/FileInputButton.tsx | 54 +--- .../files/common/FileInputButton/styles.ts | 9 +- .../FileInputMenuItem.styled.tsx | 2 +- .../FileInputMenuItem/FileInputMenuItem.tsx | 84 ++---- .../inputs/files/common/UploadProgress.tsx | 8 +- .../inputs/files/common/UploadWarning.tsx | 17 +- .../members/array/IncompatibleItemType.tsx | 6 +- .../object/errors/DuplicateKeysAlert.tsx | 3 +- .../object/errors/MissingKeysAlert.tsx | 3 +- .../members/object/errors/MixedArrayAlert.tsx | 3 +- .../studio/assetSource/image/AssetThumb.tsx | 11 +- .../assetSource/shared/AssetDeleteDialog.tsx | 42 ++- .../assetSource/shared/AssetUsageDialog.tsx | 7 +- .../assetSource/shared/DefaultSource.tsx | 3 +- packages/sanity/src/core/hooks/index.ts | 1 + .../core/hooks/useDocumentStatusTimeAgo.ts | 45 ++++ .../sanity/src/core/i18n/bundles/studio.ts | 1 - .../core/i18n/components/LocaleProvider.tsx | 4 +- .../core/presence/DocumentPreviewPresence.tsx | 17 +- .../core/presence/FieldPresence.styled.tsx | 3 +- .../src/core/presence/PresenceTooltip.tsx | 11 +- .../sanity/src/core/presence/constants.ts | 2 +- .../SanityDefaultPreviewStory.tsx | 15 ++ .../src/core/preview/__workshop__/index.ts | 5 + .../components/SanityDefaultPreview.tsx | 22 +- .../preview/components/_previewComponents.ts | 9 +- .../__workshop__/ReferenceSchemaStory.tsx | 10 +- .../_legacy/__workshop__/CurrentUserStory.tsx | 5 +- .../__workshop__/DocumentPairStory.tsx | 5 +- .../__workshop__/DocumentPermissionStory.tsx | 2 +- .../_legacy/__workshop__/HistoryStory.tsx | 2 +- .../__workshop__/HistoryTimelineStory.tsx | 7 +- .../_legacy/__workshop__/PresenceStory.tsx | 2 +- .../authStore/createLoginComponent.tsx | 19 +- .../sanity/src/core/studio/AuthBoundary.tsx | 5 +- .../sanity/src/core/studio/GlobalStyle.tsx | 49 +++- .../sanity/src/core/studio/Studio.test.tsx | 7 +- .../src/core/studio/StudioErrorBoundary.tsx | 3 +- .../sanity/src/core/studio/StudioLayout.tsx | 34 ++- .../sanity/src/core/studio/StudioProvider.tsx | 8 +- .../studio/components/navbar/LogoButton.tsx | 27 -- .../studio/components/navbar/NavDrawer.tsx | 15 +- .../studio/components/navbar/SanityLogo.tsx | 27 ++ .../studio/components/navbar/StudioLogo.tsx | 2 +- .../studio/components/navbar/StudioNavbar.tsx | 246 +++++++++--------- .../configIssues/ConfigIssuesButton.tsx | 30 +-- .../new-document/NewDocumentButton.style.ts | 7 +- .../navbar/new-document/NewDocumentButton.tsx | 57 ++-- .../navbar/new-document/NewDocumentList.tsx | 22 +- .../new-document/NewDocumentListOption.tsx | 16 +- .../navbar/presence/PresenceMenu.tsx | 92 +++---- .../navbar/presence/PresenceMenuItem.tsx | 48 ++-- .../navbar/resources/ResourcesButton.tsx | 64 ++--- .../navbar/resources/ResourcesMenuItems.tsx | 28 +- .../resources/helper-functions/types.ts | 2 + .../components/navbar/search/SearchButton.tsx | 36 +++ .../components/navbar/search/SearchField.tsx | 71 ----- .../__workshop__/CommonDateDirectionStory.tsx | 2 +- .../__workshop__/CommonDateEqualStory.tsx | 2 +- .../__workshop__/CommonDateRangeStory.tsx | 4 +- .../__workshop__/SearchPopoverStory.tsx | 1 - .../navbar/search/components/NoResults.tsx | 2 +- .../navbar/search/components/SearchError.tsx | 2 +- .../navbar/search/components/SearchHeader.tsx | 18 +- .../search/components/SearchPopover.tsx | 39 +-- .../navbar/search/components/SortMenu.tsx | 44 +--- .../components/common/CustomTextInput.tsx | 8 +- .../search/components/common/FilterLabel.tsx | 4 +- .../components/common/SearchWrapper.tsx | 2 +- .../search/components/filters/Filters.tsx | 6 +- .../filters/addFilter/AddFilterButton.tsx | 7 +- .../filters/addFilter/items/FilterTooltip.tsx | 31 +-- .../addFilter/items/MenuItemFilter.tsx | 30 +-- .../addFilter/items/MenuItemHeader.tsx | 8 +- .../common/FilterPopoverContentHeader.tsx | 3 +- .../filters/debug/_DebugDocumentTypes.tsx | 2 +- .../debug/_DebugDocumentTypesNarrowed.tsx | 2 +- .../filters/debug/_DebugFilterQuery.tsx | 2 +- .../filters/debug/_DebugFilterValues.tsx | 2 +- .../documentTypes/DocumentTypesButton.tsx | 24 +- .../DocumentTypesPopoverContent.tsx | 11 +- .../items/DocumentTypeFilterItem.tsx | 7 +- .../filters/filter/FilterButton.tsx | 8 +- .../components/filters/filter/FilterError.tsx | 2 +- .../components/filters/filter/FilterForm.tsx | 6 +- .../filters/filter/OperatorsMenuButton.tsx | 43 +-- .../filters/filter/inputs/asset/Asset.tsx | 13 +- .../filter/inputs/asset/AssetSourceError.tsx | 2 +- .../asset/preview/FileReferencePreview.tsx | 9 +- .../asset/preview/ImageReferencePreview.tsx | 15 +- .../inputs/date/ParsedDateTextInput.tsx | 64 ++--- .../date/datePicker/calendar/Calendar.tsx | 6 +- .../datePicker/calendar/CalendarHeader.tsx | 11 +- .../filter/inputs/reference/Reference.tsx | 8 +- .../reference/ReferenceAutocomplete.tsx | 3 +- .../filter/inputs/string/StringList.tsx | 43 ++- .../recentSearches/RecentSearches.tsx | 18 +- .../recentSearches/item/RecentSearchItem.tsx | 11 +- .../searchResults/item/DebugOverlay.tsx | 41 ++- .../searchResults/item/SearchResultItem.tsx | 8 +- .../item/SearchResultItemPreview.tsx | 15 +- .../components/navbar/search/constants.ts | 2 +- .../search/definitions/defaultFilters.ts | 4 +- .../studio/components/navbar/search/index.ts | 2 +- .../navbar/tools/ToolCollapseMenu.tsx | 38 +-- .../navbar/tools/ToolVerticalMenu.tsx | 7 +- .../components/navbar/userMenu/LocaleMenu.tsx | 11 +- .../components/navbar/userMenu/UserMenu.tsx | 35 +-- .../workspace/WorkspaceAuth/WorkspaceAuth.tsx | 11 +- .../navbar/workspace/WorkspaceMenuButton.tsx | 224 ++++++++-------- .../navbar/workspace/WorkspacePreview.tsx | 34 ++- .../studio/screens/CorsOriginErrorScreen.tsx | 39 ++- .../src/core/studio/screens/LoadingScreen.tsx | 23 -- .../core/studio/screens/NoSourcesScreen.tsx | 2 +- .../src/core/studio/screens/NoToolsScreen.tsx | 2 +- .../studio/screens/NotAuthenticatedScreen.tsx | 17 +- .../core/studio/screens/NotFoundScreen.tsx | 3 +- .../studio/screens/ToolNotFoundScreen.tsx | 2 +- .../sanity/src/core/studio/screens/index.ts | 1 - .../InitialValueTemplateError.tsx | 21 +- .../schemaErrors/SchemaProblemGroups.tsx | 2 +- .../studio-components-hooks/componentHooks.ts | 1 + .../studio/workspaceLoader/ErrorMessage.tsx | 2 +- .../sanity/src/core/theme/_legacy/color.ts | 18 +- .../sanity/src/core/theme/_legacy/theme.ts | 3 +- .../desk/__workshop__/DocumentStateStory.tsx | 6 +- .../plugin/field/CommentsFieldButton.tsx | 71 ++--- .../CommentsInspectorFeedbackFooter.tsx | 11 - .../inspector/CommentsInspectorHeader.tsx | 32 +-- .../src/components/CommentBreadcrumbs.tsx | 15 +- .../src/components/CommentDeleteDialog.tsx | 29 ++- .../comments/src/components/TextTooltip.tsx | 32 --- .../src/components/avatars/SpacerAvatar.tsx | 3 +- .../src/desk/comments/src/components/index.ts | 1 - .../components/list/CommentThreadLayout.tsx | 8 +- .../src/components/list/CommentsListItem.tsx | 8 +- .../list/CommentsListItemContextMenu.tsx | 39 +-- .../list/CommentsListItemLayout.tsx | 2 +- .../components/list/CommentsListStatus.tsx | 17 +- .../src/components/mentions/MentionsMenu.tsx | 7 +- .../onboarding/CommentsOnboardingPopover.tsx | 7 +- .../pte/blocks/MentionInlineBlock.tsx | 13 +- .../CommentInputDiscardDialog.tsx | 30 +-- .../pte/comment-input/CommentInputInner.tsx | 53 ++-- .../src/desk/components/IntentButton.tsx | 7 +- .../MissingDocumentTypesMessage.tsx | 63 +++++ .../desk/components/NotPublishedStatus.tsx | 14 + .../ConfirmDeleteDialog.tsx | 50 ++-- .../ConfirmDeleteDialogBody.styles.tsx | 37 ++- .../ConfirmDeleteDialogBody.tsx | 65 ++--- .../components/confirmDeleteDialog/index.tsx | 21 +- .../deskTool/NoDocumentTypesScreen.tsx | 2 +- .../components/deskTool/StructureError.tsx | 11 +- .../components/pane/PaneContextMenuButton.tsx | 11 +- .../components/pane/PaneFooter.styles.tsx | 2 +- .../components/pane/PaneHeader.styles.tsx | 35 ++- .../src/desk/components/pane/PaneHeader.tsx | 28 +- .../pane/PaneHeaderActionButton.tsx | 110 ++++---- .../components/pane/PaneMenuButtonItem.tsx | 10 +- .../__workshop__/ChangeConnectorsStory.tsx | 27 +- .../pane/__workshop__/ExampleStory.tsx | 52 ++-- .../DocumentPane/DocumentActions.tsx | 18 +- .../DocumentPane/DocumentViewPanel.tsx | 13 +- .../DocumentPane/ReviewChangesPanel.tsx | 12 +- .../SplitPanesStory/ListPane/ListPane.tsx | 22 +- .../InsufficientPermissionsMessageTooltip.tsx | 10 +- .../PaneHeaderCreateButton.tsx | 22 +- .../src/desk/components/paneItem/PaneItem.tsx | 14 +- .../components/paneItem/PaneItemPreview.tsx | 28 +- .../DeskRenameToolMenuButtonPopover.tsx | 14 +- .../desk/documentActions/PublishAction.tsx | 6 +- .../document-layout/DocumentLayout.tsx | 15 +- .../DocumentInspectorHeader.tsx | 19 +- .../document/documentInspector/Resizer.tsx | 1 - .../documentPanel/DeletedDocumentBanner.tsx | 5 +- .../documentPanel/ReferenceChangedBanner.tsx | 9 +- .../documentViews/FormHeader.tsx | 66 +++++ .../documentPanel/documentViews/FormView.tsx | 80 +++--- .../documentPanel/documentViews/styles.ts | 6 + .../header/DocumentHeaderTabs.tsx | 15 +- .../header/DocumentHeaderTitle.tsx | 1 + .../header/DocumentPanelHeader.tsx | 138 +++++----- .../sanity/src/desk/panes/document/index.ts | 1 + .../document/inspectDialog/InspectDialog.tsx | 9 +- .../inspectors/changes/ChangesInspector.tsx | 4 +- .../document/statusBar/ActionMenuButton.tsx | 101 +++---- .../document/statusBar/ActionStateDialog.tsx | 19 +- .../document/statusBar/DocumentStatusBar.tsx | 18 +- .../statusBar/DocumentStatusBarActions.tsx | 39 ++- .../__workshop__/DocumentStatusPulseStory.tsx | 23 ++ .../__workshop__/ReviewChangesButtonStory.tsx | 24 -- .../document/statusBar/__workshop__/index.ts | 6 +- .../statusBar/dialogs/ConfirmDialog.tsx | 2 +- .../statusBar/dialogs/ModalDialog.tsx | 12 +- .../document/statusBar/dialogs/constants.ts | 3 +- .../statusBar/sparkline/DocumentBadges.tsx | 11 +- .../statusBar/sparkline/DocumentSparkline.tsx | 87 +++---- .../AnimatedStatusIcon.tsx | 22 -- .../DocumentStatusPulse.tsx | 45 ++++ .../sparkline/DocumentStatusPulse/index.ts | 1 + .../statusBar/sparkline/IconBadge.tsx | 57 ---- .../ReviewChangesButton.tsx | 100 ------- .../sparkline/ReviewChangesButton/index.ts | 1 - .../panes/document/timeline/TimelineError.tsx | 2 +- .../desk/panes/document/timeline/timeline.tsx | 11 +- .../document/timeline/timelineItem.styled.tsx | 9 +- .../panes/document/timeline/timelineItem.tsx | 10 +- .../panes/document/timeline/timelineMenu.tsx | 9 +- .../desk/panes/document/useDocumentTitle.ts | 50 ++++ .../panes/documentList/DocumentListPane.tsx | 45 ++-- .../documentList/DocumentListPaneContent.tsx | 18 +- .../documentList/DocumentListPaneHeader.tsx | 48 ++-- .../src/desk/panes/list/ListPaneContent.tsx | 4 +- .../src/desk/panes/list/ListPaneHeader.tsx | 12 +- .../src/desk/panes/loading/LoadingPane.tsx | 13 +- .../userComponent/UserComponentPaneHeader.tsx | 12 +- .../src/ui/__workshop__/MenuItemStory.tsx | 106 ++++++++ packages/sanity/src/ui/__workshop__/index.ts | 14 + packages/sanity/src/ui/button/Button.tsx | 100 +++++++ packages/sanity/src/ui/button/index.ts | 1 + .../conditionalWrapper/ConditionalWrapper.tsx | 17 ++ .../sanity/src/ui/conditionalWrapper/index.ts | 1 + packages/sanity/src/ui/dialog/Dialog.tsx | 94 +++++++ packages/sanity/src/ui/dialog/index.ts | 1 + .../src/ui/documentStatus/DocumentStatus.tsx | 56 ++++ .../sanity/src/ui/documentStatus/index.ts | 1 + packages/sanity/src/ui/index.ts | 8 + .../src/ui/loadingBlock/LoadingBlock.tsx | 126 +++++++++ packages/sanity/src/ui/loadingBlock/index.ts | 1 + .../sanity/src/ui/menuGroup/MenuGroup.tsx | 19 ++ packages/sanity/src/ui/menuGroup/index.ts | 1 + packages/sanity/src/ui/menuItem/MenuItem.tsx | 160 ++++++++++++ packages/sanity/src/ui/menuItem/index.ts | 1 + packages/sanity/src/ui/tab/Tab.tsx | 50 ++++ packages/sanity/src/ui/tab/index.ts | 1 + packages/sanity/src/ui/tooltip/Tooltip.tsx | 62 +++++ .../src/ui/tooltip/TooltipWithNodes.tsx | 35 +++ packages/sanity/src/ui/tooltip/constants.ts | 3 + packages/sanity/src/ui/tooltip/index.ts | 2 + yarn.lock | 81 +++++- 394 files changed, 4648 insertions(+), 3896 deletions(-) create mode 100644 packages/sanity/src/core/components/collapseTabList/CollapseTabList.tsx create mode 100644 packages/sanity/src/core/components/collapseTabList/__workshop__/CollapseTabListStory.tsx create mode 100644 packages/sanity/src/core/components/collapseTabList/__workshop__/index.ts create mode 100644 packages/sanity/src/core/components/collapseTabList/index.ts create mode 100644 packages/sanity/src/core/components/previews/general/CompactPreview.tsx delete mode 100644 packages/sanity/src/core/form/components/FullscreenSpinner.tsx delete mode 100644 packages/sanity/src/core/form/components/SpinnerWithText.tsx create mode 100644 packages/sanity/src/core/hooks/useDocumentStatusTimeAgo.ts create mode 100644 packages/sanity/src/core/preview/__workshop__/SanityDefaultPreviewStory.tsx delete mode 100644 packages/sanity/src/core/studio/components/navbar/LogoButton.tsx create mode 100644 packages/sanity/src/core/studio/components/navbar/SanityLogo.tsx create mode 100644 packages/sanity/src/core/studio/components/navbar/search/SearchButton.tsx delete mode 100644 packages/sanity/src/core/studio/components/navbar/search/SearchField.tsx delete mode 100644 packages/sanity/src/core/studio/screens/LoadingScreen.tsx delete mode 100644 packages/sanity/src/desk/comments/src/components/TextTooltip.tsx create mode 100644 packages/sanity/src/desk/components/MissingDocumentTypesMessage.tsx create mode 100644 packages/sanity/src/desk/components/NotPublishedStatus.tsx create mode 100644 packages/sanity/src/desk/panes/document/documentPanel/documentViews/FormHeader.tsx create mode 100644 packages/sanity/src/desk/panes/document/documentPanel/documentViews/styles.ts create mode 100644 packages/sanity/src/desk/panes/document/statusBar/__workshop__/DocumentStatusPulseStory.tsx delete mode 100644 packages/sanity/src/desk/panes/document/statusBar/__workshop__/ReviewChangesButtonStory.tsx rename packages/sanity/src/desk/panes/document/statusBar/sparkline/{ReviewChangesButton => DocumentStatusPulse}/AnimatedStatusIcon.tsx (87%) create mode 100644 packages/sanity/src/desk/panes/document/statusBar/sparkline/DocumentStatusPulse/DocumentStatusPulse.tsx create mode 100644 packages/sanity/src/desk/panes/document/statusBar/sparkline/DocumentStatusPulse/index.ts delete mode 100644 packages/sanity/src/desk/panes/document/statusBar/sparkline/IconBadge.tsx delete mode 100644 packages/sanity/src/desk/panes/document/statusBar/sparkline/ReviewChangesButton/ReviewChangesButton.tsx delete mode 100644 packages/sanity/src/desk/panes/document/statusBar/sparkline/ReviewChangesButton/index.ts create mode 100644 packages/sanity/src/desk/panes/document/useDocumentTitle.ts create mode 100644 packages/sanity/src/ui/__workshop__/MenuItemStory.tsx create mode 100644 packages/sanity/src/ui/__workshop__/index.ts create mode 100644 packages/sanity/src/ui/button/Button.tsx create mode 100644 packages/sanity/src/ui/button/index.ts create mode 100644 packages/sanity/src/ui/conditionalWrapper/ConditionalWrapper.tsx create mode 100644 packages/sanity/src/ui/conditionalWrapper/index.ts create mode 100644 packages/sanity/src/ui/dialog/Dialog.tsx create mode 100644 packages/sanity/src/ui/dialog/index.ts create mode 100644 packages/sanity/src/ui/documentStatus/DocumentStatus.tsx create mode 100644 packages/sanity/src/ui/documentStatus/index.ts create mode 100644 packages/sanity/src/ui/index.ts create mode 100644 packages/sanity/src/ui/loadingBlock/LoadingBlock.tsx create mode 100644 packages/sanity/src/ui/loadingBlock/index.ts create mode 100644 packages/sanity/src/ui/menuGroup/MenuGroup.tsx create mode 100644 packages/sanity/src/ui/menuGroup/index.ts create mode 100644 packages/sanity/src/ui/menuItem/MenuItem.tsx create mode 100644 packages/sanity/src/ui/menuItem/index.ts create mode 100644 packages/sanity/src/ui/tab/Tab.tsx create mode 100644 packages/sanity/src/ui/tab/index.ts create mode 100644 packages/sanity/src/ui/tooltip/Tooltip.tsx create mode 100644 packages/sanity/src/ui/tooltip/TooltipWithNodes.tsx create mode 100644 packages/sanity/src/ui/tooltip/constants.ts create mode 100644 packages/sanity/src/ui/tooltip/index.ts diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 656272a4ff1..a92c3a8b9ef 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -231,6 +231,40 @@ const config = { '@sanity/i18n/no-attribute-template-literals': 'off', }, }, + + // Prefer local components vs certain @sanity/ui imports (in sanity package) + { + files: ['packages/sanity/**'], + rules: { + 'no-restricted-imports': [ + 'error', + { + paths: [ + { + name: '@sanity/ui', + importNames: [ + 'Button', + 'ButtonProps', + 'Dialog', + 'DialogProps', + 'MenuGroup', + 'MenuGroupProps', + 'MenuItem', + 'MenuItemProps', + 'Tab', + 'TabProps', + 'Tooltip', + 'TooltipProps', + 'TooltipWithNodes', + ], + message: + 'Please use the (more opinionated) exported components in sanity/src/ui instead.', + }, + ], + }, + ], + }, + }, ], } diff --git a/dev/design-studio/package.json b/dev/design-studio/package.json index 123d1be11fc..2180c5eacb0 100644 --- a/dev/design-studio/package.json +++ b/dev/design-studio/package.json @@ -31,8 +31,8 @@ "start": "../.bin/sanity start --port 4000" }, "dependencies": { - "@sanity/icons": "^2.6.0", - "@sanity/ui": "^1.9.3", + "@sanity/icons": "^2.7.0", + "@sanity/ui": "2.0.0-alpha.32", "react": "^18.2.0", "react-dom": "^18.2.0", "sanity": "3.22.1", diff --git a/dev/test-studio/assetSources/imageAssetSource.tsx b/dev/test-studio/assetSources/imageAssetSource.tsx index db3cbbbc015..b3354847f52 100644 --- a/dev/test-studio/assetSources/imageAssetSource.tsx +++ b/dev/test-studio/assetSources/imageAssetSource.tsx @@ -1,10 +1,10 @@ import {ImagesIcon} from '@sanity/icons' import {AssetSource, AssetSourceComponentProps} from '@sanity/types' -import {Box, Dialog, Text} from '@sanity/ui' -import React from 'react' +import {Text} from '@sanity/ui' +import {Dialog} from '../../../packages/sanity/src/ui' function ImageAssetSource(props: AssetSourceComponentProps) { - const {dialogHeaderTitle, onClose, ...restProps} = props + const {dialogHeaderTitle, onClose} = props return ( - - - (custom image asset source) - - + + (custom image asset source) + ) } diff --git a/dev/test-studio/components/formComponents.tsx b/dev/test-studio/components/formComponents.tsx index 00a78fce7e5..0b970318189 100644 --- a/dev/test-studio/components/formComponents.tsx +++ b/dev/test-studio/components/formComponents.tsx @@ -78,6 +78,13 @@ export function Preview(props: PreviewProps) { ) } +export function CustomBadge() { + return { + label: 'Hello world', + title: 'Hello I am a custom document badge', + } +} + export const formComponentsPlugin = definePlugin({ name: 'form-components-plugin', form: { diff --git a/dev/test-studio/documentActions/actions/TestCustomComponentAction.tsx b/dev/test-studio/documentActions/actions/TestCustomComponentAction.tsx index 3e213c15c63..434651c9db6 100644 --- a/dev/test-studio/documentActions/actions/TestCustomComponentAction.tsx +++ b/dev/test-studio/documentActions/actions/TestCustomComponentAction.tsx @@ -1,6 +1,7 @@ -import {Button, Card, Dialog, Stack, Text} from '@sanity/ui' +import {Text} from '@sanity/ui' import {DocumentActionComponent} from 'sanity' -import React, {useCallback, useState} from 'react' +import {useCallback, useState} from 'react' +import {Dialog} from '../../../../packages/sanity/src/ui' export const TestCustomComponentAction: DocumentActionComponent = () => { const [open, setOpen] = useState(false) @@ -19,15 +20,15 @@ export const TestCustomComponentAction: DocumentActionComponent = () => { onClickOutside={toggleOpen} onClose={toggleOpen} width={1} - footer={ - -