@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
package/package.json
CHANGED
|
@@ -22,14 +22,14 @@ import {EMPTY_ARRAY, EMPTY_RECORD} from '../../constants'
|
|
|
22
22
|
import {_raf} from '../../helpers/animation'
|
|
23
23
|
import {_hasFocus, focusFirstDescendant} from '../../helpers/focus'
|
|
24
24
|
import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
25
|
+
import {Box, type BoxOwnProps} from '../../primitives/box/box'
|
|
26
|
+
import {Button} from '../../primitives/button/button'
|
|
27
|
+
import {Popover, type PopoverProps} from '../../primitives/popover/popover'
|
|
28
|
+
import {Selectable} from '../../primitives/selectable/selectable'
|
|
29
29
|
import {AnimatedSpinnerIcon} from '../../primitives/spinner/animatedSpinnerIcon'
|
|
30
|
-
import {Stack} from '../../primitives/stack'
|
|
31
|
-
import {Text} from '../../primitives/text'
|
|
32
|
-
import {TextInput, type TextInputOwnProps} from '../../primitives/textInput'
|
|
30
|
+
import {Stack} from '../../primitives/stack/stack'
|
|
31
|
+
import {Text} from '../../primitives/text/text'
|
|
32
|
+
import {TextInput, type TextInputOwnProps} from '../../primitives/textInput/textInput'
|
|
33
33
|
import type {ComponentType, Props} from '../../types/props'
|
|
34
34
|
import {AutocompleteOption} from './autocompleteOption'
|
|
35
35
|
import {autocompleteReducer} from './autocompleteReducer'
|
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
} from 'react'
|
|
13
13
|
|
|
14
14
|
import {useClickOutsideEvent} from '../../hooks/useClickOutsideEvent'
|
|
15
|
-
import {Box} from '../../primitives/box'
|
|
16
|
-
import {Button, type ButtonProps} from '../../primitives/button'
|
|
17
|
-
import {Flex} from '../../primitives/flex'
|
|
18
|
-
import {Popover} from '../../primitives/popover'
|
|
19
|
-
import {Stack} from '../../primitives/stack'
|
|
20
|
-
import {Text} from '../../primitives/text'
|
|
15
|
+
import {Box} from '../../primitives/box/box'
|
|
16
|
+
import {Button, type ButtonProps} from '../../primitives/button/button'
|
|
17
|
+
import {Flex} from '../../primitives/flex/flex'
|
|
18
|
+
import {Popover} from '../../primitives/popover/popover'
|
|
19
|
+
import {Stack} from '../../primitives/stack/stack'
|
|
20
|
+
import {Text} from '../../primitives/text/text'
|
|
21
21
|
import type {ComponentType, Props} from '../../types/props'
|
|
22
22
|
|
|
23
23
|
/** @beta */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Button,
|
|
3
|
+
Dialog,
|
|
3
4
|
Flex,
|
|
4
5
|
Layer,
|
|
5
6
|
LayerProvider,
|
|
@@ -11,8 +12,6 @@ import {
|
|
|
11
12
|
} from '@sanity/ui'
|
|
12
13
|
import {useState} from 'react'
|
|
13
14
|
|
|
14
|
-
import {Dialog} from '../dialog'
|
|
15
|
-
|
|
16
15
|
export default function LayeringFocusStory() {
|
|
17
16
|
const [firstDialogOpen, setFirstDialogOpen] = useState<boolean>(false)
|
|
18
17
|
const [secondDialogOpen, setSecondDialogOpen] = useState<boolean>(false)
|
|
@@ -12,12 +12,13 @@ import {isHTMLElement} from '../../helpers/element'
|
|
|
12
12
|
import {focusFirstDescendant, focusLastDescendant} from '../../helpers/focus'
|
|
13
13
|
import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
|
|
14
14
|
import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
15
|
-
import type {CardTone} from '../../primitives/card'
|
|
16
|
-
import {Container} from '../../primitives/container'
|
|
17
|
-
import {Layer, type LayerOwnProps, type LayerProps} from '../../primitives/layer'
|
|
15
|
+
import type {CardTone} from '../../primitives/card/types'
|
|
16
|
+
import {Container} from '../../primitives/container/container'
|
|
17
|
+
import {Layer, type LayerOwnProps, type LayerProps} from '../../primitives/layer/layer'
|
|
18
18
|
import type {ComponentType, Props} from '../../types/props'
|
|
19
|
-
import {useBoundaryElement} from '../../utils/boundaryElement'
|
|
20
|
-
import {Portal
|
|
19
|
+
import {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'
|
|
20
|
+
import {Portal} from '../../utils/portal/portal'
|
|
21
|
+
import {usePortal} from '../../utils/portal/usePortal'
|
|
21
22
|
import {DialogCard} from './dialogCard'
|
|
22
23
|
import {isTargetWithinScope} from './isTargetWithinScope'
|
|
23
24
|
import type {DialogPosition} from './types'
|
|
@@ -21,15 +21,15 @@ import {
|
|
|
21
21
|
import {focusFirstDescendant} from '../../helpers/focus'
|
|
22
22
|
import {useClickOutsideEvent} from '../../hooks/useClickOutsideEvent'
|
|
23
23
|
import {useGlobalKeyDown} from '../../hooks/useGlobalKeyDown'
|
|
24
|
-
import {Box} from '../../primitives/box'
|
|
25
|
-
import {Button} from '../../primitives/button'
|
|
26
|
-
import {Card, type CardElementType, type CardOwnProps} from '../../primitives/card'
|
|
27
|
-
import {Flex} from '../../primitives/flex'
|
|
28
|
-
import {useLayer} from '../../primitives/layer'
|
|
29
|
-
import {Text} from '../../primitives/text'
|
|
24
|
+
import {Box} from '../../primitives/box/box'
|
|
25
|
+
import {Button} from '../../primitives/button/button'
|
|
26
|
+
import {Card, type CardElementType, type CardOwnProps} from '../../primitives/card/card'
|
|
27
|
+
import {Flex} from '../../primitives/flex/flex'
|
|
28
|
+
import {useLayer} from '../../primitives/layer/useLayer'
|
|
29
|
+
import {Text} from '../../primitives/text/text'
|
|
30
30
|
import type {Props} from '../../types/props'
|
|
31
|
-
import {useBoundaryElement} from '../../utils/boundaryElement'
|
|
32
|
-
import {usePortal} from '../../utils/portal'
|
|
31
|
+
import {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'
|
|
32
|
+
import {usePortal} from '../../utils/portal/usePortal'
|
|
33
33
|
import {isTargetWithinScope} from './isTargetWithinScope'
|
|
34
34
|
|
|
35
35
|
/** @internal */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type {GapStyleProps, RadiusStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
2
2
|
import type {FontTextSize, Space} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import {Box} from '../../primitives/box'
|
|
5
|
-
import {KBD} from '../../primitives/kbd'
|
|
4
|
+
import {Box} from '../../primitives/box/box'
|
|
5
|
+
import {KBD} from '../../primitives/kbd/kbd'
|
|
6
6
|
import type {ComponentType, Props} from '../../types/props'
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
@@ -7,14 +7,13 @@ import {
|
|
|
7
7
|
Flex,
|
|
8
8
|
Menu,
|
|
9
9
|
MenuButton,
|
|
10
|
+
type MenuButtonProps,
|
|
10
11
|
MenuItem,
|
|
11
12
|
type SelectableTone,
|
|
12
13
|
Text,
|
|
13
14
|
} from '@sanity/ui'
|
|
14
15
|
import {useState} from 'react'
|
|
15
16
|
|
|
16
|
-
import type {MenuButtonProps} from '../menuButton'
|
|
17
|
-
|
|
18
17
|
const POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
19
18
|
constrainSize: true,
|
|
20
19
|
placement: 'bottom',
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {Button, Flex, LayerProvider, Popover} from '@sanity/ui'
|
|
1
|
+
import {Button, Flex, LayerProvider, Menu, MenuDivider, MenuItem, Popover} from '@sanity/ui'
|
|
2
2
|
import {useSelect} from '@sanity/ui-workshop'
|
|
3
3
|
import {Fragment, useCallback, useState} from 'react'
|
|
4
4
|
|
|
5
|
-
import {Menu} from '../menu'
|
|
6
|
-
import {MenuDivider} from '../menuDivider'
|
|
7
|
-
import {MenuItem} from '../menuItem'
|
|
8
|
-
|
|
9
5
|
const ITEMS = [...Array(8).keys()].map((num) => ({
|
|
10
6
|
title: `Item ${num + 1}`,
|
|
11
7
|
divider: num === 3,
|
|
@@ -4,9 +4,9 @@ import {useCallback, useEffect, useImperativeHandle, useMemo, useRef} from 'reac
|
|
|
4
4
|
|
|
5
5
|
import {useClickOutsideEvent} from '../../hooks/useClickOutsideEvent'
|
|
6
6
|
import {useGlobalKeyDown} from '../../hooks/useGlobalKeyDown'
|
|
7
|
-
import {Box} from '../../primitives/box'
|
|
8
|
-
import {useLayer} from '../../primitives/layer'
|
|
9
|
-
import {Stack} from '../../primitives/stack'
|
|
7
|
+
import {Box} from '../../primitives/box/box'
|
|
8
|
+
import {useLayer} from '../../primitives/layer/useLayer'
|
|
9
|
+
import {Stack} from '../../primitives/stack/stack'
|
|
10
10
|
import type {ComponentType, Props} from '../../types/props'
|
|
11
11
|
import {MenuContext, type MenuContextValue} from './menuContext'
|
|
12
12
|
import {useMenuController} from './useMenuController'
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
useState,
|
|
15
15
|
} from 'react'
|
|
16
16
|
|
|
17
|
-
import type {ButtonProps} from '../../primitives/button'
|
|
18
|
-
import {Popover, type PopoverProps} from '../../primitives/popover'
|
|
17
|
+
import type {ButtonProps} from '../../primitives/button/button'
|
|
18
|
+
import {Popover, type PopoverProps} from '../../primitives/popover/popover'
|
|
19
19
|
import type {Placement} from '../../types/placement'
|
|
20
20
|
import type {Props} from '../../types/props'
|
|
21
21
|
import type {MenuProps} from './menu'
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
} from 'react'
|
|
14
14
|
import {isValidElementType} from 'react-is'
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {Text} from '../../primitives/text'
|
|
16
|
+
import {Box} from '../../primitives/box/box'
|
|
17
|
+
import {Flex} from '../../primitives/flex/flex'
|
|
18
|
+
import {Popover, type PopoverProps} from '../../primitives/popover/popover'
|
|
19
|
+
import {Selectable} from '../../primitives/selectable/selectable'
|
|
20
|
+
import {Text} from '../../primitives/text/text'
|
|
21
21
|
import type {ComponentType, Props} from '../../types/props'
|
|
22
22
|
import {DEFAULT_MENU_ELEMENT, Menu, type MenuProps} from './menu'
|
|
23
23
|
import {useMenu} from './useMenu'
|
|
@@ -19,12 +19,12 @@ import {
|
|
|
19
19
|
} from 'react'
|
|
20
20
|
import {isValidElementType} from 'react-is'
|
|
21
21
|
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {Text} from '../../primitives/text'
|
|
22
|
+
import {Box} from '../../primitives/box/box'
|
|
23
|
+
import {Flex} from '../../primitives/flex/flex'
|
|
24
|
+
import {Selectable} from '../../primitives/selectable/selectable'
|
|
25
|
+
import {Text} from '../../primitives/text/text'
|
|
26
26
|
import type {ComponentType, Props} from '../../types/props'
|
|
27
|
-
import {Hotkeys} from '../hotkeys'
|
|
27
|
+
import {Hotkeys} from '../hotkeys/hotkeys'
|
|
28
28
|
import {useMenu} from './useMenu'
|
|
29
29
|
|
|
30
30
|
/** @public */
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useState,
|
|
10
10
|
} from 'react'
|
|
11
11
|
|
|
12
|
-
import {Flex, type FlexOwnProps} from '../../primitives/flex'
|
|
12
|
+
import {Flex, type FlexOwnProps} from '../../primitives/flex/flex'
|
|
13
13
|
import type {ComponentType, Props} from '../../types/props'
|
|
14
14
|
import type {TabProps} from './tab'
|
|
15
15
|
|
|
@@ -4,12 +4,12 @@ import {motion, type Variant, type Variants} from 'framer-motion'
|
|
|
4
4
|
import {type ReactNode} from 'react'
|
|
5
5
|
|
|
6
6
|
import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
|
|
7
|
-
import {Box} from '../../primitives/box'
|
|
8
|
-
import {Button} from '../../primitives/button'
|
|
9
|
-
import {Card} from '../../primitives/card'
|
|
10
|
-
import {Flex} from '../../primitives/flex'
|
|
11
|
-
import {Stack} from '../../primitives/stack'
|
|
12
|
-
import {Text} from '../../primitives/text'
|
|
7
|
+
import {Box} from '../../primitives/box/box'
|
|
8
|
+
import {Button} from '../../primitives/button/button'
|
|
9
|
+
import {Card} from '../../primitives/card/card'
|
|
10
|
+
import {Flex} from '../../primitives/flex/flex'
|
|
11
|
+
import {Stack} from '../../primitives/stack/stack'
|
|
12
|
+
import {Text} from '../../primitives/text/text'
|
|
13
13
|
import type {ComponentType, Props} from '../../types/props'
|
|
14
14
|
|
|
15
15
|
/** @internal */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {type GapStyleProps, type PaddingStyleProps, toastLayer} from '@sanity/ui/css'
|
|
2
2
|
|
|
3
|
-
import {Grid} from '../../primitives/grid'
|
|
4
|
-
import {useLayer} from '../../primitives/layer'
|
|
3
|
+
import {Grid} from '../../primitives/grid/grid'
|
|
4
|
+
import {useLayer} from '../../primitives/layer/useLayer'
|
|
5
5
|
import type {ComponentType, Props} from '../../types/props'
|
|
6
6
|
|
|
7
7
|
/** @internal */
|
|
@@ -3,7 +3,7 @@ import {AnimatePresence} from 'framer-motion'
|
|
|
3
3
|
import {startTransition, useMemo, useState} from 'react'
|
|
4
4
|
|
|
5
5
|
import {useMounted} from '../../hooks/useMounted'
|
|
6
|
-
import {LayerProvider} from '../../primitives/layer'
|
|
6
|
+
import {LayerProvider} from '../../primitives/layer/layerProvider'
|
|
7
7
|
import {Toast} from './toast'
|
|
8
8
|
import {ToastContext} from './toastContext'
|
|
9
9
|
import {ToastLayer, type ToastLayerProps} from './toastLayer'
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useState,
|
|
12
12
|
} from 'react'
|
|
13
13
|
|
|
14
|
-
import {Stack} from '../../primitives/stack'
|
|
14
|
+
import {Stack} from '../../primitives/stack/stack'
|
|
15
15
|
import type {ComponentType, Props} from '../../types/props'
|
|
16
16
|
import {_findNextItemElement, _findPrevItemElement, _focusItemElement} from './helpers'
|
|
17
17
|
import {TreeContext} from './treeContext'
|
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
useRef,
|
|
16
16
|
} from 'react'
|
|
17
17
|
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import {Text} from '../../primitives/text'
|
|
18
|
+
import {Box, type BoxProps} from '../../primitives/box/box'
|
|
19
|
+
import type {CardOwnProps} from '../../primitives/card/card'
|
|
20
|
+
import {Flex} from '../../primitives/flex/flex'
|
|
21
|
+
import {Selectable, type SelectableElementType} from '../../primitives/selectable/selectable'
|
|
22
|
+
import {Text} from '../../primitives/text/text'
|
|
23
23
|
import type {ComponentType, Props} from '../../types/props'
|
|
24
24
|
import {TreeContext} from './treeContext'
|
|
25
25
|
import {TreeGroup} from './treeGroup'
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
import {_isScrollable} from '../../helpers/scroll'
|
|
14
14
|
import {_ResizeObserver} from '../../observers/resize'
|
|
15
|
-
import {Box} from '../../primitives/box'
|
|
15
|
+
import {Box} from '../../primitives/box/box'
|
|
16
16
|
import type {ComponentType, Props} from '../../types/props'
|
|
17
17
|
|
|
18
18
|
/** @beta */
|
package/src/core/index.ts
CHANGED
|
@@ -1,16 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
// compat
|
|
2
|
+
export * from './_compat/helpers'
|
|
3
|
+
export * from './_compat/styles/_responsive'
|
|
4
|
+
export * from './_compat/theme/themeColorProvider'
|
|
5
|
+
export * from './_compat/theme/themeProvider'
|
|
6
|
+
export * from './_compat/theme/types'
|
|
7
|
+
export * from './_compat/theme/useRootTheme'
|
|
8
|
+
export * from './_compat/theme/useTheme'
|
|
9
|
+
export * from './_compat/types'
|
|
2
10
|
|
|
3
11
|
// components
|
|
4
12
|
export * from './components/autocomplete/autocomplete'
|
|
5
13
|
export * from './components/autocomplete/types'
|
|
6
|
-
export * from './components/breadcrumbs'
|
|
7
|
-
export * from './components/dialog'
|
|
8
|
-
export * from './components/
|
|
9
|
-
export * from './components/
|
|
10
|
-
export * from './components/
|
|
11
|
-
export * from './components/
|
|
12
|
-
export * from './components/
|
|
13
|
-
export * from './components/
|
|
14
|
+
export * from './components/breadcrumbs/breadcrumbs'
|
|
15
|
+
export * from './components/dialog/dialog'
|
|
16
|
+
export * from './components/dialog/dialogContext'
|
|
17
|
+
export * from './components/dialog/dialogProvider'
|
|
18
|
+
export * from './components/dialog/types'
|
|
19
|
+
export * from './components/dialog/useDialog'
|
|
20
|
+
export * from './components/hotkeys/hotkeys'
|
|
21
|
+
export * from './components/menu/menu'
|
|
22
|
+
export * from './components/menu/menuButton'
|
|
23
|
+
export * from './components/menu/menuDivider'
|
|
24
|
+
export * from './components/menu/menuGroup'
|
|
25
|
+
export * from './components/menu/menuItem'
|
|
26
|
+
export * from './components/tab/tab'
|
|
27
|
+
export * from './components/tab/tabList'
|
|
28
|
+
export * from './components/tab/tabPanel'
|
|
29
|
+
export * from './components/toast/toast'
|
|
30
|
+
export * from './components/toast/toastProvider'
|
|
31
|
+
export * from './components/toast/types'
|
|
32
|
+
export * from './components/toast/useToast'
|
|
33
|
+
export * from './components/tree/tree'
|
|
34
|
+
export * from './components/tree/treeItem'
|
|
35
|
+
export * from './components/tree/types'
|
|
36
|
+
export * from './components/tree/useTree'
|
|
37
|
+
export * from './components/virtualList/virtualList'
|
|
14
38
|
|
|
15
39
|
// helpers
|
|
16
40
|
export * from './helpers/animation'
|
|
@@ -24,12 +48,12 @@ export * from './hooks/useArrayProp'
|
|
|
24
48
|
export * from './hooks/useClickOutside'
|
|
25
49
|
export * from './hooks/useClickOutsideEvent'
|
|
26
50
|
export * from './hooks/useCustomValidity'
|
|
27
|
-
export * from './hooks/useElementRect'
|
|
51
|
+
export * from './hooks/useElementRect/useElementRect'
|
|
28
52
|
export * from './hooks/useElementSize'
|
|
29
53
|
export * from './hooks/useForwardedRef'
|
|
30
54
|
export * from './hooks/useGlobalKeyDown'
|
|
31
55
|
export * from './hooks/useMatchMedia'
|
|
32
|
-
export * from './hooks/useMediaIndex'
|
|
56
|
+
export * from './hooks/useMediaIndex/useMediaIndex'
|
|
33
57
|
export * from './hooks/usePrefersDark'
|
|
34
58
|
export * from './hooks/usePrefersReducedMotion'
|
|
35
59
|
export * from './hooks/useResponsiveProp'
|
|
@@ -39,43 +63,70 @@ export * from './observers/elementSize'
|
|
|
39
63
|
export * from './observers/resize'
|
|
40
64
|
|
|
41
65
|
// primitives
|
|
42
|
-
export * from './primitives/
|
|
43
|
-
export * from './primitives/
|
|
44
|
-
export * from './primitives/avatar'
|
|
45
|
-
export * from './primitives/
|
|
46
|
-
export * from './primitives/
|
|
47
|
-
export * from './primitives/
|
|
48
|
-
export * from './primitives/
|
|
49
|
-
export * from './primitives/
|
|
50
|
-
export * from './primitives/
|
|
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/
|
|
66
|
+
export * from './primitives/arrow/arrow'
|
|
67
|
+
export * from './primitives/avatar/avatar'
|
|
68
|
+
export * from './primitives/avatar/avatarCounter'
|
|
69
|
+
export * from './primitives/avatar/avatarStack'
|
|
70
|
+
export * from './primitives/avatar/types'
|
|
71
|
+
export * from './primitives/badge/badge'
|
|
72
|
+
export * from './primitives/box/box'
|
|
73
|
+
export * from './primitives/box/types'
|
|
74
|
+
export * from './primitives/button/button'
|
|
75
|
+
export * from './primitives/button/types'
|
|
76
|
+
export * from './primitives/card/card'
|
|
77
|
+
export * from './primitives/card/cardProvider'
|
|
78
|
+
export * from './primitives/card/types'
|
|
79
|
+
export * from './primitives/card/useCard'
|
|
80
|
+
export * from './primitives/checkbox/checkbox'
|
|
81
|
+
export * from './primitives/code/code'
|
|
82
|
+
export * from './primitives/container/container'
|
|
83
|
+
export * from './primitives/container/types'
|
|
84
|
+
export * from './primitives/flex/flex'
|
|
85
|
+
export * from './primitives/flex/types'
|
|
86
|
+
export * from './primitives/grid/grid'
|
|
87
|
+
export * from './primitives/grid/types'
|
|
88
|
+
export * from './primitives/heading/heading'
|
|
89
|
+
export * from './primitives/inline/inline'
|
|
90
|
+
export * from './primitives/kbd/kbd'
|
|
91
|
+
export * from './primitives/label/label'
|
|
92
|
+
export * from './primitives/layer/layer'
|
|
93
|
+
export * from './primitives/layer/layerProvider'
|
|
94
|
+
export * from './primitives/layer/types'
|
|
95
|
+
export * from './primitives/layer/useLayer'
|
|
96
|
+
export * from './primitives/popover/popover'
|
|
97
|
+
export * from './primitives/popover/types'
|
|
98
|
+
export * from './primitives/radio/radio'
|
|
99
|
+
export * from './primitives/root/Root'
|
|
100
|
+
export * from './primitives/root/RootProvider'
|
|
101
|
+
export * from './primitives/select/select'
|
|
102
|
+
export * from './primitives/selectable/selectable'
|
|
103
|
+
export * from './primitives/selectable/types'
|
|
104
|
+
export * from './primitives/skeleton/codeSkeleton'
|
|
105
|
+
export * from './primitives/skeleton/headingSkeleton'
|
|
106
|
+
export * from './primitives/skeleton/labelSkeleton'
|
|
107
|
+
export * from './primitives/skeleton/skeleton'
|
|
108
|
+
export * from './primitives/skeleton/textSkeleton'
|
|
109
|
+
export * from './primitives/spinner/spinner'
|
|
110
|
+
export * from './primitives/srOnly/srOnly'
|
|
111
|
+
export * from './primitives/stack/stack'
|
|
112
|
+
export * from './primitives/switch/switch'
|
|
113
|
+
export * from './primitives/text/text'
|
|
114
|
+
export * from './primitives/textArea/textArea'
|
|
115
|
+
export * from './primitives/textInput/textInput'
|
|
116
|
+
export * from './primitives/tooltip/tooltip'
|
|
117
|
+
export * from './primitives/tooltip/tooltipDelayGroup'
|
|
72
118
|
export * from './primitives/types'
|
|
73
119
|
|
|
74
120
|
// utils
|
|
75
|
-
export * from './utils/boundaryElement'
|
|
76
|
-
export * from './utils/
|
|
121
|
+
export * from './utils/boundaryElement/boundaryElementProvider'
|
|
122
|
+
export * from './utils/boundaryElement/types'
|
|
123
|
+
export * from './utils/boundaryElement/useBoundaryElement'
|
|
124
|
+
export * from './utils/elementQuery/elementQuery'
|
|
77
125
|
export * from './utils/errorBoundary'
|
|
78
|
-
export * from './utils/portal'
|
|
126
|
+
export * from './utils/portal/portal'
|
|
127
|
+
export * from './utils/portal/portalProvider'
|
|
128
|
+
export * from './utils/portal/types'
|
|
129
|
+
export * from './utils/portal/usePortal'
|
|
79
130
|
|
|
80
131
|
// types
|
|
81
132
|
export * from './types/gridItem'
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
+
import {Avatar, AvatarStack, Box, Button, Container, Flex, Stack, Text} from '@sanity/ui'
|
|
1
2
|
import {useBoolean} from '@sanity/ui-workshop'
|
|
2
3
|
|
|
3
|
-
import {Box} from '../../box'
|
|
4
|
-
import {Button} from '../../button'
|
|
5
|
-
import {Container} from '../../container'
|
|
6
|
-
import {Flex} from '../../flex'
|
|
7
|
-
import {Stack} from '../../stack'
|
|
8
|
-
import {Text} from '../../text'
|
|
9
|
-
import {Avatar} from '../avatar'
|
|
10
|
-
import {AvatarStack} from '../avatarStack'
|
|
11
|
-
|
|
12
4
|
export default function WithinButtonStory() {
|
|
13
5
|
const disabled = useBoolean('Disabled', false)
|
|
14
6
|
|
|
@@ -11,8 +11,8 @@ import {useCallback, useEffect, useMemo, useState} from 'react'
|
|
|
11
11
|
|
|
12
12
|
import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
13
13
|
import type {ComponentType, Props} from '../../types/props'
|
|
14
|
-
import {Box} from '../box'
|
|
15
|
-
import {Label} from '../label'
|
|
14
|
+
import {Box} from '../box/box'
|
|
15
|
+
import {Label} from '../label/label'
|
|
16
16
|
import type {AvatarPosition, AvatarStatus} from './types'
|
|
17
17
|
|
|
18
18
|
/** @public */
|
|
@@ -4,8 +4,8 @@ import {useMemo} from 'react'
|
|
|
4
4
|
|
|
5
5
|
import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
6
6
|
import type {ComponentType, Props} from '../../types/props'
|
|
7
|
-
import {Box} from '../box'
|
|
8
|
-
import {Label} from '../label'
|
|
7
|
+
import {Box} from '../box/box'
|
|
8
|
+
import {Label} from '../label/label'
|
|
9
9
|
|
|
10
10
|
/** @public */
|
|
11
11
|
export const DEFAULT_AVATAR_COUNTER_ELEMENT = 'span'
|
|
@@ -4,7 +4,7 @@ import {Children, cloneElement, Fragment, isValidElement, type ReactElement} fro
|
|
|
4
4
|
|
|
5
5
|
import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
6
6
|
import type {ComponentType, Props} from '../../types/props'
|
|
7
|
-
import {Box, type BoxOwnProps} from '../box'
|
|
7
|
+
import {Box, type BoxOwnProps} from '../box/box'
|
|
8
8
|
import type {AvatarProps} from './avatar'
|
|
9
9
|
import {AvatarCounter} from './avatarCounter'
|
|
10
10
|
|
|
@@ -3,8 +3,8 @@ import {badge} from '@sanity/ui/css'
|
|
|
3
3
|
import type {FontTextSize} from '@sanity/ui/theme'
|
|
4
4
|
|
|
5
5
|
import type {ComponentType, Props} from '../../types/props'
|
|
6
|
-
import {Box} from '../box'
|
|
7
|
-
import {Text} from '../text'
|
|
6
|
+
import {Box} from '../box/box'
|
|
7
|
+
import {Text} from '../text/text'
|
|
8
8
|
import type {BadgeTone} from './types'
|
|
9
9
|
|
|
10
10
|
/** @public */
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import {SquareIcon} from '@sanity/icons'
|
|
2
|
+
import {Button, Card, Container, Grid, Stack, Text} from '@sanity/ui'
|
|
2
3
|
import {useBoolean} from '@sanity/ui-workshop'
|
|
3
4
|
|
|
4
|
-
import {Card} from '../../card/card'
|
|
5
|
-
import {Container} from '../../container/container'
|
|
6
|
-
import {Grid} from '../../grid/grid'
|
|
7
|
-
import {Stack} from '../../stack/stack'
|
|
8
|
-
import {Text} from '../../text/text'
|
|
9
|
-
import {Button} from '../button'
|
|
10
|
-
|
|
11
5
|
const GAP = 4
|
|
12
6
|
const COLUMNS = 3
|
|
13
7
|
|
|
@@ -13,10 +13,9 @@ import {type ElementType as ReactElementType, isValidElement, type ReactNode} fr
|
|
|
13
13
|
import {isValidElementType} from 'react-is'
|
|
14
14
|
|
|
15
15
|
import type {ComponentType, Props} from '../../types/props'
|
|
16
|
-
import {Box} from '../box'
|
|
17
|
-
import {Spinner} from '../spinner'
|
|
18
|
-
import type
|
|
19
|
-
import {Text} from '../text'
|
|
16
|
+
import {Box} from '../box/box'
|
|
17
|
+
import {Spinner} from '../spinner/spinner'
|
|
18
|
+
import {Text, type TextOwnProps} from '../text/text'
|
|
20
19
|
import type {ButtonTextAlign} from './types'
|
|
21
20
|
|
|
22
21
|
/** @public */
|