shadcn-glass-ui 2.2.0 → 2.2.3

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +12 -46
  2. package/README.md +11 -12
  3. package/context7.json +4 -15
  4. package/dist/cli/index.cjs +1 -1
  5. package/dist/components.cjs +4 -4
  6. package/dist/components.d.ts +90 -161
  7. package/dist/components.js +1 -1
  8. package/dist/hooks.cjs +2 -2
  9. package/dist/index.cjs +1064 -2292
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.js +1055 -2256
  12. package/dist/index.js.map +1 -1
  13. package/dist/r/alert-glass.json +1 -1
  14. package/dist/r/badge-glass.json +1 -1
  15. package/dist/r/button-glass.json +1 -1
  16. package/dist/r/card-glass.json +40 -0
  17. package/dist/r/input-glass.json +1 -1
  18. package/dist/r/modal-glass.json +5 -5
  19. package/dist/r/registry.json +7 -1
  20. package/dist/r/tooltip-glass.json +1 -1
  21. package/dist/shadcn-glass-ui.css +1 -1
  22. package/dist/{theme-context-D_cb9KzA.cjs → theme-context-BEA8K_rq.cjs} +2 -2
  23. package/dist/{theme-context-D_cb9KzA.cjs.map → theme-context-BEA8K_rq.cjs.map} +1 -1
  24. package/dist/themes.cjs +1 -1
  25. package/dist/{trust-score-card-glass-CTsEVRD3.cjs → trust-score-card-glass-DTS1RdIt.cjs} +189 -341
  26. package/dist/trust-score-card-glass-DTS1RdIt.cjs.map +1 -0
  27. package/dist/{trust-score-card-glass-CUStm4o_.js → trust-score-card-glass-Dg4_b_g_.js} +158 -238
  28. package/dist/trust-score-card-glass-Dg4_b_g_.js.map +1 -0
  29. package/dist/{use-focus--Hw2nevi.cjs → use-focus-CdoUzFQ8.cjs} +2 -2
  30. package/dist/{use-focus--Hw2nevi.cjs.map → use-focus-CdoUzFQ8.cjs.map} +1 -1
  31. package/dist/{use-wallpaper-tint-B4oMQsXQ.cjs → use-wallpaper-tint-Rq5UgY9L.cjs} +2 -2
  32. package/dist/{use-wallpaper-tint-B4oMQsXQ.cjs.map → use-wallpaper-tint-Rq5UgY9L.cjs.map} +1 -1
  33. package/dist/{utils-BqeJ4aco.cjs → utils-NLnOCttr.cjs} +2 -2
  34. package/dist/{utils-BqeJ4aco.cjs.map → utils-NLnOCttr.cjs.map} +1 -1
  35. package/dist/utils.cjs +1 -1
  36. package/docs/ADVANCED_PATTERNS.md +7 -5
  37. package/docs/AI_USAGE.md +0 -1
  38. package/docs/BEST_PRACTICES.md +0 -2
  39. package/docs/BREAKING_CHANGES.md +0 -1
  40. package/docs/COMPONENTS_CATALOG.md +1 -4
  41. package/docs/COMPONENT_PATTERNS.md +325 -0
  42. package/docs/GETTING_STARTED.md +52 -28
  43. package/docs/api/README.md +0 -2
  44. package/docs/api/variables/ModalGlass.md +5 -4
  45. package/package.json +2 -4
  46. package/dist/trust-score-card-glass-CTsEVRD3.cjs.map +0 -1
  47. package/dist/trust-score-card-glass-CUStm4o_.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
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");
1
+ const require_trust_score_card_glass = require("./trust-score-card-glass-DTS1RdIt.cjs");
2
+ const require_utils = require("./utils-NLnOCttr.cjs");
3
+ const require_use_focus = require("./use-focus-CdoUzFQ8.cjs");
4
+ const require_theme_context = require("./theme-context-BEA8K_rq.cjs");
5
+ const require_use_wallpaper_tint = require("./use-wallpaper-tint-Rq5UgY9L.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,9 +12,93 @@ 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
+ var blurMap = {
16
+ subtle: "var(--blur-sm)",
17
+ medium: "var(--blur-md)",
18
+ strong: "var(--blur-lg)"
19
+ };
20
+ var bgVarMap = {
21
+ subtle: "var(--card-subtle-bg)",
22
+ medium: "var(--card-medium-bg)",
23
+ strong: "var(--card-strong-bg)"
24
+ };
25
+ var borderVarMap = {
26
+ subtle: "var(--card-subtle-border)",
27
+ medium: "var(--card-medium-border)",
28
+ strong: "var(--card-strong-border)"
29
+ };
30
+ var glowVarMap = {
31
+ blue: "var(--glow-blue)",
32
+ violet: "var(--glow-violet)",
33
+ cyan: "var(--glow-cyan)"
34
+ };
35
+ function CardGlassRoot({ className, intensity = "medium", glow = null, hover = false, style, ...props }) {
36
+ const cardStyles = {
37
+ background: bgVarMap[intensity],
38
+ borderColor: borderVarMap[intensity],
39
+ backdropFilter: `blur(${blurMap[intensity]})`,
40
+ WebkitBackdropFilter: `blur(${blurMap[intensity]})`,
41
+ boxShadow: glow ? glowVarMap[glow] : "var(--glow-neutral)",
42
+ ...style
43
+ };
44
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
45
+ "data-slot": "card",
46
+ className: require_utils.cn("flex flex-col gap-6 rounded-xl border py-6 transition-all duration-300", "text-[var(--text-primary)]", hover && "hover:shadow-lg hover:border-[var(--card-hover-border)] cursor-pointer", className),
47
+ style: cardStyles,
48
+ ...props
49
+ });
50
+ }
51
+ function CardGlassHeader({ className, ...props }) {
52
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
53
+ "data-slot": "card-header",
54
+ className: require_utils.cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6", "has-data-[slot=card-action]:grid-cols-[1fr_auto]", "[.border-b]:pb-6", className),
55
+ ...props
56
+ });
57
+ }
58
+ function CardGlassTitle({ className, ...props }) {
59
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
60
+ "data-slot": "card-title",
61
+ className: require_utils.cn("leading-none font-semibold text-[var(--text-primary)]", className),
62
+ ...props
63
+ });
64
+ }
65
+ function CardGlassDescription({ className, ...props }) {
66
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
67
+ "data-slot": "card-description",
68
+ className: require_utils.cn("text-sm text-[var(--text-muted)]", className),
69
+ ...props
70
+ });
71
+ }
72
+ function CardGlassAction({ className, ...props }) {
73
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
74
+ "data-slot": "card-action",
75
+ className: require_utils.cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
76
+ ...props
77
+ });
78
+ }
79
+ function CardGlassContent({ className, ...props }) {
80
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
81
+ "data-slot": "card-content",
82
+ className: require_utils.cn("px-6", className),
83
+ ...props
84
+ });
85
+ }
86
+ function CardGlassFooter({ className, ...props }) {
87
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
88
+ "data-slot": "card-footer",
89
+ className: require_utils.cn("flex items-center gap-2 px-6 [.border-t]:pt-6", className),
90
+ ...props
91
+ });
92
+ }
93
+ const CardGlass = {
94
+ Root: CardGlassRoot,
95
+ Header: CardGlassHeader,
96
+ Title: CardGlassTitle,
97
+ Description: CardGlassDescription,
98
+ Action: CardGlassAction,
99
+ Content: CardGlassContent,
100
+ Footer: CardGlassFooter
101
+ };
18
102
  const stepperRootVariants = (0, class_variance_authority.cva)("flex w-full", {
19
103
  variants: { orientation: {
20
104
  horizontal: "flex-col",
@@ -375,641 +459,38 @@ const StepperGlass = {
375
459
  Step: StepperStep,
376
460
  Content: StepperContent
377
461
  };
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)];
417
- }
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;
462
+ var MOBILE_BREAKPOINT = 768;
463
+ var SIDEBAR_COOKIE_NAME = "sidebar:state";
464
+ var SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
465
+ var SidebarContext = (0, react.createContext)(null);
466
+ function useSidebar() {
467
+ const context = (0, react.useContext)(SidebarContext);
468
+ if (!context) throw new Error("useSidebar must be used within SidebarGlass.Provider. Wrap your component tree with <SidebarGlass.Provider>.");
469
+ return context;
439
470
  }
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}\``);
471
+ const SidebarProvider = ({ children, open: controlledOpen, onOpenChange, defaultOpen = true, side = "left", variant = "sidebar", collapsible = "offcanvas", cookieName = SIDEBAR_COOKIE_NAME, keyboardShortcut = "b" }) => {
472
+ const [internalOpen, setInternalOpen] = (0, react.useState)(() => {
473
+ if (typeof document !== "undefined") {
474
+ const sidebarCookie = document.cookie.split(";").find((c) => c.trim().startsWith(`${cookieName}=`));
475
+ if (sidebarCookie) return sidebarCookie.split("=")[1] === "true";
497
476
  }
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
- });
477
+ return defaultOpen;
565
478
  });
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
- })
591
- });
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
- }
673
- }, [
674
- focusable,
675
- onFocusableItemAdd,
676
- onFocusableItemRemove
677
- ]);
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;
479
+ const isControlled = controlledOpen !== void 0;
480
+ const open = isControlled ? controlledOpen : internalOpen;
481
+ const setOpen = (0, react.useCallback)((value$1) => {
482
+ if (!isControlled) setInternalOpen(value$1);
483
+ onOpenChange?.(value$1);
484
+ if (typeof document !== "undefined") document.cookie = `${cookieName}=${value$1}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
485
+ }, [
486
+ isControlled,
487
+ onOpenChange,
488
+ cookieName
489
+ ]);
490
+ const [openMobile, setOpenMobile] = (0, react.useState)(false);
491
+ const [isMobile, setIsMobile] = (0, react.useState)(() => {
492
+ if (typeof window === "undefined") return false;
493
+ return window.innerWidth < MOBILE_BREAKPOINT;
1013
494
  });
1014
495
  (0, react.useEffect)(() => {
1015
496
  if (typeof window === "undefined") return;
@@ -1385,875 +866,342 @@ const SidebarGlass = {
1385
866
  MenuSubItem: SidebarMenuSubItem,
1386
867
  MenuSubButton: SidebarMenuSubButton
1387
868
  };
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);
1409
- }
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 = [
1420
- "a",
1421
- "button",
1422
- "div",
1423
- "form",
1424
- "h2",
1425
- "h3",
1426
- "img",
1427
- "input",
1428
- "label",
1429
- "li",
1430
- "nav",
1431
- "ol",
1432
- "p",
1433
- "select",
1434
- "span",
1435
- "svg",
1436
- "ul"
1437
- ].reduce((primitive, node) => {
1438
- const Slot$3 = (0, __radix_ui_react_slot.createSlot)(`Primitive.${node}`);
1439
- const Node = react.forwardRef((props, forwardedRef) => {
1440
- const { asChild, ...primitiveProps } = props;
1441
- const Comp = asChild ? Slot$3 : node;
1442
- if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
1443
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
1444
- ...primitiveProps,
1445
- ref: forwardedRef
1446
- });
1447
- });
1448
- Node.displayName = `Primitive.${node}`;
1449
- return {
1450
- ...primitive,
1451
- [node]: Node
1452
- };
1453
- }, {});
1454
- function createContextScope$2(scopeName, createContextScopeDeps = []) {
1455
- let defaultContexts = [];
1456
- function createContext3(rootComponentName, defaultContext) {
1457
- const BaseContext = react.createContext(defaultContext);
1458
- const index = defaultContexts.length;
1459
- defaultContexts = [...defaultContexts, defaultContext];
1460
- const Provider = (props) => {
1461
- const { scope, children, ...context } = props;
1462
- const Context = scope?.[scopeName]?.[index] || BaseContext;
1463
- const value = react.useMemo(() => context, Object.values(context));
1464
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Context.Provider, {
1465
- value,
1466
- children
1467
- });
1468
- };
1469
- Provider.displayName = rootComponentName + "Provider";
1470
- function useContext2(consumerName, scope) {
1471
- const Context = scope?.[scopeName]?.[index] || BaseContext;
1472
- const context = react.useContext(Context);
1473
- if (context) return context;
1474
- if (defaultContext !== void 0) return defaultContext;
1475
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
869
+ function _extends$1() {
870
+ return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
871
+ for (var e = 1; e < arguments.length; e++) {
872
+ var t = arguments[e];
873
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1476
874
  }
1477
- return [Provider, useContext2];
875
+ return n;
876
+ }, _extends$1.apply(null, arguments);
877
+ }
878
+ function ownKeys$1(e, r) {
879
+ var t = Object.keys(e);
880
+ if (Object.getOwnPropertySymbols) {
881
+ var o = Object.getOwnPropertySymbols(e);
882
+ r && (o = o.filter(function(r$1) {
883
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
884
+ })), t.push.apply(t, o);
1478
885
  }
1479
- const createScope = () => {
1480
- const scopeContexts = defaultContexts.map((defaultContext) => {
1481
- return react.createContext(defaultContext);
1482
- });
1483
- return function useScope(scope) {
1484
- const contexts = scope?.[scopeName] || scopeContexts;
1485
- return react.useMemo(() => ({ [`__scope${scopeName}`]: {
1486
- ...scope,
1487
- [scopeName]: contexts
1488
- } }), [scope, contexts]);
1489
- };
1490
- };
1491
- createScope.scopeName = scopeName;
1492
- return [createContext3, composeContextScopes$2(createScope, ...createContextScopeDeps)];
886
+ return t;
1493
887
  }
1494
- function composeContextScopes$2(...scopes) {
1495
- const baseScope = scopes[0];
1496
- if (scopes.length === 1) return baseScope;
1497
- const createScope = () => {
1498
- const scopeHooks = scopes.map((createScope2) => ({
1499
- useScope: createScope2(),
1500
- scopeName: createScope2.scopeName
1501
- }));
1502
- return function useComposedScopes(overrideScopes) {
1503
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
1504
- const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
1505
- return {
1506
- ...nextScopes2,
1507
- ...currentScope
1508
- };
1509
- }, {});
1510
- return react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
1511
- };
1512
- };
1513
- createScope.scopeName = baseScope.scopeName;
1514
- return createScope;
888
+ function _objectSpread$1(e) {
889
+ for (var r = 1; r < arguments.length; r++) {
890
+ var t = null != arguments[r] ? arguments[r] : {};
891
+ r % 2 ? ownKeys$1(Object(t), !0).forEach(function(r$1) {
892
+ _defineProperty$1(e, r$1, t[r$1]);
893
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r$1) {
894
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
895
+ });
896
+ }
897
+ return e;
1515
898
  }
1516
- function useStateMachine(initialState, machine) {
1517
- return react.useReducer((state, event) => {
1518
- return machine[state][event] ?? state;
1519
- }, initialState);
899
+ function _defineProperty$1(e, r, t) {
900
+ return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
901
+ value: t,
902
+ enumerable: !0,
903
+ configurable: !0,
904
+ writable: !0
905
+ }) : e[r] = t, e;
1520
906
  }
1521
- var SCROLL_AREA_NAME = "ScrollArea";
1522
- var [createScrollAreaContext, createScrollAreaScope] = createContextScope$2(SCROLL_AREA_NAME);
1523
- var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
1524
- var ScrollArea$1 = react.forwardRef((props, forwardedRef) => {
1525
- const { __scopeScrollArea, type = "hover", dir, scrollHideDelay = 600, ...scrollAreaProps } = props;
1526
- const [scrollArea, setScrollArea] = react.useState(null);
1527
- const [viewport, setViewport] = react.useState(null);
1528
- const [content, setContent] = react.useState(null);
1529
- const [scrollbarX, setScrollbarX] = react.useState(null);
1530
- const [scrollbarY, setScrollbarY] = react.useState(null);
1531
- const [cornerWidth, setCornerWidth] = react.useState(0);
1532
- const [cornerHeight, setCornerHeight] = react.useState(0);
1533
- const [scrollbarXEnabled, setScrollbarXEnabled] = react.useState(false);
1534
- const [scrollbarYEnabled, setScrollbarYEnabled] = react.useState(false);
1535
- const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => setScrollArea(node));
1536
- const direction = require_trust_score_card_glass.useDirection(dir);
1537
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaProvider, {
1538
- scope: __scopeScrollArea,
1539
- type,
1540
- dir: direction,
1541
- scrollHideDelay,
1542
- scrollArea,
1543
- viewport,
1544
- onViewportChange: setViewport,
1545
- content,
1546
- onContentChange: setContent,
1547
- scrollbarX,
1548
- onScrollbarXChange: setScrollbarX,
1549
- scrollbarXEnabled,
1550
- onScrollbarXEnabledChange: setScrollbarXEnabled,
1551
- scrollbarY,
1552
- onScrollbarYChange: setScrollbarY,
1553
- scrollbarYEnabled,
1554
- onScrollbarYEnabledChange: setScrollbarYEnabled,
1555
- onCornerWidthChange: setCornerWidth,
1556
- onCornerHeightChange: setCornerHeight,
1557
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
1558
- dir: direction,
1559
- ...scrollAreaProps,
1560
- ref: composedRefs,
1561
- style: {
1562
- position: "relative",
1563
- ["--radix-scroll-area-corner-width"]: cornerWidth + "px",
1564
- ["--radix-scroll-area-corner-height"]: cornerHeight + "px",
1565
- ...props.style
1566
- }
1567
- })
1568
- });
1569
- });
1570
- ScrollArea$1.displayName = SCROLL_AREA_NAME;
1571
- var VIEWPORT_NAME = "ScrollAreaViewport";
1572
- var ScrollAreaViewport = react.forwardRef((props, forwardedRef) => {
1573
- const { __scopeScrollArea, children, nonce, ...viewportProps } = props;
1574
- const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
1575
- const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, react.useRef(null), context.onViewportChange);
1576
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", {
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}` },
1578
- nonce
1579
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
1580
- "data-radix-scroll-area-viewport": "",
1581
- ...viewportProps,
1582
- ref: composedRefs,
1583
- style: {
1584
- overflowX: context.scrollbarXEnabled ? "scroll" : "hidden",
1585
- overflowY: context.scrollbarYEnabled ? "scroll" : "hidden",
1586
- ...props.style
1587
- },
1588
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1589
- ref: context.onContentChange,
1590
- style: {
1591
- minWidth: "100%",
1592
- display: "table"
1593
- },
1594
- children
1595
- })
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
- });
1729
- });
1730
- var ScrollAreaScrollbarAuto = react.forwardRef((props, forwardedRef) => {
1731
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1732
- const { forceMount, ...scrollbarProps } = props;
1733
- const [visible, setVisible] = react.useState(false);
1734
- const isHorizontal = props.orientation === "horizontal";
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 = {
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,
1782
- ref: forwardedRef,
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,
1799
- ref: forwardedRef,
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",
1827
- ...scrollbarProps,
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
- });
1858
- });
1859
- var ScrollAreaScrollbarY = react.forwardRef((props, forwardedRef) => {
1860
- const { sizes, onSizesChange, ...scrollbarProps } = props;
1861
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
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);
1865
- react.useEffect(() => {
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
- });
1900
- }
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
- });
907
+ function _toPropertyKey$1(t) {
908
+ var i = _toPrimitive$1(t, "string");
909
+ return "symbol" == typeof i ? i : i + "";
910
+ }
911
+ function _toPrimitive$1(t, r) {
912
+ if ("object" != typeof t || !t) return t;
913
+ var e = t[Symbol.toPrimitive];
914
+ if (void 0 !== e) {
915
+ var i = e.call(t, r || "default");
916
+ if ("object" != typeof i) return i;
917
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1921
918
  }
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, {
1947
- ...scrollbarProps,
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
- })
1971
- })
1972
- });
1973
- });
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
- })
919
+ return ("string" === r ? String : Number)(t);
920
+ }
921
+ var SIZE = 32;
922
+ var defaultLegendContentDefaultProps = {
923
+ align: "center",
924
+ iconSize: 14,
925
+ inactiveColor: "#ccc",
926
+ layout: "horizontal",
927
+ verticalAlign: "middle"
928
+ };
929
+ function Icon(_ref) {
930
+ var { data, iconType, inactiveColor } = _ref;
931
+ var halfSize = SIZE / 2;
932
+ var sixthSize = SIZE / 6;
933
+ var thirdSize = SIZE / 3;
934
+ var color = data.inactive ? inactiveColor : data.color;
935
+ var preferredIcon = iconType !== null && iconType !== void 0 ? iconType : data.type;
936
+ if (preferredIcon === "none") return null;
937
+ if (preferredIcon === "plainline") {
938
+ var _data$payload;
939
+ return /* @__PURE__ */ react.createElement("line", {
940
+ strokeWidth: 4,
941
+ fill: "none",
942
+ stroke: color,
943
+ strokeDasharray: (_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.strokeDasharray,
944
+ x1: 0,
945
+ y1: halfSize,
946
+ x2: SIZE,
947
+ y2: halfSize,
948
+ className: "recharts-legend-icon"
949
+ });
950
+ }
951
+ if (preferredIcon === "line") return /* @__PURE__ */ react.createElement("path", {
952
+ strokeWidth: 4,
953
+ fill: "none",
954
+ stroke: color,
955
+ 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),
956
+ className: "recharts-legend-icon"
1984
957
  });
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;
1997
- }
1998
- }, 100);
1999
- react.useEffect(() => {
2000
- const viewport = scrollAreaContext.viewport;
2001
- if (viewport) {
2002
- const handleScroll = () => {
2003
- debounceScrollEnd();
2004
- if (!removeUnlinkedScrollListenerRef.current) {
2005
- removeUnlinkedScrollListenerRef.current = addUnlinkedScrollListener(viewport, onThumbPositionChange);
2006
- onThumbPositionChange();
2007
- }
2008
- };
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)
958
+ if (preferredIcon === "rect") return /* @__PURE__ */ react.createElement("path", {
959
+ stroke: "none",
960
+ fill: color,
961
+ d: "M0,".concat(SIZE / 8, "h").concat(SIZE, "v").concat(SIZE * 3 / 4, "h").concat(-SIZE, "z"),
962
+ className: "recharts-legend-icon"
2037
963
  });
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);
964
+ if (/* @__PURE__ */ react.isValidElement(data.legendIcon)) {
965
+ var iconProps = _objectSpread$1({}, data);
966
+ delete iconProps.legendIcon;
967
+ return /* @__PURE__ */ react.cloneElement(data.legendIcon, iconProps);
968
+ }
969
+ return /* @__PURE__ */ react.createElement(require_trust_score_card_glass.Symbols, {
970
+ fill: color,
971
+ cx: halfSize,
972
+ cy: halfSize,
973
+ size: SIZE,
974
+ sizeType: "diameter",
975
+ type: preferredIcon
2060
976
  });
2061
- useResizeObserver(context.scrollbarY, () => {
2062
- const width2 = context.scrollbarY?.offsetWidth || 0;
2063
- context.onCornerWidthChange(width2);
2064
- setWidth(width2);
977
+ }
978
+ function Items(props) {
979
+ var { payload, iconSize, layout, formatter, inactiveColor, iconType } = props;
980
+ var viewBox = {
981
+ x: 0,
982
+ y: 0,
983
+ width: SIZE,
984
+ height: SIZE
985
+ };
986
+ var itemStyle = {
987
+ display: layout === "horizontal" ? "inline-block" : "block",
988
+ marginRight: 10
989
+ };
990
+ var svgStyle = {
991
+ display: "inline-block",
992
+ verticalAlign: "middle",
993
+ marginRight: 4
994
+ };
995
+ return payload.map((entry, i) => {
996
+ var finalFormatter = entry.formatter || formatter;
997
+ var className = (0, clsx.clsx)({
998
+ "recharts-legend-item": true,
999
+ ["legend-item-".concat(i)]: true,
1000
+ inactive: entry.inactive
1001
+ });
1002
+ if (entry.type === "none") return null;
1003
+ var color = entry.inactive ? inactiveColor : entry.color;
1004
+ var finalValue = finalFormatter ? finalFormatter(entry.value, entry, i) : entry.value;
1005
+ return /* @__PURE__ */ react.createElement("li", _extends$1({
1006
+ className,
1007
+ style: itemStyle,
1008
+ key: "legend-item-".concat(i)
1009
+ }, require_trust_score_card_glass.adaptEventsOfChild(props, entry, i)), /* @__PURE__ */ react.createElement(require_trust_score_card_glass.Surface, {
1010
+ width: iconSize,
1011
+ height: iconSize,
1012
+ viewBox,
1013
+ style: svgStyle,
1014
+ "aria-label": "".concat(finalValue, " legend icon")
1015
+ }, /* @__PURE__ */ react.createElement(Icon, {
1016
+ data: entry,
1017
+ iconType,
1018
+ inactiveColor
1019
+ })), /* @__PURE__ */ react.createElement("span", {
1020
+ className: "recharts-legend-item-text",
1021
+ style: { color }
1022
+ }, finalValue));
2065
1023
  });
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
1024
+ }
1025
+ var DefaultLegendContent = (outsideProps) => {
1026
+ var props = require_trust_score_card_glass.resolveDefaultProps(outsideProps, defaultLegendContentDefaultProps);
1027
+ var { payload, layout, align } = props;
1028
+ if (!payload || !payload.length) return null;
1029
+ var finalStyle = {
1030
+ padding: 0,
1031
+ margin: 0,
1032
+ textAlign: layout === "horizontal" ? align : "left"
1033
+ };
1034
+ return /* @__PURE__ */ react.createElement("ul", {
1035
+ className: "recharts-default-legend",
1036
+ style: finalStyle
1037
+ }, /* @__PURE__ */ react.createElement(Items, _extends$1({}, props, { payload })));
1038
+ };
1039
+ function useLegendPayload() {
1040
+ return require_trust_score_card_glass.useAppSelector(require_trust_score_card_glass.selectLegendPayload);
1041
+ }
1042
+ var _excluded = ["contextPayload"];
1043
+ function _extends() {
1044
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
1045
+ for (var e = 1; e < arguments.length; e++) {
1046
+ var t = arguments[e];
1047
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
2077
1048
  }
2078
- }) : null;
2079
- });
2080
- function toInt(value) {
2081
- return value ? parseInt(value, 10) : 0;
1049
+ return n;
1050
+ }, _extends.apply(null, arguments);
2082
1051
  }
