@bridge-ui/vue 0.11.0 → 0.13.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/dist/Adapters/Examples/date-moment.js +31 -31
- package/dist/Adapters/Examples/i18n-dictionary.js +14 -0
- package/dist/Adapters/Examples/icon-fontawesome.js +53 -40
- package/dist/Adapters/Examples/icon-heroicons.js +46 -33
- package/dist/Adapters/Examples/icon-lucide.js +47 -34
- package/dist/Adapters/Examples/icon-phosphor.js +48 -35
- package/dist/Adapters/Examples/icon-tabler.js +45 -32
- package/dist/Adapters/Examples/rich-text-tiptap.d.ts +5 -0
- package/dist/Adapters/Examples/rich-text-tiptap.js +138 -0
- package/dist/Adapters/RichText/index.d.ts +1 -0
- package/dist/Adapters/RichText/index.js +2 -0
- package/dist/Adapters/RichText/mockRichTextAdapter.d.ts +5 -0
- package/dist/Adapters/RichText/useRichTextAdapter.d.ts +12 -0
- package/dist/Adapters/RichText/useRichTextAdapter.js +13 -0
- package/dist/Adapters/index.d.ts +1 -0
- package/dist/Adapters/index.js +2 -1
- package/dist/Components/ActionFooter/composables/useActionFooter.d.ts +6 -6
- package/dist/Components/Autocomplete/composables/useAutocomplete.js +2 -2
- package/dist/Components/BaseField/composables/useBaseField.d.ts +3 -3
- package/dist/Components/BaseField/composables/useBaseField.js +7 -7
- package/dist/Components/Breadcrumb/Breadcrumb.vue.d.ts +17 -10
- package/dist/Components/Breadcrumb/Breadcrumb.vue_vue_type_script_setup_true_lang.js +7 -2
- package/dist/Components/Breadcrumb/breadcrumb.types.d.ts +22 -4
- package/dist/Components/Breadcrumb/breadcrumbInjectionKey.d.ts +5 -1
- package/dist/Components/Breadcrumb/composables/useBreadcrumb.d.ts +6 -5
- package/dist/Components/Breadcrumb/composables/useBreadcrumb.js +2 -0
- package/dist/Components/BreadcrumbItem/BreadcrumbItem.vue.d.ts +17 -11
- package/dist/Components/BreadcrumbItem/BreadcrumbItem.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/Components/BreadcrumbItem/breadcrumbItem.types.d.ts +21 -3
- package/dist/Components/BreadcrumbItem/composables/useBreadcrumbItem.d.ts +10 -6
- package/dist/Components/BreadcrumbItem/composables/useBreadcrumbItem.js +65 -59
- package/dist/Components/Button/Button.vue.d.ts +17 -8
- package/dist/Components/Button/Button.vue_vue_type_script_setup_true_lang.js +10 -10
- package/dist/Components/Button/button.types.d.ts +22 -5
- package/dist/Components/Button/composables/useButton.d.ts +198 -8
- package/dist/Components/Button/composables/useButton.js +101 -86
- package/dist/Components/Calendar/Calendar.vue_vue_type_script_setup_true_lang.js +8 -8
- 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/ColorPicker/composables/useColorPicker.js +1 -1
- package/dist/Components/DataTable/DataTable.vue.d.ts +1 -1
- package/dist/Components/DataTable/composables/useDataTable.d.ts +1 -1
- package/dist/Components/DataTable/composables/useDataTable.js +288 -282
- package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -1
- package/dist/Components/Drawer/composables/useDrawer.js +2 -2
- package/dist/Components/FileUpload/FileUpload.js +5 -0
- package/dist/Components/FileUpload/FileUpload.vue.d.ts +26 -0
- package/dist/Components/FileUpload/FileUpload.vue_vue_type_script_setup_true_lang.js +141 -0
- package/dist/Components/FileUpload/composables/useFileUpload.d.ts +120 -0
- package/dist/Components/FileUpload/composables/useFileUpload.js +235 -0
- package/dist/Components/FileUpload/fileUpload.types.d.ts +396 -0
- package/dist/Components/FileUpload/fileUploadInjectionKey.d.ts +61 -0
- package/dist/Components/FileUpload/fileUploadInjectionKey.js +4 -0
- package/dist/Components/FileUpload/index.d.ts +3 -0
- package/dist/Components/FileUpload/index.js +3 -0
- 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/FormField/composables/useFormField.d.ts +1 -1
- package/dist/Components/Link/Link.vue.d.ts +17 -8
- package/dist/Components/Link/Link.vue_vue_type_script_setup_true_lang.js +30 -25
- package/dist/Components/Link/composables/useLink.d.ts +8 -6
- package/dist/Components/Link/composables/useLink.js +52 -45
- package/dist/Components/Link/link.types.d.ts +21 -4
- package/dist/Components/ListItem/ListItem.vue.d.ts +17 -15
- package/dist/Components/ListItem/ListItem.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/Components/ListItem/composables/useListItem.d.ts +7 -6
- package/dist/Components/ListItem/composables/useListItem.js +108 -105
- package/dist/Components/ListItem/listItem.types.d.ts +19 -3
- package/dist/Components/Listbox/composables/useListbox.d.ts +2 -2
- package/dist/Components/Menu/composables/useMenu.js +6 -6
- package/dist/Components/Modal/composables/useModal.d.ts +1 -1
- package/dist/Components/Modal/composables/useModal.js +2 -2
- package/dist/Components/Pagination/composables/usePagination.d.ts +1 -1
- package/dist/Components/RichTextEditor/RichTextEditor.js +5 -0
- package/dist/Components/RichTextEditor/RichTextEditor.vue.d.ts +23 -0
- package/dist/Components/RichTextEditor/RichTextEditor.vue_vue_type_script_setup_true_lang.js +104 -0
- package/dist/Components/RichTextEditor/composables/useRichTextEditor.d.ts +488 -0
- package/dist/Components/RichTextEditor/composables/useRichTextEditor.js +226 -0
- package/dist/Components/RichTextEditor/index.d.ts +3 -0
- package/dist/Components/RichTextEditor/index.js +3 -0
- package/dist/Components/RichTextEditor/richTextEditor.types.d.ts +103 -0
- package/dist/Components/Select/composables/useSelect.js +2 -2
- package/dist/Components/Sidebar/SidebarListItem.vue.d.ts +17 -9
- package/dist/Components/Sidebar/SidebarListItem.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/Components/Sidebar/composables/useSidebarListItem.js +1 -1
- package/dist/Components/Sidebar/composables/useSidebarTrigger.d.ts +1 -1
- package/dist/Components/Sidebar/sidebar.types.d.ts +2 -1
- package/dist/Components/Snackbar/composables/useSnackbar.js +1 -1
- package/dist/Components/Textarea/composables/useTextarea.js +1 -1
- package/dist/Components/Tooltip/composables/useTooltip.js +3 -3
- package/dist/Utils/linkAs.d.ts +29 -0
- package/dist/Utils/linkAs.js +18 -0
- package/dist/augments.d.ts +19 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +181 -170
- package/dist/theme.css +3 -0
- package/docs/README.md +4 -0
- package/docs/components/Breadcrumb.md +16 -0
- package/docs/components/BridgeUIProvider.md +18 -1
- package/docs/components/Button.md +31 -19
- package/docs/components/Carousel.md +113 -0
- package/docs/components/DataTable.md +1 -1
- package/docs/components/FileUpload.md +197 -0
- package/docs/components/Link.md +28 -12
- package/docs/components/List.md +21 -19
- package/docs/components/RichTextEditor.md +88 -0
- package/docs/components/Sidebar.md +1 -1
- package/package.json +54 -18
|
@@ -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 u, useId as ee, watch as d } from "vue";
|
|
5
|
+
import { get as f, omit as p } from "es-toolkit/compat";
|
|
6
|
+
import { canMoveCarousel as m, clampCarouselIndex as h, getAdjacentCarouselIndex as te, getCarouselMaxIndex as g, getCarouselSlideStyle as _, getCarouselTrackStyle as v, resolveCarouselAutoPlayInterval as y, resolveCarouselSwipeDirection as b, shouldPauseCarouselAutoPlay as ne } from "@bridge-ui/core/Domain";
|
|
7
|
+
import { carouselSizeProps as re } from "@bridge-ui/core/Tokens";
|
|
8
|
+
import { cn as x, mergeBridgeUILayeredClasses as ie, splitComponentProps as ae } from "@bridge-ui/core/Utils";
|
|
9
|
+
//#region src/Components/Carousel/composables/useCarousel.ts
|
|
10
|
+
var oe = [
|
|
11
|
+
"gap",
|
|
12
|
+
"loop",
|
|
13
|
+
"size",
|
|
14
|
+
"classes",
|
|
15
|
+
"autoPlay",
|
|
16
|
+
"indicators",
|
|
17
|
+
"customProps",
|
|
18
|
+
"orientation",
|
|
19
|
+
"defaultIndex",
|
|
20
|
+
"slidesPerView"
|
|
21
|
+
], S = [
|
|
22
|
+
"onBlur",
|
|
23
|
+
"onFocus",
|
|
24
|
+
"onKeydown",
|
|
25
|
+
"onMouseenter",
|
|
26
|
+
"onMouseleave"
|
|
27
|
+
], se = [
|
|
28
|
+
"onPointerup",
|
|
29
|
+
"onPointerdown",
|
|
30
|
+
"onPointercancel"
|
|
31
|
+
];
|
|
32
|
+
function ce(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 typeof e == "function" ? e : void 0;
|
|
40
|
+
}
|
|
41
|
+
function w(w, T, E) {
|
|
42
|
+
let D = e(), le = u(), ue = `bridge-carousel${ee()}`, 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(() => ae({
|
|
43
|
+
props: {
|
|
44
|
+
...le,
|
|
45
|
+
...w
|
|
46
|
+
},
|
|
47
|
+
bridgeKeys: oe
|
|
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 = g(t, L.value.slidesPerView);
|
|
56
|
+
return h(e, n + 1);
|
|
57
|
+
}), B = r({
|
|
58
|
+
entry: R,
|
|
59
|
+
props: () => I.value.componentProps
|
|
60
|
+
}), V = a(() => ie(re, R.value?.tokens?.size)), H = a(() => f(V.value, L.value.size)), U = a(() => f(H.value, "icon") ?? "sm");
|
|
61
|
+
function W(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 de(e) {
|
|
67
|
+
return O.value.indexOf(e);
|
|
68
|
+
}
|
|
69
|
+
function G(e) {
|
|
70
|
+
let t = O.value.length, n = t <= 0 ? null : g(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 K(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) && G(te(n));
|
|
82
|
+
}
|
|
83
|
+
function q(e) {
|
|
84
|
+
G(e);
|
|
85
|
+
}
|
|
86
|
+
d(() => ({
|
|
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, g(e, L.value.slidesPerView) + 1));
|
|
91
|
+
}), P.value = z.value, d(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 (typeof window.matchMedia != "function") 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 J;
|
|
109
|
+
function Y() {
|
|
110
|
+
J !== void 0 && (window.clearInterval(J), J = void 0);
|
|
111
|
+
}
|
|
112
|
+
d(() => [
|
|
113
|
+
A.value,
|
|
114
|
+
j.value,
|
|
115
|
+
L.value.loop,
|
|
116
|
+
L.value.autoPlay,
|
|
117
|
+
M.value,
|
|
118
|
+
O.value.length
|
|
119
|
+
], () => {
|
|
120
|
+
Y();
|
|
121
|
+
let e = y(L.value.autoPlay);
|
|
122
|
+
e == null || ne({
|
|
123
|
+
focused: j.value,
|
|
124
|
+
hovered: A.value,
|
|
125
|
+
reducedMotion: M.value
|
|
126
|
+
}) || (J = window.setInterval(() => {
|
|
127
|
+
K(1);
|
|
128
|
+
}, e));
|
|
129
|
+
}, { immediate: !0 }), s(Y);
|
|
130
|
+
let X = a(() => {
|
|
131
|
+
let e = O.value.length;
|
|
132
|
+
return e <= 0 ? 0 : g(e, L.value.slidesPerView) + 1;
|
|
133
|
+
}), Z = a(() => X.value > 1), fe = a(() => L.value.indicators !== !1 && X.value > 1), Q = a(() => L.value.orientation === "vertical"), $ = a(() => !Q.value && I.value.inheritedAttrs.dir === "rtl"), pe = a(() => Q.value ? "ArrowUp" : $.value ? "ArrowRight" : "ArrowLeft"), me = a(() => Q.value ? "ArrowDown" : $.value ? "ArrowLeft" : "ArrowRight"), he = 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
|
+
})), ge = 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
|
+
})), _e = a(() => Array.from({ length: X.value }, (e, t) => t)), ve = a(() => ({
|
|
146
|
+
getIndex: de,
|
|
147
|
+
registerSlide: W,
|
|
148
|
+
id: ue,
|
|
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: f(B.value, "slide") ?? "",
|
|
155
|
+
slideStyle: _(L.value.slidesPerView, L.value.gap, L.value.orientation)
|
|
156
|
+
}));
|
|
157
|
+
c(i, ve);
|
|
158
|
+
let ye = 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, [...S]);
|
|
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
|
+
[f(H.value, "root") ?? ""]: !0,
|
|
176
|
+
[f(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
|
+
ce(e.target) || (e.key === me.value ? (e.preventDefault(), K(1)) : e.key === pe.value ? (e.preventDefault(), K(-1)) : e.key === "Home" ? (e.preventDefault(), q(0)) : e.key === "End" && (e.preventDefault(), q(g(O.value.length, L.value.slidesPerView)))), r?.(e);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}), be = 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, [...se]), {}, {
|
|
189
|
+
"data-part": "viewport",
|
|
190
|
+
onPointercancel: (e) => {
|
|
191
|
+
F.value = null, i?.(e);
|
|
192
|
+
},
|
|
193
|
+
class: x({
|
|
194
|
+
[f(H.value, "viewport") ?? ""]: !0,
|
|
195
|
+
[f(B.value, "viewport") ?? ""]: !0,
|
|
196
|
+
[f(H.value, "viewportVertical") ?? ""]: Q.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 = b(e.clientX - t.x, e.clientY - t.y, {
|
|
209
|
+
rtl: $.value,
|
|
210
|
+
orientation: L.value.orientation
|
|
211
|
+
});
|
|
212
|
+
n && K(n);
|
|
213
|
+
}
|
|
214
|
+
n?.(e);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}), xe = a(() => t(L.value.customProps?.track, {}, {
|
|
218
|
+
"data-part": "track",
|
|
219
|
+
class: x({
|
|
220
|
+
[f(H.value, "track") ?? ""]: !0,
|
|
221
|
+
[f(B.value, "track") ?? ""]: !0,
|
|
222
|
+
[f(H.value, "trackVertical") ?? ""]: Q.value
|
|
223
|
+
}),
|
|
224
|
+
style: v(z.value, {
|
|
225
|
+
rtl: $.value,
|
|
226
|
+
gap: L.value.gap,
|
|
227
|
+
count: O.value.length,
|
|
228
|
+
orientation: L.value.orientation,
|
|
229
|
+
slidesPerView: L.value.slidesPerView
|
|
230
|
+
})
|
|
231
|
+
})), Se = a(() => t(L.value.customProps?.controls, {}, {
|
|
232
|
+
"data-part": "controls",
|
|
233
|
+
class: x({
|
|
234
|
+
[f(H.value, "controls") ?? ""]: !0,
|
|
235
|
+
[f(B.value, "controls") ?? ""]: !0,
|
|
236
|
+
[f(H.value, "controlsVertical") ?? ""]: Q.value
|
|
237
|
+
})
|
|
238
|
+
})), Ce = a(() => Z.value ? Q.value ? f(H.value, "frameVertical") ?? "relative" : f(H.value, "frame") ?? "relative" : "relative"), we = a(() => t(L.value.customProps?.prev, {}, {
|
|
239
|
+
"data-part": "prev",
|
|
240
|
+
type: "button",
|
|
241
|
+
disabled: he.value,
|
|
242
|
+
onClick: () => {
|
|
243
|
+
K(-1);
|
|
244
|
+
},
|
|
245
|
+
"aria-label": D("Previous slide"),
|
|
246
|
+
class: x({
|
|
247
|
+
[f(H.value, "control") ?? ""]: !0,
|
|
248
|
+
[f(B.value, "prev") ?? ""]: !0,
|
|
249
|
+
[f(B.value, "control") ?? ""]: !0
|
|
250
|
+
})
|
|
251
|
+
})), Te = a(() => t(L.value.customProps?.next, {}, {
|
|
252
|
+
"data-part": "next",
|
|
253
|
+
type: "button",
|
|
254
|
+
disabled: ge.value,
|
|
255
|
+
"aria-label": D("Next slide"),
|
|
256
|
+
onClick: () => {
|
|
257
|
+
K(1);
|
|
258
|
+
},
|
|
259
|
+
class: x({
|
|
260
|
+
[f(H.value, "control") ?? ""]: !0,
|
|
261
|
+
[f(B.value, "next") ?? ""]: !0,
|
|
262
|
+
[f(B.value, "control") ?? ""]: !0
|
|
263
|
+
})
|
|
264
|
+
})), Ee = a(() => t(L.value.customProps?.prevIcon, {}, {
|
|
265
|
+
"aria-hidden": !0,
|
|
266
|
+
size: U.value,
|
|
267
|
+
class: Q.value ? void 0 : "rtl:rotate-180"
|
|
268
|
+
})), De = a(() => t(L.value.customProps?.nextIcon, {}, {
|
|
269
|
+
"aria-hidden": !0,
|
|
270
|
+
size: U.value,
|
|
271
|
+
class: Q.value ? void 0 : "rtl:rotate-180"
|
|
272
|
+
})), Oe = a(() => t(L.value.customProps?.indicators, {}, {
|
|
273
|
+
role: "group",
|
|
274
|
+
"data-part": "indicators",
|
|
275
|
+
"aria-label": D("Slides"),
|
|
276
|
+
class: x({
|
|
277
|
+
[f(H.value, "indicators") ?? ""]: !0,
|
|
278
|
+
[f(B.value, "indicators") ?? ""]: !0
|
|
279
|
+
})
|
|
280
|
+
})), ke = a(() => t(L.value.customProps?.live, {}, {
|
|
281
|
+
"aria-atomic": !0,
|
|
282
|
+
"data-part": "live",
|
|
283
|
+
"aria-live": "polite",
|
|
284
|
+
class: x({
|
|
285
|
+
[f(H.value, "live") ?? ""]: !0,
|
|
286
|
+
[f(B.value, "live") ?? ""]: !0
|
|
287
|
+
})
|
|
288
|
+
}));
|
|
289
|
+
function Ae(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
|
+
q(e);
|
|
297
|
+
},
|
|
298
|
+
"aria-label": D("Go to slide {{index}}", { index: e + 1 }),
|
|
299
|
+
class: x({
|
|
300
|
+
[f(H.value, "indicator") ?? ""]: !0,
|
|
301
|
+
[f(H.value, "indicatorSelected") ?? ""]: n,
|
|
302
|
+
[f(B.value, "indicator") ?? ""]: !0
|
|
303
|
+
})
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
let je = a(() => Q.value ? "chevronUp" : "chevronLeft");
|
|
307
|
+
return {
|
|
308
|
+
go: K,
|
|
309
|
+
liveBind: ke,
|
|
310
|
+
nextBind: Te,
|
|
311
|
+
nextIcon: a(() => Q.value ? "chevronDown" : "chevronRight"),
|
|
312
|
+
prevBind: we,
|
|
313
|
+
prevIcon: je,
|
|
314
|
+
rootBind: ye,
|
|
315
|
+
trackBind: xe,
|
|
316
|
+
activeIndex: z,
|
|
317
|
+
controlsBind: Se,
|
|
318
|
+
nextIconBind: De,
|
|
319
|
+
prevIconBind: Ee,
|
|
320
|
+
showControls: Z,
|
|
321
|
+
viewportBind: be,
|
|
322
|
+
announcement: N,
|
|
323
|
+
frameClassName: Ce,
|
|
324
|
+
indicatorsBind: Oe,
|
|
325
|
+
showIndicators: fe,
|
|
326
|
+
getIndicatorBind: Ae,
|
|
327
|
+
indicatorIndexes: _e
|
|
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>;
|