material-ui 0.7.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +31 -0
  6. data/Rakefile +20 -0
  7. data/lib/material-ui.rb +4 -0
  8. data/material-ui-gem.gemspec +33 -0
  9. data/vendor/assets/javascripts/material-ui.js +1 -0
  10. data/vendor/assets/javascripts/material-ui/components/app-bar.jsx +93 -0
  11. data/vendor/assets/javascripts/material-ui/components/app-canvas.jsx +27 -0
  12. data/vendor/assets/javascripts/material-ui/components/checkbox.jsx +60 -0
  13. data/vendor/assets/javascripts/material-ui/components/date-picker/calendar-month.jsx +59 -0
  14. data/vendor/assets/javascripts/material-ui/components/date-picker/calendar-toolbar.jsx +64 -0
  15. data/vendor/assets/javascripts/material-ui/components/date-picker/calendar.jsx +194 -0
  16. data/vendor/assets/javascripts/material-ui/components/date-picker/date-display.jsx +79 -0
  17. data/vendor/assets/javascripts/material-ui/components/date-picker/date-picker-dialog.jsx +118 -0
  18. data/vendor/assets/javascripts/material-ui/components/date-picker/date-picker.jsx +116 -0
  19. data/vendor/assets/javascripts/material-ui/components/date-picker/day-button.jsx +49 -0
  20. data/vendor/assets/javascripts/material-ui/components/dialog-window.jsx +183 -0
  21. data/vendor/assets/javascripts/material-ui/components/dialog.jsx +54 -0
  22. data/vendor/assets/javascripts/material-ui/components/drop-down-icon.jsx +68 -0
  23. data/vendor/assets/javascripts/material-ui/components/drop-down-menu.jsx +94 -0
  24. data/vendor/assets/javascripts/material-ui/components/enhanced-button.jsx +147 -0
  25. data/vendor/assets/javascripts/material-ui/components/enhanced-switch.jsx +296 -0
  26. data/vendor/assets/javascripts/material-ui/components/enhanced-textarea.jsx +113 -0
  27. data/vendor/assets/javascripts/material-ui/components/flat-button.jsx +46 -0
  28. data/vendor/assets/javascripts/material-ui/components/floating-action-button.jsx +123 -0
  29. data/vendor/assets/javascripts/material-ui/components/font-icon.jsx +23 -0
  30. data/vendor/assets/javascripts/material-ui/components/icon-button.jsx +123 -0
  31. data/vendor/assets/javascripts/material-ui/components/ink-bar.jsx +25 -0
  32. data/vendor/assets/javascripts/material-ui/components/input.jsx +143 -0
  33. data/vendor/assets/javascripts/material-ui/components/left-nav.jsx +105 -0
  34. data/vendor/assets/javascripts/material-ui/components/menu/link-menu-item.jsx +42 -0
  35. data/vendor/assets/javascripts/material-ui/components/menu/menu-item.jsx +105 -0
  36. data/vendor/assets/javascripts/material-ui/components/menu/menu.jsx +325 -0
  37. data/vendor/assets/javascripts/material-ui/components/menu/subheader-menu-item.jsx +18 -0
  38. data/vendor/assets/javascripts/material-ui/components/mixins/classable.js +42 -0
  39. data/vendor/assets/javascripts/material-ui/components/mixins/click-awayable.js +35 -0
  40. data/vendor/assets/javascripts/material-ui/components/mixins/window-listenable.js +23 -0
  41. data/vendor/assets/javascripts/material-ui/components/overlay.jsx +58 -0
  42. data/vendor/assets/javascripts/material-ui/components/paper.jsx +58 -0
  43. data/vendor/assets/javascripts/material-ui/components/radio-button-group.jsx +112 -0
  44. data/vendor/assets/javascripts/material-ui/components/radio-button.jsx +65 -0
  45. data/vendor/assets/javascripts/material-ui/components/raised-button.jsx +102 -0
  46. data/vendor/assets/javascripts/material-ui/components/ripples/circle.jsx +35 -0
  47. data/vendor/assets/javascripts/material-ui/components/ripples/focus-ripple.jsx +40 -0
  48. data/vendor/assets/javascripts/material-ui/components/ripples/touch-ripple.jsx +174 -0
  49. data/vendor/assets/javascripts/material-ui/components/slider.jsx +178 -0
  50. data/vendor/assets/javascripts/material-ui/components/snackbar.jsx +76 -0
  51. data/vendor/assets/javascripts/material-ui/components/svg-icons/drop-down-arrow.jsx +16 -0
  52. data/vendor/assets/javascripts/material-ui/components/svg-icons/navigation-chevron-left.jsx +16 -0
  53. data/vendor/assets/javascripts/material-ui/components/svg-icons/navigation-chevron-right.jsx +17 -0
  54. data/vendor/assets/javascripts/material-ui/components/svg-icons/navigation-menu.jsx +16 -0
  55. data/vendor/assets/javascripts/material-ui/components/svg-icons/svg-icon.jsx +23 -0
  56. data/vendor/assets/javascripts/material-ui/components/svg-icons/toggle-check-box-checked.jsx +16 -0
  57. data/vendor/assets/javascripts/material-ui/components/svg-icons/toggle-check-box-outline-blank.jsx +16 -0
  58. data/vendor/assets/javascripts/material-ui/components/svg-icons/toggle-radio-button-off.jsx +16 -0
  59. data/vendor/assets/javascripts/material-ui/components/svg-icons/toggle-radio-button-on.jsx +16 -0
  60. data/vendor/assets/javascripts/material-ui/components/table-header.jsx +50 -0
  61. data/vendor/assets/javascripts/material-ui/components/table-rows-item.jsx +31 -0
  62. data/vendor/assets/javascripts/material-ui/components/table-rows.jsx +57 -0
  63. data/vendor/assets/javascripts/material-ui/components/tabs/tab.jsx +38 -0
  64. data/vendor/assets/javascripts/material-ui/components/tabs/tabTemplate.jsx +15 -0
  65. data/vendor/assets/javascripts/material-ui/components/tabs/tabs.jsx +96 -0
  66. data/vendor/assets/javascripts/material-ui/components/text-field.jsx +215 -0
  67. data/vendor/assets/javascripts/material-ui/components/toggle.jsx +62 -0
  68. data/vendor/assets/javascripts/material-ui/components/toolbar-group.jsx +28 -0
  69. data/vendor/assets/javascripts/material-ui/components/toolbar.jsx +21 -0
  70. data/vendor/assets/javascripts/material-ui/components/tooltip.jsx +58 -0
  71. data/vendor/assets/javascripts/material-ui/components/transition-groups/slide-in.jsx +48 -0
  72. data/vendor/assets/javascripts/material-ui/components/utils/css-event.js +52 -0
  73. data/vendor/assets/javascripts/material-ui/components/utils/date-time.js +132 -0
  74. data/vendor/assets/javascripts/material-ui/components/utils/dom.js +71 -0
  75. data/vendor/assets/javascripts/material-ui/components/utils/events.js +34 -0
  76. data/vendor/assets/javascripts/material-ui/components/utils/key-code.js +10 -0
  77. data/vendor/assets/javascripts/material-ui/components/utils/key-line.js +13 -0
  78. data/vendor/assets/javascripts/material-ui/components/utils/unique-id.js +7 -0
  79. data/vendor/assets/stylesheets/material-ui.less +2 -0
  80. data/vendor/assets/stylesheets/material-ui/components.less +5 -0
  81. data/vendor/assets/stylesheets/material-ui/components/app-bar.less +37 -0
  82. data/vendor/assets/stylesheets/material-ui/components/card.less +20 -0
  83. data/vendor/assets/stylesheets/material-ui/components/checkbox.less +66 -0
  84. data/vendor/assets/stylesheets/material-ui/components/components.less +37 -0
  85. data/vendor/assets/stylesheets/material-ui/components/date-picker/calendar-month.less +11 -0
  86. data/vendor/assets/stylesheets/material-ui/components/date-picker/calendar-toolbar.less +23 -0
  87. data/vendor/assets/stylesheets/material-ui/components/date-picker/calendar.less +59 -0
  88. data/vendor/assets/stylesheets/material-ui/components/date-picker/date-display.less +84 -0
  89. data/vendor/assets/stylesheets/material-ui/components/date-picker/date-picker-dialog.less +18 -0
  90. data/vendor/assets/stylesheets/material-ui/components/date-picker/date-picker.less +9 -0
  91. data/vendor/assets/stylesheets/material-ui/components/date-picker/day-button.less +35 -0
  92. data/vendor/assets/stylesheets/material-ui/components/dialog-window.less +42 -0
  93. data/vendor/assets/stylesheets/material-ui/components/dialog.less +10 -0
  94. data/vendor/assets/stylesheets/material-ui/components/drop-down-icon.less +43 -0
  95. data/vendor/assets/stylesheets/material-ui/components/drop-down-menu.less +77 -0
  96. data/vendor/assets/stylesheets/material-ui/components/enhanced-button.less +24 -0
  97. data/vendor/assets/stylesheets/material-ui/components/enhanced-switch.less +52 -0
  98. data/vendor/assets/stylesheets/material-ui/components/enhanced-textarea.less +16 -0
  99. data/vendor/assets/stylesheets/material-ui/components/flat-button.less +93 -0
  100. data/vendor/assets/stylesheets/material-ui/components/floating-action-button.less +95 -0
  101. data/vendor/assets/stylesheets/material-ui/components/font-icon.less +6 -0
  102. data/vendor/assets/stylesheets/material-ui/components/icon-button.less +46 -0
  103. data/vendor/assets/stylesheets/material-ui/components/ink-bar.less +9 -0
  104. data/vendor/assets/stylesheets/material-ui/components/input.less +186 -0
  105. data/vendor/assets/stylesheets/material-ui/components/left-nav.less +31 -0
  106. data/vendor/assets/stylesheets/material-ui/components/menu-item.less +69 -0
  107. data/vendor/assets/stylesheets/material-ui/components/menu.less +50 -0
  108. data/vendor/assets/stylesheets/material-ui/components/overlay.less +21 -0
  109. data/vendor/assets/stylesheets/material-ui/components/paper.less +59 -0
  110. data/vendor/assets/stylesheets/material-ui/components/radio-button.less +67 -0
  111. data/vendor/assets/stylesheets/material-ui/components/raised-button.less +132 -0
  112. data/vendor/assets/stylesheets/material-ui/components/ripples/circle.less +31 -0
  113. data/vendor/assets/stylesheets/material-ui/components/ripples/focus-ripple.less +30 -0
  114. data/vendor/assets/stylesheets/material-ui/components/ripples/touch-ripple.less +9 -0
  115. data/vendor/assets/stylesheets/material-ui/components/slider.less +163 -0
  116. data/vendor/assets/stylesheets/material-ui/components/snackbar.less +44 -0
  117. data/vendor/assets/stylesheets/material-ui/components/subheader.less +17 -0
  118. data/vendor/assets/stylesheets/material-ui/components/svg-icon.less +11 -0
  119. data/vendor/assets/stylesheets/material-ui/components/table.less +46 -0
  120. data/vendor/assets/stylesheets/material-ui/components/tabs.less +41 -0
  121. data/vendor/assets/stylesheets/material-ui/components/text-field.less +168 -0
  122. data/vendor/assets/stylesheets/material-ui/components/toggle.less +83 -0
  123. data/vendor/assets/stylesheets/material-ui/components/toolbar.less +95 -0
  124. data/vendor/assets/stylesheets/material-ui/components/tooltip.less +73 -0
  125. data/vendor/assets/stylesheets/material-ui/components/transition-groups/slide-in.less +92 -0
  126. data/vendor/assets/stylesheets/material-ui/core/base.less +31 -0
  127. data/vendor/assets/stylesheets/material-ui/core/core.less +4 -0
  128. data/vendor/assets/stylesheets/material-ui/core/keylines.less +29 -0
  129. data/vendor/assets/stylesheets/material-ui/core/layouts.less +12 -0
  130. data/vendor/assets/stylesheets/material-ui/core/typography.less +158 -0
  131. data/vendor/assets/stylesheets/material-ui/mixins/clearfix.less +22 -0
  132. data/vendor/assets/stylesheets/material-ui/mixins/mixins.less +3 -0
  133. data/vendor/assets/stylesheets/material-ui/mixins/no-wrap.less +3 -0
  134. data/vendor/assets/stylesheets/material-ui/mixins/transitions.less +17 -0
  135. data/vendor/assets/stylesheets/material-ui/resets/normalize.css +430 -0
  136. data/vendor/assets/stylesheets/material-ui/resets/typography-resets.less +34 -0
  137. data/vendor/assets/stylesheets/material-ui/scaffolding.less +10 -0
  138. data/vendor/assets/stylesheets/material-ui/variables/colors.less +285 -0
  139. data/vendor/assets/stylesheets/material-ui/variables/custom-variables.less +163 -0
  140. data/vendor/assets/stylesheets/material-ui/variables/media-queries.less +4 -0
  141. data/vendor/assets/stylesheets/material-ui/variables/spacing.less +16 -0
  142. metadata +268 -0
