@khanacademy/wonder-blocks-form
Advanced tools
Comparing version 1.4.1 to 1.4.2
//@flow | ||
import React from "react"; | ||
import * as React from "react"; | ||
import {mount, unmountAll} from "../../../../utils/testing/mount.js"; | ||
@@ -4,0 +4,0 @@ |
//@flow | ||
import React from "react"; | ||
import * as React from "react"; | ||
import {mount, unmountAll} from "../../../../utils/testing/mount.js"; | ||
@@ -4,0 +4,0 @@ |
@@ -35,3 +35,3 @@ // @flow | ||
export default class CheckboxCore extends React.Component<Props> { | ||
handleChange = () => { | ||
handleChange: () => void = () => { | ||
// Empty because change is handled by ClickableBehavior | ||
@@ -41,3 +41,3 @@ return; | ||
render() { | ||
render(): React.Node { | ||
const { | ||
@@ -44,0 +44,0 @@ checked, |
@@ -92,3 +92,3 @@ // @flow | ||
render() { | ||
render(): React.Node { | ||
const { | ||
@@ -95,0 +95,0 @@ children, |
@@ -73,2 +73,7 @@ // @flow | ||
type DefaultProps = {| | ||
disabled: $PropertyType<ChoiceComponentProps, "disabled">, | ||
error: $PropertyType<ChoiceComponentProps, "error">, | ||
|}; | ||
/** | ||
@@ -82,3 +87,3 @@ * ☑️ A nicely styled checkbox for all your checking needs. Can optionally take | ||
export default class Checkbox extends React.Component<ChoiceComponentProps> { | ||
static defaultProps = { | ||
static defaultProps: DefaultProps = { | ||
disabled: false, | ||
@@ -88,5 +93,5 @@ error: false, | ||
render() { | ||
render(): React.Node { | ||
return <ChoiceInternal variant="checkbox" {...this.props} />; | ||
} | ||
} |
@@ -67,2 +67,8 @@ // @flow | ||
type DefaultProps = {| | ||
checked: $PropertyType<Props, "checked">, | ||
disabled: $PropertyType<Props, "disabled">, | ||
error: $PropertyType<Props, "error">, | ||
|}; | ||
/** | ||
@@ -76,3 +82,3 @@ * This is a potentially labeled 🔘 or ☑️ item. This is an internal component | ||
*/ export default class ChoiceInternal extends React.Component<Props> { | ||
static defaultProps = { | ||
static defaultProps: DefaultProps = { | ||
checked: false, | ||
@@ -83,3 +89,3 @@ disabled: false, | ||
handleLabelClick = (event: SyntheticEvent<>) => { | ||
handleLabelClick: (event: SyntheticEvent<>) => void = (event) => { | ||
// Browsers automatically use the for attribute to select the input, | ||
@@ -90,3 +96,3 @@ // but we use ClickableBehavior to handle this. | ||
handleClick = () => { | ||
handleClick: () => void = () => { | ||
const {checked, onChange, variant} = this.props; | ||
@@ -100,3 +106,3 @@ // Radio buttons cannot be unchecked | ||
getChoiceCoreComponent() { | ||
getChoiceCoreComponent(): React.ComponentType<> { | ||
if (this.props.variant === "radio") { | ||
@@ -108,3 +114,3 @@ return RadioCore; | ||
} | ||
getLabel() { | ||
getLabel(): React.Node { | ||
const {disabled, id, label} = this.props; | ||
@@ -121,3 +127,3 @@ return ( | ||
} | ||
getDescription() { | ||
getDescription(): React.Node { | ||
const {description} = this.props; | ||
@@ -128,3 +134,3 @@ return ( | ||
} | ||
render() { | ||
render(): React.Node { | ||
const { | ||
@@ -131,0 +137,0 @@ label, |
@@ -69,2 +69,8 @@ // @flow | ||
type DefaultProps = {| | ||
checked: $PropertyType<Props, "checked">, | ||
disabled: $PropertyType<Props, "disabled">, | ||
onChange: $PropertyType<Props, "onChange">, | ||
|}; | ||
/** | ||
@@ -79,3 +85,3 @@ * This is a labeled 🔘 or ☑️ item. Choice is meant to be used as children of | ||
*/ export default class Choice extends React.Component<Props> { | ||
static defaultProps = { | ||
static defaultProps: DefaultProps = { | ||
checked: false, | ||
@@ -86,3 +92,3 @@ disabled: false, | ||
getChoiceComponent(variant: ?string) { | ||
getChoiceComponent(variant: ?string): React.ComponentType<> { | ||
if (variant === "checkbox") { | ||
@@ -94,3 +100,3 @@ return Checkbox; | ||
} | ||
render() { | ||
render(): React.Node { | ||
// we don't need this going into the ChoiceComponent | ||
@@ -97,0 +103,0 @@ // eslint-disable-next-line no-unused-vars |
@@ -7,3 +7,5 @@ // @flow | ||
const styles = StyleSheet.create({ | ||
import type {StyleDeclaration} from "aphrodite"; | ||
const styles: StyleDeclaration = StyleSheet.create({ | ||
fieldset: { | ||
@@ -10,0 +12,0 @@ border: "none", |
@@ -26,3 +26,3 @@ // @flow | ||
*/ export default class RadioCore extends React.Component<Props> { | ||
handleChange = () => { | ||
handleChange: () => void = () => { | ||
// Empty because change is handled by ClickableBehavior | ||
@@ -32,3 +32,3 @@ return; | ||
render() { | ||
render(): React.Node { | ||
const { | ||
@@ -35,0 +35,0 @@ checked, |
@@ -82,3 +82,3 @@ // @flow | ||
render() { | ||
render(): React.Node { | ||
const { | ||
@@ -85,0 +85,0 @@ children, |
@@ -73,2 +73,7 @@ // @flow | ||
type DefaultProps = {| | ||
disabled: $PropertyType<ChoiceComponentProps, "disabled">, | ||
error: $PropertyType<ChoiceComponentProps, "error">, | ||
|}; | ||
/** | ||
@@ -81,3 +86,3 @@ * 🔘 A nicely styled radio button for all your non-AMFM radio button needs. Can | ||
*/ export default class Radio extends React.Component<ChoiceComponentProps> { | ||
static defaultProps = { | ||
static defaultProps: DefaultProps = { | ||
disabled: false, | ||
@@ -87,5 +92,5 @@ error: false, | ||
render() { | ||
render(): React.Node { | ||
return <ChoiceInternal variant="radio" {...this.props} />; | ||
} | ||
} |
{ | ||
"name": "@khanacademy/wonder-blocks-form", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"design": "v1", | ||
@@ -18,8 +18,8 @@ "description": "Form components for Wonder Blocks.", | ||
"dependencies": { | ||
"@khanacademy/wonder-blocks-color": "^1.1.15", | ||
"@khanacademy/wonder-blocks-core": "^3.0.2", | ||
"@khanacademy/wonder-blocks-icon": "^1.2.16", | ||
"@khanacademy/wonder-blocks-layout": "^1.3.27", | ||
"@khanacademy/wonder-blocks-color": "^1.1.16", | ||
"@khanacademy/wonder-blocks-core": "^3.1.0", | ||
"@khanacademy/wonder-blocks-icon": "^1.2.17", | ||
"@khanacademy/wonder-blocks-layout": "^1.3.28", | ||
"@khanacademy/wonder-blocks-spacing": "^3.0.1", | ||
"@khanacademy/wonder-blocks-typography": "^1.1.20" | ||
"@khanacademy/wonder-blocks-typography": "^1.1.21" | ||
}, | ||
@@ -33,3 +33,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "4258b926780fd497bd70b0386704d7ac9c9e96bc" | ||
"gitHead": "644907d5558f4ab46a8ecb3c7e22be8bd3a9920e" | ||
} |
470117
6472