@bitrix24/b24ui-nuxt 0.4.6 → 0.4.7
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/dropdown-menu.ts +1 -1
- package/.nuxt/b24ui/index.ts +1 -0
- package/.nuxt/b24ui/popover.ts +6 -0
- package/dist/meta.cjs +306 -8
- package/dist/meta.d.cts +306 -8
- package/dist/meta.d.mts +306 -8
- package/dist/meta.d.ts +306 -8
- package/dist/meta.mjs +306 -8
- package/dist/module.cjs +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Form.vue +5 -5
- package/dist/runtime/components/FormField.vue +1 -1
- package/dist/runtime/components/Popover.vue +105 -0
- package/dist/runtime/plugins/colors.js +3 -1
- package/dist/runtime/types/form.d.ts +1 -1
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/vue/stubs.d.ts +2 -4
- package/dist/runtime/vue/stubs.js +2 -1
- package/dist/shared/{b24ui-nuxt.BiEJAB1L.mjs → b24ui-nuxt.CPOPpSQq.mjs} +14 -1
- package/dist/shared/{b24ui-nuxt.yyScbwpE.cjs → b24ui-nuxt.lbv7ybxH.cjs} +14 -1
- package/dist/unplugin.cjs +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +2 -2
package/dist/module.cjs
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defu } from 'defu';
|
|
2
2
|
import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addComponentsDir, addImportsDir, hasNuxtModule, installModule } from '@nuxt/kit';
|
|
3
|
-
import { d as defaultOptions, a as getDefaultUiConfig, b as addTemplates } from './shared/b24ui-nuxt.
|
|
3
|
+
import { d as defaultOptions, a as getDefaultUiConfig, b as addTemplates } from './shared/b24ui-nuxt.CPOPpSQq.mjs';
|
|
4
4
|
import 'node:url';
|
|
5
5
|
import 'scule';
|
|
6
6
|
|
|
@@ -29,7 +29,7 @@ export interface FormEmits<T extends object> {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface FormSlots {
|
|
32
|
-
default(props?: {}): any
|
|
32
|
+
default(props?: { errors: FormError[] }): any
|
|
33
33
|
}
|
|
34
34
|
</script>
|
|
35
35
|
|
|
@@ -120,7 +120,7 @@ const blurredFields = new Set<keyof T>()
|
|
|
120
120
|
function resolveErrorIds(errs: FormError[]): FormErrorWithId[] {
|
|
121
121
|
return errs.map(err => ({
|
|
122
122
|
...err,
|
|
123
|
-
id: inputs.value[err.name]?.id
|
|
123
|
+
id: err?.name ? inputs.value[err.name]?.id : undefined
|
|
124
124
|
}))
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -158,12 +158,12 @@ async function _validate(opts: { name?: keyof T | (keyof T)[], silent?: boolean,
|
|
|
158
158
|
if (names) {
|
|
159
159
|
const otherErrors = errors.value.filter(error => !names.some((name) => {
|
|
160
160
|
const pattern = inputs.value?.[name]?.pattern
|
|
161
|
-
return name === error.name || (pattern && error.name
|
|
161
|
+
return name === error.name || (pattern && error.name?.match(pattern))
|
|
162
162
|
}))
|
|
163
163
|
|
|
164
164
|
const pathErrors = (await getErrors()).filter(error => names.some((name) => {
|
|
165
165
|
const pattern = inputs.value?.[name]?.pattern
|
|
166
|
-
return name === error.name || (pattern && error.name
|
|
166
|
+
return name === error.name || (pattern && error.name?.match(pattern))
|
|
167
167
|
}))
|
|
168
168
|
|
|
169
169
|
errors.value = otherErrors.concat(pathErrors)
|
|
@@ -268,6 +268,6 @@ defineExpose<Form<T>>({
|
|
|
268
268
|
:class="form({ class: props.class })"
|
|
269
269
|
@submit.prevent="onSubmitWrapper"
|
|
270
270
|
>
|
|
271
|
-
<slot />
|
|
271
|
+
<slot :errors="errors" />
|
|
272
272
|
</component>
|
|
273
273
|
</template>
|
|
@@ -68,7 +68,7 @@ const b24ui = computed(() => formField({
|
|
|
68
68
|
|
|
69
69
|
const formErrors = inject<Ref<FormError[]> | null>('form-errors', null)
|
|
70
70
|
|
|
71
|
-
const error = computed(() => props.error || formErrors?.value?.find(error => error.name === props.name || (props.errorPattern && error.name.match(props.errorPattern)))?.message)
|
|
71
|
+
const error = computed(() => props.error || formErrors?.value?.find(error => error.name && (error.name === props.name || (props.errorPattern && error.name.match(props.errorPattern))))?.message)
|
|
72
72
|
|
|
73
73
|
const id = ref(useId())
|
|
74
74
|
// Copies id's initial value to bind aria-attributes such as aria-describedby.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverArrowProps } from 'reka-ui'
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/b24ui/popover'
|
|
6
|
+
import { tv } from '../utils/tv'
|
|
7
|
+
|
|
8
|
+
const appConfigPopover = _appConfig as AppConfig & { b24ui: { popover: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const popover = tv({ extend: tv(theme), ...(appConfigPopover.b24ui?.popover || {}) })
|
|
11
|
+
|
|
12
|
+
export interface PopoverProps extends PopoverRootProps, Pick<HoverCardRootProps, 'openDelay' | 'closeDelay'> {
|
|
13
|
+
/**
|
|
14
|
+
* The display mode of the popover.
|
|
15
|
+
* @defaultValue 'click'
|
|
16
|
+
*/
|
|
17
|
+
mode?: 'click' | 'hover'
|
|
18
|
+
/**
|
|
19
|
+
* The content of the popover.
|
|
20
|
+
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
|
21
|
+
*/
|
|
22
|
+
content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
23
|
+
/**
|
|
24
|
+
* Display an arrow alongside the popover.
|
|
25
|
+
* @defaultValue false
|
|
26
|
+
*/
|
|
27
|
+
arrow?: boolean | Omit<PopoverArrowProps, 'as' | 'asChild'>
|
|
28
|
+
/**
|
|
29
|
+
* Render the popover in a portal.
|
|
30
|
+
* @defaultValue true
|
|
31
|
+
*/
|
|
32
|
+
portal?: boolean
|
|
33
|
+
/**
|
|
34
|
+
* When `false`, the popover will not close when clicking outside or pressing escape.
|
|
35
|
+
* @defaultValue true
|
|
36
|
+
*/
|
|
37
|
+
dismissible?: boolean
|
|
38
|
+
class?: any
|
|
39
|
+
b24ui?: Partial<typeof popover.slots>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface PopoverEmits extends PopoverRootEmits {}
|
|
43
|
+
|
|
44
|
+
export interface PopoverSlots {
|
|
45
|
+
default(props: { open: boolean }): any
|
|
46
|
+
content(props?: {}): any
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<script setup lang="ts">
|
|
51
|
+
import { computed, toRef } from 'vue'
|
|
52
|
+
import { defu } from 'defu'
|
|
53
|
+
import { useForwardPropsEmits } from 'reka-ui'
|
|
54
|
+
import { Popover, HoverCard } from 'reka-ui/namespaced'
|
|
55
|
+
import { reactivePick } from '@vueuse/core'
|
|
56
|
+
|
|
57
|
+
const props = withDefaults(defineProps<PopoverProps>(), {
|
|
58
|
+
portal: true,
|
|
59
|
+
mode: 'click',
|
|
60
|
+
openDelay: 0,
|
|
61
|
+
closeDelay: 0,
|
|
62
|
+
dismissible: true
|
|
63
|
+
})
|
|
64
|
+
const emits = defineEmits<PopoverEmits>()
|
|
65
|
+
const slots = defineSlots<PopoverSlots>()
|
|
66
|
+
|
|
67
|
+
const pick = props.mode === 'hover' ? reactivePick(props, 'defaultOpen', 'open', 'openDelay', 'closeDelay') : reactivePick(props, 'defaultOpen', 'open', 'modal')
|
|
68
|
+
const rootProps = useForwardPropsEmits(pick, emits)
|
|
69
|
+
const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8 }) as PopoverContentProps)
|
|
70
|
+
const contentEvents = computed(() => {
|
|
71
|
+
if (!props.dismissible) {
|
|
72
|
+
return {
|
|
73
|
+
pointerDownOutside: (e: Event) => e.preventDefault(),
|
|
74
|
+
interactOutside: (e: Event) => e.preventDefault(),
|
|
75
|
+
escapeKeyDown: (e: Event) => e.preventDefault()
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return {}
|
|
80
|
+
})
|
|
81
|
+
const arrowProps = toRef(() => props.arrow as PopoverArrowProps)
|
|
82
|
+
|
|
83
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
84
|
+
const b24ui = computed(() => popover({
|
|
85
|
+
side: contentProps.value.side
|
|
86
|
+
}))
|
|
87
|
+
|
|
88
|
+
const Component = computed(() => props.mode === 'hover' ? HoverCard : Popover)
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<template>
|
|
92
|
+
<Component.Root v-slot="{ open }" v-bind="rootProps">
|
|
93
|
+
<Component.Trigger v-if="!!slots.default" as-child :class="props.class">
|
|
94
|
+
<slot :open="open" />
|
|
95
|
+
</Component.Trigger>
|
|
96
|
+
|
|
97
|
+
<Component.Portal :disabled="!portal">
|
|
98
|
+
<Component.Content v-bind="contentProps" :class="b24ui.content({ class: [!slots.default && props.class, props.b24ui?.content] })" v-on="contentEvents">
|
|
99
|
+
<slot name="content" />
|
|
100
|
+
|
|
101
|
+
<Component.Arrow v-if="!!arrow" v-bind="arrowProps" :class="b24ui.arrow({ class: props.b24ui?.arrow })" />
|
|
102
|
+
</Component.Content>
|
|
103
|
+
</Component.Portal>
|
|
104
|
+
</Component.Root>
|
|
105
|
+
</template>
|
|
@@ -27,7 +27,7 @@ export interface Form<T extends object> {
|
|
|
27
27
|
export type FormSchema<T extends object> = ZodSchema | YupObjectSchema<T> | ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any> | JoiSchema<T> | SuperstructSchema<any, any> | StandardSchemaV1;
|
|
28
28
|
export type FormInputEvents = 'input' | 'blur' | 'change' | 'focus';
|
|
29
29
|
export interface FormError<P extends string = string> {
|
|
30
|
-
name
|
|
30
|
+
name?: P;
|
|
31
31
|
message: string;
|
|
32
32
|
}
|
|
33
33
|
export interface FormErrorWithId extends FormError {
|
|
@@ -21,6 +21,7 @@ export * from '../components/Kbd.vue';
|
|
|
21
21
|
export * from '../components/Link.vue';
|
|
22
22
|
export * from '../components/Modal.vue';
|
|
23
23
|
export * from '../components/ModalDialogClose.vue';
|
|
24
|
+
export * from '../components/Popover.vue';
|
|
24
25
|
export * from '../components/Progress.vue';
|
|
25
26
|
export * from '../components/RadioGroup.vue';
|
|
26
27
|
export * from '../components/Range.vue';
|
|
@@ -21,6 +21,7 @@ export * from "../components/Kbd.vue";
|
|
|
21
21
|
export * from "../components/Link.vue";
|
|
22
22
|
export * from "../components/Modal.vue";
|
|
23
23
|
export * from "../components/ModalDialogClose.vue";
|
|
24
|
+
export * from "../components/Popover.vue";
|
|
24
25
|
export * from "../components/Progress.vue";
|
|
25
26
|
export * from "../components/RadioGroup.vue";
|
|
26
27
|
export * from "../components/Range.vue";
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
2
|
import type { NuxtApp } from '#app';
|
|
3
|
-
|
|
4
|
-
* @todo not use @unhead/vue/legacy
|
|
5
|
-
*/
|
|
6
|
-
export { useHead } from '@unhead/vue/legacy';
|
|
3
|
+
export { useHead } from '@unhead/vue';
|
|
7
4
|
export { useRoute, useRouter } from 'vue-router';
|
|
8
5
|
export { defineShortcuts } from '../composables/defineShortcuts';
|
|
9
6
|
export { defineLocale } from '../composables/defineLocale';
|
|
@@ -31,6 +28,7 @@ export declare const useCookie: <T = string>(_name: string, _options?: Record<st
|
|
|
31
28
|
export declare const useState: <T>(key: string, init: () => T) => Ref<T>;
|
|
32
29
|
export declare function useNuxtApp(): {
|
|
33
30
|
isHydrating: boolean;
|
|
31
|
+
isVue: boolean;
|
|
34
32
|
payload: {
|
|
35
33
|
serverRendered: boolean;
|
|
36
34
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref } from "vue";
|
|
2
2
|
import appConfig from "#build/app.config";
|
|
3
3
|
import { useColorMode as useColorModeVueUse } from "@vueuse/core";
|
|
4
|
-
export { useHead } from "@unhead/vue
|
|
4
|
+
export { useHead } from "@unhead/vue";
|
|
5
5
|
export { useRoute, useRouter } from "vue-router";
|
|
6
6
|
export { defineShortcuts } from "../composables/defineShortcuts.js";
|
|
7
7
|
export { defineLocale } from "../composables/defineLocale.js";
|
|
@@ -55,6 +55,7 @@ export const useState = (key, init) => {
|
|
|
55
55
|
export function useNuxtApp() {
|
|
56
56
|
return {
|
|
57
57
|
isHydrating: true,
|
|
58
|
+
isVue: true,
|
|
58
59
|
payload: { serverRendered: false }
|
|
59
60
|
};
|
|
60
61
|
}
|
|
@@ -1694,7 +1694,7 @@ const dropdownMenu = {
|
|
|
1694
1694
|
"bg-white dark:bg-base-dark",
|
|
1695
1695
|
"shadow-lg rounded-2xs ring ring-base-300 dark:ring-base-800",
|
|
1696
1696
|
"overflow-y-auto",
|
|
1697
|
-
"data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
1697
|
+
"motion-safe:data-[state=open]:animate-[scale-in_100ms_ease-out] motion-safe:data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
1698
1698
|
"divide-y divide-base-master/10 dark:divide-base-100/20 scroll-py-1",
|
|
1699
1699
|
"pointer-events-auto"
|
|
1700
1700
|
].join(" "),
|
|
@@ -3391,6 +3391,18 @@ const modal = {
|
|
|
3391
3391
|
}
|
|
3392
3392
|
};
|
|
3393
3393
|
|
|
3394
|
+
const popover = {
|
|
3395
|
+
slots: {
|
|
3396
|
+
content: [
|
|
3397
|
+
"bg-white dark:bg-base-dark",
|
|
3398
|
+
"shadow-lg rounded-2xs ring ring-base-300 dark:ring-base-800",
|
|
3399
|
+
"motion-safe:data-[state=open]:animate-[scale-in_100ms_ease-out] motion-safe:data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
3400
|
+
"focus:outline-none pointer-events-auto"
|
|
3401
|
+
].join(" "),
|
|
3402
|
+
arrow: "fill-white dark:fill-base-dark stroke-base-300 dark:stroke-base-300"
|
|
3403
|
+
}
|
|
3404
|
+
};
|
|
3405
|
+
|
|
3394
3406
|
const progress = {
|
|
3395
3407
|
slots: {
|
|
3396
3408
|
root: "gap-2",
|
|
@@ -5294,6 +5306,7 @@ const theme = {
|
|
|
5294
5306
|
kbd: kbd,
|
|
5295
5307
|
link: link,
|
|
5296
5308
|
modal: modal,
|
|
5309
|
+
popover: popover,
|
|
5297
5310
|
progress: progress,
|
|
5298
5311
|
radioGroup: radioGroup,
|
|
5299
5312
|
range: range,
|
|
@@ -1696,7 +1696,7 @@ const dropdownMenu = {
|
|
|
1696
1696
|
"bg-white dark:bg-base-dark",
|
|
1697
1697
|
"shadow-lg rounded-2xs ring ring-base-300 dark:ring-base-800",
|
|
1698
1698
|
"overflow-y-auto",
|
|
1699
|
-
"data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
1699
|
+
"motion-safe:data-[state=open]:animate-[scale-in_100ms_ease-out] motion-safe:data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
1700
1700
|
"divide-y divide-base-master/10 dark:divide-base-100/20 scroll-py-1",
|
|
1701
1701
|
"pointer-events-auto"
|
|
1702
1702
|
].join(" "),
|
|
@@ -3393,6 +3393,18 @@ const modal = {
|
|
|
3393
3393
|
}
|
|
3394
3394
|
};
|
|
3395
3395
|
|
|
3396
|
+
const popover = {
|
|
3397
|
+
slots: {
|
|
3398
|
+
content: [
|
|
3399
|
+
"bg-white dark:bg-base-dark",
|
|
3400
|
+
"shadow-lg rounded-2xs ring ring-base-300 dark:ring-base-800",
|
|
3401
|
+
"motion-safe:data-[state=open]:animate-[scale-in_100ms_ease-out] motion-safe:data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
3402
|
+
"focus:outline-none pointer-events-auto"
|
|
3403
|
+
].join(" "),
|
|
3404
|
+
arrow: "fill-white dark:fill-base-dark stroke-base-300 dark:stroke-base-300"
|
|
3405
|
+
}
|
|
3406
|
+
};
|
|
3407
|
+
|
|
3396
3408
|
const progress = {
|
|
3397
3409
|
slots: {
|
|
3398
3410
|
root: "gap-2",
|
|
@@ -5296,6 +5308,7 @@ const theme = {
|
|
|
5296
5308
|
kbd: kbd,
|
|
5297
5309
|
link: link,
|
|
5298
5310
|
modal: modal,
|
|
5311
|
+
popover: popover,
|
|
5299
5312
|
progress: progress,
|
|
5300
5313
|
radioGroup: radioGroup,
|
|
5301
5314
|
range: range,
|
package/dist/unplugin.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const pathe = require('pathe');
|
|
|
5
5
|
const unplugin = require('unplugin');
|
|
6
6
|
const defu = require('defu');
|
|
7
7
|
const tailwind = require('@tailwindcss/vite');
|
|
8
|
-
const templates = require('./shared/b24ui-nuxt.
|
|
8
|
+
const templates = require('./shared/b24ui-nuxt.lbv7ybxH.cjs');
|
|
9
9
|
const tinyglobby = require('tinyglobby');
|
|
10
10
|
const knitwork = require('knitwork');
|
|
11
11
|
const MagicString = require('magic-string');
|
package/dist/unplugin.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { join, normalize } from 'pathe';
|
|
|
3
3
|
import { createUnplugin } from 'unplugin';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
5
|
import tailwind from '@tailwindcss/vite';
|
|
6
|
-
import { g as getTemplates, d as defaultOptions, a as getDefaultUiConfig } from './shared/b24ui-nuxt.
|
|
6
|
+
import { g as getTemplates, d as defaultOptions, a as getDefaultUiConfig } from './shared/b24ui-nuxt.CPOPpSQq.mjs';
|
|
7
7
|
import { globSync } from 'tinyglobby';
|
|
8
8
|
import { genSafeVariableName } from 'knitwork';
|
|
9
9
|
import MagicString from 'magic-string';
|
package/dist/vite.cjs
CHANGED
package/dist/vite.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitrix24/b24ui-nuxt",
|
|
3
3
|
"description": "Bitrix24 UI-Kit for developing web applications REST API for NUXT & VUE",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.7",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/bitrix24/b24ui.git"
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@tailwindcss/postcss": "^4.0.12",
|
|
79
79
|
"@tailwindcss/vite": "^4.0.12",
|
|
80
80
|
"@tanstack/vue-table": "^8.21.2",
|
|
81
|
-
"@unhead/vue": "^2.0.0-rc.
|
|
81
|
+
"@unhead/vue": "^2.0.0-rc.10",
|
|
82
82
|
"@vueuse/core": "^13.0.0",
|
|
83
83
|
"@vueuse/integrations": "^13.0.0",
|
|
84
84
|
"canvas-confetti": "^1.9.3",
|