2083
- function getThumbRatio(viewportSize, contentSize) {
2084
- const ratio = viewportSize / contentSize;
2085
- return isNaN(ratio) ? 0 : ratio;
1052
+ function ownKeys(e, r) {
1053
+ var t = Object.keys(e);
1054
+ if (Object.getOwnPropertySymbols) {
1055
+ var o = Object.getOwnPropertySymbols(e);
1056
+ r && (o = o.filter(function(r$1) {
1057
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
1058
+ })), t.push.apply(t, o);
1059
+ }
1060
+ return t;
2086
1061
  }
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);
1062
+ function _objectSpread(e) {
1063
+ for (var r = 1; r < arguments.length; r++) {
1064
+ var t = null != arguments[r] ? arguments[r] : {};
1065
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
1066
+ _defineProperty(e, r$1, t[r$1]);
1067
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
1068
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
1069
+ });
1070
+ }
1071
+ return e;
2092
1072
  }
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);
1073
+ function _defineProperty(e, r, t) {
1074
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1075
+ value: t,
1076
+ enumerable: !0,
1077
+ configurable: !0,
1078
+ writable: !0
1079
+ }) : e[r] = t, e;
2103
1080
  }
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);
1081
+ function _toPropertyKey(t) {
1082
+ var i = _toPrimitive(t, "string");
1083
+ return "symbol" == typeof i ? i : i + "";
1084
+ }
1085
+ function _toPrimitive(t, r) {
1086
+ if ("object" != typeof t || !t) return t;
1087
+ var e = t[Symbol.toPrimitive];
1088
+ if (void 0 !== e) {
1089
+ var i = e.call(t, r || "default");
1090
+ if ("object" != typeof i) return i;
1091
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1092
+ }
1093
+ return ("string" === r ? String : Number)(t);
1094
+ }
1095
+ function _objectWithoutProperties(e, t) {
1096
+ if (null == e) return {};
1097
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
1098
+ if (Object.getOwnPropertySymbols) {
1099
+ var n = Object.getOwnPropertySymbols(e);
1100
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
1101
+ }
1102
+ return i;
2112
1103
  }
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
- };
1104
+ function _objectWithoutPropertiesLoose(r, e) {
1105
+ if (null == r) return {};
1106
+ var t = {};
1107
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
1108
+ if (-1 !== e.indexOf(n)) continue;
1109
+ t[n] = r[n];
1110
+ }
1111
+ return t;
2119
1112
  }
