@zag-js/carousel
Advanced tools
Comparing version 0.0.0-dev-20230222120620 to 0.0.0-dev-20230222181847
@@ -6,12 +6,33 @@ import { PropTypes, NormalizeProps } from '@zag-js/types'; | ||
declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): { | ||
/** | ||
* The current index of the carousel | ||
*/ | ||
index: number; | ||
/** | ||
* Whether the carousel is currently auto-playing | ||
*/ | ||
isAutoplay: boolean; | ||
/** | ||
* Whether the carousel is can scroll to the next slide | ||
*/ | ||
canScrollNext: boolean; | ||
/** | ||
* Whether the carousel is can scroll to the previous slide | ||
*/ | ||
canScrollPrevious: boolean; | ||
/** | ||
* Function to scroll to a specific slide index | ||
*/ | ||
scrollTo(index: number): void; | ||
/** | ||
* Function to scroll to the next slide | ||
*/ | ||
scrollToNext(): void; | ||
/** | ||
* Function to scroll to the previous slide | ||
*/ | ||
scrollToPrevious(): void; | ||
rootProps: T["element"]; | ||
viewportProps: T["element"]; | ||
slideGroupProps: T["element"]; | ||
/** | ||
* Returns the state of a specific slide | ||
*/ | ||
getSlideState: (props: SlideProps) => { | ||
@@ -23,2 +44,5 @@ valueText: string; | ||
}; | ||
rootProps: T["element"]; | ||
viewportProps: T["element"]; | ||
slideGroupProps: T["element"]; | ||
getSlideProps(props: SlideProps): T["element"]; | ||
@@ -25,0 +49,0 @@ previousTriggerProps: T["button"]; |
@@ -71,15 +71,40 @@ "use strict"; | ||
return { | ||
/** | ||
* The current index of the carousel | ||
*/ | ||
index: state.context.index, | ||
/** | ||
* Whether the carousel is currently auto-playing | ||
*/ | ||
isAutoplay, | ||
/** | ||
* Whether the carousel is can scroll to the next slide | ||
*/ | ||
canScrollNext, | ||
/** | ||
* Whether the carousel is can scroll to the previous slide | ||
*/ | ||
canScrollPrevious, | ||
/** | ||
* Function to scroll to a specific slide index | ||
*/ | ||
scrollTo(index) { | ||
send({ type: "GOTO", index }); | ||
}, | ||
/** | ||
* Function to scroll to the next slide | ||
*/ | ||
scrollToNext() { | ||
send("NEXT"); | ||
}, | ||
/** | ||
* Function to scroll to the previous slide | ||
*/ | ||
scrollToPrevious() { | ||
send("PREV"); | ||
}, | ||
/** | ||
* Returns the state of a specific slide | ||
*/ | ||
getSlideState, | ||
rootProps: normalize.element({ | ||
@@ -118,3 +143,2 @@ ...parts.root.attrs, | ||
}), | ||
getSlideState, | ||
getSlideProps(props) { | ||
@@ -121,0 +145,0 @@ const { index } = props; |
@@ -74,15 +74,40 @@ "use strict"; | ||
return { | ||
/** | ||
* The current index of the carousel | ||
*/ | ||
index: state.context.index, | ||
/** | ||
* Whether the carousel is currently auto-playing | ||
*/ | ||
isAutoplay, | ||
/** | ||
* Whether the carousel is can scroll to the next slide | ||
*/ | ||
canScrollNext, | ||
/** | ||
* Whether the carousel is can scroll to the previous slide | ||
*/ | ||
canScrollPrevious, | ||
/** | ||
* Function to scroll to a specific slide index | ||
*/ | ||
scrollTo(index) { | ||
send({ type: "GOTO", index }); | ||
}, | ||
/** | ||
* Function to scroll to the next slide | ||
*/ | ||
scrollToNext() { | ||
send("NEXT"); | ||
}, | ||
/** | ||
* Function to scroll to the previous slide | ||
*/ | ||
scrollToPrevious() { | ||
send("PREV"); | ||
}, | ||
/** | ||
* Returns the state of a specific slide | ||
*/ | ||
getSlideState, | ||
rootProps: normalize.element({ | ||
@@ -121,3 +146,2 @@ ...parts.root.attrs, | ||
}), | ||
getSlideState, | ||
getSlideProps(props) { | ||
@@ -124,0 +148,0 @@ const { index } = props; |
{ | ||
"name": "@zag-js/carousel", | ||
"version": "0.0.0-dev-20230222120620", | ||
"version": "0.0.0-dev-20230222181847", | ||
"description": "Core logic for the carousel widget implemented as a state machine", | ||
@@ -31,5 +31,5 @@ "keywords": [ | ||
"@zag-js/anatomy": "0.1.4", | ||
"@zag-js/core": "0.0.0-dev-20230222120620", | ||
"@zag-js/core": "0.0.0-dev-20230222181847", | ||
"@zag-js/types": "0.3.4", | ||
"@zag-js/dom-query": "0.0.0-dev-20230222120620", | ||
"@zag-js/dom-query": "0.0.0-dev-20230222181847", | ||
"@zag-js/utils": "0.3.3" | ||
@@ -36,0 +36,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49773
1450
+ Added@zag-js/core@0.0.0-dev-20230222181847(transitive)
+ Added@zag-js/dom-query@0.0.0-dev-20230222181847(transitive)
+ Added@zag-js/store@0.0.0-dev-20230222181847(transitive)
- Removed@zag-js/core@0.0.0-dev-20230222120620(transitive)
- Removed@zag-js/dom-query@0.0.0-dev-20230222120620(transitive)
- Removed@zag-js/store@0.0.0-dev-20230222120620(transitive)