@zag-js/tabs 0.48.0 → 0.50.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/src/tabs.types.ts CHANGED
@@ -37,7 +37,7 @@ interface PublicContext extends DirectionProperty, CommonProperties {
37
37
  /**
38
38
  * Specifies the localized strings that identifies the accessibility elements and their states
39
39
  */
40
- translations: IntlTranslations
40
+ translations?: IntlTranslations
41
41
  /**
42
42
  * Whether the keyboard navigation will loop from last tab to first, and vice versa.
43
43
  * @default true
@@ -59,6 +59,7 @@ interface PublicContext extends DirectionProperty, CommonProperties {
59
59
  * The activation mode of the tabs. Can be `manual` or `automatic`
60
60
  * - `manual`: Tabs are activated when clicked or press `enter` key.
61
61
  * - `automatic`: Tabs are activated when receiving focus
62
+ *
62
63
  * @default "automatic"
63
64
  */
64
65
  activationMode?: "manual" | "automatic"
@@ -70,22 +71,21 @@ interface PublicContext extends DirectionProperty, CommonProperties {
70
71
  * Callback to be called when the focused tab changes
71
72
  */
72
73
  onFocusChange?: (details: FocusChangeDetails) => void
74
+ /**
75
+ * Whether the tab is composite
76
+ */
77
+ composite: boolean
73
78
  }
74
79
 
75
80
  export type UserDefinedContext = RequiredBy<PublicContext, "id">
76
81
 
77
- type ComputedContext = Readonly<{
78
- /**
79
- * @computed
80
- * Whether the tab is in the horizontal orientation
81
- */
82
- isHorizontal: boolean
83
- /**
84
- * @computed
85
- * Whether the tab is in the vertical orientation
86
- */
87
- isVertical: boolean
88
- }>
82
+ type ComputedContext = Readonly<{}>
83
+
84
+ interface IndicatorState {
85
+ rendered: boolean
86
+ rect: Partial<{ left: string; top: string; width: string; height: string }>
87
+ transition: boolean
88
+ }
89
89
 
90
90
  interface PrivateContext {
91
91
  /**
@@ -95,19 +95,9 @@ interface PrivateContext {
95
95
  focusedValue: string | null
96
96
  /**
97
97
  * @internal
98
- * Whether the indicator is rendered.
99
- */
100
- isIndicatorRendered: boolean
101
- /**
102
- * @internal
103
- * The active tab indicator's dom rect
104
- */
105
- indicatorRect?: Partial<{ left: string; top: string; width: string; height: string }>
106
- /**
107
- * @internal
108
- * Whether the active tab indicator's rect can transition
98
+ * The active tab indicator details
109
99
  */
110
- canIndicatorTransition?: boolean
100
+ indicatorState: IndicatorState
111
101
  /**
112
102
  * @internal
113
103
  * Function to clean up the observer for the active tab's rect
@@ -183,6 +173,23 @@ export interface MachineApi<T extends PropTypes = PropTypes> {
183
173
  * Sets the indicator rect to the tab with the given value
184
174
  */
185
175
  setIndicatorRect(value: string): void
176
+ /**
177
+ * Synchronizes the tab index of the content element.
178
+ * Useful when rendering tabs within a select or combobox
179
+ */
180
+ syncTabIndex(): void
181
+ /**
182
+ * Set focus on the selected tab trigger
183
+ */
184
+ focus(): void
185
+ /**
186
+ * Selects the next tab
187
+ */
188
+ selectNext(fromValue?: string): void
189
+ /**
190
+ * Selects the previous tab
191
+ */
192
+ selectPrev(fromValue?: string): void
186
193
  /**
187
194
  * Returns the state of the trigger with the given props
188
195
  */