shadcn-glass-ui 2.1.4 → 2.2.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/CHANGELOG.md +51 -0
- package/README.md +13 -13
- package/context7.json +30 -4
- package/dist/cli/index.cjs +1 -1
- package/dist/components.cjs +4 -4
- package/dist/components.d.ts +18 -4
- package/dist/components.js +1 -1
- package/dist/hooks.cjs +2 -2
- package/dist/index.cjs +2320 -997
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2284 -996
- package/dist/index.js.map +1 -1
- package/dist/shadcn-glass-ui.css +1 -1
- package/dist/{theme-context-Y98bGvcm.cjs → theme-context-D_cb9KzA.cjs} +2 -2
- package/dist/{theme-context-Y98bGvcm.cjs.map → theme-context-D_cb9KzA.cjs.map} +1 -1
- package/dist/themes.cjs +1 -1
- package/dist/{trust-score-card-glass-2rjz00d_.cjs → trust-score-card-glass-CTsEVRD3.cjs} +178 -35
- package/dist/{trust-score-card-glass-2rjz00d_.cjs.map → trust-score-card-glass-CTsEVRD3.cjs.map} +1 -1
- package/dist/{trust-score-card-glass-zjkx4OC2.js → trust-score-card-glass-CUStm4o_.js} +86 -15
- package/dist/{trust-score-card-glass-zjkx4OC2.js.map → trust-score-card-glass-CUStm4o_.js.map} +1 -1
- package/dist/{use-focus-DbpBEuee.cjs → use-focus--Hw2nevi.cjs} +2 -2
- package/dist/{use-focus-DbpBEuee.cjs.map → use-focus--Hw2nevi.cjs.map} +1 -1
- package/dist/{use-wallpaper-tint-DbawS9zh.cjs → use-wallpaper-tint-B4oMQsXQ.cjs} +2 -2
- package/dist/{use-wallpaper-tint-DbawS9zh.cjs.map → use-wallpaper-tint-B4oMQsXQ.cjs.map} +1 -1
- package/dist/{utils-XlyXIhuP.cjs → utils-BqeJ4aco.cjs} +2 -2
- package/dist/{utils-XlyXIhuP.cjs.map → utils-BqeJ4aco.cjs.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/docs/AI_USAGE.md +5 -5
- package/docs/BEST_PRACTICES.md +1 -1
- package/docs/COMPONENTS_CATALOG.md +215 -0
- package/docs/EXPORTS_MAP.json +140 -14
- package/docs/EXPORTS_STRUCTURE.md +43 -9
- package/docs/GETTING_STARTED.md +1 -1
- package/docs/REGISTRY_USAGE.md +1 -1
- package/docs/api/README.md +1 -1
- package/docs/components/SIDEBAR_GLASS.md +555 -0
- package/docs/components/SPLIT_LAYOUT_GLASS.md +304 -365
- package/package.json +6 -3
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_trust_score_card_glass = require("./trust-score-card-glass-
|
|
2
|
-
const require_utils = require("./utils-
|
|
3
|
-
const require_use_focus = require("./use-focus
|
|
4
|
-
const require_theme_context = require("./theme-context-
|
|
5
|
-
const require_use_wallpaper_tint = require("./use-wallpaper-tint-
|
|
1
|
+
const require_trust_score_card_glass = require("./trust-score-card-glass-CTsEVRD3.cjs");
|
|
2
|
+
const require_utils = require("./utils-BqeJ4aco.cjs");
|
|
3
|
+
const require_use_focus = require("./use-focus--Hw2nevi.cjs");
|
|
4
|
+
const require_theme_context = require("./theme-context-D_cb9KzA.cjs");
|
|
5
|
+
const require_use_wallpaper_tint = require("./use-wallpaper-tint-B4oMQsXQ.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
react = require_trust_score_card_glass.__toESM(react);
|
|
8
8
|
let lucide_react = require("lucide-react");
|
|
@@ -12,6 +12,9 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
12
12
|
let __radix_ui_react_slot = require("@radix-ui/react-slot");
|
|
13
13
|
let react_dom = require("react-dom");
|
|
14
14
|
react_dom = require_trust_score_card_glass.__toESM(react_dom);
|
|
15
|
+
let __radix_ui_react_dialog = require("@radix-ui/react-dialog");
|
|
16
|
+
__radix_ui_react_dialog = require_trust_score_card_glass.__toESM(__radix_ui_react_dialog);
|
|
17
|
+
let __radix_ui_react_toggle = require("@radix-ui/react-toggle");
|
|
15
18
|
const stepperRootVariants = (0, class_variance_authority.cva)("flex w-full", {
|
|
16
19
|
variants: { orientation: {
|
|
17
20
|
horizontal: "flex-col",
|
|
@@ -372,63 +375,666 @@ const StepperGlass = {
|
|
|
372
375
|
Step: StepperStep,
|
|
373
376
|
Content: StepperContent
|
|
374
377
|
};
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
378
|
+
function createContextScope$3(scopeName, createContextScopeDeps = []) {
|
|
379
|
+
let defaultContexts = [];
|
|
380
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
381
|
+
const BaseContext = react.createContext(defaultContext);
|
|
382
|
+
const index = defaultContexts.length;
|
|
383
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
384
|
+
const Provider = (props) => {
|
|
385
|
+
const { scope, children, ...context } = props;
|
|
386
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
387
|
+
const value = react.useMemo(() => context, Object.values(context));
|
|
388
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Context.Provider, {
|
|
389
|
+
value,
|
|
390
|
+
children
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
394
|
+
function useContext2(consumerName, scope) {
|
|
395
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
396
|
+
const context = react.useContext(Context);
|
|
397
|
+
if (context) return context;
|
|
398
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
399
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
400
|
+
}
|
|
401
|
+
return [Provider, useContext2];
|
|
402
|
+
}
|
|
403
|
+
const createScope = () => {
|
|
404
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
405
|
+
return react.createContext(defaultContext);
|
|
406
|
+
});
|
|
407
|
+
return function useScope(scope) {
|
|
408
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
409
|
+
return react.useMemo(() => ({ [`__scope${scopeName}`]: {
|
|
410
|
+
...scope,
|
|
411
|
+
[scopeName]: contexts
|
|
412
|
+
} }), [scope, contexts]);
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
createScope.scopeName = scopeName;
|
|
416
|
+
return [createContext3, composeContextScopes$4(createScope, ...createContextScopeDeps)];
|
|
383
417
|
}
|
|
384
|
-
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
418
|
+
function composeContextScopes$4(...scopes) {
|
|
419
|
+
const baseScope = scopes[0];
|
|
420
|
+
if (scopes.length === 1) return baseScope;
|
|
421
|
+
const createScope = () => {
|
|
422
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
423
|
+
useScope: createScope2(),
|
|
424
|
+
scopeName: createScope2.scopeName
|
|
425
|
+
}));
|
|
426
|
+
return function useComposedScopes(overrideScopes) {
|
|
427
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
428
|
+
const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
|
|
429
|
+
return {
|
|
430
|
+
...nextScopes2,
|
|
431
|
+
...currentScope
|
|
432
|
+
};
|
|
433
|
+
}, {});
|
|
434
|
+
return react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
createScope.scopeName = baseScope.scopeName;
|
|
438
|
+
return createScope;
|
|
439
|
+
}
|
|
440
|
+
var Primitive$4 = [
|
|
441
|
+
"a",
|
|
442
|
+
"button",
|
|
443
|
+
"div",
|
|
444
|
+
"form",
|
|
445
|
+
"h2",
|
|
446
|
+
"h3",
|
|
447
|
+
"img",
|
|
448
|
+
"input",
|
|
449
|
+
"label",
|
|
450
|
+
"li",
|
|
451
|
+
"nav",
|
|
452
|
+
"ol",
|
|
453
|
+
"p",
|
|
454
|
+
"select",
|
|
455
|
+
"span",
|
|
456
|
+
"svg",
|
|
457
|
+
"ul"
|
|
458
|
+
].reduce((primitive, node) => {
|
|
459
|
+
const Slot$3 = (0, __radix_ui_react_slot.createSlot)(`Primitive.${node}`);
|
|
460
|
+
const Node = react.forwardRef((props, forwardedRef) => {
|
|
461
|
+
const { asChild, ...primitiveProps } = props;
|
|
462
|
+
const Comp = asChild ? Slot$3 : node;
|
|
463
|
+
if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
|
|
464
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
|
|
465
|
+
...primitiveProps,
|
|
466
|
+
ref: forwardedRef
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
Node.displayName = `Primitive.${node}`;
|
|
470
|
+
return {
|
|
471
|
+
...primitive,
|
|
472
|
+
[node]: Node
|
|
473
|
+
};
|
|
474
|
+
}, {});
|
|
475
|
+
function createContextScope$4(scopeName, createContextScopeDeps = []) {
|
|
476
|
+
let defaultContexts = [];
|
|
477
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
478
|
+
const BaseContext = react.createContext(defaultContext);
|
|
479
|
+
const index = defaultContexts.length;
|
|
480
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
481
|
+
const Provider = (props) => {
|
|
482
|
+
const { scope, children, ...context } = props;
|
|
483
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
484
|
+
const value = react.useMemo(() => context, Object.values(context));
|
|
485
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Context.Provider, {
|
|
486
|
+
value,
|
|
487
|
+
children
|
|
488
|
+
});
|
|
489
|
+
};
|
|
490
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
491
|
+
function useContext2(consumerName, scope) {
|
|
492
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
493
|
+
const context = react.useContext(Context);
|
|
494
|
+
if (context) return context;
|
|
495
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
496
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
389
497
|
}
|
|
390
|
-
return
|
|
498
|
+
return [Provider, useContext2];
|
|
499
|
+
}
|
|
500
|
+
const createScope = () => {
|
|
501
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
502
|
+
return react.createContext(defaultContext);
|
|
503
|
+
});
|
|
504
|
+
return function useScope(scope) {
|
|
505
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
506
|
+
return react.useMemo(() => ({ [`__scope${scopeName}`]: {
|
|
507
|
+
...scope,
|
|
508
|
+
[scopeName]: contexts
|
|
509
|
+
} }), [scope, contexts]);
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
createScope.scopeName = scopeName;
|
|
513
|
+
return [createContext3, composeContextScopes$3(createScope, ...createContextScopeDeps)];
|
|
514
|
+
}
|
|
515
|
+
function composeContextScopes$3(...scopes) {
|
|
516
|
+
const baseScope = scopes[0];
|
|
517
|
+
if (scopes.length === 1) return baseScope;
|
|
518
|
+
const createScope = () => {
|
|
519
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
520
|
+
useScope: createScope2(),
|
|
521
|
+
scopeName: createScope2.scopeName
|
|
522
|
+
}));
|
|
523
|
+
return function useComposedScopes(overrideScopes) {
|
|
524
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
525
|
+
const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
|
|
526
|
+
return {
|
|
527
|
+
...nextScopes2,
|
|
528
|
+
...currentScope
|
|
529
|
+
};
|
|
530
|
+
}, {});
|
|
531
|
+
return react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
532
|
+
};
|
|
533
|
+
};
|
|
534
|
+
createScope.scopeName = baseScope.scopeName;
|
|
535
|
+
return createScope;
|
|
536
|
+
}
|
|
537
|
+
var Primitive$5 = [
|
|
538
|
+
"a",
|
|
539
|
+
"button",
|
|
540
|
+
"div",
|
|
541
|
+
"form",
|
|
542
|
+
"h2",
|
|
543
|
+
"h3",
|
|
544
|
+
"img",
|
|
545
|
+
"input",
|
|
546
|
+
"label",
|
|
547
|
+
"li",
|
|
548
|
+
"nav",
|
|
549
|
+
"ol",
|
|
550
|
+
"p",
|
|
551
|
+
"select",
|
|
552
|
+
"span",
|
|
553
|
+
"svg",
|
|
554
|
+
"ul"
|
|
555
|
+
].reduce((primitive, node) => {
|
|
556
|
+
const Slot$3 = (0, __radix_ui_react_slot.createSlot)(`Primitive.${node}`);
|
|
557
|
+
const Node = react.forwardRef((props, forwardedRef) => {
|
|
558
|
+
const { asChild, ...primitiveProps } = props;
|
|
559
|
+
const Comp = asChild ? Slot$3 : node;
|
|
560
|
+
if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
|
|
561
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
|
|
562
|
+
...primitiveProps,
|
|
563
|
+
ref: forwardedRef
|
|
564
|
+
});
|
|
391
565
|
});
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
566
|
+
Node.displayName = `Primitive.${node}`;
|
|
567
|
+
return {
|
|
568
|
+
...primitive,
|
|
569
|
+
[node]: Node
|
|
570
|
+
};
|
|
571
|
+
}, {});
|
|
572
|
+
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
573
|
+
var EVENT_OPTIONS = {
|
|
574
|
+
bubbles: false,
|
|
575
|
+
cancelable: true
|
|
576
|
+
};
|
|
577
|
+
var GROUP_NAME = "RovingFocusGroup";
|
|
578
|
+
var [Collection, useCollection, createCollectionScope] = require_trust_score_card_glass.createCollection(GROUP_NAME);
|
|
579
|
+
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope$4(GROUP_NAME, [createCollectionScope]);
|
|
580
|
+
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
581
|
+
var RovingFocusGroup = react.forwardRef((props, forwardedRef) => {
|
|
582
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collection.Provider, {
|
|
583
|
+
scope: props.__scopeRovingFocusGroup,
|
|
584
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collection.Slot, {
|
|
585
|
+
scope: props.__scopeRovingFocusGroup,
|
|
586
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RovingFocusGroupImpl, {
|
|
587
|
+
...props,
|
|
588
|
+
ref: forwardedRef
|
|
589
|
+
})
|
|
590
|
+
})
|
|
407
591
|
});
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
592
|
+
});
|
|
593
|
+
RovingFocusGroup.displayName = GROUP_NAME;
|
|
594
|
+
var RovingFocusGroupImpl = react.forwardRef((props, forwardedRef) => {
|
|
595
|
+
const { __scopeRovingFocusGroup, orientation, loop = false, dir, currentTabStopId: currentTabStopIdProp, defaultCurrentTabStopId, onCurrentTabStopIdChange, onEntryFocus, preventScrollOnEntryFocus = false, ...groupProps } = props;
|
|
596
|
+
const ref = react.useRef(null);
|
|
597
|
+
const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref);
|
|
598
|
+
const direction = require_trust_score_card_glass.useDirection(dir);
|
|
599
|
+
const [currentTabStopId, setCurrentTabStopId] = require_trust_score_card_glass.useControllableState({
|
|
600
|
+
prop: currentTabStopIdProp,
|
|
601
|
+
defaultProp: defaultCurrentTabStopId ?? null,
|
|
602
|
+
onChange: onCurrentTabStopIdChange,
|
|
603
|
+
caller: GROUP_NAME
|
|
604
|
+
});
|
|
605
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = react.useState(false);
|
|
606
|
+
const handleEntryFocus = require_trust_score_card_glass.useCallbackRef(onEntryFocus);
|
|
607
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
608
|
+
const isClickFocusRef = react.useRef(false);
|
|
609
|
+
const [focusableItemsCount, setFocusableItemsCount] = react.useState(0);
|
|
610
|
+
react.useEffect(() => {
|
|
611
|
+
const node = ref.current;
|
|
612
|
+
if (node) {
|
|
613
|
+
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
614
|
+
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
615
|
+
}
|
|
616
|
+
}, [handleEntryFocus]);
|
|
617
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RovingFocusProvider, {
|
|
618
|
+
scope: __scopeRovingFocusGroup,
|
|
619
|
+
orientation,
|
|
620
|
+
dir: direction,
|
|
621
|
+
loop,
|
|
622
|
+
currentTabStopId,
|
|
623
|
+
onItemFocus: react.useCallback((tabStopId) => setCurrentTabStopId(tabStopId), [setCurrentTabStopId]),
|
|
624
|
+
onItemShiftTab: react.useCallback(() => setIsTabbingBackOut(true), []),
|
|
625
|
+
onFocusableItemAdd: react.useCallback(() => setFocusableItemsCount((prevCount) => prevCount + 1), []),
|
|
626
|
+
onFocusableItemRemove: react.useCallback(() => setFocusableItemsCount((prevCount) => prevCount - 1), []),
|
|
627
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$5.div, {
|
|
628
|
+
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
629
|
+
"data-orientation": orientation,
|
|
630
|
+
...groupProps,
|
|
631
|
+
ref: composedRefs,
|
|
632
|
+
style: {
|
|
633
|
+
outline: "none",
|
|
634
|
+
...props.style
|
|
635
|
+
},
|
|
636
|
+
onMouseDown: require_trust_score_card_glass.composeEventHandlers(props.onMouseDown, () => {
|
|
637
|
+
isClickFocusRef.current = true;
|
|
638
|
+
}),
|
|
639
|
+
onFocus: require_trust_score_card_glass.composeEventHandlers(props.onFocus, (event) => {
|
|
640
|
+
const isKeyboardFocus = !isClickFocusRef.current;
|
|
641
|
+
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
642
|
+
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
643
|
+
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
644
|
+
if (!entryFocusEvent.defaultPrevented) {
|
|
645
|
+
const items = getItems().filter((item) => item.focusable);
|
|
646
|
+
focusFirst([
|
|
647
|
+
items.find((item) => item.active),
|
|
648
|
+
items.find((item) => item.id === currentTabStopId),
|
|
649
|
+
...items
|
|
650
|
+
].filter(Boolean).map((item) => item.ref.current), preventScrollOnEntryFocus);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
isClickFocusRef.current = false;
|
|
654
|
+
}),
|
|
655
|
+
onBlur: require_trust_score_card_glass.composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
|
|
656
|
+
})
|
|
657
|
+
});
|
|
658
|
+
});
|
|
659
|
+
var ITEM_NAME$2 = "RovingFocusGroupItem";
|
|
660
|
+
var RovingFocusGroupItem = react.forwardRef((props, forwardedRef) => {
|
|
661
|
+
const { __scopeRovingFocusGroup, focusable = true, active = false, tabStopId, children, ...itemProps } = props;
|
|
662
|
+
const autoId = require_trust_score_card_glass.useId();
|
|
663
|
+
const id = tabStopId || autoId;
|
|
664
|
+
const context = useRovingFocusContext(ITEM_NAME$2, __scopeRovingFocusGroup);
|
|
665
|
+
const isCurrentTabStop = context.currentTabStopId === id;
|
|
666
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
667
|
+
const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
|
|
668
|
+
react.useEffect(() => {
|
|
669
|
+
if (focusable) {
|
|
670
|
+
onFocusableItemAdd();
|
|
671
|
+
return () => onFocusableItemRemove();
|
|
672
|
+
}
|
|
422
673
|
}, [
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
674
|
+
focusable,
|
|
675
|
+
onFocusableItemAdd,
|
|
676
|
+
onFocusableItemRemove
|
|
426
677
|
]);
|
|
427
|
-
(0,
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
678
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collection.ItemSlot, {
|
|
679
|
+
scope: __scopeRovingFocusGroup,
|
|
680
|
+
id,
|
|
681
|
+
focusable,
|
|
682
|
+
active,
|
|
683
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$5.span, {
|
|
684
|
+
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
685
|
+
"data-orientation": context.orientation,
|
|
686
|
+
...itemProps,
|
|
687
|
+
ref: forwardedRef,
|
|
688
|
+
onMouseDown: require_trust_score_card_glass.composeEventHandlers(props.onMouseDown, (event) => {
|
|
689
|
+
if (!focusable) event.preventDefault();
|
|
690
|
+
else context.onItemFocus(id);
|
|
691
|
+
}),
|
|
692
|
+
onFocus: require_trust_score_card_glass.composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
|
|
693
|
+
onKeyDown: require_trust_score_card_glass.composeEventHandlers(props.onKeyDown, (event) => {
|
|
694
|
+
if (event.key === "Tab" && event.shiftKey) {
|
|
695
|
+
context.onItemShiftTab();
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
if (event.target !== event.currentTarget) return;
|
|
699
|
+
const focusIntent = getFocusIntent(event, context.orientation, context.dir);
|
|
700
|
+
if (focusIntent !== void 0) {
|
|
701
|
+
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
702
|
+
event.preventDefault();
|
|
703
|
+
let candidateNodes = getItems().filter((item) => item.focusable).map((item) => item.ref.current);
|
|
704
|
+
if (focusIntent === "last") candidateNodes.reverse();
|
|
705
|
+
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
706
|
+
if (focusIntent === "prev") candidateNodes.reverse();
|
|
707
|
+
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
708
|
+
candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
709
|
+
}
|
|
710
|
+
setTimeout(() => focusFirst(candidateNodes));
|
|
711
|
+
}
|
|
712
|
+
}),
|
|
713
|
+
children: typeof children === "function" ? children({
|
|
714
|
+
isCurrentTabStop,
|
|
715
|
+
hasTabStop: currentTabStopId != null
|
|
716
|
+
}) : children
|
|
717
|
+
})
|
|
718
|
+
});
|
|
719
|
+
});
|
|
720
|
+
RovingFocusGroupItem.displayName = ITEM_NAME$2;
|
|
721
|
+
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
722
|
+
ArrowLeft: "prev",
|
|
723
|
+
ArrowUp: "prev",
|
|
724
|
+
ArrowRight: "next",
|
|
725
|
+
ArrowDown: "next",
|
|
726
|
+
PageUp: "first",
|
|
727
|
+
Home: "first",
|
|
728
|
+
PageDown: "last",
|
|
729
|
+
End: "last"
|
|
730
|
+
};
|
|
731
|
+
function getDirectionAwareKey(key, dir) {
|
|
732
|
+
if (dir !== "rtl") return key;
|
|
733
|
+
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
734
|
+
}
|
|
735
|
+
function getFocusIntent(event, orientation, dir) {
|
|
736
|
+
const key = getDirectionAwareKey(event.key, dir);
|
|
737
|
+
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
738
|
+
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
739
|
+
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
740
|
+
}
|
|
741
|
+
function focusFirst(candidates, preventScroll = false) {
|
|
742
|
+
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
743
|
+
for (const candidate of candidates) {
|
|
744
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
745
|
+
candidate.focus({ preventScroll });
|
|
746
|
+
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
function wrapArray(array, startIndex) {
|
|
750
|
+
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
751
|
+
}
|
|
752
|
+
var Root$3 = RovingFocusGroup;
|
|
753
|
+
var Item = RovingFocusGroupItem;
|
|
754
|
+
var TOGGLE_GROUP_NAME = "ToggleGroup";
|
|
755
|
+
var [createToggleGroupContext, createToggleGroupScope] = createContextScope$3(TOGGLE_GROUP_NAME, [createRovingFocusGroupScope]);
|
|
756
|
+
var useRovingFocusGroupScope$1 = createRovingFocusGroupScope();
|
|
757
|
+
var ToggleGroup = react.default.forwardRef((props, forwardedRef) => {
|
|
758
|
+
const { type, ...toggleGroupProps } = props;
|
|
759
|
+
if (type === "single") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupImplSingle, {
|
|
760
|
+
...toggleGroupProps,
|
|
761
|
+
ref: forwardedRef
|
|
762
|
+
});
|
|
763
|
+
if (type === "multiple") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupImplMultiple, {
|
|
764
|
+
...toggleGroupProps,
|
|
765
|
+
ref: forwardedRef
|
|
766
|
+
});
|
|
767
|
+
throw new Error(`Missing prop \`type\` expected on \`${TOGGLE_GROUP_NAME}\``);
|
|
768
|
+
});
|
|
769
|
+
ToggleGroup.displayName = TOGGLE_GROUP_NAME;
|
|
770
|
+
var [ToggleGroupValueProvider, useToggleGroupValueContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
|
|
771
|
+
var ToggleGroupImplSingle = react.default.forwardRef((props, forwardedRef) => {
|
|
772
|
+
const { value: valueProp, defaultValue, onValueChange = () => {}, ...toggleGroupSingleProps } = props;
|
|
773
|
+
const [value, setValue] = require_trust_score_card_glass.useControllableState({
|
|
774
|
+
prop: valueProp,
|
|
775
|
+
defaultProp: defaultValue ?? "",
|
|
776
|
+
onChange: onValueChange,
|
|
777
|
+
caller: TOGGLE_GROUP_NAME
|
|
778
|
+
});
|
|
779
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupValueProvider, {
|
|
780
|
+
scope: props.__scopeToggleGroup,
|
|
781
|
+
type: "single",
|
|
782
|
+
value: react.default.useMemo(() => value ? [value] : [], [value]),
|
|
783
|
+
onItemActivate: setValue,
|
|
784
|
+
onItemDeactivate: react.default.useCallback(() => setValue(""), [setValue]),
|
|
785
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupImpl, {
|
|
786
|
+
...toggleGroupSingleProps,
|
|
787
|
+
ref: forwardedRef
|
|
788
|
+
})
|
|
789
|
+
});
|
|
790
|
+
});
|
|
791
|
+
var ToggleGroupImplMultiple = react.default.forwardRef((props, forwardedRef) => {
|
|
792
|
+
const { value: valueProp, defaultValue, onValueChange = () => {}, ...toggleGroupMultipleProps } = props;
|
|
793
|
+
const [value, setValue] = require_trust_score_card_glass.useControllableState({
|
|
794
|
+
prop: valueProp,
|
|
795
|
+
defaultProp: defaultValue ?? [],
|
|
796
|
+
onChange: onValueChange,
|
|
797
|
+
caller: TOGGLE_GROUP_NAME
|
|
798
|
+
});
|
|
799
|
+
const handleButtonActivate = react.default.useCallback((itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]), [setValue]);
|
|
800
|
+
const handleButtonDeactivate = react.default.useCallback((itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)), [setValue]);
|
|
801
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupValueProvider, {
|
|
802
|
+
scope: props.__scopeToggleGroup,
|
|
803
|
+
type: "multiple",
|
|
804
|
+
value,
|
|
805
|
+
onItemActivate: handleButtonActivate,
|
|
806
|
+
onItemDeactivate: handleButtonDeactivate,
|
|
807
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupImpl, {
|
|
808
|
+
...toggleGroupMultipleProps,
|
|
809
|
+
ref: forwardedRef
|
|
810
|
+
})
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
ToggleGroup.displayName = TOGGLE_GROUP_NAME;
|
|
814
|
+
var [ToggleGroupContext$1, useToggleGroupContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
|
|
815
|
+
var ToggleGroupImpl = react.default.forwardRef((props, forwardedRef) => {
|
|
816
|
+
const { __scopeToggleGroup, disabled = false, rovingFocus = true, orientation, dir, loop = true, ...toggleGroupProps } = props;
|
|
817
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope$1(__scopeToggleGroup);
|
|
818
|
+
const direction = require_trust_score_card_glass.useDirection(dir);
|
|
819
|
+
const commonProps = {
|
|
820
|
+
role: "group",
|
|
821
|
+
dir: direction,
|
|
822
|
+
...toggleGroupProps
|
|
823
|
+
};
|
|
824
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupContext$1, {
|
|
825
|
+
scope: __scopeToggleGroup,
|
|
826
|
+
rovingFocus,
|
|
827
|
+
disabled,
|
|
828
|
+
children: rovingFocus ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$3, {
|
|
829
|
+
asChild: true,
|
|
830
|
+
...rovingFocusGroupScope,
|
|
831
|
+
orientation,
|
|
832
|
+
dir: direction,
|
|
833
|
+
loop,
|
|
834
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$4.div, {
|
|
835
|
+
...commonProps,
|
|
836
|
+
ref: forwardedRef
|
|
837
|
+
})
|
|
838
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$4.div, {
|
|
839
|
+
...commonProps,
|
|
840
|
+
ref: forwardedRef
|
|
841
|
+
})
|
|
842
|
+
});
|
|
843
|
+
});
|
|
844
|
+
var ITEM_NAME$1 = "ToggleGroupItem";
|
|
845
|
+
var ToggleGroupItem = react.default.forwardRef((props, forwardedRef) => {
|
|
846
|
+
const valueContext = useToggleGroupValueContext(ITEM_NAME$1, props.__scopeToggleGroup);
|
|
847
|
+
const context = useToggleGroupContext(ITEM_NAME$1, props.__scopeToggleGroup);
|
|
848
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope$1(props.__scopeToggleGroup);
|
|
849
|
+
const pressed = valueContext.value.includes(props.value);
|
|
850
|
+
const disabled = context.disabled || props.disabled;
|
|
851
|
+
const commonProps = {
|
|
852
|
+
...props,
|
|
853
|
+
pressed,
|
|
854
|
+
disabled
|
|
855
|
+
};
|
|
856
|
+
const ref = react.default.useRef(null);
|
|
857
|
+
return context.rovingFocus ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
|
|
858
|
+
asChild: true,
|
|
859
|
+
...rovingFocusGroupScope,
|
|
860
|
+
focusable: !disabled,
|
|
861
|
+
active: pressed,
|
|
862
|
+
ref,
|
|
863
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupItemImpl, {
|
|
864
|
+
...commonProps,
|
|
865
|
+
ref: forwardedRef
|
|
866
|
+
})
|
|
867
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupItemImpl, {
|
|
868
|
+
...commonProps,
|
|
869
|
+
ref: forwardedRef
|
|
870
|
+
});
|
|
871
|
+
});
|
|
872
|
+
ToggleGroupItem.displayName = ITEM_NAME$1;
|
|
873
|
+
var ToggleGroupItemImpl = react.default.forwardRef((props, forwardedRef) => {
|
|
874
|
+
const { __scopeToggleGroup, value, ...itemProps } = props;
|
|
875
|
+
const valueContext = useToggleGroupValueContext(ITEM_NAME$1, __scopeToggleGroup);
|
|
876
|
+
const singleProps = {
|
|
877
|
+
role: "radio",
|
|
878
|
+
"aria-checked": props.pressed,
|
|
879
|
+
"aria-pressed": void 0
|
|
880
|
+
};
|
|
881
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_toggle.Toggle, {
|
|
882
|
+
...valueContext.type === "single" ? singleProps : void 0,
|
|
883
|
+
...itemProps,
|
|
884
|
+
ref: forwardedRef,
|
|
885
|
+
onPressedChange: (pressed) => {
|
|
886
|
+
if (pressed) valueContext.onItemActivate(value);
|
|
887
|
+
else valueContext.onItemDeactivate(value);
|
|
888
|
+
}
|
|
889
|
+
});
|
|
890
|
+
});
|
|
891
|
+
var Root2$1 = ToggleGroup;
|
|
892
|
+
var Item2$1 = ToggleGroupItem;
|
|
893
|
+
var ToggleGroupContext = react.createContext({
|
|
894
|
+
size: "default",
|
|
895
|
+
variant: "default"
|
|
896
|
+
});
|
|
897
|
+
var toggleGroupItemVariants = (0, class_variance_authority.cva)([
|
|
898
|
+
"inline-flex items-center justify-center rounded-md text-sm font-medium",
|
|
899
|
+
"transition-all duration-200",
|
|
900
|
+
"focus:outline-none focus-visible:ring-2",
|
|
901
|
+
"focus-visible:ring-[var(--focus-ring)] focus-visible:ring-offset-2",
|
|
902
|
+
"disabled:pointer-events-none disabled:opacity-50"
|
|
903
|
+
], {
|
|
904
|
+
variants: {
|
|
905
|
+
variant: {
|
|
906
|
+
default: [
|
|
907
|
+
"bg-[var(--toggle-group-item-bg,transparent)]",
|
|
908
|
+
"hover:bg-[var(--toggle-group-item-hover-bg,var(--glass-bg-subtle))]",
|
|
909
|
+
"data-[state=on]:bg-[var(--toggle-group-item-active-bg,var(--semantic-primary-subtle))]",
|
|
910
|
+
"data-[state=on]:text-[var(--toggle-group-item-active-text,var(--semantic-primary))]"
|
|
911
|
+
],
|
|
912
|
+
outline: [
|
|
913
|
+
"border border-[var(--toggle-group-item-border,var(--glass-border))]",
|
|
914
|
+
"bg-transparent",
|
|
915
|
+
"hover:bg-[var(--toggle-group-item-hover-bg,var(--glass-bg-subtle))]",
|
|
916
|
+
"data-[state=on]:border-[var(--semantic-primary)]",
|
|
917
|
+
"data-[state=on]:bg-[var(--toggle-group-item-active-bg,var(--semantic-primary-subtle))]",
|
|
918
|
+
"data-[state=on]:text-[var(--toggle-group-item-active-text,var(--semantic-primary))]"
|
|
919
|
+
]
|
|
920
|
+
},
|
|
921
|
+
size: {
|
|
922
|
+
default: "h-10 px-3",
|
|
923
|
+
sm: "h-8 px-2",
|
|
924
|
+
lg: "h-11 px-4"
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
defaultVariants: {
|
|
928
|
+
variant: "default",
|
|
929
|
+
size: "default"
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
function ToggleGroupGlassRootImpl(props, ref) {
|
|
933
|
+
const { className, variant = "default", size = "default", children, ...rest } = props;
|
|
934
|
+
const containerClasses = require_utils.cn("inline-flex items-center justify-center gap-1", "rounded-lg p-1", "bg-[var(--toggle-group-bg,var(--glass-bg-subtle))]", "border border-[var(--toggle-group-border,var(--glass-border))]", className);
|
|
935
|
+
const contextValue = {
|
|
936
|
+
size: size ?? "default",
|
|
937
|
+
variant: variant ?? "default"
|
|
938
|
+
};
|
|
939
|
+
if (props.type === "multiple") {
|
|
940
|
+
const multipleRest = rest;
|
|
941
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root2$1, {
|
|
942
|
+
ref,
|
|
943
|
+
className: containerClasses,
|
|
944
|
+
...multipleRest,
|
|
945
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupContext.Provider, {
|
|
946
|
+
value: contextValue,
|
|
947
|
+
children
|
|
948
|
+
})
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
const singleRest = rest;
|
|
952
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root2$1, {
|
|
953
|
+
ref,
|
|
954
|
+
className: containerClasses,
|
|
955
|
+
...singleRest,
|
|
956
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupContext.Provider, {
|
|
957
|
+
value: contextValue,
|
|
958
|
+
children
|
|
959
|
+
})
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
var ToggleGroupGlassRoot = react.forwardRef(ToggleGroupGlassRootImpl);
|
|
963
|
+
ToggleGroupGlassRoot.displayName = "ToggleGroupGlassRoot";
|
|
964
|
+
var ToggleGroupGlassItem = react.forwardRef(({ className, children, variant, size, ...props }, ref) => {
|
|
965
|
+
const context = react.useContext(ToggleGroupContext);
|
|
966
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item2$1, {
|
|
967
|
+
ref,
|
|
968
|
+
className: require_utils.cn(toggleGroupItemVariants({
|
|
969
|
+
variant: variant ?? context.variant,
|
|
970
|
+
size: size ?? context.size
|
|
971
|
+
}), className),
|
|
972
|
+
...props,
|
|
973
|
+
children
|
|
974
|
+
});
|
|
975
|
+
});
|
|
976
|
+
ToggleGroupGlassItem.displayName = "ToggleGroupGlassItem";
|
|
977
|
+
const ToggleGroupGlass = {
|
|
978
|
+
Root: ToggleGroupGlassRoot,
|
|
979
|
+
Item: ToggleGroupGlassItem
|
|
980
|
+
};
|
|
981
|
+
var MOBILE_BREAKPOINT = 768;
|
|
982
|
+
var SIDEBAR_COOKIE_NAME = "sidebar:state";
|
|
983
|
+
var SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
|
|
984
|
+
var SidebarContext = (0, react.createContext)(null);
|
|
985
|
+
function useSidebar() {
|
|
986
|
+
const context = (0, react.useContext)(SidebarContext);
|
|
987
|
+
if (!context) throw new Error("useSidebar must be used within SidebarGlass.Provider. Wrap your component tree with <SidebarGlass.Provider>.");
|
|
988
|
+
return context;
|
|
989
|
+
}
|
|
990
|
+
const SidebarProvider = ({ children, open: controlledOpen, onOpenChange, defaultOpen = true, side = "left", variant = "sidebar", collapsible = "offcanvas", cookieName = SIDEBAR_COOKIE_NAME, keyboardShortcut = "b" }) => {
|
|
991
|
+
const [internalOpen, setInternalOpen] = (0, react.useState)(() => {
|
|
992
|
+
if (typeof document !== "undefined") {
|
|
993
|
+
const sidebarCookie = document.cookie.split(";").find((c) => c.trim().startsWith(`${cookieName}=`));
|
|
994
|
+
if (sidebarCookie) return sidebarCookie.split("=")[1] === "true";
|
|
995
|
+
}
|
|
996
|
+
return defaultOpen;
|
|
997
|
+
});
|
|
998
|
+
const isControlled = controlledOpen !== void 0;
|
|
999
|
+
const open = isControlled ? controlledOpen : internalOpen;
|
|
1000
|
+
const setOpen = (0, react.useCallback)((value$1) => {
|
|
1001
|
+
if (!isControlled) setInternalOpen(value$1);
|
|
1002
|
+
onOpenChange?.(value$1);
|
|
1003
|
+
if (typeof document !== "undefined") document.cookie = `${cookieName}=${value$1}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
1004
|
+
}, [
|
|
1005
|
+
isControlled,
|
|
1006
|
+
onOpenChange,
|
|
1007
|
+
cookieName
|
|
1008
|
+
]);
|
|
1009
|
+
const [openMobile, setOpenMobile] = (0, react.useState)(false);
|
|
1010
|
+
const [isMobile, setIsMobile] = (0, react.useState)(() => {
|
|
1011
|
+
if (typeof window === "undefined") return false;
|
|
1012
|
+
return window.innerWidth < MOBILE_BREAKPOINT;
|
|
1013
|
+
});
|
|
1014
|
+
(0, react.useEffect)(() => {
|
|
1015
|
+
if (typeof window === "undefined") return;
|
|
1016
|
+
const checkMobile = () => {
|
|
1017
|
+
const mobile = window.innerWidth < MOBILE_BREAKPOINT;
|
|
1018
|
+
setIsMobile(mobile);
|
|
1019
|
+
if (!mobile) setOpenMobile(false);
|
|
1020
|
+
};
|
|
1021
|
+
checkMobile();
|
|
1022
|
+
window.addEventListener("resize", checkMobile);
|
|
1023
|
+
return () => window.removeEventListener("resize", checkMobile);
|
|
1024
|
+
}, []);
|
|
1025
|
+
const toggleSidebar = (0, react.useCallback)(() => {
|
|
1026
|
+
if (isMobile) setOpenMobile((prev) => !prev);
|
|
1027
|
+
else setOpen(!open);
|
|
1028
|
+
}, [
|
|
1029
|
+
isMobile,
|
|
1030
|
+
open,
|
|
1031
|
+
setOpen
|
|
1032
|
+
]);
|
|
1033
|
+
(0, react.useEffect)(() => {
|
|
1034
|
+
if (!keyboardShortcut) return;
|
|
1035
|
+
const handleKeyDown = (e) => {
|
|
1036
|
+
if (e.key === keyboardShortcut && (e.metaKey || e.ctrlKey)) {
|
|
1037
|
+
e.preventDefault();
|
|
432
1038
|
toggleSidebar();
|
|
433
1039
|
}
|
|
434
1040
|
};
|
|
@@ -686,435 +1292,131 @@ const SidebarMenuButton = (0, react.forwardRef)(({ asChild = false, isActive = f
|
|
|
686
1292
|
children: button
|
|
687
1293
|
});
|
|
688
1294
|
});
|
|
689
|
-
SidebarMenuButton.displayName = "SidebarGlass.MenuButton";
|
|
690
|
-
const SidebarMenuAction = (0, react.forwardRef)(({ asChild = false, showOnHover = false, className, ...props }, ref) => {
|
|
691
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? __radix_ui_react_slot.Slot : "button", {
|
|
692
|
-
ref,
|
|
693
|
-
"data-sidebar": "menu-action",
|
|
694
|
-
className: require_utils.cn("absolute right-1 top-1.5", "flex aspect-square w-5 items-center justify-center", "rounded-md p-0 text-[var(--sidebar-foreground)]/60", "ring-[var(--sidebar-ring)]", "transition-transform hover:bg-[var(--sidebar-accent)]", "hover:text-[var(--sidebar-foreground)]", "focus-visible:outline-none focus-visible:ring-2", "[&>svg]:size-4 [&>svg]:shrink-0", "group-data-[state=collapsed]/sidebar:hidden", showOnHover && "peer-hover/menu-button:opacity-100 group-focus-within/menu-item:opacity-100", showOnHover && "data-[state=open]:opacity-100 md:opacity-0", "after:absolute after:-inset-2 after:md:hidden", className),
|
|
695
|
-
...props
|
|
696
|
-
});
|
|
697
|
-
});
|
|
698
|
-
SidebarMenuAction.displayName = "SidebarGlass.MenuAction";
|
|
699
|
-
const SidebarMenuBadge = (0, react.forwardRef)(({ children, className, ...props }, ref) => {
|
|
700
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
701
|
-
ref,
|
|
702
|
-
"data-sidebar": "menu-badge",
|
|
703
|
-
className: require_utils.cn("pointer-events-none absolute right-1 flex h-5 min-w-5", "select-none items-center justify-center", "rounded-md px-1 text-xs font-medium tabular-nums", "text-[var(--sidebar-foreground)]/60", "group-data-[state=collapsed]/sidebar:hidden", className),
|
|
704
|
-
...props,
|
|
705
|
-
children
|
|
706
|
-
});
|
|
707
|
-
});
|
|
708
|
-
SidebarMenuBadge.displayName = "SidebarGlass.MenuBadge";
|
|
709
|
-
const SidebarMenuSkeleton = (0, react.forwardRef)(({ showIcon = false, className, ...props }, ref) => {
|
|
710
|
-
const width = "70%";
|
|
711
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
712
|
-
ref,
|
|
713
|
-
"data-sidebar": "menu-skeleton",
|
|
714
|
-
className: require_utils.cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
715
|
-
...props,
|
|
716
|
-
children: [showIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.SkeletonGlass, { className: "size-4 rounded-md" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.SkeletonGlass, {
|
|
717
|
-
className: "h-4 max-w-[var(--skeleton-width)] flex-1",
|
|
718
|
-
style: { "--skeleton-width": width }
|
|
719
|
-
})]
|
|
720
|
-
});
|
|
721
|
-
});
|
|
722
|
-
SidebarMenuSkeleton.displayName = "SidebarGlass.MenuSkeleton";
|
|
723
|
-
var SidebarMenuSubContext = (0, react.createContext)(null);
|
|
724
|
-
const SidebarMenuSub = (0, react.forwardRef)(({ children, className, ...props }, ref) => {
|
|
725
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarMenuSubContext.Provider, {
|
|
726
|
-
value: { open: true },
|
|
727
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
728
|
-
ref,
|
|
729
|
-
"data-sidebar": "menu-sub",
|
|
730
|
-
className: require_utils.cn("flex min-w-0 flex-col gap-1", "mx-3.5 border-l border-[var(--sidebar-border)] px-2.5 py-0.5", "group-data-[state=collapsed]/sidebar:hidden", className),
|
|
731
|
-
...props,
|
|
732
|
-
children
|
|
733
|
-
})
|
|
734
|
-
});
|
|
735
|
-
});
|
|
736
|
-
SidebarMenuSub.displayName = "SidebarGlass.MenuSub";
|
|
737
|
-
const SidebarMenuSubItem = (0, react.forwardRef)(({ children, className, ...props }, ref) => {
|
|
738
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
739
|
-
ref,
|
|
740
|
-
"data-sidebar": "menu-sub-item",
|
|
741
|
-
className: require_utils.cn(className),
|
|
742
|
-
...props,
|
|
743
|
-
children
|
|
744
|
-
});
|
|
745
|
-
});
|
|
746
|
-
SidebarMenuSubItem.displayName = "SidebarGlass.MenuSubItem";
|
|
747
|
-
const SidebarMenuSubButton = (0, react.forwardRef)(({ asChild = false, isActive = false, size = "md", className, ...props }, ref) => {
|
|
748
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? __radix_ui_react_slot.Slot : "a", {
|
|
749
|
-
ref,
|
|
750
|
-
"data-sidebar": "menu-sub-button",
|
|
751
|
-
"data-active": isActive,
|
|
752
|
-
"data-size": size,
|
|
753
|
-
className: require_utils.cn("flex min-w-0 items-center gap-2", "-ml-px rounded-md border-l border-transparent", "text-[var(--sidebar-foreground)]/60", "ring-[var(--sidebar-ring)]", "transition-colors", "hover:border-[var(--sidebar-border)]", "hover:bg-[var(--sidebar-accent)]", "hover:text-[var(--sidebar-accent-foreground)]", "focus-visible:outline-none focus-visible:ring-2", "active:bg-[var(--sidebar-accent)] active:text-[var(--sidebar-accent-foreground)]", "disabled:pointer-events-none disabled:opacity-50", "[&>span:last-child]:truncate", "[&>svg]:size-4 [&>svg]:shrink-0", size === "sm" && "h-7 px-2 text-xs", size === "md" && "h-8 px-2 text-sm", isActive && ["border-[var(--sidebar-primary)]", "text-[var(--sidebar-foreground)]"], className),
|
|
754
|
-
...props
|
|
755
|
-
});
|
|
756
|
-
});
|
|
757
|
-
SidebarMenuSubButton.displayName = "SidebarGlass.MenuSubButton";
|
|
758
|
-
const SidebarGlass = {
|
|
759
|
-
Provider: SidebarProvider,
|
|
760
|
-
Root: SidebarRoot,
|
|
761
|
-
Header: SidebarHeader,
|
|
762
|
-
Content: SidebarContent,
|
|
763
|
-
Footer: SidebarFooter,
|
|
764
|
-
Rail: SidebarRail,
|
|
765
|
-
Inset: SidebarInset,
|
|
766
|
-
Trigger: SidebarTrigger,
|
|
767
|
-
Separator: SidebarSeparator,
|
|
768
|
-
Group: SidebarGroup,
|
|
769
|
-
GroupLabel: SidebarGroupLabel,
|
|
770
|
-
GroupAction: SidebarGroupAction,
|
|
771
|
-
GroupContent: SidebarGroupContent,
|
|
772
|
-
Menu: SidebarMenu,
|
|
773
|
-
MenuItem: SidebarMenuItem,
|
|
774
|
-
MenuButton: SidebarMenuButton,
|
|
775
|
-
MenuAction: SidebarMenuAction,
|
|
776
|
-
MenuBadge: SidebarMenuBadge,
|
|
777
|
-
MenuSkeleton: SidebarMenuSkeleton,
|
|
778
|
-
MenuSub: SidebarMenuSub,
|
|
779
|
-
MenuSubItem: SidebarMenuSubItem,
|
|
780
|
-
MenuSubButton: SidebarMenuSubButton
|
|
781
|
-
};
|
|
782
|
-
function _extends$1() {
|
|
783
|
-
return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
|
|
784
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
785
|
-
var t = arguments[e];
|
|
786
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
787
|
-
}
|
|
788
|
-
return n;
|
|
789
|
-
}, _extends$1.apply(null, arguments);
|
|
790
|
-
}
|
|
791
|
-
function ownKeys$1(e, r) {
|
|
792
|
-
var t = Object.keys(e);
|
|
793
|
-
if (Object.getOwnPropertySymbols) {
|
|
794
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
795
|
-
r && (o = o.filter(function(r$1) {
|
|
796
|
-
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
797
|
-
})), t.push.apply(t, o);
|
|
798
|
-
}
|
|
799
|
-
return t;
|
|
800
|
-
}
|
|
801
|
-
function _objectSpread$1(e) {
|
|
802
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
803
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
804
|
-
r % 2 ? ownKeys$1(Object(t), !0).forEach(function(r$1) {
|
|
805
|
-
_defineProperty$1(e, r$1, t[r$1]);
|
|
806
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r$1) {
|
|
807
|
-
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
return e;
|
|
811
|
-
}
|
|
812
|
-
function _defineProperty$1(e, r, t) {
|
|
813
|
-
return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
|
|
814
|
-
value: t,
|
|
815
|
-
enumerable: !0,
|
|
816
|
-
configurable: !0,
|
|
817
|
-
writable: !0
|
|
818
|
-
}) : e[r] = t, e;
|
|
819
|
-
}
|
|
820
|
-
function _toPropertyKey$1(t) {
|
|
821
|
-
var i = _toPrimitive$1(t, "string");
|
|
822
|
-
return "symbol" == typeof i ? i : i + "";
|
|
823
|
-
}
|
|
824
|
-
function _toPrimitive$1(t, r) {
|
|
825
|
-
if ("object" != typeof t || !t) return t;
|
|
826
|
-
var e = t[Symbol.toPrimitive];
|
|
827
|
-
if (void 0 !== e) {
|
|
828
|
-
var i = e.call(t, r || "default");
|
|
829
|
-
if ("object" != typeof i) return i;
|
|
830
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
831
|
-
}
|
|
832
|
-
return ("string" === r ? String : Number)(t);
|
|
833
|
-
}
|
|
834
|
-
var SIZE = 32;
|
|
835
|
-
var defaultLegendContentDefaultProps = {
|
|
836
|
-
align: "center",
|
|
837
|
-
iconSize: 14,
|
|
838
|
-
inactiveColor: "#ccc",
|
|
839
|
-
layout: "horizontal",
|
|
840
|
-
verticalAlign: "middle"
|
|
841
|
-
};
|
|
842
|
-
function Icon(_ref) {
|
|
843
|
-
var { data, iconType, inactiveColor } = _ref;
|
|
844
|
-
var halfSize = SIZE / 2;
|
|
845
|
-
var sixthSize = SIZE / 6;
|
|
846
|
-
var thirdSize = SIZE / 3;
|
|
847
|
-
var color = data.inactive ? inactiveColor : data.color;
|
|
848
|
-
var preferredIcon = iconType !== null && iconType !== void 0 ? iconType : data.type;
|
|
849
|
-
if (preferredIcon === "none") return null;
|
|
850
|
-
if (preferredIcon === "plainline") {
|
|
851
|
-
var _data$payload;
|
|
852
|
-
return /* @__PURE__ */ react.createElement("line", {
|
|
853
|
-
strokeWidth: 4,
|
|
854
|
-
fill: "none",
|
|
855
|
-
stroke: color,
|
|
856
|
-
strokeDasharray: (_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.strokeDasharray,
|
|
857
|
-
x1: 0,
|
|
858
|
-
y1: halfSize,
|
|
859
|
-
x2: SIZE,
|
|
860
|
-
y2: halfSize,
|
|
861
|
-
className: "recharts-legend-icon"
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
if (preferredIcon === "line") return /* @__PURE__ */ react.createElement("path", {
|
|
865
|
-
strokeWidth: 4,
|
|
866
|
-
fill: "none",
|
|
867
|
-
stroke: color,
|
|
868
|
-
d: "M0,".concat(halfSize, "h").concat(thirdSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(2 * thirdSize, ",").concat(halfSize, "\n H").concat(SIZE, "M").concat(2 * thirdSize, ",").concat(halfSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(thirdSize, ",").concat(halfSize),
|
|
869
|
-
className: "recharts-legend-icon"
|
|
870
|
-
});
|
|
871
|
-
if (preferredIcon === "rect") return /* @__PURE__ */ react.createElement("path", {
|
|
872
|
-
stroke: "none",
|
|
873
|
-
fill: color,
|
|
874
|
-
d: "M0,".concat(SIZE / 8, "h").concat(SIZE, "v").concat(SIZE * 3 / 4, "h").concat(-SIZE, "z"),
|
|
875
|
-
className: "recharts-legend-icon"
|
|
876
|
-
});
|
|
877
|
-
if (/* @__PURE__ */ react.isValidElement(data.legendIcon)) {
|
|
878
|
-
var iconProps = _objectSpread$1({}, data);
|
|
879
|
-
delete iconProps.legendIcon;
|
|
880
|
-
return /* @__PURE__ */ react.cloneElement(data.legendIcon, iconProps);
|
|
881
|
-
}
|
|
882
|
-
return /* @__PURE__ */ react.createElement(require_trust_score_card_glass.Symbols, {
|
|
883
|
-
fill: color,
|
|
884
|
-
cx: halfSize,
|
|
885
|
-
cy: halfSize,
|
|
886
|
-
size: SIZE,
|
|
887
|
-
sizeType: "diameter",
|
|
888
|
-
type: preferredIcon
|
|
889
|
-
});
|
|
890
|
-
}
|
|
891
|
-
function Items(props) {
|
|
892
|
-
var { payload, iconSize, layout, formatter, inactiveColor, iconType } = props;
|
|
893
|
-
var viewBox = {
|
|
894
|
-
x: 0,
|
|
895
|
-
y: 0,
|
|
896
|
-
width: SIZE,
|
|
897
|
-
height: SIZE
|
|
898
|
-
};
|
|
899
|
-
var itemStyle = {
|
|
900
|
-
display: layout === "horizontal" ? "inline-block" : "block",
|
|
901
|
-
marginRight: 10
|
|
902
|
-
};
|
|
903
|
-
var svgStyle = {
|
|
904
|
-
display: "inline-block",
|
|
905
|
-
verticalAlign: "middle",
|
|
906
|
-
marginRight: 4
|
|
907
|
-
};
|
|
908
|
-
return payload.map((entry, i) => {
|
|
909
|
-
var finalFormatter = entry.formatter || formatter;
|
|
910
|
-
var className = (0, clsx.clsx)({
|
|
911
|
-
"recharts-legend-item": true,
|
|
912
|
-
["legend-item-".concat(i)]: true,
|
|
913
|
-
inactive: entry.inactive
|
|
914
|
-
});
|
|
915
|
-
if (entry.type === "none") return null;
|
|
916
|
-
var color = entry.inactive ? inactiveColor : entry.color;
|
|
917
|
-
var finalValue = finalFormatter ? finalFormatter(entry.value, entry, i) : entry.value;
|
|
918
|
-
return /* @__PURE__ */ react.createElement("li", _extends$1({
|
|
919
|
-
className,
|
|
920
|
-
style: itemStyle,
|
|
921
|
-
key: "legend-item-".concat(i)
|
|
922
|
-
}, require_trust_score_card_glass.adaptEventsOfChild(props, entry, i)), /* @__PURE__ */ react.createElement(require_trust_score_card_glass.Surface, {
|
|
923
|
-
width: iconSize,
|
|
924
|
-
height: iconSize,
|
|
925
|
-
viewBox,
|
|
926
|
-
style: svgStyle,
|
|
927
|
-
"aria-label": "".concat(finalValue, " legend icon")
|
|
928
|
-
}, /* @__PURE__ */ react.createElement(Icon, {
|
|
929
|
-
data: entry,
|
|
930
|
-
iconType,
|
|
931
|
-
inactiveColor
|
|
932
|
-
})), /* @__PURE__ */ react.createElement("span", {
|
|
933
|
-
className: "recharts-legend-item-text",
|
|
934
|
-
style: { color }
|
|
935
|
-
}, finalValue));
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
var DefaultLegendContent = (outsideProps) => {
|
|
939
|
-
var props = require_trust_score_card_glass.resolveDefaultProps(outsideProps, defaultLegendContentDefaultProps);
|
|
940
|
-
var { payload, layout, align } = props;
|
|
941
|
-
if (!payload || !payload.length) return null;
|
|
942
|
-
var finalStyle = {
|
|
943
|
-
padding: 0,
|
|
944
|
-
margin: 0,
|
|
945
|
-
textAlign: layout === "horizontal" ? align : "left"
|
|
946
|
-
};
|
|
947
|
-
return /* @__PURE__ */ react.createElement("ul", {
|
|
948
|
-
className: "recharts-default-legend",
|
|
949
|
-
style: finalStyle
|
|
950
|
-
}, /* @__PURE__ */ react.createElement(Items, _extends$1({}, props, { payload })));
|
|
951
|
-
};
|
|
952
|
-
function useLegendPayload() {
|
|
953
|
-
return require_trust_score_card_glass.useAppSelector(require_trust_score_card_glass.selectLegendPayload);
|
|
954
|
-
}
|
|
955
|
-
var _excluded = ["contextPayload"];
|
|
956
|
-
function _extends() {
|
|
957
|
-
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
958
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
959
|
-
var t = arguments[e];
|
|
960
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
961
|
-
}
|
|
962
|
-
return n;
|
|
963
|
-
}, _extends.apply(null, arguments);
|
|
964
|
-
}
|
|
965
|
-
function ownKeys(e, r) {
|
|
966
|
-
var t = Object.keys(e);
|
|
967
|
-
if (Object.getOwnPropertySymbols) {
|
|
968
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
969
|
-
r && (o = o.filter(function(r$1) {
|
|
970
|
-
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
971
|
-
})), t.push.apply(t, o);
|
|
972
|
-
}
|
|
973
|
-
return t;
|
|
974
|
-
}
|
|
975
|
-
function _objectSpread(e) {
|
|
976
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
977
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
978
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
|
|
979
|
-
_defineProperty(e, r$1, t[r$1]);
|
|
980
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
981
|
-
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
982
|
-
});
|
|
983
|
-
}
|
|
984
|
-
return e;
|
|
985
|
-
}
|
|
986
|
-
function _defineProperty(e, r, t) {
|
|
987
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
988
|
-
value: t,
|
|
989
|
-
enumerable: !0,
|
|
990
|
-
configurable: !0,
|
|
991
|
-
writable: !0
|
|
992
|
-
}) : e[r] = t, e;
|
|
993
|
-
}
|
|
994
|
-
function _toPropertyKey(t) {
|
|
995
|
-
var i = _toPrimitive(t, "string");
|
|
996
|
-
return "symbol" == typeof i ? i : i + "";
|
|
997
|
-
}
|
|
998
|
-
function _toPrimitive(t, r) {
|
|
999
|
-
if ("object" != typeof t || !t) return t;
|
|
1000
|
-
var e = t[Symbol.toPrimitive];
|
|
1001
|
-
if (void 0 !== e) {
|
|
1002
|
-
var i = e.call(t, r || "default");
|
|
1003
|
-
if ("object" != typeof i) return i;
|
|
1004
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1005
|
-
}
|
|
1006
|
-
return ("string" === r ? String : Number)(t);
|
|
1007
|
-
}
|
|
1008
|
-
function _objectWithoutProperties(e, t) {
|
|
1009
|
-
if (null == e) return {};
|
|
1010
|
-
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
1011
|
-
if (Object.getOwnPropertySymbols) {
|
|
1012
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
1013
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
1014
|
-
}
|
|
1015
|
-
return i;
|
|
1016
|
-
}
|
|
1017
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
1018
|
-
if (null == r) return {};
|
|
1019
|
-
var t = {};
|
|
1020
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
1021
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
1022
|
-
t[n] = r[n];
|
|
1023
|
-
}
|
|
1024
|
-
return t;
|
|
1025
|
-
}
|
|
1026
|
-
function defaultUniqBy(entry) {
|
|
1027
|
-
return entry.value;
|
|
1028
|
-
}
|
|
1029
|
-
function LegendContent(props) {
|
|
1030
|
-
var { contextPayload } = props, otherProps = _objectWithoutProperties(props, _excluded);
|
|
1031
|
-
var finalPayload = require_trust_score_card_glass.getUniqPayload(contextPayload, props.payloadUniqBy, defaultUniqBy);
|
|
1032
|
-
var contentProps = _objectSpread(_objectSpread({}, otherProps), {}, { payload: finalPayload });
|
|
1033
|
-
if (/* @__PURE__ */ react.isValidElement(props.content)) return /* @__PURE__ */ react.cloneElement(props.content, contentProps);
|
|
1034
|
-
if (typeof props.content === "function") return /* @__PURE__ */ react.createElement(props.content, contentProps);
|
|
1035
|
-
return /* @__PURE__ */ react.createElement(DefaultLegendContent, contentProps);
|
|
1036
|
-
}
|
|
1037
|
-
function getDefaultPosition(style, props, margin, chartWidth, chartHeight, box) {
|
|
1038
|
-
var { layout, align, verticalAlign } = props;
|
|
1039
|
-
var hPos, vPos;
|
|
1040
|
-
if (!style || (style.left === void 0 || style.left === null) && (style.right === void 0 || style.right === null)) if (align === "center" && layout === "vertical") hPos = { left: ((chartWidth || 0) - box.width) / 2 };
|
|
1041
|
-
else hPos = align === "right" ? { right: margin && margin.right || 0 } : { left: margin && margin.left || 0 };
|
|
1042
|
-
if (!style || (style.top === void 0 || style.top === null) && (style.bottom === void 0 || style.bottom === null)) if (verticalAlign === "middle") vPos = { top: ((chartHeight || 0) - box.height) / 2 };
|
|
1043
|
-
else vPos = verticalAlign === "bottom" ? { bottom: margin && margin.bottom || 0 } : { top: margin && margin.top || 0 };
|
|
1044
|
-
return _objectSpread(_objectSpread({}, hPos), vPos);
|
|
1045
|
-
}
|
|
1046
|
-
function LegendSettingsDispatcher(props) {
|
|
1047
|
-
var dispatch = require_trust_score_card_glass.useAppDispatch();
|
|
1048
|
-
(0, react.useEffect)(() => {
|
|
1049
|
-
dispatch(require_trust_score_card_glass.setLegendSettings(props));
|
|
1050
|
-
}, [dispatch, props]);
|
|
1051
|
-
return null;
|
|
1052
|
-
}
|
|
1053
|
-
function LegendSizeDispatcher(props) {
|
|
1054
|
-
var dispatch = require_trust_score_card_glass.useAppDispatch();
|
|
1055
|
-
(0, react.useEffect)(() => {
|
|
1056
|
-
dispatch(require_trust_score_card_glass.setLegendSize(props));
|
|
1057
|
-
return () => {
|
|
1058
|
-
dispatch(require_trust_score_card_glass.setLegendSize({
|
|
1059
|
-
width: 0,
|
|
1060
|
-
height: 0
|
|
1061
|
-
}));
|
|
1062
|
-
};
|
|
1063
|
-
}, [dispatch, props]);
|
|
1064
|
-
return null;
|
|
1065
|
-
}
|
|
1066
|
-
function getWidthOrHeight(layout, height, width, maxWidth) {
|
|
1067
|
-
if (layout === "vertical" && require_trust_score_card_glass.isNumber(height)) return { height };
|
|
1068
|
-
if (layout === "horizontal") return { width: width || maxWidth };
|
|
1069
|
-
return null;
|
|
1070
|
-
}
|
|
1071
|
-
var legendDefaultProps = {
|
|
1072
|
-
align: "center",
|
|
1073
|
-
iconSize: 14,
|
|
1074
|
-
itemSorter: "value",
|
|
1075
|
-
layout: "horizontal",
|
|
1076
|
-
verticalAlign: "bottom"
|
|
1295
|
+
SidebarMenuButton.displayName = "SidebarGlass.MenuButton";
|
|
1296
|
+
const SidebarMenuAction = (0, react.forwardRef)(({ asChild = false, showOnHover = false, className, ...props }, ref) => {
|
|
1297
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? __radix_ui_react_slot.Slot : "button", {
|
|
1298
|
+
ref,
|
|
1299
|
+
"data-sidebar": "menu-action",
|
|
1300
|
+
className: require_utils.cn("absolute right-1 top-1.5", "flex aspect-square w-5 items-center justify-center", "rounded-md p-0 text-[var(--sidebar-foreground)]/60", "ring-[var(--sidebar-ring)]", "transition-transform hover:bg-[var(--sidebar-accent)]", "hover:text-[var(--sidebar-foreground)]", "focus-visible:outline-none focus-visible:ring-2", "[&>svg]:size-4 [&>svg]:shrink-0", "group-data-[state=collapsed]/sidebar:hidden", showOnHover && "peer-hover/menu-button:opacity-100 group-focus-within/menu-item:opacity-100", showOnHover && "data-[state=open]:opacity-100 md:opacity-0", "after:absolute after:-inset-2 after:md:hidden", className),
|
|
1301
|
+
...props
|
|
1302
|
+
});
|
|
1303
|
+
});
|
|
1304
|
+
SidebarMenuAction.displayName = "SidebarGlass.MenuAction";
|
|
1305
|
+
const SidebarMenuBadge = (0, react.forwardRef)(({ children, className, ...props }, ref) => {
|
|
1306
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1307
|
+
ref,
|
|
1308
|
+
"data-sidebar": "menu-badge",
|
|
1309
|
+
className: require_utils.cn("pointer-events-none absolute right-1 flex h-5 min-w-5", "select-none items-center justify-center", "rounded-md px-1 text-xs font-medium tabular-nums", "text-[var(--sidebar-foreground)]/60", "group-data-[state=collapsed]/sidebar:hidden", className),
|
|
1310
|
+
...props,
|
|
1311
|
+
children
|
|
1312
|
+
});
|
|
1313
|
+
});
|
|
1314
|
+
SidebarMenuBadge.displayName = "SidebarGlass.MenuBadge";
|
|
1315
|
+
const SidebarMenuSkeleton = (0, react.forwardRef)(({ showIcon = false, className, ...props }, ref) => {
|
|
1316
|
+
const width = "70%";
|
|
1317
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1318
|
+
ref,
|
|
1319
|
+
"data-sidebar": "menu-skeleton",
|
|
1320
|
+
className: require_utils.cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
1321
|
+
...props,
|
|
1322
|
+
children: [showIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.SkeletonGlass, { className: "size-4 rounded-md" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.SkeletonGlass, {
|
|
1323
|
+
className: "h-4 max-w-[var(--skeleton-width)] flex-1",
|
|
1324
|
+
style: { "--skeleton-width": width }
|
|
1325
|
+
})]
|
|
1326
|
+
});
|
|
1327
|
+
});
|
|
1328
|
+
SidebarMenuSkeleton.displayName = "SidebarGlass.MenuSkeleton";
|
|
1329
|
+
var SidebarMenuSubContext = (0, react.createContext)(null);
|
|
1330
|
+
const SidebarMenuSub = (0, react.forwardRef)(({ children, className, ...props }, ref) => {
|
|
1331
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarMenuSubContext.Provider, {
|
|
1332
|
+
value: { open: true },
|
|
1333
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1334
|
+
ref,
|
|
1335
|
+
"data-sidebar": "menu-sub",
|
|
1336
|
+
className: require_utils.cn("flex min-w-0 flex-col gap-1", "mx-3.5 border-l border-[var(--sidebar-border)] px-2.5 py-0.5", "group-data-[state=collapsed]/sidebar:hidden", className),
|
|
1337
|
+
...props,
|
|
1338
|
+
children
|
|
1339
|
+
})
|
|
1340
|
+
});
|
|
1341
|
+
});
|
|
1342
|
+
SidebarMenuSub.displayName = "SidebarGlass.MenuSub";
|
|
1343
|
+
const SidebarMenuSubItem = (0, react.forwardRef)(({ children, className, ...props }, ref) => {
|
|
1344
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
1345
|
+
ref,
|
|
1346
|
+
"data-sidebar": "menu-sub-item",
|
|
1347
|
+
className: require_utils.cn(className),
|
|
1348
|
+
...props,
|
|
1349
|
+
children
|
|
1350
|
+
});
|
|
1351
|
+
});
|
|
1352
|
+
SidebarMenuSubItem.displayName = "SidebarGlass.MenuSubItem";
|
|
1353
|
+
const SidebarMenuSubButton = (0, react.forwardRef)(({ asChild = false, isActive = false, size = "md", className, ...props }, ref) => {
|
|
1354
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? __radix_ui_react_slot.Slot : "a", {
|
|
1355
|
+
ref,
|
|
1356
|
+
"data-sidebar": "menu-sub-button",
|
|
1357
|
+
"data-active": isActive,
|
|
1358
|
+
"data-size": size,
|
|
1359
|
+
className: require_utils.cn("flex min-w-0 items-center gap-2", "-ml-px rounded-md border-l border-transparent", "text-[var(--sidebar-foreground)]/60", "ring-[var(--sidebar-ring)]", "transition-colors", "hover:border-[var(--sidebar-border)]", "hover:bg-[var(--sidebar-accent)]", "hover:text-[var(--sidebar-accent-foreground)]", "focus-visible:outline-none focus-visible:ring-2", "active:bg-[var(--sidebar-accent)] active:text-[var(--sidebar-accent-foreground)]", "disabled:pointer-events-none disabled:opacity-50", "[&>span:last-child]:truncate", "[&>svg]:size-4 [&>svg]:shrink-0", size === "sm" && "h-7 px-2 text-xs", size === "md" && "h-8 px-2 text-sm", isActive && ["border-[var(--sidebar-primary)]", "text-[var(--sidebar-foreground)]"], className),
|
|
1360
|
+
...props
|
|
1361
|
+
});
|
|
1362
|
+
});
|
|
1363
|
+
SidebarMenuSubButton.displayName = "SidebarGlass.MenuSubButton";
|
|
1364
|
+
const SidebarGlass = {
|
|
1365
|
+
Provider: SidebarProvider,
|
|
1366
|
+
Root: SidebarRoot,
|
|
1367
|
+
Header: SidebarHeader,
|
|
1368
|
+
Content: SidebarContent,
|
|
1369
|
+
Footer: SidebarFooter,
|
|
1370
|
+
Rail: SidebarRail,
|
|
1371
|
+
Inset: SidebarInset,
|
|
1372
|
+
Trigger: SidebarTrigger,
|
|
1373
|
+
Separator: SidebarSeparator,
|
|
1374
|
+
Group: SidebarGroup,
|
|
1375
|
+
GroupLabel: SidebarGroupLabel,
|
|
1376
|
+
GroupAction: SidebarGroupAction,
|
|
1377
|
+
GroupContent: SidebarGroupContent,
|
|
1378
|
+
Menu: SidebarMenu,
|
|
1379
|
+
MenuItem: SidebarMenuItem,
|
|
1380
|
+
MenuButton: SidebarMenuButton,
|
|
1381
|
+
MenuAction: SidebarMenuAction,
|
|
1382
|
+
MenuBadge: SidebarMenuBadge,
|
|
1383
|
+
MenuSkeleton: SidebarMenuSkeleton,
|
|
1384
|
+
MenuSub: SidebarMenuSub,
|
|
1385
|
+
MenuSubItem: SidebarMenuSubItem,
|
|
1386
|
+
MenuSubButton: SidebarMenuSubButton
|
|
1077
1387
|
};
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
style: outerStyle,
|
|
1100
|
-
ref: updateBoundingBox
|
|
1101
|
-
}, /* @__PURE__ */ react.createElement(LegendSettingsDispatcher, {
|
|
1102
|
-
layout: props.layout,
|
|
1103
|
-
align: props.align,
|
|
1104
|
-
verticalAlign: props.verticalAlign,
|
|
1105
|
-
itemSorter: props.itemSorter
|
|
1106
|
-
}), !portalFromProps && /* @__PURE__ */ react.createElement(LegendSizeDispatcher, {
|
|
1107
|
-
width: lastBoundingBox.width,
|
|
1108
|
-
height: lastBoundingBox.height
|
|
1109
|
-
}), /* @__PURE__ */ react.createElement(LegendContent, _extends({}, props, widthOrHeight, {
|
|
1110
|
-
margin,
|
|
1111
|
-
chartWidth,
|
|
1112
|
-
chartHeight,
|
|
1113
|
-
contextPayload
|
|
1114
|
-
}))), legendPortal);
|
|
1388
|
+
var NAME = "Separator";
|
|
1389
|
+
var DEFAULT_ORIENTATION = "horizontal";
|
|
1390
|
+
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
1391
|
+
var Separator = react.forwardRef((props, forwardedRef) => {
|
|
1392
|
+
const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;
|
|
1393
|
+
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
|
|
1394
|
+
const ariaOrientation = orientation === "vertical" ? orientation : void 0;
|
|
1395
|
+
const semanticProps = decorative ? { role: "none" } : {
|
|
1396
|
+
"aria-orientation": ariaOrientation,
|
|
1397
|
+
role: "separator"
|
|
1398
|
+
};
|
|
1399
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Primitive.div, {
|
|
1400
|
+
"data-orientation": orientation,
|
|
1401
|
+
...semanticProps,
|
|
1402
|
+
...domProps,
|
|
1403
|
+
ref: forwardedRef
|
|
1404
|
+
});
|
|
1405
|
+
});
|
|
1406
|
+
Separator.displayName = NAME;
|
|
1407
|
+
function isValidOrientation(orientation) {
|
|
1408
|
+
return ORIENTATIONS.includes(orientation);
|
|
1115
1409
|
}
|
|
1116
|
-
|
|
1117
|
-
var
|
|
1410
|
+
var Root$2 = Separator;
|
|
1411
|
+
var SeparatorGlass = react.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$2, {
|
|
1412
|
+
ref,
|
|
1413
|
+
decorative,
|
|
1414
|
+
orientation,
|
|
1415
|
+
className: require_utils.cn("shrink-0", "bg-[var(--separator-bg,var(--glass-border))]", orientation === "horizontal" ? "h-px w-full" : "h-full w-px", className),
|
|
1416
|
+
...props
|
|
1417
|
+
}));
|
|
1418
|
+
SeparatorGlass.displayName = "SeparatorGlass";
|
|
1419
|
+
var Primitive$2 = [
|
|
1118
1420
|
"a",
|
|
1119
1421
|
"button",
|
|
1120
1422
|
"div",
|
|
@@ -1149,7 +1451,7 @@ var Primitive = [
|
|
|
1149
1451
|
[node]: Node
|
|
1150
1452
|
};
|
|
1151
1453
|
}, {});
|
|
1152
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
1454
|
+
function createContextScope$2(scopeName, createContextScopeDeps = []) {
|
|
1153
1455
|
let defaultContexts = [];
|
|
1154
1456
|
function createContext3(rootComponentName, defaultContext) {
|
|
1155
1457
|
const BaseContext = react.createContext(defaultContext);
|
|
@@ -1187,9 +1489,9 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
1187
1489
|
};
|
|
1188
1490
|
};
|
|
1189
1491
|
createScope.scopeName = scopeName;
|
|
1190
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
1492
|
+
return [createContext3, composeContextScopes$2(createScope, ...createContextScopeDeps)];
|
|
1191
1493
|
}
|
|
1192
|
-
function composeContextScopes(...scopes) {
|
|
1494
|
+
function composeContextScopes$2(...scopes) {
|
|
1193
1495
|
const baseScope = scopes[0];
|
|
1194
1496
|
if (scopes.length === 1) return baseScope;
|
|
1195
1497
|
const createScope = () => {
|
|
@@ -1217,7 +1519,7 @@ function useStateMachine(initialState, machine) {
|
|
|
1217
1519
|
}, initialState);
|
|
1218
1520
|
}
|
|
1219
1521
|
var SCROLL_AREA_NAME = "ScrollArea";
|
|
1220
|
-
var [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME);
|
|
1522
|
+
var [createScrollAreaContext, createScrollAreaScope] = createContextScope$2(SCROLL_AREA_NAME);
|
|
1221
1523
|
var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
|
|
1222
1524
|
var ScrollArea$1 = react.forwardRef((props, forwardedRef) => {
|
|
1223
1525
|
const { __scopeScrollArea, type = "hover", dir, scrollHideDelay = 600, ...scrollAreaProps } = props;
|
|
@@ -1252,7 +1554,7 @@ var ScrollArea$1 = react.forwardRef((props, forwardedRef) => {
|
|
|
1252
1554
|
onScrollbarYEnabledChange: setScrollbarYEnabled,
|
|
1253
1555
|
onCornerWidthChange: setCornerWidth,
|
|
1254
1556
|
onCornerHeightChange: setCornerHeight,
|
|
1255
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
|
|
1557
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
|
|
1256
1558
|
dir: direction,
|
|
1257
1559
|
...scrollAreaProps,
|
|
1258
1560
|
ref: composedRefs,
|
|
@@ -1274,7 +1576,7 @@ var ScrollAreaViewport = react.forwardRef((props, forwardedRef) => {
|
|
|
1274
1576
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", {
|
|
1275
1577
|
dangerouslySetInnerHTML: { __html: `[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}` },
|
|
1276
1578
|
nonce
|
|
1277
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
|
|
1579
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
|
|
1278
1580
|
"data-radix-scroll-area-viewport": "",
|
|
1279
1581
|
...viewportProps,
|
|
1280
1582
|
ref: composedRefs,
|
|
@@ -1291,583 +1593,1574 @@ var ScrollAreaViewport = react.forwardRef((props, forwardedRef) => {
|
|
|
1291
1593
|
},
|
|
1292
1594
|
children
|
|
1293
1595
|
})
|
|
1294
|
-
})] });
|
|
1596
|
+
})] });
|
|
1597
|
+
});
|
|
1598
|
+
ScrollAreaViewport.displayName = VIEWPORT_NAME;
|
|
1599
|
+
var SCROLLBAR_NAME = "ScrollAreaScrollbar";
|
|
1600
|
+
var ScrollAreaScrollbar = react.forwardRef((props, forwardedRef) => {
|
|
1601
|
+
const { forceMount, ...scrollbarProps } = props;
|
|
1602
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
1603
|
+
const { onScrollbarXEnabledChange, onScrollbarYEnabledChange } = context;
|
|
1604
|
+
const isHorizontal = props.orientation === "horizontal";
|
|
1605
|
+
react.useEffect(() => {
|
|
1606
|
+
isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);
|
|
1607
|
+
return () => {
|
|
1608
|
+
isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);
|
|
1609
|
+
};
|
|
1610
|
+
}, [
|
|
1611
|
+
isHorizontal,
|
|
1612
|
+
onScrollbarXEnabledChange,
|
|
1613
|
+
onScrollbarYEnabledChange
|
|
1614
|
+
]);
|
|
1615
|
+
return context.type === "hover" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarHover, {
|
|
1616
|
+
...scrollbarProps,
|
|
1617
|
+
ref: forwardedRef,
|
|
1618
|
+
forceMount
|
|
1619
|
+
}) : context.type === "scroll" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarScroll, {
|
|
1620
|
+
...scrollbarProps,
|
|
1621
|
+
ref: forwardedRef,
|
|
1622
|
+
forceMount
|
|
1623
|
+
}) : context.type === "auto" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarAuto, {
|
|
1624
|
+
...scrollbarProps,
|
|
1625
|
+
ref: forwardedRef,
|
|
1626
|
+
forceMount
|
|
1627
|
+
}) : context.type === "always" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
|
|
1628
|
+
...scrollbarProps,
|
|
1629
|
+
ref: forwardedRef
|
|
1630
|
+
}) : null;
|
|
1631
|
+
});
|
|
1632
|
+
ScrollAreaScrollbar.displayName = SCROLLBAR_NAME;
|
|
1633
|
+
var ScrollAreaScrollbarHover = react.forwardRef((props, forwardedRef) => {
|
|
1634
|
+
const { forceMount, ...scrollbarProps } = props;
|
|
1635
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
1636
|
+
const [visible, setVisible] = react.useState(false);
|
|
1637
|
+
react.useEffect(() => {
|
|
1638
|
+
const scrollArea = context.scrollArea;
|
|
1639
|
+
let hideTimer = 0;
|
|
1640
|
+
if (scrollArea) {
|
|
1641
|
+
const handlePointerEnter = () => {
|
|
1642
|
+
window.clearTimeout(hideTimer);
|
|
1643
|
+
setVisible(true);
|
|
1644
|
+
};
|
|
1645
|
+
const handlePointerLeave = () => {
|
|
1646
|
+
hideTimer = window.setTimeout(() => setVisible(false), context.scrollHideDelay);
|
|
1647
|
+
};
|
|
1648
|
+
scrollArea.addEventListener("pointerenter", handlePointerEnter);
|
|
1649
|
+
scrollArea.addEventListener("pointerleave", handlePointerLeave);
|
|
1650
|
+
return () => {
|
|
1651
|
+
window.clearTimeout(hideTimer);
|
|
1652
|
+
scrollArea.removeEventListener("pointerenter", handlePointerEnter);
|
|
1653
|
+
scrollArea.removeEventListener("pointerleave", handlePointerLeave);
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
}, [context.scrollArea, context.scrollHideDelay]);
|
|
1657
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
|
|
1658
|
+
present: forceMount || visible,
|
|
1659
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarAuto, {
|
|
1660
|
+
"data-state": visible ? "visible" : "hidden",
|
|
1661
|
+
...scrollbarProps,
|
|
1662
|
+
ref: forwardedRef
|
|
1663
|
+
})
|
|
1664
|
+
});
|
|
1665
|
+
});
|
|
1666
|
+
var ScrollAreaScrollbarScroll = react.forwardRef((props, forwardedRef) => {
|
|
1667
|
+
const { forceMount, ...scrollbarProps } = props;
|
|
1668
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
1669
|
+
const isHorizontal = props.orientation === "horizontal";
|
|
1670
|
+
const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
|
|
1671
|
+
const [state, send] = useStateMachine("hidden", {
|
|
1672
|
+
hidden: { SCROLL: "scrolling" },
|
|
1673
|
+
scrolling: {
|
|
1674
|
+
SCROLL_END: "idle",
|
|
1675
|
+
POINTER_ENTER: "interacting"
|
|
1676
|
+
},
|
|
1677
|
+
interacting: {
|
|
1678
|
+
SCROLL: "interacting",
|
|
1679
|
+
POINTER_LEAVE: "idle"
|
|
1680
|
+
},
|
|
1681
|
+
idle: {
|
|
1682
|
+
HIDE: "hidden",
|
|
1683
|
+
SCROLL: "scrolling",
|
|
1684
|
+
POINTER_ENTER: "interacting"
|
|
1685
|
+
}
|
|
1686
|
+
});
|
|
1687
|
+
react.useEffect(() => {
|
|
1688
|
+
if (state === "idle") {
|
|
1689
|
+
const hideTimer = window.setTimeout(() => send("HIDE"), context.scrollHideDelay);
|
|
1690
|
+
return () => window.clearTimeout(hideTimer);
|
|
1691
|
+
}
|
|
1692
|
+
}, [
|
|
1693
|
+
state,
|
|
1694
|
+
context.scrollHideDelay,
|
|
1695
|
+
send
|
|
1696
|
+
]);
|
|
1697
|
+
react.useEffect(() => {
|
|
1698
|
+
const viewport = context.viewport;
|
|
1699
|
+
const scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop";
|
|
1700
|
+
if (viewport) {
|
|
1701
|
+
let prevScrollPos = viewport[scrollDirection];
|
|
1702
|
+
const handleScroll = () => {
|
|
1703
|
+
const scrollPos = viewport[scrollDirection];
|
|
1704
|
+
if (prevScrollPos !== scrollPos) {
|
|
1705
|
+
send("SCROLL");
|
|
1706
|
+
debounceScrollEnd();
|
|
1707
|
+
}
|
|
1708
|
+
prevScrollPos = scrollPos;
|
|
1709
|
+
};
|
|
1710
|
+
viewport.addEventListener("scroll", handleScroll);
|
|
1711
|
+
return () => viewport.removeEventListener("scroll", handleScroll);
|
|
1712
|
+
}
|
|
1713
|
+
}, [
|
|
1714
|
+
context.viewport,
|
|
1715
|
+
isHorizontal,
|
|
1716
|
+
send,
|
|
1717
|
+
debounceScrollEnd
|
|
1718
|
+
]);
|
|
1719
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
|
|
1720
|
+
present: forceMount || state !== "hidden",
|
|
1721
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
|
|
1722
|
+
"data-state": state === "hidden" ? "hidden" : "visible",
|
|
1723
|
+
...scrollbarProps,
|
|
1724
|
+
ref: forwardedRef,
|
|
1725
|
+
onPointerEnter: require_trust_score_card_glass.composeEventHandlers(props.onPointerEnter, () => send("POINTER_ENTER")),
|
|
1726
|
+
onPointerLeave: require_trust_score_card_glass.composeEventHandlers(props.onPointerLeave, () => send("POINTER_LEAVE"))
|
|
1727
|
+
})
|
|
1728
|
+
});
|
|
1295
1729
|
});
|
|
1296
|
-
|
|
1297
|
-
var SCROLLBAR_NAME = "ScrollAreaScrollbar";
|
|
1298
|
-
var ScrollAreaScrollbar = react.forwardRef((props, forwardedRef) => {
|
|
1299
|
-
const { forceMount, ...scrollbarProps } = props;
|
|
1730
|
+
var ScrollAreaScrollbarAuto = react.forwardRef((props, forwardedRef) => {
|
|
1300
1731
|
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
1301
|
-
const {
|
|
1732
|
+
const { forceMount, ...scrollbarProps } = props;
|
|
1733
|
+
const [visible, setVisible] = react.useState(false);
|
|
1302
1734
|
const isHorizontal = props.orientation === "horizontal";
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1735
|
+
const handleResize = useDebounceCallback(() => {
|
|
1736
|
+
if (context.viewport) {
|
|
1737
|
+
const isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth;
|
|
1738
|
+
const isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight;
|
|
1739
|
+
setVisible(isHorizontal ? isOverflowX : isOverflowY);
|
|
1740
|
+
}
|
|
1741
|
+
}, 10);
|
|
1742
|
+
useResizeObserver(context.viewport, handleResize);
|
|
1743
|
+
useResizeObserver(context.content, handleResize);
|
|
1744
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
|
|
1745
|
+
present: forceMount || visible,
|
|
1746
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
|
|
1747
|
+
"data-state": visible ? "visible" : "hidden",
|
|
1748
|
+
...scrollbarProps,
|
|
1749
|
+
ref: forwardedRef
|
|
1750
|
+
})
|
|
1751
|
+
});
|
|
1752
|
+
});
|
|
1753
|
+
var ScrollAreaScrollbarVisible = react.forwardRef((props, forwardedRef) => {
|
|
1754
|
+
const { orientation = "vertical", ...scrollbarProps } = props;
|
|
1755
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
1756
|
+
const thumbRef = react.useRef(null);
|
|
1757
|
+
const pointerOffsetRef = react.useRef(0);
|
|
1758
|
+
const [sizes, setSizes] = react.useState({
|
|
1759
|
+
content: 0,
|
|
1760
|
+
viewport: 0,
|
|
1761
|
+
scrollbar: {
|
|
1762
|
+
size: 0,
|
|
1763
|
+
paddingStart: 0,
|
|
1764
|
+
paddingEnd: 0
|
|
1765
|
+
}
|
|
1766
|
+
});
|
|
1767
|
+
const thumbRatio = getThumbRatio(sizes.viewport, sizes.content);
|
|
1768
|
+
const commonProps = {
|
|
1318
1769
|
...scrollbarProps,
|
|
1770
|
+
sizes,
|
|
1771
|
+
onSizesChange: setSizes,
|
|
1772
|
+
hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),
|
|
1773
|
+
onThumbChange: (thumb) => thumbRef.current = thumb,
|
|
1774
|
+
onThumbPointerUp: () => pointerOffsetRef.current = 0,
|
|
1775
|
+
onThumbPointerDown: (pointerPos) => pointerOffsetRef.current = pointerPos
|
|
1776
|
+
};
|
|
1777
|
+
function getScrollPosition(pointerPos, dir) {
|
|
1778
|
+
return getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir);
|
|
1779
|
+
}
|
|
1780
|
+
if (orientation === "horizontal") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarX, {
|
|
1781
|
+
...commonProps,
|
|
1319
1782
|
ref: forwardedRef,
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1783
|
+
onThumbPositionChange: () => {
|
|
1784
|
+
if (context.viewport && thumbRef.current) {
|
|
1785
|
+
const scrollPos = context.viewport.scrollLeft;
|
|
1786
|
+
const offset = getThumbOffsetFromScroll(scrollPos, sizes, context.dir);
|
|
1787
|
+
thumbRef.current.style.transform = `translate3d(${offset}px, 0, 0)`;
|
|
1788
|
+
}
|
|
1789
|
+
},
|
|
1790
|
+
onWheelScroll: (scrollPos) => {
|
|
1791
|
+
if (context.viewport) context.viewport.scrollLeft = scrollPos;
|
|
1792
|
+
},
|
|
1793
|
+
onDragScroll: (pointerPos) => {
|
|
1794
|
+
if (context.viewport) context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir);
|
|
1795
|
+
}
|
|
1796
|
+
});
|
|
1797
|
+
if (orientation === "vertical") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarY, {
|
|
1798
|
+
...commonProps,
|
|
1323
1799
|
ref: forwardedRef,
|
|
1324
|
-
|
|
1325
|
-
|
|
1800
|
+
onThumbPositionChange: () => {
|
|
1801
|
+
if (context.viewport && thumbRef.current) {
|
|
1802
|
+
const scrollPos = context.viewport.scrollTop;
|
|
1803
|
+
const offset = getThumbOffsetFromScroll(scrollPos, sizes);
|
|
1804
|
+
thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`;
|
|
1805
|
+
}
|
|
1806
|
+
},
|
|
1807
|
+
onWheelScroll: (scrollPos) => {
|
|
1808
|
+
if (context.viewport) context.viewport.scrollTop = scrollPos;
|
|
1809
|
+
},
|
|
1810
|
+
onDragScroll: (pointerPos) => {
|
|
1811
|
+
if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);
|
|
1812
|
+
}
|
|
1813
|
+
});
|
|
1814
|
+
return null;
|
|
1815
|
+
});
|
|
1816
|
+
var ScrollAreaScrollbarX = react.forwardRef((props, forwardedRef) => {
|
|
1817
|
+
const { sizes, onSizesChange, ...scrollbarProps } = props;
|
|
1818
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
1819
|
+
const [computedStyle, setComputedStyle] = react.useState();
|
|
1820
|
+
const ref = react.useRef(null);
|
|
1821
|
+
const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref, context.onScrollbarXChange);
|
|
1822
|
+
react.useEffect(() => {
|
|
1823
|
+
if (ref.current) setComputedStyle(getComputedStyle(ref.current));
|
|
1824
|
+
}, [ref]);
|
|
1825
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarImpl, {
|
|
1826
|
+
"data-orientation": "horizontal",
|
|
1326
1827
|
...scrollbarProps,
|
|
1327
|
-
ref:
|
|
1328
|
-
|
|
1828
|
+
ref: composeRefs,
|
|
1829
|
+
sizes,
|
|
1830
|
+
style: {
|
|
1831
|
+
bottom: 0,
|
|
1832
|
+
left: context.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
1833
|
+
right: context.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
1834
|
+
["--radix-scroll-area-thumb-width"]: getThumbSize(sizes) + "px",
|
|
1835
|
+
...props.style
|
|
1836
|
+
},
|
|
1837
|
+
onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.x),
|
|
1838
|
+
onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.x),
|
|
1839
|
+
onWheelScroll: (event, maxScrollPos) => {
|
|
1840
|
+
if (context.viewport) {
|
|
1841
|
+
const scrollPos = context.viewport.scrollLeft + event.deltaX;
|
|
1842
|
+
props.onWheelScroll(scrollPos);
|
|
1843
|
+
if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
|
|
1844
|
+
}
|
|
1845
|
+
},
|
|
1846
|
+
onResize: () => {
|
|
1847
|
+
if (ref.current && context.viewport && computedStyle) onSizesChange({
|
|
1848
|
+
content: context.viewport.scrollWidth,
|
|
1849
|
+
viewport: context.viewport.offsetWidth,
|
|
1850
|
+
scrollbar: {
|
|
1851
|
+
size: ref.current.clientWidth,
|
|
1852
|
+
paddingStart: toInt(computedStyle.paddingLeft),
|
|
1853
|
+
paddingEnd: toInt(computedStyle.paddingRight)
|
|
1854
|
+
}
|
|
1855
|
+
});
|
|
1856
|
+
}
|
|
1857
|
+
});
|
|
1329
1858
|
});
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
const { forceMount, ...scrollbarProps } = props;
|
|
1859
|
+
var ScrollAreaScrollbarY = react.forwardRef((props, forwardedRef) => {
|
|
1860
|
+
const { sizes, onSizesChange, ...scrollbarProps } = props;
|
|
1333
1861
|
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
1334
|
-
const [
|
|
1862
|
+
const [computedStyle, setComputedStyle] = react.useState();
|
|
1863
|
+
const ref = react.useRef(null);
|
|
1864
|
+
const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref, context.onScrollbarYChange);
|
|
1335
1865
|
react.useEffect(() => {
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1866
|
+
if (ref.current) setComputedStyle(getComputedStyle(ref.current));
|
|
1867
|
+
}, [ref]);
|
|
1868
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarImpl, {
|
|
1869
|
+
"data-orientation": "vertical",
|
|
1870
|
+
...scrollbarProps,
|
|
1871
|
+
ref: composeRefs,
|
|
1872
|
+
sizes,
|
|
1873
|
+
style: {
|
|
1874
|
+
top: 0,
|
|
1875
|
+
right: context.dir === "ltr" ? 0 : void 0,
|
|
1876
|
+
left: context.dir === "rtl" ? 0 : void 0,
|
|
1877
|
+
bottom: "var(--radix-scroll-area-corner-height)",
|
|
1878
|
+
["--radix-scroll-area-thumb-height"]: getThumbSize(sizes) + "px",
|
|
1879
|
+
...props.style
|
|
1880
|
+
},
|
|
1881
|
+
onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.y),
|
|
1882
|
+
onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.y),
|
|
1883
|
+
onWheelScroll: (event, maxScrollPos) => {
|
|
1884
|
+
if (context.viewport) {
|
|
1885
|
+
const scrollPos = context.viewport.scrollTop + event.deltaY;
|
|
1886
|
+
props.onWheelScroll(scrollPos);
|
|
1887
|
+
if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
|
|
1888
|
+
}
|
|
1889
|
+
},
|
|
1890
|
+
onResize: () => {
|
|
1891
|
+
if (ref.current && context.viewport && computedStyle) onSizesChange({
|
|
1892
|
+
content: context.viewport.scrollHeight,
|
|
1893
|
+
viewport: context.viewport.offsetHeight,
|
|
1894
|
+
scrollbar: {
|
|
1895
|
+
size: ref.current.clientHeight,
|
|
1896
|
+
paddingStart: toInt(computedStyle.paddingTop),
|
|
1897
|
+
paddingEnd: toInt(computedStyle.paddingBottom)
|
|
1898
|
+
}
|
|
1899
|
+
});
|
|
1353
1900
|
}
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1901
|
+
});
|
|
1902
|
+
});
|
|
1903
|
+
var [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME);
|
|
1904
|
+
var ScrollAreaScrollbarImpl = react.forwardRef((props, forwardedRef) => {
|
|
1905
|
+
const { __scopeScrollArea, sizes, hasThumb, onThumbChange, onThumbPointerUp, onThumbPointerDown, onThumbPositionChange, onDragScroll, onWheelScroll, onResize, ...scrollbarProps } = props;
|
|
1906
|
+
const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
|
|
1907
|
+
const [scrollbar, setScrollbar] = react.useState(null);
|
|
1908
|
+
const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => setScrollbar(node));
|
|
1909
|
+
const rectRef = react.useRef(null);
|
|
1910
|
+
const prevWebkitUserSelectRef = react.useRef("");
|
|
1911
|
+
const viewport = context.viewport;
|
|
1912
|
+
const maxScrollPos = sizes.content - sizes.viewport;
|
|
1913
|
+
const handleWheelScroll = require_trust_score_card_glass.useCallbackRef(onWheelScroll);
|
|
1914
|
+
const handleThumbPositionChange = require_trust_score_card_glass.useCallbackRef(onThumbPositionChange);
|
|
1915
|
+
const handleResize = useDebounceCallback(onResize, 10);
|
|
1916
|
+
function handleDragScroll(event) {
|
|
1917
|
+
if (rectRef.current) onDragScroll({
|
|
1918
|
+
x: event.clientX - rectRef.current.left,
|
|
1919
|
+
y: event.clientY - rectRef.current.top
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
react.useEffect(() => {
|
|
1923
|
+
const handleWheel = (event) => {
|
|
1924
|
+
const element = event.target;
|
|
1925
|
+
if (scrollbar?.contains(element)) handleWheelScroll(event, maxScrollPos);
|
|
1926
|
+
};
|
|
1927
|
+
document.addEventListener("wheel", handleWheel, { passive: false });
|
|
1928
|
+
return () => document.removeEventListener("wheel", handleWheel, { passive: false });
|
|
1929
|
+
}, [
|
|
1930
|
+
viewport,
|
|
1931
|
+
scrollbar,
|
|
1932
|
+
maxScrollPos,
|
|
1933
|
+
handleWheelScroll
|
|
1934
|
+
]);
|
|
1935
|
+
react.useEffect(handleThumbPositionChange, [sizes, handleThumbPositionChange]);
|
|
1936
|
+
useResizeObserver(scrollbar, handleResize);
|
|
1937
|
+
useResizeObserver(context.content, handleResize);
|
|
1938
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollbarProvider, {
|
|
1939
|
+
scope: __scopeScrollArea,
|
|
1940
|
+
scrollbar,
|
|
1941
|
+
hasThumb,
|
|
1942
|
+
onThumbChange: require_trust_score_card_glass.useCallbackRef(onThumbChange),
|
|
1943
|
+
onThumbPointerUp: require_trust_score_card_glass.useCallbackRef(onThumbPointerUp),
|
|
1944
|
+
onThumbPositionChange: handleThumbPositionChange,
|
|
1945
|
+
onThumbPointerDown: require_trust_score_card_glass.useCallbackRef(onThumbPointerDown),
|
|
1946
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
|
|
1359
1947
|
...scrollbarProps,
|
|
1360
|
-
ref:
|
|
1948
|
+
ref: composeRefs,
|
|
1949
|
+
style: {
|
|
1950
|
+
position: "absolute",
|
|
1951
|
+
...scrollbarProps.style
|
|
1952
|
+
},
|
|
1953
|
+
onPointerDown: require_trust_score_card_glass.composeEventHandlers(props.onPointerDown, (event) => {
|
|
1954
|
+
if (event.button === 0) {
|
|
1955
|
+
event.target.setPointerCapture(event.pointerId);
|
|
1956
|
+
rectRef.current = scrollbar.getBoundingClientRect();
|
|
1957
|
+
prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
|
|
1958
|
+
document.body.style.webkitUserSelect = "none";
|
|
1959
|
+
if (context.viewport) context.viewport.style.scrollBehavior = "auto";
|
|
1960
|
+
handleDragScroll(event);
|
|
1961
|
+
}
|
|
1962
|
+
}),
|
|
1963
|
+
onPointerMove: require_trust_score_card_glass.composeEventHandlers(props.onPointerMove, handleDragScroll),
|
|
1964
|
+
onPointerUp: require_trust_score_card_glass.composeEventHandlers(props.onPointerUp, (event) => {
|
|
1965
|
+
const element = event.target;
|
|
1966
|
+
if (element.hasPointerCapture(event.pointerId)) element.releasePointerCapture(event.pointerId);
|
|
1967
|
+
document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
|
|
1968
|
+
if (context.viewport) context.viewport.style.scrollBehavior = "";
|
|
1969
|
+
rectRef.current = null;
|
|
1970
|
+
})
|
|
1361
1971
|
})
|
|
1362
1972
|
});
|
|
1363
1973
|
});
|
|
1364
|
-
var
|
|
1365
|
-
|
|
1366
|
-
const
|
|
1367
|
-
const
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
},
|
|
1375
|
-
interacting: {
|
|
1376
|
-
SCROLL: "interacting",
|
|
1377
|
-
POINTER_LEAVE: "idle"
|
|
1378
|
-
},
|
|
1379
|
-
idle: {
|
|
1380
|
-
HIDE: "hidden",
|
|
1381
|
-
SCROLL: "scrolling",
|
|
1382
|
-
POINTER_ENTER: "interacting"
|
|
1383
|
-
}
|
|
1974
|
+
var THUMB_NAME = "ScrollAreaThumb";
|
|
1975
|
+
var ScrollAreaThumb = react.forwardRef((props, forwardedRef) => {
|
|
1976
|
+
const { forceMount, ...thumbProps } = props;
|
|
1977
|
+
const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);
|
|
1978
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
|
|
1979
|
+
present: forceMount || scrollbarContext.hasThumb,
|
|
1980
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaThumbImpl, {
|
|
1981
|
+
ref: forwardedRef,
|
|
1982
|
+
...thumbProps
|
|
1983
|
+
})
|
|
1384
1984
|
});
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1985
|
+
});
|
|
1986
|
+
var ScrollAreaThumbImpl = react.forwardRef((props, forwardedRef) => {
|
|
1987
|
+
const { __scopeScrollArea, style, ...thumbProps } = props;
|
|
1988
|
+
const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);
|
|
1989
|
+
const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);
|
|
1990
|
+
const { onThumbPositionChange } = scrollbarContext;
|
|
1991
|
+
const composedRef = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => scrollbarContext.onThumbChange(node));
|
|
1992
|
+
const removeUnlinkedScrollListenerRef = react.useRef(void 0);
|
|
1993
|
+
const debounceScrollEnd = useDebounceCallback(() => {
|
|
1994
|
+
if (removeUnlinkedScrollListenerRef.current) {
|
|
1995
|
+
removeUnlinkedScrollListenerRef.current();
|
|
1996
|
+
removeUnlinkedScrollListenerRef.current = void 0;
|
|
1389
1997
|
}
|
|
1390
|
-
},
|
|
1391
|
-
state,
|
|
1392
|
-
context.scrollHideDelay,
|
|
1393
|
-
send
|
|
1394
|
-
]);
|
|
1998
|
+
}, 100);
|
|
1395
1999
|
react.useEffect(() => {
|
|
1396
|
-
const viewport =
|
|
1397
|
-
const scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop";
|
|
2000
|
+
const viewport = scrollAreaContext.viewport;
|
|
1398
2001
|
if (viewport) {
|
|
1399
|
-
let prevScrollPos = viewport[scrollDirection];
|
|
1400
2002
|
const handleScroll = () => {
|
|
1401
|
-
|
|
1402
|
-
if (
|
|
1403
|
-
|
|
1404
|
-
|
|
2003
|
+
debounceScrollEnd();
|
|
2004
|
+
if (!removeUnlinkedScrollListenerRef.current) {
|
|
2005
|
+
removeUnlinkedScrollListenerRef.current = addUnlinkedScrollListener(viewport, onThumbPositionChange);
|
|
2006
|
+
onThumbPositionChange();
|
|
1405
2007
|
}
|
|
1406
|
-
prevScrollPos = scrollPos;
|
|
1407
2008
|
};
|
|
1408
|
-
|
|
1409
|
-
|
|
2009
|
+
onThumbPositionChange();
|
|
2010
|
+
viewport.addEventListener("scroll", handleScroll);
|
|
2011
|
+
return () => viewport.removeEventListener("scroll", handleScroll);
|
|
2012
|
+
}
|
|
2013
|
+
}, [
|
|
2014
|
+
scrollAreaContext.viewport,
|
|
2015
|
+
debounceScrollEnd,
|
|
2016
|
+
onThumbPositionChange
|
|
2017
|
+
]);
|
|
2018
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
|
|
2019
|
+
"data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
|
|
2020
|
+
...thumbProps,
|
|
2021
|
+
ref: composedRef,
|
|
2022
|
+
style: {
|
|
2023
|
+
width: "var(--radix-scroll-area-thumb-width)",
|
|
2024
|
+
height: "var(--radix-scroll-area-thumb-height)",
|
|
2025
|
+
...style
|
|
2026
|
+
},
|
|
2027
|
+
onPointerDownCapture: require_trust_score_card_glass.composeEventHandlers(props.onPointerDownCapture, (event) => {
|
|
2028
|
+
const thumbRect = event.target.getBoundingClientRect();
|
|
2029
|
+
const x = event.clientX - thumbRect.left;
|
|
2030
|
+
const y = event.clientY - thumbRect.top;
|
|
2031
|
+
scrollbarContext.onThumbPointerDown({
|
|
2032
|
+
x,
|
|
2033
|
+
y
|
|
2034
|
+
});
|
|
2035
|
+
}),
|
|
2036
|
+
onPointerUp: require_trust_score_card_glass.composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp)
|
|
2037
|
+
});
|
|
2038
|
+
});
|
|
2039
|
+
ScrollAreaThumb.displayName = THUMB_NAME;
|
|
2040
|
+
var CORNER_NAME = "ScrollAreaCorner";
|
|
2041
|
+
var ScrollAreaCorner = react.forwardRef((props, forwardedRef) => {
|
|
2042
|
+
const context = useScrollAreaContext(CORNER_NAME, props.__scopeScrollArea);
|
|
2043
|
+
const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
|
|
2044
|
+
return context.type !== "scroll" && hasBothScrollbarsVisible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaCornerImpl, {
|
|
2045
|
+
...props,
|
|
2046
|
+
ref: forwardedRef
|
|
2047
|
+
}) : null;
|
|
2048
|
+
});
|
|
2049
|
+
ScrollAreaCorner.displayName = CORNER_NAME;
|
|
2050
|
+
var ScrollAreaCornerImpl = react.forwardRef((props, forwardedRef) => {
|
|
2051
|
+
const { __scopeScrollArea, ...cornerProps } = props;
|
|
2052
|
+
const context = useScrollAreaContext(CORNER_NAME, __scopeScrollArea);
|
|
2053
|
+
const [width, setWidth] = react.useState(0);
|
|
2054
|
+
const [height, setHeight] = react.useState(0);
|
|
2055
|
+
const hasSize = Boolean(width && height);
|
|
2056
|
+
useResizeObserver(context.scrollbarX, () => {
|
|
2057
|
+
const height2 = context.scrollbarX?.offsetHeight || 0;
|
|
2058
|
+
context.onCornerHeightChange(height2);
|
|
2059
|
+
setHeight(height2);
|
|
2060
|
+
});
|
|
2061
|
+
useResizeObserver(context.scrollbarY, () => {
|
|
2062
|
+
const width2 = context.scrollbarY?.offsetWidth || 0;
|
|
2063
|
+
context.onCornerWidthChange(width2);
|
|
2064
|
+
setWidth(width2);
|
|
2065
|
+
});
|
|
2066
|
+
return hasSize ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
|
|
2067
|
+
...cornerProps,
|
|
2068
|
+
ref: forwardedRef,
|
|
2069
|
+
style: {
|
|
2070
|
+
width,
|
|
2071
|
+
height,
|
|
2072
|
+
position: "absolute",
|
|
2073
|
+
right: context.dir === "ltr" ? 0 : void 0,
|
|
2074
|
+
left: context.dir === "rtl" ? 0 : void 0,
|
|
2075
|
+
bottom: 0,
|
|
2076
|
+
...props.style
|
|
2077
|
+
}
|
|
2078
|
+
}) : null;
|
|
2079
|
+
});
|
|
2080
|
+
function toInt(value) {
|
|
2081
|
+
return value ? parseInt(value, 10) : 0;
|
|
2082
|
+
}
|
|
2083
|
+
function getThumbRatio(viewportSize, contentSize) {
|
|
2084
|
+
const ratio = viewportSize / contentSize;
|
|
2085
|
+
return isNaN(ratio) ? 0 : ratio;
|
|
2086
|
+
}
|
|
2087
|
+
function getThumbSize(sizes) {
|
|
2088
|
+
const ratio = getThumbRatio(sizes.viewport, sizes.content);
|
|
2089
|
+
const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
|
|
2090
|
+
const thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio;
|
|
2091
|
+
return Math.max(thumbSize, 18);
|
|
2092
|
+
}
|
|
2093
|
+
function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes, dir = "ltr") {
|
|
2094
|
+
const thumbSizePx = getThumbSize(sizes);
|
|
2095
|
+
const thumbCenter = thumbSizePx / 2;
|
|
2096
|
+
const offset = pointerOffset || thumbCenter;
|
|
2097
|
+
const thumbOffsetFromEnd = thumbSizePx - offset;
|
|
2098
|
+
const minPointerPos = sizes.scrollbar.paddingStart + offset;
|
|
2099
|
+
const maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd;
|
|
2100
|
+
const maxScrollPos = sizes.content - sizes.viewport;
|
|
2101
|
+
const scrollRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
|
|
2102
|
+
return linearScale([minPointerPos, maxPointerPos], scrollRange)(pointerPos);
|
|
2103
|
+
}
|
|
2104
|
+
function getThumbOffsetFromScroll(scrollPos, sizes, dir = "ltr") {
|
|
2105
|
+
const thumbSizePx = getThumbSize(sizes);
|
|
2106
|
+
const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
|
|
2107
|
+
const scrollbar = sizes.scrollbar.size - scrollbarPadding;
|
|
2108
|
+
const maxScrollPos = sizes.content - sizes.viewport;
|
|
2109
|
+
const maxThumbPos = scrollbar - thumbSizePx;
|
|
2110
|
+
const scrollWithoutMomentum = require_trust_score_card_glass.clamp(scrollPos, dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0]);
|
|
2111
|
+
return linearScale([0, maxScrollPos], [0, maxThumbPos])(scrollWithoutMomentum);
|
|
2112
|
+
}
|
|
2113
|
+
function linearScale(input, output) {
|
|
2114
|
+
return (value) => {
|
|
2115
|
+
if (input[0] === input[1] || output[0] === output[1]) return output[0];
|
|
2116
|
+
const ratio = (output[1] - output[0]) / (input[1] - input[0]);
|
|
2117
|
+
return output[0] + ratio * (value - input[0]);
|
|
2118
|
+
};
|
|
2119
|
+
}
|
|
2120
|
+
function isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {
|
|
2121
|
+
return scrollPos > 0 && scrollPos < maxScrollPos;
|
|
2122
|
+
}
|
|
2123
|
+
var addUnlinkedScrollListener = (node, handler = () => {}) => {
|
|
2124
|
+
let prevPosition = {
|
|
2125
|
+
left: node.scrollLeft,
|
|
2126
|
+
top: node.scrollTop
|
|
2127
|
+
};
|
|
2128
|
+
let rAF = 0;
|
|
2129
|
+
(function loop() {
|
|
2130
|
+
const position = {
|
|
2131
|
+
left: node.scrollLeft,
|
|
2132
|
+
top: node.scrollTop
|
|
2133
|
+
};
|
|
2134
|
+
const isHorizontalScroll = prevPosition.left !== position.left;
|
|
2135
|
+
const isVerticalScroll = prevPosition.top !== position.top;
|
|
2136
|
+
if (isHorizontalScroll || isVerticalScroll) handler();
|
|
2137
|
+
prevPosition = position;
|
|
2138
|
+
rAF = window.requestAnimationFrame(loop);
|
|
2139
|
+
})();
|
|
2140
|
+
return () => window.cancelAnimationFrame(rAF);
|
|
2141
|
+
};
|
|
2142
|
+
function useDebounceCallback(callback, delay) {
|
|
2143
|
+
const handleCallback = require_trust_score_card_glass.useCallbackRef(callback);
|
|
2144
|
+
const debounceTimerRef = react.useRef(0);
|
|
2145
|
+
react.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
|
|
2146
|
+
return react.useCallback(() => {
|
|
2147
|
+
window.clearTimeout(debounceTimerRef.current);
|
|
2148
|
+
debounceTimerRef.current = window.setTimeout(handleCallback, delay);
|
|
2149
|
+
}, [handleCallback, delay]);
|
|
2150
|
+
}
|
|
2151
|
+
function useResizeObserver(element, onResize) {
|
|
2152
|
+
const handleResize = require_trust_score_card_glass.useCallbackRef(onResize);
|
|
2153
|
+
require_trust_score_card_glass.useLayoutEffect2(() => {
|
|
2154
|
+
let rAF = 0;
|
|
2155
|
+
if (element) {
|
|
2156
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
2157
|
+
cancelAnimationFrame(rAF);
|
|
2158
|
+
rAF = window.requestAnimationFrame(handleResize);
|
|
2159
|
+
});
|
|
2160
|
+
resizeObserver.observe(element);
|
|
2161
|
+
return () => {
|
|
2162
|
+
window.cancelAnimationFrame(rAF);
|
|
2163
|
+
resizeObserver.unobserve(element);
|
|
2164
|
+
};
|
|
1410
2165
|
}
|
|
1411
|
-
}, [
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
2166
|
+
}, [element, handleResize]);
|
|
2167
|
+
}
|
|
2168
|
+
var Root$1 = ScrollArea$1;
|
|
2169
|
+
var Viewport = ScrollAreaViewport;
|
|
2170
|
+
var Corner = ScrollAreaCorner;
|
|
2171
|
+
var ScrollBarGlass = react.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbar, {
|
|
2172
|
+
ref,
|
|
2173
|
+
orientation,
|
|
2174
|
+
className: require_utils.cn("flex touch-none select-none transition-colors", "bg-[var(--scrollbar-track,transparent)]", orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]", orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]", className),
|
|
2175
|
+
...props,
|
|
2176
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaThumb, { className: require_utils.cn("relative flex-1 rounded-full", "bg-[var(--scrollbar-thumb,var(--glass-border))]", "hover:bg-[var(--scrollbar-thumb-hover,var(--glass-border-hover))]", "transition-colors") })
|
|
2177
|
+
}));
|
|
2178
|
+
ScrollBarGlass.displayName = "ScrollBarGlass";
|
|
2179
|
+
var ScrollAreaGlass = react.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root$1, {
|
|
2180
|
+
ref,
|
|
2181
|
+
className: require_utils.cn("relative overflow-hidden", className),
|
|
2182
|
+
...props,
|
|
2183
|
+
children: [
|
|
2184
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Viewport, {
|
|
2185
|
+
className: "h-full w-full rounded-[inherit]",
|
|
2186
|
+
children
|
|
2187
|
+
}),
|
|
2188
|
+
(orientation === "vertical" || orientation === "both") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollBarGlass, { orientation: "vertical" }),
|
|
2189
|
+
(orientation === "horizontal" || orientation === "both") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollBarGlass, { orientation: "horizontal" }),
|
|
2190
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Corner, {})
|
|
2191
|
+
]
|
|
2192
|
+
}));
|
|
2193
|
+
ScrollAreaGlass.displayName = "ScrollAreaGlass";
|
|
2194
|
+
function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
2195
|
+
let defaultContexts = [];
|
|
2196
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
2197
|
+
const BaseContext = react.createContext(defaultContext);
|
|
2198
|
+
const index = defaultContexts.length;
|
|
2199
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
2200
|
+
const Provider = (props) => {
|
|
2201
|
+
const { scope, children, ...context } = props;
|
|
2202
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
2203
|
+
const value = react.useMemo(() => context, Object.values(context));
|
|
2204
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Context.Provider, {
|
|
2205
|
+
value,
|
|
2206
|
+
children
|
|
2207
|
+
});
|
|
2208
|
+
};
|
|
2209
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
2210
|
+
function useContext2(consumerName, scope) {
|
|
2211
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
2212
|
+
const context = react.useContext(Context);
|
|
2213
|
+
if (context) return context;
|
|
2214
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
2215
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1438
2216
|
}
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
2217
|
+
return [Provider, useContext2];
|
|
2218
|
+
}
|
|
2219
|
+
const createScope = () => {
|
|
2220
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
2221
|
+
return react.createContext(defaultContext);
|
|
2222
|
+
});
|
|
2223
|
+
return function useScope(scope) {
|
|
2224
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
2225
|
+
return react.useMemo(() => ({ [`__scope${scopeName}`]: {
|
|
2226
|
+
...scope,
|
|
2227
|
+
[scopeName]: contexts
|
|
2228
|
+
} }), [scope, contexts]);
|
|
2229
|
+
};
|
|
2230
|
+
};
|
|
2231
|
+
createScope.scopeName = scopeName;
|
|
2232
|
+
return [createContext3, composeContextScopes$1(createScope, ...createContextScopeDeps)];
|
|
2233
|
+
}
|
|
2234
|
+
function composeContextScopes$1(...scopes) {
|
|
2235
|
+
const baseScope = scopes[0];
|
|
2236
|
+
if (scopes.length === 1) return baseScope;
|
|
2237
|
+
const createScope = () => {
|
|
2238
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
2239
|
+
useScope: createScope2(),
|
|
2240
|
+
scopeName: createScope2.scopeName
|
|
2241
|
+
}));
|
|
2242
|
+
return function useComposedScopes(overrideScopes) {
|
|
2243
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
2244
|
+
const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
|
|
2245
|
+
return {
|
|
2246
|
+
...nextScopes2,
|
|
2247
|
+
...currentScope
|
|
2248
|
+
};
|
|
2249
|
+
}, {});
|
|
2250
|
+
return react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
2251
|
+
};
|
|
2252
|
+
};
|
|
2253
|
+
createScope.scopeName = baseScope.scopeName;
|
|
2254
|
+
return createScope;
|
|
2255
|
+
}
|
|
2256
|
+
var Primitive$1 = [
|
|
2257
|
+
"a",
|
|
2258
|
+
"button",
|
|
2259
|
+
"div",
|
|
2260
|
+
"form",
|
|
2261
|
+
"h2",
|
|
2262
|
+
"h3",
|
|
2263
|
+
"img",
|
|
2264
|
+
"input",
|
|
2265
|
+
"label",
|
|
2266
|
+
"li",
|
|
2267
|
+
"nav",
|
|
2268
|
+
"ol",
|
|
2269
|
+
"p",
|
|
2270
|
+
"select",
|
|
2271
|
+
"span",
|
|
2272
|
+
"svg",
|
|
2273
|
+
"ul"
|
|
2274
|
+
].reduce((primitive, node) => {
|
|
2275
|
+
const Slot$3 = (0, __radix_ui_react_slot.createSlot)(`Primitive.${node}`);
|
|
2276
|
+
const Node = react.forwardRef((props, forwardedRef) => {
|
|
2277
|
+
const { asChild, ...primitiveProps } = props;
|
|
2278
|
+
const Comp = asChild ? Slot$3 : node;
|
|
2279
|
+
if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
|
|
2280
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
|
|
2281
|
+
...primitiveProps,
|
|
1447
2282
|
ref: forwardedRef
|
|
1448
|
-
})
|
|
1449
|
-
});
|
|
1450
|
-
});
|
|
1451
|
-
var ScrollAreaScrollbarVisible = react.forwardRef((props, forwardedRef) => {
|
|
1452
|
-
const { orientation = "vertical", ...scrollbarProps } = props;
|
|
1453
|
-
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
1454
|
-
const thumbRef = react.useRef(null);
|
|
1455
|
-
const pointerOffsetRef = react.useRef(0);
|
|
1456
|
-
const [sizes, setSizes] = react.useState({
|
|
1457
|
-
content: 0,
|
|
1458
|
-
viewport: 0,
|
|
1459
|
-
scrollbar: {
|
|
1460
|
-
size: 0,
|
|
1461
|
-
paddingStart: 0,
|
|
1462
|
-
paddingEnd: 0
|
|
1463
|
-
}
|
|
2283
|
+
});
|
|
1464
2284
|
});
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
...
|
|
1468
|
-
|
|
1469
|
-
onSizesChange: setSizes,
|
|
1470
|
-
hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),
|
|
1471
|
-
onThumbChange: (thumb) => thumbRef.current = thumb,
|
|
1472
|
-
onThumbPointerUp: () => pointerOffsetRef.current = 0,
|
|
1473
|
-
onThumbPointerDown: (pointerPos) => pointerOffsetRef.current = pointerPos
|
|
2285
|
+
Node.displayName = `Primitive.${node}`;
|
|
2286
|
+
return {
|
|
2287
|
+
...primitive,
|
|
2288
|
+
[node]: Node
|
|
1474
2289
|
};
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
2290
|
+
}, {});
|
|
2291
|
+
var COLLAPSIBLE_NAME = "Collapsible";
|
|
2292
|
+
var [createCollapsibleContext, createCollapsibleScope] = createContextScope$1(COLLAPSIBLE_NAME);
|
|
2293
|
+
var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
|
|
2294
|
+
var Collapsible = react.forwardRef((props, forwardedRef) => {
|
|
2295
|
+
const { __scopeCollapsible, open: openProp, defaultOpen, disabled, onOpenChange, ...collapsibleProps } = props;
|
|
2296
|
+
const [open, setOpen] = require_trust_score_card_glass.useControllableState({
|
|
2297
|
+
prop: openProp,
|
|
2298
|
+
defaultProp: defaultOpen ?? false,
|
|
2299
|
+
onChange: onOpenChange,
|
|
2300
|
+
caller: COLLAPSIBLE_NAME
|
|
2301
|
+
});
|
|
2302
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollapsibleProvider, {
|
|
2303
|
+
scope: __scopeCollapsible,
|
|
2304
|
+
disabled,
|
|
2305
|
+
contentId: require_trust_score_card_glass.useId(),
|
|
2306
|
+
open,
|
|
2307
|
+
onOpenToggle: react.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
2308
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$1.div, {
|
|
2309
|
+
"data-state": getState$1(open),
|
|
2310
|
+
"data-disabled": disabled ? "" : void 0,
|
|
2311
|
+
...collapsibleProps,
|
|
2312
|
+
ref: forwardedRef
|
|
2313
|
+
})
|
|
1494
2314
|
});
|
|
1495
|
-
|
|
1496
|
-
|
|
2315
|
+
});
|
|
2316
|
+
Collapsible.displayName = COLLAPSIBLE_NAME;
|
|
2317
|
+
var TRIGGER_NAME = "CollapsibleTrigger";
|
|
2318
|
+
var CollapsibleTrigger = react.forwardRef((props, forwardedRef) => {
|
|
2319
|
+
const { __scopeCollapsible, ...triggerProps } = props;
|
|
2320
|
+
const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible);
|
|
2321
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$1.button, {
|
|
2322
|
+
type: "button",
|
|
2323
|
+
"aria-controls": context.contentId,
|
|
2324
|
+
"aria-expanded": context.open || false,
|
|
2325
|
+
"data-state": getState$1(context.open),
|
|
2326
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
2327
|
+
disabled: context.disabled,
|
|
2328
|
+
...triggerProps,
|
|
1497
2329
|
ref: forwardedRef,
|
|
1498
|
-
|
|
1499
|
-
if (context.viewport && thumbRef.current) {
|
|
1500
|
-
const scrollPos = context.viewport.scrollTop;
|
|
1501
|
-
const offset = getThumbOffsetFromScroll(scrollPos, sizes);
|
|
1502
|
-
thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`;
|
|
1503
|
-
}
|
|
1504
|
-
},
|
|
1505
|
-
onWheelScroll: (scrollPos) => {
|
|
1506
|
-
if (context.viewport) context.viewport.scrollTop = scrollPos;
|
|
1507
|
-
},
|
|
1508
|
-
onDragScroll: (pointerPos) => {
|
|
1509
|
-
if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);
|
|
1510
|
-
}
|
|
2330
|
+
onClick: require_trust_score_card_glass.composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
1511
2331
|
});
|
|
1512
|
-
return null;
|
|
1513
2332
|
});
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
const
|
|
1518
|
-
const
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
ref: composeRefs,
|
|
1527
|
-
sizes,
|
|
1528
|
-
style: {
|
|
1529
|
-
bottom: 0,
|
|
1530
|
-
left: context.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
1531
|
-
right: context.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
1532
|
-
["--radix-scroll-area-thumb-width"]: getThumbSize(sizes) + "px",
|
|
1533
|
-
...props.style
|
|
1534
|
-
},
|
|
1535
|
-
onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.x),
|
|
1536
|
-
onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.x),
|
|
1537
|
-
onWheelScroll: (event, maxScrollPos) => {
|
|
1538
|
-
if (context.viewport) {
|
|
1539
|
-
const scrollPos = context.viewport.scrollLeft + event.deltaX;
|
|
1540
|
-
props.onWheelScroll(scrollPos);
|
|
1541
|
-
if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
|
|
1542
|
-
}
|
|
1543
|
-
},
|
|
1544
|
-
onResize: () => {
|
|
1545
|
-
if (ref.current && context.viewport && computedStyle) onSizesChange({
|
|
1546
|
-
content: context.viewport.scrollWidth,
|
|
1547
|
-
viewport: context.viewport.offsetWidth,
|
|
1548
|
-
scrollbar: {
|
|
1549
|
-
size: ref.current.clientWidth,
|
|
1550
|
-
paddingStart: toInt(computedStyle.paddingLeft),
|
|
1551
|
-
paddingEnd: toInt(computedStyle.paddingRight)
|
|
1552
|
-
}
|
|
1553
|
-
});
|
|
1554
|
-
}
|
|
2333
|
+
CollapsibleTrigger.displayName = TRIGGER_NAME;
|
|
2334
|
+
var CONTENT_NAME = "CollapsibleContent";
|
|
2335
|
+
var CollapsibleContent = react.forwardRef((props, forwardedRef) => {
|
|
2336
|
+
const { forceMount, ...contentProps } = props;
|
|
2337
|
+
const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible);
|
|
2338
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
|
|
2339
|
+
present: forceMount || context.open,
|
|
2340
|
+
children: ({ present }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollapsibleContentImpl, {
|
|
2341
|
+
...contentProps,
|
|
2342
|
+
ref: forwardedRef,
|
|
2343
|
+
present
|
|
2344
|
+
})
|
|
1555
2345
|
});
|
|
1556
2346
|
});
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
const
|
|
1560
|
-
const
|
|
2347
|
+
CollapsibleContent.displayName = CONTENT_NAME;
|
|
2348
|
+
var CollapsibleContentImpl = react.forwardRef((props, forwardedRef) => {
|
|
2349
|
+
const { __scopeCollapsible, present, children, ...contentProps } = props;
|
|
2350
|
+
const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible);
|
|
2351
|
+
const [isPresent, setIsPresent] = react.useState(present);
|
|
1561
2352
|
const ref = react.useRef(null);
|
|
1562
|
-
const
|
|
2353
|
+
const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref);
|
|
2354
|
+
const heightRef = react.useRef(0);
|
|
2355
|
+
const height = heightRef.current;
|
|
2356
|
+
const widthRef = react.useRef(0);
|
|
2357
|
+
const width = widthRef.current;
|
|
2358
|
+
const isOpen = context.open || isPresent;
|
|
2359
|
+
const isMountAnimationPreventedRef = react.useRef(isOpen);
|
|
2360
|
+
const originalStylesRef = react.useRef(void 0);
|
|
1563
2361
|
react.useEffect(() => {
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
2362
|
+
const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
|
|
2363
|
+
return () => cancelAnimationFrame(rAF);
|
|
2364
|
+
}, []);
|
|
2365
|
+
require_trust_score_card_glass.useLayoutEffect2(() => {
|
|
2366
|
+
const node = ref.current;
|
|
2367
|
+
if (node) {
|
|
2368
|
+
originalStylesRef.current = originalStylesRef.current || {
|
|
2369
|
+
transitionDuration: node.style.transitionDuration,
|
|
2370
|
+
animationName: node.style.animationName
|
|
2371
|
+
};
|
|
2372
|
+
node.style.transitionDuration = "0s";
|
|
2373
|
+
node.style.animationName = "none";
|
|
2374
|
+
const rect = node.getBoundingClientRect();
|
|
2375
|
+
heightRef.current = rect.height;
|
|
2376
|
+
widthRef.current = rect.width;
|
|
2377
|
+
if (!isMountAnimationPreventedRef.current) {
|
|
2378
|
+
node.style.transitionDuration = originalStylesRef.current.transitionDuration;
|
|
2379
|
+
node.style.animationName = originalStylesRef.current.animationName;
|
|
2380
|
+
}
|
|
2381
|
+
setIsPresent(present);
|
|
2382
|
+
}
|
|
2383
|
+
}, [context.open, present]);
|
|
2384
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$1.div, {
|
|
2385
|
+
"data-state": getState$1(context.open),
|
|
2386
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
2387
|
+
id: context.contentId,
|
|
2388
|
+
hidden: !isOpen,
|
|
2389
|
+
...contentProps,
|
|
2390
|
+
ref: composedRefs,
|
|
1571
2391
|
style: {
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
left: context.dir === "rtl" ? 0 : void 0,
|
|
1575
|
-
bottom: "var(--radix-scroll-area-corner-height)",
|
|
1576
|
-
["--radix-scroll-area-thumb-height"]: getThumbSize(sizes) + "px",
|
|
2392
|
+
[`--radix-collapsible-content-height`]: height ? `${height}px` : void 0,
|
|
2393
|
+
[`--radix-collapsible-content-width`]: width ? `${width}px` : void 0,
|
|
1577
2394
|
...props.style
|
|
1578
2395
|
},
|
|
1579
|
-
|
|
1580
|
-
onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.y),
|
|
1581
|
-
onWheelScroll: (event, maxScrollPos) => {
|
|
1582
|
-
if (context.viewport) {
|
|
1583
|
-
const scrollPos = context.viewport.scrollTop + event.deltaY;
|
|
1584
|
-
props.onWheelScroll(scrollPos);
|
|
1585
|
-
if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
|
|
1586
|
-
}
|
|
1587
|
-
},
|
|
1588
|
-
onResize: () => {
|
|
1589
|
-
if (ref.current && context.viewport && computedStyle) onSizesChange({
|
|
1590
|
-
content: context.viewport.scrollHeight,
|
|
1591
|
-
viewport: context.viewport.offsetHeight,
|
|
1592
|
-
scrollbar: {
|
|
1593
|
-
size: ref.current.clientHeight,
|
|
1594
|
-
paddingStart: toInt(computedStyle.paddingTop),
|
|
1595
|
-
paddingEnd: toInt(computedStyle.paddingBottom)
|
|
1596
|
-
}
|
|
1597
|
-
});
|
|
1598
|
-
}
|
|
2396
|
+
children: isOpen && children
|
|
1599
2397
|
});
|
|
1600
2398
|
});
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
2399
|
+
function getState$1(open) {
|
|
2400
|
+
return open ? "open" : "closed";
|
|
2401
|
+
}
|
|
2402
|
+
var Root = Collapsible;
|
|
2403
|
+
var Trigger = CollapsibleTrigger;
|
|
2404
|
+
var Content = CollapsibleContent;
|
|
2405
|
+
var CollapsibleGlassRoot = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root, {
|
|
2406
|
+
ref,
|
|
2407
|
+
className: require_utils.cn("w-full", className),
|
|
2408
|
+
...props
|
|
2409
|
+
}));
|
|
2410
|
+
CollapsibleGlassRoot.displayName = "CollapsibleGlassRoot";
|
|
2411
|
+
var CollapsibleGlassTrigger = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, {
|
|
2412
|
+
ref,
|
|
2413
|
+
className: require_utils.cn("flex w-full items-center justify-between", "focus-visible:outline-none focus-visible:ring-2", "focus-visible:ring-[var(--focus-ring)] focus-visible:ring-offset-2", className),
|
|
2414
|
+
...props
|
|
2415
|
+
}));
|
|
2416
|
+
CollapsibleGlassTrigger.displayName = "CollapsibleGlassTrigger";
|
|
2417
|
+
var CollapsibleGlassContent = react.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, {
|
|
2418
|
+
ref,
|
|
2419
|
+
className: require_utils.cn("overflow-hidden transition-all", "data-[state=closed]:animate-collapsible-up", "data-[state=open]:animate-collapsible-down", className),
|
|
2420
|
+
...props,
|
|
2421
|
+
children
|
|
2422
|
+
}));
|
|
2423
|
+
CollapsibleGlassContent.displayName = "CollapsibleGlassContent";
|
|
2424
|
+
const CollapsibleGlass = {
|
|
2425
|
+
Root: CollapsibleGlassRoot,
|
|
2426
|
+
Trigger: CollapsibleGlassTrigger,
|
|
2427
|
+
Content: CollapsibleGlassContent
|
|
2428
|
+
};
|
|
2429
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
2430
|
+
let defaultContexts = [];
|
|
2431
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
2432
|
+
const BaseContext = react.createContext(defaultContext);
|
|
2433
|
+
const index = defaultContexts.length;
|
|
2434
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
2435
|
+
const Provider = (props) => {
|
|
2436
|
+
const { scope, children, ...context } = props;
|
|
2437
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
2438
|
+
const value = react.useMemo(() => context, Object.values(context));
|
|
2439
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Context.Provider, {
|
|
2440
|
+
value,
|
|
2441
|
+
children
|
|
2442
|
+
});
|
|
2443
|
+
};
|
|
2444
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
2445
|
+
function useContext2(consumerName, scope) {
|
|
2446
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
2447
|
+
const context = react.useContext(Context);
|
|
2448
|
+
if (context) return context;
|
|
2449
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
2450
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
2451
|
+
}
|
|
2452
|
+
return [Provider, useContext2];
|
|
1619
2453
|
}
|
|
1620
|
-
|
|
1621
|
-
const
|
|
1622
|
-
|
|
1623
|
-
|
|
2454
|
+
const createScope = () => {
|
|
2455
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
2456
|
+
return react.createContext(defaultContext);
|
|
2457
|
+
});
|
|
2458
|
+
return function useScope(scope) {
|
|
2459
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
2460
|
+
return react.useMemo(() => ({ [`__scope${scopeName}`]: {
|
|
2461
|
+
...scope,
|
|
2462
|
+
[scopeName]: contexts
|
|
2463
|
+
} }), [scope, contexts]);
|
|
1624
2464
|
};
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
2465
|
+
};
|
|
2466
|
+
createScope.scopeName = scopeName;
|
|
2467
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
2468
|
+
}
|
|
2469
|
+
function composeContextScopes(...scopes) {
|
|
2470
|
+
const baseScope = scopes[0];
|
|
2471
|
+
if (scopes.length === 1) return baseScope;
|
|
2472
|
+
const createScope = () => {
|
|
2473
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
2474
|
+
useScope: createScope2(),
|
|
2475
|
+
scopeName: createScope2.scopeName
|
|
2476
|
+
}));
|
|
2477
|
+
return function useComposedScopes(overrideScopes) {
|
|
2478
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
2479
|
+
const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
|
|
2480
|
+
return {
|
|
2481
|
+
...nextScopes2,
|
|
2482
|
+
...currentScope
|
|
2483
|
+
};
|
|
2484
|
+
}, {});
|
|
2485
|
+
return react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
2486
|
+
};
|
|
2487
|
+
};
|
|
2488
|
+
createScope.scopeName = baseScope.scopeName;
|
|
2489
|
+
return createScope;
|
|
2490
|
+
}
|
|
2491
|
+
var Primitive = [
|
|
2492
|
+
"a",
|
|
2493
|
+
"button",
|
|
2494
|
+
"div",
|
|
2495
|
+
"form",
|
|
2496
|
+
"h2",
|
|
2497
|
+
"h3",
|
|
2498
|
+
"img",
|
|
2499
|
+
"input",
|
|
2500
|
+
"label",
|
|
2501
|
+
"li",
|
|
2502
|
+
"nav",
|
|
2503
|
+
"ol",
|
|
2504
|
+
"p",
|
|
2505
|
+
"select",
|
|
2506
|
+
"span",
|
|
2507
|
+
"svg",
|
|
2508
|
+
"ul"
|
|
2509
|
+
].reduce((primitive, node) => {
|
|
2510
|
+
const Slot$3 = (0, __radix_ui_react_slot.createSlot)(`Primitive.${node}`);
|
|
2511
|
+
const Node = react.forwardRef((props, forwardedRef) => {
|
|
2512
|
+
const { asChild, ...primitiveProps } = props;
|
|
2513
|
+
const Comp = asChild ? Slot$3 : node;
|
|
2514
|
+
if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
|
|
2515
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
|
|
2516
|
+
...primitiveProps,
|
|
2517
|
+
ref: forwardedRef
|
|
2518
|
+
});
|
|
2519
|
+
});
|
|
2520
|
+
Node.displayName = `Primitive.${node}`;
|
|
2521
|
+
return {
|
|
2522
|
+
...primitive,
|
|
2523
|
+
[node]: Node
|
|
2524
|
+
};
|
|
2525
|
+
}, {});
|
|
2526
|
+
var RADIO_NAME = "Radio";
|
|
2527
|
+
var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
|
|
2528
|
+
var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
|
|
2529
|
+
var Radio = react.forwardRef((props, forwardedRef) => {
|
|
2530
|
+
const { __scopeRadio, name, checked = false, required, disabled, value = "on", onCheck, form, ...radioProps } = props;
|
|
2531
|
+
const [button, setButton] = react.useState(null);
|
|
2532
|
+
const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
2533
|
+
const hasConsumerStoppedPropagationRef = react.useRef(false);
|
|
2534
|
+
const isFormControl = button ? form || !!button.closest("form") : true;
|
|
2535
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RadioProvider, {
|
|
2536
|
+
scope: __scopeRadio,
|
|
2537
|
+
checked,
|
|
2538
|
+
disabled,
|
|
2539
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.button, {
|
|
2540
|
+
type: "button",
|
|
2541
|
+
role: "radio",
|
|
2542
|
+
"aria-checked": checked,
|
|
2543
|
+
"data-state": getState(checked),
|
|
2544
|
+
"data-disabled": disabled ? "" : void 0,
|
|
2545
|
+
disabled,
|
|
2546
|
+
value,
|
|
2547
|
+
...radioProps,
|
|
2548
|
+
ref: composedRefs,
|
|
2549
|
+
onClick: require_trust_score_card_glass.composeEventHandlers(props.onClick, (event) => {
|
|
2550
|
+
if (!checked) onCheck?.();
|
|
2551
|
+
if (isFormControl) {
|
|
2552
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
2553
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
1659
2554
|
}
|
|
1660
|
-
}),
|
|
1661
|
-
onPointerMove: require_trust_score_card_glass.composeEventHandlers(props.onPointerMove, handleDragScroll),
|
|
1662
|
-
onPointerUp: require_trust_score_card_glass.composeEventHandlers(props.onPointerUp, (event) => {
|
|
1663
|
-
const element = event.target;
|
|
1664
|
-
if (element.hasPointerCapture(event.pointerId)) element.releasePointerCapture(event.pointerId);
|
|
1665
|
-
document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
|
|
1666
|
-
if (context.viewport) context.viewport.style.scrollBehavior = "";
|
|
1667
|
-
rectRef.current = null;
|
|
1668
2555
|
})
|
|
1669
|
-
})
|
|
2556
|
+
}), isFormControl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioBubbleInput, {
|
|
2557
|
+
control: button,
|
|
2558
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
2559
|
+
name,
|
|
2560
|
+
value,
|
|
2561
|
+
checked,
|
|
2562
|
+
required,
|
|
2563
|
+
disabled,
|
|
2564
|
+
form,
|
|
2565
|
+
style: { transform: "translateX(-100%)" }
|
|
2566
|
+
})]
|
|
1670
2567
|
});
|
|
1671
2568
|
});
|
|
1672
|
-
|
|
1673
|
-
var
|
|
1674
|
-
|
|
1675
|
-
const
|
|
2569
|
+
Radio.displayName = RADIO_NAME;
|
|
2570
|
+
var INDICATOR_NAME = "RadioIndicator";
|
|
2571
|
+
var RadioIndicator = react.forwardRef((props, forwardedRef) => {
|
|
2572
|
+
const { __scopeRadio, forceMount, ...indicatorProps } = props;
|
|
2573
|
+
const context = useRadioContext(INDICATOR_NAME, __scopeRadio);
|
|
1676
2574
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
|
|
1677
|
-
present: forceMount ||
|
|
1678
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
})
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
const
|
|
1690
|
-
const
|
|
1691
|
-
const
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
if (!removeUnlinkedScrollListenerRef.current) {
|
|
1703
|
-
removeUnlinkedScrollListenerRef.current = addUnlinkedScrollListener(viewport, onThumbPositionChange);
|
|
1704
|
-
onThumbPositionChange();
|
|
1705
|
-
}
|
|
1706
|
-
};
|
|
1707
|
-
onThumbPositionChange();
|
|
1708
|
-
viewport.addEventListener("scroll", handleScroll);
|
|
1709
|
-
return () => viewport.removeEventListener("scroll", handleScroll);
|
|
2575
|
+
present: forceMount || context.checked,
|
|
2576
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.span, {
|
|
2577
|
+
"data-state": getState(context.checked),
|
|
2578
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
2579
|
+
...indicatorProps,
|
|
2580
|
+
ref: forwardedRef
|
|
2581
|
+
})
|
|
2582
|
+
});
|
|
2583
|
+
});
|
|
2584
|
+
RadioIndicator.displayName = INDICATOR_NAME;
|
|
2585
|
+
var BUBBLE_INPUT_NAME = "RadioBubbleInput";
|
|
2586
|
+
var RadioBubbleInput = react.forwardRef(({ __scopeRadio, control, checked, bubbles = true, ...props }, forwardedRef) => {
|
|
2587
|
+
const ref = react.useRef(null);
|
|
2588
|
+
const composedRefs = require_trust_score_card_glass.useComposedRefs(ref, forwardedRef);
|
|
2589
|
+
const prevChecked = require_trust_score_card_glass.usePrevious(checked);
|
|
2590
|
+
const controlSize = require_trust_score_card_glass.useSize(control);
|
|
2591
|
+
react.useEffect(() => {
|
|
2592
|
+
const input = ref.current;
|
|
2593
|
+
if (!input) return;
|
|
2594
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
2595
|
+
const setChecked = Object.getOwnPropertyDescriptor(inputProto, "checked").set;
|
|
2596
|
+
if (prevChecked !== checked && setChecked) {
|
|
2597
|
+
const event = new Event("click", { bubbles });
|
|
2598
|
+
setChecked.call(input, checked);
|
|
2599
|
+
input.dispatchEvent(event);
|
|
1710
2600
|
}
|
|
1711
2601
|
}, [
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
2602
|
+
prevChecked,
|
|
2603
|
+
checked,
|
|
2604
|
+
bubbles
|
|
1715
2605
|
]);
|
|
1716
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
2606
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.input, {
|
|
2607
|
+
type: "radio",
|
|
2608
|
+
"aria-hidden": true,
|
|
2609
|
+
defaultChecked: checked,
|
|
2610
|
+
...props,
|
|
2611
|
+
tabIndex: -1,
|
|
2612
|
+
ref: composedRefs,
|
|
1720
2613
|
style: {
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
const y = event.clientY - thumbRect.top;
|
|
1729
|
-
scrollbarContext.onThumbPointerDown({
|
|
1730
|
-
x,
|
|
1731
|
-
y
|
|
1732
|
-
});
|
|
1733
|
-
}),
|
|
1734
|
-
onPointerUp: require_trust_score_card_glass.composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp)
|
|
2614
|
+
...props.style,
|
|
2615
|
+
...controlSize,
|
|
2616
|
+
position: "absolute",
|
|
2617
|
+
pointerEvents: "none",
|
|
2618
|
+
opacity: 0,
|
|
2619
|
+
margin: 0
|
|
2620
|
+
}
|
|
1735
2621
|
});
|
|
1736
2622
|
});
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
2623
|
+
RadioBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
2624
|
+
function getState(checked) {
|
|
2625
|
+
return checked ? "checked" : "unchecked";
|
|
2626
|
+
}
|
|
2627
|
+
var ARROW_KEYS = [
|
|
2628
|
+
"ArrowUp",
|
|
2629
|
+
"ArrowDown",
|
|
2630
|
+
"ArrowLeft",
|
|
2631
|
+
"ArrowRight"
|
|
2632
|
+
];
|
|
2633
|
+
var RADIO_GROUP_NAME = "RadioGroup";
|
|
2634
|
+
var [createRadioGroupContext, createRadioGroupScope] = createContextScope(RADIO_GROUP_NAME, [createRovingFocusGroupScope, createRadioScope]);
|
|
2635
|
+
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
2636
|
+
var useRadioScope = createRadioScope();
|
|
2637
|
+
var [RadioGroupProvider, useRadioGroupContext] = createRadioGroupContext(RADIO_GROUP_NAME);
|
|
2638
|
+
var RadioGroup = react.forwardRef((props, forwardedRef) => {
|
|
2639
|
+
const { __scopeRadioGroup, name, defaultValue, value: valueProp, required = false, disabled = false, orientation, dir, loop = true, onValueChange, ...groupProps } = props;
|
|
2640
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
|
|
2641
|
+
const direction = require_trust_score_card_glass.useDirection(dir);
|
|
2642
|
+
const [value, setValue] = require_trust_score_card_glass.useControllableState({
|
|
2643
|
+
prop: valueProp,
|
|
2644
|
+
defaultProp: defaultValue ?? null,
|
|
2645
|
+
onChange: onValueChange,
|
|
2646
|
+
caller: RADIO_GROUP_NAME
|
|
2647
|
+
});
|
|
2648
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioGroupProvider, {
|
|
2649
|
+
scope: __scopeRadioGroup,
|
|
2650
|
+
name,
|
|
2651
|
+
required,
|
|
2652
|
+
disabled,
|
|
2653
|
+
value,
|
|
2654
|
+
onValueChange: setValue,
|
|
2655
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$3, {
|
|
2656
|
+
asChild: true,
|
|
2657
|
+
...rovingFocusGroupScope,
|
|
2658
|
+
orientation,
|
|
2659
|
+
dir: direction,
|
|
2660
|
+
loop,
|
|
2661
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
|
|
2662
|
+
role: "radiogroup",
|
|
2663
|
+
"aria-required": required,
|
|
2664
|
+
"aria-orientation": orientation,
|
|
2665
|
+
"data-disabled": disabled ? "" : void 0,
|
|
2666
|
+
dir: direction,
|
|
2667
|
+
...groupProps,
|
|
2668
|
+
ref: forwardedRef
|
|
2669
|
+
})
|
|
2670
|
+
})
|
|
2671
|
+
});
|
|
2672
|
+
});
|
|
2673
|
+
RadioGroup.displayName = RADIO_GROUP_NAME;
|
|
2674
|
+
var ITEM_NAME = "RadioGroupItem";
|
|
2675
|
+
var RadioGroupItem = react.forwardRef((props, forwardedRef) => {
|
|
2676
|
+
const { __scopeRadioGroup, disabled, ...itemProps } = props;
|
|
2677
|
+
const context = useRadioGroupContext(ITEM_NAME, __scopeRadioGroup);
|
|
2678
|
+
const isDisabled = context.disabled || disabled;
|
|
2679
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
|
|
2680
|
+
const radioScope = useRadioScope(__scopeRadioGroup);
|
|
2681
|
+
const ref = react.useRef(null);
|
|
2682
|
+
const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref);
|
|
2683
|
+
const checked = context.value === itemProps.value;
|
|
2684
|
+
const isArrowKeyPressedRef = react.useRef(false);
|
|
2685
|
+
react.useEffect(() => {
|
|
2686
|
+
const handleKeyDown = (event) => {
|
|
2687
|
+
if (ARROW_KEYS.includes(event.key)) isArrowKeyPressedRef.current = true;
|
|
2688
|
+
};
|
|
2689
|
+
const handleKeyUp = () => isArrowKeyPressedRef.current = false;
|
|
2690
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2691
|
+
document.addEventListener("keyup", handleKeyUp);
|
|
2692
|
+
return () => {
|
|
2693
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
2694
|
+
document.removeEventListener("keyup", handleKeyUp);
|
|
2695
|
+
};
|
|
2696
|
+
}, []);
|
|
2697
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
|
|
2698
|
+
asChild: true,
|
|
2699
|
+
...rovingFocusGroupScope,
|
|
2700
|
+
focusable: !isDisabled,
|
|
2701
|
+
active: checked,
|
|
2702
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Radio, {
|
|
2703
|
+
disabled: isDisabled,
|
|
2704
|
+
required: context.required,
|
|
2705
|
+
checked,
|
|
2706
|
+
...radioScope,
|
|
2707
|
+
...itemProps,
|
|
2708
|
+
name: context.name,
|
|
2709
|
+
ref: composedRefs,
|
|
2710
|
+
onCheck: () => context.onValueChange(itemProps.value),
|
|
2711
|
+
onKeyDown: require_trust_score_card_glass.composeEventHandlers((event) => {
|
|
2712
|
+
if (event.key === "Enter") event.preventDefault();
|
|
2713
|
+
}),
|
|
2714
|
+
onFocus: require_trust_score_card_glass.composeEventHandlers(itemProps.onFocus, () => {
|
|
2715
|
+
if (isArrowKeyPressedRef.current) ref.current?.click();
|
|
2716
|
+
})
|
|
2717
|
+
})
|
|
2718
|
+
});
|
|
2719
|
+
});
|
|
2720
|
+
RadioGroupItem.displayName = ITEM_NAME;
|
|
2721
|
+
var INDICATOR_NAME2 = "RadioGroupIndicator";
|
|
2722
|
+
var RadioGroupIndicator = react.forwardRef((props, forwardedRef) => {
|
|
2723
|
+
const { __scopeRadioGroup, ...indicatorProps } = props;
|
|
2724
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioIndicator, {
|
|
2725
|
+
...useRadioScope(__scopeRadioGroup),
|
|
2726
|
+
...indicatorProps,
|
|
1744
2727
|
ref: forwardedRef
|
|
1745
|
-
})
|
|
2728
|
+
});
|
|
1746
2729
|
});
|
|
1747
|
-
|
|
1748
|
-
var
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
2730
|
+
RadioGroupIndicator.displayName = INDICATOR_NAME2;
|
|
2731
|
+
var Root2 = RadioGroup;
|
|
2732
|
+
var Item2 = RadioGroupItem;
|
|
2733
|
+
var Indicator = RadioGroupIndicator;
|
|
2734
|
+
var RadioGroupGlassRoot = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root2, {
|
|
2735
|
+
ref,
|
|
2736
|
+
className: require_utils.cn("grid gap-2", className),
|
|
2737
|
+
...props
|
|
2738
|
+
}));
|
|
2739
|
+
RadioGroupGlassRoot.displayName = "RadioGroupGlassRoot";
|
|
2740
|
+
var RadioGroupGlassItem = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item2, {
|
|
2741
|
+
ref,
|
|
2742
|
+
className: require_utils.cn("aspect-square h-4 w-4 rounded-full", "border border-[var(--radio-border,var(--glass-border))]", "bg-[var(--radio-bg,transparent)]", "text-[var(--radio-indicator,var(--semantic-primary))]", "ring-offset-background", "focus:outline-none focus-visible:ring-2", "focus-visible:ring-[var(--focus-ring)] focus-visible:ring-offset-2", "disabled:cursor-not-allowed disabled:opacity-50", "data-[state=checked]:border-[var(--radio-border-checked,var(--semantic-primary))]", "data-[state=checked]:bg-[var(--radio-bg-checked,var(--semantic-primary-subtle))]", "transition-all duration-200", className),
|
|
2743
|
+
...props,
|
|
2744
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Indicator, {
|
|
2745
|
+
className: "flex items-center justify-center",
|
|
2746
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Circle, { className: require_utils.cn("h-2.5 w-2.5 fill-current text-current", "drop-shadow-[0_0_4px_var(--semantic-primary)]") })
|
|
2747
|
+
})
|
|
2748
|
+
}));
|
|
2749
|
+
RadioGroupGlassItem.displayName = "RadioGroupGlassItem";
|
|
2750
|
+
const RadioGroupGlass = {
|
|
2751
|
+
Root: RadioGroupGlassRoot,
|
|
2752
|
+
Item: RadioGroupGlassItem
|
|
2753
|
+
};
|
|
2754
|
+
var sheetVariants = (0, class_variance_authority.cva)([
|
|
2755
|
+
"fixed z-50 gap-4 p-6",
|
|
2756
|
+
"bg-[var(--sheet-bg,var(--modal-bg))]",
|
|
2757
|
+
"border-[var(--sheet-border,var(--modal-border))]",
|
|
2758
|
+
"backdrop-blur-lg",
|
|
2759
|
+
"transition-all duration-300 ease-in-out",
|
|
2760
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out"
|
|
2761
|
+
], {
|
|
2762
|
+
variants: { side: {
|
|
2763
|
+
top: ["inset-x-0 top-0 border-b", "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top"],
|
|
2764
|
+
bottom: ["inset-x-0 bottom-0 border-t", "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"],
|
|
2765
|
+
left: ["inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left"],
|
|
2766
|
+
right: ["inset-y-0 right-0 h-full w-3/4 border-r sm:max-w-sm", "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right"]
|
|
2767
|
+
} },
|
|
2768
|
+
defaultVariants: { side: "right" }
|
|
2769
|
+
});
|
|
2770
|
+
var SheetGlassRoot = __radix_ui_react_dialog.Root;
|
|
2771
|
+
var SheetGlassTrigger = __radix_ui_react_dialog.Trigger;
|
|
2772
|
+
var SheetGlassClose = __radix_ui_react_dialog.Close;
|
|
2773
|
+
var SheetGlassPortal = __radix_ui_react_dialog.Portal;
|
|
2774
|
+
var SheetGlassOverlay = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_dialog.Overlay, {
|
|
2775
|
+
ref,
|
|
2776
|
+
className: require_utils.cn("fixed inset-0 z-50", "bg-[var(--sheet-overlay,var(--modal-overlay))]", "backdrop-blur-sm", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
|
|
2777
|
+
...props
|
|
2778
|
+
}));
|
|
2779
|
+
SheetGlassOverlay.displayName = "SheetGlassOverlay";
|
|
2780
|
+
var SheetGlassContent = react.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(SheetGlassPortal, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetGlassOverlay, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__radix_ui_react_dialog.Content, {
|
|
2781
|
+
ref,
|
|
2782
|
+
className: require_utils.cn(sheetVariants({ side }), className),
|
|
2783
|
+
...props,
|
|
2784
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__radix_ui_react_dialog.Close, {
|
|
2785
|
+
className: require_utils.cn("absolute right-4 top-4 rounded-sm", "opacity-70 ring-offset-background", "transition-opacity hover:opacity-100", "focus:outline-none focus:ring-2 focus:ring-[var(--focus-ring)] focus:ring-offset-2", "disabled:pointer-events-none", "data-[state=open]:bg-secondary"),
|
|
2786
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "h-4 w-4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2787
|
+
className: "sr-only",
|
|
2788
|
+
children: "Close"
|
|
2789
|
+
})]
|
|
2790
|
+
})]
|
|
2791
|
+
})] }));
|
|
2792
|
+
SheetGlassContent.displayName = "SheetGlassContent";
|
|
2793
|
+
var SheetGlassHeader = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2794
|
+
className: require_utils.cn("flex flex-col space-y-2 text-center sm:text-left", className),
|
|
2795
|
+
...props
|
|
2796
|
+
});
|
|
2797
|
+
SheetGlassHeader.displayName = "SheetGlassHeader";
|
|
2798
|
+
var SheetGlassFooter = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2799
|
+
className: require_utils.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
2800
|
+
...props
|
|
2801
|
+
});
|
|
2802
|
+
SheetGlassFooter.displayName = "SheetGlassFooter";
|
|
2803
|
+
var SheetGlassTitle = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_dialog.Title, {
|
|
2804
|
+
ref,
|
|
2805
|
+
className: require_utils.cn("text-lg font-semibold", "text-[var(--sheet-title,var(--text-primary))]", className),
|
|
2806
|
+
...props
|
|
2807
|
+
}));
|
|
2808
|
+
SheetGlassTitle.displayName = "SheetGlassTitle";
|
|
2809
|
+
var SheetGlassDescription = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_dialog.Description, {
|
|
2810
|
+
ref,
|
|
2811
|
+
className: require_utils.cn("text-sm", "text-[var(--sheet-description,var(--text-muted))]", className),
|
|
2812
|
+
...props
|
|
2813
|
+
}));
|
|
2814
|
+
SheetGlassDescription.displayName = "SheetGlassDescription";
|
|
2815
|
+
const SheetGlass = {
|
|
2816
|
+
Root: SheetGlassRoot,
|
|
2817
|
+
Trigger: SheetGlassTrigger,
|
|
2818
|
+
Close: SheetGlassClose,
|
|
2819
|
+
Portal: SheetGlassPortal,
|
|
2820
|
+
Overlay: SheetGlassOverlay,
|
|
2821
|
+
Content: SheetGlassContent,
|
|
2822
|
+
Header: SheetGlassHeader,
|
|
2823
|
+
Footer: SheetGlassFooter,
|
|
2824
|
+
Title: SheetGlassTitle,
|
|
2825
|
+
Description: SheetGlassDescription
|
|
2826
|
+
};
|
|
2827
|
+
function _extends$1() {
|
|
2828
|
+
return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
|
|
2829
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
2830
|
+
var t = arguments[e];
|
|
2831
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
2832
|
+
}
|
|
2833
|
+
return n;
|
|
2834
|
+
}, _extends$1.apply(null, arguments);
|
|
2835
|
+
}
|
|
2836
|
+
function ownKeys$1(e, r) {
|
|
2837
|
+
var t = Object.keys(e);
|
|
2838
|
+
if (Object.getOwnPropertySymbols) {
|
|
2839
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
2840
|
+
r && (o = o.filter(function(r$1) {
|
|
2841
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
2842
|
+
})), t.push.apply(t, o);
|
|
2843
|
+
}
|
|
2844
|
+
return t;
|
|
2845
|
+
}
|
|
2846
|
+
function _objectSpread$1(e) {
|
|
2847
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
2848
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
2849
|
+
r % 2 ? ownKeys$1(Object(t), !0).forEach(function(r$1) {
|
|
2850
|
+
_defineProperty$1(e, r$1, t[r$1]);
|
|
2851
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r$1) {
|
|
2852
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
2853
|
+
});
|
|
2854
|
+
}
|
|
2855
|
+
return e;
|
|
2856
|
+
}
|
|
2857
|
+
function _defineProperty$1(e, r, t) {
|
|
2858
|
+
return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
|
|
2859
|
+
value: t,
|
|
2860
|
+
enumerable: !0,
|
|
2861
|
+
configurable: !0,
|
|
2862
|
+
writable: !0
|
|
2863
|
+
}) : e[r] = t, e;
|
|
2864
|
+
}
|
|
2865
|
+
function _toPropertyKey$1(t) {
|
|
2866
|
+
var i = _toPrimitive$1(t, "string");
|
|
2867
|
+
return "symbol" == typeof i ? i : i + "";
|
|
2868
|
+
}
|
|
2869
|
+
function _toPrimitive$1(t, r) {
|
|
2870
|
+
if ("object" != typeof t || !t) return t;
|
|
2871
|
+
var e = t[Symbol.toPrimitive];
|
|
2872
|
+
if (void 0 !== e) {
|
|
2873
|
+
var i = e.call(t, r || "default");
|
|
2874
|
+
if ("object" != typeof i) return i;
|
|
2875
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2876
|
+
}
|
|
2877
|
+
return ("string" === r ? String : Number)(t);
|
|
2878
|
+
}
|
|
2879
|
+
var SIZE = 32;
|
|
2880
|
+
var defaultLegendContentDefaultProps = {
|
|
2881
|
+
align: "center",
|
|
2882
|
+
iconSize: 14,
|
|
2883
|
+
inactiveColor: "#ccc",
|
|
2884
|
+
layout: "horizontal",
|
|
2885
|
+
verticalAlign: "middle"
|
|
2886
|
+
};
|
|
2887
|
+
function Icon(_ref) {
|
|
2888
|
+
var { data, iconType, inactiveColor } = _ref;
|
|
2889
|
+
var halfSize = SIZE / 2;
|
|
2890
|
+
var sixthSize = SIZE / 6;
|
|
2891
|
+
var thirdSize = SIZE / 3;
|
|
2892
|
+
var color = data.inactive ? inactiveColor : data.color;
|
|
2893
|
+
var preferredIcon = iconType !== null && iconType !== void 0 ? iconType : data.type;
|
|
2894
|
+
if (preferredIcon === "none") return null;
|
|
2895
|
+
if (preferredIcon === "plainline") {
|
|
2896
|
+
var _data$payload;
|
|
2897
|
+
return /* @__PURE__ */ react.createElement("line", {
|
|
2898
|
+
strokeWidth: 4,
|
|
2899
|
+
fill: "none",
|
|
2900
|
+
stroke: color,
|
|
2901
|
+
strokeDasharray: (_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.strokeDasharray,
|
|
2902
|
+
x1: 0,
|
|
2903
|
+
y1: halfSize,
|
|
2904
|
+
x2: SIZE,
|
|
2905
|
+
y2: halfSize,
|
|
2906
|
+
className: "recharts-legend-icon"
|
|
2907
|
+
});
|
|
2908
|
+
}
|
|
2909
|
+
if (preferredIcon === "line") return /* @__PURE__ */ react.createElement("path", {
|
|
2910
|
+
strokeWidth: 4,
|
|
2911
|
+
fill: "none",
|
|
2912
|
+
stroke: color,
|
|
2913
|
+
d: "M0,".concat(halfSize, "h").concat(thirdSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(2 * thirdSize, ",").concat(halfSize, "\n H").concat(SIZE, "M").concat(2 * thirdSize, ",").concat(halfSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(thirdSize, ",").concat(halfSize),
|
|
2914
|
+
className: "recharts-legend-icon"
|
|
1758
2915
|
});
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
2916
|
+
if (preferredIcon === "rect") return /* @__PURE__ */ react.createElement("path", {
|
|
2917
|
+
stroke: "none",
|
|
2918
|
+
fill: color,
|
|
2919
|
+
d: "M0,".concat(SIZE / 8, "h").concat(SIZE, "v").concat(SIZE * 3 / 4, "h").concat(-SIZE, "z"),
|
|
2920
|
+
className: "recharts-legend-icon"
|
|
1763
2921
|
});
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
2922
|
+
if (/* @__PURE__ */ react.isValidElement(data.legendIcon)) {
|
|
2923
|
+
var iconProps = _objectSpread$1({}, data);
|
|
2924
|
+
delete iconProps.legendIcon;
|
|
2925
|
+
return /* @__PURE__ */ react.cloneElement(data.legendIcon, iconProps);
|
|
2926
|
+
}
|
|
2927
|
+
return /* @__PURE__ */ react.createElement(require_trust_score_card_glass.Symbols, {
|
|
2928
|
+
fill: color,
|
|
2929
|
+
cx: halfSize,
|
|
2930
|
+
cy: halfSize,
|
|
2931
|
+
size: SIZE,
|
|
2932
|
+
sizeType: "diameter",
|
|
2933
|
+
type: preferredIcon
|
|
2934
|
+
});
|
|
2935
|
+
}
|
|
2936
|
+
function Items(props) {
|
|
2937
|
+
var { payload, iconSize, layout, formatter, inactiveColor, iconType } = props;
|
|
2938
|
+
var viewBox = {
|
|
2939
|
+
x: 0,
|
|
2940
|
+
y: 0,
|
|
2941
|
+
width: SIZE,
|
|
2942
|
+
height: SIZE
|
|
2943
|
+
};
|
|
2944
|
+
var itemStyle = {
|
|
2945
|
+
display: layout === "horizontal" ? "inline-block" : "block",
|
|
2946
|
+
marginRight: 10
|
|
2947
|
+
};
|
|
2948
|
+
var svgStyle = {
|
|
2949
|
+
display: "inline-block",
|
|
2950
|
+
verticalAlign: "middle",
|
|
2951
|
+
marginRight: 4
|
|
2952
|
+
};
|
|
2953
|
+
return payload.map((entry, i) => {
|
|
2954
|
+
var finalFormatter = entry.formatter || formatter;
|
|
2955
|
+
var className = (0, clsx.clsx)({
|
|
2956
|
+
"recharts-legend-item": true,
|
|
2957
|
+
["legend-item-".concat(i)]: true,
|
|
2958
|
+
inactive: entry.inactive
|
|
2959
|
+
});
|
|
2960
|
+
if (entry.type === "none") return null;
|
|
2961
|
+
var color = entry.inactive ? inactiveColor : entry.color;
|
|
2962
|
+
var finalValue = finalFormatter ? finalFormatter(entry.value, entry, i) : entry.value;
|
|
2963
|
+
return /* @__PURE__ */ react.createElement("li", _extends$1({
|
|
2964
|
+
className,
|
|
2965
|
+
style: itemStyle,
|
|
2966
|
+
key: "legend-item-".concat(i)
|
|
2967
|
+
}, require_trust_score_card_glass.adaptEventsOfChild(props, entry, i)), /* @__PURE__ */ react.createElement(require_trust_score_card_glass.Surface, {
|
|
2968
|
+
width: iconSize,
|
|
2969
|
+
height: iconSize,
|
|
2970
|
+
viewBox,
|
|
2971
|
+
style: svgStyle,
|
|
2972
|
+
"aria-label": "".concat(finalValue, " legend icon")
|
|
2973
|
+
}, /* @__PURE__ */ react.createElement(Icon, {
|
|
2974
|
+
data: entry,
|
|
2975
|
+
iconType,
|
|
2976
|
+
inactiveColor
|
|
2977
|
+
})), /* @__PURE__ */ react.createElement("span", {
|
|
2978
|
+
className: "recharts-legend-item-text",
|
|
2979
|
+
style: { color }
|
|
2980
|
+
}, finalValue));
|
|
2981
|
+
});
|
|
2982
|
+
}
|
|
2983
|
+
var DefaultLegendContent = (outsideProps) => {
|
|
2984
|
+
var props = require_trust_score_card_glass.resolveDefaultProps(outsideProps, defaultLegendContentDefaultProps);
|
|
2985
|
+
var { payload, layout, align } = props;
|
|
2986
|
+
if (!payload || !payload.length) return null;
|
|
2987
|
+
var finalStyle = {
|
|
2988
|
+
padding: 0,
|
|
2989
|
+
margin: 0,
|
|
2990
|
+
textAlign: layout === "horizontal" ? align : "left"
|
|
2991
|
+
};
|
|
2992
|
+
return /* @__PURE__ */ react.createElement("ul", {
|
|
2993
|
+
className: "recharts-default-legend",
|
|
2994
|
+
style: finalStyle
|
|
2995
|
+
}, /* @__PURE__ */ react.createElement(Items, _extends$1({}, props, { payload })));
|
|
2996
|
+
};
|
|
2997
|
+
function useLegendPayload() {
|
|
2998
|
+
return require_trust_score_card_glass.useAppSelector(require_trust_score_card_glass.selectLegendPayload);
|
|
2999
|
+
}
|
|
3000
|
+
var _excluded = ["contextPayload"];
|
|
3001
|
+
function _extends() {
|
|
3002
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
3003
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
3004
|
+
var t = arguments[e];
|
|
3005
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
1775
3006
|
}
|
|
1776
|
-
|
|
1777
|
-
});
|
|
1778
|
-
function toInt(value) {
|
|
1779
|
-
return value ? parseInt(value, 10) : 0;
|
|
3007
|
+
return n;
|
|
3008
|
+
}, _extends.apply(null, arguments);
|
|
1780
3009
|
}
|
|
1781
|
-
function
|
|
1782
|
-
|
|
1783
|
-
|
|
3010
|
+
function ownKeys(e, r) {
|
|
3011
|
+
var t = Object.keys(e);
|
|
3012
|
+
if (Object.getOwnPropertySymbols) {
|
|
3013
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
3014
|
+
r && (o = o.filter(function(r$1) {
|
|
3015
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
3016
|
+
})), t.push.apply(t, o);
|
|
3017
|
+
}
|
|
3018
|
+
return t;
|
|
1784
3019
|
}
|
|
1785
|
-
function
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
3020
|
+
function _objectSpread(e) {
|
|
3021
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
3022
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
3023
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
|
|
3024
|
+
_defineProperty(e, r$1, t[r$1]);
|
|
3025
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
3026
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
3027
|
+
});
|
|
3028
|
+
}
|
|
3029
|
+
return e;
|
|
1790
3030
|
}
|
|
1791
|
-
function
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
const maxScrollPos = sizes.content - sizes.viewport;
|
|
1799
|
-
const scrollRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
|
|
1800
|
-
return linearScale([minPointerPos, maxPointerPos], scrollRange)(pointerPos);
|
|
3031
|
+
function _defineProperty(e, r, t) {
|
|
3032
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
3033
|
+
value: t,
|
|
3034
|
+
enumerable: !0,
|
|
3035
|
+
configurable: !0,
|
|
3036
|
+
writable: !0
|
|
3037
|
+
}) : e[r] = t, e;
|
|
1801
3038
|
}
|
|
1802
|
-
function
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
const scrollbar = sizes.scrollbar.size - scrollbarPadding;
|
|
1806
|
-
const maxScrollPos = sizes.content - sizes.viewport;
|
|
1807
|
-
const maxThumbPos = scrollbar - thumbSizePx;
|
|
1808
|
-
const scrollWithoutMomentum = require_trust_score_card_glass.clamp(scrollPos, dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0]);
|
|
1809
|
-
return linearScale([0, maxScrollPos], [0, maxThumbPos])(scrollWithoutMomentum);
|
|
3039
|
+
function _toPropertyKey(t) {
|
|
3040
|
+
var i = _toPrimitive(t, "string");
|
|
3041
|
+
return "symbol" == typeof i ? i : i + "";
|
|
1810
3042
|
}
|
|
1811
|
-
function
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
3043
|
+
function _toPrimitive(t, r) {
|
|
3044
|
+
if ("object" != typeof t || !t) return t;
|
|
3045
|
+
var e = t[Symbol.toPrimitive];
|
|
3046
|
+
if (void 0 !== e) {
|
|
3047
|
+
var i = e.call(t, r || "default");
|
|
3048
|
+
if ("object" != typeof i) return i;
|
|
3049
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3050
|
+
}
|
|
3051
|
+
return ("string" === r ? String : Number)(t);
|
|
1817
3052
|
}
|
|
1818
|
-
function
|
|
1819
|
-
|
|
3053
|
+
function _objectWithoutProperties(e, t) {
|
|
3054
|
+
if (null == e) return {};
|
|
3055
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
3056
|
+
if (Object.getOwnPropertySymbols) {
|
|
3057
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
3058
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
3059
|
+
}
|
|
3060
|
+
return i;
|
|
1820
3061
|
}
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
3062
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
3063
|
+
if (null == r) return {};
|
|
3064
|
+
var t = {};
|
|
3065
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
3066
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
3067
|
+
t[n] = r[n];
|
|
3068
|
+
}
|
|
3069
|
+
return t;
|
|
3070
|
+
}
|
|
3071
|
+
function defaultUniqBy(entry) {
|
|
3072
|
+
return entry.value;
|
|
3073
|
+
}
|
|
3074
|
+
function LegendContent(props) {
|
|
3075
|
+
var { contextPayload } = props, otherProps = _objectWithoutProperties(props, _excluded);
|
|
3076
|
+
var finalPayload = require_trust_score_card_glass.getUniqPayload(contextPayload, props.payloadUniqBy, defaultUniqBy);
|
|
3077
|
+
var contentProps = _objectSpread(_objectSpread({}, otherProps), {}, { payload: finalPayload });
|
|
3078
|
+
if (/* @__PURE__ */ react.isValidElement(props.content)) return /* @__PURE__ */ react.cloneElement(props.content, contentProps);
|
|
3079
|
+
if (typeof props.content === "function") return /* @__PURE__ */ react.createElement(props.content, contentProps);
|
|
3080
|
+
return /* @__PURE__ */ react.createElement(DefaultLegendContent, contentProps);
|
|
3081
|
+
}
|
|
3082
|
+
function getDefaultPosition(style, props, margin, chartWidth, chartHeight, box) {
|
|
3083
|
+
var { layout, align, verticalAlign } = props;
|
|
3084
|
+
var hPos, vPos;
|
|
3085
|
+
if (!style || (style.left === void 0 || style.left === null) && (style.right === void 0 || style.right === null)) if (align === "center" && layout === "vertical") hPos = { left: ((chartWidth || 0) - box.width) / 2 };
|
|
3086
|
+
else hPos = align === "right" ? { right: margin && margin.right || 0 } : { left: margin && margin.left || 0 };
|
|
3087
|
+
if (!style || (style.top === void 0 || style.top === null) && (style.bottom === void 0 || style.bottom === null)) if (verticalAlign === "middle") vPos = { top: ((chartHeight || 0) - box.height) / 2 };
|
|
3088
|
+
else vPos = verticalAlign === "bottom" ? { bottom: margin && margin.bottom || 0 } : { top: margin && margin.top || 0 };
|
|
3089
|
+
return _objectSpread(_objectSpread({}, hPos), vPos);
|
|
3090
|
+
}
|
|
3091
|
+
function LegendSettingsDispatcher(props) {
|
|
3092
|
+
var dispatch = require_trust_score_card_glass.useAppDispatch();
|
|
3093
|
+
(0, react.useEffect)(() => {
|
|
3094
|
+
dispatch(require_trust_score_card_glass.setLegendSettings(props));
|
|
3095
|
+
}, [dispatch, props]);
|
|
3096
|
+
return null;
|
|
3097
|
+
}
|
|
3098
|
+
function LegendSizeDispatcher(props) {
|
|
3099
|
+
var dispatch = require_trust_score_card_glass.useAppDispatch();
|
|
3100
|
+
(0, react.useEffect)(() => {
|
|
3101
|
+
dispatch(require_trust_score_card_glass.setLegendSize(props));
|
|
3102
|
+
return () => {
|
|
3103
|
+
dispatch(require_trust_score_card_glass.setLegendSize({
|
|
3104
|
+
width: 0,
|
|
3105
|
+
height: 0
|
|
3106
|
+
}));
|
|
1831
3107
|
};
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
if (isHorizontalScroll || isVerticalScroll) handler();
|
|
1835
|
-
prevPosition = position;
|
|
1836
|
-
rAF = window.requestAnimationFrame(loop);
|
|
1837
|
-
})();
|
|
1838
|
-
return () => window.cancelAnimationFrame(rAF);
|
|
1839
|
-
};
|
|
1840
|
-
function useDebounceCallback(callback, delay) {
|
|
1841
|
-
const handleCallback = require_trust_score_card_glass.useCallbackRef(callback);
|
|
1842
|
-
const debounceTimerRef = react.useRef(0);
|
|
1843
|
-
react.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
|
|
1844
|
-
return react.useCallback(() => {
|
|
1845
|
-
window.clearTimeout(debounceTimerRef.current);
|
|
1846
|
-
debounceTimerRef.current = window.setTimeout(handleCallback, delay);
|
|
1847
|
-
}, [handleCallback, delay]);
|
|
3108
|
+
}, [dispatch, props]);
|
|
3109
|
+
return null;
|
|
1848
3110
|
}
|
|
1849
|
-
function
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
if (element) {
|
|
1854
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
1855
|
-
cancelAnimationFrame(rAF);
|
|
1856
|
-
rAF = window.requestAnimationFrame(handleResize);
|
|
1857
|
-
});
|
|
1858
|
-
resizeObserver.observe(element);
|
|
1859
|
-
return () => {
|
|
1860
|
-
window.cancelAnimationFrame(rAF);
|
|
1861
|
-
resizeObserver.unobserve(element);
|
|
1862
|
-
};
|
|
1863
|
-
}
|
|
1864
|
-
}, [element, handleResize]);
|
|
3111
|
+
function getWidthOrHeight(layout, height, width, maxWidth) {
|
|
3112
|
+
if (layout === "vertical" && require_trust_score_card_glass.isNumber(height)) return { height };
|
|
3113
|
+
if (layout === "horizontal") return { width: width || maxWidth };
|
|
3114
|
+
return null;
|
|
1865
3115
|
}
|
|
1866
|
-
var
|
|
1867
|
-
|
|
1868
|
-
|
|
3116
|
+
var legendDefaultProps = {
|
|
3117
|
+
align: "center",
|
|
3118
|
+
iconSize: 14,
|
|
3119
|
+
itemSorter: "value",
|
|
3120
|
+
layout: "horizontal",
|
|
3121
|
+
verticalAlign: "bottom"
|
|
3122
|
+
};
|
|
3123
|
+
function Legend(outsideProps) {
|
|
3124
|
+
var props = require_trust_score_card_glass.resolveDefaultProps(outsideProps, legendDefaultProps);
|
|
3125
|
+
var contextPayload = useLegendPayload();
|
|
3126
|
+
var legendPortalFromContext = require_trust_score_card_glass.useLegendPortal();
|
|
3127
|
+
var margin = require_trust_score_card_glass.useMargin();
|
|
3128
|
+
var { width: widthFromProps, height: heightFromProps, wrapperStyle, portal: portalFromProps } = props;
|
|
3129
|
+
var [lastBoundingBox, updateBoundingBox] = require_trust_score_card_glass.useElementOffset([contextPayload]);
|
|
3130
|
+
var chartWidth = require_trust_score_card_glass.useChartWidth();
|
|
3131
|
+
var chartHeight = require_trust_score_card_glass.useChartHeight();
|
|
3132
|
+
if (chartWidth == null || chartHeight == null) return null;
|
|
3133
|
+
var maxWidth = chartWidth - ((margin === null || margin === void 0 ? void 0 : margin.left) || 0) - ((margin === null || margin === void 0 ? void 0 : margin.right) || 0);
|
|
3134
|
+
var widthOrHeight = getWidthOrHeight(props.layout, heightFromProps, widthFromProps, maxWidth);
|
|
3135
|
+
var outerStyle = portalFromProps ? wrapperStyle : _objectSpread(_objectSpread({
|
|
3136
|
+
position: "absolute",
|
|
3137
|
+
width: (widthOrHeight === null || widthOrHeight === void 0 ? void 0 : widthOrHeight.width) || widthFromProps || "auto",
|
|
3138
|
+
height: (widthOrHeight === null || widthOrHeight === void 0 ? void 0 : widthOrHeight.height) || heightFromProps || "auto"
|
|
3139
|
+
}, getDefaultPosition(wrapperStyle, props, margin, chartWidth, chartHeight, lastBoundingBox)), wrapperStyle);
|
|
3140
|
+
var legendPortal = portalFromProps !== null && portalFromProps !== void 0 ? portalFromProps : legendPortalFromContext;
|
|
3141
|
+
if (legendPortal == null || contextPayload == null) return null;
|
|
3142
|
+
return /* @__PURE__ */ (0, react_dom.createPortal)(/* @__PURE__ */ react.createElement("div", {
|
|
3143
|
+
className: "recharts-legend-wrapper",
|
|
3144
|
+
style: outerStyle,
|
|
3145
|
+
ref: updateBoundingBox
|
|
3146
|
+
}, /* @__PURE__ */ react.createElement(LegendSettingsDispatcher, {
|
|
3147
|
+
layout: props.layout,
|
|
3148
|
+
align: props.align,
|
|
3149
|
+
verticalAlign: props.verticalAlign,
|
|
3150
|
+
itemSorter: props.itemSorter
|
|
3151
|
+
}), !portalFromProps && /* @__PURE__ */ react.createElement(LegendSizeDispatcher, {
|
|
3152
|
+
width: lastBoundingBox.width,
|
|
3153
|
+
height: lastBoundingBox.height
|
|
3154
|
+
}), /* @__PURE__ */ react.createElement(LegendContent, _extends({}, props, widthOrHeight, {
|
|
3155
|
+
margin,
|
|
3156
|
+
chartWidth,
|
|
3157
|
+
chartHeight,
|
|
3158
|
+
contextPayload
|
|
3159
|
+
}))), legendPortal);
|
|
3160
|
+
}
|
|
3161
|
+
Legend.displayName = "Legend";
|
|
1869
3162
|
function ScrollArea({ className, children, ...props }) {
|
|
1870
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, {
|
|
3163
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root$1, {
|
|
1871
3164
|
"data-slot": "scroll-area",
|
|
1872
3165
|
className: require_utils.cn("relative", className),
|
|
1873
3166
|
...props,
|
|
@@ -2574,6 +3867,10 @@ exports.ChartTooltipContent = ChartTooltipContent;
|
|
|
2574
3867
|
exports.CheckboxGlass = require_trust_score_card_glass.CheckboxGlass;
|
|
2575
3868
|
exports.CircularMetricGlass = require_trust_score_card_glass.CircularMetricGlass;
|
|
2576
3869
|
exports.CircularProgressGlass = require_trust_score_card_glass.CircularProgressGlass;
|
|
3870
|
+
exports.CollapsibleGlass = CollapsibleGlass;
|
|
3871
|
+
exports.CollapsibleGlassContent = CollapsibleGlassContent;
|
|
3872
|
+
exports.CollapsibleGlassRoot = CollapsibleGlassRoot;
|
|
3873
|
+
exports.CollapsibleGlassTrigger = CollapsibleGlassTrigger;
|
|
2577
3874
|
exports.ComboBoxGlass = require_trust_score_card_glass.ComboBoxGlass;
|
|
2578
3875
|
exports.ContributionMetricsGlass = require_trust_score_card_glass.ContributionMetricsGlass;
|
|
2579
3876
|
exports.DropdownGlass = require_trust_score_card_glass.DropdownGlass;
|
|
@@ -2597,6 +3894,12 @@ exports.FlagAlertGlass = require_trust_score_card_glass.FlagAlertGlass;
|
|
|
2597
3894
|
exports.FlagsSectionGlass = require_trust_score_card_glass.FlagsSectionGlass;
|
|
2598
3895
|
exports.FormFieldWrapper = require_trust_score_card_glass.FormFieldWrapper;
|
|
2599
3896
|
exports.GlassCard = require_trust_score_card_glass.GlassCard;
|
|
3897
|
+
exports.GlassCardAction = require_trust_score_card_glass.GlassCardAction;
|
|
3898
|
+
exports.GlassCardContent = require_trust_score_card_glass.GlassCardContent;
|
|
3899
|
+
exports.GlassCardDescription = require_trust_score_card_glass.GlassCardDescription;
|
|
3900
|
+
exports.GlassCardFooter = require_trust_score_card_glass.GlassCardFooter;
|
|
3901
|
+
exports.GlassCardHeader = require_trust_score_card_glass.GlassCardHeader;
|
|
3902
|
+
exports.GlassCardTitle = require_trust_score_card_glass.GlassCardTitle;
|
|
2600
3903
|
exports.HeaderBrandingGlass = require_trust_score_card_glass.HeaderBrandingGlass;
|
|
2601
3904
|
exports.HeaderNavGlass = require_trust_score_card_glass.HeaderNavGlass;
|
|
2602
3905
|
exports.IconButtonGlass = require_trust_score_card_glass.IconButtonGlass;
|
|
@@ -2617,13 +3920,30 @@ exports.ProfileAvatarGlass = require_trust_score_card_glass.ProfileAvatarGlass;
|
|
|
2617
3920
|
exports.ProfileHeaderGlass = require_trust_score_card_glass.ProfileHeaderGlass;
|
|
2618
3921
|
exports.ProgressGlass = require_trust_score_card_glass.ProgressGlass;
|
|
2619
3922
|
exports.ProjectsListGlass = require_trust_score_card_glass.ProjectsListGlass;
|
|
3923
|
+
exports.RadioGroupGlass = RadioGroupGlass;
|
|
3924
|
+
exports.RadioGroupGlassItem = RadioGroupGlassItem;
|
|
3925
|
+
exports.RadioGroupGlassRoot = RadioGroupGlassRoot;
|
|
2620
3926
|
exports.RainbowProgressGlass = require_trust_score_card_glass.RainbowProgressGlass;
|
|
2621
3927
|
exports.RepositoryCardGlass = require_trust_score_card_glass.RepositoryCardGlass;
|
|
2622
3928
|
exports.RepositoryHeaderGlass = require_trust_score_card_glass.RepositoryHeaderGlass;
|
|
2623
3929
|
exports.RepositoryMetadataGlass = require_trust_score_card_glass.RepositoryMetadataGlass;
|
|
2624
3930
|
exports.ResponsiveContainer = require_trust_score_card_glass.ResponsiveContainer;
|
|
3931
|
+
exports.ScrollAreaGlass = ScrollAreaGlass;
|
|
3932
|
+
exports.ScrollBarGlass = ScrollBarGlass;
|
|
2625
3933
|
exports.SearchBoxGlass = require_trust_score_card_glass.SearchBoxGlass;
|
|
2626
3934
|
exports.SegmentedControlGlass = require_trust_score_card_glass.SegmentedControlGlass;
|
|
3935
|
+
exports.SeparatorGlass = SeparatorGlass;
|
|
3936
|
+
exports.SheetGlass = SheetGlass;
|
|
3937
|
+
exports.SheetGlassClose = SheetGlassClose;
|
|
3938
|
+
exports.SheetGlassContent = SheetGlassContent;
|
|
3939
|
+
exports.SheetGlassDescription = SheetGlassDescription;
|
|
3940
|
+
exports.SheetGlassFooter = SheetGlassFooter;
|
|
3941
|
+
exports.SheetGlassHeader = SheetGlassHeader;
|
|
3942
|
+
exports.SheetGlassOverlay = SheetGlassOverlay;
|
|
3943
|
+
exports.SheetGlassPortal = SheetGlassPortal;
|
|
3944
|
+
exports.SheetGlassRoot = SheetGlassRoot;
|
|
3945
|
+
exports.SheetGlassTitle = SheetGlassTitle;
|
|
3946
|
+
exports.SheetGlassTrigger = SheetGlassTrigger;
|
|
2627
3947
|
exports.SidebarGlass = SidebarGlass;
|
|
2628
3948
|
exports.SkeletonGlass = require_trust_score_card_glass.SkeletonGlass;
|
|
2629
3949
|
exports.SliderGlass = require_trust_score_card_glass.SliderGlass;
|
|
@@ -2640,6 +3960,9 @@ exports.TabsGlass = require_trust_score_card_glass.TabsGlass;
|
|
|
2640
3960
|
exports.ThemeProvider = require_theme_context.ThemeProvider;
|
|
2641
3961
|
exports.ThemeToggleGlass = require_trust_score_card_glass.ThemeToggleGlass;
|
|
2642
3962
|
exports.ToggleGlass = require_trust_score_card_glass.ToggleGlass;
|
|
3963
|
+
exports.ToggleGroupGlass = ToggleGroupGlass;
|
|
3964
|
+
exports.ToggleGroupGlassItem = ToggleGroupGlassItem;
|
|
3965
|
+
exports.ToggleGroupGlassRoot = ToggleGroupGlassRoot;
|
|
2643
3966
|
exports.TooltipGlass = require_trust_score_card_glass.TooltipGlass;
|
|
2644
3967
|
exports.TooltipGlassContent = require_trust_score_card_glass.TooltipGlassContent;
|
|
2645
3968
|
exports.TooltipGlassProvider = require_trust_score_card_glass.TooltipGlassProvider;
|