@sanity/ui 3.0.0-static.26 → 3.0.0-static.28
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 +674 -804
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-cjs/refractor.cjs +2 -2
- package/dist/_chunks-cjs/refractor.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +652 -781
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/refractor.js +1 -1
- package/dist/_visual-editing.d.cts +1 -0
- package/dist/_visual-editing.d.ts +1 -0
- package/dist/css/layers.css +4 -0
- package/dist/css/primitives/popover/popover.css +4 -0
- package/dist/css.cjs +59 -50
- package/dist/css.cjs.map +1 -1
- package/dist/css.d.cts +14 -6
- package/dist/css.d.ts +14 -6
- package/dist/css.js +59 -50
- package/dist/css.js.map +1 -1
- package/dist/index.cjs +1995 -1813
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -0
- package/dist/index.d.cts +35 -17
- package/dist/index.d.ts +35 -17
- package/dist/index.js +2013 -1832
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +2605 -1075
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +2689 -1159
- package/dist/theme.js.map +1 -1
- package/exports/_visual-editing.ts +2 -2
- package/package.json +20 -38
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +13 -17
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/core/components/autocomplete/constants.ts +3 -1
- package/src/core/components/autocomplete/types.ts +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +8 -3
- package/src/core/components/dialog/__workshop__/activate.tsx +11 -3
- package/src/core/components/dialog/__workshop__/panes.tsx +12 -5
- package/src/core/components/dialog/dialog.tsx +12 -13
- package/src/core/components/dialog/dialogCard.tsx +89 -53
- package/src/core/components/dialog/dialogContext.ts +1 -1
- package/src/core/components/dialog/dialogProvider.tsx +1 -1
- package/src/core/components/dialog/index.ts +1 -0
- package/src/core/components/dialog/isTargetWithinScope.ts +1 -1
- package/src/core/components/hotkeys/hotkeys.tsx +3 -2
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +12 -6
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +1 -5
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -2
- package/src/core/components/menu/helpers.ts +1 -1
- package/src/core/components/menu/menu.tsx +6 -4
- package/src/core/components/menu/menuButton.tsx +5 -3
- package/src/core/components/menu/menuDivider.tsx +1 -1
- package/src/core/components/menu/menuGroup.tsx +8 -4
- package/src/core/components/menu/menuItem.tsx +4 -2
- package/src/core/components/tab/tab.tsx +2 -2
- package/src/core/components/tab/tabList.tsx +2 -2
- package/src/core/components/tab/tabPanel.tsx +2 -2
- package/src/core/components/toast/toast.tsx +7 -2
- 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 +2 -2
- package/src/core/components/tree/treeGroup.tsx +2 -2
- package/src/core/components/tree/treeItem.tsx +13 -6
- package/src/core/components/tree/types.ts +0 -1
- package/src/core/{utils → components}/virtualList/__workshop__/index.ts +1 -1
- package/src/core/{utils → components}/virtualList/virtualList.tsx +10 -5
- package/src/core/helpers/focus.ts +0 -8
- package/src/core/hooks/useArrayProp.ts +1 -1
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -3
- package/src/core/hooks/useElementSize.ts +1 -1
- package/src/core/hooks/useResponsiveProp.ts +1 -1
- package/src/core/index.ts +83 -7
- package/src/core/observers/{elementSizeObserver.ts → elementSize.ts} +1 -1
- package/src/core/primitives/_selectable/index.ts +1 -0
- package/src/core/primitives/_selectable/selectable.tsx +13 -3
- package/src/core/{types/selectable.ts → primitives/_selectable/types.ts} +1 -1
- package/src/core/{utils → primitives}/arrow/arrow.tsx +1 -1
- package/src/core/primitives/avatar/avatar.tsx +4 -3
- package/src/core/primitives/avatar/avatarCounter.tsx +3 -3
- package/src/core/primitives/avatar/avatarStack.tsx +4 -4
- package/src/core/primitives/avatar/types.ts +17 -0
- package/src/core/primitives/badge/badge.tsx +4 -2
- package/src/core/primitives/badge/types.ts +11 -2
- package/src/core/primitives/box/__workshop__/responsive.tsx +0 -1
- package/src/core/primitives/box/box.tsx +1 -1
- package/src/core/primitives/box/index.ts +1 -0
- package/src/core/primitives/button/__workshop__/disabled.tsx +37 -51
- package/src/core/primitives/button/__workshop__/index.ts +5 -0
- package/src/core/primitives/button/__workshop__/textOverflow.tsx +13 -0
- package/src/core/primitives/button/button.tsx +15 -14
- package/src/core/primitives/button/index.ts +1 -0
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +2 -2
- package/src/core/primitives/card/card.tsx +1 -1
- package/src/core/primitives/card/types.ts +3 -0
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +9 -1
- package/src/core/primitives/checkbox/checkbox.tsx +3 -4
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +17 -42
- package/src/core/primitives/code/code.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/flex/index.ts +1 -0
- package/src/core/primitives/grid/grid.tsx +1 -1
- package/src/core/primitives/grid/index.ts +1 -0
- package/src/core/primitives/heading/heading.tsx +1 -1
- package/src/core/primitives/inline/inline.tsx +1 -1
- package/src/core/primitives/kbd/kbd.tsx +1 -1
- package/src/core/primitives/label/label.tsx +1 -1
- package/src/core/{utils → primitives}/layer/__workshop__/index.ts +1 -1
- package/src/core/{utils → primitives}/layer/layer.test.tsx +1 -1
- package/src/core/{utils → primitives}/layer/layer.tsx +2 -2
- package/src/core/{utils → primitives}/layer/layerCard.tsx +3 -3
- package/src/core/{utils → primitives}/layer/layerProvider.tsx +2 -1
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +12 -9
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +9 -8
- package/src/core/primitives/popover/constants.ts +1 -1
- package/src/core/primitives/popover/floating-ui/size.ts +1 -1
- package/src/core/primitives/popover/popover.tsx +8 -4
- package/src/core/primitives/popover/popoverLayer.tsx +4 -2
- package/src/core/primitives/popover/types.ts +5 -0
- package/src/core/primitives/radio/radio.tsx +2 -2
- package/src/core/primitives/select/select.tsx +2 -2
- package/src/core/{components → primitives}/skeleton/__workshop__/index.ts +1 -1
- package/src/core/{components → primitives}/skeleton/codeSkeleton.tsx +1 -1
- package/src/core/{components → primitives}/skeleton/headingSkeleton.tsx +1 -1
- package/src/core/{components → primitives}/skeleton/labelSkeleton.tsx +1 -1
- package/src/core/{components → primitives}/skeleton/skeleton.tsx +7 -8
- package/src/core/{components → primitives}/skeleton/textSkeleton.tsx +1 -1
- package/src/core/primitives/spinner/spinner.tsx +1 -1
- package/src/core/{utils → primitives}/srOnly/srOnly.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +2 -1
- package/src/core/primitives/switch/switch.tsx +2 -7
- package/src/core/primitives/text/__workshop__/colored.tsx +2 -2
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +17 -42
- package/src/core/primitives/text/text.tsx +3 -1
- package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/textArea/textArea.tsx +2 -2
- package/src/core/primitives/textInput/textInput.tsx +3 -2
- package/src/core/primitives/tooltip/constants.ts +1 -1
- package/src/core/primitives/tooltip/tooltip.tsx +6 -3
- package/src/core/primitives/tooltip/tooltipLayer.tsx +3 -2
- package/src/core/primitives/types.ts +8 -10
- package/src/core/types/radius.ts +1 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +9 -5
- package/src/core/utils/elementQuery/elementQuery.tsx +2 -2
- package/src/core/utils/getElementRef.ts +1 -0
- package/src/core/utils/portal/portal.tsx +1 -1
- package/src/css/components/dialog/dialog.css.ts +26 -1
- package/src/css/components/dialog/dialog.ts +27 -7
- package/src/css/components/skeleton/skeleton.ts +3 -1
- package/src/css/components/skeleton/types.ts +3 -1
- package/src/css/index.ts +75 -5
- package/src/css/primitives/_input/input.ts +2 -1
- package/src/css/primitives/_input/types.ts +2 -1
- package/src/css/primitives/_selectable/_selectable.css.ts +32 -24
- package/src/css/primitives/_selectable/selectable.ts +1 -1
- package/src/css/primitives/_selectable/types.ts +1 -1
- package/src/css/primitives/avatar/avatar.css.ts +11 -2
- package/src/css/primitives/avatar/avatar.ts +1 -1
- package/src/css/primitives/badge/badge.css.ts +2 -1
- package/src/css/primitives/badge/types.ts +0 -2
- package/src/css/primitives/box/box.ts +35 -37
- package/src/css/primitives/box/types.ts +34 -36
- package/src/css/primitives/button/button.css.ts +4 -0
- package/src/css/primitives/button/button.ts +5 -2
- package/src/css/primitives/button/types.ts +4 -11
- package/src/css/primitives/card/__workshop__/color.tsx +70 -0
- package/src/css/primitives/card/__workshop__/index.ts +14 -0
- package/src/css/primitives/card/card.css.ts +4 -0
- package/src/css/primitives/code/code.ts +3 -1
- package/src/css/primitives/code/types.ts +2 -1
- package/src/css/primitives/container/container.ts +3 -1
- package/src/css/primitives/heading/heading.ts +4 -1
- package/src/css/primitives/heading/types.ts +3 -1
- package/src/css/primitives/kbd/kbd.ts +1 -1
- package/src/css/primitives/kbd/types.ts +1 -1
- package/src/css/primitives/label/label.css.ts +1 -0
- package/src/css/primitives/label/label.ts +4 -1
- package/src/css/primitives/label/types.ts +3 -1
- package/src/css/primitives/switch/switch.css.ts +1 -1
- package/src/css/primitives/text/text.ts +6 -1
- package/src/css/primitives/text/types.ts +5 -2
- package/src/css/props/width/types.ts +1 -1
- package/src/css/props/width/width.css.ts +3 -0
- package/src/theme/v2/build/buildTheme.test.ts +8 -8
- package/src/theme/v2/build/buildTheme.ts +32 -7
- package/src/theme/v3/defaultFonts.ts +6 -6
- package/src/theme/v3/defaultTokens.ts +1 -1
- package/bin/sanity-ui.cjs +0 -5
- package/dist/ui.css +0 -1
- package/src/cli/buildCommand.ts +0 -10
- package/src/cli/index.ts +0 -26
- package/src/core/components/autocomplete/index.ts +0 -2
- package/src/core/components/index.ts +0 -9
- package/src/core/helpers/index.ts +0 -5
- package/src/core/hooks/index.ts +0 -13
- package/src/core/observers/index.ts +0 -2
- package/src/core/primitives/index.ts +0 -27
- package/src/core/types/avatar.ts +0 -16
- package/src/core/types/card.ts +0 -4
- package/src/core/types/index.ts +0 -15
- package/src/core/types/popover.ts +0 -4
- package/src/core/utils/index.ts +0 -8
- package/src/css/__theme/index.ts +0 -16
- package/src/css/__theme/lib/contract/buildVarContract.ts +0 -78
- package/src/css/__theme/lib/contract/index.ts +0 -4
- package/src/css/__theme/lib/contract/types.ts +0 -17
- package/src/css/__theme/resolveTheme.ts +0 -865
- package/src/css/components/index.ts +0 -6
- package/src/css/primitives/index.ts +0 -24
- package/src/css/props/index.ts +0 -37
- package/src/css/utils/srOnly/index.ts +0 -1
- /package/src/core/{global.ts → __DEV__.ts} +0 -0
- /package/src/core/{types/dialog.ts → components/dialog/types.ts} +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/changingProps.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/elementScroll.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/infiniteList.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/windowScrolll.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/index.ts +0 -0
- /package/src/core/observers/{resizeObserver.ts → resize.ts} +0 -0
- /package/src/core/{utils → primitives}/arrow/cmds.ts +0 -0
- /package/src/core/{utils → primitives}/arrow/index.ts +0 -0
- /package/src/core/{types/badge.ts → primitives/badge/types2.ts} +0 -0
- /package/src/core/{types/box.ts → primitives/box/types.ts} +0 -0
- /package/src/core/{types/button.ts → primitives/button/types.ts} +0 -0
- /package/src/core/{types/flex.ts → primitives/flex/types.ts} +0 -0
- /package/src/core/{types/grid.ts → primitives/grid/types.ts} +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/_debug.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/multipleRoots.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/nested.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/responsiveZOffset.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/getLayerContext.test.ts +0 -0
- /package/src/core/{utils → primitives}/layer/getLayerContext.ts +0 -0
- /package/src/core/{utils → primitives}/layer/index.ts +0 -0
- /package/src/core/{utils → primitives}/layer/layerContext.ts +0 -0
- /package/src/core/{utils → primitives}/layer/types.ts +0 -0
- /package/src/core/{utils → primitives}/layer/useLayer.ts +0 -0
- /package/src/core/{components → primitives}/skeleton/__workshop__/delay.tsx +0 -0
- /package/src/core/{components → primitives}/skeleton/__workshop__/skeleton.tsx +0 -0
- /package/src/core/{components → primitives}/skeleton/index.ts +0 -0
- /package/src/core/{utils → primitives}/srOnly/index.ts +0 -0
- /package/src/core/types/{text.ts → textAlign.ts} +0 -0
- /package/src/css/{utils → primitives/srOnly}/index.ts +0 -0
- /package/src/css/{utils → primitives}/srOnly/srOnly.css.ts +0 -0
- /package/src/css/{utils → primitives}/srOnly/srOnly.ts +0 -0
|
@@ -25,11 +25,15 @@ import {
|
|
|
25
25
|
} from 'react'
|
|
26
26
|
|
|
27
27
|
import {Z_OFFSETS} from '../../constants'
|
|
28
|
-
import {usePrefersReducedMotion
|
|
28
|
+
import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
|
|
29
|
+
import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
29
30
|
import {origin} from '../../middleware/origin'
|
|
30
|
-
import type {
|
|
31
|
-
import
|
|
31
|
+
import type {Placement} from '../../types/placement'
|
|
32
|
+
import type {ComponentType, Props} from '../../types/props'
|
|
33
|
+
import {useBoundaryElement} from '../../utils/boundaryElement'
|
|
34
|
+
import {Portal} from '../../utils/portal'
|
|
32
35
|
import {CardProvider, useCard} from '../card'
|
|
36
|
+
import {type LayerOwnProps, useLayer} from '../layer'
|
|
33
37
|
import {
|
|
34
38
|
DEFAULT_FALLBACK_PLACEMENTS,
|
|
35
39
|
DEFAULT_POPOVER_DISTANCE,
|
|
@@ -38,7 +42,7 @@ import {
|
|
|
38
42
|
} from './constants'
|
|
39
43
|
import {size} from './floating-ui/size'
|
|
40
44
|
import {PopoverLayer} from './popoverLayer'
|
|
41
|
-
import type {PopoverUpdateCallback} from './types'
|
|
45
|
+
import type {PopoverMargins, PopoverUpdateCallback} from './types'
|
|
42
46
|
|
|
43
47
|
/** @public */
|
|
44
48
|
export const DEFAULT_POPOVER_ELEMENT = 'div'
|
|
@@ -4,15 +4,17 @@ import {motion} from 'framer-motion'
|
|
|
4
4
|
import {type CSSProperties, type ForwardedRef, useMemo} from 'react'
|
|
5
5
|
|
|
6
6
|
import {POPOVER_MOTION_PROPS} from '../../constants'
|
|
7
|
-
import type {Placement
|
|
8
|
-
import {Arrow
|
|
7
|
+
import type {Placement} from '../../types/placement'
|
|
8
|
+
import {Arrow} from '../arrow'
|
|
9
9
|
import {Flex} from '../flex'
|
|
10
|
+
import {Layer, type LayerOwnProps, type LayerProps} from '../layer'
|
|
10
11
|
import {
|
|
11
12
|
DEFAULT_POPOVER_ARROW_HEIGHT,
|
|
12
13
|
DEFAULT_POPOVER_ARROW_RADIUS,
|
|
13
14
|
DEFAULT_POPOVER_ARROW_WIDTH,
|
|
14
15
|
DEFAULT_POPOVER_MARGINS,
|
|
15
16
|
} from './constants'
|
|
17
|
+
import type {PopoverMargins} from './types'
|
|
16
18
|
|
|
17
19
|
/** @internal */
|
|
18
20
|
export const DEFAULT_POPOVER_LAYER_ELEMENT = 'div'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {radio, radioInput, radioPresentation} from '@sanity/ui/css'
|
|
2
2
|
import {useImperativeHandle, useRef} from 'react'
|
|
3
3
|
|
|
4
|
-
import {useCustomValidity} from '../../hooks'
|
|
5
|
-
import type {ComponentType, Props} from '../../types'
|
|
4
|
+
import {useCustomValidity} from '../../hooks/useCustomValidity'
|
|
5
|
+
import type {ComponentType, Props} from '../../types/props'
|
|
6
6
|
|
|
7
7
|
/** @public */
|
|
8
8
|
export const DEFAULT_RADIO_ELEMENT = 'input'
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
import type {Space} from '@sanity/ui/theme'
|
|
10
10
|
import {useImperativeHandle, useRef} from 'react'
|
|
11
11
|
|
|
12
|
-
import {useCustomValidity} from '../../hooks'
|
|
13
|
-
import type {ComponentType, Props} from '../../types'
|
|
12
|
+
import {useCustomValidity} from '../../hooks/useCustomValidity'
|
|
13
|
+
import type {ComponentType, Props} from '../../types/props'
|
|
14
14
|
import {Box} from '../box'
|
|
15
15
|
import {Text} from '../text'
|
|
16
16
|
|
|
@@ -2,7 +2,7 @@ import {defineScope} from '@sanity/ui-workshop'
|
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
4
|
export default defineScope({
|
|
5
|
-
name: '
|
|
5
|
+
name: 'primitives/skeleton',
|
|
6
6
|
title: 'Skeleton',
|
|
7
7
|
stories: [
|
|
8
8
|
{name: 'skeleton', title: 'Skeleton', component: lazy(() => import('./skeleton'))},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {codeSkeleton, type ResponsiveProp} from '@sanity/ui/css'
|
|
2
2
|
import type {FontCodeSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {Props} from '../../types'
|
|
4
|
+
import type {Props} from '../../types/props'
|
|
5
5
|
import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
|
|
6
6
|
|
|
7
7
|
/** @beta */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {headingSkeleton, type ResponsiveProp} from '@sanity/ui/css'
|
|
2
2
|
import type {FontHeadingSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {Props} from '../../types'
|
|
4
|
+
import type {Props} from '../../types/props'
|
|
5
5
|
import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
|
|
6
6
|
|
|
7
7
|
/** @beta */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {labelSkeleton, type ResponsiveProp} from '@sanity/ui/css'
|
|
2
2
|
import type {FontLabelSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {Props} from '../../types'
|
|
4
|
+
import type {Props} from '../../types/props'
|
|
5
5
|
import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
|
|
6
6
|
|
|
7
7
|
/** @beta */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {skeleton, type SkeletonStyleProps} from '@sanity/ui/css'
|
|
2
2
|
import {useEffect, useState} from 'react'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import type {ComponentType, Props} from '../../types'
|
|
4
|
+
import type {ComponentType, Props} from '../../types/props'
|
|
6
5
|
|
|
7
6
|
/** @beta */
|
|
8
7
|
export const DEFAULT_SKELETON_ELEMENT = 'div'
|
|
@@ -11,11 +10,10 @@ export const DEFAULT_SKELETON_ELEMENT = 'div'
|
|
|
11
10
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
12
11
|
* @beta
|
|
13
12
|
*/
|
|
14
|
-
export type SkeletonOwnProps =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
export type SkeletonOwnProps = SkeletonStyleProps & {
|
|
14
|
+
animated?: boolean
|
|
15
|
+
delay?: number
|
|
16
|
+
}
|
|
19
17
|
|
|
20
18
|
/** @beta */
|
|
21
19
|
export type SkeletonElementType = 'div' | 'span' | ComponentType
|
|
@@ -34,6 +32,7 @@ export function Skeleton<E extends SkeletonElementType = typeof DEFAULT_SKELETON
|
|
|
34
32
|
props: SkeletonProps<E>,
|
|
35
33
|
) {
|
|
36
34
|
const {
|
|
35
|
+
as: As = DEFAULT_SKELETON_ELEMENT,
|
|
37
36
|
animated = false,
|
|
38
37
|
className,
|
|
39
38
|
delay,
|
|
@@ -58,7 +57,7 @@ export function Skeleton<E extends SkeletonElementType = typeof DEFAULT_SKELETON
|
|
|
58
57
|
}, [delay])
|
|
59
58
|
|
|
60
59
|
return (
|
|
61
|
-
<
|
|
60
|
+
<As
|
|
62
61
|
data-ui="Skeleton"
|
|
63
62
|
{...rest}
|
|
64
63
|
className={skeleton({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {type ResponsiveProp, textSkeleton} from '@sanity/ui/css'
|
|
2
2
|
import type {FontTextSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {Props} from '../../types'
|
|
4
|
+
import type {Props} from '../../types/props'
|
|
5
5
|
import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
|
|
6
6
|
|
|
7
7
|
/** @beta */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {type ResponsiveProp, spinner} from '@sanity/ui/css'
|
|
2
2
|
import type {FontTextSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {ComponentType, Props} from '../../types'
|
|
4
|
+
import type {ComponentType, Props} from '../../types/props'
|
|
5
5
|
import {Text} from '../text'
|
|
6
6
|
import {AnimatedSpinnerIcon} from './animatedSpinnerIcon'
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {type ResponsiveProp, stack} from '@sanity/ui/css'
|
|
2
2
|
import type {Space} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {Props} from '../../types'
|
|
4
|
+
import type {Props} from '../../types/props'
|
|
5
5
|
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
6
6
|
|
|
7
7
|
/** @public */
|
|
@@ -17,6 +17,7 @@ export type StackOwnProps = Omit<
|
|
|
17
17
|
| 'direction'
|
|
18
18
|
| 'display'
|
|
19
19
|
| 'flexDirection'
|
|
20
|
+
| 'flexWrap'
|
|
20
21
|
| 'gapX'
|
|
21
22
|
| 'gapY'
|
|
22
23
|
| 'justify'
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@sanity/ui/css'
|
|
8
8
|
import {useEffect, useImperativeHandle, useRef} from 'react'
|
|
9
9
|
|
|
10
|
-
import type {ComponentType, Props} from '../../types'
|
|
10
|
+
import type {ComponentType, Props} from '../../types/props'
|
|
11
11
|
import {Box} from '../box'
|
|
12
12
|
|
|
13
13
|
/** @public */
|
|
@@ -36,7 +36,6 @@ export function Switch<E extends SwitchElementType = typeof DEFAULT_SWITCH_ELEME
|
|
|
36
36
|
) {
|
|
37
37
|
const {
|
|
38
38
|
as: Element = DEFAULT_SWITCH_ELEMENT,
|
|
39
|
-
checked,
|
|
40
39
|
className,
|
|
41
40
|
disabled,
|
|
42
41
|
indeterminate,
|
|
@@ -63,18 +62,14 @@ export function Switch<E extends SwitchElementType = typeof DEFAULT_SWITCH_ELEME
|
|
|
63
62
|
return (
|
|
64
63
|
<Box
|
|
65
64
|
className={_switch({className})}
|
|
66
|
-
data-checked={checked ? '' : undefined}
|
|
67
|
-
data-indeterminate={indeterminate ? '' : undefined}
|
|
68
65
|
data-ui="Switch"
|
|
69
|
-
display="
|
|
66
|
+
display="block"
|
|
70
67
|
position="relative"
|
|
71
68
|
style={style}
|
|
72
69
|
>
|
|
73
70
|
<Element
|
|
74
71
|
{...rest}
|
|
75
|
-
checked={indeterminate !== true && checked}
|
|
76
72
|
className={_switchElement()}
|
|
77
|
-
data-disabled={disabled ? '' : undefined}
|
|
78
73
|
data-read-only={!disabled && readOnly ? '' : undefined}
|
|
79
74
|
disabled={disabled || readOnly}
|
|
80
75
|
type="checkbox"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Flex, Text} from '@sanity/ui'
|
|
2
|
-
import {
|
|
2
|
+
import {vars} from '@sanity/ui/css'
|
|
3
3
|
import type {AvatarColor} from '@sanity/ui/theme'
|
|
4
4
|
import {useSelect} from '@sanity/ui-workshop'
|
|
5
5
|
import {styled} from 'styled-components'
|
|
@@ -7,7 +7,7 @@ import {styled} from 'styled-components'
|
|
|
7
7
|
import {WORKSHOP_AVATAR_COLOR_OPTIONS} from '$workshop'
|
|
8
8
|
|
|
9
9
|
const ColoredText = styled(Text)<{$color: AvatarColor}>`
|
|
10
|
-
${
|
|
10
|
+
${vars.color.fg.slice(4, -1)}: ${({$color}) => vars.color.avatar[$color].bg};
|
|
11
11
|
`
|
|
12
12
|
|
|
13
13
|
export default function ColoredTextStory() {
|
|
@@ -1,48 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {Box,
|
|
1
|
+
import {CropIcon} from '@sanity/icons'
|
|
2
|
+
import {Box, Stack, Text} from '@sanity/ui'
|
|
3
|
+
import {vars} from '@sanity/ui/css'
|
|
4
|
+
import {FONT_TEXT_SIZE} from '@sanity/ui/theme'
|
|
3
5
|
|
|
4
6
|
export default function OpticalAlignment() {
|
|
5
7
|
return (
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<Text size={
|
|
11
|
-
|
|
12
|
-
</Flex>
|
|
13
|
-
|
|
14
|
-
<Flex>
|
|
15
|
-
<Card padding={0} tone="neutral">
|
|
16
|
-
<Text size={3}>Hamburgefonstiv M</Text>
|
|
17
|
-
</Card>
|
|
18
|
-
</Flex>
|
|
19
|
-
|
|
20
|
-
<Flex>
|
|
21
|
-
<Card padding={0} tone="neutral">
|
|
22
|
-
<Text size={2}>Hamburgefonstiv M</Text>
|
|
23
|
-
</Card>
|
|
24
|
-
</Flex>
|
|
25
|
-
|
|
26
|
-
<Flex>
|
|
27
|
-
<Card padding={0} tone="neutral">
|
|
28
|
-
<Text size={1}>Hamburgefonstiv M</Text>
|
|
29
|
-
</Card>
|
|
30
|
-
</Flex>
|
|
31
|
-
|
|
32
|
-
<Flex>
|
|
33
|
-
<Card padding={0} tone="neutral">
|
|
34
|
-
<Text size={0}>Hamburgefonstiv M</Text>
|
|
35
|
-
</Card>
|
|
36
|
-
</Flex>
|
|
37
|
-
|
|
38
|
-
<Flex>
|
|
39
|
-
<Card padding={2} tone="neutral">
|
|
40
|
-
<Text>
|
|
41
|
-
<AddCircleIcon />
|
|
8
|
+
<Stack gap={4} padding={[4, 5, 6]}>
|
|
9
|
+
{FONT_TEXT_SIZE.map((size) => (
|
|
10
|
+
<Box display="flex" gap={2} key={size}>
|
|
11
|
+
<div style={{outline: `0.5px solid ${vars.color.tinted.suggest.border[4]}`}}>
|
|
12
|
+
<Text size={size}>
|
|
13
|
+
<CropIcon />
|
|
42
14
|
</Text>
|
|
43
|
-
</
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
15
|
+
</div>
|
|
16
|
+
<div style={{outline: `0.5px solid ${vars.color.tinted.suggest.border[4]}`}}>
|
|
17
|
+
<Text size={size}>Hamburgefonstiv M</Text>
|
|
18
|
+
</div>
|
|
19
|
+
</Box>
|
|
20
|
+
))}
|
|
21
|
+
</Stack>
|
|
47
22
|
)
|
|
48
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {text, textOverflow, type TextOverflowStyleProps, type TextStyleProps} from '@sanity/ui/css'
|
|
2
2
|
|
|
3
|
-
import type {ComponentType, Props} from '../../types'
|
|
3
|
+
import type {ComponentType, Props} from '../../types/props'
|
|
4
4
|
|
|
5
5
|
/** @public */
|
|
6
6
|
export const DEFAULT_TEXT_ELEMENT = 'div'
|
|
@@ -39,6 +39,7 @@ export function Text<E extends TextElementType = typeof DEFAULT_TEXT_ELEMENT>(pr
|
|
|
39
39
|
children,
|
|
40
40
|
className,
|
|
41
41
|
flex,
|
|
42
|
+
maxWidth = 'fill',
|
|
42
43
|
muted,
|
|
43
44
|
size = 2,
|
|
44
45
|
textOverflow: textOverflowProp,
|
|
@@ -55,6 +56,7 @@ export function Text<E extends TextElementType = typeof DEFAULT_TEXT_ELEMENT>(pr
|
|
|
55
56
|
accent,
|
|
56
57
|
align,
|
|
57
58
|
flex,
|
|
59
|
+
maxWidth,
|
|
58
60
|
muted,
|
|
59
61
|
size,
|
|
60
62
|
weight,
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
import type {Space} from '@sanity/ui/theme'
|
|
9
9
|
import {useImperativeHandle, useRef} from 'react'
|
|
10
10
|
|
|
11
|
-
import {useCustomValidity} from '../../hooks'
|
|
12
|
-
import type {ComponentType, Props} from '../../types'
|
|
11
|
+
import {useCustomValidity} from '../../hooks/useCustomValidity'
|
|
12
|
+
import type {ComponentType, Props} from '../../types/props'
|
|
13
13
|
|
|
14
14
|
/** @public */
|
|
15
15
|
export const DEFAULT_TEXT_AREA_ELEMENT = 'textarea'
|
|
@@ -23,9 +23,10 @@ import {
|
|
|
23
23
|
import {isValidElementType} from 'react-is'
|
|
24
24
|
|
|
25
25
|
import {EMPTY_RECORD} from '../../constants'
|
|
26
|
-
import {useCustomValidity
|
|
26
|
+
import {useCustomValidity} from '../../hooks/useCustomValidity'
|
|
27
|
+
import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
27
28
|
import {isRecord} from '../../lib/isRecord'
|
|
28
|
-
import type {ComponentType, Props} from '../../types'
|
|
29
|
+
import type {ComponentType, Props} from '../../types/props'
|
|
29
30
|
import {Box} from '../box'
|
|
30
31
|
import {Button, type ButtonProps} from '../button'
|
|
31
32
|
import {Text} from '../text'
|
|
@@ -31,13 +31,16 @@ import {
|
|
|
31
31
|
import {useEffectEvent} from 'use-effect-event'
|
|
32
32
|
|
|
33
33
|
import {Z_OFFSETS} from '../../constants'
|
|
34
|
-
import {usePrefersReducedMotion} from '../../hooks'
|
|
35
34
|
import {useDelayedState} from '../../hooks/useDelayedState'
|
|
35
|
+
import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
|
|
36
36
|
import {origin} from '../../middleware/origin'
|
|
37
|
-
import type {
|
|
38
|
-
import
|
|
37
|
+
import type {Placement} from '../../types/placement'
|
|
38
|
+
import type {ComponentType, Props} from '../../types/props'
|
|
39
|
+
import {useBoundaryElement} from '../../utils/boundaryElement'
|
|
39
40
|
import {getElementRef} from '../../utils/getElementRef'
|
|
41
|
+
import {Portal, usePortal} from '../../utils/portal'
|
|
40
42
|
import {CardProvider, useCard} from '../card'
|
|
43
|
+
import type {LayerOwnProps} from '../layer'
|
|
41
44
|
import type {Delay} from '../types'
|
|
42
45
|
import {
|
|
43
46
|
DEFAULT_FALLBACK_PLACEMENTS,
|
|
@@ -2,8 +2,9 @@ import {motion, type MotionStyle} from 'framer-motion'
|
|
|
2
2
|
import {type CSSProperties, type ForwardedRef, useMemo} from 'react'
|
|
3
3
|
|
|
4
4
|
import {POPOVER_MOTION_PROPS} from '../../constants'
|
|
5
|
-
import type {Placement} from '../../types'
|
|
6
|
-
import {Arrow
|
|
5
|
+
import type {Placement} from '../../types/placement'
|
|
6
|
+
import {Arrow} from '../arrow'
|
|
7
|
+
import {Layer, type LayerOwnProps, type LayerProps} from '../layer'
|
|
7
8
|
import {
|
|
8
9
|
DEFAULT_TOOLTIP_ARROW_HEIGHT,
|
|
9
10
|
DEFAULT_TOOLTIP_ARROW_RADIUS,
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
AlignItems,
|
|
3
|
+
BoxHeight,
|
|
4
|
+
BoxOverflow,
|
|
5
|
+
BoxSizing,
|
|
3
6
|
Flex,
|
|
4
7
|
FlexDirection,
|
|
5
8
|
FlexWrap,
|
|
9
|
+
GridAutoCols,
|
|
10
|
+
GridAutoFlow,
|
|
11
|
+
GridAutoRows,
|
|
6
12
|
GridItemColumn,
|
|
7
13
|
GridItemColumnEnd,
|
|
8
14
|
GridItemColumnStart,
|
|
@@ -11,17 +17,9 @@ import type {
|
|
|
11
17
|
GridItemRowStart,
|
|
12
18
|
JustifyContent,
|
|
13
19
|
} from '@sanity/ui/css'
|
|
20
|
+
import type {Radius} from '@sanity/ui/theme'
|
|
14
21
|
|
|
15
|
-
import type {
|
|
16
|
-
BoxDisplay,
|
|
17
|
-
BoxHeight,
|
|
18
|
-
BoxOverflow,
|
|
19
|
-
BoxSizing,
|
|
20
|
-
GridAutoCols,
|
|
21
|
-
GridAutoFlow,
|
|
22
|
-
GridAutoRows,
|
|
23
|
-
Radius,
|
|
24
|
-
} from '../types'
|
|
22
|
+
import type {BoxDisplay} from './box/types'
|
|
25
23
|
|
|
26
24
|
/**
|
|
27
25
|
* @public
|
package/src/core/types/radius.ts
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import {Box, Card, ElementQuery, Text} from '@sanity/ui'
|
|
2
|
-
import {
|
|
2
|
+
import {vars} from '@sanity/ui/css'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
|
|
5
5
|
const TestCard = styled(Card)`
|
|
6
6
|
[data-eq-min~='0'] > & {
|
|
7
|
-
${
|
|
7
|
+
${vars.color.fg.slice(4, -1)}: light-dark(${vars.color.palette.orange[600]}, ${vars.color
|
|
8
|
+
.palette.orange[400]});
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
[data-eq-min~='1'] > & {
|
|
11
|
-
${
|
|
12
|
+
${vars.color.fg.slice(4, -1)}: light-dark(${vars.color.palette.red[600]}, ${vars.color.palette
|
|
13
|
+
.red[400]});
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
[data-eq-min~='2'] > & {
|
|
15
|
-
${
|
|
17
|
+
${vars.color.fg.slice(4, -1)}: light-dark(${vars.color.palette.magenta[600]}, ${vars.color
|
|
18
|
+
.palette.magenta[400]});
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
[data-eq-min~='3'] > & {
|
|
19
|
-
${
|
|
22
|
+
${vars.color.fg.slice(4, -1)}: light-dark(${vars.color.palette.purple[600]}, ${vars.color
|
|
23
|
+
.palette.purple[400]});
|
|
20
24
|
}
|
|
21
25
|
`
|
|
22
26
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {BREAKPOINTS} from '@sanity/ui/css'
|
|
2
2
|
import {useImperativeHandle, useMemo, useState} from 'react'
|
|
3
3
|
|
|
4
|
-
import {useElementSize} from '../../hooks'
|
|
5
|
-
import type {ComponentType, Props} from '../../types'
|
|
4
|
+
import {useElementSize} from '../../hooks/useElementSize'
|
|
5
|
+
import type {ComponentType, Props} from '../../types/props'
|
|
6
6
|
import {findMaxBreakpoints, findMinBreakpoints} from './helpers'
|
|
7
7
|
|
|
8
8
|
/** @beta */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @internal */
|
|
1
2
|
// Based on https://github.com/radix-ui/primitives/blob/0bade6a704e5821b90a6da0f3d8cfa8a7711127d/packages/react/slot/src/Slot.tsx#L128-L150
|
|
2
3
|
// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`
|
|
3
4
|
// After React 19 accessing `element.ref` does the opposite.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {ReactNode, ReactPortal} from 'react'
|
|
2
2
|
import {createPortal} from 'react-dom'
|
|
3
3
|
|
|
4
|
-
import {CardProvider, useCard} from '../../primitives'
|
|
4
|
+
import {CardProvider, useCard} from '../../primitives/card'
|
|
5
5
|
import {usePortal} from './usePortal'
|
|
6
6
|
|
|
7
7
|
/** @public */
|
|
@@ -63,8 +63,33 @@ export const container = _style(layers.components, {
|
|
|
63
63
|
height: '100%',
|
|
64
64
|
})
|
|
65
65
|
|
|
66
|
-
export const
|
|
66
|
+
export const scroller = _style(layers.components, {
|
|
67
67
|
width: '100%',
|
|
68
|
+
height: '100%',
|
|
69
|
+
// overflow: 'auto',
|
|
70
|
+
outline: 'none',
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
export const scrollerShadowTop = _style(layers.components, {
|
|
74
|
+
position: 'absolute',
|
|
75
|
+
top: 0,
|
|
76
|
+
left: 0,
|
|
77
|
+
right: 0,
|
|
78
|
+
height: 8,
|
|
79
|
+
background: `linear-gradient(to top, color-mix(in srgb,transparent, ${vars.color.shadow.penumbra} 0%) 0%, color-mix(in srgb, ${vars.color.shadow.umbra} 100%, transparent 100%) 100%)`,
|
|
80
|
+
boxShadow: `inset 0 0.5px 0 color-mix(in srgb, transparent, ${vars.color.shadow.outline} 50%)`,
|
|
81
|
+
pointerEvents: 'none',
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
export const scrollerShadowBottom = _style(layers.components, {
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
bottom: 0,
|
|
87
|
+
left: 0,
|
|
88
|
+
right: 0,
|
|
89
|
+
height: 8,
|
|
90
|
+
background: `linear-gradient(to bottom, color-mix(in srgb,transparent, ${vars.color.shadow.penumbra} 0%) 0%, color-mix(in srgb, ${vars.color.shadow.umbra} 100%, transparent 100%) 100%)`,
|
|
91
|
+
boxShadow: `inset 0 -0.5px 0 color-mix(in srgb, transparent, ${vars.color.shadow.outline} 50%)`,
|
|
92
|
+
pointerEvents: 'none',
|
|
68
93
|
})
|
|
69
94
|
|
|
70
95
|
export const header = _style(layers.components, {
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import {_composeClassNames} from '../../_composeClassNames'
|
|
2
|
-
import {inset} from '../../props'
|
|
3
|
-
import {
|
|
2
|
+
import {inset} from '../../props/inset'
|
|
3
|
+
import {
|
|
4
|
+
card,
|
|
5
|
+
container,
|
|
6
|
+
content,
|
|
7
|
+
footer,
|
|
8
|
+
header,
|
|
9
|
+
root,
|
|
10
|
+
scroller,
|
|
11
|
+
scrollerShadowBottom,
|
|
12
|
+
scrollerShadowTop,
|
|
13
|
+
} from './dialog.css'
|
|
4
14
|
|
|
5
15
|
/** @public */
|
|
6
16
|
export function dialog(props: {className?: string}): string | undefined {
|
|
@@ -17,11 +27,6 @@ export function dialogContainer(): string | undefined {
|
|
|
17
27
|
return container
|
|
18
28
|
}
|
|
19
29
|
|
|
20
|
-
/** @public */
|
|
21
|
-
export function dialogLayout(): string | undefined {
|
|
22
|
-
return layout
|
|
23
|
-
}
|
|
24
|
-
|
|
25
30
|
/** @public */
|
|
26
31
|
export function dialogHeader(): string | undefined {
|
|
27
32
|
return header
|
|
@@ -32,6 +37,21 @@ export function dialogContent(): string | undefined {
|
|
|
32
37
|
return content
|
|
33
38
|
}
|
|
34
39
|
|
|
40
|
+
/** @public */
|
|
41
|
+
export function dialogScroller(): string | undefined {
|
|
42
|
+
return scroller
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** @public */
|
|
46
|
+
export function dialogScrollerShadowTop(): string | undefined {
|
|
47
|
+
return scrollerShadowTop
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** @public */
|
|
51
|
+
export function dialogScrollerShadowBottom(): string | undefined {
|
|
52
|
+
return scrollerShadowBottom
|
|
53
|
+
}
|
|
54
|
+
|
|
35
55
|
/** @public */
|
|
36
56
|
export function dialogFooter(): string | undefined {
|
|
37
57
|
return footer
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {_composeClassNames} from '../../_composeClassNames'
|
|
2
2
|
import {_responsiveClassName} from '../../_responsiveClassName'
|
|
3
|
+
import {flex} from '../../props/flex'
|
|
4
|
+
import {margin} from '../../props/margin'
|
|
3
5
|
import {radius} from '../../props/radius'
|
|
4
6
|
import {codeScale, font, headingScale, labelScale, root, textScale} from './skeleton.css'
|
|
5
7
|
import type {
|
|
@@ -12,7 +14,7 @@ import type {
|
|
|
12
14
|
|
|
13
15
|
/** @beta */
|
|
14
16
|
export function skeleton(props: SkeletonStyleProps): string | undefined {
|
|
15
|
-
return _composeClassNames(props.className, root, radius(props))
|
|
17
|
+
return _composeClassNames(props.className, root, flex(props), radius(props), margin(props))
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
/** @beta */
|