element-ps 2.0.36 → 2.0.37

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 (326) hide show
  1. package/dist/index.full.js +3 -1
  2. package/dist/index.full.min.js +1 -1
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +1 -1
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +3 -1
  7. package/es/components/alert/index.mjs +2 -2
  8. package/es/components/alert/src/alert.mjs +83 -33
  9. package/es/components/alert/src/alert.mjs.map +1 -1
  10. package/es/components/alert/src/alert2.mjs +33 -83
  11. package/es/components/alert/src/alert2.mjs.map +1 -1
  12. package/es/components/autocomplete/index.mjs +2 -2
  13. package/es/components/autocomplete/src/autocomplete.mjs +58 -94
  14. package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
  15. package/es/components/autocomplete/src/autocomplete2.mjs +94 -58
  16. package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
  17. package/es/components/avatar/index.mjs +2 -2
  18. package/es/components/avatar/src/avatar.mjs +29 -61
  19. package/es/components/avatar/src/avatar.mjs.map +1 -1
  20. package/es/components/avatar/src/avatar2.mjs +61 -29
  21. package/es/components/avatar/src/avatar2.mjs.map +1 -1
  22. package/es/components/badge/index.mjs +2 -2
  23. package/es/components/badge/src/badge.mjs +17 -54
  24. package/es/components/badge/src/badge.mjs.map +1 -1
  25. package/es/components/badge/src/badge2.mjs +54 -17
  26. package/es/components/badge/src/badge2.mjs.map +1 -1
  27. package/es/components/button/index.mjs +2 -2
  28. package/es/components/button/src/button-group.mjs +1 -1
  29. package/es/components/button/src/button.mjs +96 -48
  30. package/es/components/button/src/button.mjs.map +1 -1
  31. package/es/components/button/src/button2.mjs +48 -96
  32. package/es/components/button/src/button2.mjs.map +1 -1
  33. package/es/components/calendar/index.mjs +2 -2
  34. package/es/components/calendar/src/calendar.mjs +188 -9
  35. package/es/components/calendar/src/calendar.mjs.map +1 -1
  36. package/es/components/calendar/src/calendar2.mjs +9 -188
  37. package/es/components/calendar/src/calendar2.mjs.map +1 -1
  38. package/es/components/card/index.mjs +2 -2
  39. package/es/components/card/src/card.mjs +35 -15
  40. package/es/components/card/src/card.mjs.map +1 -1
  41. package/es/components/card/src/card2.mjs +15 -35
  42. package/es/components/card/src/card2.mjs.map +1 -1
  43. package/es/components/carousel/index.mjs +2 -2
  44. package/es/components/carousel/src/carousel.mjs +43 -201
  45. package/es/components/carousel/src/carousel.mjs.map +1 -1
  46. package/es/components/carousel/src/carousel2.mjs +201 -43
  47. package/es/components/carousel/src/carousel2.mjs.map +1 -1
  48. package/es/components/collection/index.mjs +1 -1
  49. package/es/components/collection/src/collection.mjs +30 -10
  50. package/es/components/collection/src/collection.mjs.map +1 -1
  51. package/es/components/collection/src/collection2.mjs +10 -30
  52. package/es/components/collection/src/collection2.mjs.map +1 -1
  53. package/es/components/dialog/src/dialog-content.mjs +34 -79
  54. package/es/components/dialog/src/dialog-content.mjs.map +1 -1
  55. package/es/components/dialog/src/dialog-content2.mjs +79 -34
  56. package/es/components/dialog/src/dialog-content2.mjs.map +1 -1
  57. package/es/components/dialog/src/dialog.mjs +1 -1
  58. package/es/components/dialog/src/dialog2.mjs +1 -1
  59. package/es/components/divider/index.mjs +2 -2
  60. package/es/components/divider/src/divider.mjs +34 -17
  61. package/es/components/divider/src/divider.mjs.map +1 -1
  62. package/es/components/divider/src/divider2.mjs +17 -34
  63. package/es/components/divider/src/divider2.mjs.map +1 -1
  64. package/es/components/drawer/index.mjs +2 -2
  65. package/es/components/drawer/src/drawer.mjs +117 -23
  66. package/es/components/drawer/src/drawer.mjs.map +1 -1
  67. package/es/components/drawer/src/drawer2.mjs +23 -117
  68. package/es/components/drawer/src/drawer2.mjs.map +1 -1
  69. package/es/components/dropdown/index.mjs +2 -2
  70. package/es/components/dropdown/src/dropdown-item-impl.mjs +1 -1
  71. package/es/components/dropdown/src/dropdown-item.mjs +1 -1
  72. package/es/components/dropdown/src/dropdown-menu.mjs +1 -1
  73. package/es/components/dropdown/src/dropdown.mjs +100 -109
  74. package/es/components/dropdown/src/dropdown.mjs.map +1 -1
  75. package/es/components/dropdown/src/dropdown2.mjs +109 -100
  76. package/es/components/dropdown/src/dropdown2.mjs.map +1 -1
  77. package/es/components/empty/index.mjs +2 -2
  78. package/es/components/empty/src/empty.mjs +11 -56
  79. package/es/components/empty/src/empty.mjs.map +1 -1
  80. package/es/components/empty/src/empty2.mjs +56 -11
  81. package/es/components/empty/src/empty2.mjs.map +1 -1
  82. package/es/components/form/index.mjs +4 -4
  83. package/es/components/form/src/form-item.mjs +171 -46
  84. package/es/components/form/src/form-item.mjs.map +1 -1
  85. package/es/components/form/src/form-item2.mjs +46 -171
  86. package/es/components/form/src/form-item2.mjs.map +1 -1
  87. package/es/components/form/src/form.mjs +45 -40
  88. package/es/components/form/src/form.mjs.map +1 -1
  89. package/es/components/form/src/form2.mjs +40 -45
  90. package/es/components/form/src/form2.mjs.map +1 -1
  91. package/es/components/icon/index.mjs +2 -2
  92. package/es/components/icon/src/icon.mjs +35 -8
  93. package/es/components/icon/src/icon.mjs.map +1 -1
  94. package/es/components/icon/src/icon2.mjs +8 -35
  95. package/es/components/icon/src/icon2.mjs.map +1 -1
  96. package/es/components/image/index.mjs +2 -2
  97. package/es/components/image/src/image.mjs +50 -127
  98. package/es/components/image/src/image.mjs.map +1 -1
  99. package/es/components/image/src/image2.mjs +127 -50
  100. package/es/components/image/src/image2.mjs.map +1 -1
  101. package/es/components/image-viewer/index.mjs +2 -2
  102. package/es/components/image-viewer/src/image-viewer.mjs +31 -210
  103. package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
  104. package/es/components/image-viewer/src/image-viewer2.mjs +210 -31
  105. package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
  106. package/es/components/index.mjs +27 -27
  107. package/es/components/menu/index.mjs +2 -2
  108. package/es/components/menu/src/menu-item-group.mjs +35 -4
  109. package/es/components/menu/src/menu-item-group.mjs.map +1 -1
  110. package/es/components/menu/src/menu-item-group2.mjs +4 -35
  111. package/es/components/menu/src/menu-item-group2.mjs.map +1 -1
  112. package/es/components/page-header/index.mjs +2 -2
  113. package/es/components/page-header/src/page-header.mjs +14 -55
  114. package/es/components/page-header/src/page-header.mjs.map +1 -1
  115. package/es/components/page-header/src/page-header2.mjs +55 -14
  116. package/es/components/page-header/src/page-header2.mjs.map +1 -1
  117. package/es/components/popconfirm/src/popconfirm.mjs +1 -1
  118. package/es/components/popconfirm/src/popconfirm2.mjs +4 -2
  119. package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
  120. package/es/components/popover/src/popover.mjs +1 -1
  121. package/es/components/popper/index.mjs +4 -4
  122. package/es/components/popper/src/arrow.mjs +31 -7
  123. package/es/components/popper/src/arrow.mjs.map +1 -1
  124. package/es/components/popper/src/arrow2.mjs +7 -31
  125. package/es/components/popper/src/arrow2.mjs.map +1 -1
  126. package/es/components/popper/src/content.mjs +64 -52
  127. package/es/components/popper/src/content.mjs.map +1 -1
  128. package/es/components/popper/src/content2.mjs +52 -64
  129. package/es/components/popper/src/content2.mjs.map +1 -1
  130. package/es/components/rate/index.mjs +2 -2
  131. package/es/components/rate/src/rate.mjs +84 -169
  132. package/es/components/rate/src/rate.mjs.map +1 -1
  133. package/es/components/rate/src/rate2.mjs +169 -84
  134. package/es/components/rate/src/rate2.mjs.map +1 -1
  135. package/es/components/roving-focus-group/src/roving-focus-group.mjs +1 -1
  136. package/es/components/tabs/index.mjs +1 -1
  137. package/es/components/tabs/src/tab-bar.mjs +76 -7
  138. package/es/components/tabs/src/tab-bar.mjs.map +1 -1
  139. package/es/components/tabs/src/tab-bar2.mjs +7 -76
  140. package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
  141. package/es/components/tabs/src/tab-nav.mjs +1 -1
  142. package/es/components/tooltip/src/tooltip.mjs +1 -1
  143. package/es/components/tooltip/src/tooltip2.mjs +1 -1
  144. package/es/components/tooltip-v2/index.mjs +2 -2
  145. package/es/components/tooltip-v2/src/arrow.mjs +22 -38
  146. package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
  147. package/es/components/tooltip-v2/src/arrow2.mjs +38 -22
  148. package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
  149. package/es/components/tooltip-v2/src/tooltip.mjs +2 -2
  150. package/es/components/tooltip-v2/src/tooltip2.mjs +4 -4
  151. package/es/components/tooltip-v2/src/trigger.mjs +11 -89
  152. package/es/components/tooltip-v2/src/trigger.mjs.map +1 -1
  153. package/es/components/tooltip-v2/src/trigger2.mjs +89 -11
  154. package/es/components/tooltip-v2/src/trigger2.mjs.map +1 -1
  155. package/es/components/upload/index.mjs +2 -2
  156. package/es/components/upload/src/upload-content.mjs +46 -15
  157. package/es/components/upload/src/upload-content.mjs.map +1 -1
  158. package/es/components/upload/src/upload-content2.mjs +15 -46
  159. package/es/components/upload/src/upload-content2.mjs.map +1 -1
  160. package/es/components/upload/src/upload-dragger.mjs +32 -11
  161. package/es/components/upload/src/upload-dragger.mjs.map +1 -1
  162. package/es/components/upload/src/upload-dragger2.mjs +11 -32
  163. package/es/components/upload/src/upload-dragger2.mjs.map +1 -1
  164. package/es/components/upload/src/upload2.mjs +1 -1
  165. package/es/index.mjs +27 -27
  166. package/lib/components/alert/index.js +2 -2
  167. package/lib/components/alert/src/alert.js +82 -33
  168. package/lib/components/alert/src/alert.js.map +1 -1
  169. package/lib/components/alert/src/alert2.js +33 -82
  170. package/lib/components/alert/src/alert2.js.map +1 -1
  171. package/lib/components/autocomplete/index.js +2 -2
  172. package/lib/components/autocomplete/src/autocomplete.js +58 -94
  173. package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
  174. package/lib/components/autocomplete/src/autocomplete2.js +94 -58
  175. package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
  176. package/lib/components/avatar/index.js +2 -2
  177. package/lib/components/avatar/src/avatar.js +29 -61
  178. package/lib/components/avatar/src/avatar.js.map +1 -1
  179. package/lib/components/avatar/src/avatar2.js +61 -29
  180. package/lib/components/avatar/src/avatar2.js.map +1 -1
  181. package/lib/components/badge/index.js +2 -2
  182. package/lib/components/badge/src/badge.js +17 -54
  183. package/lib/components/badge/src/badge.js.map +1 -1
  184. package/lib/components/badge/src/badge2.js +54 -17
  185. package/lib/components/badge/src/badge2.js.map +1 -1
  186. package/lib/components/button/index.js +2 -2
  187. package/lib/components/button/src/button-group.js +1 -1
  188. package/lib/components/button/src/button.js +96 -50
  189. package/lib/components/button/src/button.js.map +1 -1
  190. package/lib/components/button/src/button2.js +50 -96
  191. package/lib/components/button/src/button2.js.map +1 -1
  192. package/lib/components/calendar/index.js +2 -2
  193. package/lib/components/calendar/src/calendar.js +192 -9
  194. package/lib/components/calendar/src/calendar.js.map +1 -1
  195. package/lib/components/calendar/src/calendar2.js +9 -192
  196. package/lib/components/calendar/src/calendar2.js.map +1 -1
  197. package/lib/components/card/index.js +2 -2
  198. package/lib/components/card/src/card.js +35 -15
  199. package/lib/components/card/src/card.js.map +1 -1
  200. package/lib/components/card/src/card2.js +15 -35
  201. package/lib/components/card/src/card2.js.map +1 -1
  202. package/lib/components/carousel/index.js +2 -2
  203. package/lib/components/carousel/src/carousel.js +43 -201
  204. package/lib/components/carousel/src/carousel.js.map +1 -1
  205. package/lib/components/carousel/src/carousel2.js +201 -43
  206. package/lib/components/carousel/src/carousel2.js.map +1 -1
  207. package/lib/components/collection/index.js +1 -1
  208. package/lib/components/collection/src/collection.js +30 -9
  209. package/lib/components/collection/src/collection.js.map +1 -1
  210. package/lib/components/collection/src/collection2.js +9 -30
  211. package/lib/components/collection/src/collection2.js.map +1 -1
  212. package/lib/components/dialog/src/dialog-content.js +33 -78
  213. package/lib/components/dialog/src/dialog-content.js.map +1 -1
  214. package/lib/components/dialog/src/dialog-content2.js +78 -33
  215. package/lib/components/dialog/src/dialog-content2.js.map +1 -1
  216. package/lib/components/dialog/src/dialog.js +1 -1
  217. package/lib/components/dialog/src/dialog2.js +1 -1
  218. package/lib/components/divider/index.js +2 -2
  219. package/lib/components/divider/src/divider.js +34 -17
  220. package/lib/components/divider/src/divider.js.map +1 -1
  221. package/lib/components/divider/src/divider2.js +17 -34
  222. package/lib/components/divider/src/divider2.js.map +1 -1
  223. package/lib/components/drawer/index.js +2 -2
  224. package/lib/components/drawer/src/drawer.js +117 -23
  225. package/lib/components/drawer/src/drawer.js.map +1 -1
  226. package/lib/components/drawer/src/drawer2.js +23 -117
  227. package/lib/components/drawer/src/drawer2.js.map +1 -1
  228. package/lib/components/dropdown/index.js +2 -2
  229. package/lib/components/dropdown/src/dropdown-item-impl.js +1 -1
  230. package/lib/components/dropdown/src/dropdown-item.js +1 -1
  231. package/lib/components/dropdown/src/dropdown-menu.js +1 -1
  232. package/lib/components/dropdown/src/dropdown.js +109 -109
  233. package/lib/components/dropdown/src/dropdown.js.map +1 -1
  234. package/lib/components/dropdown/src/dropdown2.js +109 -109
  235. package/lib/components/dropdown/src/dropdown2.js.map +1 -1
  236. package/lib/components/empty/index.js +2 -2
  237. package/lib/components/empty/src/empty.js +11 -56
  238. package/lib/components/empty/src/empty.js.map +1 -1
  239. package/lib/components/empty/src/empty2.js +56 -11
  240. package/lib/components/empty/src/empty2.js.map +1 -1
  241. package/lib/components/form/index.js +4 -4
  242. package/lib/components/form/src/form-item.js +171 -47
  243. package/lib/components/form/src/form-item.js.map +1 -1
  244. package/lib/components/form/src/form-item2.js +47 -171
  245. package/lib/components/form/src/form-item2.js.map +1 -1
  246. package/lib/components/form/src/form.js +45 -40
  247. package/lib/components/form/src/form.js.map +1 -1
  248. package/lib/components/form/src/form2.js +40 -45
  249. package/lib/components/form/src/form2.js.map +1 -1
  250. package/lib/components/icon/index.js +2 -2
  251. package/lib/components/icon/src/icon.js +35 -8
  252. package/lib/components/icon/src/icon.js.map +1 -1
  253. package/lib/components/icon/src/icon2.js +8 -35
  254. package/lib/components/icon/src/icon2.js.map +1 -1
  255. package/lib/components/image/index.js +2 -2
  256. package/lib/components/image/src/image.js +50 -127
  257. package/lib/components/image/src/image.js.map +1 -1
  258. package/lib/components/image/src/image2.js +127 -50
  259. package/lib/components/image/src/image2.js.map +1 -1
  260. package/lib/components/image-viewer/index.js +2 -2
  261. package/lib/components/image-viewer/src/image-viewer.js +31 -210
  262. package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
  263. package/lib/components/image-viewer/src/image-viewer2.js +210 -31
  264. package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
  265. package/lib/components/index.js +27 -27
  266. package/lib/components/menu/index.js +2 -2
  267. package/lib/components/menu/src/menu-item-group.js +35 -4
  268. package/lib/components/menu/src/menu-item-group.js.map +1 -1
  269. package/lib/components/menu/src/menu-item-group2.js +4 -35
  270. package/lib/components/menu/src/menu-item-group2.js.map +1 -1
  271. package/lib/components/page-header/index.js +2 -2
  272. package/lib/components/page-header/src/page-header.js +14 -55
  273. package/lib/components/page-header/src/page-header.js.map +1 -1
  274. package/lib/components/page-header/src/page-header2.js +55 -14
  275. package/lib/components/page-header/src/page-header2.js.map +1 -1
  276. package/lib/components/popconfirm/src/popconfirm.js +1 -1
  277. package/lib/components/popconfirm/src/popconfirm2.js +3 -1
  278. package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
  279. package/lib/components/popover/src/popover.js +1 -1
  280. package/lib/components/popper/index.js +4 -4
  281. package/lib/components/popper/src/arrow.js +31 -7
  282. package/lib/components/popper/src/arrow.js.map +1 -1
  283. package/lib/components/popper/src/arrow2.js +7 -31
  284. package/lib/components/popper/src/arrow2.js.map +1 -1
  285. package/lib/components/popper/src/content.js +65 -52
  286. package/lib/components/popper/src/content.js.map +1 -1
  287. package/lib/components/popper/src/content2.js +52 -65
  288. package/lib/components/popper/src/content2.js.map +1 -1
  289. package/lib/components/rate/index.js +2 -2
  290. package/lib/components/rate/src/rate.js +84 -169
  291. package/lib/components/rate/src/rate.js.map +1 -1
  292. package/lib/components/rate/src/rate2.js +169 -84
  293. package/lib/components/rate/src/rate2.js.map +1 -1
  294. package/lib/components/roving-focus-group/src/roving-focus-group.js +1 -1
  295. package/lib/components/tabs/index.js +1 -1
  296. package/lib/components/tabs/src/tab-bar.js +76 -7
  297. package/lib/components/tabs/src/tab-bar.js.map +1 -1
  298. package/lib/components/tabs/src/tab-bar2.js +7 -76
  299. package/lib/components/tabs/src/tab-bar2.js.map +1 -1
  300. package/lib/components/tabs/src/tab-nav.js +1 -1
  301. package/lib/components/tooltip/src/tooltip.js +1 -1
  302. package/lib/components/tooltip/src/tooltip2.js +1 -1
  303. package/lib/components/tooltip-v2/index.js +2 -2
  304. package/lib/components/tooltip-v2/src/arrow.js +23 -38
  305. package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
  306. package/lib/components/tooltip-v2/src/arrow2.js +38 -23
  307. package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
  308. package/lib/components/tooltip-v2/src/tooltip.js +2 -2
  309. package/lib/components/tooltip-v2/src/tooltip2.js +4 -4
  310. package/lib/components/tooltip-v2/src/trigger.js +11 -89
  311. package/lib/components/tooltip-v2/src/trigger.js.map +1 -1
  312. package/lib/components/tooltip-v2/src/trigger2.js +89 -11
  313. package/lib/components/tooltip-v2/src/trigger2.js.map +1 -1
  314. package/lib/components/upload/index.js +2 -2
  315. package/lib/components/upload/src/upload-content.js +46 -15
  316. package/lib/components/upload/src/upload-content.js.map +1 -1
  317. package/lib/components/upload/src/upload-content2.js +15 -46
  318. package/lib/components/upload/src/upload-content2.js.map +1 -1
  319. package/lib/components/upload/src/upload-dragger.js +32 -12
  320. package/lib/components/upload/src/upload-dragger.js.map +1 -1
  321. package/lib/components/upload/src/upload-dragger2.js +12 -32
  322. package/lib/components/upload/src/upload-dragger2.js.map +1 -1
  323. package/lib/components/upload/src/upload2.js +1 -1
  324. package/lib/index.js +27 -27
  325. package/package.json +1 -1
  326. package/web-types.json +1 -1
