@zag-js/tabs 2.0.0-next.3 → 2.0.0-next.4
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 +7 -8
- package/dist/index.d.ts +7 -8
- 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 -7
- package/dist/tabs.connect.d.ts +4 -7
- package/dist/tabs.connect.js +253 -231
- package/dist/tabs.connect.mjs +249 -204
- package/dist/tabs.dom.d.mts +27 -33
- package/dist/tabs.dom.d.ts +27 -33
- package/dist/tabs.dom.js +77 -84
- package/dist/tabs.dom.mjs +57 -44
- package/dist/tabs.machine.d.mts +2 -7
- package/dist/tabs.machine.d.ts +2 -7
- package/dist/tabs.machine.js +301 -329
- package/dist/tabs.machine.mjs +298 -294
- package/dist/tabs.props.d.mts +7 -12
- package/dist/tabs.props.d.ts +7 -12
- package/dist/tabs.props.js +33 -61
- package/dist/tabs.props.mjs +24 -31
- package/dist/tabs.types.d.mts +252 -194
- package/dist/tabs.types.d.ts +252 -194
- package/dist/tabs.types.js +4 -18
- package/dist/tabs.types.mjs +1 -0
- package/package.json +7 -7
package/dist/tabs.connect.mjs
CHANGED
|
@@ -1,207 +1,252 @@
|
|
|
1
|
-
// src/tabs.connect.ts
|
|
2
|
-
import {
|
|
3
|
-
contains,
|
|
4
|
-
dataAttr,
|
|
5
|
-
getEventKey,
|
|
6
|
-
getEventTarget,
|
|
7
|
-
isComposingEvent,
|
|
8
|
-
isOpeningInNewTab,
|
|
9
|
-
isSafari
|
|
10
|
-
} from "@zag-js/dom-query";
|
|
11
|
-
import { toPx } from "@zag-js/utils";
|
|
12
1
|
import { parts } from "./tabs.anatomy.mjs";
|
|
13
|
-
import
|
|
2
|
+
import { getContentId, getListEl, getTriggerEl, getTriggerId } from "./tabs.dom.mjs";
|
|
3
|
+
import { contains, dataAttr, getEventKey, getEventTarget, isAnchorElement, isComposingEvent, isDownloadingEvent, isModifierKey, isOpeningInNewTab, isSafari } from "@zag-js/dom-query";
|
|
4
|
+
import { toPx } from "@zag-js/utils";
|
|
5
|
+
// src/tabs.connect.ts
|
|
14
6
|
function connect(service, normalize) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
7
|
+
const { state, send, context, prop, scope, computed } = service;
|
|
8
|
+
const translations = prop("translations");
|
|
9
|
+
const focused = state.matches("focused");
|
|
10
|
+
const isVertical = prop("orientation") === "vertical";
|
|
11
|
+
const isHorizontal = prop("orientation") === "horizontal";
|
|
12
|
+
const virtualFocus = prop("virtualFocus");
|
|
13
|
+
const tabStopValue = context.get("tabStopValue") ?? context.get("value");
|
|
14
|
+
const activationDirection = computed("activationDirection");
|
|
15
|
+
const indicatorRect = context.get("indicatorRect");
|
|
16
|
+
const indicatorPending = context.get("ssr") || indicatorRect != null && isRectEmpty(indicatorRect);
|
|
17
|
+
function moveFocus(to) {
|
|
18
|
+
send({
|
|
19
|
+
type: "FOCUS.MOVE",
|
|
20
|
+
to,
|
|
21
|
+
src: "keyboard"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function getRootState() {
|
|
25
|
+
return {
|
|
26
|
+
focused,
|
|
27
|
+
orientation: prop("orientation"),
|
|
28
|
+
activationDirection
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function getTriggerState(props) {
|
|
32
|
+
return {
|
|
33
|
+
selected: context.get("value") === props.value,
|
|
34
|
+
focused: context.get("focusedValue") === props.value,
|
|
35
|
+
disabled: !!props.disabled
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function getContentState(props) {
|
|
39
|
+
return {
|
|
40
|
+
...getRootState(),
|
|
41
|
+
selected: context.get("value") === props.value
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function getIndicatorState() {
|
|
45
|
+
const rect = context.get("indicatorRect");
|
|
46
|
+
return {
|
|
47
|
+
...getRootState(),
|
|
48
|
+
visible: !isRectEmpty(rect),
|
|
49
|
+
instant: context.get("indicatorInstant")
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
value: context.get("value"),
|
|
54
|
+
focusedValue: context.get("focusedValue"),
|
|
55
|
+
activationDirection,
|
|
56
|
+
setValue(value, reason = "script") {
|
|
57
|
+
send({
|
|
58
|
+
type: "VALUE.SET",
|
|
59
|
+
value,
|
|
60
|
+
src: reason
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
clearValue() {
|
|
64
|
+
send({
|
|
65
|
+
type: "VALUE.SET",
|
|
66
|
+
value: null,
|
|
67
|
+
src: "script"
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
setIndicatorRect(value) {
|
|
71
|
+
send({
|
|
72
|
+
type: "INDICATOR.SET",
|
|
73
|
+
value
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
syncTabIndex() {
|
|
77
|
+
send({ type: "CONTENT.SYNC" });
|
|
78
|
+
},
|
|
79
|
+
selectNext(fromValue) {
|
|
80
|
+
send({
|
|
81
|
+
type: "VALUE.STEP",
|
|
82
|
+
step: 1,
|
|
83
|
+
from: fromValue,
|
|
84
|
+
src: "script"
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
selectPrevious(fromValue) {
|
|
88
|
+
send({
|
|
89
|
+
type: "VALUE.STEP",
|
|
90
|
+
step: -1,
|
|
91
|
+
from: fromValue,
|
|
92
|
+
src: "script"
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
focus() {
|
|
96
|
+
const value = context.get("value");
|
|
97
|
+
if (!value) return;
|
|
98
|
+
getTriggerEl(scope, value)?.focus();
|
|
99
|
+
},
|
|
100
|
+
getRootState,
|
|
101
|
+
getRootProps() {
|
|
102
|
+
const rootState = getRootState();
|
|
103
|
+
return normalize.element({
|
|
104
|
+
...parts.root.attrs(scope.id),
|
|
105
|
+
"data-orientation": rootState.orientation,
|
|
106
|
+
"data-focus": dataAttr(rootState.focused),
|
|
107
|
+
"data-activation-direction": rootState.activationDirection,
|
|
108
|
+
dir: prop("dir")
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
getListProps() {
|
|
112
|
+
const rootState = getRootState();
|
|
113
|
+
return normalize.element({
|
|
114
|
+
...parts.list.attrs(scope.id),
|
|
115
|
+
role: "tablist",
|
|
116
|
+
dir: prop("dir"),
|
|
117
|
+
"data-focus": dataAttr(rootState.focused),
|
|
118
|
+
"aria-orientation": rootState.orientation,
|
|
119
|
+
"data-orientation": rootState.orientation,
|
|
120
|
+
"data-activation-direction": rootState.activationDirection,
|
|
121
|
+
"aria-label": translations?.listLabel,
|
|
122
|
+
onKeyDown(event) {
|
|
123
|
+
if (event.defaultPrevented) return;
|
|
124
|
+
if (isComposingEvent(event)) return;
|
|
125
|
+
if (isModifierKey(event) || event.shiftKey) return;
|
|
126
|
+
if (!contains(event.currentTarget, getEventTarget(event))) return;
|
|
127
|
+
const exec = {
|
|
128
|
+
ArrowDown() {
|
|
129
|
+
if (isHorizontal) return;
|
|
130
|
+
moveFocus("next");
|
|
131
|
+
},
|
|
132
|
+
ArrowUp() {
|
|
133
|
+
if (isHorizontal) return;
|
|
134
|
+
moveFocus("prev");
|
|
135
|
+
},
|
|
136
|
+
ArrowLeft() {
|
|
137
|
+
if (isVertical) return;
|
|
138
|
+
moveFocus("prev");
|
|
139
|
+
},
|
|
140
|
+
ArrowRight() {
|
|
141
|
+
if (isVertical) return;
|
|
142
|
+
moveFocus("next");
|
|
143
|
+
},
|
|
144
|
+
Home() {
|
|
145
|
+
moveFocus("first");
|
|
146
|
+
},
|
|
147
|
+
End() {
|
|
148
|
+
moveFocus("last");
|
|
149
|
+
}
|
|
150
|
+
}[getEventKey(event, {
|
|
151
|
+
dir: prop("dir"),
|
|
152
|
+
orientation: prop("orientation")
|
|
153
|
+
})];
|
|
154
|
+
if (exec) {
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
exec(event);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
getTriggerState,
|
|
163
|
+
getTriggerProps(props) {
|
|
164
|
+
const { value, disabled } = props;
|
|
165
|
+
const triggerState = getTriggerState(props);
|
|
166
|
+
return normalize.button({
|
|
167
|
+
...parts.trigger.attrs(scope.id),
|
|
168
|
+
role: "tab",
|
|
169
|
+
type: "button",
|
|
170
|
+
disabled,
|
|
171
|
+
dir: prop("dir"),
|
|
172
|
+
"data-orientation": prop("orientation"),
|
|
173
|
+
"data-disabled": dataAttr(disabled),
|
|
174
|
+
"aria-disabled": disabled,
|
|
175
|
+
"data-value": value,
|
|
176
|
+
"aria-selected": triggerState.selected,
|
|
177
|
+
"data-selected": dataAttr(triggerState.selected),
|
|
178
|
+
"data-focus": dataAttr(triggerState.focused),
|
|
179
|
+
"aria-controls": triggerState.selected ? getContentId(scope, value) : void 0,
|
|
180
|
+
"data-indicator-pending": dataAttr(indicatorPending),
|
|
181
|
+
"data-activation-direction": activationDirection,
|
|
182
|
+
id: getTriggerId(scope, value),
|
|
183
|
+
tabIndex: !virtualFocus && tabStopValue === value ? 0 : -1,
|
|
184
|
+
onFocus() {
|
|
185
|
+
send({
|
|
186
|
+
type: "TRIGGER.FOCUS",
|
|
187
|
+
value
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
onBlur(event) {
|
|
191
|
+
if (contains(getListEl(scope), event.relatedTarget)) return;
|
|
192
|
+
send({ type: "TRIGGER.BLUR" });
|
|
193
|
+
},
|
|
194
|
+
onClick(event) {
|
|
195
|
+
if (event.defaultPrevented) return;
|
|
196
|
+
if (isDownloadingEvent(event)) return;
|
|
197
|
+
if (isOpeningInNewTab(event)) return;
|
|
198
|
+
if (event.shiftKey && isAnchorElement(event.currentTarget)) return;
|
|
199
|
+
if (disabled) return;
|
|
200
|
+
if (isSafari()) event.currentTarget.focus();
|
|
201
|
+
const node = event.currentTarget;
|
|
202
|
+
if (prop("navigate") != null && isAnchorElement(node)) event.preventDefault();
|
|
203
|
+
send({
|
|
204
|
+
type: "TRIGGER.CLICK",
|
|
205
|
+
value,
|
|
206
|
+
src: "trigger-click"
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
getContentState,
|
|
212
|
+
getContentProps(props) {
|
|
213
|
+
const { value } = props;
|
|
214
|
+
const contentState = getContentState(props);
|
|
215
|
+
return normalize.element({
|
|
216
|
+
...parts.content.attrs(scope.id),
|
|
217
|
+
dir: prop("dir"),
|
|
218
|
+
id: getContentId(scope, value),
|
|
219
|
+
tabIndex: virtualFocus ? -1 : contentState.selected && context.get("hasFocusableContent") ? void 0 : 0,
|
|
220
|
+
"aria-labelledby": getTriggerId(scope, value),
|
|
221
|
+
role: "tabpanel",
|
|
222
|
+
"data-selected": dataAttr(contentState.selected),
|
|
223
|
+
"data-orientation": contentState.orientation,
|
|
224
|
+
"data-activation-direction": contentState.activationDirection,
|
|
225
|
+
hidden: !contentState.selected
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
getIndicatorState,
|
|
229
|
+
getIndicatorProps() {
|
|
230
|
+
const indicatorState = getIndicatorState();
|
|
231
|
+
const rect = context.get("indicatorRect");
|
|
232
|
+
return normalize.element({
|
|
233
|
+
...parts.indicator.attrs(scope.id),
|
|
234
|
+
dir: prop("dir"),
|
|
235
|
+
"data-orientation": indicatorState.orientation,
|
|
236
|
+
"data-instant": dataAttr(indicatorState.instant),
|
|
237
|
+
"data-activation-direction": indicatorState.activationDirection,
|
|
238
|
+
hidden: !indicatorState.visible,
|
|
239
|
+
style: {
|
|
240
|
+
"--left": toPx(rect?.x),
|
|
241
|
+
"--top": toPx(rect?.y),
|
|
242
|
+
"--width": toPx(rect?.width),
|
|
243
|
+
"--height": toPx(rect?.height),
|
|
244
|
+
position: "absolute",
|
|
245
|
+
[isHorizontal ? "left" : "top"]: isHorizontal ? "var(--left)" : "var(--top)"
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
};
|
|
203
250
|
}
|
|
204
|
-
|
|
205
|
-
export {
|
|
206
|
-
connect
|
|
207
|
-
};
|
|
251
|
+
const isRectEmpty = (rect) => rect == null || rect.width === 0 && rect.height === 0 && rect.x === 0 && rect.y === 0;
|
|
252
|
+
export { connect };
|
package/dist/tabs.dom.d.mts
CHANGED
|
@@ -1,36 +1,30 @@
|
|
|
1
|
-
import { Scope } from
|
|
2
|
-
|
|
3
|
-
declare const getRootId: (ctx: Scope) => any;
|
|
4
|
-
declare const getListId: (ctx: Scope) => any;
|
|
5
|
-
declare const getContentId: (ctx: Scope, value: string) => any;
|
|
6
|
-
declare const getTriggerId: (ctx: Scope, value: string) => any;
|
|
7
|
-
declare const getIndicatorId: (ctx: Scope) => any;
|
|
8
|
-
declare const getListEl: (ctx: Scope) => HTMLElement | null;
|
|
9
|
-
declare const getContentEl: (ctx: Scope, value: string) => HTMLElement | null;
|
|
10
|
-
declare const getTriggerEl: (ctx: Scope, value: string | null) => HTMLElement | null;
|
|
11
|
-
declare const getIndicatorEl: (ctx: Scope) => HTMLElement | null;
|
|
12
|
-
declare const getElements: (ctx: Scope) => HTMLElement[];
|
|
13
|
-
declare const getFirstTriggerEl: (ctx: Scope) => HTMLElement | undefined;
|
|
14
|
-
declare const getLastTriggerEl: (ctx: Scope) => HTMLElement | undefined;
|
|
15
|
-
declare const getNextTriggerEl: (ctx: Scope, opts: {
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { Scope } from "@zag-js/core";
|
|
2
|
+
import { ActivationDirection, Orientation } from "@zag-js/types";
|
|
3
|
+
export declare const getRootId: (ctx: Scope) => any;
|
|
4
|
+
export declare const getListId: (ctx: Scope) => any;
|
|
5
|
+
export declare const getContentId: (ctx: Scope, value: string) => any;
|
|
6
|
+
export declare const getTriggerId: (ctx: Scope, value: string) => any;
|
|
7
|
+
export declare const getIndicatorId: (ctx: Scope) => any;
|
|
8
|
+
export declare const getListEl: (ctx: Scope) => HTMLElement | null;
|
|
9
|
+
export declare const getContentEl: (ctx: Scope, value: string) => HTMLElement | null;
|
|
10
|
+
export declare const getTriggerEl: (ctx: Scope, value: string | null) => HTMLElement | null;
|
|
11
|
+
export declare const getIndicatorEl: (ctx: Scope) => HTMLElement | null;
|
|
12
|
+
export declare const getElements: (ctx: Scope) => HTMLElement[];
|
|
13
|
+
export declare const getFirstTriggerEl: (ctx: Scope) => HTMLElement | undefined;
|
|
14
|
+
export declare const getLastTriggerEl: (ctx: Scope) => HTMLElement | undefined;
|
|
15
|
+
export declare const getNextTriggerEl: (ctx: Scope, opts: {
|
|
16
|
+
value: string;
|
|
17
|
+
loopFocus?: boolean | undefined;
|
|
18
18
|
}) => HTMLElement;
|
|
19
|
-
declare const getPrevTriggerEl: (ctx: Scope, opts: {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export declare const getPrevTriggerEl: (ctx: Scope, opts: {
|
|
20
|
+
value: string;
|
|
21
|
+
loopFocus?: boolean | undefined;
|
|
22
22
|
}) => HTMLElement | null;
|
|
23
|
-
declare const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
export declare const getSiblingTriggerEl: (ctx: Scope, value: string | null, step: number, loopFocus?: boolean) => HTMLElement | null | undefined;
|
|
24
|
+
export declare const getTriggerRect: (ctx: Scope, triggerEl: HTMLElement) => {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
28
29
|
};
|
|
29
|
-
declare const
|
|
30
|
-
x: number;
|
|
31
|
-
y: number;
|
|
32
|
-
width: number;
|
|
33
|
-
height: number;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export { getContentEl, getContentId, getElements, getFirstTriggerEl, getIndicatorEl, getIndicatorId, getLastTriggerEl, getListEl, getListId, getNextTriggerEl, getOffsetRect, getPrevTriggerEl, getRectByValue, getRootId, getTriggerEl, getTriggerId };
|
|
30
|
+
export declare const getActivationDirection: (ctx: Scope, prevValue: string | null, value: string | null, orientation: Orientation) => ActivationDirection;
|
package/dist/tabs.dom.d.ts
CHANGED
|
@@ -1,36 +1,30 @@
|
|
|
1
|
-
import { Scope } from
|
|
2
|
-
|
|
3
|
-
declare const getRootId: (ctx: Scope) => any;
|
|
4
|
-
declare const getListId: (ctx: Scope) => any;
|
|
5
|
-
declare const getContentId: (ctx: Scope, value: string) => any;
|
|
6
|
-
declare const getTriggerId: (ctx: Scope, value: string) => any;
|
|
7
|
-
declare const getIndicatorId: (ctx: Scope) => any;
|
|
8
|
-
declare const getListEl: (ctx: Scope) => HTMLElement | null;
|
|
9
|
-
declare const getContentEl: (ctx: Scope, value: string) => HTMLElement | null;
|
|
10
|
-
declare const getTriggerEl: (ctx: Scope, value: string | null) => HTMLElement | null;
|
|
11
|
-
declare const getIndicatorEl: (ctx: Scope) => HTMLElement | null;
|
|
12
|
-
declare const getElements: (ctx: Scope) => HTMLElement[];
|
|
13
|
-
declare const getFirstTriggerEl: (ctx: Scope) => HTMLElement | undefined;
|
|
14
|
-
declare const getLastTriggerEl: (ctx: Scope) => HTMLElement | undefined;
|
|
15
|
-
declare const getNextTriggerEl: (ctx: Scope, opts: {
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { Scope } from "@zag-js/core";
|
|
2
|
+
import { ActivationDirection, Orientation } from "@zag-js/types";
|
|
3
|
+
export declare const getRootId: (ctx: Scope) => any;
|
|
4
|
+
export declare const getListId: (ctx: Scope) => any;
|
|
5
|
+
export declare const getContentId: (ctx: Scope, value: string) => any;
|
|
6
|
+
export declare const getTriggerId: (ctx: Scope, value: string) => any;
|
|
7
|
+
export declare const getIndicatorId: (ctx: Scope) => any;
|
|
8
|
+
export declare const getListEl: (ctx: Scope) => HTMLElement | null;
|
|
9
|
+
export declare const getContentEl: (ctx: Scope, value: string) => HTMLElement | null;
|
|
10
|
+
export declare const getTriggerEl: (ctx: Scope, value: string | null) => HTMLElement | null;
|
|
11
|
+
export declare const getIndicatorEl: (ctx: Scope) => HTMLElement | null;
|
|
12
|
+
export declare const getElements: (ctx: Scope) => HTMLElement[];
|
|
13
|
+
export declare const getFirstTriggerEl: (ctx: Scope) => HTMLElement | undefined;
|
|
14
|
+
export declare const getLastTriggerEl: (ctx: Scope) => HTMLElement | undefined;
|
|
15
|
+
export declare const getNextTriggerEl: (ctx: Scope, opts: {
|
|
16
|
+
value: string;
|
|
17
|
+
loopFocus?: boolean | undefined;
|
|
18
18
|
}) => HTMLElement;
|
|
19
|
-
declare const getPrevTriggerEl: (ctx: Scope, opts: {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export declare const getPrevTriggerEl: (ctx: Scope, opts: {
|
|
20
|
+
value: string;
|
|
21
|
+
loopFocus?: boolean | undefined;
|
|
22
22
|
}) => HTMLElement | null;
|
|
23
|
-
declare const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
export declare const getSiblingTriggerEl: (ctx: Scope, value: string | null, step: number, loopFocus?: boolean) => HTMLElement | null | undefined;
|
|
24
|
+
export declare const getTriggerRect: (ctx: Scope, triggerEl: HTMLElement) => {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
28
29
|
};
|
|
29
|
-
declare const
|
|
30
|
-
x: number;
|
|
31
|
-
y: number;
|
|
32
|
-
width: number;
|
|
33
|
-
height: number;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export { getContentEl, getContentId, getElements, getFirstTriggerEl, getIndicatorEl, getIndicatorId, getLastTriggerEl, getListEl, getListId, getNextTriggerEl, getOffsetRect, getPrevTriggerEl, getRectByValue, getRootId, getTriggerEl, getTriggerId };
|
|
30
|
+
export declare const getActivationDirection: (ctx: Scope, prevValue: string | null, value: string | null, orientation: Orientation) => ActivationDirection;
|