No Description

ons-bottom-toolbar.js 3.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of';
  2. import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
  3. import _createClass from 'babel-runtime/helpers/createClass';
  4. import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
  5. import _inherits from 'babel-runtime/helpers/inherits';
  6. /*
  7. Copyright 2013-2015 ASIAL CORPORATION
  8. Licensed under the Apache License, Version 2.0 (the "License");
  9. you may not use this file except in compliance with the License.
  10. You may obtain a copy of the License at
  11. http://www.apache.org/licenses/LICENSE-2.0
  12. Unless required by applicable law or agreed to in writing, software
  13. distributed under the License is distributed on an "AS IS" BASIS,
  14. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. See the License for the specific language governing permissions and
  16. limitations under the License.
  17. */
  18. import onsElements from '../ons/elements';
  19. import util from '../ons/util';
  20. import autoStyle from '../ons/autostyle';
  21. import ModifierUtil from '../ons/internal/modifier-util';
  22. import BaseElement from './base/base-element';
  23. var defaultClassName = 'bottom-bar';
  24. var scheme = { '': 'bottom-bar--*' };
  25. /**
  26. * @element ons-bottom-toolbar
  27. * @category page
  28. * @description
  29. * [en]Toolbar component that is positioned at the bottom of the page. Since bottom toolbars are very versatile elements, `ons-bottom-toolbar` does not provide any specific layout syntax for its children. Modifiers or custom CSS must be used.[/en]
  30. * [ja]ページ下部に配置されるツールバー用コンポーネントです。[/ja]
  31. * @modifier transparent
  32. * [en]Make the toolbar transparent.[/en]
  33. * [ja]ツールバーの背景を透明にして表示します。[/ja]
  34. * @modifier aligned
  35. * [en]Vertically aligns its children and applies flexbox for block elements. `justify-content` CSS rule can be used to change horizontal align.[/en]
  36. * [ja]ツールバーの背景を透明にして表示します。[/ja]
  37. * @seealso ons-toolbar [en]ons-toolbar component[/en][ja]ons-toolbarコンポーネント[/ja]
  38. * @example
  39. * <ons-bottom-toolbar>
  40. * Content
  41. * </ons-bottom-toolbar>
  42. */
  43. var BottomToolbarElement = function (_BaseElement) {
  44. _inherits(BottomToolbarElement, _BaseElement);
  45. /**
  46. * @attribute modifier
  47. * @type {String}
  48. * @description
  49. * [en]The appearance of the toolbar.[/en]
  50. * [ja]ツールバーの見た目の表現を指定します。[/ja]
  51. */
  52. function BottomToolbarElement() {
  53. _classCallCheck(this, BottomToolbarElement);
  54. var _this = _possibleConstructorReturn(this, (BottomToolbarElement.__proto__ || _Object$getPrototypeOf(BottomToolbarElement)).call(this));
  55. _this.classList.add(defaultClassName);
  56. ModifierUtil.initModifier(_this, scheme);
  57. return _this;
  58. }
  59. _createClass(BottomToolbarElement, [{
  60. key: 'attributeChangedCallback',
  61. value: function attributeChangedCallback(name, last, current) {
  62. switch (name) {
  63. case 'class':
  64. util.restoreClass(this, defaultClassName, scheme);
  65. break;
  66. case 'modifier':
  67. ModifierUtil.onModifierChanged(last, current, this, scheme);
  68. break;
  69. }
  70. }
  71. }], [{
  72. key: 'observedAttributes',
  73. get: function get() {
  74. return ['modifier', 'class'];
  75. }
  76. }]);
  77. return BottomToolbarElement;
  78. }(BaseElement);
  79. export default BottomToolbarElement;
  80. onsElements.BottomToolbar = BottomToolbarElement;
  81. customElements.define('ons-bottom-toolbar', BottomToolbarElement);