calcite-panel.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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, Fragment } from '@stencil/core/internal/client';
  7. import { a as getElementDir, b as getSlotted, t as toAriaBoolean } from './dom.js';
  8. import { H as Heading } from './Heading.js';
  9. import { S as SLOTS$1, d as defineCustomElement$6 } from './action-menu.js';
  10. import { c as connectConditionalSlotComponent, d as disconnectConditionalSlotComponent } from './conditionalSlot.js';
  11. import { u as updateHostInteraction } from './interactive.js';
  12. import { c as createObserver } from './observers.js';
  13. import { d as defineCustomElement$7 } from './action.js';
  14. import { d as defineCustomElement$5 } from './icon.js';
  15. import { d as defineCustomElement$4 } from './loader.js';
  16. import { d as defineCustomElement$3 } from './popover.js';
  17. import { d as defineCustomElement$2 } from './scrim.js';
  18. const CSS = {
  19. backButton: "back-button",
  20. container: "container",
  21. header: "header",
  22. heading: "heading",
  23. summary: "summary",
  24. headerContent: "header-content",
  25. headerActions: "header-actions",
  26. headerActionsEnd: "header-actions--end",
  27. headerActionsStart: "header-actions--start",
  28. contentWrapper: "content-wrapper",
  29. contentContainer: "content-container",
  30. contentHeight: "content-height",
  31. fabContainer: "fab-container",
  32. footer: "footer",
  33. menuContainer: "menu-container",
  34. menuButton: "menu-button",
  35. menu: "menu",
  36. menuOpen: "menu--open"
  37. };
  38. const ICONS = {
  39. close: "x",
  40. menu: "ellipsis",
  41. backLeft: "chevron-left",
  42. backRight: "chevron-right"
  43. };
  44. const SLOTS = {
  45. headerActionsStart: "header-actions-start",
  46. headerActionsEnd: "header-actions-end",
  47. headerMenuActions: "header-menu-actions",
  48. headerContent: "header-content",
  49. fab: "fab",
  50. footer: "footer",
  51. footerActions: "footer-actions"
  52. };
  53. const TEXT = {
  54. back: "Back",
  55. close: "Close",
  56. open: "Open",
  57. options: "Options"
  58. };
  59. const HEADING_LEVEL = 3;
  60. const panelCss = "@-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}:host{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--calcite-popper-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{position:relative;display:-ms-flexbox;display:flex;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;overflow:hidden;--calcite-min-header-height:calc(var(--calcite-icon-size) * 3);--calcite-panel-max-height:unset;--calcite-panel-width:100%;--calcite-panel-min-width:unset;--calcite-panel-max-width:unset}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.header{margin:0px;display:-ms-flexbox;display:flex;-ms-flex-line-pack:justify;align-content:space-between;-ms-flex-align:center;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}.heading{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}.header .heading{-ms-flex:1 1 auto;flex:1 1 auto;padding:0.5rem}h1.heading{font-size:var(--calcite-font-size-2);line-height:1.5rem}h2.heading{font-size:var(--calcite-font-size-1);line-height:1.5rem}h3.heading{font-size:var(--calcite-font-size-0);line-height:1.25rem}h4.heading,h5.heading{font-size:var(--calcite-font-size--1);line-height:1rem}.container{margin:0px;display:-ms-flexbox;display:flex;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch;background-color:var(--calcite-ui-background);padding:0px;max-height:var(--calcite-panel-max-height);width:var(--calcite-panel-width);max-width:var(--calcite-panel-max-width);min-width:var(--calcite-panel-min-width);-webkit-transition:max-height var(--calcite-animation-timing), width var(--calcite-animation-timing);transition:max-height var(--calcite-animation-timing), width var(--calcite-animation-timing)}:host([height-scale=s]){--calcite-panel-max-height:40vh}:host([height-scale=m]){--calcite-panel-max-height:60vh}:host([height-scale=l]){--calcite-panel-max-height:80vh}:host([width-scale=s]){--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 12vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 300px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 150px)}:host([width-scale=m]){--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 20vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 420px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 240px)}:host([width-scale=l]){--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 45vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 680px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 340px)}.container[hidden]{display:none}:host([loading]) .container,:host([disabled]) .container{position:relative}.header{border-bottom:1px solid;position:-webkit-sticky;position:sticky;top:0px;width:100%;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:start;justify-content:flex-start;background-color:var(--calcite-ui-foreground-1);border-bottom-color:var(--calcite-ui-border-3);-ms-flex:0 0 auto;flex:0 0 auto}.header-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:hidden;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.875rem;padding-bottom:0.875rem;-webkit-margin-end:auto;margin-inline-end:auto}.header-content .heading,.header-content .summary{display:block;overflow-wrap:break-word;padding:0px}.header-content .heading{margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:0.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-weight:var(--calcite-font-weight-medium)}.header-content .heading:only-child{margin-bottom:0px}.header-content .summary{font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}.header-actions{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:stretch;align-items:stretch}.header-actions--end,.menu-container:only-child{-webkit-margin-start:auto;margin-inline-start:auto}.menu-button{position:relative;height:100%;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:stretch;align-self:stretch}.menu{min-width:10rem;-ms-flex-flow:column nowrap;flex-flow:column nowrap}.content-wrapper{overflow:auto}.content-height{height:100%}.content-container{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:stretch;align-items:stretch;background-color:var(--calcite-ui-background)}.footer{border-top:1px solid;position:-webkit-sticky;position:sticky;bottom:0px;display:-ms-flexbox;display:flex;width:100%;-ms-flex-pack:space-evenly;justify-content:space-evenly;background-color:var(--calcite-ui-foreground-1);border-top-color:var(--calcite-ui-border-3);-ms-flex:0 0 auto;flex:0 0 auto;min-height:3rem;padding:0.5rem}.fab-container{position:-webkit-sticky;position:sticky;bottom:0px;left:0px;right:0px;margin-top:0px;margin-bottom:0px;margin-left:auto;margin-right:auto;display:block;padding:0.5rem;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content}";
  61. const Panel = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  62. constructor() {
  63. super();
  64. this.__registerHost();
  65. this.__attachShadow();
  66. this.calcitePanelDismiss = createEvent(this, "calcitePanelDismiss", 7);
  67. this.calcitePanelDismissedChange = createEvent(this, "calcitePanelDismissedChange", 7);
  68. this.calcitePanelScroll = createEvent(this, "calcitePanelScroll", 7);
  69. this.calcitePanelBackClick = createEvent(this, "calcitePanelBackClick", 7);
  70. // --------------------------------------------------------------------------
  71. //
  72. // Properties
  73. //
  74. // --------------------------------------------------------------------------
  75. /**
  76. * Hides the panel.
  77. */
  78. this.dismissed = false;
  79. /**
  80. * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
  81. */
  82. this.disabled = false;
  83. /**
  84. * Displays a close button in the trailing side of the header.
  85. */
  86. this.dismissible = false;
  87. /**
  88. * Shows a back button in the header.
  89. */
  90. this.showBackButton = false;
  91. /**
  92. * When true, content is waiting to be loaded. This state shows a busy indicator.
  93. */
  94. this.loading = false;
  95. /**
  96. * Opens the action menu.
  97. */
  98. this.menuOpen = false;
  99. this.resizeObserver = createObserver("resize", () => this.resizeHandler());
  100. // --------------------------------------------------------------------------
  101. //
  102. // Private Methods
  103. //
  104. // --------------------------------------------------------------------------
  105. this.resizeHandler = () => {
  106. const { panelScrollEl } = this;
  107. if (!panelScrollEl ||
  108. typeof panelScrollEl.scrollHeight !== "number" ||
  109. typeof panelScrollEl.offsetHeight !== "number") {
  110. return;
  111. }
  112. panelScrollEl.tabIndex = panelScrollEl.scrollHeight > panelScrollEl.offsetHeight ? 0 : -1;
  113. };
  114. this.setContainerRef = (node) => {
  115. this.containerEl = node;
  116. };
  117. this.setDismissRef = (node) => {
  118. this.dismissButtonEl = node;
  119. };
  120. this.setBackRef = (node) => {
  121. this.backButtonEl = node;
  122. };
  123. this.panelKeyDownHandler = (event) => {
  124. if (event.key === "Escape") {
  125. this.dismiss();
  126. }
  127. };
  128. this.dismiss = () => {
  129. this.dismissed = true;
  130. this.calcitePanelDismiss.emit();
  131. };
  132. this.panelScrollHandler = () => {
  133. this.calcitePanelScroll.emit();
  134. };
  135. this.backButtonClick = () => {
  136. this.calcitePanelBackClick.emit();
  137. };
  138. this.setPanelScrollEl = (el) => {
  139. var _a, _b;
  140. this.panelScrollEl = el;
  141. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  142. if (el) {
  143. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.observe(el);
  144. this.resizeHandler();
  145. }
  146. };
  147. }
  148. dismissedHandler() {
  149. this.calcitePanelDismissedChange.emit();
  150. }
  151. //--------------------------------------------------------------------------
  152. //
  153. // Lifecycle
  154. //
  155. //--------------------------------------------------------------------------
  156. componentDidRender() {
  157. updateHostInteraction(this);
  158. }
  159. // --------------------------------------------------------------------------
  160. //
  161. // Lifecycle
  162. //
  163. // --------------------------------------------------------------------------
  164. connectedCallback() {
  165. connectConditionalSlotComponent(this);
  166. }
  167. disconnectedCallback() {
  168. var _a;
  169. disconnectConditionalSlotComponent(this);
  170. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  171. }
  172. // --------------------------------------------------------------------------
  173. //
  174. // Methods
  175. //
  176. // --------------------------------------------------------------------------
  177. /** Sets focus on the component. */
  178. async setFocus(focusId) {
  179. var _a, _b, _c;
  180. if (focusId === "dismiss-button") {
  181. (_a = this.dismissButtonEl) === null || _a === void 0 ? void 0 : _a.setFocus();
  182. return;
  183. }
  184. if (focusId === "back-button") {
  185. (_b = this.backButtonEl) === null || _b === void 0 ? void 0 : _b.setFocus();
  186. return;
  187. }
  188. (_c = this.containerEl) === null || _c === void 0 ? void 0 : _c.focus();
  189. }
  190. /** Scrolls panel content to a particular set of coordinates.
  191. *
  192. * ```
  193. * myCalcitePanel.scrollContentTo({
  194. * left: 0, // Specifies the number of pixels along the X axis to scroll the window or element.
  195. * top: 0, // Specifies the number of pixels along the Y axis to scroll the window or element
  196. * behavior: "auto" // Specifies whether the scrolling should animate smoothly (smooth), or happen instantly in a single jump (auto, the default value).
  197. * });
  198. * ```
  199. */
  200. async scrollContentTo(options) {
  201. var _a;
  202. (_a = this.panelScrollEl) === null || _a === void 0 ? void 0 : _a.scrollTo(options);
  203. }
  204. // --------------------------------------------------------------------------
  205. //
  206. // Render Methods
  207. //
  208. // --------------------------------------------------------------------------
  209. renderBackButton() {
  210. const { el } = this;
  211. const rtl = getElementDir(el) === "rtl";
  212. const { showBackButton, intlBack, backButtonClick } = this;
  213. const label = intlBack || TEXT.back;
  214. const icon = rtl ? ICONS.backRight : ICONS.backLeft;
  215. return showBackButton ? (h("calcite-action", { "aria-label": label, class: CSS.backButton, icon: icon, key: "back-button", onClick: backButtonClick, ref: this.setBackRef, scale: "s", slot: SLOTS.headerActionsStart, text: label })) : null;
  216. }
  217. renderHeaderContent() {
  218. const { heading, headingLevel, summary } = this;
  219. const headingNode = heading ? (h(Heading, { class: CSS.heading, level: headingLevel || HEADING_LEVEL }, heading)) : null;
  220. const summaryNode = summary ? h("span", { class: CSS.summary }, summary) : null;
  221. return headingNode || summaryNode ? (h("div", { class: CSS.headerContent, key: "header-content" }, headingNode, summaryNode)) : null;
  222. }
  223. /**
  224. * Allows user to override the entire header-content node.
  225. */
  226. renderHeaderSlottedContent() {
  227. return (h("div", { class: CSS.headerContent, key: "slotted-header-content" }, h("slot", { name: SLOTS.headerContent })));
  228. }
  229. renderHeaderStartActions() {
  230. const { el } = this;
  231. const hasStartActions = getSlotted(el, SLOTS.headerActionsStart);
  232. return hasStartActions ? (h("div", { class: { [CSS.headerActionsStart]: true, [CSS.headerActions]: true }, key: "header-actions-start" }, h("slot", { name: SLOTS.headerActionsStart }))) : null;
  233. }
  234. renderHeaderActionsEnd() {
  235. const { dismiss, dismissible, el, intlClose } = this;
  236. const text = intlClose || TEXT.close;
  237. const dismissibleNode = dismissible ? (h("calcite-action", { "aria-label": text, icon: ICONS.close, onClick: dismiss, ref: this.setDismissRef, text: text })) : null;
  238. const slotNode = h("slot", { name: SLOTS.headerActionsEnd });
  239. const hasEndActions = getSlotted(el, SLOTS.headerActionsEnd);
  240. return hasEndActions || dismissibleNode ? (h("div", { class: { [CSS.headerActionsEnd]: true, [CSS.headerActions]: true }, key: "header-actions-end" }, slotNode, dismissibleNode)) : null;
  241. }
  242. renderMenu() {
  243. const { el, intlOptions, menuOpen } = this;
  244. const hasMenuItems = getSlotted(el, SLOTS.headerMenuActions);
  245. return hasMenuItems ? (h("calcite-action-menu", { flipPlacements: ["top", "bottom"], key: "menu", label: intlOptions || TEXT.options, open: menuOpen, placement: "bottom-end" }, h("calcite-action", { icon: ICONS.menu, slot: SLOTS$1.trigger, text: intlOptions || TEXT.options }), h("slot", { name: SLOTS.headerMenuActions }))) : null;
  246. }
  247. renderHeaderNode() {
  248. const { el, showBackButton } = this;
  249. const backButtonNode = this.renderBackButton();
  250. const hasHeaderSlottedContent = getSlotted(el, SLOTS.headerContent);
  251. const headerContentNode = hasHeaderSlottedContent
  252. ? this.renderHeaderSlottedContent()
  253. : this.renderHeaderContent();
  254. const actionsNodeStart = this.renderHeaderStartActions();
  255. const actionsNodeEnd = this.renderHeaderActionsEnd();
  256. const headerMenuNode = this.renderMenu();
  257. return actionsNodeStart ||
  258. headerContentNode ||
  259. actionsNodeEnd ||
  260. headerMenuNode ||
  261. showBackButton ? (h("header", { class: CSS.header }, backButtonNode, actionsNodeStart, headerContentNode, actionsNodeEnd, headerMenuNode)) : null;
  262. }
  263. renderFooterNode() {
  264. const { el } = this;
  265. const hasFooterSlottedContent = getSlotted(el, SLOTS.footer);
  266. const hasFooterActions = getSlotted(el, SLOTS.footerActions);
  267. return hasFooterSlottedContent || hasFooterActions ? (h("footer", { class: CSS.footer, key: "footer" }, hasFooterSlottedContent ? h("slot", { key: "footer-slot", name: SLOTS.footer }) : null, hasFooterActions ? h("slot", { key: "footer-actions-slot", name: SLOTS.footerActions }) : null)) : null;
  268. }
  269. renderContent() {
  270. const { el } = this;
  271. const hasFab = getSlotted(el, SLOTS.fab);
  272. const defaultSlotNode = h("slot", { key: "default-slot" });
  273. const contentWrapperKey = "content-wrapper";
  274. return hasFab ? (h("div", { class: { [CSS.contentWrapper]: true, [CSS.contentHeight]: true }, key: contentWrapperKey, onScroll: this.panelScrollHandler, ref: this.setPanelScrollEl }, h("section", { class: CSS.contentContainer }, defaultSlotNode), this.renderFab())) : (h("section", { class: { [CSS.contentWrapper]: true, [CSS.contentContainer]: true }, key: contentWrapperKey, onScroll: this.panelScrollHandler, ref: this.setPanelScrollEl }, defaultSlotNode));
  275. }
  276. renderFab() {
  277. return (h("div", { class: CSS.fabContainer }, h("slot", { name: SLOTS.fab })));
  278. }
  279. render() {
  280. const { dismissed, dismissible, loading, panelKeyDownHandler } = this;
  281. const panelNode = (h("article", { "aria-busy": toAriaBoolean(loading), class: CSS.container, hidden: dismissible && dismissed, onKeyDown: panelKeyDownHandler, ref: this.setContainerRef, tabIndex: dismissible ? 0 : -1 }, this.renderHeaderNode(), this.renderContent(), this.renderFooterNode()));
  282. return (h(Fragment, null, loading ? h("calcite-scrim", { loading: loading }) : null, panelNode));
  283. }
  284. get el() { return this; }
  285. static get watchers() { return {
  286. "dismissed": ["dismissedHandler"]
  287. }; }
  288. static get style() { return panelCss; }
  289. }, [1, "calcite-panel", {
  290. "dismissed": [1540],
  291. "beforeBack": [16],
  292. "disabled": [516],
  293. "dismissible": [516],
  294. "headingLevel": [2, "heading-level"],
  295. "showBackButton": [516, "show-back-button"],
  296. "intlBack": [1, "intl-back"],
  297. "heightScale": [513, "height-scale"],
  298. "widthScale": [513, "width-scale"],
  299. "loading": [516],
  300. "intlClose": [1, "intl-close"],
  301. "intlOptions": [1, "intl-options"],
  302. "heading": [1],
  303. "summary": [1],
  304. "menuOpen": [516, "menu-open"],
  305. "setFocus": [64],
  306. "scrollContentTo": [64]
  307. }]);
  308. function defineCustomElement$1() {
  309. if (typeof customElements === "undefined") {
  310. return;
  311. }
  312. const components = ["calcite-panel", "calcite-action", "calcite-action-menu", "calcite-icon", "calcite-loader", "calcite-popover", "calcite-scrim"];
  313. components.forEach(tagName => { switch (tagName) {
  314. case "calcite-panel":
  315. if (!customElements.get(tagName)) {
  316. customElements.define(tagName, Panel);
  317. }
  318. break;
  319. case "calcite-action":
  320. if (!customElements.get(tagName)) {
  321. defineCustomElement$7();
  322. }
  323. break;
  324. case "calcite-action-menu":
  325. if (!customElements.get(tagName)) {
  326. defineCustomElement$6();
  327. }
  328. break;
  329. case "calcite-icon":
  330. if (!customElements.get(tagName)) {
  331. defineCustomElement$5();
  332. }
  333. break;
  334. case "calcite-loader":
  335. if (!customElements.get(tagName)) {
  336. defineCustomElement$4();
  337. }
  338. break;
  339. case "calcite-popover":
  340. if (!customElements.get(tagName)) {
  341. defineCustomElement$3();
  342. }
  343. break;
  344. case "calcite-scrim":
  345. if (!customElements.get(tagName)) {
  346. defineCustomElement$2();
  347. }
  348. break;
  349. } });
  350. }
  351. defineCustomElement$1();
  352. const CalcitePanel = Panel;
  353. const defineCustomElement = defineCustomElement$1;
  354. export { CalcitePanel, defineCustomElement };