{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"57828ba99309f51c222108e23d490286d43b0d9f","tarball":"https://registry.npmjs.org/@material/slider/-/slider-10.0.0-canary.ea55b87ca.0.tgz","fileCount":38,"integrity":"sha512-mNQQq75b06KEbiN4ZuoOhQLGNBQAzxtswWJgoU8zH2oMSEh8JaNYELLQos2rcn8MSX9mzt0+fAPKkqpoXEV1OA==","signatures":[{"sig":"MEYCIQD9lLAYy4/GuJnA5a16ay0dYtDVr1yzI7HAg3koaRwe/AIhAOEKjjL6RWVEw7lKl0k+oT4+RNwoVfqlFzW+Jwj1KEwE","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":783026,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgEKnVCRA9TVsSAnZWagAAPrMQAIs0+irCBSflDpcZgw/Z\nt76gIFQNKqauMvanHRsqYOodAGhKZCoY8NWfoaWYwV3r8UgRL+6bkFTVNbZN\nNPVoBLsEaDiPLP3Rw37WnODK03tOhejO3V3yRuliVinGILt/3ojGjIRZu6JR\nmGCmx0uxHqVsWvC7fW6ZI3TmWSzkMuSYADaFnLmmacqL2r8D5G2yYVsKuD4D\n4Uz1LFUsG7hfs8jKJDHzCvLSmj3k9RBj2MGPahgSfBLH5yuU4l2f/ftU7QFE\nvial8V2a6SjjdKluuvhRg2nI8YHFHMUDy65krIAYDsua637W9ZqIRw8D0AMt\noEmY2CWh5OqwSHlwaQElgVAHNKv1/qyujvslDubbvxPNiGIxfhbO5rXLRwUR\nswMPdCy5S3CkIYYnERmEnNQY4xMjZAWs7E+WOb3iVtzRfQ+8TGGqxtY3SpZv\nqx9HdjSOD53JrUpjfh4muFWi3DcP/MJdlLTwBIZ3DVCKXEPQuPaLxVihgFrQ\n4nBvgG6Uul0TvViTM9E9R3myEkkW1pi4aIBW5S+DqnMiEykNXmUym1TsNxaO\npkbXWJUfDbQoS+u+nqWerbWrjPlFYvQpSnTcaWfd1QpvaO+mCL92ZdFCfMbT\ntRY85llAvS/VDO39RLe5EocpZNxQIdkyF4DqXvu43iMtStbiRuIH79P0RSQb\nXiRg\r\n=1/jY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/mdc.slider.js","name":"@material/slider","types":"dist/mdc.slider.d.ts","module":"index.js","readme":"<!--docs:\ntitle: \"Sliders\"\nlayout: detail\nsection: components\nexcerpt: \"Sliders allow users to make selections from a range of values.\"\niconId: slider\npath: /catalog/input-controls/sliders/\n-->\n\n# Slider\n\n[Sliders](https://material.io/components/sliders/) allow users to make\nselections from a range of values.\n\nThe MDC Slider implementation supports both single point sliders (one thumb)\nand range sliders (two thumbs). It is backed by the browser\n`<input type=\"range\">` element, is fully accessible, and is RTL-aware.\n\n**Contents**\n\n*   [Using sliders](#using-sliders)\n*   [Sliders](#sliders)\n*   [Other variants](#other-variants)\n*   [Additional information](#additional-information)\n*   [API](#api)\n\n## Using sliders\n\n### Installing sliders\n\n```\nnpm install @material/slider\n```\n\n### Styles\n\n```scss\n@use \"@material/slider/styles\";\n```\n\n### JavaScript instantiation\n\n```js\nimport {MDCSlider} from '@material/slider';\n\nconst slider = new MDCSlider(document.querySelector('.mdc-slider'));\n```\n\n**Note**: See [Importing the JS component](../../docs/importing-js.md) for more\ninformation on how to import JavaScript.\n\n### Making sliders accessible\n\nSliders are backed by an `<input>` element, meaning that they are fully\naccessible. Unlike the [ARIA-based slider](https://www.w3.org/TR/wai-aria-practices/#slider),\nMDC sliders are adjustable using touch-based assistive technologies such as\nTalkBack on Android.\n\nPer the spec, ensure that the following attributes are added to the\n`input` element(s):\n\n* `value`: Value representing the current value.\n* `min`: Value representing the minimum allowed value.\n* `max`: Value representing the maximum allowed value.\n* `aria-label` or `aria-labelledby`: Accessible label for the slider.\n\nIf the value is not user-friendly (e.g. a number to\nrepresent the day of the week), also set the following:\n\n* `aria-valuetext`: Set this input attribute to a string that makes the slider\nvalue understandable, e.g. 'Monday'.\n* Add a function to map the slider value to `aria-valuetext` via the\n`MDCSlider#setValueToAriaValueTextFn` method.\n\n## Sliders\n\nThere are two types of sliders:\n\n1.  [Continuous slider](#continuous-slider)\n1.  [Discrete slider](#discrete-slider)\n\n### Continuous slider\n\nContinuous sliders allow users to make meaningful selections that don’t require\na specific value.\n\nNote: The step size for value quantization is, by default, 1. To specify\na custom step size, provide a value for the `step` attribute on the `input`\nelement.\n\n<img src=\"images/continuous-slider.png\" alt=\"Continuous slider with a value of 50\">\n\n```html\n<div class=\"mdc-slider\">\n  <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"100\" value=\"50\" name=\"volume\" aria-label=\"Continuous slider demo\">\n  <div class=\"mdc-slider__track\">\n    <div class=\"mdc-slider__track--inactive\"></div>\n    <div class=\"mdc-slider__track--active\">\n      <div class=\"mdc-slider__track--active_fill\"></div>\n    </div>\n  </div>\n  <div class=\"mdc-slider__thumb\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n</div>\n```\n\n#### Continuous range slider\n\n<img src=\"images/continuous-range-slider.png\" alt=\"Continuous range slider with values of 30 and 70\">\n\n```html\n<div class=\"mdc-slider mdc-slider--range\">\n  <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"70\" value=\"30\" name=\"rangeStart\" aria-label=\"Continuous range slider demo\">\n  <input class=\"mdc-slider__input\" type=\"range\" min=\"30\" max=\"100\" value=\"70\" name=\"rangeEnd\" aria-label=\"Continuous range slider demo\">\n  <div class=\"mdc-slider__track\">\n    <div class=\"mdc-slider__track--inactive\"></div>\n    <div class=\"mdc-slider__track--active\">\n      <div class=\"mdc-slider__track--active_fill\"></div>\n    </div>\n  </div>\n  <div class=\"mdc-slider__thumb\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n  <div class=\"mdc-slider__thumb\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n</div>\n```\n\n### Discrete slider\n\nDiscrete sliders display a numeric value label upon pressing the thumb, which\nallows a user to select an exact value.\n\n<img src=\"images/discrete-slider.png\" alt=\"Discrete slider with a value of 50\">\n\nTo create a discrete slider, add the following:\n\n*   `mdc-slider--discrete` class on the root element.\n*   Value indicator element (`mdc-slider__value-indicator-container`), as shown\n    below.\n\n```html\n<div class=\"mdc-slider mdc-slider--discrete\">\n  <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"100\" value=\"50\" name=\"volume\" step=\"10\" aria-label=\"Discrete slider demo\">\n  <div class=\"mdc-slider__track\">\n    <div class=\"mdc-slider__track--inactive\"></div>\n    <div class=\"mdc-slider__track--active\">\n      <div class=\"mdc-slider__track--active_fill\"></div>\n    </div>\n  </div>\n  <div class=\"mdc-slider__thumb\">\n    <div class=\"mdc-slider__value-indicator-container\" aria-hidden=\"true\">\n      <div class=\"mdc-slider__value-indicator\">\n        <span class=\"mdc-slider__value-indicator-text\">\n          50\n        </span>\n      </div>\n    </div>\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n</div>\n```\n\n#### Discrete slider with tick marks\n\nDiscrete sliders can optionally display tick marks. Tick marks represent\npredetermined values to which the user can move the slider.\n\n<img src=\"images/discrete-slider-tick-marks.png\" alt=\"Discrete slider (with tick marks), with a value of 50\">\n\nTo add tick marks to a discrete slider, add the following:\n\n*   `mdc-slider--tick-marks` class on the root element\n*   `mdc-slider__tick-marks` element as a child of the `mdc-slider__track`\n    element\n*   `mdc-slider__tick-mark--active` and `mdc-slider__tick-mark--inactive`\n    elements as children of the `mdc-slider__tick-marks` element\n\n```html\n<div class=\"mdc-slider mdc-slider--discrete mdc-slider--tick-marks\">\n  <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"100\" value=\"50\" name=\"volume\" step=\"10\" aria-label=\"Discrete slider with tick marks demo\">\n  <div class=\"mdc-slider__track\">\n    <div class=\"mdc-slider__track--inactive\"></div>\n    <div class=\"mdc-slider__track--active\">\n      <div class=\"mdc-slider__track--active_fill\"></div>\n    </div>\n    <div class=\"mdc-slider__tick-marks\">\n      <div class=\"mdc-slider__tick-mark--active\"></div>\n      <div class=\"mdc-slider__tick-mark--active\"></div>\n      <div class=\"mdc-slider__tick-mark--active\"></div>\n      <div class=\"mdc-slider__tick-mark--active\"></div>\n      <div class=\"mdc-slider__tick-mark--active\"></div>\n      <div class=\"mdc-slider__tick-mark--active\"></div>\n      <div class=\"mdc-slider__tick-mark--inactive\"></div>\n      <div class=\"mdc-slider__tick-mark--inactive\"></div>\n      <div class=\"mdc-slider__tick-mark--inactive\"></div>\n      <div class=\"mdc-slider__tick-mark--inactive\"></div>\n      <div class=\"mdc-slider__tick-mark--inactive\"></div>\n    </div>\n  </div>\n  <div class=\"mdc-slider__thumb\">\n    <div class=\"mdc-slider__value-indicator-container\" aria-hidden=\"true\">\n      <div class=\"mdc-slider__value-indicator\">\n        <span class=\"mdc-slider__value-indicator-text\">\n          50\n        </span>\n      </div>\n    </div>\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n</div>\n```\n\n#### Discrete range slider\n\n```html\n<div class=\"mdc-slider mdc-slider--range mdc-slider--discrete\">\n  <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"50\" value=\"20\" step=\"10\" name=\"rangeStart\" aria-label=\"Discrete range slider demo\">\n  <input class=\"mdc-slider__input\" type=\"range\" min=\"20\" max=\"100\" value=\"50\" step=\"10\" name=\"rangeEnd\" aria-label=\"Discrete range slider demo\">\n  <div class=\"mdc-slider__track\">\n    <div class=\"mdc-slider__track--inactive\"></div>\n    <div class=\"mdc-slider__track--active\">\n      <div class=\"mdc-slider__track--active_fill\"></div>\n    </div>\n  </div>\n  <div class=\"mdc-slider__thumb\">\n    <div class=\"mdc-slider__value-indicator-container\" aria-hidden=\"true\">\n      <div class=\"mdc-slider__value-indicator\">\n        <span class=\"mdc-slider__value-indicator-text\">\n          20\n        </span>\n      </div>\n    </div>\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n  <div class=\"mdc-slider__thumb\">\n    <div class=\"mdc-slider__value-indicator-container\" aria-hidden=\"true\">\n      <div class=\"mdc-slider__value-indicator\">\n        <span class=\"mdc-slider__value-indicator-text\">\n          50\n        </span>\n      </div>\n    </div>\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n</div>\n```\n\n## Other variants\n\n### Disabled slider\n\nTo disable a slider, add the following:\n\n*   `mdc-slider--disabled` class on the root element\n*   `disabled` attribute on the input element\n\n```html\n<div class=\"mdc-slider mdc-slider--disabled\">\n  <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"100\" value=\"50\" step=\"10\" disabled name=\"volume\" aria-label=\"Disabled slider demo\">\n  <div class=\"mdc-slider__track\">\n    <div class=\"mdc-slider__track--inactive\"></div>\n    <div class=\"mdc-slider__track--active\">\n      <div class=\"mdc-slider__track--active_fill\"></div>\n    </div>\n  </div>\n  <div class=\"mdc-slider__thumb\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n</div>\n```\n\n## Additional information\n\n### Initialization with custom ranges and values\n\nWhen `MDCSlider` is initialized, it reads the input element's `min`,\n`max`, and `value` attributes if present, using them to set\nthe component's internal `min`, `max`, and `value` properties.\n\nUse these attributes to initialize the slider with a custom range and values,\nas shown below:\n\n```html\n<div class=\"mdc-slider\">\n  <input class=\"mdc-slider__input\" aria-label=\"Slider demo\" min=\"0\" max=\"100\" value=\"75\">\n  <!-- ... -->\n</div>\n```\n\n### Setting slider position before component initialization\n\nWhen `MDCSlider` is initialized, it updates the slider track and thumb\npositions based on the internal value(s). To set the correct track and thumb\npositions before component initialization, mark up the DOM as follows:\n\n- Calculate `rangePercentDecimal`, the active track range as a percentage of\n  the entire track, i.e. `(valueEnd - valueStart) / (max - min)`.\n  Set `transform:scaleX(<rangePercentDecimal>)` as an inline style on the\n  `mdc-slider__track--active_fill` element.\n- Calculate `thumbEndPercent`, the initial position of the end thumb as a\n  percentage of the entire track. Set `left:calc(<thumbEndPercent>% - 24px)`\n  as an inline style on the end thumb (`mdc-slider__thumb`) element\n  (or `right` for RTL layouts).\n- *[Range sliders only]* Calculate `thumbStartPercent`, the initial position\n  of the start thumb as a percentage of the entire track. Set\n  `left:calc(<thumbStartPercent>% - 24px)` as an inline style on the\n  start thumb (`mdc-slider__thumb`) element (or `right` for RTL layouts).\n- *[Range sliders only]* Using the previously calculated `thumbStartPercent`,\n  set `left:<thumbStartPercent>%` as an inline style on the\n  `mdc-slider__track--active_fill` element (or `right` for RTL layouts).\n\nAdditionally, the MDCSlider component should be initialized with\n`skipInitialUIUpdate` set to true.\n\n#### Range slider example\n\nThis is an example of a range slider with internal values of\n`[min, max] = [0, 100]` and `[start, end] = [30, 70]`.\n\n```html\n<div class=\"mdc-slider mdc-slider--range\">\n  <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"70\" value=\"30\" name=\"rangeStart\" aria-label=\"Range slider demo\">\n  <input class=\"mdc-slider__input\" type=\"range\" min=\"30\" max=\"100\" value=\"70\" name=\"rangeEnd\" aria-label=\"Range slider demo\">\n  <div class=\"mdc-slider__track\">\n    <div class=\"mdc-slider__track--inactive\"></div>\n    <div class=\"mdc-slider__track--active\">\n      <div class=\"mdc-slider__track--active_fill\"\n           style=\"transform:scaleX(.4); left:30%\"></div>\n    </div>\n  </div>\n  <div class=\"mdc-slider__thumb\" style=\"left:calc(30%-24px)\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n  <div class=\"mdc-slider__thumb\" style=\"left:calc(70%-24px)\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n</div>\n```\n\n## API\n\n### Sass mixins\n\nMixin | Description\n--- | ---\n`track-active-color($color)` | Sets the color of the active track.\n`track-inactive-color($color, $opacity)` | Sets the color and opacity of the inactive track.\n`thumb-color($color)` | Sets the color of the thumb.\n`thumb-ripple-color($color)` | Sets the color of the thumb ripple.\n`tick-mark-active-color($color)` | Sets the color of tick marks on the active track.\n`tick-mark-inactive-color($color)` | Sets the color of tick marks on the inactive track.\n`value-indicator-color($color, $opaicty)` | Sets the color and opacity of the value indicator.\n`value-indicator-text-color($color, $opaicty)` | Sets the color of the value indicator text.\n\n### `MDCSlider` events\n\nEvent name | `event.detail` | Description\n--- | --- | ---\n`MDCSlider:change` | `MDCSliderChangeEventDetail` | Emitted when a value has been changed and committed from a user event. Mirrors the native `change` event: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event\n`MDCSlider:input` | `MDCSliderChangeEventDetail` | Emitted when a value has been changed from a user event. Mirrors the native `input` event: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event\n\n### `MDCSlider` methods\n\nMethod Signature | Description\n--- | ---\n`getValueStart() => number` | Gets the value of the start thumb (only applicable for range sliders).\n`setValueStart(valueStart: number) => void` | Sets the value of the start thumb (only applicable for range sliders).\n`getValue() => number` | Gets the value of the thumb (for single point sliders), or the end thumb (for range sliders).\n`setValue(value: number) => void` | Sets the value of the thumb (for single point sliders), or the end thumb (for range sliders).\n`getDisabled() => boolean` | Gets the disabled state of the slider.\n`setDisabled(disabled: boolean) => void` | Sets the disabled state of the slider.\n`setValueToAriaValueTextFn((mapFn: ((value: number) => string) \\| null) => void` | Sets a function that maps the slider value to value of the `aria-valuetext` attribute on the thumb element. If not set, the `aria-valuetext` attribute is unchanged when the value changes.\n\n### Usage within frameworks\n\nIf you are using a JavaScript framework such as React or Angular, you can create a slider for your framework. Depending on your needs, you can use the _Simple Approach: Wrapping MDC Web Vanilla Components_, or the _Advanced Approach: Using Foundations and Adapters_. Please follow the instructions [here](../../docs/integrating-into-frameworks.md).\n\nSee [MDCSliderAdapter](./adapter.ts) and [MDCSliderFoundation](./foundation.ts) for up-to-date code documentation of slider foundation API's.\n","gitHead":"00e7569feb0aac4c4dbbfb9b292c9f53adb608bd","license":"MIT","_npmUser":{"name":"abhiomkar","email":"abhiomkar@gmail.com"},"homepage":"https://github.com/material-components/material-components-web#readme","keywords":["material components","material design","slider"],"repository":{"url":"git+https://github.com/material-components/material-components-web.git","type":"git","directory":"packages/mdc-slider"},"_npmVersion":"lerna/3.20.2/node@v10.23.0+x64 (linux)","description":"The Material Components for the web slider component","directories":{},"maintainers":[{"name":"abhiomkar","email":"abhiomkar@gmail.com"},{"name":"azakus","email":"dfreedm2@gmail.com"},{"name":"bicknellr","email":"bicknellr@gmail.com"},{"name":"material-admin","email":"aprigogin+npm@google.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.23.0","dependencies":{"tslib":"^1.9.3","@material/dom":"10.0.0-canary.ea55b87ca.0","@material/rtl":"10.0.0-canary.ea55b87ca.0","@material/base":"10.0.0-canary.ea55b87ca.0","@material/theme":"10.0.0-canary.ea55b87ca.0","@material/ripple":"10.0.0-canary.ea55b87ca.0","@material/animation":"10.0.0-canary.ea55b87ca.0","@material/elevation":"10.0.0-canary.ea55b87ca.0","@material/typography":"10.0.0-canary.ea55b87ca.0","@material/feature-targeting":"10.0.0-canary.ea55b87ca.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/slider_10.0.0-canary.ea55b87ca.0_1611704789209_0.004248530634060055","host":"s3://npm-registry-packages"},"_id":"@material/slider@10.0.0-canary.ea55b87ca.0","version":"10.0.0-canary.ea55b87ca.0"}