@govtechsg/sgds-web-component 3.17.1-rc.0 → 3.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/base/card-element.d.ts +1 -0
  2. package/base/card-element.js +14 -0
  3. package/base/card-element.js.map +1 -1
  4. package/base/card.js +1 -1
  5. package/components/Breadcrumb/index.umd.min.js +10 -16
  6. package/components/Breadcrumb/index.umd.min.js.map +1 -1
  7. package/components/Card/index.umd.min.js +2 -2
  8. package/components/Card/index.umd.min.js.map +1 -1
  9. package/components/Card/sgds-card.js +3 -9
  10. package/components/Card/sgds-card.js.map +1 -1
  11. package/components/ComboBox/index.umd.min.js +1 -1
  12. package/components/ComboBox/index.umd.min.js.map +1 -1
  13. package/components/Datepicker/index.umd.min.js +1 -1
  14. package/components/Datepicker/index.umd.min.js.map +1 -1
  15. package/components/Dropdown/dropdown-menu.js +1 -1
  16. package/components/Dropdown/dropdown.js +1 -1
  17. package/components/Dropdown/index.umd.min.js +3 -9
  18. package/components/Dropdown/index.umd.min.js.map +1 -1
  19. package/components/Dropdown/sgds-dropdown.js +19 -11
  20. package/components/Dropdown/sgds-dropdown.js.map +1 -1
  21. package/components/IconCard/index.umd.min.js +3 -3
  22. package/components/IconCard/index.umd.min.js.map +1 -1
  23. package/components/IconCard/sgds-icon-card.js +3 -9
  24. package/components/IconCard/sgds-icon-card.js.map +1 -1
  25. package/components/ImageCard/index.umd.min.js +2 -2
  26. package/components/ImageCard/index.umd.min.js.map +1 -1
  27. package/components/ImageCard/sgds-image-card.js +3 -9
  28. package/components/ImageCard/sgds-image-card.js.map +1 -1
  29. package/components/Mainnav/index.umd.min.js +10 -16
  30. package/components/Mainnav/index.umd.min.js.map +1 -1
  31. package/components/OverflowMenu/index.umd.min.js +3 -9
  32. package/components/OverflowMenu/index.umd.min.js.map +1 -1
  33. package/components/Select/index.umd.min.js +1 -1
  34. package/components/Select/index.umd.min.js.map +1 -1
  35. package/components/Stepper/index.d.ts +0 -2
  36. package/components/Stepper/index.js +0 -2
  37. package/components/Stepper/index.js.map +1 -1
  38. package/components/Stepper/index.umd.min.js +23 -47
  39. package/components/Stepper/index.umd.min.js.map +1 -1
  40. package/components/Stepper/sgds-stepper.d.ts +2 -23
  41. package/components/Stepper/sgds-stepper.js +11 -79
  42. package/components/Stepper/sgds-stepper.js.map +1 -1
  43. package/components/Stepper/stepper.js +1 -1
  44. package/components/Stepper/types.d.ts +0 -1
  45. package/components/ThumbnailCard/index.umd.min.js +5 -5
  46. package/components/ThumbnailCard/index.umd.min.js.map +1 -1
  47. package/components/ThumbnailCard/sgds-thumbnail-card.js +6 -9
  48. package/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -1
  49. package/components/index.umd.min.js +9 -17
  50. package/components/index.umd.min.js.map +1 -1
  51. package/css/fouc.css +0 -1
  52. package/custom-elements.json +99 -201
  53. package/index.umd.min.js +43 -73
  54. package/index.umd.min.js.map +1 -1
  55. package/package.json +1 -1
  56. package/react/base/card-element.cjs.js +14 -0
  57. package/react/base/card-element.cjs.js.map +1 -1
  58. package/react/base/card-element.js +14 -0
  59. package/react/base/card-element.js.map +1 -1
  60. package/react/base/card.cjs.js +1 -1
  61. package/react/base/card.js +1 -1
  62. package/react/components/Card/sgds-card.cjs.js +3 -9
  63. package/react/components/Card/sgds-card.cjs.js.map +1 -1
  64. package/react/components/Card/sgds-card.js +3 -9
  65. package/react/components/Card/sgds-card.js.map +1 -1
  66. package/react/components/Dropdown/dropdown-menu.cjs.js +1 -1
  67. package/react/components/Dropdown/dropdown-menu.js +1 -1
  68. package/react/components/Dropdown/dropdown.cjs.js +1 -1
  69. package/react/components/Dropdown/dropdown.js +1 -1
  70. package/react/components/Dropdown/sgds-dropdown.cjs.js +19 -11
  71. package/react/components/Dropdown/sgds-dropdown.cjs.js.map +1 -1
  72. package/react/components/Dropdown/sgds-dropdown.js +19 -11
  73. package/react/components/Dropdown/sgds-dropdown.js.map +1 -1
  74. package/react/components/IconCard/sgds-icon-card.cjs.js +3 -9
  75. package/react/components/IconCard/sgds-icon-card.cjs.js.map +1 -1
  76. package/react/components/IconCard/sgds-icon-card.js +3 -9
  77. package/react/components/IconCard/sgds-icon-card.js.map +1 -1
  78. package/react/components/ImageCard/sgds-image-card.cjs.js +3 -9
  79. package/react/components/ImageCard/sgds-image-card.cjs.js.map +1 -1
  80. package/react/components/ImageCard/sgds-image-card.js +3 -9
  81. package/react/components/ImageCard/sgds-image-card.js.map +1 -1
  82. package/react/components/Stepper/sgds-stepper.cjs.js +10 -78
  83. package/react/components/Stepper/sgds-stepper.cjs.js.map +1 -1
  84. package/react/components/Stepper/sgds-stepper.js +11 -79
  85. package/react/components/Stepper/sgds-stepper.js.map +1 -1
  86. package/react/components/Stepper/stepper.cjs.js +1 -1
  87. package/react/components/Stepper/stepper.js +1 -1
  88. package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js +6 -9
  89. package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js.map +1 -1
  90. package/react/components/ThumbnailCard/sgds-thumbnail-card.js +6 -9
  91. package/react/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -1
  92. package/react/index.cjs.js +38 -40
  93. package/react/index.cjs.js.map +1 -1
  94. package/react/index.d.ts +0 -1
  95. package/react/index.js +0 -1
  96. package/react/index.js.map +1 -1
  97. package/types/react.d.ts +3 -18
  98. package/components/Stepper/sgds-step.d.ts +0 -42
  99. package/components/Stepper/sgds-step.js +0 -118
  100. package/components/Stepper/sgds-step.js.map +0 -1
  101. package/components/Stepper/step.js +0 -6
  102. package/components/Stepper/step.js.map +0 -1
  103. package/react/components/Stepper/sgds-step.cjs.js +0 -124
  104. package/react/components/Stepper/sgds-step.cjs.js.map +0 -1
  105. package/react/components/Stepper/sgds-step.js +0 -119
  106. package/react/components/Stepper/sgds-step.js.map +0 -1
  107. package/react/components/Stepper/step.cjs.js +0 -11
  108. package/react/components/Stepper/step.cjs.js.map +0 -1
  109. package/react/components/Stepper/step.js +0 -7
  110. package/react/components/Stepper/step.js.map +0 -1
  111. package/react/step/index.cjs.js +0 -40
  112. package/react/step/index.cjs.js.map +0 -1
  113. package/react/step/index.d.ts +0 -2
  114. package/react/step/index.js +0 -16
  115. package/react/step/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-icon-card.cjs.js","sources":["../../../../src/components/IconCard/sgds-icon-card.ts"],"sourcesContent":["import { nothing, PropertyValueMap } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedElements, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport type SgdsLink from \"../Link/sgds-link\";\nimport IconCardStyle from \"./icon-card.css\";\n\n/**\n * @summary Icon cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot icon - Accepts an icon element to visually represent the card. Only a single element is allowed to be passed in.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot footer - Footer area of the card. Accepts links, actions, or any custom content.\n * @slot link - (@deprecated) Deprecated since 3.3.2 in favour of `footer` slot.\n * Legacy slot for anchor elements. Use `footer` instead.\n */\nexport class SgdsIconCard extends CardElement {\n static styles = [...CardElement.styles, IconCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"icon\", flatten: true })\n _iconNode!: Array<Node>;\n /** @internal */\n @queryAssignedNodes({ slot: \"upper\", flatten: true })\n _upperNode!: Array<Node>;\n @queryAssignedElements({ slot: \"footer\" })\n private footerNode!: HTMLElement[];\n @queryAssignedElements({ slot: \"link\" })\n private linkNode!: HTMLAnchorElement[] | SgdsLink[];\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n private get linkSlotItems(): HTMLAnchorElement | null {\n if (!this.linkNode || this.linkNode.length === 0) return null;\n const element = this.linkNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n private get footerSlotItems(): HTMLAnchorElement | null {\n if (!this.footerNode || this.footerNode.length === 0) return null;\n const element = this.footerNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n protected firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n\n if (this._iconNode.length === 0) {\n if ((this.orientation === \"vertical\" && this._upperNode.length === 0) || this.orientation === \"horizontal\") {\n const media = this.shadowRoot.querySelector(\".card-media\") as HTMLDivElement;\n media.style.display = \"none\";\n\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n if (this.noPadding) body.style.padding = \"0px\";\n }\n }\n\n if (this.stretchedLink) {\n const footerHref = this.footerSlotItems?.href;\n const linkHref = this.linkSlotItems?.href;\n\n if (footerHref) {\n this.card.setAttribute(\"href\", footerHref);\n } else if (linkHref) {\n this.card.setAttribute(\"href\", linkHref);\n }\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n\n return html`\n <${tag} \n class=\"${classMap({\n card: true,\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-media\">\n <slot name=\"icon\"></slot>\n ${this.orientation === \"vertical\" ? html`<slot name=\"upper\"></slot>` : nothing}\n </div>\n <div class=\"card-body\">\n ${this.orientation === \"horizontal\" ? html`<slot name=\"upper\"></slot>` : nothing}\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n <slot name=\"description\"></slot>\n <slot name=\"lower\"></slot>\n <slot name=\"footer\">\n <slot name=\"link\" @slotchange=${this.warnLinkSlotMisused}></slot>\n </slot>\n </div>\n </${tag}>\n `;\n }\n}\n\nexport default SgdsIconCard;\n"],"names":["CardElement","literal","html","classMap","nothing","IconCardStyle","__decorate","queryAssignedNodes","queryAssignedElements","property"],"mappings":";;;;;;;;;;;;;AAQA;;;;;;;;;;;;AAYG;AACG,MAAO,YAAa,SAAQA,uBAAW,CAAA;AAA7C,IAAA,WAAA,GAAA;;;QAe8C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;KA0E/D;AAxEC,IAAA,IAAY,aAAa,GAAA;QACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;AAAE,YAAA,OAAO,IAAI,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAgB,CAAC;QAChD,QAAQ,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,OAAO,EAAuB;KACrE;AAED,IAAA,IAAY,eAAe,GAAA;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;AAAE,YAAA,OAAO,IAAI,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAgB,CAAC;QAClD,QAAQ,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,OAAO,EAAuB;KACrE;AAES,IAAA,YAAY,CAAC,iBAAyC,EAAA;;AAC9D,QAAA,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;QAEtC,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,UAAU,IAAI,IAAI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YAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAE3BF,gBAAA,CAAA;AADP,IAAAE,mCAAqB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACY,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGRF,gBAAA,CAAA;IAA3CG,sBAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAmB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA;;;;;"}
