@usecapsule/core-components 3.0.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (234) hide show
  1. package/css/capsule-core.css +93 -24
  2. package/css/capsule-core.css.map +1 -1
  3. package/dist/capsule/capsule.esm.js +1 -1
  4. package/dist/capsule/capsule.esm.js.map +1 -1
  5. package/dist/capsule/index.esm.js +1 -1
  6. package/dist/capsule/index.esm.js.map +1 -1
  7. package/dist/capsule/p-397edab5.entry.js +2 -0
  8. package/dist/capsule/{p-ad14a817.entry.js.map → p-397edab5.entry.js.map} +1 -1
  9. package/dist/capsule/p-52d6ebee.entry.js +2 -0
  10. package/dist/capsule/{p-fcead80b.entry.js.map → p-52d6ebee.entry.js.map} +1 -1
  11. package/dist/capsule/p-5ed5e96c.entry.js +2 -0
  12. package/dist/capsule/p-5ed5e96c.entry.js.map +1 -0
  13. package/dist/capsule/p-6e71539d.js +3 -0
  14. package/dist/capsule/p-6e71539d.js.map +1 -0
  15. package/dist/capsule/p-6e900654.entry.js +29 -0
  16. package/dist/capsule/p-6e900654.entry.js.map +1 -0
  17. package/dist/capsule/{p-0d0a0037.entry.js → p-70f95c93.entry.js} +2 -2
  18. package/dist/capsule/{p-0d0a0037.entry.js.map → p-70f95c93.entry.js.map} +1 -1
  19. package/dist/capsule/p-86e6cba5.entry.js +10 -0
  20. package/dist/capsule/{p-d28b96ba.entry.js.map → p-86e6cba5.entry.js.map} +1 -1
  21. package/dist/capsule/p-f2393be6.js +2 -0
  22. package/dist/capsule/p-f2393be6.js.map +1 -0
  23. package/dist/capsule/{p-fa078837.entry.js → p-f9351426.entry.js} +2 -2
  24. package/dist/capsule/{p-fa078837.entry.js.map → p-f9351426.entry.js.map} +1 -1
  25. package/dist/cjs/capsule.cjs.js +10 -10
  26. package/dist/cjs/capsule.cjs.js.map +1 -1
  27. package/dist/cjs/{constants-0869a780.js → constants-9b1b01bb.js} +3 -3
  28. package/dist/cjs/{constants-0869a780.js.map → constants-9b1b01bb.js.map} +1 -1
  29. package/dist/cjs/{cpsl-alert_29.cjs.entry.js → cpsl-alert_33.cjs.entry.js} +663 -94
  30. package/dist/cjs/cpsl-alert_33.cjs.entry.js.map +1 -0
  31. package/dist/cjs/cpsl-animation.cjs.entry.js +2 -2
  32. package/dist/cjs/cpsl-col.cjs.entry.js +2 -2
  33. package/dist/cjs/cpsl-grid.cjs.entry.js +3 -3
  34. package/dist/cjs/cpsl-info-box.cjs.entry.js +3 -3
  35. package/dist/cjs/cpsl-info-box.cjs.entry.js.map +1 -1
  36. package/dist/cjs/cpsl-modal-v2.cjs.entry.js +55 -0
  37. package/dist/cjs/cpsl-modal-v2.cjs.entry.js.map +1 -0
  38. package/dist/cjs/cpsl-row.cjs.entry.js +2 -2
  39. package/dist/cjs/index-85125285.js +1414 -0
  40. package/dist/cjs/index-85125285.js.map +1 -0
  41. package/dist/cjs/index.cjs.js +116 -107
  42. package/dist/cjs/index.cjs.js.map +1 -1
  43. package/dist/cjs/loader.cjs.js +2 -2
  44. package/dist/collection/assets/icons/chevron-up.svg +2 -2
  45. package/dist/collection/assets/icons/close.svg +3 -4
  46. package/dist/collection/assets/icons/cube.svg +3 -0
  47. package/dist/collection/assets/icons/farcaster-brand.svg +10 -0
  48. package/dist/collection/assets/icons/farcaster.svg +10 -0
  49. package/dist/collection/assets/icons/image.svg +3 -0
  50. package/dist/collection/assets/icons/index.js +9 -1
  51. package/dist/collection/assets/icons/index.js.map +1 -1
  52. package/dist/collection/assets/icons/menu.svg +3 -0
  53. package/dist/collection/assets/icons/refresh.svg +3 -0
  54. package/dist/collection/assets/icons/stars.svg +4 -0
  55. package/dist/collection/assets/icons/x.svg +3 -0
  56. package/dist/collection/collection-manifest.json +7 -2
  57. package/dist/collection/components/cpsl-alert/cpsl-alert.js +2 -2
  58. package/dist/collection/components/cpsl-alert/cpsl-alert.js.map +1 -1
  59. package/dist/collection/components/cpsl-animation/cpsl-animation.js +1 -1
  60. package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js +20 -4
  61. package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js.map +1 -1
  62. package/dist/collection/components/cpsl-avatar/cpsl-avatar.js +1 -1
  63. package/dist/collection/components/cpsl-button/cpsl-button.css +113 -17
  64. package/dist/collection/components/cpsl-button/cpsl-button.js +63 -7
  65. package/dist/collection/components/cpsl-button/cpsl-button.js.map +1 -1
  66. package/dist/collection/components/cpsl-button-group/cpsl-button-group.css +1 -0
  67. package/dist/collection/components/cpsl-button-group/cpsl-button-group.js +1 -1
  68. package/dist/collection/components/cpsl-card/cpsl-card.css +1 -1
  69. package/dist/collection/components/cpsl-card/cpsl-card.js +1 -1
  70. package/dist/collection/components/cpsl-card/cpsl-card.js.map +1 -1
  71. package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.css +2 -2
  72. package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.js +1 -1
  73. package/dist/collection/components/cpsl-code-input/cpsl-code-input.css +1 -1
  74. package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +2 -2
  75. package/dist/collection/components/cpsl-code-input/cpsl-code-input.js.map +1 -1
  76. package/dist/collection/components/cpsl-col/cpsl-col.js +1 -1
  77. package/dist/collection/components/cpsl-divider/cpsl-divider.css +1 -1
  78. package/dist/collection/components/cpsl-divider/cpsl-divider.js +1 -1
  79. package/dist/collection/components/cpsl-drawer/cpsl-drawer.js +84 -11
  80. package/dist/collection/components/cpsl-drawer/cpsl-drawer.js.map +1 -1
  81. package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +1 -1
  82. package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js.map +1 -1
  83. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.css +211 -0
  84. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js +406 -0
  85. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js.map +1 -0
  86. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js +29 -0
  87. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js.map +1 -0
  88. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js +37 -0
  89. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js.map +1 -0
  90. package/dist/collection/components/cpsl-grid/cpsl-grid.js +2 -2
  91. package/dist/collection/components/cpsl-icon/cpsl-icon.js +2 -2
  92. package/dist/collection/components/cpsl-info-box/cpsl-info-box.css +1 -1
  93. package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +1 -1
  94. package/dist/collection/components/cpsl-input/cpsl-input.css +7 -6
  95. package/dist/collection/components/cpsl-input/cpsl-input.js +3 -8
  96. package/dist/collection/components/cpsl-input/cpsl-input.js.map +1 -1
  97. package/dist/collection/components/cpsl-modal/cpsl-modal.css +4 -4
  98. package/dist/collection/components/cpsl-modal/cpsl-modal.js +1 -0
  99. package/dist/collection/components/cpsl-modal/cpsl-modal.js.map +1 -1
  100. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.css +91 -0
  101. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js +224 -0
  102. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js.map +1 -0
  103. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js +29 -0
  104. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js.map +1 -0
  105. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js +37 -0
  106. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js.map +1 -0
  107. package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.js +1 -1
  108. package/dist/collection/components/cpsl-overlay/cpsl-overlay.css +1 -1
  109. package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +1 -1
  110. package/dist/collection/components/cpsl-pagination/cpsl-pagination.css +4 -0
  111. package/dist/collection/components/cpsl-pagination/cpsl-pagination.js +1 -1
  112. package/dist/collection/components/cpsl-pagination/cpsl-pagination.js.map +1 -1
  113. package/dist/collection/components/cpsl-pill/cpsl-pill.css +1 -1
  114. package/dist/collection/components/cpsl-pill/cpsl-pill.js +1 -1
  115. package/dist/collection/components/cpsl-popover/cpsl-popover.css +98 -0
  116. package/dist/collection/components/cpsl-popover/cpsl-popover.js +511 -0
  117. package/dist/collection/components/cpsl-popover/cpsl-popover.js.map +1 -0
  118. package/dist/collection/components/cpsl-popover/test/cpsl-popover.e2e.js +29 -0
  119. package/dist/collection/components/cpsl-popover/test/cpsl-popover.e2e.js.map +1 -0
  120. package/dist/collection/components/cpsl-popover/test/cpsl-popover.spec.js +37 -0
  121. package/dist/collection/components/cpsl-popover/test/cpsl-popover.spec.js.map +1 -0
  122. package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.css +3 -3
  123. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.css +1 -1
  124. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +1 -1
  125. package/dist/collection/components/cpsl-radio/cpsl-radio.css +2 -2
  126. package/dist/collection/components/cpsl-radio/cpsl-radio.js +1 -1
  127. package/dist/collection/components/cpsl-row/cpsl-row.js +1 -1
  128. package/dist/collection/components/cpsl-select/cpsl-select.css +229 -0
  129. package/dist/collection/components/cpsl-select/cpsl-select.js +409 -0
  130. package/dist/collection/components/cpsl-select/cpsl-select.js.map +1 -0
  131. package/dist/collection/components/cpsl-select/test/cpsl-select.e2e.js +29 -0
  132. package/dist/collection/components/cpsl-select/test/cpsl-select.e2e.js.map +1 -0
  133. package/dist/collection/components/cpsl-select/test/cpsl-select.spec.js +37 -0
  134. package/dist/collection/components/cpsl-select/test/cpsl-select.spec.js.map +1 -0
  135. package/dist/collection/components/cpsl-select-item/cpsl-select-item.css +114 -0
  136. package/dist/collection/components/cpsl-select-item/cpsl-select-item.js +85 -0
  137. package/dist/collection/components/cpsl-select-item/cpsl-select-item.js.map +1 -0
  138. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.e2e.js +29 -0
  139. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.e2e.js.map +1 -0
  140. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.spec.js +37 -0
  141. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.spec.js.map +1 -0
  142. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.css +3 -3
  143. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +3 -3
  144. package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +2 -2
  145. package/dist/collection/components/cpsl-switch/cpsl-switch.css +4 -4
  146. package/dist/collection/components/cpsl-switch/cpsl-switch.js +1 -1
  147. package/dist/collection/components/cpsl-tab/cpsl-tab.js +1 -1
  148. package/dist/collection/components/cpsl-table/cpsl-table.css +48 -60
  149. package/dist/collection/components/cpsl-table/cpsl-table.js +34 -58
  150. package/dist/collection/components/cpsl-table/cpsl-table.js.map +1 -1
  151. package/dist/collection/components/cpsl-tabs/cpsl-tabs.css +2 -2
  152. package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +1 -1
  153. package/dist/collection/components/cpsl-text/cpsl-text.css +4 -0
  154. package/dist/collection/components/cpsl-text/cpsl-text.js +5 -4
  155. package/dist/collection/components/cpsl-text/cpsl-text.js.map +1 -1
  156. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.css +1 -1
  157. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +2 -2
  158. package/dist/collection/constants.js +2 -2
  159. package/dist/collection/constants.js.map +1 -1
  160. package/dist/collection/interface.js.map +1 -1
  161. package/dist/collection/utils/theme/generateBorderRadii.js +40 -39
  162. package/dist/collection/utils/theme/generateBorderRadii.js.map +1 -1
  163. package/dist/collection/utils/theme/generatePalette.js +11 -3
  164. package/dist/collection/utils/theme/generatePalette.js.map +1 -1
  165. package/dist/collection/utils/theme/generateTheme.js +2 -2
  166. package/dist/collection/utils/theme/generateTheme.js.map +1 -1
  167. package/dist/collection/utils/theme/utils.js +1 -0
  168. package/dist/collection/utils/theme/utils.js.map +1 -1
  169. package/dist/esm/capsule.js +11 -11
  170. package/dist/esm/capsule.js.map +1 -1
  171. package/dist/esm/{constants-6acf4ea8.js → constants-fce138fa.js} +3 -3
  172. package/dist/esm/{constants-6acf4ea8.js.map → constants-fce138fa.js.map} +1 -1
  173. package/dist/esm/{cpsl-alert_29.entry.js → cpsl-alert_33.entry.js} +660 -95
  174. package/dist/esm/cpsl-alert_33.entry.js.map +1 -0
  175. package/dist/esm/cpsl-animation.entry.js +2 -2
  176. package/dist/esm/cpsl-col.entry.js +2 -2
  177. package/dist/esm/cpsl-grid.entry.js +3 -3
  178. package/dist/esm/cpsl-info-box.entry.js +3 -3
  179. package/dist/esm/cpsl-info-box.entry.js.map +1 -1
  180. package/dist/esm/cpsl-modal-v2.entry.js +51 -0
  181. package/dist/esm/cpsl-modal-v2.entry.js.map +1 -0
  182. package/dist/esm/cpsl-row.entry.js +2 -2
  183. package/dist/esm/index-b9a060b3.js +1383 -0
  184. package/dist/esm/index-b9a060b3.js.map +1 -0
  185. package/dist/esm/index.js +116 -107
  186. package/dist/esm/index.js.map +1 -1
  187. package/dist/esm/loader.js +3 -3
  188. package/dist/loader/cdn.js +1 -3
  189. package/dist/loader/index.cjs.js +1 -3
  190. package/dist/loader/index.es2017.js +1 -3
  191. package/dist/loader/index.js +1 -3
  192. package/dist/types/assets/icons/index.d.ts +8 -0
  193. package/dist/types/components/cpsl-app-bar/cpsl-app-bar.d.ts +1 -0
  194. package/dist/types/components/cpsl-button/cpsl-button.d.ts +4 -1
  195. package/dist/types/components/cpsl-drawer/cpsl-drawer.d.ts +10 -1
  196. package/dist/types/components/cpsl-file-upload/cpsl-file-upload.d.ts +34 -0
  197. package/dist/types/components/cpsl-input/cpsl-input.d.ts +1 -1
  198. package/dist/types/components/cpsl-modal-v2/cpsl-modal-v2.d.ts +17 -0
  199. package/dist/types/components/cpsl-popover/cpsl-popover.d.ts +35 -0
  200. package/dist/types/components/cpsl-select/cpsl-select.d.ts +38 -0
  201. package/dist/types/components/cpsl-select-item/cpsl-select-item.d.ts +8 -0
  202. package/dist/types/components/cpsl-table/cpsl-table.d.ts +6 -3
  203. package/dist/types/components/cpsl-text/cpsl-text.d.ts +1 -1
  204. package/dist/types/components.d.ts +596 -28
  205. package/dist/types/constants.d.ts +2 -2
  206. package/dist/types/interface.d.ts +68 -1
  207. package/dist/types/stencil-public-runtime.d.ts +3 -8
  208. package/dist/types/utils/theme/generateBorderRadii.d.ts +1 -1
  209. package/dist/types/utils/theme/generateTheme.d.ts +1 -1
  210. package/dist/types/utils/theme/utils.d.ts +4 -1
  211. package/package.json +2 -2
  212. package/dist/capsule/p-107e1ff5.entry.js +0 -29
  213. package/dist/capsule/p-107e1ff5.entry.js.map +0 -1
  214. package/dist/capsule/p-86e48e61.js +0 -3
  215. package/dist/capsule/p-86e48e61.js.map +0 -1
  216. package/dist/capsule/p-ad14a817.entry.js +0 -2
  217. package/dist/capsule/p-b6b38e73.js +0 -2
  218. package/dist/capsule/p-b6b38e73.js.map +0 -1
  219. package/dist/capsule/p-d28b96ba.entry.js +0 -10
  220. package/dist/capsule/p-fcead80b.entry.js +0 -2
  221. package/dist/cjs/cpsl-alert_29.cjs.entry.js.map +0 -1
  222. package/dist/cjs/index-5733071e.js +0 -2020
  223. package/dist/cjs/index-5733071e.js.map +0 -1
  224. package/dist/collection/components/cpsl-table/table-interface.js +0 -2
  225. package/dist/collection/components/cpsl-table/table-interface.js.map +0 -1
  226. package/dist/esm/cpsl-alert_29.entry.js.map +0 -1
  227. package/dist/esm/index-8fe9f35e.js +0 -1990
  228. package/dist/esm/index-8fe9f35e.js.map +0 -1
  229. package/dist/esm/polyfills/core-js.js +0 -11
  230. package/dist/esm/polyfills/dom.js +0 -79
  231. package/dist/esm/polyfills/es5-html-element.js +0 -1
  232. package/dist/esm/polyfills/index.js +0 -34
  233. package/dist/esm/polyfills/system.js +0 -6
  234. package/dist/types/components/cpsl-table/table-interface.d.ts +0 -19
