Skip to content

Commit

Permalink
Merge branch 'main' of github.com:chakra-ui/zag
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed Aug 4, 2023
2 parents b865f17 + c3b6b5d commit 1908249
Show file tree
Hide file tree
Showing 11 changed files with 171 additions and 206 deletions.
7 changes: 7 additions & 0 deletions .changeset/weak-guests-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@zag-js/carousel": minor
---

## Breaking Changes

Rename nextTrigger, prevTrigger to nextSlideTrigger and prevSlideTrigger to be more explicit.
4 changes: 2 additions & 2 deletions examples/next-ts/pages/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default function Page() {
<>
<main className="carousel">
<div {...api.rootProps}>
<button {...api.prevTriggerProps}>Prev</button>
<button {...api.nextTriggerProps}>Next</button>
<button {...api.prevSlideTriggerProps}>Prev</button>
<button {...api.nextSlideTriggerProps}>Next</button>
<div {...api.viewportProps}>
<div {...api.slideGroupProps}>
{carouselData.map((image, index) => (
Expand Down
4 changes: 2 additions & 2 deletions examples/solid-ts/src/pages/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default function Page() {
<>
<main class="carousel">
<div {...api().rootProps}>
<button {...api().prevTriggerProps}>Prev</button>
<button {...api().nextTriggerProps}>Next</button>
<button {...api().prevSlideTriggerProps}>Prev</button>
<button {...api().nextSlideTriggerProps}>Next</button>
<div {...api().viewportProps}>
<div {...api().slideGroupProps}>
<For each={carouselData}>
Expand Down
4 changes: 2 additions & 2 deletions examples/vue-ts/src/pages/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export default defineComponent({
<>
<main class="carousel">
<div {...api.rootProps}>
<button {...api.prevTriggerProps}>Prev</button>
<button {...api.nextTriggerProps}>Next</button>
<button {...api.prevSlideTriggerProps}>Prev</button>
<button {...api.nextSlideTriggerProps}>Next</button>
<div {...api.viewportProps}>
<div {...api.slideGroupProps}>
{carouselData.map((image, index) => (
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@internationalized/date": "^3.3.0",
"@octokit/rest": "20.0.1",
"@playwright/test": "1.36.2",
"@swc/core": "1.3.71",
"@swc/core": "1.3.74",
"@types/babel__traverse": "^7.20.1",
"@types/babel__generator": "^7.6.4",
"@types/node": "^20.4.4",
Expand Down Expand Up @@ -104,5 +104,5 @@
"engines": {
"node": ">=18.0.0"
},
"packageManager": "[email protected].0"
"packageManager": "[email protected].11"
}
4 changes: 2 additions & 2 deletions packages/machines/carousel/src/carousel.anatomy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export const anatomy = createAnatomy("carousel").parts(
"viewport",
"slideGroup",
"slide",
"previousTrigger",
"nextTrigger",
"nextSlideTrigger",
"prevSlideTrigger",
"indicatorGroup",
"indicator",
)
Expand Down
12 changes: 6 additions & 6 deletions packages/machines/carousel/src/carousel.connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ export function connect<T extends PropTypes>(state: State, send: Send, normalize
})
},

prevTriggerProps: normalize.button({
...parts.previousTrigger.attrs,
id: dom.getPrevTriggerId(state.context),
prevSlideTriggerProps: normalize.button({
...parts.prevSlideTrigger.attrs,
id: dom.getPrevSliderTriggerId(state.context),
type: "button",
tabIndex: -1,
disabled: !canScrollPrev,
Expand All @@ -125,9 +125,9 @@ export function connect<T extends PropTypes>(state: State, send: Send, normalize
},
}),

nextTriggerProps: normalize.button({
...parts.nextTrigger.attrs,
id: dom.getNextTriggerId(state.context),
nextSlideTriggerProps: normalize.button({
...parts.nextSlideTrigger.attrs,
id: dom.getNextSliderTriggerId(state.context),
type: "button",
tabIndex: -1,
"aria-label": "Next Slide",
Expand Down
4 changes: 2 additions & 2 deletions packages/machines/carousel/src/carousel.dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const dom = createScope({
getViewportId: (ctx: Ctx) => ctx.ids?.viewport ?? `carousel:${ctx.id}:viewport`,
getSlideId: (ctx: Ctx, index: number) => ctx.ids?.slide?.(index) ?? `carousel:${ctx.id}:slide:${index}`,
getSlideGroupId: (ctx: Ctx) => ctx.ids?.slideGroup ?? `carousel:${ctx.id}:slide-group`,
getNextTriggerId: (ctx: Ctx) => ctx.ids?.nextTrigger ?? `carousel:${ctx.id}:next-trigger`,
getPrevTriggerId: (ctx: Ctx) => ctx.ids?.prevTrigger ?? `carousel:${ctx.id}:prev-trigger`,
getNextSliderTriggerId: (ctx: Ctx) => ctx.ids?.nextSlideTrigger ?? `carousel:${ctx.id}:next-slide-trigger`,
getPrevSliderTriggerId: (ctx: Ctx) => ctx.ids?.prevSlideTrigger ?? `carousel:${ctx.id}:prev-slide-trigger`,
getIndicatorGroupId: (ctx: Ctx) => ctx.ids?.indicatorGroup ?? `carousel:${ctx.id}:indicator-group`,
getIndicatorId: (ctx: Ctx, index: number) => ctx.ids?.indicator?.(index) ?? `carousel:${ctx.id}:indicator:${index}`,

Expand Down
8 changes: 4 additions & 4 deletions packages/machines/carousel/src/carousel.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ type ElementIds = Partial<{
viewport: string
slide(index: number): string
slideGroup: string
nextTrigger: string
prevTrigger: string
nextSlideTrigger: string
prevSlideTrigger: string
indicatorGroup: string
indicator(index: number): string
}>
Expand Down Expand Up @@ -115,8 +115,8 @@ export type PublicApi<T extends PropTypes = PropTypes> = {
viewportProps: T["element"]
slideGroupProps: T["element"]
getSlideProps(props: SlideProps): T["element"]
prevTriggerProps: T["button"]
nextTriggerProps: T["button"]
prevSlideTriggerProps: T["button"]
nextSlideTriggerProps: T["button"]
indicatorGroupProps: T["element"]
getIndicatorProps(props: SlideIndicatorProps): T["button"]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/popper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@zag-js/dom-query": "workspace:*",
"@zag-js/element-rect": "workspace:*",
"@zag-js/utils": "workspace:*",
"@floating-ui/dom": "1.4.5"
"@floating-ui/dom": "1.5.1"
},
"devDependencies": {
"clean-package": "2.2.0"
Expand Down
Loading

0 comments on commit 1908249

Please sign in to comment.