1
+ {"version":3,"file":"sgds-icon-card.cjs.js","sources":["../../../../src/components/IconCard/sgds-icon-card.ts"],"sourcesContent":["import { nothing, PropertyValueMap } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedElements, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport type SgdsLink from \"../Link/sgds-link\";\nimport IconCardStyle from \"./icon-card.css\";\n\n/**\n * @summary Icon cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot icon - Accepts an icon element to visually represent the card. Only a single element is allowed to be passed in.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot footer - Footer area of the card. Accepts links, actions, or any custom content.\n * @slot link - (@deprecated) Deprecated since 3.3.2 in favour of `footer` slot.\n * Legacy slot for anchor elements. Use `footer` instead.\n */\nexport class SgdsIconCard extends CardElement {\n static styles = [...CardElement.styles, IconCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"icon\", flatten: true })\n _iconNode!: Array<Node>;\n /** @internal */\n @queryAssignedNodes({ slot: \"upper\", flatten: true })\n _upperNode!: Array<Node>;\n @queryAssignedElements({ slot: \"footer\" })\n private footerNode!: HTMLElement[];\n @queryAssignedElements({ slot: \"link\" })\n private linkNode!: HTMLAnchorElement[] | SgdsLink[];\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n private get linkSlotItems(): HTMLAnchorElement | null {\n if (!this.linkNode || this.linkNode.length === 0) return null;\n const element = this.linkNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n private get footerSlotItems(): HTMLAnchorElement | null {\n if (!this.footerNode || this.footerNode.length === 0) return null;\n const element = this.footerNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n protected firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n\n if (this._iconNode.length === 0) {\n if ((this.orientation === \"vertical\" && this._upperNode.length === 0) || this.orientation === \"horizontal\") {\n const media = this.shadowRoot.querySelector(\".card-media\") as HTMLDivElement;\n media.style.display = \"none\";\n\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n if (this.noPadding) body.style.padding = \"0px\";\n }\n }\n\n if (this.stretchedLink) {\n const footerAnchor = this.footerSlotItems;\n const linkAnchor = this.linkSlotItems;\n this._forwardAnchorAttributes(footerAnchor?.href ? footerAnchor : linkAnchor);\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n\n return html`\n <${tag} \n class=\"${classMap({\n card: true,\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-media\">\n <slot name=\"icon\"></slot>\n ${this.orientation === \"vertical\" ? html`<slot name=\"upper\"></slot>` : nothing}\n </div>\n <div class=\"card-body\">\n ${this.orientation === \"horizontal\" ? html`<slot name=\"upper\"></slot>` : nothing}\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n <slot name=\"description\"></slot>\n <slot name=\"lower\"></slot>\n <slot name=\"footer\">\n <slot name=\"link\" @slotchange=${this.warnLinkSlotMisused}></slot>\n </slot>\n </div>\n </${tag}>\n `;\n }\n}\n\nexport default SgdsIconCard;\n"],"names":["CardElement","literal","html","classMap","nothing","IconCardStyle","__decorate","queryAssignedNodes","queryAssignedElements","property"],"mappings":";;;;;;;;;;;;;AAQA;;;;;;;;;;;;AAYG;AACG,MAAO,YAAa,SAAQA,uBAAW,CAAA;AAA7C,IAAA,WAAA,GAAA;;;QAe8C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;KAqE/D;AAnEC,IAAA,IAAY,aAAa,GAAA;QACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;AAAE,YAAA,OAAO,IAAI,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAgB,CAAC;QAChD,QAAQ,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,OAAO,EAAuB;KACrE;AAED,IAAA,IAAY,eAAe,GAAA;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;AAAE,YAAA,OAAO,IAAI,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAgB,CAAC;QAClD,QAAQ,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,OAAO,EAAuB;KACrE;AAES,IAAA,YAAY,CAAC,iBAAyC,EAAA;A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mCAAqB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACY,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGRF,gBAAA,CAAA;IAA3CG,sBAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAmB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA;;;;;"}
@@ -39,7 +39,6 @@ class SgdsIconCard extends CardElement {
39
39
  return (element.querySelector("a") || element);
40
40
  }
