@wix/headless-bookings 0.0.29 → 0.0.30
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/cjs/dist/react/core/service/ServiceMediaCover.d.ts +43 -0
- package/cjs/dist/react/core/service/ServiceMediaCover.js +34 -0
- package/cjs/dist/react/core/service/ServiceMediaGallery.d.ts +50 -0
- package/cjs/dist/react/core/service/ServiceMediaGallery.js +37 -0
- package/cjs/dist/react/core/service/ServiceMediaMain.d.ts +42 -0
- package/cjs/dist/react/core/service/ServiceMediaMain.js +33 -0
- package/cjs/dist/react/index.d.ts +1 -0
- package/cjs/dist/react/index.js +1 -0
- package/cjs/dist/react/service/Service.d.ts +7 -154
- package/cjs/dist/react/service/Service.js +8 -148
- package/cjs/dist/react/service/ServiceMedia.d.ts +191 -0
- package/cjs/dist/react/service/ServiceMedia.js +175 -0
- package/dist/react/core/service/ServiceMediaCover.d.ts +43 -0
- package/dist/react/core/service/ServiceMediaCover.js +34 -0
- package/dist/react/core/service/ServiceMediaGallery.d.ts +50 -0
- package/dist/react/core/service/ServiceMediaGallery.js +37 -0
- package/dist/react/core/service/ServiceMediaMain.d.ts +42 -0
- package/dist/react/core/service/ServiceMediaMain.js +33 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/react/service/Service.d.ts +7 -154
- package/dist/react/service/Service.js +8 -148
- package/dist/react/service/ServiceMedia.d.ts +191 -0
- package/dist/react/service/ServiceMedia.js +175 -0
- package/package.json +2 -2
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ServiceMedia - Compound component for displaying service media
|
|
4
|
+
* Provides components for displaying main media, cover media, and media galleries
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
8
|
+
import { WixMediaImage } from '@wix/headless-media/react';
|
|
9
|
+
import { MediaGallery } from '@wix/headless-media/react';
|
|
10
|
+
import * as CoreServiceMediaMain from '../core/service/ServiceMediaMain.js';
|
|
11
|
+
import * as CoreServiceMediaCover from '../core/service/ServiceMediaCover.js';
|
|
12
|
+
import * as CoreServiceMediaGallery from '../core/service/ServiceMediaGallery.js';
|
|
13
|
+
var TestIds;
|
|
14
|
+
(function (TestIds) {
|
|
15
|
+
TestIds["serviceMediaMain"] = "service-media-main";
|
|
16
|
+
TestIds["serviceMediaCover"] = "service-media-cover";
|
|
17
|
+
})(TestIds || (TestIds = {}));
|
|
18
|
+
/**
|
|
19
|
+
* Displays the service main media image using WixMediaImage.
|
|
20
|
+
*
|
|
21
|
+
* @component
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* // Default usage
|
|
25
|
+
* <ServiceMedia.Main className="w-full h-64 object-cover rounded-lg" />
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // asChild with primitive img element
|
|
31
|
+
* <ServiceMedia.Main asChild>
|
|
32
|
+
* <img className="w-full h-64 object-cover shadow-lg" />
|
|
33
|
+
* </ServiceMedia.Main>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* // asChild with custom component accessing media data
|
|
39
|
+
* <ServiceMedia.Main asChild>
|
|
40
|
+
* {React.forwardRef(({media, ...props}, ref) => (
|
|
41
|
+
* <div ref={ref} {...props} className="relative aspect-video">
|
|
42
|
+
* <WixMediaImage media={media} className="w-full h-full object-cover" />
|
|
43
|
+
* <div className="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/50 p-4">
|
|
44
|
+
* <Service.Name className="text-primary-foreground" />
|
|
45
|
+
* </div>
|
|
46
|
+
* </div>
|
|
47
|
+
* ))}
|
|
48
|
+
* </ServiceMedia.Main>
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export const Main = React.forwardRef((props, ref) => {
|
|
52
|
+
const { asChild, children, className } = props;
|
|
53
|
+
return (_jsx(CoreServiceMediaMain.MainMedia, { children: ({ mainMedia }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceMediaMain, customElement: children, customElementProps: { media: mainMedia }, children: mainMedia?.image ? _jsx(WixMediaImage, { media: mainMedia }) : null })) }));
|
|
54
|
+
});
|
|
55
|
+
Main.displayName = 'ServiceMedia.Main';
|
|
56
|
+
/**
|
|
57
|
+
* Displays the service cover media image using WixMediaImage.
|
|
58
|
+
* The cover media is typically used as a hero/banner image.
|
|
59
|
+
*
|
|
60
|
+
* @component
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* // Default usage
|
|
64
|
+
* <ServiceMedia.Cover className="w-full h-96 object-cover" />
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* // asChild as a background image container
|
|
70
|
+
* <ServiceMedia.Cover asChild>
|
|
71
|
+
* <div className="w-full h-96 bg-cover bg-center" />
|
|
72
|
+
* </ServiceMedia.Cover>
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* // asChild with custom component accessing media data
|
|
78
|
+
* <ServiceMedia.Cover asChild>
|
|
79
|
+
* {React.forwardRef(({media, ...props}, ref) => (
|
|
80
|
+
* <header ref={ref} {...props} className="relative h-96">
|
|
81
|
+
* <WixMediaImage media={media} className="w-full h-full object-cover" />
|
|
82
|
+
* <div className="absolute inset-0 bg-black/40 flex items-center justify-center">
|
|
83
|
+
* <h1 className="text-4xl font-bold text-primary-foreground">
|
|
84
|
+
* <Service.Name />
|
|
85
|
+
* </h1>
|
|
86
|
+
* </div>
|
|
87
|
+
* </header>
|
|
88
|
+
* ))}
|
|
89
|
+
* </ServiceMedia.Cover>
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export const Cover = React.forwardRef((props, ref) => {
|
|
93
|
+
const { asChild, children, className } = props;
|
|
94
|
+
return (_jsx(CoreServiceMediaCover.CoverMedia, { children: ({ coverMedia }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceMediaCover, customElement: children, customElementProps: { media: coverMedia }, children: coverMedia?.image ? _jsx(WixMediaImage, { media: coverMedia }) : null })) }));
|
|
95
|
+
});
|
|
96
|
+
Cover.displayName = 'ServiceMedia.Cover';
|
|
97
|
+
/**
|
|
98
|
+
* Container for service media items gallery.
|
|
99
|
+
* Renders a MediaGallery.Root with the service media items.
|
|
100
|
+
* Supports autoPlay and infinite scroll options for carousel behavior.
|
|
101
|
+
*
|
|
102
|
+
* @component
|
|
103
|
+
* @example
|
|
104
|
+
* ```tsx
|
|
105
|
+
* // Basic usage with MediaGallery components
|
|
106
|
+
* <ServiceMedia.Gallery>
|
|
107
|
+
* <MediaGallery.Thumbnails>
|
|
108
|
+
* <MediaGallery.ThumbnailRepeater>
|
|
109
|
+
* <MediaGallery.ThumbnailItem />
|
|
110
|
+
* </MediaGallery.ThumbnailRepeater>
|
|
111
|
+
* </MediaGallery.Thumbnails>
|
|
112
|
+
* </ServiceMedia.Gallery>
|
|
113
|
+
*
|
|
114
|
+
* // With autoPlay carousel
|
|
115
|
+
* <ServiceMedia.Gallery
|
|
116
|
+
* autoPlay={{ direction: 'forward', intervalMs: 3000 }}
|
|
117
|
+
* infinite
|
|
118
|
+
* >
|
|
119
|
+
* <MediaGallery.Viewport />
|
|
120
|
+
* <MediaGallery.Previous />
|
|
121
|
+
* <MediaGallery.Next />
|
|
122
|
+
* </ServiceMedia.Gallery>
|
|
123
|
+
*
|
|
124
|
+
* // Full gallery with thumbnails and navigation
|
|
125
|
+
* <ServiceMedia.Gallery infinite>
|
|
126
|
+
* <div className="gallery-container">
|
|
127
|
+
* <MediaGallery.Viewport className="main-image" />
|
|
128
|
+
* <div className="controls">
|
|
129
|
+
* <MediaGallery.Previous>Prev</MediaGallery.Previous>
|
|
130
|
+
* <MediaGallery.Next>Next</MediaGallery.Next>
|
|
131
|
+
* </div>
|
|
132
|
+
* <MediaGallery.Thumbnails>
|
|
133
|
+
* <MediaGallery.ThumbnailRepeater>
|
|
134
|
+
* <MediaGallery.ThumbnailItem />
|
|
135
|
+
* </MediaGallery.ThumbnailRepeater>
|
|
136
|
+
* </MediaGallery.Thumbnails>
|
|
137
|
+
* </div>
|
|
138
|
+
* </ServiceMedia.Gallery>
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export const Gallery = (props) => {
|
|
142
|
+
const { children, infinite, autoPlay } = props;
|
|
143
|
+
return (_jsx(CoreServiceMediaGallery.MediaGallery, { children: ({ mediaItems }) => {
|
|
144
|
+
const mediaGalleryServiceConfig = {
|
|
145
|
+
media: mediaItems,
|
|
146
|
+
infinite,
|
|
147
|
+
autoPlay,
|
|
148
|
+
};
|
|
149
|
+
return (_jsx(MediaGallery.Root, { mediaGalleryServiceConfig: mediaGalleryServiceConfig, children: children }));
|
|
150
|
+
} }));
|
|
151
|
+
};
|
|
152
|
+
Gallery.displayName = 'ServiceMedia.Gallery';
|
|
153
|
+
/**
|
|
154
|
+
* ServiceMedia compound component for displaying service media
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```tsx
|
|
158
|
+
* import { Service, ServiceMedia } from '@wix/headless-bookings/react';
|
|
159
|
+
*
|
|
160
|
+
* function ServiceCard({ service }) {
|
|
161
|
+
* return (
|
|
162
|
+
* <Service.Root serviceServiceConfig={{ service }}>
|
|
163
|
+
* <ServiceMedia.Main className="w-full h-48 object-cover" />
|
|
164
|
+
* <Service.Name />
|
|
165
|
+
* </Service.Root>
|
|
166
|
+
* );
|
|
167
|
+
* }
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export const ServiceMedia = {
|
|
171
|
+
Main,
|
|
172
|
+
Cover,
|
|
173
|
+
Gallery,
|
|
174
|
+
};
|
|
175
|
+
export default ServiceMedia;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-bookings",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"groupId": "com.wixpress.headless-components"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
|
-
"falconPackageHash": "
|
|
75
|
+
"falconPackageHash": "d466b4eaebfa6f1258b0d9f3bfa7928fa0f0a6df920e8c143ebb52d0"
|
|
76
76
|
}
|