@pictogrammers/components 0.3.1

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 (379) hide show
  1. package/@types/css.d.ts +4 -0
  2. package/@types/html.d.ts +4 -0
  3. package/README.md +49 -0
  4. package/dist/main.js +3819 -0
  5. package/dist/pgAnnoy.js +116 -0
  6. package/dist/pgAvatar.js +136 -0
  7. package/dist/pgButton.js +116 -0
  8. package/dist/pgButtonGroup.js +116 -0
  9. package/dist/pgButtonLink.js +116 -0
  10. package/dist/pgButtonToggle.js +146 -0
  11. package/dist/pgCard.js +116 -0
  12. package/dist/pgCardUser.js +196 -0
  13. package/dist/pgColor.js +136 -0
  14. package/dist/pgDatabase.js +236 -0
  15. package/dist/pgDropdown.js +686 -0
  16. package/dist/pgGrid.js +126 -0
  17. package/dist/pgHeader.js +116 -0
  18. package/dist/pgIcon.js +116 -0
  19. package/dist/pgInputCheck.js +116 -0
  20. package/dist/pgInputCheckList.js +126 -0
  21. package/dist/pgInputFileLocal.js +116 -0
  22. package/dist/pgInputHexRgb.js +126 -0
  23. package/dist/pgInputRange.js +116 -0
  24. package/dist/pgInputSelect.js +116 -0
  25. package/dist/pgInputText.js +116 -0
  26. package/dist/pgInputTextIcon.js +176 -0
  27. package/dist/pgInputUserSelect.js +116 -0
  28. package/dist/pgListTag.js +136 -0
  29. package/dist/pgMarkdown.js +346 -0
  30. package/dist/pgMenuIcon.js +206 -0
  31. package/dist/pgModalAlert.js +126 -0
  32. package/dist/pgModification.js +396 -0
  33. package/dist/pgNav.js +116 -0
  34. package/dist/pgOverlay.js +96 -0
  35. package/dist/pgPicker.js +116 -0
  36. package/dist/pgPreview.js +116 -0
  37. package/dist/pgScroll.js +266 -0
  38. package/dist/pgSearch.js +146 -0
  39. package/dist/pgTab.js +116 -0
  40. package/dist/pgTabs.js +136 -0
  41. package/dist/pgToast.js +136 -0
  42. package/dist/pgToasts.js +136 -0
  43. package/dist/pgTooltip.js +126 -0
  44. package/index.html +302 -0
  45. package/package.json +25 -0
  46. package/pg/annoy/README.md +18 -0
  47. package/pg/annoy/__examples__/basic/basic.html +8 -0
  48. package/pg/annoy/__examples__/basic/basic.ts +11 -0
  49. package/pg/annoy/annoy.css +238 -0
  50. package/pg/annoy/annoy.html +59 -0
  51. package/pg/annoy/annoy.ts +48 -0
  52. package/pg/annoy/index.ts +3 -0
  53. package/pg/avatar/README.md +23 -0
  54. package/pg/avatar/__examples__/basic/basic.html +6 -0
  55. package/pg/avatar/__examples__/basic/basic.ts +41 -0
  56. package/pg/avatar/__examples__/basic/constants.ts +1 -0
  57. package/pg/avatar/avatar.css +45 -0
  58. package/pg/avatar/avatar.html +8 -0
  59. package/pg/avatar/avatar.spec.ts +51 -0
  60. package/pg/avatar/avatar.ts +37 -0
  61. package/pg/avatar/index.ts +3 -0
  62. package/pg/button/README.md +51 -0
  63. package/pg/button/__examples__/basic/basic.html +11 -0
  64. package/pg/button/__examples__/basic/basic.ts +11 -0
  65. package/pg/button/__examples__/states/states.html +8 -0
  66. package/pg/button/__examples__/states/states.ts +20 -0
  67. package/pg/button/button.css +91 -0
  68. package/pg/button/button.html +3 -0
  69. package/pg/button/button.ts +45 -0
  70. package/pg/button/index.ts +3 -0
  71. package/pg/buttonGroup/README.md +28 -0
  72. package/pg/buttonGroup/__examples__/basic/basic.html +12 -0
  73. package/pg/buttonGroup/__examples__/basic/basic.ts +11 -0
  74. package/pg/buttonGroup/buttonGroup.css +4 -0
  75. package/pg/buttonGroup/buttonGroup.html +1 -0
  76. package/pg/buttonGroup/buttonGroup.spec.ts +30 -0
  77. package/pg/buttonGroup/buttonGroup.ts +50 -0
  78. package/pg/buttonGroup/index.ts +3 -0
  79. package/pg/buttonLink/README.md +51 -0
  80. package/pg/buttonLink/__examples__/basic/basic.html +17 -0
  81. package/pg/buttonLink/__examples__/basic/basic.ts +11 -0
  82. package/pg/buttonLink/buttonLink.css +91 -0
  83. package/pg/buttonLink/buttonLink.html +3 -0
  84. package/pg/buttonLink/buttonLink.ts +46 -0
  85. package/pg/buttonLink/index.ts +3 -0
  86. package/pg/buttonToggle/README.md +54 -0
  87. package/pg/buttonToggle/__examples__/basic/basic.html +10 -0
  88. package/pg/buttonToggle/__examples__/basic/basic.ts +23 -0
  89. package/pg/buttonToggle/buttonToggle.css +8 -0
  90. package/pg/buttonToggle/buttonToggle.html +4 -0
  91. package/pg/buttonToggle/buttonToggle.ts +44 -0
  92. package/pg/buttonToggle/index.ts +3 -0
  93. package/pg/card/README.md +21 -0
  94. package/pg/card/__examples__/basic/basic.html +5 -0
  95. package/pg/card/__examples__/basic/basic.ts +11 -0
  96. package/pg/card/card.css +11 -0
  97. package/pg/card/card.html +3 -0
  98. package/pg/card/card.spec.ts +30 -0
  99. package/pg/card/card.ts +13 -0
  100. package/pg/card/index.ts +3 -0
  101. package/pg/cardUser/README.md +22 -0
  102. package/pg/cardUser/__examples__/basic/basic.html +3 -0
  103. package/pg/cardUser/__examples__/basic/basic.ts +30 -0
  104. package/pg/cardUser/__examples__/basic/constants.ts +1 -0
  105. package/pg/cardUser/cardUser.css +67 -0
  106. package/pg/cardUser/cardUser.html +23 -0
  107. package/pg/cardUser/cardUser.spec.ts +46 -0
  108. package/pg/cardUser/cardUser.ts +53 -0
  109. package/pg/cardUser/index.ts +3 -0
  110. package/pg/color/README.md +13 -0
  111. package/pg/color/__examples__/basic/basic.html +4 -0
  112. package/pg/color/__examples__/basic/basic.ts +20 -0
  113. package/pg/color/color.css +21 -0
  114. package/pg/color/color.html +1 -0
  115. package/pg/color/color.ts +97 -0
  116. package/pg/color/constants.ts +357 -0
  117. package/pg/color/index.ts +3 -0
  118. package/pg/color/utils.ts +27 -0
  119. package/pg/database/README.md +28 -0
  120. package/pg/database/__examples__/basic/basic.html +9 -0
  121. package/pg/database/__examples__/basic/basic.ts +37 -0
  122. package/pg/database/database.css +0 -0
  123. package/pg/database/database.html +0 -0
  124. package/pg/database/database.ts +42 -0
  125. package/pg/database/index.ts +3 -0
  126. package/pg/dropdown/README.md +13 -0
  127. package/pg/dropdown/__examples__/basic/basic.html +14 -0
  128. package/pg/dropdown/__examples__/basic/basic.ts +11 -0
  129. package/pg/dropdown/dropdown.css +46 -0
  130. package/pg/dropdown/dropdown.html +5 -0
  131. package/pg/dropdown/dropdown.ts +60 -0
  132. package/pg/dropdown/index.ts +3 -0
  133. package/pg/grid/README.md +97 -0
  134. package/pg/grid/__examples__/basic/basic.html +29 -0
  135. package/pg/grid/__examples__/basic/basic.ts +139 -0
  136. package/pg/grid/grid.css +68 -0
  137. package/pg/grid/grid.html +6 -0
  138. package/pg/grid/grid.spec.ts +66 -0
  139. package/pg/grid/grid.ts +417 -0
  140. package/pg/grid/index.ts +3 -0
  141. package/pg/header/README.md +23 -0
  142. package/pg/header/__examples__/basic/basic.html +8 -0
  143. package/pg/header/__examples__/basic/basic.ts +11 -0
  144. package/pg/header/header.css +42 -0
  145. package/pg/header/header.html +15 -0
  146. package/pg/header/header.ts +28 -0
  147. package/pg/header/index.ts +3 -0
  148. package/pg/icon/README.md +26 -0
  149. package/pg/icon/__examples__/basic/basic.html +16 -0
  150. package/pg/icon/__examples__/basic/basic.ts +34 -0
  151. package/pg/icon/__examples__/basic/constants.ts +2 -0
  152. package/pg/icon/icon.css +9 -0
  153. package/pg/icon/icon.html +3 -0
  154. package/pg/icon/icon.spec.ts +46 -0
  155. package/pg/icon/icon.ts +23 -0
  156. package/pg/icon/index.ts +3 -0
  157. package/pg/inputCheck/README.md +32 -0
  158. package/pg/inputCheck/__examples__/basic/basic.html +8 -0
  159. package/pg/inputCheck/__examples__/basic/basic.ts +23 -0
  160. package/pg/inputCheck/index.ts +3 -0
  161. package/pg/inputCheck/inputCheck.css +45 -0
  162. package/pg/inputCheck/inputCheck.html +6 -0
  163. package/pg/inputCheck/inputCheck.ts +42 -0
  164. package/pg/inputCheckList/README.md +35 -0
  165. package/pg/inputCheckList/__examples__/basic/basic.html +4 -0
  166. package/pg/inputCheckList/__examples__/basic/basic.ts +31 -0
  167. package/pg/inputCheckList/index.ts +3 -0
  168. package/pg/inputCheckList/inputCheckList.css +70 -0
  169. package/pg/inputCheckList/inputCheckList.html +1 -0
  170. package/pg/inputCheckList/inputCheckList.ts +103 -0
  171. package/pg/inputCheckList/templates/option.html +8 -0
  172. package/pg/inputFileLocal/README.md +30 -0
  173. package/pg/inputFileLocal/__examples__/basic/basic.html +4 -0
  174. package/pg/inputFileLocal/__examples__/basic/basic.ts +23 -0
  175. package/pg/inputFileLocal/index.ts +3 -0
  176. package/pg/inputFileLocal/inputFileLocal.css +80 -0
  177. package/pg/inputFileLocal/inputFileLocal.html +5 -0
  178. package/pg/inputFileLocal/inputFileLocal.ts +82 -0
  179. package/pg/inputHexRgb/README.md +15 -0
  180. package/pg/inputHexRgb/__examples__/basic/basic.html +4 -0
  181. package/pg/inputHexRgb/__examples__/basic/basic.ts +23 -0
  182. package/pg/inputHexRgb/index.ts +3 -0
  183. package/pg/inputHexRgb/inputHexRgb.css +96 -0
  184. package/pg/inputHexRgb/inputHexRgb.html +9 -0
  185. package/pg/inputHexRgb/inputHexRgb.ts +79 -0
  186. package/pg/inputHexRgb/utils.ts +27 -0
  187. package/pg/inputRange/README.md +18 -0
  188. package/pg/inputRange/__examples__/basic/basic.html +9 -0
  189. package/pg/inputRange/__examples__/basic/basic.ts +30 -0
  190. package/pg/inputRange/index.ts +3 -0
  191. package/pg/inputRange/inputRange.css +0 -0
  192. package/pg/inputRange/inputRange.html +1 -0
  193. package/pg/inputRange/inputRange.ts +53 -0
  194. package/pg/inputSelect/README.md +25 -0
  195. package/pg/inputSelect/__examples__/basic/basic.html +6 -0
  196. package/pg/inputSelect/__examples__/basic/basic.ts +30 -0
  197. package/pg/inputSelect/index.ts +3 -0
  198. package/pg/inputSelect/inputSelect.css +36 -0
  199. package/pg/inputSelect/inputSelect.html +4 -0
  200. package/pg/inputSelect/inputSelect.ts +57 -0
  201. package/pg/inputText/README.md +27 -0
  202. package/pg/inputText/__examples__/basic/basic.html +9 -0
  203. package/pg/inputText/__examples__/basic/basic.ts +30 -0
  204. package/pg/inputText/index.ts +3 -0
  205. package/pg/inputText/inputText.css +20 -0
  206. package/pg/inputText/inputText.html +1 -0
  207. package/pg/inputText/inputText.spec.ts +59 -0
  208. package/pg/inputText/inputText.ts +59 -0
  209. package/pg/inputTextIcon/README.md +26 -0
  210. package/pg/inputTextIcon/index.ts +3 -0
  211. package/pg/inputTextIcon/inputTextIcon.css +24 -0
  212. package/pg/inputTextIcon/inputTextIcon.html +4 -0
  213. package/pg/inputTextIcon/inputTextIcon.spec.ts +44 -0
  214. package/pg/inputTextIcon/inputTextIcon.ts +26 -0
  215. package/pg/inputUserSelect/README.md +31 -0
  216. package/pg/inputUserSelect/__examples__/basic/basic.html +4 -0
  217. package/pg/inputUserSelect/__examples__/basic/basic.ts +25 -0
  218. package/pg/inputUserSelect/__examples__/basic/constants.ts +33 -0
  219. package/pg/inputUserSelect/index.ts +3 -0
  220. package/pg/inputUserSelect/inputUserSelect.css +174 -0
  221. package/pg/inputUserSelect/inputUserSelect.html +18 -0
  222. package/pg/inputUserSelect/inputUserSelect.ts +266 -0
  223. package/pg/listTag/README.md +26 -0
  224. package/pg/listTag/__examples__/basic/basic.html +16 -0
  225. package/pg/listTag/__examples__/basic/basic.ts +53 -0
  226. package/pg/listTag/__examples__/basic/constants.ts +22 -0
  227. package/pg/listTag/index.ts +3 -0
  228. package/pg/listTag/listTag.css +9 -0
  229. package/pg/listTag/listTag.html +1 -0
  230. package/pg/listTag/listTag.ts +48 -0
  231. package/pg/listTag/partials/tag.html +3 -0
  232. package/pg/markdown/README.md +13 -0
  233. package/pg/markdown/__examples__/basic/basic.html +3 -0
  234. package/pg/markdown/__examples__/basic/basic.ts +51 -0
  235. package/pg/markdown/__examples__/basic/constants.ts +129 -0
  236. package/pg/markdown/index.ts +5 -0
  237. package/pg/markdown/markdown.css +760 -0
  238. package/pg/markdown/markdown.html +1 -0
  239. package/pg/markdown/markdown.md +123 -0
  240. package/pg/markdown/markdown.spec.ts +87 -0
  241. package/pg/markdown/markdown.ts +381 -0
  242. package/pg/markdown/markdownReplace.ts +7 -0
  243. package/pg/menuIcon/README.md +13 -0
  244. package/pg/menuIcon/__examples__/basic/basic.html +3 -0
  245. package/pg/menuIcon/__examples__/basic/basic.ts +15 -0
  246. package/pg/menuIcon/index.ts +3 -0
  247. package/pg/menuIcon/menuIcon.css +168 -0
  248. package/pg/menuIcon/menuIcon.html +64 -0
  249. package/pg/menuIcon/menuIcon.ts +271 -0
  250. package/pg/modalAlert/README.md +17 -0
  251. package/pg/modalAlert/__examples__/basic/basic.html +4 -0
  252. package/pg/modalAlert/__examples__/basic/basic.ts +27 -0
  253. package/pg/modalAlert/index.ts +3 -0
  254. package/pg/modalAlert/modalAlert.css +43 -0
  255. package/pg/modalAlert/modalAlert.html +22 -0
  256. package/pg/modalAlert/modalAlert.ts +45 -0
  257. package/pg/modification/README.md +34 -0
  258. package/pg/modification/__examples__/basic/basic.html +8 -0
  259. package/pg/modification/__examples__/basic/basic.ts +63 -0
  260. package/pg/modification/__examples__/basic/constants.ts +416 -0
  261. package/pg/modification/index.ts +3 -0
  262. package/pg/modification/modification.css +311 -0
  263. package/pg/modification/modification.html +1 -0
  264. package/pg/modification/modification.spec.ts +33 -0
  265. package/pg/modification/modification.ts +201 -0
  266. package/pg/modification/type/date.html +1 -0
  267. package/pg/modification/type/iconAliasCreated.html +13 -0
  268. package/pg/modification/type/iconAliasDeleted.html +13 -0
  269. package/pg/modification/type/iconAuthorModified.html +13 -0
  270. package/pg/modification/type/iconCreated.html +13 -0
  271. package/pg/modification/type/iconDeleted.html +13 -0
  272. package/pg/modification/type/iconDeprecated.html +13 -0
  273. package/pg/modification/type/iconDescriptionModified.html +10 -0
  274. package/pg/modification/type/iconModified.html +14 -0
  275. package/pg/modification/type/iconRenamed.html +13 -0
  276. package/pg/modification/type/iconTagCreated.html +13 -0
  277. package/pg/modification/type/iconTagDeleted.html +13 -0
  278. package/pg/modification/type/news.html +5 -0
  279. package/pg/nav/README.md +16 -0
  280. package/pg/nav/__examples__/basic/basic.html +5 -0
  281. package/pg/nav/__examples__/basic/basic.ts +11 -0
  282. package/pg/nav/index.ts +3 -0
  283. package/pg/nav/nav.css +14 -0
  284. package/pg/nav/nav.html +16 -0
  285. package/pg/nav/nav.ts +21 -0
  286. package/pg/overlay/README.md +37 -0
  287. package/pg/overlay/__examples__/basic/basic.css +3 -0
  288. package/pg/overlay/__examples__/basic/basic.html +3 -0
  289. package/pg/overlay/__examples__/basic/basic.ts +13 -0
  290. package/pg/overlay/index.ts +3 -0
  291. package/pg/overlay/overlay.ts +26 -0
  292. package/pg/picker/README.md +13 -0
  293. package/pg/picker/index.ts +3 -0
  294. package/pg/picker/picker.css +56 -0
  295. package/pg/picker/picker.html +8 -0
  296. package/pg/picker/picker.ts +66 -0
  297. package/pg/preview/README.md +19 -0
  298. package/pg/preview/__examples__/basic/basic.html +11 -0
  299. package/pg/preview/__examples__/basic/basic.ts +22 -0
  300. package/pg/preview/index.ts +3 -0
  301. package/pg/preview/preview.css +34 -0
  302. package/pg/preview/preview.html +5 -0
  303. package/pg/preview/preview.ts +38 -0
  304. package/pg/scroll/README.md +42 -0
  305. package/pg/scroll/__examples__/basic/basic.css +4 -0
  306. package/pg/scroll/__examples__/basic/basic.html +11 -0
  307. package/pg/scroll/__examples__/basic/basic.ts +88 -0
  308. package/pg/scroll/index.ts +3 -0
  309. package/pg/scroll/scroll.css +7 -0
  310. package/pg/scroll/scroll.html +3 -0
  311. package/pg/scroll/scroll.ts +158 -0
  312. package/pg/search/README.md +59 -0
  313. package/pg/search/__examples__/basic/basic.html +3 -0
  314. package/pg/search/__examples__/basic/basic.ts +29 -0
  315. package/pg/search/__examples__/basic/constants.ts +3 -0
  316. package/pg/search/index.ts +3 -0
  317. package/pg/search/search.css +188 -0
  318. package/pg/search/search.html +18 -0
  319. package/pg/search/search.ts +252 -0
  320. package/pg/search/utils.ts +12 -0
  321. package/pg/shared/README.md +28 -0
  322. package/pg/shared/copy.ts +25 -0
  323. package/pg/shared/database.ts +35 -0
  324. package/pg/shared/databaseService.ts +230 -0
  325. package/pg/shared/debounce.ts +12 -0
  326. package/pg/shared/enums/modificationType.ts +19 -0
  327. package/pg/shared/filter.ts +14 -0
  328. package/pg/shared/http.ts +83 -0
  329. package/pg/shared/iconFilter.spec.ts +61 -0
  330. package/pg/shared/iconFilter.ts +71 -0
  331. package/pg/shared/list.ts +34 -0
  332. package/pg/shared/models/alias.ts +40 -0
  333. package/pg/shared/models/font.ts +31 -0
  334. package/pg/shared/models/fontIcon.ts +25 -0
  335. package/pg/shared/models/fontVersion.ts +22 -0
  336. package/pg/shared/models/icon.ts +97 -0
  337. package/pg/shared/models/modification.ts +45 -0
  338. package/pg/shared/models/style.ts +12 -0
  339. package/pg/shared/models/tag.ts +37 -0
  340. package/pg/shared/models/user.ts +35 -0
  341. package/pg/shared/models/version.ts +20 -0
  342. package/pg/shared/removeDiacritics.ts +94 -0
  343. package/pg/shared/toast.ts +47 -0
  344. package/pg/shared/uuid.ts +6 -0
  345. package/pg/tab/README.md +18 -0
  346. package/pg/tab/index.ts +3 -0
  347. package/pg/tab/tab.css +13 -0
  348. package/pg/tab/tab.html +3 -0
  349. package/pg/tab/tab.ts +51 -0
  350. package/pg/tabs/README.md +31 -0
  351. package/pg/tabs/__examples__/basic/basic.html +13 -0
  352. package/pg/tabs/__examples__/basic/basic.ts +11 -0
  353. package/pg/tabs/index.ts +3 -0
  354. package/pg/tabs/partials/tab.html +3 -0
  355. package/pg/tabs/tabs.css +69 -0
  356. package/pg/tabs/tabs.html +4 -0
  357. package/pg/tabs/tabs.ts +102 -0
  358. package/pg/toast/README.md +13 -0
  359. package/pg/toast/index.ts +3 -0
  360. package/pg/toast/toast.css +112 -0
  361. package/pg/toast/toast.html +13 -0
  362. package/pg/toast/toast.ts +39 -0
  363. package/pg/toasts/README.md +37 -0
  364. package/pg/toasts/__examples__/basic/basic.html +11 -0
  365. package/pg/toasts/__examples__/basic/basic.ts +86 -0
  366. package/pg/toasts/index.ts +3 -0
  367. package/pg/toasts/toasts.css +8 -0
  368. package/pg/toasts/toasts.html +1 -0
  369. package/pg/toasts/toasts.ts +51 -0
  370. package/pg/tooltip/README.md +51 -0
  371. package/pg/tooltip/__examples__/basic/basic.css +38 -0
  372. package/pg/tooltip/__examples__/basic/basic.html +21 -0
  373. package/pg/tooltip/__examples__/basic/basic.ts +55 -0
  374. package/pg/tooltip/addTooltip.ts +31 -0
  375. package/pg/tooltip/index.ts +20 -0
  376. package/pg/tooltip/position.ts +15 -0
  377. package/pg/tooltip/tooltip.css +36 -0
  378. package/pg/tooltip/tooltip.html +4 -0
  379. package/pg/tooltip/tooltip.ts +170 -0
