mui-sass 0.7.5 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e6e89d89e35090e22194c3461fb9a8662b5ca71
4
- data.tar.gz: ac43c85993e893f9082366b8580b05083553045f
3
+ metadata.gz: 812fecbc763791d5dd154a8d92e723f02664c562
4
+ data.tar.gz: 8d7bc80f1f71e491fc86cfc80564d93663402eec
5
5
  SHA512:
6
- metadata.gz: 8ff264429310f6ba2d86bb93ae01afb5f9d1babefbd4cb1658546ebdc280a4d5ef85fb58fc9533069017b6d68e7f8e636508ed6887d364613cf76d983140b776
7
- data.tar.gz: 1ab69866de2f61249df45bfde26d2bbf74bcece9878bf8f6ec4b8beb43a6d6a55686ef4337c18a8c4e654ce2beeafcd6e46c57ee3ba6067a6f45dec85b143c23
6
+ metadata.gz: d9e1fea5fbd2f770c09278891da775a9503c82a54fbceba9842e21e6c719429f459ab747cafbbef04ad79b20328f9a0bbb48a84e644b1ef5e9cd2d293d67085f
7
+ data.tar.gz: 03409819887debb1c88e63538189be9aacff1c385d10b5764c7a45f338cb7af78b8c350ca5ae67b4b83f4f58ed5753c5b0df969c006e3a73e7ce45b79fb3d191
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.8.1 (2016-09-21)
2
+
3
+ - Update assets to match upstream version
4
+
1
5
  ## 0.7.5 (2016-09-16)
2
6
 
3
7
  - Update assets to match upstream version
@@ -1,5 +1,5 @@
1
1
  module Mui
2
2
  module Sass
3
- VERSION = '0.7.5'
3
+ VERSION = '0.8.1'
4
4
  end
5
5
  end
@@ -1267,6 +1267,7 @@ var jqLite = require('./lib/jqLite'),
1267
1267
  cssSelector = '.mui-select > select',
1268
1268
  menuClass = 'mui-select__menu',
1269
1269
  selectedClass = 'mui--is-selected',
1270
+ disabledClass = 'mui--is-disabled',
1270
1271
  doc = document,
1271
1272
  win = window;
1272
1273
 
