{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"db423880efd5b5ab6e07a83e9ed321b98fdf99e9","tarball":"https://registry.npmjs.org/@material/tooltip/-/tooltip-9.0.0-canary.2d5f32d41.0.tgz","fileCount":36,"integrity":"sha512-5H1Jf2qU7AJ8T8OLnZD673TUcDp4msXt4/yP4fiB1c9rHKduGEZR9CIuidfBnu0pPI43y1m7UdctHFKlcHDyPA==","signatures":[{"sig":"MEUCIQDCCuozCiJNMHk+2JNvmkGGWO0T1kkpfExBr4+StrGIOAIgcN2ffBFnCChSATPmLzURpHJ+bol7G6UmjPX3e28BxIQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":445789,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfzluTCRA9TVsSAnZWagAA/UQP/j5Id/NfTvhVktKLYvr/\n4iNvJM/2HuchqS9IsvKrUxZbNAQQrHItKVkk/b2YfVXBC/xI2GZ65AS7DHtp\nhp0B+rDenX1XLYtEiPDDPwH2EzIb/GdRLmXuvn6BoTij/qet0/9ptErywhzW\niq8Fa1rsep7YHr9W5yVojQMGzhIZ68HGWcS+6Vc3l+IS4APyOEp8/6mw/Woo\ncCbsScGHUHFtsKHQ2v5fxSa28z2xpUv1n0BQCFjihOtDJYDQ67Y4yxwIAtFN\n4Wr3lHkEhAdO0rJxgKX8onV2PtmXzHtsl0JjfPW5K3QrvrSk3kcmg6FhyQgZ\naE4Peb+iqJNfbCZq1FTaDzU8Lcxfla9Cy4m0ZLBNaRa723w+PEgdjsrinwJM\nysa3QYTKf8PtiuyYqX6Tsp7FSwCqx01itiGP16s+hu70k+vLen92WT0ozHV4\ngbWOkgzlibQcWUOBvpPxkNqtBCdzIFYg0s1SqxUq9Dn+eUlpbudSiBtjl1h+\nBjDmi+/6WnNRv87GrKw5WfJFPK3FJYOQiqWgkgXmXvrQclxZpR/tKTbdKXPs\nSnA0o6pZjX4dqnMK2AuPgowQ1IPOH5TQw03zMuO+WzA5BgejzwrrrdF8gbtJ\nLmDmnjYss0e4kurRloUlyFlV4qlx15gg8A8tt1lN4kBsU5Qp5l5i1xt30wvG\n6bXl\r\n=9z9z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/mdc.tooltip.js","name":"@material/tooltip","types":"dist/mdc.tooltip.d.ts","module":"index.js","readme":"<!--docs:\ntitle: \"Tooltip\"\nlayout: detail\nsection: components\nexcerpt: \"Tooltips display informative text when users hover over, focus on, or tap an element.\"\niconId: tooltip\npath: /catalog/tooltips/\n-->\n\n# Tooltip\n\nTooltips display informative text when users hover over, focus on, or tap an element.\n\n![Tooltip example](images/tooltip.png)\n\n**Contents**\n\n* [Using tooltips](#using-tooltips)\n* [Tooltips](#tooltips)\n* [API](#api)\n* [Usage within web frameworks](#usage-within-web-frameworks)\n\n## Using tooltips\n\nTooltips, when activated, display a text label identifying an element, such as a\ndescription of its function. Tooltips should include only short, descriptive\ntext and avoid restating visible UI text.\n\nCommon use cases include:\n\n* Displaying full text that has been truncated\n* Identifying a UI affordance\n* Describing differences between similar elements\n* Distinguishing actions with related iconography\n\n### Tooltip positioning\nTooltip positioning is based on the anchor element (the element that, on user\ninteraction, results in showing or hiding of a tooltip). They appear directly\nbelow or above this anchor element and can be placed flush with either the end,\ncenter, or start of the anchor.\n\n![End, center, and start alignment of tooltip on icon button in a LTR page](images/plain_tooltip_alignment.png)\n<p align=\"center\"> *Tooltips aligned with the end, center, and start of an anchor element (in a LTR page flow).* </p>\n\n\nA threshold distance of 32px is expected to be maintained between the tooltip\nand the viewport edge. A valid tooltip position is calculated based on which of\nthe position options (start, center, or end for x-axis alignment and above or\nbelow for y-axis alignment) maintain this threshold. If all possible alignment\noptions violate the threshold, then a valid tooltip position is one that does\nnot collide with the viewport.\n\nA user specified position is honored only if the specified position is\nconsidered valid based on the logic outlined above.\n\n### Installing tooltips\n\n```\nnpm install @material/tooltip\n```\n\n### Styles\n\n```scss\n@use \"@material/tooltip/styles\";\n```\n\n### JavaScript instantiation\n\n```js\nimport {MDCTooltip} from '@material/tooltip';\nconst tooltip = new MDCTooltip(document.querySelector('.mdc-tooltip'));\n```\n\n> See [Importing the JS component](../../docs/importing-js.md) for more information on how to import JavaScript.\n\n### Making tooltips accessible\n\nEach tooltip element placed into the DOM is expected to have a unique `id`.\nTheir corresponding anchor element must be labeled with the `aria-describedby`\nattribute, establishing a relationship between the two elements.\n\n## Tooltips\n\n### Tooltip example\n\n```html\n<div id=\"tooltip-id\" class=\"mdc-tooltip\" role=\"tooltip\" aria-hidden=\"true\">\n  <div class=\"mdc-tooltip__surface\">\n    lorem ipsum dolor\n  </div>\n</div>\n```\n\nTo ensure proper positioning of the tooltip, it's important that this tooltip\nelement is an immediate child of the `<body>`, rather than nested underneath\nthe anchor element or other elements.\n\n\n```html\n<a aria-describedby=\"tooltip-id\" href=\"www.google.com\"> Link </a>\n```\n\nThe `aria-describedby` attribute (which is given the `id` for the associated tooltip)\ndesignates an element as being the anchor element for a particular tooltip.\n\nOther MDC components can be designated as anchor elements by adding this\nattribute.\n\n#### MDC Button:\n\n```html\n<button class=\"mdc-button mdc-button--outlined\" aria-describedby=\"tooltip-id\">\n  <div class=\"mdc-button__ripple\"></div>\n  <span class=\"mdc-button__label\">Button</span>\n</button>\n```\n#### MDC Icon Button:\n\n```html\n<button class=\"mdc-icon-button material-icons\" aria-describedby=\"tooltip-id\">favorite</button>\n```\n\nIf the information provided in the tooltip is duplicated from the anchor\nelement's `aria-label`, the tooltip can be hidden from the screenreader by\nannotating the anchor element with `data-tooltip-id` instead of\n`aria-describedby`. Hiding the tooltip from the screenreader will prevent the\nsame information from being announced twice (once from the `aria-label` and\na second time from the tooltip).\n\n```html\n<button class=\"mdc-icon-button material-icons\"\n        aria-label=\"toggle favorite\"\n        data-tooltip-id=\"tooltip-id\">\n  favorite\n</button>\n\n<div id=\"tooltip-id\" class=\"mdc-tooltip\" role=\"tooltip\" aria-hidden=\"true\">\n  <div class=\"mdc-tooltip__surface\">\n    toggle favorite\n  </div>\n</div>\n```\n\n\n## API\n\n### Sass mixins\n\nAccess to theme mixins require importing the tooltip's theme style module.\n\n```scss\n@use \"@material/tooltip\";\n```\n\nMixin | Description\n--- | ---\n`fill-color($color)` | Sets the fill color of the tooltip.\n`label-ink-color($color)` | Sets the color of the tooltip's label text.\n`shape-radius($radius, $rtl-reflexive)` | Sets the rounded shape to tooltip surface with given radius size. Set `$rtl-reflexive` to true to flip radius values in RTL context, defaults to false.\n`word-break($value, $fallbackValue)` | Sets the `word-break` property for the tooltip label. This is used to force-wrap long tooltip labels that lack spaces and hyphens. The optional $fallbackValue param can be used for IE11 as it does not support the `break-word` option. Users for IE11 who do not want their tooltip labels to be broken in the middle of the word can use this mixin to remove the default IE11 behavior of `break-all`.\n`z-index($z-index)` | Sets the z-index of the tooltip.\n\n### `MDCTooltip` Methods\n\nMethod Signature | Description\n--- | ---\n`setTooltipPosition(position: {xPos?: XPosition, yPos?: YPosition}) => void` | Specify how the tooltip should be aligned with the anchor element. See [tooltip positioning](#tooltip-positioning) section for more information.\n`setAnchorBoundaryType(type: AnchorBoundaryType) => void` | Specify whether the anchor element is `bounded` (element has an identifiable boundary such as a button) or `unbounded` (element does not have a visually declared boundary such as a text link). Tooltips are placed closer to bounded anchor elements compared to unbounded anchor elements. If no type is specified, defaults to `bounded`\n\n### Usage Within Frameworks\n\nIf you are using a JavaScript framework, such as React or Angular, you can create a Tooltip 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 [MDCTooltipAdapter](./adapter.ts) and [MDCTooltipFoundation](./foundation.ts) for up-to-date code documentation of tooltip foundation APIs.\n","gitHead":"2c385d3016a738d32bd3c03bcc91bccf82981fed","license":"MIT","_npmUser":{"name":"abhiomkar","email":"abhiomkar@gmail.com"},"homepage":"https://github.com/material-components/material-components-web#readme","keywords":["material components","material design","tooltip"],"repository":{"url":"git+https://github.com/material-components/material-components-web.git","type":"git","directory":"packages/mdc-tooltip"},"_npmVersion":"lerna/3.20.2/node@v10.23.0+x64 (linux)","description":"The Material Components Web tooltip component.","directories":{},"maintainers":[{"name":"taylorv","email":"brian.t.vann@gmail.com"},{"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@gmail.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.23.0","dependencies":{"tslib":"^1.9.3","@material/dom":"9.0.0-canary.2d5f32d41.0","@material/rtl":"9.0.0-canary.2d5f32d41.0","@material/base":"9.0.0-canary.2d5f32d41.0","@material/shape":"9.0.0-canary.2d5f32d41.0","@material/theme":"9.0.0-canary.2d5f32d41.0","@material/animation":"9.0.0-canary.2d5f32d41.0","@material/elevation":"9.0.0-canary.2d5f32d41.0","@material/typography":"9.0.0-canary.2d5f32d41.0","@material/feature-targeting":"9.0.0-canary.2d5f32d41.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/tooltip_9.0.0-canary.2d5f32d41.0_1607359379391_0.44608256612671604","host":"s3://npm-registry-packages"},"_id":"@material/tooltip@9.0.0-canary.2d5f32d41.0","version":"9.0.0-canary.2d5f32d41.0"}