{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"e609fec661b1a76545b9461910c734d52a588553","tarball":"https://registry.npmjs.org/@material/slider/-/slider-8.0.0-canary.c71ebfa02.0.tgz","fileCount":38,"integrity":"sha512-v6uK5dut80A91xACL9HVihca4VieFdjfobPVuwEThbjeksZVIhQH1cNiJMU/haYvexBtTKiLk1mnuBB3kC68yw==","signatures":[{"sig":"MEUCIDtJ51T7FoBwtGjRELnl0mAbriiIKs81qvrkDvGqlQLsAiEA8FxZjHZfHHwO//FM5VPsSJm68FWYPKB5/veD3LZiLRQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":773581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfhnv5CRA9TVsSAnZWagAAa6YP+wRL5Ma8/dNtySm4OPwl\nucO4MY9a1m6Sd0/9LbXdumWlVD84EH/+DQ/FSj0ZNiV3Arul6jVF42DGUARQ\n6RqO5BB0qE0CLhKd/oPVkUFO4AWRRT3eJiPfIdhisnHguI4Vu74/G3/W+uMN\nKsbhTjgTwT4aRXl711+HyzIyVrYnvXrmLqZBuhAJesMX0ug7OYvz2D8DJDph\n1+/is0W9D3vk6hgZlRw8RaoD4Dbn3ZdzLSEn9F4ReXiPIZUf3QD7wam8sdUs\ngodUDZlhP9iNsp3b6qI1/xhCzx1y/MCZl5gRAn401v4PcgtdGFuVhndOwDGT\nt1hWvxfVH+FfGgcvLP05WbzoXXq3AhxRUbBuDxipaTtEiHkybApPCXlo+bBc\n5nM2/ZdTLVC1uslhlQbyFQ9LmAtXI2LJeiIiWg3LNQFc+0gSO+srwZeAR5FA\nd22f+zmXiy/iZUGcFjQQ0zKacumJOHBTGckWWPt2i1lks21RQQWmuZS+WVQl\n8Ix61v3f467MOpqJ+E4Ok6AqrAPNQBdstlB9mGuy5GRLhW/r2FaopZ33c26X\nCReEpLtfShvj2aCdCRIYi1EFjyQmnw+CUZo0kOGjjRfAgbX7BOkbJWjuXdPD\nxiqTfSAzvczOKdF9/Ts3BZBRkltWH4WRCKtONECZOs5gAcU7excdR8iTZQZA\nXHKg\r\n=rFqG\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 modeled after the browser's\n`<input type=\"range\">` element.\n\nSliders follow accessibility best practices per the [WAI-ARIA spec](https://www.w3.org/TR/wai-aria-practices/#slider)\nand are fully 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\";\n\n@include slider.core-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 follow the\n[WAI-ARIA guidelines](https://www.w3.org/TR/wai-aria-practices/#slider).\nPer the spec, ensure that the following attributes are added to the\n`mdc-slider__thumb` element(s):\n\n* `role=\"slider\"`\n* `aria-valuenow`: Value representing the current value.\n* `aria-valuemin`: Value representing the minimum allowed value.\n* `aria-valuemax`: Value representing the maximum allowed value.\n* `aria-label` or `aria-labelledby`: Accessible label for the slider.\n\nIf the value of `aria-valuenow` is not user-friendly (e.g. a number to\nrepresent the day of the week), also set the following:\n\n* `aria-valuetext`: Set to a string that makes the slider value\nunderstandable, 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\n<img src=\"images/continuous-slider.png\" alt=\"Continuous slider with a value of 50\">\n\n```html\n<div class=\"mdc-slider\">\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\" role=\"slider\" tabindex=\"0\" aria-label=\"Continuous slider demo\" aria-valuemin=\"0\"\n       aria-valuemax=\"100\" aria-valuenow=\"50\">\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  <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\" role=\"slider\" tabindex=\"0\" aria-label=\"Continuous range slider demo\" aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"30\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n  <div class=\"mdc-slider__thumb\" role=\"slider\" tabindex=\"0\" aria-label=\"Continuous range slider demo\" aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"70\">\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*   `data-step` attribute on the root element. This will be the step size for\n    value quantization. If not set, the default is 1.\n*   Value indicator element (`mdc-slider__value-indicator-container`), as shown\n    below.\n\n```html\n<div class=\"mdc-slider mdc-slider--discrete\" data-step=\"10\">\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\" role=\"slider\" tabindex=\"0\" aria-label=\"Discrete slider demo\" aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"50\">\n    <div class=\"mdc-slider__value-indicator-container\">\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\" data-step=\"10\">\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\" role=\"slider\" tabindex=\"0\" aria-label=\"Discrete slider with tick marks demo\" aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"50\">\n    <div class=\"mdc-slider__value-indicator-container\">\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\" data-step=\"10\">\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\" role=\"slider\" tabindex=\"0\" aria-label=\"Discrete range slider demo\" aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"20\">\n    <div class=\"mdc-slider__value-indicator-container\">\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\" role=\"slider\" tabindex=\"0\" aria-label=\"Discrete range slider demo\" aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"50\">\n    <div class=\"mdc-slider__value-indicator-container\">\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*   `tabindex=\"-1\"` attribute on the thumb(s)\n*   `aria-disabled=\"true\"` on the thumb(s)\n\n```html\n<div class=\"mdc-slider mdc-slider--disabled\">\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\" role=\"slider\" tabindex=\"-1\" aria-label=\"Disabled slider demo\" aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"50\" aria-disabled=\"true\">\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 thumb element's `aria-valuemin`,\n`aria-valuemax`, and `aria-valuenow` 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  <!-- ... -->\n  <div class=\"mdc-slider__thumb\" role=\"slider\" tabindex=\"0\" aria-label=\"Slider demo\" aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"75\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\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  <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\" role=\"slider\" tabindex=\"0\" aria-label=\"Range slider demo\" aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"30\" style=\"left:calc(30%-24px)\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n  </div>\n  <div class=\"mdc-slider__thumb\" role=\"slider\" tabindex=\"0\" aria-label=\"Range slider demo\" aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"70\" 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":"d1158a184d234471c81501e838b409c54f591268","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.22.1+x64 (linux)","description":"The Material Components for the web slider component","directories":{},"maintainers":[{"name":"ssuarez","email":"sayrisuarez@google.com"},{"name":"candysonya","email":"wangchan518@gmail.com"},{"name":"asyncliz","email":"asyncliz@gmail.com"},{"name":"esgonzalez","email":"esgonzalez@google.com"},{"name":"allanchen","email":"allanchen@google.com"},{"name":"emarquez","email":"emarquez@google.com"},{"name":"aomarks","email":"aomarks@google.com"},{"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"}],"sideEffects":false,"_nodeVersion":"10.22.1","dependencies":{"tslib":"^1.9.3","@material/dom":"8.0.0-canary.c71ebfa02.0","@material/rtl":"8.0.0-canary.c71ebfa02.0","@material/base":"8.0.0-canary.c71ebfa02.0","@material/theme":"8.0.0-canary.c71ebfa02.0","@material/ripple":"8.0.0-canary.c71ebfa02.0","@material/animation":"8.0.0-canary.c71ebfa02.0","@material/elevation":"8.0.0-canary.c71ebfa02.0","@material/typography":"8.0.0-canary.c71ebfa02.0","@material/feature-targeting":"8.0.0-canary.c71ebfa02.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/slider_8.0.0-canary.c71ebfa02.0_1602649081248_0.4485114127839347","host":"s3://npm-registry-packages"},"_id":"@material/slider@8.0.0-canary.c71ebfa02.0","version":"8.0.0-canary.c71ebfa02.0"}