@zag-js/tabs 0.49.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/dist/index.d.mts +26 -15
- package/dist/index.d.ts +26 -15
- package/dist/index.js +163 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +164 -111
- 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/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
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
*/
|