calcite-shell_3.cjs.entry.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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. 'use strict';
  7. Object.defineProperty(exports, '__esModule', { value: true });
  8. const index = require('./index-5c65e149.js');
  9. const dom = require('./dom-9ac0341c.js');
  10. const conditionalSlot = require('./conditionalSlot-ba5cd797.js');
  11. const math = require('./math-9d6de52c.js');
  12. require('./guid-8b6d6cb4.js');
  13. require('./observers-d9fdf006.js');
  14. const CSS$2 = {
  15. main: "main",
  16. mainReversed: "main--reversed",
  17. content: "content",
  18. contentBehind: "content--behind",
  19. footer: "footer"
  20. };
  21. const SLOTS$2 = {
  22. centerRow: "center-row",
  23. primaryPanel: "primary-panel",
  24. contextualPanel: "contextual-panel",
  25. header: "header",
  26. footer: "footer"
  27. };
  28. const shellCss = "@-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:absolute;top:0px;right:0px;bottom:0px;left:0px;display:-ms-flexbox;display:flex;height:100%;width:100%;-ms-flex-direction:column;flex-direction:column;overflow:hidden;--calcite-shell-tip-spacing:26vw}.main{position:relative;display:-ms-flexbox;display:flex;height:100%;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between;overflow:hidden}.main--reversed{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.content{display:-ms-flexbox;display:flex;height:100%;width:100%;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;overflow:auto}.content ::slotted(calcite-shell-center-row),.content ::slotted(calcite-panel),.content ::slotted(calcite-flow){-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-item-align:stretch;align-self:stretch;max-height:unset}.content--behind{position:absolute;top:0px;right:0px;bottom:0px;left:0px;z-index:0;border-width:0px;display:initial}::slotted(calcite-shell-center-row){width:unset}::slotted(.header .heading){font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-normal)}::slotted(calcite-shell-panel),::slotted(calcite-shell-center-row){position:relative;z-index:1}::slotted(calcite-panel),::slotted(calcite-flow){border-width:1px;border-left-width:0px;border-right-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3)}slot[name=center-row]::slotted(calcite-shell-center-row:not([detached])){border-left-width:1px;border-right-width:1px;border-color:var(--calcite-ui-border-3)}::slotted(calcite-tip-manager){position:absolute;-webkit-box-sizing:border-box;box-sizing:border-box}@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)}}::slotted(calcite-tip-manager){-webkit-animation:in-up var(--calcite-internal-animation-timing-slow) ease-in-out;animation:in-up var(--calcite-internal-animation-timing-slow) ease-in-out;border-radius:0.25rem;--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);bottom:0.5rem;left:var(--calcite-shell-tip-spacing);right:var(--calcite-shell-tip-spacing);z-index:2}";
  29. const Shell = class {
  30. constructor(hostRef) {
  31. index.registerInstance(this, hostRef);
  32. // --------------------------------------------------------------------------
  33. //
  34. // Properties
  35. //
  36. // --------------------------------------------------------------------------
  37. /**
  38. * Positions the center content behind any calcite-shell-panels.
  39. */
  40. this.contentBehind = false;
  41. }
  42. // --------------------------------------------------------------------------
  43. //
  44. // Lifecycle
  45. //
  46. // --------------------------------------------------------------------------
  47. connectedCallback() {
  48. conditionalSlot.connectConditionalSlotComponent(this);
  49. }
  50. disconnectedCallback() {
  51. conditionalSlot.disconnectConditionalSlotComponent(this);
  52. }
  53. // --------------------------------------------------------------------------
  54. //
  55. // Render Methods
  56. //
  57. // --------------------------------------------------------------------------
  58. renderHeader() {
  59. const hasHeader = !!dom.getSlotted(this.el, SLOTS$2.header);
  60. return hasHeader ? index.h("slot", { key: "header", name: SLOTS$2.header }) : null;
  61. }
  62. renderContent() {
  63. const defaultSlotNode = index.h("slot", { key: "default-slot" });
  64. const centerRowSlotNode = index.h("slot", { key: "center-row-slot", name: SLOTS$2.centerRow });
  65. const contentContainerKey = "content-container";
  66. const content = !!this.contentBehind
  67. ? [
  68. index.h("div", { class: {
  69. [CSS$2.content]: true,
  70. [CSS$2.contentBehind]: true
  71. }, key: contentContainerKey }, defaultSlotNode),
  72. centerRowSlotNode
  73. ]
  74. : [
  75. index.h("div", { class: CSS$2.content, key: contentContainerKey }, defaultSlotNode, centerRowSlotNode)
  76. ];
  77. return content;
  78. }
  79. renderFooter() {
  80. const hasFooter = !!dom.getSlotted(this.el, SLOTS$2.footer);
  81. return hasFooter ? (index.h("div", { class: CSS$2.footer, key: "footer" }, index.h("slot", { name: SLOTS$2.footer }))) : null;
  82. }
  83. renderMain() {
  84. const primaryPanel = dom.getSlotted(this.el, SLOTS$2.primaryPanel);
  85. const mainClasses = {
  86. [CSS$2.main]: true,
  87. [CSS$2.mainReversed]: (primaryPanel === null || primaryPanel === void 0 ? void 0 : primaryPanel.position) === "end"
  88. };
  89. return (index.h("div", { class: mainClasses }, index.h("slot", { name: SLOTS$2.primaryPanel }), this.renderContent(), index.h("slot", { name: SLOTS$2.contextualPanel })));
  90. }
  91. render() {
  92. return (index.h(index.Fragment, null, this.renderHeader(), this.renderMain(), this.renderFooter()));
  93. }
  94. get el() { return index.getElement(this); }
  95. };
  96. Shell.style = shellCss;
  97. const CSS$1 = {
  98. actionBarContainer: "action-bar-container",
  99. content: "content"
  100. };
  101. const SLOTS$1 = {
  102. actionBar: "action-bar"
  103. };
  104. const shellCenterRowCss = "@-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{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;overflow:hidden;background-color:transparent}.content{margin:0px;display:-ms-flexbox;display:flex;height:100%;width:100%;overflow:hidden;-ms-flex:1 0 0px;flex:1 0 0}.action-bar-container{display:-ms-flexbox;display:flex}:host([detached]){margin-left:0.5rem;margin-right:0.5rem;margin-top:0.5rem;margin-bottom:1.5rem}@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)}}:host([detached]){-webkit-animation:in-up var(--calcite-internal-animation-timing-slow) ease-in-out;animation:in-up var(--calcite-internal-animation-timing-slow) ease-in-out;border-radius:0.25rem;border-width:0px;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px 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)}:host([position=end]){-ms-flex-item-align:end;align-self:flex-end}:host([position=start]){-ms-flex-item-align:start;align-self:flex-start}:host([height-scale=s]){height:33.333333%}:host([height-scale=m]){height:70%}:host([height-scale=l]){height:100%}:host([height-scale=l][detached]){height:calc(100% - 2rem)}::slotted(calcite-panel){height:100%;width:100%}::slotted(calcite-action-bar),::slotted(calcite-action-bar[position=end]){-webkit-border-end:1px solid;border-inline-end:1px solid;border-color:var(--calcite-ui-border-3)}";
  105. const ShellCenterRow = class {
  106. constructor(hostRef) {
  107. index.registerInstance(this, hostRef);
  108. // --------------------------------------------------------------------------
  109. //
  110. // Properties
  111. //
  112. // --------------------------------------------------------------------------
  113. /**
  114. * This property makes the content area appear like a "floating" panel.
  115. */
  116. this.detached = false;
  117. /**
  118. * Specifies the maximum height of the row.
  119. */
  120. this.heightScale = "s";
  121. /**
  122. * Arranges the component depending on the elements 'dir' property.
  123. */
  124. this.position = "end";
  125. }
  126. // --------------------------------------------------------------------------
  127. //
  128. // Lifecycle
  129. //
  130. // --------------------------------------------------------------------------
  131. connectedCallback() {
  132. conditionalSlot.connectConditionalSlotComponent(this);
  133. }
  134. disconnectedCallback() {
  135. conditionalSlot.disconnectConditionalSlotComponent(this);
  136. }
  137. // --------------------------------------------------------------------------
  138. //
  139. // Render Methods
  140. //
  141. // --------------------------------------------------------------------------
  142. render() {
  143. const { el } = this;
  144. const contentNode = (index.h("div", { class: CSS$1.content }, index.h("slot", null)));
  145. const actionBar = dom.getSlotted(el, SLOTS$1.actionBar);
  146. const actionBarNode = actionBar ? (index.h("div", { class: CSS$1.actionBarContainer, key: "action-bar" }, index.h("slot", { name: SLOTS$1.actionBar }))) : null;
  147. const children = [actionBarNode, contentNode];
  148. if ((actionBar === null || actionBar === void 0 ? void 0 : actionBar.position) === "end") {
  149. children.reverse();
  150. }
  151. return index.h(index.Fragment, null, children);
  152. }
  153. get el() { return index.getElement(this); }
  154. };
  155. ShellCenterRow.style = shellCenterRowCss;
  156. const CSS = {
  157. container: "container",
  158. content: "content",
  159. contentHeader: "content__header",
  160. contentBody: "content__body",
  161. contentDetached: "content--detached",
  162. separator: "separator"
  163. };
  164. const SLOTS = {
  165. actionBar: "action-bar",
  166. header: "header"
  167. };
  168. const TEXT = {
  169. resize: "Resize"
  170. };
  171. const shellPanelCss = "@-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{pointer-events:none;display:-ms-flexbox;display:flex;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-align:stretch;align-items:stretch;--calcite-shell-panel-detached-max-height:unset}.container{pointer-events:none;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-align:stretch;align-items:stretch;background-color:transparent;font-size:var(--calcite-font-size--1);color:var(--calcite-ui-text-2)}.container *{-webkit-box-sizing:border-box;box-sizing:border-box}:host(:hover) .separator:not(:hover):not(:focus),:host(:focus-within) .separator:not(:hover):not(:focus){opacity:1;background-color:var(--calcite-ui-border-3)}.separator{pointer-events:auto;position:absolute;bottom:0px;top:0px;z-index:10;display:-ms-flexbox;display:flex;height:100%;width:0.125rem;background-color:transparent;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;cursor:col-resize;outline:none}.separator:hover{opacity:1;background-color:var(--calcite-ui-border-2)}.separator:focus{background-color:var(--calcite-ui-brand);opacity:1}:host([position=start]) .separator{inset-inline-end:-2px}:host([position=end]) .separator{inset-inline-start:-2px}::slotted(calcite-panel),::slotted(calcite-flow){height:100%;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;max-height:unset;max-width:unset}::slotted(.calcite-match-height){display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;overflow:hidden}.content{pointer-events:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:stretch;align-items:stretch;-ms-flex-item-align:stretch;align-self:stretch;background-color:var(--calcite-ui-background);padding:0px;width:var(--calcite-shell-panel-width);max-width:var(--calcite-shell-panel-max-width);min-width:var(--calcite-shell-panel-min-width);-webkit-transition:max-height var(--calcite-animation-timing), max-width var(--calcite-animation-timing);transition:max-height var(--calcite-animation-timing), max-width var(--calcite-animation-timing)}.content__header{display:-ms-flexbox;display:flex;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:stretch;align-items:stretch}.content__body{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;overflow:hidden}:host([width-scale=s]) .content{--calcite-shell-panel-width:calc(var(--calcite-panel-width-multiplier) * 12vw);--calcite-shell-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 300px);--calcite-shell-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 150px)}:host([width-scale=m]) .content{--calcite-shell-panel-width:calc(var(--calcite-panel-width-multiplier) * 20vw);--calcite-shell-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 420px);--calcite-shell-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 240px)}:host([width-scale=l]) .content{--calcite-shell-panel-width:calc(var(--calcite-panel-width-multiplier) * 45vw);--calcite-shell-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 680px);--calcite-shell-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 340px)}:host([detached-height-scale=s]) .content--detached{--calcite-shell-panel-detached-max-height:40vh}:host([detached-height-scale=m]) .content--detached{--calcite-shell-panel-detached-max-height:60vh}:host([detached-height-scale=l]) .content--detached{--calcite-shell-panel-detached-max-height:80vh}.content--detached{margin-left:0.5rem;margin-right:0.5rem;margin-top:0.5rem;margin-bottom:auto;height:auto;overflow:hidden;border-radius:0.25rem;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px 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);max-height:var(--calcite-shell-panel-detached-max-height)}.content--detached ::slotted(calcite-panel),.content--detached ::slotted(calcite-flow){max-height:unset}:host([position=start]) .content--detached ::slotted(calcite-panel),:host([position=start]) .content--detached ::slotted(calcite-flow),:host([position=end]) .content--detached ::slotted(calcite-panel),:host([position=end]) .content--detached ::slotted(calcite-flow){border-style:none}.content[hidden]{display:none}slot[name=action-bar]::slotted(calcite-action-bar),.content ::slotted(calcite-flow),.content ::slotted(calcite-panel:not([dismissed])){border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}:host([position=start]) slot[name=action-bar]::slotted(calcite-action-bar),:host([position=start]) .content ::slotted(calcite-flow),:host([position=start]) .content ::slotted(calcite-panel){-webkit-border-start:none;border-inline-start:none}:host([position=end]) slot[name=action-bar]::slotted(calcite-action-bar),:host([position=end]) .content ::slotted(calcite-flow),:host([position=end]) .content ::slotted(calcite-panel){-webkit-border-end:none;border-inline-end:none}";
  172. const ShellPanel = class {
  173. constructor(hostRef) {
  174. index.registerInstance(this, hostRef);
  175. this.calciteShellPanelToggle = index.createEvent(this, "calciteShellPanelToggle", 7);
  176. // --------------------------------------------------------------------------
  177. //
  178. // Properties
  179. //
  180. // --------------------------------------------------------------------------
  181. /**
  182. * Hide the content panel.
  183. */
  184. this.collapsed = false;
  185. /**
  186. * This property makes the content area appear like a "floating" panel.
  187. */
  188. this.detached = false;
  189. /**
  190. * Specifies the maximum height of the contents when detached.
  191. */
  192. this.detachedHeightScale = "l";
  193. /**
  194. * This sets width of the content area.
  195. */
  196. this.widthScale = "m";
  197. /**
  198. * Accessible label for resize separator.
  199. * @default "Resize"
  200. */
  201. this.intlResize = TEXT.resize;
  202. /**
  203. * This property makes the content area resizable if the calcite-shell-panel is not 'detached'.
  204. */
  205. this.resizable = false;
  206. this.contentWidth = null;
  207. this.initialContentWidth = null;
  208. this.initialClientX = null;
  209. this.contentWidthMax = null;
  210. this.contentWidthMin = null;
  211. this.step = 1;
  212. this.stepMultiplier = 10;
  213. this.storeContentEl = (contentEl) => {
  214. this.contentEl = contentEl;
  215. };
  216. this.getKeyAdjustedWidth = (event) => {
  217. const { key } = event;
  218. const { el, step, stepMultiplier, contentWidthMin, contentWidthMax, initialContentWidth, position } = this;
  219. const multipliedStep = step * stepMultiplier;
  220. const MOVEMENT_KEYS = [
  221. "ArrowUp",
  222. "ArrowDown",
  223. "ArrowLeft",
  224. "ArrowRight",
  225. "Home",
  226. "End",
  227. "PageUp",
  228. "PageDown"
  229. ];
  230. if (MOVEMENT_KEYS.indexOf(key) > -1) {
  231. event.preventDefault();
  232. }
  233. const dir = dom.getElementDir(el);
  234. const directionKeys = ["ArrowLeft", "ArrowRight"];
  235. const directionFactor = dir === "rtl" && directionKeys.includes(key) ? -1 : 1;
  236. const increaseKeys = key === "ArrowUp" ||
  237. (position === "end" ? key === directionKeys[0] : key === directionKeys[1]);
  238. if (increaseKeys) {
  239. const stepValue = event.shiftKey ? multipliedStep : step;
  240. return initialContentWidth + directionFactor * stepValue;
  241. }
  242. const decreaseKeys = key === "ArrowDown" ||
  243. (position === "end" ? key === directionKeys[1] : key === directionKeys[0]);
  244. if (decreaseKeys) {
  245. const stepValue = event.shiftKey ? multipliedStep : step;
  246. return initialContentWidth - directionFactor * stepValue;
  247. }
  248. if (typeof contentWidthMin === "number" && key === "Home") {
  249. return contentWidthMin;
  250. }
  251. if (typeof contentWidthMax === "number" && key === "End") {
  252. return contentWidthMax;
  253. }
  254. if (key === "PageDown") {
  255. return initialContentWidth - multipliedStep;
  256. }
  257. if (key === "PageUp") {
  258. return initialContentWidth + multipliedStep;
  259. }
  260. return null;
  261. };
  262. this.separatorKeyDown = (event) => {
  263. this.setInitialContentWidth();
  264. const width = this.getKeyAdjustedWidth(event);
  265. if (typeof width === "number") {
  266. this.setContentWidth(width);
  267. }
  268. };
  269. this.separatorPointerMove = (event) => {
  270. event.preventDefault();
  271. const { el, initialContentWidth, position, initialClientX } = this;
  272. const offset = event.clientX - initialClientX;
  273. const dir = dom.getElementDir(el);
  274. const adjustmentDirection = dir === "rtl" ? -1 : 1;
  275. const adjustedOffset = position === "end" ? -adjustmentDirection * offset : adjustmentDirection * offset;
  276. const width = initialContentWidth + adjustedOffset;
  277. this.setContentWidth(width);
  278. };
  279. this.separatorPointerUp = (event) => {
  280. event.preventDefault();
  281. document.removeEventListener("pointerup", this.separatorPointerUp);
  282. document.removeEventListener("pointermove", this.separatorPointerMove);
  283. };
  284. this.setInitialContentWidth = () => {
  285. var _a;
  286. this.initialContentWidth = (_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
  287. };
  288. this.separatorPointerDown = (event) => {
  289. event.preventDefault();
  290. const { separatorEl } = this;
  291. separatorEl && document.activeElement !== separatorEl && separatorEl.focus();
  292. this.setInitialContentWidth();
  293. this.initialClientX = event.clientX;
  294. document.addEventListener("pointerup", this.separatorPointerUp);
  295. document.addEventListener("pointermove", this.separatorPointerMove);
  296. };
  297. this.connectSeparator = (separatorEl) => {
  298. this.disconnectSeparator();
  299. this.separatorEl = separatorEl;
  300. separatorEl.addEventListener("pointerdown", this.separatorPointerDown);
  301. };
  302. this.disconnectSeparator = () => {
  303. var _a;
  304. (_a = this.separatorEl) === null || _a === void 0 ? void 0 : _a.removeEventListener("pointerdown", this.separatorPointerDown);
  305. };
  306. }
  307. watchHandler() {
  308. this.calciteShellPanelToggle.emit();
  309. }
  310. //--------------------------------------------------------------------------
  311. //
  312. // Lifecycle
  313. //
  314. //--------------------------------------------------------------------------
  315. connectedCallback() {
  316. conditionalSlot.connectConditionalSlotComponent(this);
  317. }
  318. disconnectedCallback() {
  319. conditionalSlot.disconnectConditionalSlotComponent(this);
  320. this.disconnectSeparator();
  321. }
  322. componentDidLoad() {
  323. this.updateAriaValues();
  324. }
  325. // --------------------------------------------------------------------------
  326. //
  327. // Render Methods
  328. //
  329. // --------------------------------------------------------------------------
  330. renderHeader() {
  331. const { el } = this;
  332. const hasHeader = dom.getSlotted(el, SLOTS.header);
  333. return hasHeader ? (index.h("div", { class: CSS.contentHeader, key: "header" }, index.h("slot", { name: SLOTS.header }))) : null;
  334. }
  335. render() {
  336. const { collapsed, detached, position, initialContentWidth, contentWidth, contentWidthMax, contentWidthMin, intlResize, resizable } = this;
  337. const allowResizing = !detached && resizable;
  338. const contentNode = (index.h("div", { class: { [CSS.content]: true, [CSS.contentDetached]: detached }, hidden: collapsed, key: "content", ref: this.storeContentEl, style: allowResizing && contentWidth ? { width: `${contentWidth}px` } : null }, this.renderHeader(), index.h("div", { class: CSS.contentBody }, index.h("slot", null))));
  339. const separatorNode = allowResizing ? (index.h("div", { "aria-label": intlResize, "aria-orientation": "horizontal", "aria-valuemax": contentWidthMax, "aria-valuemin": contentWidthMin, "aria-valuenow": contentWidth !== null && contentWidth !== void 0 ? contentWidth : initialContentWidth, class: CSS.separator, key: "separator", onKeyDown: this.separatorKeyDown, ref: this.connectSeparator, role: "separator", tabIndex: 0, "touch-action": "none" })) : null;
  340. const actionBarNode = index.h("slot", { key: "action-bar", name: SLOTS.actionBar });
  341. const mainNodes = [actionBarNode, contentNode, separatorNode];
  342. if (position === "end") {
  343. mainNodes.reverse();
  344. }
  345. return index.h("div", { class: { [CSS.container]: true } }, mainNodes);
  346. }
  347. // --------------------------------------------------------------------------
  348. //
  349. // private Methods
  350. //
  351. // --------------------------------------------------------------------------
  352. setContentWidth(width) {
  353. const { contentWidthMax, contentWidthMin } = this;
  354. const roundedWidth = Math.round(width);
  355. this.contentWidth =
  356. typeof contentWidthMax === "number" && typeof contentWidthMin === "number"
  357. ? math.clamp(roundedWidth, contentWidthMin, contentWidthMax)
  358. : roundedWidth;
  359. }
  360. updateAriaValues() {
  361. const { contentEl } = this;
  362. const computedStyle = contentEl && getComputedStyle(contentEl);
  363. if (!computedStyle) {
  364. return;
  365. }
  366. const max = parseInt(computedStyle.getPropertyValue("max-width"), 10);
  367. const min = parseInt(computedStyle.getPropertyValue("min-width"), 10);
  368. const valueNow = parseInt(computedStyle.getPropertyValue("width"), 10);
  369. if (typeof valueNow === "number" && !isNaN(valueNow)) {
  370. this.initialContentWidth = valueNow;
  371. }
  372. if (typeof max === "number" && !isNaN(max)) {
  373. this.contentWidthMax = max;
  374. }
  375. if (typeof min === "number" && !isNaN(min)) {
  376. this.contentWidthMin = min;
  377. }
  378. index.forceUpdate(this);
  379. }
  380. get el() { return index.getElement(this); }
  381. static get watchers() { return {
  382. "collapsed": ["watchHandler"]
  383. }; }
  384. };
  385. ShellPanel.style = shellPanelCss;
  386. exports.calcite_shell = Shell;
  387. exports.calcite_shell_center_row = ShellCenterRow;
  388. exports.calcite_shell_panel = ShellPanel;