41
41
  firstUpdated(changedProperties) {
42
- var _a, _b;
43
42
  super.firstUpdated(changedProperties);
44
43
  if (this._iconNode.length === 0) {
45
44
  if ((this.orientation === "vertical" && this._upperNode.length === 0) || this.orientation === "horizontal") {
@@ -51,14 +50,9 @@ class SgdsIconCard extends CardElement {
51
50
  }
52
51
  }
53
52
  if (this.stretchedLink) {
54
- const footerHref = (_a = this.footerSlotItems) === null || _a === void 0 ? void 0 : _a.href;
55
- const linkHref = (_b = this.linkSlotItems) === null || _b === void 0 ? void 0 : _b.href;
56
- if (footerHref) {
57
- this.card.setAttribute("href", footerHref);
58
- }
59
- else if (linkHref) {
60
- this.card.setAttribute("href", linkHref);
61
- }
53
+ const footerAnchor = this.footerSlotItems;
54
+ const linkAnchor = this.linkSlotItems;
55
+ this._forwardAnchorAttributes((footerAnchor === null || footerAnchor === void 0 ? void 0 : footerAnchor.href) ? footerAnchor : linkAnchor);
62
56
  }
63
57
  }
64
58
  render() {
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-icon-card.js","sources":["../../../../src/components/IconCard/sgds-icon-card.ts"],"sourcesContent":["import { nothing, PropertyValueMap } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedElements, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport type SgdsLink from \"../Link/sgds-link\";\nimport IconCardStyle from \"./icon-card.css\";\n\n/**\n * @summary Icon cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot icon - Accepts an icon element to visually represent the card. Only a single element is allowed to be passed in.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot footer - Footer area of the card. Accepts links, actions, or any custom content.\n * @slot link - (@deprecated) Deprecated since 3.3.2 in favour of `footer` slot.\n * Legacy slot for anchor elements. Use `footer` instead.\n */\nexport class SgdsIconCard extends CardElement {\n static styles = [...CardElement.styles, IconCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"icon\", flatten: true })\n _iconNode!: Array<Node>;\n /** @internal */\n @queryAssignedNodes({ slot: \"upper\", flatten: true })\n _upperNode!: Array<Node>;\n @queryAssignedElements({ slot: \"footer\" })\n private footerNode!: HTMLElement[];\n @queryAssignedElements({ slot: \"link\" })\n private linkNode!: HTMLAnchorElement[] | SgdsLink[];\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n private get linkSlotItems(): HTMLAnchorElement | null {\n if (!this.linkNode || this.linkNode.length === 0) return null;\n const element = this.linkNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n private get footerSlotItems(): HTMLAnchorElement | null {\n if (!this.footerNode || this.footerNode.length === 0) return null;\n const element = this.footerNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n protected firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n\n if (this._iconNode.length === 0) {\n if ((this.orientation === \"vertical\" && this._upperNode.length === 0) || this.orientation === \"horizontal\") {\n const media = this.shadowRoot.querySelector(\".card-media\") as HTMLDivElement;\n media.style.display = \"none\";\n\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n if (this.noPadding) body.style.padding = \"0px\";\n }\n }\n\n if (this.stretchedLink) {\n const footerHref = this.footerSlotItems?.href;\n const linkHref = this.linkSlotItems?.href;\n\n if (footerHref) {\n this.card.setAttribute(\"href\", footerHref);\n } else if (linkHref) {\n this.card.setAttribute(\"href\", linkHref);\n }\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n\n return html`\n <${tag} \n class=\"${classMap({\n card: true,\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-media\">\n <slot name=\"icon\"></slot>\n ${this.orientation === \"vertical\" ? html`<slot name=\"upper\"></slot>` : nothing}\n </div>\n <div class=\"card-body\">\n ${this.orientation === \"horizontal\" ? html`<slot name=\"upper\"></slot>` : nothing}\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n <slot name=\"description\"></slot>\n <slot name=\"lower\"></slot>\n <slot name=\"footer\">\n <slot name=\"link\" @slotchange=${this.warnLinkSlotMisused}></slot>\n </slot>\n </div>\n </${tag}>\n `;\n }\n}\n\nexport default SgdsIconCard;\n"],"names":["IconCardStyle"],"mappings":";;;;;;;;;AAQA;;;;;;;;;;;;AAYG;AACG,MAAO,YAAa,SAAQ,WAAW,CAAA;AAA7C,IAAA,WAAA,GAAA;;;QAe8C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;KA0E/D;AAxEC,IAAA,IAAY,aAAa,GAAA;QACvB,IAAI,CAAC,IAAI,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AAG,OAAO,CAAA;;;;AAIpB,oEAAA,EAAA,IAAI,CAAC,qBAAqB,CAAA;;;;;;;AAOpD,0CAAA,EAAA,IAAI,CAAC,mBAAmB,CAAA;;;UAG1D,GAAG,CAAA;KACR,CAAC;KACH;;AAvFM,YAAM,CAAA,MAAA,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAEA,QAAa,CAAxC,CAA0C;AAIvD,UAAA,CAAA;IADC,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGxB,UAAA,CAAA;IADC,kBAAkB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAEjB,UAAA,CAAA;AADP,IAAA,qBAAqB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACP,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAE3B,UAAA,CAAA;AADP,IAAA,qBAAqB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACY,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGR,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAmB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"sgds-icon-card.js","sources":["../../../../src/components/IconCard/sgds-icon-card.ts"],"sourcesContent":["import { nothing, PropertyValueMap } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedElements, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport type SgdsLink from \"../Link/sgds-link\";\nimport IconCardStyle from \"./icon-card.css\";\n\n/**\n * @summary Icon cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot icon - Accepts an icon element to visually represent the card. Only a single element is allowed to be passed in.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot footer - Footer area of the card. Accepts links, actions, or any custom content.\n * @slot link - (@deprecated) Deprecated since 3.3.2 in favour of `footer` slot.\n * Legacy slot for anchor elements. Use `footer` instead.\n */\nexport class SgdsIconCard extends CardElement {\n static styles = [...CardElement.styles, IconCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"icon\", flatten: true })\n _iconNode!: Array<Node>;\n /** @internal */\n @queryAssignedNodes({ slot: \"upper\", flatten: true })\n _upperNode!: Array<Node>;\n @queryAssignedElements({ slot: \"footer\" })\n private footerNode!: HTMLElement[];\n @queryAssignedElements({ slot: \"link\" })\n private linkNode!: HTMLAnchorElement[] | SgdsLink[];\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n private get linkSlotItems(): HTMLAnchorElement | null {\n if (!this.linkNode || this.linkNode.length === 0) return null;\n const element = this.linkNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n private get footerSlotItems(): HTMLAnchorElement | null {\n if (!this.footerNode || this.footerNode.length === 0) return null;\n const element = this.footerNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n protected firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n\n if (this._iconNode.length === 0) {\n if ((this.orientation === \"vertical\" && this._upperNode.length === 0) || this.orientation === \"horizontal\") {\n const media = this.shadowRoot.querySelector(\".card-media\") as HTMLDivElement;\n media.style.display = \"none\";\n\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n if (this.noPadding) body.style.padding = \"0px\";\n }\n }\n\n if (this.stretchedLink) {\n const footerAnchor = this.footerSlotItems;\n const linkAnchor = this.linkSlotItems;\n this._forwardAnchorAttributes(footerAnchor?.href ? footerAnchor : linkAnchor);\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n\n return html`\n <${tag} \n class=\"${classMap({\n card: true,\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-media\">\n <slot name=\"icon\"></slot>\n ${this.orientation === \"vertical\" ? html`<slot name=\"upper\"></slot>` : nothing}\n </div>\n <div class=\"card-body\">\n ${this.orientation === \"horizontal\" ? html`<slot name=\"upper\"></slot>` : nothing}\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n <slot name=\"description\"></slot>\n <slot name=\"lower\"></slot>\n <slot name=\"footer\">\n <slot name=\"link\" @slotchange=${this.warnLinkSlotMisused}></slot>\n </slot>\n </div>\n </${tag}>\n `;\n }\n}\n\nexport default SgdsIconCard;\n"],"names":["IconCardStyle"],"mappings":";;;;;;;;;AAQA;;;;;;;;;;;;AAYG;AACG,MAAO,YAAa,SAAQ,WAAW,CAAA;AAA7C,IAAA,WAAA,GAAA;;;QAe8C,IAAS,CAAA,SAAA,GAAG,KAAK,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WAAW,CAAC,MAAM,EAAEA,QAAa,CAAxC,CAA0C;AAIvD,UAAA,CAAA;IADC,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGxB,UAAA,CAAA;IADC,kBAAkB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAEjB,UAAA,CAAA;AADP,IAAA,qBAAqB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACP,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAE3B,UAAA,CAAA;AADP,IAAA,qBAAqB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACY,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGR,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAmB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
@@ -49,7 +49,6 @@ class SgdsImageCard extends cardElement.CardElement {
49
49
  return (element.querySelector("a") || element);
50
50
  }
