diff --git a/src/components/mdAvatar/mdAvatar.scss b/src/components/mdAvatar/mdAvatar.scss index b2da95b..94aacfd 100644 --- a/src/components/mdAvatar/mdAvatar.scss +++ b/src/components/mdAvatar/mdAvatar.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; $avatar-size: 40px; $avatar-large-size: 64px; diff --git a/src/components/mdBottomBar/mdBottomBar.scss b/src/components/mdBottomBar/mdBottomBar.scss index 834a28e..79c9365 100644 --- a/src/components/mdBottomBar/mdBottomBar.scss +++ b/src/components/mdBottomBar/mdBottomBar.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; .md-bottom-bar { width: 100%; diff --git a/src/components/mdButton/mdButton.scss b/src/components/mdButton/mdButton.scss index d49022d..1103c86 100644 --- a/src/components/mdButton/mdButton.scss +++ b/src/components/mdButton/mdButton.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; $button-width: 88px; $button-height: 36px; diff --git a/src/components/mdButtonToggle/mdButtonToggle.scss b/src/components/mdButtonToggle/mdButtonToggle.scss index ba9a610..ec5f422 100644 --- a/src/components/mdButtonToggle/mdButtonToggle.scss +++ b/src/components/mdButtonToggle/mdButtonToggle.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; .md-button-toggle { .md-button:not([disabled]) { diff --git a/src/components/mdCheckbox/mdCheckbox.scss b/src/components/mdCheckbox/mdCheckbox.scss index 1ef980f..e965e3a 100644 --- a/src/components/mdCheckbox/mdCheckbox.scss +++ b/src/components/mdCheckbox/mdCheckbox.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; $checkbox-size: 20px; $checkbox-ripple-size: 48px; diff --git a/src/components/mdDivider/mdDivider.scss b/src/components/mdDivider/mdDivider.scss index 1ee19e9..cab95b0 100644 --- a/src/components/mdDivider/mdDivider.scss +++ b/src/components/mdDivider/mdDivider.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; .md-divider { height: 1px; diff --git a/src/components/mdIcon/mdIcon.scss b/src/components/mdIcon/mdIcon.scss index fc7fd26..fb8b1ec 100644 --- a/src/components/mdIcon/mdIcon.scss +++ b/src/components/mdIcon/mdIcon.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; $icon-size: 24px; diff --git a/src/components/mdInkRipple/mdInkRipple.scss b/src/components/mdInkRipple/mdInkRipple.scss index f4ec555..009c128 100644 --- a/src/components/mdInkRipple/mdInkRipple.scss +++ b/src/components/mdInkRipple/mdInkRipple.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; .md-ink-ripple { pointer-events: none; diff --git a/src/components/mdInputContainer/mdInput.vue b/src/components/mdInputContainer/mdInput.vue index 21463b8..baa24e3 100644 --- a/src/components/mdInputContainer/mdInput.vue +++ b/src/components/mdInputContainer/mdInput.vue @@ -115,9 +115,6 @@ managePlaceholderClass(this.placeholder, this.parentClasses); manageHasValueClass(this.$el.value, this.parentClasses); manageMaxlength(this.maxlength, this.$parent); - }, - beforeDestroy() { - } }; diff --git a/src/components/mdInputContainer/mdInputContainer.scss b/src/components/mdInputContainer/mdInputContainer.scss index 577aa18..0c53140 100644 --- a/src/components/mdInputContainer/mdInputContainer.scss +++ b/src/components/mdInputContainer/mdInputContainer.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; $input-size: 32px; @@ -192,11 +192,9 @@ $input-size: 32px; } } - &.md-has-select { - &:hover { - label { - color: rgba(#000, .87); - } + &.md-has-select:hover { + .md-select:after { + color: rgba(#000, .87); } } } diff --git a/src/components/mdList/mdList.scss b/src/components/mdList/mdList.scss index 2711497..6d4ca66 100644 --- a/src/components/mdList/mdList.scss +++ b/src/components/mdList/mdList.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; .md-list { margin: 0; diff --git a/src/components/mdRadio/mdRadio.scss b/src/components/mdRadio/mdRadio.scss index d766bb9..974e5f4 100644 --- a/src/components/mdRadio/mdRadio.scss +++ b/src/components/mdRadio/mdRadio.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; $radio-size: 20px; $radio-ripple-size: 48px; diff --git a/src/components/mdSelect/index.js b/src/components/mdSelect/index.js index 63bc2c6..21d3db3 100644 --- a/src/components/mdSelect/index.js +++ b/src/components/mdSelect/index.js @@ -1,8 +1,10 @@ import mdSelect from './mdSelect.vue'; +import mdOption from './mdOption.vue'; import mdSelectTheme from './mdSelect.theme'; export default function install(Vue) { Vue.component('md-select', Vue.extend(mdSelect)); + Vue.component('md-option', Vue.extend(mdOption)); window.VueMaterial.styles.push(mdSelectTheme); } diff --git a/src/components/mdSelect/mdOption.vue b/src/components/mdSelect/mdOption.vue new file mode 100644 index 0000000..d50a1e9 --- /dev/null +++ b/src/components/mdSelect/mdOption.vue @@ -0,0 +1,28 @@ + + + diff --git a/src/components/mdSelect/mdSelect.scss b/src/components/mdSelect/mdSelect.scss index 442bb4b..e681ad6 100644 --- a/src/components/mdSelect/mdSelect.scss +++ b/src/components/mdSelect/mdSelect.scss @@ -1,16 +1,13 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; .md-select { + width: 100%; min-width: 128px; - - &:hover { - &:after { - color: rgba(#000, .87); - } - } + height: 32px; + position: relative; &:after { - margin-top: 9px; + margin-top: 2px; position: absolute; top: 50%; right: 0; @@ -20,12 +17,104 @@ content: "\25BC"; } + &.md-active { + .md-select-menu { + top: -8px; + pointer-events: auto; + opacity: 1; + transform: translateY(-8px) scale3D(1, 1, 1); + transform-origin: center top; + transition: $swift-ease-out; + transition-duration: .25s; + transition-property: opacity, transform, top; + + > * { + opacity: 1; + transition: $swift-ease-in; + transition-duration: .15s; + transition-delay: .1s; + } + } + } + select { position: absolute; left: -999em; } + .md-select-value { + width: 100%; + height: 100%; + display: flex; + align-items: center; + cursor: pointer; + position: relative; + z-index: 2; + font-size: 16px; + line-height: 1.2em; + text-overflow: ellipsis; + white-space: nowrap; + } + .md-select-menu { - display: none; + min-width: 156px; + max-width: 100%; + min-height: 48px; + max-height: 256px; + display: flex; + flex-flow: column; + justify-content: stretch; + align-content: stretch; + pointer-events: none; + position: absolute; + top: -16px; + left: -16px; + z-index: 7; + background-color: #fff; + border-radius: 2px; + box-shadow: $material-shadow-2dp; + opacity: 0; + transform: scale3D(.85, .7, 1); + transition: opacity .25s $swift-ease-in-timing-function, + top .25s $swift-ease-in-timing-function, + transform 0s .25s $swift-ease-in-timing-function; + + > * { + opacity: 0; + transition: $swift-ease-out; + transition-duration: .25s; + } + } + + .md-select-menu-container { + margin: 0; + padding: 8px 0; + display: flex; + flex-flow: column; + justify-content: stretch; + align-content: stretch; + overflow-x: hidden; + overflow-y: auto; + } +} + +.md-option { + height: 48px; + min-height: 48px; + padding: 0 16px; + display: flex; + flex-flow: column; + justify-content: center; + overflow: hidden; + cursor: pointer; + position: relative; + transition: $swift-ease-out; + font-size: 16px; + line-height: 1.2em; + text-overflow: ellipsis; + white-space: nowrap; + + &:hover { + background-color: rgba(#000, .12); } } diff --git a/src/components/mdSelect/mdSelect.vue b/src/components/mdSelect/mdSelect.vue index 11222c4..aa35943 100644 --- a/src/components/mdSelect/mdSelect.vue +++ b/src/components/mdSelect/mdSelect.vue @@ -1,20 +1,33 @@ diff --git a/src/components/mdSidenav/mdSidenav.scss b/src/components/mdSidenav/mdSidenav.scss index 56d3cf0..38afc92 100644 --- a/src/components/mdSidenav/mdSidenav.scss +++ b/src/components/mdSidenav/mdSidenav.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; .md-sidenav { &.md-left .md-sidenav-content { diff --git a/src/components/mdSubheader/mdSubheader.scss b/src/components/mdSubheader/mdSubheader.scss index 6596eb7..cb1e29a 100644 --- a/src/components/mdSubheader/mdSubheader.scss +++ b/src/components/mdSubheader/mdSubheader.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; .md-subheader { min-height: 48px; diff --git a/src/components/mdSwitch/mdSwitch.scss b/src/components/mdSwitch/mdSwitch.scss index 992059b..dcee3f7 100644 --- a/src/components/mdSwitch/mdSwitch.scss +++ b/src/components/mdSwitch/mdSwitch.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; $switch-width: 34px; $switch-height: 14px; diff --git a/src/components/mdToolbar/mdToolbar.scss b/src/components/mdToolbar/mdToolbar.scss index 324a572..f23c5fd 100644 --- a/src/components/mdToolbar/mdToolbar.scss +++ b/src/components/mdToolbar/mdToolbar.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; .md-toolbar { min-height: 64px; diff --git a/src/components/mdTooltip/mdTooltip.scss b/src/components/mdTooltip/mdTooltip.scss index 325442c..12a347e 100644 --- a/src/components/mdTooltip/mdTooltip.scss +++ b/src/components/mdTooltip/mdTooltip.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; $tooltip-height: 20px; diff --git a/src/components/mdWhiteframe/mdWhiteframe.scss b/src/components/mdWhiteframe/mdWhiteframe.scss index 7579387..4b96cc1 100644 --- a/src/components/mdWhiteframe/mdWhiteframe.scss +++ b/src/components/mdWhiteframe/mdWhiteframe.scss @@ -1,4 +1,4 @@ -@import '../../core/variables.scss'; +@import '../../core/stylesheets/variables.scss'; .md-whiteframe { position: relative; diff --git a/src/core/core.vue b/src/core/core.vue index 2616b18..cfc7c25 100644 --- a/src/core/core.vue +++ b/src/core/core.vue @@ -1,25 +1,29 @@ diff --git a/src/core/directives/clickaway.js b/src/core/directives/clickaway.js new file mode 100644 index 0000000..2e14f69 --- /dev/null +++ b/src/core/directives/clickaway.js @@ -0,0 +1,26 @@ +import Vue from 'vue'; + +export default { + acceptStatement: true, + priority: 700, + update(handler) { + var self = this; + + this.handler = function(ev) { + if (!self.el.contains(ev.target)) { + let res = handler(ev); + + ev.targetVM = self.vm; + self.vm.$event = ev; + + self.vm.$event = null; + return res; + } + }; + + Vue.util.on(document.documentElement, 'click', this.handler); + }, + unbind() { + Vue.util.off(document.documentElement, 'click', this.handler); + } +}; diff --git a/src/core/structure.scss b/src/core/structure.scss deleted file mode 100644 index b4c2803..0000000 --- a/src/core/structure.scss +++ /dev/null @@ -1,17 +0,0 @@ -body { - min-height: 100%; - margin: 0; - position: relative; - -webkit-tap-highlight-color: transparent; - -webkit-touch-callout: none; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; - color: rgba(#000, .87); - font-family: $font-roboto; - font-size: 14px; - font-weight: 400; - letter-spacing: .010em; - line-height: 20px; -} diff --git a/src/core/core.theme b/src/core/stylesheets/core.theme similarity index 100% rename from src/core/core.theme rename to src/core/stylesheets/core.theme diff --git a/src/core/stylesheets/structure.scss b/src/core/stylesheets/structure.scss new file mode 100644 index 0000000..e65d0ec --- /dev/null +++ b/src/core/stylesheets/structure.scss @@ -0,0 +1,46 @@ +body { + min-height: 100%; + margin: 0; + position: relative; + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + color: rgba(#000, .87); + font-family: $font-roboto; + font-size: 14px; + font-weight: 400; + letter-spacing: .010em; + line-height: 20px; +} + +::-webkit-scrollbar { + width: 10px; + height: 10px; + box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1); + transition: $swift-ease-in-out; + background-color: rgba(0, 0, 0, .05); + + &:hover { + box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .05), + inset 0 -1px 0 rgba(0, 0, 0, .03); + background-color: rgba(0, 0, 0, .08); + } +} + +::-webkit-scrollbar-button { + display: none; +} + +::-webkit-scrollbar-corner { + background-color: transparent; +} + +::-webkit-scrollbar-thumb { + background-color: rgba(0, 0, 0, .2); + box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .05), + inset 0 -1px 0 rgba(0, 0, 0, .07); + transition: $swift-ease-in-out; +} diff --git a/src/core/type.scss b/src/core/stylesheets/type.scss similarity index 100% rename from src/core/type.scss rename to src/core/stylesheets/type.scss diff --git a/src/core/utils/commons.scss b/src/core/stylesheets/utils/commons.scss similarity index 100% rename from src/core/utils/commons.scss rename to src/core/stylesheets/utils/commons.scss diff --git a/src/core/utils/mixins.scss b/src/core/stylesheets/utils/mixins.scss similarity index 100% rename from src/core/utils/mixins.scss rename to src/core/stylesheets/utils/mixins.scss diff --git a/src/core/variables.scss b/src/core/stylesheets/variables.scss similarity index 100% rename from src/core/variables.scss rename to src/core/stylesheets/variables.scss diff --git a/src/docs/pages/List.vue b/src/docs/pages/List.vue index 759bda8..77f5383 100644 --- a/src/docs/pages/List.vue +++ b/src/docs/pages/List.vue @@ -580,7 +580,7 @@