@usecapsule/core-components 3.4.1 → 3.5.1-dev.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. package/css/capsule-core.css +1 -1
  2. package/dist/capsule/capsule.esm.js +1 -1
  3. package/dist/capsule/capsule.esm.js.map +1 -1
  4. package/dist/capsule/index.esm.js +1 -1
  5. package/dist/capsule/index.esm.js.map +1 -1
  6. package/dist/capsule/p-286db996.js +2 -0
  7. package/dist/capsule/p-286db996.js.map +1 -0
  8. package/dist/capsule/{p-f0cd0482.entry.js → p-41bc3c58.entry.js} +2 -2
  9. package/dist/capsule/p-4da7328c.entry.js +20 -0
  10. package/dist/capsule/p-4da7328c.entry.js.map +1 -0
  11. package/dist/capsule/p-52bb30d8.entry.js +2 -0
  12. package/dist/capsule/p-52bb30d8.entry.js.map +1 -0
  13. package/dist/capsule/{p-5965b15e.entry.js → p-5cd62456.entry.js} +2 -2
  14. package/dist/capsule/{p-b96e357a.entry.js → p-7dff759e.entry.js} +2 -2
  15. package/dist/capsule/p-7dff759e.entry.js.map +1 -0
  16. package/dist/capsule/p-ab7b3141.entry.js +2 -0
  17. package/dist/capsule/{p-1bd11889.entry.js → p-c9e61114.entry.js} +2 -2
  18. package/dist/capsule/{p-9e64a60e.entry.js → p-d4bdb369.entry.js} +2 -2
  19. package/dist/capsule/{p-d165df27.entry.js → p-de2a16e4.entry.js} +2 -2
  20. package/dist/cjs/capsule.cjs.js +1 -1
  21. package/dist/cjs/cpsl-alert_34.cjs.entry.js +553 -54
  22. package/dist/cjs/cpsl-alert_34.cjs.entry.js.map +1 -1
  23. package/dist/cjs/cpsl-col.cjs.entry.js +1 -1
  24. package/dist/cjs/cpsl-grid.cjs.entry.js +2 -2
  25. package/dist/cjs/cpsl-hero.cjs.entry.js +8 -4
  26. package/dist/cjs/cpsl-hero.cjs.entry.js.map +1 -1
  27. package/dist/cjs/cpsl-identicon.cjs.entry.js +76 -30
  28. package/dist/cjs/cpsl-identicon.cjs.entry.js.map +1 -1
  29. package/dist/cjs/cpsl-info-box.cjs.entry.js +1 -1
  30. package/dist/cjs/cpsl-modal-v2.cjs.entry.js +1 -1
  31. package/dist/cjs/cpsl-nav-button.cjs.entry.js +1 -1
  32. package/dist/cjs/cpsl-row.cjs.entry.js +1 -1
  33. package/dist/cjs/index.cjs.js +2 -0
  34. package/dist/cjs/index.cjs.js.map +1 -1
  35. package/dist/cjs/loader.cjs.js +1 -1
  36. package/dist/cjs/prand-a35ea6b2.js +209 -0
  37. package/dist/cjs/prand-a35ea6b2.js.map +1 -0
  38. package/dist/collection/assets/icons/alert-triangle.svg +5 -0
  39. package/dist/collection/assets/icons/arrow-circle-down-filled.svg +5 -0
  40. package/dist/collection/assets/icons/check-circle-filled.svg +5 -0
  41. package/dist/collection/assets/icons/chevron-down.svg +5 -0
  42. package/dist/collection/assets/icons/chevron-selector-vertical.svg +5 -0
  43. package/dist/collection/assets/icons/cosmos.svg +12 -0
  44. package/dist/collection/assets/icons/credit-card-02.svg +5 -0
  45. package/dist/collection/assets/icons/edit-02.svg +5 -0
  46. package/dist/collection/assets/icons/ethereum.svg +4 -0
  47. package/dist/collection/assets/icons/index.js +375 -1
  48. package/dist/collection/assets/icons/index.js.map +1 -1
  49. package/dist/collection/assets/icons/plus.svg +5 -0
  50. package/dist/collection/assets/icons/polygon.svg +5 -0
  51. package/dist/collection/assets/icons/solana.svg +19 -0
  52. package/dist/collection/assets/icons/star-04-filled.svg +3 -0
  53. package/dist/collection/assets/icons/user.svg +5 -0
  54. package/dist/collection/assets/images/index.js +5 -1
  55. package/dist/collection/assets/images/index.js.map +1 -1
  56. package/dist/collection/components/cpsl-alert/cpsl-alert.css +23 -2
  57. package/dist/collection/components/cpsl-alert/cpsl-alert.js +21 -3
  58. package/dist/collection/components/cpsl-alert/cpsl-alert.js.map +1 -1
  59. package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js +3 -3
  60. package/dist/collection/components/cpsl-auth-modal/cpsl-auth-modal.css +6 -1
  61. package/dist/collection/components/cpsl-avatar/cpsl-avatar.js +1 -1
  62. package/dist/collection/components/cpsl-button/cpsl-button.css +1 -1
  63. package/dist/collection/components/cpsl-button/cpsl-button.js +2 -2
  64. package/dist/collection/components/cpsl-button-group/cpsl-button-group.js +1 -1
  65. package/dist/collection/components/cpsl-card/cpsl-card.js +1 -1
  66. package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.js +1 -1
  67. package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +2 -2
  68. package/dist/collection/components/cpsl-col/cpsl-col.js +1 -1
  69. package/dist/collection/components/cpsl-divider/cpsl-divider.js +1 -1
  70. package/dist/collection/components/cpsl-drawer/cpsl-drawer.js +2 -2
  71. package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +1 -1
  72. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js +20 -1
  73. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js.map +1 -1
  74. package/dist/collection/components/cpsl-grid/cpsl-grid.js +2 -2
  75. package/dist/collection/components/cpsl-hero/cpsl-hero.css +4 -4
  76. package/dist/collection/components/cpsl-hero/cpsl-hero.js +2 -2
  77. package/dist/collection/components/cpsl-hero/cpsl-hero.js.map +1 -1
  78. package/dist/collection/components/cpsl-icon/cpsl-icon.js +2 -2
  79. package/dist/collection/components/cpsl-icon-group/cpsl-icon-group.js +1 -1
  80. package/dist/collection/components/cpsl-identicon/cpsl-identicon.css +17 -10
  81. package/dist/collection/components/cpsl-identicon/cpsl-identicon.js +101 -36
  82. package/dist/collection/components/cpsl-identicon/cpsl-identicon.js.map +1 -1
  83. package/dist/collection/components/cpsl-identicon/cpsl-identicon.stories.js +1 -1
  84. package/dist/collection/components/cpsl-identicon/cpsl-identicon.stories.js.map +1 -1
  85. package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +1 -1
  86. package/dist/collection/components/cpsl-input/cpsl-input.js +22 -2
  87. package/dist/collection/components/cpsl-input/cpsl-input.js.map +1 -1
  88. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js +1 -1
  89. package/dist/collection/components/cpsl-nav-button/cpsl-nav-button.js +1 -1
  90. package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.js +1 -1
  91. package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +1 -1
  92. package/dist/collection/components/cpsl-pagination/cpsl-pagination.js +1 -1
  93. package/dist/collection/components/cpsl-pill/cpsl-pill.js +1 -1
  94. package/dist/collection/components/cpsl-popover/cpsl-popover.js +6 -3
  95. package/dist/collection/components/cpsl-popover/cpsl-popover.js.map +1 -1
  96. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +1 -1
  97. package/dist/collection/components/cpsl-radio/cpsl-radio.js +1 -1
  98. package/dist/collection/components/cpsl-row/cpsl-row.js +1 -1
  99. package/dist/collection/components/cpsl-select/cpsl-select.css +1 -0
  100. package/dist/collection/components/cpsl-select/cpsl-select.js +45 -2
  101. package/dist/collection/components/cpsl-select/cpsl-select.js.map +1 -1
  102. package/dist/collection/components/cpsl-select-item/cpsl-select-item.js +1 -1
  103. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +3 -3
  104. package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +2 -2
  105. package/dist/collection/components/cpsl-switch/cpsl-switch.js +1 -1
  106. package/dist/collection/components/cpsl-tab/cpsl-tab.css +4 -4
  107. package/dist/collection/components/cpsl-tab/cpsl-tab.js +32 -1
  108. package/dist/collection/components/cpsl-tab/cpsl-tab.js.map +1 -1
  109. package/dist/collection/components/cpsl-tab/tab-interface.js.map +1 -1
  110. package/dist/collection/components/cpsl-table/cpsl-table.js +1 -1
  111. package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +16 -1
  112. package/dist/collection/components/cpsl-tabs/cpsl-tabs.js.map +1 -1
  113. package/dist/collection/components/cpsl-text/cpsl-text.js +9 -8
  114. package/dist/collection/components/cpsl-text/cpsl-text.js.map +1 -1
  115. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +2 -2
  116. package/dist/collection/index.js +1 -0
  117. package/dist/collection/index.js.map +1 -1
  118. package/dist/collection/lib/prando.js +187 -0
  119. package/dist/collection/lib/prando.js.map +1 -0
  120. package/dist/collection/utils/prand.js +16 -0
  121. package/dist/collection/utils/prand.js.map +1 -0
  122. package/dist/esm/capsule.js +1 -1
  123. package/dist/esm/cpsl-alert_34.entry.js +553 -54
  124. package/dist/esm/cpsl-alert_34.entry.js.map +1 -1
  125. package/dist/esm/cpsl-col.entry.js +1 -1
  126. package/dist/esm/cpsl-grid.entry.js +2 -2
  127. package/dist/esm/cpsl-hero.entry.js +8 -4
  128. package/dist/esm/cpsl-hero.entry.js.map +1 -1
  129. package/dist/esm/cpsl-identicon.entry.js +76 -30
  130. package/dist/esm/cpsl-identicon.entry.js.map +1 -1
  131. package/dist/esm/cpsl-info-box.entry.js +1 -1
  132. package/dist/esm/cpsl-modal-v2.entry.js +1 -1
  133. package/dist/esm/cpsl-nav-button.entry.js +1 -1
  134. package/dist/esm/cpsl-row.entry.js +1 -1
  135. package/dist/esm/index.js +1 -0
  136. package/dist/esm/index.js.map +1 -1
  137. package/dist/esm/loader.js +1 -1
  138. package/dist/esm/prand-c8323494.js +205 -0
  139. package/dist/esm/prand-c8323494.js.map +1 -0
  140. package/dist/scripts/buildAssets.js +9 -9
  141. package/dist/scripts/buildAssets.js.map +1 -1
  142. package/dist/types/assets/icons/index.d.ts +14 -0
  143. package/dist/types/components/cpsl-alert/cpsl-alert.d.ts +4 -0
  144. package/dist/types/components/cpsl-file-upload/cpsl-file-upload.d.ts +5 -0
  145. package/dist/types/components/cpsl-identicon/cpsl-identicon.d.ts +5 -4
  146. package/dist/types/components/cpsl-input/cpsl-input.d.ts +4 -0
  147. package/dist/types/components/cpsl-select/cpsl-select.d.ts +10 -0
  148. package/dist/types/components/cpsl-tab/cpsl-tab.d.ts +7 -1
  149. package/dist/types/components/cpsl-tab/tab-interface.d.ts +3 -0
  150. package/dist/types/components/cpsl-tabs/cpsl-tabs.d.ts +2 -0
  151. package/dist/types/components.d.ts +51 -8
  152. package/dist/types/index.d.ts +1 -0
  153. package/dist/types/lib/prando.d.ts +92 -0
  154. package/dist/types/utils/prand.d.ts +3 -0
  155. package/package.json +4 -5
  156. package/dist/capsule/p-5d62e610.entry.js +0 -2
  157. package/dist/capsule/p-5d62e610.entry.js.map +0 -1
  158. package/dist/capsule/p-afbb1e6f.entry.js +0 -20
  159. package/dist/capsule/p-afbb1e6f.entry.js.map +0 -1
  160. package/dist/capsule/p-b96e357a.entry.js.map +0 -1
  161. package/dist/capsule/p-cfc382c0.entry.js +0 -2
  162. /package/dist/capsule/{p-f0cd0482.entry.js.map → p-41bc3c58.entry.js.map} +0 -0
  163. /package/dist/capsule/{p-5965b15e.entry.js.map → p-5cd62456.entry.js.map} +0 -0
  164. /package/dist/capsule/{p-cfc382c0.entry.js.map → p-ab7b3141.entry.js.map} +0 -0
  165. /package/dist/capsule/{p-1bd11889.entry.js.map → p-c9e61114.entry.js.map} +0 -0
  166. /package/dist/capsule/{p-9e64a60e.entry.js.map → p-d4bdb369.entry.js.map} +0 -0
  167. /package/dist/capsule/{p-d165df27.entry.js.map → p-de2a16e4.entry.js.map} +0 -0
  168. /package/dist/types/Users/{norwood/capsule-repos → taylorbosch/Documents/GitHub/Capsule}/web-sdk/packages/core-components/.stencil/scripts/buildAssets.d.ts +0 -0
