calcite-shell_3.entry.js 31 KB

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