@sanity/ui 3.0.0-static.29 → 3.0.0-static.30
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 +1 -1
- package/dist/_chunks-cjs/_visual-editing.cjs +293 -293
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +294 -294
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/css/index.cjs.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.js.map +1 -1
- package/dist/index.cjs +47 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +48 -38
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +6 -6
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.js +6 -6
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +7 -7
- package/src/core/components/autocomplete/constants.ts +0 -2
- package/src/core/components/autocomplete/types.ts +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +6 -6
- package/src/core/components/dialog/__workshop__/activate.tsx +1 -2
- package/src/core/components/dialog/dialog.tsx +6 -5
- package/src/core/components/dialog/dialogCard.tsx +8 -8
- package/src/core/components/hotkeys/hotkeys.tsx +2 -2
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +1 -2
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -5
- package/src/core/components/menu/menu.tsx +3 -3
- package/src/core/components/menu/menuButton.tsx +2 -2
- package/src/core/components/menu/menuGroup.tsx +5 -5
- package/src/core/components/menu/menuItem.tsx +5 -5
- package/src/core/components/tab/tab.tsx +1 -1
- package/src/core/components/tab/tabList.tsx +1 -1
- package/src/core/components/tab/tabPanel.tsx +1 -1
- package/src/core/components/toast/toast.tsx +6 -6
- package/src/core/components/toast/toastLayer.tsx +2 -2
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/components/tree/tree.tsx +1 -1
- package/src/core/components/tree/treeGroup.tsx +1 -1
- package/src/core/components/tree/treeItem.tsx +5 -5
- package/src/core/components/virtualList/virtualList.tsx +1 -1
- package/src/core/index.ts +95 -44
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -9
- package/src/core/primitives/avatar/avatar.tsx +2 -2
- package/src/core/primitives/avatar/avatarCounter.tsx +2 -2
- package/src/core/primitives/avatar/avatarStack.tsx +1 -1
- package/src/core/primitives/badge/badge.tsx +2 -2
- package/src/core/primitives/button/__workshop__/disabled.tsx +1 -7
- package/src/core/primitives/button/button.tsx +3 -4
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +1 -3
- package/src/core/primitives/card/card.tsx +1 -1
- package/src/core/primitives/container/container.tsx +1 -1
- package/src/core/primitives/flex/flex.tsx +1 -1
- package/src/core/primitives/grid/grid.tsx +1 -1
- package/src/core/primitives/inline/inline.tsx +1 -1
- package/src/core/primitives/kbd/kbd.tsx +4 -4
- package/src/core/primitives/layer/layer.tsx +1 -1
- package/src/core/primitives/layer/layerCard.tsx +1 -1
- package/src/core/primitives/layer/layerProvider.tsx +1 -1
- package/src/core/primitives/popover/popover.tsx +6 -4
- package/src/core/primitives/popover/popoverLayer.tsx +3 -3
- package/src/core/primitives/root/Root.tsx +11 -16
- package/src/core/primitives/root/RootProvider.tsx +40 -0
- package/src/core/primitives/select/select.tsx +2 -2
- package/src/core/primitives/{_selectable → selectable}/selectable.tsx +1 -1
- package/src/core/primitives/spinner/spinner.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +1 -1
- package/src/core/primitives/switch/switch.tsx +1 -1
- package/src/core/primitives/textInput/textInput.tsx +3 -3
- package/src/core/primitives/tooltip/tooltip.test.tsx +2 -2
- package/src/core/primitives/tooltip/tooltip.tsx +6 -4
- package/src/core/primitives/tooltip/tooltipLayer.tsx +2 -2
- package/src/core/utils/errorBoundary.tsx +1 -1
- package/src/core/utils/portal/portal.tsx +2 -1
- package/src/css/components/dialog/dialog.ts +1 -1
- package/src/css/components/skeleton/skeleton.ts +3 -3
- package/src/css/components/skeleton/types.ts +3 -3
- package/src/css/defaultTheme.css.ts +1 -1
- package/src/css/index.ts +126 -69
- package/src/css/primitives/_input/input.ts +2 -2
- package/src/css/primitives/_input/types.ts +2 -2
- package/src/css/primitives/_selectable/selectable.ts +1 -1
- package/src/css/primitives/_selectable/types.ts +1 -1
- package/src/css/primitives/avatar/avatar.ts +1 -1
- package/src/css/primitives/box/box.ts +35 -35
- package/src/css/primitives/box/types.ts +34 -34
- package/src/css/primitives/button/button.css.ts +8 -8
- package/src/css/primitives/button/button.ts +4 -4
- package/src/css/primitives/button/types.ts +3 -3
- package/src/css/primitives/card/__workshop__/color.tsx +8 -3
- package/src/css/primitives/code/code.ts +3 -3
- package/src/css/primitives/code/types.ts +2 -2
- package/src/css/primitives/container/container.ts +3 -3
- package/src/css/primitives/heading/heading.ts +4 -4
- package/src/css/primitives/heading/types.ts +3 -3
- package/src/css/primitives/kbd/kbd.ts +1 -1
- package/src/css/primitives/kbd/types.ts +1 -1
- package/src/css/primitives/label/label.ts +4 -4
- package/src/css/primitives/label/types.ts +3 -3
- package/src/css/primitives/root/root.ts +2 -2
- package/src/css/primitives/root/types.ts +1 -1
- package/src/css/primitives/select/select.ts +1 -1
- package/src/css/primitives/select/types.ts +1 -1
- package/src/css/primitives/text/text.ts +5 -5
- package/src/css/primitives/text/types.ts +4 -4
- package/src/css/primitives/textArea/textArea.ts +1 -1
- package/src/css/primitives/textArea/types.ts +1 -1
- package/src/css/primitives/textInput/textInput.ts +1 -1
- package/src/css/primitives/textInput/types.ts +1 -1
- package/src/css/primitives/tooltip/tooltip.css.ts +1 -3
- package/src/css/primitives/tooltip/tooltip.ts +0 -2
- package/src/theme/v3/defaultTokens.ts +6 -6
- package/src/core/_compat/index.ts +0 -4
- package/src/core/_compat/styles/index.ts +0 -1
- package/src/core/_compat/theme/index.ts +0 -5
- package/src/core/components/breadcrumbs/index.ts +0 -1
- package/src/core/components/dialog/index.ts +0 -5
- package/src/core/components/hotkeys/index.ts +0 -1
- package/src/core/components/menu/index.ts +0 -5
- package/src/core/components/tab/index.ts +0 -3
- package/src/core/components/toast/index.ts +0 -4
- package/src/core/components/tree/index.ts +0 -4
- package/src/core/components/virtualList/index.ts +0 -1
- package/src/core/hooks/useElementRect/index.ts +0 -1
- package/src/core/hooks/useMediaIndex/index.ts +0 -1
- package/src/core/primitives/_selectable/index.ts +0 -2
- package/src/core/primitives/arrow/index.ts +0 -1
- package/src/core/primitives/avatar/index.ts +0 -4
- package/src/core/primitives/badge/index.ts +0 -1
- package/src/core/primitives/badge/types2.ts +0 -10
- package/src/core/primitives/box/index.ts +0 -2
- package/src/core/primitives/button/index.ts +0 -2
- package/src/core/primitives/card/index.ts +0 -4
- package/src/core/primitives/checkbox/index.ts +0 -1
- package/src/core/primitives/code/index.ts +0 -1
- package/src/core/primitives/container/index.ts +0 -2
- package/src/core/primitives/flex/index.ts +0 -2
- package/src/core/primitives/grid/index.ts +0 -2
- package/src/core/primitives/heading/index.ts +0 -1
- package/src/core/primitives/inline/index.ts +0 -1
- package/src/core/primitives/inline/types.ts +0 -7
- package/src/core/primitives/kbd/index.ts +0 -1
- package/src/core/primitives/label/index.ts +0 -1
- package/src/core/primitives/layer/index.ts +0 -4
- package/src/core/primitives/popover/index.ts +0 -2
- package/src/core/primitives/radio/index.ts +0 -1
- package/src/core/primitives/root/index.ts +0 -1
- package/src/core/primitives/select/index.ts +0 -1
- package/src/core/primitives/skeleton/index.ts +0 -5
- package/src/core/primitives/spinner/index.ts +0 -1
- package/src/core/primitives/srOnly/index.ts +0 -1
- package/src/core/primitives/stack/index.ts +0 -1
- package/src/core/primitives/switch/index.ts +0 -1
- package/src/core/primitives/text/index.ts +0 -1
- package/src/core/primitives/textArea/index.ts +0 -1
- package/src/core/primitives/textInput/index.ts +0 -1
- package/src/core/primitives/tooltip/index.ts +0 -2
- package/src/core/utils/boundaryElement/index.ts +0 -3
- package/src/core/utils/elementQuery/index.ts +0 -1
- package/src/core/utils/portal/index.ts +0 -4
- package/src/css/components/breadcrumbs/index.ts +0 -1
- package/src/css/components/dialog/index.ts +0 -1
- package/src/css/components/menu/index.ts +0 -1
- package/src/css/components/skeleton/index.ts +0 -2
- package/src/css/components/toast/index.ts +0 -1
- package/src/css/components/tree/index.ts +0 -1
- package/src/css/primitives/_arrow/index.ts +0 -1
- package/src/css/primitives/_input/index.ts +0 -2
- package/src/css/primitives/_selectable/index.ts +0 -2
- package/src/css/primitives/avatar/index.ts +0 -2
- package/src/css/primitives/badge/index.ts +0 -2
- package/src/css/primitives/box/index.ts +0 -2
- package/src/css/primitives/button/index.ts +0 -2
- package/src/css/primitives/card/index.ts +0 -2
- package/src/css/primitives/checkbox/index.ts +0 -1
- package/src/css/primitives/code/index.ts +0 -2
- package/src/css/primitives/container/index.ts +0 -2
- package/src/css/primitives/heading/index.ts +0 -2
- package/src/css/primitives/kbd/index.ts +0 -2
- package/src/css/primitives/label/index.ts +0 -2
- package/src/css/primitives/popover/index.ts +0 -1
- package/src/css/primitives/radio/index.ts +0 -1
- package/src/css/primitives/root/index.ts +0 -2
- package/src/css/primitives/select/index.ts +0 -2
- package/src/css/primitives/spinner/index.ts +0 -2
- package/src/css/primitives/srOnly/index.ts +0 -1
- package/src/css/primitives/stack/index.ts +0 -1
- package/src/css/primitives/switch/index.ts +0 -1
- package/src/css/primitives/text/index.ts +0 -2
- package/src/css/primitives/textArea/index.ts +0 -2
- package/src/css/primitives/textInput/index.ts +0 -2
- package/src/css/primitives/tooltip/index.ts +0 -2
- package/src/css/props/alignItems/index.ts +0 -2
- package/src/css/props/border/index.ts +0 -2
- package/src/css/props/boxSizing/index.ts +0 -2
- package/src/css/props/display/index.ts +0 -2
- package/src/css/props/flex/index.ts +0 -2
- package/src/css/props/flexDirection/index.ts +0 -2
- package/src/css/props/flexWrap/index.ts +0 -2
- package/src/css/props/font/index.ts +0 -2
- package/src/css/props/gap/index.ts +0 -2
- package/src/css/props/gridAutoColumns/index.ts +0 -2
- package/src/css/props/gridAutoFlow/index.ts +0 -2
- package/src/css/props/gridAutoRows/index.ts +0 -2
- package/src/css/props/gridColumn/index.ts +0 -2
- package/src/css/props/gridColumnEnd/index.ts +0 -2
- package/src/css/props/gridColumnStart/index.ts +0 -2
- package/src/css/props/gridRow/index.ts +0 -2
- package/src/css/props/gridRowEnd/index.ts +0 -2
- package/src/css/props/gridRowStart/index.ts +0 -2
- package/src/css/props/gridTemplateColumns/index.ts +0 -2
- package/src/css/props/gridTemplateRows/index.ts +0 -2
- package/src/css/props/height/index.ts +0 -2
- package/src/css/props/inset/index.ts +0 -2
- package/src/css/props/justifyContent/index.ts +0 -2
- package/src/css/props/margin/index.ts +0 -2
- package/src/css/props/maxWidth/index.ts +0 -2
- package/src/css/props/minHeight/index.ts +0 -2
- package/src/css/props/minWidth/index.ts +0 -2
- package/src/css/props/outline/index.ts +0 -2
- package/src/css/props/overflow/index.ts +0 -2
- package/src/css/props/padding/index.ts +0 -2
- package/src/css/props/pointerEvents/index.ts +0 -2
- package/src/css/props/position/index.ts +0 -2
- package/src/css/props/radius/index.ts +0 -2
- package/src/css/props/shadow/index.ts +0 -2
- package/src/css/props/textAlign/index.ts +0 -2
- package/src/css/props/textOverflow/index.ts +0 -2
- package/src/css/props/width/index.ts +0 -2
- /package/src/core/primitives/{_selectable → selectable}/types.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {card, type CardStyleProps} from '@sanity/ui/css'
|
|
2
2
|
|
|
3
3
|
import type {Props} from '../../types/props'
|
|
4
|
-
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
4
|
+
import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
|
|
5
5
|
import {CardProvider} from './cardProvider'
|
|
6
6
|
import {useCard} from './useCard'
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {container, type ContainerStyleProps} from '@sanity/ui/css'
|
|
2
2
|
|
|
3
3
|
import type {Props} from '../../types/props'
|
|
4
|
-
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
4
|
+
import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
|
|
5
5
|
|
|
6
6
|
/** @public */
|
|
7
7
|
export const DEFAULT_CONTAINER_ELEMENT = 'div'
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
} from '@sanity/ui/css'
|
|
8
8
|
|
|
9
9
|
import type {Props} from '../../types/props'
|
|
10
|
-
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
10
|
+
import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
|
|
11
11
|
|
|
12
12
|
/** @public */
|
|
13
13
|
export const DEFAULT_FLEX_ELEMENT = 'div'
|
|
@@ -2,7 +2,7 @@ import type {ResponsiveProp} from '@sanity/ui/css'
|
|
|
2
2
|
import type {Space} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
4
|
import type {Props} from '../../types/props'
|
|
5
|
-
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
5
|
+
import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
|
|
6
6
|
|
|
7
7
|
/** @public */
|
|
8
8
|
export const DEFAULT_INLINE_ELEMENT = 'div'
|
|
@@ -2,8 +2,8 @@ import {kbd, type RadiusStyleProps, type ResponsiveProp} from '@sanity/ui/css'
|
|
|
2
2
|
import type {FontTextSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
4
|
import type {ComponentType, Props} from '../../types/props'
|
|
5
|
-
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
6
|
-
import {Text} from '../text'
|
|
5
|
+
import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
|
|
6
|
+
import {Text} from '../text/text'
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
9
|
export const DEFAULT_KBD_ELEMENT = 'kbd'
|
|
@@ -31,7 +31,7 @@ export function KBD<E extends KBDElementType = typeof DEFAULT_KBD_ELEMENT>(props
|
|
|
31
31
|
children,
|
|
32
32
|
className,
|
|
33
33
|
display = 'inline-block',
|
|
34
|
-
fontSize =
|
|
34
|
+
fontSize = 1,
|
|
35
35
|
padding = 1,
|
|
36
36
|
radius = 2,
|
|
37
37
|
...rest
|
|
@@ -47,7 +47,7 @@ export function KBD<E extends KBDElementType = typeof DEFAULT_KBD_ELEMENT>(props
|
|
|
47
47
|
muted
|
|
48
48
|
padding={padding}
|
|
49
49
|
>
|
|
50
|
-
<Text as="span" muted size={fontSize} weight="
|
|
50
|
+
<Text as="span" muted size={fontSize} weight="medium">
|
|
51
51
|
{children}
|
|
52
52
|
</Text>
|
|
53
53
|
</Box>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {ResponsiveProp} from '@sanity/ui/css'
|
|
2
2
|
|
|
3
|
-
import type {CardElementType, CardOwnProps} from '../../primitives/card'
|
|
3
|
+
import type {CardElementType, CardOwnProps} from '../../primitives/card/card'
|
|
4
4
|
import type {Props} from '../../types/props'
|
|
5
5
|
import {LayerCard} from './layerCard'
|
|
6
6
|
import {LayerProvider} from './layerProvider'
|
|
@@ -2,7 +2,7 @@ import {type FocusEvent, useCallback, useEffect, useImperativeHandle, useRef} fr
|
|
|
2
2
|
|
|
3
3
|
import {EMPTY_RECORD} from '../../constants'
|
|
4
4
|
import {containsOrEqualsElement, isHTMLElement} from '../../helpers/element'
|
|
5
|
-
import {Card, type CardElementType} from '../../primitives/card'
|
|
5
|
+
import {Card, type CardElementType} from '../../primitives/card/card'
|
|
6
6
|
import type {Props} from '../../types/props'
|
|
7
7
|
import type {LayerElementType, LayerOwnProps} from './layer'
|
|
8
8
|
import {useLayer} from './useLayer'
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useState,
|
|
10
10
|
} from 'react'
|
|
11
11
|
|
|
12
|
-
import {useMediaIndex} from '../../hooks/useMediaIndex'
|
|
12
|
+
import {useMediaIndex} from '../../hooks/useMediaIndex/useMediaIndex'
|
|
13
13
|
import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
14
14
|
import {getLayerContext} from './getLayerContext'
|
|
15
15
|
import {LayerContext} from './layerContext'
|
|
@@ -30,10 +30,12 @@ import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
|
30
30
|
import {origin} from '../../middleware/origin'
|
|
31
31
|
import type {Placement} from '../../types/placement'
|
|
32
32
|
import type {ComponentType, Props} from '../../types/props'
|
|
33
|
-
import {useBoundaryElement} from '../../utils/boundaryElement'
|
|
34
|
-
import {Portal} from '../../utils/portal'
|
|
35
|
-
import {CardProvider
|
|
36
|
-
import {
|
|
33
|
+
import {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'
|
|
34
|
+
import {Portal} from '../../utils/portal/portal'
|
|
35
|
+
import {CardProvider} from '../card/cardProvider'
|
|
36
|
+
import {useCard} from '../card/useCard'
|
|
37
|
+
import {type LayerOwnProps} from '../layer/layer'
|
|
38
|
+
import {useLayer} from '../layer/useLayer'
|
|
37
39
|
import {
|
|
38
40
|
DEFAULT_FALLBACK_PLACEMENTS,
|
|
39
41
|
DEFAULT_POPOVER_DISTANCE,
|
|
@@ -5,9 +5,9 @@ import {type CSSProperties, type ForwardedRef, useMemo} from 'react'
|
|
|
5
5
|
|
|
6
6
|
import {POPOVER_MOTION_PROPS} from '../../constants'
|
|
7
7
|
import type {Placement} from '../../types/placement'
|
|
8
|
-
import {Arrow} from '../arrow'
|
|
9
|
-
import {Flex} from '../flex'
|
|
10
|
-
import {Layer, type LayerOwnProps, type LayerProps} from '../layer'
|
|
8
|
+
import {Arrow} from '../arrow/arrow'
|
|
9
|
+
import {Flex} from '../flex/flex'
|
|
10
|
+
import {Layer, type LayerOwnProps, type LayerProps} from '../layer/layer'
|
|
11
11
|
import {
|
|
12
12
|
DEFAULT_POPOVER_ARROW_HEIGHT,
|
|
13
13
|
DEFAULT_POPOVER_ARROW_RADIUS,
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import {box, root, type RootStyleProps} from '@sanity/ui/css'
|
|
2
2
|
import {useCallback, useImperativeHandle, useRef, useState} from 'react'
|
|
3
3
|
|
|
4
|
-
import {ToastProvider} from '../../components/toast'
|
|
5
4
|
import type {Props} from '../../types/props'
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {Box, type BoxOwnProps} from '../box'
|
|
9
|
-
import {CardProvider} from '../card'
|
|
10
|
-
import {LayerProvider} from '../layer'
|
|
5
|
+
import {Box, type BoxOwnProps} from '../box/box'
|
|
6
|
+
import {RootProvider} from './RootProvider'
|
|
11
7
|
|
|
12
8
|
/** @public */
|
|
13
9
|
export const DEFAULT_ROOT_ELEMENT = 'html'
|
|
@@ -54,16 +50,15 @@ export function Root<E extends RootElementType = typeof DEFAULT_ROOT_ELEMENT>(pr
|
|
|
54
50
|
}, [])
|
|
55
51
|
|
|
56
52
|
let node = (
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
</LayerProvider>
|
|
53
|
+
<RootProvider
|
|
54
|
+
boundaryElement={boundaryElement}
|
|
55
|
+
portalElement={portalElement}
|
|
56
|
+
scheme={scheme}
|
|
57
|
+
tone={tone}
|
|
58
|
+
>
|
|
59
|
+
{children}
|
|
60
|
+
<div data-portal="" ref={setPortalElement} />
|
|
61
|
+
</RootProvider>
|
|
67
62
|
)
|
|
68
63
|
|
|
69
64
|
if (as === 'html') {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type {ThemeColorCardToneKey, ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
2
|
+
import type {ReactNode} from 'react'
|
|
3
|
+
|
|
4
|
+
import {ToastProvider} from '../../components/toast/toastProvider'
|
|
5
|
+
import {BoundaryElementProvider} from '../../utils/boundaryElement/boundaryElementProvider'
|
|
6
|
+
import {PortalProvider} from '../../utils/portal/portalProvider'
|
|
7
|
+
import {CardProvider} from '../card/cardProvider'
|
|
8
|
+
import {LayerProvider} from '../layer/layerProvider'
|
|
9
|
+
|
|
10
|
+
/** @public */
|
|
11
|
+
export interface RootProviderProps {
|
|
12
|
+
boundaryElement?: HTMLElement | null
|
|
13
|
+
children?: ReactNode
|
|
14
|
+
portalElement?: HTMLElement | null
|
|
15
|
+
scheme?: ThemeColorSchemeKey
|
|
16
|
+
tone?: ThemeColorCardToneKey
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** @public */
|
|
20
|
+
export function RootProvider(props: RootProviderProps) {
|
|
21
|
+
const {
|
|
22
|
+
boundaryElement = null,
|
|
23
|
+
children,
|
|
24
|
+
portalElement = null,
|
|
25
|
+
scheme = 'light',
|
|
26
|
+
tone = 'transparent',
|
|
27
|
+
} = props
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<LayerProvider>
|
|
31
|
+
<CardProvider scheme={scheme} tone={tone}>
|
|
32
|
+
<ToastProvider>
|
|
33
|
+
<BoundaryElementProvider element={boundaryElement}>
|
|
34
|
+
<PortalProvider element={portalElement}>{children}</PortalProvider>
|
|
35
|
+
</BoundaryElementProvider>
|
|
36
|
+
</ToastProvider>
|
|
37
|
+
</CardProvider>
|
|
38
|
+
</LayerProvider>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -11,8 +11,8 @@ import {useImperativeHandle, useRef} from 'react'
|
|
|
11
11
|
|
|
12
12
|
import {useCustomValidity} from '../../hooks/useCustomValidity'
|
|
13
13
|
import type {ComponentType, Props} from '../../types/props'
|
|
14
|
-
import {Box} from '../box'
|
|
15
|
-
import {Text} from '../text'
|
|
14
|
+
import {Box} from '../box/box'
|
|
15
|
+
import {Text} from '../text/text'
|
|
16
16
|
|
|
17
17
|
/** @public */
|
|
18
18
|
export const DEFAULT_SELECT_ELEMENT = 'select'
|
|
@@ -2,7 +2,7 @@ import {_selectable, type SelectableStyleProps} from '@sanity/ui/css'
|
|
|
2
2
|
import type {ThemeColorStateToneKey} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
4
|
import type {ComponentType, Props} from '../../types/props'
|
|
5
|
-
import {Box, type BoxOwnProps} from '../box'
|
|
5
|
+
import {Box, type BoxOwnProps} from '../box/box'
|
|
6
6
|
|
|
7
7
|
/** @internal */
|
|
8
8
|
export const DEFAULT_SELECTABLE_ELEMENT = 'button'
|
|
@@ -2,7 +2,7 @@ import {type ResponsiveProp, spinner} from '@sanity/ui/css'
|
|
|
2
2
|
import type {FontTextSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
4
|
import type {ComponentType, Props} from '../../types/props'
|
|
5
|
-
import {Text} from '../text'
|
|
5
|
+
import {Text} from '../text/text'
|
|
6
6
|
import {AnimatedSpinnerIcon} from './animatedSpinnerIcon'
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
@@ -2,7 +2,7 @@ import {type ResponsiveProp, stack} from '@sanity/ui/css'
|
|
|
2
2
|
import type {Space} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
4
|
import type {Props} from '../../types/props'
|
|
5
|
-
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
5
|
+
import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
|
|
6
6
|
|
|
7
7
|
/** @public */
|
|
8
8
|
export const DEFAULT_STACK_ELEMENT = 'div'
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {useEffect, useImperativeHandle, useRef} from 'react'
|
|
9
9
|
|
|
10
10
|
import type {ComponentType, Props} from '../../types/props'
|
|
11
|
-
import {Box} from '../box'
|
|
11
|
+
import {Box} from '../box/box'
|
|
12
12
|
|
|
13
13
|
/** @public */
|
|
14
14
|
export const DEFAULT_SWITCH_ELEMENT = 'input'
|
|
@@ -27,9 +27,9 @@ import {useCustomValidity} from '../../hooks/useCustomValidity'
|
|
|
27
27
|
import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
28
28
|
import {isRecord} from '../../lib/isRecord'
|
|
29
29
|
import type {ComponentType, Props} from '../../types/props'
|
|
30
|
-
import {Box} from '../box'
|
|
31
|
-
import {Button, type ButtonProps} from '../button'
|
|
32
|
-
import {Text} from '../text'
|
|
30
|
+
import {Box} from '../box/box'
|
|
31
|
+
import {Button, type ButtonProps} from '../button/button'
|
|
32
|
+
import {Text} from '../text/text'
|
|
33
33
|
|
|
34
34
|
/** @public */
|
|
35
35
|
export const DEFAULT_TEXT_INPUT_ELEMENT = 'input'
|
|
@@ -5,8 +5,8 @@ import {act, fireEvent, screen} from '@testing-library/react'
|
|
|
5
5
|
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'
|
|
6
6
|
|
|
7
7
|
import {render} from '../../../../test'
|
|
8
|
-
import {Button} from '../button'
|
|
9
|
-
import {Text} from '../text'
|
|
8
|
+
import {Button} from '../button/button'
|
|
9
|
+
import {Text} from '../text/text'
|
|
10
10
|
import {Tooltip} from './tooltip'
|
|
11
11
|
import {TooltipDelayGroupProvider} from './tooltipDelayGroup'
|
|
12
12
|
|
|
@@ -36,11 +36,13 @@ import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
|
|
|
36
36
|
import {origin} from '../../middleware/origin'
|
|
37
37
|
import type {Placement} from '../../types/placement'
|
|
38
38
|
import type {ComponentType, Props} from '../../types/props'
|
|
39
|
-
import {useBoundaryElement} from '../../utils/boundaryElement'
|
|
39
|
+
import {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'
|
|
40
40
|
import {getElementRef} from '../../utils/getElementRef'
|
|
41
|
-
import {Portal
|
|
42
|
-
import {
|
|
43
|
-
import
|
|
41
|
+
import {Portal} from '../../utils/portal/portal'
|
|
42
|
+
import {usePortal} from '../../utils/portal/usePortal'
|
|
43
|
+
import {CardProvider} from '../card/cardProvider'
|
|
44
|
+
import {useCard} from '../card/useCard'
|
|
45
|
+
import type {LayerOwnProps} from '../layer/layer'
|
|
44
46
|
import type {Delay} from '../types'
|
|
45
47
|
import {
|
|
46
48
|
DEFAULT_FALLBACK_PLACEMENTS,
|
|
@@ -3,8 +3,8 @@ import {type CSSProperties, type ForwardedRef, useMemo} from 'react'
|
|
|
3
3
|
|
|
4
4
|
import {POPOVER_MOTION_PROPS} from '../../constants'
|
|
5
5
|
import type {Placement} from '../../types/placement'
|
|
6
|
-
import {Arrow} from '../arrow'
|
|
7
|
-
import {Layer, type LayerOwnProps, type LayerProps} from '../layer'
|
|
6
|
+
import {Arrow} from '../arrow/arrow'
|
|
7
|
+
import {Layer, type LayerOwnProps, type LayerProps} from '../layer/layer'
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_TOOLTIP_ARROW_HEIGHT,
|
|
10
10
|
DEFAULT_TOOLTIP_ARROW_RADIUS,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type {ReactNode, ReactPortal} from 'react'
|
|
2
2
|
import {createPortal} from 'react-dom'
|
|
3
3
|
|
|
4
|
-
import {CardProvider
|
|
4
|
+
import {CardProvider} from '../../primitives/card/cardProvider'
|
|
5
|
+
import {useCard} from '../../primitives/card/useCard'
|
|
5
6
|
import {usePortal} from './usePortal'
|
|
6
7
|
|
|
7
8
|
/** @public */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {_composeClassNames} from '../../_composeClassNames'
|
|
2
2
|
import {_responsiveClassName} from '../../_responsiveClassName'
|
|
3
|
-
import {flex} from '../../props/flex'
|
|
4
|
-
import {margin} from '../../props/margin'
|
|
5
|
-
import {radius} from '../../props/radius'
|
|
3
|
+
import {flex} from '../../props/flex/flex'
|
|
4
|
+
import {margin} from '../../props/margin/margin'
|
|
5
|
+
import {radius} from '../../props/radius/radius'
|
|
6
6
|
import {codeScale, font, headingScale, labelScale, root, textScale} from './skeleton.css'
|
|
7
7
|
import type {
|
|
8
8
|
CodeSkeletonStyleProps,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type {FontCodeSize, FontHeadingSize, FontLabelSize, FontTextSize} from '@sanity/ui/theme'
|
|
2
2
|
|
|
3
|
-
import type {FlexStyleProps} from '../../props/flex'
|
|
4
|
-
import type {MarginStyleProps} from '../../props/margin'
|
|
5
|
-
import type {RadiusStyleProps} from '../../props/radius'
|
|
3
|
+
import type {FlexStyleProps} from '../../props/flex/types'
|
|
4
|
+
import type {MarginStyleProps} from '../../props/margin/types'
|
|
5
|
+
import type {RadiusStyleProps} from '../../props/radius/types'
|
|
6
6
|
import type {ResponsiveProp} from '../../types'
|
|
7
7
|
|
|
8
8
|
/** @beta */
|
|
@@ -33,7 +33,7 @@ import type {CSSTheme, CSSThemeColorCard} from './types'
|
|
|
33
33
|
import {px, toBoxShadow} from './util'
|
|
34
34
|
import {paletteVars, themeVars} from './vars.css'
|
|
35
35
|
|
|
36
|
-
const fontDisplay: FontDisplay = '
|
|
36
|
+
const fontDisplay: FontDisplay = 'swap'
|
|
37
37
|
|
|
38
38
|
globalFontFace('Inter', [
|
|
39
39
|
{
|
package/src/css/index.ts
CHANGED
|
@@ -7,79 +7,136 @@ export * from './vars.css'
|
|
|
7
7
|
export * from './defaultTheme.css'
|
|
8
8
|
|
|
9
9
|
// props
|
|
10
|
-
export * from './props/alignItems'
|
|
11
|
-
export * from './props/
|
|
12
|
-
export * from './props/
|
|
13
|
-
export * from './props/
|
|
14
|
-
export * from './props/
|
|
15
|
-
export * from './props/
|
|
16
|
-
export * from './props/
|
|
17
|
-
export * from './props/
|
|
18
|
-
export * from './props/
|
|
19
|
-
export * from './props/
|
|
20
|
-
export * from './props/
|
|
21
|
-
export * from './props/
|
|
22
|
-
export * from './props/
|
|
23
|
-
export * from './props/
|
|
24
|
-
export * from './props/
|
|
25
|
-
export * from './props/
|
|
26
|
-
export * from './props/
|
|
27
|
-
export * from './props/
|
|
28
|
-
export * from './props/
|
|
29
|
-
export * from './props/
|
|
30
|
-
export * from './props/
|
|
31
|
-
export * from './props/
|
|
32
|
-
export * from './props/
|
|
33
|
-
export * from './props/
|
|
34
|
-
export * from './props/
|
|
35
|
-
export * from './props/
|
|
36
|
-
export * from './props/
|
|
37
|
-
export * from './props/
|
|
38
|
-
export * from './props/
|
|
39
|
-
export * from './props/
|
|
40
|
-
export * from './props/
|
|
41
|
-
export * from './props/
|
|
42
|
-
export * from './props/
|
|
43
|
-
export * from './props/
|
|
44
|
-
export * from './props/
|
|
45
|
-
export * from './props/
|
|
46
|
-
export * from './props/
|
|
10
|
+
export * from './props/alignItems/alignItems'
|
|
11
|
+
export * from './props/alignItems/types'
|
|
12
|
+
export * from './props/border/border'
|
|
13
|
+
export * from './props/border/types'
|
|
14
|
+
export * from './props/boxSizing/boxSizing'
|
|
15
|
+
export * from './props/boxSizing/types'
|
|
16
|
+
export * from './props/display/display'
|
|
17
|
+
export * from './props/display/types'
|
|
18
|
+
export * from './props/flex/flex'
|
|
19
|
+
export * from './props/flex/types'
|
|
20
|
+
export * from './props/flexDirection/flexDirection'
|
|
21
|
+
export * from './props/flexDirection/types'
|
|
22
|
+
export * from './props/flexWrap/flexWrap'
|
|
23
|
+
export * from './props/flexWrap/types'
|
|
24
|
+
export * from './props/font/font'
|
|
25
|
+
export * from './props/font/types'
|
|
26
|
+
export * from './props/gap/gap'
|
|
27
|
+
export * from './props/gap/types'
|
|
28
|
+
export * from './props/gridAutoColumns/gridAutoColumns'
|
|
29
|
+
export * from './props/gridAutoColumns/types'
|
|
30
|
+
export * from './props/gridAutoFlow/gridAutoFlow'
|
|
31
|
+
export * from './props/gridAutoFlow/types'
|
|
32
|
+
export * from './props/gridAutoRows/gridAutoRows'
|
|
33
|
+
export * from './props/gridAutoRows/types'
|
|
34
|
+
export * from './props/gridColumn/gridColumn'
|
|
35
|
+
export * from './props/gridColumn/types'
|
|
36
|
+
export * from './props/gridColumnEnd/gridColumnEnd'
|
|
37
|
+
export * from './props/gridColumnEnd/types'
|
|
38
|
+
export * from './props/gridColumnStart/gridColumnStart'
|
|
39
|
+
export * from './props/gridColumnStart/types'
|
|
40
|
+
export * from './props/gridRow/gridRow'
|
|
41
|
+
export * from './props/gridRow/types'
|
|
42
|
+
export * from './props/gridRowEnd/gridRowEnd'
|
|
43
|
+
export * from './props/gridRowEnd/types'
|
|
44
|
+
export * from './props/gridRowStart/gridRowStart'
|
|
45
|
+
export * from './props/gridRowStart/types'
|
|
46
|
+
export * from './props/gridTemplateColumns/gridTemplateColumns'
|
|
47
|
+
export * from './props/gridTemplateColumns/types'
|
|
48
|
+
export * from './props/gridTemplateRows/gridTemplateRows'
|
|
49
|
+
export * from './props/gridTemplateRows/types'
|
|
50
|
+
export * from './props/height/height'
|
|
51
|
+
export * from './props/height/types'
|
|
52
|
+
export * from './props/inset/inset'
|
|
53
|
+
export * from './props/inset/types'
|
|
54
|
+
export * from './props/justifyContent/justifyContent'
|
|
55
|
+
export * from './props/justifyContent/types'
|
|
56
|
+
export * from './props/margin/margin'
|
|
57
|
+
export * from './props/margin/types'
|
|
58
|
+
export * from './props/maxWidth/maxWidth'
|
|
59
|
+
export * from './props/maxWidth/types'
|
|
60
|
+
export * from './props/minHeight/minHeight'
|
|
61
|
+
export * from './props/minHeight/types'
|
|
62
|
+
export * from './props/minWidth/minWidth'
|
|
63
|
+
export * from './props/minWidth/types'
|
|
64
|
+
export * from './props/outline/outline'
|
|
65
|
+
export * from './props/outline/types'
|
|
66
|
+
export * from './props/overflow/overflow'
|
|
67
|
+
export * from './props/overflow/types'
|
|
68
|
+
export * from './props/padding/padding'
|
|
69
|
+
export * from './props/padding/types'
|
|
70
|
+
export * from './props/pointerEvents/pointerEvents'
|
|
71
|
+
export * from './props/pointerEvents/types'
|
|
72
|
+
export * from './props/position/position'
|
|
73
|
+
export * from './props/position/types'
|
|
74
|
+
export * from './props/radius/radius'
|
|
75
|
+
export * from './props/radius/types'
|
|
76
|
+
export * from './props/shadow/shadow'
|
|
77
|
+
export * from './props/shadow/types'
|
|
78
|
+
export * from './props/textAlign/textAlign'
|
|
79
|
+
export * from './props/textAlign/types'
|
|
80
|
+
export * from './props/textOverflow/textOverflow'
|
|
81
|
+
export * from './props/textOverflow/types'
|
|
82
|
+
export * from './props/width/width'
|
|
83
|
+
export * from './props/width/types'
|
|
47
84
|
|
|
48
85
|
// primitives
|
|
49
|
-
export * from './primitives/_arrow'
|
|
50
|
-
export * from './primitives/_input'
|
|
51
|
-
export * from './primitives/
|
|
52
|
-
export * from './primitives/
|
|
53
|
-
export * from './primitives/
|
|
54
|
-
export * from './primitives/
|
|
55
|
-
export * from './primitives/
|
|
56
|
-
export * from './primitives/
|
|
57
|
-
export * from './primitives/
|
|
58
|
-
export * from './primitives/
|
|
59
|
-
export * from './primitives/
|
|
60
|
-
export * from './primitives/
|
|
61
|
-
export * from './primitives/
|
|
62
|
-
export * from './primitives/
|
|
63
|
-
export * from './primitives/
|
|
64
|
-
export * from './primitives/
|
|
65
|
-
export * from './primitives/
|
|
66
|
-
export * from './primitives/
|
|
67
|
-
export * from './primitives/
|
|
68
|
-
export * from './primitives/
|
|
69
|
-
export * from './primitives/
|
|
70
|
-
export * from './primitives/
|
|
71
|
-
export * from './primitives/
|
|
72
|
-
export * from './primitives/
|
|
73
|
-
export * from './primitives/
|
|
74
|
-
export * from './primitives/
|
|
86
|
+
export * from './primitives/_arrow/_arrow'
|
|
87
|
+
export * from './primitives/_input/input'
|
|
88
|
+
export * from './primitives/_input/types'
|
|
89
|
+
export * from './primitives/_selectable/selectable'
|
|
90
|
+
export * from './primitives/_selectable/types'
|
|
91
|
+
export * from './primitives/avatar/avatar'
|
|
92
|
+
export * from './primitives/avatar/types'
|
|
93
|
+
export * from './primitives/badge/badge'
|
|
94
|
+
export * from './primitives/badge/types'
|
|
95
|
+
export * from './primitives/box/box'
|
|
96
|
+
export * from './primitives/box/types'
|
|
97
|
+
export * from './primitives/button/button'
|
|
98
|
+
export * from './primitives/button/types'
|
|
99
|
+
export * from './primitives/card/card'
|
|
100
|
+
export * from './primitives/card/types'
|
|
101
|
+
export * from './primitives/checkbox/checkbox'
|
|
102
|
+
export * from './primitives/code/code'
|
|
103
|
+
export * from './primitives/code/types'
|
|
104
|
+
export * from './primitives/container/container'
|
|
105
|
+
export * from './primitives/container/types'
|
|
106
|
+
export * from './primitives/heading/heading'
|
|
107
|
+
export * from './primitives/heading/types'
|
|
108
|
+
export * from './primitives/kbd/kbd'
|
|
109
|
+
export * from './primitives/kbd/types'
|
|
110
|
+
export * from './primitives/label/label'
|
|
111
|
+
export * from './primitives/label/types'
|
|
112
|
+
export * from './primitives/popover/popover'
|
|
113
|
+
export * from './primitives/radio/radio'
|
|
114
|
+
export * from './primitives/root/root'
|
|
115
|
+
export * from './primitives/root/types'
|
|
116
|
+
export * from './primitives/select/select'
|
|
117
|
+
export * from './primitives/select/types'
|
|
118
|
+
export * from './primitives/spinner/spinner'
|
|
119
|
+
export * from './primitives/spinner/types'
|
|
120
|
+
export * from './primitives/srOnly/srOnly'
|
|
121
|
+
export * from './primitives/stack/stack'
|
|
122
|
+
export * from './primitives/switch/switch'
|
|
123
|
+
export * from './primitives/text/text'
|
|
124
|
+
export * from './primitives/text/types'
|
|
125
|
+
export * from './primitives/textArea/textArea'
|
|
126
|
+
export * from './primitives/textArea/types'
|
|
127
|
+
export * from './primitives/textInput/textInput'
|
|
128
|
+
export * from './primitives/textInput/types'
|
|
129
|
+
export * from './primitives/tooltip/tooltip'
|
|
130
|
+
export * from './primitives/tooltip/types'
|
|
75
131
|
|
|
76
132
|
// components
|
|
77
|
-
export * from './components/breadcrumbs'
|
|
78
|
-
export * from './components/dialog'
|
|
79
|
-
export * from './components/menu'
|
|
80
|
-
export * from './components/skeleton'
|
|
81
|
-
export * from './components/
|
|
82
|
-
export * from './components/
|
|
133
|
+
export * from './components/breadcrumbs/breadcrumbs'
|
|
134
|
+
export * from './components/dialog/dialog'
|
|
135
|
+
export * from './components/menu/menu'
|
|
136
|
+
export * from './components/skeleton/skeleton'
|
|
137
|
+
export * from './components/skeleton/types'
|
|
138
|
+
export * from './components/toast/toast'
|
|
139
|
+
export * from './components/tree/tree'
|
|
83
140
|
|
|
84
141
|
export * from './constants'
|
|
85
142
|
export * from './types'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {_composeClassNames} from '../../_composeClassNames'
|
|
2
2
|
import {_responsiveClassName} from '../../_responsiveClassName'
|
|
3
|
-
import {radius} from '../../props/radius'
|
|
4
|
-
import {width} from '../../props/width'
|
|
3
|
+
import {radius} from '../../props/radius/radius'
|
|
4
|
+
import {width} from '../../props/width/width'
|
|
5
5
|
import {border, element, fontSize, gap, padding, presentation, root} from './_input.css'
|
|
6
6
|
import type {InputStyleProps} from './types'
|
|
7
7
|
|