@postnord/pn-marketweb-components 1.0.50 → 2.0.2-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/cjs/{index-5d2abef7.js → index-28bbc937.js} +1 -1
  2. package/cjs/{index-b6e46a26.js → index-e3e27c79.js} +3 -0
  3. package/cjs/loader.cjs.js +2 -2
  4. package/cjs/pn-bonus-progressbar-level.cjs.entry.js +1 -1
  5. package/cjs/pn-bonus-progressbar.cjs.entry.js +1 -1
  6. package/cjs/pn-choice-button.cjs.entry.js +1 -1
  7. package/cjs/pn-filter-checkbox.cjs.entry.js +1 -1
  8. package/cjs/pn-find-price-result.cjs.entry.js +5 -5
  9. package/cjs/{pn-find-price-store-d1977b2e.js → pn-find-price-store-6aab7fd0.js} +1 -2
  10. package/cjs/pn-find-price.cjs.entry.js +9 -12
  11. package/cjs/pn-find-service-and-price-result.cjs.entry.js +3 -3
  12. package/cjs/{pn-find-service-and-price-store-2d7dd8e3.js → pn-find-service-and-price-store-16a7936c.js} +1 -1
  13. package/cjs/pn-find-service-and-price.cjs.entry.js +3 -3
  14. package/cjs/pn-language-selector_9.cjs.entry.js +3 -3
  15. package/cjs/pn-mainnav-link.cjs.entry.js +3 -3
  16. package/cjs/{pn-mainnav-store-bbe3a1cf.js → pn-mainnav-store-61a75ea0.js} +1 -1
  17. package/cjs/pn-market-web-components.cjs.js +2 -2
  18. package/cjs/pn-marketweb-input.cjs.entry.js +76 -0
  19. package/cjs/pn-marketweb-search.cjs.entry.js +103 -0
  20. package/cjs/pn-marketweb-sitefooter.cjs.entry.js +1 -1
  21. package/cjs/pn-marketweb-siteheader.cjs.entry.js +1 -1
  22. package/cjs/pn-pex-pricefinder.cjs.entry.js +11 -3
  23. package/cjs/pn-product-card_3.cjs.entry.js +9 -9
  24. package/cjs/pn-product-pricelist-result.cjs.entry.js +3 -3
  25. package/cjs/{pn-product-pricelist-store-c88813f7.js → pn-product-pricelist-store-86310b5a.js} +1 -1
  26. package/cjs/pn-product-pricelist.cjs.entry.js +4 -4
  27. package/cjs/pn-product-tile_3.cjs.entry.js +1 -1
  28. package/cjs/pn-profile-selector-option.cjs.entry.js +1 -1
  29. package/cjs/pn-profile-selector.cjs.entry.js +1 -1
  30. package/cjs/pn-sidenav-level.cjs.entry.js +3 -3
  31. package/cjs/pn-sidenav-link.cjs.entry.js +3 -3
  32. package/cjs/{pn-sidenav-store-a753d3d7.js → pn-sidenav-store-d9bd9e00.js} +1 -1
  33. package/cjs/pn-sidenav.cjs.entry.js +3 -3
  34. package/cjs/pn-site-footer_2.cjs.entry.js +1 -1
  35. package/collection/collection-manifest.json +2 -1
  36. package/collection/components/input/pn-marketweb-input/marketweb-input.stories.js +51 -0
  37. package/collection/components/input/pn-marketweb-input/pn-marketweb-input.css +156 -0
  38. package/collection/components/input/pn-marketweb-input/pn-marketweb-input.js +412 -0
  39. package/collection/components/input/{pn-filter-search/search-field.stories.js → pn-marketweb-search/marketweb-search-field.stories.js} +15 -3
  40. package/collection/components/input/{pn-filter-search/pn-filter-search.css → pn-marketweb-search/pn-marketweb-search.css} +22 -17
  41. package/collection/components/input/{pn-filter-search/pn-filter-search.js → pn-marketweb-search/pn-marketweb-search.js} +67 -9
  42. package/collection/components/widgets/pn-find-price/img/clouds.svg +5 -0
  43. package/collection/components/widgets/pn-find-price/pn-find-price-result.js +2 -2
  44. package/collection/components/widgets/pn-find-price/pn-find-price-store.js +0 -1
  45. package/collection/components/widgets/pn-find-price/pn-find-price-translations.js +1 -6
  46. package/collection/components/widgets/pn-find-price/pn-find-price.css +17 -4
  47. package/collection/components/widgets/pn-find-price/pn-find-price.js +4 -3
  48. package/collection/components/widgets/pn-pex-pricefinder/pn-pex-pricefinder.js +10 -2
  49. package/collection/components/widgets/pn-product-card/pn-product-card-info.css +6 -7
  50. package/collection/components/widgets/pn-product-card/pn-product-card-info.js +2 -3
  51. package/collection/components/widgets/pn-product-card/pn-product-card-price.css +22 -5
  52. package/collection/components/widgets/pn-product-card/pn-product-card-price.js +1 -1
  53. package/collection/components/widgets/pn-product-card/pn-product-card.css +88 -30
  54. package/collection/components/widgets/pn-product-card/pn-product-card.js +1 -1
  55. package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.css +1 -0
  56. package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.stories.js +1 -1
  57. package/custom-elements/index.d.ts +12 -6
  58. package/custom-elements/index.js +201 -91
  59. package/esm/{index-02847864.js → index-5397620b.js} +4 -1
  60. package/esm/{index-1978107a.js → index-7b21ecff.js} +1 -1
  61. package/esm/loader.js +2 -2
  62. package/esm/pn-bonus-progressbar-level.entry.js +1 -1
  63. package/esm/pn-bonus-progressbar.entry.js +1 -1
  64. package/esm/pn-choice-button.entry.js +1 -1
  65. package/esm/pn-filter-checkbox.entry.js +1 -1
  66. package/esm/pn-find-price-result.entry.js +5 -5
  67. package/esm/{pn-find-price-store-b2f18af4.js → pn-find-price-store-3301df0a.js} +1 -2
  68. package/esm/pn-find-price.entry.js +9 -12
  69. package/esm/pn-find-service-and-price-result.entry.js +3 -3
  70. package/esm/{pn-find-service-and-price-store-27464d58.js → pn-find-service-and-price-store-65df46a0.js} +1 -1
  71. package/esm/pn-find-service-and-price.entry.js +3 -3
  72. package/esm/pn-language-selector_9.entry.js +3 -3
  73. package/esm/pn-mainnav-link.entry.js +3 -3
  74. package/esm/{pn-mainnav-store-5d39e63a.js → pn-mainnav-store-28571e54.js} +1 -1
  75. package/esm/pn-market-web-components.js +2 -2
  76. package/esm/pn-marketweb-input.entry.js +72 -0
  77. package/esm/pn-marketweb-search.entry.js +99 -0
  78. package/esm/pn-marketweb-sitefooter.entry.js +1 -1
  79. package/esm/pn-marketweb-siteheader.entry.js +1 -1
  80. package/esm/pn-pex-pricefinder.entry.js +11 -3
  81. package/esm/pn-product-card_3.entry.js +9 -9
  82. package/esm/pn-product-pricelist-result.entry.js +3 -3
  83. package/esm/{pn-product-pricelist-store-df8749ef.js → pn-product-pricelist-store-2c336043.js} +1 -1
  84. package/esm/pn-product-pricelist.entry.js +4 -4
  85. package/esm/pn-product-tile_3.entry.js +1 -1
  86. package/esm/pn-profile-selector-option.entry.js +1 -1
  87. package/esm/pn-profile-selector.entry.js +1 -1
  88. package/esm/pn-sidenav-level.entry.js +3 -3
  89. package/esm/pn-sidenav-link.entry.js +3 -3
  90. package/esm/{pn-sidenav-store-d4bd09c8.js → pn-sidenav-store-50b186d6.js} +1 -1
  91. package/esm/pn-sidenav.entry.js +3 -3
  92. package/esm/pn-site-footer_2.entry.js +1 -1
  93. package/esm-es5/{index-02847864.js → index-5397620b.js} +1 -1
  94. package/esm-es5/{index-1978107a.js → index-7b21ecff.js} +1 -1
  95. package/esm-es5/loader.js +1 -1
  96. package/esm-es5/pn-bonus-progressbar-level.entry.js +1 -1
  97. package/esm-es5/pn-bonus-progressbar.entry.js +1 -1
  98. package/esm-es5/pn-choice-button.entry.js +1 -1
  99. package/esm-es5/pn-filter-checkbox.entry.js +1 -1
  100. package/esm-es5/pn-find-price-result.entry.js +1 -1
  101. package/esm-es5/pn-find-price-store-3301df0a.js +1 -0
  102. package/esm-es5/pn-find-price.entry.js +1 -1
  103. package/esm-es5/pn-find-service-and-price-result.entry.js +1 -1
  104. package/esm-es5/{pn-find-service-and-price-store-27464d58.js → pn-find-service-and-price-store-65df46a0.js} +1 -1
  105. package/esm-es5/pn-find-service-and-price.entry.js +1 -1
  106. package/esm-es5/pn-language-selector_9.entry.js +1 -1
  107. package/esm-es5/pn-mainnav-link.entry.js +1 -1
  108. package/esm-es5/{pn-mainnav-store-5d39e63a.js → pn-mainnav-store-28571e54.js} +1 -1
  109. package/esm-es5/pn-market-web-components.js +1 -1
  110. package/esm-es5/pn-marketweb-input.entry.js +1 -0
  111. package/esm-es5/pn-marketweb-search.entry.js +1 -0
  112. package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
  113. package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
  114. package/esm-es5/pn-pex-pricefinder.entry.js +1 -1
  115. package/esm-es5/pn-product-card_3.entry.js +1 -1
  116. package/esm-es5/pn-product-pricelist-result.entry.js +1 -1
  117. package/esm-es5/{pn-product-pricelist-store-df8749ef.js → pn-product-pricelist-store-2c336043.js} +1 -1
  118. package/esm-es5/pn-product-pricelist.entry.js +1 -1
  119. package/esm-es5/pn-product-tile_3.entry.js +1 -1
  120. package/esm-es5/pn-profile-selector-option.entry.js +1 -1
  121. package/esm-es5/pn-profile-selector.entry.js +1 -1
  122. package/esm-es5/pn-sidenav-level.entry.js +1 -1
  123. package/esm-es5/pn-sidenav-link.entry.js +1 -1
  124. package/esm-es5/{pn-sidenav-store-d4bd09c8.js → pn-sidenav-store-50b186d6.js} +1 -1
  125. package/esm-es5/pn-sidenav.entry.js +1 -1
  126. package/esm-es5/pn-site-footer_2.entry.js +1 -1
  127. package/package.json +1 -1
  128. package/pn-market-web-components/{p-0f17a915.system.entry.js → p-01fbbbbc.system.entry.js} +1 -1
  129. package/pn-market-web-components/{p-3163e45b.system.js → p-02ea55ad.system.js} +1 -1
  130. package/pn-market-web-components/{p-6926ecdf.entry.js → p-045a349a.entry.js} +1 -1
  131. package/pn-market-web-components/p-07cc9f6b.system.entry.js +1 -0
  132. package/pn-market-web-components/{p-2f899d96.js → p-0cacf9fb.js} +1 -1
  133. package/pn-market-web-components/{p-b99c5d79.entry.js → p-10b95894.entry.js} +1 -1
  134. package/pn-market-web-components/{p-0e4a8305.system.entry.js → p-13eb4c66.system.entry.js} +1 -1
  135. package/pn-market-web-components/{p-ad2c41d8.entry.js → p-15112837.entry.js} +1 -1
  136. package/pn-market-web-components/{p-89907168.system.entry.js → p-1ce871c5.system.entry.js} +1 -1
  137. package/pn-market-web-components/{p-75654937.entry.js → p-227e1d46.entry.js} +1 -1
  138. package/pn-market-web-components/{p-3e3fed19.system.entry.js → p-2718b89a.system.entry.js} +1 -1
  139. package/pn-market-web-components/{p-0a95c2b9.system.entry.js → p-2870b0c5.system.entry.js} +1 -1
  140. package/pn-market-web-components/p-29d5e118.entry.js +1 -0
  141. package/pn-market-web-components/p-36654f2a.system.js +1 -0
  142. package/pn-market-web-components/p-3971ddb9.system.js +1 -0
  143. package/pn-market-web-components/p-3af9dfc5.system.entry.js +1 -0
  144. package/pn-market-web-components/{p-8bb99125.system.entry.js → p-401b57b1.system.entry.js} +1 -1
  145. package/pn-market-web-components/{p-f2ca2961.entry.js → p-40264b65.entry.js} +1 -1
  146. package/pn-market-web-components/{p-c932f5f5.entry.js → p-51df9292.entry.js} +1 -1
  147. package/pn-market-web-components/{p-c089e9b5.system.entry.js → p-57cc0679.system.entry.js} +1 -1
  148. package/pn-market-web-components/p-58e8d7d5.js +1 -0
  149. package/pn-market-web-components/{p-b0a2b362.entry.js → p-5c41acb2.entry.js} +1 -1
  150. package/pn-market-web-components/p-5d587499.js +1 -0
  151. package/pn-market-web-components/{p-8a3c3674.system.entry.js → p-625fb7fb.system.entry.js} +1 -1
  152. package/pn-market-web-components/p-67887512.system.js +1 -0
  153. package/pn-market-web-components/{p-465baa55.entry.js → p-715d1ef7.entry.js} +1 -1
  154. package/pn-market-web-components/p-72195bd8.entry.js +1 -0
  155. package/pn-market-web-components/{p-bb69b9ff.entry.js → p-774b7a9f.entry.js} +1 -1
  156. package/pn-market-web-components/{p-b14d20bd.system.entry.js → p-7b93d570.system.entry.js} +1 -1
  157. package/pn-market-web-components/{p-bc4da3dd.entry.js → p-7d75ea68.entry.js} +1 -1
  158. package/pn-market-web-components/p-7e494e9d.system.entry.js +1 -0
  159. package/pn-market-web-components/p-80dce81e.system.entry.js +1 -0
  160. package/pn-market-web-components/{p-ec78fe82.system.entry.js → p-8144bcbc.system.entry.js} +1 -1
  161. package/pn-market-web-components/{p-27168bcc.entry.js → p-81d764a0.entry.js} +1 -1
  162. package/pn-market-web-components/{p-aa625cb0.system.js → p-825b8fb8.system.js} +1 -1
  163. package/pn-market-web-components/{p-271f42e8.js → p-84699999.js} +1 -1
  164. package/pn-market-web-components/{p-5629de79.entry.js → p-86b271f4.entry.js} +1 -1
  165. package/pn-market-web-components/p-86f06e26.js +1 -0
  166. package/pn-market-web-components/{p-547a9203.system.entry.js → p-885bc8d7.system.entry.js} +1 -1
  167. package/pn-market-web-components/p-996d8a6a.entry.js +1 -0
  168. package/pn-market-web-components/p-9e8c5793.system.entry.js +1 -0
  169. package/pn-market-web-components/p-9edaf6b6.system.entry.js +1 -0
  170. package/pn-market-web-components/p-a5bc1695.system.js +1 -0
  171. package/pn-market-web-components/{p-b5fbf807.system.js → p-a5f75560.system.js} +1 -1
  172. package/pn-market-web-components/{p-fed64b11.entry.js → p-adc639c8.entry.js} +1 -1
  173. package/pn-market-web-components/{p-aa59101e.system.js → p-add7d76c.system.js} +1 -1
  174. package/pn-market-web-components/{p-99d6a75c.js → p-ae2bd55f.js} +1 -1
  175. package/pn-market-web-components/{p-c74ee774.system.entry.js → p-aeb26d10.system.entry.js} +1 -1
  176. package/pn-market-web-components/{p-d71027bc.entry.js → p-b4f0228c.entry.js} +1 -1
  177. package/pn-market-web-components/p-bb626ab4.js +1 -0
  178. package/pn-market-web-components/{p-5cb8ae86.entry.js → p-c0c52dc6.entry.js} +1 -1
  179. package/pn-market-web-components/{p-415b6c13.entry.js → p-c240b614.entry.js} +1 -1
  180. package/pn-market-web-components/p-c34db063.entry.js +1 -0
  181. package/pn-market-web-components/{p-3bef52c8.system.entry.js → p-c418bb48.system.entry.js} +1 -1
  182. package/pn-market-web-components/{p-07733b06.system.entry.js → p-d46d9b6e.system.entry.js} +1 -1
  183. package/pn-market-web-components/{p-15a18941.system.entry.js → p-d7776336.system.entry.js} +1 -1
  184. package/pn-market-web-components/{p-f2307b30.entry.js → p-e056d2c6.entry.js} +1 -1
  185. package/pn-market-web-components/{p-0c1d92ed.entry.js → p-e474b831.entry.js} +1 -1
  186. package/pn-market-web-components/p-e5fffc92.entry.js +1 -0
  187. package/pn-market-web-components/p-e9fe5c54.entry.js +1 -0
  188. package/pn-market-web-components/{p-df87670c.system.entry.js → p-f4cb2104.system.entry.js} +1 -1
  189. package/pn-market-web-components/{p-7a14e808.entry.js → p-f774e2cc.entry.js} +1 -1
  190. package/pn-market-web-components/{p-cf058789.system.entry.js → p-f7b013a7.system.entry.js} +1 -1
  191. package/pn-market-web-components/{p-8f309dad.system.entry.js → p-fc1083d2.system.entry.js} +1 -1
  192. package/pn-market-web-components/p-fc6a09e0.system.entry.js +1 -0
  193. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  194. package/pn-market-web-components/pn-market-web-components.js +1 -1
  195. package/types/components/input/pn-marketweb-input/pn-marketweb-input.d.ts +32 -0
  196. package/types/components/input/{pn-filter-search/pn-filter-search.d.ts → pn-marketweb-search/pn-marketweb-search.d.ts} +9 -1
  197. package/types/components/widgets/pn-find-price/pn-find-price-store.d.ts +0 -2
  198. package/types/components/widgets/pn-find-price/pn-find-price-translations.d.ts +0 -5
  199. package/types/components/widgets/pn-find-price/pn-find-price-types.d.ts +0 -1
  200. package/types/components/widgets/pn-pex-pricefinder/pn-pex-pricefinder.d.ts +1 -0
  201. package/types/components.d.ts +146 -65
  202. package/cjs/pn-filter-search.cjs.entry.js +0 -69
  203. package/esm/pn-filter-search.entry.js +0 -65
  204. package/esm-es5/pn-filter-search.entry.js +0 -1
  205. package/esm-es5/pn-find-price-store-b2f18af4.js +0 -1
  206. package/pn-market-web-components/p-0065e309.system.js +0 -1
  207. package/pn-market-web-components/p-1662a0e9.system.entry.js +0 -1
  208. package/pn-market-web-components/p-1663fe37.entry.js +0 -1
  209. package/pn-market-web-components/p-5ff39f75.system.entry.js +0 -1
  210. package/pn-market-web-components/p-6855204a.entry.js +0 -1
  211. package/pn-market-web-components/p-90c11ea0.system.entry.js +0 -1
  212. package/pn-market-web-components/p-9ae0afa8.js +0 -1
  213. package/pn-market-web-components/p-9d2ff751.system.entry.js +0 -1
  214. package/pn-market-web-components/p-a110366f.entry.js +0 -1
  215. package/pn-market-web-components/p-af1ac826.js +0 -1
  216. package/pn-market-web-components/p-b429c99d.system.js +0 -1
  217. package/pn-market-web-components/p-b6769599.entry.js +0 -1
  218. package/pn-market-web-components/p-b7b78fb0.system.entry.js +0 -1
  219. package/pn-market-web-components/p-d30c5783.system.entry.js +0 -1
  220. package/pn-market-web-components/p-d944756c.system.js +0 -1
  221. package/pn-market-web-components/p-dde0c959.js +0 -1
  222. package/pn-market-web-components/p-e1a8308e.system.js +0 -1
  223. package/pn-market-web-components/p-e422ad85.js +0 -1
  224. package/pn-market-web-components/p-ebc83f89.entry.js +0 -1
