UNPKG

carbon-custom-elements

Version:

A Carbon Design System variant that's as easy to use as native HTML elements, with no framework tax, no framework silo.

1 lines 2.54 kB
{"version":3,"sources":["components/notification/toast-notification.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,oBAAoB,EAAE,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAKhF;;;;;;;;;GASG;AACH,cACM,mBAAoB,SAAQ,oBAAoB;IACpD,SAAS,CAAC,KAAK,oBAA2B;IAE1C,SAAS,CAAC,WAAW;IAYrB;;OAEG;IAEH,OAAO,SAAM;IAEb,MAAM;IAWN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,mBAAmB,CAAC","file":"toast-notification.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2020\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport settings from 'carbon-components/es/globals/js/settings';\nimport { html, property, customElement } from 'lit-element';\nimport BXInlineNotification, { NOTIFICATION_TYPE } from './inline-notification';\nimport styles from './toast-notification.scss';\n\nconst { prefix } = settings;\n\n/**\n * Toast notification.\n * @element bx-toast-notification\n * @slot subtitle - The subtitle.\n * @slot title - The title.\n * @fires bx-notification-beingclosed\n * The custom event fired before this notification is being closed upon a user gesture.\n * Cancellation of this event stops the user-initiated action of closing this notification.\n * @fires bx-notification-closed - The custom event fired after this notification is closed upon a user gesture.\n */\n@customElement(`${prefix}-toast-notification`)\nclass BXToastNotification extends BXInlineNotification {\n protected _type = NOTIFICATION_TYPE.TOAST;\n\n protected _renderText() {\n const { caption, subtitle, title, _type: type } = this;\n return html`\n <div class=\"${prefix}--${type}-notification__details\">\n <h3 class=\"${prefix}--${type}-notification__title\">${title}<slot name=\"title\"></slot></h3>\n <div class=\"${prefix}--${type}-notification__subtitle\">${subtitle}<slot name=\"subtitle\"></slot></div>\n <div class=\"${prefix}--${type}-notification__caption\">${caption}<slot name=\"caption\"></slot></div>\n <slot></slot>\n </div>\n `;\n }\n\n /**\n * The caption.\n */\n @property()\n caption = '';\n\n render() {\n const { _type: type } = this;\n return html`\n ${this._renderIcon()}\n <div class=\"${prefix}--${type}-notification__details\">\n ${this._renderText()}\n </div>\n ${this._renderButton()}\n `;\n }\n\n static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\nexport default BXToastNotification;\n"]}