panel.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  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.97
  5. */
  6. import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client/index.js';
  7. import { c as getElementDir, t as toAriaBoolean } from './dom.js';
  8. import { H as Heading } from './Heading.js';
  9. import { S as SLOTS$1, d as defineCustomElement$5 } from './action-menu.js';
  10. import { u as updateHostInteraction } from './interactive.js';
  11. import { c as createObserver } from './observers.js';
  12. import { d as defineCustomElement$6 } from './action.js';
  13. import { d as defineCustomElement$4 } from './icon.js';
  14. import { d as defineCustomElement$3 } from './loader.js';
  15. import { d as defineCustomElement$2 } from './popover.js';
  16. import { d as defineCustomElement$1 } from './scrim.js';
  17. const CSS = {
  18. backButton: "back-button",
  19. container: "container",
  20. header: "header",
  21. heading: "heading",
  22. summary: "summary",
  23. description: "description",
  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. };
  34. const ICONS = {
  35. close: "x",
  36. menu: "ellipsis",
  37. backLeft: "chevron-left",
  38. backRight: "chevron-right"
  39. };
  40. const SLOTS = {
  41. headerActionsStart: "header-actions-start",
  42. headerActionsEnd: "header-actions-end",
  43. headerMenuActions: "header-menu-actions",
  44. headerContent: "header-content",
  45. fab: "fab",
  46. footer: "footer",
  47. footerActions: "footer-actions"
  48. };
  49. const TEXT = {
  50. back: "Back",
  51. close: "Close",
  52. open: "Open",
  53. options: "Options"
  54. };
  55. const HEADING_LEVEL = 3;
  56. const panelCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:host{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 *{box-sizing:border-box}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{position:relative;display:flex;inline-size:100%;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]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.header{margin:0px;display:flex;align-content:space-between;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{flex:1 1 auto;padding:0.5rem}.container{margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;background-color:var(--calcite-ui-background);padding:0px;max-block-size:var(--calcite-panel-max-height);inline-size:var(--calcite-panel-width);max-inline-size:var(--calcite-panel-max-width);min-inline-size:var(--calcite-panel-min-width);transition:max-block-size var(--calcite-animation-timing), inline-size 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}.header{border-block-end:1px solid;position:sticky;inset-block-start:0px;z-index:400;inline-size:100%;align-items:stretch;justify-content:flex-start;background-color:var(--calcite-ui-foreground-1);border-block-end-color:var(--calcite-ui-border-3);flex:0 0 auto}.header-content{display:flex;flex-direction:column;overflow:hidden;padding-inline:0.75rem;padding-block:0.875rem;margin-inline-end:auto}.header-content .heading,.header-content .description{display:block;overflow-wrap:break-word;padding:0px}.header-content .heading{margin-inline:0px;margin-block:0px 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-block-end:0px}.header-content .description{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:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch}.header-actions--end{margin-inline-start:auto}.content-wrapper{overflow:auto}.content-height{block-size:100%}.content-container{display:flex;flex:1 1 auto;flex-direction:column;flex-wrap:nowrap;align-items:stretch;background-color:var(--calcite-ui-background)}.footer{border-block-start:1px solid;position:sticky;inset-block-end:0px;display:flex;inline-size:100%;justify-content:space-evenly;background-color:var(--calcite-ui-foreground-1);border-block-start-color:var(--calcite-ui-border-3);flex:0 0 auto;min-block-size:3rem;padding:0.5rem}.fab-container{position:sticky;inset-block-end:0px;z-index:300;margin-block:0px;margin-inline:auto;display:block;padding:0.5rem;inset-inline:0;inline-size:-moz-fit-content;inline-size:fit-content}[hidden]{display:none}";
  57. const Panel = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  58. constructor() {
  59. super();
  60. this.__registerHost();
  61. this.__attachShadow();
  62. this.calcitePanelClose = createEvent(this, "calcitePanelClose", 6);
  63. this.calcitePanelDismiss = createEvent(this, "calcitePanelDismiss", 6);
  64. this.calcitePanelDismissedChange = createEvent(this, "calcitePanelDismissedChange", 6);
  65. this.calcitePanelScroll = createEvent(this, "calcitePanelScroll", 6);
  66. this.calcitePanelBackClick = createEvent(this, "calcitePanelBackClick", 6);
  67. // --------------------------------------------------------------------------
  68. //
  69. // Properties
  70. //
  71. // --------------------------------------------------------------------------
  72. /**
  73. * When `true`, hides the component.
  74. *
  75. * @deprecated use `closed` instead.
  76. */
  77. this.dismissed = false;
  78. /** When `true`, the component will be hidden. */
  79. this.closed = false;
  80. /**
  81. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  82. */
  83. this.disabled = false;
  84. /**
  85. * When `true`, a close button is added to the component.
  86. *
  87. * @deprecated use `closable` instead
  88. */
  89. this.dismissible = false;
  90. /** When `true`, displays a close button in the trailing side of the header. */
  91. this.closable = false;
  92. /**
  93. * When `true`, displays a back button in the header.
  94. *
  95. * @deprecated use `calcite-flow-item` instead.
  96. */
  97. this.showBackButton = false;
  98. /**
  99. * When `true`, a busy indicator is displayed.
  100. */
  101. this.loading = false;
  102. /**
  103. * When `true`, the action menu items in the `header-menu-actions` slot are open.
  104. */
  105. this.menuOpen = false;
  106. this.resizeObserver = createObserver("resize", () => this.resizeHandler());
  107. this.hasStartActions = false;
  108. this.hasEndActions = false;
  109. this.hasMenuItems = false;
  110. this.hasHeaderContent = false;
  111. this.hasFooterContent = false;
  112. this.hasFooterActions = false;
  113. this.hasFab = false;
  114. // --------------------------------------------------------------------------
  115. //
  116. // Private Methods
  117. //
  118. // --------------------------------------------------------------------------
  119. this.resizeHandler = () => {
  120. const { panelScrollEl } = this;
  121. if (!panelScrollEl ||
  122. typeof panelScrollEl.scrollHeight !== "number" ||
  123. typeof panelScrollEl.offsetHeight !== "number") {
  124. return;
  125. }
  126. panelScrollEl.tabIndex = panelScrollEl.scrollHeight > panelScrollEl.offsetHeight ? 0 : -1;
  127. };
  128. this.setContainerRef = (node) => {
  129. this.containerEl = node;
  130. };
  131. this.setCloseRef = (node) => {
  132. this.closeButtonEl = node;
  133. };
  134. this.setBackRef = (node) => {
  135. this.backButtonEl = node;
  136. };
  137. this.panelKeyDownHandler = (event) => {
  138. if (this.closable && event.key === "Escape" && !event.defaultPrevented) {
  139. this.close();
  140. event.preventDefault();
  141. }
  142. };
  143. this.close = () => {
  144. this.closed = true;
  145. this.calcitePanelDismiss.emit();
  146. this.calcitePanelClose.emit();
  147. };
  148. this.panelScrollHandler = () => {
  149. this.calcitePanelScroll.emit();
  150. };
  151. this.backButtonClick = () => {
  152. this.calcitePanelBackClick.emit();
  153. };
  154. this.handleHeaderActionsStartSlotChange = (event) => {
  155. const elements = event.target.assignedElements({
  156. flatten: true
  157. });
  158. this.hasStartActions = !!elements.length;
  159. };
  160. this.handleHeaderActionsEndSlotChange = (event) => {
  161. const elements = event.target.assignedElements({
  162. flatten: true
  163. });
  164. this.hasEndActions = !!elements.length;
  165. };
  166. this.handleHeaderMenuActionsSlotChange = (event) => {
  167. const elements = event.target.assignedElements({
  168. flatten: true
  169. });
  170. this.hasMenuItems = !!elements.length;
  171. };
  172. this.handleHeaderContentSlotChange = (event) => {
  173. const elements = event.target.assignedElements({
  174. flatten: true
  175. });
  176. this.hasHeaderContent = !!elements.length;
  177. };
  178. this.handleFooterSlotChange = (event) => {
  179. const elements = event.target.assignedElements({
  180. flatten: true
  181. });
  182. this.hasFooterContent = !!elements.length;
  183. };
  184. this.handleFooterActionsSlotChange = (event) => {
  185. const elements = event.target.assignedElements({
  186. flatten: true
  187. });
  188. this.hasFooterActions = !!elements.length;
  189. };
  190. this.handleFabSlotChange = (event) => {
  191. const elements = event.target.assignedElements({
  192. flatten: true
  193. });
  194. this.hasFab = !!elements.length;
  195. };
  196. this.setPanelScrollEl = (el) => {
  197. var _a, _b;
  198. this.panelScrollEl = el;
  199. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  200. if (el) {
  201. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.observe(el);
  202. this.resizeHandler();
  203. }
  204. };
  205. }
  206. dismissedHandler(value) {
  207. this.closed = value;
  208. this.calcitePanelDismissedChange.emit();
  209. }
  210. closedHandler(value) {
  211. this.dismissed = value;
  212. }
  213. dismissibleHandler(value) {
  214. this.closable = value;
  215. }
  216. closableHandler(value) {
  217. this.dismissible = value;
  218. }
  219. //--------------------------------------------------------------------------
  220. //
  221. // Lifecycle
  222. //
  223. //--------------------------------------------------------------------------
  224. componentDidRender() {
  225. updateHostInteraction(this);
  226. }
  227. // --------------------------------------------------------------------------
  228. //
  229. // Lifecycle
  230. //
  231. // --------------------------------------------------------------------------
  232. connectedCallback() {
  233. const isClosed = this.dismissed || this.closed;
  234. const isClosable = this.dismissible || this.closable;
  235. if (isClosed) {
  236. this.dismissedHandler(isClosed);
  237. this.closedHandler(isClosed);
  238. }
  239. if (isClosable) {
  240. this.dismissibleHandler(isClosable);
  241. this.closableHandler(isClosable);
  242. }
  243. }
  244. disconnectedCallback() {
  245. var _a;
  246. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  247. }
  248. // --------------------------------------------------------------------------
  249. //
  250. // Methods
  251. //
  252. // --------------------------------------------------------------------------
  253. /**
  254. * Sets focus on the component.
  255. *
  256. * @param focusId
  257. */
  258. async setFocus(focusId) {
  259. const { backButtonEl, closeButtonEl, containerEl } = this;
  260. if (focusId === "back-button") {
  261. backButtonEl === null || backButtonEl === void 0 ? void 0 : backButtonEl.setFocus();
  262. return;
  263. }
  264. if (focusId === "dismiss-button") {
  265. closeButtonEl === null || closeButtonEl === void 0 ? void 0 : closeButtonEl.setFocus();
  266. return;
  267. }
  268. if (backButtonEl) {
  269. backButtonEl.setFocus();
  270. return;
  271. }
  272. if (closeButtonEl) {
  273. closeButtonEl.setFocus();
  274. return;
  275. }
  276. containerEl === null || containerEl === void 0 ? void 0 : containerEl.focus();
  277. }
  278. /**
  279. * Scrolls the component's content to a specified set of coordinates.
  280. *
  281. * @example
  282. * myCalciteFlowItem.scrollContentTo({
  283. * left: 0, // Specifies the number of pixels along the X axis to scroll the window or element.
  284. * top: 0, // Specifies the number of pixels along the Y axis to scroll the window or element
  285. * behavior: "auto" // Specifies whether the scrolling should animate smoothly (smooth), or happen instantly in a single jump (auto, the default value).
  286. * });
  287. * @param options
  288. */
  289. async scrollContentTo(options) {
  290. var _a;
  291. (_a = this.panelScrollEl) === null || _a === void 0 ? void 0 : _a.scrollTo(options);
  292. }
  293. // --------------------------------------------------------------------------
  294. //
  295. // Render Methods
  296. //
  297. // --------------------------------------------------------------------------
  298. renderBackButton() {
  299. const { el } = this;
  300. const rtl = getElementDir(el) === "rtl";
  301. const { showBackButton, intlBack, backButtonClick } = this;
  302. const label = intlBack || TEXT.back;
  303. const icon = rtl ? ICONS.backRight : ICONS.backLeft;
  304. 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;
  305. }
  306. renderHeaderContent() {
  307. const { heading, headingLevel, summary, description, hasHeaderContent } = this;
  308. const headingNode = heading ? (h(Heading, { class: CSS.heading, level: headingLevel || HEADING_LEVEL }, heading)) : null;
  309. const descriptionNode = description || summary ? h("span", { class: CSS.description }, description || summary) : null;
  310. return !hasHeaderContent && (headingNode || descriptionNode) ? (h("div", { class: CSS.headerContent, key: "header-content" }, headingNode, descriptionNode)) : null;
  311. }
  312. /**
  313. * Allows user to override the entire header-content node.
  314. */
  315. renderHeaderSlottedContent() {
  316. return (h("div", { class: CSS.headerContent, hidden: !this.hasHeaderContent, key: "slotted-header-content" }, h("slot", { name: SLOTS.headerContent, onSlotchange: this.handleHeaderContentSlotChange })));
  317. }
  318. renderHeaderStartActions() {
  319. const { hasStartActions } = this;
  320. return (h("div", { class: { [CSS.headerActionsStart]: true, [CSS.headerActions]: true }, hidden: !hasStartActions, key: "header-actions-start" }, h("slot", { name: SLOTS.headerActionsStart, onSlotchange: this.handleHeaderActionsStartSlotChange })));
  321. }
  322. renderHeaderActionsEnd() {
  323. const { close, hasEndActions, intlClose, closable } = this;
  324. const text = intlClose || TEXT.close;
  325. const closableNode = closable ? (h("calcite-action", { "aria-label": text, icon: ICONS.close, onClick: close, ref: this.setCloseRef, text: text })) : null;
  326. const slotNode = (h("slot", { name: SLOTS.headerActionsEnd, onSlotchange: this.handleHeaderActionsEndSlotChange }));
  327. const showContainer = hasEndActions || closableNode;
  328. return (h("div", { class: { [CSS.headerActionsEnd]: true, [CSS.headerActions]: true }, hidden: !showContainer, key: "header-actions-end" }, slotNode, closableNode));
  329. }
  330. renderMenu() {
  331. const { hasMenuItems, intlOptions, menuOpen } = this;
  332. return (h("calcite-action-menu", { flipPlacements: ["top", "bottom"], hidden: !hasMenuItems, 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, onSlotchange: this.handleHeaderMenuActionsSlotChange })));
  333. }
  334. renderHeaderNode() {
  335. const { showBackButton, hasHeaderContent, hasStartActions, hasEndActions, closable, hasMenuItems } = this;
  336. const headerContentNode = this.renderHeaderContent();
  337. const showHeader = showBackButton ||
  338. hasHeaderContent ||
  339. headerContentNode ||
  340. hasStartActions ||
  341. hasEndActions ||
  342. closable ||
  343. hasMenuItems;
  344. return (h("header", { class: CSS.header, hidden: !showHeader }, this.renderBackButton(), this.renderHeaderStartActions(), this.renderHeaderSlottedContent(), headerContentNode, this.renderHeaderActionsEnd(), this.renderMenu()));
  345. }
  346. renderFooterNode() {
  347. const { hasFooterContent, hasFooterActions } = this;
  348. const showFooter = hasFooterContent || hasFooterActions;
  349. return (h("footer", { class: CSS.footer, hidden: !showFooter }, h("slot", { key: "footer-slot", name: SLOTS.footer, onSlotchange: this.handleFooterSlotChange }), h("slot", { key: "footer-actions-slot", name: SLOTS.footerActions, onSlotchange: this.handleFooterActionsSlotChange })));
  350. }
  351. renderContent() {
  352. const { hasFab } = this;
  353. const defaultSlotNode = h("slot", { key: "default-slot" });
  354. const containerNode = hasFab ? (h("section", { class: CSS.contentContainer }, defaultSlotNode)) : (defaultSlotNode);
  355. return (h("div", { class: {
  356. [CSS.contentWrapper]: true,
  357. [CSS.contentContainer]: !hasFab,
  358. [CSS.contentHeight]: hasFab
  359. }, onScroll: this.panelScrollHandler, ref: this.setPanelScrollEl }, containerNode, this.renderFab()));
  360. }
  361. renderFab() {
  362. return (h("div", { class: CSS.fabContainer, hidden: !this.hasFab }, h("slot", { name: SLOTS.fab, onSlotchange: this.handleFabSlotChange })));
  363. }
  364. render() {
  365. const { loading, panelKeyDownHandler, closed, closable } = this;
  366. const panelNode = (h("article", { "aria-busy": toAriaBoolean(loading), class: CSS.container, hidden: closed, onKeyDown: panelKeyDownHandler, ref: this.setContainerRef, tabIndex: closable ? 0 : -1 }, this.renderHeaderNode(), this.renderContent(), this.renderFooterNode()));
  367. return (h(Fragment, null, loading ? h("calcite-scrim", { loading: loading }) : null, panelNode));
  368. }
  369. get el() { return this; }
  370. static get watchers() { return {
  371. "dismissed": ["dismissedHandler"],
  372. "closed": ["closedHandler"],
  373. "dismissible": ["dismissibleHandler"],
  374. "closable": ["closableHandler"]
  375. }; }
  376. static get style() { return panelCss; }
  377. }, [1, "calcite-panel", {
  378. "dismissed": [1540],
  379. "closed": [1540],
  380. "beforeBack": [16],
  381. "disabled": [516],
  382. "dismissible": [1540],
  383. "closable": [1540],
  384. "headingLevel": [514, "heading-level"],
  385. "showBackButton": [516, "show-back-button"],
  386. "intlBack": [1, "intl-back"],
  387. "heightScale": [513, "height-scale"],
  388. "widthScale": [513, "width-scale"],
  389. "loading": [516],
  390. "intlClose": [1, "intl-close"],
  391. "intlOptions": [1, "intl-options"],
  392. "heading": [1],
  393. "summary": [1],
  394. "description": [1],
  395. "menuOpen": [516, "menu-open"],
  396. "hasStartActions": [32],
  397. "hasEndActions": [32],
  398. "hasMenuItems": [32],
  399. "hasHeaderContent": [32],
  400. "hasFooterContent": [32],
  401. "hasFooterActions": [32],
  402. "hasFab": [32],
  403. "setFocus": [64],
  404. "scrollContentTo": [64]
  405. }]);
  406. function defineCustomElement() {
  407. if (typeof customElements === "undefined") {
  408. return;
  409. }
  410. const components = ["calcite-panel", "calcite-action", "calcite-action-menu", "calcite-icon", "calcite-loader", "calcite-popover", "calcite-scrim"];
  411. components.forEach(tagName => { switch (tagName) {
  412. case "calcite-panel":
  413. if (!customElements.get(tagName)) {
  414. customElements.define(tagName, Panel);
  415. }
  416. break;
  417. case "calcite-action":
  418. if (!customElements.get(tagName)) {
  419. defineCustomElement$6();
  420. }
  421. break;
  422. case "calcite-action-menu":
  423. if (!customElements.get(tagName)) {
  424. defineCustomElement$5();
  425. }
  426. break;
  427. case "calcite-icon":
  428. if (!customElements.get(tagName)) {
  429. defineCustomElement$4();
  430. }
  431. break;
  432. case "calcite-loader":
  433. if (!customElements.get(tagName)) {
  434. defineCustomElement$3();
  435. }
  436. break;
  437. case "calcite-popover":
  438. if (!customElements.get(tagName)) {
  439. defineCustomElement$2();
  440. }
  441. break;
  442. case "calcite-scrim":
  443. if (!customElements.get(tagName)) {
  444. defineCustomElement$1();
  445. }
  446. break;
  447. } });
  448. }
  449. defineCustomElement();
  450. export { Panel as P, SLOTS as S, defineCustomElement as d };