@iblai/iblai-js 1.20.7 → 1.20.8

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.
@@ -95448,138 +95448,13 @@ ToastTitle.displayName = Title.displayName;
95448
95448
  const ToastDescription = React.forwardRef(({ className, ...props }, ref) => (jsx(Description, { ref: ref, className: cn("text-sm opacity-90", className), ...props })));
95449
95449
  ToastDescription.displayName = Description.displayName;
95450
95450
 
95451
- function useStateMachine$2(initialState, machine) {
95452
- return React.useReducer((state, event) => {
95453
- const nextState = machine[state][event];
95454
- return nextState ?? state;
95455
- }, initialState);
95456
- }
95457
-
95458
- // src/presence.tsx
95459
- var Presence$1 = (props) => {
95460
- const { present, children } = props;
95461
- const presence = usePresence$1(present);
95462
- const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
95463
- const ref = useComposedRefs$1(presence.ref, getElementRef$2(child));
95464
- const forceMount = typeof children === "function";
95465
- return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
95466
- };
95467
- Presence$1.displayName = "Presence";
95468
- function usePresence$1(present) {
95469
- const [node, setNode] = React.useState();
95470
- const stylesRef = React.useRef(null);
95471
- const prevPresentRef = React.useRef(present);
95472
- const prevAnimationNameRef = React.useRef("none");
95473
- const initialState = present ? "mounted" : "unmounted";
95474
- const [state, send] = useStateMachine$2(initialState, {
95475
- mounted: {
95476
- UNMOUNT: "unmounted",
95477
- ANIMATION_OUT: "unmountSuspended"
95478
- },
95479
- unmountSuspended: {
95480
- MOUNT: "mounted",
95481
- ANIMATION_END: "unmounted"
95482
- },
95483
- unmounted: {
95484
- MOUNT: "mounted"
95485
- }
95486
- });
95487
- React.useEffect(() => {
95488
- const currentAnimationName = getAnimationName$1(stylesRef.current);
95489
- prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
95490
- }, [state]);
95491
- useLayoutEffect2$1(() => {
95492
- const styles = stylesRef.current;
95493
- const wasPresent = prevPresentRef.current;
95494
- const hasPresentChanged = wasPresent !== present;
95495
- if (hasPresentChanged) {
95496
- const prevAnimationName = prevAnimationNameRef.current;
95497
- const currentAnimationName = getAnimationName$1(styles);
95498
- if (present) {
95499
- send("MOUNT");
95500
- } else if (currentAnimationName === "none" || styles?.display === "none") {
95501
- send("UNMOUNT");
95502
- } else {
95503
- const isAnimating = prevAnimationName !== currentAnimationName;
95504
- if (wasPresent && isAnimating) {
95505
- send("ANIMATION_OUT");
95506
- } else {
95507
- send("UNMOUNT");
95508
- }
95509
- }
95510
- prevPresentRef.current = present;
95511
- }
95512
- }, [present, send]);
95513
- useLayoutEffect2$1(() => {
95514
- if (node) {
95515
- let timeoutId;
95516
- const ownerWindow = node.ownerDocument.defaultView ?? window;
95517
- const handleAnimationEnd = (event) => {
95518
- const currentAnimationName = getAnimationName$1(stylesRef.current);
95519
- const isCurrentAnimation = currentAnimationName.includes(event.animationName);
95520
- if (event.target === node && isCurrentAnimation) {
95521
- send("ANIMATION_END");
95522
- if (!prevPresentRef.current) {
95523
- const currentFillMode = node.style.animationFillMode;
95524
- node.style.animationFillMode = "forwards";
95525
- timeoutId = ownerWindow.setTimeout(() => {
95526
- if (node.style.animationFillMode === "forwards") {
95527
- node.style.animationFillMode = currentFillMode;
95528
- }
95529
- });
95530
- }
95531
- }
95532
- };
95533
- const handleAnimationStart = (event) => {
95534
- if (event.target === node) {
95535
- prevAnimationNameRef.current = getAnimationName$1(stylesRef.current);
95536
- }
95537
- };
95538
- node.addEventListener("animationstart", handleAnimationStart);
95539
- node.addEventListener("animationcancel", handleAnimationEnd);
95540
- node.addEventListener("animationend", handleAnimationEnd);
95541
- return () => {
95542
- ownerWindow.clearTimeout(timeoutId);
95543
- node.removeEventListener("animationstart", handleAnimationStart);
95544
- node.removeEventListener("animationcancel", handleAnimationEnd);
95545
- node.removeEventListener("animationend", handleAnimationEnd);
95546
- };
95547
- } else {
95548
- send("ANIMATION_END");
95549
- }
95550
- }, [node, send]);
95551
- return {
95552
- isPresent: ["mounted", "unmountSuspended"].includes(state),
95553
- ref: React.useCallback((node2) => {
95554
- stylesRef.current = node2 ? getComputedStyle(node2) : null;
95555
- setNode(node2);
95556
- }, [])
95557
- };
95558
- }
95559
- function getAnimationName$1(styles) {
95560
- return styles?.animationName || "none";
95561
- }
95562
- function getElementRef$2(element) {
95563
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
95564
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
95565
- if (mayWarn) {
95566
- return element.ref;
95567
- }
95568
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
95569
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
95570
- if (mayWarn) {
95571
- return element.props.ref;
95572
- }
95573
- return element.props.ref || element.ref;
95574
- }
95575
-
95576
- var CHECKBOX_NAME = "Checkbox";
95577
- var [createCheckboxContext, createCheckboxScope] = createContextScope$1(CHECKBOX_NAME);
95578
- var [CheckboxProvider, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
95579
- var Checkbox$1 = React.forwardRef(
95451
+ var SWITCH_NAME = "Switch";
95452
+ var [createSwitchContext, createSwitchScope] = createContextScope$1(SWITCH_NAME);
95453
+ var [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME);
95454
+ var Switch$1 = React.forwardRef(
95580
95455
  (props, forwardedRef) => {
95581
95456
  const {
95582
- __scopeCheckbox,
95457
+ __scopeSwitch,
95583
95458
  name,
95584
95459
  checked: checkedProp,
95585
95460
  defaultChecked,
@@ -95588,7 +95463,7 @@ var Checkbox$1 = React.forwardRef(
95588
95463
  value = "on",
95589
95464
  onCheckedChange,
95590
95465
  form,
95591
- ...checkboxProps
95466
+ ...switchProps
95592
95467
  } = props;
95593
95468
  const [button, setButton] = React.useState(null);
95594
95469
  const composedRefs = useComposedRefs$1(forwardedRef, (node) => setButton(node));
@@ -95598,36 +95473,24 @@ var Checkbox$1 = React.forwardRef(
95598
95473
  prop: checkedProp,
95599
95474
  defaultProp: defaultChecked ?? false,
95600
95475
  onChange: onCheckedChange,
95601
- caller: CHECKBOX_NAME
95476
+ caller: SWITCH_NAME
95602
95477
  });
95603
- const initialCheckedStateRef = React.useRef(checked);
95604
- React.useEffect(() => {
95605
- const form2 = button?.form;
95606
- if (form2) {
95607
- const reset = () => setChecked(initialCheckedStateRef.current);
95608
- form2.addEventListener("reset", reset);
95609
- return () => form2.removeEventListener("reset", reset);
95610
- }
95611
- }, [button, setChecked]);
95612
- return /* @__PURE__ */ jsxs(CheckboxProvider, { scope: __scopeCheckbox, state: checked, disabled, children: [
95478
+ return /* @__PURE__ */ jsxs(SwitchProvider, { scope: __scopeSwitch, checked, disabled, children: [
95613
95479
  /* @__PURE__ */ jsx(
95614
- Primitive$3.button,
95480
+ Primitive$2.button,
95615
95481
  {
95616
95482
  type: "button",
95617
- role: "checkbox",
95618
- "aria-checked": isIndeterminate(checked) ? "mixed" : checked,
95483
+ role: "switch",
95484
+ "aria-checked": checked,
95619
95485
  "aria-required": required,
95620
95486
  "data-state": getState$3(checked),
95621
95487
  "data-disabled": disabled ? "" : void 0,
95622
95488
  disabled,
95623
95489
  value,
95624
- ...checkboxProps,
95490
+ ...switchProps,
95625
95491
  ref: composedRefs,
95626
- onKeyDown: composeEventHandlers$2(props.onKeyDown, (event) => {
95627
- if (event.key === "Enter") event.preventDefault();
95628
- }),
95629
- onClick: composeEventHandlers$2(props.onClick, (event) => {
95630
- setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
95492
+ onClick: composeEventHandlers$1(props.onClick, (event) => {
95493
+ setChecked((prevChecked) => !prevChecked);
95631
95494
  if (isFormControl) {
95632
95495
  hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
95633
95496
  if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
@@ -95636,7 +95499,7 @@ var Checkbox$1 = React.forwardRef(
95636
95499
  }
95637
95500
  ),
95638
95501
  isFormControl && /* @__PURE__ */ jsx(
95639
- CheckboxBubbleInput,
95502
+ SwitchBubbleInput,
95640
95503
  {
95641
95504
  control: button,
95642
95505
  bubbles: !hasConsumerStoppedPropagationRef.current,
@@ -95646,40 +95509,37 @@ var Checkbox$1 = React.forwardRef(
95646
95509
  required,
95647
95510
  disabled,
95648
95511
  form,
95649
- style: { transform: "translateX(-100%)" },
95650
- defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked
95512
+ style: { transform: "translateX(-100%)" }
95651
95513
  }
95652
95514
  )
95653
95515
  ] });
95654
95516
  }
95655
95517
  );
95656
- Checkbox$1.displayName = CHECKBOX_NAME;
95657
- var INDICATOR_NAME$2 = "CheckboxIndicator";
95658
- var CheckboxIndicator = React.forwardRef(
95518
+ Switch$1.displayName = SWITCH_NAME;
95519
+ var THUMB_NAME$1 = "SwitchThumb";
95520
+ var SwitchThumb = React.forwardRef(
95659
95521
  (props, forwardedRef) => {
95660
- const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
95661
- const context = useCheckboxContext(INDICATOR_NAME$2, __scopeCheckbox);
95662
- return /* @__PURE__ */ jsx(Presence$1, { present: forceMount || isIndeterminate(context.state) || context.state === true, children: /* @__PURE__ */ jsx(
95663
- Primitive$3.span,
95522
+ const { __scopeSwitch, ...thumbProps } = props;
95523
+ const context = useSwitchContext(THUMB_NAME$1, __scopeSwitch);
95524
+ return /* @__PURE__ */ jsx(
95525
+ Primitive$2.span,
95664
95526
  {
95665
- "data-state": getState$3(context.state),
95527
+ "data-state": getState$3(context.checked),
95666
95528
  "data-disabled": context.disabled ? "" : void 0,
95667
- ...indicatorProps,
95668
- ref: forwardedRef,
95669
- style: { pointerEvents: "none", ...props.style }
95529
+ ...thumbProps,
95530
+ ref: forwardedRef
95670
95531
  }
95671
- ) });
95532
+ );
95672
95533
  }
95673
95534
  );
95674
- CheckboxIndicator.displayName = INDICATOR_NAME$2;
95675
- var BUBBLE_INPUT_NAME$1 = "CheckboxBubbleInput";
95676
- var CheckboxBubbleInput = React.forwardRef(
95535
+ SwitchThumb.displayName = THUMB_NAME$1;
95536
+ var BUBBLE_INPUT_NAME$1 = "SwitchBubbleInput";
95537
+ var SwitchBubbleInput = React.forwardRef(
95677
95538
  ({
95678
- __scopeCheckbox,
95539
+ __scopeSwitch,
95679
95540
  control,
95680
95541
  checked,
95681
95542
  bubbles = true,
95682
- defaultChecked,
95683
95543
  ...props
95684
95544
  }, forwardedRef) => {
95685
95545
  const ref = React.useRef(null);
@@ -95697,18 +95557,16 @@ var CheckboxBubbleInput = React.forwardRef(
95697
95557
  const setChecked = descriptor.set;
95698
95558
  if (prevChecked !== checked && setChecked) {
95699
95559
  const event = new Event("click", { bubbles });
95700
- input.indeterminate = isIndeterminate(checked);
95701
- setChecked.call(input, isIndeterminate(checked) ? false : checked);
95560
+ setChecked.call(input, checked);
95702
95561
  input.dispatchEvent(event);
95703
95562
  }
95704
95563
  }, [prevChecked, checked, bubbles]);
95705
- const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
95706
95564
  return /* @__PURE__ */ jsx(
95707
- Primitive$3.input,
95565
+ "input",
95708
95566
  {
95709
95567
  type: "checkbox",
95710
95568
  "aria-hidden": true,
95711
- defaultChecked: defaultChecked ?? defaultCheckedRef.current,
95569
+ defaultChecked: checked,
95712
95570
  ...props,
95713
95571
  tabIndex: -1,
95714
95572
  ref: composedRefs,
@@ -95724,18 +95582,15 @@ var CheckboxBubbleInput = React.forwardRef(
95724
95582
  );
95725
95583
  }
95726
95584
  );
95727
- CheckboxBubbleInput.displayName = BUBBLE_INPUT_NAME$1;
95728
- function isIndeterminate(checked) {
95729
- return checked === "indeterminate";
95730
- }
95585
+ SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME$1;
95731
95586
  function getState$3(checked) {
95732
- return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
95587
+ return checked ? "checked" : "unchecked";
95733
95588
  }
95734
- var Root$a = Checkbox$1;
95735
- var Indicator$2 = CheckboxIndicator;
95589
+ var Root$a = Switch$1;
95590
+ var Thumb = SwitchThumb;
95736
95591
 
95737
- const Checkbox = React.forwardRef(({ className, ...props }, ref) => (jsx(Root$a, { ref: ref, className: cn("peer border-primary focus-visible:ring-ring h-4 w-4 shrink-0 rounded-sm border shadow-sm focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-500 data-[state=checked]:text-white", className), ...props, children: jsx(Indicator$2, { className: cn("flex items-center justify-center text-current"), children: jsx(Check, { className: "h-4 w-4" }) }) })));
95738
- Checkbox.displayName = Root$a.displayName;
95592
+ const Switch = React.forwardRef(({ className, ...props }, ref) => (jsx(Root$a, { className: cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", className), ...props, ref: ref, children: jsx(Thumb, { className: cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0") }) })));
95593
+ Switch.displayName = Root$a.displayName;
95739
95594
 
95740
95595
  const __storeToDerived = /* @__PURE__ */ new WeakMap();
95741
95596
  const __derivedToStore = /* @__PURE__ */ new WeakMap();
@@ -100837,6 +100692,131 @@ var Portal$2 = React.forwardRef((props, forwardedRef) => {
100837
100692
  });
100838
100693
  Portal$2.displayName = PORTAL_NAME$3;
100839
100694
 
100695
+ function useStateMachine$2(initialState, machine) {
100696
+ return React.useReducer((state, event) => {
100697
+ const nextState = machine[state][event];
100698
+ return nextState ?? state;
100699
+ }, initialState);
100700
+ }
100701
+
100702
+ // src/presence.tsx
100703
+ var Presence$1 = (props) => {
100704
+ const { present, children } = props;
100705
+ const presence = usePresence$1(present);
100706
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
100707
+ const ref = useComposedRefs$1(presence.ref, getElementRef$2(child));
100708
+ const forceMount = typeof children === "function";
100709
+ return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
100710
+ };
100711
+ Presence$1.displayName = "Presence";
100712
+ function usePresence$1(present) {
100713
+ const [node, setNode] = React.useState();
100714
+ const stylesRef = React.useRef(null);
100715
+ const prevPresentRef = React.useRef(present);
100716
+ const prevAnimationNameRef = React.useRef("none");
100717
+ const initialState = present ? "mounted" : "unmounted";
100718
+ const [state, send] = useStateMachine$2(initialState, {
100719
+ mounted: {
100720
+ UNMOUNT: "unmounted",
100721
+ ANIMATION_OUT: "unmountSuspended"
100722
+ },
100723
+ unmountSuspended: {
100724
+ MOUNT: "mounted",
100725
+ ANIMATION_END: "unmounted"
100726
+ },
100727
+ unmounted: {
100728
+ MOUNT: "mounted"
100729
+ }
100730
+ });
100731
+ React.useEffect(() => {
100732
+ const currentAnimationName = getAnimationName$1(stylesRef.current);
100733
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
100734
+ }, [state]);
100735
+ useLayoutEffect2$1(() => {
100736
+ const styles = stylesRef.current;
100737
+ const wasPresent = prevPresentRef.current;
100738
+ const hasPresentChanged = wasPresent !== present;
100739
+ if (hasPresentChanged) {
100740
+ const prevAnimationName = prevAnimationNameRef.current;
100741
+ const currentAnimationName = getAnimationName$1(styles);
100742
+ if (present) {
100743
+ send("MOUNT");
100744
+ } else if (currentAnimationName === "none" || styles?.display === "none") {
100745
+ send("UNMOUNT");
100746
+ } else {
100747
+ const isAnimating = prevAnimationName !== currentAnimationName;
100748
+ if (wasPresent && isAnimating) {
100749
+ send("ANIMATION_OUT");
100750
+ } else {
100751
+ send("UNMOUNT");
100752
+ }
100753
+ }
100754
+ prevPresentRef.current = present;
100755
+ }
100756
+ }, [present, send]);
100757
+ useLayoutEffect2$1(() => {
100758
+ if (node) {
100759
+ let timeoutId;
100760
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
100761
+ const handleAnimationEnd = (event) => {
100762
+ const currentAnimationName = getAnimationName$1(stylesRef.current);
100763
+ const isCurrentAnimation = currentAnimationName.includes(event.animationName);
100764
+ if (event.target === node && isCurrentAnimation) {
100765
+ send("ANIMATION_END");
100766
+ if (!prevPresentRef.current) {
100767
+ const currentFillMode = node.style.animationFillMode;
100768
+ node.style.animationFillMode = "forwards";
100769
+ timeoutId = ownerWindow.setTimeout(() => {
100770
+ if (node.style.animationFillMode === "forwards") {
100771
+ node.style.animationFillMode = currentFillMode;
100772
+ }
100773
+ });
100774
+ }
100775
+ }
100776
+ };
100777
+ const handleAnimationStart = (event) => {
100778
+ if (event.target === node) {
100779
+ prevAnimationNameRef.current = getAnimationName$1(stylesRef.current);
100780
+ }
100781
+ };
100782
+ node.addEventListener("animationstart", handleAnimationStart);
100783
+ node.addEventListener("animationcancel", handleAnimationEnd);
100784
+ node.addEventListener("animationend", handleAnimationEnd);
100785
+ return () => {
100786
+ ownerWindow.clearTimeout(timeoutId);
100787
+ node.removeEventListener("animationstart", handleAnimationStart);
100788
+ node.removeEventListener("animationcancel", handleAnimationEnd);
100789
+ node.removeEventListener("animationend", handleAnimationEnd);
100790
+ };
100791
+ } else {
100792
+ send("ANIMATION_END");
100793
+ }
100794
+ }, [node, send]);
100795
+ return {
100796
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
100797
+ ref: React.useCallback((node2) => {
100798
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
100799
+ setNode(node2);
100800
+ }, [])
100801
+ };
100802
+ }
100803
+ function getAnimationName$1(styles) {
100804
+ return styles?.animationName || "none";
100805
+ }
100806
+ function getElementRef$2(element) {
100807
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
100808
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
100809
+ if (mayWarn) {
100810
+ return element.ref;
100811
+ }
100812
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
100813
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
100814
+ if (mayWarn) {
100815
+ return element.props.ref;
100816
+ }
100817
+ return element.props.ref || element.ref;
100818
+ }
100819
+
100840
100820
  // src/visually-hidden.tsx
100841
100821
  var VISUALLY_HIDDEN_STYLES = Object.freeze({
100842
100822
  // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
@@ -101355,150 +101335,6 @@ function TooltipContent({ className, sideOffset = 0, children, ...props }) {
101355
101335
  return (jsx(Portal$1, { children: jsxs(Content2$2, { "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance", className), ...props, children: [children, jsx(Arrow2, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })] }) }));
101356
101336
  }
101357
101337
 
101358
- var SWITCH_NAME = "Switch";
101359
- var [createSwitchContext, createSwitchScope] = createContextScope$1(SWITCH_NAME);
101360
- var [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME);
101361
- var Switch$1 = React.forwardRef(
101362
- (props, forwardedRef) => {
101363
- const {
101364
- __scopeSwitch,
101365
- name,
101366
- checked: checkedProp,
101367
- defaultChecked,
101368
- required,
101369
- disabled,
101370
- value = "on",
101371
- onCheckedChange,
101372
- form,
101373
- ...switchProps
101374
- } = props;
101375
- const [button, setButton] = React.useState(null);
101376
- const composedRefs = useComposedRefs$1(forwardedRef, (node) => setButton(node));
101377
- const hasConsumerStoppedPropagationRef = React.useRef(false);
101378
- const isFormControl = button ? form || !!button.closest("form") : true;
101379
- const [checked, setChecked] = useControllableState$1({
101380
- prop: checkedProp,
101381
- defaultProp: defaultChecked ?? false,
101382
- onChange: onCheckedChange,
101383
- caller: SWITCH_NAME
101384
- });
101385
- return /* @__PURE__ */ jsxs(SwitchProvider, { scope: __scopeSwitch, checked, disabled, children: [
101386
- /* @__PURE__ */ jsx(
101387
- Primitive$2.button,
101388
- {
101389
- type: "button",
101390
- role: "switch",
101391
- "aria-checked": checked,
101392
- "aria-required": required,
101393
- "data-state": getState$2(checked),
101394
- "data-disabled": disabled ? "" : void 0,
101395
- disabled,
101396
- value,
101397
- ...switchProps,
101398
- ref: composedRefs,
101399
- onClick: composeEventHandlers$1(props.onClick, (event) => {
101400
- setChecked((prevChecked) => !prevChecked);
101401
- if (isFormControl) {
101402
- hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
101403
- if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
101404
- }
101405
- })
101406
- }
101407
- ),
101408
- isFormControl && /* @__PURE__ */ jsx(
101409
- SwitchBubbleInput,
101410
- {
101411
- control: button,
101412
- bubbles: !hasConsumerStoppedPropagationRef.current,
101413
- name,
101414
- value,
101415
- checked,
101416
- required,
101417
- disabled,
101418
- form,
101419
- style: { transform: "translateX(-100%)" }
101420
- }
101421
- )
101422
- ] });
101423
- }
101424
- );
101425
- Switch$1.displayName = SWITCH_NAME;
101426
- var THUMB_NAME$1 = "SwitchThumb";
101427
- var SwitchThumb = React.forwardRef(
101428
- (props, forwardedRef) => {
101429
- const { __scopeSwitch, ...thumbProps } = props;
101430
- const context = useSwitchContext(THUMB_NAME$1, __scopeSwitch);
101431
- return /* @__PURE__ */ jsx(
101432
- Primitive$2.span,
101433
- {
101434
- "data-state": getState$2(context.checked),
101435
- "data-disabled": context.disabled ? "" : void 0,
101436
- ...thumbProps,
101437
- ref: forwardedRef
101438
- }
101439
- );
101440
- }
101441
- );
101442
- SwitchThumb.displayName = THUMB_NAME$1;
101443
- var BUBBLE_INPUT_NAME = "SwitchBubbleInput";
101444
- var SwitchBubbleInput = React.forwardRef(
101445
- ({
101446
- __scopeSwitch,
101447
- control,
101448
- checked,
101449
- bubbles = true,
101450
- ...props
101451
- }, forwardedRef) => {
101452
- const ref = React.useRef(null);
101453
- const composedRefs = useComposedRefs$1(ref, forwardedRef);
101454
- const prevChecked = usePrevious$1(checked);
101455
- const controlSize = useSize$1(control);
101456
- React.useEffect(() => {
101457
- const input = ref.current;
101458
- if (!input) return;
101459
- const inputProto = window.HTMLInputElement.prototype;
101460
- const descriptor = Object.getOwnPropertyDescriptor(
101461
- inputProto,
101462
- "checked"
101463
- );
101464
- const setChecked = descriptor.set;
101465
- if (prevChecked !== checked && setChecked) {
101466
- const event = new Event("click", { bubbles });
101467
- setChecked.call(input, checked);
101468
- input.dispatchEvent(event);
101469
- }
101470
- }, [prevChecked, checked, bubbles]);
101471
- return /* @__PURE__ */ jsx(
101472
- "input",
101473
- {
101474
- type: "checkbox",
101475
- "aria-hidden": true,
101476
- defaultChecked: checked,
101477
- ...props,
101478
- tabIndex: -1,
101479
- ref: composedRefs,
101480
- style: {
101481
- ...props.style,
101482
- ...controlSize,
101483
- position: "absolute",
101484
- pointerEvents: "none",
101485
- opacity: 0,
101486
- margin: 0
101487
- }
101488
- }
101489
- );
101490
- }
101491
- );
101492
- SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME;
101493
- function getState$2(checked) {
101494
- return checked ? "checked" : "unchecked";
101495
- }
101496
- var Root$7 = Switch$1;
101497
- var Thumb = SwitchThumb;
101498
-
101499
- const Switch = React.forwardRef(({ className, ...props }, ref) => (jsx(Root$7, { className: cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", className), ...props, ref: ref, children: jsx(Thumb, { className: cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0") }) })));
101500
- Switch.displayName = Root$7.displayName;
101501
-
101502
101338
  // packages/react/context/src/createContext.tsx
101503
101339
  function createContextScope(scopeName, createContextScopeDeps = []) {
101504
101340
  let defaultContexts = [];
@@ -101742,11 +101578,11 @@ var Progress$1 = React.forwardRef(
101742
101578
  }
101743
101579
  );
101744
101580
  Progress$1.displayName = PROGRESS_NAME;
101745
- var INDICATOR_NAME$1 = "ProgressIndicator";
101581
+ var INDICATOR_NAME$2 = "ProgressIndicator";
101746
101582
  var ProgressIndicator = React.forwardRef(
101747
101583
  (props, forwardedRef) => {
101748
101584
  const { __scopeProgress, ...indicatorProps } = props;
101749
- const context = useProgressContext(INDICATOR_NAME$1, __scopeProgress);
101585
+ const context = useProgressContext(INDICATOR_NAME$2, __scopeProgress);
101750
101586
  return /* @__PURE__ */ jsx(
101751
101587
  Primitive$1.div,
101752
101588
  {
@@ -101759,7 +101595,7 @@ var ProgressIndicator = React.forwardRef(
101759
101595
  );
101760
101596
  }
101761
101597
  );
101762
- ProgressIndicator.displayName = INDICATOR_NAME$1;
101598
+ ProgressIndicator.displayName = INDICATOR_NAME$2;
101763
101599
  function defaultGetValueLabel(value, max) {
101764
101600
  return `${Math.round(value / max * 100)}%`;
101765
101601
  }
@@ -101786,11 +101622,11 @@ function getInvalidValueError(propValue, componentName) {
101786
101622
 
101787
101623
  Defaulting to \`null\`.`;
101788
101624
  }
101789
- var Root$6 = Progress$1;
101790
- var Indicator$1 = ProgressIndicator;
101625
+ var Root$7 = Progress$1;
101626
+ var Indicator$2 = ProgressIndicator;
101791
101627
 
101792
- const Progress = React.forwardRef(({ className, value, ...props }, ref) => (jsx(Root$6, { ref: ref, className: cn('bg-secondary relative h-4 w-full overflow-hidden rounded-full', className), ...props, children: jsx(Indicator$1, { className: "bg-primary h-full w-full flex-1 transition-all", style: { transform: `translateX(-${100 - (value || 0)}%)` } }) })));
101793
- Progress.displayName = Root$6.displayName;
101628
+ const Progress = React.forwardRef(({ className, value, ...props }, ref) => (jsx(Root$7, { ref: ref, className: cn('bg-secondary relative h-4 w-full overflow-hidden rounded-full', className), ...props, children: jsx(Indicator$2, { className: "bg-primary h-full w-full flex-1 transition-all", style: { transform: `translateX(-${100 - (value || 0)}%)` } }) })));
101629
+ Progress.displayName = Root$7.displayName;
101794
101630
 
101795
101631
  var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
101796
101632
  // @__NO_SIDE_EFFECTS__
@@ -102819,11 +102655,11 @@ var Label$1 = React.forwardRef((props, forwardedRef) => {
102819
102655
  );
102820
102656
  });
102821
102657
  Label$1.displayName = NAME$2;
102822
- var Root$5 = Label$1;
102658
+ var Root$6 = Label$1;
102823
102659
 
102824
102660
  const labelVariants = cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
102825
- const Label = React.forwardRef(({ className, ...props }, ref) => (jsx(Root$5, { ref: ref, className: cn(labelVariants(), className), ...props })));
102826
- Label.displayName = Root$5.displayName;
102661
+ const Label = React.forwardRef(({ className, ...props }, ref) => (jsx(Root$6, { ref: ref, className: cn(labelVariants(), className), ...props })));
102662
+ Label.displayName = Root$6.displayName;
102827
102663
 
102828
102664
  var dayjs_min = {exports: {}};
102829
102665
 
@@ -126025,10 +125861,10 @@ function Profile({ tenant, username, tenants, onClose, customization = {}, isAdm
126025
125861
  })] }), (customization.showLeaderboardDisplayCheckbox ||
126026
125862
  customization.showMentorAIDisplayCheckbox) && (jsxs("div", { className: "grid grid-cols-2 gap-6 pt-4", children: [customization.showMentorAIDisplayCheckbox && (jsx("div", { className: "space-y-2", children: jsxs("div", { className: "flex items-center space-x-2", children: [basicForm.Field({
126027
125863
  name: 'displayMentor',
126028
- children: (field) => (jsx(Checkbox, { onCheckedChange: (checked) => field.handleChange(checked), checked: field.state.value, disabled: basicForm.state.isSubmitting || isUserMetadataLoading, id: "display-mentor" })),
126029
- }), jsx("label", { htmlFor: "display-mentor", className: "text-sm leading-none font-medium text-gray-700 peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: "Display Mentor AI" })] }) })), customization.showLeaderboardDisplayCheckbox && (jsx("div", { className: "space-y-2", children: jsxs("div", { className: "flex items-center space-x-2", children: [basicForm.Field({
125864
+ children: (field) => (jsx(Switch, { className: "data-[state=checked]:bg-blue-600", onCheckedChange: (checked) => field.handleChange(checked), checked: field.state.value, disabled: basicForm.state.isSubmitting || isUserMetadataLoading, id: "display-mentor" })),
125865
+ }), jsx("label", { htmlFor: "display-mentor", className: "text-sm leading-none font-medium text-gray-700 peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: "Display Agent Sidebar" })] }) })), customization.showLeaderboardDisplayCheckbox && (jsx("div", { className: "space-y-2", children: jsxs("div", { className: "flex items-center space-x-2", children: [basicForm.Field({
126030
125866
  name: 'displayLeaderBoard',
126031
- children: (field) => (jsx(Checkbox, { onCheckedChange: (checked) => field.handleChange(checked), checked: field.state.value, disabled: basicForm.state.isSubmitting || isUserMetadataLoading, id: "display-leaderboard" })),
125867
+ children: (field) => (jsx(Switch, { className: "data-[state=checked]:bg-blue-600", onCheckedChange: (checked) => field.handleChange(checked), checked: field.state.value, disabled: basicForm.state.isSubmitting || isUserMetadataLoading, id: "display-leaderboard" })),
126032
125868
  }), jsx("label", { htmlFor: "display-leaderboard", className: "text-sm leading-none font-medium text-gray-700 peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: "Display Leaderboard" })] }) }))] }))] }) })), activeTab === 'social' && (jsx("div", { className: "max-w-2xl space-y-6", children: jsxs("form", { className: "space-y-6", onSubmit: (formEvent) => {
126033
125869
  formEvent.preventDefault();
126034
125870
  formEvent.stopPropagation();
@@ -126588,6 +126424,170 @@ function UsersTab$1({ tenant, currentPage, itemsPerPage, onInviteSuccess }) {
126588
126424
  jsx("tr", { children: jsx("td", { colSpan: 2, className: "px-6 py-12 text-center", children: jsxs("div", { className: "flex flex-col items-center justify-center text-gray-500", children: [jsx(Mail, { className: "h-12 w-12 mb-3 text-gray-300", "aria-hidden": "true" }), jsx("p", { className: "text-sm font-medium", children: "No invitations yet" }), jsx("p", { className: "text-xs mt-1", children: "Start by inviting users above or uploading a CSV file" })] }) }) })) : (currentUsers.map((user) => (jsxs("tr", { className: "hover:bg-gray-50 transition-colors duration-150", children: [jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: jsxs("div", { className: "flex items-center truncate max-w-[200px] sm:max-w-full", children: [jsx("div", { className: "flex-shrink-0 h-8 w-8", children: jsx("div", { className: "h-8 w-8 rounded-full bg-blue-100 flex items-center justify-center", children: jsx(Mail, { className: "h-4 w-4 text-blue-600", "aria-hidden": "true" }) }) }), jsx("div", { className: "ml-3", children: jsx("div", { className: "text-sm font-medium text-gray-900", children: user.email || 'No email' }) })] }) }), jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: jsxs("span", { className: `inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${getStatusColor(user.active, user.expired)}`, children: [user.active && !user.expired && (jsx(Clock, { className: "h-3 w-3 mr-1 text-blue-500", "aria-hidden": "true" })), !user.active && !user.expired && (jsx(CircleCheck, { className: "h-3 w-3 mr-1 text-green-700", "aria-hidden": "true" })), user.expired && (jsx(CircleX, { className: "h-3 w-3 mr-1 text-gray-500", "aria-hidden": "true" })), getStatusText(user.active, user.expired)] }) })] }, user.id)))) })] }) }) }) }) }), isCSVEditorOpen && (jsx(CSVEditor, { csvData: parsedCSVData, onSave: handleCSVEditorSave, onCancel: handleCSVEditorCancel }))] }));