@@ -1404,9 +1405,9 @@ function Menu(wrapperEl, selectEl) {
1404
1405
  util.enableScrollLock();
1405
1406
 
1406
1407
  // instance variables
1407
- this.indexMap = {};
1408
- this.origIndex = null;
1409
- this.currentIndex = null;
1408
+ this.itemArray = [];
1409
+ this.origPos = null;
1410
+ this.currentPos = null;
1410
1411
  this.selectEl = selectEl;
1411
1412
  this.menuEl = this._createMenuEl(wrapperEl, selectEl);
1412
1413
  this.clickCallbackFn = util.callback(this, 'clickHandler');
@@ -1443,8 +1444,9 @@ function Menu(wrapperEl, selectEl) {
1443
1444
  Menu.prototype._createMenuEl = function(wrapperEl, selectEl) {
1444
1445
  var menuEl = doc.createElement('div'),
1445
1446
  childEls = selectEl.children,
1446
- indexNum = 0,
1447
- indexMap = this.indexMap,
1447
+ itemArray = this.itemArray,
1448
+ itemPos = 0,
1449
+ selectedPos = 0,
1448
1450
  selectedRow = 0,
1449
1451
  loopEl,
1450
1452
  rowEl,
@@ -1481,30 +1483,37 @@ Menu.prototype._createMenuEl = function(wrapperEl, selectEl) {
1481
1483
  // add row item to menu
1482
1484
  rowEl = doc.createElement('div');
1483
1485
  rowEl.textContent = loopEl.textContent;
1484
- rowEl._muiIndex = indexNum;
1485
-
1486
- // handle selected options
1487
- if (loopEl.selected) {
1488
- rowEl.className = selectedClass;
1489
- selectedRow = menuEl.children.length;
1490
- }
1491
1486
 
1492
1487
  // handle optgroup options
1493
1488
  if (inGroup) jqLite.addClass(rowEl, 'mui-optgroup__option');
1494
1489
 
1495
- menuEl.appendChild(rowEl);
1490
+ if (loopEl.disabled) {
1491
+ // do not attach muiIndex to disable <option> elements to make them
1492
+ // unselectable.
1493
+ jqLite.addClass(rowEl, disabledClass);
1494
+ } else {
1495
+ rowEl._muiIndex = loopEl.index;
1496
+ rowEl._muiPos = itemPos;
1497
+
1498
+ // handle selected options
1499
+ if (loopEl.selected) {
1500
+ jqLite.addClass(rowEl, selectedClass);
1501
+ selectedRow = menuEl.children.length;
1502
+ selectedPos = itemPos;
1503
+ }
1496
1504
 
1497
- // add to index map
1498
- indexMap[indexNum] = rowEl;
1499
- indexNum += 1;
1505
+ // add to item array
1506
+ itemArray.push(rowEl);
1507
+ itemPos += 1;
1508
+ }
1509
+
1510
+ menuEl.appendChild(rowEl);
1500
1511
  }
1501
1512
  }
1502
1513
 
1503
1514
  // save indices
1504
- var selectedIndex = selectEl.selectedIndex;
1505
-
1506
- this.origIndex = selectedIndex;
1507
- this.currentIndex = selectedIndex;
1515
+ this.origPos = selectedPos;
1516
+ this.currentPos = selectedPos;
1508
1517
 
1509
1518
  // set position
1510
1519
  var props = formlib.getMenuPositionalCSS(
@@ -1556,13 +1565,14 @@ Menu.prototype.clickHandler = function(ev) {
1556
1565
  // don't allow events to bubble
1557
1566
  ev.stopPropagation();
1558
1567
 
1559
- var index = ev.target._muiIndex;
1568
+ var item = ev.target,
1569
+ index = item._muiIndex;
1560
1570
 
1561
1571
  // ignore clicks on non-items
1562
1572
  if (index === undefined) return;
1563
1573
 
1564
1574
  // select option
1565
- this.currentIndex = index;
1575
+ this.currentPos = item._muiPos;
1566
1576
  this.selectCurrent();
1567
1577
 
1568
1578
  // destroy menu
@@ -1574,14 +1584,14 @@ Menu.prototype.clickHandler = function(ev) {
1574
1584
  * Increment selected item
1575
1585
  */
1576
1586
  Menu.prototype.increment = function() {
1577
- if (this.currentIndex === this.selectEl.length - 1) return;
1587
+ if (this.currentPos === this.itemArray.length - 1) return;
1578
1588
 
1579
1589
  // un-select old row
1580
- jqLite.removeClass(this.indexMap[this.currentIndex], selectedClass);
1590
+ jqLite.removeClass(this.itemArray[this.currentPos], selectedClass);
1581
1591
 
1582
1592
  // select new row
1583
- this.currentIndex += 1;
1584
- jqLite.addClass(this.indexMap[this.currentIndex], selectedClass);
1593
+ this.currentPos += 1;
1594
+ jqLite.addClass(this.itemArray[this.currentPos], selectedClass);
1585
1595
  }
1586
1596
 
1587
1597
 
@@ -1589,14 +1599,14 @@ Menu.prototype.increment = function() {
1589
1599
  * Decrement selected item
1590
1600
  */
1591
1601
  Menu.prototype.decrement = function() {
1592
- if (this.currentIndex === 0) return;
1602
+ if (this.currentPos === 0) return;
1593
1603
 
1594
1604
  // un-select old row
1595
- jqLite.removeClass(this.indexMap[this.currentIndex], selectedClass);
1605
+ jqLite.removeClass(this.itemArray[this.currentPos], selectedClass);
1596
1606
 
1597
1607
  // select new row
1598
- this.currentIndex -= 1;
1599
- jqLite.addClass(this.indexMap[this.currentIndex], selectedClass);
1608
+ this.currentPos -= 1;
1609
+ jqLite.addClass(this.itemArray[this.currentPos], selectedClass);
1600
1610
  }
1601
1611
 
1602
1612
 
@@ -1604,8 +1614,8 @@ Menu.prototype.decrement = function() {
1604
1614
  * Select current item
1605
1615
  */
1606
1616
  Menu.prototype.selectCurrent = function() {
1607
- if (this.currentIndex !== this.origIndex) {
1608
- this.selectEl.selectedIndex = this.currentIndex;
1617
+ if (this.currentPos !== this.origPos) {
1618
+ this.selectEl.selectedIndex = this.itemArray[this.currentPos]._muiIndex;
1609
1619
 
1610
1620
  // trigger change event
1611
1621
  util.dispatchEvent(this.selectEl, 'change');
@@ -113,7 +113,12 @@ $xFormLabelLineHeight: floor($mui-label-font-size * 1.25);
113
113
  background-color: mui-color('grey', '200');
114
114
  }
115
115
 
116
- &:not(.mui-optgroup__label):hover {
116
+ &.mui--is-disabled {
117
+ color: $mui-text-dark-hint;
118
+ cursor: $mui-cursor-disabled;
119
+ }
120
+
121
+ &:not(.mui-optgroup__label):not(.mui--is-disabled):hover {
117
122
  background-color: mui-color('grey', '300');
118
123
  }
119
124
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mui-sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Tarasov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2016-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass