@tide-design/components 0.17.0 → 0.18.1
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.
- package/dist/Checkbox/Checkbox.js +15 -16
- package/dist/Checkbox/components/CheckboxMark.js +35 -0
- package/dist/Checkbox/constants/checkboxClass.js +15 -5
- package/dist/Dialog/components/DialogCloseButton.js +23 -0
- package/dist/Dialog/components/DialogContentInner.js +13 -11
- package/dist/Dialog/components/DialogHeader.d.ts +13 -0
- package/dist/Dialog/components/DialogHeader.js +34 -0
- package/dist/Dialog/components/DialogTitle.d.ts +1 -1
- package/dist/Dialog/components/DialogTitle.js +3 -3
- package/dist/Dialog/index.d.ts +2 -1
- package/dist/Radio/Radio.js +2 -2
- package/dist/Radio/constants/radioClass.js +6 -1
- package/dist/Tabs/Tabs.d.ts +6 -4
- package/dist/Tabs/Tabs.js +6 -3
- package/dist/Tabs/components/TabIndicator.js +15 -0
- package/dist/Tabs/components/TabList.js +14 -6
- package/dist/Tabs/components/TabView.js +2 -2
- package/dist/Tabs/constants/tabsClass.js +32 -9
- package/dist/Tabs/hooks/useTabIndicator.js +59 -0
- package/dist/Tabs/index.d.ts +2 -2
- package/dist/Tabs/types.d.ts +2 -0
- package/dist/_internal/constants/choiceClass.js +5 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/package.json +3 -3
|
@@ -3,21 +3,17 @@
|
|
|
3
3
|
import { CheckboxGroupContext } from "../_internal/hooks/useChoiceGroup.js";
|
|
4
4
|
import { choiceAreaClass, choiceInputClass, choiceMarkClass, choiceRootClass, choiceTextClass } from "../_internal/constants/choiceClass.js";
|
|
5
5
|
import { cn } from "../_internal/libs/cn.js";
|
|
6
|
-
import { checkboxInputStateClass, checkboxMarkClass } from "./constants/checkboxClass.js";
|
|
6
|
+
import { checkboxFillClass, checkboxInputStateClass, checkboxMarkClass, checkboxMarkShownClass } from "./constants/checkboxClass.js";
|
|
7
|
+
import { CheckboxMark } from "./components/CheckboxMark.js";
|
|
7
8
|
import { useFieldControl } from "../_internal/hooks/useFieldControl.js";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { use, useImperativeHandle, useLayoutEffect, useRef } from "react";
|
|
10
|
-
import { CheckIcon, MinusIcon } from "@tide-design/icons";
|
|
11
11
|
|
|
12
12
|
// src/Checkbox/Checkbox.tsx
|
|
13
13
|
const boxClass = {
|
|
14
14
|
sm: "size-4 rounded-sm",
|
|
15
15
|
md: "size-5 rounded-sm"
|
|
16
16
|
};
|
|
17
|
-
const iconSize = {
|
|
18
|
-
sm: 12,
|
|
19
|
-
md: 16
|
|
20
|
-
};
|
|
21
17
|
/**
|
|
22
18
|
* 네이티브 체크박스. 여러 개를 묶어 이름·설명·오류를 붙이려면 `Field group` 안의 `CheckboxGroup`에 둔다.
|
|
23
19
|
* Tide props: `children`, `size`, `color`, `indeterminate`, `invalid`, `className`, `style` ({@link CheckboxOwnProps}). 나머지는 `<input>` 속성.
|
|
@@ -53,17 +49,20 @@ function Checkbox({ children, size = "md", color = "primary", indeterminate = fa
|
|
|
53
49
|
type: "checkbox",
|
|
54
50
|
className: cn(boxClass[size], choiceInputClass, checkboxInputStateClass)
|
|
55
51
|
}),
|
|
56
|
-
/* @__PURE__ */ jsx(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
/* @__PURE__ */ jsx("span", {
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
"data-fill": "",
|
|
55
|
+
className: cn(boxClass[size], checkboxFillClass)
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx(CheckboxMark, {
|
|
58
|
+
kind: "check",
|
|
59
|
+
size,
|
|
60
|
+
className: cn(choiceMarkClass, checkboxMarkClass, checkboxMarkShownClass.check)
|
|
61
61
|
}),
|
|
62
|
-
/* @__PURE__ */ jsx(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
className: cn(choiceMarkClass, checkboxMarkClass, "peer-indeterminate:block")
|
|
62
|
+
/* @__PURE__ */ jsx(CheckboxMark, {
|
|
63
|
+
kind: "indeterminate",
|
|
64
|
+
size,
|
|
65
|
+
className: cn(choiceMarkClass, checkboxMarkClass, checkboxMarkShownClass.indeterminate)
|
|
67
66
|
})
|
|
68
67
|
]
|
|
69
68
|
}), children === void 0 || children === null ? null : /* @__PURE__ */ jsx("span", { children })]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
// src/Checkbox/components/CheckboxMark.tsx
|
|
4
|
+
const pathData = {
|
|
5
|
+
check: "M20 6 9 17l-5-5",
|
|
6
|
+
indeterminate: "M5 12h14"
|
|
7
|
+
};
|
|
8
|
+
const pixelSize = {
|
|
9
|
+
sm: 12,
|
|
10
|
+
md: 16
|
|
11
|
+
};
|
|
12
|
+
/** 그려지는 체크 표시. 상태는 input이 보조 기술에 알려 장식으로 숨긴다. */
|
|
13
|
+
function CheckboxMark({ kind, size, className }) {
|
|
14
|
+
const px = pixelSize[size];
|
|
15
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
focusable: "false",
|
|
18
|
+
"data-mark": kind,
|
|
19
|
+
width: px,
|
|
20
|
+
height: px,
|
|
21
|
+
viewBox: "0 0 24 24",
|
|
22
|
+
fill: "none",
|
|
23
|
+
stroke: "currentColor",
|
|
24
|
+
strokeWidth: 48 / px,
|
|
25
|
+
strokeLinecap: "round",
|
|
26
|
+
strokeLinejoin: "round",
|
|
27
|
+
className,
|
|
28
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
29
|
+
d: pathData[kind],
|
|
30
|
+
pathLength: 1
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { CheckboxMark };
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
// src/Checkbox/constants/checkboxClass.ts
|
|
2
|
-
/** 체크·indeterminate
|
|
3
|
-
const checkboxInputStateClass = "checked:border-accent
|
|
4
|
-
/**
|
|
5
|
-
|
|
2
|
+
/** 체크 전 hover·누름은 subtle 바탕이다. 체크·indeterminate 채움은 채움 레이어가 맡고, forced-colors에서만 input이 칠한다. */
|
|
3
|
+
const checkboxInputStateClass = "checked:border-accent indeterminate:border-accent enabled:not-checked:not-indeterminate:group-hover/choice:bg-accent-subtle enabled:not-checked:not-indeterminate:group-active/choice:bg-accent-subtle-active forced-colors:enabled:checked:bg-accent-solid forced-colors:enabled:indeterminate:bg-accent-solid";
|
|
4
|
+
/**
|
|
5
|
+
* 체크·indeterminate 채움. input과 같은 크기라 테두리까지 덮는다. opacity와 scale이 함께 fast로 바뀐다.
|
|
6
|
+
* 비활성·forced-colors에서는 숨고 input 바탕이 그 색을 맡는다. 오류 색은 input의 변수가 닿지 않아 다시 적는다(ADR 0035).
|
|
7
|
+
*/
|
|
8
|
+
const checkboxFillClass = "pointer-events-none col-start-1 row-start-1 bg-accent-solid opacity-0 transition-[opacity,background-color] group-hover/choice:bg-accent-solid-hover group-active/choice:bg-accent-solid-active peer-checked:opacity-100 peer-indeterminate:opacity-100 motion-safe:scale-70 motion-safe:transition-[opacity,scale,background-color] motion-safe:peer-checked:scale-100 motion-safe:peer-indeterminate:scale-100 peer-aria-invalid:[--tide-accent-solid:var(--tide-bg-danger-solid)] peer-aria-invalid:[--tide-accent-solid-hover:var(--tide-bg-danger-solid-hover)] peer-aria-invalid:[--tide-accent-solid-active:var(--tide-bg-danger-solid-active)] peer-disabled:hidden forced-colors:hidden";
|
|
9
|
+
/** solid 위 흰 표시. 숨을 때는 지연 없이 fast로 거꾸로 지워지며 사라진다. dash는 svg에 두고 path가 물려받는다. */
|
|
10
|
+
const checkboxMarkClass = "relative text-accent-on-solid forced-colors:[--tide-accent-on-solid:HighlightText] motion-safe:[stroke-dasharray:1] motion-safe:[stroke-dashoffset:1] motion-safe:transition-[opacity,stroke-dashoffset]";
|
|
11
|
+
/** 보이는 조건과 그리기. 채움이 찬 뒤(fast 지연) opacity와 dash가 fast로 함께 바뀐다. */
|
|
12
|
+
const checkboxMarkShownClass = {
|
|
13
|
+
check: "peer-checked:peer-not-indeterminate:opacity-100 motion-safe:peer-checked:peer-not-indeterminate:[stroke-dashoffset:0] motion-safe:peer-checked:peer-not-indeterminate:duration-fast motion-safe:peer-checked:peer-not-indeterminate:delay-(--tide-duration-fast)",
|
|
14
|
+
indeterminate: "peer-indeterminate:opacity-100 motion-safe:peer-indeterminate:[stroke-dashoffset:0] motion-safe:peer-indeterminate:duration-fast motion-safe:peer-indeterminate:delay-(--tide-duration-fast)"
|
|
15
|
+
};
|
|
6
16
|
|
|
7
|
-
export { checkboxInputStateClass, checkboxMarkClass };
|
|
17
|
+
export { checkboxFillClass, checkboxInputStateClass, checkboxMarkClass, checkboxMarkShownClass };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useDialogContext } from "../../_internal/hooks/useDialogContext.js";
|
|
4
|
+
import { IconButton } from "../../IconButton/IconButton.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { XIcon } from "@tide-design/icons";
|
|
7
|
+
|
|
8
|
+
// src/Dialog/components/DialogCloseButton.tsx
|
|
9
|
+
/** Dialog 끝 위쪽의 아이콘 닫기 버튼. */
|
|
10
|
+
function DialogCloseButton({ label, className }) {
|
|
11
|
+
const { state } = useDialogContext("DialogCloseButton");
|
|
12
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
13
|
+
"aria-label": label,
|
|
14
|
+
variant: "ghost",
|
|
15
|
+
color: "neutral",
|
|
16
|
+
size: "sm",
|
|
17
|
+
onClick: state.close,
|
|
18
|
+
className,
|
|
19
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { DialogCloseButton };
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { useOverlayTheme } from "../../_internal/hooks/useOverlayTheme.js";
|
|
4
4
|
import { cn } from "../../_internal/libs/cn.js";
|
|
5
|
-
import { IconButton } from "../../IconButton/IconButton.js";
|
|
6
5
|
import { backdropClass, contentClass, sizeClass } from "../constants/dialogClass.js";
|
|
7
6
|
import { DialogPartsContext } from "../hooks/useDialogPartsContext.js";
|
|
7
|
+
import { DialogCloseButton } from "./DialogCloseButton.js";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
10
|
-
import { XIcon } from "@tide-design/icons";
|
|
11
10
|
import { mergeProps, mergeRefs, useDialog, useFocusManager, useModalOverlay } from "react-aria";
|
|
12
11
|
|
|
13
12
|
// src/Dialog/components/DialogContentInner.tsx
|
|
@@ -17,6 +16,7 @@ function DialogContentInner({ context, backdropRef, size = "md", closeLabel = "
|
|
|
17
16
|
const dialogRef = useRef(null);
|
|
18
17
|
const [titleId, setTitleId] = useState(null);
|
|
19
18
|
const [descriptionId, setDescriptionId] = useState(null);
|
|
19
|
+
const [hasHeader, setHasHeader] = useState(false);
|
|
20
20
|
useOverlayTheme(triggerRef, backdropRef);
|
|
21
21
|
const { modalProps, underlayProps } = useModalOverlay({ isDismissable: !alert }, state, dialogRef);
|
|
22
22
|
const labelledBy = props["aria-labelledby"] ?? (props["aria-label"] ? void 0 : titleId ?? triggerId ?? void 0);
|
|
@@ -34,9 +34,16 @@ function DialogContentInner({ context, backdropRef, size = "md", closeLabel = "
|
|
|
34
34
|
const mergedRef = useMemo(() => mergeRefs(ref, dialogRef), [ref]);
|
|
35
35
|
const parts = useMemo(() => ({
|
|
36
36
|
alert,
|
|
37
|
+
closeLabel,
|
|
38
|
+
hasHeader,
|
|
39
|
+
setHasHeader,
|
|
37
40
|
setTitleId,
|
|
38
41
|
setDescriptionId
|
|
39
|
-
}), [
|
|
42
|
+
}), [
|
|
43
|
+
alert,
|
|
44
|
+
closeLabel,
|
|
45
|
+
hasHeader
|
|
46
|
+
]);
|
|
40
47
|
const open = state.isOpen ? "" : void 0;
|
|
41
48
|
return /* @__PURE__ */ jsx("div", {
|
|
42
49
|
...underlayProps,
|
|
@@ -52,14 +59,9 @@ function DialogContentInner({ context, backdropRef, size = "md", closeLabel = "
|
|
|
52
59
|
children: [/* @__PURE__ */ jsx(DialogPartsContext, {
|
|
53
60
|
value: parts,
|
|
54
61
|
children
|
|
55
|
-
}), !alert && /* @__PURE__ */ jsx(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
color: "neutral",
|
|
59
|
-
size: "sm",
|
|
60
|
-
onClick: state.close,
|
|
61
|
-
className: "absolute end-5 top-5",
|
|
62
|
-
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
62
|
+
}), !alert && !hasHeader && /* @__PURE__ */ jsx(DialogCloseButton, {
|
|
63
|
+
label: closeLabel,
|
|
64
|
+
className: "absolute end-5 top-5"
|
|
63
65
|
})]
|
|
64
66
|
})
|
|
65
67
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentProps, ReactElement } from "react";
|
|
2
|
+
export type DialogHeaderAlign = "start" | "center";
|
|
3
|
+
export interface DialogHeaderOwnProps {
|
|
4
|
+
/** 닫기 버튼의 세로 정렬. `start`(기본값)는 제목 첫 줄, `center`는 한 줄 내용(입력 등)의 가운데다. */
|
|
5
|
+
align?: DialogHeaderAlign;
|
|
6
|
+
}
|
|
7
|
+
export interface DialogHeaderProps extends DialogHeaderOwnProps, Omit<ComponentProps<"div">, keyof DialogHeaderOwnProps> {}
|
|
8
|
+
/**
|
|
9
|
+
* 제목이나 입력과 닫기 버튼을 한 줄에 놓는 머리. 있으면 `DialogContent`의 기본 닫기 버튼을 대신한다.
|
|
10
|
+
* AlertDialog에서는 닫기 버튼이 없다.
|
|
11
|
+
* Tide props: `align` ({@link DialogHeaderOwnProps}). 나머지는 `<div>` 속성.
|
|
12
|
+
*/
|
|
13
|
+
export declare function DialogHeader({ align, className, children, ...props }: DialogHeaderProps): ReactElement;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../_internal/libs/cn.js";
|
|
4
|
+
import { useDialogPartsContext } from "../hooks/useDialogPartsContext.js";
|
|
5
|
+
import { DialogCloseButton } from "./DialogCloseButton.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useLayoutEffect } from "react";
|
|
8
|
+
|
|
9
|
+
// src/Dialog/components/DialogHeader.tsx
|
|
10
|
+
/**
|
|
11
|
+
* 제목이나 입력과 닫기 버튼을 한 줄에 놓는 머리. 있으면 `DialogContent`의 기본 닫기 버튼을 대신한다.
|
|
12
|
+
* AlertDialog에서는 닫기 버튼이 없다.
|
|
13
|
+
* Tide props: `align` ({@link DialogHeaderOwnProps}). 나머지는 `<div>` 속성.
|
|
14
|
+
*/
|
|
15
|
+
function DialogHeader({ align = "start", className, children, ...props }) {
|
|
16
|
+
const { alert, closeLabel, setHasHeader } = useDialogPartsContext("DialogHeader");
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
setHasHeader(true);
|
|
19
|
+
return () => setHasHeader(false);
|
|
20
|
+
}, [setHasHeader]);
|
|
21
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
...props,
|
|
23
|
+
className: cn("flex gap-3", align === "center" ? "items-center" : "items-start", className),
|
|
24
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: "flex min-w-0 flex-1 flex-col gap-4",
|
|
26
|
+
children
|
|
27
|
+
}), !alert && /* @__PURE__ */ jsx(DialogCloseButton, {
|
|
28
|
+
label: closeLabel,
|
|
29
|
+
className: align === "start" ? "-my-0.5" : "shrink-0"
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { DialogHeader };
|
|
@@ -2,6 +2,6 @@ import { ComponentProps, ReactElement } from "react";
|
|
|
2
2
|
export type DialogTitleProps = ComponentProps<"h2">;
|
|
3
3
|
/**
|
|
4
4
|
* Dialog 제목(`<h2>`, `text-heading-sm`). 있으면 dialog의 `aria-labelledby`가 가리켜 이름이 된다.
|
|
5
|
-
*
|
|
5
|
+
* `DialogHeader` 밖에서는 끝쪽 닫기 버튼과 겹치지 않게 끝 여백(36px)을 둔다.
|
|
6
6
|
*/
|
|
7
7
|
export declare function DialogTitle({ id, className, ...props }: DialogTitleProps): ReactElement;
|
|
@@ -8,15 +8,15 @@ import { jsx } from "react/jsx-runtime";
|
|
|
8
8
|
// src/Dialog/components/DialogTitle.tsx
|
|
9
9
|
/**
|
|
10
10
|
* Dialog 제목(`<h2>`, `text-heading-sm`). 있으면 dialog의 `aria-labelledby`가 가리켜 이름이 된다.
|
|
11
|
-
*
|
|
11
|
+
* `DialogHeader` 밖에서는 끝쪽 닫기 버튼과 겹치지 않게 끝 여백(36px)을 둔다.
|
|
12
12
|
*/
|
|
13
13
|
function DialogTitle({ id, className, ...props }) {
|
|
14
|
-
const { alert, setTitleId } = useDialogPartsContext("DialogTitle");
|
|
14
|
+
const { alert, hasHeader, setTitleId } = useDialogPartsContext("DialogTitle");
|
|
15
15
|
const resolvedId = usePartId(id, setTitleId);
|
|
16
16
|
return /* @__PURE__ */ jsx("h2", {
|
|
17
17
|
...props,
|
|
18
18
|
id: resolvedId,
|
|
19
|
-
className: cn("text-heading-sm text-default", !alert && "pe-9", className)
|
|
19
|
+
className: cn("text-heading-sm text-default", !alert && !hasHeader && "pe-9", className)
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
|
package/dist/Dialog/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ import { Dialog } from "./Dialog.js";
|
|
|
3
3
|
import { DialogTrigger, DialogTriggerOwnProps, DialogTriggerProps } from "./components/DialogTrigger.js";
|
|
4
4
|
import { DialogSize } from "./types.js";
|
|
5
5
|
import { DialogContent, DialogContentOwnProps, DialogContentProps } from "./components/DialogContent.js";
|
|
6
|
+
import { DialogHeader, DialogHeaderAlign, DialogHeaderOwnProps, DialogHeaderProps } from "./components/DialogHeader.js";
|
|
6
7
|
import { DialogTitle, DialogTitleProps } from "./components/DialogTitle.js";
|
|
7
8
|
import { DialogDescription, DialogDescriptionProps } from "./components/DialogDescription.js";
|
|
8
9
|
import { DialogFooter, DialogFooterProps } from "./components/DialogFooter.js";
|
|
9
10
|
import { DialogClose, DialogCloseOwnProps, DialogCloseProps } from "./components/DialogClose.js";
|
|
10
|
-
export { Dialog, DialogClose, type DialogCloseOwnProps, type DialogCloseProps, DialogContent, type DialogContentOwnProps, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, type DialogProps, type DialogSize, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerOwnProps, type DialogTriggerProps };
|
|
11
|
+
export { Dialog, DialogClose, type DialogCloseOwnProps, type DialogCloseProps, DialogContent, type DialogContentOwnProps, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderAlign, type DialogHeaderOwnProps, type DialogHeaderProps, type DialogProps, type DialogSize, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerOwnProps, type DialogTriggerProps };
|
package/dist/Radio/Radio.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { RadioGroupContext } from "../_internal/hooks/useChoiceGroup.js";
|
|
4
4
|
import { choiceAreaClass, choiceInputClass, choiceMarkClass, choiceRootClass, choiceTextClass } from "../_internal/constants/choiceClass.js";
|
|
5
5
|
import { cn } from "../_internal/libs/cn.js";
|
|
6
|
-
import { radioDotClass, radioInputStateClass, radioMarkClass } from "./constants/radioClass.js";
|
|
6
|
+
import { radioDotClass, radioInputStateClass, radioMarkClass, radioMarkShownClass } from "./constants/radioClass.js";
|
|
7
7
|
import { useFieldControl } from "../_internal/hooks/useFieldControl.js";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { use } from "react";
|
|
@@ -52,7 +52,7 @@ function Radio({ value, children, size = "md", color = "primary", invalid, id, d
|
|
|
52
52
|
}), /* @__PURE__ */ jsx("span", {
|
|
53
53
|
"aria-hidden": "true",
|
|
54
54
|
"data-mark": "dot",
|
|
55
|
-
className: cn(choiceMarkClass, radioMarkClass, radioDotClass[size],
|
|
55
|
+
className: cn(choiceMarkClass, radioMarkClass, radioDotClass[size], radioMarkShownClass)
|
|
56
56
|
})]
|
|
57
57
|
}), children === void 0 || children === null ? null : /* @__PURE__ */ jsx("span", { children })]
|
|
58
58
|
});
|
|
@@ -11,5 +11,10 @@ const radioDotClass = {
|
|
|
11
11
|
};
|
|
12
12
|
/** 점은 테두리와 같은 색이다. 오류면 danger, 비활성이면 text-disabled(choiceMarkClass)가 이긴다. */
|
|
13
13
|
const radioMarkClass = "rounded-full bg-current text-(--tide-accent-border) peer-enabled:peer-aria-invalid:text-(--tide-border-danger) forced-colors:[--tide-accent-border:Highlight] forced-colors:[--tide-border-danger:CanvasText]";
|
|
14
|
+
/**
|
|
15
|
+
* 고르면 보인다. 움직임이 허락되면 점이 0에서 살짝 넘쳤다가 자리 잡고(normal), 해제되면 fast·ease-out으로 줄어든다.
|
|
16
|
+
* overshoot 곡선은 Radio만 써서 Token에 두지 않는다. 다른 Component도 쓰면 foundation easing으로 올린다(ADR 0037).
|
|
17
|
+
*/
|
|
18
|
+
const radioMarkShownClass = "peer-checked:opacity-100 motion-safe:scale-0 motion-safe:transition-[opacity,scale] motion-safe:peer-checked:scale-100 motion-safe:peer-checked:duration-normal motion-safe:peer-checked:ease-[cubic-bezier(0.34,1.56,0.64,1)]";
|
|
14
19
|
|
|
15
|
-
export { radioDotClass, radioInputStateClass, radioMarkClass };
|
|
20
|
+
export { radioDotClass, radioInputStateClass, radioMarkClass, radioMarkShownClass };
|
package/dist/Tabs/Tabs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TabsActivationMode, TabsOrientation } from "./types.js";
|
|
1
|
+
import { TabsActivationMode, TabsOrientation, TabsShape } from "./types.js";
|
|
2
2
|
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
3
3
|
type TabsValueProps = {
|
|
4
4
|
/** 고른 탭의 값(제어). 주면 `onValueChange`로 바꾼다. */
|
|
@@ -14,6 +14,8 @@ interface TabsBaseOwnProps {
|
|
|
14
14
|
onValueChange?: (value: string) => void;
|
|
15
15
|
/** 탭 목록의 방향. 기본값은 `horizontal`이다. 세로면 ↓↑로 옮기고 탭 목록이 패널의 시작쪽에 선다. */
|
|
16
16
|
orientation?: TabsOrientation;
|
|
17
|
+
/** 고른 표시의 모양. 기본값 `underline`(밑줄). `box`는 옅은 바탕 위 둥근 사각형이다. 고른 표시는 탭을 바꾸면 새 탭으로 미끄러진다. */
|
|
18
|
+
shape?: TabsShape;
|
|
17
19
|
/** 키보드로 옮기면 바로 고를지(`automatic`, 기본값), Enter·Space로 고를지(`manual`). 패널이 느리면 `manual`. */
|
|
18
20
|
activationMode?: TabsActivationMode;
|
|
19
21
|
/** `TabList` 하나와 `TabPanel`들 */
|
|
@@ -22,9 +24,9 @@ interface TabsBaseOwnProps {
|
|
|
22
24
|
export type TabsOwnProps = TabsBaseOwnProps & TabsValueProps;
|
|
23
25
|
export type TabsProps = TabsOwnProps & Omit<ComponentProps<"div">, keyof TabsOwnProps | "onChange">;
|
|
24
26
|
/**
|
|
25
|
-
* 같은 영역의 여러 패널 중 하나를 고르는 탭 묶음. 루트는 `<div>`이고
|
|
27
|
+
* 같은 영역의 여러 패널 중 하나를 고르는 탭 묶음. 루트는 `<div>`이고 방향·모양이 `data-orientation`·`data-shape`로 붙는다.
|
|
26
28
|
* 안에 `TabList` 하나와 탭마다 `TabPanel`을 둔다.
|
|
27
|
-
* Tide props: `value`, `defaultValue`, `onValueChange`, `orientation`, `activationMode`, `children` ({@link TabsOwnProps}). 나머지는 `<div>` 속성.
|
|
29
|
+
* Tide props: `value`, `defaultValue`, `onValueChange`, `orientation`, `shape`, `activationMode`, `children` ({@link TabsOwnProps}). 나머지는 `<div>` 속성.
|
|
28
30
|
*/
|
|
29
|
-
export declare function Tabs({ value: valueProp, defaultValue, onValueChange, orientation, activationMode, ref, className, children, ...props }: TabsProps): ReactElement;
|
|
31
|
+
export declare function Tabs({ value: valueProp, defaultValue, onValueChange, orientation, shape, activationMode, ref, className, children, ...props }: TabsProps): ReactElement;
|
|
30
32
|
export {};
|
package/dist/Tabs/Tabs.js
CHANGED
|
@@ -10,11 +10,11 @@ import { useCallback, useId, useMemo, useState } from "react";
|
|
|
10
10
|
/** id에 쓸 수 없는 공백을 뺀다(React Aria 탭 id와 같은 규칙). */
|
|
11
11
|
const idPart = (value) => value.replace(/\s+/g, "");
|
|
12
12
|
/**
|
|
13
|
-
* 같은 영역의 여러 패널 중 하나를 고르는 탭 묶음. 루트는 `<div>`이고
|
|
13
|
+
* 같은 영역의 여러 패널 중 하나를 고르는 탭 묶음. 루트는 `<div>`이고 방향·모양이 `data-orientation`·`data-shape`로 붙는다.
|
|
14
14
|
* 안에 `TabList` 하나와 탭마다 `TabPanel`을 둔다.
|
|
15
|
-
* Tide props: `value`, `defaultValue`, `onValueChange`, `orientation`, `activationMode`, `children` ({@link TabsOwnProps}). 나머지는 `<div>` 속성.
|
|
15
|
+
* Tide props: `value`, `defaultValue`, `onValueChange`, `orientation`, `shape`, `activationMode`, `children` ({@link TabsOwnProps}). 나머지는 `<div>` 속성.
|
|
16
16
|
*/
|
|
17
|
-
function Tabs({ value: valueProp, defaultValue, onValueChange, orientation = "horizontal", activationMode = "automatic", ref, className, children, ...props }) {
|
|
17
|
+
function Tabs({ value: valueProp, defaultValue, onValueChange, orientation = "horizontal", shape = "underline", activationMode = "automatic", ref, className, children, ...props }) {
|
|
18
18
|
const [internal, setInternal] = useState(defaultValue ?? "");
|
|
19
19
|
const controlled = valueProp !== void 0;
|
|
20
20
|
const value = controlled ? valueProp : internal;
|
|
@@ -32,6 +32,7 @@ function Tabs({ value: valueProp, defaultValue, onValueChange, orientation = "ho
|
|
|
32
32
|
value,
|
|
33
33
|
setValue,
|
|
34
34
|
orientation,
|
|
35
|
+
shape,
|
|
35
36
|
activationMode,
|
|
36
37
|
tabId: (tab) => `${baseId}-tab-${idPart(tab)}`,
|
|
37
38
|
panelId: (tab) => `${baseId}-tabpanel-${idPart(tab)}`
|
|
@@ -39,6 +40,7 @@ function Tabs({ value: valueProp, defaultValue, onValueChange, orientation = "ho
|
|
|
39
40
|
value,
|
|
40
41
|
setValue,
|
|
41
42
|
orientation,
|
|
43
|
+
shape,
|
|
42
44
|
activationMode,
|
|
43
45
|
baseId
|
|
44
46
|
]);
|
|
@@ -46,6 +48,7 @@ function Tabs({ value: valueProp, defaultValue, onValueChange, orientation = "ho
|
|
|
46
48
|
...props,
|
|
47
49
|
ref,
|
|
48
50
|
"data-orientation": orientation,
|
|
51
|
+
"data-shape": shape,
|
|
49
52
|
className: cn(tabsOrientationClass[orientation], className),
|
|
50
53
|
children: /* @__PURE__ */ jsx(TabsContext, {
|
|
51
54
|
value: context,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { tabIndicatorClass } from "../constants/tabsClass.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
// src/Tabs/components/TabIndicator.tsx
|
|
5
|
+
/** 고른 탭 아래에 놓이는 고른 표시 하나. 자리는 useTabIndicator가 CSS 변수로 적는다. */
|
|
6
|
+
function TabIndicator({ ref, shape, orientation }) {
|
|
7
|
+
return /* @__PURE__ */ jsx("span", {
|
|
8
|
+
ref,
|
|
9
|
+
"aria-hidden": "true",
|
|
10
|
+
"data-indicator": "",
|
|
11
|
+
className: tabIndicatorClass[shape][orientation]
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { TabIndicator };
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../_internal/libs/cn.js";
|
|
4
4
|
import { resolveCollectionChildren } from "../../_internal/libs/listCollection.js";
|
|
5
|
-
import {
|
|
5
|
+
import { tabListClass } from "../constants/tabsClass.js";
|
|
6
|
+
import { useTabIndicator } from "../hooks/useTabIndicator.js";
|
|
6
7
|
import { useTabsContext } from "../hooks/useTabsContext.js";
|
|
8
|
+
import { TabIndicator } from "./TabIndicator.js";
|
|
7
9
|
import { TabView } from "./TabView.js";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
11
|
import { isValidElement, useMemo, useRef } from "react";
|
|
10
12
|
import { mergeProps, mergeRefs, useTabList } from "react-aria";
|
|
11
13
|
import { useTabListState } from "react-stately";
|
|
@@ -19,6 +21,7 @@ import { useTabListState } from "react-stately";
|
|
|
19
21
|
function TabList({ ref, className, children, ...props }) {
|
|
20
22
|
const context = useTabsContext("TabList");
|
|
21
23
|
const listRef = useRef(null);
|
|
24
|
+
const indicatorRef = useRef(null);
|
|
22
25
|
const items = useMemo(() => resolveCollectionChildren(children), [children]);
|
|
23
26
|
const known = items.some((item) => isValidElement(item) && item.props.value === context.value);
|
|
24
27
|
const state = useTabListState({
|
|
@@ -33,15 +36,20 @@ function TabList({ ref, className, children, ...props }) {
|
|
|
33
36
|
"aria-labelledby": props["aria-labelledby"]
|
|
34
37
|
}, state, listRef);
|
|
35
38
|
const mergedRef = useMemo(() => mergeRefs(ref, listRef), [ref, listRef]);
|
|
36
|
-
|
|
39
|
+
useTabIndicator(listRef, indicatorRef);
|
|
40
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
37
41
|
...mergeProps(props, tabListProps),
|
|
38
42
|
ref: mergedRef,
|
|
39
|
-
className: cn(
|
|
40
|
-
children: [
|
|
43
|
+
className: cn(tabListClass[context.shape][context.orientation], className),
|
|
44
|
+
children: [/* @__PURE__ */ jsx(TabIndicator, {
|
|
45
|
+
ref: indicatorRef,
|
|
46
|
+
shape: context.shape,
|
|
47
|
+
orientation: context.orientation
|
|
48
|
+
}), [...state.collection].map((node) => /* @__PURE__ */ jsx(TabView, {
|
|
41
49
|
node,
|
|
42
50
|
state,
|
|
43
51
|
context
|
|
44
|
-
}, node.key))
|
|
52
|
+
}, node.key))]
|
|
45
53
|
});
|
|
46
54
|
}
|
|
47
55
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../_internal/libs/cn.js";
|
|
4
|
-
import { tabBaseClass,
|
|
4
|
+
import { tabBaseClass, tabFallbackClass } from "../constants/tabsClass.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { useMemo, useRef } from "react";
|
|
7
7
|
import { mergeProps, mergeRefs, useTab } from "react-aria";
|
|
@@ -21,7 +21,7 @@ function TabView({ node, state, context }) {
|
|
|
21
21
|
"aria-controls": isSelected ? context.panelId(value) : void 0,
|
|
22
22
|
disabled: isDisabled || void 0,
|
|
23
23
|
"data-selected": isSelected ? "" : void 0,
|
|
24
|
-
className: cn(tabBaseClass,
|
|
24
|
+
className: cn(tabBaseClass, tabFallbackClass[context.shape][context.orientation], className),
|
|
25
25
|
children: node.rendered
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -3,21 +3,44 @@ const tabsOrientationClass = {
|
|
|
3
3
|
horizontal: "flex flex-col gap-4",
|
|
4
4
|
vertical: "flex flex-row gap-6"
|
|
5
5
|
};
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const unmeasuredFallback = "[&:not([data-measured])>[data-selected]]:after:opacity-100";
|
|
7
|
+
const tabListClass = {
|
|
8
|
+
underline: {
|
|
9
|
+
horizontal: `relative flex shrink-0 gap-1 border-b border-default ${unmeasuredFallback}`,
|
|
10
|
+
vertical: `relative flex shrink-0 flex-col gap-1 border-e border-default ${unmeasuredFallback}`
|
|
11
|
+
},
|
|
12
|
+
box: {
|
|
13
|
+
horizontal: `relative flex shrink-0 gap-1 self-start rounded-lg bg-inset p-1 [&:not([data-measured])>[data-selected]]:bg-surface [&:not([data-measured])>[data-selected]]:shadow-sm ${unmeasuredFallback}`,
|
|
14
|
+
vertical: `relative flex shrink-0 flex-col gap-1 self-start rounded-lg bg-inset p-1 [&:not([data-measured])>[data-selected]]:bg-surface [&:not([data-measured])>[data-selected]]:shadow-sm ${unmeasuredFallback}`
|
|
15
|
+
}
|
|
9
16
|
};
|
|
10
17
|
const tabBaseClass = [
|
|
11
18
|
"relative flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-label-md whitespace-nowrap text-muted outline-none select-none [&>svg]:size-4 [&>svg]:shrink-0",
|
|
12
19
|
"hover:not-data-selected:enabled:text-default data-selected:text-primary focus-visible:focus-ring",
|
|
13
20
|
"disabled:cursor-not-allowed disabled:text-disabled",
|
|
14
|
-
"after:pointer-events-none after:absolute after:
|
|
15
|
-
"forced-colors:after:forced-color-adjust-none forced-colors:after:border-[Highlight]"
|
|
21
|
+
"after:pointer-events-none after:absolute after:opacity-0"
|
|
16
22
|
].join(" ");
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
const tabFallbackClass = {
|
|
24
|
+
underline: {
|
|
25
|
+
horizontal: "after:inset-x-0 after:-bottom-px after:border-b-2 after:border-primary forced-colors:after:forced-color-adjust-none forced-colors:after:border-[Highlight]",
|
|
26
|
+
vertical: "after:inset-y-0 after:-end-px after:border-e-2 after:border-primary forced-colors:after:forced-color-adjust-none forced-colors:after:border-[Highlight]"
|
|
27
|
+
},
|
|
28
|
+
box: {
|
|
29
|
+
horizontal: "after:inset-0 after:hidden after:rounded-md after:border-2 forced-colors:after:block forced-colors:after:forced-color-adjust-none forced-colors:after:border-[Highlight]",
|
|
30
|
+
vertical: "after:inset-0 after:hidden after:rounded-md after:border-2 forced-colors:after:block forced-colors:after:forced-color-adjust-none forced-colors:after:border-[Highlight]"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const indicatorBaseClass = "pointer-events-none invisible absolute [[data-measured]>&]:visible motion-safe:transition-[translate,width,height] motion-safe:duration-normal motion-safe:ease-out forced-colors:forced-color-adjust-none";
|
|
34
|
+
const tabIndicatorClass = {
|
|
35
|
+
underline: {
|
|
36
|
+
horizontal: `${indicatorBaseClass} -bottom-px left-0 w-(--tab-indicator-width) translate-x-(--tab-indicator-x) border-b-2 border-primary forced-colors:border-[Highlight]`,
|
|
37
|
+
vertical: `${indicatorBaseClass} top-0 -end-px h-(--tab-indicator-height) translate-y-(--tab-indicator-y) border-e-2 border-primary forced-colors:border-[Highlight]`
|
|
38
|
+
},
|
|
39
|
+
box: {
|
|
40
|
+
horizontal: `${indicatorBaseClass} top-0 left-0 h-(--tab-indicator-height) w-(--tab-indicator-width) translate-x-(--tab-indicator-x) translate-y-(--tab-indicator-y) rounded-md border border-raised bg-surface shadow-sm forced-colors:border-2 forced-colors:border-[Highlight] forced-colors:bg-transparent forced-colors:shadow-none`,
|
|
41
|
+
vertical: `${indicatorBaseClass} top-0 left-0 h-(--tab-indicator-height) w-(--tab-indicator-width) translate-x-(--tab-indicator-x) translate-y-(--tab-indicator-y) rounded-md border border-raised bg-surface shadow-sm forced-colors:border-2 forced-colors:border-[Highlight] forced-colors:bg-transparent forced-colors:shadow-none`
|
|
42
|
+
}
|
|
20
43
|
};
|
|
21
44
|
const tabPanelClass = "min-w-0 flex-1 rounded-md outline-none focus-visible:focus-ring";
|
|
22
45
|
|
|
23
|
-
export { tabBaseClass,
|
|
46
|
+
export { tabBaseClass, tabFallbackClass, tabIndicatorClass, tabListClass, tabPanelClass, tabsOrientationClass };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useLayoutEffect, useRef } from "react";
|
|
4
|
+
|
|
5
|
+
// src/Tabs/hooks/useTabIndicator.ts
|
|
6
|
+
const tabSelector = ":scope > [role=\"tab\"]";
|
|
7
|
+
/**
|
|
8
|
+
* 고른 탭의 위치·크기를 재어 `indicatorRef`에 CSS 변수(`--tab-indicator-x·y·width·height`)로 적는다.
|
|
9
|
+
* 고른 탭이 바뀔 때만 미끄러지고, 첫 자리·크기 변화·숨었다 보일 때는 transition 없이 놓는다.
|
|
10
|
+
*/
|
|
11
|
+
function useTabIndicator(listRef, indicatorRef) {
|
|
12
|
+
const placed = useRef(null);
|
|
13
|
+
useLayoutEffect(() => {
|
|
14
|
+
const list = listRef.current;
|
|
15
|
+
const indicator = indicatorRef.current;
|
|
16
|
+
if (!list || !indicator) return;
|
|
17
|
+
const place = () => {
|
|
18
|
+
const tab = list.querySelector(`${tabSelector}[aria-selected="true"]`);
|
|
19
|
+
if (!tab || list.getClientRects().length === 0) {
|
|
20
|
+
delete list.dataset["measured"];
|
|
21
|
+
placed.current = null;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const listRect = list.getBoundingClientRect();
|
|
25
|
+
const rect = tab.getBoundingClientRect();
|
|
26
|
+
const scaleX = list.offsetWidth > 0 ? listRect.width / list.offsetWidth : 1;
|
|
27
|
+
const scaleY = list.offsetHeight > 0 ? listRect.height / list.offsetHeight : 1;
|
|
28
|
+
const x = (rect.left - listRect.left) / scaleX - list.clientLeft + list.scrollLeft;
|
|
29
|
+
const y = (rect.top - listRect.top) / scaleY - list.clientTop + list.scrollTop;
|
|
30
|
+
const width = rect.width / scaleX;
|
|
31
|
+
const height = rect.height / scaleY;
|
|
32
|
+
const geometry = `${x} ${y} ${width} ${height}`;
|
|
33
|
+
const previous = placed.current;
|
|
34
|
+
if (previous?.tab === tab.id && previous.geometry === geometry) return;
|
|
35
|
+
const slide = previous !== null && previous.tab !== tab.id;
|
|
36
|
+
if (!slide) indicator.style.transition = "none";
|
|
37
|
+
indicator.style.setProperty("--tab-indicator-x", `${x}px`);
|
|
38
|
+
indicator.style.setProperty("--tab-indicator-y", `${y}px`);
|
|
39
|
+
indicator.style.setProperty("--tab-indicator-width", `${width}px`);
|
|
40
|
+
indicator.style.setProperty("--tab-indicator-height", `${height}px`);
|
|
41
|
+
if (!slide) {
|
|
42
|
+
indicator.getBoundingClientRect();
|
|
43
|
+
indicator.style.removeProperty("transition");
|
|
44
|
+
}
|
|
45
|
+
list.dataset["measured"] = "";
|
|
46
|
+
placed.current = {
|
|
47
|
+
tab: tab.id,
|
|
48
|
+
geometry
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
place();
|
|
52
|
+
const observer = new ResizeObserver(place);
|
|
53
|
+
observer.observe(list);
|
|
54
|
+
for (const tab of list.querySelectorAll(tabSelector)) observer.observe(tab);
|
|
55
|
+
return () => observer.disconnect();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { useTabIndicator };
|
package/dist/Tabs/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { Tabs, TabsOwnProps, TabsProps } from "./Tabs.js";
|
|
|
2
2
|
import { TabList, TabListOwnProps, TabListProps } from "./components/TabList.js";
|
|
3
3
|
import { Tab, TabOwnProps, TabProps } from "./components/Tab.js";
|
|
4
4
|
import { TabPanel, TabPanelOwnProps, TabPanelProps } from "./components/TabPanel.js";
|
|
5
|
-
import { TabsActivationMode, TabsOrientation } from "./types.js";
|
|
6
|
-
export { Tab, TabList, type TabListOwnProps, type TabListProps, type TabOwnProps, TabPanel, type TabPanelOwnProps, type TabPanelProps, type TabProps, Tabs, type TabsActivationMode, type TabsOrientation, type TabsOwnProps, type TabsProps };
|
|
5
|
+
import { TabsActivationMode, TabsOrientation, TabsShape } from "./types.js";
|
|
6
|
+
export { Tab, TabList, type TabListOwnProps, type TabListProps, type TabOwnProps, TabPanel, type TabPanelOwnProps, type TabPanelProps, type TabProps, Tabs, type TabsActivationMode, type TabsOrientation, type TabsOwnProps, type TabsProps, type TabsShape };
|
package/dist/Tabs/types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import "react-stately";
|
|
2
2
|
/** 탭 목록의 방향. 세로면 ↓↑로 옮기고 탭 목록이 패널의 시작쪽에 선다. */
|
|
3
3
|
export type TabsOrientation = "horizontal" | "vertical";
|
|
4
|
+
/** 고른 표시의 모양. `underline`은 밑줄, `box`는 옅은 바탕 위 둥근 사각형이다. */
|
|
5
|
+
export type TabsShape = "underline" | "box";
|
|
4
6
|
/** 키보드로 탭을 옮겼을 때 바로 고를지(`automatic`), Enter·Space로 고를지(`manual`). */
|
|
5
7
|
export type TabsActivationMode = "automatic" | "manual";
|
|
@@ -5,8 +5,11 @@ const choiceRootClass = "group/choice inline-flex items-start gap-2 align-top te
|
|
|
5
5
|
const choiceAreaClass = "grid size-6 shrink-0 place-items-center";
|
|
6
6
|
/** 네이티브 input을 상자·원으로 그린다. 선택 상태 모양은 Checkbox·Radio가 각자 더한다. */
|
|
7
7
|
const choiceInputClass = "peer col-start-1 row-start-1 m-0 appearance-none border border-strong bg-canvas cursor-pointer transition-colors enabled:aria-invalid:border-danger focus-visible:focus-field disabled:cursor-not-allowed disabled:border-default disabled:bg-disabled not-forced-colors:aria-invalid:[--tide-accent-subtle:var(--tide-bg-danger-subtle)] not-forced-colors:aria-invalid:[--tide-accent-subtle-active:var(--tide-bg-danger-subtle-active)] not-forced-colors:aria-invalid:[--tide-accent-solid:var(--tide-bg-danger-solid)] not-forced-colors:aria-invalid:[--tide-accent-solid-hover:var(--tide-bg-danger-solid-hover)] not-forced-colors:aria-invalid:[--tide-accent-solid-active:var(--tide-bg-danger-solid-active)] forced-colors:forced-color-adjust-none forced-colors:[--tide-bg-canvas:Canvas] forced-colors:[--tide-border-strong:CanvasText] forced-colors:[--tide-border-danger:CanvasText] forced-colors:[--tide-accent-border:Highlight] forced-colors:[--tide-accent-solid:Highlight] forced-colors:[--tide-accent-solid-hover:Highlight] forced-colors:[--tide-accent-solid-active:Highlight] forced-colors:[--tide-accent-subtle:Canvas] forced-colors:[--tide-accent-subtle-active:Canvas] forced-colors:[--tide-border-default:GrayText] forced-colors:[--tide-bg-disabled:Canvas] forced-colors:[--tide-accent-subtle-border:Highlight] forced-colors:[--tide-border-danger-subtle:Highlight]";
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* 상자 위에 겹치는 표시. 누름은 input이 받는다. 색과 보이는 조건 class는 Component가 붙인다.
|
|
10
|
+
* display를 바꾸지 않고 opacity로 숨긴다. display가 바뀌면 전환이 시작되지 않는다(ADR 0037).
|
|
11
|
+
*/
|
|
12
|
+
const choiceMarkClass = "pointer-events-none col-start-1 row-start-1 opacity-0 transition-opacity peer-disabled:text-disabled forced-colors:forced-color-adjust-none forced-colors:[--tide-text-disabled:GrayText]";
|
|
10
13
|
/** 글자 스타일. md 행간 24px은 조작 영역과 같고, sm 행간 20px은 위아래 2px을 둬 첫 줄을 상자 가운데에 맞춘다. */
|
|
11
14
|
const choiceTextClass = {
|
|
12
15
|
sm: "py-0.5 text-body-sm",
|
package/dist/index.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ import { Dialog } from "./Dialog/Dialog.js";
|
|
|
89
89
|
import { DialogTrigger, DialogTriggerOwnProps, DialogTriggerProps } from "./Dialog/components/DialogTrigger.js";
|
|
90
90
|
import { DialogSize } from "./Dialog/types.js";
|
|
91
91
|
import { DialogContent, DialogContentOwnProps, DialogContentProps } from "./Dialog/components/DialogContent.js";
|
|
92
|
+
import { DialogHeader, DialogHeaderAlign, DialogHeaderOwnProps, DialogHeaderProps } from "./Dialog/components/DialogHeader.js";
|
|
92
93
|
import { DialogTitle, DialogTitleProps } from "./Dialog/components/DialogTitle.js";
|
|
93
94
|
import { DialogDescription, DialogDescriptionProps } from "./Dialog/components/DialogDescription.js";
|
|
94
95
|
import { DialogFooter, DialogFooterProps } from "./Dialog/components/DialogFooter.js";
|
|
@@ -100,7 +101,7 @@ import { AccordionHeadingLevel } from "./Accordion/types.js";
|
|
|
100
101
|
import { AccordionTrigger, AccordionTriggerOwnProps, AccordionTriggerProps } from "./Accordion/components/AccordionTrigger.js";
|
|
101
102
|
import { AccordionPanel, AccordionPanelOwnProps, AccordionPanelProps } from "./Accordion/components/AccordionPanel.js";
|
|
102
103
|
import "./Tabs/index.js";
|
|
103
|
-
import { TabsActivationMode, TabsOrientation } from "./Tabs/types.js";
|
|
104
|
+
import { TabsActivationMode, TabsOrientation, TabsShape } from "./Tabs/types.js";
|
|
104
105
|
import { Tabs, TabsOwnProps, TabsProps } from "./Tabs/Tabs.js";
|
|
105
106
|
import { TabList, TabListOwnProps, TabListProps } from "./Tabs/components/TabList.js";
|
|
106
107
|
import { Tab, TabOwnProps, TabProps } from "./Tabs/components/Tab.js";
|
|
@@ -118,4 +119,4 @@ import { TooltipTrigger, TooltipTriggerOwnProps, TooltipTriggerProps } from "./T
|
|
|
118
119
|
import { TooltipPlacement } from "./Tooltip/types.js";
|
|
119
120
|
import { TooltipContent, TooltipContentOwnProps, TooltipContentProps } from "./Tooltip/components/TooltipContent.js";
|
|
120
121
|
import { Color, ColorFamilyName, ColorFamilyRegistry, FillVariant, Role, RoleRegistry, Size } from "./types.js";
|
|
121
|
-
export { Accordion, type AccordionHeadingLevel, AccordionItem, type AccordionItemOwnProps, type AccordionItemProps, type AccordionOwnProps, AccordionPanel, type AccordionPanelOwnProps, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerOwnProps, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertOwnProps, type AlertProps, Avatar, type AvatarOwnProps, type AvatarProps, Badge, type BadgeOwnProps, type BadgeProps, Breadcrumb, BreadcrumbCurrent, type BreadcrumbCurrentProps, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkOwnProps, type BreadcrumbLinkProps, type BreadcrumbOwnProps, type BreadcrumbProps, Button, type ButtonOwnProps, type ButtonProps, Card, type CardOwnProps, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupOwnProps, type CheckboxGroupProps, type CheckboxOwnProps, type CheckboxProps, type ChoiceOrientation, type Color, type ColorFamilyName, type ColorFamilyRegistry, Combobox, ComboboxItem, type ComboboxItemOwnProps, type ComboboxItemProps, type ComboboxOwnProps, type ComboboxProps, ComboboxSection, type ComboboxSectionProps, Dialog, DialogClose, type DialogCloseOwnProps, type DialogCloseProps, DialogContent, type DialogContentOwnProps, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, type DialogProps, type DialogSize, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerOwnProps, type DialogTriggerProps, Field, type FieldOwnProps, type FieldProps, type FillVariant, IconButton, type IconButtonOwnProps, type IconButtonProps, Input, type InputOwnProps, type InputProps, Link, type LinkOwnProps, type LinkProps, Menu, MenuContent, type MenuContentOwnProps, type MenuContentProps, MenuItem, type MenuItemOwnProps, type MenuItemProps, type MenuPlacement, type MenuProps, MenuSection, type MenuSectionProps, MenuTrigger, type MenuTriggerOwnProps, type MenuTriggerProps, Pagination, PaginationEllipsis, type PaginationEllipsisOwnProps, type PaginationEllipsisProps, PaginationItem, type PaginationItemProps, PaginationLink, type PaginationLinkOwnProps, type PaginationLinkProps, PaginationNext, type PaginationNextOwnProps, type PaginationNextProps, type PaginationOwnProps, PaginationPrevious, type PaginationPreviousOwnProps, type PaginationPreviousProps, type PaginationProps, Popover, PopoverContent, type PopoverContentOwnProps, type PopoverContentProps, type PopoverPlacement, type PopoverProps, PopoverTrigger, type PopoverTriggerOwnProps, type PopoverTriggerProps, Progress, type ProgressOwnProps, type ProgressProps, Radio, RadioGroup, type RadioGroupOwnProps, type RadioGroupProps, type RadioOwnProps, type RadioProps, type Role, type RoleRegistry, Select, SelectItem, type SelectItemOwnProps, type SelectItemProps, type SelectOwnProps, type SelectProps, SelectSection, type SelectSectionProps, Separator, type SeparatorOwnProps, type SeparatorProps, type Size, Skeleton, type SkeletonOwnProps, type SkeletonProps, Spinner, type SpinnerOwnProps, type SpinnerProps, Switch, type SwitchOwnProps, type SwitchProps, Tab, TabList, type TabListOwnProps, type TabListProps, type TabOwnProps, TabPanel, type TabPanelOwnProps, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHead, type TableHeadProps, TableHeaderCell, type TableHeaderCellOwnProps, type TableHeaderCellProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsActivationMode, type TabsOrientation, type TabsOwnProps, type TabsProps, Tag, TagGroup, type TagGroupOwnProps, type TagGroupProps, type TagOwnProps, type TagProps, Textarea, type TextareaOwnProps, type TextareaProps, type ToastAction, type ToastOptions, ToastQueue, type ToastQueueOptions, ToastRegion, type ToastRegionOwnProps, type ToastRegionProps, Tooltip, TooltipContent, type TooltipContentOwnProps, type TooltipContentProps, type TooltipPlacement, type TooltipProps, TooltipTrigger, type TooltipTriggerOwnProps, type TooltipTriggerProps, Typography, type TypographyOwnProps, type TypographyProps, VisuallyHidden, type VisuallyHiddenProps, cn };
|
|
122
|
+
export { Accordion, type AccordionHeadingLevel, AccordionItem, type AccordionItemOwnProps, type AccordionItemProps, type AccordionOwnProps, AccordionPanel, type AccordionPanelOwnProps, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerOwnProps, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertOwnProps, type AlertProps, Avatar, type AvatarOwnProps, type AvatarProps, Badge, type BadgeOwnProps, type BadgeProps, Breadcrumb, BreadcrumbCurrent, type BreadcrumbCurrentProps, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkOwnProps, type BreadcrumbLinkProps, type BreadcrumbOwnProps, type BreadcrumbProps, Button, type ButtonOwnProps, type ButtonProps, Card, type CardOwnProps, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupOwnProps, type CheckboxGroupProps, type CheckboxOwnProps, type CheckboxProps, type ChoiceOrientation, type Color, type ColorFamilyName, type ColorFamilyRegistry, Combobox, ComboboxItem, type ComboboxItemOwnProps, type ComboboxItemProps, type ComboboxOwnProps, type ComboboxProps, ComboboxSection, type ComboboxSectionProps, Dialog, DialogClose, type DialogCloseOwnProps, type DialogCloseProps, DialogContent, type DialogContentOwnProps, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderAlign, type DialogHeaderOwnProps, type DialogHeaderProps, type DialogProps, type DialogSize, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerOwnProps, type DialogTriggerProps, Field, type FieldOwnProps, type FieldProps, type FillVariant, IconButton, type IconButtonOwnProps, type IconButtonProps, Input, type InputOwnProps, type InputProps, Link, type LinkOwnProps, type LinkProps, Menu, MenuContent, type MenuContentOwnProps, type MenuContentProps, MenuItem, type MenuItemOwnProps, type MenuItemProps, type MenuPlacement, type MenuProps, MenuSection, type MenuSectionProps, MenuTrigger, type MenuTriggerOwnProps, type MenuTriggerProps, Pagination, PaginationEllipsis, type PaginationEllipsisOwnProps, type PaginationEllipsisProps, PaginationItem, type PaginationItemProps, PaginationLink, type PaginationLinkOwnProps, type PaginationLinkProps, PaginationNext, type PaginationNextOwnProps, type PaginationNextProps, type PaginationOwnProps, PaginationPrevious, type PaginationPreviousOwnProps, type PaginationPreviousProps, type PaginationProps, Popover, PopoverContent, type PopoverContentOwnProps, type PopoverContentProps, type PopoverPlacement, type PopoverProps, PopoverTrigger, type PopoverTriggerOwnProps, type PopoverTriggerProps, Progress, type ProgressOwnProps, type ProgressProps, Radio, RadioGroup, type RadioGroupOwnProps, type RadioGroupProps, type RadioOwnProps, type RadioProps, type Role, type RoleRegistry, Select, SelectItem, type SelectItemOwnProps, type SelectItemProps, type SelectOwnProps, type SelectProps, SelectSection, type SelectSectionProps, Separator, type SeparatorOwnProps, type SeparatorProps, type Size, Skeleton, type SkeletonOwnProps, type SkeletonProps, Spinner, type SpinnerOwnProps, type SpinnerProps, Switch, type SwitchOwnProps, type SwitchProps, Tab, TabList, type TabListOwnProps, type TabListProps, type TabOwnProps, TabPanel, type TabPanelOwnProps, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHead, type TableHeadProps, TableHeaderCell, type TableHeaderCellOwnProps, type TableHeaderCellProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsActivationMode, type TabsOrientation, type TabsOwnProps, type TabsProps, type TabsShape, Tag, TagGroup, type TagGroupOwnProps, type TagGroupProps, type TagOwnProps, type TagProps, Textarea, type TextareaOwnProps, type TextareaProps, type ToastAction, type ToastOptions, ToastQueue, type ToastQueueOptions, ToastRegion, type ToastRegionOwnProps, type ToastRegionProps, Tooltip, TooltipContent, type TooltipContentOwnProps, type TooltipContentProps, type TooltipPlacement, type TooltipProps, TooltipTrigger, type TooltipTriggerOwnProps, type TooltipTriggerProps, Typography, type TypographyOwnProps, type TypographyProps, VisuallyHidden, type VisuallyHiddenProps, cn };
|
package/dist/index.js
CHANGED
|
@@ -56,6 +56,7 @@ import { DialogClose } from "./Dialog/components/DialogClose.js";
|
|
|
56
56
|
import { DialogContent } from "./Dialog/components/DialogContent.js";
|
|
57
57
|
import { DialogDescription } from "./Dialog/components/DialogDescription.js";
|
|
58
58
|
import { DialogFooter } from "./Dialog/components/DialogFooter.js";
|
|
59
|
+
import { DialogHeader } from "./Dialog/components/DialogHeader.js";
|
|
59
60
|
import { DialogTitle } from "./Dialog/components/DialogTitle.js";
|
|
60
61
|
import { DialogTrigger } from "./Dialog/components/DialogTrigger.js";
|
|
61
62
|
import { Accordion } from "./Accordion/Accordion.js";
|
|
@@ -74,4 +75,4 @@ import { Tooltip } from "./Tooltip/Tooltip.js";
|
|
|
74
75
|
import { TooltipContent } from "./Tooltip/components/TooltipContent.js";
|
|
75
76
|
import { TooltipTrigger } from "./Tooltip/components/TooltipTrigger.js";
|
|
76
77
|
|
|
77
|
-
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, Alert, AlertDialog, Avatar, Badge, Breadcrumb, BreadcrumbCurrent, BreadcrumbItem, BreadcrumbLink, Button, Card, Checkbox, CheckboxGroup, Combobox, ComboboxItem, ComboboxSection, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, Field, IconButton, Input, Link, Menu, MenuContent, MenuItem, MenuSection, MenuTrigger, Pagination, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, Progress, Radio, RadioGroup, Select, SelectItem, SelectSection, Separator, Skeleton, Spinner, Switch, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow, Tabs, Tag, TagGroup, Textarea, ToastQueue, ToastRegion, Tooltip, TooltipContent, TooltipTrigger, Typography, VisuallyHidden, cn };
|
|
78
|
+
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, Alert, AlertDialog, Avatar, Badge, Breadcrumb, BreadcrumbCurrent, BreadcrumbItem, BreadcrumbLink, Button, Card, Checkbox, CheckboxGroup, Combobox, ComboboxItem, ComboboxSection, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Field, IconButton, Input, Link, Menu, MenuContent, MenuItem, MenuSection, MenuTrigger, Pagination, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, Progress, Radio, RadioGroup, Select, SelectItem, SelectSection, Separator, Skeleton, Spinner, Switch, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow, Tabs, Tag, TagGroup, Textarea, ToastQueue, ToastRegion, Tooltip, TooltipContent, TooltipTrigger, Typography, VisuallyHidden, cn };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tide-design/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "Tide 디자인 시스템의 React Component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"./styles.css": "./dist/styles.css"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tide-design/foundation": "0.
|
|
38
|
-
"@tide-design/icons": "0.
|
|
37
|
+
"@tide-design/foundation": "0.18.1",
|
|
38
|
+
"@tide-design/icons": "0.18.1",
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"react-aria": "^3.53.1",
|
|
41
41
|
"react-stately": "^3.51.0",
|