Skip to content

Commit

Permalink
Merge branch 'release/0.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
furqanZafar committed Oct 16, 2015
2 parents 939524a + f532883 commit 57270c8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,7 @@
* added missing dependency react-addons-css-transition-group to package.json

## v0.3.4 / 14th October 2015
* fixed a bug where the height of the ".dropdown-transition" element blocked the dom underneath (#6)
* fixed a bug where the height of the ".dropdown-transition" element blocked the dom underneath (#6)

## v0.3.5 / 16th October 2015
* improved the default auto-size implementation
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LIVE DEMO: [furqanZafar.github.io/react-selectize](http://furqanZafar.github.io/

[![](http://i.imgsafe.co/rQmogzn.gif)](http://furqanZafar.github.io/react-selectize/)

- [Changelog](CHANGELOG.md) (last updated on 14th October 2015)
- [Changelog](CHANGELOG.md) (last updated on 16th October 2015)
- [API Reference](API.md)

# Motivation
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-selectize",
"version": "0.3.4",
"description": "react implementation of selectize",
"version": "0.3.5",
"description": "A Stateless & Flexible Select component for React inspired by Selectize",
"main": "src/index.js",
"scripts": {
"test": "mocha test/index.ls --compilers ls:livescript",
Expand Down
43 changes: 24 additions & 19 deletions src/ReactSelectize.ls
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,33 @@ module.exports = create-class do
# get-default-props :: a -> Props
get-default-props: ->
anchor: null
# autosize :: InputElement -> Int
autosize: ($search) ->
# autosize :: InputElement -> Voud
autosize: ($search) !->

# modern browsers
if $search.scroll-width > 0
$search.style.width = "#{2 + $search.scroll-width}px"
if $search.value.length == 0
$search.style.width = if !!$search?.current-style then \4px else \2px

# IE / Edge
else
$input = document.create-element \div
..innerHTML = $search.value

# copy all the styles of the search input
(if !!$search.current-style then $search.current-style else (document.default-view ? window .get-computed-style $search))
|> obj-to-pairs
|> each ([key, value]) -> $input.style[key] = value
|> -> $input.style.width = ""

# add a new input element to document.body and measure the text width
document.body.append-child $input
$search.style.width = "#{4 + $input.client-width}px"
document.body.remove-child $input

# modern browsers
if $search.scroll-width > 0
$search.style.width = "#{2 + $search.scroll-width}px"

# IE / Edge
else
$input = document.create-element \div
..innerHTML = $search.value

# copy all the styles of the search input
(if !!$search.current-style then $search.current-style else (document.default-view ? window .get-computed-style $search))
|> obj-to-pairs
|> each ([key, value]) -> $input.style[key] = value
|> -> $input.style.width = ""

# add a new input element to document.body and measure the text width
document.body.append-child $input
$search.style.width = "#{4 + $input.client-width}px"
document.body.remove-child $input

# class-name :: String
disabled: false
Expand Down

0 comments on commit 57270c8

Please sign in to comment.