@@ -1,13 +1,82 @@
1
+ import { defineComponent, getCurrentInstance, inject, ref, watch, nextTick, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle } from 'vue';
2
+ import { useResizeObserver } from '@vueuse/core';
1
3
  import '../../../utils/index.mjs';
2
- import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
3
- import { mutable } from '../../../utils/typescript.mjs';
4
+ import '../../../tokens/index.mjs';
5
+ import '../../../hooks/index.mjs';
6
+ import { tabBarProps } from './tab-bar2.mjs';
7
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
8
+ import { tabsRootContextKey } from '../../../tokens/tabs.mjs';
9
+ import { throwError } from '../../../utils/error.mjs';
10
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
11
+ import { capitalize } from '@vue/shared';
4
12
 
5
- const tabBarProps = buildProps({
6
- tabs: {
7
- type: definePropType(Array),
8
- default: () => mutable([])
13
+ const __default__ = {
14
+ name: "PsTabBar"
15
+ };
16
+ const _sfc_main = /* @__PURE__ */ defineComponent({
17
+ ...__default__,
18
+ props: tabBarProps,
19
+ setup(__props, { expose }) {
20
+ const props = __props;
21
+ const COMPONENT_NAME = "PsTabBar";
22
+ const instance = getCurrentInstance();
23
+ const rootTabs = inject(tabsRootContextKey);
24
+ if (!rootTabs)
25
+ throwError(COMPONENT_NAME, "<ps-tabs><ps-tab-bar /></ps-tabs>");
26
+ const ns = useNamespace("tabs");
27
+ const barRef = ref();
28
+ const barStyle = ref();
29
+ const getBarStyle = () => {
30
+ let offset = 0;
31
+ let tabSize = 0;
32
+ const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
33
+ const sizeDir = sizeName === "width" ? "x" : "y";
34
+ props.tabs.every((tab) => {
35
+ var _a, _b, _c, _d;
36
+ const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.paneName}`];
37
+ if (!$el)
38
+ return false;
39
+ if (!tab.active) {
40
+ return true;
41
+ }
42
+ tabSize = $el[`client${capitalize(sizeName)}`];
43
+ const position = sizeDir === "x" ? "left" : "top";
44
+ offset = $el.getBoundingClientRect()[position] - ((_d = (_c = $el.parentElement) == null ? void 0 : _c.getBoundingClientRect()[position]) != null ? _d : 0);
45
+ const tabStyles = window.getComputedStyle($el);
46
+ if (sizeName === "width") {
47
+ if (props.tabs.length > 1) {
48
+ tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
49
+ }
50
+ offset += Number.parseFloat(tabStyles.paddingLeft);
51
+ }
52
+ return false;
53
+ });
54
+ return {
55
+ [sizeName]: `${tabSize}px`,
56
+ transform: `translate${capitalize(sizeDir)}(${offset}px)`
57
+ };
58
+ };
59
+ const update = () => barStyle.value = getBarStyle();
60
+ watch(() => props.tabs, async () => {
61
+ await nextTick();
62
+ update();
63
+ }, { immediate: true });
64
+ useResizeObserver(barRef, () => update());
65
+ expose({
66
+ ref: barRef,
67
+ update
68
+ });
69
+ return (_ctx, _cache) => {
70
+ return openBlock(), createElementBlock("div", {
71
+ ref_key: "barRef",
72
+ ref: barRef,
73
+ class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
74
+ style: normalizeStyle(barStyle.value)
75
+ }, null, 6);
76
+ };
9
77
  }
10
78
  });
79
+ var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/tabs/src/tab-bar.vue"]]);
11
80
 
12
- export { tabBarProps };
81
+ export { TabBar as default };
13
82
  //# sourceMappingURL=tab-bar.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tab-bar.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.ts"],"sourcesContent":["import { buildProps, definePropType, mutable } from '@element-ps/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type { TabsPaneContext } from '@element-ps/tokens'\nimport type TabBar from './tab-bar.vue'\n\nexport const tabBarProps = buildProps({\n tabs: {\n type: definePropType<TabsPaneContext[]>(Array),\n default: () => mutable([] as const),\n },\n} as const)\n\nexport type TabBarProps = ExtractPropTypes<typeof tabBarProps>\nexport type TabBarInstance = InstanceType<typeof TabBar>\n"],"names":[],"mappings":";;;;AACY,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC;AAC9B,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"tab-bar.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.vue"],"sourcesContent":["<template>\n <div\n ref=\"barRef\"\n :class=\"[ns.e('active-bar'), ns.is(rootTabs.props.tabPosition)]\"\n :style=\"barStyle\"\n />\n</template>\n<script lang=\"ts\" setup>\nimport { getCurrentInstance, inject, nextTick, ref, watch } from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { capitalize, throwError } from '@element-ps/utils'\nimport { tabsRootContextKey } from '@element-ps/tokens'\nimport { useNamespace } from '@element-ps/hooks'\nimport { tabBarProps } from './tab-bar'\n\nimport type { CSSProperties } from 'vue'\n\nconst COMPONENT_NAME = 'PsTabBar'\ndefineOptions({\n name: 'PsTabBar',\n})\nconst props = defineProps(tabBarProps)\n\nconst instance = getCurrentInstance()!\nconst rootTabs = inject(tabsRootContextKey)\nif (!rootTabs) throwError(COMPONENT_NAME, '<ps-tabs><ps-tab-bar /></ps-tabs>')\n\nconst ns = useNamespace('tabs')\n\nconst barRef = ref<HTMLDivElement>()\nconst barStyle = ref<CSSProperties>()\n\nconst getBarStyle = (): CSSProperties => {\n let offset = 0\n let tabSize = 0\n\n const sizeName = ['top', 'bottom'].includes(rootTabs.props.tabPosition)\n ? 'width'\n : 'height'\n const sizeDir = sizeName === 'width' ? 'x' : 'y'\n\n props.tabs.every((tab) => {\n const $el = instance.parent?.refs?.[`tab-${tab.paneName}`] as HTMLElement\n if (!$el) return false\n\n if (!tab.active) {\n return true\n }\n\n tabSize = $el[`client${capitalize(sizeName)}`]\n const position = sizeDir === 'x' ? 'left' : 'top'\n offset =\n $el.getBoundingClientRect()[position] -\n ($el.parentElement?.getBoundingClientRect()[position] ?? 0)\n const tabStyles = window.getComputedStyle($el)\n\n if (sizeName === 'width') {\n if (props.tabs.length > 1) {\n tabSize -=\n Number.parseFloat(tabStyles.paddingLeft) +\n Number.parseFloat(tabStyles.paddingRight)\n }\n offset += Number.parseFloat(tabStyles.paddingLeft)\n }\n return false\n })\n\n return {\n [sizeName]: `${tabSize}px`,\n transform: `translate${capitalize(sizeDir)}(${offset}px)`,\n }\n}\n\nconst update = () => (barStyle.value = getBarStyle())\n\nwatch(\n () => props.tabs,\n async () => {\n await nextTick()\n update()\n },\n { immediate: true }\n)\nuseResizeObserver(barRef, () => update())\n\ndefineExpose({\n /** @description tab root html element */\n ref: barRef,\n /** @description method to manually update tab bar style */\n update,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAiBA,IAAA,MAAA,cAAA,GAAA,UAAA,CAAA;AAMA,IAAA,MAAA,WAAA,kBAAA,EAAA,CAAA;AACA,IAAA,MAAA,QAAA,GAAA,OAAA,kBAAA,CAAA,CAAA;AACA,IAAA,IAAA,CAAA,QAAA;AAAA,MAAA,UAAA,CAAA,gBAAA,mCAAA,CAAA,CAAA;AAEA,IAAA,MAAA,EAAA,GAAA,aAAA,MAAA,CAAA,CAAA;AAEA,IAAA,MAAA,SAAA,GAAA,EAAA,CAAA;AACA,IAAA,MAAA,WAAA,GAAA,EAAA,CAAA;AAEA,IAAA,MAAA,cAAA,MAAA;AACA,MAAA,IAAA,MAAA,GAAA,CAAA,CAAA;AACA,MAAA,IAAA,OAAA,GAAA,CAAA,CAAA;AAEA,MAAA,MAAA,QAAA,GAAA,CAAA,KAAA,EAAA,QAAA,CAAA,CAAA,SAAA,QAAA,CAAA,KAAA,CAAA,WAAA,CAAA,GACA,OACA,GAAA,QAAA,CAAA;AACA,MAAA,MAAA,OAAA,GAAA,QAAA,KAAA,OAAA,GAAA,GAAA,GAAA,GAAA,CAAA;AAEA,MAAA,KAAA,CAAA,IAAA,CAAA,KAAA,CAAA,CAAA,GAAA,KAAA;AACA,QAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AACA,QAAA,MAAA,GAAA,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,QAAA,CAAA,MAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,CAAA,IAAA,EAAA,GAAA,CAAA,QAAA,CAAA,CAAA,CAAA,CAAA;AAAA,QAAA,IAAA,CAAA,GAAA;AAEA,UAAA,OAAA,KAAA,CAAA;AACA,QAAA,IAAA,CAAA,GAAA,CAAA,MAAA,EAAA;AAAA,UACA,OAAA,IAAA,CAAA;AAEA,SAAA;AACA,QAAA,OAAA,GAAA,GAAA,CAAA,CAAA,MAAA,EAAA,UAAA,CAAA,QAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA,QACA,MAAA,6BAAA,MAAA,GAAA,KACA;AACA,QAAA,MAAA,GAAA,GAAA,CAAA,qBAAA,EAAA,CAAA,QAAA,CAAA,IAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,GAAA,CAAA,aAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,qBAAA,EAAA,CAAA,QAAA,CAAA,KAAA,IAAA,GAAA,EAAA,GAAA,CAAA,CAAA,CAAA;AAEA,QAAA,kBAAA,MAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA;AACA,QAAA,IAAA,QAAA,KAAA,OAAA,EAAA;AACA,UACA,IAAA,KAAA,CAAA,IAAA,CAAA;AACA,YACA,OAAA,IAAA,MAAA,CAAA,UAAA,CAAA,SAAA,CAAA,WAAA,CAAA,GAAA,MAAA,CAAA,UAAA,CAAA,SAAA,CAAA,YAAA,CAAA,CAAA;AACA,WAAA;AAAA,UACA,MAAA,IAAA,MAAA,CAAA,UAAA,CAAA,SAAA,CAAA,WAAA,CAAA,CAAA;AACA,SAAA;AAAA,QACA,OAAA,KAAA,CAAA;AAEA,OAAA,CAAA,CAAA;AAAA,MAAA;AACA,QACA,CAAA,QAAA,GAAA,CAAA,EAAA,OAAA,CAAA,EAAA,CAAA;AAAA,QACA,SAAA,EAAA,CAAA,SAAA,EAAA,UAAA,CAAA,OAAA,CAAA,CAAA,CAAA,EAAA,MAAA,CAAA,GAAA,CAAA;AAAA,OACA,CAAA;AAEA,KAAA,CAAA;AAEA,IACA,MAAA,MAAA,GAAA,MAAA,QACA,CAAA,KAAA,GAAA,WAAA,EAAA,CAAA;AACA,IAAA,KAAA,CAAA,MAAA,KAAA,CAAA,IAAA,EAAA,YAAA;AACA,MAAA,MAAA,QAAA,EAAA,CAAA;AAAA,MAEA,MAAA,EAAA,CAAA;AAEA,KAAA,EAAA,EAAA,SAAA,EAAA,IAAA,EAAA,CAAA,CAAA;AAEA,IAAA,iBAAA,CAAA,MAAA,EAAA,MAAA,MAAA,EAAA,CAAA,CAAA;AAAA,IAAA,MAEA,CAAA;AAAA,MAEA,GAAA,EAAA,MAAA;AAAA,MACA,MAAA;;;;;;;;;;;;;;;;"}
@@ -1,82 +1,13 @@
1
- import { defineComponent, getCurrentInstance, inject, ref, watch, nextTick, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle } from 'vue';
2
- import { useResizeObserver } from '@vueuse/core';
3
1
  import '../../../utils/index.mjs';
4
- import '../../../tokens/index.mjs';
5
- import '../../../hooks/index.mjs';
6
- import { tabBarProps } from './tab-bar.mjs';
7
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
8
- import { tabsRootContextKey } from '../../../tokens/tabs.mjs';
9
- import { throwError } from '../../../utils/error.mjs';
10
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
11
- import { capitalize } from '@vue/shared';
2
+ import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
3
+ import { mutable } from '../../../utils/typescript.mjs';
12
4
 
13
- const __default__ = {
14
- name: "PsTabBar"
15
- };
16
- const _sfc_main = /* @__PURE__ */ defineComponent({
17
- ...__default__,
18
- props: tabBarProps,
19
- setup(__props, { expose }) {
20
- const props = __props;
21
- const COMPONENT_NAME = "PsTabBar";
22
- const instance = getCurrentInstance();
23
- const rootTabs = inject(tabsRootContextKey);
24
- if (!rootTabs)
25
- throwError(COMPONENT_NAME, "<ps-tabs><ps-tab-bar /></ps-tabs>");
26
- const ns = useNamespace("tabs");
27
- const barRef = ref();
28
- const barStyle = ref();
29
- const getBarStyle = () => {
30
- let offset = 0;
31
- let tabSize = 0;
32
- const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
33
- const sizeDir = sizeName === "width" ? "x" : "y";
34
- props.tabs.every((tab) => {
35
- var _a, _b, _c, _d;
36
- const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.paneName}`];
37
- if (!$el)
38
- return false;
39
- if (!tab.active) {
40
- return true;
41
- }
42
- tabSize = $el[`client${capitalize(sizeName)}`];
43
- const position = sizeDir === "x" ? "left" : "top";
44
- offset = $el.getBoundingClientRect()[position] - ((_d = (_c = $el.parentElement) == null ? void 0 : _c.getBoundingClientRect()[position]) != null ? _d : 0);
45
- const tabStyles = window.getComputedStyle($el);
46
- if (sizeName === "width") {
47
- if (props.tabs.length > 1) {
48
- tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
49
- }
50
- offset += Number.parseFloat(tabStyles.paddingLeft);
51
- }
52
- return false;
53
- });
54
- return {
55
- [sizeName]: `${tabSize}px`,
56
- transform: `translate${capitalize(sizeDir)}(${offset}px)`
57
- };
58
- };
59
- const update = () => barStyle.value = getBarStyle();
60
- watch(() => props.tabs, async () => {
61
- await nextTick();
62
- update();
63
- }, { immediate: true });
64
- useResizeObserver(barRef, () => update());
65
- expose({
66
- ref: barRef,
67
- update
68
- });
69
- return (_ctx, _cache) => {
70
- return openBlock(), createElementBlock("div", {
71
- ref_key: "barRef",
72
- ref: barRef,
73
- class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
74
- style: normalizeStyle(barStyle.value)
75
- }, null, 6);
76
- };
5
+ const tabBarProps = buildProps({
6
+ tabs: {
7
+ type: definePropType(Array),
8
+ default: () => mutable([])
77
9
  }
78
10
  });
79
- var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/tabs/src/tab-bar.vue"]]);
80
11
 
81
- export { TabBar as default };
12
+ export { tabBarProps };
82
13
  //# sourceMappingURL=tab-bar2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tab-bar2.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.vue"],"sourcesContent":["<template>\n <div\n ref=\"barRef\"\n :class=\"[ns.e('active-bar'), ns.is(rootTabs.props.tabPosition)]\"\n :style=\"barStyle\"\n />\n</template>\n<script lang=\"ts\" setup>\nimport { getCurrentInstance, inject, nextTick, ref, watch } from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { capitalize, throwError } from '@element-ps/utils'\nimport { tabsRootContextKey } from '@element-ps/tokens'\nimport { useNamespace } from '@element-ps/hooks'\nimport { tabBarProps } from './tab-bar'\n\nimport type { CSSProperties } from 'vue'\n\nconst COMPONENT_NAME = 'PsTabBar'\ndefineOptions({\n name: 'PsTabBar',\n})\nconst props = defineProps(tabBarProps)\n\nconst instance = getCurrentInstance()!\nconst rootTabs = inject(tabsRootContextKey)\nif (!rootTabs) throwError(COMPONENT_NAME, '<ps-tabs><ps-tab-bar /></ps-tabs>')\n\nconst ns = useNamespace('tabs')\n\nconst barRef = ref<HTMLDivElement>()\nconst barStyle = ref<CSSProperties>()\n\nconst getBarStyle = (): CSSProperties => {\n let offset = 0\n let tabSize = 0\n\n const sizeName = ['top', 'bottom'].includes(rootTabs.props.tabPosition)\n ? 'width'\n : 'height'\n const sizeDir = sizeName === 'width' ? 'x' : 'y'\n\n props.tabs.every((tab) => {\n const $el = instance.parent?.refs?.[`tab-${tab.paneName}`] as HTMLElement\n if (!$el) return false\n\n if (!tab.active) {\n return true\n }\n\n tabSize = $el[`client${capitalize(sizeName)}`]\n const position = sizeDir === 'x' ? 'left' : 'top'\n offset =\n $el.getBoundingClientRect()[position] -\n ($el.parentElement?.getBoundingClientRect()[position] ?? 0)\n const tabStyles = window.getComputedStyle($el)\n\n if (sizeName === 'width') {\n if (props.tabs.length > 1) {\n tabSize -=\n Number.parseFloat(tabStyles.paddingLeft) +\n Number.parseFloat(tabStyles.paddingRight)\n }\n offset += Number.parseFloat(tabStyles.paddingLeft)\n }\n return false\n })\n\n return {\n [sizeName]: `${tabSize}px`,\n transform: `translate${capitalize(sizeDir)}(${offset}px)`,\n }\n}\n\nconst update = () => (barStyle.value = getBarStyle())\n\nwatch(\n () => props.tabs,\n async () => {\n await nextTick()\n update()\n },\n { immediate: true }\n)\nuseResizeObserver(barRef, () => update())\n\ndefineExpose({\n /** @description tab root html element */\n ref: barRef,\n /** @description method to manually update tab bar style */\n update,\n})\n</script>\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"tab-bar2.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.ts"],"sourcesContent":["import { buildProps, definePropType, mutable } from '@element-ps/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type { TabsPaneContext } from '@element-ps/tokens'\nimport type TabBar from './tab-bar.vue'\n\nexport const tabBarProps = buildProps({\n tabs: {\n type: definePropType<TabsPaneContext[]>(Array),\n default: () => mutable([] as const),\n },\n} as const)\n\nexport type TabBarProps = ExtractPropTypes<typeof tabBarProps>\nexport type TabBarInstance = InstanceType<typeof TabBar>\n"],"names":[],"mappings":";;;;AACY,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC;AAC9B,GAAG;AACH,CAAC;;;;"}
@@ -7,7 +7,7 @@ import { PsIcon } from '../../icon/index.mjs';
7
7
  import { ArrowLeft, ArrowRight, Close } from '@element-plus/icons-vue';
8
8
  import '../../../tokens/index.mjs';
9
9
  import '../../../hooks/index.mjs';
10
- import TabBar from './tab-bar2.mjs';
10
+ import TabBar from './tab-bar.mjs';
11
11
  import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
12
12
  import { mutable } from '../../../utils/typescript.mjs';
13
13
  import { tabsRootContextKey } from '../../../tokens/tabs.mjs';
@@ -3,7 +3,7 @@ import '../../popper/index.mjs';
3
3
  import '../../../hooks/index.mjs';
4
4
  import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
5
5
  import { useDelayedToggleProps } from '../../../hooks/use-delayed-toggle/index.mjs';
6
- import { usePopperContentProps } from '../../popper/src/content2.mjs';
6
+ import { usePopperContentProps } from '../../popper/src/content.mjs';
7
7
  import { POPPER_CONTAINER_SELECTOR } from '../../../hooks/use-popper-container/index.mjs';
8
8
  import { usePopperTriggerProps } from '../../popper/src/trigger.mjs';
9
9
 
@@ -7,7 +7,7 @@ import { useTooltipContentProps, useTooltipTriggerProps, useTooltipProps } from
7
7
  import { TOOLTIP_INJECTION_KEY } from './tokens.mjs';
8
8
  import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
9
9
  import { createModelToggleComposable } from '../../../hooks/use-model-toggle/index.mjs';
10
- import { usePopperArrowProps } from '../../popper/src/arrow.mjs';
10
+ import { usePopperArrowProps } from '../../popper/src/arrow2.mjs';
11
11
  import { usePopperContainer } from '../../../hooks/use-popper-container/index.mjs';
12
12
  import { useId } from '../../../hooks/use-id/index.mjs';
13
13
  import { isBoolean } from '@vueuse/core';
@@ -1,10 +1,10 @@
1
1
  import '../../utils/index.mjs';
2
2
  import TooltipV2 from './src/tooltip2.mjs';
3
- export { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './src/arrow2.mjs';
3
+ export { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './src/arrow.mjs';
4
4
  export { tooltipV2ContentProps } from './src/content.mjs';
5
5
  export { tooltipV2RootProps } from './src/root.mjs';
6
6
  export { tooltipV2Props } from './src/tooltip.mjs';
7
- export { tooltipV2TriggerProps } from './src/trigger2.mjs';
7
+ export { tooltipV2TriggerProps } from './src/trigger.mjs';
8
8
  import { withInstall } from '../../utils/vue/install.mjs';
9
9
 
10
10
  const PsTooltipV2 = withInstall(TooltipV2);
@@ -1,44 +1,28 @@
1
- import { defineComponent, inject, computed, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass } from 'vue';
2
- import '../../../tokens/index.mjs';
3
- import { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './arrow2.mjs';
4
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
- import { tooltipV2RootKey, tooltipV2ContentKey } from '../../../tokens/tooltip-v2.mjs';
1
+ import '../../../utils/index.mjs';
2
+ import { tooltipV2Sides } from './common.mjs';
3
+ import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
6
4
 
7
- const __default__ = {
8
- name: "PsTooltipV2Arrow"
9
- };
10
- const _sfc_main = /* @__PURE__ */ defineComponent({
11
- ...__default__,
12
- props: {
13
- ...tooltipV2ArrowProps,
14
- ...tooltipV2ArrowSpecialProps
5
+ const tooltipV2ArrowProps = buildProps({
6
+ width: {
7
+ type: Number,
8
+ default: 10
15
9
  },
16
- setup(__props) {
17
- const props = __props;
18
- const { ns } = inject(tooltipV2RootKey);
19
- const { arrowRef } = inject(tooltipV2ContentKey);
20
- const arrowStyle = computed(() => {
21
- const { style, width, height } = props;
22
- const namespace = ns.namespace.value;
23
- return {
24
- [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
25
- [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
26
- [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
27
- [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
28
- ...style || {}
29
- };
30
- });
31
- return (_ctx, _cache) => {
32
- return openBlock(), createElementBlock("span", {
33
- ref_key: "arrowRef",
34
- ref: arrowRef,
35
- style: normalizeStyle(unref(arrowStyle)),
36
- class: normalizeClass(unref(ns).e("arrow"))
37
- }, null, 6);
38
- };
10
+ height: {
11
+ type: Number,
12
+ default: 10
13
+ },
14
+ style: {
15
+ type: definePropType(Object),
16
+ default: null
17
+ }
18
+ });
19
+ const tooltipV2ArrowSpecialProps = buildProps({
20
+ side: {
21
+ type: definePropType(String),
22
+ values: tooltipV2Sides,
23
+ required: true
39
24
  }
40
25
  });
41
- var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/tooltip-v2/src/arrow.vue"]]);
42
26
 
43
- export { TooltipV2Arrow as default };
27
+ export { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps };
44
28
  //# sourceMappingURL=arrow.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrow.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/arrow.vue"],"sourcesContent":["<template>\n <span ref=\"arrowRef\" :style=\"arrowStyle\" :class=\"ns.e('arrow')\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, inject } from 'vue'\nimport { tooltipV2ContentKey, tooltipV2RootKey } from '@element-ps/tokens'\nimport { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './arrow'\n\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'PsTooltipV2Arrow',\n})\n\nconst props = defineProps({\n ...tooltipV2ArrowProps,\n ...tooltipV2ArrowSpecialProps,\n})\n\nconst { ns } = inject(tooltipV2RootKey)!\nconst { arrowRef } = inject(tooltipV2ContentKey)!\n\nconst arrowStyle = computed<CSSProperties>(() => {\n const { style, width, height } = props\n const namespace = ns.namespace.value\n\n return {\n [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,\n [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,\n [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,\n [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,\n ...(style || {}),\n }\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAoBA,IAAA,MAAA,EAAA,EAAA,EAAA,GAAA,MAAA,CAAA,gBAAA,CAAA,CAAA;AACA,IAAA,MAAA,EAAA,QAAA,EAAA,GAAA,MAAA,CAAA,mBAAA,CAAA,CAAA;AAEA,IAAA,MAAA,UAAA,GAAA,SAAA,MAAA;AACA,MAAA,MAAA,EAAA,KAAA,EAAA,KAAA,EAAA,MAAA,EAAA,GAAA,KAAA,CAAA;AACA,MAAA,MAAA,SAAA,GAAA,GAAA,SAAA,CAAA,KAAA,CAAA;AAEA,MAAA,OAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,qCAAA,CAAA,EAAA,KAAA,CAAA,EAAA,CAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,sCAAA,CAAA,EAAA,MAAA,CAAA,EAAA,CAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,SAAA,CAAA,8BAAA,CAAA,GAAA,CAAA,EAAA,KAAA,GAAA,CAAA,CAAA,EAAA,CAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,SAAA,CAAA,6BAAA,CAAA,GAAA,KAAA,GAAA,CAAA,GAAA,CAAA;AAAA,QAAA,GACA,SAAA,EAAA;AAAA,OACA,CAAA;AAAA,KACA,CAAA,CAAA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"arrow.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/arrow.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-ps/utils'\nimport { tooltipV2Sides } from './common'\n\nimport type { CSSProperties, ExtractPropTypes } from 'vue'\nimport type { TooltipV2Sides } from './common'\n\nexport const tooltipV2ArrowProps = buildProps({\n width: {\n type: Number,\n default: 10,\n },\n height: {\n type: Number,\n default: 10,\n },\n style: {\n type: definePropType<CSSProperties | null>(Object),\n default: null,\n },\n} as const)\n\nexport const tooltipV2ArrowSpecialProps = buildProps({\n side: {\n type: definePropType<TooltipV2Sides>(String),\n values: tooltipV2Sides,\n required: true,\n },\n} as const)\n\nexport type TooltipV2ArrowProps = ExtractPropTypes<typeof tooltipV2ArrowProps>\n"],"names":[],"mappings":";;;;AAEY,MAAC,mBAAmB,GAAG,UAAU,CAAC;AAC9C,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,0BAA0B,GAAG,UAAU,CAAC;AACrD,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,CAAC;;;;"}
@@ -1,28 +1,44 @@
1
- import '../../../utils/index.mjs';
2
- import { tooltipV2Sides } from './common.mjs';
3
- import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
1
+ import { defineComponent, inject, computed, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass } from 'vue';
2
+ import '../../../tokens/index.mjs';
3
+ import { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './arrow.mjs';
4
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
+ import { tooltipV2RootKey, tooltipV2ContentKey } from '../../../tokens/tooltip-v2.mjs';
4
6
 
5
- const tooltipV2ArrowProps = buildProps({
6
- width: {
7
- type: Number,
8
- default: 10
7
+ const __default__ = {
8
+ name: "PsTooltipV2Arrow"
9
+ };
10
+ const _sfc_main = /* @__PURE__ */ defineComponent({
11
+ ...__default__,
12
+ props: {
13
+ ...tooltipV2ArrowProps,
14
+ ...tooltipV2ArrowSpecialProps
9
15
  },
10
- height: {
11
- type: Number,
12
- default: 10
13
- },
14
- style: {
15
- type: definePropType(Object),
16
- default: null
17
- }
18
- });
19
- const tooltipV2ArrowSpecialProps = buildProps({
20
- side: {
21
- type: definePropType(String),
22
- values: tooltipV2Sides,
23
- required: true
16
+ setup(__props) {
17
+ const props = __props;
18
+ const { ns } = inject(tooltipV2RootKey);
19
+ const { arrowRef } = inject(tooltipV2ContentKey);
20
+ const arrowStyle = computed(() => {
21
+ const { style, width, height } = props;
22
+ const namespace = ns.namespace.value;
23
+ return {
24
+ [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
25
+ [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
26
+ [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
27
+ [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
28
+ ...style || {}
29
+ };
30
+ });
31
+ return (_ctx, _cache) => {
32
+ return openBlock(), createElementBlock("span", {
33
+ ref_key: "arrowRef",
34
+ ref: arrowRef,
35
+ style: normalizeStyle(unref(arrowStyle)),
36
+ class: normalizeClass(unref(ns).e("arrow"))
37
+ }, null, 6);
38
+ };
24
39
  }
25
40
  });
41
+ var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/tooltip-v2/src/arrow.vue"]]);
26
42
 
27
- export { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps };
43
+ export { TooltipV2Arrow as default };
28
44
  //# sourceMappingURL=arrow2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrow2.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/arrow.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-ps/utils'\nimport { tooltipV2Sides } from './common'\n\nimport type { CSSProperties, ExtractPropTypes } from 'vue'\nimport type { TooltipV2Sides } from './common'\n\nexport const tooltipV2ArrowProps = buildProps({\n width: {\n type: Number,\n default: 10,\n },\n height: {\n type: Number,\n default: 10,\n },\n style: {\n type: definePropType<CSSProperties | null>(Object),\n default: null,\n },\n} as const)\n\nexport const tooltipV2ArrowSpecialProps = buildProps({\n side: {\n type: definePropType<TooltipV2Sides>(String),\n values: tooltipV2Sides,\n required: true,\n },\n} as const)\n\nexport type TooltipV2ArrowProps = ExtractPropTypes<typeof tooltipV2ArrowProps>\n"],"names":[],"mappings":";;;;AAEY,MAAC,mBAAmB,GAAG,UAAU,CAAC;AAC9C,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,0BAA0B,GAAG,UAAU,CAAC;AACrD,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"arrow2.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/arrow.vue"],"sourcesContent":["<template>\n <span ref=\"arrowRef\" :style=\"arrowStyle\" :class=\"ns.e('arrow')\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, inject } from 'vue'\nimport { tooltipV2ContentKey, tooltipV2RootKey } from '@element-ps/tokens'\nimport { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './arrow'\n\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'PsTooltipV2Arrow',\n})\n\nconst props = defineProps({\n ...tooltipV2ArrowProps,\n ...tooltipV2ArrowSpecialProps,\n})\n\nconst { ns } = inject(tooltipV2RootKey)!\nconst { arrowRef } = inject(tooltipV2ContentKey)!\n\nconst arrowStyle = computed<CSSProperties>(() => {\n const { style, width, height } = props\n const namespace = ns.namespace.value\n\n return {\n [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,\n [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,\n [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,\n [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,\n ...(style || {}),\n }\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAoBA,IAAA,MAAA,EAAA,EAAA,EAAA,GAAA,MAAA,CAAA,gBAAA,CAAA,CAAA;AACA,IAAA,MAAA,EAAA,QAAA,EAAA,GAAA,MAAA,CAAA,mBAAA,CAAA,CAAA;AAEA,IAAA,MAAA,UAAA,GAAA,SAAA,MAAA;AACA,MAAA,MAAA,EAAA,KAAA,EAAA,KAAA,EAAA,MAAA,EAAA,GAAA,KAAA,CAAA;AACA,MAAA,MAAA,SAAA,GAAA,GAAA,SAAA,CAAA,KAAA,CAAA;AAEA,MAAA,OAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,qCAAA,CAAA,EAAA,KAAA,CAAA,EAAA,CAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,sCAAA,CAAA,EAAA,MAAA,CAAA,EAAA,CAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,SAAA,CAAA,8BAAA,CAAA,GAAA,CAAA,EAAA,KAAA,GAAA,CAAA,CAAA,EAAA,CAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,SAAA,CAAA,6BAAA,CAAA,GAAA,KAAA,GAAA,CAAA,GAAA,CAAA;AAAA,QAAA,GACA,SAAA,EAAA;AAAA,OACA,CAAA;AAAA,KACA,CAAA,CAAA;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import '../../../utils/index.mjs';
2
2
  import { tooltipV2RootProps } from './root.mjs';
3
- import { tooltipV2TriggerProps } from './trigger2.mjs';
4
- import { tooltipV2ArrowProps } from './arrow2.mjs';
3
+ import { tooltipV2TriggerProps } from './trigger.mjs';
4
+ import { tooltipV2ArrowProps } from './arrow.mjs';
5
5
  import { tooltipV2ContentProps } from './content.mjs';
6
6
  import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
7
7
 
@@ -1,14 +1,14 @@
1
1
  import { defineComponent, toRefs, reactive, openBlock, createBlock, normalizeProps, guardReactiveProps, unref, withCtx, createVNode, mergeProps, renderSlot, Teleport, Transition, createCommentVNode, createElementBlock, Fragment } from 'vue';
2
2
  import { pick } from 'lodash-unified';
3
- import { tooltipV2ArrowProps } from './arrow2.mjs';
3
+ import { tooltipV2ArrowProps } from './arrow.mjs';
4
4
  import { tooltipV2ContentProps } from './content.mjs';
5
5
  import { tooltipV2RootProps } from './root.mjs';
6
6
  import { tooltipV2Props } from './tooltip.mjs';
7
- import { tooltipV2TriggerProps } from './trigger2.mjs';
7
+ import { tooltipV2TriggerProps } from './trigger.mjs';
8
8
  import TooltipV2Root from './root2.mjs';
9
- import TooltipV2Arrow from './arrow.mjs';
9
+ import TooltipV2Arrow from './arrow2.mjs';
10
10
  import TooltipV2Content from './content2.mjs';
11
- import TooltipV2Trigger from './trigger.mjs';
11
+ import TooltipV2Trigger from './trigger2.mjs';
12
12
  import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
13
13
 
14
14
  const __default__ = {
@@ -1,95 +1,17 @@
1
- import { defineComponent, inject, watch, onBeforeUnmount, openBlock, createBlock, unref, withCtx, renderSlot, createElementBlock, mergeProps } from 'vue';
2
1
  import '../../../utils/index.mjs';
3
- import '../../../tokens/index.mjs';
4
- import ForwardRef from './forward-ref.mjs';
5
- import { tooltipV2TriggerProps } from './trigger2.mjs';
6
- import { tooltipV2CommonProps } from './common.mjs';
7
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
8
- import { tooltipV2RootKey } from '../../../tokens/tooltip-v2.mjs';
9
- import { composeEventHandlers } from '../../../utils/dom/event.mjs';
2
+ import { definePropType, buildProps } from '../../../utils/vue/props.mjs';
10
3
 
11
- const __default__ = {
12
- name: "PsTooltipV2Trigger"
4
+ const EventHandler = {
5
+ type: definePropType(Function)
13
6
  };
14
- const _sfc_main = /* @__PURE__ */ defineComponent({
15
- ...__default__,
16
- props: {
17
- ...tooltipV2CommonProps,
18
- ...tooltipV2TriggerProps
19
- },
20
- setup(__props) {
21
- const props = __props;
22
- const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = inject(tooltipV2RootKey);
23
- let isMousedown = false;
24
- const setTriggerRef = (el) => {
25
- triggerRef.value = el;
26
- };
27
- const onMouseup = () => {
28
- isMousedown = false;
29
- };
30
- const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
31
- const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
32
- const onMousedown = composeEventHandlers(props.onMouseDown, () => {
33
- onClose();
34
- isMousedown = true;
35
- document.addEventListener("mouseup", onMouseup, { once: true });
36
- });
37
- const onFocus = composeEventHandlers(props.onFocus, () => {
38
- if (!isMousedown)
39
- onOpen();
40
- });
41
- const onBlur = composeEventHandlers(props.onBlur, onClose);
42
- const onClick = composeEventHandlers(props.onClick, (e) => {
43
- if (e.detail === 0)
44
- onClose();
45
- });
46
- const events = {
47
- blur: onBlur,
48
- click: onClick,
49
- focus: onFocus,
50
- mousedown: onMousedown,
51
- mouseenter: onMouseenter,
52
- mouseleave: onMouseleave
53
- };
54
- const setEvents = (el, events2, type) => {
55
- if (el) {
56
- Object.entries(events2).forEach(([name, handler]) => {
57
- el[type](name, handler);
58
- });
59
- }
60
- };
61
- watch(triggerRef, (triggerEl, previousTriggerEl) => {
62
- setEvents(triggerEl, events, "addEventListener");
63
- setEvents(previousTriggerEl, events, "removeEventListener");
64
- if (triggerEl) {
65
- triggerEl.setAttribute("aria-describedby", contentId.value);
66
- }
67
- });
68
- onBeforeUnmount(() => {
69
- setEvents(triggerRef.value, events, "removeEventListener");
70
- document.removeEventListener("mouseup", onMouseup);
71
- });
72
- return (_ctx, _cache) => {
73
- return _ctx.nowrap ? (openBlock(), createBlock(unref(ForwardRef), {
74
- key: 0,
75
- "set-ref": setTriggerRef,
76
- "only-child": ""
77
- }, {
78
- default: withCtx(() => [
79
- renderSlot(_ctx.$slots, "default")
80
- ]),
81
- _: 3
82
- })) : (openBlock(), createElementBlock("button", mergeProps({
83
- key: 1,
84
- ref_key: "triggerRef",
85
- ref: triggerRef
86
- }, _ctx.$attrs), [
87
- renderSlot(_ctx.$slots, "default")
88
- ], 16));
89
- };
90
- }
7
+ const tooltipV2TriggerProps = buildProps({
8
+ onBlur: EventHandler,
9
+ onClick: EventHandler,
10
+ onFocus: EventHandler,
11
+ onMouseDown: EventHandler,
12
+ onMouseEnter: EventHandler,
13
+ onMouseLeave: EventHandler
91
14
  });
92
- var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/tooltip-v2/src/trigger.vue"]]);
93
15
 
94
- export { TooltipV2Trigger as default };
16
+ export { tooltipV2TriggerProps };
95
17
  //# sourceMappingURL=trigger.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"trigger.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/trigger.vue"],"sourcesContent":["<template>\n <forward-ref v-if=\"nowrap\" :set-ref=\"setTriggerRef\" only-child>\n <slot />\n </forward-ref>\n <button v-else ref=\"triggerRef\" v-bind=\"$attrs\">\n <slot />\n </button>\n</template>\n\n<script setup lang=\"ts\">\nimport { inject, onBeforeUnmount, watch } from 'vue'\nimport { composeEventHandlers } from '@element-ps/utils'\nimport { tooltipV2RootKey } from '@element-ps/tokens'\nimport ForwardRef from './forward-ref'\nimport { tooltipV2TriggerProps } from './trigger'\nimport { tooltipV2CommonProps } from './common'\n\ndefineOptions({\n name: 'PsTooltipV2Trigger',\n})\n\nconst props = defineProps({\n ...tooltipV2CommonProps,\n ...tooltipV2TriggerProps,\n})\n\n/**\n * onOpen opens the tooltip instantly, onTrigger acts a lil bit differently,\n * it will check if delayDuration is set to greater than 0 and based on that result,\n * if true, it opens the tooltip after delayDuration, otherwise it opens it instantly.\n */\nconst { onClose, onOpen, onDelayOpen, triggerRef, contentId } =\n inject(tooltipV2RootKey)!\n\nlet isMousedown = false\n\nconst setTriggerRef = (el: HTMLElement | null) => {\n triggerRef.value = el\n}\n\nconst onMouseup = () => {\n isMousedown = false\n}\n\nconst onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen)\n\nconst onMouseleave = composeEventHandlers(props.onMouseLeave, onClose)\n\nconst onMousedown = composeEventHandlers(props.onMouseDown, () => {\n onClose()\n isMousedown = true\n document.addEventListener('mouseup', onMouseup, { once: true })\n})\n\nconst onFocus = composeEventHandlers(props.onFocus, () => {\n if (!isMousedown) onOpen()\n})\n\nconst onBlur = composeEventHandlers(props.onBlur, onClose)\n\nconst onClick = composeEventHandlers(props.onClick, (e) => {\n if ((e as MouseEvent).detail === 0) onClose()\n})\n\nconst events = {\n blur: onBlur,\n click: onClick,\n focus: onFocus,\n mousedown: onMousedown,\n mouseenter: onMouseenter,\n mouseleave: onMouseleave,\n}\n\nconst setEvents = <T extends (e: Event) => void>(\n el: HTMLElement | null | undefined,\n events: Record<string, T>,\n type: 'addEventListener' | 'removeEventListener'\n) => {\n if (el) {\n Object.entries(events).forEach(([name, handler]) => {\n el[type](name, handler)\n })\n }\n}\n\nwatch(triggerRef, (triggerEl, previousTriggerEl) => {\n setEvents(triggerEl, events, 'addEventListener')\n setEvents(previousTriggerEl, events, 'removeEventListener')\n\n if (triggerEl) {\n triggerEl.setAttribute('aria-describedby', contentId.value)\n }\n})\n\nonBeforeUnmount(() => {\n setEvents(triggerRef.value, events, 'removeEventListener')\n document.removeEventListener('mouseup', onMouseup)\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,IAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,aAAA,UAAA,EAAA,SAAA,EAAA,GACA,OAAA,gBAAA,CAAA,CAAA;AAEA,IAAA,IAAA,WAAA,GAAA,KAAA,CAAA;AAEA,IAAA,MAAA,aAAA,GAAA,CAAA,EAAA,KAAA;AACA,MAAA,UAAA,CAAA,KAAA,GAAA,EAAA,CAAA;AAAA,KACA,CAAA;AAEA,IAAA,MAAA,YAAA,MAAA;AACA,MAAA,WAAA,GAAA,KAAA,CAAA;AAAA,KACA,CAAA;AAEA,IAAA,MAAA,YAAA,GAAA,oBAAA,CAAA,KAAA,CAAA,YAAA,EAAA,WAAA,CAAA,CAAA;AAEA,IAAA,MAAA,YAAA,GAAA,oBAAA,CAAA,KAAA,CAAA,YAAA,EAAA,OAAA,CAAA,CAAA;AAEA,IAAA,MAAA,WAAA,GAAA,oBAAA,CAAA,KAAA,CAAA,WAAA,EAAA,MAAA;AACA,MAAA,OAAA,EAAA,CAAA;AACA,MAAA,WAAA,GAAA,IAAA,CAAA;AACA,MAAA,QAAA,CAAA,iBAAA,SAAA,EAAA,SAAA,EAAA,EAAA,IAAA,EAAA,MAAA,CAAA,CAAA;AAAA,KACA,CAAA,CAAA;AAEA,IAAA,MAAA,OAAA,GAAA,oBAAA,CAAA,KAAA,CAAA,OAAA,EAAA,MAAA;AACA,MAAA,IAAA,CAAA,WAAA;AAAA,QAAA,MAAA,EAAA,CAAA;AAAA,KACA,CAAA,CAAA;AAEA,IAAA,MAAA,MAAA,GAAA,oBAAA,CAAA,KAAA,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;AAEA,IAAA,MAAA,OAAA,GAAA,oBAAA,CAAA,KAAA,CAAA,OAAA,EAAA,CAAA,CAAA,KAAA;AACA,MAAA,IAAA,EAAA,MAAA,KAAA,CAAA;AAAA,QAAA,OAAA,EAAA,CAAA;AAAA,KACA,CAAA,CAAA;AAEA,IAAA,MAAA,MAAA,GAAA;AAAA,MACA,IAAA,EAAA,MAAA;AAAA,MACA,KAAA,EAAA,OAAA;AAAA,MACA,KAAA,EAAA,OAAA;AAAA,MACA,SAAA,EAAA,WAAA;AAAA,MACA,UAAA,EAAA,YAAA;AAAA,MACA,UAAA,EAAA,YAAA;AAAA,KACA,CAAA;AAEA,IAAA,MAAA,SAAA,GAAA,CACA,EACA,EAAA,OAAA,EACA,IACA,KAAA;AACA,MAAA,IAAA,EAAA,EAAA;AACA,QAAA,MAAA,CAAA,QAAA,OAAA,CAAA,CAAA,QAAA,CAAA,CAAA,MAAA,OAAA,CAAA,KAAA;AACA,UAAA,EAAA,CAAA,IAAA,CAAA,CAAA,MAAA,OAAA,CAAA,CAAA;AAAA,SACA,CAAA,CAAA;AAAA,OACA;AAAA,KACA,CAAA;AAEA,IAAA,KAAA,CAAA,UAAA,EAAA,CAAA,SAAA,EAAA,iBAAA,KAAA;AACA,MAAA,SAAA,CAAA,SAAA,EAAA,QAAA,kBAAA,CAAA,CAAA;AACA,MAAA,SAAA,CAAA,iBAAA,EAAA,QAAA,qBAAA,CAAA,CAAA;AAEA,MAAA,IAAA,SAAA,EAAA;AACA,QAAA,SAAA,CAAA,YAAA,CAAA,kBAAA,EAAA,SAAA,CAAA,KAAA,CAAA,CAAA;AAAA,OACA;AAAA,KACA,CAAA,CAAA;AAEA,IAAA,eAAA,CAAA,MAAA;AACA,MAAA,SAAA,CAAA,UAAA,CAAA,KAAA,EAAA,MAAA,EAAA,qBAAA,CAAA,CAAA;AACA,MAAA,QAAA,CAAA,mBAAA,CAAA,WAAA,SAAA,CAAA,CAAA;AAAA,KACA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"trigger.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/trigger.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-ps/utils'\n\nimport type { ExtractPropTypes } from 'vue'\n\nconst EventHandler = {\n type: definePropType<(e: Event) => boolean | void>(Function),\n} as const\n\nexport const tooltipV2TriggerProps = buildProps({\n onBlur: EventHandler,\n onClick: EventHandler,\n onFocus: EventHandler,\n onMouseDown: EventHandler,\n onMouseEnter: EventHandler,\n onMouseLeave: EventHandler,\n} as const)\n\nexport type TooltipV2TriggerProps = ExtractPropTypes<\n typeof tooltipV2TriggerProps\n>\n"],"names":[],"mappings":";;;AACA,MAAM,YAAY,GAAG;AACrB,EAAE,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAChC,CAAC,CAAC;AACU,MAAC,qBAAqB,GAAG,UAAU,CAAC;AAChD,EAAE,MAAM,EAAE,YAAY;AACtB,EAAE,OAAO,EAAE,YAAY;AACvB,EAAE,OAAO,EAAE,YAAY;AACvB,EAAE,WAAW,EAAE,YAAY;AAC3B,EAAE,YAAY,EAAE,YAAY;AAC5B,EAAE,YAAY,EAAE,YAAY;AAC5B,CAAC;;;;"}