@ehmetlabs/webf-react-carousel-slider 0.1.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/README.md +157 -0
- package/dist/index.d.mts +297 -0
- package/dist/index.d.ts +297 -0
- package/dist/index.js +139 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +108 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# WebF React Carousel Slider
|
|
2
|
+
|
|
3
|
+
React wrapper for the WebF `<carousel-slider>` custom element. It is intended for WebF environments where the Flutter custom element is registered.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- React >= 16.8
|
|
8
|
+
- react-dom >= 16.8
|
|
9
|
+
- @openwebf/react-core-ui ^0.24.2
|
|
10
|
+
- Flutter-side registration via `webf_carousel_slider` (see `native_uis/webf_carousel_slider`)
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @ehmetlabs/webf-react-carousel-slider
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import React, { useRef } from 'react';
|
|
22
|
+
import {
|
|
23
|
+
CarouselSlider,
|
|
24
|
+
CarouselSliderElement,
|
|
25
|
+
Axis,
|
|
26
|
+
Curve,
|
|
27
|
+
} from '@ehmetlabs/webf-react-carousel-slider';
|
|
28
|
+
|
|
29
|
+
export function App() {
|
|
30
|
+
const ref = useRef<CarouselSliderElement>(null);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<CarouselSlider
|
|
34
|
+
ref={ref}
|
|
35
|
+
autoplay
|
|
36
|
+
autoplayInterval={4}
|
|
37
|
+
aspectRatio={16 / 9}
|
|
38
|
+
viewportFraction={0.8}
|
|
39
|
+
enlargeCenterPage
|
|
40
|
+
scrollDirection={Axis.horizontal}
|
|
41
|
+
autoPlayCurve={Curve.fastOutSlowIn}
|
|
42
|
+
onChange={(event) => {
|
|
43
|
+
console.log(event.detail.index, event.detail.reason);
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<img src="https://example.com/1.jpg" />
|
|
47
|
+
<img src="https://example.com/2.jpg" />
|
|
48
|
+
</CarouselSlider>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Options JSON (batch config + items)
|
|
54
|
+
|
|
55
|
+
If you prefer a single JSON string, use `options`. Keys are camelCase.
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
<CarouselSlider
|
|
59
|
+
options={JSON.stringify({
|
|
60
|
+
autoplay: true,
|
|
61
|
+
autoplayInterval: 3,
|
|
62
|
+
items: [
|
|
63
|
+
{ id: 1, url: 'https://example.com/1.jpg' },
|
|
64
|
+
{ id: 2, url: 'https://example.com/2.jpg' },
|
|
65
|
+
],
|
|
66
|
+
})}
|
|
67
|
+
onItemclick={(event) => {
|
|
68
|
+
console.log('Clicked:', event.detail.id);
|
|
69
|
+
}}
|
|
70
|
+
/>;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Notes:
|
|
74
|
+
|
|
75
|
+
- `items` is used only when there are no children.
|
|
76
|
+
- Invalid JSON triggers an `error` event on the underlying element.
|
|
77
|
+
|
|
78
|
+
## Props
|
|
79
|
+
|
|
80
|
+
All props map to kebab-case attributes on `<carousel-slider>` unless noted.
|
|
81
|
+
|
|
82
|
+
| Prop | Type | Default | Attribute |
|
|
83
|
+
| --- | --- | --- | --- |
|
|
84
|
+
| `currentIndex` | number | 0 | `current-index` |
|
|
85
|
+
| `options` | string (JSON) | - | `options` |
|
|
86
|
+
| `height` | string | - | `height` |
|
|
87
|
+
| `aspectRatio` | number | 16/9 | `aspect-ratio` |
|
|
88
|
+
| `viewportFraction` | number | 0.8 | `viewport-fraction` |
|
|
89
|
+
| `initialPage` | number | 0 | `initial-page` |
|
|
90
|
+
| `padEnds` | boolean | true | `pad-ends` |
|
|
91
|
+
| `disableCenter` | boolean | false | `disable-center` |
|
|
92
|
+
| `enableInfiniteScroll` | boolean | true | `enable-infinite-scroll` |
|
|
93
|
+
| `animateToClosest` | boolean | true | `animate-to-closest` |
|
|
94
|
+
| `reverse` | boolean | false | `reverse` |
|
|
95
|
+
| `scrollDirection` | Axis | Axis.horizontal | `scroll-direction` |
|
|
96
|
+
| `pageSnapping` | boolean | true | `page-snapping` |
|
|
97
|
+
| `scrollPhysics` | string | - | `scroll-physics` |
|
|
98
|
+
| `autoplay` | boolean | false | `autoplay` |
|
|
99
|
+
| `autoplayInterval` | number (seconds) | 4.0 | `autoplay-interval` |
|
|
100
|
+
| `autoPlayAnimationDuration` | number (ms) | 800 | `auto-play-animation-duration` |
|
|
101
|
+
| `autoPlayCurve` | Curve | Curves.fastOutSlowIn | `auto-play-curve` |
|
|
102
|
+
| `pauseAutoPlayOnTouch` | boolean | true | `pause-auto-play-on-touch` |
|
|
103
|
+
| `pauseAutoPlayOnManualNavigate` | boolean | true | `pause-auto-play-on-manual-navigate` |
|
|
104
|
+
| `pauseAutoPlayInFiniteScroll` | boolean | false | `pause-auto-play-in-finite-scroll` |
|
|
105
|
+
| `enlargeCenterPage` | boolean | false | `enlarge-center-page` |
|
|
106
|
+
| `enlargeStrategy` | CenterPageEnlargeStrategy | scale | `enlarge-strategy` |
|
|
107
|
+
| `enlargeFactor` | number | 0.3 | `enlarge-factor` |
|
|
108
|
+
| `id` | string | - | `id` |
|
|
109
|
+
| `className` | string | - | `class` |
|
|
110
|
+
| `style` | React.CSSProperties | - | - |
|
|
111
|
+
| `children` | React.ReactNode | - | - |
|
|
112
|
+
|
|
113
|
+
Value notes:
|
|
114
|
+
|
|
115
|
+
- `scrollDirection`: use `Axis.horizontal` or `Axis.vertical` (strings like `horizontal` are also accepted).
|
|
116
|
+
- `autoPlayCurve`: use `Curve` enum values such as `Curves.fastOutSlowIn`.
|
|
117
|
+
- `enlargeStrategy`: `CenterPageEnlargeStrategy.scale`, `height`, or `zoom`.
|
|
118
|
+
- `scrollPhysics`: `clamping`, `bouncing`, or `fixed`.
|
|
119
|
+
|
|
120
|
+
### Event props
|
|
121
|
+
|
|
122
|
+
| Prop | DOM event | Detail |
|
|
123
|
+
| --- | --- | --- |
|
|
124
|
+
| `onChange` | `change` | `{ index, reason }` |
|
|
125
|
+
| `onSlidestart` | `slidestart` | - |
|
|
126
|
+
| `onSlideend` | `slideend` | - |
|
|
127
|
+
| `onPageanimationstart` | `pageanimationstart` | `{ from, to }` |
|
|
128
|
+
| `onPageanimationend` | `pageanimationend` | `{ index }` |
|
|
129
|
+
| `onAutoplaypause` | `autoplaypause` | - |
|
|
130
|
+
| `onAutoplayresume` | `autoplayresume` | - |
|
|
131
|
+
| `onScrolled` | `scrolled` | `number` |
|
|
132
|
+
| `onItemclick` | `itemclick` | `{ id }` |
|
|
133
|
+
|
|
134
|
+
If you need events not exposed as props (for example, `error`), attach a listener via `ref.current?.addEventListener(...)`.
|
|
135
|
+
|
|
136
|
+
## Ref methods
|
|
137
|
+
|
|
138
|
+
Use a ref to call imperative APIs on the element:
|
|
139
|
+
|
|
140
|
+
- `next()` - next page (fixed 300ms ease animation)
|
|
141
|
+
- `previous()` - previous page (fixed 300ms ease animation)
|
|
142
|
+
- `jumpToPage(page: number)` - jump without animation
|
|
143
|
+
- `pause()` / `resume()` - pause or resume autoplay
|
|
144
|
+
- `startAutoPlay()` / `stopAutoPlay()` - explicit autoplay control
|
|
145
|
+
|
|
146
|
+
## Build
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
npm run build
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Generated files
|
|
153
|
+
|
|
154
|
+
The following files are generated. Do not edit them manually:
|
|
155
|
+
|
|
156
|
+
- `src/index.ts`
|
|
157
|
+
- `src/types.ts`
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WebFElementWithMethods } from '@openwebf/react-core-ui';
|
|
3
|
+
|
|
4
|
+
interface CarouselSliderProps {
|
|
5
|
+
/**
|
|
6
|
+
* Set carousel height. Overrides aspectRatio if provided.
|
|
7
|
+
*/
|
|
8
|
+
height?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Aspect ratio when height is not set.
|
|
11
|
+
* Default: 16 / 9
|
|
12
|
+
*/
|
|
13
|
+
aspectRatio?: number;
|
|
14
|
+
/**
|
|
15
|
+
* The fraction of the viewport that each page should occupy.
|
|
16
|
+
* Default: 0.8 (carousel_slider_plus default)
|
|
17
|
+
*/
|
|
18
|
+
viewportFraction?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The initial page to show.
|
|
21
|
+
* Default: 0
|
|
22
|
+
*/
|
|
23
|
+
initialPage?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Determines if carousel should loop infinitely.
|
|
26
|
+
* Default: true
|
|
27
|
+
*/
|
|
28
|
+
enableInfiniteScroll?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Loop to the closest occurrence of requested page.
|
|
31
|
+
* Default: true
|
|
32
|
+
*/
|
|
33
|
+
animateToClosest?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Reverse the order of items.
|
|
36
|
+
* Default: false
|
|
37
|
+
*/
|
|
38
|
+
reverse?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Enables auto play.
|
|
41
|
+
* Default: false
|
|
42
|
+
*/
|
|
43
|
+
autoPlay?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Frequency of slides in milliseconds.
|
|
46
|
+
* Default: 4000
|
|
47
|
+
*/
|
|
48
|
+
autoPlayInterval?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Animation duration between pages in milliseconds.
|
|
51
|
+
* Default: 800
|
|
52
|
+
*/
|
|
53
|
+
autoPlayAnimationDuration?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Animation curve name.
|
|
56
|
+
* Default: 'fast-out-slow-in'
|
|
57
|
+
*/
|
|
58
|
+
autoPlayCurve?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Whether current page should be larger than side images.
|
|
61
|
+
* Default: false
|
|
62
|
+
*/
|
|
63
|
+
enlargeCenterPage?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Called whenever the page in the center changes.
|
|
66
|
+
*/
|
|
67
|
+
onPageChanged?: any;
|
|
68
|
+
/**
|
|
69
|
+
* Called whenever the carousel is scrolled.
|
|
70
|
+
*/
|
|
71
|
+
onScrolled?: any;
|
|
72
|
+
/**
|
|
73
|
+
* Scroll physics identifier.
|
|
74
|
+
*/
|
|
75
|
+
scrollPhysics?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Set to false to disable page snapping.
|
|
78
|
+
* Default: true
|
|
79
|
+
*/
|
|
80
|
+
pageSnapping?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Axis along which the page view scrolls.
|
|
83
|
+
* Default: 'horizontal'
|
|
84
|
+
*/
|
|
85
|
+
scrollDirection?: 'horizontal' | 'vertical';
|
|
86
|
+
/**
|
|
87
|
+
* Pause auto play on touch.
|
|
88
|
+
* Default: true
|
|
89
|
+
*/
|
|
90
|
+
pauseAutoPlayOnTouch?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Pause auto play on manual navigation.
|
|
93
|
+
* Default: true
|
|
94
|
+
*/
|
|
95
|
+
pauseAutoPlayOnManualNavigate?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* When finite scroll, decide whether auto play loops to first item.
|
|
98
|
+
* Default: false
|
|
99
|
+
*/
|
|
100
|
+
pauseAutoPlayInFiniteScroll?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* PageStorageKey identifier.
|
|
103
|
+
*/
|
|
104
|
+
pageViewKey?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Determine which method to enlarge the center page.
|
|
107
|
+
* Default: 'scale'
|
|
108
|
+
*/
|
|
109
|
+
enlargeStrategy?: 'scale' | 'height' | 'zoom';
|
|
110
|
+
/**
|
|
111
|
+
* How much the pages next to the center page will be scaled down.
|
|
112
|
+
* Default: 0.3
|
|
113
|
+
*/
|
|
114
|
+
enlargeFactor?: number;
|
|
115
|
+
/**
|
|
116
|
+
* Whether to disable the Center widget for each slide.
|
|
117
|
+
* Default: false
|
|
118
|
+
*/
|
|
119
|
+
disableCenter?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Whether to add padding to both ends of the list.
|
|
122
|
+
* Default: true
|
|
123
|
+
*/
|
|
124
|
+
padEnds?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Clip behavior name.
|
|
127
|
+
* Default: 'hardEdge'
|
|
128
|
+
*/
|
|
129
|
+
clipBehavior?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Whether to disable touch gestures.
|
|
132
|
+
* Default: false
|
|
133
|
+
*/
|
|
134
|
+
disableGesture?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Current real page index (read-only).
|
|
137
|
+
*/
|
|
138
|
+
realPage?: number;
|
|
139
|
+
/**
|
|
140
|
+
* HTML id attribute
|
|
141
|
+
*/
|
|
142
|
+
id?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Additional CSS styles
|
|
145
|
+
*/
|
|
146
|
+
style?: React.CSSProperties;
|
|
147
|
+
/**
|
|
148
|
+
* Children elements
|
|
149
|
+
*/
|
|
150
|
+
children?: React.ReactNode;
|
|
151
|
+
/**
|
|
152
|
+
* Additional CSS class names
|
|
153
|
+
*/
|
|
154
|
+
className?: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Element interface with methods/properties accessible via ref
|
|
158
|
+
* @example
|
|
159
|
+
* ```tsx
|
|
160
|
+
* const ref = useRef<CarouselSliderElement>(null);
|
|
161
|
+
* // Call methods on the element
|
|
162
|
+
* ref.current?.finishRefresh('success');
|
|
163
|
+
* // Access properties
|
|
164
|
+
* console.log(ref.current?.height);
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
interface CarouselSliderElement extends WebFElementWithMethods<{
|
|
168
|
+
/**
|
|
169
|
+
* Animates to the next page.
|
|
170
|
+
*/
|
|
171
|
+
nextPage(duration: number, curve: string): void;
|
|
172
|
+
/**
|
|
173
|
+
* Animates to the previous page.
|
|
174
|
+
*/
|
|
175
|
+
previousPage(duration: number, curve: string): void;
|
|
176
|
+
/**
|
|
177
|
+
* Jumps to a specific page without animation.
|
|
178
|
+
*/
|
|
179
|
+
jumpToPage(page: number): void;
|
|
180
|
+
/**
|
|
181
|
+
* Animates to a specific page.
|
|
182
|
+
*/
|
|
183
|
+
animateToPage(page: number, duration: number, curve: string): void;
|
|
184
|
+
/**
|
|
185
|
+
* Starts auto play.
|
|
186
|
+
*/
|
|
187
|
+
startAutoPlay(): void;
|
|
188
|
+
/**
|
|
189
|
+
* Stops auto play.
|
|
190
|
+
*/
|
|
191
|
+
stopAutoPlay(): void;
|
|
192
|
+
}> {
|
|
193
|
+
/** Set carousel height. Overrides aspectRatio if provided. */
|
|
194
|
+
height?: number;
|
|
195
|
+
/** Aspect ratio when height is not set. */
|
|
196
|
+
aspectRatio?: number;
|
|
197
|
+
/** The fraction of the viewport that each page should occupy. */
|
|
198
|
+
viewportFraction?: number;
|
|
199
|
+
/** The initial page to show. */
|
|
200
|
+
initialPage?: number;
|
|
201
|
+
/** Determines if carousel should loop infinitely. */
|
|
202
|
+
enableInfiniteScroll?: boolean;
|
|
203
|
+
/** Loop to the closest occurrence of requested page. */
|
|
204
|
+
animateToClosest?: boolean;
|
|
205
|
+
/** Reverse the order of items. */
|
|
206
|
+
reverse?: boolean;
|
|
207
|
+
/** Enables auto play. */
|
|
208
|
+
autoPlay?: boolean;
|
|
209
|
+
/** Frequency of slides in milliseconds. */
|
|
210
|
+
autoPlayInterval?: number;
|
|
211
|
+
/** Animation duration between pages in milliseconds. */
|
|
212
|
+
autoPlayAnimationDuration?: number;
|
|
213
|
+
/** Animation curve name. */
|
|
214
|
+
autoPlayCurve?: string;
|
|
215
|
+
/** Whether current page should be larger than side images. */
|
|
216
|
+
enlargeCenterPage?: boolean;
|
|
217
|
+
/** Called whenever the page in the center changes. */
|
|
218
|
+
onPageChanged?: any;
|
|
219
|
+
/** Called whenever the carousel is scrolled. */
|
|
220
|
+
onScrolled?: any;
|
|
221
|
+
/** Scroll physics identifier. */
|
|
222
|
+
scrollPhysics?: string;
|
|
223
|
+
/** Set to false to disable page snapping. */
|
|
224
|
+
pageSnapping?: boolean;
|
|
225
|
+
/** Axis along which the page view scrolls. */
|
|
226
|
+
scrollDirection?: 'horizontal' | 'vertical';
|
|
227
|
+
/** Pause auto play on touch. */
|
|
228
|
+
pauseAutoPlayOnTouch?: boolean;
|
|
229
|
+
/** Pause auto play on manual navigation. */
|
|
230
|
+
pauseAutoPlayOnManualNavigate?: boolean;
|
|
231
|
+
/** When finite scroll, decide whether auto play loops to first item. */
|
|
232
|
+
pauseAutoPlayInFiniteScroll?: boolean;
|
|
233
|
+
/** PageStorageKey identifier. */
|
|
234
|
+
pageViewKey?: string;
|
|
235
|
+
/** Determine which method to enlarge the center page. */
|
|
236
|
+
enlargeStrategy?: 'scale' | 'height' | 'zoom';
|
|
237
|
+
/** How much the pages next to the center page will be scaled down. */
|
|
238
|
+
enlargeFactor?: number;
|
|
239
|
+
/** Whether to disable the Center widget for each slide. */
|
|
240
|
+
disableCenter?: boolean;
|
|
241
|
+
/** Whether to add padding to both ends of the list. */
|
|
242
|
+
padEnds?: boolean;
|
|
243
|
+
/** Clip behavior name. */
|
|
244
|
+
clipBehavior?: string;
|
|
245
|
+
/** Whether to disable touch gestures. */
|
|
246
|
+
disableGesture?: boolean;
|
|
247
|
+
/** Current real page index (read-only). */
|
|
248
|
+
readonly realPage?: number;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Properties for <webf-carousel-slider>.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```tsx
|
|
255
|
+
* const ref = useRef<CarouselSliderElement>(null);
|
|
256
|
+
*
|
|
257
|
+
* <CarouselSlider
|
|
258
|
+
* ref={ref}
|
|
259
|
+
* // Add props here
|
|
260
|
+
* >
|
|
261
|
+
* Content
|
|
262
|
+
* </CarouselSlider>
|
|
263
|
+
*
|
|
264
|
+
* // Call methods on the element
|
|
265
|
+
* ref.current?.finishRefresh('success');
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
declare const CarouselSlider: React.ForwardRefExoticComponent<CarouselSliderProps & {
|
|
269
|
+
className?: string;
|
|
270
|
+
style?: React.CSSProperties;
|
|
271
|
+
children?: React.ReactNode;
|
|
272
|
+
} & React.RefAttributes<CarouselSliderElement>>;
|
|
273
|
+
|
|
274
|
+
declare enum CarouselPageChangedReason {
|
|
275
|
+
timed = "timed",
|
|
276
|
+
manual = "manual",
|
|
277
|
+
controller = "controller"
|
|
278
|
+
}
|
|
279
|
+
declare enum CenterPageEnlargeStrategy {
|
|
280
|
+
scale = "scale",
|
|
281
|
+
height = "height",
|
|
282
|
+
zoom = "zoom"
|
|
283
|
+
}
|
|
284
|
+
declare enum Axis {
|
|
285
|
+
horizontal = "Axis.horizontal",
|
|
286
|
+
vertical = "Axis.vertical"
|
|
287
|
+
}
|
|
288
|
+
declare enum Curve {
|
|
289
|
+
ease = "Curves.ease",
|
|
290
|
+
easeIn = "Curves.easeIn",
|
|
291
|
+
easeOut = "Curves.easeOut",
|
|
292
|
+
easeInOut = "Curves.easeInOut",
|
|
293
|
+
fastOutSlowIn = "Curves.fastOutSlowIn",
|
|
294
|
+
linear = "Curves.linear"
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export { Axis, CarouselPageChangedReason, CarouselSlider, type CarouselSliderElement, CenterPageEnlargeStrategy, Curve };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WebFElementWithMethods } from '@openwebf/react-core-ui';
|
|
3
|
+
|
|
4
|
+
interface CarouselSliderProps {
|
|
5
|
+
/**
|
|
6
|
+
* Set carousel height. Overrides aspectRatio if provided.
|
|
7
|
+
*/
|
|
8
|
+
height?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Aspect ratio when height is not set.
|
|
11
|
+
* Default: 16 / 9
|
|
12
|
+
*/
|
|
13
|
+
aspectRatio?: number;
|
|
14
|
+
/**
|
|
15
|
+
* The fraction of the viewport that each page should occupy.
|
|
16
|
+
* Default: 0.8 (carousel_slider_plus default)
|
|
17
|
+
*/
|
|
18
|
+
viewportFraction?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The initial page to show.
|
|
21
|
+
* Default: 0
|
|
22
|
+
*/
|
|
23
|
+
initialPage?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Determines if carousel should loop infinitely.
|
|
26
|
+
* Default: true
|
|
27
|
+
*/
|
|
28
|
+
enableInfiniteScroll?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Loop to the closest occurrence of requested page.
|
|
31
|
+
* Default: true
|
|
32
|
+
*/
|
|
33
|
+
animateToClosest?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Reverse the order of items.
|
|
36
|
+
* Default: false
|
|
37
|
+
*/
|
|
38
|
+
reverse?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Enables auto play.
|
|
41
|
+
* Default: false
|
|
42
|
+
*/
|
|
43
|
+
autoPlay?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Frequency of slides in milliseconds.
|
|
46
|
+
* Default: 4000
|
|
47
|
+
*/
|
|
48
|
+
autoPlayInterval?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Animation duration between pages in milliseconds.
|
|
51
|
+
* Default: 800
|
|
52
|
+
*/
|
|
53
|
+
autoPlayAnimationDuration?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Animation curve name.
|
|
56
|
+
* Default: 'fast-out-slow-in'
|
|
57
|
+
*/
|
|
58
|
+
autoPlayCurve?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Whether current page should be larger than side images.
|
|
61
|
+
* Default: false
|
|
62
|
+
*/
|
|
63
|
+
enlargeCenterPage?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Called whenever the page in the center changes.
|
|
66
|
+
*/
|
|
67
|
+
onPageChanged?: any;
|
|
68
|
+
/**
|
|
69
|
+
* Called whenever the carousel is scrolled.
|
|
70
|
+
*/
|
|
71
|
+
onScrolled?: any;
|
|
72
|
+
/**
|
|
73
|
+
* Scroll physics identifier.
|
|
74
|
+
*/
|
|
75
|
+
scrollPhysics?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Set to false to disable page snapping.
|
|
78
|
+
* Default: true
|
|
79
|
+
*/
|
|
80
|
+
pageSnapping?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Axis along which the page view scrolls.
|
|
83
|
+
* Default: 'horizontal'
|
|
84
|
+
*/
|
|
85
|
+
scrollDirection?: 'horizontal' | 'vertical';
|
|
86
|
+
/**
|
|
87
|
+
* Pause auto play on touch.
|
|
88
|
+
* Default: true
|
|
89
|
+
*/
|
|
90
|
+
pauseAutoPlayOnTouch?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Pause auto play on manual navigation.
|
|
93
|
+
* Default: true
|
|
94
|
+
*/
|
|
95
|
+
pauseAutoPlayOnManualNavigate?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* When finite scroll, decide whether auto play loops to first item.
|
|
98
|
+
* Default: false
|
|
99
|
+
*/
|
|
100
|
+
pauseAutoPlayInFiniteScroll?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* PageStorageKey identifier.
|
|
103
|
+
*/
|
|
104
|
+
pageViewKey?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Determine which method to enlarge the center page.
|
|
107
|
+
* Default: 'scale'
|
|
108
|
+
*/
|
|
109
|
+
enlargeStrategy?: 'scale' | 'height' | 'zoom';
|
|
110
|
+
/**
|
|
111
|
+
* How much the pages next to the center page will be scaled down.
|
|
112
|
+
* Default: 0.3
|
|
113
|
+
*/
|
|
114
|
+
enlargeFactor?: number;
|
|
115
|
+
/**
|
|
116
|
+
* Whether to disable the Center widget for each slide.
|
|
117
|
+
* Default: false
|
|
118
|
+
*/
|
|
119
|
+
disableCenter?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Whether to add padding to both ends of the list.
|
|
122
|
+
* Default: true
|
|
123
|
+
*/
|
|
124
|
+
padEnds?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Clip behavior name.
|
|
127
|
+
* Default: 'hardEdge'
|
|
128
|
+
*/
|
|
129
|
+
clipBehavior?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Whether to disable touch gestures.
|
|
132
|
+
* Default: false
|
|
133
|
+
*/
|
|
134
|
+
disableGesture?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Current real page index (read-only).
|
|
137
|
+
*/
|
|
138
|
+
realPage?: number;
|
|
139
|
+
/**
|
|
140
|
+
* HTML id attribute
|
|
141
|
+
*/
|
|
142
|
+
id?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Additional CSS styles
|
|
145
|
+
*/
|
|
146
|
+
style?: React.CSSProperties;
|
|
147
|
+
/**
|
|
148
|
+
* Children elements
|
|
149
|
+
*/
|
|
150
|
+
children?: React.ReactNode;
|
|
151
|
+
/**
|
|
152
|
+
* Additional CSS class names
|
|
153
|
+
*/
|
|
154
|
+
className?: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Element interface with methods/properties accessible via ref
|
|
158
|
+
* @example
|
|
159
|
+
* ```tsx
|
|
160
|
+
* const ref = useRef<CarouselSliderElement>(null);
|
|
161
|
+
* // Call methods on the element
|
|
162
|
+
* ref.current?.finishRefresh('success');
|
|
163
|
+
* // Access properties
|
|
164
|
+
* console.log(ref.current?.height);
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
interface CarouselSliderElement extends WebFElementWithMethods<{
|
|
168
|
+
/**
|
|
169
|
+
* Animates to the next page.
|
|
170
|
+
*/
|
|
171
|
+
nextPage(duration: number, curve: string): void;
|
|
172
|
+
/**
|
|
173
|
+
* Animates to the previous page.
|
|
174
|
+
*/
|
|
175
|
+
previousPage(duration: number, curve: string): void;
|
|
176
|
+
/**
|
|
177
|
+
* Jumps to a specific page without animation.
|
|
178
|
+
*/
|
|
179
|
+
jumpToPage(page: number): void;
|
|
180
|
+
/**
|
|
181
|
+
* Animates to a specific page.
|
|
182
|
+
*/
|
|
183
|
+
animateToPage(page: number, duration: number, curve: string): void;
|
|
184
|
+
/**
|
|
185
|
+
* Starts auto play.
|
|
186
|
+
*/
|
|
187
|
+
startAutoPlay(): void;
|
|
188
|
+
/**
|
|
189
|
+
* Stops auto play.
|
|
190
|
+
*/
|
|
191
|
+
stopAutoPlay(): void;
|
|
192
|
+
}> {
|
|
193
|
+
/** Set carousel height. Overrides aspectRatio if provided. */
|
|
194
|
+
height?: number;
|
|
195
|
+
/** Aspect ratio when height is not set. */
|
|
196
|
+
aspectRatio?: number;
|
|
197
|
+
/** The fraction of the viewport that each page should occupy. */
|
|
198
|
+
viewportFraction?: number;
|
|
199
|
+
/** The initial page to show. */
|
|
200
|
+
initialPage?: number;
|
|
201
|
+
/** Determines if carousel should loop infinitely. */
|
|
202
|
+
enableInfiniteScroll?: boolean;
|
|
203
|
+
/** Loop to the closest occurrence of requested page. */
|
|
204
|
+
animateToClosest?: boolean;
|
|
205
|
+
/** Reverse the order of items. */
|
|
206
|
+
reverse?: boolean;
|
|
207
|
+
/** Enables auto play. */
|
|
208
|
+
autoPlay?: boolean;
|
|
209
|
+
/** Frequency of slides in milliseconds. */
|
|
210
|
+
autoPlayInterval?: number;
|
|
211
|
+
/** Animation duration between pages in milliseconds. */
|
|
212
|
+
autoPlayAnimationDuration?: number;
|
|
213
|
+
/** Animation curve name. */
|
|
214
|
+
autoPlayCurve?: string;
|
|
215
|
+
/** Whether current page should be larger than side images. */
|
|
216
|
+
enlargeCenterPage?: boolean;
|
|
217
|
+
/** Called whenever the page in the center changes. */
|
|
218
|
+
onPageChanged?: any;
|
|
219
|
+
/** Called whenever the carousel is scrolled. */
|
|
220
|
+
onScrolled?: any;
|
|
221
|
+
/** Scroll physics identifier. */
|
|
222
|
+
scrollPhysics?: string;
|
|
223
|
+
/** Set to false to disable page snapping. */
|
|
224
|
+
pageSnapping?: boolean;
|
|
225
|
+
/** Axis along which the page view scrolls. */
|
|
226
|
+
scrollDirection?: 'horizontal' | 'vertical';
|
|
227
|
+
/** Pause auto play on touch. */
|
|
228
|
+
pauseAutoPlayOnTouch?: boolean;
|
|
229
|
+
/** Pause auto play on manual navigation. */
|
|
230
|
+
pauseAutoPlayOnManualNavigate?: boolean;
|
|
231
|
+
/** When finite scroll, decide whether auto play loops to first item. */
|
|
232
|
+
pauseAutoPlayInFiniteScroll?: boolean;
|
|
233
|
+
/** PageStorageKey identifier. */
|
|
234
|
+
pageViewKey?: string;
|
|
235
|
+
/** Determine which method to enlarge the center page. */
|
|
236
|
+
enlargeStrategy?: 'scale' | 'height' | 'zoom';
|
|
237
|
+
/** How much the pages next to the center page will be scaled down. */
|
|
238
|
+
enlargeFactor?: number;
|
|
239
|
+
/** Whether to disable the Center widget for each slide. */
|
|
240
|
+
disableCenter?: boolean;
|
|
241
|
+
/** Whether to add padding to both ends of the list. */
|
|
242
|
+
padEnds?: boolean;
|
|
243
|
+
/** Clip behavior name. */
|
|
244
|
+
clipBehavior?: string;
|
|
245
|
+
/** Whether to disable touch gestures. */
|
|
246
|
+
disableGesture?: boolean;
|
|
247
|
+
/** Current real page index (read-only). */
|
|
248
|
+
readonly realPage?: number;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Properties for <webf-carousel-slider>.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```tsx
|
|
255
|
+
* const ref = useRef<CarouselSliderElement>(null);
|
|
256
|
+
*
|
|
257
|
+
* <CarouselSlider
|
|
258
|
+
* ref={ref}
|
|
259
|
+
* // Add props here
|
|
260
|
+
* >
|
|
261
|
+
* Content
|
|
262
|
+
* </CarouselSlider>
|
|
263
|
+
*
|
|
264
|
+
* // Call methods on the element
|
|
265
|
+
* ref.current?.finishRefresh('success');
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
declare const CarouselSlider: React.ForwardRefExoticComponent<CarouselSliderProps & {
|
|
269
|
+
className?: string;
|
|
270
|
+
style?: React.CSSProperties;
|
|
271
|
+
children?: React.ReactNode;
|
|
272
|
+
} & React.RefAttributes<CarouselSliderElement>>;
|
|
273
|
+
|
|
274
|
+
declare enum CarouselPageChangedReason {
|
|
275
|
+
timed = "timed",
|
|
276
|
+
manual = "manual",
|
|
277
|
+
controller = "controller"
|
|
278
|
+
}
|
|
279
|
+
declare enum CenterPageEnlargeStrategy {
|
|
280
|
+
scale = "scale",
|
|
281
|
+
height = "height",
|
|
282
|
+
zoom = "zoom"
|
|
283
|
+
}
|
|
284
|
+
declare enum Axis {
|
|
285
|
+
horizontal = "Axis.horizontal",
|
|
286
|
+
vertical = "Axis.vertical"
|
|
287
|
+
}
|
|
288
|
+
declare enum Curve {
|
|
289
|
+
ease = "Curves.ease",
|
|
290
|
+
easeIn = "Curves.easeIn",
|
|
291
|
+
easeOut = "Curves.easeOut",
|
|
292
|
+
easeInOut = "Curves.easeInOut",
|
|
293
|
+
fastOutSlowIn = "Curves.fastOutSlowIn",
|
|
294
|
+
linear = "Curves.linear"
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export { Axis, CarouselPageChangedReason, CarouselSlider, type CarouselSliderElement, CenterPageEnlargeStrategy, Curve };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Axis: () => Axis,
|
|
24
|
+
CarouselPageChangedReason: () => CarouselPageChangedReason,
|
|
25
|
+
CarouselSlider: () => CarouselSlider,
|
|
26
|
+
CenterPageEnlargeStrategy: () => CenterPageEnlargeStrategy,
|
|
27
|
+
Curve: () => Curve
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(index_exports);
|
|
30
|
+
|
|
31
|
+
// src/lib/src/carousel_slider.tsx
|
|
32
|
+
var import_react_core_ui = require("@openwebf/react-core-ui");
|
|
33
|
+
var CarouselSlider = (0, import_react_core_ui.createWebFComponent)({
|
|
34
|
+
tagName: "carousel-slider",
|
|
35
|
+
displayName: "CarouselSlider",
|
|
36
|
+
// Map props to attributes
|
|
37
|
+
attributeProps: [
|
|
38
|
+
"height",
|
|
39
|
+
"aspectRatio",
|
|
40
|
+
"viewportFraction",
|
|
41
|
+
"initialPage",
|
|
42
|
+
"enableInfiniteScroll",
|
|
43
|
+
"animateToClosest",
|
|
44
|
+
"reverse",
|
|
45
|
+
"autoPlay",
|
|
46
|
+
"autoPlayInterval",
|
|
47
|
+
"autoPlayAnimationDuration",
|
|
48
|
+
"autoPlayCurve",
|
|
49
|
+
"enlargeCenterPage",
|
|
50
|
+
"onPageChanged",
|
|
51
|
+
"onScrolled",
|
|
52
|
+
"scrollPhysics",
|
|
53
|
+
"pageSnapping",
|
|
54
|
+
"scrollDirection",
|
|
55
|
+
"pauseAutoPlayOnTouch",
|
|
56
|
+
"pauseAutoPlayOnManualNavigate",
|
|
57
|
+
"pauseAutoPlayInFiniteScroll",
|
|
58
|
+
"pageViewKey",
|
|
59
|
+
"enlargeStrategy",
|
|
60
|
+
"enlargeFactor",
|
|
61
|
+
"disableCenter",
|
|
62
|
+
"padEnds",
|
|
63
|
+
"clipBehavior",
|
|
64
|
+
"disableGesture",
|
|
65
|
+
"realPage"
|
|
66
|
+
],
|
|
67
|
+
// Convert prop names to attribute names if needed
|
|
68
|
+
attributeMap: {
|
|
69
|
+
aspectRatio: "aspect-ratio",
|
|
70
|
+
viewportFraction: "viewport-fraction",
|
|
71
|
+
initialPage: "initial-page",
|
|
72
|
+
enableInfiniteScroll: "enable-infinite-scroll",
|
|
73
|
+
animateToClosest: "animate-to-closest",
|
|
74
|
+
autoPlay: "auto-play",
|
|
75
|
+
autoPlayInterval: "auto-play-interval",
|
|
76
|
+
autoPlayAnimationDuration: "auto-play-animation-duration",
|
|
77
|
+
autoPlayCurve: "auto-play-curve",
|
|
78
|
+
enlargeCenterPage: "enlarge-center-page",
|
|
79
|
+
onPageChanged: "on-page-changed",
|
|
80
|
+
onScrolled: "on-scrolled",
|
|
81
|
+
scrollPhysics: "scroll-physics",
|
|
82
|
+
pageSnapping: "page-snapping",
|
|
83
|
+
scrollDirection: "scroll-direction",
|
|
84
|
+
pauseAutoPlayOnTouch: "pause-auto-play-on-touch",
|
|
85
|
+
pauseAutoPlayOnManualNavigate: "pause-auto-play-on-manual-navigate",
|
|
86
|
+
pauseAutoPlayInFiniteScroll: "pause-auto-play-in-finite-scroll",
|
|
87
|
+
pageViewKey: "page-view-key",
|
|
88
|
+
enlargeStrategy: "enlarge-strategy",
|
|
89
|
+
enlargeFactor: "enlarge-factor",
|
|
90
|
+
disableCenter: "disable-center",
|
|
91
|
+
padEnds: "pad-ends",
|
|
92
|
+
clipBehavior: "clip-behavior",
|
|
93
|
+
disableGesture: "disable-gesture",
|
|
94
|
+
realPage: "real-page"
|
|
95
|
+
},
|
|
96
|
+
// Event handlers
|
|
97
|
+
events: [],
|
|
98
|
+
// Default prop values
|
|
99
|
+
defaultProps: {
|
|
100
|
+
// Add default values here
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// src/types.ts
|
|
105
|
+
var CarouselPageChangedReason = /* @__PURE__ */ ((CarouselPageChangedReason2) => {
|
|
106
|
+
CarouselPageChangedReason2["timed"] = "timed";
|
|
107
|
+
CarouselPageChangedReason2["manual"] = "manual";
|
|
108
|
+
CarouselPageChangedReason2["controller"] = "controller";
|
|
109
|
+
return CarouselPageChangedReason2;
|
|
110
|
+
})(CarouselPageChangedReason || {});
|
|
111
|
+
var CenterPageEnlargeStrategy = /* @__PURE__ */ ((CenterPageEnlargeStrategy2) => {
|
|
112
|
+
CenterPageEnlargeStrategy2["scale"] = "scale";
|
|
113
|
+
CenterPageEnlargeStrategy2["height"] = "height";
|
|
114
|
+
CenterPageEnlargeStrategy2["zoom"] = "zoom";
|
|
115
|
+
return CenterPageEnlargeStrategy2;
|
|
116
|
+
})(CenterPageEnlargeStrategy || {});
|
|
117
|
+
var Axis = /* @__PURE__ */ ((Axis2) => {
|
|
118
|
+
Axis2["horizontal"] = "Axis.horizontal";
|
|
119
|
+
Axis2["vertical"] = "Axis.vertical";
|
|
120
|
+
return Axis2;
|
|
121
|
+
})(Axis || {});
|
|
122
|
+
var Curve = /* @__PURE__ */ ((Curve2) => {
|
|
123
|
+
Curve2["ease"] = "Curves.ease";
|
|
124
|
+
Curve2["easeIn"] = "Curves.easeIn";
|
|
125
|
+
Curve2["easeOut"] = "Curves.easeOut";
|
|
126
|
+
Curve2["easeInOut"] = "Curves.easeInOut";
|
|
127
|
+
Curve2["fastOutSlowIn"] = "Curves.fastOutSlowIn";
|
|
128
|
+
Curve2["linear"] = "Curves.linear";
|
|
129
|
+
return Curve2;
|
|
130
|
+
})(Curve || {});
|
|
131
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
132
|
+
0 && (module.exports = {
|
|
133
|
+
Axis,
|
|
134
|
+
CarouselPageChangedReason,
|
|
135
|
+
CarouselSlider,
|
|
136
|
+
CenterPageEnlargeStrategy,
|
|
137
|
+
Curve
|
|
138
|
+
});
|
|
139
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/lib/src/carousel_slider.tsx","../src/types.ts"],"sourcesContent":["/*\n * Generated by TSDL, don't edit this file directly.\n */\n\n\nexport { CarouselSlider, CarouselSliderElement } from \"./lib/src/carousel_slider\";\nexport * from './types';\n","import React from \"react\";\nimport { createWebFComponent, WebFElementWithMethods } from \"@openwebf/react-core-ui\";\nimport * as __webfTypes from \"../../types\";\ntype CarouselPageChangedReason = \"timed\" | \"manual\" | \"controller\";\ntype CenterPageEnlargeStrategy = \"scale\" | \"height\" | \"zoom\";\n/**\n * Methods for <webf-carousel-slider>.\n */\ninterface CarouselSliderMethods {\n /**\n * Animates to the next page.\n */\n nextPage(duration: number, curve: string): void;\n /**\n * Animates to the previous page.\n */\n previousPage(duration: number, curve: string): void;\n /**\n * Jumps to a specific page without animation.\n */\n jumpToPage(page: number): void;\n /**\n * Animates to a specific page.\n */\n animateToPage(page: number, duration: number, curve: string): void;\n /**\n * Starts auto play.\n */\n startAutoPlay(): void;\n /**\n * Stops auto play.\n */\n stopAutoPlay(): void;\n}\nexport interface CarouselSliderProps {\n /**\n * Set carousel height. Overrides aspectRatio if provided.\n */\n height?: number;\n /**\n * Aspect ratio when height is not set.\n * Default: 16 / 9\n */\n aspectRatio?: number;\n /**\n * The fraction of the viewport that each page should occupy.\n * Default: 0.8 (carousel_slider_plus default)\n */\n viewportFraction?: number;\n /**\n * The initial page to show.\n * Default: 0\n */\n initialPage?: number;\n /**\n * Determines if carousel should loop infinitely.\n * Default: true\n */\n enableInfiniteScroll?: boolean;\n /**\n * Loop to the closest occurrence of requested page.\n * Default: true\n */\n animateToClosest?: boolean;\n /**\n * Reverse the order of items.\n * Default: false\n */\n reverse?: boolean;\n /**\n * Enables auto play.\n * Default: false\n */\n autoPlay?: boolean;\n /**\n * Frequency of slides in milliseconds.\n * Default: 4000\n */\n autoPlayInterval?: number;\n /**\n * Animation duration between pages in milliseconds.\n * Default: 800\n */\n autoPlayAnimationDuration?: number;\n /**\n * Animation curve name.\n * Default: 'fast-out-slow-in'\n */\n autoPlayCurve?: string;\n /**\n * Whether current page should be larger than side images.\n * Default: false\n */\n enlargeCenterPage?: boolean;\n /**\n * Called whenever the page in the center changes.\n */\n onPageChanged?: any;\n /**\n * Called whenever the carousel is scrolled.\n */\n onScrolled?: any;\n /**\n * Scroll physics identifier.\n */\n scrollPhysics?: string;\n /**\n * Set to false to disable page snapping.\n * Default: true\n */\n pageSnapping?: boolean;\n /**\n * Axis along which the page view scrolls.\n * Default: 'horizontal'\n */\n scrollDirection?: 'horizontal' | 'vertical';\n /**\n * Pause auto play on touch.\n * Default: true\n */\n pauseAutoPlayOnTouch?: boolean;\n /**\n * Pause auto play on manual navigation.\n * Default: true\n */\n pauseAutoPlayOnManualNavigate?: boolean;\n /**\n * When finite scroll, decide whether auto play loops to first item.\n * Default: false\n */\n pauseAutoPlayInFiniteScroll?: boolean;\n /**\n * PageStorageKey identifier.\n */\n pageViewKey?: string;\n /**\n * Determine which method to enlarge the center page.\n * Default: 'scale'\n */\n enlargeStrategy?: 'scale' | 'height' | 'zoom';\n /**\n * How much the pages next to the center page will be scaled down.\n * Default: 0.3\n */\n enlargeFactor?: number;\n /**\n * Whether to disable the Center widget for each slide.\n * Default: false\n */\n disableCenter?: boolean;\n /**\n * Whether to add padding to both ends of the list.\n * Default: true\n */\n padEnds?: boolean;\n /**\n * Clip behavior name.\n * Default: 'hardEdge'\n */\n clipBehavior?: string;\n /**\n * Whether to disable touch gestures.\n * Default: false\n */\n disableGesture?: boolean;\n /**\n * Current real page index (read-only).\n */\n realPage?: number;\n /**\n * HTML id attribute\n */\n id?: string;\n /**\n * Additional CSS styles\n */\n style?: React.CSSProperties;\n /**\n * Children elements\n */\n children?: React.ReactNode;\n /**\n * Additional CSS class names\n */\n className?: string;\n}\n/**\n * Element interface with methods/properties accessible via ref\n * @example\n * ```tsx\n * const ref = useRef<CarouselSliderElement>(null);\n * // Call methods on the element\n * ref.current?.finishRefresh('success');\n * // Access properties\n * console.log(ref.current?.height);\n * ```\n */\nexport interface CarouselSliderElement extends WebFElementWithMethods<{\n /**\n * Animates to the next page.\n */\n nextPage(duration: number, curve: string): void;\n /**\n * Animates to the previous page.\n */\n previousPage(duration: number, curve: string): void;\n /**\n * Jumps to a specific page without animation.\n */\n jumpToPage(page: number): void;\n /**\n * Animates to a specific page.\n */\n animateToPage(page: number, duration: number, curve: string): void;\n /**\n * Starts auto play.\n */\n startAutoPlay(): void;\n /**\n * Stops auto play.\n */\n stopAutoPlay(): void;\n}> {\n /** Set carousel height. Overrides aspectRatio if provided. */\n height?: number;\n /** Aspect ratio when height is not set. */\n aspectRatio?: number;\n /** The fraction of the viewport that each page should occupy. */\n viewportFraction?: number;\n /** The initial page to show. */\n initialPage?: number;\n /** Determines if carousel should loop infinitely. */\n enableInfiniteScroll?: boolean;\n /** Loop to the closest occurrence of requested page. */\n animateToClosest?: boolean;\n /** Reverse the order of items. */\n reverse?: boolean;\n /** Enables auto play. */\n autoPlay?: boolean;\n /** Frequency of slides in milliseconds. */\n autoPlayInterval?: number;\n /** Animation duration between pages in milliseconds. */\n autoPlayAnimationDuration?: number;\n /** Animation curve name. */\n autoPlayCurve?: string;\n /** Whether current page should be larger than side images. */\n enlargeCenterPage?: boolean;\n /** Called whenever the page in the center changes. */\n onPageChanged?: any;\n /** Called whenever the carousel is scrolled. */\n onScrolled?: any;\n /** Scroll physics identifier. */\n scrollPhysics?: string;\n /** Set to false to disable page snapping. */\n pageSnapping?: boolean;\n /** Axis along which the page view scrolls. */\n scrollDirection?: 'horizontal' | 'vertical';\n /** Pause auto play on touch. */\n pauseAutoPlayOnTouch?: boolean;\n /** Pause auto play on manual navigation. */\n pauseAutoPlayOnManualNavigate?: boolean;\n /** When finite scroll, decide whether auto play loops to first item. */\n pauseAutoPlayInFiniteScroll?: boolean;\n /** PageStorageKey identifier. */\n pageViewKey?: string;\n /** Determine which method to enlarge the center page. */\n enlargeStrategy?: 'scale' | 'height' | 'zoom';\n /** How much the pages next to the center page will be scaled down. */\n enlargeFactor?: number;\n /** Whether to disable the Center widget for each slide. */\n disableCenter?: boolean;\n /** Whether to add padding to both ends of the list. */\n padEnds?: boolean;\n /** Clip behavior name. */\n clipBehavior?: string;\n /** Whether to disable touch gestures. */\n disableGesture?: boolean;\n /** Current real page index (read-only). */\n readonly realPage?: number;\n}\n/**\n * Properties for <webf-carousel-slider>.\n * \n * @example\n * ```tsx\n * const ref = useRef<CarouselSliderElement>(null);\n * \n * <CarouselSlider\n * ref={ref}\n * // Add props here\n * >\n * Content\n * </CarouselSlider>\n * \n * // Call methods on the element\n * ref.current?.finishRefresh('success');\n * ```\n */\nexport const CarouselSlider = createWebFComponent<CarouselSliderElement, CarouselSliderProps>({\n tagName: 'carousel-slider',\n displayName: 'CarouselSlider',\n // Map props to attributes\n attributeProps: [\n 'height',\n 'aspectRatio',\n 'viewportFraction',\n 'initialPage',\n 'enableInfiniteScroll',\n 'animateToClosest',\n 'reverse',\n 'autoPlay',\n 'autoPlayInterval',\n 'autoPlayAnimationDuration',\n 'autoPlayCurve',\n 'enlargeCenterPage',\n 'onPageChanged',\n 'onScrolled',\n 'scrollPhysics',\n 'pageSnapping',\n 'scrollDirection',\n 'pauseAutoPlayOnTouch',\n 'pauseAutoPlayOnManualNavigate',\n 'pauseAutoPlayInFiniteScroll',\n 'pageViewKey',\n 'enlargeStrategy',\n 'enlargeFactor',\n 'disableCenter',\n 'padEnds',\n 'clipBehavior',\n 'disableGesture',\n 'realPage',\n ],\n // Convert prop names to attribute names if needed\n attributeMap: {\n aspectRatio: 'aspect-ratio',\n viewportFraction: 'viewport-fraction',\n initialPage: 'initial-page',\n enableInfiniteScroll: 'enable-infinite-scroll',\n animateToClosest: 'animate-to-closest',\n autoPlay: 'auto-play',\n autoPlayInterval: 'auto-play-interval',\n autoPlayAnimationDuration: 'auto-play-animation-duration',\n autoPlayCurve: 'auto-play-curve',\n enlargeCenterPage: 'enlarge-center-page',\n onPageChanged: 'on-page-changed',\n onScrolled: 'on-scrolled',\n scrollPhysics: 'scroll-physics',\n pageSnapping: 'page-snapping',\n scrollDirection: 'scroll-direction',\n pauseAutoPlayOnTouch: 'pause-auto-play-on-touch',\n pauseAutoPlayOnManualNavigate: 'pause-auto-play-on-manual-navigate',\n pauseAutoPlayInFiniteScroll: 'pause-auto-play-in-finite-scroll',\n pageViewKey: 'page-view-key',\n enlargeStrategy: 'enlarge-strategy',\n enlargeFactor: 'enlarge-factor',\n disableCenter: 'disable-center',\n padEnds: 'pad-ends',\n clipBehavior: 'clip-behavior',\n disableGesture: 'disable-gesture',\n realPage: 'real-page',\n },\n // Event handlers\n events: [\n ],\n // Default prop values\n defaultProps: {\n // Add default values here\n },\n});","/* Generated by WebF CLI - aggregated type declarations */\nexport enum CarouselPageChangedReason { timed = 'timed', manual = 'manual', controller = 'controller' }\nexport enum CenterPageEnlargeStrategy { scale = 'scale', height = 'height', zoom = 'zoom' }\nexport enum Axis { horizontal = 'Axis.horizontal', vertical = 'Axis.vertical' }\nexport enum Curve { ease = 'Curves.ease', easeIn = 'Curves.easeIn', easeOut = 'Curves.easeOut', easeInOut = 'Curves.easeInOut', fastOutSlowIn = 'Curves.fastOutSlowIn', linear = 'Curves.linear' }"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,2BAA4D;AAySrD,IAAM,qBAAiB,0CAAgE;AAAA,EAC5F,SAAS;AAAA,EACT,aAAa;AAAA;AAAA,EAEb,gBAAgB;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA;AAAA,EAEA,cAAc;AAAA,IACZ,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,kBAAkB;AAAA,IAClB,UAAU;AAAA,IACV,kBAAkB;AAAA,IAClB,2BAA2B;AAAA,IAC3B,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,sBAAsB;AAAA,IACtB,+BAA+B;AAAA,IAC/B,6BAA6B;AAAA,IAC7B,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,eAAe;AAAA,IACf,SAAS;AAAA,IACT,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,UAAU;AAAA,EACZ;AAAA;AAAA,EAEA,QAAQ,CACR;AAAA;AAAA,EAEA,cAAc;AAAA;AAAA,EAEd;AACF,CAAC;;;AC/WM,IAAK,4BAAL,kBAAKA,+BAAL;AAAiC,EAAAA,2BAAA,WAAQ;AAAS,EAAAA,2BAAA,YAAS;AAAU,EAAAA,2BAAA,gBAAa;AAA7E,SAAAA;AAAA,GAAA;AACL,IAAK,4BAAL,kBAAKC,+BAAL;AAAiC,EAAAA,2BAAA,WAAQ;AAAS,EAAAA,2BAAA,YAAS;AAAU,EAAAA,2BAAA,UAAO;AAAvE,SAAAA;AAAA,GAAA;AACL,IAAK,OAAL,kBAAKC,UAAL;AAAY,EAAAA,MAAA,gBAAa;AAAmB,EAAAA,MAAA,cAAW;AAAlD,SAAAA;AAAA,GAAA;AACL,IAAK,QAAL,kBAAKC,WAAL;AAAa,EAAAA,OAAA,UAAO;AAAe,EAAAA,OAAA,YAAS;AAAiB,EAAAA,OAAA,aAAU;AAAkB,EAAAA,OAAA,eAAY;AAAoB,EAAAA,OAAA,mBAAgB;AAAwB,EAAAA,OAAA,YAAS;AAArK,SAAAA;AAAA,GAAA;","names":["CarouselPageChangedReason","CenterPageEnlargeStrategy","Axis","Curve"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// src/lib/src/carousel_slider.tsx
|
|
2
|
+
import { createWebFComponent } from "@openwebf/react-core-ui";
|
|
3
|
+
var CarouselSlider = createWebFComponent({
|
|
4
|
+
tagName: "carousel-slider",
|
|
5
|
+
displayName: "CarouselSlider",
|
|
6
|
+
// Map props to attributes
|
|
7
|
+
attributeProps: [
|
|
8
|
+
"height",
|
|
9
|
+
"aspectRatio",
|
|
10
|
+
"viewportFraction",
|
|
11
|
+
"initialPage",
|
|
12
|
+
"enableInfiniteScroll",
|
|
13
|
+
"animateToClosest",
|
|
14
|
+
"reverse",
|
|
15
|
+
"autoPlay",
|
|
16
|
+
"autoPlayInterval",
|
|
17
|
+
"autoPlayAnimationDuration",
|
|
18
|
+
"autoPlayCurve",
|
|
19
|
+
"enlargeCenterPage",
|
|
20
|
+
"onPageChanged",
|
|
21
|
+
"onScrolled",
|
|
22
|
+
"scrollPhysics",
|
|
23
|
+
"pageSnapping",
|
|
24
|
+
"scrollDirection",
|
|
25
|
+
"pauseAutoPlayOnTouch",
|
|
26
|
+
"pauseAutoPlayOnManualNavigate",
|
|
27
|
+
"pauseAutoPlayInFiniteScroll",
|
|
28
|
+
"pageViewKey",
|
|
29
|
+
"enlargeStrategy",
|
|
30
|
+
"enlargeFactor",
|
|
31
|
+
"disableCenter",
|
|
32
|
+
"padEnds",
|
|
33
|
+
"clipBehavior",
|
|
34
|
+
"disableGesture",
|
|
35
|
+
"realPage"
|
|
36
|
+
],
|
|
37
|
+
// Convert prop names to attribute names if needed
|
|
38
|
+
attributeMap: {
|
|
39
|
+
aspectRatio: "aspect-ratio",
|
|
40
|
+
viewportFraction: "viewport-fraction",
|
|
41
|
+
initialPage: "initial-page",
|
|
42
|
+
enableInfiniteScroll: "enable-infinite-scroll",
|
|
43
|
+
animateToClosest: "animate-to-closest",
|
|
44
|
+
autoPlay: "auto-play",
|
|
45
|
+
autoPlayInterval: "auto-play-interval",
|
|
46
|
+
autoPlayAnimationDuration: "auto-play-animation-duration",
|
|
47
|
+
autoPlayCurve: "auto-play-curve",
|
|
48
|
+
enlargeCenterPage: "enlarge-center-page",
|
|
49
|
+
onPageChanged: "on-page-changed",
|
|
50
|
+
onScrolled: "on-scrolled",
|
|
51
|
+
scrollPhysics: "scroll-physics",
|
|
52
|
+
pageSnapping: "page-snapping",
|
|
53
|
+
scrollDirection: "scroll-direction",
|
|
54
|
+
pauseAutoPlayOnTouch: "pause-auto-play-on-touch",
|
|
55
|
+
pauseAutoPlayOnManualNavigate: "pause-auto-play-on-manual-navigate",
|
|
56
|
+
pauseAutoPlayInFiniteScroll: "pause-auto-play-in-finite-scroll",
|
|
57
|
+
pageViewKey: "page-view-key",
|
|
58
|
+
enlargeStrategy: "enlarge-strategy",
|
|
59
|
+
enlargeFactor: "enlarge-factor",
|
|
60
|
+
disableCenter: "disable-center",
|
|
61
|
+
padEnds: "pad-ends",
|
|
62
|
+
clipBehavior: "clip-behavior",
|
|
63
|
+
disableGesture: "disable-gesture",
|
|
64
|
+
realPage: "real-page"
|
|
65
|
+
},
|
|
66
|
+
// Event handlers
|
|
67
|
+
events: [],
|
|
68
|
+
// Default prop values
|
|
69
|
+
defaultProps: {
|
|
70
|
+
// Add default values here
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// src/types.ts
|
|
75
|
+
var CarouselPageChangedReason = /* @__PURE__ */ ((CarouselPageChangedReason2) => {
|
|
76
|
+
CarouselPageChangedReason2["timed"] = "timed";
|
|
77
|
+
CarouselPageChangedReason2["manual"] = "manual";
|
|
78
|
+
CarouselPageChangedReason2["controller"] = "controller";
|
|
79
|
+
return CarouselPageChangedReason2;
|
|
80
|
+
})(CarouselPageChangedReason || {});
|
|
81
|
+
var CenterPageEnlargeStrategy = /* @__PURE__ */ ((CenterPageEnlargeStrategy2) => {
|
|
82
|
+
CenterPageEnlargeStrategy2["scale"] = "scale";
|
|
83
|
+
CenterPageEnlargeStrategy2["height"] = "height";
|
|
84
|
+
CenterPageEnlargeStrategy2["zoom"] = "zoom";
|
|
85
|
+
return CenterPageEnlargeStrategy2;
|
|
86
|
+
})(CenterPageEnlargeStrategy || {});
|
|
87
|
+
var Axis = /* @__PURE__ */ ((Axis2) => {
|
|
88
|
+
Axis2["horizontal"] = "Axis.horizontal";
|
|
89
|
+
Axis2["vertical"] = "Axis.vertical";
|
|
90
|
+
return Axis2;
|
|
91
|
+
})(Axis || {});
|
|
92
|
+
var Curve = /* @__PURE__ */ ((Curve2) => {
|
|
93
|
+
Curve2["ease"] = "Curves.ease";
|
|
94
|
+
Curve2["easeIn"] = "Curves.easeIn";
|
|
95
|
+
Curve2["easeOut"] = "Curves.easeOut";
|
|
96
|
+
Curve2["easeInOut"] = "Curves.easeInOut";
|
|
97
|
+
Curve2["fastOutSlowIn"] = "Curves.fastOutSlowIn";
|
|
98
|
+
Curve2["linear"] = "Curves.linear";
|
|
99
|
+
return Curve2;
|
|
100
|
+
})(Curve || {});
|
|
101
|
+
export {
|
|
102
|
+
Axis,
|
|
103
|
+
CarouselPageChangedReason,
|
|
104
|
+
CarouselSlider,
|
|
105
|
+
CenterPageEnlargeStrategy,
|
|
106
|
+
Curve
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/src/carousel_slider.tsx","../src/types.ts"],"sourcesContent":["import React from \"react\";\nimport { createWebFComponent, WebFElementWithMethods } from \"@openwebf/react-core-ui\";\nimport * as __webfTypes from \"../../types\";\ntype CarouselPageChangedReason = \"timed\" | \"manual\" | \"controller\";\ntype CenterPageEnlargeStrategy = \"scale\" | \"height\" | \"zoom\";\n/**\n * Methods for <webf-carousel-slider>.\n */\ninterface CarouselSliderMethods {\n /**\n * Animates to the next page.\n */\n nextPage(duration: number, curve: string): void;\n /**\n * Animates to the previous page.\n */\n previousPage(duration: number, curve: string): void;\n /**\n * Jumps to a specific page without animation.\n */\n jumpToPage(page: number): void;\n /**\n * Animates to a specific page.\n */\n animateToPage(page: number, duration: number, curve: string): void;\n /**\n * Starts auto play.\n */\n startAutoPlay(): void;\n /**\n * Stops auto play.\n */\n stopAutoPlay(): void;\n}\nexport interface CarouselSliderProps {\n /**\n * Set carousel height. Overrides aspectRatio if provided.\n */\n height?: number;\n /**\n * Aspect ratio when height is not set.\n * Default: 16 / 9\n */\n aspectRatio?: number;\n /**\n * The fraction of the viewport that each page should occupy.\n * Default: 0.8 (carousel_slider_plus default)\n */\n viewportFraction?: number;\n /**\n * The initial page to show.\n * Default: 0\n */\n initialPage?: number;\n /**\n * Determines if carousel should loop infinitely.\n * Default: true\n */\n enableInfiniteScroll?: boolean;\n /**\n * Loop to the closest occurrence of requested page.\n * Default: true\n */\n animateToClosest?: boolean;\n /**\n * Reverse the order of items.\n * Default: false\n */\n reverse?: boolean;\n /**\n * Enables auto play.\n * Default: false\n */\n autoPlay?: boolean;\n /**\n * Frequency of slides in milliseconds.\n * Default: 4000\n */\n autoPlayInterval?: number;\n /**\n * Animation duration between pages in milliseconds.\n * Default: 800\n */\n autoPlayAnimationDuration?: number;\n /**\n * Animation curve name.\n * Default: 'fast-out-slow-in'\n */\n autoPlayCurve?: string;\n /**\n * Whether current page should be larger than side images.\n * Default: false\n */\n enlargeCenterPage?: boolean;\n /**\n * Called whenever the page in the center changes.\n */\n onPageChanged?: any;\n /**\n * Called whenever the carousel is scrolled.\n */\n onScrolled?: any;\n /**\n * Scroll physics identifier.\n */\n scrollPhysics?: string;\n /**\n * Set to false to disable page snapping.\n * Default: true\n */\n pageSnapping?: boolean;\n /**\n * Axis along which the page view scrolls.\n * Default: 'horizontal'\n */\n scrollDirection?: 'horizontal' | 'vertical';\n /**\n * Pause auto play on touch.\n * Default: true\n */\n pauseAutoPlayOnTouch?: boolean;\n /**\n * Pause auto play on manual navigation.\n * Default: true\n */\n pauseAutoPlayOnManualNavigate?: boolean;\n /**\n * When finite scroll, decide whether auto play loops to first item.\n * Default: false\n */\n pauseAutoPlayInFiniteScroll?: boolean;\n /**\n * PageStorageKey identifier.\n */\n pageViewKey?: string;\n /**\n * Determine which method to enlarge the center page.\n * Default: 'scale'\n */\n enlargeStrategy?: 'scale' | 'height' | 'zoom';\n /**\n * How much the pages next to the center page will be scaled down.\n * Default: 0.3\n */\n enlargeFactor?: number;\n /**\n * Whether to disable the Center widget for each slide.\n * Default: false\n */\n disableCenter?: boolean;\n /**\n * Whether to add padding to both ends of the list.\n * Default: true\n */\n padEnds?: boolean;\n /**\n * Clip behavior name.\n * Default: 'hardEdge'\n */\n clipBehavior?: string;\n /**\n * Whether to disable touch gestures.\n * Default: false\n */\n disableGesture?: boolean;\n /**\n * Current real page index (read-only).\n */\n realPage?: number;\n /**\n * HTML id attribute\n */\n id?: string;\n /**\n * Additional CSS styles\n */\n style?: React.CSSProperties;\n /**\n * Children elements\n */\n children?: React.ReactNode;\n /**\n * Additional CSS class names\n */\n className?: string;\n}\n/**\n * Element interface with methods/properties accessible via ref\n * @example\n * ```tsx\n * const ref = useRef<CarouselSliderElement>(null);\n * // Call methods on the element\n * ref.current?.finishRefresh('success');\n * // Access properties\n * console.log(ref.current?.height);\n * ```\n */\nexport interface CarouselSliderElement extends WebFElementWithMethods<{\n /**\n * Animates to the next page.\n */\n nextPage(duration: number, curve: string): void;\n /**\n * Animates to the previous page.\n */\n previousPage(duration: number, curve: string): void;\n /**\n * Jumps to a specific page without animation.\n */\n jumpToPage(page: number): void;\n /**\n * Animates to a specific page.\n */\n animateToPage(page: number, duration: number, curve: string): void;\n /**\n * Starts auto play.\n */\n startAutoPlay(): void;\n /**\n * Stops auto play.\n */\n stopAutoPlay(): void;\n}> {\n /** Set carousel height. Overrides aspectRatio if provided. */\n height?: number;\n /** Aspect ratio when height is not set. */\n aspectRatio?: number;\n /** The fraction of the viewport that each page should occupy. */\n viewportFraction?: number;\n /** The initial page to show. */\n initialPage?: number;\n /** Determines if carousel should loop infinitely. */\n enableInfiniteScroll?: boolean;\n /** Loop to the closest occurrence of requested page. */\n animateToClosest?: boolean;\n /** Reverse the order of items. */\n reverse?: boolean;\n /** Enables auto play. */\n autoPlay?: boolean;\n /** Frequency of slides in milliseconds. */\n autoPlayInterval?: number;\n /** Animation duration between pages in milliseconds. */\n autoPlayAnimationDuration?: number;\n /** Animation curve name. */\n autoPlayCurve?: string;\n /** Whether current page should be larger than side images. */\n enlargeCenterPage?: boolean;\n /** Called whenever the page in the center changes. */\n onPageChanged?: any;\n /** Called whenever the carousel is scrolled. */\n onScrolled?: any;\n /** Scroll physics identifier. */\n scrollPhysics?: string;\n /** Set to false to disable page snapping. */\n pageSnapping?: boolean;\n /** Axis along which the page view scrolls. */\n scrollDirection?: 'horizontal' | 'vertical';\n /** Pause auto play on touch. */\n pauseAutoPlayOnTouch?: boolean;\n /** Pause auto play on manual navigation. */\n pauseAutoPlayOnManualNavigate?: boolean;\n /** When finite scroll, decide whether auto play loops to first item. */\n pauseAutoPlayInFiniteScroll?: boolean;\n /** PageStorageKey identifier. */\n pageViewKey?: string;\n /** Determine which method to enlarge the center page. */\n enlargeStrategy?: 'scale' | 'height' | 'zoom';\n /** How much the pages next to the center page will be scaled down. */\n enlargeFactor?: number;\n /** Whether to disable the Center widget for each slide. */\n disableCenter?: boolean;\n /** Whether to add padding to both ends of the list. */\n padEnds?: boolean;\n /** Clip behavior name. */\n clipBehavior?: string;\n /** Whether to disable touch gestures. */\n disableGesture?: boolean;\n /** Current real page index (read-only). */\n readonly realPage?: number;\n}\n/**\n * Properties for <webf-carousel-slider>.\n * \n * @example\n * ```tsx\n * const ref = useRef<CarouselSliderElement>(null);\n * \n * <CarouselSlider\n * ref={ref}\n * // Add props here\n * >\n * Content\n * </CarouselSlider>\n * \n * // Call methods on the element\n * ref.current?.finishRefresh('success');\n * ```\n */\nexport const CarouselSlider = createWebFComponent<CarouselSliderElement, CarouselSliderProps>({\n tagName: 'carousel-slider',\n displayName: 'CarouselSlider',\n // Map props to attributes\n attributeProps: [\n 'height',\n 'aspectRatio',\n 'viewportFraction',\n 'initialPage',\n 'enableInfiniteScroll',\n 'animateToClosest',\n 'reverse',\n 'autoPlay',\n 'autoPlayInterval',\n 'autoPlayAnimationDuration',\n 'autoPlayCurve',\n 'enlargeCenterPage',\n 'onPageChanged',\n 'onScrolled',\n 'scrollPhysics',\n 'pageSnapping',\n 'scrollDirection',\n 'pauseAutoPlayOnTouch',\n 'pauseAutoPlayOnManualNavigate',\n 'pauseAutoPlayInFiniteScroll',\n 'pageViewKey',\n 'enlargeStrategy',\n 'enlargeFactor',\n 'disableCenter',\n 'padEnds',\n 'clipBehavior',\n 'disableGesture',\n 'realPage',\n ],\n // Convert prop names to attribute names if needed\n attributeMap: {\n aspectRatio: 'aspect-ratio',\n viewportFraction: 'viewport-fraction',\n initialPage: 'initial-page',\n enableInfiniteScroll: 'enable-infinite-scroll',\n animateToClosest: 'animate-to-closest',\n autoPlay: 'auto-play',\n autoPlayInterval: 'auto-play-interval',\n autoPlayAnimationDuration: 'auto-play-animation-duration',\n autoPlayCurve: 'auto-play-curve',\n enlargeCenterPage: 'enlarge-center-page',\n onPageChanged: 'on-page-changed',\n onScrolled: 'on-scrolled',\n scrollPhysics: 'scroll-physics',\n pageSnapping: 'page-snapping',\n scrollDirection: 'scroll-direction',\n pauseAutoPlayOnTouch: 'pause-auto-play-on-touch',\n pauseAutoPlayOnManualNavigate: 'pause-auto-play-on-manual-navigate',\n pauseAutoPlayInFiniteScroll: 'pause-auto-play-in-finite-scroll',\n pageViewKey: 'page-view-key',\n enlargeStrategy: 'enlarge-strategy',\n enlargeFactor: 'enlarge-factor',\n disableCenter: 'disable-center',\n padEnds: 'pad-ends',\n clipBehavior: 'clip-behavior',\n disableGesture: 'disable-gesture',\n realPage: 'real-page',\n },\n // Event handlers\n events: [\n ],\n // Default prop values\n defaultProps: {\n // Add default values here\n },\n});","/* Generated by WebF CLI - aggregated type declarations */\nexport enum CarouselPageChangedReason { timed = 'timed', manual = 'manual', controller = 'controller' }\nexport enum CenterPageEnlargeStrategy { scale = 'scale', height = 'height', zoom = 'zoom' }\nexport enum Axis { horizontal = 'Axis.horizontal', vertical = 'Axis.vertical' }\nexport enum Curve { ease = 'Curves.ease', easeIn = 'Curves.easeIn', easeOut = 'Curves.easeOut', easeInOut = 'Curves.easeInOut', fastOutSlowIn = 'Curves.fastOutSlowIn', linear = 'Curves.linear' }"],"mappings":";AACA,SAAS,2BAAmD;AAySrD,IAAM,iBAAiB,oBAAgE;AAAA,EAC5F,SAAS;AAAA,EACT,aAAa;AAAA;AAAA,EAEb,gBAAgB;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA;AAAA,EAEA,cAAc;AAAA,IACZ,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,kBAAkB;AAAA,IAClB,UAAU;AAAA,IACV,kBAAkB;AAAA,IAClB,2BAA2B;AAAA,IAC3B,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,sBAAsB;AAAA,IACtB,+BAA+B;AAAA,IAC/B,6BAA6B;AAAA,IAC7B,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,eAAe;AAAA,IACf,SAAS;AAAA,IACT,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,UAAU;AAAA,EACZ;AAAA;AAAA,EAEA,QAAQ,CACR;AAAA;AAAA,EAEA,cAAc;AAAA;AAAA,EAEd;AACF,CAAC;;;AC/WM,IAAK,4BAAL,kBAAKA,+BAAL;AAAiC,EAAAA,2BAAA,WAAQ;AAAS,EAAAA,2BAAA,YAAS;AAAU,EAAAA,2BAAA,gBAAa;AAA7E,SAAAA;AAAA,GAAA;AACL,IAAK,4BAAL,kBAAKC,+BAAL;AAAiC,EAAAA,2BAAA,WAAQ;AAAS,EAAAA,2BAAA,YAAS;AAAU,EAAAA,2BAAA,UAAO;AAAvE,SAAAA;AAAA,GAAA;AACL,IAAK,OAAL,kBAAKC,UAAL;AAAY,EAAAA,MAAA,gBAAa;AAAmB,EAAAA,MAAA,cAAW;AAAlD,SAAAA;AAAA,GAAA;AACL,IAAK,QAAL,kBAAKC,WAAL;AAAa,EAAAA,OAAA,UAAO;AAAe,EAAAA,OAAA,YAAS;AAAiB,EAAAA,OAAA,aAAU;AAAkB,EAAAA,OAAA,eAAY;AAAoB,EAAAA,OAAA,mBAAgB;AAAwB,EAAAA,OAAA,YAAS;AAArK,SAAAA;AAAA,GAAA;","names":["CarouselPageChangedReason","CenterPageEnlargeStrategy","Axis","Curve"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ehmetlabs/webf-react-carousel-slider",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "WebF Custom Element wrapper for carousel_slider_plus. Provides hybrid UI carousel component with Flutter performance and JavaScript API.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": ["dist"],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsup"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"type": "commonjs",
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"react": ">=16.8.0",
|
|
18
|
+
"react-dom": ">=16.8.0",
|
|
19
|
+
"@openwebf/react-core-ui": "^0.24.2"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@openwebf/react-core-ui": "^0.24.1",
|
|
23
|
+
"@types/react": ">=16.8.0",
|
|
24
|
+
"@types/react-dom": ">=16.8.0",
|
|
25
|
+
"picomatch": "^4.0.3",
|
|
26
|
+
"tsup": "^8.5.1",
|
|
27
|
+
"typescript": "^5.9.3"
|
|
28
|
+
}
|
|
29
|
+
}
|