Browse Source

Alteracoes moodle 3.6

MOODLE_36_STABLE
thiagourias 6 years ago
parent
commit
bcfe236430
  1. 6
      .idea/vcs.xml
  2. 1
      amd/build/alert.min.js
  3. 1
      amd/build/aria.min.js
  4. 1
      amd/build/button.min.js
  5. 1
      amd/build/carousel.min.js
  6. 1
      amd/build/collapse.min.js
  7. 1
      amd/build/drawer.min.js
  8. 1
      amd/build/dropdown.min.js
  9. 1
      amd/build/form-display-errors.min.js
  10. 1
      amd/build/loader.min.js
  11. 1
      amd/build/modal.min.js
  12. 1
      amd/build/popover.min.js
  13. 1
      amd/build/scrollspy.min.js
  14. 1
      amd/build/tab.min.js
  15. 1
      amd/build/tether.min.js
  16. 1
      amd/build/tooltip.min.js
  17. 1
      amd/build/util.min.js
  18. 216
      amd/src/alert.js
  19. 201
      amd/src/aria.js
  20. 200
      amd/src/button.js
  21. 589
      amd/src/carousel.js
  22. 455
      amd/src/collapse.js
  23. 181
      amd/src/drawer.js
  24. 549
      amd/src/dropdown.js
  25. 65
      amd/src/form-display-errors.js
  26. 76
      amd/src/loader.js
  27. 662
      amd/src/modal.js
  28. 297
      amd/src/popover.js
  29. 390
      amd/src/scrollspy.js
  30. 289
      amd/src/tab.js
  31. 1792
      amd/src/tether.js
  32. 762
      amd/src/tooltip.js
  33. 156
      amd/src/util.js
  34. 8
      classes/admin_settingspage_tabs.php
  35. 8
      classes/autoprefixer.php
  36. 6
      classes/output/block_settings_renderer.php
  37. 52
      classes/output/core/admin_renderer.php
  38. 8
      classes/output/core/course_renderer.php
  39. 6
      classes/output/core/files_renderer.php
  40. 749
      classes/output/core_course/management/renderer.php
  41. 6
      classes/output/core_question/bank_renderer.php
  42. 71
      classes/output/core_renderer.php
  43. 6
      classes/output/core_renderer_maintenance.php
  44. 6
      classes/output/gradereport_history_renderer.php
  45. 52
      classes/privacy/provider.php
  46. 106
      cli/import-bootswatch.php
  47. 153
      config.php
  48. 56
      lang/en/theme_ilb.php
  49. 5
      layout/columns1.php
  50. 5
      layout/columns2.php
  51. 5
      layout/login.php
  52. 36
      layout/login_nova_conta.php
  53. 144
      lib.php
  54. 2
      pix/fp/th.svg
  55. BIN
      pix/screenshot.jpg
  56. 35
      readme_moodle.txt
  57. 2
      scss/bootstrap.scss
  58. 4
      scss/bootstrap/LICENSE
  59. 27
      scss/bootstrap/_alert.scss
  60. 47
      scss/bootstrap/_badge.scss
  61. 8
      scss/bootstrap/_breadcrumb.scss
  62. 150
      scss/bootstrap/_button-group.scss
  63. 137
      scss/bootstrap/_buttons.scss
  64. 270
      scss/bootstrap/_card.scss
  65. 264
      scss/bootstrap/_carousel.scss
  66. 17
      scss/bootstrap/_close.scss
  67. 19
      scss/bootstrap/_code.scss
  68. 246
      scss/bootstrap/_custom-forms.scss
  69. 166
      scss/bootstrap/_dropdown.scss
  70. 267
      scss/bootstrap/_forms.scss
  71. 86
      scss/bootstrap/_functions.scss
  72. 17
      scss/bootstrap/_grid.scss
  73. 18
      scss/bootstrap/_images.scss
  74. 237
      scss/bootstrap/_input-group.scss
  75. 4
      scss/bootstrap/_jumbotron.scss
  76. 118
      scss/bootstrap/_list-group.scss
  77. 77
      scss/bootstrap/_media.scss
  78. 24
      scss/bootstrap/_mixins.scss
  79. 82
      scss/bootstrap/_modal.scss
  80. 101
      scss/bootstrap/_nav.scss
  81. 325
      scss/bootstrap/_navbar.scss
  82. 68
      scss/bootstrap/_pagination.scss
  83. 214
      scss/bootstrap/_popover.scss
  84. 38
      scss/bootstrap/_print.scss
  85. 142
      scss/bootstrap/_progress.scss
  86. 367
      scss/bootstrap/_reboot.scss
  87. 19
      scss/bootstrap/_root.scss
  88. 118
      scss/bootstrap/_tables.scss
  89. 116
      scss/bootstrap/_tooltip.scss
  90. 36
      scss/bootstrap/_transitions.scss
  91. 55
      scss/bootstrap/_type.scss
  92. 7
      scss/bootstrap/_utilities.scss
  93. 1017
      scss/bootstrap/_variables.scss
  94. 35
      scss/bootstrap/bootstrap-grid.scss
  95. 17
      scss/bootstrap/bootstrap-reboot.scss
  96. 28
      scss/bootstrap/bootstrap.scss
  97. 11
      scss/bootstrap/mixins/_alert.scss
  98. 12
      scss/bootstrap/mixins/_background-variant.scss
  99. 12
      scss/bootstrap/mixins/_badge.scss
  100. 6
      scss/bootstrap/mixins/_border-radius.scss

6
.idea/vcs.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

1
amd/build/alert.min.js

@ -0,0 +1 @@
define(["exports","jquery","./util"],function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function g(a,b,c){return b&&f(a.prototype,b),c&&f(a,c),a}Object.defineProperty(a,"__esModule",{value:!0});var h=d(b),i=d(c),j=function(a){var b="alert",c="4.0.0",d="bs.alert",f=".".concat(d),h=".data-api",j=a.fn[b],k=150,l={DISMISS:'[data-dismiss="alert"]'},m={CLOSE:"close".concat(f),CLOSED:"closed".concat(f),CLICK_DATA_API:"click".concat(f).concat(h)},n={ALERT:"alert",FADE:"fade",SHOW:"show"},o=function(){function b(a){e(this,b),this._element=a}return g(b,[{key:"close",value:function(a){a=a||this._element;var b=this._getRootElement(a),c=this._triggerCloseEvent(b);c.isDefaultPrevented()||this._removeElement(b)}},{key:"dispose",value:function(){a.removeData(this._element,d),this._element=null}},{key:"_getRootElement",value:function(b){var c=i["default"].getSelectorFromElement(b),d=!1;return c&&(d=a(c)[0]),d||(d=a(b).closest(".".concat(n.ALERT))[0]),d}},{key:"_triggerCloseEvent",value:function(b){var c=a.Event(m.CLOSE);return a(b).trigger(c),c}},{key:"_removeElement",value:function(b){var c=this;return a(b).removeClass(n.SHOW),i["default"].supportsTransitionEnd()&&a(b).hasClass(n.FADE)?void a(b).one(i["default"].TRANSITION_END,function(a){return c._destroyElement(b,a)}).emulateTransitionEnd(k):void this._destroyElement(b)}},{key:"_destroyElement",value:function(b){a(b).detach().trigger(m.CLOSED).remove()}}],[{key:"_jQueryInterface",value:function(c){return this.each(function(){var e=a(this),f=e.data(d);f||(f=new b(this),e.data(d,f)),"close"===c&&f[c](this)})}},{key:"_handleDismiss",value:function(a){return function(b){b&&b.preventDefault(),a.close(this)}}},{key:"VERSION",get:function(){return c}}]),b}();return a(document).on(m.CLICK_DATA_API,l.DISMISS,o._handleDismiss(new o)),a.fn[b]=o._jQueryInterface,a.fn[b].Constructor=o,a.fn[b].noConflict=function(){return a.fn[b]=j,o._jQueryInterface},o}(h["default"]);a["default"]=j});

1
amd/build/aria.min.js

@ -0,0 +1 @@
define(["jquery","core/pending"],function(a,b){return{init:function(){var c=!1,d=function(){c=!0},e=function(){var a=c;return c=!1,a};a('[data-toggle="dropdown"]').keydown(function(b){var c,e=b.which||b.keyCode;38==e&&d(),27==e&&(c=a(b.target).attr("aria-expanded"),b.preventDefault(),"false"==c&&a(b.target).click()),32!=e&&13!=e||(b.preventDefault(),a(b.target).click())});var f=function(c){var d=function(b){a(this).focus(),b.resolve()}.bind(c);setTimeout(d,50,new b("core/aria:delayed-focus"))};a(".dropdown").on("shown.bs.dropdown",function(b){var c=a(b.target).find('[role="menu"]'),d=!1,g=!1;c&&(d=a(c).find('[role="menuitem"]')),d&&d.length>0&&(g=e()?d[d.length-1]:d[0]),g&&f(g)}),a('.dropdown [role="menu"] [role="menuitem"]').keypress(function(b){var c,d,e=String.fromCharCode(b.which||b.keyCode),g=a(b.target).closest('[role="menu"]'),h=0,i=!1;if(g&&(i=a(g).find('[role="menuitem"]')))for(e=e.toLowerCase(),h=0;h<i.length;h++)if(c=a(i[h]),d=c.text().trim().toLowerCase(),0==d.indexOf(e)){f(c);break}}),a('.dropdown [role="menu"] [role="menuitem"]').keydown(function(b){var c=b.which||b.keyCode,d=!1,e=a(b.target).closest('[role="menu"]'),g=0,h=!1;if(e&&(h=a(e).find('[role="menuitem"]'))){if(40==c){for(g=0;g<h.length-1;g++)if(h[g]==b.target){d=h[g+1];break}d||(d=h[0])}else if(38==c){for(g=1;g<h.length;g++)if(h[g]==b.target){d=h[g-1];break}d||(d=h[h.length-1])}else 36==c?d=h[0]:35==c&&(d=h[h.length-1]);d&&(b.preventDefault(),f(d))}}),a(".dropdown").on("hidden.bs.dropdown",function(b){var c=a(b.target).find('[data-toggle="dropdown"]');c&&f(c)}),a(function(){window.setTimeout(function(b){var c=a('[role="alert"][data-aria-autofocus="true"]');c.length>0&&(a(c[0]).attr("tabindex","0"),a(c[0]).focus()),b.resolve()},300,new b("core/aria:delayed-focus"))})}}});

1
amd/build/button.min.js

@ -0,0 +1 @@
define(["exports","jquery"],function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function f(a,b,c){return b&&e(a.prototype,b),c&&e(a,c),a}Object.defineProperty(a,"__esModule",{value:!0});var g=c(b),h=function(a){var b="button",c="4.0.0",e="bs.button",g=".".concat(e),h=".data-api",i=a.fn[b],j={ACTIVE:"active",BUTTON:"btn",FOCUS:"focus"},k={DATA_TOGGLE_CARROT:'[data-toggle^="button"]',DATA_TOGGLE:'[data-toggle="buttons"]',INPUT:"input",ACTIVE:".active",BUTTON:".btn"},l={CLICK_DATA_API:"click".concat(g).concat(h),FOCUS_BLUR_DATA_API:"focus".concat(g).concat(h," ")+"blur".concat(g).concat(h)},m=function(){function b(a){d(this,b),this._element=a}return f(b,[{key:"toggle",value:function(){var b=!0,c=!0,d=a(this._element).closest(k.DATA_TOGGLE)[0];if(d){var e=a(this._element).find(k.INPUT)[0];if(e){if("radio"===e.type)if(e.checked&&a(this._element).hasClass(j.ACTIVE))b=!1;else{var f=a(d).find(k.ACTIVE)[0];f&&a(f).removeClass(j.ACTIVE)}if(b){if(e.hasAttribute("disabled")||d.hasAttribute("disabled")||e.classList.contains("disabled")||d.classList.contains("disabled"))return;e.checked=!a(this._element).hasClass(j.ACTIVE),a(e).trigger("change")}e.focus(),c=!1}}c&&this._element.setAttribute("aria-pressed",!a(this._element).hasClass(j.ACTIVE)),b&&a(this._element).toggleClass(j.ACTIVE)}},{key:"dispose",value:function(){a.removeData(this._element,e),this._element=null}}],[{key:"_jQueryInterface",value:function(c){return this.each(function(){var d=a(this).data(e);d||(d=new b(this),a(this).data(e,d)),"toggle"===c&&d[c]()})}},{key:"VERSION",get:function(){return c}}]),b}();return a(document).on(l.CLICK_DATA_API,k.DATA_TOGGLE_CARROT,function(b){b.preventDefault();var c=b.target;a(c).hasClass(j.BUTTON)||(c=a(c).closest(k.BUTTON)),m._jQueryInterface.call(a(c),"toggle")}).on(l.FOCUS_BLUR_DATA_API,k.DATA_TOGGLE_CARROT,function(b){var c=a(b.target).closest(k.BUTTON)[0];a(c).toggleClass(j.FOCUS,/^focus(in)?$/.test(b.type))}),a.fn[b]=m._jQueryInterface,a.fn[b].Constructor=m,a.fn[b].noConflict=function(){return a.fn[b]=i,m._jQueryInterface},m}(g["default"]);a["default"]=h});

1
amd/build/carousel.min.js

File diff suppressed because one or more lines are too long

1
amd/build/collapse.min.js

File diff suppressed because one or more lines are too long

1
amd/build/drawer.min.js

@ -0,0 +1 @@
define(["jquery","core/custom_interaction_events","core/log"],function(a,b,c){var d={TOGGLE_REGION:'[data-region="drawer-toggle"]',TOGGLE_ACTION:'[data-action="toggle-drawer"]',TOGGLE_TARGET:"aria-controls",TOGGLE_SIDE:"left",BODY:"body",SECTION:'.list-group-item[href*="#section-"]'},e=a(document).width()<768,f=function(){a(d.TOGGLE_REGION).length||c.debug("Page is missing a drawer region"),a(d.TOGGLE_ACTION).length||c.debug("Page is missing a drawer toggle link"),a(d.TOGGLE_REGION).each(function(b,c){var f=a(c).find(d.TOGGLE_ACTION),g=f.attr("aria-controls"),h=a(document.getElementById(g)),i="false"==f.attr("aria-expanded"),j=f.attr("data-side"),k=a(d.BODY),l=f.attr("data-preference");e&&M.util.set_user_preference(l,"false"),h.on("mousewheel DOMMouseScroll",this.preventPageScroll),i?f.attr("aria-expanded","false"):(k.addClass("drawer-open-"+j),f.attr("aria-expanded","true"))}.bind(this)),this.registerEventListeners(),e&&this.closeAll()};return f.prototype.closeAll=function(){a(d.TOGGLE_REGION).each(function(b,c){var f=a(c).find(d.TOGGLE_ACTION),g=f.attr("data-side"),h=a(d.BODY),i=f.attr("aria-controls"),j=a(document.getElementById(i)),k=f.attr("data-preference");f.attr("aria-expanded","false"),h.removeClass("drawer-open-"+g),j.attr("aria-hidden","true"),j.addClass("closed"),e||M.util.set_user_preference(k,"false")})},f.prototype.toggleDrawer=function(b){var c=a(b.target).closest("[data-action=toggle-drawer]"),f=c.attr("aria-controls"),g=a(document.getElementById(f)),h=a(d.BODY),i=c.attr("data-side"),j=c.attr("data-preference");e&&M.util.set_user_preference(j,"false"),h.addClass("drawer-ease");var k="true"==c.attr("aria-expanded");k?(h.removeClass("drawer-open-"+i),c.attr("aria-expanded","false"),g.attr("aria-hidden","true"),g.addClass("closed"),e||M.util.set_user_preference(j,"false")):(c.attr("aria-expanded","true"),g.attr("aria-hidden","false"),g.focus(),h.addClass("drawer-open-"+i),g.removeClass("closed"),e||M.util.set_user_preference(j,"true"))},f.prototype.preventPageScroll=function(b){var c=b.wheelDelta||b.originalEvent&&b.originalEvent.wheelDelta||-b.originalEvent.detail,d=this.scrollTop+a(this).outerHeight()-this.scrollHeight>=0,e=this.scrollTop<=0;(c<0&&d||c>0&&e)&&b.preventDefault()},f.prototype.registerEventListeners=function(){a(d.TOGGLE_ACTION).each(function(c,d){b.define(a(d),[b.events.activate]),a(d).on(b.events.activate,function(a,b){this.toggleDrawer(b.originalEvent),b.originalEvent.preventDefault()}.bind(this))}.bind(this)),a(d.SECTION).click(function(){e&&this.closeAll()}.bind(this))},{init:function(){return new f}}});

1
amd/build/dropdown.min.js

File diff suppressed because one or more lines are too long

1
amd/build/form-display-errors.min.js

@ -0,0 +1 @@
define(["jquery","core/event"],function(a,b){return{enhance:function(c){var d=document.getElementById(c);a(d).on(b.Events.FORM_FIELD_VALIDATION,function(b,c){b.preventDefault();var e=a(d).closest(".form-group"),f=e.find(".form-control-feedback");"TEXTAREA"==a(d).prop("tagName")&&e.find("[contenteditable]")&&(d=e.find("[contenteditable]")),""!==c?(e.addClass("has-danger"),e.data("client-validation-error",!0),a(d).addClass("is-invalid"),a(d).attr("aria-describedby",f.attr("id")),a(d).attr("aria-invalid",!0),f.attr("tabindex",0),f.html(c),f.is(":visible")||(f.show(),f.focus())):e.data("client-validation-error")===!0&&(e.removeClass("has-danger"),e.data("client-validation-error",!1),a(d).removeClass("is-invalid"),a(d).removeAttr("aria-describedby"),a(d).attr("aria-invalid",!1),f.hide())})}}});

1
amd/build/loader.min.js

@ -0,0 +1 @@
define(["jquery","./tether","core/event"],function(a,b,c){return window.jQuery=a,window.Tether=b,require(["theme_ilb/aria","theme_ilb/util","theme_ilb/alert","theme_ilb/button","theme_ilb/carousel","theme_ilb/collapse","theme_ilb/dropdown","theme_ilb/modal","theme_ilb/scrollspy","theme_ilb/tab","theme_ilb/tooltip","theme_ilb/popover"],function(b){a("body").popover({trigger:"focus",selector:"[data-toggle=popover][data-trigger!=hover]"}),a("html").popover({container:"body",selector:"[data-toggle=popover][data-trigger=hover]",trigger:"hover",delay:{hide:500}}),c.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,function(){a("body").popover({selector:'[data-toggle="popover"]',trigger:"focus"})})}),b.init()}),{}});

1
amd/build/modal.min.js

File diff suppressed because one or more lines are too long

1
amd/build/popover.min.js

@ -0,0 +1 @@
define(["exports","jquery","./tooltip"],function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function g(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function h(a,b,c){return b&&g(a.prototype,b),c&&g(a,c),a}function i(a,b){if(b&&("object"===e(b)||"function"==typeof b))return b;if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function j(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(){return k=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},k.apply(this,arguments)}Object.defineProperty(a,"__esModule",{value:!0});var l=d(b),m=d(c),n=function(a){var b="popover",c="4.0.0",d="bs.popover",g=".".concat(d),l=a.fn[b],n="bs-popover",o=new RegExp("(^|\\s)".concat(n,"\\S+"),"g"),p=k({},m["default"].Default,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'}),q=k({},m["default"].DefaultType,{content:"(string|element|function)"}),r={FADE:"fade",SHOW:"show"},s={TITLE:".popover-header",CONTENT:".popover-body"},t={HIDE:"hide".concat(g),HIDDEN:"hidden".concat(g),SHOW:"show".concat(g),SHOWN:"shown".concat(g),INSERTED:"inserted".concat(g),CLICK:"click".concat(g),FOCUSIN:"focusin".concat(g),FOCUSOUT:"focusout".concat(g),MOUSEENTER:"mouseenter".concat(g),MOUSELEAVE:"mouseleave".concat(g)},u=function(k){function l(){return f(this,l),i(this,(l.__proto__||Object.getPrototypeOf(l)).apply(this,arguments))}return j(l,k),h(l,[{key:"isWithContent",value:function(){return this.getTitle()||this._getContent()}},{key:"addAttachmentClass",value:function(b){a(this.getTipElement()).addClass("".concat(n,"-").concat(b))}},{key:"getTipElement",value:function(){return this.tip=this.tip||a(this.config.template)[0],this.tip}},{key:"setContent",value:function(){var b=a(this.getTipElement());this.setElementContent(b.find(s.TITLE),this.getTitle());var c=this._getContent();"function"==typeof c&&(c=c.call(this.element)),this.setElementContent(b.find(s.CONTENT),c),b.removeClass("".concat(r.FADE," ").concat(r.SHOW))}},{key:"_getContent",value:function(){return this.element.getAttribute("data-content")||this.config.content}},{key:"_cleanTipClass",value:function(){var b=a(this.getTipElement()),c=b.attr("class").match(o);null!==c&&c.length>0&&b.removeClass(c.join(""))}}],[{key:"_jQueryInterface",value:function(b){return this.each(function(){var c=a(this).data(d),f="object"===e(b)?b:null;if((c||!/destroy|hide/.test(b))&&(c||(c=new l(this,f),a(this).data(d,c)),"string"==typeof b)){if("undefined"==typeof c[b])throw new TypeError('No method named "'.concat(b,'"'));c[b]()}})}},{key:"VERSION",get:function(){return c}},{key:"Default",get:function(){return p}},{key:"NAME",get:function(){return b}},{key:"DATA_KEY",get:function(){return d}},{key:"Event",get:function(){return t}},{key:"EVENT_KEY",get:function(){return g}},{key:"DefaultType",get:function(){return q}}]),l}(m["default"]);return a.fn[b]=u._jQueryInterface,a.fn[b].Constructor=u,a.fn[b].noConflict=function(){return a.fn[b]=l,u._jQueryInterface},u}(l["default"]);a["default"]=n});

1
amd/build/scrollspy.min.js

File diff suppressed because one or more lines are too long

1
amd/build/tab.min.js

@ -0,0 +1 @@
define(["exports","jquery","./util"],function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function g(a,b,c){return b&&f(a.prototype,b),c&&f(a,c),a}Object.defineProperty(a,"__esModule",{value:!0});var h=d(b),i=d(c),j=function(a){var b="tab",c="4.0.0",d="bs.tab",f=".".concat(d),h=".data-api",j=a.fn[b],k=150,l={HIDE:"hide".concat(f),HIDDEN:"hidden".concat(f),SHOW:"show".concat(f),SHOWN:"shown".concat(f),CLICK_DATA_API:"click".concat(f).concat(h)},m={DROPDOWN_MENU:"dropdown-menu",ACTIVE:"active",DISABLED:"disabled",FADE:"fade",SHOW:"show"},n={DROPDOWN:".dropdown",NAV_LIST_GROUP:".nav, .list-group",ACTIVE:".active",ACTIVE_UL:"> li > .active",DATA_TOGGLE:'[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',DROPDOWN_TOGGLE:".dropdown-toggle",DROPDOWN_ACTIVE_CHILD:"> .dropdown-menu .active"},o=function(){function b(a){e(this,b),this._element=a}return g(b,[{key:"show",value:function(){var b=this;if(!(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&a(this._element).hasClass(m.ACTIVE)||a(this._element).hasClass(m.DISABLED))){var c,d,e=a(this._element).closest(n.NAV_LIST_GROUP)[0],f=i["default"].getSelectorFromElement(this._element);if(e){var g="UL"===e.nodeName?n.ACTIVE_UL:n.ACTIVE;d=a.makeArray(a(e).find(g)),d=d[d.length-1]}var h=a.Event(l.HIDE,{relatedTarget:this._element}),j=a.Event(l.SHOW,{relatedTarget:d});if(d&&a(d).trigger(h),a(this._element).trigger(j),!j.isDefaultPrevented()&&!h.isDefaultPrevented()){f&&(c=a(f)[0]),this._activate(this._element,e);var k=function(){var c=a.Event(l.HIDDEN,{relatedTarget:b._element}),e=a.Event(l.SHOWN,{relatedTarget:d});a(d).trigger(c),a(b._element).trigger(e)};c?this._activate(c,c.parentNode,k):k()}}}},{key:"dispose",value:function(){a.removeData(this._element,d),this._element=null}},{key:"_activate",value:function(b,c,d){var e,f=this;e="UL"===c.nodeName?a(c).find(n.ACTIVE_UL):a(c).children(n.ACTIVE);var g=e[0],h=d&&i["default"].supportsTransitionEnd()&&g&&a(g).hasClass(m.FADE),j=function(){return f._transitionComplete(b,g,d)};g&&h?a(g).one(i["default"].TRANSITION_END,j).emulateTransitionEnd(k):j()}},{key:"_transitionComplete",value:function(b,c,d){if(c){a(c).removeClass("".concat(m.SHOW," ").concat(m.ACTIVE));var e=a(c.parentNode).find(n.DROPDOWN_ACTIVE_CHILD)[0];e&&a(e).removeClass(m.ACTIVE),"tab"===c.getAttribute("role")&&c.setAttribute("aria-selected",!1)}if(a(b).addClass(m.ACTIVE),"tab"===b.getAttribute("role")&&b.setAttribute("aria-selected",!0),i["default"].reflow(b),a(b).addClass(m.SHOW),b.parentNode&&a(b.parentNode).hasClass(m.DROPDOWN_MENU)){var f=a(b).closest(n.DROPDOWN)[0];f&&a(f).find(n.DROPDOWN_TOGGLE).addClass(m.ACTIVE),b.setAttribute("aria-expanded",!0)}d&&d()}}],[{key:"_jQueryInterface",value:function(c){return this.each(function(){var e=a(this),f=e.data(d);if(f||(f=new b(this),e.data(d,f)),"string"==typeof c){if("undefined"==typeof f[c])throw new TypeError('No method named "'.concat(c,'"'));f[c]()}})}},{key:"VERSION",get:function(){return c}}]),b}();return a(document).on(l.CLICK_DATA_API,n.DATA_TOGGLE,function(b){b.preventDefault(),o._jQueryInterface.call(a(this),"show")}),a.fn[b]=o._jQueryInterface,a.fn[b].Constructor=o,a.fn[b].noConflict=function(){return a.fn[b]=j,o._jQueryInterface},o}(h["default"]);a["default"]=j});

1
amd/build/tether.min.js

File diff suppressed because one or more lines are too long

1
amd/build/tooltip.min.js

File diff suppressed because one or more lines are too long

1
amd/build/util.min.js

@ -0,0 +1 @@
define(["exports","jquery"],function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}Object.defineProperty(a,"__esModule",{value:!0});var d=c(b),e=function(a){function b(a){return{}.toString.call(a).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function c(){return{bindType:h.end,delegateType:h.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}}}function d(){return("undefined"==typeof window||!window.QUnit)&&{end:"transitionend"}}function e(b){var c=this,d=!1;return a(this).one(j.TRANSITION_END,function(){d=!0}),setTimeout(function(){d||j.triggerTransitionEnd(c)},b),this}function f(){h=d(),a.fn.emulateTransitionEnd=e,j.supportsTransitionEnd()&&(a.event.special[j.TRANSITION_END]=c())}function g(b){return b="function"==typeof a.escapeSelector?a.escapeSelector(b).substr(1):b.replace(/(:|\.|\[|\]|,|=|@)/g,"\\$1")}var h=!1,i=1e6,j={TRANSITION_END:"bsTransitionEnd",getUID:function(a){do a+=~~(Math.random()*i);while(document.getElementById(a));return a},getSelectorFromElement:function(b){var c=b.getAttribute("data-target");c&&"#"!==c||(c=b.getAttribute("href")||""),"#"===c.charAt(0)&&(c=g(c));try{var d=a(document).find(c);return d.length>0?c:null}catch(e){return null}},reflow:function(a){return a.offsetHeight},triggerTransitionEnd:function(b){a(b).trigger(h.end)},supportsTransitionEnd:function(){return Boolean(h)},isElement:function(a){return(a[0]||a).nodeType},typeCheckConfig:function(a,c,d){for(var e in d)if(Object.prototype.hasOwnProperty.call(d,e)){var f=d[e],g=c[e],h=g&&j.isElement(g)?"element":b(g);if(!new RegExp(f).test(h))throw new Error("".concat(a.toUpperCase(),": ")+'Option "'.concat(e,'" provided type "').concat(h,'" ')+'but expected type "'.concat(f,'".'))}}};return f(),j}(d["default"]);a["default"]=e});

216
amd/src/alert.js

@ -0,0 +1,216 @@
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Alert = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'alert';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.alert';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 150;
var Selector = {
DISMISS: '[data-dismiss="alert"]'
};
var Event = {
CLOSE: "close".concat(EVENT_KEY),
CLOSED: "closed".concat(EVENT_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
ALERT: 'alert',
FADE: 'fade',
SHOW: 'show'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Alert = function () {
function Alert(element) {
_classCallCheck(this, Alert);
this._element = element;
} // Getters
_createClass(Alert, [{
key: "close",
value: function close(element) {
element = element || this._element;
var rootElement = this._getRootElement(element);
var customEvent = this._triggerCloseEvent(rootElement);
if (customEvent.isDefaultPrevented()) {
return;
}
this._removeElement(rootElement);
}
}, {
key: "dispose",
value: function dispose() {
$.removeData(this._element, DATA_KEY);
this._element = null;
}
}, {
key: "_getRootElement",
value: function _getRootElement(element) {
var selector = _util2.default.getSelectorFromElement(element);
var parent = false;
if (selector) {
parent = $(selector)[0];
}
if (!parent) {
parent = $(element).closest(".".concat(ClassName.ALERT))[0];
}
return parent;
}
}, {
key: "_triggerCloseEvent",
value: function _triggerCloseEvent(element) {
var closeEvent = $.Event(Event.CLOSE);
$(element).trigger(closeEvent);
return closeEvent;
}
}, {
key: "_removeElement",
value: function _removeElement(element) {
var _this = this;
$(element).removeClass(ClassName.SHOW);
if (!_util2.default.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) {
this._destroyElement(element);
return;
}
$(element).one(_util2.default.TRANSITION_END, function (event) {
return _this._destroyElement(element, event);
}).emulateTransitionEnd(TRANSITION_DURATION);
}
}, {
key: "_destroyElement",
value: function _destroyElement(element) {
$(element).detach().trigger(Event.CLOSED).remove();
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Alert(this);
$element.data(DATA_KEY, data);
}
if (config === 'close') {
data[config](this);
}
});
}
}, {
key: "_handleDismiss",
value: function _handleDismiss(alertInstance) {
return function (event) {
if (event) {
event.preventDefault();
}
alertInstance.close(this);
};
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return Alert;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Alert._jQueryInterface;
$.fn[NAME].Constructor = Alert;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Alert._jQueryInterface;
};
return Alert;
}(_jquery2.default);
exports.default = Alert;
});

201
amd/src/aria.js

@ -0,0 +1,201 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Enhancements to Bootstrap components for accessibility.
*
* @module theme_ilb/aria
* @copyright 2018 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/pending'], function($, Pending) {
return {
init: function() {
// Drop downs from bootstrap don't support keyboard accessibility by default.
var focusEnd = false,
setFocusEnd = function() {
focusEnd = true;
},
getFocusEnd = function() {
var result = focusEnd;
focusEnd = false;
return result;
};
// Special handling for "up" keyboard control.
$('[data-toggle="dropdown"]').keydown(function(e) {
var trigger = e.which || e.keyCode,
expanded;
// Up key opens the menu at the end.
if (trigger == 38) {
// Focus the end of the menu, not the beginning.
setFocusEnd();
}
// Escape key only closes the menu, it doesn't open it.
if (trigger == 27) {
expanded = $(e.target).attr('aria-expanded');
e.preventDefault();
if (expanded == "false") {
$(e.target).click();
}
}
// Space key or Enter key opens the menu.
if (trigger == 32 || trigger == 13) {
// Cancel random scroll.
e.preventDefault();
// Open the menu instead.
$(e.target).click();
}
});
// Special handling for navigation keys when menu is open.
var shiftFocus = function(element) {
var delayedFocus = function(pendingPromise) {
$(this).focus();
pendingPromise.resolve();
}.bind(element);
setTimeout(delayedFocus, 50, new Pending('core/aria:delayed-focus'));
};
$('.dropdown').on('shown.bs.dropdown', function(e) {
// We need to focus on the first menuitem.
var menu = $(e.target).find('[role="menu"]'),
menuItems = false,
foundMenuItem = false;
if (menu) {
menuItems = $(menu).find('[role="menuitem"]');
}
if (menuItems && menuItems.length > 0) {
if (getFocusEnd()) {
foundMenuItem = menuItems[menuItems.length - 1];
} else {
// The first menu entry, pretty reasonable.
foundMenuItem = menuItems[0];
}
}
if (foundMenuItem) {
shiftFocus(foundMenuItem);
}
});
// Search for menu items by finding the first item that has
// text starting with the typed character (case insensitive).
$('.dropdown [role="menu"] [role="menuitem"]').keypress(function(e) {
var trigger = String.fromCharCode(e.which || e.keyCode),
menu = $(e.target).closest('[role="menu"]'),
i = 0,
menuItems = false,
item,
itemText;
if (!menu) {
return;
}
menuItems = $(menu).find('[role="menuitem"]');
if (!menuItems) {
return;
}
trigger = trigger.toLowerCase();
for (i = 0; i < menuItems.length; i++) {
item = $(menuItems[i]);
itemText = item.text().trim().toLowerCase();
if (itemText.indexOf(trigger) == 0) {
shiftFocus(item);
break;
}
}
});
// Keyboard navigation for arrow keys, home and end keys.
$('.dropdown [role="menu"] [role="menuitem"]').keydown(function(e) {
var trigger = e.which || e.keyCode,
next = false,
menu = $(e.target).closest('[role="menu"]'),
i = 0,
menuItems = false;
if (!menu) {
return;
}
menuItems = $(menu).find('[role="menuitem"]');
if (!menuItems) {
return;
}
// Down key.
if (trigger == 40) {
for (i = 0; i < menuItems.length - 1; i++) {
if (menuItems[i] == e.target) {
next = menuItems[i + 1];
break;
}
}
if (!next) {
// Wrap to first item.
next = menuItems[0];
}
} else if (trigger == 38) {
// Up key.
for (i = 1; i < menuItems.length; i++) {
if (menuItems[i] == e.target) {
next = menuItems[i - 1];
break;
}
}
if (!next) {
// Wrap to last item.
next = menuItems[menuItems.length - 1];
}
} else if (trigger == 36) {
// Home key.
next = menuItems[0];
} else if (trigger == 35) {
// End key.
next = menuItems[menuItems.length - 1];
}
// Variable next is set if we do want to act on the keypress.
if (next) {
e.preventDefault();
shiftFocus(next);
}
return;
});
$('.dropdown').on('hidden.bs.dropdown', function(e) {
// We need to focus on the menu trigger.
var trigger = $(e.target).find('[data-toggle="dropdown"]');
if (trigger) {
shiftFocus(trigger);
}
});
// After page load, focus on any element with special autofocus attribute.
$(function() {
window.setTimeout(function(pendingPromise) {
var alerts = $('[role="alert"][data-aria-autofocus="true"]');
if (alerts.length > 0) {
$(alerts[0]).attr('tabindex', '0');
$(alerts[0]).focus();
}
pendingPromise.resolve();
}, 300, new Pending('core/aria:delayed-focus'));
});
}
};
});

200
amd/src/button.js

@ -0,0 +1,200 @@
define(["exports", "jquery"], function (exports, _jquery) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Button = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'button';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.button';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var ClassName = {
ACTIVE: 'active',
BUTTON: 'btn',
FOCUS: 'focus'
};
var Selector = {
DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
DATA_TOGGLE: '[data-toggle="buttons"]',
INPUT: 'input',
ACTIVE: '.active',
BUTTON: '.btn'
};
var Event = {
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY),
FOCUS_BLUR_DATA_API: "focus".concat(EVENT_KEY).concat(DATA_API_KEY, " ") + "blur".concat(EVENT_KEY).concat(DATA_API_KEY)
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Button = function () {
function Button(element) {
_classCallCheck(this, Button);
this._element = element;
} // Getters
_createClass(Button, [{
key: "toggle",
value: function toggle() {
var triggerChangeEvent = true;
var addAriaPressed = true;
var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
if (rootElement) {
var input = $(this._element).find(Selector.INPUT)[0];
if (input) {
if (input.type === 'radio') {
if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) {
triggerChangeEvent = false;
} else {
var activeElement = $(rootElement).find(Selector.ACTIVE)[0];
if (activeElement) {
$(activeElement).removeClass(ClassName.ACTIVE);
}
}
}
if (triggerChangeEvent) {
if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
return;
}
input.checked = !$(this._element).hasClass(ClassName.ACTIVE);
$(input).trigger('change');
}
input.focus();
addAriaPressed = false;
}
}
if (addAriaPressed) {
this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
}
if (triggerChangeEvent) {
$(this._element).toggleClass(ClassName.ACTIVE);
}
}
}, {
key: "dispose",
value: function dispose() {
$.removeData(this._element, DATA_KEY);
this._element = null;
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
if (!data) {
data = new Button(this);
$(this).data(DATA_KEY, data);
}
if (config === 'toggle') {
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return Button;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
event.preventDefault();
var button = event.target;
if (!$(button).hasClass(ClassName.BUTTON)) {
button = $(button).closest(Selector.BUTTON);
}
Button._jQueryInterface.call($(button), 'toggle');
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
var button = $(event.target).closest(Selector.BUTTON)[0];
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Button._jQueryInterface;
$.fn[NAME].Constructor = Button;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Button._jQueryInterface;
};
return Button;
}(_jquery2.default);
exports.default = Button;
});

589
amd/src/carousel.js