2120
- function isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {
2121
- return scrollPos > 0 && scrollPos < maxScrollPos;
1113
+ function defaultUniqBy(entry) {
1114
+ return entry.value;
2122
1115
  }
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]);
1116
+ function LegendContent(props) {
1117
+ var { contextPayload } = props, otherProps = _objectWithoutProperties(props, _excluded);
1118
+ var finalPayload = require_trust_score_card_glass.getUniqPayload(contextPayload, props.payloadUniqBy, defaultUniqBy);
1119
+ var contentProps = _objectSpread(_objectSpread({}, otherProps), {}, { payload: finalPayload });
1120
+ if (/* @__PURE__ */ react.isValidElement(props.content)) return /* @__PURE__ */ react.cloneElement(props.content, contentProps);
1121
+ if (typeof props.content === "function") return /* @__PURE__ */ react.createElement(props.content, contentProps);
1122
+ return /* @__PURE__ */ react.createElement(DefaultLegendContent, contentProps);
2150
1123
  }
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
- };
2165
- }
2166
- }, [element, handleResize]);
1124
+ function getDefaultPosition(style, props, margin, chartWidth, chartHeight, box) {
1125
+ var { layout, align, verticalAlign } = props;
1126
+ var hPos, vPos;
1127
+ 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 };
1128
+ else hPos = align === "right" ? { right: margin && margin.right || 0 } : { left: margin && margin.left || 0 };
1129
+ 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 };
1130
+ else vPos = verticalAlign === "bottom" ? { bottom: margin && margin.bottom || 0 } : { top: margin && margin.top || 0 };
1131
+ return _objectSpread(_objectSpread({}, hPos), vPos);
2167
1132
  }
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}\``);
2216
- }
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)];
1133
+ function LegendSettingsDispatcher(props) {
1134
+ var dispatch = require_trust_score_card_glass.useAppDispatch();
1135
+ (0, react.useEffect)(() => {
1136
+ dispatch(require_trust_score_card_glass.setLegendSettings(props));
1137
+ }, [dispatch, props]);
1138
+ return null;
2233
1139
  }
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]);
1140
+ function LegendSizeDispatcher(props) {
1141
+ var dispatch = require_trust_score_card_glass.useAppDispatch();
1142
+ (0, react.useEffect)(() => {
1143
+ dispatch(require_trust_score_card_glass.setLegendSize(props));
1144
+ return () => {
1145
+ dispatch(require_trust_score_card_glass.setLegendSize({
1146
+ width: 0,
1147
+ height: 0
1148
+ }));
2251
1149
  };
2252
- };
2253
- createScope.scopeName = baseScope.scopeName;
2254
- return createScope;
1150
+ }, [dispatch, props]);
1151
+ return null;
1152
+ }
1153
+ function getWidthOrHeight(layout, height, width, maxWidth) {
1154
+ if (layout === "vertical" && require_trust_score_card_glass.isNumber(height)) return { height };
1155
+ if (layout === "horizontal") return { width: width || maxWidth };
1156
+ return null;
1157
+ }
1158
+ var legendDefaultProps = {
1159
+ align: "center",
1160
+ iconSize: 14,
1161
+ itemSorter: "value",
1162
+ layout: "horizontal",
1163
+ verticalAlign: "bottom"
1164
+ };
1165
+ function Legend(outsideProps) {
1166
+ var props = require_trust_score_card_glass.resolveDefaultProps(outsideProps, legendDefaultProps);
1167
+ var contextPayload = useLegendPayload();
1168
+ var legendPortalFromContext = require_trust_score_card_glass.useLegendPortal();
1169
+ var margin = require_trust_score_card_glass.useMargin();
1170
+ var { width: widthFromProps, height: heightFromProps, wrapperStyle, portal: portalFromProps } = props;
1171
+ var [lastBoundingBox, updateBoundingBox] = require_trust_score_card_glass.useElementOffset([contextPayload]);
1172
+ var chartWidth = require_trust_score_card_glass.useChartWidth();
1173
+ var chartHeight = require_trust_score_card_glass.useChartHeight();
1174
+ if (chartWidth == null || chartHeight == null) return null;
1175
+ var maxWidth = chartWidth - ((margin === null || margin === void 0 ? void 0 : margin.left) || 0) - ((margin === null || margin === void 0 ? void 0 : margin.right) || 0);
1176
+ var widthOrHeight = getWidthOrHeight(props.layout, heightFromProps, widthFromProps, maxWidth);
1177
+ var outerStyle = portalFromProps ? wrapperStyle : _objectSpread(_objectSpread({
1178
+ position: "absolute",
1179
+ width: (widthOrHeight === null || widthOrHeight === void 0 ? void 0 : widthOrHeight.width) || widthFromProps || "auto",
1180
+ height: (widthOrHeight === null || widthOrHeight === void 0 ? void 0 : widthOrHeight.height) || heightFromProps || "auto"
1181
+ }, getDefaultPosition(wrapperStyle, props, margin, chartWidth, chartHeight, lastBoundingBox)), wrapperStyle);
1182
+ var legendPortal = portalFromProps !== null && portalFromProps !== void 0 ? portalFromProps : legendPortalFromContext;
1183
+ if (legendPortal == null || contextPayload == null) return null;
1184
+ return /* @__PURE__ */ (0, react_dom.createPortal)(/* @__PURE__ */ react.createElement("div", {
1185
+ className: "recharts-legend-wrapper",
1186
+ style: outerStyle,
1187
+ ref: updateBoundingBox
1188
+ }, /* @__PURE__ */ react.createElement(LegendSettingsDispatcher, {
1189
+ layout: props.layout,
1190
+ align: props.align,
1191
+ verticalAlign: props.verticalAlign,
1192
+ itemSorter: props.itemSorter
1193
+ }), !portalFromProps && /* @__PURE__ */ react.createElement(LegendSizeDispatcher, {
1194
+ width: lastBoundingBox.width,
1195
+ height: lastBoundingBox.height
1196
+ }), /* @__PURE__ */ react.createElement(LegendContent, _extends({}, props, widthOrHeight, {
1197
+ margin,
1198
+ chartWidth,
1199
+ chartHeight,
1200
+ contextPayload
1201
+ }))), legendPortal);
2255
1202
  }
