@getcortexlabs/mavis 0.1.0-alpha.2 → 0.1.0-alpha.4

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 (413) hide show
  1. package/README.md +7 -5
  2. package/dist/native/avatar-image.d.ts +4 -0
  3. package/dist/native/avatar-image.d.ts.map +1 -0
  4. package/dist/native/avatar-image.js +12 -0
  5. package/dist/native/avatar-image.js.map +1 -0
  6. package/dist/native/avatar-label.android.d.ts +9 -0
  7. package/dist/native/avatar-label.android.d.ts.map +1 -0
  8. package/dist/native/avatar-label.android.js +9 -0
  9. package/dist/native/avatar-label.android.js.map +1 -0
  10. package/dist/native/avatar-label.d.ts +2 -0
  11. package/dist/native/avatar-label.d.ts.map +1 -0
  12. package/dist/native/avatar-label.js +2 -0
  13. package/dist/native/avatar-label.js.map +1 -0
  14. package/dist/native/box.ios.d.ts +4 -0
  15. package/dist/native/box.ios.d.ts.map +1 -1
  16. package/dist/native/box.ios.js +29 -1
  17. package/dist/native/box.ios.js.map +1 -1
  18. package/dist/native/button.ios.d.ts +13 -1
  19. package/dist/native/button.ios.d.ts.map +1 -1
  20. package/dist/native/button.ios.js +29 -1
  21. package/dist/native/button.ios.js.map +1 -1
  22. package/dist/native/checkbox.android.d.ts +7 -0
  23. package/dist/native/checkbox.android.d.ts.map +1 -0
  24. package/dist/native/checkbox.android.js +26 -0
  25. package/dist/native/checkbox.android.js.map +1 -0
  26. package/dist/native/checkbox.d.ts +7 -0
  27. package/dist/native/checkbox.d.ts.map +1 -0
  28. package/dist/native/checkbox.js +7 -0
  29. package/dist/native/checkbox.js.map +1 -0
  30. package/dist/native/composed-button.android.d.ts +4 -0
  31. package/dist/native/composed-button.android.d.ts.map +1 -0
  32. package/dist/native/composed-button.android.js +53 -0
  33. package/dist/native/composed-button.android.js.map +1 -0
  34. package/dist/native/composed-button.d.ts +3 -0
  35. package/dist/native/composed-button.d.ts.map +1 -0
  36. package/dist/native/composed-button.js +4 -0
  37. package/dist/native/composed-button.js.map +1 -0
  38. package/dist/native/dialog.android.d.ts +12 -0
  39. package/dist/native/dialog.android.d.ts.map +1 -0
  40. package/dist/native/dialog.android.js +46 -0
  41. package/dist/native/dialog.android.js.map +1 -0
  42. package/dist/native/dialog.d.ts +12 -0
  43. package/dist/native/dialog.d.ts.map +1 -0
  44. package/dist/native/dialog.ios.d.ts +12 -0
  45. package/dist/native/dialog.ios.d.ts.map +1 -0
  46. package/dist/native/dialog.ios.js +13 -0
  47. package/dist/native/dialog.ios.js.map +1 -0
  48. package/dist/native/dialog.js +4 -0
  49. package/dist/native/dialog.js.map +1 -0
  50. package/dist/native/dynamic-type.d.ts +15 -0
  51. package/dist/native/dynamic-type.d.ts.map +1 -0
  52. package/dist/native/dynamic-type.js +47 -0
  53. package/dist/native/dynamic-type.js.map +1 -0
  54. package/dist/native/flex-layout.ios.d.ts +10 -0
  55. package/dist/native/flex-layout.ios.d.ts.map +1 -1
  56. package/dist/native/flex-layout.ios.js +85 -0
  57. package/dist/native/flex-layout.ios.js.map +1 -1
  58. package/dist/native/input-action.d.ts +5 -0
  59. package/dist/native/input-action.d.ts.map +1 -0
  60. package/dist/native/input-action.js +13 -0
  61. package/dist/native/input-action.js.map +1 -0
  62. package/dist/native/keyboard-dismiss.android.d.ts +8 -0
  63. package/dist/native/keyboard-dismiss.android.d.ts.map +1 -0
  64. package/dist/native/keyboard-dismiss.android.js +9 -0
  65. package/dist/native/keyboard-dismiss.android.js.map +1 -0
  66. package/dist/native/keyboard-dismiss.d.ts +10 -0
  67. package/dist/native/keyboard-dismiss.d.ts.map +1 -0
  68. package/dist/native/keyboard-dismiss.ios.d.ts +8 -0
  69. package/dist/native/keyboard-dismiss.ios.d.ts.map +1 -0
  70. package/dist/native/keyboard-dismiss.ios.js +91 -0
  71. package/dist/native/keyboard-dismiss.ios.js.map +1 -0
  72. package/dist/native/keyboard-dismiss.js +6 -0
  73. package/dist/native/keyboard-dismiss.js.map +1 -0
  74. package/dist/native/label.android.d.ts +12 -0
  75. package/dist/native/label.android.d.ts.map +1 -0
  76. package/dist/native/label.android.js +19 -0
  77. package/dist/native/label.android.js.map +1 -0
  78. package/dist/native/label.ios.d.ts +14 -1
  79. package/dist/native/label.ios.d.ts.map +1 -1
  80. package/dist/native/label.ios.js +37 -1
  81. package/dist/native/label.ios.js.map +1 -1
  82. package/dist/native/measure-memo.d.ts +37 -0
  83. package/dist/native/measure-memo.d.ts.map +1 -0
  84. package/dist/native/measure-memo.js +82 -0
  85. package/dist/native/measure-memo.js.map +1 -0
  86. package/dist/native/motion-surface.d.ts +9 -0
  87. package/dist/native/motion-surface.d.ts.map +1 -0
  88. package/dist/native/motion-surface.js +119 -0
  89. package/dist/native/motion-surface.js.map +1 -0
  90. package/dist/native/press.d.ts +5 -2
  91. package/dist/native/press.d.ts.map +1 -1
  92. package/dist/native/press.js +52 -8
  93. package/dist/native/press.js.map +1 -1
  94. package/dist/native/progress.d.ts +7 -0
  95. package/dist/native/progress.d.ts.map +1 -0
  96. package/dist/native/progress.js +77 -0
  97. package/dist/native/progress.js.map +1 -0
  98. package/dist/native/screen.android.d.ts +6 -0
  99. package/dist/native/screen.android.d.ts.map +1 -0
  100. package/dist/native/screen.android.js +8 -0
  101. package/dist/native/screen.android.js.map +1 -0
  102. package/dist/native/screen.d.ts +2 -0
  103. package/dist/native/screen.d.ts.map +1 -0
  104. package/dist/native/screen.js +3 -0
  105. package/dist/native/screen.js.map +1 -0
  106. package/dist/native/scroll-motion.d.ts +11 -0
  107. package/dist/native/scroll-motion.d.ts.map +1 -0
  108. package/dist/native/scroll-motion.js +94 -0
  109. package/dist/native/scroll-motion.js.map +1 -0
  110. package/dist/native/segmented.d.ts +14 -0
  111. package/dist/native/segmented.d.ts.map +1 -0
  112. package/dist/native/segmented.js +86 -0
  113. package/dist/native/segmented.js.map +1 -0
  114. package/dist/native/sheet.android.d.ts +18 -0
  115. package/dist/native/sheet.android.d.ts.map +1 -0
  116. package/dist/native/sheet.android.js +16 -0
  117. package/dist/native/sheet.android.js.map +1 -0
  118. package/dist/native/sheet.d.ts +21 -0
  119. package/dist/native/sheet.d.ts.map +1 -0
  120. package/dist/native/sheet.ios.d.ts +19 -0
  121. package/dist/native/sheet.ios.d.ts.map +1 -0
  122. package/dist/native/sheet.ios.js +41 -0
  123. package/dist/native/sheet.ios.js.map +1 -0
  124. package/dist/native/sheet.js +17 -0
  125. package/dist/native/sheet.js.map +1 -0
  126. package/dist/native/tabs.android.d.ts +3 -0
  127. package/dist/native/tabs.android.d.ts.map +1 -0
  128. package/dist/native/tabs.android.js +29 -0
  129. package/dist/native/tabs.android.js.map +1 -0
  130. package/dist/native/tabs.d.ts +3 -0
  131. package/dist/native/tabs.d.ts.map +1 -0
  132. package/dist/native/tabs.js +4 -0
  133. package/dist/native/tabs.js.map +1 -0
  134. package/dist/native/text-field.android.d.ts +1 -0
  135. package/dist/native/text-field.android.d.ts.map +1 -1
  136. package/dist/native/text-field.android.js +13 -0
  137. package/dist/native/text-field.android.js.map +1 -1
  138. package/dist/native/text-field.ios.d.ts +9 -0
  139. package/dist/native/text-field.ios.d.ts.map +1 -0
  140. package/dist/native/text-field.ios.js +52 -0
  141. package/dist/native/text-field.ios.js.map +1 -0
  142. package/dist/native/text-view.ios.d.ts +7 -0
  143. package/dist/native/text-view.ios.d.ts.map +1 -0
  144. package/dist/native/text-view.ios.js +10 -0
  145. package/dist/native/text-view.ios.js.map +1 -0
  146. package/dist/native/toast.android.d.ts +4 -0
  147. package/dist/native/toast.android.d.ts.map +1 -0
  148. package/dist/native/toast.android.js +10 -0
  149. package/dist/native/toast.android.js.map +1 -0
  150. package/dist/native/toast.d.ts +4 -0
  151. package/dist/native/toast.d.ts.map +1 -0
  152. package/dist/native/toast.ios.d.ts +4 -0
  153. package/dist/native/toast.ios.d.ts.map +1 -0
  154. package/dist/native/toast.ios.js +8 -0
  155. package/dist/native/toast.ios.js.map +1 -0
  156. package/dist/native/toast.js +5 -0
  157. package/dist/native/toast.js.map +1 -0
  158. package/dist/vue/components/ChoiceControl.d.ts +101 -0
  159. package/dist/vue/components/ChoiceControl.d.ts.map +1 -0
  160. package/dist/vue/components/ChoiceControl.js +196 -0
  161. package/dist/vue/components/ChoiceControl.js.map +1 -0
  162. package/dist/vue/components/MAccordion.d.ts +109 -0
  163. package/dist/vue/components/MAccordion.d.ts.map +1 -0
  164. package/dist/vue/components/MAccordion.js +83 -0
  165. package/dist/vue/components/MAccordion.js.map +1 -0
  166. package/dist/vue/components/MAlert.d.ts +99 -0
  167. package/dist/vue/components/MAlert.d.ts.map +1 -0
  168. package/dist/vue/components/MAlert.js +126 -0
  169. package/dist/vue/components/MAlert.js.map +1 -0
  170. package/dist/vue/components/MAvatar.d.ts +74 -0
  171. package/dist/vue/components/MAvatar.d.ts.map +1 -0
  172. package/dist/vue/components/MAvatar.js +86 -0
  173. package/dist/vue/components/MAvatar.js.map +1 -0
  174. package/dist/vue/components/MBadge.d.ts +64 -0
  175. package/dist/vue/components/MBadge.d.ts.map +1 -0
  176. package/dist/vue/components/MBadge.js +30 -0
  177. package/dist/vue/components/MBadge.js.map +1 -0
  178. package/dist/vue/components/MButton.d.ts +57 -5
  179. package/dist/vue/components/MButton.d.ts.map +1 -1
  180. package/dist/vue/components/MButton.js +129 -11
  181. package/dist/vue/components/MButton.js.map +1 -1
  182. package/dist/vue/components/MCard.d.ts +23 -5
  183. package/dist/vue/components/MCard.d.ts.map +1 -1
  184. package/dist/vue/components/MCard.js +14 -4
  185. package/dist/vue/components/MCard.js.map +1 -1
  186. package/dist/vue/components/MCheckbox.d.ts +93 -0
  187. package/dist/vue/components/MCheckbox.d.ts.map +1 -0
  188. package/dist/vue/components/MCheckbox.js +26 -0
  189. package/dist/vue/components/MCheckbox.js.map +1 -0
  190. package/dist/vue/components/MChip.d.ts +107 -0
  191. package/dist/vue/components/MChip.d.ts.map +1 -0
  192. package/dist/vue/components/MChip.js +120 -0
  193. package/dist/vue/components/MChip.js.map +1 -0
  194. package/dist/vue/components/MDialog.d.ts +95 -0
  195. package/dist/vue/components/MDialog.d.ts.map +1 -0
  196. package/dist/vue/components/MDialog.js +245 -0
  197. package/dist/vue/components/MDialog.js.map +1 -0
  198. package/dist/vue/components/MEmptyState.d.ts +107 -0
  199. package/dist/vue/components/MEmptyState.d.ts.map +1 -0
  200. package/dist/vue/components/MEmptyState.js +79 -0
  201. package/dist/vue/components/MEmptyState.js.map +1 -0
  202. package/dist/vue/components/MInput.d.ts +62 -7
  203. package/dist/vue/components/MInput.d.ts.map +1 -1
  204. package/dist/vue/components/MInput.js +88 -14
  205. package/dist/vue/components/MInput.js.map +1 -1
  206. package/dist/vue/components/MListItem.d.ts +92 -0
  207. package/dist/vue/components/MListItem.d.ts.map +1 -0
  208. package/dist/vue/components/MListItem.js +53 -0
  209. package/dist/vue/components/MListItem.js.map +1 -0
  210. package/dist/vue/components/MProgress.d.ts +112 -0
  211. package/dist/vue/components/MProgress.d.ts.map +1 -0
  212. package/dist/vue/components/MProgress.js +75 -0
  213. package/dist/vue/components/MProgress.js.map +1 -0
  214. package/dist/vue/components/MRadioGroup.d.ts +93 -0
  215. package/dist/vue/components/MRadioGroup.d.ts.map +1 -0
  216. package/dist/vue/components/MRadioGroup.js +57 -0
  217. package/dist/vue/components/MRadioGroup.js.map +1 -0
  218. package/dist/vue/components/MReveal.d.ts.map +1 -1
  219. package/dist/vue/components/MReveal.js +5 -7
  220. package/dist/vue/components/MReveal.js.map +1 -1
  221. package/dist/vue/components/MScreen.d.ts +18 -0
  222. package/dist/vue/components/MScreen.d.ts.map +1 -1
  223. package/dist/vue/components/MScreen.js +68 -5
  224. package/dist/vue/components/MScreen.js.map +1 -1
  225. package/dist/vue/components/MSegmentedControl.d.ts +85 -0
  226. package/dist/vue/components/MSegmentedControl.d.ts.map +1 -0
  227. package/dist/vue/components/MSegmentedControl.js +172 -0
  228. package/dist/vue/components/MSegmentedControl.js.map +1 -0
  229. package/dist/vue/components/MSelect.d.ts +130 -0
  230. package/dist/vue/components/MSelect.d.ts.map +1 -0
  231. package/dist/vue/components/MSelect.js +158 -0
  232. package/dist/vue/components/MSelect.js.map +1 -0
  233. package/dist/vue/components/MSeparator.d.ts +54 -0
  234. package/dist/vue/components/MSeparator.d.ts.map +1 -0
  235. package/dist/vue/components/MSeparator.js +36 -0
  236. package/dist/vue/components/MSeparator.js.map +1 -0
  237. package/dist/vue/components/MSheet.d.ts +101 -0
  238. package/dist/vue/components/MSheet.d.ts.map +1 -0
  239. package/dist/vue/components/MSheet.js +313 -0
  240. package/dist/vue/components/MSheet.js.map +1 -0
  241. package/dist/vue/components/MSkeleton.d.ts +70 -0
  242. package/dist/vue/components/MSkeleton.d.ts.map +1 -0
  243. package/dist/vue/components/MSkeleton.js +87 -0
  244. package/dist/vue/components/MSkeleton.js.map +1 -0
  245. package/dist/vue/components/MSlider.d.ts +1 -1
  246. package/dist/vue/components/MSlider.d.ts.map +1 -1
  247. package/dist/vue/components/MSlider.js +2 -1
  248. package/dist/vue/components/MSlider.js.map +1 -1
  249. package/dist/vue/components/MSwitch.d.ts +79 -0
  250. package/dist/vue/components/MSwitch.d.ts.map +1 -0
  251. package/dist/vue/components/MSwitch.js +163 -0
  252. package/dist/vue/components/MSwitch.js.map +1 -0
  253. package/dist/vue/components/MTabs.d.ts +91 -0
  254. package/dist/vue/components/MTabs.d.ts.map +1 -0
  255. package/dist/vue/components/MTabs.js +245 -0
  256. package/dist/vue/components/MTabs.js.map +1 -0
  257. package/dist/vue/components/MText.d.ts +16 -7
  258. package/dist/vue/components/MText.d.ts.map +1 -1
  259. package/dist/vue/components/MText.js +43 -17
  260. package/dist/vue/components/MText.js.map +1 -1
  261. package/dist/vue/components/MToast.d.ts +23 -0
  262. package/dist/vue/components/MToast.d.ts.map +1 -0
  263. package/dist/vue/components/MToast.js +242 -0
  264. package/dist/vue/components/MToast.js.map +1 -0
  265. package/dist/vue/index.d.ts +31 -4
  266. package/dist/vue/index.d.ts.map +1 -1
  267. package/dist/vue/index.js +48 -4
  268. package/dist/vue/index.js.map +1 -1
  269. package/dist/vue/layers.d.ts +19 -0
  270. package/dist/vue/layers.d.ts.map +1 -0
  271. package/dist/vue/layers.js +26 -0
  272. package/dist/vue/layers.js.map +1 -0
  273. package/dist/vue/native-view.d.ts +6 -0
  274. package/dist/vue/native-view.d.ts.map +1 -0
  275. package/dist/vue/native-view.js +5 -0
  276. package/dist/vue/native-view.js.map +1 -0
  277. package/dist/vue/props.d.ts +12 -11
  278. package/dist/vue/props.d.ts.map +1 -1
  279. package/dist/vue/props.js +25 -10
  280. package/dist/vue/props.js.map +1 -1
  281. package/dist/vue/reveal-motion.d.ts +13 -0
  282. package/dist/vue/reveal-motion.d.ts.map +1 -0
  283. package/dist/vue/reveal-motion.js +55 -0
  284. package/dist/vue/reveal-motion.js.map +1 -0
  285. package/dist/vue/system-back.d.ts +11 -0
  286. package/dist/vue/system-back.d.ts.map +1 -0
  287. package/dist/vue/system-back.js +2 -0
  288. package/dist/vue/system-back.js.map +1 -0
  289. package/dist/vue/use-motion-surface.d.ts +8 -0
  290. package/dist/vue/use-motion-surface.d.ts.map +1 -0
  291. package/dist/vue/use-motion-surface.js +75 -0
  292. package/dist/vue/use-motion-surface.js.map +1 -0
  293. package/dist/vue/use-press.d.ts +1 -1
  294. package/dist/vue/use-press.d.ts.map +1 -1
  295. package/dist/vue/use-press.js +12 -4
  296. package/dist/vue/use-press.js.map +1 -1
  297. package/dist/vue/use-scroll-motion.d.ts +7 -0
  298. package/dist/vue/use-scroll-motion.d.ts.map +1 -0
  299. package/dist/vue/use-scroll-motion.js +30 -0
  300. package/dist/vue/use-scroll-motion.js.map +1 -0
  301. package/package.json +3 -3
  302. package/platforms/android/java/com/mavis/ui/Box.java +38 -3
  303. package/platforms/android/java/com/mavis/ui/ContentWidth.java +77 -0
  304. package/platforms/android/java/com/mavis/ui/FlexLayout.java +80 -4
  305. package/platforms/android/java/com/mavis/ui/MeasureMemo.java +145 -0
  306. package/platforms/android/java/com/mavis/ui/Screen.java +108 -0
  307. package/src/native/avatar-image.ts +9 -0
  308. package/src/native/avatar-label.android.ts +14 -0
  309. package/src/native/avatar-label.ts +1 -0
  310. package/src/native/box.ios.ts +48 -1
  311. package/src/native/button.ios.ts +53 -1
  312. package/src/native/checkbox.android.ts +35 -0
  313. package/src/native/checkbox.ts +9 -0
  314. package/src/native/composed-button.android.ts +74 -0
  315. package/src/native/composed-button.ts +9 -0
  316. package/src/native/dialog.android.ts +56 -0
  317. package/src/native/dialog.ios.ts +23 -0
  318. package/src/native/dialog.ts +10 -0
  319. package/src/native/dynamic-type.ts +71 -0
  320. package/src/native/flex-layout.ios.ts +113 -0
  321. package/src/native/input-action.ts +15 -0
  322. package/src/native/keyboard-dismiss.android.ts +17 -0
  323. package/src/native/keyboard-dismiss.ios.ts +124 -0
  324. package/src/native/keyboard-dismiss.ts +14 -0
  325. package/src/native/label.android.ts +27 -0
  326. package/src/native/label.ios.ts +54 -1
  327. package/src/native/measure-memo.ts +116 -0
  328. package/src/native/motion-surface.ts +137 -0
  329. package/src/native/press.ts +52 -10
  330. package/src/native/progress.ts +78 -0
  331. package/src/native/screen.android.ts +12 -0
  332. package/src/native/screen.ts +2 -0
  333. package/src/native/scroll-motion.ts +101 -0
  334. package/src/native/segmented.ts +95 -0
  335. package/src/native/sheet.android.ts +24 -0
  336. package/src/native/sheet.ios.ts +52 -0
  337. package/src/native/sheet.ts +26 -0
  338. package/src/native/tabs.android.ts +58 -0
  339. package/src/native/tabs.ts +8 -0
  340. package/src/native/text-field.android.ts +19 -0
  341. package/src/native/text-field.ios.ts +53 -0
  342. package/src/native/text-view.ios.ts +10 -0
  343. package/src/native/toast.android.ts +9 -0
  344. package/src/native/toast.ios.ts +13 -0
  345. package/src/native/toast.ts +6 -0
  346. package/src/vue/components/ChoiceControl.ts +238 -0
  347. package/src/vue/components/MAccordion.ts +123 -0
  348. package/src/vue/components/MAlert.ts +156 -0
  349. package/src/vue/components/MAvatar.ts +103 -0
  350. package/src/vue/components/MBadge.ts +34 -0
  351. package/src/vue/components/MButton.ts +176 -9
  352. package/src/vue/components/MCard.ts +23 -3
  353. package/src/vue/components/MCheckbox.ts +25 -0
  354. package/src/vue/components/MChip.ts +134 -0
  355. package/src/vue/components/MDialog.ts +312 -0
  356. package/src/vue/components/MEmptyState.ts +96 -0
  357. package/src/vue/components/MInput.ts +96 -12
  358. package/src/vue/components/MListItem.ts +66 -0
  359. package/src/vue/components/MProgress.ts +94 -0
  360. package/src/vue/components/MRadioGroup.ts +64 -0
  361. package/src/vue/components/MReveal.ts +6 -7
  362. package/src/vue/components/MScreen.ts +93 -5
  363. package/src/vue/components/MSegmentedControl.ts +214 -0
  364. package/src/vue/components/MSelect.ts +185 -0
  365. package/src/vue/components/MSeparator.ts +40 -0
  366. package/src/vue/components/MSheet.ts +375 -0
  367. package/src/vue/components/MSkeleton.ts +100 -0
  368. package/src/vue/components/MSlider.ts +7 -1
  369. package/src/vue/components/MSwitch.ts +187 -0
  370. package/src/vue/components/MTabs.ts +302 -0
  371. package/src/vue/components/MText.ts +37 -6
  372. package/src/vue/components/MToast.ts +289 -0
  373. package/src/vue/index.ts +90 -4
  374. package/src/vue/layers.ts +48 -0
  375. package/src/vue/native-view.ts +6 -0
  376. package/src/vue/props.ts +37 -12
  377. package/src/vue/reveal-motion.ts +61 -0
  378. package/src/vue/system-back.ts +12 -0
  379. package/src/vue/use-motion-surface.ts +77 -0
  380. package/src/vue/use-press.ts +12 -4
  381. package/src/vue/use-scroll-motion.ts +31 -0
  382. package/dist/native/input-description.android.d.ts +0 -4
  383. package/dist/native/input-description.android.d.ts.map +0 -1
  384. package/dist/native/input-description.android.js +0 -18
  385. package/dist/native/input-description.android.js.map +0 -1
  386. package/dist/theme/resolve.d.ts +0 -3
  387. package/dist/theme/resolve.d.ts.map +0 -1
  388. package/dist/theme/resolve.js +0 -8
  389. package/dist/theme/resolve.js.map +0 -1
  390. package/dist/theme/themes.d.ts +0 -6
  391. package/dist/theme/themes.d.ts.map +0 -1
  392. package/dist/theme/themes.js +0 -83
  393. package/dist/theme/themes.js.map +0 -1
  394. package/dist/theme/types.d.ts +0 -50
  395. package/dist/theme/types.d.ts.map +0 -1
  396. package/dist/theme/types.js +0 -2
  397. package/dist/theme/types.js.map +0 -1
  398. package/dist/vue/global-components.d.ts +0 -21
  399. package/dist/vue/global-components.d.ts.map +0 -1
  400. package/dist/vue/global-components.js +0 -2
  401. package/dist/vue/global-components.js.map +0 -1
  402. package/dist/vue/layout-context.d.ts +0 -5
  403. package/dist/vue/layout-context.d.ts.map +0 -1
  404. package/dist/vue/layout-context.js +0 -7
  405. package/dist/vue/layout-context.js.map +0 -1
  406. package/dist/vue/text-content.d.ts +0 -4
  407. package/dist/vue/text-content.d.ts.map +0 -1
  408. package/dist/vue/text-content.js +0 -17
  409. package/dist/vue/text-content.js.map +0 -1
  410. package/dist/vue/theme.d.ts +0 -177
  411. package/dist/vue/theme.d.ts.map +0 -1
  412. package/dist/vue/theme.js +0 -17
  413. package/dist/vue/theme.js.map +0 -1
