@byyuurin/ui 0.0.10 → 0.1.0
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 +170 -58
- package/dist/module.d.mts +4 -13
- package/dist/module.json +4 -4
- package/dist/module.mjs +54 -20
- package/dist/runtime/components/Accordion.vue +48 -72
- package/dist/runtime/components/Accordion.vue.d.ts +74 -0
- package/dist/runtime/components/Alert.vue +65 -83
- package/dist/runtime/components/Alert.vue.d.ts +71 -0
- package/dist/runtime/components/App.vue +28 -42
- package/dist/runtime/components/App.vue.d.ts +26 -0
- package/dist/runtime/components/Avatar.vue +82 -58
- package/dist/runtime/components/Avatar.vue.d.ts +39 -0
- package/dist/runtime/components/AvatarGroup.vue +43 -70
- package/dist/runtime/components/AvatarGroup.vue.d.ts +30 -0
- package/dist/runtime/components/Badge.vue +70 -64
- package/dist/runtime/components/Badge.vue.d.ts +45 -0
- package/dist/runtime/components/Breadcrumb.vue +56 -76
- package/dist/runtime/components/Breadcrumb.vue.d.ts +79 -0
- package/dist/runtime/components/Button.vue +150 -78
- package/dist/runtime/components/Button.vue.d.ts +45 -0
- package/dist/runtime/components/Calendar.vue +99 -125
- package/dist/runtime/components/Calendar.vue.d.ts +102 -0
- package/dist/runtime/components/Card.vue +33 -46
- package/dist/runtime/components/Card.vue.d.ts +34 -0
- package/dist/runtime/components/Carousel.vue +164 -237
- package/dist/runtime/components/Carousel.vue.d.ts +125 -0
- package/dist/runtime/components/Checkbox.vue +86 -88
- package/dist/runtime/components/Checkbox.vue.d.ts +63 -0
- package/dist/runtime/components/Chip.vue +44 -58
- package/dist/runtime/components/Chip.vue.d.ts +48 -0
- package/dist/runtime/components/Collapsible.vue +29 -33
- package/dist/runtime/components/Collapsible.vue.d.ts +34 -0
- package/dist/runtime/components/Drawer.vue +110 -150
- package/dist/runtime/components/Drawer.vue.d.ts +103 -0
- package/dist/runtime/components/DropdownMenu.vue +49 -120
- package/dist/runtime/components/DropdownMenu.vue.d.ts +140 -0
- package/dist/runtime/components/DropdownMenuContent.vue +177 -143
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +51 -0
- package/dist/runtime/components/FieldGroup.vue +33 -0
- package/dist/runtime/components/FieldGroup.vue.d.ts +33 -0
- package/dist/runtime/components/Form.vue +245 -275
- package/dist/runtime/components/Form.vue.d.ts +103 -0
- package/dist/runtime/components/FormField.vue +108 -0
- package/dist/runtime/components/FormField.vue.d.ts +63 -0
- package/dist/runtime/components/Icon.vue +20 -0
- package/dist/runtime/components/Icon.vue.d.ts +9 -0
- package/dist/runtime/components/Input.vue +125 -156
- package/dist/runtime/components/Input.vue.d.ts +76 -0
- package/dist/runtime/components/InputNumber.vue +103 -130
- package/dist/runtime/components/InputNumber.vue.d.ts +191 -0
- package/dist/runtime/components/Kbd.vue +24 -39
- package/dist/runtime/components/Kbd.vue.d.ts +34 -0
- package/dist/runtime/components/Link.vue +105 -337
- package/dist/runtime/components/Link.vue.d.ts +95 -0
- package/dist/runtime/components/LinkBase.vue +31 -71
- package/dist/runtime/components/LinkBase.vue.d.ts +33 -0
- package/dist/runtime/components/Modal.vue +82 -103
- package/dist/runtime/components/Modal.vue.d.ts +96 -0
- package/dist/runtime/components/NavigationMenu.vue +336 -0
- package/dist/runtime/components/NavigationMenu.vue.d.ts +181 -0
- package/dist/runtime/components/OverlayProvider.vue +12 -16
- package/dist/runtime/components/OverlayProvider.vue.d.ts +3 -0
- package/dist/runtime/components/Pagination.vue +65 -139
- package/dist/runtime/components/Pagination.vue.d.ts +116 -0
- package/dist/runtime/components/PinInput.vue +78 -73
- package/dist/runtime/components/PinInput.vue.d.ts +54 -0
- package/dist/runtime/components/Popover.vue +60 -75
- package/dist/runtime/components/Popover.vue.d.ts +70 -0
- package/dist/runtime/components/Progress.vue +79 -126
- package/dist/runtime/components/Progress.vue.d.ts +63 -0
- package/dist/runtime/components/RadioGroup.vue +109 -140
- package/dist/runtime/components/RadioGroup.vue.d.ts +96 -0
- package/dist/runtime/components/ScrollArea.vue +50 -48
- package/dist/runtime/components/ScrollArea.vue.d.ts +21 -0
- package/dist/runtime/components/Select.vue +221 -221
- package/dist/runtime/components/Select.vue.d.ts +260 -0
- package/dist/runtime/components/Separator.vue +55 -47
- package/dist/runtime/components/Separator.vue.d.ts +48 -0
- package/dist/runtime/components/Skeleton.vue +25 -22
- package/dist/runtime/components/Skeleton.vue.d.ts +19 -0
- package/dist/runtime/components/Slider.vue +73 -77
- package/dist/runtime/components/Slider.vue.d.ts +52 -0
- package/dist/runtime/components/Switch.vue +66 -77
- package/dist/runtime/components/Switch.vue.d.ts +58 -0
- package/dist/runtime/components/Table.vue +357 -215
- package/dist/runtime/components/Table.vue.d.ts +234 -0
- package/dist/runtime/components/Tabs.vue +90 -88
- package/dist/runtime/components/Tabs.vue.d.ts +97 -0
- package/dist/runtime/components/Textarea.vue +147 -146
- package/dist/runtime/components/Textarea.vue.d.ts +76 -0
- package/dist/runtime/components/Toast.vue +108 -90
- package/dist/runtime/components/Toast.vue.d.ts +152 -0
- package/dist/runtime/components/ToastProvider.vue +82 -109
- package/dist/runtime/components/ToastProvider.vue.d.ts +51 -0
- package/dist/runtime/components/Tooltip.vue +54 -53
- package/dist/runtime/components/Tooltip.vue.d.ts +53 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +16 -0
- package/dist/runtime/composables/defineShortcuts.js +129 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +8 -3
- package/dist/runtime/composables/useAvatarGroup.js +10 -3
- package/dist/runtime/composables/useComponentIcons.d.ts +9 -6
- package/dist/runtime/composables/useComponentIcons.js +4 -4
- package/dist/runtime/composables/useFieldGroup.d.ts +8 -0
- package/dist/runtime/composables/useFieldGroup.js +14 -0
- package/dist/runtime/composables/useFormField.d.ts +62 -0
- package/dist/runtime/composables/useFormField.js +99 -0
- package/dist/runtime/composables/useKbd.d.ts +3 -2
- package/dist/runtime/composables/useKbd.js +3 -2
- package/dist/runtime/composables/useLocale.d.ts +68 -5
- package/dist/runtime/composables/useLocale.js +11 -11
- package/dist/runtime/composables/useOverlay.d.ts +51 -15
- package/dist/runtime/composables/useOverlay.js +44 -30
- package/dist/runtime/composables/usePortal.d.ts +6 -0
- package/dist/runtime/composables/usePortal.js +17 -0
- package/dist/runtime/composables/useToast.d.ts +12 -5
- package/dist/runtime/composables/useToast.js +12 -7
- package/dist/runtime/locale/en.d.ts +30 -1
- package/dist/runtime/locale/en.js +2 -1
- package/dist/runtime/locale/index.d.ts +2 -2
- package/dist/runtime/locale/index.js +1 -1
- package/dist/runtime/locale/zh_tw.d.ts +31 -0
- package/dist/runtime/locale/{zh-tw.js → zh_tw.js} +2 -1
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/colors.js +50 -0
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/form.d.ts +58 -17
- package/dist/runtime/types/form.js +11 -0
- package/dist/runtime/types/index.d.ts +51 -8
- package/dist/runtime/types/index.js +45 -2
- package/dist/runtime/types/input.d.ts +8 -0
- package/dist/runtime/types/locale.d.ts +5 -0
- package/dist/runtime/types/style.d.ts +33 -0
- package/dist/runtime/types/style.js +0 -0
- package/dist/runtime/types/unocss.d.ts +4 -0
- package/dist/runtime/types/utils.d.ts +38 -37
- package/dist/runtime/utils/form.d.ts +5 -1
- package/dist/runtime/utils/form.js +49 -0
- package/dist/runtime/utils/index.d.ts +10 -13
- package/dist/runtime/utils/index.js +41 -48
- package/dist/runtime/utils/link.d.ts +5 -6
- package/dist/runtime/utils/link.js +16 -2
- package/dist/runtime/utils/locale.d.ts +5 -0
- package/dist/runtime/utils/locale.js +10 -0
- package/dist/runtime/utils/style.d.ts +94 -0
- package/dist/runtime/utils/style.js +37 -0
- package/dist/runtime/vue/components/Icon.vue +15 -0
- package/dist/runtime/vue/components/Icon.vue.d.ts +7 -0
- package/dist/runtime/vue/components/Link.vue +163 -0
- package/dist/runtime/vue/components/Link.vue.d.ts +95 -0
- package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
- package/dist/runtime/vue/composables/useAppConfig.js +4 -0
- package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
- package/dist/runtime/vue/plugins/color-mode.js +6 -0
- package/dist/runtime/vue/plugins/head.d.ts +4 -0
- package/dist/runtime/vue/plugins/head.js +9 -0
- package/dist/runtime/vue/stubs.d.ts +16 -1
- package/dist/runtime/vue/stubs.js +32 -1
- package/dist/setup.d.mts +13 -0
- package/dist/setup.mjs +12 -0
- package/dist/shared/ui.CzIlLITK.mjs +51 -0
- package/dist/shared/ui.DSyJHSTk.mjs +3787 -0
- package/dist/shared/ui.DpbffTXs.d.mts +84 -0
- package/dist/shared/ui.IulR-OYx.d.mts +64 -0
- package/dist/types.d.mts +3 -1
- package/dist/unocss.d.mts +12 -52
- package/dist/unocss.mjs +144 -253
- package/dist/unplugin.d.mts +13 -26
- package/dist/unplugin.mjs +193 -18
- package/dist/vite.d.mts +10 -1
- package/dist/vite.mjs +12 -3
- package/package.json +156 -87
- package/vue-plugin.d.ts +5 -0
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -13
- package/dist/module.mjs.map +0 -1
- package/dist/runtime/app/injections.d.ts +0 -9307
- package/dist/runtime/app/injections.js +0 -61
- package/dist/runtime/components/ButtonGroup.vue +0 -46
- package/dist/runtime/components/FormItem.vue +0 -129
- package/dist/runtime/composables/useButtonGroup.d.ts +0 -5
- package/dist/runtime/composables/useButtonGroup.js +0 -9
- package/dist/runtime/composables/useFormItem.d.ts +0 -27
- package/dist/runtime/composables/useFormItem.js +0 -64
- package/dist/runtime/composables/useTheme.d.ts +0 -9
- package/dist/runtime/composables/useTheme.js +0 -23
- package/dist/runtime/index.d.ts +0 -44
- package/dist/runtime/index.js +0 -44
- package/dist/runtime/locale/zh-tw.d.ts +0 -2
- package/dist/runtime/theme/accordion.d.ts +0 -56
- package/dist/runtime/theme/accordion.js +0 -28
- package/dist/runtime/theme/alert.d.ts +0 -125
- package/dist/runtime/theme/alert.js +0 -47
- package/dist/runtime/theme/app.d.ts +0 -19
- package/dist/runtime/theme/app.js +0 -19
- package/dist/runtime/theme/avatar-group.d.ts +0 -52
- package/dist/runtime/theme/avatar-group.js +0 -32
- package/dist/runtime/theme/avatar.d.ts +0 -56
- package/dist/runtime/theme/avatar.js +0 -34
- package/dist/runtime/theme/badge.d.ts +0 -82
- package/dist/runtime/theme/badge.js +0 -92
- package/dist/runtime/theme/breadcrumb.d.ts +0 -67
- package/dist/runtime/theme/breadcrumb.js +0 -44
- package/dist/runtime/theme/button-group.d.ts +0 -66
- package/dist/runtime/theme/button-group.js +0 -42
- package/dist/runtime/theme/button.d.ts +0 -190
- package/dist/runtime/theme/button.js +0 -164
- package/dist/runtime/theme/calendar.d.ts +0 -56
- package/dist/runtime/theme/calendar.js +0 -69
- package/dist/runtime/theme/card.d.ts +0 -62
- package/dist/runtime/theme/card.js +0 -37
- package/dist/runtime/theme/carousel.d.ts +0 -113
- package/dist/runtime/theme/carousel.js +0 -43
- package/dist/runtime/theme/checkbox.d.ts +0 -88
- package/dist/runtime/theme/checkbox.js +0 -54
- package/dist/runtime/theme/chip.d.ts +0 -67
- package/dist/runtime/theme/chip.js +0 -66
- package/dist/runtime/theme/collapsible.d.ts +0 -38
- package/dist/runtime/theme/collapsible.js +0 -10
- package/dist/runtime/theme/drawer.d.ts +0 -148
- package/dist/runtime/theme/drawer.js +0 -113
- package/dist/runtime/theme/dropdown-menu.d.ts +0 -71
- package/dist/runtime/theme/dropdown-menu.js +0 -83
- package/dist/runtime/theme/form-item.d.ts +0 -76
- package/dist/runtime/theme/form-item.js +0 -34
- package/dist/runtime/theme/form.d.ts +0 -8
- package/dist/runtime/theme/form.js +0 -7
- package/dist/runtime/theme/index.d.ts +0 -41
- package/dist/runtime/theme/index.js +0 -41
- package/dist/runtime/theme/input-number.d.ts +0 -121
- package/dist/runtime/theme/input-number.js +0 -95
- package/dist/runtime/theme/input.d.ts +0 -178
- package/dist/runtime/theme/input.js +0 -151
- package/dist/runtime/theme/kbd.d.ts +0 -39
- package/dist/runtime/theme/kbd.js +0 -26
- package/dist/runtime/theme/link.d.ts +0 -44
- package/dist/runtime/theme/link.js +0 -26
- package/dist/runtime/theme/modal.d.ts +0 -48
- package/dist/runtime/theme/modal.js +0 -55
- package/dist/runtime/theme/pagination.d.ts +0 -80
- package/dist/runtime/theme/pagination.js +0 -17
- package/dist/runtime/theme/pinInput.d.ts +0 -100
- package/dist/runtime/theme/pinInput.js +0 -111
- package/dist/runtime/theme/popover.d.ts +0 -38
- package/dist/runtime/theme/popover.js +0 -13
- package/dist/runtime/theme/progress.d.ts +0 -186
- package/dist/runtime/theme/progress.js +0 -95
- package/dist/runtime/theme/radio-group.d.ts +0 -110
- package/dist/runtime/theme/radio-group.js +0 -61
- package/dist/runtime/theme/scroll-area.d.ts +0 -73
- package/dist/runtime/theme/scroll-area.js +0 -33
- package/dist/runtime/theme/select.d.ts +0 -192
- package/dist/runtime/theme/select.js +0 -173
- package/dist/runtime/theme/separator.d.ts +0 -80
- package/dist/runtime/theme/separator.js +0 -53
- package/dist/runtime/theme/skeleton.d.ts +0 -8
- package/dist/runtime/theme/skeleton.js +0 -7
- package/dist/runtime/theme/slider.d.ts +0 -76
- package/dist/runtime/theme/slider.js +0 -52
- package/dist/runtime/theme/switch.d.ts +0 -122
- package/dist/runtime/theme/switch.js +0 -78
- package/dist/runtime/theme/table.d.ts +0 -92
- package/dist/runtime/theme/table.js +0 -36
- package/dist/runtime/theme/tabs.d.ts +0 -135
- package/dist/runtime/theme/tabs.js +0 -146
- package/dist/runtime/theme/textarea.d.ts +0 -96
- package/dist/runtime/theme/textarea.js +0 -116
- package/dist/runtime/theme/toast-provider.d.ts +0 -122
- package/dist/runtime/theme/toast-provider.js +0 -97
- package/dist/runtime/theme/toast.d.ts +0 -89
- package/dist/runtime/theme/toast.js +0 -35
- package/dist/runtime/theme/tooltip.d.ts +0 -44
- package/dist/runtime/theme/tooltip.js +0 -11
- package/dist/runtime/types/components.d.ts +0 -42
- package/dist/runtime/utils/extend-theme.d.ts +0 -9
- package/dist/runtime/utils/extend-theme.js +0 -27
- package/dist/runtime/utils/styler.d.ts +0 -4
- package/dist/runtime/utils/styler.js +0 -10
- package/dist/runtime/utils/translator.d.ts +0 -18
- package/dist/runtime/utils/translator.js +0 -8
- package/dist/shared/ui.3e7fad19.mjs +0 -5
- package/dist/shared/ui.3e7fad19.mjs.map +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/unocss.d.ts +0 -52
- package/dist/unocss.mjs.map +0 -1
- package/dist/unplugin.d.ts +0 -26
- package/dist/unplugin.mjs.map +0 -1
- package/dist/vite.d.ts +0 -9
- package/dist/vite.mjs.map +0 -1
- /package/dist/runtime/types/{components.js → input.js} +0 -0
|
@@ -1,344 +1,111 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { PrimitiveProps } from 'reka-ui'
|
|
3
|
-
import type { ButtonHTMLAttributes } from 'vue'
|
|
4
|
-
import type { RouteLocationRaw, RouterLinkProps } from 'vue-router'
|
|
5
|
-
import type { link } from '../theme'
|
|
6
|
-
import type { ComponentAttrs } from '../types'
|
|
1
|
+
<script>
|
|
7
2
|
|
|
8
|
-
export interface LinkSlots {
|
|
9
|
-
default?: (props: { active: boolean }) => any
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
|
|
13
|
-
/**
|
|
14
|
-
* Route Location the link should navigate to when clicked on.
|
|
15
|
-
*/
|
|
16
|
-
to?: RouteLocationRaw // need to manually type to avoid breaking typedPages
|
|
17
|
-
/**
|
|
18
|
-
* An alias for `to`. If used with `to`, `href` will be ignored
|
|
19
|
-
*/
|
|
20
|
-
href?: NuxtLinkProps['to']
|
|
21
|
-
/**
|
|
22
|
-
* Forces the link to be considered as external (true) or internal (false). This is helpful to handle edge-cases
|
|
23
|
-
*/
|
|
24
|
-
external?: boolean
|
|
25
|
-
/**
|
|
26
|
-
* Where to display the linked URL, as the name for a browsing context.
|
|
27
|
-
*/
|
|
28
|
-
target?: '_blank' | '_parent' | '_self' | '_top' | (string & {}) | null
|
|
29
|
-
/**
|
|
30
|
-
* A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
|
|
31
|
-
*/
|
|
32
|
-
rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {}) | null
|
|
33
|
-
/**
|
|
34
|
-
* If set to true, no rel attribute will be added to the link
|
|
35
|
-
*/
|
|
36
|
-
noRel?: boolean
|
|
37
|
-
/**
|
|
38
|
-
* A class to apply to links that have been prefetched.
|
|
39
|
-
*/
|
|
40
|
-
prefetchedClass?: string
|
|
41
|
-
/**
|
|
42
|
-
* When enabled will prefetch middleware, layouts and payloads of links in the viewport.
|
|
43
|
-
*/
|
|
44
|
-
prefetch?: boolean
|
|
45
|
-
/**
|
|
46
|
-
* Allows controlling when to prefetch links. By default, prefetch is triggered only on visibility.
|
|
47
|
-
*/
|
|
48
|
-
prefetchOn?: 'visibility' | 'interaction' | Partial<{
|
|
49
|
-
visibility: boolean
|
|
50
|
-
interaction: boolean
|
|
51
|
-
}>
|
|
52
|
-
/**
|
|
53
|
-
* Escape hatch to disable `prefetch` attribute.
|
|
54
|
-
*/
|
|
55
|
-
noPrefetch?: boolean
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface LinkProps extends Omit<ComponentAttrs<typeof link>, 'ui'>, NuxtLinkProps {
|
|
59
|
-
/**
|
|
60
|
-
* The element or component this component should render as when not a link.
|
|
61
|
-
* @default "button"
|
|
62
|
-
*/
|
|
63
|
-
as?: PrimitiveProps['as']
|
|
64
|
-
/**
|
|
65
|
-
* The type of the button when not a link.
|
|
66
|
-
* @default "button"
|
|
67
|
-
*/
|
|
68
|
-
type?: ButtonHTMLAttributes['type']
|
|
69
|
-
label?: string
|
|
70
|
-
disabled?: boolean
|
|
71
|
-
/** Force the link to be active independent of the current route. */
|
|
72
|
-
active?: boolean
|
|
73
|
-
/** Will only be active if the current route is an exact match. */
|
|
74
|
-
exact?: boolean
|
|
75
|
-
/** Will only be active if the current route query is an exact match. */
|
|
76
|
-
exactQuery?: boolean | 'partial'
|
|
77
|
-
/** Will only be active if the current route hash is an exact match. */
|
|
78
|
-
exactHash?: boolean
|
|
79
|
-
/** The class to apply when the link is inactive. */
|
|
80
|
-
inactiveClass?: string
|
|
81
|
-
/** The class to apply when the link is disabled. */
|
|
82
|
-
disableClass?: string
|
|
83
|
-
custom?: boolean
|
|
84
|
-
underline?: boolean
|
|
85
|
-
/** When `true`, only styles from `class`, `ui.active`, and `ui.inactive` will be applied. */
|
|
86
|
-
raw?: boolean
|
|
87
|
-
}
|
|
88
3
|
</script>
|
|
89
4
|
|
|
90
|
-
<script setup
|
|
91
|
-
import { reactiveOmit } from
|
|
92
|
-
import {
|
|
93
|
-
import { useForwardProps } from
|
|
94
|
-
import {
|
|
95
|
-
import
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import
|
|
99
|
-
|
|
100
|
-
defineOptions({ inheritAttrs: false })
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
type:
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
props
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
'exactHash',
|
|
144
|
-
'activeClass',
|
|
145
|
-
'inactiveClass',
|
|
146
|
-
'raw',
|
|
147
|
-
'class',
|
|
148
|
-
...(hasNuxtLink ? [] : ['to'] as const),
|
|
149
|
-
))
|
|
150
|
-
|
|
151
|
-
function isPartiallyEqual(item1: any, item2: any) {
|
|
152
|
-
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
153
|
-
if (q.type === 'added')
|
|
154
|
-
filtered.add(q.key)
|
|
155
|
-
|
|
156
|
-
return filtered
|
|
157
|
-
}, new Set<string>())
|
|
158
|
-
|
|
159
|
-
const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)))
|
|
160
|
-
const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)))
|
|
161
|
-
|
|
162
|
-
return isEqual(item1Filtered, item2Filtered)
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const isExternalLink = computed(() => {
|
|
166
|
-
const to = props.to || props.href
|
|
167
|
-
|
|
168
|
-
if (!to)
|
|
169
|
-
return false
|
|
170
|
-
|
|
171
|
-
if (props.target === '_blank')
|
|
172
|
-
return true
|
|
173
|
-
|
|
174
|
-
return typeof to === 'string' && hasProtocol(to, { acceptRelative: true })
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) {
|
|
178
|
-
if (props.active !== undefined)
|
|
179
|
-
return props.active
|
|
180
|
-
|
|
181
|
-
if (isExternalLink.value || !props.to)
|
|
182
|
-
return false
|
|
183
|
-
|
|
184
|
-
if (props.exactQuery === 'partial') {
|
|
185
|
-
if (!isPartiallyEqual(linkRoute?.query, route.value?.query))
|
|
186
|
-
return false
|
|
187
|
-
}
|
|
188
|
-
else if (props.exactQuery === true && !isEqual(linkRoute?.query, route.value?.query)) {
|
|
189
|
-
return false
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactiveOmit, reactivePick } from "@vueuse/core";
|
|
7
|
+
import { isEqual } from "ohash/utils";
|
|
8
|
+
import { useForwardProps } from "reka-ui";
|
|
9
|
+
import { computed } from "vue";
|
|
10
|
+
import theme from "#build/ui/link";
|
|
11
|
+
import { useAppConfig, useRoute } from "#imports";
|
|
12
|
+
import { isPartiallyEqual } from "../utils/link";
|
|
13
|
+
import { cv, merge } from "../utils/style";
|
|
14
|
+
import LinkBase from "./LinkBase.vue";
|
|
15
|
+
defineOptions({ inheritAttrs: false });
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
as: { type: null, required: false, default: "button" },
|
|
18
|
+
type: { type: null, required: false, default: "button" },
|
|
19
|
+
label: { type: String, required: false },
|
|
20
|
+
disabled: { type: Boolean, required: false },
|
|
21
|
+
active: { type: Boolean, required: false, default: void 0 },
|
|
22
|
+
exact: { type: Boolean, required: false },
|
|
23
|
+
exactQuery: { type: [Boolean, String], required: false },
|
|
24
|
+
exactHash: { type: Boolean, required: false },
|
|
25
|
+
inactiveClass: { type: String, required: false },
|
|
26
|
+
custom: { type: Boolean, required: false },
|
|
27
|
+
raw: { type: Boolean, required: false },
|
|
28
|
+
class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
|
|
29
|
+
to: { type: null, required: false },
|
|
30
|
+
href: { type: null, required: false },
|
|
31
|
+
external: { type: Boolean, required: false },
|
|
32
|
+
target: { type: [String, Object], required: false },
|
|
33
|
+
rel: { type: [String, Object], required: false },
|
|
34
|
+
noRel: { type: Boolean, required: false },
|
|
35
|
+
prefetchedClass: { type: String, required: false },
|
|
36
|
+
prefetch: { type: Boolean, required: false },
|
|
37
|
+
prefetchOn: { type: [String, Object], required: false },
|
|
38
|
+
noPrefetch: { type: Boolean, required: false },
|
|
39
|
+
activeClass: { type: String, required: false },
|
|
40
|
+
exactActiveClass: { type: String, required: false },
|
|
41
|
+
ariaCurrentValue: { type: String, required: false, default: "page" },
|
|
42
|
+
viewTransition: { type: Boolean, required: false },
|
|
43
|
+
replace: { type: Boolean, required: false }
|
|
44
|
+
});
|
|
45
|
+
defineSlots();
|
|
46
|
+
const route = useRoute();
|
|
47
|
+
const inheritProps = useForwardProps(reactivePick(props, "as", "type", "disabled"));
|
|
48
|
+
const nuxtLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
|
|
49
|
+
const to = computed(() => props.to ?? props.href);
|
|
50
|
+
function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
|
|
51
|
+
if (props.active !== void 0)
|
|
52
|
+
return props.active;
|
|
53
|
+
if (props.exactQuery === "partial") {
|
|
54
|
+
if (!isPartiallyEqual(linkRoute.query, route.query))
|
|
55
|
+
return false;
|
|
56
|
+
} else if (props.exactQuery === true && !isEqual(linkRoute.query, route.query)) {
|
|
57
|
+
return false;
|
|
190
58
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return false
|
|
194
|
-
|
|
59
|
+
if (props.exactHash && linkRoute.hash !== route.hash)
|
|
60
|
+
return false;
|
|
195
61
|
if (props.exact && isExactActive)
|
|
196
|
-
return true
|
|
197
|
-
|
|
62
|
+
return true;
|
|
198
63
|
if (!props.exact && isActive)
|
|
199
|
-
return true
|
|
200
|
-
|
|
201
|
-
return false
|
|
64
|
+
return true;
|
|
65
|
+
return false;
|
|
202
66
|
}
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const { link } = theme.value
|
|
208
|
-
const active = isLinkActive({ route, isActive, isExactActive })
|
|
209
|
-
|
|
210
|
-
if (props.raw)
|
|
211
|
-
return [props.class, active ? props.activeClass : props.inactiveClass]
|
|
212
|
-
|
|
213
|
-
const styler = createStyler({
|
|
214
|
-
...link,
|
|
67
|
+
const appConfig = useAppConfig();
|
|
68
|
+
const ui = computed(() => {
|
|
69
|
+
const link = merge(theme, {
|
|
70
|
+
...appConfig.ui.link,
|
|
215
71
|
variants: {
|
|
216
|
-
...link
|
|
72
|
+
...appConfig.ui.link?.variants,
|
|
217
73
|
active: {
|
|
218
|
-
true: [link
|
|
219
|
-
false: [link
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
74
|
+
true: [appConfig.ui.link?.variants?.active?.true, props.activeClass].filter(Boolean).join(" "),
|
|
75
|
+
false: [appConfig.ui.link?.variants?.active?.false, props.inactiveClass].filter(Boolean).join(" ")
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return cv(link)();
|
|
80
|
+
});
|
|
81
|
+
function resolveLinkClass({ route: route2, isActive, isExactActive }) {
|
|
82
|
+
const active = isLinkActive({ route: route2, isActive, isExactActive });
|
|
83
|
+
if (props.raw)
|
|
84
|
+
return [props.class, active ? props.activeClass : props.inactiveClass];
|
|
85
|
+
return ui.value.base({ ...props, active });
|
|
228
86
|
}
|
|
229
87
|
</script>
|
|
230
88
|
|
|
231
89
|
<template>
|
|
232
|
-
<
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
custom
|
|
240
|
-
>
|
|
241
|
-
<template v-if="custom">
|
|
242
|
-
<slot
|
|
243
|
-
v-bind="{
|
|
244
|
-
...$attrs,
|
|
245
|
-
as,
|
|
246
|
-
type,
|
|
247
|
-
disabled,
|
|
248
|
-
href,
|
|
249
|
-
navigate,
|
|
250
|
-
rel,
|
|
251
|
-
target,
|
|
252
|
-
isExternal,
|
|
253
|
-
active: isLinkActive({ route: linkRoute, isActive, isExactActive }),
|
|
254
|
-
}"
|
|
255
|
-
>
|
|
256
|
-
{{ props.label }}
|
|
257
|
-
</slot>
|
|
258
|
-
</template>
|
|
259
|
-
<LinkBase
|
|
260
|
-
v-else
|
|
261
|
-
v-bind="{
|
|
262
|
-
...$attrs,
|
|
263
|
-
as,
|
|
264
|
-
type,
|
|
265
|
-
disabled,
|
|
266
|
-
href,
|
|
267
|
-
navigate,
|
|
268
|
-
rel,
|
|
269
|
-
target,
|
|
270
|
-
isExternal,
|
|
271
|
-
}"
|
|
272
|
-
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
|
|
273
|
-
>
|
|
274
|
-
<slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })">
|
|
275
|
-
{{ props.label }}
|
|
276
|
-
</slot>
|
|
277
|
-
</LinkBase>
|
|
278
|
-
</component>
|
|
279
|
-
<component
|
|
280
|
-
:is="linkComponent.RouterLink"
|
|
281
|
-
v-else
|
|
282
|
-
v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }"
|
|
283
|
-
v-bind="linkProps"
|
|
284
|
-
:to="isExternalLink ? '#' : to || '#'"
|
|
285
|
-
custom
|
|
286
|
-
>
|
|
287
|
-
<template v-if="custom">
|
|
288
|
-
<slot
|
|
289
|
-
v-bind="{
|
|
290
|
-
...$attrs,
|
|
291
|
-
...isExternalLink
|
|
292
|
-
? {
|
|
293
|
-
href: to || props.href,
|
|
294
|
-
target: props.target,
|
|
295
|
-
}
|
|
296
|
-
: {
|
|
297
|
-
href: to ? href : undefined,
|
|
298
|
-
target: undefined,
|
|
299
|
-
},
|
|
300
|
-
as,
|
|
301
|
-
type,
|
|
302
|
-
disabled,
|
|
303
|
-
navigate,
|
|
304
|
-
active: isLinkActive({ route: linkRoute, isActive, isExactActive }),
|
|
305
|
-
isExternal: isExternalLink,
|
|
306
|
-
}"
|
|
307
|
-
>
|
|
308
|
-
{{ props.label }}
|
|
309
|
-
</slot>
|
|
310
|
-
</template>
|
|
311
|
-
<LinkBase
|
|
312
|
-
v-else
|
|
313
|
-
v-bind="{
|
|
314
|
-
...$attrs,
|
|
315
|
-
as,
|
|
316
|
-
type,
|
|
317
|
-
disabled,
|
|
318
|
-
href: to ? href : undefined,
|
|
319
|
-
navigate,
|
|
320
|
-
}"
|
|
321
|
-
:is-external="isExternalLink"
|
|
322
|
-
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
|
|
323
|
-
>
|
|
324
|
-
<slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })">
|
|
325
|
-
{{ props.label }}
|
|
326
|
-
</slot>
|
|
327
|
-
</LinkBase>
|
|
328
|
-
</component>
|
|
329
|
-
</template>
|
|
330
|
-
<template v-else>
|
|
331
|
-
<template v-if="props.custom">
|
|
90
|
+
<NuxtLink
|
|
91
|
+
v-slot="{ href, navigate, route: linkRoute, rel, target, isExternal, isActive, isExactActive }"
|
|
92
|
+
v-bind="nuxtLinkProps"
|
|
93
|
+
:to="to"
|
|
94
|
+
custom
|
|
95
|
+
>
|
|
96
|
+
<template v-if="custom">
|
|
332
97
|
<slot
|
|
333
98
|
v-bind="{
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
99
|
+
...$attrs,
|
|
100
|
+
...props.exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {},
|
|
101
|
+
...inheritProps,
|
|
102
|
+
href,
|
|
103
|
+
navigate,
|
|
104
|
+
rel,
|
|
105
|
+
target,
|
|
106
|
+
isExternal,
|
|
107
|
+
active: isLinkActive({ route: linkRoute, isActive, isExactActive })
|
|
108
|
+
}"
|
|
342
109
|
>
|
|
343
110
|
{{ props.label }}
|
|
344
111
|
</slot>
|
|
@@ -346,19 +113,20 @@ function resolveLinkClass({ route, isActive, isExactActive }: any = {}) {
|
|
|
346
113
|
<LinkBase
|
|
347
114
|
v-else
|
|
348
115
|
v-bind="{
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
116
|
+
...$attrs,
|
|
117
|
+
...props.exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {},
|
|
118
|
+
...inheritProps,
|
|
119
|
+
href,
|
|
120
|
+
navigate,
|
|
121
|
+
rel,
|
|
122
|
+
target,
|
|
123
|
+
isExternal
|
|
124
|
+
}"
|
|
125
|
+
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
|
|
358
126
|
>
|
|
359
|
-
<slot :active="
|
|
127
|
+
<slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })">
|
|
360
128
|
{{ props.label }}
|
|
361
129
|
</slot>
|
|
362
130
|
</LinkBase>
|
|
363
|
-
</
|
|
131
|
+
</NuxtLink>
|
|
364
132
|
</template>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { PrimitiveProps } from 'reka-ui';
|
|
2
|
+
import type { ButtonHTMLAttributes } from 'vue';
|
|
3
|
+
import type { RouteLocationRaw, RouterLinkProps } from 'vue-router';
|
|
4
|
+
import type { ComponentBaseProps } from '../types';
|
|
5
|
+
import type { StaticSlot } from '../types/utils';
|
|
6
|
+
interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
|
|
7
|
+
/**
|
|
8
|
+
* Route Location the link should navigate to when clicked on.
|
|
9
|
+
*/
|
|
10
|
+
to?: RouteLocationRaw;
|
|
11
|
+
/**
|
|
12
|
+
* An alias for `to`. If used with `to`, `href` will be ignored
|
|
13
|
+
*/
|
|
14
|
+
href?: NuxtLinkProps['to'];
|
|
15
|
+
/**
|
|
16
|
+
* Forces the link to be considered as external (true) or internal (false). This is helpful to handle edge-cases
|
|
17
|
+
*/
|
|
18
|
+
external?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Where to display the linked URL, as the name for a browsing context.
|
|
21
|
+
*/
|
|
22
|
+
target?: '_blank' | '_parent' | '_self' | '_top' | (string & {});
|
|
23
|
+
/**
|
|
24
|
+
* A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
|
|
25
|
+
*/
|
|
26
|
+
rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {});
|
|
27
|
+
/**
|
|
28
|
+
* If set to true, no rel attribute will be added to the link
|
|
29
|
+
*/
|
|
30
|
+
noRel?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* A class to apply to links that have been prefetched.
|
|
33
|
+
*/
|
|
34
|
+
prefetchedClass?: string;
|
|
35
|
+
/**
|
|
36
|
+
* When enabled will prefetch middleware, layouts and payloads of links in the viewport.
|
|
37
|
+
*/
|
|
38
|
+
prefetch?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Allows controlling when to prefetch links. By default, prefetch is triggered only on visibility.
|
|
41
|
+
*/
|
|
42
|
+
prefetchOn?: 'visibility' | 'interaction' | Partial<{
|
|
43
|
+
visibility: boolean;
|
|
44
|
+
interaction: boolean;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Escape hatch to disable `prefetch` attribute.
|
|
48
|
+
*/
|
|
49
|
+
noPrefetch?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface LinkProps extends ComponentBaseProps, NuxtLinkProps {
|
|
52
|
+
/**
|
|
53
|
+
* The element or component this component should render as when not a link.
|
|
54
|
+
* @default "button"
|
|
55
|
+
*/
|
|
56
|
+
as?: PrimitiveProps['as'];
|
|
57
|
+
/**
|
|
58
|
+
* The type of the button when not a link.
|
|
59
|
+
* @default "button"
|
|
60
|
+
*/
|
|
61
|
+
type?: ButtonHTMLAttributes['type'];
|
|
62
|
+
label?: string;
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
/** Force the link to be active independent of the current route. */
|
|
65
|
+
active?: boolean;
|
|
66
|
+
/** Will only be active if the current route is an exact match. */
|
|
67
|
+
exact?: boolean;
|
|
68
|
+
/** Allows controlling how the current route query sets the link as active. */
|
|
69
|
+
exactQuery?: boolean | 'partial';
|
|
70
|
+
/** Will only be active if the current route hash is an exact match. */
|
|
71
|
+
exactHash?: boolean;
|
|
72
|
+
/** The class to apply when the link is inactive. */
|
|
73
|
+
inactiveClass?: string;
|
|
74
|
+
custom?: boolean;
|
|
75
|
+
/** When `true`, only styles from `class`, `activeClass`, and `inactiveClass` will be applied. */
|
|
76
|
+
raw?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface LinkSlots {
|
|
79
|
+
default: StaticSlot<{
|
|
80
|
+
active: boolean;
|
|
81
|
+
}>;
|
|
82
|
+
}
|
|
83
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<LinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LinkProps> & Readonly<{}>, {
|
|
84
|
+
active: boolean;
|
|
85
|
+
type: "reset" | "submit" | "button";
|
|
86
|
+
ariaCurrentValue: "page" | "step" | "location" | "date" | "time" | "true" | "false";
|
|
87
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
88
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, LinkSlots>;
|
|
89
|
+
declare const _default: typeof __VLS_export;
|
|
90
|
+
export default _default;
|
|
91
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
92
|
+
new (): {
|
|
93
|
+
$slots: S;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
@@ -1,88 +1,48 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { PrimitiveProps } from 'reka-ui'
|
|
1
|
+
<script>
|
|
3
2
|
|
|
4
|
-
export interface LinkBaseProps {
|
|
5
|
-
/**
|
|
6
|
-
* The element or component this component should render as.
|
|
7
|
-
* @default "button"
|
|
8
|
-
*/
|
|
9
|
-
as?: PrimitiveProps['as']
|
|
10
|
-
type?: string
|
|
11
|
-
disabled?: boolean
|
|
12
|
-
onClick?: ((e: MouseEvent) => void | Promise<void>) | Array<((e: MouseEvent) => void | Promise<void>)>
|
|
13
|
-
href?: string
|
|
14
|
-
navigate?: (e: MouseEvent) => void
|
|
15
|
-
rel?: string
|
|
16
|
-
target?: string
|
|
17
|
-
isExternal?: boolean
|
|
18
|
-
}
|
|
19
3
|
</script>
|
|
20
4
|
|
|
21
|
-
<script setup
|
|
22
|
-
import { Primitive } from
|
|
23
|
-
import { computed } from
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
type:
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { Primitive } from "reka-ui";
|
|
7
|
+
import { computed } from "vue";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
as: { type: null, required: false, default: "button" },
|
|
10
|
+
type: { type: String, required: false, default: "button" },
|
|
11
|
+
disabled: { type: Boolean, required: false },
|
|
12
|
+
onClick: { type: [Function, Array], required: false },
|
|
13
|
+
href: { type: String, required: false },
|
|
14
|
+
navigate: { type: Function, required: false },
|
|
15
|
+
target: { type: null, required: false },
|
|
16
|
+
rel: { type: null, required: false },
|
|
17
|
+
active: { type: Boolean, required: false },
|
|
18
|
+
isExternal: { type: Boolean, required: false }
|
|
19
|
+
});
|
|
20
|
+
const linkProps = computed(() => {
|
|
21
|
+
const { as, type, href, rel, target, disabled } = props;
|
|
22
|
+
if (href) {
|
|
23
|
+
return disabled ? { as: "a", ariaDisabled: "true", role: "link", tabindex: -1, rel, target } : { as: "a", href, rel, target };
|
|
36
24
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
'href': disabled ? undefined : href,
|
|
43
|
-
'aria-disabled': disabled ? 'true' : undefined,
|
|
44
|
-
'role': disabled ? 'link' : undefined,
|
|
45
|
-
'tabindex': disabled ? -1 : undefined,
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (props.as === 'button') {
|
|
50
|
-
return {
|
|
51
|
-
...baseProps,
|
|
52
|
-
as: props.as,
|
|
53
|
-
type: props.type,
|
|
54
|
-
disabled,
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
...baseProps,
|
|
60
|
-
as: props.as,
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
function onClickWrapper(e: MouseEvent) {
|
|
25
|
+
if (as === "button")
|
|
26
|
+
return { as, type, disabled, rel, target };
|
|
27
|
+
return { as, rel, target };
|
|
28
|
+
});
|
|
29
|
+
function onClickWrapper(e) {
|
|
65
30
|
if (props.disabled) {
|
|
66
|
-
e.stopPropagation()
|
|
67
|
-
e.preventDefault()
|
|
68
|
-
return
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
return;
|
|
69
34
|
}
|
|
70
|
-
|
|
71
35
|
if (props.onClick) {
|
|
72
36
|
for (const onClick of Array.isArray(props.onClick) ? props.onClick : [props.onClick])
|
|
73
|
-
onClick(e)
|
|
37
|
+
onClick(e);
|
|
74
38
|
}
|
|
75
|
-
|
|
76
39
|
if (props.href && props.navigate && !props.isExternal)
|
|
77
|
-
props.navigate(e)
|
|
40
|
+
props.navigate(e);
|
|
78
41
|
}
|
|
79
42
|
</script>
|
|
80
43
|
|
|
81
44
|
<template>
|
|
82
|
-
<Primitive
|
|
83
|
-
v-bind="wrapperProps"
|
|
84
|
-
@click="onClickWrapper"
|
|
85
|
-
>
|
|
45
|
+
<Primitive v-bind="linkProps" @click="onClickWrapper">
|
|
86
46
|
<slot></slot>
|
|
87
47
|
</Primitive>
|
|
88
48
|
</template>
|