2256
- var Primitive$1 = [
1203
+ Legend.displayName = "Legend";
1204
+ var Primitive = [
2257
1205
  "a",
2258
1206
  "button",
2259
1207
  "div",
@@ -2287,145 +1235,7 @@ var Primitive$1 = [
2287
1235
  ...primitive,
2288
1236
  [node]: Node
2289
1237
  };
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
- })
2314
- });
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,
2329
- ref: forwardedRef,
2330
- onClick: require_trust_score_card_glass.composeEventHandlers(props.onClick, context.onOpenToggle)
2331
- });
2332
- });
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
- })
2345
- });
2346
- });
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);
2352
- const ref = react.useRef(null);
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);
2361
- react.useEffect(() => {
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,
2391
- style: {
2392
- [`--radix-collapsible-content-height`]: height ? `${height}px` : void 0,
2393
- [`--radix-collapsible-content-width`]: width ? `${width}px` : void 0,
2394
- ...props.style
2395
- },
2396
- children: isOpen && children
2397
- });
2398
- });
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
- };
1238
+ }, {});
2429
1239
  function createContextScope(scopeName, createContextScopeDeps = []) {
2430
1240
  let defaultContexts = [];
2431
1241
  function createContext3(rootComponentName, defaultContext) {
@@ -2488,679 +1298,663 @@ function composeContextScopes(...scopes) {
2488
1298
  createScope.scopeName = baseScope.scopeName;
2489
1299
  return createScope;
2490
1300
  }
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,
1301
+ function useStateMachine(initialState, machine) {
1302
+ return react.useReducer((state, event) => {
1303
+ return machine[state][event] ?? state;
1304
+ }, initialState);
1305
+ }
1306
+ var SCROLL_AREA_NAME = "ScrollArea";
1307
+ var [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME);
1308
+ var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
1309
+ var ScrollArea$1 = react.forwardRef((props, forwardedRef) => {
1310
+ const { __scopeScrollArea, type = "hover", dir, scrollHideDelay = 600, ...scrollAreaProps } = props;
1311
+ const [scrollArea, setScrollArea] = react.useState(null);
1312
+ const [viewport, setViewport] = react.useState(null);
1313
+ const [content, setContent] = react.useState(null);
1314
+ const [scrollbarX, setScrollbarX] = react.useState(null);
1315
+ const [scrollbarY, setScrollbarY] = react.useState(null);
1316
+ const [cornerWidth, setCornerWidth] = react.useState(0);
1317
+ const [cornerHeight, setCornerHeight] = react.useState(0);
1318
+ const [scrollbarXEnabled, setScrollbarXEnabled] = react.useState(false);
1319
+ const [scrollbarYEnabled, setScrollbarYEnabled] = react.useState(false);
1320
+ const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => setScrollArea(node));
1321
+ const direction = require_trust_score_card_glass.useDirection(dir);
1322
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaProvider, {
1323
+ scope: __scopeScrollArea,
1324
+ type,
1325
+ dir: direction,
1326
+ scrollHideDelay,
1327
+ scrollArea,
1328
+ viewport,
1329
+ onViewportChange: setViewport,
1330
+ content,
1331
+ onContentChange: setContent,
1332
+ scrollbarX,
1333
+ onScrollbarXChange: setScrollbarX,
1334
+ scrollbarXEnabled,
1335
+ onScrollbarXEnabledChange: setScrollbarXEnabled,
1336
+ scrollbarY,
1337
+ onScrollbarYChange: setScrollbarY,
1338
+ scrollbarYEnabled,
1339
+ onScrollbarYEnabledChange: setScrollbarYEnabled,
1340
+ onCornerWidthChange: setCornerWidth,
1341
+ onCornerHeightChange: setCornerHeight,
1342
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
1343
+ dir: direction,
1344
+ ...scrollAreaProps,
1345
+ ref: composedRefs,
1346
+ style: {
1347
+ position: "relative",
1348
+ ["--radix-scroll-area-corner-width"]: cornerWidth + "px",
1349
+ ["--radix-scroll-area-corner-height"]: cornerHeight + "px",
1350
+ ...props.style
1351
+ }
1352
+ })
1353
+ });
1354
+ });
1355
+ ScrollArea$1.displayName = SCROLL_AREA_NAME;
1356
+ var VIEWPORT_NAME = "ScrollAreaViewport";
1357
+ var ScrollAreaViewport = react.forwardRef((props, forwardedRef) => {
1358
+ const { __scopeScrollArea, children, nonce, ...viewportProps } = props;
1359
+ const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
1360
+ const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, react.useRef(null), context.onViewportChange);
1361
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", {
1362
+ 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}` },
1363
+ nonce
1364
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
1365
+ "data-radix-scroll-area-viewport": "",
1366
+ ...viewportProps,
1367
+ ref: composedRefs,
1368
+ style: {
1369
+ overflowX: context.scrollbarXEnabled ? "scroll" : "hidden",
1370
+ overflowY: context.scrollbarYEnabled ? "scroll" : "hidden",
1371
+ ...props.style
1372
+ },
1373
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1374
+ ref: context.onContentChange,
1375
+ style: {
1376
+ minWidth: "100%",
1377
+ display: "table"
1378
+ },
1379
+ children
1380
+ })
1381
+ })] });
1382
+ });
1383
+ ScrollAreaViewport.displayName = VIEWPORT_NAME;
1384
+ var SCROLLBAR_NAME = "ScrollAreaScrollbar";
1385
+ var ScrollAreaScrollbar = react.forwardRef((props, forwardedRef) => {
1386
+ const { forceMount, ...scrollbarProps } = props;
1387
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1388
+ const { onScrollbarXEnabledChange, onScrollbarYEnabledChange } = context;
1389
+ const isHorizontal = props.orientation === "horizontal";
1390
+ react.useEffect(() => {
1391
+ isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);
1392
+ return () => {
1393
+ isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);
1394
+ };
1395
+ }, [
1396
+ isHorizontal,
1397
+ onScrollbarXEnabledChange,
1398
+ onScrollbarYEnabledChange
1399
+ ]);
1400
+ return context.type === "hover" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarHover, {
1401
+ ...scrollbarProps,
1402
+ ref: forwardedRef,
1403
+ forceMount
1404
+ }) : context.type === "scroll" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarScroll, {
1405
+ ...scrollbarProps,
1406
+ ref: forwardedRef,
1407
+ forceMount
1408
+ }) : context.type === "auto" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarAuto, {
1409
+ ...scrollbarProps,
1410
+ ref: forwardedRef,
1411
+ forceMount
1412
+ }) : context.type === "always" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
1413
+ ...scrollbarProps,
1414
+ ref: forwardedRef
1415
+ }) : null;
1416
+ });
1417
+ ScrollAreaScrollbar.displayName = SCROLLBAR_NAME;
1418
+ var ScrollAreaScrollbarHover = react.forwardRef((props, forwardedRef) => {
1419
+ const { forceMount, ...scrollbarProps } = props;
1420
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1421
+ const [visible, setVisible] = react.useState(false);
1422
+ react.useEffect(() => {
1423
+ const scrollArea = context.scrollArea;
1424
+ let hideTimer = 0;
1425
+ if (scrollArea) {
1426
+ const handlePointerEnter = () => {
1427
+ window.clearTimeout(hideTimer);
1428
+ setVisible(true);
1429
+ };
1430
+ const handlePointerLeave = () => {
1431
+ hideTimer = window.setTimeout(() => setVisible(false), context.scrollHideDelay);
1432
+ };
1433
+ scrollArea.addEventListener("pointerenter", handlePointerEnter);
1434
+ scrollArea.addEventListener("pointerleave", handlePointerLeave);
1435
+ return () => {
1436
+ window.clearTimeout(hideTimer);
1437
+ scrollArea.removeEventListener("pointerenter", handlePointerEnter);
1438
+ scrollArea.removeEventListener("pointerleave", handlePointerLeave);
1439
+ };
1440
+ }
1441
+ }, [context.scrollArea, context.scrollHideDelay]);
1442
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
1443
+ present: forceMount || visible,
1444
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarAuto, {
1445
+ "data-state": visible ? "visible" : "hidden",
1446
+ ...scrollbarProps,
2517
1447
  ref: forwardedRef
2518
- });
1448
+ })
2519
1449
  });
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();
1450
+ });
1451
+ var ScrollAreaScrollbarScroll = react.forwardRef((props, forwardedRef) => {
1452
+ const { forceMount, ...scrollbarProps } = props;
1453
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1454
+ const isHorizontal = props.orientation === "horizontal";
1455
+ const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
1456
+ const [state, send] = useStateMachine("hidden", {
1457
+ hidden: { SCROLL: "scrolling" },
1458
+ scrolling: {
1459
+ SCROLL_END: "idle",
1460
+ POINTER_ENTER: "interacting"
1461
+ },
1462
+ interacting: {
1463
+ SCROLL: "interacting",
1464
+ POINTER_LEAVE: "idle"
1465
+ },
1466
+ idle: {
1467
+ HIDE: "hidden",
1468
+ SCROLL: "scrolling",
1469
+ POINTER_ENTER: "interacting"
1470
+ }
1471
+ });
1472
+ react.useEffect(() => {
1473
+ if (state === "idle") {
1474
+ const hideTimer = window.setTimeout(() => send("HIDE"), context.scrollHideDelay);
1475
+ return () => window.clearTimeout(hideTimer);
1476
+ }
1477
+ }, [
1478
+ state,
1479
+ context.scrollHideDelay,
1480
+ send
1481
+ ]);
1482
+ react.useEffect(() => {
1483
+ const viewport = context.viewport;
1484
+ const scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop";
1485
+ if (viewport) {
1486
+ let prevScrollPos = viewport[scrollDirection];
1487
+ const handleScroll = () => {
1488
+ const scrollPos = viewport[scrollDirection];
1489
+ if (prevScrollPos !== scrollPos) {
1490
+ send("SCROLL");
1491
+ debounceScrollEnd();
2554
1492
  }
2555
- })
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
- })]
1493
+ prevScrollPos = scrollPos;
1494
+ };
1495
+ viewport.addEventListener("scroll", handleScroll);
1496
+ return () => viewport.removeEventListener("scroll", handleScroll);
1497
+ }
1498
+ }, [
1499
+ context.viewport,
1500
+ isHorizontal,
1501
+ send,
1502
+ debounceScrollEnd
1503
+ ]);
1504
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
1505
+ present: forceMount || state !== "hidden",
1506
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
1507
+ "data-state": state === "hidden" ? "hidden" : "visible",
1508
+ ...scrollbarProps,
1509
+ ref: forwardedRef,
1510
+ onPointerEnter: require_trust_score_card_glass.composeEventHandlers(props.onPointerEnter, () => send("POINTER_ENTER")),
1511
+ onPointerLeave: require_trust_score_card_glass.composeEventHandlers(props.onPointerLeave, () => send("POINTER_LEAVE"))
1512
+ })
2567
1513
  });
2568
1514
  });
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);
1515
+ var ScrollAreaScrollbarAuto = react.forwardRef((props, forwardedRef) => {
1516
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1517
+ const { forceMount, ...scrollbarProps } = props;
1518
+ const [visible, setVisible] = react.useState(false);
1519
+ const isHorizontal = props.orientation === "horizontal";
1520
+ const handleResize = useDebounceCallback(() => {
1521
+ if (context.viewport) {
1522
+ const isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth;
1523
+ const isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight;
1524
+ setVisible(isHorizontal ? isOverflowX : isOverflowY);
1525
+ }
1526
+ }, 10);
1527
+ useResizeObserver(context.viewport, handleResize);
1528
+ useResizeObserver(context.content, handleResize);
2574
1529
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
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,
1530
+ present: forceMount || visible,
1531
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
1532
+ "data-state": visible ? "visible" : "hidden",
1533
+ ...scrollbarProps,
2580
1534
  ref: forwardedRef
2581
1535
  })
2582
1536
  });
2583
1537
  });
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);
1538
+ var ScrollAreaScrollbarVisible = react.forwardRef((props, forwardedRef) => {
1539
+ const { orientation = "vertical", ...scrollbarProps } = props;
1540
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1541
+ const thumbRef = react.useRef(null);
1542
+ const pointerOffsetRef = react.useRef(0);
1543
+ const [sizes, setSizes] = react.useState({
1544
+ content: 0,
1545
+ viewport: 0,
1546
+ scrollbar: {
1547
+ size: 0,
1548
+ paddingStart: 0,
1549
+ paddingEnd: 0
2600
1550
  }
2601
- }, [
2602
- prevChecked,
2603
- checked,
2604
- bubbles
2605
- ]);
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,
2613
- style: {
2614
- ...props.style,
2615
- ...controlSize,
2616
- position: "absolute",
2617
- pointerEvents: "none",
2618
- opacity: 0,
2619
- margin: 0
1551
+ });
1552
+ const thumbRatio = getThumbRatio(sizes.viewport, sizes.content);
1553
+ const commonProps = {
1554
+ ...scrollbarProps,
1555
+ sizes,
1556
+ onSizesChange: setSizes,
1557
+ hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),
1558
+ onThumbChange: (thumb) => thumbRef.current = thumb,
1559
+ onThumbPointerUp: () => pointerOffsetRef.current = 0,
1560
+ onThumbPointerDown: (pointerPos) => pointerOffsetRef.current = pointerPos
1561
+ };
1562
+ function getScrollPosition(pointerPos, dir) {
1563
+ return getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir);
1564
+ }
1565
+ if (orientation === "horizontal") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarX, {
1566
+ ...commonProps,
1567
+ ref: forwardedRef,
1568
+ onThumbPositionChange: () => {
1569
+ if (context.viewport && thumbRef.current) {
1570
+ const scrollPos = context.viewport.scrollLeft;
1571
+ const offset = getThumbOffsetFromScroll(scrollPos, sizes, context.dir);
1572
+ thumbRef.current.style.transform = `translate3d(${offset}px, 0, 0)`;
1573
+ }
1574
+ },
1575
+ onWheelScroll: (scrollPos) => {
1576
+ if (context.viewport) context.viewport.scrollLeft = scrollPos;
1577
+ },
1578
+ onDragScroll: (pointerPos) => {
1579
+ if (context.viewport) context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir);
2620
1580
  }
2621
1581
  });
2622
- });
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
- })
1582
+ if (orientation === "vertical") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarY, {
1583
+ ...commonProps,
1584
+ ref: forwardedRef,
1585
+ onThumbPositionChange: () => {
1586
+ if (context.viewport && thumbRef.current) {
1587
+ const scrollPos = context.viewport.scrollTop;
1588
+ const offset = getThumbOffsetFromScroll(scrollPos, sizes);
1589
+ thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`;
1590
+ }
1591
+ },
1592
+ onWheelScroll: (scrollPos) => {
1593
+ if (context.viewport) context.viewport.scrollTop = scrollPos;
1594
+ },
1595
+ onDragScroll: (pointerPos) => {
1596
+ if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);
1597
+ }
2671
1598
  });
