@sanity/ui 0.38.2-next.14 → 0.38.2-next.16
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 +5 -4
- package/dist/sanity-ui.cjs +260 -10107
- package/dist/sanity-ui.cjs.map +1 -1
- package/dist/sanity-ui.js +260 -9983
- package/dist/sanity-ui.js.map +1 -1
- package/dist/types/src/index.d.ts +239 -227
- package/package.json +20 -17
- package/src/__workshop__/color/overview.tsx +1 -1
- 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 +1 -1
- package/src/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/components/breadcrumbs/__workshop__/example.tsx +1 -0
- package/src/components/breadcrumbs/breadcrumbs.tsx +9 -1
- package/src/components/dialog/__workshop__/autoFocus.tsx +1 -0
- package/src/components/dialog/__workshop__/layering.tsx +1 -0
- 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 +1 -0
- package/src/components/dialog/__workshop__/props.tsx +1 -1
- package/src/components/dialog/__workshop__/provider.tsx +1 -0
- package/src/components/dialog/dialog.tsx +1 -1
- package/src/components/dialog/dialogProvider.tsx +1 -1
- package/src/components/hotkeys/__workshop__/plain.tsx +1 -0
- 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 +1 -0
- package/src/components/menu/__workshop__/disableFocusOnClose.tsx +1 -0
- package/src/components/menu/__workshop__/groups.tsx +1 -0
- package/src/components/menu/__workshop__/menuButton.tsx +1 -0
- package/src/components/menu/__workshop__/menuGroupRight.tsx +1 -0
- package/src/components/menu/__workshop__/nestedMenu.tsx +1 -0
- 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 +1 -0
- package/src/components/menu/__workshop__/withoutArrow.tsx +1 -0
- package/src/components/menu/menu.test.tsx +5 -4
- package/src/components/menu/menu.tsx +1 -1
- package/src/components/menu/menuButton.tsx +9 -1
- package/src/components/menu/menuGroup.tsx +1 -1
- package/src/components/menu/menuItem.tsx +1 -1
- package/src/components/menu/useMenuController.ts +1 -1
- package/src/components/skeleton/__workshop__/delay.tsx +1 -0
- package/src/components/skeleton/__workshop__/skeleton.tsx +1 -0
- 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 +1 -1
- package/src/components/tab/tabList.tsx +1 -1
- package/src/components/tab/tabPanel.tsx +1 -1
- package/src/components/toast/__workshop__/hook.tsx +1 -0
- package/src/components/toast/__workshop__/toast.tsx +1 -0
- package/src/components/toast/toast.test.tsx +5 -3
- package/src/components/toast/toast.tsx +1 -0
- 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 +3 -3
- package/src/hooks/useElementRect/__workshop__/example.tsx +1 -0
- package/src/hooks/useForwardedRef.ts +1 -1
- package/src/hooks/useMediaIndex/__workshop__/test.tsx +1 -0
- package/src/icons/__workshop__/overview.tsx +1 -1
- package/src/primitives/avatar/__workshop__/asButton.tsx +1 -0
- package/src/primitives/avatar/__workshop__/stack.tsx +1 -0
- package/src/primitives/avatar/avatar.tsx +3 -2
- package/src/primitives/avatar/avatarCounter.tsx +1 -1
- package/src/primitives/avatar/avatarStack.tsx +1 -1
- package/src/primitives/badge/__workshop__/props.tsx +1 -0
- package/src/primitives/badge/__workshop__/tones.tsx +1 -0
- package/src/primitives/badge/badge.tsx +1 -1
- package/src/primitives/box/__workshop__/props.tsx +1 -0
- package/src/primitives/box/__workshop__/responsive.tsx +1 -0
- package/src/primitives/box/box.tsx +1 -1
- package/src/primitives/button/__workshop__/custom.tsx +1 -0
- package/src/primitives/button/__workshop__/customIcons.tsx +1 -0
- package/src/primitives/button/__workshop__/mixedChildren.tsx +1 -0
- package/src/primitives/button/__workshop__/props.tsx +1 -0
- package/src/primitives/button/__workshop__/sanityUploadButton.tsx +1 -0
- package/src/primitives/button/__workshop__/stacked.tsx +1 -0
- package/src/primitives/button/__workshop__/styled1.tsx +1 -0
- package/src/primitives/button/__workshop__/styled2.tsx +1 -0
- package/src/primitives/button/__workshop__/uploadButton.tsx +1 -1
- package/src/primitives/button/button.tsx +1 -1
- package/src/primitives/card/__workshop__/allTones.tsx +1 -0
- package/src/primitives/card/__workshop__/asButton.tsx +1 -0
- package/src/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/primitives/card/__workshop__/checkered.tsx +1 -0
- package/src/primitives/card/__workshop__/interactive.tsx +1 -0
- package/src/primitives/card/__workshop__/listNavigation.tsx +1 -0
- package/src/primitives/card/__workshop__/props.tsx +1 -0
- package/src/primitives/card/__workshop__/selected.tsx +1 -0
- package/src/primitives/card/__workshop__/styled.tsx +1 -0
- package/src/primitives/card/card.tsx +1 -1
- package/src/primitives/checkbox/__workshop__/example.tsx +1 -1
- package/src/primitives/checkbox/__workshop__/props.tsx +1 -0
- package/src/primitives/checkbox/__workshop__/readOnly.tsx +1 -0
- package/src/primitives/checkbox/__workshop__/tones.tsx +1 -0
- package/src/primitives/checkbox/checkbox.tsx +1 -1
- package/src/primitives/code/__workshop__/opticalAlignment.tsx +1 -0
- package/src/primitives/code/__workshop__/props.tsx +1 -0
- package/src/primitives/code/code.tsx +1 -1
- package/src/primitives/container/__workshop__/example.tsx +1 -0
- package/src/primitives/container/container.tsx +1 -1
- package/src/primitives/flex/__workshop__/example.tsx +1 -0
- package/src/primitives/flex/__workshop__/gap.tsx +1 -0
- package/src/primitives/flex/flex.tsx +1 -1
- package/src/primitives/grid/__workshop__/responsive.tsx +1 -0
- package/src/primitives/grid/grid.tsx +1 -1
- package/src/primitives/heading/__workshop__/opticalAlignment.tsx +1 -0
- package/src/primitives/heading/__workshop__/plain.tsx +1 -0
- package/src/primitives/heading/heading.tsx +1 -1
- package/src/primitives/inline/__workshop__/plain.tsx +1 -0
- package/src/primitives/inline/inline.tsx +1 -1
- package/src/primitives/kbd/__workshop__/plain.tsx +1 -0
- package/src/primitives/kbd/kbd.tsx +1 -1
- package/src/primitives/label/__workshop__/opticalAlignment.tsx +1 -0
- package/src/primitives/label/__workshop__/plain.tsx +1 -0
- package/src/primitives/label/label.tsx +1 -1
- package/src/primitives/popover/__workshop__/MarginsStory.tsx +1 -0
- package/src/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +1 -0
- 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 +9 -1
- package/src/primitives/radio/__workshop__/example.tsx +1 -1
- package/src/primitives/radio/__workshop__/plain.tsx +1 -0
- package/src/primitives/radio/radio.tsx +1 -1
- package/src/primitives/select/__workshop__/plain.tsx +1 -0
- package/src/primitives/select/__workshop__/readOnly.tsx +1 -0
- package/src/primitives/select/select.tsx +1 -1
- package/src/primitives/spinner/__workshop__/Props.tsx +1 -0
- package/src/primitives/spinner/spinner.tsx +1 -1
- package/src/primitives/stack/__workshop__/plain.tsx +1 -0
- 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 +1 -0
- package/src/primitives/text/__workshop__/example.tsx +1 -0
- package/src/primitives/text/__workshop__/opticalAlignment.tsx +1 -0
- package/src/primitives/text/text.tsx +1 -1
- package/src/primitives/textArea/__workshop__/plain.tsx +1 -0
- package/src/primitives/textArea/textArea.tsx +1 -1
- package/src/primitives/textInput/__workshop__/clearButton.tsx +1 -1
- package/src/primitives/textInput/__workshop__/customValidity.tsx +1 -0
- package/src/primitives/textInput/__workshop__/multipleTones.tsx +1 -0
- package/src/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/primitives/textInput/__workshop__/readOnly.tsx +1 -0
- package/src/primitives/textInput/__workshop__/states.tsx +1 -0
- package/src/primitives/textInput/__workshop__/tones.tsx +1 -0
- package/src/primitives/textInput/__workshop__/typed.tsx +1 -1
- package/src/primitives/textInput/textInput.tsx +1 -1
- package/src/primitives/tooltip/__workshop__/props.tsx +1 -0
- package/src/primitives/tooltip/tooltip.tsx +1 -1
- package/src/primitives/tooltip/tooltipArrow.tsx +1 -1
- package/src/styles/font/responsiveFont.ts +0 -13
- package/src/styles/helpers.ts +1 -1
- package/src/theme/__workshop__/canvas.tsx +1 -1
- package/src/theme/__workshop__/color.tsx +1 -0
- package/src/theme/__workshop__/layer.tsx +1 -1
- package/src/theme/__workshop__/nestedProvider.tsx +1 -0
- package/src/theme/theme.test.tsx +5 -3
- package/src/theme/themeColorProvider.tsx +1 -0
- package/src/theme/themeProvider.tsx +1 -1
- package/src/utils/boundaryElement/__workshop__/plain.tsx +1 -1
- package/src/utils/boundaryElement/boundaryElement.test.tsx +5 -3
- package/src/utils/boundaryElement/boundaryElementProvider.tsx +1 -1
- package/src/utils/elementQuery/__workshop__/customMedia.tsx +1 -0
- package/src/utils/elementQuery/elementQuery.tsx +1 -1
- package/src/utils/errorBoundary.tsx +4 -4
- package/src/utils/layer/__workshop__/_debug.tsx +1 -0
- package/src/utils/layer/__workshop__/multipleRoots.tsx +1 -0
- package/src/utils/layer/__workshop__/plain.tsx +1 -1
- package/src/utils/layer/__workshop__/responsiveZOffset.tsx +1 -0
- package/src/utils/layer/layer.test.tsx +5 -3
- 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 +5 -3
- package/src/utils/portal/portal.ts +3 -2
- 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/src/primitives/badge/badge.test.tsx +0 -13
- package/src/primitives/button/button.test.tsx +0 -41
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import {useId} from '@reach/auto-id'
|
|
1
2
|
import {ToggleArrowRightIcon} from '@sanity/icons'
|
|
2
|
-
import {createElement, memo, useCallback, useEffect,
|
|
3
|
+
import React, {createElement, memo, useCallback, useEffect, useMemo, useRef} from 'react'
|
|
3
4
|
import styled from 'styled-components'
|
|
4
5
|
import {Box, Flex, Text} from '../../primitives'
|
|
5
6
|
import {ThemeFontWeightKey} from '../../theme'
|
|
@@ -63,8 +64,7 @@ export const TreeItem = memo(function TreeItem(
|
|
|
63
64
|
const treeitemRef = useRef<HTMLDivElement | null>(null)
|
|
64
65
|
const tree = useTree()
|
|
65
66
|
const {path, registerItem, setExpanded, setFocusedElement} = tree
|
|
66
|
-
const
|
|
67
|
-
const id = idProp || _id
|
|
67
|
+
const id = useId(idProp) || idProp
|
|
68
68
|
const itemPath = useMemo(() => path.concat([id || '']), [id, path])
|
|
69
69
|
const itemKey = itemPath.join('/')
|
|
70
70
|
const itemState = tree.state[itemKey]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Icon, icons, IconSymbol, SearchIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Card, Code, Container, Flex, Heading, Stack, Text, TextInput} from '@sanity/ui'
|
|
3
|
-
import {useCallback, useMemo, useState} from 'react'
|
|
3
|
+
import React, {useCallback, useMemo, useState} from 'react'
|
|
4
4
|
import {packages} from '$packages'
|
|
5
5
|
|
|
6
6
|
function ucfirst(str: string) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {useId} from '@reach/auto-id'
|
|
2
|
+
import React, {forwardRef, useCallback, useEffect, useMemo, useState} from 'react'
|
|
2
3
|
import ReactIs from 'react-is'
|
|
3
4
|
import styled from 'styled-components'
|
|
4
5
|
import {useArrayProp} from '../../hooks'
|
|
@@ -70,7 +71,7 @@ export const Avatar = forwardRef(function Avatar(
|
|
|
70
71
|
const _sizeRem = avatarSize.size
|
|
71
72
|
const _radius = _sizeRem / 2
|
|
72
73
|
|
|
73
|
-
const elementId = useId()
|
|
74
|
+
const elementId = useId() || ''
|
|
74
75
|
const [arrowPosition, setArrowPosition] = useState<AvatarPosition | undefined>(
|
|
75
76
|
animateArrowFrom || arrowPositionProp || 'inside'
|
|
76
77
|
)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {icons} from '@sanity/icons'
|
|
2
2
|
import {Box, Button, Card, Container, Flex, Stack} from '@sanity/ui'
|
|
3
3
|
import {useAction, useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
4
|
+
import React from 'react'
|
|
4
5
|
import {
|
|
5
6
|
WORKSHOP_BUTTON_MODE_OPTIONS,
|
|
6
7
|
WORKSHOP_BUTTON_TONE_OPTIONS,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {createElement, forwardRef, isValidElement, useMemo} from 'react'
|
|
1
|
+
import React, {createElement, forwardRef, isValidElement, useMemo} from 'react'
|
|
2
2
|
import {isValidElementType} from 'react-is'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {CheckmarkIcon, RemoveIcon} from '@sanity/icons'
|
|
2
|
-
import {forwardRef, useEffect} from 'react'
|
|
2
|
+
import React, {forwardRef, useEffect} from 'react'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
4
|
import {useForwardedRef, useCustomValidity} from '../../hooks'
|
|
5
5
|
import {checkboxBaseStyles, inputElementStyles} from './styles'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {Box, Button, Container, Flex, Popover, Stack, Text} from '@sanity/ui'
|
|
2
2
|
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
3
|
+
import React from 'react'
|
|
3
4
|
import {WORKSHOP_PLACEMENT_OPTIONS} from '../../../__workshop__/constants'
|
|
4
5
|
|
|
5
6
|
export default function MatchReferenceWidthStory() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Button, Card, Popover, PortalProvider, Text} from '@sanity/ui'
|
|
2
2
|
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
3
|
-
import {useState} from 'react'
|
|
3
|
+
import React, {useState} from 'react'
|
|
4
4
|
import {
|
|
5
5
|
WORKSHOP_CONTAINER_WIDTH_OPTIONS,
|
|
6
6
|
WORKSHOP_PLACEMENT_OPTIONS,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ThemeColorToneKey,
|
|
8
8
|
useLayer,
|
|
9
9
|
} from '@sanity/ui'
|
|
10
|
-
import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
|
10
|
+
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
|
11
11
|
|
|
12
12
|
export default function RecursiveStory() {
|
|
13
13
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {EllipsisVerticalIcon} from '@sanity/icons'
|
|
2
2
|
import {Button, Card, Flex, Popover, Text, useClickOutside} from '@sanity/ui'
|
|
3
3
|
import {useBoolean} from '@sanity/ui-workshop'
|
|
4
|
-
import {useCallback, useState} from 'react'
|
|
4
|
+
import React, {useCallback, useState} from 'react'
|
|
5
5
|
|
|
6
6
|
export default function RightAlignedStory() {
|
|
7
7
|
const constrainSize = useBoolean('Constrain size', false)
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, {
|
|
2
|
+
cloneElement,
|
|
3
|
+
forwardRef,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
} from 'react'
|
|
2
10
|
import {usePopper} from 'react-popper'
|
|
3
11
|
import styled, {css} from 'styled-components'
|
|
4
12
|
import {EMPTY_RECORD} from '../../constants'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Box, Container, Flex, Radio, Stack, Text} from '@sanity/ui'
|
|
2
2
|
import {useBoolean} from '@sanity/ui-workshop'
|
|
3
|
-
import {useCallback, useState} from 'react'
|
|
3
|
+
import React, {useCallback, useState} from 'react'
|
|
4
4
|
|
|
5
5
|
export default function ExampleStory() {
|
|
6
6
|
const [value, setValue] = useState('first-option')
|