label2.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
  7. import { l as labelConnectedEvent, a as labelDisconnectedEvent } from './label.js';
  8. const CSS = {
  9. container: "container"
  10. };
  11. const labelCss = "@-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{display:inline}:host([alignment=start]){text-align:start}:host([alignment=end]){text-align:end}:host([alignment=center]){text-align:center}:host([scale=s]) .container{margin-bottom:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=m]) .container{margin-bottom:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=l]) .container{margin-bottom:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}:host .container{margin-top:0px;margin-right:0px;margin-left:0px;width:100%;line-height:1.375;color:var(--calcite-ui-text-1)}:host([layout=default]) .container{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:0.25rem}:host([layout=inline]) .container,:host([layout=inline-space-between]) .container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;gap:0.5rem}:host([layout=inline][scale=l]) .container{gap:0.75rem}:host([layout=inline-space-between]) .container{-ms-flex-pack:justify;justify-content:space-between}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled])>.container{pointer-events:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) ::slotted(*){pointer-events:none}:host([disabled]) ::slotted(*[disabled]),:host([disabled]) ::slotted(*[disabled] *){--tw-bg-opacity:1}:host([disabled]) ::slotted(calcite-input-message:not([active])){--tw-bg-opacity:0}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([disable-spacing]) .container{margin:0px;gap:0px}";
  12. const Label = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  13. constructor() {
  14. super();
  15. this.__registerHost();
  16. this.__attachShadow();
  17. this.calciteInternalLabelClick = createEvent(this, "calciteInternalLabelClick", 3);
  18. //--------------------------------------------------------------------------
  19. //
  20. // Properties
  21. //
  22. //--------------------------------------------------------------------------
  23. /** specify the text alignment of the label */
  24. this.alignment = "start";
  25. /**
  26. * specify the status of the label and any child input / input messages
  27. * @deprecated set directly on child element instead
  28. */
  29. this.status = "idle";
  30. /** specify the scale of the label, defaults to m */
  31. this.scale = "m";
  32. /** is the wrapped element positioned inline with the label slotted text */
  33. this.layout = "default";
  34. /** eliminates any space around the label */
  35. this.disableSpacing = false;
  36. /**
  37. * is the label disabled
  38. *
  39. * @deprecated use the `disabled` property on the interactive components instead
  40. */
  41. this.disabled = false;
  42. //--------------------------------------------------------------------------
  43. //
  44. // Private Methods
  45. //
  46. //--------------------------------------------------------------------------
  47. this.labelClickHandler = (event) => {
  48. this.calciteInternalLabelClick.emit({
  49. sourceEvent: event
  50. });
  51. };
  52. }
  53. //--------------------------------------------------------------------------
  54. //
  55. // Lifecycle
  56. //
  57. //--------------------------------------------------------------------------
  58. connectedCallback() {
  59. document.dispatchEvent(new CustomEvent(labelConnectedEvent));
  60. }
  61. disconnectedCallback() {
  62. document.dispatchEvent(new CustomEvent(labelDisconnectedEvent));
  63. }
  64. render() {
  65. return (h(Host, { onClick: this.labelClickHandler }, h("div", { class: CSS.container }, h("slot", null))));
  66. }
  67. get el() { return this; }
  68. static get style() { return labelCss; }
  69. }, [1, "calcite-label", {
  70. "alignment": [513],
  71. "status": [513],
  72. "for": [513],
  73. "scale": [513],
  74. "layout": [513],
  75. "disableSpacing": [4, "disable-spacing"],
  76. "disabled": [516]
  77. }]);
  78. function defineCustomElement() {
  79. if (typeof customElements === "undefined") {
  80. return;
  81. }
  82. const components = ["calcite-label"];
  83. components.forEach(tagName => { switch (tagName) {
  84. case "calcite-label":
  85. if (!customElements.get(tagName)) {
  86. customElements.define(tagName, Label);
  87. }
  88. break;
  89. } });
  90. }
  91. defineCustomElement();
  92. export { Label as L, defineCustomElement as d };