Major Changes
-
#3342
1e1f6daThanks
@github-actions! - Breaking: Spell out "Prev" as "Previous" across the
API.The
prevTriggerpart is nowpreviousTriggerin carousel, date picker, pagination, scheduler and steps, including
its prop getter, data attribute,idskey and translation key.- <button {...api.getPrevTriggerProps()} /> + <button {...api.getPreviousTriggerProps()} /> - [data-carousel-prev-trigger] { ... } + [data-carousel-previous-trigger] { ... } carousel.machine({ - ids: { prevTrigger: "prev" }, - translations: { prevTrigger: "Previous slide" }, + ids: { previousTrigger: "prev" }, + translations: { previousTrigger: "Previous slide" }, })
Pagination and scheduler rename
translations.prevTriggerLabeltotranslations.previousTriggerLabel.Component Before After Carousel scrollPrev(),canScrollPrevscrollPrevious(),canScrollPreviousDate picker, Scheduler goToPrev()goToPrevious()Pagination goToPrevPage()goToPreviousPage()Steps goToPrevStep(),hasPrevStepgoToPreviousStep(),hasPreviousStepTabs selectPrev()selectPrevious()Tour prev(),hasPrevStepprevious(),hasPreviousStepThe tour's
"prev"action is now"previous", and its trigger rendersdata-type="previous".- actions: [{ label: "Prev", action: "prev" }], + actions: [{ label: "Previous", action: "previous" }], - action: (actions) => actions.prev() + action: (actions) => actions.previous() - translations: { prevStep: "Previous step" } + translations: { previousStep: "Previous step" }
-
#3342
d6089c3Thanks
@github-actions! - - Breaking: Define steps with anitemsarray and
address them by stringvalueinstead of index.steps.machine({ - count: 3, - defaultStep: 0, + items: [{ value: "shipping" }, { value: "gift", optional: true }, { value: "payment" }], + defaultValue: "shipping", })Before After step/defaultStepvalue/defaultValueonStepChange/onStepCompleteonValueChange/onCompleteisStepValid(index)invalidon the itemisStepSkippable(index)optionalon the item, plusskipTriggeronStepInvalidonNavigationBlocked(reason,blockedBy)api.setStep(index)api.setValue(value)api.isCompletedapi.completestep === count(completed screen)value === steps.COMPLETEgetContentProps({ index: count })getContentProps({ value: steps.COMPLETE })api.isStepValid/isStepSkippableapi.getItemState({ value }){ index }in part props{ value }itemState.skippable/isValid()itemState.optional/!itemState.invaliditemState.first/itemState.lastindex === 0/index === api.count - 1ids.triggerId(index)/contentId(index)(value) => string--percent--steps-percent-
Add
disabledandeditableitem flags, and optionaltitleanddescription. -
Add
translationswithprogressLabelandprogressText. The progress bar announces the current step'stitle. -
Make
completedValuescontrollable, so going back no longer marks later steps incomplete. -
Add
api.items. Pass your item type toconnectto keep extra fields typed. -
Add the
skipTriggerpart, anddata-invalid,data-optional,data-skipped,data-lockedanddata-disabled. -
Add keyboard support to the step list: arrow keys,
HomeandEndmove focus, andEnterorSpaceopens a step. -
Disable unreachable triggers in linear mode.
-
Make the completed content a focusable region, and move focus to it on finish.
-
Give the progress bar an accessible name.
-
Patch Changes
- #3342
730ea29Thanks
@github-actions! - - Fix focus, scroll and sync work scheduled for the next
frame running after the component unmounts. - Updated dependencies [
a80b307]:- @zag-js/dom-query@2.0.0-next.4
- @zag-js/core@2.0.0-next.4
- @zag-js/anatomy@2.0.0-next.4
- @zag-js/types@2.0.0-next.4
- @zag-js/utils@2.0.0-next.4