@gravitee/ui-components 3.25.3-typescript-8a53edf → 3.25.3-typescript-e7256ca

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 (370) hide show
  1. package/package.json +3 -4
  2. package/src/atoms/gv-autocomplete.d.ts +104 -0
  3. package/src/atoms/gv-autocomplete.js +1 -461
  4. package/src/atoms/gv-button.d.ts +109 -0
  5. package/src/atoms/gv-button.js +1 -410
  6. package/src/atoms/gv-checkbox.d.ts +114 -0
  7. package/src/atoms/gv-checkbox.js +1 -187
  8. package/src/atoms/gv-date-picker-calendar.d.ts +190 -0
  9. package/src/atoms/gv-date-picker-calendar.js +1 -894
  10. package/src/atoms/gv-date-picker-cell.d.ts +80 -0
  11. package/src/atoms/gv-date-picker-cell.js +1 -190
  12. package/src/atoms/gv-date-picker.d.ts +194 -0
  13. package/src/atoms/gv-date-picker.js +1 -671
  14. package/src/atoms/gv-file-upload.d.ts +64 -0
  15. package/src/atoms/gv-file-upload.js +1 -367
  16. package/src/atoms/gv-icon.d.ts +26 -0
  17. package/src/atoms/gv-icon.js +1 -103
  18. package/src/atoms/gv-image.d.ts +45 -0
  19. package/src/atoms/gv-image.js +1 -144
  20. package/src/atoms/gv-input-message.d.ts +20 -0
  21. package/src/atoms/gv-input-message.js +1 -84
  22. package/src/atoms/gv-input.d.ts +246 -0
  23. package/src/atoms/gv-input.js +1 -561
  24. package/src/atoms/gv-link.d.ts +67 -0
  25. package/src/atoms/gv-link.js +1 -210
  26. package/src/atoms/gv-message.d.ts +23 -0
  27. package/src/atoms/gv-message.js +1 -128
  28. package/src/atoms/gv-metric.d.ts +32 -0
  29. package/src/atoms/gv-metric.js +1 -117
  30. package/src/atoms/gv-relative-time.d.ts +45 -0
  31. package/src/atoms/gv-relative-time.js +1 -156
  32. package/src/atoms/gv-select-native.d.ts +174 -0
  33. package/src/atoms/gv-select-native.js +1 -388
  34. package/src/atoms/gv-select.d.ts +71 -0
  35. package/src/atoms/gv-select.js +1 -437
  36. package/src/atoms/gv-spinner.d.ts +10 -0
  37. package/src/atoms/gv-spinner.js +1 -57
  38. package/src/atoms/gv-state.d.ts +50 -0
  39. package/src/atoms/gv-state.js +1 -130
  40. package/src/atoms/gv-switch.d.ts +60 -0
  41. package/src/atoms/gv-switch.js +1 -243
  42. package/src/atoms/gv-tag.d.ts +69 -0
  43. package/src/atoms/gv-tag.js +1 -168
  44. package/src/atoms/gv-text.d.ts +110 -0
  45. package/src/atoms/gv-text.js +1 -168
  46. package/src/charts/gv-chart-bar.d.ts +50 -0
  47. package/src/charts/gv-chart-bar.js +1 -103
  48. package/src/charts/gv-chart-gauge.d.ts +58 -0
  49. package/src/charts/gv-chart-gauge.js +1 -100
  50. package/src/charts/gv-chart-histogram.d.ts +48 -0
  51. package/src/charts/gv-chart-histogram.js +1 -83
  52. package/src/charts/gv-chart-line.d.ts +52 -0
  53. package/src/charts/gv-chart-line.js +1 -224
  54. package/src/charts/gv-chart-map.d.ts +50 -0
  55. package/src/charts/gv-chart-map.js +1 -112
  56. package/src/charts/gv-chart-pie.d.ts +50 -0
  57. package/src/charts/gv-chart-pie.js +1 -91
  58. package/src/index.d.ts +77 -0
  59. package/src/index.js +1 -77
  60. package/src/lib/cron-expression.d.ts +1 -0
  61. package/src/lib/cron-expression.js +1 -205
  62. package/src/lib/date.d.ts +1 -0
  63. package/src/lib/date.js +1 -44
  64. package/src/lib/events.d.ts +1 -0
  65. package/src/lib/events.js +1 -26
  66. package/src/lib/http-client-schema-form.d.ts +68 -0
  67. package/src/lib/http-client-schema-form.js +1 -67
  68. package/src/lib/http.d.ts +222 -0
  69. package/src/lib/http.js +1 -237
  70. package/src/lib/i18n.d.ts +30 -0
  71. package/src/lib/i18n.js +1 -103
  72. package/src/lib/item.d.ts +12 -0
  73. package/src/lib/item.js +1 -118
  74. package/src/lib/properties.d.ts +42 -0
  75. package/src/lib/properties.js +1 -189
  76. package/src/lib/schema-form.d.ts +5 -0
  77. package/src/lib/schema-form.js +1 -44
  78. package/src/lib/studio.d.ts +2 -0
  79. package/src/lib/studio.js +1 -141
  80. package/src/lib/style.d.ts +6 -0
  81. package/src/lib/style.js +1 -41
  82. package/src/lib/text-format.d.ts +6 -0
  83. package/src/lib/text-format.js +1 -69
  84. package/src/lib/theme.d.ts +4 -0
  85. package/src/lib/theme.js +1 -63
  86. package/src/lib/utils.d.ts +9 -0
  87. package/src/lib/utils.js +1 -111
  88. package/src/mixins/chart-element.d.ts +39 -0
  89. package/src/mixins/chart-element.js +1 -165
  90. package/src/mixins/input-element.d.ts +64 -0
  91. package/src/mixins/input-element.js +1 -144
  92. package/src/mixins/item-resource.d.ts +56 -0
  93. package/src/mixins/item-resource.js +1 -120
  94. package/src/mixins/keyboard-element.d.ts +25 -0
  95. package/src/mixins/keyboard-element.js +1 -69
  96. package/src/mixins/update-after-browser.d.ts +11 -0
  97. package/src/mixins/update-after-browser.js +1 -30
  98. package/src/mixins/with-resize-observer.d.ts +12 -0
  99. package/src/mixins/with-resize-observer.js +1 -68
  100. package/src/mixins/with-skeleton-attribute.d.ts +35 -0
  101. package/src/mixins/with-skeleton-attribute.js +1 -112
  102. package/src/molecules/gv-card-full.d.ts +78 -0
  103. package/src/molecules/gv-card-full.js +1 -218
  104. package/src/molecules/gv-card-list.d.ts +33 -0
  105. package/src/molecules/gv-card-list.js +1 -113
  106. package/src/molecules/gv-card.d.ts +65 -0
  107. package/src/molecules/gv-card.js +1 -133
  108. package/src/molecules/gv-category-list.d.ts +17 -0
  109. package/src/molecules/gv-category-list.js +1 -60
  110. package/src/molecules/gv-category.d.ts +64 -0
  111. package/src/molecules/gv-category.js +1 -170
  112. package/src/molecules/gv-code.d.ts +192 -0
  113. package/src/molecules/gv-code.js +1 -359
  114. package/src/molecules/gv-confirm.d.ts +60 -0
  115. package/src/molecules/gv-confirm.js +1 -188
  116. package/src/molecules/gv-cron-editor.d.ts +115 -0
  117. package/src/molecules/gv-cron-editor.js +1 -710
  118. package/src/molecules/gv-dropdown-menu.d.ts +28 -0
  119. package/src/molecules/gv-dropdown-menu.js +1 -116
  120. package/src/molecules/gv-expandable.d.ts +37 -0
  121. package/src/molecules/gv-expandable.js +1 -122
  122. package/src/molecules/gv-expression-language.d.ts +150 -0
  123. package/src/molecules/gv-expression-language.js +1 -270
  124. package/src/molecules/gv-identity-picture.d.ts +44 -0
  125. package/src/molecules/gv-identity-picture.js +1 -148
  126. package/src/molecules/gv-list.d.ts +123 -0
  127. package/src/molecules/gv-list.js +1 -227
  128. package/src/molecules/gv-metrics.d.ts +65 -0
  129. package/src/molecules/gv-metrics.js +1 -162
  130. package/src/molecules/gv-modal.d.ts +64 -0
  131. package/src/molecules/gv-modal.js +1 -213
  132. package/src/molecules/gv-nav.d.ts +41 -0
  133. package/src/molecules/gv-nav.js +1 -196
  134. package/src/molecules/gv-option.d.ts +65 -0
  135. package/src/molecules/gv-option.js +1 -242
  136. package/src/molecules/gv-plans.d.ts +73 -0
  137. package/src/molecules/gv-plans.js +1 -429
  138. package/src/molecules/gv-popover.d.ts +91 -0
  139. package/src/molecules/gv-popover.js +1 -351
  140. package/src/molecules/gv-promote.d.ts +108 -0
  141. package/src/molecules/gv-promote.js +1 -209
  142. package/src/molecules/gv-rating-list.d.ts +77 -0
  143. package/src/molecules/gv-rating-list.js +1 -365
  144. package/src/molecules/gv-rating.d.ts +55 -0
  145. package/src/molecules/gv-rating.js +1 -253
  146. package/src/molecules/gv-row-expandable.d.ts +8 -0
  147. package/src/molecules/gv-row-expandable.js +1 -45
  148. package/src/molecules/gv-row.d.ts +37 -0
  149. package/src/molecules/gv-row.js +1 -210
  150. package/src/molecules/gv-stats.d.ts +53 -0
  151. package/src/molecules/gv-stats.js +1 -121
  152. package/src/molecules/gv-stepper.d.ts +46 -0
  153. package/src/molecules/gv-stepper.js +1 -288
  154. package/src/molecules/gv-table.d.ts +159 -0
  155. package/src/molecules/gv-table.js +1 -685
  156. package/src/molecules/gv-tree.d.ts +44 -0
  157. package/src/molecules/gv-tree.js +1 -250
  158. package/src/organisms/gv-documentation.d.ts +52 -0
  159. package/src/organisms/gv-documentation.js +1 -215
  160. package/src/organisms/gv-header.d.ts +60 -0
  161. package/src/organisms/gv-header.js +1 -288
  162. package/src/organisms/gv-http-client.d.ts +57 -0
  163. package/src/organisms/gv-http-client.js +1 -275
  164. package/src/organisms/gv-menu.d.ts +74 -0
  165. package/src/organisms/gv-menu.js +1 -263
  166. package/src/organisms/gv-newsletter-subscription.d.ts +82 -0
  167. package/src/organisms/gv-newsletter-subscription.js +1 -271
  168. package/src/organisms/gv-pagination.d.ts +63 -0
  169. package/src/organisms/gv-pagination.js +1 -198
  170. package/src/organisms/gv-properties.d.ts +229 -0
  171. package/src/organisms/gv-properties.js +1 -920
  172. package/src/organisms/gv-resizable-views.d.ts +33 -0
  173. package/src/organisms/gv-resizable-views.js +1 -396
  174. package/src/organisms/gv-resources.d.ts +125 -0
  175. package/src/organisms/gv-resources.js +1 -535
  176. package/src/organisms/gv-schema-form-array.d.ts +55 -0
  177. package/src/organisms/gv-schema-form-array.js +1 -250
  178. package/src/organisms/gv-schema-form-control-object.d.ts +64 -0
  179. package/src/organisms/gv-schema-form-control-object.js +1 -154
  180. package/src/organisms/gv-schema-form-control.d.ts +90 -0
  181. package/src/organisms/gv-schema-form-control.js +1 -443
  182. package/src/organisms/gv-schema-form.d.ts +156 -0
  183. package/src/organisms/gv-schema-form.js +1 -751
  184. package/src/organisms/gv-tabs.d.ts +56 -0
  185. package/src/organisms/gv-tabs.js +1 -210
  186. package/src/organisms/gv-user-menu.d.ts +56 -0
  187. package/src/organisms/gv-user-menu.js +1 -314
  188. package/src/organisms/gv-vertical-menu.d.ts +28 -0
  189. package/src/organisms/gv-vertical-menu.js +1 -123
  190. package/src/policy-studio/gv-flow-step.d.ts +142 -0
  191. package/src/policy-studio/gv-flow-step.js +1 -464
  192. package/src/policy-studio/gv-flow.d.ts +89 -0
  193. package/src/policy-studio/gv-flow.js +1 -621
  194. package/src/policy-studio/gv-policy-studio-menu.d.ts +94 -0
  195. package/src/policy-studio/gv-policy-studio-menu.js +1 -750
  196. package/src/policy-studio/gv-policy-studio.d.ts +464 -0
  197. package/src/policy-studio/gv-policy-studio.js +1 -1842
  198. package/src/styles/empty.d.ts +1 -0
  199. package/src/styles/empty.js +1 -36
  200. package/src/styles/input.d.ts +1 -0
  201. package/src/styles/input.js +1 -263
  202. package/src/styles/link.d.ts +1 -0
  203. package/src/styles/link.js +1 -32
  204. package/src/styles/shapes.d.ts +2 -0
  205. package/src/styles/shapes.js +1 -17
  206. package/src/styles/skeleton.d.ts +1 -0
  207. package/src/styles/skeleton.js +1 -53
  208. package/src/styles/zoom.d.ts +1 -0
  209. package/src/styles/zoom.js +1 -40
  210. package/src/theme/gv-theme.d.ts +81 -0
  211. package/src/theme/gv-theme.js +1 -203
  212. package/wc/gv-autocomplete.d.ts +1 -0
  213. package/wc/gv-autocomplete.js +1 -1
  214. package/wc/gv-button.d.ts +1 -0
  215. package/wc/gv-button.js +1 -1
  216. package/wc/gv-card-full.d.ts +1 -0
  217. package/wc/gv-card-full.js +1 -1
  218. package/wc/gv-card-list.d.ts +1 -0
  219. package/wc/gv-card-list.js +1 -1
  220. package/wc/gv-card.d.ts +1 -0
  221. package/wc/gv-card.js +1 -1
  222. package/wc/gv-category-list.d.ts +1 -0
  223. package/wc/gv-category-list.js +1 -1
  224. package/wc/gv-category.d.ts +1 -0
  225. package/wc/gv-category.js +1 -1
  226. package/wc/gv-chart-bar.d.ts +1 -0
  227. package/wc/gv-chart-bar.js +1 -1
  228. package/wc/gv-chart-gauge.d.ts +1 -0
  229. package/wc/gv-chart-gauge.js +1 -1
  230. package/wc/gv-chart-histogram.d.ts +1 -0
  231. package/wc/gv-chart-histogram.js +1 -1
  232. package/wc/gv-chart-line.d.ts +1 -0
  233. package/wc/gv-chart-line.js +1 -1
  234. package/wc/gv-chart-map.d.ts +1 -0
  235. package/wc/gv-chart-map.js +1 -1
  236. package/wc/gv-chart-pie.d.ts +1 -0
  237. package/wc/gv-chart-pie.js +1 -1
  238. package/wc/gv-checkbox.d.ts +1 -0
  239. package/wc/gv-checkbox.js +1 -1
  240. package/wc/gv-code.d.ts +1 -0
  241. package/wc/gv-code.js +1 -1
  242. package/wc/gv-confirm.d.ts +1 -0
  243. package/wc/gv-confirm.js +1 -1
  244. package/wc/gv-cron-editor.d.ts +1 -0
  245. package/wc/gv-cron-editor.js +1 -1
  246. package/wc/gv-date-picker-calendar.d.ts +1 -0
  247. package/wc/gv-date-picker-calendar.js +1 -1
  248. package/wc/gv-date-picker-cell.d.ts +1 -0
  249. package/wc/gv-date-picker-cell.js +1 -1
  250. package/wc/gv-date-picker.d.ts +1 -0
  251. package/wc/gv-date-picker.js +1 -1
  252. package/wc/gv-documentation.d.ts +1 -0
  253. package/wc/gv-documentation.js +1 -1
  254. package/wc/gv-dropdown-menu.d.ts +1 -0
  255. package/wc/gv-dropdown-menu.js +1 -1
  256. package/wc/gv-expandable.d.ts +1 -0
  257. package/wc/gv-expandable.js +1 -1
  258. package/wc/gv-expression-language.d.ts +1 -0
  259. package/wc/gv-expression-language.js +1 -1
  260. package/wc/gv-file-upload.d.ts +1 -0
  261. package/wc/gv-file-upload.js +1 -1
  262. package/wc/gv-flow-step.d.ts +1 -0
  263. package/wc/gv-flow-step.js +1 -1
  264. package/wc/gv-flow.d.ts +1 -0
  265. package/wc/gv-flow.js +1 -1
  266. package/wc/gv-header.d.ts +1 -0
  267. package/wc/gv-header.js +1 -1
  268. package/wc/gv-http-client.d.ts +1 -0
  269. package/wc/gv-http-client.js +1 -1
  270. package/wc/gv-icon.d.ts +1 -0
  271. package/wc/gv-icon.js +1 -1
  272. package/wc/gv-identity-picture.d.ts +1 -0
  273. package/wc/gv-identity-picture.js +1 -1
  274. package/wc/gv-image.d.ts +1 -0
  275. package/wc/gv-image.js +1 -1
  276. package/wc/gv-input-message.d.ts +1 -0
  277. package/wc/gv-input-message.js +1 -1
  278. package/wc/gv-input.d.ts +1 -0
  279. package/wc/gv-input.js +1 -1
  280. package/wc/gv-link.d.ts +1 -0
  281. package/wc/gv-link.js +1 -1
  282. package/wc/gv-list.d.ts +1 -0
  283. package/wc/gv-list.js +1 -1
  284. package/wc/gv-menu.d.ts +1 -0
  285. package/wc/gv-menu.js +1 -1
  286. package/wc/gv-message.d.ts +1 -0
  287. package/wc/gv-message.js +1 -1
  288. package/wc/gv-metric.d.ts +1 -0
  289. package/wc/gv-metric.js +1 -1
  290. package/wc/gv-metrics.d.ts +1 -0
  291. package/wc/gv-metrics.js +1 -1
  292. package/wc/gv-modal.d.ts +1 -0
  293. package/wc/gv-modal.js +1 -1
  294. package/wc/gv-nav.d.ts +1 -0
  295. package/wc/gv-nav.js +1 -1
  296. package/wc/gv-newsletter-subscription.d.ts +1 -0
  297. package/wc/gv-newsletter-subscription.js +1 -1
  298. package/wc/gv-option.d.ts +1 -0
  299. package/wc/gv-option.js +1 -1
  300. package/wc/gv-pagination.d.ts +1 -0
  301. package/wc/gv-pagination.js +1 -1
  302. package/wc/gv-plans.d.ts +1 -0
  303. package/wc/gv-plans.js +1 -1
  304. package/wc/gv-policy-studio-menu.d.ts +1 -0
  305. package/wc/gv-policy-studio-menu.js +1 -1
  306. package/wc/gv-policy-studio.d.ts +1 -0
  307. package/wc/gv-policy-studio.js +1 -1
  308. package/wc/gv-popover.d.ts +1 -0
  309. package/wc/gv-popover.js +1 -1
  310. package/wc/gv-promote.d.ts +1 -0
  311. package/wc/gv-promote.js +1 -1
  312. package/wc/gv-properties.d.ts +1 -0
  313. package/wc/gv-properties.js +1 -1
  314. package/wc/gv-rating-list.d.ts +1 -0
  315. package/wc/gv-rating-list.js +1 -1
  316. package/wc/gv-rating.d.ts +1 -0
  317. package/wc/gv-rating.js +1 -1
  318. package/wc/gv-relative-time.d.ts +1 -0
  319. package/wc/gv-relative-time.js +1 -1
  320. package/wc/gv-resizable-views.d.ts +1 -0
  321. package/wc/gv-resizable-views.js +1 -1
  322. package/wc/gv-resources.d.ts +1 -0
  323. package/wc/gv-resources.js +1 -1
  324. package/wc/gv-row-expandable.d.ts +1 -0
  325. package/wc/gv-row-expandable.js +1 -1
  326. package/wc/gv-row.d.ts +1 -0
  327. package/wc/gv-row.js +1 -1
  328. package/wc/gv-schema-form-array.d.ts +1 -0
  329. package/wc/gv-schema-form-array.js +1 -1
  330. package/wc/gv-schema-form-control-object.d.ts +1 -0
  331. package/wc/gv-schema-form-control-object.js +1 -1
  332. package/wc/gv-schema-form-control.d.ts +1 -0
  333. package/wc/gv-schema-form-control.js +1 -1
  334. package/wc/gv-schema-form.d.ts +1 -0
  335. package/wc/gv-schema-form.js +1 -1
  336. package/wc/gv-select-native.d.ts +1 -0
  337. package/wc/gv-select-native.js +1 -1
  338. package/wc/gv-select.d.ts +1 -0
  339. package/wc/gv-select.js +1 -1
  340. package/wc/gv-spinner.d.ts +1 -0
  341. package/wc/gv-spinner.js +1 -1
  342. package/wc/gv-state.d.ts +1 -0
  343. package/wc/gv-state.js +1 -1
  344. package/wc/gv-stats.d.ts +1 -0
  345. package/wc/gv-stats.js +1 -1
  346. package/wc/gv-stepper.d.ts +1 -0
  347. package/wc/gv-stepper.js +1 -1
  348. package/wc/gv-switch.d.ts +1 -0
  349. package/wc/gv-switch.js +1 -1
  350. package/wc/gv-table.d.ts +1 -0
  351. package/wc/gv-table.js +1 -1
  352. package/wc/gv-tabs.d.ts +1 -0
  353. package/wc/gv-tabs.js +1 -1
  354. package/wc/gv-tag.d.ts +1 -0
  355. package/wc/gv-tag.js +1 -1
  356. package/wc/gv-text.d.ts +1 -0
  357. package/wc/gv-text.js +1 -1
  358. package/wc/gv-theme.d.ts +1 -0
  359. package/wc/gv-theme.js +1 -1
  360. package/wc/gv-tree.d.ts +1 -0
  361. package/wc/gv-tree.js +1 -1
  362. package/wc/gv-user-menu.d.ts +1 -0
  363. package/wc/gv-user-menu.js +1 -1
  364. package/wc/gv-vertical-menu.d.ts +1 -0
  365. package/wc/gv-vertical-menu.js +1 -1
  366. package/CHANGELOG.md +0 -1292
  367. package/LICENSE.txt +0 -202
  368. package/README.md +0 -195
  369. package/src/.eslintrc.js +0 -19
  370. package/src/theme/definition.json +0 -1762
