@axis-ds/ui-react 1.6.3 → 1.8.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.
Files changed (52) hide show
  1. package/README.md +2 -2
  2. package/dist/button/index.js +5 -5
  3. package/dist/button/index.mjs +5 -5
  4. package/dist/card/index.js +1 -1
  5. package/dist/card/index.mjs +1 -1
  6. package/dist/checkbox/index.js +1 -1
  7. package/dist/checkbox/index.mjs +1 -1
  8. package/dist/command/index.d.mts +7 -1
  9. package/dist/command/index.d.ts +7 -1
  10. package/dist/command/index.js +16 -8
  11. package/dist/command/index.mjs +17 -9
  12. package/dist/dialog/index.d.mts +6 -4
  13. package/dist/dialog/index.d.ts +6 -4
  14. package/dist/dialog/index.js +27 -3
  15. package/dist/dialog/index.mjs +27 -3
  16. package/dist/dropdown-menu/index.js +1 -1
  17. package/dist/dropdown-menu/index.mjs +1 -1
  18. package/dist/input/index.js +1 -1
  19. package/dist/input/index.mjs +1 -1
  20. package/dist/popover/index.d.mts +7 -4
  21. package/dist/popover/index.d.ts +7 -4
  22. package/dist/popover/index.js +26 -2
  23. package/dist/popover/index.mjs +26 -2
  24. package/dist/progress/index.js +4 -4
  25. package/dist/progress/index.mjs +4 -4
  26. package/dist/radio-group/index.js +1 -1
  27. package/dist/radio-group/index.mjs +1 -1
  28. package/dist/scroll-area/index.js +8 -1
  29. package/dist/scroll-area/index.mjs +8 -1
  30. package/dist/select/index.js +1 -1
  31. package/dist/select/index.mjs +1 -1
  32. package/dist/sheet/index.d.mts +7 -5
  33. package/dist/sheet/index.d.ts +7 -5
  34. package/dist/sheet/index.js +26 -2
  35. package/dist/sheet/index.mjs +26 -2
  36. package/dist/slider/index.js +1 -1
  37. package/dist/slider/index.mjs +1 -1
  38. package/dist/switch/index.js +1 -1
  39. package/dist/switch/index.mjs +1 -1
  40. package/dist/table/index.js +2 -2
  41. package/dist/table/index.mjs +2 -2
  42. package/dist/textarea/index.js +1 -1
  43. package/dist/textarea/index.mjs +1 -1
  44. package/dist/toast/index.js +1 -1
  45. package/dist/toast/index.mjs +1 -1
  46. package/dist/toggle/index.js +4 -4
  47. package/dist/toggle/index.mjs +4 -4
  48. package/dist/tooltip/index.d.mts +16 -3
  49. package/dist/tooltip/index.d.ts +16 -3
  50. package/dist/tooltip/index.js +87 -19
  51. package/dist/tooltip/index.mjs +87 -19
  52. package/package.json +2 -2
@@ -1,14 +1,16 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import type * as __AxisClsx from 'clsx';
3
2
  type __AxisCvaClassProp = { class: __AxisClsx.ClassValue; className?: never } | { class?: never; className: __AxisClsx.ClassValue } | { class?: never; className?: never };
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as React from 'react';
5
5
  import * as DialogPrimitive from '@radix-ui/react-dialog';
6
6
  import { VariantProps } from 'class-variance-authority';
7
7
 
