{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"c4fe5661d94f8fc67413cf3530b3b00ef775bfa9","tarball":"https://registry.npmjs.org/@material/chips/-/chips-0.39.0-0.tgz","fileCount":20,"integrity":"sha512-zuYmzysvXl0A+gfvfhelo0OftE6/eTngNXD5aXBSADiQnJsqu6Uam6EuRZZSuqVfHmX236NALWlGmDJIHR5qkA==","signatures":[{"sig":"MEYCIQCCQxKr+IEBh7JTSUvZ+DWqwkCG7ttJWVchRqEnLXbY/gIhAKlce0Cur2zmoLfMjurRO86XOqM1TCgxK/QW7sM9got3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":227479,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbdZUtCRA9TVsSAnZWagAAghgQAI4unnn4Gmeg5Et9uMvd\nXIKeRFw2g16Th3rnoXkCHcA3NCayhOx+dhCYEa2pBi6UGiPORftPOep72S4q\nOj79OMX1pEl/REpsbOz4nmjOszi/spoyoaBMY8WkwmgCbMVWgiARNa2+/mnK\ncbJKrsRBGocMWSIxdJpaxo6W2IJJJIMiVYq8MBwkVxnoWwk2o3VQPY1jODBi\nX5CeamvWD1WkHjU8Dclau6a/3igkZ90Gps00JzNM6GNPwgF31512kNouuilt\ngFr94pheJQ4yI++f+vvcUxGZ+zqaSeFFIkhkibcq8dGWmayzYiCMhmEoEQiz\n9tE7Igh3HAoxcepZbryUm3V0s+uXiTNBunKz1JB8fFQPVWRt+2xu9sYxaYOj\nVPeSDCIZHuxwCoL9EJVR/f3hJ8kA06koYR10Fy4WLt8WwIgYc6GaU8LMpWnN\n09zwzI5LXXEhdcUXIq7t2/TS0AAx4bvaZFeqrYHrSnSUgz+Ue+8wHKIBxhxx\nALU2vJ6+KYWge92CoJV/zVRaNKAzn7AR/vHJyAACtvZ4cc3Ashru2rlcrQFb\nkX1TW3UlB4l60LOM28bvEY3K+3Jq17rr6xcReB++FECIFTPLq01trA+xxvyF\nDJBKVgzEpNOc93EOmYAWGw8OinjvtM82/IQ1+mtrTb2GNIyS4xHdWwXRhI5Q\n2Hw5\r\n=a/Fd\r\n-----END PGP SIGNATURE-----\r\n"},"name":"@material/chips","readme":"<!--docs:\ntitle: \"Chips\"\nlayout: detail\nsection: components\nexcerpt: \"Chips are compact elements that represent an attribute, text, entity, or action.\"\niconId: chip\npath: /catalog/chips/\n-->\n\n# Chips\n\n<!--<div class=\"article__asset\">\n  <a class=\"article__asset-link\"\n     href=\"https://material-components.github.io/material-components-web-catalog/#/component/chips\">\n    <img src=\"{{ site.rootpath }}/images/mdc_web_screenshots/chips.png\" width=\"363\" alt=\"Chips screenshot\">\n  </a>\n</div>-->\n\nChips are compact elements that allow users to enter information, select a choice, filter content, or trigger an action.\n\n## Design & API Documentation\n\n<ul class=\"icon-list\">\n  <li class=\"icon-list-item icon-list-item--spec\">\n    <a href=\"https://material.io/go/design-chips\">Material Design guidelines: Chips</a>\n  </li>\n  <li class=\"icon-list-item icon-list-item--link\">\n    <a href=\"https://material-components.github.io/material-components-web-catalog/#/component/chips\">Demo</a>\n  </li>\n</ul>\n\n## Installation\n\n```\nnpm install @material/chips\n```\n\n## Basic Usage\n\n### HTML Structure\n\n```html\n<div class=\"mdc-chip-set\">\n  <div class=\"mdc-chip\" tabindex=\"0\">\n    <div class=\"mdc-chip__text\">Chip content</div>\n  </div>\n  ...\n</div>\n```\n\n### Styles\n\n```scss\n@import \"@material/chips/mdc-chips\";\n```\n\n### JavaScript Instantiation\n\n```js\nimport {MDCChipSet} from '@material/chips';\n\nconst chipSet = new MDCChipSet(document.querySelector('.mdc-chip-set'));\n```\n\n> See [Importing the JS component](../../docs/importing-js.md) for more information on how to import JavaScript.\n\n## Variants\n\n### Leading and Trailing Icons\n\nYou can optionally add a leading icon (i.e. thumbnail) and/or a trailing \"remove\" icon to a chip. To add an icon, add an `i` element with your preferred icon, give it a class of `mdc-chip__icon`, and a class of either `mdc-chip__icon--leading` or `mdc-chip__icon--trailing`.\n\n#### Leading icon\n\n```html\n<div class=\"mdc-chip\">\n  <i class=\"material-icons mdc-chip__icon mdc-chip__icon--leading\">event</i>\n  <div class=\"mdc-chip__text\">Add to calendar</div>\n</div>\n```\n\n#### Trailing icon\n\nA trailing icon comes with the functionality to remove the chip from the set. If you're adding a trailing icon, also set `tabindex=\"0\"` and `role=\"button\"` to make it accessible by keyboard and screenreader. Trailing icons should only be added to [input chips](#input-chips).\n\n```html\n<div class=\"mdc-chip\">\n  <div class=\"mdc-chip__text\">Jane Smith</div>\n  <i class=\"material-icons mdc-chip__icon mdc-chip__icon--trailing\" tabindex=\"0\" role=\"button\">cancel</i>\n</div>\n```\n\n### Choice Chips\n\nChoice chips are a variant of chips which allow single selection from a set of options. To define a set of chips as choice chips, add the class `mdc-chip-set--choice` to the chip set element.\n\n```html\n<div class=\"mdc-chip-set mdc-chip-set--choice\">\n  ...\n</div>\n```\n\n### Filter Chips\n\nFilter chips are a variant of chips which allow multiple selection from a set of options. To define a set of chips as filter chips, add the class `mdc-chip-set--filter` to the chip set element. When a filter chip is selected, a checkmark appears as the leading icon. If the chip already has a leading icon, the checkmark replaces it. This requires the HTML structure of a filter chip to differ from other chips:\n\n```html\n<div class=\"mdc-chip-set mdc-chip-set--filter\">\n  <div class=\"mdc-chip\">\n    <div class=\"mdc-chip__checkmark\" >\n      <svg class=\"mdc-chip__checkmark-svg\" viewBox=\"-2 -3 30 30\">\n        <path class=\"mdc-chip__checkmark-path\" fill=\"none\" stroke=\"black\"\n              d=\"M1.73,12.91 8.1,19.28 22.79,4.59\"/>\n      </svg>\n    </div>\n    <div class=\"mdc-chip__text\">Filterable content</div>\n  </div>\n  ...\n</div>\n```\n\nTo use a leading icon in a filter chip, put the `mdc-chip__icon--leading` element _before_ the `mdc-chip__checkmark` element:\n\n```html\n<div class=\"mdc-chip-set mdc-chip-set--filter\">\n  <div class=\"mdc-chip\">\n    <i class=\"material-icons mdc-chip__icon mdc-chip__icon--leading\">face</i>\n    <div class=\"mdc-chip__checkmark\" >\n      <svg class=\"mdc-chip__checkmark-svg\" viewBox=\"-2 -3 30 30\">\n        <path class=\"mdc-chip__checkmark-path\" fill=\"none\" stroke=\"black\"\n              d=\"M1.73,12.91 8.1,19.28 22.79,4.59\"/>\n      </svg>\n    </div>\n    <div class=\"mdc-chip__text\">Filterable content</div>\n  </div>\n  ...\n</div>\n```\n\n### Input Chips\n\nInput chips are a variant of chips which enable user input by converting text into chips. To define a set of chips as input chips, add the class `mdc-chip-set--input` to the chip set element.\n\n```html\n<div class=\"mdc-chip-set mdc-chip-set--input\">\n  ...\n</div>\n```\n\n You'd also want to add an event listener that calls `addChip` on the `MDCChipSet` to convert text to a chip. More information can be found in the \"`MDCChip` Properties and Methods\" section below.\n\n### Pre-selected\n\nTo display a pre-selected filter or choice chip, add the class `mdc-chip--selected` to the root chip element.\n\n```html\n<div class=\"mdc-chip mdc-chip--selected\">\n  <div class=\"mdc-chip__text\">Add to calendar</div>\n</div>\n```\n\nTo pre-select filter chips that have a leading icon, also add the class `mdc-chip__icon--leading-hidden` to the `mdc-chip__icon--leading` element. This will ensure that the checkmark displaces the leading icon.\n\n```html\n<div class=\"mdc-chip mdc-chip--selected\">\n  <i class=\"material-icons mdc-chip__icon mdc-chip__icon--leading mdc-chip__icon--leading-hidden\">face</i>\n  <div class=\"mdc-chip__checkmark\">\n    <svg class=\"mdc-chip__checkmark-svg\" viewBox=\"-2 -3 30 30\">\n      <path class=\"mdc-chip__checkmark-path\" fill=\"none\" stroke=\"black\"\n            d=\"M1.73,12.91 8.1,19.28 22.79,4.59\"/>\n    </svg>\n  </div>\n  <div class=\"mdc-chip__text\">Filterable content</div>\n</div>\n```\n\n## Style Customization\n\n### CSS Classes\n\nCSS Class | Description\n--- | ---\n`mdc-chip-set` | Mandatory. Indicates the set that the chip belongs to.\n`mdc-chip-set--input` | Optional. Indicates that the chips in the set are input chips, which enable user input by converting text into chips.\n`mdc-chip-set--choice` | Optional. Indicates that the chips in the set are choice chips, which allow a single selection from a set of options.\n`mdc-chip-set--filter` | Optional. Indicates that the chips in the set are filter chips, which allow multiple selection from a set of options.\n`mdc-chip` | Mandatory.\n`mdc-chip--selected` | Optional. Indicates that the chip is selected.\n`mdc-chip__text` | Mandatory. Indicates the text content of the chip.\n`mdc-chip__icon` | Optional. Indicates an icon in the chip.\n`mdc-chip__icon--leading` | Optional. Indicates a leading icon in the chip.\n`mdc-chip__icon--leading-hidden` | Optional. Hides the leading icon in a filter chip when the chip is selected.\n`mdc-chip__icon--trailing` | Optional. Indicates a trailing icon which removes the chip from the DOM. Only use with input chips.\n`mdc-chip__checkmark` | Optional. Indicates the checkmark in a filter chip.\n`mdc-chip__checkmark-svg` | Mandatory with the use of `mdc-chip__checkmark`. Indicates the checkmark SVG element in a filter chip.\n`mdc-chip__checkmark-path` | Mandatory with the use of `mdc-chip__checkmark`. Indicates the checkmark SVG path in a filter chip.\n\n> _NOTE_: Every element that has an `mdc-chip__icon` class must also have either the `mdc-chip__icon--leading` or `mdc-chip__icon--trailing` class.\n\n### Sass Mixins\n\nMixin | Description\n--- | ---\n`mdc-chip-set-spacing($gap-size)` | Customizes the amount of space between each chip in the set\n`mdc-chip-corner-radius($radius)` | Customizes the corner radius for a chip\n`mdc-chip-fill-color-accessible($color)` | Customizes the background fill color for a chip, and updates the chip's ink, icon and ripple colors to meet accessibility standards\n`mdc-chip-fill-color($color)` | Customizes the background fill color for a chip\n`mdc-chip-ink-color($color)` | Customizes the text ink color for a chip, and updates the chip's ripple color to match\n`mdc-chip-selected-ink-color($color)` | Customizes text ink and ripple color of a chip in the _selected_ state\n`mdc-chip-outline($width, $style, $color)` | Customizes the outline properties for a chip\n`mdc-chip-outline-width($width)` | Customizes the outline width for a chip\n`mdc-chip-outline-style($style)` | Customizes the outline style for a chip\n`mdc-chip-outline-color($color)` | Customizes the outline color for a chip\n`mdc-chip-height($height)` | Customizes the height for a chip\n`mdc-chip-leading-icon-color($color, $opacity)` | Customizes the color of a leading icon in a chip, optionally customizes opacity\n`mdc-chip-trailing-icon-color($color, $opacity, $hover-opacity, $focus-opacity)` | Customizes the color of a trailing icon in a chip, optionally customizes regular/hover/focus opacities\n`mdc-chip-leading-icon-size($size)` | Customizes the size of a leading icon in a chip\n`mdc-chip-trailing-icon-size($size)` | Customizes the size of a trailing icon in a chip\n\n> _NOTE_: `mdc-chip-set-spacing` also sets the amount of space between a chip and the edge of the set it's contained in.\n\n## `MDCChip` and `MDCChipSet` Properties and Methods\n\nThe MDC Chips package is composed of two JavaScript classes:\n* `MDCChip` defines the behavior of a single chip.\n* `MDCChipSet` defines the behavior of chips within a specific set. For example, chips in an input chip set behave differently from those in a filter chip set.\n\nTo use the `MDCChip` and `MDCChipSet` classes, [import](../../docs/importing-js.md) both classes from `@material/chips`.\n\n#### `MDCChip`\n\nMethod Signature | Description\n--- | ---\n`beginExit() => void` | Proxies to the foundation's `beginExit` method\n\nProperty | Value Type | Description\n--- | --- | ---\n`id` | string | Unique identifier on the chip\\*\n`selected` | Boolean | Proxies to the foundation's `isSelected`/`setSelected` methods\n`shouldRemoveOnTrailingIconClick` | Boolean | Proxies to the foundation's `getShouldRemoveOnTrailingIconClick`/`setShouldRemoveOnTrailingIconClick` methods\\*\\*\n`ripple` | `MDCRipple` | The `MDCRipple` instance for the root element that `MDCChip` initializes\n\n> \\*_NOTE_: This will be the same as the `id` attribute on the root element. If an `id` is not provided, a unique one will be generated.\n\n> \\*\\*_NOTE_: If `shouldRemoveOnTrailingIconClick` is set to false, you must manually call `beginExit()` on the chip to remove it.\n\n#### `MDCChipSet`\n\nMethod Signature | Description\n--- | ---\n`addChip(chipEl: Element) => void` | Adds a new `MDCChip` instance to the chip set based on the given `mdc-chip` element\n`getSelectedChipIds() => boolean` | Returns an array of the IDs of all selected chips\n\nProperty | Value Type | Description\n--- | --- | ---\n`chips` | Array<`MDCChip`> | An array of the `MDCChip` objects that represent chips in the set\n\n## Usage within Web Frameworks\n\nIf you are using a JavaScript framework, such as React or Angular, you can create Chips 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\n### Adapters: `MDCChipAdapter` and `MDCChipSetAdapter`\n\n#### `MDCChipAdapter`\n\nMethod Signature | Description\n--- | ---\n`addClass(className: string) => void` | Adds a class to the root element\n`removeClass(className: string) => void` | Removes a class from the root element\n`hasClass(className: string) => boolean` | Returns true if the root element contains the given class\n`addClassToLeadingIcon(className: string) => void` | Adds a class to the leading icon element\n`removeClassFromLeadingIcon(className: string) => void` | Removes a class from the leading icon element\n`eventTargetHasClass(target: EventTarget, className: string) => boolean` | Returns true if target has className, false otherwise\n`notifyInteraction() => void` | Emits a custom event `MDCChip:interaction` denoting the chip has been interacted with\\*\n`notifyTrailingIconInteraction() => void` | Emits a custom event `MDCChip:trailingIconInteraction` denoting the chip's trailing icon has been interacted with\\*\n`notifyRemoval() => void` | Emits a custom event `MDCChip:removal` denoting the chip will be removed\\*\\*\n`getComputedStyleValue(propertyName: string) => string` | Returns the computed property value of the given style property on the root element\n`setStyleProperty(propertyName: string, value: string) => void` | Sets the property value of the given style property on the root element\n\n> \\*_NOTE_: The custom events emitted by `notifyInteraction` and `notifyTrailingIconInteraction` must pass along the target chip's ID via `event.detail.chipId`, as well as bubble to the parent `mdc-chip-set` element.\n\n> \\*\\*_NOTE_: The custom event emitted by `notifyRemoval` must pass along the target chip's ID via `event.detail.chipId` and its root element via `event.detail.root`, as well as bubble to the parent `mdc-chip-set` element.\n\n#### `MDCChipSetAdapter`\n\nMethod Signature | Description\n--- | ---\n`hasClass(className: string) => boolean` | Returns whether the chip set element has the given class\n`removeChip(chipId: string) => void` | Removes the chip with the given id from the chip set\n`setSelected(chipId: string, selected: boolean) => void` | Sets the selected state of the chip with the given id\n\n### Foundations: `MDCChipFoundation` and `MDCChipSetFoundation`\n\n#### `MDCChipFoundation`\n\nMethod Signature | Description\n--- | ---\n`isSelected() => boolean` | Returns true if the chip is selected\n`setSelected(selected: boolean) => void` | Sets the chip's selected state\n`getShouldRemoveOnTrailingIconClick() => boolean` | Returns whether a trailing icon click should trigger exit/removal of the chip\n`setShouldRemoveOnTrailingIconClick(shouldRemove: boolean) => void` | Sets whether a trailing icon click should trigger exit/removal of the chip\n`beginExit() => void` | Begins the exit animation which leads to removal of the chip\n`handleInteraction(evt: Event) => void` | Handles an interaction event on the root element\n`handleTransitionEnd(evt: Event) => void` | Handles a transition end event on the root element\n`handleTrailingIconInteraction(evt: Event) => void` | Handles an interaction event on the trailing icon element\n\n#### `MDCChipSetFoundation`\n\nMethod Signature | Description\n--- | ---\n`getSelectedChipIds() => boolean` | Returns an array of the IDs of all selected chips\n`select(chipId: string) => void` | Selects the chip with the given id\n`deselect(chipId: string) => void` | Deselects the chip with the given id\n`toggleSelect(chipId: string) => void` | Toggles selection of the chip with the given id\n`handleChipInteraction(evt: Event) => void` | Handles a custom `MDCChip:interaction` event on the root element\n`handleChipRemoval(evt: Event) => void` | Handles a custom `MDCChip:removal` event on the root element\n","license":"Apache 2.0","_npmUser":{"name":"kfranqueiro","email":"kenneth.franqueiro@gmail.com"},"homepage":"https://github.com/material-components/material-components-web#readme","keywords":["material components","material design","chips"],"repository":{"url":"git+https://github.com/material-components/material-components-web.git","type":"git"},"_npmVersion":"6.4.0","description":"The Material Components for the Web chips component","directories":{},"maintainers":[{"name":"abhiomkar","email":"abhiomkar@gmail.com"},{"name":"acdvorak","email":"acdvorak@gmail.com"},{"name":"aprigogin","email":"andrey.prigogin@gmail.com"},{"name":"azakus","email":"dfreedm2@gmail.com"},{"name":"bicknellr","email":"bicknellr@gmail.com"},{"name":"bonniez","email":"bonniez@google.com"},{"name":"bwobrien","email":"obrien.test@gmail.com"},{"name":"kfranqueiro","email":"kenneth.franqueiro@gmail.com"},{"name":"lynnjepsen","email":"lynnjepsen@google.com"},{"name":"material-admin","email":"lynnjepsen+npm@google.com"},{"name":"moog16","email":"mattgoo@gmail.com"},{"name":"patrickrodee","email":"prodee@google.com"},{"name":"williamernest","email":"williamernest@google.com"}],"_nodeVersion":"8.11.1","dependencies":{"@material/base":"^0.35.0","@material/ripple":"^0.38.1","@material/checkbox":"^0.38.1","@material/animation":"^0.34.0","@material/typography":"^0.39.0-0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/chips_0.39.0-0_1534432557080_0.07601974639498321","host":"s3://npm-registry-packages"},"_id":"@material/chips@0.39.0-0","version":"0.39.0-0"}