├── docs ├── 404 │ └── index.html ├── page-data │ ├── 404 │ │ └── page-data.json │ ├── app-data.json │ ├── 404.html │ │ └── page-data.json │ ├── dev-404-page │ │ └── page-data.json │ ├── index │ │ └── page-data.json │ ├── theming │ │ └── page-data.json │ ├── upgrade │ │ └── page-data.json │ ├── components │ │ └── toggle │ │ │ └── page-data.json │ └── code-of-conduct │ │ └── page-data.json ├── styles-41a9f6aa338c835e034b.js.map ├── styles-41a9f6aa338c835e034b.js ├── styles.2543ff947a193d7f33b1.css ├── component---src-pages-404-js-b251b15ff0df26ecccce.js ├── chunk-map.json ├── component---src-pages-404-js-b251b15ff0df26ecccce.js.map ├── component---srcdocs-getstarted-mdx-9a40a16773f9a637c369.js ├── 404.html ├── webpack-runtime-28c7d89f58570c4f17a7.js ├── webpack-runtime-950e38aff32dfc4babdc.js ├── component---srcdocs-getstarted-mdx-9a40a16773f9a637c369.js.map ├── webpack.stats.json ├── component---srcdocs-upgrade-mdx-c6eadf8f582d6cf92114.js ├── component---srcdocs-components-toggle-toggle-mdx-bd8df1307efa34d15e59.js ├── component---srcdocs-components-toggle-toggle-mdx-9299f5eef9c8f4577218.js ├── component---srcdocs-upgrade-mdx-c6eadf8f582d6cf92114.js.map ├── component---code-of-conduct-md-d54928cb0bd0d43e52f3.js ├── component---code-of-conduct-md-d54928cb0bd0d43e52f3.js.map ├── component---srcdocs-components-toggle-toggle-mdx-bd8df1307efa34d15e59.js.map ├── component---srcdocs-components-toggle-toggle-mdx-9299f5eef9c8f4577218.js.map ├── component---srcdocs-theming-mdx-60f180b0733ac7a3bc63.js ├── component---srcdocs-theming-mdx-c292665b7998848ec7ec.js ├── component---srcdocs-theming-mdx-60f180b0733ac7a3bc63.js.map ├── component---srcdocs-theming-mdx-c292665b7998848ec7ec.js.map ├── webpack-runtime-28c7d89f58570c4f17a7.js.map ├── webpack-runtime-950e38aff32dfc4babdc.js.map └── index.html ├── src ├── index.tsx ├── theme │ ├── index.tsx │ └── theme.ts └── components │ └── Toggle │ └── index.tsx ├── dist ├── index.d.ts ├── index.js.map ├── index.js ├── theme │ ├── index.d.ts │ ├── index.js.map │ ├── theme.js.map │ ├── theme.d.ts │ ├── index.js │ └── theme.js └── components │ └── Toggle │ ├── index.d.ts │ ├── index.js.map │ └── index.js ├── doczrc.js ├── .prettierrc ├── srcdocs ├── getstarted.mdx ├── theme │ └── theme.tsx ├── components │ └── Toggle │ │ └── toggle.mdx ├── upgrade.mdx └── theming.mdx ├── tslint.json ├── config ├── tsconfig.json └── webpack.config.base.ts ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── LICENSE ├── tsconfig.json ├── .gitignore ├── package.json ├── README.md └── CODE_OF_CONDUCT.md /docs/page-data/app-data.json: -------------------------------------------------------------------------------- 1 | {"webpackCompilationHash":"058641ecf74354dacd8b"} 2 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as Toggle } from "./components/Toggle"; 2 | export { default as ReactToggleThemeProvider } from "./theme/"; -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default as Toggle } from "./components/Toggle"; 2 | export { default as ReactToggleThemeProvider } from "./theme/"; 3 | -------------------------------------------------------------------------------- /docs/styles-41a9f6aa338c835e034b.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"styles-41a9f6aa338c835e034b.js","sourceRoot":""} -------------------------------------------------------------------------------- /docs/page-data/404/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-404-js","path":"/404/","result":{"pageContext":{"isCreatedByStatefulCreatePages":true}}} -------------------------------------------------------------------------------- /docs/page-data/404.html/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---src-pages-404-js","path":"/404.html","result":{"pageContext":{"isCreatedByStatefulCreatePages":true}}} -------------------------------------------------------------------------------- /docs/styles-41a9f6aa338c835e034b.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[8],{oKgo:function(o,n,w){}}]); 2 | //# sourceMappingURL=styles-41a9f6aa338c835e034b.js.map -------------------------------------------------------------------------------- /dist/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;AAAA,8CAAwD;AAA/C,0BAAA,OAAO,CAAU;AAC1B,kCAA+D;AAAtD,2CAAA,OAAO,CAA4B"} -------------------------------------------------------------------------------- /docs/styles.2543ff947a193d7f33b1.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Inconsolata&display=swap);@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap); -------------------------------------------------------------------------------- /doczrc.js: -------------------------------------------------------------------------------- 1 | export default { 2 | typescript: true, 3 | title: "React Toggle", 4 | description: "React Toggle documentation and playground", 5 | base: "/react-toggle", 6 | ignore: ["README.md", 'readme.md', 'changelog.md', 'code_of_conduct.md', 'contributing.md', 'license.md'], 7 | dest: '/docs', 8 | } -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var Toggle_1 = require("./components/Toggle"); 4 | exports.Toggle = Toggle_1.default; 5 | var theme_1 = require("./theme/"); 6 | exports.ReactToggleThemeProvider = theme_1.default; 7 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /dist/theme/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Default theme provider. 3 | * 4 | */ 5 | import React, { FunctionComponent } from 'react'; 6 | interface Props { 7 | theme?: any; 8 | children?: React.ReactChild; 9 | } 10 | declare const ReactToggleThemeProvider: FunctionComponent; 11 | export default ReactToggleThemeProvider; 12 | -------------------------------------------------------------------------------- /dist/theme/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.tsx"],"names":[],"mappings":";;;;;AAAA;;;GAGG;AACH,gDAA+C;AAC/C,uDAAgD;AAChD,kDAAmC;AAQnC,IAAM,wBAAwB,GAA6B,UAAC,EAAgB;QAAf,sBAAQ,EAAC,gBAAK;IAAM,OAAA,8BAAC,iCAAa,IAAC,KAAK,EAAE,KAAK,IAAI,eAAY,IACzH,QAAQ,CACK;AAFiE,CAEjE,CAAC;AAEjB,kBAAe,wBAAwB,CAAC"} -------------------------------------------------------------------------------- /docs/page-data/dev-404-page/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---cache-dev-404-page-js","path":"/dev-404-page/","result":{"data":{"allSitePage":{"nodes":[{"path":"/code-of-conduct"},{"path":"/"},{"path":"/theming"},{"path":"/upgrade"},{"path":"/components/toggle"},{"path":"/404/"},{"path":"/404.html"}]}},"pageContext":{"isCreatedByStatefulCreatePages":true}}} -------------------------------------------------------------------------------- /docs/component---src-pages-404-js-b251b15ff0df26ecccce.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[3],{w2l6:function(t,e,n){"use strict";n.r(e);var i=n("aD51");e.default=function(){return Object(i.c)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",width:"100vw",fontSize:32}},"Not Found")}}}]); 2 | //# sourceMappingURL=component---src-pages-404-js-b251b15ff0df26ecccce.js.map -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": false, 3 | "arrowParens": "avoid", 4 | "bracketSpacing": true, 5 | "htmlWhitespaceSensitivity": "css", 6 | "insertPragma": false, 7 | "jsxBracketSameLine": false, 8 | "jsxSingleQuote": false, 9 | "parser": "typescript", 10 | "printWidth": 120, 11 | "semi": true, 12 | "proseWrap": "preserve", 13 | "singleQuote": false, 14 | "tabWidth": 2, 15 | "trailingComma": "all" 16 | } -------------------------------------------------------------------------------- /src/theme/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Default theme provider. 3 | * 4 | */ 5 | import React, {FunctionComponent} from 'react'; 6 | import {ThemeProvider} from "styled-components"; 7 | import defaultTheme from "./theme"; 8 | 9 | 10 | interface Props { 11 | theme?:any; 12 | children?: React.ReactChild; 13 | } 14 | 15 | const ReactToggleThemeProvider: FunctionComponent = ({children,theme}) => 16 | {children} 17 | ; 18 | 19 | export default ReactToggleThemeProvider; -------------------------------------------------------------------------------- /srcdocs/getstarted.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | name: Get Started 3 | route: / 4 | --- 5 | 6 | import {CodeSandbox} from "./theme/theme"; 7 | 8 | # Get Started 9 | 10 | ## Requirements 11 | 12 | * [node](https://nodejs.org) 13 | * [yarn](https://yarnpkg.com/en/docs/install#mac-stable) 14 | 15 | ## Installation 16 | 17 | You can use either **npm** 18 | 19 | ```bash 20 | npm i react-toggle-component 21 | ``` 22 | 23 | or **yarn** 24 | 25 | ```bash 26 | yarn add react-toggle-component 27 | ``` 28 | 29 | ## Code Sandbox 30 | 31 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "tslint:latest", 4 | "tslint-config-prettier" 5 | ], 6 | "rules": { 7 | "member-access": false, 8 | "no-implicit-dependencies": false, 9 | "no-console": false, 10 | "no-empty": false, 11 | "no-bitwise": false, 12 | "no-reference": false, 13 | "no-submodule-imports": false, 14 | "no-duplicate-imports": false, 15 | "no-shadowed-variable": false, 16 | "interface-name": false, 17 | "eslint-disable-next-line": false, 18 | "object-literal-sort-keys": false 19 | } 20 | } -------------------------------------------------------------------------------- /dist/theme/theme.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,EAAE;AACF,eAAe;AACf,EAAE;AACF,kBAAe;IACb,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IAEd,WAAW,EAAE,KAAK;IAClB,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,MAAM;IACvB,gBAAgB,EAAE,SAAS;IAE3B,mBAAmB,EAAG,MAAM;IAC5B,oBAAoB,EAAG,MAAM;IAC7B,uBAAuB,EAAG,MAAM;IAEhC,MAAM,EAAG,OAAO;IAChB,gBAAgB,EAAG,OAAO;IAC1B,UAAU,EAAG,MAAM;IAEnB,SAAS,EAAG,MAAM;IAClB,UAAU,EAAG,MAAM;IACnB,OAAO,EAAE,KAAK;IAEd,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,MAAM;IACrB,cAAc,EAAE,SAAS;CAC1B,CAAC"} -------------------------------------------------------------------------------- /docs/chunk-map.json: -------------------------------------------------------------------------------- 1 | {"app":["/app-d0a47dca2b5d1b408c83.js"],"component---code-of-conduct-md":["/component---code-of-conduct-md-d54928cb0bd0d43e52f3.js"],"component---srcdocs-theming-mdx":["/component---srcdocs-theming-mdx-c292665b7998848ec7ec.js"],"component---srcdocs-upgrade-mdx":["/component---srcdocs-upgrade-mdx-c6eadf8f582d6cf92114.js"],"component---srcdocs-getstarted-mdx":["/component---srcdocs-getstarted-mdx-9a40a16773f9a637c369.js"],"component---srcdocs-components-toggle-toggle-mdx":["/component---srcdocs-components-toggle-toggle-mdx-9299f5eef9c8f4577218.js"],"component---src-pages-404-js":["/component---src-pages-404-js-b251b15ff0df26ecccce.js"]} -------------------------------------------------------------------------------- /config/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "resolveJsonModule": true, 5 | "esModuleInterop": true, 6 | "allowSyntheticDefaultImports": true, 7 | "noImplicitReturns": true, 8 | "noImplicitThis": true, 9 | "noImplicitAny": true, 10 | "lib": [ 11 | "es2017" 12 | ], 13 | "skipLibCheck": true, 14 | "strictNullChecks": true, 15 | "suppressImplicitAnyIndexErrors": true, 16 | "noUnusedLocals": true, 17 | "typeRoots": [ 18 | "../node_modules/@types" 19 | ] 20 | }, 21 | "exclude": [ 22 | "node_modules", 23 | "../node_mobules", 24 | "../node_modules/@types" 25 | ] 26 | } -------------------------------------------------------------------------------- /docs/page-data/index/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---srcdocs-getstarted-mdx","path":"/","result":{"pageContext":{"isCreatedByStatefulCreatePages":false,"frontmatter":{"name":"Get Started","route":"/"},"entry":{"id":"84cce0b1420e7275c39043bac2e5a8ba","filepath":"srcdocs/getstarted.mdx","fullpath":"/Users/giovambattistafazioli/Lavori/Github/react-toggle/srcdocs/getstarted.mdx","route":"/","slug":"srcdocs-getstarted","name":"Get Started","menu":"","headings":[{"slug":"get-started","depth":1,"value":"Get Started"},{"slug":"requirements","depth":2,"value":"Requirements"},{"slug":"installation","depth":2,"value":"Installation"},{"slug":"code-sandbox","depth":2,"value":"Code Sandbox"}]}}}} -------------------------------------------------------------------------------- /docs/component---src-pages-404-js-b251b15ff0df26ecccce.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///./src/pages/404.js"],"names":["style","display","alignItems","justifyContent","height","width","fontSize"],"mappings":"kHAeA,UAbiB,WAUf,OAAO,mBAAKA,MATE,CACZC,QADY,OAEZC,WAFY,SAGZC,eAHY,SAIZC,OAJY,QAKZC,MALY,QAMZC,SAAU,KAGZ","file":"component---src-pages-404-js-b251b15ff0df26ecccce.js","sourcesContent":["import * as React from 'react'\n\nconst NotFound = () => {\n const style = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n height: '100vh',\n width: '100vw',\n fontSize: 32,\n }\n\n return
Not Found
\n}\n\nexport default NotFound\n"],"sourceRoot":""} -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /dist/theme/theme.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Default theme settings. 3 | * 4 | */ 5 | declare const _default: { 6 | version: string; 7 | width: string; 8 | height: string; 9 | borderWidth: string; 10 | borderColor: string; 11 | leftBorderColor: string; 12 | rightBorderColor: string; 13 | leftBackgroundColor: string; 14 | rightBackgroundColor: string; 15 | backgroundColorDisabled: string; 16 | radius: string; 17 | radiusBackground: string; 18 | knobRadius: string; 19 | knobWidth: string; 20 | knobHeight: string; 21 | knobGap: string; 22 | knobColor: string; 23 | leftKnobColor: string; 24 | rightKnobColor: string; 25 | }; 26 | export default _default; 27 | -------------------------------------------------------------------------------- /src/theme/theme.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Default theme settings. 3 | * 4 | */ 5 | 6 | // 7 | // Export theme 8 | // 9 | export default { 10 | version: "1.0.0", 11 | width: "48px", 12 | height: "24px", 13 | 14 | borderWidth: "2px", 15 | borderColor: "#aaa", 16 | leftBorderColor: "#aaa", 17 | rightBorderColor: "#3887b7", 18 | 19 | leftBackgroundColor : "#fff", 20 | rightBackgroundColor : "#fff", 21 | backgroundColorDisabled : "#eee", 22 | 23 | radius : "256px", 24 | radiusBackground : "256px", 25 | knobRadius : "100%", 26 | 27 | knobWidth : "16px", 28 | knobHeight : "16px", 29 | knobGap: "4px", 30 | 31 | knobColor: "#aaa", 32 | leftKnobColor: "#aaa", 33 | rightKnobColor: "#3887b7", 34 | }; -------------------------------------------------------------------------------- /docs/page-data/theming/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---srcdocs-theming-mdx","path":"/theming","result":{"pageContext":{"isCreatedByStatefulCreatePages":false,"frontmatter":{"name":"Theming","route":"/theming"},"entry":{"id":"4160a068d593513824bb6ed65b846cd8","filepath":"srcdocs/theming.mdx","fullpath":"/Users/giovambattistafazioli/Lavori/Github/react-toggle/srcdocs/theming.mdx","route":"/theming","slug":"srcdocs-theming","name":"Theming","menu":"","headings":[{"slug":"theming","depth":1,"value":"Theming"},{"slug":"how-change-the-toggle-appearance","depth":2,"value":"How change the toggle appearance"},{"slug":"new-appearance-props","depth":2,"value":"New appearance props"},{"slug":"theme-provider","depth":2,"value":"Theme Provider"}]}}}} -------------------------------------------------------------------------------- /dist/theme/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | /** 7 | * Default theme provider. 8 | * 9 | */ 10 | var react_1 = __importDefault(require("react")); 11 | var styled_components_1 = require("styled-components"); 12 | var theme_1 = __importDefault(require("./theme")); 13 | var ReactToggleThemeProvider = function (_a) { 14 | var children = _a.children, theme = _a.theme; 15 | return react_1.default.createElement(styled_components_1.ThemeProvider, { theme: theme || theme_1.default }, children); 16 | }; 17 | exports.default = ReactToggleThemeProvider; 18 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /docs/page-data/upgrade/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---srcdocs-upgrade-mdx","path":"/upgrade","result":{"pageContext":{"isCreatedByStatefulCreatePages":false,"frontmatter":{"name":"Upgrade Guide","route":"/upgrade"},"entry":{"id":"c3c3b9abcead5f82d3e0519037f99388","filepath":"srcdocs/upgrade.mdx","fullpath":"/Users/giovambattistafazioli/Lavori/Github/react-toggle/srcdocs/upgrade.mdx","route":"/upgrade","slug":"srcdocs-upgrade","name":"Upgrade Guide","menu":"","headings":[{"slug":"upgrade-guide","depth":1,"value":"Upgrade Guide"},{"slug":"upgrade-to-20-from-1x","depth":2,"value":"Upgrade to 2.0 from 1.x"},{"slug":"labels","depth":2,"value":"Labels"},{"slug":"events","depth":2,"value":"Events"},{"slug":"mode-prop","depth":2,"value":"Mode prop"},{"slug":"theme-prop","depth":2,"value":"Theme prop"}]}}}} -------------------------------------------------------------------------------- /dist/theme/theme.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Default theme settings. 4 | * 5 | */ 6 | Object.defineProperty(exports, "__esModule", { value: true }); 7 | // 8 | // Export theme 9 | // 10 | exports.default = { 11 | version: "1.0.0", 12 | width: "48px", 13 | height: "24px", 14 | borderWidth: "2px", 15 | borderColor: "#aaa", 16 | leftBorderColor: "#aaa", 17 | rightBorderColor: "#3887b7", 18 | leftBackgroundColor: "#fff", 19 | rightBackgroundColor: "#fff", 20 | backgroundColorDisabled: "#eee", 21 | radius: "256px", 22 | radiusBackground: "256px", 23 | knobRadius: "100%", 24 | knobWidth: "16px", 25 | knobHeight: "16px", 26 | knobGap: "4px", 27 | knobColor: "#aaa", 28 | leftKnobColor: "#aaa", 29 | rightKnobColor: "#3887b7", 30 | }; 31 | //# sourceMappingURL=theme.js.map -------------------------------------------------------------------------------- /docs/page-data/components/toggle/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---srcdocs-components-toggle-toggle-mdx","path":"/components/toggle","result":{"pageContext":{"isCreatedByStatefulCreatePages":false,"frontmatter":{"name":"Toggle","route":"/components/toggle","menu":"Components"},"entry":{"id":"b0015348a83502c35f3669a853afd697","filepath":"srcdocs/components/Toggle/toggle.mdx","fullpath":"/Users/giovambattistafazioli/Lavori/Github/react-toggle/srcdocs/components/Toggle/toggle.mdx","route":"/components/toggle","slug":"srcdocs-components-toggle-toggle","name":"Toggle","menu":"Components","headings":[{"slug":"toggle","depth":1,"value":"Toggle"},{"slug":"basic-usage","depth":2,"value":"Basic usage"},{"slug":"disable","depth":3,"value":"Disable"},{"slug":"appearance","depth":3,"value":"Appearance"},{"slug":"properties","depth":2,"value":"Properties"}]}}}} -------------------------------------------------------------------------------- /config/webpack.config.base.ts: -------------------------------------------------------------------------------- 1 | import { resolve } from "path"; 2 | import webpack from "webpack"; 3 | 4 | const BaseConfig: webpack.Configuration = { 5 | devtool: "inline-source-map", 6 | 7 | entry: [resolve(__dirname, "..", "src", "index.tsx")], 8 | 9 | module: { 10 | rules: [ 11 | { 12 | oneOf: [ 13 | { 14 | test: /\.(ts|tsx)$/, 15 | use: [ 16 | { 17 | loader: require.resolve("ts-loader"), 18 | options: { 19 | configFile: resolve(__dirname, "..", "tsconfig.json"), 20 | }, 21 | }, 22 | ], 23 | }, 24 | ], 25 | }, 26 | ], 27 | }, 28 | 29 | resolve: { 30 | extensions: [".ts", ".tsx"], 31 | alias: {}, 32 | }, 33 | }; 34 | 35 | export default BaseConfig; 36 | -------------------------------------------------------------------------------- /docs/page-data/code-of-conduct/page-data.json: -------------------------------------------------------------------------------- 1 | {"componentChunkName":"component---code-of-conduct-md","path":"/code-of-conduct","result":{"pageContext":{"isCreatedByStatefulCreatePages":false,"frontmatter":{},"entry":{"id":"a1ee87dafebc22cbd96979f1b2b7e837","filepath":"CODE_OF_CONDUCT.md","fullpath":"/Users/giovambattistafazioli/Lavori/Github/react-toggle/CODE_OF_CONDUCT.md","route":"/code-of-conduct","slug":"code-of-conduct","name":"Code of conduct","menu":"","headings":[{"slug":"contributor-covenant-code-of-conduct","depth":1,"value":"Contributor Covenant Code of Conduct"},{"slug":"our-pledge","depth":2,"value":"Our Pledge"},{"slug":"our-standards","depth":2,"value":"Our Standards"},{"slug":"our-responsibilities","depth":2,"value":"Our Responsibilities"},{"slug":"scope","depth":2,"value":"Scope"},{"slug":"enforcement","depth":2,"value":"Enforcement"},{"slug":"attribution","depth":2,"value":"Attribution"}]}}}} -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Giovambattista Fazioli 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "plugins": [ 4 | { 5 | "name": "typescript-styled-plugin" 6 | } 7 | ], 8 | "outDir": "dist", 9 | "module": "commonjs", 10 | "target": "es5", 11 | "lib": [ 12 | "es5", 13 | "es6", 14 | "es7", 15 | "es2017", 16 | "dom" 17 | ], 18 | "sourceMap": true, 19 | "jsx": "react", 20 | "moduleResolution": "node", 21 | "rootDirs": [ 22 | "src" 23 | ], 24 | "baseUrl": ".", 25 | "forceConsistentCasingInFileNames": true, 26 | "noImplicitReturns": true, 27 | "noImplicitThis": true, 28 | "noImplicitAny": true, 29 | "strictNullChecks": true, 30 | "suppressImplicitAnyIndexErrors": true, 31 | "noUnusedLocals": false, 32 | "resolveJsonModule": true, 33 | "esModuleInterop": true, 34 | "allowSyntheticDefaultImports": true, 35 | "experimentalDecorators": true, 36 | // if you want to build a lib, you need declarations to be true and allow js to be false 37 | "allowJs": false, 38 | "declaration": true, 39 | "skipLibCheck": true 40 | }, 41 | "include": [ 42 | "src/**/*" 43 | ], 44 | "exclude": [ 45 | "node_modules", 46 | "build", 47 | "scripts", 48 | "config" 49 | ] 50 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | .env.test 60 | 61 | # parcel-bundler cache (https://parceljs.org/) 62 | .cache 63 | 64 | # next.js build output 65 | .next 66 | 67 | # nuxt.js build output 68 | .nuxt 69 | 70 | # vuepress build output 71 | .vuepress/dist 72 | 73 | # Serverless directories 74 | .serverless/ 75 | 76 | # FuseBox cache 77 | .fusebox/ 78 | 79 | # DynamoDB Local files 80 | .dynamodb/ 81 | 82 | storybook-static 83 | .docz -------------------------------------------------------------------------------- /srcdocs/theme/theme.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import styled from "styled-components"; 3 | 4 | export const DocsExample = styled.div` 5 | background-color: #fff; 6 | border: 1px solid #aaa; 7 | border-radius: 8px; 8 | margin: 16px auto; 9 | 10 | padding: 0 8px 8px; 11 | 12 | h1 { 13 | font-size: 20px; 14 | margin: 0 -8px; 15 | padding: 0 8px; 16 | border-radius: 7px 7px 0 0; 17 | background-color: #999; 18 | color: #fff; 19 | } 20 | 21 | button { 22 | padding: 8px 16px; 23 | border-radius: 3px; 24 | border: none; 25 | background-color: #80a5f4; 26 | color: #fff; 27 | margin: 0 8px; 28 | cursor: pointer; 29 | box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.69); 30 | 31 | &:active { 32 | background-color: #5e77bb; 33 | box-shadow: none; 34 | } 35 | } 36 | 37 | pre { 38 | font-size: 12px; 39 | display: block; 40 | background-color: #fff; 41 | color: #666; 42 | border-radius: 256px; 43 | padding: 3px 12px; 44 | margin: 16px 8px; 45 | box-shadow: 0 0 1px rgba(0, 0, 0, 0.3); 46 | } 47 | `; 48 | 49 | export function CodeSandbox(id?: string) { 50 | const styles = { 51 | width: "100%", 52 | height: "500px", 53 | border: "0", 54 | borderRadius: "4px", 55 | overflow: "hidden", 56 | }; 57 | 58 | return ( 59 | 64 | ); 65 | } 66 | -------------------------------------------------------------------------------- /srcdocs/components/Toggle/toggle.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | name: Toggle 3 | route: /components/toggle 4 | menu: Components 5 | --- 6 | 7 | import { Playground, Props } from 'docz' 8 | import Toggle, {ToggleProps} from '../../../src/components/Toggle' 9 | 10 | 11 | # Toggle 12 | 13 | The Toggle component is an useful replacement to the standar input checkbox component. 14 | Anyway, remember that the toggle component is an extension of the input checkbox. So, you can use it inside a form as well. 15 | In fact, remember to use the props `name` when you're using multiple toggle component in your view. 16 | 17 | ## Basic usage 18 | 19 | You can wrap the Toggle component with `label` 20 | 21 | 22 | 26 | 27 | 28 | 29 | 33 | 34 | 35 | Or set any `label` outside 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | ### Disable 48 | 49 | 50 | 54 | 55 | 56 | ### Appearance 57 | 58 | 59 | 70 | 71 | 72 | ## Properties 73 | 74 | 75 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-toggle-component", 3 | "version": "3.0.8", 4 | "description": "A React UI Component to display an awesome Toggle Button control", 5 | "private": false, 6 | "main": "dist/index.js", 7 | "keywords": [ 8 | "toggle", 9 | "component", 10 | "react", 11 | "react-component", 12 | "docz", 13 | "typescript", 14 | "hooks" 15 | ], 16 | "homepage": "http://gfazioli.github.io/react-toggle/", 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/gfazioli/react-toggle" 20 | }, 21 | "bugs": { 22 | "url": "https://github.com/gfazioli/react-toggle/issues" 23 | }, 24 | "author": "Giovambattista Fazioli", 25 | "license": "MIT", 26 | "devDependencies": { 27 | "@babel/core": "^7.4.3", 28 | "@types/node": "12.12.7", 29 | "@types/react": "^16.8.23", 30 | "@types/react-dom": "^16.8.4", 31 | "@types/styled-components": "^4.1.19", 32 | "@types/webpack": "4.39.8", 33 | "babel-loader": "^8.0.4", 34 | "prettier": "1.19.1", 35 | "ts-loader": "^6.2.1", 36 | "ts-node": "^8.0.3", 37 | "tslint": "^6.0.0-beta0", 38 | "tslint-config-prettier": "^1.18.0", 39 | "typescript": "3.7.2", 40 | "typescript-styled-plugin": "^0.15.0", 41 | "webpack": "^4.29.5", 42 | "webpack-cli": "^3.3.0", 43 | "react": "^16.8.6", 44 | "react-dom": "^16.8.6", 45 | "docz": "^v2.0.0-rc.75", 46 | "@emotion/core": "^10.0.14", 47 | "@emotion/styled": "^10.0.14", 48 | "gatsby": "^2.17.8", 49 | "gatsby-theme-docz": "^2.0.0-rc.75", 50 | "scheduler": "^0.17.0", 51 | "styled-components": "^4.2.0" 52 | }, 53 | "peerDependencies": { 54 | "react": "^17.0.2", 55 | "react-dom": "^17.0.2", 56 | "styled-components": "^4.2.0" 57 | }, 58 | "dependencies": { 59 | "react-use": "^13.2.1" 60 | }, 61 | "scripts": { 62 | "dev": "docz dev", 63 | "build": "docz build", 64 | "production": "tsc --project tsconfig.json && git add dist && ./node_modules/tslint/bin/tslint './src/**/*.ts{,x}'" 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /srcdocs/upgrade.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | name: Upgrade Guide 3 | route: /upgrade 4 | --- 5 | 6 | # Upgrade Guide 7 | 8 | ## Upgrade to 2.0 from 1.x 9 | 10 | This version is not fully compatible with the previous 1.x versions. Anyway, you may update your code easly 11 | 12 | ## Labels 13 | 14 | First of all, we've removed the props for the labels. You can upgrade your code by following 15 | 16 | ```jsx 17 | // previous v1.x 18 | 19 | 20 | // Left label from v2.x 21 | 25 | 26 | // Right label from v2.x 27 | 31 | ``` 32 | 33 | ## Events 34 | 35 | The previous `onChange` event become `onToggle` 36 | 37 | ```jsx 38 | // previous v1.x 39 | console.log(e.target.checked)} /> 40 | 41 | // from v2.x 42 | console.log(e.target.checked)} /> 43 | ``` 44 | 45 | The new `onToggle` event, has got only one param, I mean, the standard `event` object. 46 | In fact, you will be able to get all information about the toggle by using `e.target` as shown above. 47 | 48 | In addition, you may use the new `onRight` and `onLeft` events. They are trigged when the toggle is switched from the left to the right and vice versa. In short, when it's **on** (usually) and **off** (usually). 49 | 50 | ```jsx 51 | // from left to the right "on" 52 | console.log(e.target.name)} /> 53 | 54 | // from right to the left "off" 55 | console.log(e.target.name)} /> 56 | ``` 57 | 58 | ## Mode prop 59 | 60 | Also the prop `mode` is no longer available. This because in the previous version the `mode="switch"` was keeping the "on" and "off" appearance colours the same. Now, you can do the same by using the new props. See the [Theming](/theming) section for more details. 61 | 62 | ## Theme prop 63 | 64 | We have also removed the `theme` prop. Now, you'll be able to create any toggle theme by using the new props for the appearance and the theme provider. See the [Theming](/theming) section for more details. -------------------------------------------------------------------------------- /docs/component---srcdocs-getstarted-mdx-9a40a16773f9a637c369.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[5],{peMB:function(e,t,n){"use strict";n.r(t),n.d(t,"_frontmatter",(function(){return b})),n.d(t,"default",(function(){return s}));n("5hJT"),n("W1QL"),n("K/PF"),n("t91x"),n("75LO"),n("PJhk");var a=n("SAVP"),r=n("TjRS"),o=n("DE87");n("aD51");function c(){return(c=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,["components"]);return Object(a.b)(i,c({},l,n,{components:t,mdxType:"MDXLayout"}),Object(a.b)("h1",{id:"get-started"},"Get Started"),Object(a.b)("h2",{id:"requirements"},"Requirements"),Object(a.b)("ul",null,Object(a.b)("li",{parentName:"ul"},Object(a.b)("a",c({parentName:"li"},{href:"https://nodejs.org"}),"node")),Object(a.b)("li",{parentName:"ul"},Object(a.b)("a",c({parentName:"li"},{href:"https://yarnpkg.com/en/docs/install#mac-stable"}),"yarn"))),Object(a.b)("h2",{id:"installation"},"Installation"),Object(a.b)("p",null,"You can use either ",Object(a.b)("strong",{parentName:"p"},"npm")),Object(a.b)("pre",null,Object(a.b)("code",c({parentName:"pre"},{className:"language-bash"}),"npm i react-toggle-component\n")),Object(a.b)("p",null,"or ",Object(a.b)("strong",{parentName:"p"},"yarn")),Object(a.b)("pre",null,Object(a.b)("code",c({parentName:"pre"},{className:"language-bash"}),"yarn add react-toggle-component\n")),Object(a.b)("h2",{id:"code-sandbox"},"Code Sandbox"),Object(a.b)(o.a,{id:"01nxypo6zl",mdxType:"CodeSandbox"}))}s&&s===Object(s)&&Object.isExtensible(s)&&!s.hasOwnProperty("__filemeta")&&Object.defineProperty(s,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"srcdocs/getstarted.mdx"}}),s.isMDXComponent=!0}}]); 2 | //# sourceMappingURL=component---srcdocs-getstarted-mdx-9a40a16773f9a637c369.js.map -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | ![version](https://img.shields.io/npm/v/react-toggle-component.svg) 4 | ![license](https://img.shields.io/npm/l/react-toggle-component.svg) 5 | ![issues](https://img.shields.io/github/issues/gfazioli/react-toggle.svg) 6 | ![type](https://img.shields.io/npm/types/react-toggle-component.svg) 7 | ![last-commit](https://img.shields.io/github/last-commit/gfazioli/react-toggle.svg) 8 | ![npm](https://img.shields.io/npm/dm/react-toggle-component.svg) 9 | 10 | This component is designed to render an awesome switch/toggle component. 11 | 12 | [![Edit React Toggle](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/01nxypo6zl?autoresize=1&fontsize=14&hidenavigation=1&view=preview) 13 | 14 |

