@sanity/ui 3.0.0-static.11 → 3.0.0-static.13
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/dist/_chunks-cjs/_visual-editing.js +1293 -1215
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/buildCommand.js +28 -10
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +1284 -1202
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +528 -358
- package/dist/_visual-editing.d.ts +528 -358
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +143 -73
- package/dist/css.d.ts +143 -73
- package/dist/css.js +329 -472
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +330 -473
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +1362 -869
- package/dist/index.d.ts +1362 -869
- package/dist/index.js +383 -308
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +387 -312
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-palette.css +105 -1
- package/dist/sanity-palette.min.css +1 -0
- package/dist/sanity-theme.css +4571 -1
- package/dist/sanity-theme.min.css +1 -0
- package/dist/system.css +22053 -21946
- package/dist/system.min.css +1 -0
- package/dist/theme.d.mts +51 -106
- package/dist/theme.d.ts +51 -106
- package/dist/theme.js +9 -9
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +9 -9
- package/dist/theme.mjs.map +1 -1
- package/package.json +10 -5
- package/src/cli/buildCommand.ts +46 -19
- package/src/css/_comp.ts +2 -2
- package/src/css/{compile/compileStyle.ts → _compileStyle.ts} +7 -7
- package/src/css/{system.style.ts → _system.style.ts} +3 -2
- package/src/css/aspects/display/display.ts +1 -0
- package/src/css/aspects/display/types.ts +2 -3
- package/src/css/aspects/flex/types.ts +4 -12
- package/src/css/aspects/flexItem/types.ts +1 -3
- package/src/css/aspects/font/types.ts +1 -3
- package/src/css/aspects/grid/grid.ts +1 -0
- package/src/css/aspects/grid/types.ts +5 -9
- package/src/css/aspects/gridItem/gridItem.ts +1 -1
- package/src/css/aspects/gridItem/types.ts +7 -18
- package/src/css/aspects/height/height.ts +3 -4
- package/src/css/aspects/inset/inset.ts +1 -0
- package/src/css/aspects/margin/margin.ts +1 -0
- package/src/css/aspects/margin/types.ts +1 -0
- package/src/css/aspects/maxWidth/maxWidth.ts +1 -0
- package/src/css/aspects/maxWidth/types.ts +1 -0
- package/src/css/aspects/minWidth/minWidth.ts +1 -0
- package/src/css/aspects/minWidth/types.ts +2 -0
- package/src/css/aspects/overflow/overflow.ts +1 -0
- package/src/css/aspects/padding/padding.ts +1 -0
- package/src/css/aspects/pointerEvents/pointerEvents.ts +1 -0
- package/src/css/aspects/position/position.ts +1 -0
- package/src/css/aspects/shadow/shadow.ts +1 -0
- package/src/css/aspects/textOverflow/textOverflow.ts +1 -0
- package/src/css/aspects/textOverflow/types.ts +1 -0
- package/src/css/aspects/width/types.ts +2 -0
- package/src/css/aspects/width/width.ts +1 -0
- package/src/css/{compile/compilePalette.ts → compilePalette.ts} +14 -10
- package/src/css/compileSystem.ts +7 -0
- package/src/css/{compile/compileTheme.ts → compileTheme.ts} +1 -0
- package/src/css/{compile/compileTheme_v3.ts → compileTheme_v3.ts} +123 -104
- package/src/css/components/breadcrumbs/breadcrumbs.ts +1 -0
- package/src/css/components/dialog/dialog.ts +7 -0
- package/src/css/components/menu/menu.ts +2 -0
- package/src/css/components/skeleton/skeleton.ts +4 -0
- package/src/css/components/skeleton/types.ts +4 -0
- package/src/css/components/toast/toast.ts +5 -0
- package/src/css/components/tree/tree.ts +1 -0
- package/src/css/composeClassNames.ts +4 -2
- package/src/css/constants.ts +2 -0
- package/src/css/index.ts +3 -3
- package/src/css/primitives/_arrow/_arrow.ts +3 -0
- package/src/css/primitives/_input/input.ts +2 -0
- package/src/css/primitives/_selectable/_selectable.style.ts +1 -2
- package/src/css/primitives/_selectable/selectable.ts +1 -2
- package/src/css/primitives/avatar/avatar.style.ts +5 -8
- package/src/css/primitives/avatar/avatar.ts +6 -0
- package/src/css/primitives/avatar/types.ts +1 -0
- package/src/css/primitives/box/types.ts +1 -3
- package/src/css/primitives/button/button.ts +4 -21
- package/src/css/primitives/button/index.ts +1 -0
- package/src/css/primitives/button/types.ts +18 -0
- package/src/css/primitives/card/card.style.ts +3 -6
- package/src/css/primitives/card/card.ts +2 -2
- package/src/css/primitives/card/types.ts +2 -2
- package/src/css/primitives/checkbox/checkbox.ts +2 -0
- package/src/css/primitives/container/container.ts +1 -0
- package/src/css/primitives/container/types.ts +1 -0
- package/src/css/primitives/kbd/kbd.ts +1 -0
- package/src/css/primitives/label/types.ts +7 -2
- package/src/css/primitives/popover/popover.ts +2 -0
- package/src/css/primitives/radio/radio.ts +1 -0
- package/src/css/primitives/select/select.ts +2 -0
- package/src/css/primitives/spinner/spinner.ts +2 -0
- package/src/css/primitives/switch/switch.ts +5 -0
- package/src/css/primitives/text/types.ts +4 -0
- package/src/css/primitives/textArea/textArea.ts +1 -0
- package/src/css/primitives/textInput/textInput.ts +1 -0
- package/src/css/primitives/tooltip/tooltip.ts +2 -0
- package/src/css/scopeClassName.ts +1 -0
- package/src/css/types.ts +9 -12
- package/src/css/util.ts +5 -0
- package/src/css/utils/srOnly/srOnly.ts +3 -1
- package/src/css/varNames.ts +131 -141
- package/src/css/vars.ts +1 -6
- package/src/theme/palette/constants.ts +2 -0
- package/src/theme/palette/types.ts +3 -0
- package/src/theme/types.ts +2 -6
- package/src/theme/v0/focusRing.ts +1 -3
- package/src/theme/v0/font.ts +6 -18
- package/src/theme/v0/layer.ts +1 -3
- package/src/theme/v0/shadow.ts +2 -6
- package/src/theme/v2/avatar.ts +1 -3
- package/src/theme/v2/color/_system.ts +1 -3
- package/src/theme/v2/color/avatar.ts +2 -6
- package/src/theme/v2/color/badge.ts +2 -6
- package/src/theme/v2/color/button.ts +3 -9
- package/src/theme/v2/color/color.ts +3 -9
- package/src/theme/v2/color/input.ts +3 -9
- package/src/theme/v2/color/kbd.ts +1 -3
- package/src/theme/v2/color/selectable.ts +2 -6
- package/src/theme/v2/color/state.ts +1 -3
- package/src/theme/v2/color/syntax.ts +1 -3
- package/src/theme/v2/input.ts +1 -3
- package/src/theme/v2/theme.ts +2 -6
- package/src/theme/v3/buildTheme_v3.ts +1 -0
- package/src/theme/v3/color/color.ts +6 -4
- package/src/theme/v3/color/renderColor.ts +4 -1
- package/src/theme/v3/defaultTokens.ts +1 -0
- package/src/theme/v3/resolveTokens.ts +9 -9
- package/src/ui/RootClassNames.tsx +3 -0
- package/src/ui/StyleTags.tsx +3 -1
- package/src/ui/_compat/theme/themeColorProvider.tsx +2 -6
- package/src/ui/_compat/theme/themeProvider.tsx +2 -6
- package/src/ui/_compat/theme/types.ts +1 -3
- package/src/ui/_compat/theme/useRootTheme.ts +1 -3
- package/src/ui/_compat/theme/useTheme.ts +2 -6
- package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/ui/components/autocomplete/autocomplete.tsx +86 -114
- package/src/ui/components/autocomplete/autocompleteOption.tsx +2 -0
- package/src/ui/components/autocomplete/types.ts +3 -8
- package/src/ui/components/breadcrumbs/breadcrumbs.tsx +27 -21
- package/src/ui/components/dialog/dialog.tsx +89 -291
- package/src/ui/components/dialog/dialogCard.tsx +183 -0
- package/src/ui/components/dialog/isTargetWithinScope.ts +14 -0
- package/src/ui/components/hotkeys/hotkeys.tsx +33 -15
- package/src/ui/components/menu/__workshop__/asComponent.tsx +6 -6
- package/src/ui/components/menu/menu.tsx +27 -33
- package/src/ui/components/menu/menuButton.tsx +10 -14
- package/src/ui/components/menu/menuDivider.tsx +25 -13
- package/src/ui/components/menu/menuGroup.tsx +34 -26
- package/src/ui/components/menu/menuItem.tsx +51 -40
- package/src/ui/components/skeleton/codeSkeleton.tsx +53 -0
- package/src/ui/components/skeleton/headingSkeleton.tsx +52 -0
- package/src/ui/components/skeleton/index.ts +3 -0
- package/src/ui/components/skeleton/labelSkeleton.tsx +51 -0
- package/src/ui/components/skeleton/skeleton.tsx +39 -16
- package/src/ui/components/skeleton/textSkeleton.tsx +31 -110
- package/src/ui/components/tab/tab.tsx +23 -19
- package/src/ui/components/tab/tabList.tsx +34 -33
- package/src/ui/components/tab/tabPanel.tsx +25 -19
- package/src/ui/components/toast/toast.tsx +21 -16
- package/src/ui/components/toast/toastLayer.tsx +28 -10
- package/src/ui/components/toast/toastProvider.tsx +2 -6
- package/src/ui/components/toast/types.ts +2 -6
- package/src/ui/components/toast/useToast.ts +1 -3
- package/src/ui/components/tree/tree.tsx +194 -187
- package/src/ui/components/tree/treeGroup.tsx +25 -5
- package/src/ui/components/tree/treeItem.tsx +35 -23
- package/src/ui/hooks/useClickOutside.ts +2 -6
- package/src/ui/hooks/useClickOutsideEvent.ts +3 -9
- package/src/ui/primitives/_selectable/selectable.tsx +33 -20
- package/src/ui/primitives/avatar/avatar.tsx +28 -31
- package/src/ui/primitives/avatar/avatarCounter.tsx +33 -25
- package/src/ui/primitives/avatar/avatarStack.tsx +31 -24
- package/src/ui/primitives/avatar/types.ts +2 -0
- package/src/ui/primitives/badge/__workshop__/props.tsx +1 -9
- package/src/ui/primitives/badge/__workshop__/tones.tsx +1 -6
- package/src/ui/primitives/badge/badge.tsx +33 -32
- package/src/ui/primitives/badge/types.ts +2 -1
- package/src/ui/primitives/box/box.tsx +59 -29
- package/src/ui/primitives/button/__workshop__/sanityUploadButton.tsx +3 -3
- package/src/ui/primitives/button/__workshop__/uploadButton.tsx +2 -1
- package/src/ui/primitives/button/button.test.tsx +1 -15
- package/src/ui/primitives/button/button.tsx +64 -70
- package/src/ui/primitives/card/__workshop__/asComponent.tsx +3 -3
- package/src/ui/primitives/card/card.tsx +22 -22
- package/src/ui/primitives/card/cardProvider.tsx +2 -0
- package/src/ui/primitives/checkbox/checkbox.tsx +26 -15
- package/src/ui/primitives/code/code.tsx +24 -22
- package/src/ui/primitives/container/container.tsx +26 -15
- package/src/ui/primitives/flex/flex.tsx +21 -19
- package/src/ui/primitives/grid/grid.tsx +21 -16
- package/src/ui/primitives/heading/heading.tsx +42 -19
- package/src/ui/primitives/inline/inline.tsx +26 -23
- package/src/ui/primitives/kbd/kbd.tsx +25 -23
- package/src/ui/primitives/label/label.tsx +41 -26
- package/src/ui/primitives/popover/popover.tsx +281 -277
- package/src/ui/primitives/popover/popoverCard.tsx +119 -118
- package/src/ui/primitives/radio/radio.tsx +30 -14
- package/src/ui/primitives/select/select.tsx +24 -16
- package/src/ui/primitives/spinner/animatedSpinnerIcon.tsx +4 -2
- package/src/ui/primitives/spinner/spinner.tsx +24 -12
- package/src/ui/primitives/stack/stack.tsx +27 -18
- package/src/ui/primitives/switch/switch.tsx +31 -14
- package/src/ui/primitives/text/text.tsx +42 -24
- package/src/ui/primitives/textArea/textArea.tsx +33 -18
- package/src/ui/primitives/textInput/textInput.tsx +28 -40
- package/src/ui/primitives/tooltip/constants.ts +1 -1
- package/src/ui/primitives/tooltip/tooltip.tsx +76 -59
- package/src/ui/primitives/tooltip/tooltipCard.tsx +89 -82
- package/src/ui/primitives/types.ts +1 -3
- package/src/ui/types/avatar.ts +3 -6
- package/src/ui/types/badge.ts +1 -3
- package/src/ui/types/button.ts +1 -3
- package/src/ui/types/card.ts +1 -3
- package/src/ui/types/dialog.ts +1 -3
- package/src/ui/types/props.ts +20 -10
- package/src/ui/utils/arrow/arrow.tsx +40 -14
- package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +2 -6
- package/src/ui/utils/boundaryElement/types.ts +1 -3
- package/src/ui/utils/boundaryElement/useBoundaryElement.ts +1 -3
- package/src/ui/utils/elementQuery/elementQuery.tsx +36 -14
- package/src/ui/utils/errorBoundary.tsx +2 -0
- package/src/ui/utils/index.ts +0 -1
- package/src/ui/utils/layer/layer.tsx +23 -93
- package/src/ui/utils/layer/layerCard.tsx +92 -0
- package/src/ui/utils/layer/layerProvider.tsx +2 -6
- package/src/ui/utils/layer/useLayer.ts +1 -3
- package/src/ui/utils/portal/portal.ts +2 -6
- package/src/ui/utils/portal/portalProvider.tsx +2 -6
- package/src/ui/utils/portal/types.ts +1 -3
- package/src/ui/utils/portal/usePortal.ts +1 -3
- package/src/ui/utils/srOnly/srOnly.tsx +25 -20
- package/src/ui/utils/virtualList/virtualList.tsx +36 -24
- package/src/css/compile/compileRule.ts +0 -97
- package/src/css/compile/compileRules.test.ts +0 -36
- package/src/css/compile/compileRules.ts +0 -43
- package/src/css/compile/compileSystem.ts +0 -7
- package/src/css/compile/types.ts +0 -6
- package/src/css/primitives/_selectable/_contants.ts +0 -11
- package/src/css/primitives/card/_constants.ts +0 -13
- package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +0 -23
- package/src/ui/utils/conditionalWrapper/index.ts +0 -1
|
@@ -1,49 +1,51 @@
|
|
|
1
1
|
import {code, composeClassNames, FontStyleProps} from '@sanity/ui/css'
|
|
2
|
-
import {
|
|
2
|
+
import {lazy, Suspense} from 'react'
|
|
3
3
|
|
|
4
|
-
import {Props} from '../../types'
|
|
4
|
+
import {ComponentType, Props} from '../../types'
|
|
5
5
|
|
|
6
6
|
const LazyRefractor = lazy(() => import('./refractor'))
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
/** @public */
|
|
9
|
+
export const DEFAULT_CODE_ELEMENT = 'pre'
|
|
10
|
+
|
|
11
|
+
/** @public */
|
|
12
|
+
export type CodeOwnProps = Omit<FontStyleProps, 'align'> & {
|
|
12
13
|
/** Define the language to use for syntax highlighting. */
|
|
13
14
|
language?: string
|
|
14
15
|
size?: number | number[]
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
/** @public */
|
|
19
|
+
export type CodeElementType = 'div' | 'pre' | ComponentType
|
|
20
|
+
|
|
21
|
+
/** @public */
|
|
22
|
+
export type CodeProps<E extends CodeElementType = CodeElementType> = Props<CodeOwnProps, E>
|
|
23
|
+
|
|
24
|
+
/** @public */
|
|
25
|
+
export function Code<E extends CodeElementType = typeof DEFAULT_CODE_ELEMENT>(props: CodeProps<E>) {
|
|
24
26
|
const {
|
|
25
|
-
as:
|
|
27
|
+
as: Element = DEFAULT_CODE_ELEMENT,
|
|
26
28
|
children,
|
|
27
29
|
className,
|
|
28
30
|
language: languageProp,
|
|
29
31
|
size = 2,
|
|
30
32
|
weight,
|
|
31
|
-
...
|
|
32
|
-
} = props
|
|
33
|
+
...rest
|
|
34
|
+
} = props as CodeProps<typeof DEFAULT_CODE_ELEMENT>
|
|
35
|
+
|
|
33
36
|
const language = typeof languageProp === 'string' ? languageProp : undefined
|
|
34
37
|
|
|
35
38
|
return (
|
|
36
|
-
<
|
|
39
|
+
<Element
|
|
37
40
|
data-ui="Code"
|
|
38
|
-
{...
|
|
41
|
+
{...rest}
|
|
39
42
|
className={composeClassNames(className, code({size, weight}))}
|
|
40
|
-
ref={ref}
|
|
41
43
|
>
|
|
42
44
|
<Suspense fallback={<code>{children}</code>}>
|
|
43
45
|
<LazyRefractor language={language} value={children} />
|
|
44
46
|
</Suspense>
|
|
45
|
-
</
|
|
47
|
+
</Element>
|
|
46
48
|
)
|
|
47
|
-
}
|
|
49
|
+
}
|
|
48
50
|
|
|
49
|
-
Code.displayName = '
|
|
51
|
+
Code.displayName = 'Code'
|
|
@@ -1,35 +1,46 @@
|
|
|
1
1
|
import {composeClassNames, container, ContainerStyleProps} from '@sanity/ui/css'
|
|
2
|
-
import {ForwardedRef, forwardRef} from 'react'
|
|
3
2
|
|
|
4
3
|
import {Props} from '../../types'
|
|
5
|
-
import {Box,
|
|
4
|
+
import {Box, BoxElementType, BoxOwnProps} from '../box'
|
|
6
5
|
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
/** @public */
|
|
7
|
+
export const DEFAULT_CONTAINER_ELEMENT = 'div'
|
|
8
|
+
|
|
9
|
+
/** @public */
|
|
10
|
+
export type ContainerOwnProps = Omit<BoxOwnProps, 'width'> & ContainerStyleProps
|
|
11
|
+
|
|
12
|
+
/** @public */
|
|
13
|
+
export type ContainerElementType = BoxElementType
|
|
14
|
+
|
|
15
|
+
/** @public */
|
|
16
|
+
export type ContainerProps<E extends ContainerElementType = ContainerElementType> = Props<
|
|
17
|
+
ContainerOwnProps,
|
|
18
|
+
E
|
|
19
|
+
>
|
|
11
20
|
|
|
12
21
|
/**
|
|
13
22
|
* The `Container` component wraps content layout in a defined set of widths.
|
|
14
23
|
*
|
|
15
24
|
* @public
|
|
16
25
|
*/
|
|
17
|
-
export
|
|
18
|
-
props:
|
|
19
|
-
ref: ForwardedRef<HTMLDivElement>,
|
|
26
|
+
export function Container<E extends ContainerElementType = typeof DEFAULT_CONTAINER_ELEMENT>(
|
|
27
|
+
props: ContainerProps<E>,
|
|
20
28
|
) {
|
|
21
|
-
const {
|
|
29
|
+
const {
|
|
30
|
+
as = DEFAULT_CONTAINER_ELEMENT,
|
|
31
|
+
className,
|
|
32
|
+
width = 2,
|
|
33
|
+
...rest
|
|
34
|
+
} = props as ContainerProps<typeof DEFAULT_CONTAINER_ELEMENT>
|
|
22
35
|
|
|
23
36
|
return (
|
|
24
37
|
<Box
|
|
25
38
|
data-ui="Container"
|
|
26
|
-
{...
|
|
39
|
+
{...rest}
|
|
27
40
|
as={as}
|
|
28
41
|
className={composeClassNames(className, container({width}))}
|
|
29
|
-
ref={ref}
|
|
30
|
-
sizing={sizing}
|
|
31
42
|
/>
|
|
32
43
|
)
|
|
33
|
-
}
|
|
44
|
+
}
|
|
34
45
|
|
|
35
|
-
Container.displayName = '
|
|
46
|
+
Container.displayName = 'Container'
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import {ForwardedRef, forwardRef} from 'react'
|
|
2
|
-
|
|
3
1
|
import {Props} from '../../types'
|
|
4
|
-
import {Box,
|
|
2
|
+
import {Box, BoxElementType, BoxOwnProps} from '../box'
|
|
5
3
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
/** @public */
|
|
5
|
+
export const DEFAULT_FLEX_ELEMENT = 'div'
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export type FlexOwnProps = Omit<BoxOwnProps, 'display'>
|
|
9
|
+
|
|
10
|
+
/** @public */
|
|
11
|
+
export type FlexElementType = BoxElementType
|
|
12
|
+
|
|
13
|
+
/** @public */
|
|
14
|
+
export type FlexProps<E extends FlexElementType = FlexElementType> = Props<FlexOwnProps, E>
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* The `Flex` component is a wrapper component for flexible elements (`Box`, `Card` and `Flex`).
|
|
15
18
|
*
|
|
16
19
|
* @public
|
|
17
20
|
*/
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
export function Flex<E extends FlexElementType = typeof DEFAULT_FLEX_ELEMENT>(props: FlexProps<E>) {
|
|
22
|
+
const {
|
|
23
|
+
as = DEFAULT_FLEX_ELEMENT,
|
|
24
|
+
direction = 'row',
|
|
25
|
+
...rest
|
|
26
|
+
} = props as FlexProps<typeof DEFAULT_FLEX_ELEMENT>
|
|
23
27
|
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
})
|
|
28
|
+
return <Box data-ui="Flex" {...rest} as={as} direction={direction} display="flex" />
|
|
29
|
+
}
|
|
28
30
|
|
|
29
|
-
Flex.displayName = '
|
|
31
|
+
Flex.displayName = 'Flex'
|
|
@@ -1,30 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {Props} from '../../types'
|
|
2
|
+
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
/** @public */
|
|
5
|
+
export const DEFAULT_GRID_ELEMENT = 'div'
|
|
5
6
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
7
|
+
/** @public */
|
|
8
|
+
export type GridOwnProps = Omit<BoxOwnProps, 'display'>
|
|
9
|
+
|
|
10
|
+
/** @public */
|
|
11
|
+
export type GridElementType = BoxElementType
|
|
12
|
+
|
|
13
|
+
/** @public */
|
|
14
|
+
export type GridProps<E extends GridElementType = GridElementType> = Props<GridOwnProps, E>
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* The `Grid` component is for building 2-dimensional layers (based on CSS grid).
|
|
14
18
|
*
|
|
15
19
|
* @public
|
|
16
20
|
*/
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
export function Grid<E extends GridElementType = typeof DEFAULT_GRID_ELEMENT>(props: GridProps<E>) {
|
|
22
|
+
const {
|
|
23
|
+
as = DEFAULT_GRID_ELEMENT,
|
|
24
|
+
children,
|
|
25
|
+
...rest
|
|
26
|
+
} = props as GridProps<typeof DEFAULT_GRID_ELEMENT>
|
|
22
27
|
|
|
23
28
|
return (
|
|
24
|
-
<Box data-ui="Grid" {...
|
|
29
|
+
<Box data-ui="Grid" {...rest} as={as} display="grid">
|
|
25
30
|
{children}
|
|
26
31
|
</Box>
|
|
27
32
|
)
|
|
28
|
-
}
|
|
33
|
+
}
|
|
29
34
|
|
|
30
|
-
Grid.displayName = '
|
|
35
|
+
Grid.displayName = 'Grid'
|
|
@@ -5,28 +5,46 @@ import {
|
|
|
5
5
|
textOverflow,
|
|
6
6
|
type TextOverflowStyleProps,
|
|
7
7
|
} from '@sanity/ui/css'
|
|
8
|
-
import {ForwardedRef, forwardRef} from 'react'
|
|
9
8
|
|
|
10
|
-
import {Props} from '../../types'
|
|
9
|
+
import type {ComponentType, Props} from '../../types'
|
|
11
10
|
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
/** @public */
|
|
12
|
+
export const DEFAULT_HEADING_ELEMENT = 'div'
|
|
13
|
+
|
|
14
|
+
/** @public */
|
|
15
|
+
export type HeadingOwnProps = HeadingStyleProps & TextOverflowStyleProps
|
|
16
|
+
|
|
17
|
+
/** @public */
|
|
18
|
+
export type HeadingElementType =
|
|
19
|
+
| 'div'
|
|
20
|
+
| 'h1'
|
|
21
|
+
| 'h2'
|
|
22
|
+
| 'h3'
|
|
23
|
+
| 'h4'
|
|
24
|
+
| 'h5'
|
|
25
|
+
| 'h6'
|
|
26
|
+
| 'label'
|
|
27
|
+
| 'span'
|
|
28
|
+
| ComponentType
|
|
29
|
+
|
|
30
|
+
/** @public */
|
|
31
|
+
export type HeadingProps<E extends HeadingElementType = HeadingElementType> = Props<
|
|
32
|
+
HeadingOwnProps,
|
|
33
|
+
E
|
|
34
|
+
>
|
|
16
35
|
|
|
17
36
|
/**
|
|
18
37
|
* Typographic headings.
|
|
19
38
|
*
|
|
20
39
|
* @public
|
|
21
40
|
*/
|
|
22
|
-
export
|
|
23
|
-
props:
|
|
24
|
-
ref: ForwardedRef<HTMLElement>,
|
|
41
|
+
export function Heading<E extends HeadingElementType = typeof DEFAULT_HEADING_ELEMENT>(
|
|
42
|
+
props: HeadingProps<E>,
|
|
25
43
|
) {
|
|
26
44
|
const {
|
|
27
45
|
accent = false,
|
|
28
46
|
align,
|
|
29
|
-
as:
|
|
47
|
+
as: Element = DEFAULT_HEADING_ELEMENT,
|
|
30
48
|
children,
|
|
31
49
|
className,
|
|
32
50
|
flex,
|
|
@@ -34,13 +52,13 @@ export const Heading = forwardRef(function Heading(
|
|
|
34
52
|
size = 2,
|
|
35
53
|
textOverflow: textOverflowProp,
|
|
36
54
|
weight,
|
|
37
|
-
...
|
|
38
|
-
} = props
|
|
55
|
+
...rest
|
|
56
|
+
} = props as HeadingProps<typeof DEFAULT_HEADING_ELEMENT>
|
|
39
57
|
|
|
40
58
|
return (
|
|
41
|
-
<
|
|
59
|
+
<Element
|
|
42
60
|
data-ui="Heading"
|
|
43
|
-
{...
|
|
61
|
+
{...rest}
|
|
44
62
|
className={composeClassNames(
|
|
45
63
|
className,
|
|
46
64
|
heading({
|
|
@@ -52,11 +70,16 @@ export const Heading = forwardRef(function Heading(
|
|
|
52
70
|
weight,
|
|
53
71
|
}),
|
|
54
72
|
)}
|
|
55
|
-
ref={ref}
|
|
56
73
|
>
|
|
57
|
-
<span
|
|
58
|
-
|
|
74
|
+
<span
|
|
75
|
+
className={textOverflow({
|
|
76
|
+
textOverflow: textOverflowProp,
|
|
77
|
+
})}
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
</span>
|
|
81
|
+
</Element>
|
|
59
82
|
)
|
|
60
|
-
}
|
|
83
|
+
}
|
|
61
84
|
|
|
62
|
-
Heading.displayName = '
|
|
85
|
+
Heading.displayName = 'Heading'
|
|
@@ -1,50 +1,53 @@
|
|
|
1
|
-
import {ResponsiveProp} from '@sanity/ui/css'
|
|
1
|
+
import {FlexStyleProps, GridStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
2
2
|
import {Space} from '@sanity/ui/theme'
|
|
3
|
-
import {Children, ForwardedRef, forwardRef, useMemo} from 'react'
|
|
4
3
|
|
|
5
|
-
import {Props} from '../../types'
|
|
6
|
-
import {Box,
|
|
4
|
+
import type {Props} from '../../types'
|
|
5
|
+
import {Box, type BoxElementType, type BoxOwnProps} from '../box'
|
|
7
6
|
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
/** @public */
|
|
8
|
+
export const DEFAULT_INLINE_ELEMENT = 'div'
|
|
9
|
+
|
|
10
|
+
/** @public */
|
|
11
|
+
export type InlineOwnProps = Omit<BoxOwnProps, keyof FlexStyleProps | keyof GridStyleProps> & {
|
|
12
12
|
/** @deprecated Use `gap` instead. */
|
|
13
13
|
space?: ResponsiveProp<Space>
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/** @public */
|
|
17
|
+
export type InlineElementType = BoxElementType
|
|
18
|
+
|
|
19
|
+
/** @public */
|
|
20
|
+
export type InlineProps<E extends InlineElementType = InlineElementType> = Props<InlineOwnProps, E>
|
|
21
|
+
|
|
16
22
|
/**
|
|
17
23
|
* The `Inline` component is a layout utility for aligning and spacing items horizontally.
|
|
18
24
|
*
|
|
19
25
|
* @public
|
|
20
26
|
*/
|
|
21
|
-
export
|
|
22
|
-
props:
|
|
23
|
-
ref: ForwardedRef<HTMLDivElement>,
|
|
27
|
+
export function Inline<E extends InlineElementType = typeof DEFAULT_INLINE_ELEMENT>(
|
|
28
|
+
props: InlineProps<E>,
|
|
24
29
|
) {
|
|
25
|
-
const {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
const {
|
|
31
|
+
as = DEFAULT_INLINE_ELEMENT,
|
|
32
|
+
children,
|
|
33
|
+
gap,
|
|
34
|
+
space,
|
|
35
|
+
...rest
|
|
36
|
+
} = props as InlineProps<typeof DEFAULT_INLINE_ELEMENT>
|
|
31
37
|
|
|
32
38
|
return (
|
|
33
39
|
<Box
|
|
34
40
|
data-ui="Inline"
|
|
35
|
-
{...
|
|
41
|
+
{...rest}
|
|
36
42
|
align="center"
|
|
37
43
|
as={as}
|
|
38
44
|
display="flex"
|
|
39
45
|
gap={gap ?? space}
|
|
40
|
-
gapX={gapX}
|
|
41
|
-
gapY={gapY}
|
|
42
|
-
ref={ref}
|
|
43
46
|
wrap="wrap"
|
|
44
47
|
>
|
|
45
48
|
{children}
|
|
46
49
|
</Box>
|
|
47
50
|
)
|
|
48
|
-
}
|
|
51
|
+
}
|
|
49
52
|
|
|
50
|
-
Inline.displayName = '
|
|
53
|
+
Inline.displayName = 'Inline'
|
|
@@ -1,55 +1,57 @@
|
|
|
1
1
|
import {composeClassNames, kbd, RadiusStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
-
import {FontTextSize
|
|
3
|
-
import {ForwardedRef, forwardRef} from 'react'
|
|
2
|
+
import {FontTextSize} from '@sanity/ui/theme'
|
|
4
3
|
|
|
5
|
-
import {Props} from '../../types'
|
|
6
|
-
import {Box,
|
|
4
|
+
import {ComponentType, Props} from '../../types'
|
|
5
|
+
import {Box, BoxElementType, BoxOwnProps} from '../box'
|
|
7
6
|
import {Text} from '../text'
|
|
8
7
|
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
/** @public */
|
|
9
|
+
export const DEFAULT_KBD_ELEMENT = 'kbd'
|
|
10
|
+
|
|
11
|
+
/** @public */
|
|
12
|
+
export type KBDOwnProps = BoxOwnProps &
|
|
13
|
+
RadiusStyleProps & {
|
|
14
|
+
fontSize?: ResponsiveProp<FontTextSize>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @public */
|
|
18
|
+
export type KBDElementType = 'kbd' | ComponentType
|
|
19
|
+
|
|
20
|
+
/** @public */
|
|
21
|
+
export type KBDProps<E extends KBDElementType = KBDElementType> = Props<KBDOwnProps, E>
|
|
16
22
|
|
|
17
23
|
/**
|
|
18
24
|
* Used to define some text as keyboard input.
|
|
19
25
|
*
|
|
20
26
|
* @public
|
|
21
27
|
*/
|
|
22
|
-
export
|
|
23
|
-
props: Props<KBDProps, 'div'>,
|
|
24
|
-
ref: ForwardedRef<HTMLDivElement>,
|
|
25
|
-
) {
|
|
28
|
+
export function KBD<E extends KBDElementType = typeof DEFAULT_KBD_ELEMENT>(props: KBDProps<E>) {
|
|
26
29
|
const {
|
|
27
|
-
as =
|
|
30
|
+
as = DEFAULT_KBD_ELEMENT,
|
|
28
31
|
children,
|
|
29
32
|
className,
|
|
30
33
|
display = 'inline-block',
|
|
31
34
|
fontSize = 0,
|
|
32
35
|
padding = 1,
|
|
33
36
|
radius = 2,
|
|
34
|
-
...
|
|
35
|
-
} = props
|
|
37
|
+
...rest
|
|
38
|
+
} = props as KBDProps<typeof DEFAULT_KBD_ELEMENT>
|
|
36
39
|
|
|
37
40
|
return (
|
|
38
41
|
<Box
|
|
39
42
|
data-ui="KBD"
|
|
40
|
-
{...
|
|
41
|
-
as={as}
|
|
43
|
+
{...rest}
|
|
44
|
+
as={as as BoxElementType}
|
|
42
45
|
className={composeClassNames(className, kbd({radius}))}
|
|
43
46
|
display={display}
|
|
44
47
|
muted
|
|
45
48
|
padding={padding}
|
|
46
|
-
ref={ref}
|
|
47
49
|
>
|
|
48
50
|
<Text as="span" muted size={fontSize} weight="semibold">
|
|
49
51
|
{children}
|
|
50
52
|
</Text>
|
|
51
53
|
</Box>
|
|
52
54
|
)
|
|
53
|
-
}
|
|
55
|
+
}
|
|
54
56
|
|
|
55
|
-
KBD.displayName = '
|
|
57
|
+
KBD.displayName = 'KBD'
|
|
@@ -1,52 +1,62 @@
|
|
|
1
1
|
import {
|
|
2
2
|
composeClassNames,
|
|
3
|
-
FontStyleProps,
|
|
4
3
|
label,
|
|
5
|
-
|
|
6
|
-
ResponsiveProp,
|
|
4
|
+
LabelStyleProps,
|
|
7
5
|
textOverflow,
|
|
8
6
|
TextOverflowStyleProps,
|
|
9
7
|
} from '@sanity/ui/css'
|
|
10
|
-
import {ForwardedRef, forwardRef} from 'react'
|
|
11
8
|
|
|
12
|
-
import {Props} from '../../types'
|
|
9
|
+
import {ComponentType, Props} from '../../types'
|
|
13
10
|
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
/** @public */
|
|
12
|
+
export const DEFAULT_LABEL_ELEMENT = 'div'
|
|
13
|
+
|
|
14
|
+
/** @public */
|
|
15
|
+
export type LabelOwnProps = LabelStyleProps & TextOverflowStyleProps
|
|
16
|
+
|
|
17
|
+
/** @public */
|
|
18
|
+
export type LabelElementType =
|
|
19
|
+
| 'div'
|
|
20
|
+
| 'h1'
|
|
21
|
+
| 'h2'
|
|
22
|
+
| 'h3'
|
|
23
|
+
| 'h4'
|
|
24
|
+
| 'h5'
|
|
25
|
+
| 'h6'
|
|
26
|
+
| 'label'
|
|
27
|
+
| 'li'
|
|
28
|
+
| 'p'
|
|
29
|
+
| 'span'
|
|
30
|
+
| ComponentType
|
|
31
|
+
|
|
32
|
+
/** @public */
|
|
33
|
+
export type LabelProps<E extends LabelElementType = LabelElementType> = Props<LabelOwnProps, E>
|
|
23
34
|
|
|
24
35
|
/**
|
|
25
36
|
* Typographic labels.
|
|
26
37
|
*
|
|
27
38
|
* @public
|
|
28
39
|
*/
|
|
29
|
-
export
|
|
30
|
-
props:
|
|
31
|
-
ref: ForwardedRef<HTMLDivElement>,
|
|
40
|
+
export function Label<E extends LabelElementType = typeof DEFAULT_LABEL_ELEMENT>(
|
|
41
|
+
props: LabelProps<E>,
|
|
32
42
|
) {
|
|
33
43
|
const {
|
|
34
44
|
accent,
|
|
35
45
|
align,
|
|
36
|
-
as:
|
|
46
|
+
as: Element = DEFAULT_LABEL_ELEMENT,
|
|
37
47
|
children,
|
|
38
48
|
className,
|
|
39
49
|
muted = false,
|
|
40
50
|
size = 1,
|
|
41
51
|
textOverflow: textOverflowProp,
|
|
42
52
|
weight = 'medium',
|
|
43
|
-
...
|
|
53
|
+
...rest
|
|
44
54
|
} = props
|
|
45
55
|
|
|
46
56
|
return (
|
|
47
|
-
<
|
|
57
|
+
<Element
|
|
48
58
|
data-ui="Label"
|
|
49
|
-
{...
|
|
59
|
+
{...rest}
|
|
50
60
|
className={composeClassNames(
|
|
51
61
|
className,
|
|
52
62
|
label({
|
|
@@ -57,11 +67,16 @@ export const Label = forwardRef(function Label(
|
|
|
57
67
|
weight,
|
|
58
68
|
}),
|
|
59
69
|
)}
|
|
60
|
-
ref={ref}
|
|
61
70
|
>
|
|
62
|
-
<span
|
|
63
|
-
|
|
71
|
+
<span
|
|
72
|
+
className={textOverflow({
|
|
73
|
+
textOverflow: textOverflowProp,
|
|
74
|
+
})}
|
|
75
|
+
>
|
|
76
|
+
{children}
|
|
77
|
+
</span>
|
|
78
|
+
</Element>
|
|
64
79
|
)
|
|
65
|
-
}
|
|
80
|
+
}
|
|
66
81
|
|
|
67
|
-
Label.displayName = '
|
|
82
|
+
Label.displayName = 'Label'
|