@thinkpixellab-public/px-vue 3.0.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 (398) hide show
  1. package/.eslintrc.js +14 -0
  2. package/.prettierrc.js +10 -0
  3. package/LICENSE.md +9 -0
  4. package/README.md +83 -0
  5. package/assets/feather/activity.svg +1 -0
  6. package/assets/feather/airplay.svg +1 -0
  7. package/assets/feather/alert-circle.svg +1 -0
  8. package/assets/feather/alert-octagon.svg +1 -0
  9. package/assets/feather/alert-triangle.svg +1 -0
  10. package/assets/feather/align-center.svg +1 -0
  11. package/assets/feather/align-justify.svg +1 -0
  12. package/assets/feather/align-left.svg +1 -0
  13. package/assets/feather/align-right.svg +1 -0
  14. package/assets/feather/anchor.svg +1 -0
  15. package/assets/feather/aperture.svg +1 -0
  16. package/assets/feather/archive.svg +1 -0
  17. package/assets/feather/arrow-down-circle.svg +1 -0
  18. package/assets/feather/arrow-down-left.svg +1 -0
  19. package/assets/feather/arrow-down-right.svg +1 -0
  20. package/assets/feather/arrow-down.svg +1 -0
  21. package/assets/feather/arrow-left-circle.svg +1 -0
  22. package/assets/feather/arrow-left.svg +1 -0
  23. package/assets/feather/arrow-right-circle.svg +1 -0
  24. package/assets/feather/arrow-right.svg +1 -0
  25. package/assets/feather/arrow-up-circle.svg +1 -0
  26. package/assets/feather/arrow-up-left.svg +1 -0
  27. package/assets/feather/arrow-up-right.svg +1 -0
  28. package/assets/feather/arrow-up.svg +1 -0
  29. package/assets/feather/at-sign.svg +1 -0
  30. package/assets/feather/award.svg +1 -0
  31. package/assets/feather/bar-chart-2.svg +1 -0
  32. package/assets/feather/bar-chart.svg +1 -0
  33. package/assets/feather/battery-charging.svg +1 -0
  34. package/assets/feather/battery.svg +1 -0
  35. package/assets/feather/bell-off.svg +1 -0
  36. package/assets/feather/bell.svg +1 -0
  37. package/assets/feather/bluetooth.svg +1 -0
  38. package/assets/feather/bold.svg +1 -0
  39. package/assets/feather/book-open.svg +1 -0
  40. package/assets/feather/book.svg +1 -0
  41. package/assets/feather/bookmark.svg +1 -0
  42. package/assets/feather/box.svg +1 -0
  43. package/assets/feather/briefcase.svg +1 -0
  44. package/assets/feather/calendar.svg +1 -0
  45. package/assets/feather/camera-off.svg +1 -0
  46. package/assets/feather/camera.svg +1 -0
  47. package/assets/feather/cast.svg +1 -0
  48. package/assets/feather/check-circle.svg +1 -0
  49. package/assets/feather/check-square.svg +1 -0
  50. package/assets/feather/check.svg +1 -0
  51. package/assets/feather/chevron-down.svg +1 -0
  52. package/assets/feather/chevron-left.svg +1 -0
  53. package/assets/feather/chevron-right.svg +1 -0
  54. package/assets/feather/chevron-up.svg +1 -0
  55. package/assets/feather/chevrons-down.svg +1 -0
  56. package/assets/feather/chevrons-left.svg +1 -0
  57. package/assets/feather/chevrons-right.svg +1 -0
  58. package/assets/feather/chevrons-up.svg +1 -0
  59. package/assets/feather/chrome.svg +1 -0
  60. package/assets/feather/circle.svg +1 -0
  61. package/assets/feather/clipboard.svg +1 -0
  62. package/assets/feather/clock.svg +1 -0
  63. package/assets/feather/cloud-drizzle.svg +1 -0
  64. package/assets/feather/cloud-lightning.svg +1 -0
  65. package/assets/feather/cloud-off.svg +1 -0
  66. package/assets/feather/cloud-rain.svg +1 -0
  67. package/assets/feather/cloud-snow.svg +1 -0
  68. package/assets/feather/cloud.svg +1 -0
  69. package/assets/feather/code.svg +1 -0
  70. package/assets/feather/codepen.svg +1 -0
  71. package/assets/feather/codesandbox.svg +1 -0
  72. package/assets/feather/coffee.svg +1 -0
  73. package/assets/feather/columns.svg +1 -0
  74. package/assets/feather/command.svg +1 -0
  75. package/assets/feather/compass.svg +1 -0
  76. package/assets/feather/copy.svg +1 -0
  77. package/assets/feather/corner-down-left.svg +1 -0
  78. package/assets/feather/corner-down-right.svg +1 -0
  79. package/assets/feather/corner-left-down.svg +1 -0
  80. package/assets/feather/corner-left-up.svg +1 -0
  81. package/assets/feather/corner-right-down.svg +1 -0
  82. package/assets/feather/corner-right-up.svg +1 -0
  83. package/assets/feather/corner-up-left.svg +1 -0
  84. package/assets/feather/corner-up-right.svg +1 -0
  85. package/assets/feather/cpu.svg +1 -0
  86. package/assets/feather/credit-card.svg +1 -0
  87. package/assets/feather/crop.svg +1 -0
  88. package/assets/feather/crosshair.svg +1 -0
  89. package/assets/feather/database.svg +1 -0
  90. package/assets/feather/delete.svg +1 -0
  91. package/assets/feather/disc.svg +1 -0
  92. package/assets/feather/divide-circle.svg +1 -0
  93. package/assets/feather/divide-square.svg +1 -0
  94. package/assets/feather/divide.svg +1 -0
  95. package/assets/feather/dollar-sign.svg +1 -0
  96. package/assets/feather/download-cloud.svg +1 -0
  97. package/assets/feather/download.svg +1 -0
  98. package/assets/feather/dribbble.svg +1 -0
  99. package/assets/feather/droplet.svg +1 -0
  100. package/assets/feather/edit-2.svg +1 -0
  101. package/assets/feather/edit-3.svg +1 -0
  102. package/assets/feather/edit.svg +1 -0
  103. package/assets/feather/external-link.svg +1 -0
  104. package/assets/feather/eye-off.svg +1 -0
  105. package/assets/feather/eye.svg +1 -0
  106. package/assets/feather/facebook.svg +1 -0
  107. package/assets/feather/fast-forward.svg +1 -0
  108. package/assets/feather/feather.svg +1 -0
  109. package/assets/feather/figma.svg +1 -0
  110. package/assets/feather/file-minus.svg +1 -0
  111. package/assets/feather/file-plus.svg +1 -0
  112. package/assets/feather/file-text.svg +1 -0
  113. package/assets/feather/file.svg +1 -0
  114. package/assets/feather/film.svg +1 -0
  115. package/assets/feather/filter.svg +1 -0
  116. package/assets/feather/flag.svg +1 -0
  117. package/assets/feather/folder-minus.svg +1 -0
  118. package/assets/feather/folder-plus.svg +1 -0
  119. package/assets/feather/folder.svg +1 -0
  120. package/assets/feather/framer.svg +1 -0
  121. package/assets/feather/frown.svg +1 -0
  122. package/assets/feather/gift.svg +1 -0
  123. package/assets/feather/git-branch.svg +1 -0
  124. package/assets/feather/git-commit.svg +1 -0
  125. package/assets/feather/git-merge.svg +1 -0
  126. package/assets/feather/git-pull-request.svg +1 -0
  127. package/assets/feather/github.svg +1 -0
  128. package/assets/feather/gitlab.svg +1 -0
  129. package/assets/feather/globe.svg +1 -0
  130. package/assets/feather/grid.svg +1 -0
  131. package/assets/feather/hard-drive.svg +1 -0
  132. package/assets/feather/hash.svg +1 -0
  133. package/assets/feather/headphones.svg +1 -0
  134. package/assets/feather/heart.svg +1 -0
  135. package/assets/feather/help-circle.svg +1 -0
  136. package/assets/feather/hexagon.svg +1 -0
  137. package/assets/feather/home.svg +1 -0
  138. package/assets/feather/image.svg +1 -0
  139. package/assets/feather/inbox.svg +1 -0
  140. package/assets/feather/info.svg +1 -0
  141. package/assets/feather/instagram.svg +1 -0
  142. package/assets/feather/italic.svg +1 -0
  143. package/assets/feather/key.svg +1 -0
  144. package/assets/feather/layers.svg +1 -0
  145. package/assets/feather/layout.svg +1 -0
  146. package/assets/feather/life-buoy.svg +1 -0
  147. package/assets/feather/link-2.svg +1 -0
  148. package/assets/feather/link.svg +1 -0
  149. package/assets/feather/linkedin.svg +1 -0
  150. package/assets/feather/list.svg +1 -0
  151. package/assets/feather/loader.svg +1 -0
  152. package/assets/feather/lock.svg +1 -0
  153. package/assets/feather/log-in.svg +1 -0
  154. package/assets/feather/log-out.svg +1 -0
  155. package/assets/feather/mail.svg +1 -0
  156. package/assets/feather/map-pin.svg +1 -0
  157. package/assets/feather/map.svg +1 -0
  158. package/assets/feather/maximize-2.svg +1 -0
  159. package/assets/feather/maximize.svg +1 -0
  160. package/assets/feather/meh.svg +1 -0
  161. package/assets/feather/menu.svg +1 -0
  162. package/assets/feather/message-circle.svg +1 -0
  163. package/assets/feather/message-square.svg +1 -0
  164. package/assets/feather/mic-off.svg +1 -0
  165. package/assets/feather/mic.svg +1 -0
  166. package/assets/feather/minimize-2.svg +1 -0
  167. package/assets/feather/minimize.svg +1 -0
  168. package/assets/feather/minus-circle.svg +1 -0
  169. package/assets/feather/minus-square.svg +1 -0
  170. package/assets/feather/minus.svg +1 -0
  171. package/assets/feather/monitor.svg +1 -0
  172. package/assets/feather/moon.svg +1 -0
  173. package/assets/feather/more-horizontal.svg +1 -0
  174. package/assets/feather/more-vertical.svg +1 -0
  175. package/assets/feather/mouse-pointer.svg +1 -0
  176. package/assets/feather/move.svg +1 -0
  177. package/assets/feather/music.svg +1 -0
  178. package/assets/feather/navigation-2.svg +1 -0
  179. package/assets/feather/navigation.svg +1 -0
  180. package/assets/feather/octagon.svg +1 -0
  181. package/assets/feather/package.svg +1 -0
  182. package/assets/feather/paperclip.svg +1 -0
  183. package/assets/feather/pause-circle.svg +1 -0
  184. package/assets/feather/pause.svg +1 -0
  185. package/assets/feather/pen-tool.svg +1 -0
  186. package/assets/feather/percent.svg +1 -0
  187. package/assets/feather/phone-call.svg +1 -0
  188. package/assets/feather/phone-forwarded.svg +1 -0
  189. package/assets/feather/phone-incoming.svg +1 -0
  190. package/assets/feather/phone-missed.svg +1 -0
  191. package/assets/feather/phone-off.svg +1 -0
  192. package/assets/feather/phone-outgoing.svg +1 -0
  193. package/assets/feather/phone.svg +1 -0
  194. package/assets/feather/pie-chart.svg +1 -0
  195. package/assets/feather/play-circle.svg +1 -0
  196. package/assets/feather/play.svg +1 -0
  197. package/assets/feather/plus-circle.svg +1 -0
  198. package/assets/feather/plus-square.svg +1 -0
  199. package/assets/feather/plus.svg +1 -0
  200. package/assets/feather/pocket.svg +1 -0
  201. package/assets/feather/power.svg +1 -0
  202. package/assets/feather/printer.svg +1 -0
  203. package/assets/feather/radio.svg +1 -0
  204. package/assets/feather/refresh-ccw.svg +1 -0
  205. package/assets/feather/refresh-cw.svg +1 -0
  206. package/assets/feather/repeat.svg +1 -0
  207. package/assets/feather/rewind.svg +1 -0
  208. package/assets/feather/rotate-ccw.svg +1 -0
  209. package/assets/feather/rotate-cw.svg +1 -0
  210. package/assets/feather/rss.svg +1 -0
  211. package/assets/feather/save.svg +1 -0
  212. package/assets/feather/scissors.svg +1 -0
  213. package/assets/feather/search.svg +1 -0
  214. package/assets/feather/send.svg +1 -0
  215. package/assets/feather/server.svg +1 -0
  216. package/assets/feather/settings.svg +1 -0
  217. package/assets/feather/share-2.svg +1 -0
  218. package/assets/feather/share.svg +1 -0
  219. package/assets/feather/shield-off.svg +1 -0
  220. package/assets/feather/shield.svg +1 -0
  221. package/assets/feather/shopping-bag.svg +1 -0
  222. package/assets/feather/shopping-cart.svg +1 -0
  223. package/assets/feather/shuffle.svg +1 -0
  224. package/assets/feather/sidebar.svg +1 -0
  225. package/assets/feather/skip-back.svg +1 -0
  226. package/assets/feather/skip-forward.svg +1 -0
  227. package/assets/feather/slack.svg +1 -0
  228. package/assets/feather/slash.svg +1 -0
  229. package/assets/feather/sliders.svg +1 -0
  230. package/assets/feather/smartphone.svg +1 -0
  231. package/assets/feather/smile.svg +1 -0
  232. package/assets/feather/speaker.svg +1 -0
  233. package/assets/feather/square.svg +1 -0
  234. package/assets/feather/star.svg +1 -0
  235. package/assets/feather/stop-circle.svg +1 -0
  236. package/assets/feather/sun.svg +1 -0
  237. package/assets/feather/sunrise.svg +1 -0
  238. package/assets/feather/sunset.svg +1 -0
  239. package/assets/feather/table.svg +1 -0
  240. package/assets/feather/tablet.svg +1 -0
  241. package/assets/feather/tag.svg +1 -0
  242. package/assets/feather/target.svg +1 -0
  243. package/assets/feather/terminal.svg +1 -0
  244. package/assets/feather/thermometer.svg +1 -0
  245. package/assets/feather/thumbs-down.svg +1 -0
  246. package/assets/feather/thumbs-up.svg +1 -0
  247. package/assets/feather/toggle-left.svg +1 -0
  248. package/assets/feather/toggle-right.svg +1 -0
  249. package/assets/feather/tool.svg +1 -0
  250. package/assets/feather/trash-2.svg +1 -0
  251. package/assets/feather/trash.svg +1 -0
  252. package/assets/feather/trello.svg +1 -0
  253. package/assets/feather/trending-down.svg +1 -0
  254. package/assets/feather/trending-up.svg +1 -0
  255. package/assets/feather/triangle.svg +1 -0
  256. package/assets/feather/truck.svg +1 -0
  257. package/assets/feather/tv.svg +1 -0
  258. package/assets/feather/twitch.svg +1 -0
  259. package/assets/feather/twitter.svg +1 -0
  260. package/assets/feather/type.svg +1 -0
  261. package/assets/feather/umbrella.svg +1 -0
  262. package/assets/feather/underline.svg +1 -0
  263. package/assets/feather/unlock.svg +1 -0
  264. package/assets/feather/upload-cloud.svg +1 -0
  265. package/assets/feather/upload.svg +1 -0
  266. package/assets/feather/user-check.svg +1 -0
  267. package/assets/feather/user-minus.svg +1 -0
  268. package/assets/feather/user-plus.svg +1 -0
  269. package/assets/feather/user-x.svg +1 -0
  270. package/assets/feather/user.svg +1 -0
  271. package/assets/feather/users.svg +1 -0
  272. package/assets/feather/video-off.svg +1 -0
  273. package/assets/feather/video.svg +1 -0
  274. package/assets/feather/voicemail.svg +1 -0
  275. package/assets/feather/volume-1.svg +1 -0
  276. package/assets/feather/volume-2.svg +1 -0
  277. package/assets/feather/volume-x.svg +1 -0
  278. package/assets/feather/volume.svg +1 -0
  279. package/assets/feather/watch.svg +1 -0
  280. package/assets/feather/wifi-off.svg +1 -0
  281. package/assets/feather/wifi.svg +1 -0
  282. package/assets/feather/wind.svg +1 -0
  283. package/assets/feather/x-circle.svg +1 -0
  284. package/assets/feather/x-octagon.svg +1 -0
  285. package/assets/feather/x-square.svg +1 -0
  286. package/assets/feather/x.svg +1 -0
  287. package/assets/feather/youtube.svg +1 -0
  288. package/assets/feather/zap-off.svg +1 -0
  289. package/assets/feather/zap.svg +1 -0
  290. package/assets/feather/zoom-in.svg +1 -0
  291. package/assets/feather/zoom-out.svg +1 -0
  292. package/assets/icons/calendar.svg +6 -0
  293. package/assets/icons/check.svg +1 -0
  294. package/assets/icons/close-sm.svg +1 -0
  295. package/assets/icons/close.svg +1 -0
  296. package/assets/icons/copy.svg +1 -0
  297. package/assets/icons/dropdown.svg +8 -0
  298. package/assets/icons/invalid.svg +1 -0
  299. package/assets/icons/menu.svg +1 -0
  300. package/assets/icons/nav-next.svg +1 -0
  301. package/assets/icons/nav-prev.svg +1 -0
  302. package/assets/icons/sort-asc.svg +1 -0
  303. package/assets/icons/sort-desc.svg +1 -0
  304. package/assets/test/README.md +1 -0
  305. package/assets/test/trash.svg +8 -0
  306. package/babel.config.js +16 -0
  307. package/components/PxAspect.vue +127 -0
  308. package/components/PxAutoClamp.vue +75 -0
  309. package/components/PxBalancedText.vue +118 -0
  310. package/components/PxBase.vue +15 -0
  311. package/components/PxBaseDate.vue +27 -0
  312. package/components/PxBaseItems.vue +72 -0
  313. package/components/PxBaseItemsSelect.vue +230 -0
  314. package/components/PxBaseResize.vue +60 -0
  315. package/components/PxBaseToggle.vue +56 -0
  316. package/components/PxBaseVariants.vue +62 -0
  317. package/components/PxBaseVisible.vue +40 -0
  318. package/components/PxCalendar.vue +385 -0
  319. package/components/PxCard.vue +47 -0
  320. package/components/PxCardGrid.vue +386 -0
  321. package/components/PxClock.vue +510 -0
  322. package/components/PxCopyText.vue +78 -0
  323. package/components/PxDatePicker.vue +249 -0
  324. package/components/PxDropdown.vue +181 -0
  325. package/components/PxExpander.vue +46 -0
  326. package/components/PxFeatherIcon.vue +29 -0
  327. package/components/PxFeatherIconButton.vue +19 -0
  328. package/components/PxFit.vue +274 -0
  329. package/components/PxFlex.vue +93 -0
  330. package/components/PxFloat.vue +32 -0
  331. package/components/PxIcon.vue +43 -0
  332. package/components/PxIconButton.vue +115 -0
  333. package/components/PxIdUniquer.vue +59 -0
  334. package/components/PxModal.vue +365 -0
  335. package/components/PxNineGrid.vue +94 -0
  336. package/components/PxPivot.vue +207 -0
  337. package/components/PxPopup.vue +230 -0
  338. package/components/PxPortal.vue +138 -0
  339. package/components/PxPortalTarget.vue +25 -0
  340. package/components/PxProgressCircle.vue +73 -0
  341. package/components/PxRadioButton.vue +83 -0
  342. package/components/PxSideDrawer.vue +164 -0
  343. package/components/PxSlideTransition.vue +116 -0
  344. package/components/PxSlides.vue +217 -0
  345. package/components/PxStylesPreview.vue +129 -0
  346. package/components/PxSvg.vue +157 -0
  347. package/components/PxSwiper.vue +271 -0
  348. package/components/PxSwiperSlide.vue +42 -0
  349. package/components/PxSyncHeight.vue +137 -0
  350. package/components/PxTable.vue +323 -0
  351. package/components/PxTabs.vue +1 -0
  352. package/components/PxTextbox.vue +90 -0
  353. package/components/PxToggle.vue +125 -0
  354. package/components/PxToggleButton.vue +139 -0
  355. package/components/PxToggleButtonList.vue +131 -0
  356. package/components/PxTransitionExpand.vue +100 -0
  357. package/components/PxValidator.vue +431 -0
  358. package/components/PxVueTest.vue +761 -0
  359. package/components/README.md +0 -0
  360. package/dev/data/fruits.js +59 -0
  361. package/dev/data/random.js +13 -0
  362. package/dev/demos/Demo-PxBaseDrag.vue +94 -0
  363. package/dev/demos/Demo-PxCardGrid.vue +53 -0
  364. package/dev/demos/Demo-PxPivot.vue +58 -0
  365. package/dev/demos/Demo-PxSideDrawer.vue +72 -0
  366. package/dev/demos/Demo-PxSlideTransition.vue +86 -0
  367. package/dev/demos/Demo-PxSlides.vue +142 -0
  368. package/dev/demos/Demo-PxStylesPreview.vue +46 -0
  369. package/dev/demos/Demo-PxSwiper.vue +44 -0
  370. package/dev/demos/DemoPicker.vue +79 -0
  371. package/dev/dev.vue +56 -0
  372. package/dev/serve.js +17 -0
  373. package/package.json +45 -0
  374. package/plugins/common-client.js +13 -0
  375. package/plugins/common-lib.js +4 -0
  376. package/plugins/common.js +39 -0
  377. package/plugins/filters/aspect.js +14 -0
  378. package/plugins/filters/date.js +26 -0
  379. package/plugins/filters/kebab.js +9 -0
  380. package/plugins/filters/phone.js +7 -0
  381. package/plugins/filters/slug.js +26 -0
  382. package/plugins/filters/spacenator.js +11 -0
  383. package/plugins/filters/stringToItems.js +28 -0
  384. package/plugins/filters/striphtml.js +10 -0
  385. package/plugins/mixins/eventBus.js +23 -0
  386. package/px-styles.config.scss +12 -0
  387. package/styles/helpers.scss +14 -0
  388. package/styles/px.scss +6 -0
  389. package/utils/balanceText.js +123 -0
  390. package/utils/bem.js +99 -0
  391. package/utils/cardGrid.js +383 -0
  392. package/utils/cssStr.js +45 -0
  393. package/utils/drag.js +363 -0
  394. package/utils/fit.js +73 -0
  395. package/utils/tween.js +129 -0
  396. package/utils/utils.js +167 -0
  397. package/utils/variants.js +33 -0
  398. package/vue.config.js +12 -0
