diff --git a/src/input-number/src/InputNumber.vue b/src/input-number/src/InputNumber.vue index 23ee70ce6..f45ae67ee 100644 --- a/src/input-number/src/InputNumber.vue +++ b/src/input-number/src/InputNumber.vue @@ -1,79 +1,47 @@ diff --git a/src/input-number/src/styles/index.cssr.js b/src/input-number/src/styles/index.cssr.js new file mode 100644 index 000000000..dd8ab1897 --- /dev/null +++ b/src/input-number/src/styles/index.cssr.js @@ -0,0 +1,8 @@ +import { cB } from '../../../_utils/cssr' + +// vars: +// --bezier +export default cB('input-number', ` + text-align: center; + width: 132px; +`) diff --git a/src/input-number/src/styles/index.js b/src/input-number/src/styles/index.js deleted file mode 100644 index fd9338f5d..000000000 --- a/src/input-number/src/styles/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import baseStyle from './themed-base.cssr.js' - -export default [ - { - key: 'mergedTheme', - watch: ['mergedTheme'], - CNode: baseStyle - } -] diff --git a/src/input-number/src/styles/themed-base.cssr.js b/src/input-number/src/styles/themed-base.cssr.js deleted file mode 100644 index 20aeb3748..000000000 --- a/src/input-number/src/styles/themed-base.cssr.js +++ /dev/null @@ -1,360 +0,0 @@ -import { cTB, c, cB, cE, cM, createKey, insideFormItem } from '../../../_utils/cssr' - -export default c([ - ({ props }) => { - const { - $global: { - cubicBezierEaseInOut - }, - $local - } = props - const { - buttonColorDisabled, - buttonTextColorDisabled, - placeholderColorDisabled, - colorDisabled, - textColorDisabled, - textColor, - border, - borderHover, - borderFocus, - buttonColor, - buttonColorHover, - buttonColorActive, - buttonTextColor, - buttonTextColorHover, - buttonTextColorPressed, - caretColor, - color: backgroundColor, - colorFocus, - boxShadowFocus, - placeholderColor, - borderRadius - } = $local - return cTB('input-number', { - raw: ` - position: relative; - box-sizing: border-box; - display: inline-block; - outline: none; - z-index: auto; - `, - borderRadius - }, [ - ['small', 'medium', 'large'].map(size => { - const { - [createKey('height', size)]: height, - [createKey('width', size)]: width, - [createKey('fontSize', size)]: fontSize, - [createKey('buttonIconSize', size)]: buttonIconSize, - [createKey('buttonWidth', size)]: buttonWidth - } = $local - return cM(size + '-size', { - height, - width, - lineHeight: height - }, [ - cE('button, input', { - height, - lineHeight: height - }), - cE('button', { - width: buttonWidth, - fontSize: buttonIconSize - }), - cE('input', { - padding: `0 ${buttonWidth}`, - fontSize - }) - ]) - }), - cE('border', { - raw: ` - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: ${border}; - border-radius: ${borderRadius}; - transition: border-color .3s ${cubicBezierEaseInOut}; - pointer-events: none; - ` - }), - cE('border-mask', { - raw: ` - position: absolute; - z-index: 1; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: ${border}; - border-color: transparent; - border-radius: ${borderRadius}; - transition: - box-shadow .3s ${cubicBezierEaseInOut}, - border-color .3s ${cubicBezierEaseInOut}; - pointer-events: none; - ` - }), - cE('minus-button', { - left: 0, - borderTopLeftRadius: borderRadius, - borderBottomLeftRadius: borderRadius - }, [ - cB('input-number-button-border-mask', { - borderTopLeftRadius: borderRadius, - borderBottomLeftRadius: borderRadius - }), - cB('input-number-button-body', { - left: '1px', - right: 0 - }, [ - cB('icon', { - transform: 'translateX(-1px)' - }) - ]), - cB('input-number-button-boundary', { - left: 0 - }) - ]), - cE('add-button', { - right: 0, - borderTopRightRadius: borderRadius, - borderBottomRightRadius: borderRadius - }, [ - cB('input-number-button-border-mask', { - borderTopRightRadius: borderRadius, - borderBottomRightRadius: borderRadius - }), - cB('input-number-button-body', { - right: '1px', - left: 0 - }, [ - cB('icon', { - transform: 'translateX(1px)' - }) - ]), - cB('input-number-button-boundary', { - right: 0 - }) - ]), - cM('disabled', { - cursor: 'not-allowed' - }, [ - cE('button', { - pointerEvents: 'none' - }, [ - cB('input-number-button-body', { - backgroundColor: buttonColorDisabled - }), - cB('input-number-button-boundary', { - backgroundColor: buttonColorDisabled - }), - cB('icon', { - color: buttonTextColorDisabled - }) - ]), - cE('input', { - backgroundColor: colorDisabled, - color: textColorDisabled, - pointerEvents: 'none' - }, [ - c('&::placeholder', { - color: placeholderColorDisabled - }) - ]) - ]), - cM('invalid', [ - cE('input', { - textDecoration: 'line-through', - textDecorationColor: textColor - }) - ]), - cE('button', { - raw: ` - background-color: transparent; - overflow: hidden; - outline: none; - position: absolute; - cursor: pointer; - z-index: auto; - top: 0; - padding: 0; - border: none; - ` - }, [ - cB('input-number-button-border-mask', { - raw: ` - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - `, - transition: ` - border-color .3s ${cubicBezierEaseInOut}, - box-shadow .3s ${cubicBezierEaseInOut} - `, - border - }), - cB('input-number-button-body', { - raw: ` - position: absolute; - top: 0; - bottom: 0; - display: flex; - align-items: center; - justify-content: center; - transition: background-color .3s ${cubicBezierEaseInOut}; - `, - backgroundColor: buttonColor - }), - cB('input-number-button-boundary', { - raw: ` - width: 1px; - position: absolute; - top: 0; - bottom: 0; - transition: background-color .3s ${cubicBezierEaseInOut}; - `, - backgroundColor: buttonColor - }), - cB('icon', { - transition: `color .3s ${cubicBezierEaseInOut}`, - color: buttonTextColor - }), - c('&:hover ~', [ - cE('border-mask', { - border: borderHover - }) - ]), - c('&:hover', [ - cB('input-number-button-body', { - backgroundColor: buttonColorHover - }), - cB('input-number-button-boundary', { - backgroundColor: buttonColorHover - }), - cB('icon', { - color: buttonTextColorHover - }) - ]), - c('&:active', [ - cB('input-number-button-body', { - backgroundColor: buttonColorActive - }), - cB('input-number-button-boundary', { - backgroundColor: buttonColorActive - }), - cB('icon', { - color: buttonTextColorPressed - }) - ]), - cM('disabled', { - cursor: 'not-allowed' - }, [ - cB('input-number-button-body', { - backgroundColor: buttonColorDisabled - }), - cB('input-number-button-boundary', { - backgroundColor: buttonColorDisabled - }), - cB('icon', { - color: buttonTextColorDisabled - }) - ]) - ]), - cE('input', { - raw: ` - outline: none; - box-sizing: border-box; - border-radius: ${borderRadius}; - transition: - color .3s ${cubicBezierEaseInOut}, - caret-color .3s ${cubicBezierEaseInOut}, - background-color .3s ${cubicBezierEaseInOut}, - box-shadow .3s ${cubicBezierEaseInOut}, - text-decoration-color .3s ${cubicBezierEaseInOut}; - border: none; - width: 100%; - text-align: center; - `, - backgroundColor, - color: textColor, - caretColor: caretColor - }, [ - c('&::placeholder', { - transition: `color .3s ${cubicBezierEaseInOut}`, - color: placeholderColor - }), - c('&:hover ~', [ - cE('border-mask', { - border: borderHover - }) - ]), - c('&:focus', { - backgroundColor: colorFocus - }, [ - c('& ~', [ - cE('border-mask', { - border: borderFocus, - boxShadow: boxShadowFocus - }) - ]) - ]) - ]) - ]) - }, - ({ props }) => ['warning', 'error'].map(status => { - const local = props.$local - const border = local[createKey('border', status)] - const borderHover = local[createKey('borderHover', status)] - const borderFocus = local[createKey('borderFocus', status)] - const boxShadowFocus = local[createKey('boxShadowFocus', status)] - const colorFocus = local[createKey('colorFocus', status)] - const caretColor = local[createKey('caretColor', status)] - const buttonTextColorHover = local[createKey('buttonTextColorHover', status)] - const buttonTextColorPressed = local[createKey('buttonTextColorPressed', status)] - return insideFormItem( - status, - cTB('input-number', [ - cE('border-mask', { - border - }), - cE('input', { - caretColor: caretColor - }, [ - c('&:hover ~', [ - cE('border-mask', { - border: borderHover - }) - ]), - c('&:focus', { - backgroundColor: colorFocus - }, [ - c('& ~', [ - cE('border-mask', { - border: borderFocus, - boxShadow: boxShadowFocus - }) - ]) - ]) - ]), - cE('button', [ - c('&:hover', [ - cB('icon', { - color: buttonTextColorHover - }) - ]), - c('&:active', [ - cB('icon', { - color: buttonTextColorPressed - }) - ]) - ]) - ]) - ) - }) -]) diff --git a/src/input-number/styles/dark.js b/src/input-number/styles/dark.js index 5bb5e7864..c53e241eb 100644 --- a/src/input-number/styles/dark.js +++ b/src/input-number/styles/dark.js @@ -1,14 +1,15 @@ -import create from '../../_styles/utils/create-component-base' import { changeColor } from 'seemly' -import { baseDark } from '../../_styles/base' import { iconDark } from '../../icon/styles' import commonVars from './_common' +import { commonDark } from '../../_styles/new-common' -export default create({ +export default { name: 'InputNumber', - theme: 'dark', - peer: [baseDark, iconDark], - getLocalVars (vars) { + common: commonDark, + peers: { + Icon: iconDark + }, + self (vars) { const { primaryColor, primaryColorHover, @@ -94,4 +95,4 @@ export default create({ buttonTextColorPressedError: errorColorPressed } } -}) +} diff --git a/src/input-number/styles/light.js b/src/input-number/styles/light.js index bd168df23..34350c904 100644 --- a/src/input-number/styles/light.js +++ b/src/input-number/styles/light.js @@ -1,14 +1,13 @@ -import create from '../../_styles/utils/create-component-base' import { changeColor } from 'seemly' -import { baseLight } from '../../_styles/base' import { iconLight } from '../../icon/styles' import commonVars from './_common' -export default create({ +export default { name: 'InputNumber', - theme: 'light', - peer: [baseLight, iconLight], - getLocalVars (vars) { + peers: { + Icon: iconLight + }, + self (vars) { const { primaryColor, primaryColorHover, @@ -94,4 +93,4 @@ export default create({ buttonTextColorPressedError: errorColorPressed } } -}) +} diff --git a/src/styles.js b/src/styles.js index 9f22826d3..8cf9198b9 100644 --- a/src/styles.js +++ b/src/styles.js @@ -47,7 +47,7 @@ export { baseDark, baseLight } from './_styles/base' // export { gridDark, gridLight } from './grid/styles' // export { iconDark, iconLight } from './icon/styles' // export { inputDark, inputLight } from './input/styles' -export { inputNumberDark, inputNumberLight } from './input-number/styles' +// export { inputNumberDark, inputNumberLight } from './input-number/styles' export { layoutDark, layoutLight } from './layout/styles' export { listDark, listLight } from './list/styles' export { loadingBarDark, loadingBarLight } from './loading-bar/styles' diff --git a/src/styles.new.js b/src/styles.new.js index 3a9aafb5e..b24456098 100644 --- a/src/styles.new.js +++ b/src/styles.new.js @@ -29,6 +29,7 @@ import { gradientTextDark } from './gradient-text/styles' import { gridDark } from './grid/styles' import { iconDark } from './icon/styles' import { inputDark } from './input/styles' +import { inputNumberDark } from './input-number/styles' export const darkTheme = { common: commonDark, @@ -61,5 +62,6 @@ export const darkTheme = { GradientText: gradientTextDark, Grid: gridDark, Icon: iconDark, - Input: inputDark + Input: inputDark, + InputNumber: inputNumberDark }