{"version":3,"file":"bootstrap-material-design.js","sources":["../../rollupPluginBabelHelpers","../../js/util.js","../../js/base.js","../../js/baseInput.js","../../js/baseSelection.js","../../js/checkbox.js","../../js/checkboxInline.js","../../js/collapseInline.js","../../js/file.js","../../js/radio.js","../../js/radioInline.js","../../js/baseFormControl.js","../../js/select.js","../../js/switch.js","../../js/text.js","../../js/textarea.js","../../js/dropdown.js","../../js/baseLayout.js","../../js/drawer.js","../../js/ripples.js","../../js/autofill.js","../../js/bootstrapMaterialDesign.js","../../js/index.js"],"sourcesContent":["export { _createClass as createClass, _extends as extends, _inheritsLoose as inheritsLoose };\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","const Util = (() => {\n /**\n * ------------------------------------------------------------------------\n * Private TransitionEnd Helpers\n * ------------------------------------------------------------------------\n */\n\n let transitionEnd = false;\n let transitionEndSelector = \"\";\n\n const TransitionEndEvent = {\n WebkitTransition: \"webkitTransitionEnd\",\n MozTransition: \"transitionend\",\n OTransition: \"oTransitionEnd otransitionend\",\n transition: \"transitionend\"\n };\n\n function transitionEndTest() {\n if (window.QUnit) {\n return false;\n }\n\n let el = document.createElement(\"bmd\");\n\n for (let name in TransitionEndEvent) {\n if (el.style[name] !== undefined) {\n return TransitionEndEvent[name]; // { end: TransitionEndEvent[name] }\n }\n }\n\n return false;\n }\n\n function setTransitionEndSupport() {\n transitionEnd = transitionEndTest();\n\n // generate a concatenated transition end event selector\n for (let name in TransitionEndEvent) {\n transitionEndSelector += ` ${TransitionEndEvent[name]}`;\n }\n }\n\n /**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\n let Util = {\n transitionEndSupported() {\n return transitionEnd;\n },\n\n transitionEndSelector() {\n return transitionEndSelector;\n },\n\n isChar(event) {\n if (typeof event.which === \"undefined\") {\n return true;\n } else if (typeof event.which === \"number\" && event.which > 0) {\n return (\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey &&\n event.which !== 8 && // backspace\n event.which !== 9 && // tab\n event.which !== 13 && // enter\n event.which !== 16 && // shift\n event.which !== 17 && // ctrl\n event.which !== 20 && // caps lock\n event.which !== 27 // escape\n );\n }\n return false;\n },\n\n assert($element, invalidTest, message) {\n if (invalidTest) {\n if (!$element === undefined) {\n $element.css(\"border\", \"1px solid red\");\n }\n console.error(message, $element); // eslint-disable-line no-console\n throw message;\n }\n },\n\n describe($element) {\n if ($element === undefined) {\n return \"undefined\";\n } else if ($element.length === 0) {\n return \"(no matching elements)\";\n }\n return `${$element[0].outerHTML.split(\">\")[0]}>`;\n }\n };\n\n setTransitionEndSupport();\n return Util;\n})(jQuery);\n\nexport default Util;\n","import Util from \"./util\";\n\nconst Base = ($ => {\n const ClassName = {\n BMD_FORM_GROUP: \"bmd-form-group\",\n IS_FILLED: \"is-filled\",\n IS_FOCUSED: \"is-focused\"\n };\n\n const Selector = {\n BMD_FORM_GROUP: `.${ClassName.BMD_FORM_GROUP}`\n };\n\n const Default = {};\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n class Base {\n /**\n *\n * @param element\n * @param config\n * @param properties - anything that needs to be set as this[key] = value. Works around the need to call `super` before using `this`\n */\n constructor($element, config, properties = {}) {\n this.$element = $element;\n this.config = $.extend(true, {}, Default, config);\n\n // set properties for use in the constructor initialization\n for (let key in properties) {\n this[key] = properties[key];\n }\n }\n\n dispose(dataKey) {\n this.$element.data(dataKey, null);\n this.$element = null;\n this.config = null;\n }\n\n // ------------------------------------------------------------------------\n // protected\n\n addFormGroupFocus() {\n if (!this.$element.prop(\"disabled\")) {\n this.$bmdFormGroup.addClass(ClassName.IS_FOCUSED);\n }\n }\n\n removeFormGroupFocus() {\n this.$bmdFormGroup.removeClass(ClassName.IS_FOCUSED);\n }\n\n removeIsFilled() {\n this.$bmdFormGroup.removeClass(ClassName.IS_FILLED);\n }\n\n addIsFilled() {\n this.$bmdFormGroup.addClass(ClassName.IS_FILLED);\n }\n\n // Find bmd-form-group\n findMdbFormGroup(raiseError = true) {\n let mfg = this.$element.closest(Selector.BMD_FORM_GROUP);\n if (mfg.length === 0 && raiseError) {\n $.error(\n `Failed to find ${Selector.BMD_FORM_GROUP} for ${Util.describe(\n this.$element\n )}`\n );\n }\n return mfg;\n }\n\n // ------------------------------------------------------------------------\n // private\n\n // ------------------------------------------------------------------------\n // static\n }\n\n return Base;\n})(jQuery);\n\nexport default Base;\n","import Base from \"./base\";\nimport Util from \"./util\";\n\nconst BaseInput = ($ => {\n const ClassName = {\n FORM_GROUP: \"form-group\",\n BMD_FORM_GROUP: \"bmd-form-group\",\n BMD_LABEL: \"bmd-label\",\n BMD_LABEL_STATIC: \"bmd-label-static\",\n BMD_LABEL_PLACEHOLDER: \"bmd-label-placeholder\",\n BMD_LABEL_FLOATING: \"bmd-label-floating\",\n HAS_DANGER: \"has-danger\",\n IS_FILLED: \"is-filled\",\n IS_FOCUSED: \"is-focused\",\n INPUT_GROUP: \"input-group\"\n };\n\n const Selector = {\n FORM_GROUP: `.${ClassName.FORM_GROUP}`,\n BMD_FORM_GROUP: `.${ClassName.BMD_FORM_GROUP}`,\n BMD_LABEL_WILDCARD: `label[class^='${ClassName.BMD_LABEL}'], label[class*=' ${ClassName.BMD_LABEL}']` // match any label variant if specified\n };\n\n const Default = {\n validate: false,\n formGroup: {\n required: false\n },\n bmdFormGroup: {\n template: ``,\n create: true, // create a wrapper if form-group not found\n required: true // not recommended to turn this off, only used for inline components\n },\n label: {\n required: false,\n\n // Prioritized find order for resolving the label to be used as an bmd-label if not specified in the markup\n // - a function(thisComponent); or\n // - a string selector used like $bmdFormGroup.find(selector)\n //\n // Note this only runs if $bmdFormGroup.find(Selector.BMD_LABEL_WILDCARD) fails to find a label (as authored in the markup)\n //\n selectors: [\n `.form-control-label`, // in the case of horizontal or inline forms, this will be marked\n `> label` // usual case for text inputs, first child. Deeper would find toggle labels so don't do that.\n ],\n className: ClassName.BMD_LABEL_STATIC\n },\n requiredClasses: [],\n invalidComponentMatches: [],\n convertInputSizeVariations: true\n };\n\n const FormControlSizeMarkers = {\n \"form-control-lg\": \"bmd-form-group-lg\",\n \"form-control-sm\": \"bmd-form-group-sm\"\n };\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n class BaseInput extends Base {\n /**\n *\n * @param element\n * @param config\n * @param properties - anything that needs to be set as this[key] = value. Works around the need to call `super` before using `this`\n */\n constructor($element, config, properties = {}) {\n super($element, $.extend(true, {}, Default, config), properties);\n\n // Enforce no overlap between components to prevent side effects\n this._rejectInvalidComponentMatches();\n\n // Enforce expected structure (if any)\n this.rejectWithoutRequiredStructure();\n\n // Enforce required classes for a consistent rendering\n this._rejectWithoutRequiredClasses();\n\n // Resolve the form-group first, it will be used for bmd-form-group if possible\n // note: different components have different rules\n this.$formGroup = this.findFormGroup(this.config.formGroup.required);\n\n // Will add bmd-form-group to form-group or create an bmd-form-group\n // Performance Note: for those forms that are really performance driven, create the markup with the .bmd-form-group to avoid\n // rendering changes once added.\n this.$bmdFormGroup = this.resolveMdbFormGroup();\n\n // Resolve and mark the bmdLabel if necessary as defined by the config\n this.$bmdLabel = this.resolveMdbLabel();\n\n // Signal to the bmd-form-group that a form-control-* variation is being used\n this.resolveMdbFormGroupSizing();\n\n this.addFocusListener();\n this.addChangeListener();\n\n if (this.$element.val() != \"\") {\n this.addIsFilled();\n }\n }\n\n dispose(dataKey) {\n super.dispose(dataKey);\n this.$bmdFormGroup = null;\n this.$formGroup = null;\n }\n\n // ------------------------------------------------------------------------\n // protected\n\n rejectWithoutRequiredStructure() {\n // implement\n }\n\n addFocusListener() {\n this.$element\n .on(\"focus\", () => {\n this.addFormGroupFocus();\n })\n .on(\"blur\", () => {\n this.removeFormGroupFocus();\n });\n }\n\n addChangeListener() {\n this.$element\n .on(\"keydown paste\", event => {\n if (Util.isChar(event)) {\n this.addIsFilled();\n }\n })\n .on(\"keyup change\", () => {\n // make sure empty is added back when there is a programmatic value change.\n // NOTE: programmatic changing of value using $.val() must trigger the change event i.e. $.val('x').trigger('change')\n if (this.isEmpty()) {\n this.removeIsFilled();\n } else {\n this.addIsFilled();\n }\n\n if (this.config.validate) {\n // Validation events do not bubble, so they must be attached directly to the text: http://jsfiddle.net/PEpRM/1/\n // Further, even the bind method is being caught, but since we are already calling #checkValidity here, just alter\n // the form-group on change.\n //\n // NOTE: I'm not sure we should be intervening regarding validation, this seems better as a README and snippet of code.\n // BUT, I've left it here for backwards compatibility.\n let isValid =\n typeof this.$element[0].checkValidity === \"undefined\" ||\n this.$element[0].checkValidity();\n if (isValid) {\n this.removeHasDanger();\n } else {\n this.addHasDanger();\n }\n }\n });\n }\n\n addHasDanger() {\n this.$bmdFormGroup.addClass(ClassName.HAS_DANGER);\n }\n\n removeHasDanger() {\n this.$bmdFormGroup.removeClass(ClassName.HAS_DANGER);\n }\n\n isEmpty() {\n return (\n this.$element.val() === null ||\n this.$element.val() === undefined ||\n this.$element.val() === \"\"\n );\n }\n\n // Will add bmd-form-group to form-group or create a bmd-form-group if necessary\n resolveMdbFormGroup() {\n let mfg = this.findMdbFormGroup(false);\n if (mfg === undefined || mfg.length === 0) {\n if (\n this.config.bmdFormGroup.create &&\n (this.$formGroup === undefined || this.$formGroup.length === 0)\n ) {\n // If a form-group doesn't exist (not recommended), take a guess and wrap the element (assuming no label).\n // note: it's possible to make this smarter, but I need to see valid cases before adding any complexity.\n\n // this may be an input-group, wrap that instead\n if (this.outerElement().parent().hasClass(ClassName.INPUT_GROUP)) {\n this.outerElement()\n .parent()\n .wrap(this.config.bmdFormGroup.template);\n } else {\n this.outerElement().wrap(this.config.bmdFormGroup.template);\n }\n } else {\n // a form-group does exist, add our marker class to it\n this.$formGroup.addClass(ClassName.BMD_FORM_GROUP);\n\n // OLD: may want to implement this after all, see how the styling turns out, but using an existing form-group is less manipulation of the dom and therefore preferable\n // A form-group does exist, so add an bmd-form-group wrapping it's internal contents\n //fg.wrapInner(this.config.bmdFormGroup.template)\n }\n\n mfg = this.findMdbFormGroup(this.config.bmdFormGroup.required);\n }\n\n return mfg;\n }\n\n // Demarcation element (e.g. first child of a form-group)\n // Subclasses such as file inputs may have different structures\n outerElement() {\n return this.$element;\n }\n\n // Will add bmd-label to bmd-form-group if not already specified\n resolveMdbLabel() {\n let label = this.$bmdFormGroup.find(Selector.BMD_LABEL_WILDCARD);\n if (label === undefined || label.length === 0) {\n // we need to find it based on the configured selectors\n label = this.findMdbLabel(this.config.label.required);\n\n if (label === undefined || label.length === 0) {\n // no label found, and finder did not require one\n } else {\n // a candidate label was found, add the configured default class name\n label.addClass(this.config.label.className);\n }\n }\n\n return label;\n }\n\n // Find bmd-label variant based on the config selectors\n findMdbLabel(raiseError = true) {\n let label = null;\n\n // use the specified selector order\n for (let selector of this.config.label.selectors) {\n if ($.isFunction(selector)) {\n label = selector(this);\n } else {\n label = this.$bmdFormGroup.find(selector);\n }\n\n if (label !== undefined && label.length > 0) {\n break;\n }\n }\n\n if (label.length === 0 && raiseError) {\n $.error(\n `Failed to find ${Selector.BMD_LABEL_WILDCARD} within form-group for ${Util.describe(\n this.$element\n )}`\n );\n }\n return label;\n }\n\n // Find bmd-form-group\n findFormGroup(raiseError = true) {\n let fg = this.$element.closest(Selector.FORM_GROUP);\n if (fg.length === 0 && raiseError) {\n $.error(\n `Failed to find ${Selector.FORM_GROUP} for ${Util.describe(\n this.$element\n )}`\n );\n }\n return fg;\n }\n\n // Due to the interconnected nature of labels/inputs/help-blocks, signal the bmd-form-group-* size variation based on\n // a found form-control-* size\n resolveMdbFormGroupSizing() {\n if (!this.config.convertInputSizeVariations) {\n return;\n }\n\n // Modification - Change text-sm/lg to form-group-sm/lg instead (preferred standard and simpler css/less variants)\n for (let inputSize in FormControlSizeMarkers) {\n if (this.$element.hasClass(inputSize)) {\n //this.$element.removeClass(inputSize)\n this.$bmdFormGroup.addClass(FormControlSizeMarkers[inputSize]);\n }\n }\n }\n\n // ------------------------------------------------------------------------\n // private\n _rejectInvalidComponentMatches() {\n for (let otherComponent of this.config.invalidComponentMatches) {\n otherComponent.rejectMatch(this.constructor.name, this.$element);\n }\n }\n\n _rejectWithoutRequiredClasses() {\n for (let requiredClass of this.config.requiredClasses) {\n let found = false;\n // allow one of several classes to be passed in x||y\n if (requiredClass.indexOf(\"||\") !== -1) {\n let oneOf = requiredClass.split(\"||\");\n for (let requiredClass of oneOf) {\n if (this.$element.hasClass(requiredClass)) {\n found = true;\n break;\n }\n }\n } else if (this.$element.hasClass(requiredClass)) {\n found = true;\n }\n }\n }\n\n // ------------------------------------------------------------------------\n // static\n }\n\n return BaseInput;\n})(jQuery);\n\nexport default BaseInput;\n","import BaseInput from \"./baseInput\";\nimport Util from \"./util\";\n\nconst BaseSelection = ($ => {\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n const Default = {\n label: {\n required: false\n\n // Prioritized find order for resolving the label to be used as an bmd-label if not specified in the markup\n // - a function(thisComponent); or\n // - a string selector used like $bmdFormGroup.find(selector)\n //\n // Note this only runs if $bmdFormGroup.find(Selector.BMD_LABEL_WILDCARD) fails to find a label (as authored in the markup)\n //\n //selectors: [\n // `.form-control-label`, // in the case of horizontal or inline forms, this will be marked\n // `> label` // usual case for text inputs\n //]\n }\n };\n\n const Selector = {\n LABEL: \"label\"\n };\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n class BaseSelection extends BaseInput {\n constructor($element, config, properties) {\n // properties = {inputType: checkbox, outerClass: checkbox-inline}\n // '.checkbox|switch|radio > label > input[type=checkbox|radio]'\n // '.${this.outerClass} > label > input[type=${this.inputType}]'\n\n super($element, $.extend(true, {}, Default, config), properties);\n this.decorateMarkup();\n }\n\n // ------------------------------------------------------------------------\n // protected\n\n decorateMarkup() {\n const $decorator = $(this.config.template);\n this.$element.after($decorator);\n\n // initialize ripples after decorator has been inserted into DOM\n if (this.config.ripples !== false) {\n $decorator.bmdRipples();\n }\n }\n\n // Demarcation element (e.g. first child of a form-group)\n outerElement() {\n // .checkbox|switch|radio > label > input[type=checkbox|radio]\n // label.checkbox-inline > input[type=checkbox|radio]\n // .${this.outerClass} > label > input[type=${this.inputType}]\n return this.$element.parent().closest(`.${this.outerClass}`);\n }\n\n rejectWithoutRequiredStructure() {\n // '.checkbox|switch|radio > label > input[type=checkbox|radio]'\n // '.${this.outerClass} > label > input[type=${this.inputType}]'\n Util.assert(\n this.$element,\n !this.$element.parent().prop(\"tagName\") === \"label\",\n `${this.constructor.name}'s ${Util.describe(\n this.$element\n )} parent element should be