15 | 16 |

17 | 18 | ## New in v2.0.x 19 | 20 | * Use TypeScript 21 | * Use React Hooks 22 | * New [Documentation and Interactive Playground](https://gfazioli.github.io/react-toggle/) 23 | * Removed the import styles 24 | * New props 25 | 26 | ## Upgrade Guide 27 | 28 | If you're using the previous version 1.x, have a look at [Upgrade to 2.0 from 1.x](https://gfazioli.github.io/react-toggle) before upgrade 29 | 30 | ## Installation 31 | 32 | You can use either **npm** 33 | 34 | ```bash 35 | npm i react-toggle-component 36 | ``` 37 | 38 | or **yarn** 39 | 40 | ```bash 41 | yarn add react-toggle-component 42 | ``` 43 | 44 | ## Basic Usage 45 | 46 | First of all, remember to import the component. 47 | 48 | ```jsx 49 | import React from "react" 50 | 51 | import {Toggle} from "react-toggle-component" 52 | 53 | function Application() { 54 | 55 | return ; 56 | 57 | } 58 | ``` 59 | 60 | ## Documentation 61 | 62 | See the complete [documentation and interactive playground](https://gfazioli.github.io/react-toggle/) 63 | 64 | 65 | ## Contributing 66 | 67 | Thanks for any of your contributions 👏. 68 | 69 | ## Bugs 🐛 70 | 71 | Use the GitHub issues. 72 | 73 | ## License 74 | 75 | MIT Licensed. Copyright (c) Giovambattista Fazioli 2019. 76 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 |
Not Found
-------------------------------------------------------------------------------- /docs/404/index.html: -------------------------------------------------------------------------------- 1 |
Not Found
-------------------------------------------------------------------------------- /docs/webpack-runtime-28c7d89f58570c4f17a7.js: -------------------------------------------------------------------------------- 1 | !function(e){function t(t){for(var n,a,u=t[0],i=t[1],f=t[2],s=0,l=[];s function MDXDefaultShortcode(props) {\n console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n return
;\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n\n\n

{`Get Started`}

\n

{`Requirements`}

\n \n

{`Installation`}

\n

{`You can use either `}{`npm`}

\n
{`npm i react-toggle-component\n`}
\n

{`or `}{`yarn`}

\n
{`yarn add react-toggle-component\n`}
\n

{`Code Sandbox`}

\n \n\n
;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""} -------------------------------------------------------------------------------- /docs/webpack.stats.json: -------------------------------------------------------------------------------- 1 | {"errors":[],"warnings":[],"namedChunkGroups":{"app":{"chunks":[9,8,0,1],"assets":["webpack-runtime-950e38aff32dfc4babdc.js","webpack-runtime-950e38aff32dfc4babdc.js.map","styles.2543ff947a193d7f33b1.css","styles-41a9f6aa338c835e034b.js","styles-41a9f6aa338c835e034b.js.map","commons-f5facf3ce4d6402c14af.js","commons-f5facf3ce4d6402c14af.js.map","app-d0a47dca2b5d1b408c83.js","app-d0a47dca2b5d1b408c83.js.map"],"children":{},"childAssets":{}},"component---code-of-conduct-md":{"chunks":[0,2],"assets":["commons-f5facf3ce4d6402c14af.js","commons-f5facf3ce4d6402c14af.js.map","component---code-of-conduct-md-d54928cb0bd0d43e52f3.js","component---code-of-conduct-md-d54928cb0bd0d43e52f3.js.map"],"children":{},"childAssets":{}},"component---srcdocs-theming-mdx":{"chunks":[0,6],"assets":["commons-f5facf3ce4d6402c14af.js","commons-f5facf3ce4d6402c14af.js.map","component---srcdocs-theming-mdx-c292665b7998848ec7ec.js","component---srcdocs-theming-mdx-c292665b7998848ec7ec.js.map"],"children":{},"childAssets":{}},"component---srcdocs-upgrade-mdx":{"chunks":[0,7],"assets":["commons-f5facf3ce4d6402c14af.js","commons-f5facf3ce4d6402c14af.js.map","component---srcdocs-upgrade-mdx-c6eadf8f582d6cf92114.js","component---srcdocs-upgrade-mdx-c6eadf8f582d6cf92114.js.map"],"children":{},"childAssets":{}},"component---srcdocs-getstarted-mdx":{"chunks":[0,5],"assets":["commons-f5facf3ce4d6402c14af.js","commons-f5facf3ce4d6402c14af.js.map","component---srcdocs-getstarted-mdx-9a40a16773f9a637c369.js","component---srcdocs-getstarted-mdx-9a40a16773f9a637c369.js.map"],"children":{},"childAssets":{}},"component---srcdocs-components-toggle-toggle-mdx":{"chunks":[0,4],"assets":["commons-f5facf3ce4d6402c14af.js","commons-f5facf3ce4d6402c14af.js.map","component---srcdocs-components-toggle-toggle-mdx-9299f5eef9c8f4577218.js","component---srcdocs-components-toggle-toggle-mdx-9299f5eef9c8f4577218.js.map"],"children":{},"childAssets":{}},"component---src-pages-404-js":{"chunks":[3],"assets":["component---src-pages-404-js-b251b15ff0df26ecccce.js","component---src-pages-404-js-b251b15ff0df26ecccce.js.map"],"children":{},"childAssets":{}}},"assetsByChunkName":{"app":["webpack-runtime-950e38aff32dfc4babdc.js","styles.2543ff947a193d7f33b1.css","styles-41a9f6aa338c835e034b.js","commons-f5facf3ce4d6402c14af.js","app-d0a47dca2b5d1b408c83.js"],"component---code-of-conduct-md":["commons-f5facf3ce4d6402c14af.js","component---code-of-conduct-md-d54928cb0bd0d43e52f3.js"],"component---srcdocs-theming-mdx":["commons-f5facf3ce4d6402c14af.js","component---srcdocs-theming-mdx-c292665b7998848ec7ec.js"],"component---srcdocs-upgrade-mdx":["commons-f5facf3ce4d6402c14af.js","component---srcdocs-upgrade-mdx-c6eadf8f582d6cf92114.js"],"component---srcdocs-getstarted-mdx":["commons-f5facf3ce4d6402c14af.js","component---srcdocs-getstarted-mdx-9a40a16773f9a637c369.js"],"component---srcdocs-components-toggle-toggle-mdx":["commons-f5facf3ce4d6402c14af.js","component---srcdocs-components-toggle-toggle-mdx-9299f5eef9c8f4577218.js"],"component---src-pages-404-js":["component---src-pages-404-js-b251b15ff0df26ecccce.js"]}} -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at giovambattista.fazioli@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /dist/components/Toggle/index.d.ts: -------------------------------------------------------------------------------- 1 | import React, { FunctionComponent } from "react"; 2 | interface Props { 3 | /** 4 | * Addition CSS classes 5 | */ 6 | className?: string; 7 | /** 8 | * Name of checkbox. You should alway assign a name 9 | * 10 | * @requires true 11 | */ 12 | name?: string; 13 | /** 14 | * Value used when you'll post data 15 | * 16 | * @default 17 | */ 18 | value?: string; 19 | /** 20 | * State of checked 21 | * 22 | * @default false 23 | */ 24 | checked?: boolean; 25 | /** 26 | * Controls whether the checked prop is controlled (passed to the `checked` prop on input) or not (passed to the `defautlChecked` prop on input) 27 | * 28 | * @default false 29 | */ 30 | controlled?: boolean; 31 | /** 32 | * Disable the toogle 33 | * 34 | * @default false 35 | */ 36 | disabled?: boolean; 37 | /** 38 | * Trigged when the toggle change 39 | * 40 | * @param {React.ChangeEvent} e 41 | */ 42 | onToggle?: (e: React.ChangeEvent) => void; 43 | /** 44 | * Trigged when the toggle is on the left. 45 | */ 46 | onRight?: (e: React.ChangeEvent) => void; 47 | /** 48 | * Trigged when the toggle is on the right. 49 | */ 50 | onLeft?: (e: React.ChangeEvent) => void; 51 | /** 52 | * Width of component 53 | */ 54 | width?: string; 55 | /** 56 | * Height of component 57 | */ 58 | height?: string; 59 | /** 60 | * Border width 61 | */ 62 | borderWidth?: string; 63 | /** 64 | * Border color for both knob position. This props will override leftBorderColor and rightBorderColor props 65 | */ 66 | borderColor?: string; 67 | /** 68 | * Border color when the knob is on the left (usually off) 69 | */ 70 | leftBorderColor?: string; 71 | /** 72 | * Border color when the knob is on the right (usually on) 73 | */ 74 | rightBorderColor?: string; 75 | /** 76 | * Background color for both knob position. This props will override leftBackgroundColor and rightBackgroundColor props 77 | */ 78 | backgroundColor?: string; 79 | /** 80 | * Background color when the knob is on the left (usually off) 81 | */ 82 | leftBackgroundColor?: string; 83 | /** 84 | * Background color when the knob is on the right (usually on) 85 | */ 86 | rightBackgroundColor?: string; 87 | /** 88 | * Background color when the toggle is disabled 89 | */ 90 | backgroundColorDisabled?: string; 91 | /** 92 | * Radius of container 93 | * 94 | */ 95 | radius?: string; 96 | /** 97 | * Radius of gap 98 | */ 99 | radiusBackground?: string; 100 | /** 101 | * Border radius of knob 102 | */ 103 | knobRadius?: string; 104 | /** 105 | * Knob width 106 | */ 107 | knobWidth?: string; 108 | /** 109 | * Knob height 110 | */ 111 | knobHeight?: string; 112 | /** 113 | * Knob gap. It's the distance from the border/background 114 | */ 115 | knobGap?: string; 116 | /** 117 | * Knob color for both knob position. This props will override the leftKnobColor and rightKnobColor 118 | */ 119 | knobColor?: string; 120 | /** 121 | * Knob color when it's on the left (usually off) 122 | */ 123 | leftKnobColor?: string; 124 | /** 125 | * Knob color when it's on the right (usually on) 126 | */ 127 | rightKnobColor?: string; 128 | } 129 | declare const Toggle: FunctionComponent; 130 | export { Toggle as ToggleProps }; 131 | declare const _default: React.ForwardRefExoticComponent>; 132 | export default _default; 133 | -------------------------------------------------------------------------------- /srcdocs/theming.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | name: Theming 3 | route: /theming 4 | --- 5 | import { Playground, Props } from 'docz' 6 | import Toggle from '../src/components/Toggle' 7 | import ReactToggleThemeProvider from '../src/theme/' 8 | 9 | # Theming 10 | 11 | This new version allow to change the whole toggle appearance. Now you'll be able to change every single color and size, for each single toggle component of for the whole user interface. 12 | 13 | ## How change the toggle appearance 14 | 15 | You may change the toggle appearance in two way: by using the new props for each single instance of your toggle component, or by using a theme provider. 16 | 17 | ## New appearance props 18 | 19 | You may use the new props to change the appearance for a single instance of component 20 | 21 | 22 |

Change the background

23 | 24 |
25 | 26 | 27 |

Change the background when on

28 | 29 |
30 | 31 | Now you can also change others appearance properties 32 | 33 | 34 |

Change the shape

35 | 36 |
37 | 38 | 39 |

Change the width size

40 | 41 |
42 | 43 | 44 |

Change the height size

45 | 46 |
47 | 48 | 49 |

Change the knob size

50 | 51 | 52 |
53 | 54 | You can also change the size and the border 55 | 56 | 57 |

Change the border size

58 | 59 | 60 | 61 | 62 |
63 | 64 | Of course, you can set the knob gap 65 | 66 | 67 |

Change the border size

68 | 69 | 70 | 71 | 72 |
73 | 74 | ## Theme Provider 75 | 76 | Instead of change every single props, you might use the `ReactToggleThemeProvider` 77 | 78 | ```jsx 79 | import {ReactToggleThemeProvider} from "react-toggle-component"; 80 | ``` 81 | 82 | The current default theme is the following 83 | 84 | ```jsx 85 | export default { 86 | version: "1.0.0", 87 | width: "48px", 88 | height: "24px", 89 | 90 | borderWidth: "2px", 91 | borderColor: "#aaa", 92 | leftBorderColor: "#aaa", 93 | rightBorderColor: "#3887b7", 94 | 95 | leftBackgroundColor : "#fff", 96 | rightBackgroundColor : "#fff", 97 | backgroundColorDisabled : "#eee", 98 | 99 | radius : "256px", 100 | radiusBackground : "256px", 101 | knobRadius : "100%", 102 | 103 | knobWidth : "16px", 104 | knobHeight : "16px", 105 | knobGap: "4px", 106 | 107 | knobColor: "#aaa", 108 | leftKnobColor: "#aaa", 109 | rightKnobColor: "#3887b7", 110 | }; 111 | ``` 112 | 113 | 114 | 115 |
116 |

All toggle children will use the same theme

117 | 118 | 119 | 120 | 121 |
122 |
123 |
124 | 125 | As you can see from the above example, you don't need to write your own custome theme with all properties, you may override one or more properties. -------------------------------------------------------------------------------- /docs/component---srcdocs-upgrade-mdx-c6eadf8f582d6cf92114.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[7],{Fzxv:function(e,t,n){"use strict";n.r(t),n.d(t,"_frontmatter",(function(){return r})),n.d(t,"default",(function(){return c}));n("5hJT"),n("W1QL"),n("K/PF"),n("t91x"),n("75LO"),n("PJhk");var o=n("SAVP"),a=n("TjRS");n("aD51");function l(){return(l=Object.assign||function(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,["components"]);return Object(o.b)(i,l({},b,n,{components:t,mdxType:"MDXLayout"}),Object(o.b)("h1",{id:"upgrade-guide"},"Upgrade Guide"),Object(o.b)("h2",{id:"upgrade-to-20-from-1x"},"Upgrade to 2.0 from 1.x"),Object(o.b)("p",null,"This version is not fully compatible with the previous 1.x versions. Anyway, you may update your code easly"),Object(o.b)("h2",{id:"labels"},"Labels"),Object(o.b)("p",null,"First of all, we've removed the props for the labels. You can upgrade your code by following"),Object(o.b)("pre",null,Object(o.b)("code",l({parentName:"pre"},{className:"language-jsx"}),'// previous v1.x\n\n\n// Left label from v2.x\n\n\n// Right label from v2.x\n\n')),Object(o.b)("h2",{id:"events"},"Events"),Object(o.b)("p",null,"The previous ",Object(o.b)("inlineCode",{parentName:"p"},"onChange")," event become ",Object(o.b)("inlineCode",{parentName:"p"},"onToggle")),Object(o.b)("pre",null,Object(o.b)("code",l({parentName:"pre"},{className:"language-jsx"}),'// previous v1.x\n console.log(e.target.checked)} />\n\n// from v2.x\n console.log(e.target.checked)} />\n')),Object(o.b)("p",null,"The new ",Object(o.b)("inlineCode",{parentName:"p"},"onToggle")," event, has got only one param, I mean, the standard ",Object(o.b)("inlineCode",{parentName:"p"},"event")," object.\nIn fact, you will be able to get all information about the toggle by using ",Object(o.b)("inlineCode",{parentName:"p"},"e.target")," as shown above."),Object(o.b)("p",null,"In addition, you may use the new ",Object(o.b)("inlineCode",{parentName:"p"},"onRight")," and ",Object(o.b)("inlineCode",{parentName:"p"},"onLeft")," events. They are trigged when the toggle is switched from the left to the right and vice versa. In short, when it's ",Object(o.b)("strong",{parentName:"p"},"on")," (usually) and ",Object(o.b)("strong",{parentName:"p"},"off")," (usually)."),Object(o.b)("pre",null,Object(o.b)("code",l({parentName:"pre"},{className:"language-jsx"}),'// from left to the right "on"\n console.log(e.target.name)} />\n\n// from right to the left "off"\n console.log(e.target.name)} />\n')),Object(o.b)("h2",{id:"mode-prop"},"Mode prop"),Object(o.b)("p",null,"Also the prop ",Object(o.b)("inlineCode",{parentName:"p"},"mode")," is no longer available. This because in the previous version the ",Object(o.b)("inlineCode",{parentName:"p"},'mode="switch"'),' was keeping the "on" and "off" appearance colours the same. Now, you can do the same by using the new props. See the ',Object(o.b)("a",l({parentName:"p"},{href:"/react-toggle/theming"}),"Theming")," section for more details."),Object(o.b)("h2",{id:"theme-prop"},"Theme prop"),Object(o.b)("p",null,"We have also removed the ",Object(o.b)("inlineCode",{parentName:"p"},"theme")," prop. Now, you'll be able to create any toggle theme by using the new props for the appearance and the theme provider. See the ",Object(o.b)("a",l({parentName:"p"},{href:"/react-toggle/theming"}),"Theming")," section for more details."))}c&&c===Object(c)&&Object.isExtensible(c)&&!c.hasOwnProperty("__filemeta")&&Object.defineProperty(c,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"srcdocs/upgrade.mdx"}}),c.isMDXComponent=!0}}]); 2 | //# sourceMappingURL=component---srcdocs-upgrade-mdx-c6eadf8f582d6cf92114.js.map -------------------------------------------------------------------------------- /docs/component---srcdocs-components-toggle-toggle-mdx-bd8df1307efa34d15e59.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[4],{OCol:function(e,o,t){"use strict";t.r(o),t.d(o,"_frontmatter",(function(){return b})),t.d(o,"default",(function(){return i}));t("5hJT"),t("W1QL"),t("K/PF"),t("t91x"),t("75LO"),t("PJhk");var l=t("SAVP"),a=t("TjRS"),n=t("ZFoC"),g=t("HUpa");t("aD51");function r(){return(r=Object.assign||function(e){for(var o=1;o=0||(a[t]=e[t]);return a}(e,["components"]);return Object(l.b)(p,r({},c,t,{components:o,mdxType:"MDXLayout"}),Object(l.b)("h1",{id:"toggle"},"Toggle"),Object(l.b)("p",null,"The Toggle component is an useful replacement to the standar input checkbox component.\nAnyway, remember that the toggle component is an extension of the input checkbox. So, you can use it inside a form as well.\nIn fact, remember to use the props ",Object(l.b)("inlineCode",{parentName:"p"},"name")," when you're using multiple toggle component in your view."),Object(l.b)("h2",{id:"basic-usage"},"Basic usage"),Object(l.b)("p",null,"You can wrap the Toggle component with ",Object(l.b)("inlineCode",{parentName:"p"},"label")),Object(l.b)(n.c,{__position:0,__code:'',__scope:{props:t,DefaultLayout:a.a,Playground:n.c,Props:n.d,Toggle:g.a},mdxType:"Playground"},Object(l.b)("label",{htmlFor:"toggle-1"},"Left label",Object(l.b)(g.a,{name:"toggle-1",mdxType:"Toggle"}))),Object(l.b)(n.c,{__position:1,__code:'',__scope:{props:t,DefaultLayout:a.a,Playground:n.c,Props:n.d,Toggle:g.a},mdxType:"Playground"},Object(l.b)("label",{htmlFor:"toggle-2"},Object(l.b)(g.a,{name:"toggle-2",mdxType:"Toggle"}),"Right label")),Object(l.b)("p",null,"Or set any ",Object(l.b)("inlineCode",{parentName:"p"},"label")," outside"),Object(l.b)(n.c,{__position:2,__code:'\n',__scope:{props:t,DefaultLayout:a.a,Playground:n.c,Props:n.d,Toggle:g.a},mdxType:"Playground"},Object(l.b)("label",{htmlFor:"toggle-1a"},"Left label outside"),Object(l.b)(g.a,{name:"toggle-1a",mdxType:"Toggle"})),Object(l.b)(n.c,{__position:3,__code:'\n',__scope:{props:t,DefaultLayout:a.a,Playground:n.c,Props:n.d,Toggle:g.a},mdxType:"Playground"},Object(l.b)(g.a,{name:"toggle-2a",mdxType:"Toggle"}),Object(l.b)("label",{htmlFor:"toggle-2a"},"Right label outside")),Object(l.b)("h3",{id:"disable"},"Disable"),Object(l.b)(n.c,{__position:4,__code:'',__scope:{props:t,DefaultLayout:a.a,Playground:n.c,Props:n.d,Toggle:g.a},mdxType:"Playground"},Object(l.b)("label",{htmlFor:"toggle-3"},"Disabled",Object(l.b)(g.a,{name:"toggle-3",disabled:!0,mdxType:"Toggle"}))),Object(l.b)("h3",{id:"appearance"},"Appearance"),Object(l.b)(n.c,{__position:5,__code:'',__scope:{props:t,DefaultLayout:a.a,Playground:n.c,Props:n.d,Toggle:g.a},mdxType:"Playground"},Object(l.b)("label",{htmlFor:"toggle-4"},Object(l.b)(g.a,{leftBackgroundColor:"tomato",rightBackgroundColor:"green",borderColor:"tomato",knobColor:"white",name:"toggle-4",onToggle:function(e){return console.log("onToggle",e.target.checked)},mdxType:"Toggle"}),"Appearance")),Object(l.b)("h2",{id:"props"},"Props"),Object(l.b)(n.d,{of:g.a,mdxType:"Props"}))}i&&i===Object(i)&&Object.isExtensible(i)&&!i.hasOwnProperty("__filemeta")&&Object.defineProperty(i,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"srcdocs/components/Toggle/toggle.mdx"}}),i.isMDXComponent=!0}}]); 2 | //# sourceMappingURL=component---srcdocs-components-toggle-toggle-mdx-bd8df1307efa34d15e59.js.map -------------------------------------------------------------------------------- /docs/component---srcdocs-components-toggle-toggle-mdx-9299f5eef9c8f4577218.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[4],{OCol:function(e,o,t){"use strict";t.r(o),t.d(o,"_frontmatter",(function(){return b})),t.d(o,"default",(function(){return i}));t("5hJT"),t("W1QL"),t("K/PF"),t("t91x"),t("75LO"),t("PJhk");var l=t("SAVP"),n=t("TjRS"),a=t("ZFoC"),g=t("HUpa");t("aD51");function r(){return(r=Object.assign||function(e){for(var o=1;o=0||(n[t]=e[t]);return n}(e,["components"]);return Object(l.b)(p,r({},c,t,{components:o,mdxType:"MDXLayout"}),Object(l.b)("h1",{id:"toggle"},"Toggle"),Object(l.b)("p",null,"The Toggle component is an useful replacement to the standar input checkbox component.\nAnyway, remember that the toggle component is an extension of the input checkbox. So, you can use it inside a form as well.\nIn fact, remember to use the props ",Object(l.b)("inlineCode",{parentName:"p"},"name")," when you're using multiple toggle component in your view."),Object(l.b)("h2",{id:"basic-usage"},"Basic usage"),Object(l.b)("p",null,"You can wrap the Toggle component with ",Object(l.b)("inlineCode",{parentName:"p"},"label")),Object(l.b)(a.c,{__position:0,__code:'',__scope:{props:t,DefaultLayout:n.a,Playground:a.c,Props:a.d,Toggle:g.b,ToggleProps:g.a},mdxType:"Playground"},Object(l.b)("label",{htmlFor:"toggle-1"},"Left label",Object(l.b)(g.b,{name:"toggle-1",mdxType:"Toggle"}))),Object(l.b)(a.c,{__position:1,__code:'',__scope:{props:t,DefaultLayout:n.a,Playground:a.c,Props:a.d,Toggle:g.b,ToggleProps:g.a},mdxType:"Playground"},Object(l.b)("label",{htmlFor:"toggle-2"},Object(l.b)(g.b,{name:"toggle-2",mdxType:"Toggle"}),"Right label")),Object(l.b)("p",null,"Or set any ",Object(l.b)("inlineCode",{parentName:"p"},"label")," outside"),Object(l.b)(a.c,{__position:2,__code:'\n',__scope:{props:t,DefaultLayout:n.a,Playground:a.c,Props:a.d,Toggle:g.b,ToggleProps:g.a},mdxType:"Playground"},Object(l.b)("label",{htmlFor:"toggle-1a"},"Left label outside"),Object(l.b)(g.b,{name:"toggle-1a",mdxType:"Toggle"})),Object(l.b)(a.c,{__position:3,__code:'\n',__scope:{props:t,DefaultLayout:n.a,Playground:a.c,Props:a.d,Toggle:g.b,ToggleProps:g.a},mdxType:"Playground"},Object(l.b)(g.b,{name:"toggle-2a",mdxType:"Toggle"}),Object(l.b)("label",{htmlFor:"toggle-2a"},"Right label outside")),Object(l.b)("h3",{id:"disable"},"Disable"),Object(l.b)(a.c,{__position:4,__code:'',__scope:{props:t,DefaultLayout:n.a,Playground:a.c,Props:a.d,Toggle:g.b,ToggleProps:g.a},mdxType:"Playground"},Object(l.b)("label",{htmlFor:"toggle-3"},"Disabled",Object(l.b)(g.b,{name:"toggle-3",disabled:!0,mdxType:"Toggle"}))),Object(l.b)("h3",{id:"appearance"},"Appearance"),Object(l.b)(a.c,{__position:5,__code:'',__scope:{props:t,DefaultLayout:n.a,Playground:a.c,Props:a.d,Toggle:g.b,ToggleProps:g.a},mdxType:"Playground"},Object(l.b)("label",{htmlFor:"toggle-4"},Object(l.b)(g.b,{leftBackgroundColor:"tomato",rightBackgroundColor:"green",borderColor:"tomato",knobColor:"white",name:"toggle-4",onToggle:function(e){return console.log("onToggle",e.target.checked)},mdxType:"Toggle"}),"Appearance")),Object(l.b)("h2",{id:"properties"},"Properties"),Object(l.b)(a.d,{of:g.a,mdxType:"Props"}))}i&&i===Object(i)&&Object.isExtensible(i)&&!i.hasOwnProperty("__filemeta")&&Object.defineProperty(i,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"srcdocs/components/Toggle/toggle.mdx"}}),i.isMDXComponent=!0}}]); 2 | //# sourceMappingURL=component---srcdocs-components-toggle-toggle-mdx-9299f5eef9c8f4577218.js.map -------------------------------------------------------------------------------- /dist/components/Toggle/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Toggle/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAqE;AACrE,wEAAuC;AACvC,4DAA6C;AA4J7C,IAAM,eAAe,GAAG,2BAAM,CAAC,KAAK,qEAAA,EAAE,IAAA,CAAC;AAEvC,IAAM,UAAU,GAAG,2BAAM,CAAC,IAAI,6iEAAO,gHAK1B,EAAgE,eAC/D,EAAmE,yVAgBhE,EAAgE,mBAC/D,EAAmE,6BACzD;IACwF,0BAC3F,EAAmE,mMAQjE;IAC6E,qCAE1F,EAAgE,sBAC9D,EAAkF,iDAGpF,EAAmE,sBACjE,EAAkF,0CAEpE;IAIc,mBAC1B,EAAkF,8HAOjF,EAA4E,qBAC3E,EAA+E,4BACxE,EAA+E,+BAC5E;IACgF,kEAErF,EAAsE,sGAOjE;IAIW,uDAGT;IAIe,sFAKxB,EAA4E,oBACjF,EAAsE,wFAGxD;IACmF,gGAMnF;IAGkB,mLAWpB;IAGkB,2GAIhB;IAGkB,qCAK/C,KAxHU,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,eAAY,CAAC,KAAK,EAA3D,CAA2D,EAC/D,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,eAAY,CAAC,MAAM,EAA9D,CAA8D,EAgBhE,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,eAAY,CAAC,KAAK,EAA3D,CAA2D,EAC/D,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,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AK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,IACd,WAAW,CAAC,UAAU,CAAC,EAC3B;QACF,8BAAC,eAAe,IAAC,OAAO,EAAE,IAAI,GAAI,CACvB,CACd,CAAC;AACJ,CAAC,CAAC;AAEiB,6BAAW;AAC9B,kBAAe,kBAAU,CAAC,MAAM,CAAC,CAAC"} -------------------------------------------------------------------------------- /docs/component---srcdocs-upgrade-mdx-c6eadf8f582d6cf92114.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///../srcdocs/upgrade.mdx"],"names":["_frontmatter","layoutProps","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","parentName","isMDXComponent"],"mappings":"weAMO,IAAMA,EAAe,Q,qMAE5B,IAKMC,EAAc,CAClBD,gBAEIE,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,E,oIACF,mBACD,OAAO,YAACJ,EAAD,KAAeD,EAAiBK,EAAhC,CAAuCD,WAAYA,EAAYE,QAAQ,cAG5E,iBAAQ,CACN,GAAM,iBADR,iBAGA,iBAAQ,CACN,GAAM,yBADR,2BAGA,oIACA,iBAAQ,CACN,GAAM,UADR,UAGA,qHACA,uBAAK,sBAAMC,WAAW,OAAU,CAC5B,UAAa,iBADZ,6QAiBL,iBAAQ,CACN,GAAM,UADR,UAGA,qCAAoB,0BAAYA,WAAW,KAAvB,YAApB,iBAA0F,0BAAYA,WAAW,KAAvB,aAC1F,uBAAK,sBAAMA,WAAW,OAAU,CAC5B,UAAa,iBADZ,wMAQL,gCAAe,0BAAYA,WAAW,KAAvB,YAAf,wDAA4H,0BAAYA,WAAW,KAAvB,SAA5H,wFACyE,0BAAYA,WAAW,KAAvB,YADzE,oBAEA,yDAAwC,0BAAYA,WAAW,KAAvB,WAAxC,QAAoG,0BAAYA,WAAW,KAAvB,UAApG,wHAA+Q,sBAAQA,WAAW,KAAnB,MAA/Q,kBAAwU,sBAAQA,WAAW,KAAnB,OAAxU,eACA,uBAAK,sBAAMA,WAAW,OAAU,CAC5B,UAAa,iBADZ,mNAQL,iBAAQ,CACN,GAAM,aADR,aAGA,sCAAqB,0BAAYA,WAAW,KAAvB,QAArB,qEAA2I,0BAAYA,WAAW,KAAvB,iBAA3I,0HAA+T,mBAAGA,WAAW,KAAQ,CACjV,KAAQ,0BADmT,WAA/T,8BAGA,iBAAQ,CACN,GAAM,cADR,cAGA,iDAAgC,0BAAYA,WAAW,KAAvB,SAAhC,mIAAqN,mBAAGA,WAAW,KAAQ,CACvO,KAAQ,0BADyM,WAArN,+B,4LAOJJ,EAAWK,gBAAiB","file":"component---srcdocs-upgrade-mdx-c6eadf8f582d6cf92114.js","sourcesContent":["import React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nimport DefaultLayout from \"/Users/giovambattistafazioli/Lavori/Github/react-toggle/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nexport const _frontmatter = {};\n\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n return
;\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n\n

{`Upgrade Guide`}

\n

{`Upgrade to 2.0 from 1.x`}

\n

{`This version is not fully compatible with the previous 1.x versions. Anyway, you may update your code easly`}

\n

{`Labels`}

\n

{`First of all, we've removed the props for the labels. You can upgrade your code by following`}

\n
{`// previous v1.x\n\n\n// Left label from v2.x\n\n\n// Right label from v2.x\n\n`}
\n

{`Events`}

\n

{`The previous `}{`onChange`}{` event become `}{`onToggle`}

\n
{`// previous v1.x\n console.log(e.target.checked)} />\n\n// from v2.x\n console.log(e.target.checked)} />\n`}
\n

{`The new `}{`onToggle`}{` event, has got only one param, I mean, the standard `}{`event`}{` object.\nIn fact, you will be able to get all information about the toggle by using `}{`e.target`}{` as shown above.`}

\n

{`In addition, you may use the new `}{`onRight`}{` and `}{`onLeft`}{` events. They are trigged when the toggle is switched from the left to the right and vice versa. In short, when it's `}{`on`}{` (usually) and `}{`off`}{` (usually).`}

\n
{`// from left to the right \"on\"\n console.log(e.target.name)} />\n\n// from right to the left \"off\"\n console.log(e.target.name)} />\n`}
\n

{`Mode prop`}

\n

{`Also the prop `}{`mode`}{` is no longer available. This because in the previous version the `}{`mode=\"switch\"`}{` was keeping the \"on\" and \"off\" appearance colours the same. Now, you can do the same by using the new props. See the `}{`Theming`}{` section for more details.`}

\n

{`Theme prop`}

\n

{`We have also removed the `}{`theme`}{` prop. Now, you'll be able to create any toggle theme by using the new props for the appearance and the theme provider. See the `}{`Theming`}{` section for more details.`}

\n\n
;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""} -------------------------------------------------------------------------------- /docs/component---code-of-conduct-md-d54928cb0bd0d43e52f3.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[2],{qlK9:function(e,t,n){"use strict";n.r(t),n.d(t,"_frontmatter",(function(){return r})),n.d(t,"default",(function(){return l}));n("5hJT"),n("W1QL"),n("K/PF"),n("t91x"),n("75LO"),n("PJhk");var o=n("SAVP"),i=n("TjRS");n("aD51");function a(){return(a=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,["components"]);return Object(o.b)(s,a({},c,n,{components:t,mdxType:"MDXLayout"}),Object(o.b)("h1",{id:"contributor-covenant-code-of-conduct"},"Contributor Covenant Code of Conduct"),Object(o.b)("h2",{id:"our-pledge"},"Our Pledge"),Object(o.b)("p",null,"In the interest of fostering an open and welcoming environment, we as\ncontributors and maintainers pledge to making participation in our project and\nour community a harassment-free experience for everyone, regardless of age, body\nsize, disability, ethnicity, sex characteristics, gender identity and expression,\nlevel of experience, education, socio-economic status, nationality, personal\nappearance, race, religion, or sexual identity and orientation."),Object(o.b)("h2",{id:"our-standards"},"Our Standards"),Object(o.b)("p",null,"Examples of behavior that contributes to creating a positive environment\ninclude:"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"Using welcoming and inclusive language"),Object(o.b)("li",{parentName:"ul"},"Being respectful of differing viewpoints and experiences"),Object(o.b)("li",{parentName:"ul"},"Gracefully accepting constructive criticism"),Object(o.b)("li",{parentName:"ul"},"Focusing on what is best for the community"),Object(o.b)("li",{parentName:"ul"},"Showing empathy towards other community members")),Object(o.b)("p",null,"Examples of unacceptable behavior by participants include:"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"The use of sexualized language or imagery and unwelcome sexual attention or\nadvances"),Object(o.b)("li",{parentName:"ul"},"Trolling, insulting/derogatory comments, and personal or political attacks"),Object(o.b)("li",{parentName:"ul"},"Public or private harassment"),Object(o.b)("li",{parentName:"ul"},"Publishing others' private information, such as a physical or electronic\naddress, without explicit permission"),Object(o.b)("li",{parentName:"ul"},"Other conduct which could reasonably be considered inappropriate in a\nprofessional setting")),Object(o.b)("h2",{id:"our-responsibilities"},"Our Responsibilities"),Object(o.b)("p",null,"Project maintainers are responsible for clarifying the standards of acceptable\nbehavior and are expected to take appropriate and fair corrective action in\nresponse to any instances of unacceptable behavior."),Object(o.b)("p",null,"Project maintainers have the right and responsibility to remove, edit, or\nreject comments, commits, code, wiki edits, issues, and other contributions\nthat are not aligned to this Code of Conduct, or to ban temporarily or\npermanently any contributor for other behaviors that they deem inappropriate,\nthreatening, offensive, or harmful."),Object(o.b)("h2",{id:"scope"},"Scope"),Object(o.b)("p",null,"This Code of Conduct applies both within project spaces and in public spaces\nwhen an individual is representing the project or its community. Examples of\nrepresenting a project or community include using an official project e-mail\naddress, posting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event. Representation of a project may be\nfurther defined and clarified by project maintainers."),Object(o.b)("h2",{id:"enforcement"},"Enforcement"),Object(o.b)("p",null,"Instances of abusive, harassing, or otherwise unacceptable behavior may be\nreported by contacting the project team at giovambattista.fazioli@gmail.com. All\ncomplaints will be reviewed and investigated and will result in a response that\nis deemed necessary and appropriate to the circumstances. The project team is\nobligated to maintain confidentiality with regard to the reporter of an incident.\nFurther details of specific enforcement policies may be posted separately."),Object(o.b)("p",null,"Project maintainers who do not follow or enforce the Code of Conduct in good\nfaith may face temporary or permanent repercussions as determined by other\nmembers of the project's leadership."),Object(o.b)("h2",{id:"attribution"},"Attribution"),Object(o.b)("p",null,"This Code of Conduct is adapted from the ",Object(o.b)("a",a({parentName:"p"},{href:"https://www.contributor-covenant.org"}),"Contributor Covenant"),", version 1.4,\navailable at ",Object(o.b)("a",a({parentName:"p"},{href:"https://www.contributor-covenant.org/version/1/4/code-of-conduct.html"}),"https://www.contributor-covenant.org/version/1/4/code-of-conduct.html")),Object(o.b)("p",null,"For answers to common questions about this code of conduct, see\n",Object(o.b)("a",a({parentName:"p"},{href:"https://www.contributor-covenant.org/faq"}),"https://www.contributor-covenant.org/faq")))}l&&l===Object(l)&&Object.isExtensible(l)&&!l.hasOwnProperty("__filemeta")&&Object.defineProperty(l,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"CODE_OF_CONDUCT.md"}}),l.isMDXComponent=!0}}]); 2 | //# sourceMappingURL=component---code-of-conduct-md-d54928cb0bd0d43e52f3.js.map -------------------------------------------------------------------------------- /docs/component---code-of-conduct-md-d54928cb0bd0d43e52f3.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///../CODE_OF_CONDUCT.md"],"names":["_frontmatter","layoutProps","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","parentName","isMDXComponent"],"mappings":"weAMO,IAAMA,EAAe,Q,oMAE5B,IAKMC,EAAc,CAClBD,gBAEIE,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,E,oIACF,mBACD,OAAO,YAACJ,EAAD,KAAeD,EAAiBK,EAAhC,CAAuCD,WAAYA,EAAYE,QAAQ,cAG5E,iBAAQ,CACN,GAAM,wCADR,wCAGA,iBAAQ,CACN,GAAM,cADR,cAGA,keAMA,iBAAQ,CACN,GAAM,iBADR,iBAGA,2GAEA,sBACE,kBAAIC,WAAW,MAAf,0CACA,kBAAIA,WAAW,MAAf,4DACA,kBAAIA,WAAW,MAAf,+CACA,kBAAIA,WAAW,MAAf,8CACA,kBAAIA,WAAW,MAAf,oDAEF,mFACA,sBACE,kBAAIA,WAAW,MAAf,yFAEA,kBAAIA,WAAW,MAAf,8EACA,kBAAIA,WAAW,MAAf,gCACA,kBAAIA,WAAW,MAAf,kHAEA,kBAAIA,WAAW,MAAf,gGAGF,iBAAQ,CACN,GAAM,wBADR,wBAGA,yOAGA,2WAKA,iBAAQ,CACN,GAAM,SADR,SAGA,4dAMA,iBAAQ,CACN,GAAM,eADR,eAGA,ofAMA,uNAGA,iBAAQ,CACN,GAAM,eADR,eAGA,iEAAgD,mBAAGA,WAAW,KAAQ,CAClE,KAAQ,yCADoC,wBAAhD,gCAGW,mBAAGA,WAAW,KAAQ,CAC7B,KAAQ,0EADD,0EAGX,yFACF,mBAAGA,WAAW,KAAQ,CAChB,KAAQ,6CADd,8C,2LAOFJ,EAAWK,gBAAiB","file":"component---code-of-conduct-md-d54928cb0bd0d43e52f3.js","sourcesContent":["import React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nimport DefaultLayout from \"/Users/giovambattistafazioli/Lavori/Github/react-toggle/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nexport const _frontmatter = {};\n\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n return
;\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n\n