@@ -86,12 +86,12 @@ span.container {
86
86
  height: 100%;
87
87
  border-radius: var(--container-border-radius);
88
88
  border: var(--container-border-width-default) solid;
89
- background-color: var(--container-background-color-default);
89
+ background: var(--container-background-color-default);
90
90
  border-color: var(--container-border-color-default);
91
91
  transition: all 0.15s ease-in-out;
92
92
  }
93
93
  span.container.checked {
94
- background-color: var(--container-background-color-checked);
94
+ background: var(--container-background-color-checked);
95
95
  border-color: var(--container-border-color-checked);
96
96
  border-width: var(--container-border-width-checked);
97
97
  }
@@ -9,7 +9,7 @@ export class CpslRadio {
9
9
  this.checked = undefined;
10
10
  }
11
11
  render() {
12
- return (h(Host, { key: '9c027812c817ec008e28b66fb74ca35e407f2572' }, h("input", { key: 'da445cfc2c18da5852cd21d54daf14897d3bc13a', type: "radio", checked: this.checked }), h("span", { key: '2f432d7c3a6f33ea7581a8c62dd84078de1904d1', onClick: this.handleRadioClick, class: { container: true, checked: this.checked } })));
12
+ return (h(Host, { key: '43659e8ba43bfe8a53578d357d2ab9a3c3bcbd96' }, h("input", { key: 'dc9c9328be5a09b00b4e02b74934ffa02312441d', type: "radio", checked: this.checked }), h("span", { key: '87436a09ace01394e860786950a916efb26a9bb7', onClick: this.handleRadioClick, class: { container: true, checked: this.checked } })));
13
13
  }