8
- /** 화면 측면에서 슬라이드되어 나타나는 시트(Sheet) 컴포넌트의 루트 요소 */
9
- declare const Sheet: React.FC<DialogPrimitive.DialogProps>;
10
- /** 시트를 열기 위한 트리거 버튼 컴포넌트 */
11
- declare const SheetTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
8
+ declare function Sheet({ open: openProp, defaultOpen, onOpenChange, ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime.JSX.Element;
9
+ declare namespace Sheet {
10
+ var displayName: string;
11
+ }
12
+ /** 시트를 열기 위한 트리거 버튼 컴포넌트. 닫힌 동안에는 aria-controls 를 두지 않는다. */
13
+ declare const SheetTrigger: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
12
14
  /** 시트를 닫기 위한 닫기 버튼 컴포넌트 */
13
15
  declare const SheetClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
14
16
  /** 시트 콘텐츠를 포탈로 렌더링하는 컴포넌트 */
@@ -1,14 +1,16 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import type * as __AxisClsx from 'clsx';
3
2
  type __AxisCvaClassProp = { class: __AxisClsx.ClassValue; className?: never } | { class?: never; className: __AxisClsx.ClassValue } | { class?: never; className?: never };
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as React from 'react';
5
5
  import * as DialogPrimitive from '@radix-ui/react-dialog';
6
6
  import { VariantProps } from 'class-variance-authority';
7
7
 
8
- /** 화면 측면에서 슬라이드되어 나타나는 시트(Sheet) 컴포넌트의 루트 요소 */
9
- declare const Sheet: React.FC<DialogPrimitive.DialogProps>;
10
- /** 시트를 열기 위한 트리거 버튼 컴포넌트 */
11
- declare const SheetTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
8
+ declare function Sheet({ open: openProp, defaultOpen, onOpenChange, ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime.JSX.Element;
9
+ declare namespace Sheet {
10
+ var displayName: string;
11
+ }
12
+ /** 시트를 열기 위한 트리거 버튼 컴포넌트. 닫힌 동안에는 aria-controls 를 두지 않는다. */
13
+ declare const SheetTrigger: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
12
14
  /** 시트를 닫기 위한 닫기 버튼 컴포넌트 */
13
15
  declare const SheetClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
14
16
  /** 시트 콘텐츠를 포탈로 렌더링하는 컴포넌트 */
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -45,8 +46,31 @@ var React = __toESM(require("react"));
45
46
  var SheetPrimitive = __toESM(require("@radix-ui/react-dialog"));
46
47
  var import_class_variance_authority = require("class-variance-authority");
47
48
  var import_utils = require("../utils.js");
48
- const Sheet = SheetPrimitive.Root;
49
- const SheetTrigger = SheetPrimitive.Trigger;
49
+ const SheetOpenContext = React.createContext(null);
50
+ function Sheet({
51
+ open: openProp,
52
+ defaultOpen,
53
+ onOpenChange,
54
+ ...props
55
+ }) {
56
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? false);
57
+ const isControlled = openProp !== void 0;
58
+ const open = isControlled ? openProp : uncontrolledOpen;
59
+ const handleOpenChange = React.useCallback(
60
+ (next) => {
61
+ if (!isControlled) setUncontrolledOpen(next);
62
+ onOpenChange?.(next);
63
+ },
64
+ [isControlled, onOpenChange]
65
+ );
66
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetOpenContext.Provider, { value: open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetPrimitive.Root, { open, onOpenChange: handleOpenChange, ...props }) });
67
+ }
68
+ Sheet.displayName = "Sheet";
69
+ const SheetTrigger = React.forwardRef((props, ref) => {
70
+ const open = React.useContext(SheetOpenContext);
71
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetPrimitive.Trigger, { ref, ...open === false ? { "aria-controls": void 0 } : {}, ...props });
72
+ });
73
+ SheetTrigger.displayName = "SheetTrigger";
50
74
  const SheetClose = SheetPrimitive.Close;
51
75
  const SheetPortal = SheetPrimitive.Portal;
52
76
  const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -1,10 +1,34 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import * as React from "react";
3
4
  import * as SheetPrimitive from "@radix-ui/react-dialog";
4
5
  import { cva } from "class-variance-authority";
5
6
  import { cn } from "../utils.mjs";
6
- const Sheet = SheetPrimitive.Root;
7
- const SheetTrigger = SheetPrimitive.Trigger;
7
+ const SheetOpenContext = React.createContext(null);
8
+ function Sheet({
9
+ open: openProp,
10
+ defaultOpen,
11
+ onOpenChange,
12
+ ...props
13
+ }) {
14
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? false);
15
+ const isControlled = openProp !== void 0;
16
+ const open = isControlled ? openProp : uncontrolledOpen;
17
+ const handleOpenChange = React.useCallback(
18
+ (next) => {
19
+ if (!isControlled) setUncontrolledOpen(next);
20
+ onOpenChange?.(next);
21
+ },
22
+ [isControlled, onOpenChange]
23
+ );
24
+ return /* @__PURE__ */ jsx(SheetOpenContext.Provider, { value: open, children: /* @__PURE__ */ jsx(SheetPrimitive.Root, { open, onOpenChange: handleOpenChange, ...props }) });
25
+ }
26
+ Sheet.displayName = "Sheet";
27
+ const SheetTrigger = React.forwardRef((props, ref) => {
28
+ const open = React.useContext(SheetOpenContext);
29
+ return /* @__PURE__ */ jsx(SheetPrimitive.Trigger, { ref, ...open === false ? { "aria-controls": void 0 } : {}, ...props });
30
+ });
31
+ SheetTrigger.displayName = "SheetTrigger";
8
32
  const SheetClose = SheetPrimitive.Close;
