@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,12 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
avatar,
|
|
3
|
+
avatarArrow,
|
|
4
|
+
avatarBgStroke,
|
|
5
|
+
avatarImage,
|
|
6
|
+
avatarInitials,
|
|
7
|
+
avatarStroke,
|
|
8
|
+
composeClassNames,
|
|
9
|
+
} from '@sanity/ui/css'
|
|
1
10
|
import {ThemeColorAvatarColorKey} from '@sanity/ui/theme'
|
|
2
11
|
import {forwardRef, useCallback, useEffect, useId, useMemo, useState} from 'react'
|
|
3
12
|
import ReactIs from 'react-is'
|
|
4
|
-
import {styled} from 'styled-components'
|
|
5
13
|
import {useArrayProp} from '../../hooks'
|
|
6
14
|
import {useTheme_v2} from '../../theme'
|
|
7
15
|
import {AvatarPosition, AvatarSize, AvatarStatus} from '../../types'
|
|
8
16
|
import {Label} from '../label'
|
|
9
|
-
import {avatarStyle, responsiveAvatarSizeStyle} from './styles'
|
|
10
17
|
|
|
11
18
|
/**
|
|
12
19
|
* @public
|
|
@@ -30,25 +37,6 @@ export interface AvatarProps {
|
|
|
30
37
|
title?: string
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
const Root = styled.div<{$color: ThemeColorAvatarColorKey; $size: AvatarSize[]}>(
|
|
34
|
-
responsiveAvatarSizeStyle,
|
|
35
|
-
avatarStyle.root,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
const Arrow = styled.div(avatarStyle.arrow)
|
|
39
|
-
|
|
40
|
-
const BgStroke = styled.ellipse(avatarStyle.bgStroke)
|
|
41
|
-
|
|
42
|
-
const Stroke = styled.ellipse(avatarStyle.stroke)
|
|
43
|
-
|
|
44
|
-
const Initials = styled.div(avatarStyle.initials)
|
|
45
|
-
|
|
46
|
-
const InitialsLabel = styled(Label)({
|
|
47
|
-
color: 'inherit',
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
const Image = styled.svg(avatarStyle.image)
|
|
51
|
-
|
|
52
40
|
/**
|
|
53
41
|
* Avatars are used to represent people and other agents (e.g. bots).
|
|
54
42
|
*
|
|
@@ -61,6 +49,7 @@ export const Avatar = forwardRef(function Avatar(
|
|
|
61
49
|
const {
|
|
62
50
|
__unstable_hideInnerStroke,
|
|
63
51
|
as: asProp,
|
|
52
|
+
className,
|
|
64
53
|
color = 'gray',
|
|
65
54
|
src,
|
|
66
55
|
title,
|
|
@@ -72,12 +61,12 @@ export const Avatar = forwardRef(function Avatar(
|
|
|
72
61
|
size: sizeProp = 1,
|
|
73
62
|
...restProps
|
|
74
63
|
} = props
|
|
75
|
-
const {avatar} = useTheme_v2()
|
|
76
|
-
const
|
|
64
|
+
const {avatar: avatarTheme} = useTheme_v2()
|
|
65
|
+
const As = ReactIs.isValidElementType(asProp) ? asProp : 'div'
|
|
77
66
|
const size = useArrayProp(sizeProp)
|
|
78
67
|
|
|
79
68
|
// @todo: remove this
|
|
80
|
-
const avatarSize =
|
|
69
|
+
const avatarSize = avatarTheme.sizes[size[0]] || avatarTheme.sizes[0]
|
|
81
70
|
const _sizeRem = avatarSize.size
|
|
82
71
|
const _radius = _sizeRem / 2
|
|
83
72
|
|
|
@@ -124,30 +113,37 @@ export const Avatar = forwardRef(function Avatar(
|
|
|
124
113
|
)
|
|
125
114
|
|
|
126
115
|
return (
|
|
127
|
-
<
|
|
128
|
-
as={
|
|
129
|
-
data-as={typeof as === 'string' ? as : undefined}
|
|
116
|
+
<As
|
|
117
|
+
data-as={typeof As === 'string' ? As : undefined}
|
|
130
118
|
data-ui="Avatar"
|
|
131
119
|
{...restProps}
|
|
132
120
|
$color={color}
|
|
133
121
|
$size={size}
|
|
134
122
|
aria-label={title}
|
|
135
|
-
|
|
123
|
+
className={composeClassNames(
|
|
124
|
+
className,
|
|
125
|
+
avatar({
|
|
126
|
+
arrowPosition,
|
|
127
|
+
color,
|
|
128
|
+
size: sizeProp,
|
|
129
|
+
}),
|
|
130
|
+
)}
|
|
131
|
+
// data-arrow-position={arrowPosition}
|
|
136
132
|
data-status={status}
|
|
137
133
|
ref={ref}
|
|
138
134
|
title={title}
|
|
139
135
|
>
|
|
140
|
-
<
|
|
136
|
+
<span className={avatarArrow()}>
|
|
141
137
|
<svg width="11" height="7" viewBox="0 0 11 7" fill="none">
|
|
142
138
|
<path
|
|
143
139
|
d="M6.67948 1.50115L11 7L0 7L4.32052 1.50115C4.92109 0.736796 6.07891 0.736795 6.67948 1.50115Z"
|
|
144
140
|
fill={color}
|
|
145
141
|
/>
|
|
146
142
|
</svg>
|
|
147
|
-
</
|
|
143
|
+
</span>
|
|
148
144
|
|
|
149
145
|
{!imageFailed && src && (
|
|
150
|
-
<
|
|
146
|
+
<svg className={avatarImage()} viewBox={`0 0 ${_sizeRem} ${_sizeRem}`} fill="none">
|
|
151
147
|
<defs>
|
|
152
148
|
<pattern id={imageId} patternContentUnits="objectBoundingBox" width="1" height="1">
|
|
153
149
|
<image
|
|
@@ -163,7 +159,8 @@ export const Avatar = forwardRef(function Avatar(
|
|
|
163
159
|
<circle cx={_radius} cy={_radius} r={_radius} fill={`url(#${imageId})`} />
|
|
164
160
|
|
|
165
161
|
{!__unstable_hideInnerStroke && (
|
|
166
|
-
<
|
|
162
|
+
<ellipse
|
|
163
|
+
className={avatarBgStroke()}
|
|
167
164
|
cx={_radius}
|
|
168
165
|
cy={_radius}
|
|
169
166
|
rx={_radius}
|
|
@@ -172,26 +169,28 @@ export const Avatar = forwardRef(function Avatar(
|
|
|
172
169
|
/>
|
|
173
170
|
)}
|
|
174
171
|
|
|
175
|
-
<
|
|
172
|
+
<ellipse
|
|
173
|
+
className={avatarStroke()}
|
|
176
174
|
cx={_radius}
|
|
177
175
|
cy={_radius}
|
|
178
176
|
rx={_radius}
|
|
179
177
|
ry={_radius}
|
|
180
178
|
vectorEffect="non-scaling-stroke"
|
|
181
179
|
/>
|
|
182
|
-
</
|
|
180
|
+
</svg>
|
|
183
181
|
)}
|
|
184
182
|
|
|
185
183
|
{(imageFailed || !src) && initials && (
|
|
186
184
|
<>
|
|
187
|
-
<
|
|
188
|
-
<
|
|
185
|
+
<span className={avatarInitials()}>
|
|
186
|
+
<Label as="span" size={initialsSize} style={{color: 'inherit'}} weight="medium">
|
|
189
187
|
{initials}
|
|
190
|
-
</
|
|
191
|
-
</
|
|
188
|
+
</Label>
|
|
189
|
+
</span>
|
|
192
190
|
</>
|
|
193
191
|
)}
|
|
194
|
-
</
|
|
192
|
+
</As>
|
|
195
193
|
)
|
|
196
194
|
})
|
|
195
|
+
|
|
197
196
|
Avatar.displayName = 'ForwardRef(Avatar)'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {getTheme_v2} from '@sanity/ui/theme'
|
|
2
2
|
import {forwardRef, useMemo} from 'react'
|
|
3
|
-
import {
|
|
3
|
+
import {rem, _responsive, ThemeProps} from '../../_compat'
|
|
4
4
|
import {EMPTY_RECORD} from '../../constants'
|
|
5
5
|
import {useArrayProp} from '../../hooks'
|
|
6
|
-
import {
|
|
6
|
+
import {styled, css} from '../../lib/styled'
|
|
7
7
|
import {AvatarSize} from '../../types'
|
|
8
8
|
import {Label} from '../label'
|
|
9
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {getTheme_v2} from '@sanity/ui/theme'
|
|
2
2
|
import {Children, cloneElement, forwardRef, isValidElement, useMemo} from 'react'
|
|
3
|
-
import {
|
|
3
|
+
import {rem, _responsive, ThemeProps} from '../../_compat'
|
|
4
4
|
import {EMPTY_RECORD} from '../../constants'
|
|
5
5
|
import {useArrayProp} from '../../hooks'
|
|
6
|
-
import {
|
|
6
|
+
import {styled, css} from '../../lib/styled'
|
|
7
7
|
import {AvatarSize} from '../../types'
|
|
8
8
|
import {AvatarCounter} from './avatarCounter'
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
|
|
2
|
-
import {rem, _responsive, ThemeProps} from '../../
|
|
3
|
-
import {focusRingStyle} from '../../styles/internal'
|
|
2
|
+
import {rem, _responsive, ThemeProps} from '../../_compat'
|
|
3
|
+
import {focusRingStyle} from '../../_compat/styles/internal'
|
|
4
4
|
import {AvatarRootStyleProps, ResponsiveAvatarSizeStyleProps} from './types'
|
|
5
5
|
|
|
6
6
|
export const avatarStyle = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {Badge, Flex
|
|
1
|
+
import {Badge, Flex} from '@sanity/ui'
|
|
2
|
+
import {THEME_COLOR_STATE_TONES} from '@sanity/ui/theme'
|
|
2
3
|
import {useSelect} from '@sanity/ui-workshop'
|
|
3
4
|
import {WORKSHOP_BADGE_MODE_OPTIONS} from '../../../__workshop__/constants'
|
|
4
5
|
|
|
@@ -7,21 +8,13 @@ export default function Tones() {
|
|
|
7
8
|
|
|
8
9
|
return (
|
|
9
10
|
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</Badge>
|
|
18
|
-
<Badge mode={mode} tone="caution">
|
|
19
|
-
Caution
|
|
20
|
-
</Badge>
|
|
21
|
-
<Badge mode={mode} tone="critical">
|
|
22
|
-
Critical
|
|
23
|
-
</Badge>
|
|
24
|
-
</Inline>
|
|
11
|
+
<Flex align="center" direction="column" gap={2}>
|
|
12
|
+
{THEME_COLOR_STATE_TONES.map((tone) => (
|
|
13
|
+
<Badge key={tone} mode={mode} tone={tone}>
|
|
14
|
+
{tone}
|
|
15
|
+
</Badge>
|
|
16
|
+
))}
|
|
17
|
+
</Flex>
|
|
25
18
|
</Flex>
|
|
26
19
|
)
|
|
27
20
|
}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {useArrayProp} from '../../hooks'
|
|
4
|
-
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
1
|
+
import {badge, composeClassNames, RadiusStyleProps} from '@sanity/ui/css'
|
|
2
|
+
import {ForwardedRef, forwardRef} from 'react'
|
|
5
3
|
import {BadgeMode, BadgeTone} from '../../types'
|
|
6
4
|
import {Box, BoxProps} from '../box'
|
|
7
5
|
import {Text} from '../text'
|
|
8
|
-
import {ResponsiveRadiusProps} from '../types'
|
|
9
|
-
import {badgeStyle} from './styles'
|
|
10
|
-
import {BadgeStyleProps} from './types'
|
|
11
6
|
|
|
12
7
|
/**
|
|
13
8
|
* @public
|
|
14
9
|
*/
|
|
15
|
-
export interface BadgeProps extends BoxProps,
|
|
10
|
+
export interface BadgeProps extends BoxProps, RadiusStyleProps {
|
|
16
11
|
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
17
12
|
fontSize?: number | number[]
|
|
18
13
|
/** @deprecated No longer used. */
|
|
@@ -20,11 +15,6 @@ export interface BadgeProps extends BoxProps, ResponsiveRadiusProps {
|
|
|
20
15
|
tone?: BadgeTone
|
|
21
16
|
}
|
|
22
17
|
|
|
23
|
-
const Root = styled(Box)<BadgeStyleProps & ResponsiveRadiusStyleProps>(
|
|
24
|
-
responsiveRadiusStyle,
|
|
25
|
-
badgeStyle,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
18
|
/**
|
|
29
19
|
* Badges are used to tag resources.
|
|
30
20
|
*
|
|
@@ -32,30 +22,38 @@ const Root = styled(Box)<BadgeStyleProps & ResponsiveRadiusStyleProps>(
|
|
|
32
22
|
*/
|
|
33
23
|
export const Badge = forwardRef(function Badge(
|
|
34
24
|
props: BadgeProps & React.HTMLProps<HTMLDivElement>,
|
|
35
|
-
ref
|
|
25
|
+
ref: ForwardedRef<HTMLDivElement>,
|
|
36
26
|
) {
|
|
37
27
|
const {
|
|
38
28
|
children,
|
|
29
|
+
className,
|
|
30
|
+
display = 'inline-block',
|
|
39
31
|
fontSize = 1,
|
|
40
32
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41
33
|
mode: _deprecated_mode,
|
|
42
34
|
padding = 1,
|
|
43
|
-
radius =
|
|
35
|
+
radius = 2,
|
|
44
36
|
tone = 'default',
|
|
45
37
|
...restProps
|
|
46
38
|
} = props
|
|
47
39
|
|
|
48
40
|
return (
|
|
49
|
-
<
|
|
41
|
+
<Box
|
|
50
42
|
data-ui="Badge"
|
|
51
43
|
{...restProps}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
className={composeClassNames(
|
|
45
|
+
className,
|
|
46
|
+
badge({
|
|
47
|
+
radius,
|
|
48
|
+
tone,
|
|
49
|
+
}),
|
|
50
|
+
)}
|
|
51
|
+
display={display}
|
|
52
|
+
padding={padding}
|
|
55
53
|
ref={ref}
|
|
56
54
|
>
|
|
57
55
|
<Text size={fontSize}>{children}</Text>
|
|
58
|
-
</
|
|
56
|
+
</Box>
|
|
59
57
|
)
|
|
60
58
|
})
|
|
61
59
|
Badge.displayName = 'ForwardRef(Badge)'
|
|
@@ -1,55 +1,15 @@
|
|
|
1
|
+
import {box, BoxStyleProps, composeClassNames, PositionStyleProps} from '@sanity/ui/css'
|
|
2
|
+
import {GapStyleProps} from '@sanity/ui/css'
|
|
1
3
|
import {forwardRef} from 'react'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
3
|
-
import {useArrayProp} from '../../hooks'
|
|
4
|
-
import {
|
|
5
|
-
boxStyle,
|
|
6
|
-
flexItemStyle,
|
|
7
|
-
FlexItemStyleProps,
|
|
8
|
-
responsiveBoxStyle,
|
|
9
|
-
ResponsiveBoxStyleProps,
|
|
10
|
-
responsiveGridItemStyle,
|
|
11
|
-
ResponsiveGridItemStyleProps,
|
|
12
|
-
responsivePaddingStyle,
|
|
13
|
-
ResponsivePaddingStyleProps,
|
|
14
|
-
responsiveMarginStyle,
|
|
15
|
-
ResponsiveMarginStyleProps,
|
|
16
|
-
} from '../../styles/internal'
|
|
17
|
-
import {
|
|
18
|
-
ResponsiveBoxProps,
|
|
19
|
-
ResponsiveFlexItemProps,
|
|
20
|
-
ResponsiveGridItemProps,
|
|
21
|
-
ResponsiveMarginProps,
|
|
22
|
-
ResponsivePaddingProps,
|
|
23
|
-
} from '../types'
|
|
24
4
|
|
|
25
5
|
/**
|
|
26
6
|
* @public
|
|
27
7
|
*/
|
|
28
|
-
export interface BoxProps
|
|
29
|
-
extends ResponsiveFlexItemProps,
|
|
30
|
-
ResponsiveBoxProps,
|
|
31
|
-
ResponsiveGridItemProps,
|
|
32
|
-
ResponsiveMarginProps,
|
|
33
|
-
ResponsivePaddingProps {
|
|
8
|
+
export interface BoxProps extends BoxStyleProps, GapStyleProps, PositionStyleProps {
|
|
34
9
|
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
35
10
|
forwardedAs?: React.ElementType | keyof JSX.IntrinsicElements
|
|
36
11
|
}
|
|
37
12
|
|
|
38
|
-
const Root = styled.div<
|
|
39
|
-
FlexItemStyleProps &
|
|
40
|
-
ResponsiveBoxStyleProps &
|
|
41
|
-
ResponsiveGridItemStyleProps &
|
|
42
|
-
ResponsiveMarginStyleProps &
|
|
43
|
-
ResponsivePaddingStyleProps
|
|
44
|
-
>(
|
|
45
|
-
boxStyle,
|
|
46
|
-
flexItemStyle,
|
|
47
|
-
responsiveBoxStyle,
|
|
48
|
-
responsiveGridItemStyle,
|
|
49
|
-
responsiveMarginStyle,
|
|
50
|
-
responsivePaddingStyle,
|
|
51
|
-
)
|
|
52
|
-
|
|
53
13
|
/**
|
|
54
14
|
* The `Box` component is a basic layout wrapper component which provides utility properties
|
|
55
15
|
* for flex, margins and padding.
|
|
@@ -57,17 +17,26 @@ const Root = styled.div<
|
|
|
57
17
|
* @public
|
|
58
18
|
*/
|
|
59
19
|
export const Box = forwardRef(function Box(
|
|
60
|
-
props: BoxProps &
|
|
20
|
+
props: BoxProps &
|
|
21
|
+
Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'rows' | 'wrap' | 'width'>,
|
|
61
22
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
62
23
|
) {
|
|
63
24
|
const {
|
|
64
|
-
|
|
25
|
+
align,
|
|
26
|
+
as: As = 'div',
|
|
27
|
+
className,
|
|
65
28
|
column,
|
|
66
29
|
columnStart,
|
|
67
30
|
columnEnd,
|
|
31
|
+
direction,
|
|
68
32
|
display = 'block',
|
|
69
33
|
flex,
|
|
34
|
+
gap,
|
|
35
|
+
gapX,
|
|
36
|
+
gapY,
|
|
70
37
|
height,
|
|
38
|
+
inset,
|
|
39
|
+
justify,
|
|
71
40
|
margin = 0,
|
|
72
41
|
marginX,
|
|
73
42
|
marginY,
|
|
@@ -75,6 +44,7 @@ export const Box = forwardRef(function Box(
|
|
|
75
44
|
marginRight,
|
|
76
45
|
marginBottom,
|
|
77
46
|
marginLeft,
|
|
47
|
+
maxWidth,
|
|
78
48
|
overflow,
|
|
79
49
|
padding = 0,
|
|
80
50
|
paddingX,
|
|
@@ -83,48 +53,69 @@ export const Box = forwardRef(function Box(
|
|
|
83
53
|
paddingRight,
|
|
84
54
|
paddingBottom,
|
|
85
55
|
paddingLeft,
|
|
56
|
+
pointerEvents,
|
|
57
|
+
position,
|
|
86
58
|
row,
|
|
87
59
|
rowStart,
|
|
88
60
|
rowEnd,
|
|
89
61
|
sizing,
|
|
62
|
+
width,
|
|
63
|
+
wrap,
|
|
90
64
|
...restProps
|
|
91
65
|
} = props
|
|
92
66
|
|
|
93
67
|
return (
|
|
94
|
-
<
|
|
95
|
-
data-as={typeof
|
|
68
|
+
<As
|
|
69
|
+
data-as={typeof As === 'string' ? As : undefined}
|
|
96
70
|
data-ui="Box"
|
|
97
71
|
{...restProps}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
72
|
+
className={composeClassNames(
|
|
73
|
+
className,
|
|
74
|
+
box({
|
|
75
|
+
align,
|
|
76
|
+
column,
|
|
77
|
+
columnStart,
|
|
78
|
+
columnEnd,
|
|
79
|
+
direction,
|
|
80
|
+
display,
|
|
81
|
+
flex,
|
|
82
|
+
gap,
|
|
83
|
+
gapX,
|
|
84
|
+
gapY,
|
|
85
|
+
height,
|
|
86
|
+
inset,
|
|
87
|
+
justify,
|
|
88
|
+
overflow,
|
|
89
|
+
margin,
|
|
90
|
+
marginX,
|
|
91
|
+
marginY,
|
|
92
|
+
marginTop,
|
|
93
|
+
marginRight,
|
|
94
|
+
marginBottom,
|
|
95
|
+
marginLeft,
|
|
96
|
+
maxWidth,
|
|
97
|
+
padding,
|
|
98
|
+
paddingX,
|
|
99
|
+
paddingY,
|
|
100
|
+
paddingTop,
|
|
101
|
+
paddingRight,
|
|
102
|
+
paddingBottom,
|
|
103
|
+
paddingLeft,
|
|
104
|
+
pointerEvents,
|
|
105
|
+
position,
|
|
106
|
+
row,
|
|
107
|
+
rowStart,
|
|
108
|
+
rowEnd,
|
|
109
|
+
sizing,
|
|
110
|
+
width,
|
|
111
|
+
wrap,
|
|
112
|
+
}),
|
|
113
|
+
)}
|
|
124
114
|
ref={ref}
|
|
125
115
|
>
|
|
126
116
|
{props.children}
|
|
127
|
-
</
|
|
117
|
+
</As>
|
|
128
118
|
)
|
|
129
119
|
})
|
|
120
|
+
|
|
130
121
|
Box.displayName = 'ForwardRef(Box)'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {icons} from '@sanity/icons'
|
|
2
2
|
import {Button, Flex} from '@sanity/ui'
|
|
3
|
+
import {FontTextSize} from '@sanity/ui/theme'
|
|
3
4
|
import {useAction, useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
4
5
|
import {
|
|
5
6
|
WORKSHOP_BUTTON_MODE_OPTIONS,
|
|
@@ -13,10 +14,11 @@ import {
|
|
|
13
14
|
|
|
14
15
|
export default function ButtonStory() {
|
|
15
16
|
const disabled = useBoolean('Disabled', false, 'Props')
|
|
16
|
-
const fontSize = useSelect('Font size', WORKSHOP_TEXT_SIZE_OPTIONS,
|
|
17
|
+
const fontSize = useSelect('Font size', WORKSHOP_TEXT_SIZE_OPTIONS, 2, 'Props')
|
|
17
18
|
const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'add-circle', 'Props')
|
|
18
19
|
const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS, '', 'Props')
|
|
19
20
|
const justify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS, 'center', 'Props')
|
|
21
|
+
const loading = useBoolean('Loading', false, 'Props')
|
|
20
22
|
const mode = useSelect('Mode', WORKSHOP_BUTTON_MODE_OPTIONS, 'default', 'Props')
|
|
21
23
|
const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
22
24
|
const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
@@ -31,10 +33,11 @@ export default function ButtonStory() {
|
|
|
31
33
|
<Flex align="center" height="fill" justify="center">
|
|
32
34
|
<Button
|
|
33
35
|
disabled={disabled}
|
|
34
|
-
fontSize={fontSize}
|
|
36
|
+
fontSize={fontSize as FontTextSize}
|
|
35
37
|
icon={icon && icons[icon]}
|
|
36
38
|
iconRight={iconRight && icons[iconRight]}
|
|
37
39
|
justify={justify}
|
|
40
|
+
loading={loading}
|
|
38
41
|
mode={mode}
|
|
39
42
|
onClick={useAction('onClick')}
|
|
40
43
|
paddingX={paddingX}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {icons} from '@sanity/icons'
|
|
2
2
|
import {Box, Button, Card, Container, Flex, Stack} from '@sanity/ui'
|
|
3
|
+
import {FontTextSize} from '@sanity/ui/theme'
|
|
3
4
|
import {useAction, useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
4
5
|
import {
|
|
5
6
|
WORKSHOP_BUTTON_MODE_OPTIONS,
|
|
@@ -33,7 +34,7 @@ export default function StackedStory() {
|
|
|
33
34
|
{tones.map(([title, tone]) => (
|
|
34
35
|
<Button
|
|
35
36
|
disabled={disabled}
|
|
36
|
-
fontSize={fontSize}
|
|
37
|
+
fontSize={fontSize as FontTextSize}
|
|
37
38
|
icon={icon && icons[icon]}
|
|
38
39
|
iconRight={iconRight && icons[iconRight]}
|
|
39
40
|
justify={justify}
|