@bitrix24/b24ui-nuxt 0.4.6 → 0.4.8
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/calendar.ts +92 -0
- package/.nuxt/b24ui/dropdown-menu.ts +1 -1
- package/.nuxt/b24ui/index.ts +2 -0
- package/.nuxt/b24ui/popover.ts +6 -0
- package/dist/meta.cjs +6200 -264
- package/dist/meta.d.cts +6200 -264
- package/dist/meta.d.mts +6200 -264
- package/dist/meta.d.ts +6200 -264
- package/dist/meta.mjs +6200 -264
- package/dist/module.cjs +1 -1
- package/dist/module.d.cts +1 -1
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Calendar.vue +211 -0
- 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/composables/defineLocale.d.ts +1 -0
- package/dist/runtime/dictionary/icons.d.ts +5 -0
- package/dist/runtime/dictionary/icons.js +2 -1
- package/dist/runtime/locale/ar.js +1 -0
- package/dist/runtime/locale/br.js +1 -0
- package/dist/runtime/locale/de.js +1 -0
- package/dist/runtime/locale/en.js +1 -0
- package/dist/runtime/locale/fr.js +1 -0
- package/dist/runtime/locale/id.js +1 -0
- package/dist/runtime/locale/it.js +1 -0
- package/dist/runtime/locale/ja.js +1 -0
- package/dist/runtime/locale/kz.js +1 -0
- package/dist/runtime/locale/la.js +1 -0
- package/dist/runtime/locale/ms.js +1 -0
- package/dist/runtime/locale/pl.js +1 -0
- package/dist/runtime/locale/ru.js +1 -0
- package/dist/runtime/locale/sc.js +1 -0
- package/dist/runtime/locale/tc.js +1 -0
- package/dist/runtime/locale/th.js +1 -0
- package/dist/runtime/locale/tr.js +1 -0
- package/dist/runtime/locale/ua.js +1 -0
- package/dist/runtime/locale/vn.js +1 -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 +2 -0
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/vue/stubs.d.ts +2 -4
- package/dist/runtime/vue/stubs.js +2 -1
- package/dist/shared/{b24ui-nuxt.yyScbwpE.cjs → b24ui-nuxt.CH0xlXgy.cjs} +127 -1
- package/dist/shared/{b24ui-nuxt.BiEJAB1L.mjs → b24ui-nuxt.D6rkGFKm.mjs} +127 -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 +7 -7
package/dist/module.cjs
CHANGED
package/dist/module.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ interface ModuleOptions {
|
|
|
5
5
|
/**
|
|
6
6
|
* Enable or disable `@nuxtjs/color-mode` module
|
|
7
7
|
* @defaultValue `true`
|
|
8
|
-
* @link https://
|
|
8
|
+
* @link https://bitrix24.github.io/b24ui/guide/color-mode-nuxt.html
|
|
9
9
|
*/
|
|
10
10
|
colorMode?: boolean;
|
|
11
11
|
}
|
package/dist/module.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ interface ModuleOptions {
|
|
|
5
5
|
/**
|
|
6
6
|
* Enable or disable `@nuxtjs/color-mode` module
|
|
7
7
|
* @defaultValue `true`
|
|
8
|
-
* @link https://
|
|
8
|
+
* @link https://bitrix24.github.io/b24ui/guide/color-mode-nuxt.html
|
|
9
9
|
*/
|
|
10
10
|
colorMode?: boolean;
|
|
11
11
|
}
|
package/dist/module.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ interface ModuleOptions {
|
|
|
5
5
|
/**
|
|
6
6
|
* Enable or disable `@nuxtjs/color-mode` module
|
|
7
7
|
* @defaultValue `true`
|
|
8
|
-
* @link https://
|
|
8
|
+
* @link https://bitrix24.github.io/b24ui/guide/color-mode-nuxt.html
|
|
9
9
|
*/
|
|
10
10
|
colorMode?: boolean;
|
|
11
11
|
}
|
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.D6rkGFKm.mjs';
|
|
4
4
|
import 'node:url';
|
|
5
5
|
import 'scule';
|
|
6
6
|
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { CalendarRootProps, CalendarRootEmits, RangeCalendarRootEmits, DateRange, CalendarCellTriggerProps } from 'reka-ui'
|
|
4
|
+
import type { DateValue } from '@internationalized/date'
|
|
5
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
+
import _appConfig from '#build/app.config'
|
|
7
|
+
import theme from '#build/b24ui/calendar'
|
|
8
|
+
import { tv } from '../utils/tv'
|
|
9
|
+
import type { IconComponent } from '../types'
|
|
10
|
+
import type { PartialString } from '../types/utils'
|
|
11
|
+
|
|
12
|
+
const appConfigCalendar = _appConfig as AppConfig & { b24ui: { calendar: Partial<typeof theme> } }
|
|
13
|
+
|
|
14
|
+
const calendar = tv({ extend: tv(theme), ...(appConfigCalendar.b24ui?.calendar || {}) })
|
|
15
|
+
|
|
16
|
+
type CalendarVariants = VariantProps<typeof calendar>
|
|
17
|
+
|
|
18
|
+
type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true
|
|
19
|
+
? DateRange
|
|
20
|
+
: M extends true
|
|
21
|
+
? DateValue[]
|
|
22
|
+
: DateValue
|
|
23
|
+
|
|
24
|
+
export interface CalendarProps<R extends boolean, M extends boolean> extends Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'> {
|
|
25
|
+
/**
|
|
26
|
+
* The element or component this component should render as.
|
|
27
|
+
* @defaultValue 'div'
|
|
28
|
+
*/
|
|
29
|
+
as?: any
|
|
30
|
+
/**
|
|
31
|
+
* The icon to use for the next year control.
|
|
32
|
+
* @defaultValue icons.chevronDoubleRight
|
|
33
|
+
* @IconComponent
|
|
34
|
+
*/
|
|
35
|
+
nextYearIcon?: IconComponent
|
|
36
|
+
/**
|
|
37
|
+
* The icon to use for the next month control.
|
|
38
|
+
* @defaultValue icons.chevronRight
|
|
39
|
+
* @IconComponent
|
|
40
|
+
*/
|
|
41
|
+
nextMonthIcon?: IconComponent
|
|
42
|
+
/**
|
|
43
|
+
* The icon to use for the previous year control.
|
|
44
|
+
* @defaultValue icons.chevronDoubleLeft
|
|
45
|
+
* @IconComponent
|
|
46
|
+
*/
|
|
47
|
+
prevYearIcon?: IconComponent
|
|
48
|
+
/**
|
|
49
|
+
* The icon to use for the previous month control.
|
|
50
|
+
* @defaultValue icons.chevronLeft
|
|
51
|
+
* @IconComponent
|
|
52
|
+
*/
|
|
53
|
+
prevMonthIcon?: IconComponent
|
|
54
|
+
/**
|
|
55
|
+
* @defaultValue 'primary'
|
|
56
|
+
*/
|
|
57
|
+
color?: CalendarVariants['color']
|
|
58
|
+
/**
|
|
59
|
+
* @defaultValue 'md'
|
|
60
|
+
*/
|
|
61
|
+
size?: CalendarVariants['size']
|
|
62
|
+
/** Whether a range of dates can be selected */
|
|
63
|
+
range?: R & boolean
|
|
64
|
+
/** Whether multiple dates can be selected */
|
|
65
|
+
multiple?: M & boolean
|
|
66
|
+
/** Show month controls */
|
|
67
|
+
monthControls?: boolean
|
|
68
|
+
/** Show year controls */
|
|
69
|
+
yearControls?: boolean
|
|
70
|
+
defaultValue?: CalendarModelValue<R, M>
|
|
71
|
+
modelValue?: CalendarModelValue<R, M>
|
|
72
|
+
class?: any
|
|
73
|
+
b24ui?: PartialString<typeof calendar.slots>
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
|
|
77
|
+
'update:modelValue': [date: CalendarModelValue<R, M>]
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface CalendarSlots {
|
|
81
|
+
'heading': (props: { value: string }) => any
|
|
82
|
+
'day': (props: Pick<CalendarCellTriggerProps, 'day'>) => any
|
|
83
|
+
'week-day': (props: { day: string }) => any
|
|
84
|
+
}
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<script setup lang="ts" generic="R extends boolean = false, M extends boolean = false">
|
|
88
|
+
import { computed } from 'vue'
|
|
89
|
+
import { useForwardPropsEmits } from 'reka-ui'
|
|
90
|
+
import { Calendar as SingleCalendar, RangeCalendar } from 'reka-ui/namespaced'
|
|
91
|
+
import { reactiveOmit } from '@vueuse/core'
|
|
92
|
+
import { useLocale } from '../composables/useLocale'
|
|
93
|
+
import icons from '../dictionary/icons'
|
|
94
|
+
import B24Button from './Button.vue'
|
|
95
|
+
|
|
96
|
+
const props = withDefaults(defineProps<CalendarProps<R, M>>(), {
|
|
97
|
+
fixedWeeks: true,
|
|
98
|
+
monthControls: true,
|
|
99
|
+
yearControls: true
|
|
100
|
+
})
|
|
101
|
+
const emits = defineEmits<CalendarEmits<R, M>>()
|
|
102
|
+
defineSlots<CalendarSlots>()
|
|
103
|
+
|
|
104
|
+
const { code: locale, dir, t } = useLocale()
|
|
105
|
+
|
|
106
|
+
const rootProps = useForwardPropsEmits(reactiveOmit(props, 'range', 'modelValue', 'defaultValue', 'color', 'size', 'monthControls', 'yearControls', 'class', 'b24ui'), emits)
|
|
107
|
+
|
|
108
|
+
const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === 'rtl' ? icons.chevronDoubleLeft : icons.chevronDoubleRight))
|
|
109
|
+
const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === 'rtl' ? icons.chevronLeft : icons.chevronRight))
|
|
110
|
+
const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === 'rtl' ? icons.chevronDoubleRight : icons.chevronDoubleLeft))
|
|
111
|
+
const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === 'rtl' ? icons.chevronRight : icons.chevronLeft))
|
|
112
|
+
|
|
113
|
+
const b24ui = computed(() => calendar({
|
|
114
|
+
color: props.color,
|
|
115
|
+
size: props.size
|
|
116
|
+
}))
|
|
117
|
+
|
|
118
|
+
function paginateYear(date: DateValue, sign: -1 | 1) {
|
|
119
|
+
if (sign === -1) {
|
|
120
|
+
return date.subtract({ years: 1 })
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return date.add({ years: 1 })
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar)
|
|
127
|
+
|
|
128
|
+
const btnSize = computed(() => {
|
|
129
|
+
switch (props.size) {
|
|
130
|
+
case 'lg': return 'sm'
|
|
131
|
+
default: return 'xs'
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<template>
|
|
137
|
+
<Calendar.Root
|
|
138
|
+
v-slot="{ weekDays, grid }"
|
|
139
|
+
v-bind="rootProps"
|
|
140
|
+
:model-value="(modelValue as CalendarModelValue<true & false>)"
|
|
141
|
+
:default-value="(defaultValue as CalendarModelValue<true & false>)"
|
|
142
|
+
:locale="locale"
|
|
143
|
+
:dir="dir"
|
|
144
|
+
:class="b24ui.root({ class: [props.class, props.b24ui?.root] })"
|
|
145
|
+
>
|
|
146
|
+
<Calendar.Header :class="b24ui.header({ class: props.b24ui?.header })">
|
|
147
|
+
<Calendar.Prev v-if="props.yearControls" :prev-page="(date: DateValue) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
|
|
148
|
+
<B24Button :icon="prevYearIcon" :size="btnSize" color="link" />
|
|
149
|
+
</Calendar.Prev>
|
|
150
|
+
<Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
|
|
151
|
+
<B24Button :icon="prevMonthIcon" :size="btnSize" color="link" />
|
|
152
|
+
</Calendar.Prev>
|
|
153
|
+
<Calendar.Heading v-slot="{ headingValue }" :class="b24ui.heading({ class: props.b24ui?.heading })">
|
|
154
|
+
<slot name="heading" :value="headingValue">
|
|
155
|
+
{{ headingValue }}
|
|
156
|
+
</slot>
|
|
157
|
+
</Calendar.Heading>
|
|
158
|
+
<Calendar.Next v-if="props.monthControls" :aria-label="t('calendar.nextMonth')" as-child>
|
|
159
|
+
<B24Button :icon="nextMonthIcon" :size="btnSize" color="link" />
|
|
160
|
+
</Calendar.Next>
|
|
161
|
+
<Calendar.Next v-if="props.yearControls" :next-page="(date: DateValue) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
|
|
162
|
+
<B24Button :icon="nextYearIcon" :size="btnSize" color="link" />
|
|
163
|
+
</Calendar.Next>
|
|
164
|
+
</Calendar.Header>
|
|
165
|
+
<div :class="b24ui.body({ class: props.b24ui?.body })">
|
|
166
|
+
<Calendar.Grid
|
|
167
|
+
v-for="month in grid"
|
|
168
|
+
:key="month.value.toString()"
|
|
169
|
+
:class="b24ui.grid({ class: props.b24ui?.grid })"
|
|
170
|
+
>
|
|
171
|
+
<Calendar.GridHead>
|
|
172
|
+
<Calendar.GridRow :class="b24ui.gridWeekDaysRow({ class: props.b24ui?.gridWeekDaysRow })">
|
|
173
|
+
<Calendar.HeadCell
|
|
174
|
+
v-for="day in weekDays"
|
|
175
|
+
:key="day"
|
|
176
|
+
:class="b24ui.headCell({ class: props.b24ui?.headCell })"
|
|
177
|
+
>
|
|
178
|
+
<slot name="week-day" :day="day">
|
|
179
|
+
{{ day }}
|
|
180
|
+
</slot>
|
|
181
|
+
</Calendar.HeadCell>
|
|
182
|
+
</Calendar.GridRow>
|
|
183
|
+
</Calendar.GridHead>
|
|
184
|
+
<Calendar.GridBody :class="b24ui.gridBody({ class: props.b24ui?.gridBody })">
|
|
185
|
+
<Calendar.GridRow
|
|
186
|
+
v-for="(weekDates, index) in month.rows"
|
|
187
|
+
:key="`weekDate-${index}`"
|
|
188
|
+
:class="b24ui.gridRow({ class: props.b24ui?.gridRow })"
|
|
189
|
+
>
|
|
190
|
+
<Calendar.Cell
|
|
191
|
+
v-for="weekDate in weekDates"
|
|
192
|
+
:key="weekDate.toString()"
|
|
193
|
+
:date="weekDate"
|
|
194
|
+
:class="b24ui.cell({ class: props.b24ui?.cell })"
|
|
195
|
+
>
|
|
196
|
+
<Calendar.CellTrigger
|
|
197
|
+
:day="weekDate"
|
|
198
|
+
:month="month.value"
|
|
199
|
+
:class="b24ui.cellTrigger({ class: props.b24ui?.cellTrigger })"
|
|
200
|
+
>
|
|
201
|
+
<slot name="day" :day="weekDate">
|
|
202
|
+
{{ weekDate.day }}
|
|
203
|
+
</slot>
|
|
204
|
+
</Calendar.CellTrigger>
|
|
205
|
+
</Calendar.Cell>
|
|
206
|
+
</Calendar.GridRow>
|
|
207
|
+
</Calendar.GridBody>
|
|
208
|
+
</Calendar.Grid>
|
|
209
|
+
</div>
|
|
210
|
+
</Calendar.Root>
|
|
211
|
+
</template>
|
|
@@ -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>
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default icons
|
|
3
|
+
* ---
|
|
4
|
+
* @link https://bitrix24.github.io/b24icons/
|
|
5
|
+
*/
|
|
1
6
|
declare const _default: {
|
|
2
7
|
arrowLeft: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}>;
|
|
3
8
|
arrowRight: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}>;
|
|
@@ -6,6 +6,7 @@ import ChevronDownIcon from "@bitrix24/b24icons-vue/actions/ChevronDownIcon";
|
|
|
6
6
|
import ChevronToTheLeftIcon from "@bitrix24/b24icons-vue/actions/ChevronToTheLeftIcon";
|
|
7
7
|
import ChevronToTheRightIcon from "@bitrix24/b24icons-vue/actions/ChevronToTheRightIcon";
|
|
8
8
|
import DoubleShevronsRightIcon from "@bitrix24/b24icons-vue/actions/DoubleShevronsRightIcon";
|
|
9
|
+
import DoubleShevronsLeftIcon from "@bitrix24/b24icons-vue/actions/DoubleShevronsLeftIcon";
|
|
9
10
|
import Cross30Icon from "@bitrix24/b24icons-vue/actions/Cross30Icon";
|
|
10
11
|
import DotsIcon from "@bitrix24/b24icons-vue/button/DotsIcon";
|
|
11
12
|
import OpenIn50Icon from "@bitrix24/b24icons-vue/actions/OpenIn50Icon";
|
|
@@ -18,7 +19,7 @@ export default {
|
|
|
18
19
|
arrowLeft: ArrowToTheLeftIcon,
|
|
19
20
|
arrowRight: ArrowToTheRightIcon,
|
|
20
21
|
check: CheckIcon,
|
|
21
|
-
chevronDoubleLeft:
|
|
22
|
+
chevronDoubleLeft: DoubleShevronsLeftIcon,
|
|
22
23
|
chevronDoubleRight: DoubleShevronsRightIcon,
|
|
23
24
|
chevronDown: ChevronDownIcon,
|
|
24
25
|
chevronLeft: ChevronToTheLeftIcon,
|
|
@@ -2,6 +2,7 @@ import { defineLocale } from "../composables/defineLocale.js";
|
|
|
2
2
|
export default defineLocale({
|
|
3
3
|
name: "\u65E5\u672C\u8A9E",
|
|
4
4
|
code: "ja",
|
|
5
|
+
locale: "ja",
|
|
5
6
|
messages: {
|
|
6
7
|
inputMenu: {
|
|
7
8
|
noMatch: "\u4E00\u81F4\u3059\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",
|
|
@@ -2,6 +2,7 @@ import { defineLocale } from "../composables/defineLocale.js";
|
|
|
2
2
|
export default defineLocale({
|
|
3
3
|
name: "\u049A\u0430\u0437\u0430\u049B\u0448\u0430",
|
|
4
4
|
code: "kz",
|
|
5
|
+
locale: "kk",
|
|
5
6
|
messages: {
|
|
6
7
|
inputMenu: {
|
|
7
8
|
noMatch: "\u0421\u04D9\u0439\u043A\u0435\u0441 \u0434\u0435\u0440\u0435\u043A\u0442\u0435\u0440 \u0436\u043E\u049B",
|
|
@@ -2,6 +2,7 @@ import { defineLocale } from "../composables/defineLocale.js";
|
|
|
2
2
|
export default defineLocale({
|
|
3
3
|
name: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
|
|
4
4
|
code: "ru",
|
|
5
|
+
locale: "ru",
|
|
5
6
|
messages: {
|
|
6
7
|
inputMenu: {
|
|
7
8
|
noMatch: "\u0421\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0439 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",
|
|
@@ -2,6 +2,7 @@ import { defineLocale } from "../composables/defineLocale.js";
|
|
|
2
2
|
export default defineLocale({
|
|
3
3
|
name: "\u0E20\u0E32\u0E29\u0E32\u0E44\u0E17\u0E22",
|
|
4
4
|
code: "th",
|
|
5
|
+
locale: "th",
|
|
5
6
|
messages: {
|
|
6
7
|
inputMenu: {
|
|
7
8
|
noMatch: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E19",
|
|
@@ -2,6 +2,7 @@ import { defineLocale } from "../composables/defineLocale.js";
|
|
|
2
2
|
export default defineLocale({
|
|
3
3
|
name: "\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",
|
|
4
4
|
code: "ua",
|
|
5
|
+
locale: "uk",
|
|
5
6
|
messages: {
|
|
6
7
|
inputMenu: {
|
|
7
8
|
noMatch: "\u0417\u0431\u0456\u0433\u0456\u0432 \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E",
|
|
@@ -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 {
|