@@ -0,0 +1,312 @@
1
+ import { useButtonAction, themeKey, type MavisThemeContext } from '@getcortexlabs/mavis-core/vue'
2
+ import {
3
+ provide,
4
+ computed,
5
+ defineComponent,
6
+ h,
7
+ inject,
8
+ onBeforeUnmount,
9
+ ref,
10
+ shallowRef,
11
+ watch,
12
+ type PropType,
13
+ } from 'nativescript-vue'
14
+ import { Application, Utils, type EventData, type View } from '@nativescript/core'
15
+ import { JoltTransition } from '@rafaelaugusto/jolt/vue'
16
+ import { checkDialogLabels } from '@getcortexlabs/mavis-core'
17
+ import {
18
+ dialogProps,
19
+ dialogEmits,
20
+ useDialogState,
21
+ useMavisTheme,
22
+ } from '@getcortexlabs/mavis-core/vue'
23
+ import { useLayerHost } from '../layers.js'
24
+ import { systemBackKey } from '../system-back.js'
25
+ import { nativeViewOf } from '../native-view.js'
26
+ import { watchBack, setModal, safeAreaOf, contentInsets } from '../../native/sheet'
27
+ import { bindDialogFocus } from '../../native/dialog'
28
+ import { MBox, MColumn, MRow } from './layout.js'
29
+ import { MText } from './MText.js'
30
+ import { MButton } from './MButton.js'
31
+ import { MIcon } from './MIcon.js'
32
+
33
+ type Bridge = {
34
+ context: MavisThemeContext
35
+ props: Readonly<import('nativescript-vue').ExtractPropTypes<typeof dialogProps>>
36
+ state: ReturnType<typeof useDialogState>
37
+ theme: ReturnType<typeof useMavisTheme>['theme']
38
+ }
39
+ type Element = { nativeView: View }
40
+ const DialogLayer = defineComponent({
41
+ name: 'MDialogLayer',
42
+ props: { bridge: { type: Object as PropType<Bridge>, required: true } },
43
+ setup({ bridge }) {
44
+ useButtonAction()
45
+ provide(themeKey, bridge.context)
46
+ const { props, state, theme } = bridge
47
+ const claim = inject(systemBackKey, undefined)
48
+ const panel = shallowRef<Element>(),
49
+ title = shallowRef<View>()
50
+ const cancel = shallowRef<View>(),
51
+ confirm = shallowRef<View>()
52
+ const width = ref(320),
53
+ available = ref(600),
54
+ footerHeight = ref(56)
55
+ const padding = ref({ top: 24, right: 24, bottom: 24, left: 24 })
56
+ let host: View | undefined
57
+ let focus: ReturnType<typeof bindDialogFocus> | undefined
58
+ let releaseBack = () => {},
59
+ releaseClaim = () => {}
60
+ function size() {
61
+ if (!host) return
62
+ const area = safeAreaOf(host),
63
+ insets = contentInsets(host)
64
+ const bounds = host.getActualSize()
65
+ padding.value = {
66
+ top: area.top + 24,
67
+ right: insets.right + 24,
68
+ bottom: insets.bottom + 24,
69
+ left: insets.left + 24,
70
+ }
71
+ width.value = Math.max(0, Math.min(440, bounds.width - insets.left - insets.right - 48))
72
+ available.value = Math.max(170, bounds.height - area.top - insets.bottom - 48)
73
+ }
74
+ function release() {
75
+ host?.off('layoutChanged', size)
76
+ host = undefined
77
+ releaseBack()
78
+ releaseClaim()
79
+ releaseBack = releaseClaim = () => {}
80
+ focus?.dispose(Boolean(nativeViewOf(panel.value)?.page?.isLoaded && !Application.suspended))
81
+ focus = undefined
82
+ }
83
+ function entered() {
84
+ const views = {
85
+ panel: nativeViewOf(panel.value),
86
+ title: title.value,
87
+ cancel: cancel.value,
88
+ confirm: confirm.value,
89
+ }
90
+ if (!views.panel || !views.title || !views.cancel || !views.confirm) return
91
+ setModal(views.panel, true)
92
+ focus?.dispose(false)
93
+ focus = bindDialogFocus(
94
+ views as { panel: View; title: View; cancel: View; confirm: View },
95
+ () => state.request('escape'),
96
+ )
97
+ focus.update(props.loading)
98
+ }
99
+ watch(
100
+ () => props.loading,
101
+ (loading) => focus?.update(loading),
102
+ { flush: 'post' },
103
+ )
104
+ onBeforeUnmount(release)
105
+ return () => {
106
+ const { colors, radius } = theme.value
107
+ const danger = props.tone === 'danger'
108
+ const footerMax = Math.max(48, available.value - 122)
109
+ const bodyMax = Math.max(48, available.value - Math.min(footerHeight.value, footerMax) - 74)
110
+ return h(
111
+ JoltTransition,
112
+ {
113
+ appear: true,
114
+ enter: [{ opacity: [0, 1] }, { duration: 180 }],
115
+ leave: [{ opacity: 0 }, { duration: 120 }],
116
+ onAfterEnter: entered,
117
+ onAfterLeave: state.left,
118
+ },
119
+ {
120
+ default: () =>
121
+ state.visible.value
122
+ ? h(
123
+ 'GridLayout',
124
+ {
125
+ iosIgnoreSafeArea: true,
126
+ onLoaded: (event: EventData) => {
127
+ host = (event.object as View).parent as View
128
+ size()
129
+ host.on('layoutChanged', size)
130
+ releaseBack = watchBack((event) => {
131
+ event.cancel = true
132
+ state.request('back')
133
+ })
134
+ releaseClaim =
135
+ claim?.({
136
+ owns: () => state.presented.value,
137
+ back: () => state.request('back'),
138
+ }) ?? (() => {})
139
+ },
140
+ onUnloaded: release,
141
+ },
142
+ [
143
+ h('MavisBox', {
144
+ backgroundColor: 'rgba(16, 11, 28, 0.5)',
145
+ accessible: false,
146
+ accessibilityHidden: true,
147
+ onTap: () => state.request('backdrop'),
148
+ }),
149
+ h(
150
+ 'MavisBox',
151
+ {
152
+ ref: panel,
153
+ id: props.id,
154
+ rows: 'auto,auto',
155
+ marginTop: padding.value.top,
156
+ marginRight: padding.value.right,
157
+ marginBottom: padding.value.bottom,
158
+ marginLeft: padding.value.left,
159
+ width: width.value,
160
+ padding: 24,
161
+ horizontalAlignment: 'center',
162
+ verticalAlignment: 'middle',
163
+ borderWidth: 1,
164
+ borderColor: colors.border,
165
+ borderRadius: radius.lg,
166
+ backgroundColor: colors.surface,
167
+ },
168
+ [
169
+ h('ScrollView', { row: 0, style: { maxHeight: bodyMax } }, [
170
+ h(
171
+ MColumn,
172
+ { gap: 'md', verticalAlignment: 'top' },
173
+ {
174
+ default: () => [
175
+ h(
176
+ MBox,
177
+ {
178
+ width: 48,
179
+ height: 48,
180
+ radius: 'md',
181
+ style: { alignSelf: 'flex-start' },
182
+ backgroundColor: danger ? colors.elevated : colors.primarySoft,
183
+ },
184
+ {
185
+ default: () =>
186
+ h(MIcon, {
187
+ name: danger ? 'triangle-alert' : 'circle-check',
188
+ tone: danger ? 'danger' : 'primary',
189
+ size: 'lg',
190
+ horizontalAlignment: 'center',
191
+ verticalAlignment: 'middle',
192
+ }),
193
+ },
194
+ ),
195
+ h(MText, {
196
+ as: 'h2',
197
+ variant: 'heading',
198
+ text: props.title,
199
+ onLoaded: (event: EventData) => {
200
+ title.value = event.object as View
201
+ },
202
+ }),
203
+ props.description
204
+ ? h(MText, { text: props.description, tone: 'muted' })
205
+ : null,
206
+ ],
207
+ },
208
+ ),
209
+ ]),
210
+ h(
211
+ 'ScrollView',
212
+ { row: 1, marginTop: 24, style: { maxHeight: footerMax } },
213
+ [
214
+ h(
215
+ MRow,
216
+ {
217
+ gap: 'sm',
218
+ align: 'stretch',
219
+ verticalAlignment: 'top',
220
+ onLayoutChanged: (event: EventData) => {
221
+ footerHeight.value = (event.object as View).getActualSize().height
222
+ },
223
+ },
224
+ {
225
+ default: () => [
226
+ h(MButton, {
227
+ onLoaded: (event: EventData) => {
228
+ cancel.value = event.object as View
229
+ },
230
+ text: props.cancelLabel,
231
+ variant: 'secondary',
232
+ grow: 1,
233
+ disabled: props.loading,
234
+ style: { width: 0 },
235
+ onClick: () => state.request('cancel'),
236
+ }),
237
+ h(MButton, {
238
+ onLoaded: (event: EventData) => {
239
+ confirm.value = event.object as View
240
+ },
241
+ text: props.confirmLabel,
242
+ loading: props.loading,
243
+ loadingText: props.loadingLabel,
244
+ grow: 1,
245
+ style: {
246
+ width: 0,
247
+ ...(danger
248
+ ? { backgroundColor: colors.danger, color: colors.surface }
249
+ : {}),
250
+ },
251
+ onClick: state.confirm,
252
+ }),
253
+ ],
254
+ },
255
+ ),
256
+ ],
257
+ ),
258
+ ],
259
+ ),
260
+ ],
261
+ )
262
+ : null,
263
+ },
264
+ )
265
+ }
266
+ },
267
+ })
268
+
269
+ export const MDialog = defineComponent({
270
+ name: 'MDialog',
271
+ inheritAttrs: false,
272
+ props: dialogProps,
273
+ emits: dialogEmits,
274
+ setup(props, { emit }) {
275
+ const layers = useLayerHost('MDialog')
276
+ const state = useDialogState(props, emit)
277
+ const context = useMavisTheme()
278
+ const { theme } = context
279
+ const active = ref(false)
280
+ const bridge: Bridge = { props, state, theme, context }
281
+ watch(
282
+ () => props.open,
283
+ (open) => {
284
+ if (open && active.value) Utils.dismissKeyboard()
285
+ },
286
+ )
287
+ onBeforeUnmount(
288
+ layers.add({
289
+ component: DialogLayer,
290
+ props: { bridge },
291
+ presented: computed(() => active.value && state.presented.value),
292
+ }),
293
+ )
294
+ return () => {
295
+ checkDialogLabels(props.title, props.confirmLabel, props.cancelLabel, props.loadingLabel)
296
+ // The anchor observes a retained page even when its dialog is closed.
297
+ return h('MavisBox', {
298
+ visibility: 'collapse',
299
+ accessibilityHidden: true,
300
+ height: 0,
301
+ onLoaded: () => {
302
+ active.value = true
303
+ if (props.open) Utils.dismissKeyboard()
304
+ },
305
+ onUnloaded: () => {
306
+ if (!Application.suspended) state.request('navigation')
307
+ active.value = false
308
+ },
309
+ })
310
+ }
311
+ },
312
+ })
@@ -0,0 +1,96 @@
1
+ import { defineComponent, h, mergeProps, type SlotsType, type VNode } from 'nativescript-vue'
2
+ import { checkEmptyStateTitle } from '@getcortexlabs/mavis-core'
3
+ import { emptyStateProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
4
+ import { ActionChildren } from '../accessibility.js'
5
+ import { MColumn, MRow, MBox } from './layout.js'
6
+ import { MText } from './MText.js'
7
+ import { MIcon } from './MIcon.js'
8
+
9
+ export const MEmptyState = defineComponent({
10
+ name: 'MEmptyState',
11
+ inheritAttrs: false,
12
+ props: emptyStateProps,
13
+ slots: Object as SlotsType<{ illustration?: () => VNode[]; actions?: () => VNode[] }>,
14
+ setup(props, { attrs, slots }) {
15
+ const { theme } = useMavisTheme()
16
+ return () => {
17
+ checkEmptyStateTitle(props.title)
18
+ const { colors } = theme.value
19
+ const size = props.compact ? 64 : 88
20
+ const illustration = () =>
21
+ slots.illustration?.() ??
22
+ h(
23
+ MBox,
24
+ {
25
+ width: size,
26
+ height: size,
27
+ },
28
+ {
29
+ default: () => [
30
+ h(MBox, {
31
+ width: size,
32
+ height: size,
33
+ radius: 'full',
34
+ backgroundColor: colors[props.tone === 'primary' ? 'primarySoft' : 'accentSoft'],
35
+ }),
36
+ h(MIcon, {
37
+ name: props.icon,
38
+ size: props.compact ? 28 : 36,
39
+ tone: props.tone,
40
+ style: { horizontalAlignment: 'center', verticalAlignment: 'middle' },
41
+ }),
42
+ h(MBox, {
43
+ width: 18,
44
+ height: 18,
45
+ radius: 'full',
46
+ backgroundColor: colors[props.tone === 'primary' ? 'accent' : 'primary'],
47
+ style: { horizontalAlignment: 'right', verticalAlignment: 'top' },
48
+ }),
49
+ ],
50
+ },
51
+ )
52
+ return h(
53
+ MColumn,
54
+ mergeProps(attrs, {
55
+ id: props.id,
56
+ width: props.width,
57
+ grow: props.grow,
58
+ shrink: props.shrink,
59
+ accessibilityHidden: props.accessibilityHidden,
60
+ gap: props.compact ? 'md' : 'lg',
61
+ padding: props.compact ? 'lg' : '2xl',
62
+ align: 'stretch',
63
+ }),
64
+ {
65
+ default: () => [
66
+ h(
67
+ MColumn,
68
+ { align: 'center', accessibilityHidden: true },
69
+ { default: () => h(ActionChildren, { hidden: true }, { default: illustration }) },
70
+ ),
71
+ h(
72
+ MColumn,
73
+ { gap: 'sm' },
74
+ {
75
+ default: () => [
76
+ h(MText, {
77
+ text: props.title,
78
+ variant: props.compact ? 'heading' : 'title',
79
+ as: props.titleAs,
80
+ align: 'center',
81
+ }),
82
+ props.description
83
+ ? h(MText, { text: props.description, tone: 'muted', align: 'center' })
84
+ : null,
85
+ ],
86
+ },
87
+ ),
88
+ slots.actions
89
+ ? h(MRow, { gap: 'sm', wrap: true, justify: 'center' }, { default: slots.actions })
90
+ : null,
91
+ ],
92
+ },
93
+ )
94
+ }
95
+ },
96
+ })
@@ -7,8 +7,10 @@ import {
7
7
  registerElement,
8
8
  watch,
9
9
  provide,
10
+ onBeforeUnmount,
10
11
  } from 'nativescript-vue'
11
12
  import {
13
+ useButtonAction,
12
14
  inputProps,
13
15
  inputEmits,
14
16
  useMavisTheme,
@@ -17,33 +19,54 @@ import {
17
19
  } from '@getcortexlabs/mavis-core/vue'
18
20
  import {
19
21
  validateInput,
22
+ fontFamily,
23
+ resolveRadius,
20
24
  nonNegative,
21
25
  resolveDimension,
22
26
  iconSizes,
27
+ inputActionSize,
23
28
  type InputHandle,
24
29
  } from '@getcortexlabs/mavis-core'
25
- import type { EventData, PropertyChangeData, TextField, TextView } from '@nativescript/core'
30
+ import { isAndroid } from '@nativescript/core'
31
+ import type { EventData, PropertyChangeData, TextField, TextView, View } from '@nativescript/core'
26
32
  import { MavisTextField } from '../../native/text-field'
27
33
  import { MavisTextView } from '../../native/text-view'
28
34
  import { MText } from './MText.js'
29
35
  import { MIcon } from './MIcon.js'
36
+ import { MButton } from './MButton.js'
37
+ import { keepEditingOn } from '../../native/input-action'
30
38
  import { useNativeViewAttrs } from '../accessibility.js'
31
39
 
32
40
  registerElement('MavisTextField', () => MavisTextField)
33
41
  registerElement('MavisTextView', () => MavisTextView)
34
42
 
35
- export const MInput = defineComponent({
43
+ const Input = defineComponent({
36
44
  name: 'MInput',
37
45
  inheritAttrs: false,
38
46
  props: inputProps,
39
47
  emits: inputEmits,
40
48
  setup(props, { attrs, emit, expose }) {
49
+ useButtonAction()
41
50
  const { theme } = useMavisTheme()
42
51
  const shrink = useDefaultShrink()
43
52
  provide(layoutDirection, 'column')
44
53
  const nativeAttrs = useNativeViewAttrs(props)
45
54
  const editor = shallowRef<{ nativeView: TextField | TextView }>()
46
55
  const focused = ref(false)
56
+ let focusFeedback: ReturnType<typeof setTimeout> | undefined
57
+ function cancelFocusFeedback() {
58
+ clearTimeout(focusFeedback)
59
+ focusFeedback = undefined
60
+ }
61
+ let releaseAction: (() => void) | undefined
62
+ function clearAction() {
63
+ releaseAction?.()
64
+ releaseAction = undefined
65
+ }
66
+ onBeforeUnmount(() => {
67
+ cancelFocusFeedback()
68
+ clearAction()
69
+ })
47
70
  function blur() {
48
71
  const view = editor.value?.nativeView
49
72
  view?.dismissSoftInput()
@@ -69,7 +92,14 @@ export const MInput = defineComponent({
69
92
  const text = props.type === 'text' || props.type === 'search'
70
93
  const capitalize = props.autocapitalize ?? (text ? 'sentences' : 'none')
71
94
  const border = props.error ? colors.danger : focused.value ? colors.primary : colors.border
72
- const inset = 16 + iconSizes.md + 10
95
+ const tokens = theme.value.components.input
96
+ const fontSize = tokens.fontSize ?? typography.body.fontSize
97
+ const family = fontFamily(
98
+ tokens.fontFamily ?? typography.body.fontFamily,
99
+ isAndroid ? 'android' : 'ios',
100
+ )
101
+ const inset = tokens.paddingX + iconSizes.md + 10
102
+ const action = props.trailingAction
73
103
  // Icons sit over the editor box and let touches through to it.
74
104
  const icon = (name: typeof props.icon, trailing: boolean) =>
75
105
  name
@@ -82,8 +112,8 @@ export const MInput = defineComponent({
82
112
  style: {
83
113
  horizontalAlignment: trailing ? 'right' : 'left',
84
114
  verticalAlignment: props.multiline ? 'top' : 'middle',
85
- marginLeft: trailing ? 0 : 16,
86
- marginRight: trailing ? 16 : 0,
115
+ marginLeft: trailing ? 0 : tokens.paddingX,
116
+ marginRight: trailing ? tokens.paddingX : 0,
87
117
  marginTop: space.sm + (props.multiline ? 14 : 0),
88
118
  },
89
119
  })
@@ -143,19 +173,28 @@ export const MInput = defineComponent({
143
173
  style: {
144
174
  flexShrink: 0,
145
175
  minWidth: 0,
146
- minHeight: props.multiline ? props.rows * 24 + 30 : control.md.height,
147
- padding: 14,
148
- paddingLeft: props.icon ? inset : 16,
149
- paddingRight: props.trailingIcon ? inset : 16,
176
+ minHeight: props.multiline
177
+ ? props.rows * fontSize * tokens.lineHeight + tokens.paddingY * 2 + 2
178
+ : Math.max(control.md.height, action ? inputActionSize + 8 : 0),
179
+ padding: tokens.paddingY,
180
+ paddingLeft: props.icon ? inset : tokens.paddingX,
181
+ paddingRight: action
182
+ ? Math.max(inputActionSize + 12, tokens.paddingX)
183
+ : props.trailingIcon
184
+ ? inset
185
+ : tokens.paddingX,
150
186
  margin: 0,
151
187
  marginTop: space.sm,
152
- fontSize: typography.body.fontSize,
188
+ fontSize,
189
+ fontFamily: family,
190
+ fontWeight: tokens.fontWeight,
191
+ lineHeight: fontSize * (tokens.lineHeight - 1),
153
192
  color: colors.text,
154
193
  placeholderColor: colors.muted,
155
194
  backgroundColor: props.readonly ? colors.elevated : colors.surface,
156
195
  borderColor: border,
157
196
  borderWidth: 2,
158
- borderRadius: radius.md,
197
+ borderRadius: resolveRadius(theme.value, tokens.radius),
159
198
  },
160
199
  onTextChange: (event: PropertyChangeData) => {
161
200
  const value = String(event.value ?? '')
@@ -163,14 +202,25 @@ export const MInput = defineComponent({
163
202
  emit('update:modelValue', value)
164
203
  },
165
204
  onFocus: () => {
166
- focused.value = true
205
+ cancelFocusFeedback()
206
+ const view = editor.value?.nativeView
207
+ if (view?.android) {
208
+ // Repainting the border invalidates Android's text layout. Let EditText finish
209
+ // its touch event and request the IME before updating the focus appearance.
210
+ focusFeedback = setTimeout(() => {
211
+ focusFeedback = undefined
212
+ if (view.isLoaded && view.android?.hasFocus()) focused.value = true
213
+ }, 0)
214
+ } else focused.value = true
167
215
  emit('focus')
168
216
  },
169
217
  onBlur: () => {
218
+ cancelFocusFeedback()
170
219
  focused.value = false
171
220
  emit('blur')
172
221
  },
173
222
  onUnloaded: () => {
223
+ cancelFocusFeedback()
174
224
  focused.value = false
175
225
  },
176
226
  onReturnPress: (event: EventData) => {
@@ -182,6 +232,35 @@ export const MInput = defineComponent({
182
232
  }),
183
233
  icon(props.icon, false),
184
234
  icon(props.trailingIcon, true),
235
+ action
236
+ ? h(MButton, {
237
+ row: 1,
238
+ icon: action.icon,
239
+ accessibilityLabel: action.label,
240
+ variant: 'ghost',
241
+ disabled: props.disabled || props.readonly || action.disabled,
242
+ style: {
243
+ horizontalAlignment: 'right',
244
+ verticalAlignment: props.multiline ? 'top' : 'middle',
245
+ width: inputActionSize,
246
+ minHeight: inputActionSize,
247
+ padding: 0,
248
+ marginRight: 4,
249
+ marginTop: space.sm + (props.multiline ? 4 : 0),
250
+ },
251
+ onClick: () => {
252
+ if (!props.disabled && !props.readonly && !action.disabled) emit('action')
253
+ },
254
+ onLoaded: (event: EventData) => {
255
+ clearAction()
256
+ releaseAction = keepEditingOn(
257
+ event.object as View,
258
+ () => editor.value?.nativeView,
259
+ )
260
+ },
261
+ onUnloaded: clearAction,
262
+ })
263
+ : null,
185
264
  message
186
265
  ? h(MText, {
187
266
  row: 2,
@@ -196,3 +275,8 @@ export const MInput = defineComponent({
196
275
  }
197
276
  },
198
277
  })
278
+
279
+ // Keep the constructor declaration aligned with the portable handle exposed above.
280
+ export const MInput = Input as typeof Input & {
281
+ new (): InstanceType<typeof Input> & InputHandle
282
+ }
@@ -0,0 +1,66 @@
1
+ import { defineComponent, h, mergeProps, type SlotsType, type VNode } from 'nativescript-vue'
2
+ import { listItemProps, actionEmits } from '@getcortexlabs/mavis-core/vue'
3
+ import { listItemLabel } from '@getcortexlabs/mavis-core'
4
+ import { MCard } from './MCard.js'
5
+ import { MRow, MColumn } from './layout.js'
6
+ import { MText } from './MText.js'
7
+ import { MIcon } from './MIcon.js'
8
+
9
+ export const MListItem = defineComponent({
10
+ name: 'MListItem',
11
+ inheritAttrs: false,
12
+ props: listItemProps,
13
+ emits: actionEmits,
14
+ slots: Object as SlotsType<{ leading?: () => VNode[]; trailing?: () => VNode[] }>,
15
+ setup(props, { attrs, slots, emit }) {
16
+ return () => {
17
+ const label = listItemLabel(props.title, props.description, props.accessibilityLabel)
18
+ return h(
19
+ MCard,
20
+ mergeProps(attrs, {
21
+ id: props.id,
22
+ width: props.width,
23
+ grow: props.grow,
24
+ shrink: props.shrink,
25
+ padding: 'md',
26
+ radius: 'md',
27
+ interactive: props.interactive,
28
+ disabled: props.disabled,
29
+ accessibilityHidden: props.accessibilityHidden,
30
+ accessibilityLabel: props.interactive ? label : undefined,
31
+ style: { borderWidth: 0 },
32
+ onClick: () => emit('click'),
33
+ }),
34
+ {
35
+ default: () =>
36
+ h(
37
+ MRow,
38
+ { gap: 'md' },
39
+ {
40
+ default: () => [
41
+ slots.leading ? h(MColumn, { shrink: 0 }, { default: slots.leading }) : null,
42
+ h(
43
+ MColumn,
44
+ { width: 0, grow: 1, gap: 'xs' },
45
+ {
46
+ default: () => [
47
+ h(MText, { text: props.title, style: { fontWeight: '600' } }),
48
+ props.description
49
+ ? h(MText, { text: props.description, variant: 'caption', tone: 'muted' })
50
+ : null,
51
+ ],
52
+ },
53
+ ),
54
+ slots.trailing
55
+ ? h(MColumn, { shrink: 1, align: 'end' }, { default: slots.trailing })
56
+ : props.interactive
57
+ ? h(MIcon, { name: 'chevron-right', size: 'sm', tone: 'muted' })
58
+ : null,
59
+ ],
60
+ },
61
+ ),
62
+ },
63
+ )
64
+ }
65
+ },
66
+ })