@t3q-ui/design-system 1.63.2 → 1.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1361,9 +1361,62 @@ function Badge({ className, variant, rounded, appearance, size, children, ...pro
1361
1361
  }
1362
1362
  );
1363
1363
  }
1364
+ var restoring = false;
1365
+ function isRestoringFocus() {
1366
+ return restoring;
1367
+ }
1368
+ function useRestoreFocusToOpener({
1369
+ onOpenAutoFocus,
1370
+ onCloseAutoFocus
1371
+ }) {
1372
+ const openerRef = useRef(null);
1373
+ const handleOpenAutoFocus = useCallback(
1374
+ (event) => {
1375
+ openerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
1376
+ onOpenAutoFocus?.(event);
1377
+ },
1378
+ [onOpenAutoFocus]
1379
+ );
1380
+ const handleCloseAutoFocus = useCallback(
1381
+ (event) => {
1382
+ onCloseAutoFocus?.(event);
1383
+ if (event.defaultPrevented) return;
1384
+ const opener = openerRef.current;
1385
+ if (!opener || opener === document.body || !opener.isConnected) return;
1386
+ event.preventDefault();
1387
+ restoring = true;
1388
+ try {
1389
+ opener.focus({ preventScroll: true });
1390
+ } finally {
1391
+ restoring = false;
1392
+ }
1393
+ },
1394
+ [onCloseAutoFocus]
1395
+ );
1396
+ return { onOpenAutoFocus: handleOpenAutoFocus, onCloseAutoFocus: handleCloseAutoFocus };
1397
+ }
1364
1398
  var TooltipProvider = TooltipPrimitive.Provider;
1399
+ function isKeyboardFocus(el) {
1400
+ try {
1401
+ return el.matches(":focus-visible");
1402
+ } catch {
1403
+ return true;
1404
+ }
1405
+ }
1365
1406
  var Tooltip = TooltipPrimitive.Root;
1366
- var TooltipTrigger = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { type: "button", ref, className: cn(className), ...props }));
1407
+ var TooltipTrigger = React10.forwardRef(({ className, onFocus, ...props }, ref) => /* @__PURE__ */ jsx(
1408
+ TooltipPrimitive.Trigger,
1409
+ {
1410
+ type: "button",
1411
+ ref,
1412
+ className: cn(className),
1413
+ ...props,
1414
+ onFocus: (e) => {
1415
+ onFocus?.(e);
1416
+ if (isRestoringFocus() && !isKeyboardFocus(e.target)) e.preventDefault();
1417
+ }
1418
+ }
1419
+ ));
1367
1420
  TooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName;
1368
1421
  var TooltipContent = React10.forwardRef(({ className, sideOffset = 4, children, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1369
1422
  TooltipPrimitive.Content,
@@ -3577,31 +3630,6 @@ function ChatMessage({
3577
3630
  }
3578
3631
  );
3579
3632
  }
3580
- function useRestoreFocusToOpener({
3581
- onOpenAutoFocus,
3582
- onCloseAutoFocus
3583
- }) {
3584
- const openerRef = useRef(null);
3585
- const handleOpenAutoFocus = useCallback(
3586
- (event) => {
3587
- openerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
3588
- onOpenAutoFocus?.(event);
3589
- },
3590
- [onOpenAutoFocus]
3591
- );
3592
- const handleCloseAutoFocus = useCallback(
3593
- (event) => {
3594
- onCloseAutoFocus?.(event);
3595
- if (event.defaultPrevented) return;
3596
- const opener = openerRef.current;
3597
- if (!opener || opener === document.body || !opener.isConnected) return;
3598
- event.preventDefault();
3599
- opener.focus({ preventScroll: true });
3600
- },
3601
- [onCloseAutoFocus]
3602
- );
3603
- return { onOpenAutoFocus: handleOpenAutoFocus, onCloseAutoFocus: handleCloseAutoFocus };
3604
- }
3605
3633
  var Dialog = DialogPrimitive.Root;
3606
3634
  var DialogTrigger = DialogPrimitive.Trigger;
3607
3635
  var DialogPortal = DialogPrimitive.Portal;
@@ -5637,5 +5665,5 @@ function TwoLineCellRenderer(params) {
5637
5665
  }
5638
5666
 
5639
5667
  export { AG_GRID_LOCALE_KR, AgGridContext, AgGridTable, Alert, AlertActions, AlertDescription, AlertTitle, BADGE_OUTLINE_ACCENT, BALANCED_FILL_MIN_WIDTH, Badge, Button, CLEAR_HOST_CLASS, CLEAR_REVEAL_CLASS, CancelIcon, Card, CardContent, CardDescription, CardFooter, CardHeader, CardThumbnail, CardTitle, ChatComposer, ChatHistory, ChatMessage, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyBoxIllustration, FloatingLabelOutline, Form, FormControl, FormDescription, FormField, FormFooter, FormHeader, FormItem, FormLabel, FormMessage, FormSection, FormSectionLevelContext, FormValidMessage, HeaderCheckboxRenderer, LucideIcon, NUMBER_COLUMN_WIDTH, PageHeader, PageHeaderProvider, Pagination, PaginationContent, PaginationFirst, PaginationItem, PaginationLast, PaginationLink, PaginationNext, PaginationPrevious, PaginationWrapper, Panel, RowCheckboxRenderer, SORT_ICON_OFFSET_CLASS, Separator2 as Separator, Skeleton, Spinner, Stack, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TextField, Textarea, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TwoLineCellRenderer, badgeVariants, buttonVariants, estimateHeaderTextWidth, fitColumnsToContent, getPaginationRange, getSortedColumnState, groupChatHistoryByDate, growColumnIds, sanitizeUserText, tagVariants, useFloatingLabel, useFormControlContext, useFormField, usePageHeader, useRestoreFocusToOpener, withBalancedFill, withExplicitSortIcons, withFlexFill, withHeaderMinWidth, withNumberColumnWidth, withSortIconOffset, withTypeClasses, withWidthFloor };
5640
- //# sourceMappingURL=chunk-S6TTWFNU.js.map
5641
- //# sourceMappingURL=chunk-S6TTWFNU.js.map
5668
+ //# sourceMappingURL=chunk-MWVKFIOX.js.map
5669
+ //# sourceMappingURL=chunk-MWVKFIOX.js.map