chunk.XLLF4RY5.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import {
  2. hasSlot
  3. } from "./chunk.FMCX45AD.js";
  4. import {
  5. e
  6. } from "./chunk.YXKHB4AC.js";
  7. import {
  8. T,
  9. h,
  10. n,
  11. r,
  12. r2
  13. } from "./chunk.5PIDMFOE.js";
  14. import {
  15. __decorateClass
  16. } from "./chunk.IHGPZX35.js";
  17. // _uyihdawu1:/Users/claviska/Projects/shoelace/src/components/card/card.scss
  18. var card_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 --border-color: var(--sl-color-gray-200);\n --border-radius: var(--sl-border-radius-medium);\n --border-width: 1px;\n --padding: var(--sl-spacing-large);\n display: inline-block;\n}\n\n.card {\n display: flex;\n flex-direction: column;\n background-color: var(--sl-color-white);\n box-shadow: var(--sl-shadow-x-small);\n border: solid var(--border-width) var(--border-color);\n border-radius: var(--border-radius);\n}\n\n.card__image {\n border-top-left-radius: var(--border-radius);\n border-top-right-radius: var(--border-radius);\n margin: calc(-1 * var(--border-width));\n overflow: hidden;\n}\n.card__image ::slotted(img) {\n display: block;\n width: 100%;\n}\n\n.card:not(.card--has-image) .card__image {\n display: none;\n}\n\n.card__header {\n border-bottom: solid var(--border-width) var(--border-color);\n padding: calc(var(--padding) / 2) var(--padding);\n}\n\n.card:not(.card--has-header) .card__header {\n display: none;\n}\n\n.card__body {\n padding: var(--padding);\n}\n\n.card--has-footer .card__footer {\n border-top: solid var(--border-width) var(--border-color);\n padding: var(--padding);\n}\n\n.card:not(.card--has-footer) .card__footer {\n display: none;\n}";
  19. // src/components/card/card.ts
  20. var SlCard = class extends h {
  21. constructor() {
  22. super(...arguments);
  23. this.hasFooter = false;
  24. this.hasImage = false;
  25. this.hasHeader = false;
  26. }
  27. handleSlotChange() {
  28. this.hasFooter = hasSlot(this, "footer");
  29. this.hasImage = hasSlot(this, "image");
  30. this.hasHeader = hasSlot(this, "header");
  31. }
  32. render() {
  33. return T`
  34. <div
  35. part="base"
  36. class=${e({
  37. card: true,
  38. "card--has-footer": this.hasFooter,
  39. "card--has-image": this.hasImage,
  40. "card--has-header": this.hasHeader
  41. })}
  42. >
  43. <div part="image" class="card__image">
  44. <slot name="image" @slotchange=${this.handleSlotChange}></slot>
  45. </div>
  46. <div part="header" class="card__header">
  47. <slot name="header" @slotchange=${this.handleSlotChange}></slot>
  48. </div>
  49. <div part="body" class="card__body">
  50. <slot></slot>
  51. </div>
  52. <div part="footer" class="card__footer">
  53. <slot name="footer" @slotchange=${this.handleSlotChange}></slot>
  54. </div>
  55. </div>
  56. `;
  57. }
  58. };
  59. SlCard.styles = r(card_default);
  60. __decorateClass([
  61. r2()
  62. ], SlCard.prototype, "hasFooter", 2);
  63. __decorateClass([
  64. r2()
  65. ], SlCard.prototype, "hasImage", 2);
  66. __decorateClass([
  67. r2()
  68. ], SlCard.prototype, "hasHeader", 2);
  69. SlCard = __decorateClass([
  70. n("sl-card")
  71. ], SlCard);
  72. var card_default2 = SlCard;
  73. export {
  74. card_default2 as card_default
  75. };