@@ -0,0 +1,215 @@
1
+ var React = require('react');
2
+ var Classable = require('./mixins/classable');
3
+ var UniqueId = require('./utils/unique-id');
4
+ var EnhancedTextarea = require('./enhanced-textarea');
5
+
6
+ var TextField = React.createClass({
7
+
8
+ mixins: [Classable],
9
+
10
+ propTypes: {
11
+ errorText: React.PropTypes.string,
12
+ floatingLabelText: React.PropTypes.string,
13
+ hintText: React.PropTypes.string,
14
+ id: React.PropTypes.string,
15
+ multiLine: React.PropTypes.bool,
16
+ onBlur: React.PropTypes.func,
17
+ onChange: React.PropTypes.func,
18
+ onFocus: React.PropTypes.func,
19
+ onKeyDown: React.PropTypes.func,
20
+ onEnterKeyDown: React.PropTypes.func,
21
+ type: React.PropTypes.string
22
+ },
23
+
24
+ getDefaultProps: function() {
25
+ return {
26
+ type: 'text'
27
+ };
28
+ },
29
+
30
+ getInitialState: function() {
31
+ return {
32
+ errorText: this.props.errorText,
33
+ hasValue: this.props.value || this.props.defaultValue ||
34
+ (this.props.valueLink && this.props.valueLink.value)
35
+ };
36
+ },
37
+
38
+ componentWillReceiveProps: function(nextProps) {
39
+ var hasErrorProp = nextProps.hasOwnProperty('errorText');
40
+ var hasValueLinkProp = nextProps.hasOwnProperty('valueLink');
41
+ var hasValueProp = nextProps.hasOwnProperty('value');
42
+ var hasNewDefaultValue = nextProps.defaultValue !== this.props.defaultValue;
43
+ var newState = {};
44
+
45
+ if (hasValueProp) {
46
+ newState.hasValue = nextProps.value;
47
+ } else if (hasValueLinkProp) {
48
+ newState.hasValue = nextProps.valueLink.value;
49
+ } else if (hasNewDefaultValue) {
50
+ newState.hasValue = nextProps.defaultValue;
51
+ }
52
+
53
+ if (hasErrorProp) newState.errorText = nextProps.errorText;
54
+ if (newState) this.setState(newState);
55
+ },
56
+
57
+ render: function() {
58
+ var {
59
+ className,
60
+ errorText,
61
+ floatingLabelText,
62
+ hintText,
63
+ id,
64
+ multiLine,
65
+ onBlur,
66
+ onChange,
67
+ onFocus,
68
+ type,
69
+ ...other
70
+ } = this.props;
71
+
72
+ var classes = this.getClasses('mui-text-field', {
73
+ 'mui-has-error': this.props.errorText,
74
+ 'mui-has-floating-labels': this.props.floatingLabelText,
75
+ 'mui-has-value': this.state.hasValue,
76
+ 'mui-is-disabled': this.props.disabled,
77
+ 'mui-is-focused': this.state.isFocused,
78
+ 'mui-is-multiLine': this.props.multiLine
79
+ });
80
+
81
+ var inputId = this.props.id || UniqueId.generate();
82
+
83
+ var errorTextElement = this.state.errorText ? (
84
+ <div className="mui-text-field-error">{this.state.errorText}</div>
85
+ ) : null;
86
+
87
+ var hintTextElement = this.props.hintText ? (
88
+ <div className="mui-text-field-hint">{this.props.hintText}</div>
89
+ ) : null;
90
+
91
+ var floatingLabelTextElement = this.props.floatingLabelText ? (
92
+ <label
93
+ className="mui-text-field-floating-label"
94
+ htmlFor={inputId}>
95
+ {this.props.floatingLabelText}
96
+ </label>
97
+ ) : null;
98
+
99
+ var inputProps;
100
+ var inputElement;
101
+
102
+ inputProps = {
103
+ ref: 'input',
104
+ className: 'mui-text-field-input',
105
+ id: inputId,
106
+ onBlur: this._handleInputBlur,
107
+ onFocus: this._handleInputFocus,
108
+ onKeyDown: this._handleInputKeyDown
109
+ };
110
+
111
+ if (!this.props.hasOwnProperty('valueLink')) {
112
+ inputProps.onChange = this._handleInputChange;
113
+ }
114
+
115
+ inputElement = this.props.multiLine ? (
116
+ <EnhancedTextarea
117
+ {...other}
118
+ {...inputProps}
119
+ onHeightChange={this._handleTextAreaHeightChange}
120
+ textareaClassName="mui-text-field-textarea" />
121
+ ) : (
122
+ <input
123
+ {...other}
124
+ {...inputProps}
125
+ type={this.props.type} />
126
+ );
127
+
128
+ return (
129
+ <div className={classes}>
130
+
131
+ {floatingLabelTextElement}
132
+ {hintTextElement}
133
+ {inputElement}
134
+
135
+ <hr className="mui-text-field-underline" />
136
+ <hr className="mui-text-field-focus-underline" />
137
+
138
+ {errorTextElement}
139
+
140
+ </div>
141
+ );
142
+ },
143
+
144
+ blur: function() {
145
+ if (this.isMounted()) this._getInputNode().blur();
146
+ },
147
+
148
+ clearValue: function() {
149
+ this.setValue('');
150
+ },
151
+
152
+ focus: function() {
153
+ if (this.isMounted()) this._getInputNode().focus();
154
+ },
155
+
156
+ getValue: function() {
157
+ return this.isMounted() ? this._getInputNode().value : undefined;
158
+ },
159
+
160
+ setErrorText: function(newErrorText) {
161
+ if (process.NODE_ENV !== 'production' && this.props.hasOwnProperty('errorText')) {
162
+ console.error('Cannot call TextField.setErrorText when errorText is defined as a property.');
163
+ } else if (this.isMounted()) {
164
+ this.setState({errorText: newErrorText});
165
+ }
166
+ },
167
+
168
+ setValue: function(newValue) {
169
+ if (process.NODE_ENV !== 'production' && this._isControlled()) {
170
+ console.error('Cannot call TextField.setValue when value or valueLink is defined as a property.');
171
+ } else if (this.isMounted()) {
172
+ this._getInputNode().value = newValue;
173
+ this.setState({hasValue: newValue});
174
+ }
175
+ },
176
+
177
+ _getInputNode: function() {
178
+ return this.props.multiLine ?
179
+ this.refs.input.getInputNode() : this.refs.input.getDOMNode();
180
+ },
181
+
182
+ _handleInputBlur: function(e) {
183
+ this.setState({isFocused: false});
184
+ if (this.props.onBlur) this.props.onBlur(e);
185
+ },
186
+
187
+ _handleInputChange: function(e) {
188
+ this.setState({hasValue: e.target.value});
189
+ if (this.props.onChange) this.props.onChange(e);
190
+ },
191
+
192
+ _handleInputFocus: function(e) {
193
+ this.setState({isFocused: true});
194
+ if (this.props.onFocus) this.props.onFocus(e);
195
+ },
196
+
197
+ _handleInputKeyDown: function(e) {
198
+ if (e.keyCode === 13 && this.props.onEnterKeyDown) this.props.onEnterKeyDown(e);
199
+ if (this.props.onKeyDown) this.props.onKeyDown(e);
200
+ },
201
+
202
+ _handleTextAreaHeightChange: function(e, height) {
203
+ var newHeight = height + 24;
204
+ if (this.props.floatingLabelText) newHeight += 24;
205
+ this.getDOMNode().style.height = newHeight + 'px';
206
+ },
207
+
208
+ _isControlled: function() {
209
+ return this.props.hasOwnProperty('value') ||
210
+ this.props.hasOwnProperty('valueLink');
211
+ }
212
+
213
+ });
214
+
215
+ module.exports = TextField;
@@ -0,0 +1,62 @@
1
+ var React = require('react');
2
+ var Classable = require('./mixins/classable');
3
+ var Paper = require('./paper');
4
+ var EnhancedSwitch = require('./enhanced-switch');
5
+
6
+ var Toggle = React.createClass({
7
+
8
+ mixins: [Classable],
9
+
10
+ propTypes: {
11
+ onToggle: React.PropTypes.func,
12
+ toggled: React.PropTypes.bool,
13
+ defaultToggled: React.PropTypes.bool
14
+ },
15
+
16
+ render: function() {
17
+ var {
18
+ onToggle,
19
+ ...other
20
+ } = this.props;
21
+
22
+ var toggleElement = (
23
+ <div>
24
+ <div className="mui-toggle-track" />
25
+ <Paper className="mui-toggle-thumb" zDepth={1}/>
26
+ </div>
27
+ );
28
+
29
+ var enhancedSwitchProps = {
30
+ ref: "enhancedSwitch",
31
+ inputType: "checkbox",
32
+ switchElement: toggleElement,
33
+ className: "mui-toggle",
34
+ iconClassName: "mui-toggle-icon",
35
+ onSwitch: this._handleToggle,
36
+ defaultSwitched: this.props.defaultToggled,
37
+ labelPosition: (this.props.labelPosition) ? this.props.labelPosition : "left"
38
+ };
39
+
40
+ if (this.props.hasOwnProperty('toggled')) enhancedSwitchProps.checked = this.props.toggled;
41
+
42
+ return (
43
+ <EnhancedSwitch
44
+ {...other}
45
+ {...enhancedSwitchProps}/>
46
+ );
47
+ },
48
+
49
+ isToggled: function() {
50
+ return this.refs.enhancedSwitch.isSwitched();
51
+ },
52
+
53
+ setToggled: function(newToggledValue) {
54
+ this.refs.enhancedSwitch.setSwitched(newToggledValue);
55
+ },
56
+
57
+ _handleToggle: function(e, isInputChecked) {
58
+ if (this.props.onToggle) this.props.onToggle(e, isInputChecked);
59
+ }
60
+ });
61
+
62
+ module.exports = Toggle;
@@ -0,0 +1,28 @@
1
+ var Classable = require('./mixins/classable');
2
+ var React = require('react');
3
+
4
+ var ToolbarGroup = React.createClass({
5
+
6
+ propTypes: {
7
+ float: React.PropTypes.string
8
+ },
9
+
10
+ mixins: [Classable],
11
+
12
+ render: function() {
13
+
14
+ var classes = this.getClasses('mui-toolbar-group', {
15
+ 'mui-left': this.props.float === 'left',
16
+ 'mui-right': this.props.float === 'right'
17
+ });
18
+
19
+ return (
20
+ <div className={classes}>
21
+ {this.props.children}
22
+ </div>
23
+ );
24
+ }
25
+
26
+ });
27
+
28
+ module.exports = ToolbarGroup;
@@ -0,0 +1,21 @@
1
+ var Classable = require('./mixins/classable');
2
+ var React = require('react');
3
+
4
+ var Toolbar = React.createClass({
5
+
6
+ mixins: [Classable],
7
+
8
+ render: function() {
9
+ var classes = this.getClasses('mui-toolbar', {
10
+ });
11
+
12
+ return (
13
+ <div className={classes}>
14
+ {this.props.children}
15
+ </div>
16
+ );
17
+ }
18
+
19
+ });
20
+
21
+ module.exports = Toolbar;
@@ -0,0 +1,58 @@
1
+ var React = require('react');
2
+ var Classable = require('./mixins/classable');
3
+
4
+ var Tooltip = React.createClass({
5
+
6
+ mixins: [Classable],
7
+
8
+ propTypes: {
9
+ className: React.PropTypes.string,
10
+ label: React.PropTypes.string.isRequired,
11
+ show: React.PropTypes.bool,
12
+ touch: React.PropTypes.bool
13
+ },
14
+
15
+ componentDidMount: function() {
16
+ this._setRippleSize();
17
+ },
18
+
19
+ componentDidUpdate: function(prevProps, prevState) {
20
+ this._setRippleSize();
21
+ },
22
+
23
+ render: function() {
24
+ var {
25
+ className,
26
+ label,
27
+ ...other } = this.props;
28
+ var classes = this.getClasses('mui-tooltip', {
29
+ 'mui-is-shown': this.props.show,
30
+ 'mui-is-touch': this.props.touch
31
+ });
32
+
33
+ return (
34
+ <div {...other} className={classes}>
35
+ <div ref="ripple" className="mui-tooltip-ripple" />
36
+ <span className="mui-tooltip-label">{this.props.label}</span>
37
+ </div>
38
+ );
39
+ },
40
+
41
+ _setRippleSize: function() {
42
+ var ripple = this.refs.ripple.getDOMNode();
43
+ var tooltipSize = this.getDOMNode().offsetWidth;
44
+ var ripplePadding = this.props.touch ? 45 : 20;
45
+ var rippleSize = tooltipSize + ripplePadding + 'px';
46
+
47
+ if (this.props.show) {
48
+ ripple.style.height = rippleSize;
49
+ ripple.style.width = rippleSize;
50
+ } else {
51
+ ripple.style.width = '0px';
52
+ ripple.style.height = '0px';
53
+ }
54
+ }
55
+
56
+ });
57
+
58
+ module.exports = Tooltip;
@@ -0,0 +1,48 @@
1
+ var React = require('react/addons');
2
+ var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
3
+ var Classable = require('../mixins/classable');
4
+
5
+ var SlideIn = React.createClass({
6
+
7
+ mixins: [Classable],
8
+
9
+ propTypes: {
10
+ direction: React.PropTypes.oneOf(['left', 'right', 'up', 'down'])
11
+ },
12
+
13
+ getDefaultProps: function() {
14
+ return {
15
+ direction: 'left'
16
+ };
17
+ },
18
+
19
+ render: function() {
20
+ var {
21
+ className,
22
+ direction,
23
+ ...other
24
+ } = this.props;
25
+ var classes = this.getClasses('mui-transition-slide-in');
26
+
27
+ classes += ' mui-is-' + this.props.direction;
28
+
29
+ //Add a custom className to every child
30
+ React.Children.forEach(this.props.children, function(child) {
31
+ child.props.className = child.props.className ?
32
+ child.props.className + ' mui-transition-slide-in-child':
33
+ 'mui-transition-slide-in-child';
34
+ });
35
+
36
+ return (
37
+ <ReactCSSTransitionGroup {...other}
38
+ className={classes}
39
+ transitionName="mui-transition-slide-in"
40
+ component="div">
41
+ {this.props.children}
42
+ </ReactCSSTransitionGroup>
43
+ );
44
+ }
45
+
46
+ });
47
+
48
+ module.exports = SlideIn;
@@ -0,0 +1,52 @@
1
+ var Events = require('./events');
2
+
3
+ module.exports = {
4
+
5
+ _testSupportedProps: function(props) {
6
+ var i,
7
+ undefined,
8
+ el = document.createElement('div');
9
+
10
+ for (i in props) {
11
+ if (props.hasOwnProperty(i) && el.style[i] !== undefined) {
12
+ return props[i];
13
+ }
14
+ }
15
+ },
16
+
17
+ //Returns the correct event name to use
18
+ transitionEndEventName: function() {
19
+ return this._testSupportedProps({
20
+ 'transition':'transitionend',
21
+ 'OTransition':'otransitionend',
22
+ 'MozTransition':'transitionend',
23
+ 'WebkitTransition':'webkitTransitionEnd'
24
+ });
25
+ },
26
+
27
+ animationEndEventName: function() {
28
+ return this._testSupportedProps({
29
+ 'animation': 'animationend',
30
+ '-o-animation': 'oAnimationEnd',
31
+ '-moz-animation': 'animationend',
32
+ '-webkit-animation': 'webkitAnimationEnd'
33
+ });
34
+ },
35
+
36
+ onTransitionEnd: function (el, callback) {
37
+ var transitionEnd = this.transitionEndEventName();
38
+
39
+ Events.once(el, transitionEnd, function() {
40
+ return callback();
41
+ });
42
+ },
43
+
44
+ onAnimationEnd: function (el, callback) {
45
+ var animationEnd = this.animationEndEventName();
46
+
47
+ Events.once(el, animationEnd, function() {
48
+ return callback();
49
+ });
50
+ }
51
+
52
+ };