1599
+ return null;
2672
1600
  });
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);
1601
+ var ScrollAreaScrollbarX = react.forwardRef((props, forwardedRef) => {
1602
+ const { sizes, onSizesChange, ...scrollbarProps } = props;
1603
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1604
+ const [computedStyle, setComputedStyle] = react.useState();
2681
1605
  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);
1606
+ const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref, context.onScrollbarXChange);
2685
1607
  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,
2727
- ref: forwardedRef
1608
+ if (ref.current) setComputedStyle(getComputedStyle(ref.current));
1609
+ }, [ref]);
1610
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarImpl, {
1611
+ "data-orientation": "horizontal",
1612
+ ...scrollbarProps,
1613
+ ref: composeRefs,
1614
+ sizes,
1615
+ style: {
1616
+ bottom: 0,
1617
+ left: context.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
1618
+ right: context.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
1619
+ ["--radix-scroll-area-thumb-width"]: getThumbSize(sizes) + "px",
1620
+ ...props.style
1621
+ },
1622
+ onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.x),
1623
+ onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.x),
1624
+ onWheelScroll: (event, maxScrollPos) => {
1625
+ if (context.viewport) {
1626
+ const scrollPos = context.viewport.scrollLeft + event.deltaX;
1627
+ props.onWheelScroll(scrollPos);
1628
+ if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
1629
+ }
1630
+ },
1631
+ onResize: () => {
1632
+ if (ref.current && context.viewport && computedStyle) onSizesChange({
1633
+ content: context.viewport.scrollWidth,
1634
+ viewport: context.viewport.offsetWidth,
1635
+ scrollbar: {
1636
+ size: ref.current.clientWidth,
1637
+ paddingStart: toInt(computedStyle.paddingLeft),
1638
+ paddingEnd: toInt(computedStyle.paddingRight)
1639
+ }
1640
+ });
1641
+ }
2728
1642
  });
