@bitrix24/b24ui-nuxt 0.1.1
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/.nuxt/b24ui/advice.ts +52 -0
- package/.nuxt/b24ui/alert.ts +118 -0
- package/.nuxt/b24ui/avatar-group.ts +52 -0
- package/.nuxt/b24ui/avatar.ts +63 -0
- package/.nuxt/b24ui/badge.ts +256 -0
- package/.nuxt/b24ui/button-group.ts +27 -0
- package/.nuxt/b24ui/button.ts +342 -0
- package/.nuxt/b24ui/checkbox.ts +128 -0
- package/.nuxt/b24ui/chip.ts +205 -0
- package/.nuxt/b24ui/container.ts +3 -0
- package/.nuxt/b24ui/content/description-list.ts +62 -0
- package/.nuxt/b24ui/countdown.ts +94 -0
- package/.nuxt/b24ui/form-field.ts +57 -0
- package/.nuxt/b24ui/form.ts +3 -0
- package/.nuxt/b24ui/index.ts +28 -0
- package/.nuxt/b24ui/input.ts +472 -0
- package/.nuxt/b24ui/kbd.ts +31 -0
- package/.nuxt/b24ui/link.ts +20 -0
- package/.nuxt/b24ui/progress.ts +303 -0
- package/.nuxt/b24ui/radio-group.ts +135 -0
- package/.nuxt/b24ui/range.ts +172 -0
- package/.nuxt/b24ui/select.ts +550 -0
- package/.nuxt/b24ui/separator.ts +176 -0
- package/.nuxt/b24ui/skeleton.ts +3 -0
- package/.nuxt/b24ui/switch.ts +134 -0
- package/.nuxt/b24ui/tabs.ts +341 -0
- package/.nuxt/b24ui/textarea.ts +332 -0
- package/.nuxt/b24ui/toast.ts +89 -0
- package/.nuxt/b24ui/toaster.ts +91 -0
- package/.nuxt/b24ui/tooltip.ts +16 -0
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/cli/commands/make/component.mjs +95 -0
- package/cli/commands/make/index.mjs +14 -0
- package/cli/commands/make/locale.mjs +64 -0
- package/cli/index.mjs +15 -0
- package/cli/package.json +13 -0
- package/cli/templates.mjs +240 -0
- package/cli/utils.mjs +31 -0
- package/dist/meta.cjs +23610 -0
- package/dist/meta.d.cts +23608 -0
- package/dist/meta.d.mts +23608 -0
- package/dist/meta.d.ts +23608 -0
- package/dist/meta.mjs +23608 -0
- package/dist/module.cjs +54 -0
- package/dist/module.d.cts +14 -0
- package/dist/module.d.mts +14 -0
- package/dist/module.d.ts +14 -0
- package/dist/module.json +13 -0
- package/dist/module.mjs +51 -0
- package/dist/runtime/components/Advice.vue +115 -0
- package/dist/runtime/components/Alert.vue +136 -0
- package/dist/runtime/components/App.vue +52 -0
- package/dist/runtime/components/Avatar.vue +118 -0
- package/dist/runtime/components/AvatarGroup.vue +99 -0
- package/dist/runtime/components/Badge.vue +114 -0
- package/dist/runtime/components/Button.vue +177 -0
- package/dist/runtime/components/ButtonGroup.vue +58 -0
- package/dist/runtime/components/Checkbox.vue +110 -0
- package/dist/runtime/components/Chip.vue +81 -0
- package/dist/runtime/components/Container.vue +36 -0
- package/dist/runtime/components/Countdown.vue +498 -0
- package/dist/runtime/components/Form.vue +271 -0
- package/dist/runtime/components/FormField.vue +128 -0
- package/dist/runtime/components/Input.vue +224 -0
- package/dist/runtime/components/Kbd.vue +50 -0
- package/dist/runtime/components/Link.vue +219 -0
- package/dist/runtime/components/LinkBase.vue +63 -0
- package/dist/runtime/components/Progress.vue +182 -0
- package/dist/runtime/components/RadioGroup.vue +178 -0
- package/dist/runtime/components/Range.vue +114 -0
- package/dist/runtime/components/Select.vue +328 -0
- package/dist/runtime/components/Separator.vue +82 -0
- package/dist/runtime/components/Skeleton.vue +31 -0
- package/dist/runtime/components/Switch.vue +133 -0
- package/dist/runtime/components/Tabs.vue +127 -0
- package/dist/runtime/components/Textarea.vue +216 -0
- package/dist/runtime/components/Toast.vue +168 -0
- package/dist/runtime/components/Toaster.vue +143 -0
- package/dist/runtime/components/Tooltip.vue +94 -0
- package/dist/runtime/components/content/DescriptionList.vue +220 -0
- package/dist/runtime/composables/defineLocale.d.ts +9 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +15 -0
- package/dist/runtime/composables/defineShortcuts.js +135 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +10 -0
- package/dist/runtime/composables/useAvatarGroup.js +10 -0
- package/dist/runtime/composables/useButtonGroup.d.ts +17 -0
- package/dist/runtime/composables/useButtonGroup.js +10 -0
- package/dist/runtime/composables/useComponentIcons.d.ts +20 -0
- package/dist/runtime/composables/useComponentIcons.js +25 -0
- package/dist/runtime/composables/useFormField.d.ts +42 -0
- package/dist/runtime/composables/useFormField.js +65 -0
- package/dist/runtime/composables/useKbd.d.ts +35 -0
- package/dist/runtime/composables/useKbd.js +52 -0
- package/dist/runtime/composables/useLocale.d.ts +4 -0
- package/dist/runtime/composables/useLocale.js +10 -0
- package/dist/runtime/composables/useToast.d.ts +12 -0
- package/dist/runtime/composables/useToast.js +62 -0
- package/dist/runtime/dictionary/icons.d.ts +20 -0
- package/dist/runtime/dictionary/icons.js +35 -0
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/keyframes.css +1 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +48 -0
- package/dist/runtime/locale/es.d.ts +2 -0
- package/dist/runtime/locale/es.js +48 -0
- package/dist/runtime/locale/index.d.ts +3 -0
- package/dist/runtime/locale/index.js +3 -0
- package/dist/runtime/locale/ru.d.ts +2 -0
- package/dist/runtime/locale/ru.js +48 -0
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/colors.js +40 -0
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/form.d.ts +84 -0
- package/dist/runtime/types/form.js +12 -0
- package/dist/runtime/types/icons.d.ts +3 -0
- package/dist/runtime/types/icons.js +0 -0
- package/dist/runtime/types/index.d.ts +33 -0
- package/dist/runtime/types/index.js +33 -0
- package/dist/runtime/types/locale.d.ts +50 -0
- package/dist/runtime/types/locale.js +0 -0
- package/dist/runtime/types/utils.d.ts +22 -0
- package/dist/runtime/types/utils.js +0 -0
- package/dist/runtime/utils/form.d.ts +17 -0
- package/dist/runtime/utils/form.js +153 -0
- package/dist/runtime/utils/fuse.d.ts +4 -0
- package/dist/runtime/utils/fuse.js +63 -0
- package/dist/runtime/utils/index.d.ts +6 -0
- package/dist/runtime/utils/index.js +63 -0
- package/dist/runtime/utils/link.d.ts +29 -0
- package/dist/runtime/utils/link.js +4 -0
- package/dist/runtime/utils/locale.d.ts +15 -0
- package/dist/runtime/utils/locale.js +25 -0
- package/dist/runtime/utils/tv.d.ts +1 -0
- package/dist/runtime/utils/tv.js +4 -0
- package/dist/runtime/vue/components/Link.vue +203 -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 +6 -0
- package/dist/runtime/vue/stubs.d.ts +15 -0
- package/dist/runtime/vue/stubs.js +27 -0
- package/dist/shared/b24ui-nuxt.CNGvMe2S.mjs +4074 -0
- package/dist/shared/b24ui-nuxt.D22QQtm8.cjs +4079 -0
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/unplugin.cjs +213 -0
- package/dist/unplugin.d.cts +22 -0
- package/dist/unplugin.d.mts +22 -0
- package/dist/unplugin.d.ts +22 -0
- package/dist/unplugin.mjs +202 -0
- package/dist/vite.cjs +21 -0
- package/dist/vite.d.cts +12 -0
- package/dist/vite.d.mts +12 -0
- package/dist/vite.d.ts +12 -0
- package/dist/vite.mjs +19 -0
- package/package.json +166 -0
- package/vue-plugin.d.ts +5 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ButtonHTMLAttributes } from 'vue'
|
|
3
|
+
import { tv } from 'tailwind-variants'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import type { RouterLinkProps, RouteLocationRaw } from 'vue-router'
|
|
7
|
+
import theme from '#build/b24ui/link'
|
|
8
|
+
|
|
9
|
+
interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
|
|
10
|
+
/**
|
|
11
|
+
* Route Location the link should navigate to when clicked on.
|
|
12
|
+
*/
|
|
13
|
+
to?: RouteLocationRaw // need to manually type to avoid breaking typedPages
|
|
14
|
+
/**
|
|
15
|
+
* An alias for `to`. If used with `to`, `href` will be ignored
|
|
16
|
+
*/
|
|
17
|
+
href?: NuxtLinkProps['to']
|
|
18
|
+
/**
|
|
19
|
+
* Forces the link to be considered as external (true) or internal (false). This is helpful to handle edge-cases
|
|
20
|
+
*/
|
|
21
|
+
external?: boolean
|
|
22
|
+
/**
|
|
23
|
+
* Where to display the linked URL, as the name for a browsing context.
|
|
24
|
+
*/
|
|
25
|
+
target?: '_blank' | '_parent' | '_self' | '_top' | (string & {}) | null
|
|
26
|
+
/**
|
|
27
|
+
* A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
|
|
28
|
+
*/
|
|
29
|
+
rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {}) | null
|
|
30
|
+
/**
|
|
31
|
+
* If set to true, no rel attribute will be added to the link
|
|
32
|
+
*/
|
|
33
|
+
noRel?: boolean
|
|
34
|
+
/**
|
|
35
|
+
* A class to apply to links that have been prefetched.
|
|
36
|
+
*/
|
|
37
|
+
prefetchedClass?: string
|
|
38
|
+
/**
|
|
39
|
+
* When enabled will prefetch middleware, layouts and payloads of links in the viewport.
|
|
40
|
+
*/
|
|
41
|
+
prefetch?: boolean
|
|
42
|
+
/**
|
|
43
|
+
* Allows controlling when to prefetch links. By default, prefetch is triggered only on visibility.
|
|
44
|
+
*/
|
|
45
|
+
prefetchOn?: 'visibility' | 'interaction' | Partial<{
|
|
46
|
+
visibility: boolean
|
|
47
|
+
interaction: boolean
|
|
48
|
+
}>
|
|
49
|
+
/**
|
|
50
|
+
* Escape hatch to disable `prefetch` attribute.
|
|
51
|
+
*/
|
|
52
|
+
noPrefetch?: boolean
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const appConfigLink = _appConfig as AppConfig & { b24ui: { link: Partial<typeof theme> } }
|
|
56
|
+
|
|
57
|
+
const link = tv({ extend: tv(theme), ...(appConfigLink.b24ui?.link || {}) })
|
|
58
|
+
|
|
59
|
+
export interface LinkProps extends NuxtLinkProps {
|
|
60
|
+
/**
|
|
61
|
+
* The element or component this component should render as when not a link.
|
|
62
|
+
* @defaultValue 'button'
|
|
63
|
+
*/
|
|
64
|
+
as?: any
|
|
65
|
+
/**
|
|
66
|
+
* The type of the button when not a link.
|
|
67
|
+
* @defaultValue 'button'
|
|
68
|
+
*/
|
|
69
|
+
type?: ButtonHTMLAttributes['type']
|
|
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
|
|
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
|
+
custom?: boolean
|
|
82
|
+
/** When `true`, uses special underlined styling. */
|
|
83
|
+
isAction?: boolean
|
|
84
|
+
/** When `true`, only styles from `class`, `activeClass`, and `inactiveClass` will be applied. */
|
|
85
|
+
raw?: boolean
|
|
86
|
+
class?: any
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface LinkSlots {
|
|
90
|
+
default(props: { active: boolean }): any
|
|
91
|
+
}
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<script setup lang="ts">
|
|
95
|
+
import { computed } from 'vue'
|
|
96
|
+
import { isEqual } from 'ohash'
|
|
97
|
+
import { useForwardProps } from 'reka-ui'
|
|
98
|
+
import { reactiveOmit } from '@vueuse/core'
|
|
99
|
+
import { hasProtocol } from 'ufo'
|
|
100
|
+
import { useRoute } from '#imports'
|
|
101
|
+
import { RouterLink } from 'vue-router'
|
|
102
|
+
|
|
103
|
+
defineOptions({ inheritAttrs: false })
|
|
104
|
+
|
|
105
|
+
const props = withDefaults(defineProps<LinkProps>(), {
|
|
106
|
+
as: 'button',
|
|
107
|
+
type: 'button',
|
|
108
|
+
active: undefined,
|
|
109
|
+
isAction: false,
|
|
110
|
+
activeClass: '',
|
|
111
|
+
inactiveClass: ''
|
|
112
|
+
})
|
|
113
|
+
defineSlots<LinkSlots>()
|
|
114
|
+
|
|
115
|
+
const route = useRoute()
|
|
116
|
+
const routerLinkProps = useForwardProps(reactiveOmit(props, 'as', 'type', 'disabled', 'active', 'exact', 'exactQuery', 'exactHash', 'activeClass', 'inactiveClass', 'to', 'raw', 'class'))
|
|
117
|
+
|
|
118
|
+
const ui = computed(() => tv({
|
|
119
|
+
extend: link,
|
|
120
|
+
variants: {
|
|
121
|
+
active: {
|
|
122
|
+
true: props.activeClass,
|
|
123
|
+
false: props.inactiveClass
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}))
|
|
127
|
+
|
|
128
|
+
const isExternal = computed(() => typeof props.to === 'string' && hasProtocol(props.to, { acceptRelative: true }))
|
|
129
|
+
|
|
130
|
+
function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) {
|
|
131
|
+
if (props.active !== undefined) {
|
|
132
|
+
return props.active
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (!props.to) {
|
|
136
|
+
return false
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (props.exactQuery && !isEqual(linkRoute.query, route.query)) {
|
|
140
|
+
return false
|
|
141
|
+
}
|
|
142
|
+
if (props.exactHash && linkRoute.hash !== route.hash) {
|
|
143
|
+
return false
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (props.exact && isExactActive) {
|
|
147
|
+
return true
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (!props.exact && isActive) {
|
|
151
|
+
return true
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return false
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function resolveLinkClass({ route, isActive, isExactActive }: any) {
|
|
158
|
+
const active = isLinkActive({ route, isActive, isExactActive })
|
|
159
|
+
|
|
160
|
+
if (props.raw) {
|
|
161
|
+
return [props.class, active ? props.activeClass : props.inactiveClass]
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return ui.value({
|
|
165
|
+
class: props.class,
|
|
166
|
+
active,
|
|
167
|
+
disabled: props.disabled,
|
|
168
|
+
isAction: Boolean(props.isAction)
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<template>
|
|
174
|
+
<RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to || '#'" custom>
|
|
175
|
+
<template v-if="custom">
|
|
176
|
+
<slot
|
|
177
|
+
v-bind="{
|
|
178
|
+
...$attrs,
|
|
179
|
+
as,
|
|
180
|
+
type,
|
|
181
|
+
disabled,
|
|
182
|
+
href: to ? (isExternal ? to as string : href) : undefined,
|
|
183
|
+
navigate,
|
|
184
|
+
active: isLinkActive({ route: linkRoute, isActive, isExactActive })
|
|
185
|
+
}"
|
|
186
|
+
/>
|
|
187
|
+
</template>
|
|
188
|
+
<B24LinkBase
|
|
189
|
+
v-else
|
|
190
|
+
v-bind="{
|
|
191
|
+
...$attrs,
|
|
192
|
+
as,
|
|
193
|
+
type,
|
|
194
|
+
disabled,
|
|
195
|
+
href: to ? (isExternal ? to as string : href) : undefined,
|
|
196
|
+
navigate
|
|
197
|
+
}"
|
|
198
|
+
:class="resolveLinkClass({ route: linkRoute, isActive: isActive, isExactActive: isExactActive })"
|
|
199
|
+
>
|
|
200
|
+
<slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })" />
|
|
201
|
+
</B24LinkBase>
|
|
202
|
+
</RouterLink>
|
|
203
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { NuxtApp } from '#app';
|
|
3
|
+
export { useHead } from '@unhead/vue';
|
|
4
|
+
export { useRoute, useRouter } from 'vue-router';
|
|
5
|
+
export declare const useAppConfig: () => any;
|
|
6
|
+
export declare const useState: <T>(key: string, init: () => T) => Ref<T>;
|
|
7
|
+
export declare function useNuxtApp(): {
|
|
8
|
+
isHydrating: boolean;
|
|
9
|
+
payload: {
|
|
10
|
+
serverRendered: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare function defineNuxtPlugin(plugin: (nuxtApp: NuxtApp) => void): {
|
|
14
|
+
install(app: import("vue").App<any>): void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import appConfig from "#build/app.config";
|
|
3
|
+
export { useHead } from "@unhead/vue";
|
|
4
|
+
export { useRoute, useRouter } from "vue-router";
|
|
5
|
+
export const useAppConfig = () => appConfig;
|
|
6
|
+
const state = {};
|
|
7
|
+
export const useState = (key, init) => {
|
|
8
|
+
if (state[key]) {
|
|
9
|
+
return state[key];
|
|
10
|
+
}
|
|
11
|
+
const value = ref(init());
|
|
12
|
+
state[key] = value;
|
|
13
|
+
return value;
|
|
14
|
+
};
|
|
15
|
+
export function useNuxtApp() {
|
|
16
|
+
return {
|
|
17
|
+
isHydrating: true,
|
|
18
|
+
payload: { serverRendered: false }
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function defineNuxtPlugin(plugin) {
|
|
22
|
+
return {
|
|
23
|
+
install(app) {
|
|
24
|
+
plugin({ vueApp: app });
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|