diff --git a/packages/chakra-ui-core/src/Accordion/Accordion.js b/packages/chakra-ui-core/src/Accordion/Accordion.js index 1af0171c..95d83878 100644 --- a/packages/chakra-ui-core/src/Accordion/Accordion.js +++ b/packages/chakra-ui-core/src/Accordion/Accordion.js @@ -1,16 +1,14 @@ -import { baseProps } from '../config' import Box from '../Box' import { forwardProps, cloneVNodes, useId, isDef } from '../utils' import PseudoBox from '../PseudoBox' -import styleProps from '../config/props' import Collapse from '../Collapse' import Icon from '../Icon' import { iconProps } from '../Icon/icon.props' const Accordion = { name: 'Accordion', + extends: Box, props: { - ...baseProps, allowMultiple: Boolean, allowToggle: Boolean, index: { @@ -117,8 +115,8 @@ const Accordion = { const AccordionItem = { name: 'AccordionItem', + extends: PseudoBox, props: { - ...styleProps, isOpen: { type: Boolean, default: null @@ -204,7 +202,7 @@ const AccordionItem = { const AccordionHeader = { name: 'AccordionHeader', inject: ['$AccordionContext'], - props: styleProps, + extends: PseudoBox, computed: { context () { return this.$AccordionContext() @@ -248,7 +246,7 @@ const AccordionHeader = { const AccordionPanel = { name: 'AccordionPanel', inject: ['$AccordionContext'], - props: baseProps, + extends: Box, computed: { context () { return this.$AccordionContext() @@ -279,8 +277,8 @@ const AccordionPanel = { const AccordionIcon = { name: 'AccordionIcon', inject: ['$AccordionContext'], + extends: Box, props: { - ...baseProps, ...iconProps }, computed: { diff --git a/packages/chakra-ui-core/src/Alert/Alert.js b/packages/chakra-ui-core/src/Alert/Alert.js index 13138b7a..33092d23 100644 --- a/packages/chakra-ui-core/src/Alert/Alert.js +++ b/packages/chakra-ui-core/src/Alert/Alert.js @@ -1,6 +1,5 @@ import Box from '../Box' import Icon from '../Icon' -import { baseProps } from '../config/props' import { forwardProps } from '../utils' import useAlertStyle, { useAlertIconStyle } from './alert.styles' @@ -14,6 +13,7 @@ export const statuses = { const Alert = { name: 'Alert', inject: ['$theme', '$colorMode'], + extends: Box, provide () { return { _status: this.status, @@ -33,8 +33,7 @@ const Alert = { variant: { type: [String, Array], default: 'subtle' - }, - ...baseProps + } }, render (h) { const alertStyles = useAlertStyle({ @@ -60,12 +59,12 @@ const Alert = { const AlertIcon = { name: 'AlertIcon', inject: ['_status', '_variant', '$colorMode', '$theme'], + extends: Box, props: { size: { default: 5 }, - name: String, - ...baseProps + name: String }, computed: { colorMode () { @@ -96,9 +95,7 @@ const AlertIcon = { const AlertTitle = { name: 'AlertTitle', - props: { - ...baseProps - }, + extends: Box, render (h) { return h(Box, { props: { @@ -112,9 +109,7 @@ const AlertTitle = { const AlertDescription = { name: 'AlertDescription', - props: { - ...baseProps - }, + extends: Box, render (h) { return h(Box, { props: forwardProps(this.$props) }, this.$slots.default) } diff --git a/packages/chakra-ui-core/src/AspectRatioBox/AspectRatioBox.js b/packages/chakra-ui-core/src/AspectRatioBox/AspectRatioBox.js index 1033f401..41a394e8 100644 --- a/packages/chakra-ui-core/src/AspectRatioBox/AspectRatioBox.js +++ b/packages/chakra-ui-core/src/AspectRatioBox/AspectRatioBox.js @@ -1,11 +1,11 @@ -import styleProps from '../config/props' + import PseudoBox from '../PseudoBox' import { cloneVNode, forwardProps } from '../utils' const AspectRatioBox = { name: 'AspectRatioBox', + extends: PseudoBox, props: { - ...styleProps, ratio: { type: Number, default: 4 / 3 diff --git a/packages/chakra-ui-core/src/Avatar/Avatar.js b/packages/chakra-ui-core/src/Avatar/Avatar.js index d0dd6650..24bedb98 100644 --- a/packages/chakra-ui-core/src/Avatar/Avatar.js +++ b/packages/chakra-ui-core/src/Avatar/Avatar.js @@ -1,4 +1,3 @@ -import { baseProps } from '../config/props' import { forwardProps, canUseDOM } from '../utils/' import useAvatarStyles, { avatarSizes } from './avatar.styles' import Box from '../Box' @@ -24,9 +23,9 @@ const getInitials = (name) => { export const AvatarBadge = { name: 'AvatarBadge', inject: ['$theme', '$colorMode'], + extends: Box, props: { - size: [String, Number, Array], - ...baseProps + size: [String, Number, Array] }, computed: { theme () { @@ -63,10 +62,10 @@ export const AvatarBadge = { */ const AvatarName = { name: 'AvatarName', + extends: Box, props: { name: [String, Array], - size: [String, Array], - ...baseProps + size: [String, Array] }, render (h) { return h(Box, { @@ -90,9 +89,9 @@ const AvatarName = { */ const DefaultAvatar = { name: 'DefaultAvatar', + extends: Box, props: { - size: [String, Number, Array], - ...baseProps + size: [String, Number, Array] }, render (h) { return h(Box, { @@ -122,6 +121,7 @@ const DefaultAvatar = { export const Avatar = { name: 'Avatar', inject: ['$theme', '$colorMode'], + extends: Box, computed: { theme () { return this.$theme() @@ -141,8 +141,7 @@ export const Avatar = { }, name: [String, Array], src: [String, Array], - borderColor: [String], - ...baseProps + borderColor: [String] }, data () { return { diff --git a/packages/chakra-ui-core/src/AvatarGroup/AvatarGroup.js b/packages/chakra-ui-core/src/AvatarGroup/AvatarGroup.js index 730670a2..43e56fc1 100644 --- a/packages/chakra-ui-core/src/AvatarGroup/AvatarGroup.js +++ b/packages/chakra-ui-core/src/AvatarGroup/AvatarGroup.js @@ -1,6 +1,5 @@ import Flex from '../Flex' import { avatarSizes } from '../Avatar/avatar.styles' -import { baseProps } from '../config/props' import { forwardProps } from '../utils' /** @@ -9,10 +8,10 @@ import { forwardProps } from '../utils' const MoreAvatarLabel = { name: 'MoreAvatarLabel', inject: ['$theme', '$colorMode'], + extends: Flex, props: { size: [String, Array], - label: String, - ...baseProps + label: String }, computed: { theme () { @@ -51,8 +50,9 @@ const MoreAvatarLabel = { const AvatarGroup = { name: 'AvatarGroup', + extends: Flex, props: { - groupSize: { + size: { type: [Number, String, Array], default: 'md' }, @@ -61,8 +61,7 @@ const AvatarGroup = { spacing: { type: [Number, String, Array], default: -3 - }, - ...baseProps + } }, render (h) { // Get the number of slot nodes inside AvatarGroup @@ -77,7 +76,7 @@ const AvatarGroup = { // Change VNode component options const { propsData } = node.componentOptions propsData['ml'] = isFirstAvatar ? 0 : this.spacing - propsData['size'] = this.groupSize + propsData['size'] = this.size propsData['showBorder'] = true propsData['borderColor'] = this.borderColor || propsData['borderColor'] propsData['zIndex'] = count - index @@ -87,7 +86,7 @@ const AvatarGroup = { if (max && index === max) { return h(MoreAvatarLabel, { props: { - size: this.groupSize, + size: this.size, ml: this.spacing, label: `+${count - max}` } @@ -95,11 +94,14 @@ const AvatarGroup = { } }) + // Drop size, borderColor, max, spacing props from final rendered AvatarGroup props for consistency. + const { size, borderColor, max: _max, spacing, ...rest } = this.$props + return h(Flex, { props: { alignItems: 'center', zIndex: 0, - ...forwardProps(this.$props) + ...forwardProps(rest) } }, clones) } diff --git a/packages/chakra-ui-core/src/Badge/Badge.js b/packages/chakra-ui-core/src/Badge/Badge.js index ab9fabfe..ec415a60 100644 --- a/packages/chakra-ui-core/src/Badge/Badge.js +++ b/packages/chakra-ui-core/src/Badge/Badge.js @@ -1,11 +1,11 @@ import Box from '../Box' import { forwardProps } from '../utils' -import { baseProps } from '../config/props' import useBadgeStyles from './badge.styles' export default { name: 'Badge', inject: ['$theme', '$colorMode'], + extends: Box, props: { variant: { type: String, @@ -14,8 +14,7 @@ export default { variantColor: { type: String, default: 'gray' - }, - ...baseProps + } }, computed: { colorMode () { diff --git a/packages/chakra-ui-core/src/Button/Button.js b/packages/chakra-ui-core/src/Button/Button.js index 0d9b45f2..970846af 100644 --- a/packages/chakra-ui-core/src/Button/Button.js +++ b/packages/chakra-ui-core/src/Button/Button.js @@ -1,4 +1,3 @@ -import styleProps from '../config/props' import { buttonProps } from './button.props' import { forwardProps } from '../utils' import createButtonStyles, { setIconSizes } from './button.styles' @@ -12,14 +11,14 @@ import Icon from '../Icon' */ const ButtonIcon = { name: 'ButtonIcon', + extends: Box, props: { icon: { type: [String, Object] }, size: { type: [String, Number] - }, - ...styleProps + } }, render (h) { if (typeof this.icon === 'string') { @@ -54,10 +53,10 @@ const ButtonIcon = { */ export default { name: 'Button', + extends: PseudoBox, inject: ['$theme', '$colorMode'], props: { ...buttonProps, - ...styleProps, to: [String, Object] }, computed: { diff --git a/packages/chakra-ui-core/src/Button/Button.stories.js b/packages/chakra-ui-core/src/Button/Button.stories.js index f0018d88..5da2b786 100644 --- a/packages/chakra-ui-core/src/Button/Button.stories.js +++ b/packages/chakra-ui-core/src/Button/Button.stories.js @@ -74,7 +74,7 @@ storiesOf('UI | Button', module) this.loading = false this.buttonText = 'Success' this.variantColor = 'green' - }, 1500) + }, 60000) } } })) diff --git a/packages/chakra-ui-core/src/Button/button.props.js b/packages/chakra-ui-core/src/Button/button.props.js index 28a3f92d..1326344c 100644 --- a/packages/chakra-ui-core/src/Button/button.props.js +++ b/packages/chakra-ui-core/src/Button/button.props.js @@ -56,7 +56,7 @@ export const buttonProps = { type: String, default: null }, - rounded: { + isRounded: { type: Boolean, default: false }, diff --git a/packages/chakra-ui-core/src/ButtonGroup/ButtonGroup.js b/packages/chakra-ui-core/src/ButtonGroup/ButtonGroup.js index d1b0ca39..da95ec4a 100644 --- a/packages/chakra-ui-core/src/ButtonGroup/ButtonGroup.js +++ b/packages/chakra-ui-core/src/ButtonGroup/ButtonGroup.js @@ -1,9 +1,9 @@ import Box from '../Box' -import { baseProps } from '../config/props' import { forwardProps } from '../utils' const ButtonGroup = { name: 'ButtonGroup', + extends: Box, props: { size: [String, Array], variantColor: [String, Array], @@ -12,8 +12,7 @@ const ButtonGroup = { spacing: { type: [Number, Array, String], default: 2 - }, - ...baseProps + } }, render (h) { const children = this.$slots.default.filter(e => e.tag) diff --git a/packages/chakra-ui-core/src/Checkbox/Checkbox.js b/packages/chakra-ui-core/src/Checkbox/Checkbox.js index b7471a1e..d54d0180 100644 --- a/packages/chakra-ui-core/src/Checkbox/Checkbox.js +++ b/packages/chakra-ui-core/src/Checkbox/Checkbox.js @@ -1,6 +1,5 @@ import { StringNumber, StringArray } from '../config/props/props.types' -import { baseProps } from '../config' -import { useVariantColorWarning, useId } from '../utils' +import { useVariantColorWarning, useId, forwardProps } from '../utils' import useCheckboxStyle from './checkbox.styles' import Box from '../Box' import VisuallyHidden from '../VisuallyHidden' @@ -10,12 +9,12 @@ import Icon from '../Icon' const Checkbox = { name: 'Checkbox', inject: ['$theme', '$colorMode'], + extends: Box, model: { prop: 'isChecked', event: 'change' }, props: { - ...baseProps, id: String, name: String, value: [String, Boolean], @@ -77,7 +76,7 @@ const Checkbox = { return h(Box, { props: { - ...this.$props, + ...forwardProps(this.$props), as: 'label', display: 'inline-flex', verticalAlign: 'top', diff --git a/packages/chakra-ui-core/src/Checkbox/tests/__snapshots__/Checkbox.test.js.snap b/packages/chakra-ui-core/src/Checkbox/tests/__snapshots__/Checkbox.test.js.snap index 2acf87ba..afebb2d7 100644 --- a/packages/chakra-ui-core/src/Checkbox/tests/__snapshots__/Checkbox.test.js.snap +++ b/packages/chakra-ui-core/src/Checkbox/tests/__snapshots__/Checkbox.test.js.snap @@ -17,7 +17,7 @@ exports[`should render correctly 1`] = ` class="css-1ra3zj0 css-xkdust" > diff --git a/packages/chakra-ui-core/src/CheckboxGroup/CheckboxGroup.js b/packages/chakra-ui-core/src/CheckboxGroup/CheckboxGroup.js index a9aaedfc..80e246be 100644 --- a/packages/chakra-ui-core/src/CheckboxGroup/CheckboxGroup.js +++ b/packages/chakra-ui-core/src/CheckboxGroup/CheckboxGroup.js @@ -1,16 +1,15 @@ import { SNA } from '../config/props/props.types' -import { baseProps } from '../config' import Box from '../Box' import { isDef, useId, cleanChildren, cloneVNodeElement, forwardProps } from '../utils' const CheckboxGroup = { name: 'CheckboxGroup', + extends: Box, model: { prop: 'value', event: 'change' }, props: { - ...baseProps, name: String, variantColor: String, size: String, diff --git a/packages/chakra-ui-core/src/CheckboxGroup/tests/__snapshots__/CheckboxGroup.test.js.snap b/packages/chakra-ui-core/src/CheckboxGroup/tests/__snapshots__/CheckboxGroup.test.js.snap index 89661248..93490894 100644 --- a/packages/chakra-ui-core/src/CheckboxGroup/tests/__snapshots__/CheckboxGroup.test.js.snap +++ b/packages/chakra-ui-core/src/CheckboxGroup/tests/__snapshots__/CheckboxGroup.test.js.snap @@ -29,7 +29,7 @@ exports[`should render correctly 1`] = ` class="css-1ra3zj0 css-hpvc67" > @@ -97,7 +97,7 @@ exports[`should render correctly 1`] = ` class="css-1ra3zj0 css-hpvc67" > @@ -164,7 +164,7 @@ exports[`should render correctly 1`] = ` class="css-1ra3zj0 css-hpvc67" > diff --git a/packages/chakra-ui-core/src/CircularProgress/CircularProgress.js b/packages/chakra-ui-core/src/CircularProgress/CircularProgress.js index 6f3189b6..afaaeb57 100644 --- a/packages/chakra-ui-core/src/CircularProgress/CircularProgress.js +++ b/packages/chakra-ui-core/src/CircularProgress/CircularProgress.js @@ -1,11 +1,10 @@ import Box from '../Box' -import { baseProps } from '../config/props' import { forwardProps } from '../utils' import { getComputedProps } from './circularprogress.styles' const CircularProgressLabel = { name: 'CircularProgressLabel', - props: baseProps, + extends: Box, render (h) { return h(Box, { style: { @@ -27,6 +26,7 @@ const CircularProgressLabel = { const CircularProgress = { name: 'CircularProgress', inject: ['$colorMode'], + extends: Box, computed: { colorMode () { return this.$colorMode() @@ -67,8 +67,7 @@ const CircularProgress = { color: { type: String, default: 'blue' - }, - ...baseProps + } }, render (h) { const _trackColor = { light: `${this.trackColor}.100`, dark: 'whiteAlpha.300' } diff --git a/packages/chakra-ui-core/src/CircularProgress/tests/__snapshots__/CircularProgress.test.js.snap b/packages/chakra-ui-core/src/CircularProgress/tests/__snapshots__/CircularProgress.test.js.snap index 195b27a5..6df4a4e8 100644 --- a/packages/chakra-ui-core/src/CircularProgress/tests/__snapshots__/CircularProgress.test.js.snap +++ b/packages/chakra-ui-core/src/CircularProgress/tests/__snapshots__/CircularProgress.test.js.snap @@ -6,7 +6,7 @@ exports[`should render correctly 1`] = ` aria-valuemax="100" aria-valuemin="0" aria-valuenow="40" - class="css-xqz7ss" + class="css-12d21aj" data-testid="CircularProgress" role="progressbar" > @@ -24,7 +24,7 @@ exports[`should render correctly 1`] = ` stroke-width="11.111111111111112" /> { diff --git a/packages/chakra-ui-core/src/CloseButton/tests/__snapshots__/CloseButton.test.js.snap b/packages/chakra-ui-core/src/CloseButton/tests/__snapshots__/CloseButton.test.js.snap index 6a47beff..87ba85dd 100644 --- a/packages/chakra-ui-core/src/CloseButton/tests/__snapshots__/CloseButton.test.js.snap +++ b/packages/chakra-ui-core/src/CloseButton/tests/__snapshots__/CloseButton.test.js.snap @@ -4,11 +4,11 @@ exports[`should render correctly 1`] = ` * @param {string} placement @@ -36,6 +39,7 @@ function flipPlacement (placement) { const Popper = { name: 'Popper', + extends: PseudoBox, props: { _id: { type: String, @@ -81,8 +85,7 @@ const Popper = { default: true }, positionFixed: Boolean, - usePortalTarget: String, - ...styleProps + usePortalTarget: String }, data () { return { diff --git a/packages/chakra-ui-core/src/Progress/Progress.js b/packages/chakra-ui-core/src/Progress/Progress.js index ec980677..2834a946 100644 --- a/packages/chakra-ui-core/src/Progress/Progress.js +++ b/packages/chakra-ui-core/src/Progress/Progress.js @@ -1,7 +1,6 @@ import Box from '../Box' import { generateStripe, valueToPercent, forwardProps } from '../utils' import { css, keyframes } from 'emotion' -import { baseProps } from '../config/props' const stripe = keyframes({ from: { backgroundPosition: '1rem 0' }, @@ -20,7 +19,7 @@ const progressbarSizes = { const ProgressLabel = { name: 'ProgressLabel', - props: baseProps, + extends: Box, render (h) { return h(Box, { props: { @@ -34,8 +33,8 @@ const ProgressLabel = { const ProgressTrack = { name: 'ProgressTrack', + extends: Box, props: { - ...baseProps, size: [String, Number, Array] }, render (h) { @@ -53,8 +52,8 @@ const ProgressTrack = { const ProgressIndicator = { name: 'ProgressIndicator', + extends: Box, props: { - ...baseProps, isIndeterminate: Boolean, min: Number, max: Number, @@ -86,8 +85,8 @@ const ProgressIndicator = { const Progress = { name: 'Progress', inject: ['$colorMode'], + extends: Box, props: { - ...baseProps, color: { type: String, default: 'blue' diff --git a/packages/chakra-ui-core/src/PseudoBox/PseudoBox.js b/packages/chakra-ui-core/src/PseudoBox/PseudoBox.js index 35e0003c..0fbc70ea 100644 --- a/packages/chakra-ui-core/src/PseudoBox/PseudoBox.js +++ b/packages/chakra-ui-core/src/PseudoBox/PseudoBox.js @@ -2,7 +2,7 @@ import { css } from 'emotion' import __css from '@styled-system/css' import { background, border, color, borderRadius, flexbox, grid, layout, position, shadow, space, typography, compose } from 'styled-system' import Box from '../Box' -import styleProps, { propsConfig } from '../config/props' +import { propsConfig, pseudoProps } from '../config/props' import { parsePseudoStyles } from './utils' const systemProps = compose( @@ -23,13 +23,14 @@ const systemProps = compose( const PseudoBox = { name: 'PseudoBox', inject: ['$theme'], + extends: Box, props: { as: { type: [String, Object], default: () => 'div' }, to: [String, Object], - ...styleProps + ...pseudoProps }, computed: { theme () { diff --git a/packages/chakra-ui-core/src/Radio/Radio.js b/packages/chakra-ui-core/src/Radio/Radio.js index 154f2ccd..7a4f77fc 100644 --- a/packages/chakra-ui-core/src/Radio/Radio.js +++ b/packages/chakra-ui-core/src/Radio/Radio.js @@ -1,4 +1,3 @@ -import styleProps from '../config/props' import { useVariantColorWarning, forwardProps } from '../utils' import useCheckboxStyle from '../Checkbox/checkbox.styles' import Box from '../Box' @@ -8,8 +7,8 @@ import ControlBox from '../ControlBox' const Radio = { name: 'Radio', inject: ['$colorMode', '$theme'], + extends: ControlBox, props: { - ...styleProps, id: String, name: String, value: String, @@ -89,9 +88,7 @@ const Radio = { props: { ...forwardProps(this.$props), ...this.radioStyles, - rounded: 'full' - }, - attrs: { + rounded: 'full', type: 'radio' } }, [ diff --git a/packages/chakra-ui-core/src/RadioButtonGroup/RadioButtonGroup.js b/packages/chakra-ui-core/src/RadioButtonGroup/RadioButtonGroup.js index 72962501..ae8a5663 100644 --- a/packages/chakra-ui-core/src/RadioButtonGroup/RadioButtonGroup.js +++ b/packages/chakra-ui-core/src/RadioButtonGroup/RadioButtonGroup.js @@ -1,12 +1,11 @@ import Box from '../Box' -import { baseProps } from '../config' import { StringNumber, SNA } from '../config/props/props.types' import { isDef, useId, cloneVNodeElement, forwardProps, cleanChildren } from '../utils' const RadioButtonGroup = { name: 'RadioButtonGroup', + extends: Box, props: { - ...baseProps, name: { type: String, default: `radio-${useId()}` diff --git a/packages/chakra-ui-core/src/RadioGroup/RadioGroup.js b/packages/chakra-ui-core/src/RadioGroup/RadioGroup.js index 8a4dcdf6..c2c2c1f9 100644 --- a/packages/chakra-ui-core/src/RadioGroup/RadioGroup.js +++ b/packages/chakra-ui-core/src/RadioGroup/RadioGroup.js @@ -1,12 +1,11 @@ import Box from '../Box' -import { baseProps } from '../config' import { StringNumber } from '../config/props/props.types' import { useId, cloneVNodeElement, forwardProps } from '../utils' const RadioGroup = { name: 'RadioGroup', + extends: Box, props: { - ...baseProps, name: { type: String, default: `radio-${useId()}` diff --git a/packages/chakra-ui-core/src/Select/Select.js b/packages/chakra-ui-core/src/Select/Select.js index 74d40564..6049706b 100644 --- a/packages/chakra-ui-core/src/Select/Select.js +++ b/packages/chakra-ui-core/src/Select/Select.js @@ -1,7 +1,4 @@ -import { baseProps } from '../config' import Box from '../Box' -import styleProps from '../config/props' -import { inputProps } from '../Input/input.props' import Input from '../Input' import splitProps from './select.utils' import Icon from '../Icon' @@ -11,7 +8,7 @@ import Icon from '../Icon' */ const SelectIconWrapper = { name: 'SelectIconWrapper', - props: baseProps, + extends: Box, render (h) { return h(Box, { props: { @@ -34,9 +31,8 @@ const SelectIconWrapper = { const SelectInput = { name: 'SelectInput', + extends: Input, props: { - ...styleProps, - ...inputProps, placeholder: String, value: String }, @@ -74,9 +70,8 @@ const Select = { prop: 'value', event: 'change' }, + extends: Input, props: { - ...styleProps, - ...inputProps, rootProps: { type: Object, default: () => ({}) diff --git a/packages/chakra-ui-core/src/SimpleGrid/SimpleGrid.js b/packages/chakra-ui-core/src/SimpleGrid/SimpleGrid.js index 864743dd..32faaf34 100644 --- a/packages/chakra-ui-core/src/SimpleGrid/SimpleGrid.js +++ b/packages/chakra-ui-core/src/SimpleGrid/SimpleGrid.js @@ -1,16 +1,15 @@ import Grid from '../Grid' -import { baseProps } from '../config/props' import { countToColumns, widthToColumns } from './grid.styles' const SimpleGrid = { name: 'SimpleGrid', + extends: Grid, props: { columns: [String, Number, Array], spacingX: [String, Number, Array], spacingY: [String, Number, Array], spacing: [String, Number, Array], - minChildWidth: [String, Number, Array], - ...baseProps + minChildWidth: [String, Number, Array] }, computed: { templateColumns () { diff --git a/packages/chakra-ui-core/src/Slider/Slider.js b/packages/chakra-ui-core/src/Slider/Slider.js index 6268cbf4..6ce1eb9f 100644 --- a/packages/chakra-ui-core/src/Slider/Slider.js +++ b/packages/chakra-ui-core/src/Slider/Slider.js @@ -1,17 +1,15 @@ -import { baseProps } from '../config' import { isDef, valueToPercent, useId, getElById, forwardProps } from '../utils' import { clampValue, roundValueToStep } from './slider.utils' import Box from '../Box' import useSliderStyle from './slider.styles' import { percentToValue } from '../utils/transform' -import styleProps from '../config/props' import PseudoBox from '../PseudoBox' const Slider = { name: 'Slider', inject: ['$theme', '$colorMode'], + extends: Box, props: { - ...baseProps, value: Number, defaultValue: Number, isDisabled: Boolean, @@ -300,7 +298,7 @@ const Slider = { const SliderTrack = { name: 'SliderTrack', inject: ['$SliderContext', '$theme', '$colorMode'], - props: baseProps, + extends: Box, computed: { context () { return this.$SliderContext() @@ -342,7 +340,7 @@ const SliderTrack = { const SliderFilledTrack = { name: 'SliderFilledTrack', inject: ['$SliderContext', '$theme', '$colorMode'], - props: styleProps, + extends: PseudoBox, computed: { context () { return this.$SliderContext() @@ -383,7 +381,7 @@ const SliderFilledTrack = { const SliderThumb = { name: 'SliderThumb', inject: ['$SliderContext', '$theme', '$colorMode'], - props: baseProps, + extends: Box, computed: { context () { return this.$SliderContext() diff --git a/packages/chakra-ui-core/src/Spinner/Spinner.js b/packages/chakra-ui-core/src/Spinner/Spinner.js index d29730d9..32d7bc62 100644 --- a/packages/chakra-ui-core/src/Spinner/Spinner.js +++ b/packages/chakra-ui-core/src/Spinner/Spinner.js @@ -1,5 +1,4 @@ import { keyframes } from 'emotion' -import { baseProps } from '../config/props' import { forwardProps } from '../utils' import Box from '../Box' import VisuallyHidden from '../VisuallyHidden' @@ -49,6 +48,7 @@ const setSizes = (props) => { export default { name: 'Spinner', + extends: Box, props: { size: { type: [String, Array], @@ -74,8 +74,7 @@ export default { type: [String, Array], default: 'transparent' }, - forwardRef: Object, - ...baseProps + forwardRef: Object }, render (h) { return h(Box, { diff --git a/packages/chakra-ui-core/src/Stat/Stat.js b/packages/chakra-ui-core/src/Stat/Stat.js index 0316d83a..b8f90988 100644 --- a/packages/chakra-ui-core/src/Stat/Stat.js +++ b/packages/chakra-ui-core/src/Stat/Stat.js @@ -71,8 +71,8 @@ const StatArrow = { mr: 1, size: '14px', verticalAlign: 'middle', - ...arrowOptions[this.type], - ...forwardProps(this.$props) + ...forwardProps(this.$props), + ...arrowOptions[this.type] } }) } diff --git a/packages/chakra-ui-core/src/Switch/Switch.js b/packages/chakra-ui-core/src/Switch/Switch.js index c6a27d80..fd3c2b09 100644 --- a/packages/chakra-ui-core/src/Switch/Switch.js +++ b/packages/chakra-ui-core/src/Switch/Switch.js @@ -1,5 +1,4 @@ import Box from '../Box' -import styleProps from '../config/props' import { forwardProps } from '../utils' import VisuallyHidden from '../VisuallyHidden' import ControlBox from '../ControlBox' @@ -21,13 +20,13 @@ const switchSizes = { const Switch = { name: 'CSwitch', + extends: Box, model: { prop: 'isChecked', event: 'change' }, inject: ['$colorMode'], props: { - ...styleProps, id: String, name: String, value: Boolean, diff --git a/packages/chakra-ui-core/src/Tabs/Tabs.js b/packages/chakra-ui-core/src/Tabs/Tabs.js index d324464f..2c6bb42b 100644 --- a/packages/chakra-ui-core/src/Tabs/Tabs.js +++ b/packages/chakra-ui-core/src/Tabs/Tabs.js @@ -1,7 +1,5 @@ -import { baseProps } from '../config' import { useVariantColorWarning, isDef, useId, forwardProps, cleanChildren, cloneVNodeElement } from '../utils' import { useTabListStyle, useTabStyle } from './tabs.styles' -import styleProps from '../config/props' import Flex from '../Flex' import Box from '../Box' import PseudoBox from '../PseudoBox' @@ -9,8 +7,8 @@ import PseudoBox from '../PseudoBox' const Tabs = { name: 'Tabs', inject: ['$theme', '$colorMode'], + extends: Box, props: { - ...baseProps, index: Number, defaultIndex: Number, isManual: Boolean, @@ -170,7 +168,7 @@ const Tabs = { const TabList = { name: 'TabList', - props: baseProps, + extends: Flex, inject: ['$TabContext', '$theme', '$colorMode'], data () { return { @@ -319,8 +317,8 @@ const TabList = { const Tab = { name: 'Tab', inject: ['$theme', '$colorMode', '$TabContext'], + extends: PseudoBox, props: { - ...styleProps, isSelected: Boolean, isDisabled: Boolean, id: String @@ -373,8 +371,8 @@ const Tab = { const TabPanel = { name: 'TabPanel', + extends: Box, props: { - ...baseProps, isSelected: Boolean, selectedPanelNode: Object, id: String @@ -397,7 +395,7 @@ const TabPanel = { const TabPanels = { name: 'TabPanels', inject: ['$TabContext'], - props: baseProps, + extends: Box, computed: { context () { return this.$TabContext() diff --git a/packages/chakra-ui-core/src/Tag/Tag.js b/packages/chakra-ui-core/src/Tag/Tag.js index fe53331e..466823d3 100644 --- a/packages/chakra-ui-core/src/Tag/Tag.js +++ b/packages/chakra-ui-core/src/Tag/Tag.js @@ -1,4 +1,3 @@ -import styleProps, { baseProps } from '../config/props' import { css } from 'emotion' import PseudoBox from '../PseudoBox' import Icon from '../Icon' @@ -28,8 +27,8 @@ const tagSizes = { const TagCloseButton = { name: 'TagCloseButton', + extends: PseudoBox, props: { - ...styleProps, isDisabled: Boolean }, render (h) { @@ -81,8 +80,8 @@ const TagCloseButton = { const TagIcon = { name: 'TagIcon', + extends: Box, props: { - ...baseProps, icon: [String, Object] }, render (h) { @@ -117,7 +116,7 @@ const TagIcon = { const TagLabel = { name: 'TagLabel', - props: baseProps, + extends: Box, render (h) { return h(Box, { ...forwardProps(this.$props), @@ -131,8 +130,8 @@ const TagLabel = { const Tag = { name: 'Tag', inject: ['$theme', '$colorMode'], + extends: PseudoBox, props: { - ...styleProps, variant: { type: String, default: 'subtle' diff --git a/packages/chakra-ui-core/src/Tag/tests/__snapshots__/Tag.test.js.snap b/packages/chakra-ui-core/src/Tag/tests/__snapshots__/Tag.test.js.snap index 6432ee0d..6ee5de11 100644 --- a/packages/chakra-ui-core/src/Tag/tests/__snapshots__/Tag.test.js.snap +++ b/packages/chakra-ui-core/src/Tag/tests/__snapshots__/Tag.test.js.snap @@ -44,7 +44,7 @@ exports[`should display tag with right icon 1`] = `