@zag-js/tabs 1.47.0 → 1.48.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 +6 -9
- package/dist/index.d.ts +6 -9
- package/dist/index.js +16 -38
- package/dist/index.mjs +2 -7
- package/dist/tabs.anatomy.d.mts +2 -6
- package/dist/tabs.anatomy.d.ts +2 -6
- package/dist/tabs.anatomy.js +8 -33
- package/dist/tabs.anatomy.mjs +4 -7
- package/dist/tabs.connect.d.mts +4 -8
- package/dist/tabs.connect.d.ts +4 -8
- package/dist/tabs.connect.js +229 -238
- package/dist/tabs.connect.mjs +225 -212
- package/dist/tabs.dom.d.mts +30 -33
- package/dist/tabs.dom.d.ts +30 -33
- package/dist/tabs.dom.js +46 -84
- package/dist/tabs.dom.mjs +26 -43
- package/dist/tabs.machine.d.mts +2 -8
- package/dist/tabs.machine.d.ts +2 -8
- package/dist/tabs.machine.js +263 -335
- package/dist/tabs.machine.mjs +259 -299
- package/dist/tabs.props.d.mts +7 -13
- package/dist/tabs.props.d.ts +7 -13
- package/dist/tabs.props.js +33 -61
- package/dist/tabs.props.mjs +24 -31
- package/dist/tabs.types.d.mts +180 -182
- package/dist/tabs.types.d.ts +180 -182
- package/dist/tabs.types.js +4 -18
- package/dist/tabs.types.mjs +1 -0
- package/package.json +8 -8
package/dist/tabs.types.d.ts
CHANGED
|
@@ -1,194 +1,192 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
value: string;
|
|
1
|
+
import { EventObject, Machine, Service } from "@zag-js/core";
|
|
2
|
+
import { CommonProperties, DirectionProperty, PropTypes, Rect, RequiredBy } from "@zag-js/types";
|
|
3
|
+
import { AnimationFrame } from "@zag-js/dom-query";
|
|
4
|
+
export interface ValueChangeDetails {
|
|
5
|
+
value: string;
|
|
7
6
|
}
|
|
8
|
-
interface FocusChangeDetails {
|
|
9
|
-
|
|
7
|
+
export interface FocusChangeDetails {
|
|
8
|
+
focusedValue: string;
|
|
10
9
|
}
|
|
11
|
-
interface NavigateDetails {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export interface NavigateDetails {
|
|
11
|
+
value: string;
|
|
12
|
+
node: HTMLAnchorElement;
|
|
13
|
+
href: string;
|
|
15
14
|
}
|
|
16
|
-
interface IntlTranslations {
|
|
17
|
-
|
|
15
|
+
export interface IntlTranslations {
|
|
16
|
+
listLabel?: string | undefined;
|
|
18
17
|
}
|
|
19
|
-
interface ElementIds {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
export interface ElementIds {
|
|
19
|
+
root?: string | undefined;
|
|
20
|
+
trigger?: ((value: string) => string) | undefined;
|
|
21
|
+
list?: string | undefined;
|
|
22
|
+
content?: ((value: string) => string) | undefined;
|
|
23
|
+
indicator?: string | undefined;
|
|
25
24
|
}
|
|
26
|
-
interface TabsProps extends DirectionProperty, CommonProperties {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
25
|
+
export interface TabsProps extends DirectionProperty, CommonProperties {
|
|
26
|
+
/**
|
|
27
|
+
* The ids of the elements in the tabs. Useful for composition.
|
|
28
|
+
*/
|
|
29
|
+
ids?: ElementIds | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Specifies the localized strings that identifies the accessibility elements and their states
|
|
32
|
+
*/
|
|
33
|
+
translations?: IntlTranslations | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the keyboard navigation will loop from last tab to first, and vice versa.
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
loopFocus?: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* The controlled selected tab value
|
|
41
|
+
*/
|
|
42
|
+
value?: string | null | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The initial selected tab value when rendered.
|
|
45
|
+
* Use when you don't need to control the selected tab value.
|
|
46
|
+
*/
|
|
47
|
+
defaultValue?: string | null | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* The orientation of the tabs. Can be `horizontal` or `vertical`
|
|
50
|
+
* - `horizontal`: only left and right arrow key navigation will work.
|
|
51
|
+
* - `vertical`: only up and down arrow key navigation will work.
|
|
52
|
+
*
|
|
53
|
+
* @default "horizontal"
|
|
54
|
+
*/
|
|
55
|
+
orientation?: "horizontal" | "vertical" | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* The activation mode of the tabs. Can be `manual` or `automatic`
|
|
58
|
+
* - `manual`: Tabs are activated when clicked or press `enter` key.
|
|
59
|
+
* - `automatic`: Tabs are activated when receiving focus
|
|
60
|
+
*
|
|
61
|
+
* @default "automatic"
|
|
62
|
+
*/
|
|
63
|
+
activationMode?: "manual" | "automatic" | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Callback to be called when the selected/active tab changes
|
|
66
|
+
*/
|
|
67
|
+
onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Callback to be called when the focused tab changes
|
|
70
|
+
*/
|
|
71
|
+
onFocusChange?: ((details: FocusChangeDetails) => void) | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Whether the tab is composite
|
|
74
|
+
*/
|
|
75
|
+
composite?: boolean | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Whether the active tab can be deselected when clicking on it.
|
|
78
|
+
*/
|
|
79
|
+
deselectable?: boolean | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Function to navigate to the selected tab when clicking on it.
|
|
82
|
+
* Useful if tab triggers are anchor elements.
|
|
83
|
+
*/
|
|
84
|
+
navigate?: ((details: NavigateDetails) => void) | null | undefined;
|
|
86
85
|
}
|
|
87
86
|
type PropsWithDefault = "orientation" | "activationMode" | "loopFocus";
|
|
88
|
-
type TabsSchema = {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
87
|
+
export type TabsSchema = {
|
|
88
|
+
state: "idle" | "focused";
|
|
89
|
+
props: RequiredBy<TabsProps, PropsWithDefault>;
|
|
90
|
+
context: {
|
|
91
|
+
ssr: boolean;
|
|
92
|
+
value: string | null;
|
|
93
|
+
focusedValue: string | null;
|
|
94
|
+
indicatorRect: Rect | null;
|
|
95
|
+
animateIndicator: boolean;
|
|
96
|
+
};
|
|
97
|
+
refs: {
|
|
98
|
+
indicatorCleanup: VoidFunction | null | undefined;
|
|
99
|
+
prevValue: string | null;
|
|
100
|
+
focusFrame: AnimationFrame;
|
|
101
|
+
};
|
|
102
|
+
computed: {
|
|
103
|
+
focused: boolean;
|
|
104
|
+
};
|
|
105
|
+
action: string;
|
|
106
|
+
guard: string;
|
|
107
|
+
effect: string;
|
|
108
|
+
event: EventObject & {
|
|
109
|
+
src?: "keyboard" | "selectNext" | "selectPrev" | undefined;
|
|
110
|
+
};
|
|
112
111
|
};
|
|
113
|
-
type TabsService = Service<TabsSchema>;
|
|
114
|
-
type TabsMachine = Machine<TabsSchema>;
|
|
115
|
-
interface TriggerProps {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
export type TabsService = Service<TabsSchema>;
|
|
113
|
+
export type TabsMachine = Machine<TabsSchema>;
|
|
114
|
+
export interface TriggerProps {
|
|
115
|
+
/**
|
|
116
|
+
* The value of the tab
|
|
117
|
+
*/
|
|
118
|
+
value: string;
|
|
119
|
+
/**
|
|
120
|
+
* Whether the tab is disabled
|
|
121
|
+
*/
|
|
122
|
+
disabled?: boolean | undefined;
|
|
124
123
|
}
|
|
125
|
-
interface TriggerState {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
124
|
+
export interface TriggerState {
|
|
125
|
+
/**
|
|
126
|
+
* Whether the tab is selected
|
|
127
|
+
*/
|
|
128
|
+
selected: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Whether the tab is focused
|
|
131
|
+
*/
|
|
132
|
+
focused: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Whether the tab is disabled
|
|
135
|
+
*/
|
|
136
|
+
disabled: boolean;
|
|
138
137
|
}
|
|
139
|
-
interface ContentProps {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
export interface ContentProps {
|
|
139
|
+
/**
|
|
140
|
+
* The value of the tab
|
|
141
|
+
*/
|
|
142
|
+
value: string;
|
|
144
143
|
}
|
|
145
|
-
interface TabsApi<T extends PropTypes = PropTypes> {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
144
|
+
export interface TabsApi<T extends PropTypes = PropTypes> {
|
|
145
|
+
/**
|
|
146
|
+
* The current value of the tabs.
|
|
147
|
+
*/
|
|
148
|
+
value: string | null;
|
|
149
|
+
/**
|
|
150
|
+
* The value of the tab that is currently focused.
|
|
151
|
+
*/
|
|
152
|
+
focusedValue: string | null;
|
|
153
|
+
/**
|
|
154
|
+
* Sets the value of the tabs.
|
|
155
|
+
*/
|
|
156
|
+
setValue: (value: string) => void;
|
|
157
|
+
/**
|
|
158
|
+
* Clears the value of the tabs.
|
|
159
|
+
*/
|
|
160
|
+
clearValue: VoidFunction;
|
|
161
|
+
/**
|
|
162
|
+
* Sets the indicator rect to the tab with the given value
|
|
163
|
+
*/
|
|
164
|
+
setIndicatorRect: (value: string) => void;
|
|
165
|
+
/**
|
|
166
|
+
* Synchronizes the tab index of the content element.
|
|
167
|
+
* Useful when rendering tabs within a select or combobox
|
|
168
|
+
*/
|
|
169
|
+
syncTabIndex: VoidFunction;
|
|
170
|
+
/**
|
|
171
|
+
* Set focus on the selected tab trigger
|
|
172
|
+
*/
|
|
173
|
+
focus: VoidFunction;
|
|
174
|
+
/**
|
|
175
|
+
* Selects the next tab
|
|
176
|
+
*/
|
|
177
|
+
selectNext: (fromValue?: string) => void;
|
|
178
|
+
/**
|
|
179
|
+
* Selects the previous tab
|
|
180
|
+
*/
|
|
181
|
+
selectPrev: (fromValue?: string) => void;
|
|
182
|
+
/**
|
|
183
|
+
* Returns the state of the trigger with the given props
|
|
184
|
+
*/
|
|
185
|
+
getTriggerState: (props: TriggerProps) => TriggerState;
|
|
186
|
+
getRootProps: () => T["element"];
|
|
187
|
+
getListProps: () => T["element"];
|
|
188
|
+
getTriggerProps: (props: TriggerProps) => T["button"];
|
|
189
|
+
getContentProps: (props: ContentProps) => T["element"];
|
|
190
|
+
getIndicatorProps: () => T["element"];
|
|
192
191
|
}
|
|
193
|
-
|
|
194
|
-
export type { ContentProps, ElementIds, FocusChangeDetails, IntlTranslations, NavigateDetails, TabsApi, TabsMachine, TabsProps, TabsSchema, TabsService, TriggerProps, TriggerState, ValueChangeDetails };
|
|
192
|
+
export {};
|
package/dist/tabs.types.js
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/tabs.types.ts
|
|
17
|
-
var tabs_types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(tabs_types_exports);
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
package/dist/tabs.types.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/tabs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.48.0",
|
|
4
4
|
"description": "Core logic for the tabs widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/anatomy": "1.
|
|
33
|
-
"@zag-js/dom-query": "1.
|
|
34
|
-
"@zag-js/utils": "1.
|
|
35
|
-
"@zag-js/core": "1.
|
|
36
|
-
"@zag-js/types": "1.
|
|
32
|
+
"@zag-js/anatomy": "1.48.0",
|
|
33
|
+
"@zag-js/dom-query": "1.48.0",
|
|
34
|
+
"@zag-js/utils": "1.48.0",
|
|
35
|
+
"@zag-js/core": "1.48.0",
|
|
36
|
+
"@zag-js/types": "1.48.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"clean-package": "2.2.0"
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"./package.json": "./package.json"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
|
-
"build": "
|
|
70
|
-
"lint": "
|
|
69
|
+
"build": "tsdown",
|
|
70
|
+
"lint": "oxlint src",
|
|
71
71
|
"typecheck": "tsc --noEmit"
|
|
72
72
|
}
|
|
73
73
|
}
|