chunk.I34X2KDU.js 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import {
  2. event
  3. } from "./chunk.XX234VRK.js";
  4. import {
  5. e as e2
  6. } from "./chunk.YXKHB4AC.js";
  7. import {
  8. T,
  9. e,
  10. h,
  11. n,
  12. r
  13. } from "./chunk.5PIDMFOE.js";
  14. import {
  15. __decorateClass
  16. } from "./chunk.IHGPZX35.js";
  17. // _uyihdawu1:/Users/claviska/Projects/shoelace/src/components/tag/tag.scss
  18. var tag_default = ":host {\n position: relative;\n box-sizing: border-box;\n}\n:host *, :host *:before, :host *:after {\n box-sizing: inherit;\n}\n\n[hidden] {\n display: none !important;\n}\n\n:host {\n display: inline-block;\n}\n\n.tag {\n display: flex;\n align-items: center;\n border: solid 1px;\n line-height: 1;\n white-space: nowrap;\n user-select: none;\n cursor: default;\n}\n\n.tag__clear::part(base) {\n color: inherit;\n padding: 0;\n}\n\n.tag--primary {\n background-color: var(--sl-color-primary-100);\n border-color: var(--sl-color-primary-200);\n color: var(--sl-color-primary-700);\n}\n\n.tag--success {\n background-color: var(--sl-color-success-100);\n border-color: var(--sl-color-success-200);\n color: var(--sl-color-success-700);\n}\n\n.tag--info {\n background-color: var(--sl-color-info-100);\n border-color: var(--sl-color-info-200);\n color: var(--sl-color-info-700);\n}\n\n.tag--warning {\n background-color: var(--sl-color-warning-100);\n border-color: var(--sl-color-warning-200);\n color: var(--sl-color-warning-700);\n}\n\n.tag--danger {\n background-color: var(--sl-color-danger-100);\n border-color: var(--sl-color-danger-200);\n color: var(--sl-color-danger-700);\n}\n\n.tag--small {\n font-size: var(--sl-button-font-size-small);\n height: calc(var(--sl-input-height-small) * 0.8);\n line-height: calc(var(--sl-input-height-small) - var(--sl-input-border-width) * 2);\n border-radius: var(--sl-input-border-radius-small);\n padding: 0 var(--sl-spacing-x-small);\n}\n.tag--small .tag__clear {\n margin-left: var(--sl-spacing-xx-small);\n margin-right: calc(-1 * var(--sl-spacing-xxx-small));\n}\n\n.tag--medium {\n font-size: var(--sl-button-font-size-medium);\n height: calc(var(--sl-input-height-medium) * 0.8);\n line-height: calc(var(--sl-input-height-medium) - var(--sl-input-border-width) * 2);\n border-radius: var(--sl-input-border-radius-medium);\n padding: 0 var(--sl-spacing-small);\n}\n.tag--medium .tag__clear {\n margin-left: var(--sl-spacing-xx-small);\n margin-right: calc(-1 * var(--sl-spacing-xx-small));\n}\n\n.tag--large {\n font-size: var(--sl-button-font-size-large);\n height: calc(var(--sl-input-height-large) * 0.8);\n line-height: calc(var(--sl-input-height-large) - var(--sl-input-border-width) * 2);\n border-radius: var(--sl-input-border-radius-large);\n padding: 0 var(--sl-spacing-medium);\n}\n.tag--large .tag__clear {\n margin-left: var(--sl-spacing-xx-small);\n margin-right: calc(-1 * var(--sl-spacing-x-small));\n}\n\n.tag--pill {\n border-radius: var(--sl-border-radius-pill);\n}";
  19. // src/components/tag/tag.ts
  20. var SlTag = class extends h {
  21. constructor() {
  22. super(...arguments);
  23. this.type = "primary";
  24. this.size = "medium";
  25. this.pill = false;
  26. this.clearable = false;
  27. }
  28. handleClearClick() {
  29. this.slClear.emit();
  30. }
  31. render() {
  32. return T`
  33. <span
  34. part="base"
  35. class=${e2({
  36. tag: true,
  37. "tag--primary": this.type === "primary",
  38. "tag--success": this.type === "success",
  39. "tag--info": this.type === "info",
  40. "tag--warning": this.type === "warning",
  41. "tag--danger": this.type === "danger",
  42. "tag--text": this.type === "text",
  43. "tag--small": this.size === "small",
  44. "tag--medium": this.size === "medium",
  45. "tag--large": this.size === "large",
  46. "tag--pill": this.pill,
  47. "tag--clearable": this.clearable
  48. })}
  49. >
  50. <span part="content" class="tag__content">
  51. <slot></slot>
  52. </span>
  53. ${this.clearable ? T`
  54. <sl-icon-button
  55. exportparts="base:clear-button"
  56. name="x"
  57. library="system"
  58. class="tag__clear"
  59. @click=${this.handleClearClick}
  60. ></sl-icon-button>
  61. ` : ""}
  62. </span>
  63. `;
  64. }
  65. };
  66. SlTag.styles = r(tag_default);
  67. __decorateClass([
  68. e({ reflect: true })
  69. ], SlTag.prototype, "type", 2);
  70. __decorateClass([
  71. e({ reflect: true })
  72. ], SlTag.prototype, "size", 2);
  73. __decorateClass([
  74. e({ type: Boolean, reflect: true })
  75. ], SlTag.prototype, "pill", 2);
  76. __decorateClass([
  77. e({ type: Boolean })
  78. ], SlTag.prototype, "clearable", 2);
  79. __decorateClass([
  80. event("sl-clear")
  81. ], SlTag.prototype, "slClear", 2);
  82. SlTag = __decorateClass([
  83. n("sl-tag")
  84. ], SlTag);
  85. var tag_default2 = SlTag;
  86. export {
  87. tag_default2 as tag_default
  88. };