@tide-design/components 0.11.0 → 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 -4
- 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 -26
- 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 -96
- 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 -4
- 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/{listbox.d.ts → _internal/components/ListBoxNodes/types.d.ts} +1 -1
- package/dist/_internal/components/OverlayPortal.js +21 -0
- package/dist/{alert-style.js → _internal/constants/alertClass.js} +2 -16
- package/dist/{choice-style.js → _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/{input-style.d.ts → _internal/constants/inputClass.d.ts} +1 -1
- package/dist/{input-style.js → _internal/constants/inputClass.js} +1 -1
- package/dist/{list-style.js → _internal/constants/listClass.js} +2 -2
- package/dist/{overlay-style.js → _internal/constants/overlayClass.js} +1 -1
- package/dist/_internal/constants/pressableClass.js +33 -0
- package/dist/{choice-group.js → _internal/hooks/useChoiceGroup.js} +2 -2
- package/dist/_internal/hooks/useCloseOnTab.js +29 -0
- package/dist/_internal/hooks/useDialogContext.js +14 -0
- package/dist/{field-context.js → _internal/hooks/useFieldControl.js} +1 -1
- package/dist/_internal/hooks/useOverlayPresence.js +46 -0
- package/dist/_internal/hooks/useOverlayTheme.js +20 -0
- package/dist/_internal/hooks/usePopoverOverlay.js +25 -0
- package/dist/_internal/libs/alertStatusIcon.js +17 -0
- package/dist/{cn.js → _internal/libs/cn.js} +1 -1
- package/dist/{list-collection.js → _internal/libs/listCollection.js} +1 -1
- package/dist/{overlay.d.ts → _internal/libs/overlayPosition.d.ts} +0 -1
- package/dist/_internal/libs/overlayPosition.js +20 -0
- package/dist/_internal/libs/pressableState.js +43 -0
- package/dist/{render.js → _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 -255
- package/dist/Menu.d.ts +0 -72
- package/dist/Menu.js +0 -226
- 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 -147
- package/dist/Select.js +0 -169
- 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 -191
- package/dist/Tooltip.d.ts +0 -53
- package/dist/Tooltip.js +0 -129
- package/dist/listbox.js +0 -90
- package/dist/overlay.js +0 -130
- package/dist/pressable.js +0 -70
- /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/{choice-style.d.ts → _internal/constants/choiceClass.d.ts} +0 -0
- /package/dist/{cn.d.ts → _internal/libs/cn.d.ts} +0 -0
- /package/dist/{list-collection.d.ts → _internal/libs/listCollection.d.ts} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, use } from "react";
|
|
4
|
+
|
|
5
|
+
// src/Menu/hooks/useMenuContext.ts
|
|
6
|
+
const MenuContext = createContext(null);
|
|
7
|
+
function useMenuContext(part) {
|
|
8
|
+
const context = use(MenuContext);
|
|
9
|
+
if (!context) throw new Error(`${part}는 Menu 안에 둔다.`);
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { MenuContext, useMenuContext };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Menu, MenuProps } from "./Menu.js";
|
|
2
|
+
import { MenuTrigger, MenuTriggerProps } from "./components/MenuTrigger.js";
|
|
3
|
+
import { MenuContent, MenuContentProps } from "./components/MenuContent.js";
|
|
4
|
+
import { MenuItem, MenuItemProps } from "./components/MenuItem.js";
|
|
5
|
+
import { MenuSection, MenuSectionProps } from "./components/MenuSection.js";
|
|
6
|
+
import { MenuPlacement } from "./types.js";
|
|
7
|
+
export { Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, type MenuPlacement, type MenuProps, MenuSection, type MenuSectionProps, MenuTrigger, type MenuTriggerProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentProps, ReactElement } from "react";
|
|
2
|
+
export interface PaginationProps extends ComponentProps<"nav"> {
|
|
3
|
+
/** 탐색 영역 이름. 기본값은 `"페이지 이동"`이다. 한 화면에 목록이 여럿이면 `"댓글 페이지"`처럼 구분한다. */
|
|
4
|
+
"aria-label"?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 페이지 이동 탐색 영역. `<nav>` 안의 `<ul>`이다.
|
|
8
|
+
* 자식은 `PaginationItem`이고, 그 안에 `PaginationPrevious`·`PaginationLink`·`PaginationEllipsis`·`PaginationNext`를 둔다.
|
|
9
|
+
* `ref`·`className`은 `<nav>`에 붙는다.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Pagination({ "aria-label": ariaLabel, children, ...props }: PaginationProps): ReactElement;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { listClass } from "./constants/paginationClass.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
// src/Pagination/Pagination.tsx
|
|
5
|
+
/**
|
|
6
|
+
* 페이지 이동 탐색 영역. `<nav>` 안의 `<ul>`이다.
|
|
7
|
+
* 자식은 `PaginationItem`이고, 그 안에 `PaginationPrevious`·`PaginationLink`·`PaginationEllipsis`·`PaginationNext`를 둔다.
|
|
8
|
+
* `ref`·`className`은 `<nav>`에 붙는다.
|
|
9
|
+
*/
|
|
10
|
+
function Pagination({ "aria-label": ariaLabel = "페이지 이동", children, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
12
|
+
...props,
|
|
13
|
+
"aria-label": ariaLabel,
|
|
14
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
15
|
+
className: listClass,
|
|
16
|
+
children
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { Pagination };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
2
|
+
export interface PaginationEllipsisProps extends Omit<ComponentProps<"span">, "children"> {
|
|
3
|
+
/** 스크린리더가 읽는 텍스트. 화면에는 「…」 아이콘만 보인다. 기본값은 `"페이지 생략"`이다. */
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/** 생략된 번호 자리 `<span>`. 화면에는 「…」 아이콘, 스크린리더에는 텍스트(기본 `"페이지 생략"`)를 보인다. */
|
|
7
|
+
export declare function PaginationEllipsis({ className, children, ...props }: PaginationEllipsisProps): ReactElement;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cn } from "../../_internal/libs/cn.js";
|
|
2
|
+
import { VisuallyHidden } from "../../VisuallyHidden/VisuallyHidden.js";
|
|
3
|
+
import { ellipsisClass } from "../constants/paginationClass.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { EllipsisIcon } from "@tide-design/icons";
|
|
6
|
+
|
|
7
|
+
// src/Pagination/components/PaginationEllipsis.tsx
|
|
8
|
+
/** 생략된 번호 자리 `<span>`. 화면에는 「…」 아이콘, 스크린리더에는 텍스트(기본 `"페이지 생략"`)를 보인다. */
|
|
9
|
+
function PaginationEllipsis({ className, children = "페이지 생략", ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
11
|
+
...props,
|
|
12
|
+
className: cn(ellipsisClass, className),
|
|
13
|
+
children: [/* @__PURE__ */ jsx(EllipsisIcon, {}), /* @__PURE__ */ jsx(VisuallyHidden, { children })]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { PaginationEllipsis };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentProps, ReactElement } from "react";
|
|
2
|
+
export interface PaginationLinkProps extends Omit<ComponentProps<"a">, "color"> {
|
|
3
|
+
/** 현재 페이지인지. `aria-current="page"`를 붙이고 subtle 채움으로 보인다. 기본값은 `false`다. */
|
|
4
|
+
current?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* 다른 요소로 렌더한다. 예: `render={<NextLink href="?page=2" />}`.
|
|
7
|
+
* 상태로 페이지를 바꾸면 `render={<button type="button" onClick={...} />}`를 쓴다. props, ref, className을 병합한다.
|
|
8
|
+
*/
|
|
9
|
+
render?: ReactElement;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 페이지 번호 링크. 기본은 `<a>`이고 Button(ghost, 32px) 모양이다. 현재 페이지는 `current`를 준다.
|
|
13
|
+
* Next.js에서는 `render={<NextLink href="?page=2" />}`를 쓴다.
|
|
14
|
+
*/
|
|
15
|
+
export declare function PaginationLink({ current, render, className, ...props }: PaginationLinkProps): ReactElement;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Button } from "../../Button/Button.js";
|
|
2
|
+
import { cn } from "../../_internal/libs/cn.js";
|
|
3
|
+
import { linkClass } from "../constants/paginationClass.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
// src/Pagination/components/PaginationLink.tsx
|
|
7
|
+
/**
|
|
8
|
+
* 페이지 번호 링크. 기본은 `<a>`이고 Button(ghost, 32px) 모양이다. 현재 페이지는 `current`를 준다.
|
|
9
|
+
* Next.js에서는 `render={<NextLink href="?page=2" />}`를 쓴다.
|
|
10
|
+
*/
|
|
11
|
+
function PaginationLink({ current = false, render, className, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
13
|
+
...props,
|
|
14
|
+
render: render ?? /* @__PURE__ */ jsx("a", {}),
|
|
15
|
+
variant: current ? "subtle" : "ghost",
|
|
16
|
+
color: current ? "primary" : "neutral",
|
|
17
|
+
size: "sm",
|
|
18
|
+
"aria-current": current ? "page" : props["aria-current"],
|
|
19
|
+
className: cn(linkClass, className)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { PaginationLink };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PaginationArrowProps } from "../types.js";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
export interface PaginationNextProps extends PaginationArrowProps {}
|
|
4
|
+
/** 다음 페이지로 가는 IconButton(ghost, 32px, ›). 마지막 페이지에서는 `disabled`를 준다. */
|
|
5
|
+
export declare function PaginationNext({ "aria-label": ariaLabel, ...props }: PaginationNextProps): ReactElement;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IconButton } from "../../IconButton/IconButton.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronRightIcon } from "@tide-design/icons";
|
|
4
|
+
|
|
5
|
+
// src/Pagination/components/PaginationNext.tsx
|
|
6
|
+
/** 다음 페이지로 가는 IconButton(ghost, 32px, ›). 마지막 페이지에서는 `disabled`를 준다. */
|
|
7
|
+
function PaginationNext({ "aria-label": ariaLabel = "다음 페이지", ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
9
|
+
...props,
|
|
10
|
+
"aria-label": ariaLabel,
|
|
11
|
+
variant: "ghost",
|
|
12
|
+
color: "neutral",
|
|
13
|
+
size: "sm",
|
|
14
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { PaginationNext };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PaginationArrowProps } from "../types.js";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
export interface PaginationPreviousProps extends PaginationArrowProps {}
|
|
4
|
+
/** 이전 페이지로 가는 IconButton(ghost, 32px, ‹). 첫 페이지에서는 `disabled`를 준다. */
|
|
5
|
+
export declare function PaginationPrevious({ "aria-label": ariaLabel, ...props }: PaginationPreviousProps): ReactElement;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IconButton } from "../../IconButton/IconButton.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronLeftIcon } from "@tide-design/icons";
|
|
4
|
+
|
|
5
|
+
// src/Pagination/components/PaginationPrevious.tsx
|
|
6
|
+
/** 이전 페이지로 가는 IconButton(ghost, 32px, ‹). 첫 페이지에서는 `disabled`를 준다. */
|
|
7
|
+
function PaginationPrevious({ "aria-label": ariaLabel = "이전 페이지", ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
9
|
+
...props,
|
|
10
|
+
"aria-label": ariaLabel,
|
|
11
|
+
variant: "ghost",
|
|
12
|
+
color: "neutral",
|
|
13
|
+
size: "sm",
|
|
14
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { PaginationPrevious };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// src/Pagination/constants/paginationClass.ts
|
|
2
|
+
const listClass = "flex flex-wrap items-center gap-1";
|
|
3
|
+
const linkClass = "min-w-8 px-2 tabular-nums";
|
|
4
|
+
const ellipsisClass = "inline-flex size-8 items-center justify-center text-muted";
|
|
5
|
+
|
|
6
|
+
export { ellipsisClass, linkClass, listClass };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Pagination, PaginationProps } from "./Pagination.js";
|
|
2
|
+
import { PaginationItem, PaginationItemProps } from "./components/PaginationItem.js";
|
|
3
|
+
import { PaginationLink, PaginationLinkProps } from "./components/PaginationLink.js";
|
|
4
|
+
import { PaginationPrevious, PaginationPreviousProps } from "./components/PaginationPrevious.js";
|
|
5
|
+
import { PaginationNext, PaginationNextProps } from "./components/PaginationNext.js";
|
|
6
|
+
import { PaginationEllipsis, PaginationEllipsisProps } from "./components/PaginationEllipsis.js";
|
|
7
|
+
export { Pagination, PaginationEllipsis, type PaginationEllipsisProps, PaginationItem, type PaginationItemProps, PaginationLink, type PaginationLinkProps, PaginationNext, type PaginationNextProps, PaginationPrevious, type PaginationPreviousProps, type PaginationProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IconButtonProps } from "../IconButton/IconButton.js";
|
|
2
|
+
/** 이전/다음 항목 props. IconButton의 props에서 모양(variant·color·size)과 아이콘·로딩을 고정했다. */
|
|
3
|
+
export interface PaginationArrowProps extends Omit<IconButtonProps, "aria-label" | "children" | "variant" | "color" | "size" | "loading" | "loadingLabel"> {
|
|
4
|
+
/** 버튼 이름. 기본값은 이전 `"이전 페이지"`, 다음 `"다음 페이지"`다. */
|
|
5
|
+
"aria-label"?: string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
export interface PopoverProps {
|
|
3
|
+
/** 열림 상태(제어). 주면 `onOpenChange`로 바꾼다. */
|
|
4
|
+
open?: boolean;
|
|
5
|
+
/** 처음 열림 상태(비제어). 기본값은 `false`다. */
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
/** 열림 상태가 바뀌려 할 때 새 값으로 부른다. */
|
|
8
|
+
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
/** `PopoverTrigger`와 `PopoverContent` */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 트리거와 내용을 잇는 열림 상태. DOM 요소를 만들지 않는다.
|
|
14
|
+
* 안에 `PopoverTrigger` 하나와 `PopoverContent` 하나를 둔다.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Popover({ open, defaultOpen, onOpenChange, children }: PopoverProps): ReactElement;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { PopoverContext } from "./hooks/usePopoverContext.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useId, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { useOverlayTrigger } from "react-aria";
|
|
7
|
+
import { useOverlayTriggerState } from "react-stately";
|
|
8
|
+
|
|
9
|
+
// src/Popover/Popover.tsx
|
|
10
|
+
/**
|
|
11
|
+
* 트리거와 내용을 잇는 열림 상태. DOM 요소를 만들지 않는다.
|
|
12
|
+
* 안에 `PopoverTrigger` 하나와 `PopoverContent` 하나를 둔다.
|
|
13
|
+
*/
|
|
14
|
+
function Popover({ open, defaultOpen, onOpenChange, children }) {
|
|
15
|
+
const state = useOverlayTriggerState({
|
|
16
|
+
isOpen: open,
|
|
17
|
+
defaultOpen,
|
|
18
|
+
onOpenChange
|
|
19
|
+
});
|
|
20
|
+
const triggerRef = useRef(null);
|
|
21
|
+
const { triggerProps, overlayProps } = useOverlayTrigger({ type: "dialog" }, state, triggerRef);
|
|
22
|
+
const generatedTriggerId = useId();
|
|
23
|
+
const [triggerId, setTriggerId] = useState(generatedTriggerId);
|
|
24
|
+
const value = useMemo(() => ({
|
|
25
|
+
state,
|
|
26
|
+
triggerRef,
|
|
27
|
+
triggerProps,
|
|
28
|
+
contentId: overlayProps.id,
|
|
29
|
+
triggerId,
|
|
30
|
+
setTriggerId
|
|
31
|
+
}), [
|
|
32
|
+
state,
|
|
33
|
+
triggerProps,
|
|
34
|
+
overlayProps.id,
|
|
35
|
+
triggerId
|
|
36
|
+
]);
|
|
37
|
+
return /* @__PURE__ */ jsx(PopoverContext, {
|
|
38
|
+
value,
|
|
39
|
+
children
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { Popover };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PopoverPlacement } from "../types.js";
|
|
2
|
+
import { ComponentProps, ReactElement } from "react";
|
|
3
|
+
export interface PopoverContentProps extends Omit<ComponentProps<"div">, "id" | "role"> {
|
|
4
|
+
/** 트리거 기준 위치. 기본값은 `bottom`(아래, 가운데 맞춤)이다. 공간이 모자라면 반대쪽으로 뒤집힌다. */
|
|
5
|
+
placement?: PopoverPlacement;
|
|
6
|
+
/** 트리거와의 간격(px). 기본값은 `8`이다. */
|
|
7
|
+
offset?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 트리거 옆에 뜨는 내용(`role="dialog"`). 열릴 때만 `document.body`에 portal로 렌더하고 `z-popover`로 쌓는다.
|
|
11
|
+
* 등장은 opacity + blur 4px + 4px 이동(`normal`), 퇴장은 그 절반(`fast`)이다. 움직임 줄이기에서는 opacity만 바뀐다.
|
|
12
|
+
* 열려 있으면 `data-open`이, 트리거 기준 방향이 `data-placement`(`top`/`bottom`/`left`/`right`)로 붙는다.
|
|
13
|
+
*/
|
|
14
|
+
export declare function PopoverContent(props: PopoverContentProps): ReactElement | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { OverlayPortal } from "../../_internal/components/OverlayPortal.js";
|
|
4
|
+
import { useOverlayPresence } from "../../_internal/hooks/useOverlayPresence.js";
|
|
5
|
+
import { usePopoverContext } from "../hooks/usePopoverContext.js";
|
|
6
|
+
import { PopoverContentInner } from "./PopoverContentInner.js";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { useRef } from "react";
|
|
9
|
+
|
|
10
|
+
// src/Popover/components/PopoverContent.tsx
|
|
11
|
+
/**
|
|
12
|
+
* 트리거 옆에 뜨는 내용(`role="dialog"`). 열릴 때만 `document.body`에 portal로 렌더하고 `z-popover`로 쌓는다.
|
|
13
|
+
* 등장은 opacity + blur 4px + 4px 이동(`normal`), 퇴장은 그 절반(`fast`)이다. 움직임 줄이기에서는 opacity만 바뀐다.
|
|
14
|
+
* 열려 있으면 `data-open`이, 트리거 기준 방향이 `data-placement`(`top`/`bottom`/`left`/`right`)로 붙는다.
|
|
15
|
+
*/
|
|
16
|
+
function PopoverContent(props) {
|
|
17
|
+
const context = usePopoverContext("PopoverContent");
|
|
18
|
+
const popoverRef = useRef(null);
|
|
19
|
+
if (!useOverlayPresence(context.state.isOpen, popoverRef)) return null;
|
|
20
|
+
return /* @__PURE__ */ jsx(OverlayPortal, {
|
|
21
|
+
isExiting: !context.state.isOpen,
|
|
22
|
+
children: /* @__PURE__ */ jsx(PopoverContentInner, {
|
|
23
|
+
...props,
|
|
24
|
+
context,
|
|
25
|
+
popoverRef
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { PopoverContent };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useOverlayTheme } from "../../_internal/hooks/useOverlayTheme.js";
|
|
4
|
+
import { usePopoverOverlay } from "../../_internal/hooks/usePopoverOverlay.js";
|
|
5
|
+
import { cn } from "../../_internal/libs/cn.js";
|
|
6
|
+
import { contentClass } from "../constants/popoverClass.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useMemo } from "react";
|
|
9
|
+
import { DismissButton, mergeProps, mergeRefs, useDialog } from "react-aria";
|
|
10
|
+
|
|
11
|
+
// src/Popover/components/PopoverContentInner.tsx
|
|
12
|
+
/** DOM에 있는 동안만 portal 안에서 렌더한다. React Aria 오버레이 hook은 요소가 있다고 보고 동작한다. */
|
|
13
|
+
function PopoverContentInner({ context, popoverRef, placement = "bottom", offset = 8, ref, className, children, ...props }) {
|
|
14
|
+
const { state, triggerRef, contentId, triggerId } = context;
|
|
15
|
+
useOverlayTheme(triggerRef, popoverRef);
|
|
16
|
+
const { overlayProps } = usePopoverOverlay({
|
|
17
|
+
triggerRef,
|
|
18
|
+
popoverRef,
|
|
19
|
+
placement,
|
|
20
|
+
offset
|
|
21
|
+
}, state);
|
|
22
|
+
const { dialogProps } = useDialog({
|
|
23
|
+
"aria-label": props["aria-label"],
|
|
24
|
+
"aria-labelledby": props["aria-labelledby"]
|
|
25
|
+
}, popoverRef);
|
|
26
|
+
const labelledBy = dialogProps["aria-labelledby"] ?? (props["aria-label"] ? void 0 : triggerId);
|
|
27
|
+
const mergedRef = useMemo(() => mergeRefs(ref, popoverRef), [ref, popoverRef]);
|
|
28
|
+
const { style: _style, ...rest } = mergeProps(props, overlayProps, dialogProps);
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
30
|
+
...rest,
|
|
31
|
+
id: contentId,
|
|
32
|
+
ref: mergedRef,
|
|
33
|
+
"aria-labelledby": labelledBy,
|
|
34
|
+
"data-open": state.isOpen ? "" : void 0,
|
|
35
|
+
className: cn(contentClass, className),
|
|
36
|
+
style: {
|
|
37
|
+
...overlayProps.style,
|
|
38
|
+
...props.style
|
|
39
|
+
},
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx(DismissButton, { onDismiss: state.close }),
|
|
42
|
+
children,
|
|
43
|
+
/* @__PURE__ */ jsx(DismissButton, { onDismiss: state.close })
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { PopoverContentInner };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentProps, ReactElement } from "react";
|
|
2
|
+
export interface PopoverTriggerProps extends ComponentProps<"button"> {
|
|
3
|
+
/**
|
|
4
|
+
* 다른 요소로 렌더한다. 예: `render={<Button variant="outline" />}`, `render={<IconButton aria-label="설정" />}`.
|
|
5
|
+
* props, ref, className, 이벤트 핸들러를 그 요소에 병합한다. 기본은 class 없는 `<button type="button">`이다.
|
|
6
|
+
*/
|
|
7
|
+
render?: ReactElement;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Popover를 여닫는 버튼. 누르면(마우스, 터치, Enter, Space) 열림 상태를 뒤집는다.
|
|
11
|
+
* `aria-expanded`, 열렸을 때 `aria-controls`, 열렸을 때 `data-open`이 붙는다.
|
|
12
|
+
*/
|
|
13
|
+
export declare function PopoverTrigger({ render, ref, id, className, ...props }: PopoverTriggerProps): ReactElement;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { renderElement } from "../../_internal/libs/renderElement.js";
|
|
4
|
+
import { usePopoverContext } from "../hooks/usePopoverContext.js";
|
|
5
|
+
import { createElement, useLayoutEffect, useMemo } from "react";
|
|
6
|
+
import { mergeProps, mergeRefs, usePress } from "react-aria";
|
|
7
|
+
|
|
8
|
+
// src/Popover/components/PopoverTrigger.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Popover를 여닫는 버튼. 누르면(마우스, 터치, Enter, Space) 열림 상태를 뒤집는다.
|
|
11
|
+
* `aria-expanded`, 열렸을 때 `aria-controls`, 열렸을 때 `data-open`이 붙는다.
|
|
12
|
+
*/
|
|
13
|
+
function PopoverTrigger({ render, ref, id, className, ...props }) {
|
|
14
|
+
const { state, triggerRef, triggerProps, triggerId, setTriggerId } = usePopoverContext("PopoverTrigger");
|
|
15
|
+
const { onPress, ...ariaProps } = triggerProps;
|
|
16
|
+
const { pressProps } = usePress({
|
|
17
|
+
onPress,
|
|
18
|
+
ref: triggerRef
|
|
19
|
+
});
|
|
20
|
+
const mergedRef = useMemo(() => mergeRefs(ref, triggerRef), [ref, triggerRef]);
|
|
21
|
+
const resolvedId = id ?? triggerId;
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
if (resolvedId !== triggerId) setTriggerId(resolvedId);
|
|
24
|
+
}, [
|
|
25
|
+
resolvedId,
|
|
26
|
+
triggerId,
|
|
27
|
+
setTriggerId
|
|
28
|
+
]);
|
|
29
|
+
const merged = {
|
|
30
|
+
...mergeProps(props, ariaProps, pressProps),
|
|
31
|
+
id: resolvedId,
|
|
32
|
+
ref: mergedRef,
|
|
33
|
+
"data-open": state.isOpen ? "" : void 0
|
|
34
|
+
};
|
|
35
|
+
if (!render) return createElement("button", {
|
|
36
|
+
type: "button",
|
|
37
|
+
...merged,
|
|
38
|
+
className
|
|
39
|
+
});
|
|
40
|
+
return renderElement({
|
|
41
|
+
defaultElement: "button",
|
|
42
|
+
render,
|
|
43
|
+
baseClassName: "",
|
|
44
|
+
props: {
|
|
45
|
+
...merged,
|
|
46
|
+
className
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { PopoverTrigger };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { overlaySurfaceClass, popoverMotionClass } from "../../_internal/constants/overlayClass.js";
|
|
2
|
+
|
|
3
|
+
// src/Popover/constants/popoverClass.ts
|
|
4
|
+
const contentClass = `isolate z-popover max-w-80 overflow-auto p-4 text-body-md outline-none ${overlaySurfaceClass} ${popoverMotionClass}`;
|
|
5
|
+
|
|
6
|
+
export { contentClass };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, use } from "react";
|
|
4
|
+
|
|
5
|
+
// src/Popover/hooks/usePopoverContext.ts
|
|
6
|
+
const PopoverContext = createContext(null);
|
|
7
|
+
function usePopoverContext(part) {
|
|
8
|
+
const context = use(PopoverContext);
|
|
9
|
+
if (!context) throw new Error(`${part}는 Popover 안에 둔다.`);
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { PopoverContext, usePopoverContext };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Popover, PopoverProps } from "./Popover.js";
|
|
2
|
+
import { PopoverTrigger, PopoverTriggerProps } from "./components/PopoverTrigger.js";
|
|
3
|
+
import { PopoverContent, PopoverContentProps } from "./components/PopoverContent.js";
|
|
4
|
+
import { PopoverPlacement } from "./types.js";
|
|
5
|
+
export { Popover, PopoverContent, type PopoverContentProps, type PopoverPlacement, type PopoverProps, PopoverTrigger, type PopoverTriggerProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChoiceSize } from "
|
|
2
|
-
import { Role } from "
|
|
1
|
+
import { ChoiceSize } from "../_internal/constants/choiceClass.js";
|
|
2
|
+
import { Role } from "../types.js";
|
|
3
3
|
import { CSSProperties, ComponentProps, ReactElement, ReactNode } from "react";
|
|
4
4
|
export interface RadioProps extends Omit<ComponentProps<"input">, "type" | "size" | "color" | "children" | "className" | "style" | "value"> {
|
|
5
5
|
/** 이 라디오의 값. RadioGroup의 `value`·`onValueChange`가 이 값을 쓰고, form에 제출된다. */
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { RadioGroupContext } from "
|
|
4
|
-
import { choiceAreaClass, choiceInputClass, choiceMarkClass, choiceRootClass, choiceTextClass } from "
|
|
5
|
-
import { cn } from "
|
|
6
|
-
import { useFieldControl } from "
|
|
3
|
+
import { RadioGroupContext } from "../_internal/hooks/useChoiceGroup.js";
|
|
4
|
+
import { choiceAreaClass, choiceInputClass, choiceMarkClass, choiceRootClass, choiceTextClass } from "../_internal/constants/choiceClass.js";
|
|
5
|
+
import { cn } from "../_internal/libs/cn.js";
|
|
6
|
+
import { useFieldControl } from "../_internal/hooks/useFieldControl.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { use } from "react";
|
|
9
9
|
import { CircleIcon } from "@tide-design/icons";
|
|
10
10
|
|
|
11
|
-
// src/Radio.tsx
|
|
11
|
+
// src/Radio/Radio.tsx
|
|
12
12
|
const boxClass = {
|
|
13
13
|
sm: "size-4 rounded-full",
|
|
14
14
|
md: "size-5 rounded-full"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChoiceOrientation } from "
|
|
1
|
+
import { ChoiceOrientation } from "../_internal/constants/choiceGroupClass.js";
|
|
2
2
|
import { ComponentProps, ReactElement } from "react";
|
|
3
3
|
export interface RadioGroupProps extends Omit<ComponentProps<"div">, "defaultValue"> {
|
|
4
4
|
/** 안의 Radio가 함께 쓰는 `name`. form에 이 이름으로 제출된다. 주지 않으면 자동으로 만든다. */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { orientationClass } from "
|
|
4
|
-
import { RadioGroupContext, useChoiceGroup } from "
|
|
5
|
-
import { cn } from "
|
|
6
|
-
import { FieldContext } from "
|
|
3
|
+
import { orientationClass } from "../_internal/constants/choiceGroupClass.js";
|
|
4
|
+
import { RadioGroupContext, useChoiceGroup } from "../_internal/hooks/useChoiceGroup.js";
|
|
5
|
+
import { cn } from "../_internal/libs/cn.js";
|
|
6
|
+
import { FieldContext } from "../_internal/hooks/useFieldControl.js";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
import { useId } from "react";
|
|
9
9
|
|
|
10
|
-
// src/RadioGroup.tsx
|
|
10
|
+
// src/RadioGroup/RadioGroup.tsx
|
|
11
11
|
/**
|
|
12
12
|
* Radio 여러 개를 하나의 이름과 선택 값으로 묶는다. `<Field label group>` 안에 두면 label이 묶음의 이름,
|
|
13
13
|
* 설명·오류가 묶음의 설명이 된다. Field 밖에서는 `aria-label`이나 `aria-labelledby`를 준다.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { InputSize } from "
|
|
2
|
-
import { ListBoxOptionProps, ListBoxSectionProps } from "./listbox.js";
|
|
1
|
+
import { InputSize } from "../_internal/constants/inputClass.js";
|
|
3
2
|
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
4
3
|
export interface SelectProps extends Omit<ComponentProps<"button">, "value" | "defaultValue" | "onChange" | "type" | "size" | "children" | "name" | "form"> {
|
|
5
4
|
/** 고른 값(제어). 고른 옵션의 `value`다. `null`이면 아무것도 고르지 않은 상태다. 주면 `onValueChange`로 바꾼다. */
|
|
@@ -45,18 +44,4 @@ export interface SelectProps extends Omit<ComponentProps<"button">, "value" | "d
|
|
|
45
44
|
* 상태는 `data-open`(트리거·목록), `data-invalid`(트리거), 네이티브 `:disabled`(트리거),
|
|
46
45
|
* `data-highlighted`·`data-selected`·`data-disabled`(옵션)로 노출한다.
|
|
47
46
|
*/
|
|
48
|
-
export declare function Select({ value, defaultValue, onValueChange, open, defaultOpen, onOpenChange, name, form, autoComplete, placeholder, size, invalid, disabled, required, id, ref, className, children, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: SelectProps): ReactElement;
|
|
49
|
-
export interface SelectItemProps extends ListBoxOptionProps {}
|
|
50
|
-
/**
|
|
51
|
-
* Select의 옵션(`role="option"`). `Select`나 `SelectSection` 바로 안에 둔다. `value`가 고른 값이고 폼에 제출된다.
|
|
52
|
-
* 내용(아이콘과 글자)은 고르면 트리거에도 보인다. 키보드 위치와 마우스를 올린 옵션은 highlight(primary subtle 배경,
|
|
53
|
-
* primary 글자), 고른 옵션은 neutral subtle-active 배경과 끝의 체크 아이콘이다.
|
|
54
|
-
* 상태는 `data-highlighted`, `data-selected`, `data-disabled`로 노출한다.
|
|
55
|
-
*/
|
|
56
|
-
export declare function SelectItem(_props: SelectItemProps): null;
|
|
57
|
-
export interface SelectSectionProps extends ListBoxSectionProps {}
|
|
58
|
-
/**
|
|
59
|
-
* 옵션 묶음(`role="group"`). `heading`이 화면에 보이는 제목이자 묶음의 이름이고, 없으면 `aria-label`이 이름이다.
|
|
60
|
-
* 앞뒤 다른 옵션·묶음과의 사이에 구분선이 그려진다.
|
|
61
|
-
*/
|
|
62
|
-
export declare function SelectSection(_props: SelectSectionProps): null;
|
|
47
|
+
export declare function Select({ value, defaultValue, onValueChange, open, defaultOpen, onOpenChange, name, form, autoComplete, placeholder, size, invalid, disabled, required, id, ref, className, children, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: SelectProps): ReactElement;
|