Skip to content

Commit 2f9c08b

Browse files
authored
Merge pull request #64 from draperd/update-atlaskit-checkbox
update the checkbox
2 parents a7e2edc + 5064441 commit 2f9c08b

File tree

3 files changed

+84
-61
lines changed

3 files changed

+84
-61
lines changed

packages/atlaskit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.38",
44
"main": "dist/index.js",
55
"scripts": {
6-
"test": "jest",
6+
"test": "jest --transformIgnorePatterns \"node_modules/(?!(@atlaskit))/\"",
77
"start": "webpack-dev-server --mode development",
88
"transpile": "babel src -d dist --copy-files",
99
"prepublishOnly": "npm run transpile",
@@ -13,7 +13,7 @@
1313
"license": "MIT",
1414
"dependencies": {
1515
"@atlaskit/button": "9.0.4",
16-
"@atlaskit/checkbox": "4.0.2",
16+
"@atlaskit/checkbox": "7.0.0",
1717
"@atlaskit/datetime-picker": "^6.4.0",
1818
"@atlaskit/field-radio-group": "4.0.3",
1919
"@atlaskit/field-range": "5.0.2",
Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,59 @@
11
// @flow
22
import React from "react";
3-
import Checkbox from "@atlaskit/checkbox";
3+
import { Checkbox } from "@atlaskit/checkbox";
44
import { FieldWrapper } from "react-forms-processor";
55
import type { Field, FieldDef } from "react-forms-processor";
66
import { Field as AkField, ErrorMessage } from "@atlaskit/form";
77

88
class AtlaskitCheckbox extends React.Component<Field> {
9-
render() {
10-
const {
11-
description,
12-
disabled,
13-
errorMessages,
14-
id,
15-
isValid,
16-
name,
17-
onFieldChange,
18-
onFieldFocus,
19-
onFieldBlur,
20-
value,
21-
label,
22-
required
23-
} = this.props;
24-
const stringValue: string | void = value ? value.toString() : undefined;
25-
return (
26-
<AkField
27-
name={name}
28-
helperText={description}
29-
isRequired={required}
30-
isInvalid={!isValid}
31-
invalidMessage={errorMessages}
32-
validateOnBlur={false}
33-
>
34-
{({ fieldProps }) => (
35-
<React.Fragment>
36-
<Checkbox
37-
{...fieldProps}
38-
label={label}
39-
name={name}
40-
isDisabled={disabled}
41-
value={stringValue}
42-
initiallyChecked={stringValue === "true"}
43-
isChecked={stringValue === "true"}
44-
isInvalid={!isValid}
45-
onChange={evt => {
46-
onFieldChange(id, evt.isChecked);
47-
}}
48-
onFocus={() => onFieldFocus(id)}
49-
onBlur={() => onFieldBlur(id)}
50-
/>
51-
{!isValid && <ErrorMessage>{errorMessages}</ErrorMessage>}
52-
</React.Fragment>
53-
)}
54-
</AkField>
55-
);
56-
}
9+
render() {
10+
const {
11+
description,
12+
disabled,
13+
errorMessages,
14+
id,
15+
isValid,
16+
name,
17+
onFieldChange,
18+
value,
19+
label,
20+
required
21+
} = this.props;
22+
const stringValue: string | void = value ? value.toString() : undefined;
23+
return (
24+
<AkField
25+
name={name}
26+
helperText={description}
27+
isRequired={required}
28+
isInvalid={!isValid}
29+
invalidMessage={errorMessages}
30+
validateOnBlur={false}
31+
>
32+
{({ fieldProps }) => (
33+
<React.Fragment>
34+
<Checkbox
35+
{...fieldProps}
36+
label={label}
37+
name={name}
38+
isDisabled={disabled}
39+
value={stringValue}
40+
defaultChecked={stringValue === "true"}
41+
isChecked={stringValue === "true"}
42+
isInvalid={!isValid}
43+
onChange={evt => {
44+
onFieldChange(id, evt.target.checked);
45+
}}
46+
/>
47+
{!isValid && <ErrorMessage>{errorMessages}</ErrorMessage>}
48+
</React.Fragment>
49+
)}
50+
</AkField>
51+
);
52+
}
5753
}
5854

5955
export default (props: FieldDef) => (
60-
<FieldWrapper {...props}>
61-
<AtlaskitCheckbox />
62-
</FieldWrapper>
56+
<FieldWrapper {...props}>
57+
<AtlaskitCheckbox />
58+
</FieldWrapper>
6359
);

yarn.lock

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
babel-runtime "^6.26.0"
2424
prop-types "^15.5.10"
2525

26+
"@atlaskit/analytics-next@^5.0.0":
27+
version "5.0.0"
28+
resolved "https://registry.yarnpkg.com/@atlaskit/analytics-next/-/analytics-next-5.0.0.tgz#30e781b7bd84739f0861dc883719fb13ae527030"
29+
integrity sha512-g0qOGUXCq9J6bDtxJXtWsPL7utXBG6KPB0AQkqdY+hS91AuYRCG2cofMQlbVaBZFwXc050dXDN0Mm1oBqqeIFQ==
30+
dependencies:
31+
"@babel/runtime" "^7.0.0"
32+
prop-types "^15.5.10"
33+
2634
"@atlaskit/button@9.0.4":
2735
version "9.0.4"
2836
resolved "https://registry.yarnpkg.com/@atlaskit/button/-/button-9.0.4.tgz#5935ccb7d203f48c29671fa4488a41564b243d68"
@@ -60,14 +68,15 @@
6068
lodash.pick "^4.4.0"
6169
uuid "^3.1.0"
6270

63-
"@atlaskit/checkbox@4.0.2":
64-
version "4.0.2"
65-
resolved "https://registry.yarnpkg.com/@atlaskit/checkbox/-/checkbox-4.0.2.tgz#e4cf10d1a71a14ded39cbe5377f48f673ef51b35"
71+
"@atlaskit/checkbox@7.0.0":
72+
version "7.0.0"
73+
resolved "https://registry.yarnpkg.com/@atlaskit/checkbox/-/checkbox-7.0.0.tgz#d163f7c287b4e79bcdf8d3fa05b7330ae7cf868c"
74+
integrity sha512-iTJXkA/wHqiP/6uE61Al6LvhLdnp80LbVpEYYXMbO4KpJHtGe4ePsJb168EOtfZGPWW8kuBBL7qZyGqEgVZ3cw==
6675
dependencies:
67-
"@atlaskit/analytics-next" "^3.0.3"
68-
"@atlaskit/icon" "^13.2.2"
69-
"@atlaskit/theme" "^5.1.2"
70-
babel-runtime "^6.26.0"
76+
"@atlaskit/analytics-next" "^5.0.0"
77+
"@atlaskit/icon" "^17.0.0"
78+
"@atlaskit/theme" "^9.0.0"
79+
"@babel/runtime" "^7.0.0"
7180
prop-types "^15.5.10"
7281

7382
"@atlaskit/datetime-picker@^6.4.0":
@@ -190,6 +199,15 @@
190199
babel-runtime "^6.26.0"
191200
uuid "^3.1.0"
192201

202+
"@atlaskit/icon@^17.0.0":
203+
version "17.2.0"
204+
resolved "https://registry.yarnpkg.com/@atlaskit/icon/-/icon-17.2.0.tgz#4fc3ec50844590dac5235e2ec83d5b2e0a017882"
205+
integrity sha512-z1lad8viAgGeDJmxyop2lPxiqEhdpOjBULyr3fmbESuwCXF28oz01okJF61EY4rCLILjCWejSWWsGFm/R5Gszg==
206+
dependencies:
207+
"@atlaskit/theme" "^9.1.0"
208+
"@babel/runtime" "^7.0.0"
209+
uuid "^3.1.0"
210+
193211
"@atlaskit/inline-dialog@^8.0.3":
194212
version "8.0.3"
195213
resolved "https://registry.yarnpkg.com/@atlaskit/inline-dialog/-/inline-dialog-8.0.3.tgz#236c6a658008703096aa6174332eab818e4be5c0"
@@ -316,6 +334,15 @@
316334
exenv "^1.2.2"
317335
prop-types "^15.5.10"
318336

337+
"@atlaskit/theme@^9.0.0", "@atlaskit/theme@^9.1.0":
338+
version "9.1.0"
339+
resolved "https://registry.yarnpkg.com/@atlaskit/theme/-/theme-9.1.0.tgz#a58f01240f090efa4b230991664b2b8d4e5c6c8e"
340+
integrity sha512-7uF8YksrQp7l6rIWoBBTtqPXxkJTt6j30aLykxv6WlIq2aO8rT6BxVbBOEQZ4xT1v5CGTuXBnLjKGBuXZJ/kFw==
341+
dependencies:
342+
"@babel/runtime" "^7.0.0"
343+
exenv "^1.2.2"
344+
prop-types "^15.5.10"
345+
319346
"@atlaskit/tooltip@12.0.4":
320347
version "12.0.4"
321348
resolved "https://registry.yarnpkg.com/@atlaskit/tooltip/-/tooltip-12.0.4.tgz#7e1e86296dcbb7d0222b96010ce8ded1145ade18"

0 commit comments

Comments
 (0)