@usecapsule/core-components 3.0.1 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (210) 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-02072c68.entry.js +2 -0
  8. package/dist/capsule/p-02072c68.entry.js.map +1 -0
  9. package/dist/capsule/p-1474c545.entry.js +29 -0
  10. package/dist/capsule/p-1474c545.entry.js.map +1 -0
  11. package/dist/capsule/p-2c16694d.entry.js +2 -0
  12. package/dist/capsule/p-41088cd4.entry.js +2 -0
  13. package/dist/capsule/{p-fcead80b.entry.js.map → p-41088cd4.entry.js.map} +1 -1
  14. package/dist/capsule/{p-fa078837.entry.js → p-6dcaee48.entry.js} +2 -2
  15. package/dist/capsule/p-7dde3172.js +3 -0
  16. package/dist/capsule/p-7dde3172.js.map +1 -0
  17. package/dist/capsule/{p-d28b96ba.entry.js → p-a6aaf3f4.entry.js} +2 -2
  18. package/dist/capsule/{p-0d0a0037.entry.js → p-b976b6f0.entry.js} +2 -2
  19. package/dist/capsule/p-f2393be6.js +2 -0
  20. package/dist/capsule/p-f2393be6.js.map +1 -0
  21. package/dist/cjs/capsule.cjs.js +2 -2
  22. package/dist/cjs/{constants-0869a780.js → constants-9b1b01bb.js} +3 -3
  23. package/dist/cjs/{constants-0869a780.js.map → constants-9b1b01bb.js.map} +1 -1
  24. package/dist/cjs/{cpsl-alert_29.cjs.entry.js → cpsl-alert_33.cjs.entry.js} +662 -87
  25. package/dist/cjs/cpsl-alert_33.cjs.entry.js.map +1 -0
  26. package/dist/cjs/cpsl-animation.cjs.entry.js +1 -1
  27. package/dist/cjs/cpsl-col.cjs.entry.js +1 -1
  28. package/dist/cjs/cpsl-grid.cjs.entry.js +3 -3
  29. package/dist/cjs/cpsl-info-box.cjs.entry.js +3 -3
  30. package/dist/cjs/cpsl-info-box.cjs.entry.js.map +1 -1
  31. package/dist/cjs/cpsl-modal-v2.cjs.entry.js +55 -0
  32. package/dist/cjs/cpsl-modal-v2.cjs.entry.js.map +1 -0
  33. package/dist/cjs/cpsl-row.cjs.entry.js +2 -2
  34. package/dist/cjs/{index-5733071e.js → index-528f7428.js} +86 -3
  35. package/dist/cjs/index-528f7428.js.map +1 -0
  36. package/dist/cjs/index.cjs.js +116 -107
  37. package/dist/cjs/index.cjs.js.map +1 -1
  38. package/dist/cjs/loader.cjs.js +2 -2
  39. package/dist/collection/assets/icons/chevron-up.svg +2 -2
  40. package/dist/collection/assets/icons/close.svg +3 -4
  41. package/dist/collection/assets/icons/cube.svg +3 -0
  42. package/dist/collection/assets/icons/farcaster-brand.svg +10 -0
  43. package/dist/collection/assets/icons/farcaster.svg +10 -0
  44. package/dist/collection/assets/icons/image.svg +3 -0
  45. package/dist/collection/assets/icons/index.js +9 -1
  46. package/dist/collection/assets/icons/index.js.map +1 -1
  47. package/dist/collection/assets/icons/menu.svg +3 -0
  48. package/dist/collection/assets/icons/refresh.svg +3 -0
  49. package/dist/collection/assets/icons/stars.svg +4 -0
  50. package/dist/collection/assets/icons/x.svg +3 -0
  51. package/dist/collection/collection-manifest.json +5 -0
  52. package/dist/collection/components/cpsl-alert/cpsl-alert.js +1 -1
  53. package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js +20 -4
  54. package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js.map +1 -1
  55. package/dist/collection/components/cpsl-button/cpsl-button.css +113 -17
  56. package/dist/collection/components/cpsl-button/cpsl-button.js +63 -7
  57. package/dist/collection/components/cpsl-button/cpsl-button.js.map +1 -1
  58. package/dist/collection/components/cpsl-button-group/cpsl-button-group.css +1 -0
  59. package/dist/collection/components/cpsl-card/cpsl-card.css +1 -1
  60. package/dist/collection/components/cpsl-card/cpsl-card.js +1 -1
  61. package/dist/collection/components/cpsl-card/cpsl-card.js.map +1 -1
  62. package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.css +2 -2
  63. package/dist/collection/components/cpsl-code-input/cpsl-code-input.css +1 -1
  64. package/dist/collection/components/cpsl-divider/cpsl-divider.css +1 -1
  65. package/dist/collection/components/cpsl-drawer/cpsl-drawer.js +84 -11
  66. package/dist/collection/components/cpsl-drawer/cpsl-drawer.js.map +1 -1
  67. package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +1 -1
  68. package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js.map +1 -1
  69. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.css +211 -0
  70. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js +406 -0
  71. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js.map +1 -0
  72. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js +29 -0
  73. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js.map +1 -0
  74. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js +37 -0
  75. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js.map +1 -0
  76. package/dist/collection/components/cpsl-grid/cpsl-grid.js +2 -2
  77. package/dist/collection/components/cpsl-icon/cpsl-icon.js +2 -2
  78. package/dist/collection/components/cpsl-info-box/cpsl-info-box.css +1 -1
  79. package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +1 -1
  80. package/dist/collection/components/cpsl-input/cpsl-input.css +7 -6
  81. package/dist/collection/components/cpsl-input/cpsl-input.js +3 -8
  82. package/dist/collection/components/cpsl-input/cpsl-input.js.map +1 -1
  83. package/dist/collection/components/cpsl-modal/cpsl-modal.css +4 -4
  84. package/dist/collection/components/cpsl-modal/cpsl-modal.js +1 -0
  85. package/dist/collection/components/cpsl-modal/cpsl-modal.js.map +1 -1
  86. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.css +91 -0
  87. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js +224 -0
  88. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js.map +1 -0
  89. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js +29 -0
  90. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js.map +1 -0
  91. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js +37 -0
  92. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js.map +1 -0
  93. package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.js +1 -1
  94. package/dist/collection/components/cpsl-overlay/cpsl-overlay.css +1 -1
  95. package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +1 -1
  96. package/dist/collection/components/cpsl-pagination/cpsl-pagination.css +4 -0
  97. package/dist/collection/components/cpsl-pagination/cpsl-pagination.js +1 -1
  98. package/dist/collection/components/cpsl-pagination/cpsl-pagination.js.map +1 -1
  99. package/dist/collection/components/cpsl-pill/cpsl-pill.css +1 -1
  100. package/dist/collection/components/cpsl-pill/cpsl-pill.js +1 -1
  101. package/dist/collection/components/cpsl-popover/cpsl-popover.css +98 -0
  102. package/dist/collection/components/cpsl-popover/cpsl-popover.js +511 -0
  103. package/dist/collection/components/cpsl-popover/cpsl-popover.js.map +1 -0
  104. package/dist/collection/components/cpsl-popover/test/cpsl-popover.e2e.js +29 -0
  105. package/dist/collection/components/cpsl-popover/test/cpsl-popover.e2e.js.map +1 -0
  106. package/dist/collection/components/cpsl-popover/test/cpsl-popover.spec.js +37 -0
  107. package/dist/collection/components/cpsl-popover/test/cpsl-popover.spec.js.map +1 -0
  108. package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.css +3 -3
  109. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.css +1 -1
  110. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +1 -1
  111. package/dist/collection/components/cpsl-radio/cpsl-radio.css +2 -2
  112. package/dist/collection/components/cpsl-radio/cpsl-radio.js +1 -1
  113. package/dist/collection/components/cpsl-row/cpsl-row.js +1 -1
  114. package/dist/collection/components/cpsl-select/cpsl-select.css +229 -0
  115. package/dist/collection/components/cpsl-select/cpsl-select.js +409 -0
  116. package/dist/collection/components/cpsl-select/cpsl-select.js.map +1 -0
  117. package/dist/collection/components/cpsl-select/test/cpsl-select.e2e.js +29 -0
  118. package/dist/collection/components/cpsl-select/test/cpsl-select.e2e.js.map +1 -0
  119. package/dist/collection/components/cpsl-select/test/cpsl-select.spec.js +37 -0
  120. package/dist/collection/components/cpsl-select/test/cpsl-select.spec.js.map +1 -0
  121. package/dist/collection/components/cpsl-select-item/cpsl-select-item.css +114 -0
  122. package/dist/collection/components/cpsl-select-item/cpsl-select-item.js +85 -0
  123. package/dist/collection/components/cpsl-select-item/cpsl-select-item.js.map +1 -0
  124. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.e2e.js +29 -0
  125. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.e2e.js.map +1 -0
  126. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.spec.js +37 -0
  127. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.spec.js.map +1 -0
  128. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.css +3 -3
  129. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +3 -3
  130. package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +2 -2
  131. package/dist/collection/components/cpsl-switch/cpsl-switch.css +4 -4
  132. package/dist/collection/components/cpsl-switch/cpsl-switch.js +1 -1
  133. package/dist/collection/components/cpsl-tab/cpsl-tab.js +1 -1
  134. package/dist/collection/components/cpsl-table/cpsl-table.css +40 -60
  135. package/dist/collection/components/cpsl-table/cpsl-table.js +40 -58
  136. package/dist/collection/components/cpsl-table/cpsl-table.js.map +1 -1
  137. package/dist/collection/components/cpsl-tabs/cpsl-tabs.css +2 -2
  138. package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +1 -1
  139. package/dist/collection/components/cpsl-text/cpsl-text.css +4 -0
  140. package/dist/collection/components/cpsl-text/cpsl-text.js +5 -4
  141. package/dist/collection/components/cpsl-text/cpsl-text.js.map +1 -1
  142. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.css +1 -1
  143. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +2 -2
  144. package/dist/collection/constants.js +2 -2
  145. package/dist/collection/constants.js.map +1 -1
  146. package/dist/collection/interface.js.map +1 -1
  147. package/dist/collection/utils/theme/generateBorderRadii.js +40 -39
  148. package/dist/collection/utils/theme/generateBorderRadii.js.map +1 -1
  149. package/dist/collection/utils/theme/generatePalette.js +11 -3
  150. package/dist/collection/utils/theme/generatePalette.js.map +1 -1
  151. package/dist/collection/utils/theme/generateTheme.js +2 -2
  152. package/dist/collection/utils/theme/generateTheme.js.map +1 -1
  153. package/dist/collection/utils/theme/utils.js +1 -0
  154. package/dist/collection/utils/theme/utils.js.map +1 -1
  155. package/dist/esm/capsule.js +3 -3
  156. package/dist/esm/{constants-6acf4ea8.js → constants-fce138fa.js} +3 -3
  157. package/dist/esm/{constants-6acf4ea8.js.map → constants-fce138fa.js.map} +1 -1
  158. package/dist/esm/{cpsl-alert_29.entry.js → cpsl-alert_33.entry.js} +659 -88
  159. package/dist/esm/cpsl-alert_33.entry.js.map +1 -0
  160. package/dist/esm/cpsl-animation.entry.js +1 -1
  161. package/dist/esm/cpsl-col.entry.js +1 -1
  162. package/dist/esm/cpsl-grid.entry.js +3 -3
  163. package/dist/esm/cpsl-info-box.entry.js +3 -3
  164. package/dist/esm/cpsl-info-box.entry.js.map +1 -1
  165. package/dist/esm/cpsl-modal-v2.entry.js +51 -0
  166. package/dist/esm/cpsl-modal-v2.entry.js.map +1 -0
  167. package/dist/esm/cpsl-row.entry.js +2 -2
  168. package/dist/esm/{index-8fe9f35e.js → index-b188f201.js} +86 -4
  169. package/dist/esm/index-b188f201.js.map +1 -0
  170. package/dist/esm/index.js +116 -107
  171. package/dist/esm/index.js.map +1 -1
  172. package/dist/esm/loader.js +3 -3
  173. package/dist/types/assets/icons/index.d.ts +8 -0
  174. package/dist/types/components/cpsl-app-bar/cpsl-app-bar.d.ts +1 -0
  175. package/dist/types/components/cpsl-button/cpsl-button.d.ts +4 -1
  176. package/dist/types/components/cpsl-drawer/cpsl-drawer.d.ts +10 -1
  177. package/dist/types/components/cpsl-file-upload/cpsl-file-upload.d.ts +34 -0
  178. package/dist/types/components/cpsl-input/cpsl-input.d.ts +1 -1
  179. package/dist/types/components/cpsl-modal-v2/cpsl-modal-v2.d.ts +17 -0
  180. package/dist/types/components/cpsl-popover/cpsl-popover.d.ts +35 -0
  181. package/dist/types/components/cpsl-select/cpsl-select.d.ts +38 -0
  182. package/dist/types/components/cpsl-select-item/cpsl-select-item.d.ts +8 -0
  183. package/dist/types/components/cpsl-table/cpsl-table.d.ts +8 -3
  184. package/dist/types/components/cpsl-text/cpsl-text.d.ts +1 -1
  185. package/dist/types/components.d.ts +596 -28
  186. package/dist/types/constants.d.ts +2 -2
  187. package/dist/types/interface.d.ts +68 -1
  188. package/dist/types/utils/theme/generateBorderRadii.d.ts +1 -1
  189. package/dist/types/utils/theme/generateTheme.d.ts +1 -1
  190. package/dist/types/utils/theme/utils.d.ts +4 -1
  191. package/package.json +2 -2
  192. package/dist/capsule/p-107e1ff5.entry.js +0 -29
  193. package/dist/capsule/p-107e1ff5.entry.js.map +0 -1
  194. package/dist/capsule/p-86e48e61.js +0 -3
  195. package/dist/capsule/p-86e48e61.js.map +0 -1
  196. package/dist/capsule/p-ad14a817.entry.js +0 -2
  197. package/dist/capsule/p-b6b38e73.js +0 -2
  198. package/dist/capsule/p-b6b38e73.js.map +0 -1
  199. package/dist/capsule/p-fcead80b.entry.js +0 -2
  200. package/dist/cjs/cpsl-alert_29.cjs.entry.js.map +0 -1
  201. package/dist/cjs/index-5733071e.js.map +0 -1
  202. package/dist/collection/components/cpsl-table/table-interface.js +0 -2
  203. package/dist/collection/components/cpsl-table/table-interface.js.map +0 -1
  204. package/dist/esm/cpsl-alert_29.entry.js.map +0 -1
  205. package/dist/esm/index-8fe9f35e.js.map +0 -1
  206. package/dist/types/components/cpsl-table/table-interface.d.ts +0 -19
  207. /package/dist/capsule/{p-ad14a817.entry.js.map → p-2c16694d.entry.js.map} +0 -0
  208. /package/dist/capsule/{p-fa078837.entry.js.map → p-6dcaee48.entry.js.map} +0 -0
  209. /package/dist/capsule/{p-d28b96ba.entry.js.map → p-a6aaf3f4.entry.js.map} +0 -0
  210. /package/dist/capsule/{p-0d0a0037.entry.js.map → p-b976b6f0.entry.js.map} +0 -0
