aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/native
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/ui/native')
-rw-r--r--node_modules/montage/ui/native/anchor.reel/anchor.js80
-rw-r--r--node_modules/montage/ui/native/button.reel/button.js465
-rw-r--r--node_modules/montage/ui/native/image.reel/image.js54
-rw-r--r--node_modules/montage/ui/native/input-checkbox.reel/input-checkbox.js77
-rw-r--r--node_modules/montage/ui/native/input-date.reel/input-date.js46
-rw-r--r--node_modules/montage/ui/native/input-number.reel/input-number.js48
-rw-r--r--node_modules/montage/ui/native/input-radio.reel/input-radio.js174
-rw-r--r--node_modules/montage/ui/native/input-range.reel/input-range.js83
-rw-r--r--node_modules/montage/ui/native/input-text.reel/input-text.js26
-rw-r--r--node_modules/montage/ui/native/progress.reel/progress.js49
-rw-r--r--node_modules/montage/ui/native/select.reel/select.js496
-rw-r--r--node_modules/montage/ui/native/textarea.reel/textarea.js127
12 files changed, 1725 insertions, 0 deletions
diff --git a/node_modules/montage/ui/native/anchor.reel/anchor.js b/node_modules/montage/ui/native/anchor.reel/anchor.js
new file mode 100644
index 00000000..31f3c29c
--- /dev/null
+++ b/node_modules/montage/ui/native/anchor.reel/anchor.js
@@ -0,0 +1,80 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
7/**
8 @module "montage/ui/anchor.reel"
9 @requires montage/core/core
10 @requires montage/ui/native-control
11*/
12var Montage = require("montage").Montage,
13 Component = require("ui/component").Component,
14 NativeControl = require("ui/native-control").NativeControl;
15/**
16 The Anchor component wraps a native <code>&lt;a&gt;</code> element and exposes its standard attributes as bindable properties.
17 @class module:"montage/ui/anchor.reel".Anchor
18 @extends module:montage/ui/native-control.NativeControl
19
20*/
21var Anchor = exports.Anchor = Montage.create(NativeControl, {
22
23 // HTMLAnchorElement methods
24
25 blur: { value: function() { this._element.blur(); } },
26 focus: { value: function() { this._element.focus(); } }
27
28});
29
30Anchor.addAttributes( /** @lends module:"montage/ui/anchor.reel".Anchor# */ {
31
32/**
33 The text displayed by the link.
34 @type string
35 @default null
36*/
37 textContent: null,
38
39/**
40 The link target URL.
41 @type string
42 @default null
43*/
44 href: null,
45
46/**
47 The language of the linked resource.
48 @type string
49 @default null
50*/
51 hreflang: null,
52
53/**
54 The media type for which the target document was designed.
55 @type string
56 @default null
57*/
58 media: null,
59
60/**
61 Controls what kinds of links the elements create.
62 @type string
63 @default null
64*/
65 rel: null,
66
67/**
68 The target window the link will open in.
69 @type string
70 @default null
71*/
72 target: null,
73
74/**
75 The MIME type of the linked resource.
76 @type string
77 @default null
78*/
79 type: null
80});
diff --git a/node_modules/montage/ui/native/button.reel/button.js b/node_modules/montage/ui/native/button.reel/button.js
new file mode 100644
index 00000000..d7a4ffee
--- /dev/null
+++ b/node_modules/montage/ui/native/button.reel/button.js
@@ -0,0 +1,465 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6 /*global require, exports*/
7
8/**
9 @module "montage/ui/button.reel"
10 @requires montage/core/core
11 @requires montage/ui/component
12 @requires montage/ui/native-control
13 @requires montage/ui/composer/press-composer
14*/
15var Montage = require("montage").Montage,
16 Component = require("ui/component").Component,
17 NativeControl = require("ui/native-control").NativeControl,
18 PressComposer = require("ui/composer/press-composer").PressComposer;
19
20/**
21 Wraps a native <code>&lt;button></code> or <code>&lt;input[type="button"]></code> HTML element. The element's standard attributes are exposed as bindable properties.
22 @class module:"montage/ui/button.reel".Button
23 @extends module:montage/ui/native-control.NativeControl
24 @example
25<caption>JavaScript example</caption>
26var b1 = Button.create();
27b1.element = document.querySelector("btnElement");
28b1.addEventListener("action", function(event) {
29 console.log("Got event 'action' event");
30});
31 @example
32<caption>Serialized example</caption>
33{
34 "aButton": {
35 "prototype": "montage/ui/button.reel",
36 "properties": {
37 "element": {"#": "btnElement"}
38 },
39 "listeners": [
40 {
41 "type": "action",
42 "listener": {"@": "appListener"}
43 }
44 ]
45 },
46 "listener": {
47 "prototype": "appListener"
48 }
49}
50&lt;button data-montage-id="btnElement"></button>
51*/
52var Button = exports.Button = Montage.create(NativeControl, /** @lends module:"montage/ui/button.reel".Button# */ {
53
54 _preventFocus: {
55 enumerable: false,
56 value: false
57 },
58
59/**
60 Specifies whether the button should receive focus or not.
61 @type {boolean}
62 @default false
63 @event longpress
64*/
65 preventFocus: {
66 get: function () {
67 return this._preventFocus;
68 },
69 set: function (value) {
70 if (value === true) {
71 this._preventFocus = true;
72 } else {
73 this._preventFocus = false;
74 }
75 }
76 },
77
78
79/**
80 Enables or disables the Button from user input. When this property is set to <code>false</code>, the "disabled" CSS style is applied to the button's DOM element during the next draw cycle. When set to <code>true</code> the "disabled" CSS class is removed from the element's class list.
81*/
82 //TODO we should prefer positive properties like enabled vs disabled, get rid of disabled
83 enabled: {
84 dependencies: ["disabled"],
85 get: function () {
86 return !this._disabled;
87 },
88 set: function (value) {
89 this.disabled = !value;
90 }
91 },
92
93 /**
94 A Montage converter object used to convert or format the label displayed by the Button instance. When a new value is assigned to <code>label</code>, the converter object's <code>convert()</code> method is invoked, passing it the newly assigned label value.
95 @type {Property}
96 @default null
97 */
98 converter: {
99 value: null
100 },
101
102 /**
103 Stores the node that contains this button's value. Only used for
104 non-`<input>` elements.
105 @private
106 */
107 _labelNode: {value:undefined, enumerable: false},
108
109 _label: { value: undefined, enumerable: false },
110
111 /**
112 The label for the button. In an &lt;input> element this is taken from the element's <code>value</code> attribute. On any other element (including &lt;button>) this is the first child node which is a text node. If one isn't found then it will be created.
113
114 If the button has a non-null <code>converter</code> property, the converter object's <code>convert()</code> method is called on the value before being assigned to the button instance.
115
116 @type {string}
117 @default undefined
118 */
119 label: {
120 get: function() {
121 return this._label;
122 },
123 set: function(value) {