@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
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import {THEME_COLOR_AVATAR_COLORS} from '@sanity/ui/theme'
|
|
2
|
+
import {responsiveRules} from '../../responsiveRules'
|
|
3
|
+
import {Rules} from '../../types'
|
|
4
|
+
|
|
5
|
+
export const avatarRules: Rules = {
|
|
6
|
+
'avatar': {
|
|
7
|
+
'backgroundColor': 'var(--avatar-bg-color)',
|
|
8
|
+
'position': 'relative',
|
|
9
|
+
'boxSizing': 'border-box',
|
|
10
|
+
'userSelect': 'none',
|
|
11
|
+
'boxShadow': '0 0 0 1px var(--card-bg-color)',
|
|
12
|
+
|
|
13
|
+
'@nest': {
|
|
14
|
+
'&[data-status="inactive"]': {
|
|
15
|
+
opacity: 0.5,
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
'& > svg:not([hidden])': {
|
|
19
|
+
display: 'block',
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
/* &:is(button) */
|
|
23
|
+
'&[data-as="button"]': {
|
|
24
|
+
WebkitFontSmoothing: 'inherit',
|
|
25
|
+
appearance: 'none',
|
|
26
|
+
margin: 0,
|
|
27
|
+
padding: 0,
|
|
28
|
+
border: 0,
|
|
29
|
+
font: 'inherit',
|
|
30
|
+
color: 'inherit',
|
|
31
|
+
outline: 'none',
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
'&[data-as="button"]:focus': {
|
|
35
|
+
// boxShadow: focusRingStyle({focusRing: avatar.focusRing}),
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
'&[data-as="button"]:focus:not(:focus-visible)': {
|
|
39
|
+
boxShadow: 'none',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
...THEME_COLOR_AVATAR_COLORS.reduce((acc, color) => {
|
|
45
|
+
return {
|
|
46
|
+
...acc,
|
|
47
|
+
[`avatar-${color}`]: {
|
|
48
|
+
'--avatar-bg-color': `var(--card-avatar-${color}-bg-color)`,
|
|
49
|
+
'--avatar-fg-color': `var(--card-avatar-${color}-fg-color)`,
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
}, {} as Rules),
|
|
53
|
+
|
|
54
|
+
'avatar-arrow': {
|
|
55
|
+
'position': 'absolute',
|
|
56
|
+
'boxSizing': 'border-box',
|
|
57
|
+
'zIndex': 0,
|
|
58
|
+
'opacity': 0,
|
|
59
|
+
'transition': 'all 0.2s linear',
|
|
60
|
+
'transform': 'rotate(-90deg) translate3d(0, 6px, 0)',
|
|
61
|
+
'left': 0,
|
|
62
|
+
'right': 0,
|
|
63
|
+
'top': 0,
|
|
64
|
+
'bottom': 0,
|
|
65
|
+
|
|
66
|
+
'@nest': {
|
|
67
|
+
'& > svg': {
|
|
68
|
+
width: '11px',
|
|
69
|
+
height: '7px',
|
|
70
|
+
position: 'absolute',
|
|
71
|
+
top: '-5px',
|
|
72
|
+
left: '50%',
|
|
73
|
+
transform: 'translateX(-6px)',
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
'& > svg:not([hidden])': {
|
|
77
|
+
display: 'block',
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
'.arrow-position-inside > &': {
|
|
81
|
+
transform: 'rotate(-90deg) translate3d(0, 6px, 0)',
|
|
82
|
+
opacity: 0,
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
'.arrow-position-top > &': {
|
|
86
|
+
opacity: 1,
|
|
87
|
+
transform: 'rotate(0deg)',
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
'.arrow-position-bottom > &': {
|
|
91
|
+
opacity: 1,
|
|
92
|
+
transform: 'rotate(-180deg)',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
...responsiveRules('avatar-0', {
|
|
98
|
+
'width': `var(--avatar-0-size)`,
|
|
99
|
+
'height': `var(--avatar-0-size)`,
|
|
100
|
+
'borderRadius': `var(--avatar-0-size)`,
|
|
101
|
+
|
|
102
|
+
'@nest': {
|
|
103
|
+
'& > svg': {
|
|
104
|
+
width: `var(--avatar-0-size)`,
|
|
105
|
+
height: `var(--avatar-0-size)`,
|
|
106
|
+
borderRadius: `var(--avatar-0-size)`,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
110
|
+
|
|
111
|
+
...responsiveRules('avatar-1', {
|
|
112
|
+
'width': `var(--avatar-1-size)`,
|
|
113
|
+
'height': `var(--avatar-1-size)`,
|
|
114
|
+
'borderRadius': `var(--avatar-1-size)`,
|
|
115
|
+
|
|
116
|
+
'@nest': {
|
|
117
|
+
'& > svg': {
|
|
118
|
+
width: `var(--avatar-1-size)`,
|
|
119
|
+
height: `var(--avatar-1-size)`,
|
|
120
|
+
borderRadius: `var(--avatar-1-size)`,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
|
|
125
|
+
...responsiveRules('avatar-2', {
|
|
126
|
+
'width': `var(--avatar-2-size)`,
|
|
127
|
+
'height': `var(--avatar-2-size)`,
|
|
128
|
+
'borderRadius': `var(--avatar-2-size)`,
|
|
129
|
+
|
|
130
|
+
'@nest': {
|
|
131
|
+
'& > svg': {
|
|
132
|
+
width: `var(--avatar-2-size)`,
|
|
133
|
+
height: `var(--avatar-2-size)`,
|
|
134
|
+
borderRadius: `var(--avatar-2-size)`,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
}),
|
|
138
|
+
|
|
139
|
+
...responsiveRules('avatar-3', {
|
|
140
|
+
'width': `var(--avatar-3-size)`,
|
|
141
|
+
'height': `var(--avatar-3-size)`,
|
|
142
|
+
'borderRadius': `var(--avatar-3-size)`,
|
|
143
|
+
|
|
144
|
+
'@nest': {
|
|
145
|
+
'& > svg': {
|
|
146
|
+
width: `var(--avatar-3-size)`,
|
|
147
|
+
height: `var(--avatar-3-size)`,
|
|
148
|
+
borderRadius: `var(--avatar-3-size)`,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
}),
|
|
152
|
+
|
|
153
|
+
'avatar-initials': {
|
|
154
|
+
'width': '100%',
|
|
155
|
+
'height': '100%',
|
|
156
|
+
'color': 'var(--avatar-fg-color)',
|
|
157
|
+
'alignItems': 'center',
|
|
158
|
+
'justifyContent': 'center',
|
|
159
|
+
'textTransform': 'uppercase',
|
|
160
|
+
'textAlign': 'center',
|
|
161
|
+
'borderRadius': '50%',
|
|
162
|
+
|
|
163
|
+
'@nest': {
|
|
164
|
+
'&:not([hidden])': {
|
|
165
|
+
display: 'flex',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
'avatar-bg-stroke': {
|
|
171
|
+
strokeWidth: '4px',
|
|
172
|
+
stroke: 'var(--card-bg-color)',
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
'avatar-stroke': {
|
|
176
|
+
'strokeWidth': '2px',
|
|
177
|
+
'stroke': 'var(--avatar-bg-color)',
|
|
178
|
+
|
|
179
|
+
'@nest': {
|
|
180
|
+
'[data-status="editing"] &': {
|
|
181
|
+
strokeDasharray: '2 4',
|
|
182
|
+
strokeLinecap: 'round',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
'avatar-image': {
|
|
188
|
+
position: 'relative',
|
|
189
|
+
},
|
|
190
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {AvatarPosition} from '@sanity/ui'
|
|
2
|
+
import {AvatarSize, ThemeColorAvatarColorKey} from '@sanity/ui/theme'
|
|
3
|
+
import {ResponsiveProp} from '../../types'
|
|
4
|
+
|
|
5
|
+
export interface AvatarStyleProps {
|
|
6
|
+
color: ThemeColorAvatarColorKey
|
|
7
|
+
size: ResponsiveProp<AvatarSize>
|
|
8
|
+
arrowPosition?: AvatarPosition
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {composeClassNames} from '../../composeClassNames'
|
|
2
|
+
import {radius} from '../../styles/radius'
|
|
3
|
+
import {BadgeStyleProps} from './types'
|
|
4
|
+
|
|
5
|
+
/** @public */
|
|
6
|
+
export function badge(props: BadgeStyleProps): string {
|
|
7
|
+
return composeClassNames('badge', props.tone && `badge-${props.tone}`, radius(props))
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {THEME_COLOR_STATE_TONES} from '@sanity/ui/theme'
|
|
2
|
+
import type {Rules} from '../../types'
|
|
3
|
+
import {varNames} from '../../varNames'
|
|
4
|
+
import {vars} from '../../vars'
|
|
5
|
+
|
|
6
|
+
export const badgeRules: Rules = {
|
|
7
|
+
badge: {
|
|
8
|
+
backgroundColor: vars.color.badge.bg,
|
|
9
|
+
color: vars.color.badge.fg,
|
|
10
|
+
verticalAlign: 'top',
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
...THEME_COLOR_STATE_TONES.reduce(
|
|
14
|
+
(acc, tone) => ({
|
|
15
|
+
...acc,
|
|
16
|
+
[`badge-${tone}`]: {
|
|
17
|
+
[varNames.color.badge.bg]: vars.color.badge[tone].bg,
|
|
18
|
+
[varNames.color.badge.dot]: vars.color.badge[tone].dot,
|
|
19
|
+
[varNames.color.badge.fg]: vars.color.badge[tone].fg,
|
|
20
|
+
[varNames.color.badge.icon]: vars.color.badge[tone].icon,
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
23
|
+
{} as Rules,
|
|
24
|
+
),
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {_resp} from '../../_resp'
|
|
2
|
+
import {composeClassNames} from '../../composeClassNames'
|
|
3
|
+
import {flex} from '../../styles/flex'
|
|
4
|
+
import {flexItem} from '../../styles/flexItem'
|
|
5
|
+
import {gap} from '../../styles/gap'
|
|
6
|
+
import {grid} from '../../styles/grid'
|
|
7
|
+
import {gridItem} from '../../styles/gridItem'
|
|
8
|
+
import {margin} from '../../styles/margin'
|
|
9
|
+
import {maxWidth} from '../../styles/maxWidth'
|
|
10
|
+
import {overflow} from '../../styles/overflow'
|
|
11
|
+
import {padding} from '../../styles/padding'
|
|
12
|
+
import {pointerEvents} from '../../styles/pointerEvents'
|
|
13
|
+
import {position} from '../../styles/position'
|
|
14
|
+
import {width} from '../../styles/width'
|
|
15
|
+
import {BoxStyleProps} from './types'
|
|
16
|
+
|
|
17
|
+
/** @public */
|
|
18
|
+
export function box(props: BoxStyleProps): string {
|
|
19
|
+
return composeClassNames(
|
|
20
|
+
'box',
|
|
21
|
+
_resp(undefined, props.display),
|
|
22
|
+
_resp(`h`, props.height),
|
|
23
|
+
_resp(`box`, props.sizing),
|
|
24
|
+
flex(props),
|
|
25
|
+
flexItem(props),
|
|
26
|
+
grid(props),
|
|
27
|
+
gridItem(props),
|
|
28
|
+
gap(props),
|
|
29
|
+
margin(props),
|
|
30
|
+
maxWidth(props),
|
|
31
|
+
props.outline && `outline-${props.outline}`,
|
|
32
|
+
overflow(props),
|
|
33
|
+
padding(props),
|
|
34
|
+
pointerEvents(props),
|
|
35
|
+
position(props),
|
|
36
|
+
width(props),
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type {Rules} from '../../types'
|
|
2
|
+
|
|
3
|
+
export const boxRules: Rules = {
|
|
4
|
+
'box': {
|
|
5
|
+
'minWidth': 0,
|
|
6
|
+
'minHeight': 0,
|
|
7
|
+
|
|
8
|
+
'@nest': {
|
|
9
|
+
// 'ul.&, ol.&': {
|
|
10
|
+
'&[data-as="ul"], &[data-as="ol"]': {
|
|
11
|
+
listStyle: 'none',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
// sizing
|
|
17
|
+
|
|
18
|
+
'box-content': {
|
|
19
|
+
boxSizing: 'content-box',
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
'box-border': {
|
|
23
|
+
boxSizing: 'border-box',
|
|
24
|
+
},
|
|
25
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {GridStyleProps} from '@sanity/ui/css'
|
|
2
|
+
import {FlexStyleProps} from '../../styles/flex'
|
|
3
|
+
import {FlexItemStyleProps} from '../../styles/flexItem'
|
|
4
|
+
import {GapStyleProps} from '../../styles/gap'
|
|
5
|
+
import {GridItemStyleProps} from '../../styles/gridItem'
|
|
6
|
+
import {MarginStyleProps} from '../../styles/margin'
|
|
7
|
+
import {MaxWidthStyleProps} from '../../styles/maxWidth'
|
|
8
|
+
import {OverflowStyleProps} from '../../styles/overflow'
|
|
9
|
+
import {PaddingStyleProps} from '../../styles/padding'
|
|
10
|
+
import {PointerEventsStyleProps} from '../../styles/pointerEvents'
|
|
11
|
+
import {PositionStyleProps} from '../../styles/position'
|
|
12
|
+
import {WidthStyleProps} from '../../styles/width'
|
|
13
|
+
import {ResponsiveProp} from '../../types'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export type BoxSizing = 'content' | 'border'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export type Display = 'none' | 'block' | 'grid' | 'flex' | 'inline-block'
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export type BoxHeight = 'stretch' | 'fill'
|
|
29
|
+
|
|
30
|
+
/** @public */
|
|
31
|
+
export interface BoxStyleProps
|
|
32
|
+
extends FlexStyleProps,
|
|
33
|
+
FlexItemStyleProps,
|
|
34
|
+
GapStyleProps,
|
|
35
|
+
GridStyleProps,
|
|
36
|
+
GridItemStyleProps,
|
|
37
|
+
MarginStyleProps,
|
|
38
|
+
MaxWidthStyleProps,
|
|
39
|
+
OverflowStyleProps,
|
|
40
|
+
PaddingStyleProps,
|
|
41
|
+
PointerEventsStyleProps,
|
|
42
|
+
PositionStyleProps,
|
|
43
|
+
WidthStyleProps {
|
|
44
|
+
display?: ResponsiveProp<Display>
|
|
45
|
+
height?: ResponsiveProp<BoxHeight>
|
|
46
|
+
outline?: 'none'
|
|
47
|
+
sizing?: ResponsiveProp<BoxSizing>
|
|
48
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {ButtonMode, ButtonTone} from '@sanity/ui'
|
|
2
|
+
import {WidthStyleProps} from '@sanity/ui/css'
|
|
3
|
+
import {composeClassNames} from '../../composeClassNames'
|
|
4
|
+
import {radius, RadiusStyleProps} from '../../styles/radius'
|
|
5
|
+
import {width} from '../../styles/width'
|
|
6
|
+
|
|
7
|
+
export interface ButtonStyleProps extends RadiusStyleProps, WidthStyleProps {
|
|
8
|
+
mode?: ButtonMode
|
|
9
|
+
tone?: ButtonTone
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function button(props: ButtonStyleProps): string {
|
|
13
|
+
const {mode = 'default', tone = 'default'} = props
|
|
14
|
+
|
|
15
|
+
return composeClassNames(
|
|
16
|
+
'button',
|
|
17
|
+
`button-mode-${mode}`,
|
|
18
|
+
`button-tone-${tone}`,
|
|
19
|
+
radius(props),
|
|
20
|
+
width(props),
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function buttonLoadingBox(): string {
|
|
25
|
+
return 'button-loading-box'
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button'
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {THEME_COLOR_BUTTON_MODES, THEME_COLOR_STATE_TONES} from '@sanity/ui/theme'
|
|
2
|
+
import {Rules} from '../../types'
|
|
3
|
+
|
|
4
|
+
export const buttonRules: Rules = {
|
|
5
|
+
'button': {
|
|
6
|
+
WebkitFontSmoothing: 'inherit',
|
|
7
|
+
appearance: 'none',
|
|
8
|
+
display: 'inline-flex',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
font: 'inherit',
|
|
11
|
+
outline: 'none',
|
|
12
|
+
userSelect: 'none',
|
|
13
|
+
textDecoration: 'none',
|
|
14
|
+
border: 0,
|
|
15
|
+
boxSizing: 'border-box',
|
|
16
|
+
padding: 0,
|
|
17
|
+
overflow: 'hidden',
|
|
18
|
+
margin: 0,
|
|
19
|
+
textAlign: 'left',
|
|
20
|
+
position: 'relative',
|
|
21
|
+
verticalAlign: 'top',
|
|
22
|
+
backgroundColor: 'var(--card-bg-color)',
|
|
23
|
+
color: 'var(--card-fg-color)',
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
// variants
|
|
27
|
+
...THEME_COLOR_BUTTON_MODES.reduce((acc, mode) => {
|
|
28
|
+
return {
|
|
29
|
+
...acc,
|
|
30
|
+
[`button-mode-${mode}`]: {
|
|
31
|
+
'@nest': THEME_COLOR_STATE_TONES.reduce((acc, tone) => {
|
|
32
|
+
return {
|
|
33
|
+
...acc,
|
|
34
|
+
[`&.button-tone-${tone}`]: {
|
|
35
|
+
'--card-bg-color': `var(--card-button-${mode}-${tone}-enabled-bg-color, rgba(127, 127, 127, 0.1))`,
|
|
36
|
+
'--card-fg-color': `var(--card-button-${mode}-${tone}-enabled-fg-color, currentColor)`,
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
}, {} as Rules),
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
}, {} as Rules),
|
|
43
|
+
|
|
44
|
+
'button-loading-box': {
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
right: 0,
|
|
49
|
+
bottom: 0,
|
|
50
|
+
// display: 'flex',
|
|
51
|
+
// alignItems: 'center',
|
|
52
|
+
// justifyContent: 'center',
|
|
53
|
+
backgroundColor: 'var(--card-bg-color)',
|
|
54
|
+
borderRadius: 'inherit',
|
|
55
|
+
zIndex: 1,
|
|
56
|
+
// boxShadow: 'inherit',
|
|
57
|
+
},
|
|
58
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {composeClassNames} from '../../composeClassNames'
|
|
2
|
+
import {border, BorderStyleProps} from '../../styles/border'
|
|
3
|
+
import {radius, RadiusStyleProps} from '../../styles/radius'
|
|
4
|
+
import {ResponsiveProp} from '../../types'
|
|
5
|
+
import {box, BoxStyleProps} from '../box'
|
|
6
|
+
|
|
7
|
+
export interface CardStyleProps extends BoxStyleProps, BorderStyleProps, RadiusStyleProps {
|
|
8
|
+
checkered?: boolean
|
|
9
|
+
shadow?: ResponsiveProp<number>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function card(props: CardStyleProps): string {
|
|
13
|
+
return composeClassNames(
|
|
14
|
+
'card',
|
|
15
|
+
props.checkered && 'card-checkered',
|
|
16
|
+
box(props),
|
|
17
|
+
border(props),
|
|
18
|
+
radius(props),
|
|
19
|
+
props.shadow === undefined ? undefined : `shadow-${props.shadow}`,
|
|
20
|
+
)
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './card'
|