9
33
  const SheetPortal = SheetPrimitive.Portal;
10
34
  const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
@@ -51,7 +51,7 @@ const Slider = React.forwardRef(
51
51
  ),
52
52
  ...props,
53
53
  children: [
54
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-[var(--axis-surface-tertiary)]", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderPrimitive.Range, { className: "absolute h-full bg-[var(--axis-interactive-primary)]" }) }),
54
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-[var(--axis-form-control-track,var(--axis-surface-tertiary))]", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderPrimitive.Range, { className: "absolute h-full bg-[var(--axis-interactive-primary)]" }) }),
55
55
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
56
56
  SliderPrimitive.Thumb,
57
57
  {
@@ -18,7 +18,7 @@ const Slider = React.forwardRef(
18
18
  ),
19
19
  ...props,
20
20
  children: [
21
- /* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-[var(--axis-surface-tertiary)]", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-[var(--axis-interactive-primary)]" }) }),
21
+ /* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-[var(--axis-form-control-track,var(--axis-surface-tertiary))]", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-[var(--axis-interactive-primary)]" }) }),
22
22
  /* @__PURE__ */ jsx(
23
23
  SliderPrimitive.Thumb,
24
24
  {
@@ -43,7 +43,7 @@ const Switch = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
43
43
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--axis-border-focus)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--axis-surface-default)]",
44
44
  "disabled:cursor-not-allowed disabled:opacity-50",
45
45
  "data-[state=checked]:bg-[var(--axis-interactive-primary)]",
46
- "data-[state=unchecked]:bg-[var(--axis-surface-tertiary)]",
46
+ "data-[state=unchecked]:bg-[var(--axis-form-control-track,var(--axis-surface-tertiary))]",
47
47
  className
48
48
  ),
49
49
  ...props,
@@ -10,7 +10,7 @@ const Switch = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
10
10
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--axis-border-focus)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--axis-surface-default)]",
11
11
  "disabled:cursor-not-allowed disabled:opacity-50",
12
12
  "data-[state=checked]:bg-[var(--axis-interactive-primary)]",
13
- "data-[state=unchecked]:bg-[var(--axis-surface-tertiary)]",
13
+ "data-[state=unchecked]:bg-[var(--axis-form-control-track,var(--axis-surface-tertiary))]",
14
14
  className
15
15
  ),
16
16
  ...props,
