calcite-list-item-YJPNGP27.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import {
  2. updateHostInteraction
  3. } from "./chunk-4LXFBVBS.js";
  4. import {
  5. connectConditionalSlotComponent,
  6. disconnectConditionalSlotComponent
  7. } from "./chunk-2FBWETRC.js";
  8. import "./chunk-AVLPSIKF.js";
  9. import {
  10. getSlotted
  11. } from "./chunk-2TTT3V5O.js";
  12. import {
  13. H,
  14. Host,
  15. h,
  16. proxyCustomElement
  17. } from "./chunk-IOZKU7B2.js";
  18. import "./chunk-S5KM4IGW.js";
  19. // node_modules/@esri/calcite-components/dist/components/calcite-list-item.js
  20. var CSS = {
  21. container: "container",
  22. contentContainer: "content-container",
  23. nestedContainer: "nested-container",
  24. contentContainerButton: "content-container--button",
  25. content: "content",
  26. actionsStart: "actions-start",
  27. contentStart: "content-start",
  28. label: "label",
  29. description: "description",
  30. contentEnd: "content-end",
  31. actionsEnd: "actions-end",
  32. hasCenterContent: "has-center-content"
  33. };
  34. var SLOTS = {
  35. actionsStart: "actions-start",
  36. contentStart: "content-start",
  37. contentEnd: "content-end",
  38. actionsEnd: "actions-end"
  39. };
  40. var listItemCss = "@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}}: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{display:flex;flex-direction:column}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.container{box-sizing:border-box;display:flex;flex:1 1 0%;background-color:var(--calcite-ui-foreground-1);font-family:var(--calcite-sans-family)}.container *{box-sizing:border-box}.nested-container{display:flex;flex-direction:column;background-color:var(--calcite-ui-foreground-1)}.content-container{display:flex;flex:1 1 auto;align-items:stretch;padding:0px;font-family:var(--calcite-sans-family);font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);outline-color:transparent}.content-container--button{cursor:pointer;border-style:none;background-color:var(--calcite-ui-foreground-1);outline-color:transparent;text-align:initial}.content-container--button:hover{background-color:var(--calcite-ui-foreground-2)}.content-container--button:hover .label,.content-container--button:hover .description{color:var(--calcite-ui-text-1)}.content-container--button:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.content-container--button .content-start,.content-container--button .content-end{pointer-events:none}.content{display:flex;flex:1 1 auto;flex-direction:column;justify-content:center;padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--2);line-height:1.375}.label,.description{font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);word-wrap:break-word;word-break:break-word}.label:only-child,.description:only-child{margin:0px;padding-block:0.25rem}.label{color:var(--calcite-ui-text-1)}.description{margin-block-start:0.125rem;color:var(--calcite-ui-text-3)}.content-start{justify-content:flex-start}.content-end{justify-content:flex-end}.content-start,.content-end{flex:1 1 auto}.has-center-content .content-start,.has-center-content .content-end{flex:0 1 auto}.actions-start,.actions-end,.content-start,.content-end{display:flex;align-items:center}.content-start ::slotted(calcite-icon),.content-end ::slotted(calcite-icon){margin-inline:0.75rem;align-self:center}.actions-start ::slotted(calcite-action),.actions-end ::slotted(calcite-action){align-self:stretch;color:inherit}::slotted(calcite-list-item-group),::slotted(calcite-list-item){padding-inline-start:0.5rem}";
  41. var ListItem = proxyCustomElement(class extends H {
  42. constructor() {
  43. super();
  44. this.__registerHost();
  45. this.__attachShadow();
  46. this.nonInteractive = false;
  47. this.disabled = false;
  48. }
  49. componentDidRender() {
  50. updateHostInteraction(this);
  51. }
  52. connectedCallback() {
  53. connectConditionalSlotComponent(this);
  54. }
  55. disconnectedCallback() {
  56. disconnectConditionalSlotComponent(this);
  57. }
  58. async setFocus() {
  59. var _a;
  60. (_a = this.focusEl) === null || _a === void 0 ? void 0 : _a.focus();
  61. }
  62. renderActionsStart() {
  63. const { el } = this;
  64. return getSlotted(el, SLOTS.actionsStart) ? h("div", { class: CSS.actionsStart }, h("slot", { name: SLOTS.actionsStart })) : null;
  65. }
  66. renderActionsEnd() {
  67. const { el } = this;
  68. return getSlotted(el, SLOTS.actionsEnd) ? h("div", { class: CSS.actionsEnd }, h("slot", { name: SLOTS.actionsEnd })) : null;
  69. }
  70. renderContentStart() {
  71. const { el } = this;
  72. return getSlotted(el, SLOTS.contentStart) ? h("div", { class: CSS.contentStart }, h("slot", { name: SLOTS.contentStart })) : null;
  73. }
  74. renderContentEnd() {
  75. const { el } = this;
  76. return getSlotted(el, SLOTS.contentEnd) ? h("div", { class: CSS.contentEnd }, h("slot", { name: SLOTS.contentEnd })) : null;
  77. }
  78. renderContent() {
  79. const { label, description } = this;
  80. return !!label || !!description ? h("div", { class: CSS.content }, label ? h("div", { class: CSS.label }, label) : null, description ? h("div", { class: CSS.description }, description) : null) : null;
  81. }
  82. renderContentContainer() {
  83. const { description, disabled, label, nonInteractive } = this;
  84. const hasCenterContent = !!label || !!description;
  85. const content = [this.renderContentStart(), this.renderContent(), this.renderContentEnd()];
  86. return !nonInteractive ? h("button", { class: {
  87. [CSS.contentContainer]: true,
  88. [CSS.contentContainerButton]: true,
  89. [CSS.hasCenterContent]: hasCenterContent
  90. }, disabled, ref: (focusEl) => this.focusEl = focusEl }, content) : h("div", { class: { [CSS.contentContainer]: true, [CSS.hasCenterContent]: hasCenterContent }, ref: () => this.focusEl = null }, content);
  91. }
  92. render() {
  93. return h(Host, { role: "listitem" }, h("div", { class: CSS.container }, this.renderActionsStart(), this.renderContentContainer(), this.renderActionsEnd()), h("div", { class: CSS.nestedContainer }, h("slot", null)));
  94. }
  95. get el() {
  96. return this;
  97. }
  98. static get style() {
  99. return listItemCss;
  100. }
  101. }, [1, "calcite-list-item", {
  102. "nonInteractive": [516, "non-interactive"],
  103. "description": [1],
  104. "disabled": [516],
  105. "label": [1],
  106. "setFocus": [64]
  107. }]);
  108. function defineCustomElement$1() {
  109. if (typeof customElements === "undefined") {
  110. return;
  111. }
  112. const components = ["calcite-list-item"];
  113. components.forEach((tagName) => {
  114. switch (tagName) {
  115. case "calcite-list-item":
  116. if (!customElements.get(tagName)) {
  117. customElements.define(tagName, ListItem);
  118. }
  119. break;
  120. }
  121. });
  122. }
  123. defineCustomElement$1();
  124. var CalciteListItem = ListItem;
  125. var defineCustomElement = defineCustomElement$1;
  126. export {
  127. CalciteListItem,
  128. defineCustomElement
  129. };
  130. /*!
  131. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  132. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  133. * v1.0.0-beta.97
  134. */
  135. //# sourceMappingURL=calcite-list-item-YJPNGP27.js.map