14
14
  static get is() { return "cpsl-radio"; }
15
15
  static get encapsulation() { return "shadow"; }
@@ -1,7 +1,7 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  export class CpslRow {
3
3
  render() {
4
- return (h(Host, { key: '4a88600c071a5ec733e3480e94037c2936effacd' }, h("slot", { key: '6ed654883b1acd711843480702821efba06cec96' })));
4
+ return (h(Host, { key: 'a227664834127c3580926c34abdc7aacdbd9ffd6' }, h("slot", { key: '61010658365df7a30f0e3b05f45436da5acf6720' })));
5
5
  }
6
6
  static get is() { return "cpsl-row"; }
7
7
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Convert a font size to a dynamic font size.
3
+ * Fonts that participate in Dynamic Type should use
4
+ * dynamic font sizes.
5
+ * @param size - The initial font size including the unit (i.e. px or pt)
6
+ * @param unit (optional) - The unit to convert to. Use this if you want to
7
+ * convert to a unit other than $baselineUnit.
8
+ */
9
+ /**
10
+ * Convert a font size to a dynamic font size but impose
11
+ * a maximum font size.
12
+ * @param size - The initial font size including the unit (i.e. px or pt)
13
+ * @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
14
+ * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
15
+ * convert to a unit other than $baselineUnit.
16
+ */
17
+ /**
18
+ * Convert a font size to a dynamic font size but impose
19
+ * a minimum font size.
20
+ * @param size - The initial font size including the unit (i.e. px or pt)
21
+ * @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
22
+ * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
23
+ * convert to a unit other than $baselineUnit.
24
+ */
25
+ /**
26
+ * Convert a font size to a dynamic font size but impose
27
+ * maximum and minimum font sizes.
28
+ * @param size - The initial font size including the unit (i.e. px or pt)
29
+ * @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
30
+ * @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
31
+ * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
32
+ * convert to a unit other than $baselineUnit.
33
+ */
34
+ /**
35
+ * A heuristic that applies CSS to tablet
36
+ * viewports.
37
+ *
38
+ * Usage:
39
+ * @include tablet-viewport() {
40
+ * :host {
41
+ * background-color: green;
42
+ * }
43
+ * }
44
+ */
45
+ /**
46
+ * A heuristic that applies CSS to mobile
47
+ * viewports (i.e. phones, not tablets).
48
+ *
49
+ * Usage:
50
+ * @include mobile-viewport() {
51
+ * :host {
52
+ * background-color: blue;
53
+ * }
54
+ * }
55
+ */
56
+ :host {
57
+ --container-box-shadow: none;
58
+ --container-box-shadow-color: var(--cpsl-color-select-border-placeholder);
59
+ --container-border-color: var(--cpsl-color-select-border-active);
60
+ --container-border-error-color: var(--cpsl-color-select-border-error);
61
+ --container-background-color: var(--cpsl-color-select-surface-default);
62
+ --container-background-color-disabled: var(--cpsl-color-select-surface-disabled);
63
+ --container-border-width: 1px;
64
+ --container-border-radius: var(--cpsl-border-radius-select);
65
+ --container-padding-top: 0px;
66
+ --container-padding-bottom: 0px;
67
+ --container-padding-end: 12px;
68
+ --container-padding-start: 12px;
69
+ --container-height: 48px;
70
+ --container-gap: 8px;
71
+ --dropdown-margin-top: 4px;
72
+ --dropdown-border-width: 1px;
73
+ --dropdown-border-radius: var(--cpsl-border-radius-select);
74
+ --dropdown-border-color: var(--cpsl-color-select-dropdown-border);
75
+ --optional-label-color: var(--cpsl-color-text-secondary);
76
+ --label-color: var(--cpsl-color-text-primary);
77
+ --label-font-size: var(--cpsl-font-size-body-s);
78
+ --label-margin-bottom: 0px;
79
+ --helper-text-color: var(--cpsl-color-text-secondary);
80
+ --helper-text-error-color: var(--cpsl-color-text-error);
81
+ --helper-text-icon-color: var(--cpsl-color-text-secondary);
82
+ --helper-text-icon-error-color: var(--cpsl-color-text-error);
83
+ --helper-text-icon-size: 16px;
84
+ --helper-text-font-size: var(--cpsl-font-size-body-xs);
85
+ --helper-text-margin-top: 0px;
86
+ display: flex;
87
+ flex-direction: column;
88
+ gap: 4px;
89
+ font-family: var(--cpsl-font-family, inherit);
90
+ }
91
+
92
+ input {
93
+ box-sizing: border-box;
94
+ position: absolute;
95
+ width: 100%;
96
+ height: 100%;
97
+ margin: 0px;
98
+ opacity: 0;
99
+ top: 0;
100
+ left: 0;
101
+ z-index: -1;
102
+ cursor: pointer;
103
+ }
104
+ input.disabled {
105
+ cursor: default;
106
+ }
107
+
108
+ :host(:not(.has-value)) {
109
+ --container-border-color: var(--cpsl-color-select-border-placeholder);
110
+ --select-color: var(--cpsl-color-text-secondary);
111
+ }
112
+
113
+ :host(.disabled) {
114
+ --container-background-color: var(--container-background-color-disabled);
115
+ --select-background-color: var(--select-background-color-disabled);
116
+ --select-color: var(--cpsl-color-text-disabled);
117
+ }
118
+
119
+ :host(.focused) {
120
+ --container-box-shadow: 0px 0px 0px 2px var(--container-box-shadow-color);
121
+ --container-border-color: var(--cpsl-color-select-border-active);
122
+ --container-background-color: var(--cpsl-color-select-surface-default);
123
+ }
124
+
125
+ .select-container {
126
+ -webkit-padding-start: var(--container-padding-start);
127
+ padding-inline-start: var(--container-padding-start);
128
+ -webkit-padding-end: var(--container-padding-end);
129
+ padding-inline-end: var(--container-padding-end);
130
+ padding-top: var(--container-padding-top);
131
+ padding-bottom: var(--container-padding-bottom);
132
+ position: relative;
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: space-between;
136
+ gap: 8px;
137
+ box-sizing: border-box;
138
+ height: var(--container-height);
139
+ gap: var(--container-gap);
140
+ cursor: pointer;
141
+ border-style: solid;
142
+ border-width: var(--container-border-width);
143
+ border-color: var(--container-border-color);
144
+ border-radius: var(--container-border-radius);
145
+ background: var(--container-background-color);
146
+ box-shadow: var(--container-box-shadow);
147
+ }
148
+
149
+ .error-container {
150
+ border-color: var(--container-border-error-color);
151
+ }
152
+
153
+ .label {
154
+ display: inline-block;
155
+ color: var(--label-color);
156
+ font-size: var(--label-font-size);
157
+ font-weight: 500;
158
+ margin-bottom: var(--label-margin-bottom);
159
+ }
160
+
161
+ .optional-label {
162
+ display: inline-block;
163
+ color: var(--optional-label-color);
164
+ font-size: var(--label-font-size);
165
+ font-weight: 500;
166
+ }
167
+
168
+ .helper-text-container {
169
+ display: flex;
170
+ align-items: center;
171
+ gap: 4px;
172
+ color: var(--helper-text-color);
173
+ font-size: var(--helper-text-font-size);
174
+ font-weight: 500;
175
+ margin-top: var(--helper-text-margin-top);
176
+ }
177
+ .helper-text-container cpsl-icon {
178
+ --height: var(--helper-text-icon-size);
179
+ --width: var(--helper-text-icon-size);
180
+ --icon-color: var(--helper-text-icon-color);
181
+ }
182
+
183
+ .error-text {
184
+ color: var(--helper-text-error-color);
185
+ }
186
+ .error-text cpsl-icon {
187
+ --icon-color: var(--helper-text-icon-error-color);
188
+ }
189
+
190
+ .selected-container-content {
191
+ flex: 1;
192
+ }
193
+
194
+ .chevron {
195
+ transition: transform 0.3s ease;
196
+ transform: rotate(180deg);
197
+ --icon-color: var(--cpsl-color-text-disabled);
198
+ }
199
+ .chevron.open {
200
+ transform: rotate(0deg);
201
+ --icon-color: var(--cpsl-color-text-primary);
202
+ }
203
+ .chevron.has-value {
204
+ --icon-color: var(--cpsl-color-text-primary);
205
+ }
206
+
207
+ .selected-text {
208
+ color: var(--cpsl-color-text-primary);
209
+ }
210
+ .selected-text.placeholder {
211
+ color: var(--cpsl-color-text-disabled);
212
+ }
213
+
214
+ .dropdown {
215
+ margin-top: var(--dropdown-margin-top);
216
+ border-style: solid;
217
+ border-width: var(--dropdown-border-width);
218
+ border-color: var(--dropdown-border-color);
219
+ border-radius: var(--dropdown-border-radius);
220
+ overflow: hidden;
221
+ }
222
+ .dropdown ::slotted(*:last-child) {
223
+ --container-border-width: 0px;
224
+ }
225
+
226
+ .dropdown-inner {
227
+ overflow: auto;
228
+ scrollbar-width: thin;
229
+ }
@@ -0,0 +1,409 @@
1
+ import { Host, h } from "@stencil/core";
2
+ export class CpslSelect {
3
+ constructor() {
4
+ this.inputId = `cpsl-select-${inputIds++}`;
5
+ this.onBlur = (ev) => {
6
+ this.hasFocus = false;
7
+ this.popoverEl.closePopover();
8
+ this.cpslBlur.emit(ev);
9
+ };
10
+ this.onFocus = (ev) => {
11
+ this.hasFocus = true;
12
+ this.cpslFocus.emit(ev);
13
+ };
14
+ this.handleEnterPress = (ev) => {
15
+ if (ev.key === 'Enter') {
16
+ ev.preventDefault();
17
+ this.el.dispatchEvent(new MouseEvent('mousedown'));
18
+ }
19
+ };
20
+ this.selectItem = () => {
21
+ const items = Array.from(this.el.querySelectorAll('cpsl-select-item'));
22
+ items.forEach(item => {
23
+ if (item.value === this.selectedValue) {
24
+ item.setAttribute('selected', 'true');
25
+ this.hasSelectedItem = true;
26
+ }
27
+ else {
28
+ item.setAttribute('selected', 'false');
29
+ }
30
+ });
31
+ if (!Boolean(this.selectedValue)) {
32
+ this.hasSelectedItem = false;
33
+ }
34
+ };
35
+ this.handleClickOutside = (event) => {
36
+ if (this.hasFocus && !this.el.contains(event.target)) {
37
+ this.hasFocus = false;
38
+ window.removeEventListener('click', this.handleClickOutside);
39
+ }
40
+ };
41
+ this.handleClick = () => {
42
+ if (!this.disabled) {
43
+ this.hasFocus = true;
44
+ window.addEventListener('click', this.handleClickOutside);
45
+ }
46
+ };
47
+ this.anchorEl = undefined;
48
+ this.hasFocus = false;
49
+ this.popoverOpen = false;
50
+ this.hasSelectedItem = false;
51
+ this.disabled = false;
52
+ this.dropdownMaxHeight = undefined;
53
+ this.errorText = undefined;
54
+ this.formatValue = undefined;
55
+ this.helperText = undefined;
56
+ this.id = `${this.inputId}-trigger`;
57
+ this.label = undefined;
58
+ this.placeholder = undefined;
59
+ this.required = false;
60
+ this.selectedValue = undefined;
61
+ this.showFormattedSelectedItem = undefined;
62
+ this.showOptionalLabel = false;
63
+ }
64
+ onValueChange() {
65
+ this.popoverEl.closePopover();
66
+ }
67
+ handleValueChange() {
68
+ this.selectItem();
69
+ }
70
+ selectItemClickHandler(event) {
71
+ this.cpslSelectValueChange.emit(event.detail);
72
+ }
73
+ onPopoverOpen() {
74
+ this.popoverOpen = true;
75
+ }
76
+ onPopoverClose() {
77
+ this.popoverOpen = false;
78
+ }
79
+ componentDidLoad() {
80
+ this.popoverEl = this.el.shadowRoot.querySelector(`cpsl-popover`);
81
+ this.anchorEl = this.el.shadowRoot.getElementById('select-container');
82
+ this.selectItem();
83
+ }
84
+ render() {
85
+ var _a, _b, _c, _d;
86
+ return (h(Host, { key: 'dfe6786c9be71ebd71fee236c9b569ef1ad30eac', id: this.id, class: { 'disabled': this.disabled, 'focused': this.hasFocus, 'has-value': Boolean(this.selectedValue) } }, this.label && (h("label", { key: 'fbe2cfb2d93558f647442e17b29713f37375be5a', class: "label", htmlFor: this.inputId }, this.label, this.required ? '*' : ' ', !this.required && this.showOptionalLabel ? h("span", { class: "optional-label" }, "(optional)") : '')), h("div", { key: '9e5fdf3c056a7a6c13fe9ce45caf78e27482e779', id: "select-container", class: { 'select-container': true, 'error-container': Boolean(this.errorText) }, onMouseDown: this.handleClick }, this.hasSelectedItem && this.showFormattedSelectedItem && h("slot", { key: 'c721fcd057a142bad5f8f473c7b4daf090e7722a', name: "selected-item" }), h("div", { key: '58c94ace573965e8151ef4a9c0648385d6b1c4dc', class: "selected-container-content", id: "selected-container-content" }, (!this.hasSelectedItem || !this.showFormattedSelectedItem) && (h("cpsl-text", { key: 'ceb4c60607b6c2cbc17a086fe702045196afbd44', class: { 'selected-text': true, 'placeholder': !Boolean(this.selectedValue) } }, !Boolean(this.selectedValue) ? (_a = this.placeholder) !== null && _a !== void 0 ? _a : 'Select' : (_c = (_b = this.formatValue) === null || _b === void 0 ? void 0 : _b.call(this, this.selectedValue)) !== null && _c !== void 0 ? _c : this.selectedValue))), h("cpsl-icon", { key: '05cf53f1ce3f8f34e47082c591f2d75d4aeea11b', class: { 'chevron': true, 'open': this.popoverOpen, 'has-value': Boolean(this.selectedValue) }, icon: "chevronUp" }), h("input", { key: 'a395add0f06b0d10f1e2e6d0ea81478f4a1c07d6', id: this.inputId, disabled: this.disabled, class: { disabled: this.disabled }, value: this.selectedValue, onFocus: this.onFocus, onBlur: this.onBlur, onKeyPress: this.handleEnterPress, inputmode: "none" })), (this.errorText || this.helperText) && (h("div", { key: 'e7f991ed99ed332f5f42e666bfd2d25eecff3113', class: { 'helper-text-container': true, 'error-text': Boolean(this.errorText) } }, h("span", { key: 'f734a586f0dd7e94ccb2d7806fc9a6a5bdb5f50b' }, (_d = this.errorText) !== null && _d !== void 0 ? _d : this.helperText))), h("cpsl-popover", { key: 'c45f42267e3b4945823e27f5901b58dc5545a51e', autoWidth: false, trigger: this.id, preventBlur: this.hasFocus, disabled: this.disabled, anchorEl: this.anchorEl }, h("div", { key: 'cd7bdc9a3e06a2c4aed9ebe12ec3cd070e323b12', class: "dropdown" }, h("div", { key: '0e1483542dd9d63ad548242a2bc2ecb2041f8ed5', class: "dropdown-inner", style: { maxHeight: `${this.dropdownMaxHeight}px` } }, h("slot", { key: 'e7697bc187fc433ccb2f5728f8944ff2162387d9', name: "items" }))))));
87
+ }
88
+ static get is() { return "cpsl-select"; }
89
+ static get encapsulation() { return "shadow"; }
90
+ static get originalStyleUrls() {
91
+ return {
92
+ "$": ["cpsl-select.scss"]
93
+ };
94
+ }
95
+ static get styleUrls() {
96
+ return {
97
+ "$": ["cpsl-select.css"]
98
+ };
99
+ }
100
+ static get properties() {
101
+ return {
102
+ "disabled": {
103
+ "type": "boolean",
104
+ "mutable": false,
105
+ "complexType": {
106
+ "original": "boolean",
107
+ "resolved": "boolean",
108
+ "references": {}
109
+ },
110
+ "required": false,
111
+ "optional": false,
112
+ "docs": {
113
+ "tags": [],
114
+ "text": "If `true`, the user cannot interact with the input."
115
+ },
116
+ "attribute": "disabled",
117
+ "reflect": false,
118
+ "defaultValue": "false"
119
+ },
120
+ "dropdownMaxHeight": {
121
+ "type": "number",
122
+ "mutable": false,
123
+ "complexType": {
124
+ "original": "number",
125
+ "resolved": "number",
126
+ "references": {}
127
+ },
128
+ "required": false,
129
+ "optional": true,
130
+ "docs": {
131
+ "tags": [],
132
+ "text": "Set the max height of the dropdown."
133
+ },
134
+ "attribute": "dropdown-max-height",
135
+ "reflect": false
136
+ },
137
+ "errorText": {
138
+ "type": "string",
139
+ "mutable": false,
140
+ "complexType": {
141
+ "original": "string",
142
+ "resolved": "string",
143
+ "references": {}
144
+ },
145
+ "required": false,
146
+ "optional": true,
147
+ "docs": {
148
+ "tags": [],
149
+ "text": "Error text to show below the input. If this is provided the input will enter an error state."
150
+ },
151
+ "attribute": "error-text",
152
+ "reflect": false
153
+ },
154
+ "formatValue": {
155
+ "type": "unknown",
156
+ "mutable": false,
157
+ "complexType": {
158
+ "original": "(value: string) => string",
159
+ "resolved": "(value: string) => string",
160
+ "references": {}
161
+ },
162
+ "required": false,
163
+ "optional": true,
164
+ "docs": {
165
+ "tags": [],
166
+ "text": "Format value for display when selected."
167
+ }
168
+ },
169
+ "helperText": {
170
+ "type": "string",
171
+ "mutable": false,
172
+ "complexType": {
173
+ "original": "string",
174
+ "resolved": "string",
175
+ "references": {}
176
+ },
177
+ "required": false,
178
+ "optional": true,
179
+ "docs": {
180
+ "tags": [],
181
+ "text": "Helper text to show below the input. If `\"errorText\"` is provided that will take precedence."
182
+ },
183
+ "attribute": "helper-text",
184
+ "reflect": false
185
+ },
186
+ "id": {
187
+ "type": "string",
188
+ "mutable": false,
189
+ "complexType": {
190
+ "original": "string",
191
+ "resolved": "string",
192
+ "references": {}
193
+ },
194
+ "required": false,
195
+ "optional": false,
196
+ "docs": {
197
+ "tags": [],
198
+ "text": "ID of the element, must be unique for the popover trigger."
199
+ },
200
+ "attribute": "id",
201
+ "reflect": false,
202
+ "defaultValue": "`${this.inputId}-trigger`"
203
+ },
204
+ "label": {
205
+ "type": "string",
206
+ "mutable": false,
207
+ "complexType": {
208
+ "original": "string",
209
+ "resolved": "string",
210
+ "references": {}
211
+ },
212
+ "required": false,
213
+ "optional": true,
214
+ "docs": {
215
+ "tags": [],
216
+ "text": "The label for the input."
217
+ },
218
+ "attribute": "label",
219
+ "reflect": false
220
+ },
221
+ "placeholder": {
222
+ "type": "string",
223
+ "mutable": false,
224
+ "complexType": {
225
+ "original": "string",
226
+ "resolved": "string",
227
+ "references": {}
228
+ },
229
+ "required": false,
230
+ "optional": true,
231
+ "docs": {
232
+ "tags": [],
233
+ "text": "Placeholder to display if `selectedValue` is empty."
234
+ },
235
+ "attribute": "placeholder",
236
+ "reflect": false
237
+ },
238
+ "required": {
239
+ "type": "boolean",
240
+ "mutable": false,
241
+ "complexType": {
242
+ "original": "boolean",
243
+ "resolved": "boolean",
244
+ "references": {}
245
+ },
246
+ "required": false,
247
+ "optional": false,
248
+ "docs": {
249
+ "tags": [],
250
+ "text": "If `true`, the user must fill in a value before submitting a form."
251
+ },
252
+ "attribute": "required",
253
+ "reflect": false,
254
+ "defaultValue": "false"
255
+ },
256
+ "selectedValue": {
257
+ "type": "string",
258
+ "mutable": false,
259
+ "complexType": {
260
+ "original": "string",
261
+ "resolved": "string",
262
+ "references": {}
263
+ },
264
+ "required": false,
265
+ "optional": true,
266
+ "docs": {
267
+ "tags": [],
268
+ "text": "Value of the selected item."
269
+ },
270
+ "attribute": "selected-value",
271
+ "reflect": false
272
+ },
273
+ "showFormattedSelectedItem": {
274
+ "type": "boolean",
275
+ "mutable": false,
276
+ "complexType": {
277
+ "original": "boolean",
278
+ "resolved": "boolean",
279
+ "references": {}
280
+ },
281
+ "required": false,
282
+ "optional": true,
283
+ "docs": {
284
+ "tags": [],
285
+ "text": "Will show the formatted selected item (passed in the `selected-item` slot) in the select rather than the item value."
286
+ },
287
+ "attribute": "show-formatted-selected-item",
288
+ "reflect": false
289
+ },
290
+ "showOptionalLabel": {
291
+ "type": "boolean",
292
+ "mutable": false,
293
+ "complexType": {
294
+ "original": "boolean",
295
+ "resolved": "boolean",
296
+ "references": {}
297
+ },
298
+ "required": false,
299
+ "optional": false,
300
+ "docs": {
301
+ "tags": [],
302
+ "text": "If `true`, the label will display an \"optional\" tag."
303
+ },
304
+ "attribute": "show-optional-label",
305
+ "reflect": false,
306
+ "defaultValue": "false"
307
+ }
308
+ };
309
+ }
310
+ static get states() {
311
+ return {
312
+ "anchorEl": {},
313
+ "hasFocus": {},
314
+ "popoverOpen": {},
315
+ "hasSelectedItem": {}
316
+ };
317
+ }
318
+ static get events() {
319
+ return [{
320
+ "method": "cpslBlur",
321
+ "name": "cpslBlur",
322
+ "bubbles": true,
323
+ "cancelable": true,
324
+ "composed": true,
325
+ "docs": {
326
+ "tags": [],
327
+ "text": "Emitted when the input loses focus."
328
+ },
329
+ "complexType": {
330
+ "original": "FocusEvent",
331
+ "resolved": "FocusEvent",
332
+ "references": {
333
+ "FocusEvent": {
334
+ "location": "global",
335
+ "id": "global::FocusEvent"
336
+ }
337
+ }
338
+ }
339
+ }, {
340
+ "method": "cpslFocus",
341
+ "name": "cpslFocus",
342
+ "bubbles": true,
343
+ "cancelable": true,
344
+ "composed": true,
345
+ "docs": {
346
+ "tags": [],
347
+ "text": "Emitted when the input has focus."
348
+ },
349
+ "complexType": {
350
+ "original": "FocusEvent",
351
+ "resolved": "FocusEvent",
352
+ "references": {
353
+ "FocusEvent": {
354
+ "location": "global",
355
+ "id": "global::FocusEvent"
356
+ }
357
+ }
358
+ }
359
+ }, {
360
+ "method": "cpslSelectValueChange",
361
+ "name": "cpslSelectValueChange",
362
+ "bubbles": true,
363
+ "cancelable": true,
364
+ "composed": true,
365
+ "docs": {
366
+ "tags": [],
367
+ "text": "Emitted when the value changes."
368
+ },
369
+ "complexType": {
370
+ "original": "string",
371
+ "resolved": "string",
372
+ "references": {}
373
+ }
374
+ }];
375
+ }
376
+ static get elementRef() { return "el"; }
377
+ static get watchers() {
378
+ return [{
379
+ "propName": "selectedValue",
380
+ "methodName": "onValueChange"
381
+ }, {
382
+ "propName": "selectedValue",
383
+ "methodName": "handleValueChange"
384
+ }];
385
+ }
386
+ static get listeners() {
387
+ return [{
388
+ "name": "cpslSelectItemClick",
389
+ "method": "selectItemClickHandler",
390
+ "target": undefined,
391
+ "capture": false,
392
+ "passive": false
393
+ }, {
394
+ "name": "cpslOpen",
395
+ "method": "onPopoverOpen",
396
+ "target": undefined,
397
+ "capture": false,
398
+ "passive": false
399
+ }, {
400
+ "name": "cpslClose",
401
+ "method": "onPopoverClose",
402
+ "target": undefined,
403
+ "capture": false,
404
+ "passive": false
405
+ }];
406
+ }
407
+ }
408
+ let inputIds = 0;
409
+ //# sourceMappingURL=cpsl-select.js.map