@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,10 +1,10 @@
|
|
|
1
1
|
import {ChevronRightIcon} from '@sanity/icons'
|
|
2
|
+
import {ResponsiveProp} from '@sanity/ui/css'
|
|
3
|
+
import {Space} from '@sanity/ui/theme'
|
|
2
4
|
import {isValidElement, useCallback, useEffect, useState} from 'react'
|
|
3
5
|
import {isValidElementType} from 'react-is'
|
|
4
|
-
import {useArrayProp} from '../../hooks'
|
|
5
6
|
import {Box, Flex, Popover, PopoverProps, Text} from '../../primitives'
|
|
6
7
|
import {Selectable} from '../../primitives/_selectable'
|
|
7
|
-
import {useRootTheme} from '../../theme'
|
|
8
8
|
import {Radius, SelectableTone} from '../../types'
|
|
9
9
|
import {Menu} from './menu'
|
|
10
10
|
import {useMenu} from './useMenu'
|
|
@@ -19,7 +19,7 @@ export interface MenuGroupProps {
|
|
|
19
19
|
padding?: number | number[]
|
|
20
20
|
popover?: Omit<PopoverProps, 'content' | 'open'>
|
|
21
21
|
radius?: Radius | Radius[]
|
|
22
|
-
space?:
|
|
22
|
+
space?: ResponsiveProp<Space>
|
|
23
23
|
text: React.ReactNode
|
|
24
24
|
tone?: SelectableTone
|
|
25
25
|
}
|
|
@@ -28,7 +28,10 @@ export interface MenuGroupProps {
|
|
|
28
28
|
* @public
|
|
29
29
|
*/
|
|
30
30
|
export function MenuGroup(
|
|
31
|
-
props: Omit<
|
|
31
|
+
props: Omit<
|
|
32
|
+
React.HTMLProps<HTMLDivElement>,
|
|
33
|
+
'as' | 'height' | 'popover' | 'ref' | 'rows' | 'tabIndex' | 'width' | 'wrap'
|
|
34
|
+
> &
|
|
32
35
|
MenuGroupProps,
|
|
33
36
|
): React.ReactElement {
|
|
34
37
|
const {
|
|
@@ -46,7 +49,7 @@ export function MenuGroup(
|
|
|
46
49
|
...restProps
|
|
47
50
|
} = props
|
|
48
51
|
const menu = useMenu()
|
|
49
|
-
|
|
52
|
+
|
|
50
53
|
const {
|
|
51
54
|
activeElement,
|
|
52
55
|
mount,
|
|
@@ -166,14 +169,13 @@ export function MenuGroup(
|
|
|
166
169
|
aria-pressed={as === 'button' ? withinMenu : undefined}
|
|
167
170
|
data-pressed={as !== 'button' ? withinMenu : undefined}
|
|
168
171
|
data-selected={!withinMenu && active ? '' : undefined}
|
|
169
|
-
$radius={useArrayProp(radius)}
|
|
170
|
-
$tone={tone}
|
|
171
|
-
$scheme={scheme}
|
|
172
172
|
onClick={handleClick}
|
|
173
173
|
onKeyDown={handleKeyDown}
|
|
174
174
|
onMouseEnter={handleMouseEnter}
|
|
175
|
+
radius={radius}
|
|
175
176
|
ref={setRootElement}
|
|
176
177
|
tabIndex={-1}
|
|
178
|
+
tone={tone}
|
|
177
179
|
type={as === 'button' ? 'button' : undefined}
|
|
178
180
|
>
|
|
179
181
|
<Flex gap={space} padding={padding}>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {PaddingStyleProps, RadiusStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import {Space} from '@sanity/ui/theme'
|
|
1
3
|
import {
|
|
2
4
|
forwardRef,
|
|
3
5
|
isValidElement,
|
|
@@ -9,11 +11,10 @@ import {
|
|
|
9
11
|
useState,
|
|
10
12
|
} from 'react'
|
|
11
13
|
import {isValidElementType} from 'react-is'
|
|
12
|
-
import {useArrayProp} from '../../hooks'
|
|
14
|
+
// import {useArrayProp} from '../../hooks'
|
|
13
15
|
import {Box, Flex, Text} from '../../primitives'
|
|
14
16
|
import {Selectable} from '../../primitives/_selectable'
|
|
15
|
-
import {
|
|
16
|
-
import {useRootTheme} from '../../theme'
|
|
17
|
+
// import {useRootTheme} from '../../theme'
|
|
17
18
|
import {SelectableTone} from '../../types/selectable'
|
|
18
19
|
import {Hotkeys} from '../hotkeys'
|
|
19
20
|
import {useMenu} from './useMenu'
|
|
@@ -21,7 +22,7 @@ import {useMenu} from './useMenu'
|
|
|
21
22
|
/**
|
|
22
23
|
* @public
|
|
23
24
|
*/
|
|
24
|
-
export interface MenuItemProps extends
|
|
25
|
+
export interface MenuItemProps extends PaddingStyleProps, RadiusStyleProps {
|
|
25
26
|
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
26
27
|
fontSize?: number | number[]
|
|
27
28
|
hotkeys?: string[]
|
|
@@ -29,7 +30,8 @@ export interface MenuItemProps extends ResponsivePaddingProps, ResponsiveRadiusP
|
|
|
29
30
|
iconRight?: React.ElementType | React.ReactNode
|
|
30
31
|
pressed?: boolean
|
|
31
32
|
selected?: boolean
|
|
32
|
-
space?: number | number[]
|
|
33
|
+
// space?: number | number[]
|
|
34
|
+
space?: ResponsiveProp<Space>
|
|
33
35
|
text?: React.ReactNode
|
|
34
36
|
tone?: SelectableTone
|
|
35
37
|
}
|
|
@@ -39,7 +41,10 @@ export interface MenuItemProps extends ResponsivePaddingProps, ResponsiveRadiusP
|
|
|
39
41
|
*/
|
|
40
42
|
export const MenuItem = forwardRef(function MenuItem(
|
|
41
43
|
props: MenuItemProps &
|
|
42
|
-
Omit<
|
|
44
|
+
Omit<
|
|
45
|
+
React.HTMLProps<HTMLDivElement>,
|
|
46
|
+
'as' | 'height' | 'ref' | 'rows' | 'selected' | 'tabIndex' | 'width' | 'wrap'
|
|
47
|
+
>,
|
|
43
48
|
forwardedRef: React.ForwardedRef<HTMLDivElement>,
|
|
44
49
|
) {
|
|
45
50
|
const {
|
|
@@ -66,7 +71,7 @@ export const MenuItem = forwardRef(function MenuItem(
|
|
|
66
71
|
tone = 'default',
|
|
67
72
|
...restProps
|
|
68
73
|
} = props
|
|
69
|
-
const {scheme} = useRootTheme()
|
|
74
|
+
// const {scheme} = useRootTheme()
|
|
70
75
|
const menu = useMenu()
|
|
71
76
|
const {
|
|
72
77
|
activeElement,
|
|
@@ -105,7 +110,7 @@ export const MenuItem = forwardRef(function MenuItem(
|
|
|
105
110
|
[padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft],
|
|
106
111
|
)
|
|
107
112
|
|
|
108
|
-
const hotkeysFontSize = useArrayProp(fontSize).map((s) => s - 1)
|
|
113
|
+
// const hotkeysFontSize = useArrayProp(fontSize).map((s) => s - 1)
|
|
109
114
|
|
|
110
115
|
const setRef = useCallback((el: HTMLDivElement | null) => {
|
|
111
116
|
ref.current = el
|
|
@@ -117,14 +122,16 @@ export const MenuItem = forwardRef(function MenuItem(
|
|
|
117
122
|
data-ui="MenuItem"
|
|
118
123
|
{...restProps}
|
|
119
124
|
aria-pressed={as === 'button' && pressed}
|
|
125
|
+
as={as}
|
|
120
126
|
data-pressed={as !== 'button' && pressed ? '' : undefined}
|
|
121
127
|
data-selected={active ? '' : undefined}
|
|
122
128
|
data-disabled={disabled ? '' : undefined}
|
|
123
|
-
forwardedAs={as}
|
|
124
|
-
|
|
125
|
-
$
|
|
126
|
-
$
|
|
127
|
-
$
|
|
129
|
+
// forwardedAs={as}
|
|
130
|
+
radius={radius}
|
|
131
|
+
// $radius={useArrayProp(radius)}
|
|
132
|
+
// $padding={useArrayProp(0)}
|
|
133
|
+
// $tone={disabled ? 'default' : tone}
|
|
134
|
+
// $scheme={scheme}
|
|
128
135
|
disabled={disabled}
|
|
129
136
|
onClick={handleClick}
|
|
130
137
|
onMouseEnter={onItemMouseEnter}
|
|
@@ -132,6 +139,7 @@ export const MenuItem = forwardRef(function MenuItem(
|
|
|
132
139
|
ref={setRef}
|
|
133
140
|
role="menuitem"
|
|
134
141
|
tabIndex={-1}
|
|
142
|
+
tone={tone}
|
|
135
143
|
type={as === 'button' ? 'button' : undefined}
|
|
136
144
|
>
|
|
137
145
|
{(IconComponent || text || IconRightComponent) && (
|
|
@@ -153,7 +161,7 @@ export const MenuItem = forwardRef(function MenuItem(
|
|
|
153
161
|
|
|
154
162
|
{hotkeys && (
|
|
155
163
|
<Hotkeys
|
|
156
|
-
fontSize={hotkeysFontSize}
|
|
164
|
+
// fontSize={hotkeysFontSize}
|
|
157
165
|
keys={hotkeys}
|
|
158
166
|
style={{marginTop: -4, marginBottom: -4}}
|
|
159
167
|
/>
|
|
@@ -175,4 +183,5 @@ export const MenuItem = forwardRef(function MenuItem(
|
|
|
175
183
|
</Selectable>
|
|
176
184
|
)
|
|
177
185
|
})
|
|
186
|
+
|
|
178
187
|
MenuItem.displayName = 'ForwardRef(MenuItem)'
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {Box} from '../../primitives'
|
|
5
|
-
import {BoxProps, ResponsiveRadiusProps} from '../../primitives'
|
|
6
|
-
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
7
|
-
import {skeletonStyle} from './styles'
|
|
8
|
-
|
|
9
|
-
const Root = styled(Box)<{$animated: boolean; $visible: boolean} & ResponsiveRadiusStyleProps>(
|
|
10
|
-
responsiveRadiusStyle,
|
|
11
|
-
skeletonStyle,
|
|
12
|
-
)
|
|
1
|
+
import {composeClassNames, skeleton, SkeletonStyleProps} from '@sanity/ui/css'
|
|
2
|
+
import {ForwardedRef, forwardRef, HTMLProps, useEffect, useState} from 'react'
|
|
3
|
+
import {Box, BoxProps} from '../../primitives'
|
|
13
4
|
|
|
14
5
|
/**
|
|
15
6
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
16
7
|
* @beta
|
|
17
8
|
*/
|
|
18
|
-
export interface SkeletonProps extends
|
|
9
|
+
export interface SkeletonProps extends SkeletonStyleProps, Omit<BoxProps, 'children'> {
|
|
19
10
|
animated?: boolean
|
|
20
11
|
delay?: number
|
|
21
12
|
}
|
|
@@ -25,10 +16,11 @@ export interface SkeletonProps extends ResponsiveRadiusProps, Omit<BoxProps, 'ch
|
|
|
25
16
|
* @beta
|
|
26
17
|
*/
|
|
27
18
|
export const Skeleton = forwardRef(function Skeleton(
|
|
28
|
-
props: SkeletonProps &
|
|
29
|
-
|
|
19
|
+
props: SkeletonProps &
|
|
20
|
+
Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'rows' | 'width' | 'wrap'>,
|
|
21
|
+
ref: ForwardedRef<HTMLDivElement>,
|
|
30
22
|
) {
|
|
31
|
-
const {animated = false, delay, radius, ...restProps} = props
|
|
23
|
+
const {animated = false, className, delay, radius, ...restProps} = props
|
|
32
24
|
const [visible, setVisible] = useState<boolean>(delay ? false : true)
|
|
33
25
|
|
|
34
26
|
useEffect(() => {
|
|
@@ -46,13 +38,15 @@ export const Skeleton = forwardRef(function Skeleton(
|
|
|
46
38
|
}, [delay])
|
|
47
39
|
|
|
48
40
|
return (
|
|
49
|
-
<
|
|
41
|
+
<Box
|
|
42
|
+
data-ui="Skeleton"
|
|
50
43
|
{...restProps}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
className={composeClassNames(className, skeleton({radius}))}
|
|
45
|
+
data-animated={animated ? '' : undefined}
|
|
46
|
+
data-visible={visible ? '' : undefined}
|
|
54
47
|
ref={ref}
|
|
55
48
|
/>
|
|
56
49
|
)
|
|
57
50
|
})
|
|
51
|
+
|
|
58
52
|
Skeleton.displayName = 'ForwardRef(Skeleton)'
|
|
@@ -1,36 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
codeSkeleton,
|
|
3
|
+
composeClassNames,
|
|
4
|
+
headingSkeleton,
|
|
5
|
+
labelSkeleton,
|
|
6
|
+
ResponsiveProp,
|
|
7
|
+
textSkeleton,
|
|
8
|
+
} from '@sanity/ui/css'
|
|
9
|
+
import {FontCodeSize, FontHeadingSize, FontLabelSize, FontTextSize} from '@sanity/ui/theme'
|
|
2
10
|
import {forwardRef} from 'react'
|
|
3
|
-
import {styled} from 'styled-components'
|
|
4
|
-
import {useArrayProp} from '../../hooks'
|
|
5
|
-
import {ThemeProps, _responsive} from '../../styles'
|
|
6
11
|
import {Skeleton, SkeletonProps} from './skeleton'
|
|
7
12
|
|
|
8
|
-
const Root = styled(Skeleton)<{$size: number[]; $style: ThemeFontKey}>((
|
|
9
|
-
props: {
|
|
10
|
-
$size: number[]
|
|
11
|
-
$style: ThemeFontKey
|
|
12
|
-
} & ThemeProps,
|
|
13
|
-
) => {
|
|
14
|
-
const {$size, $style} = props
|
|
15
|
-
const {font, media} = getTheme_v2(props.theme)
|
|
16
|
-
const fontStyle = font[$style]
|
|
17
|
-
|
|
18
|
-
const styles = _responsive(media, $size, (sizeIndex) => {
|
|
19
|
-
const fontSize = fontStyle.sizes[sizeIndex]
|
|
20
|
-
const capHeight = fontSize.lineHeight - fontSize.ascenderHeight - fontSize.descenderHeight
|
|
21
|
-
|
|
22
|
-
return {height: capHeight}
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
return styles
|
|
26
|
-
})
|
|
27
|
-
|
|
28
13
|
/**
|
|
29
14
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
30
15
|
* @beta
|
|
31
16
|
*/
|
|
32
17
|
export interface TextSkeletonProps extends SkeletonProps {
|
|
33
|
-
size?:
|
|
18
|
+
size?: ResponsiveProp<FontTextSize>
|
|
34
19
|
}
|
|
35
20
|
|
|
36
21
|
/**
|
|
@@ -38,7 +23,7 @@ export interface TextSkeletonProps extends SkeletonProps {
|
|
|
38
23
|
* @beta
|
|
39
24
|
*/
|
|
40
25
|
export interface LabelSkeletonProps extends SkeletonProps {
|
|
41
|
-
size?:
|
|
26
|
+
size?: ResponsiveProp<FontLabelSize>
|
|
42
27
|
}
|
|
43
28
|
|
|
44
29
|
/**
|
|
@@ -46,7 +31,7 @@ export interface LabelSkeletonProps extends SkeletonProps {
|
|
|
46
31
|
* @beta
|
|
47
32
|
*/
|
|
48
33
|
export interface HeadingSkeletonProps extends SkeletonProps {
|
|
49
|
-
size?:
|
|
34
|
+
size?: ResponsiveProp<FontHeadingSize>
|
|
50
35
|
}
|
|
51
36
|
|
|
52
37
|
/**
|
|
@@ -54,7 +39,7 @@ export interface HeadingSkeletonProps extends SkeletonProps {
|
|
|
54
39
|
* @beta
|
|
55
40
|
*/
|
|
56
41
|
export interface CodeSkeletonProps extends SkeletonProps {
|
|
57
|
-
size?:
|
|
42
|
+
size?: ResponsiveProp<FontCodeSize>
|
|
58
43
|
}
|
|
59
44
|
|
|
60
45
|
/**
|
|
@@ -63,14 +48,24 @@ export interface CodeSkeletonProps extends SkeletonProps {
|
|
|
63
48
|
*/
|
|
64
49
|
export const TextSkeleton = forwardRef(function TextSkeleton(
|
|
65
50
|
props: TextSkeletonProps &
|
|
66
|
-
Omit<
|
|
51
|
+
Omit<
|
|
52
|
+
React.HTMLProps<HTMLDivElement>,
|
|
53
|
+
'as' | 'children' | 'height' | 'rows' | 'size' | 'width' | 'wrap'
|
|
54
|
+
>,
|
|
67
55
|
ref: React.Ref<HTMLDivElement>,
|
|
68
56
|
) {
|
|
69
|
-
const {size = 2, ...restProps} = props
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
57
|
+
const {className, size = 2, ...restProps} = props
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Skeleton
|
|
61
|
+
data-ui="TextSkeleton"
|
|
62
|
+
{...restProps}
|
|
63
|
+
className={composeClassNames(className, textSkeleton({size}))}
|
|
64
|
+
ref={ref}
|
|
65
|
+
/>
|
|
66
|
+
)
|
|
73
67
|
})
|
|
68
|
+
|
|
74
69
|
TextSkeleton.displayName = 'ForwardRef(TextSkeleton)'
|
|
75
70
|
|
|
76
71
|
/**
|
|
@@ -79,14 +74,24 @@ TextSkeleton.displayName = 'ForwardRef(TextSkeleton)'
|
|
|
79
74
|
*/
|
|
80
75
|
export const LabelSkeleton = forwardRef(function TextSkeleton(
|
|
81
76
|
props: LabelSkeletonProps &
|
|
82
|
-
Omit<
|
|
77
|
+
Omit<
|
|
78
|
+
React.HTMLProps<HTMLDivElement>,
|
|
79
|
+
'as' | 'children' | 'height' | 'rows' | 'size' | 'width' | 'wrap'
|
|
80
|
+
>,
|
|
83
81
|
ref: React.Ref<HTMLDivElement>,
|
|
84
82
|
) {
|
|
85
|
-
const {size = 2, ...restProps} = props
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
const {className, size = 2, ...restProps} = props
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Skeleton
|
|
87
|
+
data-ui="LabelSkeleton"
|
|
88
|
+
{...restProps}
|
|
89
|
+
className={composeClassNames(className, labelSkeleton({size}))}
|
|
90
|
+
ref={ref}
|
|
91
|
+
/>
|
|
92
|
+
)
|
|
89
93
|
})
|
|
94
|
+
|
|
90
95
|
LabelSkeleton.displayName = 'ForwardRef(LabelSkeleton)'
|
|
91
96
|
|
|
92
97
|
/**
|
|
@@ -95,14 +100,23 @@ LabelSkeleton.displayName = 'ForwardRef(LabelSkeleton)'
|
|
|
95
100
|
*/
|
|
96
101
|
export const HeadingSkeleton = forwardRef(function TextSkeleton(
|
|
97
102
|
props: HeadingSkeletonProps &
|
|
98
|
-
Omit<
|
|
103
|
+
Omit<
|
|
104
|
+
React.HTMLProps<HTMLDivElement>,
|
|
105
|
+
'as' | 'children' | 'height' | 'rows' | 'size' | 'width' | 'wrap'
|
|
106
|
+
>,
|
|
99
107
|
ref: React.Ref<HTMLDivElement>,
|
|
100
108
|
) {
|
|
101
|
-
const {size = 2, ...restProps} = props
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
const {className, size = 2, ...restProps} = props
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<Skeleton
|
|
113
|
+
{...restProps}
|
|
114
|
+
className={composeClassNames(className, headingSkeleton({size}))}
|
|
115
|
+
ref={ref}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
105
118
|
})
|
|
119
|
+
|
|
106
120
|
HeadingSkeleton.displayName = 'ForwardRef(HeadingSkeleton)'
|
|
107
121
|
|
|
108
122
|
/**
|
|
@@ -111,12 +125,22 @@ HeadingSkeleton.displayName = 'ForwardRef(HeadingSkeleton)'
|
|
|
111
125
|
*/
|
|
112
126
|
export const CodeSkeleton = forwardRef(function TextSkeleton(
|
|
113
127
|
props: CodeSkeletonProps &
|
|
114
|
-
Omit<
|
|
128
|
+
Omit<
|
|
129
|
+
React.HTMLProps<HTMLDivElement>,
|
|
130
|
+
'as' | 'children' | 'height' | 'rows' | 'size' | 'width' | 'wrap'
|
|
131
|
+
>,
|
|
115
132
|
ref: React.Ref<HTMLDivElement>,
|
|
116
133
|
) {
|
|
117
|
-
const {size = 2, ...restProps} = props
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
134
|
+
const {className, size = 2, ...restProps} = props
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<Skeleton
|
|
138
|
+
// root
|
|
139
|
+
{...restProps}
|
|
140
|
+
className={composeClassNames(className, codeSkeleton({size}))}
|
|
141
|
+
ref={ref}
|
|
142
|
+
/>
|
|
143
|
+
)
|
|
121
144
|
})
|
|
145
|
+
|
|
122
146
|
CodeSkeleton.displayName = 'ForwardRef(CodeSkeleton)'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import {ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import {FontTextSize} from '@sanity/ui/theme'
|
|
1
3
|
import {forwardRef, useCallback, useEffect, useImperativeHandle, useRef} from 'react'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
3
4
|
import {Button} from '../../primitives'
|
|
4
5
|
import {ButtonTone} from '../../types'
|
|
5
6
|
|
|
@@ -14,17 +15,13 @@ export interface TabProps {
|
|
|
14
15
|
'id': string
|
|
15
16
|
'icon'?: React.ElementType | React.ReactNode
|
|
16
17
|
'focused'?: boolean
|
|
17
|
-
'fontSize'?:
|
|
18
|
+
'fontSize'?: ResponsiveProp<FontTextSize>
|
|
18
19
|
'label'?: React.ReactNode
|
|
19
20
|
'padding'?: number | number[]
|
|
20
21
|
'selected'?: boolean
|
|
21
22
|
'tone'?: ButtonTone
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
const CustomButton = styled(Button)`
|
|
25
|
-
max-width: 100%;
|
|
26
|
-
`
|
|
27
|
-
|
|
28
25
|
/**
|
|
29
26
|
* @public
|
|
30
27
|
*/
|
|
@@ -76,7 +73,7 @@ export const Tab = forwardRef(function Tab(
|
|
|
76
73
|
}, [focused])
|
|
77
74
|
|
|
78
75
|
return (
|
|
79
|
-
<
|
|
76
|
+
<Button
|
|
80
77
|
data-ui="Tab"
|
|
81
78
|
{...restProps}
|
|
82
79
|
aria-selected={selected ? 'true' : 'false'}
|
|
@@ -97,4 +94,5 @@ export const Tab = forwardRef(function Tab(
|
|
|
97
94
|
/>
|
|
98
95
|
)
|
|
99
96
|
})
|
|
97
|
+
|
|
100
98
|
Tab.displayName = 'ForwardRef(Tab)'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {cloneElement, forwardRef, useCallback, useMemo, useState} from 'react'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
1
|
+
import {cloneElement, ForwardedRef, forwardRef, useCallback, useMemo, useState} from 'react'
|
|
3
2
|
import {Inline, InlineProps} from '../../primitives'
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -13,22 +12,12 @@ function _isReactElement(node: unknown): node is React.ReactElement {
|
|
|
13
12
|
return Boolean(node)
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
//Limits the width of tabs in tablist
|
|
17
|
-
const CustomInline = styled(Inline)`
|
|
18
|
-
& > div {
|
|
19
|
-
display: inline-block;
|
|
20
|
-
vertical-align: middle;
|
|
21
|
-
max-width: 100%;
|
|
22
|
-
box-sizing: border-box;
|
|
23
|
-
}
|
|
24
|
-
`
|
|
25
|
-
|
|
26
15
|
/**
|
|
27
16
|
* @public
|
|
28
17
|
*/
|
|
29
18
|
export const TabList = forwardRef(function TabList(
|
|
30
19
|
props: TabListProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height'>,
|
|
31
|
-
ref
|
|
20
|
+
ref: ForwardedRef<HTMLDivElement>,
|
|
32
21
|
) {
|
|
33
22
|
const {children: childrenProp, ...restProps} = props
|
|
34
23
|
const [focusedIndex, setFocusedIndex] = useState(-1)
|
|
@@ -63,15 +52,10 @@ export const TabList = forwardRef(function TabList(
|
|
|
63
52
|
)
|
|
64
53
|
|
|
65
54
|
return (
|
|
66
|
-
<
|
|
67
|
-
data-ui="TabList"
|
|
68
|
-
{...restProps}
|
|
69
|
-
onKeyDown={handleKeyDown}
|
|
70
|
-
ref={ref}
|
|
71
|
-
role="tablist"
|
|
72
|
-
>
|
|
55
|
+
<Inline data-ui="TabList" {...restProps} onKeyDown={handleKeyDown} ref={ref} role="tablist">
|
|
73
56
|
{tabs}
|
|
74
|
-
</
|
|
57
|
+
</Inline>
|
|
75
58
|
)
|
|
76
59
|
})
|
|
60
|
+
|
|
77
61
|
TabList.displayName = 'ForwardRef(TabList)'
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import {CloseIcon} from '@sanity/icons'
|
|
2
|
+
import {RadiusStyleProps} from '@sanity/ui/css'
|
|
2
3
|
import {ThemeColorStateToneKey} from '@sanity/ui/theme'
|
|
3
|
-
import {styled} from 'styled-components'
|
|
4
4
|
import {Box, Button, Flex, Stack, Text, Card} from '../../primitives'
|
|
5
|
-
import {ThemeProps} from '../../styles'
|
|
6
5
|
import type {ButtonTone} from '../../types'
|
|
7
|
-
import {rootStyles, TextBox} from './styles'
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* @public
|
|
11
9
|
*/
|
|
12
|
-
export interface ToastProps {
|
|
10
|
+
export interface ToastProps extends RadiusStyleProps {
|
|
13
11
|
closable?: boolean
|
|
14
12
|
description?: React.ReactNode
|
|
15
13
|
onClose?: () => void
|
|
16
|
-
radius?: number | number[]
|
|
17
14
|
title?: React.ReactNode
|
|
18
15
|
status?: 'error' | 'warning' | 'success' | 'info'
|
|
19
16
|
duration?: number
|
|
@@ -40,10 +37,6 @@ const ROLES = {
|
|
|
40
37
|
info: 'alert',
|
|
41
38
|
} as const
|
|
42
39
|
|
|
43
|
-
const Root = styled(Card)<{$duration?: number; tone: ThemeColorStateToneKey} & ThemeProps>(
|
|
44
|
-
rootStyles,
|
|
45
|
-
)
|
|
46
|
-
|
|
47
40
|
/**
|
|
48
41
|
* The `Toast` component gives feedback to users when an action has taken place.
|
|
49
42
|
*
|
|
@@ -52,26 +45,48 @@ const Root = styled(Card)<{$duration?: number; tone: ThemeColorStateToneKey} & T
|
|
|
52
45
|
* @public
|
|
53
46
|
*/
|
|
54
47
|
export function Toast(
|
|
55
|
-
props: ToastProps &
|
|
48
|
+
props: ToastProps &
|
|
49
|
+
Omit<
|
|
50
|
+
React.HTMLProps<HTMLDivElement>,
|
|
51
|
+
'as' | 'height' | 'ref' | 'rows' | 'title' | 'width' | 'wrap'
|
|
52
|
+
>,
|
|
56
53
|
): React.ReactElement {
|
|
57
|
-
const {
|
|
54
|
+
const {
|
|
55
|
+
closable,
|
|
56
|
+
description,
|
|
57
|
+
duration, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
58
|
+
onClose,
|
|
59
|
+
radius = 3,
|
|
60
|
+
title,
|
|
61
|
+
status,
|
|
62
|
+
...restProps
|
|
63
|
+
} = props
|
|
64
|
+
|
|
58
65
|
const cardTone = status ? STATUS_CARD_TONE[status] : 'default'
|
|
59
66
|
const buttonTone = status ? BUTTON_TONE[status] : 'default'
|
|
60
67
|
const role = status ? ROLES[status] : 'status'
|
|
61
68
|
|
|
62
69
|
return (
|
|
63
|
-
<
|
|
70
|
+
<Card
|
|
71
|
+
// root
|
|
64
72
|
data-ui="Toast"
|
|
65
73
|
role={role}
|
|
66
74
|
{...restProps}
|
|
67
75
|
marginTop={3}
|
|
76
|
+
pointerEvents="auto"
|
|
68
77
|
radius={radius}
|
|
69
78
|
shadow={2}
|
|
70
79
|
tone={cardTone}
|
|
71
|
-
|
|
80
|
+
// todo
|
|
81
|
+
// $duration={duration}
|
|
72
82
|
>
|
|
73
83
|
<Flex align="flex-start">
|
|
74
|
-
<
|
|
84
|
+
<Box
|
|
85
|
+
// text-box
|
|
86
|
+
flex={1}
|
|
87
|
+
overflowX="auto"
|
|
88
|
+
padding={3}
|
|
89
|
+
>
|
|
75
90
|
<Stack space={3}>
|
|
76
91
|
{title && (
|
|
77
92
|
<Text size={1} weight="medium">
|
|
@@ -84,7 +99,7 @@ export function Toast(
|
|
|
84
99
|
</Text>
|
|
85
100
|
)}
|
|
86
101
|
</Stack>
|
|
87
|
-
</
|
|
102
|
+
</Box>
|
|
88
103
|
|
|
89
104
|
{closable && (
|
|
90
105
|
<Box padding={1}>
|
|
@@ -100,7 +115,7 @@ export function Toast(
|
|
|
100
115
|
</Box>
|
|
101
116
|
)}
|
|
102
117
|
</Flex>
|
|
103
|
-
</
|
|
118
|
+
</Card>
|
|
104
119
|
)
|
|
105
120
|
}
|
|
106
121
|
|