{`Contributor Covenant Code of Conduct`}

\n

{`Our Pledge`}

\n

{`In the interest of fostering an open and welcoming environment, we as\ncontributors and maintainers pledge to making participation in our project and\nour community a harassment-free experience for everyone, regardless of age, body\nsize, disability, ethnicity, sex characteristics, gender identity and expression,\nlevel of experience, education, socio-economic status, nationality, personal\nappearance, race, religion, or sexual identity and orientation.`}

\n

{`Our Standards`}

\n

{`Examples of behavior that contributes to creating a positive environment\ninclude:`}

\n
    \n
  • {`Using welcoming and inclusive language`}
  • \n
  • {`Being respectful of differing viewpoints and experiences`}
  • \n
  • {`Gracefully accepting constructive criticism`}
  • \n
  • {`Focusing on what is best for the community`}
  • \n
  • {`Showing empathy towards other community members`}
  • \n
\n

{`Examples of unacceptable behavior by participants include:`}

\n
    \n
  • {`The use of sexualized language or imagery and unwelcome sexual attention or\nadvances`}
  • \n
  • {`Trolling, insulting/derogatory comments, and personal or political attacks`}
  • \n
  • {`Public or private harassment`}
  • \n
  • {`Publishing others' private information, such as a physical or electronic\naddress, without explicit permission`}
  • \n
  • {`Other conduct which could reasonably be considered inappropriate in a\nprofessional setting`}
  • \n
