@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/dist/module.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const defu = require('defu');
4
4
  const kit = require('@nuxt/kit');
5
- const templates = require('./shared/b24ui-nuxt.yyScbwpE.cjs');
5
+ const templates = require('./shared/b24ui-nuxt.lbv7ybxH.cjs');
6
6
  require('node:url');
7
7
  require('scule');
8
8
 
package/dist/module.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
7
  "docs": "https://bitrix24.github.io/b24ui/guide/installation-nuxt-app.html",
8
- "version": "0.4.6",
8
+ "version": "0.4.7",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.8.4",
11
11
  "unbuild": "2.0.0"
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.BiEJAB1L.mjs';
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.match(pattern))
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.match(pattern))
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>
@@ -38,5 +38,7 @@ export default defineNuxtPlugin(() => {
38
38
  }];
39
39
  }
40
40
  }
41
- useHead(headData);
41
+ if (!nuxtApp.isVue) {
42
+ useHead(headData);
43
+ }
42
44
  });
@@ -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: P;
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/legacy";
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.yyScbwpE.cjs');
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.BiEJAB1L.mjs';
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
@@ -6,7 +6,7 @@ require('pathe');
6
6
  require('unplugin');
7
7
  require('defu');
8
8
  require('@tailwindcss/vite');
9
- require('./shared/b24ui-nuxt.yyScbwpE.cjs');
9
+ require('./shared/b24ui-nuxt.lbv7ybxH.cjs');
10
10
  require('scule');
11
11
  require('@nuxt/kit');
12
12
  require('tinyglobby');
package/dist/vite.mjs CHANGED
@@ -4,7 +4,7 @@ import 'pathe';
4
4
  import 'unplugin';
5
5
  import 'defu';
6
6
  import '@tailwindcss/vite';
7
- import './shared/b24ui-nuxt.BiEJAB1L.mjs';
7
+ import './shared/b24ui-nuxt.CPOPpSQq.mjs';
8
8
  import 'scule';
9
9
  import '@nuxt/kit';
10
10
  import 'tinyglobby';
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.6",
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.9",
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",