2729
1643
  });
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"
1644
+ var ScrollAreaScrollbarY = react.forwardRef((props, forwardedRef) => {
1645
+ const { sizes, onSizesChange, ...scrollbarProps } = props;
1646
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1647
+ const [computedStyle, setComputedStyle] = react.useState();
1648
+ const ref = react.useRef(null);
1649
+ const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref, context.onScrollbarYChange);
1650
+ react.useEffect(() => {
1651
+ if (ref.current) setComputedStyle(getComputedStyle(ref.current));
1652
+ }, [ref]);
1653
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarImpl, {
1654
+ "data-orientation": "vertical",
1655
+ ...scrollbarProps,
1656
+ ref: composeRefs,
1657
+ sizes,
1658
+ style: {
1659
+ top: 0,
1660
+ right: context.dir === "ltr" ? 0 : void 0,
1661
+ left: context.dir === "rtl" ? 0 : void 0,
1662
+ bottom: "var(--radix-scroll-area-corner-height)",
1663
+ ["--radix-scroll-area-thumb-height"]: getThumbSize(sizes) + "px",
1664
+ ...props.style
1665
+ },
1666
+ onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.y),
1667
+ onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.y),
1668
+ onWheelScroll: (event, maxScrollPos) => {
1669
+ if (context.viewport) {
1670
+ const scrollPos = context.viewport.scrollTop + event.deltaY;
1671
+ props.onWheelScroll(scrollPos);
1672
+ if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
1673
+ }
1674
+ },
1675
+ onResize: () => {
1676
+ if (ref.current && context.viewport && computedStyle) onSizesChange({
1677
+ content: context.viewport.scrollHeight,
1678
+ viewport: context.viewport.offsetHeight,
1679
+ scrollbar: {
1680
+ size: ref.current.clientHeight,
1681
+ paddingStart: toInt(computedStyle.paddingTop),
1682
+ paddingEnd: toInt(computedStyle.paddingBottom)
1683
+ }
1684
+ });
1685
+ }
1686
+ });
1687
+ });
1688
+ var [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME);
1689
+ var ScrollAreaScrollbarImpl = react.forwardRef((props, forwardedRef) => {
1690
+ const { __scopeScrollArea, sizes, hasThumb, onThumbChange, onThumbPointerUp, onThumbPointerDown, onThumbPositionChange, onDragScroll, onWheelScroll, onResize, ...scrollbarProps } = props;
1691
+ const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
1692
+ const [scrollbar, setScrollbar] = react.useState(null);
1693
+ const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => setScrollbar(node));
1694
+ const rectRef = react.useRef(null);
1695
+ const prevWebkitUserSelectRef = react.useRef("");
1696
+ const viewport = context.viewport;
1697
+ const maxScrollPos = sizes.content - sizes.viewport;
1698
+ const handleWheelScroll = require_trust_score_card_glass.useCallbackRef(onWheelScroll);
1699
+ const handleThumbPositionChange = require_trust_score_card_glass.useCallbackRef(onThumbPositionChange);
1700
+ const handleResize = useDebounceCallback(onResize, 10);
1701
+ function handleDragScroll(event) {
1702
+ if (rectRef.current) onDragScroll({
1703
+ x: event.clientX - rectRef.current.left,
1704
+ y: event.clientY - rectRef.current.top
2907
1705
  });
2908
1706
  }
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"
2915
- });
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"
1707
+ react.useEffect(() => {
1708
+ const handleWheel = (event) => {
1709
+ const element = event.target;
1710
+ if (scrollbar?.contains(element)) handleWheelScroll(event, maxScrollPos);
1711
+ };
1712
+ document.addEventListener("wheel", handleWheel, { passive: false });
1713
+ return () => document.removeEventListener("wheel", handleWheel, { passive: false });
1714
+ }, [
1715
+ viewport,
1716
+ scrollbar,
1717
+ maxScrollPos,
1718
+ handleWheelScroll
1719
+ ]);
1720
+ react.useEffect(handleThumbPositionChange, [sizes, handleThumbPositionChange]);
1721
+ useResizeObserver(scrollbar, handleResize);
1722
+ useResizeObserver(context.content, handleResize);
1723
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollbarProvider, {
1724
+ scope: __scopeScrollArea,
1725
+ scrollbar,
1726
+ hasThumb,
1727
+ onThumbChange: require_trust_score_card_glass.useCallbackRef(onThumbChange),
1728
+ onThumbPointerUp: require_trust_score_card_glass.useCallbackRef(onThumbPointerUp),
1729
+ onThumbPositionChange: handleThumbPositionChange,
1730
+ onThumbPointerDown: require_trust_score_card_glass.useCallbackRef(onThumbPointerDown),
1731
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
1732
+ ...scrollbarProps,
1733
+ ref: composeRefs,
1734
+ style: {
1735
+ position: "absolute",
1736
+ ...scrollbarProps.style
1737
+ },
1738
+ onPointerDown: require_trust_score_card_glass.composeEventHandlers(props.onPointerDown, (event) => {
1739
+ if (event.button === 0) {
1740
+ event.target.setPointerCapture(event.pointerId);
1741
+ rectRef.current = scrollbar.getBoundingClientRect();
1742
+ prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
1743
+ document.body.style.webkitUserSelect = "none";
1744
+ if (context.viewport) context.viewport.style.scrollBehavior = "auto";
1745
+ handleDragScroll(event);
1746
+ }
1747
+ }),
1748
+ onPointerMove: require_trust_score_card_glass.composeEventHandlers(props.onPointerMove, handleDragScroll),
1749
+ onPointerUp: require_trust_score_card_glass.composeEventHandlers(props.onPointerUp, (event) => {
1750
+ const element = event.target;
1751
+ if (element.hasPointerCapture(event.pointerId)) element.releasePointerCapture(event.pointerId);
1752
+ document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
1753
+ if (context.viewport) context.viewport.style.scrollBehavior = "";
1754
+ rectRef.current = null;
1755
+ })
1756
+ })
2921
1757
  });
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
1758
+ });
1759
+ var THUMB_NAME = "ScrollAreaThumb";
1760
+ var ScrollAreaThumb = react.forwardRef((props, forwardedRef) => {
1761
+ const { forceMount, ...thumbProps } = props;
1762
+ const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);
1763
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
1764
+ present: forceMount || scrollbarContext.hasThumb,
1765
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaThumbImpl, {
1766
+ ref: forwardedRef,
1767
+ ...thumbProps
1768
+ })
2934
1769
  });
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));
1770
+ });
1771
+ var ScrollAreaThumbImpl = react.forwardRef((props, forwardedRef) => {
1772
+ const { __scopeScrollArea, style, ...thumbProps } = props;
1773
+ const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);
1774
+ const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);
1775
+ const { onThumbPositionChange } = scrollbarContext;
1776
+ const composedRef = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => scrollbarContext.onThumbChange(node));
1777
+ const removeUnlinkedScrollListenerRef = react.useRef(void 0);
1778
+ const debounceScrollEnd = useDebounceCallback(() => {
1779
+ if (removeUnlinkedScrollListenerRef.current) {
1780
+ removeUnlinkedScrollListenerRef.current();
1781
+ removeUnlinkedScrollListenerRef.current = void 0;
1782
+ }
1783
+ }, 100);
1784
+ react.useEffect(() => {
1785
+ const viewport = scrollAreaContext.viewport;
1786
+ if (viewport) {
1787
+ const handleScroll = () => {
1788
+ debounceScrollEnd();
1789
+ if (!removeUnlinkedScrollListenerRef.current) {
1790
+ removeUnlinkedScrollListenerRef.current = addUnlinkedScrollListener(viewport, onThumbPositionChange);
1791
+ onThumbPositionChange();
1792
+ }
1793
+ };
1794
+ onThumbPositionChange();
1795
+ viewport.addEventListener("scroll", handleScroll);
1796
+ return () => viewport.removeEventListener("scroll", handleScroll);
1797
+ }
1798
+ }, [
1799
+ scrollAreaContext.viewport,
1800
+ debounceScrollEnd,
1801
+ onThumbPositionChange
1802
+ ]);
1803
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
1804
+ "data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
1805
+ ...thumbProps,
1806
+ ref: composedRef,
1807
+ style: {
1808
+ width: "var(--radix-scroll-area-thumb-width)",
1809
+ height: "var(--radix-scroll-area-thumb-height)",
1810
+ ...style
1811
+ },
1812
+ onPointerDownCapture: require_trust_score_card_glass.composeEventHandlers(props.onPointerDownCapture, (event) => {
1813
+ const thumbRect = event.target.getBoundingClientRect();
1814
+ const x = event.clientX - thumbRect.left;
1815
+ const y = event.clientY - thumbRect.top;
1816
+ scrollbarContext.onThumbPointerDown({
1817
+ x,
1818
+ y
1819
+ });
1820
+ }),
1821
+ onPointerUp: require_trust_score_card_glass.composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp)
2981
1822
  });
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]);
1823
+ });
1824
+ ScrollAreaThumb.displayName = THUMB_NAME;
1825
+ var CORNER_NAME = "ScrollAreaCorner";
1826
+ var ScrollAreaCorner = react.forwardRef((props, forwardedRef) => {
1827
+ const context = useScrollAreaContext(CORNER_NAME, props.__scopeScrollArea);
1828
+ const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
1829
+ return context.type !== "scroll" && hasBothScrollbarsVisible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaCornerImpl, {
1830
+ ...props,
1831
+ ref: forwardedRef
1832
+ }) : null;
1833
+ });
1834
+ ScrollAreaCorner.displayName = CORNER_NAME;
1835
+ var ScrollAreaCornerImpl = react.forwardRef((props, forwardedRef) => {
1836
+ const { __scopeScrollArea, ...cornerProps } = props;
1837
+ const context = useScrollAreaContext(CORNER_NAME, __scopeScrollArea);
1838
+ const [width, setWidth] = react.useState(0);
1839
+ const [height, setHeight] = react.useState(0);
1840
+ const hasSize = Boolean(width && height);
1841
+ useResizeObserver(context.scrollbarX, () => {
1842
+ const height2 = context.scrollbarX?.offsetHeight || 0;
1843
+ context.onCornerHeightChange(height2);
1844
+ setHeight(height2);
1845
+ });
1846
+ useResizeObserver(context.scrollbarY, () => {
1847
+ const width2 = context.scrollbarY?.offsetWidth || 0;
1848
+ context.onCornerWidthChange(width2);
1849
+ setWidth(width2);
1850
+ });
1851
+ return hasSize ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
1852
+ ...cornerProps,
1853
+ ref: forwardedRef,
1854
+ style: {
1855
+ width,
1856
+ height,
1857
+ position: "absolute",
1858
+ right: context.dir === "ltr" ? 0 : void 0,
1859
+ left: context.dir === "rtl" ? 0 : void 0,
1860
+ bottom: 0,
1861
+ ...props.style
3006
1862
  }
3007
- return n;
3008
- }, _extends.apply(null, arguments);
3009
- }
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;
3019
- }
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;
3030
- }
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;
3038
- }
3039
- function _toPropertyKey(t) {
3040
- var i = _toPrimitive(t, "string");
3041
- return "symbol" == typeof i ? i : i + "";
3042
- }
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);
1863
+ }) : null;
1864
+ });
1865
+ function toInt(value) {
1866
+ return value ? parseInt(value, 10) : 0;
3052
1867
  }
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;
1868
+ function getThumbRatio(viewportSize, contentSize) {
1869
+ const ratio = viewportSize / contentSize;
1870
+ return isNaN(ratio) ? 0 : ratio;
3061
1871
  }
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;
1872
+ function getThumbSize(sizes) {
1873
+ const ratio = getThumbRatio(sizes.viewport, sizes.content);
1874
+ const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
1875
+ const thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio;
1876
+ return Math.max(thumbSize, 18);
3070
1877
  }
