@tide-design/components 0.11.1 → 0.11.2
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/Accordion/Accordion.d.ts +24 -0
- package/dist/Accordion/Accordion.js +32 -0
- package/dist/Accordion/components/AccordionItem.d.ts +14 -0
- package/dist/Accordion/components/AccordionItem.js +51 -0
- package/dist/Accordion/components/AccordionPanel.d.ts +13 -0
- package/dist/Accordion/components/AccordionPanel.js +27 -0
- package/dist/Accordion/components/AccordionTrigger.d.ts +17 -0
- package/dist/Accordion/components/AccordionTrigger.js +39 -0
- package/dist/Accordion/constants/accordionClass.js +12 -0
- package/dist/Accordion/hooks/useAccordionContext.js +8 -0
- package/dist/Accordion/hooks/useAccordionItemContext.js +13 -0
- package/dist/Accordion/index.d.ts +6 -0
- package/dist/Accordion/types.d.ts +2 -0
- package/dist/{Alert.d.ts → Alert/Alert.d.ts} +1 -1
- package/dist/{Alert.js → Alert/Alert.js} +5 -5
- package/dist/Alert/index.d.ts +2 -0
- package/dist/{AlertDialog.d.ts → AlertDialog/AlertDialog.d.ts} +1 -1
- package/dist/{AlertDialog.js → AlertDialog/AlertDialog.js} +2 -2
- package/dist/AlertDialog/index.d.ts +2 -0
- package/dist/{Avatar.d.ts → Avatar/Avatar.d.ts} +1 -1
- package/dist/{Avatar.js → Avatar/Avatar.js} +2 -2
- package/dist/Avatar/index.d.ts +2 -0
- package/dist/{Badge.d.ts → Badge/Badge.d.ts} +1 -1
- package/dist/{Badge.js → Badge/Badge.js} +2 -2
- package/dist/Badge/index.d.ts +2 -0
- package/dist/Breadcrumb/Breadcrumb.d.ts +11 -0
- package/dist/Breadcrumb/Breadcrumb.js +21 -0
- package/dist/Breadcrumb/components/BreadcrumbCurrent.d.ts +4 -0
- package/dist/Breadcrumb/components/BreadcrumbCurrent.js +15 -0
- package/dist/Breadcrumb/components/BreadcrumbItem.d.ts +4 -0
- package/dist/Breadcrumb/components/BreadcrumbItem.js +16 -0
- package/dist/Breadcrumb/components/BreadcrumbLink.d.ts +10 -0
- package/dist/Breadcrumb/components/BreadcrumbLink.js +15 -0
- package/dist/Breadcrumb/constants/breadcrumbClass.js +8 -0
- package/dist/Breadcrumb/index.d.ts +5 -0
- package/dist/{Button.d.ts → Button/Button.d.ts} +3 -7
- package/dist/{Button.js → Button/Button.js} +8 -27
- package/dist/Button/components/Icon.js +13 -0
- package/dist/Button/constants/buttonClass.js +17 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Button/types.d.ts +5 -0
- package/dist/{Card.js → Card/Card.js} +2 -2
- package/dist/Card/index.d.ts +2 -0
- package/dist/{Checkbox.d.ts → Checkbox/Checkbox.d.ts} +2 -2
- package/dist/{Checkbox.js → Checkbox/Checkbox.js} +5 -5
- package/dist/Checkbox/index.d.ts +2 -0
- package/dist/{CheckboxGroup.d.ts → CheckboxGroup/CheckboxGroup.d.ts} +3 -3
- package/dist/{CheckboxGroup.js → CheckboxGroup/CheckboxGroup.js} +6 -10
- package/dist/CheckboxGroup/index.d.ts +3 -0
- package/dist/{Combobox.d.ts → Combobox/Combobox.d.ts} +2 -17
- package/dist/{Combobox.js → Combobox/Combobox.js} +10 -99
- package/dist/Combobox/components/ComboboxItem.d.ts +9 -0
- package/dist/Combobox/components/ComboboxItem.js +17 -0
- package/dist/Combobox/components/ComboboxPopover.js +23 -0
- package/dist/Combobox/components/ComboboxPopoverInner.js +50 -0
- package/dist/Combobox/components/ComboboxSection.d.ts +7 -0
- package/dist/Combobox/components/ComboboxSection.js +15 -0
- package/dist/Combobox/constants/comboboxClass.js +21 -0
- package/dist/Combobox/index.d.ts +4 -0
- package/dist/Dialog/Dialog.d.ts +8 -0
- package/dist/Dialog/Dialog.js +18 -0
- package/dist/Dialog/components/DialogClose.d.ts +13 -0
- package/dist/Dialog/components/DialogClose.js +35 -0
- package/dist/Dialog/components/DialogContent.d.ts +15 -0
- package/dist/Dialog/components/DialogContent.js +31 -0
- package/dist/Dialog/components/DialogContentInner.js +68 -0
- package/dist/Dialog/components/DialogDescription.d.ts +7 -0
- package/dist/Dialog/components/DialogDescription.js +23 -0
- package/dist/Dialog/components/DialogFooter.d.ts +4 -0
- package/dist/Dialog/components/DialogFooter.js +13 -0
- package/dist/Dialog/components/DialogTitle.d.ts +7 -0
- package/dist/Dialog/components/DialogTitle.js +23 -0
- package/dist/Dialog/components/DialogTrigger.d.ts +13 -0
- package/dist/Dialog/components/DialogTrigger.js +49 -0
- package/dist/Dialog/constants/dialogClass.js +12 -0
- package/dist/Dialog/hooks/useDialogPartsContext.js +13 -0
- package/dist/Dialog/hooks/usePartId.js +17 -0
- package/dist/Dialog/index.d.ts +10 -0
- package/dist/Dialog/types.d.ts +2 -0
- package/dist/{Field.js → Field/Field.js} +3 -3
- package/dist/Field/index.d.ts +2 -0
- package/dist/{IconButton.d.ts → IconButton/IconButton.d.ts} +1 -1
- package/dist/{IconButton.js → IconButton/IconButton.js} +5 -5
- package/dist/IconButton/index.d.ts +2 -0
- package/dist/{Input.d.ts → Input/Input.d.ts} +1 -1
- package/dist/{Input.js → Input/Input.js} +4 -4
- package/dist/Input/index.d.ts +2 -0
- package/dist/{Link.d.ts → Link/Link.d.ts} +1 -1
- package/dist/{Link.js → Link/Link.js} +2 -2
- package/dist/Link/index.d.ts +2 -0
- package/dist/Menu/Menu.d.ts +16 -0
- package/dist/Menu/Menu.js +43 -0
- package/dist/Menu/components/MenuContent.d.ts +16 -0
- package/dist/Menu/components/MenuContent.js +30 -0
- package/dist/Menu/components/MenuContentInner.js +67 -0
- package/dist/Menu/components/MenuItem.d.ts +17 -0
- package/dist/Menu/components/MenuItem.js +16 -0
- package/dist/Menu/components/MenuItemView.js +34 -0
- package/dist/Menu/components/MenuSection.d.ts +13 -0
- package/dist/Menu/components/MenuSection.js +15 -0
- package/dist/Menu/components/MenuSectionView.js +33 -0
- package/dist/Menu/components/MenuTrigger.d.ts +13 -0
- package/dist/Menu/components/MenuTrigger.js +53 -0
- package/dist/Menu/hooks/useMenuContext.js +13 -0
- package/dist/Menu/index.d.ts +7 -0
- package/dist/Menu/types.d.ts +4 -0
- package/dist/Pagination/Pagination.d.ts +11 -0
- package/dist/Pagination/Pagination.js +21 -0
- package/dist/Pagination/components/PaginationEllipsis.d.ts +7 -0
- package/dist/Pagination/components/PaginationEllipsis.js +17 -0
- package/dist/Pagination/components/PaginationItem.d.ts +4 -0
- package/dist/Pagination/components/PaginationItem.js +9 -0
- package/dist/Pagination/components/PaginationLink.d.ts +15 -0
- package/dist/Pagination/components/PaginationLink.js +23 -0
- package/dist/Pagination/components/PaginationNext.d.ts +5 -0
- package/dist/Pagination/components/PaginationNext.js +18 -0
- package/dist/Pagination/components/PaginationPrevious.d.ts +5 -0
- package/dist/Pagination/components/PaginationPrevious.js +18 -0
- package/dist/Pagination/constants/paginationClass.js +6 -0
- package/dist/Pagination/index.d.ts +7 -0
- package/dist/Pagination/types.d.ts +6 -0
- package/dist/Popover/Popover.d.ts +16 -0
- package/dist/Popover/Popover.js +43 -0
- package/dist/Popover/components/PopoverContent.d.ts +14 -0
- package/dist/Popover/components/PopoverContent.js +30 -0
- package/dist/Popover/components/PopoverContentInner.js +48 -0
- package/dist/Popover/components/PopoverTrigger.d.ts +13 -0
- package/dist/Popover/components/PopoverTrigger.js +51 -0
- package/dist/Popover/constants/popoverClass.js +6 -0
- package/dist/Popover/hooks/usePopoverContext.js +13 -0
- package/dist/Popover/index.d.ts +5 -0
- package/dist/Popover/types.d.ts +3 -0
- package/dist/{Progress.d.ts → Progress/Progress.d.ts} +1 -1
- package/dist/{Progress.js → Progress/Progress.js} +2 -2
- package/dist/Progress/index.d.ts +2 -0
- package/dist/{Radio.d.ts → Radio/Radio.d.ts} +2 -2
- package/dist/{Radio.js → Radio/Radio.js} +5 -5
- package/dist/Radio/index.d.ts +2 -0
- package/dist/{RadioGroup.d.ts → RadioGroup/RadioGroup.d.ts} +1 -1
- package/dist/{RadioGroup.js → RadioGroup/RadioGroup.js} +5 -5
- package/dist/RadioGroup/index.d.ts +2 -0
- package/dist/{Select.d.ts → Select/Select.d.ts} +2 -17
- package/dist/Select/Select.js +97 -0
- package/dist/Select/components/SelectItem.d.ts +9 -0
- package/dist/Select/components/SelectItem.js +17 -0
- package/dist/Select/components/SelectPopover.js +23 -0
- package/dist/Select/components/SelectPopoverInner.js +51 -0
- package/dist/Select/components/SelectSection.d.ts +7 -0
- package/dist/Select/components/SelectSection.js +15 -0
- package/dist/Select/constants/selectClass.js +7 -0
- package/dist/Select/index.d.ts +4 -0
- package/dist/{Separator.js → Separator/Separator.js} +2 -2
- package/dist/Separator/index.d.ts +2 -0
- package/dist/{Skeleton.d.ts → Skeleton/Skeleton.d.ts} +1 -1
- package/dist/{Skeleton.js → Skeleton/Skeleton.js} +2 -2
- package/dist/Skeleton/index.d.ts +2 -0
- package/dist/{Spinner.d.ts → Spinner/Spinner.d.ts} +1 -1
- package/dist/{Spinner.js → Spinner/Spinner.js} +2 -2
- package/dist/Spinner/index.d.ts +2 -0
- package/dist/{Switch.d.ts → Switch/Switch.d.ts} +1 -1
- package/dist/{Switch.js → Switch/Switch.js} +3 -3
- package/dist/Switch/index.d.ts +2 -0
- package/dist/Table/Table.d.ts +7 -0
- package/dist/Table/Table.js +17 -0
- package/dist/Table/components/TableBody.d.ts +4 -0
- package/dist/Table/components/TableBody.js +9 -0
- package/dist/Table/components/TableCell.d.ts +4 -0
- package/dist/Table/components/TableCell.js +14 -0
- package/dist/Table/components/TableHead.d.ts +4 -0
- package/dist/Table/components/TableHead.js +9 -0
- package/dist/Table/components/TableHeaderCell.d.ts +13 -0
- package/dist/Table/components/TableHeaderCell.js +18 -0
- package/dist/Table/components/TableRow.d.ts +4 -0
- package/dist/Table/components/TableRow.js +14 -0
- package/dist/Table/constants/tableClass.js +7 -0
- package/dist/Table/index.d.ts +7 -0
- package/dist/Tabs/Tabs.d.ts +34 -0
- package/dist/Tabs/Tabs.js +56 -0
- package/dist/Tabs/components/Tab.d.ts +12 -0
- package/dist/Tabs/components/Tab.js +16 -0
- package/dist/Tabs/components/TabList.d.ts +10 -0
- package/dist/Tabs/components/TabList.js +47 -0
- package/dist/Tabs/components/TabPanel.d.ts +10 -0
- package/dist/Tabs/components/TabPanel.js +27 -0
- package/dist/Tabs/components/TabView.js +29 -0
- package/dist/Tabs/constants/tabsClass.js +23 -0
- package/dist/Tabs/hooks/useTabsContext.js +13 -0
- package/dist/Tabs/index.d.ts +6 -0
- package/dist/Tabs/types.d.ts +5 -0
- package/dist/Tag/Tag.d.ts +18 -0
- package/dist/Tag/Tag.js +15 -0
- package/dist/{Tag.d.ts → Tag/components/TagGroup.d.ts} +0 -17
- package/dist/Tag/components/TagGroup.js +49 -0
- package/dist/Tag/components/TagView.js +49 -0
- package/dist/Tag/constants/tagClass.js +13 -0
- package/dist/Tag/hooks/useTagGroupContext.js +8 -0
- package/dist/Tag/index.d.ts +3 -0
- package/dist/{Textarea.d.ts → Textarea/Textarea.d.ts} +1 -1
- package/dist/{Textarea.js → Textarea/Textarea.js} +4 -4
- package/dist/Textarea/index.d.ts +2 -0
- package/dist/Toast/Toast.d.ts +15 -0
- package/dist/Toast/Toast.js +43 -0
- package/dist/Toast/components/Region.js +28 -0
- package/dist/Toast/components/ToastItem.js +82 -0
- package/dist/Toast/constants/toastClass.js +8 -0
- package/dist/Toast/index.d.ts +4 -0
- package/dist/Toast/libs/mergeEntries.js +19 -0
- package/dist/Toast/libs/toastQueue.d.ts +20 -0
- package/dist/Toast/libs/toastQueue.js +49 -0
- package/dist/{Toast.d.ts → Toast/types.d.ts} +4 -33
- package/dist/Tooltip/Tooltip.d.ts +25 -0
- package/dist/Tooltip/Tooltip.js +42 -0
- package/dist/Tooltip/components/TooltipContent.d.ts +14 -0
- package/dist/Tooltip/components/TooltipContent.js +31 -0
- package/dist/Tooltip/components/TooltipContentInner.js +43 -0
- package/dist/Tooltip/components/TooltipTrigger.d.ts +14 -0
- package/dist/Tooltip/components/TooltipTrigger.js +38 -0
- package/dist/Tooltip/constants/tooltipClass.js +6 -0
- package/dist/Tooltip/hooks/useTooltipContext.js +13 -0
- package/dist/Tooltip/index.d.ts +5 -0
- package/dist/Tooltip/types.d.ts +3 -0
- package/dist/{Typography.js → Typography/Typography.js} +2 -2
- package/dist/Typography/index.d.ts +2 -0
- package/dist/{VisuallyHidden.js → VisuallyHidden/VisuallyHidden.js} +2 -2
- package/dist/VisuallyHidden/index.d.ts +2 -0
- package/dist/_internal/components/DialogRoot.d.ts +11 -0
- package/dist/_internal/components/DialogRoot.js +41 -0
- package/dist/_internal/components/ListBoxNodes/ListBoxNodes.js +35 -0
- package/dist/_internal/components/ListBoxNodes/components/ListBoxOptionView.js +42 -0
- package/dist/_internal/components/ListBoxNodes/components/ListBoxSectionView.js +33 -0
- package/dist/{components/ListBoxNodes.d.ts → _internal/components/ListBoxNodes/types.d.ts} +1 -1
- package/dist/{components → _internal/components}/OverlayPortal.js +1 -1
- package/dist/{constants → _internal/constants}/alertClass.js +1 -1
- package/dist/{constants → _internal/constants}/choiceClass.js +1 -1
- package/dist/_internal/constants/choiceGroupClass.d.ts +2 -0
- package/dist/_internal/constants/choiceGroupClass.js +8 -0
- package/dist/{constants → _internal/constants}/inputClass.d.ts +1 -1
- package/dist/{constants → _internal/constants}/inputClass.js +1 -1
- package/dist/{constants → _internal/constants}/listClass.js +1 -1
- package/dist/{constants → _internal/constants}/overlayClass.js +1 -1
- package/dist/{constants → _internal/constants}/pressableClass.js +1 -1
- package/dist/{hooks → _internal/hooks}/useChoiceGroup.js +1 -1
- package/dist/{hooks → _internal/hooks}/useCloseOnTab.js +1 -1
- package/dist/_internal/hooks/useDialogContext.js +14 -0
- package/dist/{hooks → _internal/hooks}/useFieldControl.js +1 -1
- package/dist/{hooks → _internal/hooks}/useOverlayPresence.js +1 -1
- package/dist/{hooks → _internal/hooks}/useOverlayTheme.js +1 -1
- package/dist/{hooks → _internal/hooks}/usePopoverOverlay.js +1 -1
- package/dist/{libs → _internal/libs}/alertStatusIcon.js +1 -1
- package/dist/{libs → _internal/libs}/cn.js +1 -1
- package/dist/{libs → _internal/libs}/listCollection.js +1 -1
- package/dist/{libs → _internal/libs}/overlayPosition.js +1 -1
- package/dist/{libs → _internal/libs}/pressableState.js +1 -1
- package/dist/{libs → _internal/libs}/renderElement.js +1 -1
- package/dist/index.d.ts +119 -36
- package/dist/index.js +75 -36
- package/package.json +3 -3
- package/dist/Accordion.d.ts +0 -66
- package/dist/Accordion.js +0 -127
- package/dist/Breadcrumb.d.ts +0 -26
- package/dist/Breadcrumb.js +0 -53
- package/dist/Dialog.d.ts +0 -70
- package/dist/Dialog.js +0 -257
- package/dist/Menu.d.ts +0 -72
- package/dist/Menu.js +0 -230
- package/dist/Pagination.d.ts +0 -46
- package/dist/Pagination.js +0 -79
- package/dist/Popover.d.ts +0 -43
- package/dist/Popover.js +0 -150
- package/dist/Select.js +0 -173
- package/dist/Table.d.ts +0 -31
- package/dist/Table.js +0 -53
- package/dist/Tabs.d.ts +0 -66
- package/dist/Tabs.js +0 -159
- package/dist/Tag.js +0 -102
- package/dist/Toast.js +0 -193
- package/dist/Tooltip.d.ts +0 -53
- package/dist/Tooltip.js +0 -132
- package/dist/components/ListBoxNodes.js +0 -90
- /package/dist/{Card.d.ts → Card/Card.d.ts} +0 -0
- /package/dist/{Field.d.ts → Field/Field.d.ts} +0 -0
- /package/dist/{Separator.d.ts → Separator/Separator.d.ts} +0 -0
- /package/dist/{Typography.d.ts → Typography/Typography.d.ts} +0 -0
- /package/dist/{VisuallyHidden.d.ts → VisuallyHidden/VisuallyHidden.d.ts} +0 -0
- /package/dist/{constants → _internal/constants}/choiceClass.d.ts +0 -0
- /package/dist/{libs → _internal/libs}/cn.d.ts +0 -0
- /package/dist/{libs → _internal/libs}/listCollection.d.ts +0 -0
- /package/dist/{libs → _internal/libs}/overlayPosition.d.ts +0 -0
package/dist/Toast.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { alertCloseClass, alertContentClass, alertDescriptionClass, alertIconClass, alertLayoutClass, alertTitleClass } from "./constants/alertClass.js";
|
|
4
|
-
import { alertStatusIcon } from "./libs/alertStatusIcon.js";
|
|
5
|
-
import { Button } from "./Button.js";
|
|
6
|
-
import { cn } from "./libs/cn.js";
|
|
7
|
-
import { IconButton } from "./IconButton.js";
|
|
8
|
-
import { OverlayPortal } from "./components/OverlayPortal.js";
|
|
9
|
-
import { useOverlayPresence } from "./hooks/useOverlayPresence.js";
|
|
10
|
-
import { overlaySurfaceClass, popoverMotionClass } from "./constants/overlayClass.js";
|
|
11
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
13
|
-
import { XIcon } from "@tide-design/icons";
|
|
14
|
-
import { mergeProps, mergeRefs, useToast, useToastRegion } from "react-aria";
|
|
15
|
-
import { ToastQueue, useToastQueue } from "react-stately";
|
|
16
|
-
|
|
17
|
-
// src/Toast.tsx
|
|
18
|
-
/** 자동으로 닫히는 Toast가 보이는 가장 짧은 시간(ms). React Aria 문서가 권하는 최소값과 같다. */
|
|
19
|
-
const minTimeout = 5e3;
|
|
20
|
-
const statelyQueues = /* @__PURE__ */ new WeakMap();
|
|
21
|
-
/** 자동 닫힘 시간. `undefined`면 자동으로 닫지 않는다. */
|
|
22
|
-
function resolveTimeout(options) {
|
|
23
|
-
if (options.action !== void 0 || options.color === "danger") return void 0;
|
|
24
|
-
const timeout = options.timeout === void 0 ? minTimeout : options.timeout;
|
|
25
|
-
if (timeout === null || !Number.isFinite(timeout)) return void 0;
|
|
26
|
-
return Math.max(timeout, minTimeout);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Toast 큐. React 밖(모듈)에서 만들어 `ToastRegion`에 넘기고, 어디서든 `add`로 띄운다.
|
|
30
|
-
*
|
|
31
|
-
* ```tsx
|
|
32
|
-
* export const toasts = new ToastQueue();
|
|
33
|
-
* toasts.add({ title: "저장했습니다" });
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
var ToastQueue$1 = class {
|
|
37
|
-
constructor({ maxVisible = 3 } = {}) {
|
|
38
|
-
statelyQueues.set(this, new ToastQueue({ maxVisibleToasts: maxVisible }));
|
|
39
|
-
}
|
|
40
|
-
/** Toast를 띄우고 key를 돌려준다. 새 Toast가 맨 앞(영역의 아래)에 온다. */
|
|
41
|
-
add(options) {
|
|
42
|
-
const { timeout: _timeout, onClose, ...content } = options;
|
|
43
|
-
return queueOf(this).add(content, {
|
|
44
|
-
timeout: resolveTimeout(options),
|
|
45
|
-
onClose
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
/** key의 Toast를 닫는다. */
|
|
49
|
-
close(key) {
|
|
50
|
-
queueOf(this).close(key);
|
|
51
|
-
}
|
|
52
|
-
/** 모든 Toast를 닫는다. 기다리던 Toast도 빠진다. `onClose`는 부르지 않는다. */
|
|
53
|
-
clear() {
|
|
54
|
-
queueOf(this).clear();
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
function queueOf(queue) {
|
|
58
|
-
const stately = statelyQueues.get(queue);
|
|
59
|
-
if (!stately) throw new Error("ToastRegion의 queue에는 new ToastQueue()로 만든 큐를 넘긴다.");
|
|
60
|
-
return stately;
|
|
61
|
-
}
|
|
62
|
-
const regionClass = "fixed end-4 bottom-4 isolate z-toast flex w-[calc(100%-2rem)] max-w-96 flex-col-reverse gap-2 rounded-lg outline-none focus-visible:focus-ring";
|
|
63
|
-
const toastClass = `${alertLayoutClass} ${overlaySurfaceClass} ${popoverMotionClass} outline-none focus-visible:focus-ring`;
|
|
64
|
-
/** 보이는 Toast 목록에 퇴장 중인 Toast를 원래 자리에 끼워 넣는다. */
|
|
65
|
-
function mergeEntries(previous, visible) {
|
|
66
|
-
const visibleKeys = new Set(visible.map((toast) => toast.key));
|
|
67
|
-
const next = visible.map((toast) => ({
|
|
68
|
-
toast,
|
|
69
|
-
open: true
|
|
70
|
-
}));
|
|
71
|
-
previous.forEach((entry, index) => {
|
|
72
|
-
if (visibleKeys.has(entry.toast.key)) return;
|
|
73
|
-
next.splice(Math.min(index, next.length), 0, {
|
|
74
|
-
toast: entry.toast,
|
|
75
|
-
open: false
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
return next;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* `ToastQueue`의 Toast를 그리는 영역. 앱에 하나 둔다(보통 레이아웃의 client Component 안).
|
|
82
|
-
* Toast가 있을 때만 `document.body`에 portal하고, 없으면 아무것도 그리지 않는다.
|
|
83
|
-
*/
|
|
84
|
-
function ToastRegion({ queue, ...props }) {
|
|
85
|
-
const state = useToastQueue(queueOf(queue));
|
|
86
|
-
const [entries, setEntries] = useState(() => state.visibleToasts.map((toast) => ({
|
|
87
|
-
toast,
|
|
88
|
-
open: true
|
|
89
|
-
})));
|
|
90
|
-
const [visible, setVisible] = useState(state.visibleToasts);
|
|
91
|
-
if (visible !== state.visibleToasts) {
|
|
92
|
-
setVisible(state.visibleToasts);
|
|
93
|
-
setEntries(mergeEntries(entries, state.visibleToasts));
|
|
94
|
-
}
|
|
95
|
-
const onExited = useCallback((key) => {
|
|
96
|
-
setEntries((current) => current.filter((entry) => entry.open || entry.toast.key !== key));
|
|
97
|
-
}, []);
|
|
98
|
-
if (entries.length === 0) return null;
|
|
99
|
-
return /* @__PURE__ */ jsx(OverlayPortal, {
|
|
100
|
-
isExiting: false,
|
|
101
|
-
focusManagement: false,
|
|
102
|
-
children: /* @__PURE__ */ jsx(Region, {
|
|
103
|
-
...props,
|
|
104
|
-
state,
|
|
105
|
-
entries,
|
|
106
|
-
onExited
|
|
107
|
-
})
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
function Region({ state, entries, onExited, ref, className, "aria-label": ariaLabel, ...props }) {
|
|
111
|
-
const regionRef = useRef(null);
|
|
112
|
-
const mergedRef = useMemo(() => mergeRefs(ref, regionRef), [ref]);
|
|
113
|
-
const { regionProps } = useToastRegion({ "aria-label": ariaLabel }, state, regionRef);
|
|
114
|
-
return /* @__PURE__ */ jsx("div", {
|
|
115
|
-
...mergeProps(props, regionProps),
|
|
116
|
-
ref: mergedRef,
|
|
117
|
-
className: cn(regionClass, className),
|
|
118
|
-
children: entries.map((entry) => /* @__PURE__ */ jsx(ToastItem, {
|
|
119
|
-
toast: entry.toast,
|
|
120
|
-
open: entry.open,
|
|
121
|
-
state,
|
|
122
|
-
onExited
|
|
123
|
-
}, entry.toast.key))
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function ToastItem({ toast, open, state, onExited }) {
|
|
127
|
-
const ref = useRef(null);
|
|
128
|
-
const present = useOverlayPresence(open, ref);
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
if (!present) onExited(toast.key);
|
|
131
|
-
}, [
|
|
132
|
-
present,
|
|
133
|
-
onExited,
|
|
134
|
-
toast.key
|
|
135
|
-
]);
|
|
136
|
-
const { toastProps, contentProps, titleProps, descriptionProps } = useToast({ toast }, state, ref);
|
|
137
|
-
const { title, description, color = "info", action, closeLabel = "닫기" } = toast.content;
|
|
138
|
-
const StatusIcon = alertStatusIcon(color);
|
|
139
|
-
const close = () => state.close(toast.key);
|
|
140
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
141
|
-
...open ? toastProps : {},
|
|
142
|
-
ref,
|
|
143
|
-
"data-color": color,
|
|
144
|
-
"data-open": open ? "" : void 0,
|
|
145
|
-
inert: !open,
|
|
146
|
-
"data-placement": "top",
|
|
147
|
-
className: toastClass,
|
|
148
|
-
children: [
|
|
149
|
-
/* @__PURE__ */ jsx(StatusIcon, {
|
|
150
|
-
size: 20,
|
|
151
|
-
"aria-hidden": "true",
|
|
152
|
-
className: `${alertIconClass} text-accent`
|
|
153
|
-
}),
|
|
154
|
-
/* @__PURE__ */ jsxs("div", {
|
|
155
|
-
className: "flex min-w-0 flex-1 flex-col gap-3",
|
|
156
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
157
|
-
...open ? contentProps : {},
|
|
158
|
-
className: alertContentClass,
|
|
159
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
160
|
-
...titleProps,
|
|
161
|
-
className: alertTitleClass,
|
|
162
|
-
children: title
|
|
163
|
-
}), description !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
164
|
-
...descriptionProps,
|
|
165
|
-
className: "text-body-sm",
|
|
166
|
-
children: description
|
|
167
|
-
})]
|
|
168
|
-
}), action !== void 0 && /* @__PURE__ */ jsx(Button, {
|
|
169
|
-
variant: "outline",
|
|
170
|
-
color: "neutral",
|
|
171
|
-
size: "sm",
|
|
172
|
-
className: "self-start",
|
|
173
|
-
onClick: (event) => {
|
|
174
|
-
action.onClick?.(event);
|
|
175
|
-
if (!event.defaultPrevented) close();
|
|
176
|
-
},
|
|
177
|
-
children: action.label
|
|
178
|
-
})]
|
|
179
|
-
}),
|
|
180
|
-
/* @__PURE__ */ jsx(IconButton, {
|
|
181
|
-
"aria-label": closeLabel,
|
|
182
|
-
variant: "ghost",
|
|
183
|
-
color: "neutral",
|
|
184
|
-
size: "xs",
|
|
185
|
-
onClick: close,
|
|
186
|
-
className: alertCloseClass,
|
|
187
|
-
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
188
|
-
})
|
|
189
|
-
]
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export { ToastQueue$1 as ToastQueue, ToastRegion };
|
package/dist/Tooltip.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { OverlayPlacement } from "./libs/overlayPosition.js";
|
|
2
|
-
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
3
|
-
/** Tooltip 설명의 위치. 앞은 트리거의 어느 쪽, 뒤는 그 변에서 맞출 끝이다. 공간이 모자라면 반대쪽으로 뒤집힌다. */
|
|
4
|
-
export type TooltipPlacement = OverlayPlacement;
|
|
5
|
-
export interface TooltipProps {
|
|
6
|
-
/** 열림 상태(제어). 주면 `onOpenChange`로 바꾼다. */
|
|
7
|
-
open?: boolean;
|
|
8
|
-
/** 처음 열림 상태(비제어). 기본값은 `false`다. */
|
|
9
|
-
defaultOpen?: boolean;
|
|
10
|
-
/** 열림 상태가 바뀌려 할 때 새 값으로 부른다. */
|
|
11
|
-
onOpenChange?: (open: boolean) => void;
|
|
12
|
-
/**
|
|
13
|
-
* 마우스를 올린 뒤 열릴 때까지 기다리는 시간(ms). 기본값은 `500`이다. 키보드 포커스는 기다리지 않는다.
|
|
14
|
-
* 한 Tooltip이 열린 뒤 잠깐(0.5초) 안에 다른 트리거로 옮기면 기다리지 않고 바로 연다.
|
|
15
|
-
*/
|
|
16
|
-
delay?: number;
|
|
17
|
-
/** 포인터가 트리거·설명을 떠난 뒤 닫힐 때까지 기다리는 시간(ms). 기본값은 `300`이다. 설명으로 옮겨 갈 틈이다. */
|
|
18
|
-
closeDelay?: number;
|
|
19
|
-
/** `true`면 열리지 않는다. 트리거는 그대로 동작한다. */
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
/** `TooltipTrigger`와 `TooltipContent` */
|
|
22
|
-
children: ReactNode;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* 트리거와 설명을 잇는 열림 상태. DOM 요소를 만들지 않는다.
|
|
26
|
-
* 안에 `TooltipTrigger` 하나와 `TooltipContent` 하나를 둔다.
|
|
27
|
-
*/
|
|
28
|
-
export declare function Tooltip({ open, defaultOpen, onOpenChange, delay, closeDelay, disabled, children }: TooltipProps): ReactElement;
|
|
29
|
-
export interface TooltipTriggerProps extends ComponentProps<"button"> {
|
|
30
|
-
/**
|
|
31
|
-
* 다른 요소로 렌더한다. 예: `render={<IconButton aria-label="복사" />}`, `render={<Button variant="ghost" />}`.
|
|
32
|
-
* props, ref, className, 이벤트 핸들러를 그 요소에 병합한다. 기본은 class 없는 `<button type="button">`이다.
|
|
33
|
-
* 포커스를 받을 수 있는 요소여야 키보드 사용자도 설명을 본다.
|
|
34
|
-
*/
|
|
35
|
-
render?: ReactElement;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Tooltip을 여는 요소. 마우스를 올리면 `delay` 뒤에, 키보드로 포커스하면 바로 열린다.
|
|
39
|
-
* 누르면(마우스, 터치, 키) 닫힌다. 열린 동안 `aria-describedby`에 설명 id가 더해진다.
|
|
40
|
-
*/
|
|
41
|
-
export declare function TooltipTrigger({ render, ref, className, "aria-describedby": describedBy, ...props }: TooltipTriggerProps): ReactElement;
|
|
42
|
-
export interface TooltipContentProps extends Omit<ComponentProps<"div">, "id" | "role"> {
|
|
43
|
-
/** 트리거 기준 위치. 기본값은 `top`(위, 가운데 맞춤)이다. 공간이 모자라면 반대쪽으로 뒤집힌다. */
|
|
44
|
-
placement?: TooltipPlacement;
|
|
45
|
-
/** 트리거와의 간격(px). 기본값은 `4`다. */
|
|
46
|
-
offset?: number;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 트리거에 붙는 설명(`role="tooltip"`). 열릴 때만 `document.body`에 portal로 렌더하고 `z-tooltip`으로 쌓는다.
|
|
50
|
-
* 바로 나타나고, 닫히면 opacity만 `fast`(150ms)로 사라진다. 조작 요소(버튼, 링크)는 넣지 않는다.
|
|
51
|
-
* 열려 있으면 `data-open`이, 트리거 기준 방향이 `data-placement`(`top`/`bottom`/`left`/`right`)로 붙는다.
|
|
52
|
-
*/
|
|
53
|
-
export declare function TooltipContent(props: TooltipContentProps): ReactElement | null;
|
package/dist/Tooltip.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { cn } from "./libs/cn.js";
|
|
4
|
-
import { OverlayPortal } from "./components/OverlayPortal.js";
|
|
5
|
-
import { overlayPositionProps } from "./libs/overlayPosition.js";
|
|
6
|
-
import { useOverlayPresence } from "./hooks/useOverlayPresence.js";
|
|
7
|
-
import { useOverlayTheme } from "./hooks/useOverlayTheme.js";
|
|
8
|
-
import { frequentMotionClass, overlaySurfaceClass } from "./constants/overlayClass.js";
|
|
9
|
-
import { renderElement } from "./libs/renderElement.js";
|
|
10
|
-
import { jsx } from "react/jsx-runtime";
|
|
11
|
-
import { createContext, createElement, use, useMemo, useRef } from "react";
|
|
12
|
-
import { mergeProps, mergeRefs, useOverlayPosition, useTooltip, useTooltipTrigger } from "react-aria";
|
|
13
|
-
import { useTooltipTriggerState } from "react-stately";
|
|
14
|
-
|
|
15
|
-
// src/Tooltip.tsx
|
|
16
|
-
const TooltipContext = createContext(null);
|
|
17
|
-
function useTooltipContext(part) {
|
|
18
|
-
const context = use(TooltipContext);
|
|
19
|
-
if (!context) throw new Error(`${part}는 Tooltip 안에 둔다.`);
|
|
20
|
-
return context;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 트리거와 설명을 잇는 열림 상태. DOM 요소를 만들지 않는다.
|
|
24
|
-
* 안에 `TooltipTrigger` 하나와 `TooltipContent` 하나를 둔다.
|
|
25
|
-
*/
|
|
26
|
-
function Tooltip({ open, defaultOpen, onOpenChange, delay = 500, closeDelay = 300, disabled, children }) {
|
|
27
|
-
const options = {
|
|
28
|
-
isOpen: open,
|
|
29
|
-
defaultOpen,
|
|
30
|
-
onOpenChange,
|
|
31
|
-
delay,
|
|
32
|
-
closeDelay,
|
|
33
|
-
isDisabled: disabled
|
|
34
|
-
};
|
|
35
|
-
const state = useTooltipTriggerState(options);
|
|
36
|
-
const triggerRef = useRef(null);
|
|
37
|
-
const { triggerProps, tooltipProps } = useTooltipTrigger(options, state, triggerRef);
|
|
38
|
-
const value = useMemo(() => ({
|
|
39
|
-
state,
|
|
40
|
-
triggerRef,
|
|
41
|
-
triggerProps,
|
|
42
|
-
tooltipId: tooltipProps.id
|
|
43
|
-
}), [
|
|
44
|
-
state,
|
|
45
|
-
triggerProps,
|
|
46
|
-
tooltipProps.id
|
|
47
|
-
]);
|
|
48
|
-
return /* @__PURE__ */ jsx(TooltipContext, {
|
|
49
|
-
value,
|
|
50
|
-
children
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Tooltip을 여는 요소. 마우스를 올리면 `delay` 뒤에, 키보드로 포커스하면 바로 열린다.
|
|
55
|
-
* 누르면(마우스, 터치, 키) 닫힌다. 열린 동안 `aria-describedby`에 설명 id가 더해진다.
|
|
56
|
-
*/
|
|
57
|
-
function TooltipTrigger({ render, ref, className, "aria-describedby": describedBy, ...props }) {
|
|
58
|
-
const { triggerRef, triggerProps } = useTooltipContext("TooltipTrigger");
|
|
59
|
-
const { tabIndex: _tabIndex, "aria-describedby": tooltipDescribedBy, ...ariaProps } = triggerProps;
|
|
60
|
-
const mergedRef = useMemo(() => mergeRefs(ref, triggerRef), [ref, triggerRef]);
|
|
61
|
-
const merged = {
|
|
62
|
-
...mergeProps(props, ariaProps),
|
|
63
|
-
"aria-describedby": [describedBy, tooltipDescribedBy].filter(Boolean).join(" ") || void 0,
|
|
64
|
-
ref: mergedRef
|
|
65
|
-
};
|
|
66
|
-
if (!render) return createElement("button", {
|
|
67
|
-
type: "button",
|
|
68
|
-
...merged,
|
|
69
|
-
className
|
|
70
|
-
});
|
|
71
|
-
return renderElement({
|
|
72
|
-
defaultElement: "button",
|
|
73
|
-
render,
|
|
74
|
-
baseClassName: "",
|
|
75
|
-
props: {
|
|
76
|
-
...merged,
|
|
77
|
-
className
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
const contentClass = `isolate z-tooltip max-w-60 px-2 py-1 text-body-sm ${overlaySurfaceClass} ${frequentMotionClass}`;
|
|
82
|
-
/**
|
|
83
|
-
* 트리거에 붙는 설명(`role="tooltip"`). 열릴 때만 `document.body`에 portal로 렌더하고 `z-tooltip`으로 쌓는다.
|
|
84
|
-
* 바로 나타나고, 닫히면 opacity만 `fast`(150ms)로 사라진다. 조작 요소(버튼, 링크)는 넣지 않는다.
|
|
85
|
-
* 열려 있으면 `data-open`이, 트리거 기준 방향이 `data-placement`(`top`/`bottom`/`left`/`right`)로 붙는다.
|
|
86
|
-
*/
|
|
87
|
-
function TooltipContent(props) {
|
|
88
|
-
const context = useTooltipContext("TooltipContent");
|
|
89
|
-
const tooltipRef = useRef(null);
|
|
90
|
-
if (!useOverlayPresence(context.state.isOpen, tooltipRef)) return null;
|
|
91
|
-
return /* @__PURE__ */ jsx(OverlayPortal, {
|
|
92
|
-
isExiting: !context.state.isOpen,
|
|
93
|
-
focusManagement: false,
|
|
94
|
-
children: /* @__PURE__ */ jsx(TooltipContentInner, {
|
|
95
|
-
...props,
|
|
96
|
-
context,
|
|
97
|
-
tooltipRef
|
|
98
|
-
})
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
/** DOM에 있는 동안만 portal 안에서 렌더한다. 위치 hook은 요소가 있다고 보고 동작한다. */
|
|
102
|
-
function TooltipContentInner({ context, tooltipRef, placement = "top", offset = 4, ref, className, children, ...props }) {
|
|
103
|
-
const { state, triggerRef, tooltipId } = context;
|
|
104
|
-
useOverlayTheme(triggerRef, tooltipRef);
|
|
105
|
-
const position = useOverlayPosition({
|
|
106
|
-
targetRef: triggerRef,
|
|
107
|
-
overlayRef: tooltipRef,
|
|
108
|
-
placement,
|
|
109
|
-
offset,
|
|
110
|
-
isOpen: state.isOpen,
|
|
111
|
-
onClose: () => state.close(true)
|
|
112
|
-
});
|
|
113
|
-
const overlayProps = overlayPositionProps(position.overlayProps, position.placement, placement);
|
|
114
|
-
const { tooltipProps } = useTooltip({}, state);
|
|
115
|
-
const mergedRef = useMemo(() => mergeRefs(ref, tooltipRef), [ref, tooltipRef]);
|
|
116
|
-
const { style: _style, ...rest } = mergeProps(props, overlayProps, tooltipProps);
|
|
117
|
-
return /* @__PURE__ */ jsx("div", {
|
|
118
|
-
...rest,
|
|
119
|
-
id: tooltipId,
|
|
120
|
-
ref: mergedRef,
|
|
121
|
-
"data-open": state.isOpen ? "" : void 0,
|
|
122
|
-
"data-react-aria-top-layer": "",
|
|
123
|
-
className: cn(contentClass, !state.isOpen && state.shouldSkipAnimation && "transition-none", className),
|
|
124
|
-
style: {
|
|
125
|
-
...overlayProps.style,
|
|
126
|
-
...props.style
|
|
127
|
-
},
|
|
128
|
-
children
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export { Tooltip, TooltipContent, TooltipTrigger };
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { cn } from "../libs/cn.js";
|
|
4
|
-
import { listHeadingClass, listItemClass, listSeparatorClass } from "../constants/listClass.js";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { useMemo, useRef } from "react";
|
|
7
|
-
import { CheckIcon } from "@tide-design/icons";
|
|
8
|
-
import { mergeProps, mergeRefs, useListBoxSection, useOption } from "react-aria";
|
|
9
|
-
|
|
10
|
-
// src/components/ListBoxNodes.tsx
|
|
11
|
-
/**
|
|
12
|
-
* 고른 옵션 끝의 체크 아이콘. 장식용이다(선택은 `aria-selected`가 알린다). 배경(subtle-active)이 지워지는 고대비
|
|
13
|
-
* 모드에서도 고른 옵션이 보이게 한다. 글자와의 간격은 항목의 gap(8px)이고 `ms-auto`로 오른쪽 끝에 붙는다.
|
|
14
|
-
*/
|
|
15
|
-
const checkClass = "ms-auto";
|
|
16
|
-
/**
|
|
17
|
-
* 목록 상태의 옵션·묶음을 그린다. 묶음과 이웃한 옵션·묶음 사이에 장식용 구분선을 둔다. 목록의 처음·끝과 이어진
|
|
18
|
-
* 구분선은 그리지 않는다(Menu와 같다). listbox의 자식은 option·group만 될 수 있어(WAI-ARIA, axe
|
|
19
|
-
* aria-required-children) Menu와 달리 구분선은 `separator` 역할 없이 보조기술에서 숨긴다. 묶음 경계는 group이 알린다.
|
|
20
|
-
*/
|
|
21
|
-
function ListBoxNodes({ state }) {
|
|
22
|
-
const nodes = [...state.collection];
|
|
23
|
-
return nodes.map((node, index) => {
|
|
24
|
-
const previous = nodes[index - 1];
|
|
25
|
-
const separator = previous !== void 0 && (node.type === "section" || previous.type === "section");
|
|
26
|
-
const element = node.type === "section" ? /* @__PURE__ */ jsx(ListBoxSectionView, {
|
|
27
|
-
node,
|
|
28
|
-
state
|
|
29
|
-
}, node.key) : /* @__PURE__ */ jsx(ListBoxOptionView, {
|
|
30
|
-
node,
|
|
31
|
-
state
|
|
32
|
-
}, node.key);
|
|
33
|
-
if (!separator) return element;
|
|
34
|
-
return [/* @__PURE__ */ jsx("div", {
|
|
35
|
-
role: "presentation",
|
|
36
|
-
"aria-hidden": "true",
|
|
37
|
-
className: listSeparatorClass
|
|
38
|
-
}, `${String(node.key)}-separator`), element];
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/** 옵션 하나를 그린다. node.props는 앱이 옵션에 준 props(와 컬렉션이 더한 isDisabled)다. */
|
|
42
|
-
function ListBoxOptionView({ node, state }) {
|
|
43
|
-
const optionRef = useRef(null);
|
|
44
|
-
const { ref, className, value: _value, disabled: _disabled, textValue: _textValue, isDisabled: _isDisabled, children: _children, id: _id, ...props } = node.props;
|
|
45
|
-
const { optionProps, isFocused, isSelected, isDisabled } = useOption({
|
|
46
|
-
key: node.key,
|
|
47
|
-
"aria-label": props["aria-label"]
|
|
48
|
-
}, state, optionRef);
|
|
49
|
-
const mergedRef = useMemo(() => mergeRefs(ref, optionRef), [ref, optionRef]);
|
|
50
|
-
const merged = mergeProps(props, optionProps);
|
|
51
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
52
|
-
...merged,
|
|
53
|
-
ref: mergedRef,
|
|
54
|
-
"aria-labelledby": props["aria-labelledby"],
|
|
55
|
-
"aria-describedby": props["aria-describedby"],
|
|
56
|
-
"data-highlighted": isFocused ? "" : void 0,
|
|
57
|
-
"data-selected": isSelected ? "" : void 0,
|
|
58
|
-
"data-disabled": isDisabled ? "" : void 0,
|
|
59
|
-
className: cn(listItemClass, className),
|
|
60
|
-
children: [node.rendered, isSelected ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
61
|
-
size: 16,
|
|
62
|
-
className: checkClass
|
|
63
|
-
}) : null]
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/** 묶음 하나를 그린다. 제목은 보조기술에서 숨기고(`presentation`) 묶음의 이름으로만 쓴다(useListBoxSection). */
|
|
67
|
-
function ListBoxSectionView({ node, state }) {
|
|
68
|
-
const { className } = node.props;
|
|
69
|
-
const { itemProps, headingProps, groupProps } = useListBoxSection({
|
|
70
|
-
heading: node.rendered,
|
|
71
|
-
"aria-label": node["aria-label"]
|
|
72
|
-
});
|
|
73
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
74
|
-
...itemProps,
|
|
75
|
-
className,
|
|
76
|
-
children: [node.rendered != null && /* @__PURE__ */ jsx("div", {
|
|
77
|
-
...headingProps,
|
|
78
|
-
className: "px-2 pt-1.5 pb-1 text-label-sm text-muted select-none",
|
|
79
|
-
children: node.rendered
|
|
80
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
81
|
-
...groupProps,
|
|
82
|
-
children: [...node.childNodes].map((child) => /* @__PURE__ */ jsx(ListBoxOptionView, {
|
|
83
|
-
node: child,
|
|
84
|
-
state
|
|
85
|
-
}, child.key))
|
|
86
|
-
})]
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export { ListBoxNodes };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|