126589
126425
  }
126590
126426
 
126427
+ var CHECKBOX_NAME = "Checkbox";
126428
+ var [createCheckboxContext, createCheckboxScope] = createContextScope$1(CHECKBOX_NAME);
126429
+ var [CheckboxProvider, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
126430
+ var Checkbox$1 = React.forwardRef(
126431
+ (props, forwardedRef) => {
126432
+ const {
126433
+ __scopeCheckbox,
126434
+ name,
126435
+ checked: checkedProp,
126436
+ defaultChecked,
126437
+ required,
126438
+ disabled,
126439
+ value = "on",
126440
+ onCheckedChange,
126441
+ form,
126442
+ ...checkboxProps
126443
+ } = props;
126444
+ const [button, setButton] = React.useState(null);
126445
+ const composedRefs = useComposedRefs$1(forwardedRef, (node) => setButton(node));
126446
+ const hasConsumerStoppedPropagationRef = React.useRef(false);
126447
+ const isFormControl = button ? form || !!button.closest("form") : true;
126448
+ const [checked, setChecked] = useControllableState$1({
126449
+ prop: checkedProp,
126450
+ defaultProp: defaultChecked ?? false,
126451
+ onChange: onCheckedChange,
126452
+ caller: CHECKBOX_NAME
126453
+ });
126454
+ const initialCheckedStateRef = React.useRef(checked);
126455
+ React.useEffect(() => {
126456
+ const form2 = button?.form;
126457
+ if (form2) {
126458
+ const reset = () => setChecked(initialCheckedStateRef.current);
126459
+ form2.addEventListener("reset", reset);
126460
+ return () => form2.removeEventListener("reset", reset);
126461
+ }
126462
+ }, [button, setChecked]);
126463
+ return /* @__PURE__ */ jsxs(CheckboxProvider, { scope: __scopeCheckbox, state: checked, disabled, children: [
126464
+ /* @__PURE__ */ jsx(
126465
+ Primitive$3.button,
126466
+ {
126467
+ type: "button",
126468
+ role: "checkbox",
126469
+ "aria-checked": isIndeterminate(checked) ? "mixed" : checked,
126470
+ "aria-required": required,
126471
+ "data-state": getState$2(checked),
126472
+ "data-disabled": disabled ? "" : void 0,
126473
+ disabled,
126474
+ value,
126475
+ ...checkboxProps,
126476
+ ref: composedRefs,
126477
+ onKeyDown: composeEventHandlers$2(props.onKeyDown, (event) => {
126478
+ if (event.key === "Enter") event.preventDefault();
126479
+ }),
126480
+ onClick: composeEventHandlers$2(props.onClick, (event) => {
126481
+ setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
126482
+ if (isFormControl) {
126483
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
126484
+ if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
126485
+ }
126486
+ })
126487
+ }
126488
+ ),
126489
+ isFormControl && /* @__PURE__ */ jsx(
126490
+ CheckboxBubbleInput,
126491
+ {
126492
+ control: button,
126493
+ bubbles: !hasConsumerStoppedPropagationRef.current,
126494
+ name,
126495
+ value,
126496
+ checked,
126497
+ required,
126498
+ disabled,
126499
+ form,
126500
+ style: { transform: "translateX(-100%)" },
126501
+ defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked
126502
+ }
126503
+ )
126504
+ ] });
126505
+ }
126506
+ );
126507
+ Checkbox$1.displayName = CHECKBOX_NAME;
126508
+ var INDICATOR_NAME$1 = "CheckboxIndicator";
126509
+ var CheckboxIndicator = React.forwardRef(
126510
+ (props, forwardedRef) => {
126511
+ const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
126512
+ const context = useCheckboxContext(INDICATOR_NAME$1, __scopeCheckbox);
126513
+ return /* @__PURE__ */ jsx(Presence$1, { present: forceMount || isIndeterminate(context.state) || context.state === true, children: /* @__PURE__ */ jsx(
126514
+ Primitive$3.span,
126515
+ {
126516
+ "data-state": getState$2(context.state),
126517
+ "data-disabled": context.disabled ? "" : void 0,
126518
+ ...indicatorProps,
126519
+ ref: forwardedRef,
126520
+ style: { pointerEvents: "none", ...props.style }
126521
+ }
126522
+ ) });
126523
+ }
126524
+ );
126525
+ CheckboxIndicator.displayName = INDICATOR_NAME$1;
126526
+ var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
126527
+ var CheckboxBubbleInput = React.forwardRef(
126528
+ ({
126529
+ __scopeCheckbox,
126530
+ control,
126531
+ checked,
126532
+ bubbles = true,
126533
+ defaultChecked,
126534
+ ...props
126535
+ }, forwardedRef) => {
126536
+ const ref = React.useRef(null);
126537
+ const composedRefs = useComposedRefs$1(ref, forwardedRef);
126538
+ const prevChecked = usePrevious$1(checked);
126539
+ const controlSize = useSize$1(control);
126540
+ React.useEffect(() => {
126541
+ const input = ref.current;
126542
+ if (!input) return;
126543
+ const inputProto = window.HTMLInputElement.prototype;
126544
+ const descriptor = Object.getOwnPropertyDescriptor(
126545
+ inputProto,
126546
+ "checked"
126547
+ );
126548
+ const setChecked = descriptor.set;
126549
+ if (prevChecked !== checked && setChecked) {
126550
+ const event = new Event("click", { bubbles });
126551
+ input.indeterminate = isIndeterminate(checked);
126552
+ setChecked.call(input, isIndeterminate(checked) ? false : checked);
126553
+ input.dispatchEvent(event);
126554
+ }
126555
+ }, [prevChecked, checked, bubbles]);
126556
+ const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
126557
+ return /* @__PURE__ */ jsx(
126558
+ Primitive$3.input,
126559
+ {
126560
+ type: "checkbox",
126561
+ "aria-hidden": true,
126562
+ defaultChecked: defaultChecked ?? defaultCheckedRef.current,
126563
+ ...props,
126564
+ tabIndex: -1,
126565
+ ref: composedRefs,
126566
+ style: {
126567
+ ...props.style,
126568
+ ...controlSize,
126569
+ position: "absolute",
126570
+ pointerEvents: "none",
126571
+ opacity: 0,
126572
+ margin: 0
126573
+ }
126574
+ }
126575
+ );
126576
+ }
126577
+ );
126578
+ CheckboxBubbleInput.displayName = BUBBLE_INPUT_NAME;
126579
+ function isIndeterminate(checked) {
126580
+ return checked === "indeterminate";
126581
+ }
126582
+ function getState$2(checked) {
126583
+ return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
126584
+ }
126585
+ var Root$5 = Checkbox$1;
126586
+ var Indicator$1 = CheckboxIndicator;
126587
+
126588
+ const Checkbox = React.forwardRef(({ className, ...props }, ref) => (jsx(Root$5, { ref: ref, className: cn("peer border-primary focus-visible:ring-ring h-4 w-4 shrink-0 rounded-sm border shadow-sm focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-500 data-[state=checked]:text-white", className), ...props, children: jsx(Indicator$1, { className: cn("flex items-center justify-center text-current"), children: jsx(Check, { className: "h-4 w-4" }) }) })));
126589
+ Checkbox.displayName = Root$5.displayName;
126590
+
126591
126591
  function CoursesTab({ tenant, currentPage, itemsPerPage, hasManageUsersPermission = false, }) {
126592
126592
  var _a;
126593
126593
  const [inviteSent, setInviteSent] = useState(false);
@@ -211339,8 +211339,8 @@ const CourseContentLayout = ({ courseId, isPlatformAdmin, currentTenant, tabHref
211339
211339
  }, children: children }) })] })] })] }) }));
211340
211340
  };
211341
211341
 
211342
- const CustomSwitch = React.forwardRef(({ className, checked, onCheckedChange, ...props }, ref) => (jsx(Root$7, { checked: checked, onCheckedChange: onCheckedChange, className: cn('peer focus-visible:ring-ring focus-visible:ring-offset-background inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-500 data-[state=unchecked]:bg-gray-200', className), ...props, ref: ref, children: jsx(Thumb, { className: cn('pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0') }) })));
211343
- CustomSwitch.displayName = Root$7.displayName;
211342
+ const CustomSwitch = React.forwardRef(({ className, checked, onCheckedChange, ...props }, ref) => (jsx(Root$a, { checked: checked, onCheckedChange: onCheckedChange, className: cn('peer focus-visible:ring-ring focus-visible:ring-offset-background inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-500 data-[state=unchecked]:bg-gray-200', className), ...props, ref: ref, children: jsx(Thumb, { className: cn('pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0') }) })));
211343
+ CustomSwitch.displayName = Root$a.displayName;
211344
211344
 
211345
211345
  /**
211346
211346
  * Label contract for the Settings tab and its two sub-modals.