@@ -33,12 +33,12 @@ export class CpslDrawer {
33
33
  const setHeight = this.anchor === 'top' || this.anchor === 'bottom';
34
34
  const startingAnchor = (_a = `${this.anchorPosition}px`) !== null && _a !== void 0 ? _a : '0px';
35
35
  const size = this.size === 'auto' ? 'auto' : `${this.size}px`;
36
- return (h(Host, { key: 'ef38766c4e22cdb6496bf62611215ce7fbc8abc1', style: Object.assign({ width: setHeight ? '100vw' : size, height: setHeight ? size : '100vh', transitionDuration: `${this.showTransition ? this.transitionDuration : 0}s`, transitionTimingFunction: `${this.transitionFunction}`, [this.anchor]: this.open || this.variant === 'permanent' ? startingAnchor : this.closedAnchorPosition, opacity: this.closedAnchorPosition === undefined ? '0' : '1' }, (this.zIndexOverride ? { zIndex: `${this.zIndexOverride}` } : {})), class: {
36
+ return (h(Host, { key: '81d454f0a4532e333880f4e37a79545ee5710536', style: Object.assign({ width: setHeight ? '100vw' : size, height: setHeight ? size : '100vh', transitionDuration: `${this.showTransition ? this.transitionDuration : 0}s`, transitionTimingFunction: `${this.transitionFunction}`, [this.anchor]: this.open || this.variant === 'permanent' ? startingAnchor : this.closedAnchorPosition, opacity: this.closedAnchorPosition === undefined ? '0' : '1' }, (this.zIndexOverride ? { zIndex: `${this.zIndexOverride}` } : {})), class: {
37
37
  top: this.anchor === 'top',
38
38
  bottom: this.anchor === 'bottom',
39
39
  left: this.anchor === 'left',
40
40
  right: this.anchor === 'right',
41
- } }, this.variant === 'temporary' && !this.noOverlay && h("cpsl-overlay", { key: '7aa68b6104536d6fb29164c396179aa4f287ce97', open: this.open, zIndexOverride: DEFAULT_Z_INDICES.modal + 1 }), h("div", { key: '5049fe95873339bb4877728c49e0eda4d3158397', id: "container", class: "container", part: "container" }, h("slot", { key: 'c6d76fa8b8e47828c472ed9b876faf49c68a8a29' }))));
41
+ } }, this.variant === 'temporary' && !this.noOverlay && h("cpsl-overlay", { key: '21fdc68cd01c652b7a9f8e1d624027f4051fdb47', open: this.open, zIndexOverride: DEFAULT_Z_INDICES.modal + 1 }), h("div", { key: '085ba3bf2b57ceeb5615c42816e7a0f8758eeeb0', id: "container", class: "container", part: "container" }, h("slot", { key: 'bd8517779864cf35bc30b33597b27a43c749ba1f' }))));
42
42
  }
43
43
  static get is() { return "cpsl-drawer"; }
44
44
  static get encapsulation() { return "shadow"; }
@@ -94,7 +94,7 @@ export class CpslDropdown {
94
94
  }
95
95
  render() {
96
96
  var _a, _b, _c;
97
- return (h(Host, { key: '351276cd3f2f3170a074810279edefb3880b1e3e' }, h("button", { key: 'c73281596b3cb5ea374721b474357cba751eb112', class: "dropdown-button", onClick: this.toggleDropdown }, `${((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.selectedLabel) || ((_b = this.selectedItem) === null || _b === void 0 ? void 0 : _b.label)} ${(_c = this.selectedItem) === null || _c === void 0 ? void 0 : _c.value}`, h("div", { key: 'af68dc8729ed048ee14b49ba756b115e414feb3e', class: `chevron ${this.isOpen ? '' : 'closed'}`, innerHTML: Icons['chevronUp'] })), h("ul", { key: 'dc2f7f50a072af503d81ca77e543571871647b5d', class: { 'dropdown-options': true, 'open': this.isOpen }, style: { width: this.width } }, this.hasCpslSearch && (h("li", { key: '7e2e9270927bcdac083849389e9423d502fec40b', class: "search-bar" }, h("input", { key: '003e9aae15f7c9e5b11fa2aa3f9aeb93c1492a04', type: "text", placeholder: "Search...", value: this.searchQuery, onInput: this.handleSearchQueryChange }))), this.filteredItems.map(item => (h("li", { onClick: this.handleItemSelect(item) }, h("span", { innerHTML: Icons[item.icon] }), item.label, " ", h("span", { class: "dropdown-value" }, item.value)))))));
97
+ return (h(Host, { key: 'a997453b8690196f125bcf96fd94d728e645cd9e' }, h("button", { key: '0be8f5b0b6fcb3a27a5885205c0f585a68dc1bb9', class: "dropdown-button", onClick: this.toggleDropdown }, `${((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.selectedLabel) || ((_b = this.selectedItem) === null || _b === void 0 ? void 0 : _b.label)} ${(_c = this.selectedItem) === null || _c === void 0 ? void 0 : _c.value}`, h("div", { key: 'f324edfdd97304de361a0ccd2bec793af25d3aa3', class: `chevron ${this.isOpen ? '' : 'closed'}`, innerHTML: Icons['chevronUp'] })), h("ul", { key: 'e1a3a097abb0633bd33caefabce016e2308f1ac0', class: { 'dropdown-options': true, 'open': this.isOpen }, style: { width: this.width } }, this.hasCpslSearch && (h("li", { key: '517c74f9f94df623206d8969a32d894b854f95a4', class: "search-bar" }, h("input", { key: '28ed686f30069ecb92dd0ee1852a9b9f94a98264', type: "text", placeholder: "Search...", value: this.searchQuery, onInput: this.handleSearchQueryChange }))), this.filteredItems.map(item => (h("li", { onClick: this.handleItemSelect(item) }, h("span", { innerHTML: Icons[item.icon] }), item.label, " ", h("span", { class: "dropdown-value" }, item.value)))))));
98
98
  }
99
99
  static get is() { return "cpsl-dropdown"; }
100
100
  static get encapsulation() { return "shadow"; }
