Skip to content

Commit 7eb81fb

Browse files
committed
Fixed typo "suggestions"
1 parent 9d31e56 commit 7eb81fb

File tree

2 files changed

+33
-27
lines changed

2 files changed

+33
-27
lines changed

components/autocomplete/index.cjsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = React.createClass
3030
getInitialState: ->
3131
focus : false
3232
dataSource : _index @props.dataSource
33-
sugestions : {}
33+
suggestions : {}
3434
values : {}
3535

3636
# -- Lifecycle
@@ -39,33 +39,33 @@ module.exports = React.createClass
3939

4040
# -- Events
4141
onFocus: ->
42-
@refs.sugestions.getDOMNode().scrollTop = 0
43-
@setState focus: true, sugestions: @_getSugestions()
42+
@refs.suggestions.getDOMNode().scrollTop = 0
43+
@setState focus: true, suggestions: @_getSuggestions()
4444

4545
onBlur: (event) ->
46-
setTimeout (=> @setState focus: false, sugestions: {}), 300
46+
setTimeout (=> @setState focus: false, suggestions: {}), 300
4747

4848
onChange: ->
49-
sugestions = {}
49+
suggestions = {}
5050
value = @refs.input.getValue().toLowerCase().trim()
5151
if value.length > 0
52-
@setState focus: true, sugestions: sugestions = @_getSugestions value
53-
@setState focus: false if Object.keys(sugestions).length is 0
52+
@setState focus: true, suggestions: suggestions = @_getSuggestions value
53+
@setState focus: false if Object.keys(suggestions).length is 0
5454

5555
onKeyPress: (event) ->
5656
query = @refs.input.getValue().trim()
5757
if event.which is 13 and query isnt ""
58-
for key, label of @state.sugestions when query.toLowerCase() is label.toLowerCase()
59-
sugestion = {"#{key}": label}
58+
for key, label of @state.suggestions when query.toLowerCase() is label.toLowerCase()
59+
suggestion = {"#{key}": label}
6060
break
6161
unless @props.exact
62-
@_addValue sugestion or {"#{query}": query}
63-
else if sugestion
64-
@_addValue sugestion
62+
@_addValue suggestion or {"#{query}": query}
63+
else if suggestion
64+
@_addValue suggestion
6565

6666
onSelect: (event) ->
6767
key = event.target.getAttribute "id"
68-
@_addValue {"#{key}": @state.sugestions[key]}
68+
@_addValue {"#{key}": @state.suggestions[key]}
6969

7070
onDelete: (event) ->
7171
delete @state.values[event.target.getAttribute "id"]
@@ -84,8 +84,8 @@ module.exports = React.createClass
8484
}
8585
<Input {...@props} value="" ref="input" onChange={@onChange}
8686
onKeyPress={@onKeyPress} onFocus={@onFocus} onBlur={@onBlur}/>
87-
<ul ref="sugestions" data-role="sugestions" onClick={@onSelect}>
88-
{<li id={key}>{label}</li> for key, label of @state.sugestions}
87+
<ul ref="suggestions" data-role="suggestions" onClick={@onSelect}>
88+
{<li id={key}>{label}</li> for key, label of @state.suggestions}
8989
</ul>
9090
</div>
9191

@@ -118,12 +118,12 @@ module.exports = React.createClass
118118
@refs.input.setValue if @props.multiple then "" else value[key]
119119
@props.onChange? @
120120

121-
_getSugestions: (query) ->
122-
sugestions = {}
121+
_getSuggestions: (query) ->
122+
suggestions = {}
123123
for key, label of @state.dataSource when not @state.values[key]
124124
if not query or label.toLowerCase().trim().indexOf(query) is 0
125-
sugestions[key] = label
126-
sugestions
125+
suggestions[key] = label
126+
suggestions
127127

128128
# -- Private methods
129129
_index = (data = {}) ->

components/autocomplete/style.styl

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,38 @@
33
[data-component-autocomplete]
44
position : relative
55
// -- Children
6+
> [data-role] > *
7+
font-size : FONT_SIZE_SMALL
8+
cursor : pointer
69
> [data-role="values"]
710
> *
811
display : inline-block
9-
margin-right : (SPACE / 2)
10-
padding : (SPACE / 2)
12+
margin : 0 (SPACE / 2) (SPACE / 2) 0
13+
padding : (SPACE / 4) (SPACE / 2)
1114
font-size : FONT_SIZE_SMALL
1215
color : WHITE
1316
background-color : THEME
14-
cursor : pointer
15-
> [data-role="sugestions"]
16-
z-index : 1
17+
border-radius : (SPACE / 8)
18+
> [data-role="suggestions"]
19+
z-index : 10
1720
position : absolute
1821
width : 100%
1922
overflow-x : hidden
2023
overflow-y : scroll
21-
max-height : (2 * UNIT)
24+
max-height : 0
2225
margin-top : -(SPACE)
2326
background-color : WHITE
24-
cursor : pointer
2527
visibility : hidden
28+
box-shadow : ZDEPTH_SHADOW_1
29+
transition max-height ANIMATION_DURATION ANIMATION_EASE
2630
> *
2731
padding : (SPACE / 2)
2832
&:hover
33+
color : WHITE
2934
background-color : THEME
3035

3136
// -- Styles
3237
&.focus
33-
> [data-role="sugestions"]
38+
> [data-role="suggestions"]
39+
max-height : 25vh
3440
visibility : visible

0 commit comments

Comments
 (0)