{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"2d752fa39b19df99c5fdcf2796d10dc4f6eace0d","tarball":"https://registry.npmjs.org/@material/slider/-/slider-15.0.0-canary.d96330c08.0.tgz","fileCount":37,"integrity":"sha512-e/BhzVaKHpuvaH/od6UAjcSeiNqdfdhhp/1UBlihf0npjW+wq078kChqcDxYoVN6SCUemF+2JMVBOvVZ/cXd5A==","signatures":[{"sig":"MEQCICQOpXqFCUxj6R16nxdhQ/e7lC9ZchtbGbx3o9w72bMbAiArM2WNah4ohAhQqDfI7famKha68cMLcv0Q+lMlj6T+pA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1224763,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkCHS1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr0TA//fxcNDAr7Rf3QFy3OKvifQzpE9aPDxEiaEcsWqG7h0C0uNBU+\r\nkiOiYJKlpQz1Pc2Hoy7bTWDuA1my+VNnN8xtmGW9P8pTWH1ztBcljYYMwdeG\r\nRcAgwllfFxVmmlFS59injPzpM6YhhRoG5RDy96iAegAPVqP3H0X7aNU6X3D1\r\nHorX6DkhfVcw43nntA/gi3vxLpg7bGeMgqBNXhFsA/kUt4r7DIOpHP7UkwmG\r\nKip2lKMMWq4KOFo2bl5Ve3x8xli+irH51jyvuUMFAWXgvrZfN32QviTMPO6x\r\nQikXOQtvh0+Dho2vfymkwxKza3NPGJ6g2E1/DL/B8yfrmqZ3pzTzq5DP5wU6\r\nTaFKEf7oXldaamsjrs4XRQ5vAYfRychQg6EPFr4pbKH3CNmaRo2tXCYw5O1a\r\nsWlkvwdJ2Xz3E62pjqxkLQcklbaH5mOpFUBjZBZmNdp8fW3d+hskvlVTgveA\r\n1Tix/4VNgOCfoqC+5xLL5ktr89OIIE4YlTepdtaszGi6g+iBbifezV7RcVCg\r\nw72zI+YQ8Hrg4M1g4ToTAaqlJPFY0mFqkkWX8V+PN0psKB47NiUplYNuOzVx\r\nNc8Pn27oi41k3iMXNbUk/XgrwAc+0asIIYqlVQdvisgUXbQZqj+iTsw1l8AM\r\nazpPwKLL34HSxv3mTIwVZ2OkkxDdgc4EOZc=\r\n=YdLL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/mdc.slider.js","name":"@material/slider","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  <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    <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"100\" value=\"50\" name=\"volume\" aria-label=\"Continuous slider demo\">\n  </div>\n</div>\n```\n\n#### Continuous range slider\n\nNote: By default there's no minimum distance between the two thumbs. To specify\none, provide a value for the `data-min-range` attribute on the root element and\nadjust the `min` and `max` attributes on the input elements accordingly.\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\" data-min-range=\"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\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n    <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"60\" value=\"30\" name=\"rangeStart\" aria-label=\"Continuous range slider demo\">\n  </div>\n  <div class=\"mdc-slider__thumb\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n    <input class=\"mdc-slider__input\" type=\"range\" min=\"40\" max=\"100\" value=\"70\" name=\"rangeEnd\" aria-label=\"Continuous range slider demo\">\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  <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    <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"100\" value=\"50\" name=\"volume\" step=\"10\" aria-label=\"Discrete slider demo\">\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  <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    <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>\n</div>\n```\n\n#### Discrete range slider\n\n```html\n<div class=\"mdc-slider mdc-slider--range mdc-slider--discrete\">\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    <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"50\" value=\"20\" step=\"10\" name=\"rangeStart\" aria-label=\"Discrete range slider demo\">\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    <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>\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  <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    <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>\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  <!-- ... -->\n  <div class=\"mdc-slider__thumb\">\n    <!-- ... -->\n    <input class=\"mdc-slider__input\" aria-label=\"Slider demo\" min=\"0\" max=\"100\" value=\"75\">\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]`, and a minimum range of\n10.\n\n```html\n<div class=\"mdc-slider mdc-slider--range\" data-min-range=\"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\"\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    <input class=\"mdc-slider__input\" type=\"range\" min=\"0\" max=\"60\" value=\"30\" name=\"rangeStart\" aria-label=\"Range slider demo\">\n  </div>\n  <div class=\"mdc-slider__thumb\" style=\"left:calc(70%-24px)\">\n    <div class=\"mdc-slider__thumb-knob\"></div>\n    <input class=\"mdc-slider__input\" type=\"range\" min=\"40\" max=\"100\" value=\"70\" name=\"rangeEnd\" aria-label=\"Range slider demo\">\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":"6a6d53aa84a0c0a10bb15c3cfb596881140bddb2","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@v14.21.3+x64 (linux)","description":"The Material Components for the web slider component","directories":{},"maintainers":[{"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":"material-admin","email":"aprigogin+npm@google.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":"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.21.3","dependencies":{"tslib":"^2.1.0","@material/dom":"15.0.0-canary.d96330c08.0","@material/rtl":"15.0.0-canary.d96330c08.0","@material/base":"15.0.0-canary.d96330c08.0","@material/theme":"15.0.0-canary.d96330c08.0","@material/ripple":"15.0.0-canary.d96330c08.0","@material/tokens":"15.0.0-canary.d96330c08.0","@material/animation":"15.0.0-canary.d96330c08.0","@material/elevation":"15.0.0-canary.d96330c08.0","@material/typography":"15.0.0-canary.d96330c08.0","@material/feature-targeting":"15.0.0-canary.d96330c08.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/slider_15.0.0-canary.d96330c08.0_1678275765323_0.18560154905338666","host":"s3://npm-registry-packages"},"_id":"@material/slider@15.0.0-canary.d96330c08.0","version":"15.0.0-canary.d96330c08.0"}