51
51
  firstUpdated(changedProperties) {
52
- var _a, _b;
53
52
  super.firstUpdated(changedProperties);
54
53
  if (this._imageNode.length === 0) {
55
54
  const image = this.shadowRoot.querySelector(".card-image");
@@ -59,14 +58,9 @@ class SgdsImageCard extends cardElement.CardElement {
59
58
  body.style.padding = "0px";
60
59
  }
61
60
  if (this.stretchedLink) {
62
- const footerHref = (_a = this.footerSlotItems) === null || _a === void 0 ? void 0 : _a.href;
63
- const linkHref = (_b = this.linkSlotItems) === null || _b === void 0 ? void 0 : _b.href;
64
- if (footerHref) {
65
- this.card.setAttribute("href", footerHref);
66
- }
67
- else if (linkHref) {
68
- this.card.setAttribute("href", linkHref);
69
- }
61
+ const footerAnchor = this.footerSlotItems;
62
+ const linkAnchor = this.linkSlotItems;
63
+ this._forwardAnchorAttributes((footerAnchor === null || footerAnchor === void 0 ? void 0 : footerAnchor.href) ? footerAnchor : linkAnchor);
70
64
  }
71
65
  }
72
66
  handleImgSlotChange(e) {
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-image-card.cjs.js","sources":["../../../../src/components/ImageCard/sgds-image-card.ts"],"sourcesContent":["import { nothing, PropertyValueMap } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedElements, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport { CardImageAdjustment, CardImagePosition } from \"../Card/types\";\nimport type SgdsLink from \"../Link/sgds-link\";\nimport imageCardStyle from \"./image-card.css\";\n\n/**\n * @summary Image cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot image - Accepts an image or svg element of the card. Only a single element is allowed to be passed in.\n * @slot image-badge - Accepts an element for a badge, positioned at the top-left corner of the image.\n * @slot image-action - Accepts an element for an overflow or contextual menu, positioned at the top-right corner of the image. Typically used for action menu.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot footer - Footer area of the card. Accepts links, actions, or any custom content.\n * @slot link - (@deprecated) Deprecated since 3.3.2 in favour of `footer` slot.\n * Legacy slot for anchor elements. Use `footer` instead.\n */\nexport class SgdsImageCard extends CardElement {\n static styles = [...CardElement.styles, imageCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"image\", flatten: true })\n _imageNode!: Array<Node>;\n @queryAssignedElements({ slot: \"footer\" })\n private footerNode!: HTMLElement[];\n @queryAssignedElements({ slot: \"link\" })\n private linkNode!: HTMLAnchorElement[] | SgdsLink[];\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n /** Sets the image position of the card. Available options: `before`, `after` */\n @property({ type: String, reflect: true }) imagePosition: CardImagePosition = \"before\";\n\n /** Controls how the image is sized and aligned within the card. Available options: `default`, `padding around`, `aspect ratio` */\n @property({ type: String, reflect: true }) imageAdjustment: CardImageAdjustment = \"default\";\n\n private get linkSlotItems(): HTMLAnchorElement | null {\n if (!this.linkNode || this.linkNode.length === 0) return null;\n const element = this.linkNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n private get footerSlotItems(): HTMLAnchorElement | null {\n if (!this.footerNode || this.footerNode.length === 0) return null;\n const element = this.footerNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n protected firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n\n if (this._imageNode.length === 0) {\n const image = this.shadowRoot.querySelector(\".card-image\") as HTMLDivElement;\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n image.style.display = \"none\";\n if (this.noPadding) body.style.padding = \"0px\";\n }\n\n if (this.stretchedLink) {\n const footerHref = this.footerSlotItems?.href;\n const linkHref = this.linkSlotItems?.href;\n\n if (footerHref) {\n this.card.setAttribute(\"href\", footerHref);\n } else if (linkHref) {\n this.card.setAttribute(\"href\", linkHref);\n }\n }\n }\n\n handleImgSlotChange(e: Event) {\n const childNodes = (e.target as HTMLSlotElement).assignedNodes({ flatten: true }) as Array<HTMLOrSVGImageElement>;\n\n if (childNodes.length > 1) {\n return console.error(\"Multiple elements passed into SgdsCard's image slot\");\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n\n return html`\n <${tag} \n class=\"card ${classMap({\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-image\">\n\t\t\t\t\t<slot name=\"image\" @slotchange=${this.handleImgSlotChange}></slot>\n\t\t\t\t\t<slot name=\"image-badge\"></slot>\n\t\t\t\t\t<slot name=\"image-action\"></slot>\n </div>\n <div class=\"card-body\">\n\t\t\t\t\t<slot name=\"upper\"></slot>\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n <slot name=\"description\"></slot>\n <slot name=\"lower\"></slot>\n <slot name=\"footer\">\n <slot name=\"link\" @slotchange=${this.warnLinkSlotMisused}></slot>\n </slot>\n </div>\n </${tag}>\n `;\n }\n}\n\nexport default SgdsImageCard;\n"],"names":["CardElement","literal","html","classMap","nothing","imageCardStyle","__decorate","queryAssignedNodes","queryAssignedElements","property"],"mappings":";;;;;;;;;;;;;AASA;;;;;;;;;;;;;;AAcG;AACG,MAAO,aAAc,SAAQA,uBAAW,CAAA;AAA9C,IAAA,WAAA,GAAA;;;QAY8C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGnB,IAAa,CAAA,aAAA,GAAsB,QAAQ,CAAC;;QAG5C,IAAe,CAAA,eAAA,GAAwB,SAAS,CAAC;KA+E7F;AA7EC,IAAA,IAAY,aAAa,GAAA;QACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;AAAE,YAAA,OAAO,IAAI,CAAC;QAC9D,MA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"sourcesContent":["import { nothing, PropertyValueMap } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedElements, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport { CardImageAdjustment, CardImagePosition } from \"../Card/types\";\nimport type SgdsLink from \"../Link/sgds-link\";\nimport imageCardStyle from \"./image-card.css\";\n\n/**\n * @summary Image cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot image - Accepts an image or svg element of the card. Only a single element is allowed to be passed in.\n * @slot image-badge - Accepts an element for a badge, positioned at the top-left corner of the image.\n * @slot image-action - Accepts an element for an overflow or contextual menu, positioned at the top-right corner of the image. Typically used for action menu.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot footer - Footer area of the card. Accepts links, actions, or any custom content.\n * @slot link - (@deprecated) Deprecated since 3.3.2 in favour of `footer` slot.\n * Legacy slot for anchor elements. Use `footer` instead.\n */\nexport class SgdsImageCard extends CardElement {\n static styles = [...CardElement.styles, imageCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"image\", flatten: true })\n _imageNode!: Array<Node>;\n @queryAssignedElements({ slot: \"footer\" })\n private footerNode!: HTMLElement[];\n @queryAssignedElements({ slot: \"link\" })\n private linkNode!: HTMLAnchorElement[] | SgdsLink[];\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n /** Sets the image position of the card. Available options: `before`, `after` */\n @property({ type: String, reflect: true }) imagePosition: CardImagePosition = \"before\";\n\n /** Controls how the image is sized and aligned within the card. Available options: `default`, `padding around`, `aspect ratio` */\n @property({ type: String, reflect: true }) imageAdjustment: CardImageAdjustment = \"default\";\n\n private get linkSlotItems(): HTMLAnchorElement | null {\n if (!this.linkNode || this.linkNode.length === 0) return null;\n const element = this.linkNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n private get footerSlotItems(): HTMLAnchorElement | null {\n if (!this.footerNode || this.footerNode.length === 0) return null;\n const element = this.footerNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n protected firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n\n if (this._imageNode.length === 0) {\n const image = this.shadowRoot.querySelector(\".card-image\") as HTMLDivElement;\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n image.style.display = \"none\";\n if (this.noPadding) body.style.padding = \"0px\";\n }\n\n if (this.stretchedLink) {\n const footerAnchor = this.footerSlotItems;\n const linkAnchor = this.linkSlotItems;\n this._forwardAnchorAttributes(footerAnchor?.href ? footerAnchor : linkAnchor);\n }\n }\n\n handleImgSlotChange(e: Event) {\n const childNodes = (e.target as HTMLSlotElement).assignedNodes({ flatten: true }) as Array<HTMLOrSVGImageElement>;\n\n if (childNodes.length > 1) {\n return console.error(\"Multiple elements passed into SgdsCard's image slot\");\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n\n return html`\n <${tag} \n class=\"card ${classMap({\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-image\">\n\t\t\t\t\t<slot name=\"image\" @slotchange=${this.handleImgSlotChange}></slot>\n\t\t\t\t\t<slot name=\"image-badge\"></slot>\n\t\t\t\t\t<slot name=\"image-action\"></slot>\n </div>\n <div class=\"card-body\">\n\t\t\t\t\t<slot name=\"upper\"></slot>\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n <slot name=\"description\"></slot>\n <slot name=\"lower\"></slot>\n <slot name=\"footer\">\n <slot name=\"link\" @slotchange=${this.warnLinkSlotMisused}></slot>\n </slot>\n </div>\n </${tag}>\n `;\n }\n}\n\nexport default SgdsImageCard;\n"],"names":["CardElement","literal","html","classMap","nothing","imageCardStyle","__decorate","queryAssignedNodes","queryAssignedElements","property"],"mappings":";;;;;;;;;;;;;AASA;;;;;;;;;;;;;;AAcG;AACG,MAAO,aAAc,SAAQA,uBAAW,CAAA;AAA9C,IAAA,WAAA,GAAA;;;QAY8C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGnB,IAAa,CAAA,aAAA,GAAsB,QAAQ,CAAC;;QAG5C,IAAe,CAAA,eAAA,GAAwB,SAAS,CAAC;KA0E7F;AAxEC,IAAA,IAAY,aAAa,GAAA;QACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;AAAE,YAAA,OAAO,IAAI,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAgB,CAAC;QAChD,QAAQ,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,OAAO,EAAuB;KACrE;AAED,IAAA,IAAY,eAAe,GAAA;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;AAAE,YAAA,OAAO,IAAI,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAgB,CAAC;QAClD,QAAQ,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,OAAO,EAAuB;KACrE;AAES,IAAA,YAAY,CAAC,iBAAyC,EAAA;AAC9D,QA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A,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGnBH,gBAAA,CAAA;IAA1CG,sBAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAA6C,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAG5CH,gBAAA,CAAA;IAA1CG,sBAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAkD,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,KAAA,CAAA,CAAA;;;;;"}
@@ -45,7 +45,6 @@ class SgdsImageCard extends CardElement {
45
45
  return (element.querySelector("a") || element);
46
46
  }