3071
- function defaultUniqBy(entry) {
3072
- return entry.value;
1878
+ function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes, dir = "ltr") {
1879
+ const thumbSizePx = getThumbSize(sizes);
1880
+ const thumbCenter = thumbSizePx / 2;
1881
+ const offset = pointerOffset || thumbCenter;
1882
+ const thumbOffsetFromEnd = thumbSizePx - offset;
1883
+ const minPointerPos = sizes.scrollbar.paddingStart + offset;
1884
+ const maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd;
1885
+ const maxScrollPos = sizes.content - sizes.viewport;
1886
+ const scrollRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
1887
+ return linearScale([minPointerPos, maxPointerPos], scrollRange)(pointerPos);
3073
1888
  }
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);
1889
+ function getThumbOffsetFromScroll(scrollPos, sizes, dir = "ltr") {
1890
+ const thumbSizePx = getThumbSize(sizes);
1891
+ const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
1892
+ const scrollbar = sizes.scrollbar.size - scrollbarPadding;
1893
+ const maxScrollPos = sizes.content - sizes.viewport;
1894
+ const maxThumbPos = scrollbar - thumbSizePx;
1895
+ const scrollWithoutMomentum = require_trust_score_card_glass.clamp(scrollPos, dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0]);
1896
+ return linearScale([0, maxScrollPos], [0, maxThumbPos])(scrollWithoutMomentum);
3081
1897
  }
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);
1898
+ function linearScale(input, output) {
1899
+ return (value) => {
1900
+ if (input[0] === input[1] || output[0] === output[1]) return output[0];
1901
+ const ratio = (output[1] - output[0]) / (input[1] - input[0]);
1902
+ return output[0] + ratio * (value - input[0]);
1903
+ };
3090
1904
  }
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;
1905
+ function isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {
1906
+ return scrollPos > 0 && scrollPos < maxScrollPos;
3097
1907
  }
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
- }));
1908
+ var addUnlinkedScrollListener = (node, handler = () => {}) => {
1909
+ let prevPosition = {
1910
+ left: node.scrollLeft,
1911
+ top: node.scrollTop
1912
+ };
1913
+ let rAF = 0;
1914
+ (function loop() {
1915
+ const position = {
1916
+ left: node.scrollLeft,
1917
+ top: node.scrollTop
3107
1918
  };
3108
- }, [dispatch, props]);
3109
- return null;
3110
- }
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;
3115
- }
3116
- var legendDefaultProps = {
3117
- align: "center",
3118
- iconSize: 14,
3119
- itemSorter: "value",
3120
- layout: "horizontal",
3121
- verticalAlign: "bottom"
1919
+ const isHorizontalScroll = prevPosition.left !== position.left;
1920
+ const isVerticalScroll = prevPosition.top !== position.top;
1921
+ if (isHorizontalScroll || isVerticalScroll) handler();
1922
+ prevPosition = position;
1923
+ rAF = window.requestAnimationFrame(loop);
1924
+ })();
1925
+ return () => window.cancelAnimationFrame(rAF);
3122
1926
  };
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);
1927
+ function useDebounceCallback(callback, delay) {
1928
+ const handleCallback = require_trust_score_card_glass.useCallbackRef(callback);
1929
+ const debounceTimerRef = react.useRef(0);
1930
+ react.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
1931
+ return react.useCallback(() => {
1932
+ window.clearTimeout(debounceTimerRef.current);
1933
+ debounceTimerRef.current = window.setTimeout(handleCallback, delay);
1934
+ }, [handleCallback, delay]);
3160
1935
  }