@ -0,0 +1,589 @@
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Carousel = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'carousel';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.carousel';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 600;
var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
var Default = {
interval: 5000,
keyboard: true,
slide: false,
pause: 'hover',
wrap: true
};
var DefaultType = {
interval: '(number|boolean)',
keyboard: 'boolean',
slide: '(boolean|string)',
pause: '(string|boolean)',
wrap: 'boolean'
};
var Direction = {
NEXT: 'next',
PREV: 'prev',
LEFT: 'left',
RIGHT: 'right'
};
var Event = {
SLIDE: "slide".concat(EVENT_KEY),
SLID: "slid".concat(EVENT_KEY),
KEYDOWN: "keydown".concat(EVENT_KEY),
MOUSEENTER: "mouseenter".concat(EVENT_KEY),
MOUSELEAVE: "mouseleave".concat(EVENT_KEY),
TOUCHEND: "touchend".concat(EVENT_KEY),
LOAD_DATA_API: "load".concat(EVENT_KEY).concat(DATA_API_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
CAROUSEL: 'carousel',
ACTIVE: 'active',
SLIDE: 'slide',
RIGHT: 'carousel-item-right',
LEFT: 'carousel-item-left',
NEXT: 'carousel-item-next',
PREV: 'carousel-item-prev',
ITEM: 'carousel-item'
};
var Selector = {
ACTIVE: '.active',
ACTIVE_ITEM: '.active.carousel-item',
ITEM: '.carousel-item',
NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
INDICATORS: '.carousel-indicators',
DATA_SLIDE: '[data-slide], [data-slide-to]',
DATA_RIDE: '[data-ride="carousel"]'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Carousel = function () {
function Carousel(element, config) {
_classCallCheck(this, Carousel);
this._items = null;
this._interval = null;
this._activeElement = null;
this._isPaused = false;
this._isSliding = false;
this.touchTimeout = null;
this._config = this._getConfig(config);
this._element = $(element)[0];
this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0];
this._addEventListeners();
} // Getters
_createClass(Carousel, [{
key: "next",
value: function next() {
if (!this._isSliding) {
this._slide(Direction.NEXT);
}
}
}, {
key: "nextWhenVisible",
value: function nextWhenVisible() {
// Don't call next when the page isn't visible
// or the carousel or its parent isn't visible
if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
this.next();
}
}
}, {
key: "prev",
value: function prev() {
if (!this._isSliding) {
this._slide(Direction.PREV);
}
}
}, {
key: "pause",
value: function pause(event) {
if (!event) {
this._isPaused = true;
}
if ($(this._element).find(Selector.NEXT_PREV)[0] && _util2.default.supportsTransitionEnd()) {
_util2.default.triggerTransitionEnd(this._element);
this.cycle(true);
}
clearInterval(this._interval);
this._interval = null;
}
}, {
key: "cycle",
value: function cycle(event) {
if (!event) {
this._isPaused = false;
}
if (this._interval) {
clearInterval(this._interval);
this._interval = null;
}
if (this._config.interval && !this._isPaused) {
this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
}
}
}, {
key: "to",
value: function to(index) {
var _this = this;
this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
var activeIndex = this._getItemIndex(this._activeElement);
if (index > this._items.length - 1 || index < 0) {
return;
}
if (this._isSliding) {
$(this._element).one(Event.SLID, function () {
return _this.to(index);
});
return;
}
if (activeIndex === index) {
this.pause();
this.cycle();
return;
}
var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
this._slide(direction, this._items[index]);
}
}, {
key: "dispose",
value: function dispose() {
$(this._element).off(EVENT_KEY);
$.removeData(this._element, DATA_KEY);
this._items = null;
this._config = null;
this._element = null;
this._interval = null;
this._isPaused = null;
this._isSliding = null;
this._activeElement = null;
this._indicatorsElement = null;
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _extends({}, Default, config);
_util2.default.typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: "_addEventListeners",
value: function _addEventListeners() {
var _this2 = this;
if (this._config.keyboard) {
$(this._element).on(Event.KEYDOWN, function (event) {
return _this2._keydown(event);
});
}
if (this._config.pause === 'hover') {
$(this._element).on(Event.MOUSEENTER, function (event) {
return _this2.pause(event);
}).on(Event.MOUSELEAVE, function (event) {
return _this2.cycle(event);
});
if ('ontouchstart' in document.documentElement) {
// If it's a touch-enabled device, mouseenter/leave are fired as
// part of the mouse compatibility events on first tap - the carousel
// would stop cycling until user tapped out of it;
// here, we listen for touchend, explicitly pause the carousel
// (as if it's the second time we tap on it, mouseenter compat event
// is NOT fired) and after a timeout (to allow for mouse compatibility
// events to fire) we explicitly restart cycling
$(this._element).on(Event.TOUCHEND, function () {
_this2.pause();
if (_this2.touchTimeout) {
clearTimeout(_this2.touchTimeout);
}
_this2.touchTimeout = setTimeout(function (event) {
return _this2.cycle(event);
}, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval);
});
}
}
}
}, {
key: "_keydown",
value: function _keydown(event) {
if (/input|textarea/i.test(event.target.tagName)) {
return;
}
switch (event.which) {
case ARROW_LEFT_KEYCODE:
event.preventDefault();
this.prev();
break;
case ARROW_RIGHT_KEYCODE:
event.preventDefault();
this.next();
break;
default:
}
}
}, {
key: "_getItemIndex",
value: function _getItemIndex(element) {
this._items = $.makeArray($(element).parent().find(Selector.ITEM));
return this._items.indexOf(element);
}
}, {
key: "_getItemByDirection",
value: function _getItemByDirection(direction, activeElement) {
var isNextDirection = direction === Direction.NEXT;
var isPrevDirection = direction === Direction.PREV;
var activeIndex = this._getItemIndex(activeElement);
var lastItemIndex = this._items.length - 1;
var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
if (isGoingToWrap && !this._config.wrap) {
return activeElement;
}
var delta = direction === Direction.PREV ? -1 : 1;
var itemIndex = (activeIndex + delta) % this._items.length;
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
}
}, {
key: "_triggerSlideEvent",
value: function _triggerSlideEvent(relatedTarget, eventDirectionName) {
var targetIndex = this._getItemIndex(relatedTarget);
var fromIndex = this._getItemIndex($(this._element).find(Selector.ACTIVE_ITEM)[0]);
var slideEvent = $.Event(Event.SLIDE, {
relatedTarget: relatedTarget,
direction: eventDirectionName,
from: fromIndex,
to: targetIndex
});
$(this._element).trigger(slideEvent);
return slideEvent;
}
}, {
key: "_setActiveIndicatorElement",
value: function _setActiveIndicatorElement(element) {
if (this._indicatorsElement) {
$(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
if (nextIndicator) {
$(nextIndicator).addClass(ClassName.ACTIVE);
}
}
}
}, {
key: "_slide",
value: function _slide(direction, element) {
var _this3 = this;
var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
var activeElementIndex = this._getItemIndex(activeElement);
var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
var nextElementIndex = this._getItemIndex(nextElement);
var isCycling = Boolean(this._interval);
var directionalClassName;
var orderClassName;
var eventDirectionName;
if (direction === Direction.NEXT) {
directionalClassName = ClassName.LEFT;
orderClassName = ClassName.NEXT;
eventDirectionName = Direction.LEFT;
} else {
directionalClassName = ClassName.RIGHT;
orderClassName = ClassName.PREV;
eventDirectionName = Direction.RIGHT;
}
if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
this._isSliding = false;
return;
}
var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
if (slideEvent.isDefaultPrevented()) {
return;
}
if (!activeElement || !nextElement) {
// Some weirdness is happening, so we bail
return;
}
this._isSliding = true;
if (isCycling) {
this.pause();
}
this._setActiveIndicatorElement(nextElement);
var slidEvent = $.Event(Event.SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex
});
if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) {
$(nextElement).addClass(orderClassName);
_util2.default.reflow(nextElement);
$(activeElement).addClass(directionalClassName);
$(nextElement).addClass(directionalClassName);
$(activeElement).one(_util2.default.TRANSITION_END, function () {
$(nextElement).removeClass("".concat(directionalClassName, " ").concat(orderClassName)).addClass(ClassName.ACTIVE);
$(activeElement).removeClass("".concat(ClassName.ACTIVE, " ").concat(orderClassName, " ").concat(directionalClassName));
_this3._isSliding = false;
setTimeout(function () {
return $(_this3._element).trigger(slidEvent);
}, 0);
}).emulateTransitionEnd(TRANSITION_DURATION);
} else {
$(activeElement).removeClass(ClassName.ACTIVE);
$(nextElement).addClass(ClassName.ACTIVE);
this._isSliding = false;
$(this._element).trigger(slidEvent);
}
if (isCycling) {
this.cycle();
}
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = _extends({}, Default, $(this).data());
if (_typeof(config) === 'object') {
_config = _extends({}, _config, config);
}
var action = typeof config === 'string' ? config : _config.slide;
if (!data) {
data = new Carousel(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'number') {
data.to(config);
} else if (typeof action === 'string') {
if (typeof data[action] === 'undefined') {
throw new TypeError("No method named \"".concat(action, "\""));
}
data[action]();
} else if (_config.interval) {
data.pause();
data.cycle();
}
});
}
}, {
key: "_dataApiClickHandler",
value: function _dataApiClickHandler(event) {
var selector = _util2.default.getSelectorFromElement(this);
if (!selector) {
return;
}
var target = $(selector)[0];
if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
return;
}
var config = _extends({}, $(target).data(), $(this).data());
var slideIndex = this.getAttribute('data-slide-to');
if (slideIndex) {
config.interval = false;
}
Carousel._jQueryInterface.call($(target), config);
if (slideIndex) {
$(target).data(DATA_KEY).to(slideIndex);
}
event.preventDefault();
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return Carousel;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
$(window).on(Event.LOAD_DATA_API, function () {
$(Selector.DATA_RIDE).each(function () {
var $carousel = $(this);
Carousel._jQueryInterface.call($carousel, $carousel.data());
});
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Carousel._jQueryInterface;
$.fn[NAME].Constructor = Carousel;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Carousel._jQueryInterface;
};
return Carousel;
}(_jquery2.default);
exports.default = Carousel;
});

455
amd/src/collapse.js

@ -0,0 +1,455 @@
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Collapse = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'collapse';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.collapse';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 600;
var Default = {
toggle: true,
parent: ''
};
var DefaultType = {
toggle: 'boolean',
parent: '(string|element)'
};
var Event = {
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
SHOW: 'show',
COLLAPSE: 'collapse',
COLLAPSING: 'collapsing',
COLLAPSED: 'collapsed'
};
var Dimension = {
WIDTH: 'width',
HEIGHT: 'height'
};
var Selector = {
ACTIVES: '.show, .collapsing',
DATA_TOGGLE: '[data-toggle="collapse"]'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Collapse = function () {
function Collapse(element, config) {
_classCallCheck(this, Collapse);
this._isTransitioning = false;
this._element = element;
this._config = this._getConfig(config);
this._triggerArray = $.makeArray($("[data-toggle=\"collapse\"][href=\"#".concat(element.id, "\"],") + "[data-toggle=\"collapse\"][data-target=\"#".concat(element.id, "\"]")));
var tabToggles = $(Selector.DATA_TOGGLE);
for (var i = 0; i < tabToggles.length; i++) {
var elem = tabToggles[i];
var selector = _util2.default.getSelectorFromElement(elem);
if (selector !== null && $(selector).filter(element).length > 0) {
this._selector = selector;
this._triggerArray.push(elem);
}
}
this._parent = this._config.parent ? this._getParent() : null;
if (!this._config.parent) {
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
}
if (this._config.toggle) {
this.toggle();
}
} // Getters
_createClass(Collapse, [{
key: "toggle",
value: function toggle() {
if ($(this._element).hasClass(ClassName.SHOW)) {
this.hide();
} else {
this.show();
}
}
}, {
key: "show",
value: function show() {
var _this = this;
if (this._isTransitioning || $(this._element).hasClass(ClassName.SHOW)) {
return;
}
var actives;
var activesData;
if (this._parent) {
actives = $.makeArray($(this._parent).find(Selector.ACTIVES).filter("[data-parent=\"".concat(this._config.parent, "\"]")));
if (actives.length === 0) {
actives = null;
}
}
if (actives) {
activesData = $(actives).not(this._selector).data(DATA_KEY);
if (activesData && activesData._isTransitioning) {
return;
}
}
var startEvent = $.Event(Event.SHOW);
$(this._element).trigger(startEvent);
if (startEvent.isDefaultPrevented()) {
return;
}
if (actives) {
Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
if (!activesData) {
$(actives).data(DATA_KEY, null);
}
}
var dimension = this._getDimension();
$(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
this._element.style[dimension] = 0;
if (this._triggerArray.length > 0) {
$(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
}
this.setTransitioning(true);
var complete = function complete() {
$(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
_this._element.style[dimension] = '';
_this.setTransitioning(false);
$(_this._element).trigger(Event.SHOWN);
};
if (!_util2.default.supportsTransitionEnd()) {
complete();
return;
}
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
var scrollSize = "scroll".concat(capitalizedDimension);
$(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
this._element.style[dimension] = "".concat(this._element[scrollSize], "px");
}
}, {
key: "hide",
value: function hide() {
var _this2 = this;
if (this._isTransitioning || !$(this._element).hasClass(ClassName.SHOW)) {
return;
}
var startEvent = $.Event(Event.HIDE);
$(this._element).trigger(startEvent);
if (startEvent.isDefaultPrevented()) {
return;
}
var dimension = this._getDimension();
this._element.style[dimension] = "".concat(this._element.getBoundingClientRect()[dimension], "px");
_util2.default.reflow(this._element);
$(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
if (this._triggerArray.length > 0) {
for (var i = 0; i < this._triggerArray.length; i++) {
var trigger = this._triggerArray[i];
var selector = _util2.default.getSelectorFromElement(trigger);
if (selector !== null) {
var $elem = $(selector);
if (!$elem.hasClass(ClassName.SHOW)) {
$(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
}
}
}
}
this.setTransitioning(true);
var complete = function complete() {
_this2.setTransitioning(false);
$(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
};
this._element.style[dimension] = '';
if (!_util2.default.supportsTransitionEnd()) {
complete();
return;
}
$(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
}
}, {
key: "setTransitioning",
value: function setTransitioning(isTransitioning) {
this._isTransitioning = isTransitioning;
}
}, {
key: "dispose",
value: function dispose() {
$.removeData(this._element, DATA_KEY);
this._config = null;
this._parent = null;
this._element = null;
this._triggerArray = null;
this._isTransitioning = null;
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _extends({}, Default, config);
config.toggle = Boolean(config.toggle); // Coerce string values
_util2.default.typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: "_getDimension",
value: function _getDimension() {
var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
}
}, {
key: "_getParent",
value: function _getParent() {
var _this3 = this;
var parent = null;
if (_util2.default.isElement(this._config.parent)) {
parent = this._config.parent; // It's a jQuery object
if (typeof this._config.parent.jquery !== 'undefined') {
parent = this._config.parent[0];
}
} else {
parent = $(this._config.parent)[0];
}
var selector = "[data-toggle=\"collapse\"][data-parent=\"".concat(this._config.parent, "\"]");
$(parent).find(selector).each(function (i, element) {
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
});
return parent;
}
}, {
key: "_addAriaAndCollapsedClass",
value: function _addAriaAndCollapsedClass(element, triggerArray) {
if (element) {
var isOpen = $(element).hasClass(ClassName.SHOW);
if (triggerArray.length > 0) {
$(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
}
}
}
}], [{
key: "_getTargetFromElement",
value: function _getTargetFromElement(element) {
var selector = _util2.default.getSelectorFromElement(element);
return selector ? $(selector)[0] : null;
}
}, {
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var $this = $(this);
var data = $this.data(DATA_KEY);
var _config = _extends({}, Default, $this.data(), _typeof(config) === 'object' && config);
if (!data && _config.toggle && /show|hide/.test(config)) {
_config.toggle = false;
}
if (!data) {
data = new Collapse(this, _config);
$this.data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return Collapse;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.currentTarget.tagName === 'A') {
event.preventDefault();
}
var $trigger = $(this);
var selector = _util2.default.getSelectorFromElement(this);
$(selector).each(function () {
var $target = $(this);
var data = $target.data(DATA_KEY);
var config = data ? 'toggle' : $trigger.data();
Collapse._jQueryInterface.call($target, config);
});
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Collapse._jQueryInterface;
$.fn[NAME].Constructor = Collapse;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Collapse._jQueryInterface;
};
return Collapse;
}(_jquery2.default);
exports.default = Collapse;
});

181
amd/src/drawer.js

@ -0,0 +1,181 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Contain the logic for a drawer.
*
* @package theme_ilb
* @copyright 2016 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/custom_interaction_events', 'core/log'],
function($, CustomEvents, Log) {
var SELECTORS = {
TOGGLE_REGION: '[data-region="drawer-toggle"]',
TOGGLE_ACTION: '[data-action="toggle-drawer"]',
TOGGLE_TARGET: 'aria-controls',
TOGGLE_SIDE: 'left',
BODY: 'body',
SECTION: '.list-group-item[href*="#section-"]'
};
var small = $(document).width() < 768;
/**
* Constructor for the Drawer.
*
* @param {object} root The root jQuery element for the modal
*/
var Drawer = function() {
if (!$(SELECTORS.TOGGLE_REGION).length) {
Log.debug('Page is missing a drawer region');
}
if (!$(SELECTORS.TOGGLE_ACTION).length) {
Log.debug('Page is missing a drawer toggle link');
}
$(SELECTORS.TOGGLE_REGION).each(function(index, ele) {
var trigger = $(ele).find(SELECTORS.TOGGLE_ACTION);
var drawerid = trigger.attr('aria-controls');
var drawer = $(document.getElementById(drawerid));
var hidden = trigger.attr('aria-expanded') == 'false';
var side = trigger.attr('data-side');
var body = $(SELECTORS.BODY);
var preference = trigger.attr('data-preference');
if (small) {
M.util.set_user_preference(preference, 'false');
}
drawer.on('mousewheel DOMMouseScroll', this.preventPageScroll);
if (!hidden) {
body.addClass('drawer-open-' + side);
trigger.attr('aria-expanded', 'true');
} else {
trigger.attr('aria-expanded', 'false');
}
}.bind(this));
this.registerEventListeners();
if (small) {
this.closeAll();
}
};
Drawer.prototype.closeAll = function() {
$(SELECTORS.TOGGLE_REGION).each(function(index, ele) {
var trigger = $(ele).find(SELECTORS.TOGGLE_ACTION);
var side = trigger.attr('data-side');
var body = $(SELECTORS.BODY);
var drawerid = trigger.attr('aria-controls');
var drawer = $(document.getElementById(drawerid));
var preference = trigger.attr('data-preference');
trigger.attr('aria-expanded', 'false');
body.removeClass('drawer-open-' + side);
drawer.attr('aria-hidden', 'true');
drawer.addClass('closed');
if (!small) {
M.util.set_user_preference(preference, 'false');
}
});
};
/**
* Open / close the blocks drawer.
*
* @method toggleDrawer
* @param {Event} e
*/
Drawer.prototype.toggleDrawer = function(e) {
var trigger = $(e.target).closest('[data-action=toggle-drawer]');
var drawerid = trigger.attr('aria-controls');
var drawer = $(document.getElementById(drawerid));
var body = $(SELECTORS.BODY);
var side = trigger.attr('data-side');
var preference = trigger.attr('data-preference');
if (small) {
M.util.set_user_preference(preference, 'false');
}
body.addClass('drawer-ease');
var open = trigger.attr('aria-expanded') == 'true';
if (!open) {
// Open.
trigger.attr('aria-expanded', 'true');
drawer.attr('aria-hidden', 'false');
drawer.focus();
body.addClass('drawer-open-' + side);
drawer.removeClass('closed');
if (!small) {
M.util.set_user_preference(preference, 'true');
}
} else {
// Close.
body.removeClass('drawer-open-' + side);
trigger.attr('aria-expanded', 'false');
drawer.attr('aria-hidden', 'true');
drawer.addClass('closed');
if (!small) {
M.util.set_user_preference(preference, 'false');
}
}
};
/**
* Prevent the page from scrolling when the drawer is at max scroll.
*
* @method preventPageScroll
* @param {Event} e
*/
Drawer.prototype.preventPageScroll = function(e) {
var delta = e.wheelDelta || (e.originalEvent && e.originalEvent.wheelDelta) || -e.originalEvent.detail,
bottomOverflow = (this.scrollTop + $(this).outerHeight() - this.scrollHeight) >= 0,
topOverflow = this.scrollTop <= 0;
if ((delta < 0 && bottomOverflow) || (delta > 0 && topOverflow)) {
e.preventDefault();
}
};
/**
* Set up all of the event handling for the modal.
*
* @method registerEventListeners
*/
Drawer.prototype.registerEventListeners = function() {
$(SELECTORS.TOGGLE_ACTION).each(function(index, element) {
CustomEvents.define($(element), [CustomEvents.events.activate]);
$(element).on(CustomEvents.events.activate, function(e, data) {
this.toggleDrawer(data.originalEvent);
data.originalEvent.preventDefault();
}.bind(this));
}.bind(this));
$(SELECTORS.SECTION).click(function() {
if (small) {
this.closeAll();
}
}.bind(this));
};
return {
'init': function() {
return new Drawer();
}
};
});

549
amd/src/dropdown.js

@ -0,0 +1,549 @@
define(["exports", "jquery", "core/popper", "./util"], function (exports, _jquery, _popper, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _popper2 = _interopRequireDefault(_popper);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Dropdown = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'dropdown';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.dropdown';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
var REGEXP_KEYDOWN = new RegExp("".concat(ARROW_UP_KEYCODE, "|").concat(ARROW_DOWN_KEYCODE, "|").concat(ESCAPE_KEYCODE));
var Event = {
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
CLICK: "click".concat(EVENT_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY),
KEYDOWN_DATA_API: "keydown".concat(EVENT_KEY).concat(DATA_API_KEY),
KEYUP_DATA_API: "keyup".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
DISABLED: 'disabled',
SHOW: 'show',
DROPUP: 'dropup',
DROPRIGHT: 'dropright',
DROPLEFT: 'dropleft',
MENURIGHT: 'dropdown-menu-right',
MENULEFT: 'dropdown-menu-left',
POSITION_STATIC: 'position-static'
};
var Selector = {
DATA_TOGGLE: '[data-toggle="dropdown"]',
FORM_CHILD: '.dropdown form',
MENU: '.dropdown-menu',
NAVBAR_NAV: '.navbar-nav',
VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled)'
};
var AttachmentMap = {
TOP: 'top-start',
TOPEND: 'top-end',
BOTTOM: 'bottom-start',
BOTTOMEND: 'bottom-end',
RIGHT: 'right-start',
RIGHTEND: 'right-end',
LEFT: 'left-start',
LEFTEND: 'left-end'
};
var Default = {
offset: 0,
flip: false,
boundary: 'scrollParent'
};
var DefaultType = {
offset: '(number|string|function)',
flip: 'boolean',
boundary: '(string|element)'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Dropdown = function () {
function Dropdown(element, config) {
_classCallCheck(this, Dropdown);
this._element = element;
this._popper = null;
this._config = this._getConfig(config);
this._menu = this._getMenuElement();
this._inNavbar = this._detectNavbar();
this._addEventListeners();
} // Getters
_createClass(Dropdown, [{
key: "toggle",
value: function toggle() {
if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED)) {
return;
}
var parent = Dropdown._getParentFromElement(this._element);
var isActive = $(this._menu).hasClass(ClassName.SHOW);
Dropdown._clearMenus();
if (isActive) {
return;
}
var relatedTarget = {
relatedTarget: this._element
};
var showEvent = $.Event(Event.SHOW, relatedTarget);
$(parent).trigger(showEvent);
if (showEvent.isDefaultPrevented()) {
return;
} // Disable totally Popper.js for Dropdown in Navbar
if (!this._inNavbar) {
/**
* Check for Popper dependency
* Popper - https://popper.js.org
*/
if (typeof _popper2.default === 'undefined') {
throw new TypeError('Bootstrap dropdown require Popper.js (https://popper.js.org)');
}
var element = this._element; // For dropup with alignment we use the parent as popper container
if ($(parent).hasClass(ClassName.DROPUP)) {
if ($(this._menu).hasClass(ClassName.MENULEFT) || $(this._menu).hasClass(ClassName.MENURIGHT)) {
element = parent;
}
} // If boundary is not `scrollParent`, then set position to `static`
// to allow the menu to "escape" the scroll parent's boundaries
// https://github.com/twbs/bootstrap/issues/24251
if (this._config.boundary !== 'scrollParent') {
$(parent).addClass(ClassName.POSITION_STATIC);
}
this._popper = new _popper2.default(element, this._menu, this._getPopperConfig());
} // If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
if ('ontouchstart' in document.documentElement && $(parent).closest(Selector.NAVBAR_NAV).length === 0) {
$('body').children().on('mouseover', null, $.noop);
}
this._element.focus();
this._element.setAttribute('aria-expanded', true);
$(this._menu).toggleClass(ClassName.SHOW);
$(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.SHOWN, relatedTarget));
}
}, {
key: "dispose",
value: function dispose() {
$.removeData(this._element, DATA_KEY);
$(this._element).off(EVENT_KEY);
this._element = null;
this._menu = null;
if (this._popper !== null) {
this._popper.destroy();
this._popper = null;
}
}
}, {
key: "update",
value: function update() {
this._inNavbar = this._detectNavbar();
if (this._popper !== null) {
this._popper.scheduleUpdate();
}
}
}, {
key: "_addEventListeners",
value: function _addEventListeners() {
var _this = this;
$(this._element).on(Event.CLICK, function (event) {
event.preventDefault();
event.stopPropagation();
_this.toggle();
});
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _extends({}, this.constructor.Default, $(this._element).data(), config);
_util2.default.typeCheckConfig(NAME, config, this.constructor.DefaultType);
return config;
}
}, {
key: "_getMenuElement",
value: function _getMenuElement() {
if (!this._menu) {
var parent = Dropdown._getParentFromElement(this._element);
this._menu = $(parent).find(Selector.MENU)[0];
}
return this._menu;
}
}, {
key: "_getPlacement",
value: function _getPlacement() {
var $parentDropdown = $(this._element).parent();
var placement = AttachmentMap.BOTTOM; // Handle dropup
if ($parentDropdown.hasClass(ClassName.DROPUP)) {
placement = AttachmentMap.TOP;
if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
placement = AttachmentMap.TOPEND;
}
} else if ($parentDropdown.hasClass(ClassName.DROPRIGHT)) {
placement = AttachmentMap.RIGHT;
} else if ($parentDropdown.hasClass(ClassName.DROPLEFT)) {
placement = AttachmentMap.LEFT;
} else if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
placement = AttachmentMap.BOTTOMEND;
}
return placement;
}
}, {
key: "_detectNavbar",
value: function _detectNavbar() {
return $(this._element).closest('.navbar').length > 0;
}
}, {
key: "_getPopperConfig",
value: function _getPopperConfig() {
var _this2 = this;
var offsetConf = {};
if (typeof this._config.offset === 'function') {
offsetConf.fn = function (data) {
data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets) || {});
return data;
};
} else {
offsetConf.offset = this._config.offset;
}
var popperConfig = {
placement: this._getPlacement(),
modifiers: {
offset: offsetConf,
flip: {
enabled: this._config.flip
},
preventOverflow: {
boundariesElement: this._config.boundary
}
}
};
return popperConfig;
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = _typeof(config) === 'object' ? config : null;
if (!data) {
data = new Dropdown(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "_clearMenus",
value: function _clearMenus(event) {
if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
return;
}
var toggles = $.makeArray($(Selector.DATA_TOGGLE));
for (var i = 0; i < toggles.length; i++) {
var parent = Dropdown._getParentFromElement(toggles[i]);
var context = $(toggles[i]).data(DATA_KEY);
var relatedTarget = {
relatedTarget: toggles[i]
};
if (!context) {
continue;
}
var dropdownMenu = context._menu;
if (!$(parent).hasClass(ClassName.SHOW)) {
continue;
}
if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
continue;
}
var hideEvent = $.Event(Event.HIDE, relatedTarget);
$(parent).trigger(hideEvent);
if (hideEvent.isDefaultPrevented()) {
continue;
} // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
$('body').children().off('mouseover', null, $.noop);
}
toggles[i].setAttribute('aria-expanded', 'false');
$(dropdownMenu).removeClass(ClassName.SHOW);
$(parent).removeClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget));
}
}
}, {
key: "_getParentFromElement",
value: function _getParentFromElement(element) {
var parent;
var selector = _util2.default.getSelectorFromElement(element);
if (selector) {
parent = $(selector)[0];
}
return parent || element.parentNode;
}
}, {
key: "_dataApiKeydownHandler",
value: function _dataApiKeydownHandler(event) {
// If not input/textarea:
// - And not a key in REGEXP_KEYDOWN => not a dropdown command
// If input/textarea:
// - If space key => not a dropdown command
// - If key is other than escape
// - If key is not up or down => not a dropdown command
// - If trigger inside the menu => not a dropdown command
if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
return;
}
event.preventDefault();
event.stopPropagation();
if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
return;
}
var parent = Dropdown._getParentFromElement(this);
var isActive = $(parent).hasClass(ClassName.SHOW);
if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
if (event.which === ESCAPE_KEYCODE) {
var toggle = $(parent).find(Selector.DATA_TOGGLE)[0];
$(toggle).trigger('focus');
}
$(this).trigger('click');
return;
}
var items = $(parent).find(Selector.VISIBLE_ITEMS).get();
if (items.length === 0) {
return;
}
var index = items.indexOf(event.target);
if (event.which === ARROW_UP_KEYCODE && index > 0) {
// Up
index--;
}
if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
// Down
index++;
}
if (index < 0) {
index = 0;
}
items[index].focus();
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}, {
key: "DefaultType",
get: function get() {
return DefaultType;
}
}]);
return Dropdown;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler).on("".concat(Event.CLICK_DATA_API, " ").concat(Event.KEYUP_DATA_API), Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault();
event.stopPropagation();
Dropdown._jQueryInterface.call($(this), 'toggle');
}).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
e.stopPropagation();
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Dropdown._jQueryInterface;
$.fn[NAME].Constructor = Dropdown;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Dropdown._jQueryInterface;
};
return Dropdown;
}(_jquery2.default, _popper2.default);
exports.default = Dropdown;
});

65
amd/src/form-display-errors.js

@ -0,0 +1,65 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Custom form error event handler to manipulate the bootstrap markup and show
* nicely styled errors in an mform.
*
* @module theme_ilb/form-display-errors
* @copyright 2016 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/event'], function($, Event) {
return {
enhance: function(elementid) {
var element = document.getElementById(elementid);
$(element).on(Event.Events.FORM_FIELD_VALIDATION, function(event, msg) {
event.preventDefault();
var parent = $(element).closest('.form-group');
var feedback = parent.find('.form-control-feedback');
// Sometimes (atto) we have a hidden textarea backed by a real contenteditable div.
if (($(element).prop("tagName") == 'TEXTAREA') && parent.find('[contenteditable]')) {
element = parent.find('[contenteditable]');
}
if (msg !== '') {
parent.addClass('has-danger');
parent.data('client-validation-error', true);
$(element).addClass('is-invalid');
$(element).attr('aria-describedby', feedback.attr('id'));
$(element).attr('aria-invalid', true);
feedback.attr('tabindex', 0);
feedback.html(msg);
// Only display and focus when the error was not already visible.
if (!feedback.is(':visible')) {
feedback.show();
feedback.focus();
}
} else {
if (parent.data('client-validation-error') === true) {
parent.removeClass('has-danger');
parent.data('client-validation-error', false);
$(element).removeClass('is-invalid');
$(element).removeAttr('aria-describedby');
$(element).attr('aria-invalid', false);
feedback.hide();
}
}
});
}
};
});

76
amd/src/loader.js

@ -0,0 +1,76 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Template renderer for Moodle. Load and render Moodle templates with Mustache.
*
* @module core/templates
* @package core
* @class templates
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 2.9
*/
define(['jquery', './tether', 'core/event'], function(jQuery, Tether, Event) {
window.jQuery = jQuery;
window.Tether = Tether;
require(['theme_ilb/aria',
'theme_ilb/util',
'theme_ilb/alert',
'theme_ilb/button',
'theme_ilb/carousel',
'theme_ilb/collapse',
'theme_ilb/dropdown',
'theme_ilb/modal',
'theme_ilb/scrollspy',
'theme_ilb/tab',
'theme_ilb/tooltip',
'theme_ilb/popover'],
function(Aria) {
// We do twice because: https://github.com/twbs/bootstrap/issues/10547
jQuery('body').popover({
trigger: 'focus',
selector: "[data-toggle=popover][data-trigger!=hover]"
});
jQuery("html").popover({
container: "body",
selector: "[data-toggle=popover][data-trigger=hover]",
trigger: "hover",
delay: {
hide: 500
}
});
// We need to call popover automatically if nodes are added to the page later.
Event.getLegacyEvents().done(function(events) {
jQuery(document).on(events.FILTER_CONTENT_UPDATED, function() {
jQuery('body').popover({
selector: '[data-toggle="popover"]',
trigger: 'focus'
});
});
});
Aria.init();
});
return {};
});

662
amd/src/modal.js

@ -0,0 +1,662 @@
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Modal = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'modal';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.modal';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 300;
var BACKDROP_TRANSITION_DURATION = 150;
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
var Default = {
backdrop: true,
keyboard: true,
focus: true,
show: true
};
var DefaultType = {
backdrop: '(boolean|string)',
keyboard: 'boolean',
focus: 'boolean',
show: 'boolean'
};
var Event = {
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
FOCUSIN: "focusin".concat(EVENT_KEY),
RESIZE: "resize".concat(EVENT_KEY),
CLICK_DISMISS: "click.dismiss".concat(EVENT_KEY),
KEYDOWN_DISMISS: "keydown.dismiss".concat(EVENT_KEY),
MOUSEUP_DISMISS: "mouseup.dismiss".concat(EVENT_KEY),
MOUSEDOWN_DISMISS: "mousedown.dismiss".concat(EVENT_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
BACKDROP: 'modal-backdrop',
OPEN: 'modal-open',
FADE: 'fade',
SHOW: 'show'
};
var Selector = {
DIALOG: '.modal-dialog',
DATA_TOGGLE: '[data-toggle="modal"]',
DATA_DISMISS: '[data-dismiss="modal"]',
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
STICKY_CONTENT: '.sticky-top',
NAVBAR_TOGGLER: '.navbar-toggler'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Modal = function () {
function Modal(element, config) {
_classCallCheck(this, Modal);
this._config = this._getConfig(config);
this._element = element;
this._dialog = $(element).find(Selector.DIALOG)[0];
this._backdrop = null;
this._isShown = false;
this._isBodyOverflowing = false;
this._ignoreBackdropClick = false;
this._originalBodyPadding = 0;
this._scrollbarWidth = 0;
} // Getters
_createClass(Modal, [{
key: "toggle",
value: function toggle(relatedTarget) {
return this._isShown ? this.hide() : this.show(relatedTarget);
}
}, {
key: "show",
value: function show(relatedTarget) {
var _this = this;
if (this._isTransitioning || this._isShown) {
return;
}
if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
this._isTransitioning = true;
}
var showEvent = $.Event(Event.SHOW, {
relatedTarget: relatedTarget
});
$(this._element).trigger(showEvent);
if (this._isShown || showEvent.isDefaultPrevented()) {
return;
}
this._isShown = true;
this._checkScrollbar();
this._setScrollbar();
this._adjustDialog();
$(document.body).addClass(ClassName.OPEN);
this._setEscapeEvent();
this._setResizeEvent();
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
return _this.hide(event);
});
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
$(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
if ($(event.target).is(_this._element)) {
_this._ignoreBackdropClick = true;
}
});
});
this._showBackdrop(function () {
return _this._showElement(relatedTarget);
});
}
}, {
key: "hide",
value: function hide(event) {
var _this2 = this;
if (event) {
event.preventDefault();
}
if (this._isTransitioning || !this._isShown) {
return;
}
var hideEvent = $.Event(Event.HIDE);
$(this._element).trigger(hideEvent);
if (!this._isShown || hideEvent.isDefaultPrevented()) {
return;
}
this._isShown = false;
var transition = _util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
if (transition) {
this._isTransitioning = true;
}
this._setEscapeEvent();
this._setResizeEvent();
$(document).off(Event.FOCUSIN);
$(this._element).removeClass(ClassName.SHOW);
$(this._element).off(Event.CLICK_DISMISS);
$(this._dialog).off(Event.MOUSEDOWN_DISMISS);
if (transition) {
$(this._element).one(_util2.default.TRANSITION_END, function (event) {
return _this2._hideModal(event);
}).emulateTransitionEnd(TRANSITION_DURATION);
} else {
this._hideModal();
}
}
}, {
key: "dispose",
value: function dispose() {
$.removeData(this._element, DATA_KEY);
$(window, document, this._element, this._backdrop).off(EVENT_KEY);
this._config = null;
this._element = null;
this._dialog = null;
this._backdrop = null;
this._isShown = null;
this._isBodyOverflowing = null;
this._ignoreBackdropClick = null;
this._scrollbarWidth = null;
}
}, {
key: "handleUpdate",
value: function handleUpdate() {
this._adjustDialog();
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _extends({}, Default, config);
_util2.default.typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: "_showElement",
value: function _showElement(relatedTarget) {
var _this3 = this;
var transition = _util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
// Don't move modal's DOM position
document.body.appendChild(this._element);
}
this._element.style.display = 'block';
this._element.removeAttribute('aria-hidden');
this._element.scrollTop = 0;
if (transition) {
_util2.default.reflow(this._element);
}
$(this._element).addClass(ClassName.SHOW);
if (this._config.focus) {
this._enforceFocus();
}
var shownEvent = $.Event(Event.SHOWN, {
relatedTarget: relatedTarget
});
var transitionComplete = function transitionComplete() {
if (_this3._config.focus) {
_this3._element.focus();
}
_this3._isTransitioning = false;
$(_this3._element).trigger(shownEvent);
};
if (transition) {
$(this._dialog).one(_util2.default.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
} else {
transitionComplete();
}
}
}, {
key: "_enforceFocus",
value: function _enforceFocus() {
var _this4 = this;
$(document).off(Event.FOCUSIN) // Guard against infinite focus loop
.on(Event.FOCUSIN, function (event) {
if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) {
_this4._element.focus();
}
});
}
}, {
key: "_setEscapeEvent",
value: function _setEscapeEvent() {
var _this5 = this;
if (this._isShown && this._config.keyboard) {
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
if (event.which === ESCAPE_KEYCODE) {
event.preventDefault();
_this5.hide();
}
});
} else if (!this._isShown) {
$(this._element).off(Event.KEYDOWN_DISMISS);
}
}
}, {
key: "_setResizeEvent",
value: function _setResizeEvent() {
var _this6 = this;
if (this._isShown) {
$(window).on(Event.RESIZE, function (event) {
return _this6.handleUpdate(event);
});
} else {
$(window).off(Event.RESIZE);
}
}
}, {
key: "_hideModal",
value: function _hideModal() {
var _this7 = this;
this._element.style.display = 'none';
this._element.setAttribute('aria-hidden', true);
this._isTransitioning = false;
this._showBackdrop(function () {
$(document.body).removeClass(ClassName.OPEN);
_this7._resetAdjustments();
_this7._resetScrollbar();
$(_this7._element).trigger(Event.HIDDEN);
});
}
}, {
key: "_removeBackdrop",
value: function _removeBackdrop() {
if (this._backdrop) {
$(this._backdrop).remove();
this._backdrop = null;
}
}
}, {
key: "_showBackdrop",
value: function _showBackdrop(callback) {
var _this8 = this;
var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
if (this._isShown && this._config.backdrop) {
var doAnimate = _util2.default.supportsTransitionEnd() && animate;
this._backdrop = document.createElement('div');
this._backdrop.className = ClassName.BACKDROP;
if (animate) {
$(this._backdrop).addClass(animate);
}
$(this._backdrop).appendTo(document.body);
$(this._element).on(Event.CLICK_DISMISS, function (event) {
if (_this8._ignoreBackdropClick) {
_this8._ignoreBackdropClick = false;
return;
}
if (event.target !== event.currentTarget) {
return;
}
if (_this8._config.backdrop === 'static') {
_this8._element.focus();
} else {
_this8.hide();
}
});
if (doAnimate) {
_util2.default.reflow(this._backdrop);
}
$(this._backdrop).addClass(ClassName.SHOW);
if (!callback) {
return;
}
if (!doAnimate) {
callback();
return;
}
$(this._backdrop).one(_util2.default.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
} else if (!this._isShown && this._backdrop) {
$(this._backdrop).removeClass(ClassName.SHOW);
var callbackRemove = function callbackRemove() {
_this8._removeBackdrop();
if (callback) {
callback();
}
};
if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
$(this._backdrop).one(_util2.default.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
} else {
callbackRemove();
}
} else if (callback) {
callback();
}
}
}, {
key: "_adjustDialog",
value: function _adjustDialog() {
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
if (!this._isBodyOverflowing && isModalOverflowing) {
this._element.style.paddingLeft = "".concat(this._scrollbarWidth, "px");
}
if (this._isBodyOverflowing && !isModalOverflowing) {
this._element.style.paddingRight = "".concat(this._scrollbarWidth, "px");
}
}
}, {
key: "_resetAdjustments",
value: function _resetAdjustments() {
this._element.style.paddingLeft = '';
this._element.style.paddingRight = '';
}
}, {
key: "_checkScrollbar",
value: function _checkScrollbar() {
var rect = document.body.getBoundingClientRect();
this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
this._scrollbarWidth = this._getScrollbarWidth();
}
}, {
key: "_setScrollbar",
value: function _setScrollbar() {
var _this9 = this;
if (this._isBodyOverflowing) {
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
// Adjust fixed content padding
$(Selector.FIXED_CONTENT).each(function (index, element) {
var actualPadding = $(element)[0].style.paddingRight;
var calculatedPadding = $(element).css('padding-right');
$(element).data('padding-right', actualPadding).css('padding-right', "".concat(parseFloat(calculatedPadding) + _this9._scrollbarWidth, "px"));
}); // Adjust sticky content margin
$(Selector.STICKY_CONTENT).each(function (index, element) {
var actualMargin = $(element)[0].style.marginRight;
var calculatedMargin = $(element).css('margin-right');
$(element).data('margin-right', actualMargin).css('margin-right', "".concat(parseFloat(calculatedMargin) - _this9._scrollbarWidth, "px"));
}); // Adjust navbar-toggler margin
$(Selector.NAVBAR_TOGGLER).each(function (index, element) {
var actualMargin = $(element)[0].style.marginRight;
var calculatedMargin = $(element).css('margin-right');
$(element).data('margin-right', actualMargin).css('margin-right', "".concat(parseFloat(calculatedMargin) + _this9._scrollbarWidth, "px"));
}); // Adjust body padding
var actualPadding = document.body.style.paddingRight;
var calculatedPadding = $('body').css('padding-right');
$('body').data('padding-right', actualPadding).css('padding-right', "".concat(parseFloat(calculatedPadding) + this._scrollbarWidth, "px"));
}
}
}, {
key: "_resetScrollbar",
value: function _resetScrollbar() {
// Restore fixed content padding
$(Selector.FIXED_CONTENT).each(function (index, element) {
var padding = $(element).data('padding-right');
if (typeof padding !== 'undefined') {
$(element).css('padding-right', padding).removeData('padding-right');
}
}); // Restore sticky content and navbar-toggler margin
$("".concat(Selector.STICKY_CONTENT, ", ").concat(Selector.NAVBAR_TOGGLER)).each(function (index, element) {
var margin = $(element).data('margin-right');
if (typeof margin !== 'undefined') {
$(element).css('margin-right', margin).removeData('margin-right');
}
}); // Restore body padding
var padding = $('body').data('padding-right');
if (typeof padding !== 'undefined') {
$('body').css('padding-right', padding).removeData('padding-right');
}
}
}, {
key: "_getScrollbarWidth",
value: function _getScrollbarWidth() {
// thx d.walsh
var scrollDiv = document.createElement('div');
scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth;
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config, relatedTarget) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = _extends({}, Modal.Default, $(this).data(), _typeof(config) === 'object' && config);
if (!data) {
data = new Modal(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config](relatedTarget);
} else if (_config.show) {
data.show(relatedTarget);
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return Modal;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
var _this10 = this;
var target;
var selector = _util2.default.getSelectorFromElement(this);
if (selector) {
target = $(selector)[0];
}
var config = $(target).data(DATA_KEY) ? 'toggle' : _extends({}, $(target).data(), $(this).data());
if (this.tagName === 'A' || this.tagName === 'AREA') {
event.preventDefault();
}
var $target = $(target).one(Event.SHOW, function (showEvent) {
if (showEvent.isDefaultPrevented()) {
// Only register focus restorer if modal will actually get shown
return;
}
$target.one(Event.HIDDEN, function () {
if ($(_this10).is(':visible')) {
_this10.focus();
}
});
});
Modal._jQueryInterface.call($(target), config, this);
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Modal._jQueryInterface;
$.fn[NAME].Constructor = Modal;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Modal._jQueryInterface;
};
return Modal;
}(_jquery2.default);
exports.default = Modal;
});