\n

{`Our Responsibilities`}

\n

{`Project maintainers are responsible for clarifying the standards of acceptable\nbehavior and are expected to take appropriate and fair corrective action in\nresponse to any instances of unacceptable behavior.`}

\n

{`Project maintainers have the right and responsibility to remove, edit, or\nreject comments, commits, code, wiki edits, issues, and other contributions\nthat are not aligned to this Code of Conduct, or to ban temporarily or\npermanently any contributor for other behaviors that they deem inappropriate,\nthreatening, offensive, or harmful.`}

\n

{`Scope`}

\n

{`This Code of Conduct applies both within project spaces and in public spaces\nwhen an individual is representing the project or its community. Examples of\nrepresenting a project or community include using an official project e-mail\naddress, posting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event. Representation of a project may be\nfurther defined and clarified by project maintainers.`}

\n

{`Enforcement`}

\n

{`Instances of abusive, harassing, or otherwise unacceptable behavior may be\nreported by contacting the project team at giovambattista.fazioli@gmail.com. All\ncomplaints will be reviewed and investigated and will result in a response that\nis deemed necessary and appropriate to the circumstances. The project team is\nobligated to maintain confidentiality with regard to the reporter of an incident.\nFurther details of specific enforcement policies may be posted separately.`}

\n