@@ -46,7 +46,7 @@ const Table = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
46
46
  {
47
47
  ref,
48
48
  className: (0, import_utils.cn)(
49
- "w-full caption-bottom text-sm text-[var(--axis-text-primary)]",
49
+ "w-full caption-bottom text-[length:var(--axis-table-font-size,0.875rem)] leading-5 text-[var(--axis-text-primary)]",
50
50
  className
51
51
  ),
52
52
  ...props
@@ -102,7 +102,7 @@ const TableHead = React.forwardRef(({ className, ...props }, ref) => /* @__PURE_
102
102
  {
103
103
  ref,
104
104
  className: (0, import_utils.cn)(
105
- "h-12 px-4 text-left align-middle font-medium text-[var(--axis-text-secondary)]",
105
+ "h-12 px-4 text-left align-middle text-[length:var(--axis-table-head-font-size,0.875rem)] font-medium text-[var(--axis-text-secondary)]",
106
106
  "[&:has([role=checkbox])]:pr-0",
107
107
  className
108
108
  ),
@@ -6,7 +6,7 @@ const Table = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
6
6
  {
7
7
  ref,
8
8
  className: cn(
9
- "w-full caption-bottom text-sm text-[var(--axis-text-primary)]",
9
+ "w-full caption-bottom text-[length:var(--axis-table-font-size,0.875rem)] leading-5 text-[var(--axis-text-primary)]",
10
10
  className
11
11
  ),
12
12
  ...props
@@ -62,7 +62,7 @@ const TableHead = React.forwardRef(({ className, ...props }, ref) => /* @__PURE_
62
62
  {
63
63
  ref,
64
64
  className: cn(
65
- "h-12 px-4 text-left align-middle font-medium text-[var(--axis-text-secondary)]",
65
+ "h-12 px-4 text-left align-middle text-[length:var(--axis-table-head-font-size,0.875rem)] font-medium text-[var(--axis-text-secondary)]",
66
66
  "[&:has([role=checkbox])]:pr-0",
67
67
  className
68
68
  ),
@@ -38,7 +38,7 @@ const Textarea = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
38
38
  "textarea",
39
39
  {
40
40
  className: (0, import_utils.cn)(
41
- "flex min-h-[80px] w-full rounded-md border border-[var(--axis-border-default)] bg-[var(--axis-surface-default)] px-3 py-2 text-sm",
41
+ "flex min-h-[80px] w-full rounded-md border border-[var(--axis-form-control-border,var(--axis-border-default))] bg-[var(--axis-surface-default)] px-3 py-2 text-sm",
42
42
  "text-[var(--axis-text-primary)]",
43
43
  "ring-offset-[var(--axis-surface-default)]",
44
44
  "placeholder:text-[var(--axis-text-tertiary)]",
@@ -5,7 +5,7 @@ const Textarea = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
5
5
  "textarea",
6
6
  {
7
7
  className: cn(
8
- "flex min-h-[80px] w-full rounded-md border border-[var(--axis-border-default)] bg-[var(--axis-surface-default)] px-3 py-2 text-sm",
8
+ "flex min-h-[80px] w-full rounded-md border border-[var(--axis-form-control-border,var(--axis-border-default))] bg-[var(--axis-surface-default)] px-3 py-2 text-sm",
9
9
  "text-[var(--axis-text-primary)]",
10
10
  "ring-offset-[var(--axis-surface-default)]",
11
11
  "placeholder:text-[var(--axis-text-tertiary)]",
@@ -126,7 +126,7 @@ const ToastDescription = React.forwardRef(({ className, ...props }, ref) => /* @
126
126
  ToastPrimitives.Description,
127
127
  {
128
128
  ref,
129
- className: (0, import_utils.cn)("text-sm opacity-90", className),
129
+ className: (0, import_utils.cn)("text-sm", className),
130
130
  ...props
131
131
  }
132
132
  ));
@@ -87,7 +87,7 @@ const ToastDescription = React.forwardRef(({ className, ...props }, ref) => /* @
87
87
  ToastPrimitives.Description,
88
88
  {
89
89
  ref,
90
- className: cn("text-sm opacity-90", className),
90
+ className: cn("text-sm", className),
91
91
  ...props
92
92
  }
93
93
  ));
@@ -38,7 +38,7 @@ var TogglePrimitive = __toESM(require("@radix-ui/react-toggle"));
38
38
  var import_class_variance_authority = require("class-variance-authority");
39
39
  var import_utils = require("../utils.js");
40
40
  const toggleVariants = (0, import_class_variance_authority.cva)(
41
- "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium ring-offset-[var(--axis-surface-default)] transition-colors hover:bg-[var(--axis-surface-secondary)] hover:text-[var(--axis-text-secondary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--axis-border-focus)] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-[var(--axis-surface-secondary)] data-[state=on]:text-[var(--axis-text-primary)] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
41
+ "inline-flex items-center justify-center gap-2 rounded-[var(--axis-radius-control,0.375rem)] text-sm font-medium ring-offset-[var(--axis-surface-default)] transition-colors hover:bg-[var(--axis-surface-secondary)] hover:text-[var(--axis-text-secondary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--axis-border-focus)] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-[var(--axis-surface-secondary)] data-[state=on]:text-[var(--axis-text-primary)] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
42
42
  {
43
43
  variants: {
44
44
  variant: {
@@ -46,9 +46,9 @@ const toggleVariants = (0, import_class_variance_authority.cva)(
46
46
  outline: "border border-[var(--axis-border-default)] bg-transparent hover:bg-[var(--axis-surface-secondary)] hover:text-[var(--axis-text-primary)]"
47
47
  },
48
48
  size: {
49
- default: "h-10 px-3 min-w-10",
50
- sm: "h-9 px-2.5 min-w-9",
51
- lg: "h-11 px-5 min-w-11"
49
+ default: "h-[var(--axis-toggle-h-md,2.5rem)] px-3 min-w-[var(--axis-toggle-h-md,2.5rem)]",
50
+ sm: "h-[var(--axis-toggle-h-sm,2.25rem)] px-2.5 min-w-[var(--axis-toggle-h-sm,2.25rem)]",
51
+ lg: "h-[var(--axis-toggle-h-lg,2.75rem)] px-5 min-w-[var(--axis-toggle-h-lg,2.75rem)]"
52
52
  }
53
53
  },
54
54
  defaultVariants: {
@@ -4,7 +4,7 @@ import * as TogglePrimitive from "@radix-ui/react-toggle";
4
4
  import { cva } from "class-variance-authority";
5
5
  import { cn } from "../utils.mjs";
6
6
  const toggleVariants = cva(
7
- "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium ring-offset-[var(--axis-surface-default)] transition-colors hover:bg-[var(--axis-surface-secondary)] hover:text-[var(--axis-text-secondary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--axis-border-focus)] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-[var(--axis-surface-secondary)] data-[state=on]:text-[var(--axis-text-primary)] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
7
+ "inline-flex items-center justify-center gap-2 rounded-[var(--axis-radius-control,0.375rem)] text-sm font-medium ring-offset-[var(--axis-surface-default)] transition-colors hover:bg-[var(--axis-surface-secondary)] hover:text-[var(--axis-text-secondary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--axis-border-focus)] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-[var(--axis-surface-secondary)] data-[state=on]:text-[var(--axis-text-primary)] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
8
8
  {
9
9
  variants: {
10
10
  variant: {
@@ -12,9 +12,9 @@ const toggleVariants = cva(
12
12
  outline: "border border-[var(--axis-border-default)] bg-transparent hover:bg-[var(--axis-surface-secondary)] hover:text-[var(--axis-text-primary)]"
13
13
  },
14
14
  size: {
15
- default: "h-10 px-3 min-w-10",
16
- sm: "h-9 px-2.5 min-w-9",
17
- lg: "h-11 px-5 min-w-11"
15
+ default: "h-[var(--axis-toggle-h-md,2.5rem)] px-3 min-w-[var(--axis-toggle-h-md,2.5rem)]",
16
+ sm: "h-[var(--axis-toggle-h-sm,2.25rem)] px-2.5 min-w-[var(--axis-toggle-h-sm,2.25rem)]",
17
+ lg: "h-[var(--axis-toggle-h-lg,2.75rem)] px-5 min-w-[var(--axis-toggle-h-lg,2.75rem)]"
18
18
  }
19
19
  },
20
20
  defaultVariants: {
@@ -1,12 +1,25 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import * as React from 'react';
2
3
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
3
4
 
4
5
  /** 툴팁 시스템의 프로바이더 컴포넌트. delayDuration 등 전역 설정을 관리한다. */
5
6
  declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
6
- /** 툴팁의 루트 컴포넌트. 열림/닫힘 상태를 관리한다. */
7
- declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
7
+ type TooltipProps = React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Root>;
8
+ /**
9
+ * 툴팁의 루트 컴포넌트. 열림/닫힘 상태를 관리한다.
10
+ *
11
+ * Radix Tooltip 은 트리거를 담은 요소가 스크롤되면 닫힌다. 화면 밖 트리거로 Tab 하면 브라우저가 트리거를
12
+ * 화면 안으로 스크롤하고, 그 스크롤이 막 열린 툴팁을 닫는다(WCAG 1.4.13 지속성, WI-0073).
13
+ * 이 래퍼는 open 을 직접 제어해 **트리거에 포커스가 있는 동안 스크롤로 생긴 닫힘**만 무시한다.
14
+ * Esc · 포인터 이탈 · 블러 · 클릭 · 포커스 없는 hover 툴팁의 스크롤 닫힘은 Radix 동작 그대로다.
15
+ * open · defaultOpen · onOpenChange 는 그대로 통과한다(제어 · 비제어 모두).
16
+ */
17
+ declare function Tooltip({ open: openProp, defaultOpen, onOpenChange, ...props }: TooltipProps): react_jsx_runtime.JSX.Element;
18
+ declare namespace Tooltip {
19
+ var displayName: string;
20
+ }
8
21
  /** 툴팁을 표시하기 위한 트리거 요소 */
9
- declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
22
+ declare const TooltipTrigger: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
10
23
  /** 툴팁의 콘텐츠를 표시하는 컴포넌트. 포탈을 통해 렌더링되며 방향별 슬라이드 애니메이션을 지원한다. */
11
24
  declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
12
25
 
@@ -1,12 +1,25 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import * as React from 'react';
2
3
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
3
4
 
4
5
  /** 툴팁 시스템의 프로바이더 컴포넌트. delayDuration 등 전역 설정을 관리한다. */
5
6
  declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
6
- /** 툴팁의 루트 컴포넌트. 열림/닫힘 상태를 관리한다. */
7
- declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
7
+ type TooltipProps = React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Root>;
8
+ /**
9
+ * 툴팁의 루트 컴포넌트. 열림/닫힘 상태를 관리한다.
10
+ *
11
+ * Radix Tooltip 은 트리거를 담은 요소가 스크롤되면 닫힌다. 화면 밖 트리거로 Tab 하면 브라우저가 트리거를
12
+ * 화면 안으로 스크롤하고, 그 스크롤이 막 열린 툴팁을 닫는다(WCAG 1.4.13 지속성, WI-0073).
13
+ * 이 래퍼는 open 을 직접 제어해 **트리거에 포커스가 있는 동안 스크롤로 생긴 닫힘**만 무시한다.
14
+ * Esc · 포인터 이탈 · 블러 · 클릭 · 포커스 없는 hover 툴팁의 스크롤 닫힘은 Radix 동작 그대로다.
15
+ * open · defaultOpen · onOpenChange 는 그대로 통과한다(제어 · 비제어 모두).
16
+ */
17
+ declare function Tooltip({ open: openProp, defaultOpen, onOpenChange, ...props }: TooltipProps): react_jsx_runtime.JSX.Element;
18
+ declare namespace Tooltip {
19
+ var displayName: string;
20
+ }
8
21
  /** 툴팁을 표시하기 위한 트리거 요소 */
9
- declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
22
+ declare const TooltipTrigger: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
10
23
  /** 툴팁의 콘텐츠를 표시하는 컴포넌트. 포탈을 통해 렌더링되며 방향별 슬라이드 애니메이션을 지원한다. */
11
24
  declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
12
25
 
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -39,25 +40,92 @@ var React = __toESM(require("react"));
39
40
  var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
40
41
  var import_utils = require("../utils.js");
41
42
  const TooltipProvider = TooltipPrimitive.Provider;
42
- const Tooltip = TooltipPrimitive.Root;
43
- const TooltipTrigger = TooltipPrimitive.Trigger;
44
- const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
45
- TooltipPrimitive.Content,
46
- {
47
- ref,
48
- sideOffset,
49
- className: (0, import_utils.cn)(
50
- "z-50 overflow-hidden rounded-md bg-[var(--axis-surface-inverse)] px-3 py-1.5 text-xs text-[var(--axis-text-inverse)]",
51
- "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 motion-reduce:!animate-none",
52
- "data-[side=bottom]:slide-in-from-top-2",
53
- "data-[side=left]:slide-in-from-right-2",
54
- "data-[side=right]:slide-in-from-left-2",
55
- "data-[side=top]:slide-in-from-bottom-2",
56
- className
57
- ),
58
- ...props
59
- }
60
- ) }));
43
+ const TooltipPersistenceContext = React.createContext(null);
44
+ const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
45
+ function Tooltip({ open: openProp, defaultOpen, onOpenChange, ...props }) {
46
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? false);
47
+ const isControlled = openProp !== void 0;
48
+ const open = isControlled ? openProp : uncontrolledOpen;
49
+ const triggerRef = React.useRef(null);
50
+ const scrollingRef = React.useRef(false);
51
+ const dismissRef = React.useRef(false);
52
+ useIsomorphicLayoutEffect(() => {
53
+ let timer = 0;
54
+ const handleScroll = () => {
55
+ scrollingRef.current = true;
56
+ window.clearTimeout(timer);
57
+ timer = window.setTimeout(() => {
58
+ scrollingRef.current = false;
59
+ }, 0);
60
+ };
61
+ window.addEventListener("scroll", handleScroll, { capture: true });
62
+ return () => {
63
+ window.removeEventListener("scroll", handleScroll, { capture: true });
64
+ window.clearTimeout(timer);
65
+ };
66
+ }, []);
67
+ const handleOpenChange = React.useCallback(
68
+ (next) => {
69
+ if (!next) {
70
+ const dismissed = dismissRef.current;
71
+ dismissRef.current = false;
72
+ const trigger = triggerRef.current;
73
+ const focused = trigger !== null && trigger.ownerDocument.activeElement === trigger;
74
+ if (!dismissed && scrollingRef.current && focused) return;
75
+ }
76
+ if (!isControlled) setUncontrolledOpen(next);
77
+ onOpenChange?.(next);
78
+ },
79
+ [isControlled, onOpenChange]
80
+ );
81
+ const markDismiss = React.useCallback(() => {
82
+ dismissRef.current = true;
83
+ }, []);
84
+ const contextValue = React.useMemo(() => ({ triggerRef, markDismiss }), [markDismiss]);
85
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPersistenceContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Root, { ...props, open, onOpenChange: handleOpenChange }) });
86
+ }
87
+ Tooltip.displayName = "Tooltip";
88
+ const TooltipTrigger = React.forwardRef((props, forwardedRef) => {
89
+ const persistence = React.useContext(TooltipPersistenceContext);
90
+ const ref = React.useCallback(
91
+ (node) => {
92
+ if (persistence) persistence.triggerRef.current = node;
93
+ if (typeof forwardedRef === "function") forwardedRef(node);
94
+ else if (forwardedRef) forwardedRef.current = node;
95
+ },
96
+ [persistence, forwardedRef]
97
+ );
98
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Trigger, { ref, ...props });
99
+ });
100
+ TooltipTrigger.displayName = "TooltipTrigger";
101
+ const TooltipContent = React.forwardRef(({ className, sideOffset = 4, onEscapeKeyDown, onPointerDownOutside, ...props }, ref) => {
102
+ const persistence = React.useContext(TooltipPersistenceContext);
103
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
104
+ TooltipPrimitive.Content,
105
+ {
106
+ ref,
107
+ sideOffset,
108
+ onEscapeKeyDown: (event) => {
109
+ onEscapeKeyDown?.(event);
110
+ if (!event.defaultPrevented) persistence?.markDismiss();
111
+ },
112
+ onPointerDownOutside: (event) => {
113
+ onPointerDownOutside?.(event);
114
+ if (!event.defaultPrevented) persistence?.markDismiss();
115
+ },
116
+ className: (0, import_utils.cn)(
117
+ "z-50 overflow-hidden rounded-md bg-[var(--axis-surface-inverse)] px-3 py-1.5 text-xs text-[var(--axis-text-inverse)]",
118
+ "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 motion-reduce:!animate-none",
119
+ "data-[side=bottom]:slide-in-from-top-2",
120
+ "data-[side=left]:slide-in-from-right-2",
121
+ "data-[side=right]:slide-in-from-left-2",
122
+ "data-[side=top]:slide-in-from-bottom-2",
123
+ className
124
+ ),
125
+ ...props
126
+ }
127
+ ) });
128
+ });
61
129
  TooltipContent.displayName = "TooltipContent";