297
amd/src/popover.js

@ -0,0 +1,297 @@
define(["exports", "jquery", "./tooltip"], function (exports, _jquery, _tooltip) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _tooltip2 = _interopRequireDefault(_tooltip);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Popover = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'popover';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.popover';
var EVENT_KEY = ".".concat(DATA_KEY);
var JQUERY_NO_CONFLICT = $.fn[NAME];
var CLASS_PREFIX = 'bs-popover';
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)".concat(CLASS_PREFIX, "\\S+"), 'g');
var Default = _extends({}, _tooltip2.default.Default, {
placement: 'right',
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
});
var DefaultType = _extends({}, _tooltip2.default.DefaultType, {
content: '(string|element|function)'
});
var ClassName = {
FADE: 'fade',
SHOW: 'show'
};
var Selector = {
TITLE: '.popover-header',
CONTENT: '.popover-body'
};
var Event = {
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
INSERTED: "inserted".concat(EVENT_KEY),
CLICK: "click".concat(EVENT_KEY),
FOCUSIN: "focusin".concat(EVENT_KEY),
FOCUSOUT: "focusout".concat(EVENT_KEY),
MOUSEENTER: "mouseenter".concat(EVENT_KEY),
MOUSELEAVE: "mouseleave".concat(EVENT_KEY)
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Popover = function (_Tooltip) {
_inherits(Popover, _Tooltip);
function Popover() {
_classCallCheck(this, Popover);
return _possibleConstructorReturn(this, (Popover.__proto__ || Object.getPrototypeOf(Popover)).apply(this, arguments));
}
_createClass(Popover, [{
key: "isWithContent",
value: function isWithContent() {
return this.getTitle() || this._getContent();
}
}, {
key: "addAttachmentClass",
value: function addAttachmentClass(attachment) {
$(this.getTipElement()).addClass("".concat(CLASS_PREFIX, "-").concat(attachment));
}
}, {
key: "getTipElement",
value: function getTipElement() {
this.tip = this.tip || $(this.config.template)[0];
return this.tip;
}
}, {
key: "setContent",
value: function setContent() {
var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
var content = this._getContent();
if (typeof content === 'function') {
content = content.call(this.element);
}
this.setElementContent($tip.find(Selector.CONTENT), content);
$tip.removeClass("".concat(ClassName.FADE, " ").concat(ClassName.SHOW));
}
}, {
key: "_getContent",
value: function _getContent() {
return this.element.getAttribute('data-content') || this.config.content;
}
}, {
key: "_cleanTipClass",
value: function _cleanTipClass() {
var $tip = $(this.getTipElement());
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
if (tabClass !== null && tabClass.length > 0) {
$tip.removeClass(tabClass.join(''));
}
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = _typeof(config) === 'object' ? config : null;
if (!data && /destroy|hide/.test(config)) {
return;
}
if (!data) {
data = new Popover(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}, {
key: "NAME",
get: function get() {
return NAME;
}
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}, {
key: "Event",
get: function get() {
return Event;
}
}, {
key: "EVENT_KEY",
get: function get() {
return EVENT_KEY;
}
}, {
key: "DefaultType",
get: function get() {
return DefaultType;
}
}]);
return Popover;
}(_tooltip2.default);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Popover._jQueryInterface;
$.fn[NAME].Constructor = Popover;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Popover._jQueryInterface;
};
return Popover;
}(_jquery2.default);
exports.default = Popover;
});

390
amd/src/scrollspy.js

@ -0,0 +1,390 @@
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var ScrollSpy = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'scrollspy';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.scrollspy';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Default = {
offset: 10,
method: 'auto',
target: ''
};
var DefaultType = {
offset: 'number',
method: 'string',
target: '(string|element)'
};
var Event = {
ACTIVATE: "activate".concat(EVENT_KEY),
SCROLL: "scroll".concat(EVENT_KEY),
LOAD_DATA_API: "load".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
DROPDOWN_ITEM: 'dropdown-item',
DROPDOWN_MENU: 'dropdown-menu',
ACTIVE: 'active'
};
var Selector = {
DATA_SPY: '[data-spy="scroll"]',
ACTIVE: '.active',
NAV_LIST_GROUP: '.nav, .list-group',
NAV_LINKS: '.nav-link',
NAV_ITEMS: '.nav-item',
LIST_ITEMS: '.list-group-item',
DROPDOWN: '.dropdown',
DROPDOWN_ITEMS: '.dropdown-item',
DROPDOWN_TOGGLE: '.dropdown-toggle'
};
var OffsetMethod = {
OFFSET: 'offset',
POSITION: 'position'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var ScrollSpy = function () {
function ScrollSpy(element, config) {
var _this = this;
_classCallCheck(this, ScrollSpy);
this._element = element;
this._scrollElement = element.tagName === 'BODY' ? window : element;
this._config = this._getConfig(config);
this._selector = "".concat(this._config.target, " ").concat(Selector.NAV_LINKS, ",") + "".concat(this._config.target, " ").concat(Selector.LIST_ITEMS, ",") + "".concat(this._config.target, " ").concat(Selector.DROPDOWN_ITEMS);
this._offsets = [];
this._targets = [];
this._activeTarget = null;
this._scrollHeight = 0;
$(this._scrollElement).on(Event.SCROLL, function (event) {
return _this._process(event);
});
this.refresh();
this._process();
} // Getters
_createClass(ScrollSpy, [{
key: "refresh",
value: function refresh() {
var _this2 = this;
var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
this._offsets = [];
this._targets = [];
this._scrollHeight = this._getScrollHeight();
var targets = $.makeArray($(this._selector));
targets.map(function (element) {
var target;
var targetSelector = _util2.default.getSelectorFromElement(element);
if (targetSelector) {
target = $(targetSelector)[0];
}
if (target) {
var targetBCR = target.getBoundingClientRect();
if (targetBCR.width || targetBCR.height) {
// TODO (fat): remove sketch reliance on jQuery position/offset
return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
}
}
return null;
}).filter(function (item) {
return item;
}).sort(function (a, b) {
return a[0] - b[0];
}).forEach(function (item) {
_this2._offsets.push(item[0]);
_this2._targets.push(item[1]);
});
}
}, {
key: "dispose",
value: function dispose() {
$.removeData(this._element, DATA_KEY);
$(this._scrollElement).off(EVENT_KEY);
this._element = null;
this._scrollElement = null;
this._config = null;
this._selector = null;
this._offsets = null;
this._targets = null;
this._activeTarget = null;
this._scrollHeight = null;
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _extends({}, Default, config);
if (typeof config.target !== 'string') {
var id = $(config.target).attr('id');
if (!id) {
id = _util2.default.getUID(NAME);
$(config.target).attr('id', id);
}
config.target = "#".concat(id);
}
_util2.default.typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: "_getScrollTop",
value: function _getScrollTop() {
return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
}
}, {
key: "_getScrollHeight",
value: function _getScrollHeight() {
return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
}
}, {
key: "_getOffsetHeight",
value: function _getOffsetHeight() {
return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
}
}, {
key: "_process",
value: function _process() {
var scrollTop = this._getScrollTop() + this._config.offset;
var scrollHeight = this._getScrollHeight();
var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
if (this._scrollHeight !== scrollHeight) {
this.refresh();
}
if (scrollTop >= maxScroll) {
var target = this._targets[this._targets.length - 1];
if (this._activeTarget !== target) {
this._activate(target);
}
return;
}
if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
this._activeTarget = null;
this._clear();
return;
}
for (var i = this._offsets.length; i--;) {
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
if (isActiveTarget) {
this._activate(this._targets[i]);
}
}
}
}, {
key: "_activate",
value: function _activate(target) {
this._activeTarget = target;
this._clear();
var queries = this._selector.split(','); // eslint-disable-next-line arrow-body-style
queries = queries.map(function (selector) {
return "".concat(selector, "[data-target=\"").concat(target, "\"],") + "".concat(selector, "[href=\"").concat(target, "\"]");
});
var $link = $(queries.join(','));
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
$link.addClass(ClassName.ACTIVE);
} else {
// Set triggered link as active
$link.addClass(ClassName.ACTIVE); // Set triggered links parents as active
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
$link.parents(Selector.NAV_LIST_GROUP).prev("".concat(Selector.NAV_LINKS, ", ").concat(Selector.LIST_ITEMS)).addClass(ClassName.ACTIVE); // Handle special case when .nav-link is inside .nav-item
$link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).children(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
}
$(this._scrollElement).trigger(Event.ACTIVATE, {
relatedTarget: target
});
}
}, {
key: "_clear",
value: function _clear() {
$(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = _typeof(config) === 'object' && config;
if (!data) {
data = new ScrollSpy(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return ScrollSpy;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(window).on(Event.LOAD_DATA_API, function () {
var scrollSpys = $.makeArray($(Selector.DATA_SPY));
for (var i = scrollSpys.length; i--;) {
var $spy = $(scrollSpys[i]);
ScrollSpy._jQueryInterface.call($spy, $spy.data());
}
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = ScrollSpy._jQueryInterface;
$.fn[NAME].Constructor = ScrollSpy;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return ScrollSpy._jQueryInterface;
};
return ScrollSpy;
}(_jquery2.default);
exports.default = ScrollSpy;
});

289
amd/src/tab.js

@ -0,0 +1,289 @@
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Tab = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'tab';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.tab';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 150;
var Event = {
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
DROPDOWN_MENU: 'dropdown-menu',
ACTIVE: 'active',
DISABLED: 'disabled',
FADE: 'fade',
SHOW: 'show'
};
var Selector = {
DROPDOWN: '.dropdown',
NAV_LIST_GROUP: '.nav, .list-group',
ACTIVE: '.active',
ACTIVE_UL: '> li > .active',
DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
DROPDOWN_TOGGLE: '.dropdown-toggle',
DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Tab = function () {
function Tab(element) {
_classCallCheck(this, Tab);
this._element = element;
} // Getters
_createClass(Tab, [{
key: "show",
value: function show() {
var _this = this;
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
return;
}
var target;
var previous;
var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0];
var selector = _util2.default.getSelectorFromElement(this._element);
if (listElement) {
var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE;
previous = $.makeArray($(listElement).find(itemSelector));
previous = previous[previous.length - 1];
}
var hideEvent = $.Event(Event.HIDE, {
relatedTarget: this._element
});
var showEvent = $.Event(Event.SHOW, {
relatedTarget: previous
});
if (previous) {
$(previous).trigger(hideEvent);
}
$(this._element).trigger(showEvent);
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
return;
}
if (selector) {
target = $(selector)[0];
}
this._activate(this._element, listElement);
var complete = function complete() {
var hiddenEvent = $.Event(Event.HIDDEN, {
relatedTarget: _this._element
});
var shownEvent = $.Event(Event.SHOWN, {
relatedTarget: previous
});
$(previous).trigger(hiddenEvent);
$(_this._element).trigger(shownEvent);
};
if (target) {
this._activate(target, target.parentNode, complete);
} else {
complete();
}
}
}, {
key: "dispose",
value: function dispose() {
$.removeData(this._element, DATA_KEY);
this._element = null;
}
}, {
key: "_activate",
value: function _activate(element, container, callback) {
var _this2 = this;
var activeElements;
if (container.nodeName === 'UL') {
activeElements = $(container).find(Selector.ACTIVE_UL);
} else {
activeElements = $(container).children(Selector.ACTIVE);
}
var active = activeElements[0];
var isTransitioning = callback && _util2.default.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE);
var complete = function complete() {
return _this2._transitionComplete(element, active, callback);
};
if (active && isTransitioning) {
$(active).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
} else {
complete();
}
}
}, {
key: "_transitionComplete",
value: function _transitionComplete(element, active, callback) {
if (active) {
$(active).removeClass("".concat(ClassName.SHOW, " ").concat(ClassName.ACTIVE));
var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
if (dropdownChild) {
$(dropdownChild).removeClass(ClassName.ACTIVE);
}
if (active.getAttribute('role') === 'tab') {
active.setAttribute('aria-selected', false);
}
}
$(element).addClass(ClassName.ACTIVE);
if (element.getAttribute('role') === 'tab') {
element.setAttribute('aria-selected', true);
}
_util2.default.reflow(element);
$(element).addClass(ClassName.SHOW);
if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
if (dropdownElement) {
$(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
}
element.setAttribute('aria-expanded', true);
}
if (callback) {
callback();
}
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var $this = $(this);
var data = $this.data(DATA_KEY);
if (!data) {
data = new Tab(this);
$this.data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return Tab;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault();
Tab._jQueryInterface.call($(this), 'show');
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Tab._jQueryInterface;
$.fn[NAME].Constructor = Tab;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Tab._jQueryInterface;
};
return Tab;
}(_jquery2.default);
exports.default = Tab;
});

1792
amd/src/tether.js

File diff suppressed because it is too large

762
amd/src/tooltip.js

@ -0,0 +1,762 @@
define(["exports", "jquery", "core/popper", "./util"], function (exports, _jquery, _popper, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _popper2 = _interopRequireDefault(_popper);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Tooltip = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'tooltip';
var VERSION = '4.0.0';
var DATA_KEY = 'bs.tooltip';
var EVENT_KEY = ".".concat(DATA_KEY);
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 150;
var CLASS_PREFIX = 'bs-tooltip';
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)".concat(CLASS_PREFIX, "\\S+"), 'g');
var DefaultType = {
animation: 'boolean',
template: 'string',
title: '(string|element|function)',
trigger: 'string',
delay: '(number|object)',
html: 'boolean',
selector: '(string|boolean)',
placement: '(string|function)',
offset: '(number|string)',
container: '(string|element|boolean)',
fallbackPlacement: '(string|array)',
boundary: '(string|element)'
};
var AttachmentMap = {
AUTO: 'auto',
TOP: 'top',
RIGHT: 'right',
BOTTOM: 'bottom',
LEFT: 'left'
};
var Default = {
animation: true,
template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
selector: false,
placement: 'top',
offset: 0,
container: false,
fallbackPlacement: 'flip',
boundary: 'scrollParent'
};
var HoverState = {
SHOW: 'show',
OUT: 'out'
};
var Event = {
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
INSERTED: "inserted".concat(EVENT_KEY),
CLICK: "click".concat(EVENT_KEY),
FOCUSIN: "focusin".concat(EVENT_KEY),
FOCUSOUT: "focusout".concat(EVENT_KEY),
MOUSEENTER: "mouseenter".concat(EVENT_KEY),
MOUSELEAVE: "mouseleave".concat(EVENT_KEY)
};
var ClassName = {
FADE: 'fade',
SHOW: 'show'
};
var Selector = {
TOOLTIP: '.tooltip',
TOOLTIP_INNER: '.tooltip-inner',
ARROW: '.arrow'
};
var Trigger = {
HOVER: 'hover',
FOCUS: 'focus',
CLICK: 'click',
MANUAL: 'manual'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Tooltip = function () {
function Tooltip(element, config) {
_classCallCheck(this, Tooltip);
/**
* Check for Popper dependency
* Popper - https://popper.js.org
*/
if (typeof _popper2.default === 'undefined') {
throw new TypeError('Bootstrap tooltips require Popper.js (https://popper.js.org)');
} // private
this._isEnabled = true;
this._timeout = 0;
this._hoverState = '';
this._activeTrigger = {};
this._popper = null; // Protected
this.element = element;
this.config = this._getConfig(config);
this.tip = null;
this._setListeners();
} // Getters
_createClass(Tooltip, [{
key: "enable",
value: function enable() {
this._isEnabled = true;
}
}, {
key: "disable",
value: function disable() {
this._isEnabled = false;
}
}, {
key: "toggleEnabled",
value: function toggleEnabled() {
this._isEnabled = !this._isEnabled;
}
}, {
key: "toggle",
value: function toggle(event) {
if (!this._isEnabled) {
return;
}
if (event) {
var dataKey = this.constructor.DATA_KEY;
var context = $(event.currentTarget).data(dataKey);
if (!context) {
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
$(event.currentTarget).data(dataKey, context);
}
context._activeTrigger.click = !context._activeTrigger.click;
if (context._isWithActiveTrigger()) {
context._enter(null, context);
} else {
context._leave(null, context);
}
} else {
if ($(this.getTipElement()).hasClass(ClassName.SHOW)) {
this._leave(null, this);
return;
}
this._enter(null, this);
}
}
}, {
key: "dispose",
value: function dispose() {
clearTimeout(this._timeout);
$.removeData(this.element, this.constructor.DATA_KEY);
$(this.element).off(this.constructor.EVENT_KEY);
$(this.element).closest('.modal').off('hide.bs.modal');
if (this.tip) {
$(this.tip).remove();
}
this._isEnabled = null;
this._timeout = null;
this._hoverState = null;
this._activeTrigger = null;
if (this._popper !== null) {
this._popper.destroy();
}
this._popper = null;
this.element = null;
this.config = null;
this.tip = null;
}
}, {
key: "show",
value: function show() {
var _this = this;
if ($(this.element).css('display') === 'none') {
throw new Error('Please use show on visible elements');
}
var showEvent = $.Event(this.constructor.Event.SHOW);
if (this.isWithContent() && this._isEnabled) {
$(this.element).trigger(showEvent);
var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
if (showEvent.isDefaultPrevented() || !isInTheDom) {
return;
}
var tip = this.getTipElement();
var tipId = _util2.default.getUID(this.constructor.NAME);
tip.setAttribute('id', tipId);
this.element.setAttribute('aria-describedby', tipId);
this.setContent();
if (this.config.animation) {
$(tip).addClass(ClassName.FADE);
}
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
var attachment = this._getAttachment(placement);
this.addAttachmentClass(attachment);
var container = this.config.container === false ? document.body : $(this.config.container);
$(tip).data(this.constructor.DATA_KEY, this);
if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
$(tip).appendTo(container);
}
$(this.element).trigger(this.constructor.Event.INSERTED);
this._popper = new _popper2.default(this.element, tip, {
placement: attachment,
modifiers: {
offset: {
offset: this.config.offset
},
flip: {
behavior: this.config.fallbackPlacement
},
arrow: {
element: Selector.ARROW
},
preventOverflow: {
boundariesElement: this.config.boundary
}
},
onCreate: function onCreate(data) {
if (data.originalPlacement !== data.placement) {
_this._handlePopperPlacementChange(data);
}
},
onUpdate: function onUpdate(data) {
_this._handlePopperPlacementChange(data);
}
});
$(tip).addClass(ClassName.SHOW); // If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
if ('ontouchstart' in document.documentElement) {
$('body').children().on('mouseover', null, $.noop);
}
var complete = function complete() {
if (_this.config.animation) {
_this._fixTransition();
}
var prevHoverState = _this._hoverState;
_this._hoverState = null;
$(_this.element).trigger(_this.constructor.Event.SHOWN);
if (prevHoverState === HoverState.OUT) {
_this._leave(null, _this);
}
};
if (_util2.default.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
$(this.tip).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
} else {
complete();
}
}
}
}, {
key: "hide",
value: function hide(callback) {
var _this2 = this;
var tip = this.getTipElement();
var hideEvent = $.Event(this.constructor.Event.HIDE);
var complete = function complete() {
if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
tip.parentNode.removeChild(tip);
}
_this2._cleanTipClass();
_this2.element.removeAttribute('aria-describedby');
$(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
if (_this2._popper !== null) {
_this2._popper.destroy();
}
if (callback) {
callback();
}
};
$(this.element).trigger(hideEvent);
if (hideEvent.isDefaultPrevented()) {
return;
}
$(tip).removeClass(ClassName.SHOW); // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
$('body').children().off('mouseover', null, $.noop);
}
this._activeTrigger[Trigger.CLICK] = false;
this._activeTrigger[Trigger.FOCUS] = false;
this._activeTrigger[Trigger.HOVER] = false;
if (_util2.default.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
$(tip).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
} else {
complete();
}
this._hoverState = '';
}
}, {
key: "update",
value: function update() {
if (this._popper !== null) {
this._popper.scheduleUpdate();
}
}
}, {
key: "isWithContent",
value: function isWithContent() {
return Boolean(this.getTitle());
}
}, {
key: "addAttachmentClass",
value: function addAttachmentClass(attachment) {
$(this.getTipElement()).addClass("".concat(CLASS_PREFIX, "-").concat(attachment));
}
}, {
key: "getTipElement",
value: function getTipElement() {
this.tip = this.tip || $(this.config.template)[0];
return this.tip;
}
}, {
key: "setContent",
value: function setContent() {
var $tip = $(this.getTipElement());
this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
$tip.removeClass("".concat(ClassName.FADE, " ").concat(ClassName.SHOW));
}
}, {
key: "setElementContent",
value: function setElementContent($element, content) {
var html = this.config.html;
if (_typeof(content) === 'object' && (content.nodeType || content.jquery)) {
// Content is a DOM node or a jQuery
if (html) {
if (!$(content).parent().is($element)) {
$element.empty().append(content);
}
} else {
$element.text($(content).text());
}
} else {
$element[html ? 'html' : 'text'](content);
}
}
}, {
key: "getTitle",
value: function getTitle() {
var title = this.element.getAttribute('data-original-title');
if (!title) {
title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
}
return title;
}
}, {
key: "_getAttachment",
value: function _getAttachment(placement) {
return AttachmentMap[placement.toUpperCase()];
}
}, {
key: "_setListeners",
value: function _setListeners() {
var _this3 = this;
var triggers = this.config.trigger.split(' ');
triggers.forEach(function (trigger) {
if (trigger === 'click') {
$(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, function (event) {
return _this3.toggle(event);
});
} else if (trigger !== Trigger.MANUAL) {
var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
$(_this3.element).on(eventIn, _this3.config.selector, function (event) {
return _this3._enter(event);
}).on(eventOut, _this3.config.selector, function (event) {
return _this3._leave(event);
});
}
$(_this3.element).closest('.modal').on('hide.bs.modal', function () {
return _this3.hide();
});
});
if (this.config.selector) {
this.config = _extends({}, this.config, {
trigger: 'manual',
selector: ''
});
} else {
this._fixTitle();
}
}
}, {
key: "_fixTitle",
value: function _fixTitle() {
var titleType = _typeof(this.element.getAttribute('data-original-title'));
if (this.element.getAttribute('title') || titleType !== 'string') {
this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
this.element.setAttribute('title', '');
}
}
}, {
key: "_enter",
value: function _enter(event, context) {
var dataKey = this.constructor.DATA_KEY;
context = context || $(event.currentTarget).data(dataKey);
if (!context) {
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
$(event.currentTarget).data(dataKey, context);
}
if (event) {
context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
}
if ($(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) {
context._hoverState = HoverState.SHOW;
return;
}
clearTimeout(context._timeout);
context._hoverState = HoverState.SHOW;
if (!context.config.delay || !context.config.delay.show) {
context.show();
return;
}
context._timeout = setTimeout(function () {
if (context._hoverState === HoverState.SHOW) {
context.show();
}
}, context.config.delay.show);
}
}, {
key: "_leave",
value: function _leave(event, context) {
var dataKey = this.constructor.DATA_KEY;
context = context || $(event.currentTarget).data(dataKey);
if (!context) {
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
$(event.currentTarget).data(dataKey, context);
}
if (event) {
context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
}
if (context._isWithActiveTrigger()) {
return;
}
clearTimeout(context._timeout);
context._hoverState = HoverState.OUT;
if (!context.config.delay || !context.config.delay.hide) {
context.hide();
return;
}
context._timeout = setTimeout(function () {
if (context._hoverState === HoverState.OUT) {
context.hide();
}
}, context.config.delay.hide);
}
}, {
key: "_isWithActiveTrigger",
value: function _isWithActiveTrigger() {
for (var trigger in this._activeTrigger) {
if (this._activeTrigger[trigger]) {
return true;
}
}
return false;
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _extends({}, this.constructor.Default, $(this.element).data(), config);
if (typeof config.delay === 'number') {
config.delay = {
show: config.delay,
hide: config.delay
};
}
if (typeof config.title === 'number') {
config.title = config.title.toString();
}
if (typeof config.content === 'number') {
config.content = config.content.toString();
}
_util2.default.typeCheckConfig(NAME, config, this.constructor.DefaultType);
return config;
}
}, {
key: "_getDelegateConfig",
value: function _getDelegateConfig() {
var config = {};
if (this.config) {
for (var key in this.config) {
if (this.constructor.Default[key] !== this.config[key]) {
config[key] = this.config[key];
}
}
}
return config;
}
}, {
key: "_cleanTipClass",
value: function _cleanTipClass() {
var $tip = $(this.getTipElement());
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
if (tabClass !== null && tabClass.length > 0) {
$tip.removeClass(tabClass.join(''));
}
}
}, {
key: "_handlePopperPlacementChange",
value: function _handlePopperPlacementChange(data) {
this._cleanTipClass();
this.addAttachmentClass(this._getAttachment(data.placement));
}
}, {
key: "_fixTransition",
value: function _fixTransition() {
var tip = this.getTipElement();
var initConfigAnimation = this.config.animation;
if (tip.getAttribute('x-placement') !== null) {
return;
}
$(tip).removeClass(ClassName.FADE);
this.config.animation = false;
this.hide();
this.show();
this.config.animation = initConfigAnimation;
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = _typeof(config) === 'object' && config;
if (!data && /dispose|hide/.test(config)) {
return;
}
if (!data) {
data = new Tooltip(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}, {
key: "NAME",
get: function get() {
return NAME;
}
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}, {
key: "Event",
get: function get() {
return Event;
}
}, {
key: "EVENT_KEY",
get: function get() {
return EVENT_KEY;
}
}, {
key: "DefaultType",
get: function get() {
return DefaultType;
}
}]);
return Tooltip;
}();
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Tooltip._jQueryInterface;
$.fn[NAME].Constructor = Tooltip;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Tooltip._jQueryInterface;
};
return Tooltip;
}(_jquery2.default, _popper2.default);
exports.default = Tooltip;
});

156
amd/src/util.js

@ -0,0 +1,156 @@
define(["exports", "jquery"], function (exports, _jquery) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0): util.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Util = function ($) {
/**
* ------------------------------------------------------------------------
* Private TransitionEnd Helpers
* ------------------------------------------------------------------------
*/
var transition = false;
var MAX_UID = 1000000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
function toType(obj) {
return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
}
function getSpecialTransitionEndEvent() {
return {
bindType: transition.end,
delegateType: transition.end,
handle: function handle(event) {
if ($(event.target).is(this)) {
return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
}
return undefined; // eslint-disable-line no-undefined
}
};
}
function transitionEndTest() {
if (typeof window !== 'undefined' && window.QUnit) {
return false;
}
return {
end: 'transitionend'
};
}
function transitionEndEmulator(duration) {
var _this = this;
var called = false;
$(this).one(Util.TRANSITION_END, function () {
called = true;
});
setTimeout(function () {
if (!called) {
Util.triggerTransitionEnd(_this);
}
}, duration);
return this;
}
function setTransitionEndSupport() {
transition = transitionEndTest();
$.fn.emulateTransitionEnd = transitionEndEmulator;
if (Util.supportsTransitionEnd()) {
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
}
}
function escapeId(selector) {
// We escape IDs in case of special selectors (selector = '#myId:something')
// $.escapeSelector does not exist in jQuery < 3
selector = typeof $.escapeSelector === 'function' ? $.escapeSelector(selector).substr(1) : selector.replace(/(:|\.|\[|\]|,|=|@)/g, '\\$1');
return selector;
}
/**
* --------------------------------------------------------------------------
* Public Util Api
* --------------------------------------------------------------------------
*/
var Util = {
TRANSITION_END: 'bsTransitionEnd',
getUID: function getUID(prefix) {
do {
// eslint-disable-next-line no-bitwise
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
} while (document.getElementById(prefix));
return prefix;
},
getSelectorFromElement: function getSelectorFromElement(element) {
var selector = element.getAttribute('data-target');
if (!selector || selector === '#') {
selector = element.getAttribute('href') || '';
} // If it's an ID
if (selector.charAt(0) === '#') {
selector = escapeId(selector);
}
try {
var $selector = $(document).find(selector);
return $selector.length > 0 ? selector : null;
} catch (err) {
return null;
}
},
reflow: function reflow(element) {
return element.offsetHeight;
},
triggerTransitionEnd: function triggerTransitionEnd(element) {
$(element).trigger(transition.end);
},
supportsTransitionEnd: function supportsTransitionEnd() {
return Boolean(transition);
},
isElement: function isElement(obj) {
return (obj[0] || obj).nodeType;
},
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
for (var property in configTypes) {
if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
var expectedTypes = configTypes[property];
var value = config[property];
var valueType = value && Util.isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error("".concat(componentName.toUpperCase(), ": ") + "Option \"".concat(property, "\" provided type \"").concat(valueType, "\" ") + "but expected type \"".concat(expectedTypes, "\"."));
}
}
}
}
};
setTransitionEndSupport();
return Util;
}(_jquery2.default);
exports.default = Util;
});

8
classes/admin_settingspage_tabs.php

@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Ryan Wyllie
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -23,11 +23,11 @@
defined('MOODLE_INTERNAL') || die();
/**
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Ryan Wyllie
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class theme_boost_admin_settingspage_tabs extends admin_settingpage {
class theme_ilb_admin_settingspage_tabs extends admin_settingpage {
/** @var The tabs */
protected $tabs = array();
@ -93,7 +93,7 @@ class theme_boost_admin_settingspage_tabs extends admin_settingpage {
return '';
}
return $OUTPUT->render_from_template('theme_boost/admin_setting_tabs', $context);
return $OUTPUT->render_from_template('theme_ilb/admin_setting_tabs', $context);
}
}

8
classes/autoprefixer.php

@ -18,15 +18,15 @@
* Autoprefixer.
*
* This autoprefixer has been developed to satisfy the basic needs of the
* theme Boost when working with Bootstrap 4 alpha. We do not recommend
* theme Ilb when working with Bootstrap 4 alpha. We do not recommend
* that this tool is shared, nor used outside of this theme.
*
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace theme_boost;
namespace theme_ilb;
defined('MOODLE_INTERNAL') || die();
use Sabberworm\CSS\CSSList\CSSList;
@ -54,7 +54,7 @@ use Sabberworm\CSS\Value\ValueList;
*
* Very basic implementation covering simple needs for Bootstrap 4.
*
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

6
classes/output/block_settings_renderer.php

@ -17,12 +17,12 @@
/**
* Overriden block settings renderer.
*
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace theme_boost\output;
namespace theme_ilb\output;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/blocks/settings/renderer.php');
@ -32,7 +32,7 @@ use moodle_url;
/**
* Overriden block settings renderer.
*
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

52
classes/output/core/admin_renderer.php

@ -1,52 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Admin renderer.
*
* @package theme_noanme
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace theme_boost\output\core;
defined('MOODLE_INTERNAL') || die();
use moodle_url;
require_once($CFG->dirroot . '/' . $CFG->admin . '/renderer.php');
/**
* Admin renderer class.
*
* @package theme_noanme
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_renderer extends \core_admin_renderer {
/**
* Output a warning message.
*
* @param string $message the message to display.
* @param string $type type class
* @return string HTML to output.
*/
protected function warning($message, $type = 'warning') {
return $this->box($message, 'generalbox m-b-1 admin' . $type);
}
}

8
classes/output/core/course_renderer.php

@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace theme_boost\output\core;
namespace theme_ilb\output\core;
defined('MOODLE_INTERNAL') || die();
use moodle_url;
@ -74,8 +74,12 @@ class course_renderer extends \core_course_renderer {
'inputsize' => $inputsize,
'value' => $value
];
if ($format != 'navbar') {
$helpicon = new \help_icon('coursesearch', 'core');
$data->helpicon = $helpicon->export_for_template($this);
}
return $this->render_from_template('theme_boost/course_search_form', $data);
return $this->render_from_template('theme_ilb/course_search_form', $data);
}
}

