@usecapsule/core-components 3.0.0 → 3.0.1-dev.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. package/css/capsule-core.css +84 -15
  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-0d0a0037.entry.js → p-70f95c93.entry.js} +2 -2
  16. package/dist/capsule/{p-0d0a0037.entry.js.map → p-70f95c93.entry.js.map} +1 -1
  17. package/dist/capsule/p-86e6cba5.entry.js +10 -0
  18. package/dist/capsule/{p-d28b96ba.entry.js.map → p-86e6cba5.entry.js.map} +1 -1
  19. package/dist/capsule/p-dd596431.entry.js +29 -0
  20. package/dist/capsule/p-dd596431.entry.js.map +1 -0
  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} +645 -95
  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 +16 -4
  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/brush.svg +3 -0
  45. package/dist/collection/assets/icons/chevron-up.svg +2 -2
  46. package/dist/collection/assets/icons/close.svg +3 -4
  47. package/dist/collection/assets/icons/cube.svg +3 -0
  48. package/dist/collection/assets/icons/file.svg +3 -0
  49. package/dist/collection/assets/icons/image.svg +3 -0
  50. package/dist/collection/assets/icons/index.js +10 -1
  51. package/dist/collection/assets/icons/index.js.map +1 -1
  52. package/dist/collection/assets/icons/lightning-01.svg +3 -0
  53. package/dist/collection/assets/icons/lightning.svg +2 -2
  54. package/dist/collection/assets/icons/menu.svg +3 -0
  55. package/dist/collection/assets/icons/refresh.svg +3 -0
  56. package/dist/collection/assets/icons/stars.svg +4 -0
  57. package/dist/collection/assets/icons/x.svg +3 -0
  58. package/dist/collection/collection-manifest.json +7 -2
  59. package/dist/collection/components/cpsl-alert/cpsl-alert.js +2 -2
  60. package/dist/collection/components/cpsl-alert/cpsl-alert.js.map +1 -1
  61. package/dist/collection/components/cpsl-animation/cpsl-animation.js +1 -1
  62. package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js +20 -4
  63. package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js.map +1 -1
  64. package/dist/collection/components/cpsl-avatar/cpsl-avatar.js +1 -1
  65. package/dist/collection/components/cpsl-button/cpsl-button.css +113 -17
  66. package/dist/collection/components/cpsl-button/cpsl-button.js +63 -7
  67. package/dist/collection/components/cpsl-button/cpsl-button.js.map +1 -1
  68. package/dist/collection/components/cpsl-button-group/cpsl-button-group.css +1 -0
  69. package/dist/collection/components/cpsl-button-group/cpsl-button-group.js +1 -1
  70. package/dist/collection/components/cpsl-card/cpsl-card.css +1 -1
  71. package/dist/collection/components/cpsl-card/cpsl-card.js +1 -1
  72. package/dist/collection/components/cpsl-card/cpsl-card.js.map +1 -1
  73. package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.css +2 -2
  74. package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.js +1 -1
  75. package/dist/collection/components/cpsl-code-input/cpsl-code-input.css +1 -1
  76. package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +2 -2
  77. package/dist/collection/components/cpsl-code-input/cpsl-code-input.js.map +1 -1
  78. package/dist/collection/components/cpsl-col/cpsl-col.js +1 -1
  79. package/dist/collection/components/cpsl-divider/cpsl-divider.css +1 -1
  80. package/dist/collection/components/cpsl-divider/cpsl-divider.js +1 -1
  81. package/dist/collection/components/cpsl-drawer/cpsl-drawer.js +84 -11
  82. package/dist/collection/components/cpsl-drawer/cpsl-drawer.js.map +1 -1
  83. package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +1 -1
  84. package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js.map +1 -1
  85. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.css +210 -0
  86. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js +406 -0
  87. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js.map +1 -0
  88. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js +29 -0
  89. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js.map +1 -0
  90. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js +37 -0
  91. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js.map +1 -0
  92. package/dist/collection/components/cpsl-grid/cpsl-grid.js +2 -2
  93. package/dist/collection/components/cpsl-icon/cpsl-icon.js +2 -2
  94. package/dist/collection/components/cpsl-info-box/cpsl-info-box.css +1 -1
  95. package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +1 -1
  96. package/dist/collection/components/cpsl-input/cpsl-input.css +7 -6
  97. package/dist/collection/components/cpsl-input/cpsl-input.js +3 -8
  98. package/dist/collection/components/cpsl-input/cpsl-input.js.map +1 -1
  99. package/dist/collection/components/cpsl-modal/cpsl-modal.css +4 -4
  100. package/dist/collection/components/cpsl-modal/cpsl-modal.js +1 -0
  101. package/dist/collection/components/cpsl-modal/cpsl-modal.js.map +1 -1
  102. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.css +91 -0
  103. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js +224 -0
  104. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js.map +1 -0
  105. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js +29 -0
  106. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js.map +1 -0
  107. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js +37 -0
  108. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js.map +1 -0
  109. package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.js +1 -1
  110. package/dist/collection/components/cpsl-overlay/cpsl-overlay.css +1 -1
  111. package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +1 -1
  112. package/dist/collection/components/cpsl-pagination/cpsl-pagination.js +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 +427 -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 +25 -64
  149. package/dist/collection/components/cpsl-table/cpsl-table.js +1 -63
  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/index.js.map +1 -1
  161. package/dist/collection/interface.js.map +1 -1
  162. package/dist/collection/utils/theme/generateBorderRadii.js +4 -0
  163. package/dist/collection/utils/theme/generateBorderRadii.js.map +1 -1
  164. package/dist/collection/utils/theme/generatePalette.js +11 -3
  165. package/dist/collection/utils/theme/generatePalette.js.map +1 -1
  166. package/dist/esm/capsule.js +11 -11
  167. package/dist/esm/capsule.js.map +1 -1
  168. package/dist/esm/{constants-6acf4ea8.js → constants-fce138fa.js} +3 -3
  169. package/dist/esm/{constants-6acf4ea8.js.map → constants-fce138fa.js.map} +1 -1
  170. package/dist/esm/{cpsl-alert_29.entry.js → cpsl-alert_33.entry.js} +642 -96
  171. package/dist/esm/cpsl-alert_33.entry.js.map +1 -0
  172. package/dist/esm/cpsl-animation.entry.js +2 -2
  173. package/dist/esm/cpsl-col.entry.js +2 -2
  174. package/dist/esm/cpsl-grid.entry.js +3 -3
  175. package/dist/esm/cpsl-info-box.entry.js +3 -3
  176. package/dist/esm/cpsl-info-box.entry.js.map +1 -1
  177. package/dist/esm/cpsl-modal-v2.entry.js +51 -0
  178. package/dist/esm/cpsl-modal-v2.entry.js.map +1 -0
  179. package/dist/esm/cpsl-row.entry.js +2 -2
  180. package/dist/esm/index-b9a060b3.js +1383 -0
  181. package/dist/esm/index-b9a060b3.js.map +1 -0
  182. package/dist/esm/index.js +16 -4
  183. package/dist/esm/index.js.map +1 -1
  184. package/dist/esm/loader.js +3 -3
  185. package/dist/loader/cdn.js +1 -3
  186. package/dist/loader/index.cjs.js +1 -3
  187. package/dist/loader/index.es2017.js +1 -3
  188. package/dist/loader/index.js +1 -3
  189. package/dist/types/assets/icons/index.d.ts +9 -0
  190. package/dist/types/components/cpsl-app-bar/cpsl-app-bar.d.ts +1 -0
  191. package/dist/types/components/cpsl-button/cpsl-button.d.ts +4 -1
  192. package/dist/types/components/cpsl-drawer/cpsl-drawer.d.ts +10 -1
  193. package/dist/types/components/cpsl-file-upload/cpsl-file-upload.d.ts +34 -0
  194. package/dist/types/components/cpsl-input/cpsl-input.d.ts +1 -1
  195. package/dist/types/components/cpsl-modal-v2/cpsl-modal-v2.d.ts +17 -0
  196. package/dist/types/components/cpsl-popover/cpsl-popover.d.ts +35 -0
  197. package/dist/types/components/cpsl-select/cpsl-select.d.ts +41 -0
  198. package/dist/types/components/cpsl-select-item/cpsl-select-item.d.ts +8 -0
  199. package/dist/types/components/cpsl-table/cpsl-table.d.ts +0 -3
  200. package/dist/types/components/cpsl-text/cpsl-text.d.ts +1 -1
  201. package/dist/types/components.d.ts +596 -28
  202. package/dist/types/constants.d.ts +2 -2
  203. package/dist/types/index.d.ts +1 -1
  204. package/dist/types/interface.d.ts +44 -0
  205. package/dist/types/stencil-public-runtime.d.ts +3 -8
  206. package/package.json +2 -3
  207. package/dist/capsule/p-4d8e4d86.entry.js +0 -29
  208. package/dist/capsule/p-4d8e4d86.entry.js.map +0 -1
  209. package/dist/capsule/p-86e48e61.js +0 -3
  210. package/dist/capsule/p-86e48e61.js.map +0 -1
  211. package/dist/capsule/p-ad14a817.entry.js +0 -2
  212. package/dist/capsule/p-b6b38e73.js +0 -2
  213. package/dist/capsule/p-b6b38e73.js.map +0 -1
  214. package/dist/capsule/p-d28b96ba.entry.js +0 -10
  215. package/dist/capsule/p-fcead80b.entry.js +0 -2
  216. package/dist/cjs/cpsl-alert_29.cjs.entry.js.map +0 -1
  217. package/dist/cjs/index-5733071e.js +0 -2020
  218. package/dist/cjs/index-5733071e.js.map +0 -1
  219. package/dist/collection/components/cpsl-table/table-interface.js +0 -2
  220. package/dist/collection/components/cpsl-table/table-interface.js.map +0 -1
  221. package/dist/esm/cpsl-alert_29.entry.js.map +0 -1
  222. package/dist/esm/index-8fe9f35e.js +0 -1990
  223. package/dist/esm/index-8fe9f35e.js.map +0 -1
  224. package/dist/esm/polyfills/core-js.js +0 -11
  225. package/dist/esm/polyfills/dom.js +0 -79
  226. package/dist/esm/polyfills/es5-html-element.js +0 -1
  227. package/dist/esm/polyfills/index.js +0 -34
  228. package/dist/esm/polyfills/system.js +0 -6
  229. 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,427 @@
