@sanity/ui 0.38.2 → 0.38.3-next.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/dist/sanity-ui.js +1 -1320
- package/dist/sanity-ui.js.map +1 -1
- package/dist/sanity-ui.mjs +2 -0
- package/dist/sanity-ui.mjs.map +1 -0
- package/dist/types/src/index.d.ts +228 -239
- package/package.json +23 -20
- package/src/__workshop__/color/overview.tsx +1 -1
- package/src/__workshop__/constants.ts +1 -0
- package/src/components/autocomplete/__workshop__/async.tsx +1 -1
- package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
- package/src/components/autocomplete/__workshop__/custom.tsx +1 -1
- package/src/components/autocomplete/__workshop__/example.tsx +1 -1
- package/src/components/autocomplete/__workshop__/focusAndBlur.tsx +1 -1
- package/src/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
- package/src/components/autocomplete/autocomplete.tsx +31 -33
- package/src/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/components/autocomplete/autocompleteReducer.ts +0 -3
- package/src/components/breadcrumbs/__workshop__/example.tsx +0 -1
- package/src/components/breadcrumbs/breadcrumbs.tsx +1 -9
- package/src/components/dialog/__workshop__/autoFocus.tsx +0 -1
- package/src/components/dialog/__workshop__/layering.tsx +0 -1
- package/src/components/dialog/__workshop__/nested.tsx +1 -1
- package/src/components/dialog/__workshop__/onScroll.tsx +1 -1
- package/src/components/dialog/__workshop__/position.tsx +0 -1
- package/src/components/dialog/__workshop__/props.tsx +1 -1
- package/src/components/dialog/__workshop__/provider.tsx +0 -1
- package/src/components/dialog/dialog.tsx +1 -1
- package/src/components/dialog/dialogProvider.tsx +1 -1
- package/src/components/hotkeys/__workshop__/plain.tsx +0 -1
- package/src/components/hotkeys/hotkeys.tsx +1 -1
- package/src/components/menu/__workshop__/asComponent.tsx +1 -1
- package/src/components/menu/__workshop__/closableMenuButton.tsx +1 -1
- package/src/components/menu/__workshop__/constrainedInBoundary.tsx +1 -1
- package/src/components/menu/__workshop__/customMenuItem.tsx +0 -1
- package/src/components/menu/__workshop__/disableFocusOnClose.tsx +0 -1
- package/src/components/menu/__workshop__/groups.tsx +0 -1
- package/src/components/menu/__workshop__/menuButton.tsx +0 -1
- package/src/components/menu/__workshop__/menuGroupRight.tsx +0 -1
- package/src/components/menu/__workshop__/nestedMenu.tsx +0 -1
- package/src/components/menu/__workshop__/onCloseMenuButton.tsx +1 -1
- package/src/components/menu/__workshop__/selectedItem.tsx +1 -1
- package/src/components/menu/__workshop__/tones.tsx +0 -1
- package/src/components/menu/__workshop__/withoutArrow.tsx +0 -1
- package/src/components/menu/menu.test.tsx +3 -4
- package/src/components/menu/menu.tsx +1 -1
- package/src/components/menu/menuButton.tsx +1 -9
- package/src/components/menu/menuGroup.tsx +2 -2
- package/src/components/menu/menuItem.tsx +3 -3
- package/src/components/menu/useMenuController.ts +1 -1
- package/src/components/skeleton/__workshop__/delay.tsx +0 -1
- package/src/components/skeleton/__workshop__/skeleton.tsx +0 -1
- package/src/components/skeleton/skeleton.tsx +1 -1
- package/src/components/skeleton/textSkeleton.tsx +1 -1
- package/src/components/tab/__workshop__/example.tsx +1 -1
- package/src/components/tab/tab.tsx +2 -2
- package/src/components/tab/tabList.tsx +1 -1
- package/src/components/tab/tabPanel.tsx +1 -1
- package/src/components/toast/__workshop__/hook.tsx +0 -1
- package/src/components/toast/__workshop__/toast.tsx +0 -1
- package/src/components/toast/toast.test.tsx +3 -5
- package/src/components/toast/toast.tsx +0 -1
- package/src/components/toast/toastProvider.tsx +1 -1
- package/src/components/tree/__workshop__/basic.tsx +1 -1
- package/src/components/tree/tree.tsx +1 -1
- package/src/components/tree/treeGroup.tsx +1 -1
- package/src/components/tree/treeItem.tsx +4 -4
- package/src/hooks/useElementRect/__workshop__/example.tsx +0 -1
- package/src/hooks/useForwardedRef.ts +1 -1
- package/src/hooks/useMediaIndex/__workshop__/test.tsx +0 -1
- package/src/icons/__workshop__/overview.tsx +1 -1
- package/src/primitives/avatar/__workshop__/asButton.tsx +0 -1
- package/src/primitives/avatar/__workshop__/stack.tsx +0 -1
- package/src/primitives/avatar/avatar.tsx +2 -3
- package/src/primitives/avatar/avatarCounter.tsx +1 -1
- package/src/primitives/avatar/avatarStack.tsx +1 -1
- package/src/primitives/badge/__workshop__/props.tsx +0 -1
- package/src/primitives/badge/__workshop__/tones.tsx +0 -1
- package/src/primitives/badge/badge.test.tsx +13 -0
- package/src/primitives/badge/badge.tsx +1 -1
- package/src/primitives/box/__workshop__/props.tsx +0 -1
- package/src/primitives/box/__workshop__/responsive.tsx +0 -1
- package/src/primitives/box/box.tsx +1 -1
- package/src/primitives/button/__workshop__/custom.tsx +0 -1
- package/src/primitives/button/__workshop__/customIcons.tsx +0 -1
- package/src/primitives/button/__workshop__/mixedChildren.tsx +0 -1
- package/src/primitives/button/__workshop__/props.tsx +0 -1
- package/src/primitives/button/__workshop__/sanityUploadButton.tsx +0 -1
- package/src/primitives/button/__workshop__/stacked.tsx +0 -1
- package/src/primitives/button/__workshop__/styled1.tsx +0 -1
- package/src/primitives/button/__workshop__/styled2.tsx +0 -1
- package/src/primitives/button/__workshop__/uploadButton.tsx +1 -1
- package/src/primitives/button/button.test.tsx +41 -0
- package/src/primitives/button/button.tsx +3 -3
- package/src/primitives/card/__workshop__/allTones.tsx +0 -1
- package/src/primitives/card/__workshop__/asButton.tsx +0 -1
- package/src/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/primitives/card/__workshop__/checkered.tsx +0 -1
- package/src/primitives/card/__workshop__/interactive.tsx +0 -1
- package/src/primitives/card/__workshop__/listNavigation.tsx +0 -1
- package/src/primitives/card/__workshop__/props.tsx +0 -1
- package/src/primitives/card/__workshop__/selected.tsx +0 -1
- package/src/primitives/card/__workshop__/styled.tsx +0 -1
- package/src/primitives/card/card.tsx +1 -1
- package/src/primitives/checkbox/__workshop__/example.tsx +1 -1
- package/src/primitives/checkbox/__workshop__/props.tsx +0 -1
- package/src/primitives/checkbox/__workshop__/readOnly.tsx +0 -1
- package/src/primitives/checkbox/__workshop__/tones.tsx +0 -1
- package/src/primitives/checkbox/checkbox.tsx +1 -1
- package/src/primitives/code/__workshop__/opticalAlignment.tsx +0 -1
- package/src/primitives/code/__workshop__/props.tsx +0 -1
- package/src/primitives/code/code.tsx +1 -1
- package/src/primitives/container/__workshop__/example.tsx +0 -1
- package/src/primitives/container/container.tsx +1 -1
- package/src/primitives/flex/__workshop__/example.tsx +0 -1
- package/src/primitives/flex/__workshop__/gap.tsx +0 -1
- package/src/primitives/flex/flex.tsx +1 -1
- package/src/primitives/grid/__workshop__/responsive.tsx +0 -1
- package/src/primitives/grid/grid.tsx +1 -1
- package/src/primitives/heading/__workshop__/opticalAlignment.tsx +0 -1
- package/src/primitives/heading/__workshop__/plain.tsx +0 -1
- package/src/primitives/heading/heading.tsx +1 -1
- package/src/primitives/inline/__workshop__/plain.tsx +0 -1
- package/src/primitives/inline/inline.tsx +1 -1
- package/src/primitives/kbd/__workshop__/plain.tsx +0 -1
- package/src/primitives/kbd/kbd.tsx +1 -1
- package/src/primitives/label/__workshop__/opticalAlignment.tsx +0 -1
- package/src/primitives/label/__workshop__/plain.tsx +0 -1
- package/src/primitives/label/label.tsx +1 -1
- package/src/primitives/popover/__workshop__/MarginsStory.tsx +0 -1
- package/src/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -1
- package/src/primitives/popover/__workshop__/PlainStory.tsx +1 -1
- package/src/primitives/popover/__workshop__/RecursiveStory.tsx +1 -1
- package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +1 -1
- package/src/primitives/popover/__workshop__/TestStory.tsx +1 -1
- package/src/primitives/popover/arrow.tsx +1 -1
- package/src/primitives/popover/popover.tsx +1 -9
- package/src/primitives/radio/__workshop__/example.tsx +1 -1
- package/src/primitives/radio/__workshop__/plain.tsx +0 -1
- package/src/primitives/radio/radio.tsx +1 -1
- package/src/primitives/select/__workshop__/plain.tsx +0 -1
- package/src/primitives/select/__workshop__/readOnly.tsx +0 -1
- package/src/primitives/select/select.tsx +1 -1
- package/src/primitives/spinner/__workshop__/Props.tsx +0 -1
- package/src/primitives/spinner/spinner.tsx +1 -1
- package/src/primitives/stack/__workshop__/plain.tsx +0 -1
- package/src/primitives/stack/stack.tsx +1 -1
- package/src/primitives/switch/__workshop__/example.tsx +1 -1
- package/src/primitives/switch/__workshop__/props.tsx +1 -1
- package/src/primitives/switch/switch.tsx +1 -1
- package/src/primitives/text/__workshop__/colored.tsx +0 -1
- package/src/primitives/text/__workshop__/example.tsx +0 -1
- package/src/primitives/text/__workshop__/opticalAlignment.tsx +0 -1
- package/src/primitives/text/text.tsx +1 -1
- package/src/primitives/textArea/__workshop__/plain.tsx +0 -1
- package/src/primitives/textArea/textArea.tsx +1 -1
- package/src/primitives/textInput/__workshop__/clearButton.tsx +1 -1
- package/src/primitives/textInput/__workshop__/customValidity.tsx +0 -1
- package/src/primitives/textInput/__workshop__/multipleTones.tsx +0 -1
- package/src/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/primitives/textInput/__workshop__/readOnly.tsx +0 -1
- package/src/primitives/textInput/__workshop__/states.tsx +0 -1
- package/src/primitives/textInput/__workshop__/tones.tsx +0 -1
- package/src/primitives/textInput/__workshop__/typed.tsx +1 -1
- package/src/primitives/textInput/textInput.tsx +4 -3
- package/src/primitives/tooltip/__workshop__/props.tsx +0 -1
- package/src/primitives/tooltip/tooltip.tsx +1 -1
- package/src/primitives/tooltip/tooltipArrow.tsx +1 -1
- package/src/styles/font/responsiveFont.ts +13 -0
- package/src/theme/__workshop__/canvas.tsx +1 -1
- package/src/theme/__workshop__/color.tsx +0 -1
- package/src/theme/__workshop__/layer.tsx +1 -1
- package/src/theme/__workshop__/nestedProvider.tsx +0 -1
- package/src/theme/theme.test.tsx +3 -5
- package/src/theme/themeColorProvider.tsx +0 -1
- package/src/theme/themeProvider.tsx +1 -1
- package/src/utils/boundaryElement/__workshop__/plain.tsx +1 -1
- package/src/utils/boundaryElement/boundaryElement.test.tsx +3 -5
- package/src/utils/boundaryElement/boundaryElementProvider.tsx +1 -1
- package/src/utils/elementQuery/__workshop__/customMedia.tsx +0 -1
- package/src/utils/elementQuery/elementQuery.tsx +1 -1
- package/src/utils/errorBoundary.tsx +4 -4
- package/src/utils/layer/__workshop__/_debug.tsx +0 -1
- package/src/utils/layer/__workshop__/multipleRoots.tsx +0 -1
- package/src/utils/layer/__workshop__/plain.tsx +1 -1
- package/src/utils/layer/__workshop__/responsiveZOffset.tsx +0 -1
- package/src/utils/layer/layer.test.tsx +3 -5
- package/src/utils/layer/layer.tsx +1 -1
- package/src/utils/layer/layerProvider.tsx +1 -1
- package/src/utils/portal/__workshop__/named.tsx +1 -1
- package/src/utils/portal/portal.test.tsx +3 -5
- package/src/utils/portal/portal.ts +2 -3
- package/src/utils/portal/portalProvider.tsx +1 -1
- package/src/utils/srOnly/srOnly.tsx +1 -1
- package/src/utils/virtualList/__workshop__/changingProps.tsx +1 -1
- package/src/utils/virtualList/__workshop__/elementScroll.tsx +1 -1
- package/src/utils/virtualList/__workshop__/infiniteList.tsx +1 -1
- package/src/utils/virtualList/__workshop__/windowScrolll.tsx +1 -1
- package/src/utils/virtualList/virtualList.tsx +1 -1
- package/dist/sanity-ui.cjs +0 -1321
- package/dist/sanity-ui.cjs.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {Component, PropsWithChildren} from 'react'
|
|
2
2
|
import {Code} from '../primitives/code'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* DO NOT USE IN PRODUCTION
|
|
6
6
|
* @beta
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type ErrorBoundaryProps = PropsWithChildren<{
|
|
9
9
|
onCatch: (params: {error: Error; info: React.ErrorInfo}) => void
|
|
10
|
-
}
|
|
10
|
+
}>
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* DO NOT USE IN PRODUCTION
|
|
@@ -21,7 +21,7 @@ export interface ErrorBoundaryState {
|
|
|
21
21
|
* DO NOT USE IN PRODUCTION
|
|
22
22
|
* @beta
|
|
23
23
|
*/
|
|
24
|
-
export class ErrorBoundary extends
|
|
24
|
+
export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
25
25
|
state: ErrorBoundaryState = {error: null}
|
|
26
26
|
|
|
27
27
|
static getDerivedStateFromError(error: Error): ErrorBoundaryState {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {CloseIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Button, Card, Flex, Layer, LayerProvider, Stack, Text} from '@sanity/ui'
|
|
3
|
-
import
|
|
3
|
+
import {useCallback, useState} from 'react'
|
|
4
4
|
import {LayerDebugInfo} from './_debug'
|
|
5
5
|
|
|
6
6
|
export default function PlainStory() {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {vi} from 'vitest'
|
|
3
1
|
import {render} from '../../../test'
|
|
4
2
|
import {LayerContext} from './layerContext'
|
|
5
3
|
import {LayerContextValue} from './types'
|
|
@@ -8,7 +6,7 @@ import {useLayer} from './useLayer'
|
|
|
8
6
|
describe('utils/layer', () => {
|
|
9
7
|
describe('useLayer', () => {
|
|
10
8
|
it('should get context value', async () => {
|
|
11
|
-
const log =
|
|
9
|
+
const log = jest.fn()
|
|
12
10
|
|
|
13
11
|
function Debug() {
|
|
14
12
|
const rootLayer = useLayer()
|
|
@@ -44,7 +42,7 @@ describe('utils/layer', () => {
|
|
|
44
42
|
})
|
|
45
43
|
|
|
46
44
|
it('should fail when no context value is provided', async () => {
|
|
47
|
-
const log =
|
|
45
|
+
const log = jest.fn()
|
|
48
46
|
|
|
49
47
|
function Debug() {
|
|
50
48
|
try {
|
|
@@ -72,7 +70,7 @@ describe('utils/layer', () => {
|
|
|
72
70
|
})
|
|
73
71
|
|
|
74
72
|
it('should fail when context value is not compatible', async () => {
|
|
75
|
-
const log =
|
|
73
|
+
const log = jest.fn()
|
|
76
74
|
|
|
77
75
|
function Debug() {
|
|
78
76
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {useCallback, useContext, useEffect, useMemo, useState} from 'react'
|
|
2
2
|
import {useMediaIndex, useArrayProp} from '../../hooks'
|
|
3
3
|
import {LayerContext} from './layerContext'
|
|
4
4
|
import {LayerContextValue} from './types'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Card, Container, Portal, PortalProvider, Stack, Text} from '@sanity/ui'
|
|
2
|
-
import
|
|
2
|
+
import {useState} from 'react'
|
|
3
3
|
|
|
4
4
|
export default function NamedStory() {
|
|
5
5
|
const [portal1Element, setPortal1Element] = useState<HTMLDivElement | null>(null)
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {vi} from 'vitest'
|
|
3
1
|
import {render} from '../../../test'
|
|
4
2
|
import {PortalContext} from './portalContext'
|
|
5
3
|
import {PortalContextValue} from './types'
|
|
@@ -8,7 +6,7 @@ import {usePortal} from './usePortal'
|
|
|
8
6
|
describe('utils/portal', () => {
|
|
9
7
|
describe('usePortal', () => {
|
|
10
8
|
it('should get context value', async () => {
|
|
11
|
-
const log =
|
|
9
|
+
const log = jest.fn()
|
|
12
10
|
|
|
13
11
|
function Debug() {
|
|
14
12
|
const rootPortal = usePortal()
|
|
@@ -40,7 +38,7 @@ describe('utils/portal', () => {
|
|
|
40
38
|
})
|
|
41
39
|
|
|
42
40
|
it('should fail when no context value is provided', async () => {
|
|
43
|
-
const log =
|
|
41
|
+
const log = jest.fn()
|
|
44
42
|
|
|
45
43
|
function Debug() {
|
|
46
44
|
try {
|
|
@@ -68,7 +66,7 @@ describe('utils/portal', () => {
|
|
|
68
66
|
})
|
|
69
67
|
|
|
70
68
|
it('should fail when context value is not compatible', async () => {
|
|
71
|
-
const log =
|
|
69
|
+
const log = jest.fn()
|
|
72
70
|
|
|
73
71
|
function Debug() {
|
|
74
72
|
try {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import ReactDOM from 'react-dom'
|
|
1
|
+
import {createPortal} from 'react-dom'
|
|
3
2
|
import {usePortal} from './usePortal'
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -26,5 +25,5 @@ export function Portal(props: PortalProps): React.ReactPortal | null {
|
|
|
26
25
|
return null
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
return
|
|
28
|
+
return createPortal(children, portalElement)
|
|
30
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {forwardRef, useEffect, useMemo, useRef, useState} from 'react'
|
|
2
2
|
import styled from 'styled-components'
|
|
3
3
|
import {_isScrollable} from '../../helpers'
|
|
4
4
|
import {useForwardedRef} from '../../hooks'
|