6
classes/output/core/files_renderer.php

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace theme_boost\output\core;
namespace theme_ilb\output\core;
use plugin_renderer_base;
@ -24,14 +24,14 @@ require_once($CFG->dirroot . '/files/renderer.php');
/**
* Rendering of files viewer related widgets.
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Rendering of files viewer related widgets.
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

749
classes/output/core_course/management/renderer.php

@ -0,0 +1,749 @@
<?php
// This file is part of The Bootstrap Moodle theme
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Renderers to align Moodle's HTML with that expected by Bootstrap
*
* @package theme_ilb
* @copyright 2018 Bas Brands
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace theme_ilb\output\core_course\management;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . "/course/classes/management_renderer.php");
use html_writer;
use core_course_category;
use moodle_url;
use core_course_list_element;
use lang_string;
use context_system;
use stdClass;
use action_menu;
use action_menu_link_secondary;
/**
* Main renderer for the course management pages.
*
* @package theme_ilb
* @copyright 2013 Sam Hemelryk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class renderer extends \core_course_management_renderer {
/**
* Opens a grid.
*
* Call {@link core_course_management_renderer::grid_column_start()} to create columns.
*
* @param string $id An id to give this grid.
* @param string $class A class to give this grid.
* @return string
*/
public function grid_start($id = null, $class = null) {
$gridclass = 'grid-start grid-row-r d-flex flex-wrap row';
if (is_null($class)) {
$class = $gridclass;
} else {
$class .= ' ' . $gridclass;
}
$attributes = array();
if (!is_null($id)) {
$attributes['id'] = $id;
}
return html_writer::start_div($class, $attributes);
}
/**
* Opens a grid column
*
* @param int $size The number of segments this column should span.
* @param string $id An id to give the column.
* @param string $class A class to give the column.
* @return string
*/
public function grid_column_start($size, $id = null, $class = null) {
if ($id == 'course-detail') {
$size = 12;
$bootstrapclass = 'col-md-'.$size;
} else {
$bootstrapclass = 'd-flex flex-wrap px-3 mb-3';
}
$yuigridclass = "col-sm";
if (is_null($class)) {
$class = $yuigridclass . ' ' . $bootstrapclass;
} else {
$class .= ' ' . $yuigridclass . ' ' . $bootstrapclass;
}
$attributes = array();
if (!is_null($id)) {
$attributes['id'] = $id;
}
return html_writer::start_div($class . " grid_column_start", $attributes);
}
/**
* Renderers detailed course information.
*
* @param core_course_list_element $course The course to display details for.
* @return string
*/
public function course_detail(core_course_list_element $course) {
$details = \core_course\management\helper::get_course_detail_array($course);
$fullname = $details['fullname']['value'];
$html = html_writer::start_div('course-detail card');
$html .= html_writer::start_div('card-header');
$html .= html_writer::tag('h3', $fullname, array('id' => 'course-detail-title',
'class' => 'card-title', 'tabindex' => '0'));
$html .= html_writer::end_div();
$html .= html_writer::start_div('card-body');
$html .= $this->course_detail_actions($course);
foreach ($details as $class => $data) {
$html .= $this->detail_pair($data['key'], $data['value'], $class);
}
$html .= html_writer::end_div();
$html .= html_writer::end_div();
return $html;
}
/**
* Renders html to display a course search form
*
* @param string $value default value to populate the search field
* @param string $format display format - 'plain' (default), 'short' or 'navbar'
* @return string
*/
public function course_search_form($value = '', $format = 'plain') {
static $count = 0;
$formid = 'coursesearch';
if ((++$count) > 1) {
$formid .= $count;
}
switch ($format) {
case 'navbar' :
$formid = 'coursesearchnavbar';
$inputid = 'navsearchbox';
$inputsize = 20;
break;
case 'short' :
$inputid = 'shortsearchbox';
$inputsize = 12;
break;
default :
$inputid = 'coursesearchbox';
$inputsize = 30;
}
$strsearchcourses = get_string("searchcourses");
$searchurl = new moodle_url('/course/management.php');
$output = html_writer::start_div('row');
$output .= html_writer::start_div('col-md-12');
$output .= html_writer::start_tag('form', array('class' => 'card', 'id' => $formid,
'action' => $searchurl, 'method' => 'get'));
$output .= html_writer::start_tag('fieldset', array('class' => 'coursesearchbox invisiblefieldset'));
$output .= html_writer::tag('div', $this->output->heading($strsearchcourses.': ', 2, 'm-0'),
array('class' => 'card-header'));
$output .= html_writer::start_div('card-body');
$output .= html_writer::start_div('input-group col-sm-6 col-lg-4 m-auto');
$output .= html_writer::empty_tag('input', array('class' => 'form-control', 'type' => 'text', 'id' => $inputid,
'size' => $inputsize, 'name' => 'search', 'value' => s($value)));
$output .= html_writer::start_tag('span', array('class' => 'input-group-btn'));
$output .= html_writer::tag('button', get_string('go'), array('class' => 'btn btn-primary', 'type' => 'submit'));
$output .= html_writer::end_tag('span');
$output .= html_writer::end_div();
$output .= html_writer::end_div();
$output .= html_writer::end_tag('fieldset');
$output .= html_writer::end_tag('form');
$output .= html_writer::end_div();
$output .= html_writer::end_div();
return $output;
}
/**
* Presents a course category listing.
*
* @param core_course_category $category The currently selected category. Also the category to highlight in the listing.
* @return string
*/
public function category_listing(core_course_category $category = null) {
if ($category === null) {
$selectedparents = array();
$selectedcategory = null;
} else {
$selectedparents = $category->get_parents();
$selectedparents[] = $category->id;
$selectedcategory = $category->id;
}
$catatlevel = \core_course\management\helper::get_expanded_categories('');
$catatlevel[] = array_shift($selectedparents);
$catatlevel = array_unique($catatlevel);
$listing = core_course_category::get(0)->get_children();
$attributes = array(
'class' => 'ml-1 list-unstyled',
'role' => 'tree',
'aria-labelledby' => 'category-listing-title'
);
$html = html_writer::start_div('category-listing card w-100');
$html .= html_writer::tag('h3', get_string('categories'),
array('class' => 'card-header', 'id' => 'category-listing-title'));
$html .= html_writer::start_div('card-body');
$html .= $this->category_listing_actions($category);
$html .= html_writer::start_tag('ul', $attributes);
foreach ($listing as $listitem) {
// Render each category in the listing.
$subcategories = array();
if (in_array($listitem->id, $catatlevel)) {
$subcategories = $listitem->get_children();
}
$html .= $this->category_listitem(
$listitem,
$subcategories,
$listitem->get_children_count(),
$selectedcategory,
$selectedparents
);
}
$html .= html_writer::end_tag('ul');
$html .= $this->category_bulk_actions($category);
$html .= html_writer::end_div();
$html .= html_writer::end_div();
return $html;
}
/**
* Renders a category list item.
*
* This function gets called recursively to render sub categories.
*
* @param core_course_category $category The category to render as listitem.
* @param core_course_category[] $subcategories The subcategories belonging to the category being rented.
* @param int $totalsubcategories The total number of sub categories.
* @param int $selectedcategory The currently selected category
* @param int[] $selectedcategories The path to the selected category and its ID.
* @return string
*/
public function category_listitem(core_course_category $category, array $subcategories, $totalsubcategories,
$selectedcategory = null, $selectedcategories = array()) {
$isexpandable = ($totalsubcategories > 0);
$isexpanded = (!empty($subcategories));
$activecategory = ($selectedcategory === $category->id);
$attributes = array(
'class' => 'listitem listitem-category list-group-item list-group-item-action',
'data-id' => $category->id,
'data-expandable' => $isexpandable ? '1' : '0',
'data-expanded' => $isexpanded ? '1' : '0',
'data-selected' => $activecategory ? '1' : '0',
'data-visible' => $category->visible ? '1' : '0',
'role' => 'treeitem',
'aria-expanded' => $isexpanded ? 'true' : 'false'
);
$text = $category->get_formatted_name();
if ($category->parent) {
$a = new stdClass;
$a->category = $text;
$a->parentcategory = $category->get_parent_coursecat()->get_formatted_name();
$textlabel = get_string('categorysubcategoryof', 'moodle', $a);
}
$courseicon = $this->output->pix_icon('i/course', get_string('courses'));
$bcatinput = array(
'type' => 'checkbox',
'name' => 'bcat[]',
'value' => $category->id,
'class' => 'bulk-action-checkbox',
'aria-label' => get_string('bulkactionselect', 'moodle', $text),
'data-action' => 'select'
);
if (!$category->can_resort_subcategories() && !$category->has_manage_capability()) {
// Very very hardcoded here.
$bcatinput['style'] = 'visibility:hidden';
}
$viewcaturl = new moodle_url('/course/management.php', array('categoryid' => $category->id));
if ($isexpanded) {
$icon = $this->output->pix_icon('t/switch_minus', get_string('collapse'),
'moodle', array('class' => 'tree-icon', 'title' => ''));
$icon = html_writer::link(
$viewcaturl,
$icon,
array(
'class' => 'float-left',
'data-action' => 'collapse',
'title' => get_string('collapsecategory', 'moodle', $text),
'aria-controls' => 'subcategoryof'.$category->id
)
);
} else if ($isexpandable) {
$icon = $this->output->pix_icon('t/switch_plus', get_string('expand'),
'moodle', array('class' => 'tree-icon', 'title' => ''));
$icon = html_writer::link(
$viewcaturl,
$icon,
array(
'class' => 'float-left',
'data-action' => 'expand',
'title' => get_string('expandcategory', 'moodle', $text)
)
);
} else {
$icon = $this->output->pix_icon(
'i/empty',
'',
'moodle',
array('class' => 'tree-icon'));
$icon = html_writer::span($icon, 'float-left');
}
$actions = \core_course\management\helper::get_category_listitem_actions($category);
$hasactions = !empty($actions) || $category->can_create_course();
$html = html_writer::start_tag('li', $attributes);
$html .= html_writer::start_div('clearfix');
$html .= html_writer::start_div('float-left ba-checkbox');
$html .= html_writer::empty_tag('input', $bcatinput).'&nbsp;';
$html .= html_writer::end_div();
$html .= $icon;
if ($hasactions) {
$textattributes = array('class' => 'float-left categoryname');
} else {
$textattributes = array('class' => 'float-left categoryname without-actions');
}
if (isset($textlabel)) {
$textattributes['aria-label'] = $textlabel;
}
$html .= html_writer::link($viewcaturl, $text, $textattributes);
$html .= html_writer::start_div('float-right d-flex');
if ($category->idnumber) {
$html .= html_writer::tag('span', s($category->idnumber), array('class' => 'dimmed idnumber'));
}
if ($hasactions) {
$html .= $this->category_listitem_actions($category, $actions);
}
$countid = 'course-count-'.$category->id;
$html .= html_writer::span(
html_writer::span($category->get_courses_count()) .
html_writer::span(get_string('courses'), 'accesshide', array('id' => $countid)) .
$courseicon,
'course-count dimmed',
array('aria-labelledby' => $countid)
);
$html .= html_writer::end_div();
$html .= html_writer::end_div();
if ($isexpanded) {
$html .= html_writer::start_tag('ul',
array('class' => 'ml', 'role' => 'group', 'id' => 'subcategoryof'.$category->id));
$catatlevel = \core_course\management\helper::get_expanded_categories($category->path);
$catatlevel[] = array_shift($selectedcategories);
$catatlevel = array_unique($catatlevel);
foreach ($subcategories as $listitem) {
$childcategories = (in_array($listitem->id, $catatlevel)) ? $listitem->get_children() : array();
$html .= $this->category_listitem(
$listitem,
$childcategories,
$listitem->get_children_count(),
$selectedcategory,
$selectedcategories
);
}
$html .= html_writer::end_tag('ul');
}
$html .= html_writer::end_tag('li');
return $html;
}
/**
* Renderers the actions that are possible for the course category listing.
*
* These are not the actions associated with an individual category listing.
* That happens through category_listitem_actions.
*
* @param core_course_category $category
* @return string
*/
public function category_listing_actions(core_course_category $category = null) {
$actions = array();
$cancreatecategory = $category && $category->can_create_subcategory();
$cancreatecategory = $cancreatecategory || core_course_category::can_create_top_level_category();
if ($category === null) {
$category = core_course_category::get(0);
}
if ($cancreatecategory) {
$url = new moodle_url('/course/editcategory.php', array('parent' => $category->id));
$actions[] = html_writer::link($url, get_string('createnewcategory'), array('class' => 'btn btn-default'));
}
if (core_course_category::can_approve_course_requests()) {
$actions[] = html_writer::link(new moodle_url('/course/pending.php'), get_string('coursespending'));
}
if (count($actions) === 0) {
return '';
}
return html_writer::div(join(' ', $actions), 'listing-actions category-listing-actions mb-3');
}
/**
* Renders a course listing.
*
* @param core_course_category $category The currently selected category. This is what the listing is focused on.
* @param core_course_list_element $course The currently selected course.
* @param int $page The page being displayed.
* @param int $perpage The number of courses to display per page.
* @param string|null $viewmode The view mode the page is in, one out of 'default', 'combined', 'courses' or 'categories'.
* @return string
*/
public function course_listing(core_course_category $category = null, core_course_list_element $course = null,
$page = 0, $perpage = 20, $viewmode = 'default') {
if ($category === null) {
$html = html_writer::start_div('select-a-category');
$html .= html_writer::tag('h3', get_string('courses'),
array('id' => 'course-listing-title', 'tabindex' => '0'));
$html .= $this->output->notification(get_string('selectacategory'), 'notifymessage');
$html .= html_writer::end_div();
return $html;
}
$page = max($page, 0);
$perpage = max($perpage, 2);
$totalcourses = $category->coursecount;
$totalpages = ceil($totalcourses / $perpage);
if ($page > $totalpages - 1) {
$page = $totalpages - 1;
}
$options = array(
'offset' => $page * $perpage,
'limit' => $perpage
);
$courseid = isset($course) ? $course->id : null;
$class = '';
if ($page === 0) {
$class .= ' firstpage';
}
if ($page + 1 === (int)$totalpages) {
$class .= ' lastpage';
}
$html = html_writer::start_div('card course-listing w-100'.$class, array(
'data-category' => $category->id,
'data-page' => $page,
'data-totalpages' => $totalpages,
'data-totalcourses' => $totalcourses,
'data-canmoveoutof' => $category->can_move_courses_out_of() && $category->can_move_courses_into()
));
$html .= html_writer::tag('h3', $category->get_formatted_name(),
array('id' => 'course-listing-title', 'tabindex' => '0', 'class' => 'card-header'));
$html .= html_writer::start_div('card-body');
$html .= $this->course_listing_actions($category, $course, $perpage);
$html .= $this->listing_pagination($category, $page, $perpage, false, $viewmode);
$html .= html_writer::start_tag('ul', array('class' => 'ml course-list', 'role' => 'group'));
foreach ($category->get_courses($options) as $listitem) {
$html .= $this->course_listitem($category, $listitem, $courseid);
}
$html .= html_writer::end_tag('ul');
$html .= $this->listing_pagination($category, $page, $perpage, true, $viewmode);
$html .= $this->course_bulk_actions($category);
$html .= html_writer::end_div();
$html .= html_writer::end_div();
return $html;
}
/**
* Renderers a course list item.
*
* This function will be called for every course being displayed by course_listing.
*
* @param core_course_category $category The currently selected category and the category the course belongs to.
* @param core_course_list_element $course The course to produce HTML for.
* @param int $selectedcourse The id of the currently selected course.
* @return string
*/
public function course_listitem(core_course_category $category, core_course_list_element $course, $selectedcourse) {
$text = $course->get_formatted_name();
$attributes = array(
'class' => 'listitem listitem-course list-group-item list-group-item-action',
'data-id' => $course->id,
'data-selected' => ($selectedcourse == $course->id) ? '1' : '0',
'data-visible' => $course->visible ? '1' : '0'
);
$bulkcourseinput = array(
'type' => 'checkbox',
'name' => 'bc[]',
'value' => $course->id,
'class' => 'bulk-action-checkbox',
'aria-label' => get_string('bulkactionselect', 'moodle', $text),
'data-action' => 'select'
);
if (!$category->has_manage_capability()) {
// Very very hardcoded here.
$bulkcourseinput['style'] = 'visibility:hidden';
}
$viewcourseurl = new moodle_url($this->page->url, array('courseid' => $course->id));
$html = html_writer::start_tag('li', $attributes);
$html .= html_writer::start_div('clearfix');
if ($category->can_resort_courses()) {
// In order for dnd to be available the user must be able to resort the category children..
$html .= html_writer::div($this->output->pix_icon('i/move_2d', get_string('dndcourse')), 'float-left drag-handle');
}
$html .= html_writer::start_div('ba-checkbox float-left');
$html .= html_writer::empty_tag('input', $bulkcourseinput).'&nbsp;';
$html .= html_writer::end_div();
$html .= html_writer::link($viewcourseurl, $text, array('class' => 'float-left coursename'));
$html .= html_writer::start_div('float-right');
if ($course->idnumber) {
$html .= html_writer::tag('span', s($course->idnumber), array('class' => 'dimmed idnumber'));
}
$html .= $this->course_listitem_actions($category, $course);
$html .= html_writer::end_div();
$html .= html_writer::end_div();
$html .= html_writer::end_tag('li');
return $html;
}
/**
* Renderers actions for the course listing.
*
* Not to be confused with course_listitem_actions which renderers the actions for individual courses.
*
* @param core_course_category $category
* @param core_course_list_element $course The currently selected course.
* @param int $perpage
* @return string
*/
public function course_listing_actions(core_course_category $category, core_course_list_element $course = null, $perpage = 20) {
$actions = array();
if ($category->can_create_course()) {
$url = new moodle_url('/course/edit.php', array('category' => $category->id, 'returnto' => 'catmanage'));
$actions[] = html_writer::link($url, get_string('createnewcourse'), array('class' => 'btn btn-default'));
}
if ($category->can_request_course()) {
// Request a new course.
$url = new moodle_url('/course/request.php', array('return' => 'management'));
$actions[] = html_writer::link($url, get_string('requestcourse'));
}
if ($category->can_resort_courses()) {
$params = $this->page->url->params();
$params['action'] = 'resortcourses';
$params['sesskey'] = sesskey();
$baseurl = new moodle_url('/course/management.php', $params);
$fullnameurl = new moodle_url($baseurl, array('resort' => 'fullname'));
$fullnameurldesc = new moodle_url($baseurl, array('resort' => 'fullnamedesc'));
$shortnameurl = new moodle_url($baseurl, array('resort' => 'shortname'));
$shortnameurldesc = new moodle_url($baseurl, array('resort' => 'shortnamedesc'));
$idnumberurl = new moodle_url($baseurl, array('resort' => 'idnumber'));
$idnumberdescurl = new moodle_url($baseurl, array('resort' => 'idnumberdesc'));
$timecreatedurl = new moodle_url($baseurl, array('resort' => 'timecreated'));
$timecreateddescurl = new moodle_url($baseurl, array('resort' => 'timecreateddesc'));
$menu = new action_menu(array(
new action_menu_link_secondary($fullnameurl,
null,
get_string('sortbyx', 'moodle', get_string('fullnamecourse'))),
new action_menu_link_secondary($fullnameurldesc,
null,
get_string('sortbyxreverse', 'moodle', get_string('fullnamecourse'))),
new action_menu_link_secondary($shortnameurl,
null,
get_string('sortbyx', 'moodle', get_string('shortnamecourse'))),
new action_menu_link_secondary($shortnameurldesc,
null,
get_string('sortbyxreverse', 'moodle', get_string('shortnamecourse'))),
new action_menu_link_secondary($idnumberurl,
null,
get_string('sortbyx', 'moodle', get_string('idnumbercourse'))),
new action_menu_link_secondary($idnumberdescurl,
null,
get_string('sortbyxreverse', 'moodle', get_string('idnumbercourse'))),
new action_menu_link_secondary($timecreatedurl,
null,
get_string('sortbyx', 'moodle', get_string('timecreatedcourse'))),
new action_menu_link_secondary($timecreateddescurl,
null,
get_string('sortbyxreverse', 'moodle', get_string('timecreatedcourse')))
));
$menu->set_menu_trigger(get_string('resortcourses'));
$actions[] = $this->render($menu);
}
$strall = get_string('all');
$menu = new action_menu(array(
new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 5)), null, 5),
new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 10)), null, 10),
new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 20)), null, 20),
new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 50)), null, 50),
new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 100)), null, 100),
new action_menu_link_secondary(new moodle_url($this->page->url, array('perpage' => 999)), null, $strall),
));
if ((int)$perpage === 999) {
$perpage = $strall;
}
$menu->attributes['class'] .= ' courses-per-page';
$menu->set_menu_trigger(get_string('perpagea', 'moodle', $perpage));
$actions[] = $this->render($menu);
return html_writer::div(join(' ', $actions), 'listing-actions course-listing-actions');
}
/**
* Displays a search result listing.
*
* @param array $courses The courses to display.
* @param int $totalcourses The total number of courses to display.
* @param core_course_list_element $course The currently selected course if there is one.
* @param int $page The current page, starting at 0.
* @param int $perpage The number of courses to display per page.
* @param string $search The string we are searching for.
* @return string
*/
public function search_listing(array $courses, $totalcourses, core_course_list_element $course = null, $page = 0, $perpage = 20,
$search = '') {
$page = max($page, 0);
$perpage = max($perpage, 2);
$totalpages = ceil($totalcourses / $perpage);
if ($page > $totalpages - 1) {
$page = $totalpages - 1;
}
$courseid = isset($course) ? $course->id : null;
$first = true;
$last = false;
$i = $page * $perpage;
$html = html_writer::start_div('course-listing w-100', array(
'data-category' => 'search',
'data-page' => $page,
'data-totalpages' => $totalpages,
'data-totalcourses' => $totalcourses
));
$html .= html_writer::tag('h3', get_string('courses'));
$html .= $this->search_pagination($totalcourses, $page, $perpage);
$html .= html_writer::start_tag('ul', array('class' => 'ml'));
foreach ($courses as $listitem) {
$i++;
if ($i == $totalcourses) {
$last = true;
}
$html .= $this->search_listitem($listitem, $courseid, $first, $last);
$first = false;
}
$html .= html_writer::end_tag('ul');
$html .= $this->search_pagination($totalcourses, $page, $perpage, true, $search);
$html .= $this->course_search_bulk_actions();
$html .= html_writer::end_div();
return $html;
}
/**
* Renderers a search result course list item.
*
* This function will be called for every course being displayed by course_listing.
*
* @param core_course_list_element $course The course to produce HTML for.
* @param int $selectedcourse The id of the currently selected course.
* @return string
*/
public function search_listitem(core_course_list_element $course, $selectedcourse) {
$text = $course->get_formatted_name();
$attributes = array(
'class' => 'listitem listitem-course list-group-item list-group-item-action',
'data-id' => $course->id,
'data-selected' => ($selectedcourse == $course->id) ? '1' : '0',
'data-visible' => $course->visible ? '1' : '0'
);
$bulkcourseinput = '';
if (core_course_category::get($course->category)->can_move_courses_out_of()) {
$bulkcourseinput = array(
'type' => 'checkbox',
'name' => 'bc[]',
'value' => $course->id,
'class' => 'bulk-action-checkbox',
'aria-label' => get_string('bulkactionselect', 'moodle', $text),
'data-action' => 'select'
);
}
$viewcourseurl = new moodle_url($this->page->url, array('courseid' => $course->id));
$categoryname = core_course_category::get($course->category)->get_formatted_name();
$html = html_writer::start_tag('li', $attributes);
$html .= html_writer::start_div('clearfix');
$html .= html_writer::start_div('float-left');
if ($bulkcourseinput) {
$html .= html_writer::empty_tag('input', $bulkcourseinput).'&nbsp;';
}
$html .= html_writer::end_div();
$html .= html_writer::link($viewcourseurl, $text, array('class' => 'float-left coursename'));
$html .= html_writer::tag('span', $categoryname, array('class' => 'float-left categoryname'));
$html .= html_writer::start_div('float-right');
$html .= $this->search_listitem_actions($course);
$html .= html_writer::tag('span', s($course->idnumber), array('class' => 'dimmed idnumber'));
$html .= html_writer::end_div();
$html .= html_writer::end_div();
$html .= html_writer::end_tag('li');
return $html;
}
/**
* Renderers a key value pair of information for display.
*
* @param string $key
* @param string $value
* @param string $class
* @return string
*/
protected function detail_pair($key, $value, $class ='') {
$html = html_writer::start_div('detail-pair row yui3-g '.preg_replace('#[^a-zA-Z0-9_\-]#', '-', $class));
$html .= html_writer::div(html_writer::span($key), 'pair-key col-md-3 yui3-u-1-4 font-weight-bold');
$html .= html_writer::div(html_writer::span($value), 'pair-value col-md-8 yui3-u-3-4');
$html .= html_writer::end_div();
return $html;
}
/**
* A collection of actions for a course.
*
* @param core_course_list_element $course The course to display actions for.
* @return string
*/
public function course_detail_actions(core_course_list_element $course) {
$actions = \core_course\management\helper::get_course_detail_actions($course);
if (empty($actions)) {
return '';
}
$options = array();
foreach ($actions as $action) {
$options[] = $this->action_link($action['url'], $action['string'], null,
array('class' => 'btn btn-sm btn-secondary mr-1 mb-3'));
}
return html_writer::div(join('', $options), 'listing-actions course-detail-listing-actions');
}
}

6
classes/output/core_question/bank_renderer.php

