Added propTypes to Measurer and Dropdown

Summary:
Added some propTypes and refactored Dropdown so that the widget
doesn't know which choice is correct (instead grading itself via the rubric).

Reviewers: jack

Differential Revision: http://phabricator.khanacademy.org/D9894
Added propTypes to Measurer and Dropdown

Summary:
Added some propTypes and refactored Dropdown so that the widget
doesn't know which choice is correct (instead grading itself via the rubric).

Test Plan:
- Run Perseus.
- Load this [Dropdown and Measurer](http://localhost:9000/test.html#content=%7B%22question%22%3A%7B%22content%22%3A%22%5B%5B%E2%98%83%20dropdown%201%5D%5D%5Cn%5Cn%5B%5B%E2%98%83%20measurer%201%5D%5D%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%22dropdown%201%22%3A%7B%22type%22%3A%22dropdown%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22choices%22%3A%5B%7B%22content%22%3A%22ABC%22%2C%22correct%22%3Afalse%7D%2C%7B%22content%22%3A%22DEF%22%2C%22correct%22%3Atrue%7D%5D%2C%22placeholder%22%3A%22Letters%22%7D%7D%2C%22measurer%201%22%3A%7B%22type%22%3A%22measurer%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22box%22%3A%5B480%2C480%5D%2C%22imageUrl%22%3Anull%2C%22imageTop%22%3A0%2C%22imageLeft%22%3A0%2C%22showProtractor%22%3Atrue%2C%22showRuler%22%3Afalse%2C%22rulerLabel%22%3A%22%22%2C%22rulerTicks%22%3A10%2C%22rulerPixels%22%3A40%2C%22rulerLength%22%3A10%7D%7D%7D%7D%2C%22answerArea%22%3A%7B%22type%22%3A%22multiple%22%2C%22options%22%3A%7B%22content%22%3A%22%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%2C%22calculator%22%3Afalse%7D%2C%22hints%22%3A%5B%5D%7D). Confirm that there are no console warnings RE prop types.
- Confirm that the Dropdown grades correctly as well.

Reviewers: jack, eater

Reviewed By: eater

Subscribers: eater

Differential Revision: http://phabricator.khanacademy.org/D9894
Radio: Make labels work on mobile (non-broken?)

Summary:
There is a long-standing mobile webkit bug with labels, where
clicking the text inside a label won't check the input correctly.

This diff adds onTouchStart and onTouchEnd handlers to the radio
labels that re-implement the label elements' functionality in
react, so that perseus radio labels work correctly on mobile.

This diff also changes the radio's implementation to use
pure controlled components, rather than grabbing the DOM state
of radio/checkbox inputs after an event occurs.

This implementation makes the pseudo-label and checkbox
independent, to avoid the bug the last version of this caused.

Test Plan:
On the web:
 * Tested grading various radios in normal chrome's test.html
In the mobile app:
 * Tested clicking on a wrong answer, then a right answer's text,
   and made sure that doing this on multiple questions graded
   correctly
 * Now tested with multiple selections, both clicking on the
   checkboxes and the labels

Reviewers: eater

Reviewed By: eater

Subscribers: alpert, ben

Differential Revision: http://phabricator.khanacademy.org/D9962
Instructions text no longer uses point-events: none

Summary:
Click-to-add-points instructions text is now handled by the underlying Graphie,
allowing us to avoid usage of 'point-events:none', which doesn't have great browser support.
In graph.jsx:_setupGraphie(), the Graphie object adds a div containing its instructions text
and registers some event handlers to fade it in and out, and remove it on click. Fixes T2720.

Test Plan: Try [click to add points](http://localhost:9000/test.html#content=%7B%22question%22%3A%7B%22content%22%3A%22%5B%5B%E2%98%83%20interactive-graph%201%5D%5D%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%22interactive-graph%201%22%3A%7B%22type%22%3A%22interactive-graph%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22step%22%3A%5B1%2C1%5D%2C%22backgroundImage%22%3A%7B%22url%22%3Anull%2C%22scale%22%3A1%2C%22bottom%22%3A0%2C%22left%22%3A0%7D%2C%22markings%22%3A%22graph%22%2C%22labels%22%3A%5B%22x%22%2C%22y%22%5D%2C%22showProtractor%22%3Afalse%2C%22showRuler%22%3Afalse%2C%22rulerLabel%22%3A%22%22%2C%22rulerTicks%22%3A10%2C%22range%22%3A%5B%5B-10%2C10%5D%2C%5B-10%2C10%5D%5D%2C%22gridStep%22%3A%5B1%2C1%5D%2C%22snapStep%22%3A%5B0.5%2C0.5%5D%2C%22graph%22%3A%7B%22type%22%3A%22point%22%2C%22numPoints%22%3A%22unlimited%22%7D%2C%22correct%22%3A%7B%22type%22%3A%22point%22%2C%22numPoints%22%3A%22unlimited%22%2C%22coords%22%3A%5B%5B-5.5%2C-5.5%5D%2C%5B-5.5%2C4%5D%2C%5B-1%2C4.5%5D%5D%7D%7D%7D%7D%7D%2C%22answerArea%22%3A%7B%22type%22%3A%22multiple%22%2C%22options%22%3A%7B%22content%22%3A%22%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%2C%22calculator%22%3Afalse%7D%2C%22hints%22%3A%5B%5D%7D). Notice the instructions text, as well as how it fades in and out on mouse over and deletes on click. Also note that, in the editor pane, no instructions text is present as several points came pre-loaded.

Reviewers: jack

Reviewed By: jack

Maniphest Tasks: T2720

Differential Revision: http://phabricator.khanacademy.org/D10117
add lights-puzzle wdiget

Summary: Adds a fun puzzle widget to perseus!

Test Plan: Played around with various sizes and tried grading

Reviewers: charlie

Reviewed By: charlie

Subscribers: alex

Differential Revision: http://phabricator.khanacademy.org/D10128
release subperseus lock
comment out onInputError in test.html
Delete the `categorization` widget

Summary:
All `categorizations` now use the `categorizer` widget

Test Plan:
Search all items for `categorization` and see if any appear.

Auditors: eater
Divided matcher height object into separate leftHeight and rightHeight variables

Summary: Some matcher items were having their height set improperly when loaded from JSON due to a
setState-related race condition, as old height values for one side might override the expected
value when setting the height for another side. Now, the height logic is divided up into leftHeight
and rightHeight to avoid these types of problems. Fixes T2734.

Test Plan:

- Check out this change.
- Run `make subperseus` to carry changes over to webapp.
- Run webapp (doesn't repro in local Perseus).
- Grab the JSON from [here](https://www.khanacademy.org/math/geometry/intro_euclid/e/geometric-definitions/edit/x1d32270c678d3a11?mp-r-id=WM3JBkQ=) to get a sample broken question.
- Go to the [item creator](http://localhost:8080/devadmin/content/items/new) and load that JSON in via Developer JSON mode.
- Notice that the cards are sized correctly.
- Play around with the card contents and verify that the sizing remains consistent with expectation.

Auditors: jack

Subscribers: eater
Added non-reduced fractions option to number-line

Summary:
The number-line can now use non-reduced fractions by calculating the LCM of the denominators
and using that as a base. Fixes T2715.

Test Plan:
- Run Perseus.
- Try some number-line examples [here](http://localhost:9000/test.html#content=%7B%22question%22%3A%7B%22content%22%3A%22%5B%5B%E2%98%83%20number-line%201%5D%5D%5Cn%5Cn%5B%5B%E2%98%83%20number-line%202%5D%5D%5Cn%5Cn%5B%5B%E2%98%83%20number-line%203%5D%5D%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%22number-line%201%22%3A%7B%22type%22%3A%22number-line%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22range%22%3A%5B0%2C1%5D%2C%22labelRange%22%3A%5Bnull%2C1%5D%2C%22divisionRange%22%3A%5B1%2C10%5D%2C%22labelStyle%22%3A%22non-reduced%22%2C%22labelTicks%22%3Atrue%2C%22numDivisions%22%3A4%2C%22tickStep%22%3Anull%2C%22snapDivisions%22%3A1%2C%22correctRel%22%3A%22eq%22%2C%22correctX%22%3Anull%2C%22initialX%22%3Anull%2C%22base%22%3A1%7D%7D%2C%22number-line%202%22%3A%7B%22type%22%3A%22number-line%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22range%22%3A%5B-1%2C1%5D%2C%22labelStyle%22%3A%22non-reduced%22%2C%22tickStep%22%3Anull%2C%22divisionRange%22%3A%5B1%2C10%5D%2C%22numDivisions%22%3A6%2C%22labelRange%22%3A%5Bnull%2C1%5D%2C%22labelTicks%22%3Atrue%2C%22snapDivisions%22%3A2%2C%22correctRel%22%3A%22eq%22%2C%22correctX%22%3Anull%2C%22initialX%22%3Anull%2C%22base%22%3A1%7D%7D%2C%22number-line%203%22%3A%7B%22type%22%3A%22number-line%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22labelStyle%22%3A%22non-reduced%22%2C%22tickStep%22%3Anull%2C%22divisionRange%22%3A%5B1%2C50%5D%2C%22numDivisions%22%3A4%2C%22range%22%3A%5B0%2C1%5D%2C%22labelRange%22%3A%5Bnull%2C0.625%5D%2C%22labelTicks%22%3Atrue%2C%22snapDivisions%22%3A2%2C%22correctRel%22%3A%22eq%22%2C%22correctX%22%3Anull%2C%22initialX%22%3Anull%2C%22base%22%3A1%7D%7D%7D%7D%2C%22answerArea%22%3A%7B%22type%22%3A%22multiple%22%2C%22options%22%3A%7B%22content%22%3A%22%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%2C%22calculator%22%3Afalse%7D%2C%22hints%22%3A%5B%5D%7D). Note that adjusting the 'label' position can also affect the base calculation, as seen in the third example on that page.

Reviewers: jack

Reviewed By: jack

Subscribers: eater

Maniphest Tasks: T2715

Differential Revision: http://phabricator.khanacademy.org/D10068
Lights puzzle: Add 'x' and 'plus/x' modes

Summary:
Alternative patterns for lights puzzles

Test Plan:
Solved 3x3 and 4x4 in x mode
Solved 3x3 and 5x5 in alternate mode

Auditors: charlie
Hints are no longer outlined outside Perseus editor

Summary: The CSS selector for outlining hints wasn't quite precise enough and individuals with
Perseus access were seeing hints outlined outside of edit mode. Now, the selector checks that
the hint div immediately follows a hint editor. Fixes T2704.

Test Plan:
- Run Perseus.
- Create a widget + hint and verify that the hint is outlined.
- Run webapp.
- Go to an exercise that was previously outlining hints (e.g., 'Surface and Volume Density Word Problems').
- Verify that hints are no longer outlined.
- Enter Perseus One; verify that hints are outlined in edit more.

Auditors: jack
substate khan-exercises
Lights Puzzle: Add a move counter and reset button

Test Plan:
do a puzzle and press the reset button

Auditors: charlie
Lights puzzle: put moveCount on props

Summary:
Replaces `this._moveCount` with `this.props.moveCount`, which
I realized probably makes this more idiomatic and simpler to
think about.

Test Plan:
Do a puzzle locally; check that movecount starts out
as `0`, not `undefined`, and increments properly

Auditors: charlie
Changed image widget name from 'image-widget' to 'image'

Summary: Naming the image widget 'image-widget' is a little inconsistent with how we name our
other widgets; it'd be better if it were simply 'image'.

Test Plan:
- Run webapp.
- Verify that the image widget operates as expected: change the ranges, add labels, permalink + reload, etc.
- Here's a [sample image](http://localhost:9000/test.html#content=%7B%22question%22%3A%7B%22content%22%3A%22%5B%5B%E2%98%83%20image%201%5D%5D%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%22image%201%22%3A%7B%22type%22%3A%22image%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22backgroundImage%22%3A%7B%22url%22%3A%22https%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2Fb9f5b3b8b6ed17e61f6612e7c0af679ac0853bf0.png%22%2C%22width%22%3A400%2C%22height%22%3A400%7D%2C%22box%22%3A%5B400%2C400%5D%2C%22labels%22%3A%5B%7B%22content%22%3A%22Hello%22%2C%22coordinates%22%3A%5B3%2C0%5D%2C%22alignment%22%3A%22center%22%7D%2C%7B%22content%22%3A%22Goodbye%22%2C%22coordinates%22%3A%5B4%2C-2%5D%2C%22alignment%22%3A%22right%22%7D%5D%2C%22range%22%3A%5B%5B0%2C5%5D%2C%5B-5%2C3%5D%5D%7D%7D%7D%7D%2C%22answerArea%22%3A%7B%22type%22%3A%22multiple%22%2C%22options%22%3A%7B%22content%22%3A%22%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%2C%22calculator%22%3Afalse%7D%2C%22hints%22%3A%5B%5D%7D).

Auditors: jack
package.json: Update deps

We were hitting some large subperseus differences because our
react-components dependency was anything >=0.0.3. I updated
us to be using 0.0.8, so that we shouldn't see huge
react components changes when subperseusing depending on
how recently that dev has locally updated react-components.

I dropped the `>=` or `~` from the version so that a subperseus
is more deterministic. We can just up the version requirement
when we need to update things, and then everyone will see
the update.

Test Plan:
 * npm install
 * make test && make jest
 * make server
 * open up perseus and play around

Auditors: joel
Adding radio button styles for iPad class

Summary: - Added mobile class to radio.less

Test Plan:
Tested on desktop. https://s3.amazonaws.com/uploads.hipchat.com/6574/805139/UssNVPEbGt4cwYB/Screen%20Shot%202014-06-18%20at%2011.38.47%20AM.png
https://s3.amazonaws.com/uploads.hipchat.com/6574/805139/Bjx8e1vXtFMNI5I/Screen%20Shot%202014-06-18%20at%2011.37.33%20AM.png

Reviewers: eater, jack

Reviewed By: jack

Differential Revision: http://phabricator.khanacademy.org/D10211
interactive-graph: don't create invalid points

Summary:
In click-to-add-points, if we can't create a point where you
click, we just don't create a point there, instead of, you
know, creating a point there.

This was happening when a movablePoint2 constraint returned false, which
indicates that it's not valid to move the point there at all, instead of
proposing an alternative location. Now, we watch for this condition,
and remove the point if it is the case.

Test Plan:
[local item](http://localhost:9000/test.html#content=%7B%22question%22%3A%7B%22content%22%3A%22%5B%5B%E2%98%83%20interactive-graph%201%5D%5D%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%22interactive-graph%201%22%3A%7B%22type%22%3A%22interactive-graph%22%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22step%22%3A%5B1%2C1%5D%2C%22backgroundImage%22%3A%7B%22url%22%3Anull%2C%22scale%22%3A1%2C%22bottom%22%3A0%2C%22left%22%3A0%7D%2C%22markings%22%3A%22graph%22%2C%22labels%22%3A%5B%22x%22%2C%22y%22%5D%2C%22showProtractor%22%3Afalse%2C%22showRuler%22%3Afalse%2C%22rulerLabel%22%3A%22%22%2C%22rulerTicks%22%3A10%2C%22range%22%3A%5B%5B-10%2C10%5D%2C%5B-10%2C10%5D%5D%2C%22gridStep%22%3A%5B1%2C1%5D%2C%22snapStep%22%3A%5B2%2C2%5D%2C%22graph%22%3A%7B%22type%22%3A%22point%22%2C%22numPoints%22%3A%22unlimited%22%7D%2C%22correct%22%3A%7B%22type%22%3A%22point%22%2C%22numPoints%22%3A%22unlimited%22%2C%22coords%22%3Anull%7D%7D%7D%7D%7D%2C%22answerArea%22%3A%7B%22type%22%3A%22multiple%22%2C%22options%22%3A%7B%22content%22%3A%22%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%2C%22calculator%22%3Afalse%7D%2C%22hints%22%3A%5B%5D%7D)
 * Add four points in a 2x2 square
 * try to add a point in the center of these points
 * verify that you can do so before this commit, but cannot after this
   commit

Auditors: charlie
Move DragTarget to react-components.

Test Plan:
* open http://dev:9001/test.html
* drag an image from my desktop to the question area
* see "![](http://fake.image.url)"

Auditors: kevin