@getcortexlabs/mavis-web 0.1.0-alpha.1 → 0.1.0-alpha.10
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 +8 -4
- package/dist/appearance.d.ts +4 -0
- package/dist/appearance.d.ts.map +1 -0
- package/dist/appearance.js +23 -0
- package/dist/appearance.js.map +1 -0
- package/dist/collection-motion.d.ts +4 -0
- package/dist/collection-motion.d.ts.map +1 -0
- package/dist/collection-motion.js +97 -0
- package/dist/collection-motion.js.map +1 -0
- package/dist/components/ChoicePaint.d.ts +17 -0
- package/dist/components/ChoicePaint.d.ts.map +1 -0
- package/dist/components/ChoicePaint.js +81 -0
- package/dist/components/ChoicePaint.js.map +1 -0
- package/dist/components/DateCalendar.d.ts +95 -0
- package/dist/components/DateCalendar.d.ts.map +1 -0
- package/dist/components/DateCalendar.js +157 -0
- package/dist/components/DateCalendar.js.map +1 -0
- package/dist/components/LoadingDecoration.d.ts +116 -0
- package/dist/components/LoadingDecoration.d.ts.map +1 -0
- package/dist/components/LoadingDecoration.js +35 -0
- package/dist/components/LoadingDecoration.js.map +1 -0
- package/dist/components/MAccordion.d.ts +119 -0
- package/dist/components/MAccordion.d.ts.map +1 -0
- package/dist/components/MAccordion.js +180 -0
- package/dist/components/MAccordion.js.map +1 -0
- package/dist/components/MAlert.d.ts +109 -0
- package/dist/components/MAlert.d.ts.map +1 -0
- package/dist/components/MAlert.js +88 -0
- package/dist/components/MAlert.js.map +1 -0
- package/dist/components/MAvatar.d.ts +80 -0
- package/dist/components/MAvatar.d.ts.map +1 -0
- package/dist/components/MAvatar.js +88 -0
- package/dist/components/MAvatar.js.map +1 -0
- package/dist/components/MBadge.d.ts +70 -0
- package/dist/components/MBadge.d.ts.map +1 -0
- package/dist/components/MBadge.js +35 -0
- package/dist/components/MBadge.js.map +1 -0
- package/dist/components/MButton.d.ts +215 -35
- package/dist/components/MButton.d.ts.map +1 -1
- package/dist/components/MButton.js +104 -19
- package/dist/components/MButton.js.map +1 -1
- package/dist/components/MCard.d.ts +118 -25
- package/dist/components/MCard.d.ts.map +1 -1
- package/dist/components/MCard.js +69 -33
- package/dist/components/MCard.js.map +1 -1
- package/dist/components/MCheckbox.d.ts +103 -0
- package/dist/components/MCheckbox.d.ts.map +1 -0
- package/dist/components/MCheckbox.js +132 -0
- package/dist/components/MCheckbox.js.map +1 -0
- package/dist/components/MChip.d.ts +117 -0
- package/dist/components/MChip.d.ts.map +1 -0
- package/dist/components/MChip.js +103 -0
- package/dist/components/MChip.js.map +1 -0
- package/dist/components/MCombobox.d.ts +282 -0
- package/dist/components/MCombobox.d.ts.map +1 -0
- package/dist/components/MCombobox.js +450 -0
- package/dist/components/MCombobox.js.map +1 -0
- package/dist/components/MDatePicker.d.ts +1350 -0
- package/dist/components/MDatePicker.d.ts.map +1 -0
- package/dist/components/MDatePicker.js +23 -0
- package/dist/components/MDatePicker.js.map +1 -0
- package/dist/components/MDialog.d.ts +99 -0
- package/dist/components/MDialog.d.ts.map +1 -0
- package/dist/components/MDialog.js +279 -0
- package/dist/components/MDialog.js.map +1 -0
- package/dist/components/MEmptyState.d.ts +117 -0
- package/dist/components/MEmptyState.d.ts.map +1 -0
- package/dist/components/MEmptyState.js +79 -0
- package/dist/components/MEmptyState.js.map +1 -0
- package/dist/components/MFilePicker.d.ts +112 -0
- package/dist/components/MFilePicker.d.ts.map +1 -0
- package/dist/components/MFilePicker.js +193 -0
- package/dist/components/MFilePicker.js.map +1 -0
- package/dist/components/MGrid.d.ts +163 -0
- package/dist/components/MGrid.d.ts.map +1 -0
- package/dist/components/MGrid.js +32 -0
- package/dist/components/MGrid.js.map +1 -0
- package/dist/components/MIcon.d.ts +75 -0
- package/dist/components/MIcon.d.ts.map +1 -0
- package/dist/components/MIcon.js +38 -0
- package/dist/components/MIcon.js.map +1 -0
- package/dist/components/MImage.d.ts +248 -0
- package/dist/components/MImage.d.ts.map +1 -0
- package/dist/components/MImage.js +163 -0
- package/dist/components/MImage.js.map +1 -0
- package/dist/components/MInput.d.ts +201 -53
- package/dist/components/MInput.d.ts.map +1 -1
- package/dist/components/MInput.js +192 -71
- package/dist/components/MInput.js.map +1 -1
- package/dist/components/MLink.d.ts +120 -0
- package/dist/components/MLink.d.ts.map +1 -0
- package/dist/components/MLink.js +47 -0
- package/dist/components/MLink.js.map +1 -0
- package/dist/components/MListItem.d.ts +106 -0
- package/dist/components/MListItem.d.ts.map +1 -0
- package/dist/components/MListItem.js +53 -0
- package/dist/components/MListItem.js.map +1 -0
- package/dist/components/MPopover.d.ts +105 -0
- package/dist/components/MPopover.d.ts.map +1 -0
- package/dist/components/MPopover.js +238 -0
- package/dist/components/MPopover.js.map +1 -0
- package/dist/components/MProgress.d.ts +122 -0
- package/dist/components/MProgress.d.ts.map +1 -0
- package/dist/components/MProgress.js +69 -0
- package/dist/components/MProgress.js.map +1 -0
- package/dist/components/MRadioGroup.d.ts +104 -0
- package/dist/components/MRadioGroup.d.ts.map +1 -0
- package/dist/components/MRadioGroup.js +191 -0
- package/dist/components/MRadioGroup.js.map +1 -0
- package/dist/components/MReveal.d.ts +76 -40
- package/dist/components/MReveal.d.ts.map +1 -1
- package/dist/components/MReveal.js +43 -29
- package/dist/components/MReveal.js.map +1 -1
- package/dist/components/MScreen.d.ts +40 -7
- package/dist/components/MScreen.d.ts.map +1 -1
- package/dist/components/MScreen.js +59 -17
- package/dist/components/MScreen.js.map +1 -1
- package/dist/components/MSegmentedControl.d.ts +95 -0
- package/dist/components/MSegmentedControl.d.ts.map +1 -0
- package/dist/components/MSegmentedControl.js +128 -0
- package/dist/components/MSegmentedControl.js.map +1 -0
- package/dist/components/MSelect.d.ts +140 -0
- package/dist/components/MSelect.d.ts.map +1 -0
- package/dist/components/MSelect.js +314 -0
- package/dist/components/MSelect.js.map +1 -0
- package/dist/components/MSeparator.d.ts +56 -0
- package/dist/components/MSeparator.d.ts.map +1 -0
- package/dist/components/MSeparator.js +36 -0
- package/dist/components/MSeparator.js.map +1 -0
- package/dist/components/MSheet.d.ts +117 -0
- package/dist/components/MSheet.d.ts.map +1 -0
- package/dist/components/MSheet.js +303 -0
- package/dist/components/MSheet.js.map +1 -0
- package/dist/components/MSkeleton.d.ts +89 -0
- package/dist/components/MSkeleton.d.ts.map +1 -0
- package/dist/components/MSkeleton.js +49 -0
- package/dist/components/MSkeleton.js.map +1 -0
- package/dist/components/MSlider.d.ts +9 -5
- package/dist/components/MSlider.d.ts.map +1 -1
- package/dist/components/MSlider.js +14 -2
- package/dist/components/MSlider.js.map +1 -1
- package/dist/components/MStack.d.ts +198 -0
- package/dist/components/MStack.d.ts.map +1 -0
- package/dist/components/MStack.js +52 -0
- package/dist/components/MStack.js.map +1 -0
- package/dist/components/MSwitch.d.ts +89 -0
- package/dist/components/MSwitch.d.ts.map +1 -0
- package/dist/components/MSwitch.js +94 -0
- package/dist/components/MSwitch.js.map +1 -0
- package/dist/components/MTabs.d.ts +101 -0
- package/dist/components/MTabs.d.ts.map +1 -0
- package/dist/components/MTabs.js +228 -0
- package/dist/components/MTabs.js.map +1 -0
- package/dist/components/MText.d.ts +62 -26
- package/dist/components/MText.d.ts.map +1 -1
- package/dist/components/MText.js +37 -13
- package/dist/components/MText.js.map +1 -1
- package/dist/components/MTimePicker.d.ts +655 -0
- package/dist/components/MTimePicker.d.ts.map +1 -0
- package/dist/components/MTimePicker.js +81 -0
- package/dist/components/MTimePicker.js.map +1 -0
- package/dist/components/MToast.d.ts +24 -0
- package/dist/components/MToast.d.ts.map +1 -0
- package/dist/components/MToast.js +196 -0
- package/dist/components/MToast.js.map +1 -0
- package/dist/components/MVirtualList.d.ts +3 -0
- package/dist/components/MVirtualList.d.ts.map +1 -0
- package/dist/components/MVirtualList.js +109 -0
- package/dist/components/MVirtualList.js.map +1 -0
- package/dist/components/configurator.d.ts +541 -0
- package/dist/components/configurator.d.ts.map +1 -0
- package/dist/components/configurator.js +20 -0
- package/dist/components/configurator.js.map +1 -0
- package/dist/components/layout.d.ts +425 -95
- package/dist/components/layout.d.ts.map +1 -1
- package/dist/components/layout.js +18 -13
- package/dist/components/layout.js.map +1 -1
- package/dist/components/navigation.d.ts +225 -0
- package/dist/components/navigation.d.ts.map +1 -0
- package/dist/components/navigation.js +41 -0
- package/dist/components/navigation.js.map +1 -0
- package/dist/components/workflows.d.ts +251 -0
- package/dist/components/workflows.d.ts.map +1 -0
- package/dist/components/workflows.js +23 -0
- package/dist/components/workflows.js.map +1 -0
- package/dist/connected-motion.d.ts +6 -0
- package/dist/connected-motion.d.ts.map +1 -0
- package/dist/connected-motion.js +18 -0
- package/dist/connected-motion.js.map +1 -0
- package/dist/content-width.d.ts +4 -0
- package/dist/content-width.d.ts.map +1 -0
- package/dist/content-width.js +62 -0
- package/dist/content-width.js.map +1 -0
- package/dist/date-format.d.ts +6 -0
- package/dist/date-format.d.ts.map +1 -0
- package/dist/date-format.js +23 -0
- package/dist/date-format.js.map +1 -0
- package/dist/experimental.d.ts +11 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +31 -0
- package/dist/experimental.js.map +1 -0
- package/dist/files.d.ts +6 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +82 -0
- package/dist/files.js.map +1 -0
- package/dist/hydration.d.ts +3 -0
- package/dist/hydration.d.ts.map +1 -0
- package/dist/hydration.js +20 -0
- package/dist/hydration.js.map +1 -0
- package/dist/icons.d.ts +14 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +23 -0
- package/dist/icons.js.map +1 -0
- package/dist/image-effects.d.ts +11 -0
- package/dist/image-effects.d.ts.map +1 -0
- package/dist/image-effects.js +67 -0
- package/dist/image-effects.js.map +1 -0
- package/dist/index.d.ts +51 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +92 -6
- package/dist/index.js.map +1 -1
- package/dist/input-attrs.d.ts +15 -0
- package/dist/input-attrs.d.ts.map +1 -0
- package/dist/input-attrs.js +18 -0
- package/dist/input-attrs.js.map +1 -0
- package/dist/motion-context.d.ts +13 -0
- package/dist/motion-context.d.ts.map +1 -0
- package/dist/motion-context.js +33 -0
- package/dist/motion-context.js.map +1 -0
- package/dist/motion-region.d.ts +16 -0
- package/dist/motion-region.d.ts.map +1 -0
- package/dist/motion-region.js +174 -0
- package/dist/motion-region.js.map +1 -0
- package/dist/motion-surface.d.ts +16 -0
- package/dist/motion-surface.d.ts.map +1 -0
- package/dist/motion-surface.js +244 -0
- package/dist/motion-surface.js.map +1 -0
- package/dist/motion.d.ts +20 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +244 -0
- package/dist/motion.js.map +1 -0
- package/dist/navigation.d.ts +12 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/navigation.js +38 -0
- package/dist/navigation.js.map +1 -0
- package/dist/nuxt-navigation.d.ts +18 -0
- package/dist/nuxt-navigation.d.ts.map +1 -0
- package/dist/nuxt-navigation.js +23 -0
- package/dist/nuxt-navigation.js.map +1 -0
- package/dist/platform-motion.d.ts +4 -0
- package/dist/platform-motion.d.ts.map +1 -0
- package/dist/platform-motion.js +23 -0
- package/dist/platform-motion.js.map +1 -0
- package/dist/reveal-motion.d.ts +5 -0
- package/dist/reveal-motion.d.ts.map +1 -0
- package/dist/reveal-motion.js +53 -0
- package/dist/reveal-motion.js.map +1 -0
- package/dist/router-navigation.d.ts +31 -0
- package/dist/router-navigation.d.ts.map +1 -0
- package/dist/router-navigation.js +215 -0
- package/dist/router-navigation.js.map +1 -0
- package/dist/screen-viewport.d.ts.map +1 -1
- package/dist/screen-viewport.js +8 -0
- package/dist/screen-viewport.js.map +1 -1
- package/dist/scroll-motion.d.ts +5 -0
- package/dist/scroll-motion.d.ts.map +1 -0
- package/dist/scroll-motion.js +84 -0
- package/dist/scroll-motion.js.map +1 -0
- package/dist/section-scroll.d.ts +8 -0
- package/dist/section-scroll.d.ts.map +1 -0
- package/dist/section-scroll.js +79 -0
- package/dist/section-scroll.js.map +1 -0
- package/dist/services.d.ts +16 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/services.js +22 -0
- package/dist/services.js.map +1 -0
- package/dist/sheet-motion.d.ts +12 -0
- package/dist/sheet-motion.d.ts.map +1 -0
- package/dist/sheet-motion.js +83 -0
- package/dist/sheet-motion.js.map +1 -0
- package/dist/style.d.ts.map +1 -1
- package/dist/style.js +24 -9
- package/dist/style.js.map +1 -1
- package/dist/surface-effects.d.ts +4 -0
- package/dist/surface-effects.d.ts.map +1 -0
- package/dist/surface-effects.js +28 -0
- package/dist/surface-effects.js.map +1 -0
- package/dist/tokens.d.ts +7 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +29 -0
- package/dist/tokens.js.map +1 -0
- package/dist/use-motion-surface.d.ts +8 -0
- package/dist/use-motion-surface.d.ts.map +1 -0
- package/dist/use-motion-surface.js +33 -0
- package/dist/use-motion-surface.js.map +1 -0
- package/dist/visual-effects.d.ts +4 -0
- package/dist/visual-effects.d.ts.map +1 -0
- package/dist/visual-effects.js +120 -0
- package/dist/visual-effects.js.map +1 -0
- package/package.json +27 -4
- package/src/appearance.ts +23 -0
- package/src/base.css +998 -0
- package/src/collection-motion.ts +107 -0
- package/src/components/ChoicePaint.ts +96 -0
- package/src/components/DateCalendar.ts +213 -0
- package/src/components/LoadingDecoration.ts +39 -0
- package/src/components/MAccordion.ts +231 -0
- package/src/components/MAlert.ts +109 -0
- package/src/components/MAvatar.ts +97 -0
- package/src/components/MBadge.ts +40 -0
- package/src/components/MButton.ts +138 -20
- package/src/components/MCard.ts +96 -30
- package/src/components/MCheckbox.ts +160 -0
- package/src/components/MChip.ts +109 -0
- package/src/components/MCombobox.ts +520 -0
- package/src/components/MDatePicker.ts +23 -0
- package/src/components/MDialog.ts +319 -0
- package/src/components/MEmptyState.ts +96 -0
- package/src/components/MFilePicker.ts +233 -0
- package/src/components/MGrid.ts +45 -0
- package/src/components/MIcon.ts +47 -0
- package/src/components/MImage.ts +183 -0
- package/src/components/MInput.ts +216 -71
- package/src/components/MLink.ts +63 -0
- package/src/components/MListItem.ts +66 -0
- package/src/components/MPopover.ts +280 -0
- package/src/components/MProgress.ts +82 -0
- package/src/components/MRadioGroup.ts +216 -0
- package/src/components/MReveal.ts +62 -32
- package/src/components/MScreen.ts +57 -3
- package/src/components/MSegmentedControl.ts +151 -0
- package/src/components/MSelect.ts +367 -0
- package/src/components/MSeparator.ts +40 -0
- package/src/components/MSheet.ts +361 -0
- package/src/components/MSkeleton.ts +61 -0
- package/src/components/MSlider.ts +25 -2
- package/src/components/MStack.ts +73 -0
- package/src/components/MSwitch.ts +119 -0
- package/src/components/MTabs.ts +275 -0
- package/src/components/MText.ts +46 -14
- package/src/components/MTimePicker.ts +124 -0
- package/src/components/MToast.ts +241 -0
- package/src/components/MVirtualList.ts +146 -0
- package/src/components/configurator.ts +24 -0
- package/src/components/layout.ts +20 -12
- package/src/components/navigation.ts +44 -0
- package/src/components/workflows.ts +27 -0
- package/src/connected-motion.ts +23 -0
- package/src/content-width.ts +70 -0
- package/src/date-format.ts +36 -0
- package/src/experimental.ts +37 -0
- package/src/files.ts +77 -0
- package/src/fonts/LICENSE +45 -0
- package/src/fonts/lucide.woff2 +0 -0
- package/src/hydration.ts +21 -0
- package/src/icons.css +7 -0
- package/src/icons.ts +28 -0
- package/src/image-effects.ts +80 -0
- package/src/index.ts +183 -20
- package/src/input-attrs.ts +41 -0
- package/src/motion-context.ts +35 -0
- package/src/motion-region.ts +209 -0
- package/src/motion-surface.ts +274 -0
- package/src/motion.ts +281 -0
- package/src/navigation.ts +44 -0
- package/src/nuxt-navigation.ts +29 -0
- package/src/platform-motion.ts +36 -0
- package/src/reveal-motion.ts +59 -0
- package/src/router-navigation.ts +249 -0
- package/src/screen-viewport.ts +6 -0
- package/src/scroll-motion.ts +88 -0
- package/src/section-scroll.ts +101 -0
- package/src/services.ts +39 -0
- package/src/sheet-motion.ts +80 -0
- package/src/style.css +2 -139
- package/src/style.ts +20 -9
- package/src/surface-effects.ts +33 -0
- package/src/tokens.ts +29 -0
- package/src/use-motion-surface.ts +43 -0
- package/src/visual-effects.ts +139 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { defineComponent, h, mergeProps } from 'vue'
|
|
2
|
+
import { alertProps, alertEmits, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
3
|
+
import { alertAppearance, checkAlertLabels } from '@getcortexlabs/mavis-core'
|
|
4
|
+
import { MBox, MColumn, MRow } from './layout.js'
|
|
5
|
+
import { MText } from './MText.js'
|
|
6
|
+
import { MIcon } from './MIcon.js'
|
|
7
|
+
import { MButton } from './MButton.js'
|
|
8
|
+
|
|
9
|
+
export const MAlert = defineComponent({
|
|
10
|
+
name: 'MAlert',
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
props: alertProps,
|
|
13
|
+
emits: alertEmits,
|
|
14
|
+
setup(props, { attrs, slots, emit }) {
|
|
15
|
+
const { theme } = useMavisTheme()
|
|
16
|
+
return () => {
|
|
17
|
+
checkAlertLabels(props.title, props.dismissible, props.closeLabel)
|
|
18
|
+
const { colors } = theme.value
|
|
19
|
+
const appearance = alertAppearance[props.tone]
|
|
20
|
+
return h(
|
|
21
|
+
MColumn,
|
|
22
|
+
mergeProps(
|
|
23
|
+
{
|
|
24
|
+
width: props.width,
|
|
25
|
+
grow: props.grow,
|
|
26
|
+
shrink: props.shrink,
|
|
27
|
+
padding: 'md',
|
|
28
|
+
gap: 'md',
|
|
29
|
+
radius: 'md',
|
|
30
|
+
backgroundColor: colors.surface,
|
|
31
|
+
style: {
|
|
32
|
+
border: `1px solid ${colors[appearance.tone]}`,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
attrs,
|
|
36
|
+
{
|
|
37
|
+
id: props.id,
|
|
38
|
+
accessibilityHidden: props.accessibilityHidden,
|
|
39
|
+
class: 'm-alert',
|
|
40
|
+
'data-tone': props.tone,
|
|
41
|
+
},
|
|
42
|
+
),
|
|
43
|
+
{
|
|
44
|
+
default: () => [
|
|
45
|
+
h(
|
|
46
|
+
MRow,
|
|
47
|
+
{ gap: 'sm', align: 'start' },
|
|
48
|
+
{
|
|
49
|
+
default: () => [
|
|
50
|
+
h(
|
|
51
|
+
MBox,
|
|
52
|
+
{
|
|
53
|
+
width: 32,
|
|
54
|
+
height: 32,
|
|
55
|
+
radius: 'sm',
|
|
56
|
+
shrink: 0,
|
|
57
|
+
backgroundColor: colors.elevated,
|
|
58
|
+
style: { placeItems: 'center' },
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
default: () =>
|
|
62
|
+
h(MIcon, { name: appearance.icon, tone: appearance.tone, size: 20 }),
|
|
63
|
+
},
|
|
64
|
+
),
|
|
65
|
+
h(
|
|
66
|
+
MColumn,
|
|
67
|
+
{
|
|
68
|
+
width: 0,
|
|
69
|
+
grow: 1,
|
|
70
|
+
gap: 'xs',
|
|
71
|
+
role: props.announce
|
|
72
|
+
? props.tone === 'error'
|
|
73
|
+
? 'alert'
|
|
74
|
+
: 'status'
|
|
75
|
+
: undefined,
|
|
76
|
+
'aria-atomic': props.announce ? 'true' : undefined,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
default: () => [
|
|
80
|
+
h(MText, { text: props.title, style: { fontWeight: '600' } }),
|
|
81
|
+
props.description
|
|
82
|
+
? h(MText, { text: props.description, tone: 'muted' })
|
|
83
|
+
: null,
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
),
|
|
87
|
+
props.dismissible
|
|
88
|
+
? h(MButton, {
|
|
89
|
+
icon: 'x',
|
|
90
|
+
variant: 'ghost',
|
|
91
|
+
size: 'sm',
|
|
92
|
+
accessibilityLabel: props.closeLabel,
|
|
93
|
+
shrink: 0,
|
|
94
|
+
style: { width: '44px', paddingLeft: 0, paddingRight: 0 },
|
|
95
|
+
onClick: () => emit('close'),
|
|
96
|
+
})
|
|
97
|
+
: null,
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
),
|
|
101
|
+
slots.actions
|
|
102
|
+
? h(MRow, { gap: 'sm', wrap: true, align: 'start' }, { default: slots.actions })
|
|
103
|
+
: null,
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
})
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { fontFamily } from '@getcortexlabs/mavis-core'
|
|
2
|
+
import { defineComponent, h, mergeProps, ref, watch } from 'vue'
|
|
3
|
+
import { avatarProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
4
|
+
import { avatarSizes, avatarInitials } from '@getcortexlabs/mavis-core'
|
|
5
|
+
import { webAttrs } from '../style.js'
|
|
6
|
+
import { MIcon } from './MIcon.js'
|
|
7
|
+
|
|
8
|
+
export const MAvatar = defineComponent({
|
|
9
|
+
name: 'MAvatar',
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: avatarProps,
|
|
12
|
+
setup(props, { attrs }) {
|
|
13
|
+
const { theme } = useMavisTheme()
|
|
14
|
+
const ready = ref(false)
|
|
15
|
+
let revision = 0
|
|
16
|
+
watch(
|
|
17
|
+
() => props.src,
|
|
18
|
+
() => {
|
|
19
|
+
revision++
|
|
20
|
+
ready.value = false
|
|
21
|
+
},
|
|
22
|
+
{ flush: 'sync' },
|
|
23
|
+
)
|
|
24
|
+
return () => {
|
|
25
|
+
const size = avatarSizes[props.size]
|
|
26
|
+
const current = revision
|
|
27
|
+
const label = props.accessibilityLabel ?? props.name.trim()
|
|
28
|
+
const hidden = props.accessibilityHidden || !label
|
|
29
|
+
const initials = avatarInitials(props.name)
|
|
30
|
+
return h(
|
|
31
|
+
'span',
|
|
32
|
+
mergeProps(webAttrs(attrs), {
|
|
33
|
+
id: props.id,
|
|
34
|
+
class: 'm-avatar',
|
|
35
|
+
role: hidden ? undefined : 'img',
|
|
36
|
+
'aria-label': hidden ? undefined : label,
|
|
37
|
+
'aria-hidden': hidden ? 'true' : undefined,
|
|
38
|
+
style: {
|
|
39
|
+
display: 'inline-grid',
|
|
40
|
+
position: 'relative',
|
|
41
|
+
overflow: 'hidden',
|
|
42
|
+
width: `${size}px`,
|
|
43
|
+
height: `${size}px`,
|
|
44
|
+
flexShrink: 0,
|
|
45
|
+
alignSelf: 'flex-start',
|
|
46
|
+
borderRadius: props.shape === 'circle' ? '50%' : `${size / 4}px`,
|
|
47
|
+
placeItems: 'center',
|
|
48
|
+
color: theme.value.colors.primary,
|
|
49
|
+
backgroundColor: theme.value.colors.primarySoft,
|
|
50
|
+
fontFamily: fontFamily(theme.value.typography.body.fontFamily, 'web'),
|
|
51
|
+
fontSize: `${Math.round(size * 0.34)}px`,
|
|
52
|
+
fontWeight: 600,
|
|
53
|
+
lineHeight: 1,
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
[
|
|
57
|
+
h(
|
|
58
|
+
'span',
|
|
59
|
+
{
|
|
60
|
+
'aria-hidden': 'true',
|
|
61
|
+
style: { gridArea: '1 / 1', visibility: ready.value ? 'hidden' : 'visible' },
|
|
62
|
+
},
|
|
63
|
+
initials ||
|
|
64
|
+
h(MIcon, { name: 'user-round', size: Math.round(size * 0.46), tone: 'primary' }),
|
|
65
|
+
),
|
|
66
|
+
props.src.trim()
|
|
67
|
+
? h('img', {
|
|
68
|
+
key: revision,
|
|
69
|
+
src: props.src.trim(),
|
|
70
|
+
alt: '',
|
|
71
|
+
'aria-hidden': 'true',
|
|
72
|
+
draggable: false,
|
|
73
|
+
ref: (element) => {
|
|
74
|
+
const image = element as HTMLImageElement | null
|
|
75
|
+
if (current === revision && image?.complete) ready.value = image.naturalWidth > 0
|
|
76
|
+
},
|
|
77
|
+
style: {
|
|
78
|
+
position: 'absolute',
|
|
79
|
+
inset: 0,
|
|
80
|
+
width: '100%',
|
|
81
|
+
height: '100%',
|
|
82
|
+
objectFit: 'cover',
|
|
83
|
+
visibility: ready.value ? 'visible' : 'hidden',
|
|
84
|
+
},
|
|
85
|
+
onLoad: () => {
|
|
86
|
+
if (current === revision) ready.value = true
|
|
87
|
+
},
|
|
88
|
+
onError: () => {
|
|
89
|
+
if (current === revision) ready.value = false
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
: null,
|
|
93
|
+
],
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { fontFamily } from '@getcortexlabs/mavis-core'
|
|
2
|
+
import { defineComponent, h, mergeProps } from 'vue'
|
|
3
|
+
import { badgeProps, useMavisTheme, viewAttrs } from '@getcortexlabs/mavis-core/vue'
|
|
4
|
+
import { badgeColors } from '@getcortexlabs/mavis-core'
|
|
5
|
+
import { webAttrs } from '../style.js'
|
|
6
|
+
|
|
7
|
+
export const MBadge = defineComponent({
|
|
8
|
+
name: 'MBadge',
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: badgeProps,
|
|
11
|
+
setup(props, { attrs }) {
|
|
12
|
+
const { theme } = useMavisTheme()
|
|
13
|
+
return () =>
|
|
14
|
+
h(
|
|
15
|
+
'span',
|
|
16
|
+
mergeProps(webAttrs({ ...attrs, ...viewAttrs(props) }), {
|
|
17
|
+
class: 'm-badge',
|
|
18
|
+
role: props.accessibilityLabel ? 'img' : undefined,
|
|
19
|
+
style: {
|
|
20
|
+
...badgeColors(theme.value.colors, props.tone),
|
|
21
|
+
display: 'inline-block',
|
|
22
|
+
alignSelf: 'flex-start',
|
|
23
|
+
boxSizing: 'border-box',
|
|
24
|
+
maxWidth: '100%',
|
|
25
|
+
minWidth: props.size === 'sm' ? '22px' : '28px',
|
|
26
|
+
padding: props.size === 'sm' ? '3px 8px' : '5px 10px',
|
|
27
|
+
borderRadius: '999px',
|
|
28
|
+
fontFamily: fontFamily(theme.value.typography.body.fontFamily, 'web'),
|
|
29
|
+
fontSize: props.size === 'sm' ? '0.6875rem' : '0.8125rem',
|
|
30
|
+
fontWeight: 600,
|
|
31
|
+
lineHeight: 1.4,
|
|
32
|
+
textAlign: 'center',
|
|
33
|
+
overflowWrap: 'anywhere',
|
|
34
|
+
whiteSpace: 'normal',
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
String(props.text),
|
|
38
|
+
)
|
|
39
|
+
},
|
|
40
|
+
})
|
|
@@ -1,72 +1,190 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useIconContent } from '../icons.js'
|
|
2
|
+
import { defineComponent, h, mergeProps, type VNode, type SlotsType } from 'vue'
|
|
2
3
|
import {
|
|
4
|
+
useButtonAction,
|
|
3
5
|
buttonProps,
|
|
6
|
+
buttonContent,
|
|
7
|
+
ButtonAdornment,
|
|
4
8
|
useMavisTheme,
|
|
9
|
+
useNavigationOptions,
|
|
5
10
|
actionEmits,
|
|
6
11
|
textContent,
|
|
7
|
-
|
|
12
|
+
useLayoutShrink,
|
|
8
13
|
viewAttrs,
|
|
9
14
|
} from '@getcortexlabs/mavis-core/vue'
|
|
10
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
fontFamily,
|
|
17
|
+
resolveRadius,
|
|
18
|
+
shadowStyle,
|
|
19
|
+
nonNegative,
|
|
20
|
+
iconSizes,
|
|
21
|
+
checkIconOnly,
|
|
22
|
+
} from '@getcortexlabs/mavis-core'
|
|
11
23
|
import { webAttrs } from '../style.js'
|
|
24
|
+
import { usePressFeedback } from '../motion.js'
|
|
25
|
+
import { navigationAttrs } from '../navigation.js'
|
|
26
|
+
import { LoadingDecoration } from './LoadingDecoration.js'
|
|
12
27
|
|
|
13
28
|
export const MButton = defineComponent({
|
|
14
29
|
name: 'MButton',
|
|
15
30
|
inheritAttrs: false,
|
|
16
31
|
props: buttonProps,
|
|
17
32
|
emits: actionEmits,
|
|
33
|
+
slots: Object as SlotsType<{
|
|
34
|
+
default?: () => VNode[]
|
|
35
|
+
leading?: () => VNode[]
|
|
36
|
+
trailing?: () => VNode[]
|
|
37
|
+
}>,
|
|
18
38
|
setup(props, { attrs, slots, emit }) {
|
|
39
|
+
useButtonAction()
|
|
19
40
|
const { theme } = useMavisTheme()
|
|
20
|
-
const
|
|
41
|
+
const navigation = useNavigationOptions(props)
|
|
42
|
+
const renderIcon = useIconContent()
|
|
43
|
+
const lifecycle = usePressFeedback(
|
|
44
|
+
() => !props.disabled && !props.loading,
|
|
45
|
+
theme,
|
|
46
|
+
() => props.motionSurface,
|
|
47
|
+
)
|
|
48
|
+
const shrink = useLayoutShrink()
|
|
21
49
|
return () => {
|
|
22
|
-
const { colors, control
|
|
50
|
+
const { colors, control } = theme.value
|
|
51
|
+
const tokens = theme.value.components.button
|
|
52
|
+
const family = fontFamily(tokens.fontFamily ?? theme.value.typography.body.fontFamily, 'web')
|
|
23
53
|
const size = control[props.size]
|
|
24
54
|
const primary = props.variant === 'primary'
|
|
25
55
|
const text = props.loading
|
|
26
56
|
? props.loadingText
|
|
27
57
|
: (props.text ?? textContent(slots.default?.()))
|
|
58
|
+
const leading = buttonContent(slots.leading?.())
|
|
59
|
+
const trailing = buttonContent(slots.trailing?.())
|
|
60
|
+
const composed = Boolean(slots.leading || slots.trailing)
|
|
61
|
+
const indicator = props.loading && props.loadingIndicator !== 'none'
|
|
62
|
+
const hasIcon = Boolean(composed || props.icon || props.trailingIcon || indicator)
|
|
63
|
+
checkIconOnly(text, hasIcon, props.accessibilityLabel)
|
|
64
|
+
const iconSize = iconSizes[props.size]
|
|
65
|
+
const paddingX = hasIcon && !text ? Math.round((size.height - iconSize) / 2) : size.padding
|
|
66
|
+
const span = (name: typeof props.icon) => {
|
|
67
|
+
if (!name) return null
|
|
68
|
+
const icon = renderIcon(name, iconSize)
|
|
69
|
+
return h(
|
|
70
|
+
'span',
|
|
71
|
+
{
|
|
72
|
+
class: 'm-icon',
|
|
73
|
+
'aria-hidden': 'true',
|
|
74
|
+
style: {
|
|
75
|
+
fontFamily: icon.fontFamily,
|
|
76
|
+
fontSize: `${iconSize}px`,
|
|
77
|
+
width: `${iconSize}px`,
|
|
78
|
+
height: `${iconSize}px`,
|
|
79
|
+
lineHeight: 1,
|
|
80
|
+
display: 'inline-flex',
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
justifyContent: 'center',
|
|
83
|
+
flexShrink: 0,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
icon.content,
|
|
87
|
+
)
|
|
88
|
+
}
|
|
28
89
|
return h(
|
|
29
|
-
'button',
|
|
90
|
+
props.href === undefined ? 'button' : 'a',
|
|
30
91
|
mergeProps(
|
|
92
|
+
lifecycle,
|
|
31
93
|
{
|
|
32
94
|
class: 'm-button',
|
|
33
95
|
style: {
|
|
34
96
|
boxSizing: 'border-box',
|
|
97
|
+
display: 'inline-flex',
|
|
98
|
+
flexWrap: composed ? 'wrap' : undefined,
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
gap: hasIcon ? '8px' : undefined,
|
|
35
102
|
minHeight: `${size.height}px`,
|
|
36
|
-
padding: `
|
|
37
|
-
fontSize:
|
|
38
|
-
fontWeight:
|
|
39
|
-
fontFamily:
|
|
40
|
-
lineHeight:
|
|
103
|
+
padding: `var(--m-button-padding-y, ${tokens.paddingY}px) var(--m-button-padding-x, ${paddingX}px)`,
|
|
104
|
+
fontSize: `var(--m-button-font-size, ${size.fontSize}px)`,
|
|
105
|
+
fontWeight: `var(--m-button-font-weight, ${tokens.fontWeight})`,
|
|
106
|
+
fontFamily: `var(--m-button-font-family, ${family})`,
|
|
107
|
+
lineHeight: `var(--m-button-line-height, ${tokens.lineHeight})`,
|
|
41
108
|
backgroundColor: primary
|
|
42
109
|
? colors.primary
|
|
43
110
|
: props.variant === 'secondary'
|
|
44
111
|
? colors.elevated
|
|
45
112
|
: 'transparent',
|
|
46
113
|
color: primary ? colors.onPrimary : colors.text,
|
|
47
|
-
borderRadius:
|
|
114
|
+
borderRadius: `var(--m-button-radius, ${resolveRadius(theme.value, tokens.radius)}px)`,
|
|
115
|
+
boxShadow: `var(--m-button-shadow, ${shadowStyle(theme.value.elevation[tokens.elevation])})`,
|
|
48
116
|
border: 0,
|
|
49
117
|
margin: 0,
|
|
50
|
-
|
|
118
|
+
textDecoration: 'none',
|
|
119
|
+
filter: props.disabled ? 'opacity(0.45)' : undefined,
|
|
51
120
|
flexGrow: nonNegative(props.grow, 'grow'),
|
|
52
|
-
flexShrink: nonNegative(props.shrink ?? shrink, 'shrink'),
|
|
121
|
+
flexShrink: nonNegative(props.shrink ?? shrink.value, 'shrink'),
|
|
53
122
|
minWidth: '44px',
|
|
54
|
-
'--m-press-scale': motion.pressScale,
|
|
55
123
|
'--m-focus': colors.primary,
|
|
56
124
|
},
|
|
57
125
|
},
|
|
58
126
|
webAttrs({ ...attrs, ...viewAttrs(props) }),
|
|
59
127
|
{
|
|
60
|
-
type:
|
|
61
|
-
|
|
128
|
+
type: props.href === undefined ? props.type : undefined,
|
|
129
|
+
name: props.name,
|
|
130
|
+
value: props.value,
|
|
131
|
+
form: props.form,
|
|
132
|
+
disabled: props.href === undefined ? props.disabled : undefined,
|
|
62
133
|
'aria-disabled': props.disabled || props.loading || undefined,
|
|
63
134
|
'aria-busy': props.loading || undefined,
|
|
64
|
-
onClick: () => {
|
|
65
|
-
if (
|
|
135
|
+
onClick: (event: MouseEvent) => {
|
|
136
|
+
if (props.disabled || props.loading) {
|
|
137
|
+
event.preventDefault()
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
if (props.href === undefined && !event.defaultPrevented) emit('click')
|
|
66
141
|
},
|
|
67
142
|
},
|
|
143
|
+
props.href === undefined
|
|
144
|
+
? {}
|
|
145
|
+
: navigationAttrs(
|
|
146
|
+
navigation(),
|
|
147
|
+
props.disabled || props.loading,
|
|
148
|
+
() => emit('click'),
|
|
149
|
+
(error) => emit('error', error),
|
|
150
|
+
),
|
|
68
151
|
),
|
|
69
|
-
|
|
152
|
+
hasIcon
|
|
153
|
+
? [
|
|
154
|
+
...(indicator
|
|
155
|
+
? [
|
|
156
|
+
h(LoadingDecoration, {
|
|
157
|
+
kind: props.loadingIndicator as 'dots' | 'bars' | 'ring',
|
|
158
|
+
width: iconSize,
|
|
159
|
+
height: iconSize,
|
|
160
|
+
size: iconSize,
|
|
161
|
+
color: primary ? colors.onPrimary : colors.text,
|
|
162
|
+
radius: 'none',
|
|
163
|
+
}),
|
|
164
|
+
]
|
|
165
|
+
: []),
|
|
166
|
+
slots.leading
|
|
167
|
+
? h('span', { class: 'm-button-adornment', 'aria-hidden': 'true', inert: '' }, [
|
|
168
|
+
h(ButtonAdornment, {}, { default: () => leading }),
|
|
169
|
+
])
|
|
170
|
+
: span(props.icon),
|
|
171
|
+
text
|
|
172
|
+
? h(
|
|
173
|
+
'span',
|
|
174
|
+
{
|
|
175
|
+
class: 'm-button-label',
|
|
176
|
+
style: { minWidth: 0, maxWidth: '100%', overflowWrap: 'break-word' },
|
|
177
|
+
},
|
|
178
|
+
text,
|
|
179
|
+
)
|
|
180
|
+
: null,
|
|
181
|
+
slots.trailing
|
|
182
|
+
? h('span', { class: 'm-button-adornment', 'aria-hidden': 'true', inert: '' }, [
|
|
183
|
+
h(ButtonAdornment, {}, { default: () => trailing }),
|
|
184
|
+
])
|
|
185
|
+
: span(props.trailingIcon),
|
|
186
|
+
]
|
|
187
|
+
: text,
|
|
70
188
|
)
|
|
71
189
|
}
|
|
72
190
|
},
|
package/src/components/MCard.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { resolveSpace, resolveRadius, shadowStyle } from '@getcortexlabs/mavis-core'
|
|
2
|
+
import { defineComponent, h, mergeProps, shallowRef, type VNode } from 'vue'
|
|
3
|
+
import { preserveBoundPaint } from '../motion-surface.js'
|
|
4
|
+
import {
|
|
5
|
+
useButtonAction,
|
|
6
|
+
cardProps,
|
|
7
|
+
useMavisTheme,
|
|
8
|
+
useNavigationOptions,
|
|
9
|
+
actionEmits,
|
|
10
|
+
} from '@getcortexlabs/mavis-core/vue'
|
|
11
|
+
import { MColumn, createLayout } from './layout.js'
|
|
12
|
+
import { navigationAttrs } from '../navigation.js'
|
|
13
|
+
import { usePressFeedback } from '../motion.js'
|
|
14
|
+
|
|
15
|
+
const LinkColumn = createLayout('MCardLink', 'column', 'a')
|
|
4
16
|
|
|
5
17
|
export const MCard = defineComponent({
|
|
6
18
|
name: 'MCard',
|
|
@@ -8,46 +20,100 @@ export const MCard = defineComponent({
|
|
|
8
20
|
props: cardProps,
|
|
9
21
|
emits: actionEmits,
|
|
10
22
|
setup(props, { attrs, slots, emit }) {
|
|
23
|
+
useButtonAction(() => props.interactive || props.href !== undefined)
|
|
11
24
|
const { theme } = useMavisTheme()
|
|
25
|
+
const navigation = useNavigationOptions(props)
|
|
26
|
+
const element = shallowRef<HTMLElement>()
|
|
27
|
+
const lifecycle = usePressFeedback(
|
|
28
|
+
() => (props.interactive || props.href !== undefined) && !props.disabled,
|
|
29
|
+
theme,
|
|
30
|
+
() => props.motionSurface,
|
|
31
|
+
() => !props.disabled,
|
|
32
|
+
)
|
|
12
33
|
const activate = () => {
|
|
13
|
-
if (props.interactive && !props.disabled) emit('click')
|
|
34
|
+
if ((props.interactive || props.href !== undefined) && !props.disabled) emit('click')
|
|
14
35
|
}
|
|
15
36
|
return () => {
|
|
16
|
-
const {
|
|
37
|
+
const {
|
|
38
|
+
interactive,
|
|
39
|
+
disabled,
|
|
40
|
+
elevation,
|
|
41
|
+
motionSurface,
|
|
42
|
+
href,
|
|
43
|
+
navigate,
|
|
44
|
+
target,
|
|
45
|
+
rel,
|
|
46
|
+
...layout
|
|
47
|
+
} = props
|
|
48
|
+
const tokens = theme.value.components.card
|
|
49
|
+
layout.padding ??= tokens.padding
|
|
50
|
+
layout.radius ??= tokens.radius
|
|
17
51
|
return h(
|
|
18
|
-
MColumn,
|
|
52
|
+
href === undefined ? MColumn : LinkColumn,
|
|
19
53
|
mergeProps(
|
|
54
|
+
lifecycle,
|
|
20
55
|
layout,
|
|
21
56
|
{
|
|
22
|
-
class:
|
|
57
|
+
class: 'm-card',
|
|
23
58
|
style: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
59
|
+
paddingLeft:
|
|
60
|
+
props.paddingX !== undefined || props.padding !== undefined
|
|
61
|
+
? `${resolveSpace(theme.value, props.paddingX ?? props.padding!)}px`
|
|
62
|
+
: `var(--m-card-padding, ${resolveSpace(theme.value, tokens.padding)}px)`,
|
|
63
|
+
paddingRight:
|
|
64
|
+
props.paddingX !== undefined || props.padding !== undefined
|
|
65
|
+
? `${resolveSpace(theme.value, props.paddingX ?? props.padding!)}px`
|
|
66
|
+
: `var(--m-card-padding, ${resolveSpace(theme.value, tokens.padding)}px)`,
|
|
67
|
+
paddingTop:
|
|
68
|
+
props.paddingY !== undefined || props.padding !== undefined
|
|
69
|
+
? `${resolveSpace(theme.value, props.paddingY ?? props.padding!)}px`
|
|
70
|
+
: `var(--m-card-padding, ${resolveSpace(theme.value, tokens.padding)}px)`,
|
|
71
|
+
paddingBottom:
|
|
72
|
+
props.paddingY !== undefined || props.padding !== undefined
|
|
73
|
+
? `${resolveSpace(theme.value, props.paddingY ?? props.padding!)}px`
|
|
74
|
+
: `var(--m-card-padding, ${resolveSpace(theme.value, tokens.padding)}px)`,
|
|
75
|
+
borderRadius:
|
|
76
|
+
props.radius !== undefined
|
|
77
|
+
? `${resolveRadius(theme.value, props.radius)}px`
|
|
78
|
+
: `var(--m-card-radius, ${resolveRadius(theme.value, tokens.radius)}px)`,
|
|
79
|
+
boxShadow: `var(--m-card-shadow, ${shadowStyle(theme.value.elevation[elevation ?? tokens.elevation])})`,
|
|
80
|
+
backgroundColor:
|
|
81
|
+
props.backgroundColor ?? `var(--m-card-background, ${theme.value.colors.surface})`,
|
|
82
|
+
border: `var(--m-card-border, 1px solid ${theme.value.colors.border})`,
|
|
83
|
+
filter: interactive && disabled ? 'opacity(0.45)' : undefined,
|
|
28
84
|
'--m-focus': theme.value.colors.primary,
|
|
85
|
+
textDecoration: 'none',
|
|
86
|
+
color: 'inherit',
|
|
29
87
|
},
|
|
30
88
|
},
|
|
31
89
|
attrs,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
90
|
+
{
|
|
91
|
+
onVnodeMounted: (node: VNode) => {
|
|
92
|
+
element.value = node.el as HTMLElement
|
|
93
|
+
},
|
|
94
|
+
style: preserveBoundPaint(element.value),
|
|
95
|
+
},
|
|
96
|
+
href !== undefined
|
|
97
|
+
? navigationAttrs(navigation(), disabled, activate, (error) => emit('error', error))
|
|
98
|
+
: interactive
|
|
99
|
+
? {
|
|
100
|
+
role: 'button',
|
|
101
|
+
tabindex: disabled ? -1 : 0,
|
|
102
|
+
'aria-disabled': disabled || undefined,
|
|
103
|
+
onClick: activate,
|
|
104
|
+
onKeydown: (event: KeyboardEvent) => {
|
|
105
|
+
if (event.target !== event.currentTarget) return
|
|
106
|
+
if (event.key === 'Enter' || event.key === ' ') event.preventDefault()
|
|
107
|
+
if (event.key === 'Enter' && !event.repeat) activate()
|
|
108
|
+
},
|
|
109
|
+
onKeyup: (event: KeyboardEvent) => {
|
|
110
|
+
if (event.target === event.currentTarget && event.key === ' ') {
|
|
111
|
+
event.preventDefault()
|
|
112
|
+
activate()
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
: {},
|
|
51
117
|
),
|
|
52
118
|
slots,
|
|
53
119
|
)
|