@mantine-vue/carousel 1.1.2

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.
@@ -0,0 +1,66 @@
1
+ import { type DefineComponent } from 'vue';
2
+ import type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from 'embla-carousel';
3
+ import { CarouselSlide } from './CarouselSlide';
4
+ import classes from './Carousel.module.css';
5
+ export type CarouselStylesNames = 'slide' | 'root' | 'viewport' | 'container' | 'controls' | 'control' | 'indicators' | 'indicator';
6
+ export interface CarouselProps {
7
+ /** Options passed down to embla carousel */
8
+ emblaOptions?: EmblaOptionsType;
9
+ /** Called when next slide is shown */
10
+ onNextSlide?: () => void;
11
+ /** Called when previous slider is shown */
12
+ onPreviousSlide?: () => void;
13
+ /** Called with slide index when slide changes */
14
+ onSlideChange?: (index: number) => void;
15
+ /** Get embla API as ref */
16
+ getEmblaApi?: (embla: EmblaCarouselType) => void;
17
+ /** Props passed down to next control */
18
+ nextControlProps?: Record<string, any>;
19
+ /** Props passed down to previous control */
20
+ previousControlProps?: Record<string, any>;
21
+ /** Controls size of the next and previous controls @default 26 */
22
+ controlSize?: string | number;
23
+ /** Controls position of the next and previous controls, key of `theme.spacing` or any valid CSS value @default 'sm' */
24
+ controlsOffset?: string | number;
25
+ /** Controls slide width based on viewport width @default '100%' */
26
+ slideSize?: string | number | Record<string, string | number>;
27
+ /** Key of theme.spacing or number to set gap between slides */
28
+ slideGap?: string | number | Record<string, string | number>;
29
+ /** Carousel orientation @default 'horizontal' */
30
+ orientation?: 'horizontal' | 'vertical';
31
+ /** Determines type of queries used for responsive styles @default 'media' */
32
+ type?: 'media' | 'container';
33
+ /** Slides container `height`, required for vertical orientation */
34
+ height?: string | number;
35
+ /** Determines whether gap between slides should be treated as part of the slide size @default true */
36
+ includeGapInSize?: boolean;
37
+ /** Index of initial slide */
38
+ initialSlide?: number;
39
+ /** Determines whether next/previous controls should be displayed @default true */
40
+ withControls?: boolean;
41
+ /** Determines whether indicators should be displayed @default false */
42
+ withIndicators?: boolean;
43
+ /** A list of embla plugins */
44
+ plugins?: EmblaPluginType[];
45
+ /** Icon of the next control */
46
+ nextControlIcon?: any;
47
+ /** Icon of the previous control */
48
+ previousControlIcon?: any;
49
+ /** Determines whether arrow key should switch slides @default true */
50
+ withKeyboardEvents?: boolean;
51
+ /** Function to get props for indicator button */
52
+ getIndicatorProps?: (index: number) => Record<string, any>;
53
+ id?: string;
54
+ classNames?: any;
55
+ styles?: any;
56
+ vars?: any;
57
+ unstyled?: boolean;
58
+ mod?: any;
59
+ }
60
+ declare const varsResolver: (theme: import("@mantine-vue/core").MantineTheme, props: any, ctx: Record<string, any>) => Record<string, Record<string, string | undefined>>;
61
+ export declare const Carousel: DefineComponent<CarouselProps> & {
62
+ classes: typeof classes;
63
+ varsResolver: typeof varsResolver;
64
+ Slide: typeof CarouselSlide;
65
+ };
66
+ export {};
@@ -0,0 +1,161 @@
1
+ import { type PropType } from 'vue';
2
+ export type CarouselSlideStylesNames = 'slide';
3
+ export interface CarouselSlideProps {
4
+ classNames?: any;
5
+ styles?: any;
6
+ mod?: any;
7
+ }
8
+ export declare const CarouselSlide: {
9
+ new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
10
+ classNames: {
11
+ type: (ObjectConstructor | FunctionConstructor)[];
12
+ default: undefined;
13
+ };
14
+ styles: {
15
+ type: (ObjectConstructor | FunctionConstructor)[];
16
+ default: undefined;
17
+ };
18
+ mod: {
19
+ type: PropType<any>;
20
+ default: undefined;
21
+ };
22
+ }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
23
+ [key: string]: any;
24
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
25
+ classNames: Function | Record<string, any>;
26
+ styles: Function | Record<string, any>;
27
+ mod: any;
28
+ }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
29
+ P: {};
30
+ B: {};
31
+ D: {};
32
+ C: {};
33
+ M: {};
34
+ Defaults: {};
35
+ }, Readonly<import("vue").ExtractPropTypes<{
36
+ classNames: {
37
+ type: (ObjectConstructor | FunctionConstructor)[];
38
+ default: undefined;
39
+ };
40
+ styles: {
41
+ type: (ObjectConstructor | FunctionConstructor)[];
42
+ default: undefined;
43
+ };
44
+ mod: {
45
+ type: PropType<any>;
46
+ default: undefined;
47
+ };
48
+ }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
49
+ [key: string]: any;
50
+ }>, {}, {}, {}, {
51
+ classNames: Function | Record<string, any>;
52
+ styles: Function | Record<string, any>;
53
+ mod: any;
54
+ }>;
55
+ __isFragment?: never;
56
+ __isTeleport?: never;
57
+ __isSuspense?: never;
58
+ } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
59
+ classNames: {
60
+ type: (ObjectConstructor | FunctionConstructor)[];
61
+ default: undefined;
62
+ };
63
+ styles: {
64
+ type: (ObjectConstructor | FunctionConstructor)[];
65
+ default: undefined;
66
+ };
67
+ mod: {
68
+ type: PropType<any>;
69
+ default: undefined;
70
+ };
71
+ }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
72
+ [key: string]: any;
73
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
74
+ classNames: Function | Record<string, any>;
75
+ styles: Function | Record<string, any>;
76
+ mod: any;
77
+ }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
78
+ $: import("vue").ComponentInternalInstance;
79
+ $data: {};
80
+ $props: Partial<{
81
+ classNames: Function | Record<string, any>;
82
+ styles: Function | Record<string, any>;
83
+ mod: any;
84
+ }> & Omit<{
85
+ readonly classNames?: Function | Record<string, any> | undefined;
86
+ readonly styles?: Function | Record<string, any> | undefined;
87
+ readonly mod?: any;
88
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "classNames" | "styles" | "mod">;
89
+ $attrs: import("vue").Attrs;
90
+ $refs: {
91
+ [x: string]: unknown;
92
+ };
93
+ $slots: Readonly<{
94
+ [name: string]: import("vue").Slot<any> | undefined;
95
+ }>;
96
+ $root: import("vue").ComponentPublicInstance | null;
97
+ $parent: import("vue").ComponentPublicInstance | null;
98
+ $host: Element | null;
99
+ $emit: (event: string, ...args: any[]) => void;
100
+ $el: any;
101
+ $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
102
+ classNames: {
103
+ type: (ObjectConstructor | FunctionConstructor)[];
104
+ default: undefined;
105
+ };
106
+ styles: {
107
+ type: (ObjectConstructor | FunctionConstructor)[];
108
+ default: undefined;
109
+ };
110
+ mod: {
111
+ type: PropType<any>;
112
+ default: undefined;
113
+ };
114
+ }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
115
+ [key: string]: any;
116
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
117
+ classNames: Function | Record<string, any>;
118
+ styles: Function | Record<string, any>;
119
+ mod: any;
120
+ }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
121
+ beforeCreate?: (() => void) | (() => void)[];
122
+ created?: (() => void) | (() => void)[];
123
+ beforeMount?: (() => void) | (() => void)[];
124
+ mounted?: (() => void) | (() => void)[];
125
+ beforeUpdate?: (() => void) | (() => void)[];
126
+ updated?: (() => void) | (() => void)[];
127
+ activated?: (() => void) | (() => void)[];
128
+ deactivated?: (() => void) | (() => void)[];
129
+ beforeDestroy?: (() => void) | (() => void)[];
130
+ beforeUnmount?: (() => void) | (() => void)[];
131
+ destroyed?: (() => void) | (() => void)[];
132
+ unmounted?: (() => void) | (() => void)[];
133
+ renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
134
+ renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
135
+ errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
136
+ };
137
+ $forceUpdate: () => void;
138
+ $nextTick: typeof import("vue").nextTick;
139
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
140
+ } & Readonly<{
141
+ classNames: Function | Record<string, any>;
142
+ styles: Function | Record<string, any>;
143
+ mod: any;
144
+ }> & Omit<Readonly<import("vue").ExtractPropTypes<{
145
+ classNames: {
146
+ type: (ObjectConstructor | FunctionConstructor)[];
147
+ default: undefined;
148
+ };
149
+ styles: {
150
+ type: (ObjectConstructor | FunctionConstructor)[];
151
+ default: undefined;
152
+ };
153
+ mod: {
154
+ type: PropType<any>;
155
+ default: undefined;
156
+ };
157
+ }>> & Readonly<{}>, "classNames" | "styles" | "mod"> & {} & {} & import("vue").ComponentCustomProperties & {} & {
158
+ $props: import("@mantine-vue/core").BoxProps;
159
+ }) & {
160
+ classes: Record<string, string>;
161
+ };
@@ -0,0 +1,67 @@
1
+ import { type PropType } from 'vue';
2
+ type StyleProp<T> = T | Partial<Record<string, T>>;
3
+ export declare const CarouselVariables: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ selector: {
5
+ type: StringConstructor;
6
+ required: boolean;
7
+ };
8
+ slideSize: {
9
+ type: PropType<StyleProp<string | number>>;
10
+ default: undefined;
11
+ };
12
+ slideGap: {
13
+ type: PropType<StyleProp<string | number>>;
14
+ default: undefined;
15
+ };
16
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
17
+ [key: string]: any;
18
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ selector: {
20
+ type: StringConstructor;
21
+ required: boolean;
22
+ };
23
+ slideSize: {
24
+ type: PropType<StyleProp<string | number>>;
25
+ default: undefined;
26
+ };
27
+ slideGap: {
28
+ type: PropType<StyleProp<string | number>>;
29
+ default: undefined;
30
+ };
31
+ }>> & Readonly<{}>, {
32
+ slideSize: StyleProp<string | number>;
33
+ slideGap: StyleProp<string | number>;
34
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
35
+ export declare const CarouselContainerVariables: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
36
+ selector: {
37
+ type: StringConstructor;
38
+ required: boolean;
39
+ };
40
+ slideSize: {
41
+ type: PropType<StyleProp<string | number>>;
42
+ default: undefined;
43
+ };
44
+ slideGap: {
45
+ type: PropType<StyleProp<string | number>>;
46
+ default: undefined;
47
+ };
48
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
49
+ [key: string]: any;
50
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
51
+ selector: {
52
+ type: StringConstructor;
53
+ required: boolean;
54
+ };
55
+ slideSize: {
56
+ type: PropType<StyleProp<string | number>>;
57
+ default: undefined;
58
+ };
59
+ slideGap: {
60
+ type: PropType<StyleProp<string | number>>;
61
+ default: undefined;
62
+ };
63
+ }>> & Readonly<{}>, {
64
+ slideSize: StyleProp<string | number>;
65
+ slideGap: StyleProp<string | number>;
66
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
67
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface GetChevronRotationOptions {
2
+ dir: 'rtl' | 'ltr';
3
+ orientation: 'horizontal' | 'vertical' | undefined;
4
+ direction: 'next' | 'previous';
5
+ }
6
+ export declare function getChevronRotation({ dir, orientation, direction }: GetChevronRotationOptions): number;
@@ -0,0 +1,3 @@
1
+ export declare function getNextIndicatorIndex(index: number, total: number): number;
2
+ export declare function getPreviousIndicatorIndex(index: number, total: number): number;
3
+ export declare function clamp(value: number, min: number, max: number): number;
@@ -0,0 +1,6 @@
1
+ export { Carousel } from './Carousel';
2
+ export { useCarouselContext } from './Carousel.context';
3
+ export { CarouselSlide } from './CarouselSlide';
4
+ export type { CarouselProps, CarouselStylesNames } from './Carousel';
5
+ export type { CarouselSlideProps, CarouselSlideStylesNames } from './CarouselSlide';
6
+ export type { CarouselContextValue } from './Carousel.context';
package/lib/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export { Carousel } from './Carousel';
2
+ export { useCarouselContext } from './Carousel.context';
3
+ export { CarouselSlide } from './CarouselSlide';
4
+ export type { CarouselProps, CarouselStylesNames } from './Carousel';
5
+ export type { CarouselSlideProps, CarouselSlideStylesNames } from './CarouselSlide';
6
+ export type { CarouselContextValue } from './Carousel.context';
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@mantine-vue/carousel",
3
+ "version": "1.1.2",
4
+ "description": "Embla based carousel, Vue equivalent to @mantine/carousel",
5
+ "license": "MIT",
6
+ "files": [
7
+ "cjs",
8
+ "esm",
9
+ "lib",
10
+ "styles.css",
11
+ "styles.layer.css",
12
+ "styles"
13
+ ],
14
+ "sideEffects": [
15
+ "*.css"
16
+ ],
17
+ "main": "./cjs/index.cjs",
18
+ "module": "./esm/index.mjs",
19
+ "types": "./lib/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "import": {
23
+ "types": "./lib/index.d.mts",
24
+ "default": "./esm/index.mjs"
25
+ },
26
+ "require": {
27
+ "types": "./lib/index.d.ts",
28
+ "default": "./cjs/index.cjs"
29
+ }
30
+ }
31
+ },
32
+ "devDependencies": {
33
+ "@mantine-vue/core": "workspace:*",
34
+ "@mantine-vue/hooks": "workspace:*",
35
+ "@vue/compiler-dom": "^3.5.0",
36
+ "@vue/test-utils": "^2.4.6",
37
+ "embla-carousel": "^8.6.0",
38
+ "embla-carousel-vue": "^8.6.0",
39
+ "vue": "^3.5.0"
40
+ },
41
+ "peerDependencies": {
42
+ "@mantine-vue/core": "1.1.1",
43
+ "@mantine-vue/hooks": "1.1.2",
44
+ "embla-carousel": ">=8.0.0",
45
+ "embla-carousel-vue": ">=8.0.0",
46
+ "vue": "^3.5.0"
47
+ }
48
+ }
package/styles.css ADDED
@@ -0,0 +1,173 @@
1
+ ._root_avx3r_1 {
2
+ --carousel-height: auto;
3
+ position: relative;
4
+ }
5
+
6
+ ._viewport_avx3r_6 {
7
+ height: var(--carousel-height);
8
+ overflow: hidden;
9
+ }
10
+
11
+ ._viewport_avx3r_6[data-type='container'] {
12
+ container: carousel / inline-size;
13
+ }
14
+
15
+ ._container_avx3r_15 {
16
+ display: flex;
17
+ flex-direction: row;
18
+ height: var(--carousel-height);
19
+ }
20
+
21
+ :where([data-include-gap-in-size]) ._container_avx3r_15:where([data-orientation='vertical']) {
22
+ margin-bottom: calc(var(--carousel-slide-gap) * -1);
23
+ }
24
+
25
+ :where([data-include-gap-in-size]) ._container_avx3r_15:where([data-orientation='horizontal']) {
26
+ margin-inline-end: calc(var(--carousel-slide-gap) * -1);
27
+ }
28
+
29
+ ._container_avx3r_15:where([data-orientation='vertical']) {
30
+ flex-direction: column;
31
+ }
32
+
33
+ ._controls_avx3r_35 {
34
+ position: absolute;
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: space-between;
38
+ z-index: 1;
39
+ pointer-events: none;
40
+ }
41
+
42
+ ._controls_avx3r_35:where([data-orientation='vertical']) {
43
+ inset-inline-start: calc(50% - var(--carousel-control-size) / 2);
44
+ top: 0;
45
+ bottom: 0;
46
+ flex-direction: column;
47
+ padding: var(--carousel-controls-offset) 0;
48
+ }
49
+
50
+ ._controls_avx3r_35:where([data-orientation='horizontal']) {
51
+ inset-inline-start: 0;
52
+ inset-inline-end: 0;
53
+ top: calc(50% - var(--carousel-control-size) / 2);
54
+ flex-direction: row;
55
+ padding: 0 var(--carousel-controls-offset);
56
+ }
57
+
58
+ ._control_avx3r_35 {
59
+ display: flex;
60
+ justify-content: center;
61
+ align-items: center;
62
+ min-width: var(--carousel-control-size);
63
+ min-height: var(--carousel-control-size);
64
+ border-radius: var(--carousel-control-size);
65
+ pointer-events: all;
66
+ background-color: var(--mantine-color-white);
67
+ color: var(--mantine-color-black);
68
+ box-shadow: var(--mantine-shadow-md);
69
+ border: 1px solid var(--mantine-color-gray-3);
70
+ transition: opacity 100ms ease;
71
+ }
72
+
73
+ :where([data-mantine-color-scheme='light']) ._control_avx3r_35 {
74
+ opacity: 0.85;
75
+ }
76
+
77
+ :where([data-mantine-color-scheme='dark']) ._control_avx3r_35 {
78
+ opacity: 0.65;
79
+ }
80
+
81
+ @media (hover: hover) {
82
+
83
+ ._control_avx3r_35:hover {
84
+ opacity: 1;
85
+ }
86
+ }
87
+
88
+ @media (hover: none) {
89
+
90
+ ._control_avx3r_35:active {
91
+ opacity: 1;
92
+ }
93
+ }
94
+
95
+ ._indicators_avx3r_87 {
96
+ position: absolute;
97
+ display: flex;
98
+ justify-content: center;
99
+ gap: calc(0.5rem * var(--mantine-scale));
100
+ pointer-events: none;
101
+ }
102
+
103
+ ._indicators_avx3r_87:where([data-orientation='vertical']) {
104
+ bottom: 0;
105
+ top: 0;
106
+ inset-inline-end: var(--mantine-spacing-md);
107
+ flex-direction: column;
108
+ }
109
+
110
+ ._indicators_avx3r_87:where([data-orientation='horizontal']) {
111
+ bottom: var(--mantine-spacing-md);
112
+ inset-inline-start: 0;
113
+ inset-inline-end: 0;
114
+ flex-direction: row;
115
+ }
116
+
117
+ ._indicator_avx3r_87 {
118
+ pointer-events: all;
119
+ border-radius: var(--mantine-radius-xl);
120
+ box-shadow: var(--mantine-shadow-sm);
121
+ opacity: 0.6;
122
+ background-color: var(--mantine-color-white);
123
+ }
124
+
125
+ @media (hover: hover) {
126
+
127
+ ._indicator_avx3r_87:hover {
128
+ opacity: 1;
129
+ }
130
+ }
131
+
132
+ @media (hover: none) {
133
+
134
+ ._indicator_avx3r_87:active {
135
+ opacity: 1;
136
+ }
137
+ }
138
+
139
+ ._indicator_avx3r_87:where([data-active]) {
140
+ opacity: 1;
141
+ }
142
+
143
+ ._indicator_avx3r_87:where([data-orientation='vertical']) {
144
+ width: calc(0.3125rem * var(--mantine-scale));
145
+ height: calc(1.5625rem * var(--mantine-scale));
146
+ }
147
+
148
+ ._indicator_avx3r_87:where([data-orientation='horizontal']) {
149
+ width: calc(1.5625rem * var(--mantine-scale));
150
+ height: calc(0.3125rem * var(--mantine-scale));
151
+ }
152
+
153
+ ._slide_avx3r_135 {
154
+ position: relative;
155
+ flex: 0 0 var(--carousel-slide-size, 100%);
156
+ }
157
+
158
+ ._root_avx3r_1:where([data-include-gap-in-size]) ._slide_avx3r_135:where([data-orientation='vertical']) {
159
+ padding-bottom: var(--carousel-slide-gap);
160
+ }
161
+
162
+ ._root_avx3r_1:where([data-include-gap-in-size]) ._slide_avx3r_135:where([data-orientation='horizontal']) {
163
+ padding-inline-end: var(--carousel-slide-gap);
164
+ }
165
+
166
+ ._root_avx3r_1:where(:not([data-include-gap-in-size])) ._slide_avx3r_135:where([data-orientation='vertical']) {
167
+ margin-bottom: var(--carousel-slide-gap);
168
+ }
169
+
170
+ ._root_avx3r_1:where(:not([data-include-gap-in-size])) ._slide_avx3r_135:where([data-orientation='horizontal']) {
171
+ margin-inline-end: var(--carousel-slide-gap);
172
+ }
173
+ /*$vite$:1*/