@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.d.mts
CHANGED
|
@@ -29,7 +29,7 @@ interface PublicContext extends DirectionProperty, CommonProperties {
|
|
|
29
29
|
/**
|
|
30
30
|
* Specifies the localized strings that identifies the accessibility elements and their states
|
|
31
31
|
*/
|
|
32
|
-
translations
|
|
32
|
+
translations?: IntlTranslations;
|
|
33
33
|
/**
|
|
34
34
|
* Whether the keyboard navigation will loop from last tab to first, and vice versa.
|
|
35
35
|
* @default true
|
|
@@ -51,6 +51,7 @@ interface PublicContext extends DirectionProperty, CommonProperties {
|
|
|
51
51
|
* The activation mode of the tabs. Can be `manual` or `automatic`
|
|
52
52
|
* - `manual`: Tabs are activated when clicked or press `enter` key.
|
|
53
53
|
* - `automatic`: Tabs are activated when receiving focus
|
|
54
|
+
*
|
|
54
55
|
* @default "automatic"
|
|
55
56
|
*/
|
|
56
57
|
activationMode?: "manual" | "automatic";
|
|
@@ -62,20 +63,13 @@ interface PublicContext extends DirectionProperty, CommonProperties {
|
|
|
62
63
|
* Callback to be called when the focused tab changes
|
|
63
64
|
*/
|
|
64
65
|
onFocusChange?: (details: FocusChangeDetails) => void;
|
|
65
|
-
}
|
|
66
|
-
type UserDefinedContext = RequiredBy<PublicContext, "id">;
|
|
67
|
-
type ComputedContext = Readonly<{
|
|
68
|
-
/**
|
|
69
|
-
* @computed
|
|
70
|
-
* Whether the tab is in the horizontal orientation
|
|
71
|
-
*/
|
|
72
|
-
isHorizontal: boolean;
|
|
73
66
|
/**
|
|
74
|
-
*
|
|
75
|
-
* Whether the tab is in the vertical orientation
|
|
67
|
+
* Whether the tab is composite
|
|
76
68
|
*/
|
|
77
|
-
|
|
78
|
-
}
|
|
69
|
+
composite: boolean;
|
|
70
|
+
}
|
|
71
|
+
type UserDefinedContext = RequiredBy<PublicContext, "id">;
|
|
72
|
+
type ComputedContext = Readonly<{}>;
|
|
79
73
|
interface PrivateContext {
|
|
80
74
|
}
|
|
81
75
|
interface MachineContext extends PublicContext, ComputedContext, PrivateContext {
|
|
@@ -136,6 +130,23 @@ interface MachineApi<T extends PropTypes = PropTypes> {
|
|
|
136
130
|
* Sets the indicator rect to the tab with the given value
|
|
137
131
|
*/
|
|
138
132
|
setIndicatorRect(value: string): void;
|
|
133
|
+
/**
|
|
134
|
+
* Synchronizes the tab index of the content element.
|
|
135
|
+
* Useful when rendering tabs within a select or combobox
|
|
136
|
+
*/
|
|
137
|
+
syncTabIndex(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Set focus on the selected tab trigger
|
|
140
|
+
*/
|
|
141
|
+
focus(): void;
|
|
142
|
+
/**
|
|
143
|
+
* Selects the next tab
|
|
144
|
+
*/
|
|
145
|
+
selectNext(fromValue?: string): void;
|
|
146
|
+
/**
|
|
147
|
+
* Selects the previous tab
|
|
148
|
+
*/
|
|
149
|
+
selectPrev(fromValue?: string): void;
|
|
139
150
|
/**
|
|
140
151
|
* Returns the state of the trigger with the given props
|
|
141
152
|
*/
|
|
@@ -151,8 +162,8 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
|
|
|
151
162
|
|
|
152
163
|
declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
|
|
153
164
|
|
|
154
|
-
declare const props: ("value" | "dir" | "id" | "orientation" | "ids" | "translations" | "loopFocus" | "activationMode" | "onValueChange" | "onFocusChange" | "
|
|
155
|
-
declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "value" | "dir" | "id" | "orientation" | "ids" | "translations" | "loopFocus" | "activationMode" | "onValueChange" | "onFocusChange" | "
|
|
165
|
+
declare const props: ("value" | "dir" | "id" | "getRootNode" | "orientation" | "ids" | "translations" | "loopFocus" | "activationMode" | "onValueChange" | "onFocusChange" | "composite")[];
|
|
166
|
+
declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "value" | "dir" | "id" | "getRootNode" | "orientation" | "ids" | "translations" | "loopFocus" | "activationMode" | "onValueChange" | "onFocusChange" | "composite">];
|
|
156
167
|
declare const triggerProps: (keyof TriggerProps)[];
|
|
157
168
|
declare const splitTriggerProps: <Props extends TriggerProps>(props: Props) => [TriggerProps, Omit<Props, keyof TriggerProps>];
|
|
158
169
|
declare const contentProps: "value"[];
|
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ interface PublicContext extends DirectionProperty, CommonProperties {
|
|
|
29
29
|
/**
|
|
30
30
|
* Specifies the localized strings that identifies the accessibility elements and their states
|
|
31
31
|
*/
|
|
32
|
-
translations
|
|
32
|
+
translations?: IntlTranslations;
|
|
33
33
|
/**
|
|
34
34
|
* Whether the keyboard navigation will loop from last tab to first, and vice versa.
|
|
35
35
|
* @default true
|
|
@@ -51,6 +51,7 @@ interface PublicContext extends DirectionProperty, CommonProperties {
|
|
|
51
51
|
* The activation mode of the tabs. Can be `manual` or `automatic`
|
|
52
52
|
* - `manual`: Tabs are activated when clicked or press `enter` key.
|
|
53
53
|
* - `automatic`: Tabs are activated when receiving focus
|
|
54
|
+
*
|
|
54
55
|
* @default "automatic"
|
|
55
56
|
*/
|
|
56
57
|
activationMode?: "manual" | "automatic";
|
|
@@ -62,20 +63,13 @@ interface PublicContext extends DirectionProperty, CommonProperties {
|
|
|
62
63
|
* Callback to be called when the focused tab changes
|
|
63
64
|
*/
|
|
64
65
|
onFocusChange?: (details: FocusChangeDetails) => void;
|
|
65
|
-
}
|
|
66
|
-
type UserDefinedContext = RequiredBy<PublicContext, "id">;
|
|
67
|
-
type ComputedContext = Readonly<{
|
|
68
|
-
/**
|
|
69
|
-
* @computed
|
|
70
|
-
* Whether the tab is in the horizontal orientation
|
|
71
|
-
*/
|
|
72
|
-
isHorizontal: boolean;
|
|
73
66
|
/**
|
|
74
|
-
*
|
|
75
|
-
* Whether the tab is in the vertical orientation
|
|
67
|
+
* Whether the tab is composite
|
|
76
68
|
*/
|
|
77
|
-
|
|
78
|
-
}
|
|
69
|
+
composite: boolean;
|
|
70
|
+
}
|
|
71
|
+
type UserDefinedContext = RequiredBy<PublicContext, "id">;
|
|
72
|
+
type ComputedContext = Readonly<{}>;
|
|
79
73
|
interface PrivateContext {
|
|
80
74
|
}
|
|
81
75
|
interface MachineContext extends PublicContext, ComputedContext, PrivateContext {
|
|
@@ -136,6 +130,23 @@ interface MachineApi<T extends PropTypes = PropTypes> {
|
|
|
136
130
|
* Sets the indicator rect to the tab with the given value
|
|
137
131
|
*/
|
|
138
132
|
setIndicatorRect(value: string): void;
|
|
133
|
+
/**
|
|
134
|
+
* Synchronizes the tab index of the content element.
|
|
135
|
+
* Useful when rendering tabs within a select or combobox
|
|
136
|
+
*/
|
|
137
|
+
syncTabIndex(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Set focus on the selected tab trigger
|
|
140
|
+
*/
|
|
141
|
+
focus(): void;
|
|
142
|
+
/**
|
|
143
|
+
* Selects the next tab
|
|
144
|
+
*/
|
|
145
|
+
selectNext(fromValue?: string): void;
|
|
146
|
+
/**
|
|
147
|
+
* Selects the previous tab
|
|
148
|
+
*/
|
|
149
|
+
selectPrev(fromValue?: string): void;
|
|
139
150
|
/**
|
|
140
151
|
* Returns the state of the trigger with the given props
|
|
141
152
|
*/
|
|
@@ -151,8 +162,8 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
|
|
|
151
162
|
|
|
152
163
|
declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
|
|
153
164
|
|
|
154
|
-
declare const props: ("value" | "dir" | "id" | "orientation" | "ids" | "translations" | "loopFocus" | "activationMode" | "onValueChange" | "onFocusChange" | "
|
|
155
|
-
declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "value" | "dir" | "id" | "orientation" | "ids" | "translations" | "loopFocus" | "activationMode" | "onValueChange" | "onFocusChange" | "
|
|
165
|
+
declare const props: ("value" | "dir" | "id" | "getRootNode" | "orientation" | "ids" | "translations" | "loopFocus" | "activationMode" | "onValueChange" | "onFocusChange" | "composite")[];
|
|
166
|
+
declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "value" | "dir" | "id" | "getRootNode" | "orientation" | "ids" | "translations" | "loopFocus" | "activationMode" | "onValueChange" | "onFocusChange" | "composite">];
|
|
156
167
|
declare const triggerProps: (keyof TriggerProps)[];
|
|
157
168
|
declare const splitTriggerProps: <Props extends TriggerProps>(props: Props) => [TriggerProps, Omit<Props, keyof TriggerProps>];
|
|
158
169
|
declare const contentProps: "value"[];
|