@@ -0,0 +1,266 @@
1
+ import { Component, Prop, Part } from '@pictogrammers/element';
2
+
3
+ import template from './inputUserSelect.html';
4
+ import style from './inputUserSelect.css';
5
+ import { User } from '../shared/models/user';
6
+ import PgIcon from '../icon/icon';
7
+
8
+ function createIcon(d: string, className: string) {
9
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
10
+ svg.setAttribute('viewBox', '0 0 24 24');
11
+ const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
12
+ path.setAttribute('d', d);
13
+ path.setAttribute('fill', 'currentColor');
14
+ svg.appendChild(path);
15
+ svg.classList.add(className);
16
+ return svg;
17
+ }
18
+
19
+ const KEY = {
20
+ ArrowUp: 'ArrowUp',
21
+ ArrowRight: 'ArrowRight',
22
+ ArrowDown: 'ArrowDown',
23
+ ArrowLeft: 'ArrowLeft',
24
+ Escape: 'Escape',
25
+ Tab: 'Tab'
26
+ };
27
+
28
+ const mdiGithub = 'M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z';
29
+ const mdiShape = 'M11,13.5V21.5H3V13.5H11M12,2L17.5,11H6.5L12,2M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13Z';
30
+
31
+ @Component({
32
+ selector: 'pg-input-user-select',
33
+ style,
34
+ template
35
+ })
36
+ export default class PgInputUserSelect extends HTMLElement {
37
+ @Prop() options: User[] | null = null;
38
+ @Prop() value: User | null = null;
39
+ @Prop() clear: boolean = false;
40
+ @Prop() noDataText: string = 'Empty Users List';
41
+ @Prop() noSelectionText: string = 'Select a User';
42
+ @Prop() name: string = '';
43
+
44
+ @Part() $select: HTMLButtonElement;
45
+ @Part() $selectedAvatar: HTMLImageElement;
46
+ @Part() $selectedName: HTMLSpanElement;
47
+ @Part() $githubIcon: PgIcon;
48
+ @Part() $selectedGithub: HTMLSpanElement;
49
+ @Part() $countIcon: PgIcon;
50
+ @Part() $selectedCount: HTMLSpanElement;
51
+ @Part() $dropdown: HTMLDivElement;
52
+ @Part() $loading: SVGElement;
53
+ @Part() $loadingText: HTMLSpanElement;
54
+ @Part() $noData: HTMLSpanElement;
55
+ @Part() $noSelection: HTMLSpanElement;
56
+
57
+ connectedCallback() {
58
+ this.$select.addEventListener('click', this.handleClick.bind(this));
59
+ this.addEventListener('keydown', this.handleKeys.bind(this));
60
+ }
61
+
62
+ isOpen = false;
63
+ handleCloseBind;
64
+ optionsElements: HTMLButtonElement[] = [];
65
+
66
+ close() {
67
+ this.isOpen = false;
68
+ this.$dropdown.classList.remove('open');
69
+ document.removeEventListener('mousedown', this.handleCloseBind);
70
+ }
71
+
72
+ handleClose(e) {
73
+ // This is wrong
74
+ const target = e.target as PgInputUserSelect;
75
+ if (target.nodeName === this.nodeName && target.isOpen) {
76
+ // Do nothing!
77
+ } else {
78
+ this.close();
79
+ }
80
+ }
81
+
82
+ handleClick() {
83
+ this.isOpen = !this.isOpen;
84
+ this.$dropdown.classList.toggle('open', this.isOpen);
85
+ this.handleCloseBind = this.handleClose.bind(this);
86
+ document.addEventListener('mousedown', this.handleCloseBind);
87
+ this.focusSelected();
88
+ }
89
+
90
+ focusSelected() {
91
+ const find = this.options?.findIndex((value) => value === this.value);
92
+ if (find && find !== -1) {
93
+ this.optionsElements[find].focus();
94
+ this.index = find;
95
+ } else if (this.optionsElements.length) {
96
+ this.optionsElements[0].focus();
97
+ }
98
+ }
99
+
100
+ handleSelect(e) {
101
+ console.log('clicked');
102
+ const { id } = e.currentTarget.dataset;
103
+ const selected = this.options?.find(d => d.id === id);
104
+ this.value = selected || null;
105
+ this.dispatchEvent(
106
+ new CustomEvent('change', {
107
+ detail: {
108
+ value: this.value,
109
+ name: this.name
110
+ }
111
+ })
112
+ );
113
+ this.close();
114
+ }
115
+
116
+ loadingMode() {
117
+ this.$selectedAvatar.style.display = 'none';
118
+ this.$selectedName.style.display = 'none';
119
+ this.$githubIcon.style.display = 'none';
120
+ this.$selectedGithub.style.display = 'none';
121
+ this.$countIcon.style.display = 'none';
122
+ this.$selectedCount.style.display = 'none';
123
+ this.$noData.style.display = 'none';
124
+ this.$noSelection.style.display = 'none';
125
+ this.$loading.style.display = 'flex';
126
+ this.$loadingText.style.display = 'initial';
127
+ this.$select.disabled = true;
128
+ }
129
+
130
+ noDataMode() {
131
+ this.$selectedAvatar.style.display = 'none';
132
+ this.$selectedName.style.display = 'none';
133
+ this.$githubIcon.style.display = 'none';
134
+ this.$selectedGithub.style.display = 'none';
135
+ this.$countIcon.style.display = 'none';
136
+ this.$selectedCount.style.display = 'none';
137
+ this.$noData.style.display = 'initial';
138
+ this.$noSelection.style.display = 'none';
139
+ this.$loading.style.display = 'none';
140
+ this.$loadingText.style.display = 'none';
141
+ this.$select.disabled = true;
142
+ }
143
+
144
+ noSelectionMode() {
145
+ this.$selectedAvatar.style.display = 'none';
146
+ this.$selectedName.style.display = 'none';
147
+ this.$githubIcon.style.display = 'none';
148
+ this.$selectedGithub.style.display = 'none';
149
+ this.$countIcon.style.display = 'none';
150
+ this.$selectedCount.style.display = 'none';
151
+ this.$noData.style.display = 'none';
152
+ this.$noSelection.style.display = 'initial';
153
+ this.$loading.style.display = 'none';
154
+ this.$loadingText.style.display = 'none';
155
+ this.$select.disabled = false;
156
+ }
157
+
158
+ selectMode() {
159
+ this.$selectedAvatar.style.display = 'initial';
160
+ this.$selectedName.style.display = 'initial';
161
+ this.$githubIcon.style.display = 'initial';
162
+ this.$selectedGithub.style.display = 'initial';
163
+ this.$countIcon.style.display = 'initial';
164
+ this.$selectedCount.style.display = 'initial';
165
+ this.$noData.style.display = 'none';
166
+ this.$noSelection.style.display = 'none';
167
+ this.$loading.style.display = 'none';
168
+ this.$loadingText.style.display = 'none';
169
+ this.$select.disabled = false;
170
+ }
171
+
172
+ render(changes) {
173
+ if (changes.options) {
174
+ if (this.options === null) {
175
+ this.loadingMode();
176
+ } else if (this.options.length === 0) {
177
+ this.noDataMode();
178
+ } else {
179
+ this.selectMode();
180
+ this.calculateMinWidth();
181
+ this.optionsElements = this.options.map(o => {
182
+ const button = document.createElement('button');
183
+ const img = document.createElement('img');
184
+ img.src = `${o.base64}`;
185
+ img.classList.add('avatar');
186
+ button.appendChild(img);
187
+ const spanName = document.createElement('span');
188
+ spanName.innerText = `${o.name}`;
189
+ spanName.classList.add('name');
190
+ button.appendChild(spanName);
191
+ const spanGitHub = document.createElement('span');
192
+ spanGitHub.innerText = `${o.github}`;
193
+ spanGitHub.classList.add('github');
194
+ button.appendChild(spanGitHub);
195
+ const spanIconCount = document.createElement('span');
196
+ spanIconCount.innerText = `${o.iconCount}`;
197
+ spanIconCount.classList.add('iconCount');
198
+ button.appendChild(spanIconCount);
199
+ button.dataset.id = `${o.id}`;
200
+ button.appendChild(createIcon(mdiGithub, 'githubIcon'));
201
+ button.appendChild(createIcon(mdiShape, 'countIcon'));
202
+ button.addEventListener('click', this.handleSelect.bind(this));
203
+ this.$dropdown.appendChild(button);
204
+ return button;
205
+ });
206
+ if (this.value === null) {
207
+ this.noSelectionMode();
208
+ }
209
+ }
210
+ //if (this.$select.value !== this.value) {
211
+ // this.$select.value = this.value;
212
+ //}
213
+ }
214
+ if (changes.value) {
215
+ if (changes.value && this.value) {
216
+ this.$selectedAvatar.src = this.value.base64 || '';
217
+ this.$selectedCount.innerText = `${this.value.iconCount}`;
218
+ this.$selectedName.innerText = `${this.value.name}`;
219
+ this.$selectedGithub.innerText = `${this.value.github}`;
220
+ this.selectMode();
221
+ }
222
+ }
223
+ if (changes.noDataText) {
224
+ this.$noData.innerText = this.noDataText;
225
+ }
226
+ if (changes.noSelectionText) {
227
+ this.$noSelection.innerText = this.noSelectionText;
228
+ }
229
+ }
230
+
231
+ calculateMinWidth() {
232
+ const { width } = this.$select.getBoundingClientRect();
233
+ this.$dropdown.style.minWidth = `${width - 2}px`;
234
+ }
235
+
236
+ index = -1;
237
+ handleKeys(e: KeyboardEvent) {
238
+ const items = this.optionsElements;
239
+ let newIndex = this.index;
240
+ switch (e.key) {
241
+ case KEY.ArrowUp:
242
+ if (newIndex === 0) {
243
+ newIndex = items.length - 1;
244
+ } else if (newIndex >= 0) {
245
+ newIndex -= 1;
246
+ }
247
+ break;
248
+ case KEY.ArrowDown:
249
+ if (newIndex < items.length - 1) {
250
+ newIndex += 1;
251
+ } else if (newIndex === items.length - 1) {
252
+ newIndex = 0;
253
+ }
254
+ break;
255
+ case KEY.Tab:
256
+ case KEY.Escape:
257
+ this.close();
258
+ break;
259
+ }
260
+ if (newIndex != this.index) {
261
+ this.index = newIndex;
262
+ items[newIndex].focus();
263
+ e.preventDefault();
264
+ }
265
+ }
266
+ }
@@ -0,0 +1,26 @@
1
+ # `<pg-icon>`
2
+
3
+ The `pg-icon` component allows a standard way to render [MaterialDesignIcons.com](https://materialdesignicons.com) icons.
4
+
5
+ ```typescript
6
+ import '@pictogrammers/components/pg/icon';
7
+ import PgIcon from '@pictogrammers/components/pg/icon';
8
+ ```
9
+
10
+ ```html
11
+ <pg-icon path="..."></pg-icon>
12
+ ```
13
+
14
+ ## Attributes
15
+
16
+ | Attributes | Tested | Description |
17
+ | ---------- | -------- | ----------- |
18
+ | path | &#x2705; | Set path data |
19
+
20
+ ## CSS Variables
21
+
22
+ | CSS Variables | Default | Description |
23
+ | ------------------- | --------- | ----------- |
24
+ | `--pg-icon-color` | `#453C4F` | Color |
25
+ | `--pg-icon-width` | `1.5rem` | Width |
26
+ | `--pg-icon-height` | `1.5rem` | Height |
@@ -0,0 +1,16 @@
1
+ <button part="buttonClear">
2
+ Clear Tags
3
+ </button>
4
+ <button part="buttonAdd">
5
+ Add Tag
6
+ </button>
7
+ <button part="buttonRemove">
8
+ Remove Tag
9
+ </button>
10
+ <button part="buttonEdit">
11
+ Toggle Edit
12
+ </button>
13
+
14
+ <div class="example">
15
+ <pg-list-tag part="tags"></pg-list-tag>
16
+ </div>
@@ -0,0 +1,53 @@
1
+ import { Component, Part, Prop } from '@pictogrammers/element';
2
+ import PgListTag from '../../listTag';
3
+ import { tags } from './constants';
4
+
5
+ import template from './basic.html';
6
+ import { Tag } from '../../../shared/models/tag';
7
+
8
+ @Component({
9
+ selector: 'x-pg-list-tag-basic',
10
+ template
11
+ })
12
+ export default class XPgIconBasic extends HTMLElement {
13
+ @Part() $tags: PgListTag;
14
+ @Part() $buttonClear: HTMLButtonElement;
15
+ @Part() $buttonAdd: HTMLButtonElement;
16
+ @Part() $buttonRemove: HTMLButtonElement;
17
+ @Part() $buttonEdit: HTMLButtonElement;
18
+
19
+ connectedCallback() {
20
+ this.$buttonClear.addEventListener('click', this.handleClear.bind(this));
21
+ this.$buttonAdd.addEventListener('click', this.handleAdd.bind(this));
22
+ this.$buttonRemove.addEventListener('click', this.handleRemove.bind(this));
23
+ this.$buttonEdit.addEventListener('click', this.handleEdit.bind(this));
24
+ this.$tags.items = tags;
25
+ }
26
+
27
+ handleClear() {
28
+ this.$tags.items = [];
29
+ }
30
+
31
+ uuid = 4;
32
+
33
+ handleAdd() {
34
+ this.$tags.items = [
35
+ ...this.$tags.items,
36
+ new Tag().from({
37
+ id: `uuid${this.uuid++}`,
38
+ count: 42,
39
+ name: 'Foo Bar',
40
+ url: 'foo-bar'
41
+ })
42
+ ];
43
+ }
44
+
45
+ handleRemove() {
46
+ this.$tags.items = this.$tags.items.slice(0, this.$tags.items.length - 1);
47
+ }
48
+
49
+ handleEdit() {
50
+ this.$tags.edit = !this.$tags.edit;
51
+ }
52
+
53
+ }
@@ -0,0 +1,22 @@
1
+ import { Tag } from "../../../shared/models/tag";
2
+
3
+ export const tags = [
4
+ new Tag().from({
5
+ id: 'uuid1',
6
+ name: 'test 1',
7
+ url: 'test-1',
8
+ count: 42
9
+ }),
10
+ new Tag().from({
11
+ id: 'uuid2',
12
+ name: 'test 2',
13
+ url: 'test-2',
14
+ count: 12
15
+ }),
16
+ new Tag().from({
17
+ id: 'uuid3',
18
+ name: 'test 3',
19
+ url: 'test-3',
20
+ count: 0
21
+ })
22
+ ]
@@ -0,0 +1,3 @@
1
+ import PgListTag from './listTag';
2
+
3
+ export default PgListTag;
@@ -0,0 +1,9 @@
1
+ :host {
2
+ display: inline-flex;
3
+ color: var(--pg-icon-color, #453C4F);
4
+ }
5
+
6
+ [part="svg"] {
7
+ width: var(--pg-icon-width, 1.5rem);
8
+ height: var(--pg-icon-height, 1.5rem);
9
+ }
@@ -0,0 +1 @@
1
+ <div part="items"></div>
@@ -0,0 +1,48 @@
1
+ import { Component, Prop, Part, node } from '@pictogrammers/element';
2
+ import { Tag } from '../shared/models/tag';
3
+ import { list, item } from '../shared/list';
4
+
5
+ import partialTag from './partials/tag.html';
6
+
7
+ import template from './listTag.html';
8
+ import style from './listTag.css';
9
+
10
+ @Component({
11
+ selector: 'pg-list-tag',
12
+ style,
13
+ template
14
+ })
15
+ export default class PgListTag extends HTMLElement {
16
+ @Prop() items: Tag[] = [];
17
+ @Prop() edit: boolean = false;
18
+
19
+ @Part() $items: HTMLDivElement;
20
+
21
+ render(changes) {
22
+ if (changes.items) {
23
+ list(
24
+ this.$items,
25
+ this.items,
26
+ 'id',
27
+ (tag: Tag) => {
28
+ const n = node<HTMLDivElement>(partialTag, {
29
+ name: {
30
+ innerText: tag.name
31
+ }
32
+ });
33
+ const name = n.querySelector<HTMLDivElement>('[part="name"]');
34
+ name?.addEventListener('click', (e) => {
35
+ console.log(tag);
36
+ });
37
+ return n;
38
+ },
39
+ (modifiction, $item) => {
40
+
41
+ }
42
+ );
43
+ }
44
+ if (changes.edit) {
45
+
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,3 @@
1
+ <button part="name">
2
+
3
+ </button>
@@ -0,0 +1,13 @@
1
+ # `<pg-markdown>`
2
+
3
+ Render markdown text with rich formatting.
4
+
5
+ ```typescript
6
+ import '@pictogrammers/components/pg/markdown';
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ | Events | Description |
12
+ | ------ | ----------- |
13
+ | `onchange` | `event = { detail: { r, g, b, hex } }` |
@@ -0,0 +1,3 @@
1
+ <div class="example">
2
+ <pg-markdown part="markdown"></pg-markdown>
3
+ </div>
@@ -0,0 +1,51 @@
1
+ import { Component, Part, Prop } from '@pictogrammers/element';
2
+ import PgMarkdown from '../../markdown';
3
+ import { example, icons, mdiAlert, mdiVanish } from './constants';
4
+
5
+ import template from './basic.html';
6
+
7
+ @Component({
8
+ selector: 'x-pg-markdown-basic',
9
+ template
10
+ })
11
+ export default class XPgMarkdownBasic extends HTMLElement {
12
+ @Part() $markdown: PgMarkdown;
13
+
14
+ connectedCallback() {
15
+ this.$markdown.replace = [{
16
+ find: new RegExp('(\\\\mdi|mdi|icon):([a-z0-9-]+):?([#a-z0-9-]+)?', 'g'),
17
+ replace: (m, type, icon, color) => {
18
+ if (type == '\\mdi') { return `mdi:${icon}`; }
19
+ if (icon == 'not' || icon == 'before') { return m; }
20
+ const c = color ? ` style="fill:${color}"` : '';
21
+ if (type === 'mdi') {
22
+ return `<a href="icon/${icon}"><svg class="icon" data-type="link" viewBox="0 0 24 24"><path data-icon="${icon}" fill="currentColor" d="${mdiVanish}"${c} /></svg></a>`;
23
+ } else {
24
+ return `<svg class="icon" data-type="icon" viewBox="0 0 24 24"><path data-icon="${icon}" fill="currentColor" d="${mdiVanish}"${c} /></svg>`;
25
+ }
26
+ }
27
+ }, {
28
+ find: new RegExp('<blockquote>([\\\s\\\S]*?)<\\\/blockquote>', 'g'),
29
+ replace: (m) => {
30
+ const matchLabel = m.match(/<blockquote>\r?\n?<p><strong>([\w ]+):</);
31
+ if (matchLabel) {
32
+ const label = matchLabel[1];
33
+ const classLabel = matchLabel[1].trim().toLowerCase().replace(/[ _]/g, '-');
34
+ m = m.replace(new RegExp(`<strong>${label}:</strong> ?`), '');
35
+ m = m.replace(/^<blockquote/, `<blockquote class="${classLabel}"`);
36
+ }
37
+ return m;
38
+ }
39
+ }];
40
+
41
+ this.$markdown.text = example;
42
+
43
+ this.$markdown.modify(($content) => {
44
+ var paths = $content.querySelectorAll('[data-icon]');
45
+ for (var i = 0; i < paths.length; i++) {
46
+ var path = paths[i];
47
+ path.setAttribute('d', icons[path.dataset.icon] || mdiAlert)
48
+ }
49
+ });
50
+ }
51
+ }
@@ -0,0 +1,129 @@
1
+ export const mdiVanish = 'M16,13V11H21V13H16M14.83,7.76L17.66,4.93L19.07,6.34L16.24,9.17L14.83,7.76M11,16H13V21H11V16M11,3H13V8H11V3M4.93,17.66L7.76,14.83L9.17,16.24L6.34,19.07L4.93,17.66M4.93,6.34L6.34,4.93L9.17,7.76L7.76,9.17L4.93,6.34M8,13H3V11H8V13M19.07,17.66L17.66,19.07L14.83,16.24L16.24,14.83L19.07,17.66Z';
2
+ export const mdiAlert = 'M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z';
3
+ export const icons = {
4
+ 'account': 'M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z'
5
+ };
6
+
7
+ export const example = [
8
+ '# Header 1',
9
+ '',
10
+ 'Paragraph text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text',
11
+ '',
12
+ '## Header 2',
13
+ '',
14
+ 'Paragraph text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text',
15
+ '',
16
+ '### Header 3',
17
+ '',
18
+ 'Paragraph text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text',
19
+ '',
20
+ '#### Header 4',
21
+ '',
22
+ 'Paragraph text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text',
23
+ '',
24
+ 'Test [`link code`](#) example.',
25
+ '',
26
+ `<a href="" class="button">icon:account Button</a>`,
27
+ '',
28
+ '- List 1',
29
+ '- List 2',
30
+ ' - List 1 `code`',
31
+ ' - List 2',
32
+ '- List 3 `inline` code',
33
+ '',
34
+ '> Blockquote',
35
+ '',
36
+ '',
37
+ '> **Warning:** Blockquote',
38
+ '',
39
+ '',
40
+ '> **Note:** Blockquote',
41
+ '',
42
+ '',
43
+ '> **Alert:** Blockquote',
44
+ '',
45
+ '> **Attention:** Blockquote',
46
+ '',
47
+ '> **Success:** Blockquote',
48
+ '',
49
+ '> ',
50
+ '>',
51
+ '',
52
+ '```javascript',
53
+ 'function foo() {',
54
+ ' // Code',
55
+ '}',
56
+ '```',
57
+ '```typescript',
58
+ 'function foo() {',
59
+ ' // Really long item with overlap. test test test test test test test test test test test test test test test test test test',
60
+ '}',
61
+ '```',
62
+ '```markdown',
63
+ '# Header',
64
+ '',
65
+ 'Does markdown in markdown work...',
66
+ '```',
67
+ '',
68
+ '```',
69
+ 'Nothing',
70
+ '```',
71
+ '',
72
+ '```yaml',
73
+ 'type: object',
74
+ 'properties:',
75
+ ' id:',
76
+ ' type: string',
77
+ ' format: uuid',
78
+ ' name:',
79
+ ' type: string',
80
+ ' pattern: /$[a-z0-9-]+^/',
81
+ ' example: user',
82
+ ' complex:',
83
+ ' type: object',
84
+ ' properties:',
85
+ ' id:',
86
+ ' type: string',
87
+ ' format: uuid',
88
+ '```',
89
+ '',
90
+ 'Tabs without Label',
91
+ '',
92
+ 'tabs',
93
+ 'tab Tab Title 1',
94
+ '',
95
+ 'Anything...',
96
+ '',
97
+ '/tab',
98
+ 'tab icon:foo Tab Title 2',
99
+ '',
100
+ 'Another tabs `content`.',
101
+ '',
102
+ '/tab',
103
+ '/tabs',
104
+ '',
105
+ '',
106
+ 'Tabs with Label',
107
+ '',
108
+ 'tabs Label',
109
+ 'tab Tab Title 1',
110
+ '',
111
+ 'Anything...',
112
+ '',
113
+ '/tab',
114
+ 'tab Tab Title 2',
115
+ '',
116
+ 'Another tabs `content`.',
117
+ '',
118
+ '/tab',
119
+ '/tabs',
120
+ '',
121
+ '| Header 1 | Header 2 |',
122
+ '|----------------------|----------|',
123
+ '| Row 1... larger size | Row 1 |',
124
+ '| Row 2 | Row 2 |',
125
+ '| Row 3 | Row 3 |',
126
+ '| Row 4 | Row 4 |',
127
+ '',
128
+ 'Done, but `code` blocks would be useful.'
129
+ ].join('\n');
@@ -0,0 +1,5 @@
1
+ import PgMarkdown from './markdown';
2
+
3
+ export { MarkdownReplace } from './markdownReplace';
4
+
5
+ export default PgMarkdown;