47
47
  firstUpdated(changedProperties) {
48
- var _a, _b;
49
48
  super.firstUpdated(changedProperties);
50
49
  if (this._imageNode.length === 0) {
51
50
  const image = this.shadowRoot.querySelector(".card-image");
@@ -55,14 +54,9 @@ class SgdsImageCard extends CardElement {
55
54
  body.style.padding = "0px";
56
55
  }
57
56
  if (this.stretchedLink) {
58
- const footerHref = (_a = this.footerSlotItems) === null || _a === void 0 ? void 0 : _a.href;
59
- const linkHref = (_b = this.linkSlotItems) === null || _b === void 0 ? void 0 : _b.href;
60
- if (footerHref) {
61
- this.card.setAttribute("href", footerHref);
62
- }
63
- else if (linkHref) {
64
- this.card.setAttribute("href", linkHref);
65
- }
57
+ const footerAnchor = this.footerSlotItems;
58
+ const linkAnchor = this.linkSlotItems;
59
+ this._forwardAnchorAttributes((footerAnchor === null || footerAnchor === void 0 ? void 0 : footerAnchor.href) ? footerAnchor : linkAnchor);
66
60
  }
67
61
  }
68
62
  handleImgSlotChange(e) {
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-image-card.js","sources":["../../../../src/components/ImageCard/sgds-image-card.ts"],"sourcesContent":["import { nothing, PropertyValueMap } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedElements, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport { CardImageAdjustment, CardImagePosition } from \"../Card/types\";\nimport type SgdsLink from \"../Link/sgds-link\";\nimport imageCardStyle from \"./image-card.css\";\n\n/**\n * @summary Image cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot image - Accepts an image or svg element of the card. Only a single element is allowed to be passed in.\n * @slot image-badge - Accepts an element for a badge, positioned at the top-left corner of the image.\n * @slot image-action - Accepts an element for an overflow or contextual menu, positioned at the top-right corner of the image. Typically used for action menu.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot footer - Footer area of the card. Accepts links, actions, or any custom content.\n * @slot link - (@deprecated) Deprecated since 3.3.2 in favour of `footer` slot.\n * Legacy slot for anchor elements. Use `footer` instead.\n */\nexport class SgdsImageCard extends CardElement {\n static styles = [...CardElement.styles, imageCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"image\", flatten: true })\n _imageNode!: Array<Node>;\n @queryAssignedElements({ slot: \"footer\" })\n private footerNode!: HTMLElement[];\n @queryAssignedElements({ slot: \"link\" })\n private linkNode!: HTMLAnchorElement[] | SgdsLink[];\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n /** Sets the image position of the card. Available options: `before`, `after` */\n @property({ type: String, reflect: true }) imagePosition: CardImagePosition = \"before\";\n\n /** Controls how the image is sized and aligned within the card. Available options: `default`, `padding around`, `aspect ratio` */\n @property({ type: String, reflect: true }) imageAdjustment: CardImageAdjustment = \"default\";\n\n private get linkSlotItems(): HTMLAnchorElement | null {\n if (!this.linkNode || this.linkNode.length === 0) return null;\n const element = this.linkNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n private get footerSlotItems(): HTMLAnchorElement | null {\n if (!this.footerNode || this.footerNode.length === 0) return null;\n const element = this.footerNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n protected firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n\n if (this._imageNode.length === 0) {\n const image = this.shadowRoot.querySelector(\".card-image\") as HTMLDivElement;\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n image.style.display = \"none\";\n if (this.noPadding) body.style.padding = \"0px\";\n }\n\n if (this.stretchedLink) {\n const footerHref = this.footerSlotItems?.href;\n const linkHref = this.linkSlotItems?.href;\n\n if (footerHref) {\n this.card.setAttribute(\"href\", footerHref);\n } else if (linkHref) {\n this.card.setAttribute(\"href\", linkHref);\n }\n }\n }\n\n handleImgSlotChange(e: Event) {\n const childNodes = (e.target as HTMLSlotElement).assignedNodes({ flatten: true }) as Array<HTMLOrSVGImageElement>;\n\n if (childNodes.length > 1) {\n return console.error(\"Multiple elements passed into SgdsCard's image slot\");\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n\n return html`\n <${tag} \n class=\"card ${classMap({\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-image\">\n\t\t\t\t\t<slot name=\"image\" @slotchange=${this.handleImgSlotChange}></slot>\n\t\t\t\t\t<slot name=\"image-badge\"></slot>\n\t\t\t\t\t<slot name=\"image-action\"></slot>\n </div>\n <div class=\"card-body\">\n\t\t\t\t\t<slot name=\"upper\"></slot>\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n <slot name=\"description\"></slot>\n <slot name=\"lower\"></slot>\n <slot name=\"footer\">\n <slot name=\"link\" @slotchange=${this.warnLinkSlotMisused}></slot>\n </slot>\n </div>\n </${tag}>\n `;\n }\n}\n\nexport default SgdsImageCard;\n"],"names":["imageCardStyle"],"mappings":";;;;;;;;;AASA;;;;;;;;;;;;;;AAcG;AACG,MAAO,aAAc,SAAQ,WAAW,CAAA;AAA9C,IAAA,WAAA,GAAA;;;QAY8C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGnB,IAAa,CAAA,aAAA,GAAsB,QAAQ,CAAC;;QAG5C,IAAe,CAAA,eAAA,GAAwB,SAAS,CAAC;KA+E7F;AA7EC,IAAA,IAAY,aAAa,GAAA;QACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;AAAE,YAAA,OAAO,IAAI,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAgB,CAAC;QAChD,QAAQ,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,OAAO,EAAuB;KACrE;AAED,IAAA,IAAY,eAAe,GAAA;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;AAAE,YAAA,OAAO,IAAI,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAgB,CAAC;QAClD,QAAQ,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,OAAO,EAAuB;KACrE;AAES,IAAA,YAAY,CAAC,iBAAyC,EAAA;;AAC9D,QAAA,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;QAEtC,IAAI,IAAI,CAAC,UAAU,CAA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AA,KAAA,CAAA,CAAA,CAAA;AAGR,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAmB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGnB,UAAA,CAAA;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAA6C,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAG5C,UAAA,CAAA;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAkD,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"sgds-image-card.js","sources":["../../../../src/components/ImageCard/sgds-image-card.ts"],"sourcesContent":["import { nothing, PropertyValueMap } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedElements, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport { CardImageAdjustment, CardImagePosition } from \"../Card/types\";\nimport type SgdsLink from \"../Link/sgds-link\";\nimport imageCardStyle from \"./image-card.css\";\n\n/**\n * @summary Image cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot image - Accepts an image or svg element of the card. Only a single element is allowed to be passed in.\n * @slot image-badge - Accepts an element for a badge, positioned at the top-left corner of the image.\n * @slot image-action - Accepts an element for an overflow or contextual menu, positioned at the top-right corner of the image. Typically used for action menu.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot footer - Footer area of the card. Accepts links, actions, or any custom content.\n * @slot link - (@deprecated) Deprecated since 3.3.2 in favour of `footer` slot.\n * Legacy slot for anchor elements. Use `footer` instead.\n */\nexport class SgdsImageCard extends CardElement {\n static styles = [...CardElement.styles, imageCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"image\", flatten: true })\n _imageNode!: Array<Node>;\n @queryAssignedElements({ slot: \"footer\" })\n private footerNode!: HTMLElement[];\n @queryAssignedElements({ slot: \"link\" })\n private linkNode!: HTMLAnchorElement[] | SgdsLink[];\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n /** Sets the image position of the card. Available options: `before`, `after` */\n @property({ type: String, reflect: true }) imagePosition: CardImagePosition = \"before\";\n\n /** Controls how the image is sized and aligned within the card. Available options: `default`, `padding around`, `aspect ratio` */\n @property({ type: String, reflect: true }) imageAdjustment: CardImageAdjustment = \"default\";\n\n private get linkSlotItems(): HTMLAnchorElement | null {\n if (!this.linkNode || this.linkNode.length === 0) return null;\n const element = this.linkNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n private get footerSlotItems(): HTMLAnchorElement | null {\n if (!this.footerNode || this.footerNode.length === 0) return null;\n const element = this.footerNode[0] as HTMLElement;\n return (element.querySelector(\"a\") || element) as HTMLAnchorElement;\n }\n\n protected firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n\n if (this._imageNode.length === 0) {\n const image = this.shadowRoot.querySelector(\".card-image\") as HTMLDivElement;\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n image.style.display = \"none\";\n if (this.noPadding) body.style.padding = \"0px\";\n }\n\n if (this.stretchedLink) {\n const footerAnchor = this.footerSlotItems;\n const linkAnchor = this.linkSlotItems;\n this._forwardAnchorAttributes(footerAnchor?.href ? footerAnchor : linkAnchor);\n }\n }\n\n handleImgSlotChange(e: Event) {\n const childNodes = (e.target as HTMLSlotElement).assignedNodes({ flatten: true }) as Array<HTMLOrSVGImageElement>;\n\n if (childNodes.length > 1) {\n return console.error(\"Multiple elements passed into SgdsCard's image slot\");\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n\n return html`\n <${tag} \n class=\"card ${classMap({\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-image\">\n\t\t\t\t\t<slot name=\"image\" @slotchange=${this.handleImgSlotChange}></slot>\n\t\t\t\t\t<slot name=\"image-badge\"></slot>\n\t\t\t\t\t<slot name=\"image-action\"></slot>\n </div>\n <div class=\"card-body\">\n\t\t\t\t\t<slot name=\"upper\"></slot>\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n <slot name=\"description\"></slot>\n <slot name=\"lower\"></slot>\n <slot name=\"footer\">\n <slot name=\"link\" @slotchange=${this.warnLinkSlotMisused}></slot>\n </slot>\n </div>\n </${tag}>\n `;\n }\n}\n\nexport default SgdsImageCard;\n"],"names":["imageCardStyle"],"mappings":";;;;;;;;;AASA;;;;;;;;;;;;;;AAcG;AACG,MAAO,aAAc,SAAQ,WAAW,CAAA;AAA9C,IAAA,WAAA,GAAA;;;QAY8C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGnB,IAAa,CAAA,aAAA,GAAsB,QAAQ,CAAC;;QAG5C,IAAe,CAAA,eAAA,GAAwB,SAAS,CAAC;KA0E7F;AAxEC,IAAA,IAAY,aAAa,GAAA;QACvB,IAAI,CAAC,IA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AI,EAAE,CAAC;AAC5B,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAEjB,UAAA,CAAA;AADP,IAAA,qBAAqB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACP,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAE3B,UAAA,CAAA;AADP,IAAA,qBAAqB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACY,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGR,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAmB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGnB,UAAA,CAAA;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAA6C,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAG5C,UAAA,CAAA;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAkD,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
@@ -22,14 +22,13 @@ var sgdsIcon = require('../Icon/sgds-icon.cjs.js');
22
22
  * @event sgds-first-step - Emitted on hide after animation has completed. Event is fired when firstStep method is called.
