@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.
Files changed (290) hide show
  1. package/dist/Accordion/Accordion.d.ts +24 -0
  2. package/dist/Accordion/Accordion.js +32 -0
  3. package/dist/Accordion/components/AccordionItem.d.ts +14 -0
  4. package/dist/Accordion/components/AccordionItem.js +51 -0
  5. package/dist/Accordion/components/AccordionPanel.d.ts +13 -0
  6. package/dist/Accordion/components/AccordionPanel.js +27 -0
  7. package/dist/Accordion/components/AccordionTrigger.d.ts +17 -0
  8. package/dist/Accordion/components/AccordionTrigger.js +39 -0
  9. package/dist/Accordion/constants/accordionClass.js +12 -0
  10. package/dist/Accordion/hooks/useAccordionContext.js +8 -0
  11. package/dist/Accordion/hooks/useAccordionItemContext.js +13 -0
  12. package/dist/Accordion/index.d.ts +6 -0
  13. package/dist/Accordion/types.d.ts +2 -0
  14. package/dist/{Alert.d.ts → Alert/Alert.d.ts} +1 -1
  15. package/dist/{Alert.js → Alert/Alert.js} +5 -4
  16. package/dist/Alert/index.d.ts +2 -0
  17. package/dist/{AlertDialog.d.ts → AlertDialog/AlertDialog.d.ts} +1 -1
  18. package/dist/{AlertDialog.js → AlertDialog/AlertDialog.js} +2 -2
  19. package/dist/AlertDialog/index.d.ts +2 -0
  20. package/dist/{Avatar.d.ts → Avatar/Avatar.d.ts} +1 -1
  21. package/dist/{Avatar.js → Avatar/Avatar.js} +2 -2
  22. package/dist/Avatar/index.d.ts +2 -0
  23. package/dist/{Badge.d.ts → Badge/Badge.d.ts} +1 -1
  24. package/dist/{Badge.js → Badge/Badge.js} +2 -2
  25. package/dist/Badge/index.d.ts +2 -0
  26. package/dist/Breadcrumb/Breadcrumb.d.ts +11 -0
  27. package/dist/Breadcrumb/Breadcrumb.js +21 -0
  28. package/dist/Breadcrumb/components/BreadcrumbCurrent.d.ts +4 -0
  29. package/dist/Breadcrumb/components/BreadcrumbCurrent.js +15 -0
  30. package/dist/Breadcrumb/components/BreadcrumbItem.d.ts +4 -0
  31. package/dist/Breadcrumb/components/BreadcrumbItem.js +16 -0
  32. package/dist/Breadcrumb/components/BreadcrumbLink.d.ts +10 -0
  33. package/dist/Breadcrumb/components/BreadcrumbLink.js +15 -0
  34. package/dist/Breadcrumb/constants/breadcrumbClass.js +8 -0
  35. package/dist/Breadcrumb/index.d.ts +5 -0
  36. package/dist/{Button.d.ts → Button/Button.d.ts} +3 -7
  37. package/dist/{Button.js → Button/Button.js} +8 -26
  38. package/dist/Button/components/Icon.js +13 -0
  39. package/dist/Button/constants/buttonClass.js +17 -0
  40. package/dist/Button/index.d.ts +2 -0
  41. package/dist/Button/types.d.ts +5 -0
  42. package/dist/{Card.js → Card/Card.js} +2 -2
  43. package/dist/Card/index.d.ts +2 -0
  44. package/dist/{Checkbox.d.ts → Checkbox/Checkbox.d.ts} +2 -2
  45. package/dist/{Checkbox.js → Checkbox/Checkbox.js} +5 -5
  46. package/dist/Checkbox/index.d.ts +2 -0
  47. package/dist/{CheckboxGroup.d.ts → CheckboxGroup/CheckboxGroup.d.ts} +3 -3
  48. package/dist/{CheckboxGroup.js → CheckboxGroup/CheckboxGroup.js} +6 -10
  49. package/dist/CheckboxGroup/index.d.ts +3 -0
  50. package/dist/{Combobox.d.ts → Combobox/Combobox.d.ts} +2 -17
  51. package/dist/{Combobox.js → Combobox/Combobox.js} +10 -96
  52. package/dist/Combobox/components/ComboboxItem.d.ts +9 -0
  53. package/dist/Combobox/components/ComboboxItem.js +17 -0
  54. package/dist/Combobox/components/ComboboxPopover.js +23 -0
  55. package/dist/Combobox/components/ComboboxPopoverInner.js +50 -0
  56. package/dist/Combobox/components/ComboboxSection.d.ts +7 -0
  57. package/dist/Combobox/components/ComboboxSection.js +15 -0
  58. package/dist/Combobox/constants/comboboxClass.js +21 -0
  59. package/dist/Combobox/index.d.ts +4 -0
  60. package/dist/Dialog/Dialog.d.ts +8 -0
  61. package/dist/Dialog/Dialog.js +18 -0
  62. package/dist/Dialog/components/DialogClose.d.ts +13 -0
  63. package/dist/Dialog/components/DialogClose.js +35 -0
  64. package/dist/Dialog/components/DialogContent.d.ts +15 -0
  65. package/dist/Dialog/components/DialogContent.js +31 -0
  66. package/dist/Dialog/components/DialogContentInner.js +68 -0
  67. package/dist/Dialog/components/DialogDescription.d.ts +7 -0
  68. package/dist/Dialog/components/DialogDescription.js +23 -0
  69. package/dist/Dialog/components/DialogFooter.d.ts +4 -0
  70. package/dist/Dialog/components/DialogFooter.js +13 -0
  71. package/dist/Dialog/components/DialogTitle.d.ts +7 -0
  72. package/dist/Dialog/components/DialogTitle.js +23 -0
  73. package/dist/Dialog/components/DialogTrigger.d.ts +13 -0
  74. package/dist/Dialog/components/DialogTrigger.js +49 -0
  75. package/dist/Dialog/constants/dialogClass.js +12 -0
  76. package/dist/Dialog/hooks/useDialogPartsContext.js +13 -0
  77. package/dist/Dialog/hooks/usePartId.js +17 -0
  78. package/dist/Dialog/index.d.ts +10 -0
  79. package/dist/Dialog/types.d.ts +2 -0
  80. package/dist/{Field.js → Field/Field.js} +3 -3
  81. package/dist/Field/index.d.ts +2 -0
  82. package/dist/{IconButton.d.ts → IconButton/IconButton.d.ts} +1 -1
  83. package/dist/{IconButton.js → IconButton/IconButton.js} +5 -4
  84. package/dist/IconButton/index.d.ts +2 -0
  85. package/dist/{Input.d.ts → Input/Input.d.ts} +1 -1
  86. package/dist/{Input.js → Input/Input.js} +4 -4
  87. package/dist/Input/index.d.ts +2 -0
  88. package/dist/{Link.d.ts → Link/Link.d.ts} +1 -1
  89. package/dist/{Link.js → Link/Link.js} +2 -2
  90. package/dist/Link/index.d.ts +2 -0
  91. package/dist/Menu/Menu.d.ts +16 -0
  92. package/dist/Menu/Menu.js +43 -0
  93. package/dist/Menu/components/MenuContent.d.ts +16 -0
  94. package/dist/Menu/components/MenuContent.js +30 -0
  95. package/dist/Menu/components/MenuContentInner.js +67 -0
  96. package/dist/Menu/components/MenuItem.d.ts +17 -0
  97. package/dist/Menu/components/MenuItem.js +16 -0
  98. package/dist/Menu/components/MenuItemView.js +34 -0
  99. package/dist/Menu/components/MenuSection.d.ts +13 -0
  100. package/dist/Menu/components/MenuSection.js +15 -0
  101. package/dist/Menu/components/MenuSectionView.js +33 -0
  102. package/dist/Menu/components/MenuTrigger.d.ts +13 -0
  103. package/dist/Menu/components/MenuTrigger.js +53 -0
  104. package/dist/Menu/hooks/useMenuContext.js +13 -0
  105. package/dist/Menu/index.d.ts +7 -0
  106. package/dist/Menu/types.d.ts +4 -0
  107. package/dist/Pagination/Pagination.d.ts +11 -0
  108. package/dist/Pagination/Pagination.js +21 -0
  109. package/dist/Pagination/components/PaginationEllipsis.d.ts +7 -0
  110. package/dist/Pagination/components/PaginationEllipsis.js +17 -0
  111. package/dist/Pagination/components/PaginationItem.d.ts +4 -0
  112. package/dist/Pagination/components/PaginationItem.js +9 -0
  113. package/dist/Pagination/components/PaginationLink.d.ts +15 -0
  114. package/dist/Pagination/components/PaginationLink.js +23 -0
  115. package/dist/Pagination/components/PaginationNext.d.ts +5 -0
  116. package/dist/Pagination/components/PaginationNext.js +18 -0
  117. package/dist/Pagination/components/PaginationPrevious.d.ts +5 -0
  118. package/dist/Pagination/components/PaginationPrevious.js +18 -0
  119. package/dist/Pagination/constants/paginationClass.js +6 -0
  120. package/dist/Pagination/index.d.ts +7 -0
  121. package/dist/Pagination/types.d.ts +6 -0
  122. package/dist/Popover/Popover.d.ts +16 -0
  123. package/dist/Popover/Popover.js +43 -0
  124. package/dist/Popover/components/PopoverContent.d.ts +14 -0
  125. package/dist/Popover/components/PopoverContent.js +30 -0
  126. package/dist/Popover/components/PopoverContentInner.js +48 -0
  127. package/dist/Popover/components/PopoverTrigger.d.ts +13 -0
  128. package/dist/Popover/components/PopoverTrigger.js +51 -0
  129. package/dist/Popover/constants/popoverClass.js +6 -0
  130. package/dist/Popover/hooks/usePopoverContext.js +13 -0
  131. package/dist/Popover/index.d.ts +5 -0
  132. package/dist/Popover/types.d.ts +3 -0
  133. package/dist/{Progress.d.ts → Progress/Progress.d.ts} +1 -1
  134. package/dist/{Progress.js → Progress/Progress.js} +2 -2
  135. package/dist/Progress/index.d.ts +2 -0
  136. package/dist/{Radio.d.ts → Radio/Radio.d.ts} +2 -2
  137. package/dist/{Radio.js → Radio/Radio.js} +5 -5
  138. package/dist/Radio/index.d.ts +2 -0
  139. package/dist/{RadioGroup.d.ts → RadioGroup/RadioGroup.d.ts} +1 -1
  140. package/dist/{RadioGroup.js → RadioGroup/RadioGroup.js} +5 -5
  141. package/dist/RadioGroup/index.d.ts +2 -0
  142. package/dist/{Select.d.ts → Select/Select.d.ts} +2 -17
  143. package/dist/Select/Select.js +97 -0
  144. package/dist/Select/components/SelectItem.d.ts +9 -0
  145. package/dist/Select/components/SelectItem.js +17 -0
  146. package/dist/Select/components/SelectPopover.js +23 -0
  147. package/dist/Select/components/SelectPopoverInner.js +51 -0
  148. package/dist/Select/components/SelectSection.d.ts +7 -0
  149. package/dist/Select/components/SelectSection.js +15 -0
  150. package/dist/Select/constants/selectClass.js +7 -0
  151. package/dist/Select/index.d.ts +4 -0
  152. package/dist/{Separator.js → Separator/Separator.js} +2 -2
  153. package/dist/Separator/index.d.ts +2 -0
  154. package/dist/{Skeleton.d.ts → Skeleton/Skeleton.d.ts} +1 -1
  155. package/dist/{Skeleton.js → Skeleton/Skeleton.js} +2 -2
  156. package/dist/Skeleton/index.d.ts +2 -0
  157. package/dist/{Spinner.d.ts → Spinner/Spinner.d.ts} +1 -1
  158. package/dist/{Spinner.js → Spinner/Spinner.js} +2 -2
  159. package/dist/Spinner/index.d.ts +2 -0
  160. package/dist/{Switch.d.ts → Switch/Switch.d.ts} +1 -1
  161. package/dist/{Switch.js → Switch/Switch.js} +3 -3
  162. package/dist/Switch/index.d.ts +2 -0
  163. package/dist/Table/Table.d.ts +7 -0
  164. package/dist/Table/Table.js +17 -0
  165. package/dist/Table/components/TableBody.d.ts +4 -0
  166. package/dist/Table/components/TableBody.js +9 -0
  167. package/dist/Table/components/TableCell.d.ts +4 -0
  168. package/dist/Table/components/TableCell.js +14 -0
  169. package/dist/Table/components/TableHead.d.ts +4 -0
  170. package/dist/Table/components/TableHead.js +9 -0
  171. package/dist/Table/components/TableHeaderCell.d.ts +13 -0
  172. package/dist/Table/components/TableHeaderCell.js +18 -0
  173. package/dist/Table/components/TableRow.d.ts +4 -0
  174. package/dist/Table/components/TableRow.js +14 -0
  175. package/dist/Table/constants/tableClass.js +7 -0
  176. package/dist/Table/index.d.ts +7 -0
  177. package/dist/Tabs/Tabs.d.ts +34 -0
  178. package/dist/Tabs/Tabs.js +56 -0
  179. package/dist/Tabs/components/Tab.d.ts +12 -0
  180. package/dist/Tabs/components/Tab.js +16 -0
  181. package/dist/Tabs/components/TabList.d.ts +10 -0
  182. package/dist/Tabs/components/TabList.js +47 -0
  183. package/dist/Tabs/components/TabPanel.d.ts +10 -0
  184. package/dist/Tabs/components/TabPanel.js +27 -0
  185. package/dist/Tabs/components/TabView.js +29 -0
  186. package/dist/Tabs/constants/tabsClass.js +23 -0
  187. package/dist/Tabs/hooks/useTabsContext.js +13 -0
  188. package/dist/Tabs/index.d.ts +6 -0
  189. package/dist/Tabs/types.d.ts +5 -0
  190. package/dist/Tag/Tag.d.ts +18 -0
  191. package/dist/Tag/Tag.js +15 -0
  192. package/dist/{Tag.d.ts → Tag/components/TagGroup.d.ts} +0 -17
  193. package/dist/Tag/components/TagGroup.js +49 -0
  194. package/dist/Tag/components/TagView.js +49 -0
  195. package/dist/Tag/constants/tagClass.js +13 -0
  196. package/dist/Tag/hooks/useTagGroupContext.js +8 -0
  197. package/dist/Tag/index.d.ts +3 -0
  198. package/dist/{Textarea.d.ts → Textarea/Textarea.d.ts} +1 -1
  199. package/dist/{Textarea.js → Textarea/Textarea.js} +4 -4
  200. package/dist/Textarea/index.d.ts +2 -0
  201. package/dist/Toast/Toast.d.ts +15 -0
  202. package/dist/Toast/Toast.js +43 -0
  203. package/dist/Toast/components/Region.js +28 -0
  204. package/dist/Toast/components/ToastItem.js +82 -0
  205. package/dist/Toast/constants/toastClass.js +8 -0
  206. package/dist/Toast/index.d.ts +4 -0
  207. package/dist/Toast/libs/mergeEntries.js +19 -0
  208. package/dist/Toast/libs/toastQueue.d.ts +20 -0
  209. package/dist/Toast/libs/toastQueue.js +49 -0
  210. package/dist/{Toast.d.ts → Toast/types.d.ts} +4 -33
  211. package/dist/Tooltip/Tooltip.d.ts +25 -0
  212. package/dist/Tooltip/Tooltip.js +42 -0
  213. package/dist/Tooltip/components/TooltipContent.d.ts +14 -0
  214. package/dist/Tooltip/components/TooltipContent.js +31 -0
  215. package/dist/Tooltip/components/TooltipContentInner.js +43 -0
  216. package/dist/Tooltip/components/TooltipTrigger.d.ts +14 -0
  217. package/dist/Tooltip/components/TooltipTrigger.js +38 -0
  218. package/dist/Tooltip/constants/tooltipClass.js +6 -0
  219. package/dist/Tooltip/hooks/useTooltipContext.js +13 -0
  220. package/dist/Tooltip/index.d.ts +5 -0
  221. package/dist/Tooltip/types.d.ts +3 -0
  222. package/dist/{Typography.js → Typography/Typography.js} +2 -2
  223. package/dist/Typography/index.d.ts +2 -0
  224. package/dist/{VisuallyHidden.js → VisuallyHidden/VisuallyHidden.js} +2 -2
  225. package/dist/VisuallyHidden/index.d.ts +2 -0
  226. package/dist/_internal/components/DialogRoot.d.ts +11 -0
  227. package/dist/_internal/components/DialogRoot.js +41 -0
  228. package/dist/_internal/components/ListBoxNodes/ListBoxNodes.js +35 -0
  229. package/dist/_internal/components/ListBoxNodes/components/ListBoxOptionView.js +42 -0
  230. package/dist/_internal/components/ListBoxNodes/components/ListBoxSectionView.js +33 -0
  231. package/dist/{listbox.d.ts → _internal/components/ListBoxNodes/types.d.ts} +1 -1
  232. package/dist/_internal/components/OverlayPortal.js +21 -0
  233. package/dist/{alert-style.js → _internal/constants/alertClass.js} +2 -16
  234. package/dist/{choice-style.js → _internal/constants/choiceClass.js} +1 -1
  235. package/dist/_internal/constants/choiceGroupClass.d.ts +2 -0
  236. package/dist/_internal/constants/choiceGroupClass.js +8 -0
  237. package/dist/{input-style.d.ts → _internal/constants/inputClass.d.ts} +1 -1
  238. package/dist/{input-style.js → _internal/constants/inputClass.js} +1 -1
  239. package/dist/{list-style.js → _internal/constants/listClass.js} +2 -2
  240. package/dist/{overlay-style.js → _internal/constants/overlayClass.js} +1 -1
  241. package/dist/_internal/constants/pressableClass.js +33 -0
  242. package/dist/{choice-group.js → _internal/hooks/useChoiceGroup.js} +2 -2
  243. package/dist/_internal/hooks/useCloseOnTab.js +29 -0
  244. package/dist/_internal/hooks/useDialogContext.js +14 -0
  245. package/dist/{field-context.js → _internal/hooks/useFieldControl.js} +1 -1
  246. package/dist/_internal/hooks/useOverlayPresence.js +46 -0
  247. package/dist/_internal/hooks/useOverlayTheme.js +20 -0
  248. package/dist/_internal/hooks/usePopoverOverlay.js +25 -0
  249. package/dist/_internal/libs/alertStatusIcon.js +17 -0
  250. package/dist/{cn.js → _internal/libs/cn.js} +1 -1
  251. package/dist/{list-collection.js → _internal/libs/listCollection.js} +1 -1
  252. package/dist/{overlay.d.ts → _internal/libs/overlayPosition.d.ts} +0 -1
  253. package/dist/_internal/libs/overlayPosition.js +20 -0
  254. package/dist/_internal/libs/pressableState.js +43 -0
  255. package/dist/{render.js → _internal/libs/renderElement.js} +1 -1
  256. package/dist/index.d.ts +119 -36
  257. package/dist/index.js +75 -36
  258. package/package.json +3 -3
  259. package/dist/Accordion.d.ts +0 -66
  260. package/dist/Accordion.js +0 -127
  261. package/dist/Breadcrumb.d.ts +0 -26
  262. package/dist/Breadcrumb.js +0 -53
  263. package/dist/Dialog.d.ts +0 -70
  264. package/dist/Dialog.js +0 -255
  265. package/dist/Menu.d.ts +0 -72
  266. package/dist/Menu.js +0 -226
  267. package/dist/Pagination.d.ts +0 -46
  268. package/dist/Pagination.js +0 -79
  269. package/dist/Popover.d.ts +0 -43
  270. package/dist/Popover.js +0 -147
  271. package/dist/Select.js +0 -169
  272. package/dist/Table.d.ts +0 -31
  273. package/dist/Table.js +0 -53
  274. package/dist/Tabs.d.ts +0 -66
  275. package/dist/Tabs.js +0 -159
  276. package/dist/Tag.js +0 -102
  277. package/dist/Toast.js +0 -191
  278. package/dist/Tooltip.d.ts +0 -53
  279. package/dist/Tooltip.js +0 -129
  280. package/dist/listbox.js +0 -90
  281. package/dist/overlay.js +0 -130
  282. package/dist/pressable.js +0 -70
  283. /package/dist/{Card.d.ts → Card/Card.d.ts} +0 -0
  284. /package/dist/{Field.d.ts → Field/Field.d.ts} +0 -0
  285. /package/dist/{Separator.d.ts → Separator/Separator.d.ts} +0 -0
  286. /package/dist/{Typography.d.ts → Typography/Typography.d.ts} +0 -0
  287. /package/dist/{VisuallyHidden.d.ts → VisuallyHidden/VisuallyHidden.d.ts} +0 -0
  288. /package/dist/{choice-style.d.ts → _internal/constants/choiceClass.d.ts} +0 -0
  289. /package/dist/{cn.d.ts → _internal/libs/cn.d.ts} +0 -0
  290. /package/dist/{list-collection.d.ts → _internal/libs/listCollection.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
- import { ChoiceSize } from "./choice-style.js";
2
- import { Role } from "./types.js";
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 CheckboxProps extends Omit<ComponentProps<"input">, "type" | "size" | "color" | "children" | "className" | "style"> {
5
5
  /** 상자 옆에 보이는 label. 체크박스의 이름이 된다. 없으면 `aria-label`을 준다. */
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
 
3
- import { CheckboxGroupContext } from "./choice-group.js";
4
- import { choiceAreaClass, choiceInputClass, choiceMarkClass, choiceRootClass, choiceTextClass } from "./choice-style.js";
5
- import { cn } from "./cn.js";
6
- import { useFieldControl } from "./field-context.js";
3
+ import { CheckboxGroupContext } 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, useImperativeHandle, useLayoutEffect, useRef } from "react";
9
9
  import { CheckIcon, MinusIcon } from "@tide-design/icons";
10
10
 
11
- // src/Checkbox.tsx
11
+ // src/Checkbox/Checkbox.tsx
12
12
  /** 상자 크기와 모서리. 체크박스는 radius `sm`(4px)이다. */
13
13
  const boxClass = {
14
14
  sm: "size-4 rounded-sm",
@@ -0,0 +1,2 @@
1
+ import { Checkbox, CheckboxProps } from "./Checkbox.js";
2
+ export { Checkbox, type CheckboxProps };
@@ -1,6 +1,5 @@
1
+ import { ChoiceOrientation } from "../_internal/constants/choiceGroupClass.js";
1
2
  import { ComponentProps, ReactElement } from "react";
2
- /** 항목을 쌓는 방향 */
3
- export type ChoiceOrientation = "vertical" | "horizontal";
4
3
  export interface CheckboxGroupProps extends ComponentProps<"div"> {
5
4
  /** 항목을 세로(`vertical`)로 쌓거나 가로(`horizontal`)로 늘어놓는다. 기본값은 `vertical`이다. */
6
5
  orientation?: ChoiceOrientation;
@@ -16,4 +15,5 @@ export interface CheckboxGroupProps extends ComponentProps<"div"> {
16
15
  * Checkbox 여러 개를 하나의 이름으로 묶는다. `<Field label group>` 안에 두면 label이 묶음의 이름, 설명·오류가
17
16
  * 묶음의 설명이 된다. Field 밖에서는 `aria-label`이나 `aria-labelledby`를 준다.
18
17
  */
19
- export declare function CheckboxGroup({ orientation, invalid, disabled, id, className, children, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...props }: CheckboxGroupProps): ReactElement;
18
+ export declare function CheckboxGroup({ orientation, invalid, disabled, id, className, children, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...props }: CheckboxGroupProps): ReactElement;
19
+ export type { ChoiceOrientation };
@@ -1,16 +1,12 @@
1
1
  "use client";
2
2
 
3
- import { CheckboxGroupContext, useChoiceGroup } from "./choice-group.js";
4
- import { cn } from "./cn.js";
5
- import { FieldContext } from "./field-context.js";
3
+ import { CheckboxGroupContext, useChoiceGroup } from "../_internal/hooks/useChoiceGroup.js";
4
+ import { cn } from "../_internal/libs/cn.js";
5
+ import { FieldContext } from "../_internal/hooks/useFieldControl.js";
6
+ import { orientationClass } from "../_internal/constants/choiceGroupClass.js";
6
7
  import { jsx } from "react/jsx-runtime";
7
8
 
8
- // src/CheckboxGroup.tsx
9
- /** 방향별 배치. 가로는 줄이 넘치면 다음 줄로 간다. */
10
- const orientationClass = {
11
- vertical: "flex flex-col gap-2",
12
- horizontal: "flex flex-row flex-wrap gap-x-6 gap-y-2"
13
- };
9
+ // src/CheckboxGroup/CheckboxGroup.tsx
14
10
  /**
15
11
  * Checkbox 여러 개를 하나의 이름으로 묶는다. `<Field label group>` 안에 두면 label이 묶음의 이름, 설명·오류가
16
12
  * 묶음의 설명이 된다. Field 밖에서는 `aria-label`이나 `aria-labelledby`를 준다.
@@ -42,4 +38,4 @@ function CheckboxGroup({ orientation = "vertical", invalid, disabled, id, classN
42
38
  });
43
39
  }
44
40
 
45
- export { CheckboxGroup, orientationClass };
41
+ export { CheckboxGroup };
@@ -0,0 +1,3 @@
1
+ import { ChoiceOrientation } from "../_internal/constants/choiceGroupClass.js";
2
+ import { CheckboxGroup, CheckboxGroupProps } from "./CheckboxGroup.js";
3
+ export { CheckboxGroup, type CheckboxGroupProps, type ChoiceOrientation };
@@ -1,5 +1,4 @@
1
- import { InputSize } from "./input-style.js";
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 ComboboxProps extends Omit<ComponentProps<"input">, "value" | "defaultValue" | "onChange" | "type" | "size" | "children" | "name" | "form" | "list"> {
5
4
  /** 고른 값(제어). 고른 옵션의 `value`다. `null`이면 아무것도 고르지 않은 상태다. 주면 `onValueChange`로 바꾼다. */
@@ -42,18 +41,4 @@ export interface ComboboxProps extends Omit<ComponentProps<"input">, "value" | "
42
41
  * 상태는 `data-open`·`data-invalid`·네이티브 `:disabled`(입력), `data-open`(목록),
43
42
  * `data-highlighted`·`data-selected`·`data-disabled`(옵션)로 노출한다.
44
43
  */
45
- export declare function Combobox({ value, defaultValue, onValueChange, onOpenChange, emptyMessage, name, form, size, invalid, disabled, required, readOnly, id, ref, className, children, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ComboboxProps): ReactElement;
46
- export interface ComboboxItemProps extends ListBoxOptionProps {}
47
- /**
48
- * Combobox의 옵션(`role="option"`). `Combobox`나 `ComboboxSection` 바로 안에 둔다. `value`가 고른 값이고 폼에
49
- * 제출된다. 거르기와 고른 뒤 입력에 들어가는 글자는 `textValue`(기본은 내용의 글자)다. 키보드 위치와 마우스를 올린
50
- * 옵션은 highlight, 고른 옵션은 neutral subtle-active 배경과 끝의 체크 아이콘이다(Select 옵션과 같다).
51
- * 상태는 `data-highlighted`, `data-selected`, `data-disabled`로 노출한다.
52
- */
53
- export declare function ComboboxItem(_props: ComboboxItemProps): null;
54
- export interface ComboboxSectionProps extends ListBoxSectionProps {}
55
- /**
56
- * 옵션 묶음(`role="group"`). `heading`이 화면에 보이는 제목이자 묶음의 이름이고, 없으면 `aria-label`이 이름이다.
57
- * 거른 결과 묶음 안에 남은 옵션이 없으면 묶음도 빠진다.
58
- */
59
- export declare function ComboboxSection(_props: ComboboxSectionProps): null;
44
+ export declare function Combobox({ value, defaultValue, onValueChange, onOpenChange, emptyMessage, name, form, size, invalid, disabled, required, readOnly, id, ref, className, children, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ComboboxProps): ReactElement;
@@ -1,37 +1,18 @@
1
1
  "use client";
2
2
 
3
- import { cn } from "./cn.js";
4
- import { FieldContext, useFieldControl } from "./field-context.js";
5
- import { inputBaseClass, inputSizeClass } from "./input-style.js";
6
- import { asCollectionComponent, resolveCollectionChildren, sectionCollectionNode, valueItemCollectionNode } from "./list-collection.js";
7
- import { listPopupClass } from "./list-style.js";
8
- import { ListBoxNodes } from "./listbox.js";
9
- import { OverlayPortal, useOverlayPresence, useOverlayTheme, usePopoverOverlay } from "./overlay.js";
3
+ import { inputBaseClass, inputSizeClass } from "../_internal/constants/inputClass.js";
4
+ import { FieldContext, useFieldControl } from "../_internal/hooks/useFieldControl.js";
5
+ import { cn } from "../_internal/libs/cn.js";
6
+ import { resolveCollectionChildren } from "../_internal/libs/listCollection.js";
7
+ import { ComboboxPopover } from "./components/ComboboxPopover.js";
8
+ import { buttonClass, buttonSizeClass, inputEndClass, wrapperClass } from "./constants/comboboxClass.js";
10
9
  import { jsx, jsxs } from "react/jsx-runtime";
11
- import { use, useLayoutEffect, useMemo, useRef } from "react";
10
+ import { use, useMemo, useRef } from "react";
12
11
  import { ChevronDownIcon } from "@tide-design/icons";
13
- import { mergeProps, mergeRefs, useButton, useComboBox, useFilter, useListBox } from "react-aria";
12
+ import { mergeProps, mergeRefs, useButton, useComboBox, useFilter } from "react-aria";
14
13
  import { useComboBoxState } from "react-stately";
15
14
 
16
- // src/Combobox.tsx
17
- const wrapperClass = "flex w-full";
18
- const inputEndClass = {
19
- sm: "pe-[34px]",
20
- md: "pe-9",
21
- lg: "pe-10"
22
- };
23
- const buttonSizeClass = {
24
- sm: "-ms-[35px] w-[35px] pe-[11px]",
25
- md: "-ms-[37px] w-[37px] pe-[13px]",
26
- lg: "-ms-[41px] w-[41px] pe-[17px]"
27
- };
28
- const buttonClass = "inline-flex shrink-0 cursor-pointer items-center justify-end text-muted outline-none disabled:cursor-not-allowed disabled:text-disabled";
29
- /**
30
- * 거른 결과가 없을 때의 글자. 옵션과 같은 여백·글자 크기라 목록 높이가 옵션 하나와 같다. `text-muted`.
31
- * listbox 밖(같은 목록 표면 안)에 둔다. listbox 자식은 option·group만 될 수 있어서다. 결과 개수(0개)는 React Aria가
32
- * live region으로 알린다.
33
- */
34
- const emptyClass = "px-2 py-1.5 text-body-sm text-muted select-none";
15
+ // src/Combobox/Combobox.tsx
35
16
  /**
36
17
  * 한글 IME 조합 중의 keydown인지. 조합 중 Enter·화살표·Esc는 IME가 쓰므로 목록 동작에 쓰지 않는다.
37
18
  * Chromium·Firefox는 `isComposing`이 `true`다. Safari는 조합을 끝내는 Enter의 keydown이 compositionend 뒤에
@@ -135,72 +116,5 @@ function Combobox({ value, defaultValue, onValueChange, onOpenChange, emptyMessa
135
116
  ]
136
117
  });
137
118
  }
138
- /**
139
- * 목록을 DOM에 둘지 정하고 portal한다. 닫혀도 퇴장 전환이 끝날 때까지 남긴다(ADR 0018).
140
- * 포커스는 입력에 머물므로 FocusScope로 감싸지 않는다(`focusManagement={false}`). 감싸면 바깥 빈 곳을 눌러 포커스가
141
- * body로 간 뒤 목록이 빠질 때 FocusScope가 입력으로 포커스를 되돌린다(react-aria 3.53.1 FocusScope restoreFocus).
142
- */
143
- function ComboboxPopover(props) {
144
- if (!useOverlayPresence(props.state.isOpen, props.popoverRef)) return null;
145
- return /* @__PURE__ */ jsx(OverlayPortal, {
146
- isExiting: !props.state.isOpen,
147
- focusManagement: false,
148
- children: /* @__PURE__ */ jsx(ComboboxPopoverInner, { ...props })
149
- });
150
- }
151
- /**
152
- * 목록 표면(`listPopupClass`)과 그 안의 `role="listbox"`. 입력 아래 시작 끝에 4px 떨어져 붙고(Select와 같다),
153
- * 폭은 입력보다 좁지 않다. 거른 결과가 없으면 listbox 뒤에 `emptyMessage`를 보인다.
154
- */
155
- function ComboboxPopoverInner({ state, inputRef, popoverRef, listBoxRef, listBoxProps, emptyMessage }) {
156
- useOverlayTheme(inputRef, popoverRef);
157
- useLayoutEffect(() => {
158
- const popover = popoverRef.current;
159
- const width = inputRef.current?.offsetWidth;
160
- if (popover && width) popover.style.minWidth = `min(${width}px, 100vw - 24px)`;
161
- }, [inputRef, popoverRef]);
162
- const { overlayProps } = usePopoverOverlay({
163
- triggerRef: inputRef,
164
- popoverRef,
165
- placement: "bottom start",
166
- offset: 4,
167
- nonModal: true
168
- }, state);
169
- const { listBoxProps: listProps } = useListBox(listBoxProps, state, listBoxRef);
170
- const empty = state.collection.size === 0;
171
- return /* @__PURE__ */ jsxs("div", {
172
- ...overlayProps,
173
- ref: popoverRef,
174
- "data-open": state.isOpen ? "" : void 0,
175
- className: listPopupClass,
176
- children: [/* @__PURE__ */ jsx("div", {
177
- ...listProps,
178
- ref: listBoxRef,
179
- className: "outline-none",
180
- children: /* @__PURE__ */ jsx(ListBoxNodes, { state })
181
- }), empty && /* @__PURE__ */ jsx("div", {
182
- className: emptyClass,
183
- children: emptyMessage
184
- })]
185
- });
186
- }
187
- /**
188
- * Combobox의 옵션(`role="option"`). `Combobox`나 `ComboboxSection` 바로 안에 둔다. `value`가 고른 값이고 폼에
189
- * 제출된다. 거르기와 고른 뒤 입력에 들어가는 글자는 `textValue`(기본은 내용의 글자)다. 키보드 위치와 마우스를 올린
190
- * 옵션은 highlight, 고른 옵션은 neutral subtle-active 배경과 끝의 체크 아이콘이다(Select 옵션과 같다).
191
- * 상태는 `data-highlighted`, `data-selected`, `data-disabled`로 노출한다.
192
- */
193
- function ComboboxItem(_props) {
194
- return null;
195
- }
196
- asCollectionComponent(ComboboxItem, valueItemCollectionNode);
197
- /**
198
- * 옵션 묶음(`role="group"`). `heading`이 화면에 보이는 제목이자 묶음의 이름이고, 없으면 `aria-label`이 이름이다.
199
- * 거른 결과 묶음 안에 남은 옵션이 없으면 묶음도 빠진다.
200
- */
201
- function ComboboxSection(_props) {
202
- return null;
203
- }
204
- asCollectionComponent(ComboboxSection, sectionCollectionNode);
205
119
 
206
- export { Combobox, ComboboxItem, ComboboxSection };
120
+ export { Combobox };
@@ -0,0 +1,9 @@
1
+ import { ListBoxOptionProps } from "../../_internal/components/ListBoxNodes/types.js";
2
+ export interface ComboboxItemProps extends ListBoxOptionProps {}
3
+ /**
4
+ * Combobox의 옵션(`role="option"`). `Combobox`나 `ComboboxSection` 바로 안에 둔다. `value`가 고른 값이고 폼에
5
+ * 제출된다. 거르기와 고른 뒤 입력에 들어가는 글자는 `textValue`(기본은 내용의 글자)다. 키보드 위치와 마우스를 올린
6
+ * 옵션은 highlight, 고른 옵션은 neutral subtle-active 배경과 끝의 체크 아이콘이다(Select 옵션과 같다).
7
+ * 상태는 `data-highlighted`, `data-selected`, `data-disabled`로 노출한다.
8
+ */
9
+ export declare function ComboboxItem(_props: ComboboxItemProps): null;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+
3
+ import { asCollectionComponent, valueItemCollectionNode } from "../../_internal/libs/listCollection.js";
4
+
5
+ // src/Combobox/components/ComboboxItem.tsx
6
+ /**
7
+ * Combobox의 옵션(`role="option"`). `Combobox`나 `ComboboxSection` 바로 안에 둔다. `value`가 고른 값이고 폼에
8
+ * 제출된다. 거르기와 고른 뒤 입력에 들어가는 글자는 `textValue`(기본은 내용의 글자)다. 키보드 위치와 마우스를 올린
9
+ * 옵션은 highlight, 고른 옵션은 neutral subtle-active 배경과 끝의 체크 아이콘이다(Select 옵션과 같다).
10
+ * 상태는 `data-highlighted`, `data-selected`, `data-disabled`로 노출한다.
11
+ */
12
+ function ComboboxItem(_props) {
13
+ return null;
14
+ }
15
+ asCollectionComponent(ComboboxItem, valueItemCollectionNode);
16
+
17
+ export { ComboboxItem };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+
3
+ import { OverlayPortal } from "../../_internal/components/OverlayPortal.js";
4
+ import { useOverlayPresence } from "../../_internal/hooks/useOverlayPresence.js";
5
+ import { ComboboxPopoverInner } from "./ComboboxPopoverInner.js";
6
+ import { jsx } from "react/jsx-runtime";
7
+
8
+ // src/Combobox/components/ComboboxPopover.tsx
9
+ /**
10
+ * 목록을 DOM에 둘지 정하고 portal한다. 닫혀도 퇴장 전환이 끝날 때까지 남긴다(ADR 0018).
11
+ * 포커스는 입력에 머물므로 FocusScope로 감싸지 않는다(`focusManagement={false}`). 감싸면 바깥 빈 곳을 눌러 포커스가
12
+ * body로 간 뒤 목록이 빠질 때 FocusScope가 입력으로 포커스를 되돌린다(react-aria 3.53.1 FocusScope restoreFocus).
13
+ */
14
+ function ComboboxPopover(props) {
15
+ if (!useOverlayPresence(props.state.isOpen, props.popoverRef)) return null;
16
+ return /* @__PURE__ */ jsx(OverlayPortal, {
17
+ isExiting: !props.state.isOpen,
18
+ focusManagement: false,
19
+ children: /* @__PURE__ */ jsx(ComboboxPopoverInner, { ...props })
20
+ });
21
+ }
22
+
23
+ export { ComboboxPopover };
@@ -0,0 +1,50 @@
1
+ "use client";
2
+
3
+ import { ListBoxNodes } from "../../_internal/components/ListBoxNodes/ListBoxNodes.js";
4
+ import { listPopupClass } from "../../_internal/constants/listClass.js";
5
+ import { useOverlayTheme } from "../../_internal/hooks/useOverlayTheme.js";
6
+ import { usePopoverOverlay } from "../../_internal/hooks/usePopoverOverlay.js";
7
+ import { emptyClass } from "../constants/comboboxClass.js";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { useLayoutEffect } from "react";
10
+ import { useListBox } from "react-aria";
11
+
12
+ // src/Combobox/components/ComboboxPopoverInner.tsx
13
+ /**
14
+ * 목록 표면(`listPopupClass`)과 그 안의 `role="listbox"`. 입력 아래 시작 끝에 4px 떨어져 붙고(Select와 같다),
15
+ * 폭은 입력보다 좁지 않다. 거른 결과가 없으면 listbox 뒤에 `emptyMessage`를 보인다.
16
+ */
17
+ function ComboboxPopoverInner({ state, inputRef, popoverRef, listBoxRef, listBoxProps, emptyMessage }) {
18
+ useOverlayTheme(inputRef, popoverRef);
19
+ useLayoutEffect(() => {
20
+ const popover = popoverRef.current;
21
+ const width = inputRef.current?.offsetWidth;
22
+ if (popover && width) popover.style.minWidth = `min(${width}px, 100vw - 24px)`;
23
+ }, [inputRef, popoverRef]);
24
+ const { overlayProps } = usePopoverOverlay({
25
+ triggerRef: inputRef,
26
+ popoverRef,
27
+ placement: "bottom start",
28
+ offset: 4,
29
+ nonModal: true
30
+ }, state);
31
+ const { listBoxProps: listProps } = useListBox(listBoxProps, state, listBoxRef);
32
+ const empty = state.collection.size === 0;
33
+ return /* @__PURE__ */ jsxs("div", {
34
+ ...overlayProps,
35
+ ref: popoverRef,
36
+ "data-open": state.isOpen ? "" : void 0,
37
+ className: listPopupClass,
38
+ children: [/* @__PURE__ */ jsx("div", {
39
+ ...listProps,
40
+ ref: listBoxRef,
41
+ className: "outline-none",
42
+ children: /* @__PURE__ */ jsx(ListBoxNodes, { state })
43
+ }), empty && /* @__PURE__ */ jsx("div", {
44
+ className: "px-2 py-1.5 text-body-sm text-muted select-none",
45
+ children: emptyMessage
46
+ })]
47
+ });
48
+ }
49
+
50
+ export { ComboboxPopoverInner };
@@ -0,0 +1,7 @@
1
+ import { ListBoxSectionProps } from "../../_internal/components/ListBoxNodes/types.js";
2
+ export interface ComboboxSectionProps extends ListBoxSectionProps {}
3
+ /**
4
+ * 옵션 묶음(`role="group"`). `heading`이 화면에 보이는 제목이자 묶음의 이름이고, 없으면 `aria-label`이 이름이다.
5
+ * 거른 결과 묶음 안에 남은 옵션이 없으면 묶음도 빠진다.
6
+ */
7
+ export declare function ComboboxSection(_props: ComboboxSectionProps): null;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+
3
+ import { asCollectionComponent, sectionCollectionNode } from "../../_internal/libs/listCollection.js";
4
+
5
+ // src/Combobox/components/ComboboxSection.tsx
6
+ /**
7
+ * 옵션 묶음(`role="group"`). `heading`이 화면에 보이는 제목이자 묶음의 이름이고, 없으면 `aria-label`이 이름이다.
8
+ * 거른 결과 묶음 안에 남은 옵션이 없으면 묶음도 빠진다.
9
+ */
10
+ function ComboboxSection(_props) {
11
+ return null;
12
+ }
13
+ asCollectionComponent(ComboboxSection, sectionCollectionNode);
14
+
15
+ export { ComboboxSection };
@@ -0,0 +1,21 @@
1
+ // src/Combobox/constants/comboboxClass.ts
2
+ const wrapperClass = "flex w-full";
3
+ const inputEndClass = {
4
+ sm: "pe-[34px]",
5
+ md: "pe-9",
6
+ lg: "pe-10"
7
+ };
8
+ const buttonSizeClass = {
9
+ sm: "-ms-[35px] w-[35px] pe-[11px]",
10
+ md: "-ms-[37px] w-[37px] pe-[13px]",
11
+ lg: "-ms-[41px] w-[41px] pe-[17px]"
12
+ };
13
+ const buttonClass = "inline-flex shrink-0 cursor-pointer items-center justify-end text-muted outline-none disabled:cursor-not-allowed disabled:text-disabled";
14
+ /**
15
+ * 거른 결과가 없을 때의 글자. 옵션과 같은 여백·글자 크기라 목록 높이가 옵션 하나와 같다. `text-muted`.
16
+ * listbox 밖(같은 목록 표면 안)에 둔다. listbox 자식은 option·group만 될 수 있어서다. 결과 개수(0개)는 React Aria가
17
+ * live region으로 알린다.
18
+ */
19
+ const emptyClass = "px-2 py-1.5 text-body-sm text-muted select-none";
20
+
21
+ export { buttonClass, buttonSizeClass, emptyClass, inputEndClass, wrapperClass };
@@ -0,0 +1,4 @@
1
+ import { Combobox, ComboboxProps } from "./Combobox.js";
2
+ import { ComboboxItem, ComboboxItemProps } from "./components/ComboboxItem.js";
3
+ import { ComboboxSection, ComboboxSectionProps } from "./components/ComboboxSection.js";
4
+ export { Combobox, ComboboxItem, type ComboboxItemProps, type ComboboxProps, ComboboxSection, type ComboboxSectionProps };
@@ -0,0 +1,8 @@
1
+ import { DialogProps } from "../_internal/components/DialogRoot.js";
2
+ import { ReactElement } from "react";
3
+ /**
4
+ * 트리거와 내용을 잇는 열림 상태. DOM 요소를 만들지 않는다.
5
+ * 안에 `DialogTrigger`(없어도 된다. `open`으로 제어해 Menu 항목 등에서 열 수 있다)와 `DialogContent`를 둔다.
6
+ */
7
+ export declare function Dialog(props: DialogProps): ReactElement;
8
+ export type { DialogProps };
@@ -0,0 +1,18 @@
1
+ "use client";
2
+
3
+ import { DialogRoot } from "../_internal/components/DialogRoot.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+
6
+ // src/Dialog/Dialog.tsx
7
+ /**
8
+ * 트리거와 내용을 잇는 열림 상태. DOM 요소를 만들지 않는다.
9
+ * 안에 `DialogTrigger`(없어도 된다. `open`으로 제어해 Menu 항목 등에서 열 수 있다)와 `DialogContent`를 둔다.
10
+ */
11
+ function Dialog(props) {
12
+ return /* @__PURE__ */ jsx(DialogRoot, {
13
+ ...props,
14
+ alert: false
15
+ });
16
+ }
17
+
18
+ export { Dialog };
@@ -0,0 +1,13 @@
1
+ import { ComponentProps, ReactElement } from "react";
2
+ export interface DialogCloseProps extends ComponentProps<"button"> {
3
+ /**
4
+ * 다른 요소로 렌더한다. 예: `render={<Button variant="ghost" color="neutral" />}`.
5
+ * 기본은 class 없는 `<button type="button">`이다.
6
+ */
7
+ render?: ReactElement;
8
+ }
9
+ /**
10
+ * 누르면 Dialog를 닫는 버튼. `onClick`을 먼저 부르고, 그 안에서 `event.preventDefault()`를 부르면 닫지 않는다.
11
+ * 닫히면 포커스는 열기 전 요소로 돌아간다.
12
+ */
13
+ export declare function DialogClose({ render, onClick, className, ...props }: DialogCloseProps): ReactElement;
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ import { useDialogContext } from "../../_internal/hooks/useDialogContext.js";
4
+ import { renderElement } from "../../_internal/libs/renderElement.js";
5
+ import { createElement } from "react";
6
+
7
+ // src/Dialog/components/DialogClose.tsx
8
+ /**
9
+ * 누르면 Dialog를 닫는 버튼. `onClick`을 먼저 부르고, 그 안에서 `event.preventDefault()`를 부르면 닫지 않는다.
10
+ * 닫히면 포커스는 열기 전 요소로 돌아간다.
11
+ */
12
+ function DialogClose({ render, onClick, className, ...props }) {
13
+ const { state } = useDialogContext("DialogClose");
14
+ const handleClick = (event) => {
15
+ onClick?.(event);
16
+ if (!event.defaultPrevented) state.close();
17
+ };
18
+ const merged = {
19
+ ...props,
20
+ onClick: handleClick,
21
+ className
22
+ };
23
+ if (!render) return createElement("button", {
24
+ type: "button",
25
+ ...merged
26
+ });
27
+ return renderElement({
28
+ defaultElement: "button",
29
+ render,
30
+ baseClassName: "",
31
+ props: merged
32
+ });
33
+ }
34
+
35
+ export { DialogClose };
@@ -0,0 +1,15 @@
1
+ import { DialogSize } from "../types.js";
2
+ import { ComponentProps, ReactElement } from "react";
3
+ export interface DialogContentProps extends Omit<ComponentProps<"div">, "id" | "role"> {
4
+ /** 최대 폭. 기본값은 `md`(32rem)다. 화면이 좁으면 화면 폭 − 32px까지 줄어든다. */
5
+ size?: DialogSize;
6
+ /** 닫기 버튼(IconButton)의 이름. 기본값은 `"닫기"`다. AlertDialog에는 닫기 버튼이 없어 쓰지 않는다. */
7
+ closeLabel?: string;
8
+ }
9
+ /**
10
+ * 화면 가운데 뜨는 모달 내용(`role="dialog"`, AlertDialog 안에서는 `role="alertdialog"`).
11
+ * 열릴 때만 `document.body`에 portal하고, 반투명 막(`bg-overlay`)과 함께 `z-modal`로 쌓는다.
12
+ * 등장은 opacity + scale 0.96 → 1(`normal`), 퇴장은 opacity + scale 0.98(`fast`)이다. 움직임 줄이기에서는 opacity만 바뀐다.
13
+ * Dialog에는 끝 위쪽에 닫기 버튼(IconButton)이 있고 바깥 막을 누르면 닫힌다. AlertDialog는 둘 다 없다(Esc는 닫는다).
14
+ */
15
+ export declare function DialogContent(props: DialogContentProps): ReactElement | null;
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ import { OverlayPortal } from "../../_internal/components/OverlayPortal.js";
4
+ import { useDialogContext } from "../../_internal/hooks/useDialogContext.js";
5
+ import { useOverlayPresence } from "../../_internal/hooks/useOverlayPresence.js";
6
+ import { DialogContentInner } from "./DialogContentInner.js";
7
+ import { jsx } from "react/jsx-runtime";
8
+ import { useRef } from "react";
9
+
10
+ // src/Dialog/components/DialogContent.tsx
11
+ /**
12
+ * 화면 가운데 뜨는 모달 내용(`role="dialog"`, AlertDialog 안에서는 `role="alertdialog"`).
13
+ * 열릴 때만 `document.body`에 portal하고, 반투명 막(`bg-overlay`)과 함께 `z-modal`로 쌓는다.
14
+ * 등장은 opacity + scale 0.96 → 1(`normal`), 퇴장은 opacity + scale 0.98(`fast`)이다. 움직임 줄이기에서는 opacity만 바뀐다.
15
+ * Dialog에는 끝 위쪽에 닫기 버튼(IconButton)이 있고 바깥 막을 누르면 닫힌다. AlertDialog는 둘 다 없다(Esc는 닫는다).
16
+ */
17
+ function DialogContent(props) {
18
+ const context = useDialogContext("DialogContent");
19
+ const backdropRef = useRef(null);
20
+ if (!useOverlayPresence(context.state.isOpen, backdropRef)) return null;
21
+ return /* @__PURE__ */ jsx(OverlayPortal, {
22
+ isExiting: !context.state.isOpen,
23
+ children: /* @__PURE__ */ jsx(DialogContentInner, {
24
+ ...props,
25
+ context,
26
+ backdropRef
27
+ })
28
+ });
29
+ }
30
+
31
+ export { DialogContent };
@@ -0,0 +1,68 @@
1
+ "use client";
2
+
3
+ import { useOverlayTheme } from "../../_internal/hooks/useOverlayTheme.js";
4
+ import { cn } from "../../_internal/libs/cn.js";
5
+ import { IconButton } from "../../IconButton/IconButton.js";
6
+ import { backdropClass, contentClass, sizeClass } from "../constants/dialogClass.js";
7
+ import { DialogPartsContext } from "../hooks/useDialogPartsContext.js";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { useEffect, useMemo, useRef, useState } from "react";
10
+ import { XIcon } from "@tide-design/icons";
11
+ import { mergeProps, mergeRefs, useDialog, useFocusManager, useModalOverlay } from "react-aria";
12
+
13
+ // src/Dialog/components/DialogContentInner.tsx
14
+ /** DOM에 있는 동안만 portal 안에서 렌더한다. React Aria 오버레이 hook은 요소가 있다고 보고 동작한다. */
15
+ function DialogContentInner({ context, backdropRef, size = "md", closeLabel = "닫기", ref, className, children, ...props }) {
16
+ const { state, triggerRef, contentId, triggerId, alert } = context;
17
+ const dialogRef = useRef(null);
18
+ const [titleId, setTitleId] = useState(null);
19
+ const [descriptionId, setDescriptionId] = useState(null);
20
+ useOverlayTheme(triggerRef, backdropRef);
21
+ const { modalProps, underlayProps } = useModalOverlay({ isDismissable: !alert }, state, dialogRef);
22
+ const labelledBy = props["aria-labelledby"] ?? (props["aria-label"] ? void 0 : titleId ?? triggerId ?? void 0);
23
+ const describedBy = props["aria-describedby"] ?? descriptionId ?? void 0;
24
+ const { dialogProps } = useDialog({
25
+ role: alert ? "alertdialog" : "dialog",
26
+ "aria-label": props["aria-label"],
27
+ "aria-labelledby": labelledBy,
28
+ "aria-describedby": describedBy
29
+ }, dialogRef);
30
+ const focusManager = useFocusManager();
31
+ useEffect(() => {
32
+ if (alert && document.activeElement === dialogRef.current) focusManager?.focusFirst({ tabbable: true });
33
+ }, []);
34
+ const mergedRef = useMemo(() => mergeRefs(ref, dialogRef), [ref]);
35
+ const parts = useMemo(() => ({
36
+ alert,
37
+ setTitleId,
38
+ setDescriptionId
39
+ }), [alert]);
40
+ const open = state.isOpen ? "" : void 0;
41
+ return /* @__PURE__ */ jsx("div", {
42
+ ...underlayProps,
43
+ ref: backdropRef,
44
+ "data-open": open,
45
+ className: backdropClass,
46
+ children: /* @__PURE__ */ jsxs("div", {
47
+ ...mergeProps(props, modalProps, dialogProps),
48
+ id: contentId,
49
+ ref: mergedRef,
50
+ "data-open": open,
51
+ className: cn(contentClass, sizeClass[size], className),
52
+ children: [/* @__PURE__ */ jsx(DialogPartsContext, {
53
+ value: parts,
54
+ children
55
+ }), !alert && /* @__PURE__ */ jsx(IconButton, {
56
+ "aria-label": closeLabel,
57
+ variant: "ghost",
58
+ color: "neutral",
59
+ size: "sm",
60
+ onClick: state.close,
61
+ className: "absolute end-5 top-5",
62
+ children: /* @__PURE__ */ jsx(XIcon, {})
63
+ })]
64
+ })
65
+ });
66
+ }
67
+
68
+ export { DialogContentInner };
@@ -0,0 +1,7 @@
1
+ import { ComponentProps, ReactElement } from "react";
2
+ export type DialogDescriptionProps = ComponentProps<"p">;
3
+ /**
4
+ * Dialog 설명(`<p>`, `text-muted`). 있으면 dialog의 `aria-describedby`가 가리킨다. AlertDialog에서는 알릴 내용을 여기에 쓴다.
5
+ * 목록·여러 문단처럼 구조가 있는 내용은 한 줄로 읽히므로 이 요소 밖에 둔다(APG Dialog).
6
+ */
7
+ export declare function DialogDescription({ id, className, ...props }: DialogDescriptionProps): ReactElement;
@@ -0,0 +1,23 @@
1
+ "use client";
2
+
3
+ import { cn } from "../../_internal/libs/cn.js";
4
+ import { useDialogPartsContext } from "../hooks/useDialogPartsContext.js";
5
+ import { usePartId } from "../hooks/usePartId.js";
6
+ import { jsx } from "react/jsx-runtime";
7
+
8
+ // src/Dialog/components/DialogDescription.tsx
9
+ /**
10
+ * Dialog 설명(`<p>`, `text-muted`). 있으면 dialog의 `aria-describedby`가 가리킨다. AlertDialog에서는 알릴 내용을 여기에 쓴다.
11
+ * 목록·여러 문단처럼 구조가 있는 내용은 한 줄로 읽히므로 이 요소 밖에 둔다(APG Dialog).
12
+ */
13
+ function DialogDescription({ id, className, ...props }) {
14
+ const { setDescriptionId } = useDialogPartsContext("DialogDescription");
15
+ const resolvedId = usePartId(id, setDescriptionId);
16
+ return /* @__PURE__ */ jsx("p", {
17
+ ...props,
18
+ id: resolvedId,
19
+ className: cn("text-body-md text-muted", className)
20
+ });
21
+ }
22
+
23
+ export { DialogDescription };
@@ -0,0 +1,4 @@
1
+ import { ComponentProps, ReactElement } from "react";
2
+ export type DialogFooterProps = ComponentProps<"div">;
3
+ /** 동작 버튼 줄. 끝쪽에 맞추고 버튼 사이는 8px이다. 앞에 덜 위험한 동작(취소)을, 끝에 주 동작을 둔다. */
4
+ export declare function DialogFooter({ className, ...props }: DialogFooterProps): ReactElement;
@@ -0,0 +1,13 @@
1
+ import { cn } from "../../_internal/libs/cn.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+
4
+ // src/Dialog/components/DialogFooter.tsx
5
+ /** 동작 버튼 줄. 끝쪽에 맞추고 버튼 사이는 8px이다. 앞에 덜 위험한 동작(취소)을, 끝에 주 동작을 둔다. */
6
+ function DialogFooter({ className, ...props }) {
7
+ return /* @__PURE__ */ jsx("div", {
8
+ ...props,
9
+ className: cn("mt-2 flex flex-wrap justify-end gap-2", className)
10
+ });
11
+ }
12
+
13
+ export { DialogFooter };