@getcortexlabs/mavis 0.1.0-alpha.3 → 0.1.0-alpha.5
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.
- package/README.md +9 -5
- package/dist/files.d.ts +4 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +3 -0
- package/dist/files.js.map +1 -0
- package/dist/native/avatar-image.d.ts +4 -0
- package/dist/native/avatar-image.d.ts.map +1 -0
- package/dist/native/avatar-image.js +12 -0
- package/dist/native/avatar-image.js.map +1 -0
- package/dist/native/avatar-label.android.d.ts +9 -0
- package/dist/native/avatar-label.android.d.ts.map +1 -0
- package/dist/native/avatar-label.android.js +9 -0
- package/dist/native/avatar-label.android.js.map +1 -0
- package/dist/native/avatar-label.d.ts +2 -0
- package/dist/native/avatar-label.d.ts.map +1 -0
- package/dist/native/avatar-label.js +2 -0
- package/dist/native/avatar-label.js.map +1 -0
- package/dist/native/box.ios.d.ts.map +1 -1
- package/dist/native/box.ios.js +16 -1
- package/dist/native/box.ios.js.map +1 -1
- package/dist/native/button.ios.d.ts +9 -1
- package/dist/native/button.ios.d.ts.map +1 -1
- package/dist/native/button.ios.js +17 -1
- package/dist/native/button.ios.js.map +1 -1
- package/dist/native/checkbox.android.d.ts +7 -0
- package/dist/native/checkbox.android.d.ts.map +1 -0
- package/dist/native/checkbox.android.js +26 -0
- package/dist/native/checkbox.android.js.map +1 -0
- package/dist/native/checkbox.d.ts +7 -0
- package/dist/native/checkbox.d.ts.map +1 -0
- package/dist/native/checkbox.js +7 -0
- package/dist/native/checkbox.js.map +1 -0
- package/dist/native/combobox-editor.android.d.ts +3 -0
- package/dist/native/combobox-editor.android.d.ts.map +1 -0
- package/dist/native/combobox-editor.android.js +5 -0
- package/dist/native/combobox-editor.android.js.map +1 -0
- package/dist/native/combobox-editor.d.ts +4 -0
- package/dist/native/combobox-editor.d.ts.map +1 -0
- package/dist/native/combobox-editor.js +5 -0
- package/dist/native/combobox-editor.js.map +1 -0
- package/dist/native/composed-button.android.d.ts +4 -0
- package/dist/native/composed-button.android.d.ts.map +1 -0
- package/dist/native/composed-button.android.js +53 -0
- package/dist/native/composed-button.android.js.map +1 -0
- package/dist/native/composed-button.d.ts +3 -0
- package/dist/native/composed-button.d.ts.map +1 -0
- package/dist/native/composed-button.js +4 -0
- package/dist/native/composed-button.js.map +1 -0
- package/dist/native/dialog.android.d.ts +12 -0
- package/dist/native/dialog.android.d.ts.map +1 -0
- package/dist/native/dialog.android.js +46 -0
- package/dist/native/dialog.android.js.map +1 -0
- package/dist/native/dialog.d.ts +12 -0
- package/dist/native/dialog.d.ts.map +1 -0
- package/dist/native/dialog.ios.d.ts +12 -0
- package/dist/native/dialog.ios.d.ts.map +1 -0
- package/dist/native/dialog.ios.js +13 -0
- package/dist/native/dialog.ios.js.map +1 -0
- package/dist/native/dialog.js +4 -0
- package/dist/native/dialog.js.map +1 -0
- package/dist/native/dynamic-type.d.ts +15 -0
- package/dist/native/dynamic-type.d.ts.map +1 -0
- package/dist/native/dynamic-type.js +47 -0
- package/dist/native/dynamic-type.js.map +1 -0
- package/dist/native/file-access.d.ts +23 -0
- package/dist/native/file-access.d.ts.map +1 -0
- package/dist/native/file-access.js +55 -0
- package/dist/native/file-access.js.map +1 -0
- package/dist/native/file-picker.android.d.ts +3 -0
- package/dist/native/file-picker.android.d.ts.map +1 -0
- package/dist/native/file-picker.android.js +147 -0
- package/dist/native/file-picker.android.js.map +1 -0
- package/dist/native/file-picker.d.ts +4 -0
- package/dist/native/file-picker.d.ts.map +1 -0
- package/dist/native/file-picker.ios.d.ts +3 -0
- package/dist/native/file-picker.ios.d.ts.map +1 -0
- package/dist/native/file-picker.ios.js +152 -0
- package/dist/native/file-picker.ios.js.map +1 -0
- package/dist/native/file-picker.js +7 -0
- package/dist/native/file-picker.js.map +1 -0
- package/dist/native/flex-layout.ios.d.ts +5 -0
- package/dist/native/flex-layout.ios.d.ts.map +1 -1
- package/dist/native/flex-layout.ios.js +63 -2
- package/dist/native/flex-layout.ios.js.map +1 -1
- package/dist/native/input-action.d.ts +5 -0
- package/dist/native/input-action.d.ts.map +1 -0
- package/dist/native/input-action.js +13 -0
- package/dist/native/input-action.js.map +1 -0
- package/dist/native/keyboard-dismiss.ios.d.ts.map +1 -1
- package/dist/native/keyboard-dismiss.ios.js +3 -0
- package/dist/native/keyboard-dismiss.ios.js.map +1 -1
- package/dist/native/label.android.d.ts +12 -0
- package/dist/native/label.android.d.ts.map +1 -0
- package/dist/native/label.android.js +19 -0
- package/dist/native/label.android.js.map +1 -0
- package/dist/native/label.ios.d.ts +10 -1
- package/dist/native/label.ios.d.ts.map +1 -1
- package/dist/native/label.ios.js +25 -1
- package/dist/native/label.ios.js.map +1 -1
- package/dist/native/motion-owner.d.ts +5 -0
- package/dist/native/motion-owner.d.ts.map +1 -0
- package/dist/native/motion-owner.js +53 -0
- package/dist/native/motion-owner.js.map +1 -0
- package/dist/native/motion-region.d.ts +6 -0
- package/dist/native/motion-region.d.ts.map +1 -0
- package/dist/native/motion-region.js +199 -0
- package/dist/native/motion-region.js.map +1 -0
- package/dist/native/motion-surface.d.ts +9 -0
- package/dist/native/motion-surface.d.ts.map +1 -0
- package/dist/native/motion-surface.js +137 -0
- package/dist/native/motion-surface.js.map +1 -0
- package/dist/native/press.d.ts +5 -2
- package/dist/native/press.d.ts.map +1 -1
- package/dist/native/press.js +52 -8
- package/dist/native/press.js.map +1 -1
- package/dist/native/progress.d.ts +7 -0
- package/dist/native/progress.d.ts.map +1 -0
- package/dist/native/progress.js +77 -0
- package/dist/native/progress.js.map +1 -0
- package/dist/native/scroll-motion.d.ts +12 -0
- package/dist/native/scroll-motion.d.ts.map +1 -0
- package/dist/native/scroll-motion.js +100 -0
- package/dist/native/scroll-motion.js.map +1 -0
- package/dist/native/segmented.d.ts +14 -0
- package/dist/native/segmented.d.ts.map +1 -0
- package/dist/native/segmented.js +86 -0
- package/dist/native/segmented.js.map +1 -0
- package/dist/native/sheet.android.d.ts +5 -1
- package/dist/native/sheet.android.d.ts.map +1 -1
- package/dist/native/sheet.android.js +2 -2
- package/dist/native/sheet.android.js.map +1 -1
- package/dist/native/sheet.d.ts +5 -1
- package/dist/native/sheet.d.ts.map +1 -1
- package/dist/native/sheet.ios.d.ts +5 -1
- package/dist/native/sheet.ios.d.ts.map +1 -1
- package/dist/native/sheet.ios.js +12 -3
- package/dist/native/sheet.ios.js.map +1 -1
- package/dist/native/sheet.js +2 -2
- package/dist/native/sheet.js.map +1 -1
- package/dist/native/tabs.android.d.ts +3 -0
- package/dist/native/tabs.android.d.ts.map +1 -0
- package/dist/native/tabs.android.js +29 -0
- package/dist/native/tabs.android.js.map +1 -0
- package/dist/native/tabs.d.ts +3 -0
- package/dist/native/tabs.d.ts.map +1 -0
- package/dist/native/tabs.js +4 -0
- package/dist/native/tabs.js.map +1 -0
- package/dist/native/text-field.android.d.ts +1 -0
- package/dist/native/text-field.android.d.ts.map +1 -1
- package/dist/native/text-field.android.js +13 -0
- package/dist/native/text-field.android.js.map +1 -1
- package/dist/native/text-field.ios.d.ts +9 -0
- package/dist/native/text-field.ios.d.ts.map +1 -0
- package/dist/native/text-field.ios.js +52 -0
- package/dist/native/text-field.ios.js.map +1 -0
- package/dist/native/text-view.ios.d.ts +7 -0
- package/dist/native/text-view.ios.d.ts.map +1 -0
- package/dist/native/text-view.ios.js +10 -0
- package/dist/native/text-view.ios.js.map +1 -0
- package/dist/native/toast.android.d.ts +4 -0
- package/dist/native/toast.android.d.ts.map +1 -0
- package/dist/native/toast.android.js +10 -0
- package/dist/native/toast.android.js.map +1 -0
- package/dist/native/toast.d.ts +4 -0
- package/dist/native/toast.d.ts.map +1 -0
- package/dist/native/toast.ios.d.ts +4 -0
- package/dist/native/toast.ios.d.ts.map +1 -0
- package/dist/native/toast.ios.js +8 -0
- package/dist/native/toast.ios.js.map +1 -0
- package/dist/native/toast.js +5 -0
- package/dist/native/toast.js.map +1 -0
- package/dist/vue/components/ChoiceControl.d.ts +111 -0
- package/dist/vue/components/ChoiceControl.d.ts.map +1 -0
- package/dist/vue/components/ChoiceControl.js +196 -0
- package/dist/vue/components/ChoiceControl.js.map +1 -0
- package/dist/vue/components/DateCalendar.d.ts +94 -0
- package/dist/vue/components/DateCalendar.d.ts.map +1 -0
- package/dist/vue/components/DateCalendar.js +96 -0
- package/dist/vue/components/DateCalendar.js.map +1 -0
- package/dist/vue/components/MAccordion.d.ts +119 -0
- package/dist/vue/components/MAccordion.d.ts.map +1 -0
- package/dist/vue/components/MAccordion.js +83 -0
- package/dist/vue/components/MAccordion.js.map +1 -0
- package/dist/vue/components/MAlert.d.ts +109 -0
- package/dist/vue/components/MAlert.d.ts.map +1 -0
- package/dist/vue/components/MAlert.js +126 -0
- package/dist/vue/components/MAlert.js.map +1 -0
- package/dist/vue/components/MAvatar.d.ts +80 -0
- package/dist/vue/components/MAvatar.d.ts.map +1 -0
- package/dist/vue/components/MAvatar.js +86 -0
- package/dist/vue/components/MAvatar.js.map +1 -0
- package/dist/vue/components/MBadge.d.ts +70 -0
- package/dist/vue/components/MBadge.d.ts.map +1 -0
- package/dist/vue/components/MBadge.js +30 -0
- package/dist/vue/components/MBadge.js.map +1 -0
- package/dist/vue/components/MButton.d.ts +126 -32
- package/dist/vue/components/MButton.d.ts.map +1 -1
- package/dist/vue/components/MButton.js +129 -11
- package/dist/vue/components/MButton.js.map +1 -1
- package/dist/vue/components/MCard.d.ts +70 -24
- package/dist/vue/components/MCard.d.ts.map +1 -1
- package/dist/vue/components/MCard.js +14 -4
- package/dist/vue/components/MCard.js.map +1 -1
- package/dist/vue/components/MCheckbox.d.ts +103 -0
- package/dist/vue/components/MCheckbox.d.ts.map +1 -0
- package/dist/vue/components/MCheckbox.js +26 -0
- package/dist/vue/components/MCheckbox.js.map +1 -0
- package/dist/vue/components/MChip.d.ts +117 -0
- package/dist/vue/components/MChip.d.ts.map +1 -0
- package/dist/vue/components/MChip.js +120 -0
- package/dist/vue/components/MChip.js.map +1 -0
- package/dist/vue/components/MCombobox.d.ts +279 -0
- package/dist/vue/components/MCombobox.d.ts.map +1 -0
- package/dist/vue/components/MCombobox.js +234 -0
- package/dist/vue/components/MCombobox.js.map +1 -0
- package/dist/vue/components/MDatePicker.d.ts +1254 -0
- package/dist/vue/components/MDatePicker.d.ts.map +1 -0
- package/dist/vue/components/MDatePicker.js +35 -0
- package/dist/vue/components/MDatePicker.js.map +1 -0
- package/dist/vue/components/MDialog.d.ts +97 -0
- package/dist/vue/components/MDialog.d.ts.map +1 -0
- package/dist/vue/components/MDialog.js +245 -0
- package/dist/vue/components/MDialog.js.map +1 -0
- package/dist/vue/components/MEmptyState.d.ts +117 -0
- package/dist/vue/components/MEmptyState.d.ts.map +1 -0
- package/dist/vue/components/MEmptyState.js +79 -0
- package/dist/vue/components/MEmptyState.js.map +1 -0
- package/dist/vue/components/MFilePicker.d.ts +112 -0
- package/dist/vue/components/MFilePicker.d.ts.map +1 -0
- package/dist/vue/components/MFilePicker.js +196 -0
- package/dist/vue/components/MFilePicker.js.map +1 -0
- package/dist/vue/components/MIcon.d.ts +5 -3
- package/dist/vue/components/MIcon.d.ts.map +1 -1
- package/dist/vue/components/MInput.d.ts +178 -51
- package/dist/vue/components/MInput.d.ts.map +1 -1
- package/dist/vue/components/MInput.js +88 -14
- package/dist/vue/components/MInput.js.map +1 -1
- package/dist/vue/components/MListItem.d.ts +104 -0
- package/dist/vue/components/MListItem.d.ts.map +1 -0
- package/dist/vue/components/MListItem.js +53 -0
- package/dist/vue/components/MListItem.js.map +1 -0
- package/dist/vue/components/MProgress.d.ts +122 -0
- package/dist/vue/components/MProgress.d.ts.map +1 -0
- package/dist/vue/components/MProgress.js +75 -0
- package/dist/vue/components/MProgress.js.map +1 -0
- package/dist/vue/components/MRadioGroup.d.ts +103 -0
- package/dist/vue/components/MRadioGroup.d.ts.map +1 -0
- package/dist/vue/components/MRadioGroup.js +57 -0
- package/dist/vue/components/MRadioGroup.js.map +1 -0
- package/dist/vue/components/MReveal.d.ts +75 -39
- package/dist/vue/components/MReveal.d.ts.map +1 -1
- package/dist/vue/components/MReveal.js +5 -7
- package/dist/vue/components/MReveal.js.map +1 -1
- package/dist/vue/components/MScreen.d.ts +21 -6
- package/dist/vue/components/MScreen.d.ts.map +1 -1
- package/dist/vue/components/MScreen.js +19 -4
- package/dist/vue/components/MScreen.js.map +1 -1
- package/dist/vue/components/MSegmentedControl.d.ts +95 -0
- package/dist/vue/components/MSegmentedControl.d.ts.map +1 -0
- package/dist/vue/components/MSegmentedControl.js +172 -0
- package/dist/vue/components/MSegmentedControl.js.map +1 -0
- package/dist/vue/components/MSelect.d.ts +140 -0
- package/dist/vue/components/MSelect.d.ts.map +1 -0
- package/dist/vue/components/MSelect.js +158 -0
- package/dist/vue/components/MSelect.js.map +1 -0
- package/dist/vue/components/MSeparator.d.ts +56 -0
- package/dist/vue/components/MSeparator.d.ts.map +1 -0
- package/dist/vue/components/MSeparator.js +36 -0
- package/dist/vue/components/MSeparator.js.map +1 -0
- package/dist/vue/components/MSheet.d.ts +26 -14
- package/dist/vue/components/MSheet.d.ts.map +1 -1
- package/dist/vue/components/MSheet.js +66 -34
- package/dist/vue/components/MSheet.js.map +1 -1
- package/dist/vue/components/MSkeleton.d.ts +78 -0
- package/dist/vue/components/MSkeleton.d.ts.map +1 -0
- package/dist/vue/components/MSkeleton.js +87 -0
- package/dist/vue/components/MSkeleton.js.map +1 -0
- package/dist/vue/components/MSlider.d.ts +8 -4
- package/dist/vue/components/MSlider.d.ts.map +1 -1
- package/dist/vue/components/MSlider.js +2 -1
- package/dist/vue/components/MSlider.js.map +1 -1
- package/dist/vue/components/MSwitch.d.ts +89 -0
- package/dist/vue/components/MSwitch.d.ts.map +1 -0
- package/dist/vue/components/MSwitch.js +163 -0
- package/dist/vue/components/MSwitch.js.map +1 -0
- package/dist/vue/components/MTabs.d.ts +101 -0
- package/dist/vue/components/MTabs.d.ts.map +1 -0
- package/dist/vue/components/MTabs.js +245 -0
- package/dist/vue/components/MTabs.js.map +1 -0
- package/dist/vue/components/MText.d.ts +51 -26
- package/dist/vue/components/MText.d.ts.map +1 -1
- package/dist/vue/components/MText.js +43 -17
- package/dist/vue/components/MText.js.map +1 -1
- package/dist/vue/components/MToast.d.ts +23 -0
- package/dist/vue/components/MToast.d.ts.map +1 -0
- package/dist/vue/components/MToast.js +242 -0
- package/dist/vue/components/MToast.js.map +1 -0
- package/dist/vue/components/layout.d.ts +206 -97
- package/dist/vue/components/layout.d.ts.map +1 -1
- package/dist/vue/components/layout.js +6 -4
- package/dist/vue/components/layout.js.map +1 -1
- package/dist/vue/components/workflows.d.ts +251 -0
- package/dist/vue/components/workflows.d.ts.map +1 -0
- package/dist/vue/components/workflows.js +35 -0
- package/dist/vue/components/workflows.js.map +1 -0
- package/dist/vue/index.d.ts +29 -3
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +56 -4
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/layers.d.ts +2 -0
- package/dist/vue/layers.d.ts.map +1 -1
- package/dist/vue/layers.js.map +1 -1
- package/dist/vue/reveal-motion.d.ts +13 -0
- package/dist/vue/reveal-motion.d.ts.map +1 -0
- package/dist/vue/reveal-motion.js +55 -0
- package/dist/vue/reveal-motion.js.map +1 -0
- package/dist/vue/use-motion-region.d.ts +7 -0
- package/dist/vue/use-motion-region.d.ts.map +1 -0
- package/dist/vue/use-motion-region.js +28 -0
- package/dist/vue/use-motion-region.js.map +1 -0
- package/dist/vue/use-motion-surface.d.ts +8 -0
- package/dist/vue/use-motion-surface.d.ts.map +1 -0
- package/dist/vue/use-motion-surface.js +76 -0
- package/dist/vue/use-motion-surface.js.map +1 -0
- package/dist/vue/use-press.d.ts +1 -1
- package/dist/vue/use-press.d.ts.map +1 -1
- package/dist/vue/use-press.js +12 -4
- package/dist/vue/use-press.js.map +1 -1
- package/dist/vue/use-scroll-motion.d.ts +7 -0
- package/dist/vue/use-scroll-motion.d.ts.map +1 -0
- package/dist/vue/use-scroll-motion.js +30 -0
- package/dist/vue/use-scroll-motion.js.map +1 -0
- package/package.json +3 -3
- package/platforms/android/java/com/mavis/ui/Box.java +3 -1
- package/platforms/android/java/com/mavis/ui/ContentWidth.java +77 -0
- package/platforms/android/java/com/mavis/ui/FlexLayout.java +5 -1
- package/src/files.ts +3 -0
- package/src/native/avatar-image.ts +9 -0
- package/src/native/avatar-label.android.ts +14 -0
- package/src/native/avatar-label.ts +1 -0
- package/src/native/box.ios.ts +21 -1
- package/src/native/button.ios.ts +40 -2
- package/src/native/checkbox.android.ts +35 -0
- package/src/native/checkbox.ts +9 -0
- package/src/native/combobox-editor.android.ts +11 -0
- package/src/native/combobox-editor.ts +6 -0
- package/src/native/composed-button.android.ts +74 -0
- package/src/native/composed-button.ts +9 -0
- package/src/native/dialog.android.ts +56 -0
- package/src/native/dialog.ios.ts +23 -0
- package/src/native/dialog.ts +10 -0
- package/src/native/dynamic-type.ts +71 -0
- package/src/native/file-access.ts +71 -0
- package/src/native/file-picker.android.ts +191 -0
- package/src/native/file-picker.ios.ts +230 -0
- package/src/native/file-picker.ts +8 -0
- package/src/native/flex-layout.ios.ts +74 -2
- package/src/native/input-action.ts +15 -0
- package/src/native/keyboard-dismiss.ios.ts +2 -0
- package/src/native/label.android.ts +27 -0
- package/src/native/label.ios.ts +40 -1
- package/src/native/motion-owner.ts +59 -0
- package/src/native/motion-region.ts +213 -0
- package/src/native/motion-surface.ts +162 -0
- package/src/native/press.ts +52 -10
- package/src/native/progress.ts +78 -0
- package/src/native/scroll-motion.ts +106 -0
- package/src/native/segmented.ts +95 -0
- package/src/native/sheet.android.ts +2 -2
- package/src/native/sheet.ios.ts +12 -3
- package/src/native/sheet.ts +2 -2
- package/src/native/tabs.android.ts +58 -0
- package/src/native/tabs.ts +8 -0
- package/src/native/text-field.android.ts +19 -0
- package/src/native/text-field.ios.ts +53 -0
- package/src/native/text-view.ios.ts +10 -0
- package/src/native/toast.android.ts +9 -0
- package/src/native/toast.ios.ts +13 -0
- package/src/native/toast.ts +6 -0
- package/src/vue/components/ChoiceControl.ts +238 -0
- package/src/vue/components/DateCalendar.ts +117 -0
- package/src/vue/components/MAccordion.ts +123 -0
- package/src/vue/components/MAlert.ts +156 -0
- package/src/vue/components/MAvatar.ts +103 -0
- package/src/vue/components/MBadge.ts +34 -0
- package/src/vue/components/MButton.ts +176 -9
- package/src/vue/components/MCard.ts +23 -3
- package/src/vue/components/MCheckbox.ts +25 -0
- package/src/vue/components/MChip.ts +134 -0
- package/src/vue/components/MCombobox.ts +257 -0
- package/src/vue/components/MDatePicker.ts +33 -0
- package/src/vue/components/MDialog.ts +312 -0
- package/src/vue/components/MEmptyState.ts +96 -0
- package/src/vue/components/MFilePicker.ts +226 -0
- package/src/vue/components/MInput.ts +96 -12
- package/src/vue/components/MListItem.ts +66 -0
- package/src/vue/components/MProgress.ts +94 -0
- package/src/vue/components/MRadioGroup.ts +64 -0
- package/src/vue/components/MReveal.ts +6 -7
- package/src/vue/components/MScreen.ts +21 -6
- package/src/vue/components/MSegmentedControl.ts +214 -0
- package/src/vue/components/MSelect.ts +185 -0
- package/src/vue/components/MSeparator.ts +40 -0
- package/src/vue/components/MSheet.ts +83 -43
- package/src/vue/components/MSkeleton.ts +100 -0
- package/src/vue/components/MSlider.ts +7 -1
- package/src/vue/components/MSwitch.ts +187 -0
- package/src/vue/components/MTabs.ts +302 -0
- package/src/vue/components/MText.ts +37 -6
- package/src/vue/components/MToast.ts +289 -0
- package/src/vue/components/layout.ts +6 -3
- package/src/vue/components/workflows.ts +38 -0
- package/src/vue/index.ts +93 -2
- package/src/vue/layers.ts +2 -0
- package/src/vue/reveal-motion.ts +61 -0
- package/src/vue/use-motion-region.ts +29 -0
- package/src/vue/use-motion-surface.ts +84 -0
- package/src/vue/use-press.ts +12 -4
- package/src/vue/use-scroll-motion.ts +31 -0
- package/dist/native/input-description.android.d.ts +0 -4
- package/dist/native/input-description.android.d.ts.map +0 -1
- package/dist/native/input-description.android.js +0 -18
- package/dist/native/input-description.android.js.map +0 -1
- package/dist/theme/resolve.d.ts +0 -3
- package/dist/theme/resolve.d.ts.map +0 -1
- package/dist/theme/resolve.js +0 -8
- package/dist/theme/resolve.js.map +0 -1
- package/dist/theme/themes.d.ts +0 -6
- package/dist/theme/themes.d.ts.map +0 -1
- package/dist/theme/themes.js +0 -83
- package/dist/theme/themes.js.map +0 -1
- package/dist/theme/types.d.ts +0 -50
- package/dist/theme/types.d.ts.map +0 -1
- package/dist/theme/types.js +0 -2
- package/dist/theme/types.js.map +0 -1
- package/dist/vue/global-components.d.ts +0 -21
- package/dist/vue/global-components.d.ts.map +0 -1
- package/dist/vue/global-components.js +0 -2
- package/dist/vue/global-components.js.map +0 -1
- package/dist/vue/layout-context.d.ts +0 -5
- package/dist/vue/layout-context.d.ts.map +0 -1
- package/dist/vue/layout-context.js +0 -7
- package/dist/vue/layout-context.js.map +0 -1
- package/dist/vue/text-content.d.ts +0 -4
- package/dist/vue/text-content.d.ts.map +0 -1
- package/dist/vue/text-content.js +0 -17
- package/dist/vue/text-content.js.map +0 -1
- package/dist/vue/theme.d.ts +0 -177
- package/dist/vue/theme.d.ts.map +0 -1
- package/dist/vue/theme.js +0 -17
- package/dist/vue/theme.js.map +0 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineComponent,
|
|
3
|
+
h,
|
|
4
|
+
mergeProps,
|
|
5
|
+
nextTick,
|
|
6
|
+
onBeforeUnmount,
|
|
7
|
+
onDeactivated,
|
|
8
|
+
shallowRef,
|
|
9
|
+
watch,
|
|
10
|
+
} from 'nativescript-vue'
|
|
11
|
+
import { filePickerProps, fileStatusText, useButtonAction } from '@getcortexlabs/mavis-core/vue'
|
|
12
|
+
import type { InputHandle } from '@getcortexlabs/mavis-core'
|
|
13
|
+
import { createNativeFilePicker } from '../../native/file-picker'
|
|
14
|
+
import { MColumn, MRow } from './layout.js'
|
|
15
|
+
import { MText } from './MText.js'
|
|
16
|
+
import { MButton } from './MButton.js'
|
|
17
|
+
import { MProgress } from './MProgress.js'
|
|
18
|
+
import { MCard } from './MCard.js'
|
|
19
|
+
import { Application, isAndroid, type EventData, type View } from '@nativescript/core'
|
|
20
|
+
|
|
21
|
+
const FilePicker = defineComponent({
|
|
22
|
+
name: 'MFilePicker',
|
|
23
|
+
inheritAttrs: false,
|
|
24
|
+
props: filePickerProps,
|
|
25
|
+
setup(props, { attrs, expose }) {
|
|
26
|
+
useButtonAction()
|
|
27
|
+
const state = shallowRef(props.selection.state)
|
|
28
|
+
const picker = createNativeFilePicker()
|
|
29
|
+
let chooseView: View | undefined
|
|
30
|
+
let loaded = false
|
|
31
|
+
let unsubscribe = () => {}
|
|
32
|
+
watch(
|
|
33
|
+
() => props.selection,
|
|
34
|
+
(selection, previous) => {
|
|
35
|
+
previous?.pause()
|
|
36
|
+
unsubscribe()
|
|
37
|
+
state.value = selection.state
|
|
38
|
+
unsubscribe = selection.subscribe((value) => {
|
|
39
|
+
state.value = value
|
|
40
|
+
})
|
|
41
|
+
},
|
|
42
|
+
{ immediate: true, flush: 'sync' },
|
|
43
|
+
)
|
|
44
|
+
watch(
|
|
45
|
+
() => props.disabled,
|
|
46
|
+
(disabled) => {
|
|
47
|
+
if (disabled) props.selection.pause()
|
|
48
|
+
},
|
|
49
|
+
)
|
|
50
|
+
function unload() {
|
|
51
|
+
loaded = false
|
|
52
|
+
// Android stops/unloads the owner Activity when its system document picker opens.
|
|
53
|
+
// Keep that intentional handoff alive; route unloads and component disposal still cancel.
|
|
54
|
+
if (isAndroid && Application.android.paused && props.selection.state.picking) {
|
|
55
|
+
for (const item of props.selection.state.items) props.selection.cancel(item.id)
|
|
56
|
+
} else props.selection.pause()
|
|
57
|
+
chooseView = undefined
|
|
58
|
+
}
|
|
59
|
+
onDeactivated(() => props.selection.pause())
|
|
60
|
+
onBeforeUnmount(() => {
|
|
61
|
+
unsubscribe()
|
|
62
|
+
props.selection.pause()
|
|
63
|
+
unload()
|
|
64
|
+
})
|
|
65
|
+
function focusChoose() {
|
|
66
|
+
if (loaded && !props.disabled && !state.value.picking) chooseView?.focus()
|
|
67
|
+
}
|
|
68
|
+
expose({
|
|
69
|
+
focus: focusChoose,
|
|
70
|
+
blur: () => {
|
|
71
|
+
chooseView?.android?.clearFocus()
|
|
72
|
+
chooseView?.ios?.resignFirstResponder()
|
|
73
|
+
},
|
|
74
|
+
} satisfies InputHandle)
|
|
75
|
+
function choose() {
|
|
76
|
+
if (!loaded || props.disabled || state.value.picking) return
|
|
77
|
+
const selection = props.selection
|
|
78
|
+
void selection.select(picker).finally(async () => {
|
|
79
|
+
await nextTick()
|
|
80
|
+
if (props.selection === selection) focusChoose()
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
return () => {
|
|
84
|
+
if (!props.label.trim()) throw new TypeError('FilePicker needs a non-empty label')
|
|
85
|
+
const selection = props.selection
|
|
86
|
+
return h(
|
|
87
|
+
MColumn,
|
|
88
|
+
mergeProps(attrs, {
|
|
89
|
+
gap: 'md',
|
|
90
|
+
onLoaded: () => {
|
|
91
|
+
loaded = true
|
|
92
|
+
},
|
|
93
|
+
onUnloaded: unload,
|
|
94
|
+
}),
|
|
95
|
+
{
|
|
96
|
+
default: () => [
|
|
97
|
+
h(MText, { text: props.label, weight: '600' }),
|
|
98
|
+
h(
|
|
99
|
+
MRow,
|
|
100
|
+
{ gap: 'sm', wrap: true },
|
|
101
|
+
{
|
|
102
|
+
default: () => [
|
|
103
|
+
h(MButton, {
|
|
104
|
+
text: props.chooseLabel,
|
|
105
|
+
variant: 'secondary',
|
|
106
|
+
disabled: props.disabled || state.value.picking,
|
|
107
|
+
accessibilityLabel: `${props.chooseLabel}: ${props.label}`,
|
|
108
|
+
onClick: choose,
|
|
109
|
+
onLoaded: (event: EventData) => {
|
|
110
|
+
chooseView = event.object as View
|
|
111
|
+
},
|
|
112
|
+
}),
|
|
113
|
+
state.value.picking
|
|
114
|
+
? h(MButton, {
|
|
115
|
+
text: props.cancelLabel,
|
|
116
|
+
variant: 'ghost',
|
|
117
|
+
onClick: () => {
|
|
118
|
+
selection.cancelSelection()
|
|
119
|
+
focusChoose()
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
: null,
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
),
|
|
126
|
+
state.value.error
|
|
127
|
+
? h(MText, {
|
|
128
|
+
text: props.errorLabels[state.value.error.code] ?? state.value.error.message,
|
|
129
|
+
tone: 'danger',
|
|
130
|
+
})
|
|
131
|
+
: null,
|
|
132
|
+
!state.value.items.length ? h(MText, { text: props.emptyLabel, tone: 'muted' }) : null,
|
|
133
|
+
...state.value.items.map((item) => {
|
|
134
|
+
const preview = selection.preview(item.id)
|
|
135
|
+
const status = fileStatusText(item, props.statusLabels)
|
|
136
|
+
return h(
|
|
137
|
+
MCard,
|
|
138
|
+
{ key: item.id, gap: 'sm' },
|
|
139
|
+
{
|
|
140
|
+
default: () => [
|
|
141
|
+
preview
|
|
142
|
+
? h('Image', {
|
|
143
|
+
src: preview,
|
|
144
|
+
width: 80,
|
|
145
|
+
height: 80,
|
|
146
|
+
stretch: 'aspectFit',
|
|
147
|
+
horizontalAlignment: 'left',
|
|
148
|
+
accessible: false,
|
|
149
|
+
accessibilityHidden: true,
|
|
150
|
+
})
|
|
151
|
+
: null,
|
|
152
|
+
h(MText, { text: item.name, weight: '600' }),
|
|
153
|
+
h(MText, {
|
|
154
|
+
text: `${status}${item.size === undefined ? '' : ` · ${item.size} B`}`,
|
|
155
|
+
variant: 'caption',
|
|
156
|
+
tone:
|
|
157
|
+
item.status === 'failed'
|
|
158
|
+
? 'danger'
|
|
159
|
+
: item.status === 'uploaded'
|
|
160
|
+
? 'success'
|
|
161
|
+
: 'muted',
|
|
162
|
+
}),
|
|
163
|
+
item.status === 'uploading'
|
|
164
|
+
? h(MProgress, {
|
|
165
|
+
value: (item.progress ?? 0) * 100,
|
|
166
|
+
indeterminate: item.progress === undefined,
|
|
167
|
+
label: `${props.uploadLabel}: ${item.name}`,
|
|
168
|
+
indeterminateLabel: props.pendingLabel,
|
|
169
|
+
})
|
|
170
|
+
: null,
|
|
171
|
+
item.error
|
|
172
|
+
? h(MText, { text: item.error, tone: 'danger', variant: 'caption' })
|
|
173
|
+
: null,
|
|
174
|
+
h(
|
|
175
|
+
MRow,
|
|
176
|
+
{ gap: 'sm', wrap: true },
|
|
177
|
+
{
|
|
178
|
+
default: () => [
|
|
179
|
+
item.status === 'uploading'
|
|
180
|
+
? h(MButton, {
|
|
181
|
+
text: props.cancelLabel,
|
|
182
|
+
accessibilityLabel: `${props.cancelLabel}: ${item.name}`,
|
|
183
|
+
variant: 'secondary',
|
|
184
|
+
disabled: props.disabled,
|
|
185
|
+
onClick: () => selection.cancel(item.id),
|
|
186
|
+
})
|
|
187
|
+
: selection.canUpload && item.status !== 'uploaded'
|
|
188
|
+
? h(MButton, {
|
|
189
|
+
text:
|
|
190
|
+
item.status === 'failed' || item.status === 'cancelled'
|
|
191
|
+
? props.retryLabel
|
|
192
|
+
: props.uploadLabel,
|
|
193
|
+
accessibilityLabel: `${item.status === 'failed' || item.status === 'cancelled' ? props.retryLabel : props.uploadLabel}: ${item.name}`,
|
|
194
|
+
disabled: props.disabled || !selection.hasFile(item.id),
|
|
195
|
+
onClick: () => {
|
|
196
|
+
void selection.upload(item.id)
|
|
197
|
+
},
|
|
198
|
+
})
|
|
199
|
+
: null,
|
|
200
|
+
h(MButton, {
|
|
201
|
+
text: props.removeLabel,
|
|
202
|
+
accessibilityLabel: `${props.removeLabel}: ${item.name}`,
|
|
203
|
+
variant: 'ghost',
|
|
204
|
+
disabled: props.disabled,
|
|
205
|
+
onClick: () => {
|
|
206
|
+
focusChoose()
|
|
207
|
+
selection.remove(item.id)
|
|
208
|
+
},
|
|
209
|
+
}),
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
),
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
)
|
|
216
|
+
}),
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
export const MFilePicker = FilePicker as typeof FilePicker & {
|
|
225
|
+
new (): InstanceType<typeof FilePicker> & InputHandle
|
|
226
|
+
}
|
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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 :
|
|
86
|
-
marginRight: trailing ?
|
|
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
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
|
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:
|
|
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
|
-
|
|
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
|
+
})
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { defineComponent, h, mergeProps, onBeforeUnmount, watch } from 'nativescript-vue'
|
|
2
|
+
import type { EventData, View } from '@nativescript/core'
|
|
3
|
+
import { progressProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
4
|
+
import {
|
|
5
|
+
progressSizes,
|
|
6
|
+
progressMotion,
|
|
7
|
+
progressState,
|
|
8
|
+
checkProgressLabels,
|
|
9
|
+
} from '@getcortexlabs/mavis-core'
|
|
10
|
+
import { attachProgressMotion } from '../../native/progress'
|
|
11
|
+
import { useNativeViewAttrs } from '../accessibility.js'
|
|
12
|
+
import { MBox } from './layout.js'
|
|
13
|
+
|
|
14
|
+
export const MProgress = defineComponent({
|
|
15
|
+
name: 'MProgress',
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
props: progressProps,
|
|
18
|
+
setup(props, { attrs }) {
|
|
19
|
+
const { theme } = useMavisTheme()
|
|
20
|
+
const nativeAttrs = useNativeViewAttrs(props)
|
|
21
|
+
let track: View | undefined
|
|
22
|
+
let fill: View | undefined
|
|
23
|
+
let motion: ReturnType<typeof attachProgressMotion> | undefined
|
|
24
|
+
function connect() {
|
|
25
|
+
if (track && fill && !motion) motion = attachProgressMotion(track, fill, props.indeterminate)
|
|
26
|
+
}
|
|
27
|
+
function release() {
|
|
28
|
+
motion?.dispose()
|
|
29
|
+
motion = undefined
|
|
30
|
+
}
|
|
31
|
+
watch(
|
|
32
|
+
() => props.indeterminate,
|
|
33
|
+
(value) => motion?.update(value),
|
|
34
|
+
{ flush: 'post' },
|
|
35
|
+
)
|
|
36
|
+
onBeforeUnmount(release)
|
|
37
|
+
return () => {
|
|
38
|
+
checkProgressLabels(props.label, props.indeterminateLabel)
|
|
39
|
+
const reading = progressState(props.value, props.max)
|
|
40
|
+
const fraction = props.indeterminate ? progressMotion.segment : reading.ratio
|
|
41
|
+
return h(
|
|
42
|
+
MBox,
|
|
43
|
+
mergeProps(
|
|
44
|
+
{
|
|
45
|
+
width: props.width,
|
|
46
|
+
height: progressSizes[props.size],
|
|
47
|
+
grow: props.grow,
|
|
48
|
+
shrink: props.shrink,
|
|
49
|
+
radius: 'full',
|
|
50
|
+
backgroundColor: theme.value.colors.border,
|
|
51
|
+
},
|
|
52
|
+
attrs,
|
|
53
|
+
nativeAttrs(),
|
|
54
|
+
{
|
|
55
|
+
accessible: true,
|
|
56
|
+
accessibilityRole: 'progressBar',
|
|
57
|
+
accessibilityLabel: props.label,
|
|
58
|
+
accessibilityValue: props.indeterminate ? props.indeterminateLabel : reading.text,
|
|
59
|
+
clipToBounds: true,
|
|
60
|
+
onLoaded: (event: EventData) => {
|
|
61
|
+
track = event.object as View
|
|
62
|
+
connect()
|
|
63
|
+
},
|
|
64
|
+
onUnloaded: () => {
|
|
65
|
+
release()
|
|
66
|
+
track = undefined
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
),
|
|
70
|
+
{
|
|
71
|
+
default: () =>
|
|
72
|
+
h(MBox, {
|
|
73
|
+
width: fraction === 0 ? 0 : `${fraction * 100}%`,
|
|
74
|
+
height: progressSizes[props.size],
|
|
75
|
+
radius: 'full',
|
|
76
|
+
horizontalAlignment: 'left',
|
|
77
|
+
backgroundColor: theme.value.colors[props.tone],
|
|
78
|
+
accessible: false,
|
|
79
|
+
accessibilityHidden: true,
|
|
80
|
+
isUserInteractionEnabled: false,
|
|
81
|
+
onLoaded: (event: EventData) => {
|
|
82
|
+
fill = event.object as View
|
|
83
|
+
connect()
|
|
84
|
+
},
|
|
85
|
+
onUnloaded: () => {
|
|
86
|
+
release()
|
|
87
|
+
fill = undefined
|
|
88
|
+
},
|
|
89
|
+
}),
|
|
90
|
+
},
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
})
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { computed, defineComponent, h, mergeProps } from 'nativescript-vue'
|
|
2
|
+
import { choiceKey, validateChoices, canChoose } from '@getcortexlabs/mavis-core'
|
|
3
|
+
import { useButtonAction, radioGroupProps, radioGroupEmits } from '@getcortexlabs/mavis-core/vue'
|
|
4
|
+
import { MColumn } from './layout.js'
|
|
5
|
+
import { MText } from './MText.js'
|
|
6
|
+
import { ChoiceControl } from './ChoiceControl.js'
|
|
7
|
+
|
|
8
|
+
export const MRadioGroup = defineComponent({
|
|
9
|
+
name: 'MRadioGroup',
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: radioGroupProps,
|
|
12
|
+
emits: radioGroupEmits,
|
|
13
|
+
setup(props, { attrs, emit }) {
|
|
14
|
+
useButtonAction()
|
|
15
|
+
const options = computed(() => {
|
|
16
|
+
validateChoices(props.options, props.modelValue)
|
|
17
|
+
return props.options
|
|
18
|
+
})
|
|
19
|
+
return () =>
|
|
20
|
+
h(
|
|
21
|
+
MColumn,
|
|
22
|
+
mergeProps(attrs, {
|
|
23
|
+
id: props.id,
|
|
24
|
+
width: props.width,
|
|
25
|
+
grow: props.grow,
|
|
26
|
+
shrink: props.shrink,
|
|
27
|
+
gap: 'sm',
|
|
28
|
+
accessibilityHidden: props.accessibilityHidden,
|
|
29
|
+
}),
|
|
30
|
+
{
|
|
31
|
+
default: () => [
|
|
32
|
+
h(MText, {
|
|
33
|
+
text: props.label,
|
|
34
|
+
style: { fontWeight: '600' },
|
|
35
|
+
accessibilityHidden: props.accessibilityHidden,
|
|
36
|
+
}),
|
|
37
|
+
props.helperText
|
|
38
|
+
? h(MText, {
|
|
39
|
+
text: props.helperText,
|
|
40
|
+
variant: 'caption',
|
|
41
|
+
tone: 'muted',
|
|
42
|
+
accessibilityHidden: props.accessibilityHidden,
|
|
43
|
+
})
|
|
44
|
+
: null,
|
|
45
|
+
...options.value.map((option) =>
|
|
46
|
+
h(ChoiceControl, {
|
|
47
|
+
key: choiceKey(option.value),
|
|
48
|
+
radio: true,
|
|
49
|
+
modelValue: props.modelValue === option.value,
|
|
50
|
+
label: option.label,
|
|
51
|
+
helperText: option.helperText,
|
|
52
|
+
disabled: props.disabled || option.disabled,
|
|
53
|
+
accessibilityHidden: props.accessibilityHidden,
|
|
54
|
+
onActivate() {
|
|
55
|
+
if (canChoose(option, props.modelValue, props.disabled))
|
|
56
|
+
emit('update:modelValue', option.value)
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
),
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
)
|
|
63
|
+
},
|
|
64
|
+
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, h, mergeProps } from 'nativescript-vue'
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent, h, mergeProps, BaseTransition } from 'nativescript-vue'
|
|
2
|
+
import { useRevealMotion } from '../reveal-motion.js'
|
|
3
3
|
import { revealProps } from '@getcortexlabs/mavis-core/vue'
|
|
4
4
|
import { MColumn } from './layout.js'
|
|
5
5
|
import { isAndroid, type View } from '@nativescript/core'
|
|
@@ -11,20 +11,19 @@ export const MReveal = defineComponent({
|
|
|
11
11
|
inheritAttrs: false,
|
|
12
12
|
props: revealProps,
|
|
13
13
|
setup(props, { attrs, slots }) {
|
|
14
|
+
const motion = useRevealMotion()
|
|
14
15
|
let trigger: WeakRef<View> | undefined
|
|
15
16
|
let restore = false
|
|
16
17
|
return () => {
|
|
17
18
|
const { show, ...layout } = props
|
|
18
19
|
return h(
|
|
19
|
-
|
|
20
|
+
BaseTransition,
|
|
20
21
|
{
|
|
21
|
-
|
|
22
|
-
leave: [{ opacity: 0 }, { duration: 120 }],
|
|
22
|
+
...motion,
|
|
23
23
|
onBeforeEnter: (element: { nativeView?: View }) => {
|
|
24
24
|
if (element.nativeView)
|
|
25
25
|
element.nativeView.accessibilityHidden = Boolean(props.accessibilityHidden)
|
|
26
|
-
|
|
27
|
-
onEnter: (element: { nativeView?: View }) => {
|
|
26
|
+
|
|
28
27
|
const page = element.nativeView?.page
|
|
29
28
|
const focused = page && focusedView(page)
|
|
30
29
|
trigger = focused ? new WeakRef(focused) : undefined
|