From 9d515d3e1aadbb99a6b89dd2af29a715b5f5b9ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Thu, 28 Jan 2021 20:51:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84input=E7=BB=84=E4=BB=B6;?= =?UTF-8?q?=E4=BC=98=E5=8C=96button,icon;=E4=BC=98=E5=8C=96=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.dev.js | 2 +- build.prod.js | 2 +- src/css/reset-basic.css | 39 +-- src/form/button.wc | 18 +- src/form/input.wc | 357 +++++++++++++----------- src/form/textarea.wc | 602 ++++++++++++++++++++++++++++++++++++++++ src/icon/index.wc | 27 +- src/pager/index.wc | 4 + 8 files changed, 842 insertions(+), 209 deletions(-) create mode 100644 src/form/textarea.wc diff --git a/build.dev.js b/build.dev.js index ccd93fb..4b15b10 100644 --- a/build.dev.js +++ b/build.dev.js @@ -99,7 +99,7 @@ function mkWCFile({ style, html, js }) { .replace('unmount()', 'disconnectedCallback()') .replace( 'watch() {', - 'attributeChangedCallback(name, old, val) {\nif (val === null || old === val) {return}' + 'attributeChangedCallback(name, old, val) {\nif (old === val) {return}' ) .replace('adopted()', 'adoptedCallback()') diff --git a/build.prod.js b/build.prod.js index 5494aed..38247ef 100644 --- a/build.prod.js +++ b/build.prod.js @@ -114,7 +114,7 @@ function mkWCFile({ style, html, js }) { .replace('unmount()', 'disconnectedCallback()') .replace( 'watch() {', - 'attributeChangedCallback(name, old, val) {\nif (val === null || old === val) {return}' + 'attributeChangedCallback(name, old, val) {\nif (old === val) {return}' ) .replace('adopted()', 'adoptedCallback()') diff --git a/src/css/reset-basic.css b/src/css/reset-basic.css index 40ff760..b559871 100644 --- a/src/css/reset-basic.css +++ b/src/css/reset-basic.css @@ -17,62 +17,65 @@ * */ - -* {margin: 0;padding: 0;vertical-align: baseline;box-sizing:border-box;} -::before,::after {box-sizing:border-box;} +* {margin: 0;padding: 0;vertical-align: baseline;box-sizing: border-box;} +::before, ::after {box-sizing: border-box;} /* HTML5 display-role reset for older browsers */ -article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section,content {display: block;} -img {border:0;display:inline-block;} -ol, ul {list-style: none;} +article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,content {display: block;} +img {border: 0;display: inline-block;} +ol,ul {list-style: none;} blockquote, q {quotes: none;} -blockquote::before, blockquote::after, -q::before, q::after {content: '';content: none;} +blockquote::before, blockquote::after, q::before, q::after {content: '';content: none;} table {border-collapse: collapse;border-spacing: 0;} -a:focus,input,textarea,button:focus,input:focus,textarea:focus {outline:none;} -::-moz-focus-inner { - border:none;outline:none; -} -body {font-family:"Helvetica Neue", Arial,"WenQuanYi Micro Hei","PingFang SC","Hiragino Sans GB","Segoe UI", "Microsoft Yahei", sans-serif;-webkit-font-smoothing: antialiased;text-size-adjust: 100%;-webkit-tap-highlight-color: transparent;} -code,pre,samp {font-family:Menlo,Monaco,Consolas,"Courier New",monospace;} -[anot],[\:repeat],[\:if] {visibility:hidden;} +a:focus,input,textarea,button:focus,input:focus,textarea:focus {outline: none;} +::-moz-focus-inner {border: none;outline: none;} +body {font-family: 'Helvetica Neue', Arial, 'WenQuanYi Micro Hei', 'PingFang SC', 'Hiragino Sans GB', 'Segoe UI', 'Microsoft Yahei', sans-serif;-webkit-font-smoothing: antialiased;text-size-adjust: 100%;-webkit-tap-highlight-color: transparent;} +code, pre, samp {font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;} +[anot],[\:repeat],[\:if] {visibility: hidden;} .noselect {-webkit-touch-callout: none;-webkit-user-select: none;-moz-user-select: none;user-select: none;} -.noselect img, .noselect a {-webkit-user-drag:none;} -.text-ell {overflow:hidden; white-space:nowrap; text-overflow:ellipsis } +.noselect img, .noselect a {-webkit-user-drag: none;} +.text-ell {overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .text-thin {-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;} - :root { /* primary */ + --color-teal-a: rgba(72, 201, 176, 0.5); --color-teal-1: rgb(72, 201, 176); --color-teal-2: rgb(26, 188, 156); --color-teal-3: rgb(22, 160, 133); /* sucess */ + --color-green-a: rgba(88, 214, 141, 0.5); --color-green-1: rgb(88, 214, 141); --color-green-2: rgb(46, 204, 113); --color-green-3: rgb(39, 173, 96); /* info */ + --color-blue-a: rgba(100, 181, 246, 0.5); --color-blue-1: rgb(100, 181, 246); --color-blue-2: rgb(66, 165, 245); --color-blue-3: rgb(33, 150, 243); /* danger */ + --color-red-a: rgba(255, 107, 129, 0.5); --color-red-1: rgb(255, 107, 129); --color-red-2: rgb(255, 71, 87); --color-red-3: rgb(230, 52, 67); /* warning */ + --color-orange-a: rgba(244, 211, 19, 0.5); --color-orange-1: rgb(244, 211, 19); --color-orange-2: rgb(241, 196, 15); --color-orange-3: rgb(205, 167, 13); /* default1 */ + --color-plain-a: rgba(242, 245, 252, 0.5); --color-plain-1: rgb(242, 245, 252); --color-plain-2: rgb(232, 235, 244); --color-plain-3: rgb(218, 225, 233); /* default2 */ + --color-grey-a: rgba(206, 214, 224, 0.5); --color-grey-1: rgb(206, 214, 224); --color-grey-2: rgb(164, 176, 190); --color-grey-3: rgb(134, 144, 155); /* inverse */ + --color-dark-a: rgba(65, 91, 118, 0.5); --color-dark-1: rgb(65, 91, 118); --color-dark-2: rgb(52, 73, 94); --color-dark-3: rgb(44, 62, 80); diff --git a/src/form/button.wc b/src/form/button.wc index 0b677eb..19a97cc 100644 --- a/src/form/button.wc +++ b/src/form/button.wc @@ -146,7 +146,7 @@ } } :host(:focus-within:not([link])) { - box-shadow: 0 0 0 2px rgba(242, 245, 252, 0.5); + box-shadow: 0 0 0 2px var(--color-plain-a); } // ------------- @@ -165,7 +165,7 @@ } } :host([type='danger']:focus-within:not([link])) { - box-shadow: 0 0 0 2px rgba(255, 107, 129, 0.5); + box-shadow: 0 0 0 2px var(--color-red-a); } // ------------- @@ -184,7 +184,7 @@ } } :host([type='info']:focus-within:not([link])) { - box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.5); + box-shadow: 0 0 0 2px var(--color-blue-a); } // -------- @@ -203,7 +203,7 @@ } } :host([type='sucess']:focus-within:not([link])) { - box-shadow: 0 0 0 2px rgba(88, 214, 141, 0.5); + box-shadow: 0 0 0 2px var(--color-green-a); } // --------- @@ -222,7 +222,7 @@ } } :host([type='primary']:focus-within:not([link])) { - box-shadow: 0 0 0 2px rgba(72, 201, 176, 0.5); + box-shadow: 0 0 0 2px var(--color-teal-a); } // ---------- @@ -241,7 +241,7 @@ } } :host([type='warning']:focus-within:not([link])) { - box-shadow: 0 0 0 2px rgba(244, 211, 19, 0.5); + box-shadow: 0 0 0 2px var(--color-orange-a); } // ------- @@ -260,7 +260,7 @@ } } :host([type='inverse']:focus-within:not([link])) { - box-shadow: 0 0 0 2px rgba(65, 91, 118, 0.5); + box-shadow: 0 0 0 2px var(--color-dark-a); } // ------- @@ -279,7 +279,7 @@ } } :host([type='default']:focus-within:not([link])) { - box-shadow: 0 0 0 2px rgba(206, 214, 224, 0.5); + box-shadow: 0 0 0 2px var(--color-grey-a); } :host([loading]), @@ -423,7 +423,7 @@ export default class Button { case 'loading': case 'disabled': - this[name] = true + this[name] = val !== null break } } diff --git a/src/form/input.wc b/src/form/input.wc index 31311a5..e4f6918 100644 --- a/src/form/input.wc +++ b/src/form/input.wc @@ -1,7 +1,7 @@