{`Project maintainers who do not follow or enforce the Code of Conduct in good\nfaith may face temporary or permanent repercussions as determined by other\nmembers of the project's leadership.`}

\n

{`Attribution`}

\n

{`This Code of Conduct is adapted from the `}{`Contributor Covenant`}{`, version 1.4,\navailable at `}{`https://www.contributor-covenant.org/version/1/4/code-of-conduct.html`}

\n

{`For answers to common questions about this code of conduct, see\n`}{`https://www.contributor-covenant.org/faq`}

\n\n
;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""} -------------------------------------------------------------------------------- /docs/component---srcdocs-components-toggle-toggle-mdx-bd8df1307efa34d15e59.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///../srcdocs/components/Toggle/toggle.mdx"],"names":["_frontmatter","layoutProps","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","parentName","__position","__code","__scope","Playground","Props","Toggle","htmlFor","name","disabled","leftBackgroundColor","rightBackgroundColor","borderColor","knobColor","onToggle","e","console","log","target","checked","of","isMDXComponent"],"mappings":"ggBAQO,IAAMA,EAAe,Q,sNAE5B,IAKMC,EAAc,CAClBD,gBAEIE,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,E,oIACF,mBACD,OAAO,YAACJ,EAAD,KAAeD,EAAiBK,EAAhC,CAAuCD,WAAYA,EAAYE,QAAQ,cAI5E,iBAAQ,CACN,GAAM,UADR,UAGA,gRAEiC,0BAAYC,WAAW,KAAvB,QAFjC,8DAGA,iBAAQ,CACN,GAAM,eADR,eAGA,+DAA8C,0BAAYA,WAAW,KAAvB,UAC9C,YAAC,IAAD,CAAYC,WAAY,EAAGC,OAAQ,mFAAwFC,QAAS,CAClIL,QACAH,kBACAS,eACAC,UACAC,YACCP,QAAQ,cACb,qBAAOQ,QAAQ,YAAf,aAEE,YAAC,IAAD,CAAQC,KAAK,WAAWT,QAAQ,aAGhC,YAAC,IAAD,CAAYE,WAAY,EAAGC,OAAQ,oFAAyFC,QAAS,CACnIL,QACAH,kBACAS,eACAC,UACAC,YACCP,QAAQ,cACb,qBAAOQ,QAAQ,YACb,YAAC,IAAD,CAAQC,KAAK,WAAWT,QAAQ,WADlC,gBAKE,mCAAkB,0BAAYC,WAAW,KAAvB,SAAlB,YACA,YAAC,IAAD,CAAYC,WAAY,EAAGC,OAAQ,qFAA0FC,QAAS,CACpIL,QACAH,kBACAS,eACAC,UACAC,YACCP,QAAQ,cACb,qBAAOQ,QAAQ,aAAf,sBACA,YAAC,IAAD,CAAQC,KAAK,YAAYT,QAAQ,YAE/B,YAAC,IAAD,CAAYE,WAAY,EAAGC,OAAQ,sFAA2FC,QAAS,CACrIL,QACAH,kBACAS,eACAC,UACAC,YACCP,QAAQ,cACb,YAAC,IAAD,CAAQS,KAAK,YAAYT,QAAQ,WACjC,qBAAOQ,QAAQ,aAAf,wBAEE,iBAAQ,CACN,GAAM,WADR,WAGA,YAAC,IAAD,CAAYN,WAAY,EAAGC,OAAQ,0FAA+FC,QAAS,CACzIL,QACAH,kBACAS,eACAC,UACAC,YACCP,QAAQ,cACb,qBAAOQ,QAAQ,YAAf,WAEE,YAAC,IAAD,CAAQC,KAAK,WAAWC,UAAQ,EAACV,QAAQ,aAGzC,iBAAQ,CACN,GAAM,cADR,cAGA,YAAC,IAAD,CAAYE,WAAY,EAAGC,OAAQ,iRAA8RC,QAAS,CACxUL,QACAH,kBACAS,eACAC,UACAC,YACCP,QAAQ,cACb,qBAAOQ,QAAQ,YACb,YAAC,IAAD,CAAQG,oBAAoB,SAASC,qBAAqB,QAAQC,YAAY,SAASC,UAAU,QAAQL,KAAK,WAAWM,SAAU,SAAAC,GAAC,OAAIC,QAAQC,IAAI,WAAYF,EAAEG,OAAOC,UAAUpB,QAAQ,WAD7L,eAKE,iBAAQ,CACN,GAAM,SADR,SAGA,YAAC,IAAD,CAAOqB,GAAId,IAAQP,QAAQ,W,6MAK/BH,EAAWyB,gBAAiB","file":"component---srcdocs-components-toggle-toggle-mdx-bd8df1307efa34d15e59.js","sourcesContent":["import React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nimport DefaultLayout from \"/Users/giovambattistafazioli/Lavori/Github/react-toggle/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nimport { Playground, Props } from 'docz';\nimport Toggle from '../../../src/components/Toggle';\nexport const _frontmatter = {};\n\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n return
;\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n\n\n

{`Toggle`}

\n

{`The Toggle component is an useful replacement to the standar input checkbox component.\nAnyway, remember that the toggle component is an extension of the input checkbox. So, you can use it inside a form as well.\nIn fact, remember to use the props `}{`name`}{` when you're using multiple toggle component in your view.`}

\n

{`Basic usage`}

\n

{`You can wrap the Toggle component with `}{`label`}

\n \\n Left label\\n \\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle\n }} mdxType=\"Playground\">\n \n \n \\n \\n Right label\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle\n }} mdxType=\"Playground\">\n \n \n

{`Or set any `}{`label`}{` outside`}

\n Left label outside\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle\n }} mdxType=\"Playground\">\n \n \n \n \\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle\n }} mdxType=\"Playground\">\n \n \n \n

{`Disable`}

\n \\n Disabled\\n \\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle\n }} mdxType=\"Playground\">\n \n \n

{`Appearance`}

\n \\n console.log(\\'onToggle\\', e.target.checked)}\\n />\\n Appearance\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle\n }} mdxType=\"Playground\">\n \n \n

{`Props`}

\n \n\n
;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""} -------------------------------------------------------------------------------- /docs/component---srcdocs-components-toggle-toggle-mdx-9299f5eef9c8f4577218.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///../srcdocs/components/Toggle/toggle.mdx"],"names":["_frontmatter","layoutProps","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","parentName","__position","__code","__scope","Playground","Props","Toggle","ToggleProps","htmlFor","name","disabled","leftBackgroundColor","rightBackgroundColor","borderColor","knobColor","onToggle","e","console","log","target","checked","of","isMDXComponent"],"mappings":"ggBAQO,IAAMA,EAAe,Q,sNAE5B,IAKMC,EAAc,CAClBD,gBAEIE,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,E,oIACF,mBACD,OAAO,YAACJ,EAAD,KAAeD,EAAiBK,EAAhC,CAAuCD,WAAYA,EAAYE,QAAQ,cAI5E,iBAAQ,CACN,GAAM,UADR,UAGA,gRAEiC,0BAAYC,WAAW,KAAvB,QAFjC,8DAGA,iBAAQ,CACN,GAAM,eADR,eAGA,+DAA8C,0BAAYA,WAAW,KAAvB,UAC9C,YAAC,IAAD,CAAYC,WAAY,EAAGC,OAAQ,mFAAwFC,QAAS,CAClIL,QACAH,kBACAS,eACAC,UACAC,WACAC,iBACCR,QAAQ,cACb,qBAAOS,QAAQ,YAAf,aAEE,YAAC,IAAD,CAAQC,KAAK,WAAWV,QAAQ,aAGhC,YAAC,IAAD,CAAYE,WAAY,EAAGC,OAAQ,oFAAyFC,QAAS,CACnIL,QACAH,kBACAS,eACAC,UACAC,WACAC,iBACCR,QAAQ,cACb,qBAAOS,QAAQ,YACb,YAAC,IAAD,CAAQC,KAAK,WAAWV,QAAQ,WADlC,gBAKE,mCAAkB,0BAAYC,WAAW,KAAvB,SAAlB,YACA,YAAC,IAAD,CAAYC,WAAY,EAAGC,OAAQ,qFAA0FC,QAAS,CACpIL,QACAH,kBACAS,eACAC,UACAC,WACAC,iBACCR,QAAQ,cACb,qBAAOS,QAAQ,aAAf,sBACA,YAAC,IAAD,CAAQC,KAAK,YAAYV,QAAQ,YAE/B,YAAC,IAAD,CAAYE,WAAY,EAAGC,OAAQ,sFAA2FC,QAAS,CACrIL,QACAH,kBACAS,eACAC,UACAC,WACAC,iBACCR,QAAQ,cACb,YAAC,IAAD,CAAQU,KAAK,YAAYV,QAAQ,WACjC,qBAAOS,QAAQ,aAAf,wBAEE,iBAAQ,CACN,GAAM,WADR,WAGA,YAAC,IAAD,CAAYP,WAAY,EAAGC,OAAQ,0FAA+FC,QAAS,CACzIL,QACAH,kBACAS,eACAC,UACAC,WACAC,iBACCR,QAAQ,cACb,qBAAOS,QAAQ,YAAf,WAEE,YAAC,IAAD,CAAQC,KAAK,WAAWC,UAAQ,EAACX,QAAQ,aAGzC,iBAAQ,CACN,GAAM,cADR,cAGA,YAAC,IAAD,CAAYE,WAAY,EAAGC,OAAQ,iRAA8RC,QAAS,CACxUL,QACAH,kBACAS,eACAC,UACAC,WACAC,iBACCR,QAAQ,cACb,qBAAOS,QAAQ,YACb,YAAC,IAAD,CAAQG,oBAAoB,SAASC,qBAAqB,QAAQC,YAAY,SAASC,UAAU,QAAQL,KAAK,WAAWM,SAAU,SAAAC,GAAC,OAAIC,QAAQC,IAAI,WAAYF,EAAEG,OAAOC,UAAUrB,QAAQ,WAD7L,eAKE,iBAAQ,CACN,GAAM,cADR,cAGA,YAAC,IAAD,CAAOsB,GAAId,IAAaR,QAAQ,W,6MAKpCH,EAAW0B,gBAAiB","file":"component---srcdocs-components-toggle-toggle-mdx-9299f5eef9c8f4577218.js","sourcesContent":["import React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nimport DefaultLayout from \"/Users/giovambattistafazioli/Lavori/Github/react-toggle/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nimport { Playground, Props } from 'docz';\nimport Toggle, { ToggleProps } from '../../../src/components/Toggle';\nexport const _frontmatter = {};\n\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n return
;\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n\n\n

{`Toggle`}

\n

{`The Toggle component is an useful replacement to the standar input checkbox component.\nAnyway, remember that the toggle component is an extension of the input checkbox. So, you can use it inside a form as well.\nIn fact, remember to use the props `}{`name`}{` when you're using multiple toggle component in your view.`}

\n

{`Basic usage`}

\n

{`You can wrap the Toggle component with `}{`label`}

\n \\n Left label\\n \\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ToggleProps\n }} mdxType=\"Playground\">\n \n \n \\n \\n Right label\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ToggleProps\n }} mdxType=\"Playground\">\n \n \n

{`Or set any `}{`label`}{` outside`}

\n Left label outside\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ToggleProps\n }} mdxType=\"Playground\">\n \n \n \n \\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ToggleProps\n }} mdxType=\"Playground\">\n \n \n \n

{`Disable`}

\n \\n Disabled\\n \\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ToggleProps\n }} mdxType=\"Playground\">\n \n \n

{`Appearance`}

\n \\n console.log(\\'onToggle\\', e.target.checked)}\\n />\\n Appearance\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ToggleProps\n }} mdxType=\"Playground\">\n \n \n

{`Properties`}

