@sanity/ui 2.9.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,10 +1,13 @@
|
|
|
1
1
|
import {Strategy} from '@floating-ui/react-dom'
|
|
2
|
+
import {RadiusStyleProps} from '@sanity/ui/css'
|
|
2
3
|
import {ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
3
4
|
import {MotionProps, motion} from 'framer-motion'
|
|
4
5
|
import React, {CSSProperties, forwardRef, memo, useMemo} from 'react'
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
// POPOVER_MOTION_CONTENT_OPACITY_PROPERTY,
|
|
8
|
+
POPOVER_MOTION_PROPS,
|
|
9
|
+
} from '../../constants'
|
|
10
|
+
import {BoxOverflow, CardTone, Placement, PopoverMargins} from '../../types'
|
|
8
11
|
import {Arrow, useLayer} from '../../utils'
|
|
9
12
|
import {Card, CardProps} from '../card'
|
|
10
13
|
import {Flex} from '../flex'
|
|
@@ -15,46 +18,38 @@ import {
|
|
|
15
18
|
DEFAULT_POPOVER_MARGINS,
|
|
16
19
|
} from './constants'
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
/** @internal */
|
|
22
|
+
export interface PopoverCardProps extends RadiusStyleProps {
|
|
23
|
+
/** @beta*/
|
|
24
|
+
__unstable_margins?: PopoverMargins
|
|
25
|
+
animate?: boolean
|
|
26
|
+
arrow: boolean
|
|
27
|
+
arrowRef: React.Ref<HTMLDivElement>
|
|
28
|
+
arrowX?: number
|
|
29
|
+
arrowY?: number
|
|
30
|
+
originX?: number
|
|
31
|
+
originY?: number
|
|
32
|
+
overflow?: BoxOverflow
|
|
33
|
+
padding?: number | number[]
|
|
34
|
+
placement: Placement
|
|
35
|
+
scheme?: ThemeColorSchemeKey
|
|
36
|
+
shadow?: number | number[]
|
|
37
|
+
strategy: Strategy
|
|
38
|
+
tone: CardTone
|
|
39
|
+
width: number | undefined
|
|
40
|
+
x: number | null
|
|
41
|
+
y: number | null
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const MotionCard = motion(Card)
|
|
30
45
|
|
|
31
46
|
/**
|
|
32
47
|
* @internal
|
|
33
48
|
*/
|
|
34
49
|
export const PopoverCard = memo(
|
|
35
50
|
forwardRef(function PopoverCard(
|
|
36
|
-
props:
|
|
37
|
-
|
|
38
|
-
__unstable_margins?: PopoverMargins
|
|
39
|
-
animate?: boolean
|
|
40
|
-
arrow: boolean
|
|
41
|
-
arrowRef: React.Ref<HTMLDivElement>
|
|
42
|
-
arrowX?: number
|
|
43
|
-
arrowY?: number
|
|
44
|
-
originX?: number
|
|
45
|
-
originY?: number
|
|
46
|
-
overflow?: BoxOverflow
|
|
47
|
-
padding?: number | number[]
|
|
48
|
-
placement: Placement
|
|
49
|
-
radius?: Radius | Radius[]
|
|
50
|
-
scheme?: ThemeColorSchemeKey
|
|
51
|
-
shadow?: number | number[]
|
|
52
|
-
strategy: Strategy
|
|
53
|
-
tone: CardTone
|
|
54
|
-
width: number | undefined
|
|
55
|
-
x: number | null
|
|
56
|
-
y: number | null
|
|
57
|
-
} & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width'>,
|
|
51
|
+
props: PopoverCardProps &
|
|
52
|
+
Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width' | 'wrap'>,
|
|
58
53
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
59
54
|
) {
|
|
60
55
|
const {
|
|
@@ -121,6 +116,7 @@ export const PopoverCard = memo(
|
|
|
121
116
|
|
|
122
117
|
return (
|
|
123
118
|
<MotionCard
|
|
119
|
+
className="popover-card"
|
|
124
120
|
data-ui="Popover"
|
|
125
121
|
{...(restProps as CardProps & MotionProps)}
|
|
126
122
|
data-placement={placement}
|
|
@@ -131,7 +127,9 @@ export const PopoverCard = memo(
|
|
|
131
127
|
sizing="border"
|
|
132
128
|
style={rootStyle}
|
|
133
129
|
tone={tone}
|
|
134
|
-
|
|
130
|
+
// todo
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
132
|
+
{...((animate ? POPOVER_MOTION_PROPS : {}) as any)}
|
|
135
133
|
>
|
|
136
134
|
<Flex data-ui="Popover__wrapper" direction="column" flex={1} overflow={overflow}>
|
|
137
135
|
<Flex direction="column" flex={1} padding={padding}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {ChevronDownIcon} from '@sanity/icons'
|
|
2
2
|
import {forwardRef, useImperativeHandle, useRef} from 'react'
|
|
3
|
-
import {styled} from 'styled
|
|
3
|
+
import {styled} from '../../lib/styled'
|
|
4
4
|
import {useCustomValidity, useArrayProp} from '../../hooks'
|
|
5
5
|
import {Radius} from '../../types'
|
|
6
6
|
import {Box} from '../box'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {ThemeFontSize, getTheme_v2} from '@sanity/ui/theme'
|
|
2
2
|
import {CSSObject} from '@sanity/ui/theme'
|
|
3
|
-
import {css} from 'styled
|
|
3
|
+
import {css} from '../../lib/styled'
|
|
4
4
|
import {rem, _responsive, ThemeProps} from '../../styles'
|
|
5
5
|
import {
|
|
6
6
|
focusRingBorderStyle,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {SpinnerIcon} from '@sanity/icons'
|
|
2
|
+
import {ResponsiveProp, spinner} from '@sanity/ui/css'
|
|
3
|
+
import {FontTextSize} from '@sanity/ui/theme'
|
|
2
4
|
import {forwardRef} from 'react'
|
|
3
|
-
import {styled, keyframes} from 'styled-components'
|
|
4
5
|
import {Text} from '../text'
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -8,25 +9,9 @@ import {Text} from '../text'
|
|
|
8
9
|
*/
|
|
9
10
|
export interface SpinnerProps {
|
|
10
11
|
muted?: boolean
|
|
11
|
-
size?:
|
|
12
|
+
size?: ResponsiveProp<FontTextSize>
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const rotate = keyframes`
|
|
15
|
-
from {
|
|
16
|
-
transform: rotate(0deg);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
to {
|
|
20
|
-
transform: rotate(360deg);
|
|
21
|
-
}
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
const Root = styled(Text)`
|
|
25
|
-
& > span > svg {
|
|
26
|
-
animation: ${rotate} 500ms linear infinite;
|
|
27
|
-
}
|
|
28
|
-
`
|
|
29
|
-
|
|
30
15
|
/**
|
|
31
16
|
* Indicate that something is loading for an indeterminate amount of time.
|
|
32
17
|
*
|
|
@@ -37,9 +22,10 @@ export const Spinner = forwardRef(function Spinner(
|
|
|
37
22
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
38
23
|
) {
|
|
39
24
|
return (
|
|
40
|
-
<
|
|
25
|
+
<Text data-ui="Spinner" {...props} className={spinner()} ref={ref}>
|
|
41
26
|
<SpinnerIcon />
|
|
42
|
-
</
|
|
27
|
+
</Text>
|
|
43
28
|
)
|
|
44
29
|
})
|
|
30
|
+
|
|
45
31
|
Spinner.displayName = 'ForwardRef(Spinner)'
|
|
@@ -1,39 +1,41 @@
|
|
|
1
|
+
import {ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import {Space} from '@sanity/ui/theme'
|
|
1
3
|
import {forwardRef} from 'react'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
3
|
-
import {useArrayProp} from '../../hooks'
|
|
4
4
|
import {Box, BoxProps} from '../box'
|
|
5
|
-
import {stackBaseStyle, responsiveStackSpaceStyle, ResponsiveStackSpaceStyleProps} from './styles'
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @public
|
|
9
8
|
*/
|
|
10
|
-
export interface StackProps
|
|
9
|
+
export interface StackProps
|
|
10
|
+
extends Omit<BoxProps, 'direction' | 'display' | 'gap' | 'gapX' | 'gapY'> {
|
|
11
11
|
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
12
|
-
space?:
|
|
12
|
+
space?: ResponsiveProp<Space>
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const Root = styled(Box)<ResponsiveStackSpaceStyleProps>(stackBaseStyle, responsiveStackSpaceStyle)
|
|
16
|
-
|
|
17
15
|
/**
|
|
18
16
|
* The `Stack` component is used to place elements on top of each other.
|
|
19
17
|
*
|
|
20
18
|
* @public
|
|
21
19
|
*/
|
|
22
20
|
export const Stack = forwardRef(function Stack(
|
|
23
|
-
props: StackProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'ref'>,
|
|
21
|
+
props: StackProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'ref' | 'width'>,
|
|
24
22
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
25
23
|
) {
|
|
26
24
|
const {as, space, ...restProps} = props
|
|
27
25
|
|
|
28
26
|
return (
|
|
29
|
-
<
|
|
27
|
+
<Box
|
|
28
|
+
as={as}
|
|
30
29
|
data-as={typeof as === 'string' ? as : undefined}
|
|
31
30
|
data-ui="Stack"
|
|
32
31
|
{...restProps}
|
|
33
|
-
|
|
32
|
+
direction="column"
|
|
33
|
+
display="flex"
|
|
34
34
|
forwardedAs={as}
|
|
35
|
+
gapY={space}
|
|
35
36
|
ref={ref}
|
|
36
37
|
/>
|
|
37
38
|
)
|
|
38
39
|
})
|
|
40
|
+
|
|
39
41
|
Stack.displayName = 'ForwardRef(Stack)'
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {getTheme_v2} from '@sanity/ui/theme'
|
|
2
|
-
import {css} from 'styled
|
|
2
|
+
import {css} from '../../lib/styled'
|
|
3
3
|
import {rem, ThemeProps} from '../../styles'
|
|
4
4
|
import {focusRingStyle} from '../../styles/internal'
|
|
5
5
|
|
|
6
6
|
/* Root */
|
|
7
|
-
export function switchBaseStyles(): ReturnType<typeof css> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
7
|
+
// export function switchBaseStyles(): ReturnType<typeof css> {
|
|
8
|
+
// return css`
|
|
9
|
+
// position: relative;
|
|
10
|
+
// &:not([hidden]) {
|
|
11
|
+
// display: inline-block;
|
|
12
|
+
// }
|
|
13
|
+
// `
|
|
14
|
+
// }
|
|
15
15
|
|
|
16
16
|
/* Input */
|
|
17
17
|
export function switchInputStyles(): ReturnType<typeof css> {
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
+
import {_switch, composeClassNames} from '@sanity/ui/css'
|
|
1
2
|
import {forwardRef, useEffect, useImperativeHandle, useRef} from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
switchBaseStyles,
|
|
5
|
-
switchRepresentationStyles,
|
|
6
|
-
switchThumbStyles,
|
|
7
|
-
switchTrackStyles,
|
|
8
|
-
switchInputStyles,
|
|
9
|
-
} from './styles'
|
|
3
|
+
import {Box} from '../box'
|
|
10
4
|
|
|
11
5
|
/**
|
|
12
6
|
* @public
|
|
@@ -15,12 +9,6 @@ export interface SwitchProps {
|
|
|
15
9
|
indeterminate?: boolean
|
|
16
10
|
}
|
|
17
11
|
|
|
18
|
-
const Root = styled.span(switchBaseStyles)
|
|
19
|
-
const Input = styled.input(switchInputStyles)
|
|
20
|
-
const Representation = styled.span(switchRepresentationStyles)
|
|
21
|
-
const Track = styled.span(switchTrackStyles)
|
|
22
|
-
const Thumb = styled.span<{$checked?: boolean; $indeterminate?: boolean}>(switchThumbStyles)
|
|
23
|
-
|
|
24
12
|
/**
|
|
25
13
|
* The `Switch` component allows the user to toggle a setting on and off.
|
|
26
14
|
*
|
|
@@ -48,20 +36,31 @@ export const Switch = forwardRef(function Switch(
|
|
|
48
36
|
}, [indeterminate])
|
|
49
37
|
|
|
50
38
|
return (
|
|
51
|
-
<
|
|
52
|
-
|
|
39
|
+
<Box
|
|
40
|
+
className={composeClassNames(className, _switch())}
|
|
41
|
+
data-ui="Switch"
|
|
42
|
+
display="inline-block"
|
|
43
|
+
position="relative"
|
|
44
|
+
style={style}
|
|
45
|
+
>
|
|
46
|
+
<input
|
|
53
47
|
data-read-only={!disabled && readOnly ? '' : undefined}
|
|
54
48
|
{...restProps}
|
|
55
49
|
checked={indeterminate !== true && checked}
|
|
50
|
+
className="switch-input"
|
|
56
51
|
disabled={disabled || readOnly}
|
|
57
52
|
type="checkbox"
|
|
58
53
|
ref={ref}
|
|
59
54
|
/>
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
<span aria-hidden className="switch-presentation" data-name="representation">
|
|
56
|
+
<span className="switch-track" />
|
|
57
|
+
<span
|
|
58
|
+
className="switch-thumb"
|
|
59
|
+
data-checked={checked ? '' : undefined}
|
|
60
|
+
data-indeterminate={indeterminate ? '' : undefined}
|
|
61
|
+
/>
|
|
62
|
+
</span>
|
|
63
|
+
</Box>
|
|
65
64
|
)
|
|
66
65
|
})
|
|
67
66
|
Switch.displayName = 'ForwardRef(Switch)'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Flex, Text, ThemeProps} from '@sanity/ui'
|
|
2
2
|
import {ThemeColorAvatarColorKey, ThemeColorSpotKey, getTheme_v2} from '@sanity/ui/theme'
|
|
3
3
|
import {useSelect} from '@sanity/ui-workshop'
|
|
4
|
-
import {styled, css} from 'styled
|
|
4
|
+
import {styled, css} from '../../../lib/styled'
|
|
5
5
|
import {WORKSHOP_SPOT_COLOR_OPTIONS} from '../../../__workshop__/constants'
|
|
6
6
|
|
|
7
7
|
const ColoredText = styled(Text)<{$color?: ThemeColorSpotKey}>((
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {getTheme_v2} from '@sanity/ui/theme'
|
|
2
|
-
import {css} from 'styled
|
|
2
|
+
import {css} from '../../lib/styled'
|
|
3
3
|
import {ThemeProps} from '../../styles'
|
|
4
4
|
|
|
5
5
|
export function textBaseStyle(
|
|
@@ -9,7 +9,6 @@ export function textBaseStyle(
|
|
|
9
9
|
const {font} = getTheme_v2(props.theme)
|
|
10
10
|
|
|
11
11
|
return css`
|
|
12
|
-
min-width: 0;
|
|
13
12
|
color: var(--card-fg-color);
|
|
14
13
|
|
|
15
14
|
${$accent &&
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
+
import {composeClassNames, text, TextStyleProps} 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
|
-
ResponsiveFontStyleProps,
|
|
7
|
-
responsiveTextAlignStyle,
|
|
8
|
-
responsiveTextFont,
|
|
9
|
-
} from '../../styles/internal'
|
|
5
|
+
import {styled} from '../../lib/styled'
|
|
10
6
|
import {TextAlign} from '../../types'
|
|
11
|
-
import {textBaseStyle} from './styles'
|
|
12
7
|
|
|
13
8
|
/**
|
|
14
9
|
* @public
|
|
15
10
|
*/
|
|
16
|
-
export interface TextProps {
|
|
11
|
+
export interface TextProps extends TextStyleProps {
|
|
17
12
|
accent?: boolean
|
|
18
13
|
align?: TextAlign | TextAlign[]
|
|
19
14
|
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
20
15
|
/** When `true` the text color will be muted. */
|
|
21
16
|
muted?: boolean
|
|
22
|
-
size?: number | number[]
|
|
23
17
|
/**
|
|
24
18
|
* Controls how overflowing text is treated.
|
|
25
19
|
* Use `textOverflow="ellipsis"` to render text as a single line which is concatenated with a `…` symbol.
|
|
@@ -29,12 +23,6 @@ export interface TextProps {
|
|
|
29
23
|
weight?: ThemeFontWeightKey
|
|
30
24
|
}
|
|
31
25
|
|
|
32
|
-
const Root = styled.div<ResponsiveFontStyleProps>(
|
|
33
|
-
responsiveTextFont,
|
|
34
|
-
responsiveTextAlignStyle,
|
|
35
|
-
textBaseStyle,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
26
|
const SpanWithTextOverflow = styled.span`
|
|
39
27
|
display: block;
|
|
40
28
|
white-space: nowrap;
|
|
@@ -55,7 +43,9 @@ export const Text = forwardRef(function Text(
|
|
|
55
43
|
const {
|
|
56
44
|
accent = false,
|
|
57
45
|
align,
|
|
46
|
+
as: As = 'div',
|
|
58
47
|
children: childrenProp,
|
|
48
|
+
className,
|
|
59
49
|
muted = false,
|
|
60
50
|
size = 2,
|
|
61
51
|
textOverflow,
|
|
@@ -72,18 +62,24 @@ export const Text = forwardRef(function Text(
|
|
|
72
62
|
}
|
|
73
63
|
|
|
74
64
|
return (
|
|
75
|
-
<
|
|
65
|
+
<As
|
|
76
66
|
data-ui="Text"
|
|
77
67
|
{...restProps}
|
|
78
|
-
$accent={accent}
|
|
79
68
|
$align={useArrayProp(align)}
|
|
80
|
-
$muted={muted}
|
|
81
69
|
ref={ref}
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
className={composeClassNames(
|
|
71
|
+
className,
|
|
72
|
+
text({
|
|
73
|
+
accent,
|
|
74
|
+
muted,
|
|
75
|
+
size,
|
|
76
|
+
weight,
|
|
77
|
+
}),
|
|
78
|
+
)}
|
|
84
79
|
>
|
|
85
80
|
{children}
|
|
86
|
-
</
|
|
81
|
+
</As>
|
|
87
82
|
)
|
|
88
83
|
})
|
|
84
|
+
|
|
89
85
|
Text.displayName = 'ForwardRef(Text)'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
2
|
import {forwardRef, useImperativeHandle, useRef} from 'react'
|
|
3
|
-
import {styled} from 'styled
|
|
3
|
+
import {styled} from '../../lib/styled'
|
|
4
4
|
import {useCustomValidity, useArrayProp} from '../../hooks'
|
|
5
5
|
import {
|
|
6
6
|
responsiveInputPaddingStyle,
|
|
@@ -83,7 +83,7 @@ function TextInputTest(props: {inputRef: React.Ref<HTMLInputElement>}) {
|
|
|
83
83
|
icon={icon && icons[icon]}
|
|
84
84
|
iconRight={iconRight && icons[iconRight]}
|
|
85
85
|
id="text-input-example"
|
|
86
|
-
name="
|
|
86
|
+
name="test"
|
|
87
87
|
onChange={handleChange}
|
|
88
88
|
padding={padding}
|
|
89
89
|
placeholder={placeholder}
|