@@ -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: '15b4fdf30799927941280b3f11f4611e4e4d27b2' }, h("input", { key: 'd5bf9704061977610d98b99a6188933f720ffce3', type: "radio", checked: this.checked }), h("span", { key: 'd56242703448531efc847167b55013b420f17715', 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: '7f72521f5a00092d54fb143c73334dfdc8d5daf7' }, h("slot", { key: 'a23bda8f3a3178b61e409f73e6004586f8b26509' })));
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: '96b15a986afbf40228adfb0ddfb5934ea79a9df0', id: this.id, class: { 'disabled': this.disabled, 'focused': this.hasFocus, 'has-value': Boolean(this.selectedValue) } }, this.label && (h("label", { class: "label", htmlFor: this.inputId }, this.label, this.required ? '*' : ' ', !this.required && this.showOptionalLabel ? h("span", { class: "optional-label" }, "(optional)") : '')), h("div", { key: 'b43bb6ef5670aff411a82391c5695f8840412f85', id: "select-container", class: { 'select-container': true, 'error-container': Boolean(this.errorText) }, onMouseDown: this.handleClick }, this.hasSelectedItem && this.showFormattedSelectedItem && h("slot", { name: "selected-item" }), h("div", { key: 'fa5654cfbeb30c963fd918599c4fc304e9d894c5', class: "selected-container-content", id: "selected-container-content" }, (!this.hasSelectedItem || !this.showFormattedSelectedItem) && (h("cpsl-text", { 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: '063de47032a31e2c7d114467cc4eaedfcf8d59a8', class: { 'chevron': true, 'open': this.popoverOpen, 'has-value': Boolean(this.selectedValue) }, icon: "chevronUp" }), h("input", { key: '760922353c0971b766d80ac45430ebc806833a9a', 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", { class: { 'helper-text-container': true, 'error-text': Boolean(this.errorText) } }, h("span", null, (_d = this.errorText) !== null && _d !== void 0 ? _d : this.helperText))), h("cpsl-popover", { key: 'fcbf94fcc199d5415dc62faa3b7a0280f16418fa', autoWidth: false, trigger: this.id, preventBlur: this.hasFocus, disabled: this.disabled, anchorEl: this.anchorEl }, h("div", { key: '95aa9ce659bf279c502b0f8b6e068765a1f29d5d', class: "dropdown" }, h("div", { key: '4b83c05b33d370d9ce8fa7450b11b24c75ddb025', class: "dropdown-inner", style: { maxHeight: `${this.dropdownMaxHeight}px` } }, h("slot", { key: 'a94a087322953b56c4b9e488b5e23ab6f020d37f', 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