@sanity/ui 2.10.0-corel.0 → 3.0.0-static.1
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 +3542 -0
- package/dist/_chunks-cjs/buildCommand.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +25 -0
- package/dist/cli.js.map +1 -0
- package/dist/css.d.mts +1062 -0
- package/dist/css.d.ts +1062 -0
- package/dist/css.esm.js +3794 -0
- package/dist/css.esm.js.map +1 -0
- package/dist/css.js +3794 -0
- package/dist/css.js.map +1 -0
- package/dist/css.mjs +3794 -0
- package/dist/css.mjs.map +1 -0
- package/dist/index.d.mts +240 -221
- package/dist/index.d.ts +240 -221
- package/dist/index.esm.js +3033 -4536
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3037 -4541
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3033 -4536
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +25 -0
- package/dist/system.css +3385 -0
- package/dist/theme.d.mts +84 -22
- package/dist/theme.d.ts +84 -22
- package/dist/theme.esm.js +1718 -656
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +1757 -693
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1718 -656
- package/dist/theme.mjs.map +1 -1
- package/exports/css.ts +1 -0
- package/package.json +45 -24
- package/src/core/__workshop__/constants.ts +28 -19
- package/src/core/_compat/index.ts +2 -0
- package/src/core/{styles → _compat/styles}/border/borderStyle.ts +6 -0
- package/src/core/{styles → _compat/styles}/border/types.ts +1 -0
- package/src/core/{styles → _compat/styles}/box/boxStyle.ts +7 -1
- package/src/core/{styles → _compat/styles}/box/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/card/_cardColorStyle.ts +2 -10
- package/src/core/{styles → _compat/styles}/flex/flexItemStyle.ts +1 -1
- package/src/core/{styles → _compat/styles}/flex/flexStyle.ts +0 -18
- package/src/core/{styles → _compat/styles}/flex/types.ts +1 -3
- package/src/core/{styles → _compat/styles}/font/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/grid/gridStyle.ts +0 -10
- package/src/core/{styles → _compat/styles}/grid/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/helpers.ts +10 -1
- package/src/core/{styles → _compat/styles}/input/textInputStyle.ts +2 -2
- package/src/core/{styles → _compat/styles}/radius/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/shadow/shadowStyle.ts +1 -1
- package/src/core/components/autocomplete/__workshop__/custom.tsx +5 -4
- package/src/core/components/autocomplete/__workshop__/example.tsx +3 -2
- package/src/core/components/autocomplete/autocomplete.tsx +17 -9
- 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.tsx +14 -9
- package/src/core/components/dialog/__workshop__/props.tsx +2 -0
- package/src/core/components/dialog/dialog.tsx +73 -92
- package/src/core/components/hotkeys/hotkeys.tsx +18 -29
- package/src/core/components/menu/menu.tsx +13 -12
- package/src/core/components/menu/menuDivider.tsx +16 -0
- package/src/core/components/menu/menuGroup.tsx +10 -8
- package/src/core/components/menu/menuItem.tsx +23 -14
- package/src/core/components/skeleton/skeleton.tsx +14 -20
- package/src/core/components/skeleton/textSkeleton.tsx +72 -48
- package/src/core/components/tab/tab.tsx +5 -7
- package/src/core/components/tab/tabList.tsx +5 -21
- package/src/core/components/tab/tabPanel.tsx +1 -0
- package/src/core/components/toast/toast.tsx +31 -16
- package/src/core/components/toast/toastProvider.tsx +23 -23
- package/src/core/components/tree/tree.tsx +7 -2
- package/src/core/components/tree/treeGroup.tsx +4 -1
- package/src/core/components/tree/treeItem.tsx +44 -35
- package/src/core/components/tree/types.ts +5 -1
- package/src/core/hooks/useArrayProp.ts +1 -1
- package/src/core/index.ts +0 -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 +38 -39
- package/src/core/primitives/avatar/avatarCounter.tsx +2 -2
- package/src/core/primitives/avatar/avatarStack.tsx +2 -2
- package/src/core/primitives/avatar/styles.ts +2 -2
- 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 +65 -74
- package/src/core/primitives/button/__workshop__/props.tsx +5 -2
- package/src/core/primitives/button/__workshop__/stacked.tsx +2 -1
- package/src/core/primitives/button/button.tsx +38 -45
- package/src/core/primitives/button/styles.ts +5 -5
- package/src/core/primitives/card/RootCardContext.ts +3 -0
- package/src/core/primitives/card/__workshop__/props.tsx +2 -2
- package/src/core/primitives/card/card.tsx +37 -42
- package/src/core/primitives/checkbox/checkbox.tsx +6 -8
- package/src/core/primitives/code/code.tsx +22 -13
- package/src/core/primitives/code/styles.ts +1 -1
- package/src/core/primitives/container/container.tsx +7 -15
- package/src/core/primitives/container/styles.ts +1 -1
- package/src/core/primitives/flex/flex.tsx +6 -31
- package/src/core/primitives/grid/grid.tsx +6 -19
- package/src/core/primitives/heading/heading.tsx +24 -28
- package/src/core/primitives/heading/styles.ts +2 -2
- package/src/core/primitives/inline/inline.tsx +18 -18
- package/src/core/primitives/inline/styles.ts +1 -1
- package/src/core/primitives/kbd/kbd.tsx +30 -37
- package/src/core/primitives/label/label.tsx +15 -9
- package/src/core/primitives/label/styles.ts +2 -2
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -1
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -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 +3 -3
- package/src/core/primitives/select/select.tsx +1 -1
- package/src/core/primitives/select/styles.ts +3 -3
- package/src/core/primitives/spinner/__workshop__/Props.tsx +2 -1
- package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +16 -0
- package/src/core/primitives/spinner/spinner.tsx +8 -22
- package/src/core/primitives/stack/stack.tsx +12 -10
- package/src/core/primitives/stack/styles.ts +1 -1
- package/src/core/primitives/switch/styles.ts +11 -11
- package/src/core/primitives/switch/switch.tsx +20 -21
- package/src/core/primitives/text/styles.ts +2 -3
- package/src/core/primitives/text/text.tsx +18 -25
- package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/textArea/textArea.tsx +3 -3
- package/src/core/primitives/textInput/__workshop__/plain.tsx +4 -3
- package/src/core/primitives/textInput/textInput.tsx +111 -125
- 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 +36 -16
- package/src/core/theme/__workshop__/build/story.tsx +2 -4
- package/src/core/theme/useTheme.ts +1 -1
- package/src/core/types/avatar.ts +6 -1
- package/src/core/types/box.ts +22 -16
- package/src/core/types/button.ts +1 -0
- package/src/core/types/flex.ts +27 -26
- package/src/core/types/grid.ts +17 -12
- package/src/core/types/gridItem.ts +32 -24
- package/src/core/types/radius.ts +7 -4
- package/src/core/types/text.ts +7 -4
- package/src/core/utils/arrow/arrow.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/compileRule.ts +58 -0
- package/src/css/compile/compileRules.ts +56 -0
- package/src/css/compile/compileSystem.ts +7 -0
- package/src/css/compile/compileTheme.ts +512 -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 +25 -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/menu/index.ts +1 -0
- package/src/css/components/menu/menu.ts +5 -0
- package/src/css/components/menu/rules.ts +10 -0
- package/src/css/components/skeleton/index.ts +2 -0
- package/src/css/components/skeleton/rules.ts +106 -0
- package/src/css/components/skeleton/skeleton.ts +31 -0
- package/src/css/components/skeleton/types.ts +24 -0
- package/src/css/components/toast/rules.ts +68 -0
- package/src/css/components/tree/index.ts +1 -0
- package/src/css/components/tree/rules.ts +167 -0
- package/src/css/components/tree/tree.ts +5 -0
- package/src/css/composeClassNames.ts +3 -0
- package/src/css/index.ts +51 -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 +38 -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 +48 -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 +241 -0
- package/src/css/primitives/checkbox/__styles.ts +129 -0
- 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/css/primitives/selectable/__style.ts +117 -0
- 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 +20 -0
- package/src/css/primitives/spinner/spinner.ts +9 -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 +2 -0
- package/src/css/primitives/textInput/rules.ts +321 -0
- package/src/css/primitives/textInput/textInput.ts +15 -0
- package/src/css/primitives/textInput/types.ts +8 -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 +99 -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 +17 -0
- package/src/css/styles/font/index.ts +2 -0
- package/src/css/styles/font/rules.ts +148 -0
- package/src/css/styles/font/types.ts +12 -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/grid.ts +13 -0
- package/src/css/styles/grid/index.ts +2 -0
- package/src/css/styles/grid/rules.ts +146 -0
- package/src/css/styles/grid/types.ts +29 -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 +63 -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/outline/rules.ts +7 -0
- package/src/css/styles/overflow/index.ts +2 -0
- package/src/css/styles/overflow/overflow.ts +11 -0
- package/src/css/styles/overflow/rules.ts +9 -0
- package/src/css/styles/overflow/types.ts +11 -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 +61 -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 +626 -0
- package/src/css/varNames.ts +381 -0
- package/src/css/vars.ts +399 -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/dist/_chunks-cjs/getTheme_v2.js +0 -342
- package/dist/_chunks-cjs/getTheme_v2.js.map +0 -1
- package/dist/_chunks-es/getTheme_v2.mjs +0 -343
- package/dist/_chunks-es/getTheme_v2.mjs.map +0 -1
- package/dist/_legacy/getTheme_v2.esm.js +0 -343
- package/dist/_legacy/getTheme_v2.esm.js.map +0 -1
- package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -38
- package/src/core/components/breadcrumbs/__workshop__/buttons.tsx +0 -58
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -5
- package/src/core/components/dialog/styles.ts +0 -76
- package/src/core/components/menu/menuDivider.ts +0 -12
- package/src/core/components/skeleton/styles.ts +0 -50
- package/src/core/components/toast/styles.ts +0 -61
- package/src/core/components/tree/style.ts +0 -104
- package/src/core/primitives/_selectable/style.ts +0 -114
- package/src/core/primitives/card/styles.ts +0 -146
- package/src/core/primitives/checkbox/styles.ts +0 -127
- /package/src/core/{styles → _compat/styles}/border/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/box/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/card/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/flex/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/focusRing/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/codeFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/headingFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/labelFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/responsiveFont.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/textAlignStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/textFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/grid/gridItemStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/grid/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/input/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/input/responsiveInputPaddingStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/internal.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/marginStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/marginsStyle.test.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/paddingStyle.test.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/paddingStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/radius/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/radius/radiusStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/shadow/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/shadow/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/types.ts +0 -0
- /package/src/core/{_compat.ts → _compat/types.ts} +0 -0
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import {CloseIcon} from '@sanity/icons'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
composeClassNames,
|
|
4
|
+
RadiusStyleProps,
|
|
5
|
+
ResponsiveProp,
|
|
6
|
+
textInput,
|
|
7
|
+
textInputElement,
|
|
8
|
+
} from '@sanity/ui/css'
|
|
9
|
+
import {FontTextSize, Space, ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
3
10
|
import {forwardRef, isValidElement, useCallback, useImperativeHandle, useMemo, useRef} from 'react'
|
|
4
11
|
import {isValidElementType} from 'react-is'
|
|
5
|
-
import {styled} from 'styled-components'
|
|
6
12
|
import {EMPTY_RECORD} from '../../constants'
|
|
7
13
|
import {useArrayProp, useCustomValidity} from '../../hooks'
|
|
8
|
-
import {
|
|
9
|
-
responsiveRadiusStyle,
|
|
10
|
-
ResponsiveRadiusStyleProps,
|
|
11
|
-
responsiveInputPaddingStyle,
|
|
12
|
-
TextInputInputStyleProps,
|
|
13
|
-
TextInputRepresentationStyleProps,
|
|
14
|
-
TextInputResponsivePaddingStyleProps,
|
|
15
|
-
textInputBaseStyle,
|
|
16
|
-
textInputFontSizeStyle,
|
|
17
|
-
textInputRepresentationStyle,
|
|
18
|
-
textInputRootStyle,
|
|
19
|
-
} from '../../styles/internal'
|
|
14
|
+
import {styled} from '../../lib/styled'
|
|
20
15
|
import {useRootTheme} from '../../theme'
|
|
21
|
-
import {Radius} from '../../types'
|
|
22
16
|
import {Box} from '../box'
|
|
23
17
|
import {Button, ButtonProps} from '../button'
|
|
24
18
|
import {Card} from '../card'
|
|
@@ -50,7 +44,7 @@ export type TextInputType =
|
|
|
50
44
|
/**
|
|
51
45
|
* @public
|
|
52
46
|
*/
|
|
53
|
-
export interface TextInputProps {
|
|
47
|
+
export interface TextInputProps extends RadiusStyleProps {
|
|
54
48
|
/**
|
|
55
49
|
* @beta
|
|
56
50
|
*/
|
|
@@ -61,82 +55,27 @@ export interface TextInputProps {
|
|
|
61
55
|
*/
|
|
62
56
|
clearButton?: boolean | TextInputClearButtonProps
|
|
63
57
|
customValidity?: string
|
|
64
|
-
fontSize?:
|
|
58
|
+
fontSize?: ResponsiveProp<FontTextSize>
|
|
65
59
|
icon?: React.ElementType | React.ReactNode
|
|
66
60
|
iconRight?: React.ElementType | React.ReactNode
|
|
67
61
|
/**
|
|
68
62
|
* @beta
|
|
69
63
|
*/
|
|
70
64
|
onClear?: () => void
|
|
71
|
-
padding?:
|
|
65
|
+
padding?: ResponsiveProp<Space>
|
|
72
66
|
prefix?: React.ReactNode
|
|
73
|
-
|
|
74
|
-
space?: number | number[]
|
|
67
|
+
space?: ResponsiveProp<Space>
|
|
75
68
|
suffix?: React.ReactNode
|
|
76
69
|
type?: TextInputType
|
|
77
70
|
weight?: ThemeFontWeightKey
|
|
78
71
|
}
|
|
79
72
|
|
|
80
|
-
const CLEAR_BUTTON_BOX_STYLE: React.CSSProperties = {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
min-width: 0;
|
|
87
|
-
display: block;
|
|
88
|
-
position: relative;
|
|
89
|
-
`
|
|
90
|
-
|
|
91
|
-
const Prefix = styled(Card).attrs({forwardedAs: 'span'})`
|
|
92
|
-
border-top-right-radius: 0;
|
|
93
|
-
border-bottom-right-radius: 0;
|
|
94
|
-
|
|
95
|
-
& > span {
|
|
96
|
-
display: block;
|
|
97
|
-
margin: -1px;
|
|
98
|
-
}
|
|
99
|
-
`
|
|
100
|
-
|
|
101
|
-
const Suffix = styled(Card).attrs({forwardedAs: 'span'})`
|
|
102
|
-
border-top-left-radius: 0;
|
|
103
|
-
border-bottom-left-radius: 0;
|
|
104
|
-
|
|
105
|
-
& > span {
|
|
106
|
-
display: block;
|
|
107
|
-
margin: -1px;
|
|
108
|
-
}
|
|
109
|
-
`
|
|
110
|
-
|
|
111
|
-
const Input = styled.input<TextInputResponsivePaddingStyleProps & TextInputInputStyleProps>(
|
|
112
|
-
responsiveInputPaddingStyle,
|
|
113
|
-
textInputBaseStyle,
|
|
114
|
-
textInputFontSizeStyle,
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
const Presentation = styled.span<ResponsiveRadiusStyleProps & TextInputRepresentationStyleProps>(
|
|
118
|
-
responsiveRadiusStyle,
|
|
119
|
-
textInputRepresentationStyle,
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
const LeftBox = styled(Box)`
|
|
123
|
-
position: absolute;
|
|
124
|
-
top: 0;
|
|
125
|
-
left: 0;
|
|
126
|
-
`
|
|
127
|
-
|
|
128
|
-
const RightBox = styled(Box)`
|
|
129
|
-
position: absolute;
|
|
130
|
-
top: 0;
|
|
131
|
-
right: 0;
|
|
132
|
-
`
|
|
133
|
-
|
|
134
|
-
const RightCard = styled(Card)`
|
|
135
|
-
background-color: transparent;
|
|
136
|
-
position: absolute;
|
|
137
|
-
top: 0;
|
|
138
|
-
right: 0;
|
|
139
|
-
`
|
|
73
|
+
const CLEAR_BUTTON_BOX_STYLE: React.CSSProperties = {
|
|
74
|
+
backgroundColor: 'transparent',
|
|
75
|
+
top: 0,
|
|
76
|
+
right: 0,
|
|
77
|
+
zIndex: 2,
|
|
78
|
+
}
|
|
140
79
|
|
|
141
80
|
const TextInputClearButton = styled(Button)({
|
|
142
81
|
'&:not([hidden])': {
|
|
@@ -156,6 +95,7 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
156
95
|
const {
|
|
157
96
|
__unstable_disableFocusRing,
|
|
158
97
|
border = true,
|
|
98
|
+
className,
|
|
159
99
|
clearButton,
|
|
160
100
|
disabled = false,
|
|
161
101
|
fontSize: fontSizeProp = 2,
|
|
@@ -166,11 +106,11 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
166
106
|
prefix,
|
|
167
107
|
radius: radiusProp = 2,
|
|
168
108
|
readOnly,
|
|
169
|
-
space:
|
|
109
|
+
space: _space = 3, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
170
110
|
suffix,
|
|
171
111
|
customValidity,
|
|
172
112
|
type = 'text',
|
|
173
|
-
weight,
|
|
113
|
+
weight: _width, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
174
114
|
...restProps
|
|
175
115
|
} = props
|
|
176
116
|
const ref = useRef<HTMLInputElement | null>(null)
|
|
@@ -180,14 +120,14 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
180
120
|
const fontSize = useArrayProp(fontSizeProp)
|
|
181
121
|
const padding = useArrayProp(paddingProp)
|
|
182
122
|
const radius = useArrayProp(radiusProp)
|
|
183
|
-
const space = useArrayProp(spaceProp)
|
|
123
|
+
// const space = useArrayProp(spaceProp)
|
|
184
124
|
|
|
185
125
|
// Transient properties
|
|
186
126
|
const $hasClearButton = Boolean(clearButton)
|
|
187
|
-
const $hasIcon = Boolean(IconComponent)
|
|
188
|
-
const $hasIconRight = Boolean(IconRightComponent)
|
|
189
|
-
const $hasSuffix = Boolean(suffix)
|
|
190
|
-
const $hasPrefix = Boolean(prefix)
|
|
127
|
+
// const $hasIcon = Boolean(IconComponent)
|
|
128
|
+
// const $hasIconRight = Boolean(IconRightComponent)
|
|
129
|
+
// const $hasSuffix = Boolean(suffix)
|
|
130
|
+
// const $hasPrefix = Boolean(prefix)
|
|
191
131
|
|
|
192
132
|
useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(
|
|
193
133
|
forwardedRef,
|
|
@@ -219,9 +159,18 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
219
159
|
const prefixNode = useMemo(
|
|
220
160
|
() =>
|
|
221
161
|
prefix && (
|
|
222
|
-
<
|
|
162
|
+
<Card
|
|
163
|
+
as="span"
|
|
164
|
+
borderTop
|
|
165
|
+
borderLeft
|
|
166
|
+
borderBottom
|
|
167
|
+
className="text-input-prefix"
|
|
168
|
+
radius={radius}
|
|
169
|
+
sizing="border"
|
|
170
|
+
tone="inherit"
|
|
171
|
+
>
|
|
223
172
|
<span>{prefix}</span>
|
|
224
|
-
</
|
|
173
|
+
</Card>
|
|
225
174
|
),
|
|
226
175
|
[prefix, radius],
|
|
227
176
|
)
|
|
@@ -229,35 +178,41 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
229
178
|
// Render presentation (memoized)
|
|
230
179
|
const presentationNode = useMemo(
|
|
231
180
|
() => (
|
|
232
|
-
<
|
|
233
|
-
|
|
234
|
-
$
|
|
235
|
-
$
|
|
236
|
-
$
|
|
237
|
-
$
|
|
238
|
-
$
|
|
181
|
+
<Card
|
|
182
|
+
as="span"
|
|
183
|
+
// $hasPrefix={$hasPrefix}
|
|
184
|
+
// $unstableDisableFocusRing={__unstable_disableFocusRing}
|
|
185
|
+
// $hasSuffix={$hasSuffix}
|
|
186
|
+
// $radius={radius}
|
|
187
|
+
// $scheme={rootTheme.scheme}
|
|
188
|
+
// $tone={rootTheme.tone}
|
|
189
|
+
// border={border}
|
|
190
|
+
className="text-input-presentation"
|
|
239
191
|
data-border={border ? '' : undefined}
|
|
192
|
+
data-disable-focus-ring={__unstable_disableFocusRing ? '' : undefined}
|
|
240
193
|
data-scheme={rootTheme.scheme}
|
|
241
194
|
data-tone={rootTheme.tone}
|
|
195
|
+
position="absolute"
|
|
196
|
+
radius={radius}
|
|
242
197
|
>
|
|
243
198
|
{IconComponent && (
|
|
244
|
-
<
|
|
199
|
+
<Box as="span" padding={padding} position="absolute" style={{top: 0, left: 0}}>
|
|
245
200
|
<Text size={fontSize}>
|
|
246
201
|
{isValidElement(IconComponent) && IconComponent}
|
|
247
202
|
{isValidElementType(IconComponent) && <IconComponent />}
|
|
248
203
|
</Text>
|
|
249
|
-
</
|
|
204
|
+
</Box>
|
|
250
205
|
)}
|
|
251
206
|
|
|
252
207
|
{!$hasClearButton && IconRightComponent && (
|
|
253
|
-
<
|
|
208
|
+
<Box as="span" padding={padding} position="absolute" style={{top: 0, right: 0}}>
|
|
254
209
|
<Text size={fontSize}>
|
|
255
210
|
{isValidElement(IconRightComponent) && IconRightComponent}
|
|
256
211
|
{isValidElementType(IconRightComponent) && <IconRightComponent />}
|
|
257
212
|
</Text>
|
|
258
|
-
</
|
|
213
|
+
</Box>
|
|
259
214
|
)}
|
|
260
|
-
</
|
|
215
|
+
</Card>
|
|
261
216
|
),
|
|
262
217
|
[
|
|
263
218
|
__unstable_disableFocusRing,
|
|
@@ -269,8 +224,8 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
269
224
|
radius,
|
|
270
225
|
rootTheme,
|
|
271
226
|
$hasClearButton,
|
|
272
|
-
$hasPrefix,
|
|
273
|
-
$hasSuffix,
|
|
227
|
+
// $hasPrefix,
|
|
228
|
+
// $hasSuffix,
|
|
274
229
|
],
|
|
275
230
|
)
|
|
276
231
|
|
|
@@ -282,10 +237,11 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
282
237
|
if (v === 1) return 1
|
|
283
238
|
if (v === 2) return 1
|
|
284
239
|
|
|
285
|
-
return v - 2
|
|
240
|
+
return (v as Space) - 2
|
|
286
241
|
}),
|
|
287
242
|
[padding],
|
|
288
243
|
)
|
|
244
|
+
|
|
289
245
|
const clearButtonPadding = useMemo(
|
|
290
246
|
() =>
|
|
291
247
|
padding.map((v) => {
|
|
@@ -293,7 +249,7 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
293
249
|
if (v === 1) return 0
|
|
294
250
|
if (v === 2) return 1
|
|
295
251
|
|
|
296
|
-
return v - 1
|
|
252
|
+
return (v as Space) - 1
|
|
297
253
|
}),
|
|
298
254
|
[padding],
|
|
299
255
|
)
|
|
@@ -306,11 +262,16 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
306
262
|
!disabled &&
|
|
307
263
|
!readOnly &&
|
|
308
264
|
clearButton && (
|
|
309
|
-
<
|
|
310
|
-
forwardedAs="span"
|
|
265
|
+
<Card
|
|
266
|
+
// forwardedAs="span"
|
|
311
267
|
padding={clearButtonBoxPadding}
|
|
268
|
+
position="absolute"
|
|
312
269
|
style={CLEAR_BUTTON_BOX_STYLE}
|
|
313
270
|
tone={customValidity ? 'critical' : 'inherit'}
|
|
271
|
+
|
|
272
|
+
// position: absolute;
|
|
273
|
+
// top: 0;
|
|
274
|
+
// right: 0;
|
|
314
275
|
>
|
|
315
276
|
<TextInputClearButton
|
|
316
277
|
aria-label="Clear"
|
|
@@ -324,7 +285,7 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
324
285
|
onClick={handleClearClick}
|
|
325
286
|
onMouseDown={handleClearMouseDown}
|
|
326
287
|
/>
|
|
327
|
-
</
|
|
288
|
+
</Card>
|
|
328
289
|
),
|
|
329
290
|
[
|
|
330
291
|
clearButton,
|
|
@@ -345,31 +306,55 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
345
306
|
const suffixNode = useMemo(
|
|
346
307
|
() =>
|
|
347
308
|
suffix && (
|
|
348
|
-
<
|
|
309
|
+
<Card
|
|
310
|
+
as="span"
|
|
311
|
+
borderTop
|
|
312
|
+
borderRight
|
|
313
|
+
borderBottom
|
|
314
|
+
className="text-input-suffix"
|
|
315
|
+
radius={radius}
|
|
316
|
+
sizing="border"
|
|
317
|
+
tone="inherit"
|
|
318
|
+
>
|
|
349
319
|
<span>{suffix}</span>
|
|
350
|
-
</
|
|
320
|
+
</Card>
|
|
351
321
|
),
|
|
352
322
|
[radius, suffix],
|
|
353
323
|
)
|
|
354
324
|
|
|
355
325
|
return (
|
|
356
|
-
<
|
|
326
|
+
<Card
|
|
327
|
+
align="center"
|
|
328
|
+
as="span"
|
|
329
|
+
className={composeClassNames(className, textInput({padding, size: fontSizeProp}))}
|
|
330
|
+
data-ui="TextInput"
|
|
331
|
+
display="flex"
|
|
332
|
+
tone={rootTheme.tone}
|
|
333
|
+
>
|
|
357
334
|
{prefixNode}
|
|
358
335
|
|
|
359
|
-
<
|
|
360
|
-
|
|
336
|
+
<Box
|
|
337
|
+
as="span"
|
|
338
|
+
// className="text-input-wrapper"
|
|
339
|
+
flex={1}
|
|
340
|
+
// todo
|
|
341
|
+
// minWidth={0}
|
|
342
|
+
position="relative"
|
|
343
|
+
>
|
|
344
|
+
<input
|
|
361
345
|
data-as="input"
|
|
362
|
-
data-scheme={rootTheme.scheme}
|
|
363
|
-
data-tone={rootTheme.tone}
|
|
346
|
+
// data-scheme={rootTheme.scheme}
|
|
347
|
+
// data-tone={rootTheme.tone}
|
|
364
348
|
{...restProps}
|
|
365
|
-
|
|
366
|
-
$
|
|
367
|
-
$
|
|
368
|
-
$
|
|
369
|
-
$
|
|
370
|
-
$
|
|
371
|
-
$
|
|
372
|
-
$
|
|
349
|
+
className={textInputElement()}
|
|
350
|
+
// $fontSize={fontSize}
|
|
351
|
+
// $iconLeft={$hasIcon}
|
|
352
|
+
// $iconRight={$hasIconRight || $hasClearButton}
|
|
353
|
+
// $padding={padding}
|
|
354
|
+
// $scheme={rootTheme.scheme}
|
|
355
|
+
// $space={space}
|
|
356
|
+
// $tone={rootTheme.tone}
|
|
357
|
+
// $weight={weight}
|
|
373
358
|
disabled={disabled}
|
|
374
359
|
readOnly={readOnly}
|
|
375
360
|
ref={ref}
|
|
@@ -378,10 +363,11 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
378
363
|
|
|
379
364
|
{presentationNode}
|
|
380
365
|
{clearButtonNode}
|
|
381
|
-
</
|
|
366
|
+
</Box>
|
|
382
367
|
|
|
383
368
|
{suffixNode}
|
|
384
|
-
</
|
|
369
|
+
</Card>
|
|
385
370
|
)
|
|
386
371
|
})
|
|
372
|
+
|
|
387
373
|
TextInput.displayName = 'ForwardRef(TextInput)'
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
type Middleware,
|
|
10
10
|
type RootBoundary,
|
|
11
11
|
} from '@floating-ui/react-dom'
|
|
12
|
+
import {composeClassNames, RadiusStyleProps, tooltip} from '@sanity/ui/css'
|
|
12
13
|
import type {ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
13
14
|
import {AnimatePresence} from 'framer-motion'
|
|
14
15
|
import {
|
|
@@ -23,7 +24,6 @@ import {
|
|
|
23
24
|
useImperativeHandle,
|
|
24
25
|
useLayoutEffect,
|
|
25
26
|
} from 'react'
|
|
26
|
-
import {styled} from 'styled-components'
|
|
27
27
|
import {useEffectEvent} from 'use-effect-event'
|
|
28
28
|
import {useArrayProp, usePrefersReducedMotion} from '../../hooks'
|
|
29
29
|
import {useDelayedState} from '../../hooks/useDelayedState'
|
|
@@ -43,7 +43,7 @@ import {useTooltipDelayGroup} from './tooltipDelayGroup'
|
|
|
43
43
|
/**
|
|
44
44
|
* @public
|
|
45
45
|
*/
|
|
46
|
-
export interface TooltipProps extends Omit<LayerProps, 'as'
|
|
46
|
+
export interface TooltipProps extends Omit<LayerProps, 'as'>, RadiusStyleProps {
|
|
47
47
|
/** @deprecated Use `fallbackPlacements` instead. */
|
|
48
48
|
allowedAutoPlacements?: Placement[]
|
|
49
49
|
arrow?: boolean
|
|
@@ -56,7 +56,7 @@ export interface TooltipProps extends Omit<LayerProps, 'as'> {
|
|
|
56
56
|
placement?: Placement
|
|
57
57
|
/** Whether or not to render the tooltip in a portal element. */
|
|
58
58
|
portal?: boolean | string
|
|
59
|
-
radius?: number | number[]
|
|
59
|
+
// radius?: number | number[]
|
|
60
60
|
scheme?: ThemeColorSchemeKey
|
|
61
61
|
shadow?: number | number[]
|
|
62
62
|
/**
|
|
@@ -79,17 +79,14 @@ export interface TooltipProps extends Omit<LayerProps, 'as'> {
|
|
|
79
79
|
animate?: boolean
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
const Root = styled(Layer)`
|
|
83
|
-
pointer-events: none;
|
|
84
|
-
`
|
|
85
|
-
|
|
86
82
|
/**
|
|
87
83
|
* Tooltips display information when hovering, focusing or tapping.
|
|
88
84
|
*
|
|
89
85
|
* @public
|
|
90
86
|
*/
|
|
91
87
|
export const Tooltip = forwardRef(function Tooltip(
|
|
92
|
-
props: TooltipProps &
|
|
88
|
+
props: TooltipProps &
|
|
89
|
+
Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content' | 'width' | 'wrap'>,
|
|
93
90
|
forwardedRef: React.ForwardedRef<HTMLDivElement>,
|
|
94
91
|
) {
|
|
95
92
|
const boundaryElementContext = useBoundaryElement()
|
|
@@ -99,6 +96,7 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
99
96
|
arrow: arrowProp = false,
|
|
100
97
|
boundaryElement = boundaryElementContext?.element,
|
|
101
98
|
children: childProp,
|
|
99
|
+
className,
|
|
102
100
|
content,
|
|
103
101
|
disabled,
|
|
104
102
|
fallbackPlacements: fallbackPlacementsProp = props.fallbackPlacements ??
|
|
@@ -364,10 +362,11 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
364
362
|
|
|
365
363
|
if (disabled) return child
|
|
366
364
|
|
|
367
|
-
const
|
|
368
|
-
<
|
|
365
|
+
const node = (
|
|
366
|
+
<Layer
|
|
369
367
|
data-ui="Tooltip"
|
|
370
368
|
{...restProps}
|
|
369
|
+
className={composeClassNames(className, tooltip())}
|
|
371
370
|
ref={setFloating}
|
|
372
371
|
style={{
|
|
373
372
|
...floatingStyles,
|
|
@@ -393,17 +392,17 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
393
392
|
>
|
|
394
393
|
{content}
|
|
395
394
|
</TooltipCard>
|
|
396
|
-
</
|
|
395
|
+
</Layer>
|
|
397
396
|
)
|
|
398
397
|
|
|
399
398
|
const children =
|
|
400
399
|
showTooltip &&
|
|
401
400
|
(portalProp ? (
|
|
402
401
|
<Portal __unstable_name={typeof portalProp === 'string' ? portalProp : undefined}>
|
|
403
|
-
{
|
|
402
|
+
{node}
|
|
404
403
|
</Portal>
|
|
405
404
|
) : (
|
|
406
|
-
|
|
405
|
+
node
|
|
407
406
|
))
|
|
408
407
|
|
|
409
408
|
return (
|
|
@@ -416,6 +415,7 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
416
415
|
</>
|
|
417
416
|
)
|
|
418
417
|
})
|
|
418
|
+
|
|
419
419
|
Tooltip.displayName = 'ForwardRef(Tooltip)'
|
|
420
420
|
|
|
421
421
|
/**
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
+
import {RadiusStyleProps, tooltipCard} from '@sanity/ui/css'
|
|
1
2
|
import {ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
2
|
-
import {
|
|
3
|
+
import {motion} from 'framer-motion'
|
|
3
4
|
import React, {CSSProperties, forwardRef, memo, useMemo} from 'react'
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
// POPOVER_MOTION_CONTENT_OPACITY_PROPERTY,
|
|
7
|
+
POPOVER_MOTION_PROPS,
|
|
8
|
+
} from '../../constants'
|
|
9
|
+
import {Placement} from '../../types'
|
|
7
10
|
import {Arrow} from '../../utils'
|
|
8
|
-
import {Card
|
|
11
|
+
import {Card} from '../card'
|
|
9
12
|
import {
|
|
10
13
|
DEFAULT_TOOLTIP_ARROW_HEIGHT,
|
|
11
14
|
DEFAULT_TOOLTIP_ARROW_RADIUS,
|
|
12
15
|
DEFAULT_TOOLTIP_ARROW_WIDTH,
|
|
13
16
|
} from './constants'
|
|
14
17
|
|
|
15
|
-
const MotionCard =
|
|
16
|
-
& > * {
|
|
17
|
-
opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
18
|
-
will-change: opacity;
|
|
19
|
-
}
|
|
20
|
-
`
|
|
18
|
+
const MotionCard = motion(Card) as typeof Card
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
21
|
* @internal
|
|
@@ -34,10 +32,10 @@ export const TooltipCard = memo(
|
|
|
34
32
|
originY?: number
|
|
35
33
|
padding?: number | number[]
|
|
36
34
|
placement?: Placement
|
|
37
|
-
radius?: Radius | Radius[]
|
|
38
35
|
scheme?: ThemeColorSchemeKey
|
|
39
36
|
shadow?: number | number[]
|
|
40
|
-
} &
|
|
37
|
+
} & RadiusStyleProps &
|
|
38
|
+
Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'rows' | 'width' | 'wrap'>,
|
|
41
39
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
42
40
|
) {
|
|
43
41
|
const {
|
|
@@ -81,7 +79,9 @@ export const TooltipCard = memo(
|
|
|
81
79
|
return (
|
|
82
80
|
<MotionCard
|
|
83
81
|
data-ui="Tooltip__card"
|
|
84
|
-
{...
|
|
82
|
+
{...restProps}
|
|
83
|
+
data-animate={animate ? '' : undefined}
|
|
84
|
+
className={tooltipCard()}
|
|
85
85
|
data-placement={placement}
|
|
86
86
|
padding={padding}
|
|
87
87
|
radius={radius}
|
|
@@ -106,4 +106,5 @@ export const TooltipCard = memo(
|
|
|
106
106
|
)
|
|
107
107
|
}),
|
|
108
108
|
)
|
|
109
|
+
|
|
109
110
|
TooltipCard.displayName = 'Memo(ForwardRef(TooltipCard))'
|
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
|
-
BoxDisplay,
|
|
3
|
-
BoxHeight,
|
|
4
|
-
BoxOverflow,
|
|
5
|
-
BoxSizing,
|
|
6
|
-
FlexAlign,
|
|
7
|
-
FlexDirection,
|
|
8
|
-
FlexJustify,
|
|
9
|
-
FlexValue,
|
|
10
|
-
FlexWrap,
|
|
11
|
-
GridAutoCols,
|
|
12
|
-
GridAutoFlow,
|
|
13
|
-
GridAutoRows,
|
|
14
2
|
GridItemColumn,
|
|
15
3
|
GridItemColumnEnd,
|
|
16
4
|
GridItemColumnStart,
|
|
17
5
|
GridItemRow,
|
|
18
6
|
GridItemRowEnd,
|
|
19
7
|
GridItemRowStart,
|
|
20
|
-
|
|
8
|
+
type FlexAlign,
|
|
9
|
+
type FlexDirection,
|
|
10
|
+
type FlexJustify,
|
|
11
|
+
type FlexValue,
|
|
12
|
+
type FlexWrap,
|
|
13
|
+
} from '@sanity/ui/css'
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
type BoxDisplay,
|
|
17
|
+
type BoxHeight,
|
|
18
|
+
type BoxOverflow,
|
|
19
|
+
type BoxSizing,
|
|
20
|
+
type GridAutoCols,
|
|
21
|
+
type GridAutoFlow,
|
|
22
|
+
type GridAutoRows,
|
|
23
|
+
// type GridItemColumn,
|
|
24
|
+
// type GridItemColumnEnd,
|
|
25
|
+
// type GridItemColumnStart,
|
|
26
|
+
// type GridItemRow,
|
|
27
|
+
// type GridItemRowEnd,
|
|
28
|
+
// type GridItemRowStart,
|
|
29
|
+
type Radius,
|
|
21
30
|
} from '../types'
|
|
22
31
|
|
|
23
32
|
/**
|
|
24
33
|
* @public
|
|
34
|
+
* @deprecated
|
|
25
35
|
*/
|
|
26
36
|
export interface ResponsiveBorderProps {
|
|
27
37
|
border?: boolean | boolean[]
|
|
@@ -33,6 +43,7 @@ export interface ResponsiveBorderProps {
|
|
|
33
43
|
|
|
34
44
|
/**
|
|
35
45
|
* @public
|
|
46
|
+
* @deprecated
|
|
36
47
|
*/
|
|
37
48
|
export interface ResponsiveBoxProps {
|
|
38
49
|
display?: BoxDisplay | BoxDisplay[]
|
|
@@ -43,6 +54,7 @@ export interface ResponsiveBoxProps {
|
|
|
43
54
|
|
|
44
55
|
/**
|
|
45
56
|
* @public
|
|
57
|
+
* @deprecated
|
|
46
58
|
*/
|
|
47
59
|
export interface ResponsiveFlexProps {
|
|
48
60
|
align?: FlexAlign | FlexAlign[]
|
|
@@ -53,6 +65,7 @@ export interface ResponsiveFlexProps {
|
|
|
53
65
|
|
|
54
66
|
/**
|
|
55
67
|
* @public
|
|
68
|
+
* @deprecated
|
|
56
69
|
*/
|
|
57
70
|
export interface ResponsiveFlexItemProps {
|
|
58
71
|
/** Sets the flex CSS attribute. The property is responsive. */
|
|
@@ -61,20 +74,22 @@ export interface ResponsiveFlexItemProps {
|
|
|
61
74
|
|
|
62
75
|
/**
|
|
63
76
|
* @public
|
|
77
|
+
* @deprecated
|
|
64
78
|
*/
|
|
65
79
|
export interface ResponsiveGridProps {
|
|
66
80
|
autoRows?: GridAutoRows | GridAutoRows[]
|
|
67
81
|
autoCols?: GridAutoCols | GridAutoCols[]
|
|
68
82
|
autoFlow?: GridAutoFlow | GridAutoFlow[]
|
|
69
83
|
columns?: number | number[]
|
|
70
|
-
gap?: number | number[]
|
|
71
|
-
gapX?: number | number[]
|
|
72
|
-
gapY?: number | number[]
|
|
84
|
+
// gap?: number | number[]
|
|
85
|
+
// gapX?: number | number[]
|
|
86
|
+
// gapY?: number | number[]
|
|
73
87
|
rows?: number | number[]
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
/**
|
|
77
91
|
* @public
|
|
92
|
+
* @deprecated
|
|
78
93
|
*/
|
|
79
94
|
export interface ResponsiveGridItemProps {
|
|
80
95
|
column?: GridItemColumn | GridItemColumn[]
|
|
@@ -87,6 +102,7 @@ export interface ResponsiveGridItemProps {
|
|
|
87
102
|
|
|
88
103
|
/**
|
|
89
104
|
* @public
|
|
105
|
+
* @deprecated
|
|
90
106
|
*/
|
|
91
107
|
export interface ResponsiveMarginProps {
|
|
92
108
|
/** Applies margins to all sides. The property is responsive. */
|
|
@@ -103,6 +119,7 @@ export interface ResponsiveMarginProps {
|
|
|
103
119
|
|
|
104
120
|
/**
|
|
105
121
|
* @public
|
|
122
|
+
* @deprecated
|
|
106
123
|
*/
|
|
107
124
|
export interface ResponsivePaddingProps {
|
|
108
125
|
padding?: number | number[]
|
|
@@ -116,6 +133,7 @@ export interface ResponsivePaddingProps {
|
|
|
116
133
|
|
|
117
134
|
/**
|
|
118
135
|
* @public
|
|
136
|
+
* @deprecated
|
|
119
137
|
*/
|
|
120
138
|
export interface ResponsiveRadiusProps {
|
|
121
139
|
radius?: Radius | Radius[]
|
|
@@ -123,6 +141,7 @@ export interface ResponsiveRadiusProps {
|
|
|
123
141
|
|
|
124
142
|
/**
|
|
125
143
|
* @public
|
|
144
|
+
* @deprecated
|
|
126
145
|
*/
|
|
127
146
|
export interface ResponsiveShadowProps {
|
|
128
147
|
shadow?: number | number[]
|
|
@@ -130,6 +149,7 @@ export interface ResponsiveShadowProps {
|
|
|
130
149
|
|
|
131
150
|
/**
|
|
132
151
|
* @public
|
|
152
|
+
* @deprecated
|
|
133
153
|
*/
|
|
134
154
|
export interface ResponsiveWidthProps {
|
|
135
155
|
width?: number | 'auto' | (number | 'auto')[]
|