Repository: mozilla-services/react-jsonschema-form
Pull request #1071 (2018-10-30 13:36:58)

Add `prepare` script to package.json
That way we can install from github master branch if a feature has not yet been released.

```
npm install --save mozilla-services/react-jsonschema-form
```

### Reasons for making this change

I want to use some features that are not yet available/released (submitting form programmatically).

### Checklist

It does not match that well with the checklist.

* [ ] **I'm updating documentation**
  - [ ] I've checked the rendering of the Markdown text I've added
  - [ ] If I'm adding a new section, I've updated the Table of Content
* [ ] **I'm adding or updating code**
  - [ ] I've added and/or updated tests
  - [ ] I've updated docs if needed
  - [ ] I've run `npm run cs-format` on my branch to conform my code to [prettier](https://github.com/prettier/prettier) coding style
* [ ] **I'm adding a new feature**
  - [ ] I've updated the playground with an example use of the feature



Patch:
diff --git a/package.json b/package.json
index 803cd1acb..9ffd3bafa 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,7 @@
     "cs-format": "prettier --jsx-bracket-same-line --trailing-comma es5 --use-tabs false --semi --tab-width 2 '{playground,src,test}/**/*.js' --write",
     "dist": "npm run build:lib && npm run build:dist",
     "lint": "eslint src test playground",
+    "prepare": "npm run dist",
     "precommit": "lint-staged",
     "publish-to-gh-pages": "npm run build:playground && gh-pages --dist build/",
     "publish-to-npm": "npm run build:readme && npm run dist && npm publish",
diff --git a/src/components/fields/BooleanField.js b/src/components/fields/BooleanField.js
index 8f10dccff..00014f28c 100644
--- a/src/components/fields/BooleanField.js
+++ b/src/components/fields/BooleanField.js
@@ -21,6 +21,8 @@ function BooleanField(props) {
     readonly,
     autofocus,
     onChange,
+    onFocus,
+    onBlur,
     rawErrors,
   } = props;
   const { title } = schema;
@@ -37,6 +39,8 @@ function BooleanField(props) {
       schema={schema}
       id={idSchema && idSchema.$id}
       onChange={onChange}
+      onFocus={onFocus}
+      onBlur={onBlur}
       label={title === undefined ? name : title}
       value={formData}
       required={required}
@@ -56,6 +60,8 @@ if (process.env.NODE_ENV !== "production") {
     uiSchema: PropTypes.object,
     idSchema: PropTypes.object,
     onChange: PropTypes.func.isRequired,
+    onFocus: PropTypes.func,
+    onBlur: PropTypes.func,
     formData: PropTypes.bool,
     required: PropTypes.bool,
     disabled: PropTypes.bool,
diff --git a/src/components/fields/TitleField.js b/src/components/fields/TitleField.js
index 30ed634df..f33f98384 100644
--- a/src/components/fields/TitleField.js
+++ b/src/components/fields/TitleField.js
@@ -5,8 +5,12 @@ const REQUIRED_FIELD_SYMBOL = "*";
 
 function TitleField(props) {
   const { id, title, required } = props;
-  const legend = required ? title + REQUIRED_FIELD_SYMBOL : title;
-  return <legend id={id}>{legend}</legend>;
+  return (
+    <legend id={id}>
+      {title}
+      {required && <span className="required">{REQUIRED_FIELD_SYMBOL}</span>}
+    </legend>
+  );
 }
 
 if (process.env.NODE_ENV !== "production") {


Test patch:
diff --git a/test/TitleField_test.js b/test/TitleField_test.js
index ed689ecdd..1c62e4988 100644
--- a/test/TitleField_test.js
+++ b/test/TitleField_test.js
@@ -65,5 +65,7 @@ describe("TitleField", () => {
     const { node } = createComponent(TitleFieldWrapper, props);
 
     expect(node.textContent).to.equal(props.title + "*");
+
+    expect(node.querySelector("span.required").textContent).to.equal("*");
   });
 });