@crispy-seed/data-table 0.8.0 → 0.9.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/data-table-recipe.css +7 -2
- package/dist/data-table-recipe.layered.css +3 -1
- package/dist/index.cjs +3050 -320
- package/dist/index.d.ts +187 -62
- package/dist/index.js +3051 -321
- package/dist/record-preview-recipe.css +16 -0
- package/dist/record-preview-recipe.layered.css +19 -0
- package/dist/resizable-panel-recipe.css +38 -10
- package/dist/resizable-panel-recipe.layered.css +42 -10
- package/dist/styles.css +64 -11
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ var textInput = require('@seed-design/css/recipes/text-input');
|
|
|
33
33
|
var reactMenu = require('@seed-design/react-menu');
|
|
34
34
|
var menu = require('@seed-design/css/recipes/menu');
|
|
35
35
|
var menuItem = require('@seed-design/css/recipes/menu-item');
|
|
36
|
+
var tabs = require('@seed-design/css/recipes/tabs');
|
|
36
37
|
|
|
37
38
|
function _interopNamespace(e) {
|
|
38
39
|
if (e && e.__esModule) return e;
|
|
@@ -224,36 +225,8 @@ var Icon$b = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg
|
|
|
224
225
|
var IconDot3HorizontalLine = /*#__PURE__*/ React.forwardRef(Icon$b);
|
|
225
226
|
var IconDot3HorizontalLine_default = IconDot3HorizontalLine;
|
|
226
227
|
|
|
227
|
-
// src/IconEyeLine.tsx
|
|
228
|
-
var Icon$a = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
229
|
-
viewBox: "0 0 24 24",
|
|
230
|
-
fill: "none",
|
|
231
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
232
|
-
"data-seed-icon": "true",
|
|
233
|
-
width: size,
|
|
234
|
-
height: size,
|
|
235
|
-
ref,
|
|
236
|
-
...props,
|
|
237
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("g", {
|
|
238
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("g", {
|
|
239
|
-
children: [
|
|
240
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
241
|
-
d: "M1.68785 14.0027C2.21223 14.1751 2.77712 13.8901 2.94996 13.3659C3.07236 13.0089 3.23163 12.663 3.39915 12.3254C3.7229 11.6731 4.22663 10.8054 4.94433 9.94191C6.3729 8.22305 8.6137 6.55273 12.0003 6.55273C15.3868 6.55273 17.6276 8.22305 19.0562 9.94191C19.7739 10.8054 20.2776 11.6731 20.6014 12.3254C20.7627 12.6505 20.8778 12.9189 20.9513 13.1024C21.0036 13.233 21.0295 13.302 21.0509 13.3669C21.2241 13.8904 21.7886 14.175 22.3127 14.0027C22.8373 13.8301 23.1225 13.264 22.9499 12.7394C22.9158 12.6366 22.8793 12.5369 22.8078 12.3586C22.717 12.1319 22.5805 11.8144 22.3929 11.4363C22.0187 10.6824 21.435 9.67502 20.5943 8.66356C18.9062 6.63242 16.147 4.55273 12.0003 4.55273C7.8535 4.55273 5.09431 6.63242 3.40621 8.66356C2.56557 9.67502 1.9818 10.6824 1.60765 11.4363C1.42001 11.8144 1.28353 12.1319 1.1927 12.3586C1.12106 12.5374 1.08448 12.6372 1.05033 12.7403C0.877781 13.2649 1.16321 13.8301 1.68785 14.0027Z",
|
|
242
|
-
fill: "currentColor"
|
|
243
|
-
}),
|
|
244
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
245
|
-
d: "M12.576 9.10187C12.7569 9.46282 12.7029 9.89712 12.4393 10.2029C12.0675 10.634 11.8429 11.1792 11.8429 11.7727C11.8429 13.0923 12.9123 14.1613 14.2263 14.1613C14.8331 14.1613 15.3926 13.9188 15.8177 13.522C16.1163 13.2434 16.5544 13.1743 16.9243 13.3476C17.2941 13.5209 17.5214 13.9017 17.4984 14.3095C17.3348 17.2106 15.0545 19.5498 12.0068 19.5498C8.94739 19.5498 6.5 16.9571 6.5 14.0363C6.5 11.1187 8.76722 8.75104 11.6123 8.55225C12.015 8.52411 12.3952 8.74091 12.576 9.10187Z",
|
|
246
|
-
fill: "currentColor"
|
|
247
|
-
})
|
|
248
|
-
]
|
|
249
|
-
})
|
|
250
|
-
})
|
|
251
|
-
});
|
|
252
|
-
var IconEyeLine = /*#__PURE__*/ React.forwardRef(Icon$a);
|
|
253
|
-
var IconEyeLine_default = IconEyeLine;
|
|
254
|
-
|
|
255
228
|
// src/IconMagnifyingglassLine.tsx
|
|
256
|
-
var Icon$
|
|
229
|
+
var Icon$a = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
257
230
|
viewBox: "0 0 24 24",
|
|
258
231
|
fill: "none",
|
|
259
232
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -271,11 +244,11 @@ var Icon$9 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg
|
|
|
271
244
|
})
|
|
272
245
|
})
|
|
273
246
|
});
|
|
274
|
-
var IconMagnifyingglassLine = /*#__PURE__*/ React.forwardRef(Icon$
|
|
247
|
+
var IconMagnifyingglassLine = /*#__PURE__*/ React.forwardRef(Icon$a);
|
|
275
248
|
var IconMagnifyingglassLine_default = IconMagnifyingglassLine;
|
|
276
249
|
|
|
277
250
|
// src/IconSlider2HorizontalLine.tsx
|
|
278
|
-
var Icon$
|
|
251
|
+
var Icon$9 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
279
252
|
viewBox: "0 0 24 24",
|
|
280
253
|
fill: "none",
|
|
281
254
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -303,11 +276,11 @@ var Icon$8 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg
|
|
|
303
276
|
})
|
|
304
277
|
})
|
|
305
278
|
});
|
|
306
|
-
var IconSlider2HorizontalLine = /*#__PURE__*/ React.forwardRef(Icon$
|
|
279
|
+
var IconSlider2HorizontalLine = /*#__PURE__*/ React.forwardRef(Icon$9);
|
|
307
280
|
var IconSlider2HorizontalLine_default = IconSlider2HorizontalLine;
|
|
308
281
|
|
|
309
282
|
// src/IconPersonCircleLine.tsx
|
|
310
|
-
var Icon$
|
|
283
|
+
var Icon$8 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
311
284
|
viewBox: "0 0 24 24",
|
|
312
285
|
fill: "none",
|
|
313
286
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -335,11 +308,11 @@ var Icon$7 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg
|
|
|
335
308
|
})
|
|
336
309
|
})
|
|
337
310
|
});
|
|
338
|
-
var IconPersonCircleLine = /*#__PURE__*/ React.forwardRef(Icon$
|
|
311
|
+
var IconPersonCircleLine = /*#__PURE__*/ React.forwardRef(Icon$8);
|
|
339
312
|
var IconPersonCircleLine_default = IconPersonCircleLine;
|
|
340
313
|
|
|
341
314
|
// src/IconPlusLine.tsx
|
|
342
|
-
var Icon$
|
|
315
|
+
var Icon$7 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
343
316
|
viewBox: "0 0 24 24",
|
|
344
317
|
fill: "none",
|
|
345
318
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -355,11 +328,11 @@ var Icon$6 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg
|
|
|
355
328
|
})
|
|
356
329
|
})
|
|
357
330
|
});
|
|
358
|
-
var IconPlusLine = /*#__PURE__*/ React.forwardRef(Icon$
|
|
331
|
+
var IconPlusLine = /*#__PURE__*/ React.forwardRef(Icon$7);
|
|
359
332
|
var IconPlusLine_default = IconPlusLine;
|
|
360
333
|
|
|
361
334
|
// src/IconMinusLine.tsx
|
|
362
|
-
var Icon$
|
|
335
|
+
var Icon$6 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
363
336
|
viewBox: "0 0 24 24",
|
|
364
337
|
fill: "none",
|
|
365
338
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -375,11 +348,11 @@ var Icon$5 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg
|
|
|
375
348
|
})
|
|
376
349
|
})
|
|
377
350
|
});
|
|
378
|
-
var IconMinusLine = /*#__PURE__*/ React.forwardRef(Icon$
|
|
351
|
+
var IconMinusLine = /*#__PURE__*/ React.forwardRef(Icon$6);
|
|
379
352
|
var IconMinusLine_default = IconMinusLine;
|
|
380
353
|
|
|
381
354
|
// src/IconXmarkLine.tsx
|
|
382
|
-
var Icon$
|
|
355
|
+
var Icon$5 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
383
356
|
viewBox: "0 0 24 24",
|
|
384
357
|
fill: "none",
|
|
385
358
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -395,11 +368,11 @@ var Icon$4 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg
|
|
|
395
368
|
})
|
|
396
369
|
})
|
|
397
370
|
});
|
|
398
|
-
var IconXmarkLine = /*#__PURE__*/ React.forwardRef(Icon$
|
|
371
|
+
var IconXmarkLine = /*#__PURE__*/ React.forwardRef(Icon$5);
|
|
399
372
|
var IconXmarkLine_default = IconXmarkLine;
|
|
400
373
|
|
|
401
374
|
// src/IconCheckmarkLine.tsx
|
|
402
|
-
var Icon$
|
|
375
|
+
var Icon$4 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
403
376
|
viewBox: "0 0 24 24",
|
|
404
377
|
fill: "none",
|
|
405
378
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -417,9 +390,45 @@ var Icon$3 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg
|
|
|
417
390
|
})
|
|
418
391
|
})
|
|
419
392
|
});
|
|
420
|
-
var IconCheckmarkLine = /*#__PURE__*/ React.forwardRef(Icon$
|
|
393
|
+
var IconCheckmarkLine = /*#__PURE__*/ React.forwardRef(Icon$4);
|
|
421
394
|
var IconCheckmarkLine_default = IconCheckmarkLine;
|
|
422
395
|
|
|
396
|
+
// src/IconCorner4OutwardLine.tsx
|
|
397
|
+
var Icon$3 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
398
|
+
viewBox: "0 0 24 24",
|
|
399
|
+
fill: "none",
|
|
400
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
401
|
+
"data-seed-icon": "true",
|
|
402
|
+
width: size,
|
|
403
|
+
height: size,
|
|
404
|
+
ref,
|
|
405
|
+
...props,
|
|
406
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("g", {
|
|
407
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("g", {
|
|
408
|
+
children: [
|
|
409
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
410
|
+
d: "M4.99961 4.00001L8.5 4C9.05228 4 9.5 3.55228 9.5 3C9.5 2.44772 9.05228 2 8.5 2L4.99959 2.00001C3.3426 2.00003 2 3.34333 2 4.99993V8.5C2 9.05228 2.44772 9.5 3 9.5C3.55228 9.5 4 9.05228 4 8.5V4.99993C4 4.44751 4.44757 4.00002 4.99961 4.00001Z",
|
|
411
|
+
fill: "currentColor"
|
|
412
|
+
}),
|
|
413
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
414
|
+
d: "M15.5 2C14.9477 2 14.5 2.44772 14.5 3C14.5 3.55228 14.9477 4 15.5 4H19C19.5525 4 20 4.44762 20 4.99974V8.5C20 9.05228 20.4477 9.5 21 9.5C21.5523 9.5 22 9.05228 22 8.5V4.99974C22 3.34271 20.6567 2 19 2H15.5Z",
|
|
415
|
+
fill: "currentColor"
|
|
416
|
+
}),
|
|
417
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
418
|
+
d: "M3.00001 14.5C3.5523 14.5 4.00001 14.9477 4.00001 15.5L4 19.0002C3.99999 19.5523 4.44759 20 5.00007 20H8.49995C9.05223 20 9.49995 20.4477 9.49995 21C9.49995 21.5523 9.05223 22 8.49995 22H5.00007C3.34331 22 1.99998 20.6572 2 19.0001L2.00001 15.5C2.00001 14.9477 2.44773 14.5 3.00001 14.5Z",
|
|
419
|
+
fill: "currentColor"
|
|
420
|
+
}),
|
|
421
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
422
|
+
d: "M22 15.5C22 14.9477 21.5523 14.5 21 14.5C20.4477 14.5 20 14.9477 20 15.5V19.0003C20 19.5524 19.5525 20 19 20H15.5C14.9477 20 14.5 20.4477 14.5 21C14.5 21.5523 14.9477 22 15.5 22H19C20.6567 22 22 20.6573 22 19.0003V15.5Z",
|
|
423
|
+
fill: "currentColor"
|
|
424
|
+
})
|
|
425
|
+
]
|
|
426
|
+
})
|
|
427
|
+
})
|
|
428
|
+
});
|
|
429
|
+
var IconCorner4OutwardLine = /*#__PURE__*/ React.forwardRef(Icon$3);
|
|
430
|
+
var IconCorner4OutwardLine_default = IconCorner4OutwardLine;
|
|
431
|
+
|
|
423
432
|
// src/IconChevronDownSmallLine.tsx
|
|
424
433
|
var Icon$2 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
425
434
|
viewBox: "0 0 24 24",
|
|
@@ -462,8 +471,8 @@ var Icon$1 = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg
|
|
|
462
471
|
var IconCheckmarkFatFill = /*#__PURE__*/ React.forwardRef(Icon$1);
|
|
463
472
|
var IconCheckmarkFatFill_default = IconCheckmarkFatFill;
|
|
464
473
|
|
|
465
|
-
var __defProp$
|
|
466
|
-
var __name$
|
|
474
|
+
var __defProp$5 = Object.defineProperty;
|
|
475
|
+
var __name$5 = (target, value)=>__defProp$5(target, "name", {
|
|
467
476
|
value,
|
|
468
477
|
configurable: true
|
|
469
478
|
});
|
|
@@ -474,7 +483,7 @@ function setRef(ref, value) {
|
|
|
474
483
|
ref.current = value;
|
|
475
484
|
}
|
|
476
485
|
}
|
|
477
|
-
__name$
|
|
486
|
+
__name$5(setRef, "setRef");
|
|
478
487
|
function composeRefs(...refs) {
|
|
479
488
|
return (node)=>{
|
|
480
489
|
let hasCleanup = false;
|
|
@@ -499,14 +508,14 @@ function composeRefs(...refs) {
|
|
|
499
508
|
}
|
|
500
509
|
};
|
|
501
510
|
}
|
|
502
|
-
__name$
|
|
511
|
+
__name$5(composeRefs, "composeRefs");
|
|
503
512
|
function useComposedRefs(...refs) {
|
|
504
513
|
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
505
514
|
}
|
|
506
|
-
__name$
|
|
515
|
+
__name$5(useComposedRefs, "useComposedRefs");
|
|
507
516
|
|
|
508
|
-
var __defProp$
|
|
509
|
-
var __name$
|
|
517
|
+
var __defProp$4 = Object.defineProperty;
|
|
518
|
+
var __name$4 = (target, value)=>__defProp$4(target, "name", {
|
|
510
519
|
value,
|
|
511
520
|
configurable: true
|
|
512
521
|
});
|
|
@@ -560,18 +569,18 @@ function createSlot(ownerName) {
|
|
|
560
569
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
561
570
|
return Slot2;
|
|
562
571
|
}
|
|
563
|
-
__name$
|
|
572
|
+
__name$4(createSlot, "createSlot");
|
|
564
573
|
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
565
574
|
var SLOTTABLE_IDENTIFIER = Symbol.for("radix.slottable");
|
|
566
575
|
// @__NO_SIDE_EFFECTS__
|
|
567
576
|
function createSlottable(ownerName) {
|
|
568
|
-
const Slottable2 = /* @__PURE__ */ __name$
|
|
577
|
+
const Slottable2 = /* @__PURE__ */ __name$4((props)=>"child" in props ? props.children(props.child) : props.children, "Slottable");
|
|
569
578
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
570
579
|
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
571
580
|
return Slottable2;
|
|
572
581
|
}
|
|
573
|
-
__name$
|
|
574
|
-
var getSlottableElementFromSlottable = /* @__PURE__ */ __name$
|
|
582
|
+
__name$4(createSlottable, "createSlottable");
|
|
583
|
+
var getSlottableElementFromSlottable = /* @__PURE__ */ __name$4((slottable, child)=>{
|
|
575
584
|
if ("child" in slottable.props) {
|
|
576
585
|
const child2 = slottable.props.child;
|
|
577
586
|
if (!/*#__PURE__*/ React__namespace.isValidElement(child2)) return null;
|
|
@@ -614,7 +623,7 @@ function mergeProps(slotProps, childProps) {
|
|
|
614
623
|
...overrideProps
|
|
615
624
|
};
|
|
616
625
|
}
|
|
617
|
-
__name$
|
|
626
|
+
__name$4(mergeProps, "mergeProps");
|
|
618
627
|
function getElementRef(element) {
|
|
619
628
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
620
629
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
@@ -628,24 +637,24 @@ function getElementRef(element) {
|
|
|
628
637
|
}
|
|
629
638
|
return element.props.ref || element.ref;
|
|
630
639
|
}
|
|
631
|
-
__name$
|
|
640
|
+
__name$4(getElementRef, "getElementRef");
|
|
632
641
|
function isSlottable(child) {
|
|
633
642
|
return /*#__PURE__*/ React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
634
643
|
}
|
|
635
|
-
__name$
|
|
644
|
+
__name$4(isSlottable, "isSlottable");
|
|
636
645
|
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
637
646
|
function isLazyComponent(element) {
|
|
638
647
|
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
639
648
|
}
|
|
640
|
-
__name$
|
|
649
|
+
__name$4(isLazyComponent, "isLazyComponent");
|
|
641
650
|
function isPromiseLike(value) {
|
|
642
651
|
return typeof value === "object" && value !== null && "then" in value;
|
|
643
652
|
}
|
|
644
|
-
__name$
|
|
645
|
-
var createSlotError = /* @__PURE__ */ __name$
|
|
653
|
+
__name$4(isPromiseLike, "isPromiseLike");
|
|
654
|
+
var createSlotError = /* @__PURE__ */ __name$4((ownerName)=>{
|
|
646
655
|
return `${ownerName} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`;
|
|
647
656
|
}, "createSlotError");
|
|
648
|
-
var createSlottableError = /* @__PURE__ */ __name$
|
|
657
|
+
var createSlottableError = /* @__PURE__ */ __name$4((ownerName)=>{
|
|
649
658
|
return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
|
|
650
659
|
}, "createSlottableError");
|
|
651
660
|
var use = React__namespace[" use ".trim().toString()];
|
|
@@ -2451,7 +2460,7 @@ function createRecipeContext(recipe) {
|
|
|
2451
2460
|
}
|
|
2452
2461
|
|
|
2453
2462
|
const { withContext: withGroupContext } = createRecipeContext(checkboxGroup.checkboxGroup);
|
|
2454
|
-
const { ClassNamesProvider: ClassNamesProvider$3, withContext: withContext$
|
|
2463
|
+
const { ClassNamesProvider: ClassNamesProvider$3, withContext: withContext$6 } = createSlotRecipeContext(checkbox.checkbox);
|
|
2455
2464
|
const { withProvider: withCheckmarkProvider, useClassNames: useCheckmarkClassNames, PropsProvider: CheckmarkPropsProvider } = createSlotRecipeContext(checkmark.checkmark);
|
|
2456
2465
|
const withStateProps$4 = createWithStateProps([
|
|
2457
2466
|
reactCheckbox.useCheckboxContext
|
|
@@ -2505,14 +2514,14 @@ const CheckboxIndicator = /*#__PURE__*/ React.forwardRef(({ unchecked: unchecked
|
|
|
2505
2514
|
return null;
|
|
2506
2515
|
});
|
|
2507
2516
|
CheckboxIndicator.displayName = "CheckboxIndicator";
|
|
2508
|
-
const CheckboxLabel = withContext$
|
|
2517
|
+
const CheckboxLabel = withContext$6(withStateProps$4(Primitive.span), "label");
|
|
2509
2518
|
const CheckboxHiddenInput = reactCheckbox.Checkbox.HiddenInput;
|
|
2510
2519
|
|
|
2511
|
-
const { withProvider: withProvider$
|
|
2512
|
-
const AvatarRoot = withProvider$
|
|
2513
|
-
const AvatarImage = withContext$
|
|
2514
|
-
const AvatarFallback = withContext$
|
|
2515
|
-
withContext$
|
|
2520
|
+
const { withProvider: withProvider$2, withContext: withContext$5 } = createSlotRecipeContext(avatar.avatar);
|
|
2521
|
+
const AvatarRoot = withProvider$2(reactImage.Image.Root, "root");
|
|
2522
|
+
const AvatarImage = withContext$5(reactImage.Image.Content, "image");
|
|
2523
|
+
const AvatarFallback = withContext$5(reactImage.Image.Fallback, "fallback");
|
|
2524
|
+
withContext$5(Primitive.div, "badge");
|
|
2516
2525
|
|
|
2517
2526
|
const Badge = /*#__PURE__*/ React.forwardRef(({ className, children, ...props }, ref)=>{
|
|
2518
2527
|
const [variantProps, restProps] = badge.badge.splitVariantProps(props);
|
|
@@ -2647,7 +2656,7 @@ function EntityCell({ value, className, nameClassName, actionsClassName, actionC
|
|
|
2647
2656
|
event.stopPropagation();
|
|
2648
2657
|
column.onOpenPreview?.(row);
|
|
2649
2658
|
},
|
|
2650
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(
|
|
2659
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(IconCorner4OutwardLine_default, {
|
|
2651
2660
|
size: 16
|
|
2652
2661
|
})
|
|
2653
2662
|
})
|
|
@@ -3082,7 +3091,7 @@ const SelectHiddenSelect = /*#__PURE__*/ React__namespace.forwardRef((props, ref
|
|
|
3082
3091
|
});
|
|
3083
3092
|
SelectHiddenSelect.displayName = "SelectHiddenSelect";
|
|
3084
3093
|
|
|
3085
|
-
const { withContext: withContext$
|
|
3094
|
+
const { withContext: withContext$4, ClassNamesProvider: ClassNamesProvider$2 } = createSlotRecipeContext(_switch.switchStyle);
|
|
3086
3095
|
const { withContext: withControlContext, PropsProvider: ControlPropsProvider, withProvider: withControlProvider } = createSlotRecipeContext(switchmark.switchmark);
|
|
3087
3096
|
const withStateProps$2 = createWithStateProps([
|
|
3088
3097
|
reactSwitch.useSwitchContext
|
|
@@ -3108,13 +3117,13 @@ const SwitchRoot = /*#__PURE__*/ React__namespace.default.forwardRef(({ classNam
|
|
|
3108
3117
|
SwitchRoot.displayName = "SwitchRoot";
|
|
3109
3118
|
const SwitchControl = withScaleFeedback(withControlProvider(reactSwitch.Switch.Control, "root"));
|
|
3110
3119
|
const SwitchThumb = withControlContext(reactSwitch.Switch.Thumb, "thumb");
|
|
3111
|
-
withContext$
|
|
3120
|
+
withContext$4(withStateProps$2(Primitive.span), "label");
|
|
3112
3121
|
const SwitchHiddenInput = reactSwitch.Switch.HiddenInput;
|
|
3113
3122
|
|
|
3114
3123
|
// src/use-layout-effect.tsx
|
|
3115
3124
|
var useLayoutEffect2 = globalThis?.document ? React__namespace.useLayoutEffect : ()=>{};
|
|
3116
3125
|
|
|
3117
|
-
const { withProvider, withContext: withContext$
|
|
3126
|
+
const { withProvider: withProvider$1, withContext: withContext$3, useClassNames: useClassNames$2 } = createSlotRecipeContext(textInput.textInput);
|
|
3118
3127
|
const withFieldStateProps = createWithStateProps([
|
|
3119
3128
|
{
|
|
3120
3129
|
useContext: reactField.useFieldContext,
|
|
@@ -3128,11 +3137,11 @@ const withStateProps$1 = createWithStateProps([
|
|
|
3128
3137
|
strict: false
|
|
3129
3138
|
}
|
|
3130
3139
|
]);
|
|
3131
|
-
const TextFieldRoot = withProvider(withFieldStateProps(reactTextField.TextField.Root), "root");
|
|
3132
|
-
withContext$
|
|
3133
|
-
withContext$
|
|
3134
|
-
withContext$
|
|
3135
|
-
withContext$
|
|
3140
|
+
const TextFieldRoot = withProvider$1(withFieldStateProps(reactTextField.TextField.Root), "root");
|
|
3141
|
+
withContext$3(withStateProps$1(InternalIcon), "prefixIcon");
|
|
3142
|
+
withContext$3(withStateProps$1(Primitive.span), "prefixText");
|
|
3143
|
+
withContext$3(withStateProps$1(InternalIcon), "suffixIcon");
|
|
3144
|
+
withContext$3(withStateProps$1(Primitive.span), "suffixText");
|
|
3136
3145
|
const TextFieldInput = /*#__PURE__*/ React.forwardRef(({ className, ...otherProps }, ref)=>{
|
|
3137
3146
|
const classNames = useClassNames$2();
|
|
3138
3147
|
const textFieldContext = reactTextField.useTextFieldContext();
|
|
@@ -3209,7 +3218,7 @@ const TextFieldTextarea = /*#__PURE__*/ React.forwardRef(({ className, autoresiz
|
|
|
3209
3218
|
});
|
|
3210
3219
|
TextFieldTextarea.displayName = "TextFieldTextarea";
|
|
3211
3220
|
|
|
3212
|
-
__insertCSS(".seed-data-table__root{box-sizing:border-box;display:flex;flex-direction:column;width:100%;border-width:1px;border-style:solid;font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif}.seed-data-table__table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}.seed-data-table__headerCell{box-sizing:border-box;position:sticky;top:0;z-index:2;vertical-align:middle;text-align:start;padding:0;height:var(--seed-dimension-x10);background-color:var(--seed-color-bg-layer-default);border-top:1px solid var(--seed-color-stroke-neutral-muted);border-bottom:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-inline-start:none;color:var(--seed-color-fg-neutral);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-medium);letter-spacing:-.14px}.seed-data-table__headerCell:last-child{border-inline-end:none}.seed-data-table__headerCell[data-sortable]{cursor:pointer;user-select:none}.seed-data-table__headerCell [data-chevron]{opacity:0;transition:opacity .12s}.seed-data-table__headerCell[data-sortable]:hover [data-chevron]{opacity:.6}.seed-data-table__headerCell[data-sorted] [data-chevron]{opacity:1;color:var(--seed-color-fg-neutral)}.seed-data-table__headerCell:hover [data-column-menu]{opacity:1}.seed-data-table__headerCell [data-column-menu]:focus-visible,.seed-data-table__headerCell [data-column-menu][data-open]{opacity:1}.seed-data-table__headerCell[data-dragging]{opacity:.5}.seed-data-table__headerCell[data-sticky]{position:sticky;z-index:3;background-color:var(--seed-color-bg-layer-default)}.seed-data-table__headerCell{outline:var(--seed-dimension-x0_5) solid transparent;outline-offset:calc(var(--seed-dimension-x0_5) * -1)}.seed-data-table__headerCell:is(:focus-visible,[data-focus-visible]){outline:var(--seed-dimension-x0_5) solid var(--seed-color-stroke-focus-ring);outline-offset:calc(var(--seed-dimension-x0_5) * -1)}.seed-data-table__headerCell .seed-data-table-resize-handle{position:absolute;top:0;inset-inline-end:calc(7px / -2);width:7px;height:100%;z-index:4;display:flex;align-items:center;justify-content:center;cursor:col-resize;touch-action:none}.seed-data-table__headerCell .seed-data-table-resize-handle-inner{width:3px;height:100%;border-radius:3px;background-color:#0298d9;opacity:0;transition:opacity .1s}.seed-data-table__headerCell .seed-data-table-resize-handle:hover .seed-data-table-resize-handle-inner,.seed-data-table__headerCell .seed-data-table-resize-handle[data-resizing] .seed-data-table-resize-handle-inner{opacity:1}.seed-data-table__headerCellInner{box-sizing:border-box;display:flex;align-items:center;width:100%;height:100%;min-width:0;gap:var(--seed-dimension-x1_5);padding-inline:var(--seed-dimension-x3)}.seed-data-table__headerCellLabel{min-width:0;flex:1 1 0%;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__headerCellIcon{flex-shrink:0;margin-inline-start:auto;display:inline-flex;align-items:center;justify-content:center;width:var(--seed-dimension-x4);height:var(--seed-dimension-x4);color:var(--seed-color-fg-neutral-subtle);border:none;background:0 0;padding:0;font:inherit;cursor:pointer}.seed-data-table__headerCellIcon[data-active]{color:var(--seed-color-fg-neutral)}.seed-data-table__headerCellIcon[data-column-menu]{opacity:0;transition:opacity .12s}.seed-data-table__row{position:relative;background-color:var(--seed-color-bg-layer-default);--seed-data-table-row-bg:var(--seed-color-bg-layer-default)}.seed-data-table__row[data-clickable]{cursor:pointer}.seed-data-table__row:is([aria-selected=true],[data-selected]){background-color:color-mix(in srgb,#0298d9 10%,var(--seed-color-bg-layer-default));--seed-data-table-row-bg:color-mix(in srgb, #0298d9 10%, var(--seed-color-bg-layer-default))}.seed-data-table__row:is([aria-selected=true],[data-selected]):is(:hover,[data-hover]){background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 3%,color-mix(in srgb,#0298d9 10%,var(--seed-color-bg-layer-default)));--seed-data-table-row-bg:color-mix(in srgb, var(--seed-color-fg-neutral) 3%, color-mix(in srgb, #0298d9 10%, var(--seed-color-bg-layer-default)))}.seed-data-table__cell{box-sizing:border-box;position:relative;vertical-align:middle;text-align:start;height:var(--seed-dimension-x9);border-bottom:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-top:none;border-inline-start:none;padding-block:0;padding-inline:var(--seed-dimension-x3);color:var(--seed-color-fg-neutral);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-regular);letter-spacing:-.14px;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__cell:last-child{border-inline-end:none}tbody tr:last-child .seed-data-table__cell{border-bottom:none}.seed-data-table__cell[data-numeric]{text-align:end;font-variant-numeric:tabular-nums}.seed-data-table__cell[data-sticky]{position:sticky;z-index:1;background-color:var(--seed-data-table-row-bg)}.seed-data-table__cell[data-editable]{cursor:default}.seed-data-table__cell .seed-data-table-edit-picker{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);min-width:0}.seed-data-table__cell .seed-data-table-edit-pending{flex-shrink:0;color:var(--seed-color-fg-neutral-subtle);animation:rotate .6s linear infinite}.seed-data-table__cell .seed-data-table-edit-error{position:absolute;top:100%;inset-inline-start:var(--seed-dimension-x3);inset-inline-end:var(--seed-dimension-x3);z-index:2;padding-top:2px;font-size:12px;line-height:1.3;color:var(--seed-color-fg-critical);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__entity{display:flex;align-items:center;min-width:0;gap:var(--seed-dimension-x1_5)}.seed-data-table__entityName{min-width:0;font-weight:var(--seed-font-weight-medium);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__tagList{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);overflow:hidden;min-width:0}.seed-data-table__entityActions{display:flex;align-items:center;gap:6px;margin-inline-start:auto;flex-shrink:0;opacity:0}.seed-data-table__entityActions:focus-within,tr:hover .seed-data-table__entityActions{opacity:1}.seed-data-table__entityAction{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin:0;padding:0;border:none;border-radius:6px;background:0 0;font-family:inherit;color:color-mix(in srgb,var(--seed-color-fg-neutral) 55%,transparent);cursor:pointer;flex-shrink:0}.seed-data-table__entityAction:hover{background:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,transparent);color:var(--seed-color-fg-neutral)}.seed-data-table__link{color:var(--seed-color-fg-neutral);text-decoration:none;min-width:0;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__link:is(:hover,[data-hover]){text-decoration:underline}.seed-data-table__toolbar{box-sizing:border-box;display:flex;align-items:center;width:100%;flex-shrink:0;min-height:49px;gap:var(--seed-dimension-x2);padding-inline:var(--seed-dimension-x3);border-top:1px solid var(--seed-color-stroke-neutral-muted)}.seed-data-table__search{position:relative;display:inline-flex;align-items:center;flex:1 1 0%;max-width:280px}.seed-data-table__search svg{position:absolute;inset-inline-start:var(--seed-dimension-x2);width:var(--seed-dimension-x4);height:var(--seed-dimension-x4);color:var(--seed-color-fg-neutral-muted);pointer-events:none}.seed-data-table__search input{width:100%;height:var(--seed-dimension-x8);padding-inline-start:var(--seed-dimension-x7);padding-inline-end:var(--seed-dimension-x2);border:none;border-radius:var(--seed-radius-r2);background-color:var(--seed-color-bg-layer-default);box-shadow:inset 0 0 0 1px var(--seed-color-stroke-neutral-weak);font-family:inherit;font-size:var(--seed-font-size-t4);color:var(--seed-color-fg-neutral);outline:0;transition:box-shadow .1s var(--seed-timing-function-easing)}.seed-data-table__search input::placeholder{color:var(--seed-color-fg-neutral-subtle)}.seed-data-table__search input:focus{box-shadow:inset 0 0 0 2px var(--seed-color-stroke-neutral-contrast)}.seed-data-table__count{flex-shrink:0;color:var(--seed-color-fg-neutral-subtle);font-size:var(--seed-font-size-t3);font-variant-numeric:tabular-nums}.seed-data-table__toolbarEnd{flex-shrink:0;margin-inline-start:auto;display:inline-flex;align-items:center;gap:var(--seed-dimension-x2)}.seed-data-table__scrollArea{position:relative;display:flex;flex-direction:column;width:100%;min-width:0;flex:1 1 auto;min-height:0;overflow-x:auto;overflow-y:auto}.seed-data-table__scrollArea[data-scrolled-start] [data-sticky-edge]{clip-path:inset(0 -38px 0 0);box-shadow:6px 0 16px 4px rgba(0,0,0,.12)}.seed-data-table__scrollArea[data-scrolled-end] [data-sticky-edge-end]{clip-path:inset(0 0 0 -38px);box-shadow:-6px 0 16px 4px rgba(0,0,0,.12)}.seed-data-table__footerCell{box-sizing:border-box;position:sticky;bottom:0;z-index:2;vertical-align:middle;padding:0;height:var(--seed-dimension-x9);background-color:var(--seed-color-bg-layer-default);border-top:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-inline-start:none}.seed-data-table__footerCell:last-child{border-inline-end:none}.seed-data-table__footerCell .seed-data-table-column-calc-trigger{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);width:100%;height:100%;min-width:0;margin:0;padding:0 var(--seed-dimension-x3);border:none;background:0 0;color:var(--seed-color-fg-neutral-subtle);font-family:inherit;font-size:var(--seed-font-size-t4);font-weight:var(--seed-font-weight-medium);white-space:nowrap;overflow:clip;cursor:pointer;transition:background-color .12s,color .12s}.seed-data-table__footerCell .seed-data-table-column-calc-trigger:hover{background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,transparent);color:var(--seed-color-fg-neutral)}.seed-data-table__footerCell .seed-data-table-column-calc-trigger[data-align=right]{justify-content:flex-end}.seed-data-table__footerCell .seed-data-table-column-calc-trigger svg{flex-shrink:0;opacity:.7}.seed-data-table__footerCell .seed-data-table-column-calc-placeholder{overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__footerCell .seed-data-table-column-calc-value{min-width:0;flex-shrink:1;color:var(--seed-color-fg-neutral);font-variant-numeric:tabular-nums;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__footerCell .seed-data-table-column-calc-op{min-width:0;flex-shrink:1;color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__emptyState{box-sizing:border-box;text-align:center;padding-block:var(--seed-dimension-x8);padding-inline:var(--seed-dimension-x3);color:var(--seed-color-fg-neutral-subtle);font-size:var(--seed-font-size-t4)}.seed-data-table__loadingState{box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:10px;padding-block:var(--seed-dimension-x8);padding-inline:var(--seed-dimension-x3);color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-medium)}.seed-data-table__loadingState[data-inline]{padding-block:0;padding-inline:0;height:var(--seed-dimension-x9)}.seed-data-table__loadingState .seed-data-table-loading-spinner{flex-shrink:0;color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);animation:rotate .6s linear infinite}.seed-data-table__addRowCell{box-sizing:border-box;padding:0;border-top:none}.seed-data-table__addRow{box-sizing:border-box;display:flex;align-items:center;width:100%;margin:0;border:none;border-top:1px solid var(--seed-color-stroke-neutral-muted);background-color:var(--seed-color-bg-layer-default);height:var(--seed-dimension-x9);gap:var(--seed-dimension-x2);padding-inline:var(--seed-dimension-x2);color:var(--seed-color-fg-neutral-subtle);font-family:inherit;font-size:var(--seed-font-size-t4);cursor:pointer;transition:background-color .12s,color .12s}.seed-data-table__addRow:hover{background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,var(--seed-color-bg-layer-default));color:var(--seed-color-fg-neutral)}.seed-data-table__addRow svg{flex-shrink:0}.seed-data-table__selectionCell{text-align:center;padding:0}.seed-data-table__root--surface_card{border-color:var(--seed-color-stroke-neutral-muted);background-color:var(--seed-color-bg-layer-default);border-radius:var(--seed-radius-r3)}.seed-data-table__root--surface_bleed{border-color:var(--seed-color-bg-transparent);background-color:var(--seed-color-bg-transparent)}.seed-data-table__row--interactive_true{transition:background-color .12s}.seed-data-table__row--interactive_true:is(:hover,[data-hover]){background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 3%,transparent);--seed-data-table-row-bg:color-mix(in srgb, var(--seed-color-fg-neutral) 3%, var(--seed-color-bg-layer-default))}");
|
|
3221
|
+
__insertCSS(".seed-data-table__root{box-sizing:border-box;display:flex;flex-direction:column;width:100%;border-width:1px;border-style:solid;font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif}.seed-data-table__table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}.seed-data-table__headerCell{box-sizing:border-box;position:sticky;top:0;z-index:2;vertical-align:middle;text-align:start;padding:0;height:var(--seed-dimension-x10);background-color:var(--seed-color-bg-layer-default);border-top:1px solid var(--seed-color-stroke-neutral-muted);border-bottom:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-inline-start:none;color:var(--seed-color-fg-neutral);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-medium);letter-spacing:-.14px}.seed-data-table__headerCell:last-child{border-inline-end:none}.seed-data-table__headerCell[data-sortable]{cursor:pointer;user-select:none}.seed-data-table__headerCell [data-chevron]{opacity:0;transition:opacity .12s}.seed-data-table__headerCell[data-sortable]:hover [data-chevron]{opacity:.6}.seed-data-table__headerCell[data-sorted] [data-chevron]{opacity:1;color:var(--seed-color-fg-neutral)}.seed-data-table__headerCell:hover [data-column-menu]{opacity:1}.seed-data-table__headerCell [data-column-menu]:focus-visible,.seed-data-table__headerCell [data-column-menu][data-open]{opacity:1}.seed-data-table__headerCell[data-dragging]{opacity:.5}.seed-data-table__headerCell[data-sticky]{position:sticky;z-index:3;background-color:var(--seed-color-bg-layer-default)}.seed-data-table__headerCell{outline:var(--seed-dimension-x0_5) solid transparent;outline-offset:calc(var(--seed-dimension-x0_5) * -1)}.seed-data-table__headerCell:is(:focus-visible,[data-focus-visible]){outline:var(--seed-dimension-x0_5) solid var(--seed-color-stroke-focus-ring);outline-offset:calc(var(--seed-dimension-x0_5) * -1)}.seed-data-table__headerCell .seed-data-table-resize-handle{position:absolute;top:0;inset-inline-end:calc(7px / -2);width:7px;height:100%;z-index:4;display:flex;align-items:center;justify-content:center;cursor:col-resize;touch-action:none}.seed-data-table__headerCell .seed-data-table-resize-handle-inner{width:3px;height:100%;border-radius:3px;background-color:#0298d9;opacity:0;transition:opacity .1s}.seed-data-table__headerCell .seed-data-table-resize-handle:hover .seed-data-table-resize-handle-inner,.seed-data-table__headerCell .seed-data-table-resize-handle[data-resizing] .seed-data-table-resize-handle-inner{opacity:1}.seed-data-table__headerCellInner{box-sizing:border-box;display:flex;align-items:center;width:100%;height:100%;min-width:0;gap:var(--seed-dimension-x1_5);padding-inline:var(--seed-dimension-x3)}.seed-data-table__headerCellLabel{min-width:0;flex:1 1 0%;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__headerCellIcon{flex-shrink:0;margin-inline-start:auto;display:inline-flex;align-items:center;justify-content:center;width:var(--seed-dimension-x4);height:var(--seed-dimension-x4);color:var(--seed-color-fg-neutral-subtle);border:none;background:0 0;padding:0;font:inherit;cursor:pointer}.seed-data-table__headerCellIcon[data-active]{color:var(--seed-color-fg-neutral)}.seed-data-table__headerCellIcon[data-column-menu]{opacity:0;transition:opacity .12s}.seed-data-table__row{position:relative;background-color:var(--seed-color-bg-layer-default);--seed-data-table-row-bg:var(--seed-color-bg-layer-default)}.seed-data-table__row[data-clickable]{cursor:pointer}.seed-data-table__row:is([aria-selected=true],[data-selected]){background-color:color-mix(in srgb,#0298d9 10%,var(--seed-color-bg-layer-default));--seed-data-table-row-bg:color-mix(in srgb, #0298d9 10%, var(--seed-color-bg-layer-default))}.seed-data-table__row:is([aria-selected=true],[data-selected]):is(:hover,[data-hover]){background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 3%,color-mix(in srgb,#0298d9 10%,var(--seed-color-bg-layer-default)));--seed-data-table-row-bg:color-mix(in srgb, var(--seed-color-fg-neutral) 3%, color-mix(in srgb, #0298d9 10%, var(--seed-color-bg-layer-default)))}.seed-data-table__cell{box-sizing:border-box;position:relative;vertical-align:middle;text-align:start;height:var(--seed-dimension-x9);border-bottom:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-top:none;border-inline-start:none;padding-block:0;padding-inline:var(--seed-dimension-x3);color:var(--seed-color-fg-neutral);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-regular);letter-spacing:-.14px;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__cell:last-child{border-inline-end:none}tbody tr:last-child .seed-data-table__cell{border-bottom:none}.seed-data-table__cell[data-numeric]{text-align:end;font-variant-numeric:tabular-nums}.seed-data-table__cell[data-sticky]{position:sticky;z-index:1;background-color:var(--seed-data-table-row-bg)}.seed-data-table__cell[data-editable]{cursor:default}.seed-data-table__cell .seed-data-table-edit-picker{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);min-width:0}.seed-data-table__cell .seed-data-table-edit-pending{flex-shrink:0;color:var(--seed-color-fg-neutral-subtle);animation:rotate .6s linear infinite}.seed-data-table__cell .seed-data-table-edit-error{position:absolute;top:100%;inset-inline-start:var(--seed-dimension-x3);inset-inline-end:var(--seed-dimension-x3);z-index:2;padding-top:2px;font-size:12px;line-height:1.3;color:var(--seed-color-fg-critical);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__entity{display:flex;align-items:center;min-width:0;gap:var(--seed-dimension-x1_5)}.seed-data-table__entityName{min-width:0;font-weight:var(--seed-font-weight-medium);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__tagList{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);overflow:hidden;min-width:0}.seed-data-table__entityActions{display:flex;align-items:center;gap:6px;margin-inline-start:auto;flex-shrink:0;opacity:0;transition:opacity .15s}tr:hover .seed-data-table__entityActions{opacity:1}.seed-data-table__entityActions:focus-within{opacity:1}.seed-data-table__entityAction{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin:0;padding:2px;border:none;border-radius:6px;background:0 0;font-family:inherit;color:color-mix(in srgb,var(--seed-color-fg-neutral) 55%,transparent);cursor:pointer;flex-shrink:0;transition:background-color .2s,color .2s,box-shadow .2s}.seed-data-table__entityAction:hover{background:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,transparent);color:var(--seed-color-fg-neutral)}.seed-data-table__link{color:var(--seed-color-fg-neutral);text-decoration:none;min-width:0;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__link:is(:hover,[data-hover]){text-decoration:underline}.seed-data-table__toolbar{box-sizing:border-box;display:flex;align-items:center;width:100%;flex-shrink:0;min-height:49px;gap:var(--seed-dimension-x2);padding-inline:var(--seed-dimension-x3);border-top:1px solid var(--seed-color-stroke-neutral-muted)}.seed-data-table__search{position:relative;display:inline-flex;align-items:center;flex:1 1 0%;max-width:280px}.seed-data-table__search svg{position:absolute;inset-inline-start:var(--seed-dimension-x2);width:var(--seed-dimension-x4);height:var(--seed-dimension-x4);color:var(--seed-color-fg-neutral-muted);pointer-events:none}.seed-data-table__search input{width:100%;height:var(--seed-dimension-x8);padding-inline-start:var(--seed-dimension-x7);padding-inline-end:var(--seed-dimension-x2);border:none;border-radius:var(--seed-radius-r2);background-color:var(--seed-color-bg-layer-default);box-shadow:inset 0 0 0 1px var(--seed-color-stroke-neutral-weak);font-family:inherit;font-size:var(--seed-font-size-t4);color:var(--seed-color-fg-neutral);outline:0;transition:box-shadow .1s var(--seed-timing-function-easing)}.seed-data-table__search input::placeholder{color:var(--seed-color-fg-neutral-subtle)}.seed-data-table__search input:focus{box-shadow:inset 0 0 0 2px var(--seed-color-stroke-neutral-contrast)}.seed-data-table__count{flex-shrink:0;color:var(--seed-color-fg-neutral-subtle);font-size:var(--seed-font-size-t3);font-variant-numeric:tabular-nums}.seed-data-table__toolbarEnd{flex-shrink:0;margin-inline-start:auto;display:inline-flex;align-items:center;gap:var(--seed-dimension-x2)}.seed-data-table__scrollArea{position:relative;display:flex;flex-direction:column;width:100%;min-width:0;flex:1 1 auto;min-height:0;overflow-x:auto;overflow-y:auto}.seed-data-table__scrollArea[data-scrolled-start] [data-sticky-edge]{clip-path:inset(0 -38px 0 0);box-shadow:6px 0 16px 4px rgba(0,0,0,.12)}.seed-data-table__scrollArea[data-scrolled-end] [data-sticky-edge-end]{clip-path:inset(0 0 0 -38px);box-shadow:-6px 0 16px 4px rgba(0,0,0,.12)}.seed-data-table__footerCell{box-sizing:border-box;position:sticky;bottom:0;z-index:2;vertical-align:middle;padding:0;height:var(--seed-dimension-x9);background-color:var(--seed-color-bg-layer-default);border-top:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-inline-start:none}.seed-data-table__footerCell:last-child{border-inline-end:none}.seed-data-table__footerCell .seed-data-table-column-calc-trigger{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);width:100%;height:100%;min-width:0;margin:0;padding:0 var(--seed-dimension-x3);border:none;background:0 0;color:var(--seed-color-fg-neutral-subtle);font-family:inherit;font-size:var(--seed-font-size-t4);font-weight:var(--seed-font-weight-medium);white-space:nowrap;overflow:clip;cursor:pointer;transition:background-color .12s,color .12s}.seed-data-table__footerCell .seed-data-table-column-calc-trigger:hover{background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,transparent);color:var(--seed-color-fg-neutral)}.seed-data-table__footerCell .seed-data-table-column-calc-trigger[data-align=right]{justify-content:flex-end}.seed-data-table__footerCell .seed-data-table-column-calc-trigger svg{flex-shrink:0;opacity:.7}.seed-data-table__footerCell .seed-data-table-column-calc-placeholder{overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__footerCell .seed-data-table-column-calc-value{min-width:0;flex-shrink:1;color:var(--seed-color-fg-neutral);font-variant-numeric:tabular-nums;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__footerCell .seed-data-table-column-calc-op{min-width:0;flex-shrink:1;color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__emptyState{box-sizing:border-box;text-align:center;padding-block:var(--seed-dimension-x8);padding-inline:var(--seed-dimension-x3);color:var(--seed-color-fg-neutral-subtle);font-size:var(--seed-font-size-t4)}.seed-data-table__loadingState{box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:10px;padding-block:var(--seed-dimension-x8);padding-inline:var(--seed-dimension-x3);color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-medium)}.seed-data-table__loadingState[data-inline]{padding-block:0;padding-inline:0;height:var(--seed-dimension-x9)}.seed-data-table__loadingState .seed-data-table-loading-spinner{flex-shrink:0;color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);animation:rotate .6s linear infinite}.seed-data-table__addRowCell{box-sizing:border-box;padding:0;border-top:none}.seed-data-table__addRow{box-sizing:border-box;display:flex;align-items:center;width:100%;margin:0;border:none;border-top:1px solid var(--seed-color-stroke-neutral-muted);background-color:var(--seed-color-bg-layer-default);height:var(--seed-dimension-x9);gap:var(--seed-dimension-x2);padding-inline:var(--seed-dimension-x2);color:var(--seed-color-fg-neutral-subtle);font-family:inherit;font-size:var(--seed-font-size-t4);cursor:pointer;transition:background-color .12s,color .12s}.seed-data-table__addRow:hover{background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,var(--seed-color-bg-layer-default));color:var(--seed-color-fg-neutral)}.seed-data-table__addRow svg{flex-shrink:0}.seed-data-table__selectionCell{text-align:center;padding:0}.seed-data-table__root--surface_card{border-color:var(--seed-color-stroke-neutral-muted);background-color:var(--seed-color-bg-layer-default);border-radius:var(--seed-radius-r3)}.seed-data-table__root--surface_bleed{border-color:var(--seed-color-bg-transparent);background-color:var(--seed-color-bg-transparent)}.seed-data-table__row--interactive_true{transition:background-color .12s}.seed-data-table__row--interactive_true:is(:hover,[data-hover]){background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 3%,transparent);--seed-data-table-row-bg:color-mix(in srgb, var(--seed-color-fg-neutral) 3%, var(--seed-color-bg-layer-default))}");
|
|
3213
3222
|
|
|
3214
3223
|
const createClassName = (className, variants, compoundVariants = [])=>{
|
|
3215
3224
|
const variantKeys = Object.keys(variants);
|
|
@@ -3396,7 +3405,7 @@ Object.assign(dataTable, {
|
|
|
3396
3405
|
// other file (`DataTable.tsx`, `column-menu.tsx`, `resize.tsx`, `column-calc.tsx`,
|
|
3397
3406
|
// `toolbar.tsx`, `body-cells.tsx`, `editors.tsx`) imports its exports from here rather
|
|
3398
3407
|
// than re-deriving its own.
|
|
3399
|
-
const { ClassNamesProvider: ClassNamesProvider$1, withContext: withContext$
|
|
3408
|
+
const { ClassNamesProvider: ClassNamesProvider$1, withContext: withContext$2, useClassNames: useClassNames$1 } = createSlotRecipeContext(dataTable);
|
|
3400
3409
|
|
|
3401
3410
|
/**
|
|
3402
3411
|
* The pure filter itself, split out of `useSelectSearch` below so it can be
|
|
@@ -4115,7 +4124,7 @@ function DisplayCellContent({ column, row, value, classNames, locale }) {
|
|
|
4115
4124
|
}
|
|
4116
4125
|
}
|
|
4117
4126
|
|
|
4118
|
-
const { ClassNamesProvider, withContext, useClassNames } = createSlotRecipeContext(menu.menu);
|
|
4127
|
+
const { ClassNamesProvider, withContext: withContext$1, useClassNames } = createSlotRecipeContext(menu.menu);
|
|
4119
4128
|
const { PropsProvider: ItemPropsProvider, useProps: useItemProps, withContext: withItemContext, ClassNamesProvider: ItemClassNamesProvider } = createSlotRecipeContext(menuItem.menuItem);
|
|
4120
4129
|
const withStateProps = createWithStateProps([
|
|
4121
4130
|
reactMenu.useMenuContext
|
|
@@ -4149,10 +4158,10 @@ const MenuPositioner = /*#__PURE__*/ React__namespace.forwardRef(({ className, .
|
|
|
4149
4158
|
});
|
|
4150
4159
|
});
|
|
4151
4160
|
MenuPositioner.displayName = "MenuPositioner";
|
|
4152
|
-
const MenuContent = withContext(reactMenu.Menu.Content, "content");
|
|
4153
|
-
const MenuScrollArea = withContext(withStateProps(Primitive.div), "scrollArea");
|
|
4154
|
-
withContext(reactMenu.Menu.Group, "group");
|
|
4155
|
-
withContext(reactMenu.Menu.GroupLabel, "groupLabel");
|
|
4161
|
+
const MenuContent = withContext$1(reactMenu.Menu.Content, "content");
|
|
4162
|
+
const MenuScrollArea = withContext$1(withStateProps(Primitive.div), "scrollArea");
|
|
4163
|
+
withContext$1(reactMenu.Menu.Group, "group");
|
|
4164
|
+
withContext$1(reactMenu.Menu.GroupLabel, "groupLabel");
|
|
4156
4165
|
const MenuItem = /*#__PURE__*/ React__namespace.forwardRef(({ className: propClassName, ...props }, ref)=>{
|
|
4157
4166
|
const [variantProps, otherProps] = menuItem.menuItem.splitVariantProps(props);
|
|
4158
4167
|
const parentProps = useItemProps();
|
|
@@ -5917,8 +5926,8 @@ Object.assign(datePicker, {
|
|
|
5917
5926
|
splitVariantProps: (props)=>splitVariantProps(props, datePickerVariantMap)
|
|
5918
5927
|
}); // @recipe(seed): date-picker
|
|
5919
5928
|
|
|
5920
|
-
var __defProp$
|
|
5921
|
-
var __name$
|
|
5929
|
+
var __defProp$3 = Object.defineProperty;
|
|
5930
|
+
var __name$3 = (target, value)=>__defProp$3(target, "name", {
|
|
5922
5931
|
value,
|
|
5923
5932
|
configurable: true
|
|
5924
5933
|
});
|
|
@@ -5942,15 +5951,15 @@ function useEffectEvent(callback) {
|
|
|
5942
5951
|
}
|
|
5943
5952
|
return React__namespace.useMemo(()=>(...args)=>ref.current?.(...args), []);
|
|
5944
5953
|
}
|
|
5945
|
-
__name$
|
|
5954
|
+
__name$3(useEffectEvent, "useEffectEvent");
|
|
5946
5955
|
|
|
5947
|
-
var __defProp = Object.defineProperty;
|
|
5948
|
-
var __name = (target, value)=>__defProp(target, "name", {
|
|
5956
|
+
var __defProp$2 = Object.defineProperty;
|
|
5957
|
+
var __name$2 = (target, value)=>__defProp$2(target, "name", {
|
|
5949
5958
|
value,
|
|
5950
5959
|
configurable: true
|
|
5951
5960
|
});
|
|
5952
5961
|
var useInsertionEffect = React__namespace[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
5953
|
-
function useControllableState({ prop, defaultProp, onChange = /* @__PURE__ */ __name(()=>{}, "onChange"), caller }) {
|
|
5962
|
+
function useControllableState({ prop, defaultProp, onChange = /* @__PURE__ */ __name$2(()=>{}, "onChange"), caller }) {
|
|
5954
5963
|
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
5955
5964
|
defaultProp,
|
|
5956
5965
|
onChange
|
|
@@ -5977,7 +5986,7 @@ function useControllableState({ prop, defaultProp, onChange = /* @__PURE__ */ __
|
|
|
5977
5986
|
setValue
|
|
5978
5987
|
];
|
|
5979
5988
|
}
|
|
5980
|
-
__name(useControllableState, "useControllableState");
|
|
5989
|
+
__name$2(useControllableState, "useControllableState");
|
|
5981
5990
|
function useUncontrolledState({ defaultProp, onChange }) {
|
|
5982
5991
|
const [value, setValue] = React__namespace.useState(defaultProp);
|
|
5983
5992
|
const prevValueRef = React__namespace.useRef(value);
|
|
@@ -6002,11 +6011,11 @@ function useUncontrolledState({ defaultProp, onChange }) {
|
|
|
6002
6011
|
onChangeRef
|
|
6003
6012
|
];
|
|
6004
6013
|
}
|
|
6005
|
-
__name(useUncontrolledState, "useUncontrolledState");
|
|
6014
|
+
__name$2(useUncontrolledState, "useUncontrolledState");
|
|
6006
6015
|
function isFunction(value) {
|
|
6007
6016
|
return typeof value === "function";
|
|
6008
6017
|
}
|
|
6009
|
-
__name(isFunction, "isFunction");
|
|
6018
|
+
__name$2(isFunction, "isFunction");
|
|
6010
6019
|
var SYNC_STATE = Symbol("RADIX:SYNC_STATE");
|
|
6011
6020
|
function useControllableStateReducer(reducer, userArgs, initialArg, init) {
|
|
6012
6021
|
const { prop: controlledState, defaultProp, onChange: onChangeProp, caller } = userArgs;
|
|
@@ -6078,7 +6087,7 @@ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
|
|
|
6078
6087
|
dispatch
|
|
6079
6088
|
];
|
|
6080
6089
|
}
|
|
6081
|
-
__name(useControllableStateReducer, "useControllableStateReducer");
|
|
6090
|
+
__name$2(useControllableStateReducer, "useControllableStateReducer");
|
|
6082
6091
|
|
|
6083
6092
|
/*
|
|
6084
6093
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -10284,8 +10293,8 @@ const formatFilterDate = (iso)=>{
|
|
|
10284
10293
|
});
|
|
10285
10294
|
}
|
|
10286
10295
|
|
|
10287
|
-
const DataTableToolbar = withContext$
|
|
10288
|
-
const DataTableCount = withContext$
|
|
10296
|
+
const DataTableToolbar = withContext$2(Primitive.div, "toolbar");
|
|
10297
|
+
const DataTableCount = withContext$2(Primitive.span, "count");
|
|
10289
10298
|
/**
|
|
10290
10299
|
* The toolbar's own right-hand group -- `count`'s `marginInlineStart: auto` moved
|
|
10291
10300
|
* here (off the `<span>` itself) so a consumer's `toolbarActions` and the row count
|
|
@@ -10296,7 +10305,7 @@ const DataTableCount = withContext$1(Primitive.span, "count");
|
|
|
10296
10305
|
* it. `DataTable.tsx` always renders this wrapper once either `toolbarActions` or
|
|
10297
10306
|
* `showCount` is on, so it degrades to exactly the old single-count layout when no
|
|
10298
10307
|
* `toolbarActions` is passed.
|
|
10299
|
-
*/ const DataTableToolbarEnd = withContext$
|
|
10308
|
+
*/ const DataTableToolbarEnd = withContext$2(Primitive.div, "toolbarEnd");
|
|
10300
10309
|
/**
|
|
10301
10310
|
* A compact, borderless search box -- crisp's own measured `.crisp-datatable-search`
|
|
10302
10311
|
* (32px, `bgSurface` background, a leading icon, a soft rest-state shadow, a 1px brand
|
|
@@ -10718,7 +10727,7 @@ DataTableInner.displayName = "DataTable";
|
|
|
10718
10727
|
// is a SIBLING of the toolbar (both inside `DataTablePrimitiveRoot`'s card `<div>`)
|
|
10719
10728
|
// rather than `DataTablePrimitiveRoot` itself: a `<table>` cannot host the toolbar as a
|
|
10720
10729
|
// child without the HTML parser foster-parenting it back out.
|
|
10721
|
-
const DataTableTable = withContext$
|
|
10730
|
+
const DataTableTable = withContext$2(DataTableTable$1, "table");
|
|
10722
10731
|
/** One `<col>` per rendered column (plus the 40px selection column, if any) -- the
|
|
10723
10732
|
* SINGLE place a column's width is ever set now. Every row's header/body/footer cell
|
|
10724
10733
|
* reads its own width off this shared `<colgroup>` by construction (native table
|
|
@@ -10755,15 +10764,15 @@ const DataTableTable = withContext$1(DataTableTable$1, "table");
|
|
|
10755
10764
|
]
|
|
10756
10765
|
});
|
|
10757
10766
|
}
|
|
10758
|
-
const DataTableHeader = withContext$
|
|
10759
|
-
const DataTableHeaderCell = withContext$
|
|
10767
|
+
const DataTableHeader = withContext$2(DataTableHeader$1, "header");
|
|
10768
|
+
const DataTableHeaderCell = withContext$2(DataTableHeaderCell$1, "headerCell");
|
|
10760
10769
|
// `.crisp-datatable-th-inner` -- the flex row INSIDE a `<th>` (label + filter trigger +
|
|
10761
10770
|
// sort chevron + column menu). See qvism-preset's own `headerCellInner` slot comment
|
|
10762
10771
|
// for why this lives one level below the cell itself rather than on it.
|
|
10763
|
-
const DataTableHeaderCellInner = withContext$
|
|
10772
|
+
const DataTableHeaderCellInner = withContext$2(Primitive.div, "headerCellInner");
|
|
10764
10773
|
/** The label text specifically -- the one thing in `DataTableHeaderCellInner` that
|
|
10765
10774
|
* truncates; the trailing filter/sort/menu icons stay fully visible regardless of how
|
|
10766
|
-
* long a column's own header text is. */ const DataTableHeaderCellLabel = withContext$
|
|
10775
|
+
* long a column's own header text is. */ const DataTableHeaderCellLabel = withContext$2(Primitive.span, "headerCellLabel");
|
|
10767
10776
|
/**
|
|
10768
10777
|
* A selection `<th>`/`<td>`/footer `<td>` composes ITS base slot (`headerCell`/`cell`/
|
|
10769
10778
|
* `footerCell`) together with the `selectionCell` MODIFIER, rather than replacing it --
|
|
@@ -10785,12 +10794,12 @@ const DataTableHeaderCellInner = withContext$1(Primitive.div, "headerCellInner")
|
|
|
10785
10794
|
return StyledComponent;
|
|
10786
10795
|
}
|
|
10787
10796
|
const DataTableSelectionHeaderCell = withSelectionCell(DataTableHeaderCell$1, "headerCell");
|
|
10788
|
-
const DataTableHeaderCellIcon = withContext$
|
|
10797
|
+
const DataTableHeaderCellIcon = withContext$2(Primitive.span, "headerCellIcon");
|
|
10789
10798
|
// body has no CSS slot of its own in the rootage spec -- it is a plain structural
|
|
10790
10799
|
// `<tbody>`, so it is not wrapped in `withContext`.
|
|
10791
10800
|
const DataTableBody = DataTableBody$1;
|
|
10792
|
-
const DataTableRow = withContext$
|
|
10793
|
-
const DataTableCell = withContext$
|
|
10801
|
+
const DataTableRow = withContext$2(DataTableRow$1, "row");
|
|
10802
|
+
const DataTableCell = withContext$2(DataTableCell$1, "cell");
|
|
10794
10803
|
const DataTableSelectionCell = withSelectionCell(DataTableCell$1, "cell");
|
|
10795
10804
|
// Tranche 4 -- column menu + reorder + resize + sticky columns. A scroll boundary
|
|
10796
10805
|
// wrapping the whole `<table>`: `overflowX: auto` is what makes a wide table (more
|
|
@@ -10800,7 +10809,7 @@ const DataTableSelectionCell = withSelectionCell(DataTableCell$1, "cell");
|
|
|
10800
10809
|
// stays out of this slot's own base css (nothing here has a bounded height of its own
|
|
10801
10810
|
// to clip), so it never introduces a second vertical scrollbar next to whatever
|
|
10802
10811
|
// ambient container the whole DataTable already sits in.
|
|
10803
|
-
const DataTableScrollBodyBase = withContext$
|
|
10812
|
+
const DataTableScrollBodyBase = withContext$2(Primitive.div, "scrollArea");
|
|
10804
10813
|
function DataTableScrollBody({ children, scrollProps }) {
|
|
10805
10814
|
const { scrollAreaRef, scrolledStart, scrolledEnd, onScroll } = useDataTableContext();
|
|
10806
10815
|
const { className: scrollClassName, style: scrollStyle, ...otherScrollProps } = scrollProps ?? {};
|
|
@@ -10815,7 +10824,7 @@ function DataTableScrollBody({ children, scrollProps }) {
|
|
|
10815
10824
|
children: children
|
|
10816
10825
|
});
|
|
10817
10826
|
}
|
|
10818
|
-
const DataTableFooterBase = withContext$
|
|
10827
|
+
const DataTableFooterBase = withContext$2(Primitive.tfoot, "footer");
|
|
10819
10828
|
function DataTableFooter({ children, ...props }) {
|
|
10820
10829
|
return /*#__PURE__*/ jsxRuntime.jsx(DataTableFooterBase, {
|
|
10821
10830
|
...props,
|
|
@@ -10824,7 +10833,7 @@ function DataTableFooter({ children, ...props }) {
|
|
|
10824
10833
|
})
|
|
10825
10834
|
});
|
|
10826
10835
|
}
|
|
10827
|
-
const DataTableFooterCell = withContext$
|
|
10836
|
+
const DataTableFooterCell = withContext$2(Primitive.td, "footerCell");
|
|
10828
10837
|
// The selection column's OWN sticky wrappers -- one each for header/body/footer,
|
|
10829
10838
|
// reading the live pinned set via `useSelectionStickyFirst` (column-layout.ts) instead
|
|
10830
10839
|
// of the `stickyFirst` PROP alone, so the checkbox column sticks the moment ANY column
|
|
@@ -11176,7 +11185,7 @@ DataTableViewsControl.displayName = "DataTableViewsControl";
|
|
|
11176
11185
|
});
|
|
11177
11186
|
}
|
|
11178
11187
|
|
|
11179
|
-
__insertCSS(".seed-resizable-panel__root{position:relative;display:flex;height:100%}.seed-resizable-panel__spacer{flex:0 0 auto;height:100%;transition:width .14s}.seed-resizable-panel__panel{position:absolute;top:0;bottom:0;box-sizing:border-box;overflow:hidden;background:var(--seed-color-bg-layer-default)}.seed-resizable-panel__panel[data-side=left]{left:0}.seed-resizable-panel__panel[data-side=right]{right:0}.seed-resizable-panel__panel[data-floating=false]{border-radius:0;box-shadow:none}.seed-resizable-panel__panel[data-floating=false][data-side=left]{border-inline-end:1px solid var(--seed-color-stroke-neutral-muted)}.seed-resizable-panel__panel[data-floating=false][data-side=right]{border-inline-start:1px solid var(--seed-color-stroke-neutral-muted)}.seed-resizable-panel__panel[data-floating=true]{position:absolute;top:
|
|
11188
|
+
__insertCSS(".seed-resizable-panel__root{position:relative;display:flex;height:100%}.seed-resizable-panel__root[data-floating=true]{position:absolute;inset:0;display:block;height:auto;pointer-events:none}.seed-resizable-panel__spacer{flex:0 0 auto;height:100%;transition:width .14s}.seed-resizable-panel__panel{position:absolute;top:0;bottom:0;box-sizing:border-box;overflow:hidden;background:var(--seed-color-bg-layer-default)}.seed-resizable-panel__panel[data-side=left]{left:0}.seed-resizable-panel__panel[data-side=right]{right:0}.seed-resizable-panel__panel[data-floating=false]{border-radius:0;box-shadow:none}.seed-resizable-panel__panel[data-floating=false][data-side=left]{border-inline-end:1px solid var(--seed-color-stroke-neutral-muted)}.seed-resizable-panel__panel[data-floating=false][data-side=right]{border-inline-start:1px solid var(--seed-color-stroke-neutral-muted)}.seed-resizable-panel__panel[data-floating=true]{position:absolute;top:0;bottom:0;z-index:20;pointer-events:auto;border-inline-end:none;border-inline-start:none;transform:none;opacity:1}.seed-resizable-panel__panel[data-floating=true][data-side=left]{left:0;border-top-right-radius:12px;border-bottom-right-radius:12px;box-shadow:1px 0 0 rgba(28,40,64,.04),8px 0 16px -6px rgba(28,40,64,.12),8px 0 24px -4px rgba(24,41,75,.16)}.seed-resizable-panel__panel[data-floating=true][data-side=right]{right:0;border-top-left-radius:12px;border-bottom-left-radius:12px;box-shadow:-1px 0 0 rgba(28,40,64,.04),-8px 0 16px -6px rgba(28,40,64,.12),-8px 0 24px -4px rgba(24,41,75,.16)}.seed-resizable-panel__panel[data-floating=true][data-side=left][data-state=open]{animation:seed-enter;animation-timing-function:cubic-bezier(0.16,1,0.3,1);animation-duration:.18s;--seed-enter-translate-x:-100%;--seed-enter-translate-y:0;--seed-enter-opacity:0;--seed-enter-scale:1}@media (prefers-reduced-motion:reduce){.seed-resizable-panel__panel[data-floating=true][data-side=left][data-state=open]{--seed-enter-translate-x:0}}.seed-resizable-panel__panel[data-floating=true][data-side=left][data-state=closed]{animation:seed-exit;animation-timing-function:cubic-bezier(0.4,0,1,1);animation-duration:.14s;animation-fill-mode:forwards;--seed-exit-translate-x:-100%;--seed-exit-translate-y:0;--seed-exit-opacity:0;--seed-exit-scale:1}@media (prefers-reduced-motion:reduce){.seed-resizable-panel__panel[data-floating=true][data-side=left][data-state=closed]{--seed-exit-translate-x:0}}.seed-resizable-panel__panel[data-floating=true][data-side=right][data-state=open]{animation:seed-enter;animation-timing-function:cubic-bezier(0.16,1,0.3,1);animation-duration:.18s;--seed-enter-translate-x:100%;--seed-enter-translate-y:0;--seed-enter-opacity:0;--seed-enter-scale:1}@media (prefers-reduced-motion:reduce){.seed-resizable-panel__panel[data-floating=true][data-side=right][data-state=open]{--seed-enter-translate-x:0}}.seed-resizable-panel__panel[data-floating=true][data-side=right][data-state=closed]{animation:seed-exit;animation-timing-function:cubic-bezier(0.4,0,1,1);animation-duration:.14s;animation-fill-mode:forwards;--seed-exit-translate-x:100%;--seed-exit-translate-y:0;--seed-exit-opacity:0;--seed-exit-scale:1}@media (prefers-reduced-motion:reduce){.seed-resizable-panel__panel[data-floating=true][data-side=right][data-state=closed]{--seed-exit-translate-x:0}}.seed-resizable-panel__inner{height:100%}.seed-resizable-panel__backdrop{position:absolute;inset:0;z-index:19;pointer-events:auto;background:rgba(15,19,32,.32);opacity:0;transition:opacity .16s cubic-bezier(.4, 0, 1, 1)}.seed-resizable-panel__backdrop[data-state=open]{opacity:1;transition-timing-function:cubic-bezier(0.16,1,0.3,1)}.seed-resizable-panel__backdrop[data-state=closed]{opacity:0}.seed-resizable-panel__handle{position:absolute;top:0;width:10px;height:100%;z-index:2;cursor:col-resize;background:0 0;touch-action:none}.seed-resizable-panel__handle[data-side=left]{right:0}.seed-resizable-panel__handle[data-side=right]{left:0}.seed-resizable-panel__handle::before{content:\"\";position:absolute;top:0;width:1px;height:100%;background:var(--seed-color-stroke-neutral-muted);transition:background-color .16s,height .16s}.seed-resizable-panel__handle[data-side=left]::before{right:0}.seed-resizable-panel__handle[data-side=right]::before{left:0}.seed-resizable-panel__handle:hover::before,.seed-resizable-panel__handle[data-dragging]::before{width:2px;background:#0298d9}.seed-resizable-panel__handle.crisp-seed-resizable-panel-handle--column{display:flex;align-items:center;justify-content:center;width:7px;left:-3px;right:-3px;z-index:1;cursor:col-resize}.seed-resizable-panel__handle.crisp-seed-resizable-panel-handle--column::before{content:none}.seed-resizable-panel__handleInner{width:3px;height:100%;border-radius:3px;background:#0298d9;opacity:0;transition:opacity .1s .1s}.seed-resizable-panel__handle:hover .seed-resizable-panel__handleInner,.seed-resizable-panel__handle[data-dragging] .seed-resizable-panel__handleInner{opacity:1}");
|
|
11180
11189
|
|
|
11181
11190
|
const resizablePanelSlotNames = [
|
|
11182
11191
|
[
|
|
@@ -11202,6 +11211,10 @@ const resizablePanelSlotNames = [
|
|
|
11202
11211
|
[
|
|
11203
11212
|
"handleInner",
|
|
11204
11213
|
"seed-resizable-panel__handleInner"
|
|
11214
|
+
],
|
|
11215
|
+
[
|
|
11216
|
+
"backdrop",
|
|
11217
|
+
"seed-resizable-panel__backdrop"
|
|
11205
11218
|
]
|
|
11206
11219
|
];
|
|
11207
11220
|
const defaultVariant$1 = {};
|
|
@@ -11380,26 +11393,20 @@ Object.assign(resizablePanel, {
|
|
|
11380
11393
|
// selector), so this component and that recipe stay in lockstep without a
|
|
11381
11394
|
// second source of truth for the string.
|
|
11382
11395
|
const COLUMN_HANDLE_CLASS = "crisp-seed-resizable-panel-handle--column";
|
|
11383
|
-
// Kept in lock-step with `resizable-panel.ts`'s own `FLOATING_GUTTER` (a
|
|
11384
|
-
// literal there too, for the same reason) -- the floating/inset-card variant
|
|
11385
|
-
// needs an outward-facing gutter that DOCKED never reserves. Read on at
|
|
11386
|
-
// `spacer`'s own render below for why this can't just be one more CSS rule.
|
|
11387
|
-
const FLOATING_GUTTER_PX = 8;
|
|
11388
11396
|
/**
|
|
11389
|
-
* An adjustable-panel primitive
|
|
11390
|
-
*
|
|
11391
|
-
*
|
|
11392
|
-
*
|
|
11393
|
-
*
|
|
11394
|
-
*
|
|
11395
|
-
*
|
|
11396
|
-
*
|
|
11397
|
-
*
|
|
11398
|
-
*
|
|
11399
|
-
*
|
|
11400
|
-
*
|
|
11401
|
-
|
|
11402
|
-
*/ const ResizablePanel = /*#__PURE__*/ React.forwardRef(({ side = "left", width: sizeProp, defaultSize = 280, onWidthChange, min = 200, max, floating = false, handleVariant = "panel", resizable = true, storageKey, animationState, panelElementRef, className, children, ...rest }, forwardedRef)=>{
|
|
11397
|
+
* An adjustable-panel primitive with two layout models (`floating`'s own doc
|
|
11398
|
+
* comment above has the full contrast). Docked: a `spacer` reserves layout
|
|
11399
|
+
* width and the panel overlays exactly that reservation, so a resize drag
|
|
11400
|
+
* never causes a reflow glitch on the rest of the layout. Floating: no
|
|
11401
|
+
* spacer at all -- this component's own outer element becomes a
|
|
11402
|
+
* `position: absolute; inset: 0` overlay reserving zero width, with the
|
|
11403
|
+
* panel itself pinned to one edge and spanning the full height of that box.
|
|
11404
|
+
* Drag the edge handle to resize; constraints are CSS `min-width`/
|
|
11405
|
+
* `max-width`, never re-clamped in JS. Ported from your-moon/crisp's
|
|
11406
|
+
* `ResizablePanel` (`components/resizablepanel/`); state/drag behavior
|
|
11407
|
+
* lives in `useResizablePanel` (`@seed-design/react-resizable-panel`), this
|
|
11408
|
+
* component owns the DOM + recipe classes on top of it.
|
|
11409
|
+
*/ const ResizablePanel = /*#__PURE__*/ React.forwardRef(({ side = "left", width: sizeProp, defaultSize = 280, onWidthChange, min = 200, max, floating = false, backdrop = false, onBackdropClick, handleVariant = "panel", resizable = true, storageKey, animationState, panelElementRef, className, children, ...rest }, forwardedRef)=>{
|
|
11403
11410
|
const { width, dragging, containerRef, panelRef, handleHandlers } = useResizablePanel({
|
|
11404
11411
|
side,
|
|
11405
11412
|
size: sizeProp,
|
|
@@ -11409,27 +11416,12 @@ const FLOATING_GUTTER_PX = 8;
|
|
|
11409
11416
|
});
|
|
11410
11417
|
const composedPanelRef = useComposedRefs(panelRef, panelElementRef);
|
|
11411
11418
|
const classNames = resizablePanel();
|
|
11412
|
-
//
|
|
11413
|
-
//
|
|
11414
|
-
//
|
|
11415
|
-
//
|
|
11416
|
-
// is the RESERVED FOOTPRINT -- what the table beside it actually gives
|
|
11417
|
-
// up -- so the panel's own rendered card shrinks by the gutter INSIDE
|
|
11418
|
-
// that footprint, rather than the footprint growing past it: reserving
|
|
11419
|
-
// the panel's full width AND adding an outward gutter on top of it
|
|
11420
|
-
// over-claims space the surrounding layout was never asked for --
|
|
11421
|
-
// confirmed live, it pushed the whole page 8px into horizontal
|
|
11422
|
-
// overflow. Docked (no gutter) keeps `width` as both the reservation
|
|
11423
|
-
// and the render, as before.
|
|
11424
|
-
const panelGutter = floating ? FLOATING_GUTTER_PX : 0;
|
|
11419
|
+
// Floating spans its full container edge to edge -- no gutter, no
|
|
11420
|
+
// shrink -- so the panel's own size style is the SAME reservation a
|
|
11421
|
+
// docked spacer would use; only whether `spacer` itself renders differs
|
|
11422
|
+
// below.
|
|
11425
11423
|
const maxStyle = max == null ? undefined : typeof max === "number" ? `${max}px` : max;
|
|
11426
|
-
const panelMaxStyle = panelGutter === 0 || maxStyle == null ? maxStyle : `calc(${maxStyle} - ${panelGutter}px)`;
|
|
11427
11424
|
const panelSizeStyle = {
|
|
11428
|
-
width: width - panelGutter,
|
|
11429
|
-
minWidth: min - panelGutter,
|
|
11430
|
-
maxWidth: panelMaxStyle
|
|
11431
|
-
};
|
|
11432
|
-
const spacerSizeStyle = {
|
|
11433
11425
|
width,
|
|
11434
11426
|
minWidth: min,
|
|
11435
11427
|
maxWidth: maxStyle
|
|
@@ -11441,11 +11433,21 @@ const FLOATING_GUTTER_PX = 8;
|
|
|
11441
11433
|
else if (forwardedRef) forwardedRef.current = node;
|
|
11442
11434
|
},
|
|
11443
11435
|
className: clsx(classNames.root, className),
|
|
11436
|
+
"data-floating": floating ? "true" : "false",
|
|
11444
11437
|
...rest,
|
|
11445
11438
|
children: [
|
|
11446
|
-
/*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
11439
|
+
!floating && /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
11447
11440
|
className: classNames.spacer,
|
|
11448
|
-
style:
|
|
11441
|
+
style: {
|
|
11442
|
+
width,
|
|
11443
|
+
minWidth: min,
|
|
11444
|
+
maxWidth: maxStyle
|
|
11445
|
+
}
|
|
11446
|
+
}),
|
|
11447
|
+
floating && backdrop && /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
11448
|
+
className: classNames.backdrop,
|
|
11449
|
+
"data-state": animationState,
|
|
11450
|
+
onClick: onBackdropClick
|
|
11449
11451
|
}),
|
|
11450
11452
|
/*#__PURE__*/ jsxRuntime.jsxs(Primitive.div, {
|
|
11451
11453
|
ref: composedPanelRef,
|
|
@@ -11477,7 +11479,7 @@ const FLOATING_GUTTER_PX = 8;
|
|
|
11477
11479
|
});
|
|
11478
11480
|
ResizablePanel.displayName = "ResizablePanel";
|
|
11479
11481
|
|
|
11480
|
-
__insertCSS(".seed-record-preview__root{display:flex;flex-direction:column;height:100%;overflow:hidden;background:var(--seed-color-bg-layer-default);font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif}.seed-record-preview__toolbar{display:flex;align-items:center;height:49px;flex-shrink:0;padding:8px 10px;border-bottom:1px solid var(--seed-color-stroke-neutral-muted)}.seed-record-preview__toolbarSpacer{flex:1}.seed-record-preview__pager{display:flex;align-items:center;gap:6px;margin-inline-start:12px}.seed-record-preview__counter{margin-inline-start:12px;font-size:12px;font-weight:500;color:var(--seed-color-fg-neutral-subtle);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.seed-record-preview__iconbtn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex-shrink:0;padding:0;border:none;border-radius:6px;background:0 0;color:var(--seed-color-fg-neutral-subtle);font-family:inherit;cursor:pointer;transition:background-color .12s}.seed-record-preview__iconbtn:hover{background:var(--seed-color-bg-layer-fill);color:var(--seed-color-fg-neutral)}.seed-record-preview__navbtn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex-shrink:0;padding:0;border:none;border-radius:6px;background:var(--seed-color-bg-layer-default);box-shadow:inset 0 0 0 1px rgba(0,0,0,.06),0 0 2px rgba(28,40,64,.18),0 1px 3px rgba(0,0,0,.04);color:var(--seed-color-fg-neutral);font-family:inherit;cursor:pointer}.seed-record-preview__navbtn:hover:not(:disabled){background:var(--seed-color-bg-layer-fill)}.seed-record-preview__navbtn:disabled{opacity:.4;cursor:not-allowed}.seed-record-preview__header{display:flex;align-items:center;gap:8px;height:52px;flex-shrink:0;padding:0 12px}.seed-record-preview__fav{width:22px;height:22px;border-radius:4px;flex-shrink:0;object-fit:cover;background:var(--seed-color-bg-layer-fill)}.seed-record-preview__title{flex:1;min-width:0;font-size:16px;font-weight:600;letter-spacing:-.2px;color:var(--seed-color-fg-neutral);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.seed-record-preview__body{flex:1;min-height:0;overflow-y:auto;padding:8px 12px}.seed-record-preview__section{padding:8px 4px 0}.seed-record-preview__sectionHead{display:flex;align-items:center;justify-content:space-between;gap:8px;height:20px;margin-bottom:8px}.seed-record-preview__sectionLabel{font-size:14px;font-weight:500;color:var(--seed-color-fg-neutral-subtle)}.seed-record-preview__sectionAction{border:none;background:0 0;padding:0;font-family:inherit;font-size:10px;font-weight:400;color:color-mix(in srgb,var(--seed-color-fg-neutral) 55%,transparent);cursor:pointer}.seed-record-preview__sectionAction:hover{color:var(--seed-color-fg-neutral)}.seed-record-preview__highlights{display:grid;grid-template-columns:1fr 1fr;gap:8px}.seed-record-preview__highlight{display:flex;flex-direction:column;gap:6px;min-width:0}.seed-record-preview__highlightLabel{display:flex;align-items:center;gap:4px;font-size:12px;font-weight:500;color:var(--seed-color-fg-neutral-subtle)}.seed-record-preview__highlightLabel span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.seed-record-preview__highlightLabel svg{flex-shrink:0;color:var(--seed-color-fg-neutral-subtle)}.seed-record-preview__highlightValue{font-size:14px;font-weight:500;color:var(--seed-color-fg-neutral);overflow:hidden;text-overflow:ellipsis}.seed-record-preview__activity{font-size:14px}.seed-record-preview__sections{display:flex;flex-direction:column;padding-top:8px}.seed-record-preview__sectionTrigger{display:flex;align-items:center;gap:4px;width:100%;height:20px;padding:0 8px 0 12px;border:none;background:0 0;font-family:inherit;text-align:start;cursor:pointer}.seed-record-preview__sectionTrigger[data-inert]{cursor:default}.seed-record-preview__sectionRowLabel{font-size:14px;font-weight:500;color:var(--seed-color-fg-neutral)}.seed-record-preview__sectionRowCount{font-size:14px;color:var(--seed-color-fg-neutral-subtle)}.seed-record-preview__sectionChevron{margin-inline-start:auto;flex-shrink:0;color:var(--seed-color-fg-neutral-subtle);transition:transform .15s ease}.seed-record-preview__sectionChevron[data-open]{transform:rotate(180deg)}.seed-record-preview__sectionContent{padding:8px 8px 8px 12px}.seed-record-preview__footer{flex-shrink:0;display:flex;align-items:center;gap:8px;padding:8px 12px;border-top:1px solid var(--seed-color-stroke-neutral-muted)}");
|
|
11482
|
+
__insertCSS(".seed-record-preview__root{display:flex;flex-direction:column;height:100%;overflow:hidden;background:var(--seed-color-bg-layer-default);font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif}.seed-record-preview__toolbar{display:flex;align-items:center;height:49px;flex-shrink:0;padding:8px 10px;border-bottom:1px solid var(--seed-color-stroke-neutral-muted)}.seed-record-preview__toolbarSpacer{flex:1}.seed-record-preview__pager{display:flex;align-items:center;gap:6px;margin-inline-start:12px}.seed-record-preview__counter{margin-inline-start:12px;font-size:12px;font-weight:500;color:var(--seed-color-fg-neutral-subtle);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.seed-record-preview__iconbtn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex-shrink:0;padding:0;border:none;border-radius:6px;background:0 0;color:var(--seed-color-fg-neutral-subtle);font-family:inherit;cursor:pointer;transition:background-color .12s}.seed-record-preview__iconbtn:hover{background:var(--seed-color-bg-layer-fill);color:var(--seed-color-fg-neutral)}.seed-record-preview__navbtn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex-shrink:0;padding:0;border:none;border-radius:6px;background:var(--seed-color-bg-layer-default);box-shadow:inset 0 0 0 1px rgba(0,0,0,.06),0 0 2px rgba(28,40,64,.18),0 1px 3px rgba(0,0,0,.04);color:var(--seed-color-fg-neutral);font-family:inherit;cursor:pointer}.seed-record-preview__navbtn:hover:not(:disabled){background:var(--seed-color-bg-layer-fill)}.seed-record-preview__navbtn:disabled{opacity:.4;cursor:not-allowed}.seed-record-preview__header{display:flex;align-items:center;gap:8px;height:52px;flex-shrink:0;padding:0 12px}.seed-record-preview__fav{width:22px;height:22px;border-radius:4px;flex-shrink:0;object-fit:cover;background:var(--seed-color-bg-layer-fill)}.seed-record-preview__title{flex:1;min-width:0;font-size:16px;font-weight:600;letter-spacing:-.2px;color:var(--seed-color-fg-neutral);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.seed-record-preview__body{flex:1;min-height:0;overflow-y:auto;padding:8px 12px}.seed-record-preview__section{padding:8px 4px 0}.seed-record-preview__sectionHead{display:flex;align-items:center;justify-content:space-between;gap:8px;height:20px;margin-bottom:8px}.seed-record-preview__sectionLabel{font-size:14px;font-weight:500;color:var(--seed-color-fg-neutral-subtle)}.seed-record-preview__sectionAction{border:none;background:0 0;padding:0;font-family:inherit;font-size:10px;font-weight:400;color:color-mix(in srgb,var(--seed-color-fg-neutral) 55%,transparent);cursor:pointer}.seed-record-preview__sectionAction:hover{color:var(--seed-color-fg-neutral)}.seed-record-preview__highlights{display:grid;grid-template-columns:1fr 1fr;gap:8px}.seed-record-preview__highlight{display:flex;flex-direction:column;gap:6px;min-width:0}.seed-record-preview__highlightLabel{display:flex;align-items:center;gap:4px;font-size:12px;font-weight:500;color:var(--seed-color-fg-neutral-subtle)}.seed-record-preview__highlightLabel span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.seed-record-preview__highlightLabel svg{flex-shrink:0;color:var(--seed-color-fg-neutral-subtle)}.seed-record-preview__highlightValue{font-size:14px;font-weight:500;color:var(--seed-color-fg-neutral);overflow:hidden;text-overflow:ellipsis}.seed-record-preview__activity{font-size:14px}.seed-record-preview__sections{display:flex;flex-direction:column;padding-top:8px}.seed-record-preview__sectionTrigger{display:flex;align-items:center;gap:4px;width:100%;height:20px;padding:0 8px 0 12px;border:none;background:0 0;font-family:inherit;text-align:start;cursor:pointer}.seed-record-preview__sectionTrigger[data-inert]{cursor:default}.seed-record-preview__sectionRowLabel{font-size:14px;font-weight:500;color:var(--seed-color-fg-neutral)}.seed-record-preview__sectionRowCount{font-size:14px;color:var(--seed-color-fg-neutral-subtle)}.seed-record-preview__sectionChevron{margin-inline-start:auto;flex-shrink:0;color:var(--seed-color-fg-neutral-subtle);transition:transform .15s ease}.seed-record-preview__sectionChevron[data-open]{transform:rotate(180deg)}.seed-record-preview__sectionContent{padding:8px 8px 8px 12px}.seed-record-preview__footer{flex-shrink:0;display:flex;align-items:center;gap:8px;padding:8px 12px;border-top:1px solid var(--seed-color-stroke-neutral-muted)}.seed-record-preview__tabsRoot{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.seed-record-preview__tabPanel{flex:1;min-height:0;overflow-y:auto;padding:8px 12px}.seed-record-preview__tabBadge{margin-inline-start:6px}");
|
|
11481
11483
|
|
|
11482
11484
|
const recordPreviewSlotNames = [
|
|
11483
11485
|
[
|
|
@@ -11587,6 +11589,18 @@ const recordPreviewSlotNames = [
|
|
|
11587
11589
|
[
|
|
11588
11590
|
"footer",
|
|
11589
11591
|
"seed-record-preview__footer"
|
|
11592
|
+
],
|
|
11593
|
+
[
|
|
11594
|
+
"tabsRoot",
|
|
11595
|
+
"seed-record-preview__tabsRoot"
|
|
11596
|
+
],
|
|
11597
|
+
[
|
|
11598
|
+
"tabPanel",
|
|
11599
|
+
"seed-record-preview__tabPanel"
|
|
11600
|
+
],
|
|
11601
|
+
[
|
|
11602
|
+
"tabBadge",
|
|
11603
|
+
"seed-record-preview__tabBadge"
|
|
11590
11604
|
]
|
|
11591
11605
|
];
|
|
11592
11606
|
const defaultVariant = {};
|
|
@@ -11748,71 +11762,2725 @@ function useStateMachine(initialState, machine) {
|
|
|
11748
11762
|
const PresenceContext = /*#__PURE__*/ React.createContext(null);
|
|
11749
11763
|
PresenceContext.Provider;
|
|
11750
11764
|
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
* area and an Activity feed (measured live). Ported from your-moon/crisp's
|
|
11756
|
-
* `RecordPanel` (`product/recordpanel/`), built ON `ResizablePanel`
|
|
11757
|
-
* (`side="right" floating`) rather than crisp's own duplicate absolute-
|
|
11758
|
-
* positioning/slide-in/resize-handle implementation -- the outer shell (the
|
|
11759
|
-
* enter/exit keyframe animation, the floating elevation, the drag handle
|
|
11760
|
-
* itself) all come from that primitive; this component only renders the
|
|
11761
|
-
* CONTENT inside it.
|
|
11762
|
-
*
|
|
11763
|
-
* Enter/exit: closing this panel is a state change (`open` -> false) that
|
|
11764
|
-
* typically clears `record` in the SAME update (see the DataTable story's
|
|
11765
|
-
* own `onClose={() => setPreviewRow(null)}`), so by the time an exit
|
|
11766
|
-
* animation should play, the values this component would render are
|
|
11767
|
-
* already gone. `usePresence` (`@seed-design/react-presence`, the same
|
|
11768
|
-
* idiom Dialog/Drawer already use for their own floating layers) keeps the
|
|
11769
|
-
* tree mounted for exactly the exit animation's duration; the snapshot
|
|
11770
|
-
* below keeps the LAST visible props around for that same window, since
|
|
11771
|
-
* without it the panel would animate out empty.
|
|
11772
|
-
*/ function RecordPreview(props) {
|
|
11773
|
-
const shouldRender = props.open && props.record != null;
|
|
11774
|
-
const { isPresent, ref: panelElementRef } = usePresence(shouldRender);
|
|
11775
|
-
const lastVisiblePropsRef = React.useRef(props);
|
|
11776
|
-
if (shouldRender) lastVisiblePropsRef.current = props;
|
|
11777
|
-
if (!isPresent) return null;
|
|
11778
|
-
return /*#__PURE__*/ jsxRuntime.jsx(RecordPreviewPanel, {
|
|
11779
|
-
...shouldRender ? props : lastVisiblePropsRef.current,
|
|
11780
|
-
animationState: shouldRender ? "open" : "closed",
|
|
11781
|
-
panelElementRef: panelElementRef
|
|
11765
|
+
var __defProp$1 = Object.defineProperty;
|
|
11766
|
+
var __name$1 = (target, value)=>__defProp$1(target, "name", {
|
|
11767
|
+
value,
|
|
11768
|
+
configurable: true
|
|
11782
11769
|
});
|
|
11770
|
+
function useSize(element) {
|
|
11771
|
+
const [size, setSize] = React__namespace.useState(void 0);
|
|
11772
|
+
useLayoutEffect2(()=>{
|
|
11773
|
+
if (element) {
|
|
11774
|
+
setSize({
|
|
11775
|
+
width: element.offsetWidth,
|
|
11776
|
+
height: element.offsetHeight
|
|
11777
|
+
});
|
|
11778
|
+
const resizeObserver = new ResizeObserver((entries)=>{
|
|
11779
|
+
if (!Array.isArray(entries)) {
|
|
11780
|
+
return;
|
|
11781
|
+
}
|
|
11782
|
+
if (!entries.length) {
|
|
11783
|
+
return;
|
|
11784
|
+
}
|
|
11785
|
+
const entry = entries[0];
|
|
11786
|
+
let width;
|
|
11787
|
+
let height;
|
|
11788
|
+
if ("borderBoxSize" in entry) {
|
|
11789
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
11790
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
11791
|
+
width = borderSize["inlineSize"];
|
|
11792
|
+
height = borderSize["blockSize"];
|
|
11793
|
+
} else {
|
|
11794
|
+
width = element.offsetWidth;
|
|
11795
|
+
height = element.offsetHeight;
|
|
11796
|
+
}
|
|
11797
|
+
setSize({
|
|
11798
|
+
width,
|
|
11799
|
+
height
|
|
11800
|
+
});
|
|
11801
|
+
});
|
|
11802
|
+
resizeObserver.observe(element, {
|
|
11803
|
+
box: "border-box"
|
|
11804
|
+
});
|
|
11805
|
+
return ()=>resizeObserver.unobserve(element);
|
|
11806
|
+
} else {
|
|
11807
|
+
setSize(void 0);
|
|
11808
|
+
}
|
|
11809
|
+
}, [
|
|
11810
|
+
element
|
|
11811
|
+
]);
|
|
11812
|
+
return size;
|
|
11783
11813
|
}
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
const
|
|
11788
|
-
// Which sections (your-moon/crisp#413) are expanded -- uncontrolled and
|
|
11789
|
-
// independent (Attio's own Emails/Notes/Tasks open without closing one
|
|
11790
|
-
// another): a plain `Set`, reset whenever the record itself changes so a
|
|
11791
|
-
// stale open section doesn't carry over between two different records.
|
|
11792
|
-
const [openSections, setOpenSections] = React.useState(()=>new Set());
|
|
11793
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: `record` is read as a change TRIGGER, not a value the effect body needs -- reset whenever it changes identity, regardless of what it now points to.
|
|
11814
|
+
__name$1(useSize, "useSize");
|
|
11815
|
+
|
|
11816
|
+
function useSupports(selector) {
|
|
11817
|
+
const [isSupported, setIsSupported] = React.useState(null);
|
|
11794
11818
|
React.useEffect(()=>{
|
|
11795
|
-
|
|
11819
|
+
setIsSupported(CSS.supports(selector));
|
|
11796
11820
|
}, [
|
|
11797
|
-
|
|
11821
|
+
selector
|
|
11798
11822
|
]);
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11823
|
+
return isSupported;
|
|
11824
|
+
}
|
|
11825
|
+
|
|
11826
|
+
var __defProp = Object.defineProperty;
|
|
11827
|
+
var __name = (target, value)=>__defProp(target, "name", {
|
|
11828
|
+
value,
|
|
11829
|
+
configurable: true
|
|
11830
|
+
});
|
|
11831
|
+
function useCallbackRef(callback) {
|
|
11832
|
+
const callbackRef = React__namespace.useRef(callback);
|
|
11833
|
+
React__namespace.useEffect(()=>{
|
|
11834
|
+
callbackRef.current = callback;
|
|
11835
|
+
});
|
|
11836
|
+
return React__namespace.useMemo(()=>(...args)=>callbackRef.current?.(...args), []);
|
|
11837
|
+
}
|
|
11838
|
+
__name(useCallbackRef, "useCallbackRef");
|
|
11839
|
+
|
|
11840
|
+
function AutoHeight(userOptions = {}) {
|
|
11841
|
+
let emblaApi;
|
|
11842
|
+
let slideHeights = [];
|
|
11843
|
+
const heightEvents = [
|
|
11844
|
+
'select',
|
|
11845
|
+
'slideFocus'
|
|
11846
|
+
];
|
|
11847
|
+
function init(emblaApiInstance) {
|
|
11848
|
+
emblaApi = emblaApiInstance;
|
|
11849
|
+
const { options: { axis }, slideRects } = emblaApi.internalEngine();
|
|
11850
|
+
if (axis === 'y') return;
|
|
11851
|
+
slideHeights = slideRects.map((slideRect)=>slideRect.height);
|
|
11852
|
+
heightEvents.forEach((evt)=>emblaApi.on(evt, setContainerHeight));
|
|
11853
|
+
setContainerHeight();
|
|
11854
|
+
}
|
|
11855
|
+
function destroy() {
|
|
11856
|
+
heightEvents.forEach((evt)=>emblaApi.off(evt, setContainerHeight));
|
|
11857
|
+
const container = emblaApi.containerNode();
|
|
11858
|
+
container.style.height = '';
|
|
11859
|
+
if (!container.getAttribute('style')) container.removeAttribute('style');
|
|
11860
|
+
}
|
|
11861
|
+
function highestInView() {
|
|
11862
|
+
const { slideRegistry } = emblaApi.internalEngine();
|
|
11863
|
+
const selectedIndexes = slideRegistry[emblaApi.selectedScrollSnap()];
|
|
11864
|
+
if (!selectedIndexes) return null;
|
|
11865
|
+
return selectedIndexes.map((index)=>slideHeights[index]).reduce((a, b)=>Math.max(a, b), 0);
|
|
11866
|
+
}
|
|
11867
|
+
function setContainerHeight() {
|
|
11868
|
+
const height = highestInView();
|
|
11869
|
+
if (height === null) return;
|
|
11870
|
+
emblaApi.containerNode().style.height = `${highestInView()}px`;
|
|
11871
|
+
}
|
|
11872
|
+
const self = {
|
|
11873
|
+
name: 'autoHeight',
|
|
11874
|
+
options: userOptions,
|
|
11875
|
+
init,
|
|
11876
|
+
destroy
|
|
11877
|
+
};
|
|
11878
|
+
return self;
|
|
11879
|
+
}
|
|
11880
|
+
AutoHeight.globalOptions = undefined;
|
|
11881
|
+
|
|
11882
|
+
function isObject$1(subject) {
|
|
11883
|
+
return Object.prototype.toString.call(subject) === '[object Object]';
|
|
11884
|
+
}
|
|
11885
|
+
function isRecord(subject) {
|
|
11886
|
+
return isObject$1(subject) || Array.isArray(subject);
|
|
11887
|
+
}
|
|
11888
|
+
function canUseDOM() {
|
|
11889
|
+
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
11890
|
+
}
|
|
11891
|
+
function areOptionsEqual(optionsA, optionsB) {
|
|
11892
|
+
const optionsAKeys = Object.keys(optionsA);
|
|
11893
|
+
const optionsBKeys = Object.keys(optionsB);
|
|
11894
|
+
if (optionsAKeys.length !== optionsBKeys.length) return false;
|
|
11895
|
+
const breakpointsA = JSON.stringify(Object.keys(optionsA.breakpoints || {}));
|
|
11896
|
+
const breakpointsB = JSON.stringify(Object.keys(optionsB.breakpoints || {}));
|
|
11897
|
+
if (breakpointsA !== breakpointsB) return false;
|
|
11898
|
+
return optionsAKeys.every((key)=>{
|
|
11899
|
+
const valueA = optionsA[key];
|
|
11900
|
+
const valueB = optionsB[key];
|
|
11901
|
+
if (typeof valueA === 'function') return `${valueA}` === `${valueB}`;
|
|
11902
|
+
if (!isRecord(valueA) || !isRecord(valueB)) return valueA === valueB;
|
|
11903
|
+
return areOptionsEqual(valueA, valueB);
|
|
11904
|
+
});
|
|
11905
|
+
}
|
|
11906
|
+
function sortAndMapPluginToOptions(plugins) {
|
|
11907
|
+
return plugins.concat().sort((a, b)=>a.name > b.name ? 1 : -1).map((plugin)=>plugin.options);
|
|
11908
|
+
}
|
|
11909
|
+
function arePluginsEqual(pluginsA, pluginsB) {
|
|
11910
|
+
if (pluginsA.length !== pluginsB.length) return false;
|
|
11911
|
+
const optionsA = sortAndMapPluginToOptions(pluginsA);
|
|
11912
|
+
const optionsB = sortAndMapPluginToOptions(pluginsB);
|
|
11913
|
+
return optionsA.every((optionA, index)=>{
|
|
11914
|
+
const optionB = optionsB[index];
|
|
11915
|
+
return areOptionsEqual(optionA, optionB);
|
|
11916
|
+
});
|
|
11917
|
+
}
|
|
11918
|
+
|
|
11919
|
+
function isNumber(subject) {
|
|
11920
|
+
return typeof subject === 'number';
|
|
11921
|
+
}
|
|
11922
|
+
function isString(subject) {
|
|
11923
|
+
return typeof subject === 'string';
|
|
11924
|
+
}
|
|
11925
|
+
function isBoolean(subject) {
|
|
11926
|
+
return typeof subject === 'boolean';
|
|
11927
|
+
}
|
|
11928
|
+
function isObject(subject) {
|
|
11929
|
+
return Object.prototype.toString.call(subject) === '[object Object]';
|
|
11930
|
+
}
|
|
11931
|
+
function mathAbs(n) {
|
|
11932
|
+
return Math.abs(n);
|
|
11933
|
+
}
|
|
11934
|
+
function mathSign(n) {
|
|
11935
|
+
return Math.sign(n);
|
|
11936
|
+
}
|
|
11937
|
+
function deltaAbs(valueB, valueA) {
|
|
11938
|
+
return mathAbs(valueB - valueA);
|
|
11939
|
+
}
|
|
11940
|
+
function factorAbs(valueB, valueA) {
|
|
11941
|
+
if (valueB === 0 || valueA === 0) return 0;
|
|
11942
|
+
if (mathAbs(valueB) <= mathAbs(valueA)) return 0;
|
|
11943
|
+
const diff = deltaAbs(mathAbs(valueB), mathAbs(valueA));
|
|
11944
|
+
return mathAbs(diff / valueB);
|
|
11945
|
+
}
|
|
11946
|
+
function roundToTwoDecimals(num) {
|
|
11947
|
+
return Math.round(num * 100) / 100;
|
|
11948
|
+
}
|
|
11949
|
+
function arrayKeys(array) {
|
|
11950
|
+
return objectKeys(array).map(Number);
|
|
11951
|
+
}
|
|
11952
|
+
function arrayLast(array) {
|
|
11953
|
+
return array[arrayLastIndex(array)];
|
|
11954
|
+
}
|
|
11955
|
+
function arrayLastIndex(array) {
|
|
11956
|
+
return Math.max(0, array.length - 1);
|
|
11957
|
+
}
|
|
11958
|
+
function arrayIsLastIndex(array, index) {
|
|
11959
|
+
return index === arrayLastIndex(array);
|
|
11960
|
+
}
|
|
11961
|
+
function arrayFromNumber(n, startAt = 0) {
|
|
11962
|
+
return Array.from(Array(n), (_, i)=>startAt + i);
|
|
11963
|
+
}
|
|
11964
|
+
function objectKeys(object) {
|
|
11965
|
+
return Object.keys(object);
|
|
11966
|
+
}
|
|
11967
|
+
function objectsMergeDeep(objectA, objectB) {
|
|
11968
|
+
return [
|
|
11969
|
+
objectA,
|
|
11970
|
+
objectB
|
|
11971
|
+
].reduce((mergedObjects, currentObject)=>{
|
|
11972
|
+
objectKeys(currentObject).forEach((key)=>{
|
|
11973
|
+
const valueA = mergedObjects[key];
|
|
11974
|
+
const valueB = currentObject[key];
|
|
11975
|
+
const areObjects = isObject(valueA) && isObject(valueB);
|
|
11976
|
+
mergedObjects[key] = areObjects ? objectsMergeDeep(valueA, valueB) : valueB;
|
|
11804
11977
|
});
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11978
|
+
return mergedObjects;
|
|
11979
|
+
}, {});
|
|
11980
|
+
}
|
|
11981
|
+
function isMouseEvent(evt, ownerWindow) {
|
|
11982
|
+
return typeof ownerWindow.MouseEvent !== 'undefined' && evt instanceof ownerWindow.MouseEvent;
|
|
11983
|
+
}
|
|
11984
|
+
function Alignment(align, viewSize) {
|
|
11985
|
+
const predefined = {
|
|
11986
|
+
start,
|
|
11987
|
+
center,
|
|
11988
|
+
end
|
|
11989
|
+
};
|
|
11990
|
+
function start() {
|
|
11991
|
+
return 0;
|
|
11992
|
+
}
|
|
11993
|
+
function center(n) {
|
|
11994
|
+
return end(n) / 2;
|
|
11995
|
+
}
|
|
11996
|
+
function end(n) {
|
|
11997
|
+
return viewSize - n;
|
|
11998
|
+
}
|
|
11999
|
+
function measure(n, index) {
|
|
12000
|
+
if (isString(align)) return predefined[align](n);
|
|
12001
|
+
return align(viewSize, n, index);
|
|
12002
|
+
}
|
|
12003
|
+
const self = {
|
|
12004
|
+
measure
|
|
12005
|
+
};
|
|
12006
|
+
return self;
|
|
12007
|
+
}
|
|
12008
|
+
function EventStore() {
|
|
12009
|
+
let listeners = [];
|
|
12010
|
+
function add(node, type, handler, options = {
|
|
12011
|
+
passive: true
|
|
12012
|
+
}) {
|
|
12013
|
+
let removeListener;
|
|
12014
|
+
if ('addEventListener' in node) {
|
|
12015
|
+
node.addEventListener(type, handler, options);
|
|
12016
|
+
removeListener = ()=>node.removeEventListener(type, handler, options);
|
|
12017
|
+
} else {
|
|
12018
|
+
const legacyMediaQueryList = node;
|
|
12019
|
+
legacyMediaQueryList.addListener(handler);
|
|
12020
|
+
removeListener = ()=>legacyMediaQueryList.removeListener(handler);
|
|
12021
|
+
}
|
|
12022
|
+
listeners.push(removeListener);
|
|
12023
|
+
return self;
|
|
12024
|
+
}
|
|
12025
|
+
function clear() {
|
|
12026
|
+
listeners = listeners.filter((remove)=>remove());
|
|
12027
|
+
}
|
|
12028
|
+
const self = {
|
|
12029
|
+
add,
|
|
12030
|
+
clear
|
|
12031
|
+
};
|
|
12032
|
+
return self;
|
|
12033
|
+
}
|
|
12034
|
+
function Animations(ownerDocument, ownerWindow, update, render) {
|
|
12035
|
+
const documentVisibleHandler = EventStore();
|
|
12036
|
+
const fixedTimeStep = 1000 / 60;
|
|
12037
|
+
let lastTimeStamp = null;
|
|
12038
|
+
let accumulatedTime = 0;
|
|
12039
|
+
let animationId = 0;
|
|
12040
|
+
function init() {
|
|
12041
|
+
documentVisibleHandler.add(ownerDocument, 'visibilitychange', ()=>{
|
|
12042
|
+
if (ownerDocument.hidden) reset();
|
|
12043
|
+
});
|
|
12044
|
+
}
|
|
12045
|
+
function destroy() {
|
|
12046
|
+
stop();
|
|
12047
|
+
documentVisibleHandler.clear();
|
|
12048
|
+
}
|
|
12049
|
+
function animate(timeStamp) {
|
|
12050
|
+
if (!animationId) return;
|
|
12051
|
+
if (!lastTimeStamp) {
|
|
12052
|
+
lastTimeStamp = timeStamp;
|
|
12053
|
+
update();
|
|
12054
|
+
update();
|
|
12055
|
+
}
|
|
12056
|
+
const timeElapsed = timeStamp - lastTimeStamp;
|
|
12057
|
+
lastTimeStamp = timeStamp;
|
|
12058
|
+
accumulatedTime += timeElapsed;
|
|
12059
|
+
while(accumulatedTime >= fixedTimeStep){
|
|
12060
|
+
update();
|
|
12061
|
+
accumulatedTime -= fixedTimeStep;
|
|
12062
|
+
}
|
|
12063
|
+
const alpha = accumulatedTime / fixedTimeStep;
|
|
12064
|
+
render(alpha);
|
|
12065
|
+
if (animationId) {
|
|
12066
|
+
animationId = ownerWindow.requestAnimationFrame(animate);
|
|
12067
|
+
}
|
|
12068
|
+
}
|
|
12069
|
+
function start() {
|
|
12070
|
+
if (animationId) return;
|
|
12071
|
+
animationId = ownerWindow.requestAnimationFrame(animate);
|
|
12072
|
+
}
|
|
12073
|
+
function stop() {
|
|
12074
|
+
ownerWindow.cancelAnimationFrame(animationId);
|
|
12075
|
+
lastTimeStamp = null;
|
|
12076
|
+
accumulatedTime = 0;
|
|
12077
|
+
animationId = 0;
|
|
12078
|
+
}
|
|
12079
|
+
function reset() {
|
|
12080
|
+
lastTimeStamp = null;
|
|
12081
|
+
accumulatedTime = 0;
|
|
12082
|
+
}
|
|
12083
|
+
const self = {
|
|
12084
|
+
init,
|
|
12085
|
+
destroy,
|
|
12086
|
+
start,
|
|
12087
|
+
stop,
|
|
12088
|
+
update,
|
|
12089
|
+
render
|
|
12090
|
+
};
|
|
12091
|
+
return self;
|
|
12092
|
+
}
|
|
12093
|
+
function Axis(axis, contentDirection) {
|
|
12094
|
+
const isRightToLeft = contentDirection === 'rtl';
|
|
12095
|
+
const isVertical = axis === 'y';
|
|
12096
|
+
const scroll = isVertical ? 'y' : 'x';
|
|
12097
|
+
const cross = isVertical ? 'x' : 'y';
|
|
12098
|
+
const sign = !isVertical && isRightToLeft ? -1 : 1;
|
|
12099
|
+
const startEdge = getStartEdge();
|
|
12100
|
+
const endEdge = getEndEdge();
|
|
12101
|
+
function measureSize(nodeRect) {
|
|
12102
|
+
const { height, width } = nodeRect;
|
|
12103
|
+
return isVertical ? height : width;
|
|
12104
|
+
}
|
|
12105
|
+
function getStartEdge() {
|
|
12106
|
+
if (isVertical) return 'top';
|
|
12107
|
+
return isRightToLeft ? 'right' : 'left';
|
|
12108
|
+
}
|
|
12109
|
+
function getEndEdge() {
|
|
12110
|
+
if (isVertical) return 'bottom';
|
|
12111
|
+
return isRightToLeft ? 'left' : 'right';
|
|
12112
|
+
}
|
|
12113
|
+
function direction(n) {
|
|
12114
|
+
return n * sign;
|
|
12115
|
+
}
|
|
12116
|
+
const self = {
|
|
12117
|
+
scroll,
|
|
12118
|
+
cross,
|
|
12119
|
+
startEdge,
|
|
12120
|
+
endEdge,
|
|
12121
|
+
measureSize,
|
|
12122
|
+
direction
|
|
12123
|
+
};
|
|
12124
|
+
return self;
|
|
12125
|
+
}
|
|
12126
|
+
function Limit(min = 0, max = 0) {
|
|
12127
|
+
const length = mathAbs(min - max);
|
|
12128
|
+
function reachedMin(n) {
|
|
12129
|
+
return n < min;
|
|
12130
|
+
}
|
|
12131
|
+
function reachedMax(n) {
|
|
12132
|
+
return n > max;
|
|
12133
|
+
}
|
|
12134
|
+
function reachedAny(n) {
|
|
12135
|
+
return reachedMin(n) || reachedMax(n);
|
|
12136
|
+
}
|
|
12137
|
+
function constrain(n) {
|
|
12138
|
+
if (!reachedAny(n)) return n;
|
|
12139
|
+
return reachedMin(n) ? min : max;
|
|
12140
|
+
}
|
|
12141
|
+
function removeOffset(n) {
|
|
12142
|
+
if (!length) return n;
|
|
12143
|
+
return n - length * Math.ceil((n - max) / length);
|
|
12144
|
+
}
|
|
12145
|
+
const self = {
|
|
12146
|
+
length,
|
|
12147
|
+
max,
|
|
12148
|
+
min,
|
|
12149
|
+
constrain,
|
|
12150
|
+
reachedAny,
|
|
12151
|
+
reachedMax,
|
|
12152
|
+
reachedMin,
|
|
12153
|
+
removeOffset
|
|
12154
|
+
};
|
|
12155
|
+
return self;
|
|
12156
|
+
}
|
|
12157
|
+
function Counter(max, start, loop) {
|
|
12158
|
+
const { constrain } = Limit(0, max);
|
|
12159
|
+
const loopEnd = max + 1;
|
|
12160
|
+
let counter = withinLimit(start);
|
|
12161
|
+
function withinLimit(n) {
|
|
12162
|
+
return !loop ? constrain(n) : mathAbs((loopEnd + n) % loopEnd);
|
|
12163
|
+
}
|
|
12164
|
+
function get() {
|
|
12165
|
+
return counter;
|
|
12166
|
+
}
|
|
12167
|
+
function set(n) {
|
|
12168
|
+
counter = withinLimit(n);
|
|
12169
|
+
return self;
|
|
12170
|
+
}
|
|
12171
|
+
function add(n) {
|
|
12172
|
+
return clone().set(get() + n);
|
|
12173
|
+
}
|
|
12174
|
+
function clone() {
|
|
12175
|
+
return Counter(max, get(), loop);
|
|
12176
|
+
}
|
|
12177
|
+
const self = {
|
|
12178
|
+
get,
|
|
12179
|
+
set,
|
|
12180
|
+
add,
|
|
12181
|
+
clone
|
|
12182
|
+
};
|
|
12183
|
+
return self;
|
|
12184
|
+
}
|
|
12185
|
+
function DragHandler(axis, rootNode, ownerDocument, ownerWindow, target, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, baseFriction, watchDrag) {
|
|
12186
|
+
const { cross: crossAxis, direction } = axis;
|
|
12187
|
+
const focusNodes = [
|
|
12188
|
+
'INPUT',
|
|
12189
|
+
'SELECT',
|
|
12190
|
+
'TEXTAREA'
|
|
12191
|
+
];
|
|
12192
|
+
const nonPassiveEvent = {
|
|
12193
|
+
passive: false
|
|
12194
|
+
};
|
|
12195
|
+
const initEvents = EventStore();
|
|
12196
|
+
const dragEvents = EventStore();
|
|
12197
|
+
const goToNextThreshold = Limit(50, 225).constrain(percentOfView.measure(20));
|
|
12198
|
+
const snapForceBoost = {
|
|
12199
|
+
mouse: 300,
|
|
12200
|
+
touch: 400
|
|
12201
|
+
};
|
|
12202
|
+
const freeForceBoost = {
|
|
12203
|
+
mouse: 500,
|
|
12204
|
+
touch: 600
|
|
12205
|
+
};
|
|
12206
|
+
const baseSpeed = dragFree ? 43 : 25;
|
|
12207
|
+
let isMoving = false;
|
|
12208
|
+
let startScroll = 0;
|
|
12209
|
+
let startCross = 0;
|
|
12210
|
+
let pointerIsDown = false;
|
|
12211
|
+
let preventScroll = false;
|
|
12212
|
+
let preventClick = false;
|
|
12213
|
+
let isMouse = false;
|
|
12214
|
+
function init(emblaApi) {
|
|
12215
|
+
if (!watchDrag) return;
|
|
12216
|
+
function downIfAllowed(evt) {
|
|
12217
|
+
if (isBoolean(watchDrag) || watchDrag(emblaApi, evt)) down(evt);
|
|
12218
|
+
}
|
|
12219
|
+
const node = rootNode;
|
|
12220
|
+
initEvents.add(node, 'dragstart', (evt)=>evt.preventDefault(), nonPassiveEvent).add(node, 'touchmove', ()=>undefined, nonPassiveEvent).add(node, 'touchend', ()=>undefined).add(node, 'touchstart', downIfAllowed).add(node, 'mousedown', downIfAllowed).add(node, 'touchcancel', up).add(node, 'contextmenu', up).add(node, 'click', click, true);
|
|
12221
|
+
}
|
|
12222
|
+
function destroy() {
|
|
12223
|
+
initEvents.clear();
|
|
12224
|
+
dragEvents.clear();
|
|
12225
|
+
}
|
|
12226
|
+
function addDragEvents() {
|
|
12227
|
+
const node = isMouse ? ownerDocument : rootNode;
|
|
12228
|
+
dragEvents.add(node, 'touchmove', move, nonPassiveEvent).add(node, 'touchend', up).add(node, 'mousemove', move, nonPassiveEvent).add(node, 'mouseup', up);
|
|
12229
|
+
}
|
|
12230
|
+
function isFocusNode(node) {
|
|
12231
|
+
const nodeName = node.nodeName || '';
|
|
12232
|
+
return focusNodes.includes(nodeName);
|
|
12233
|
+
}
|
|
12234
|
+
function forceBoost() {
|
|
12235
|
+
const boost = dragFree ? freeForceBoost : snapForceBoost;
|
|
12236
|
+
const type = isMouse ? 'mouse' : 'touch';
|
|
12237
|
+
return boost[type];
|
|
12238
|
+
}
|
|
12239
|
+
function allowedForce(force, targetChanged) {
|
|
12240
|
+
const next = index.add(mathSign(force) * -1);
|
|
12241
|
+
const baseForce = scrollTarget.byDistance(force, !dragFree).distance;
|
|
12242
|
+
if (dragFree || mathAbs(force) < goToNextThreshold) return baseForce;
|
|
12243
|
+
if (skipSnaps && targetChanged) return baseForce * 0.5;
|
|
12244
|
+
return scrollTarget.byIndex(next.get(), 0).distance;
|
|
12245
|
+
}
|
|
12246
|
+
function down(evt) {
|
|
12247
|
+
const isMouseEvt = isMouseEvent(evt, ownerWindow);
|
|
12248
|
+
isMouse = isMouseEvt;
|
|
12249
|
+
preventClick = dragFree && isMouseEvt && !evt.buttons && isMoving;
|
|
12250
|
+
isMoving = deltaAbs(target.get(), location.get()) >= 2;
|
|
12251
|
+
if (isMouseEvt && evt.button !== 0) return;
|
|
12252
|
+
if (isFocusNode(evt.target)) return;
|
|
12253
|
+
pointerIsDown = true;
|
|
12254
|
+
dragTracker.pointerDown(evt);
|
|
12255
|
+
scrollBody.useFriction(0).useDuration(0);
|
|
12256
|
+
target.set(location);
|
|
12257
|
+
addDragEvents();
|
|
12258
|
+
startScroll = dragTracker.readPoint(evt);
|
|
12259
|
+
startCross = dragTracker.readPoint(evt, crossAxis);
|
|
12260
|
+
eventHandler.emit('pointerDown');
|
|
12261
|
+
}
|
|
12262
|
+
function move(evt) {
|
|
12263
|
+
const isTouchEvt = !isMouseEvent(evt, ownerWindow);
|
|
12264
|
+
if (isTouchEvt && evt.touches.length >= 2) return up(evt);
|
|
12265
|
+
const lastScroll = dragTracker.readPoint(evt);
|
|
12266
|
+
const lastCross = dragTracker.readPoint(evt, crossAxis);
|
|
12267
|
+
const diffScroll = deltaAbs(lastScroll, startScroll);
|
|
12268
|
+
const diffCross = deltaAbs(lastCross, startCross);
|
|
12269
|
+
if (!preventScroll && !isMouse) {
|
|
12270
|
+
if (!evt.cancelable) return up(evt);
|
|
12271
|
+
preventScroll = diffScroll > diffCross;
|
|
12272
|
+
if (!preventScroll) return up(evt);
|
|
12273
|
+
}
|
|
12274
|
+
const diff = dragTracker.pointerMove(evt);
|
|
12275
|
+
if (diffScroll > dragThreshold) preventClick = true;
|
|
12276
|
+
scrollBody.useFriction(0.3).useDuration(0.75);
|
|
12277
|
+
animation.start();
|
|
12278
|
+
target.add(direction(diff));
|
|
12279
|
+
evt.preventDefault();
|
|
12280
|
+
}
|
|
12281
|
+
function up(evt) {
|
|
12282
|
+
const currentLocation = scrollTarget.byDistance(0, false);
|
|
12283
|
+
const targetChanged = currentLocation.index !== index.get();
|
|
12284
|
+
const rawForce = dragTracker.pointerUp(evt) * forceBoost();
|
|
12285
|
+
const force = allowedForce(direction(rawForce), targetChanged);
|
|
12286
|
+
const forceFactor = factorAbs(rawForce, force);
|
|
12287
|
+
const speed = baseSpeed - 10 * forceFactor;
|
|
12288
|
+
const friction = baseFriction + forceFactor / 50;
|
|
12289
|
+
preventScroll = false;
|
|
12290
|
+
pointerIsDown = false;
|
|
12291
|
+
dragEvents.clear();
|
|
12292
|
+
scrollBody.useDuration(speed).useFriction(friction);
|
|
12293
|
+
scrollTo.distance(force, !dragFree);
|
|
12294
|
+
isMouse = false;
|
|
12295
|
+
eventHandler.emit('pointerUp');
|
|
12296
|
+
}
|
|
12297
|
+
function click(evt) {
|
|
12298
|
+
if (preventClick) {
|
|
12299
|
+
evt.stopPropagation();
|
|
12300
|
+
evt.preventDefault();
|
|
12301
|
+
preventClick = false;
|
|
12302
|
+
}
|
|
12303
|
+
}
|
|
12304
|
+
function pointerDown() {
|
|
12305
|
+
return pointerIsDown;
|
|
12306
|
+
}
|
|
12307
|
+
const self = {
|
|
12308
|
+
init,
|
|
12309
|
+
destroy,
|
|
12310
|
+
pointerDown
|
|
12311
|
+
};
|
|
12312
|
+
return self;
|
|
12313
|
+
}
|
|
12314
|
+
function DragTracker(axis, ownerWindow) {
|
|
12315
|
+
const logInterval = 170;
|
|
12316
|
+
let startEvent;
|
|
12317
|
+
let lastEvent;
|
|
12318
|
+
function readTime(evt) {
|
|
12319
|
+
return evt.timeStamp;
|
|
12320
|
+
}
|
|
12321
|
+
function readPoint(evt, evtAxis) {
|
|
12322
|
+
const property = evtAxis || axis.scroll;
|
|
12323
|
+
const coord = `client${property === 'x' ? 'X' : 'Y'}`;
|
|
12324
|
+
return (isMouseEvent(evt, ownerWindow) ? evt : evt.touches[0])[coord];
|
|
12325
|
+
}
|
|
12326
|
+
function pointerDown(evt) {
|
|
12327
|
+
startEvent = evt;
|
|
12328
|
+
lastEvent = evt;
|
|
12329
|
+
return readPoint(evt);
|
|
12330
|
+
}
|
|
12331
|
+
function pointerMove(evt) {
|
|
12332
|
+
const diff = readPoint(evt) - readPoint(lastEvent);
|
|
12333
|
+
const expired = readTime(evt) - readTime(startEvent) > logInterval;
|
|
12334
|
+
lastEvent = evt;
|
|
12335
|
+
if (expired) startEvent = evt;
|
|
12336
|
+
return diff;
|
|
12337
|
+
}
|
|
12338
|
+
function pointerUp(evt) {
|
|
12339
|
+
if (!startEvent || !lastEvent) return 0;
|
|
12340
|
+
const diffDrag = readPoint(lastEvent) - readPoint(startEvent);
|
|
12341
|
+
const diffTime = readTime(evt) - readTime(startEvent);
|
|
12342
|
+
const expired = readTime(evt) - readTime(lastEvent) > logInterval;
|
|
12343
|
+
const force = diffDrag / diffTime;
|
|
12344
|
+
const isFlick = diffTime && !expired && mathAbs(force) > 0.1;
|
|
12345
|
+
return isFlick ? force : 0;
|
|
12346
|
+
}
|
|
12347
|
+
const self = {
|
|
12348
|
+
pointerDown,
|
|
12349
|
+
pointerMove,
|
|
12350
|
+
pointerUp,
|
|
12351
|
+
readPoint
|
|
12352
|
+
};
|
|
12353
|
+
return self;
|
|
12354
|
+
}
|
|
12355
|
+
function NodeRects() {
|
|
12356
|
+
function measure(node) {
|
|
12357
|
+
const { offsetTop, offsetLeft, offsetWidth, offsetHeight } = node;
|
|
12358
|
+
const offset = {
|
|
12359
|
+
top: offsetTop,
|
|
12360
|
+
right: offsetLeft + offsetWidth,
|
|
12361
|
+
bottom: offsetTop + offsetHeight,
|
|
12362
|
+
left: offsetLeft,
|
|
12363
|
+
width: offsetWidth,
|
|
12364
|
+
height: offsetHeight
|
|
12365
|
+
};
|
|
12366
|
+
return offset;
|
|
12367
|
+
}
|
|
12368
|
+
const self = {
|
|
12369
|
+
measure
|
|
12370
|
+
};
|
|
12371
|
+
return self;
|
|
12372
|
+
}
|
|
12373
|
+
function PercentOfView(viewSize) {
|
|
12374
|
+
function measure(n) {
|
|
12375
|
+
return viewSize * (n / 100);
|
|
12376
|
+
}
|
|
12377
|
+
const self = {
|
|
12378
|
+
measure
|
|
12379
|
+
};
|
|
12380
|
+
return self;
|
|
12381
|
+
}
|
|
12382
|
+
function ResizeHandler(container, eventHandler, ownerWindow, slides, axis, watchResize, nodeRects) {
|
|
12383
|
+
const observeNodes = [
|
|
12384
|
+
container
|
|
12385
|
+
].concat(slides);
|
|
12386
|
+
let resizeObserver;
|
|
12387
|
+
let containerSize;
|
|
12388
|
+
let slideSizes = [];
|
|
12389
|
+
let destroyed = false;
|
|
12390
|
+
function readSize(node) {
|
|
12391
|
+
return axis.measureSize(nodeRects.measure(node));
|
|
12392
|
+
}
|
|
12393
|
+
function init(emblaApi) {
|
|
12394
|
+
if (!watchResize) return;
|
|
12395
|
+
containerSize = readSize(container);
|
|
12396
|
+
slideSizes = slides.map(readSize);
|
|
12397
|
+
function defaultCallback(entries) {
|
|
12398
|
+
for (const entry of entries){
|
|
12399
|
+
if (destroyed) return;
|
|
12400
|
+
const isContainer = entry.target === container;
|
|
12401
|
+
const slideIndex = slides.indexOf(entry.target);
|
|
12402
|
+
const lastSize = isContainer ? containerSize : slideSizes[slideIndex];
|
|
12403
|
+
const newSize = readSize(isContainer ? container : slides[slideIndex]);
|
|
12404
|
+
const diffSize = mathAbs(newSize - lastSize);
|
|
12405
|
+
if (diffSize >= 0.5) {
|
|
12406
|
+
emblaApi.reInit();
|
|
12407
|
+
eventHandler.emit('resize');
|
|
12408
|
+
break;
|
|
12409
|
+
}
|
|
12410
|
+
}
|
|
12411
|
+
}
|
|
12412
|
+
resizeObserver = new ResizeObserver((entries)=>{
|
|
12413
|
+
if (isBoolean(watchResize) || watchResize(emblaApi, entries)) {
|
|
12414
|
+
defaultCallback(entries);
|
|
12415
|
+
}
|
|
12416
|
+
});
|
|
12417
|
+
ownerWindow.requestAnimationFrame(()=>{
|
|
12418
|
+
observeNodes.forEach((node)=>resizeObserver.observe(node));
|
|
12419
|
+
});
|
|
12420
|
+
}
|
|
12421
|
+
function destroy() {
|
|
12422
|
+
destroyed = true;
|
|
12423
|
+
if (resizeObserver) resizeObserver.disconnect();
|
|
12424
|
+
}
|
|
12425
|
+
const self = {
|
|
12426
|
+
init,
|
|
12427
|
+
destroy
|
|
12428
|
+
};
|
|
12429
|
+
return self;
|
|
12430
|
+
}
|
|
12431
|
+
function ScrollBody(location, offsetLocation, previousLocation, target, baseDuration, baseFriction) {
|
|
12432
|
+
let scrollVelocity = 0;
|
|
12433
|
+
let scrollDirection = 0;
|
|
12434
|
+
let scrollDuration = baseDuration;
|
|
12435
|
+
let scrollFriction = baseFriction;
|
|
12436
|
+
let rawLocation = location.get();
|
|
12437
|
+
let rawLocationPrevious = 0;
|
|
12438
|
+
function seek() {
|
|
12439
|
+
const displacement = target.get() - location.get();
|
|
12440
|
+
const isInstant = !scrollDuration;
|
|
12441
|
+
let scrollDistance = 0;
|
|
12442
|
+
if (isInstant) {
|
|
12443
|
+
scrollVelocity = 0;
|
|
12444
|
+
previousLocation.set(target);
|
|
12445
|
+
location.set(target);
|
|
12446
|
+
scrollDistance = displacement;
|
|
12447
|
+
} else {
|
|
12448
|
+
previousLocation.set(location);
|
|
12449
|
+
scrollVelocity += displacement / scrollDuration;
|
|
12450
|
+
scrollVelocity *= scrollFriction;
|
|
12451
|
+
rawLocation += scrollVelocity;
|
|
12452
|
+
location.add(scrollVelocity);
|
|
12453
|
+
scrollDistance = rawLocation - rawLocationPrevious;
|
|
12454
|
+
}
|
|
12455
|
+
scrollDirection = mathSign(scrollDistance);
|
|
12456
|
+
rawLocationPrevious = rawLocation;
|
|
12457
|
+
return self;
|
|
12458
|
+
}
|
|
12459
|
+
function settled() {
|
|
12460
|
+
const diff = target.get() - offsetLocation.get();
|
|
12461
|
+
return mathAbs(diff) < 0.001;
|
|
12462
|
+
}
|
|
12463
|
+
function duration() {
|
|
12464
|
+
return scrollDuration;
|
|
12465
|
+
}
|
|
12466
|
+
function direction() {
|
|
12467
|
+
return scrollDirection;
|
|
12468
|
+
}
|
|
12469
|
+
function velocity() {
|
|
12470
|
+
return scrollVelocity;
|
|
12471
|
+
}
|
|
12472
|
+
function useBaseDuration() {
|
|
12473
|
+
return useDuration(baseDuration);
|
|
12474
|
+
}
|
|
12475
|
+
function useBaseFriction() {
|
|
12476
|
+
return useFriction(baseFriction);
|
|
12477
|
+
}
|
|
12478
|
+
function useDuration(n) {
|
|
12479
|
+
scrollDuration = n;
|
|
12480
|
+
return self;
|
|
12481
|
+
}
|
|
12482
|
+
function useFriction(n) {
|
|
12483
|
+
scrollFriction = n;
|
|
12484
|
+
return self;
|
|
12485
|
+
}
|
|
12486
|
+
const self = {
|
|
12487
|
+
direction,
|
|
12488
|
+
duration,
|
|
12489
|
+
velocity,
|
|
12490
|
+
seek,
|
|
12491
|
+
settled,
|
|
12492
|
+
useBaseFriction,
|
|
12493
|
+
useBaseDuration,
|
|
12494
|
+
useFriction,
|
|
12495
|
+
useDuration
|
|
12496
|
+
};
|
|
12497
|
+
return self;
|
|
12498
|
+
}
|
|
12499
|
+
function ScrollBounds(limit, location, target, scrollBody, percentOfView) {
|
|
12500
|
+
const pullBackThreshold = percentOfView.measure(10);
|
|
12501
|
+
const edgeOffsetTolerance = percentOfView.measure(50);
|
|
12502
|
+
const frictionLimit = Limit(0.1, 0.99);
|
|
12503
|
+
let disabled = false;
|
|
12504
|
+
function shouldConstrain() {
|
|
12505
|
+
if (disabled) return false;
|
|
12506
|
+
if (!limit.reachedAny(target.get())) return false;
|
|
12507
|
+
if (!limit.reachedAny(location.get())) return false;
|
|
12508
|
+
return true;
|
|
12509
|
+
}
|
|
12510
|
+
function constrain(pointerDown) {
|
|
12511
|
+
if (!shouldConstrain()) return;
|
|
12512
|
+
const edge = limit.reachedMin(location.get()) ? 'min' : 'max';
|
|
12513
|
+
const diffToEdge = mathAbs(limit[edge] - location.get());
|
|
12514
|
+
const diffToTarget = target.get() - location.get();
|
|
12515
|
+
const friction = frictionLimit.constrain(diffToEdge / edgeOffsetTolerance);
|
|
12516
|
+
target.subtract(diffToTarget * friction);
|
|
12517
|
+
if (!pointerDown && mathAbs(diffToTarget) < pullBackThreshold) {
|
|
12518
|
+
target.set(limit.constrain(target.get()));
|
|
12519
|
+
scrollBody.useDuration(25).useBaseFriction();
|
|
12520
|
+
}
|
|
12521
|
+
}
|
|
12522
|
+
function toggleActive(active) {
|
|
12523
|
+
disabled = !active;
|
|
12524
|
+
}
|
|
12525
|
+
const self = {
|
|
12526
|
+
shouldConstrain,
|
|
12527
|
+
constrain,
|
|
12528
|
+
toggleActive
|
|
12529
|
+
};
|
|
12530
|
+
return self;
|
|
12531
|
+
}
|
|
12532
|
+
function ScrollContain(viewSize, contentSize, snapsAligned, containScroll, pixelTolerance) {
|
|
12533
|
+
const scrollBounds = Limit(-contentSize + viewSize, 0);
|
|
12534
|
+
const snapsBounded = measureBounded();
|
|
12535
|
+
const scrollContainLimit = findScrollContainLimit();
|
|
12536
|
+
const snapsContained = measureContained();
|
|
12537
|
+
function usePixelTolerance(bound, snap) {
|
|
12538
|
+
return deltaAbs(bound, snap) <= 1;
|
|
12539
|
+
}
|
|
12540
|
+
function findScrollContainLimit() {
|
|
12541
|
+
const startSnap = snapsBounded[0];
|
|
12542
|
+
const endSnap = arrayLast(snapsBounded);
|
|
12543
|
+
const min = snapsBounded.lastIndexOf(startSnap);
|
|
12544
|
+
const max = snapsBounded.indexOf(endSnap) + 1;
|
|
12545
|
+
return Limit(min, max);
|
|
12546
|
+
}
|
|
12547
|
+
function measureBounded() {
|
|
12548
|
+
return snapsAligned.map((snapAligned, index)=>{
|
|
12549
|
+
const { min, max } = scrollBounds;
|
|
12550
|
+
const snap = scrollBounds.constrain(snapAligned);
|
|
12551
|
+
const isFirst = !index;
|
|
12552
|
+
const isLast = arrayIsLastIndex(snapsAligned, index);
|
|
12553
|
+
if (isFirst) return max;
|
|
12554
|
+
if (isLast) return min;
|
|
12555
|
+
if (usePixelTolerance(min, snap)) return min;
|
|
12556
|
+
if (usePixelTolerance(max, snap)) return max;
|
|
12557
|
+
return snap;
|
|
12558
|
+
}).map((scrollBound)=>parseFloat(scrollBound.toFixed(3)));
|
|
12559
|
+
}
|
|
12560
|
+
function measureContained() {
|
|
12561
|
+
if (contentSize <= viewSize + pixelTolerance) return [
|
|
12562
|
+
scrollBounds.max
|
|
12563
|
+
];
|
|
12564
|
+
if (containScroll === 'keepSnaps') return snapsBounded;
|
|
12565
|
+
const { min, max } = scrollContainLimit;
|
|
12566
|
+
return snapsBounded.slice(min, max);
|
|
12567
|
+
}
|
|
12568
|
+
const self = {
|
|
12569
|
+
snapsContained,
|
|
12570
|
+
scrollContainLimit
|
|
12571
|
+
};
|
|
12572
|
+
return self;
|
|
12573
|
+
}
|
|
12574
|
+
function ScrollLimit(contentSize, scrollSnaps, loop) {
|
|
12575
|
+
const max = scrollSnaps[0];
|
|
12576
|
+
const min = loop ? max - contentSize : arrayLast(scrollSnaps);
|
|
12577
|
+
const limit = Limit(min, max);
|
|
12578
|
+
const self = {
|
|
12579
|
+
limit
|
|
12580
|
+
};
|
|
12581
|
+
return self;
|
|
12582
|
+
}
|
|
12583
|
+
function ScrollLooper(contentSize, limit, location, vectors) {
|
|
12584
|
+
const jointSafety = 0.1;
|
|
12585
|
+
const min = limit.min + jointSafety;
|
|
12586
|
+
const max = limit.max + jointSafety;
|
|
12587
|
+
const { reachedMin, reachedMax } = Limit(min, max);
|
|
12588
|
+
function shouldLoop(direction) {
|
|
12589
|
+
if (direction === 1) return reachedMax(location.get());
|
|
12590
|
+
if (direction === -1) return reachedMin(location.get());
|
|
12591
|
+
return false;
|
|
12592
|
+
}
|
|
12593
|
+
function loop(direction) {
|
|
12594
|
+
if (!shouldLoop(direction)) return;
|
|
12595
|
+
const loopDistance = contentSize * (direction * -1);
|
|
12596
|
+
vectors.forEach((v)=>v.add(loopDistance));
|
|
12597
|
+
}
|
|
12598
|
+
const self = {
|
|
12599
|
+
loop
|
|
12600
|
+
};
|
|
12601
|
+
return self;
|
|
12602
|
+
}
|
|
12603
|
+
function ScrollProgress(limit) {
|
|
12604
|
+
const { max, length } = limit;
|
|
12605
|
+
function get(n) {
|
|
12606
|
+
const currentLocation = n - max;
|
|
12607
|
+
return length ? currentLocation / -length : 0;
|
|
12608
|
+
}
|
|
12609
|
+
const self = {
|
|
12610
|
+
get
|
|
12611
|
+
};
|
|
12612
|
+
return self;
|
|
12613
|
+
}
|
|
12614
|
+
function ScrollSnaps(axis, alignment, containerRect, slideRects, slidesToScroll) {
|
|
12615
|
+
const { startEdge, endEdge } = axis;
|
|
12616
|
+
const { groupSlides } = slidesToScroll;
|
|
12617
|
+
const alignments = measureSizes().map(alignment.measure);
|
|
12618
|
+
const snaps = measureUnaligned();
|
|
12619
|
+
const snapsAligned = measureAligned();
|
|
12620
|
+
function measureSizes() {
|
|
12621
|
+
return groupSlides(slideRects).map((rects)=>arrayLast(rects)[endEdge] - rects[0][startEdge]).map(mathAbs);
|
|
12622
|
+
}
|
|
12623
|
+
function measureUnaligned() {
|
|
12624
|
+
return slideRects.map((rect)=>containerRect[startEdge] - rect[startEdge]).map((snap)=>-mathAbs(snap));
|
|
12625
|
+
}
|
|
12626
|
+
function measureAligned() {
|
|
12627
|
+
return groupSlides(snaps).map((g)=>g[0]).map((snap, index)=>snap + alignments[index]);
|
|
12628
|
+
}
|
|
12629
|
+
const self = {
|
|
12630
|
+
snaps,
|
|
12631
|
+
snapsAligned
|
|
12632
|
+
};
|
|
12633
|
+
return self;
|
|
12634
|
+
}
|
|
12635
|
+
function SlideRegistry(containSnaps, containScroll, scrollSnaps, scrollContainLimit, slidesToScroll, slideIndexes) {
|
|
12636
|
+
const { groupSlides } = slidesToScroll;
|
|
12637
|
+
const { min, max } = scrollContainLimit;
|
|
12638
|
+
const slideRegistry = createSlideRegistry();
|
|
12639
|
+
function createSlideRegistry() {
|
|
12640
|
+
const groupedSlideIndexes = groupSlides(slideIndexes);
|
|
12641
|
+
const doNotContain = !containSnaps || containScroll === 'keepSnaps';
|
|
12642
|
+
if (scrollSnaps.length === 1) return [
|
|
12643
|
+
slideIndexes
|
|
12644
|
+
];
|
|
12645
|
+
if (doNotContain) return groupedSlideIndexes;
|
|
12646
|
+
return groupedSlideIndexes.slice(min, max).map((group, index, groups)=>{
|
|
12647
|
+
const isFirst = !index;
|
|
12648
|
+
const isLast = arrayIsLastIndex(groups, index);
|
|
12649
|
+
if (isFirst) {
|
|
12650
|
+
const range = arrayLast(groups[0]) + 1;
|
|
12651
|
+
return arrayFromNumber(range);
|
|
12652
|
+
}
|
|
12653
|
+
if (isLast) {
|
|
12654
|
+
const range = arrayLastIndex(slideIndexes) - arrayLast(groups)[0] + 1;
|
|
12655
|
+
return arrayFromNumber(range, arrayLast(groups)[0]);
|
|
12656
|
+
}
|
|
12657
|
+
return group;
|
|
12658
|
+
});
|
|
12659
|
+
}
|
|
12660
|
+
const self = {
|
|
12661
|
+
slideRegistry
|
|
12662
|
+
};
|
|
12663
|
+
return self;
|
|
12664
|
+
}
|
|
12665
|
+
function ScrollTarget(loop, scrollSnaps, contentSize, limit, targetVector) {
|
|
12666
|
+
const { reachedAny, removeOffset, constrain } = limit;
|
|
12667
|
+
function minDistance(distances) {
|
|
12668
|
+
return distances.concat().sort((a, b)=>mathAbs(a) - mathAbs(b))[0];
|
|
12669
|
+
}
|
|
12670
|
+
function findTargetSnap(target) {
|
|
12671
|
+
const distance = loop ? removeOffset(target) : constrain(target);
|
|
12672
|
+
const ascDiffsToSnaps = scrollSnaps.map((snap, index)=>({
|
|
12673
|
+
diff: shortcut(snap - distance, 0),
|
|
12674
|
+
index
|
|
12675
|
+
})).sort((d1, d2)=>mathAbs(d1.diff) - mathAbs(d2.diff));
|
|
12676
|
+
const { index } = ascDiffsToSnaps[0];
|
|
12677
|
+
return {
|
|
12678
|
+
index,
|
|
12679
|
+
distance
|
|
12680
|
+
};
|
|
12681
|
+
}
|
|
12682
|
+
function shortcut(target, direction) {
|
|
12683
|
+
const targets = [
|
|
12684
|
+
target,
|
|
12685
|
+
target + contentSize,
|
|
12686
|
+
target - contentSize
|
|
12687
|
+
];
|
|
12688
|
+
if (!loop) return target;
|
|
12689
|
+
if (!direction) return minDistance(targets);
|
|
12690
|
+
const matchingTargets = targets.filter((t)=>mathSign(t) === direction);
|
|
12691
|
+
if (matchingTargets.length) return minDistance(matchingTargets);
|
|
12692
|
+
return arrayLast(targets) - contentSize;
|
|
12693
|
+
}
|
|
12694
|
+
function byIndex(index, direction) {
|
|
12695
|
+
const diffToSnap = scrollSnaps[index] - targetVector.get();
|
|
12696
|
+
const distance = shortcut(diffToSnap, direction);
|
|
12697
|
+
return {
|
|
12698
|
+
index,
|
|
12699
|
+
distance
|
|
12700
|
+
};
|
|
12701
|
+
}
|
|
12702
|
+
function byDistance(distance, snap) {
|
|
12703
|
+
const target = targetVector.get() + distance;
|
|
12704
|
+
const { index, distance: targetSnapDistance } = findTargetSnap(target);
|
|
12705
|
+
const reachedBound = !loop && reachedAny(target);
|
|
12706
|
+
if (!snap || reachedBound) return {
|
|
12707
|
+
index,
|
|
12708
|
+
distance
|
|
12709
|
+
};
|
|
12710
|
+
const diffToSnap = scrollSnaps[index] - targetSnapDistance;
|
|
12711
|
+
const snapDistance = distance + shortcut(diffToSnap, 0);
|
|
12712
|
+
return {
|
|
12713
|
+
index,
|
|
12714
|
+
distance: snapDistance
|
|
12715
|
+
};
|
|
12716
|
+
}
|
|
12717
|
+
const self = {
|
|
12718
|
+
byDistance,
|
|
12719
|
+
byIndex,
|
|
12720
|
+
shortcut
|
|
12721
|
+
};
|
|
12722
|
+
return self;
|
|
12723
|
+
}
|
|
12724
|
+
function ScrollTo(animation, indexCurrent, indexPrevious, scrollBody, scrollTarget, targetVector, eventHandler) {
|
|
12725
|
+
function scrollTo(target) {
|
|
12726
|
+
const distanceDiff = target.distance;
|
|
12727
|
+
const indexDiff = target.index !== indexCurrent.get();
|
|
12728
|
+
targetVector.add(distanceDiff);
|
|
12729
|
+
if (distanceDiff) {
|
|
12730
|
+
if (scrollBody.duration()) {
|
|
12731
|
+
animation.start();
|
|
12732
|
+
} else {
|
|
12733
|
+
animation.update();
|
|
12734
|
+
animation.render(1);
|
|
12735
|
+
animation.update();
|
|
12736
|
+
}
|
|
12737
|
+
}
|
|
12738
|
+
if (indexDiff) {
|
|
12739
|
+
indexPrevious.set(indexCurrent.get());
|
|
12740
|
+
indexCurrent.set(target.index);
|
|
12741
|
+
eventHandler.emit('select');
|
|
12742
|
+
}
|
|
12743
|
+
}
|
|
12744
|
+
function distance(n, snap) {
|
|
12745
|
+
const target = scrollTarget.byDistance(n, snap);
|
|
12746
|
+
scrollTo(target);
|
|
12747
|
+
}
|
|
12748
|
+
function index(n, direction) {
|
|
12749
|
+
const targetIndex = indexCurrent.clone().set(n);
|
|
12750
|
+
const target = scrollTarget.byIndex(targetIndex.get(), direction);
|
|
12751
|
+
scrollTo(target);
|
|
12752
|
+
}
|
|
12753
|
+
const self = {
|
|
12754
|
+
distance,
|
|
12755
|
+
index
|
|
12756
|
+
};
|
|
12757
|
+
return self;
|
|
12758
|
+
}
|
|
12759
|
+
function SlideFocus(root, slides, slideRegistry, scrollTo, scrollBody, eventStore, eventHandler, watchFocus) {
|
|
12760
|
+
const focusListenerOptions = {
|
|
12761
|
+
passive: true,
|
|
12762
|
+
capture: true
|
|
12763
|
+
};
|
|
12764
|
+
let lastTabPressTime = 0;
|
|
12765
|
+
function init(emblaApi) {
|
|
12766
|
+
if (!watchFocus) return;
|
|
12767
|
+
function defaultCallback(index) {
|
|
12768
|
+
const nowTime = new Date().getTime();
|
|
12769
|
+
const diffTime = nowTime - lastTabPressTime;
|
|
12770
|
+
if (diffTime > 10) return;
|
|
12771
|
+
eventHandler.emit('slideFocusStart');
|
|
12772
|
+
root.scrollLeft = 0;
|
|
12773
|
+
const group = slideRegistry.findIndex((group)=>group.includes(index));
|
|
12774
|
+
if (!isNumber(group)) return;
|
|
12775
|
+
scrollBody.useDuration(0);
|
|
12776
|
+
scrollTo.index(group, 0);
|
|
12777
|
+
eventHandler.emit('slideFocus');
|
|
12778
|
+
}
|
|
12779
|
+
eventStore.add(document, 'keydown', registerTabPress, false);
|
|
12780
|
+
slides.forEach((slide, slideIndex)=>{
|
|
12781
|
+
eventStore.add(slide, 'focus', (evt)=>{
|
|
12782
|
+
if (isBoolean(watchFocus) || watchFocus(emblaApi, evt)) {
|
|
12783
|
+
defaultCallback(slideIndex);
|
|
12784
|
+
}
|
|
12785
|
+
}, focusListenerOptions);
|
|
12786
|
+
});
|
|
12787
|
+
}
|
|
12788
|
+
function registerTabPress(event) {
|
|
12789
|
+
if (event.code === 'Tab') lastTabPressTime = new Date().getTime();
|
|
12790
|
+
}
|
|
12791
|
+
const self = {
|
|
12792
|
+
init
|
|
12793
|
+
};
|
|
12794
|
+
return self;
|
|
12795
|
+
}
|
|
12796
|
+
function Vector1D(initialValue) {
|
|
12797
|
+
let value = initialValue;
|
|
12798
|
+
function get() {
|
|
12799
|
+
return value;
|
|
12800
|
+
}
|
|
12801
|
+
function set(n) {
|
|
12802
|
+
value = normalizeInput(n);
|
|
12803
|
+
}
|
|
12804
|
+
function add(n) {
|
|
12805
|
+
value += normalizeInput(n);
|
|
12806
|
+
}
|
|
12807
|
+
function subtract(n) {
|
|
12808
|
+
value -= normalizeInput(n);
|
|
12809
|
+
}
|
|
12810
|
+
function normalizeInput(n) {
|
|
12811
|
+
return isNumber(n) ? n : n.get();
|
|
12812
|
+
}
|
|
12813
|
+
const self = {
|
|
12814
|
+
get,
|
|
12815
|
+
set,
|
|
12816
|
+
add,
|
|
12817
|
+
subtract
|
|
12818
|
+
};
|
|
12819
|
+
return self;
|
|
12820
|
+
}
|
|
12821
|
+
function Translate(axis, container) {
|
|
12822
|
+
const translate = axis.scroll === 'x' ? x : y;
|
|
12823
|
+
const containerStyle = container.style;
|
|
12824
|
+
let previousTarget = null;
|
|
12825
|
+
let disabled = false;
|
|
12826
|
+
function x(n) {
|
|
12827
|
+
return `translate3d(${n}px,0px,0px)`;
|
|
12828
|
+
}
|
|
12829
|
+
function y(n) {
|
|
12830
|
+
return `translate3d(0px,${n}px,0px)`;
|
|
12831
|
+
}
|
|
12832
|
+
function to(target) {
|
|
12833
|
+
if (disabled) return;
|
|
12834
|
+
const newTarget = roundToTwoDecimals(axis.direction(target));
|
|
12835
|
+
if (newTarget === previousTarget) return;
|
|
12836
|
+
containerStyle.transform = translate(newTarget);
|
|
12837
|
+
previousTarget = newTarget;
|
|
12838
|
+
}
|
|
12839
|
+
function toggleActive(active) {
|
|
12840
|
+
disabled = !active;
|
|
12841
|
+
}
|
|
12842
|
+
function clear() {
|
|
12843
|
+
if (disabled) return;
|
|
12844
|
+
containerStyle.transform = '';
|
|
12845
|
+
if (!container.getAttribute('style')) container.removeAttribute('style');
|
|
12846
|
+
}
|
|
12847
|
+
const self = {
|
|
12848
|
+
clear,
|
|
12849
|
+
to,
|
|
12850
|
+
toggleActive
|
|
12851
|
+
};
|
|
12852
|
+
return self;
|
|
12853
|
+
}
|
|
12854
|
+
function SlideLooper(axis, viewSize, contentSize, slideSizes, slideSizesWithGaps, snaps, scrollSnaps, location, slides) {
|
|
12855
|
+
const roundingSafety = 0.5;
|
|
12856
|
+
const ascItems = arrayKeys(slideSizesWithGaps);
|
|
12857
|
+
const descItems = arrayKeys(slideSizesWithGaps).reverse();
|
|
12858
|
+
const loopPoints = startPoints().concat(endPoints());
|
|
12859
|
+
function removeSlideSizes(indexes, from) {
|
|
12860
|
+
return indexes.reduce((a, i)=>{
|
|
12861
|
+
return a - slideSizesWithGaps[i];
|
|
12862
|
+
}, from);
|
|
12863
|
+
}
|
|
12864
|
+
function slidesInGap(indexes, gap) {
|
|
12865
|
+
return indexes.reduce((a, i)=>{
|
|
12866
|
+
const remainingGap = removeSlideSizes(a, gap);
|
|
12867
|
+
return remainingGap > 0 ? a.concat([
|
|
12868
|
+
i
|
|
12869
|
+
]) : a;
|
|
12870
|
+
}, []);
|
|
12871
|
+
}
|
|
12872
|
+
function findSlideBounds(offset) {
|
|
12873
|
+
return snaps.map((snap, index)=>({
|
|
12874
|
+
start: snap - slideSizes[index] + roundingSafety + offset,
|
|
12875
|
+
end: snap + viewSize - roundingSafety + offset
|
|
12876
|
+
}));
|
|
12877
|
+
}
|
|
12878
|
+
function findLoopPoints(indexes, offset, isEndEdge) {
|
|
12879
|
+
const slideBounds = findSlideBounds(offset);
|
|
12880
|
+
return indexes.map((index)=>{
|
|
12881
|
+
const initial = isEndEdge ? 0 : -contentSize;
|
|
12882
|
+
const altered = isEndEdge ? contentSize : 0;
|
|
12883
|
+
const boundEdge = isEndEdge ? 'end' : 'start';
|
|
12884
|
+
const loopPoint = slideBounds[index][boundEdge];
|
|
12885
|
+
return {
|
|
12886
|
+
index,
|
|
12887
|
+
loopPoint,
|
|
12888
|
+
slideLocation: Vector1D(-1),
|
|
12889
|
+
translate: Translate(axis, slides[index]),
|
|
12890
|
+
target: ()=>location.get() > loopPoint ? initial : altered
|
|
12891
|
+
};
|
|
12892
|
+
});
|
|
12893
|
+
}
|
|
12894
|
+
function startPoints() {
|
|
12895
|
+
const gap = scrollSnaps[0];
|
|
12896
|
+
const indexes = slidesInGap(descItems, gap);
|
|
12897
|
+
return findLoopPoints(indexes, contentSize, false);
|
|
12898
|
+
}
|
|
12899
|
+
function endPoints() {
|
|
12900
|
+
const gap = viewSize - scrollSnaps[0] - 1;
|
|
12901
|
+
const indexes = slidesInGap(ascItems, gap);
|
|
12902
|
+
return findLoopPoints(indexes, -contentSize, true);
|
|
12903
|
+
}
|
|
12904
|
+
function canLoop() {
|
|
12905
|
+
return loopPoints.every(({ index })=>{
|
|
12906
|
+
const otherIndexes = ascItems.filter((i)=>i !== index);
|
|
12907
|
+
return removeSlideSizes(otherIndexes, viewSize) <= 0.1;
|
|
12908
|
+
});
|
|
12909
|
+
}
|
|
12910
|
+
function loop() {
|
|
12911
|
+
loopPoints.forEach((loopPoint)=>{
|
|
12912
|
+
const { target, translate, slideLocation } = loopPoint;
|
|
12913
|
+
const shiftLocation = target();
|
|
12914
|
+
if (shiftLocation === slideLocation.get()) return;
|
|
12915
|
+
translate.to(shiftLocation);
|
|
12916
|
+
slideLocation.set(shiftLocation);
|
|
12917
|
+
});
|
|
12918
|
+
}
|
|
12919
|
+
function clear() {
|
|
12920
|
+
loopPoints.forEach((loopPoint)=>loopPoint.translate.clear());
|
|
12921
|
+
}
|
|
12922
|
+
const self = {
|
|
12923
|
+
canLoop,
|
|
12924
|
+
clear,
|
|
12925
|
+
loop,
|
|
12926
|
+
loopPoints
|
|
12927
|
+
};
|
|
12928
|
+
return self;
|
|
12929
|
+
}
|
|
12930
|
+
function SlidesHandler(container, eventHandler, watchSlides) {
|
|
12931
|
+
let mutationObserver;
|
|
12932
|
+
let destroyed = false;
|
|
12933
|
+
function init(emblaApi) {
|
|
12934
|
+
if (!watchSlides) return;
|
|
12935
|
+
function defaultCallback(mutations) {
|
|
12936
|
+
for (const mutation of mutations){
|
|
12937
|
+
if (mutation.type === 'childList') {
|
|
12938
|
+
emblaApi.reInit();
|
|
12939
|
+
eventHandler.emit('slidesChanged');
|
|
12940
|
+
break;
|
|
12941
|
+
}
|
|
12942
|
+
}
|
|
12943
|
+
}
|
|
12944
|
+
mutationObserver = new MutationObserver((mutations)=>{
|
|
12945
|
+
if (destroyed) return;
|
|
12946
|
+
if (isBoolean(watchSlides) || watchSlides(emblaApi, mutations)) {
|
|
12947
|
+
defaultCallback(mutations);
|
|
12948
|
+
}
|
|
12949
|
+
});
|
|
12950
|
+
mutationObserver.observe(container, {
|
|
12951
|
+
childList: true
|
|
12952
|
+
});
|
|
12953
|
+
}
|
|
12954
|
+
function destroy() {
|
|
12955
|
+
if (mutationObserver) mutationObserver.disconnect();
|
|
12956
|
+
destroyed = true;
|
|
12957
|
+
}
|
|
12958
|
+
const self = {
|
|
12959
|
+
init,
|
|
12960
|
+
destroy
|
|
12961
|
+
};
|
|
12962
|
+
return self;
|
|
12963
|
+
}
|
|
12964
|
+
function SlidesInView(container, slides, eventHandler, threshold) {
|
|
12965
|
+
const intersectionEntryMap = {};
|
|
12966
|
+
let inViewCache = null;
|
|
12967
|
+
let notInViewCache = null;
|
|
12968
|
+
let intersectionObserver;
|
|
12969
|
+
let destroyed = false;
|
|
12970
|
+
function init() {
|
|
12971
|
+
intersectionObserver = new IntersectionObserver((entries)=>{
|
|
12972
|
+
if (destroyed) return;
|
|
12973
|
+
entries.forEach((entry)=>{
|
|
12974
|
+
const index = slides.indexOf(entry.target);
|
|
12975
|
+
intersectionEntryMap[index] = entry;
|
|
12976
|
+
});
|
|
12977
|
+
inViewCache = null;
|
|
12978
|
+
notInViewCache = null;
|
|
12979
|
+
eventHandler.emit('slidesInView');
|
|
12980
|
+
}, {
|
|
12981
|
+
root: container.parentElement,
|
|
12982
|
+
threshold
|
|
12983
|
+
});
|
|
12984
|
+
slides.forEach((slide)=>intersectionObserver.observe(slide));
|
|
12985
|
+
}
|
|
12986
|
+
function destroy() {
|
|
12987
|
+
if (intersectionObserver) intersectionObserver.disconnect();
|
|
12988
|
+
destroyed = true;
|
|
12989
|
+
}
|
|
12990
|
+
function createInViewList(inView) {
|
|
12991
|
+
return objectKeys(intersectionEntryMap).reduce((list, slideIndex)=>{
|
|
12992
|
+
const index = parseInt(slideIndex);
|
|
12993
|
+
const { isIntersecting } = intersectionEntryMap[index];
|
|
12994
|
+
const inViewMatch = inView && isIntersecting;
|
|
12995
|
+
const notInViewMatch = !inView && !isIntersecting;
|
|
12996
|
+
if (inViewMatch || notInViewMatch) list.push(index);
|
|
12997
|
+
return list;
|
|
12998
|
+
}, []);
|
|
12999
|
+
}
|
|
13000
|
+
function get(inView = true) {
|
|
13001
|
+
if (inView && inViewCache) return inViewCache;
|
|
13002
|
+
if (!inView && notInViewCache) return notInViewCache;
|
|
13003
|
+
const slideIndexes = createInViewList(inView);
|
|
13004
|
+
if (inView) inViewCache = slideIndexes;
|
|
13005
|
+
if (!inView) notInViewCache = slideIndexes;
|
|
13006
|
+
return slideIndexes;
|
|
13007
|
+
}
|
|
13008
|
+
const self = {
|
|
13009
|
+
init,
|
|
13010
|
+
destroy,
|
|
13011
|
+
get
|
|
13012
|
+
};
|
|
13013
|
+
return self;
|
|
13014
|
+
}
|
|
13015
|
+
function SlideSizes(axis, containerRect, slideRects, slides, readEdgeGap, ownerWindow) {
|
|
13016
|
+
const { measureSize, startEdge, endEdge } = axis;
|
|
13017
|
+
const withEdgeGap = slideRects[0] && readEdgeGap;
|
|
13018
|
+
const startGap = measureStartGap();
|
|
13019
|
+
const endGap = measureEndGap();
|
|
13020
|
+
const slideSizes = slideRects.map(measureSize);
|
|
13021
|
+
const slideSizesWithGaps = measureWithGaps();
|
|
13022
|
+
function measureStartGap() {
|
|
13023
|
+
if (!withEdgeGap) return 0;
|
|
13024
|
+
const slideRect = slideRects[0];
|
|
13025
|
+
return mathAbs(containerRect[startEdge] - slideRect[startEdge]);
|
|
13026
|
+
}
|
|
13027
|
+
function measureEndGap() {
|
|
13028
|
+
if (!withEdgeGap) return 0;
|
|
13029
|
+
const style = ownerWindow.getComputedStyle(arrayLast(slides));
|
|
13030
|
+
return parseFloat(style.getPropertyValue(`margin-${endEdge}`));
|
|
13031
|
+
}
|
|
13032
|
+
function measureWithGaps() {
|
|
13033
|
+
return slideRects.map((rect, index, rects)=>{
|
|
13034
|
+
const isFirst = !index;
|
|
13035
|
+
const isLast = arrayIsLastIndex(rects, index);
|
|
13036
|
+
if (isFirst) return slideSizes[index] + startGap;
|
|
13037
|
+
if (isLast) return slideSizes[index] + endGap;
|
|
13038
|
+
return rects[index + 1][startEdge] - rect[startEdge];
|
|
13039
|
+
}).map(mathAbs);
|
|
13040
|
+
}
|
|
13041
|
+
const self = {
|
|
13042
|
+
slideSizes,
|
|
13043
|
+
slideSizesWithGaps,
|
|
13044
|
+
startGap,
|
|
13045
|
+
endGap
|
|
13046
|
+
};
|
|
13047
|
+
return self;
|
|
13048
|
+
}
|
|
13049
|
+
function SlidesToScroll(axis, viewSize, slidesToScroll, loop, containerRect, slideRects, startGap, endGap, pixelTolerance) {
|
|
13050
|
+
const { startEdge, endEdge, direction } = axis;
|
|
13051
|
+
const groupByNumber = isNumber(slidesToScroll);
|
|
13052
|
+
function byNumber(array, groupSize) {
|
|
13053
|
+
return arrayKeys(array).filter((i)=>i % groupSize === 0).map((i)=>array.slice(i, i + groupSize));
|
|
13054
|
+
}
|
|
13055
|
+
function bySize(array) {
|
|
13056
|
+
if (!array.length) return [];
|
|
13057
|
+
return arrayKeys(array).reduce((groups, rectB, index)=>{
|
|
13058
|
+
const rectA = arrayLast(groups) || 0;
|
|
13059
|
+
const isFirst = rectA === 0;
|
|
13060
|
+
const isLast = rectB === arrayLastIndex(array);
|
|
13061
|
+
const edgeA = containerRect[startEdge] - slideRects[rectA][startEdge];
|
|
13062
|
+
const edgeB = containerRect[startEdge] - slideRects[rectB][endEdge];
|
|
13063
|
+
const gapA = !loop && isFirst ? direction(startGap) : 0;
|
|
13064
|
+
const gapB = !loop && isLast ? direction(endGap) : 0;
|
|
13065
|
+
const chunkSize = mathAbs(edgeB - gapB - (edgeA + gapA));
|
|
13066
|
+
if (index && chunkSize > viewSize + pixelTolerance) groups.push(rectB);
|
|
13067
|
+
if (isLast) groups.push(array.length);
|
|
13068
|
+
return groups;
|
|
13069
|
+
}, []).map((currentSize, index, groups)=>{
|
|
13070
|
+
const previousSize = Math.max(groups[index - 1] || 0);
|
|
13071
|
+
return array.slice(previousSize, currentSize);
|
|
13072
|
+
});
|
|
13073
|
+
}
|
|
13074
|
+
function groupSlides(array) {
|
|
13075
|
+
return groupByNumber ? byNumber(array, slidesToScroll) : bySize(array);
|
|
13076
|
+
}
|
|
13077
|
+
const self = {
|
|
13078
|
+
groupSlides
|
|
13079
|
+
};
|
|
13080
|
+
return self;
|
|
13081
|
+
}
|
|
13082
|
+
function Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler) {
|
|
13083
|
+
// Options
|
|
13084
|
+
const { align, axis: scrollAxis, direction, startIndex, loop, duration, dragFree, dragThreshold, inViewThreshold, slidesToScroll: groupSlides, skipSnaps, containScroll, watchResize, watchSlides, watchDrag, watchFocus } = options;
|
|
13085
|
+
// Measurements
|
|
13086
|
+
const pixelTolerance = 2;
|
|
13087
|
+
const nodeRects = NodeRects();
|
|
13088
|
+
const containerRect = nodeRects.measure(container);
|
|
13089
|
+
const slideRects = slides.map(nodeRects.measure);
|
|
13090
|
+
const axis = Axis(scrollAxis, direction);
|
|
13091
|
+
const viewSize = axis.measureSize(containerRect);
|
|
13092
|
+
const percentOfView = PercentOfView(viewSize);
|
|
13093
|
+
const alignment = Alignment(align, viewSize);
|
|
13094
|
+
const containSnaps = !loop && !!containScroll;
|
|
13095
|
+
const readEdgeGap = loop || !!containScroll;
|
|
13096
|
+
const { slideSizes, slideSizesWithGaps, startGap, endGap } = SlideSizes(axis, containerRect, slideRects, slides, readEdgeGap, ownerWindow);
|
|
13097
|
+
const slidesToScroll = SlidesToScroll(axis, viewSize, groupSlides, loop, containerRect, slideRects, startGap, endGap, pixelTolerance);
|
|
13098
|
+
const { snaps, snapsAligned } = ScrollSnaps(axis, alignment, containerRect, slideRects, slidesToScroll);
|
|
13099
|
+
const contentSize = -arrayLast(snaps) + arrayLast(slideSizesWithGaps);
|
|
13100
|
+
const { snapsContained, scrollContainLimit } = ScrollContain(viewSize, contentSize, snapsAligned, containScroll, pixelTolerance);
|
|
13101
|
+
const scrollSnaps = containSnaps ? snapsContained : snapsAligned;
|
|
13102
|
+
const { limit } = ScrollLimit(contentSize, scrollSnaps, loop);
|
|
13103
|
+
// Indexes
|
|
13104
|
+
const index = Counter(arrayLastIndex(scrollSnaps), startIndex, loop);
|
|
13105
|
+
const indexPrevious = index.clone();
|
|
13106
|
+
const slideIndexes = arrayKeys(slides);
|
|
13107
|
+
// Animation
|
|
13108
|
+
const update = ({ dragHandler, scrollBody, scrollBounds, options: { loop } })=>{
|
|
13109
|
+
if (!loop) scrollBounds.constrain(dragHandler.pointerDown());
|
|
13110
|
+
scrollBody.seek();
|
|
13111
|
+
};
|
|
13112
|
+
const render = ({ scrollBody, translate, location, offsetLocation, previousLocation, scrollLooper, slideLooper, dragHandler, animation, eventHandler, scrollBounds, options: { loop } }, alpha)=>{
|
|
13113
|
+
const shouldSettle = scrollBody.settled();
|
|
13114
|
+
const withinBounds = !scrollBounds.shouldConstrain();
|
|
13115
|
+
const hasSettled = loop ? shouldSettle : shouldSettle && withinBounds;
|
|
13116
|
+
const hasSettledAndIdle = hasSettled && !dragHandler.pointerDown();
|
|
13117
|
+
if (hasSettledAndIdle) animation.stop();
|
|
13118
|
+
const interpolatedLocation = location.get() * alpha + previousLocation.get() * (1 - alpha);
|
|
13119
|
+
offsetLocation.set(interpolatedLocation);
|
|
13120
|
+
if (loop) {
|
|
13121
|
+
scrollLooper.loop(scrollBody.direction());
|
|
13122
|
+
slideLooper.loop();
|
|
13123
|
+
}
|
|
13124
|
+
translate.to(offsetLocation.get());
|
|
13125
|
+
if (hasSettledAndIdle) eventHandler.emit('settle');
|
|
13126
|
+
if (!hasSettled) eventHandler.emit('scroll');
|
|
13127
|
+
};
|
|
13128
|
+
const animation = Animations(ownerDocument, ownerWindow, ()=>update(engine), (alpha)=>render(engine, alpha));
|
|
13129
|
+
// Shared
|
|
13130
|
+
const friction = 0.68;
|
|
13131
|
+
const startLocation = scrollSnaps[index.get()];
|
|
13132
|
+
const location = Vector1D(startLocation);
|
|
13133
|
+
const previousLocation = Vector1D(startLocation);
|
|
13134
|
+
const offsetLocation = Vector1D(startLocation);
|
|
13135
|
+
const target = Vector1D(startLocation);
|
|
13136
|
+
const scrollBody = ScrollBody(location, offsetLocation, previousLocation, target, duration, friction);
|
|
13137
|
+
const scrollTarget = ScrollTarget(loop, scrollSnaps, contentSize, limit, target);
|
|
13138
|
+
const scrollTo = ScrollTo(animation, index, indexPrevious, scrollBody, scrollTarget, target, eventHandler);
|
|
13139
|
+
const scrollProgress = ScrollProgress(limit);
|
|
13140
|
+
const eventStore = EventStore();
|
|
13141
|
+
const slidesInView = SlidesInView(container, slides, eventHandler, inViewThreshold);
|
|
13142
|
+
const { slideRegistry } = SlideRegistry(containSnaps, containScroll, scrollSnaps, scrollContainLimit, slidesToScroll, slideIndexes);
|
|
13143
|
+
const slideFocus = SlideFocus(root, slides, slideRegistry, scrollTo, scrollBody, eventStore, eventHandler, watchFocus);
|
|
13144
|
+
// Engine
|
|
13145
|
+
const engine = {
|
|
13146
|
+
ownerDocument,
|
|
13147
|
+
ownerWindow,
|
|
13148
|
+
eventHandler,
|
|
13149
|
+
containerRect,
|
|
13150
|
+
slideRects,
|
|
13151
|
+
animation,
|
|
13152
|
+
axis,
|
|
13153
|
+
dragHandler: DragHandler(axis, root, ownerDocument, ownerWindow, target, DragTracker(axis, ownerWindow), location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, friction, watchDrag),
|
|
13154
|
+
eventStore,
|
|
13155
|
+
percentOfView,
|
|
13156
|
+
index,
|
|
13157
|
+
indexPrevious,
|
|
13158
|
+
limit,
|
|
13159
|
+
location,
|
|
13160
|
+
offsetLocation,
|
|
13161
|
+
previousLocation,
|
|
13162
|
+
options,
|
|
13163
|
+
resizeHandler: ResizeHandler(container, eventHandler, ownerWindow, slides, axis, watchResize, nodeRects),
|
|
13164
|
+
scrollBody,
|
|
13165
|
+
scrollBounds: ScrollBounds(limit, offsetLocation, target, scrollBody, percentOfView),
|
|
13166
|
+
scrollLooper: ScrollLooper(contentSize, limit, offsetLocation, [
|
|
13167
|
+
location,
|
|
13168
|
+
offsetLocation,
|
|
13169
|
+
previousLocation,
|
|
13170
|
+
target
|
|
13171
|
+
]),
|
|
13172
|
+
scrollProgress,
|
|
13173
|
+
scrollSnapList: scrollSnaps.map(scrollProgress.get),
|
|
13174
|
+
scrollSnaps,
|
|
13175
|
+
scrollTarget,
|
|
13176
|
+
scrollTo,
|
|
13177
|
+
slideLooper: SlideLooper(axis, viewSize, contentSize, slideSizes, slideSizesWithGaps, snaps, scrollSnaps, offsetLocation, slides),
|
|
13178
|
+
slideFocus,
|
|
13179
|
+
slidesHandler: SlidesHandler(container, eventHandler, watchSlides),
|
|
13180
|
+
slidesInView,
|
|
13181
|
+
slideIndexes,
|
|
13182
|
+
slideRegistry,
|
|
13183
|
+
slidesToScroll,
|
|
13184
|
+
target,
|
|
13185
|
+
translate: Translate(axis, container)
|
|
13186
|
+
};
|
|
13187
|
+
return engine;
|
|
13188
|
+
}
|
|
13189
|
+
function EventHandler() {
|
|
13190
|
+
let listeners = {};
|
|
13191
|
+
let api;
|
|
13192
|
+
function init(emblaApi) {
|
|
13193
|
+
api = emblaApi;
|
|
13194
|
+
}
|
|
13195
|
+
function getListeners(evt) {
|
|
13196
|
+
return listeners[evt] || [];
|
|
13197
|
+
}
|
|
13198
|
+
function emit(evt) {
|
|
13199
|
+
getListeners(evt).forEach((e)=>e(api, evt));
|
|
13200
|
+
return self;
|
|
13201
|
+
}
|
|
13202
|
+
function on(evt, cb) {
|
|
13203
|
+
listeners[evt] = getListeners(evt).concat([
|
|
13204
|
+
cb
|
|
13205
|
+
]);
|
|
13206
|
+
return self;
|
|
13207
|
+
}
|
|
13208
|
+
function off(evt, cb) {
|
|
13209
|
+
listeners[evt] = getListeners(evt).filter((e)=>e !== cb);
|
|
13210
|
+
return self;
|
|
13211
|
+
}
|
|
13212
|
+
function clear() {
|
|
13213
|
+
listeners = {};
|
|
13214
|
+
}
|
|
13215
|
+
const self = {
|
|
13216
|
+
init,
|
|
13217
|
+
emit,
|
|
13218
|
+
off,
|
|
13219
|
+
on,
|
|
13220
|
+
clear
|
|
13221
|
+
};
|
|
13222
|
+
return self;
|
|
13223
|
+
}
|
|
13224
|
+
const defaultOptions = {
|
|
13225
|
+
align: 'center',
|
|
13226
|
+
axis: 'x',
|
|
13227
|
+
container: null,
|
|
13228
|
+
slides: null,
|
|
13229
|
+
containScroll: 'trimSnaps',
|
|
13230
|
+
direction: 'ltr',
|
|
13231
|
+
slidesToScroll: 1,
|
|
13232
|
+
inViewThreshold: 0,
|
|
13233
|
+
breakpoints: {},
|
|
13234
|
+
dragFree: false,
|
|
13235
|
+
dragThreshold: 10,
|
|
13236
|
+
loop: false,
|
|
13237
|
+
skipSnaps: false,
|
|
13238
|
+
duration: 25,
|
|
13239
|
+
startIndex: 0,
|
|
13240
|
+
active: true,
|
|
13241
|
+
watchDrag: true,
|
|
13242
|
+
watchResize: true,
|
|
13243
|
+
watchSlides: true,
|
|
13244
|
+
watchFocus: true
|
|
13245
|
+
};
|
|
13246
|
+
function OptionsHandler(ownerWindow) {
|
|
13247
|
+
function mergeOptions(optionsA, optionsB) {
|
|
13248
|
+
return objectsMergeDeep(optionsA, optionsB || {});
|
|
13249
|
+
}
|
|
13250
|
+
function optionsAtMedia(options) {
|
|
13251
|
+
const optionsAtMedia = options.breakpoints || {};
|
|
13252
|
+
const matchedMediaOptions = objectKeys(optionsAtMedia).filter((media)=>ownerWindow.matchMedia(media).matches).map((media)=>optionsAtMedia[media]).reduce((a, mediaOption)=>mergeOptions(a, mediaOption), {});
|
|
13253
|
+
return mergeOptions(options, matchedMediaOptions);
|
|
13254
|
+
}
|
|
13255
|
+
function optionsMediaQueries(optionsList) {
|
|
13256
|
+
return optionsList.map((options)=>objectKeys(options.breakpoints || {})).reduce((acc, mediaQueries)=>acc.concat(mediaQueries), []).map(ownerWindow.matchMedia);
|
|
13257
|
+
}
|
|
13258
|
+
const self = {
|
|
13259
|
+
mergeOptions,
|
|
13260
|
+
optionsAtMedia,
|
|
13261
|
+
optionsMediaQueries
|
|
13262
|
+
};
|
|
13263
|
+
return self;
|
|
13264
|
+
}
|
|
13265
|
+
function PluginsHandler(optionsHandler) {
|
|
13266
|
+
let activePlugins = [];
|
|
13267
|
+
function init(emblaApi, plugins) {
|
|
13268
|
+
activePlugins = plugins.filter(({ options })=>optionsHandler.optionsAtMedia(options).active !== false);
|
|
13269
|
+
activePlugins.forEach((plugin)=>plugin.init(emblaApi, optionsHandler));
|
|
13270
|
+
return plugins.reduce((map, plugin)=>Object.assign(map, {
|
|
13271
|
+
[plugin.name]: plugin
|
|
13272
|
+
}), {});
|
|
13273
|
+
}
|
|
13274
|
+
function destroy() {
|
|
13275
|
+
activePlugins = activePlugins.filter((plugin)=>plugin.destroy());
|
|
13276
|
+
}
|
|
13277
|
+
const self = {
|
|
13278
|
+
init,
|
|
13279
|
+
destroy
|
|
13280
|
+
};
|
|
13281
|
+
return self;
|
|
13282
|
+
}
|
|
13283
|
+
function EmblaCarousel(root, userOptions, userPlugins) {
|
|
13284
|
+
const ownerDocument = root.ownerDocument;
|
|
13285
|
+
const ownerWindow = ownerDocument.defaultView;
|
|
13286
|
+
const optionsHandler = OptionsHandler(ownerWindow);
|
|
13287
|
+
const pluginsHandler = PluginsHandler(optionsHandler);
|
|
13288
|
+
const mediaHandlers = EventStore();
|
|
13289
|
+
const eventHandler = EventHandler();
|
|
13290
|
+
const { mergeOptions, optionsAtMedia, optionsMediaQueries } = optionsHandler;
|
|
13291
|
+
const { on, off, emit } = eventHandler;
|
|
13292
|
+
const reInit = reActivate;
|
|
13293
|
+
let destroyed = false;
|
|
13294
|
+
let engine;
|
|
13295
|
+
let optionsBase = mergeOptions(defaultOptions, EmblaCarousel.globalOptions);
|
|
13296
|
+
let options = mergeOptions(optionsBase);
|
|
13297
|
+
let pluginList = [];
|
|
13298
|
+
let pluginApis;
|
|
13299
|
+
let container;
|
|
13300
|
+
let slides;
|
|
13301
|
+
function storeElements() {
|
|
13302
|
+
const { container: userContainer, slides: userSlides } = options;
|
|
13303
|
+
const customContainer = isString(userContainer) ? root.querySelector(userContainer) : userContainer;
|
|
13304
|
+
container = customContainer || root.children[0];
|
|
13305
|
+
const customSlides = isString(userSlides) ? container.querySelectorAll(userSlides) : userSlides;
|
|
13306
|
+
slides = [].slice.call(customSlides || container.children);
|
|
13307
|
+
}
|
|
13308
|
+
function createEngine(options) {
|
|
13309
|
+
const engine = Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler);
|
|
13310
|
+
if (options.loop && !engine.slideLooper.canLoop()) {
|
|
13311
|
+
const optionsWithoutLoop = Object.assign({}, options, {
|
|
13312
|
+
loop: false
|
|
13313
|
+
});
|
|
13314
|
+
return createEngine(optionsWithoutLoop);
|
|
13315
|
+
}
|
|
13316
|
+
return engine;
|
|
13317
|
+
}
|
|
13318
|
+
function activate(withOptions, withPlugins) {
|
|
13319
|
+
if (destroyed) return;
|
|
13320
|
+
optionsBase = mergeOptions(optionsBase, withOptions);
|
|
13321
|
+
options = optionsAtMedia(optionsBase);
|
|
13322
|
+
pluginList = withPlugins || pluginList;
|
|
13323
|
+
storeElements();
|
|
13324
|
+
engine = createEngine(options);
|
|
13325
|
+
optionsMediaQueries([
|
|
13326
|
+
optionsBase,
|
|
13327
|
+
...pluginList.map(({ options })=>options)
|
|
13328
|
+
]).forEach((query)=>mediaHandlers.add(query, 'change', reActivate));
|
|
13329
|
+
if (!options.active) return;
|
|
13330
|
+
engine.translate.to(engine.location.get());
|
|
13331
|
+
engine.animation.init();
|
|
13332
|
+
engine.slidesInView.init();
|
|
13333
|
+
engine.slideFocus.init(self);
|
|
13334
|
+
engine.eventHandler.init(self);
|
|
13335
|
+
engine.resizeHandler.init(self);
|
|
13336
|
+
engine.slidesHandler.init(self);
|
|
13337
|
+
if (engine.options.loop) engine.slideLooper.loop();
|
|
13338
|
+
if (container.offsetParent && slides.length) engine.dragHandler.init(self);
|
|
13339
|
+
pluginApis = pluginsHandler.init(self, pluginList);
|
|
13340
|
+
}
|
|
13341
|
+
function reActivate(withOptions, withPlugins) {
|
|
13342
|
+
const startIndex = selectedScrollSnap();
|
|
13343
|
+
deActivate();
|
|
13344
|
+
activate(mergeOptions({
|
|
13345
|
+
startIndex
|
|
13346
|
+
}, withOptions), withPlugins);
|
|
13347
|
+
eventHandler.emit('reInit');
|
|
13348
|
+
}
|
|
13349
|
+
function deActivate() {
|
|
13350
|
+
engine.dragHandler.destroy();
|
|
13351
|
+
engine.eventStore.clear();
|
|
13352
|
+
engine.translate.clear();
|
|
13353
|
+
engine.slideLooper.clear();
|
|
13354
|
+
engine.resizeHandler.destroy();
|
|
13355
|
+
engine.slidesHandler.destroy();
|
|
13356
|
+
engine.slidesInView.destroy();
|
|
13357
|
+
engine.animation.destroy();
|
|
13358
|
+
pluginsHandler.destroy();
|
|
13359
|
+
mediaHandlers.clear();
|
|
13360
|
+
}
|
|
13361
|
+
function destroy() {
|
|
13362
|
+
if (destroyed) return;
|
|
13363
|
+
destroyed = true;
|
|
13364
|
+
mediaHandlers.clear();
|
|
13365
|
+
deActivate();
|
|
13366
|
+
eventHandler.emit('destroy');
|
|
13367
|
+
eventHandler.clear();
|
|
13368
|
+
}
|
|
13369
|
+
function scrollTo(index, jump, direction) {
|
|
13370
|
+
if (!options.active || destroyed) return;
|
|
13371
|
+
engine.scrollBody.useBaseFriction().useDuration(jump === true ? 0 : options.duration);
|
|
13372
|
+
engine.scrollTo.index(index, direction || 0);
|
|
13373
|
+
}
|
|
13374
|
+
function scrollNext(jump) {
|
|
13375
|
+
const next = engine.index.add(1).get();
|
|
13376
|
+
scrollTo(next, jump, -1);
|
|
13377
|
+
}
|
|
13378
|
+
function scrollPrev(jump) {
|
|
13379
|
+
const prev = engine.index.add(-1).get();
|
|
13380
|
+
scrollTo(prev, jump, 1);
|
|
13381
|
+
}
|
|
13382
|
+
function canScrollNext() {
|
|
13383
|
+
const next = engine.index.add(1).get();
|
|
13384
|
+
return next !== selectedScrollSnap();
|
|
13385
|
+
}
|
|
13386
|
+
function canScrollPrev() {
|
|
13387
|
+
const prev = engine.index.add(-1).get();
|
|
13388
|
+
return prev !== selectedScrollSnap();
|
|
13389
|
+
}
|
|
13390
|
+
function scrollSnapList() {
|
|
13391
|
+
return engine.scrollSnapList;
|
|
13392
|
+
}
|
|
13393
|
+
function scrollProgress() {
|
|
13394
|
+
return engine.scrollProgress.get(engine.offsetLocation.get());
|
|
13395
|
+
}
|
|
13396
|
+
function selectedScrollSnap() {
|
|
13397
|
+
return engine.index.get();
|
|
13398
|
+
}
|
|
13399
|
+
function previousScrollSnap() {
|
|
13400
|
+
return engine.indexPrevious.get();
|
|
13401
|
+
}
|
|
13402
|
+
function slidesInView() {
|
|
13403
|
+
return engine.slidesInView.get();
|
|
13404
|
+
}
|
|
13405
|
+
function slidesNotInView() {
|
|
13406
|
+
return engine.slidesInView.get(false);
|
|
13407
|
+
}
|
|
13408
|
+
function plugins() {
|
|
13409
|
+
return pluginApis;
|
|
13410
|
+
}
|
|
13411
|
+
function internalEngine() {
|
|
13412
|
+
return engine;
|
|
13413
|
+
}
|
|
13414
|
+
function rootNode() {
|
|
13415
|
+
return root;
|
|
13416
|
+
}
|
|
13417
|
+
function containerNode() {
|
|
13418
|
+
return container;
|
|
13419
|
+
}
|
|
13420
|
+
function slideNodes() {
|
|
13421
|
+
return slides;
|
|
13422
|
+
}
|
|
13423
|
+
const self = {
|
|
13424
|
+
canScrollNext,
|
|
13425
|
+
canScrollPrev,
|
|
13426
|
+
containerNode,
|
|
13427
|
+
internalEngine,
|
|
13428
|
+
destroy,
|
|
13429
|
+
off,
|
|
13430
|
+
on,
|
|
13431
|
+
emit,
|
|
13432
|
+
plugins,
|
|
13433
|
+
previousScrollSnap,
|
|
13434
|
+
reInit,
|
|
13435
|
+
rootNode,
|
|
13436
|
+
scrollNext,
|
|
13437
|
+
scrollPrev,
|
|
13438
|
+
scrollProgress,
|
|
13439
|
+
scrollSnapList,
|
|
13440
|
+
scrollTo,
|
|
13441
|
+
selectedScrollSnap,
|
|
13442
|
+
slideNodes,
|
|
13443
|
+
slidesInView,
|
|
13444
|
+
slidesNotInView
|
|
13445
|
+
};
|
|
13446
|
+
activate(userOptions, userPlugins);
|
|
13447
|
+
setTimeout(()=>eventHandler.emit('init'), 0);
|
|
13448
|
+
return self;
|
|
13449
|
+
}
|
|
13450
|
+
EmblaCarousel.globalOptions = undefined;
|
|
13451
|
+
|
|
13452
|
+
function useEmblaCarousel(options = {}, plugins = []) {
|
|
13453
|
+
const storedOptions = React.useRef(options);
|
|
13454
|
+
const storedPlugins = React.useRef(plugins);
|
|
13455
|
+
const [emblaApi, setEmblaApi] = React.useState();
|
|
13456
|
+
const [viewport, setViewport] = React.useState();
|
|
13457
|
+
const reInit = React.useCallback(()=>{
|
|
13458
|
+
if (emblaApi) emblaApi.reInit(storedOptions.current, storedPlugins.current);
|
|
13459
|
+
}, [
|
|
13460
|
+
emblaApi
|
|
13461
|
+
]);
|
|
13462
|
+
React.useEffect(()=>{
|
|
13463
|
+
if (areOptionsEqual(storedOptions.current, options)) return;
|
|
13464
|
+
storedOptions.current = options;
|
|
13465
|
+
reInit();
|
|
13466
|
+
}, [
|
|
13467
|
+
options,
|
|
13468
|
+
reInit
|
|
13469
|
+
]);
|
|
13470
|
+
React.useEffect(()=>{
|
|
13471
|
+
if (arePluginsEqual(storedPlugins.current, plugins)) return;
|
|
13472
|
+
storedPlugins.current = plugins;
|
|
13473
|
+
reInit();
|
|
13474
|
+
}, [
|
|
13475
|
+
plugins,
|
|
13476
|
+
reInit
|
|
13477
|
+
]);
|
|
13478
|
+
React.useEffect(()=>{
|
|
13479
|
+
if (canUseDOM() && viewport) {
|
|
13480
|
+
EmblaCarousel.globalOptions = useEmblaCarousel.globalOptions;
|
|
13481
|
+
const newEmblaApi = EmblaCarousel(viewport, storedOptions.current, storedPlugins.current);
|
|
13482
|
+
setEmblaApi(newEmblaApi);
|
|
13483
|
+
return ()=>newEmblaApi.destroy();
|
|
13484
|
+
} else {
|
|
13485
|
+
setEmblaApi(undefined);
|
|
13486
|
+
}
|
|
13487
|
+
}, [
|
|
13488
|
+
viewport,
|
|
13489
|
+
setEmblaApi
|
|
13490
|
+
]);
|
|
13491
|
+
return [
|
|
13492
|
+
setViewport,
|
|
13493
|
+
emblaApi
|
|
13494
|
+
];
|
|
13495
|
+
}
|
|
13496
|
+
useEmblaCarousel.globalOptions = undefined;
|
|
13497
|
+
|
|
13498
|
+
function useRenderStrategy(props) {
|
|
13499
|
+
const wasEverPresent = React.useRef(false);
|
|
13500
|
+
if (props.present) {
|
|
13501
|
+
wasEverPresent.current = true;
|
|
13502
|
+
}
|
|
13503
|
+
return {
|
|
13504
|
+
unmounted: !props.present && !wasEverPresent.current && props.lazyMount || props.unmountOnExit && !props.present && wasEverPresent.current
|
|
13505
|
+
};
|
|
13506
|
+
}
|
|
13507
|
+
const RenderStrategyPropsContext = /*#__PURE__*/ React.createContext(null);
|
|
13508
|
+
const RenderStrategyPropsProvider = RenderStrategyPropsContext.Provider;
|
|
13509
|
+
function useRenderStrategyPropsContext({ strict = true } = {}) {
|
|
13510
|
+
const context = React.useContext(RenderStrategyPropsContext);
|
|
13511
|
+
if (!context && strict) {
|
|
13512
|
+
throw new Error("useRenderStrategyPropsContext must be used within a RenderStrategyPropsProvider");
|
|
13513
|
+
}
|
|
13514
|
+
return context;
|
|
13515
|
+
}
|
|
13516
|
+
/* ID -----------------------------------------------------------------------
|
|
13517
|
+
-------------------------------------------------------------------------------- */ const getTriggerId = (value, id)=>`tabs:${value}:${id}:trigger-root`;
|
|
13518
|
+
const getListId = (id)=>`tabs:${id}:list`;
|
|
13519
|
+
const getContentId = (value, id)=>`tabs:${value}:${id}:content`;
|
|
13520
|
+
/* Query -----------------------------------------------------------------------
|
|
13521
|
+
-------------------------------------------------------------------------------- */ const getTriggerByValue = (listEl, value)=>{
|
|
13522
|
+
return listEl.querySelector(`[data-value="${value}"]`);
|
|
13523
|
+
};
|
|
13524
|
+
const getEnabledValues = (el)=>{
|
|
13525
|
+
if (!el) return [];
|
|
13526
|
+
return Array.from(el.children).filter((child)=>!child.hasAttribute("aria-disabled")).map((child)=>child.getAttribute("data-value")).filter(Boolean);
|
|
13527
|
+
};
|
|
13528
|
+
/* Prevent Drag -----------------------------------------------------------------------
|
|
13529
|
+
-------------------------------------------------------------------------------- */ const PREVENT_DRAG_ATTRIBUTE = "data-embla-prevent-drag";
|
|
13530
|
+
const isDragPrevented = (el)=>{
|
|
13531
|
+
return el.closest(`[${PREVENT_DRAG_ATTRIBUTE}]`) != null;
|
|
13532
|
+
};
|
|
13533
|
+
function getPrevIndex(index, length) {
|
|
13534
|
+
if (length <= 0) {
|
|
13535
|
+
throw new Error("Length must be a positive number.");
|
|
13536
|
+
}
|
|
13537
|
+
return (index - 1 + length) % length;
|
|
13538
|
+
}
|
|
13539
|
+
function getNextIndex(index, length) {
|
|
13540
|
+
if (length <= 0) {
|
|
13541
|
+
throw new Error("Length must be a positive number.");
|
|
13542
|
+
}
|
|
13543
|
+
return (index + 1) % length;
|
|
13544
|
+
}
|
|
13545
|
+
// Helper function to scroll tab into view
|
|
13546
|
+
function scrollTabIntoView(tabElement, listElement, options) {
|
|
13547
|
+
const isHorizontal = listElement.getAttribute("aria-orientation") !== "vertical";
|
|
13548
|
+
// Default padding is 16px if not specified
|
|
13549
|
+
const scrollPadding = options?.scrollPadding;
|
|
13550
|
+
if (isHorizontal) {
|
|
13551
|
+
const tabLeft = tabElement.offsetLeft;
|
|
13552
|
+
const tabRight = tabLeft + tabElement.offsetWidth;
|
|
13553
|
+
const listScrollLeft = listElement.scrollLeft;
|
|
13554
|
+
const listWidth = listElement.clientWidth;
|
|
13555
|
+
const listRight = listScrollLeft + listWidth;
|
|
13556
|
+
if (tabLeft < listScrollLeft) {
|
|
13557
|
+
// Tab is to the left of the visible area - scroll a bit more to the left
|
|
13558
|
+
listElement.scrollTo({
|
|
13559
|
+
left: Math.max(0, tabLeft - scrollPadding),
|
|
13560
|
+
behavior: "smooth"
|
|
13561
|
+
});
|
|
13562
|
+
} else if (tabRight > listRight) {
|
|
13563
|
+
// Tab is to the right of the visible area - scroll a bit more to the right
|
|
13564
|
+
listElement.scrollTo({
|
|
13565
|
+
left: tabRight - listWidth + scrollPadding,
|
|
13566
|
+
behavior: "smooth"
|
|
13567
|
+
});
|
|
13568
|
+
}
|
|
13569
|
+
} else {
|
|
13570
|
+
const tabTop = tabElement.offsetTop;
|
|
13571
|
+
const tabBottom = tabTop + tabElement.offsetHeight;
|
|
13572
|
+
const listScrollTop = listElement.scrollTop;
|
|
13573
|
+
const listHeight = listElement.clientHeight;
|
|
13574
|
+
const listBottom = listScrollTop + listHeight;
|
|
13575
|
+
if (tabTop < listScrollTop) {
|
|
13576
|
+
// Tab is above the visible area - scroll a bit more up
|
|
13577
|
+
listElement.scrollTo({
|
|
13578
|
+
top: Math.max(0, tabTop - scrollPadding),
|
|
13579
|
+
behavior: "smooth"
|
|
13580
|
+
});
|
|
13581
|
+
} else if (tabBottom > listBottom) {
|
|
13582
|
+
// Tab is below the visible area - scroll a bit more down
|
|
13583
|
+
listElement.scrollTo({
|
|
13584
|
+
top: tabBottom - listHeight + scrollPadding,
|
|
13585
|
+
behavior: "smooth"
|
|
13586
|
+
});
|
|
13587
|
+
}
|
|
13588
|
+
}
|
|
13589
|
+
}
|
|
13590
|
+
function useIsSSR() {
|
|
13591
|
+
const [isSSR, setIsSSR] = React.useState(true);
|
|
13592
|
+
React.useEffect(()=>{
|
|
13593
|
+
setIsSSR(false);
|
|
13594
|
+
}, []);
|
|
13595
|
+
return isSSR;
|
|
13596
|
+
}
|
|
13597
|
+
function useTabsState(props) {
|
|
13598
|
+
const [interactionState, setInteractionState] = React.useState("idle");
|
|
13599
|
+
const [value, setValue] = useControllableState$1({
|
|
13600
|
+
prop: props.value,
|
|
13601
|
+
defaultProp: props.defaultValue ?? undefined,
|
|
13602
|
+
onChange: props.onValueChange
|
|
13603
|
+
});
|
|
13604
|
+
const [focusedValue, setFocusedValue] = React.useState(null);
|
|
13605
|
+
const [isFocusVisible, setIsFocusVisible] = React.useState(false);
|
|
13606
|
+
const isFocusVisibleSupported = useSupports("selector(:focus-visible)");
|
|
13607
|
+
const [listEl, listRef] = React.useState(null);
|
|
13608
|
+
const [selectedTriggerEl, setSelectedTriggerEl] = React.useState(null);
|
|
13609
|
+
const selectedTriggerSize = useSize(selectedTriggerEl);
|
|
13610
|
+
const enabledValues = React.useMemo(()=>listEl ? getEnabledValues(listEl) : [], [
|
|
13611
|
+
listEl
|
|
13612
|
+
]);
|
|
13613
|
+
const contentIndex = value ? enabledValues.indexOf(value) : -1;
|
|
13614
|
+
const prevIndex = contentIndex >= 0 ? getPrevIndex(contentIndex, enabledValues.length) : -1;
|
|
13615
|
+
const nextIndex = contentIndex >= 0 ? getNextIndex(contentIndex, enabledValues.length) : -1;
|
|
13616
|
+
// Scroll selected tab into view when it changes
|
|
13617
|
+
// TODO: this implementation is temporary, we should create some sort of hook or plugin system
|
|
13618
|
+
// to allow users to customize the scroll behavior.
|
|
13619
|
+
React.useEffect(()=>{
|
|
13620
|
+
if (selectedTriggerEl && listEl) {
|
|
13621
|
+
scrollTabIntoView(selectedTriggerEl, listEl, {
|
|
13622
|
+
scrollPadding: 16
|
|
13623
|
+
});
|
|
13624
|
+
}
|
|
13625
|
+
}, [
|
|
13626
|
+
selectedTriggerEl,
|
|
13627
|
+
listEl
|
|
13628
|
+
]);
|
|
13629
|
+
const focusTriggerByValue = React.useCallback((value)=>{
|
|
13630
|
+
if (listEl) {
|
|
13631
|
+
getTriggerByValue(listEl, value)?.focus();
|
|
13632
|
+
}
|
|
13633
|
+
}, [
|
|
13634
|
+
listEl
|
|
13635
|
+
]);
|
|
13636
|
+
const selectPrevAction = React.useCallback(()=>{
|
|
13637
|
+
const prevValue = enabledValues[prevIndex];
|
|
13638
|
+
if (!prevValue) return;
|
|
13639
|
+
setValue(prevValue);
|
|
13640
|
+
}, [
|
|
13641
|
+
enabledValues,
|
|
13642
|
+
prevIndex,
|
|
13643
|
+
setValue
|
|
13644
|
+
]);
|
|
13645
|
+
const selectNextAction = React.useCallback(()=>{
|
|
13646
|
+
const nextValue = enabledValues[nextIndex];
|
|
13647
|
+
if (!nextValue) return;
|
|
13648
|
+
setValue(nextValue);
|
|
13649
|
+
}, [
|
|
13650
|
+
enabledValues,
|
|
13651
|
+
nextIndex,
|
|
13652
|
+
setValue
|
|
13653
|
+
]);
|
|
13654
|
+
const selectFirstAction = React.useCallback(()=>{
|
|
13655
|
+
const firstValue = enabledValues[0];
|
|
13656
|
+
if (!firstValue) return;
|
|
13657
|
+
setValue(firstValue);
|
|
13658
|
+
}, [
|
|
13659
|
+
enabledValues,
|
|
13660
|
+
setValue
|
|
13661
|
+
]);
|
|
13662
|
+
const selectLastAction = React.useCallback(()=>{
|
|
13663
|
+
const lastValue = enabledValues[enabledValues.length - 1];
|
|
13664
|
+
if (!lastValue) return;
|
|
13665
|
+
setValue(lastValue);
|
|
13666
|
+
}, [
|
|
13667
|
+
enabledValues,
|
|
13668
|
+
setValue
|
|
13669
|
+
]);
|
|
13670
|
+
const setFocusedValueAction = React.useCallback((value)=>{
|
|
13671
|
+
setFocusedValue(value);
|
|
13672
|
+
}, []);
|
|
13673
|
+
const clearFocusedValueAction = React.useCallback(()=>{
|
|
13674
|
+
setFocusedValue(null);
|
|
13675
|
+
}, []);
|
|
13676
|
+
const setValueAction = React.useCallback((value)=>{
|
|
13677
|
+
setValue(value);
|
|
13678
|
+
}, [
|
|
13679
|
+
setValue
|
|
13680
|
+
]);
|
|
13681
|
+
const actions = {
|
|
13682
|
+
selectPrev: selectPrevAction,
|
|
13683
|
+
selectNext: selectNextAction,
|
|
13684
|
+
selectFirst: selectFirstAction,
|
|
13685
|
+
selectLast: selectLastAction,
|
|
13686
|
+
setFocusedValue: setFocusedValueAction,
|
|
13687
|
+
clearFocusedValue: clearFocusedValueAction,
|
|
13688
|
+
setValue: setValueAction
|
|
13689
|
+
};
|
|
13690
|
+
const arrowPrevEvent = React.useCallback(()=>{
|
|
13691
|
+
if (interactionState === "focused") {
|
|
13692
|
+
actions.selectPrev();
|
|
13693
|
+
focusTriggerByValue(enabledValues[prevIndex] ?? "");
|
|
13694
|
+
if (isFocusVisibleSupported) {
|
|
13695
|
+
setIsFocusVisible(true);
|
|
13696
|
+
}
|
|
13697
|
+
}
|
|
13698
|
+
}, [
|
|
13699
|
+
interactionState,
|
|
13700
|
+
actions.selectPrev,
|
|
13701
|
+
focusTriggerByValue,
|
|
13702
|
+
enabledValues,
|
|
13703
|
+
prevIndex,
|
|
13704
|
+
isFocusVisibleSupported
|
|
13705
|
+
]);
|
|
13706
|
+
const arrowNextEvent = React.useCallback(()=>{
|
|
13707
|
+
if (interactionState === "focused") {
|
|
13708
|
+
actions.selectNext();
|
|
13709
|
+
focusTriggerByValue(enabledValues[nextIndex] ?? "");
|
|
13710
|
+
if (isFocusVisibleSupported) {
|
|
13711
|
+
setIsFocusVisible(true);
|
|
13712
|
+
}
|
|
13713
|
+
}
|
|
13714
|
+
}, [
|
|
13715
|
+
interactionState,
|
|
13716
|
+
actions.selectNext,
|
|
13717
|
+
focusTriggerByValue,
|
|
13718
|
+
enabledValues,
|
|
13719
|
+
nextIndex,
|
|
13720
|
+
isFocusVisibleSupported
|
|
13721
|
+
]);
|
|
13722
|
+
const arrowUpEvent = React.useCallback(()=>{
|
|
13723
|
+
if (interactionState === "focused") {
|
|
13724
|
+
actions.selectPrev();
|
|
13725
|
+
focusTriggerByValue(enabledValues[prevIndex] ?? "");
|
|
13726
|
+
if (isFocusVisibleSupported) {
|
|
13727
|
+
setIsFocusVisible(true);
|
|
13728
|
+
}
|
|
13729
|
+
}
|
|
13730
|
+
}, [
|
|
13731
|
+
interactionState,
|
|
13732
|
+
actions.selectPrev,
|
|
13733
|
+
focusTriggerByValue,
|
|
13734
|
+
enabledValues,
|
|
13735
|
+
prevIndex,
|
|
13736
|
+
isFocusVisibleSupported
|
|
13737
|
+
]);
|
|
13738
|
+
const arrowDownEvent = React.useCallback(()=>{
|
|
13739
|
+
if (interactionState === "focused") {
|
|
13740
|
+
actions.selectNext();
|
|
13741
|
+
focusTriggerByValue(enabledValues[nextIndex] ?? "");
|
|
13742
|
+
if (isFocusVisibleSupported) {
|
|
13743
|
+
setIsFocusVisible(true);
|
|
13744
|
+
}
|
|
13745
|
+
}
|
|
13746
|
+
}, [
|
|
13747
|
+
interactionState,
|
|
13748
|
+
actions.selectNext,
|
|
13749
|
+
focusTriggerByValue,
|
|
13750
|
+
enabledValues,
|
|
13751
|
+
nextIndex,
|
|
13752
|
+
isFocusVisibleSupported
|
|
13753
|
+
]);
|
|
13754
|
+
const homeEvent = React.useCallback(()=>{
|
|
13755
|
+
if (interactionState === "focused") {
|
|
13756
|
+
actions.selectFirst();
|
|
13757
|
+
focusTriggerByValue(enabledValues[0] ?? "");
|
|
13758
|
+
if (isFocusVisibleSupported) {
|
|
13759
|
+
setIsFocusVisible(true);
|
|
13760
|
+
}
|
|
13761
|
+
}
|
|
13762
|
+
}, [
|
|
13763
|
+
interactionState,
|
|
13764
|
+
actions.selectFirst,
|
|
13765
|
+
focusTriggerByValue,
|
|
13766
|
+
enabledValues,
|
|
13767
|
+
isFocusVisibleSupported
|
|
13768
|
+
]);
|
|
13769
|
+
const endEvent = React.useCallback(()=>{
|
|
13770
|
+
if (interactionState === "focused") {
|
|
13771
|
+
actions.selectLast();
|
|
13772
|
+
focusTriggerByValue(enabledValues[enabledValues.length - 1] ?? "");
|
|
13773
|
+
if (isFocusVisibleSupported) {
|
|
13774
|
+
setIsFocusVisible(true);
|
|
13775
|
+
}
|
|
13776
|
+
}
|
|
13777
|
+
}, [
|
|
13778
|
+
interactionState,
|
|
13779
|
+
actions.selectLast,
|
|
13780
|
+
focusTriggerByValue,
|
|
13781
|
+
enabledValues,
|
|
13782
|
+
isFocusVisibleSupported
|
|
13783
|
+
]);
|
|
13784
|
+
const tabFocusEvent = React.useCallback((value)=>{
|
|
13785
|
+
actions.setFocusedValue(value);
|
|
13786
|
+
if (interactionState === "idle") {
|
|
13787
|
+
setInteractionState("focused");
|
|
13788
|
+
}
|
|
13789
|
+
}, [
|
|
13790
|
+
interactionState,
|
|
13791
|
+
actions.setFocusedValue
|
|
13792
|
+
]);
|
|
13793
|
+
const tabBlurEvent = React.useCallback(()=>{
|
|
13794
|
+
if (interactionState === "focused") {
|
|
13795
|
+
actions.clearFocusedValue();
|
|
13796
|
+
setInteractionState("idle");
|
|
13797
|
+
}
|
|
13798
|
+
}, [
|
|
13799
|
+
interactionState,
|
|
13800
|
+
actions.clearFocusedValue
|
|
13801
|
+
]);
|
|
13802
|
+
const tabClickEvent = React.useCallback((value)=>{
|
|
13803
|
+
actions.setValue(value);
|
|
13804
|
+
if (interactionState === "idle") {
|
|
13805
|
+
setInteractionState("focused");
|
|
13806
|
+
}
|
|
13807
|
+
}, [
|
|
13808
|
+
interactionState,
|
|
13809
|
+
actions.setValue
|
|
13810
|
+
]);
|
|
13811
|
+
const setValueEvent = React.useCallback((value)=>{
|
|
13812
|
+
actions.setValue(value);
|
|
13813
|
+
}, [
|
|
13814
|
+
actions.setValue
|
|
13815
|
+
]);
|
|
13816
|
+
const selectNextEvent = React.useCallback(()=>{
|
|
13817
|
+
if (interactionState === "focused") {
|
|
13818
|
+
actions.selectNext();
|
|
13819
|
+
if (isFocusVisibleSupported) {
|
|
13820
|
+
setIsFocusVisible(true);
|
|
13821
|
+
}
|
|
13822
|
+
}
|
|
13823
|
+
}, [
|
|
13824
|
+
interactionState,
|
|
13825
|
+
actions.selectNext,
|
|
13826
|
+
isFocusVisibleSupported
|
|
13827
|
+
]);
|
|
13828
|
+
const selectPrevEvent = React.useCallback(()=>{
|
|
13829
|
+
if (interactionState === "focused") {
|
|
13830
|
+
actions.selectPrev();
|
|
13831
|
+
if (isFocusVisibleSupported) {
|
|
13832
|
+
setIsFocusVisible(true);
|
|
13833
|
+
}
|
|
13834
|
+
}
|
|
13835
|
+
}, [
|
|
13836
|
+
interactionState,
|
|
13837
|
+
actions.selectPrev,
|
|
13838
|
+
isFocusVisibleSupported
|
|
13839
|
+
]);
|
|
13840
|
+
const setContentIndexEvent = React.useCallback((index)=>{
|
|
13841
|
+
const valueFromIndex = enabledValues[index];
|
|
13842
|
+
if (!valueFromIndex) return;
|
|
13843
|
+
actions.setValue(valueFromIndex);
|
|
13844
|
+
}, [
|
|
13845
|
+
actions.setValue,
|
|
13846
|
+
enabledValues
|
|
13847
|
+
]);
|
|
13848
|
+
const setIsFocusVisibleEvent = React.useCallback((isFocusVisible)=>{
|
|
13849
|
+
setIsFocusVisible(isFocusVisible);
|
|
13850
|
+
}, []);
|
|
13851
|
+
const setSelectedTriggerElEvent = React.useCallback((element)=>{
|
|
13852
|
+
setSelectedTriggerEl(element);
|
|
13853
|
+
}, []);
|
|
13854
|
+
const events = {
|
|
13855
|
+
arrowPrev: arrowPrevEvent,
|
|
13856
|
+
arrowNext: arrowNextEvent,
|
|
13857
|
+
arrowUp: arrowUpEvent,
|
|
13858
|
+
arrowDown: arrowDownEvent,
|
|
13859
|
+
home: homeEvent,
|
|
13860
|
+
end: endEvent,
|
|
13861
|
+
tabFocus: tabFocusEvent,
|
|
13862
|
+
tabBlur: tabBlurEvent,
|
|
13863
|
+
tabClick: tabClickEvent,
|
|
13864
|
+
setValue: setValueEvent,
|
|
13865
|
+
selectNext: selectNextEvent,
|
|
13866
|
+
selectPrev: selectPrevEvent,
|
|
13867
|
+
setContentIndex: setContentIndexEvent,
|
|
13868
|
+
setIsFocusVisible: setIsFocusVisibleEvent,
|
|
13869
|
+
setSelectedTriggerEl: setSelectedTriggerElEvent
|
|
13870
|
+
};
|
|
13871
|
+
const refs = React.useMemo(()=>({
|
|
13872
|
+
list: listRef
|
|
13873
|
+
}), []);
|
|
13874
|
+
const triggerRect = React.useMemo(()=>({
|
|
13875
|
+
width: selectedTriggerSize?.width ?? selectedTriggerEl?.offsetWidth ?? 0,
|
|
13876
|
+
left: selectedTriggerEl?.offsetLeft ?? 0
|
|
13877
|
+
}), [
|
|
13878
|
+
selectedTriggerSize,
|
|
13879
|
+
selectedTriggerEl
|
|
13880
|
+
]);
|
|
13881
|
+
const isSSR = useIsSSR();
|
|
13882
|
+
return {
|
|
13883
|
+
refs,
|
|
13884
|
+
interactionState,
|
|
13885
|
+
value,
|
|
13886
|
+
isSSR,
|
|
13887
|
+
triggerRect,
|
|
13888
|
+
focusedValue,
|
|
13889
|
+
isFocusVisible,
|
|
13890
|
+
contentIndex,
|
|
13891
|
+
events,
|
|
13892
|
+
isFocusVisibleSupported
|
|
13893
|
+
};
|
|
13894
|
+
}
|
|
13895
|
+
function useTabs(props) {
|
|
13896
|
+
const autoId = React.useId();
|
|
13897
|
+
const { refs, interactionState, value, isSSR, events, triggerRect, focusedValue, isFocusVisible, contentIndex, isFocusVisibleSupported } = useTabsState(props);
|
|
13898
|
+
const { orientation = "horizontal" } = props;
|
|
13899
|
+
const focused = interactionState === "focused";
|
|
13900
|
+
const stateProps = React.useMemo(()=>domUtils.elementProps({
|
|
13901
|
+
"data-orientation": orientation,
|
|
13902
|
+
"data-focus": domUtils.dataAttr(focused),
|
|
13903
|
+
"data-ssr": domUtils.dataAttr(isSSR)
|
|
13904
|
+
}), [
|
|
13905
|
+
orientation,
|
|
13906
|
+
focused,
|
|
13907
|
+
isSSR
|
|
13908
|
+
]);
|
|
13909
|
+
return {
|
|
13910
|
+
refs,
|
|
13911
|
+
value,
|
|
13912
|
+
contentIndex,
|
|
13913
|
+
triggerRect,
|
|
13914
|
+
selectNext: events.selectNext,
|
|
13915
|
+
selectPrev: events.selectPrev,
|
|
13916
|
+
setValue: events.setValue,
|
|
13917
|
+
setContentIndex: events.setContentIndex,
|
|
13918
|
+
stateProps,
|
|
13919
|
+
rootProps: domUtils.elementProps({
|
|
13920
|
+
...stateProps,
|
|
13921
|
+
style: {
|
|
13922
|
+
"--indicator-left": `${triggerRect.left}px`,
|
|
13923
|
+
"--indicator-width": `${triggerRect.width}px`
|
|
13924
|
+
}
|
|
13925
|
+
}),
|
|
13926
|
+
listProps: domUtils.elementProps({
|
|
13927
|
+
id: getListId(autoId),
|
|
13928
|
+
role: "tablist",
|
|
13929
|
+
"aria-orientation": orientation,
|
|
13930
|
+
...stateProps,
|
|
13931
|
+
onKeyDown (event) {
|
|
13932
|
+
if (event.defaultPrevented) return;
|
|
13933
|
+
if (event.nativeEvent.isComposing) return;
|
|
13934
|
+
// TODO: support activationMode="manual"
|
|
13935
|
+
switch(event.key){
|
|
13936
|
+
case "ArrowLeft":
|
|
13937
|
+
if (orientation !== "horizontal") return;
|
|
13938
|
+
event.preventDefault();
|
|
13939
|
+
events.arrowPrev();
|
|
13940
|
+
break;
|
|
13941
|
+
case "ArrowRight":
|
|
13942
|
+
if (orientation !== "horizontal") return;
|
|
13943
|
+
event.preventDefault();
|
|
13944
|
+
events.arrowNext();
|
|
13945
|
+
break;
|
|
13946
|
+
case "ArrowUp":
|
|
13947
|
+
if (orientation !== "vertical") return;
|
|
13948
|
+
event.preventDefault();
|
|
13949
|
+
events.arrowPrev();
|
|
13950
|
+
break;
|
|
13951
|
+
case "ArrowDown":
|
|
13952
|
+
if (orientation !== "vertical") return;
|
|
13953
|
+
event.preventDefault();
|
|
13954
|
+
events.arrowNext();
|
|
13955
|
+
break;
|
|
13956
|
+
case "Home":
|
|
13957
|
+
{
|
|
13958
|
+
event.preventDefault();
|
|
13959
|
+
events.home();
|
|
13960
|
+
break;
|
|
13961
|
+
}
|
|
13962
|
+
case "End":
|
|
13963
|
+
{
|
|
13964
|
+
event.preventDefault();
|
|
13965
|
+
events.end();
|
|
13966
|
+
break;
|
|
13967
|
+
}
|
|
13968
|
+
}
|
|
13969
|
+
}
|
|
13970
|
+
}),
|
|
13971
|
+
getTriggerProps: (props)=>{
|
|
13972
|
+
const { disabled: isDisabled, value: triggerValue } = props;
|
|
13973
|
+
const itemState = {
|
|
13974
|
+
isDisabled,
|
|
13975
|
+
isSelected: value === triggerValue,
|
|
13976
|
+
isFocused: focusedValue === triggerValue
|
|
13977
|
+
};
|
|
13978
|
+
const itemStateProps = {
|
|
13979
|
+
"data-focus": domUtils.dataAttr(itemState.isFocused),
|
|
13980
|
+
"data-focus-visible": domUtils.dataAttr(itemState.isFocused && isFocusVisible),
|
|
13981
|
+
"data-selected": domUtils.dataAttr(itemState.isSelected),
|
|
13982
|
+
"data-disabled": domUtils.dataAttr(itemState.isDisabled),
|
|
13983
|
+
"data-ssr": domUtils.dataAttr(isSSR),
|
|
13984
|
+
"aria-disabled": domUtils.ariaAttr(itemState.isDisabled),
|
|
13985
|
+
"aria-selected": domUtils.ariaAttr(itemState.isSelected)
|
|
13986
|
+
};
|
|
13987
|
+
const ref = (element)=>{
|
|
13988
|
+
if (element && triggerValue === value) {
|
|
13989
|
+
events.setSelectedTriggerEl(element);
|
|
13990
|
+
}
|
|
13991
|
+
};
|
|
13992
|
+
return {
|
|
13993
|
+
...itemState,
|
|
13994
|
+
refs: {
|
|
13995
|
+
root: ref
|
|
13996
|
+
},
|
|
13997
|
+
stateProps: itemStateProps,
|
|
13998
|
+
rootProps: domUtils.buttonProps({
|
|
13999
|
+
id: getTriggerId(triggerValue, autoId),
|
|
14000
|
+
role: "tab",
|
|
14001
|
+
type: "button",
|
|
14002
|
+
disabled: isDisabled,
|
|
14003
|
+
tabIndex: itemState.isSelected ? 0 : -1,
|
|
14004
|
+
...itemStateProps,
|
|
14005
|
+
"data-value": triggerValue,
|
|
14006
|
+
"data-orientation": orientation,
|
|
14007
|
+
"data-ownedby": getListId(autoId),
|
|
14008
|
+
"aria-controls": getContentId(triggerValue, autoId),
|
|
14009
|
+
onClick (event) {
|
|
14010
|
+
if (itemState.isDisabled) return;
|
|
14011
|
+
if (event.defaultPrevented) return;
|
|
14012
|
+
events.tabClick(triggerValue);
|
|
14013
|
+
},
|
|
14014
|
+
onFocus (event) {
|
|
14015
|
+
events.tabFocus(props.value);
|
|
14016
|
+
if (isFocusVisibleSupported) {
|
|
14017
|
+
events.setIsFocusVisible(event.target.matches(":focus-visible"));
|
|
14018
|
+
}
|
|
14019
|
+
},
|
|
14020
|
+
onBlur (event) {
|
|
14021
|
+
const target = event.relatedTarget;
|
|
14022
|
+
if (target?.getAttribute("role") !== "tab") {
|
|
14023
|
+
events.tabBlur();
|
|
14024
|
+
}
|
|
14025
|
+
if (isFocusVisibleSupported) {
|
|
14026
|
+
events.setIsFocusVisible(false);
|
|
14027
|
+
}
|
|
14028
|
+
}
|
|
14029
|
+
})
|
|
14030
|
+
};
|
|
14031
|
+
},
|
|
14032
|
+
getContentProps: (props)=>{
|
|
14033
|
+
const { value: contentValue } = props;
|
|
14034
|
+
const triggerId = getTriggerId(contentValue, autoId);
|
|
14035
|
+
const isSelected = value === contentValue;
|
|
14036
|
+
return domUtils.elementProps({
|
|
14037
|
+
id: getContentId(contentValue, autoId),
|
|
14038
|
+
tabIndex: -1,
|
|
14039
|
+
role: "tabpanel",
|
|
14040
|
+
"aria-labelledby": triggerId,
|
|
14041
|
+
"aria-selected": domUtils.ariaAttr(isSelected),
|
|
14042
|
+
"aria-hidden": !isSelected,
|
|
14043
|
+
"data-selected": domUtils.dataAttr(isSelected),
|
|
14044
|
+
"data-orientation": orientation,
|
|
14045
|
+
"data-ownedby": getListId(autoId),
|
|
14046
|
+
"data-ssr": domUtils.dataAttr(isSSR)
|
|
14047
|
+
});
|
|
14048
|
+
},
|
|
14049
|
+
indicatorProps: domUtils.elementProps({
|
|
14050
|
+
...stateProps
|
|
14051
|
+
})
|
|
14052
|
+
};
|
|
14053
|
+
}
|
|
14054
|
+
const TabsContext = /*#__PURE__*/ React.createContext(null);
|
|
14055
|
+
const TabsProvider = TabsContext.Provider;
|
|
14056
|
+
function useTabsContext({ strict = true } = {}) {
|
|
14057
|
+
const context = React.useContext(TabsContext);
|
|
14058
|
+
if (!context && strict) {
|
|
14059
|
+
throw new Error("useTabsContext must be used within a Tabs");
|
|
14060
|
+
}
|
|
14061
|
+
return context;
|
|
14062
|
+
}
|
|
14063
|
+
const autoHeight = AutoHeight();
|
|
14064
|
+
const plugins = [
|
|
14065
|
+
autoHeight
|
|
14066
|
+
];
|
|
14067
|
+
const useTabsCarouselState = (props)=>{
|
|
14068
|
+
const api = useTabsContext();
|
|
14069
|
+
const slideHeights = React.useRef(new WeakMap());
|
|
14070
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
14071
|
+
loop: props.loop,
|
|
14072
|
+
dragThreshold: props.dragThreshold,
|
|
14073
|
+
duration: 20,
|
|
14074
|
+
watchDrag: (_, event)=>{
|
|
14075
|
+
if (event.target instanceof HTMLElement) {
|
|
14076
|
+
if (isDragPrevented(event.target)) {
|
|
14077
|
+
return false;
|
|
14078
|
+
}
|
|
14079
|
+
}
|
|
14080
|
+
return true;
|
|
14081
|
+
},
|
|
14082
|
+
// Workaround for Embla v8 AutoHeight plugin not detecting lazy-loaded content height changes.
|
|
14083
|
+
// ref: https://github.com/davidjerleke/embla-carousel/discussions/1142
|
|
14084
|
+
// Embla's default resize handler only reInits on axis-size (width, for a horizontal carousel)
|
|
14085
|
+
// changes, so a slide growing taller (e.g. after lazy mount) never triggers a recalculation.
|
|
14086
|
+
// We reInit manually, but ONLY when a slide's *height* actually changes — reInit-ing on every
|
|
14087
|
+
// slide resize (including width fluctuations during horizontal scroll) re-applies Embla's
|
|
14088
|
+
// translate3d mid-scroll and breaks momentum scrolling in WKWebView/Safari.
|
|
14089
|
+
watchResize: (emblaApi, entries)=>{
|
|
14090
|
+
const heights = slideHeights.current;
|
|
14091
|
+
const slides = emblaApi.slideNodes();
|
|
14092
|
+
for (const entry of entries){
|
|
14093
|
+
const slide = slides.find((node)=>node === entry.target);
|
|
14094
|
+
if (!slide) continue;
|
|
14095
|
+
const newHeight = slide.offsetHeight;
|
|
14096
|
+
const prevHeight = heights.get(slide);
|
|
14097
|
+
heights.set(slide, newHeight);
|
|
14098
|
+
if (prevHeight !== undefined && newHeight !== prevHeight) {
|
|
14099
|
+
emblaApi.reInit();
|
|
14100
|
+
return false;
|
|
14101
|
+
}
|
|
14102
|
+
}
|
|
14103
|
+
return true;
|
|
14104
|
+
}
|
|
14105
|
+
}, plugins);
|
|
14106
|
+
const onSettle = useCallbackRef(props.onSettle);
|
|
14107
|
+
const onSwipeStart = useCallbackRef(props.onSwipeStart);
|
|
14108
|
+
const onSwipeEnd = useCallbackRef(props.onSwipeEnd);
|
|
14109
|
+
React.useEffect(()=>{
|
|
14110
|
+
const select = emblaApi?.on("select", ()=>{
|
|
14111
|
+
const contentIndex = emblaApi.selectedScrollSnap();
|
|
14112
|
+
api.setContentIndex(contentIndex);
|
|
14113
|
+
});
|
|
14114
|
+
const settle = emblaApi?.on("settle", ()=>{
|
|
14115
|
+
onSettle?.();
|
|
14116
|
+
});
|
|
14117
|
+
const pointerDown = emblaApi?.on("pointerDown", ()=>{
|
|
14118
|
+
onSwipeStart?.();
|
|
14119
|
+
});
|
|
14120
|
+
const pointerUp = emblaApi?.on("pointerUp", ()=>{
|
|
14121
|
+
onSwipeEnd?.();
|
|
14122
|
+
});
|
|
14123
|
+
return ()=>{
|
|
14124
|
+
select?.clear();
|
|
14125
|
+
settle?.clear();
|
|
14126
|
+
pointerDown?.clear();
|
|
14127
|
+
pointerUp?.clear();
|
|
14128
|
+
};
|
|
14129
|
+
}, [
|
|
14130
|
+
emblaApi,
|
|
14131
|
+
api.setContentIndex,
|
|
14132
|
+
onSettle,
|
|
14133
|
+
onSwipeStart,
|
|
14134
|
+
onSwipeEnd
|
|
14135
|
+
]);
|
|
14136
|
+
const getContentIndex = useCallbackRef(()=>api.contentIndex);
|
|
14137
|
+
React.useEffect(()=>{
|
|
14138
|
+
const reInit = emblaApi?.on("reInit", ()=>{
|
|
14139
|
+
emblaApi?.scrollTo(getContentIndex(), true);
|
|
14140
|
+
});
|
|
14141
|
+
return ()=>{
|
|
14142
|
+
reInit?.clear();
|
|
14143
|
+
};
|
|
14144
|
+
}, [
|
|
14145
|
+
getContentIndex,
|
|
14146
|
+
emblaApi
|
|
14147
|
+
]);
|
|
14148
|
+
React.useEffect(()=>{
|
|
14149
|
+
if (!emblaApi) return;
|
|
14150
|
+
const { dragHandler } = emblaApi.internalEngine();
|
|
14151
|
+
if (props.swipeable) {
|
|
14152
|
+
dragHandler.init(emblaApi);
|
|
14153
|
+
} else {
|
|
14154
|
+
dragHandler.destroy();
|
|
14155
|
+
}
|
|
14156
|
+
}, [
|
|
14157
|
+
emblaApi,
|
|
14158
|
+
props.swipeable
|
|
14159
|
+
]);
|
|
14160
|
+
const isInitialScroll = React.useRef(true);
|
|
14161
|
+
React.useEffect(()=>{
|
|
14162
|
+
if (emblaApi && api.contentIndex !== emblaApi.selectedScrollSnap()) {
|
|
14163
|
+
const engine = emblaApi.internalEngine();
|
|
14164
|
+
/**
|
|
14165
|
+
* We want the content to quickly snap into place when a tab changes.
|
|
14166
|
+
* However, using a very small duration can result in an underdamped spring, which produces a rubber-band (oscillatory) effect.
|
|
14167
|
+
*
|
|
14168
|
+
* To avoid that, we intentionally use a low duration and friction so that the motion feels fast (snappy)
|
|
14169
|
+
* without overshooting. The underlying idea is to map our parameters to a physical spring model—a damped harmonic oscillator—
|
|
14170
|
+
* so we can control the dynamics in a physically intuitive way.
|
|
14171
|
+
*
|
|
14172
|
+
* In embla, the acceleration is modeled as:
|
|
14173
|
+
* a = (displacement * friction) / duration - velocity * (1 - friction)
|
|
14174
|
+
*
|
|
14175
|
+
* In a classical damped harmonic oscillator (assuming unit mass, m = 1), the acceleration is:
|
|
14176
|
+
* a = (stiffness * displacement - damping * velocity)
|
|
14177
|
+
*
|
|
14178
|
+
* By comparing the two equations, we can equate the coefficients for displacement and velocity:
|
|
14179
|
+
*
|
|
14180
|
+
* For the displacement term:
|
|
14181
|
+
* stiffness = friction / duration
|
|
14182
|
+
*
|
|
14183
|
+
* For the velocity term:
|
|
14184
|
+
* damping = 1 - friction
|
|
14185
|
+
*
|
|
14186
|
+
* Additionally, the damping ratio (zeta) for a damped oscillator is defined as:
|
|
14187
|
+
* zeta = damping / (2 * sqrt(stiffness))
|
|
14188
|
+
*
|
|
14189
|
+
* Substituting the derived expressions for stiffness and damping gives:
|
|
14190
|
+
* zeta = (1 - friction) / (2 * sqrt(friction / duration))
|
|
14191
|
+
*
|
|
14192
|
+
* This damping ratio (zeta) tells us the nature of the response:
|
|
14193
|
+
* - zeta < 1: Underdamped (oscillatory, rubber-band effect)
|
|
14194
|
+
* - zeta = 1: Critically damped (fast snap without overshoot)
|
|
14195
|
+
* - zeta > 1: Overdamped (slow response)
|
|
14196
|
+
*
|
|
14197
|
+
* For our current configuration, we use:
|
|
14198
|
+
*
|
|
14199
|
+
* duration = 4
|
|
14200
|
+
* friction = 0.4
|
|
14201
|
+
*
|
|
14202
|
+
* Which gives:
|
|
14203
|
+
*
|
|
14204
|
+
* stiffness = 0.4 / 4 = 0.1
|
|
14205
|
+
* damping = 1 - 0.4 = 0.6
|
|
14206
|
+
*
|
|
14207
|
+
* And the damping ratio becomes:
|
|
14208
|
+
*
|
|
14209
|
+
* zeta = 0.6 / (2 * sqrt(0.1))
|
|
14210
|
+
* = 0.6 / (2 * 0.31623...)
|
|
14211
|
+
* = 0.6 / 0.63246...
|
|
14212
|
+
* = 0.94868...
|
|
14213
|
+
*
|
|
14214
|
+
* Since zeta is close to 1, this spring is nearly critically damped. This is enough for our usage,
|
|
14215
|
+
* ensuring that the animation snaps quickly without overshooting (avoiding the rubber-band effect)
|
|
14216
|
+
* when switching tabs.
|
|
14217
|
+
*/ if (isInitialScroll.current) {
|
|
14218
|
+
engine.scrollBody.useDuration(0);
|
|
14219
|
+
isInitialScroll.current = false;
|
|
14220
|
+
} else {
|
|
14221
|
+
engine.scrollBody.useDuration(4).useFriction(0.4);
|
|
14222
|
+
}
|
|
14223
|
+
engine.scrollTo.index(api.contentIndex, 0);
|
|
14224
|
+
}
|
|
14225
|
+
}, [
|
|
14226
|
+
emblaApi,
|
|
14227
|
+
api.contentIndex
|
|
14228
|
+
]);
|
|
14229
|
+
return {
|
|
14230
|
+
refs: {
|
|
14231
|
+
root: emblaRef
|
|
14232
|
+
},
|
|
14233
|
+
autoHeight: props.autoHeight
|
|
14234
|
+
};
|
|
14235
|
+
};
|
|
14236
|
+
const useTabsCarousel = (props)=>{
|
|
14237
|
+
const { refs, autoHeight } = useTabsCarouselState(props);
|
|
14238
|
+
const stateProps = domUtils.elementProps({
|
|
14239
|
+
"data-carousel": "",
|
|
14240
|
+
"data-auto-height": domUtils.dataAttr(autoHeight)
|
|
14241
|
+
});
|
|
14242
|
+
return {
|
|
14243
|
+
refs,
|
|
14244
|
+
stateProps,
|
|
14245
|
+
rootProps: domUtils.elementProps({
|
|
14246
|
+
...stateProps
|
|
14247
|
+
}),
|
|
14248
|
+
cameraProps: domUtils.elementProps({
|
|
14249
|
+
...stateProps
|
|
14250
|
+
})
|
|
14251
|
+
};
|
|
14252
|
+
};
|
|
14253
|
+
const TabsCarouselContext = /*#__PURE__*/ React.createContext(null);
|
|
14254
|
+
const TabsCarouselProvider = TabsCarouselContext.Provider;
|
|
14255
|
+
function useTabsCarouselContext({ strict = true } = {}) {
|
|
14256
|
+
const context = React.useContext(TabsCarouselContext);
|
|
14257
|
+
if (!context && strict) {
|
|
14258
|
+
throw new Error("useTabsCarouselContext must be used within a TabsCarousel");
|
|
14259
|
+
}
|
|
14260
|
+
return context;
|
|
14261
|
+
}
|
|
14262
|
+
const TabsTriggerContext = /*#__PURE__*/ React.createContext(null);
|
|
14263
|
+
const TabsTriggerProvider = TabsTriggerContext.Provider;
|
|
14264
|
+
const TabsRoot$1 = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
14265
|
+
const { defaultValue, value, onValueChange, orientation, lazyMount, unmountOnExit, ...otherProps } = props;
|
|
14266
|
+
const api = useTabs({
|
|
14267
|
+
defaultValue,
|
|
14268
|
+
value,
|
|
14269
|
+
onValueChange,
|
|
14270
|
+
orientation
|
|
14271
|
+
});
|
|
14272
|
+
return /*#__PURE__*/ jsxRuntime.jsx(TabsProvider, {
|
|
14273
|
+
value: api,
|
|
14274
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(RenderStrategyPropsProvider, {
|
|
14275
|
+
value: React.useMemo(()=>({
|
|
14276
|
+
lazyMount,
|
|
14277
|
+
unmountOnExit
|
|
14278
|
+
}), [
|
|
14279
|
+
lazyMount,
|
|
14280
|
+
unmountOnExit
|
|
14281
|
+
]),
|
|
14282
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14283
|
+
ref: ref,
|
|
14284
|
+
...domUtils.mergeProps(api.rootProps, otherProps)
|
|
14285
|
+
})
|
|
14286
|
+
})
|
|
14287
|
+
});
|
|
14288
|
+
});
|
|
14289
|
+
TabsRoot$1.displayName = "TabsRoot";
|
|
14290
|
+
const TabsList$1 = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
14291
|
+
const api = useTabsContext();
|
|
14292
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14293
|
+
ref: composeRefs(api.refs.list, ref),
|
|
14294
|
+
...domUtils.mergeProps(api.listProps, props)
|
|
14295
|
+
});
|
|
14296
|
+
});
|
|
14297
|
+
TabsList$1.displayName = "TabsList";
|
|
14298
|
+
const TabsTrigger$1 = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
14299
|
+
const { value, disabled, ...otherProps } = props;
|
|
14300
|
+
const api = useTabsContext();
|
|
14301
|
+
const triggerApi = api.getTriggerProps({
|
|
14302
|
+
value,
|
|
14303
|
+
disabled
|
|
14304
|
+
});
|
|
14305
|
+
return /*#__PURE__*/ jsxRuntime.jsx(TabsTriggerProvider, {
|
|
14306
|
+
value: triggerApi,
|
|
14307
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Primitive.button, {
|
|
14308
|
+
ref: composeRefs(triggerApi.refs.root, ref),
|
|
14309
|
+
...domUtils.mergeProps(triggerApi.rootProps, otherProps)
|
|
14310
|
+
})
|
|
14311
|
+
});
|
|
14312
|
+
});
|
|
14313
|
+
TabsTrigger$1.displayName = "TabsTrigger";
|
|
14314
|
+
const TabsContent$1 = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
14315
|
+
const { value, children, ...otherProps } = props;
|
|
14316
|
+
const api = useTabsContext();
|
|
14317
|
+
const carouselApi = useTabsCarouselContext({
|
|
14318
|
+
strict: false
|
|
14319
|
+
});
|
|
14320
|
+
const inCarousel = carouselApi != null;
|
|
14321
|
+
const renderStrategyProps = useRenderStrategyPropsContext();
|
|
14322
|
+
const { unmounted } = useRenderStrategy({
|
|
14323
|
+
...renderStrategyProps,
|
|
14324
|
+
present: api.value === value
|
|
14325
|
+
});
|
|
14326
|
+
// Outside a carousel, an unmounted tab renders nothing at all.
|
|
14327
|
+
// Inside a carousel, every tab must keep its slide slot even while unmounted:
|
|
14328
|
+
// the carousel syncs by numeric index, so collapsing the slide set (returning
|
|
14329
|
+
// null for lazy/exited tabs) makes embla's snap index drift from the tab's
|
|
14330
|
+
// logical index, and clicking/swiping to a far tab lands on the wrong one.
|
|
14331
|
+
// We keep the slot but still honor lazyMount/unmountOnExit for the children,
|
|
14332
|
+
// so expensive content stays lazy — only the empty slide wrapper persists.
|
|
14333
|
+
if (unmounted && !inCarousel) return null;
|
|
14334
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14335
|
+
ref: ref,
|
|
14336
|
+
...domUtils.mergeProps(api.getContentProps({
|
|
14337
|
+
value
|
|
14338
|
+
}), carouselApi?.stateProps ?? {}, otherProps),
|
|
14339
|
+
children: unmounted ? null : children
|
|
14340
|
+
});
|
|
14341
|
+
});
|
|
14342
|
+
TabsContent$1.displayName = "TabsContent";
|
|
14343
|
+
const TabsIndicator$1 = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
14344
|
+
const api = useTabsContext();
|
|
14345
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14346
|
+
ref: ref,
|
|
14347
|
+
...domUtils.mergeProps(api.indicatorProps, props)
|
|
14348
|
+
});
|
|
14349
|
+
});
|
|
14350
|
+
const TabsCarousel = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
14351
|
+
const { dragThreshold, loop, swipeable, autoHeight, onSettle, onSwipeStart, onSwipeEnd, ...otherProps } = props;
|
|
14352
|
+
const api = useTabsCarousel({
|
|
14353
|
+
dragThreshold,
|
|
14354
|
+
loop,
|
|
14355
|
+
swipeable,
|
|
14356
|
+
onSettle,
|
|
14357
|
+
autoHeight,
|
|
14358
|
+
onSwipeStart,
|
|
14359
|
+
onSwipeEnd
|
|
14360
|
+
});
|
|
14361
|
+
return /*#__PURE__*/ jsxRuntime.jsx(TabsCarouselProvider, {
|
|
14362
|
+
value: api,
|
|
14363
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14364
|
+
ref: composeRefs(api.refs.root, ref),
|
|
14365
|
+
...domUtils.mergeProps(api.rootProps, otherProps),
|
|
14366
|
+
children: props.children
|
|
14367
|
+
})
|
|
14368
|
+
});
|
|
14369
|
+
});
|
|
14370
|
+
TabsCarousel.displayName = "TabsCarousel";
|
|
14371
|
+
const TabsCarouselCamera = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
14372
|
+
const api = useTabsCarouselContext();
|
|
14373
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14374
|
+
ref: ref,
|
|
14375
|
+
...domUtils.mergeProps(api.cameraProps, props)
|
|
14376
|
+
});
|
|
14377
|
+
});
|
|
14378
|
+
TabsCarouselCamera.displayName = "TabsCarouselCamera";
|
|
14379
|
+
|
|
14380
|
+
var Tabs_namespace = {
|
|
14381
|
+
__proto__: null,
|
|
14382
|
+
Carousel: TabsCarousel,
|
|
14383
|
+
CarouselCamera: TabsCarouselCamera,
|
|
14384
|
+
Content: TabsContent$1,
|
|
14385
|
+
Indicator: TabsIndicator$1,
|
|
14386
|
+
List: TabsList$1,
|
|
14387
|
+
Root: TabsRoot$1,
|
|
14388
|
+
Trigger: TabsTrigger$1};
|
|
14389
|
+
|
|
14390
|
+
const { withProvider, withContext } = createSlotRecipeContext(tabs.tabs);
|
|
14391
|
+
const TabsRoot = withProvider(Tabs_namespace.Root, "root");
|
|
14392
|
+
const TabsList = withContext(Tabs_namespace.List, "list");
|
|
14393
|
+
const TabsTrigger = withScaleFeedback(withContext(Tabs_namespace.Trigger, "trigger"));
|
|
14394
|
+
const TabsIndicator = withContext(Tabs_namespace.Indicator, "indicator");
|
|
14395
|
+
const TabsContent = withContext(Tabs_namespace.Content, "content");
|
|
14396
|
+
withContext(Tabs_namespace.Carousel, "carousel");
|
|
14397
|
+
withContext(Tabs_namespace.CarouselCamera, "carouselCamera");
|
|
14398
|
+
|
|
14399
|
+
const RESIZE_MIN_WIDTH = 360;
|
|
14400
|
+
const RESIZE_MAX_WIDTH = 720;
|
|
14401
|
+
/**
|
|
14402
|
+
* Right-side record peek panel -- Attio's own peek shows a Highlights card
|
|
14403
|
+
* area and an Activity feed (measured live). Ported from your-moon/crisp's
|
|
14404
|
+
* `RecordPanel` (`product/recordpanel/`), built ON `ResizablePanel`
|
|
14405
|
+
* (`side="right" floating`) rather than crisp's own duplicate absolute-
|
|
14406
|
+
* positioning/slide-in/resize-handle implementation -- the outer shell (the
|
|
14407
|
+
* enter/exit keyframe animation, the full-height overlay, the drag handle
|
|
14408
|
+
* itself) all come from that primitive; this component only renders the
|
|
14409
|
+
* CONTENT inside it.
|
|
14410
|
+
*
|
|
14411
|
+
* OVERLAY, not docked: `floating` (on the `ResizablePanel` this is built on)
|
|
14412
|
+
* now means a real `position: absolute` overlay that reserves ZERO layout
|
|
14413
|
+
* width -- opening this panel never shrinks or reflows a table beside it
|
|
14414
|
+
* (your-moon/crisp#448 reversed an earlier in-flow/docked attempt at this
|
|
14415
|
+
* exact spot, reported live as "table's action buttons moving"). Because of
|
|
14416
|
+
* that, THIS COMPONENT OWNS ITS OWN POSITIONING -- a consumer does not wrap
|
|
14417
|
+
* it in a flex row with the table; it renders `<RecordPreview>` as an
|
|
14418
|
+
* ordinary sibling of the table. The one requirement: the shared parent
|
|
14419
|
+
* (the table region's own wrapper) must itself be a positioned element
|
|
14420
|
+
* (typically `position: relative`) with a real height, since that's the
|
|
14421
|
+
* containing block this panel's `inset: 0` resolves against. See
|
|
14422
|
+
* `DataTable.stories.tsx`'s own Showcase for the pattern:
|
|
14423
|
+
*
|
|
14424
|
+
* ```tsx
|
|
14425
|
+
* <div style={{ position: "relative", flex: 1, minHeight: 0 }}>
|
|
14426
|
+
* <DataTable style={{ width: "100%", height: "100%" }} ... />
|
|
14427
|
+
* <RecordPreview open={open} record={record} onClose={onClose} ... />
|
|
14428
|
+
* </div>
|
|
14429
|
+
* ```
|
|
14430
|
+
*
|
|
14431
|
+
* Enter/exit: closing this panel is a state change (`open` -> false) that
|
|
14432
|
+
* typically clears `record` in the SAME update (see the DataTable story's
|
|
14433
|
+
* own `onClose={() => setPreviewRow(null)}`), so by the time an exit
|
|
14434
|
+
* animation should play, the values this component would render are
|
|
14435
|
+
* already gone. `usePresence` (`@seed-design/react-presence`, the same
|
|
14436
|
+
* idiom Dialog/Drawer already use for their own floating layers) keeps the
|
|
14437
|
+
* tree mounted for exactly the exit animation's duration; the snapshot
|
|
14438
|
+
* below keeps the LAST visible props around for that same window, since
|
|
14439
|
+
* without it the panel would animate out empty.
|
|
14440
|
+
*/ function RecordPreview(props) {
|
|
14441
|
+
const shouldRender = props.open && props.record != null;
|
|
14442
|
+
const { isPresent, ref: panelElementRef } = usePresence(shouldRender);
|
|
14443
|
+
const lastVisiblePropsRef = React.useRef(props);
|
|
14444
|
+
if (shouldRender) lastVisiblePropsRef.current = props;
|
|
14445
|
+
if (!isPresent) return null;
|
|
14446
|
+
return /*#__PURE__*/ jsxRuntime.jsx(RecordPreviewPanel, {
|
|
14447
|
+
...shouldRender ? props : lastVisiblePropsRef.current,
|
|
14448
|
+
animationState: shouldRender ? "open" : "closed",
|
|
14449
|
+
panelElementRef: panelElementRef
|
|
14450
|
+
});
|
|
14451
|
+
}
|
|
14452
|
+
RecordPreview.displayName = "RecordPreview";
|
|
14453
|
+
function RecordPreviewPanel({ open: _open, record, onClose, className, animationState, panelElementRef, closeLabel = "Close panel", onOpenRecord, openRecordLabel = "Open record", onPrevious, previousRecordLabel = "Previous record", onNext, nextRecordLabel = "Next record", title, avatar, highlightsLabel = "Highlights", highlights, counterLabel, resizable = false, width, defaultWidth = 497, onWidthChange, minWidth = RESIZE_MIN_WIDTH, maxWidth = RESIZE_MAX_WIDTH, activityLabel = "Activity", viewAllActivityLabel = "View all", onViewAllActivity, activity, sections, tabs, activeTab, defaultActiveTab, onTabChange, overviewTabLabel = "Overview", footer, backdrop = false, ...rest }) {
|
|
14454
|
+
const titleId = React.useId();
|
|
14455
|
+
const classNames = recordPreview();
|
|
14456
|
+
// Which sections (your-moon/crisp#413) are expanded -- uncontrolled and
|
|
14457
|
+
// independent (Attio's own Emails/Notes/Tasks open without closing one
|
|
14458
|
+
// another): a plain `Set`, reset whenever the record itself changes so a
|
|
14459
|
+
// stale open section doesn't carry over between two different records.
|
|
14460
|
+
const [openSections, setOpenSections] = React.useState(()=>new Set());
|
|
14461
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: `record` is read as a change TRIGGER, not a value the effect body needs -- reset whenever it changes identity, regardless of what it now points to.
|
|
14462
|
+
React.useEffect(()=>{
|
|
14463
|
+
setOpenSections(new Set());
|
|
14464
|
+
}, [
|
|
14465
|
+
record
|
|
14466
|
+
]);
|
|
14467
|
+
const toggleSection = (key)=>setOpenSections((prev)=>{
|
|
14468
|
+
const next = new Set(prev);
|
|
14469
|
+
if (next.has(key)) next.delete(key);
|
|
14470
|
+
else next.add(key);
|
|
14471
|
+
return next;
|
|
14472
|
+
});
|
|
14473
|
+
// Close on Escape. Simpler than crisp's own version (crisp additionally
|
|
14474
|
+
// checks `hasOpenFloatingLayer()` so an Escape meant for a nested Menu/
|
|
14475
|
+
// Select/Popover doesn't also close this panel) -- crispy-seed has no
|
|
14476
|
+
// equivalent floating-stack registry to read, so a consumer nesting its
|
|
14477
|
+
// own floating layers inside `footer`/`sections` content should stop
|
|
14478
|
+
// propagation on its own Escape handler. This component is only ever
|
|
14479
|
+
// mounted (by `RecordPreview`, above) while genuinely open or animating
|
|
14480
|
+
// out, so there's no separate `open` flag to gate on here.
|
|
14481
|
+
React.useEffect(()=>{
|
|
14482
|
+
const onKey = (event)=>{
|
|
14483
|
+
if (event.key === "Escape") onClose();
|
|
11816
14484
|
};
|
|
11817
14485
|
document.addEventListener("keydown", onKey);
|
|
11818
14486
|
return ()=>document.removeEventListener("keydown", onKey);
|
|
@@ -11822,9 +14490,143 @@ function RecordPreviewPanel({ open: _open, record, onClose, className, animation
|
|
|
11822
14490
|
// Defensive only -- `RecordPreview` never mounts this without a record.
|
|
11823
14491
|
if (!record) return null;
|
|
11824
14492
|
const heading = title ?? record.name ?? "Record";
|
|
14493
|
+
// The plain (non-tabs) layout -- unchanged from before `tabs` existed.
|
|
14494
|
+
// Extracted so it can ALSO become the synthesized "Overview" tab's own
|
|
14495
|
+
// content below, rather than being re-authored as JSX twice.
|
|
14496
|
+
const overviewContent = /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
14497
|
+
children: [
|
|
14498
|
+
highlights && highlights.length > 0 && /*#__PURE__*/ jsxRuntime.jsxs(Primitive.div, {
|
|
14499
|
+
className: classNames.section,
|
|
14500
|
+
children: [
|
|
14501
|
+
/*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14502
|
+
className: classNames.sectionHead,
|
|
14503
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
14504
|
+
className: classNames.sectionLabel,
|
|
14505
|
+
children: highlightsLabel
|
|
14506
|
+
})
|
|
14507
|
+
}),
|
|
14508
|
+
/*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14509
|
+
className: classNames.highlights,
|
|
14510
|
+
children: highlights.map((h)=>/*#__PURE__*/ jsxRuntime.jsxs(Primitive.div, {
|
|
14511
|
+
className: classNames.highlight,
|
|
14512
|
+
children: [
|
|
14513
|
+
/*#__PURE__*/ jsxRuntime.jsxs(Primitive.span, {
|
|
14514
|
+
className: classNames.highlightLabel,
|
|
14515
|
+
children: [
|
|
14516
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
14517
|
+
children: h.label
|
|
14518
|
+
}),
|
|
14519
|
+
h.icon ? /*#__PURE__*/ jsxRuntime.jsx(h.icon, {
|
|
14520
|
+
size: 16
|
|
14521
|
+
}) : null
|
|
14522
|
+
]
|
|
14523
|
+
}),
|
|
14524
|
+
/*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
14525
|
+
className: classNames.highlightValue,
|
|
14526
|
+
children: h.value
|
|
14527
|
+
})
|
|
14528
|
+
]
|
|
14529
|
+
}, h.key))
|
|
14530
|
+
})
|
|
14531
|
+
]
|
|
14532
|
+
}),
|
|
14533
|
+
activity != null && /*#__PURE__*/ jsxRuntime.jsxs(Primitive.div, {
|
|
14534
|
+
className: classNames.section,
|
|
14535
|
+
children: [
|
|
14536
|
+
/*#__PURE__*/ jsxRuntime.jsxs(Primitive.div, {
|
|
14537
|
+
className: classNames.sectionHead,
|
|
14538
|
+
children: [
|
|
14539
|
+
/*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
14540
|
+
className: classNames.sectionLabel,
|
|
14541
|
+
children: activityLabel
|
|
14542
|
+
}),
|
|
14543
|
+
onViewAllActivity && /*#__PURE__*/ jsxRuntime.jsx(Primitive.button, {
|
|
14544
|
+
type: "button",
|
|
14545
|
+
className: classNames.sectionAction,
|
|
14546
|
+
onClick: onViewAllActivity,
|
|
14547
|
+
children: viewAllActivityLabel
|
|
14548
|
+
})
|
|
14549
|
+
]
|
|
14550
|
+
}),
|
|
14551
|
+
/*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14552
|
+
className: classNames.activity,
|
|
14553
|
+
children: activity
|
|
14554
|
+
})
|
|
14555
|
+
]
|
|
14556
|
+
}),
|
|
14557
|
+
sections && sections.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14558
|
+
className: classNames.sections,
|
|
14559
|
+
children: sections.map((s)=>{
|
|
14560
|
+
const isOpen = openSections.has(s.key);
|
|
14561
|
+
const panelId = `${titleId}-section-${s.key}`;
|
|
14562
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
14563
|
+
children: [
|
|
14564
|
+
s.content ? /*#__PURE__*/ jsxRuntime.jsxs(Primitive.button, {
|
|
14565
|
+
type: "button",
|
|
14566
|
+
className: classNames.sectionTrigger,
|
|
14567
|
+
"aria-expanded": isOpen,
|
|
14568
|
+
"aria-controls": panelId,
|
|
14569
|
+
onClick: ()=>toggleSection(s.key),
|
|
14570
|
+
children: [
|
|
14571
|
+
/*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
14572
|
+
className: classNames.sectionRowLabel,
|
|
14573
|
+
children: s.label
|
|
14574
|
+
}),
|
|
14575
|
+
/*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
14576
|
+
className: classNames.sectionRowCount,
|
|
14577
|
+
children: s.count
|
|
14578
|
+
}),
|
|
14579
|
+
/*#__PURE__*/ jsxRuntime.jsx(IconChevronDownLine_default, {
|
|
14580
|
+
className: classNames.sectionChevron,
|
|
14581
|
+
size: 14,
|
|
14582
|
+
"data-open": isOpen ? "" : undefined,
|
|
14583
|
+
"aria-hidden": "true"
|
|
14584
|
+
})
|
|
14585
|
+
]
|
|
14586
|
+
}) : /*#__PURE__*/ jsxRuntime.jsxs(Primitive.div, {
|
|
14587
|
+
className: classNames.sectionTrigger,
|
|
14588
|
+
"data-inert": "",
|
|
14589
|
+
children: [
|
|
14590
|
+
/*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
14591
|
+
className: classNames.sectionRowLabel,
|
|
14592
|
+
children: s.label
|
|
14593
|
+
}),
|
|
14594
|
+
/*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
14595
|
+
className: classNames.sectionRowCount,
|
|
14596
|
+
children: s.count
|
|
14597
|
+
})
|
|
14598
|
+
]
|
|
14599
|
+
}),
|
|
14600
|
+
s.content && isOpen && /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14601
|
+
id: panelId,
|
|
14602
|
+
className: classNames.sectionContent,
|
|
14603
|
+
children: s.content
|
|
14604
|
+
})
|
|
14605
|
+
]
|
|
14606
|
+
}, s.key);
|
|
14607
|
+
})
|
|
14608
|
+
})
|
|
14609
|
+
]
|
|
14610
|
+
});
|
|
14611
|
+
// Combine (`tabs`'s own doc comment): when there's ALSO plain overview
|
|
14612
|
+
// content given alongside `tabs`, prepend a synthesized tab carrying it,
|
|
14613
|
+
// ahead of the consumer's own tabs -- so `tabs` and the simpler Highlights/
|
|
14614
|
+
// Activity/sections props stay usable TOGETHER rather than one silently
|
|
14615
|
+
// replacing the other.
|
|
14616
|
+
const hasOverviewContent = highlights && highlights.length > 0 || activity != null || sections && sections.length > 0;
|
|
14617
|
+
const allTabs = tabs && hasOverviewContent ? [
|
|
14618
|
+
{
|
|
14619
|
+
key: "__overview",
|
|
14620
|
+
label: overviewTabLabel,
|
|
14621
|
+
content: overviewContent
|
|
14622
|
+
},
|
|
14623
|
+
...tabs
|
|
14624
|
+
] : tabs ?? [];
|
|
11825
14625
|
return /*#__PURE__*/ jsxRuntime.jsx(ResizablePanel, {
|
|
11826
14626
|
side: "right",
|
|
11827
14627
|
floating: true,
|
|
14628
|
+
backdrop: backdrop,
|
|
14629
|
+
onBackdropClick: onClose,
|
|
11828
14630
|
animationState: animationState,
|
|
11829
14631
|
panelElementRef: panelElementRef,
|
|
11830
14632
|
resizable: resizable,
|
|
@@ -11914,121 +14716,49 @@ function RecordPreviewPanel({ open: _open, record, onClose, className, animation
|
|
|
11914
14716
|
})
|
|
11915
14717
|
]
|
|
11916
14718
|
}),
|
|
11917
|
-
/*#__PURE__*/ jsxRuntime.
|
|
11918
|
-
className: classNames.
|
|
11919
|
-
children:
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
/*#__PURE__*/ jsxRuntime.jsxs(Primitive.span, {
|
|
11936
|
-
className: classNames.highlightLabel,
|
|
11937
|
-
children: [
|
|
11938
|
-
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
11939
|
-
children: h.label
|
|
11940
|
-
}),
|
|
11941
|
-
h.icon ? /*#__PURE__*/ jsxRuntime.jsx(h.icon, {
|
|
11942
|
-
size: 16
|
|
11943
|
-
}) : null
|
|
11944
|
-
]
|
|
11945
|
-
}),
|
|
11946
|
-
/*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
11947
|
-
className: classNames.highlightValue,
|
|
11948
|
-
children: h.value
|
|
11949
|
-
})
|
|
11950
|
-
]
|
|
11951
|
-
}, h.key))
|
|
11952
|
-
})
|
|
11953
|
-
]
|
|
11954
|
-
}),
|
|
11955
|
-
activity != null && /*#__PURE__*/ jsxRuntime.jsxs(Primitive.div, {
|
|
11956
|
-
className: classNames.section,
|
|
11957
|
-
children: [
|
|
11958
|
-
/*#__PURE__*/ jsxRuntime.jsxs(Primitive.div, {
|
|
11959
|
-
className: classNames.sectionHead,
|
|
11960
|
-
children: [
|
|
11961
|
-
/*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
11962
|
-
className: classNames.sectionLabel,
|
|
11963
|
-
children: activityLabel
|
|
11964
|
-
}),
|
|
11965
|
-
onViewAllActivity && /*#__PURE__*/ jsxRuntime.jsx(Primitive.button, {
|
|
11966
|
-
type: "button",
|
|
11967
|
-
className: classNames.sectionAction,
|
|
11968
|
-
onClick: onViewAllActivity,
|
|
11969
|
-
children: viewAllActivityLabel
|
|
11970
|
-
})
|
|
11971
|
-
]
|
|
11972
|
-
}),
|
|
11973
|
-
/*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
11974
|
-
className: classNames.activity,
|
|
11975
|
-
children: activity
|
|
11976
|
-
})
|
|
11977
|
-
]
|
|
11978
|
-
}),
|
|
11979
|
-
sections && sections.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
11980
|
-
className: classNames.sections,
|
|
11981
|
-
children: sections.map((s)=>{
|
|
11982
|
-
const isOpen = openSections.has(s.key);
|
|
11983
|
-
const panelId = `${titleId}-section-${s.key}`;
|
|
11984
|
-
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
11985
|
-
children: [
|
|
11986
|
-
s.content ? /*#__PURE__*/ jsxRuntime.jsxs(Primitive.button, {
|
|
11987
|
-
type: "button",
|
|
11988
|
-
className: classNames.sectionTrigger,
|
|
11989
|
-
"aria-expanded": isOpen,
|
|
11990
|
-
"aria-controls": panelId,
|
|
11991
|
-
onClick: ()=>toggleSection(s.key),
|
|
11992
|
-
children: [
|
|
11993
|
-
/*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
11994
|
-
className: classNames.sectionRowLabel,
|
|
11995
|
-
children: s.label
|
|
11996
|
-
}),
|
|
11997
|
-
/*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
11998
|
-
className: classNames.sectionRowCount,
|
|
11999
|
-
children: s.count
|
|
12000
|
-
}),
|
|
12001
|
-
/*#__PURE__*/ jsxRuntime.jsx(IconChevronDownLine_default, {
|
|
12002
|
-
className: classNames.sectionChevron,
|
|
12003
|
-
size: 14,
|
|
12004
|
-
"data-open": isOpen ? "" : undefined,
|
|
12005
|
-
"aria-hidden": "true"
|
|
12006
|
-
})
|
|
12007
|
-
]
|
|
12008
|
-
}) : /*#__PURE__*/ jsxRuntime.jsxs(Primitive.div, {
|
|
12009
|
-
className: classNames.sectionTrigger,
|
|
12010
|
-
"data-inert": "",
|
|
14719
|
+
tabs && tabs.length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14720
|
+
className: classNames.tabsRoot,
|
|
14721
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(TabsRoot, {
|
|
14722
|
+
value: activeTab,
|
|
14723
|
+
defaultValue: defaultActiveTab ?? allTabs[0]?.key,
|
|
14724
|
+
onValueChange: onTabChange,
|
|
14725
|
+
style: {
|
|
14726
|
+
display: "flex",
|
|
14727
|
+
flexDirection: "column",
|
|
14728
|
+
flex: "1 1 auto",
|
|
14729
|
+
minHeight: 0,
|
|
14730
|
+
overflow: "hidden"
|
|
14731
|
+
},
|
|
14732
|
+
children: [
|
|
14733
|
+
/*#__PURE__*/ jsxRuntime.jsxs(TabsList, {
|
|
14734
|
+
children: [
|
|
14735
|
+
allTabs.map((tab)=>/*#__PURE__*/ jsxRuntime.jsxs(TabsTrigger, {
|
|
14736
|
+
value: tab.key,
|
|
12011
14737
|
children: [
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
/*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
12017
|
-
className: classNames.sectionRowCount,
|
|
12018
|
-
children: s.count
|
|
14738
|
+
tab.label,
|
|
14739
|
+
tab.badge != null && /*#__PURE__*/ jsxRuntime.jsx(Primitive.span, {
|
|
14740
|
+
className: classNames.tabBadge,
|
|
14741
|
+
children: tab.badge
|
|
12019
14742
|
})
|
|
12020
14743
|
]
|
|
12021
|
-
}),
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
14744
|
+
}, tab.key)),
|
|
14745
|
+
/*#__PURE__*/ jsxRuntime.jsx(TabsIndicator, {})
|
|
14746
|
+
]
|
|
14747
|
+
}),
|
|
14748
|
+
allTabs.map((tab)=>/*#__PURE__*/ jsxRuntime.jsx(TabsContent, {
|
|
14749
|
+
value: tab.key,
|
|
14750
|
+
className: classNames.tabPanel,
|
|
14751
|
+
style: {
|
|
14752
|
+
flex: "1 1 auto",
|
|
14753
|
+
minHeight: 0
|
|
14754
|
+
},
|
|
14755
|
+
children: tab.content
|
|
14756
|
+
}, tab.key))
|
|
14757
|
+
]
|
|
14758
|
+
})
|
|
14759
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
14760
|
+
className: classNames.body,
|
|
14761
|
+
children: overviewContent
|
|
12032
14762
|
}),
|
|
12033
14763
|
footer != null && /*#__PURE__*/ jsxRuntime.jsx(Primitive.div, {
|
|
12034
14764
|
className: classNames.footer,
|