62
130
  // Annotate the CommonJS export names for ESM import in node:
63
131
  0 && (module.exports = {
@@ -1,27 +1,95 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import * as React from "react";
3
4
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
4
5
  import { cn } from "../utils.mjs";
5
6
  const TooltipProvider = TooltipPrimitive.Provider;
6
- const Tooltip = TooltipPrimitive.Root;
7
- const TooltipTrigger = TooltipPrimitive.Trigger;
8
- const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
9
- TooltipPrimitive.Content,
10
- {
11
- ref,
12
- sideOffset,
13
- className: cn(
14
- "z-50 overflow-hidden rounded-md bg-[var(--axis-surface-inverse)] px-3 py-1.5 text-xs text-[var(--axis-text-inverse)]",
15
- "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 motion-reduce:!animate-none",
16
- "data-[side=bottom]:slide-in-from-top-2",
17
- "data-[side=left]:slide-in-from-right-2",
18
- "data-[side=right]:slide-in-from-left-2",
19
- "data-[side=top]:slide-in-from-bottom-2",
20
- className
21
- ),
22
- ...props
23
- }
24
- ) }));
7
+ const TooltipPersistenceContext = React.createContext(null);
8
+ const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
9
+ function Tooltip({ open: openProp, defaultOpen, onOpenChange, ...props }) {
10
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? false);
11
+ const isControlled = openProp !== void 0;
12
+ const open = isControlled ? openProp : uncontrolledOpen;
13
+ const triggerRef = React.useRef(null);
14
+ const scrollingRef = React.useRef(false);
15
+ const dismissRef = React.useRef(false);
16
+ useIsomorphicLayoutEffect(() => {
17
+ let timer = 0;
18
+ const handleScroll = () => {
19
+ scrollingRef.current = true;
20
+ window.clearTimeout(timer);
21
+ timer = window.setTimeout(() => {
22
+ scrollingRef.current = false;
23
+ }, 0);
24
+ };
25
+ window.addEventListener("scroll", handleScroll, { capture: true });
26
+ return () => {
27
+ window.removeEventListener("scroll", handleScroll, { capture: true });
28
+ window.clearTimeout(timer);
29
+ };
30
+ }, []);
31
+ const handleOpenChange = React.useCallback(
32
+ (next) => {
33
+ if (!next) {
34
+ const dismissed = dismissRef.current;
35
+ dismissRef.current = false;
36
+ const trigger = triggerRef.current;
37
+ const focused = trigger !== null && trigger.ownerDocument.activeElement === trigger;
38
+ if (!dismissed && scrollingRef.current && focused) return;
39
+ }
40
+ if (!isControlled) setUncontrolledOpen(next);
41
+ onOpenChange?.(next);
42
+ },
43
+ [isControlled, onOpenChange]
44
+ );
45
+ const markDismiss = React.useCallback(() => {
46
+ dismissRef.current = true;
47
+ }, []);
48
+ const contextValue = React.useMemo(() => ({ triggerRef, markDismiss }), [markDismiss]);
49
+ return /* @__PURE__ */ jsx(TooltipPersistenceContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { ...props, open, onOpenChange: handleOpenChange }) });
50
+ }
51
+ Tooltip.displayName = "Tooltip";
52
+ const TooltipTrigger = React.forwardRef((props, forwardedRef) => {
53
+ const persistence = React.useContext(TooltipPersistenceContext);
54
+ const ref = React.useCallback(
55
+ (node) => {
56
+ if (persistence) persistence.triggerRef.current = node;
57
+ if (typeof forwardedRef === "function") forwardedRef(node);
58
+ else if (forwardedRef) forwardedRef.current = node;
59
+ },
60
+ [persistence, forwardedRef]
61
+ );
62
+ return /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { ref, ...props });
63
+ });
64
+ TooltipTrigger.displayName = "TooltipTrigger";
65
+ const TooltipContent = React.forwardRef(({ className, sideOffset = 4, onEscapeKeyDown, onPointerDownOutside, ...props }, ref) => {
66
+ const persistence = React.useContext(TooltipPersistenceContext);
67
+ return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
68
+ TooltipPrimitive.Content,
69
+ {
70
+ ref,
71
+ sideOffset,
72
+ onEscapeKeyDown: (event) => {
73
+ onEscapeKeyDown?.(event);
74
+ if (!event.defaultPrevented) persistence?.markDismiss();
75
+ },
76
+ onPointerDownOutside: (event) => {
77
+ onPointerDownOutside?.(event);
78
+ if (!event.defaultPrevented) persistence?.markDismiss();
79
+ },
80
+ className: cn(
81
+ "z-50 overflow-hidden rounded-md bg-[var(--axis-surface-inverse)] px-3 py-1.5 text-xs text-[var(--axis-text-inverse)]",
82
+ "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 motion-reduce:!animate-none",
83
+ "data-[side=bottom]:slide-in-from-top-2",
84
+ "data-[side=left]:slide-in-from-right-2",
85
+ "data-[side=right]:slide-in-from-left-2",
86
+ "data-[side=top]:slide-in-from-bottom-2",
87
+ className
88
+ ),
89
+ ...props
90
+ }
91
+ ) });
92
+ });
25
93
  TooltipContent.displayName = "TooltipContent";
26
94
  export {
27
95
  Tooltip,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axis-ds/ui-react",
3
- "version": "1.6.3",
3
+ "version": "1.8.0",
4
4
  "description": "AXIS Design System - Core React UI Components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -302,7 +302,7 @@
302
302
  "clsx": "^2.1.0",
303
303
  "cmdk": "^1.1.1",
304
304
  "tailwind-merge": "^2.5.0",
305
- "@axis-ds/tokens": "1.6.2"
305
+ "@axis-ds/tokens": "1.8.0"
306
306
  },
307
307
  "devDependencies": {
308
308
  "@testing-library/jest-dom": "^6.9.1",