@zag-js/tabs 0.49.0 → 0.51.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/dist/index.d.mts +26 -15
- package/dist/index.d.ts +26 -15
- package/dist/index.js +1 -531
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -496
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -9
- package/src/tabs.connect.ts +40 -16
- package/src/tabs.dom.ts +6 -6
- package/src/tabs.machine.ts +113 -92
- package/src/tabs.props.ts +1 -0
- package/src/tabs.types.ts +32 -25
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/tabs.anatomy.ts","../src/tabs.connect.ts","../src/tabs.dom.ts","../src/tabs.machine.ts","../src/tabs.props.ts"],"sourcesContent":["export { anatomy } from \"./tabs.anatomy\"\nexport { connect } from \"./tabs.connect\"\nexport { machine } from \"./tabs.machine\"\nexport * from \"./tabs.props\"\nexport type {\n MachineApi as Api,\n ContentProps,\n UserDefinedContext as Context,\n ElementIds,\n FocusChangeDetails,\n IntlTranslations,\n TriggerProps,\n ValueChangeDetails,\n} from \"./tabs.types\"\n","import { createAnatomy } from \"@zag-js/anatomy\"\n\nexport const anatomy = createAnatomy(\"tabs\").parts(\"root\", \"list\", \"trigger\", \"content\", \"indicator\")\nexport const parts = anatomy.build()\n","import { getEventKey, getNativeEvent, type EventKeyMap } from \"@zag-js/dom-event\"\nimport { dataAttr, isSafari, isSelfTarget } from \"@zag-js/dom-query\"\nimport type { NormalizeProps, PropTypes } from \"@zag-js/types\"\nimport { parts } from \"./tabs.anatomy\"\nimport { dom } from \"./tabs.dom\"\nimport type { MachineApi, Send, State, TriggerProps, TriggerState } from \"./tabs.types\"\n\nexport function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): MachineApi<T> {\n const translations = state.context.translations\n const focused = state.matches(\"focused\")\n\n function getTriggerState(props: TriggerProps): TriggerState {\n return {\n selected: state.context.value === props.value,\n focused: state.context.focusedValue === props.value,\n disabled: !!props.disabled,\n }\n }\n\n return {\n value: state.context.value,\n focusedValue: state.context.focusedValue,\n setValue(value) {\n send({ type: \"SET_VALUE\", value })\n },\n clearValue() {\n send({ type: \"CLEAR_VALUE\" })\n },\n setIndicatorRect(value) {\n const id = dom.getTriggerId(state.context, value)\n send({ type: \"SET_INDICATOR_RECT\", id })\n },\n getTriggerState,\n\n rootProps: normalize.element({\n ...parts.root.attrs,\n id: dom.getRootId(state.context),\n \"data-orientation\": state.context.orientation,\n \"data-focus\": dataAttr(focused),\n dir: state.context.dir,\n }),\n\n listProps: normalize.element({\n ...parts.list.attrs,\n id: dom.getListId(state.context),\n role: \"tablist\",\n dir: state.context.dir,\n \"data-focus\": dataAttr(focused),\n \"aria-orientation\": state.context.orientation,\n \"data-orientation\": state.context.orientation,\n \"aria-label\": translations.listLabel,\n onKeyDown(event) {\n if (event.defaultPrevented) return\n const evt = getNativeEvent(event)\n if (!isSelfTarget(evt)) return\n\n const keyMap: EventKeyMap = {\n ArrowDown() {\n send(\"ARROW_DOWN\")\n },\n ArrowUp() {\n send(\"ARROW_UP\")\n },\n ArrowLeft() {\n send(\"ARROW_LEFT\")\n },\n ArrowRight() {\n send(\"ARROW_RIGHT\")\n },\n Home() {\n send(\"HOME\")\n },\n End() {\n send(\"END\")\n },\n Enter() {\n send({ type: \"ENTER\", value: state.context.focusedValue })\n },\n }\n\n let key = getEventKey(event, state.context)\n const exec = keyMap[key]\n\n if (exec) {\n event.preventDefault()\n exec(event)\n }\n },\n }),\n\n getTriggerProps(props) {\n const { value, disabled } = props\n const triggerState = getTriggerState(props)\n\n return normalize.button({\n ...parts.trigger.attrs,\n role: \"tab\",\n type: \"button\",\n disabled,\n dir: state.context.dir,\n \"data-orientation\": state.context.orientation,\n \"data-disabled\": dataAttr(disabled),\n \"aria-disabled\": disabled,\n \"data-value\": value,\n \"aria-selected\": triggerState.selected,\n \"data-selected\": dataAttr(triggerState.selected),\n \"data-focus\": dataAttr(triggerState.focused),\n \"aria-controls\": dom.getContentId(state.context, value),\n \"data-ownedby\": dom.getListId(state.context),\n id: dom.getTriggerId(state.context, value),\n tabIndex: triggerState.selected ? 0 : -1,\n onFocus() {\n send({ type: \"TAB_FOCUS\", value })\n },\n onBlur(event) {\n const target = event.relatedTarget as HTMLElement | null\n if (target?.getAttribute(\"role\") !== \"tab\") {\n send({ type: \"TAB_BLUR\" })\n }\n },\n onClick(event) {\n if (event.defaultPrevented) return\n if (disabled) return\n if (isSafari()) {\n event.currentTarget.focus()\n }\n send({ type: \"TAB_CLICK\", value })\n },\n })\n },\n\n getContentProps(props) {\n const { value } = props\n const selected = state.context.value === value\n return normalize.element({\n ...parts.content.attrs,\n dir: state.context.dir,\n id: dom.getContentId(state.context, value),\n tabIndex: 0,\n \"aria-labelledby\": dom.getTriggerId(state.context, value),\n role: \"tabpanel\",\n \"data-ownedby\": dom.getListId(state.context),\n \"data-selected\": dataAttr(selected),\n \"data-orientation\": state.context.orientation,\n hidden: !selected,\n })\n },\n\n indicatorProps: normalize.element({\n id: dom.getIndicatorId(state.context),\n ...parts.indicator.attrs,\n dir: state.context.dir,\n \"data-orientation\": state.context.orientation,\n style: {\n \"--transition-property\": \"left, right, top, bottom, width, height\",\n \"--left\": state.context.indicatorRect?.left,\n \"--top\": state.context.indicatorRect?.top,\n \"--width\": state.context.indicatorRect?.width,\n \"--height\": state.context.indicatorRect?.height,\n position: \"absolute\",\n willChange: \"var(--transition-property)\",\n transitionProperty: \"var(--transition-property)\",\n transitionDuration: state.context.canIndicatorTransition ? \"var(--transition-duration, 150ms)\" : \"0ms\",\n transitionTimingFunction: \"var(--transition-timing-function)\",\n [state.context.orientation === \"horizontal\" ? \"left\" : \"top\"]:\n state.context.orientation === \"horizontal\" ? \"var(--left)\" : \"var(--top)\",\n },\n }),\n }\n}\n","import { createScope, itemById, nextById, prevById, queryAll } from \"@zag-js/dom-query\"\nimport { first, last } from \"@zag-js/utils\"\nimport type { MachineContext as Ctx } from \"./tabs.types\"\n\nexport const dom = createScope({\n getRootId: (ctx: Ctx) => ctx.ids?.root ?? `tabs:${ctx.id}`,\n getListId: (ctx: Ctx) => ctx.ids?.list ?? `tabs:${ctx.id}:list`,\n getContentId: (ctx: Ctx, id: string) => ctx.ids?.content ?? `tabs:${ctx.id}:content-${id}`,\n getTriggerId: (ctx: Ctx, id: string) => ctx.ids?.trigger ?? `tabs:${ctx.id}:trigger-${id}`,\n getIndicatorId: (ctx: Ctx) => ctx.ids?.indicator ?? `tabs:${ctx.id}:indicator`,\n\n getListEl: (ctx: Ctx) => dom.getById(ctx, dom.getListId(ctx)),\n getContentEl: (ctx: Ctx, id: string) => dom.getById(ctx, dom.getContentId(ctx, id)),\n getTriggerEl: (ctx: Ctx, id: string) => dom.getById(ctx, dom.getTriggerId(ctx, id)),\n getIndicatorEl: (ctx: Ctx) => dom.getById(ctx, dom.getIndicatorId(ctx)),\n\n getElements: (ctx: Ctx) => {\n const ownerId = CSS.escape(dom.getListId(ctx))\n const selector = `[role=tab][data-ownedby='${ownerId}']:not([disabled])`\n return queryAll(dom.getListEl(ctx), selector)\n },\n\n getFirstEl: (ctx: Ctx) => first(dom.getElements(ctx)),\n getLastEl: (ctx: Ctx) => last(dom.getElements(ctx)),\n getNextEl: (ctx: Ctx, id: string) => nextById(dom.getElements(ctx), dom.getTriggerId(ctx, id), ctx.loopFocus),\n getPrevEl: (ctx: Ctx, id: string) => prevById(dom.getElements(ctx), dom.getTriggerId(ctx, id), ctx.loopFocus),\n getActiveContentEl: (ctx: Ctx) => {\n if (!ctx.value) return\n return dom.getContentEl(ctx, ctx.value)\n },\n getActiveTabEl: (ctx: Ctx) => {\n if (!ctx.value) return\n return dom.getTriggerEl(ctx, ctx.value)\n },\n\n getOffsetRect: (el: HTMLElement | undefined) => {\n return {\n left: el?.offsetLeft ?? 0,\n top: el?.offsetTop ?? 0,\n width: el?.offsetWidth ?? 0,\n height: el?.offsetHeight ?? 0,\n }\n },\n\n getRectById: (ctx: Ctx, id: string) => {\n const tab = itemById(dom.getElements(ctx), dom.getTriggerId(ctx, id))\n return dom.resolveRect(dom.getOffsetRect(tab))\n },\n\n resolveRect: (rect: Record<\"width\" | \"height\" | \"left\" | \"top\", number>) => ({\n width: `${rect.width}px`,\n height: `${rect.height}px`,\n left: `${rect.left}px`,\n top: `${rect.top}px`,\n }),\n})\n","import { createMachine, guards } from \"@zag-js/core\"\nimport { clickIfLink } from \"@zag-js/dom-event\"\nimport { nextTick, raf } from \"@zag-js/dom-query\"\nimport { trackElementRect } from \"@zag-js/element-rect\"\nimport { getFocusables } from \"@zag-js/tabbable\"\nimport { compact, isEqual } from \"@zag-js/utils\"\nimport { dom } from \"./tabs.dom\"\nimport type { MachineContext, MachineState, UserDefinedContext } from \"./tabs.types\"\n\nconst { not } = guards\n\nexport function machine(userContext: UserDefinedContext) {\n const ctx = compact(userContext)\n return createMachine<MachineContext, MachineState>(\n {\n initial: \"idle\",\n\n context: {\n dir: \"ltr\",\n orientation: \"horizontal\",\n activationMode: \"automatic\",\n value: null,\n focusedValue: null,\n indicatorRect: {\n left: \"0px\",\n top: \"0px\",\n width: \"0px\",\n height: \"0px\",\n },\n canIndicatorTransition: false,\n isIndicatorRendered: false,\n loopFocus: true,\n translations: {},\n ...ctx,\n },\n\n computed: {\n isHorizontal: (ctx) => ctx.orientation === \"horizontal\",\n isVertical: (ctx) => ctx.orientation === \"vertical\",\n },\n\n entry: [\"checkRenderedElements\", \"syncIndicatorRect\", \"setContentTabIndex\"],\n\n exit: [\"cleanupObserver\"],\n\n watch: {\n value: [\"enableIndicatorTransition\", \"syncIndicatorRect\", \"setContentTabIndex\", \"clickIfLink\"],\n dir: [\"syncIndicatorRect\"],\n orientation: [\"syncIndicatorRect\"],\n },\n\n on: {\n SET_VALUE: {\n actions: \"setValue\",\n },\n CLEAR_VALUE: {\n actions: \"clearValue\",\n },\n SET_INDICATOR_RECT: {\n actions: \"setIndicatorRect\",\n },\n },\n\n states: {\n idle: {\n on: {\n TAB_FOCUS: [\n {\n guard: \"selectOnFocus\",\n target: \"focused\",\n actions: [\"setFocusedValue\", \"setValue\"],\n },\n {\n target: \"focused\",\n actions: \"setFocusedValue\",\n },\n ],\n TAB_CLICK: {\n target: \"focused\",\n actions: [\"setFocusedValue\", \"setValue\"],\n },\n },\n },\n focused: {\n on: {\n TAB_CLICK: {\n target: \"focused\",\n actions: [\"setFocusedValue\", \"setValue\"],\n },\n ARROW_LEFT: {\n guard: \"isHorizontal\",\n actions: \"focusPrevTab\",\n },\n ARROW_RIGHT: {\n guard: \"isHorizontal\",\n actions: \"focusNextTab\",\n },\n ARROW_UP: {\n guard: \"isVertical\",\n actions: \"focusPrevTab\",\n },\n ARROW_DOWN: {\n guard: \"isVertical\",\n actions: \"focusNextTab\",\n },\n HOME: {\n actions: \"focusFirstTab\",\n },\n END: {\n actions: \"focusLastTab\",\n },\n ENTER: {\n guard: not(\"selectOnFocus\"),\n actions: \"setValue\",\n },\n TAB_FOCUS: [\n {\n guard: \"selectOnFocus\",\n actions: [\"setFocusedValue\", \"setValue\"],\n },\n { actions: \"setFocusedValue\" },\n ],\n TAB_BLUR: {\n target: \"idle\",\n actions: \"clearFocusedValue\",\n },\n },\n },\n },\n },\n {\n guards: {\n isVertical: (ctx) => ctx.isVertical,\n isHorizontal: (ctx) => ctx.isHorizontal,\n selectOnFocus: (ctx) => ctx.activationMode === \"automatic\",\n },\n\n actions: {\n setFocusedValue(ctx, evt) {\n set.focusedValue(ctx, evt.value)\n },\n clearFocusedValue(ctx) {\n set.focusedValue(ctx, null)\n },\n setValue(ctx, evt) {\n set.value(ctx, evt.value)\n },\n clearValue(ctx) {\n set.value(ctx, null)\n },\n focusFirstTab(ctx) {\n raf(() => dom.getFirstEl(ctx)?.focus())\n },\n focusLastTab(ctx) {\n raf(() => dom.getLastEl(ctx)?.focus())\n },\n focusNextTab(ctx) {\n if (!ctx.focusedValue) return\n const next = dom.getNextEl(ctx, ctx.focusedValue)\n raf(() => next?.focus())\n },\n focusPrevTab(ctx) {\n if (!ctx.focusedValue) return\n const prev = dom.getPrevEl(ctx, ctx.focusedValue)\n raf(() => prev?.focus())\n },\n checkRenderedElements(ctx) {\n ctx.isIndicatorRendered = !!dom.getIndicatorEl(ctx)\n },\n // if tab panel contains focusable elements, remove the tabindex attribute\n setContentTabIndex(ctx) {\n raf(() => {\n const panel = dom.getActiveContentEl(ctx)\n if (!panel) return\n const focusables = getFocusables(panel)\n if (focusables.length > 0) {\n panel.removeAttribute(\"tabindex\")\n } else {\n panel.setAttribute(\"tabindex\", \"0\")\n }\n })\n },\n cleanupObserver(ctx) {\n ctx.indicatorCleanup?.()\n },\n enableIndicatorTransition(ctx) {\n ctx.canIndicatorTransition = true\n },\n setIndicatorRect(ctx, evt) {\n const value = evt.id ?? ctx.value\n if (!ctx.isIndicatorRendered || !value) return\n\n const tabEl = dom.getTriggerEl(ctx, value)\n if (!tabEl) return\n\n ctx.indicatorRect = dom.getRectById(ctx, value)\n nextTick(() => {\n ctx.canIndicatorTransition = false\n })\n },\n syncIndicatorRect(ctx) {\n ctx.indicatorCleanup?.()\n\n const value = ctx.value\n if (!ctx.isIndicatorRendered || !value) return\n\n const tabEl = dom.getActiveTabEl(ctx)\n if (!tabEl) return\n\n ctx.indicatorCleanup = trackElementRect(tabEl, {\n getRect(el) {\n return dom.getOffsetRect(el)\n },\n onChange(rect) {\n ctx.indicatorRect = dom.resolveRect(rect)\n nextTick(() => {\n ctx.canIndicatorTransition = false\n })\n },\n })\n },\n clickIfLink(ctx) {\n clickIfLink(dom.getActiveTabEl(ctx))\n },\n },\n },\n )\n}\n\nconst invoke = {\n change: (ctx: MachineContext) => {\n if (ctx.value == null) return\n ctx.onValueChange?.({ value: ctx.value })\n },\n focusChange: (ctx: MachineContext) => {\n if (ctx.focusedValue == null) return\n ctx.onFocusChange?.({ focusedValue: ctx.focusedValue })\n },\n}\n\nconst set = {\n value: (ctx: MachineContext, value: string | null) => {\n if (isEqual(value, ctx.value)) return\n ctx.value = value\n invoke.change(ctx)\n },\n focusedValue: (ctx: MachineContext, value: string | null) => {\n if (isEqual(value, ctx.focusedValue)) return\n ctx.focusedValue = value\n invoke.focusChange(ctx)\n },\n}\n","import { createProps } from \"@zag-js/types\"\nimport { createSplitProps } from \"@zag-js/utils\"\nimport type { ContentProps, TriggerProps, UserDefinedContext } from \"./tabs.types\"\n\nexport const props = createProps<UserDefinedContext>()([\n \"activationMode\",\n \"dir\",\n \"getRootNode\",\n \"id\",\n \"ids\",\n \"loopFocus\",\n \"onFocusChange\",\n \"onValueChange\",\n \"orientation\",\n \"translations\",\n \"value\",\n])\n\nexport const splitProps = createSplitProps<Partial<UserDefinedContext>>(props)\n\nexport const triggerProps = createProps<TriggerProps>()([\"disabled\", \"value\"])\nexport const splitTriggerProps = createSplitProps<TriggerProps>(triggerProps)\n\nexport const contentProps = createProps<ContentProps>()([\"value\"])\nexport const splitContentProps = createSplitProps<ContentProps>(contentProps)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAA8B;AAEvB,IAAM,cAAU,8BAAc,MAAM,EAAE,MAAM,QAAQ,QAAQ,WAAW,WAAW,WAAW;AAC7F,IAAM,QAAQ,QAAQ,MAAM;;;ACHnC,uBAA8D;AAC9D,IAAAA,oBAAiD;;;ACDjD,uBAAoE;AACpE,mBAA4B;AAGrB,IAAM,UAAM,8BAAY;AAAA,EAC7B,WAAW,CAAC,QAAa,IAAI,KAAK,QAAQ,QAAQ,IAAI,EAAE;AAAA,EACxD,WAAW,CAAC,QAAa,IAAI,KAAK,QAAQ,QAAQ,IAAI,EAAE;AAAA,EACxD,cAAc,CAAC,KAAU,OAAe,IAAI,KAAK,WAAW,QAAQ,IAAI,EAAE,YAAY,EAAE;AAAA,EACxF,cAAc,CAAC,KAAU,OAAe,IAAI,KAAK,W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ACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,iBAAa,gCAA8C,KAAK;AAEtE,IAAM,mBAAe,0BAA0B,EAAE,CAAC,YAAY,OAAO,CAAC;AACtE,IAAM,wBAAoB,gCAA+B,YAAY;AAErE,IAAM,mBAAe,0BAA0B,EAAE,CAAC,OAAO,CAAC;AAC1D,IAAM,wBAAoB,gCAA+B,YAAY;","names":["import_dom_query","props","import_dom_event","import_dom_query","import_utils","ctx","import_utils"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/tabs.anatomy.ts","../src/tabs.connect.ts","../src/tabs.dom.ts","../src/tabs.machine.ts","../src/tabs.props.ts"],"sourcesContent":["export { anatomy } from \"./tabs.anatomy\"\nexport { connect } from \"./tabs.connect\"\nexport { machine } from \"./tabs.machine\"\nexport * from \"./tabs.props\"\nexport type {\n MachineApi as Api,\n ContentProps,\n UserDefinedContext as Context,\n ElementIds,\n FocusChangeDetails,\n IntlTranslations,\n TriggerProps,\n ValueChangeDetails,\n} from \"./tabs.types\"\n","import { createAnatomy } from \"@zag-js/anatomy\"\n\nexport const anatomy = createAnatomy(\"tabs\").parts(\"root\", \"list\", \"trigger\", \"content\", \"indicator\")\nexport const parts = anatomy.build()\n","import { getEventKey, getNativeEvent, type EventKeyMap } from \"@zag-js/dom-event\"\nimport { dataAttr, isSafari, isSelfTarget } from \"@zag-js/dom-query\"\nimport type { NormalizeProps, PropTypes } from \"@zag-js/types\"\nimport { parts } from \"./tabs.anatomy\"\nimport { dom } from \"./tabs.dom\"\nimport type { MachineApi, Send, State, TriggerProps, TriggerState } from \"./tabs.types\"\n\nexport function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): MachineApi<T> {\n const translations = state.context.translations\n const focused = state.matches(\"focused\")\n\n const isVertical = state.context.orientation === \"vertical\"\n const isHorizontal = state.context.orientation === \"horizontal\"\n const composite = state.context.composite\n const indicator = state.context.indicatorState\n\n function getTriggerState(props: TriggerProps): TriggerState {\n return {\n selected: state.context.value === props.value,\n focused: state.context.focusedValue === props.value,\n disabled: !!props.disabled,\n }\n }\n\n return {\n value: state.context.value,\n focusedValue: state.context.focusedValue,\n setValue(value) {\n send({ type: \"SET_VALUE\", value })\n },\n clearValue() {\n send({ type: \"CLEAR_VALUE\" })\n },\n setIndicatorRect(value) {\n const id = dom.getTriggerId(state.context, value)\n send({ type: \"SET_INDICATOR_RECT\", id })\n },\n syncTabIndex() {\n send(\"SYNC_TAB_INDEX\")\n },\n selectNext(fromValue) {\n send({ type: \"TAB_FOCUS\", value: fromValue, src: \"selectNext\" })\n send({ type: \"ARROW_NEXT\", src: \"selectNext\" })\n },\n selectPrev(fromValue) {\n send({ type: \"TAB_FOCUS\", value: fromValue, src: \"selectPrev\" })\n send({ type: \"ARROW_PREV\", src: \"selectPrev\" })\n },\n focus() {\n dom.getSelectedTriggerEl(state.context)?.focus()\n },\n getTriggerState,\n\n rootProps: normalize.element({\n ...parts.root.attrs,\n id: dom.getRootId(state.context),\n \"data-orientation\": state.context.orientation,\n \"data-focus\": dataAttr(focused),\n dir: state.context.dir,\n }),\n\n listProps: normalize.element({\n ...parts.list.attrs,\n id: dom.getListId(state.context),\n role: \"tablist\",\n dir: state.context.dir,\n \"data-focus\": dataAttr(focused),\n \"aria-orientation\": state.context.orientation,\n \"data-orientation\": state.context.orientation,\n \"aria-label\": translations?.listLabel,\n onKeyDown(event) {\n if (event.defaultPrevented) return\n const evt = getNativeEvent(event)\n\n if (!isSelfTarget(evt)) return\n if (evt.isComposing) return\n\n const keyMap: EventKeyMap = {\n ArrowDown() {\n if (isHorizontal) return\n send({ type: \"ARROW_NEXT\", key: \"ArrowDown\" })\n },\n ArrowUp() {\n if (isHorizontal) return\n send({ type: \"ARROW_PREV\", key: \"ArrowUp\" })\n },\n ArrowLeft() {\n if (isVertical) return\n send({ type: \"ARROW_PREV\", key: \"ArrowLeft\" })\n },\n ArrowRight() {\n if (isVertical) return\n send({ type: \"ARROW_NEXT\", key: \"ArrowRight\" })\n },\n Home() {\n send(\"HOME\")\n },\n End() {\n send(\"END\")\n },\n Enter() {\n send({ type: \"ENTER\" })\n },\n }\n\n let key = getEventKey(event, state.context)\n const exec = keyMap[key]\n\n if (exec) {\n event.preventDefault()\n exec(event)\n }\n },\n }),\n\n getTriggerProps(props) {\n const { value, disabled } = props\n const triggerState = getTriggerState(props)\n\n return normalize.button({\n ...parts.trigger.attrs,\n role: \"tab\",\n type: \"button\",\n disabled,\n dir: state.context.dir,\n \"data-orientation\": state.context.orientation,\n \"data-disabled\": dataAttr(disabled),\n \"aria-disabled\": disabled,\n \"data-value\": value,\n \"aria-selected\": triggerState.selected,\n \"data-selected\": dataAttr(triggerState.selected),\n \"data-focus\": dataAttr(triggerState.focused),\n \"aria-controls\": triggerState.selected ? dom.getContentId(state.context, value) : undefined,\n \"data-ownedby\": dom.getListId(state.context),\n id: dom.getTriggerId(state.context, value),\n tabIndex: triggerState.selected && composite ? 0 : -1,\n onFocus() {\n send({ type: \"TAB_FOCUS\", value })\n },\n onBlur(event) {\n const target = event.relatedTarget as HTMLElement | null\n if (target?.getAttribute(\"role\") !== \"tab\") {\n send({ type: \"TAB_BLUR\" })\n }\n },\n onClick(event) {\n if (event.defaultPrevented) return\n if (disabled) return\n if (isSafari()) {\n event.currentTarget.focus()\n }\n send({ type: \"TAB_CLICK\", value })\n },\n })\n },\n\n getContentProps(props) {\n const { value } = props\n const selected = state.context.value === value\n return normalize.element({\n ...parts.content.attrs,\n dir: state.context.dir,\n id: dom.getContentId(state.context, value),\n tabIndex: composite ? 0 : -1,\n \"aria-labelledby\": dom.getTriggerId(state.context, value),\n role: \"tabpanel\",\n \"data-ownedby\": dom.getListId(state.context),\n \"data-selected\": dataAttr(selected),\n \"data-orientation\": state.context.orientation,\n hidden: !selected,\n })\n },\n\n indicatorProps: normalize.element({\n id: dom.getIndicatorId(state.context),\n ...parts.indicator.attrs,\n dir: state.context.dir,\n \"data-orientation\": state.context.orientation,\n style: {\n \"--transition-property\": \"left, right, top, bottom, width, height\",\n \"--left\": indicator.rect?.left,\n \"--top\": indicator.rect?.top,\n \"--width\": indicator.rect?.width,\n \"--height\": indicator.rect?.height,\n position: \"absolute\",\n willChange: \"var(--transition-property)\",\n transitionProperty: \"var(--transition-property)\",\n transitionDuration: indicator.transition ? \"var(--transition-duration, 150ms)\" : \"0ms\",\n transitionTimingFunction: \"var(--transition-timing-function)\",\n [isHorizontal ? \"left\" : \"top\"]: isHorizontal ? \"var(--left)\" : \"var(--top)\",\n },\n }),\n }\n}\n","import { createScope, itemById, nextById, prevById, queryAll } from \"@zag-js/dom-query\"\nimport { first, last } from \"@zag-js/utils\"\nimport type { MachineContext as Ctx } from \"./tabs.types\"\n\nexport const dom = createScope({\n getRootId: (ctx: Ctx) => ctx.ids?.root ?? `tabs:${ctx.id}`,\n getListId: (ctx: Ctx) => ctx.ids?.list ?? `tabs:${ctx.id}:list`,\n getContentId: (ctx: Ctx, id: string) => ctx.ids?.content ?? `tabs:${ctx.id}:content-${id}`,\n getTriggerId: (ctx: Ctx, id: string) => ctx.ids?.trigger ?? `tabs:${ctx.id}:trigger-${id}`,\n getIndicatorId: (ctx: Ctx) => ctx.ids?.indicator ?? `tabs:${ctx.id}:indicator`,\n\n getListEl: (ctx: Ctx) => dom.getById(ctx, dom.getListId(ctx)),\n getContentEl: (ctx: Ctx, id: string) => dom.getById(ctx, dom.getContentId(ctx, id)),\n getTriggerEl: (ctx: Ctx, id: string) => dom.getById(ctx, dom.getTriggerId(ctx, id)),\n getIndicatorEl: (ctx: Ctx) => dom.getById(ctx, dom.getIndicatorId(ctx)),\n\n getElements: (ctx: Ctx) => {\n const ownerId = CSS.escape(dom.getListId(ctx))\n const selector = `[role=tab][data-ownedby='${ownerId}']:not([disabled])`\n return queryAll(dom.getListEl(ctx), selector)\n },\n\n getFirstTriggerEl: (ctx: Ctx) => first(dom.getElements(ctx)),\n getLastTriggerEl: (ctx: Ctx) => last(dom.getElements(ctx)),\n getNextTriggerEl: (ctx: Ctx, id: string) => nextById(dom.getElements(ctx), dom.getTriggerId(ctx, id), ctx.loopFocus),\n getPrevTriggerEl: (ctx: Ctx, id: string) => prevById(dom.getElements(ctx), dom.getTriggerId(ctx, id), ctx.loopFocus),\n getSelectedContentEl: (ctx: Ctx) => {\n if (!ctx.value) return\n return dom.getContentEl(ctx, ctx.value)\n },\n getSelectedTriggerEl: (ctx: Ctx) => {\n if (!ctx.value) return\n return dom.getTriggerEl(ctx, ctx.value)\n },\n\n getOffsetRect: (el: HTMLElement | undefined) => {\n return {\n left: el?.offsetLeft ?? 0,\n top: el?.offsetTop ?? 0,\n width: el?.offsetWidth ?? 0,\n height: el?.offsetHeight ?? 0,\n }\n },\n\n getRectById: (ctx: Ctx, id: string) => {\n const tab = itemById(dom.getElements(ctx), dom.getTriggerId(ctx, id))\n return dom.resolveRect(dom.getOffsetRect(tab))\n },\n\n resolveRect: (rect: Record<\"width\" | \"height\" | \"left\" | \"top\", number>) => ({\n width: `${rect.width}px`,\n height: `${rect.height}px`,\n left: `${rect.left}px`,\n top: `${rect.top}px`,\n }),\n})\n","import { createMachine, guards } from \"@zag-js/core\"\nimport { clickIfLink } from \"@zag-js/dom-event\"\nimport { nextTick, raf, getFocusables } from \"@zag-js/dom-query\"\nimport { trackElementRect } from \"@zag-js/element-rect\"\nimport { compact, isEqual } from \"@zag-js/utils\"\nimport { dom } from \"./tabs.dom\"\nimport type { MachineContext, MachineState, UserDefinedContext } from \"./tabs.types\"\n\nconst { not } = guards\n\nexport function machine(userContext: UserDefinedContext) {\n const ctx = compact(userContext)\n return createMachine<MachineContext, MachineState>(\n {\n initial: \"idle\",\n\n context: {\n dir: \"ltr\",\n orientation: \"horizontal\",\n activationMode: \"automatic\",\n value: null,\n loopFocus: true,\n composite: true,\n ...ctx,\n focusedValue: ctx.value ?? null,\n indicatorState: {\n rendered: false,\n transition: false,\n rect: { left: \"0px\", top: \"0px\", width: \"0px\", height: \"0px\" },\n },\n },\n\n watch: {\n value: [\"allowIndicatorTransition\", \"syncIndicatorRect\", \"syncTabIndex\", \"clickIfLink\"],\n dir: [\"syncIndicatorRect\"],\n orientation: [\"syncIndicatorRect\"],\n },\n\n on: {\n SET_VALUE: {\n actions: \"setValue\",\n },\n CLEAR_VALUE: {\n actions: \"clearValue\",\n },\n SET_INDICATOR_RECT: {\n actions: \"setIndicatorRect\",\n },\n SYNC_TAB_INDEX: {\n actions: \"syncTabIndex\",\n },\n },\n\n created: [\"syncFocusedValue\"],\n entry: [\"checkRenderedElements\", \"syncIndicatorRect\", \"syncTabIndex\"],\n exit: [\"cleanupObserver\"],\n\n states: {\n idle: {\n on: {\n TAB_FOCUS: {\n target: \"focused\",\n actions: \"setFocusedValue\",\n },\n TAB_CLICK: {\n target: \"focused\",\n actions: [\"setFocusedValue\", \"setValue\"],\n },\n },\n },\n focused: {\n on: {\n TAB_CLICK: {\n target: \"focused\",\n actions: [\"setFocusedValue\", \"setValue\"],\n },\n ARROW_PREV: [\n {\n guard: \"selectOnFocus\",\n actions: [\"focusPrevTab\", \"selectFocusedTab\"],\n },\n {\n actions: \"focusPrevTab\",\n },\n ],\n ARROW_NEXT: [\n {\n guard: \"selectOnFocus\",\n actions: [\"focusNextTab\", \"selectFocusedTab\"],\n },\n {\n actions: \"focusNextTab\",\n },\n ],\n HOME: [\n {\n guard: \"selectOnFocus\",\n actions: [\"focusFirstTab\", \"selectFocusedTab\"],\n },\n {\n actions: \"focusFirstTab\",\n },\n ],\n END: [\n {\n guard: \"selectOnFocus\",\n actions: [\"focusLastTab\", \"selectFocusedTab\"],\n },\n {\n actions: \"focusLastTab\",\n },\n ],\n ENTER: {\n guard: not(\"selectOnFocus\"),\n actions: \"selectFocusedTab\",\n },\n TAB_FOCUS: {\n actions: [\"setFocusedValue\"],\n },\n TAB_BLUR: {\n target: \"idle\",\n actions: \"clearFocusedValue\",\n },\n },\n },\n },\n },\n {\n guards: {\n selectOnFocus: (ctx) => ctx.activationMode === \"automatic\",\n },\n\n actions: {\n syncFocusedValue(ctx) {\n if (ctx.value != null && ctx.focusedValue == null) {\n ctx.focusedValue = ctx.value\n }\n },\n selectFocusedTab(ctx) {\n raf(() => {\n set.value(ctx, ctx.focusedValue)\n })\n },\n setFocusedValue(ctx, evt) {\n if (evt.value == null) return\n set.focusedValue(ctx, evt.value)\n },\n clearFocusedValue(ctx) {\n set.focusedValue(ctx, null)\n },\n setValue(ctx, evt) {\n set.value(ctx, evt.value)\n },\n clearValue(ctx) {\n set.value(ctx, null)\n },\n focusFirstTab(ctx) {\n raf(() => {\n dom.getFirstTriggerEl(ctx)?.focus()\n })\n },\n focusLastTab(ctx) {\n raf(() => {\n dom.getLastTriggerEl(ctx)?.focus()\n })\n },\n focusNextTab(ctx) {\n if (!ctx.focusedValue) return\n const triggerEl = dom.getNextTriggerEl(ctx, ctx.focusedValue)\n raf(() => {\n if (ctx.composite) {\n triggerEl?.focus()\n } else if (triggerEl?.dataset.value != null) {\n set.focusedValue(ctx, triggerEl.dataset.value)\n }\n })\n },\n focusPrevTab(ctx) {\n if (!ctx.focusedValue) return\n const triggerEl = dom.getPrevTriggerEl(ctx, ctx.focusedValue)\n raf(() => {\n if (ctx.composite) {\n triggerEl?.focus()\n } else if (triggerEl?.dataset.value != null) {\n set.focusedValue(ctx, triggerEl.dataset.value)\n }\n })\n },\n checkRenderedElements(ctx) {\n ctx.indicatorState.rendered = !!dom.getIndicatorEl(ctx)\n },\n syncTabIndex(ctx) {\n raf(() => {\n const contentEl = dom.getSelectedContentEl(ctx)\n if (!contentEl) return\n const focusables = getFocusables(contentEl)\n if (focusables.length > 0) {\n contentEl.removeAttribute(\"tabindex\")\n } else {\n contentEl.setAttribute(\"tabindex\", \"0\")\n }\n })\n },\n cleanupObserver(ctx) {\n ctx.indicatorCleanup?.()\n },\n allowIndicatorTransition(ctx) {\n ctx.indicatorState.transition = true\n },\n setIndicatorRect(ctx, evt) {\n const value = evt.id ?? ctx.value\n if (!ctx.indicatorState.rendered || !value) return\n\n const triggerEl = dom.getTriggerEl(ctx, value)\n if (!triggerEl) return\n\n ctx.indicatorState.rect = dom.getRectById(ctx, value)\n nextTick(() => {\n ctx.indicatorState.transition = false\n })\n },\n syncIndicatorRect(ctx) {\n ctx.indicatorCleanup?.()\n\n const value = ctx.value\n if (!ctx.indicatorState.rendered || !value) return\n\n const triggerEl = dom.getSelectedTriggerEl(ctx)\n if (!triggerEl) return\n\n ctx.indicatorCleanup = trackElementRect(triggerEl, {\n getRect(el) {\n return dom.getOffsetRect(el)\n },\n onChange(rect) {\n ctx.indicatorState.rect = dom.resolveRect(rect)\n nextTick(() => {\n ctx.indicatorState.transition = false\n })\n },\n })\n },\n clickIfLink(ctx) {\n clickIfLink(dom.getSelectedTriggerEl(ctx))\n },\n },\n },\n )\n}\n\nconst invoke = {\n change: (ctx: MachineContext) => {\n if (ctx.value == null) return\n ctx.onValueChange?.({ value: ctx.value })\n },\n focusChange: (ctx: MachineContext) => {\n if (ctx.focusedValue == null) return\n ctx.onFocusChange?.({ focusedValue: ctx.focusedValue })\n },\n}\n\nconst set = {\n value: (ctx: MachineContext, value: string | null) => {\n if (isEqual(value, ctx.value)) return\n ctx.value = value\n invoke.change(ctx)\n },\n focusedValue: (ctx: MachineContext, value: string | null) => {\n if (isEqual(value, ctx.focusedValue)) return\n ctx.focusedValue = value\n invoke.focusChange(ctx)\n },\n}\n","import { createProps } from \"@zag-js/types\"\nimport { createSplitProps } from \"@zag-js/utils\"\nimport type { ContentProps, TriggerProps, UserDefinedContext } from \"./tabs.types\"\n\nexport const props = createProps<UserDefinedContext>()([\n \"activationMode\",\n \"composite\",\n \"dir\",\n \"getRootNode\",\n \"id\",\n \"ids\",\n \"loopFocus\",\n \"onFocusChange\",\n \"onValueChange\",\n \"orientation\",\n \"translations\",\n \"value\",\n])\n\nexport const splitProps = createSplitProps<Partial<UserDefinedContext>>(props)\n\nexport const triggerProps = createProps<TriggerProps>()([\"disabled\", \"value\"])\nexport const splitTriggerProps = createSplitProps<TriggerProps>(triggerProps)\n\nexport const contentProps = createProps<ContentProps>()([\"value\"])\nexport const splitContentProps = createSplitProps<ContentProps>(contentProps)\n"],"mappings":"qqBAAA,sUCAA,mBAA8B,2BAEvB,IAAM,WAAU,8BAAc,MAAM,EAAE,MAAM,OAAQ,OAAQ,UAAW,UAAW,WAAW,EAC7F,IAAM,MAAQ,QAAQ,MAAM,ECHnC,qBAA8D,6BAC9D,IAAAA,kBAAiD,6BCDjD,qBAAoE,6BACpE,iBAA4B,yBAGrB,IAAM,OAAM,8BAAY,CAC7B,UAAY,KAAa,IAAI,KAAK,MAAQ,QAAQ,IAAI,EAAE,GACxD,UAAY,KAAa,IAAI,KAAK,MAAQ,QAAQ,IAAI,EAAE,QACxD,aAAc,CAAC,IAAU,KAAe,IAAI,KAAK,SAAW,QAAQ,IAAI,EAAE,YAAY,EAAE,GACxF,aAAc,CAAC,IAAU,KAAe,IAAI,KAAK,SAAW,QAAQ,IAAI,EAAE,YAAY,EAAE,GACxF,eAAiB,KAAa,IAAI,KAAK,WAAa,QAAQ,IAAI,EAAE,aAElE,UAAY,KAAa,IAAI,QAAQ,IAAK,IAAI,UAAU,GAAG,CAAC,EAC5D,aAAc,CAAC,IAAU,KAAe,IAAI,QAAQ,IAAK,IAAI,aAAa,IAAK,EAAE,CAAC,EAClF,aAAc,CAAC,IAAU,KAAe,IAAI,QAAQ,IAAK,IAAI,aAAa,IAAK,EAAE,CAAC,EAClF,eAAiB,KAAa,IAAI,QAAQ,IAAK,IAAI,eAAe,GAAG,CAAC,EAEtE,YAAc,KAAa,CACzB,MAAM,QAAU,IAAI,OAAO,IAAI,UAAU,GAAG,CAAC,EAC7C,MAAM,SAAW,4BAA4B,OAAO,qBACpD,SAAO,2BAAS,IAAI,UAAU,GAAG,EAAG,QAAQ,CAC9C,EAEA,kBAAoB,QAAa,oBAAM,IAAI,YAAY,GAAG,CAAC,EAC3D,iBAAmB,QAAa,mBAA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_query","props","import_dom_event","import_dom_query","import_utils","ctx","import_utils"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,497 +1,2 @@
|
|
|
1
|
-
// src/tabs.anatomy.ts
|
|
2
|
-
import { createAnatomy } from "@zag-js/anatomy";
|
|
3
|
-
var anatomy = createAnatomy("tabs").parts("root", "list", "trigger", "content", "indicator");
|
|
4
|
-
var parts = anatomy.build();
|
|
5
|
-
|
|
6
|
-
// src/tabs.connect.ts
|
|
7
|
-
import { getEventKey, getNativeEvent } from "@zag-js/dom-event";
|
|
8
|
-
import { dataAttr, isSafari, isSelfTarget } from "@zag-js/dom-query";
|
|
9
|
-
|
|
10
|
-
// src/tabs.dom.ts
|
|
11
|
-
import { createScope, itemById, nextById, prevById, queryAll } from "@zag-js/dom-query";
|
|
12
|
-
import { first, last } from "@zag-js/utils";
|
|
13
|
-
var dom = createScope({
|
|
14
|
-
getRootId: (ctx) => ctx.ids?.root ?? `tabs:${ctx.id}`,
|
|
15
|
-
getListId: (ctx) => ctx.ids?.list ?? `tabs:${ctx.id}:list`,
|
|
16
|
-
getContentId: (ctx, id) => ctx.ids?.content ?? `tabs:${ctx.id}:content-${id}`,
|
|
17
|
-
getTriggerId: (ctx, id) => ctx.ids?.trigger ?? `tabs:${ctx.id}:trigger-${id}`,
|
|
18
|
-
getIndicatorId: (ctx) => ctx.ids?.indicator ?? `tabs:${ctx.id}:indicator`,
|
|
19
|
-
getListEl: (ctx) => dom.getById(ctx, dom.getListId(ctx)),
|
|
20
|
-
getContentEl: (ctx, id) => dom.getById(ctx, dom.getContentId(ctx, id)),
|
|
21
|
-
getTriggerEl: (ctx, id) => dom.getById(ctx, dom.getTriggerId(ctx, id)),
|
|
22
|
-
getIndicatorEl: (ctx) => dom.getById(ctx, dom.getIndicatorId(ctx)),
|
|
23
|
-
getElements: (ctx) => {
|
|
24
|
-
const ownerId = CSS.escape(dom.getListId(ctx));
|
|
25
|
-
const selector = `[role=tab][data-ownedby='${ownerId}']:not([disabled])`;
|
|
26
|
-
return queryAll(dom.getListEl(ctx), selector);
|
|
27
|
-
},
|
|
28
|
-
getFirstEl: (ctx) => first(dom.getElements(ctx)),
|
|
29
|
-
getLastEl: (ctx) => last(dom.getElements(ctx)),
|
|
30
|
-
getNextEl: (ctx, id) => nextById(dom.getElements(ctx), dom.getTriggerId(ctx, id), ctx.loopFocus),
|
|
31
|
-
getPrevEl: (ctx, id) => prevById(dom.getElements(ctx), dom.getTriggerId(ctx, id), ctx.loopFocus),
|
|
32
|
-
getActiveContentEl: (ctx) => {
|
|
33
|
-
if (!ctx.value)
|
|
34
|
-
return;
|
|
35
|
-
return dom.getContentEl(ctx, ctx.value);
|
|
36
|
-
},
|
|
37
|
-
getActiveTabEl: (ctx) => {
|
|
38
|
-
if (!ctx.value)
|
|
39
|
-
return;
|
|
40
|
-
return dom.getTriggerEl(ctx, ctx.value);
|
|
41
|
-
},
|
|
42
|
-
getOffsetRect: (el) => {
|
|
43
|
-
return {
|
|
44
|
-
left: el?.offsetLeft ?? 0,
|
|
45
|
-
top: el?.offsetTop ?? 0,
|
|
46
|
-
width: el?.offsetWidth ?? 0,
|
|
47
|
-
height: el?.offsetHeight ?? 0
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
getRectById: (ctx, id) => {
|
|
51
|
-
const tab = itemById(dom.getElements(ctx), dom.getTriggerId(ctx, id));
|
|
52
|
-
return dom.resolveRect(dom.getOffsetRect(tab));
|
|
53
|
-
},
|
|
54
|
-
resolveRect: (rect) => ({
|
|
55
|
-
width: `${rect.width}px`,
|
|
56
|
-
height: `${rect.height}px`,
|
|
57
|
-
left: `${rect.left}px`,
|
|
58
|
-
top: `${rect.top}px`
|
|
59
|
-
})
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// src/tabs.connect.ts
|
|
63
|
-
function connect(state, send, normalize) {
|
|
64
|
-
const translations = state.context.translations;
|
|
65
|
-
const focused = state.matches("focused");
|
|
66
|
-
function getTriggerState(props2) {
|
|
67
|
-
return {
|
|
68
|
-
selected: state.context.value === props2.value,
|
|
69
|
-
focused: state.context.focusedValue === props2.value,
|
|
70
|
-
disabled: !!props2.disabled
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
value: state.context.value,
|
|
75
|
-
focusedValue: state.context.focusedValue,
|
|
76
|
-
setValue(value) {
|
|
77
|
-
send({ type: "SET_VALUE", value });
|
|
78
|
-
},
|
|
79
|
-
clearValue() {
|
|
80
|
-
send({ type: "CLEAR_VALUE" });
|
|
81
|
-
},
|
|
82
|
-
setIndicatorRect(value) {
|
|
83
|
-
const id = dom.getTriggerId(state.context, value);
|
|
84
|
-
send({ type: "SET_INDICATOR_RECT", id });
|
|
85
|
-
},
|
|
86
|
-
getTriggerState,
|
|
87
|
-
rootProps: normalize.element({
|
|
88
|
-
...parts.root.attrs,
|
|
89
|
-
id: dom.getRootId(state.context),
|
|
90
|
-
"data-orientation": state.context.orientation,
|
|
91
|
-
"data-focus": dataAttr(focused),
|
|
92
|
-
dir: state.context.dir
|
|
93
|
-
}),
|
|
94
|
-
listProps: normalize.element({
|
|
95
|
-
...parts.list.attrs,
|
|
96
|
-
id: dom.getListId(state.context),
|
|
97
|
-
role: "tablist",
|
|
98
|
-
dir: state.context.dir,
|
|
99
|
-
"data-focus": dataAttr(focused),
|
|
100
|
-
"aria-orientation": state.context.orientation,
|
|
101
|
-
"data-orientation": state.context.orientation,
|
|
102
|
-
"aria-label": translations.listLabel,
|
|
103
|
-
onKeyDown(event) {
|
|
104
|
-
if (event.defaultPrevented)
|
|
105
|
-
return;
|
|
106
|
-
const evt = getNativeEvent(event);
|
|
107
|
-
if (!isSelfTarget(evt))
|
|
108
|
-
return;
|
|
109
|
-
const keyMap = {
|
|
110
|
-
ArrowDown() {
|
|
111
|
-
send("ARROW_DOWN");
|
|
112
|
-
},
|
|
113
|
-
ArrowUp() {
|
|
114
|
-
send("ARROW_UP");
|
|
115
|
-
},
|
|
116
|
-
ArrowLeft() {
|
|
117
|
-
send("ARROW_LEFT");
|
|
118
|
-
},
|
|
119
|
-
ArrowRight() {
|
|
120
|
-
send("ARROW_RIGHT");
|
|
121
|
-
},
|
|
122
|
-
Home() {
|
|
123
|
-
send("HOME");
|
|
124
|
-
},
|
|
125
|
-
End() {
|
|
126
|
-
send("END");
|
|
127
|
-
},
|
|
128
|
-
Enter() {
|
|
129
|
-
send({ type: "ENTER", value: state.context.focusedValue });
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
let key = getEventKey(event, state.context);
|
|
133
|
-
const exec = keyMap[key];
|
|
134
|
-
if (exec) {
|
|
135
|
-
event.preventDefault();
|
|
136
|
-
exec(event);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}),
|
|
140
|
-
getTriggerProps(props2) {
|
|
141
|
-
const { value, disabled } = props2;
|
|
142
|
-
const triggerState = getTriggerState(props2);
|
|
143
|
-
return normalize.button({
|
|
144
|
-
...parts.trigger.attrs,
|
|
145
|
-
role: "tab",
|
|
146
|
-
type: "button",
|
|
147
|
-
disabled,
|
|
148
|
-
dir: state.context.dir,
|
|
149
|
-
"data-orientation": state.context.orientation,
|
|
150
|
-
"data-disabled": dataAttr(disabled),
|
|
151
|
-
"aria-disabled": disabled,
|
|
152
|
-
"data-value": value,
|
|
153
|
-
"aria-selected": triggerState.selected,
|
|
154
|
-
"data-selected": dataAttr(triggerState.selected),
|
|
155
|
-
"data-focus": dataAttr(triggerState.focused),
|
|
156
|
-
"aria-controls": dom.getContentId(state.context, value),
|
|
157
|
-
"data-ownedby": dom.getListId(state.context),
|
|
158
|
-
id: dom.getTriggerId(state.context, value),
|
|
159
|
-
tabIndex: triggerState.selected ? 0 : -1,
|
|
160
|
-
onFocus() {
|
|
161
|
-
send({ type: "TAB_FOCUS", value });
|
|
162
|
-
},
|
|
163
|
-
onBlur(event) {
|
|
164
|
-
const target = event.relatedTarget;
|
|
165
|
-
if (target?.getAttribute("role") !== "tab") {
|
|
166
|
-
send({ type: "TAB_BLUR" });
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
onClick(event) {
|
|
170
|
-
if (event.defaultPrevented)
|
|
171
|
-
return;
|
|
172
|
-
if (disabled)
|
|
173
|
-
return;
|
|
174
|
-
if (isSafari()) {
|
|
175
|
-
event.currentTarget.focus();
|
|
176
|
-
}
|
|
177
|
-
send({ type: "TAB_CLICK", value });
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
},
|
|
181
|
-
getContentProps(props2) {
|
|
182
|
-
const { value } = props2;
|
|
183
|
-
const selected = state.context.value === value;
|
|
184
|
-
return normalize.element({
|
|
185
|
-
...parts.content.attrs,
|
|
186
|
-
dir: state.context.dir,
|
|
187
|
-
id: dom.getContentId(state.context, value),
|
|
188
|
-
tabIndex: 0,
|
|
189
|
-
"aria-labelledby": dom.getTriggerId(state.context, value),
|
|
190
|
-
role: "tabpanel",
|
|
191
|
-
"data-ownedby": dom.getListId(state.context),
|
|
192
|
-
"data-selected": dataAttr(selected),
|
|
193
|
-
"data-orientation": state.context.orientation,
|
|
194
|
-
hidden: !selected
|
|
195
|
-
});
|
|
196
|
-
},
|
|
197
|
-
indicatorProps: normalize.element({
|
|
198
|
-
id: dom.getIndicatorId(state.context),
|
|
199
|
-
...parts.indicator.attrs,
|
|
200
|
-
dir: state.context.dir,
|
|
201
|
-
"data-orientation": state.context.orientation,
|
|
202
|
-
style: {
|
|
203
|
-
"--transition-property": "left, right, top, bottom, width, height",
|
|
204
|
-
"--left": state.context.indicatorRect?.left,
|
|
205
|
-
"--top": state.context.indicatorRect?.top,
|
|
206
|
-
"--width": state.context.indicatorRect?.width,
|
|
207
|
-
"--height": state.context.indicatorRect?.height,
|
|
208
|
-
position: "absolute",
|
|
209
|
-
willChange: "var(--transition-property)",
|
|
210
|
-
transitionProperty: "var(--transition-property)",
|
|
211
|
-
transitionDuration: state.context.canIndicatorTransition ? "var(--transition-duration, 150ms)" : "0ms",
|
|
212
|
-
transitionTimingFunction: "var(--transition-timing-function)",
|
|
213
|
-
[state.context.orientation === "horizontal" ? "left" : "top"]: state.context.orientation === "horizontal" ? "var(--left)" : "var(--top)"
|
|
214
|
-
}
|
|
215
|
-
})
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// src/tabs.machine.ts
|
|
220
|
-
import { createMachine, guards } from "@zag-js/core";
|
|
221
|
-
import { clickIfLink } from "@zag-js/dom-event";
|
|
222
|
-
import { nextTick, raf } from "@zag-js/dom-query";
|
|
223
|
-
import { trackElementRect } from "@zag-js/element-rect";
|
|
224
|
-
import { getFocusables } from "@zag-js/tabbable";
|
|
225
|
-
import { compact, isEqual } from "@zag-js/utils";
|
|
226
|
-
var { not } = guards;
|
|
227
|
-
function machine(userContext) {
|
|
228
|
-
const ctx = compact(userContext);
|
|
229
|
-
return createMachine(
|
|
230
|
-
{
|
|
231
|
-
initial: "idle",
|
|
232
|
-
context: {
|
|
233
|
-
dir: "ltr",
|
|
234
|
-
orientation: "horizontal",
|
|
235
|
-
activationMode: "automatic",
|
|
236
|
-
value: null,
|
|
237
|
-
focusedValue: null,
|
|
238
|
-
indicatorRect: {
|
|
239
|
-
left: "0px",
|
|
240
|
-
top: "0px",
|
|
241
|
-
width: "0px",
|
|
242
|
-
height: "0px"
|
|
243
|
-
},
|
|
244
|
-
canIndicatorTransition: false,
|
|
245
|
-
isIndicatorRendered: false,
|
|
246
|
-
loopFocus: true,
|
|
247
|
-
translations: {},
|
|
248
|
-
...ctx
|
|
249
|
-
},
|
|
250
|
-
computed: {
|
|
251
|
-
isHorizontal: (ctx2) => ctx2.orientation === "horizontal",
|
|
252
|
-
isVertical: (ctx2) => ctx2.orientation === "vertical"
|
|
253
|
-
},
|
|
254
|
-
entry: ["checkRenderedElements", "syncIndicatorRect", "setContentTabIndex"],
|
|
255
|
-
exit: ["cleanupObserver"],
|
|
256
|
-
watch: {
|
|
257
|
-
value: ["enableIndicatorTransition", "syncIndicatorRect", "setContentTabIndex", "clickIfLink"],
|
|
258
|
-
dir: ["syncIndicatorRect"],
|
|
259
|
-
orientation: ["syncIndicatorRect"]
|
|
260
|
-
},
|
|
261
|
-
on: {
|
|
262
|
-
SET_VALUE: {
|
|
263
|
-
actions: "setValue"
|
|
264
|
-
},
|
|
265
|
-
CLEAR_VALUE: {
|
|
266
|
-
actions: "clearValue"
|
|
267
|
-
},
|
|
268
|
-
SET_INDICATOR_RECT: {
|
|
269
|
-
actions: "setIndicatorRect"
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
states: {
|
|
273
|
-
idle: {
|
|
274
|
-
on: {
|
|
275
|
-
TAB_FOCUS: [
|
|
276
|
-
{
|
|
277
|
-
guard: "selectOnFocus",
|
|
278
|
-
target: "focused",
|
|
279
|
-
actions: ["setFocusedValue", "setValue"]
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
target: "focused",
|
|
283
|
-
actions: "setFocusedValue"
|
|
284
|
-
}
|
|
285
|
-
],
|
|
286
|
-
TAB_CLICK: {
|
|
287
|
-
target: "focused",
|
|
288
|
-
actions: ["setFocusedValue", "setValue"]
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
focused: {
|
|
293
|
-
on: {
|
|
294
|
-
TAB_CLICK: {
|
|
295
|
-
target: "focused",
|
|
296
|
-
actions: ["setFocusedValue", "setValue"]
|
|
297
|
-
},
|
|
298
|
-
ARROW_LEFT: {
|
|
299
|
-
guard: "isHorizontal",
|
|
300
|
-
actions: "focusPrevTab"
|
|
301
|
-
},
|
|
302
|
-
ARROW_RIGHT: {
|
|
303
|
-
guard: "isHorizontal",
|
|
304
|
-
actions: "focusNextTab"
|
|
305
|
-
},
|
|
306
|
-
ARROW_UP: {
|
|
307
|
-
guard: "isVertical",
|
|
308
|
-
actions: "focusPrevTab"
|
|
309
|
-
},
|
|
310
|
-
ARROW_DOWN: {
|
|
311
|
-
guard: "isVertical",
|
|
312
|
-
actions: "focusNextTab"
|
|
313
|
-
},
|
|
314
|
-
HOME: {
|
|
315
|
-
actions: "focusFirstTab"
|
|
316
|
-
},
|
|
317
|
-
END: {
|
|
318
|
-
actions: "focusLastTab"
|
|
319
|
-
},
|
|
320
|
-
ENTER: {
|
|
321
|
-
guard: not("selectOnFocus"),
|
|
322
|
-
actions: "setValue"
|
|
323
|
-
},
|
|
324
|
-
TAB_FOCUS: [
|
|
325
|
-
{
|
|
326
|
-
guard: "selectOnFocus",
|
|
327
|
-
actions: ["setFocusedValue", "setValue"]
|
|
328
|
-
},
|
|
329
|
-
{ actions: "setFocusedValue" }
|
|
330
|
-
],
|
|
331
|
-
TAB_BLUR: {
|
|
332
|
-
target: "idle",
|
|
333
|
-
actions: "clearFocusedValue"
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
guards: {
|
|
341
|
-
isVertical: (ctx2) => ctx2.isVertical,
|
|
342
|
-
isHorizontal: (ctx2) => ctx2.isHorizontal,
|
|
343
|
-
selectOnFocus: (ctx2) => ctx2.activationMode === "automatic"
|
|
344
|
-
},
|
|
345
|
-
actions: {
|
|
346
|
-
setFocusedValue(ctx2, evt) {
|
|
347
|
-
set.focusedValue(ctx2, evt.value);
|
|
348
|
-
},
|
|
349
|
-
clearFocusedValue(ctx2) {
|
|
350
|
-
set.focusedValue(ctx2, null);
|
|
351
|
-
},
|
|
352
|
-
setValue(ctx2, evt) {
|
|
353
|
-
set.value(ctx2, evt.value);
|
|
354
|
-
},
|
|
355
|
-
clearValue(ctx2) {
|
|
356
|
-
set.value(ctx2, null);
|
|
357
|
-
},
|
|
358
|
-
focusFirstTab(ctx2) {
|
|
359
|
-
raf(() => dom.getFirstEl(ctx2)?.focus());
|
|
360
|
-
},
|
|
361
|
-
focusLastTab(ctx2) {
|
|
362
|
-
raf(() => dom.getLastEl(ctx2)?.focus());
|
|
363
|
-
},
|
|
364
|
-
focusNextTab(ctx2) {
|
|
365
|
-
if (!ctx2.focusedValue)
|
|
366
|
-
return;
|
|
367
|
-
const next = dom.getNextEl(ctx2, ctx2.focusedValue);
|
|
368
|
-
raf(() => next?.focus());
|
|
369
|
-
},
|
|
370
|
-
focusPrevTab(ctx2) {
|
|
371
|
-
if (!ctx2.focusedValue)
|
|
372
|
-
return;
|
|
373
|
-
const prev = dom.getPrevEl(ctx2, ctx2.focusedValue);
|
|
374
|
-
raf(() => prev?.focus());
|
|
375
|
-
},
|
|
376
|
-
checkRenderedElements(ctx2) {
|
|
377
|
-
ctx2.isIndicatorRendered = !!dom.getIndicatorEl(ctx2);
|
|
378
|
-
},
|
|
379
|
-
// if tab panel contains focusable elements, remove the tabindex attribute
|
|
380
|
-
setContentTabIndex(ctx2) {
|
|
381
|
-
raf(() => {
|
|
382
|
-
const panel = dom.getActiveContentEl(ctx2);
|
|
383
|
-
if (!panel)
|
|
384
|
-
return;
|
|
385
|
-
const focusables = getFocusables(panel);
|
|
386
|
-
if (focusables.length > 0) {
|
|
387
|
-
panel.removeAttribute("tabindex");
|
|
388
|
-
} else {
|
|
389
|
-
panel.setAttribute("tabindex", "0");
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
},
|
|
393
|
-
cleanupObserver(ctx2) {
|
|
394
|
-
ctx2.indicatorCleanup?.();
|
|
395
|
-
},
|
|
396
|
-
enableIndicatorTransition(ctx2) {
|
|
397
|
-
ctx2.canIndicatorTransition = true;
|
|
398
|
-
},
|
|
399
|
-
setIndicatorRect(ctx2, evt) {
|
|
400
|
-
const value = evt.id ?? ctx2.value;
|
|
401
|
-
if (!ctx2.isIndicatorRendered || !value)
|
|
402
|
-
return;
|
|
403
|
-
const tabEl = dom.getTriggerEl(ctx2, value);
|
|
404
|
-
if (!tabEl)
|
|
405
|
-
return;
|
|
406
|
-
ctx2.indicatorRect = dom.getRectById(ctx2, value);
|
|
407
|
-
nextTick(() => {
|
|
408
|
-
ctx2.canIndicatorTransition = false;
|
|
409
|
-
});
|
|
410
|
-
},
|
|
411
|
-
syncIndicatorRect(ctx2) {
|
|
412
|
-
ctx2.indicatorCleanup?.();
|
|
413
|
-
const value = ctx2.value;
|
|
414
|
-
if (!ctx2.isIndicatorRendered || !value)
|
|
415
|
-
return;
|
|
416
|
-
const tabEl = dom.getActiveTabEl(ctx2);
|
|
417
|
-
if (!tabEl)
|
|
418
|
-
return;
|
|
419
|
-
ctx2.indicatorCleanup = trackElementRect(tabEl, {
|
|
420
|
-
getRect(el) {
|
|
421
|
-
return dom.getOffsetRect(el);
|
|
422
|
-
},
|
|
423
|
-
onChange(rect) {
|
|
424
|
-
ctx2.indicatorRect = dom.resolveRect(rect);
|
|
425
|
-
nextTick(() => {
|
|
426
|
-
ctx2.canIndicatorTransition = false;
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
},
|
|
431
|
-
clickIfLink(ctx2) {
|
|
432
|
-
clickIfLink(dom.getActiveTabEl(ctx2));
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
var invoke = {
|
|
439
|
-
change: (ctx) => {
|
|
440
|
-
if (ctx.value == null)
|
|
441
|
-
return;
|
|
442
|
-
ctx.onValueChange?.({ value: ctx.value });
|
|
443
|
-
},
|
|
444
|
-
focusChange: (ctx) => {
|
|
445
|
-
if (ctx.focusedValue == null)
|
|
446
|
-
return;
|
|
447
|
-
ctx.onFocusChange?.({ focusedValue: ctx.focusedValue });
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
var set = {
|
|
451
|
-
value: (ctx, value) => {
|
|
452
|
-
if (isEqual(value, ctx.value))
|
|
453
|
-
return;
|
|
454
|
-
ctx.value = value;
|
|
455
|
-
invoke.change(ctx);
|
|
456
|
-
},
|
|
457
|
-
focusedValue: (ctx, value) => {
|
|
458
|
-
if (isEqual(value, ctx.focusedValue))
|
|
459
|
-
return;
|
|
460
|
-
ctx.focusedValue = value;
|
|
461
|
-
invoke.focusChange(ctx);
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
// src/tabs.props.ts
|
|
466
|
-
import { createProps } from "@zag-js/types";
|
|
467
|
-
import { createSplitProps } from "@zag-js/utils";
|
|
468
|
-
var props = createProps()([
|
|
469
|
-
"activationMode",
|
|
470
|
-
"dir",
|
|
471
|
-
"getRootNode",
|
|
472
|
-
"id",
|
|
473
|
-
"ids",
|
|
474
|
-
"loopFocus",
|
|
475
|
-
"onFocusChange",
|
|
476
|
-
"onValueChange",
|
|
477
|
-
"orientation",
|
|
478
|
-
"translations",
|
|
479
|
-
"value"
|
|
480
|
-
]);
|
|
481
|
-
var splitProps = createSplitProps(props);
|
|
482
|
-
var triggerProps = createProps()(["disabled", "value"]);
|
|
483
|
-
var splitTriggerProps = createSplitProps(triggerProps);
|
|
484
|
-
var contentProps = createProps()(["value"]);
|
|
485
|
-
var splitContentProps = createSplitProps(contentProps);
|
|
486
|
-
export {
|
|
487
|
-
anatomy,
|
|
488
|
-
connect,
|
|
489
|
-
contentProps,
|
|
490
|
-
machine,
|
|
491
|
-
props,
|
|
492
|
-
splitContentProps,
|
|
493
|
-
splitProps,
|
|
494
|
-
splitTriggerProps,
|
|
495
|
-
triggerProps
|
|
496
|
-
};
|
|
1
|
+
import{createAnatomy}from"@zag-js/anatomy";var anatomy=createAnatomy("tabs").parts("root","list","trigger","content","indicator");var parts=anatomy.build();import{getEventKey,getNativeEvent}from"@zag-js/dom-event";import{dataAttr,isSafari,isSelfTarget}from"@zag-js/dom-query";import{createScope,itemById,nextById,prevById,queryAll}from"@zag-js/dom-query";import{first,last}from"@zag-js/utils";var dom=createScope({getRootId:ctx=>ctx.ids?.root??`tabs:${ctx.id}`,getListId:ctx=>ctx.ids?.list??`tabs:${ctx.id}:list`,getContentId:(ctx,id)=>ctx.ids?.content??`tabs:${ctx.id}:content-${id}`,getTriggerId:(ctx,id)=>ctx.ids?.trigger??`tabs:${ctx.id}:trigger-${id}`,getIndicatorId:ctx=>ctx.ids?.indicator??`tabs:${ctx.id}:indicator`,getListEl:ctx=>dom.getById(ctx,dom.getListId(ctx)),getContentEl:(ctx,id)=>dom.getById(ctx,dom.getContentId(ctx,id)),getTriggerEl:(ctx,id)=>dom.getById(ctx,dom.getTriggerId(ctx,id)),getIndicatorEl:ctx=>dom.getById(ctx,dom.getIndicatorId(ctx)),getElements:ctx=>{const ownerId=CSS.escape(dom.getListId(ctx));const selector=`[role=tab][data-ownedby='${ownerId}']:not([disabled])`;return queryAll(dom.getListEl(ctx),selector)},getFirstTriggerEl:ctx=>first(dom.getElements(ctx)),getLastTriggerEl:ctx=>last(dom.getElements(ctx)),getNextTriggerEl:(ctx,id)=>nextById(dom.getElements(ctx),dom.getTriggerId(ctx,id),ctx.loopFocus),getPrevTriggerEl:(ctx,id)=>prevById(dom.getElements(ctx),dom.getTriggerId(ctx,id),ctx.loopFocus),getSelectedContentEl:ctx=>{if(!ctx.value)return;return dom.getContentEl(ctx,ctx.value)},getSelectedTriggerEl:ctx=>{if(!ctx.value)return;return dom.getTriggerEl(ctx,ctx.value)},getOffsetRect:el=>{return{left:el?.offsetLeft??0,top:el?.offsetTop??0,width:el?.offsetWidth??0,height:el?.offsetHeight??0}},getRectById:(ctx,id)=>{const tab=itemById(dom.getElements(ctx),dom.getTriggerId(ctx,id));return dom.resolveRect(dom.getOffsetRect(tab))},resolveRect:rect=>({width:`${rect.width}px`,height:`${rect.height}px`,left:`${rect.left}px`,top:`${rect.top}px`})});function connect(state,send,normalize){const translations=state.context.translations;const focused=state.matches("focused");const isVertical=state.context.orientation==="vertical";const isHorizontal=state.context.orientation==="horizontal";const composite=state.context.composite;const indicator=state.context.indicatorState;function getTriggerState(props2){return{selected:state.context.value===props2.value,focused:state.context.focusedValue===props2.value,disabled:!!props2.disabled}}return{value:state.context.value,focusedValue:state.context.focusedValue,setValue(value){send({type:"SET_VALUE",value})},clearValue(){send({type:"CLEAR_VALUE"})},setIndicatorRect(value){const id=dom.getTriggerId(state.context,value);send({type:"SET_INDICATOR_RECT",id})},syncTabIndex(){send("SYNC_TAB_INDEX")},selectNext(fromValue){send({type:"TAB_FOCUS",value:fromValue,src:"selectNext"});send({type:"ARROW_NEXT",src:"selectNext"})},selectPrev(fromValue){send({type:"TAB_FOCUS",value:fromValue,src:"selectPrev"});send({type:"ARROW_PREV",src:"selectPrev"})},focus(){dom.getSelectedTriggerEl(state.context)?.focus()},getTriggerState,rootProps:normalize.element({...parts.root.attrs,id:dom.getRootId(state.context),"data-orientation":state.context.orientation,"data-focus":dataAttr(focused),dir:state.context.dir}),listProps:normalize.element({...parts.list.attrs,id:dom.getListId(state.context),role:"tablist",dir:state.context.dir,"data-focus":dataAttr(focused),"aria-orientation":state.context.orientation,"data-orientation":state.context.orientation,"aria-label":translations?.listLabel,onKeyDown(event){if(event.defaultPrevented)return;const evt=getNativeEvent(event);if(!isSelfTarget(evt))return;if(evt.isComposing)return;const keyMap={ArrowDown(){if(isHorizontal)return;send({type:"ARROW_NEXT",key:"ArrowDown"})},ArrowUp(){if(isHorizontal)return;send({type:"ARROW_PREV",key:"ArrowUp"})},ArrowLeft(){if(isVertical)return;send({type:"ARROW_PREV",key:"ArrowLeft"})},ArrowRight(){if(isVertical)return;send({type:"ARROW_NEXT",key:"ArrowRight"})},Home(){send("HOME")},End(){send("END")},Enter(){send({type:"ENTER"})}};let key=getEventKey(event,state.context);const exec=keyMap[key];if(exec){event.preventDefault();exec(event)}}}),getTriggerProps(props2){const{value,disabled}=props2;const triggerState=getTriggerState(props2);return normalize.button({...parts.trigger.attrs,role:"tab",type:"button",disabled,dir:state.context.dir,"data-orientation":state.context.orientation,"data-disabled":dataAttr(disabled),"aria-disabled":disabled,"data-value":value,"aria-selected":triggerState.selected,"data-selected":dataAttr(triggerState.selected),"data-focus":dataAttr(triggerState.focused),"aria-controls":triggerState.selected?dom.getContentId(state.context,value):void 0,"data-ownedby":dom.getListId(state.context),id:dom.getTriggerId(state.context,value),tabIndex:triggerState.selected&&composite?0:-1,onFocus(){send({type:"TAB_FOCUS",value})},onBlur(event){const target=event.relatedTarget;if(target?.getAttribute("role")!=="tab"){send({type:"TAB_BLUR"})}},onClick(event){if(event.defaultPrevented)return;if(disabled)return;if(isSafari()){event.currentTarget.focus()}send({type:"TAB_CLICK",value})}})},getContentProps(props2){const{value}=props2;const selected=state.context.value===value;return normalize.element({...parts.content.attrs,dir:state.context.dir,id:dom.getContentId(state.context,value),tabIndex:composite?0:-1,"aria-labelledby":dom.getTriggerId(state.context,value),role:"tabpanel","data-ownedby":dom.getListId(state.context),"data-selected":dataAttr(selected),"data-orientation":state.context.orientation,hidden:!selected})},indicatorProps:normalize.element({id:dom.getIndicatorId(state.context),...parts.indicator.attrs,dir:state.context.dir,"data-orientation":state.context.orientation,style:{"--transition-property":"left, right, top, bottom, width, height","--left":indicator.rect?.left,"--top":indicator.rect?.top,"--width":indicator.rect?.width,"--height":indicator.rect?.height,position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:indicator.transition?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[isHorizontal?"left":"top"]:isHorizontal?"var(--left)":"var(--top)"}})}}import{createMachine,guards}from"@zag-js/core";import{clickIfLink}from"@zag-js/dom-event";import{nextTick,raf,getFocusables}from"@zag-js/dom-query";import{trackElementRect}from"@zag-js/element-rect";import{compact,isEqual}from"@zag-js/utils";var{not}=guards;function machine(userContext){const ctx=compact(userContext);return createMachine({initial:"idle",context:{dir:"ltr",orientation:"horizontal",activationMode:"automatic",value:null,loopFocus:true,composite:true,...ctx,focusedValue:ctx.value??null,indicatorState:{rendered:false,transition:false,rect:{left:"0px",top:"0px",width:"0px",height:"0px"}}},watch:{value:["allowIndicatorTransition","syncIndicatorRect","syncTabIndex","clickIfLink"],dir:["syncIndicatorRect"],orientation:["syncIndicatorRect"]},on:{SET_VALUE:{actions:"setValue"},CLEAR_VALUE:{actions:"clearValue"},SET_INDICATOR_RECT:{actions:"setIndicatorRect"},SYNC_TAB_INDEX:{actions:"syncTabIndex"}},created:["syncFocusedValue"],entry:["checkRenderedElements","syncIndicatorRect","syncTabIndex"],exit:["cleanupObserver"],states:{idle:{on:{TAB_FOCUS:{target:"focused",actions:"setFocusedValue"},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]},ARROW_PREV:[{guard:"selectOnFocus",actions:["focusPrevTab","selectFocusedTab"]},{actions:"focusPrevTab"}],ARROW_NEXT:[{guard:"selectOnFocus",actions:["focusNextTab","selectFocusedTab"]},{actions:"focusNextTab"}],HOME:[{guard:"selectOnFocus",actions:["focusFirstTab","selectFocusedTab"]},{actions:"focusFirstTab"}],END:[{guard:"selectOnFocus",actions:["focusLastTab","selectFocusedTab"]},{actions:"focusLastTab"}],ENTER:{guard:not("selectOnFocus"),actions:"selectFocusedTab"},TAB_FOCUS:{actions:["setFocusedValue"]},TAB_BLUR:{target:"idle",actions:"clearFocusedValue"}}}}},{guards:{selectOnFocus:ctx2=>ctx2.activationMode==="automatic"},actions:{syncFocusedValue(ctx2){if(ctx2.value!=null&&ctx2.focusedValue==null){ctx2.focusedValue=ctx2.value}},selectFocusedTab(ctx2){raf(()=>{set.value(ctx2,ctx2.focusedValue)})},setFocusedValue(ctx2,evt){if(evt.value==null)return;set.focusedValue(ctx2,evt.value)},clearFocusedValue(ctx2){set.focusedValue(ctx2,null)},setValue(ctx2,evt){set.value(ctx2,evt.value)},clearValue(ctx2){set.value(ctx2,null)},focusFirstTab(ctx2){raf(()=>{dom.getFirstTriggerEl(ctx2)?.focus()})},focusLastTab(ctx2){raf(()=>{dom.getLastTriggerEl(ctx2)?.focus()})},focusNextTab(ctx2){if(!ctx2.focusedValue)return;const triggerEl=dom.getNextTriggerEl(ctx2,ctx2.focusedValue);raf(()=>{if(ctx2.composite){triggerEl?.focus()}else if(triggerEl?.dataset.value!=null){set.focusedValue(ctx2,triggerEl.dataset.value)}})},focusPrevTab(ctx2){if(!ctx2.focusedValue)return;const triggerEl=dom.getPrevTriggerEl(ctx2,ctx2.focusedValue);raf(()=>{if(ctx2.composite){triggerEl?.focus()}else if(triggerEl?.dataset.value!=null){set.focusedValue(ctx2,triggerEl.dataset.value)}})},checkRenderedElements(ctx2){ctx2.indicatorState.rendered=!!dom.getIndicatorEl(ctx2)},syncTabIndex(ctx2){raf(()=>{const contentEl=dom.getSelectedContentEl(ctx2);if(!contentEl)return;const focusables=getFocusables(contentEl);if(focusables.length>0){contentEl.removeAttribute("tabindex")}else{contentEl.setAttribute("tabindex","0")}})},cleanupObserver(ctx2){ctx2.indicatorCleanup?.()},allowIndicatorTransition(ctx2){ctx2.indicatorState.transition=true},setIndicatorRect(ctx2,evt){const value=evt.id??ctx2.value;if(!ctx2.indicatorState.rendered||!value)return;const triggerEl=dom.getTriggerEl(ctx2,value);if(!triggerEl)return;ctx2.indicatorState.rect=dom.getRectById(ctx2,value);nextTick(()=>{ctx2.indicatorState.transition=false})},syncIndicatorRect(ctx2){ctx2.indicatorCleanup?.();const value=ctx2.value;if(!ctx2.indicatorState.rendered||!value)return;const triggerEl=dom.getSelectedTriggerEl(ctx2);if(!triggerEl)return;ctx2.indicatorCleanup=trackElementRect(triggerEl,{getRect(el){return dom.getOffsetRect(el)},onChange(rect){ctx2.indicatorState.rect=dom.resolveRect(rect);nextTick(()=>{ctx2.indicatorState.transition=false})}})},clickIfLink(ctx2){clickIfLink(dom.getSelectedTriggerEl(ctx2))}}})}var invoke={change:ctx=>{if(ctx.value==null)return;ctx.onValueChange?.({value:ctx.value})},focusChange:ctx=>{if(ctx.focusedValue==null)return;ctx.onFocusChange?.({focusedValue:ctx.focusedValue})}};var set={value:(ctx,value)=>{if(isEqual(value,ctx.value))return;ctx.value=value;invoke.change(ctx)},focusedValue:(ctx,value)=>{if(isEqual(value,ctx.focusedValue))return;ctx.focusedValue=value;invoke.focusChange(ctx)}};import{createProps}from"@zag-js/types";import{createSplitProps}from"@zag-js/utils";var props=createProps()(["activationMode","composite","dir","getRootNode","id","ids","loopFocus","onFocusChange","onValueChange","orientation","translations","value"]);var splitProps=createSplitProps(props);var triggerProps=createProps()(["disabled","value"]);var splitTriggerProps=createSplitProps(triggerProps);var contentProps=createProps()(["value"]);var splitContentProps=createSplitProps(contentProps);export{anatomy,connect,contentProps,machine,props,splitContentProps,splitProps,splitTriggerProps,triggerProps};
|
|
497
2
|
//# sourceMappingURL=index.mjs.map
|