@bridge-ui/vue 0.12.0 → 0.14.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/ai/skills/bridge-ui-components/SKILL.md +2 -1
- package/ai/skills/bridge-ui-forms/SKILL.md +3 -3
- package/dist/Adapters/Examples/date-moment.js +31 -31
- package/dist/Adapters/Examples/i18n-dictionary.js +14 -0
- package/dist/Adapters/Examples/icon-fontawesome.js +24 -22
- package/dist/Adapters/Examples/icon-heroicons.js +47 -45
- package/dist/Adapters/Examples/icon-lucide.js +13 -11
- package/dist/Adapters/Examples/icon-phosphor.js +49 -47
- package/dist/Adapters/Examples/icon-tabler.js +13 -11
- package/dist/Adapters/Examples/rich-text-tiptap.js +34 -41
- package/dist/Components/BaseField/composables/useBaseField.d.ts +3 -3
- package/dist/Components/BaseField/composables/useBaseField.js +7 -7
- package/dist/Components/Calendar/Calendar.vue.d.ts +14 -6
- package/dist/Components/Calendar/Calendar.vue_vue_type_script_setup_true_lang.js +78 -74
- package/dist/Components/Calendar/calendar.types.d.ts +12 -7
- package/dist/Components/Calendar/composables/useCalendar.d.ts +5 -9
- package/dist/Components/Calendar/composables/useCalendar.js +144 -143
- package/dist/Components/CalendarDate/CalendarDate.vue.d.ts +14 -6
- package/dist/Components/CalendarDate/CalendarDate.vue_vue_type_script_setup_true_lang.js +20 -16
- package/dist/Components/CalendarDate/calendarDate.types.d.ts +13 -8
- package/dist/Components/CalendarDate/composables/useCalendarDate.d.ts +4 -8
- package/dist/Components/CalendarDate/composables/useCalendarDate.js +105 -105
- package/dist/Components/CalendarMonth/CalendarMonth.vue.d.ts +9 -2
- package/dist/Components/CalendarMonth/CalendarMonth.vue_vue_type_script_setup_true_lang.js +19 -12
- package/dist/Components/CalendarMonth/calendarMonth.types.d.ts +14 -8
- package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +4 -7
- package/dist/Components/CalendarMonth/composables/useCalendarMonth.js +92 -89
- package/dist/Components/CalendarRange/CalendarRange.vue.d.ts +14 -6
- package/dist/Components/CalendarRange/CalendarRange.vue_vue_type_script_setup_true_lang.js +109 -105
- package/dist/Components/CalendarRange/calendarRange.types.d.ts +12 -7
- package/dist/Components/CalendarRange/composables/useCalendarRange.d.ts +5 -9
- package/dist/Components/CalendarRange/composables/useCalendarRange.js +181 -154
- package/dist/Components/CalendarYear/CalendarYear.vue.d.ts +9 -2
- package/dist/Components/CalendarYear/CalendarYear.vue_vue_type_script_setup_true_lang.js +20 -13
- package/dist/Components/CalendarYear/calendarYear.types.d.ts +12 -6
- package/dist/Components/CalendarYear/composables/useCalendarYear.d.ts +4 -7
- package/dist/Components/CalendarYear/composables/useCalendarYear.js +91 -88
- package/dist/Components/Carousel/Carousel.js +5 -0
- package/dist/Components/Carousel/Carousel.vue.d.ts +22 -0
- package/dist/Components/Carousel/Carousel.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/Components/Carousel/carousel.types.d.ts +236 -0
- package/dist/Components/Carousel/carouselInjectionKey.d.ts +48 -0
- package/dist/Components/Carousel/carouselInjectionKey.js +4 -0
- package/dist/Components/Carousel/composables/useCarousel.d.ts +91 -0
- package/dist/Components/Carousel/composables/useCarousel.js +331 -0
- package/dist/Components/Carousel/index.d.ts +4 -0
- package/dist/Components/Carousel/index.js +4 -0
- package/dist/Components/CarouselSlide/CarouselSlide.js +5 -0
- package/dist/Components/CarouselSlide/CarouselSlide.vue.d.ts +11 -0
- package/dist/Components/CarouselSlide/CarouselSlide.vue_vue_type_script_setup_true_lang.js +17 -0
- package/dist/Components/CarouselSlide/carouselSlide.types.d.ts +40 -0
- package/dist/Components/CarouselSlide/composables/useCarouselSlide.d.ts +205 -0
- package/dist/Components/CarouselSlide/composables/useCarouselSlide.js +79 -0
- package/dist/Components/CarouselSlide/index.d.ts +3 -0
- package/dist/Components/CarouselSlide/index.js +3 -0
- package/dist/Components/ColorField/ColorField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/ColorPicker/ColorPicker.vue.d.ts +9 -2
- package/dist/Components/ColorPicker/ColorPicker.vue_vue_type_script_setup_true_lang.js +48 -44
- package/dist/Components/ColorPicker/colorPicker.types.d.ts +12 -7
- package/dist/Components/ColorPicker/composables/useColorPicker.d.ts +3 -3
- package/dist/Components/ColorPicker/composables/useColorPicker.js +150 -150
- package/dist/Components/DateField/DateField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/DatePicker/DatePicker.vue.d.ts +12 -4
- package/dist/Components/DatePicker/DatePicker.vue_vue_type_script_setup_true_lang.js +55 -51
- package/dist/Components/DatePicker/composables/useDatePicker.d.ts +3 -3
- package/dist/Components/DatePicker/composables/useDatePicker.js +52 -25
- package/dist/Components/DatePicker/datePicker.types.d.ts +12 -7
- package/dist/Components/DateRangeField/DateRangeField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/DateRangePicker/DateRangePicker.vue.d.ts +12 -4
- package/dist/Components/DateRangePicker/DateRangePicker.vue_vue_type_script_setup_true_lang.js +54 -50
- package/dist/Components/DateRangePicker/composables/useDateRangePicker.d.ts +3 -3
- package/dist/Components/DateRangePicker/composables/useDateRangePicker.js +26 -26
- package/dist/Components/DateRangePicker/dateRangePicker.types.d.ts +12 -7
- package/dist/Components/DateTimeField/DateTimeField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/DateTimePicker/DateTimePicker.vue.d.ts +9 -2
- package/dist/Components/DateTimePicker/DateTimePicker.vue_vue_type_script_setup_true_lang.js +82 -78
- package/dist/Components/DateTimePicker/composables/useDateTimePicker.d.ts +3 -3
- package/dist/Components/DateTimePicker/composables/useDateTimePicker.js +64 -63
- package/dist/Components/DateTimePicker/dateTimePicker.types.d.ts +12 -7
- package/dist/Components/DateTimeRangeField/DateTimeRangeField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/DateTimeRangePicker/DateTimeRangePicker.vue.d.ts +12 -4
- package/dist/Components/DateTimeRangePicker/DateTimeRangePicker.vue_vue_type_script_setup_true_lang.js +110 -106
- package/dist/Components/DateTimeRangePicker/composables/useDateTimeRangePicker.d.ts +3 -3
- package/dist/Components/DateTimeRangePicker/composables/useDateTimeRangePicker.js +71 -70
- package/dist/Components/DateTimeRangePicker/dateTimeRangePicker.types.d.ts +12 -7
- package/dist/Components/FileUpload/FileUpload.vue.d.ts +22 -24
- package/dist/Components/FileUpload/FileUpload.vue_vue_type_script_setup_true_lang.js +101 -92
- package/dist/Components/FileUpload/composables/useFileUpload.d.ts +66 -16
- package/dist/Components/FileUpload/composables/useFileUpload.js +182 -157
- package/dist/Components/FileUpload/fileUpload.types.d.ts +113 -23
- package/dist/Components/FileUpload/fileUploadInjectionKey.d.ts +61 -0
- package/dist/Components/FileUpload/fileUploadInjectionKey.js +4 -0
- package/dist/Components/FileUpload/index.d.ts +1 -1
- package/dist/Components/FileUploadItem/FileUploadItem.js +5 -0
- package/dist/Components/FileUploadItem/FileUploadItem.vue.d.ts +12 -0
- package/dist/Components/FileUploadItem/FileUploadItem.vue_vue_type_script_setup_true_lang.js +83 -0
- package/dist/Components/FileUploadItem/composables/useFileUploadItem.d.ts +1153 -0
- package/dist/Components/FileUploadItem/composables/useFileUploadItem.js +94 -0
- package/dist/Components/FileUploadItem/fileUploadItem.types.d.ts +20 -0
- package/dist/Components/FileUploadItem/index.d.ts +3 -0
- package/dist/Components/FileUploadItem/index.js +3 -0
- package/dist/Components/Pagination/composables/usePagination.d.ts +1 -1
- package/dist/Components/Rating/Rating.js +5 -0
- package/dist/Components/Rating/Rating.vue.d.ts +20 -0
- package/dist/Components/Rating/Rating.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/Components/Rating/composables/useRating.d.ts +112 -0
- package/dist/Components/Rating/composables/useRating.js +190 -0
- package/dist/Components/Rating/index.d.ts +4 -0
- package/dist/Components/Rating/index.js +3 -0
- package/dist/Components/Rating/rating.types.d.ts +107 -0
- package/dist/Components/Sidebar/composables/useSidebar.js +1 -1
- package/dist/Components/Sidebar/composables/useSidebarTrigger.d.ts +1 -1
- package/dist/Components/Slider/composables/useSlider.d.ts +1 -1
- package/dist/Components/TimeField/TimeField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/TimePanel/TimePanel.vue.d.ts +10 -2
- package/dist/Components/TimePanel/TimePanel.vue_vue_type_script_setup_true_lang.js +37 -34
- package/dist/Components/TimePanel/composables/useTimePanel.d.ts +5 -5
- package/dist/Components/TimePanel/composables/useTimePanel.js +108 -109
- package/dist/Components/TimePanel/timePanel.types.d.ts +10 -4
- package/dist/Components/TimePicker/TimePicker.vue.d.ts +10 -2
- package/dist/Components/TimePicker/TimePicker.vue_vue_type_script_setup_true_lang.js +46 -42
- package/dist/Components/TimePicker/composables/useTimePicker.d.ts +3 -3
- package/dist/Components/TimePicker/composables/useTimePicker.js +36 -36
- package/dist/Components/TimePicker/timePicker.types.d.ts +12 -7
- package/dist/Components/TimeRangeField/TimeRangeField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/TimeRangePicker/TimeRangePicker.vue.d.ts +12 -4
- package/dist/Components/TimeRangePicker/TimeRangePicker.vue_vue_type_script_setup_true_lang.js +72 -68
- package/dist/Components/TimeRangePicker/composables/useTimeRangePicker.d.ts +4 -4
- package/dist/Components/TimeRangePicker/composables/useTimeRangePicker.js +87 -87
- package/dist/Components/TimeRangePicker/timeRangePicker.types.d.ts +12 -7
- package/dist/augments.d.ts +10 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +117 -109
- package/docs/README.md +2 -0
- package/docs/components/BaseField.md +3 -3
- package/docs/components/Calendar.md +0 -1
- package/docs/components/CalendarDate.md +0 -1
- package/docs/components/CalendarMonth.md +0 -1
- package/docs/components/CalendarRange.md +0 -1
- package/docs/components/CalendarYear.md +0 -1
- package/docs/components/Carousel.md +113 -0
- package/docs/components/ColorPicker.md +13 -14
- package/docs/components/DatePicker.md +0 -1
- package/docs/components/DateRangePicker.md +0 -1
- package/docs/components/DateTimePicker.md +0 -1
- package/docs/components/DateTimeRangePicker.md +0 -1
- package/docs/components/FileUpload.md +83 -8
- package/docs/components/Rating.md +86 -0
- package/docs/components/RichTextEditor.md +3 -3
- package/docs/components/TimePanel.md +0 -1
- package/docs/components/TimePicker.md +0 -1
- package/docs/components/TimeRangePicker.md +0 -1
- package/package.json +2 -12
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ComputedRef, HTMLAttributes, InjectionKey } from 'vue';
|
|
2
|
+
import { CarouselSizeItem } from '@bridge-ui/core/Tokens';
|
|
3
|
+
/**
|
|
4
|
+
* Shared carousel state for `CarouselSlide` descendants.
|
|
5
|
+
*/
|
|
6
|
+
export type CarouselContextValue = {
|
|
7
|
+
/**
|
|
8
|
+
* Bound 0-based active index.
|
|
9
|
+
*/
|
|
10
|
+
activeIndex: number;
|
|
11
|
+
/**
|
|
12
|
+
* Resolves a registered slide's 0-based index.
|
|
13
|
+
*/
|
|
14
|
+
getIndex: (id: string) => number;
|
|
15
|
+
/**
|
|
16
|
+
* Stable id prefix for slide elements.
|
|
17
|
+
*/
|
|
18
|
+
id: string;
|
|
19
|
+
/**
|
|
20
|
+
* Registers a slide id and returns unregister.
|
|
21
|
+
*/
|
|
22
|
+
registerSlide: (id: string) => () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Size class map.
|
|
25
|
+
*/
|
|
26
|
+
sizeItem: undefined | CarouselSizeItem;
|
|
27
|
+
/**
|
|
28
|
+
* Classes from the carousel `classes.slide` part.
|
|
29
|
+
*/
|
|
30
|
+
slideClassName: string;
|
|
31
|
+
/**
|
|
32
|
+
* Number of registered slides.
|
|
33
|
+
*/
|
|
34
|
+
slideCount: number;
|
|
35
|
+
/**
|
|
36
|
+
* Props forwarded from `customProps.slide`.
|
|
37
|
+
*/
|
|
38
|
+
slidePartProps: undefined | HTMLAttributes;
|
|
39
|
+
/**
|
|
40
|
+
* How many slides fit in the viewport.
|
|
41
|
+
*/
|
|
42
|
+
slidesPerView: number;
|
|
43
|
+
/**
|
|
44
|
+
* Inline size for each slide (basis and gap padding).
|
|
45
|
+
*/
|
|
46
|
+
slideStyle: Record<string, string>;
|
|
47
|
+
};
|
|
48
|
+
export declare const CAROUSEL_INJECTION_KEY: InjectionKey<ComputedRef<CarouselContextValue>>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { IconSize } from '@bridge-ui/core/Tokens';
|
|
3
|
+
import { LibDefaultsShape } from '@bridge-ui/core/Utils';
|
|
4
|
+
import { CarouselOwnProps, CarouselProps } from '../carousel.types';
|
|
5
|
+
type CarouselLibDefaults = LibDefaultsShape<CarouselOwnProps, "gap" | "loop" | "size" | "autoPlay" | "indicators" | "orientation" | "defaultIndex" | "slidesPerView">;
|
|
6
|
+
export declare function useCarousel(props: CarouselOwnProps, libDefaults: CarouselLibDefaults, model: Ref<number | undefined>): {
|
|
7
|
+
go: (direction: 1 | -1) => void;
|
|
8
|
+
liveBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
9
|
+
"aria-atomic": boolean;
|
|
10
|
+
"data-part": string;
|
|
11
|
+
"aria-live": "polite";
|
|
12
|
+
class: string;
|
|
13
|
+
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
14
|
+
nextBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
15
|
+
"data-part": string;
|
|
16
|
+
type: "button";
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
"aria-label": string;
|
|
19
|
+
onClick: () => void;
|
|
20
|
+
class: string;
|
|
21
|
+
}, "class", import('vue').ButtonHTMLAttributes | undefined, {}>>;
|
|
22
|
+
nextIcon: import('vue').ComputedRef<"chevronDown" | "chevronRight">;
|
|
23
|
+
prevBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
24
|
+
"data-part": string;
|
|
25
|
+
type: "button";
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
onClick: () => void;
|
|
28
|
+
"aria-label": string;
|
|
29
|
+
class: string;
|
|
30
|
+
}, "class", import('vue').ButtonHTMLAttributes | undefined, {}>>;
|
|
31
|
+
prevIcon: import('vue').ComputedRef<"chevronUp" | "chevronLeft">;
|
|
32
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
33
|
+
role: string;
|
|
34
|
+
"aria-roledescription": string;
|
|
35
|
+
"data-orientation": NonNullable<import('@bridge-ui/core/Domain').CarouselOrientation | undefined>;
|
|
36
|
+
onFocus: (event: FocusEvent) => void;
|
|
37
|
+
onMouseenter: (event: MouseEvent) => void;
|
|
38
|
+
onMouseleave: (event: MouseEvent) => void;
|
|
39
|
+
"aria-label": string;
|
|
40
|
+
class: string;
|
|
41
|
+
onBlur: (event: FocusEvent) => void;
|
|
42
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
43
|
+
}, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<CarouselProps, "orientation" | "size" | "classes" | "customProps" | "autoPlay" | "defaultIndex" | "gap" | "indicators" | "loop" | "slidesPerView">, "onFocus" | "onBlur" | "onKeydown" | "onMouseenter" | "onMouseleave">>>;
|
|
44
|
+
trackBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
45
|
+
"data-part": string;
|
|
46
|
+
class: string;
|
|
47
|
+
style: Record<string, string>;
|
|
48
|
+
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
49
|
+
activeIndex: import('vue').ComputedRef<number>;
|
|
50
|
+
controlsBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
51
|
+
"data-part": string;
|
|
52
|
+
class: string;
|
|
53
|
+
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
54
|
+
nextIconBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
55
|
+
"aria-hidden": boolean;
|
|
56
|
+
size: keyof IconSize;
|
|
57
|
+
class: string | undefined;
|
|
58
|
+
}, "class", Partial<Omit<import('../../Icon').IconProps, "icon">> | undefined, {}>>;
|
|
59
|
+
prevIconBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
60
|
+
"aria-hidden": boolean;
|
|
61
|
+
size: keyof IconSize;
|
|
62
|
+
class: string | undefined;
|
|
63
|
+
}, "class", Partial<Omit<import('../../Icon').IconProps, "icon">> | undefined, {}>>;
|
|
64
|
+
showControls: import('vue').ComputedRef<boolean>;
|
|
65
|
+
viewportBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
66
|
+
"data-part": string;
|
|
67
|
+
onPointercancel: (event: PointerEvent) => void;
|
|
68
|
+
class: string;
|
|
69
|
+
onPointerdown: (event: PointerEvent) => void;
|
|
70
|
+
onPointerup: (event: PointerEvent) => void;
|
|
71
|
+
}, "class", Omit<import('vue').HTMLAttributes, "onPointerdown" | "onPointerup" | "onPointercancel">, {}>>;
|
|
72
|
+
announcement: Ref<string, string>;
|
|
73
|
+
frameClassName: import('vue').ComputedRef<string>;
|
|
74
|
+
indicatorsBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
75
|
+
role: string;
|
|
76
|
+
"data-part": string;
|
|
77
|
+
"aria-label": string;
|
|
78
|
+
class: string;
|
|
79
|
+
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
80
|
+
showIndicators: import('vue').ComputedRef<boolean>;
|
|
81
|
+
getIndicatorBind: (index: number) => import('@bridge-ui/core/Utils').MergePartBind<{
|
|
82
|
+
type: "button";
|
|
83
|
+
"data-part": string;
|
|
84
|
+
"aria-current": "true" | undefined;
|
|
85
|
+
onClick: () => void;
|
|
86
|
+
"aria-label": string;
|
|
87
|
+
class: string;
|
|
88
|
+
}, "class", import('vue').ButtonHTMLAttributes | undefined, {}>;
|
|
89
|
+
indicatorIndexes: import('vue').ComputedRef<number[]>;
|
|
90
|
+
};
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { useResolveMessage as e } from "../../../Adapters/I18n/useI18nAdapter.js";
|
|
2
|
+
import { mergePartBind as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as r } from "../../../Utils/index.js";
|
|
3
|
+
import { CAROUSEL_INJECTION_KEY as i } from "../carouselInjectionKey.js";
|
|
4
|
+
import { computed as a, onMounted as o, onScopeDispose as s, provide as c, ref as l, useAttrs as ee, useId as te, watch as u } from "vue";
|
|
5
|
+
import { get as d, isFunction as f, omit as p } from "es-toolkit/compat";
|
|
6
|
+
import { canMoveCarousel as m, clampCarouselIndex as h, getAdjacentCarouselIndex as g, getCarouselMaxIndex as _, getCarouselSlideStyle as v, getCarouselTrackStyle as y, resolveCarouselAutoPlayInterval as b, resolveCarouselSwipeDirection as ne, shouldPauseCarouselAutoPlay as re } from "@bridge-ui/core/Domain";
|
|
7
|
+
import { carouselSizeProps as ie } from "@bridge-ui/core/Tokens";
|
|
8
|
+
import { cn as x, mergeBridgeUILayeredClasses as ae, splitComponentProps as oe } from "@bridge-ui/core/Utils";
|
|
9
|
+
//#region src/Components/Carousel/composables/useCarousel.ts
|
|
10
|
+
var se = [
|
|
11
|
+
"gap",
|
|
12
|
+
"loop",
|
|
13
|
+
"size",
|
|
14
|
+
"classes",
|
|
15
|
+
"autoPlay",
|
|
16
|
+
"indicators",
|
|
17
|
+
"customProps",
|
|
18
|
+
"orientation",
|
|
19
|
+
"defaultIndex",
|
|
20
|
+
"slidesPerView"
|
|
21
|
+
], ce = [
|
|
22
|
+
"onBlur",
|
|
23
|
+
"onFocus",
|
|
24
|
+
"onKeydown",
|
|
25
|
+
"onMouseenter",
|
|
26
|
+
"onMouseleave"
|
|
27
|
+
], le = [
|
|
28
|
+
"onPointerup",
|
|
29
|
+
"onPointerdown",
|
|
30
|
+
"onPointercancel"
|
|
31
|
+
];
|
|
32
|
+
function S(e) {
|
|
33
|
+
if (!(e instanceof HTMLElement)) return !1;
|
|
34
|
+
if (e.isContentEditable) return !0;
|
|
35
|
+
let t = e.tagName;
|
|
36
|
+
return t === "INPUT" || t === "SELECT" || t === "TEXTAREA";
|
|
37
|
+
}
|
|
38
|
+
function C(e) {
|
|
39
|
+
return f(e) ? e : void 0;
|
|
40
|
+
}
|
|
41
|
+
function w(w, T, E) {
|
|
42
|
+
let D = e(), ue = ee(), de = `bridge-carousel${te()}`, O = l([]), k = l(w.defaultIndex ?? T.defaultIndex ?? 0), A = l(!1), j = l(!1), M = l(!1), N = l(""), P = l(null), F = l(null), I = a(() => oe({
|
|
43
|
+
props: {
|
|
44
|
+
...ue,
|
|
45
|
+
...w
|
|
46
|
+
},
|
|
47
|
+
bridgeKeys: se
|
|
48
|
+
})), { merged: L, entry: R } = n({
|
|
49
|
+
libDefaults: T,
|
|
50
|
+
componentName: "Carousel",
|
|
51
|
+
props: () => I.value.componentProps
|
|
52
|
+
}), z = a(() => {
|
|
53
|
+
let e = E.value ?? k.value, t = O.value.length;
|
|
54
|
+
if (t <= 0) return e;
|
|
55
|
+
let n = _(t, L.value.slidesPerView);
|
|
56
|
+
return h(e, n + 1);
|
|
57
|
+
}), B = r({
|
|
58
|
+
entry: R,
|
|
59
|
+
props: () => I.value.componentProps
|
|
60
|
+
}), V = a(() => ae(ie, R.value?.tokens?.size)), H = a(() => d(V.value, L.value.size)), U = a(() => d(H.value, "icon") ?? "sm");
|
|
61
|
+
function fe(e) {
|
|
62
|
+
return O.value.includes(e) || (O.value = [...O.value, e]), () => {
|
|
63
|
+
O.value = O.value.filter((t) => t !== e);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function pe(e) {
|
|
67
|
+
return O.value.indexOf(e);
|
|
68
|
+
}
|
|
69
|
+
function W(e) {
|
|
70
|
+
let t = O.value.length, n = t <= 0 ? null : _(t, L.value.slidesPerView), r = n == null ? e : h(e, n + 1);
|
|
71
|
+
r !== z.value && (E.value === void 0 && (k.value = r), E.value = r);
|
|
72
|
+
}
|
|
73
|
+
function G(e) {
|
|
74
|
+
let t = O.value.length, n = {
|
|
75
|
+
loop: L.value.loop === !0,
|
|
76
|
+
count: t,
|
|
77
|
+
direction: e,
|
|
78
|
+
slidesPerView: L.value.slidesPerView,
|
|
79
|
+
index: z.value
|
|
80
|
+
};
|
|
81
|
+
m(n) && W(g(n));
|
|
82
|
+
}
|
|
83
|
+
function K(e) {
|
|
84
|
+
W(e);
|
|
85
|
+
}
|
|
86
|
+
u(() => ({
|
|
87
|
+
count: O.value.length,
|
|
88
|
+
slidesPerView: L.value.slidesPerView
|
|
89
|
+
}), ({ count: e }) => {
|
|
90
|
+
e <= 0 || E.value !== void 0 || (k.value = h(k.value, _(e, L.value.slidesPerView) + 1));
|
|
91
|
+
}), P.value = z.value, u(z, (e) => {
|
|
92
|
+
if (e === P.value) return;
|
|
93
|
+
P.value = e;
|
|
94
|
+
let t = O.value.length;
|
|
95
|
+
t <= 0 || (N.value = D("Slide {{index}} of {{count}}", {
|
|
96
|
+
count: t,
|
|
97
|
+
index: e + 1
|
|
98
|
+
}));
|
|
99
|
+
}), o(() => {
|
|
100
|
+
if (!f(window.matchMedia)) return;
|
|
101
|
+
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = () => {
|
|
102
|
+
M.value = e.matches;
|
|
103
|
+
};
|
|
104
|
+
t(), e.addEventListener("change", t), s(() => {
|
|
105
|
+
e.removeEventListener("change", t);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
let q;
|
|
109
|
+
function J() {
|
|
110
|
+
q !== void 0 && (window.clearInterval(q), q = void 0);
|
|
111
|
+
}
|
|
112
|
+
u(() => [
|
|
113
|
+
A.value,
|
|
114
|
+
j.value,
|
|
115
|
+
L.value.loop,
|
|
116
|
+
L.value.autoPlay,
|
|
117
|
+
M.value,
|
|
118
|
+
O.value.length
|
|
119
|
+
], () => {
|
|
120
|
+
J();
|
|
121
|
+
let e = b(L.value.autoPlay);
|
|
122
|
+
e == null || re({
|
|
123
|
+
focused: j.value,
|
|
124
|
+
hovered: A.value,
|
|
125
|
+
reducedMotion: M.value
|
|
126
|
+
}) || (q = window.setInterval(() => {
|
|
127
|
+
G(1);
|
|
128
|
+
}, e));
|
|
129
|
+
}, { immediate: !0 }), s(J);
|
|
130
|
+
let Y = a(() => {
|
|
131
|
+
let e = O.value.length;
|
|
132
|
+
return e <= 0 ? 0 : _(e, L.value.slidesPerView) + 1;
|
|
133
|
+
}), X = a(() => Y.value > 1), me = a(() => L.value.indicators !== !1 && Y.value > 1), Z = a(() => L.value.orientation === "vertical"), Q = a(() => !Z.value && I.value.inheritedAttrs.dir === "rtl"), he = a(() => Z.value ? "ArrowUp" : Q.value ? "ArrowRight" : "ArrowLeft"), ge = a(() => Z.value ? "ArrowDown" : Q.value ? "ArrowLeft" : "ArrowRight"), _e = a(() => !m({
|
|
134
|
+
direction: -1,
|
|
135
|
+
index: z.value,
|
|
136
|
+
count: O.value.length,
|
|
137
|
+
loop: L.value.loop === !0,
|
|
138
|
+
slidesPerView: L.value.slidesPerView
|
|
139
|
+
})), ve = a(() => !m({
|
|
140
|
+
direction: 1,
|
|
141
|
+
index: z.value,
|
|
142
|
+
count: O.value.length,
|
|
143
|
+
loop: L.value.loop === !0,
|
|
144
|
+
slidesPerView: L.value.slidesPerView
|
|
145
|
+
})), ye = a(() => Array.from({ length: Y.value }, (e, t) => t)), be = a(() => ({
|
|
146
|
+
getIndex: pe,
|
|
147
|
+
registerSlide: fe,
|
|
148
|
+
id: de,
|
|
149
|
+
sizeItem: H.value,
|
|
150
|
+
activeIndex: z.value,
|
|
151
|
+
slideCount: O.value.length,
|
|
152
|
+
slidesPerView: L.value.slidesPerView,
|
|
153
|
+
slidePartProps: L.value.customProps?.slide,
|
|
154
|
+
slideClassName: d(B.value, "slide") ?? "",
|
|
155
|
+
slideStyle: v(L.value.slidesPerView, L.value.gap, L.value.orientation)
|
|
156
|
+
}));
|
|
157
|
+
c(i, be);
|
|
158
|
+
let xe = a(() => {
|
|
159
|
+
let e = C(I.value.inheritedAttrs.onBlur), n = C(I.value.inheritedAttrs.onFocus), r = C(I.value.inheritedAttrs.onKeydown), i = C(I.value.inheritedAttrs.onMouseenter), a = C(I.value.inheritedAttrs.onMouseleave), o = p(I.value.inheritedAttrs, [...ce]);
|
|
160
|
+
return t(L.value.customProps?.root, o, {
|
|
161
|
+
role: "region",
|
|
162
|
+
"aria-roledescription": "carousel",
|
|
163
|
+
"data-orientation": L.value.orientation,
|
|
164
|
+
onFocus: (e) => {
|
|
165
|
+
j.value = !0, n?.(e);
|
|
166
|
+
},
|
|
167
|
+
onMouseenter: (e) => {
|
|
168
|
+
A.value = !0, i?.(e);
|
|
169
|
+
},
|
|
170
|
+
onMouseleave: (e) => {
|
|
171
|
+
A.value = !1, a?.(e);
|
|
172
|
+
},
|
|
173
|
+
"aria-label": I.value.inheritedAttrs["aria-label"] ?? D("Carousel"),
|
|
174
|
+
class: x({
|
|
175
|
+
[d(H.value, "root") ?? ""]: !0,
|
|
176
|
+
[d(B.value, "root") ?? ""]: !0
|
|
177
|
+
}),
|
|
178
|
+
onBlur: (t) => {
|
|
179
|
+
let n = t.relatedTarget, r = t.currentTarget;
|
|
180
|
+
(!(n instanceof Node) || !(r instanceof Node) || !r.contains(n)) && (j.value = !1), e?.(t);
|
|
181
|
+
},
|
|
182
|
+
onKeydown: (e) => {
|
|
183
|
+
S(e.target) || (e.key === ge.value ? (e.preventDefault(), G(1)) : e.key === he.value ? (e.preventDefault(), G(-1)) : e.key === "Home" ? (e.preventDefault(), K(0)) : e.key === "End" && (e.preventDefault(), K(_(O.value.length, L.value.slidesPerView)))), r?.(e);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}), Se = a(() => {
|
|
187
|
+
let e = L.value.customProps?.viewport, n = C(e?.onPointerup), r = C(e?.onPointerdown), i = C(e?.onPointercancel);
|
|
188
|
+
return t(p(e, [...le]), {}, {
|
|
189
|
+
"data-part": "viewport",
|
|
190
|
+
onPointercancel: (e) => {
|
|
191
|
+
F.value = null, i?.(e);
|
|
192
|
+
},
|
|
193
|
+
class: x({
|
|
194
|
+
[d(H.value, "viewport") ?? ""]: !0,
|
|
195
|
+
[d(B.value, "viewport") ?? ""]: !0,
|
|
196
|
+
[d(H.value, "viewportVertical") ?? ""]: Z.value
|
|
197
|
+
}),
|
|
198
|
+
onPointerdown: (e) => {
|
|
199
|
+
(e.pointerType !== "mouse" || e.button === 0) && (F.value = {
|
|
200
|
+
x: e.clientX,
|
|
201
|
+
y: e.clientY,
|
|
202
|
+
pointerId: e.pointerId
|
|
203
|
+
}), r?.(e);
|
|
204
|
+
},
|
|
205
|
+
onPointerup: (e) => {
|
|
206
|
+
let t = F.value;
|
|
207
|
+
if (F.value = null, t && t.pointerId === e.pointerId) {
|
|
208
|
+
let n = ne(e.clientX - t.x, e.clientY - t.y, {
|
|
209
|
+
rtl: Q.value,
|
|
210
|
+
orientation: L.value.orientation
|
|
211
|
+
});
|
|
212
|
+
n && G(n);
|
|
213
|
+
}
|
|
214
|
+
n?.(e);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}), $ = a(() => t(L.value.customProps?.track, {}, {
|
|
218
|
+
"data-part": "track",
|
|
219
|
+
class: x({
|
|
220
|
+
[d(H.value, "track") ?? ""]: !0,
|
|
221
|
+
[d(B.value, "track") ?? ""]: !0,
|
|
222
|
+
[d(H.value, "trackVertical") ?? ""]: Z.value
|
|
223
|
+
}),
|
|
224
|
+
style: y(z.value, {
|
|
225
|
+
rtl: Q.value,
|
|
226
|
+
gap: L.value.gap,
|
|
227
|
+
count: O.value.length,
|
|
228
|
+
orientation: L.value.orientation,
|
|
229
|
+
slidesPerView: L.value.slidesPerView
|
|
230
|
+
})
|
|
231
|
+
})), Ce = a(() => t(L.value.customProps?.controls, {}, {
|
|
232
|
+
"data-part": "controls",
|
|
233
|
+
class: x({
|
|
234
|
+
[d(H.value, "controls") ?? ""]: !0,
|
|
235
|
+
[d(B.value, "controls") ?? ""]: !0,
|
|
236
|
+
[d(H.value, "controlsVertical") ?? ""]: Z.value
|
|
237
|
+
})
|
|
238
|
+
})), we = a(() => X.value ? Z.value ? d(H.value, "frameVertical") ?? "relative" : d(H.value, "frame") ?? "relative" : "relative"), Te = a(() => t(L.value.customProps?.prev, {}, {
|
|
239
|
+
"data-part": "prev",
|
|
240
|
+
type: "button",
|
|
241
|
+
disabled: _e.value,
|
|
242
|
+
onClick: () => {
|
|
243
|
+
G(-1);
|
|
244
|
+
},
|
|
245
|
+
"aria-label": D("Previous slide"),
|
|
246
|
+
class: x({
|
|
247
|
+
[d(H.value, "control") ?? ""]: !0,
|
|
248
|
+
[d(B.value, "prev") ?? ""]: !0,
|
|
249
|
+
[d(B.value, "control") ?? ""]: !0
|
|
250
|
+
})
|
|
251
|
+
})), Ee = a(() => t(L.value.customProps?.next, {}, {
|
|
252
|
+
"data-part": "next",
|
|
253
|
+
type: "button",
|
|
254
|
+
disabled: ve.value,
|
|
255
|
+
"aria-label": D("Next slide"),
|
|
256
|
+
onClick: () => {
|
|
257
|
+
G(1);
|
|
258
|
+
},
|
|
259
|
+
class: x({
|
|
260
|
+
[d(H.value, "control") ?? ""]: !0,
|
|
261
|
+
[d(B.value, "next") ?? ""]: !0,
|
|
262
|
+
[d(B.value, "control") ?? ""]: !0
|
|
263
|
+
})
|
|
264
|
+
})), De = a(() => t(L.value.customProps?.prevIcon, {}, {
|
|
265
|
+
"aria-hidden": !0,
|
|
266
|
+
size: U.value,
|
|
267
|
+
class: Z.value ? void 0 : "rtl:rotate-180"
|
|
268
|
+
})), Oe = a(() => t(L.value.customProps?.nextIcon, {}, {
|
|
269
|
+
"aria-hidden": !0,
|
|
270
|
+
size: U.value,
|
|
271
|
+
class: Z.value ? void 0 : "rtl:rotate-180"
|
|
272
|
+
})), ke = a(() => t(L.value.customProps?.indicators, {}, {
|
|
273
|
+
role: "group",
|
|
274
|
+
"data-part": "indicators",
|
|
275
|
+
"aria-label": D("Slides"),
|
|
276
|
+
class: x({
|
|
277
|
+
[d(H.value, "indicators") ?? ""]: !0,
|
|
278
|
+
[d(B.value, "indicators") ?? ""]: !0
|
|
279
|
+
})
|
|
280
|
+
})), Ae = a(() => t(L.value.customProps?.live, {}, {
|
|
281
|
+
"aria-atomic": !0,
|
|
282
|
+
"data-part": "live",
|
|
283
|
+
"aria-live": "polite",
|
|
284
|
+
class: x({
|
|
285
|
+
[d(H.value, "live") ?? ""]: !0,
|
|
286
|
+
[d(B.value, "live") ?? ""]: !0
|
|
287
|
+
})
|
|
288
|
+
}));
|
|
289
|
+
function je(e) {
|
|
290
|
+
let n = e === z.value;
|
|
291
|
+
return t(L.value.customProps?.indicator, {}, {
|
|
292
|
+
type: "button",
|
|
293
|
+
"data-part": "indicator",
|
|
294
|
+
"aria-current": n ? "true" : void 0,
|
|
295
|
+
onClick: () => {
|
|
296
|
+
K(e);
|
|
297
|
+
},
|
|
298
|
+
"aria-label": D("Go to slide {{index}}", { index: e + 1 }),
|
|
299
|
+
class: x({
|
|
300
|
+
[d(H.value, "indicator") ?? ""]: !0,
|
|
301
|
+
[d(H.value, "indicatorSelected") ?? ""]: n,
|
|
302
|
+
[d(B.value, "indicator") ?? ""]: !0
|
|
303
|
+
})
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
let Me = a(() => Z.value ? "chevronUp" : "chevronLeft");
|
|
307
|
+
return {
|
|
308
|
+
go: G,
|
|
309
|
+
liveBind: Ae,
|
|
310
|
+
nextBind: Ee,
|
|
311
|
+
nextIcon: a(() => Z.value ? "chevronDown" : "chevronRight"),
|
|
312
|
+
prevBind: Te,
|
|
313
|
+
prevIcon: Me,
|
|
314
|
+
rootBind: xe,
|
|
315
|
+
trackBind: $,
|
|
316
|
+
activeIndex: z,
|
|
317
|
+
controlsBind: Ce,
|
|
318
|
+
nextIconBind: Oe,
|
|
319
|
+
prevIconBind: De,
|
|
320
|
+
showControls: X,
|
|
321
|
+
viewportBind: Se,
|
|
322
|
+
announcement: N,
|
|
323
|
+
frameClassName: we,
|
|
324
|
+
indicatorsBind: ke,
|
|
325
|
+
showIndicators: me,
|
|
326
|
+
getIndicatorBind: je,
|
|
327
|
+
indicatorIndexes: ye
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
//#endregion
|
|
331
|
+
export { w as useCarousel };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { CarouselClasses, CarouselCustomProps, CarouselEmits, CarouselIndicatorState, CarouselOwnProps, CarouselProps, CarouselSizeOverrides, CarouselSlots, } from './carousel.types';
|
|
2
|
+
export { default as Carousel } from './Carousel.vue';
|
|
3
|
+
export { CAROUSEL_INJECTION_KEY, type CarouselContextValue, } from './carouselInjectionKey';
|
|
4
|
+
export { useCarousel } from './composables/useCarousel';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CarouselSlideOwnProps, CarouselSlideSlots } from './carouselSlide.types';
|
|
2
|
+
type __VLS_Slots = CarouselSlideSlots;
|
|
3
|
+
declare const __VLS_base: import('vue').DefineComponent<CarouselSlideOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CarouselSlideOwnProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
4
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
7
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
8
|
+
new (): {
|
|
9
|
+
$slots: S;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useCarouselSlide as e } from "./composables/useCarouselSlide.js";
|
|
2
|
+
import { createElementBlock as t, defineComponent as n, guardReactiveProps as r, normalizeProps as i, openBlock as a, renderSlot as o, unref as s } from "vue";
|
|
3
|
+
//#region src/Components/CarouselSlide/CarouselSlide.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var c = /*@__PURE__*/ n({
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "CarouselSlide",
|
|
7
|
+
props: {
|
|
8
|
+
classes: {},
|
|
9
|
+
customProps: {}
|
|
10
|
+
},
|
|
11
|
+
setup(n) {
|
|
12
|
+
let { rootBind: c } = e(n);
|
|
13
|
+
return (e, n) => (a(), t("div", i(r(s(c))), [o(e.$slots, "default")], 16));
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
export { c as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { HTMLAttributes, Slot } from 'vue';
|
|
2
|
+
import { MergeHtmlProps } from '@bridge-ui/core/Utils';
|
|
3
|
+
export interface CarouselSlideClasses {
|
|
4
|
+
/**
|
|
5
|
+
* Classes merged onto the slide root.
|
|
6
|
+
*/
|
|
7
|
+
root?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CarouselSlideCustomProps {
|
|
10
|
+
/**
|
|
11
|
+
* Props forwarded to the slide root.
|
|
12
|
+
*
|
|
13
|
+
* @default undefined
|
|
14
|
+
*/
|
|
15
|
+
root?: HTMLAttributes;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* One slide inside `Carousel`.
|
|
19
|
+
*/
|
|
20
|
+
export interface CarouselSlideOwnProps {
|
|
21
|
+
/**
|
|
22
|
+
* Classes for the slide.
|
|
23
|
+
*
|
|
24
|
+
* @default undefined
|
|
25
|
+
*/
|
|
26
|
+
classes?: CarouselSlideClasses;
|
|
27
|
+
/**
|
|
28
|
+
* Extra props for the slide root.
|
|
29
|
+
*
|
|
30
|
+
* @default undefined
|
|
31
|
+
*/
|
|
32
|
+
customProps?: CarouselSlideCustomProps;
|
|
33
|
+
}
|
|
34
|
+
export interface CarouselSlideSlots {
|
|
35
|
+
/**
|
|
36
|
+
* Slide content.
|
|
37
|
+
*/
|
|
38
|
+
default?: Slot<undefined>;
|
|
39
|
+
}
|
|
40
|
+
export type CarouselSlideProps = MergeHtmlProps<CarouselSlideOwnProps, HTMLAttributes>;
|