@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,103 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineComponent,
|
|
3
|
+
h,
|
|
4
|
+
mergeProps,
|
|
5
|
+
onBeforeUnmount,
|
|
6
|
+
shallowRef,
|
|
7
|
+
watch,
|
|
8
|
+
registerElement,
|
|
9
|
+
} from 'nativescript-vue'
|
|
10
|
+
import { avatarProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
11
|
+
import { avatarSizes, avatarInitials, iconGlyph, iconFontFamily } from '@getcortexlabs/mavis-core'
|
|
12
|
+
import type { ImageSource } from '@nativescript/core'
|
|
13
|
+
import { loadAvatarImage } from '../../native/avatar-image'
|
|
14
|
+
import { useNativeViewAttrs } from '../accessibility.js'
|
|
15
|
+
import { MBox } from './layout.js'
|
|
16
|
+
import { MavisAvatarLabel } from '../../native/avatar-label'
|
|
17
|
+
|
|
18
|
+
registerElement('MavisAvatarLabel', () => MavisAvatarLabel)
|
|
19
|
+
|
|
20
|
+
export const MAvatar = defineComponent({
|
|
21
|
+
name: 'MAvatar',
|
|
22
|
+
inheritAttrs: false,
|
|
23
|
+
props: avatarProps,
|
|
24
|
+
setup(props, { attrs }) {
|
|
25
|
+
const { theme } = useMavisTheme()
|
|
26
|
+
const nativeAttrs = useNativeViewAttrs(props)
|
|
27
|
+
const image = shallowRef<ImageSource | null>(null)
|
|
28
|
+
let request = 0
|
|
29
|
+
watch(
|
|
30
|
+
() => props.src,
|
|
31
|
+
async (value) => {
|
|
32
|
+
const current = ++request
|
|
33
|
+
image.value = null
|
|
34
|
+
if (!value.trim()) return
|
|
35
|
+
try {
|
|
36
|
+
const result = await loadAvatarImage(value.trim())
|
|
37
|
+
if (current === request)
|
|
38
|
+
image.value = result && result.width > 0 && result.height > 0 ? result : null
|
|
39
|
+
} catch {
|
|
40
|
+
// Missing files, network failures and decode errors all keep the fallback.
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{ immediate: true },
|
|
44
|
+
)
|
|
45
|
+
onBeforeUnmount(() => {
|
|
46
|
+
request++
|
|
47
|
+
image.value = null
|
|
48
|
+
})
|
|
49
|
+
return () => {
|
|
50
|
+
const size = avatarSizes[props.size]
|
|
51
|
+
const radius = props.shape === 'circle' ? size / 2 : size / 4
|
|
52
|
+
const initials = avatarInitials(props.name)
|
|
53
|
+
const label = props.accessibilityLabel ?? props.name.trim()
|
|
54
|
+
return h(
|
|
55
|
+
MBox,
|
|
56
|
+
mergeProps(attrs, nativeAttrs(), {
|
|
57
|
+
width: size,
|
|
58
|
+
height: size,
|
|
59
|
+
radius,
|
|
60
|
+
shrink: 0,
|
|
61
|
+
backgroundColor: theme.value.colors.primarySoft,
|
|
62
|
+
accessible: Boolean(label),
|
|
63
|
+
accessibilityRole: 'image',
|
|
64
|
+
accessibilityLabel: label,
|
|
65
|
+
accessibilityHidden: nativeAttrs().accessibilityHidden || !label,
|
|
66
|
+
style: { alignSelf: 'flex-start' },
|
|
67
|
+
}),
|
|
68
|
+
{
|
|
69
|
+
default: () =>
|
|
70
|
+
image.value
|
|
71
|
+
? [
|
|
72
|
+
h('Image', {
|
|
73
|
+
imageSource: image.value,
|
|
74
|
+
stretch: 'aspectFill',
|
|
75
|
+
width: size,
|
|
76
|
+
height: size,
|
|
77
|
+
borderRadius: radius,
|
|
78
|
+
accessible: false,
|
|
79
|
+
accessibilityHidden: true,
|
|
80
|
+
}),
|
|
81
|
+
]
|
|
82
|
+
: [
|
|
83
|
+
h('MavisAvatarLabel', {
|
|
84
|
+
text: initials || iconGlyph('user-round'),
|
|
85
|
+
textWrap: false,
|
|
86
|
+
accessible: false,
|
|
87
|
+
accessibilityHidden: true,
|
|
88
|
+
iosAccessibilityAdjustsFontSize: false,
|
|
89
|
+
style: {
|
|
90
|
+
fontFamily: initials ? undefined : iconFontFamily,
|
|
91
|
+
fontSize: Math.round(size * (initials ? 0.34 : 0.46)),
|
|
92
|
+
fontWeight: '600',
|
|
93
|
+
color: theme.value.colors.primary,
|
|
94
|
+
textAlignment: 'center',
|
|
95
|
+
verticalAlignment: 'middle',
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
})
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineComponent, h, mergeProps } from 'nativescript-vue'
|
|
2
|
+
import { badgeProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
3
|
+
import { badgeColors } from '@getcortexlabs/mavis-core'
|
|
4
|
+
import { MText } from './MText.js'
|
|
5
|
+
|
|
6
|
+
export const MBadge = defineComponent({
|
|
7
|
+
name: 'MBadge',
|
|
8
|
+
inheritAttrs: false,
|
|
9
|
+
props: badgeProps,
|
|
10
|
+
setup(props, { attrs }) {
|
|
11
|
+
const { theme } = useMavisTheme()
|
|
12
|
+
return () =>
|
|
13
|
+
h(
|
|
14
|
+
MText,
|
|
15
|
+
mergeProps(attrs, {
|
|
16
|
+
id: props.id,
|
|
17
|
+
text: String(props.text),
|
|
18
|
+
variant: 'caption',
|
|
19
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
20
|
+
accessibilityHidden: props.accessibilityHidden,
|
|
21
|
+
style: {
|
|
22
|
+
...badgeColors(theme.value.colors, props.tone),
|
|
23
|
+
alignSelf: 'flex-start',
|
|
24
|
+
fontSize: props.size === 'sm' ? 11 : 13,
|
|
25
|
+
fontWeight: '600',
|
|
26
|
+
padding: props.size === 'sm' ? '3 8' : '5 10',
|
|
27
|
+
borderRadius: 999,
|
|
28
|
+
textAlignment: 'center',
|
|
29
|
+
minWidth: props.size === 'sm' ? 22 : 28,
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
)
|
|
33
|
+
},
|
|
34
|
+
})
|
|
@@ -1,19 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MRow } from './layout.js'
|
|
2
|
+
import { MText } from './MText.js'
|
|
3
|
+
import { MIcon } from './MIcon.js'
|
|
4
|
+
import { ActionChildren } from '../accessibility.js'
|
|
5
|
+
import { observeComposedButton } from '../../native/composed-button'
|
|
2
6
|
import {
|
|
7
|
+
defineComponent,
|
|
8
|
+
h,
|
|
9
|
+
mergeProps,
|
|
10
|
+
registerElement,
|
|
11
|
+
onBeforeUnmount,
|
|
12
|
+
ref,
|
|
13
|
+
type VNode,
|
|
14
|
+
type SlotsType,
|
|
15
|
+
} from 'nativescript-vue'
|
|
16
|
+
import {
|
|
17
|
+
useButtonAction,
|
|
3
18
|
buttonProps,
|
|
19
|
+
buttonContent,
|
|
20
|
+
ButtonAdornment,
|
|
4
21
|
useMavisTheme,
|
|
5
22
|
actionEmits,
|
|
6
23
|
textContent,
|
|
7
24
|
useDefaultShrink,
|
|
8
25
|
} from '@getcortexlabs/mavis-core/vue'
|
|
9
26
|
import {
|
|
27
|
+
fontFamily,
|
|
28
|
+
resolveRadius,
|
|
29
|
+
shadowStyle,
|
|
10
30
|
nonNegative,
|
|
11
31
|
iconGlyph,
|
|
12
32
|
iconFontFamily,
|
|
13
33
|
iconSizes,
|
|
14
34
|
checkIconOnly,
|
|
15
35
|
} from '@getcortexlabs/mavis-core'
|
|
16
|
-
import { isAndroid } from '@nativescript/core'
|
|
36
|
+
import { isAndroid, type EventData, type View } from '@nativescript/core'
|
|
37
|
+
import { useMotionSurface } from '../use-motion-surface.js'
|
|
17
38
|
import { usePressFeedback } from '../use-press.js'
|
|
18
39
|
import { MavisButton } from '../../native/button'
|
|
19
40
|
import { useNativeViewAttrs } from '../accessibility.js'
|
|
@@ -25,20 +46,44 @@ export const MButton = defineComponent({
|
|
|
25
46
|
inheritAttrs: false,
|
|
26
47
|
props: buttonProps,
|
|
27
48
|
emits: actionEmits,
|
|
49
|
+
slots: Object as SlotsType<{
|
|
50
|
+
default?: () => VNode[]
|
|
51
|
+
leading?: () => VNode[]
|
|
52
|
+
trailing?: () => VNode[]
|
|
53
|
+
}>,
|
|
28
54
|
setup(props, { attrs, slots, emit }) {
|
|
55
|
+
useButtonAction()
|
|
29
56
|
const { theme } = useMavisTheme()
|
|
30
57
|
const nativeAttrs = useNativeViewAttrs(props)
|
|
31
58
|
const shrink = useDefaultShrink()
|
|
32
59
|
const enabled = () => !props.disabled && !props.loading
|
|
33
|
-
const
|
|
60
|
+
const keyboardPressed = ref(false)
|
|
61
|
+
const lifecycle = usePressFeedback(enabled, theme, keyboardPressed)
|
|
62
|
+
const { allowsActivation, ...surface } = useMotionSurface(() => props.motionSurface, enabled)
|
|
63
|
+
const focused = ref(false)
|
|
64
|
+
let releaseFocus: (() => void) | undefined
|
|
65
|
+
const clearFocus = () => {
|
|
66
|
+
releaseFocus?.()
|
|
67
|
+
releaseFocus = undefined
|
|
68
|
+
focused.value = false
|
|
69
|
+
}
|
|
70
|
+
onBeforeUnmount(clearFocus)
|
|
34
71
|
return () => {
|
|
35
72
|
const { colors, control, radius } = theme.value
|
|
73
|
+
const tokens = theme.value.components.button
|
|
74
|
+
const family = fontFamily(
|
|
75
|
+
tokens.fontFamily ?? theme.value.typography.body.fontFamily,
|
|
76
|
+
isAndroid ? 'android' : 'ios',
|
|
77
|
+
)
|
|
36
78
|
const size = control[props.size]
|
|
37
79
|
const primary = props.variant === 'primary'
|
|
38
80
|
const text = props.loading
|
|
39
81
|
? props.loadingText
|
|
40
82
|
: (props.text ?? textContent(slots.default?.()))
|
|
41
|
-
const
|
|
83
|
+
const leading = buttonContent(slots.leading?.())
|
|
84
|
+
const trailing = buttonContent(slots.trailing?.())
|
|
85
|
+
const composed = Boolean(slots.leading || slots.trailing)
|
|
86
|
+
const hasIcon = Boolean(composed || props.icon || props.trailingIcon)
|
|
42
87
|
checkIconOnly(text, hasIcon, props.accessibilityLabel)
|
|
43
88
|
const iconSize = iconSizes[props.size]
|
|
44
89
|
const minHeight = Math.max(size.height, isAndroid ? 48 : 44)
|
|
@@ -47,6 +92,121 @@ export const MButton = defineComponent({
|
|
|
47
92
|
name
|
|
48
93
|
? h('Span', { text: iconGlyph(name), fontFamily: iconFontFamily, fontSize: iconSize })
|
|
49
94
|
: null
|
|
95
|
+
if (composed) {
|
|
96
|
+
const tone = primary ? 'onPrimary' : 'text'
|
|
97
|
+
const adornment = (children: ReturnType<typeof buttonContent>) =>
|
|
98
|
+
h(
|
|
99
|
+
MRow,
|
|
100
|
+
{
|
|
101
|
+
shrink: 0,
|
|
102
|
+
align: 'center',
|
|
103
|
+
accessibilityHidden: true,
|
|
104
|
+
isUserInteractionEnabled: false,
|
|
105
|
+
},
|
|
106
|
+
{ default: () => h(ButtonAdornment, {}, { default: () => children }) },
|
|
107
|
+
)
|
|
108
|
+
return h(
|
|
109
|
+
MRow,
|
|
110
|
+
mergeProps(
|
|
111
|
+
{
|
|
112
|
+
justify: 'center',
|
|
113
|
+
align: 'center',
|
|
114
|
+
wrap: true,
|
|
115
|
+
gap: 8,
|
|
116
|
+
style: {
|
|
117
|
+
minWidth: minHeight,
|
|
118
|
+
minHeight,
|
|
119
|
+
margin: 0,
|
|
120
|
+
paddingLeft: paddingX,
|
|
121
|
+
paddingRight: paddingX,
|
|
122
|
+
paddingTop: tokens.paddingY,
|
|
123
|
+
paddingBottom: tokens.paddingY,
|
|
124
|
+
backgroundColor: primary
|
|
125
|
+
? colors.primary
|
|
126
|
+
: props.variant === 'secondary'
|
|
127
|
+
? colors.elevated
|
|
128
|
+
: 'transparent',
|
|
129
|
+
borderRadius: resolveRadius(theme.value, tokens.radius),
|
|
130
|
+
borderWidth: focused.value ? 2 : 0,
|
|
131
|
+
borderColor: colors.primary,
|
|
132
|
+
boxShadow:
|
|
133
|
+
tokens.elevation === 'none'
|
|
134
|
+
? undefined
|
|
135
|
+
: shadowStyle(theme.value.elevation[tokens.elevation], 'native'),
|
|
136
|
+
opacity: props.disabled ? 0.45 : 1,
|
|
137
|
+
flexGrow: nonNegative(props.grow, 'grow'),
|
|
138
|
+
flexShrink: nonNegative(props.shrink ?? shrink, 'shrink'),
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
nativeAttrs(),
|
|
142
|
+
attrs,
|
|
143
|
+
lifecycle,
|
|
144
|
+
surface,
|
|
145
|
+
{
|
|
146
|
+
isEnabled: enabled(),
|
|
147
|
+
accessible: true,
|
|
148
|
+
accessibilityRole: 'button',
|
|
149
|
+
accessibilityState: enabled() ? '' : 'disabled',
|
|
150
|
+
accessibilityLabel: props.accessibilityLabel ?? text,
|
|
151
|
+
accessibilityValue: props.accessibilityLabel ? text : undefined,
|
|
152
|
+
onTap: () => {
|
|
153
|
+
if (enabled() && allowsActivation()) emit('click')
|
|
154
|
+
},
|
|
155
|
+
onLoaded: (event: EventData) => {
|
|
156
|
+
clearFocus()
|
|
157
|
+
releaseFocus = observeComposedButton(
|
|
158
|
+
event.object as View,
|
|
159
|
+
(value) => {
|
|
160
|
+
focused.value = value
|
|
161
|
+
},
|
|
162
|
+
() => {
|
|
163
|
+
if (enabled() && allowsActivation()) emit('click')
|
|
164
|
+
},
|
|
165
|
+
(value) => {
|
|
166
|
+
keyboardPressed.value = value
|
|
167
|
+
},
|
|
168
|
+
)
|
|
169
|
+
},
|
|
170
|
+
onUnloaded: clearFocus,
|
|
171
|
+
},
|
|
172
|
+
),
|
|
173
|
+
{
|
|
174
|
+
default: () =>
|
|
175
|
+
h(
|
|
176
|
+
ActionChildren,
|
|
177
|
+
{ hidden: true },
|
|
178
|
+
{
|
|
179
|
+
default: () => [
|
|
180
|
+
slots.leading
|
|
181
|
+
? adornment(leading)
|
|
182
|
+
: props.icon
|
|
183
|
+
? h(MIcon, { name: props.icon, size: props.size, tone })
|
|
184
|
+
: null,
|
|
185
|
+
text
|
|
186
|
+
? h(MText, {
|
|
187
|
+
text,
|
|
188
|
+
shrink: 0,
|
|
189
|
+
tone,
|
|
190
|
+
align: 'center',
|
|
191
|
+
style: {
|
|
192
|
+
fontSize: size.fontSize,
|
|
193
|
+
fontWeight: tokens.fontWeight,
|
|
194
|
+
fontFamily: family,
|
|
195
|
+
lineHeight: size.fontSize * (tokens.lineHeight - 1),
|
|
196
|
+
},
|
|
197
|
+
})
|
|
198
|
+
: null,
|
|
199
|
+
slots.trailing
|
|
200
|
+
? adornment(trailing)
|
|
201
|
+
: props.trailingIcon
|
|
202
|
+
? h(MIcon, { name: props.trailingIcon, size: props.size, tone })
|
|
203
|
+
: null,
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
),
|
|
207
|
+
},
|
|
208
|
+
)
|
|
209
|
+
}
|
|
50
210
|
return h(
|
|
51
211
|
'MavisButton',
|
|
52
212
|
mergeProps(
|
|
@@ -62,10 +222,12 @@ export const MButton = defineComponent({
|
|
|
62
222
|
minHeight,
|
|
63
223
|
paddingLeft: paddingX,
|
|
64
224
|
paddingRight: paddingX,
|
|
65
|
-
paddingTop:
|
|
66
|
-
paddingBottom:
|
|
225
|
+
paddingTop: tokens.paddingY,
|
|
226
|
+
paddingBottom: tokens.paddingY,
|
|
67
227
|
fontSize: size.fontSize,
|
|
68
|
-
fontWeight:
|
|
228
|
+
fontWeight: tokens.fontWeight,
|
|
229
|
+
fontFamily: family,
|
|
230
|
+
lineHeight: size.fontSize * (tokens.lineHeight - 1),
|
|
69
231
|
textTransform: 'none',
|
|
70
232
|
backgroundColor: primary
|
|
71
233
|
? colors.primary
|
|
@@ -73,7 +235,11 @@ export const MButton = defineComponent({
|
|
|
73
235
|
? colors.elevated
|
|
74
236
|
: 'transparent',
|
|
75
237
|
color: primary ? colors.onPrimary : colors.text,
|
|
76
|
-
borderRadius:
|
|
238
|
+
borderRadius: resolveRadius(theme.value, tokens.radius),
|
|
239
|
+
boxShadow:
|
|
240
|
+
tokens.elevation === 'none'
|
|
241
|
+
? undefined
|
|
242
|
+
: shadowStyle(theme.value.elevation[tokens.elevation], 'native'),
|
|
77
243
|
borderWidth: 0,
|
|
78
244
|
androidElevation: 0,
|
|
79
245
|
androidDynamicElevationOffset: 0,
|
|
@@ -87,6 +253,7 @@ export const MButton = defineComponent({
|
|
|
87
253
|
nativeAttrs(),
|
|
88
254
|
attrs,
|
|
89
255
|
lifecycle,
|
|
256
|
+
surface,
|
|
90
257
|
{
|
|
91
258
|
isEnabled: enabled(),
|
|
92
259
|
accessible: true,
|
|
@@ -96,7 +263,7 @@ export const MButton = defineComponent({
|
|
|
96
263
|
accessibilityValue:
|
|
97
264
|
attrs.accessibilityValue ?? (props.accessibilityLabel ? text : undefined),
|
|
98
265
|
onTap: () => {
|
|
99
|
-
if (enabled()) emit('click')
|
|
266
|
+
if (enabled() && allowsActivation()) emit('click')
|
|
100
267
|
},
|
|
101
268
|
},
|
|
102
269
|
),
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { resolveSpace, resolveRadius, shadowStyle } from '@getcortexlabs/mavis-core'
|
|
1
2
|
import { ActionChildren } from '../accessibility.js'
|
|
2
3
|
import { defineComponent, h, mergeProps } from 'nativescript-vue'
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
useButtonAction,
|
|
6
|
+
cardProps,
|
|
7
|
+
useMavisTheme,
|
|
8
|
+
actionEmits,
|
|
9
|
+
} from '@getcortexlabs/mavis-core/vue'
|
|
4
10
|
import { MColumn } from './layout.js'
|
|
5
11
|
import { usePressFeedback } from '../use-press.js'
|
|
12
|
+
import { useMotionSurface } from '../use-motion-surface.js'
|
|
6
13
|
|
|
7
14
|
export const MCard = defineComponent({
|
|
8
15
|
name: 'MCard',
|
|
@@ -10,17 +17,29 @@ export const MCard = defineComponent({
|
|
|
10
17
|
props: cardProps,
|
|
11
18
|
emits: actionEmits,
|
|
12
19
|
setup(props, { attrs, slots, emit }) {
|
|
20
|
+
useButtonAction(() => props.interactive)
|
|
13
21
|
const { theme } = useMavisTheme()
|
|
14
22
|
const enabled = () => props.interactive && !props.disabled
|
|
15
23
|
const lifecycle = usePressFeedback(enabled, theme)
|
|
24
|
+
const { allowsActivation, ...surface } = useMotionSurface(
|
|
25
|
+
() => props.motionSurface,
|
|
26
|
+
() => !props.disabled,
|
|
27
|
+
)
|
|
16
28
|
return () => {
|
|
17
|
-
const { interactive, disabled, ...layout } = props
|
|
29
|
+
const { interactive, disabled, elevation, motionSurface, ...layout } = props
|
|
30
|
+
const tokens = theme.value.components.card
|
|
31
|
+
layout.padding ??= tokens.padding
|
|
32
|
+
layout.radius ??= tokens.radius
|
|
18
33
|
return h(
|
|
19
34
|
MColumn,
|
|
20
35
|
mergeProps(
|
|
21
36
|
layout,
|
|
22
37
|
{
|
|
23
38
|
style: {
|
|
39
|
+
boxShadow:
|
|
40
|
+
(elevation ?? tokens.elevation) === 'none'
|
|
41
|
+
? undefined
|
|
42
|
+
: shadowStyle(theme.value.elevation[elevation ?? tokens.elevation], 'native'),
|
|
24
43
|
backgroundColor: props.backgroundColor ?? theme.value.colors.surface,
|
|
25
44
|
borderColor: theme.value.colors.border,
|
|
26
45
|
borderWidth: 1,
|
|
@@ -29,13 +48,14 @@ export const MCard = defineComponent({
|
|
|
29
48
|
},
|
|
30
49
|
attrs,
|
|
31
50
|
lifecycle,
|
|
51
|
+
surface,
|
|
32
52
|
{
|
|
33
53
|
accessible: interactive,
|
|
34
54
|
accessibilityRole: interactive ? 'button' : '',
|
|
35
55
|
accessibilityState: interactive && disabled ? 'disabled' : '',
|
|
36
56
|
onTap: interactive
|
|
37
57
|
? () => {
|
|
38
|
-
if (enabled()) emit('click')
|
|
58
|
+
if (enabled() && allowsActivation()) emit('click')
|
|
39
59
|
}
|
|
40
60
|
: undefined,
|
|
41
61
|
},
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineComponent, h } from 'nativescript-vue'
|
|
2
|
+
import { useButtonAction, checkboxProps, checkboxEmits } from '@getcortexlabs/mavis-core/vue'
|
|
3
|
+
import { ChoiceControl } from './ChoiceControl.js'
|
|
4
|
+
|
|
5
|
+
export const MCheckbox = defineComponent({
|
|
6
|
+
name: 'MCheckbox',
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
props: checkboxProps,
|
|
9
|
+
emits: checkboxEmits,
|
|
10
|
+
setup(props, { attrs, emit }) {
|
|
11
|
+
useButtonAction()
|
|
12
|
+
return () =>
|
|
13
|
+
h(ChoiceControl, {
|
|
14
|
+
...attrs,
|
|
15
|
+
...props,
|
|
16
|
+
radio: false,
|
|
17
|
+
onActivate() {
|
|
18
|
+
if (props.disabled) return
|
|
19
|
+
const next = props.indeterminate || !props.modelValue
|
|
20
|
+
if (props.indeterminate) emit('update:indeterminate', false)
|
|
21
|
+
emit('update:modelValue', next)
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
},
|
|
25
|
+
})
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { defineComponent, h, mergeProps } from 'nativescript-vue'
|
|
2
|
+
import { checkChipLabels, chipColors } from '@getcortexlabs/mavis-core'
|
|
3
|
+
import { useButtonAction, chipProps, chipEmits, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
4
|
+
import { usePressFeedback } from '../use-press.js'
|
|
5
|
+
import { ActionChildren, useNativeViewAttrs } from '../accessibility.js'
|
|
6
|
+
import { MRow } from './layout.js'
|
|
7
|
+
import { MText } from './MText.js'
|
|
8
|
+
import { MIcon } from './MIcon.js'
|
|
9
|
+
import { MButton } from './MButton.js'
|
|
10
|
+
|
|
11
|
+
export const MChip = defineComponent({
|
|
12
|
+
name: 'MChip',
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: chipProps,
|
|
15
|
+
emits: chipEmits,
|
|
16
|
+
setup(props, { attrs, emit }) {
|
|
17
|
+
useButtonAction()
|
|
18
|
+
const { theme } = useMavisTheme()
|
|
19
|
+
const nativeAttrs = useNativeViewAttrs(props)
|
|
20
|
+
const lifecycle = usePressFeedback(() => props.selectable && !props.disabled, theme)
|
|
21
|
+
return () => {
|
|
22
|
+
checkChipLabels(props.label, props.removable, props.removeLabel)
|
|
23
|
+
const selected = props.selectable && props.modelValue
|
|
24
|
+
const colors = chipColors(theme.value.colors, props.tone, selected)
|
|
25
|
+
const icon = selected ? 'check' : props.icon
|
|
26
|
+
return h(
|
|
27
|
+
MRow,
|
|
28
|
+
mergeProps(attrs, {
|
|
29
|
+
id: props.id,
|
|
30
|
+
width: props.width,
|
|
31
|
+
grow: props.grow,
|
|
32
|
+
shrink: props.shrink,
|
|
33
|
+
accessibilityHidden: props.accessibilityHidden,
|
|
34
|
+
align: 'stretch',
|
|
35
|
+
radius: 'full',
|
|
36
|
+
style: {
|
|
37
|
+
...colors,
|
|
38
|
+
borderWidth: 1,
|
|
39
|
+
opacity: props.disabled ? 0.45 : 1,
|
|
40
|
+
alignSelf: 'flex-start',
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
{
|
|
44
|
+
default: () => [
|
|
45
|
+
h(
|
|
46
|
+
MRow,
|
|
47
|
+
mergeProps(
|
|
48
|
+
{
|
|
49
|
+
gap: 'xs',
|
|
50
|
+
paddingX: 14,
|
|
51
|
+
paddingY: 15,
|
|
52
|
+
grow: 1,
|
|
53
|
+
shrink: 1,
|
|
54
|
+
radius: 'full',
|
|
55
|
+
accessible: true,
|
|
56
|
+
accessibilityRole: props.selectable ? 'button' : 'text',
|
|
57
|
+
accessibilityLabel: props.label,
|
|
58
|
+
// Core accepts one state token; unavailable takes precedence over selected.
|
|
59
|
+
accessibilityState: props.selectable
|
|
60
|
+
? props.disabled
|
|
61
|
+
? 'disabled'
|
|
62
|
+
: selected
|
|
63
|
+
? 'selected'
|
|
64
|
+
: ''
|
|
65
|
+
: '',
|
|
66
|
+
accessibilityHidden: nativeAttrs().accessibilityHidden,
|
|
67
|
+
isEnabled: !props.disabled,
|
|
68
|
+
style: { minHeight: 46 },
|
|
69
|
+
onTap: props.selectable
|
|
70
|
+
? () => {
|
|
71
|
+
if (!props.disabled) emit('update:modelValue', !props.modelValue)
|
|
72
|
+
}
|
|
73
|
+
: undefined,
|
|
74
|
+
},
|
|
75
|
+
lifecycle,
|
|
76
|
+
),
|
|
77
|
+
{
|
|
78
|
+
default: () =>
|
|
79
|
+
h(
|
|
80
|
+
ActionChildren,
|
|
81
|
+
{ hidden: true },
|
|
82
|
+
{
|
|
83
|
+
default: () => [
|
|
84
|
+
icon || props.selectable
|
|
85
|
+
? h(MIcon, {
|
|
86
|
+
name: icon ?? 'check',
|
|
87
|
+
size: 'sm',
|
|
88
|
+
tone: selected ? props.tone : 'muted',
|
|
89
|
+
style: { opacity: icon ? 1 : 0 },
|
|
90
|
+
})
|
|
91
|
+
: null,
|
|
92
|
+
h(MText, {
|
|
93
|
+
text: props.label,
|
|
94
|
+
variant: 'caption',
|
|
95
|
+
tone: selected ? props.tone : 'text',
|
|
96
|
+
shrink: 1,
|
|
97
|
+
style: { fontWeight: '600' },
|
|
98
|
+
}),
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
),
|
|
102
|
+
},
|
|
103
|
+
),
|
|
104
|
+
props.removable
|
|
105
|
+
? h(MButton, {
|
|
106
|
+
icon: 'x',
|
|
107
|
+
size: 'sm',
|
|
108
|
+
variant: 'ghost',
|
|
109
|
+
disabled: props.disabled,
|
|
110
|
+
accessibilityHidden: props.accessibilityHidden,
|
|
111
|
+
accessibilityLabel: props.removeLabel,
|
|
112
|
+
width: 46,
|
|
113
|
+
shrink: 0,
|
|
114
|
+
style: {
|
|
115
|
+
minHeight: 46,
|
|
116
|
+
borderRadius: 999,
|
|
117
|
+
paddingLeft: 0,
|
|
118
|
+
paddingRight: 0,
|
|
119
|
+
paddingTop: 0,
|
|
120
|
+
paddingBottom: 0,
|
|
121
|
+
color: colors.color,
|
|
122
|
+
opacity: 1,
|
|
123
|
+
},
|
|
124
|
+
onClick: () => {
|
|
125
|
+
if (!props.disabled) emit('remove')
|
|
126
|
+
},
|
|
127
|
+
})
|
|
128
|
+
: null,
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
})
|