@ -17,12 +17,12 @@
/**
* Question renderer.
*
* @package theme_boost
* @package theme_ilb
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace theme_boost\output\core_question;
namespace theme_ilb\output\core_question;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/' . $CFG->admin . '/renderer.php');
@ -30,7 +30,7 @@ require_once($CFG->dirroot . '/' . $CFG->admin . '/renderer.php');
/**
* Question renderer class.
*
* @package theme_boost
* @package theme_ilb
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

71
classes/output/core_renderer.php

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace theme_boost\output;
namespace theme_ilb\output;
use coding_exception;
use html_writer;
@ -31,7 +31,6 @@ use preferences_groups;
use action_menu;
use help_icon;
use single_button;
use paging_bar;
use context_course;
use pix_icon;
@ -40,7 +39,7 @@ defined('MOODLE_INTERNAL') || die;
/**
* Renderers to align Moodle's HTML with that expected by Bootstrap
*
* @package theme_boost
* @package theme_ilb
* @copyright 2012 Bas Brands, www.basbrands.nl
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -62,7 +61,7 @@ class core_renderer extends \core_renderer {
if (is_array($classes)) {
$classes = implode(' ', $classes);
}
return parent::box_start($classes . ' p-y-1', $id, $attributes);
return parent::box_start($classes . ' py-3', $id, $attributes);
}
/**
@ -73,29 +72,14 @@ class core_renderer extends \core_renderer {
public function full_header() {
global $PAGE;
$html = html_writer::start_tag('header', array('id' => 'page-header', 'class' => 'row'));
$html .= html_writer::start_div('col-xs-12 p-a-1');
$html .= html_writer::start_div('card');
$html .= html_writer::start_div('card-block');
$html .= html_writer::div($this->context_header_settings_menu(), 'pull-xs-right context-header-settings-menu');
$html .= html_writer::start_div('pull-xs-left');
$html .= $this->context_header();
$html .= html_writer::end_div();
$pageheadingbutton = $this->page_heading_button();
if (empty($PAGE->layout_options['nonavbar'])) {
$html .= html_writer::start_div('clearfix w-100 pull-xs-left', array('id' => 'page-navbar'));
$html .= html_writer::tag('div', $this->navbar(), array('class' => 'breadcrumb-nav'));
$html .= html_writer::div($pageheadingbutton, 'breadcrumb-button pull-xs-right');
$html .= html_writer::end_div();
} else if ($pageheadingbutton) {
$html .= html_writer::div($pageheadingbutton, 'breadcrumb-button nonavbar pull-xs-right');
}
$html .= html_writer::tag('div', $this->course_header(), array('id' => 'course-header'));
$html .= html_writer::end_div();
$html .= html_writer::end_div();
$html .= html_writer::end_div();
$html .= html_writer::end_tag('header');
return $html;
$header = new stdClass();
$header->settingsmenu = $this->context_header_settings_menu();
$header->contextheader = $this->context_header();
$header->hasnavbar = empty($PAGE->layout_options['nonavbar']);
$header->navbar = $this->navbar();
$header->pageheadingbutton = $this->page_heading_button();
$header->courseheader = $this->course_header();
return $this->render_from_template('theme_ilb/header', $header);
}
/**
@ -147,7 +131,7 @@ class core_renderer extends \core_renderer {
if ($this->should_display_main_logo($headinglevel)) {
$sitename = format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID)));
return html_writer::div(html_writer::empty_tag('img', [
'src' => $this->get_logo_url(null, 150), 'alt' => $sitename]), 'logo');
'src' => $this->get_logo_url(null, 150), 'alt' => $sitename, 'class' => 'img-fluid']), 'logo');
}
return parent::context_header($headerinfo, $headinglevel);
@ -432,18 +416,6 @@ class core_renderer extends \core_renderer {
return $this->render_from_template('core/single_button', $button->export_for_template($this));
}
/**
* Renders a paging bar.
*
* @param paging_bar $pagingbar The object.
* @return string HTML
*/
protected function render_paging_bar(paging_bar $pagingbar) {
// Any more than 10 is not usable and causes wierd wrapping of the pagination in this theme.
$pagingbar->maxdisplay = 10;
return $this->render_from_template('core/paging_bar', $pagingbar->export_for_template($this));
}
/**
* Renders the login form.
*
@ -451,19 +423,24 @@ class core_renderer extends \core_renderer {
* @return string
*/
public function render_login(\core_auth\output\login $form) {
global $SITE;
global $CFG, $SITE;
$context = $form->export_for_template($this);
// Override because rendering is not supported in template yet.
if ($CFG->rememberusername == 0) {
$context->cookieshelpiconformatted = $this->help_icon('cookiesenabledonlysession');
} else {
$context->cookieshelpiconformatted = $this->help_icon('cookiesenabled');
}
$context->errorformatted = $this->error_text($context->error);
$url = $this->get_logo_url();
if ($url) {
$url = $url->out(false);
}
$context->logourl = $url;
$context->sitename = format_string($SITE->fullname, true, ['context' => context_course::instance(SITEID), "escape" => false]);
$context->sitename = format_string($SITE->fullname, true,
['context' => context_course::instance(SITEID), "escape" => false]);
return $this->render_from_template('core/loginform', $context);
}
@ -483,7 +460,8 @@ class core_renderer extends \core_renderer {
$url = $url->out(false);
}
$context['logourl'] = $url;
$context['sitename'] = format_string($SITE->fullname, true, ['context' => context_course::instance(SITEID), "escape" => false]);
$context['sitename'] = format_string($SITE->fullname, true,
['context' => context_course::instance(SITEID), "escape" => false]);
return $this->render_from_template('core/signup_form_layout', $context);
}
@ -547,7 +525,6 @@ class core_renderer extends \core_renderer {
$showusermenu = true;
}
if ($showfrontpagemenu) {
$settingsnode = $this->page->settingsnav->find('frontpage', navigation_node::TYPE_SETTING);
if ($settingsnode) {
@ -558,7 +535,7 @@ class core_renderer extends \core_renderer {
if ($skipped) {
$text = get_string('morenavigationlinks');
$url = new moodle_url('/course/admin.php', array('courseid' => $this->page->course->id));
$link = new action_link($url, $text, null, null, new pix_icon('t/edit', $text));
$link = new action_link($url, $text, null, null, new pix_icon('t/edit', ''));
$menu->add_secondary_action($link);
}
}
@ -572,7 +549,7 @@ class core_renderer extends \core_renderer {
if ($skipped) {
$text = get_string('morenavigationlinks');
$url = new moodle_url('/course/admin.php', array('courseid' => $this->page->course->id));
$link = new action_link($url, $text, null, null, new pix_icon('t/edit', $text));
$link = new action_link($url, $text, null, null, new pix_icon('t/edit', ''));
$menu->add_secondary_action($link);
}
}
@ -692,7 +669,7 @@ class core_renderer extends \core_renderer {
$link = new action_link(new moodle_url('#'), $menuitem->text, null, ['disabled' => true], $menuitem->icon);
}
if ($indent) {
$link->add_class('m-l-1');
$link->add_class('ml-4');
}
if (!empty($menuitem->classes)) {
$link->add_class(implode(" ", $menuitem->classes));

6
classes/output/core_renderer_maintenance.php

@ -18,12 +18,12 @@
/**
* Overriden core maintenance renderer.
*
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace theme_boost\output;
namespace theme_ilb\output;
defined('MOODLE_INTERNAL') || die();
use coding_exception;
@ -34,7 +34,7 @@ use stdClass;
/**
* The maintenance renderer.
*
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

6
classes/output/gradereport_history_renderer.php

@ -17,12 +17,12 @@
/**
* Overriden gradereport_history renderer.
*
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace theme_boost\output;
namespace theme_ilb\output;
defined('MOODLE_INTERNAL') || die();
use gradereport_history\output\user_button;
@ -30,7 +30,7 @@ use gradereport_history\output\user_button;
/**
* Overriden gradereport_history renderer.
*
* @package theme_boost
* @package theme_ilb
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

52
classes/privacy/provider.php

@ -15,32 +15,64 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Privacy Subsystem implementation for theme_boost.
* Privacy Subsystem implementation for theme_ilb.
*
* @package theme_boost
* @package theme_ilb
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace theme_boost\privacy;
namespace theme_ilb\privacy;
use \core_privacy\local\metadata\collection;
defined('MOODLE_INTERNAL') || die();
/**
* The boost theme does not store any data.
* The ilb theme stores a user preference data.
*
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
class provider implements
// This plugin has data.
\core_privacy\local\metadata\provider,
// This plugin has some sitewide user preferences to export.
\core_privacy\local\request\user_preference_provider {
/** The user preference for the navigation drawer. */
const DRAWER_OPEN_NAV = 'drawer-open-nav';
/**
* Returns meta data about this system.
*
* @param collection $items The initialised item collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $items) : collection {
$items->add_user_preference(self::DRAWER_OPEN_NAV, 'privacy:metadata:preference:draweropennav');
return $items;
}
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
* Store all user preferences for the plugin.
*
* @return string
* @param int $userid The userid of the user whose data is to be exported.
*/
public static function get_reason() : string {
return 'privacy:metadata';
public static function export_user_preferences(int $userid) {
$draweropennavpref = get_user_preferences(self::DRAWER_OPEN_NAV, null, $userid);
if (isset($draweropennavpref)) {
$preferencestring = get_string('privacy:drawernavclosed', 'theme_ilb');
if ($draweropennavpref == 'true') {
$preferencestring = get_string('privacy:drawernavopen', 'theme_ilb');
}
\core_privacy\local\request\writer::export_user_preference(
'theme_ilb',
self::DRAWER_OPEN_NAV,
$draweropennavpref,
$preferencestring
);
}
}
}

106
cli/import-bootswatch.php

@ -0,0 +1,106 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Used to convert a bootswatch file from https://bootswatch.com/ to a Moodle preset.
*
* @package theme_ilb
* @subpackage cli
* @copyright 2016 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../../config.php');
require_once($CFG->libdir.'/clilib.php');
$usage = "
Utility to convert a Bootswatch theme to a Moodle preset compatible with Bootstrap 4.
Download _variables.scss and _bootswatch.scss files from https://bootswatch.com/
Run this script. It will generate a new file 'preset.scss' which can be used as
a Moodle preset.
Usage:
# php import-bootswatch.php [--help|-h]
# php import-bootswatch.php --variables=<path> --bootswatch=<path> --preset=<path>
Options:
-h --help Print this help.
--variables=<path> Path to the input variables file, defaults to _variables.scss
--bootswatch=<path> Path to the input bootswatch file, defauls to _bootswatch.scss
--preset=<path> Path to the output preset file, defaults to preset.scss
";
list($options, $unrecognised) = cli_get_params([
'help' => false,
'variables' => '_variables.scss',
'bootswatch' => '_bootswatch.scss',
'preset' => 'preset.scss',
], [
'h' => 'help',
]);
if ($unrecognised) {
$unrecognised = implode(PHP_EOL.' ', $unrecognised);
cli_error(get_string('cliunknowoption', 'core_admin', $unrecognised));
}
if ($options['help']) {
cli_writeln($usage);
exit(2);
}
if (is_readable($options['variables'])) {
$sourcevariables = file_get_contents($options['variables']);
} else {
cli_writeln($usage);
cli_error('Error reading the variables file: '.$options['variables']);
}
if (is_readable($options['bootswatch'])) {
$sourcebootswatch = file_get_contents($options['bootswatch']);
} else {
cli_writeln($usage);
cli_error('Error reading the bootswatch file: '.$options['bootswatch']);
}
// Write the preset file.
$out = fopen($options['preset'], 'w');
if (!$out) {
cli_error('Error writing to the preset file');
}
fwrite($out, $sourcevariables);
fwrite($out, '
// Import FontAwesome.
@import "fontawesome";
// Import All of Bootstrap
@import "bootstrap";
// Import Core moodle CSS
@import "moodle";
');
// Add the bootswatch file.
fwrite($out, $sourcebootswatch);
fclose($out);

153
config.php

@ -1,54 +1,39 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Ilb config.
*
* @package theme_ilb
* @copyright 2016 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Every file should have GPL and copyright in the header - we skip it in tutorials but you should not skip it for real.
// This line protects the file from being accessed by a URL directly.
defined('MOODLE_INTERNAL') || die();
// $THEME is defined before this page is included and we can define settings by adding properties to this global object.
require_once(__DIR__ . '/lib.php');
// The first setting we need is the name of the theme. This should be the last part of the component name, and the same
// as the directory name for our theme.
$THEME->name = 'ilb';
// This setting list the style sheets we want to include in our theme. Because we want to use SCSS instead of CSS - we won't
// list any style sheets. If we did we would list the name of a file in the /style/ folder for our theme without any css file
// extensions.
$THEME->sheets = [];
// This is a setting that can be used to provide some styling to the content in the TinyMCE text editor. This is no longer the
// default text editor and "Atto" does not need this setting so we won't provide anything. If we did it would work the same
// as the previous setting - listing a file in the /styles/ folder.
$THEME->editor_sheets = [];
// This is a critical setting. We want to inherit from theme_boost because it provides a great starting point for SCSS bootstrap4
// themes. We could add more than one parent here to inherit from multiple parents, and if we did they would be processed in
// order of importance (later themes overriding earlier ones). Things we will inherit from the parent theme include
// styles and mustache templates and some (not all) settings.
$THEME->parents = ['boost'];
// A dock is a way to take blocks out of the page and put them in a persistent floating area on the side of the page. Boost
// does not support a dock so we won't either - but look at bootstrapbase for an example of a theme with a dock.
$THEME->enable_dock = false;
// This is an old setting used to load specific CSS for some YUI JS. We don't need it in Boost based themes because Boost
// provides default styling for the YUI modules that we use. It is not recommended to use this setting anymore.
$THEME->yuicssmodules = array();
// Most themes will use this rendererfactory as this is the one that allows the theme to override any other renderer.
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
// This is a list of blocks that are required to exist on all pages for this theme to function correctly. For example
// bootstrap base requires the settings and navigation blocks because otherwise there would be no way to navigate to all the
// pages in Moodle. Boost does not require these blocks because it provides other ways to navigate built into the theme.
$THEME->requiredblocks = '';
// This is a feature that tells the blocks library not to use the "Add a block" block. We don't want this in boost based themes because
// it forces a block region into the page when editing is enabled and it takes up too much room.
$THEME->addblockposition = BLOCK_ADDBLOCK_POSITION_FLATNAV;
$THEME->editor_scss = ['editor'];
$THEME->usefallback = true;
$THEME->iconsystem = \core\output\icon_system::FONTAWESOME;
$THEME->scss = function($theme) {
return theme_ilb_get_main_scss_content($theme);
};
$THEME->layouts = [
// Most backwards compatible layout without the blocks - this is the layout used by default.
@ -87,18 +72,88 @@ $THEME->layouts = [
'defaultregion' => 'side-pre',
'options' => array('nonavbar' => true),
),
// Server administration scripts.
'admin' => array(
'file' => 'columns2.php',
'regions' => array('side-pre'),
'defaultregion' => 'side-pre',
),
// My dashboard page.
'mydashboard' => array(
'file' => 'columns2.php',
'regions' => array('side-pre'),
'defaultregion' => 'side-pre',
'options' => array('nonavbar' => true, 'langmenu' => true),
'options' => array('nonavbar' => true, 'langmenu' => true, 'nocontextheader' => true),
),
// My public page.
'mypublic' => array(
'file' => 'columns2.php',
'regions' => array('side-pre'),
'defaultregion' => 'side-pre',
),
'login' => array(
'file' => 'login.php',
'regions' => array(),
'options' => array('langmenu' => true),
),
// Pages that appear in pop-up windows - no navigation, no blocks, no header.
'popup' => array(
'file' => 'columns1.php',
'regions' => array(),
'options' => array('nofooter' => true, 'nonavbar' => true),
),
// No blocks and minimal footer - used for legacy frame layouts only!
'frametop' => array(
'file' => 'columns1.php',
'regions' => array(),
'options' => array('nofooter' => true, 'nocoursefooter' => true),
),
// Embeded pages, like iframe/object embeded in moodleform - it needs as much space as possible.
'embedded' => array(
'file' => 'embedded.php',
'regions' => array()
),
// Used during upgrade and install, and for the 'This site is undergoing maintenance' message.
// This must not have any blocks, links, or API calls that would lead to database or cache interaction.
// Please be extremely careful if you are modifying this layout.
'maintenance' => array(
'file' => 'maintenance.php',
'regions' => array(),
),
// Should display the content and basic headers only.
'print' => array(
'file' => 'columns1.php',
'regions' => array(),
'options' => array('nofooter' => true, 'nonavbar' => false),
),
// The pagelayout used when a redirection is occuring.
'redirect' => array(
'file' => 'embedded.php',
'regions' => array(),
),
// The pagelayout used for reports.
'report' => array(
'file' => 'columns2.php',
'regions' => array('side-pre'),
'defaultregion' => 'side-pre',
),
// The pagelayout used for safebrowser and securewindow.
'secure' => array(
'file' => 'secure.php',
'regions' => array('side-pre'),
'defaultregion' => 'side-pre'
)
];
// This is the function that returns the SCSS source for the main file in our theme. We override the boost version because
// we want to allow presets uploaded to our own theme file area to be selected in the preset list.
$THEME->scss = function($theme) {
return theme_ilb_get_main_scss_content($theme);
};
$THEME->parents = [];
$THEME->enable_dock = false;
$THEME->csstreepostprocessor = 'theme_ilb_css_tree_post_processor';
$THEME->extrascsscallback = 'theme_ilb_get_extra_scss';
$THEME->prescsscallback = 'theme_ilb_get_pre_scss';
$THEME->precompiledcsscallback = 'theme_ilb_get_precompiled_css';
$THEME->yuicssmodules = array();
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
$THEME->requiredblocks = '';
$THEME->addblockposition = BLOCK_ADDBLOCK_POSITION_FLATNAV;
$THEME->iconsystem = \core\output\icon_system::FONTAWESOME;

56
lang/en/theme_ilb.php

@ -1,12 +1,54 @@
<?php
// Every file should have GPL and copyright in the header - we skip it in tutorials but you should not skip it for real.
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Language file.
*
* @package theme_ilb
* @copyright 2016 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// This line protects the file from being accessed by a URL directly.
defined('MOODLE_INTERNAL') || die();
// A description shown in the admin theme selector.
$string['choosereadme'] = 'Tema do ILB para o Moodle';
// The name of our plugin.
$string['pluginname'] = 'ILB';
// We need to include a lang string for each block region.
$string['advancedsettings'] = 'Advanced settings';
$string['backgroundimage'] = 'Background image';
$string['backgroundimage_desc'] = 'The image to display as a background of the site. The background image you upload here will override the background image in your theme preset files.';
$string['brandcolor'] = 'Brand colour';
$string['brandcolor_desc'] = 'The accent colour.';
$string['bootswatch'] = 'Bootswatch';
$string['bootswatch_desc'] = 'A bootswatch is a set of Bootstrap variables and css to style Bootstrap';
$string['choosereadme'] = 'Ilb is a modern highly-customisable theme. This theme is intended to be used directly, or as a parent theme when creating new themes utilising Bootstrap 4.';
$string['currentinparentheses'] = '(current)';
$string['configtitle'] = 'Ilb';
$string['fontsize'] = 'Theme base fontsize';
$string['fontsize_desc'] = 'Enter a fontsize in %';
$string['generalsettings'] = 'General settings';
$string['nobootswatch'] = 'None';
$string['pluginname'] = 'Ilb';
$string['presetfiles'] = 'Additional theme preset files';
$string['presetfiles_desc'] = 'Preset files can be used to dramatically alter the appearance of the theme. See <a href="https://docs.moodle.org/dev/Ilb_Presets">Ilb presets</a> for information on creating and sharing your own preset files, and see the <a href="http://moodle.net/ilb">Presets repository</a> for presets that others have shared.';
$string['preset'] = 'Theme preset';
$string['preset_desc'] = 'Pick a preset to broadly change the look of the theme.';
$string['privacy:metadata'] = 'The Ilb theme does not store any personal data about any user.';
$string['rawscss'] = 'Raw SCSS';
$string['rawscss_desc'] = 'Use this field to provide SCSS or CSS code which will be injected at the end of the style sheet.';
$string['rawscsspre'] = 'Raw initial SCSS';
$string['rawscsspre_desc'] = 'In this field you can provide initialising SCSS code, it will be injected before everything else. Most of the time you will use this setting to define variables.';
$string['region-side-pre'] = 'Right';
$string['privacy:metadata:preference:draweropennav'] = 'The user\'s preference for hiding or showing the drawer menu navigation.';
$string['privacy:drawernavclosed'] = 'The current preference for the navigation drawer is closed.';
$string['privacy:drawernavopen'] = 'The current preference for the navigation drawer is open.';

5
layout/columns1.php

@ -24,15 +24,12 @@
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/../config.php');
$bodyattributes = $OUTPUT->body_attributes([]);
$templatecontext = [
'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
'output' => $OUTPUT,
'bodyattributes' => $bodyattributes,
'moodle_url' => $CFG->wwwroot
'bodyattributes' => $bodyattributes
];
echo $OUTPUT->render_from_template('theme_ilb/columns1', $templatecontext);

5
layout/columns2.php

@ -26,7 +26,6 @@ defined('MOODLE_INTERNAL') || die();
user_preference_allow_ajax_update('drawer-open-nav', PARAM_ALPHA);
require_once($CFG->libdir . '/behat/lib.php');
require_once($CFG->libdir . '/../config.php');
if (isloggedin()) {
$navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
@ -49,9 +48,9 @@ $templatecontext = [
'bodyattributes' => $bodyattributes,
'navdraweropen' => $navdraweropen,
'regionmainsettingsmenu' => $regionmainsettingsmenu,
'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu),
'moodle_url' => $CFG->wwwroot
'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu)
];
$templatecontext['flatnavigation'] = $PAGE->flatnav;
echo $OUTPUT->render_from_template('theme_ilb/columns2', $templatecontext);

5
layout/login.php

@ -16,8 +16,6 @@
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/../config.php');
/**
* A login page layout for the ilb theme.
*
@ -31,8 +29,7 @@ $bodyattributes = $OUTPUT->body_attributes();
$templatecontext = [
'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
'output' => $OUTPUT,
'bodyattributes' => $bodyattributes,
'moodle_url' => $CFG->wwwroot
'bodyattributes' => $bodyattributes
];
echo $OUTPUT->render_from_template('theme_ilb/login', $templatecontext);

36
layout/login_nova_conta.php

@ -1,36 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
/**
* A login page layout for the ilb theme.
*
* @package theme_ilb
* @copyright 2016 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$bodyattributes = $OUTPUT->body_attributes();
$templatecontext = [
'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
'output' => $OUTPUT,
'bodyattributes' => $bodyattributes
];
echo $OUTPUT->render_from_template('theme_ilb/login_nova_conta', $templatecontext);

144
lib.php

@ -1,12 +1,92 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
// Every file should have GPL and copyright in the header - we skip it in tutorials but you should not skip it for real.
/**
* Theme functions.
*
* @package theme_ilb
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// This line protects the file from being accessed by a URL directly.
defined('MOODLE_INTERNAL') || die();
// We will add callbacks here as we add features to our theme.
/**
* Post process the CSS tree.
*
* @param string $tree The CSS tree.
* @param theme_config $theme The theme config object.
*/
function theme_ilb_css_tree_post_processor($tree, $theme) {
$prefixer = new theme_ilb\autoprefixer($tree);
$prefixer->prefix();
}
/**
* Inject additional SCSS.
*
* @param theme_config $theme The theme config object.
* @return string
*/
function theme_ilb_get_extra_scss($theme) {
$content = '';
$imageurl = $theme->setting_file_url('backgroundimage', 'backgroundimage');
// Sets the background image, and its settings.
if (!empty($imageurl)) {
$content .= 'body { ';
$content .= "background-image: url('$imageurl'); background-size: cover;";
$content .= ' }';
}
// Always return the background image with the scss when we have it.
return !empty($theme->settings->scss) ? $theme->settings->scss . ' ' . $content : $content;
}
/**
* Serves any files associated with the theme settings.
*
* @param stdClass $course
* @param stdClass $cm
* @param context $context
* @param string $filearea
* @param array $args
* @param bool $forcedownload
* @param array $options
* @return bool
*/
function theme_ilb_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
if ($context->contextlevel == CONTEXT_SYSTEM && ($filearea === 'logo' || $filearea === 'backgroundimage')) {
$theme = theme_config::load('ilb');
// By default, theme files must be cache-able by both browsers and proxies.
if (!array_key_exists('cacheability', $options)) {
$options['cacheability'] = 'public';
}
return $theme->setting_file_serve($filearea, $args, $forcedownload, $options);
} else {
send_file_not_found();
}
}
/**
* Returns the main SCSS content.
*
* @param theme_config $theme The theme config object.
* @return string
*/
function theme_ilb_get_main_scss_content($theme) {
global $CFG;
@ -16,18 +96,62 @@ function theme_ilb_get_main_scss_content($theme) {
$context = context_system::instance();
if ($filename == 'default.scss') {
// We still load the default preset files directly from the boost theme. No sense in duplicating them.
$scss .= file_get_contents($CFG->dirroot . '/theme/boost/scss/preset/default.scss');
$scss .= file_get_contents($CFG->dirroot . '/theme/ilb/scss/preset/default.scss');
} else if ($filename == 'plain.scss') {
// We still load the default preset files directly from the boost theme. No sense in duplicating them.
$scss .= file_get_contents($CFG->dirroot . '/theme/boost/scss/preset/plain.scss');
$scss .= file_get_contents($CFG->dirroot . '/theme/ilb/scss/preset/plain.scss');
} else if ($filename && ($presetfile = $fs->get_file($context->id, 'theme_ilb', 'preset', 0, '/', $filename))) {
// This preset file was fetched from the file area for theme_ilb and not theme_boost (see the line above).
$scss .= $presetfile->get_content();
} else {
// Safety fallback - maybe new installs etc.
$scss .= file_get_contents($CFG->dirroot . '/theme/boost/scss/preset/default.scss');
$scss .= file_get_contents($CFG->dirroot . '/theme/ilb/scss/preset/default.scss');
}
return $scss;
}
/**
* Get compiled css.
*
* @return string compiled css
*/
function theme_ilb_get_precompiled_css() {
global $CFG;
return file_get_contents($CFG->dirroot . '/theme/ilb/style/moodle.css');
}
/**
* Get SCSS to prepend.
*
* @param theme_config $theme The theme config object.
* @return array
*/
function theme_ilb_get_pre_scss($theme) {
global $CFG;
$scss = '';
$configurable = [
// Config key => [variableName, ...].
'brandcolor' => ['primary'],
];
// Prepend variables first.
foreach ($configurable as $configkey => $targets) {
$value = isset($theme->settings->{$configkey}) ? $theme->settings->{$configkey} : null;
if (empty($value)) {
continue;
}
array_map(function($target) use (&$scss, $value) {
$scss .= '$' . $target . ': ' . $value . ";\n";
}, (array) $targets);
}
// Prepend pre-scss.
if (!empty($theme->settings->scsspre)) {
$scss .= $theme->settings->scsspre;
}
if (!empty($theme->settings->fontsize)) {
$scss .= '$font-size-base: ' . (1 / 100 * $theme->settings->fontsize) . "rem !default;\n";
}
return $scss;

2
pix/fp/th.svg

@ -1 +1 @@
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMid meet"><path d="M512 1248v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm640 512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm-640-1024v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm640 512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm640 512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm-640-1024v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm640 512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68z"/></svg>
/var/www/html/moodle/theme/ilb/pix<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMid meet"><path d="M512 1248v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm640 512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm-640-1024v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm640 512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm640 512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm-640-1024v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm640 512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68zm0-512v192q0 40-28 68t-68 28h-320q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h320q40 0 68 28t28 68z"/></svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
pix/screenshot.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

35
readme_moodle.txt

@ -0,0 +1,35 @@
Description of Twitter bootstrap import into Moodle
Twitter bootstrap
-----------------
Sass:
This theme uses the version 4.0.0 Twitter bootstrap sass files.
The bootstrap repository is available on:
https://github.com/twitter/bootstrap.git
To update to the latest release of twitter bootstrap:
* remove all files from scss/bootstrap,
* download the new scss files and store them in scss/bootstrap
* re-apply /* rtl:begin:ignore */ on the top of _popover.scss before .popover rule and /* rtl:end:ignore */ before
.popover-arrow::after rule. See MDL-56763 commit (1a4faf9b).
* comment out all uses of the @supports syntax in SCSS (see https://github.com/sabberworm/PHP-CSS-Parser/issues/127). In Bootstrap 4.0 The @supports rules are used for carousal transitions (nice sliding) and the .sticky-top helper class. The carousel bootstrap component will still be functional.
* update ./thirdpartylibs.xml
Javascript:
This theme uses the transpiled javascript from bootstrap4 as amd modules.
To update the javascript files:
Checkout the latest branch of bootstrap to a folder, Run the follwing inside the cloned Bootstrap repository:
```
$ npm install @babel/cli@7.0.0-beta.37 @babel/preset-env@7.0.0-beta.37 babel-plugin-transform-es2015-modules-amd @babel/plugin-proposal-object-rest-spread
$ mkdir out
$ ./node_modules/@babel/cli/bin/babel.js --presets @babel/preset-env --plugins transform-es2015-modules-amd,@babel/plugin-proposal-object-rest-spread -d ./out/ js/src/
```
Copy the transpiled files from out/ into the amd/src/ folder for the theme.
Run grunt to re-compile the JS files. (thanks to Joby Harding)

2
scss/bootstrap.scss

@ -0,0 +1,2 @@
// Import Bootstrap.
@import "bootstrap/bootstrap";

4
scss/bootstrap/LICENSE

@ -1,7 +1,7 @@
The MIT License (MIT)
Copyright (c) 2011-2016 Twitter, Inc.
Copyright (c) 2011-2016 The Bootstrap Authors
Copyright (c) 2011-2018 Twitter, Inc.
Copyright (c) 2011-2018 The Bootstrap Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

27
scss/bootstrap/_alert.scss

@ -3,8 +3,9 @@
//
.alert {
padding: $alert-padding;
margin-bottom: $spacer-y;
position: relative;
padding: $alert-padding-y $alert-padding-x;
margin-bottom: $alert-margin-bottom;
border: $alert-border-width solid transparent;
@include border-radius($alert-border-radius);
}
@ -26,13 +27,14 @@
// Expand the right padding and account for the close button's positioning.
.alert-dismissible {
padding-right: ($alert-padding * 2);
padding-right: ($close-font-size + $alert-padding-x * 2);
// Adjust close link position
.close {
position: relative;
top: -.125rem;
right: -$alert-padding;
position: absolute;
top: 0;
right: 0;
padding: $alert-padding-y $alert-padding-x;
color: inherit;
}
}
@ -42,15 +44,8 @@
//
// Generate contextual modifier classes for colorizing the alert.
.alert-success {
@include alert-variant($alert-success-bg, $alert-success-border, $alert-success-text);
}
.alert-info {
@include alert-variant($alert-info-bg, $alert-info-border, $alert-info-text);
}
.alert-warning {
@include alert-variant($alert-warning-bg, $alert-warning-border, $alert-warning-text);
@each $color, $value in $theme-colors {
.alert-#{$color} {
@include alert-variant(theme-color-level($color, $alert-bg-level), theme-color-level($color, $alert-border-level), theme-color-level($color, $alert-color-level));
}
.alert-danger {
@include alert-variant($alert-danger-bg, $alert-danger-border, $alert-danger-text);
}

47
scss/bootstrap/_badge.scss

@ -0,0 +1,47 @@
// Base class
//
// Requires one of the contextual, color modifier classes for `color` and
// `background-color`.
.badge {
display: inline-block;
padding: $badge-padding-y $badge-padding-x;
font-size: $badge-font-size;
font-weight: $badge-font-weight;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
@include border-radius($badge-border-radius);
// Empty badges collapse automatically
&:empty {
display: none;
}
}
// Quick fix for badges in buttons
.btn .badge {
position: relative;
top: -1px;
}
// Pill badges
//
// Make them extra rounded with a modifier to replace v3's badges.
.badge-pill {
padding-right: $badge-pill-padding-x;
padding-left: $badge-pill-padding-x;
@include border-radius($badge-pill-border-radius);
}
// Colors
//
// Contextual variations (linked badges get darker on :hover).
@each $color, $value in $theme-colors {
.badge-#{$color} {
@include badge-variant($value);
}
}

8
scss/bootstrap/_breadcrumb.scss

@ -1,15 +1,14 @@
.breadcrumb {
display: flex;
flex-wrap: wrap;
padding: $breadcrumb-padding-y $breadcrumb-padding-x;
margin-bottom: $spacer-y;
margin-bottom: $breadcrumb-margin-bottom;
list-style: none;
background-color: $breadcrumb-bg;
@include border-radius($border-radius);
@include clearfix;
}
.breadcrumb-item {
float: left;
// The separator between breadcrumbs (by default, a forward-slash: "/")
+ .breadcrumb-item::before {
display: inline-block; // Suppress underlining of the separator in modern browsers
@ -28,6 +27,7 @@
+ .breadcrumb-item:hover::before {
text-decoration: underline;
}
// stylelint-disable-next-line no-duplicate-selectors
+ .breadcrumb-item:hover::before {
text-decoration: none;
}

150
scss/bootstrap/_button-group.scss

@ -1,97 +1,65 @@
// scss-lint:disable QualifyingElement
// stylelint-disable selector-no-qualifying-type
// Make the div behave like a button
.btn-group,
.btn-group-vertical {
position: relative;
display: inline-block;
display: inline-flex;
vertical-align: middle; // match .btn alignment given font-size hack above
> .btn {
position: relative;
float: left;
flex: 0 1 auto;
// Bring the "active" button to the front
// Bring the hover, focused, and "active" buttons to the front to overlay
// the borders properly
@include hover {
z-index: 1;
}
&:focus,
&:active,
&.active {
z-index: 2;
}
@include hover {
z-index: 2;
}
z-index: 1;
}
}
// Prevent double borders when buttons are next to each other
.btn-group {
.btn + .btn,
.btn + .btn-group,
.btn-group + .btn,
.btn-group + .btn-group {
margin-left: -$input-btn-border-width;
margin-left: -$btn-border-width;
}
}
// Optional: Group multiple button groups together for a toolbar
.btn-toolbar {
margin-left: -$btn-toolbar-margin; // Offset the first child's margin
@include clearfix();
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
.btn-group,
.input-group {
float: left;
}
> .btn,
> .btn-group,
> .input-group {
margin-left: $btn-toolbar-margin;
width: auto;
}
}
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
border-radius: 0;
}
// Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
.btn-group > .btn:first-child {
.btn-group {
> .btn:first-child {
margin-left: 0;
&:not(:last-child):not(.dropdown-toggle) {
@include border-right-radius(0);
}
}
// Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it
.btn-group > .btn:last-child:not(:first-child),
.btn-group > .dropdown-toggle:not(:first-child) {
@include border-left-radius(0);
}
// Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)
.btn-group > .btn-group {
float: left;
}
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0;
}
.btn-group > .btn-group:first-child:not(:last-child) {
> .btn:last-child,
> .dropdown-toggle {
// Reset rounded corners
> .btn:not(:last-child):not(.dropdown-toggle),
> .btn-group:not(:last-child) > .btn {
@include border-right-radius(0);
}
}
.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {
> .btn:not(:first-child),
> .btn-group:not(:first-child) > .btn {
@include border-left-radius(0);
}
// On active and open, don't show outline
.btn-group .dropdown-toggle:active,
.btn-group.open .dropdown-toggle {
outline: 0;
}
// Sizing
//
// Remix the default button sizing classes into new ones for easier manipulation.
@ -104,7 +72,7 @@
// Split button dropdowns
//
.btn + .dropdown-toggle-split {
.dropdown-toggle-split {
padding-right: $btn-padding-x * .75;
padding-left: $btn-padding-x * .75;
@ -125,8 +93,8 @@
// The clickable button for toggling the menu
// Remove the gradient and set the same inset shadow as the :active state
.btn-group.open .dropdown-toggle {
// Set the same inset shadow as the :active state
.btn-group.show .dropdown-toggle {
@include box-shadow($btn-active-box-shadow);
// Show no shadow for `.btn-link` since it has no other button styles.
@ -136,77 +104,39 @@
}
// Reposition the caret
.btn .caret {
margin-left: 0;
}
// Carets in other button sizes
.btn-lg .caret {
border-width: $caret-width-lg $caret-width-lg 0;
border-bottom-width: 0;
}
// Upside down carets for .dropup
.dropup .btn-lg .caret {
border-width: 0 $caret-width-lg $caret-width-lg;
}
//
// Vertical button groups
//
.btn-group-vertical {
> .btn,
> .btn-group,
> .btn-group > .btn {
display: block;
float: none;
width: 100%;
max-width: 100%;
}
flex-direction: column;
align-items: flex-start;
justify-content: center;
// Clear floats so dropdown menus can be properly placed
> .btn-group {
@include clearfix();
> .btn {
float: none;
}
.btn,
.btn-group {
width: 100%;
}
> .btn + .btn,
> .btn + .btn-group,
> .btn-group + .btn,
> .btn-group + .btn-group {
margin-top: -$input-btn-border-width;
margin-top: -$btn-border-width;
margin-left: 0;
}
}
.btn-group-vertical > .btn {
&:not(:first-child):not(:last-child) {
border-radius: 0;
}
&:first-child:not(:last-child) {
// Reset rounded corners
> .btn:not(:last-child):not(.dropdown-toggle),
> .btn-group:not(:last-child) > .btn {
@include border-bottom-radius(0);
}
&:last-child:not(:first-child) {
> .btn:not(:first-child),
> .btn-group:not(:first-child) > .btn {
@include border-top-radius(0);
}
}
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0;
}
.btn-group-vertical > .btn-group:first-child:not(:last-child) {
> .btn:last-child,
> .dropdown-toggle {
@include border-bottom-radius(0);
}
}
.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
@include border-top-radius(0);
}
// Checkbox and radio options
@ -221,9 +151,11 @@
// See https://github.com/twbs/bootstrap/pull/12794 and
// https://github.com/twbs/bootstrap/pull/14559 for more information.
[data-toggle="buttons"] {
.btn-group-toggle {
> .btn,
> .btn-group > .btn {
margin-bottom: 0; // Override default `<label>` value
input[type="radio"],
input[type="checkbox"] {
position: absolute;

137
scss/bootstrap/_buttons.scss

@ -1,4 +1,4 @@
// scss-lint:disable QualifyingElement
// stylelint-disable selector-no-qualifying-type
//
// Base styles
@ -7,50 +7,51 @@
.btn {
display: inline-block;
font-weight: $btn-font-weight;
line-height: $btn-line-height;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
user-select: none;
border: $input-btn-border-width solid transparent;
@include button-size($btn-padding-y, $btn-padding-x, $font-size-base, $btn-border-radius);
@include transition(all .2s ease-in-out);
&,
&:active,
&.active {
&:focus,
&.focus {
@include tab-focus();
}
}
border: $btn-border-width solid transparent;
@include button-size($btn-padding-y, $btn-padding-x, $font-size-base, $btn-line-height, $btn-border-radius);
@include transition($btn-transition);
// Share hover and focus styles
@include hover-focus {
text-decoration: none;
}
&.focus {
text-decoration: none;
}
&:active,
&.active {
background-image: none;
&:focus,
&.focus {
outline: 0;
@include box-shadow($btn-active-box-shadow);
box-shadow: $btn-focus-box-shadow;
}
// Disabled comes first so active can properly restyle
&.disabled,
&:disabled {
cursor: $cursor-disabled;
opacity: .65;
opacity: $btn-disabled-opacity;
@include box-shadow(none);
}
// Opinionated: add "hand" cursor to non-disabled .btn elements
&:not(:disabled):not(.disabled) {
cursor: pointer;
}
&:not(:disabled):not(.disabled):active,
&:not(:disabled):not(.disabled).active {
background-image: none;
@include box-shadow($btn-active-box-shadow);
&:focus {
@include box-shadow($btn-focus-box-shadow, $btn-active-box-shadow);
}
}
}
// Future-proof disabling of clicks on `<a>` elements
a.btn.disabled,
fieldset[disabled] a.btn {
fieldset:disabled a.btn {
pointer-events: none;
}
@ -59,43 +60,16 @@ fieldset[disabled] a.btn {
// Alternate buttons
//
.btn-primary {
@include button-variant($btn-primary-color, $btn-primary-bg, $btn-primary-border);
@each $color, $value in $theme-colors {
.btn-#{$color} {
@include button-variant($value, $value);
}
.btn-secondary {
@include button-variant($btn-secondary-color, $btn-secondary-bg, $btn-secondary-border);
}
.btn-info {
@include button-variant($btn-info-color, $btn-info-bg, $btn-info-border);
}
.btn-success {
@include button-variant($btn-success-color, $btn-success-bg, $btn-success-border);
}
.btn-warning {
@include button-variant($btn-warning-color, $btn-warning-bg, $btn-warning-border);
}
.btn-danger {
@include button-variant($btn-danger-color, $btn-danger-bg, $btn-danger-border);
}
// Remove all backgrounds
.btn-outline-primary {
@include button-outline-variant($btn-primary-bg);
}
.btn-outline-secondary {
@include button-outline-variant($btn-secondary-border);
}
.btn-outline-info {
@include button-outline-variant($btn-info-bg);
}
.btn-outline-success {
@include button-outline-variant($btn-success-bg);
@each $color, $value in $theme-colors {
.btn-outline-#{$color} {
@include button-outline-variant($value);
}
.btn-outline-warning {
@include button-outline-variant($btn-warning-bg);
}
.btn-outline-danger {
@include button-outline-variant($btn-danger-bg);
}
@ -105,36 +79,30 @@ fieldset[disabled] a.btn {
// Make a button look and behave like a link
.btn-link {
font-weight: normal;
font-weight: $font-weight-normal;
color: $link-color;
border-radius: 0;
&,
&:active,
&.active,
&:disabled {
background-color: transparent;
@include box-shadow(none);
}
&,
&:focus,
&:active {
border-color: transparent;
}
@include hover {
border-color: transparent;
}
@include hover-focus {
color: $link-hover-color;
text-decoration: $link-hover-decoration;
background-color: transparent;
border-color: transparent;
}
&:disabled {
@include hover-focus {
color: $btn-link-disabled-color;
text-decoration: none;
&:focus,
&.focus {
text-decoration: $link-hover-decoration;
border-color: transparent;
box-shadow: none;
}
&:disabled,
&.disabled {
color: $btn-link-disabled-color;
}
// No need for an active state here
}
@ -143,12 +111,11 @@ fieldset[disabled] a.btn {
//
.btn-lg {
// line-height: ensure even-numbered height of button next to large input
@include button-size($btn-padding-y-lg, $btn-padding-x-lg, $font-size-lg, $btn-border-radius-lg);
@include button-size($btn-padding-y-lg, $btn-padding-x-lg, $font-size-lg, $btn-line-height-lg, $btn-border-radius-lg);
}
.btn-sm {
// line-height: ensure proper height of button next to small input
@include button-size($btn-padding-y-sm, $btn-padding-x-sm, $font-size-sm, $btn-border-radius-sm);
@include button-size($btn-padding-y-sm, $btn-padding-x-sm, $font-size-sm, $btn-line-height-sm, $btn-border-radius-sm);
}
@ -159,12 +126,12 @@ fieldset[disabled] a.btn {
.btn-block {
display: block;
width: 100%;
}
// Vertically space out multiple block buttons
.btn-block + .btn-block {
+ .btn-block {
margin-top: $btn-block-spacing-y;
}
}
// Specificity overrides
input[type="submit"],

270
scss/bootstrap/_card.scss

@ -4,16 +4,37 @@
.card {
position: relative;
display: block;
margin-bottom: $card-spacer-y;
display: flex;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
background-color: $card-bg;
// border: $card-border-width solid $card-border-color;
@include border-radius($card-border-radius);
background-clip: border-box;
border: $card-border-width solid $card-border-color;
@include border-radius($card-border-radius);
> hr {
margin-right: 0;
margin-left: 0;
}
.card-block {
@include clearfix;
> .list-group:first-child {
.list-group-item:first-child {
@include border-top-radius($card-border-radius);
}
}
> .list-group:last-child {
.list-group-item:last-child {
@include border-bottom-radius($card-border-radius);
}
}
}
.card-body {
// Enable `flex-grow: 1` for decks and groups so that card blocks take up
// as much space as possible, ensuring footers are aligned to the bottom.
flex: 1 1 auto;
padding: $card-spacer-x;
}
@ -30,14 +51,6 @@
margin-bottom: 0;
}
// .card-actions {
// padding: $card-spacer-y $card-spacer-x;
// .card-link + .card-link {
// margin-left: $card-spacer-x;
// }
// }
.card-link {
@include hover {
text-decoration: none;
@ -48,44 +61,34 @@
}
}
.card {
> .list-group:first-child {
.list-group-item:first-child {
@include border-top-radius($card-border-radius);
}
}
> .list-group:last-child {
.list-group-item:last-child {
@include border-bottom-radius($card-border-radius);
}
}
}
//
// Optional textual caps
//
.card-header {
@include clearfix;
padding: $card-spacer-y $card-spacer-x;
margin-bottom: 0; // Removes the default margin-bottom of <hN>
background-color: $card-cap-bg;
border-bottom: $card-border-width solid $card-border-color;
&:first-child {
@include border-radius($card-border-radius-inner $card-border-radius-inner 0 0);
@include border-radius($card-inner-border-radius $card-inner-border-radius 0 0);
}
+ .list-group {
.list-group-item:first-child {
border-top: 0;
}
}
}
.card-footer {
@include clearfix;
padding: $card-spacer-y $card-spacer-x;
background-color: $card-cap-bg;
border-top: $card-border-width solid $card-border-color;
&:last-child {
@include border-radius(0 0 $card-border-radius-inner $card-border-radius-inner);
@include border-radius(0 0 $card-inner-border-radius $card-inner-border-radius);
}
}
@ -106,70 +109,7 @@
margin-left: -($card-spacer-x / 2);
}
//
// Background variations
//
.card-primary {
@include card-variant($brand-primary, $brand-primary);
}
.card-success {
@include card-variant($brand-success, $brand-success);
}
.card-info {
@include card-variant($brand-info, $brand-info);
}
.card-warning {
@include card-variant($brand-warning, $brand-warning);
}
.card-danger {
@include card-variant($brand-danger, $brand-danger);
}
// Remove all backgrounds
.card-outline-primary {
@include card-outline-variant($btn-primary-bg);
}
.card-outline-secondary {
@include card-outline-variant($btn-secondary-border);
}
.card-outline-info {
@include card-outline-variant($btn-info-bg);
}
.card-outline-success {
@include card-outline-variant($btn-success-bg);
}
.card-outline-warning {
@include card-outline-variant($btn-warning-bg);
}
.card-outline-danger {
@include card-outline-variant($btn-danger-bg);
}
//
// Inverse text within a card for use with dark backgrounds
//
.card-inverse {
@include card-inverse;
}
//
// Blockquote
//
.card-blockquote {
padding: 0;
margin-bottom: 0;
border-left: 0;
}
// Card image
.card-img {
// margin: -1.325rem;
@include border-radius(.25rem);
}
.card-img-overlay {
position: absolute;
top: 0;
@ -179,89 +119,74 @@
padding: $card-img-overlay-padding;
}
.card-img {
width: 100%; // Required because we use flexbox and this inherently applies align-self: stretch
@include border-radius($card-inner-border-radius);
}
// Card image caps
.card-img-top {
@include border-top-radius($card-border-radius-inner);
width: 100%; // Required because we use flexbox and this inherently applies align-self: stretch
@include border-top-radius($card-inner-border-radius);
}
.card-img-bottom {
@include border-bottom-radius($card-border-radius-inner);
width: 100%; // Required because we use flexbox and this inherently applies align-self: stretch
@include border-bottom-radius($card-inner-border-radius);
}
// Card set
//
// Heads up! We do some funky style resetting here for margins across our two
// variations (one flex, one table). Individual cards have margin-bottom by
// default, but they're ignored due to table styles. For a consistent design,
// we've done the same to the flex variation.
//
// Those changes are noted by `// Margin balancing`.
// Card deck
@if $enable-flex {
@include media-breakpoint-up(sm) {
.card-deck {
display: flex;
flex-direction: column;
.card {
margin-bottom: $card-deck-margin;
}
@include media-breakpoint-up(sm) {
flex-flow: row wrap;
margin-right: -$card-deck-margin;
margin-bottom: $card-spacer-y; // Margin balancing
margin-left: -$card-deck-margin;
.card {
flex: 1 0 0;
display: flex;
// Flexbugs #4: https://github.com/philipwalton/flexbugs#4-flex-shorthand-declarations-with-unitless-flex-basis-values-are-ignored
flex: 1 0 0%;
flex-direction: column;
margin-right: $card-deck-margin;
margin-bottom: 0; // Margin balancing
margin-bottom: 0; // Override the default
margin-left: $card-deck-margin;
}
}
}
} @else {
@include media-breakpoint-up(sm) {
$space-between-cards: (2 * $card-deck-margin);
.card-deck {
display: table;
width: 100%;
margin-bottom: $card-spacer-y; // Margin balancing
table-layout: fixed;
border-spacing: $space-between-cards 0;
.card {
display: table-cell;
margin-bottom: 0; // Margin balancing
vertical-align: top;
}
}
.card-deck-wrapper {
margin-right: (-$space-between-cards);
margin-left: (-$space-between-cards);
}
}
}
//
// Card groups
//
@include media-breakpoint-up(sm) {
.card-group {
@if $enable-flex {
display: flex;
flex-flow: row wrap;
} @else {
display: table;
width: 100%;
table-layout: fixed;
}
flex-direction: column;
.card {
@if $enable-flex {
flex: 1 0 0;
} @else {
display: table-cell;
vertical-align: top;
// The child selector allows nested `.card` within `.card-group`
// to display properly.
> .card {
margin-bottom: $card-group-margin;
}
@include media-breakpoint-up(sm) {
flex-flow: row wrap;
// The child selector allows nested `.card` within `.card-group`
// to display properly.
> .card {
// Flexbugs #4: https://github.com/philipwalton/flexbugs#4-flex-shorthand-declarations-with-unitless-flex-basis-values-are-ignored
flex: 1 0 0%;
margin-bottom: 0;
+ .card {
margin-left: 0;
border-left: 0;
@ -272,30 +197,50 @@
&:first-child {
@include border-right-radius(0);
.card-img-top {
.card-img-top,
.card-header {
border-top-right-radius: 0;
}
.card-img-bottom {
.card-img-bottom,
.card-footer {
border-bottom-right-radius: 0;
}
}
&:last-child {
@include border-left-radius(0);
.card-img-top {
.card-img-top,
.card-header {
border-top-left-radius: 0;
}
.card-img-bottom {
.card-img-bottom,
.card-footer {
border-bottom-left-radius: 0;
}
}
&:not(:first-child):not(:last-child) {
border-radius: 0;
&:only-child {
@include border-radius($card-border-radius);
.card-img-top,
.card-img-bottom {
border-radius: 0;
.card-header {
@include border-top-radius($card-border-radius);
}
.card-img-bottom,
.card-footer {
@include border-bottom-radius($card-border-radius);
}
}
&:not(:first-child):not(:last-child):not(:only-child) {
@include border-radius(0);
.card-img-top,
.card-img-bottom,
.card-header,
.card-footer {
@include border-radius(0);
}
}
}
@ -305,16 +250,21 @@
//
// Card
// Columns
//
@include media-breakpoint-up(sm) {
.card-columns {
column-count: 3;
column-gap: $card-columns-sm-up-column-gap;
.card {
margin-bottom: $card-columns-margin;
}
@include media-breakpoint-up(sm) {
column-count: $card-columns-count;
column-gap: $card-columns-gap;
.card {
width: 100%; // Don't let them exceed the column width
display: inline-block; // Don't let them vertically span multiple columns
width: 100%; // Don't let their width change
}
}
}

264
scss/bootstrap/_carousel.scss

@ -7,109 +7,79 @@
position: relative;
width: 100%;
overflow: hidden;
}
> .carousel-item {
.carousel-item {
position: relative;
display: none;
transition: .6s ease-in-out left;
// Account for jankitude on images
> img,
> a > img {
@extend .img-fluid;
line-height: 1;
}
// WebKit CSS3 transforms for supported devices
@media all and (transform-3d), (-webkit-transform-3d) {
transition: transform .6s ease-in-out;
align-items: center;
width: 100%;
@include transition($carousel-transition);
backface-visibility: hidden;
perspective: 1000px;
&.next,
&.active.right {
left: 0;
transform: translate3d(100%, 0, 0);
}
&.prev,
&.active.left {
left: 0;
transform: translate3d(-100%, 0, 0);
}
&.next.left,
&.prev.right,
&.active {
left: 0;
transform: translate3d(0, 0, 0);
}
}
}
> .active,
> .next,
> .prev {
.carousel-item.active,
.carousel-item-next,
.carousel-item-prev {
display: block;
}
> .active {
left: 0;
}
> .next,
> .prev {
.carousel-item-next,
.carousel-item-prev {
position: absolute;
top: 0;
width: 100%;
}
> .next {
left: 100%;
}
> .prev {
left: -100%;
}
> .next.left,
> .prev.right {
left: 0;
}
// CSS3 transforms when supported by the browser
// .carousel-item-next.carousel-item-left,
// .carousel-item-prev.carousel-item-right {
// transform: translateX(0);
> .active.left {
left: -100%;
}
> .active.right {
left: 100%;
}
}
// @supports (transform-style: preserve-3d) {
// transform: translate3d(0, 0, 0);
// }
// }
// .carousel-item-next,
// .active.carousel-item-right {
// transform: translateX(100%);
// @supports (transform-style: preserve-3d) {
// transform: translate3d(100%, 0, 0);
// }
// }
// .carousel-item-prev,
// .active.carousel-item-left {
// transform: translateX(-100%);
// @supports (transform-style: preserve-3d) {
// transform: translate3d(-100%, 0, 0);
// }
// }
//
// Left/right controls for nav
//
.carousel-control {
.carousel-control-prev,
.carousel-control-next {
position: absolute;
top: 0;
bottom: 0;
left: 0;
// Use flex for alignment (1-3)
display: flex; // 1. allow flex styles
align-items: center; // 2. vertically center contents
justify-content: center; // 3. horizontally center contents
width: $carousel-control-width;
font-size: $carousel-control-font-size;
color: $carousel-control-color;
text-align: center;
text-shadow: $carousel-text-shadow;
opacity: $carousel-control-opacity;
// We can't have this transition here because WebKit cancels the carousel
// We can't have a transition here because WebKit cancels the carousel
// animation if you trip this while in the middle of another animation.
// Set gradients for backgrounds
&.left {
@include gradient-x($start-color: rgba(0,0,0,.5), $end-color: rgba(0,0,0,.0001));
}
&.right {
right: 0;
left: auto;
@include gradient-x($start-color: rgba(0,0,0,.0001), $end-color: rgba(0,0,0,.5));
}
// Hover/focus state
@include hover-focus {
color: $carousel-control-color;
@ -117,79 +87,88 @@
outline: 0;
opacity: .9;
}
// Toggles
.icon-prev,
.icon-next {
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
width: $carousel-icon-width;
height: $carousel-icon-width;
margin-top: -($carousel-icon-width / 2);
font-family: serif;
line-height: 1;
}
.icon-prev {
left: 50%;
margin-left: -($carousel-icon-width / 2);
.carousel-control-prev {
left: 0;
@if $enable-gradients {
background: linear-gradient(90deg, rgba(0, 0, 0, .25), rgba(0, 0, 0, .001));
}
.icon-next {
right: 50%;
margin-right: -($carousel-icon-width / 2);
}
.icon-prev {
&::before {
content: "\2039";// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
.carousel-control-next {
right: 0;
@if $enable-gradients {
background: linear-gradient(270deg, rgba(0, 0, 0, .25), rgba(0, 0, 0, .001));
}
}
.icon-next {
&::before {
content: "\203a";// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
// Icons for within
.carousel-control-prev-icon,
.carousel-control-next-icon {
display: inline-block;
width: $carousel-control-icon-width;
height: $carousel-control-icon-width;
background: transparent no-repeat center center;
background-size: 100% 100%;
}
.carousel-control-prev-icon {
background-image: $carousel-control-prev-icon-bg;
}
.carousel-control-next-icon {
background-image: $carousel-control-next-icon-bg;
}
// Optional indicator pips
//
// Add an unordered list with the following class and add a list item for each
// Add an ordered list with the following class and add a list item for each
// slide your carousel holds.
.carousel-indicators {
position: absolute;
right: 0;
bottom: 10px;
left: 50%;
left: 0;
z-index: 15;
width: $carousel-indicators-width;
padding-left: 0;
margin-left: -($carousel-indicators-width / 2);
text-align: center;
display: flex;
justify-content: center;
padding-left: 0; // override <ol> default
// Use the .carousel-control's width as margin so we don't overlay those
margin-right: $carousel-control-width;
margin-left: $carousel-control-width;
list-style: none;
li {
display: inline-block;
width: $carousel-indicator-size;
height: $carousel-indicator-size;
margin: 1px;
position: relative;
flex: 0 1 auto;
width: $carousel-indicator-width;
height: $carousel-indicator-height;
margin-right: $carousel-indicator-spacer;
margin-left: $carousel-indicator-spacer;
text-indent: -999px;
cursor: pointer;
// IE9 hack for event handling
//
// Internet Explorer 9 does not properly handle clicks on elements with a `background-color` of `transparent`,
// so we use `rgba(0,0,0,0)` instead since it's a non-buggy equivalent.
// See https://developer.mozilla.org/en-US/docs/Web/Events/click#Internet_Explorer
background-color: rgba(0,0,0,0); // IE9
border: 1px solid $carousel-indicator-border-color;
border-radius: $carousel-indicator-size;
background-color: rgba($carousel-indicator-active-bg, .5);
// Use pseudo classes to increase the hit area by 10px on top and bottom.
&::before {
position: absolute;
top: -10px;
left: 0;
display: inline-block;
width: 100%;
height: 10px;
content: "";
}
&::after {
position: absolute;
bottom: -10px;
left: 0;
display: inline-block;
width: 100%;
height: 10px;
content: "";
}
}
.active {
width: $carousel-indicator-active-size;
height: $carousel-indicator-active-size;
margin: 0;
background-color: $carousel-indicator-active-bg;
}
}
@ -197,7 +176,7 @@
// Optional captions
//
// Hidden by default for smaller viewports.
//
.carousel-caption {
position: absolute;
@ -209,45 +188,4 @@
padding-bottom: 20px;
color: $carousel-caption-color;
text-align: center;
text-shadow: $carousel-text-shadow;
.btn {
text-shadow: none; // No shadow for button elements in carousel-caption
}
}
//
// Responsive variations
//
@include media-breakpoint-up(sm) {
// Scale up the controls a smidge
.carousel-control {
.icon-prev,
.icon-next {
width: $carousel-control-sm-up-size;
height: $carousel-control-sm-up-size;
margin-top: -($carousel-control-sm-up-size / 2);
font-size: $carousel-control-sm-up-size;
}
.icon-prev {
margin-left: -($carousel-control-sm-up-size / 2);
}
.icon-next {
margin-right: -($carousel-control-sm-up-size / 2);
}
}
// Show and left align the captions
.carousel-caption {
right: ((100% - $carousel-caption-sm-up-width) / 2);
left: ((100% - $carousel-caption-sm-up-width) / 2);
padding-bottom: 30px;
}
// Move up the indicators
.carousel-indicators {
bottom: 20px;
}
}

17
scss/bootstrap/_close.scss

@ -1,17 +1,21 @@
.close {
float: right;
font-size: ($font-size-base * 1.5);
font-size: $close-font-size;
font-weight: $close-font-weight;
line-height: 1;
color: $close-color;
text-shadow: $close-text-shadow;
opacity: .2;
opacity: .5;
@include hover-focus {
color: $close-color;
text-decoration: none;
opacity: .75;
}
// Opinionated: add "hand" cursor to non-disabled .close elements
&:not(:disabled):not(.disabled) {
cursor: pointer;
opacity: .5;
}
}
@ -20,12 +24,11 @@
// If you want the anchor version, it requires `href="#"`.
// See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile
// scss-lint:disable QualifyingElement
// stylelint-disable property-no-vendor-prefix, selector-no-qualifying-type
button.close {
padding: 0;
cursor: pointer;
background: transparent;
background-color: transparent;
border: 0;
-webkit-appearance: none;
}
// scss-lint:enable QualifyingElement
// stylelint-enable

19
scss/bootstrap/_code.scss

@ -8,17 +8,20 @@ samp {
// Inline code
code {
padding: $code-padding-y $code-padding-x;
font-size: $code-font-size;
color: $code-color;
background-color: $code-bg;
@include border-radius($border-radius);
word-break: break-word;
// Streamline the style when inside anchors to avoid broken underline and more
a > & {
color: inherit;
}
}
// User input typically entered via keyboard
kbd {
padding: $code-padding-y $code-padding-x;
font-size: $code-font-size;
padding: $kbd-padding-y $kbd-padding-x;
font-size: $kbd-font-size;
color: $kbd-color;
background-color: $kbd-bg;
@include border-radius($border-radius-sm);
@ -35,18 +38,14 @@ kbd {
// Blocks of code
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
font-size: $code-font-size;
color: $pre-color;
// Account for some code outputs that place code tags in pre tags
code {
padding: 0;
font-size: inherit;
color: inherit;
background-color: transparent;
border-radius: 0;
word-break: normal;
}
}

246
scss/bootstrap/_custom-forms.scss

@ -1,8 +1,6 @@
// scss-lint:disable PropertyCount
// Embedded icons from Open Iconic.
// Released under MIT and copyright 2014 Waybury.
// http://useiconic.com/open
// https://useiconic.com/open
// Checkboxes and radios
@ -11,13 +9,14 @@
.custom-control {
position: relative;
display: inline;
display: block;
min-height: (1rem * $line-height-base);
padding-left: $custom-control-gutter;
cursor: pointer;
+ .custom-control {
margin-left: $custom-control-spacer-x;
}
.custom-control-inline {
display: inline-flex;
margin-right: $custom-control-spacer-x;
}
.custom-control-input {
@ -25,73 +24,107 @@
z-index: -1; // Put the input behind the label so it doesn't overlay text
opacity: 0;
&:checked ~ .custom-control-indicator {
color: $custom-control-checked-indicator-color;
background-color: $custom-control-checked-indicator-bg;
@include box-shadow($custom-control-checked-indicator-box-shadow);
&:checked ~ .custom-control-label::before {
color: $custom-control-indicator-checked-color;
@include gradient-bg($custom-control-indicator-checked-bg);
@include box-shadow($custom-control-indicator-checked-box-shadow);
}
&:focus ~ .custom-control-indicator {
&:focus ~ .custom-control-label::before {
// the mixin is not used here to make sure there is feedback
box-shadow: $custom-control-focus-indicator-box-shadow;
box-shadow: $custom-control-indicator-focus-box-shadow;
}
&:active ~ .custom-control-indicator {
color: $custom-control-active-indicator-color;
background-color: $custom-control-active-indicator-bg;
@include box-shadow($custom-control-active-indicator-box-shadow);
&:active ~ .custom-control-label::before {
color: $custom-control-indicator-active-color;
background-color: $custom-control-indicator-active-bg;
@include box-shadow($custom-control-indicator-active-box-shadow);
}
&:disabled {
~ .custom-control-indicator {
cursor: $custom-control-disabled-cursor;
background-color: $custom-control-disabled-indicator-bg;
}
~ .custom-control-label {
color: $custom-control-label-disabled-color;
~ .custom-control-description {
color: $custom-control-disabled-description-color;
cursor: $custom-control-disabled-cursor;
&::before {
background-color: $custom-control-indicator-disabled-bg;
}
}
}
}
// Custom indicator
// Custom control indicators
//
// Generates a shadow element to create our makeshift checkbox/radio background.
// Build the custom controls out of psuedo-elements.
.custom-control-label {
margin-bottom: 0;
.custom-control-indicator {
// Background-color and (when enabled) gradient
&::before {
position: absolute;
top: .0625rem;
top: (($line-height-base - $custom-control-indicator-size) / 2);
left: 0;
display: block;
width: $custom-control-indicator-size;
height: $custom-control-indicator-size;
pointer-events: none;
content: "";
user-select: none;
background-color: $custom-control-indicator-bg;
@include box-shadow($custom-control-indicator-box-shadow);
}
// Foreground (icon)
&::after {
position: absolute;
top: (($line-height-base - $custom-control-indicator-size) / 2);
left: 0;
display: block;
width: $custom-control-indicator-size;
height: $custom-control-indicator-size;
content: "";
background-repeat: no-repeat;
background-position: center center;
background-size: $custom-control-indicator-bg-size;
@include box-shadow($custom-control-indicator-box-shadow);
}
}
// Checkboxes
//
// Tweak just a few things for checkboxes.
.custom-checkbox {
.custom-control-indicator {
@include border-radius($custom-checkbox-radius);
.custom-control-label::before {
@include border-radius($custom-checkbox-indicator-border-radius);
}
.custom-control-input:checked ~ .custom-control-label {
&::before {
@include gradient-bg($custom-control-indicator-checked-bg);
}
&::after {
background-image: $custom-checkbox-indicator-icon-checked;
}
}
.custom-control-input:checked ~ .custom-control-indicator {
background-image: $custom-checkbox-checked-icon;
.custom-control-input:indeterminate ~ .custom-control-label {
&::before {
@include gradient-bg($custom-checkbox-indicator-indeterminate-bg);
@include box-shadow($custom-checkbox-indicator-indeterminate-box-shadow);
}
&::after {
background-image: $custom-checkbox-indicator-icon-indeterminate;
}
}
.custom-control-input:indeterminate ~ .custom-control-indicator {
background-color: $custom-checkbox-indeterminate-bg;
background-image: $custom-checkbox-indeterminate-icon;
@include box-shadow($custom-checkbox-indeterminate-box-shadow);
.custom-control-input:disabled {
&:checked ~ .custom-control-label::before {
background-color: $custom-control-indicator-checked-disabled-bg;
}
&:indeterminate ~ .custom-control-label::before {
background-color: $custom-control-indicator-checked-disabled-bg;
}
}
}
@ -100,33 +133,22 @@
// Tweak just a few things for radios.
.custom-radio {
.custom-control-indicator {
border-radius: $custom-radio-radius;
.custom-control-label::before {
border-radius: $custom-radio-indicator-border-radius;
}
.custom-control-input:checked ~ .custom-control-indicator {
background-image: $custom-radio-checked-icon;
}
.custom-control-input:checked ~ .custom-control-label {
&::before {
@include gradient-bg($custom-control-indicator-checked-bg);
}
// Layout options
//
// By default radios and checkboxes are `inline-block` with no additional spacing
// set. Use these optional classes to tweak the layout.
.custom-controls-stacked {
.custom-control {
display: inline;
&::after {
display: block;
margin-bottom: $custom-control-spacer-y;
content: "";
background-image: $custom-radio-indicator-icon-checked;
}
}
+ .custom-control {
margin-left: 0;
.custom-control-input:disabled {
&:checked ~ .custom-control-label::before {
background-color: $custom-control-indicator-checked-disabled-bg;
}
}
}
@ -137,32 +159,33 @@
// Replaces the browser default select with a custom one, mostly pulled from
// http://primercss.io.
//
// Includes IE9-specific hacks (noted by ` \9`).
.custom-select {
display: inline-block;
max-width: 100%;
width: 100%;
height: $custom-select-height;
padding: $custom-select-padding-y ($custom-select-padding-x + $custom-select-indicator-padding) $custom-select-padding-y $custom-select-padding-x;
padding-right: $custom-select-padding-x \9;
line-height: $custom-select-line-height;
color: $custom-select-color;
vertical-align: middle;
background: $custom-select-bg $custom-select-indicator no-repeat right $custom-select-padding-x center;
background-image: none \9;
background-size: $custom-select-bg-size;
border: $custom-select-border-width solid $custom-select-border-color;
@include border-radius($custom-select-border-radius);
// Use vendor prefixes as `appearance` isn't part of the CSS spec.
-moz-appearance: none;
-webkit-appearance: none;
@if $enable-rounded {
border-radius: $custom-select-border-radius;
} @else {
border-radius: 0;
}
appearance: none;
&:focus {
border-color: $custom-select-focus-border-color;
outline: none;
@include box-shadow($custom-select-focus-box-shadow);
outline: 0;
box-shadow: $custom-select-focus-box-shadow;
&::-ms-value {
// For visual consistency with other platforms/browsers,
// supress the default white text on blue background highlight given to
// suppress the default white text on blue background highlight given to
// the selected option text when the (still closed) <select> receives focus
// in IE and (under certain conditions) Edge.
// See https://github.com/twbs/bootstrap/issues/19398.
@ -171,9 +194,15 @@
}
}
&[multiple],
&[size]:not([size="1"]) {
height: auto;
padding-right: $custom-select-padding-x;
background-image: none;
}
&:disabled {
color: $custom-select-disabled-color;
cursor: $cursor-disabled;
background-color: $custom-select-disabled-bg;
}
@ -184,14 +213,17 @@
}
.custom-select-sm {
height: $custom-select-height-sm;
padding-top: $custom-select-padding-y;
padding-bottom: $custom-select-padding-y;
font-size: $custom-select-sm-font-size;
font-size: $custom-select-font-size-sm;
}
// &:not([multiple]) {
// height: 26px;
// min-height: 26px;
// }
.custom-select-lg {
height: $custom-select-height-lg;
padding-top: $custom-select-padding-y;
padding-bottom: $custom-select-padding-y;
font-size: $custom-select-font-size-lg;
}
@ -202,64 +234,64 @@
.custom-file {
position: relative;
display: inline-block;
max-width: 100%;
width: 100%;
height: $custom-file-height;
cursor: pointer;
margin-bottom: 0;
}
.custom-file-input {
min-width: $custom-file-width;
max-width: 100%;
position: relative;
z-index: 2;
width: 100%;
height: $custom-file-height;
margin: 0;
filter: alpha(opacity = 0);
opacity: 0;
&:focus ~ .custom-file-control {
@include box-shadow($custom-file-focus-box-shadow);
border-color: $custom-file-focus-border-color;
box-shadow: $custom-file-focus-box-shadow;
&::before {
border-color: $custom-file-focus-border-color;
}
}
@each $lang, $value in $custom-file-text {
&:lang(#{$lang}) ~ .custom-file-label::after {
content: $value;
}
}
}
.custom-file-control {
.custom-file-label {
position: absolute;
top: 0;
right: 0;
left: 0;
z-index: 5;
z-index: 1;
height: $custom-file-height;
padding: $custom-file-padding-x $custom-file-padding-y;
padding: $custom-file-padding-y $custom-file-padding-x;
line-height: $custom-file-line-height;
color: $custom-file-color;
user-select: none;
background-color: $custom-file-bg;
border: $custom-file-border-width solid $custom-file-border-color;
@include border-radius($custom-file-border-radius);
@include box-shadow($custom-file-box-shadow);
@each $lang, $text in map-get($custom-file-text, placeholder) {
&:lang(#{$lang})::after {
content: $text;
}
}
&::before {
&::after {
position: absolute;
top: -$custom-file-border-width;
right: -$custom-file-border-width;
bottom: -$custom-file-border-width;
z-index: 6;
top: 0;
right: 0;
bottom: 0;
z-index: 3;
display: block;
height: $custom-file-height;
padding: $custom-file-padding-x $custom-file-padding-y;
height: calc(#{$custom-file-height} - #{$custom-file-border-width} * 2);
padding: $custom-file-padding-y $custom-file-padding-x;
line-height: $custom-file-line-height;
color: $custom-file-button-color;
background-color: $custom-file-button-bg;
border: $custom-file-border-width solid $custom-file-border-color;
content: "Browse";
@include gradient-bg($custom-file-button-bg);
border-left: $custom-file-border-width solid $custom-file-border-color;
@include border-radius(0 $custom-file-border-radius $custom-file-border-radius 0);
}
@each $lang, $text in map-get($custom-file-text, button-label) {
&:lang(#{$lang})::before {
content: $text;
}
}
}

166
scss/bootstrap/_dropdown.scss

@ -6,31 +6,7 @@
.dropdown-toggle {
// Generate the caret automatically
&::after {
display: inline-block;
width: 0;
height: 0;
margin-left: $caret-width;
vertical-align: middle;
content: "";
border-top: $caret-width solid;
border-right: $caret-width solid transparent;
border-left: $caret-width solid transparent;
}
// Prevent the focus on the dropdown toggle when closing dropdowns
&:focus {
outline: 0;
}
}
.dropup {
.dropdown-toggle {
&::after {
border-top: 0;
border-bottom: $caret-width solid;
}
}
@include caret;
}
// The dropdown menu
@ -43,18 +19,59 @@
float: left;
min-width: $dropdown-min-width;
padding: $dropdown-padding-y 0;
margin: $dropdown-margin-top 0 0; // override default ul
font-size: $font-size-base;
margin: $dropdown-spacer 0 0; // override default ul
font-size: $font-size-base; // Redeclare because nesting can cause inheritance issues
color: $body-color;
text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer)
list-style: none;
background-color: $dropdown-bg;
background-clip: padding-box;
border: $dropdown-border-width solid $dropdown-border-color;
@include border-radius($border-radius);
@include border-radius($dropdown-border-radius);
@include box-shadow($dropdown-box-shadow);
}
// Allow for dropdowns to go bottom up (aka, dropup-menu)
// Just add .dropup after the standard .dropdown class and you're set.
.dropup {
.dropdown-menu {
margin-top: 0;
margin-bottom: $dropdown-spacer;
}
.dropdown-toggle {
@include caret(up);
}
}
.dropright {
.dropdown-menu {
margin-top: 0;
margin-left: $dropdown-spacer;
}
.dropdown-toggle {
@include caret(right);
&::after {
vertical-align: 0;
}
}
}
.dropleft {
.dropdown-menu {
margin-top: 0;
margin-right: $dropdown-spacer;
}
.dropdown-toggle {
@include caret(left);
&::before {
vertical-align: 0;
}
}
}
// Dividers (basically an `<hr>`) within the dropdown
.dropdown-divider {
@include nav-divider($dropdown-divider-bg);
@ -66,114 +83,49 @@
.dropdown-item {
display: block;
width: 100%; // For `<button>`s
padding: 3px $dropdown-item-padding-x;
padding: $dropdown-item-padding-y $dropdown-item-padding-x;
clear: both;
font-weight: normal;
font-weight: $font-weight-normal;
color: $dropdown-link-color;
text-align: inherit; // For `<button>`s
white-space: nowrap; // prevent links from randomly breaking onto new lines
background: none; // For `<button>`s
background-color: transparent; // For `<button>`s
border: 0; // For `<button>`s
@include hover-focus {
color: $dropdown-link-hover-color;
text-decoration: none;
background-color: $dropdown-link-hover-bg;
@include gradient-bg($dropdown-link-hover-bg);
}
// Active state
&.active {
@include plain-hover-focus {
&.active,
&:active {
color: $dropdown-link-active-color;
text-decoration: none;
background-color: $dropdown-link-active-bg;
outline: 0;
}
@include gradient-bg($dropdown-link-active-bg);
}
// Disabled state
//
// Gray out text and ensure the hover/focus state remains gray
&.disabled {
@include plain-hover-focus {
&.disabled,
&:disabled {
color: $dropdown-link-disabled-color;
}
// Nuke hover/focus effects
@include hover-focus {
text-decoration: none;
cursor: $cursor-disabled;
background-color: transparent;
background-image: none; // Remove CSS gradient
@include reset-filter();
// Remove CSS gradients if they're enabled
@if $enable-gradients {
background-image: none;
}
}
}
// Open state for the dropdown
.open {
// Show the menu
> .dropdown-menu {
.dropdown-menu.show {
display: block;
}
// Remove the outline when :focus is triggered
> a {
outline: 0;
}
}
// Menu positioning
//
// Add extra class to `.dropdown-menu` to flip the alignment of the dropdown
// menu with the parent.
.dropdown-menu-right {
right: 0;
left: auto; // Reset the default from `.dropdown-menu`
}
.dropdown-menu-left {
right: auto;
left: 0;
}
// Dropdown section headers
.dropdown-header {
display: block;
padding: $dropdown-padding-y $dropdown-item-padding-x;
margin-bottom: 0; // for use with heading elements
font-size: $font-size-sm;
color: $dropdown-header-color;
white-space: nowrap; // as with > li > a
}
// Backdrop to catch body clicks on mobile, etc.
.dropdown-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: $zindex-dropdown-backdrop;
}
// Allow for dropdowns to go bottom up (aka, dropup-menu)
//
// Just add .dropup after the standard .dropdown class and you're set.
// TODO: abstract this so that the navbar fixed styles are not placed here?
.dropup,
.navbar-fixed-bottom .dropdown {
// Reverse the caret
.caret {
content: "";
border-top: 0;
border-bottom: $caret-width solid;
}
// Different positioning for bottom up menu
.dropdown-menu {
top: auto;
bottom: 100%;
margin-bottom: $dropdown-margin-top;
}
}

267
scss/bootstrap/_forms.scss

@ -1,4 +1,4 @@
// scss-lint:disable QualifyingElement
// stylelint-disable selector-no-qualifying-type
//
// Textual form controls
@ -7,21 +7,25 @@
.form-control {
display: block;
width: 100%;
// // Make inputs at least the height of their button counterpart (base line-height + padding + border)
// height: $input-height;
padding: $input-padding-y $input-padding-x;
font-size: $font-size-base;
line-height: $input-line-height;
color: $input-color;
background-color: $input-bg;
// Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214.
background-image: none;
background-clip: padding-box;
border: $input-btn-border-width solid $input-border-color;
border: $input-border-width solid $input-border-color;
// Note: This has no effect on <select>s in some browsers, due to the limited stylability of `<select>`s in CSS.
@include border-radius($input-border-radius);
@if $enable-rounded {
// Manually use the if/else instead of the mixin to account for iOS override
border-radius: $input-border-radius;
} @else {
// Otherwise undo the iOS default
border-radius: 0;
}
@include box-shadow($input-box-shadow);
@include transition(border-color ease-in-out .15s, box-shadow ease-in-out .15s);
@include transition($input-transition);
// Unstyle the caret on `<select>`s in IE10+.
&::-ms-expand {
@ -34,7 +38,7 @@
// Placeholder
&::placeholder {
color: $input-color-placeholder;
color: $input-placeholder-color;
// Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526.
opacity: 1;
}
@ -46,14 +50,10 @@
// don't honor that edge case; we style them as disabled anyway.
&:disabled,
&[readonly] {
background-color: $input-bg-disabled;
background-color: $input-disabled-bg;
// iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655.
opacity: 1;
}
&:disabled {
cursor: $cursor-disabled;
}
}
select.form-control {
@ -76,6 +76,7 @@ select.form-control {
.form-control-file,
.form-control-range {
display: block;
width: 100%;
}
@ -83,53 +84,46 @@ select.form-control {
// Labels
//
// For use with horizontal and inline forms, when you need the label text to
// align with the form controls.
// For use with horizontal and inline forms, when you need the label (or legend)
// text to align with the form controls.
.col-form-label {
padding-top: $input-padding-y;
padding-bottom: $input-padding-y;
margin-bottom: 0; // Override the `<label>` default
padding-top: calc(#{$input-padding-y} + #{$input-border-width});
padding-bottom: calc(#{$input-padding-y} + #{$input-border-width});
margin-bottom: 0; // Override the `<label>/<legend>` default
font-size: inherit; // Override the `<legend>` default
line-height: $input-line-height;
}
.col-form-label-lg {
padding-top: $input-padding-y-lg;
padding-bottom: $input-padding-y-lg;
padding-top: calc(#{$input-padding-y-lg} + #{$input-border-width});
padding-bottom: calc(#{$input-padding-y-lg} + #{$input-border-width});
font-size: $font-size-lg;
line-height: $input-line-height-lg;
}
.col-form-label-sm {
padding-top: $input-padding-y-sm;
padding-bottom: $input-padding-y-sm;
padding-top: calc(#{$input-padding-y-sm} + #{$input-border-width});
padding-bottom: calc(#{$input-padding-y-sm} + #{$input-border-width});
font-size: $font-size-sm;
line-height: $input-line-height-sm;
}
// Readonly controls as plain text
//
// Legends
//
// Apply class to a readonly input to make it appear like regular plain
// text (without any border, background color, focus indicator)
// For use with horizontal and inline forms, when you need the legend text to
// be the same size as regular labels, and to align with the form controls.
.col-form-legend {
padding-top: $input-padding-y;
padding-bottom: $input-padding-y;
margin-bottom: 0;
font-size: $font-size-base;
}
// Static form control text
//
// Apply class to an element to make any string of text align with labels in a
// horizontal form layout.
.form-control-static {
min-height: $input-height;
// Size it appropriately next to real form controls
.form-control-plaintext {
display: block;
width: 100%;
padding-top: $input-padding-y;
padding-bottom: $input-padding-y;
// Remove default margin from `p`
margin-bottom: 0;
margin-bottom: 0; // match inputs if this class comes on inputs with default margins
line-height: $input-line-height;
background-color: transparent;
border: solid transparent;
border-width: $input-border-width 0;
&.form-control-sm,
&.form-control-lg {
@ -150,6 +144,7 @@ select.form-control {
.form-control-sm {
padding: $input-padding-y-sm $input-padding-x-sm;
font-size: $font-size-sm;
line-height: $input-line-height-sm;
@include border-radius($input-border-radius-sm);
}
@ -162,6 +157,7 @@ select.form-control-sm {
.form-control-lg {
padding: $input-padding-y-lg $input-padding-x-lg;
font-size: $font-size-lg;
line-height: $input-line-height-lg;
@include border-radius($input-border-radius-lg);
}
@ -183,7 +179,25 @@ select.form-control-lg {
.form-text {
display: block;
margin-top: ($spacer * .25);
margin-top: $form-text-margin-top;
}
// Form grid
//
// Special replacement for our grid system's `.row` for tighter form layouts.
.form-row {
display: flex;
flex-wrap: wrap;
margin-right: -5px;
margin-left: -5px;
> .col,
> [class*="col-"] {
padding-right: 5px;
padding-left: 5px;
}
}
@ -194,98 +208,48 @@ select.form-control-lg {
.form-check {
position: relative;
display: block;
margin-bottom: ($spacer * .75);
// Move up sibling radios or checkboxes for tighter spacing
+ .form-check {
margin-top: -.25rem;
padding-left: $form-check-input-gutter;
}
&.disabled {
.form-check-label {
.form-check-input {
position: absolute;
margin-top: $form-check-input-margin-y;
margin-left: -$form-check-input-gutter;
&:disabled ~ .form-check-label {
color: $text-muted;
cursor: $cursor-disabled;
}
}
}
.form-check-label {
padding-left: 1.25rem;
margin-bottom: 0; // Override default `<label>` bottom margin
cursor: pointer;
}
.form-check-input {
position: absolute;
margin-top: .25rem;
margin-left: -1.25rem;
&:only-child {
position: static;
}
}
// Radios and checkboxes on same line
.form-check-inline {
position: relative;
display: inline-block;
padding-left: 1.25rem;
margin-bottom: 0; // Override default `<label>` bottom margin
vertical-align: middle;
cursor: pointer;
+ .form-check-inline {
margin-left: .75rem;
}
display: inline-flex;
align-items: center;
padding-left: 0; // Override base .form-check
margin-right: $form-check-inline-margin-x;
&.disabled {
cursor: $cursor-disabled;
// Undo .form-check-input defaults and add some `margin-right`.
.form-check-input {
position: static;
margin-top: 0;
margin-right: $form-check-inline-input-margin-x;
margin-left: 0;
}
}
// Form control feedback states
// Form validation
//
// Apply contextual and semantic states to individual form controls.
.form-control-feedback {
margin-top: ($spacer * .25);
}
.form-control-success,
.form-control-warning,
.form-control-danger {
padding-right: ($input-padding-x * 3);
background-repeat: no-repeat;
background-position: center right ($input-height / 4);
background-size: ($input-height / 2) ($input-height / 2);
}
// Form validation states
.has-success {
@include form-control-validation($brand-success);
.form-control-success {
background-image: $form-icon-success;
}
}
.has-warning {
@include form-control-validation($brand-warning);
.form-control-warning {
background-image: $form-icon-warning;
}
}
.has-danger {
@include form-control-validation($brand-danger);
.form-control-danger {
background-image: $form-icon-danger;
}
}
// Provide feedback to users when form field values are valid or invalid. Works
// primarily for client-side validation via scoped `:invalid` and `:valid`
// pseudo-classes but also includes `.is-invalid` and `.is-valid` classes for
// server side validation.
@include form-validation-state("valid", $form-feedback-valid-color);
@include form-validation-state("invalid", $form-feedback-invalid-color);
// Inline forms
//
@ -297,14 +261,33 @@ select.form-control-lg {
// default HTML form controls and our custom form controls (e.g., input groups).
.form-inline {
display: flex;
flex-flow: row wrap;
align-items: center; // Prevent shorter elements from growing to same height as others (e.g., small buttons growing to normal sized button height)
// Because we use flex, the initial sizing of checkboxes is collapsed and
// doesn't occupy the full-width (which is what we want for xs grid tier),
// so we force that here.
.form-check {
width: 100%;
}
// Kick in the inline
@include media-breakpoint-up(sm) {
label {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 0;
}
// Inline-block all the things for "inline"
.form-group {
display: inline-block;
display: flex;
flex: 0 0 auto;
flex-flow: row wrap;
align-items: center;
margin-bottom: 0;
vertical-align: middle;
}
// Allow folks to *not* use `.form-group`
@ -315,50 +298,36 @@ select.form-control-lg {
}
// Make static controls behave like regular ones
.form-control-static {
.form-control-plaintext {
display: inline-block;
}
.input-group {
display: inline-table;
vertical-align: middle;
.input-group-addon,
.input-group-btn,
.form-control {
width: auto;
}
}
// Input groups need that 100% width though
.input-group > .form-control {
width: 100%;
}
.form-control-label {
margin-bottom: 0;
vertical-align: middle;
}
// Remove default margin on radios/checkboxes that were used for stacking, and
// then undo the floating of radios and checkboxes to match.
.form-check {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
}
.form-check-label {
display: flex;
align-items: center;
justify-content: center;
width: auto;
padding-left: 0;
}
.form-check-input {
position: relative;
margin-top: 0;
margin-right: $form-check-input-margin-x;
margin-left: 0;
}
// Re-override the feedback icon.
.has-feedback .form-control-feedback {
top: 0;
.custom-control {
align-items: center;
justify-content: center;
}
.custom-control-label {
margin-bottom: 0;
}
}
}

86
scss/bootstrap/_functions.scss

@ -0,0 +1,86 @@
// Bootstrap functions
//
// Utility mixins and functions for evalutating source code across our variables, maps, and mixins.
// Ascending
// Used to evaluate Sass maps like our grid breakpoints.
@mixin _assert-ascending($map, $map-name) {
$prev-key: null;
$prev-num: null;
@each $key, $num in $map {
@if $prev-num == null {
// Do nothing
} @else if not comparable($prev-num, $num) {
@warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !";
} @else if $prev-num >= $num {
@warn "Invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} which isn't greater than #{$prev-num}, the value of the previous key '#{$prev-key}' !";
}
$prev-key: $key;
$prev-num: $num;
}
}
// Starts at zero
// Another grid mixin that ensures the min-width of the lowest breakpoint starts at 0.
@mixin _assert-starts-at-zero($map) {
$values: map-values($map);
$first-value: nth($values, 1);
@if $first-value != 0 {
@warn "First breakpoint in `$grid-breakpoints` must start at 0, but starts at #{$first-value}.";
}
}
// Replace `$search` with `$replace` in `$string`
// Used on our SVG icon backgrounds for custom forms.
//
// @author Hugo Giraudel
// @param {String} $string - Initial string
// @param {String} $search - Substring to replace
// @param {String} $replace ('') - New value
// @return {String} - Updated string
@function str-replace($string, $search, $replace: "") {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
// Color contrast
@function color-yiq($color) {
$r: red($color);
$g: green($color);
$b: blue($color);
$yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
@if ($yiq >= $yiq-contrasted-threshold) {
@return $yiq-text-dark;
} @else {
@return $yiq-text-light;
}
}
// Retrieve color Sass maps
@function color($key: "blue") {
@return map-get($colors, $key);
}
@function theme-color($key: "primary") {
@return map-get($theme-colors, $key);
}
@function gray($key: "100") {
@return map-get($grays, $key);
}
// Request a theme color level
@function theme-color-level($color-name: "primary", $level: 0) {
$color: theme-color($color-name);
$color-base: if($level > 0, #000, #fff);
$level: abs($level);
@return mix($color-base, $color, $level * $theme-color-interval);
}

17
scss/bootstrap/_grid.scss

@ -11,8 +11,8 @@
// Fluid container
//
// Utilizes the mixin meant for fixed width containers, but without any defined
// width for fluid, full width layouts.
// Utilizes the mixin meant for fixed width containers, but with 100% width for
// fluid, full width layouts.
@if $enable-grid-classes {
.container-fluid {
@ -28,6 +28,19 @@
.row {
@include make-row();
}
// Remove the negative margin from default .row, then the horizontal padding
// from all immediate children columns (to prevent runaway style inheritance).
.no-gutters {
margin-right: 0;
margin-left: 0;
> .col,
> [class*="col-"] {
padding-right: 0;
padding-left: 0;
}
}
}
// Columns

18
scss/bootstrap/_images.scss

@ -6,13 +6,9 @@
// which weren't expecting the images within themselves to be involuntarily resized.
// See also https://github.com/twbs/bootstrap/issues/18178
.img-fluid {
@include img-fluid();
@include img-fluid;
}
// Rounded corners
.img-rounded {
@include border-radius($border-radius-lg);
}
// Image thumbnails
.img-thumbnail {
@ -20,16 +16,10 @@
background-color: $thumbnail-bg;
border: $thumbnail-border-width solid $thumbnail-border-color;
@include border-radius($thumbnail-border-radius);
transition: all .2s ease-in-out;
@include box-shadow($thumbnail-box-shadow);
// Keep them at most 100% wide
@include img-fluid(inline-block);
}
// Perfect circle
.img-circle {
border-radius: 50%;
@include img-fluid;
}
//
@ -42,11 +32,11 @@
}
.figure-img {
margin-bottom: ($spacer-y / 2);
margin-bottom: ($spacer / 2);
line-height: 1;
}
.figure-caption {
font-size: $figure-caption-font-size;
color: $gray-light;
color: $figure-caption-color;
}

237
scss/bootstrap/_input-group.scss

@ -1,188 +1,159 @@
// stylelint-disable selector-no-qualifying-type
//
// Base styles
//
.input-group {
position: relative;
display: flex;
flex-wrap: wrap; // For form validation feedback
align-items: stretch;
width: 100%;
@if $enable-flex {
display: flex;
} @else {
display: table;
// Prevent input groups from inheriting border styles from table cells when
// placed within a table.
border-collapse: separate;
}
> .form-control,
> .custom-select,
> .custom-file {
position: relative; // For focus state's z-index
flex: 1 1 auto;
// Add width 1% and flex-basis auto to ensure that button will not wrap out
// the column. Applies to IE Edge+ and Firefox. Chrome does not require this.
width: 1%;
margin-bottom: 0;
.form-control {
// Ensure that the input is always above the *appended* addon button for
// proper border colors.
position: relative;
z-index: 2;
// Bring the "active" form control to the front
@include hover-focus-active {
// Bring the "active" form control to the top of surrounding elements
&:focus {
z-index: 3;
}
@if $enable-flex {
flex: 1;
} @else {
// IE9 fubars the placeholder attribute in text inputs and the arrows on
// select elements in input groups. To fix it, we float the input. Details:
// https://github.com/twbs/bootstrap/issues/11561#issuecomment-28936855
float: left;
width: 100%;
}
margin-bottom: 0;
+ .form-control,
+ .custom-select,
+ .custom-file {
margin-left: -$input-border-width;
}
}
.input-group-addon,
.input-group-btn,
.input-group .form-control {
@if not $enable-flex {
display: table-cell;
> .form-control,
> .custom-select {
&:not(:last-child) { @include border-right-radius(0); }
&:not(:first-child) { @include border-left-radius(0); }
}
&:not(:first-child):not(:last-child) {
@include border-radius(0);
}
}
// Custom file inputs have more complex markup, thus requiring different
// border-radius overrides.
> .custom-file {
display: flex;
align-items: center;
.input-group-addon,
.input-group-btn {
@if not $enable-flex {
width: 1%;
&:not(:last-child) .custom-file-label,
&:not(:last-child) .custom-file-label::before { @include border-right-radius(0); }
&:not(:first-child) .custom-file-label,
&:not(:first-child) .custom-file-label::before { @include border-left-radius(0); }
}
white-space: nowrap;
vertical-align: middle; // Match the inputs
}
// Sizing options
// Prepend and append
//
// Remix the default form control sizing classes into new ones for easier
// manipulation.
// While it requires one extra layer of HTML for each, dedicated prepend and
// append elements allow us to 1) be less clever, 2) simplify our selectors, and
// 3) support HTML5 form validation.
.input-group-lg > .form-control,
.input-group-lg > .input-group-addon,
.input-group-lg > .input-group-btn > .btn {
@extend .form-control-lg;
.input-group-prepend,
.input-group-append {
display: flex;
// Ensure buttons are always above inputs for more visually pleasing borders.
// This isn't needed for `.input-group-text` since it shares the same border-color
// as our inputs.
.btn {
position: relative;
z-index: 2;
}
.btn + .btn,
.btn + .input-group-text,
.input-group-text + .input-group-text,
.input-group-text + .btn {
margin-left: -$input-border-width;
}
.input-group-sm > .form-control,
.input-group-sm > .input-group-addon,
.input-group-sm > .input-group-btn > .btn {
@extend .form-control-sm;
}
.input-group-prepend { margin-right: -$input-border-width; }
.input-group-append { margin-left: -$input-border-width; }
// Textual addons
//
// Text input groups
//
// Serves as a catch-all element for any text or radio/checkbox input you wish
// to prepend or append to an input.
.input-group-addon {
.input-group-text {
display: flex;
align-items: center;
padding: $input-padding-y $input-padding-x;
margin-bottom: 0; // Allow use of <label> elements by overriding our default margin-bottom
font-size: $font-size-base;
font-weight: normal;
font-size: $font-size-base; // Match inputs
font-weight: $font-weight-normal;
line-height: $input-line-height;
color: $input-color;
color: $input-group-addon-color;
text-align: center;
white-space: nowrap;
background-color: $input-group-addon-bg;
border: $input-btn-border-width solid $input-group-addon-border-color;
border: $input-border-width solid $input-group-addon-border-color;
@include border-radius($input-border-radius);
// Sizing
&.form-control-sm {
padding: $input-padding-y-sm $input-padding-x-sm;
font-size: $font-size-sm;
@include border-radius($input-border-radius-sm);
}
&.form-control-lg {
padding: $input-padding-y-lg $input-padding-x-lg;
font-size: $font-size-lg;
@include border-radius($input-border-radius-lg);
}
// scss-lint:disable QualifyingElement
// Nuke default margins from checkboxes and radios to vertically center within.
input[type="radio"],
input[type="checkbox"] {
margin-top: 0;
}
// scss-lint:enable QualifyingElement
}
// Sizing
//
// Reset rounded corners
//
// Remix the default form control sizing classes into new ones for easier
// manipulation.
.input-group .form-control:not(:last-child),
.input-group-addon:not(:last-child),
.input-group-btn:not(:last-child) > .btn,
.input-group-btn:not(:last-child) > .btn-group > .btn,
.input-group-btn:not(:last-child) > .dropdown-toggle,
.input-group-btn:not(:first-child) > .btn:not(:last-child):not(.dropdown-toggle),
.input-group-btn:not(:first-child) > .btn-group:not(:last-child) > .btn {
@include border-right-radius(0);
}
.input-group-addon:not(:last-child) {
border-right: 0;
}
.input-group .form-control:not(:first-child),
.input-group-addon:not(:first-child),
.input-group-btn:not(:first-child) > .btn,
.input-group-btn:not(:first-child) > .btn-group > .btn,
.input-group-btn:not(:first-child) > .dropdown-toggle,
.input-group-btn:not(:last-child) > .btn:not(:first-child),
.input-group-btn:not(:last-child) > .btn-group:not(:first-child) > .btn {
@include border-left-radius(0);
.input-group-lg > .form-control,
.input-group-lg > .input-group-prepend > .input-group-text,
.input-group-lg > .input-group-append > .input-group-text,
.input-group-lg > .input-group-prepend > .btn,
.input-group-lg > .input-group-append > .btn {
@extend .form-control-lg;
}
.form-control + .input-group-addon:not(:first-child) {
border-left: 0;
.input-group-sm > .form-control,
.input-group-sm > .input-group-prepend > .input-group-text,
.input-group-sm > .input-group-append > .input-group-text,
.input-group-sm > .input-group-prepend > .btn,
.input-group-sm > .input-group-append > .btn {
@extend .form-control-sm;
}
// Prepend and append rounded corners
//
// Button input groups
//
// These rulesets must come after the sizing ones to properly override sm and lg
// border-radius values when extending. They're more specific than we'd like
// with the `.input-group >` part, but without it, we cannot override the sizing.
.input-group-btn {
position: relative;
// Jankily prevent input button groups from wrapping with `white-space` and
// `font-size` in combination with `inline-block` on buttons.
font-size: 0;
white-space: nowrap;
// Negative margin for spacing, position for bringing hovered/focused/actived
// element above the siblings.
> .btn {
position: relative;
+ .btn {
margin-left: (-$input-btn-border-width);
}
// Bring the "active" button to the front
@include hover-focus-active {
z-index: 3;
}
.input-group > .input-group-prepend > .btn,
.input-group > .input-group-prepend > .input-group-text,
.input-group > .input-group-append:not(:last-child) > .btn,
.input-group > .input-group-append:not(:last-child) > .input-group-text,
.input-group > .input-group-append:last-child > .btn:not(:last-child):not(.dropdown-toggle),
.input-group > .input-group-append:last-child > .input-group-text:not(:last-child) {
@include border-right-radius(0);
}
// Negative margin to only have a single, shared border between the two
&:not(:last-child) {
> .btn,
> .btn-group {
margin-right: (-$input-btn-border-width);
}
}
&:not(:first-child) {
> .btn,
> .btn-group {
z-index: 2;
margin-left: (-$input-btn-border-width);
// Because specificity
@include hover-focus-active {
z-index: 3;
}
}
}
.input-group > .input-group-append > .btn,
.input-group > .input-group-append > .input-group-text,
.input-group > .input-group-prepend:not(:first-child) > .btn,
.input-group > .input-group-prepend:not(:first-child) > .input-group-text,
.input-group > .input-group-prepend:first-child > .btn:not(:first-child),
.input-group > .input-group-prepend:first-child > .input-group-text:not(:first-child) {
@include border-left-radius(0);
}

4
scss/bootstrap/_jumbotron.scss

@ -9,10 +9,6 @@
}
}
.jumbotron-hr {
border-top-color: darken($jumbotron-bg, 10%);
}
.jumbotron-fluid {
padding-right: 0;
padding-left: 0;

118
scss/bootstrap/_list-group.scss

@ -3,12 +3,39 @@
// Easily usable on <ul>, <ol>, or <div>.
.list-group {
display: flex;
flex-direction: column;
// No need to set list-style: none; since .list-group-item is block level
padding-left: 0; // reset padding because ul and ol
margin-bottom: 0;
}
// Interactive list items
//
// Use anchor or button elements instead of `li`s or `div`s to create interactive
// list items. Includes an extra `.active` modifier class for selected items.
.list-group-item-action {
width: 100%; // For `<button>`s (anchors become 100% by default though)
color: $list-group-action-color;
text-align: inherit; // For `<button>`s (anchors inherit)
// Hover state
@include hover-focus {
color: $list-group-action-hover-color;
text-decoration: none;
background-color: $list-group-hover-bg;
}
&:active {
color: $list-group-action-active-color;
background-color: $list-group-action-active-bg;
}
}
// Individual list items
//
// Use on `li`s or `div`s within the `.list-group` parent.
@ -31,69 +58,49 @@
@include border-bottom-radius($list-group-border-radius);
}
&.disabled {
@include plain-hover-focus {
@include hover-focus {
z-index: 1; // Place hover/active items above their siblings for proper border styling
text-decoration: none;
}
&.disabled,
&:disabled {
color: $list-group-disabled-color;
cursor: $cursor-disabled;
background-color: $list-group-disabled-bg;
// Force color to inherit for custom content
.list-group-item-heading {
color: inherit;
}
.list-group-item-text {
color: $list-group-disabled-text-color;
}
}
}
// Include both here for `<a>`s and `<button>`s
&.active {
@include plain-hover-focus {
z-index: 2; // Place active items above their siblings for proper border styling
color: $list-group-active-color;
text-decoration: none; // Repeat here because it inherits global a:hover otherwise
background-color: $list-group-active-bg;
border-color: $list-group-active-border;
// Force color to inherit for custom content
.list-group-item-heading,
.list-group-item-heading > small,
.list-group-item-heading > .small {
color: inherit;
}
.list-group-item-text {
color: $list-group-active-text-color;
}
}
}
}
.list-group-flush {
.list-group-item {
border-radius: 0;
border-color: $list-group-active-border-color;
}
}
// Interactive list items
// Flush list items
//
// Use anchor or button elements instead of `li`s or `div`s to create interactive
// list items. Includes an extra `.active` modifier class for selected items.
// Remove borders and border-radius to keep list group items edge-to-edge. Most
// useful within other components (e.g., cards).
.list-group-item-action {
width: 100%; // For `<button>`s (anchors become 100% by default though)
color: $list-group-link-color;
text-align: inherit; // For `<button>`s (anchors inherit)
.list-group-flush {
.list-group-item {
border-right: 0;
border-left: 0;
@include border-radius(0);
}
.list-group-item-heading {
color: $list-group-link-heading-color;
&:first-child {
.list-group-item:first-child {
border-top: 0;
}
}
// Hover state
@include hover-focus {
color: $list-group-link-hover-color;
text-decoration: none;
background-color: $list-group-hover-bg;
&:last-child {
.list-group-item:last-child {
border-bottom: 0;
}
}
}
@ -103,21 +110,6 @@
// Add modifier classes to change text and background color on individual items.
// Organizationally, this must come after the `:hover` states.
@include list-group-item-variant(success, $state-success-bg, $state-success-text);
@include list-group-item-variant(info, $state-info-bg, $state-info-text);
@include list-group-item-variant(warning, $state-warning-bg, $state-warning-text);
@include list-group-item-variant(danger, $state-danger-bg, $state-danger-text);
// Custom content options
//
// Extra classes for creating well-formatted content within `.list-group-item`s.
.list-group-item-heading {
margin-top: 0;
margin-bottom: $list-group-item-heading-margin-bottom;
}
.list-group-item-text {
margin-bottom: 0;
line-height: 1.3;
@each $color, $value in $theme-colors {
@include list-group-item-variant($color, theme-color-level($color, -9), theme-color-level($color, 6));
}

77
scss/bootstrap/_media.scss

@ -1,81 +1,8 @@
@if $enable-flex {
.media {
display: flex;
align-items: flex-start;
}
.media-body {
flex: 1;
}
.media-middle {
align-self: center;
}
.media-bottom {
align-self: flex-end;
}
} @else {
.media,
.media-body {
overflow: hidden;
}
.media-body {
width: 10000px;
}
.media-left,
.media-right,
.media-body {
display: table-cell;
vertical-align: top;
}
.media-middle {
vertical-align: middle;
}
.media-bottom {
vertical-align: bottom;
}
}
//
// Images/elements as the media anchor
//
.media-object {
display: block;
// Fix collapse in webkit from max-width: 100% and display: table-cell.
&.img-thumbnail {
max-width: none;
}
}
//
// Alignment
//
.media-right {
padding-left: $media-alignment-padding-x;
}
.media-left {
padding-right: $media-alignment-padding-x;
}
//
// Headings
//
.media-heading {
margin-top: 0;
margin-bottom: $media-heading-margin-bottom;
}
//
// Media list variation
//
.media-list {
padding-left: 0;
list-style: none;
}

24
scss/bootstrap/_mixins.scss

@ -2,53 +2,41 @@
//
// Used in conjunction with global variables to enable certain theme features.
@mixin box-shadow($shadow...) {
@if $enable-shadows {
box-shadow: $shadow;
}
}
@mixin transition($transition...) {
@if $enable-transitions {
transition: $transition;
}
}
// Utilities
@import "mixins/breakpoints";
@import "mixins/hover";
@import "mixins/image";
@import "mixins/tag";
@import "mixins/reset-filter";
@import "mixins/badge";
@import "mixins/resize";
@import "mixins/screen-reader";
@import "mixins/size";
@import "mixins/tab-focus";
@import "mixins/reset-text";
@import "mixins/text-emphasis";
@import "mixins/text-hide";
@import "mixins/text-truncate";
@import "mixins/visibility";
// // Components
@import "mixins/alert";
@import "mixins/buttons";
@import "mixins/cards";
@import "mixins/caret";
@import "mixins/pagination";
@import "mixins/lists";
@import "mixins/list-group";
@import "mixins/nav-divider";
@import "mixins/forms";
@import "mixins/progress";
@import "mixins/table-row";
// // Skins
@import "mixins/background-variant";
@import "mixins/border-radius";
@import "mixins/box-shadow";
@import "mixins/gradients";
@import "mixins/transition";
// // Layout
@import "mixins/clearfix";
// @import "mixins/navbar-align";
@import "mixins/grid-framework";
@import "mixins/grid";
@import "mixins/pulls";
@import "mixins/float";

82
scss/bootstrap/_modal.scss

@ -1,7 +1,7 @@
// .modal-open - body class for killing the scroll
// .modal - container to scroll within
// .modal-dialog - positioning shell for the actual modal
// .modal-content - actual modal w/ bg and corners and shit
// .modal-content - actual modal w/ bg and corners and stuff
// Kill the scroll on the body
@ -22,35 +22,53 @@
// Prevent Chrome on Windows from adding a focus outline. For details, see
// https://github.com/twbs/bootstrap/pull/10951.
outline: 0;
-webkit-overflow-scrolling: touch;
// We deliberately don't use `-webkit-overflow-scrolling: touch;` due to a
// gnarly iOS Safari bug: https://bugs.webkit.org/show_bug.cgi?id=158342
// See also https://github.com/twbs/bootstrap/issues/17695
// When fading in the modal, animate it to slide down
&.fade .modal-dialog {
transition: transform .3s ease-out;
transform: translate(0, -25%);
}
&.in .modal-dialog { transform: translate(0, 0); }
}
.modal-open .modal {
.modal-open & {
overflow-x: hidden;
overflow-y: auto;
}
}
// Shell div to position the modal with bottom padding
.modal-dialog {
position: relative;
width: auto;
margin: $modal-dialog-margin;
// allow clicks to pass through for custom click handling to close modal
pointer-events: none;
// When fading in the modal, animate it to slide down
.modal.fade & {
@include transition($modal-transition);
transform: translate(0, -25%);
}
.modal.show & {
transform: translate(0, 0);
}
}
.modal-dialog-centered {
display: flex;
align-items: center;
min-height: calc(100% - (#{$modal-dialog-margin} * 2));
}
// Actual modal
.modal-content {
position: relative;
display: flex;
flex-direction: column;
width: 100%; // Ensure `.modal-content` extends the full width of the parent `.modal-dialog`
// counteract the pointer-events: none; in the .modal-dialog
pointer-events: auto;
background-color: $modal-content-bg;
background-clip: padding-box;
border: $modal-content-border-width solid $modal-content-border-color;
@include border-radius($border-radius-lg);
@include box-shadow($modal-content-xs-box-shadow);
@include box-shadow($modal-content-box-shadow-xs);
// Remove focus outline from opened modal
outline: 0;
}
@ -62,29 +80,34 @@
right: 0;
bottom: 0;
left: 0;
z-index: $zindex-modal-bg;
z-index: $zindex-modal-backdrop;
background-color: $modal-backdrop-bg;
// Fade for backdrop
&.fade { opacity: 0; }
&.in { opacity: $modal-backdrop-opacity; }
&.show { opacity: $modal-backdrop-opacity; }
}
// Modal header
// Top section of the modal w/ title and dismiss
.modal-header {
padding: $modal-title-padding;
display: flex;
align-items: flex-start; // so the close btn always stays on the upper right corner
justify-content: space-between; // Put modal header elements (title and dismiss) on opposite ends
padding: $modal-header-padding;
border-bottom: $modal-header-border-width solid $modal-header-border-color;
@include clearfix;
@include border-top-radius($border-radius-lg);
.close {
padding: $modal-header-padding;
// auto on the left force icon to the right even when there is no .modal-title
margin: (-$modal-header-padding) (-$modal-header-padding) (-$modal-header-padding) auto;
}
// Close icon
.modal-header .close {
margin-top: -2px;
}
// Title text within header
.modal-title {
margin: 0;
margin-bottom: 0;
line-height: $modal-title-line-height;
}
@ -92,15 +115,23 @@
// Where all modal content resides (sibling of .modal-header and .modal-footer)
.modal-body {
position: relative;
// Enable `flex-grow: 1` so that the body take up as much space as possible
// when should there be a fixed height on `.modal-dialog`.
flex: 1 1 auto;
padding: $modal-inner-padding;
}
// Footer (for actions)
.modal-footer {
display: flex;
align-items: center; // vertically center
justify-content: flex-end; // Right align buttons with flex property because text-align doesn't work on flex items
padding: $modal-inner-padding;
text-align: right; // right align buttons
border-top: $modal-footer-border-width solid $modal-footer-border-color;
@include clearfix(); // clear it in case folks use .pull-* classes on buttons
// Easily place margin between footer elements
> :not(:first-child) { margin-left: .25rem; }
> :not(:last-child) { margin-right: .25rem; }
}
// Measure scrollbar width for padding body during modal show/hide
@ -117,14 +148,19 @@
// Automatically set modal's width for larger viewports
.modal-dialog {
max-width: $modal-md;
margin: $modal-dialog-sm-up-margin-y auto;
margin: $modal-dialog-margin-y-sm-up auto;
}
.modal-dialog-centered {
min-height: calc(100% - (#{$modal-dialog-margin-y-sm-up} * 2));
}
.modal-content {
@include box-shadow($modal-content-sm-up-box-shadow);
@include box-shadow($modal-content-box-shadow-sm-up);
}
.modal-sm { max-width: $modal-sm; }
}
@include media-breakpoint-up(lg) {

101
scss/bootstrap/_nav.scss

@ -4,89 +4,58 @@
// `<nav>`s or `<ul>`s.
.nav {
display: flex;
flex-wrap: wrap;
padding-left: 0;
margin-bottom: 0;
list-style: none;
}
.nav-link {
display: inline-block;
display: block;
padding: $nav-link-padding-y $nav-link-padding-x;
@include hover-focus {
text-decoration: none;
}
// Disabled state lightens text and removes hover/tab effects
// Disabled state lightens text
&.disabled {
color: $nav-disabled-link-color;
@include plain-hover-focus {
color: $nav-disabled-link-hover-color;
cursor: $cursor-disabled;
background-color: $nav-disabled-link-hover-bg;
}
color: $nav-link-disabled-color;
}
}
// Nav inline
.nav-inline {
.nav-item {
display: inline-block;
}
.nav-item + .nav-item,
.nav-link + .nav-link {
margin-left: $nav-item-inline-spacer;
}
}
//
// Tabs
//
.nav-tabs {
border-bottom: $nav-tabs-border-width solid $nav-tabs-border-color;
@include clearfix();
.nav-item {
float: left;
// Make the list-items overlay the bottom border
margin-bottom: -$nav-tabs-border-width;
+ .nav-item {
margin-left: $nav-item-margin;
}
}
.nav-link {
display: block;
padding: $nav-link-padding;
border: $nav-tabs-border-width solid transparent;
@include border-top-radius($nav-tabs-border-radius);
@include hover-focus {
border-color: $nav-tabs-link-hover-border-color $nav-tabs-link-hover-border-color $nav-tabs-border-color;
border-color: $nav-tabs-link-hover-border-color;
}
&.disabled {
@include plain-hover-focus {
color: $nav-disabled-link-color;
color: $nav-link-disabled-color;
background-color: transparent;
border-color: transparent;
}
}
}
.nav-link.active,
.nav-item.open .nav-link {
@include plain-hover-focus {
color: $nav-tabs-active-link-hover-color;
background-color: $nav-tabs-active-link-hover-bg;
border-color: $nav-tabs-active-link-hover-border-color $nav-tabs-active-link-hover-border-color transparent;
}
.nav-item.show .nav-link {
color: $nav-tabs-link-active-color;
background-color: $nav-tabs-link-active-bg;
border-color: $nav-tabs-link-active-border-color;
}
.dropdown-menu {
@ -103,50 +72,42 @@
//
.nav-pills {
@include clearfix();
.nav-item {
float: left;
+ .nav-item {
margin-left: $nav-item-margin;
}
}
.nav-link {
display: block;
padding: $nav-link-padding;
@include border-radius($nav-pills-border-radius);
}
.nav-link.active,
.nav-item.open .nav-link {
@include plain-hover-focus {
color: $nav-pills-active-link-color;
cursor: default;
background-color: $nav-pills-active-link-bg;
}
.show > .nav-link {
color: $nav-pills-link-active-color;
background-color: $nav-pills-link-active-bg;
}
}
.nav-stacked {
.nav-item {
display: block;
float: none;
+ .nav-item {
margin-top: $nav-item-margin;
margin-left: 0;
//
// Justified variants
//
.nav-fill {
.nav-item {
flex: 1 1 auto;
text-align: center;
}
}
.nav-justified {
.nav-item {
flex-basis: 0;
flex-grow: 1;
text-align: center;
}
}
//
// Tabbable tabs
//
// Hide tabbable panes to start, show them when `.active`
.tab-content {
> .tab-pane {
display: none;

325
scss/bootstrap/_navbar.scss

@ -1,146 +1,211 @@
// Wrapper and base class
// Contents
//
// Navbar
// Navbar brand
// Navbar nav
// Navbar text
// Navbar divider
// Responsive navbar
// Navbar position
// Navbar themes
// Navbar
//
// Provide a static navbar from which we expand to create full-width, fixed, and
// other navbar variations.
.navbar {
position: relative;
display: flex;
flex-wrap: wrap; // allow us to do the line break for collapsing content
align-items: center;
justify-content: space-between; // space out brand from logo
padding: $navbar-padding-y $navbar-padding-x;
@include clearfix;
@include media-breakpoint-up(sm) {
@include border-radius($navbar-border-radius);
// Because flex properties aren't inherited, we need to redeclare these first
// few properities so that content nested within behave properly.
> .container,
> .container-fluid {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
}
}
// Navbar alignment options
// Navbar brand
//
// Display the navbar across the entirety of the page or fixed it to the top or
// bottom of the page.
// Used for brand, project, or site names.
// A static, full width modifier with no rounded corners.
.navbar-full {
z-index: $zindex-navbar;
.navbar-brand {
display: inline-block;
padding-top: $navbar-brand-padding-y;
padding-bottom: $navbar-brand-padding-y;
margin-right: $navbar-padding-x;
font-size: $navbar-brand-font-size;
line-height: inherit;
white-space: nowrap;
@include media-breakpoint-up(sm) {
@include border-radius(0);
@include hover-focus {
text-decoration: none;
}
}
// Fix the top/bottom navbars when screen real estate supports it
.navbar-fixed-top,
.navbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
z-index: $zindex-navbar-fixed;
// Undo the rounded corners
@include media-breakpoint-up(sm) {
@include border-radius(0);
}
}
// Navbar nav
//
// Custom navbar navigation (doesn't require `.nav`, but does make use of `.nav-link`).
.navbar-fixed-top {
top: 0;
}
.navbar-nav {
display: flex;
flex-direction: column; // cannot use `inherit` to get the `.navbar`s value
padding-left: 0;
margin-bottom: 0;
list-style: none;
.navbar-fixed-bottom {
bottom: 0;
.nav-link {
padding-right: 0;
padding-left: 0;
}
.navbar-sticky-top {
position: sticky;
top: 0;
z-index: $zindex-navbar-sticky;
width: 100%;
// Undo the rounded corners
@include media-breakpoint-up(sm) {
@include border-radius(0);
.dropdown-menu {
position: static;
float: none;
}
}
// Navbar text
//
// Brand/project name
//
.navbar-brand {
float: left;
padding-top: $navbar-brand-padding-y;
padding-bottom: $navbar-brand-padding-y;
margin-right: 1rem;
font-size: $font-size-lg;
.navbar-text {
display: inline-block;
padding-top: $nav-link-padding-y;
padding-bottom: $nav-link-padding-y;
}
// Responsive navbar
//
// Custom styles for responsive collapsing and toggling of navbar contents.
// Powered by the collapse Bootstrap JavaScript plugin.
// When collapsed, prevent the toggleable navbar contents from appearing in
// the default flexbox row orienation. Requires the use of `flex-wrap: wrap`
// on the `.navbar` parent.
.navbar-collapse {
flex-basis: 100%;
flex-grow: 1;
// For always expanded or extra full navbars, ensure content aligns itself
// properly vertically. Can be easily overridden with flex utilities.
align-items: center;
}
// Button for toggling the navbar when in its collapsed state
.navbar-toggler {
padding: $navbar-toggler-padding-y $navbar-toggler-padding-x;
font-size: $navbar-toggler-font-size;
line-height: 1;
background-color: transparent; // remove default button style
border: $border-width solid transparent; // remove default button style
@include border-radius($navbar-toggler-border-radius);
@include hover-focus {
text-decoration: none;
}
> img {
display: block;
// Opinionated: add "hand" cursor to non-disabled .navbar-toggler elements
&:not(:disabled):not(.disabled) {
cursor: pointer;
}
}
// Keep as a separate element so folks can easily override it with another icon
// or image file as needed.
.navbar-toggler-icon {
display: inline-block;
width: 1.5em;
height: 1.5em;
vertical-align: middle;
content: "";
background: no-repeat center center;
background-size: 100% 100%;
}
.navbar-divider {
float: left;
width: $border-width;
padding-top: .425rem;
padding-bottom: .425rem;
margin-right: $navbar-padding-x;
margin-left: $navbar-padding-x;
overflow: hidden;
// Generate series of `.navbar-expand-*` responsive classes for configuring
// where your navbar collapses.
.navbar-expand {
@each $breakpoint in map-keys($grid-breakpoints) {
$next: breakpoint-next($breakpoint, $grid-breakpoints);
$infix: breakpoint-infix($next, $grid-breakpoints);
&::before {
content: "\00a0";
&#{$infix} {
@include media-breakpoint-down($breakpoint) {
> .container,
> .container-fluid {
padding-right: 0;
padding-left: 0;
}
}
@include media-breakpoint-up($next) {
flex-flow: row nowrap;
justify-content: flex-start;
// Navbar toggle
//
// Custom button for toggling the `.navbar-collapse`, powered by the collapse
// Bootstrap JavaScript plugin.
.navbar-toggler {
padding: .5rem .75rem;
font-size: $font-size-lg;
line-height: 1;
background: none;
border: $border-width solid transparent;
@include border-radius($btn-border-radius);
.navbar-nav {
flex-direction: row;
@include hover-focus {
text-decoration: none;
.dropdown-menu {
position: absolute;
}
.dropdown-menu-right {
right: 0;
left: auto; // Reset the default from `.dropdown-menu`
}
// Navigation
//
// Custom navbar navigation built on the base `.nav` styles.
.nav-link {
padding-right: $navbar-nav-link-padding-x;
padding-left: $navbar-nav-link-padding-x;
}
}
.navbar-nav {
.nav-item {
float: left;
// For nesting containers, have to redeclare for alignment purposes
> .container,
> .container-fluid {
flex-wrap: nowrap;
}
.nav-link {
display: block;
padding-top: .425rem;
padding-bottom: .425rem;
.navbar-collapse {
display: flex !important; // stylelint-disable-line declaration-no-important
+ .nav-link {
margin-left: 1rem;
// Changes flex-bases to auto because of an IE10 bug
flex-basis: auto;
}
.navbar-toggler {
display: none;
}
.nav-item + .nav-item {
margin-left: 1rem;
.dropup {
.dropdown-menu {
top: auto;
bottom: 100%;
}
}
}
}
}
}
// Navbar themes
//
// Styles for switching between navbars with light or dark background.
// Dark links against a light background
.navbar-light {
.navbar-brand {
@ -158,20 +223,38 @@
@include hover-focus {
color: $navbar-light-hover-color;
}
&.disabled {
color: $navbar-light-disabled-color;
}
}
.open > .nav-link,
.show > .nav-link,
.active > .nav-link,
.nav-link.open,
.nav-link.show,
.nav-link.active {
@include plain-hover-focus {
color: $navbar-light-active-color;
}
}
.navbar-toggler {
color: $navbar-light-color;
border-color: $navbar-light-toggler-border-color;
}
.navbar-toggler-icon {
background-image: $navbar-light-toggler-icon-bg;
}
.navbar-divider {
background-color: rgba(0,0,0,.075);
.navbar-text {
color: $navbar-light-color;
a {
color: $navbar-light-active-color;
@include hover-focus {
color: $navbar-light-active-color;
}
}
}
}
@ -192,65 +275,37 @@
@include hover-focus {
color: $navbar-dark-hover-color;
}
&.disabled {
color: $navbar-dark-disabled-color;
}
}
.open > .nav-link,
.show > .nav-link,
.active > .nav-link,
.nav-link.open,
.nav-link.show,
.nav-link.active {
@include plain-hover-focus {
color: $navbar-dark-active-color;
}
}
}
.navbar-divider {
background-color: rgba(255,255,255,.075);
}
.navbar-toggler {
color: $navbar-dark-color;
border-color: $navbar-dark-toggler-border-color;
}
// Navbar toggleable
//
// Custom override for collapse plugin in navbar.
.navbar-toggleable {
&-xs {
@include clearfix;
@include media-breakpoint-down(xs) {
.navbar-nav .nav-item {
float: none;
margin-left: 0;
}
}
@include media-breakpoint-up(sm) {
display: block !important;
}
.navbar-toggler-icon {
background-image: $navbar-dark-toggler-icon-bg;
}
&-sm {
@include clearfix;
@include media-breakpoint-down(sm) {
.navbar-nav .nav-item {
float: none;
margin-left: 0;
}
}
@include media-breakpoint-up(md) {
display: block !important;
}
}
.navbar-text {
color: $navbar-dark-color;
a {
color: $navbar-dark-active-color;
&-md {
@include clearfix;
@include media-breakpoint-down(md) {
.navbar-nav .nav-item {
float: none;
margin-left: 0;
}
@include hover-focus {
color: $navbar-dark-active-color;
}
@include media-breakpoint-up(lg) {
display: block !important;
}
}
}

68
scss/bootstrap/_pagination.scss

@ -1,14 +1,39 @@
.pagination {
display: inline-block;
padding-left: 0;
margin-top: $spacer-y;
margin-bottom: $spacer-y;
display: flex;
@include list-unstyled();
@include border-radius();
}
.page-item {
display: inline; // Remove list-style and block-level defaults
.page-link {
position: relative;
display: block;
padding: $pagination-padding-y $pagination-padding-x;
margin-left: -$pagination-border-width;
line-height: $pagination-line-height;
color: $pagination-color;
background-color: $pagination-bg;
border: $pagination-border-width solid $pagination-border-color;
&:hover {
color: $pagination-hover-color;
text-decoration: none;
background-color: $pagination-hover-bg;
border-color: $pagination-hover-border-color;
}
&:focus {
z-index: 2;
outline: 0;
box-shadow: $pagination-focus-box-shadow;
}
// Opinionated: add "hand" cursor to non-disabled .page-link elements
&:not(:disabled):not(.disabled) {
cursor: pointer;
}
}
.page-item {
&:first-child {
.page-link {
margin-left: 0;
@ -22,40 +47,19 @@
}
&.active .page-link {
@include plain-hover-focus {
z-index: 2;
z-index: 1;
color: $pagination-active-color;
cursor: default;
background-color: $pagination-active-bg;
border-color: $pagination-active-border;
}
border-color: $pagination-active-border-color;
}
&.disabled .page-link {
@include plain-hover-focus {
color: $pagination-disabled-color;
pointer-events: none;
cursor: $cursor-disabled;
// Opinionated: remove the "hand" cursor set previously for .page-link
cursor: auto;
background-color: $pagination-disabled-bg;
border-color: $pagination-disabled-border;
}
}
}
.page-link {
position: relative;
float: left; // Collapse white-space
padding: $pagination-padding-y $pagination-padding-x;
margin-left: -1px;
color: $pagination-color;
text-decoration: none;
background-color: $pagination-bg;
border: $pagination-border-width solid $pagination-border-color;
@include hover-focus {
color: $pagination-hover-color;
background-color: $pagination-hover-bg;
border-color: $pagination-hover-border;
border-color: $pagination-disabled-border-color;
}
}

214
scss/bootstrap/_popover.scss

@ -6,144 +6,180 @@
z-index: $zindex-popover;
display: block;
max-width: $popover-max-width;
padding: $popover-inner-padding;
// Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.
// So reset our font and text properties to avoid inheriting weird values.
@include reset-text();
font-size: $font-size-sm;
font-size: $popover-font-size;
// Allow breaking very long words so they don't overflow the popover's bounds
word-wrap: break-word;
background-color: $popover-bg;
background-clip: padding-box;
border: $popover-border-width solid $popover-border-color;
@include border-radius($border-radius-lg);
@include border-radius($popover-border-radius);
@include box-shadow($popover-box-shadow);
.arrow {
position: absolute;
display: block;
width: $popover-arrow-width;
height: $popover-arrow-height;
margin: 0 $border-radius-lg;
// Popover directions
&::before,
&::after {
position: absolute;
display: block;
content: "";
border-color: transparent;
border-style: solid;
}
}
}
&.popover-top,
&.bs-tether-element-attached-bottom {
margin-top: -$popover-arrow-width;
.bs-popover-top {
margin-bottom: $popover-arrow-height;
.popover-arrow {
bottom: -$popover-arrow-outer-width;
left: 50%;
margin-left: -$popover-arrow-outer-width;
.arrow {
bottom: calc((#{$popover-arrow-height} + #{$popover-border-width}) * -1);
}
.arrow::before,
.arrow::after {
border-width: $popover-arrow-height ($popover-arrow-width / 2) 0;
}
.arrow::before {
bottom: 0;
border-top-color: $popover-arrow-outer-color;
border-bottom-width: 0;
&::after {
bottom: 1px;
margin-left: -$popover-arrow-width;
content: "";
}
.arrow::after {
bottom: $popover-border-width;
border-top-color: $popover-arrow-color;
border-bottom-width: 0;
}
}
.bs-popover-right {
margin-left: $popover-arrow-height;
.arrow {
left: calc((#{$popover-arrow-height} + #{$popover-border-width}) * -1);
width: $popover-arrow-height;
height: $popover-arrow-width;
margin: $border-radius-lg 0; // make sure the arrow does not touch the popover's rounded corners
}
&.popover-right,
&.bs-tether-element-attached-left {
margin-left: $popover-arrow-width;
.arrow::before,
.arrow::after {
border-width: ($popover-arrow-width / 2) $popover-arrow-height ($popover-arrow-width / 2) 0;
}
.popover-arrow {
top: 50%;
left: -$popover-arrow-outer-width;
margin-top: -$popover-arrow-outer-width;
.arrow::before {
left: 0;
border-right-color: $popover-arrow-outer-color;
border-left-width: 0;
&::after {
bottom: -$popover-arrow-width;
left: 1px;
content: "";
}
.arrow::after {
left: $popover-border-width;
border-right-color: $popover-arrow-color;
border-left-width: 0;
}
}
.bs-popover-bottom {
margin-top: $popover-arrow-height;
.arrow {
top: calc((#{$popover-arrow-height} + #{$popover-border-width}) * -1);
}
&.popover-bottom,
&.bs-tether-element-attached-top {
margin-top: $popover-arrow-width;
.arrow::before,
.arrow::after {
border-width: 0 ($popover-arrow-width / 2) $popover-arrow-height ($popover-arrow-width / 2);
}
.popover-arrow {
top: -$popover-arrow-outer-width;
left: 50%;
margin-left: -$popover-arrow-outer-width;
border-top-width: 0;
.arrow::before {
top: 0;
border-bottom-color: $popover-arrow-outer-color;
&::after {
top: 1px;
margin-left: -$popover-arrow-width;
content: "";
border-top-width: 0;
}
.arrow::after {
top: $popover-border-width;
border-bottom-color: $popover-arrow-color;
}
// This will remove the popover-header's border just below the arrow
.popover-header::before {
position: absolute;
top: 0;
left: 50%;
display: block;
width: $popover-arrow-width;
margin-left: ($popover-arrow-width / -2);
content: "";
border-bottom: $popover-border-width solid $popover-header-bg;
}
}
&.popover-left,
&.bs-tether-element-attached-right {
margin-left: -$popover-arrow-width;
.bs-popover-left {
margin-right: $popover-arrow-height;
.popover-arrow {
top: 50%;
right: -$popover-arrow-outer-width;
margin-top: -$popover-arrow-outer-width;
border-right-width: 0;
.arrow {
right: calc((#{$popover-arrow-height} + #{$popover-border-width}) * -1);
width: $popover-arrow-height;
height: $popover-arrow-width;
margin: $border-radius-lg 0; // make sure the arrow does not touch the popover's rounded corners
}
.arrow::before,
.arrow::after {
border-width: ($popover-arrow-width / 2) 0 ($popover-arrow-width / 2) $popover-arrow-height;
}
.arrow::before {
right: 0;
border-left-color: $popover-arrow-outer-color;
&::after {
right: 1px;
bottom: -$popover-arrow-width;
content: "";
border-right-width: 0;
}
.arrow::after {
right: $popover-border-width;
border-left-color: $popover-arrow-color;
}
}
.bs-popover-auto {
&[x-placement^="top"] {
@extend .bs-popover-top;
}
&[x-placement^="right"] {
@extend .bs-popover-right;
}
&[x-placement^="bottom"] {
@extend .bs-popover-bottom;
}
&[x-placement^="left"] {
@extend .bs-popover-left;
}
}
// Offset the popover to account for the popover arrow
.popover-title {
padding: $popover-title-padding-y $popover-title-padding-x;
margin: 0; // reset heading margin
.popover-header {
padding: $popover-header-padding-y $popover-header-padding-x;
margin-bottom: 0; // Reset the default from Reboot
font-size: $font-size-base;
background-color: $popover-title-bg;
border-bottom: $popover-border-width solid darken($popover-title-bg, 5%);
$offset-border-width: ($border-width / $font-size-root);
@include border-radius(($border-radius-lg - $offset-border-width) ($border-radius-lg - $offset-border-width) 0 0);
color: $popover-header-color;
background-color: $popover-header-bg;
border-bottom: $popover-border-width solid darken($popover-header-bg, 5%);
$offset-border-width: calc(#{$border-radius-lg} - #{$popover-border-width});
@include border-top-radius($offset-border-width);
&:empty {
display: none;
}
}
.popover-content {
padding: $popover-content-padding-y $popover-content-padding-x;
}
// Arrows
//
// .popover-arrow is outer, .popover-arrow::after is inner
.popover-arrow {
&,
&::after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
}
.popover-arrow {
border-width: $popover-arrow-outer-width;
.popover-body {
padding: $popover-body-padding-y $popover-body-padding-x;
color: $popover-body-color;
}
/* rtl:end:ignore */
.popover-arrow::after {
content: "";
border-width: $popover-arrow-width;
}

38
scss/bootstrap/_print.scss

@ -1,4 +1,4 @@
// scss-lint:disable QualifyingElement
// stylelint-disable declaration-no-important, selector-no-qualifying-type
// Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css
@ -12,21 +12,19 @@
@media print {
*,
*::before,
*::after,
*::first-letter,
*::first-line {
*::after {
// Bootstrap specific; comment out `color` and `background`
//color: #000 !important; // Black prints faster:
// http://www.sanbeiji.com/archives/953
//color: #000 !important; // Black prints faster: http://www.sanbeiji.com/archives/953
text-shadow: none !important;
//background: transparent !important;
box-shadow: none !important;
}
a,
a:visited {
a {
&:not(.btn) {
text-decoration: underline;
}
}
// Bootstrap specific; comment the following selector out
//a[href]::after {
@ -48,6 +46,9 @@
// content: "";
//}
pre {
white-space: pre-wrap !important;
}
pre,
blockquote {
border: $border-width solid #999; // Bootstrap custom code; using `$border-width` instead of 1px
@ -82,17 +83,24 @@
// Bootstrap specific changes start
// Specify a size and min-width to make printing closer across browsers.
// We don't set margin here because it breaks `size` in Chrome. We also
// don't use `!important` on `size` as it breaks in Chrome.
@page {
size: $print-page-size;
}
body {
min-width: $print-body-min-width !important;
}
.container {
min-width: $print-body-min-width !important;
}
// Bootstrap components
.navbar {
display: none;
}
.btn,
.dropup > .btn {
> .caret {
border-top-color: #000 !important;
}
}
.tag {
.badge {
border: $border-width solid #000;
}

142
scss/bootstrap/_progress.scss

@ -1,145 +1,33 @@
//
// Progress animations
//
@keyframes progress-bar-stripes {
from { background-position: $spacer-y 0; }
from { background-position: $progress-height 0; }
to { background-position: 0 0; }
}
//
// Basic progress bar
//
.progress {
display: block;
width: 100%;
height: $spacer-y; // todo: make a new var for this
margin-bottom: $spacer-y;
}
.progress[value] {
// Set overall background
background-color: $progress-bg;
// Remove Firefox and Opera border
border: 0;
// Reset the default appearance
appearance: none;
// Set overall border radius
@include border-radius($progress-border-radius);
}
// Filled-in portion of the bar
.progress[value]::-ms-fill {
background-color: $progress-bar-color;
// Remove right-hand border of value bar from IE10+/Edge
border: 0;
}
.progress[value]::-moz-progress-bar {
background-color: $progress-bar-color;
@include border-left-radius($progress-border-radius);
}
.progress[value]::-webkit-progress-value {
background-color: $progress-bar-color;
@include border-left-radius($progress-border-radius);
}
// Tweaks for full progress bar
.progress[value="100"]::-moz-progress-bar {
@include border-right-radius($progress-border-radius);
}
.progress[value="100"]::-webkit-progress-value {
@include border-right-radius($progress-border-radius);
}
// Unfilled portion of the bar
.progress[value]::-webkit-progress-bar {
background-color: $progress-bg;
@include border-radius($progress-border-radius);
@include box-shadow($progress-box-shadow);
}
base::-moz-progress-bar, // Absurd-but-syntactically-valid selector to make these styles Firefox-only
.progress[value] {
display: flex;
height: $progress-height;
overflow: hidden; // force rounded corners by cropping it
font-size: $progress-font-size;
background-color: $progress-bg;
@include border-radius($progress-border-radius);
@include box-shadow($progress-box-shadow);
}
// IE9 hacks to accompany custom markup. We don't need to scope this via media queries, but I feel better doing it anyway.
@media screen and (min-width:0\0) {
.progress {
background-color: $progress-bg;
@include border-radius($progress-border-radius);
@include box-shadow($progress-box-shadow);
}
.progress-bar {
display: inline-block;
height: $spacer-y;
text-indent: -999rem; // Simulate hiding of value as in native `<progress>`
background-color: $progress-bar-color;
@include border-left-radius($progress-border-radius);
display: flex;
flex-direction: column;
justify-content: center;
color: $progress-bar-color;
text-align: center;
background-color: $progress-bar-bg;
@include transition($progress-bar-transition);
}
.progress[width="100%"] {
@include border-right-radius($progress-border-radius);
}
}
//
// Striped
//
.progress-striped[value]::-webkit-progress-value {
@include gradient-striped();
background-size: $spacer-y $spacer-y;
}
.progress-striped[value]::-moz-progress-bar {
@include gradient-striped();
background-size: $spacer-y $spacer-y;
}
.progress-striped[value]::-ms-fill {
@include gradient-striped();
background-size: $spacer-y $spacer-y;
}
// IE9
@media screen and (min-width:0\0) {
.progress-bar-striped {
@include gradient-striped();
background-size: $spacer-y $spacer-y;
}
background-size: $progress-height $progress-height;
}
//
// Animated
//
.progress-animated[value]::-webkit-progress-value {
animation: progress-bar-stripes 2s linear infinite;
}
.progress-animated[value]::-moz-progress-bar {
animation: progress-bar-stripes 2s linear infinite;
}
// IE9
@media screen and (min-width:0\0) {
.progress-animated .progress-bar-striped {
animation: progress-bar-stripes 2s linear infinite;
}
}
//
// Variations
//
.progress-success {
@include progress-variant($progress-bar-success-bg);
}
.progress-info {
@include progress-variant($progress-bar-info-bg);
}
.progress-warning {
@include progress-variant($progress-bar-warning-bg);
}
.progress-danger {
@include progress-variant($progress-bar-danger-bg);
.progress-bar-animated {
animation: progress-bar-stripes $progress-bar-animation-timing;
}

367
scss/bootstrap/_reboot.scss

@ -1,82 +1,68 @@
// scss-lint:disable QualifyingElement, DuplicateProperty
// stylelint-disable at-rule-no-vendor-prefix, declaration-no-important, selector-no-qualifying-type, property-no-vendor-prefix
// Reboot
//
// Global resets to common HTML elements and more for easier usage by Bootstrap.
// Adds additional rules on top of Normalize.css, including several overrides.
// Normalization of HTML elements, manually forked from Normalize.css to remove
// styles targeting irrelevant browsers while applying new styles.
//
// Normalize is licensed MIT. https://github.com/necolas/normalize.css
// Reset the box-sizing
//
// Change from `box-sizing: content-box` to `border-box` so that when you add
// `padding` or `border`s to an element, the overall declared `width` does not
// change. For example, `width: 100px;` will always be `100px` despite the
// `border: 10px solid red;` and `padding: 20px;`.
// Document
//
// Heads up! This reset may cause conflicts with some third-party widgets. For
// recommendations on resolving such conflicts, see
// http://getbootstrap.com/getting-started/#third-box-sizing.
//
// Credit: https://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/
html {
box-sizing: border-box;
}
// 1. Change from `box-sizing: content-box` so that `width` is not affected by `padding` or `border`.
// 2. Change the default font family in all browsers.
// 3. Correct the line height in all browsers.
// 4. Prevent adjustments of font size after orientation changes in IE on Windows Phone and in iOS.
// 5. Setting @viewport causes scrollbars to overlap content in IE11 and Edge, so
// we force a non-overlapping, non-auto-hiding scrollbar to counteract.
// 6. Change the default tap highlight to be completely transparent in iOS.
*,
*::before,
*::after {
box-sizing: inherit;
box-sizing: border-box; // 1
}
html {
font-family: sans-serif; // 2
line-height: 1.15; // 3
-webkit-text-size-adjust: 100%; // 4
-ms-text-size-adjust: 100%; // 4
-ms-overflow-style: scrollbar; // 5
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); // 6
}
// Make viewport responsive
//
// @viewport is needed because IE 10+ doesn't honor <meta name="viewport"> in
// some cases. See http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/.
// Eventually @viewport will replace <meta name="viewport">.
//
// However, `device-width` is broken on IE 10 on Windows (Phone) 8,
// (see http://timkadlec.com/2013/01/windows-phone-8-and-device-width/ and https://github.com/twbs/bootstrap/issues/10497)
// and the fix for that involves a snippet of JavaScript to sniff the user agent
// and apply some conditional CSS.
//
// See http://getbootstrap.com/getting-started/#support-ie10-width for the relevant hack.
//
// Wrap `@viewport` with `@at-root` for when folks do a nested import (e.g.,
// `.class-name { @import "bootstrap"; }`).
// IE10+ doesn't honor `<meta name="viewport">` in some cases.
@at-root {
@-ms-viewport { width: device-width; }
@-ms-viewport {
width: device-width;
}
}
// stylelint-disable selector-list-comma-newline-after
// Shim for "new" HTML5 structural elements to display correctly (IE10, older browsers)
article, aside, dialog, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block;
}
// stylelint-enable selector-list-comma-newline-after
// Body
//
// Reset HTML, body, and more
//
html {
// Sets a specific default `font-size` for user with `rem` type scales.
font-size: $font-size-root;
// As a side-effect of setting the @viewport above,
// IE11 & Edge make the scrollbar overlap the content and automatically hide itself when not in use.
// Unfortunately, the auto-showing of the scrollbar is sometimes too sensitive,
// thus making it hard to click on stuff near the right edge of the page.
// So we add this style to force IE11 & Edge to use a "normal", non-overlapping, non-auto-hiding scrollbar.
// See https://github.com/twbs/bootstrap/issues/18543
-ms-overflow-style: scrollbar;
// Changes the default tap highlight to be completely transparent in iOS.
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
// 1. Remove the margin in all browsers.
// 2. As a best practice, apply a default `background-color`.
// 3. Set an explicit initial text-align value so that we can later use the
// the `inherit` value on things like `<th>` elements.
body {
// Make the `body` use the `font-size-root`
margin: 0; // 1
font-family: $font-family-base;
font-size: $font-size-base;
font-weight: $font-weight-base;
line-height: $line-height-base;
// Go easy on the eyes and use something other than `#000` for text
color: $body-color;
// By default, `<body>` has no `background-color` so we set one as a best practice.
background-color: $body-bg;
text-align: left; // 3
background-color: $body-bg; // 2
}
// Suppress the focus outline on elements that cannot be accessed via keyboard.
@ -85,7 +71,19 @@ body {
//
// Credit: https://github.com/suitcss/base
[tabindex="-1"]:focus {
outline: none !important;
outline: 0 !important;
}
// Content grouping
//
// 1. Add the correct box sizing in Firefox.
// 2. Show the overflow in Edge and IE.
hr {
box-sizing: content-box; // 1
height: 0; // 1
overflow: visible; // 2
}
@ -97,10 +95,12 @@ body {
//
// By default, `<h1>`-`<h6>` all receive top and bottom margins. We nuke the top
// margin for easier control within type scales as it avoids margin collapsing.
// stylelint-disable selector-list-comma-newline-after
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: .5rem;
margin-bottom: $headings-margin-bottom;
}
// stylelint-enable selector-list-comma-newline-after
// Reset margins on paragraphs
//
@ -108,15 +108,22 @@ h1, h2, h3, h4, h5, h6 {
// bottom margin to use `rem` units instead of `em`.
p {
margin-top: 0;
margin-bottom: 1rem;
margin-bottom: $paragraph-margin-bottom;
}
// Abbreviations and acronyms
// Abbreviations
//
// 1. Remove the bottom border in Firefox 39-.
// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
// 3. Add explicit cursor to indicate changed behavior.
// 4. Duplicate behavior to the data-* attribute for our tooltip plugin
abbr[title],
// Add data-* attribute to help out our tooltip plugin, per https://github.com/twbs/bootstrap/issues/5257
abbr[data-original-title] {
cursor: help;
border-bottom: 1px dotted $abbr-border-color;
abbr[data-original-title] { // 4
text-decoration: underline; // 2
text-decoration: underline dotted; // 2
cursor: help; // 3
border-bottom: 0; // 1
}
address {
@ -152,6 +159,37 @@ blockquote {
margin: 0 0 1rem;
}
dfn {
font-style: italic; // Add the correct font style in Android 4.3-
}
// stylelint-disable font-weight-notation
b,
strong {
font-weight: bolder; // Add the correct font weight in Chrome, Edge, and Safari
}
// stylelint-enable font-weight-notation
small {
font-size: 80%; // Add the correct font size in all browsers
}
//
// Prevent `sub` and `sup` elements from affecting the line height in
// all browsers.
//
sub,
sup {
position: relative;
font-size: 75%;
line-height: 0;
vertical-align: baseline;
}
sub { bottom: -.25em; }
sup { top: -.5em; }
//
// Links
@ -160,15 +198,13 @@ blockquote {
a {
color: $link-color;
text-decoration: $link-decoration;
background-color: transparent; // Remove the gray background on active links in IE 10.
-webkit-text-decoration-skip: objects; // Remove gaps in links underline in iOS 8+ and Safari 8+.
@include hover-focus {
@include hover {
color: $link-hover-color;
text-decoration: $link-hover-decoration;
}
&:focus {
@include tab-focus();
}
}
// And undo these styles for placeholder links/named anchors (without href)
@ -187,7 +223,7 @@ a:not([href]):not([tabindex]) {
}
&:focus {
outline: none;
outline: 0;
}
}
@ -196,13 +232,26 @@ a:not([href]):not([tabindex]) {
// Code
//
// stylelint-disable font-family-no-duplicate-names
pre,
code,
kbd,
samp {
font-family: monospace, monospace; // Correct the inheritance and scaling of font size in all browsers.
font-size: 1em; // Correct the odd `em` font sizing in all browsers.
}
// stylelint-enable font-family-no-duplicate-names
pre {
// Remove browser default top margin
margin-top: 0;
// Reset browser default of `1em` to use `rem`s
margin-bottom: 1rem;
// Normalize v4 removed this property, causing `<pre>` content to break out of wrapping code snippets
// Don't allow content to break outside
overflow: auto;
// We have @viewport set which causes scrollbars to overlap content in IE11 and Edge, so
// we force a non-overlapping, non-auto-hiding scrollbar to counteract.
-ms-overflow-style: scrollbar;
}
@ -211,56 +260,22 @@ pre {
//
figure {
// Normalize adds `margin` to `figure`s as browsers apply it inconsistently.
// We reset that to create a better flow in-page.
// Apply a consistent margin strategy (matches our type styles).
margin: 0 0 1rem;
}
//
// Images
// Images and content
//
img {
// By default, `<img>`s are `inline-block`. This assumes that, and vertically
// centers them. This won't apply should you reset them to `block` level.
vertical-align: middle;
// Note: `<img>`s are deliberately not made responsive by default.
// For the rationale behind this, see the comments on the `.img-fluid` class.
}
// iOS "clickable elements" fix for role="button"
//
// Fixes "clickability" issue (and more generally, the firing of events such as focus as well)
// for traditionally non-focusable elements with role="button"
// see https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile
[role="button"] {
cursor: pointer;
border-style: none; // Remove the border on images inside links in IE 10-.
}
// Avoid 300ms click delay on touch devices that support the `touch-action` CSS property.
//
// In particular, unlike most other browsers, IE11+Edge on Windows 10 on touch devices and IE Mobile 10-11
// DON'T remove the click delay when `<meta name="viewport" content="width=device-width">` is present.
// However, they DO support removing the click delay via `touch-action: manipulation`.
// See:
// * http://v4-alpha.getbootstrap.com/content/reboot/#click-delay-optimization-for-touch
// * http://caniuse.com/#feat=css-touch-action
// * http://patrickhlauke.github.io/touch/tests/results/#suppressing-300ms-delay
a,
area,
button,
[role="button"],
input,
label,
select,
summary,
textarea {
touch-action: manipulation;
svg:not(:root) {
overflow: hidden; // Hide the overflow in IE
}
@ -269,10 +284,7 @@ textarea {
//
table {
// No longer part of Normalize since v4
border-collapse: collapse;
// Reset for nesting within parents with `background-color`.
background-color: $table-bg;
border-collapse: collapse; // Prevent double borders
}
caption {
@ -284,8 +296,9 @@ caption {
}
th {
// Centered by default, but left-align-ed to match the `td`s below.
text-align: left;
// Matches default `<td>` alignment by inheriting from the `<body>`, or the
// closest parent with a set `text-align`.
text-align: inherit;
}
@ -299,6 +312,13 @@ label {
margin-bottom: .5rem;
}
// Remove the default `border-radius` that macOS Chrome adds.
//
// Details at https://github.com/twbs/bootstrap/issues/24093
button {
border-radius: 0;
}
// Work around a Firefox/IE bug where the transparent `button` background
// results in a loss of the default `button` focus styles.
//
@ -311,25 +331,47 @@ button:focus {
input,
button,
select,
optgroup,
textarea {
// Remove all `margin`s so our classes don't have to do it themselves.
margin: 0;
// Normalize includes `font: inherit;`, so `font-family`. `font-size`, etc are
// properly inherited. However, `line-height` isn't addressed there. Using this
// ensures we don't need to unnecessarily redeclare the global font stack.
margin: 0; // Remove the margin in Firefox and Safari
font-family: inherit;
font-size: inherit;
line-height: inherit;
// iOS adds rounded borders by default
border-radius: 0;
}
button,
input {
overflow: visible; // Show the overflow in Edge
}
button,
select {
text-transform: none; // Remove the inheritance of text transform in Firefox
}
// 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
// controls in Android 4.
// 2. Correct the inability to style clickable types in iOS and Safari.
button,
html [type="button"], // 1
[type="reset"],
[type="submit"] {
-webkit-appearance: button; // 2
}
// Remove inner border and padding from Firefox, but don't restore the outline like Normalize.
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
padding: 0;
border-style: none;
}
input[type="radio"],
input[type="checkbox"] {
// Apply a disabled cursor for radios and checkboxes.
//
// Note: Neither radios nor checkboxes can be readonly.
&:disabled {
cursor: $cursor-disabled;
}
box-sizing: border-box; // 1. Add the correct box sizing in IE 10-
padding: 0; // 2. Remove the padding in IE 10-
}
@ -340,20 +382,23 @@ input[type="month"] {
// Remove the default appearance of temporal inputs to avoid a Mobile Safari
// bug where setting a custom line-height prevents text from being vertically
// centered within the input.
//
// Bug report: https://github.com/twbs/bootstrap/issues/11266
// See https://bugs.webkit.org/show_bug.cgi?id=139848
// and https://github.com/twbs/bootstrap/issues/11266
-webkit-appearance: listbox;
}
textarea {
overflow: auto; // Remove the default vertical scrollbar in IE.
// Textareas should really only resize vertically so they don't break their (horizontal) containers.
resize: vertical;
}
fieldset {
// Chrome and Firefox set a `min-width: min-content;` on fieldsets,
// so we reset that to ensure it behaves more like a standard block element.
// See https://github.com/twbs/bootstrap/issues/12359.
// Browsers set a default `min-width: min-content;` on fieldsets,
// unlike e.g. `<div>`s, which have `min-width: 0;` by default.
// So we reset that to ensure fieldsets behave more like a standard block element.
// See https://github.com/twbs/bootstrap/issues/12359
// and https://html.spec.whatwg.org/multipage/#the-fieldset-and-legend-elements
min-width: 0;
// Reset the default outline behavior of fieldsets so they don't affect page layout.
padding: 0;
@ -361,33 +406,77 @@ fieldset {
border: 0;
}
// 1. Correct the text wrapping in Edge and IE.
// 2. Correct the color inheritance from `fieldset` elements in IE.
legend {
// Reset the entire legend element to match the `fieldset`
display: block;
width: 100%;
max-width: 100%; // 1
padding: 0;
margin-bottom: .5rem;
font-size: 1.5rem;
line-height: inherit;
color: inherit; // 2
white-space: normal; // 1
}
progress {
vertical-align: baseline; // Add the correct vertical alignment in Chrome, Firefox, and Opera.
}
// Correct the cursor style of increment and decrement buttons in Chrome.
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
input[type="search"] {
[type="search"] {
// This overrides the extra rounded corners on search inputs in iOS so that our
// `.form-control` class can properly style them. Note that this cannot simply
// be added to `.form-control` as it's not specific enough. For details, see
// https://github.com/twbs/bootstrap/issues/11586.
outline-offset: -2px; // 2. Correct the outline style in Safari.
-webkit-appearance: none;
}
//
// Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
//
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
// todo: needed?
//
// 1. Correct the inability to style clickable types in iOS and Safari.
// 2. Change font properties to `inherit` in Safari.
//
::-webkit-file-upload-button {
font: inherit; // 2
-webkit-appearance: button; // 1
}
//
// Correct element displays
//
output {
display: inline-block;
// font-size: $font-size-base;
// line-height: $line-height;
// color: $input-color;
}
summary {
display: list-item; // Add the correct display in all browsers
cursor: pointer;
}
template {
display: none; // Add the correct display in IE
}
// Always hide an element with the `hidden` HTML attribute (from PureCSS).
// Needed for proper display in IE 10-.
[hidden] {
display: none !important;
}

19
scss/bootstrap/_root.scss

@ -0,0 +1,19 @@
:root {
// Custom variable values only support SassScript inside `#{}`.
@each $color, $value in $colors {
--#{$color}: #{$value};
}
@each $color, $value in $theme-colors {
--#{$color}: #{$value};
}
@each $bp, $value in $grid-breakpoints {
--breakpoint-#{$bp}: #{$value};
}
// Use `inspect` for lists so that quoted items keep the quotes.
// See https://github.com/sass/sass/issues/2383#issuecomment-336349172
--font-family-sans-serif: #{inspect($font-family-sans-serif)};
--font-family-monospace: #{inspect($font-family-monospace)};
}

118
scss/bootstrap/_tables.scss

@ -6,6 +6,7 @@
width: 100%;
max-width: 100%;
margin-bottom: $spacer;
background-color: $table-bg; // Reset for nesting within parents with `background-color`.
th,
td {
@ -36,7 +37,7 @@
.table-sm {
th,
td {
padding: $table-sm-cell-padding;
padding: $table-cell-padding-sm;
}
}
@ -68,7 +69,7 @@
.table-striped {
tbody tr:nth-of-type(odd) {
background-color: $table-bg-accent;
background-color: $table-accent-bg;
}
}
@ -80,7 +81,7 @@
.table-hover {
tbody tr {
@include hover {
background-color: $table-bg-hover;
background-color: $table-hover-bg;
}
}
}
@ -91,106 +92,89 @@
// Exact selectors below required to override `.table-striped` and prevent
// inheritance to nested tables.
// Generate the contextual variants
@include table-row-variant(active, $table-bg-active);
@include table-row-variant(success, $state-success-bg);
@include table-row-variant(info, $state-info-bg);
@include table-row-variant(warning, $state-warning-bg);
@include table-row-variant(danger, $state-danger-bg);
@each $color, $value in $theme-colors {
@include table-row-variant($color, theme-color-level($color, -9));
}
@include table-row-variant(active, $table-active-bg);
// Inverse styles
// Dark styles
//
// Same table markup, but inverted color scheme: dark background and light text.
.thead-inverse {
// stylelint-disable-next-line no-duplicate-selectors
.table {
.thead-dark {
th {
color: #fff;
background-color: $gray-dark;
color: $table-dark-color;
background-color: $table-dark-bg;
border-color: $table-dark-border-color;
}
}
.thead-default {
.thead-light {
th {
color: $gray;
background-color: $gray-lighter;
color: $table-head-color;
background-color: $table-head-bg;
border-color: $table-border-color;
}
}
}
.table-inverse {
color: $gray-lighter;
background-color: $gray-dark;
.table-dark {
color: $table-dark-color;
background-color: $table-dark-bg;
th,
td,
thead th {
border-color: $gray;
border-color: $table-dark-border-color;
}
&.table-bordered {
border: 0;
}
&.table-striped {
tbody tr:nth-of-type(odd) {
background-color: $table-dark-accent-bg;
}
}
&.table-hover {
tbody tr {
@include hover {
background-color: $table-dark-hover-bg;
}
}
}
}
// Responsive tables
//
// Wrap your tables in `.table-responsive` and we'll make them mobile friendly
// by enabling horizontal scrolling. Only applies <768px. Everything above that
// will display normally.
// Generate series of `.table-responsive-*` classes for configuring the screen
// size of where your table will overflow.
.table-responsive {
@each $breakpoint in map-keys($grid-breakpoints) {
$next: breakpoint-next($breakpoint, $grid-breakpoints);
$infix: breakpoint-infix($next, $grid-breakpoints);
&#{$infix} {
@include media-breakpoint-down($breakpoint) {
display: block;
width: 100%;
min-height: .01%; // Workaround for IE9 bug (see https://github.com/twbs/bootstrap/issues/14837)
overflow-x: auto;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar; // See https://github.com/twbs/bootstrap/pull/10057
// TODO: find out if we need this still.
//
// border: $table-border-width solid $table-border-color;
// -ms-overflow-style: -ms-autohiding-scrollbar; // See https://github.com/twbs/bootstrap/pull/10057
}
.table-reflow {
thead {
float: left;
}
tbody {
display: block;
white-space: nowrap;
}
th,
td {
border-top: $table-border-width solid $table-border-color;
border-left: $table-border-width solid $table-border-color;
&:last-child {
border-right: $table-border-width solid $table-border-color;
}
}
thead,
tbody,
tfoot {
&:last-child {
tr:last-child th,
tr:last-child td {
border-bottom: $table-border-width solid $table-border-color;
}
// Prevent double border on horizontal scroll due to use of `display: block;`
> .table-bordered {
border: 0;
}
}
tr {
float: left;
th,
td {
display: block !important;
border: $table-border-width solid $table-border-color;
}
}
}

116
scss/bootstrap/_tooltip.scss

@ -3,70 +3,107 @@
position: absolute;
z-index: $zindex-tooltip;
display: block;
margin: $tooltip-margin;
// Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.
// So reset our font and text properties to avoid inheriting weird values.
@include reset-text();
font-size: $font-size-sm;
font-size: $tooltip-font-size;
// Allow breaking very long words so they don't overflow the tooltip's bounds
word-wrap: break-word;
opacity: 0;
&.in { opacity: $tooltip-opacity; }
&.show { opacity: $tooltip-opacity; }
&.tooltip-top,
&.bs-tether-element-attached-bottom {
padding: $tooltip-arrow-width 0;
margin-top: -$tooltip-margin;
.arrow {
position: absolute;
display: block;
width: $tooltip-arrow-width;
height: $tooltip-arrow-height;
&::before {
position: absolute;
content: "";
border-color: transparent;
border-style: solid;
}
}
}
.tooltip-arrow {
.bs-tooltip-top {
padding: $tooltip-arrow-height 0;
.arrow {
bottom: 0;
left: 50%;
margin-left: -$tooltip-arrow-width;
border-width: $tooltip-arrow-width $tooltip-arrow-width 0;
&::before {
top: 0;
border-width: $tooltip-arrow-height ($tooltip-arrow-width / 2) 0;
border-top-color: $tooltip-arrow-color;
}
}
&.tooltip-right,
&.bs-tether-element-attached-left {
padding: 0 $tooltip-arrow-width;
margin-left: $tooltip-margin;
}
.bs-tooltip-right {
padding: 0 $tooltip-arrow-height;
.tooltip-arrow {
top: 50%;
.arrow {
left: 0;
margin-top: -$tooltip-arrow-width;
border-width: $tooltip-arrow-width $tooltip-arrow-width $tooltip-arrow-width 0;
width: $tooltip-arrow-height;
height: $tooltip-arrow-width;
&::before {
right: 0;
border-width: ($tooltip-arrow-width / 2) $tooltip-arrow-height ($tooltip-arrow-width / 2) 0;
border-right-color: $tooltip-arrow-color;
}
}
&.tooltip-bottom,
&.bs-tether-element-attached-top {
padding: $tooltip-arrow-width 0;
margin-top: $tooltip-margin;
}
.bs-tooltip-bottom {
padding: $tooltip-arrow-height 0;
.tooltip-arrow {
.arrow {
top: 0;
left: 50%;
margin-left: -$tooltip-arrow-width;
border-width: 0 $tooltip-arrow-width $tooltip-arrow-width;
&::before {
bottom: 0;
border-width: 0 ($tooltip-arrow-width / 2) $tooltip-arrow-height;
border-bottom-color: $tooltip-arrow-color;
}
}
&.tooltip-left,
&.bs-tether-element-attached-right {
padding: 0 $tooltip-arrow-width;
margin-left: -$tooltip-margin;
}
.tooltip-arrow {
top: 50%;
.bs-tooltip-left {
padding: 0 $tooltip-arrow-height;
.arrow {
right: 0;
margin-top: -$tooltip-arrow-width;
border-width: $tooltip-arrow-width 0 $tooltip-arrow-width $tooltip-arrow-width;
width: $tooltip-arrow-height;
height: $tooltip-arrow-width;
&::before {
left: 0;
border-width: ($tooltip-arrow-width / 2) 0 ($tooltip-arrow-width / 2) $tooltip-arrow-height;
border-left-color: $tooltip-arrow-color;
}
}
}
.bs-tooltip-auto {
&[x-placement^="top"] {
@extend .bs-tooltip-top;
}
&[x-placement^="right"] {
@extend .bs-tooltip-right;
}
&[x-placement^="bottom"] {
@extend .bs-tooltip-bottom;
}
&[x-placement^="left"] {
@extend .bs-tooltip-left;
}
}
// Wrapper for the tooltip content
.tooltip-inner {
max-width: $tooltip-max-width;
@ -74,14 +111,5 @@
color: $tooltip-color;
text-align: center;
background-color: $tooltip-bg;
@include border-radius($border-radius);
}
// Arrows
.tooltip-arrow {
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
@include border-radius($tooltip-border-radius);
}

36
scss/bootstrap/_transitions.scss

@ -0,0 +1,36 @@
// stylelint-disable selector-no-qualifying-type
.fade {
opacity: 0;
@include transition($transition-fade);
&.show {
opacity: 1;
}
}
.collapse {
display: none;
&.show {
display: block;
}
}
tr {
&.collapse.show {
display: table-row;
}
}
tbody {
&.collapse.show {
display: table-row-group;
}
}
.collapsing {
position: relative;
height: 0;
overflow: hidden;
@include transition($transition-collapse);
}

55
scss/bootstrap/_type.scss

@ -1,3 +1,5 @@
// stylelint-disable declaration-no-important, selector-list-comma-newline-after
//
// Headings
//
@ -11,12 +13,12 @@ h1, h2, h3, h4, h5, h6,
color: $headings-color;
}
h1, .h1 { font-size: $font-size-h1; }
h2, .h2 { font-size: $font-size-h2; }
h3, .h3 { font-size: $font-size-h3; }
h4, .h4 { font-size: $font-size-h4; }
h5, .h5 { font-size: $font-size-h5; }
h6, .h6 { font-size: $font-size-h6; }
h1, .h1 { font-size: $h1-font-size; }
h2, .h2 { font-size: $h2-font-size; }
h3, .h3 { font-size: $h3-font-size; }
h4, .h4 { font-size: $h4-font-size; }
h5, .h5 { font-size: $h5-font-size; }
h6, .h6 { font-size: $h6-font-size; }
.lead {
font-size: $lead-font-size;
@ -27,18 +29,22 @@ h6, .h6 { font-size: $font-size-h6; }
.display-1 {
font-size: $display1-size;
font-weight: $display1-weight;
line-height: $display-line-height;
}
.display-2 {
font-size: $display2-size;
font-weight: $display2-weight;
line-height: $display-line-height;
}
.display-3 {
font-size: $display3-size;
font-weight: $display3-weight;
line-height: $display-line-height;
}
.display-4 {
font-size: $display4-size;
font-weight: $display4-weight;
line-height: $display-line-height;
}
@ -47,8 +53,8 @@ h6, .h6 { font-size: $font-size-h6; }
//
hr {
margin-top: $spacer-y;
margin-bottom: $spacer-y;
margin-top: $hr-margin-y;
margin-bottom: $hr-margin-y;
border: 0;
border-top: $hr-border-width solid $hr-border-color;
}
@ -61,7 +67,7 @@ hr {
small,
.small {
font-size: $small-font-size;
font-weight: normal;
font-weight: $font-weight-normal;
}
mark,
@ -104,10 +110,8 @@ mark,
// Blockquotes
.blockquote {
padding: ($spacer / 2) $spacer;
margin-bottom: $spacer;
font-size: $blockquote-font-size;
border-left: $blockquote-border-width solid $blockquote-border-color;
}
.blockquote-footer {
@ -119,32 +123,3 @@ mark,
content: "\2014 \00A0"; // em dash, nbsp
}
}
// Opposite alignment of blockquote
.blockquote-reverse {
padding-right: $spacer;
padding-left: 0;
text-align: right;
border-right: $blockquote-border-width solid $blockquote-border-color;
border-left: 0;
}
.blockquote-reverse .blockquote-footer {
&::before {
content: "";
}
&::after {
content: "\00A0 \2014"; // nbsp, em dash
}
}
@if not $enable-flex {
// Clean up some horizontal `<dl>`s built with grids
// scss-lint:disable QualifyingElement
dl.row {
> dd + dt {
clear: left;
}
}
// scss-lint:enable QualifyingElement
}

7
scss/bootstrap/_utilities.scss

@ -1,9 +1,14 @@
@import "utilities/align";
@import "utilities/background";
@import "utilities/borders";
@import "utilities/clearfix";
@import "utilities/display";
@import "utilities/embed";
@import "utilities/flex";
@import "utilities/pulls";
@import "utilities/float";
@import "utilities/position";
@import "utilities/screenreaders";
@import "utilities/sizing";
@import "utilities/spacing";
@import "utilities/text";
@import "utilities/visibility";

1017
scss/bootstrap/_variables.scss

File diff suppressed because it is too large

35
scss/bootstrap/bootstrap-grid.scss

@ -1,23 +1,32 @@
// Bootstrap Grid only
//
// Includes relevant variables and mixins for the regular (non-flexbox) grid
// system, as well as the generated predefined classes (e.g., `.col-4-sm`).
/*!
* Bootstrap Grid v4.0.0 (https://getbootstrap.com)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
@at-root {
@-ms-viewport { width: device-width; } // stylelint-disable-line at-rule-no-vendor-prefix
}
//
// Variables
//
html {
box-sizing: border-box;
-ms-overflow-style: scrollbar;
}
@import "custom";
@import "variables";
*,
*::before,
*::after {
box-sizing: inherit;
}
//
// Grid mixins
//
@import "functions";
@import "variables";
@import "mixins/clearfix";
@import "mixins/breakpoints";
@import "mixins/grid-framework";
@import "mixins/grid";
@import "grid";
@import "utilities/display";
@import "utilities/flex";

17
scss/bootstrap/bootstrap-reboot.scss

@ -1,11 +1,12 @@
// Bootstrap Reboot only
//
// Includes only Normalize and our custom Reboot reset.
/*!
* Bootstrap Reboot v4.0.0 (https://getbootstrap.com)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
@import "custom";
@import "functions";
@import "variables";
@import "mixins/hover";
@import "mixins/tab-focus";
@import "normalize";
@import "mixins";
@import "reboot";

28
scss/bootstrap/bootstrap.scss

@ -1,20 +1,14 @@
/*!
* Bootstrap v4.0.0-alpha.4 (http://getbootstrap.com)
* Copyright 2011-2016 The Bootstrap Authors
* Copyright 2011-2016 Twitter, Inc.
* Bootstrap v4.0.0 (https://getbootstrap.com)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
// Core variables and mixins
@import "custom";
@import "functions";
@import "variables";
@import "mixins";
// Reset and dependencies
@import "normalize";
@import "print";
// Core CSS
@import "root";
@import "reboot";
@import "type";
@import "images";
@ -23,9 +17,7 @@
@import "tables";
@import "forms";
@import "buttons";
// Components
@import "animation";
@import "transitions";
@import "dropdown";
@import "button-group";
@import "input-group";
@ -35,20 +27,16 @@
@import "card";
@import "breadcrumb";
@import "pagination";
@import "tags";
@import "badge";
@import "jumbotron";
@import "alert";
@import "progress";
@import "media";
@import "list-group";
@import "responsive-embed";
@import "close";
// Components w/ JavaScript
@import "modal";
@import "tooltip";
@import "popover";
@import "carousel";
// Utility classes
@import "utilities";
@import "print";

11
scss/bootstrap/mixins/_alert.scss

@ -1,14 +1,13 @@
// Alerts
@mixin alert-variant($background, $border, $body-color) {
background-color: $background;
@mixin alert-variant($background, $border, $color) {
color: $color;
@include gradient-bg($background);
border-color: $border;
color: $body-color;
hr {
border-top-color: darken($border, 5%);
}
.alert-link {
color: darken($body-color, 10%);
color: darken($color, 10%);
}
}

12
scss/bootstrap/mixins/_background-variant.scss

@ -1,13 +1,21 @@
// stylelint-disable declaration-no-important
// Contextual backgrounds
@mixin bg-variant($parent, $color) {
#{$parent} {
color: #fff !important;
background-color: $color !important;
}
a#{$parent} {
a#{$parent},
button#{$parent} {
@include hover-focus {
background-color: darken($color, 10%) !important;
}
}
}
@mixin bg-gradient-variant($parent, $color) {
#{$parent} {
background: $color linear-gradient(180deg, mix($body-bg, $color, 15%), $color) repeat-x !important;
}
}

12
scss/bootstrap/mixins/_badge.scss

@ -0,0 +1,12 @@
@mixin badge-variant($bg) {
color: color-yiq($bg);
background-color: $bg;
&[href] {
@include hover-focus {
color: color-yiq($bg);
text-decoration: none;
background-color: darken($bg, 10%);
}
}
}

6
scss/bootstrap/mixins/_border-radius.scss

@ -8,15 +8,15 @@
@mixin border-top-radius($radius) {
@if $enable-rounded {
border-top-right-radius: $radius;
border-top-left-radius: $radius;
border-top-right-radius: $radius;
}
}
@mixin border-right-radius($radius) {
@if $enable-rounded {
border-bottom-right-radius: $radius;
border-top-right-radius: $radius;
border-bottom-right-radius: $radius;
}
}
@ -29,7 +29,7 @@
@mixin border-left-radius($radius) {
@if $enable-rounded {
border-bottom-left-radius: $radius;
border-top-left-radius: $radius;
border-bottom-left-radius: $radius;
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save