calcite-shell-center-row.js 5.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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, h, Fragment } from '@stencil/core/internal/client/index.js';
  7. import { b as getSlotted } from './dom.js';
  8. import { c as connectConditionalSlotComponent, d as disconnectConditionalSlotComponent } from './conditionalSlot.js';
  9. const CSS = {
  10. actionBarContainer: "action-bar-container",
  11. content: "content"
  12. };
  13. const SLOTS = {
  14. actionBar: "action-bar"
  15. };
  16. const shellCenterRowCss = "@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{display:flex;flex:1 1 auto;overflow:hidden;background-color:transparent}.content{margin:0px;display:flex;block-size:100%;inline-size:100%;overflow:hidden;flex:1 0 0}.action-bar-container{display:flex}:host([detached]){margin-inline:0.5rem;margin-block:0.5rem 1.5rem}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}:host([detached]){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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host([position=end]){align-self:flex-end}:host([position=start]){align-self:flex-start}:host([height-scale=s]){block-size:33.333333%}:host([height-scale=m]){block-size:70%}:host([height-scale=l]){block-size:100%}:host([height-scale=l][detached]){block-size:calc(100% - 2rem)}::slotted(calcite-panel){block-size:100%;inline-size:100%}::slotted(calcite-action-bar),::slotted(calcite-action-bar[position=end]){border-inline-end:1px solid;border-color:var(--calcite-ui-border-3)}";
  17. const ShellCenterRow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  18. constructor() {
  19. super();
  20. this.__registerHost();
  21. this.__attachShadow();
  22. // --------------------------------------------------------------------------
  23. //
  24. // Properties
  25. //
  26. // --------------------------------------------------------------------------
  27. /**
  28. * When `true`, the content area displays like a floating panel.
  29. */
  30. this.detached = false;
  31. /**
  32. * Specifies the maximum height of the component.
  33. */
  34. this.heightScale = "s";
  35. /**
  36. * Specifies the component's position. Will be flipped when the element direction is right-to-left (`"rtl"`).
  37. */
  38. this.position = "end";
  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. render() {
  57. const { el } = this;
  58. const contentNode = (h("div", { class: CSS.content }, h("slot", null)));
  59. const actionBar = getSlotted(el, SLOTS.actionBar);
  60. const actionBarNode = actionBar ? (h("div", { class: CSS.actionBarContainer, key: "action-bar" }, h("slot", { name: SLOTS.actionBar }))) : null;
  61. const children = [actionBarNode, contentNode];
  62. if ((actionBar === null || actionBar === void 0 ? void 0 : actionBar.position) === "end") {
  63. children.reverse();
  64. }
  65. return h(Fragment, null, children);
  66. }
  67. get el() { return this; }
  68. static get style() { return shellCenterRowCss; }
  69. }, [1, "calcite-shell-center-row", {
  70. "detached": [516],
  71. "heightScale": [513, "height-scale"],
  72. "position": [513]
  73. }]);
  74. function defineCustomElement$1() {
  75. if (typeof customElements === "undefined") {
  76. return;
  77. }
  78. const components = ["calcite-shell-center-row"];
  79. components.forEach(tagName => { switch (tagName) {
  80. case "calcite-shell-center-row":
  81. if (!customElements.get(tagName)) {
  82. customElements.define(tagName, ShellCenterRow);
  83. }
  84. break;
  85. } });
  86. }
  87. defineCustomElement$1();
  88. const CalciteShellCenterRow = ShellCenterRow;
  89. const defineCustomElement = defineCustomElement$1;
  90. export { CalciteShellCenterRow, defineCustomElement };