@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,34 +1,34 @@
|
|
|
1
|
+
import {buttonLoadingBox, composeClassNames, ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import {button} from '@sanity/ui/css'
|
|
3
|
+
import {PaddingStyleProps, RadiusStyleProps} from '@sanity/ui/css'
|
|
4
|
+
import {Width} from '@sanity/ui/css'
|
|
5
|
+
import {FontTextSize, Space} from '@sanity/ui/theme'
|
|
1
6
|
import {forwardRef, isValidElement, useMemo} from 'react'
|
|
2
7
|
import {isValidElementType} from 'react-is'
|
|
3
|
-
import {styled} from 'styled-components'
|
|
4
8
|
import {useArrayProp} from '../../hooks'
|
|
5
|
-
import {ThemeProps} from '../../styles'
|
|
6
|
-
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
7
9
|
import {useTheme_v2} from '../../theme'
|
|
8
|
-
import {ButtonMode, ButtonTextAlign, ButtonTone,
|
|
10
|
+
import {ButtonMode, ButtonTextAlign, ButtonTone, FlexJustify} from '../../types'
|
|
9
11
|
import {Box} from '../box'
|
|
10
12
|
import {Flex} from '../flex'
|
|
11
13
|
import {Spinner} from '../spinner'
|
|
12
14
|
import {Text, TextProps} from '../text'
|
|
13
|
-
import {ResponsivePaddingProps, ResponsiveRadiusProps} from '../types'
|
|
14
|
-
import {buttonBaseStyles, buttonColorStyles} from './styles'
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
|
-
export interface ButtonProps extends
|
|
19
|
+
export interface ButtonProps extends PaddingStyleProps, RadiusStyleProps {
|
|
20
20
|
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
21
|
-
fontSize?:
|
|
21
|
+
fontSize?: ResponsiveProp<FontTextSize>
|
|
22
22
|
mode?: ButtonMode
|
|
23
23
|
icon?: React.ElementType | React.ReactNode
|
|
24
24
|
iconRight?: React.ElementType | React.ReactNode
|
|
25
|
-
justify?: FlexJustify
|
|
25
|
+
justify?: ResponsiveProp<FlexJustify>
|
|
26
26
|
/**
|
|
27
27
|
* @beta Do not use in production, as this might change.
|
|
28
28
|
*/
|
|
29
29
|
loading?: boolean
|
|
30
30
|
selected?: boolean
|
|
31
|
-
space?:
|
|
31
|
+
space?: ResponsiveProp<Space>
|
|
32
32
|
textAlign?: ButtonTextAlign
|
|
33
33
|
muted?: boolean
|
|
34
34
|
text?: React.ReactNode
|
|
@@ -36,38 +36,21 @@ export interface ButtonProps extends ResponsivePaddingProps, ResponsiveRadiusPro
|
|
|
36
36
|
textWeight?: TextProps['weight']
|
|
37
37
|
tone?: ButtonTone
|
|
38
38
|
type?: 'button' | 'reset' | 'submit'
|
|
39
|
-
width?: ButtonWidth
|
|
39
|
+
// width?: ButtonWidth
|
|
40
|
+
width?: ResponsiveProp<Width>
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
const Root = styled.button<
|
|
43
|
-
{$mode: ButtonMode; $tone: ButtonTone; $width?: ButtonWidth} & ResponsiveRadiusStyleProps &
|
|
44
|
-
ThemeProps
|
|
45
|
-
>(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles)
|
|
46
|
-
|
|
47
|
-
const LoadingBox = styled.div`
|
|
48
|
-
position: absolute;
|
|
49
|
-
top: 0;
|
|
50
|
-
left: 0;
|
|
51
|
-
right: 0;
|
|
52
|
-
bottom: 0;
|
|
53
|
-
display: flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
justify-content: center;
|
|
56
|
-
background-color: var(--card-bg-color);
|
|
57
|
-
border-radius: inherit;
|
|
58
|
-
z-index: 1;
|
|
59
|
-
box-shadow: inherit;
|
|
60
|
-
`
|
|
61
|
-
|
|
62
43
|
/**
|
|
63
44
|
* @public
|
|
64
45
|
*/
|
|
65
46
|
export const Button = forwardRef(function Button(
|
|
66
|
-
props: ButtonProps & Omit<React.HTMLProps<HTMLButtonElement>, 'as' | 'width'>,
|
|
47
|
+
props: ButtonProps & Omit<React.HTMLProps<HTMLButtonElement>, 'as' | 'width' | 'height' | 'wrap'>,
|
|
67
48
|
ref: React.ForwardedRef<HTMLButtonElement>,
|
|
68
49
|
) {
|
|
69
50
|
const {
|
|
51
|
+
as: As = 'button',
|
|
70
52
|
children,
|
|
53
|
+
className,
|
|
71
54
|
disabled,
|
|
72
55
|
fontSize = 1,
|
|
73
56
|
icon: IconComponent,
|
|
@@ -95,7 +78,7 @@ export const Button = forwardRef(function Button(
|
|
|
95
78
|
width,
|
|
96
79
|
...restProps
|
|
97
80
|
} = props
|
|
98
|
-
const {button} = useTheme_v2()
|
|
81
|
+
const {button: buttonTheme} = useTheme_v2()
|
|
99
82
|
|
|
100
83
|
const justify = useArrayProp(justifyProp)
|
|
101
84
|
const padding = useArrayProp(paddingProp)
|
|
@@ -105,7 +88,7 @@ export const Button = forwardRef(function Button(
|
|
|
105
88
|
const paddingBottom = useArrayProp(paddingBottomProp)
|
|
106
89
|
const paddingLeft = useArrayProp(paddingLeftProp)
|
|
107
90
|
const paddingRight = useArrayProp(paddingRightProp)
|
|
108
|
-
const radius = useArrayProp(radiusProp)
|
|
91
|
+
// const radius = useArrayProp(radiusProp)
|
|
109
92
|
const space = useArrayProp(spaceProp)
|
|
110
93
|
|
|
111
94
|
const boxProps = useMemo(
|
|
@@ -123,23 +106,32 @@ export const Button = forwardRef(function Button(
|
|
|
123
106
|
)
|
|
124
107
|
|
|
125
108
|
return (
|
|
126
|
-
<
|
|
109
|
+
<As
|
|
127
110
|
data-ui="Button"
|
|
128
111
|
{...restProps}
|
|
129
|
-
$mode={mode}
|
|
130
|
-
$radius={radius}
|
|
131
|
-
$tone={tone}
|
|
112
|
+
// $mode={mode}
|
|
113
|
+
// $radius={radius}
|
|
114
|
+
// $tone={tone}
|
|
115
|
+
className={composeClassNames(
|
|
116
|
+
className,
|
|
117
|
+
button({
|
|
118
|
+
mode,
|
|
119
|
+
radius: radiusProp,
|
|
120
|
+
tone,
|
|
121
|
+
width,
|
|
122
|
+
}),
|
|
123
|
+
)}
|
|
132
124
|
data-disabled={Boolean(loading || disabled)}
|
|
133
125
|
data-selected={selected ? '' : undefined}
|
|
134
126
|
disabled={Boolean(loading || disabled)}
|
|
135
127
|
ref={ref}
|
|
136
128
|
type={type}
|
|
137
|
-
$width={width}
|
|
129
|
+
// $width={width}
|
|
138
130
|
>
|
|
139
131
|
{Boolean(loading) && (
|
|
140
|
-
<
|
|
141
|
-
<Spinner />
|
|
142
|
-
</
|
|
132
|
+
<Box align="center" className={buttonLoadingBox()} display="flex" justify="center">
|
|
133
|
+
<Spinner size={fontSize} />
|
|
134
|
+
</Box>
|
|
143
135
|
)}
|
|
144
136
|
|
|
145
137
|
{(IconComponent || text || IconRightComponent) && (
|
|
@@ -153,14 +145,14 @@ export const Button = forwardRef(function Button(
|
|
|
153
145
|
)}
|
|
154
146
|
|
|
155
147
|
{text && (
|
|
156
|
-
<Box
|
|
148
|
+
<Box>
|
|
157
149
|
<Text
|
|
158
150
|
as="span"
|
|
159
151
|
muted={muted}
|
|
160
152
|
align={textAlign}
|
|
161
153
|
size={fontSize}
|
|
162
154
|
textOverflow={textOverflow}
|
|
163
|
-
weight={textWeight ??
|
|
155
|
+
weight={textWeight ?? buttonTheme.textWeight}
|
|
164
156
|
>
|
|
165
157
|
{text}
|
|
166
158
|
</Text>
|
|
@@ -182,7 +174,8 @@ export const Button = forwardRef(function Button(
|
|
|
182
174
|
{children}
|
|
183
175
|
</Box>
|
|
184
176
|
)}
|
|
185
|
-
</
|
|
177
|
+
</As>
|
|
186
178
|
)
|
|
187
179
|
})
|
|
180
|
+
|
|
188
181
|
Button.displayName = 'ForwardRef(Button)'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import {ThemeProps} from '../../_compat'
|
|
3
|
+
import {_cardColorStyle} from '../../_compat/styles/card'
|
|
4
|
+
import {focusRingBorderStyle, focusRingStyle} from '../../_compat/styles/internal'
|
|
5
|
+
import {css} from '../../lib/styled'
|
|
6
6
|
import {ButtonMode, ButtonTone, ButtonWidth} from '../../types'
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -29,8 +29,8 @@ export function buttonBaseStyles(
|
|
|
29
29
|
border: 0;
|
|
30
30
|
box-sizing: border-box;
|
|
31
31
|
padding: 0;
|
|
32
|
-
overflow: hidden;
|
|
33
32
|
margin: 0;
|
|
33
|
+
white-space: nowrap;
|
|
34
34
|
text-align: left;
|
|
35
35
|
position: relative;
|
|
36
36
|
vertical-align: top;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Card, Flex, Stack, Text} from '@sanity/ui'
|
|
1
|
+
import {Card, Flex, Radius, Stack, Text} from '@sanity/ui'
|
|
2
2
|
import {useAction, useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
3
3
|
import {
|
|
4
4
|
WORKSHOP_CARD_AS_OPTIONS,
|
|
@@ -28,7 +28,7 @@ export default function PropsStory() {
|
|
|
28
28
|
muted={muted}
|
|
29
29
|
onClick={useAction('onClick')}
|
|
30
30
|
padding={padding}
|
|
31
|
-
radius={radius}
|
|
31
|
+
radius={radius as Radius}
|
|
32
32
|
selected={selected}
|
|
33
33
|
shadow={shadow}
|
|
34
34
|
tone={tone}
|
|
@@ -1,31 +1,16 @@
|
|
|
1
|
+
import {card, CardStyleProps, composeClassNames} from '@sanity/ui/css'
|
|
1
2
|
import {ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
2
|
-
import {forwardRef} from 'react'
|
|
3
|
+
import {forwardRef, useContext} from 'react'
|
|
3
4
|
import {isValidElementType} from 'react-is'
|
|
4
|
-
import {styled} from 'styled-components'
|
|
5
|
-
import {useArrayProp} from '../../hooks'
|
|
6
|
-
import {
|
|
7
|
-
responsiveBorderStyle,
|
|
8
|
-
ResponsiveBorderStyleProps,
|
|
9
|
-
responsiveRadiusStyle,
|
|
10
|
-
ResponsiveRadiusStyleProps,
|
|
11
|
-
responsiveShadowStyle,
|
|
12
|
-
ResponsiveShadowStyleProps,
|
|
13
|
-
} from '../../styles/internal'
|
|
14
5
|
import {ThemeColorProvider, useRootTheme} from '../../theme'
|
|
15
6
|
import {CardTone} from '../../types'
|
|
16
7
|
import {Box, BoxProps} from '../box'
|
|
17
|
-
import {
|
|
18
|
-
import {cardStyle} from './styles'
|
|
19
|
-
import {CardStyleProps} from './types'
|
|
8
|
+
import {RootCardContext} from './RootCardContext'
|
|
20
9
|
|
|
21
10
|
/**
|
|
22
11
|
* @public
|
|
23
12
|
*/
|
|
24
|
-
export interface CardProps
|
|
25
|
-
extends BoxProps,
|
|
26
|
-
ResponsiveBorderProps,
|
|
27
|
-
ResponsiveRadiusProps,
|
|
28
|
-
ResponsiveShadowProps {
|
|
13
|
+
export interface CardProps extends BoxProps, CardStyleProps {
|
|
29
14
|
/**
|
|
30
15
|
* Do not use in production.
|
|
31
16
|
* @beta
|
|
@@ -42,13 +27,6 @@ export interface CardProps
|
|
|
42
27
|
tone?: CardTone
|
|
43
28
|
}
|
|
44
29
|
|
|
45
|
-
const Root = styled(Box)<
|
|
46
|
-
CardStyleProps &
|
|
47
|
-
ResponsiveRadiusStyleProps &
|
|
48
|
-
ResponsiveBorderStyleProps &
|
|
49
|
-
ResponsiveShadowStyleProps
|
|
50
|
-
>(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle)
|
|
51
|
-
|
|
52
30
|
/**
|
|
53
31
|
* The `Card` component acts much like a `Box`, but with a background and foreground color.
|
|
54
32
|
* Components within a `Card` inherit its colors.
|
|
@@ -56,7 +34,7 @@ const Root = styled(Box)<
|
|
|
56
34
|
* @public
|
|
57
35
|
*/
|
|
58
36
|
export const Card = forwardRef(function Card(
|
|
59
|
-
props: CardProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height'>,
|
|
37
|
+
props: CardProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width' | 'wrap'>,
|
|
60
38
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
61
39
|
) {
|
|
62
40
|
const {
|
|
@@ -68,48 +46,65 @@ export const Card = forwardRef(function Card(
|
|
|
68
46
|
borderRight,
|
|
69
47
|
borderBottom,
|
|
70
48
|
borderLeft,
|
|
49
|
+
className,
|
|
71
50
|
muted,
|
|
72
51
|
pressed,
|
|
73
52
|
radius = 0,
|
|
74
53
|
scheme,
|
|
75
54
|
selected,
|
|
76
55
|
shadow,
|
|
56
|
+
style,
|
|
77
57
|
tone: toneProp = 'default',
|
|
78
58
|
...restProps
|
|
79
59
|
} = props
|
|
80
60
|
|
|
81
61
|
const as = isValidElementType(asProp) ? asProp : 'div'
|
|
62
|
+
const rootCard = useContext(RootCardContext)
|
|
82
63
|
const rootTheme = useRootTheme()
|
|
64
|
+
|
|
83
65
|
const tone = toneProp === 'inherit' ? rootTheme.tone : toneProp
|
|
84
66
|
|
|
85
|
-
// todo: Consider adding the wrapper approach for nested cards in which the tones are not
|
|
86
|
-
|
|
67
|
+
// todo: Consider adding the wrapper approach for nested cards in which the tones are not
|
|
68
|
+
// changing, avoid unnecessary ThemeColorProvider
|
|
69
|
+
const node = (
|
|
87
70
|
<ThemeColorProvider scheme={scheme} tone={tone}>
|
|
88
|
-
<
|
|
71
|
+
<Box
|
|
89
72
|
data-as={typeof as === 'string' ? as : undefined}
|
|
90
73
|
data-scheme={rootTheme.scheme}
|
|
91
74
|
data-ui="Card"
|
|
92
75
|
data-tone={tone}
|
|
93
76
|
{...restProps}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
77
|
+
as={as}
|
|
78
|
+
className={composeClassNames(
|
|
79
|
+
className,
|
|
80
|
+
// rootCard ? undefined : 'root',
|
|
81
|
+
card({
|
|
82
|
+
border,
|
|
83
|
+
borderTop,
|
|
84
|
+
borderRight,
|
|
85
|
+
borderBottom,
|
|
86
|
+
borderLeft,
|
|
87
|
+
radius,
|
|
88
|
+
shadow,
|
|
89
|
+
}),
|
|
90
|
+
)}
|
|
105
91
|
data-checkered={checkered ? '' : undefined}
|
|
92
|
+
data-focus-ring={focusRing ? '' : undefined}
|
|
93
|
+
data-muted={muted ? '' : undefined}
|
|
106
94
|
data-pressed={pressed ? '' : undefined}
|
|
107
95
|
data-selected={selected ? '' : undefined}
|
|
108
|
-
forwardedAs={as}
|
|
109
96
|
ref={ref}
|
|
110
97
|
selected={selected}
|
|
98
|
+
style={style}
|
|
111
99
|
/>
|
|
112
100
|
</ThemeColorProvider>
|
|
113
101
|
)
|
|
102
|
+
|
|
103
|
+
if (!rootCard) {
|
|
104
|
+
return <RootCardContext.Provider value={{renderedVars: true}}>{node}</RootCardContext.Provider>
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return node
|
|
114
108
|
})
|
|
109
|
+
|
|
115
110
|
Card.displayName = 'ForwardRef(Card)'
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {CheckmarkIcon, RemoveIcon} from '@sanity/icons'
|
|
2
|
+
import {checkbox, checkboxInput, composeClassNames} from '@sanity/ui/css'
|
|
2
3
|
import {forwardRef, useEffect, useImperativeHandle, useRef} from 'react'
|
|
3
|
-
import {styled} from 'styled-components'
|
|
4
4
|
import {useCustomValidity} from '../../hooks'
|
|
5
|
-
import {checkboxBaseStyles, inputElementStyles} from './styles'
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @public
|
|
@@ -12,9 +11,6 @@ export interface CheckboxProps {
|
|
|
12
11
|
customValidity?: string
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
const Root = styled.div(checkboxBaseStyles)
|
|
16
|
-
const Input = styled.input(inputElementStyles)
|
|
17
|
-
|
|
18
14
|
/**
|
|
19
15
|
* Checkboxes allow the user to select one or more items from a set.
|
|
20
16
|
*
|
|
@@ -51,12 +47,13 @@ export const Checkbox = forwardRef(function Checkbox(
|
|
|
51
47
|
useCustomValidity(ref, customValidity)
|
|
52
48
|
|
|
53
49
|
return (
|
|
54
|
-
<
|
|
55
|
-
<
|
|
50
|
+
<span className={composeClassNames(className, checkbox())} data-ui="Checkbox" style={style}>
|
|
51
|
+
<input
|
|
56
52
|
data-read-only={!disabled && readOnly ? '' : undefined}
|
|
57
53
|
data-error={customValidity ? '' : undefined}
|
|
58
54
|
{...restProps}
|
|
59
55
|
checked={checked}
|
|
56
|
+
className={composeClassNames(className, checkboxInput())}
|
|
60
57
|
disabled={disabled || readOnly}
|
|
61
58
|
type="checkbox"
|
|
62
59
|
readOnly={readOnly}
|
|
@@ -66,7 +63,8 @@ export const Checkbox = forwardRef(function Checkbox(
|
|
|
66
63
|
<CheckmarkIcon />
|
|
67
64
|
<RemoveIcon />
|
|
68
65
|
</span>
|
|
69
|
-
</
|
|
66
|
+
</span>
|
|
70
67
|
)
|
|
71
68
|
})
|
|
69
|
+
|
|
72
70
|
Checkbox.displayName = 'ForwardRef(Checkbox)'
|
|
@@ -1,40 +1,49 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
import {code, composeClassNames, FontStyleProps} from '@sanity/ui/css'
|
|
2
4
|
import {forwardRef} from 'react'
|
|
3
5
|
import Refractor from 'react-refractor'
|
|
4
|
-
import {styled} from 'styled-components'
|
|
5
|
-
import {useArrayProp} from '../../hooks'
|
|
6
|
-
import {responsiveCodeFontStyle, ResponsiveFontStyleProps} from '../../styles/internal'
|
|
7
|
-
import {codeBaseStyle} from './styles'
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* @public
|
|
11
9
|
*/
|
|
12
|
-
export interface CodeProps {
|
|
10
|
+
export interface CodeProps extends Omit<FontStyleProps, 'align'> {
|
|
13
11
|
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
14
12
|
/** Define the language to use for syntax highlighting. */
|
|
15
13
|
language?: string
|
|
16
14
|
size?: number | number[]
|
|
17
|
-
weight?: string
|
|
18
15
|
}
|
|
19
16
|
|
|
20
|
-
const Root = styled.pre<ResponsiveFontStyleProps>(codeBaseStyle, responsiveCodeFontStyle)
|
|
21
|
-
|
|
22
17
|
/**
|
|
23
18
|
* @public
|
|
24
19
|
*/
|
|
25
20
|
export const Code = forwardRef(function Code(
|
|
26
|
-
props: CodeProps & Omit<React.HTMLProps<
|
|
27
|
-
ref: React.ForwardedRef<
|
|
21
|
+
props: CodeProps & Omit<React.HTMLProps<HTMLPreElement>, 'as' | 'size'>,
|
|
22
|
+
ref: React.ForwardedRef<HTMLPreElement>,
|
|
28
23
|
) {
|
|
29
|
-
const {
|
|
24
|
+
const {
|
|
25
|
+
as: As = 'pre',
|
|
26
|
+
children,
|
|
27
|
+
className,
|
|
28
|
+
language: languageProp,
|
|
29
|
+
size = 2,
|
|
30
|
+
weight,
|
|
31
|
+
...restProps
|
|
32
|
+
} = props
|
|
30
33
|
const language = typeof languageProp === 'string' ? languageProp : undefined
|
|
31
34
|
const registered = language ? Refractor.hasLanguage(language as any) : false
|
|
32
35
|
|
|
33
36
|
return (
|
|
34
|
-
<
|
|
37
|
+
<As
|
|
38
|
+
data-ui="Code"
|
|
39
|
+
{...restProps}
|
|
40
|
+
className={composeClassNames(className, code({size, weight}))}
|
|
41
|
+
ref={ref}
|
|
42
|
+
>
|
|
35
43
|
{!(language && registered) && <code>{children}</code>}
|
|
36
44
|
{language && registered && <Refractor inline language={language} value={String(children)} />}
|
|
37
|
-
</
|
|
45
|
+
</As>
|
|
38
46
|
)
|
|
39
47
|
})
|
|
48
|
+
|
|
40
49
|
Code.displayName = 'ForwardRef(Code)'
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
+
import {composeClassNames, container, ContainerStyleProps} from '@sanity/ui/css'
|
|
1
2
|
import {forwardRef} from 'react'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
3
|
-
import {useArrayProp} from '../../hooks'
|
|
4
3
|
import {Box, BoxProps} from '../box'
|
|
5
|
-
import {ResponsiveWidthProps} from '../types'
|
|
6
|
-
import {containerBaseStyle, responsiveContainerWidthStyle} from './styles'
|
|
7
|
-
import {ResponsiveWidthStyleProps} from './types'
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
6
|
* @public
|
|
11
7
|
*/
|
|
12
|
-
export interface ContainerProps extends BoxProps,
|
|
13
|
-
|
|
14
|
-
const Root = styled(Box)<ResponsiveWidthStyleProps>(
|
|
15
|
-
containerBaseStyle,
|
|
16
|
-
responsiveContainerWidthStyle,
|
|
17
|
-
)
|
|
8
|
+
export interface ContainerProps extends Omit<BoxProps, 'width'>, ContainerStyleProps {}
|
|
18
9
|
|
|
19
10
|
/**
|
|
20
11
|
* The `Container` component wraps content layout in a defined set of widths.
|
|
@@ -25,16 +16,17 @@ export const Container = forwardRef(function Container(
|
|
|
25
16
|
props: ContainerProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width'>,
|
|
26
17
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
27
18
|
) {
|
|
28
|
-
const {as, width = 2, ...restProps} = props
|
|
19
|
+
const {as, className, width = 2, ...restProps} = props
|
|
29
20
|
|
|
30
21
|
return (
|
|
31
|
-
<
|
|
22
|
+
<Box
|
|
32
23
|
data-ui="Container"
|
|
33
24
|
{...restProps}
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
as={as}
|
|
26
|
+
className={composeClassNames(className, container({width}))}
|
|
36
27
|
ref={ref}
|
|
37
28
|
/>
|
|
38
29
|
)
|
|
39
30
|
})
|
|
31
|
+
|
|
40
32
|
Container.displayName = 'ForwardRef(Container)'
|
|
@@ -1,31 +1,10 @@
|
|
|
1
1
|
import {forwardRef} from 'react'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
3
|
-
import {useArrayProp} from '../../hooks'
|
|
4
|
-
import {
|
|
5
|
-
flexItemStyle,
|
|
6
|
-
FlexItemStyleProps,
|
|
7
|
-
responsiveFlexStyle,
|
|
8
|
-
ResponsiveFlexStyleProps,
|
|
9
|
-
} from '../../styles/internal'
|
|
10
2
|
import {Box, BoxProps} from '../box'
|
|
11
|
-
import {ResponsiveFlexProps, ResponsiveFlexItemProps} from '../types'
|
|
12
3
|
|
|
13
4
|
/**
|
|
14
5
|
* @public
|
|
15
6
|
*/
|
|
16
|
-
export interface FlexProps
|
|
17
|
-
extends Omit<BoxProps, 'display'>,
|
|
18
|
-
ResponsiveFlexProps,
|
|
19
|
-
ResponsiveFlexItemProps {
|
|
20
|
-
gap?: number | number[]
|
|
21
|
-
gapX?: number | number[]
|
|
22
|
-
gapY?: number | number[]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const Root = styled(Box)<FlexItemStyleProps & ResponsiveFlexStyleProps>(
|
|
26
|
-
flexItemStyle,
|
|
27
|
-
responsiveFlexStyle,
|
|
28
|
-
)
|
|
7
|
+
export interface FlexProps extends Omit<BoxProps, 'display'> {}
|
|
29
8
|
|
|
30
9
|
/**
|
|
31
10
|
* The `Flex` component is a wrapper component for flexible elements (`Box`, `Card` and `Flex`).
|
|
@@ -36,22 +15,18 @@ export const Flex = forwardRef(function Flex(
|
|
|
36
15
|
props: FlexProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'wrap'>,
|
|
37
16
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
38
17
|
) {
|
|
39
|
-
const {
|
|
18
|
+
const {as, direction = 'row', ...restProps} = props
|
|
40
19
|
|
|
41
20
|
return (
|
|
42
|
-
<
|
|
21
|
+
<Box
|
|
43
22
|
data-ui="Flex"
|
|
44
23
|
{...restProps}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
$gap={useArrayProp(gap)}
|
|
48
|
-
$gapX={useArrayProp(gapX)}
|
|
49
|
-
$gapY={useArrayProp(gapY)}
|
|
50
|
-
$justify={useArrayProp(justify)}
|
|
51
|
-
$wrap={useArrayProp(wrap)}
|
|
24
|
+
direction={direction}
|
|
25
|
+
display="flex"
|
|
52
26
|
forwardedAs={as}
|
|
53
27
|
ref={ref}
|
|
54
28
|
/>
|
|
55
29
|
)
|
|
56
30
|
})
|
|
31
|
+
|
|
57
32
|
Flex.displayName = 'ForwardRef(Flex)'
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import {forwardRef} from 'react'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
3
|
-
import {useArrayProp} from '../../hooks'
|
|
4
|
-
import {responsiveGridStyle, ResponsiveGridStyleProps} from '../../styles/internal'
|
|
5
2
|
import {Box, BoxProps} from '../box'
|
|
6
|
-
import {ResponsiveGridProps} from '../types'
|
|
7
3
|
|
|
8
4
|
/**
|
|
9
5
|
* @public
|
|
10
6
|
*/
|
|
11
|
-
export interface GridProps extends Omit<BoxProps, 'display'
|
|
12
|
-
|
|
13
|
-
const Root = styled(Box)<ResponsiveGridStyleProps>(responsiveGridStyle)
|
|
7
|
+
export interface GridProps extends Omit<BoxProps, 'display'> {}
|
|
14
8
|
|
|
15
9
|
/**
|
|
16
10
|
* The `Grid` component is for building 2-dimensional layers (based on CSS grid).
|
|
@@ -21,27 +15,20 @@ export const Grid = forwardRef(function Grid(
|
|
|
21
15
|
props: GridProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'rows'>,
|
|
22
16
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
23
17
|
) {
|
|
24
|
-
const {as,
|
|
25
|
-
props
|
|
18
|
+
const {as, children, ...restProps} = props
|
|
26
19
|
|
|
27
20
|
return (
|
|
28
|
-
<
|
|
21
|
+
<Box
|
|
29
22
|
data-as={typeof as === 'string' ? as : undefined}
|
|
30
23
|
data-ui="Grid"
|
|
31
24
|
{...restProps}
|
|
32
|
-
|
|
33
|
-
$autoCols={useArrayProp(autoCols)}
|
|
34
|
-
$autoFlow={useArrayProp(autoFlow)}
|
|
35
|
-
$columns={useArrayProp(columns)}
|
|
36
|
-
$gap={useArrayProp(gap)}
|
|
37
|
-
$gapX={useArrayProp(gapX)}
|
|
38
|
-
$gapY={useArrayProp(gapY)}
|
|
39
|
-
$rows={useArrayProp(rows)}
|
|
25
|
+
display="grid"
|
|
40
26
|
forwardedAs={as}
|
|
41
27
|
ref={ref}
|
|
42
28
|
>
|
|
43
29
|
{children}
|
|
44
|
-
</
|
|
30
|
+
</Box>
|
|
45
31
|
)
|
|
46
32
|
})
|
|
33
|
+
|
|
47
34
|
Grid.displayName = 'ForwardRef(Grid)'
|