\n \n\n
;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""} -------------------------------------------------------------------------------- /docs/component---srcdocs-theming-mdx-60f180b0733ac7a3bc63.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[6],{"+jwX":function(e,o,n){"use strict";n.r(o),n.d(o,"_frontmatter",(function(){return d})),n.d(o,"default",(function(){return i}));n("5hJT"),n("W1QL"),n("K/PF"),n("t91x"),n("75LO"),n("PJhk");var t=n("SAVP"),a=n("TjRS"),r=n("ZFoC"),p=n("HUpa"),g=n("sr9g");n("aD51");function l(){return(l=Object.assign||function(e){for(var o=1;o=0||(a[n]=e[n]);return a}(e,["components"]);return Object(t.b)(c,l({},b,n,{components:o,mdxType:"MDXLayout"}),Object(t.b)("h1",{id:"theming"},"Theming"),Object(t.b)("p",null,"This new version allow to change the whole toggle appearance. Now you'll be able to change every single color and size, for each single toggle component of for the whole user interface."),Object(t.b)("h2",{id:"how-change-the-toggle-appearance"},"How change the toggle appearance"),Object(t.b)("p",null,"You may change the toggle appearance in two way: by using the new props for each single instance of your toggle component, or by using a theme provider."),Object(t.b)("h2",{id:"new-appearance-props"},"New appearance props"),Object(t.b)("p",null,"You may use the new props to change the appearance for a single instance of component"),Object(t.b)(r.c,{__position:0,__code:'

Change the background

\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.a,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the background"),Object(t.b)(p.a,{name:"t-1",backgroundColor:"rgba(0,0,0,1)",mdxType:"Toggle"})),Object(t.b)(r.c,{__position:1,__code:'

Change the background when on

\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.a,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the background when on"),Object(t.b)(p.a,{name:"t-2",rightBackgroundColor:"tomato",mdxType:"Toggle"})),Object(t.b)("p",null,"Now you can also change others appearance properties"),Object(t.b)(r.c,{__position:2,__code:'

Change the shape

\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.a,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the shape"),Object(t.b)(p.a,{name:"t-3",radius:"3px",radiusBackground:"2px",knobRadius:"2px",mdxType:"Toggle"})),Object(t.b)(r.c,{__position:3,__code:'

Change the width size

\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.a,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the width size"),Object(t.b)(p.a,{name:"t-4",width:"128px",mdxType:"Toggle"})),Object(t.b)(r.c,{__position:4,__code:'

Change the height size

\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.a,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the height size"),Object(t.b)(p.a,{name:"t-4h",height:"48px",mdxType:"Toggle"})),Object(t.b)(r.c,{__position:5,__code:'

Change the knob size

\n\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.a,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the knob size"),Object(t.b)(p.a,{name:"t-5",knobWidth:"8px",knobHeight:"8px",mdxType:"Toggle"}),Object(t.b)(p.a,{name:"t-6",radius:"3px",radiusBackground:"2px",knobRadius:"2px",width:"128px",knobWidth:"50px",mdxType:"Toggle"})),Object(t.b)("p",null,"You can also change the size and the border"),Object(t.b)(r.c,{__position:6,__code:'

Change the border size

\n\n\n\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.a,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the border size"),Object(t.b)(p.a,{name:"t-7",borderWidth:"1px",mdxType:"Toggle"}),Object(t.b)(p.a,{name:"t-8",borderWidth:"3px",mdxType:"Toggle"}),Object(t.b)(p.a,{name:"t-9",borderWidth:"5px",mdxType:"Toggle"}),Object(t.b)(p.a,{name:"t-10",borderWidth:"5px",knobWidth:"8px",knobHeight:"8px",mdxType:"Toggle"})),Object(t.b)("p",null,"Of course, you can set the knob gap"),Object(t.b)(r.c,{__position:7,__code:'

Change the border size

\n\n\n\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.a,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the border size"),Object(t.b)(p.a,{name:"t-11",borderWidth:"1px",knobGap:"8px",mdxType:"Toggle"}),Object(t.b)(p.a,{name:"t-12",borderWidth:"3px",knobGap:"8px",mdxType:"Toggle"}),Object(t.b)(p.a,{name:"t-13",borderWidth:"5px",knobGap:"8px",mdxType:"Toggle"}),Object(t.b)(p.a,{name:"t-14",borderWidth:"5px",knobWidth:"8px",knobHeight:"8px",knobGap:"8px",mdxType:"Toggle"})),Object(t.b)("h2",{id:"theme-provider"},"Theme Provider"),Object(t.b)("p",null,"Instead of change every single props, you might use the ",Object(t.b)("inlineCode",{parentName:"p"},"ReactToggleThemeProvider")),Object(t.b)("pre",null,Object(t.b)("code",l({parentName:"pre"},{className:"language-jsx"}),'import {ReactToggleThemeProvider} from "react-toggle-component";\n')),Object(t.b)("p",null,"The current default theme is the following"),Object(t.b)("pre",null,Object(t.b)("code",l({parentName:"pre"},{className:"language-jsx"}),'export default {\n version: "1.0.0",\n width: "48px",\n height: "24px",\n\n borderWidth: "2px",\n borderColor: "#aaa",\n leftBorderColor: "#aaa",\n rightBorderColor: "#3887b7",\n\n leftBackgroundColor : "#fff",\n rightBackgroundColor : "#fff",\n backgroundColorDisabled : "#eee",\n\n radius : "256px",\n radiusBackground : "256px",\n knobRadius : "100%",\n\n knobWidth : "16px",\n knobHeight : "16px",\n knobGap: "4px",\n\n knobColor: "#aaa",\n leftKnobColor: "#aaa",\n rightKnobColor: "#3887b7",\n};\n')),Object(t.b)(r.c,{__position:8,__code:'\n
\n

All toggle children will use the same theme

\n \n \n \n \n
\n
',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.a,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)(g.a,{theme:{leftBackgroundColor:"tomato"},mdxType:"ReactToggleThemeProvider"},Object(t.b)("div",null,Object(t.b)("p",null,"All toggle children will use the same theme"),Object(t.b)(p.a,{name:"t-p1",mdxType:"Toggle"}),Object(t.b)(p.a,{name:"t-p2",mdxType:"Toggle"}),Object(t.b)(p.a,{name:"t-p3",mdxType:"Toggle"}),Object(t.b)(p.a,{name:"t-p4",mdxType:"Toggle"})))),Object(t.b)("p",null,"As you can see from the above example, you don't need to write your own custome theme with all properties, you may override one or more properties."))}i&&i===Object(i)&&Object.isExtensible(i)&&!i.hasOwnProperty("__filemeta")&&Object.defineProperty(i,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"srcdocs/theming.mdx"}}),i.isMDXComponent=!0}}]); 2 | //# sourceMappingURL=component---srcdocs-theming-mdx-60f180b0733ac7a3bc63.js.map -------------------------------------------------------------------------------- /docs/component---srcdocs-theming-mdx-c292665b7998848ec7ec.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[6],{"+jwX":function(e,o,n){"use strict";n.r(o),n.d(o,"_frontmatter",(function(){return l})),n.d(o,"default",(function(){return i}));n("5hJT"),n("W1QL"),n("K/PF"),n("t91x"),n("75LO"),n("PJhk");var t=n("SAVP"),a=n("TjRS"),r=n("ZFoC"),p=n("HUpa"),g=n("sr9g");n("aD51");function b(){return(b=Object.assign||function(e){for(var o=1;o=0||(a[n]=e[n]);return a}(e,["components"]);return Object(t.b)(c,b({},d,n,{components:o,mdxType:"MDXLayout"}),Object(t.b)("h1",{id:"theming"},"Theming"),Object(t.b)("p",null,"This new version allow to change the whole toggle appearance. Now you'll be able to change every single color and size, for each single toggle component of for the whole user interface."),Object(t.b)("h2",{id:"how-change-the-toggle-appearance"},"How change the toggle appearance"),Object(t.b)("p",null,"You may change the toggle appearance in two way: by using the new props for each single instance of your toggle component, or by using a theme provider."),Object(t.b)("h2",{id:"new-appearance-props"},"New appearance props"),Object(t.b)("p",null,"You may use the new props to change the appearance for a single instance of component"),Object(t.b)(r.c,{__position:0,__code:'

Change the background

\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.b,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the background"),Object(t.b)(p.b,{name:"t-1",backgroundColor:"rgba(0,0,0,1)",mdxType:"Toggle"})),Object(t.b)(r.c,{__position:1,__code:'

Change the background when on

\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.b,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the background when on"),Object(t.b)(p.b,{name:"t-2",rightBackgroundColor:"tomato",mdxType:"Toggle"})),Object(t.b)("p",null,"Now you can also change others appearance properties"),Object(t.b)(r.c,{__position:2,__code:'

Change the shape

\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.b,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the shape"),Object(t.b)(p.b,{name:"t-3",radius:"3px",radiusBackground:"2px",knobRadius:"2px",mdxType:"Toggle"})),Object(t.b)(r.c,{__position:3,__code:'

Change the width size

\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.b,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the width size"),Object(t.b)(p.b,{name:"t-4",width:"128px",mdxType:"Toggle"})),Object(t.b)(r.c,{__position:4,__code:'

Change the height size

\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.b,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the height size"),Object(t.b)(p.b,{name:"t-4h",height:"48px",mdxType:"Toggle"})),Object(t.b)(r.c,{__position:5,__code:'

Change the knob size

\n\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.b,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the knob size"),Object(t.b)(p.b,{name:"t-5",knobWidth:"8px",knobHeight:"8px",mdxType:"Toggle"}),Object(t.b)(p.b,{name:"t-6",radius:"3px",radiusBackground:"2px",knobRadius:"2px",width:"128px",knobWidth:"50px",mdxType:"Toggle"})),Object(t.b)("p",null,"You can also change the size and the border"),Object(t.b)(r.c,{__position:6,__code:'

Change the border size

\n\n\n\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.b,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the border size"),Object(t.b)(p.b,{name:"t-7",borderWidth:"1px",mdxType:"Toggle"}),Object(t.b)(p.b,{name:"t-8",borderWidth:"3px",mdxType:"Toggle"}),Object(t.b)(p.b,{name:"t-9",borderWidth:"5px",mdxType:"Toggle"}),Object(t.b)(p.b,{name:"t-10",borderWidth:"5px",knobWidth:"8px",knobHeight:"8px",mdxType:"Toggle"})),Object(t.b)("p",null,"Of course, you can set the knob gap"),Object(t.b)(r.c,{__position:7,__code:'

Change the border size

\n\n\n\n',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.b,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)("p",null,"Change the border size"),Object(t.b)(p.b,{name:"t-11",borderWidth:"1px",knobGap:"8px",mdxType:"Toggle"}),Object(t.b)(p.b,{name:"t-12",borderWidth:"3px",knobGap:"8px",mdxType:"Toggle"}),Object(t.b)(p.b,{name:"t-13",borderWidth:"5px",knobGap:"8px",mdxType:"Toggle"}),Object(t.b)(p.b,{name:"t-14",borderWidth:"5px",knobWidth:"8px",knobHeight:"8px",knobGap:"8px",mdxType:"Toggle"})),Object(t.b)("h2",{id:"theme-provider"},"Theme Provider"),Object(t.b)("p",null,"Instead of change every single props, you might use the ",Object(t.b)("inlineCode",{parentName:"p"},"ReactToggleThemeProvider")),Object(t.b)("pre",null,Object(t.b)("code",b({parentName:"pre"},{className:"language-jsx"}),'import {ReactToggleThemeProvider} from "react-toggle-component";\n')),Object(t.b)("p",null,"The current default theme is the following"),Object(t.b)("pre",null,Object(t.b)("code",b({parentName:"pre"},{className:"language-jsx"}),'export default {\n version: "1.0.0",\n width: "48px",\n height: "24px",\n\n borderWidth: "2px",\n borderColor: "#aaa",\n leftBorderColor: "#aaa",\n rightBorderColor: "#3887b7",\n\n leftBackgroundColor : "#fff",\n rightBackgroundColor : "#fff",\n backgroundColorDisabled : "#eee",\n\n radius : "256px",\n radiusBackground : "256px",\n knobRadius : "100%",\n\n knobWidth : "16px",\n knobHeight : "16px",\n knobGap: "4px",\n\n knobColor: "#aaa",\n leftKnobColor: "#aaa",\n rightKnobColor: "#3887b7",\n};\n')),Object(t.b)(r.c,{__position:8,__code:'\n
\n

All toggle children will use the same theme

\n \n \n \n \n
\n
',__scope:{props:n,DefaultLayout:a.a,Playground:r.c,Props:r.d,Toggle:p.b,ReactToggleThemeProvider:g.a},mdxType:"Playground"},Object(t.b)(g.a,{theme:{leftBackgroundColor:"tomato"},mdxType:"ReactToggleThemeProvider"},Object(t.b)("div",null,Object(t.b)("p",null,"All toggle children will use the same theme"),Object(t.b)(p.b,{name:"t-p1",mdxType:"Toggle"}),Object(t.b)(p.b,{name:"t-p2",mdxType:"Toggle"}),Object(t.b)(p.b,{name:"t-p3",mdxType:"Toggle"}),Object(t.b)(p.b,{name:"t-p4",mdxType:"Toggle"})))),Object(t.b)("p",null,"As you can see from the above example, you don't need to write your own custome theme with all properties, you may override one or more properties."))}i&&i===Object(i)&&Object.isExtensible(i)&&!i.hasOwnProperty("__filemeta")&&Object.defineProperty(i,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"srcdocs/theming.mdx"}}),i.isMDXComponent=!0}}]); 2 | //# sourceMappingURL=component---srcdocs-theming-mdx-c292665b7998848ec7ec.js.map -------------------------------------------------------------------------------- /src/components/Toggle/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { forwardRef, FunctionComponent, useRef } from "react"; 2 | import styled from "styled-components"; 3 | import defaultTheme from "../../theme/theme"; 4 | 5 | interface Props { 6 | /** 7 | * Addition CSS classes 8 | */ 9 | className?: string; 10 | /** 11 | * Name of checkbox. You should alway assign a name 12 | * 13 | * @requires true 14 | */ 15 | name?: string; 16 | /** 17 | * Value used when you'll post data 18 | * 19 | * @default 20 | */ 21 | value?: string; 22 | /** 23 | * State of checked 24 | * 25 | * @default false 26 | */ 27 | checked?: boolean; 28 | /** 29 | * Controls whether the checked prop is controlled (passed to the `checked` prop on input) or not (passed to the `defautlChecked` prop on input) 30 | * 31 | * @default false 32 | */ 33 | controlled?: boolean; 34 | /** 35 | * Disable the toogle 36 | * 37 | * @default false 38 | */ 39 | disabled?: boolean; 40 | /** 41 | * Trigged when the toggle change 42 | * 43 | * @param {React.ChangeEvent} e 44 | */ 45 | onToggle?: (e: React.ChangeEvent) => void; 46 | /** 47 | * Trigged when the toggle is on the left. 48 | */ 49 | onRight?: (e: React.ChangeEvent) => void; 50 | /** 51 | * Trigged when the toggle is on the right. 52 | */ 53 | onLeft?: (e: React.ChangeEvent) => void; 54 | 55 | // --------------------------------------------------------------- 56 | // Appearance 57 | // --------------------------------------------------------------- 58 | 59 | /** 60 | * Width of component 61 | */ 62 | width?: string; 63 | /** 64 | * Height of component 65 | */ 66 | height?: string; 67 | 68 | // --------------------------------------------------------------- 69 | // Border 70 | // --------------------------------------------------------------- 71 | 72 | /** 73 | * Border width 74 | */ 75 | borderWidth?: string; 76 | /** 77 | * Border color for both knob position. This props will override leftBorderColor and rightBorderColor props 78 | */ 79 | borderColor?: string; 80 | /** 81 | * Border color when the knob is on the left (usually off) 82 | */ 83 | leftBorderColor?: string; 84 | /** 85 | * Border color when the knob is on the right (usually on) 86 | */ 87 | rightBorderColor?: string; 88 | 89 | // --------------------------------------------------------------- 90 | // Background color 91 | // --------------------------------------------------------------- 92 | 93 | /** 94 | * Background color for both knob position. This props will override leftBackgroundColor and rightBackgroundColor props 95 | */ 96 | backgroundColor?: string; 97 | /** 98 | * Background color when the knob is on the left (usually off) 99 | */ 100 | leftBackgroundColor?: string; 101 | /** 102 | * Background color when the knob is on the right (usually on) 103 | */ 104 | rightBackgroundColor?: string; 105 | 106 | /** 107 | * Background color when the toggle is disabled 108 | */ 109 | backgroundColorDisabled?: string; 110 | 111 | // --------------------------------------------------------------- 112 | // Radius 113 | // --------------------------------------------------------------- 114 | 115 | /** 116 | * Radius of container 117 | * 118 | */ 119 | radius?: string; 120 | /** 121 | * Radius of gap 122 | */ 123 | radiusBackground?: string; 124 | /** 125 | * Border radius of knob 126 | */ 127 | knobRadius?: string; 128 | 129 | // --------------------------------------------------------------- 130 | // Knob 131 | // --------------------------------------------------------------- 132 | 133 | /** 134 | * Knob width 135 | */ 136 | knobWidth?: string; 137 | /** 138 | * Knob height 139 | */ 140 | knobHeight?: string; 141 | /** 142 | * Knob gap. It's the distance from the border/background 143 | */ 144 | knobGap?: string; 145 | /** 146 | * Knob color for both knob position. This props will override the leftKnobColor and rightKnobColor 147 | */ 148 | knobColor?: string; 149 | /** 150 | * Knob color when it's on the left (usually off) 151 | */ 152 | leftKnobColor?: string; 153 | /** 154 | * Knob color when it's on the right (usually on) 155 | */ 156 | rightKnobColor?: string; 157 | } 158 | 159 | const ToggleContainer = styled.label``; 160 | 161 | const ToggleBase = styled.span` 162 | position: relative; 163 | box-sizing: border-box; 164 | display: inline-grid; 165 | align-items: center; 166 | width: ${p => p.width || (p.theme && p.theme.width) || defaultTheme.width}; 167 | height: ${p => p.height || (p.theme && p.theme.height) || defaultTheme.height}; 168 | vertical-align: middle; 169 | margin: 0 4px; 170 | 171 | input[type="checkbox"] { 172 | position: absolute; 173 | margin-left: -9999px; 174 | visibility: hidden; 175 | 176 | // off state 177 | & + label { 178 | display: inline-grid; 179 | box-sizing: border-box; 180 | align-items: center; 181 | outline: none; 182 | user-select: none; 183 | width: ${p => p.width || (p.theme && p.theme.width) || defaultTheme.width}; 184 | height: ${p => p.height || (p.theme && p.theme.height) || defaultTheme.height}; 185 | background-color: ${p => 186 | p.borderColor || p.leftBorderColor || (p.theme && p.theme.leftBorderColor) || defaultTheme.leftBorderColor}; 187 | border-radius: ${p => p.radius || (p.theme && p.theme.radius) || defaultTheme.radius}; 188 | cursor: pointer; 189 | transition: background ease-out 0.3s; 190 | 191 | &:before { 192 | content: ""; 193 | display: block; 194 | position: absolute; 195 | border-radius: ${p => 196 | p.radiusBackground || (p.theme && p.theme.radiusBackground) || defaultTheme.radiusBackground}; 197 | width: calc( 198 | ${p => p.width || (p.theme && p.theme.width) || defaultTheme.width} - 2 * 199 | ${p => p.borderWidth || (p.theme && p.theme.borderWidth) || defaultTheme.borderWidth} 200 | ); 201 | height: calc( 202 | ${p => p.height || (p.theme && p.theme.height) || defaultTheme.height} - 2 * 203 | ${p => p.borderWidth || (p.theme && p.theme.borderWidth) || defaultTheme.borderWidth} 204 | ); 205 | background-color: ${p => 206 | p.backgroundColor || 207 | p.leftBackgroundColor || 208 | (p.theme && p.theme.leftBackgroundColor) || 209 | defaultTheme.leftBackgroundColor}; 210 | left: ${p => p.borderWidth || (p.theme && p.theme.borderWidth) || defaultTheme.borderWidth}; 211 | } 212 | 213 | &:after { 214 | display: block; 215 | position: absolute; 216 | content: ""; 217 | width: ${p => p.knobWidth || (p.theme && p.theme.knobWidth) || defaultTheme.knobWidth}; 218 | height: ${p => p.knobHeight || (p.theme && p.theme.knobHeight) || defaultTheme.knobHeight}; 219 | border-radius: ${p => p.knobRadius || (p.theme && p.theme.knobRadius) || defaultTheme.knobRadius}; 220 | background-color: ${p => 221 | p.knobColor || p.leftKnobColor || (p.theme && p.theme.leftKnobColor) || defaultTheme.leftKnobColor}; 222 | transition: all ease-out 0.4s; 223 | margin-left: ${p => p.knobGap || (p.theme && p.theme.knobGap) || defaultTheme.knobGap}; 224 | } 225 | } 226 | 227 | // on state 228 | &:checked { 229 | & + label { 230 | background-color: ${p => 231 | p.borderColor || 232 | p.rightBorderColor || 233 | (p.theme && p.theme.rightBorderColor) || 234 | defaultTheme.rightBorderColor}; 235 | 236 | &:before { 237 | background-color: ${p => 238 | p.backgroundColor || 239 | p.rightBackgroundColor || 240 | (p.theme && p.theme.rightBackgroundColor) || 241 | defaultTheme.rightBackgroundColor}; 242 | } 243 | 244 | &:after { 245 | margin-left: calc( 246 | 100% - ${p => p.knobWidth || (p.theme && p.theme.knobWidth) || defaultTheme.knobWidth} - 247 | ${p => p.knobGap || (p.theme && p.theme.knobGap) || defaultTheme.knobGap} 248 | ); 249 | transition: all ease-out 0.2s; 250 | background-color: ${p => 251 | p.knobColor || p.rightKnobColor || (p.theme && p.theme.rightKnobColor) || defaultTheme.rightKnobColor}; 252 | } 253 | } 254 | 255 | &:disabled { 256 | & + label { 257 | background-color: ${p => 258 | p.backgroundColorDisabled || 259 | (p.theme && p.theme.backgroundColorDisabled) || 260 | defaultTheme.backgroundColorDisabled}; 261 | &:after { 262 | box-shadow: none; 263 | } 264 | } 265 | } 266 | } 267 | 268 | // disabled 269 | &:disabled { 270 | & + label { 271 | background-color: ${p => 272 | p.backgroundColorDisabled || 273 | (p.theme && p.theme.backgroundColorDisabled) || 274 | defaultTheme.backgroundColorDisabled}; 275 | cursor: default; 276 | &:after { 277 | box-shadow: none; 278 | background-color: ${p => 279 | p.backgroundColorDisabled || 280 | (p.theme && p.theme.backgroundColorDisabled) || 281 | defaultTheme.backgroundColorDisabled}; 282 | } 283 | } 284 | } 285 | } 286 | `; 287 | 288 | const Toggle: FunctionComponent = (props, ref) => { 289 | const { 290 | className, 291 | name, 292 | checked = false, 293 | controlled = false, 294 | disabled = false, 295 | value = "", 296 | onToggle = () => true, 297 | onRight = () => true, 298 | onLeft = () => true, 299 | ...others 300 | } = props; 301 | 302 | const cls = ["react-toggle", className || ""].join(" "); 303 | 304 | const onChangeHandler = (e: React.ChangeEvent) => { 305 | if (!!onToggle) { 306 | onToggle(e); 307 | 308 | if (e.target && e.target.checked) { 309 | onRight(e); 310 | } else { 311 | onLeft(e); 312 | } 313 | } 314 | }; 315 | 316 | const checkedProp = (controlled: boolean) => { 317 | return controlled ? { checked } : { defaultChecked: checked }; 318 | }; 319 | 320 | return ( 321 | 322 | 332 | 333 | 334 | ); 335 | }; 336 | 337 | export { Toggle as ToggleProps }; 338 | export default forwardRef(Toggle); 339 | -------------------------------------------------------------------------------- /dist/components/Toggle/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { 3 | if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } 4 | return cooked; 5 | }; 6 | var __assign = (this && this.__assign) || function () { 7 | __assign = Object.assign || function(t) { 8 | for (var s, i = 1, n = arguments.length; i < n; i++) { 9 | s = arguments[i]; 10 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 11 | t[p] = s[p]; 12 | } 13 | return t; 14 | }; 15 | return __assign.apply(this, arguments); 16 | }; 17 | var __rest = (this && this.__rest) || function (s, e) { 18 | var t = {}; 19 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 20 | t[p] = s[p]; 21 | if (s != null && typeof Object.getOwnPropertySymbols === "function") 22 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 23 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 24 | t[p[i]] = s[p[i]]; 25 | } 26 | return t; 27 | }; 28 | var __importStar = (this && this.__importStar) || function (mod) { 29 | if (mod && mod.__esModule) return mod; 30 | var result = {}; 31 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 32 | result["default"] = mod; 33 | return result; 34 | }; 35 | var __importDefault = (this && this.__importDefault) || function (mod) { 36 | return (mod && mod.__esModule) ? mod : { "default": mod }; 37 | }; 38 | Object.defineProperty(exports, "__esModule", { value: true }); 39 | var react_1 = __importStar(require("react")); 40 | var styled_components_1 = __importDefault(require("styled-components")); 41 | var theme_1 = __importDefault(require("../../theme/theme")); 42 | var ToggleContainer = styled_components_1.default.label(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""]))); 43 | var ToggleBase = styled_components_1.default.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n box-sizing: border-box;\n display: inline-grid;\n align-items: center;\n width: ", ";\n height: ", ";\n vertical-align: middle;\n margin: 0 4px;\n\n input[type=\"checkbox\"] {\n position: absolute;\n margin-left: -9999px;\n visibility: hidden;\n\n // off state\n & + label {\n display: inline-grid;\n box-sizing: border-box;\n align-items: center;\n outline: none;\n user-select: none;\n width: ", ";\n height: ", ";\n background-color: ", ";\n border-radius: ", ";\n cursor: pointer;\n transition: background ease-out 0.3s;\n\n &:before {\n content: \"\";\n display: block;\n position: absolute;\n border-radius: ", ";\n width: calc(\n ", " - 2 *\n ", "\n );\n height: calc(\n ", " - 2 *\n ", "\n );\n background-color: ", ";\n left: ", ";\n }\n\n &:after {\n display: block;\n position: absolute;\n content: \"\";\n width: ", ";\n height: ", ";\n border-radius: ", ";\n background-color: ", ";\n transition: all ease-out 0.4s;\n margin-left: ", ";\n }\n }\n\n // on state\n &:checked {\n & + label {\n background-color: ", ";\n\n &:before {\n background-color: ", ";\n }\n\n &:after {\n margin-left: calc(\n 100% - ", " -\n ", "\n );\n transition: all ease-out 0.2s;\n background-color: ", ";\n }\n }\n\n &:disabled {\n & + label {\n background-color: ", ";\n &:after {\n box-shadow: none;\n }\n }\n }\n }\n\n // disabled\n &:disabled {\n & + label {\n background-color: ", ";\n cursor: default;\n &:after {\n box-shadow: none;\n background-color: ", ";\n }\n }\n }\n }\n"], ["\n position: relative;\n box-sizing: border-box;\n display: inline-grid;\n align-items: center;\n width: ", ";\n height: ", ";\n vertical-align: middle;\n margin: 0 4px;\n\n input[type=\"checkbox\"] {\n position: absolute;\n margin-left: -9999px;\n visibility: hidden;\n\n // off state\n & + label {\n display: inline-grid;\n box-sizing: border-box;\n align-items: center;\n outline: none;\n user-select: none;\n width: ", ";\n height: ", ";\n background-color: ", 44 | ";\n border-radius: ", ";\n cursor: pointer;\n transition: background ease-out 0.3s;\n\n &:before {\n content: \"\";\n display: block;\n position: absolute;\n border-radius: ", 45 | ";\n width: calc(\n ", " - 2 *\n ", "\n );\n height: calc(\n ", " - 2 *\n ", "\n );\n background-color: ", 46 | ";\n left: ", ";\n }\n\n &:after {\n display: block;\n position: absolute;\n content: \"\";\n width: ", ";\n height: ", ";\n border-radius: ", ";\n background-color: ", 47 | ";\n transition: all ease-out 0.4s;\n margin-left: ", ";\n }\n }\n\n // on state\n &:checked {\n & + label {\n background-color: ", 48 | ";\n\n &:before {\n background-color: ", 49 | ";\n }\n\n &:after {\n margin-left: calc(\n 100% - ", " -\n ", "\n );\n transition: all ease-out 0.2s;\n background-color: ", 50 | ";\n }\n }\n\n &:disabled {\n & + label {\n background-color: ", 51 | ";\n &:after {\n box-shadow: none;\n }\n }\n }\n }\n\n // disabled\n &:disabled {\n & + label {\n background-color: ", 52 | ";\n cursor: default;\n &:after {\n box-shadow: none;\n background-color: ", 53 | ";\n }\n }\n }\n }\n"])), function (p) { return p.width || (p.theme && p.theme.width) || theme_1.default.width; }, function (p) { return p.height || (p.theme && p.theme.height) || theme_1.default.height; }, function (p) { return p.width || (p.theme && p.theme.width) || theme_1.default.width; }, function (p) { return p.height || (p.theme && p.theme.height) || theme_1.default.height; }, function (p) { 54 | return p.borderColor || p.leftBorderColor || (p.theme && p.theme.leftBorderColor) || theme_1.default.leftBorderColor; 55 | }, function (p) { return p.radius || (p.theme && p.theme.radius) || theme_1.default.radius; }, function (p) { 56 | return p.radiusBackground || (p.theme && p.theme.radiusBackground) || theme_1.default.radiusBackground; 57 | }, function (p) { return p.width || (p.theme && p.theme.width) || theme_1.default.width; }, function (p) { return p.borderWidth || (p.theme && p.theme.borderWidth) || theme_1.default.borderWidth; }, function (p) { return p.height || (p.theme && p.theme.height) || theme_1.default.height; }, function (p) { return p.borderWidth || (p.theme && p.theme.borderWidth) || theme_1.default.borderWidth; }, function (p) { 58 | return p.backgroundColor || 59 | p.leftBackgroundColor || 60 | (p.theme && p.theme.leftBackgroundColor) || 61 | theme_1.default.leftBackgroundColor; 62 | }, function (p) { return p.borderWidth || (p.theme && p.theme.borderWidth) || theme_1.default.borderWidth; }, function (p) { return p.knobWidth || (p.theme && p.theme.knobWidth) || theme_1.default.knobWidth; }, function (p) { return p.knobHeight || (p.theme && p.theme.knobHeight) || theme_1.default.knobHeight; }, function (p) { return p.knobRadius || (p.theme && p.theme.knobRadius) || theme_1.default.knobRadius; }, function (p) { 63 | return p.knobColor || p.leftKnobColor || (p.theme && p.theme.leftKnobColor) || theme_1.default.leftKnobColor; 64 | }, function (p) { return p.knobGap || (p.theme && p.theme.knobGap) || theme_1.default.knobGap; }, function (p) { 65 | return p.borderColor || 66 | p.rightBorderColor || 67 | (p.theme && p.theme.rightBorderColor) || 68 | theme_1.default.rightBorderColor; 69 | }, function (p) { 70 | return p.backgroundColor || 71 | p.rightBackgroundColor || 72 | (p.theme && p.theme.rightBackgroundColor) || 73 | theme_1.default.rightBackgroundColor; 74 | }, function (p) { return p.knobWidth || (p.theme && p.theme.knobWidth) || theme_1.default.knobWidth; }, function (p) { return p.knobGap || (p.theme && p.theme.knobGap) || theme_1.default.knobGap; }, function (p) { 75 | return p.knobColor || p.rightKnobColor || (p.theme && p.theme.rightKnobColor) || theme_1.default.rightKnobColor; 76 | }, function (p) { 77 | return p.backgroundColorDisabled || 78 | (p.theme && p.theme.backgroundColorDisabled) || 79 | theme_1.default.backgroundColorDisabled; 80 | }, function (p) { 81 | return p.backgroundColorDisabled || 82 | (p.theme && p.theme.backgroundColorDisabled) || 83 | theme_1.default.backgroundColorDisabled; 84 | }, function (p) { 85 | return p.backgroundColorDisabled || 86 | (p.theme && p.theme.backgroundColorDisabled) || 87 | theme_1.default.backgroundColorDisabled; 88 | }); 89 | var Toggle = function (props, ref) { 90 | var className = props.className, name = props.name, _a = props.checked, checked = _a === void 0 ? false : _a, _b = props.controlled, controlled = _b === void 0 ? false : _b, _c = props.disabled, disabled = _c === void 0 ? false : _c, _d = props.value, value = _d === void 0 ? "" : _d, _e = props.onToggle, onToggle = _e === void 0 ? function () { return true; } : _e, _f = props.onRight, onRight = _f === void 0 ? function () { return true; } : _f, _g = props.onLeft, onLeft = _g === void 0 ? function () { return true; } : _g, others = __rest(props, ["className", "name", "checked", "controlled", "disabled", "value", "onToggle", "onRight", "onLeft"]); 91 | var cls = ["react-toggle", className || ""].join(" "); 92 | var onChangeHandler = function (e) { 93 | if (!!onToggle) { 94 | onToggle(e); 95 | var target = e.target; 96 | if (target && target.checked) { 97 | onRight(e); 98 | } 99 | else { 100 | onLeft(e); 101 | } 102 | } 103 | }; 104 | var checkedProp = function (controlled) { 105 | return controlled ? { checked: checked } : { defaultChecked: checked }; 106 | }; 107 | return (react_1.default.createElement(ToggleBase, __assign({ className: cls }, others), 108 | react_1.default.createElement("input", __assign({ ref: ref, onChange: onChangeHandler, type: "checkbox", id: name, name: name, value: value, disabled: disabled }, checkedProp(controlled))), 109 | react_1.default.createElement(ToggleContainer, { htmlFor: name }))); 110 | }; 111 | exports.ToggleProps = Toggle; 112 | exports.default = react_1.forwardRef(Toggle); 113 | var templateObject_1, templateObject_2; 114 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /docs/component---srcdocs-theming-mdx-60f180b0733ac7a3bc63.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///../srcdocs/theming.mdx"],"names":["_frontmatter","layoutProps","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","__position","__code","__scope","Playground","Props","Toggle","ReactToggleThemeProvider","name","backgroundColor","rightBackgroundColor","radius","radiusBackground","knobRadius","width","height","knobWidth","knobHeight","borderWidth","knobGap","parentName","theme","leftBackgroundColor","isMDXComponent"],"mappings":"8gBASO,IAAMA,EAAe,Q,qMAE5B,IAKMC,EAAc,CAClBD,gBAEIE,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,E,oIACF,mBACD,OAAO,YAACJ,EAAD,KAAeD,EAAiBK,EAAhC,CAAuCD,WAAYA,EAAYE,Q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,CAAYnB,WAAY,EAAGC,OAAQ,iSAA0SC,QAAS,CACpVJ,QACAH,kBACAQ,eACAC,UACAC,WACAC,8BACCP,QAAQ,cACb,YAAC,IAAD,CAA0BqB,MAAO,CAC3BC,oBAAqB,UACpBtB,QAAQ,4BACb,uBACE,oEACA,YAAC,IAAD,CAAQQ,KAAK,OAAOR,QAAQ,WAC5B,YAAC,IAAD,CAAQQ,KAAK,OAAOR,QAAQ,WAC5B,YAAC,IAAD,CAAQQ,KAAK,OAAOR,QAAQ,WAC5B,YAAC,IAAD,CAAQQ,KAAK,OAAOR,QAAQ,cAI9B,6K,4LAKJH,EAAW0B,gBAAiB","file":"component---srcdocs-theming-mdx-60f180b0733ac7a3bc63.js","sourcesContent":["import React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nimport DefaultLayout from \"/Users/giovambattistafazioli/Lavori/Github/react-toggle/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nimport { Playground, Props } from 'docz';\nimport Toggle from '../src/components/Toggle';\nimport ReactToggleThemeProvider from '../src/theme/';\nexport const _frontmatter = {};\n\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n return
;\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n\n\n

{`Theming`}

\n

{`This new version allow to change the whole toggle appearance. Now you'll be able to change every single color and size, for each single toggle component of for the whole user interface.`}

\n

{`How change the toggle appearance`}

\n

{`You may change the toggle appearance in two way: by using the new props for each single instance of your toggle component, or by using a theme provider.`}

\n

{`New appearance props`}

\n

{`You may use the new props to change the appearance for a single instance of component`}

\n Change the background

\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the background

\n \n
\n Change the background when on

\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the background when on

\n \n
\n

{`Now you can also change others appearance properties`}

\n Change the shape

\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the shape

\n \n
\n Change the width size

\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the width size

\n \n
\n Change the height size

\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the height size

\n \n
\n Change the knob size

\\n\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the knob size

\n \n \n
\n

{`You can also change the size and the border`}

\n Change the border size

\\n\\n\\n\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the border size

\n \n \n \n \n
\n

{`Of course, you can set the knob gap`}

\n Change the border size

\\n\\n\\n\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the border size

\n \n \n \n \n
\n

{`Theme Provider`}

\n

{`Instead of change every single props, you might use the `}{`ReactToggleThemeProvider`}

\n
{`import {ReactToggleThemeProvider} from \"react-toggle-component\";\n`}
\n

{`The current default theme is the following`}

\n
{`export default {\n  version: \"1.0.0\",\n  width: \"48px\",\n  height: \"24px\",\n\n  borderWidth: \"2px\",\n  borderColor: \"#aaa\",\n  leftBorderColor: \"#aaa\",\n  rightBorderColor: \"#3887b7\",\n\n  leftBackgroundColor : \"#fff\",\n  rightBackgroundColor : \"#fff\",\n  backgroundColorDisabled : \"#eee\",\n\n  radius : \"256px\",\n  radiusBackground : \"256px\",\n  knobRadius : \"100%\",\n\n  knobWidth : \"16px\",\n  knobHeight : \"16px\",\n  knobGap: \"4px\",\n\n  knobColor: \"#aaa\",\n  leftKnobColor: \"#aaa\",\n  rightKnobColor: \"#3887b7\",\n};\n`}
\n \\n
\\n

All toggle children will use the same theme

\\n \\n \\n \\n \\n
\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n \n
\n

All toggle children will use the same theme

\n \n \n \n \n
\n
\n
\n

{`As you can see from the above example, you don't need to write your own custome theme with all properties, you may override one or more properties.`}

\n\n
;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""} -------------------------------------------------------------------------------- /docs/component---srcdocs-theming-mdx-c292665b7998848ec7ec.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///../srcdocs/theming.mdx"],"names":["_frontmatter","layoutProps","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","__position","__code","__scope","Playground","Props","Toggle","ReactToggleThemeProvider","name","backgroundColor","rightBackgroundColor","radius","radiusBackground","knobRadius","width","height","knobWidth","knobHeight","borderWidth","knobGap","parentName","theme","leftBackgroundColor","isMDXComponent"],"mappings":"8gBASO,IAAMA,EAAe,Q,qMAE5B,IAKMC,EAAc,CAClBD,gBAEIE,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,E,oIACF,mBACD,OAAO,YAACJ,EAAD,KAAeD,EAAiBK,EAAhC,CAAuCD,WAAYA,EAAYE,QAAQ,cAI5E,iBAAQ,CACN,GAAM,WADR,WAGA,kNACA,iBAAQ,CACN,GAAM,oCADR,oCAGA,iLACA,iBAAQ,CACN,GAAM,wBADR,wBAGA,8GACA,YAAC,IAAD,CAAYC,WAAY,EAAGC,OAAQ,sFAA2FC,QAAS,CACrIJ,QACAH,kBACAQ,eACAC,UACAC,WACAC,8BACCP,QAAQ,cACb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AD,CAAQQ,KAAK,OAAOR,QAAQ,WAC5B,YAAC,IAAD,CAAQQ,KAAK,OAAOR,QAAQ,WAC5B,YAAC,IAAD,CAAQQ,KAAK,OAAOR,QAAQ,cAI9B,6K,4LAKJH,EAAW0B,gBAAiB","file":"component---srcdocs-theming-mdx-c292665b7998848ec7ec.js","sourcesContent":["import React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nimport DefaultLayout from \"/Users/giovambattistafazioli/Lavori/Github/react-toggle/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nimport { Playground, Props } from 'docz';\nimport Toggle from '../src/components/Toggle';\nimport ReactToggleThemeProvider from '../src/theme/';\nexport const _frontmatter = {};\n\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n return
;\n};\n\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n\n\n\n

{`Theming`}

\n

{`This new version allow to change the whole toggle appearance. Now you'll be able to change every single color and size, for each single toggle component of for the whole user interface.`}

\n

{`How change the toggle appearance`}

\n

{`You may change the toggle appearance in two way: by using the new props for each single instance of your toggle component, or by using a theme provider.`}

\n

{`New appearance props`}

\n

{`You may use the new props to change the appearance for a single instance of component`}

\n Change the background

\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the background

\n \n
\n Change the background when on

\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the background when on

\n \n
\n

{`Now you can also change others appearance properties`}

\n Change the shape

\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the shape

\n \n
\n Change the width size

\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the width size

\n \n
\n Change the height size

\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the height size

\n \n
\n Change the knob size

\\n\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the knob size

\n \n \n
\n

{`You can also change the size and the border`}

\n Change the border size

\\n\\n\\n\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the border size

\n \n \n \n \n
\n

{`Of course, you can set the knob gap`}

\n Change the border size

\\n\\n\\n\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n

Change the border size

\n \n \n \n \n
\n

{`Theme Provider`}

\n

{`Instead of change every single props, you might use the `}{`ReactToggleThemeProvider`}

\n
{`import {ReactToggleThemeProvider} from \"react-toggle-component\";\n`}
\n

{`The current default theme is the following`}

\n
{`export default {\n  version: \"1.0.0\",\n  width: \"48px\",\n  height: \"24px\",\n\n  borderWidth: \"2px\",\n  borderColor: \"#aaa\",\n  leftBorderColor: \"#aaa\",\n  rightBorderColor: \"#3887b7\",\n\n  leftBackgroundColor : \"#fff\",\n  rightBackgroundColor : \"#fff\",\n  backgroundColorDisabled : \"#eee\",\n\n  radius : \"256px\",\n  radiusBackground : \"256px\",\n  knobRadius : \"100%\",\n\n  knobWidth : \"16px\",\n  knobHeight : \"16px\",\n  knobGap: \"4px\",\n\n  knobColor: \"#aaa\",\n  leftKnobColor: \"#aaa\",\n  rightKnobColor: \"#3887b7\",\n};\n`}
\n \\n
\\n

All toggle children will use the same theme

\\n \\n \\n \\n \\n
\\n'} __scope={{\n props,\n DefaultLayout,\n Playground,\n Props,\n Toggle,\n ReactToggleThemeProvider\n }} mdxType=\"Playground\">\n \n
\n

All toggle children will use the same theme

\n \n \n \n \n
\n
\n
\n

{`As you can see from the above example, you don't need to write your own custome theme with all properties, you may override one or more properties.`}

\n\n
;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""} -------------------------------------------------------------------------------- /docs/webpack-runtime-28c7d89f58570c4f17a7.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","9","exports","module","l","e","promises","installedChunkData","promise","Promise","resolve","reject","onScriptComplete","script","document","createElement","charset","timeout","nc","setAttribute","src","p","jsonpScriptSrc","error","Error","event","onerror","onload","clearTimeout","chunk","errorType","type","realSrc","target","message","name","request","undefined","setTimeout","head","appendChild","all","m","c","d","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","oe","err","console","jsonpArray","window","oldJsonpFunction","slice"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDc,EAAQd,GAAYG,EAAYH,IAKlC,IAFGe,GAAqBA,EAAoBhB,GAEt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E,eAAe7C,EAAS,aAAc,CAAEmD,OAAO,KAQvDvD,EAAoBwD,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQvD,EAAoBuD,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAK7E,OAAO8E,OAAO,MAGvB,GAFA5D,EAAoBoD,EAAEO,GACtB7E,OAAOmE,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOvD,EAAoB8C,EAAEa,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIR3D,EAAoB+D,EAAI,SAAS1D,GAChC,IAAI0C,EAAS1C,GAAUA,EAAOqD,WAC7B,WAAwB,OAAOrD,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAL,EAAoB8C,EAAEC,EAAQ,IAAKA,GAC5BA,GAIR/C,EAAoBgD,EAAI,SAASgB,EAAQC,GAAY,OAAOnF,OAAOC,UAAUC,eAAeC,KAAK+E,EAAQC,IAGzGjE,EAAoBuB,EAAI,iBAGxBvB,EAAoBkE,GAAK,SAASC,GAA2B,MAApBC,QAAQ3C,MAAM0C,GAAYA,GAEnE,IAAIE,EAAaC,OAAqB,aAAIA,OAAqB,cAAK,GAChEC,EAAmBF,EAAWlF,KAAK2E,KAAKO,GAC5CA,EAAWlF,KAAOf,EAClBiG,EAAaA,EAAWG,QACxB,IAAI,IAAI7F,EAAI,EAAGA,EAAI0F,EAAWxF,OAAQF,IAAKP,EAAqBiG,EAAW1F,IAC3E,IAAIU,EAAsBkF,EAI1B9E,I","file":"webpack-runtime-28c7d89f58570c4f17a7.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t9: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// script path function\n \tfunction jsonpScriptSrc(chunkId) {\n \t\treturn __webpack_require__.p + \"\" + ({\"2\":\"component---code-of-conduct-md\",\"3\":\"component---src-pages-404-js\",\"4\":\"component---srcdocs-components-toggle-toggle-mdx\",\"5\":\"component---srcdocs-getstarted-mdx\",\"6\":\"component---srcdocs-theming-mdx\",\"7\":\"component---srcdocs-upgrade-mdx\"}[chunkId]||chunkId) + \"-\" + {\"2\":\"d54928cb0bd0d43e52f3\",\"3\":\"b251b15ff0df26ecccce\",\"4\":\"bd8df1307efa34d15e59\",\"5\":\"9a40a16773f9a637c369\",\"6\":\"60f180b0733ac7a3bc63\",\"7\":\"c6eadf8f582d6cf92114\"}[chunkId] + \".js\"\n \t}\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tvar promises = [];\n\n\n \t\t// JSONP chunk loading for javascript\n\n \t\tvar installedChunkData = installedChunks[chunkId];\n \t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n \t\t\t// a Promise means \"currently loading\".\n \t\t\tif(installedChunkData) {\n \t\t\t\tpromises.push(installedChunkData[2]);\n \t\t\t} else {\n \t\t\t\t// setup Promise in chunk cache\n \t\t\t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\t\t\tinstalledChunkData = installedChunks[chunkId] = [resolve, reject];\n \t\t\t\t});\n \t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n \t\t\t\t// start chunk loading\n \t\t\t\tvar script = document.createElement('script');\n \t\t\t\tvar onScriptComplete;\n\n \t\t\t\tscript.charset = 'utf-8';\n \t\t\t\tscript.timeout = 120;\n \t\t\t\tif (__webpack_require__.nc) {\n \t\t\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t\t\t}\n \t\t\t\tscript.src = jsonpScriptSrc(chunkId);\n\n \t\t\t\t// create error before stack unwound to get useful stacktrace later\n \t\t\t\tvar error = new Error();\n \t\t\t\tonScriptComplete = function (event) {\n \t\t\t\t\t// avoid mem leaks in IE.\n \t\t\t\t\tscript.onerror = script.onload = null;\n \t\t\t\t\tclearTimeout(timeout);\n \t\t\t\t\tvar chunk = installedChunks[chunkId];\n \t\t\t\t\tif(chunk !== 0) {\n \t\t\t\t\t\tif(chunk) {\n \t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n \t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n \t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n \t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n \t\t\t\t\t\t\terror.type = errorType;\n \t\t\t\t\t\t\terror.request = realSrc;\n \t\t\t\t\t\t\tchunk[1](error);\n \t\t\t\t\t\t}\n \t\t\t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t\t\t}\n \t\t\t\t};\n \t\t\t\tvar timeout = setTimeout(function(){\n \t\t\t\t\tonScriptComplete({ type: 'timeout', target: script });\n \t\t\t\t}, 120000);\n \t\t\t\tscript.onerror = script.onload = onScriptComplete;\n \t\t\t\tdocument.head.appendChild(script);\n \t\t\t}\n \t\t}\n \t\treturn Promise.all(promises);\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/react-toggle/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""} -------------------------------------------------------------------------------- /docs/webpack-runtime-950e38aff32dfc4babdc.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","9","exports","module","l","e","promises","installedChunkData","promise","Promise","resolve","reject","onScriptComplete","script","document","createElement","charset","timeout","nc","setAttribute","src","p","jsonpScriptSrc","error","Error","event","onerror","onload","clearTimeout","chunk","errorType","type","realSrc","target","message","name","request","undefined","setTimeout","head","appendChild","all","m","c","d","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","oe","err","console","jsonpArray","window","oldJsonpFunction","slice"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDc,EAAQd,GAAYG,EAAYH,IAKlC,IAFGe,GAAqBA,EAAoBhB,GAEtCO,EAASC,QACdD,EAASU,OAATV,GAOD,OAHAW,EAAgBJ,KA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wD,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQvD,EAAoBuD,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAK7E,OAAO8E,OAAO,MAGvB,GAFA5D,EAAoBoD,EAAEO,GACtB7E,OAAOmE,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOvD,EAAoB8C,EAAEa,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIR3D,EAAoB+D,EAAI,SAAS1D,GAChC,IAAI0C,EAAS1C,GAAUA,EAAOqD,WAC7B,WAAwB,OAAOrD,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAL,EAAoB8C,EAAEC,EAAQ,IAAKA,GAC5BA,GAIR/C,EAAoBgD,EAAI,SAASgB,EAAQC,GAAY,OAAOnF,OAAOC,UAAUC,eAAeC,KAAK+E,EAAQC,IAGzGjE,EAAoBuB,EAAI,iBAGxBvB,EAAoBkE,GAAK,SAASC,GAA2B,MAApBC,QAAQ3C,MAAM0C,GAAYA,GAEnE,IAAIE,EAAaC,OAAqB,aAAIA,OAAqB,cAAK,GAChEC,EAAmBF,EAAWlF,KAAK2E,KAAKO,GAC5CA,EAAWlF,KAAOf,EAClBiG,EAAaA,EAAWG,QACxB,IAAI,IAAI7F,EAAI,EAAGA,EAAI0F,EAAWxF,OAAQF,IAAKP,EAAqBiG,EAAW1F,IAC3E,IAAIU,EAAsBkF,EAI1B9E,I","file":"webpack-runtime-950e38aff32dfc4babdc.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t9: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// script path function\n \tfunction jsonpScriptSrc(chunkId) {\n \t\treturn __webpack_require__.p + \"\" + ({\"2\":\"component---code-of-conduct-md\",\"3\":\"component---src-pages-404-js\",\"4\":\"component---srcdocs-components-toggle-toggle-mdx\",\"5\":\"component---srcdocs-getstarted-mdx\",\"6\":\"component---srcdocs-theming-mdx\",\"7\":\"component---srcdocs-upgrade-mdx\"}[chunkId]||chunkId) + \"-\" + {\"2\":\"d54928cb0bd0d43e52f3\",\"3\":\"b251b15ff0df26ecccce\",\"4\":\"9299f5eef9c8f4577218\",\"5\":\"9a40a16773f9a637c369\",\"6\":\"c292665b7998848ec7ec\",\"7\":\"c6eadf8f582d6cf92114\"}[chunkId] + \".js\"\n \t}\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tvar promises = [];\n\n\n \t\t// JSONP chunk loading for javascript\n\n \t\tvar installedChunkData = installedChunks[chunkId];\n \t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n \t\t\t// a Promise means \"currently loading\".\n \t\t\tif(installedChunkData) {\n \t\t\t\tpromises.push(installedChunkData[2]);\n \t\t\t} else {\n \t\t\t\t// setup Promise in chunk cache\n \t\t\t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\t\t\tinstalledChunkData = installedChunks[chunkId] = [resolve, reject];\n \t\t\t\t});\n \t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n \t\t\t\t// start chunk loading\n \t\t\t\tvar script = document.createElement('script');\n \t\t\t\tvar onScriptComplete;\n\n \t\t\t\tscript.charset = 'utf-8';\n \t\t\t\tscript.timeout = 120;\n \t\t\t\tif (__webpack_require__.nc) {\n \t\t\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t\t\t}\n \t\t\t\tscript.src = jsonpScriptSrc(chunkId);\n\n \t\t\t\t// create error before stack unwound to get useful stacktrace later\n \t\t\t\tvar error = new Error();\n \t\t\t\tonScriptComplete = function (event) {\n \t\t\t\t\t// avoid mem leaks in IE.\n \t\t\t\t\tscript.onerror = script.onload = null;\n \t\t\t\t\tclearTimeout(timeout);\n \t\t\t\t\tvar chunk = installedChunks[chunkId];\n \t\t\t\t\tif(chunk !== 0) {\n \t\t\t\t\t\tif(chunk) {\n \t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n \t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n \t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n \t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n \t\t\t\t\t\t\terror.type = errorType;\n \t\t\t\t\t\t\terror.request = realSrc;\n \t\t\t\t\t\t\tchunk[1](error);\n \t\t\t\t\t\t}\n \t\t\t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t\t\t}\n \t\t\t\t};\n \t\t\t\tvar timeout = setTimeout(function(){\n \t\t\t\t\tonScriptComplete({ type: 'timeout', target: script });\n \t\t\t\t}, 120000);\n \t\t\t\tscript.onerror = script.onload = onScriptComplete;\n \t\t\t\tdocument.head.appendChild(script);\n \t\t\t}\n \t\t}\n \t\treturn Promise.all(promises);\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/react-toggle/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""} -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | Get Started | React Toggle
React Toggle
Edit page
Code of conduct
Components
Get StartedRequirementsInstallationCode SandboxThemingUpgrade Guide

Get Started

Requirements

  • node
  • yarn

Installation

You can use either npm

npm i react-toggle-component

or yarn

yarn add react-toggle-component

Code Sandbox

--------------------------------------------------------------------------------