@chinggis.systems/collection-ui 1.0.0 → 1.0.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.
- package/README.md +21 -36
- package/dist/CollectionRenderer.d.ts +2 -2
- package/dist/CollectionRenderer.d.ts.map +1 -1
- package/dist/CollectionRenderer.js +368 -292
- package/dist/CollectionRenderer.js.map +1 -1
- package/dist/CollectionView.d.ts +13 -0
- package/dist/CollectionView.d.ts.map +1 -0
- package/dist/CollectionView.js +42 -0
- package/dist/CollectionView.js.map +1 -0
- package/dist/assets/spine/BurnBlend.png +0 -0
- package/dist/assets/spine/FlatEdges.webp +0 -0
- package/dist/assets/spine/FlatShadow.webp +0 -0
- package/dist/assets/spine/NormalBlend.webp +0 -0
- package/dist/assets/spine/SoftLightBlend.webp +0 -0
- package/dist/collectionV2Model.d.ts +43 -0
- package/dist/collectionV2Model.d.ts.map +1 -0
- package/dist/collectionV2Model.js +4 -0
- package/dist/collectionV2Model.js.map +1 -0
- package/dist/createAdapters.d.ts +66 -74
- package/dist/createAdapters.d.ts.map +1 -1
- package/dist/createAdapters.js +223 -223
- package/dist/createAdapters.js.map +1 -1
- package/dist/defaultAdapters.d.ts +7 -7
- package/dist/defaultAdapters.js +8 -8
- package/dist/index.d.ts +14 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/layoutPresets.d.ts +18 -18
- package/dist/layoutPresets.js +129 -129
- package/dist/primitives/BookSpine.d.ts +11 -11
- package/dist/primitives/BookSpine.js +10 -10
- package/dist/primitives/CollectionCarousel.d.ts +3 -3
- package/dist/primitives/CollectionCarousel.d.ts.map +1 -1
- package/dist/primitives/CollectionCarousel.js +23 -13
- package/dist/primitives/CollectionCarousel.js.map +1 -1
- package/dist/styles.css +333 -52
- package/dist/types.d.ts +147 -141
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/utils.d.ts +8 -8
- package/dist/utils.js +26 -26
- package/package.json +1 -1
package/dist/layoutPresets.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { CollectionLayout, CollectionLayoutDirection, CollectionLayoutName, CollectionLayoutShape } from "./types";
|
|
2
|
-
export type CollectionLayoutControl = "columns" | "direction" | "isNumbered" | "shape";
|
|
3
|
-
export interface CollectionLayoutDefinition {
|
|
4
|
-
name: CollectionLayoutName;
|
|
5
|
-
label: string;
|
|
6
|
-
description: string;
|
|
7
|
-
controls: CollectionLayoutControl[];
|
|
8
|
-
defaultLayout: CollectionLayout;
|
|
9
|
-
columnOptions?: number[];
|
|
10
|
-
directionOptions?: CollectionLayoutDirection[];
|
|
11
|
-
shapeOptions?: CollectionLayoutShape[];
|
|
12
|
-
}
|
|
13
|
-
export declare const COLLECTION_LAYOUT_DEFINITIONS: Record<CollectionLayoutName, CollectionLayoutDefinition>;
|
|
14
|
-
export declare function getCollectionLayoutDefinition(name: CollectionLayoutName): CollectionLayoutDefinition;
|
|
15
|
-
export declare function getCollectionLayoutControls(name: CollectionLayoutName): CollectionLayoutControl[];
|
|
16
|
-
export declare function isCollectionLayoutControlVisible(name: CollectionLayoutName, control: CollectionLayoutControl): boolean;
|
|
17
|
-
export declare function getDefaultCollectionLayout(name: CollectionLayoutName): CollectionLayout;
|
|
18
|
-
export declare function sanitizeCollectionLayout(layout: CollectionLayout): CollectionLayout;
|
|
1
|
+
import type { CollectionLayout, CollectionLayoutDirection, CollectionLayoutName, CollectionLayoutShape } from "./types";
|
|
2
|
+
export type CollectionLayoutControl = "columns" | "direction" | "isNumbered" | "shape";
|
|
3
|
+
export interface CollectionLayoutDefinition {
|
|
4
|
+
name: CollectionLayoutName;
|
|
5
|
+
label: string;
|
|
6
|
+
description: string;
|
|
7
|
+
controls: CollectionLayoutControl[];
|
|
8
|
+
defaultLayout: CollectionLayout;
|
|
9
|
+
columnOptions?: number[];
|
|
10
|
+
directionOptions?: CollectionLayoutDirection[];
|
|
11
|
+
shapeOptions?: CollectionLayoutShape[];
|
|
12
|
+
}
|
|
13
|
+
export declare const COLLECTION_LAYOUT_DEFINITIONS: Record<CollectionLayoutName, CollectionLayoutDefinition>;
|
|
14
|
+
export declare function getCollectionLayoutDefinition(name: CollectionLayoutName): CollectionLayoutDefinition;
|
|
15
|
+
export declare function getCollectionLayoutControls(name: CollectionLayoutName): CollectionLayoutControl[];
|
|
16
|
+
export declare function isCollectionLayoutControlVisible(name: CollectionLayoutName, control: CollectionLayoutControl): boolean;
|
|
17
|
+
export declare function getDefaultCollectionLayout(name: CollectionLayoutName): CollectionLayout;
|
|
18
|
+
export declare function sanitizeCollectionLayout(layout: CollectionLayout): CollectionLayout;
|
|
19
19
|
//# sourceMappingURL=layoutPresets.d.ts.map
|
package/dist/layoutPresets.js
CHANGED
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
export const COLLECTION_LAYOUT_DEFINITIONS = {
|
|
2
|
-
hero: {
|
|
3
|
-
name: "hero",
|
|
4
|
-
label: "Hero",
|
|
5
|
-
description: "Large collection banner for the top of a page.",
|
|
6
|
-
controls: [],
|
|
7
|
-
defaultLayout: { name: "hero" },
|
|
8
|
-
},
|
|
9
|
-
banner: {
|
|
10
|
-
name: "banner",
|
|
11
|
-
label: "Banner",
|
|
12
|
-
description: "Single collection image and copy.",
|
|
13
|
-
controls: [],
|
|
14
|
-
defaultLayout: { name: "banner" },
|
|
15
|
-
},
|
|
16
|
-
special: {
|
|
17
|
-
name: "special",
|
|
18
|
-
label: "Special item",
|
|
19
|
-
description: "One highlighted product with cover, description, price, and action.",
|
|
20
|
-
controls: [],
|
|
21
|
-
defaultLayout: { name: "special" },
|
|
22
|
-
},
|
|
23
|
-
carousel: {
|
|
24
|
-
name: "carousel",
|
|
25
|
-
label: "Carousel",
|
|
26
|
-
description: "Horizontal product shelf.",
|
|
27
|
-
controls: ["columns"],
|
|
28
|
-
columnOptions: [4, 5, 6, 7, 8],
|
|
29
|
-
defaultLayout: { name: "carousel", direction: "horizontal", columns: 6 },
|
|
30
|
-
},
|
|
31
|
-
list: {
|
|
32
|
-
name: "list",
|
|
33
|
-
label: "List",
|
|
34
|
-
description: "Horizontal shelf or vertical ranked list.",
|
|
35
|
-
controls: ["direction", "isNumbered"],
|
|
36
|
-
directionOptions: ["horizontal", "vertical"],
|
|
37
|
-
defaultLayout: { name: "list", direction: "horizontal" },
|
|
38
|
-
},
|
|
39
|
-
dynamic: {
|
|
40
|
-
name: "dynamic",
|
|
41
|
-
label: "Dynamic list",
|
|
42
|
-
description: "Dynamic item list with optional vertical mode.",
|
|
43
|
-
controls: ["direction", "isNumbered"],
|
|
44
|
-
directionOptions: ["horizontal", "vertical"],
|
|
45
|
-
defaultLayout: { name: "dynamic", direction: "horizontal" },
|
|
46
|
-
},
|
|
47
|
-
grid: {
|
|
48
|
-
name: "grid",
|
|
49
|
-
label: "Grid",
|
|
50
|
-
description: "Product grid/shelf.",
|
|
51
|
-
controls: ["columns"],
|
|
52
|
-
columnOptions: [3, 4, 5, 6],
|
|
53
|
-
defaultLayout: { name: "grid", columns: 4 },
|
|
54
|
-
},
|
|
55
|
-
relative: {
|
|
56
|
-
name: "relative",
|
|
57
|
-
label: "Relative",
|
|
58
|
-
description: "Related product shelf.",
|
|
59
|
-
controls: ["columns"],
|
|
60
|
-
columnOptions: [4, 5, 6],
|
|
61
|
-
defaultLayout: { name: "relative", columns: 6 },
|
|
62
|
-
},
|
|
63
|
-
"grid-title": {
|
|
64
|
-
name: "grid-title",
|
|
65
|
-
label: "Grid title",
|
|
66
|
-
description: "Grouped ranked lists.",
|
|
67
|
-
controls: ["isNumbered"],
|
|
68
|
-
defaultLayout: { name: "grid-title", isNumbered: true, itemLimit: 3 },
|
|
69
|
-
},
|
|
70
|
-
featured: {
|
|
71
|
-
name: "featured",
|
|
72
|
-
label: "Featured banners",
|
|
73
|
-
description: "Large image banner grid.",
|
|
74
|
-
controls: ["columns"],
|
|
75
|
-
columnOptions: [2, 3],
|
|
76
|
-
defaultLayout: { name: "featured", columns: 3 },
|
|
77
|
-
},
|
|
78
|
-
slide: {
|
|
79
|
-
name: "slide",
|
|
80
|
-
label: "Slide",
|
|
81
|
-
description: "Featured slide/banner collection.",
|
|
82
|
-
controls: ["columns"],
|
|
83
|
-
columnOptions: [2, 3],
|
|
84
|
-
defaultLayout: { name: "slide", columns: 3 },
|
|
85
|
-
},
|
|
86
|
-
"image-grid": {
|
|
87
|
-
name: "image-grid",
|
|
88
|
-
label: "Image grid",
|
|
89
|
-
description: "Collection image links.",
|
|
90
|
-
controls: ["columns", "shape"],
|
|
91
|
-
columnOptions: [3, 4, 5, 6],
|
|
92
|
-
shapeOptions: ["circle", "square"],
|
|
93
|
-
defaultLayout: { name: "image-grid", columns: 4, shape: "circle" },
|
|
94
|
-
},
|
|
95
|
-
"block-grid": {
|
|
96
|
-
name: "block-grid",
|
|
97
|
-
label: "Block grid",
|
|
98
|
-
description: "Small rectangular logo/banner links.",
|
|
99
|
-
controls: ["columns"],
|
|
100
|
-
columnOptions: [3, 4, 5, 6],
|
|
101
|
-
defaultLayout: { name: "block-grid", columns: 4, shape: "rectangle" },
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
export function getCollectionLayoutDefinition(name) {
|
|
105
|
-
return COLLECTION_LAYOUT_DEFINITIONS[name];
|
|
106
|
-
}
|
|
107
|
-
export function getCollectionLayoutControls(name) {
|
|
108
|
-
return COLLECTION_LAYOUT_DEFINITIONS[name]?.controls ?? [];
|
|
109
|
-
}
|
|
110
|
-
export function isCollectionLayoutControlVisible(name, control) {
|
|
111
|
-
return getCollectionLayoutControls(name).includes(control);
|
|
112
|
-
}
|
|
113
|
-
export function getDefaultCollectionLayout(name) {
|
|
114
|
-
return { ...COLLECTION_LAYOUT_DEFINITIONS[name].defaultLayout };
|
|
115
|
-
}
|
|
116
|
-
export function sanitizeCollectionLayout(layout) {
|
|
117
|
-
const definition = COLLECTION_LAYOUT_DEFINITIONS[layout.name];
|
|
118
|
-
if (!definition) {
|
|
119
|
-
return layout;
|
|
120
|
-
}
|
|
121
|
-
return {
|
|
122
|
-
name: layout.name,
|
|
123
|
-
direction: definition.controls.includes("direction") ? layout.direction : undefined,
|
|
124
|
-
isNumbered: definition.controls.includes("isNumbered") ? layout.isNumbered : undefined,
|
|
125
|
-
columns: definition.controls.includes("columns") ? layout.columns : undefined,
|
|
126
|
-
itemLimit: layout.itemLimit,
|
|
127
|
-
shape: definition.controls.includes("shape") ? layout.shape : undefined,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
1
|
+
export const COLLECTION_LAYOUT_DEFINITIONS = {
|
|
2
|
+
hero: {
|
|
3
|
+
name: "hero",
|
|
4
|
+
label: "Hero",
|
|
5
|
+
description: "Large collection banner for the top of a page.",
|
|
6
|
+
controls: [],
|
|
7
|
+
defaultLayout: { name: "hero" },
|
|
8
|
+
},
|
|
9
|
+
banner: {
|
|
10
|
+
name: "banner",
|
|
11
|
+
label: "Banner",
|
|
12
|
+
description: "Single collection image and copy.",
|
|
13
|
+
controls: [],
|
|
14
|
+
defaultLayout: { name: "banner" },
|
|
15
|
+
},
|
|
16
|
+
special: {
|
|
17
|
+
name: "special",
|
|
18
|
+
label: "Special item",
|
|
19
|
+
description: "One highlighted product with cover, description, price, and action.",
|
|
20
|
+
controls: [],
|
|
21
|
+
defaultLayout: { name: "special" },
|
|
22
|
+
},
|
|
23
|
+
carousel: {
|
|
24
|
+
name: "carousel",
|
|
25
|
+
label: "Carousel",
|
|
26
|
+
description: "Horizontal product shelf.",
|
|
27
|
+
controls: ["columns"],
|
|
28
|
+
columnOptions: [4, 5, 6, 7, 8],
|
|
29
|
+
defaultLayout: { name: "carousel", direction: "horizontal", columns: 6 },
|
|
30
|
+
},
|
|
31
|
+
list: {
|
|
32
|
+
name: "list",
|
|
33
|
+
label: "List",
|
|
34
|
+
description: "Horizontal shelf or vertical ranked list.",
|
|
35
|
+
controls: ["direction", "isNumbered"],
|
|
36
|
+
directionOptions: ["horizontal", "vertical"],
|
|
37
|
+
defaultLayout: { name: "list", direction: "horizontal" },
|
|
38
|
+
},
|
|
39
|
+
dynamic: {
|
|
40
|
+
name: "dynamic",
|
|
41
|
+
label: "Dynamic list",
|
|
42
|
+
description: "Dynamic item list with optional vertical mode.",
|
|
43
|
+
controls: ["direction", "isNumbered"],
|
|
44
|
+
directionOptions: ["horizontal", "vertical"],
|
|
45
|
+
defaultLayout: { name: "dynamic", direction: "horizontal" },
|
|
46
|
+
},
|
|
47
|
+
grid: {
|
|
48
|
+
name: "grid",
|
|
49
|
+
label: "Grid",
|
|
50
|
+
description: "Product grid/shelf.",
|
|
51
|
+
controls: ["columns"],
|
|
52
|
+
columnOptions: [3, 4, 5, 6],
|
|
53
|
+
defaultLayout: { name: "grid", columns: 4 },
|
|
54
|
+
},
|
|
55
|
+
relative: {
|
|
56
|
+
name: "relative",
|
|
57
|
+
label: "Relative",
|
|
58
|
+
description: "Related product shelf.",
|
|
59
|
+
controls: ["columns"],
|
|
60
|
+
columnOptions: [4, 5, 6],
|
|
61
|
+
defaultLayout: { name: "relative", columns: 6 },
|
|
62
|
+
},
|
|
63
|
+
"grid-title": {
|
|
64
|
+
name: "grid-title",
|
|
65
|
+
label: "Grid title",
|
|
66
|
+
description: "Grouped ranked lists.",
|
|
67
|
+
controls: ["isNumbered"],
|
|
68
|
+
defaultLayout: { name: "grid-title", isNumbered: true, itemLimit: 3 },
|
|
69
|
+
},
|
|
70
|
+
featured: {
|
|
71
|
+
name: "featured",
|
|
72
|
+
label: "Featured banners",
|
|
73
|
+
description: "Large image banner grid.",
|
|
74
|
+
controls: ["columns"],
|
|
75
|
+
columnOptions: [2, 3],
|
|
76
|
+
defaultLayout: { name: "featured", columns: 3 },
|
|
77
|
+
},
|
|
78
|
+
slide: {
|
|
79
|
+
name: "slide",
|
|
80
|
+
label: "Slide",
|
|
81
|
+
description: "Featured slide/banner collection.",
|
|
82
|
+
controls: ["columns"],
|
|
83
|
+
columnOptions: [2, 3],
|
|
84
|
+
defaultLayout: { name: "slide", columns: 3 },
|
|
85
|
+
},
|
|
86
|
+
"image-grid": {
|
|
87
|
+
name: "image-grid",
|
|
88
|
+
label: "Image grid",
|
|
89
|
+
description: "Collection image links.",
|
|
90
|
+
controls: ["columns", "shape"],
|
|
91
|
+
columnOptions: [3, 4, 5, 6],
|
|
92
|
+
shapeOptions: ["circle", "square"],
|
|
93
|
+
defaultLayout: { name: "image-grid", columns: 4, shape: "circle" },
|
|
94
|
+
},
|
|
95
|
+
"block-grid": {
|
|
96
|
+
name: "block-grid",
|
|
97
|
+
label: "Block grid",
|
|
98
|
+
description: "Small rectangular logo/banner links.",
|
|
99
|
+
controls: ["columns"],
|
|
100
|
+
columnOptions: [3, 4, 5, 6],
|
|
101
|
+
defaultLayout: { name: "block-grid", columns: 4, shape: "rectangle" },
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
export function getCollectionLayoutDefinition(name) {
|
|
105
|
+
return COLLECTION_LAYOUT_DEFINITIONS[name];
|
|
106
|
+
}
|
|
107
|
+
export function getCollectionLayoutControls(name) {
|
|
108
|
+
return COLLECTION_LAYOUT_DEFINITIONS[name]?.controls ?? [];
|
|
109
|
+
}
|
|
110
|
+
export function isCollectionLayoutControlVisible(name, control) {
|
|
111
|
+
return getCollectionLayoutControls(name).includes(control);
|
|
112
|
+
}
|
|
113
|
+
export function getDefaultCollectionLayout(name) {
|
|
114
|
+
return { ...COLLECTION_LAYOUT_DEFINITIONS[name].defaultLayout };
|
|
115
|
+
}
|
|
116
|
+
export function sanitizeCollectionLayout(layout) {
|
|
117
|
+
const definition = COLLECTION_LAYOUT_DEFINITIONS[layout.name];
|
|
118
|
+
if (!definition) {
|
|
119
|
+
return layout;
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
name: layout.name,
|
|
123
|
+
direction: definition.controls.includes("direction") ? layout.direction : undefined,
|
|
124
|
+
isNumbered: definition.controls.includes("isNumbered") ? layout.isNumbered : undefined,
|
|
125
|
+
columns: definition.controls.includes("columns") ? layout.columns : undefined,
|
|
126
|
+
itemLimit: layout.itemLimit,
|
|
127
|
+
shape: definition.controls.includes("shape") ? layout.shape : undefined,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
130
|
//# sourceMappingURL=layoutPresets.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { ImgHTMLAttributes } from "react";
|
|
2
|
-
export interface BookSpineProps {
|
|
3
|
-
src?: string | null;
|
|
4
|
-
alt?: string;
|
|
5
|
-
width?: number;
|
|
6
|
-
height?: number;
|
|
7
|
-
isAudio?: boolean;
|
|
8
|
-
loading?: ImgHTMLAttributes<HTMLImageElement>["loading"];
|
|
9
|
-
className?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function BookSpine({ src, alt, width, height, isAudio, loading, className, }: BookSpineProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import type { ImgHTMLAttributes } from "react";
|
|
2
|
+
export interface BookSpineProps {
|
|
3
|
+
src?: string | null;
|
|
4
|
+
alt?: string;
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
isAudio?: boolean;
|
|
8
|
+
loading?: ImgHTMLAttributes<HTMLImageElement>["loading"];
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function BookSpine({ src, alt, width, height, isAudio, loading, className, }: BookSpineProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
//# sourceMappingURL=BookSpine.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export function BookSpine({ src, alt = "", width = 150, height = 266, isAudio, loading = "lazy", className, }) {
|
|
3
|
-
if (!src) {
|
|
4
|
-
return _jsx("div", { className: "collection-ui-media collection-ui-media--empty" });
|
|
5
|
-
}
|
|
6
|
-
if (isAudio) {
|
|
7
|
-
return (_jsx("div", { className: className ?? "collection-ui-audio-media", style: { width, height: width }, children: _jsx("img", { src: src, alt: alt, loading: loading }) }));
|
|
8
|
-
}
|
|
9
|
-
return (_jsx("div", { className: className ?? "collection-ui-book-media", style: { width, height }, children: _jsx("div", { className: "collection-ui-book-media__artwork", style: { width, height }, children: _jsxs("div", { className: "collection-ui-book-media__lighting", style: { width, height }, children: [_jsx("div", { className: "collection-ui-book-media__background", "aria-hidden": "true", style: { width, height }, children: _jsx("img", { src: src, alt: "", loading: loading, style: { width, height } }) }), _jsx("div", { className: "collection-ui-book-media__foreground", style: { width, height }, children: _jsx("img", { src: src, alt: alt, loading: loading, style: { width, height } }) })] }) }) }));
|
|
10
|
-
}
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function BookSpine({ src, alt = "", width = 150, height = 266, isAudio, loading = "lazy", className, }) {
|
|
3
|
+
if (!src) {
|
|
4
|
+
return _jsx("div", { className: "collection-ui-media collection-ui-media--empty" });
|
|
5
|
+
}
|
|
6
|
+
if (isAudio) {
|
|
7
|
+
return (_jsx("div", { className: className ?? "collection-ui-audio-media", style: { width, height: width }, children: _jsx("img", { src: src, alt: alt, loading: loading }) }));
|
|
8
|
+
}
|
|
9
|
+
return (_jsx("div", { className: className ?? "collection-ui-book-media", style: { width, height }, children: _jsx("div", { className: "collection-ui-book-media__artwork", style: { width, height }, children: _jsxs("div", { className: "collection-ui-book-media__lighting", style: { width, height }, children: [_jsx("div", { className: "collection-ui-book-media__background", "aria-hidden": "true", style: { width, height }, children: _jsx("img", { src: src, alt: "", loading: loading, style: { width, height } }) }), _jsx("div", { className: "collection-ui-book-media__foreground", style: { width, height }, children: _jsx("img", { src: src, alt: alt, loading: loading, style: { width, height } }) })] }) }) }));
|
|
10
|
+
}
|
|
11
11
|
//# sourceMappingURL=BookSpine.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CarouselRenderProps } from "../types";
|
|
2
|
-
export type CollectionCarouselProps = CarouselRenderProps;
|
|
3
|
-
export declare function CollectionCarousel({ id, slides, className, slideClassName, previousLabel, nextLabel, showControls, breakpoints, }: CollectionCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import type { CarouselRenderProps } from "../types";
|
|
2
|
+
export type CollectionCarouselProps = CarouselRenderProps;
|
|
3
|
+
export declare function CollectionCarousel({ id, slides, className, slideClassName, previousLabel, nextLabel, showControls, effect, centeredSlides, loop, autoplay, speed, slidesPerView, slidesPerGroupAuto, spaceBetween, breakpoints, }: CollectionCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
//# sourceMappingURL=CollectionCarousel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionCarousel.d.ts","sourceRoot":"","sources":["../../src/primitives/CollectionCarousel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAE1D,wBAAgB,kBAAkB,CAAC,EACjC,EAAE,EACF,MAAM,EACN,SAAS,EACT,cAAc,EACd,aAAa,EACb,SAAS,EACT,YAAY,EACZ,WAAW,GACZ,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"CollectionCarousel.d.ts","sourceRoot":"","sources":["../../src/primitives/CollectionCarousel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAE1D,wBAAgB,kBAAkB,CAAC,EACjC,EAAE,EACF,MAAM,EACN,SAAS,EACT,cAAc,EACd,aAAa,EACb,SAAS,EACT,YAAY,EACZ,MAAM,EACN,cAAc,EACd,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,WAAW,GACZ,EAAE,uBAAuB,2CAwEzB"}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useId } from "react";
|
|
3
|
-
import { Navigation } from "swiper";
|
|
4
|
-
import { Swiper, SwiperSlide } from "swiper/react";
|
|
5
|
-
export function CollectionCarousel({ id, slides, className, slideClassName, previousLabel, nextLabel, showControls, breakpoints, }) {
|
|
6
|
-
const fallbackId = useId().replaceAll(":", "");
|
|
7
|
-
const carouselId = id || `collection-carousel-${fallbackId}`;
|
|
8
|
-
const isGridTitle = slideClassName?.includes("grid-title");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { Autoplay, EffectCoverflow, Navigation } from "swiper";
|
|
4
|
+
import { Swiper, SwiperSlide } from "swiper/react";
|
|
5
|
+
export function CollectionCarousel({ id, slides, className, slideClassName, previousLabel, nextLabel, showControls, effect, centeredSlides, loop, autoplay, speed, slidesPerView, slidesPerGroupAuto, spaceBetween, breakpoints, }) {
|
|
6
|
+
const fallbackId = useId().replaceAll(":", "");
|
|
7
|
+
const carouselId = id || `collection-carousel-${fallbackId}`;
|
|
8
|
+
const isGridTitle = slideClassName?.includes("grid-title");
|
|
9
|
+
const isBanner = className?.includes("collection-ui-banner-carousel");
|
|
10
|
+
return (_jsxs("div", { className: "collection-ui-carousel", children: [showControls ? (_jsxs("div", { className: "collection-ui-carousel__controls", children: [_jsx("button", { type: "button", "aria-controls": carouselId, "aria-label": previousLabel, className: `collection-ui-carousel__prev-${carouselId}`, children: "<" }), _jsx("button", { type: "button", "aria-controls": carouselId, "aria-label": nextLabel, className: `collection-ui-carousel__next-${carouselId}`, children: ">" })] })) : null, _jsx(Swiper, { id: carouselId, modules: [Navigation, EffectCoverflow, Autoplay], cssMode: !isBanner, effect: effect, navigation: {
|
|
11
|
+
prevEl: `.collection-ui-carousel__prev-${carouselId}`,
|
|
12
|
+
nextEl: `.collection-ui-carousel__next-${carouselId}`,
|
|
13
|
+
}, centeredSlides: centeredSlides, loop: loop, autoplay: autoplay, speed: speed, spaceBetween: spaceBetween ?? (isGridTitle ? 24 : 20), edgeSwipeDetection: "prevent", slidesPerView: slidesPerView ?? (isGridTitle ? 1 : "auto"), slidesPerGroup: 1, slidesPerGroupAuto: slidesPerGroupAuto ?? !isGridTitle, coverflowEffect: effect === "coverflow"
|
|
14
|
+
? {
|
|
15
|
+
rotate: 0,
|
|
16
|
+
stretch: 0,
|
|
17
|
+
depth: 140,
|
|
18
|
+
scale: 0.9,
|
|
19
|
+
modifier: 1,
|
|
20
|
+
slideShadows: false,
|
|
21
|
+
}
|
|
22
|
+
: undefined, className: className ?? "collection-ui-carousel__track", breakpoints: breakpoints, children: slides.map((slide, index) => (_jsx(SwiperSlide, { className: slideClassName ?? "collection-ui-carousel__slide", children: slide }, index))) })] }));
|
|
23
|
+
}
|
|
14
24
|
//# sourceMappingURL=CollectionCarousel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionCarousel.js","sourceRoot":"","sources":["../../src/primitives/CollectionCarousel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"CollectionCarousel.js","sourceRoot":"","sources":["../../src/primitives/CollectionCarousel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKnD,MAAM,UAAU,kBAAkB,CAAC,EACjC,EAAE,EACF,MAAM,EACN,SAAS,EACT,cAAc,EACd,aAAa,EACb,SAAS,EACT,YAAY,EACZ,MAAM,EACN,cAAc,EACd,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