- Added Custom Exams tab showing all exams from Generation page - Displays title, module badges, duration, and status - Added Create Exam button - Kept Exam Sessions tab for institutional sessions - Search filters across exams Made-with: Cursor
453 lines
16 KiB
JavaScript
453 lines
16 KiB
JavaScript
"use client";
|
|
import {
|
|
Anchor,
|
|
Arrow,
|
|
Content,
|
|
Root2,
|
|
createPopperScope
|
|
} from "./chunk-4QIN2SXT.js";
|
|
import "./chunk-SBO4SQHK.js";
|
|
import {
|
|
Combination_default,
|
|
FocusScope,
|
|
hideOthers,
|
|
useFocusGuards
|
|
} from "./chunk-2XAGCDBS.js";
|
|
import {
|
|
DismissableLayer,
|
|
Portal
|
|
} from "./chunk-TXGNUMDU.js";
|
|
import {
|
|
useId
|
|
} from "./chunk-6MTKRYAT.js";
|
|
import {
|
|
Presence
|
|
} from "./chunk-7QGJQHFX.js";
|
|
import {
|
|
useControllableState
|
|
} from "./chunk-PP5CJGVQ.js";
|
|
import {
|
|
Primitive,
|
|
composeEventHandlers,
|
|
createContextScope
|
|
} from "./chunk-QWDI7X5E.js";
|
|
import "./chunk-KCFVMCIE.js";
|
|
import "./chunk-5ZB7HMJW.js";
|
|
import "./chunk-T2SWDQEL.js";
|
|
import {
|
|
composeRefs,
|
|
useComposedRefs
|
|
} from "./chunk-JDYSANEB.js";
|
|
import {
|
|
require_jsx_runtime
|
|
} from "./chunk-KBTYAULA.js";
|
|
import {
|
|
require_react
|
|
} from "./chunk-QCHXOAYK.js";
|
|
import {
|
|
__toESM
|
|
} from "./chunk-WOOG5QLI.js";
|
|
|
|
// node_modules/@radix-ui/react-popover/dist/index.mjs
|
|
var React2 = __toESM(require_react(), 1);
|
|
|
|
// node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
var React = __toESM(require_react(), 1);
|
|
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
function createSlot(ownerName) {
|
|
const SlotClone = createSlotClone(ownerName);
|
|
const Slot22 = React.forwardRef((props, forwardedRef) => {
|
|
const { children, ...slotProps } = props;
|
|
const childrenArray = React.Children.toArray(children);
|
|
const slottable = childrenArray.find(isSlottable);
|
|
if (slottable) {
|
|
const newElement = slottable.props.children;
|
|
const newChildren = childrenArray.map((child) => {
|
|
if (child === slottable) {
|
|
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
return React.isValidElement(newElement) ? newElement.props.children : null;
|
|
} else {
|
|
return child;
|
|
}
|
|
});
|
|
return (0, import_jsx_runtime.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
|
}
|
|
return (0, import_jsx_runtime.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
});
|
|
Slot22.displayName = `${ownerName}.Slot`;
|
|
return Slot22;
|
|
}
|
|
var Slot = createSlot("Slot");
|
|
function createSlotClone(ownerName) {
|
|
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
const { children, ...slotProps } = props;
|
|
if (React.isValidElement(children)) {
|
|
const childrenRef = getElementRef(children);
|
|
const props2 = mergeProps(slotProps, children.props);
|
|
if (children.type !== React.Fragment) {
|
|
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
}
|
|
return React.cloneElement(children, props2);
|
|
}
|
|
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
});
|
|
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
return SlotClone;
|
|
}
|
|
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
function createSlottable(ownerName) {
|
|
const Slottable2 = ({ children }) => {
|
|
return (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
};
|
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
return Slottable2;
|
|
}
|
|
var Slottable = createSlottable("Slottable");
|
|
function isSlottable(child) {
|
|
return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
}
|
|
function mergeProps(slotProps, childProps) {
|
|
const overrideProps = { ...childProps };
|
|
for (const propName in childProps) {
|
|
const slotPropValue = slotProps[propName];
|
|
const childPropValue = childProps[propName];
|
|
const isHandler = /^on[A-Z]/.test(propName);
|
|
if (isHandler) {
|
|
if (slotPropValue && childPropValue) {
|
|
overrideProps[propName] = (...args) => {
|
|
const result = childPropValue(...args);
|
|
slotPropValue(...args);
|
|
return result;
|
|
};
|
|
} else if (slotPropValue) {
|
|
overrideProps[propName] = slotPropValue;
|
|
}
|
|
} else if (propName === "style") {
|
|
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
} else if (propName === "className") {
|
|
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
}
|
|
}
|
|
return { ...slotProps, ...overrideProps };
|
|
}
|
|
function getElementRef(element) {
|
|
var _a, _b;
|
|
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
if (mayWarn) {
|
|
return element.ref;
|
|
}
|
|
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
if (mayWarn) {
|
|
return element.props.ref;
|
|
}
|
|
return element.props.ref || element.ref;
|
|
}
|
|
|
|
// node_modules/@radix-ui/react-popover/dist/index.mjs
|
|
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
var POPOVER_NAME = "Popover";
|
|
var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [
|
|
createPopperScope
|
|
]);
|
|
var usePopperScope = createPopperScope();
|
|
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
var Popover = (props) => {
|
|
const {
|
|
__scopePopover,
|
|
children,
|
|
open: openProp,
|
|
defaultOpen,
|
|
onOpenChange,
|
|
modal = false
|
|
} = props;
|
|
const popperScope = usePopperScope(__scopePopover);
|
|
const triggerRef = React2.useRef(null);
|
|
const [hasCustomAnchor, setHasCustomAnchor] = React2.useState(false);
|
|
const [open, setOpen] = useControllableState({
|
|
prop: openProp,
|
|
defaultProp: defaultOpen ?? false,
|
|
onChange: onOpenChange,
|
|
caller: POPOVER_NAME
|
|
});
|
|
return (0, import_jsx_runtime2.jsx)(Root2, { ...popperScope, children: (0, import_jsx_runtime2.jsx)(
|
|
PopoverProvider,
|
|
{
|
|
scope: __scopePopover,
|
|
contentId: useId(),
|
|
triggerRef,
|
|
open,
|
|
onOpenChange: setOpen,
|
|
onOpenToggle: React2.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
hasCustomAnchor,
|
|
onCustomAnchorAdd: React2.useCallback(() => setHasCustomAnchor(true), []),
|
|
onCustomAnchorRemove: React2.useCallback(() => setHasCustomAnchor(false), []),
|
|
modal,
|
|
children
|
|
}
|
|
) });
|
|
};
|
|
Popover.displayName = POPOVER_NAME;
|
|
var ANCHOR_NAME = "PopoverAnchor";
|
|
var PopoverAnchor = React2.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const { __scopePopover, ...anchorProps } = props;
|
|
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
const popperScope = usePopperScope(__scopePopover);
|
|
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
React2.useEffect(() => {
|
|
onCustomAnchorAdd();
|
|
return () => onCustomAnchorRemove();
|
|
}, [onCustomAnchorAdd, onCustomAnchorRemove]);
|
|
return (0, import_jsx_runtime2.jsx)(Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
}
|
|
);
|
|
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
var TRIGGER_NAME = "PopoverTrigger";
|
|
var PopoverTrigger = React2.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const { __scopePopover, ...triggerProps } = props;
|
|
const context = usePopoverContext(TRIGGER_NAME, __scopePopover);
|
|
const popperScope = usePopperScope(__scopePopover);
|
|
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
const trigger = (0, import_jsx_runtime2.jsx)(
|
|
Primitive.button,
|
|
{
|
|
type: "button",
|
|
"aria-haspopup": "dialog",
|
|
"aria-expanded": context.open,
|
|
"aria-controls": context.contentId,
|
|
"data-state": getState(context.open),
|
|
...triggerProps,
|
|
ref: composedTriggerRef,
|
|
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
}
|
|
);
|
|
return context.hasCustomAnchor ? trigger : (0, import_jsx_runtime2.jsx)(Anchor, { asChild: true, ...popperScope, children: trigger });
|
|
}
|
|
);
|
|
PopoverTrigger.displayName = TRIGGER_NAME;
|
|
var PORTAL_NAME = "PopoverPortal";
|
|
var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, {
|
|
forceMount: void 0
|
|
});
|
|
var PopoverPortal = (props) => {
|
|
const { __scopePopover, forceMount, children, container } = props;
|
|
const context = usePopoverContext(PORTAL_NAME, __scopePopover);
|
|
return (0, import_jsx_runtime2.jsx)(PortalProvider, { scope: __scopePopover, forceMount, children: (0, import_jsx_runtime2.jsx)(Presence, { present: forceMount || context.open, children: (0, import_jsx_runtime2.jsx)(Portal, { asChild: true, container, children }) }) });
|
|
};
|
|
PopoverPortal.displayName = PORTAL_NAME;
|
|
var CONTENT_NAME = "PopoverContent";
|
|
var PopoverContent = React2.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);
|
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
return (0, import_jsx_runtime2.jsx)(Presence, { present: forceMount || context.open, children: context.modal ? (0, import_jsx_runtime2.jsx)(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : (0, import_jsx_runtime2.jsx)(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
}
|
|
);
|
|
PopoverContent.displayName = CONTENT_NAME;
|
|
var Slot2 = createSlot("PopoverContent.RemoveScroll");
|
|
var PopoverContentModal = React2.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
const contentRef = React2.useRef(null);
|
|
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
const isRightClickOutsideRef = React2.useRef(false);
|
|
React2.useEffect(() => {
|
|
const content = contentRef.current;
|
|
if (content) return hideOthers(content);
|
|
}, []);
|
|
return (0, import_jsx_runtime2.jsx)(Combination_default, { as: Slot2, allowPinchZoom: true, children: (0, import_jsx_runtime2.jsx)(
|
|
PopoverContentImpl,
|
|
{
|
|
...props,
|
|
ref: composedRefs,
|
|
trapFocus: context.open,
|
|
disableOutsidePointerEvents: true,
|
|
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
var _a;
|
|
event.preventDefault();
|
|
if (!isRightClickOutsideRef.current) (_a = context.triggerRef.current) == null ? void 0 : _a.focus();
|
|
}),
|
|
onPointerDownOutside: composeEventHandlers(
|
|
props.onPointerDownOutside,
|
|
(event) => {
|
|
const originalEvent = event.detail.originalEvent;
|
|
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
isRightClickOutsideRef.current = isRightClick;
|
|
},
|
|
{ checkForDefaultPrevented: false }
|
|
),
|
|
onFocusOutside: composeEventHandlers(
|
|
props.onFocusOutside,
|
|
(event) => event.preventDefault(),
|
|
{ checkForDefaultPrevented: false }
|
|
)
|
|
}
|
|
) });
|
|
}
|
|
);
|
|
var PopoverContentNonModal = React2.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
const hasInteractedOutsideRef = React2.useRef(false);
|
|
const hasPointerDownOutsideRef = React2.useRef(false);
|
|
return (0, import_jsx_runtime2.jsx)(
|
|
PopoverContentImpl,
|
|
{
|
|
...props,
|
|
ref: forwardedRef,
|
|
trapFocus: false,
|
|
disableOutsidePointerEvents: false,
|
|
onCloseAutoFocus: (event) => {
|
|
var _a, _b;
|
|
(_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
|
|
if (!event.defaultPrevented) {
|
|
if (!hasInteractedOutsideRef.current) (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
|
|
event.preventDefault();
|
|
}
|
|
hasInteractedOutsideRef.current = false;
|
|
hasPointerDownOutsideRef.current = false;
|
|
},
|
|
onInteractOutside: (event) => {
|
|
var _a, _b;
|
|
(_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
|
|
if (!event.defaultPrevented) {
|
|
hasInteractedOutsideRef.current = true;
|
|
if (event.detail.originalEvent.type === "pointerdown") {
|
|
hasPointerDownOutsideRef.current = true;
|
|
}
|
|
}
|
|
const target = event.target;
|
|
const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
|
|
if (targetIsTrigger) event.preventDefault();
|
|
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
}
|
|
);
|
|
}
|
|
);
|
|
var PopoverContentImpl = React2.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const {
|
|
__scopePopover,
|
|
trapFocus,
|
|
onOpenAutoFocus,
|
|
onCloseAutoFocus,
|
|
disableOutsidePointerEvents,
|
|
onEscapeKeyDown,
|
|
onPointerDownOutside,
|
|
onFocusOutside,
|
|
onInteractOutside,
|
|
...contentProps
|
|
} = props;
|
|
const context = usePopoverContext(CONTENT_NAME, __scopePopover);
|
|
const popperScope = usePopperScope(__scopePopover);
|
|
useFocusGuards();
|
|
return (0, import_jsx_runtime2.jsx)(
|
|
FocusScope,
|
|
{
|
|
asChild: true,
|
|
loop: true,
|
|
trapped: trapFocus,
|
|
onMountAutoFocus: onOpenAutoFocus,
|
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
children: (0, import_jsx_runtime2.jsx)(
|
|
DismissableLayer,
|
|
{
|
|
asChild: true,
|
|
disableOutsidePointerEvents,
|
|
onInteractOutside,
|
|
onEscapeKeyDown,
|
|
onPointerDownOutside,
|
|
onFocusOutside,
|
|
onDismiss: () => context.onOpenChange(false),
|
|
children: (0, import_jsx_runtime2.jsx)(
|
|
Content,
|
|
{
|
|
"data-state": getState(context.open),
|
|
role: "dialog",
|
|
id: context.contentId,
|
|
...popperScope,
|
|
...contentProps,
|
|
ref: forwardedRef,
|
|
style: {
|
|
...contentProps.style,
|
|
// re-namespace exposed content custom properties
|
|
...{
|
|
"--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
"--radix-popover-content-available-width": "var(--radix-popper-available-width)",
|
|
"--radix-popover-content-available-height": "var(--radix-popper-available-height)",
|
|
"--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
|
|
"--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
|
|
}
|
|
}
|
|
}
|
|
)
|
|
}
|
|
)
|
|
}
|
|
);
|
|
}
|
|
);
|
|
var CLOSE_NAME = "PopoverClose";
|
|
var PopoverClose = React2.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const { __scopePopover, ...closeProps } = props;
|
|
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
return (0, import_jsx_runtime2.jsx)(
|
|
Primitive.button,
|
|
{
|
|
type: "button",
|
|
...closeProps,
|
|
ref: forwardedRef,
|
|
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
}
|
|
);
|
|
}
|
|
);
|
|
PopoverClose.displayName = CLOSE_NAME;
|
|
var ARROW_NAME = "PopoverArrow";
|
|
var PopoverArrow = React2.forwardRef(
|
|
(props, forwardedRef) => {
|
|
const { __scopePopover, ...arrowProps } = props;
|
|
const popperScope = usePopperScope(__scopePopover);
|
|
return (0, import_jsx_runtime2.jsx)(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
}
|
|
);
|
|
PopoverArrow.displayName = ARROW_NAME;
|
|
function getState(open) {
|
|
return open ? "open" : "closed";
|
|
}
|
|
var Root22 = Popover;
|
|
var Anchor2 = PopoverAnchor;
|
|
var Trigger = PopoverTrigger;
|
|
var Portal2 = PopoverPortal;
|
|
var Content2 = PopoverContent;
|
|
var Close = PopoverClose;
|
|
var Arrow2 = PopoverArrow;
|
|
export {
|
|
Anchor2 as Anchor,
|
|
Arrow2 as Arrow,
|
|
Close,
|
|
Content2 as Content,
|
|
Popover,
|
|
PopoverAnchor,
|
|
PopoverArrow,
|
|
PopoverClose,
|
|
PopoverContent,
|
|
PopoverPortal,
|
|
PopoverTrigger,
|
|
Portal2 as Portal,
|
|
Root22 as Root,
|
|
Trigger,
|
|
createPopoverScope
|
|
};
|
|
//# sourceMappingURL=@radix-ui_react-popover.js.map
|