3161
- Legend.displayName = "Legend";
1936
+ function useResizeObserver(element, onResize) {
1937
+ const handleResize = require_trust_score_card_glass.useCallbackRef(onResize);
1938
+ require_trust_score_card_glass.useLayoutEffect2(() => {
1939
+ let rAF = 0;
1940
+ if (element) {
1941
+ const resizeObserver = new ResizeObserver(() => {
1942
+ cancelAnimationFrame(rAF);
1943
+ rAF = window.requestAnimationFrame(handleResize);
1944
+ });
1945
+ resizeObserver.observe(element);
1946
+ return () => {
1947
+ window.cancelAnimationFrame(rAF);
1948
+ resizeObserver.unobserve(element);
1949
+ };
1950
+ }
1951
+ }, [element, handleResize]);
1952
+ }
1953
+ var Root = ScrollArea$1;
1954
+ var Viewport = ScrollAreaViewport;
1955
+ var Corner = ScrollAreaCorner;
3162
1956
  function ScrollArea({ className, children, ...props }) {
3163
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root$1, {
1957
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, {
3164
1958
  "data-slot": "scroll-area",
3165
1959
  className: require_utils.cn("relative", className),
3166
1960
  ...props,
@@ -3855,6 +2649,14 @@ exports.Bar = require_trust_score_card_glass.Bar;
3855
2649
  exports.BarChart = require_trust_score_card_glass.BarChart;
3856
2650
  exports.BaseProgressGlass = require_trust_score_card_glass.BaseProgressGlass;
3857
2651
  exports.ButtonGlass = require_trust_score_card_glass.ButtonGlass;
2652
+ exports.CardGlass = CardGlass;
2653
+ exports.CardGlassAction = CardGlassAction;
2654
+ exports.CardGlassContent = CardGlassContent;
2655
+ exports.CardGlassDescription = CardGlassDescription;
2656
+ exports.CardGlassFooter = CardGlassFooter;
2657
+ exports.CardGlassHeader = CardGlassHeader;
2658
+ exports.CardGlassRoot = CardGlassRoot;
2659
+ exports.CardGlassTitle = CardGlassTitle;
3858
2660
  exports.CareerStatsGlass = require_trust_score_card_glass.CareerStatsGlass;
3859
2661
  exports.CareerStatsHeaderGlass = require_trust_score_card_glass.CareerStatsHeaderGlass;
3860
2662
  exports.Cell = require_trust_score_card_glass.Cell;
@@ -3867,10 +2669,6 @@ exports.ChartTooltipContent = ChartTooltipContent;
3867
2669
  exports.CheckboxGlass = require_trust_score_card_glass.CheckboxGlass;
3868
2670
  exports.CircularMetricGlass = require_trust_score_card_glass.CircularMetricGlass;
3869
2671
  exports.CircularProgressGlass = require_trust_score_card_glass.CircularProgressGlass;
3870
- exports.CollapsibleGlass = CollapsibleGlass;
3871
- exports.CollapsibleGlassContent = CollapsibleGlassContent;
3872
- exports.CollapsibleGlassRoot = CollapsibleGlassRoot;
3873
- exports.CollapsibleGlassTrigger = CollapsibleGlassTrigger;
3874
2672
  exports.ComboBoxGlass = require_trust_score_card_glass.ComboBoxGlass;
3875
2673
  exports.ContributionMetricsGlass = require_trust_score_card_glass.ContributionMetricsGlass;
3876
2674
  exports.DropdownGlass = require_trust_score_card_glass.DropdownGlass;
@@ -3894,12 +2692,6 @@ exports.FlagAlertGlass = require_trust_score_card_glass.FlagAlertGlass;
3894
2692
  exports.FlagsSectionGlass = require_trust_score_card_glass.FlagsSectionGlass;
3895
2693
  exports.FormFieldWrapper = require_trust_score_card_glass.FormFieldWrapper;
3896
2694
  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;
3903
2695
  exports.HeaderBrandingGlass = require_trust_score_card_glass.HeaderBrandingGlass;
3904
2696
  exports.HeaderNavGlass = require_trust_score_card_glass.HeaderNavGlass;
3905
2697
  exports.IconButtonGlass = require_trust_score_card_glass.IconButtonGlass;
@@ -3920,30 +2712,13 @@ exports.ProfileAvatarGlass = require_trust_score_card_glass.ProfileAvatarGlass;
3920
2712
  exports.ProfileHeaderGlass = require_trust_score_card_glass.ProfileHeaderGlass;
3921
2713
  exports.ProgressGlass = require_trust_score_card_glass.ProgressGlass;
3922
2714
  exports.ProjectsListGlass = require_trust_score_card_glass.ProjectsListGlass;
3923
- exports.RadioGroupGlass = RadioGroupGlass;
3924
- exports.RadioGroupGlassItem = RadioGroupGlassItem;
3925
- exports.RadioGroupGlassRoot = RadioGroupGlassRoot;
3926
2715
  exports.RainbowProgressGlass = require_trust_score_card_glass.RainbowProgressGlass;
3927
2716
  exports.RepositoryCardGlass = require_trust_score_card_glass.RepositoryCardGlass;
3928
2717
  exports.RepositoryHeaderGlass = require_trust_score_card_glass.RepositoryHeaderGlass;
3929
2718
  exports.RepositoryMetadataGlass = require_trust_score_card_glass.RepositoryMetadataGlass;
3930
2719
  exports.ResponsiveContainer = require_trust_score_card_glass.ResponsiveContainer;
3931
- exports.ScrollAreaGlass = ScrollAreaGlass;
3932
- exports.ScrollBarGlass = ScrollBarGlass;
3933
2720
  exports.SearchBoxGlass = require_trust_score_card_glass.SearchBoxGlass;
3934
2721
  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;
3947
2722
  exports.SidebarGlass = SidebarGlass;
3948
2723
  exports.SkeletonGlass = require_trust_score_card_glass.SkeletonGlass;
3949
2724
  exports.SliderGlass = require_trust_score_card_glass.SliderGlass;
@@ -3960,9 +2735,6 @@ exports.TabsGlass = require_trust_score_card_glass.TabsGlass;
3960
2735
  exports.ThemeProvider = require_theme_context.ThemeProvider;
3961
2736
  exports.ThemeToggleGlass = require_trust_score_card_glass.ThemeToggleGlass;
3962
2737
  exports.ToggleGlass = require_trust_score_card_glass.ToggleGlass;
3963
- exports.ToggleGroupGlass = ToggleGroupGlass;
3964
- exports.ToggleGroupGlassItem = ToggleGroupGlassItem;
3965
- exports.ToggleGroupGlassRoot = ToggleGroupGlassRoot;
3966
2738
  exports.TooltipGlass = require_trust_score_card_glass.TooltipGlass;
3967
2739
  exports.TooltipGlassContent = require_trust_score_card_glass.TooltipGlassContent;
3968
2740
  exports.TooltipGlassProvider = require_trust_score_card_glass.TooltipGlassProvider;