@@ -0,0 +1,412 @@
1
+ import { Component, Prop, h, Host, State } from "@stencil/core";
2
+ export class PnMarketwebInput {
3
+ constructor() {
4
+ this.disabled = false;
5
+ /** Error message; will take precedence over helpertext if both are provided (applies invalid styles automatically) */
6
+ this.error = '';
7
+ /** Error state without message (If you want to control the error messaging on your own) */
8
+ this.invalid = false;
9
+ /** Text message placed underneath the input field */
10
+ this.helpertext = '';
11
+ /** Text label placed above the input field */
12
+ this.label = '';
13
+ this.placeholder = '';
14
+ this.inputid = `${Math.random()}`;
15
+ this.name = '';
16
+ this.required = null;
17
+ this.type = 'text';
18
+ this.autocomplete = '';
19
+ this.valid = null;
20
+ this.value = '';
21
+ /** The maximum number of characters the user should be able to add, also adds a visible counter */
22
+ this.maxlength = '';
23
+ this.min = '';
24
+ this.max = '';
25
+ this.step = '';
26
+ this.pattern = '';
27
+ this.showText = false;
28
+ }
29
+ getTextMessage() {
30
+ if (this.error)
31
+ return this.error;
32
+ if (this.helpertext)
33
+ return this.helpertext;
34
+ return null;
35
+ }
36
+ toggleTextVisibility() {
37
+ this.showText = !this.showText;
38
+ }
39
+ getInputType() {
40
+ let types = ['text', 'password', 'url', 'tel', 'search', 'number', 'email', 'date', 'datetime-local', 'month', 'week', 'time'];
41
+ return (types.includes(this.type) && !this.showText) ? this.type : 'text';
42
+ }
43
+ setVal(e) {
44
+ var _a;
45
+ const target = (_a = e.composedPath) === null || _a === void 0 ? void 0 : _a.call(e)[0];
46
+ this.value = target.value;
47
+ }
48
+ getClassNames() {
49
+ let classNames = 'pn-input ';
50
+ if (this.error.length > 0 || this.invalid)
51
+ classNames += 'error ';
52
+ if (this.valid)
53
+ classNames += 'valid ';
54
+ if (this.type === 'password')
55
+ classNames += 'password ';
56
+ if (this.error || this.invalid || this.valid)
57
+ classNames += 'icon ';
58
+ return classNames;
59
+ }
60
+ render() {
61
+ return (h(Host, { class: this.getClassNames() },
62
+ (this.label || this.maxlength) &&
63
+ h("div", { class: "label-container" },
64
+ this.label && h("label", { htmlFor: this.inputid }, this.label),
65
+ parseInt(this.maxlength) > 0 && h("label", { class: "char-count", htmlFor: this.inputid }, `${this.value.length}/${this.maxlength}`)),
66
+ h("div", { class: "input-container" },
67
+ h("input", { type: this.getInputType(), value: this.value, id: this.inputid, name: this.name, placeholder: this.placeholder, disabled: this.disabled, autocomplete: this.autocomplete, onInput: (e) => this.setVal(e), maxlength: this.maxlength ? this.maxlength : null, min: (this.min ? this.min : null), max: (this.max ? this.max : null), step: (this.step ? this.step : null), pattern: (this.pattern ? this.pattern : null) }),
68
+ h("svg", { class: "pn-input-checkmark", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none" },
69
+ h("polyline", { class: "checkmark-path", points: "4,12 9,17 20,6", "stroke-width": "3" })),
70
+ this.type === 'password' && !this.disabled && h("button", { onClick: () => this.toggleTextVisibility() }, "Show")),
71
+ this.getTextMessage() &&
72
+ h("small", null,
73
+ this.error && h("pn-icon", { symbol: "alert-exclamation-circle", small: true, color: "warning" }),
74
+ this.getTextMessage())));
75
+ }
76
+ static get is() { return "pn-marketweb-input"; }
77
+ static get originalStyleUrls() { return {
78
+ "$": ["pn-marketweb-input.scss"]
79
+ }; }
80
+ static get styleUrls() { return {
81
+ "$": ["pn-marketweb-input.css"]
82
+ }; }
83
+ static get properties() { return {
84
+ "disabled": {
85
+ "type": "boolean",
86
+ "mutable": false,
87
+ "complexType": {
88
+ "original": "boolean",
89
+ "resolved": "boolean",
90
+ "references": {}
91
+ },
92
+ "required": false,
93
+ "optional": false,
94
+ "docs": {
95
+ "tags": [],
96
+ "text": ""
97
+ },
98
+ "attribute": "disabled",
99
+ "reflect": false,
100
+ "defaultValue": "false"
101
+ },
102
+ "error": {
103
+ "type": "string",
104
+ "mutable": false,
105
+ "complexType": {
106
+ "original": "string",
107
+ "resolved": "string",
108
+ "references": {}
109
+ },
110
+ "required": false,
111
+ "optional": false,
112
+ "docs": {
113
+ "tags": [],
114
+ "text": "Error message; will take precedence over helpertext if both are provided (applies invalid styles automatically)"
115
+ },
116
+ "attribute": "error",
117
+ "reflect": false,
118
+ "defaultValue": "''"
119
+ },
120
+ "invalid": {
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": "Error state without message (If you want to control the error messaging on your own)"
133
+ },
134
+ "attribute": "invalid",
135
+ "reflect": false,
136
+ "defaultValue": "false"
137
+ },
138
+ "helpertext": {
139
+ "type": "string",
140
+ "mutable": false,
141
+ "complexType": {
142
+ "original": "string",
143
+ "resolved": "string",
144
+ "references": {}
145
+ },
146
+ "required": false,
147
+ "optional": false,
148
+ "docs": {
149
+ "tags": [],
150
+ "text": "Text message placed underneath the input field"
151
+ },
152
+ "attribute": "helpertext",
153
+ "reflect": false,
154
+ "defaultValue": "''"
155
+ },
156
+ "label": {
157
+ "type": "string",
158
+ "mutable": false,
159
+ "complexType": {
160
+ "original": "string",
161
+ "resolved": "string",
162
+ "references": {}
163
+ },
164
+ "required": false,
165
+ "optional": false,
166
+ "docs": {
167
+ "tags": [],
168
+ "text": "Text label placed above the input field"
169
+ },
170
+ "attribute": "label",
171
+ "reflect": false,
172
+ "defaultValue": "''"
173
+ },
174
+ "placeholder": {
175
+ "type": "string",
176
+ "mutable": false,
177
+ "complexType": {
178
+ "original": "string",
179
+ "resolved": "string",
180
+ "references": {}
181
+ },
182
+ "required": false,
183
+ "optional": false,
184
+ "docs": {
185
+ "tags": [],
186
+ "text": ""
187
+ },
188
+ "attribute": "placeholder",
189
+ "reflect": false,
190
+ "defaultValue": "''"
191
+ },
192
+ "inputid": {
193
+ "type": "string",
194
+ "mutable": false,
195
+ "complexType": {
196
+ "original": "string",
197
+ "resolved": "string",
198
+ "references": {}
199
+ },
200
+ "required": false,
201
+ "optional": false,
202
+ "docs": {
203
+ "tags": [],
204
+ "text": ""
205
+ },
206
+ "attribute": "inputid",
207
+ "reflect": false,
208
+ "defaultValue": "`${Math.random()}`"
209
+ },
210
+ "name": {
211
+ "type": "string",
212
+ "mutable": false,
213
+ "complexType": {
214
+ "original": "string",
215
+ "resolved": "string",
216
+ "references": {}
217
+ },
218
+ "required": false,
219
+ "optional": false,
220
+ "docs": {
221
+ "tags": [],
222
+ "text": ""
223
+ },
224
+ "attribute": "name",
225
+ "reflect": false,
226
+ "defaultValue": "''"
227
+ },
228
+ "required": {
229
+ "type": "boolean",
230
+ "mutable": false,
231
+ "complexType": {
232
+ "original": "boolean",
233
+ "resolved": "boolean",
234
+ "references": {}
235
+ },
236
+ "required": false,
237
+ "optional": false,
238
+ "docs": {
239
+ "tags": [],
240
+ "text": ""
241
+ },
242
+ "attribute": "required",
243
+ "reflect": false,
244
+ "defaultValue": "null"
245
+ },
246
+ "type": {
247
+ "type": "string",
248
+ "mutable": true,
249
+ "complexType": {
250
+ "original": "string",
251
+ "resolved": "string",
252
+ "references": {}
253
+ },
254
+ "required": false,
255
+ "optional": false,
256
+ "docs": {
257
+ "tags": [],
258
+ "text": ""
259
+ },
260
+ "attribute": "type",
261
+ "reflect": false,
262
+ "defaultValue": "'text'"
263
+ },
264
+ "autocomplete": {
265
+ "type": "string",
266
+ "mutable": false,
267
+ "complexType": {
268
+ "original": "string",
269
+ "resolved": "string",
270
+ "references": {}
271
+ },
272
+ "required": false,
273
+ "optional": false,
274
+ "docs": {
275
+ "tags": [],
276
+ "text": ""
277
+ },
278
+ "attribute": "autocomplete",
279
+ "reflect": false,
280
+ "defaultValue": "''"
281
+ },
282
+ "valid": {
283
+ "type": "boolean",
284
+ "mutable": false,
285
+ "complexType": {
286
+ "original": "boolean",
287
+ "resolved": "boolean",
288
+ "references": {}
289
+ },
290
+ "required": false,
291
+ "optional": false,
292
+ "docs": {
293
+ "tags": [],
294
+ "text": ""
295
+ },
296
+ "attribute": "valid",
297
+ "reflect": false,
298
+ "defaultValue": "null"
299
+ },
300
+ "value": {
301
+ "type": "string",
302
+ "mutable": false,
303
+ "complexType": {
304
+ "original": "string",
305
+ "resolved": "string",
306
+ "references": {}
307
+ },
308
+ "required": false,
309
+ "optional": false,
310
+ "docs": {
311
+ "tags": [],
312
+ "text": ""
313
+ },
314
+ "attribute": "value",
315
+ "reflect": false,
316
+ "defaultValue": "''"
317
+ },
318
+ "maxlength": {
319
+ "type": "string",
320
+ "mutable": false,
321
+ "complexType": {
322
+ "original": "string",
323
+ "resolved": "string",
324
+ "references": {}
325
+ },
326
+ "required": false,
327
+ "optional": false,
328
+ "docs": {
329
+ "tags": [],
330
+ "text": "The maximum number of characters the user should be able to add, also adds a visible counter"
331
+ },
332
+ "attribute": "maxlength",
333
+ "reflect": false,
334
+ "defaultValue": "''"
335
+ },
336
+ "min": {
337
+ "type": "string",
338
+ "mutable": false,
339
+ "complexType": {
340
+ "original": "string",
341
+ "resolved": "string",
342
+ "references": {}
343
+ },
344
+ "required": false,
345
+ "optional": false,
346
+ "docs": {
347
+ "tags": [],
348
+ "text": ""
349
+ },
350
+ "attribute": "min",
351
+ "reflect": false,
352
+ "defaultValue": "''"
353
+ },
354
+ "max": {
355
+ "type": "string",
356
+ "mutable": false,
357
+ "complexType": {
358
+ "original": "string",
359
+ "resolved": "string",
360
+ "references": {}
361
+ },
362
+ "required": false,
363
+ "optional": false,
364
+ "docs": {
365
+ "tags": [],
366
+ "text": ""
367
+ },
368
+ "attribute": "max",
369
+ "reflect": false,
370
+ "defaultValue": "''"
371
+ },
372
+ "step": {
373
+ "type": "string",
374
+ "mutable": false,
375
+ "complexType": {
376
+ "original": "string",
377
+ "resolved": "string",
378
+ "references": {}
379
+ },
380
+ "required": false,
381
+ "optional": false,
382
+ "docs": {
383
+ "tags": [],
384
+ "text": ""
385
+ },
386
+ "attribute": "step",
387
+ "reflect": false,
388
+ "defaultValue": "''"
389
+ },
390
+ "pattern": {
391
+ "type": "string",
392
+ "mutable": false,
393
+ "complexType": {
394
+ "original": "string",
395
+ "resolved": "string",
396
+ "references": {}
397
+ },
398
+ "required": false,
399
+ "optional": false,
400
+ "docs": {
401
+ "tags": [],
402
+ "text": ""
403
+ },
404
+ "attribute": "pattern",
405
+ "reflect": false,
406
+ "defaultValue": "''"
407
+ }
408
+ }; }
409
+ static get states() { return {
410
+ "showText": {}
411
+ }; }
412
+ }
@@ -1,7 +1,7 @@
1
1
  import readme from "./readme.md";