1
+ import { Host, h } from "@stencil/core";
2
+ export class CpslSelect {
3
+ constructor() {
4
+ this.inputId = `cpsl-select-${inputIds++}`;
5
+ this.resetStyles = () => {
6
+ document.documentElement.style.removeProperty('overflow');
7
+ document.body.style.removeProperty('padding-right');
8
+ };
9
+ this.measureScrollbarWidth = () => {
10
+ const scrollbox = document.createElement('div');
11
+ scrollbox.style.overflow = 'scroll';
12
+ document.body.appendChild(scrollbox);
13
+ const scrollBarWidth = scrollbox.offsetWidth - scrollbox.clientWidth;
14
+ document.body.removeChild(scrollbox);
15
+ return scrollBarWidth;
16
+ };
17
+ this.onBlur = (ev) => {
18
+ this.hasFocus = false;
19
+ this.popoverEl.closePopover();
20
+ this.cpslBlur.emit(ev);
21
+ };
22
+ this.onFocus = (ev) => {
23
+ this.hasFocus = true;
24
+ this.cpslFocus.emit(ev);
25
+ };
26
+ this.handleEnterPress = (ev) => {
27
+ if (ev.key === 'Enter') {
28
+ ev.preventDefault();
29
+ this.el.dispatchEvent(new MouseEvent('mousedown'));
30
+ }
31
+ };
32
+ this.selectItem = () => {
33
+ const items = Array.from(this.el.querySelectorAll('cpsl-select-item'));
34
+ items.forEach(item => {
35
+ if (item.value === this.selectedValue) {
36
+ item.setAttribute('selected', 'true');
37
+ this.hasSelectedItem = true;
38
+ }
39
+ else {
40
+ item.setAttribute('selected', 'false');
41
+ }
42
+ });
43
+ if (!Boolean(this.selectedValue)) {
44
+ this.hasSelectedItem = false;
45
+ }
46
+ };
47
+ this.handleClickOutside = (event) => {
48
+ if (this.hasFocus && !this.el.contains(event.target)) {
49
+ this.hasFocus = false;
50
+ window.removeEventListener('click', this.handleClickOutside);
51
+ }
52
+ };
53
+ this.handleClick = () => {
54
+ if (!this.disabled) {
55
+ this.hasFocus = true;
56
+ window.addEventListener('click', this.handleClickOutside);
57
+ }
58
+ };
59
+ this.anchorEl = undefined;
60
+ this.hasFocus = false;
61
+ this.popoverOpen = false;
62
+ this.hasSelectedItem = false;
63
+ this.disabled = false;
64
+ this.dropdownMaxHeight = undefined;
65
+ this.errorText = undefined;
66
+ this.formatValue = undefined;
67
+ this.helperText = undefined;
68
+ this.id = `${this.inputId}-trigger`;
69
+ this.label = undefined;
70
+ this.placeholder = undefined;
71
+ this.required = false;
72
+ this.selectedValue = undefined;
73
+ this.showFormattedSelectedItem = undefined;
74
+ this.showOptionalLabel = false;
75
+ }
76
+ onValueChange() {
77
+ this.popoverEl.closePopover();
78
+ }
79
+ handleValueChange() {
80
+ this.selectItem();
81
+ }
82
+ selectItemClickHandler(event) {
83
+ this.cpslSelectValueChange.emit(event.detail);
84
+ }
85
+ onPopoverOpen() {
86
+ this.popoverOpen = true;
87
+ document.documentElement.style.overflow = 'hidden';
88
+ document.body.style.paddingRight = `${this.measureScrollbarWidth()}px`;
89
+ }
90
+ onPopoverClose() {
91
+ this.popoverOpen = false;
92
+ this.resetStyles();
93
+ }
94
+ componentDidLoad() {
95
+ this.popoverEl = this.el.shadowRoot.querySelector(`cpsl-popover`);
96
+ this.anchorEl = this.el.shadowRoot.getElementById('select-container');
97
+ this.selectItem();
98
+ }
99
+ disconnectedCallback() {
100
+ this.resetStyles();
101
+ }
102
+ render() {
103
+ var _a, _b, _c, _d;
104
+ return (h(Host, { key: 'f003552571504c992dff03463d3352c572bad02d', id: this.id, class: { 'disabled': this.disabled, 'focused': this.hasFocus, 'has-value': Boolean(this.selectedValue) } }, this.label && (h("label", { key: '81f80a9308efd7381b72d79762f2e80b1efff675', class: "label", htmlFor: this.inputId }, this.label, this.required ? '*' : ' ', !this.required && this.showOptionalLabel ? h("span", { class: "optional-label" }, "(optional)") : '')), h("div", { key: '87bce962cd77da2ed32a33a52e0823f9762e7e7a', id: "select-container", class: { 'select-container': true, 'error-container': Boolean(this.errorText) }, onMouseDown: this.handleClick }, this.hasSelectedItem && this.showFormattedSelectedItem && h("slot", { key: '5af6624ddb7dc97b00a6e15491cf74ed09afe032', name: "selected-item" }), h("div", { key: '2aac4d90d8abe8a23a0e8e94705b13744806886a', class: "selected-container-content", id: "selected-container-content" }, (!this.hasSelectedItem || !this.showFormattedSelectedItem) && (h("cpsl-text", { key: '562d171bfca20d3520422ad6e8e216ea05cd68ed', 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: 'e492e0e95497bcd0c64ad6df39147b8b525fdd7c', class: { 'chevron': true, 'open': this.popoverOpen, 'has-value': Boolean(this.selectedValue) }, icon: "chevronUp" }), h("input", { key: '174e62e95af2a23aea6daf8081b690069b8143d6', 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: '22c98327b650ad5e355b65cf2a07170c691751d8', class: { 'helper-text-container': true, 'error-text': Boolean(this.errorText) } }, h("span", { key: '2212ea94c12e6612a3185e14f853ea543df7581a' }, (_d = this.errorText) !== null && _d !== void 0 ? _d : this.helperText))), h("cpsl-popover", { key: 'a7b871c9da87ae9212dec7c0b8bd97ff3be4bafd', autoWidth: false, trigger: this.id, preventBlur: this.hasFocus, disabled: this.disabled, anchorEl: this.anchorEl }, h("div", { key: '180fd8ef77b9bf1f6dcd2b59d5103f832a9f3cc3', class: "dropdown" }, h("div", { key: '55dce031838f22b5969912733ae15a60c7af0f49', class: "dropdown-inner", style: { maxHeight: `${this.dropdownMaxHeight}px` } }, h("slot", { key: '127909f8c47c6b6c2dcd21140c7f98c33b24ea1e', name: "items" }))))));
105
+ }
106
+ static get is() { return "cpsl-select"; }
107
+ static get encapsulation() { return "shadow"; }
108
+ static get originalStyleUrls() {
109
+ return {
110
+ "$": ["cpsl-select.scss"]
111
+ };
112
+ }
113
+ static get styleUrls() {
114
+ return {
115
+ "$": ["cpsl-select.css"]
116
+ };
117
+ }
118
+ static get properties() {
119
+ return {
120
+ "disabled": {
121
+ "type": "boolean",
122
+ "mutable": false,
123
+ "complexType": {
124
+ "original": "boolean",
125
+ "resolved": "boolean",
126
+ "references": {}
127
+ },
128
+ "required": false,
129
+ "optional": false,
130
+ "docs": {
131
+ "tags": [],
132
+ "text": "If `true`, the user cannot interact with the input."
133
+ },
134
+ "attribute": "disabled",
135
+ "reflect": false,
136
+ "defaultValue": "false"
137
+ },
138
+ "dropdownMaxHeight": {
139
+ "type": "number",
140
+ "mutable": false,
141
+ "complexType": {
142
+ "original": "number",
143
+ "resolved": "number",
144
+ "references": {}
145
+ },
146
+ "required": false,
147
+ "optional": true,
148
+ "docs": {
149
+ "tags": [],
150
+ "text": "Set the max height of the dropdown."
151
+ },
152
+ "attribute": "dropdown-max-height",
153
+ "reflect": false
154
+ },
155
+ "errorText": {
156
+ "type": "string",
157
+ "mutable": false,
158
+ "complexType": {
159
+ "original": "string",
160
+ "resolved": "string",
161
+ "references": {}
162
+ },
163
+ "required": false,
164
+ "optional": true,
165
+ "docs": {
166
+ "tags": [],
167
+ "text": "Error text to show below the input. If this is provided the input will enter an error state."
168
+ },
169
+ "attribute": "error-text",
170
+ "reflect": false
171
+ },
172
+ "formatValue": {
173
+ "type": "unknown",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "(value: string) => string",
177
+ "resolved": "(value: string) => string",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": true,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "Format value for display when selected."
185
+ }
186
+ },
187
+ "helperText": {
188
+ "type": "string",
189
+ "mutable": false,
190
+ "complexType": {
191
+ "original": "string",
192
+ "resolved": "string",
193
+ "references": {}
194
+ },
195
+ "required": false,
196
+ "optional": true,
197
+ "docs": {
198
+ "tags": [],
199
+ "text": "Helper text to show below the input. If `\"errorText\"` is provided that will take precedence."
200
+ },
201
+ "attribute": "helper-text",
202
+ "reflect": false
203
+ },
204
+ "id": {
205
+ "type": "string",
206
+ "mutable": false,
207
+ "complexType": {
208
+ "original": "string",
209
+ "resolved": "string",
210
+ "references": {}
211
+ },
212
+ "required": false,
213
+ "optional": false,
214
+ "docs": {
215
+ "tags": [],
216
+ "text": "ID of the element, must be unique for the popover trigger."
217
+ },
218
+ "attribute": "id",
219
+ "reflect": false,
220
+ "defaultValue": "`${this.inputId}-trigger`"
221
+ },
222
+ "label": {
223
+ "type": "string",
224
+ "mutable": false,
225
+ "complexType": {
226
+ "original": "string",
227
+ "resolved": "string",
228
+ "references": {}
229
+ },
230
+ "required": false,
231
+ "optional": true,
232
+ "docs": {
233
+ "tags": [],
234
+ "text": "The label for the input."
235
+ },
236
+ "attribute": "label",
237
+ "reflect": false
238
+ },
239
+ "placeholder": {
240
+ "type": "string",
241
+ "mutable": false,
242
+ "complexType": {
243
+ "original": "string",
244
+ "resolved": "string",
245
+ "references": {}
246
+ },
247
+ "required": false,
248
+ "optional": true,
249
+ "docs": {
250
+ "tags": [],
251
+ "text": "Placeholder to display if `selectedValue` is empty."
252
+ },
253
+ "attribute": "placeholder",
254
+ "reflect": false
255
+ },
256
+ "required": {
257
+ "type": "boolean",
258
+ "mutable": false,
259
+ "complexType": {
260
+ "original": "boolean",
261
+ "resolved": "boolean",
262
+ "references": {}
263
+ },
264
+ "required": false,
265
+ "optional": false,
266
+ "docs": {
267
+ "tags": [],
268
+ "text": "If `true`, the user must fill in a value before submitting a form."
269
+ },
270
+ "attribute": "required",
271
+ "reflect": false,
272
+ "defaultValue": "false"
273
+ },
274
+ "selectedValue": {
275
+ "type": "string",
276
+ "mutable": false,
277
+ "complexType": {
278
+ "original": "string",
279
+ "resolved": "string",
280
+ "references": {}
281
+ },
282
+ "required": false,
283
+ "optional": true,
284
+ "docs": {
285
+ "tags": [],
286
+ "text": "Value of the selected item."
287
+ },
288
+ "attribute": "selected-value",
289
+ "reflect": false
290
+ },
291
+ "showFormattedSelectedItem": {
292
+ "type": "boolean",
293
+ "mutable": false,
294
+ "complexType": {
295
+ "original": "boolean",
296
+ "resolved": "boolean",
297
+ "references": {}
298
+ },
299
+ "required": false,
300
+ "optional": true,
301
+ "docs": {
302
+ "tags": [],
303
+ "text": "Will show the formatted selected item (passed in the `selected-item` slot) in the select rather than the item value."
304
+ },
305
+ "attribute": "show-formatted-selected-item",
306
+ "reflect": false
307
+ },
308
+ "showOptionalLabel": {
309
+ "type": "boolean",
310
+ "mutable": false,
311
+ "complexType": {
312
+ "original": "boolean",
313
+ "resolved": "boolean",
314
+ "references": {}
315
+ },
316
+ "required": false,
317
+ "optional": false,
318
+ "docs": {
319
+ "tags": [],
320
+ "text": "If `true`, the label will display an \"optional\" tag."
321
+ },
322
+ "attribute": "show-optional-label",
323
+ "reflect": false,
324
+ "defaultValue": "false"
325
+ }
326
+ };
327
+ }
328
+ static get states() {
329
+ return {
330
+ "anchorEl": {},
331
+ "hasFocus": {},
332
+ "popoverOpen": {},
333
+ "hasSelectedItem": {}
334
+ };
335
+ }
336
+ static get events() {
337
+ return [{
338
+ "method": "cpslBlur",
339
+ "name": "cpslBlur",
340
+ "bubbles": true,
341
+ "cancelable": true,
342
+ "composed": true,
343
+ "docs": {
344
+ "tags": [],
345
+ "text": "Emitted when the input loses focus."
346
+ },
347
+ "complexType": {
348
+ "original": "FocusEvent",
349
+ "resolved": "FocusEvent",
350
+ "references": {
351
+ "FocusEvent": {
352
+ "location": "global",
353
+ "id": "global::FocusEvent"
354
+ }
355
+ }
356
+ }
357
+ }, {
358
+ "method": "cpslFocus",
359
+ "name": "cpslFocus",
360
+ "bubbles": true,
361
+ "cancelable": true,
362
+ "composed": true,
363
+ "docs": {
364
+ "tags": [],
365
+ "text": "Emitted when the input has focus."
366
+ },
367
+ "complexType": {
368
+ "original": "FocusEvent",
369
+ "resolved": "FocusEvent",
370
+ "references": {
371
+ "FocusEvent": {
372
+ "location": "global",
373
+ "id": "global::FocusEvent"
374
+ }
375
+ }
376
+ }
377
+ }, {
378
+ "method": "cpslSelectValueChange",
379
+ "name": "cpslSelectValueChange",
380
+ "bubbles": true,
381
+ "cancelable": true,
382
+ "composed": true,
383
+ "docs": {
384
+ "tags": [],
385
+ "text": "Emitted when the value changes."
386
+ },
387
+ "complexType": {
388
+ "original": "string",
389
+ "resolved": "string",
390
+ "references": {}
391
+ }
392
+ }];
393
+ }
394
+ static get elementRef() { return "el"; }
395
+ static get watchers() {
396
+ return [{
397
+ "propName": "selectedValue",
398
+ "methodName": "onValueChange"
399
+ }, {
400
+ "propName": "selectedValue",
401
+ "methodName": "handleValueChange"
402
+ }];
403
+ }
404
+ static get listeners() {
405
+ return [{
406
+ "name": "cpslSelectItemClick",
407
+ "method": "selectItemClickHandler",
408
+ "target": undefined,
409
+ "capture": false,
410
+ "passive": false
411
+ }, {
412
+ "name": "cpslOpen",
413
+ "method": "onPopoverOpen",
414
+ "target": undefined,
415
+ "capture": false,
416
+ "passive": false
417
+ }, {
418
+ "name": "cpslClose",
419
+ "method": "onPopoverClose",
420
+ "target": undefined,
421
+ "capture": false,
422
+ "passive": false
423
+ }];
424
+ }
425
+ }
426
+ let inputIds = 0;
427
+ //# sourceMappingURL=cpsl-select.js.map