Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facelift/cherrypick title #5151

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ba120f1
feat(core): add placeholder inter typeface
robinpyon Sep 12, 2023
c4cb48e
chore(deps): update @sanity/ui
robinpyon Oct 10, 2023
0fc1020
chore(sanity): add no-restricted-imports rule for non-Studio UI compo…
robinpyon Oct 16, 2023
5d72047
feat(ui): initial reference studio UI tooltip component
robinpyon Oct 16, 2023
3c4dee0
fixup! feat(ui): initial reference studio UI tooltip component
robinpyon Oct 16, 2023
c9b044d
fixup! feat(ui): initial reference studio UI tooltip component
robinpyon Oct 16, 2023
d36dc68
fix: update `buildLegacyTheme` to satisfy updated color types
robinpyon Oct 17, 2023
cc29f14
fix(alpha-ui): support for breaking changes inside studio with new sa…
pedrobonamin Oct 19, 2023
cb05b1e
feat(facelift): create StudioUI tooltip with delay and replace (#5016)
ninaandal Oct 30, 2023
709d97d
chore(deps): update @sanity/ui
robinpyon Oct 31, 2023
8ed763a
feat(facelift): create menu item StudioUI (#5090)
pedrobonamin Nov 2, 2023
f6981e5
fix: remove label from workspace menu button
robinpyon Nov 2, 2023
2665927
chore: fix no-unescaped-entities eslint errors
robinpyon Nov 3, 2023
c929f04
chore: update snapshots
robinpyon Nov 3, 2023
5ae87ea
feat(facelift): implement Dialog into StudioUI (#5043)
pedrobonamin Nov 4, 2023
bdabb21
feat(facelift): add StudioUI <Button /> (#5118)
pedrobonamin Nov 4, 2023
6ba82f1
fix: reduce UI tooltip open delay
robinpyon Nov 4, 2023
caf7cfe
feat: remove navbar label usage
robinpyon Nov 4, 2023
65c46e6
refactor: omit padding from tooltip
robinpyon Nov 4, 2023
4bbc0ff
chore(deps): update @sanity/ui
robinpyon Nov 4, 2023
64671e4
fixup! refactor: omit padding from tooltip
robinpyon Nov 5, 2023
7c0678f
feat: reduce pane header font size
robinpyon Nov 5, 2023
41da3e9
feat: use medium weight for all form field + object headers
robinpyon Nov 5, 2023
8c73167
fix: remove max-width from new document + document preview presence t…
robinpyon Nov 5, 2023
29ed8c7
fix: use small buttons in comments PTE
robinpyon Nov 5, 2023
2fe73d1
feat: initial pass of new preview components, generalize published + …
robinpyon Nov 6, 2023
17b7066
feat: migrate all instances of EllipsisVerticalIcon to EllipsisHorizo…
robinpyon Nov 6, 2023
a33c232
fix: dont reference Studio UI components in @sanity/vision, update li…
robinpyon Nov 6, 2023
3972f12
fix: avoid circular dependencies with draft + published status compon…
robinpyon Nov 6, 2023
5e2ed6b
chore: update snapshots
robinpyon Nov 6, 2023
96426c7
feat(tab): add StudioUI Tab component (#5091)
ninaandal Nov 6, 2023
8888732
fix: force regular weight on all studio UI tooltips
robinpyon Nov 6, 2023
fcc6522
feat: globally change all instanes of semibold text to medium
robinpyon Nov 6, 2023
428c255
feat: replace all instances of <Label> with <Text>
robinpyon Nov 7, 2023
4b79c75
fixup! feat(tab): add StudioUI Tab component (#5091)
robinpyon Nov 7, 2023
9a4cfbe
feat(core): initial navbar pass (#5142)
ninaandal Nov 7, 2023
330656f
fix: remove unnecessary border from create new input, update schema w…
robinpyon Nov 7, 2023
2b8f21c
feat: initial pass of webkit-specific scrollbar styles
robinpyon Nov 8, 2023
442991e
fix: increase default media size, use correct sizes for detail text +…
robinpyon Nov 8, 2023
8b6ec25
fix: reduce list pane content divider vertical margins
robinpyon Nov 8, 2023
7da3a1c
feat(core): adds title to document panel (#4782)
binoy14 Aug 7, 2023
2880ba8
feat(core): avoid layout shift when editing title (#4828)
binoy14 Sep 12, 2023
9cc70c8
fix(desk): add interface to documentviews styles
ninaandal Nov 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
31 changes: 31 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,37 @@ module.exports = {
files: ['./test/**/*.js', './test/*.js', '*.test.{js,ts,tsx}'],
env: {jest: true},
},

// 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',
'MenuItem',
'MenuItemProps',
'Tab',
'TabProps',
'Tooltip',
'TooltipProps',
],
message:
'Please use the (more opinionated) exported components in sanity/src/ui instead.',
},
],
},
],
},
},
],

root: true,
Expand Down
2 changes: 1 addition & 1 deletion dev/design-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"dependencies": {
"@sanity/icons": "^2.6.0",
"@sanity/ui": "^1.8.3",
"@sanity/ui": "2.0.0-alpha.17",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sanity": "3.19.1",
Expand Down
14 changes: 6 additions & 8 deletions dev/test-studio/assetSources/imageAssetSource.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Dialog
Expand All @@ -13,11 +13,9 @@ function ImageAssetSource(props: AssetSourceComponentProps) {
onClose={onClose}
width={1}
>
<Box padding={4}>
<Text muted size={1} weight="medium">
(custom image asset source)
</Text>
</Box>
<Text muted size={1} weight="medium">
(custom image asset source)
</Text>
</Dialog>
)
}
Expand Down
7 changes: 7 additions & 0 deletions dev/test-studio/components/formComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<boolean>(false)
Expand All @@ -19,15 +20,15 @@ export const TestCustomComponentAction: DocumentActionComponent = () => {
onClickOutside={toggleOpen}
onClose={toggleOpen}
width={1}
footer={
<Stack padding={2}>
<Button onClick={toggleOpen} text="Close" />
</Stack>
}
footer={{
confirmButton: {
onClick: toggleOpen,
tone: 'default',
text: 'Close',
},
}}
>
<Card padding={5}>
<Text>This dialog is rendered using a custom dialog component.</Text>
</Card>
<Text size={1}>This dialog is rendered using a custom dialog component.</Text>
</Dialog>
),
},
Expand Down
2 changes: 1 addition & 1 deletion dev/test-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@sanity/portable-text-editor": "3.19.1",
"@sanity/tsdoc": "1.0.0-alpha.38",
"@sanity/types": "3.19.1",
"@sanity/ui": "^1.8.3",
"@sanity/ui": "2.0.0-alpha.17",
"@sanity/ui-workshop": "^1.0.0",
"@sanity/util": "3.19.1",
"@sanity/uuid": "^3.0.1",
Expand Down
3 changes: 2 additions & 1 deletion dev/test-studio/sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
import {
Annotation,
Block,
CustomBadge,
Field,
formComponentsPlugin,
InlineBlock,
Expand Down Expand Up @@ -74,10 +75,10 @@ const sharedSettings = definePlugin({
return prev
},
newDocumentOptions,

unstable_comments: {
enabled: true,
},
badges: (prev, context) => (context.schemaType === 'author' ? [CustomBadge, ...prev] : prev),
},
plugins: [
deskTool({
Expand Down
12 changes: 12 additions & 0 deletions dev/test-studio/schema/book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ export default {
},
],
},
{
name: 'genre',
title: 'Genre',
type: 'string',
options: {
list: [
{title: 'Fiction', value: 'fiction'},
{title: 'Non Fiction', value: 'nonfiction'},
{title: 'Poetry', value: 'poetry'},
],
},
},
],
orderings: [
{
Expand Down
2 changes: 1 addition & 1 deletion dev/test-studio/schema/debug/fieldComponentsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default {
description: (
<span>
Subtitle description <span style={{color: 'red'}}>x ← x - (JᵀJ + λIₙ༝ₙ)⁻¹ Jᵀr</span>
<script>window.alert('👻')</script>
<script>window.alert(&apos;👻&apos;)</script>
</span>
),
type: 'string',
Expand Down
2 changes: 1 addition & 1 deletion examples/ecommerce-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"@sanity/cli": "3.19.1",
"@sanity/ui": "^1.8.3",
"@sanity/ui": "2.0.0-alpha.17",
"react": "^18.2.0",
"react-barcode": "^1.4.1",
"react-dom": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/portable-text-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@playwright/test": "^1.38.1",
"@portabletext/toolkit": "^2.0.10",
"@sanity/diff-match-patch": "^3.1.1",
"@sanity/ui": "^1.8.3",
"@sanity/ui": "2.0.0-alpha.17",
"@testing-library/react": "^13.4.0",
"@types/debug": "^4.1.5",
"@types/express": "^4.16.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/vision/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@rexxars/react-split-pane": "^0.1.93",
"@sanity/color": "^2.1.20",
"@sanity/icons": "^2.6.0",
"@sanity/ui": "^1.8.3",
"@sanity/ui": "2.0.0-alpha.17",
"@uiw/react-codemirror": "^4.11.4",
"hashlru": "^2.3.0",
"is-hotkey": "^0.1.6",
Expand Down
4 changes: 2 additions & 2 deletions packages/@sanity/vision/src/components/PerspectivePopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export function PerspectivePopover() {

<Card>
<Text muted>
Perspectives allow your query to run against different "views" of the content in
your dataset
Perspectives allow your query to run against different &quot;views&quot; of the
content in your dataset
</Text>
</Card>

Expand Down
6 changes: 1 addition & 5 deletions packages/@sanity/vision/src/components/VisionGui.styled.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled, {css} from 'styled-components'
import {Button, Card, Box, Flex, Label, Theme, rem} from '@sanity/ui'
import {Card, Box, Flex, Label, rem} from '@sanity/ui'

export const Root = styled(Flex)`
.sidebarPanes .Pane {
Expand Down Expand Up @@ -154,7 +154,3 @@ export const TimingsTextContainer = styled(Flex)`
export const ControlsContainer = styled(Box)`
border-top: 1px solid var(--card-border-color);
`

export const ButtonFullWidth = styled(Button)`
width: 100%;
`
29 changes: 8 additions & 21 deletions packages/@sanity/vision/src/components/VisionGui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import {
ResultContainer,
Result,
ControlsContainer,
ButtonFullWidth,
TimingsFooter,
TimingsCard,
TimingsTextContainer,
Expand Down Expand Up @@ -754,13 +753,7 @@ export class VisionGui extends React.PureComponent<VisionGuiProps, VisionGuiStat
<Box flex={1}>
<TextInput readOnly type="url" ref={this._operationUrlElement} value={url} />
</Box>
<Tooltip
content={
<Box padding={2}>
<Text>Copy to clipboard</Text>
</Box>
}
>
<Tooltip content="Copy to clipboard">
<Button
aria-label="Copy to clipboard"
type="button"
Expand Down Expand Up @@ -825,15 +818,7 @@ export class VisionGui extends React.PureComponent<VisionGuiProps, VisionGuiStat
<Flex>
<StyledLabel muted>Params</StyledLabel>
{paramsError && (
<Tooltip
placement="top-end"
portal
content={
<Box padding={2}>
<Text>{paramsError}</Text>
</Box>
}
>
<Tooltip placement="top-end" portal content={paramsError}>
<Box padding={1} marginX={2}>
<Text>
<ErrorOutlineIcon />
Expand All @@ -850,7 +835,7 @@ export class VisionGui extends React.PureComponent<VisionGuiProps, VisionGuiStat
<Card padding={3} paddingX={3}>
<Tooltip
content={
<Card padding={2} radius={4}>
<Card radius={4}>
<Text size={1} muted>
Parameters are not valid JSON
</Text>
Expand All @@ -864,14 +849,15 @@ export class VisionGui extends React.PureComponent<VisionGuiProps, VisionGuiStat
<Box flex={1}>
<Tooltip
content={
<Card padding={2} radius={4}>
<Card radius={4}>
<Hotkeys keys={['Ctrl', 'Enter']} />
</Card>
}
placement="top"
portal
>
<ButtonFullWidth
<Button
width="fill"
onClick={this.handleQueryExecution}
type="button"
icon={queryInProgress ? StopIcon : PlayIcon}
Expand All @@ -882,7 +868,8 @@ export class VisionGui extends React.PureComponent<VisionGuiProps, VisionGuiStat
</Tooltip>
</Box>
<Box flex={1} marginLeft={3}>
<ButtonFullWidth
<Button
width="fill"
onClick={this.handleListenExecution}
type="button"
icon={listenInProgress ? StopIcon : PlayIcon}
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"@sanity/portable-text-editor": "3.19.1",
"@sanity/schema": "3.19.1",
"@sanity/types": "3.19.1",
"@sanity/ui": "^1.8.3",
"@sanity/ui": "2.0.0-alpha.17",
"@sanity/util": "3.19.1",
"@sanity/uuid": "^3.0.1",
"@tanstack/react-virtual": "3.0.0-beta.54",
Expand Down
20 changes: 19 additions & 1 deletion packages/sanity/src/core/components/DefaultDocument.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,24 @@ import {NoJavascript} from './NoJavascript'
import {GlobalErrorHandler} from './globalErrorHandler'
import {Favicons} from './Favicons'

// @todo: replace with fonts on our origin
const globalStyles = `
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url("https://rsms.me/inter/font-files/Inter-roman.var.woff2?v=3.19") format("woff2");
font-named-instance: 'Regular';
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 100 900;
font-display: swap;
src: url("https://rsms.me/inter/font-files/Inter-italic.var.woff2?v=3.19") format("woff2");
font-named-instance: 'Italic';
}
html {
background-color: #f1f3f6;
}
Expand Down Expand Up @@ -51,7 +68,8 @@ export function DefaultDocument(props: DefaultDocumentProps): React.ReactElement
{css.map((href) => (
<link key={href} rel="stylesheet" href={href} />
))}
<style>{globalStyles}</style>
{/* eslint-disable-next-line react/no-danger */}
<style dangerouslySetInnerHTML={{__html: globalStyles}} />
</head>
<body>
<div id="sanity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ export function InsufficientPermissionsMessage(props: InsufficientPermissionsMes
const plural = roles.length !== 1

return (
<Box padding={2}>
<Box>
<Inline space={2}>
<Text size={1}>
<AccessDeniedIcon />
</Text>
<Text weight="semibold">{title}</Text>
<Text weight="medium">{title}</Text>
</Inline>
<Inline marginTop={4}>
<Text size={1}>
<Text size={1} weight="medium">
{roles.length === 0 ? (
<>You have no role that grants you permission to {operationLabel}</>
) : (
Expand Down
8 changes: 3 additions & 5 deletions packages/sanity/src/core/components/IntentButton.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import {Button, ButtonProps} from '@sanity/ui'
import React, {HTMLProps} from 'react'
import React, {ComponentProps} from 'react'
import {Button} from '../../../src/ui'
import {IntentLink, IntentLinkProps} from 'sanity/router'

/**
*
* @hidden
* @beta
*/
export function IntentButton(
props: IntentLinkProps & ButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'as' | 'href' | 'ref'>,
) {
export function IntentButton(props: IntentLinkProps & ComponentProps<typeof Button>) {
return props.disabled ? (
<Button {...props} as="a" role="link" aria-disabled="true" />
) : (
Expand Down
Loading