@tide-design/components 0.0.0-stage → 0.11.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.
- package/LICENSE +21 -0
- package/dist/Accordion.d.ts +66 -0
- package/dist/Accordion.js +127 -0
- package/dist/Alert.d.ts +32 -0
- package/dist/Alert.js +47 -0
- package/dist/AlertDialog.d.ts +8 -0
- package/dist/AlertDialog.js +18 -0
- package/dist/Avatar.d.ts +27 -0
- package/dist/Avatar.js +44 -0
- package/dist/Badge.d.ts +32 -0
- package/dist/Badge.js +28 -0
- package/dist/Breadcrumb.d.ts +26 -0
- package/dist/Breadcrumb.js +53 -0
- package/dist/Button.d.ts +42 -0
- package/dist/Button.js +76 -0
- package/dist/Card.d.ts +13 -0
- package/dist/Card.js +18 -0
- package/dist/Checkbox.d.ts +30 -0
- package/dist/Checkbox.js +74 -0
- package/dist/CheckboxGroup.d.ts +19 -0
- package/dist/CheckboxGroup.js +45 -0
- package/dist/Combobox.d.ts +59 -0
- package/dist/Combobox.js +206 -0
- package/dist/Dialog.d.ts +70 -0
- package/dist/Dialog.js +255 -0
- package/dist/Field.d.ts +33 -0
- package/dist/Field.js +74 -0
- package/dist/IconButton.d.ts +42 -0
- package/dist/IconButton.js +63 -0
- package/dist/Input.d.ts +16 -0
- package/dist/Input.js +29 -0
- package/dist/Link.d.ts +20 -0
- package/dist/Link.js +21 -0
- package/dist/Menu.d.ts +72 -0
- package/dist/Menu.js +226 -0
- package/dist/Pagination.d.ts +46 -0
- package/dist/Pagination.js +79 -0
- package/dist/Popover.d.ts +43 -0
- package/dist/Popover.js +147 -0
- package/dist/Progress.d.ts +32 -0
- package/dist/Progress.js +40 -0
- package/dist/Radio.d.ts +27 -0
- package/dist/Radio.js +67 -0
- package/dist/RadioGroup.d.ts +28 -0
- package/dist/RadioGroup.js +50 -0
- package/dist/Select.d.ts +62 -0
- package/dist/Select.js +169 -0
- package/dist/Separator.d.ts +18 -0
- package/dist/Separator.js +24 -0
- package/dist/Skeleton.d.ts +24 -0
- package/dist/Skeleton.js +29 -0
- package/dist/Spinner.d.ts +20 -0
- package/dist/Spinner.js +35 -0
- package/dist/Switch.d.ts +30 -0
- package/dist/Switch.js +65 -0
- package/dist/Table.d.ts +31 -0
- package/dist/Table.js +53 -0
- package/dist/Tabs.d.ts +66 -0
- package/dist/Tabs.js +159 -0
- package/dist/Tag.d.ts +48 -0
- package/dist/Tag.js +102 -0
- package/dist/Textarea.d.ts +19 -0
- package/dist/Textarea.js +36 -0
- package/dist/Toast.d.ts +71 -0
- package/dist/Toast.js +191 -0
- package/dist/Tooltip.d.ts +53 -0
- package/dist/Tooltip.js +129 -0
- package/dist/Typography.d.ts +36 -0
- package/dist/Typography.js +50 -0
- package/dist/VisuallyHidden.d.ts +4 -0
- package/dist/VisuallyHidden.js +13 -0
- package/dist/alert-style.js +45 -0
- package/dist/choice-group.js +34 -0
- package/dist/choice-style.d.ts +2 -0
- package/dist/choice-style.js +16 -0
- package/dist/cn.d.ts +6 -0
- package/dist/cn.js +15 -0
- package/dist/field-context.js +26 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +38 -0
- package/dist/input-style.d.ts +3 -0
- package/dist/input-style.js +11 -0
- package/dist/list-collection.d.ts +23 -0
- package/dist/list-collection.js +99 -0
- package/dist/list-style.js +46 -0
- package/dist/listbox.d.ts +15 -0
- package/dist/listbox.js +90 -0
- package/dist/overlay-style.js +84 -0
- package/dist/overlay.d.ts +7 -0
- package/dist/overlay.js +130 -0
- package/dist/pressable.js +70 -0
- package/dist/render.js +55 -0
- package/dist/styles.css +5 -0
- package/dist/types.d.ts +9 -0
- package/package.json +57 -3
- package/README.md +0 -3
package/dist/Table.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ComponentProps, ReactElement } from "react";
|
|
2
|
+
export interface TableProps extends ComponentProps<"table"> {}
|
|
3
|
+
export interface TableHeadProps extends ComponentProps<"thead"> {}
|
|
4
|
+
export interface TableBodyProps extends ComponentProps<"tbody"> {}
|
|
5
|
+
export interface TableRowProps extends ComponentProps<"tr"> {}
|
|
6
|
+
export interface TableHeaderCellProps extends ComponentProps<"th"> {
|
|
7
|
+
/**
|
|
8
|
+
* 이 머리 칸이 맡는 범위. 기본값은 `"col"`(아래 열)이다. 본문 행의 첫 칸처럼 행을 맡으면 `"row"`를 준다.
|
|
9
|
+
* 열 그룹·행 그룹 머리는 `"colgroup"`·`"rowgroup"`이다.
|
|
10
|
+
*/
|
|
11
|
+
scope?: "col" | "row" | "colgroup" | "rowgroup";
|
|
12
|
+
}
|
|
13
|
+
export interface TableCellProps extends ComponentProps<"td"> {}
|
|
14
|
+
/**
|
|
15
|
+
* 시맨틱 `<table>`. 행·열로 된 데이터를 보여 준다. 정렬·행 선택·가상화는 없다. 서버 컴포넌트로 쓸 수 있다.
|
|
16
|
+
* 표의 이름은 `<caption>`이나 `aria-label`·`aria-labelledby`로 준다.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Table({ className, ...props }: TableProps): ReactElement;
|
|
19
|
+
/** 머리 행 묶음 `<thead>`. 안의 행은 hover로 바뀌지 않는다. */
|
|
20
|
+
export declare function TableHead(props: TableHeadProps): ReactElement;
|
|
21
|
+
/** 본문 행 묶음 `<tbody>`. 바로 아래 `TableRow`에 마우스를 올리면 배경이 바로 바뀐다. */
|
|
22
|
+
export declare function TableBody(props: TableBodyProps): ReactElement;
|
|
23
|
+
/** 행 `<tr>`. 아래 경계가 있고, `TableBody` 안에서는 hover 배경이 transition 없이 바로 바뀐다. */
|
|
24
|
+
export declare function TableRow({ className, ...props }: TableRowProps): ReactElement;
|
|
25
|
+
/**
|
|
26
|
+
* 머리 칸 `<th>`. 기본은 `scope="col"`(열 머리, columnheader)이다. 본문 행의 행 머리는 `scope="row"`(rowheader)를 준다.
|
|
27
|
+
* 복잡한 표(여러 줄 머리)는 `id`와 칸의 `headers`로 직접 잇는다.
|
|
28
|
+
*/
|
|
29
|
+
export declare function TableHeaderCell({ scope, className, ...props }: TableHeaderCellProps): ReactElement;
|
|
30
|
+
/** 데이터 칸 `<td>`. 숫자 열은 `className="tabular-nums text-end"`로 자릿수를 맞춘다. */
|
|
31
|
+
export declare function TableCell({ className, ...props }: TableCellProps): ReactElement;
|
package/dist/Table.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { cn } from "./cn.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
// src/Table.tsx
|
|
5
|
+
const tableClass = "w-full border-collapse text-body-sm text-default";
|
|
6
|
+
const rowClass = "border-b border-default [:where(tbody>&)]:hover:bg-hover";
|
|
7
|
+
const headerCellClass = "px-3 py-2.5 text-start align-middle text-label-md";
|
|
8
|
+
const cellClass = "px-3 py-2.5 text-start align-middle";
|
|
9
|
+
/**
|
|
10
|
+
* 시맨틱 `<table>`. 행·열로 된 데이터를 보여 준다. 정렬·행 선택·가상화는 없다. 서버 컴포넌트로 쓸 수 있다.
|
|
11
|
+
* 표의 이름은 `<caption>`이나 `aria-label`·`aria-labelledby`로 준다.
|
|
12
|
+
*/
|
|
13
|
+
function Table({ className, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("table", {
|
|
15
|
+
...props,
|
|
16
|
+
className: cn(tableClass, className)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/** 머리 행 묶음 `<thead>`. 안의 행은 hover로 바뀌지 않는다. */
|
|
20
|
+
function TableHead(props) {
|
|
21
|
+
return /* @__PURE__ */ jsx("thead", { ...props });
|
|
22
|
+
}
|
|
23
|
+
/** 본문 행 묶음 `<tbody>`. 바로 아래 `TableRow`에 마우스를 올리면 배경이 바로 바뀐다. */
|
|
24
|
+
function TableBody(props) {
|
|
25
|
+
return /* @__PURE__ */ jsx("tbody", { ...props });
|
|
26
|
+
}
|
|
27
|
+
/** 행 `<tr>`. 아래 경계가 있고, `TableBody` 안에서는 hover 배경이 transition 없이 바로 바뀐다. */
|
|
28
|
+
function TableRow({ className, ...props }) {
|
|
29
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
30
|
+
...props,
|
|
31
|
+
className: cn(rowClass, className)
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 머리 칸 `<th>`. 기본은 `scope="col"`(열 머리, columnheader)이다. 본문 행의 행 머리는 `scope="row"`(rowheader)를 준다.
|
|
36
|
+
* 복잡한 표(여러 줄 머리)는 `id`와 칸의 `headers`로 직접 잇는다.
|
|
37
|
+
*/
|
|
38
|
+
function TableHeaderCell({ scope = "col", className, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx("th", {
|
|
40
|
+
...props,
|
|
41
|
+
scope,
|
|
42
|
+
className: cn(headerCellClass, className)
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** 데이터 칸 `<td>`. 숫자 열은 `className="tabular-nums text-end"`로 자릿수를 맞춘다. */
|
|
46
|
+
function TableCell({ className, ...props }) {
|
|
47
|
+
return /* @__PURE__ */ jsx("td", {
|
|
48
|
+
...props,
|
|
49
|
+
className: cn(cellClass, className)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow };
|
package/dist/Tabs.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { CollectionValueItemProps } from "./list-collection.js";
|
|
2
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
3
|
+
/** 탭 목록의 방향. 세로면 ↓↑로 옮기고 탭 목록이 패널의 시작쪽에 선다. */
|
|
4
|
+
export type TabsOrientation = "horizontal" | "vertical";
|
|
5
|
+
/** 키보드로 탭을 옮겼을 때 바로 고를지(`automatic`), Enter·Space로 고를지(`manual`). */
|
|
6
|
+
export type TabsActivationMode = "automatic" | "manual";
|
|
7
|
+
type TabsValueProps = {
|
|
8
|
+
/** 고른 탭의 값(제어). 주면 `onValueChange`로 바꾼다. */
|
|
9
|
+
value: string;
|
|
10
|
+
defaultValue?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
value?: undefined;
|
|
13
|
+
/** 처음 고른 탭의 값(비제어). 서버 렌더에서도 그 패널이 바로 보이도록 `value`나 `defaultValue` 하나는 꼭 준다. */
|
|
14
|
+
defaultValue: string;
|
|
15
|
+
};
|
|
16
|
+
interface TabsBaseProps extends Omit<ComponentProps<"div">, "defaultValue" | "onChange"> {
|
|
17
|
+
/**
|
|
18
|
+
* 고른 탭이 바뀌려 할 때 새 값으로 부른다. 이미 고른 탭을 다시 눌러도 부르지 않는다.
|
|
19
|
+
* 준 값과 같은 탭이 없으면 첫 활성 탭을 고르며 부른다.
|
|
20
|
+
*/
|
|
21
|
+
onValueChange?: (value: string) => void;
|
|
22
|
+
/** 탭 목록의 방향. 기본값은 `horizontal`이다. 세로면 ↓↑로 옮기고 탭 목록이 패널의 시작쪽에 선다. */
|
|
23
|
+
orientation?: TabsOrientation;
|
|
24
|
+
/**
|
|
25
|
+
* 키보드로 탭을 옮겼을 때 바로 고를지(`automatic`, 기본값), Enter·Space로 고를지(`manual`)다.
|
|
26
|
+
* 패널을 그리는 데 시간이 걸리면(데이터를 불러오는 패널) `manual`을 쓴다(WAI-ARIA APG).
|
|
27
|
+
*/
|
|
28
|
+
activationMode?: TabsActivationMode;
|
|
29
|
+
/** `TabList` 하나와 `TabPanel`들 */
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
export type TabsProps = TabsBaseProps & TabsValueProps;
|
|
33
|
+
/**
|
|
34
|
+
* 같은 영역의 여러 패널 중 하나를 고르는 탭 묶음. 루트는 `<div>`이고 방향이 `data-orientation`으로 붙는다.
|
|
35
|
+
* 안에 `TabList` 하나와 탭마다 `TabPanel`을 둔다.
|
|
36
|
+
*/
|
|
37
|
+
export declare function Tabs({ value: valueProp, defaultValue, onValueChange, orientation, activationMode, ref, className, children, ...props }: TabsProps): ReactElement;
|
|
38
|
+
export interface TabListProps extends Omit<ComponentProps<"div">, "role" | "children"> {
|
|
39
|
+
/** `Tab`. 바로 아래(또는 Fragment·배열 안)에 둔다. */
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 탭 목록(`role="tablist"`). 화살표로 탭을 옮기고(끝에서 처음으로 돈다) Home·End로 처음·마지막 탭에 간다.
|
|
44
|
+
* 비활성 탭은 건너뛴다. 이름은 `aria-label`이나 `aria-labelledby`로 준다.
|
|
45
|
+
*/
|
|
46
|
+
export declare function TabList({ ref, className, children, ...props }: TabListProps): ReactElement;
|
|
47
|
+
export interface TabProps extends Omit<ComponentProps<"button">, "value" | "type" | "role" | "id" | "disabled" | "children">, Omit<CollectionValueItemProps, "textValue"> {
|
|
48
|
+
/** 탭 글자. 아이콘(장식용)과 글자를 함께 둘 수 있다. */
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 탭 하나(`role="tab"`). `TabList` 바로 안에 두고, 같은 `value`의 `TabPanel`과 이어진다.
|
|
53
|
+
* 고른 탭은 `data-selected`와 `aria-selected="true"`이고 primary 글자와 아래(세로면 끝쪽) 막대로 보인다.
|
|
54
|
+
* `disabled`면 네이티브 `disabled`라 고를 수 없고 키보드 이동도 건너뛴다.
|
|
55
|
+
*/
|
|
56
|
+
export declare function Tab(_props: TabProps): null;
|
|
57
|
+
export interface TabPanelProps extends Omit<ComponentProps<"div">, "id" | "role"> {
|
|
58
|
+
/** 이어지는 `Tab`의 값. 그 탭을 고른 동안만 렌더한다. */
|
|
59
|
+
value: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 탭 하나의 내용(`role="tabpanel"`). 같은 `value`의 탭을 고른 동안만 렌더하고, 그 탭이 이름이 된다(`aria-labelledby`).
|
|
63
|
+
* 탭 다음 Tab 순서에 들어간다(`tabIndex` 기본 `0`). 첫 내용이 조작 요소면 `tabIndex={-1}`로 뺄 수 있다.
|
|
64
|
+
*/
|
|
65
|
+
export declare function TabPanel({ value, ref, className, tabIndex, ...props }: TabPanelProps): ReactElement | null;
|
|
66
|
+
export {};
|
package/dist/Tabs.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "./cn.js";
|
|
4
|
+
import { asCollectionComponent, resolveCollectionChildren, valueItemCollectionNode } from "./list-collection.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { createContext, isValidElement, use, useCallback, useId, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { mergeProps, mergeRefs, useTab, useTabList } from "react-aria";
|
|
8
|
+
import { useTabListState } from "react-stately";
|
|
9
|
+
|
|
10
|
+
// src/Tabs.tsx
|
|
11
|
+
const TabsContext = createContext(null);
|
|
12
|
+
function useTabsContext(part) {
|
|
13
|
+
const context = use(TabsContext);
|
|
14
|
+
if (!context) throw new Error(`${part}는 Tabs 안에 둔다.`);
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
const tabsOrientationClass = {
|
|
18
|
+
horizontal: "flex flex-col gap-4",
|
|
19
|
+
vertical: "flex flex-row gap-6"
|
|
20
|
+
};
|
|
21
|
+
const tabListOrientationClass = {
|
|
22
|
+
horizontal: "flex shrink-0 gap-1 border-b border-default",
|
|
23
|
+
vertical: "flex shrink-0 flex-col gap-1 border-e border-default"
|
|
24
|
+
};
|
|
25
|
+
const tabBaseClass = [
|
|
26
|
+
"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",
|
|
27
|
+
"hover:not-data-selected:enabled:text-default data-selected:text-primary focus-visible:focus-ring",
|
|
28
|
+
"disabled:cursor-not-allowed disabled:text-disabled",
|
|
29
|
+
"after:pointer-events-none after:absolute after:border-primary after:opacity-0 after:transition-opacity data-selected:after:opacity-100",
|
|
30
|
+
"forced-colors:after:forced-color-adjust-none forced-colors:after:border-[Highlight]"
|
|
31
|
+
].join(" ");
|
|
32
|
+
const tabOrientationClass = {
|
|
33
|
+
horizontal: "after:inset-x-0 after:-bottom-px after:border-b-2 motion-safe:after:scale-x-0 motion-safe:after:transition-[opacity,scale] motion-safe:data-selected:after:scale-x-100",
|
|
34
|
+
vertical: "after:inset-y-0 after:-end-px after:border-e-2 motion-safe:after:scale-y-0 motion-safe:after:transition-[opacity,scale] motion-safe:data-selected:after:scale-y-100"
|
|
35
|
+
};
|
|
36
|
+
const tabPanelClass = "min-w-0 flex-1 rounded-md outline-none focus-visible:focus-ring";
|
|
37
|
+
/** id에 쓸 수 없는 공백을 뺀다(React Aria 탭 id와 같은 규칙). */
|
|
38
|
+
const idPart = (value) => value.replace(/\s+/g, "");
|
|
39
|
+
/**
|
|
40
|
+
* 같은 영역의 여러 패널 중 하나를 고르는 탭 묶음. 루트는 `<div>`이고 방향이 `data-orientation`으로 붙는다.
|
|
41
|
+
* 안에 `TabList` 하나와 탭마다 `TabPanel`을 둔다.
|
|
42
|
+
*/
|
|
43
|
+
function Tabs({ value: valueProp, defaultValue, onValueChange, orientation = "horizontal", activationMode = "automatic", ref, className, children, ...props }) {
|
|
44
|
+
const [internal, setInternal] = useState(defaultValue ?? "");
|
|
45
|
+
const controlled = valueProp !== void 0;
|
|
46
|
+
const value = controlled ? valueProp : internal;
|
|
47
|
+
const setValue = useCallback((next) => {
|
|
48
|
+
if (next === value) return;
|
|
49
|
+
if (!controlled) setInternal(next);
|
|
50
|
+
onValueChange?.(next);
|
|
51
|
+
}, [
|
|
52
|
+
controlled,
|
|
53
|
+
onValueChange,
|
|
54
|
+
value
|
|
55
|
+
]);
|
|
56
|
+
const baseId = useId();
|
|
57
|
+
const context = useMemo(() => ({
|
|
58
|
+
value,
|
|
59
|
+
setValue,
|
|
60
|
+
orientation,
|
|
61
|
+
activationMode,
|
|
62
|
+
tabId: (tab) => `${baseId}-tab-${idPart(tab)}`,
|
|
63
|
+
panelId: (tab) => `${baseId}-tabpanel-${idPart(tab)}`
|
|
64
|
+
}), [
|
|
65
|
+
value,
|
|
66
|
+
setValue,
|
|
67
|
+
orientation,
|
|
68
|
+
activationMode,
|
|
69
|
+
baseId
|
|
70
|
+
]);
|
|
71
|
+
return /* @__PURE__ */ jsx("div", {
|
|
72
|
+
...props,
|
|
73
|
+
ref,
|
|
74
|
+
"data-orientation": orientation,
|
|
75
|
+
className: cn(tabsOrientationClass[orientation], className),
|
|
76
|
+
children: /* @__PURE__ */ jsx(TabsContext, {
|
|
77
|
+
value: context,
|
|
78
|
+
children
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 탭 목록(`role="tablist"`). 화살표로 탭을 옮기고(끝에서 처음으로 돈다) Home·End로 처음·마지막 탭에 간다.
|
|
84
|
+
* 비활성 탭은 건너뛴다. 이름은 `aria-label`이나 `aria-labelledby`로 준다.
|
|
85
|
+
*/
|
|
86
|
+
function TabList({ ref, className, children, ...props }) {
|
|
87
|
+
const context = useTabsContext("TabList");
|
|
88
|
+
const listRef = useRef(null);
|
|
89
|
+
const items = useMemo(() => resolveCollectionChildren(children), [children]);
|
|
90
|
+
const known = items.some((item) => isValidElement(item) && item.props.value === context.value);
|
|
91
|
+
const state = useTabListState({
|
|
92
|
+
children: items,
|
|
93
|
+
selectedKey: known ? context.value : null,
|
|
94
|
+
onSelectionChange: (key) => context.setValue(String(key))
|
|
95
|
+
});
|
|
96
|
+
const { tabListProps } = useTabList({
|
|
97
|
+
orientation: context.orientation,
|
|
98
|
+
keyboardActivation: context.activationMode,
|
|
99
|
+
"aria-label": props["aria-label"],
|
|
100
|
+
"aria-labelledby": props["aria-labelledby"]
|
|
101
|
+
}, state, listRef);
|
|
102
|
+
const mergedRef = useMemo(() => mergeRefs(ref, listRef), [ref, listRef]);
|
|
103
|
+
return /* @__PURE__ */ jsx("div", {
|
|
104
|
+
...mergeProps(props, tabListProps),
|
|
105
|
+
ref: mergedRef,
|
|
106
|
+
className: cn(tabListOrientationClass[context.orientation], className),
|
|
107
|
+
children: [...state.collection].map((node) => /* @__PURE__ */ jsx(TabView, {
|
|
108
|
+
node,
|
|
109
|
+
state,
|
|
110
|
+
context
|
|
111
|
+
}, node.key))
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 탭 하나(`role="tab"`). `TabList` 바로 안에 두고, 같은 `value`의 `TabPanel`과 이어진다.
|
|
116
|
+
* 고른 탭은 `data-selected`와 `aria-selected="true"`이고 primary 글자와 아래(세로면 끝쪽) 막대로 보인다.
|
|
117
|
+
* `disabled`면 네이티브 `disabled`라 고를 수 없고 키보드 이동도 건너뛴다.
|
|
118
|
+
*/
|
|
119
|
+
function Tab(_props) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
asCollectionComponent(Tab, valueItemCollectionNode);
|
|
123
|
+
/** 탭 하나를 그린다. node.props는 앱이 Tab에 준 props(와 컬렉션이 더한 isDisabled)다. */
|
|
124
|
+
function TabView({ node, state, context }) {
|
|
125
|
+
const tabRef = useRef(null);
|
|
126
|
+
const { ref, className, value, disabled: _disabled, isDisabled: _isDisabled, children: _children, onFocus: _onFocus, onBlur: _onBlur, onKeyDown: _onKeyDown, onKeyUp: _onKeyUp, autoFocus: _autoFocus, ...props } = node.props;
|
|
127
|
+
const { tabProps, isSelected, isDisabled } = useTab({ key: node.key }, state, tabRef);
|
|
128
|
+
const mergedRef = useMemo(() => mergeRefs(ref, tabRef), [ref, tabRef]);
|
|
129
|
+
return /* @__PURE__ */ jsx("button", {
|
|
130
|
+
...mergeProps(props, tabProps),
|
|
131
|
+
ref: mergedRef,
|
|
132
|
+
type: "button",
|
|
133
|
+
id: context.tabId(value),
|
|
134
|
+
"aria-controls": isSelected ? context.panelId(value) : void 0,
|
|
135
|
+
disabled: isDisabled || void 0,
|
|
136
|
+
"data-selected": isSelected ? "" : void 0,
|
|
137
|
+
className: cn(tabBaseClass, tabOrientationClass[context.orientation], className),
|
|
138
|
+
children: node.rendered
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* 탭 하나의 내용(`role="tabpanel"`). 같은 `value`의 탭을 고른 동안만 렌더하고, 그 탭이 이름이 된다(`aria-labelledby`).
|
|
143
|
+
* 탭 다음 Tab 순서에 들어간다(`tabIndex` 기본 `0`). 첫 내용이 조작 요소면 `tabIndex={-1}`로 뺄 수 있다.
|
|
144
|
+
*/
|
|
145
|
+
function TabPanel({ value, ref, className, tabIndex = 0, ...props }) {
|
|
146
|
+
const context = useTabsContext("TabPanel");
|
|
147
|
+
if (context.value !== value) return null;
|
|
148
|
+
return /* @__PURE__ */ jsx("div", {
|
|
149
|
+
...props,
|
|
150
|
+
ref,
|
|
151
|
+
role: "tabpanel",
|
|
152
|
+
id: context.panelId(value),
|
|
153
|
+
"aria-labelledby": context.tabId(value),
|
|
154
|
+
tabIndex,
|
|
155
|
+
className: cn(tabPanelClass, className)
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export { Tab, TabList, TabPanel, Tabs };
|
package/dist/Tag.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { CollectionValueItemProps } from "./list-collection.js";
|
|
2
|
+
import { ColorFamilyName } from "./types.js";
|
|
3
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
4
|
+
type TagGroupNameProps = {
|
|
5
|
+
/** 묶음 이름(예: `"고른 필터"`). 화면에 보이는 제목이 있으면 `aria-labelledby`를 쓴다. */
|
|
6
|
+
"aria-label": string;
|
|
7
|
+
"aria-labelledby"?: string;
|
|
8
|
+
} | {
|
|
9
|
+
"aria-label"?: string;
|
|
10
|
+
/** 묶음 이름이 되는 요소의 id. 이름(`aria-label`이나 `aria-labelledby`) 하나는 꼭 준다. */
|
|
11
|
+
"aria-labelledby": string;
|
|
12
|
+
};
|
|
13
|
+
interface TagGroupBaseProps extends Omit<ComponentProps<"div">, "role" | "children" | "aria-label" | "aria-labelledby"> {
|
|
14
|
+
/**
|
|
15
|
+
* 태그를 지우려 할 때 지울 태그의 `value`로 부른다. 지우기 버튼을 누르거나 태그에서 Delete·Backspace를 누르면 불린다.
|
|
16
|
+
* 주면 태그마다 지우기 버튼이 생긴다. 태그를 목록에서 빼는 일은 앱이 한다.
|
|
17
|
+
*/
|
|
18
|
+
onRemove?: (value: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* 지우기 버튼 이름의 앞부분. 기본값은 `"제거"`다. 버튼 이름은 이 글자와 태그 글자를 이어 읽는다(예: 「제거 디자인」).
|
|
21
|
+
*/
|
|
22
|
+
removeLabel?: string;
|
|
23
|
+
/** `Tag`. 바로 아래(또는 Fragment·배열 안)에 둔다. */
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
export type TagGroupProps = TagGroupBaseProps & TagGroupNameProps;
|
|
27
|
+
/**
|
|
28
|
+
* 고르거나 입력한 값을 보여 주는 태그 묶음(`role="grid"`). ←→로 태그를 옮기고(끝에서 처음으로 돈다) Home·End로
|
|
29
|
+
* 처음·마지막 태그에 간다. `onRemove`를 주면 Delete·Backspace와 지우기 버튼으로 태그를 지운다.
|
|
30
|
+
* 지운 뒤 포커스는 옆 태그로 옮겨 간다. 이름은 `aria-label`이나 `aria-labelledby`로 꼭 준다.
|
|
31
|
+
*/
|
|
32
|
+
export declare function TagGroup({ onRemove, removeLabel, ref, className, children, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, ...props }: TagGroupProps): ReactElement;
|
|
33
|
+
export interface TagProps extends Omit<ComponentProps<"div">, "color" | "role" | "id" | "tabIndex" | "children">, CollectionValueItemProps {
|
|
34
|
+
/** 태그 글자. 필수다. 아이콘(장식용)을 앞에 함께 둘 수 있다. */
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* 색 계열 이름. Tide 색 계열 8개(장식 계열 purple·mint 포함)와 앱이 `ColorFamilyRegistry`에 더한 계열을 받는다. 기본값은 `gray`다.
|
|
38
|
+
* 분류를 구분하는 뜻 없는 색이라 Role(`primary`·`danger` 등)은 받지 않는다(ADR 0016·0017 후속).
|
|
39
|
+
* 루트에 `data-color`로 붙고 바깥 요소의 색을 물려받지 않는다.
|
|
40
|
+
*/
|
|
41
|
+
color?: ColorFamilyName;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 태그 하나(`role="row"`). `TagGroup` 바로 안에 둔다. `value`가 묶음 안의 key이고 `onRemove`에 넘어오는 값이다.
|
|
45
|
+
* `disabled`면 지울 수 없고 키보드 이동도 건너뛴다(`aria-disabled`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function Tag(_props: TagProps): null;
|
|
48
|
+
export {};
|
package/dist/Tag.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "./cn.js";
|
|
4
|
+
import { IconButton } from "./IconButton.js";
|
|
5
|
+
import { asCollectionComponent, resolveCollectionChildren, valueItemCollectionNode } from "./list-collection.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { createContext, use, useMemo, useRef } from "react";
|
|
8
|
+
import { XIcon } from "@tide-design/icons";
|
|
9
|
+
import { mergeProps, mergeRefs, useTag, useTagGroup } from "react-aria";
|
|
10
|
+
import { useListState } from "react-stately";
|
|
11
|
+
|
|
12
|
+
// src/Tag.tsx
|
|
13
|
+
const TagGroupContext = createContext(null);
|
|
14
|
+
const tagGroupClass = "flex flex-wrap items-center gap-2 outline-none";
|
|
15
|
+
const tagClass = [
|
|
16
|
+
"inline-flex h-8 max-w-full min-w-0 shrink-0 items-center rounded-sm border border-accent-subtle bg-accent-subtle ps-2.5 align-middle text-label-md whitespace-nowrap text-accent-on-subtle outline-none select-none",
|
|
17
|
+
"[--tag-remove-hover:var(--tide-accent-subtle-hover)] [--tag-remove-active:var(--tide-accent-subtle-active)]",
|
|
18
|
+
"aria-disabled:bg-disabled aria-disabled:text-disabled focus-visible:focus-ring"
|
|
19
|
+
].join(" ");
|
|
20
|
+
const tagCellClass = "flex min-w-0 items-center gap-1";
|
|
21
|
+
const tagLabelClass = "inline-flex min-w-0 items-center gap-1 [&>svg]:size-4 [&>svg]:shrink-0";
|
|
22
|
+
const removeClass = "rounded-sm text-current";
|
|
23
|
+
const removeInteractionClass = "hover:bg-(--tag-remove-hover) active:bg-(--tag-remove-active)";
|
|
24
|
+
/**
|
|
25
|
+
* 고르거나 입력한 값을 보여 주는 태그 묶음(`role="grid"`). ←→로 태그를 옮기고(끝에서 처음으로 돈다) Home·End로
|
|
26
|
+
* 처음·마지막 태그에 간다. `onRemove`를 주면 Delete·Backspace와 지우기 버튼으로 태그를 지운다.
|
|
27
|
+
* 지운 뒤 포커스는 옆 태그로 옮겨 간다. 이름은 `aria-label`이나 `aria-labelledby`로 꼭 준다.
|
|
28
|
+
*/
|
|
29
|
+
function TagGroup({ onRemove, removeLabel = "제거", ref, className, children, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, ...props }) {
|
|
30
|
+
const groupRef = useRef(null);
|
|
31
|
+
const items = useMemo(() => resolveCollectionChildren(children), [children]);
|
|
32
|
+
const state = useListState({ children: items });
|
|
33
|
+
const { gridProps } = useTagGroup({
|
|
34
|
+
id,
|
|
35
|
+
"aria-label": ariaLabel,
|
|
36
|
+
"aria-labelledby": ariaLabelledby,
|
|
37
|
+
"aria-describedby": ariaDescribedby,
|
|
38
|
+
onRemove: onRemove ? (keys) => keys.forEach((key) => onRemove(String(key))) : void 0
|
|
39
|
+
}, state, groupRef);
|
|
40
|
+
const mergedRef = useMemo(() => mergeRefs(ref, groupRef), [ref, groupRef]);
|
|
41
|
+
const context = useMemo(() => ({
|
|
42
|
+
onRemove,
|
|
43
|
+
removeLabel
|
|
44
|
+
}), [onRemove, removeLabel]);
|
|
45
|
+
return /* @__PURE__ */ jsx("div", {
|
|
46
|
+
...mergeProps(props, gridProps),
|
|
47
|
+
ref: mergedRef,
|
|
48
|
+
className: cn(tagGroupClass, className),
|
|
49
|
+
children: /* @__PURE__ */ jsx(TagGroupContext, {
|
|
50
|
+
value: context,
|
|
51
|
+
children: [...state.collection].map((node) => /* @__PURE__ */ jsx(TagView, {
|
|
52
|
+
node,
|
|
53
|
+
state
|
|
54
|
+
}, node.key))
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 태그 하나(`role="row"`). `TagGroup` 바로 안에 둔다. `value`가 묶음 안의 key이고 `onRemove`에 넘어오는 값이다.
|
|
60
|
+
* `disabled`면 지울 수 없고 키보드 이동도 건너뛴다(`aria-disabled`).
|
|
61
|
+
*/
|
|
62
|
+
function Tag(_props) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
asCollectionComponent(Tag, valueItemCollectionNode);
|
|
66
|
+
/** 태그 하나를 그린다. node.props는 앱이 Tag에 준 props(와 컬렉션이 더한 isDisabled)다. */
|
|
67
|
+
function TagView({ node, state }) {
|
|
68
|
+
const context = use(TagGroupContext);
|
|
69
|
+
const rowRef = useRef(null);
|
|
70
|
+
const { ref, className, color = "gray", value: _value, disabled: _disabled, isDisabled: _isDisabled, textValue: _textValue, children: _children, "aria-label": _ariaLabel, onFocus: _onFocus, onBlur: _onBlur, onKeyDown: _onKeyDown, onKeyUp: _onKeyUp, autoFocus: _autoFocus, ...props } = node.props;
|
|
71
|
+
const { rowProps, gridCellProps, removeButtonProps, allowsRemoving, isDisabled } = useTag({ item: node }, state, rowRef);
|
|
72
|
+
const mergedRef = useMemo(() => mergeRefs(ref, rowRef), [ref, rowRef]);
|
|
73
|
+
const onRemove = context?.onRemove;
|
|
74
|
+
return /* @__PURE__ */ jsx("div", {
|
|
75
|
+
...mergeProps(props, rowProps),
|
|
76
|
+
ref: mergedRef,
|
|
77
|
+
"data-color": color,
|
|
78
|
+
className: cn(tagClass, allowsRemoving ? "pe-0.75" : "pe-2.5", className),
|
|
79
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
80
|
+
...gridCellProps,
|
|
81
|
+
className: tagCellClass,
|
|
82
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: tagLabelClass,
|
|
84
|
+
children: node.rendered
|
|
85
|
+
}), allowsRemoving && onRemove ? /* @__PURE__ */ jsx(IconButton, {
|
|
86
|
+
"aria-label": context.removeLabel,
|
|
87
|
+
"aria-labelledby": removeButtonProps["aria-labelledby"],
|
|
88
|
+
id: removeButtonProps.id,
|
|
89
|
+
variant: "ghost",
|
|
90
|
+
color: "neutral",
|
|
91
|
+
size: "xs",
|
|
92
|
+
disabled: isDisabled,
|
|
93
|
+
tabIndex: -1,
|
|
94
|
+
onClick: () => onRemove(String(node.key)),
|
|
95
|
+
className: cn(removeClass, isDisabled ? void 0 : removeInteractionClass),
|
|
96
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
97
|
+
}) : null]
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { Tag, TagGroup };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Size } from "./types.js";
|
|
2
|
+
import { ComponentProps, ReactElement } from "react";
|
|
3
|
+
/** Textarea의 size. Input과 같이 `sm`/`md`/`lg`만 받는다. */
|
|
4
|
+
type TextareaSize = Extract<Size, "sm" | "md" | "lg">;
|
|
5
|
+
export interface TextareaProps extends ComponentProps<"textarea"> {
|
|
6
|
+
/** 글자 크기와 padding. 글자 크기는 같은 size의 Input과 같다(14/14/16px). 기본값은 `md`다. */
|
|
7
|
+
size?: TextareaSize;
|
|
8
|
+
/**
|
|
9
|
+
* 오류 상태. `aria-invalid="true"`와 `data-invalid`가 붙고 경계가 danger 색이 된다.
|
|
10
|
+
* Field 안에서는 Field의 값을 따르고, 여기에 준 값이 이긴다.
|
|
11
|
+
*/
|
|
12
|
+
invalid?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 여러 줄 텍스트를 입력하는 네이티브 `<textarea>`. 기본 3줄 높이이고 세로로만 크기를 바꿀 수 있다.
|
|
16
|
+
* Field 안에 두면 label, 설명, 오류 메시지가 자동으로 연결된다.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Textarea({ size, invalid, id, disabled, required, rows, className, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }: TextareaProps): ReactElement;
|
|
19
|
+
export {};
|
package/dist/Textarea.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "./cn.js";
|
|
4
|
+
import { useFieldControl } from "./field-context.js";
|
|
5
|
+
import { inputBaseClass } from "./input-style.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
// src/Textarea.tsx
|
|
9
|
+
/** 좌우·세로 padding, 텍스트 스타일 */
|
|
10
|
+
const sizeClass = {
|
|
11
|
+
sm: "px-2.5 py-1.25 text-body-sm",
|
|
12
|
+
md: "px-3 py-2 text-body-sm",
|
|
13
|
+
lg: "px-4 py-3 text-body-md"
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 여러 줄 텍스트를 입력하는 네이티브 `<textarea>`. 기본 3줄 높이이고 세로로만 크기를 바꿀 수 있다.
|
|
17
|
+
* Field 안에 두면 label, 설명, 오류 메시지가 자동으로 연결된다.
|
|
18
|
+
*/
|
|
19
|
+
function Textarea({ size = "md", invalid, id, disabled, required, rows = 3, className, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }) {
|
|
20
|
+
const control = useFieldControl({
|
|
21
|
+
id,
|
|
22
|
+
invalid,
|
|
23
|
+
disabled,
|
|
24
|
+
required,
|
|
25
|
+
"aria-describedby": ariaDescribedBy,
|
|
26
|
+
"aria-invalid": ariaInvalid
|
|
27
|
+
});
|
|
28
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
29
|
+
...props,
|
|
30
|
+
...control,
|
|
31
|
+
rows,
|
|
32
|
+
className: cn(sizeClass[size], inputBaseClass, "resize-y", className)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { Textarea };
|
package/dist/Toast.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Role } from "./types.js";
|
|
2
|
+
import { ComponentProps, MouseEvent, ReactElement, ReactNode } from "react";
|
|
3
|
+
/** Toast의 액션 버튼 */
|
|
4
|
+
export interface ToastAction {
|
|
5
|
+
/** 버튼 글자. 예: 「되돌리기」, 「다시 시도」 */
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* 누르면 부른다. 부른 뒤 Toast를 닫는다. `event.preventDefault()`를 부르면 닫지 않는다.
|
|
9
|
+
*/
|
|
10
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
11
|
+
}
|
|
12
|
+
/** `queue.add`에 넘기는 Toast 하나 */
|
|
13
|
+
export interface ToastOptions {
|
|
14
|
+
/** 제목. Toast의 이름이 되고 굵은 글자로 보인다. */
|
|
15
|
+
title: ReactNode;
|
|
16
|
+
/** 본문. Toast의 설명이 된다. */
|
|
17
|
+
description?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Role. Tide Role 6개와 앱이 `RoleRegistry`에 더한 Role을 받는다. 기본값은 `info`다(Alert와 같다).
|
|
20
|
+
* 상태 아이콘과 그 색을 정한다. 닫기·액션 버튼은 색과 관계없이 neutral이다. `danger`(오류)는 자동으로 닫지 않는다.
|
|
21
|
+
* 색 계열 이름(`blue` 등)은 받지 않는다(ADR 0016).
|
|
22
|
+
*/
|
|
23
|
+
color?: Role;
|
|
24
|
+
/** 액션 버튼. 있으면 자동으로 닫지 않는다. */
|
|
25
|
+
action?: ToastAction;
|
|
26
|
+
/**
|
|
27
|
+
* 자동으로 닫을 시간(ms). 기본값은 5000이고, 더 짧은 값은 5000으로 올린다. `null`이면 자동으로 닫지 않는다.
|
|
28
|
+
* 액션이 있거나 `color="danger"`면 이 값과 관계없이 자동으로 닫지 않는다.
|
|
29
|
+
* 시간은 영역에 마우스를 올리거나 포커스가 있는 동안 멈춘다.
|
|
30
|
+
*/
|
|
31
|
+
timeout?: number | null;
|
|
32
|
+
/** 닫힐 때(닫기 버튼, 액션, 자동 닫힘, `queue.close`) 부른다. */
|
|
33
|
+
onClose?: () => void;
|
|
34
|
+
/** 닫기 버튼 이름. 기본값은 `"닫기"`다. */
|
|
35
|
+
closeLabel?: string;
|
|
36
|
+
}
|
|
37
|
+
/** `new ToastQueue(options)`의 인자 */
|
|
38
|
+
export interface ToastQueueOptions {
|
|
39
|
+
/** 한 번에 보이는 Toast 수. 넘는 Toast는 앞의 것이 닫힐 때까지 기다린다. 기본값은 3이다. */
|
|
40
|
+
maxVisible?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Toast 큐. React 밖(모듈)에서 만들어 `ToastRegion`에 넘기고, 어디서든 `add`로 띄운다.
|
|
44
|
+
*
|
|
45
|
+
* ```tsx
|
|
46
|
+
* export const toasts = new ToastQueue();
|
|
47
|
+
* toasts.add({ title: "저장했습니다" });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare class ToastQueue {
|
|
51
|
+
constructor({ maxVisible }?: ToastQueueOptions);
|
|
52
|
+
/** Toast를 띄우고 key를 돌려준다. 새 Toast가 맨 앞(영역의 아래)에 온다. */
|
|
53
|
+
add(options: ToastOptions): string;
|
|
54
|
+
/** key의 Toast를 닫는다. */
|
|
55
|
+
close(key: string): void;
|
|
56
|
+
/** 모든 Toast를 닫는다. 기다리던 Toast도 빠진다. `onClose`는 부르지 않는다. */
|
|
57
|
+
clear(): void;
|
|
58
|
+
}
|
|
59
|
+
export interface ToastRegionProps extends Omit<ComponentProps<"div">, "children" | "role"> {
|
|
60
|
+
/** 그릴 큐(`new ToastQueue()`) */
|
|
61
|
+
queue: ToastQueue;
|
|
62
|
+
/**
|
|
63
|
+
* 영역(랜드마크) 이름. 기본값은 React Aria 번역 「N개 알림.」(locale을 따른다)이다.
|
|
64
|
+
*/
|
|
65
|
+
"aria-label"?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* `ToastQueue`의 Toast를 그리는 영역. 앱에 하나 둔다(보통 레이아웃의 client Component 안).
|
|
69
|
+
* Toast가 있을 때만 `document.body`에 portal하고, 없으면 아무것도 그리지 않는다.
|
|
70
|
+
*/
|
|
71
|
+
export declare function ToastRegion({ queue, ...props }: ToastRegionProps): ReactElement | null;
|