2
2
 
3
3
  export default {
4
- title: "input/Filter search field",
4
+ title: "input/Market web search field",
5
5
  parameters: {
6
6
  notes: readme,
7
7
  layout: 'centered'
@@ -10,7 +10,7 @@ export default {
10
10
 
11
11
  const Template = ({ ...args }) => {
12
12
  return `
13
- <pn-filter-search
13
+ <pn-marketweb-search
14
14
  label="${args.label}"
15
15
  name="${args.name}"
16
16
  inputid="${args.inputid}"
@@ -20,7 +20,19 @@ const Template = ({ ...args }) => {
20
20
  disabled=${args.disabled}
21
21
  loading=${args.loading}
22
22
  light="${args.light}"
23
- ></pn-filter-search>
23
+ list="listexample"
24
+ ></pn-marketweb-search>
25
+ <datalist id="listexample">
26
+ <option>Autocomplete example</option>
27
+ <option>More autocomplete examples</option>
28
+ </datalist>
29
+ <script>
30
+ // window.setTimeout(function() {
31
+ // const newOpt = document.createElement("option");
32
+ // newOpt.innerHTML = "new item";
33
+ // document.getElementById("listexample").appendChild(newOpt);
34
+ // }, 500);
35
+ </script>
24
36
  `;
25
37
  };
26
38
  export const Primary = Template.bind({});
@@ -66,28 +66,33 @@
66
66
  align-items: center;
67
67
  justify-content: center;
68
68
  }
69
+ :host[list] :host > .input-container .button-container {
70
+ display: none;
71
+ }
69
72
  :host > .input-container button {
70
73
  position: absolute;
71
74
  left: 50%;
72
75
  top: 50%;
73
76
  transform: translate(100%, -50%);
74
- background: none;
77
+ background: #FFFFFF;
75
78
  border: none;
76
79
  color: #005D92;
77
80
  padding: 0.3rem;
81
+ margin: 0;
82
+ font-size: 0.875em;
78
83
  border-radius: 50%;
79
84
  outline: none;
80
85
  transition: border 0.1s, background 0.2s, box-shadow 0.1s, transform cubic-bezier(0.7, 0, 0.3, 1) 0.2s, opacity 0.2s;
81
86
  border: 0.1rem solid transparent;
87
+ -webkit-tap-highlight-color: transparent;
82
88
  }
83
89
  :host > .input-container button.clear, :host > .input-container button.search {
84
90
  cursor: pointer;
85
91
  }
86
92
  :host > .input-container button:focus {
87
93
  box-shadow: 0 0 0 0.2rem #fff, 0 0 0 0.4rem #005D92;
88
- background: #8EDDF9;
89
94
  }
90
- :host > .input-container button:hover {
95
+ :host > .input-container button:hover, :host > .input-container button:focus {
91
96
  background: #E0F8FF;
92
97
  }
93
98
  :host > .input-container button:active {
@@ -98,44 +103,44 @@
98
103
  fill: white;
99
104
  }
100
105
 
101
- :host.searching button.search {
106
+ :host .searching button.search {
102
107
  transform: translate(150%, -50%);
103
108
  }
104
- :host.searching button.clear {
109
+ :host .searching button.clear {
105
110
  transform: translate(-50%, -50%);
106
111
  }
107
112
 
108
113
  /*---------------------------------------Button Variants-------------------------------------------*/
109
- :host.button-none input,
110
- :host.button-icon-inline input {
114
+ :host .button-none input,
115
+ :host .button-icon-inline input {
111
116
  padding-right: 3.3em;
112
117
  }
113
- :host.button-none pn-spinner,
114
- :host.button-icon-inline pn-spinner {
118
+ :host .button-none pn-spinner,
119
+ :host .button-icon-inline pn-spinner {
115
120
  position: absolute;
116
121
  left: 50%;
117
122
  top: 50%;
118
123
  transform: translate(100%, -50%);
119
124
  transition: transform cubic-bezier(0.7, 0, 0.3, 1) 0.2s;
120
125
  }
121
- :host.button-none button.search,
122
- :host.button-icon-inline button.search {
126
+ :host .button-none button.search,
127
+ :host .button-icon-inline button.search {
123
128
  transform: translate(-50%, -50%);
124
129
  }
125
- :host.button-none.loading button,
126
- :host.button-icon-inline.loading button {
130
+ :host .button-none.loading button,
131
+ :host .button-icon-inline.loading button {
127
132
  transform: translate(100%, -50%);
128
133
  }
129
- :host.button-none.loading pn-spinner,
130
- :host.button-icon-inline.loading pn-spinner {
134
+ :host .button-none.loading pn-spinner,
135
+ :host .button-icon-inline.loading pn-spinner {
131
136
  transform: translate(-50%, -50%);
132
137
  }
133
138
 
134
- :host.button-none.searching button.search {
139
+ :host .button-none.searching button.search {
135
140
  transform: translate(100%, -50%);
136
141
  }
137
142
 
138
- :host.button-icon > pn-button[data-loading=true] .pn-button-bg {
143
+ :host .button-icon > pn-button[data-loading=true] .pn-button-bg {
139
144
  left: 50%;
140
145
  transform: translateX(-50%);
141
146
  }
@@ -1,11 +1,12 @@
1
- import { Component, Prop, h, Host, Event, Element, Listen } from "@stencil/core";
2
- export class PnFilterSearch {
1
+ import { Component, Prop, h, Host, Event, Element, Listen, State } from "@stencil/core";
2
+ export class PnMarketwebSearch {
3
3
  constructor() {
4
4
  this.disabled = false;
5
5
  this.placeholder = null;
6
6
  this.inputid = null;
7
7
  this.name = null;
8
8
  this.autocomplete = null;
9
+ this.list = null;
9
10
  this.value = null;
10
11
  /** Label for the button */
11
12
  this.label = null;
@@ -15,6 +16,9 @@ export class PnFilterSearch {
15
16
  this.button = '';
16
17
  /** Light instead of dark search button */
17
18
  this.light = false;
19
+ this.suggestionObserver = null;
20
+ this.hasClonedInput = false;
21
+ this.listSuggestion = [];
18
22
  }
19
23
  inputHandler() {
20
24
  this.update.emit(this.value);
@@ -46,10 +50,37 @@ export class PnFilterSearch {
46
50
  classNames += `button-${this.button} `;
47
51
  return classNames;
48
52
  }
53
+ componentWillRender() {
54
+ this.cloneListContent();
55
+ this.autocompleteEventBinding();
56
+ }
57
+ onSuggestionUpdate() {
58
+ this.cloneListContent();
59
+ }
60
+ autocompleteEventBinding() {
61
+ if (this.suggestionObserver !== null || !this.list || (!this.hostElement) || !document.getElementById(this.list)) {
62
+ return;
63
+ }
64
+ const targetNode = document.getElementById(this.list);
65
+ this.suggestionObserver = new MutationObserver(this.onSuggestionUpdate.bind(this));
66
+ this.suggestionObserver.observe(targetNode, { attributes: true, childList: true, subtree: true });
67
+ }
68
+ cloneListContent() {
69
+ if (!this.list || (!this.hostElement) || !document.getElementById(this.list)) {
70
+ return;
71
+ }
72
+ const options = [...document.getElementById(this.list).querySelectorAll('option')];
73
+ this.listSuggestion = options.map((item) => {
74
+ if (item.hasAttribute('value')) {
75
+ return item.getAttribute('value');
76
+ }
77
+ return item.innerText;
78
+ });
79
+ }
49
80
  render() {
50
- return (h(Host, { class: this.getClassNames() },
51
- h("div", { class: "input-container" },
52
- h("input", { type: "search", value: this.value, id: this.inputid, name: this.name, placeholder: this.placeholder, disabled: this.disabled, autocomplete: this.autocomplete, onKeyDown: (e) => this.emitSearch(e), onInput: (e) => this.setVal(e) }),
81
+ return (h(Host, null,
82
+ h("div", { class: `input-container ${this.getClassNames()}`, "data-haslist": (this.list !== null) + '' },
83
+ h("input", { type: "search", value: this.value, id: this.inputid, name: this.name, placeholder: this.placeholder, disabled: this.disabled, autocomplete: this.autocomplete, list: this.list, onKeyDown: (e) => this.emitSearch(e), onInput: (e) => this.setVal(e) }),
53
84
  h("div", { class: "button-container" },
54
85
  (this.button === 'none' || this.button === 'icon-inline') &&
55
86
  h("button", { class: "search", tabindex: this.button === 'icon-inline' ? '0' : '-1', onClick: (e) => this.emitSearch(e), "aria-label": "search", title: "search" },
@@ -59,15 +90,19 @@ export class PnFilterSearch {
59
90
  h("pn-icon", { symbol: "close-small", color: "blue700" })),
60
91
  this.button === 'none' || this.button === 'icon-inline' && h("pn-spinner", null))),
61
92
  (this.button !== 'none' && this.button !== 'icon-inline') &&
62
- h("pn-button", { onClick: (e) => this.emitSearch(e), loading: this.loading, icon: "search", appearance: this.light ? 'light' : 'dark', "icon-only": this.button === 'icon' }, this.label)));
93
+ h("pn-button", { onClick: (e) => this.emitSearch(e), loading: this.loading, icon: "search", appearance: this.light ? 'light' : 'dark', "icon-only": this.button === 'icon' }, this.label),
94
+ (this.list) &&
95
+ h("datalist", { id: this.list }, this.listSuggestion.map((item) => {
96
+ return (h("option", null, item));
97
+ }))));
63
98
  }
64
- static get is() { return "pn-filter-search"; }
99
+ static get is() { return "pn-marketweb-search"; }
65
100
  static get encapsulation() { return "shadow"; }
66
101
  static get originalStyleUrls() { return {
67
- "$": ["pn-filter-search.scss"]
102
+ "$": ["pn-marketweb-search.scss"]
68
103
  }; }
69
104
  static get styleUrls() { return {
70
- "$": ["pn-filter-search.css"]
105
+ "$": ["pn-marketweb-search.css"]
71
106
  }; }
72
107
  static get properties() { return {
73
108
  "disabled": {
@@ -160,6 +195,24 @@ export class PnFilterSearch {
160
195
  "reflect": false,
161
196
  "defaultValue": "null"
162
197
  },
198
+ "list": {
199
+ "type": "string",
200
+ "mutable": false,
201
+ "complexType": {
202
+ "original": "string",
203
+ "resolved": "string",
204
+ "references": {}
205
+ },
206
+ "required": false,
207
+ "optional": false,
208
+ "docs": {
209
+ "tags": [],
210
+ "text": ""
211
+ },
212
+ "attribute": "list",
213
+ "reflect": false,
214
+ "defaultValue": "null"
215
+ },
163
216
  "value": {
164
217
  "type": "string",
165
218
  "mutable": false,
@@ -251,6 +304,11 @@ export class PnFilterSearch {
251
304
  "defaultValue": "false"
252
305
  }
253
306
  }; }
307
+ static get states() { return {
308
+ "suggestionObserver": {},
309
+ "hasClonedInput": {},
310
+ "listSuggestion": {}
311
+ }; }
254
312
  static get events() { return [{
255
313
  "method": "search",
256
314
  "name": "search",
@@ -0,0 +1,5 @@
1
+ <svg width="278" height="55" viewBox="0 0 278 55" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M247.355 49.6815C247.694 52.479 249.722 54.6261 252.181 54.6261H272.926C275.62 54.6261 277.798 52.0522 277.798 48.8686V48.8008C277.798 45.6173 275.62 43.0433 272.926 43.0433H270.537C269.608 39.2439 266.846 36.473 263.585 36.473H259.717C259.373 31.841 256.101 28.2092 252.124 28.2092C248.146 28.2092 244.88 31.841 244.53 36.473H242.095C238.083 36.473 234.816 40.6726 234.816 45.8205V49.6815H247.355Z" fill="#E0F8FF"/>
3
+ <path d="M12.0391 46.1022C12.3176 48.5569 14.0867 50.4373 16.2421 50.4373H34.5807C36.9304 50.4373 38.8216 48.202 38.8216 45.4248V45.3571C38.8216 42.5799 36.9304 40.3446 34.5807 40.3446H32.4684C31.6678 37.0209 29.227 34.5872 26.3283 34.5872H22.9179C22.6004 30.5597 19.7327 27.4071 16.2421 27.4071C12.7514 27.4071 9.88371 30.5597 9.56622 34.5872H7.41658C3.86346 34.5872 0.998047 38.2448 0.998047 42.7154V46.1022H12.0391Z" fill="#E0F8FF"/>
4
+ <path d="M131.056 26.5864C131.449 30.0423 133.948 32.6895 136.991 32.6895H162.891C166.209 32.6895 168.88 29.5426 168.88 25.6328V25.5375C168.88 21.6277 166.209 18.4808 162.891 18.4808H159.907C158.777 13.8015 155.33 10.3753 151.236 10.3753H146.42C145.971 4.70533 141.921 0.26709 136.991 0.26709C132.062 0.26709 128.012 4.70533 127.563 10.3753H124.528C119.51 10.3753 115.463 15.5247 115.463 21.8184V26.5864H131.056Z" fill="#E0F8FF"/>
5
+ </svg>