{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"eec9d9037c9acdc933f32283fb32bf638a405310","tarball":"https://registry.npmjs.org/@material/switch/-/switch-15.0.0-canary.cec7fb987.0.tgz","fileCount":58,"integrity":"sha512-h5wWQKJcNGRjjfqQndEBf/TDqF0oPZJfNICWoolpV3GH4GmV2Txlg4EjqjnAhiYgbils/iEuPT/cKvm5UvqafA==","signatures":[{"sig":"MEUCIEcLxMmJX9tjxQhwDyMIPh+gF1rDriRh7/FbC59QnEtkAiEA31T0HxBzdNIKBWtehW/J+WLZT6UBFMLdnZPsIuxwuU4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1065267,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjTTUDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrSzRAAoZFis17v7GL8Cmj3wwc7UJYwKauriBo5lHG6I81e4Jbhe42S\r\nH1RpL2x9QXmA8ef40se1hKGy6ftwE/V85xTsLXwm7FAc9Ckuo3QWxr89XEpZ\r\nn1/+i4Y7Bk/dy40sBapF+YWXIV2ET14lSFz947ziNkVReya4ncspv97YrpyO\r\nPFYCKMCYMATQZEo54Qu/AfxGqeNEzqMDH6k8AHl/1M8tghmBfCQ9J5o0TKQp\r\nSyCInqR+ReF5cfGVueaR2GN3IQTaZF9XYTUvdhB0MfRWoqIkV/2+9MGbcdiN\r\nokDviu5g9NpFprh5M+f4DmVqmPlljkVlbIcY3/oPxVkJl2eIVF/3DebvPFjS\r\nqVxOvVXU+WlLFd/c4k/2XxEaCVJpI/I01seE+hWL9E2rqy8vgPsniEPzwW0A\r\ni7ppqohSCk4U/ncb+j66Q2odxhPcnyk165UsqYcabuPlb8eHrZMXW6+julWd\r\nv7CYn2s5xAkivugdfWFRs0aoc0zUP0o3qqG0aqdnH1aOXrXuNOd8DIVedTcP\r\nE+hcbpQC04g/IeGjO/+6vdhNL0S/FaInhM7SkEWdGH8gjoSIR8546D5RVy6L\r\n1dUgAm29fEOk8wTs3A1HrfDVlZusqXUV5VJfIThFuMOlbpf0o3R2ooKFE8cs\r\n+mDssQThudUBYf1XjI43WytawA4G4tuc+Qo=\r\n=qIPz\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  <span class=\"mdc-switch__focus-ring-wrapper\">\n    <div class=\"mdc-switch__focus-ring\"></div>\n  </span>\n</button>\n<label for=\"basic-switch\">off/on</label>\n```\n\nThe `mdc-switch__focus-ring` element ensures that a focus indicator is displayed\nin high contrast mode around the active/focused switch.\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  <span class=\"mdc-switch__focus-ring-wrapper\">\n    <div class=\"mdc-switch__focus-ring\"></div>\n  </span>\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  <span class=\"mdc-switch__focus-ring-wrapper\">\n    <div class=\"mdc-switch__focus-ring\"></div>\n  </span>\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":"5af4beeec511ff0266173424b4b179e209402a5d","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@v14.20.1+x64 (linux)","description":"The Material Components for the web switch component","directories":{},"maintainers":[{"name":"material-admin","email":"aprigogin+npm@google.com"},{"name":"yefim","email":"hi@yef.im"},{"name":"abhiomkar","email":"abhiomkar@gmail.com"},{"name":"azakus","email":"dfreedm2@gmail.com"},{"name":"bicknellr","email":"bicknellr@gmail.com"},{"name":"aprigogin","email":"andrey.prigogin@gmail.com"},{"name":"patrickrodee","email":"prodee@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":"14.20.1","dependencies":{"tslib":"^2.1.0","safevalues":"^0.3.4","@material/dom":"15.0.0-canary.cec7fb987.0","@material/rtl":"15.0.0-canary.cec7fb987.0","@material/base":"15.0.0-canary.cec7fb987.0","@material/shape":"15.0.0-canary.cec7fb987.0","@material/theme":"15.0.0-canary.cec7fb987.0","@material/ripple":"15.0.0-canary.cec7fb987.0","@material/tokens":"15.0.0-canary.cec7fb987.0","@material/density":"15.0.0-canary.cec7fb987.0","@material/animation":"15.0.0-canary.cec7fb987.0","@material/elevation":"15.0.0-canary.cec7fb987.0","@material/focus-ring":"15.0.0-canary.cec7fb987.0","@material/feature-targeting":"15.0.0-canary.cec7fb987.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/switch_15.0.0-canary.cec7fb987.0_1666004227070_0.5954500066622379","host":"s3://npm-registry-packages"},"_id":"@material/switch@15.0.0-canary.cec7fb987.0","version":"15.0.0-canary.cec7fb987.0"}