@@ -0,0 +1,323 @@
1
+ <!--
2
+
3
+ // column definitions
4
+ {
5
+ // (null) the property that will be displayed in the column (if undefined, the column needs to be rendered using a slot)
6
+ property,
7
+
8
+ // (null) the column label (defaults to the property name if not specified)
9
+ label,
10
+
11
+ // (hidden | wrap | ellipsis) whether to wrap or show ellipsis
12
+ overflow,
13
+
14
+ // (left | center | right) text alignment for the column
15
+ align,
16
+
17
+ // (auto) size of the column, specified using grid template syntax
18
+ size,
19
+
20
+ // (null) a slot template name used to define the rendering for the column
21
+ template,
22
+
23
+ // (null) a slot template name used to define the rendering for the column header label
24
+ headerTemplate,
25
+
26
+ // (true) whether the column supports sorting (sortEnabled prop must also be true)
27
+ sortable,
28
+
29
+ // class that will be applied to cells in this column
30
+ class
31
+ }
32
+
33
+ -->
34
+ <template>
35
+ <div :class="bem()">
36
+ <div
37
+ :class="[bem('table')]"
38
+ :style="{
39
+ gridTemplateColumns: columnWidths,
40
+ gridAutoRows: rowSize,
41
+ }"
42
+ >
43
+ <!-- header -->
44
+
45
+ <div :class="bem('row', { header: true })">
46
+ <div
47
+ :class="[
48
+ bem('cell', {
49
+ header: true,
50
+ fixed: fixedHeader,
51
+ align: c.align,
52
+ sortable: isColumnSortable(c),
53
+ sorted: isColumnSorted(c),
54
+ }),
55
+ ]"
56
+ v-for="(c, index) in columnsAll"
57
+ :key="index"
58
+ :role="isColumnSortable(c) ? 'button' : null"
59
+ @click="isColumnSortable(c) ? columnSortClick(c) : null"
60
+ >
61
+ <slot v-if="c.headerTemplate" :name="c.headerTemplate" v-bind:column="c"></slot>
62
+ <span v-else>{{ c.label || c.property }}</span>
63
+
64
+ <px-icon
65
+ :class="bem('sort-icon')"
66
+ :src="iconSortedAscending"
67
+ :style="{ opacity: isColumnSorted(c) ? 1 : 0 }"
68
+ />
69
+ </div>
70
+ </div>
71
+
72
+ <!-- rows -->
73
+
74
+ <div :class="[bem('row')]" v-for="(item, itemIndex) in items" :key="getItemKey(item)">
75
+ <div
76
+ :class="[
77
+ bem('cell', { overflow: c.overflow, align: c.align }),
78
+ cellClass,
79
+ c.class,
80
+ ]"
81
+ v-for="(c, index) in columnsAll"
82
+ :key="index"
83
+ >
84
+ <!-- template -->
85
+ <slot
86
+ v-if="c.template"
87
+ :name="c.template"
88
+ v-bind:item="item"
89
+ v-bind:index="itemIndex"
90
+ ></slot>
91
+
92
+ <!-- string (default) -->
93
+ <span v-else>
94
+ {{ valueToString(item[c.property]) }}
95
+ </span>
96
+ </div>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </template>
101
+
102
+ <script>
103
+ import PxBaseItems from './PxBaseItems.vue';
104
+ import PxIcon from './PxIcon.vue';
105
+ export default {
106
+ components: { PxIcon },
107
+ name: 'px-table',
108
+ // components: { Component },
109
+ mixins: [PxBaseItems],
110
+ props: {
111
+ // class that gets applied to individual cells
112
+ cellClass: { default: null },
113
+
114
+ // can be an array of objects (see above) or strings (just property names)
115
+ columns: { default: null },
116
+
117
+ // defines the sizes of rows ( grid-template-row syntax)
118
+ rowSize: { type: String, default: 'auto' },
119
+
120
+ // whether to the header row is fixed (sticky)
121
+ fixedHeader: { type: Boolean, default: true },
122
+
123
+ // sorting
124
+
125
+ // Enables sorting on the column (PxTable tracks which column is current selected for
126
+ // sorting and a direction (ascending/descending) and raises and event (@sort) when it
127
+ // changes, but the actual sorting need to be handle externally by sorting the items).
128
+ sortEnabled: { type: Boolean, default: true },
129
+ iconSortedAscending: { type: String, default: require('../assets/icons/sort-asc.svg') },
130
+ iconSortedDescending: { type: String, default: require('../assets/icons/sort-desc.svg') },
131
+
132
+ // can be used to temporarily disabled item level actions (expand, drag, remove, etc.)
133
+ actionsEnabled: { type: Boolean, default: true },
134
+
135
+ // other actions
136
+ clickEnabled: { type: Boolean, default: false },
137
+ removeEnabled: { type: Boolean, default: false },
138
+
139
+ // dragging
140
+ dragEnabled: { type: Boolean, default: true },
141
+ dragCheck: { default: null }, // expects a function, see sortablejs move callback
142
+ },
143
+ data() {
144
+ return {
145
+ sortColumn: null,
146
+ sortAscending: false,
147
+ };
148
+ },
149
+ computed: {
150
+ defaultColumns() {
151
+ if (this.items?.length) {
152
+ return Object.keys(this.items[0]);
153
+ }
154
+ return [];
155
+ },
156
+ columnsAll() {
157
+ let cols = this.columns || this.defaultColumns;
158
+ return cols.map(c => {
159
+ if (typeof c == 'string') {
160
+ return {
161
+ property: c,
162
+ label: c,
163
+ sortable: true,
164
+ };
165
+ }
166
+ return { sortable: true, ...c };
167
+ });
168
+ },
169
+ columnWidths() {
170
+ return this.columnsAll.map(col => col.size || 'auto').join(' ');
171
+ },
172
+ },
173
+ // watch: {},
174
+ // mounted() {},
175
+ methods: {
176
+ valueToString(value) {
177
+ if (typeof value == 'object' && typeof value.getMonth === 'function') {
178
+ return value.toLocaleDateString();
179
+ }
180
+ return value;
181
+ },
182
+ isColumnSortable(column) {
183
+ return this.sortEnabled && column.sortable;
184
+ },
185
+ isColumnSorted(column) {
186
+ return this.sortColumn === column;
187
+ },
188
+ columnSortClick(column) {
189
+ this.sortColumn = column;
190
+ },
191
+ },
192
+ };
193
+ </script>
194
+
195
+ <style lang="scss">
196
+ @use '../styles/px.scss' as *;
197
+
198
+ .px-table {
199
+ // load defaults
200
+
201
+ // the outer container for the table (use to style an outer border, etc.)
202
+
203
+ $table: flat-merge(
204
+ get(
205
+ 'controls:table:table',
206
+ (
207
+ border: 1px solid gray(5),
208
+ border-radius: get('controls:border-radius'),
209
+ )
210
+ )
211
+ );
212
+
213
+ // row states that can be used when defining config for cell and header
214
+
215
+ $cell-state-aliases: (
216
+ last-row: '.px-table__row:last-child &',
217
+ even-row: '.px-table__row:nth-child(even) &',
218
+ odd-row: '.px-table__row:nth-child(odd) &',
219
+ sortable: '&.px-table__cell--sortable',
220
+ sorted: '&.px-table__cell--sorted',
221
+ );
222
+
223
+ $cell: flat-merge(
224
+ get(
225
+ 'controls:table:cell',
226
+ (
227
+ padding: 0.5em,
228
+ background-color: clr(page-bg),
229
+ border-bottom: 1px solid gray(5),
230
+ last-row: (
231
+ border-bottom: none,
232
+ ),
233
+ )
234
+ )
235
+ );
236
+
237
+ $header: flat-merge(
238
+ get(
239
+ 'controls:table:header',
240
+ (
241
+ background-color: gray(9),
242
+ sortable: (
243
+ hover: (
244
+ background-color: gray(8),
245
+ ),
246
+ ),
247
+ )
248
+ )
249
+ );
250
+
251
+ // outer grid for the container (not the tabble itself)
252
+ position: relative;
253
+ display: grid;
254
+ max-height: 100%;
255
+ overflow: auto;
256
+ @include css-map($table);
257
+
258
+ &__table {
259
+ position: relative;
260
+ display: grid;
261
+ }
262
+
263
+ &__row {
264
+ position: relative;
265
+ display: contents;
266
+ }
267
+
268
+ &__cell {
269
+ position: relative;
270
+ width: 100%;
271
+ height: 100%;
272
+ box-sizing: border-box;
273
+ display: flex;
274
+ align-items: center;
275
+
276
+ @include css-map($cell, $aliases: $cell-state-aliases);
277
+
278
+ // overflow
279
+
280
+ overflow: hidden;
281
+ white-space: nowrap;
282
+
283
+ &--overflow-ellipsis {
284
+ text-overflow: ellipsis;
285
+ }
286
+ &--overflow-wrap {
287
+ white-space: normal;
288
+ }
289
+
290
+ // align
291
+
292
+ text-align: start;
293
+
294
+ &--align-center {
295
+ text-align: center;
296
+ }
297
+
298
+ &--align-end {
299
+ text-align: end;
300
+ }
301
+
302
+ // headers
303
+
304
+ &--header {
305
+ @include css-map($header, $aliases: $cell-state-aliases);
306
+ z-index: 1;
307
+ &[role='button'] {
308
+ cursor: pointer;
309
+ }
310
+ }
311
+
312
+ &--fixed {
313
+ position: sticky;
314
+ top: 0;
315
+ }
316
+ }
317
+
318
+ &__sort-icon {
319
+ margin-left: 0.5em;
320
+ flex: none;
321
+ }
322
+ }
323
+ </style>
@@ -0,0 +1 @@
1
+ // TBD
@@ -0,0 +1,90 @@
1
+ <!--
2
+ Describe this component...
3
+ -->
4
+ <template>
5
+ <input
6
+ v-if="!multiline"
7
+ :class="bem(variantsMap)"
8
+ v-on="$listeners"
9
+ :value="value"
10
+ @input="inputUpdate"
11
+ @change="changeUpdate"
12
+ />
13
+ <textarea
14
+ v-else
15
+ :class="bem({ resize: showResize, ...variantsMap })"
16
+ v-on="$listeners"
17
+ :value="value"
18
+ @input="inputUpdate"
19
+ @change="changeUpdate"
20
+ />
21
+ </template>
22
+
23
+ <script>
24
+ import PxBase from './PxBase.vue';
25
+ import PxBaseVariants from './PxBaseVariants.vue';
26
+
27
+ export default {
28
+ model: {
29
+ prop: 'value',
30
+ event: 'update:value',
31
+ },
32
+ name: 'px-textbox',
33
+ mixins: [PxBase, PxBaseVariants],
34
+ props: {
35
+ // whether to render as a textbox or textarea, any truthy value signals use textarea and any numeric value will also set the "rows"
36
+ multiline: { type: Boolean, default: false },
37
+
38
+ // the value of the textbox
39
+ value: { type: String, default: null },
40
+
41
+ // whether to show the resize element in the corner of multiline textbox
42
+ showResize: { type: Boolean, default: false },
43
+
44
+ // whether to fire an update / v-model event on every character change ('input') or when the textbox loses focus ('change')
45
+ updateMode: {
46
+ type: String,
47
+ default: 'input',
48
+ validator: val => ['input', 'change'].includes(val),
49
+ },
50
+ },
51
+ computed: {},
52
+ methods: {
53
+ inputUpdate(e) {
54
+ if (this.updateMode == 'input') {
55
+ this.$emit('update:value', e.target.value);
56
+ }
57
+ },
58
+ changeUpdate(e) {
59
+ if (this.updateMode == 'change') {
60
+ this.$emit('update:value', e.target.value);
61
+ }
62
+ },
63
+ selectAll() {
64
+ this.$el.select();
65
+ },
66
+ },
67
+ };
68
+ </script>
69
+
70
+ <style lang="scss">
71
+ @use '../styles/px.scss' as *;
72
+
73
+ // variant: default
74
+
75
+ @include block(px-textbox, default) {
76
+ @include textbox();
77
+ }
78
+
79
+ textarea.px-textbox--default {
80
+ padding-top: 0.5em;
81
+ }
82
+
83
+ textarea.px-textbox {
84
+ resize: none;
85
+ }
86
+
87
+ textarea.px-textbox--resize {
88
+ resize: initial;
89
+ }
90
+ </style>
@@ -0,0 +1,125 @@
1
+ <!--
2
+ Creates a toggle switch.
3
+
4
+ TODO: add usage notes (and cover custom styles, etc.)
5
+
6
+ -->
7
+ <template>
8
+ <button
9
+ :class="[
10
+ bem({ checked: syncChecked, reverse: reverse, ...variantsMap }),
11
+ checkedClass && syncChecked ? checkedClass : null,
12
+ ]"
13
+ aria-role="switch"
14
+ :aria-checked="syncChecked"
15
+ v-on="$listeners"
16
+ @click="toggleChecked"
17
+ >
18
+ <span
19
+ :class="[bem('track'), trackClass]"
20
+ :style="{ backgroundColor: checked ? onColor : offColor }"
21
+ >
22
+ <span :class="bem('spacer')"></span>
23
+ <span
24
+ :class="[bem('thumb'), trackClass]"
25
+ :style="{ backroundColor: thumbColor }"
26
+ ></span>
27
+ </span>
28
+ <slot name="on-label">
29
+ <span v-if="onLabel && syncChecked" :class="[bem('label'), labelClass]">
30
+ {{ onLabel }}
31
+ </span>
32
+ </slot>
33
+ <slot name="off-label">
34
+ <span v-if="offLabel && !syncChecked" :class="[bem('label'), labelClass]">
35
+ {{ offLabel }}
36
+ </span>
37
+ </slot>
38
+ <slot name="default"></slot>
39
+ </button>
40
+ </template>
41
+
42
+ <script>
43
+ import PxBaseToggle from './PxBaseToggle.vue';
44
+ import PxBaseVariants from './PxBaseVariants.vue';
45
+ export default {
46
+ name: 'px-toggle',
47
+ // components: { Component },
48
+ mixins: [PxBaseToggle, PxBaseVariants],
49
+ props: {
50
+ // label text to be displayed in on state (override with #on-label slot)
51
+ onLabel: { type: String, default: null },
52
+
53
+ // label text to be displayed in off state (override with #off-label slot)
54
+ offLabel: { type: String, default: null },
55
+
56
+ // class that will be applied to the track element
57
+ trackClass: { type: String, default: null },
58
+
59
+ // class that will be applied to the thumb element
60
+ thumbClass: { type: String, default: null },
61
+
62
+ // class that will be applied to the default on/off label element
63
+ labelClass: { type: String, default: null },
64
+
65
+ // color that will be set on track in the on state (use trackClass for further styling)
66
+ onColor: { type: String, default: null },
67
+
68
+ // color that will optionally be set on track in the off state (use trackClass for further styling)
69
+ offColor: { type: String, default: null },
70
+
71
+ // thumb color that will optionally be set on the thumb (use thumbClass for further styling)
72
+ thumbColor: { type: String, default: null },
73
+
74
+ // toggle the label/toggle order
75
+ reverse: { type: Boolean, default: false },
76
+ },
77
+ };
78
+ </script>
79
+
80
+ <style lang="scss">
81
+ @use '../styles/px.scss' as *;
82
+ .px-toggle {
83
+ --px-toggle-size: 1em;
84
+ --px-toggle-track: #{gray(-8, 0.33)};
85
+ --px-toggle-checked: #{accent()};
86
+ --px-toggle-thumb: white;
87
+
88
+ @include toggle-switch(
89
+ (
90
+ '--thumb:background-color': var(--px-toggle-thumb),
91
+ '--thumb:font-size': var(--px-toggle-size),
92
+ '--track:background-color': var(--px-toggle-track),
93
+ '--track:font-size': var(--px-toggle-size),
94
+ 'checked:--track:background-color': var(--px-toggle-checked),
95
+ ),
96
+ '.px-toggle__track',
97
+ '.px-toggle__thumb',
98
+ '.px-toggle__spacer'
99
+ );
100
+
101
+ &--reverse {
102
+ flex-direction: row-reverse;
103
+ }
104
+
105
+ // VARIANTS
106
+
107
+ // sm - resizes just the toggle (not the label) to fs(sm)
108
+
109
+ &--sm & {
110
+ &__track,
111
+ &__thumb {
112
+ font-size: fs(sm);
113
+ }
114
+ }
115
+
116
+ // xs - resizes just the toggle (not the label) to fs(xs)
117
+
118
+ &--xs & {
119
+ &__track,
120
+ &__thumb {
121
+ font-size: fs(xs);
122
+ }
123
+ }
124
+ }
125
+ </style>
@@ -0,0 +1,139 @@
1
+ <!--
2
+ Creates a toggle button (a control with the appearance of a normal button that can be toggle
3
+ between an on/off state).
4
+
5
+ <px-toggle :v-model="isChecked" variant="sm" />
6
+ -->
7
+
8
+ <template>
9
+ <button
10
+ :class="[
11
+ bem({ checked: syncChecked, icon: iconReady, ...variantsMap }),
12
+ checkedClass && syncChecked ? checkedClass : null,
13
+ ]"
14
+ role="switch"
15
+ :aria-checked="syncChecked"
16
+ v-on="$listeners"
17
+ v-bind="$attrs"
18
+ @click="toggleChecked"
19
+ >
20
+ <span
21
+ v-if="hasIcon"
22
+ :class="bem('icon')"
23
+ ref="icon"
24
+ :style="{
25
+ opacity: iconOpacity,
26
+ transform: iconTransform,
27
+ }"
28
+ >
29
+ <px-icon @loaded="iconLoaded" :src="icon" :size="iconSize" />
30
+ </span>
31
+ <span :class="bem('content')" :style="{ transform: iconTransform }">
32
+ <slot />
33
+ </span>
34
+ </button>
35
+ </template>
36
+
37
+ <script>
38
+ import PxBaseToggle from './PxBaseToggle.vue';
39
+ import PxBaseVariants from './PxBaseVariants.vue';
40
+ import PxIcon from './PxIcon.vue';
41
+
42
+ export default {
43
+ components: { PxIcon },
44
+ name: 'px-toggle-button',
45
+ mixins: [PxBaseToggle, PxBaseVariants],
46
+ props: {
47
+ // name of icon to be displayed when the button is in a checked state
48
+ icon: { type: String, default: require('../assets/icons/check.svg') },
49
+
50
+ // the size of the icon
51
+ iconSize: { default: null },
52
+ },
53
+ computed: {
54
+ hasIcon() {
55
+ return this.icon && this.iconWidth;
56
+ },
57
+ iconTransform() {
58
+ if (this.hasIcon) {
59
+ return this.syncChecked
60
+ ? `translateX(0)`
61
+ : `translateX(${this.cssPx(this.iconWidth / -2)})`;
62
+ }
63
+ return null;
64
+ },
65
+ iconOpacity() {
66
+ return this.syncChecked ? 1 : 0;
67
+ },
68
+ },
69
+ data() {
70
+ return {
71
+ iconReady: false,
72
+ iconWidth: 0,
73
+ };
74
+ },
75
+ methods: {
76
+ iconLoaded() {
77
+ this.iconWidth = this.$refs.icon.getBoundingClientRect().width;
78
+ setTimeout(() => {
79
+ // used to enable transitions only after the icon is loaded (and avoid a "bounce" on load)
80
+ this.iconReady = true;
81
+ });
82
+ },
83
+ },
84
+ };
85
+ </script>
86
+
87
+ <style lang="scss">
88
+ @use '../styles/px.scss' as *;
89
+
90
+ .px-toggle-button {
91
+ @include control-reset();
92
+ background: transparent;
93
+
94
+ @include bem(icon) {
95
+ position: relative;
96
+ display: inline-block;
97
+ padding-right: 0.33em;
98
+ display: inline-flex;
99
+ align-items: center;
100
+ }
101
+
102
+ &--icon {
103
+ @include bem(icon content) {
104
+ @include transition(transform opacity);
105
+ }
106
+ }
107
+
108
+ &--default {
109
+ // get base css from button, merged with toggle-button defaults (if defined)
110
+ $css: button(get('controls:toggle-button', (), false));
111
+
112
+ @include css-map($css);
113
+
114
+ @include aria-checked() {
115
+ $accent: get-control-accent($css, background, background-color);
116
+ $background: shade($accent, -4);
117
+ background-color: $background;
118
+ color: contrast-color($background);
119
+ box-shadow: none;
120
+ }
121
+ }
122
+
123
+ &--outline {
124
+ // get base css from button, merged with toggle-button defaults (if defined)
125
+ $css: button-outline(get('controls:toggle-button-outline', (), false));
126
+
127
+ $checked-accent: shade(get-control-accent($css, border-color, color), -4);
128
+
129
+ @include css-map($css);
130
+
131
+ @include aria-checked() {
132
+ @include transition(background border color);
133
+ background-color: $checked-accent;
134
+ border-color: $checked-accent;
135
+ color: contrast-color($checked-accent);
136
+ }
137
+ }
138
+ }
139
+ </style>