calcite-alert.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.82
  5. */
  6. import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
  7. import { s as setRequestedIcon, t as toAriaBoolean, b as getSlotted } from './dom.js';
  8. import { S as StatusIcons } from './interfaces.js';
  9. import { d as defineCustomElement$3 } from './chip.js';
  10. import { d as defineCustomElement$2 } from './icon.js';
  11. const TEXT = {
  12. intlClose: "Close"
  13. };
  14. const DURATIONS = {
  15. slow: 14000,
  16. medium: 10000,
  17. fast: 6000
  18. };
  19. const SLOTS = {
  20. title: "title",
  21. message: "message",
  22. link: "link"
  23. };
  24. const alertCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([scale=s]){--calcite-alert-width:40em;--calcite-alert-spacing-token-small:0.5rem;--calcite-alert-spacing-token-large:0.75rem}:host([scale=s]) slot[name=title]::slotted(*),:host([scale=s]) *::slotted([slot=title]){font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=s]) slot[name=message]::slotted(*),:host([scale=s]) *::slotted([slot=message]){font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) slot[name=link]::slotted(*),:host([scale=s]) *::slotted([slot=link]){font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) .alert-queue-count{margin-left:0.5rem;margin-right:0.5rem}:host([scale=s]) .container{--calcite-alert-min-height:3.5rem}:host([scale=s]) .alert-close{padding:0.5rem}:host([scale=m]){--calcite-alert-width:50em;--calcite-alert-spacing-token-small:0.75rem;--calcite-alert-spacing-token-large:1rem}:host([scale=m]) slot[name=title]::slotted(*),:host([scale=m]) *::slotted([slot=title]){font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=m]) slot[name=message]::slotted(*),:host([scale=m]) *::slotted([slot=message]){font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) slot[name=link]::slotted(*),:host([scale=m]) *::slotted([slot=link]){font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) .alert-queue-count{margin-left:0.75rem;margin-right:0.75rem}:host([scale=m]) .container{--calcite-alert-min-height:4.1875rem}:host([scale=l]){--calcite-alert-width:60em;--calcite-alert-spacing-token-small:1rem;--calcite-alert-spacing-token-large:1.25rem}:host([scale=l]) slot[name=title]::slotted(*),:host([scale=l]) *::slotted([slot=title]){margin-bottom:0.25rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host([scale=l]) slot[name=message]::slotted(*),:host([scale=l]) *::slotted([slot=message]){font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) slot[name=link]::slotted(*),:host([scale=l]) *::slotted([slot=link]){font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) .alert-queue-count{margin-left:1rem;margin-right:1rem}:host([scale=l]) .container{--calcite-alert-min-height:5.625rem}:host{--calcite-alert-edge-distance:2rem;display:block}:host .container{pointer-events:none;position:fixed;margin-top:0px;margin-bottom:0px;margin-left:auto;margin-right:auto;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--calcite-ui-foreground-1);opacity:0;--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-radius:var(--calcite-border-radius);border-top:0px solid transparent;border-left:1px solid var(--calcite-ui-border-3);border-right:1px solid var(--calcite-ui-border-3);border-bottom:1px solid var(--calcite-ui-border-3);min-height:var(--calcite-alert-min-height);width:var(--calcite-alert-width);max-width:calc(100% - (var(--calcite-alert-edge-distance) * 2 + 2px));max-height:0;z-index:101;-webkit-transition:var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out;transition:var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out}:host .container.bottom,:host .container.top{inset-inline-end:0;inset-inline-start:0}:host .container[class*=bottom]{-webkit-transform:translate3d(0, var(--calcite-alert-edge-distance), 0);transform:translate3d(0, var(--calcite-alert-edge-distance), 0);inset-block-end:var(--calcite-alert-edge-distance)}:host .container[class*=top]{-webkit-transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), 0);transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), 0);inset-block-start:var(--calcite-alert-edge-distance)}:host .container[class*=-start]{inset-inline-start:var(--calcite-alert-edge-distance);inset-inline-end:auto}:host .container[class*=-end]{inset-inline-end:var(--calcite-alert-edge-distance);inset-inline-start:auto}.container{display:-ms-flexbox;display:flex;width:100%;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.alert-close{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}.alert-close:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host([active]) .container:not(.queued){max-height:100%;border-top-width:2px;opacity:1;pointer-events:initial}:host([active]) .container:not(.queued)[class*=bottom]{-webkit-transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), inherit);transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), inherit)}:host([active]) .container:not(.queued)[class*=top]{-webkit-transform:translate3d(0, var(--calcite-alert-edge-distance), inherit);transform:translate3d(0, var(--calcite-alert-edge-distance), inherit)}slot[name=title]::slotted(*),*::slotted([slot=title]){font-size:var(--calcite-font-size-0);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}slot[name=message]::slotted(*),*::slotted([slot=message]){margin:0px;display:inline;font-size:var(--calcite-font-size--1);line-height:1.375;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}slot[name=link]::slotted(*),*::slotted([slot=link]){display:-ms-inline-flexbox;display:inline-flex;color:var(--calcite-ui-text-link)}.alert-content{-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;padding:var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-large);-ms-flex:0 0 auto;flex:0 0 auto;overflow-wrap:break-word;background-color:var(--calcite-ui-foreground-1);-ms-flex:1 1 auto;flex:1 1 auto;min-width:0;padding-block:var(--calcite-alert-spacing-token-small);padding-inline:0 var(--calcite-alert-spacing-token-small);border-bottom-left-radius:var(--calcite-border-radius);border-bottom-right-radius:var(--calcite-border-radius)}.alert-content:first-of-type:not(:only-child){-webkit-padding-start:var(--calcite-alert-spacing-token-large);padding-inline-start:var(--calcite-alert-spacing-token-large)}.alert-content:only-child{padding:var(--calcite-alert-spacing-token-small)}.alert-icon{-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;padding:var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-large);-ms-flex:0 0 auto;flex:0 0 auto;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-item-align:stretch;align-self:stretch;background-color:var(--calcite-ui-foreground-1);padding-top:0px;padding-bottom:0px}.alert-close{-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;padding:var(--calcite-alert-spacing-token-small) var(--calcite-alert-spacing-token-large);-ms-flex:0 0 auto;flex:0 0 auto;cursor:pointer;-ms-flex-item-align:stretch;align-self:stretch;overflow:hidden;border-style:none;background-color:var(--calcite-ui-foreground-1);padding-top:0px;padding-bottom:0px;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;border-end-end-radius:var(--calcite-border-radius)}.alert-close:hover,.alert-close:focus{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}.alert-close:active{background-color:var(--calcite-ui-foreground-3)}.alert-queue-count{visibility:hidden;display:-ms-flexbox;display:flex;cursor:default;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around;-ms-flex-item-align:stretch;align-self:stretch;overflow:hidden;background-color:var(--calcite-ui-foreground-1);text-align:center;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2);opacity:0;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;border-left:0px solid transparent;border-right:0px solid transparent;border-top-right-radius:0}.alert-queue-count.active{visibility:visible;opacity:1}:host([auto-dismiss])>.alert-queue-count{-webkit-border-end:0px solid transparent;border-inline-end:0px solid transparent}.alert-dismiss-progress{position:absolute;left:0px;right:0px;display:block;width:100%;overflow:hidden;top:-2px;height:2px;z-index:103;border-radius:var(--calcite-border-radius) var(--calcite-border-radius) 0 0}.alert-dismiss-progress:after{position:absolute;top:0px;display:block;height:2px;content:\"\";background-color:var(--calcite-alert-dismiss-progress-background);z-index:104;inset-inline-end:0}:host([color=blue]) .container{border-top-color:var(--calcite-ui-info)}:host([color=blue]) .container .alert-icon{color:var(--calcite-ui-info)}:host([color=red]) .container{border-top-color:var(--calcite-ui-danger)}:host([color=red]) .container .alert-icon{color:var(--calcite-ui-danger)}:host([color=yellow]) .container{border-top-color:var(--calcite-ui-warning)}:host([color=yellow]) .container .alert-icon{color:var(--calcite-ui-warning)}:host([color=green]) .container{border-top-color:var(--calcite-ui-success)}:host([color=green]) .container .alert-icon{color:var(--calcite-ui-success)}:host([auto-dismiss-duration=fast]) .alert-dismiss-progress:after{-webkit-animation:dismissProgress 6000ms ease-out;animation:dismissProgress 6000ms ease-out}:host([auto-dismiss-duration=medium]) .alert-dismiss-progress:after{-webkit-animation:dismissProgress 10000ms ease-out;animation:dismissProgress 10000ms ease-out}:host([auto-dismiss-duration=slow]) .alert-dismiss-progress:after{-webkit-animation:dismissProgress 14000ms ease-out;animation:dismissProgress 14000ms ease-out}@-webkit-keyframes dismissProgress{0%{width:0px;opacity:0.75}100%{width:100%;opacity:1}}@keyframes dismissProgress{0%{width:0px;opacity:0.75}100%{width:100%;opacity:1}}";
  25. const Alert = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  26. constructor() {
  27. super();
  28. this.__registerHost();
  29. this.__attachShadow();
  30. this.calciteAlertClose = createEvent(this, "calciteAlertClose", 7);
  31. this.calciteAlertOpen = createEvent(this, "calciteAlertOpen", 7);
  32. this.calciteAlertSync = createEvent(this, "calciteAlertSync", 7);
  33. this.calciteAlertRegister = createEvent(this, "calciteAlertRegister", 7);
  34. //--------------------------------------------------------------------------
  35. //
  36. // Properties
  37. //
  38. //---------------------------------------------------------------------------
  39. /** Is the alert currently active or not */
  40. this.active = false;
  41. /** Close the alert automatically (recommended for passive, non-blocking alerts) */
  42. this.autoDismiss = false;
  43. /** Duration of autoDismiss (only used with `autoDismiss`) */
  44. this.autoDismissDuration = this.autoDismiss ? "medium" : null;
  45. /** Color for the alert (will apply to top border and icon) */
  46. this.color = "blue";
  47. /** string to override English close text
  48. * @default "Close"
  49. */
  50. this.intlClose = TEXT.intlClose;
  51. /** specify the placement of the alert */
  52. this.placement = "bottom";
  53. /** specify the scale of the alert, defaults to m */
  54. this.scale = "m";
  55. //--------------------------------------------------------------------------
  56. //
  57. // Private State/Props
  58. //
  59. //--------------------------------------------------------------------------
  60. /** the list of queued alerts */
  61. this.queue = [];
  62. /** the count of queued alerts */
  63. this.queueLength = 0;
  64. /** is the alert queued */
  65. this.queued = false;
  66. this.autoDismissTimeoutId = null;
  67. this.trackTimer = Date.now();
  68. this.activeTransitionProp = "opacity";
  69. /** close and emit the closed alert and the queue */
  70. this.closeAlert = () => {
  71. this.autoDismissTimeoutId = null;
  72. this.queued = false;
  73. this.active = false;
  74. this.queue = this.queue.filter((e) => e !== this.el);
  75. this.determineActiveAlert();
  76. this.calciteAlertSync.emit({ queue: this.queue });
  77. };
  78. this.transitionEnd = (event) => {
  79. if (event.propertyName === this.activeTransitionProp) {
  80. this.active
  81. ? this.calciteAlertOpen.emit({
  82. el: this.el,
  83. queue: this.queue
  84. })
  85. : this.calciteAlertClose.emit({
  86. el: this.el,
  87. queue: this.queue
  88. });
  89. }
  90. };
  91. }
  92. watchActive() {
  93. if (this.active && !this.queued) {
  94. this.calciteAlertRegister.emit();
  95. }
  96. if (!this.active) {
  97. this.queue = this.queue.filter((e) => e !== this.el);
  98. this.calciteAlertSync.emit({ queue: this.queue });
  99. }
  100. }
  101. updateRequestedIcon() {
  102. this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
  103. }
  104. updateDuration() {
  105. if (this.autoDismiss && this.autoDismissTimeoutId) {
  106. window.clearTimeout(this.autoDismissTimeoutId);
  107. this.autoDismissTimeoutId = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration] - (Date.now() - this.trackTimer));
  108. }
  109. }
  110. //--------------------------------------------------------------------------
  111. //
  112. // Lifecycle
  113. //
  114. //--------------------------------------------------------------------------
  115. connectedCallback() {
  116. if (this.active && !this.queued) {
  117. this.calciteAlertRegister.emit();
  118. }
  119. }
  120. componentWillLoad() {
  121. this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
  122. }
  123. disconnectedCallback() {
  124. window.clearTimeout(this.autoDismissTimeoutId);
  125. }
  126. render() {
  127. const closeButton = (h("button", { "aria-label": this.intlClose, class: "alert-close", onClick: this.closeAlert, ref: (el) => (this.closeButton = el), type: "button" }, h("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
  128. const queueText = `+${this.queueLength > 2 ? this.queueLength - 1 : 1}`;
  129. const queueCount = (h("div", { class: `${this.queueLength > 1 ? "active " : ""}alert-queue-count` }, h("calcite-chip", { scale: this.scale, value: queueText }, queueText)));
  130. const { active, autoDismiss, label, placement, queued, requestedIcon } = this;
  131. const role = autoDismiss ? "alert" : "alertdialog";
  132. const hidden = !active;
  133. return (h(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "calcite-hydrated-hidden": hidden, role: role }, h("div", { class: {
  134. container: true,
  135. queued,
  136. [placement]: true
  137. }, onTransitionEnd: this.transitionEnd }, requestedIcon ? (h("div", { class: "alert-icon" }, h("calcite-icon", { icon: requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, h("div", { class: "alert-content" }, h("slot", { name: SLOTS.title }), h("slot", { name: SLOTS.message }), h("slot", { name: SLOTS.link })), queueCount, !autoDismiss ? closeButton : null, active && !queued && autoDismiss ? h("div", { class: "alert-dismiss-progress" }) : null)));
  138. }
  139. // when an alert is opened or closed, update queue and determine active alert
  140. alertSync(event) {
  141. if (this.queue !== event.detail.queue) {
  142. this.queue = event.detail.queue;
  143. }
  144. this.queueLength = this.queue.length;
  145. this.determineActiveAlert();
  146. }
  147. // when an alert is first registered, trigger a queue sync to get queue
  148. alertRegister() {
  149. if (this.active && !this.queue.includes(this.el)) {
  150. this.queued = true;
  151. this.queue.push(this.el);
  152. }
  153. this.calciteAlertSync.emit({ queue: this.queue });
  154. this.determineActiveAlert();
  155. }
  156. //--------------------------------------------------------------------------
  157. //
  158. // Public Methods
  159. //
  160. //--------------------------------------------------------------------------
  161. /** Sets focus on the component. */
  162. async setFocus() {
  163. const alertLinkEl = getSlotted(this.el, { selector: "calcite-link" });
  164. if (!this.closeButton && !alertLinkEl) {
  165. return;
  166. }
  167. else if (alertLinkEl) {
  168. alertLinkEl.setFocus();
  169. }
  170. else if (this.closeButton) {
  171. this.closeButton.focus();
  172. }
  173. }
  174. //--------------------------------------------------------------------------
  175. //
  176. // Private Methods
  177. //
  178. //--------------------------------------------------------------------------
  179. /** determine which alert is active */
  180. determineActiveAlert() {
  181. var _a;
  182. if (((_a = this.queue) === null || _a === void 0 ? void 0 : _a[0]) === this.el) {
  183. this.openAlert();
  184. if (this.autoDismiss && !this.autoDismissTimeoutId) {
  185. this.trackTimer = Date.now();
  186. this.autoDismissTimeoutId = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration]);
  187. }
  188. }
  189. else {
  190. return;
  191. }
  192. }
  193. /** emit the opened alert and the queue */
  194. openAlert() {
  195. window.clearTimeout(this.queueTimeout);
  196. this.queueTimeout = window.setTimeout(() => (this.queued = false), 300);
  197. }
  198. get el() { return this; }
  199. static get watchers() { return {
  200. "active": ["watchActive"],
  201. "icon": ["updateRequestedIcon"],
  202. "color": ["updateRequestedIcon"],
  203. "autoDismissDuration": ["updateDuration"]
  204. }; }
  205. static get style() { return alertCss; }
  206. }, [1, "calcite-alert", {
  207. "active": [1540],
  208. "autoDismiss": [4, "auto-dismiss"],
  209. "autoDismissDuration": [513, "auto-dismiss-duration"],
  210. "color": [513],
  211. "icon": [520],
  212. "intlClose": [1, "intl-close"],
  213. "label": [1],
  214. "placement": [1],
  215. "scale": [513],
  216. "queue": [32],
  217. "queueLength": [32],
  218. "queued": [32],
  219. "requestedIcon": [32],
  220. "setFocus": [64]
  221. }, [[8, "calciteAlertSync", "alertSync"], [8, "calciteAlertRegister", "alertRegister"]]]);
  222. function defineCustomElement$1() {
  223. if (typeof customElements === "undefined") {
  224. return;
  225. }
  226. const components = ["calcite-alert", "calcite-chip", "calcite-icon"];
  227. components.forEach(tagName => { switch (tagName) {
  228. case "calcite-alert":
  229. if (!customElements.get(tagName)) {
  230. customElements.define(tagName, Alert);
  231. }
  232. break;
  233. case "calcite-chip":
  234. if (!customElements.get(tagName)) {
  235. defineCustomElement$3();
  236. }
  237. break;
  238. case "calcite-icon":
  239. if (!customElements.get(tagName)) {
  240. defineCustomElement$2();
  241. }
  242. break;
  243. } });
  244. }
  245. defineCustomElement$1();
  246. const CalciteAlert = Alert;
  247. const defineCustomElement = defineCustomElement$1;
  248. export { CalciteAlert, defineCustomElement };