Nenhuma descrição

ons-search-input.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 BaseInputElement from './base/base-input';
  20. var scheme = {
  21. '.search-input': 'search-input--*'
  22. };
  23. /**
  24. * @element ons-search-input
  25. * @category form
  26. * @modifier material
  27. * [en]Displays a Material Design search input.[/en]
  28. * [ja][/ja]
  29. * @description
  30. * [en]
  31. * A search input element. The component will automatically render as a Material Design search input on Android devices.
  32. *
  33. * Most attributes that can be used for a normal `<input>` element can also be used on the `<ons-search-input>` element.
  34. * [/en]
  35. * [ja][/ja]
  36. * @tutorial vanilla/Reference/search-input
  37. * @seealso ons-input
  38. * [en]The `<ons-input>` element is used to display a text input.[/en]
  39. * [ja][/ja]
  40. * @seealso ons-range
  41. * [en]The `<ons-range>` element is used to display a range slider.[/en]
  42. * [ja][/ja]
  43. * @seealso ons-switch
  44. * [en]The `<ons-switch>` element is used to display a draggable toggle switch.[/en]
  45. * [ja][/ja]
  46. * @seealso ons-select
  47. * [en]The `<ons-select>` element is used to display a select box.[/en]
  48. * [ja][/ja]
  49. * @seealso ons-checkbox
  50. * [en]The `<ons-checkbox>` element is used to display a checkbox.[/en]
  51. * [ja][/ja]
  52. * @seealso ons-radio
  53. * [en]The `<ons-radio>` element is used to display a radio button.[/en]
  54. * [ja][/ja]
  55. * @guide theming.html#modifiers [en]More details about the `modifier` attribute[/en][ja]modifier属性の使い方[/ja]
  56. * @example
  57. * <ons-search-input placeholder="Search"></ons-search-input>
  58. */
  59. var SearchInputElement = function (_BaseInputElement) {
  60. _inherits(SearchInputElement, _BaseInputElement);
  61. function SearchInputElement() {
  62. _classCallCheck(this, SearchInputElement);
  63. return _possibleConstructorReturn(this, (SearchInputElement.__proto__ || _Object$getPrototypeOf(SearchInputElement)).apply(this, arguments));
  64. }
  65. _createClass(SearchInputElement, [{
  66. key: '_scheme',
  67. get: function get() {
  68. return scheme;
  69. }
  70. }, {
  71. key: '_template',
  72. get: function get() {
  73. return '\n <input type="' + this.type + '" class="search-input">\n ';
  74. }
  75. }, {
  76. key: 'type',
  77. get: function get() {
  78. return 'search';
  79. }
  80. /**
  81. * @attribute input-id
  82. * @type {String}
  83. * @description
  84. * [en]Specify the "id" attribute of the inner `<input>` element. This is useful when using `<label for="...">` elements.[/en]
  85. * [ja][/ja]
  86. */
  87. /**
  88. * @property value
  89. * @type {String}
  90. * @description
  91. * [en]The current value of the input.[/en]
  92. * [ja][/ja]
  93. */
  94. /**
  95. * @property disabled
  96. * @type {Boolean}
  97. * @description
  98. * [en]Whether the input is disabled or not.[/en]
  99. * [ja]無効化されている場合に`true`。[/ja]
  100. */
  101. }]);
  102. return SearchInputElement;
  103. }(BaseInputElement);
  104. export default SearchInputElement;
  105. onsElements.SearchInput = SearchInputElement;
  106. customElements.define('ons-search-input', SearchInputElement);