diff --git a/build/release.sh b/build/release.sh index b9b11885b..10858e8de 100644 --- a/build/release.sh +++ b/build/release.sh @@ -19,7 +19,7 @@ then echo "Releasing zanui-css $VERSION ..." cd packages/zanui-css npm version $VERSION --message "[release] $VERSION" - npm publish --registry=http://registry.npm.qima-inc.com + npm publish cd ../.. # commit @@ -31,5 +31,5 @@ then git push origin master git push origin refs/tags/v$VERSION - npm publish --registry=http://registry.npm.qima-inc.com + npm publish fi diff --git a/packages/vant-css/README.md b/packages/vant-css/README.md new file mode 100644 index 000000000..3a3f333be --- /dev/null +++ b/packages/vant-css/README.md @@ -0,0 +1 @@ +# zanui-css diff --git a/packages/vant-css/assets/icons.sketch b/packages/vant-css/assets/icons.sketch new file mode 100644 index 000000000..bba3bf5b7 Binary files /dev/null and b/packages/vant-css/assets/icons.sketch differ diff --git a/packages/vant-css/gulpfile.js b/packages/vant-css/gulpfile.js new file mode 100644 index 000000000..5ddcc7ecf --- /dev/null +++ b/packages/vant-css/gulpfile.js @@ -0,0 +1,13 @@ +var gulp = require('gulp'); +var postcss = require('gulp-postcss'); +var cssmin = require('gulp-cssmin'); +var salad = require('postcss-salad')(require('./salad.config.json')); + +gulp.task('compile', function() { + return gulp.src('./src/*.css') + .pipe(postcss([salad])) + .pipe(cssmin()) + .pipe(gulp.dest('./lib')); +}); + +gulp.task('build', ['compile']); diff --git a/packages/vant-css/package.json b/packages/vant-css/package.json new file mode 100644 index 000000000..b0333a6a3 --- /dev/null +++ b/packages/vant-css/package.json @@ -0,0 +1,23 @@ +{ + "name": "@youzan/zanui-css", + "version": "0.1.2", + "description": "zanui css.", + "main": "lib/index.css", + "style": "lib/index.css", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "gulp build", + "build:icons": "sh scripts/build.sh" + }, + "license": "MIT", + "devDependencies": { + "gulp": "^3.9.1", + "gulp-cssmin": "^0.1.7", + "gulp-postcss": "^6.1.1", + "postcss-salad": "^1.0.5" + }, + "dependencies": {} +} diff --git a/packages/vant-css/salad.config.json b/packages/vant-css/salad.config.json new file mode 100644 index 000000000..1d82ab8c3 --- /dev/null +++ b/packages/vant-css/salad.config.json @@ -0,0 +1,16 @@ +{ + "browsers": ["ie > 8", "last 2 versions"], + "features": { + "bem": { + "shortcuts": { + "component": "b", + "modifier": "m", + "descendent": "e" + }, + "separators": { + "descendent": "__", + "modifier": "--" + } + } + } +} diff --git a/packages/vant-css/scripts/build.sh b/packages/vant-css/scripts/build.sh new file mode 100644 index 000000000..968965790 --- /dev/null +++ b/packages/vant-css/scripts/build.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +basepath=$(dirname $0) +server_prefix=/zanui/icon + +# convert relative path to absolute path +function abspath() { + pushd . > /dev/null; if [ -d "$1" ]; then cd "$1"; dirs -l +0; else cd "`dirname \"$1\"`"; cur_dir=`dirs -l +0`; if [ "$cur_dir" == "/" ]; then echo "$cur_dir`basename \"$1\"`"; else echo "$cur_dir/`basename \"$1\"`"; fi; fi; popd > /dev/null; +} + +command_exists () { + type "$1" >/dev/null 2>&1 +} + +fontname() { + if command_exists superman ; then + echo "https://b.yzcdn.cn$server_prefix/$(basename $basepath/../build/font/vant-icon-*.$1)" + else + echo "$(abspath $basepath/../build/font/vant-icon-*.$1)" + fi +} + +# generate font files from sketch file +$basepath/extract-icons.sh +$basepath/generate-font.sh + +if command_exists superman ; then + # upload to cdn + superman cdn $server_prefix $basepath/../build/font/vant-icon-* +fi + +# generate fontface style +eot=$(fontname eot) +cat > $basepath/../src/icon.css <> $basepath/../src/icon.css diff --git a/packages/vant-css/scripts/extract-icons.sh b/packages/vant-css/scripts/extract-icons.sh new file mode 100755 index 000000000..b3c54e476 --- /dev/null +++ b/packages/vant-css/scripts/extract-icons.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +basepath=$(dirname $0) + +rm -rf $basepath/../icons +sketchtool export slices --formats=svg --overwriting=YES --save-for-web=YES --output=$basepath/../icons $basepath/../assets/icons.sketch diff --git a/packages/vant-css/scripts/fount-config.js b/packages/vant-css/scripts/fount-config.js new file mode 100644 index 000000000..4046e5f22 --- /dev/null +++ b/packages/vant-css/scripts/fount-config.js @@ -0,0 +1,164 @@ +module.exports = { + name: 'vant-icon', + output: '../build', + meta: { + author: 'houzi, zhangmin', + license: 'MIT', + license_url: 'https://opensource.org/licenses/MIT', + homepage: 'http://github.com/youzan', + css_prefix_text: 'van-icon-', + filename_hash: true + }, + hinting: true, + glyphs_dir: '../icons', + glyphs: [ + { + keywords: ['qr', 'invalid'], + src: '二维码失效.svg', + css: 'qr-invalid' + }, + { + keywords: ['qr'], + src: '二维码.svg', + css: 'qr' + }, + { + keywords: ['exchange'], + src: '兑换.svg', + css: 'exchange', + 'correct_contour_direction': true + }, + { + keywords: ['close'], + src: '关闭.svg', + css: 'close' + }, + { + keywords: ['location'], + src: '其他分店.svg', + css: 'location' + }, + { + keywords: ['upgrade'], + src: '升级地址.svg', + css: 'upgrade' + }, + { + keywords: ['check'], + src: '单选.svg', + css: 'check' + }, + { + keywords: ['checked'], + src: '选中.svg', + css: 'checked' + }, + { + keywords: ['like', 'outline'], + src: '喜欢.svg', + css: 'like-o' + }, + { + keywords: ['like', 'filled'], + src: '喜欢2.svg', + css: 'like' + }, + { + keywords: ['chat'], + src: '客服.svg', + css: 'chat', + 'correct_contour_direction': true + }, + { + keywords: ['shop'], + src: '店铺.svg', + css: 'shop' + }, + { + keywords: ['photograph'], + src: '拍照.svg', + css: 'photograph' + }, + { + keywords: ['add'], + src: '新增地址.svg', + css: 'add' + }, + { + keywords: ['add2'], + src: '添加.svg', + css: 'add2' + }, + { + keywords: ['photo'], + src: '照片.svg', + css: 'photo' + }, + { + keywords: ['logistics'], + src: '物流.svg', + css: 'logistics' + }, + { + keywords: ['edit'], + src: '编辑地址.svg', + css: 'edit' + }, + { + keywords: ['passed'], + src: '认证通过.svg', + css: 'passed' + }, + { + keywords: ['cart'], + src: '购物车.svg', + css: 'cart' + }, + { + keywords: ['arrow'], + src: '进入箭头.svg', + css: 'arrow' + }, + { + keywords: ['gift'], + src: '送礼.svg', + css: 'gift' + }, + { + keywords: ['search'], + src: '搜索.svg', + css: 'search' + }, + { + keywords: ['clear'], + src: '清除搜索.svg', + css: 'clear' + }, + { + keywords: ['success'], + src: '成功.svg', + css: 'success' + }, + { + keywords: ['fail'], + src: '失败.svg', + css: 'fail' + }, + { + keywords: ['contact'], + src: '联系人.svg', + css: 'contact', + 'correct_contour_direction': true + }, + { + keywords: ['wechat'], + src: '微信支付.svg', + css: 'wechat' + }, + { + keywords: ['alipay'], + src: '支付宝支付.svg', + css: 'alipay' + } + ] +}; diff --git a/packages/vant-css/scripts/generate-font.sh b/packages/vant-css/scripts/generate-font.sh new file mode 100755 index 000000000..bd1421ec0 --- /dev/null +++ b/packages/vant-css/scripts/generate-font.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +basepath=$(dirname $0) + +iconfount --config $basepath/fount-config.js diff --git a/packages/vant-css/src/actionsheet.css b/packages/vant-css/src/actionsheet.css new file mode 100644 index 000000000..8b73ae279 --- /dev/null +++ b/packages/vant-css/src/actionsheet.css @@ -0,0 +1,82 @@ +@import './common/var.css'; +@import './mixins/border_retina.css'; +@import './popup.css'; + +@component-namespace van { + @b actionsheet { + position: fixed; + width: 100%; + top: auto; + bottom: 0; + right: auto; + left: 50%; + transform: translate3d(-50%, 0, 0); + backface-visibility: hidden; + transition: .2s ease-out; + background-color: #e0e0e0; + + @m withtitle { + background-color: $c-white; + } + + @e item { + line-height: 50px; + text-align: center; + color: $c-black; + font-size: 16px; + position: relative; + background-color: $c-white; + + @m loading { + padding: 10px 0; + } + + &::after { + @mixin border-retina (top); + } + } + + @e subname { + color: $c-gray-darker; + font-size: 12px; + } + + @e loading { + margin: 0 auto; + } + + @e button { + display: block; + margin-top: 5px; + line-height: 50px; + color: $c-black; + font-size: 16px; + text-align: center; + background-color: $c-white; + } + + @e header { + line-height: 44px; + color: $c-black; + text-align: center; + position: relative; + + &::after { + @mixin border-retina (top, bottom); + } + + .van-icon-close { + position: absolute; + font-size: 22px; + line-height: 22px; + top: 11px; + right: 15px; + } + } + } +} + +.actionsheet-float-enter, +.actionsheet-float-leave-active { + transform: translate3d(-50%, 100%, 0); +} diff --git a/packages/vant-css/src/badge.css b/packages/vant-css/src/badge.css new file mode 100644 index 000000000..2eb224da0 --- /dev/null +++ b/packages/vant-css/src/badge.css @@ -0,0 +1,77 @@ +@import './common/var.css'; +@import './mixins/border_retina.css'; + +@component-namespace van { + @b badge-group { + position: relative; + width: 85px; + &::after { + @mixin border-retina (top); + } + } + + @b badge { + display: block; + overflow: hidden; + position: relative; + padding: 20px 12px; + box-sizing: border-box; + line-height: 1.4; + background-color: $c-background; + color: $c-gray-darker; + font-size: 14px; + text-decoration: none; + word-break: break-all; + + @m select { + font-weight: bold; + color: $c-black; + background-color: $c-white; + .van-badge__active { + display: block; + } + &::after { + @mixin border-retina (top); + @mixin border-retina (right); + @mixin border-retina (left); + } + } + + @e active { + display: none; + position: absolute; + left: 0; + top: 0; + width: 3px; + height: 100%; + background-color: #FF4444; + } + + @e info { + position: absolute; + top: 2px; + right: 2px; + font-size: 10px; + transform:scale(0.8); + text-align: center; + box-sizing: border-box; + padding: 0 6px; + min-width: 18px; + height: 18px; + line-height: 18px; + border-radius: 9px; + background-color: #FF4444; + color: $c-white; + } + + &::after { + @mixin border-retina (bottom); + } + + &:last-child { + &::after { + border-bottom: 0; + } + } + } +} diff --git a/packages/vant-css/src/button.css b/packages/vant-css/src/button.css new file mode 100644 index 000000000..6d1f63d01 --- /dev/null +++ b/packages/vant-css/src/button.css @@ -0,0 +1,122 @@ +@import './common/var.css'; +@import './loading.css'; + +@component-namespace van { + @b button { + position: relative; + padding: 0; + display: inline-block; + height: 45px; + line-height: 43px; + border-radius: 4px; + box-sizing: border-box; + font-size: 16px; + text-align: center; + appearance: none; + outline: 0; + overflow: hidden; + + &::after { + content: " "; + position: absolute 0 0 0 0; + background-color: #000; + opacity: 0; + } + + &:not(.is-disabled):active::after { + opacity: .3; + } + + @e icon-loading { + display: inline-block; + width: 16px; + height: 16px; + vertical-align: middle; + } + + @m default { + color: $button-default-color; + background-color: $button-default-background-color; + border: 1px solid $button-default-border-color; + } + + @m primary { + color: $button-primary-color; + background-color: $button-primary-background-color; + border: 1px solid $button-primary-border-color; + } + + @m danger { + color: $button-danger-color; + background-color: $button-danger-background-color; + border: 1px solid $button-danger-border-color; + } + + @m large { + width: 100%; + height: 50px; + line-height: 48px; + font-size: 16px; + } + + @m normal { + padding: 0 15px; + font-size: 14px; + } + + @m small { + min-width: 60px; + height: 30px; + line-height: 28px; + font-size: 12px; + } + + /* + mini图标默认宽度50px,文字不能超过4个 + */ + @m mini { + display: inline-block; + width: 50px; + height: 22px; + line-height: 20px; + font-size: 10px; + + & + .van-button--mini { + margin-left: 5px; + } + } + + @m disabled { + color: $button-disabled-color; + background-color: $button-disabled-background-color; + border: 1px solid $button-disabled-border-color; + } + + @m block { + display: block; + width: 100%; + } + + @m loading { + .van-button__text { + display: none; + } + } + + @m bottom-action { + width: 100%; + height: 50px; + line-height: 50px; + border: 0; + border-radius: 0; + background-color: $bottom-action-button-default-background-color; + color: $bottom-action-button-default-color; + font-size: 16px; + + &.van-button--primary { + background-color: $bottom-action-button-primary-background-color; + color: $bottom-action-button-primary-color; + } + } + } +} diff --git a/packages/vant-css/src/card.css b/packages/vant-css/src/card.css new file mode 100644 index 000000000..7cd6a1bc0 --- /dev/null +++ b/packages/vant-css/src/card.css @@ -0,0 +1,93 @@ +@import './mixins/ellipsis.css'; + +@component-namespace van { + @b card { + padding: 5px 15px 5px 115px; + height: 90px; + background: #FAFAFA; + overflow: hidden; + position: relative; + margin-top: 10px; + + &:first-child { + margin-top: 0; + } + + @e img { + width: 90px; + height: auto; + border: 0; + position: absolute; + top: 5px; + left: 15px; + } + + @e content { + display: table; + width: 100%; + + @m center { + display: table; + height: 90px; + + .van-card__info { + display: table-cell; + vertical-align: middle; + } + } + } + + @e row { + overflow: hidden; + padding-right: 80px; + position: relative; + } + + @e title { + line-height: 20px; + color: #333; + max-height: 40px; + margin-bottom: 5px; + word-break: break-all; + @mixin multi-ellipsis 2; + } + + @e desc { + font-size: 12px; + color: #666; + max-height: 20px; + word-break: break-all; + @mixin multi-ellipsis 1; + } + + @e price { + position: absolute; + top: 0; + right: 0; + width: 80px; + text-align: right; + font-size: 14px; + color: #333; + } + + @e num { + position: absolute; + top: 0; + right: 0; + width: 80px; + text-align: right; + font-size: 12px; + color: #666; + } + + @e footer { + position: absolute; + right: 15px; + bottom: 5px; + + .van-button { + margin-left: 5px; + } + } + } +} diff --git a/packages/vant-css/src/cell.css b/packages/vant-css/src/cell.css new file mode 100644 index 000000000..9226456d3 --- /dev/null +++ b/packages/vant-css/src/cell.css @@ -0,0 +1,88 @@ +@import './common/var.css'; +@import './mixins/border_retina.css'; +@import './icon.css'; + +@component-namespace van { + @b cell-group { + padding-left: 15px; + position: relative; + background-color: #fff; + + &::after { + @mixin border-retina (top, bottom); + } + } + + @b cell { + display: block; + position: relative; + padding: 10px 15px 10px 0; + box-sizing: border-box; + line-height: 24px; + background-color: $c-white; + color: $c-black; + font-size: 14px; + text-decoration: none; + overflow: hidden; + + &::after { + @mixin border-retina (bottom); + } + + &:last-child { + &::after { + border-bottom: 0; + } + } + + @e title { + float: left; + } + + @e label { + display: block; + font-size: 12px; + line-height: 1.2; + color: $c-gray-darker; + } + + @e value { + float: right; + overflow: hidden; + + @m link { + margin-right: 20px; + } + + @m alone { + float: none; + } + } + + @m required { + overflow: visible; + + &::before { + content: '*'; + position: absolute; + left: -7px; + font-size: 14px; + color: #f44; + } + + .van-cell__title { + float: none; + display: inline-block; + } + } + + .van-icon-arrow { + position: absolute; + top: 50%; + right: 15px; + transform: translateY(-50%); + color: $c-gray-dark; + font-size: 12px; + } + } +} diff --git a/packages/vant-css/src/checkbox.css b/packages/vant-css/src/checkbox.css new file mode 100644 index 000000000..9e7c9d7a2 --- /dev/null +++ b/packages/vant-css/src/checkbox.css @@ -0,0 +1,49 @@ +@import './common/var.css'; + +@component-namespace van { + @b checkbox { + overflow: hidden; + + @m disabled { + .van-icon { + color: #d1dbe5; + } + } + + @e input { + position: relative; + height: 22px; + margin-right: 15px; + float: left; + } + + @e control { + position: absolute; + top: 0; + left: 0; + width: 22px; + height: 22px; + opacity: 0; + margin: 0; + } + + @e label { + line-height: 22px; + margin-left: 37px; + display: block; + } + + .van-icon { + font-size: 22px; + line-height: 1; + } + + .van-icon-checked { + color: $c-green; + } + + .van-icon-check { + color: $c-gray-dark; + } + } +} diff --git a/packages/vant-css/src/col.css b/packages/vant-css/src/col.css new file mode 100644 index 000000000..b6f234272 --- /dev/null +++ b/packages/vant-css/src/col.css @@ -0,0 +1,52 @@ +.van-col { + float: left; + box-sizing: border-box; +} +.van-col-1 { width: 4.166666666666667%; } +.van-col-2 { width: 8.333333333333334%; } +.van-col-3 { width: 12.5%; } +.van-col-4 { width: 16.666666666666668%; } +.van-col-5 { width: 20.833333333333336%; } +.van-col-6 { width: 25%; } +.van-col-7 { width: 29.166666666666668%; } +.van-col-8 { width: 33.333333333333336%; } +.van-col-9 { width: 37.5%; } +.van-col-10 { width: 41.66666666666667%; } +.van-col-11 { width: 45.833333333333336%; } +.van-col-12 { width: 50%; } +.van-col-13 { width: 54.16666666666667%; } +.van-col-14 { width: 58.333333333333336%; } +.van-col-15 { width: 62.50000000000001%; } +.van-col-16 { width: 66.66666666666667%; } +.van-col-17 { width: 70.83333333333334%; } +.van-col-18 { width: 75%; } +.van-col-19 { width: 79.16666666666667%; } +.van-col-20 { width: 83.33333333333334%; } +.van-col-21 { width: 87.5%; } +.van-col-22 { width: 91.66666666666667%; } +.van-col-23 { width: 95.83333333333334%; } +.van-col-24 { width: 100%; } +.van-col-offset-1 { margin-left: 4.166666666666667%; } +.van-col-offset-2 { margin-left: 8.333333333333334%; } +.van-col-offset-3 { margin-left: 12.5%; } +.van-col-offset-4 { margin-left: 16.666666666666668%; } +.van-col-offset-5 { margin-left: 20.833333333333336%; } +.van-col-offset-6 { margin-left: 25%; } +.van-col-offset-7 { margin-left: 29.166666666666668%; } +.van-col-offset-8 { margin-left: 33.333333333333336%; } +.van-col-offset-9 { margin-left: 37.5%; } +.van-col-offset-10 { margin-left: 41.66666666666667%; } +.van-col-offset-11 { margin-left: 45.833333333333336%; } +.van-col-offset-12 { margin-left: 50%; } +.van-col-offset-13 { margin-left: 54.16666666666667%; } +.van-col-offset-14 { margin-left: 58.333333333333336%; } +.van-col-offset-15 { margin-left: 62.50000000000001%; } +.van-col-offset-16 { margin-left: 66.66666666666667%; } +.van-col-offset-17 { margin-left: 70.83333333333334%; } +.van-col-offset-18 { margin-left: 75%; } +.van-col-offset-19 { margin-left: 79.16666666666667%; } +.van-col-offset-20 { margin-left: 83.33333333333334%; } +.van-col-offset-21 { margin-left: 87.5%; } +.van-col-offset-22 { margin-left: 91.66666666666667%; } +.van-col-offset-23 { margin-left: 95.83333333333334%; } +.van-col-offset-24 { margin-left: 100%; } diff --git a/packages/vant-css/src/common/var.css b/packages/vant-css/src/common/var.css new file mode 100644 index 000000000..4e89219f5 --- /dev/null +++ b/packages/vant-css/src/common/var.css @@ -0,0 +1,40 @@ +/* UI标准色 */ +$c-white: #fff; +$c-black: #333; +$c-green: #06bf04; +$c-green-wx: #4b0; +$c-red: #ed5050; +$c-gray: #c9c9c9; +$c-gray-light: #e5e5e5; +$c-gray-darker: #666; +$c-gray-dark: #999; +$c-yellow: #f09000; +$c-yellow-light: #fcff00; +$c-orange: #f60; +$c-orange-dark: #f15a0c; +$c-blue: #38f; + +$c-background: #f8f8f8; + +/* 按钮颜色 */ +$button-primary-color: $c-white; +$button-primary-background-color: $c-green-wx; +$button-primary-border-color: #0a0; + +$button-default-color: $c-black; +$button-default-background-color: $c-white; +$button-default-border-color: #bbb; + +$button-danger-color: $c-white; +$button-danger-background-color: #f44; +$button-danger-border-color: #e33; + +$button-disabled-color: $c-gray-dark; +$button-disabled-background-color: $c-gray-light; +$button-disabled-border-color: #cacaca; + +$bottom-action-button-default-color: $c-white; +$bottom-action-button-default-background-color: #f85; + +$bottom-action-button-primary-color: $c-white; +$bottom-action-button-primary-background-color: #f44; diff --git a/packages/vant-css/src/dialog.css b/packages/vant-css/src/dialog.css new file mode 100644 index 000000000..0523ec2ff --- /dev/null +++ b/packages/vant-css/src/dialog.css @@ -0,0 +1,101 @@ +@import './mixins/border_retina.css'; +@import './popup.css'; + +@component-namespace van { + @b dialog-wrapper { + position: absolute; + } + + @b dialog { + position: fixed; + top: 50%; + left: 50%; + transform: translate3d(-50%, -50%, 0); + background-color: #fff; + width: 85%; + border-radius: 4px; + font-size: 16px; + overflow: hidden; + backface-visibility: hidden; + transition: .2s; + + @e header { + padding: 15px 0 0; + } + + @e content { + padding: 15px 20px; + position: relative; + + &::after { + @mixin border-retina (bottom); + } + } + + @e title { + text-align: center; + padding-left: 0; + margin-bottom: 0; + font-size: 16px; + color: #333; + } + + @e message { + color: #999; + margin: 0; + font-size: 14px; + line-height: 1.5; + + @m notitle { + color: #333; + font-size: 16px; + } + } + + @e footer { + font-size: 14px; + overflow: hidden; + + @when twobtn { + .van-dialog__btn { + width: 50%; + } + + .van-dialog__cancel { + &::after { + @mixin border-retina (right); + } + } + } + } + + @e btn { + font-size: 16px; + line-height: 40px; + border: 0; + background-color: #fff; + float: left; + box-sizing: border-box; + text-align: center; + position: relative; + } + + @e cancel { + color: #333; + } + + @e confirm { + color: #00C000; + width: 100%; + } + } +} + +.dialog-bounce-enter { + opacity: 0; + transform: translate3d(-50%, -50%, 0) scale(0.7); +} +.dialog-bounce-leave-active { + opacity: 0; + transform: translate3d(-50%, -50%, 0) scale(0.9); +} diff --git a/packages/vant-css/src/field.css b/packages/vant-css/src/field.css new file mode 100644 index 000000000..2acaa8388 --- /dev/null +++ b/packages/vant-css/src/field.css @@ -0,0 +1,89 @@ +@import './common/var.css'; +@import './mixins/border_retina.css'; +@import './cell.css'; + +@component-namespace van { + @b field { + width: 100%; + + @m hastextarea { + .van-field__control { + min-height: 60px; + } + } + + @m nolabel { + .van-cell__title { + display: none; + } + + .van-cell__value { + width: 100%; + padding-left: 0; + } + } + + @m disabled { + .van-field__control { + color: $c-gray-dark; + } + } + + @m error { + .van-field__control { + color: $c-red; + } + } + + @m border { + .van-field__control { + padding-left: 10px; + } + + &::after { + border-radius: 2px; + @mixin border-retina (top, right, bottom, left); + } + + &:last-child::after { + @mixin border-retina (bottom); + } + } + + @m autosize { + .van-field__control { + min-height: 0px; + } + } + + .van-cell__title, + .van-cell__value { + float: none; + box-sizing: border-box; + } + + .van-cell__title { + width: 90px; + position: absolute; + top: 10px; + left: 0; + } + + .van-cell__value { + width: 100%; + padding-left: 90px; + } + + @e control { + border: 0; + font-size: 14px; + line-height: 24px; + height: 24px; + padding: 0; + display: block; + width: 100%; + resize: none; + outline: 0; + } + } +} diff --git a/packages/vant-css/src/icon.css b/packages/vant-css/src/icon.css new file mode 100644 index 000000000..58e1e9497 --- /dev/null +++ b/packages/vant-css/src/icon.css @@ -0,0 +1,78 @@ +/* DO NOT EDIT! Generated by fount */ + +@font-face { + font-family: 'vant-icon'; + src: url('https://b.yzcdn.cn/zanui/icon/vant-icon-587aa52c96.eot'); + src: url('https://b.yzcdn.cn/zanui/icon/vant-icon-587aa52c96.eot?#iefix') format('embedded-opentype'), + url('https://b.yzcdn.cn/zanui/icon/vant-icon-587aa52c96.woff2') format('woff2'), + url('https://b.yzcdn.cn/zanui/icon/vant-icon-587aa52c96.woff') format('woff'), + url('https://b.yzcdn.cn/zanui/icon/vant-icon-587aa52c96.ttf') format('truetype') +} + +.van-icon { + display: inline-block; +} +.van-icon::before { + font-family: "vant-icon" !important; + font-style: normal; + font-weight: normal; + speak: none; + + display: inline-block; + text-decoration: inherit; + width: 1em; + text-align: center; + + /* For safety - reset parent styles, that can break glyph codes*/ + font-variant: normal; + text-transform: none; + + /* fix buttons height, for twitter bootstrap */ + line-height: 1em; + + /* Animation center compensation - margins should be symmetric */ + /* remove if not needed */ + /* margin-left: .2em; */ + + /* you can be more comfortable with increased icons size */ + /* font-size: 120%; */ + + /* Font smoothing. That was taken from TWBS */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + /* Uncomment for 3D effect */ + /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ +} +/* DO NOT EDIT! Generated by iconfount */ + + +.van-icon-qr-invalid:before { content: '\e800'; } /* '' */ +.van-icon-qr:before { content: '\e801'; } /* '' */ +.van-icon-exchange:before { content: '\e802'; } /* '' */ +.van-icon-close:before { content: '\e803'; } /* '' */ +.van-icon-location:before { content: '\e804'; } /* '' */ +.van-icon-upgrade:before { content: '\e805'; } /* '' */ +.van-icon-check:before { content: '\e806'; } /* '' */ +.van-icon-checked:before { content: '\e807'; } /* '' */ +.van-icon-like-o:before { content: '\e808'; } /* '' */ +.van-icon-like:before { content: '\e809'; } /* '' */ +.van-icon-chat:before { content: '\e80a'; } /* '' */ +.van-icon-shop:before { content: '\e80b'; } /* '' */ +.van-icon-photograph:before { content: '\e80c'; } /* '' */ +.van-icon-add:before { content: '\e80d'; } /* '' */ +.van-icon-add2:before { content: '\e80e'; } /* '' */ +.van-icon-photo:before { content: '\e80f'; } /* '' */ +.van-icon-logistics:before { content: '\e810'; } /* '' */ +.van-icon-edit:before { content: '\e811'; } /* '' */ +.van-icon-passed:before { content: '\e812'; } /* '' */ +.van-icon-cart:before { content: '\e813'; } /* '' */ +.van-icon-arrow:before { content: '\e814'; } /* '' */ +.van-icon-gift:before { content: '\e815'; } /* '' */ +.van-icon-search:before { content: '\e816'; } /* '' */ +.van-icon-clear:before { content: '\e817'; } /* '' */ +.van-icon-success:before { content: '\e818'; } /* '' */ +.van-icon-fail:before { content: '\e819'; } /* '' */ +.van-icon-contact:before { content: '\e81a'; } /* '' */ +.van-icon-wechat:before { content: '\e81b'; } /* '' */ +.van-icon-alipay:before { content: '\e81c'; } /* '' */ \ No newline at end of file diff --git a/packages/vant-css/src/image_preview.css b/packages/vant-css/src/image_preview.css new file mode 100644 index 000000000..3ee1a64bd --- /dev/null +++ b/packages/vant-css/src/image_preview.css @@ -0,0 +1,36 @@ +@import './swipe.css'; + +@component-namespace van { + @b image-preview { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + overflow: auto; + + @e image { + display: block; + position: absolute; + left: 0; + + @m center { + width: 100%; + height: auto; + top: 50%; + transform: translate3d(0, -50%, 0); + } + } + + .van-image-preview__image--big { + height: 100%; + width: auto; + left: 50%; + transform: translate3d(-50%, 0, 0); + } + + .van-swipe { + height: 100%; + } + } +} diff --git a/packages/vant-css/src/index.css b/packages/vant-css/src/index.css new file mode 100644 index 000000000..addb5464c --- /dev/null +++ b/packages/vant-css/src/index.css @@ -0,0 +1,30 @@ +/** + css组件库入口,组装成css组件库 + */ +@import './button.css'; +@import './cell.css'; +@import './card.css'; +@import './dialog.css'; +@import './field.css'; +@import './icon.css'; +@import './loading.css'; +@import './picker.css'; +@import './popup.css'; +@import './radio.css'; +@import './switch.css'; +@import './badge.css'; +@import './search.css'; +@import './panel.css'; +@import './steps.css'; +@import './tag.css'; +@import './checkbox.css'; +@import './tab.css'; +@import './col.css'; +@import './row.css'; +@import './image_preview.css'; +@import './actionsheet.css'; +@import './quantity.css'; +@import './progress.css'; +@import './toast.css'; +@import './uploader.css'; +@import './swipe.css'; diff --git a/packages/vant-css/src/loading.css b/packages/vant-css/src/loading.css new file mode 100644 index 000000000..446e0bbe5 --- /dev/null +++ b/packages/vant-css/src/loading.css @@ -0,0 +1,68 @@ +@-webkit-keyframes loading { + from { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + to { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes loading { + from { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + to { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@component-namespace van { + @b loading { + width: 30px; + height: 30px; + line-height: 0; + font-size: 0; + + @e spinner { + display: inline-block; + height: 100%; + width: 100%; + + -webkit-animation: loading 0.8s linear; + -webkit-animation-iteration-count: infinite; + animation: loading 0.8s linear; + animation-iteration-count: infinite; + + @m circle { + border-radius: 100%; + border: 3px solid transparent; + box-sizing: border-box; + &.van-loading__spinner--black { + border-color: $c-gray; + border-top-color: $c-gray-darker; + } + &.van-loading__spinner--white { + border-color: rgba(0, 0, 0, .5); + border-top-color: transparent; + } + } + + @m gradient-circle { + &.van-loading__spinner--black { + background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAADitJREFUaAXNmmuMVVcVx++9M8PMMAwMj5GCpJjGtKVIfQxIpcGGtwylwQ+iND4iJI1GTU2jjZqmYvzQVNLY1JiaftPU1mjSftBAeA4FQagQSCoYq0EUeU55zTCvO/fh77/uWZtzh7kzd17ATvZde6+99t7rv9baj3POTSbGKB08eLC2o6OjKZ/PfyyZTN7HNPdRboTWU6+DJnO5XGcqlbpBuZX8b/IpZN6bMGHCu4sWLeqiPuopOZoj7tq1ayrjPY7SK6GfIFcBCnzJhP3AoC0FUdLcSQDDyifjfHi9tB2Ht62ysvLtJUuWfKAOo5FGBfCOHTvmA2gTCi6GVqCYgRHQbDabEiXbXHFgkusLmLrJYSjrh7ws1kJ+dfny5X8ZKegRAd6+ffvCioqKb6PUpyKQ0ieAVXk4gGUb7xcfDyP8lfqLK1euPAAdVhoW4H379jX29PR8nxlXk0OIAhxdbcgA2kM6LidNI0+bfNTPdTHPxvup3SOBrurzNvNvXrNmzQWNNZTkk5Tdh3W6GAVepEN91CkAjuoBLHVtTAaKcpHcSABrHvp3YISnCPNdqpebXImy5Hfu3PlVAPwC4Tom1KTKnryeQKas8SSENSyX24HJtMHJiPXM8wYO+Fa5fW2+coRPnDgx7uzZs88h+wRWFbCiXTUaw41nCrG2bXyUGtDDPh7CHm0DhjRz2zw+qOqUf9fb2/tMc3NzT6RLSeKTlBTYv3//ZNbLywz8sID6RK5gfwpITmtOsgA2AMgHg2iyqJ/kzIA+nuToFjYt2t2jt8hpHJJhYLyjVVVV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lSdoslSliEs3CUTtZks9bCkYh4zjysgAC3vpniPVsFS0PGYdA/TV8/yerxVNCQJ8TTHU2t8fJukz0+YsA+/qHrkyBF9iNqIEvrHu4FzzzKxha0cJw/T0cDRrkWeQ5leAabcTX8ZQ2tLXu+mr9ZfhyiAbbNCtoucA2iP+mNArVltWr0ypo4aqnkc0SuLarcmrK9z07uAvDmiSPk+lbIAex/O6GYG/RLzyNoCYZsXZc1tLhZVRcpGPFMcJQ0wyhlgDNQDAL1c0C0tAKaPyTGnNjlFhwymogEEeFrjs5nZPBjsPGf+ZddxMDokwBqMJ6SPM/k3yTUC6p6lbMeBQEohQEhBeUgKyhgG3IHS33Zt+hlA6l2KCuq9MgA5jax25R6NRyjbbk+Y29sXPJvGeKf5y7D90WUwoN4+ZMDq2NLS0oAyG1Dq0xEYeyOC0nbjkoKISXEB1U3HAEPZn7IKTVE7doRFYwg4/XXummcBk4anY8k8TN+M6syrM/rytGnT/tPfOYvcgGlYgH1E7rkPosQ6FNAuLlBaz1qnUsxeGwkA4ORxAZeyAqJ12CNZeAZQ7RpDVMBF1c7aNsAYSTu7duBTPOoNuBMjUzKNCLCPynXwAYDplelD6GreRnn3sIAbgMgovqZLAgasMBtgQAvzB6zdU9yPr/mcw6WjAtgnP3To0ER28yYUnkdIfhh+Up4WABlAgLWmVYdvgCibR70dw4mvW9Ul2s6xWf+vnL/2uw6D0VEFHJ9M/6bnce0jeGcmik8lN9A+HsCaU99yBUzrtpOQ74CvnfY6ZXmzFW/GLyfxoUdU/j+IDynLAWtddgAAAABJRU5ErkJggg=='); + background-size: contain; + } + &.van-loading__spinner--white { + background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAACZBJREFUaAXNmm2opVUVx+dOpWmNWZNpFkNEqIW9OUU2YkaRlZXUh4ikF3JAiIpCKCxCCokwicIIsw99CJsiIT8kChXOFGmNNahYSBYTZo2mFaYzmqbefr8z539bZ8/zn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6nJuQMZIayFBBeiPCuRBGj7rT1B/4DjVSTxp5FlC3X4xcSxwBurZEI0edJnaGkh0lY7/gR1+Pxdki7Cvr1cDnyjqhKCXVpbrgQTKbvBT8GddYUd6BNIGmMTOA54Zo2Vp4faPNG2Rd8CMLThIXKnHvujZ3hg4YPEp6E+24wbXIk2kO0QrXb9Upg3Nc/274B/mQl/cdTfb1sk5uJK1MV2RyThC5E5fAsMcecYV9HHfhBiWYADkHXuiByywxmF9LtofzB9tIGVJGiJJlEWIn4WqO1RoI9ktakt6MFhf/9QezfVL4RdgErYOcZOHn2TK3o/ZDu/2MiLB3NGhQk/xvJzkCBJEsckzHjs6Xdp50QcV1w4YS3+FZa+bW3j7HUc14E81kfW0cGLx0G/zs9vYz0BvARYiJKiu3RIqHNJuwP6Zoe1i4jElGgv8exabM43v3HdcbU2dez6muPfoFdcoV4ZnoHLcPgjSAKTiCq13/rZl0Ck+mYRHctuaRMSiM12l93x2F2I+6m5xsc0KjpPFM6z3+SfD84ECSgRxX5s6pBT6+OZs50z6dlKX+1NTW3Bas+w89ytzK9aH/PkLNt2V++dRBafwQqqx4o7Da7EyRfwSs5CIrbrWGt3rCLj2aHo7GqXziXuXNvCXfXVMbkd65VJZ3hkIkGvY7f/hvGjIL9YhETIh7g7YNvzqnZn4kNzSSRWJaTUjjnPxTCP833FVHtF3EVN3uWnljbZxIkkuA2ni4AvForJ6+pmAbp0JVznGEdSqSe7rV1b+tEPYLtjVrIGM8Cyhd32PwfeDbyLh7ha5Ix5FiWXMxqdMxqt3XmtrleKZ3UvRMfeifHplbkIJyrET6btV6b52ieEqw6REGx1xlstYX/Pkqg7O5esCOFUAPFjaG8F/tX1AmD87FB0Syj9Ou659w/2feCvEHVxVkRWlHCtCPLeXF4ETgSbwbHAd2dzerOUqI8qH1M+mv4JvFTdTe+89eUE08rI/wCfdm58JaCP1gAAAABJRU5ErkJggg=='); + background-size: contain; + } + } + } + } +} diff --git a/packages/vant-css/src/mixins/border_retina.css b/packages/vant-css/src/mixins/border_retina.css new file mode 100644 index 000000000..404c323e5 --- /dev/null +++ b/packages/vant-css/src/mixins/border_retina.css @@ -0,0 +1,20 @@ +$border-poses: top, right, bottom, left; + +@define-mixin border-retina $poses: $border-poses, $border-retina-color: #e5e5e5 { + content: ''; + position: absolute; + top: 0; + left: 0; + box-sizing: border-box; + width: 200%; + height: 200%; + transform: scale(.5); + transform-origin: left top; + -webkit-perspective: 1000; + -webkit-backface-visibility: hidden; + pointer-events: none; + + @each $pos in $poses { + border-$(pos): 1px solid $border-retina-color; + } +} \ No newline at end of file diff --git a/packages/vant-css/src/mixins/clearfix.css b/packages/vant-css/src/mixins/clearfix.css new file mode 100644 index 000000000..cb8ed0126 --- /dev/null +++ b/packages/vant-css/src/mixins/clearfix.css @@ -0,0 +1,7 @@ +@define-mixin clearfix { + &::after { + content: ''; + display: table; + clear: both; + } +} diff --git a/packages/vant-css/src/mixins/ellipsis.css b/packages/vant-css/src/mixins/ellipsis.css new file mode 100644 index 000000000..cfe063a5b --- /dev/null +++ b/packages/vant-css/src/mixins/ellipsis.css @@ -0,0 +1,7 @@ +@define-mixin multi-ellipsis $lines { + overflow : hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: $lines; + -webkit-box-orient: vertical; +} diff --git a/packages/vant-css/src/panel.css b/packages/vant-css/src/panel.css new file mode 100644 index 000000000..2a08bda61 --- /dev/null +++ b/packages/vant-css/src/panel.css @@ -0,0 +1,36 @@ +@component-namespace van { + @b panel { + background: #fff; + border-top: 1px solid #E5E5E5; + border-bottom: 1px solid #E5E5E5; + + @e header { + padding: 10px 15px; + position: relative; + border-bottom: 1px solid #E5E5E5; + } + + @e title { + font-size: 14px; + color: #333; + } + + @e desc { + font-size: 12px; + color: #666; + } + + @e status { + font-size: 14px; + position: absolute; + top: 10px; + right: 15px; + color: #FF4444; + } + + @e footer { + border-top: 1px solid #E5E5E5; + padding: 10px 15px; + } + } +} diff --git a/packages/vant-css/src/picker.css b/packages/vant-css/src/picker.css new file mode 100644 index 000000000..0a89f49d0 --- /dev/null +++ b/packages/vant-css/src/picker.css @@ -0,0 +1,143 @@ +@import './mixins/border_retina.css'; + +@component-namespace van { + @b picker { + overflow: hidden; + background-color: #fff; + + @e toolbar { + height: 40px; + line-height: 40px; + overflow: hidden; + padding: 0 15px; + position: relative; + + &::after { + @mixin border-retina (top, bottom); + } + } + + @e cancel { + color: #3388FF; + float: left; + } + + @e confirm { + color: #3388FF; + float: right; + } + + @e columns { + position: relative; + overflow: hidden; + + @m 1 { + .van-picker-column { + width: 100%; + } + } + + @m 2 { + .van-picker-column { + width: 50%; + } + } + + @m 3 { + .van-picker-column { + width: 33.333%; + } + } + + @m 4 { + .van-picker-column { + width: 25%; + } + } + + @m 5 { + .van-picker-column { + width: 20%; + } + } + } + } + + .van-picker-center-highlight { + box-sizing: border-box; + position: absolute; + left: 0; + width: 100%; + top: 50%; + margin-top: -18px; + pointer-events: none; + } + + .van-picker-center-highlight:before, + .van-picker-center-highlight:after { + content: ''; + position: absolute; + height: 1px; + width: 100%; + background-color: #eaeaea; + display: block; + van-index: 15; + transform: scaleY(0.5); + } + + .van-picker-center-highlight:before { + left: 0; + top: 0; + bottom: auto; + right: auto; + } + + .van-picker-center-highlight:after { + left: 0; + bottom: 0; + right: auto; + top: auto; + } + + @b picker-column { + font-size: 18px; + overflow: hidden; + position: relative; + max-height: 100%; + float: left; + text-align: center; + + @e item { + height: 44px; + line-height: 44px; + padding: 0 10px; + white-space: nowrap; + position: relative; + overflow: hidden; + text-overflow: ellipsis; + color: #707274; + left: 0; + top: 0; + width: 100%; + box-sizing: border-box; + transition-duration: .3s; + backface-visibility: hidden; + + @m selected { + color: #000; + transform: translate3d(0, 0, 0) rotateX(0); + } + } + } + + .picker-column-wrapper { + transition-duration: 0.3s; + transition-timing-function: ease-out; + backface-visibility: hidden; + } + + .picker-column-wrapper.dragging, + .picker-column-wrapper.dragging .picker-item { + transition-duration: 0s; + } +} diff --git a/packages/vant-css/src/popup.css b/packages/vant-css/src/popup.css new file mode 100644 index 000000000..5d2f438c5 --- /dev/null +++ b/packages/vant-css/src/popup.css @@ -0,0 +1,78 @@ +@component-namespace van { + @b modal { + position: fixed; + width: 100%; + height: 100%; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.701961); + transition: all .5s ease-out; + } + + @b popup { + position: fixed; + background-color: #fff; + top: 50%; + left: 50%; + transform: translate3d(-50%, -50%, 0); + backface-visibility: hidden; + transition: .2s ease-out; + + @m top { + width: 100%; + top: 0; + right: auto; + bottom: auto; + left: 50%; + transform: translate3d(-50%, 0, 0); + } + + @m right { + top: 50%; + right: 0; + bottom: auto; + left: auto; + transform: translate3d(0, -50%, 0); + } + + @m bottom { + width: 100%; + top: auto; + bottom: 0; + right: auto; + left: 50%; + transform: translate3d(-50%, 0, 0); + } + + @m left { + top: 50%; + right: auto; + bottom: auto; + left: 0; + transform: translate3d(0, -50%, 0); + } + } +} + +.popup-slide-top-enter, +.popup-slide-top-leave-active { + transform: translate3d(-50%, -100%, 0); +} + +.popup-slide-right-enter, +.popup-slide-right-leave-active { + transform: translate3d(100%, -50%, 0); +} + +.popup-slide-bottom-enter, +.popup-slide-bottom-leave-active { + transform: translate3d(-50%, 100%, 0); +} + +.popup-slide-left-enter, .popup-slide-left-leave-active { + transform: translate3d(-100%, -50%, 0); +} + +.popup-fade-enter, .popup-fade-leave-active { + opacity: 0; +} diff --git a/packages/vant-css/src/progress.css b/packages/vant-css/src/progress.css new file mode 100644 index 000000000..7240d06cd --- /dev/null +++ b/packages/vant-css/src/progress.css @@ -0,0 +1,33 @@ +@import './common/var.css'; + +@component-namespace van { + @b progress { + @e bar { + height: 4px; + border-radius: 4.5px; + width: 100%; + background: $c-gray-light; + position: relative; + + @e finished-portion { + border-radius: 4.5px; + height: 100%; + position: absolute; + left: 0; + display: inline-block; + } + @e pivot { + padding: 2px 0; + font-size: 8px; + position: absolute; + border-radius: 6px; + width: 28px; + background-color: $c-gray-light; + line-height: 8px; + text-align: center; + top: 50%; + transform: translate3d(0, -50%, 0); + } + } + } +} diff --git a/packages/vant-css/src/quantity.css b/packages/vant-css/src/quantity.css new file mode 100644 index 000000000..d37204c97 --- /dev/null +++ b/packages/vant-css/src/quantity.css @@ -0,0 +1,79 @@ +@import './common/var.css'; + +@component-namespace van { + @b quantity { + font-size: 0; + + @e stepper { + width: 40px; + height: 30px; + box-sizing: border-box; + background-color: $c-white; + border: 1px solid $c-gray-dark; + position: relative; + outline: 0; + padding: 5px; + vertical-align: middle; + + &::before { + width: 9px; + height: 1px; + } + + &::after { + width: 1px; + height: 9px; + } + + &::before, + &::after { + content: ''; + position: absolute; + margin: auto; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #6c6c6c; + } + } + + @e minus { + border-radius: 2px 0 0 2px; + + &::after { + display: none; + } + + @m disabled { + background-color: #f8f8f8; + border-color: #e8e8e8 #999 #e8e8e8 #e8e8e8; + } + } + + @e plus { + border-radius: 0 2px 2px 0; + + @m disabled { + background-color: #f8f8f8; + border-color: #e8e8e8 #e8e8e8 #e8e8e8 #999; + } + } + + @e input { + width: 33px; + height: 26px; + padding: 1px; + border: 1px solid $c-gray-dark; + border-width: 1px 0; + border-radius: 0; + box-sizing: content-box; + color: $c-gray-darker; + font-size: 14px; + outline: 0; + vertical-align: middle; + text-align: center; + -webkit-appearance: none; + } + } +} diff --git a/packages/vant-css/src/radio.css b/packages/vant-css/src/radio.css new file mode 100644 index 000000000..c45ade591 --- /dev/null +++ b/packages/vant-css/src/radio.css @@ -0,0 +1,48 @@ +@import "./common/var.css"; + +@component-namespace van { + @b radio { + overflow: hidden; + + @m disabled { + .van-icon { + color: #d1dbe5; + } + } + + @e input { + position: relative; + height: 22px; + float: left; + } + + @e control { + position: absolute; + top: 0; + left: 0; + width: 22px; + height: 22px; + opacity: 0; + margin: 0; + } + + @e label { + line-height: 22px; + display: block; + margin-left: 37px; + } + + .van-icon { + font-size: 22px; + line-height: 1; + } + + .van-icon-checked { + color: $c-green; + } + + .van-icon-check { + color: $c-gray-dark; + } + } +} diff --git a/packages/vant-css/src/row.css b/packages/vant-css/src/row.css new file mode 100644 index 000000000..d31edb8af --- /dev/null +++ b/packages/vant-css/src/row.css @@ -0,0 +1,8 @@ +.van-row { + &:after { + content: ""; + display: table; + clear: both; + } + zoom: 1; +} diff --git a/packages/vant-css/src/search.css b/packages/vant-css/src/search.css new file mode 100644 index 000000000..5cd27016b --- /dev/null +++ b/packages/vant-css/src/search.css @@ -0,0 +1,61 @@ +@import './common/var.css'; +@import './icon.css'; + +@component-namespace van { + @b search { + position: relative; + box-sizing: border-box; + padding: 4px 15px; + background-color: #F2F2F2; + + @m focus { + padding-right: 50px; + } + + @e input-wrap { + position: relative; + padding: 8px 24px 8px 35px; + border: 1px solid $c-gray-light; + border-radius: 4px; + background-color: $c-white; + } + + @e input { + display: block; + width: 100%; + height: 14px; + font-size: 14px; + color: $c-gray-dark; + border: none; + outline: none; + } + + @e cancel { + position: absolute; + line-height: 34px; + padding: 4px 0; + top: 0; + right: 10px; + font-size: 14px; + color: $c-green; + } + + .van-icon-search { + color: $c-gray-darker; + position: absolute; + top: 8px; + left: 10px; + font-size: 16px; + line-height: 1; + } + + .van-icon-clear { + font-size: 14px; + line-height: 1; + position: absolute; + right: 5px; + top: 9px; + color: #888; + } + } +} \ No newline at end of file diff --git a/packages/vant-css/src/steps.css b/packages/vant-css/src/steps.css new file mode 100644 index 000000000..f2b16ba8f --- /dev/null +++ b/packages/vant-css/src/steps.css @@ -0,0 +1,159 @@ +@import './common/var.css'; +@import './mixins/ellipsis.css'; +@import './icon.css'; + +@component-namespace van { + @b steps { + overflow: hidden; + padding: 0 10px; + background-color: #fff; + + @m 4 { + .van-step { + width: 33.2%; + } + } + + @m 3 { + .van-step { + width: 50%; + } + } + + @e icon { + float: left; + margin-right: 10px; + } + + .van-icon { + font-size: 40px; + line-height: 1; + } + + @e message { + display: table; + height: 40px; + margin: 15px 0; + + .van-steps__message-wrapper { + display: table-cell; + vertical-align: middle; + } + } + + @e title { + font-size: 14px; + color: $c-black; + } + + @e desc { + font-size: 12px; + line-height: 1.5; + color: $c-gray-dark; + max-height: 18px; + @mixin multi-ellipsis 1; + } + + @e items { + margin: 0 0 10px; + overflow: hidden; + position: relative; + padding-bottom: 20px; + + @m alone { + padding-top: 10px; + } + } + } + + @b step { + font-size: 14px; + float: left; + position: relative; + color: $c-gray-dark; + + @m finish { + color: $c-black; + + .van-step__circle, + .van-step__line { + background-color: $c-green; + } + } + + @m process { + color: $c-black; + + .van-step__circle-container { + top: 24px; + } + + .van-icon { + font-size: 12px; + color: $c-green; + line-height: 1; + display: block; + } + } + + &:first-child { + .van-step__title { + transform: none; + margin-left: 0; + } + } + + &:last-child { + position: absolute; + right: 10px; + width: auto; + + .van-step__title { + transform: none; + margin-left: 0; + } + + .van-step__circle-container { + left: auto; + right: -9px; + } + + .van-step__line { + width: 0; + } + } + + .van-step__circle-container { + position: absolute; + top: 28px; + left: -8px; + padding: 0 8px; + background-color: #fff; + z-index: 1; + } + + @e circle { + display: block; + width: 5px; + height: 5px; + background-color: #888; + border-radius: 50%; + } + + @e title { + font-size: 12px; + transform: translate3d(-50%, 0, 0); + display: inline-block; + margin-left: 3px; + } + + @e line { + position: absolute; + left: 0px; + top: 30px; + width: 100%; + height: 1px; + background-color: $c-gray-light; + } + } +} diff --git a/packages/vant-css/src/swipe.css b/packages/vant-css/src/swipe.css new file mode 100644 index 000000000..cd0ba4c61 --- /dev/null +++ b/packages/vant-css/src/swipe.css @@ -0,0 +1,56 @@ +@import './common/var.css'; + +@component-namespace van { + @b swipe { + position: relative; + overflow: hidden; + width: 100%; + height: 100%; + + @e indicators { + position: absolute; + bottom: 10px; + left: 50%; + transform: translateX(-50%); + } + + @e indicator { + width: 5px; + height: 5px; + display: inline-block; + border-radius: 100%; + background: #999; + opacity: .8; + margin: 0 3px; + z-index: 1; + + @m active { + background: $c-orange; + opacity: 1; + } + } + + @e items { + position: relative; + overflow: hidden; + position: relative; + height: 100%; + } + } + + @b swipe-item { + display: none; + height: 100%; + width: 100%; + text-align: center; + + img { + width: 100%; + height: auto; + } + + &:first-child { + display: block; + } + } +} diff --git a/packages/vant-css/src/switch.css b/packages/vant-css/src/switch.css new file mode 100644 index 000000000..fc827ef9b --- /dev/null +++ b/packages/vant-css/src/switch.css @@ -0,0 +1,59 @@ +@import './mixins/border_retina.css'; + +@component-namespace van { + @b switch { + height: 31px; + width: 51px; + display: inline-block; + position: relative; + background: #fff; + border-radius: 16px; + &::after{ + @mixin border-retina (top, right, bottom, left), rgba(0, 0, 0, .1); + border-width: 3px; + border-radius: 32px; + } + + @e node { + width: 28px; + height: 28px; + border-radius: 13.5px; + background-color: #fff; + position: absolute; + box-shadow: 0 3px 1px 0 rgba(0, 0, 0, .05), 0 2px 2px 0 rgba(0, 0, 0, .1), 0 3px 3px 0 rgba(0, 0, 0, .05); + left: 1px; + top: 1px; + z-index: 2; + &::after { + @mixin border-retina (top, right, bottom, left), rgba(0, 0, 0, .1); + border-radius: 27px; + } + } + + @e loading { + width: 16px; + height: 16px; + position: relative; + left: 50%; + top: 50%; + transform: translate3d(-50%, -50%, 0); + } + + @m on { + background-color: #44db5e; + &::after { border-color: #44db5e; } + .van-switch__node { + transform: translateX(20px); + } + } + + @m off { + background-color: #fff; + border-color: rgba(0, 0, 0, .1); + } + + @m disabled { + opacity: .4; + } + } +} diff --git a/packages/vant-css/src/tab.css b/packages/vant-css/src/tab.css new file mode 100644 index 000000000..d9e803a94 --- /dev/null +++ b/packages/vant-css/src/tab.css @@ -0,0 +1,122 @@ +@import './common/var.css'; +@import './mixins/border_retina.css'; + +@component-namespace van { + @b tabs { + position: relative; + + @m col-2 { + .van-tab { + width: 50%; + } + } + + @m col-3 { + .van-tab { + width: 33.33333333333333%; + } + } + + @m col-4 { + .van-tab { + width: 25%; + } + } + + @m col-5 { + .van-tab { + width: 20%; + } + } + + @e nav { + overflow: hidden; + transition: transform .5s cubic-bezier(.645, .045, .355, 1); + position: relative; + + @m line { + height: 44px; + background-color: $c-white; + &::after { + @mixin border-retina (top); + @mixin border-retina (bottom); + } + @b tabs-nav-bar { + display: block; + } + } + + @m card { + height: 28px; + margin: 0 15px; + background-color: $c-white; + border-radius: 2px; + border: 1px solid #666666; + overflow: hidden; + + .van-tab { + color: #666666; + line-height: 28px; + border-right: 1px solid #666666; + &:last-child { + border-right: none; + } + &.van-tab--active { + background-color: #666666; + color: $c-white; + } + } + } + } + + @e nav-bar { + z-index: 1; + position: absolute; + left: 0; + bottom: 0; + height: 2px; + background-color: #f13e3a; + transition: transform .3s cubic-bezier(.645, .045, .355, 1); + transform-origin: 0 0; + } + } + + @b tab { + color: $c-black; + font-size: 14px; + line-height: 44px; + box-sizing: border-box; + transition: color .3s cubic-bezier(.645, .045, .355, 1); + cursor: pointer; + text-align: center; + float: left; + + @m active { + color: #FF4444; + } + + @e pane { + display: none; + + @m select { + display: block; + } + } + } +} + + + + + + + + + + + + + + + + diff --git a/packages/vant-css/src/tag.css b/packages/vant-css/src/tag.css new file mode 100644 index 000000000..132e01930 --- /dev/null +++ b/packages/vant-css/src/tag.css @@ -0,0 +1,69 @@ +@import './common/var.css'; +@import './mixins/border_retina.css'; + +@component-namespace van { + @b tag { + position: relative; + display: inline-block; + line-height: 14px; + padding: 1px 5px; + border-radius: 2px; + font-size: 10px; + background: $c-gray; + color: $c-white; + + &::after { + @mixin border-retina (top, right, bottom, left), $c-gray; + border-radius: 4px; + } + + @m success { + background: $c-green; + + &::after { + border-color: $c-green; + } + + @when plain { + color: $c-green; + } + } + + @m danger { + background: $button-danger-background-color; + + &::after { + border-color: $button-danger-background-color; + } + + @when plain { + color: $button-danger-background-color; + } + } + + @m primary { + background: $c-blue; + + &::after { + border-color: $c-blue; + } + + @when plain { + color: $c-blue; + } + } + + @when plain { + background: $c-white; + color: $c-gray; + } + + @when mark { + border-radius: 0 8px 8px 0; + + &::after { + border-radius: 0 16px 16px 0; + } + } + } +} diff --git a/packages/vant-css/src/toast.css b/packages/vant-css/src/toast.css new file mode 100644 index 000000000..fc27bea7c --- /dev/null +++ b/packages/vant-css/src/toast.css @@ -0,0 +1,56 @@ +@import './common/var.css'; + +@component-namespace van { + @b toast { + position: fixed; + z-index: 3001; + border-radius: 5px; + background-color: #272727; + opacity: .7; + top: 50%; + left: 50%; + transform: translate3d(-50%, -50%, 0); + font-size: 12px; + color: $c-white; + text-align: center; + line-height: 12px; + + @e overlay { + position: fixed; + left: 0; + top: 0; + background: transparent; + height: 100vh; + width: 100vh; + z-index: 3000; + } + + @m loading { + padding: 45px; + } + + @m text, html { + padding: 12px; + min-width: 200px; + } + + @m default { + width: 120px; + height: 120px; + + .van-toast__icon { + padding-top: 20px; + font-size: 50px; + } + + .van-toast__text { + padding: 15px 0 20px; + font-size: 14px; + } + } + } +} + +.van-toast-fade-enter, .van-toast-fade-leave-active { + opacity: 0; +} diff --git a/packages/vant-css/src/uploader.css b/packages/vant-css/src/uploader.css new file mode 100644 index 000000000..c6499d397 --- /dev/null +++ b/packages/vant-css/src/uploader.css @@ -0,0 +1,23 @@ +@component-namespace van { + @b uploader { + position: relative; + display: inline-block; + + @e input { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + display: block; + width: 100%; + height: 100%; + opacity: 0; + cursor:pointer; + } + + input[type="file" i]::-webkit-file-upload-button { + cursor:pointer; + } + } +}