@sanity/ui 2.10.0-corel.0 → 3.0.0-static.0
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/bin/ui.js +6 -0
- package/dist/_chunks-cjs/buildCommand.js +2836 -0
- package/dist/_chunks-cjs/buildCommand.js.map +1 -0
- package/dist/_chunks-cjs/getTheme_v2.js +1 -27
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +1 -27
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +1 -27
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +23 -0
- package/dist/cli.js.map +1 -0
- package/dist/css.d.mts +943 -0
- package/dist/css.d.ts +943 -0
- package/dist/css.esm.js +3135 -0
- package/dist/css.esm.js.map +1 -0
- package/dist/css.js +3135 -0
- package/dist/css.js.map +1 -0
- package/dist/css.mjs +3135 -0
- package/dist/css.mjs.map +1 -0
- package/dist/index.d.mts +175 -164
- package/dist/index.d.ts +175 -164
- package/dist/index.esm.js +864 -1955
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +870 -1962
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +864 -1955
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +25 -0
- package/dist/system.css +2953 -0
- package/dist/theme.d.mts +84 -22
- package/dist/theme.d.ts +84 -22
- package/dist/theme.esm.js +232 -283
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +232 -283
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +232 -283
- package/dist/theme.mjs.map +1 -1
- package/exports/css.ts +1 -0
- package/package.json +25 -4
- package/src/core/__workshop__/constants.ts +15 -15
- package/src/core/__workshop__/fontsPlugin.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.styles.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +12 -4
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -3
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -5
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +14 -2
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +14 -9
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
- package/src/core/components/dialog/dialog.tsx +77 -92
- package/src/core/components/hotkeys/hotkeys.tsx +18 -29
- package/src/core/components/menu/menu.tsx +8 -5
- package/src/core/components/menu/menuDivider.ts +2 -1
- package/src/core/components/menu/menuGroup.tsx +16 -8
- package/src/core/components/menu/menuItem.tsx +23 -14
- package/src/core/components/skeleton/skeleton.tsx +1 -1
- package/src/core/components/skeleton/styles.ts +1 -1
- package/src/core/components/skeleton/textSkeleton.tsx +1 -1
- package/src/core/components/tab/tab.tsx +6 -7
- package/src/core/components/tab/tabList.tsx +3 -2
- package/src/core/components/toast/styles.ts +1 -1
- package/src/core/components/toast/toast.tsx +6 -4
- package/src/core/components/toast/toastProvider.tsx +31 -22
- package/src/core/components/tree/style.ts +1 -1
- package/src/core/components/tree/tree.tsx +8 -2
- package/src/core/components/tree/treeGroup.tsx +1 -1
- package/src/core/components/tree/treeItem.tsx +38 -25
- package/src/core/components/tree/types.ts +5 -1
- package/src/core/lib/styled/elements.ts +135 -0
- package/src/core/lib/styled/index.ts +2 -0
- package/src/core/lib/styled/members.ts +15 -0
- package/src/core/lib/styled/styled.ts +79 -0
- package/src/core/primitives/_selectable/selectable.tsx +27 -14
- package/src/core/primitives/avatar/avatar.tsx +52 -32
- package/src/core/primitives/avatar/avatarCounter.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +1 -1
- package/src/core/primitives/badge/__workshop__/tones.tsx +9 -16
- package/src/core/primitives/badge/badge.tsx +18 -20
- package/src/core/primitives/box/box.tsx +62 -74
- package/src/core/primitives/button/__workshop__/props.tsx +3 -1
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
- package/src/core/primitives/button/button.tsx +38 -45
- package/src/core/primitives/button/styles.ts +2 -2
- package/src/core/primitives/card/RootCardContext.ts +3 -0
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
- package/src/core/primitives/card/card.tsx +44 -46
- package/src/core/primitives/card/styles.ts +1 -1
- package/src/core/primitives/checkbox/checkbox.tsx +6 -8
- package/src/core/primitives/code/code.tsx +23 -12
- package/src/core/primitives/code/styles.ts +1 -1
- package/src/core/primitives/container/container.tsx +7 -15
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/flex.tsx +6 -19
- package/src/core/primitives/grid/grid.tsx +2 -1
- package/src/core/primitives/heading/heading.tsx +32 -19
- package/src/core/primitives/heading/styles.ts +1 -1
- package/src/core/primitives/inline/inline.tsx +22 -13
- package/src/core/primitives/kbd/kbd.tsx +30 -37
- package/src/core/primitives/label/label.tsx +15 -4
- package/src/core/primitives/label/styles.ts +1 -1
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -1
- package/src/core/primitives/popover/popover.tsx +21 -15
- package/src/core/primitives/popover/popoverCard.tsx +36 -38
- package/src/core/primitives/radio/radio.tsx +1 -1
- package/src/core/primitives/radio/styles.ts +1 -1
- package/src/core/primitives/select/select.tsx +1 -1
- package/src/core/primitives/select/styles.ts +1 -1
- package/src/core/primitives/spinner/spinner.tsx +6 -20
- package/src/core/primitives/stack/stack.tsx +12 -10
- package/src/core/primitives/switch/styles.ts +9 -9
- package/src/core/primitives/switch/switch.tsx +20 -21
- package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
- package/src/core/primitives/text/styles.ts +1 -2
- package/src/core/primitives/text/text.tsx +17 -21
- package/src/core/primitives/textArea/textArea.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/textInput.tsx +176 -123
- package/src/core/primitives/tooltip/tooltip.test.tsx +1 -0
- package/src/core/primitives/tooltip/tooltip.tsx +13 -13
- package/src/core/primitives/tooltip/tooltipCard.tsx +15 -14
- package/src/core/primitives/types.ts +35 -16
- package/src/core/styles/border/borderStyle.ts +6 -0
- package/src/core/styles/border/types.ts +1 -0
- package/src/core/styles/box/boxStyle.ts +6 -0
- package/src/core/styles/card/_cardColorStyle.ts +0 -8
- package/src/core/styles/flex/flexStyle.ts +0 -18
- package/src/core/styles/flex/types.ts +1 -3
- package/src/core/styles/grid/gridStyle.ts +0 -10
- package/src/core/styles/helpers.ts +9 -0
- package/src/core/styles/input/textInputStyle.ts +1 -1
- package/src/core/theme/__workshop__/build/Root.tsx +1 -1
- package/src/core/theme/themeProvider.tsx +1 -1
- package/src/core/theme/useTheme.ts +1 -1
- package/src/core/types/avatar.ts +6 -1
- package/src/core/types/button.ts +1 -0
- package/src/core/types/flex.ts +27 -26
- package/src/core/types/gridItem.ts +32 -24
- package/src/core/types/radius.ts +7 -4
- package/src/core/utils/arrow/arrow.tsx +1 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
- package/src/core/utils/layer/layer.tsx +28 -11
- package/src/core/utils/srOnly/srOnly.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +1 -1
- package/src/css/_resp.ts +28 -0
- package/src/css/cli/buildCommand.ts +36 -0
- package/src/css/cli/index.ts +38 -0
- package/src/css/compile/comileRules.ts +59 -0
- package/src/css/compile/compileRule.ts +58 -0
- package/src/css/compile/compileSystem.ts +7 -0
- package/src/css/compile/compileTheme.ts +509 -0
- package/src/css/components/breadcrumbs/breadcrumbs.ts +5 -0
- package/src/css/components/breadcrumbs/index.ts +1 -0
- package/src/css/components/breadcrumbs/rules.ts +7 -0
- package/src/css/components/dialog/classes.ts +29 -0
- package/src/css/components/dialog/index.ts +1 -0
- package/src/css/components/dialog/rules.ts +75 -0
- package/src/css/components/tree/index.ts +1 -0
- package/src/css/components/tree/rules.ts +52 -0
- package/src/css/components/tree/tree.ts +5 -0
- package/src/css/composeClassNames.ts +3 -0
- package/src/css/index.ts +47 -0
- package/src/css/primitives/avatar/avatar.ts +32 -0
- package/src/css/primitives/avatar/index.ts +2 -0
- package/src/css/primitives/avatar/rules.ts +190 -0
- package/src/css/primitives/avatar/types.ts +9 -0
- package/src/css/primitives/badge/badge.ts +8 -0
- package/src/css/primitives/badge/index.ts +2 -0
- package/src/css/primitives/badge/rules.ts +25 -0
- package/src/css/primitives/badge/types.ts +8 -0
- package/src/css/primitives/box/box.ts +34 -0
- package/src/css/primitives/box/index.ts +2 -0
- package/src/css/primitives/box/rules.ts +25 -0
- package/src/css/primitives/box/types.ts +49 -0
- package/src/css/primitives/button/button.ts +26 -0
- package/src/css/primitives/button/index.ts +1 -0
- package/src/css/primitives/button/rules.ts +58 -0
- package/src/css/primitives/card/card.ts +21 -0
- package/src/css/primitives/card/index.ts +1 -0
- package/src/css/primitives/card/rules.ts +93 -0
- package/src/{core/primitives/checkbox/styles.ts → css/primitives/checkbox/__styles.ts} +3 -3
- package/src/css/primitives/checkbox/checkbox.ts +9 -0
- package/src/css/primitives/checkbox/index.ts +1 -0
- package/src/css/primitives/checkbox/rules.ts +136 -0
- package/src/css/primitives/code/code.ts +9 -0
- package/src/css/primitives/code/index.ts +2 -0
- package/src/css/primitives/code/rules.ts +71 -0
- package/src/css/primitives/code/types.ts +10 -0
- package/src/css/primitives/container/container.ts +7 -0
- package/src/css/primitives/container/index.ts +2 -0
- package/src/css/primitives/container/rules.ts +8 -0
- package/src/css/primitives/container/types.ts +6 -0
- package/src/css/primitives/heading/heading.ts +16 -0
- package/src/css/primitives/heading/index.ts +2 -0
- package/src/css/primitives/heading/rules.ts +84 -0
- package/src/css/primitives/heading/types.ts +12 -0
- package/src/css/primitives/kbd/index.ts +2 -0
- package/src/css/primitives/kbd/kbd.ts +7 -0
- package/src/css/primitives/kbd/rules.ts +20 -0
- package/src/css/primitives/kbd/types.ts +5 -0
- package/src/css/primitives/label/index.ts +2 -0
- package/src/css/primitives/label/label.ts +16 -0
- package/src/css/primitives/label/rules.ts +85 -0
- package/src/css/primitives/label/types.ts +12 -0
- package/src/css/primitives/popover/index.ts +1 -0
- package/src/css/primitives/popover/popover.ts +5 -0
- package/src/css/primitives/popover/rules.ts +5 -0
- package/src/css/primitives/radio/index.ts +1 -0
- package/src/css/primitives/radio/radio.ts +5 -0
- package/src/css/primitives/radio/rules.ts +5 -0
- package/src/css/primitives/select/index.ts +1 -0
- package/src/css/primitives/select/rules.ts +5 -0
- package/src/css/primitives/select/select.ts +5 -0
- package/src/{core/primitives/_selectable/style.ts → css/primitives/selectable/__style.ts} +5 -4
- package/src/css/primitives/selectable/index.ts +2 -0
- package/src/css/primitives/selectable/rules.ts +27 -0
- package/src/css/primitives/selectable/selectable.ts +9 -0
- package/src/css/primitives/selectable/types.ts +6 -0
- package/src/css/primitives/spinner/index.ts +1 -0
- package/src/css/primitives/spinner/rules.ts +22 -0
- package/src/css/primitives/spinner/spinner.ts +5 -0
- package/src/css/primitives/switch/index.ts +1 -0
- package/src/css/primitives/switch/rules.ts +132 -0
- package/src/css/primitives/switch/switch.ts +5 -0
- package/src/css/primitives/text/index.ts +2 -0
- package/src/css/primitives/text/rules.ts +75 -0
- package/src/css/primitives/text/text.ts +16 -0
- package/src/css/primitives/text/types.ts +11 -0
- package/src/css/primitives/textArea/index.ts +1 -0
- package/src/css/primitives/textArea/rules.ts +5 -0
- package/src/css/primitives/textArea/textArea.ts +5 -0
- package/src/css/primitives/textInput/index.ts +1 -0
- package/src/css/primitives/textInput/rules.ts +226 -0
- package/src/css/primitives/textInput/textInput.ts +7 -0
- package/src/css/primitives/token/rules.ts +45 -0
- package/src/css/primitives/tooltip/index.ts +1 -0
- package/src/css/primitives/tooltip/rules.ts +17 -0
- package/src/css/primitives/tooltip/tooltip.ts +9 -0
- package/src/css/responsiveRules.ts +25 -0
- package/src/css/rules.ts +121 -0
- package/src/css/styles/border/border.ts +22 -0
- package/src/css/styles/border/index.ts +2 -0
- package/src/css/styles/border/rules.ts +24 -0
- package/src/css/styles/border/types.ts +10 -0
- package/src/css/styles/display/rules.ts +62 -0
- package/src/css/styles/flex/flex.ts +20 -0
- package/src/css/styles/flex/index.ts +2 -0
- package/src/css/styles/flex/rules.ts +28 -0
- package/src/css/styles/flex/types.ts +35 -0
- package/src/css/styles/flexItem/flexItem.ts +8 -0
- package/src/css/styles/flexItem/index.ts +2 -0
- package/src/css/styles/flexItem/rules.ts +11 -0
- package/src/css/styles/flexItem/types.ts +11 -0
- package/src/css/styles/font/font.ts +12 -0
- package/src/css/styles/font/index.ts +2 -0
- package/src/css/styles/font/rules.ts +125 -0
- package/src/css/styles/font/types.ts +6 -0
- package/src/css/styles/gap/gap.ts +8 -0
- package/src/css/styles/gap/index.ts +2 -0
- package/src/css/styles/gap/rules.ts +33 -0
- package/src/css/styles/gap/types.ts +9 -0
- package/src/css/styles/grid/rules.ts +35 -0
- package/src/css/styles/gridItem/gridItem.ts +15 -0
- package/src/css/styles/gridItem/index.ts +2 -0
- package/src/css/styles/gridItem/rules.ts +96 -0
- package/src/css/styles/gridItem/types.ts +41 -0
- package/src/css/styles/height/rules.ts +7 -0
- package/src/css/styles/margin/index.ts +2 -0
- package/src/css/styles/margin/margin.ts +15 -0
- package/src/css/styles/margin/rules.ts +59 -0
- package/src/css/styles/margin/types.ts +11 -0
- package/src/css/styles/maxWidth/index.ts +2 -0
- package/src/css/styles/maxWidth/maxWidth.ts +6 -0
- package/src/css/styles/maxWidth/rules.ts +36 -0
- package/src/css/styles/maxWidth/types.ts +6 -0
- package/src/css/styles/overflow/rules.ts +9 -0
- package/src/css/styles/padding/index.ts +2 -0
- package/src/css/styles/padding/padding.ts +15 -0
- package/src/css/styles/padding/rules.ts +59 -0
- package/src/css/styles/padding/types.ts +12 -0
- package/src/css/styles/pointerEvents/index.ts +2 -0
- package/src/css/styles/pointerEvents/pointerEvents.ts +6 -0
- package/src/css/styles/pointerEvents/rules.ts +11 -0
- package/src/css/styles/pointerEvents/types.ts +7 -0
- package/src/css/styles/position/index.ts +2 -0
- package/src/css/styles/position/position.ts +7 -0
- package/src/css/styles/position/rules.ts +31 -0
- package/src/css/styles/position/types.ts +13 -0
- package/src/css/styles/radius/index.ts +2 -0
- package/src/css/styles/radius/radius.ts +8 -0
- package/src/css/styles/radius/rules.ts +13 -0
- package/src/css/styles/radius/types.ts +7 -0
- package/src/css/styles/shadow/rules.ts +53 -0
- package/src/css/styles/width/index.ts +2 -0
- package/src/css/styles/width/rules.ts +7 -0
- package/src/css/styles/width/types.ts +8 -0
- package/src/css/styles/width/width.ts +6 -0
- package/src/css/types.ts +591 -0
- package/src/css/varNames.ts +381 -0
- package/src/css/vars.ts +313 -0
- package/src/theme/build/_deprecated/color/factory.ts +1 -1
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/buildColorTheme.ts +39 -45
- package/src/theme/build/renderColorTheme.ts +65 -239
- package/src/theme/build/resolveColorTokens.ts +115 -51
- package/src/theme/config/tokens/color/types.ts +18 -4
- package/src/theme/defaults/colorTokens.ts +10 -17
- package/src/theme/defaults/config.ts +1 -1
- package/src/theme/getScopedTheme.ts +2 -9
- package/src/theme/system/_constants.ts +25 -0
- package/src/theme/system/_types.ts +41 -0
- package/src/theme/system/color/_constants.ts +0 -8
- package/src/theme/system/color/badge.ts +7 -3
- package/src/theme/system/index.ts +2 -0
- package/src/theme/system/v0/color/_system.ts +4 -8
- package/src/theme/system/v0/color/color.ts +2 -3
- package/src/theme/versioning/themeColor_v0_v2.ts +0 -26
- package/src/theme/versioning/v0_v2.ts +0 -4
- package/src/core/components/breadcrumbs/__workshop__/buttons.tsx +0 -58
- package/src/core/components/dialog/styles.ts +0 -76
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {CheckmarkIcon, RemoveIcon} from '@sanity/icons'
|
|
2
|
+
import {checkbox, checkboxInput, composeClassNames} from '@sanity/ui/css'
|
|
2
3
|
import {forwardRef, useEffect, useImperativeHandle, useRef} from 'react'
|
|
3
|
-
import {styled} from 'styled-components'
|
|
4
4
|
import {useCustomValidity} from '../../hooks'
|
|
5
|
-
import {checkboxBaseStyles, inputElementStyles} from './styles'
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @public
|
|
@@ -12,9 +11,6 @@ export interface CheckboxProps {
|
|
|
12
11
|
customValidity?: string
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
const Root = styled.div(checkboxBaseStyles)
|
|
16
|
-
const Input = styled.input(inputElementStyles)
|
|
17
|
-
|
|
18
14
|
/**
|
|
19
15
|
* Checkboxes allow the user to select one or more items from a set.
|
|
20
16
|
*
|
|
@@ -51,12 +47,13 @@ export const Checkbox = forwardRef(function Checkbox(
|
|
|
51
47
|
useCustomValidity(ref, customValidity)
|
|
52
48
|
|
|
53
49
|
return (
|
|
54
|
-
<
|
|
55
|
-
<
|
|
50
|
+
<span className={composeClassNames(className, checkbox())} data-ui="Checkbox" style={style}>
|
|
51
|
+
<input
|
|
56
52
|
data-read-only={!disabled && readOnly ? '' : undefined}
|
|
57
53
|
data-error={customValidity ? '' : undefined}
|
|
58
54
|
{...restProps}
|
|
59
55
|
checked={checked}
|
|
56
|
+
className={composeClassNames(className, checkboxInput())}
|
|
60
57
|
disabled={disabled || readOnly}
|
|
61
58
|
type="checkbox"
|
|
62
59
|
readOnly={readOnly}
|
|
@@ -66,7 +63,8 @@ export const Checkbox = forwardRef(function Checkbox(
|
|
|
66
63
|
<CheckmarkIcon />
|
|
67
64
|
<RemoveIcon />
|
|
68
65
|
</span>
|
|
69
|
-
</
|
|
66
|
+
</span>
|
|
70
67
|
)
|
|
71
68
|
})
|
|
69
|
+
|
|
72
70
|
Checkbox.displayName = 'ForwardRef(Checkbox)'
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import {code, composeClassNames} from '@sanity/ui/css'
|
|
4
|
+
import {FontWeight} from '@sanity/ui/theme'
|
|
2
5
|
import {forwardRef} from 'react'
|
|
3
6
|
import Refractor from 'react-refractor'
|
|
4
|
-
import {styled} from 'styled-components'
|
|
5
|
-
import {useArrayProp} from '../../hooks'
|
|
6
|
-
import {responsiveCodeFontStyle, ResponsiveFontStyleProps} from '../../styles/internal'
|
|
7
|
-
import {codeBaseStyle} from './styles'
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* @public
|
|
@@ -14,27 +13,39 @@ export interface CodeProps {
|
|
|
14
13
|
/** Define the language to use for syntax highlighting. */
|
|
15
14
|
language?: string
|
|
16
15
|
size?: number | number[]
|
|
17
|
-
weight?:
|
|
16
|
+
weight?: FontWeight
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
const Root = styled.pre<ResponsiveFontStyleProps>(codeBaseStyle, responsiveCodeFontStyle)
|
|
21
|
-
|
|
22
19
|
/**
|
|
23
20
|
* @public
|
|
24
21
|
*/
|
|
25
22
|
export const Code = forwardRef(function Code(
|
|
26
|
-
props: CodeProps & Omit<React.HTMLProps<
|
|
27
|
-
ref: React.ForwardedRef<
|
|
23
|
+
props: CodeProps & Omit<React.HTMLProps<HTMLPreElement>, 'as' | 'size'>,
|
|
24
|
+
ref: React.ForwardedRef<HTMLPreElement>,
|
|
28
25
|
) {
|
|
29
|
-
const {
|
|
26
|
+
const {
|
|
27
|
+
as: As = 'pre',
|
|
28
|
+
children,
|
|
29
|
+
className,
|
|
30
|
+
language: languageProp,
|
|
31
|
+
size = 2,
|
|
32
|
+
weight,
|
|
33
|
+
...restProps
|
|
34
|
+
} = props
|
|
30
35
|
const language = typeof languageProp === 'string' ? languageProp : undefined
|
|
31
36
|
const registered = language ? Refractor.hasLanguage(language as any) : false
|
|
32
37
|
|
|
33
38
|
return (
|
|
34
|
-
<
|
|
39
|
+
<As
|
|
40
|
+
data-ui="Code"
|
|
41
|
+
{...restProps}
|
|
42
|
+
className={composeClassNames(className, code({size, weight}))}
|
|
43
|
+
ref={ref}
|
|
44
|
+
>
|
|
35
45
|
{!(language && registered) && <code>{children}</code>}
|
|
36
46
|
{language && registered && <Refractor inline language={language} value={String(children)} />}
|
|
37
|
-
</
|
|
47
|
+
</As>
|
|
38
48
|
)
|
|
39
49
|
})
|
|
50
|
+
|
|
40
51
|
Code.displayName = 'ForwardRef(Code)'
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
+
import {composeClassNames, container, ContainerStyleProps} from '@sanity/ui/css'
|
|
1
2
|
import {forwardRef} from 'react'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
3
|
-
import {useArrayProp} from '../../hooks'
|
|
4
3
|
import {Box, BoxProps} from '../box'
|
|
5
|
-
import {ResponsiveWidthProps} from '../types'
|
|
6
|
-
import {containerBaseStyle, responsiveContainerWidthStyle} from './styles'
|
|
7
|
-
import {ResponsiveWidthStyleProps} from './types'
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
6
|
* @public
|
|
11
7
|
*/
|
|
12
|
-
export interface ContainerProps extends BoxProps,
|
|
13
|
-
|
|
14
|
-
const Root = styled(Box)<ResponsiveWidthStyleProps>(
|
|
15
|
-
containerBaseStyle,
|
|
16
|
-
responsiveContainerWidthStyle,
|
|
17
|
-
)
|
|
8
|
+
export interface ContainerProps extends Omit<BoxProps, 'width'>, ContainerStyleProps {}
|
|
18
9
|
|
|
19
10
|
/**
|
|
20
11
|
* The `Container` component wraps content layout in a defined set of widths.
|
|
@@ -25,16 +16,17 @@ export const Container = forwardRef(function Container(
|
|
|
25
16
|
props: ContainerProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width'>,
|
|
26
17
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
27
18
|
) {
|
|
28
|
-
const {as, width = 2, ...restProps} = props
|
|
19
|
+
const {as, className, width = 2, ...restProps} = props
|
|
29
20
|
|
|
30
21
|
return (
|
|
31
|
-
<
|
|
22
|
+
<Box
|
|
32
23
|
data-ui="Container"
|
|
33
24
|
{...restProps}
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
as={as}
|
|
26
|
+
className={composeClassNames(className, container({width}))}
|
|
36
27
|
ref={ref}
|
|
37
28
|
/>
|
|
38
29
|
)
|
|
39
30
|
})
|
|
31
|
+
|
|
40
32
|
Container.displayName = 'ForwardRef(Container)'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Card, Code, Flex} from '@sanity/ui'
|
|
2
2
|
import {useSelect} from '@sanity/ui-workshop'
|
|
3
|
-
import {styled} from 'styled
|
|
3
|
+
import {styled} from '../../../lib/styled'
|
|
4
4
|
import {WORKSHOP_FLEX_DIRECTION_OPTIONS} from '../../../__workshop__/constants'
|
|
5
5
|
|
|
6
6
|
const DebugCard = styled(Card)`
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {forwardRef} from 'react'
|
|
2
|
-
import {styled} from 'styled
|
|
3
|
-
import {useArrayProp} from '../../hooks'
|
|
2
|
+
import {styled} from '../../lib/styled'
|
|
4
3
|
import {
|
|
5
4
|
flexItemStyle,
|
|
6
5
|
FlexItemStyleProps,
|
|
@@ -8,19 +7,11 @@ import {
|
|
|
8
7
|
ResponsiveFlexStyleProps,
|
|
9
8
|
} from '../../styles/internal'
|
|
10
9
|
import {Box, BoxProps} from '../box'
|
|
11
|
-
import {ResponsiveFlexProps, ResponsiveFlexItemProps} from '../types'
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* @public
|
|
15
13
|
*/
|
|
16
|
-
export interface FlexProps
|
|
17
|
-
extends Omit<BoxProps, 'display'>,
|
|
18
|
-
ResponsiveFlexProps,
|
|
19
|
-
ResponsiveFlexItemProps {
|
|
20
|
-
gap?: number | number[]
|
|
21
|
-
gapX?: number | number[]
|
|
22
|
-
gapY?: number | number[]
|
|
23
|
-
}
|
|
14
|
+
export interface FlexProps extends Omit<BoxProps, 'display'> {}
|
|
24
15
|
|
|
25
16
|
const Root = styled(Box)<FlexItemStyleProps & ResponsiveFlexStyleProps>(
|
|
26
17
|
flexItemStyle,
|
|
@@ -36,22 +27,18 @@ export const Flex = forwardRef(function Flex(
|
|
|
36
27
|
props: FlexProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'wrap'>,
|
|
37
28
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
38
29
|
) {
|
|
39
|
-
const {
|
|
30
|
+
const {as, direction = 'row', ...restProps} = props
|
|
40
31
|
|
|
41
32
|
return (
|
|
42
33
|
<Root
|
|
43
34
|
data-ui="Flex"
|
|
44
35
|
{...restProps}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
$gap={useArrayProp(gap)}
|
|
48
|
-
$gapX={useArrayProp(gapX)}
|
|
49
|
-
$gapY={useArrayProp(gapY)}
|
|
50
|
-
$justify={useArrayProp(justify)}
|
|
51
|
-
$wrap={useArrayProp(wrap)}
|
|
36
|
+
direction={direction}
|
|
37
|
+
display="flex"
|
|
52
38
|
forwardedAs={as}
|
|
53
39
|
ref={ref}
|
|
54
40
|
/>
|
|
55
41
|
)
|
|
56
42
|
})
|
|
43
|
+
|
|
57
44
|
Flex.displayName = 'ForwardRef(Flex)'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {forwardRef} from 'react'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
3
2
|
import {useArrayProp} from '../../hooks'
|
|
3
|
+
import {styled} from '../../lib/styled'
|
|
4
4
|
import {responsiveGridStyle, ResponsiveGridStyleProps} from '../../styles/internal'
|
|
5
5
|
import {Box, BoxProps} from '../box'
|
|
6
6
|
import {ResponsiveGridProps} from '../types'
|
|
@@ -37,6 +37,7 @@ export const Grid = forwardRef(function Grid(
|
|
|
37
37
|
$gapX={useArrayProp(gapX)}
|
|
38
38
|
$gapY={useArrayProp(gapY)}
|
|
39
39
|
$rows={useArrayProp(rows)}
|
|
40
|
+
display="grid"
|
|
40
41
|
forwardedAs={as}
|
|
41
42
|
ref={ref}
|
|
42
43
|
>
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import {composeClassNames, heading} from '@sanity/ui/css'
|
|
1
2
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
3
|
import {forwardRef} from 'react'
|
|
3
|
-
import {styled} from 'styled-components'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import {styled} from '../../lib/styled'
|
|
6
|
+
// import {
|
|
7
|
+
// ResponsiveFontStyleProps,
|
|
8
|
+
// responsiveHeadingFont,
|
|
9
|
+
// responsiveTextAlignStyle,
|
|
10
|
+
// ResponsiveTextAlignStyleProps,
|
|
11
|
+
// } from '../../styles/internal'
|
|
11
12
|
import {TextAlign} from '../../types'
|
|
12
|
-
import {headingBaseStyle} from './styles'
|
|
13
|
-
import {HeadingStyleProps} from './types'
|
|
13
|
+
// import {headingBaseStyle} from './styles'
|
|
14
|
+
// import {HeadingStyleProps} from './types'
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* @public
|
|
@@ -26,13 +27,13 @@ export interface HeadingProps {
|
|
|
26
27
|
* Use `textOverflow="ellipsis"` to render text as a single line which is concatenated with a `…` symbol.
|
|
27
28
|
* @beta
|
|
28
29
|
*/
|
|
29
|
-
textOverflow?: 'ellipsis'
|
|
30
|
+
textOverflow?: 'ellipsis'
|
|
30
31
|
weight?: ThemeFontWeightKey
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
const Root = styled.div<
|
|
34
|
-
|
|
35
|
-
>(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont)
|
|
34
|
+
// const Root = styled.div<
|
|
35
|
+
// HeadingStyleProps & ResponsiveTextAlignStyleProps & ResponsiveFontStyleProps
|
|
36
|
+
// >(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont)
|
|
36
37
|
|
|
37
38
|
const SpanWithTextOverflow = styled.span`
|
|
38
39
|
display: block;
|
|
@@ -54,7 +55,9 @@ export const Heading = forwardRef(function Heading(
|
|
|
54
55
|
const {
|
|
55
56
|
accent = false,
|
|
56
57
|
align,
|
|
58
|
+
as: As = 'div',
|
|
57
59
|
children: childrenProp,
|
|
60
|
+
className,
|
|
58
61
|
muted = false,
|
|
59
62
|
size = 2,
|
|
60
63
|
textOverflow,
|
|
@@ -69,18 +72,28 @@ export const Heading = forwardRef(function Heading(
|
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
return (
|
|
72
|
-
<
|
|
75
|
+
<As
|
|
73
76
|
data-ui="Heading"
|
|
74
77
|
{...restProps}
|
|
75
|
-
$accent={accent}
|
|
78
|
+
// $accent={accent}
|
|
76
79
|
$align={useArrayProp(align)}
|
|
77
|
-
$muted={muted}
|
|
78
|
-
$size={useArrayProp(size)}
|
|
79
|
-
$weight={weight}
|
|
80
|
+
// $muted={muted}
|
|
81
|
+
// $size={useArrayProp(size)}
|
|
82
|
+
// $weight={weight}
|
|
83
|
+
className={composeClassNames(
|
|
84
|
+
className,
|
|
85
|
+
heading({
|
|
86
|
+
accent,
|
|
87
|
+
muted,
|
|
88
|
+
size,
|
|
89
|
+
weight,
|
|
90
|
+
}),
|
|
91
|
+
)}
|
|
80
92
|
ref={ref}
|
|
81
93
|
>
|
|
82
94
|
<span>{children}</span>
|
|
83
|
-
</
|
|
95
|
+
</As>
|
|
84
96
|
)
|
|
85
97
|
})
|
|
98
|
+
|
|
86
99
|
Heading.displayName = 'ForwardRef(Heading)'
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
import {ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import {Space} from '@sanity/ui/theme'
|
|
1
3
|
import {forwardRef, useMemo, Children} from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
+
// import {useArrayProp} from '../../hooks'
|
|
5
|
+
// import {styled} from '../../lib/styled'
|
|
4
6
|
import {Box, BoxProps} from '../box'
|
|
5
|
-
import {inlineBaseStyle, inlineSpaceStyle} from './styles'
|
|
6
|
-
import {ResponsiveInlineSpaceStyleProps} from './types'
|
|
7
|
+
// import {inlineBaseStyle, inlineSpaceStyle} from './styles'
|
|
8
|
+
// import {ResponsiveInlineSpaceStyleProps} from './types'
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* @public
|
|
10
12
|
*/
|
|
11
|
-
export interface InlineProps
|
|
13
|
+
export interface InlineProps
|
|
14
|
+
extends Omit<BoxProps, 'align' | 'display' | 'gap' | 'gapX' | 'gapY' | 'justify'> {
|
|
12
15
|
/** The spacing between children. */
|
|
13
|
-
space?:
|
|
16
|
+
space?: ResponsiveProp<Space>
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
const Root = styled(Box)<ResponsiveInlineSpaceStyleProps>(inlineBaseStyle, inlineSpaceStyle)
|
|
19
|
+
// const Root = styled(Box)<ResponsiveInlineSpaceStyleProps>(inlineBaseStyle, inlineSpaceStyle)
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* The `Inline` component is a layout utility for aligning and spacing items horizontally.
|
|
@@ -21,27 +24,33 @@ const Root = styled(Box)<ResponsiveInlineSpaceStyleProps>(inlineBaseStyle, inlin
|
|
|
21
24
|
* @public
|
|
22
25
|
*/
|
|
23
26
|
export const Inline = forwardRef(function Inline(
|
|
24
|
-
props: InlineProps & React.HTMLProps<HTMLDivElement>,
|
|
27
|
+
props: InlineProps & Omit<React.HTMLProps<HTMLDivElement>, 'wrap'>,
|
|
25
28
|
ref,
|
|
26
29
|
) {
|
|
27
30
|
const {as, children: childrenProp, space, ...restProps} = props
|
|
28
31
|
|
|
29
32
|
const children = useMemo(
|
|
30
|
-
() => Children.map(childrenProp, (child) => child && <
|
|
33
|
+
() => Children.map(childrenProp, (child) => child && <Box maxWidth="fill">{child}</Box>),
|
|
31
34
|
[childrenProp],
|
|
32
35
|
)
|
|
33
36
|
|
|
34
37
|
return (
|
|
35
|
-
<
|
|
38
|
+
<Box
|
|
36
39
|
data-ui="Inline"
|
|
37
40
|
{...restProps}
|
|
38
|
-
$space={useArrayProp(space)}
|
|
39
|
-
|
|
41
|
+
// $space={useArrayProp(space)}
|
|
42
|
+
align="center"
|
|
43
|
+
as={as}
|
|
44
|
+
display="flex"
|
|
45
|
+
// forwardedAs={as}
|
|
46
|
+
gap={space}
|
|
40
47
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
48
|
ref={ref as any}
|
|
49
|
+
wrap="wrap"
|
|
42
50
|
>
|
|
43
51
|
{children}
|
|
44
|
-
</
|
|
52
|
+
</Box>
|
|
45
53
|
)
|
|
46
54
|
})
|
|
55
|
+
|
|
47
56
|
Inline.displayName = 'ForwardRef(Inline)'
|
|
@@ -1,41 +1,18 @@
|
|
|
1
|
+
import {composeClassNames, kbd, RadiusStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import {FontTextSize, Space} from '@sanity/ui/theme'
|
|
1
3
|
import {forwardRef} from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import {useArrayProp} from '../../hooks'
|
|
4
|
-
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
5
|
-
import {Radius} from '../../types'
|
|
6
|
-
import {Box} from '../box'
|
|
4
|
+
import {Box, BoxProps} from '../box'
|
|
7
5
|
import {Text} from '../text'
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* @public
|
|
11
9
|
*/
|
|
12
|
-
export interface KBDProps {
|
|
10
|
+
export interface KBDProps extends BoxProps, RadiusStyleProps {
|
|
13
11
|
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
14
|
-
fontSize?:
|
|
15
|
-
padding?:
|
|
16
|
-
radius?: Radius | Radius[]
|
|
12
|
+
fontSize?: ResponsiveProp<FontTextSize>
|
|
13
|
+
padding?: ResponsiveProp<Space>
|
|
17
14
|
}
|
|
18
15
|
|
|
19
|
-
function kbdStyle() {
|
|
20
|
-
return css`
|
|
21
|
-
--card-bg-color: var(--card-kbd-bg-color);
|
|
22
|
-
--card-border-color: var(--card-kbd-border-color);
|
|
23
|
-
--card-fg-color: var(--card-kbd-fg-color);
|
|
24
|
-
|
|
25
|
-
box-shadow: inset 0 0 0 1px var(--card-border-color);
|
|
26
|
-
background: var(--card-bg-color);
|
|
27
|
-
font: inherit;
|
|
28
|
-
|
|
29
|
-
vertical-align: top;
|
|
30
|
-
|
|
31
|
-
&:not([hidden]) {
|
|
32
|
-
display: inline-block;
|
|
33
|
-
}
|
|
34
|
-
`
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const Root = styled.kbd<ResponsiveRadiusStyleProps>(responsiveRadiusStyle, kbdStyle)
|
|
38
|
-
|
|
39
16
|
/**
|
|
40
17
|
* Used to define some text as keyboard input.
|
|
41
18
|
*
|
|
@@ -45,16 +22,32 @@ export const KBD = forwardRef(function KBD(
|
|
|
45
22
|
props: KBDProps & Omit<React.HTMLProps<HTMLElement>, 'as' | 'ref' | 'size'>,
|
|
46
23
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
47
24
|
) {
|
|
48
|
-
const {
|
|
25
|
+
const {
|
|
26
|
+
as = 'kbd',
|
|
27
|
+
children,
|
|
28
|
+
className,
|
|
29
|
+
display = 'inline-block',
|
|
30
|
+
fontSize = 0,
|
|
31
|
+
padding = 1,
|
|
32
|
+
radius = 2,
|
|
33
|
+
...restProps
|
|
34
|
+
} = props
|
|
49
35
|
|
|
50
36
|
return (
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
37
|
+
<Box
|
|
38
|
+
data-ui="KBD"
|
|
39
|
+
{...restProps}
|
|
40
|
+
as={as}
|
|
41
|
+
className={composeClassNames(className, kbd({radius}))}
|
|
42
|
+
display={display}
|
|
43
|
+
padding={padding}
|
|
44
|
+
ref={ref}
|
|
45
|
+
>
|
|
46
|
+
<Text as="span" size={fontSize} weight="semibold">
|
|
47
|
+
{children}
|
|
48
|
+
</Text>
|
|
49
|
+
</Box>
|
|
58
50
|
)
|
|
59
51
|
})
|
|
52
|
+
|
|
60
53
|
KBD.displayName = 'ForwardRef(KBD)'
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import {composeClassNames, label} from '@sanity/ui/css'
|
|
1
2
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
3
|
import {forwardRef} from 'react'
|
|
3
|
-
import {styled} from 'styled-components'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
5
|
+
import {styled} from '../../lib/styled'
|
|
5
6
|
import {responsiveLabelFont, responsiveTextAlignStyle} from '../../styles/internal'
|
|
6
7
|
import {TextAlign} from '../../types'
|
|
7
8
|
import {labelBaseStyle} from './styles'
|
|
@@ -52,6 +53,7 @@ export const Label = forwardRef(function Label(
|
|
|
52
53
|
accent,
|
|
53
54
|
align,
|
|
54
55
|
children: childrenProp,
|
|
56
|
+
className,
|
|
55
57
|
muted = false,
|
|
56
58
|
size = 2,
|
|
57
59
|
textOverflow,
|
|
@@ -71,15 +73,24 @@ export const Label = forwardRef(function Label(
|
|
|
71
73
|
<Root
|
|
72
74
|
data-ui="Label"
|
|
73
75
|
{...restProps}
|
|
74
|
-
$accent={accent}
|
|
76
|
+
// $accent={accent}
|
|
75
77
|
$align={useArrayProp(align)}
|
|
76
|
-
$muted={muted}
|
|
77
|
-
$size={useArrayProp(size)}
|
|
78
|
+
// $muted={muted}
|
|
79
|
+
// $size={useArrayProp(size)}
|
|
78
80
|
$weight={weight}
|
|
81
|
+
className={composeClassNames(
|
|
82
|
+
className,
|
|
83
|
+
label({
|
|
84
|
+
accent,
|
|
85
|
+
muted,
|
|
86
|
+
size,
|
|
87
|
+
}),
|
|
88
|
+
)}
|
|
79
89
|
ref={ref}
|
|
80
90
|
>
|
|
81
91
|
{children}
|
|
82
92
|
</Root>
|
|
83
93
|
)
|
|
84
94
|
})
|
|
95
|
+
|
|
85
96
|
Label.displayName = 'ForwardRef(Label)'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
2
3
|
import {
|
|
3
4
|
Middleware,
|
|
4
5
|
RootBoundary,
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
shift,
|
|
11
12
|
useFloating,
|
|
12
13
|
} from '@floating-ui/react-dom'
|
|
14
|
+
import {RadiusStyleProps} from '@sanity/ui/css'
|
|
13
15
|
import {ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
14
16
|
import {AnimatePresence} from 'framer-motion'
|
|
15
17
|
import {
|
|
@@ -29,7 +31,7 @@ import {origin} from '../../middleware/origin'
|
|
|
29
31
|
import {useTheme_v2} from '../../theme'
|
|
30
32
|
import {BoxOverflow, CardTone, Placement, PopoverMargins} from '../../types'
|
|
31
33
|
import {LayerProps, LayerProvider, Portal, useBoundaryElement} from '../../utils'
|
|
32
|
-
import {
|
|
34
|
+
import {ResponsiveShadowProps} from '../types'
|
|
33
35
|
import {
|
|
34
36
|
DEFAULT_POPOVER_DISTANCE,
|
|
35
37
|
DEFAULT_POPOVER_MARGINS,
|
|
@@ -45,8 +47,8 @@ export type {PopoverUpdateCallback}
|
|
|
45
47
|
|
|
46
48
|
/** @public */
|
|
47
49
|
export interface PopoverProps
|
|
48
|
-
extends Omit<LayerProps, '
|
|
49
|
-
|
|
50
|
+
extends Omit<LayerProps, 'width'>,
|
|
51
|
+
RadiusStyleProps,
|
|
50
52
|
ResponsiveShadowProps {
|
|
51
53
|
/** @beta */
|
|
52
54
|
__unstable_margins?: PopoverMargins
|
|
@@ -116,7 +118,10 @@ export interface PopoverProps
|
|
|
116
118
|
export const Popover = memo(
|
|
117
119
|
forwardRef(function Popover(
|
|
118
120
|
props: PopoverProps &
|
|
119
|
-
Omit<
|
|
121
|
+
Omit<
|
|
122
|
+
React.HTMLProps<HTMLDivElement>,
|
|
123
|
+
'as' | 'children' | 'content' | 'height' | 'width' | 'wrap'
|
|
124
|
+
>,
|
|
120
125
|
forwardedRef: React.ForwardedRef<HTMLDivElement>,
|
|
121
126
|
): React.ReactElement {
|
|
122
127
|
const {container, layer} = useTheme_v2()
|
|
@@ -139,15 +144,15 @@ export const Popover = memo(
|
|
|
139
144
|
onActivate,
|
|
140
145
|
open,
|
|
141
146
|
overflow = 'hidden',
|
|
142
|
-
padding
|
|
147
|
+
padding,
|
|
143
148
|
placement: placementProp = 'bottom',
|
|
144
149
|
portal,
|
|
145
150
|
preventOverflow = true,
|
|
146
|
-
radius
|
|
151
|
+
radius = 3,
|
|
147
152
|
referenceBoundary = props.boundaryElement ?? boundaryElementContext.element,
|
|
148
153
|
referenceElement,
|
|
149
154
|
scheme,
|
|
150
|
-
shadow
|
|
155
|
+
shadow = 3,
|
|
151
156
|
tone = 'inherit',
|
|
152
157
|
width: widthProp = 'auto',
|
|
153
158
|
zOffset: zOffsetProp = layer.popover.zOffset,
|
|
@@ -157,9 +162,9 @@ export const Popover = memo(
|
|
|
157
162
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
158
163
|
const animate = prefersReducedMotion ? false : _animate
|
|
159
164
|
const boundarySize = useElementSize(boundaryElement)?.border
|
|
160
|
-
const padding = useArrayProp(paddingProp)
|
|
161
|
-
const radius = useArrayProp(radiusProp)
|
|
162
|
-
const shadow = useArrayProp(shadowProp)
|
|
165
|
+
// const padding = useArrayProp(paddingProp)
|
|
166
|
+
// const radius = useArrayProp(radiusProp)
|
|
167
|
+
// const shadow = useArrayProp(shadowProp)
|
|
163
168
|
const widthArrayProp = useArrayProp(widthProp)
|
|
164
169
|
const zOffset = useArrayProp(zOffsetProp)
|
|
165
170
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
@@ -354,6 +359,7 @@ export const Popover = memo(
|
|
|
354
359
|
(node: HTMLElement | null) => {
|
|
355
360
|
refs.setReference(node)
|
|
356
361
|
|
|
362
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
357
363
|
const childRef = getElementRef(childProp as any)
|
|
358
364
|
|
|
359
365
|
if (typeof childRef === 'function') {
|
|
@@ -366,9 +372,9 @@ export const Popover = memo(
|
|
|
366
372
|
)
|
|
367
373
|
|
|
368
374
|
const child = useMemo(() => {
|
|
369
|
-
if (!childProp) return null
|
|
375
|
+
if (!childProp || referenceElement) return null
|
|
370
376
|
|
|
371
|
-
return cloneElement(childProp, {ref:
|
|
377
|
+
return cloneElement(childProp, {ref: setReference})
|
|
372
378
|
}, [childProp, referenceElement, setReference])
|
|
373
379
|
|
|
374
380
|
useEffect(() => {
|
|
@@ -382,9 +388,8 @@ export const Popover = memo(
|
|
|
382
388
|
}, [update, updateRef])
|
|
383
389
|
|
|
384
390
|
useEffect(() => {
|
|
385
|
-
if (
|
|
386
|
-
|
|
387
|
-
}
|
|
391
|
+
if (child) return
|
|
392
|
+
refs.setReference(referenceElement || null)
|
|
388
393
|
}, [referenceElement, refs, child])
|
|
389
394
|
|
|
390
395
|
if (disabled) {
|
|
@@ -441,6 +446,7 @@ export const Popover = memo(
|
|
|
441
446
|
)
|
|
442
447
|
}),
|
|
443
448
|
)
|
|
449
|
+
|
|
444
450
|
Popover.displayName = 'Memo(ForwardRef(Popover))'
|
|
445
451
|
|
|
446
452
|
// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`
|