@@ -91,6 +91,7 @@ export class CpslFileUpload {
91
91
  this.dragError = undefined;
92
92
  this.isUploading = undefined;
93
93
  this.uploadError = undefined;
94
+ this.disabled = false;
94
95
  this.errorText = undefined;
95
96
  this.externalFilename = undefined;
96
97
  this.externalSrc = undefined;
@@ -115,7 +116,7 @@ export class CpslFileUpload {
115
116
  }
116
117
  render() {
117
118
  var _a, _b, _c;
118
- return (h(Host, { key: '18e0096b27a8b805ee94f525ace13457349f16f3' }, this.label && (h("label", { key: '22a099ae4179b2cead6c9835123bcf4e365833e9', class: "label", htmlFor: this.inputId }, this.label, this.required ? '*' : ' ', !this.required && this.showOptionalLabel ? h("span", { class: "optional-label" }, "(optional)") : '')), h("slot", { key: 'fc02c2a0aa82d896d50045cfc10f45cf3d86e321', name: "label" }), h("div", { key: '31e50d9d7249f4700d33a9164b39050d8909efba', class: { 'container': true, 'error': Boolean(this.errorText), 'drag': this.dragOver, 'drag-error': this.dragError } }, h("div", { key: '9546b0675d270df3a24fa3cd6ee88fd4871b55de', class: { 'label-container': true } }, h("slot", { key: 'd9c1581dbad76b3ef0b1b90b8b455d0c0691ed89', name: "left-content" })), h("div", { key: 'f97421c4e415b1b5e634d494eebf964d12ee206c', class: { 'file-container': true } }, this.FileContent), h("input", { key: '5e84df74b088c43b5734118eae1de926f5c3cc70', id: this.inputId, type: "file", accept: (_b = (_a = this.fileTypes) === null || _a === void 0 ? void 0 : _a.join(', ')) !== null && _b !== void 0 ? _b : '*', files: this.file ? [this.file] : undefined, onDrop: this.handleDrop, onDragEnter: this.handleDragEnter, onDragLeave: this.handleDragLeave, onChange: this.handleInputChange })), (this.errorText || this.helperText) && (h("div", { key: '146a25dc2a19ed98649e7af450b700c4009975c9', class: { 'helper-text-container': true, 'error-text': Boolean(this.errorText) } }, h("span", { key: '83df60cdc393902f62e9766dc06ea0065aca11fe' }, (_c = this.errorText) !== null && _c !== void 0 ? _c : this.helperText)))));
119
+ return (h(Host, { key: '521ca35901a009b303650d7446e1f148930d7fe3' }, this.label && (h("label", { key: '94c58691decea8455a254698ec8fd27baba260ca', class: "label", htmlFor: this.inputId }, this.label, this.required ? '*' : ' ', !this.required && this.showOptionalLabel ? h("span", { class: "optional-label" }, "(optional)") : '')), h("slot", { key: 'cf7e80e4c4a1e48b4f4efddfe4e8eb0f4a31ed4b', name: "label" }), h("div", { key: '35f1707b3c8d1f1c939d9312b541f32edfc424d1', class: { 'container': true, 'error': Boolean(this.errorText), 'drag': this.dragOver, 'drag-error': this.dragError } }, h("div", { key: '327f71aaaa7d4920a62118ea956c4c128907fae6', class: { 'label-container': true } }, h("slot", { key: '0c4891ffb0c9d49e2b5b09c3bdbc8d5b2ed3ff2d', name: "left-content" })), h("div", { key: '47dc7cc569d860dc07478c2782c62a0d25b3df07', class: { 'file-container': true } }, this.FileContent), h("input", { key: '809568bfed82463cda7851d3717187112cff708b', id: this.inputId, type: "file", accept: (_b = (_a = this.fileTypes) === null || _a === void 0 ? void 0 : _a.join(', ')) !== null && _b !== void 0 ? _b : '*', files: this.file ? [this.file] : undefined, onDrop: this.handleDrop, onDragEnter: this.handleDragEnter, onDragLeave: this.handleDragLeave, onChange: this.handleInputChange, disabled: this.disabled })), (this.errorText || this.helperText) && (h("div", { key: '6f06cba54f65d903b3d22e015e694a154b189df7', class: { 'helper-text-container': true, 'error-text': Boolean(this.errorText) } }, h("span", { key: '2103ca2366b9a7827c42302cea3fa8d8c71bc50b' }, (_c = this.errorText) !== null && _c !== void 0 ? _c : this.helperText)))));
119
120
  }
120
121
  static get is() { return "cpsl-file-upload"; }
121
122
  static get encapsulation() { return "shadow"; }
@@ -131,6 +132,24 @@ export class CpslFileUpload {
131
132
  }
132
133
  static get properties() {
133
134
  return {
135
+ "disabled": {
136
+ "type": "boolean",
137
+ "mutable": false,
138
+ "complexType": {
139
+ "original": "boolean",
140
+ "resolved": "boolean",
141
+ "references": {}
142
+ },
143
+ "required": false,
144
+ "optional": true,
145
+ "docs": {
146
+ "tags": [],
147
+ "text": "If the input is disabled.\nDefault is: false."
148
+ },
149
+ "attribute": "disabled",
150
+ "reflect": true,
151
+ "defaultValue": "false"
152
+ },
134
153
  "errorText": {
135
154
  "type": "string",
136
155
  "mutable": false,
@@ -1 +1 @@
1
- {"version":3,"file":"cpsl-file-upload.js","sourceRoot":"","sources":["../../../../src/components/cpsl-file-upload/cpsl-file-upload.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAgB,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOxG,MAAM,OAAO,cAAc;;QAGjB,YAAO,GAAG,oBAAoB,QAAQ,EAAE,EAAE,CAAC;QA+E3C,eAAU,GAAG,CAAO,EAAa,EAAE,EAAE;;YAC3C,EAAE,CAAC,cAAc,EAAE,CAAC;YAEpB,MAAM,IAAI,GAAG,MAAA,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,0CAAG,CAAC,CAAC,CAAC;YAEpD,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC9B,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC;YAED,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YAEvB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3B,CAAC,CAAA,CAAC;QAEM,oBAAe,GAAG,CAAC,EAAa,EAAE,EAAE;;YAC1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,CAAC,SAAS,EAC1C,MAAM,EAAE,IAAI,CAAC,UAAU,EACvB,WAAW,EAAE,IAAI,CAAC,eAAe,EACjC,WAAW,EAAE,IAAI,CAAC,eAAe,EACjC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,GAChC,CACE;YACL,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CACtC,4DAAK,KAAK,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;gBAClF,+DAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAI,CAAC,UAAU,CAAQ,CAC5C,CACP,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,QAAQ,GAAG,CAAC,CAAC","sourcesContent":["import { Component, Host, Prop, Event, h, EventEmitter, State, Fragment, Element } from '@stencil/core';\n\n@Component({\n tag: 'cpsl-file-upload',\n styleUrl: 'cpsl-file-upload.scss',\n shadow: true,\n})\nexport class CpslFileUpload {\n @Element() el!: HTMLCpslFileUploadElement;\n\n private inputId = `cpsl-file-upload-${inputIds++}`;\n\n @State() file?: File;\n @State() dragOver?: boolean;\n @State() dragError?: boolean;\n @State() isUploading?: boolean;\n @State() uploadError?: boolean;\n\n /**\n * Error text to show below the input. If this is provided the input will enter an error state.\n */\n @Prop() errorText?: string;\n\n /**\n * Filename for the external source of the selected file.\n */\n @Prop() externalFilename?: string;\n\n /**\n * External source for the selected file.\n */\n @Prop() externalSrc?: string;\n\n /**\n * Valid file types.\n */\n @Prop() fileTypes?: string[];\n\n /**\n * Helper text to show below the input. If `\"errorText\"` is provided that will take precedence.\n */\n @Prop() helperText?: string;\n\n /**\n * The label for the input.\n */\n @Prop() label?: string;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the label will display an \"optional\" tag.\n */\n @Prop() showOptionalLabel = false;\n\n /**\n * Function to trigger file upload to server.\n * Returns: boolean indicating success or failure.\n */\n @Prop() uploadFile?: (file: File) => Promise<boolean>;\n\n /**\n * Emitted when the file is dropped in the input.\n */\n @Event() cpslOnDrop!: EventEmitter<DragEvent>;\n\n /**\n * Emitted when the file drag enters the input.\n */\n @Event() cpslOnDragEnter!: EventEmitter<DragEvent>;\n\n /**\n * Emitted when the file drag leaves the input.\n */\n @Event() cpslOnDragLeave!: EventEmitter<DragEvent>;\n\n /**\n * Emitted when the file changes.\n */\n @Event() cpslFileChange!: EventEmitter<File>;\n\n /**\n * Emitted when the file is removed.\n */\n @Event() cpslFileRemoved!: EventEmitter<void>;\n\n private handleDrop = async (ev: DragEvent) => {\n ev.preventDefault();\n\n const item = Array.from(ev.dataTransfer.items)?.[0];\n\n if (item && this.isValidFile(item.type)) {\n const file = item.getAsFile();\n await this.addFile(file);\n }\n\n this.dragOver = false;\n this.dragError = false;\n\n this.cpslOnDrop.emit(ev);\n };\n\n private handleDragEnter = (ev: DragEvent) => {\n ev.preventDefault();\n\n this.dragOver = true;\n\n const item = Array.from(ev.dataTransfer.items)?.[0];\n\n if (item && this.isValidFile(item.type)) {\n this.dragError = true;\n }\n\n this.cpslOnDragEnter.emit(ev);\n };\n\n private handleDragLeave = (ev: DragEvent) => {\n ev.preventDefault();\n\n this.dragOver = false;\n this.dragError = false;\n\n this.cpslOnDragLeave.emit(ev);\n };\n\n private handleInputChange = async (ev: Event) => {\n ev.preventDefault();\n\n const input = this.inputEl;\n\n if (input.files.length) {\n const file = input.files[0];\n\n if (this.isValidFile(file.type)) {\n await this.addFile(file);\n }\n }\n };\n\n private isValidFile = (type: string) => {\n if (this.fileTypes?.length ? !this.fileTypes.includes(type) : false) {\n return false;\n }\n\n return true;\n };\n\n private addFile = async (file: File) => {\n this.file = file;\n this.cpslFileChange.emit(file);\n this.uploadError = false;\n this.isUploading = true;\n const uploadSuccess = this.uploadFile ? await this.uploadFile(file) : true;\n if (!uploadSuccess) {\n this.uploadError = true;\n const input = this.inputEl;\n input.value = '';\n }\n this.isUploading = false;\n };\n\n private removeFile = (e: MouseEvent) => {\n e.preventDefault();\n\n this.file = undefined;\n\n const input = this.inputEl;\n input.value = '';\n\n this.cpslFileRemoved.emit();\n };\n\n get inputEl() {\n return this.el.shadowRoot.getElementById(this.inputId) as HTMLInputElement;\n }\n\n get FileContent() {\n const hasFile = Boolean(this.file) || Boolean(this.externalSrc);\n const isUploading = this.isUploading;\n const error = this.uploadError;\n\n const text = !hasFile ? (\n <Fragment>\n {'Drag file here or '}\n <cpsl-text class=\"inline-text\" variant=\"bodyXS\">\n upload file\n </cpsl-text>\n </Fragment>\n ) : isUploading ? (\n `${this.file.name} is uploading`\n ) : error ? (\n 'Upload Failed'\n ) : (\n this.file?.name || this.externalFilename || ''\n );\n const TopElement = !hasFile ? (\n <cpsl-icon icon=\"image\" />\n ) : isUploading ? (\n <cpsl-spinner />\n ) : error ? (\n <cpsl-icon icon=\"close\" />\n ) : (\n <img class=\"sample-img\" src={this.file ? URL.createObjectURL(this.file) : this.externalSrc} alt=\"Sample Image\" />\n );\n\n return (\n <Fragment>\n {TopElement}\n <span class=\"sample-image-name-container\">\n <cpsl-text class=\"sample-image-name\" variant=\"bodyXS\">\n {text}\n </cpsl-text>\n {hasFile && !error && !isUploading && <cpsl-icon icon=\"close\" onClick={this.removeFile} />}\n </span>\n </Fragment>\n );\n }\n\n render() {\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.inputId}>\n {this.label}\n {this.required ? '*' : ' '}\n {!this.required && this.showOptionalLabel ? <span class=\"optional-label\">(optional)</span> : ''}\n </label>\n )}\n <slot name=\"label\"></slot>\n <div class={{ 'container': true, 'error': Boolean(this.errorText), 'drag': this.dragOver, 'drag-error': this.dragError }}>\n <div class={{ 'label-container': true }}>\n <slot name=\"left-content\"></slot>\n </div>\n <div class={{ 'file-container': true }}>{this.FileContent}</div>\n <input\n id={this.inputId}\n type=\"file\"\n accept={this.fileTypes?.join(', ') ?? '*'}\n files={this.file ? [this.file] : undefined}\n onDrop={this.handleDrop}\n onDragEnter={this.handleDragEnter}\n onDragLeave={this.handleDragLeave}\n onChange={this.handleInputChange}\n />\n </div>\n {(this.errorText || this.helperText) && (\n <div class={{ 'helper-text-container': true, 'error-text': Boolean(this.errorText) }}>\n <span>{this.errorText ?? this.helperText}</span>\n </div>\n )}\n </Host>\n );\n }\n}\n\nlet inputIds = 0;\n"]}
1
+ {"version":3,"file":"cpsl-file-upload.js","sourceRoot":"","sources":["../../../../src/components/cpsl-file-upload/cpsl-file-upload.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAgB,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOxG,MAAM,OAAO,cAAc;;QAGjB,YAAO,GAAG,oBAAoB,QAAQ,EAAE,EAAE,CAAC;QAqF3C,eAAU,GAAG,CAAO,EAAa,EAAE,EAAE;;YAC3C,EAAE,CAAC,cAAc,EAAE,CAAC;YAEpB,MAAM,IAAI,GAAG,MAAA,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,0CAAG,CAAC,CAAC,CAAC;YAEpD,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS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, Event, h, EventEmitter, State, Fragment, Element } from '@stencil/core';\n\n@Component({\n tag: 'cpsl-file-upload',\n styleUrl: 'cpsl-file-upload.scss',\n shadow: true,\n})\nexport class CpslFileUpload {\n @Element() el!: HTMLCpslFileUploadElement;\n\n private inputId = `cpsl-file-upload-${inputIds++}`;\n\n @State() file?: File;\n @State() dragOver?: boolean;\n @State() dragError?: boolean;\n @State() isUploading?: boolean;\n @State() uploadError?: boolean;\n\n /**\n * If the input is disabled.\n * Default is: false.\n */\n @Prop({ reflect: true }) disabled?: boolean = false;\n\n /**\n * Error text to show below the input. If this is provided the input will enter an error state.\n */\n @Prop() errorText?: string;\n\n /**\n * Filename for the external source of the selected file.\n */\n @Prop() externalFilename?: string;\n\n /**\n * External source for the selected file.\n */\n @Prop() externalSrc?: string;\n\n /**\n * Valid file types.\n */\n @Prop() fileTypes?: string[];\n\n /**\n * Helper text to show below the input. If `\"errorText\"` is provided that will take precedence.\n */\n @Prop() helperText?: string;\n\n /**\n * The label for the input.\n */\n @Prop() label?: string;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the label will display an \"optional\" tag.\n */\n @Prop() showOptionalLabel = false;\n\n /**\n * Function to trigger file upload to server.\n * Returns: boolean indicating success or failure.\n */\n @Prop() uploadFile?: (file: File) => Promise<boolean>;\n\n /**\n * Emitted when the file is dropped in the input.\n */\n @Event() cpslOnDrop!: EventEmitter<DragEvent>;\n\n /**\n * Emitted when the file drag enters the input.\n */\n @Event() cpslOnDragEnter!: EventEmitter<DragEvent>;\n\n /**\n * Emitted when the file drag leaves the input.\n */\n @Event() cpslOnDragLeave!: EventEmitter<DragEvent>;\n\n /**\n * Emitted when the file changes.\n */\n @Event() cpslFileChange!: EventEmitter<File>;\n\n /**\n * Emitted when the file is removed.\n */\n @Event() cpslFileRemoved!: EventEmitter<void>;\n\n private handleDrop = async (ev: DragEvent) => {\n ev.preventDefault();\n\n const item = Array.from(ev.dataTransfer.items)?.[0];\n\n if (item && this.isValidFile(item.type)) {\n const file = item.getAsFile();\n await this.addFile(file);\n }\n\n this.dragOver = false;\n this.dragError = false;\n\n this.cpslOnDrop.emit(ev);\n };\n\n private handleDragEnter = (ev: DragEvent) => {\n ev.preventDefault();\n\n this.dragOver = true;\n\n const item = Array.from(ev.dataTransfer.items)?.[0];\n\n if (item && this.isValidFile(item.type)) {\n this.dragError = true;\n }\n\n this.cpslOnDragEnter.emit(ev);\n };\n\n private handleDragLeave = (ev: DragEvent) => {\n ev.preventDefault();\n\n this.dragOver = false;\n this.dragError = false;\n\n this.cpslOnDragLeave.emit(ev);\n };\n\n private handleInputChange = async (ev: Event) => {\n ev.preventDefault();\n\n const input = this.inputEl;\n\n if (input.files.length) {\n const file = input.files[0];\n\n if (this.isValidFile(file.type)) {\n await this.addFile(file);\n }\n }\n };\n\n private isValidFile = (type: string) => {\n if (this.fileTypes?.length ? !this.fileTypes.includes(type) : false) {\n return false;\n }\n\n return true;\n };\n\n private addFile = async (file: File) => {\n this.file = file;\n this.cpslFileChange.emit(file);\n this.uploadError = false;\n this.isUploading = true;\n const uploadSuccess = this.uploadFile ? await this.uploadFile(file) : true;\n if (!uploadSuccess) {\n this.uploadError = true;\n const input = this.inputEl;\n input.value = '';\n }\n this.isUploading = false;\n };\n\n private removeFile = (e: MouseEvent) => {\n e.preventDefault();\n\n this.file = undefined;\n\n const input = this.inputEl;\n input.value = '';\n\n this.cpslFileRemoved.emit();\n };\n\n get inputEl() {\n return this.el.shadowRoot.getElementById(this.inputId) as HTMLInputElement;\n }\n\n get FileContent() {\n const hasFile = Boolean(this.file) || Boolean(this.externalSrc);\n const isUploading = this.isUploading;\n const error = this.uploadError;\n\n const text = !hasFile ? (\n <Fragment>\n {'Drag file here or '}\n <cpsl-text class=\"inline-text\" variant=\"bodyXS\">\n upload file\n </cpsl-text>\n </Fragment>\n ) : isUploading ? (\n `${this.file.name} is uploading`\n ) : error ? (\n 'Upload Failed'\n ) : (\n this.file?.name || this.externalFilename || ''\n );\n const TopElement = !hasFile ? (\n <cpsl-icon icon=\"image\" />\n ) : isUploading ? (\n <cpsl-spinner />\n ) : error ? (\n <cpsl-icon icon=\"close\" />\n ) : (\n <img class=\"sample-img\" src={this.file ? URL.createObjectURL(this.file) : this.externalSrc} alt=\"Sample Image\" />\n );\n\n return (\n <Fragment>\n {TopElement}\n <span class=\"sample-image-name-container\">\n <cpsl-text class=\"sample-image-name\" variant=\"bodyXS\">\n {text}\n </cpsl-text>\n {hasFile && !error && !isUploading && <cpsl-icon icon=\"close\" onClick={this.removeFile} />}\n </span>\n </Fragment>\n );\n }\n\n render() {\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.inputId}>\n {this.label}\n {this.required ? '*' : ' '}\n {!this.required && this.showOptionalLabel ? <span class=\"optional-label\">(optional)</span> : ''}\n </label>\n )}\n <slot name=\"label\"></slot>\n <div class={{ 'container': true, 'error': Boolean(this.errorText), 'drag': this.dragOver, 'drag-error': this.dragError }}>\n <div class={{ 'label-container': true }}>\n <slot name=\"left-content\"></slot>\n </div>\n <div class={{ 'file-container': true }}>{this.FileContent}</div>\n <input\n id={this.inputId}\n type=\"file\"\n accept={this.fileTypes?.join(', ') ?? '*'}\n files={this.file ? [this.file] : undefined}\n onDrop={this.handleDrop}\n onDragEnter={this.handleDragEnter}\n onDragLeave={this.handleDragLeave}\n onChange={this.handleInputChange}\n disabled={this.disabled}\n />\n </div>\n {(this.errorText || this.helperText) && (\n <div class={{ 'helper-text-container': true, 'error-text': Boolean(this.errorText) }}>\n <span>{this.errorText ?? this.helperText}</span>\n </div>\n )}\n </Host>\n );\n }\n}\n\nlet inputIds = 0;\n"]}
@@ -4,9 +4,9 @@ export class CpslGrid {
4
4
  this.fixed = false;
5
5
  }
6
6
  render() {
7
- return (h(Host, { key: '2a309bb97e8f23435d58104be2ecb598fbd6d057', class: {
7
+ return (h(Host, { key: '76084ea41988e4fdff4a48dc400988d2aa190a56', class: {
8
8
  'grid-fixed': this.fixed,
9
- } }, h("slot", { key: 'd47730a267a8daba7e8e17396789950bf3200ebb' })));
9
+ } }, h("slot", { key: '1eb8c755910397d58a2165238a1428769623ef6b' })));
10
10
  }
11
11
  static get is() { return "cpsl-grid"; }
12
12
  static get encapsulation() { return "shadow"; }
@@ -113,15 +113,15 @@
113
113
 
114
114
  :host(.connection) .ring1,
115
115
  :host(.externalWalletConnection) > .backgroundContainer > .background .ring1 {
116
- box-shadow: 0px 0px 20px var(--cpsl-color-accent-0, color-mix(in srgb, var(--cpsl-color-foreground-0), transparent 93%));
116
+ box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.07);
117
117
  }
118
118
  :host(.connection) .ring2,
119
119
  :host(.externalWalletConnection) > .backgroundContainer > .background .ring2 {
120
- box-shadow: 0px 0px 12px var(--cpsl-color-accent-0, color-mix(in srgb, var(--cpsl-color-foreground-0), transparent 95%));
120
+ box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.05);
121
121
  }
122
122
  :host(.connection) .ring3,
123
123
  :host(.externalWalletConnection) > .backgroundContainer > .background .ring3 {
124
- box-shadow: 0px 0px 12px var(--cpsl-color-accent-0, color-mix(in srgb, var(--cpsl-color-foreground-0), transparent 96%));
124
+ box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.04);
125
125
  }
126
126
 
127
127
  :host(.pending) > .backgroundContainer > .background .ring0 {
@@ -296,7 +296,7 @@
296
296
 
297
297
  :host > .backgroundContainer > .background > .cover {
298
298
  position: absolute;
299
- height: 50%;
299
+ height: 100%;
300
300
  top: 34%;
301
301
  right: 0;
302
302
  left: 0;
@@ -11,7 +11,7 @@ export class CpslHero {
11
11
  }
12
12
  render() {
13
13
  var _a;
14
- return (h(Host, { key: '536748bef37748f5ded6103e7b1157d433a9db9e', class: {
14
+ return (h(Host, { key: 'e57d19559f8d8c92c23dcf95ca88246529a4b46f', class: {
15
15
  // VARIANTS
16
16
  connection: this.variant === 'connection',
17
17
  pending: this.variant === 'pending' || this.variant === 'customContent',
@@ -19,7 +19,7 @@ export class CpslHero {
19
19
  add: this.variant === 'add',
20
20
  failed: this.variant === 'failed',
21
21
  externalWalletConnection: this.variant === 'externalWalletConnection',
22
- } }, h("div", { key: '5f3f7d129c3b1578c5ccbfddef6c1cdc4462d1a9', class: "backgroundContainer", style: { height: `${(_a = this.height) !== null && _a !== void 0 ? _a : 180}px` } }, h("div", { key: '7916fa310aea389a5f728b03a1214c7d749cd078', class: { background: true, defaultTheme: this.withDefaultTheme } }, h("div", { key: '90d112bee9c23a1fc2c9eeceeb7748389c43b330', class: "ring ring3" }), h("div", { key: '615774a2e59d583b8a117692ac59bc52eb46ba1d', class: "ring ring2" }), h("div", { key: '83e683c08a388ee72f2944ee9dd5db31e3acf077', class: "ring ring1" }), h("div", { key: 'ef301e6e5335f73c47aeb37595878d7fcdcf26ec', class: "ring ring0" }), h("div", { key: '52cd5b1515ccf62c0547a6de5adbb4a60ff69cc0', class: { ringCenter: true, defaultTheme: this.withDefaultTheme } }, this.variant === 'connection' && (h(Fragment, { key: '09fcb87ee34ca15d0fbe71a61aacbdeca4c430ab' }, h("img", { key: 'ca54c63fe0bb01769cff7092e0f54e584d4126fc', class: "connectionImage", src: Images.heroDefault }), h("div", { key: 'f483ade09afa8d444a4858f6b24e547dabc02066', class: "connectDiagramContainer" }, h("slot", { key: '678fb89e0ea73e4683d8b24774ec9ad1574506b5', name: "connectionLeft" }), h("slot", { key: '8161ca39b931cdcad9f26a2b9cd240d21d2bd58e', name: "connectionRight" })))), this.variant === 'pending' && h("img", { key: '493b458b1d61d74a34eb5257e5e24c2926ac43e2', class: "pendingImage", src: Images.heroPending }), this.variant === 'approved' && (h(Fragment, { key: '98765b1ff59627f41df553cd67d35bdd3fcfb365' }, !this.withDefaultTheme && h("img", { key: 'aa9707c9a33fd79e60265e77e637be70f0dad207', class: "approvedImage", src: Images.heroSuccess }), h("cpsl-icon", { key: 'c5e80d7b587010e7e954b82c99a7b27161f8ab67', class: "centerIcon", icon: this.withDefaultTheme ? 'heroCheckmark' : 'heroCheckmarkCapsule' }))), this.variant === 'add' && (h(Fragment, { key: 'a2df2e659262e63ae0c93ba067620f9aabf258b2' }, h("cpsl-icon", { key: 'b2465a8b324d1193b3c13dfb4b13db9766362c18', class: "centerIcon", icon: this.withDefaultTheme ? 'heroPlusCircle' : 'heroPlusCircleCapsule' }))), this.variant === 'failed' && h("cpsl-icon", { key: '4610993869b7f3e12acc28f059a52a0385d89857', class: "centerIcon", icon: "heroAlertCircle" }), this.variant === 'externalWalletConnection' && (h(Fragment, { key: '04154eb679a0ed9ba9926400649118524a2e8930' }, h("cpsl-icon", { key: '0057163ff813b61dba7e4b025ae887d401ab229b', class: "externalConnectionIcon", icon: "heroExternalConnection" }), h("div", { key: '58cf28880b08d9e057601017ad34bc9ef845fda5', class: "connectDiagramContainer" }, h("slot", { key: 'f6bef13f87758ad8464f40e13b15e90a4a8957b7', name: "connectionLeft" }), h("slot", { key: '7632e44ec387c056e1d632e6bfa0a8f55b15f0d5', name: "connectionRight" })))), this.variant === 'customContent' && (h("div", { key: '290ebe2de0cabee6f349bad7effe9078199a17a5', class: "customImageContainer" }, h("slot", { key: '8daf7cf22a8f9cdc66b3e825d576bbd64d94ef30', name: "image" })))), !this.hideFadeOut && (h(Fragment, { key: 'ae6da06f903d815e082b6b5d4dd98e20f0fc36b7' }, h("div", { key: '09b3d4c4125b2d33b5a957dc18af18031b5a2312', class: "fadeOut" }), h("div", { key: '82e3164dccb5baf4eb00fb14e1f0f35ea24c79f3', class: "cover" }))))), h("cpsl-text", { key: 'e82eca3761754f67cc54b844d30a88af33936a10', variant: "headingXS", color: "primary", weight: "medium" }, this.title), this.subtitle && (h("cpsl-text", { key: '00eaa47c5107f3b6960c476d90fb9472f18ef1b4', variant: "bodyM", color: "secondary" }, this.subtitle))));
22
+ } }, h("div", { key: '3341d0ad455074858c3b0a9b9fe7af291ad198eb', class: "backgroundContainer", style: { height: `${(_a = this.height) !== null && _a !== void 0 ? _a : 180}px` } }, h("div", { key: '4835ffd38a99277e7178023188aae95dc6ba4ee5', class: { background: true, defaultTheme: this.withDefaultTheme } }, h("div", { key: '565638be3e6c5d230a50329031ec47c87a0e8077', class: "ring ring3" }), h("div", { key: '483a3691798e33c8547543ef6a397bb8992f86e3', class: "ring ring2" }), h("div", { key: 'c0ca1841f37918e0e1a805b34f53e2f0b204bbda', class: "ring ring1" }), h("div", { key: 'ea3b347c265679d6acd1bdd8ed26a9761d649caa', class: "ring ring0" }), h("div", { key: '1be1e9e5ef42961d8daeb4997daefc118e50b349', class: { ringCenter: true, defaultTheme: this.withDefaultTheme } }, this.variant === 'connection' && (h(Fragment, { key: '137e8b9bfb53df3208104b77767cfab0f06a500a' }, h("img", { key: '519fa3982fdbc8cee57ba3c3d2a470039d6165e3', class: "connectionImage", src: Images.heroDefault }), h("div", { key: '128cc3362b905a35ca781b4b0eab45912542e185', class: "connectDiagramContainer" }, h("slot", { key: 'bbac944d46752eb2a997c3751b7395d13c0f6ce5', name: "connectionLeft" }), h("slot", { key: '30fd8334daf3944c51ceb4ea9f42cd489125d85c', name: "connectionRight" })))), this.variant === 'pending' && h("img", { key: 'e332372db7e6651d1419d8ef83c60ed255ff1cd5', class: "pendingImage", src: Images.heroPending }), this.variant === 'approved' && (h(Fragment, { key: '7674761e57156f14350082a5e9a95a423e5a916d' }, !this.withDefaultTheme && h("img", { key: 'fc1a5e6bcff525490e85e0ac84542ecc70c78d65', class: "approvedImage", src: Images.heroSuccess }), h("cpsl-icon", { key: 'fd3341ee64f6f598a299deda12ad2fab633aaa1a', class: "centerIcon", icon: this.withDefaultTheme ? 'heroCheckmark' : 'heroCheckmarkCapsule' }))), this.variant === 'add' && (h(Fragment, { key: '155fc4680ce6bedc930cc6b27eb676eb4b067acb' }, h("cpsl-icon", { key: 'ca4dac8a0b2e0dd4fb198195528209d648d71289', class: "centerIcon", icon: this.withDefaultTheme ? 'heroPlusCircle' : 'heroPlusCircleCapsule' }))), this.variant === 'failed' && h("cpsl-icon", { key: 'd6d1886df2a68eb365924788b4bb080281e31aac', class: "centerIcon", icon: "heroAlertCircle" }), this.variant === 'externalWalletConnection' && (h(Fragment, { key: '783ec93baf3c3c79813a39c60c35b7a04b34d56c' }, h("cpsl-icon", { key: '56e792294a698f86591a7b5f1e25b08a0428c5b7', class: "externalConnectionIcon", icon: "heroExternalConnection" }), h("div", { key: '790af19407de8398e5ed3efe676edd856d7b222f', class: "connectDiagramContainer" }, h("slot", { key: 'fe702ae2f8f515dd3697684defd4cc6c06495283', name: "connectionLeft" }), h("slot", { key: 'db0670c2f4095a2e3cfd287e03ad6a429fe8caef', name: "connectionRight" })))), this.variant === 'customContent' && (h("div", { key: '0e7a0ab404fdb0fbcc249dc3ec3537e2554a945a', class: "customImageContainer" }, h("slot", { key: 'fb0afeb690e5676007d0ccc1545f9ce9791af045', name: "image" })))), !this.hideFadeOut && (h(Fragment, { key: '2fa75125453408d7fe3d7d3a6c1e9091c5042afe' }, h("div", { key: 'e9b06d0d820e8cc30d10147bcfcb55279d3977a0', class: "fadeOut" }), h("div", { key: '0018aa5158cd89c81184c50f3581e1bbecb961ee', class: "cover" }))))), h("cpsl-text", { key: 'b52135d714d10638dd03342bc4c1f374509d2bfd', variant: "headingXS", color: "primary", weight: "semiBold" }, this.title), this.subtitle && (h("cpsl-text", { key: '2c4dbbc33c7d3faaed5ef9e0d32d49f064667502', variant: "bodyS", weight: "medium", color: "secondary" }, this.subtitle))));
23
23
  }
24
24
  static get is() { return "cpsl-hero"; }
25
25
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"cpsl-hero.js","sourceRoot":"","sources":["../../../../src/components/cpsl-hero/cpsl-hero.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAO7C,MAAM,OAAO,QAAQ;;;;uBA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N,kEAAW,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,SAAS,EAAC,MAAM,EAAC,QAAQ,IAC3D,IAAI,CAAC,KAAK,CACD;YACX,IAAI,CAAC,QAAQ,IAAI,CAChB,kEAAW,OAAO,EAAC,OAAO,EAAC,KAAK,EAAC,WAAW,IACzC,IAAI,CAAC,QAAQ,CACJ,CACb,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Fragment, Host, Prop, h } from '@stencil/core';\nimport { Images } from '../../assets/images';\n\n@Component({\n tag: 'cpsl-hero',\n styleUrl: 'cpsl-hero.scss',\n shadow: true,\n})\nexport class CpslHero {\n /**\n * The height of the container.\n * Default is: 180.\n */\n @Prop() height?: number;\n\n /**\n * Hides the fade out components\n * Default is: `false`.\n */\n @Prop() hideFadeOut?: boolean;\n\n /**\n * The variant of the button.\n * Options are: `\"customContent\"`, `\"connection\"`, `\"externalWalletConnection\"`, `\"pending\", `\"approved\",`\"add\", `\"failed\".\n * Default is: `\"connection\"`.\n */\n @Prop({ reflect: true }) variant?: 'customContent' | 'connection' | 'externalWalletConnection' | 'pending' | 'approved' | 'add' | 'failed' = 'connection';\n\n @Prop({ reflect: true }) title: string;\n\n @Prop({ reflect: true }) subtitle?: string;\n\n /**\n * Whether to use the Capsule custom theming or use the provided theme\n * Default is: `false`.\n */\n @Prop() withDefaultTheme?: boolean;\n\n render() {\n return (\n <Host\n class={{\n // VARIANTS\n connection: this.variant === 'connection',\n pending: this.variant === 'pending' || this.variant === 'customContent',\n approved: this.variant === 'approved',\n add: this.variant === 'add',\n failed: this.variant === 'failed',\n externalWalletConnection: this.variant === 'externalWalletConnection',\n }}\n >\n <div class=\"backgroundContainer\" style={{ height: `${this.height ?? 180}px` }}>\n <div class={{ background: true, defaultTheme: this.withDefaultTheme }}>\n <div class=\"ring ring3\" />\n <div class=\"ring ring2\" />\n <div class=\"ring ring1\" />\n <div class=\"ring ring0\" />\n <div class={{ ringCenter: true, defaultTheme: this.withDefaultTheme }}>\n {this.variant === 'connection' && (\n <Fragment>\n <img class=\"connectionImage\" src={Images.heroDefault} />\n <div class=\"connectDiagramContainer\">\n <slot name=\"connectionLeft\" />\n <slot name=\"connectionRight\" />\n </div>\n </Fragment>\n )}\n {this.variant === 'pending' && <img class=\"pendingImage\" src={Images.heroPending} />}\n {this.variant === 'approved' && (\n <Fragment>\n {!this.withDefaultTheme && <img class=\"approvedImage\" src={Images.heroSuccess} />}\n <cpsl-icon class=\"centerIcon\" icon={this.withDefaultTheme ? 'heroCheckmark' : 'heroCheckmarkCapsule'} />\n </Fragment>\n )}\n {this.variant === 'add' && (\n <Fragment>\n <cpsl-icon class=\"centerIcon\" icon={this.withDefaultTheme ? 'heroPlusCircle' : 'heroPlusCircleCapsule'} />\n </Fragment>\n )}\n {this.variant === 'failed' && <cpsl-icon class=\"centerIcon\" icon=\"heroAlertCircle\" />}\n {this.variant === 'externalWalletConnection' && (\n <Fragment>\n <cpsl-icon class=\"externalConnectionIcon\" icon=\"heroExternalConnection\" />\n <div class=\"connectDiagramContainer\">\n <slot name=\"connectionLeft\" />\n <slot name=\"connectionRight\" />\n </div>\n </Fragment>\n )}\n {this.variant === 'customContent' && (\n <div class=\"customImageContainer\">\n <slot name=\"image\" />\n </div>\n )}\n </div>\n {!this.hideFadeOut && (\n <Fragment>\n <div class=\"fadeOut\" />\n <div class=\"cover\" />\n </Fragment>\n )}\n </div>\n </div>\n <cpsl-text variant=\"headingXS\" color=\"primary\" weight=\"medium\">\n {this.title}\n </cpsl-text>\n {this.subtitle && (\n <cpsl-text variant=\"bodyM\" color=\"secondary\">\n {this.subtitle}\n </cpsl-text>\n )}\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"cpsl-hero.js","sourceRoot":"","sources":["../../../../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EAAC,sBAAsB;4BAC/B,6DAAM,IAAI,EAAC,OAAO,GAAG,CACjB,CACP,CACG;oBACL,CAAC,IAAI,CAAC,WAAW,IAAI,CACpB,EAAC,QAAQ;wBACP,4DAAK,KAAK,EAAC,SAAS,GAAG;wBACvB,4DAAK,KAAK,EAAC,OAAO,GAAG,CACZ,CACZ,CACG,CACF;YACN,kEAAW,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,SAAS,EAAC,MAAM,EAAC,UAAU,IAC7D,IAAI,CAAC,KAAK,CACD;YACX,IAAI,CAAC,QAAQ,IAAI,CAChB,kEAAW,OAAO,EAAC,OAAO,EAAC,MAAM,EAAC,QAAQ,EAAC,KAAK,EAAC,WAAW,IACzD,IAAI,CAAC,QAAQ,CACJ,CACb,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Fragment, Host, Prop, h } from '@stencil/core';\nimport { Images } from '../../assets/images';\n\n@Component({\n tag: 'cpsl-hero',\n styleUrl: 'cpsl-hero.scss',\n shadow: true,\n})\nexport class CpslHero {\n /**\n * The height of the container.\n * Default is: 180.\n */\n @Prop() height?: number;\n\n /**\n * Hides the fade out components\n * Default is: `false`.\n */\n @Prop() hideFadeOut?: boolean;\n\n /**\n * The variant of the button.\n * Options are: `\"customContent\"`, `\"connection\"`, `\"externalWalletConnection\"`, `\"pending\", `\"approved\",`\"add\", `\"failed\".\n * Default is: `\"connection\"`.\n */\n @Prop({ reflect: true }) variant?: 'customContent' | 'connection' | 'externalWalletConnection' | 'pending' | 'approved' | 'add' | 'failed' = 'connection';\n\n @Prop({ reflect: true }) title: string;\n\n @Prop({ reflect: true }) subtitle?: string;\n\n /**\n * Whether to use the Capsule custom theming or use the provided theme\n * Default is: `false`.\n */\n @Prop() withDefaultTheme?: boolean;\n\n render() {\n return (\n <Host\n class={{\n // VARIANTS\n connection: this.variant === 'connection',\n pending: this.variant === 'pending' || this.variant === 'customContent',\n approved: this.variant === 'approved',\n add: this.variant === 'add',\n failed: this.variant === 'failed',\n externalWalletConnection: this.variant === 'externalWalletConnection',\n }}\n >\n <div class=\"backgroundContainer\" style={{ height: `${this.height ?? 180}px` }}>\n <div class={{ background: true, defaultTheme: this.withDefaultTheme }}>\n <div class=\"ring ring3\" />\n <div class=\"ring ring2\" />\n <div class=\"ring ring1\" />\n <div class=\"ring ring0\" />\n <div class={{ ringCenter: true, defaultTheme: this.withDefaultTheme }}>\n {this.variant === 'connection' && (\n <Fragment>\n <img class=\"connectionImage\" src={Images.heroDefault} />\n <div class=\"connectDiagramContainer\">\n <slot name=\"connectionLeft\" />\n <slot name=\"connectionRight\" />\n </div>\n </Fragment>\n )}\n {this.variant === 'pending' && <img class=\"pendingImage\" src={Images.heroPending} />}\n {this.variant === 'approved' && (\n <Fragment>\n {!this.withDefaultTheme && <img class=\"approvedImage\" src={Images.heroSuccess} />}\n <cpsl-icon class=\"centerIcon\" icon={this.withDefaultTheme ? 'heroCheckmark' : 'heroCheckmarkCapsule'} />\n </Fragment>\n )}\n {this.variant === 'add' && (\n <Fragment>\n <cpsl-icon class=\"centerIcon\" icon={this.withDefaultTheme ? 'heroPlusCircle' : 'heroPlusCircleCapsule'} />\n </Fragment>\n )}\n {this.variant === 'failed' && <cpsl-icon class=\"centerIcon\" icon=\"heroAlertCircle\" />}\n {this.variant === 'externalWalletConnection' && (\n <Fragment>\n <cpsl-icon class=\"externalConnectionIcon\" icon=\"heroExternalConnection\" />\n <div class=\"connectDiagramContainer\">\n <slot name=\"connectionLeft\" />\n <slot name=\"connectionRight\" />\n </div>\n </Fragment>\n )}\n {this.variant === 'customContent' && (\n <div class=\"customImageContainer\">\n <slot name=\"image\" />\n </div>\n )}\n </div>\n {!this.hideFadeOut && (\n <Fragment>\n <div class=\"fadeOut\" />\n <div class=\"cover\" />\n </Fragment>\n )}\n </div>\n </div>\n <cpsl-text variant=\"headingXS\" color=\"primary\" weight=\"semiBold\">\n {this.title}\n </cpsl-text>\n {this.subtitle && (\n <cpsl-text variant=\"bodyS\" weight=\"medium\" color=\"secondary\">\n {this.subtitle}\n </cpsl-text>\n )}\n </Host>\n );\n }\n}\n"]}
@@ -6,7 +6,7 @@ export class CpslIcon {
6
6
  this.icon = undefined;
7
7
  }
8
8
  render() {
9
- return (h(Host, { key: 'f7a86185e4b1deadba2a41381b88d6860d0d60d5', part: "icon", role: "img" }, !this.icon ? h("img", { src: this.src }) : h("div", { innerHTML: Icons[this.icon] })));
9
+ return (h(Host, { key: '83970488e84a7359667faa9948079b3fac1b8e09', part: "icon", role: "img" }, !this.icon ? h("img", { src: this.src }) : h("div", { innerHTML: Icons[this.icon] })));
10
10
  }
11
11
  static get is() { return "cpsl-icon"; }
12
12
  static get encapsulation() { return "shadow"; }
@@ -44,7 +44,7 @@ export class CpslIcon {
44
44
  "mutable": false,
45
45
  "complexType": {
46
46
  "original": "IconType",
47
- "resolved": "\"search\" | \"alertCircle\" | \"angelListBrand\" | \"angelList\" | \"appleBrand\" | \"apple\" | \"arrowCircleBrokenDownLeft\" | \"arrowNarrow\" | \"arrow\" | \"backupKit\" | \"bank\" | \"brush\" | \"capsuleLogo\" | \"capsuleRingsDark\" | \"capsuleRings\" | \"capsule\" | \"checkCircle\" | \"check\" | \"chevronUp\" | \"clock\" | \"close\" | \"clubhouseBrand\" | \"clubhouse\" | \"copy\" | \"creditCard\" | \"cube\" | \"decentBrand\" | \"decent\" | \"discordBrand\" | \"discord\" | \"dot\" | \"downloadCloud\" | \"download\" | \"dribbbleBrand\" | \"dribbble\" | \"earth\" | \"eyeOff\" | \"eye\" | \"facebookBrand\" | \"facebook\" | \"farcasterBrand\" | \"farcaster\" | \"figmaBrand\" | \"figma\" | \"file\" | \"folder\" | \"githubBrand\" | \"github\" | \"globe\" | \"googleBrand\" | \"google\" | \"helpCircle\" | \"heroAlertCircle\" | \"heroCheckmarkCapsule\" | \"heroCheckmark\" | \"heroEmail\" | \"heroExternalConnection\" | \"heroLock\" | \"heroPasskey\" | \"heroPhone\" | \"heroPlusCircleCapsule\" | \"heroPlusCircle\" | \"heroWallet\" | \"home\" | \"image\" | \"infoCircle\" | \"instagramBrand\" | \"instagram\" | \"key\" | \"lightning01\" | \"lightning\" | \"linkExternal\" | \"linkedinBrand\" | \"linkedin\" | \"logOut\" | \"mail\" | \"menu\" | \"moonpayBrand\" | \"moreLoginOptions\" | \"phone\" | \"pintrestBrand\" | \"pintrest\" | \"plusCircle\" | \"puzzlePiece\" | \"qrCode02\" | \"qrCode\" | \"rampNetworkBrand\" | \"rampNetwork\" | \"redditBrand\" | \"reddit\" | \"refresh\" | \"send\" | \"settings\" | \"shield\" | \"signalBrand\" | \"signal\" | \"snapchatBrand\" | \"snapchat\" | \"stars\" | \"stripeBrand\" | \"telegramBrand\" | \"telegram\" | \"tikTokBrand\" | \"tikTok\" | \"tumblrBrand\" | \"tumblr\" | \"twitterBrand\" | \"twitter\" | \"wallet\" | \"x\" | \"youtubeBrand\" | \"youtube\" | \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BQ2\" | \"BQ3\" | \"BR\" | \"BS\" | \"BT\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CD2\" | \"CF\" | \"CH\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DS\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB2\" | \"GB\" | \"GD\" | \"GE\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GQ\" | \"GR\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SE\" | \"SG\" | \"SI\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"US\" | \"UY\" | \"UZ\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WS\" | \"YE\" | \"ZA\" | \"ZM\" | \"ZW\"",
47
+ "resolved": "\"search\" | \"alertCircle\" | \"alertTriangle\" | \"angelListBrand\" | \"angelList\" | \"appleBrand\" | \"apple\" | \"arrowCircleBrokenDownLeft\" | \"arrowCircleDownFilled\" | \"arrowNarrow\" | \"arrow\" | \"backupKit\" | \"bank\" | \"brush\" | \"capsuleLogo\" | \"capsuleRingsDark\" | \"capsuleRings\" | \"capsule\" | \"checkCircleFilled\" | \"checkCircle\" | \"check\" | \"chevronDown\" | \"chevronSelectorVertical\" | \"chevronUp\" | \"clock\" | \"close\" | \"clubhouseBrand\" | \"clubhouse\" | \"copy\" | \"cosmos\" | \"creditCard02\" | \"creditCard\" | \"cube\" | \"decentBrand\" | \"decent\" | \"discordBrand\" | \"discord\" | \"dot\" | \"downloadCloud\" | \"download\" | \"dribbbleBrand\" | \"dribbble\" | \"earth\" | \"edit02\" | \"ethereum\" | \"eyeOff\" | \"eye\" | \"facebookBrand\" | \"facebook\" | \"farcasterBrand\" | \"farcaster\" | \"figmaBrand\" | \"figma\" | \"file\" | \"folder\" | \"githubBrand\" | \"github\" | \"globe\" | \"googleBrand\" | \"google\" | \"helpCircle\" | \"heroAlertCircle\" | \"heroCheckmarkCapsule\" | \"heroCheckmark\" | \"heroEmail\" | \"heroExternalConnection\" | \"heroLock\" | \"heroPasskey\" | \"heroPhone\" | \"heroPlusCircleCapsule\" | \"heroPlusCircle\" | \"heroWallet\" | \"home\" | \"image\" | \"infoCircle\" | \"instagramBrand\" | \"instagram\" | \"key\" | \"lightning01\" | \"lightning\" | \"linkExternal\" | \"linkedinBrand\" | \"linkedin\" | \"logOut\" | \"mail\" | \"menu\" | \"moonpayBrand\" | \"moreLoginOptions\" | \"phone\" | \"pintrestBrand\" | \"pintrest\" | \"plusCircle\" | \"plus\" | \"polygon\" | \"puzzlePiece\" | \"qrCode02\" | \"qrCode\" | \"rampNetworkBrand\" | \"rampNetwork\" | \"redditBrand\" | \"reddit\" | \"refresh\" | \"send\" | \"settings\" | \"shield\" | \"signalBrand\" | \"signal\" | \"snapchatBrand\" | \"snapchat\" | \"solana\" | \"star04Filled\" | \"stars\" | \"stripeBrand\" | \"telegramBrand\" | \"telegram\" | \"tikTokBrand\" | \"tikTok\" | \"tumblrBrand\" | \"tumblr\" | \"twitterBrand\" | \"twitter\" | \"user\" | \"wallet\" | \"x\" | \"youtubeBrand\" | \"youtube\" | \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BQ2\" | \"BQ3\" | \"BR\" | \"BS\" | \"BT\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CD2\" | \"CF\" | \"CH\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DS\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB2\" | \"GB\" | \"GD\" | \"GE\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GQ\" | \"GR\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SE\" | \"SG\" | \"SI\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"US\" | \"UY\" | \"UZ\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WS\" | \"YE\" | \"ZA\" | \"ZM\" | \"ZW\"",
48
48
  "references": {
49
49
  "IconType": {
50
50
  "location": "import",
@@ -29,7 +29,7 @@ export class CpslIconGroup {
29
29
  render() {
30
30
  // If disabled remove all brand icons to ensure the disabled color is shown correctly
31
31
  const icons = this.disabled ? this.icons.map(icon => icon.replace('Brand', '')) : this.icons;
32
- return (h(Host, { key: '4c81ff12c46582623d226e8a7f3078ff279bc8ae' }, icons.map((icon, index) => {
32
+ return (h(Host, { key: '687a32dfbceec5b1544c695bc4e8ffbcf094a384' }, icons.map((icon, index) => {
33
33
  const isIcon = isOfTypeIconType(icon);
34
34
  return (h("span", { part: "icon-container", class: {
35
35
  'icon-container': true,
@@ -1,22 +1,21 @@
1
1
  :host {
2
- --identicon-background-red: linear-gradient(136deg, #FF4270 6.86%, #FF7C7C 93.78%);
3
- --identicon-background-orange: linear-gradient(136deg, #F45532 6.86%, #FF9B63 93.78%);
4
- --identicon-background-yellow: linear-gradient(136deg, #FFA756 6.86%, #FBFF47 93.78%);
5
- --identicon-background-green: linear-gradient(136deg, #0CAE60 6.86%, #7BFFD0 93.78%);
6
- --identicon-background-blue: linear-gradient(136deg, #476FFF 6.86%, #47C8FF 93.78%);
7
- --identicon-background-purple: linear-gradient(136deg, #9747FF 6.86%, #DA47FF 93.78%);
2
+ --identicon-background-red: linear-gradient(136deg, #ff4270 6.86%, #ff7c7c 93.78%);
3
+ --identicon-background-orange: linear-gradient(136deg, #f45532 6.86%, #ff9b63 93.78%);
4
+ --identicon-background-yellow: linear-gradient(136deg, #ffa756 6.86%, #fbff47 93.78%);
5
+ --identicon-background-green: linear-gradient(136deg, #0cae60 6.86%, #7bffd0 93.78%);
6
+ --identicon-background-blue: linear-gradient(136deg, #476fff 6.86%, #47c8ff 93.78%);
7
+ --identicon-background-purple: linear-gradient(136deg, #9747ff 6.86%, #da47ff 93.78%);
8
+ --identicon-background-empty: linear-gradient(136deg, #aaaaaa 6.86%, #999999 93.78%);
8
9
  display: block;
9
- width: 62px;
10
- height: 62px;
11
10
  aspect-ratio: 1;
12
- border-radius: 6px;
11
+ border-radius: 25%;
13
12
  position: relative;
14
13
  border: 1px solid var(--cpsl-color-background-8);
15
14
  }
16
15
  :host > svg {
17
16
  fill: rgba(255, 255, 255, 0.6);
18
17
  position: absolute;
19
- width: 35%;
18
+ width: 30%;
20
19
  }
21
20
  :host > svg.rotate90 {
22
21
  transform: rotate(0.25turn);
@@ -66,4 +65,12 @@
66
65
 
67
66
  :host(.purple) {
68
67
  background: var(--identicon-background-purple);
68
+ }
69
+
70
+ :host(.empty) {
71
+ background: var(--identicon-background-empty);
72
+ }
73
+
74
+ :host(.avatar) {
75
+ border-radius: 1000px;
69
76
  }
@@ -1,4 +1,6 @@
1
1
  import { Host, h } from "@stencil/core";
2
+ import Prando from "../../lib/prando";
3
+ import { COLORS } from "../../utils/prand";
2
4
  const SingleArc = (rotation) => (h("svg", { class: {
3
5
  rotate90: rotation === 1,
4
6
  rotate180: rotation === 2,
@@ -9,35 +11,72 @@ const DoubleArc = (rotation) => (h("svg", { class: {
9
11
  rotate180: rotation === 2,
10
12
  rotate270: rotation === 3,
11
13
  }, viewBox: "0 0 12 12", xmlns: "http://www.w3.org/2000/svg" }, h("g", { "clip-path": "url(#clip0_674_255)" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24ZM12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z" }), h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18ZM12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z" })), h("defs", null, h("clipPath", { id: "clip0_674_255" }, h("rect", { width: "12", height: "12" })))));
14
+ const BASE_PATTERNS = [
15
+ [
16
+ [0, 0, 0, 0],
17
+ [0, 1, 3, 2],
18
+ ],
19
+ [
20
+ [1, 1, 0, 0],
21
+ [0, 1, 3, 2],
22
+ ],
23
+ [
24
+ [0, 1, 0, 1],
25
+ [0, 1, 3, 2],
26
+ ],
27
+ [
28
+ [0, 0, 1, 1],
29
+ [0, 1, 3, 2],
30
+ ],
31
+ [
32
+ [1, 0, 1, 0],
33
+ [0, 1, 3, 2],
34
+ ],
35
+ [
36
+ [1, 1, 1, 1],
37
+ [0, 1, 3, 2],
38
+ ],
39
+ [
40
+ [0, 0, 0, 0],
41
+ [2, 3, 1, 0],
42
+ ],
43
+ [
44
+ [1, 1, 1, 1],
45
+ [2, 3, 1, 0],
46
+ ],
47
+ [
48
+ [1, 1, 1, 1],
49
+ [0, 1, 2, 3],
50
+ ],
51
+ ];
12
52
  export class CpslIdenticon {
13
53
  constructor() {
14
54
  this.hash = undefined;
15
- this.size = 40;
55
+ this.size = '40px';
56
+ this.variant = 'default';
16
57
  }
17
58
  render() {
18
- const [code, color] = stringToBinaryAndColor(this.hash);
19
- const shapeA = ((code >> 2) & 1) !== 0;
20
- const shapeB = ((code >> 3) & 1) !== 0;
21
- const shapeC = ((code >> 4) & 1) !== 0;
22
- const shapeD = ((code >> 5) & 1) !== 0;
23
- const rotationA = (code >> 6) & 3;
24
- const rotationB = (code >> 7) & 3;
25
- const rotationC = (code >> 8) & 3;
26
- const rotationD = (code >> 9) & 3;
27
- const [shapes, rotations] = [
28
- [shapeA, shapeB, shapeC, shapeD],
29
- [rotationA, rotationB, rotationC, rotationD],
30
- ];
31
- return (h(Host, { key: '39bcae00e3fd58ff94639fbb43c77fd942899e51', class: {
32
- red: color === 'red',
33
- orange: color === 'orange',
34
- yellow: color === 'yellow',
35
- green: color === 'green',
36
- blue: color === 'blue',
37
- purple: color === 'purple',
38
- } }, shapes.map((isDouble, index) => {
39
- return isDouble ? DoubleArc(rotations[index]) : SingleArc(rotations[index]);
40
- })));
59
+ let props;
60
+ const isEmpty = !this.hash;
61
+ if (!isEmpty)
62
+ props = getIdenticonProps(this.hash);
63
+ return (h(Host, { key: 'df11955bfd534443af672f89d5133010e2ae775d', class: {
64
+ red: (props === null || props === void 0 ? void 0 : props.color) === 'red',
65
+ orange: (props === null || props === void 0 ? void 0 : props.color) === 'orange',
66
+ yellow: (props === null || props === void 0 ? void 0 : props.color) === 'yellow',
67
+ green: (props === null || props === void 0 ? void 0 : props.color) === 'green',
68
+ blue: (props === null || props === void 0 ? void 0 : props.color) === 'blue',
69
+ purple: (props === null || props === void 0 ? void 0 : props.color) === 'purple',
70
+ empty: !(props === null || props === void 0 ? void 0 : props.color) && !this.hash,
71
+ avatar: this.variant === 'avatar',
72
+ }, style: {
73
+ width: this.size,
74
+ height: this.size,
75
+ } }, (props === null || props === void 0 ? void 0 : props.shapes) &&
76
+ (props === null || props === void 0 ? void 0 : props.rotations) &&
77
+ props.shapes.map((isDouble, index) => {
78
+ return isDouble ? DoubleArc(props.rotations[index]) : SingleArc(props.rotations[index]);
79
+ })));
41
80
  }
42
81
  static get is() { return "cpsl-identicon"; }
43
82
  static get encapsulation() { return "shadow"; }
@@ -57,12 +96,12 @@ export class CpslIdenticon {
57
96
  "type": "string",
58
97
  "mutable": false,
59
98
  "complexType": {
60
- "original": "string",
99
+ "original": "string | undefined",
61
100
  "resolved": "string",
62
101
  "references": {}
63
102
  },
64
103
  "required": false,
65
- "optional": false,
104
+ "optional": true,
66
105
  "docs": {
67
106
  "tags": [],
68
107
  "text": ""
@@ -71,30 +110,56 @@ export class CpslIdenticon {
71
110
  "reflect": false
72
111
  },
73
112
  "size": {
74
- "type": "number",
113
+ "type": "string",
75
114
  "mutable": false,
76
115
  "complexType": {
77
- "original": "number",
78
- "resolved": "number",
116
+ "original": "string",
117
+ "resolved": "string",
79
118
  "references": {}
80
119
  },
81
120
  "required": false,
82
121
  "optional": false,
83
122
  "docs": {
84
123
  "tags": [],
85
- "text": "The size of the identicon.\nDefault is: 40."
124
+ "text": "The CSS width and height of the identicon.\nDefault is: 40px."
86
125
  },
87
126
  "attribute": "size",
88
127
  "reflect": false,
89
- "defaultValue": "40"
128
+ "defaultValue": "'40px'"
129
+ },
130
+ "variant": {
131
+ "type": "string",
132
+ "mutable": false,
133
+ "complexType": {
134
+ "original": "'default' | 'avatar'",
135
+ "resolved": "\"avatar\" | \"default\"",
136
+ "references": {}
137
+ },
138
+ "required": false,
139
+ "optional": false,
140
+ "docs": {
141
+ "tags": [],
142
+ "text": ""
143
+ },
144
+ "attribute": "variant",
145
+ "reflect": false,
146
+ "defaultValue": "'default'"
90
147
  }
91
148
  };
92
149
  }
93
150
  }
94
- const COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'purple'];
95
- function stringToBinaryAndColor(hash) {
96
- const code = (hash.charCodeAt(0) << 24) | (hash.charCodeAt(1) << 16) | (hash.charCodeAt(2) << 8) | hash.charCodeAt(3);
97
- const color = COLORS[Math.abs(code % 6)];
98
- return [code, color];
151
+ const PRANDO_INTS = [COLORS.length, BASE_PATTERNS.length, 16];
152
+ function getIdenticonProps(seed) {
153
+ const rng = new Prando(seed);
154
+ const [iColor, iPattern, iDeviation] = PRANDO_INTS.map(len => rng.nextInt(0, len - 1));
155
+ const deviationIndex = Math.floor(iDeviation / 4);
156
+ const [isDeviateShape, isDeviateFlip] = [iDeviation % 2 === 1, iDeviation % 4 >= 2];
157
+ return {
158
+ color: COLORS[iColor],
159
+ shapes: BASE_PATTERNS[iPattern][0].map((s, i) => {
160
+ return i === deviationIndex ? (isDeviateShape ? (s === 1 ? false : true) : s === 1) : s === 1;
161
+ }),
162
+ rotations: BASE_PATTERNS[iPattern][1].map((r, i) => (i === deviationIndex ? (isDeviateFlip ? (r + 2) % 4 : r) : r)),
163
+ };
99
164
  }
100
165
  //# sourceMappingURL=cpsl-identicon.js.map