1 | /*
|
2 | Copyright 2013-2015 ASIAL CORPORATION
|
3 |
|
4 | Licensed under the Apache License, Version 2.0 (the "License");
|
5 | you may not use this file except in compliance with the License.
|
6 | You may obtain a copy of the License at
|
7 |
|
8 | http://www.apache.org/licenses/LICENSE-2.0
|
9 |
|
10 | Unless required by applicable law or agreed to in writing, software
|
11 | distributed under the License is distributed on an "AS IS" BASIS,
|
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | See the License for the specific language governing permissions and
|
14 | limitations under the License.
|
15 |
|
16 | */
|
17 |
|
18 | import onsElements from '../ons/elements.js';
|
19 | import BaseButtonElement from './base/base-button.js';
|
20 |
|
21 | /**
|
22 | * @element ons-button
|
23 | * @category form
|
24 | * @modifier outline
|
25 | * [en]Button with outline and transparent background[/en]
|
26 | * [ja]アウトラインを持ったボタンを表示します。[/ja]
|
27 | * @modifier light
|
28 | * [en]Button that doesn't stand out.[/en]
|
29 | * [ja]目立たないボタンを表示します。[/ja]
|
30 | * @modifier quiet
|
31 | * [en]Button with no outline and or background..[/en]
|
32 | * [ja]枠線や背景が無い文字だけのボタンを表示します。[/ja]
|
33 | * @modifier cta
|
34 | * [en]Button that really stands out.[/en]
|
35 | * [ja]目立つボタンを表示します。[/ja]
|
36 | * @modifier large
|
37 | * [en]Large button that covers the width of the screen.[/en]
|
38 | * [ja]横いっぱいに広がる大きなボタンを表示します。[/ja]
|
39 | * @modifier large--quiet
|
40 | * [en]Large quiet button.[/en]
|
41 | * [ja]横いっぱいに広がるquietボタンを表示します。[/ja]
|
42 | * @modifier large--cta
|
43 | * [en]Large call to action button.[/en]
|
44 | * [ja]横いっぱいに広がるctaボタンを表示します。[/ja]
|
45 | * @modifier material
|
46 | * [en]Material Design button[/en]
|
47 | * [ja]マテリアルデザインのボタン[/ja]
|
48 | * @modifier material--flat
|
49 | * [en]Material Design flat button[/en]
|
50 | * [ja]マテリアルデザインのフラットボタン[/ja]
|
51 | * @description
|
52 | * [en]
|
53 | * Button component. If you want to place a button in a toolbar, use `<ons-toolbar-button>` or `<ons-back-button>` instead.
|
54 | *
|
55 | * Will automatically display as a Material Design button with a ripple effect on Android.
|
56 | * [/en]
|
57 | * [ja]ボタン用コンポーネント。ツールバーにボタンを設置する場合は、ons-toolbar-buttonもしくはons-back-buttonコンポーネントを使用します。[/ja]
|
58 | * @codepen hLayx
|
59 | * @tutorial vanilla/Reference/button
|
60 | * @guide theming.html#modifiers [en]More details about the `modifier` attribute[/en][ja]modifier属性の使い方[/ja]
|
61 | * @guide theming.html#cross-platform-styling-autostyling [en]Information about cross platform styling[/en][ja]Information about cross platform styling[/ja]
|
62 | * @example
|
63 | * <ons-button modifier="large--cta">
|
64 | * Tap Me
|
65 | * </ons-button>
|
66 | */
|
67 |
|
68 | export default class ButtonElement extends BaseButtonElement {
|
69 |
|
70 | /**
|
71 | * @attribute modifier
|
72 | * @type {String}
|
73 | * @description
|
74 | * [en]The appearance of the button.[/en]
|
75 | * [ja]ボタンの表現を指定します。[/ja]
|
76 | */
|
77 |
|
78 | /**
|
79 | * @attribute ripple
|
80 | * @description
|
81 | * [en]If this attribute is defined, the button will have a ripple effect.[/en]
|
82 | * [ja][/ja]
|
83 | */
|
84 |
|
85 | /**
|
86 | * @property ripple
|
87 | * @type {Boolean}
|
88 | * @description
|
89 | * [en]Whether the button has a ripple effect or not.[/en]
|
90 | * [ja][/ja]
|
91 | */
|
92 |
|
93 | /**
|
94 | * @attribute disabled
|
95 | * @description
|
96 | * [en]Specify if button should be disabled.[/en]
|
97 | * [ja]ボタンを無効化する場合は指定します。[/ja]
|
98 | */
|
99 |
|
100 | /**
|
101 | * @property disabled
|
102 | * @type {Boolean}
|
103 | * @description
|
104 | * [en]Whether the button is disabled or not.[/en]
|
105 | * [ja]無効化されている場合に`true`。[/ja]
|
106 | */
|
107 |
|
108 | get _scheme() {
|
109 | return { '': 'button--*' };
|
110 | }
|
111 |
|
112 | get _defaultClassName() {
|
113 | return 'button';
|
114 | }
|
115 | }
|
116 |
|
117 | onsElements.Button = ButtonElement;
|
118 | customElements.define('ons-button', ButtonElement);
|