@zag-js/tabs 0.1.10 → 0.1.13
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/LICENSE +21 -0
- package/dist/index.d.ts +115 -3
- package/dist/index.js +208 -235
- package/dist/index.mjs +203 -238
- package/package.json +12 -11
- package/dist/tabs.connect.d.ts +0 -17
- package/dist/tabs.dom.d.ts +0 -46
- package/dist/tabs.machine.d.ts +0 -2
- package/dist/tabs.types.d.ts +0 -120
package/dist/index.js
CHANGED
|
@@ -2,21 +2,7 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
6
|
var __export = (target, all) => {
|
|
21
7
|
for (var name in all)
|
|
22
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -40,30 +26,13 @@ __export(src_exports, {
|
|
|
40
26
|
module.exports = __toCommonJS(src_exports);
|
|
41
27
|
|
|
42
28
|
// ../../utilities/dom/dist/index.mjs
|
|
43
|
-
var __defProp2 = Object.defineProperty;
|
|
44
|
-
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
45
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
46
|
-
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
47
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
48
|
-
var __spreadValues2 = (a, b) => {
|
|
49
|
-
for (var prop in b || (b = {}))
|
|
50
|
-
if (__hasOwnProp2.call(b, prop))
|
|
51
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
52
|
-
if (__getOwnPropSymbols2)
|
|
53
|
-
for (var prop of __getOwnPropSymbols2(b)) {
|
|
54
|
-
if (__propIsEnum2.call(b, prop))
|
|
55
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
56
|
-
}
|
|
57
|
-
return a;
|
|
58
|
-
};
|
|
59
29
|
var dataAttr = (guard) => {
|
|
60
30
|
return guard ? "" : void 0;
|
|
61
31
|
};
|
|
62
32
|
var isDom = () => typeof window !== "undefined";
|
|
63
33
|
function getPlatform() {
|
|
64
|
-
var _a;
|
|
65
34
|
const agent = navigator.userAgentData;
|
|
66
|
-
return (
|
|
35
|
+
return (agent == null ? void 0 : agent.platform) ?? navigator.platform;
|
|
67
36
|
}
|
|
68
37
|
var pt = (v) => isDom() && v.test(getPlatform());
|
|
69
38
|
var vn = (v) => isDom() && v.test(navigator.vendor);
|
|
@@ -79,28 +48,27 @@ function isFrame(element) {
|
|
|
79
48
|
return element.localName === "iframe";
|
|
80
49
|
}
|
|
81
50
|
function getDocument(el) {
|
|
82
|
-
var _a;
|
|
83
51
|
if (isWindow(el))
|
|
84
52
|
return el.document;
|
|
85
53
|
if (isDocument(el))
|
|
86
54
|
return el;
|
|
87
|
-
return (
|
|
55
|
+
return (el == null ? void 0 : el.ownerDocument) ?? document;
|
|
88
56
|
}
|
|
89
57
|
function defineDomHelpers(helpers) {
|
|
90
58
|
const dom2 = {
|
|
91
59
|
getRootNode: (ctx) => {
|
|
92
|
-
var _a, _b;
|
|
93
|
-
return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
|
|
94
|
-
},
|
|
95
|
-
getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
|
|
96
|
-
getWin: (ctx) => {
|
|
97
60
|
var _a;
|
|
98
|
-
return (_a =
|
|
61
|
+
return ((_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) ?? document;
|
|
99
62
|
},
|
|
63
|
+
getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
|
|
64
|
+
getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
|
|
100
65
|
getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
|
|
101
66
|
getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
|
|
102
67
|
};
|
|
103
|
-
return
|
|
68
|
+
return {
|
|
69
|
+
...dom2,
|
|
70
|
+
...helpers
|
|
71
|
+
};
|
|
104
72
|
}
|
|
105
73
|
function isHTMLElement(v) {
|
|
106
74
|
return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
|
|
@@ -135,9 +103,7 @@ function isFocusable(element) {
|
|
|
135
103
|
}
|
|
136
104
|
var rtlKeyMap = {
|
|
137
105
|
ArrowLeft: "ArrowRight",
|
|
138
|
-
ArrowRight: "ArrowLeft"
|
|
139
|
-
Home: "End",
|
|
140
|
-
End: "Home"
|
|
106
|
+
ArrowRight: "ArrowLeft"
|
|
141
107
|
};
|
|
142
108
|
var sameKeyMap = {
|
|
143
109
|
Up: "ArrowUp",
|
|
@@ -149,10 +115,9 @@ var sameKeyMap = {
|
|
|
149
115
|
Right: "ArrowRight"
|
|
150
116
|
};
|
|
151
117
|
function getEventKey(event, options = {}) {
|
|
152
|
-
var _a;
|
|
153
118
|
const { dir = "ltr", orientation = "horizontal" } = options;
|
|
154
119
|
let { key } = event;
|
|
155
|
-
key =
|
|
120
|
+
key = sameKeyMap[key] ?? key;
|
|
156
121
|
const isRtl = dir === "rtl" && orientation === "horizontal";
|
|
157
122
|
if (isRtl && key in rtlKeyMap) {
|
|
158
123
|
key = rtlKeyMap[key];
|
|
@@ -179,8 +144,7 @@ function raf(fn) {
|
|
|
179
144
|
};
|
|
180
145
|
}
|
|
181
146
|
function queryAll(root, selector) {
|
|
182
|
-
|
|
183
|
-
return Array.from((_a = root == null ? void 0 : root.querySelectorAll(selector)) != null ? _a : []);
|
|
147
|
+
return Array.from((root == null ? void 0 : root.querySelectorAll(selector)) ?? []);
|
|
184
148
|
}
|
|
185
149
|
function itemById(v, id) {
|
|
186
150
|
return v.find((node) => node.id === id);
|
|
@@ -209,24 +173,24 @@ var last = (v) => v[v.length - 1];
|
|
|
209
173
|
// src/tabs.dom.ts
|
|
210
174
|
var dom = defineDomHelpers({
|
|
211
175
|
getRootId: (ctx) => {
|
|
212
|
-
var _a
|
|
213
|
-
return (
|
|
176
|
+
var _a;
|
|
177
|
+
return ((_a = ctx.ids) == null ? void 0 : _a.root) ?? `tabs:${ctx.id}`;
|
|
214
178
|
},
|
|
215
179
|
getTriggerGroupId: (ctx) => {
|
|
216
|
-
var _a
|
|
217
|
-
return (
|
|
180
|
+
var _a;
|
|
181
|
+
return ((_a = ctx.ids) == null ? void 0 : _a.triggerGroup) ?? `tabs:${ctx.id}:trigger-group`;
|
|
218
182
|
},
|
|
219
183
|
getContentId: (ctx, id) => {
|
|
220
|
-
var _a
|
|
221
|
-
return (
|
|
184
|
+
var _a;
|
|
185
|
+
return ((_a = ctx.ids) == null ? void 0 : _a.content) ?? `tabs:${ctx.id}:content-${id}`;
|
|
222
186
|
},
|
|
223
187
|
getContentGroupId: (ctx) => {
|
|
224
|
-
var _a
|
|
225
|
-
return (
|
|
188
|
+
var _a;
|
|
189
|
+
return ((_a = ctx.ids) == null ? void 0 : _a.contentGroup) ?? `tabs:${ctx.id}:content-group`;
|
|
226
190
|
},
|
|
227
191
|
getTriggerId: (ctx, id) => {
|
|
228
|
-
var _a
|
|
229
|
-
return (
|
|
192
|
+
var _a;
|
|
193
|
+
return ((_a = ctx.ids) == null ? void 0 : _a.trigger) ?? `tabs:${ctx.id}:trigger-${id}`;
|
|
230
194
|
},
|
|
231
195
|
getIndicatorId: (ctx) => `tabs:${ctx.id}:indicator`,
|
|
232
196
|
getTriggerGroupEl: (ctx) => dom.getById(ctx, dom.getTriggerGroupId(ctx)),
|
|
@@ -249,14 +213,13 @@ var dom = defineDomHelpers({
|
|
|
249
213
|
return dom.getById(ctx, id);
|
|
250
214
|
},
|
|
251
215
|
getRectById: (ctx, id) => {
|
|
252
|
-
var _a;
|
|
253
216
|
const empty = {
|
|
254
217
|
offsetLeft: 0,
|
|
255
218
|
offsetTop: 0,
|
|
256
219
|
offsetWidth: 0,
|
|
257
220
|
offsetHeight: 0
|
|
258
221
|
};
|
|
259
|
-
const tab =
|
|
222
|
+
const tab = itemById(dom.getElements(ctx), dom.getTriggerId(ctx, id)) ?? empty;
|
|
260
223
|
if (ctx.isVertical) {
|
|
261
224
|
return {
|
|
262
225
|
top: `${tab.offsetTop}px`,
|
|
@@ -399,15 +362,16 @@ function connect(state, send, normalize) {
|
|
|
399
362
|
id: dom.getIndicatorId(state.context),
|
|
400
363
|
"data-part": "indicator",
|
|
401
364
|
"data-orientation": state.context.orientation,
|
|
402
|
-
style:
|
|
365
|
+
style: {
|
|
403
366
|
"--transition-duration": "200ms",
|
|
404
367
|
"--transition-property": "left, right, top, bottom, width, height",
|
|
405
368
|
position: "absolute",
|
|
406
369
|
willChange: "var(--transition-property)",
|
|
407
370
|
transitionProperty: "var(--transition-property)",
|
|
408
371
|
transitionDuration: state.context.hasMeasuredRect ? "var(--transition-duration)" : "0ms",
|
|
409
|
-
transitionTimingFunction: "var(--transition-timing-function)"
|
|
410
|
-
|
|
372
|
+
transitionTimingFunction: "var(--transition-timing-function)",
|
|
373
|
+
...state.context.indicatorRect
|
|
374
|
+
}
|
|
411
375
|
})
|
|
412
376
|
};
|
|
413
377
|
}
|
|
@@ -416,196 +380,205 @@ function connect(state, send, normalize) {
|
|
|
416
380
|
var import_core = require("@zag-js/core");
|
|
417
381
|
var { not } = import_core.guards;
|
|
418
382
|
function machine(ctx) {
|
|
419
|
-
return (0, import_core.createMachine)(
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
isHorizontal: (ctx2) => ctx2.orientation === "horizontal",
|
|
436
|
-
isVertical: (ctx2) => ctx2.orientation === "vertical"
|
|
437
|
-
},
|
|
438
|
-
created: ["setPrevSelectedTabs"],
|
|
439
|
-
watch: {
|
|
440
|
-
focusedValue: "invokeOnFocus",
|
|
441
|
-
value: ["invokeOnChange", "setPrevSelectedTabs", "setIndicatorRect", "setContentTabIndex"],
|
|
442
|
-
dir: ["clearMeasured", "setIndicatorRect"]
|
|
443
|
-
},
|
|
444
|
-
on: {
|
|
445
|
-
SET_VALUE: {
|
|
446
|
-
actions: "setValue"
|
|
383
|
+
return (0, import_core.createMachine)(
|
|
384
|
+
{
|
|
385
|
+
initial: "unknown",
|
|
386
|
+
context: {
|
|
387
|
+
dir: "ltr",
|
|
388
|
+
orientation: "horizontal",
|
|
389
|
+
activationMode: "automatic",
|
|
390
|
+
value: null,
|
|
391
|
+
focusedValue: null,
|
|
392
|
+
previousValues: [],
|
|
393
|
+
indicatorRect: { left: "0px", top: "0px", width: "0px", height: "0px" },
|
|
394
|
+
hasMeasuredRect: false,
|
|
395
|
+
isIndicatorRendered: false,
|
|
396
|
+
loop: true,
|
|
397
|
+
messages: {},
|
|
398
|
+
...ctx
|
|
447
399
|
},
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
},
|
|
452
|
-
states: {
|
|
453
|
-
unknown: {
|
|
454
|
-
on: {
|
|
455
|
-
SETUP: {
|
|
456
|
-
target: "idle",
|
|
457
|
-
actions: ["checkRenderedElements", "setIndicatorRect", "setContentTabIndex"]
|
|
458
|
-
}
|
|
459
|
-
}
|
|
400
|
+
computed: {
|
|
401
|
+
isHorizontal: (ctx2) => ctx2.orientation === "horizontal",
|
|
402
|
+
isVertical: (ctx2) => ctx2.orientation === "vertical"
|
|
460
403
|
},
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
404
|
+
created: ["setPrevSelectedTabs"],
|
|
405
|
+
watch: {
|
|
406
|
+
focusedValue: "invokeOnFocus",
|
|
407
|
+
value: ["invokeOnChange", "setPrevSelectedTabs", "setIndicatorRect", "setContentTabIndex"],
|
|
408
|
+
dir: ["clearMeasured", "setIndicatorRect"]
|
|
409
|
+
},
|
|
410
|
+
on: {
|
|
411
|
+
SET_VALUE: {
|
|
412
|
+
actions: "setValue"
|
|
413
|
+
},
|
|
414
|
+
DELETE: {
|
|
415
|
+
actions: "deleteValue"
|
|
472
416
|
}
|
|
473
417
|
},
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
actions: "focusNextTab"
|
|
487
|
-
},
|
|
488
|
-
ARROW_UP: {
|
|
489
|
-
guard: "isVertical",
|
|
490
|
-
actions: "focusPrevTab"
|
|
491
|
-
},
|
|
492
|
-
ARROW_DOWN: {
|
|
493
|
-
guard: "isVertical",
|
|
494
|
-
actions: "focusNextTab"
|
|
495
|
-
},
|
|
496
|
-
HOME: {
|
|
497
|
-
actions: "focusFirstTab"
|
|
498
|
-
},
|
|
499
|
-
END: {
|
|
500
|
-
actions: "focusLastTab"
|
|
501
|
-
},
|
|
502
|
-
ENTER: {
|
|
503
|
-
guard: not("selectOnFocus"),
|
|
504
|
-
actions: "setValue"
|
|
505
|
-
},
|
|
506
|
-
TAB_FOCUS: [
|
|
507
|
-
{
|
|
418
|
+
states: {
|
|
419
|
+
unknown: {
|
|
420
|
+
on: {
|
|
421
|
+
SETUP: {
|
|
422
|
+
target: "idle",
|
|
423
|
+
actions: ["checkRenderedElements", "setIndicatorRect", "setContentTabIndex"]
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
idle: {
|
|
428
|
+
on: {
|
|
429
|
+
TAB_FOCUS: {
|
|
508
430
|
guard: "selectOnFocus",
|
|
431
|
+
target: "focused",
|
|
509
432
|
actions: ["setFocusedValue", "setValue"]
|
|
510
433
|
},
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
434
|
+
TAB_CLICK: {
|
|
435
|
+
target: "focused",
|
|
436
|
+
actions: ["setFocusedValue", "setValue"]
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
focused: {
|
|
441
|
+
on: {
|
|
442
|
+
TAB_CLICK: {
|
|
443
|
+
target: "focused",
|
|
444
|
+
actions: ["setFocusedValue", "setValue"]
|
|
445
|
+
},
|
|
446
|
+
ARROW_LEFT: {
|
|
447
|
+
guard: "isHorizontal",
|
|
448
|
+
actions: "focusPrevTab"
|
|
449
|
+
},
|
|
450
|
+
ARROW_RIGHT: {
|
|
451
|
+
guard: "isHorizontal",
|
|
452
|
+
actions: "focusNextTab"
|
|
453
|
+
},
|
|
454
|
+
ARROW_UP: {
|
|
455
|
+
guard: "isVertical",
|
|
456
|
+
actions: "focusPrevTab"
|
|
457
|
+
},
|
|
458
|
+
ARROW_DOWN: {
|
|
459
|
+
guard: "isVertical",
|
|
460
|
+
actions: "focusNextTab"
|
|
461
|
+
},
|
|
462
|
+
HOME: {
|
|
463
|
+
actions: "focusFirstTab"
|
|
464
|
+
},
|
|
465
|
+
END: {
|
|
466
|
+
actions: "focusLastTab"
|
|
467
|
+
},
|
|
468
|
+
ENTER: {
|
|
469
|
+
guard: not("selectOnFocus"),
|
|
470
|
+
actions: "setValue"
|
|
471
|
+
},
|
|
472
|
+
TAB_FOCUS: [
|
|
473
|
+
{
|
|
474
|
+
guard: "selectOnFocus",
|
|
475
|
+
actions: ["setFocusedValue", "setValue"]
|
|
476
|
+
},
|
|
477
|
+
{ actions: "setFocusedValue" }
|
|
478
|
+
],
|
|
479
|
+
TAB_BLUR: {
|
|
480
|
+
target: "idle",
|
|
481
|
+
actions: "clearFocusedValue"
|
|
482
|
+
}
|
|
516
483
|
}
|
|
517
484
|
}
|
|
518
485
|
}
|
|
519
|
-
}
|
|
520
|
-
}, {
|
|
521
|
-
guards: {
|
|
522
|
-
isVertical: (ctx2) => ctx2.isVertical,
|
|
523
|
-
isHorizontal: (ctx2) => ctx2.isHorizontal,
|
|
524
|
-
selectOnFocus: (ctx2) => ctx2.activationMode === "automatic"
|
|
525
486
|
},
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
ctx2
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
ctx2.focusedValue = null;
|
|
487
|
+
{
|
|
488
|
+
guards: {
|
|
489
|
+
isVertical: (ctx2) => ctx2.isVertical,
|
|
490
|
+
isHorizontal: (ctx2) => ctx2.isHorizontal,
|
|
491
|
+
selectOnFocus: (ctx2) => ctx2.activationMode === "automatic"
|
|
532
492
|
},
|
|
533
|
-
|
|
534
|
-
ctx2
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
});
|
|
545
|
-
},
|
|
546
|
-
focusLastTab(ctx2) {
|
|
547
|
-
raf(() => {
|
|
493
|
+
actions: {
|
|
494
|
+
setFocusedValue(ctx2, evt) {
|
|
495
|
+
ctx2.focusedValue = evt.value;
|
|
496
|
+
},
|
|
497
|
+
clearFocusedValue(ctx2) {
|
|
498
|
+
ctx2.focusedValue = null;
|
|
499
|
+
},
|
|
500
|
+
setValue(ctx2, evt) {
|
|
501
|
+
ctx2.value = evt.value;
|
|
502
|
+
},
|
|
503
|
+
invokeOnDelete(ctx2, evt) {
|
|
548
504
|
var _a;
|
|
549
|
-
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
nextTick(() => {
|
|
566
|
-
if (!ctx2.isIndicatorRendered || !ctx2.value)
|
|
505
|
+
(_a = ctx2.onDelete) == null ? void 0 : _a.call(ctx2, { value: evt.value });
|
|
506
|
+
},
|
|
507
|
+
focusFirstTab(ctx2) {
|
|
508
|
+
raf(() => {
|
|
509
|
+
var _a;
|
|
510
|
+
return (_a = dom.getFirstEl(ctx2)) == null ? void 0 : _a.focus();
|
|
511
|
+
});
|
|
512
|
+
},
|
|
513
|
+
focusLastTab(ctx2) {
|
|
514
|
+
raf(() => {
|
|
515
|
+
var _a;
|
|
516
|
+
return (_a = dom.getLastEl(ctx2)) == null ? void 0 : _a.focus();
|
|
517
|
+
});
|
|
518
|
+
},
|
|
519
|
+
focusNextTab(ctx2) {
|
|
520
|
+
if (!ctx2.focusedValue)
|
|
567
521
|
return;
|
|
568
|
-
|
|
569
|
-
|
|
522
|
+
const next = dom.getNextEl(ctx2, ctx2.focusedValue);
|
|
523
|
+
raf(() => next == null ? void 0 : next.focus());
|
|
524
|
+
},
|
|
525
|
+
focusPrevTab(ctx2) {
|
|
526
|
+
if (!ctx2.focusedValue)
|
|
570
527
|
return;
|
|
528
|
+
const prev = dom.getPrevEl(ctx2, ctx2.focusedValue);
|
|
529
|
+
raf(() => prev == null ? void 0 : prev.focus());
|
|
530
|
+
},
|
|
531
|
+
setIndicatorRect(ctx2) {
|
|
571
532
|
nextTick(() => {
|
|
572
|
-
ctx2.
|
|
533
|
+
if (!ctx2.isIndicatorRendered || !ctx2.value)
|
|
534
|
+
return;
|
|
535
|
+
ctx2.indicatorRect = dom.getRectById(ctx2, ctx2.value);
|
|
536
|
+
if (ctx2.hasMeasuredRect)
|
|
537
|
+
return;
|
|
538
|
+
nextTick(() => {
|
|
539
|
+
ctx2.hasMeasuredRect = true;
|
|
540
|
+
});
|
|
573
541
|
});
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
ctx2.previousValues = Array.from(new Set(newSelected));
|
|
594
|
-
}
|
|
595
|
-
},
|
|
596
|
-
setContentTabIndex(ctx2) {
|
|
597
|
-
raf(() => {
|
|
598
|
-
const panel = dom.getActiveContentEl(ctx2);
|
|
599
|
-
if (!panel)
|
|
600
|
-
return;
|
|
601
|
-
const focusables = getFocusables(panel);
|
|
602
|
-
if (focusables.length > 0) {
|
|
603
|
-
panel.removeAttribute("tabindex");
|
|
604
|
-
} else {
|
|
605
|
-
panel.setAttribute("tabindex", "0");
|
|
542
|
+
},
|
|
543
|
+
checkRenderedElements(ctx2) {
|
|
544
|
+
ctx2.isIndicatorRendered = !!dom.getIndicatorEl(ctx2);
|
|
545
|
+
},
|
|
546
|
+
clearMeasured(ctx2) {
|
|
547
|
+
ctx2.hasMeasuredRect = false;
|
|
548
|
+
},
|
|
549
|
+
invokeOnChange(ctx2) {
|
|
550
|
+
var _a;
|
|
551
|
+
(_a = ctx2.onChange) == null ? void 0 : _a.call(ctx2, { value: ctx2.value });
|
|
552
|
+
},
|
|
553
|
+
invokeOnFocus(ctx2) {
|
|
554
|
+
var _a;
|
|
555
|
+
(_a = ctx2.onFocus) == null ? void 0 : _a.call(ctx2, { value: ctx2.focusedValue });
|
|
556
|
+
},
|
|
557
|
+
setPrevSelectedTabs(ctx2) {
|
|
558
|
+
if (ctx2.value != null) {
|
|
559
|
+
const newSelected = Array.from(ctx2.previousValues).concat(ctx2.value);
|
|
560
|
+
ctx2.previousValues = Array.from(new Set(newSelected));
|
|
606
561
|
}
|
|
607
|
-
}
|
|
562
|
+
},
|
|
563
|
+
setContentTabIndex(ctx2) {
|
|
564
|
+
raf(() => {
|
|
565
|
+
const panel = dom.getActiveContentEl(ctx2);
|
|
566
|
+
if (!panel)
|
|
567
|
+
return;
|
|
568
|
+
const focusables = getFocusables(panel);
|
|
569
|
+
if (focusables.length > 0) {
|
|
570
|
+
panel.removeAttribute("tabindex");
|
|
571
|
+
} else {
|
|
572
|
+
panel.setAttribute("tabindex", "0");
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
}
|
|
608
576
|
}
|
|
609
577
|
}
|
|
610
|
-
|
|
578
|
+
);
|
|
611
579
|
}
|
|
580
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
581
|
+
0 && (module.exports = {
|
|
582
|
+
connect,
|
|
583
|
+
machine
|
|
584
|
+
});
|