diff --git a/.storybook/__storyshots__/Toggle.shot b/.storybook/__storyshots__/Toggle.shot index e497ae7aa..c5e16a455 100644 --- a/.storybook/__storyshots__/Toggle.shot +++ b/.storybook/__storyshots__/Toggle.shot @@ -267,7 +267,7 @@ exports[`Checked`] = `
+ Toggle control with status of Off/On +
++++ + < + Toggle + + + + + + onChange + + + = + + + { + + anonymous() + + } + + + + + + + + statusOff + + + = + + + \" + Off + \" + + + + + + + + statusOn + + + = + + + \" + On + \" + + + + + + + + /> + ++
+ property + | ++ propType + | ++ required + | ++ default + | +
---|---|---|---|
+ name + | ++ other + | ++ no + | ++ - + | +
+ className + | ++ other + | ++ no + | ++ - + | +
+ checked + | ++ other + | ++ no + | ++ - + | +
+ cols + | ++ other + | ++ no + | ++ - + | +
+ defaultChecked + | ++ other + | ++ no + | ++ - + | +
+ error + | ++ other + | ++ no + | ++ - + | +
+ label + | ++ other + | ++ no + | ++ - + | +
+ required + | ++ other + | ++ no + | ++ - + | +
+ statusOff + | ++ other + | ++ no + | ++ - + | +
+ statusOn |
other
diff --git a/NODE_ENV.cmd b/NODE_ENV.cmd
new file mode 100644
index 000000000..a4d4237aa
--- /dev/null
+++ b/NODE_ENV.cmd
@@ -0,0 +1 @@
+@set NODE_ENV=%1
diff --git a/package.json b/package.json
index bd28fa2ad..bdd04cb20 100644
--- a/package.json
+++ b/package.json
@@ -22,13 +22,13 @@
"scripts": {
"storybook": "start-storybook -s ./node_modules/@salesforce-ux/design-system -p 9001 -c .storybook",
"test": "npm-run-all test:jest test:storyshots",
- "test:storyshots": "NODE_ENV=test storyshots",
+ "test:storyshots": "NODE_ENV=test && storyshots",
"test:jest": "jest",
"prepublish": "npm run build",
"lint": "npm run lint:src && npm run lint:stories && npm run lint:test",
- "lint:src": "eslint --ext .js src/scripts/**",
- "lint:stories": "eslint --ext .js stories/**",
- "lint:test": "eslint --ext .js test/**",
+ "lint:src": "eslint --fix --ext .js src/scripts/**",
+ "lint:stories": "eslint --fix --ext .js stories/**",
+ "lint:test": "eslint --fix --ext .js test/**",
"build": "babel -d lib/ src/",
"build:assets": "cp -r node_modules/@salesforce-ux/design-system/assets public",
"build:storybook": "build-storybook -o public",
diff --git a/public/.gitignore b/public/.gitignore
index ca83fcf2a..f004ad09a 100644
--- a/public/.gitignore
+++ b/public/.gitignore
@@ -1,4 +1,4 @@
*.html
*.ico
assets
-static
+static
\ No newline at end of file
diff --git a/src/scripts/Toggle.js b/src/scripts/Toggle.js
index d1aae6eee..9d0ef20d8 100644
--- a/src/scripts/Toggle.js
+++ b/src/scripts/Toggle.js
@@ -5,7 +5,7 @@ import classnames from 'classnames';
import FormElement from './FormElement';
export default class Toggle extends Component {
- renderToggle({ className, label, ...props }) {
+ renderToggle({ className, label, statusOff, statusOn, ...props }) {
const toggleClassNames = classnames(className, 'slds-checkbox--toggle slds-grid');
return (
);
@@ -57,4 +57,6 @@ Toggle.propTypes = {
]),
checked: PropTypes.bool,
defaultChecked: PropTypes.bool,
+ statusOff: PropTypes.string,
+ statusOn: PropTypes.string,
};
diff --git a/stories/ToggleStories.js b/stories/ToggleStories.js
index b1d722499..6311992c2 100644
--- a/stories/ToggleStories.js
+++ b/stories/ToggleStories.js
@@ -23,4 +23,7 @@ storiesOf('Toggle', module)
.addWithInfo('Disabled', 'Toggle control with disabled status', () => (
|