@@ -1,561 +1 @@
1
- /*
2
- * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { classMap } from 'lit/directives/class-map';
17
-
18
- import { LitElement, html, css } from 'lit';
19
- import { skeleton } from '../styles/skeleton';
20
- import { input } from '../styles/input';
21
- import { link } from '../styles/link';
22
- import { dispatchCustomEvent } from '../lib/events';
23
- import './gv-icon';
24
- import '../molecules/gv-popover';
25
- import { i18n } from '../lib/i18n';
26
- import { InputElement } from '../mixins/input-element';
27
- import { shapeClipboard, shapeCopied } from '../styles/shapes';
28
-
29
- /**
30
- *
31
- * ## Details
32
- * * has @theme facet
33
- *
34
- * @fires gv-input:input - mirrors native input events with the `value` on `detail`
35
- * @fires gv-input:clear - event when user clear a clearable input
36
- *
37
- * @attr {Boolean} disabled - same as native input element `disabled` attribute
38
- * @attr {Boolean} required - same as native input element `required` attribute
39
- * @attr {Boolean} skeleton - enable skeleton screen UI pattern (loading hint)
40
- * @attr {String} value - the value of the input
41
- * @attr {String} label - label of the input
42
- * @attr {String} title - title of the input
43
- * @attr {String} name - name of the input
44
- * @attr {String} placeholder - an example value to display in the input when empty
45
- * @attr {String} description - a description
46
- * @attr {String} type - type of the input, can be text (Default), password, email, search, number, url.
47
- * @attr {Boolean} clipboard - for readonly input with clipboard
48
- * @attr {Boolean} large - for a large input
49
- * @attr {Boolean} medium - for a medium input (Default)
50
- * @attr {Boolean} small - for a small input
51
- * @attr {String} icon - icon of the input
52
- * @attr {String} icon-left - icon of the input to display at left
53
- * @attr {Boolean} valid - if value is valid
54
- * @attr {Boolean} invalid - if value is invalid
55
- * @attr {Boolean} [loading=false] - true to display a loading icon
56
- * @attr {Boolean} [autofocus=false] - true to put the focus on the input
57
- * @attr {Boolean} [readonly=false] - true if field is readonly mode
58
- * @attr {String} [autocomplete='off'] - standard autocomplete attribute
59
- * @attr {Boolean} [clickable=false] - If true, icon has link style
60
- * @attr {Boolean} [clearable=false] - If true, input can be clear with button
61
- * @attr {Boolean} [no-submit=false] - If true, input cannot dispatch native submit event on enter key press to closest form
62
- * @attr {String} [pattern=null] - Pattern for input validation. If type is url, default pattern is ^(http|https)://
63
- *
64
- * @cssprop {String} [--gv-input--bdc=var(--gv-theme-neutral-color, #F5F5F5)] - Border color
65
- * @cssprop {Color} [--gv-input--bds=solid] - Border style
66
- * @cssprop {Color} [--gv-input-icon--bgc=var(--gv-theme-neutral-color, #F5F5F5)] - Icon background color
67
- */
68
- export class GvInput extends InputElement(LitElement) {
69
- static get properties() {
70
- return {
71
- ...super.properties,
72
- type: { type: String, reflect: true },
73
- large: { type: Boolean },
74
- medium: { type: Boolean },
75
- small: { type: Boolean },
76
- icon: { type: String },
77
- iconLeft: { type: String, attribute: 'icon-left' },
78
- loading: { type: Boolean },
79
- min: { type: Number },
80
- max: { type: Number },
81
- autocomplete: { type: String },
82
- clipboard: { type: Boolean },
83
- clickable: { type: Boolean },
84
- clearable: { type: Boolean },
85
- noSubmit: { type: Boolean, attribute: 'no-submit' },
86
- pattern: { type: String, reflect: true },
87
- description: { type: String },
88
- _type: { type: String, attribute: false },
89
- };
90
- }
91
-
92
- static get styles() {
93
- return [
94
- ...super.styles,
95
- skeleton,
96
- input,
97
- link,
98
- // language=CSS
99
- css`
100
- .clickable input,
101
- .clickable ::slotted(input) {
102
- cursor: pointer;
103
- }
104
-
105
- .clickable input:hover,
106
- .clickable ::slotted(input:hover) {
107
- box-shadow: 0 1px 3px var(--gv-theme-neutral-color-dark, #bfbfbf);
108
- }
109
-
110
- gv-icon {
111
- --gv-icon--s: 22px;
112
- }
113
-
114
- .copied {
115
- --gv-input--bdc: var(--gv-theme-color-success-light, #81c784);
116
- }
117
-
118
- .copied .box-icon gv-icon {
119
- --gv-icon--c: var(--gv-theme-color-success-dark, #388e3c);
120
- }
121
-
122
- div.box-icon gv-icon.loading,
123
- .loading ::slotted(input) {
124
- animation: spinner 1.6s linear infinite;
125
- --gv-icon--s: 20px;
126
- }
127
-
128
- .loading.small gv-icon {
129
- --gv-icon--s: 18px;
130
- }
131
-
132
- @keyframes spinner {
133
- to {
134
- transform: rotate(360deg);
135
- }
136
- }
137
-
138
- .clipboard input,
139
- .clipboard ::slotted(input) {
140
- cursor: copy;
141
- }
142
-
143
- .clipboard input:read-only:hover,
144
- .clipboard ::slotted(input:read-only:hover) {
145
- cursor: not-allowed;
146
- }
147
-
148
- .clipboard__popover {
149
- --gv-popover--bgc: var(--gv-theme-color-darker, #383e3f);
150
- --gv-popover--c: var(--gv-theme-font-color-light, #ffffff);
151
- --gv-popover--p: 0rem 0.4rem 0rem 0.2rem;
152
- font-size: 11px;
153
- }
154
-
155
- .clipboard__popover-content {
156
- display: flex;
157
- justify-content: center;
158
- align-items: center;
159
- --gv-icon--c: var(--gv-theme-font-color-light, #ffffff);
160
- }
161
- `,
162
- ];
163
- }
164
-
165
- static get shapeSearch() {
166
- return 'general:search';
167
- }
168
-
169
- static get shapeClear() {
170
- return 'code:error';
171
- }
172
-
173
- static get shapeInvisible() {
174
- return 'general:invisible';
175
- }
176
-
177
- static get shapeVisible() {
178
- return 'general:visible';
179
- }
180
-
181
- constructor() {
182
- super();
183
- this._type = 'text';
184
- this._showPassword = false;
185
- this.value = '';
186
- this.autocomplete = 'off';
187
- this.noSubmit = false;
188
- }
189
-
190
- reset() {
191
- this.value = '';
192
- this.getInputElement().blur();
193
- }
194
-
195
- focus() {
196
- this.getInputElement().focus();
197
- }
198
-
199
- getInputElement() {
200
- return this._input || super.getInputElement();
201
- }
202
-
203
- updated(changedProperties) {
204
- if (changedProperties.has('_type')) {
205
- this.getInputElement().type = this._type;
206
- }
207
-
208
- if (changedProperties.has('autocomplete')) {
209
- this.getInputElement().autocomplete = this.autocomplete;
210
- }
211
-
212
- if (changedProperties.has('name') && this.name != null) {
213
- this.getInputElement().name = this.name;
214
- }
215
-
216
- if (changedProperties.has('required')) {
217
- this.getInputElement().required = this.required;
218
- this.getInputElement()['aria-required'] = !!this.required;
219
- if (this.value == null || this.value.trim() === '') {
220
- this.invalid = true;
221
- }
222
- }
223
-
224
- if (this.readonly) {
225
- this.getInputElement().setAttribute('readonly', true);
226
- } else {
227
- this.getInputElement().removeAttribute('readonly');
228
- }
229
-
230
- if (changedProperties.has('label') || changedProperties.has('title')) {
231
- const title = this.title || this.label;
232
- if (title != null) {
233
- this.getInputElement().title = title;
234
- }
235
- }
236
-
237
- if (changedProperties.has('label') && this.label) {
238
- this.getInputElement()['aria-label'] = this.label;
239
- }
240
-
241
- if (changedProperties.has('pattern')) {
242
- this.getInputElement().pattern = this.pattern;
243
- this._regexPattern = new RegExp(this.pattern);
244
- }
245
-
246
- if (changedProperties.has('disabled') || changedProperties.has('skeleton')) {
247
- this.getInputElement().disabled = this.disabled || this.skeleton;
248
- }
249
-
250
- if (changedProperties.has('placeholder') && this.placeholder != null) {
251
- this.getInputElement().placeholder = this.placeholder;
252
- }
253
-
254
- if (changedProperties.has('value')) {
255
- this.getInputElement().value = this.value;
256
- this.updateState(this.value);
257
- }
258
-
259
- if (changedProperties.has('min') && this.min != null) {
260
- this.getInputElement().min = this.min;
261
- }
262
-
263
- if (changedProperties.has('max') && this.max != null) {
264
- this.getInputElement().max = this.max;
265
- }
266
- }
267
-
268
- _setClipboardIcon(shape) {
269
- if (this.icon != null && this.icon !== shapeCopied && this.icon !== shapeClipboard) {
270
- this.iconLeft = shape;
271
- } else {
272
- this.icon = shape;
273
- }
274
- }
275
-
276
- firstUpdated(changedProperties) {
277
- super.firstUpdated(changedProperties);
278
-
279
- this.catchSlot();
280
-
281
- if (this.clipboard) {
282
- import('clipboard-copy').then(
283
- (mod) =>
284
- (this.copy = () => {
285
- const copy = mod.default;
286
- copy(this.value);
287
- this._copied = true;
288
- this._setClipboardIcon(shapeCopied);
289
- setTimeout(() => {
290
- this._copied = false;
291
- this._setClipboardIcon(shapeClipboard);
292
- }, 1000);
293
- }),
294
- );
295
- this._setClipboardIcon(shapeClipboard);
296
-
297
- setTimeout(() => {
298
- const clipboardPopover = this.shadowRoot.querySelector('.clipboard__popover');
299
- clipboardPopover.addEventListener('click', (e) => {
300
- e.preventDefault();
301
- e.stopPropagation();
302
- this.copy(this.value);
303
- });
304
- }, 0);
305
- } else {
306
- const clickableIcon = this.shadowRoot.querySelector('gv-icon.link');
307
- if (clickableIcon) {
308
- clickableIcon.addEventListener('click', this._onIconClick.bind(this));
309
- }
310
- }
311
-
312
- this.getInputElement().id = this._id;
313
-
314
- this.bindInputEvents();
315
- }
316
-
317
- bindInputEvents() {
318
- this.getInputElement().addEventListener('input', this._onInput.bind(this));
319
- this.getInputElement().addEventListener('keyup', this._onKeyUp.bind(this));
320
- this.getInputElement().addEventListener('keypress', this._onKeyPress.bind(this));
321
- }
322
-
323
- catchSlot() {
324
- const defaultInputElement = this.getInputElement();
325
- for (const node of this.childNodes) {
326
- if (node.nodeType === 1) {
327
- const child = node.nodeName.toLowerCase() === 'input' ? node : node.querySelector('input');
328
- if (child) {
329
- this._input = child;
330
- break;
331
- }
332
- }
333
- }
334
- if (this._input) {
335
- defaultInputElement.remove();
336
- }
337
- }
338
-
339
- updateState(value) {
340
- super.updateState(value);
341
- if (this.valid === true && !this.readonly) {
342
- if (this._regexPattern) {
343
- if (value != null && value.trim() !== '') {
344
- const valid = value.match(this._regexPattern);
345
- this.setValidity(valid == null, `field not respect the pattern ${this._regexPattern}`);
346
- }
347
- } else if (this._type === 'number' && value != null && (typeof value === 'number' || value.trim() !== '')) {
348
- const _value = Number(value).valueOf();
349
- if (isNaN(_value)) {
350
- this.setValidity(true, `field is not number`);
351
- } else if (this.min != null && this.min > _value) {
352
- this.setValidity(true, `field is < ${this.min}`);
353
- } else if (this.max != null && this.max < _value) {
354
- this.setValidity(true, `field is > ${this.max}`);
355
- } else {
356
- this.setValidity(false);
357
- }
358
- }
359
- }
360
- }
361
-
362
- _onInput(e) {
363
- this.updateState(e.target.value);
364
- this.value = e.target.value;
365
- dispatchCustomEvent(this, 'input', this.value);
366
- }
367
-
368
- _onKeyPress(e) {
369
- if (this._type === 'number') {
370
- let key;
371
- if (e.type === 'paste') {
372
- key = e.clipboardData.getData('text/plain');
373
- } else {
374
- key = String.fromCharCode(e.keyCode);
375
- }
376
-
377
- let regex = /[0-9]/;
378
- if (this.min == null || this.min < 0) {
379
- regex = /[0-9-]/;
380
- }
381
- if (!regex.test(key)) {
382
- e.preventDefault();
383
- }
384
- }
385
- }
386
-
387
- _onKeyUp(e) {
388
- if (e.keyCode === 13) {
389
- if (!this.noSubmit) {
390
- const form = this.closest('form');
391
- if (form) {
392
- form.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
393
- }
394
- }
395
- dispatchCustomEvent(this, 'submit', this.value);
396
- }
397
- }
398
-
399
- get isClearable() {
400
- return this.clearable && !this.disabled && !this.readonly && !this.loading && this.value != null && this.value !== '';
401
- }
402
-
403
- set type(value) {
404
- if (['text', 'password', 'email', 'search', 'number', 'url'].includes(value)) {
405
- this._type = value;
406
- }
407
- if (this._type === 'url') {
408
- this.pattern = '(https?://.w*)(:\\d*)?\\/?(.*)';
409
- }
410
-
411
- if (this._type === 'email') {
412
- this.pattern =
413
- /^(([^<>()\\[\]\\.,;:\s@"]+(\.[^<>()\\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
414
- }
415
-
416
- if (this._type === 'search' && this.icon == null && this.iconLeft == null) {
417
- this.icon = GvInput.shapeSearch;
418
- this.clearable = true;
419
- }
420
-
421
- if (this._type === 'password') {
422
- this.icon = GvInput.shapeSearch;
423
- }
424
- }
425
-
426
- get type() {
427
- return this._type;
428
- }
429
-
430
- _onIconClick() {
431
- dispatchCustomEvent(this, 'icon-click', this.value);
432
- dispatchCustomEvent(this, 'submit', this.value);
433
- }
434
-
435
- _onIconVisibleClick(e) {
436
- if (this.isPassword) {
437
- e.preventDefault();
438
- e.stopPropagation();
439
- this._showPassword = !this._showPassword;
440
- this._type = this._showPassword ? 'text' : 'password';
441
- }
442
- }
443
-
444
- get isPassword() {
445
- return !this.disabled && (this._type === 'password' || (this._type === 'text' && this._showPassword));
446
- }
447
-
448
- get hasClickableIcon() {
449
- return !this.disabled && !this.readonly && (this.clickable || this._type === 'search' || this.clipboard);
450
- }
451
-
452
- get hasClipboard() {
453
- return !this.disabled && this.clipboard;
454
- }
455
-
456
- clear() {
457
- this.focus();
458
- this.value = '';
459
- dispatchCustomEvent(this, 'clear', this.value);
460
- }
461
-
462
- _renderClearIcon() {
463
- if (this.isClearable) {
464
- return html`<div class="box-icon box-icon-clear">
465
- <gv-icon class="link" shape="code:error" title="${i18n('gv-input.clear')}" @click="${this.clear}"></gv-icon>
466
- </div>`;
467
- }
468
- return '';
469
- }
470
-
471
- _shapePassword() {
472
- return this._showPassword ? 'general:visible' : 'general:hidden';
473
- }
474
-
475
- _renderPasswordIcon() {
476
- if (this.isPassword) {
477
- const shape = this._shapePassword();
478
- const title = this._showPassword ? 'Show' : 'Hide';
479
- return html`<div class="box-icon">
480
- <gv-icon class="link" shape="${shape}" title="${title}" @click="${this._onIconVisibleClick}"></gv-icon>
481
- </div>`;
482
- }
483
- return '';
484
- }
485
-
486
- get hasBackground() {
487
- return !this.loading;
488
- }
489
-
490
- renderIcon() {
491
- let shape = null;
492
- if ((!this.isPassword && this.icon) || this.iconLeft) {
493
- shape = (!this.isPassword && this.icon) || this.iconLeft;
494
- }
495
- if (this.loading) {
496
- shape = 'navigation:waiting';
497
- }
498
-
499
- if (shape) {
500
- const classes = {
501
- 'box-icon': true,
502
- 'box-icon-left': this.iconLeft != null || this.clearable,
503
- 'box-icon-bgc': this.hasBackground,
504
- };
505
-
506
- const iconClasses = {
507
- link: this.hasClickableIcon,
508
- loading: this.loading,
509
- };
510
- let title = '';
511
- if (this._type === 'search') {
512
- title = i18n('gv-input.search');
513
- } else if (this.hasClipboard) {
514
- title = i18n('gv-input.copy');
515
- return html`<div class="${classMap(classes)}">
516
- <gv-popover class="clipboard__popover" event="click" delay="750" .arrow="${false}">
517
- <gv-icon class="${classMap(iconClasses)}" shape="${shape}" title="${title}"></gv-icon>
518
- <div slot="popover" class="clipboard__popover-content">
519
- <gv-icon shape="code:check"></gv-icon>
520
- <div>Copied</div>
521
- </div>
522
- </gv-popover>
523
- </div>`;
524
- } else if (this.placeholder) {
525
- title = this.placeholder;
526
- }
527
- return html`<div class="${classMap(classes)}">
528
- <gv-icon class="${classMap(iconClasses)}" shape="${shape}" title="${title}"></gv-icon>
529
- </div>`;
530
- }
531
- return '';
532
- }
533
-
534
- render() {
535
- const classes = {
536
- 'box-input': true,
537
- skeleton: this.skeleton,
538
- large: this.large,
539
- medium: this.medium || (!this.large && !this.small),
540
- small: this.small,
541
- icon: !!this.icon && !this.clearable,
542
- clearable: this.clearable,
543
- 'icon-left': !!this.iconLeft || (!!this.icon && this.clearable),
544
- clipboard: this.hasClipboard,
545
- required: this.required,
546
- copied: this.hasClipboard && this._copied,
547
- };
548
-
549
- return html`
550
- <div class="${classMap(classes)}">
551
- ${this.renderLabel()}
552
- <input />
553
- <slot></slot>
554
- ${this._renderClearIcon()} ${this.renderIcon()} ${this._renderPasswordIcon()}
555
- </div>
556
- ${this.description != null ? html`<div class="description" .innerHTML="${this.description}"></div>` : ''}
557
- `;
558
- }
559
- }
560
-
561
- window.customElements.define('gv-input', GvInput);
1
+ var t=Object.create?function(t,e,i,s){void 0===s&&(s=i),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]},e=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},i=function(i){if(i&&i.__esModule)return i;var s={};if(null!=i)for(var n in i)"default"!==n&&Object.prototype.hasOwnProperty.call(i,n)&&t(s,i,n);return e(s,i),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvInput=void 0;const s=require("lit/directives/class-map"),n=require("lit"),l=require("../styles/skeleton"),a=require("../styles/input"),o=require("../styles/link"),r=require("../lib/events");require("./gv-icon"),require("../molecules/gv-popover");const h=require("../lib/i18n"),c=require("../mixins/input-element"),p=require("../styles/shapes");class u extends((0,c.InputElement)(n.LitElement)){static get properties(){return{...super.properties,type:{type:String,reflect:!0},large:{type:Boolean},medium:{type:Boolean},small:{type:Boolean},icon:{type:String},iconLeft:{type:String,attribute:"icon-left"},loading:{type:Boolean},min:{type:Number},max:{type:Number},autocomplete:{type:String},clipboard:{type:Boolean},clickable:{type:Boolean},clearable:{type:Boolean},noSubmit:{type:Boolean,attribute:"no-submit"},pattern:{type:String,reflect:!0},description:{type:String},_type:{type:String,attribute:!1}}}static get styles(){return[...super.styles,l.skeleton,a.input,o.link,n.css`.clickable ::slotted(input),.clickable input{cursor:pointer}.clickable ::slotted(input:hover),.clickable input:hover{box-shadow:0 1px 3px var(--gv-theme-neutral-color-dark,#bfbfbf)}gv-icon{--gv-icon--s:22px}.copied{--gv-input--bdc:var(--gv-theme-color-success-light, #81c784)}.copied .box-icon gv-icon{--gv-icon--c:var(--gv-theme-color-success-dark, #388e3c)}.loading ::slotted(input),div.box-icon gv-icon.loading{animation:spinner 1.6s linear infinite;--gv-icon--s:20px}.loading.small gv-icon{--gv-icon--s:18px}@keyframes spinner{to{transform:rotate(360deg)}}.clipboard ::slotted(input),.clipboard input{cursor:copy}.clipboard ::slotted(input:read-only:hover),.clipboard input:read-only:hover{cursor:not-allowed}.clipboard__popover{--gv-popover--bgc:var(--gv-theme-color-darker, #383e3f);--gv-popover--c:var(--gv-theme-font-color-light, #ffffff);--gv-popover--p:0rem 0.4rem 0rem 0.2rem;font-size:11px}.clipboard__popover-content{display:flex;justify-content:center;align-items:center;--gv-icon--c:var(--gv-theme-font-color-light, #ffffff)}`]}static get shapeSearch(){return"general:search"}static get shapeClear(){return"code:error"}static get shapeInvisible(){return"general:invisible"}static get shapeVisible(){return"general:visible"}constructor(){super(),this._type="text",this._showPassword=!1,this.value="",this.autocomplete="off",this.noSubmit=!1}reset(){this.value="",this.getInputElement().blur()}focus(){this.getInputElement().focus()}getInputElement(){return this._input||super.getInputElement()}updated(t){if(t.has("_type")&&(this.getInputElement().type=this._type),t.has("autocomplete")&&(this.getInputElement().autocomplete=this.autocomplete),t.has("name")&&null!=this.name&&(this.getInputElement().name=this.name),t.has("required")&&(this.getInputElement().required=this.required,this.getInputElement()["aria-required"]=!!this.required,null!=this.value&&""!==this.value.trim()||(this.invalid=!0)),this.readonly?this.getInputElement().setAttribute("readonly",!0):this.getInputElement().removeAttribute("readonly"),t.has("label")||t.has("title")){const t=this.title||this.label;null!=t&&(this.getInputElement().title=t)}t.has("label")&&this.label&&(this.getInputElement()["aria-label"]=this.label),t.has("pattern")&&(this.getInputElement().pattern=this.pattern,this._regexPattern=new RegExp(this.pattern)),(t.has("disabled")||t.has("skeleton"))&&(this.getInputElement().disabled=this.disabled||this.skeleton),t.has("placeholder")&&null!=this.placeholder&&(this.getInputElement().placeholder=this.placeholder),t.has("value")&&(this.getInputElement().value=this.value,this.updateState(this.value)),t.has("min")&&null!=this.min&&(this.getInputElement().min=this.min),t.has("max")&&null!=this.max&&(this.getInputElement().max=this.max)}_setClipboardIcon(t){null!=this.icon&&this.icon!==p.shapeCopied&&this.icon!==p.shapeClipboard?this.iconLeft=t:this.icon=t}firstUpdated(t){if(super.firstUpdated(t),this.catchSlot(),this.clipboard)Promise.resolve().then((()=>i(require("clipboard-copy")))).then((t=>this.copy=()=>{(0,t.default)(this.value),this._copied=!0,this._setClipboardIcon(p.shapeCopied),setTimeout((()=>{this._copied=!1,this._setClipboardIcon(p.shapeClipboard)}),1e3)})),this._setClipboardIcon(p.shapeClipboard),setTimeout((()=>{this.shadowRoot.querySelector(".clipboard__popover").addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),this.copy(this.value)}))}),0);else{const t=this.shadowRoot.querySelector("gv-icon.link");t&&t.addEventListener("click",this._onIconClick.bind(this))}this.getInputElement().id=this._id,this.bindInputEvents()}bindInputEvents(){this.getInputElement().addEventListener("input",this._onInput.bind(this)),this.getInputElement().addEventListener("keyup",this._onKeyUp.bind(this)),this.getInputElement().addEventListener("keypress",this._onKeyPress.bind(this))}catchSlot(){const t=this.getInputElement();for(const t of this.childNodes)if(1===t.nodeType){const e="input"===t.nodeName.toLowerCase()?t:t.querySelector("input");if(e){this._input=e;break}}this._input&&t.remove()}updateState(t){if(super.updateState(t),!0===this.valid&&!this.readonly)if(this._regexPattern){if(null!=t&&""!==t.trim()){const e=t.match(this._regexPattern);this.setValidity(null==e,`field not respect the pattern ${this._regexPattern}`)}}else if("number"===this._type&&null!=t&&("number"==typeof t||""!==t.trim())){const e=Number(t).valueOf();isNaN(e)?this.setValidity(!0,"field is not number"):null!=this.min&&this.min>e?this.setValidity(!0,`field is < ${this.min}`):null!=this.max&&this.max<e?this.setValidity(!0,`field is > ${this.max}`):this.setValidity(!1)}}_onInput(t){this.updateState(t.target.value),this.value=t.target.value,(0,r.dispatchCustomEvent)(this,"input",this.value)}_onKeyPress(t){if("number"===this._type){let e;e="paste"===t.type?t.clipboardData.getData("text/plain"):String.fromCharCode(t.keyCode);let i=/[0-9]/;(null==this.min||this.min<0)&&(i=/[0-9-]/),i.test(e)||t.preventDefault()}}_onKeyUp(t){if(13===t.keyCode){if(!this.noSubmit){const t=this.closest("form");t&&t.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}))}(0,r.dispatchCustomEvent)(this,"submit",this.value)}}get isClearable(){return this.clearable&&!this.disabled&&!this.readonly&&!this.loading&&null!=this.value&&""!==this.value}set type(t){["text","password","email","search","number","url"].includes(t)&&(this._type=t),"url"===this._type&&(this.pattern="(https?://.w*)(:\\d*)?\\/?(.*)"),"email"===this._type&&(this.pattern=/^(([^<>()\\[\]\\.,;:\s@"]+(\.[^<>()\\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),"search"===this._type&&null==this.icon&&null==this.iconLeft&&(this.icon=u.shapeSearch,this.clearable=!0),"password"===this._type&&(this.icon=u.shapeSearch)}get type(){return this._type}_onIconClick(){(0,r.dispatchCustomEvent)(this,"icon-click",this.value),(0,r.dispatchCustomEvent)(this,"submit",this.value)}_onIconVisibleClick(t){this.isPassword&&(t.preventDefault(),t.stopPropagation(),this._showPassword=!this._showPassword,this._type=this._showPassword?"text":"password")}get isPassword(){return!this.disabled&&("password"===this._type||"text"===this._type&&this._showPassword)}get hasClickableIcon(){return!this.disabled&&!this.readonly&&(this.clickable||"search"===this._type||this.clipboard)}get hasClipboard(){return!this.disabled&&this.clipboard}clear(){this.focus(),this.value="",(0,r.dispatchCustomEvent)(this,"clear",this.value)}_renderClearIcon(){return this.isClearable?n.html`<div class="box-icon box-icon-clear"><gv-icon class="link" shape="code:error" title="${(0,h.i18n)("gv-input.clear")}" @click="${this.clear}"></gv-icon></div>`:""}_shapePassword(){return this._showPassword?"general:visible":"general:hidden"}_renderPasswordIcon(){if(this.isPassword){const t=this._shapePassword(),e=this._showPassword?"Show":"Hide";return n.html`<div class="box-icon"><gv-icon class="link" shape="${t}" title="${e}" @click="${this._onIconVisibleClick}"></gv-icon></div>`}return""}get hasBackground(){return!this.loading}renderIcon(){let t=null;if((!this.isPassword&&this.icon||this.iconLeft)&&(t=!this.isPassword&&this.icon||this.iconLeft),this.loading&&(t="navigation:waiting"),t){const e={"box-icon":!0,"box-icon-left":null!=this.iconLeft||this.clearable,"box-icon-bgc":this.hasBackground},i={link:this.hasClickableIcon,loading:this.loading};let l="";if("search"===this._type)l=(0,h.i18n)("gv-input.search");else{if(this.hasClipboard)return l=(0,h.i18n)("gv-input.copy"),n.html`<div class="${(0,s.classMap)(e)}"><gv-popover class="clipboard__popover" event="click" delay="750" .arrow="${!1}"><gv-icon class="${(0,s.classMap)(i)}" shape="${t}" title="${l}"></gv-icon><div slot="popover" class="clipboard__popover-content"><gv-icon shape="code:check"></gv-icon><div>Copied</div></div></gv-popover></div>`;this.placeholder&&(l=this.placeholder)}return n.html`<div class="${(0,s.classMap)(e)}"><gv-icon class="${(0,s.classMap)(i)}" shape="${t}" title="${l}"></gv-icon></div>`}return""}render(){const t={"box-input":!0,skeleton:this.skeleton,large:this.large,medium:this.medium||!this.large&&!this.small,small:this.small,icon:!!this.icon&&!this.clearable,clearable:this.clearable,"icon-left":!!this.iconLeft||!!this.icon&&this.clearable,clipboard:this.hasClipboard,required:this.required,copied:this.hasClipboard&&this._copied};return n.html`<div class="${(0,s.classMap)(t)}">${this.renderLabel()} <input><slot></slot>${this._renderClearIcon()} ${this.renderIcon()} ${this._renderPasswordIcon()}</div>${null!=this.description?n.html`<div class="description" .innerHTML="${this.description}"></div>`:""}`}}exports.GvInput=u,window.customElements.define("gv-input",u);
@@ -0,0 +1,67 @@
1
+ /**
2
+ * A link
3
+ *
4
+ * ## Details
5
+ * * has @theme facet
6
+ *
7
+ * @fires gv-link:click - Custom click event from inner link element
8
+ *
9
+ * @slot - The content of the link (text or HTML)
10
+ *
11
+ * @attr {Boolean} active - set if link is active
12
+ * @attr {String} path - link path
13
+ * @attr {String} title - link title
14
+ * @attr {String} target - link target
15
+ * @attr {String} help - help text left between parentheses
16
+ *
17
+ * @cssprop {Length} [--gv-link-a--pv=15px] - Vertical padding for the inner <a> tag
18
+ * @cssprop {Length} [--gv-link-a--ph=15px] - Horizontal padding for the inner <a> tag
19
+ * @cssprop {Color} [--gv-link--c=var(--gv-theme-font-color-dark, #262626)] - Color
20
+ * @cssprop {Color} [--gv-link-active--c=var(--gv-theme-font-color-light, #ffffff)] - Active color
21
+ * @cssprop {Color} [--gv-link--bgc=transparent] - Background color
22
+ * @cssprop {Color} [--gv-link-active--bgc=var(--gv-theme-color-dark, #28444f)] - Active background color
23
+ * @cssprop {Color} [--gv-link-active--bdc=none] - Active border color
24
+ * @cssprop {String} [--gv-link-active--bds=none] - Active border style
25
+ * @cssprop {Length} [--gv-link-active--bdw=none] - Active border width
26
+ * @cssprop {String} [--gv-link--ta=center] - Text align
27
+ * @cssprop {String} [--gv-link--td=none] - Text decoration
28
+ * @cssprop {String} [--gv-link--tsh=none]- Text shadow
29
+ * @cssprop {Length} [--gv-link-icon--s=24px] - Height and icon width
30
+ */
31
+ export class GvLink extends LitElement {
32
+ static get properties(): {
33
+ active: {
34
+ type: BooleanConstructor;
35
+ reflect: boolean;
36
+ };
37
+ icon: {
38
+ type: StringConstructor;
39
+ };
40
+ path: {
41
+ type: StringConstructor;
42
+ };
43
+ title: {
44
+ type: StringConstructor;
45
+ };
46
+ target: {
47
+ type: StringConstructor;
48
+ };
49
+ _title: {
50
+ type: StringConstructor;
51
+ attribute: boolean;
52
+ };
53
+ help: {
54
+ type: StringConstructor;
55
+ };
56
+ skeleton: {
57
+ type: BooleanConstructor;
58
+ };
59
+ small: {
60
+ type: BooleanConstructor;
61
+ };
62
+ };
63
+ static get styles(): import("lit").CSSResult[];
64
+ _onClick(e: any): Promise<void>;
65
+ _title: any;
66
+ }
67
+ import { LitElement } from "lit-element/lit-element";