23
23
  * @event sgds-arrived - Emitted right after the activeStep has updated its state, when upcoming step has arrived. Call `getMethod()` on this event to get the current step's component.
24
24
  * @event sgds-reset - Emitted right before the step is reset to its defaultActiveStep. Event is fired when reset method is called.
25
- * @slot default - slot for sgds-step children
26
25
  *
27
26
  */
28
27
  class SgdsStepper extends sgdsElement["default"] {
29
28
  constructor() {
30
29
  super(...arguments);
31
- /** The metadata of stepper, type `IStepMetaData`. Deprecated: use sgds-step child components instead.
32
- * @deprecated Use sgds-step child components instead of the steps property
30
+ /** The metadata of stepper, type `IStepMetaData`, that consist of `stepHeader: string`, `component:unknown`, `iconName:string`. `stepHeader` is the name of the step and `component` is the content that should appear at the each step. `component` is set to `unknown` to allow users to pass in their desired component based on the framework of choice. e.g. pass in your own react/angular/vue component or it can also be a text content.
31
+ * It is required to populate this array to properly render the stepper. By default, stepper markers will render numbers. For icon stepper markers, pass the name of sgds icon via `iconName` key. `iconName` is optional.
33
32
  */
34
33
  this.steps = [];
35
34
  /** The current state of active step. Defaults to 0 */
@@ -38,56 +37,17 @@ class SgdsStepper extends sgdsElement["default"] {
38
37
  this.orientation = "horizontal";
39
38
  /** When true, the stepper's steps will be clickable */
40
39
  this.clickable = false;
41
- /** When true, the stepper's steps can only be clicked in a linear manner */
42
- this.linear = false;
43
40
  /** @internal Gets or sets the default activeStep used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
44
41
  this.defaultActiveStep = 0;
45
- this._totalSteps = 0;
46
- /** @internal Bound i-sgds-click handler for proper event listener removal */
47
- this._boundHandleItemClick = this._handleStepClick.bind(this);
48
- }
49
- connectedCallback() {
50
- super.connectedCallback();
51
- this._totalSteps = this.steps.length;
52
- this.addEventListener("i-sgds-click", this._boundHandleItemClick);
53
- }
54
- /** @internal */
55
- _handleSlotChange() {
56
- this._items = this._slotNodes;
57
- this._totalSteps = this._items.length;
58
- this._updateStepItems();
59
- }
60
- /** @internal Updates step item properties based on active step and clickable state */
61
- _updateStepItems() {
62
- if (this._items && this._items.length > 0) {
63
- this._items.forEach((item, index) => {
64
- item.stepIndex = index;
65
- item.active = this.activeStep === index;
66
- item._isCompleted = item.completed || this.activeStep > index;
67
- item.isClickable = this.linear
68
- ? !item.disabled && this.clickable && (this.activeStep - 1 == index || this.activeStep + 1 == index)
69
- : !item.disabled && this.clickable;
70
- item.orientation = this.orientation;
71
- if (this._items.length > 1) {
72
- item.isFirstOfType = index === 0;
73
- item.classList.toggle("last", index === this._items.length - 1);
74
- }
75
- });
76
- }
77
42
  }
78
43
  /** By default, it returns the corresponding component of the current activeStep as defined in the steps metadata. To get other components, pass in your desired step number as the parameter*/
79
44
  getComponent(step = this.activeStep) {
80
- var _a, _b;
81
- const items = this._slotNodes.length > 1 ? this._items : this.steps;
82
- if (items && items.length > 0) {
83
- return (_a = items[step]) === null || _a === void 0 ? void 0 : _a.component;
84
- }
85
- return (_b = this.steps[step]) === null || _b === void 0 ? void 0 : _b.component;
45
+ return this.steps[step].component;
86
46
  }
87
47
  /** Moves the active step forward one step */
88
48
  nextStep() {
89
49
  this.emit("sgds-next-step");
90
- if (this.activeStep < this._totalSteps - 1) {
50
+ if (this.activeStep < this.steps.length - 1) {
91
51
  this.activeStep++;
92
52
  }
93
53
  }
@@ -101,8 +61,8 @@ class SgdsStepper extends sgdsElement["default"] {
101
61
  /** Changes the active step to the last step */
102
62
  lastStep() {
103
63
  this.emit("sgds-last-step");
104
- if (this.activeStep !== this._totalSteps - 1) {
105
- this.activeStep = this._totalSteps - 1;
64
+ if (this.activeStep !== this.steps.length - 1) {
65
+ this.activeStep = this.steps.length - 1;
106
66
  }
107
67
  }
108
68
  /** Changes active step to the first step */
@@ -119,35 +79,21 @@ class SgdsStepper extends sgdsElement["default"] {
119
79
  }
120
80
  /**@internal */
121
81
  _onStepperItemClick(index) {
122
- this.activeStep = index;
82
+ //emit an event before moving to next step
83
+ if (this.activeStep > index) {
84
+ this.activeStep = index;
85
+ }
123
86
  }
124
87
  /**@internal */
125
88
  _handleActiveStepChange() {
126
- this._updateStepItems();
127
89
  this.emit("sgds-arrived");
128
90
  }
129
91
  /**@internal */
130
- _handleClickableChange() {
131
- this._updateStepItems();
132
- }
133
- /**@internal */
134
- _handleOrientationChange() {
135
- this._updateStepItems();
136
- }
137
- /**@internal */
138
92
  _handleKeyDown(event, index) {
139
93
  if (event.key === "Enter") {
140
94
  this._onStepperItemClick(index);
141
95
  }
142
96
  }
143
- /**@internal */
144
- _handleStepClick(e) {
145
- var _a;
146
- const event = e;
147
- e.stopPropagation();
148
- const stepIndex = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.stepIndex;
149
- this._onStepperItemClick(stepIndex);
150
- }
151
97
  render() {
152
98
  return lit.html `
153
99
  <div
@@ -156,8 +102,6 @@ class SgdsStepper extends sgdsElement["default"] {
156
102
  clickable: this.clickable
157
103
  })}"
158
104
  >
159
- <slot @slotchange=${this._handleSlotChange}></slot>
160
-
161
105
  ${this.steps.map(({ stepHeader: step, iconName }, index) => {
162
106
  return lit.html `
163
107
  <div class="stepper-item-container">
@@ -200,24 +144,12 @@ tslib.__decorate([
200
144
  tslib.__decorate([
201
145
  decorators_js.property({ type: Boolean, reflect: true })
202
146
  ], SgdsStepper.prototype, "clickable", void 0);
203
- tslib.__decorate([
204
- decorators_js.property({ type: Boolean, reflect: true })
205
- ], SgdsStepper.prototype, "linear", void 0);
206
147
  tslib.__decorate([
207
148
  defaultvalue.defaultValue("activeStep")
208
149
  ], SgdsStepper.prototype, "defaultActiveStep", void 0);
209
- tslib.__decorate([
210
- decorators_js.queryAssignedElements()
211
- ], SgdsStepper.prototype, "_slotNodes", void 0);
212
150
  tslib.__decorate([
213
151
  watch.watch("activeStep", { waitUntilFirstUpdate: true })
214
152
  ], SgdsStepper.prototype, "_handleActiveStepChange", null);
215
- tslib.__decorate([
216
- watch.watch("clickable", { waitUntilFirstUpdate: true })
217
- ], SgdsStepper.prototype, "_handleClickableChange", null);
218
- tslib.__decorate([
219
- watch.watch("orientation", { waitUntilFirstUpdate: true })
220
- ], SgdsStepper.prototype, "_handleOrientationChange", null);
221
153
 
222
154
  exports.SgdsStepper = SgdsStepper;
223
155
  exports["default"] = SgdsStepper;
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-stepper.cjs.js","sources":["../../../../src/components/Stepper/sgds-stepper.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property, queryAssignedElements } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport { watch } from \"../../utils/watch\";\nimport stepperStyle from \"./stepper.css\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\nimport { IStepMetaData } from \"./types\";\nimport type SgdsStep from \"./sgds-step\";\nexport type { IStepMetaData };\n\n/**\n * @summary Steppers are used to inform users which step they are at in a form or a process\n *\n * @event sgds-next-step - Emitted right before the next step is reached. Event is fired when nextStep method is called.\n * @event sgds-previous-step - Emitted right before the previous step is reached. Event is fired when previousStep method is called.\n * @event sgds-last-step - Emitted right before the last step is reached. Event is fired when lastStep method is called.\n * @event sgds-first-step - Emitted on hide after animation has completed. Event is fired when firstStep method is called.\n * @event sgds-arrived - Emitted right after the activeStep has updated its state, when upcoming step has arrived. Call `getMethod()` on this event to get the current step's component.\n * @event sgds-reset - Emitted right before the step is reset to its defaultActiveStep. Event is fired when reset method is called.\n * @slot default - slot for sgds-step children\n *\n */\nexport class SgdsStepper extends SgdsElement {\n static styles = [...SgdsElement.styles, stepperStyle];\n /** @internal */\n static dependencies = { \"sgds-icon\": SgdsIcon };\n /** The metadata of stepper, type `IStepMetaData`. Deprecated: use sgds-step child components instead.\n * @deprecated Use sgds-step child components instead of the steps property\n */\n @property({ type: Array })\n steps: IStepMetaData[] = [];\n\n /** The current state of active step. Defaults to 0 */\n @property({ type: Number, reflect: true })\n activeStep = 0;\n\n /** The orientation of stepper. By default, the stepper is of horizontal orientation */\n @property({ type: String, reflect: true }) orientation: StepperOrientation = \"horizontal\";\n\n /** When true, the stepper's steps will be clickable */\n @property({ type: Boolean, reflect: true }) clickable = false;\n\n /** When true, the stepper's steps can only be clicked in a linear manner */\n @property({ type: Boolean, reflect: true }) linear = false;\n\n /** @internal Gets or sets the default activeStep used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue(\"activeStep\")\n defaultActiveStep = 0;\n\n /** @internal */\n @queryAssignedElements() private _slotNodes!: SgdsStep[];\n\n /** @internal */\n private _items!: SgdsStep[];\n private _totalSteps = 0;\n\n /** @internal Bound i-sgds-click handler for proper event listener removal */\n private _boundHandleItemClick = this._handleStepClick.bind(this);\n\n connectedCallback() {\n super.connectedCallback();\n\n this._totalSteps = this.steps.length;\n this.addEventListener(\"i-sgds-click\", this._boundHandleItemClick);\n }\n\n /** @internal */\n private _handleSlotChange() {\n this._items = this._slotNodes;\n this._totalSteps = this._items.length;\n\n this._updateStepItems();\n }\n\n /** @internal Updates step item properties based on active step and clickable state */\n private _updateStepItems() {\n if (this._items && this._items.length > 0) {\n this._items.forEach((item, index) => {\n item.stepIndex = index;\n item.active = this.activeStep === index;\n item._isCompleted = item.completed || this.activeStep > index;\n item.isClickable = this.linear\n ? !item.disabled && this.clickable && (this.activeStep - 1 == index || this.activeStep + 1 == index)\n : !item.disabled && this.clickable;\n item.orientation = this.orientation;\n\n if (this._items.length > 1) {\n item.isFirstOfType = index === 0;\n item.classList.toggle(\"last\", index === this._items.length - 1);\n }\n });\n }\n }\n\n /** By default, it returns the corresponding component of the current activeStep as defined in the steps metadata. To get other components, pass in your desired step number as the parameter*/\n public getComponent(step: number = this.activeStep) {\n const items = this._slotNodes.length > 1 ? this._items : this.steps;\n if (items && items.length > 0) {\n return items[step]?.component;\n }\n return this.steps[step]?.component;\n }\n\n /** Moves the active step forward one step */\n public nextStep() {\n this.emit(\"sgds-next-step\");\n if (this.activeStep < this._totalSteps - 1) {\n this.activeStep++;\n }\n }\n\n /** Moves the active step back one step */\n public previousStep() {\n this.emit(\"sgds-previous-step\");\n\n if (this.activeStep > 0) {\n this.activeStep--;\n }\n }\n\n /** Changes the active step to the last step */\n public lastStep() {\n this.emit(\"sgds-last-step\");\n if (this.activeStep !== this._totalSteps - 1) {\n this.activeStep = this._totalSteps - 1;\n }\n }\n\n /** Changes active step to the first step */\n public firstStep() {\n this.emit(\"sgds-first-step\");\n if (this.activeStep > 0) {\n this.activeStep = 0;\n }\n }\n\n /** Resets the Stepper to its initial active step state */\n public reset() {\n this.emit(\"sgds-reset\");\n this.activeStep = this.defaultActiveStep;\n }\n\n /**@internal */\n _onStepperItemClick(index: number) {\n this.activeStep = index;\n }\n\n /**@internal */\n @watch(\"activeStep\", { waitUntilFirstUpdate: true })\n _handleActiveStepChange() {\n this._updateStepItems();\n this.emit(\"sgds-arrived\");\n }\n\n /**@internal */\n @watch(\"clickable\", { waitUntilFirstUpdate: true })\n _handleClickableChange() {\n this._updateStepItems();\n }\n\n /**@internal */\n @watch(\"orientation\", { waitUntilFirstUpdate: true })\n _handleOrientationChange() {\n this._updateStepItems();\n }\n\n /**@internal */\n _handleKeyDown(event: KeyboardEvent, index: number) {\n if (event.key === \"Enter\") {\n this._onStepperItemClick(index);\n }\n }\n\n /**@internal */\n _handleStepClick(e: Event) {\n const event = e as CustomEvent;\n e.stopPropagation();\n\n const stepIndex = event.detail?.stepIndex;\n this._onStepperItemClick(stepIndex);\n }\n\n render() {\n return html`\n <div\n class=\"stepper ${classMap({\n [`${this.orientation}`]: this.orientation,\n clickable: this.clickable\n })}\"\n >\n <slot @slotchange=${this._handleSlotChange}></slot>\n\n ${this.steps.map(({ stepHeader: step, iconName }, index) => {\n return html`\n <div class=\"stepper-item-container\">\n <div\n class=\"stepper-item ${classMap({\n \"is-active\": this.activeStep === index,\n \"is-completed\": this.activeStep > index,\n \"is-clickable\": this.clickable && this.activeStep > index\n })}\"\n tabindex=${this.clickable && this.activeStep > index ? \"0\" : \"-1\"}\n aria-current=${this.activeStep === index ? \"step\" : \"false\"}\n aria-disabled=${this.activeStep <= index ? \"true\" : \"false\"}\n @click=\"${this.clickable ? () => this._onStepperItemClick(index) : null}\"\n @keydown=${this.clickable ? (e: KeyboardEvent) => this._handleKeyDown(e, index) : null}\n >\n <div class=\"stepper-marker\">\n ${iconName ? html`<sgds-icon name=${iconName} size=\"md\"></sgds-icon>` : index + 1}\n </div>\n <div class=\"stepper-detail\">${step}</div>\n </div>\n </div>\n `;\n })}\n </div>\n `;\n }\n}\n\nexport type StepperOrientation = \"horizontal\" | \"vertical\";\n\nexport default SgdsStepper;\n"],"names":["SgdsElement","html","classMap","stepperStyle","SgdsIcon","__decorate","property","defaultValue","queryAssignedElements","watch"],"mappings":";;;;;;;;;;;;;;;AAYA;;;;;;;;;;;AAWG;AACG,MAAO,WAAY,SAAQA,sBAAW,CAAA;AAA5C,IAAA,WAAA,GAAA;;AAIE;;AAEG;QAEH,IAAK,CAAA,KAAA,GAAoB,EAAE,CAAC;;QAI5B,IAAU,CAAA,UAAA,GAAG,CAAC,CAAC;;QAG4B,IAAW,CAAA,WAAA,GAAuB,YAAY,CAAC;;QAG9C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGlB,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;;QAI3D,IAAiB,CAAA,iBAAA,GAAG,CAAC,CAAC;QAOd,IAAW,CAAA,WAAA,GAAG,CAAC,CAAC;;QAGhB,IAAqB,CAAA,qBAAA,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAiKlE;IA/JC,iBAAiB,GAAA;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QACrC,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;KACnE;;IAGO,iBAAiB,GAAA;AACvB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;QAC9B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAEtC,IAAI,CAAC,gBAAgB,EAAE,CAAC;KACzB;;IAGO,gBAAgB,GAAA;AACtB,QAAA,IAAI,IAAI,CAAC,MAAM,I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CAAC,WAAW,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAGlD,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,wBAAA,EAAA,IAAA,CAAA,CAAA;AAIDJ,gBAAA,CAAA;IADCI,WAAK,CAAC,aAAa,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAGpD,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,0BAAA,EAAA,IAAA,CAAA;;;;;"}
1
+ {"version":3,"file":"sgds-stepper.cjs.js","sources":["../../../../src/components/Stepper/sgds-stepper.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport { watch } from \"../../utils/watch\";\nimport stepperStyle from \"./stepper.css\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\nimport { IStepMetaData } from \"./types\";\nexport type { IStepMetaData };\n/**\n * @summary Steppers are used to inform users which step they are at in a form or a process\n *\n * @event sgds-next-step - Emitted right before the next step is reached. Event is fired when nextStep method is called.\n * @event sgds-previous-step - Emitted right before the previous step is reached. Event is fired when previousStep method is called.\n * @event sgds-last-step - Emitted right before the last step is reached. Event is fired when lastStep method is called.\n * @event sgds-first-step - Emitted on hide after animation has completed. Event is fired when firstStep method is called.\n * @event sgds-arrived - Emitted right after the activeStep has updated its state, when upcoming step has arrived. Call `getMethod()` on this event to get the current step's component.\n * @event sgds-reset - Emitted right before the step is reset to its defaultActiveStep. Event is fired when reset method is called.\n *\n */\nexport class SgdsStepper extends SgdsElement {\n static styles = [...SgdsElement.styles, stepperStyle];\n /** @internal */\n static dependencies = { \"sgds-icon\": SgdsIcon };\n /** The metadata of stepper, type `IStepMetaData`, that consist of `stepHeader: string`, `component:unknown`, `iconName:string`. `stepHeader` is the name of the step and `component` is the content that should appear at the each step. `component` is set to `unknown` to allow users to pass in their desired component based on the framework of choice. e.g. pass in your own react/angular/vue component or it can also be a text content.\n * It is required to populate this array to properly render the stepper. By default, stepper markers will render numbers. For icon stepper markers, pass the name of sgds icon via `iconName` key. `iconName` is optional.\n */\n @property({ type: Array })\n steps: IStepMetaData[] = [];\n\n /** The current state of active step. Defaults to 0 */\n @property({ type: Number, reflect: true })\n activeStep = 0;\n\n /** The orientation of stepper. By default, the stepper is of horizontal orientation */\n @property({ type: String, reflect: true }) orientation: StepperOrientation = \"horizontal\";\n\n /** When true, the stepper's steps will be clickable */\n @property({ type: Boolean, reflect: true }) clickable = false;\n\n /** @internal Gets or sets the default activeStep used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue(\"activeStep\")\n defaultActiveStep = 0;\n\n /** By default, it returns the corresponding component of the current activeStep as defined in the steps metadata. To get other components, pass in your desired step number as the parameter*/\n public getComponent(step: number = this.activeStep) {\n return this.steps[step].component;\n }\n /** Moves the active step forward one step */\n public nextStep() {\n this.emit(\"sgds-next-step\");\n if (this.activeStep < this.steps.length - 1) {\n this.activeStep++;\n }\n }\n\n /** Moves the active step back one step */\n public previousStep() {\n this.emit(\"sgds-previous-step\");\n\n if (this.activeStep > 0) {\n this.activeStep--;\n }\n }\n\n /** Changes the active step to the last step */\n public lastStep() {\n this.emit(\"sgds-last-step\");\n if (this.activeStep !== this.steps.length - 1) {\n this.activeStep = this.steps.length - 1;\n }\n }\n\n /** Changes active step to the first step */\n public firstStep() {\n this.emit(\"sgds-first-step\");\n if (this.activeStep > 0) {\n this.activeStep = 0;\n }\n }\n\n /** Resets the Stepper to its initial active step state */\n public reset() {\n this.emit(\"sgds-reset\");\n this.activeStep = this.defaultActiveStep;\n }\n\n /**@internal */\n _onStepperItemClick(index: number) {\n //emit an event before moving to next step\n if (this.activeStep > index) {\n this.activeStep = index;\n }\n }\n\n /**@internal */\n @watch(\"activeStep\", { waitUntilFirstUpdate: true })\n _handleActiveStepChange() {\n this.emit(\"sgds-arrived\");\n }\n\n /**@internal */\n _handleKeyDown(event: KeyboardEvent, index: number) {\n if (event.key === \"Enter\") {\n this._onStepperItemClick(index);\n }\n }\n\n render() {\n return html`\n <div\n class=\"stepper ${classMap({\n [`${this.orientation}`]: this.orientation,\n clickable: this.clickable\n })}\"\n >\n ${this.steps.map(({ stepHeader: step, iconName }, index) => {\n return html`\n <div class=\"stepper-item-container\">\n <div\n class=\"stepper-item ${classMap({\n \"is-active\": this.activeStep === index,\n \"is-completed\": this.activeStep > index,\n \"is-clickable\": this.clickable && this.activeStep > index\n })}\"\n tabindex=${this.clickable && this.activeStep > index ? \"0\" : \"-1\"}\n aria-current=${this.activeStep === index ? \"step\" : \"false\"}\n aria-disabled=${this.activeStep <= index ? \"true\" : \"false\"}\n @click=\"${this.clickable ? () => this._onStepperItemClick(index) : null}\"\n @keydown=${this.clickable ? (e: KeyboardEvent) => this._handleKeyDown(e, index) : null}\n >\n <div class=\"stepper-marker\">\n ${iconName ? html`<sgds-icon name=${iconName} size=\"md\"></sgds-icon>` : index + 1}\n </div>\n <div class=\"stepper-detail\">${step}</div>\n </div>\n </div>\n `;\n })}\n </div>\n `;\n }\n}\n\nexport type StepperOrientation = \"horizontal\" | \"vertical\";\n\nexport default SgdsStepper;\n"],"names":["SgdsElement","html","classMap","stepperStyle","SgdsIcon","__decorate","property","defaultValue","watch"],"mappings":";;;;;;;;;;;;;;;AAUA;;;;;;;;;;AAUG;AACG,MAAO,WAAY,SAAQA,sBAAW,CAAA;AAA5C,IAAA,WAAA,GAAA;;AAIE;;AAEG;QAEH,IAAK,CAAA,KAAA,GAAoB,EAAE,CAAC;;QAI5B,IAAU,CAAA,UAAA,GAAG,CAAC,CAAC;;QAG4B,IAAW,CAAA,WAAA,GAAuB,YAAY,CAAC;;QAG9C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAI9D,IAAiB,CAAA,iBAAA,GAAG,CAAC,CAAC;KAoGvB;;AAjGQ,IAAA,YAAY,CAAC,IAAA,GAAe,IAAI,CAAC,UAA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