{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"f8a84e198a0a0905177ea095d4b5e5dfa5bef4a1","tarball":"https://registry.npmjs.org/@material/switch/-/switch-13.0.0-canary.e3346766f.0.tgz","fileCount":58,"integrity":"sha512-FWCjBIa1oPTTuB2FwwcA/CEt+8VcPopKDTRRB4srchMTx08zwv3wIfYqUsObvJXzzpLPuywEDrJVGDHdHy6tdQ==","signatures":[{"sig":"MEQCIHD1IphKFY74RaGTx1ffqET8YPsXebrPKYJzqyrEz5vhAiAK/CrPMTWwdd9DDOn/kRHSowZYjYFxHwNPm1+coA0Vaw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":718280,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhFswJCRA9TVsSAnZWagAAQekP/A0S7ShJY/T4xrmS4uZj\nU/1EjJ2ehAeZ+JvkEbem1l2PNIZRF8XRvXJdp/q6Ul7wFqn/N9NL8aY+r49G\nz9JpGzByp1dyKcikqsgj50puCmvjD2O+w73x1wVYVCFcfS9orvEUsqOhphAv\nZ70YdmMW190bU7ZSYbvj/5dU3HDTwttKMw+mfu48q77WwXQL/t6dG+28JRNU\n+suKwZVhHpLz1R5zO/hjVgMIjgV/2/c9s/6kNPS8UeyXq2o1CF53PgSOQyJ4\nt5wVeCzX+Dy4nn9qvBwsiPau1J41kQZvrVFDrZcZm+f//AOqQLWZY97ZfOTz\n0T3z2UEESc7ER6/290iIQwFjrMhOWiX1J5c6AAJBYaOLiFk9mwAQd1zd0Ihv\nqQuT/2SdZJ2QXRt8AsBnA/MV28/MhA53WSVZl9aUiBWQbjzEYqqCaEw5dbc+\n6em4h+23Vr7FX/RHuBAgcmjZ+RwPRiCnuFl/zBUvnfDAIbfwSxtobh1CMQh1\n9371HyVEQqyYf21qSkoNsHSgFQy7s5zKkQd25lH3bxwb4rUZLU9L66IPpa1H\n47ffHq8OK2vlXh8NDwoVlRA+R+fKpFNNx75VGdMl32hFuXZx9sQ88VxO2L4e\nJ2ewEdTbLFRIcQWjUTVQPbcLmRK+qdGU+Ti+KYcfw/BX/RZQE6VEICDlWiMY\n9rgA\r\n=ix01\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/mdc.switch.js","name":"@material/switch","module":"index.js","readme":"<!--docs:\ntitle: \"Switches\"\nlayout: detail\nsection: components\niconId: switch\npath: /catalog/input-controls/switches/\n-->\n\n# Selection controls: switches\n\n[Selection controls](https://material.io/components/selection-controls#usage)\nallow the user to select options.\n\nSwitches toggle the state of a single setting on or off. They are the preferred\nway to adjust settings on mobile.\n\n![Switch hero example for menu options](images/switch-hero.png)\n\n**Contents**\n\n*   [Using switches](#using-switches)\n*   [Switches](#switches)\n*   [Other variants](#other-variants)\n*   [API](#api)\n*   [Usage within web frameworks](#usage-within-web-frameworks)\n\n## Using switches\n\nUse switches to:\n\n*   Toggle a single item on or off, on mobile and tablet\n*   Immediately activate or deactivate something\n\n### Installing switches\n\n```\nnpm install @material/switch\n```\n\n### Styles\n\n```scss\n@use '@material/switch/styles';\n```\n\n### JavaScript instantiation\n\nThe switch requires JavaScript to function, so it is necessary to instantiate\n`MDCSwitch` on the `mdc-switch` element.\n\n```js\nimport {MDCSwitch} from '@material/switch';\n\nfor (const el of document.querySelectorAll('.mdc-switch')) {\n  const switchControl = new MDCSwitch(el);\n}\n```\n\n**Note: See [Importing the JS component](../../docs/importing-js.md) for more\ninformation on how to import JavaScript.**\n\n## Switches\n\n### Switch example\n\n```html\n<button id=\"basic-switch\" class=\"mdc-switch mdc-switch--unselected\" type=\"button\" role=\"switch\" aria-checked=\"false\">\n  <div class=\"mdc-switch__track\"></div>\n  <div class=\"mdc-switch__handle-track\">\n    <div class=\"mdc-switch__handle\">\n      <div class=\"mdc-switch__shadow\">\n        <div class=\"mdc-elevation-overlay\"></div>\n      </div>\n      <div class=\"mdc-switch__ripple\"></div>\n      <div class=\"mdc-switch__icons\">\n        <svg class=\"mdc-switch__icon mdc-switch__icon--on\" viewBox=\"0 0 24 24\">\n          <path d=\"M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z\" />\n        </svg>\n        <svg class=\"mdc-switch__icon mdc-switch__icon--off\" viewBox=\"0 0 24 24\">\n          <path d=\"M20 13H4v-2h16v2z\" />\n        </svg>\n      </div>\n    </div>\n  </div>\n</button>\n<label for=\"basic-switch\">off/on</label>\n```\n\n### Switch states\n\nSwitches can be on or off. Switches have enabled, hover, focused, and pressed\nstates.\n\n![Switch states in a table. Columns are enabled, disabled, hover, focused,\npressed. Rows are on or off.](images/switch-states.png)\n\n## Other variants\n\n### Initially disabled switch\n\nAdd the `disabled` attribute to the `mdc-switch` element to disable the switch.\nThis logic is handled by the `MDCSwitch.disabled` property, but you'll want to\navoid a FOUC by initially adding this attribute.\n\n```html\n<button id=\"disabled-switch\" class=\"mdc-switch mdc-switch--unselected\" type=\"button\" role=\"switch\" aria-checked=\"false\" disabled>\n  <div class=\"mdc-switch__track\"></div>\n  <div class=\"mdc-switch__handle-track\">\n    <div class=\"mdc-switch__handle\">\n      <div class=\"mdc-switch__shadow\">\n        <div class=\"mdc-elevation-overlay\"></div>\n      </div>\n      <div class=\"mdc-switch__ripple\"></div>\n      <div class=\"mdc-switch__icons\">\n        <svg class=\"mdc-switch__icon mdc-switch__icon--on\" viewBox=\"0 0 24 24\">\n          <path d=\"M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z\" />\n        </svg>\n        <svg class=\"mdc-switch__icon mdc-switch__icon--off\" viewBox=\"0 0 24 24\">\n          <path d=\"M20 13H4v-2h16v2z\" />\n        </svg>\n      </div>\n    </div>\n  </div>\n</button>\n<label for=\"disabled-switch\">off/on</label>\n```\n\n### Initially \"on\" switch\n\nAdd the `mdc-switch--selected` class and `aria-checked=\"true\"` attribute to the\n`mdc-switch` element to toggle the switch to \"on\". This logic is handled by the\n`MDCSwitch.selected` method, but you'll want to avoid a FOUC by initially adding\nthis class and attribute.\n\n```html\n<button id=\"selected-switch\" class=\"mdc-switch mdc-switch--selected\" type=\"button\" role=\"switch\" aria-checked=\"true\">\n  <div class=\"mdc-switch__track\"></div>\n  <div class=\"mdc-switch__handle-track\">\n    <div class=\"mdc-switch__handle\">\n      <div class=\"mdc-switch__shadow\">\n        <div class=\"mdc-elevation-overlay\"></div>\n      </div>\n      <div class=\"mdc-switch__ripple\"></div>\n      <div class=\"mdc-switch__icons\">\n        <svg class=\"mdc-switch__icon mdc-switch__icon--on\" viewBox=\"0 0 24 24\">\n          <path d=\"M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z\" />\n        </svg>\n        <svg class=\"mdc-switch__icon mdc-switch__icon--off\" viewBox=\"0 0 24 24\">\n          <path d=\"M20 13H4v-2h16v2z\" />\n        </svg>\n      </div>\n    </div>\n  </div>\n</button>\n<label for=\"selected-switch\">off/on</label>\n```\n\n## API\n\n### CSS classes\n\n| CSS Class                  | Description                                    |\n| -------------------------- | ---------------------------------------------- |\n| `mdc-switch`               | Mandatory, for the parent element.             |\n| `mdc-switch--unselected`   | Optional, styles the switch as unselected (\"off\") |\n| `mdc-switch--selected`     | Optional, styles the switch as selected (\"on\") |\n| `mdc-switch__track`        | Mandatory, for the track element.              |\n| `mdc-switch__handle-track` | Mandatory, for the handle's track element.     |\n| `mdc-switch__handle`       | Mandatory, for the handle element.             |\n| `mdc-switch__shadow`       | Mandatory, for the shadow effect.              |\n| `mdc-elevation-overlay`    | Mandatory, for the shadow effect's overlay in dark mode. |\n| `mdc-switch__ripple`       | Mandatory, for the ripple effect.              |\n| `mdc-switch__icons`        | Mandatory, for the icons.                      |\n| `mdc-switch__icon`         | Mandatory, for the icon elements.              |\n| `mdc-switch__icon--on`     | Mandatory, for the on icon.                    |\n| `mdc-switch__icon--off`    | Mandatory, for the off icon.                   |\n\n### Theme mixin\n\nThe switch may be customized using the `theme()` mixin and providing an\n[MDC Theme](../mdc-theme) string (such as `primary`) or other values to the\ntheme keys.\n\n```scss\n@use '@material/switch';\n@use '@material/theme/color-palette';\n@use '@material/theme/shadow-dom';\n\n// Include for IE11 support\n// @include shadow-dom.enable-css-selector-fallback-declarations(true);\n\n.my-switch {\n  @include switch.theme((\n    selected-handle-color: color-palette.$teal-600,\n    selected-track-color: color-palette.$teal-300,\n  ));\n}\n```\n\nView the [theme file](_switch-theme.scss) for available keys and built-in\nthemes.\n\n### `MDCSwitch` properties\n\n| Property   | Value Type | Description                                        |\n| ---------- | ---------- | -------------------------------------------------- |\n| `disabled` | Boolean    | Indicates whether or not the switch is disabled.   |\n| `selected` | Boolean    | If true, the switch is on. If false, the switch is off. |\n\n## Usage within web frameworks\n\nIf you are using a JavaScript framework, such as React or Angular, you can\ncreate a switch for your framework. Depending on your needs, you can use the\n_Simple Approach: Wrapping MDC Web Vanilla Components_, or the _Advanced\nApproach: Using Foundations and Adapters_. Please follow the instructions\n[here](../../docs/integrating-into-frameworks.md).\n\nSee [MDCSwitchAdapter](./adapter.ts) and [MDCSwitchFoundation](./foundation.ts)\nfor up-to-date code documentation of switch's foundation API.\n","gitHead":"03da616c76c8b7fab07a24f82209f171a2fec41c","license":"MIT","_npmUser":{"name":"abhiomkar","email":"abhiomkar@gmail.com"},"homepage":"https://github.com/material-components/material-components-web#readme","keywords":["material components","material design","switch"],"repository":{"url":"git+https://github.com/material-components/material-components-web.git","type":"git","directory":"packages/mdc-switch"},"_npmVersion":"lerna/3.20.2/node@v10.24.1+x64 (linux)","description":"The Material Components for the web switch component","directories":{},"maintainers":[{"name":"material-admin","email":"aprigogin+npm@google.com"},{"name":"abhiomkar","email":"abhiomkar@gmail.com"},{"name":"azakus","email":"dfreedm2@gmail.com"},{"name":"bicknellr","email":"bicknellr@gmail.com"},{"name":"bwobrien","email":"obrien.test@gmail.com"},{"name":"lynnjepsen","email":"lynnjepsen@google.com"},{"name":"acdvorak","email":"acdvorak@gmail.com"},{"name":"kfranqueiro","email":"kenneth.franqueiro@gmail.com"},{"name":"aprigogin","email":"andrey.prigogin@gmail.com"},{"name":"patrickrodee","email":"prodee@google.com"},{"name":"bonniez","email":"bonniez@google.com"},{"name":"moog16","email":"mattgoo@gmail.com"},{"name":"williamernest","email":"williamernest@google.com"},{"name":"aomarks","email":"aomarks@gmail.com"},{"name":"emarquez","email":"emarquez@google.com"},{"name":"allanchen","email":"allanchen@google.com"},{"name":"esgonzalez","email":"esgonzalez@google.com"},{"name":"asyncliz","email":"asyncliz@gmail.com"},{"name":"candysonya","email":"wangchan518@gmail.com"},{"name":"ssuarez","email":"sayrisuarez@google.com"},{"name":"taylorv","email":"brian.t.vann@gmail.com"}],"sideEffects":false,"_nodeVersion":"10.24.1","dependencies":{"tslib":"^2.1.0","@material/dom":"13.0.0-canary.e3346766f.0","@material/rtl":"13.0.0-canary.e3346766f.0","@material/base":"13.0.0-canary.e3346766f.0","@material/shape":"13.0.0-canary.e3346766f.0","@material/theme":"13.0.0-canary.e3346766f.0","@material/ripple":"13.0.0-canary.e3346766f.0","@material/tokens":"13.0.0-canary.e3346766f.0","@material/density":"13.0.0-canary.e3346766f.0","@material/animation":"13.0.0-canary.e3346766f.0","@material/elevation":"13.0.0-canary.e3346766f.0","@material/feature-targeting":"13.0.0-canary.e3346766f.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/switch_13.0.0-canary.e3346766f.0_1628883977632_0.24525069277985234","host":"s3://npm-registry-packages"},"_id":"@material/switch@13.0.0-canary.e3346766f.0","version":"13.0.0-canary.e3346766f.0"}