@zag-js/tabs 0.1.7 → 0.1.10
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.ts +0 -1
- package/dist/index.js +114 -179
- package/dist/index.mjs +114 -180
- package/dist/tabs.connect.d.ts +2 -3
- package/dist/tabs.dom.d.ts +17 -4
- package/dist/tabs.machine.d.ts +2 -3
- package/dist/tabs.types.d.ts +4 -5
- package/package.json +6 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -7
- package/dist/index.mjs.map +0 -7
- package/dist/tabs.connect.d.ts.map +0 -1
- package/dist/tabs.dom.d.ts.map +0 -1
- package/dist/tabs.machine.d.ts.map +0 -1
- package/dist/tabs.types.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -16,99 +16,99 @@ var __spreadValues = (a, b) => {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
// ../../utilities/dom/dist/index.mjs
|
|
19
|
+
var __defProp2 = Object.defineProperty;
|
|
20
|
+
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
21
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
22
|
+
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
23
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
24
|
+
var __spreadValues2 = (a, b) => {
|
|
25
|
+
for (var prop in b || (b = {}))
|
|
26
|
+
if (__hasOwnProp2.call(b, prop))
|
|
27
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
28
|
+
if (__getOwnPropSymbols2)
|
|
29
|
+
for (var prop of __getOwnPropSymbols2(b)) {
|
|
30
|
+
if (__propIsEnum2.call(b, prop))
|
|
31
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
32
|
+
}
|
|
33
|
+
return a;
|
|
34
|
+
};
|
|
19
35
|
var dataAttr = (guard) => {
|
|
20
36
|
return guard ? "" : void 0;
|
|
21
37
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
globalThis.__styleCache__ = globalThis.__styleCache__ || /* @__PURE__ */ new WeakMap();
|
|
25
|
-
return globalThis.__styleCache__;
|
|
26
|
-
}
|
|
27
|
-
function getComputedStyle2(el) {
|
|
38
|
+
var isDom = () => typeof window !== "undefined";
|
|
39
|
+
function getPlatform() {
|
|
28
40
|
var _a;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const cache = getStyleCache();
|
|
32
|
-
let style = cache.get(el);
|
|
33
|
-
if (!style) {
|
|
34
|
-
const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
35
|
-
style = win.getComputedStyle(el);
|
|
36
|
-
cache.set(el, style);
|
|
37
|
-
}
|
|
38
|
-
return style;
|
|
41
|
+
const agent = navigator.userAgentData;
|
|
42
|
+
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
39
43
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
raf2(() => raf2(fn));
|
|
47
|
-
return function cleanup() {
|
|
48
|
-
set.forEach(function(fn2) {
|
|
49
|
-
fn2();
|
|
50
|
-
});
|
|
51
|
-
};
|
|
44
|
+
var pt = (v) => isDom() && v.test(getPlatform());
|
|
45
|
+
var vn = (v) => isDom() && v.test(navigator.vendor);
|
|
46
|
+
var isSafari = () => isApple() && vn(/apple/i);
|
|
47
|
+
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
48
|
+
function isDocument(el) {
|
|
49
|
+
return el.nodeType === Node.DOCUMENT_NODE;
|
|
52
50
|
}
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
function isWindow(value) {
|
|
52
|
+
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
53
|
+
}
|
|
54
|
+
function isFrame(element) {
|
|
55
|
+
return element.localName === "iframe";
|
|
56
|
+
}
|
|
57
|
+
function getDocument(el) {
|
|
58
|
+
var _a;
|
|
59
|
+
if (isWindow(el))
|
|
60
|
+
return el.document;
|
|
61
|
+
if (isDocument(el))
|
|
62
|
+
return el;
|
|
63
|
+
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
|
|
64
|
+
}
|
|
65
|
+
function defineDomHelpers(helpers) {
|
|
66
|
+
const dom2 = {
|
|
67
|
+
getRootNode: (ctx) => {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
|
|
70
|
+
},
|
|
71
|
+
getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
|
|
72
|
+
getWin: (ctx) => {
|
|
73
|
+
var _a;
|
|
74
|
+
return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
|
|
75
|
+
},
|
|
76
|
+
getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
|
|
77
|
+
getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
|
|
57
78
|
};
|
|
79
|
+
return __spreadValues2(__spreadValues2({}, dom2), helpers);
|
|
58
80
|
}
|
|
59
|
-
var isDom = () => typeof window !== "undefined";
|
|
60
|
-
var isTouchDevice = isDom() && !!navigator.maxTouchPoints;
|
|
61
81
|
function isHTMLElement(v) {
|
|
62
82
|
return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
|
|
63
83
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"input:not([disabled]):not([type=hidden])",
|
|
69
|
-
"select:not([disabled])",
|
|
70
|
-
"textarea:not([disabled])",
|
|
71
|
-
"button:not([disabled])",
|
|
72
|
-
"embed",
|
|
73
|
-
"iframe",
|
|
74
|
-
"object",
|
|
75
|
-
"a[href]",
|
|
76
|
-
"area[href]",
|
|
77
|
-
"[tabindex]",
|
|
78
|
-
"audio[controls]",
|
|
79
|
-
"video[controls]",
|
|
80
|
-
"*[tabindex]:not([aria-disabled])",
|
|
81
|
-
"[contenteditable]:not([contenteditable=false])",
|
|
82
|
-
"details > summary:first-of-type"
|
|
83
|
-
].join(",");
|
|
84
|
-
function isHidden(el, until) {
|
|
85
|
-
const style = getComputedStyle2(el);
|
|
86
|
-
if (!el || style.getPropertyValue("visibility") === "hidden")
|
|
87
|
-
return true;
|
|
88
|
-
while (el) {
|
|
89
|
-
if (until != null && el === until)
|
|
90
|
-
return false;
|
|
91
|
-
if (style.getPropertyValue("display") === "none")
|
|
92
|
-
return true;
|
|
93
|
-
el = el.parentElement;
|
|
94
|
-
}
|
|
95
|
-
return false;
|
|
84
|
+
function isVisible(el) {
|
|
85
|
+
if (!isHTMLElement(el))
|
|
86
|
+
return false;
|
|
87
|
+
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
|
|
96
88
|
}
|
|
97
|
-
var
|
|
98
|
-
|
|
89
|
+
var focusableSelector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type";
|
|
90
|
+
var getFocusables = (container, includeContainer = false) => {
|
|
91
|
+
if (!container)
|
|
99
92
|
return [];
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
103
|
-
|
|
93
|
+
const elements = Array.from(container.querySelectorAll(focusableSelector));
|
|
94
|
+
const include = includeContainer == true || includeContainer == "if-empty" && elements.length === 0;
|
|
95
|
+
if (include && isHTMLElement(container) && isFocusable(container)) {
|
|
96
|
+
elements.unshift(container);
|
|
104
97
|
}
|
|
105
|
-
|
|
98
|
+
const focusableElements = elements.filter(isFocusable);
|
|
99
|
+
focusableElements.forEach((element, i) => {
|
|
100
|
+
if (isFrame(element) && element.contentDocument) {
|
|
101
|
+
const frameBody = element.contentDocument.body;
|
|
102
|
+
focusableElements.splice(i, 1, ...getFocusables(frameBody));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return focusableElements;
|
|
106
106
|
};
|
|
107
|
-
|
|
108
|
-
if (!
|
|
107
|
+
function isFocusable(element) {
|
|
108
|
+
if (!element)
|
|
109
109
|
return false;
|
|
110
|
-
return
|
|
111
|
-
}
|
|
110
|
+
return element.matches(focusableSelector) && isVisible(element);
|
|
111
|
+
}
|
|
112
112
|
var rtlKeyMap = {
|
|
113
113
|
ArrowLeft: "ArrowRight",
|
|
114
114
|
ArrowRight: "ArrowLeft",
|
|
@@ -135,6 +135,25 @@ function getEventKey(event, options = {}) {
|
|
|
135
135
|
}
|
|
136
136
|
return key;
|
|
137
137
|
}
|
|
138
|
+
function nextTick(fn) {
|
|
139
|
+
const set = /* @__PURE__ */ new Set();
|
|
140
|
+
function raf2(fn2) {
|
|
141
|
+
const id = globalThis.requestAnimationFrame(fn2);
|
|
142
|
+
set.add(() => globalThis.cancelAnimationFrame(id));
|
|
143
|
+
}
|
|
144
|
+
raf2(() => raf2(fn));
|
|
145
|
+
return function cleanup() {
|
|
146
|
+
set.forEach(function(fn2) {
|
|
147
|
+
fn2();
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function raf(fn) {
|
|
152
|
+
const id = globalThis.requestAnimationFrame(fn);
|
|
153
|
+
return function cleanup() {
|
|
154
|
+
globalThis.cancelAnimationFrame(id);
|
|
155
|
+
};
|
|
156
|
+
}
|
|
138
157
|
function queryAll(root, selector) {
|
|
139
158
|
var _a;
|
|
140
159
|
return Array.from((_a = root == null ? void 0 : root.querySelectorAll(selector)) != null ? _a : []);
|
|
@@ -158,112 +177,38 @@ function prevById(v, id, loop = true) {
|
|
|
158
177
|
idx = loop ? (idx - 1 + v.length) % v.length : Math.max(0, idx - 1);
|
|
159
178
|
return v[idx];
|
|
160
179
|
}
|
|
161
|
-
var getValueText = (item) => {
|
|
162
|
-
var _a, _b;
|
|
163
|
-
return (_b = (_a = item.dataset.valuetext) != null ? _a : item.textContent) != null ? _b : "";
|
|
164
|
-
};
|
|
165
|
-
var match = (valueText, query2) => valueText.toLowerCase().startsWith(query2.toLowerCase());
|
|
166
|
-
var wrap = (v, idx) => {
|
|
167
|
-
return v.map((_, index) => v[(Math.max(idx, 0) + index) % v.length]);
|
|
168
|
-
};
|
|
169
|
-
function findByText(v, text, currentId) {
|
|
170
|
-
const index = currentId ? indexOfId(v, currentId) : -1;
|
|
171
|
-
let items = currentId ? wrap(v, index) : v;
|
|
172
|
-
const isSingleKey = text.length === 1;
|
|
173
|
-
if (isSingleKey) {
|
|
174
|
-
items = items.filter((item) => item.id !== currentId);
|
|
175
|
-
}
|
|
176
|
-
return items.find((item) => match(getValueText(item), text));
|
|
177
|
-
}
|
|
178
|
-
function findByTypeahead(_items, options) {
|
|
179
|
-
const { state: state2, activeId, key, timeout = 350 } = options;
|
|
180
|
-
const search = state2.keysSoFar + key;
|
|
181
|
-
const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
|
|
182
|
-
const query2 = isRepeated ? search[0] : search;
|
|
183
|
-
let items = _items.slice();
|
|
184
|
-
const next = findByText(items, query2, activeId);
|
|
185
|
-
function cleanup() {
|
|
186
|
-
clearTimeout(state2.timer);
|
|
187
|
-
state2.timer = -1;
|
|
188
|
-
}
|
|
189
|
-
function update(value) {
|
|
190
|
-
state2.keysSoFar = value;
|
|
191
|
-
cleanup();
|
|
192
|
-
if (value !== "") {
|
|
193
|
-
state2.timer = +setTimeout(() => {
|
|
194
|
-
update("");
|
|
195
|
-
cleanup();
|
|
196
|
-
}, timeout);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
update(search);
|
|
200
|
-
return next;
|
|
201
|
-
}
|
|
202
|
-
findByTypeahead.defaultOptions = {
|
|
203
|
-
keysSoFar: "",
|
|
204
|
-
timer: -1
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
// ../../types/dist/index.mjs
|
|
208
|
-
function createNormalizer(fn) {
|
|
209
|
-
return new Proxy({}, {
|
|
210
|
-
get() {
|
|
211
|
-
return fn;
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
var normalizeProp = createNormalizer((v) => v);
|
|
216
180
|
|
|
217
181
|
// ../../utilities/core/dist/index.mjs
|
|
218
182
|
var first = (v) => v[0];
|
|
219
183
|
var last = (v) => v[v.length - 1];
|
|
220
|
-
var isDom2 = () => typeof window !== "undefined";
|
|
221
|
-
function getPlatform() {
|
|
222
|
-
var _a;
|
|
223
|
-
const agent = navigator.userAgentData;
|
|
224
|
-
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
225
|
-
}
|
|
226
|
-
var pt = (v) => isDom2() && v.test(getPlatform());
|
|
227
|
-
var vn = (v) => isDom2() && v.test(navigator.vendor);
|
|
228
|
-
var isTouchDevice2 = isDom2() && !!navigator.maxTouchPoints;
|
|
229
|
-
var isSafari = () => isApple() && vn(/apple/i);
|
|
230
|
-
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
231
184
|
|
|
232
185
|
// src/tabs.dom.ts
|
|
233
|
-
var dom = {
|
|
234
|
-
getDoc: (ctx) => {
|
|
235
|
-
var _a;
|
|
236
|
-
return (_a = ctx.doc) != null ? _a : document;
|
|
237
|
-
},
|
|
238
|
-
getRootNode: (ctx) => {
|
|
239
|
-
var _a;
|
|
240
|
-
return (_a = ctx.rootNode) != null ? _a : dom.getDoc(ctx);
|
|
241
|
-
},
|
|
186
|
+
var dom = defineDomHelpers({
|
|
242
187
|
getRootId: (ctx) => {
|
|
243
188
|
var _a, _b;
|
|
244
|
-
return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `tabs:${ctx.
|
|
189
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `tabs:${ctx.id}`;
|
|
245
190
|
},
|
|
246
191
|
getTriggerGroupId: (ctx) => {
|
|
247
192
|
var _a, _b;
|
|
248
|
-
return (_b = (_a = ctx.ids) == null ? void 0 : _a.triggerGroup) != null ? _b : `tabs:${ctx.
|
|
193
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.triggerGroup) != null ? _b : `tabs:${ctx.id}:trigger-group`;
|
|
249
194
|
},
|
|
250
195
|
getContentId: (ctx, id) => {
|
|
251
196
|
var _a, _b;
|
|
252
|
-
return (_b = (_a = ctx.ids) == null ? void 0 : _a.content) != null ? _b : `tabs:${ctx.
|
|
197
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.content) != null ? _b : `tabs:${ctx.id}:content-${id}`;
|
|
253
198
|
},
|
|
254
199
|
getContentGroupId: (ctx) => {
|
|
255
200
|
var _a, _b;
|
|
256
|
-
return (_b = (_a = ctx.ids) == null ? void 0 : _a.contentGroup) != null ? _b : `tabs:${ctx.
|
|
201
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.contentGroup) != null ? _b : `tabs:${ctx.id}:content-group`;
|
|
257
202
|
},
|
|
258
203
|
getTriggerId: (ctx, id) => {
|
|
259
204
|
var _a, _b;
|
|
260
|
-
return (_b = (_a = ctx.ids) == null ? void 0 : _a.trigger) != null ? _b : `tabs:${ctx.
|
|
205
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.trigger) != null ? _b : `tabs:${ctx.id}:trigger-${id}`;
|
|
261
206
|
},
|
|
262
|
-
getIndicatorId: (ctx) => `tabs:${ctx.
|
|
263
|
-
getTriggerGroupEl: (ctx) => dom.
|
|
264
|
-
getContentEl: (ctx, id) => dom.
|
|
265
|
-
getTriggerEl: (ctx, id) => dom.
|
|
266
|
-
getIndicatorEl: (ctx) => dom.
|
|
207
|
+
getIndicatorId: (ctx) => `tabs:${ctx.id}:indicator`,
|
|
208
|
+
getTriggerGroupEl: (ctx) => dom.getById(ctx, dom.getTriggerGroupId(ctx)),
|
|
209
|
+
getContentEl: (ctx, id) => dom.getById(ctx, dom.getContentId(ctx, id)),
|
|
210
|
+
getTriggerEl: (ctx, id) => dom.getById(ctx, dom.getTriggerId(ctx, id)),
|
|
211
|
+
getIndicatorEl: (ctx) => dom.getById(ctx, dom.getIndicatorId(ctx)),
|
|
267
212
|
getElements: (ctx) => {
|
|
268
213
|
const ownerId = CSS.escape(dom.getTriggerGroupId(ctx));
|
|
269
214
|
const selector = `[role=tab][data-ownedby='${ownerId}']:not([disabled])`;
|
|
@@ -277,7 +222,7 @@ var dom = {
|
|
|
277
222
|
if (!ctx.value)
|
|
278
223
|
return;
|
|
279
224
|
const id = dom.getContentId(ctx, ctx.value);
|
|
280
|
-
return dom.
|
|
225
|
+
return dom.getById(ctx, id);
|
|
281
226
|
},
|
|
282
227
|
getRectById: (ctx, id) => {
|
|
283
228
|
var _a;
|
|
@@ -299,10 +244,10 @@ var dom = {
|
|
|
299
244
|
width: `${tab.offsetWidth}px`
|
|
300
245
|
};
|
|
301
246
|
}
|
|
302
|
-
};
|
|
247
|
+
});
|
|
303
248
|
|
|
304
249
|
// src/tabs.connect.ts
|
|
305
|
-
function connect(state, send, normalize
|
|
250
|
+
function connect(state, send, normalize) {
|
|
306
251
|
const messages = state.context.messages;
|
|
307
252
|
const isFocused = state.matches("focused");
|
|
308
253
|
return {
|
|
@@ -444,9 +389,9 @@ function connect(state, send, normalize = normalizeProp) {
|
|
|
444
389
|
}
|
|
445
390
|
|
|
446
391
|
// src/tabs.machine.ts
|
|
447
|
-
import { createMachine, guards
|
|
392
|
+
import { createMachine, guards } from "@zag-js/core";
|
|
448
393
|
var { not } = guards;
|
|
449
|
-
function machine(ctx
|
|
394
|
+
function machine(ctx) {
|
|
450
395
|
return createMachine({
|
|
451
396
|
initial: "unknown",
|
|
452
397
|
context: __spreadValues({
|
|
@@ -455,7 +400,6 @@ function machine(ctx = {}) {
|
|
|
455
400
|
activationMode: "automatic",
|
|
456
401
|
value: null,
|
|
457
402
|
focusedValue: null,
|
|
458
|
-
uid: "",
|
|
459
403
|
previousValues: [],
|
|
460
404
|
indicatorRect: { left: "0px", top: "0px", width: "0px", height: "0px" },
|
|
461
405
|
hasMeasuredRect: false,
|
|
@@ -486,7 +430,7 @@ function machine(ctx = {}) {
|
|
|
486
430
|
on: {
|
|
487
431
|
SETUP: {
|
|
488
432
|
target: "idle",
|
|
489
|
-
actions: ["
|
|
433
|
+
actions: ["checkRenderedElements", "setIndicatorRect", "setContentTabIndex"]
|
|
490
434
|
}
|
|
491
435
|
}
|
|
492
436
|
},
|
|
@@ -556,13 +500,6 @@ function machine(ctx = {}) {
|
|
|
556
500
|
selectOnFocus: (ctx2) => ctx2.activationMode === "automatic"
|
|
557
501
|
},
|
|
558
502
|
actions: {
|
|
559
|
-
setupDocument(ctx2, evt) {
|
|
560
|
-
ctx2.uid = evt.id;
|
|
561
|
-
if (evt.doc)
|
|
562
|
-
ctx2.doc = ref(evt.doc);
|
|
563
|
-
if (evt.root)
|
|
564
|
-
ctx2.rootNode = ref(evt.root);
|
|
565
|
-
},
|
|
566
503
|
setFocusedValue(ctx2, evt) {
|
|
567
504
|
ctx2.focusedValue = evt.value;
|
|
568
505
|
},
|
|
@@ -613,9 +550,7 @@ function machine(ctx = {}) {
|
|
|
613
550
|
});
|
|
614
551
|
},
|
|
615
552
|
checkRenderedElements(ctx2) {
|
|
616
|
-
|
|
617
|
-
ctx2.isIndicatorRendered = !!dom.getIndicatorEl(ctx2);
|
|
618
|
-
});
|
|
553
|
+
ctx2.isIndicatorRendered = !!dom.getIndicatorEl(ctx2);
|
|
619
554
|
},
|
|
620
555
|
clearMeasured(ctx2) {
|
|
621
556
|
ctx2.hasMeasuredRect = false;
|
|
@@ -654,4 +589,3 @@ export {
|
|
|
654
589
|
connect,
|
|
655
590
|
machine
|
|
656
591
|
};
|
|
657
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/tabs.connect.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { NormalizeProps, PropTypes } from "@zag-js/types";
|
|
2
2
|
import type { Send, State, TabProps } from "./tabs.types";
|
|
3
|
-
export declare function connect<T extends PropTypes
|
|
3
|
+
export declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
|
|
4
4
|
value: string;
|
|
5
5
|
focusedValue: string;
|
|
6
6
|
previousValues: string[];
|
|
@@ -15,4 +15,3 @@ export declare function connect<T extends PropTypes = ReactPropTypes>(state: Sta
|
|
|
15
15
|
getDeleteButtonProps({ value, disabled }: TabProps): T["button"];
|
|
16
16
|
indicatorProps: T["element"];
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=tabs.connect.d.ts.map
|
package/dist/tabs.dom.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import { MachineContext as Ctx } from "./tabs.types";
|
|
1
|
+
import type { MachineContext as Ctx } from "./tabs.types";
|
|
2
2
|
export declare const dom: {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
getRootNode: (ctx: {
|
|
4
|
+
getRootNode?: () => Node | Document | ShadowRoot;
|
|
5
|
+
}) => Document | ShadowRoot;
|
|
6
|
+
getDoc: (ctx: {
|
|
7
|
+
getRootNode?: () => Node | Document | ShadowRoot;
|
|
8
|
+
}) => Document;
|
|
9
|
+
getWin: (ctx: {
|
|
10
|
+
getRootNode?: () => Node | Document | ShadowRoot;
|
|
11
|
+
}) => Window & typeof globalThis;
|
|
12
|
+
getActiveElement: (ctx: {
|
|
13
|
+
getRootNode?: () => Node | Document | ShadowRoot;
|
|
14
|
+
}) => HTMLElement;
|
|
15
|
+
getById: <T_1 = HTMLElement>(ctx: {
|
|
16
|
+
getRootNode?: () => Node | Document | ShadowRoot;
|
|
17
|
+
}, id: string) => T_1;
|
|
18
|
+
} & {
|
|
5
19
|
getRootId: (ctx: Ctx) => string;
|
|
6
20
|
getTriggerGroupId: (ctx: Ctx) => string;
|
|
7
21
|
getContentId: (ctx: Ctx, id: string) => string;
|
|
@@ -30,4 +44,3 @@ export declare const dom: {
|
|
|
30
44
|
height?: undefined;
|
|
31
45
|
};
|
|
32
46
|
};
|
|
33
|
-
//# sourceMappingURL=tabs.dom.d.ts.map
|
package/dist/tabs.machine.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { MachineContext, MachineState, UserDefinedContext } from "./tabs.types";
|
|
2
|
-
export declare function machine(ctx
|
|
3
|
-
//# sourceMappingURL=tabs.machine.d.ts.map
|
|
1
|
+
import type { MachineContext, MachineState, UserDefinedContext } from "./tabs.types";
|
|
2
|
+
export declare function machine(ctx: UserDefinedContext): import("@zag-js/core").Machine<MachineContext, MachineState, import("@zag-js/core").StateMachine.AnyEventObject>;
|
package/dist/tabs.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StateMachine as S } from "@zag-js/core";
|
|
2
|
-
import { Context, DirectionProperty } from "@zag-js/types";
|
|
1
|
+
import type { StateMachine as S } from "@zag-js/core";
|
|
2
|
+
import type { CommonProperties, Context, DirectionProperty, RequiredBy } from "@zag-js/types";
|
|
3
3
|
declare type IntlMessages = {
|
|
4
4
|
tablistLabel?: string;
|
|
5
5
|
deleteLabel?(value: string): string;
|
|
@@ -11,7 +11,7 @@ declare type ElementIds = Partial<{
|
|
|
11
11
|
contentGroup: string;
|
|
12
12
|
content: string;
|
|
13
13
|
}>;
|
|
14
|
-
declare type PublicContext = DirectionProperty & {
|
|
14
|
+
declare type PublicContext = DirectionProperty & CommonProperties & {
|
|
15
15
|
/**
|
|
16
16
|
* The ids of the elements in the tabs. Useful for composition.
|
|
17
17
|
*/
|
|
@@ -67,7 +67,7 @@ declare type PublicContext = DirectionProperty & {
|
|
|
67
67
|
value: string;
|
|
68
68
|
}) => void;
|
|
69
69
|
};
|
|
70
|
-
export declare type UserDefinedContext =
|
|
70
|
+
export declare type UserDefinedContext = RequiredBy<PublicContext, "id">;
|
|
71
71
|
declare type ComputedContext = Readonly<{
|
|
72
72
|
/**
|
|
73
73
|
* @computed
|
|
@@ -118,4 +118,3 @@ export declare type TabProps = {
|
|
|
118
118
|
disabled?: boolean;
|
|
119
119
|
};
|
|
120
120
|
export {};
|
|
121
|
-
//# sourceMappingURL=tabs.types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/tabs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Core logic for the tabs widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -29,9 +29,11 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/core": "0.1.
|
|
33
|
-
"@zag-js/
|
|
34
|
-
|
|
32
|
+
"@zag-js/core": "0.1.8",
|
|
33
|
+
"@zag-js/types": "0.2.2"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@zag-js/dom-utils": "0.1.7",
|
|
35
37
|
"@zag-js/utils": "0.1.2"
|
|
36
38
|
},
|
|
37
39
|
"scripts": {
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,YAAY,EAAE,kBAAkB,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA"}
|