@primitiv-ui/react 0.1.0 → 0.1.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 (207) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +2 -1
  3. package/src/AccessibleIcon/AccessibleIcon.tsx +6 -2
  4. package/src/AccessibleIcon/__tests__/AccessibleIcon.test.tsx +1 -1
  5. package/src/AccessibleIcon/types.ts +4 -0
  6. package/src/Accordion/Accordion.tsx +34 -12
  7. package/src/Accordion/AccordionContext.ts +1 -1
  8. package/src/Accordion/__tests__/Accordion.reading-direction.test.tsx +1 -1
  9. package/src/Accordion/hooks/useAccordionItem.ts +1 -1
  10. package/src/Accordion/hooks/useAccordionRoot.ts +1 -1
  11. package/src/Accordion/hooks/useAccordionTrigger.ts +2 -2
  12. package/src/Accordion/index.ts +2 -1
  13. package/src/Accordion/types.ts +55 -13
  14. package/src/Alert/Alert.tsx +9 -2
  15. package/src/Alert/__tests__/Alert.test.tsx +1 -1
  16. package/src/Alert/types.ts +1 -0
  17. package/src/Avatar/Avatar.tsx +20 -7
  18. package/src/Avatar/AvatarContext.ts +12 -6
  19. package/src/Breadcrumb/Breadcrumb.tsx +32 -10
  20. package/src/Button/Button.tsx +5 -2
  21. package/src/Button/types.ts +4 -0
  22. package/src/Carousel/Carousel.tsx +30 -14
  23. package/src/Carousel/CarouselContext.ts +7 -3
  24. package/src/Carousel/__tests__/Carousel.asChild.test.tsx +1 -1
  25. package/src/Carousel/__tests__/Carousel.auto-play.test.tsx +1 -1
  26. package/src/Carousel/__tests__/Carousel.basic-rendering.test.tsx +1 -1
  27. package/src/Carousel/__tests__/Carousel.controlled-state.test.tsx +1 -1
  28. package/src/Carousel/__tests__/Carousel.error-handling.test.tsx +1 -1
  29. package/src/Carousel/__tests__/Carousel.ids.test.tsx +1 -1
  30. package/src/Carousel/__tests__/Carousel.imperative-api.test.tsx +2 -2
  31. package/src/Carousel/__tests__/Carousel.indicators.test.tsx +1 -1
  32. package/src/Carousel/__tests__/Carousel.intersection-observer.test.tsx +2 -2
  33. package/src/Carousel/__tests__/Carousel.keyboard-navigation.test.tsx +1 -1
  34. package/src/Carousel/__tests__/Carousel.play-pause.test.tsx +1 -1
  35. package/src/Carousel/__tests__/Carousel.prev-next.test.tsx +1 -1
  36. package/src/Carousel/__tests__/Carousel.reduced-motion.test.tsx +1 -1
  37. package/src/Carousel/__tests__/Carousel.refresh-progress.test.tsx +2 -2
  38. package/src/Carousel/__tests__/Carousel.scroll-snap-change.test.tsx +1 -1
  39. package/src/Carousel/__tests__/Carousel.scroll-sync.test.tsx +1 -1
  40. package/src/Carousel/__tests__/Carousel.slides-per-move.test.tsx +1 -1
  41. package/src/Carousel/__tests__/Carousel.slides-per-page.test.tsx +1 -1
  42. package/src/Carousel/__tests__/Carousel.touch-interaction.test.tsx +1 -1
  43. package/src/Carousel/__tests__/Carousel.transition-modes.test.tsx +1 -1
  44. package/src/Carousel/__tests__/Carousel.translations.test.tsx +1 -1
  45. package/src/Carousel/__tests__/Carousel.uncontrolled-state.test.tsx +1 -1
  46. package/src/Carousel/types.ts +8 -0
  47. package/src/Checkbox/Checkbox.tsx +11 -6
  48. package/src/Checkbox/CheckboxContext.ts +1 -1
  49. package/src/Checkbox/hooks/useCheckboxRoot.ts +1 -1
  50. package/src/Checkbox/index.ts +1 -0
  51. package/src/Checkbox/types.ts +30 -3
  52. package/src/CheckboxCard/CheckboxCard.tsx +13 -11
  53. package/src/CheckboxCard/CheckboxCardContext.ts +19 -6
  54. package/src/CheckboxCard/hooks/useCheckboxCardRoot.ts +2 -2
  55. package/src/CheckboxCard/types.ts +21 -5
  56. package/src/Collapsible/Collapsible.tsx +37 -21
  57. package/src/Collapsible/CollapsibleContext.ts +1 -1
  58. package/src/Collapsible/hooks/useCollapsibleRoot.ts +1 -1
  59. package/src/Collapsible/hooks/useCollapsibleTrigger.ts +1 -1
  60. package/src/Collapsible/index.ts +1 -0
  61. package/src/Collapsible/types.ts +45 -12
  62. package/src/ContextMenu/ContextMenu.tsx +60 -34
  63. package/src/ContextMenu/ContextMenuContext.ts +2 -2
  64. package/src/ContextMenu/ContextMenuSubContext.ts +1 -1
  65. package/src/ContextMenu/__tests__/ContextMenu.reading-direction.test.tsx +1 -1
  66. package/src/ContextMenu/index.ts +2 -1
  67. package/src/ContextMenu/types.ts +160 -17
  68. package/src/DirectionProvider/DirectionProvider.tsx +7 -1
  69. package/src/DirectionProvider/__tests__/DirectionProvider.test.tsx +1 -1
  70. package/src/DirectionProvider/types.ts +1 -0
  71. package/src/Divider/Divider.tsx +4 -1
  72. package/src/Divider/__tests__/Divider.test.tsx +1 -1
  73. package/src/Divider/index.ts +2 -1
  74. package/src/Divider/types.ts +5 -0
  75. package/src/Dropdown/Dropdown.tsx +60 -34
  76. package/src/Dropdown/DropdownContext.ts +2 -2
  77. package/src/Dropdown/DropdownSubContext.ts +1 -1
  78. package/src/Dropdown/__tests__/Dropdown.reading-direction.test.tsx +1 -1
  79. package/src/Dropdown/hooks/useDropdownContent.ts +1 -1
  80. package/src/Dropdown/hooks/useDropdownItem.ts +1 -1
  81. package/src/Dropdown/hooks/useDropdownRoot.ts +2 -2
  82. package/src/Dropdown/hooks/useDropdownTrigger.ts +1 -1
  83. package/src/Dropdown/index.ts +2 -1
  84. package/src/Dropdown/types.ts +153 -25
  85. package/src/EmptyState/EmptyState.tsx +34 -20
  86. package/src/EmptyState/__tests__/EmptyState.Actions.test.tsx +1 -1
  87. package/src/EmptyState/__tests__/EmptyState.Description.test.tsx +1 -1
  88. package/src/EmptyState/__tests__/EmptyState.Media.test.tsx +1 -1
  89. package/src/EmptyState/__tests__/EmptyState.Root.test.tsx +1 -1
  90. package/src/EmptyState/__tests__/EmptyState.Title.test.tsx +1 -1
  91. package/src/EmptyState/types.ts +2 -1
  92. package/src/Field/Field.tsx +24 -10
  93. package/src/Field/FieldContext.ts +1 -1
  94. package/src/Field/types.ts +4 -0
  95. package/src/Fieldset/Fieldset.tsx +26 -10
  96. package/src/Fieldset/types.ts +2 -0
  97. package/src/Input/Input.tsx +6 -3
  98. package/src/Input/__tests__/Input.field-integration.test.tsx +1 -1
  99. package/src/Input/types.ts +4 -0
  100. package/src/InputGroup/InputGroup.tsx +15 -8
  101. package/src/InputGroup/types.ts +9 -0
  102. package/src/MillerColumns/MillerColumns.tsx +28 -8
  103. package/src/MillerColumns/MillerColumnsContext.ts +1 -1
  104. package/src/MillerColumns/hooks/useMillerColumnsItem.ts +2 -2
  105. package/src/MillerColumns/hooks/useMillerColumnsRoot.ts +0 -0
  106. package/src/MillerColumns/index.ts +1 -1
  107. package/src/MillerColumns/types.ts +67 -14
  108. package/src/MillerColumns/useMillerColumnsSelection.ts +1 -1
  109. package/src/Modal/Modal.tsx +25 -11
  110. package/src/Modal/ModalContext.ts +14 -7
  111. package/src/Modal/hooks/useModalRoot.ts +1 -1
  112. package/src/Modal/hooks/useModalTrigger.ts +2 -2
  113. package/src/Modal/types.ts +51 -2
  114. package/src/Portal/Portal.tsx +3 -1
  115. package/src/Portal/types.ts +4 -0
  116. package/src/Progress/Progress.tsx +12 -7
  117. package/src/Progress/ProgressContext.ts +18 -6
  118. package/src/RadioCard/RadioCard.tsx +17 -11
  119. package/src/RadioCard/RadioCardContext.ts +17 -5
  120. package/src/RadioCard/RadioCardItemContext.ts +18 -5
  121. package/src/RadioCard/__tests__/RadioCard.reading-direction.test.tsx +1 -1
  122. package/src/RadioCard/hooks/useRadioCardRoot.ts +1 -1
  123. package/src/RadioCard/types.ts +24 -3
  124. package/src/RadioGroup/RadioGroup.tsx +17 -11
  125. package/src/RadioGroup/RadioGroupContext.ts +1 -1
  126. package/src/RadioGroup/RadioGroupItemContext.ts +1 -1
  127. package/src/RadioGroup/__tests__/RadioGroup.reading-direction.test.tsx +1 -1
  128. package/src/RadioGroup/hooks/useRadioGroupRoot.ts +1 -1
  129. package/src/RadioGroup/index.ts +1 -0
  130. package/src/RadioGroup/types.ts +34 -3
  131. package/src/Select/Select.tsx +23 -8
  132. package/src/Select/__tests__/Select.field-integration.test.tsx +1 -1
  133. package/src/Select/index.ts +1 -1
  134. package/src/Select/types.ts +18 -3
  135. package/src/SkipNav/SkipNav.tsx +7 -2
  136. package/src/SkipNav/__tests__/SkipNav.ids.test.tsx +1 -1
  137. package/src/Slider/Slider.tsx +26 -11
  138. package/src/Slider/SliderContext.ts +13 -6
  139. package/src/Slider/__tests__/Slider.reading-direction.test.tsx +1 -1
  140. package/src/Slider/hooks/useSliderRoot.ts +1 -1
  141. package/src/Slider/types.ts +12 -3
  142. package/src/Status/Status.tsx +9 -2
  143. package/src/Status/__tests__/Status.test.tsx +1 -1
  144. package/src/Status/types.ts +4 -0
  145. package/src/Switch/Switch.tsx +16 -6
  146. package/src/Switch/SwitchContext.ts +13 -5
  147. package/src/Switch/hooks/useSwitchRoot.ts +1 -1
  148. package/src/Switch/types.ts +24 -3
  149. package/src/Table/Table.tsx +51 -25
  150. package/src/Table/__tests__/Table.Body.test.tsx +1 -1
  151. package/src/Table/__tests__/Table.Caption.test.tsx +1 -1
  152. package/src/Table/__tests__/Table.Cell.test.tsx +1 -1
  153. package/src/Table/__tests__/Table.Footer.test.tsx +1 -1
  154. package/src/Table/__tests__/Table.Head.test.tsx +1 -1
  155. package/src/Table/__tests__/Table.Header.test.tsx +1 -1
  156. package/src/Table/__tests__/Table.Root.test.tsx +1 -1
  157. package/src/Table/__tests__/Table.Row.test.tsx +1 -1
  158. package/src/Table/__tests__/Table.ScrollArea.test.tsx +1 -1
  159. package/src/Table/index.ts +2 -1
  160. package/src/Tabs/Tabs.tsx +30 -10
  161. package/src/Tabs/TabsContext.ts +15 -7
  162. package/src/Tabs/__tests__/Tabs.asChild.test.tsx +1 -1
  163. package/src/Tabs/__tests__/Tabs.basic-rendering.test.tsx +1 -1
  164. package/src/Tabs/__tests__/Tabs.change-event-callbacks.test.tsx +1 -1
  165. package/src/Tabs/__tests__/Tabs.controlled-state.test.tsx +1 -1
  166. package/src/Tabs/__tests__/Tabs.error-handling.test.tsx +1 -1
  167. package/src/Tabs/__tests__/Tabs.imperative-api.test.tsx +1 -1
  168. package/src/Tabs/__tests__/Tabs.keyboard-interaction.test.tsx +1 -1
  169. package/src/Tabs/__tests__/Tabs.lazy-mount.test.tsx +1 -1
  170. package/src/Tabs/__tests__/Tabs.mouse-interaction.test.tsx +1 -1
  171. package/src/Tabs/__tests__/Tabs.reading-direction.test.tsx +1 -1
  172. package/src/Tabs/__tests__/Tabs.uncontrolled-state.test.tsx +1 -1
  173. package/src/Tabs/hooks/useTabsContent.ts +1 -1
  174. package/src/Tabs/hooks/useTabsRoot.ts +1 -1
  175. package/src/Tabs/hooks/useTabsTrigger.ts +1 -1
  176. package/src/Tabs/types.ts +35 -1
  177. package/src/Tabs/utils.ts +1 -1
  178. package/src/Textarea/Textarea.tsx +6 -3
  179. package/src/Textarea/__tests__/Textarea.field-integration.test.tsx +1 -1
  180. package/src/Textarea/types.ts +4 -0
  181. package/src/Toggle/Toggle.tsx +11 -4
  182. package/src/Toggle/types.ts +7 -3
  183. package/src/ToggleGroup/ToggleGroup.tsx +23 -13
  184. package/src/ToggleGroup/ToggleGroupContext.ts +1 -1
  185. package/src/ToggleGroup/__tests__/ToggleGroup.reading-direction.test.tsx +1 -1
  186. package/src/ToggleGroup/hooks/useToggleGroupRoot.ts +1 -1
  187. package/src/ToggleGroup/types.ts +45 -5
  188. package/src/Tooltip/Tooltip.tsx +46 -15
  189. package/src/Tooltip/TooltipContext.ts +1 -1
  190. package/src/Tooltip/hooks/useTooltipContent.ts +1 -1
  191. package/src/Tooltip/hooks/useTooltipRoot.ts +1 -1
  192. package/src/Tooltip/hooks/useTooltipTrigger.ts +1 -1
  193. package/src/Tooltip/index.ts +1 -0
  194. package/src/Tooltip/types.ts +50 -2
  195. package/src/Tree/Tree.tsx +58 -12
  196. package/src/Tree/TreeContext.ts +1 -1
  197. package/src/Tree/__tests__/Tree.selection-path.test.tsx +2 -2
  198. package/src/Tree/hooks/useTreeItemKeyboard.ts +1 -1
  199. package/src/Tree/hooks/useTreeRoot.ts +1 -1
  200. package/src/Tree/index.ts +1 -1
  201. package/src/Tree/types.ts +39 -7
  202. package/src/VisuallyHidden/VisuallyHidden.tsx +4 -2
  203. package/src/VisuallyHidden/__tests__/VisuallyHidden.test.tsx +1 -1
  204. package/src/VisuallyHidden/types.ts +4 -0
  205. package/src/index.ts +39 -38
  206. package/src/types.ts +1 -0
  207. package/src/utils/createStrictContext.ts +9 -5
@@ -1,9 +1,10 @@
1
1
  import { useContext, useEffect, useId, useMemo, useRef, useState } from "react";
2
+ import type { ReactElement } from "react";
2
3
 
3
- import { useCheckboxRoot } from "../Checkbox/hooks";
4
- import { useDirection } from "../DirectionProvider";
5
- import { useRadioGroupRoot } from "../RadioGroup/hooks";
6
- import { composeEventHandlers, Slot } from "../Slot";
4
+ import { useCheckboxRoot } from "../Checkbox/hooks/index.ts";
5
+ import { useDirection } from "../DirectionProvider/index.ts";
6
+ import { useRadioGroupRoot } from "../RadioGroup/hooks/index.ts";
7
+ import { composeEventHandlers, Slot } from "../Slot/index.ts";
7
8
 
8
9
  import { DropdownContext } from "./DropdownContext";
9
10
  import { DropdownContentContext } from "./DropdownContentContext";
@@ -21,7 +22,7 @@ import {
21
22
  useDropdownRoot,
22
23
  useDropdownSubContext,
23
24
  useDropdownTrigger,
24
- } from "./hooks";
25
+ } from "./hooks/index.ts";
25
26
  import {
26
27
  DropdownCheckboxItemProps,
27
28
  DropdownContentProps,
@@ -84,13 +85,13 @@ import { MENUITEM_SELECTOR } from "./constants";
84
85
  * </Dropdown.Root>
85
86
  * ```
86
87
  */
87
- function DropdownRoot({
88
+ export function DropdownRoot({
88
89
  defaultOpen,
89
90
  open,
90
91
  onOpenChange,
91
92
  dir,
92
93
  children,
93
- }: DropdownRootProps) {
94
+ }: DropdownRootProps): ReactElement {
94
95
  const inheritedDir = useDirection();
95
96
  const { contextValue } = useDropdownRoot({
96
97
  defaultOpen,
@@ -106,6 +107,7 @@ function DropdownRoot({
106
107
  );
107
108
  }
108
109
 
110
+ /** @internal */
109
111
  DropdownRoot.displayName = "DropdownRoot";
110
112
 
111
113
  /**
@@ -126,12 +128,12 @@ DropdownRoot.displayName = "DropdownRoot";
126
128
  * </Dropdown.Trigger>
127
129
  * ```
128
130
  */
129
- function DropdownTrigger({
131
+ export function DropdownTrigger({
130
132
  children,
131
133
  onClick,
132
134
  asChild = false,
133
135
  ...rest
134
- }: DropdownTriggerProps) {
136
+ }: DropdownTriggerProps): ReactElement {
135
137
  const { triggerProps } = useDropdownTrigger({ onClick, restProps: rest });
136
138
 
137
139
  if (asChild) {
@@ -145,6 +147,7 @@ function DropdownTrigger({
145
147
  );
146
148
  }
147
149
 
150
+ /** @internal */
148
151
  DropdownTrigger.displayName = "DropdownTrigger";
149
152
 
150
153
  /**
@@ -178,12 +181,12 @@ DropdownTrigger.displayName = "DropdownTrigger";
178
181
  * lands on the next sibling item in the parent rather than getting
179
182
  * stuck on a non-focusable item inside a closed sub-popover.
180
183
  */
181
- function DropdownContent({
184
+ export function DropdownContent({
182
185
  children,
183
186
  onKeyDown,
184
187
  asChild = false,
185
188
  ...rest
186
- }: DropdownContentProps) {
189
+ }: DropdownContentProps): ReactElement {
187
190
  const { contentContextValue, contentProps } = useDropdownContent({
188
191
  onKeyDown,
189
192
  restProps: rest,
@@ -200,6 +203,7 @@ function DropdownContent({
200
203
  );
201
204
  }
202
205
 
206
+ /** @internal */
203
207
  DropdownContent.displayName = "DropdownContent";
204
208
 
205
209
  /**
@@ -215,14 +219,14 @@ DropdownContent.displayName = "DropdownContent";
215
219
  * Disabled items receive `aria-disabled="true"` and are skipped by arrow
216
220
  * navigation, typeahead, and activation handlers.
217
221
  */
218
- function DropdownItem({
222
+ export function DropdownItem({
219
223
  children,
220
224
  onClick,
221
225
  onSelect,
222
226
  disabled,
223
227
  asChild = false,
224
228
  ...rest
225
- }: DropdownItemProps) {
229
+ }: DropdownItemProps): ReactElement {
226
230
  const { itemProps } = useDropdownItem({
227
231
  disabled,
228
232
  onClick,
@@ -237,6 +241,7 @@ function DropdownItem({
237
241
  return <li {...itemProps}>{children}</li>;
238
242
  }
239
243
 
244
+ /** @internal */
240
245
  DropdownItem.displayName = "DropdownItem";
241
246
 
242
247
  /**
@@ -244,11 +249,11 @@ DropdownItem.displayName = "DropdownItem";
244
249
  * by default; pass `asChild` to render any element with separator semantics.
245
250
  * Non-interactive — skipped by focus, arrow navigation, and typeahead.
246
251
  */
247
- function DropdownSeparator({
252
+ export function DropdownSeparator({
248
253
  asChild = false,
249
254
  children,
250
255
  ...rest
251
- }: DropdownSeparatorProps) {
256
+ }: DropdownSeparatorProps): ReactElement {
252
257
  const separatorProps = { ...rest, role: "separator" as const };
253
258
 
254
259
  if (asChild) {
@@ -258,6 +263,7 @@ function DropdownSeparator({
258
263
  return <li {...separatorProps} />;
259
264
  }
260
265
 
266
+ /** @internal */
261
267
  DropdownSeparator.displayName = "DropdownSeparator";
262
268
 
263
269
  /**
@@ -270,11 +276,11 @@ DropdownSeparator.displayName = "DropdownSeparator";
270
276
  * first child to provide the accessible name; screen readers will announce
271
277
  * the group when arrowing into it.
272
278
  */
273
- function DropdownGroup({
279
+ export function DropdownGroup({
274
280
  children,
275
281
  asChild = false,
276
282
  ...rest
277
- }: DropdownGroupProps) {
283
+ }: DropdownGroupProps): ReactElement {
278
284
  const { contextValue, groupProps } = useDropdownGroup({ restProps: rest });
279
285
 
280
286
  return (
@@ -290,6 +296,7 @@ function DropdownGroup({
290
296
  );
291
297
  }
292
298
 
299
+ /** @internal */
293
300
  DropdownGroup.displayName = "DropdownGroup";
294
301
 
295
302
  /**
@@ -301,12 +308,12 @@ DropdownGroup.displayName = "DropdownGroup";
301
308
  * Renders a `<li>` by default; pass `asChild` to render any element. A
302
309
  * caller-supplied `id` takes precedence over the auto-generated one.
303
310
  */
304
- function DropdownLabel({
311
+ export function DropdownLabel({
305
312
  id,
306
313
  children,
307
314
  asChild = false,
308
315
  ...rest
309
- }: DropdownLabelProps) {
316
+ }: DropdownLabelProps): ReactElement {
310
317
  const { labelProps } = useDropdownLabel({ id, restProps: rest });
311
318
 
312
319
  if (asChild) {
@@ -315,6 +322,7 @@ function DropdownLabel({
315
322
  return <li {...labelProps}>{children}</li>;
316
323
  }
317
324
 
325
+ /** @internal */
318
326
  DropdownLabel.displayName = "DropdownLabel";
319
327
 
320
328
  /**
@@ -343,7 +351,7 @@ DropdownLabel.displayName = "DropdownLabel";
343
351
  *
344
352
  * Disabled items receive `aria-disabled="true"` and no-op on activation.
345
353
  */
346
- function DropdownCheckboxItem({
354
+ export function DropdownCheckboxItem({
347
355
  children,
348
356
  onClick,
349
357
  onSelect,
@@ -353,7 +361,7 @@ function DropdownCheckboxItem({
353
361
  onCheckedChange,
354
362
  asChild = false,
355
363
  ...rest
356
- }: DropdownCheckboxItemProps) {
364
+ }: DropdownCheckboxItemProps): ReactElement {
357
365
  const { setOpen, triggerRef } = useDropdownContext();
358
366
  const closeSiblingSub = useCloseSiblingSub();
359
367
  const [highlighted, setHighlighted] = useState(false);
@@ -403,6 +411,7 @@ function DropdownCheckboxItem({
403
411
  );
404
412
  }
405
413
 
414
+ /** @internal */
406
415
  DropdownCheckboxItem.displayName = "DropdownCheckboxItem";
407
416
 
408
417
  /**
@@ -417,14 +426,14 @@ DropdownCheckboxItem.displayName = "DropdownCheckboxItem";
417
426
  * Optional `onValueChange` observes selections.
418
427
  * - **Controlled** — pass `value` *and* `onValueChange` together.
419
428
  */
420
- function DropdownRadioGroup({
429
+ export function DropdownRadioGroup({
421
430
  defaultValue,
422
431
  value: controlledValue,
423
432
  onValueChange,
424
433
  children,
425
434
  asChild = false,
426
435
  ...rest
427
- }: DropdownRadioGroupProps) {
436
+ }: DropdownRadioGroupProps): ReactElement {
428
437
  const { value, select } = useRadioGroupRoot({
429
438
  defaultValue,
430
439
  value: controlledValue,
@@ -445,6 +454,7 @@ function DropdownRadioGroup({
445
454
  );
446
455
  }
447
456
 
457
+ /** @internal */
448
458
  DropdownRadioGroup.displayName = "DropdownRadioGroup";
449
459
 
450
460
  /**
@@ -467,7 +477,7 @@ DropdownRadioGroup.displayName = "DropdownRadioGroup";
467
477
  *
468
478
  * Disabled items receive `aria-disabled="true"` and no-op on activation.
469
479
  */
470
- function DropdownRadioItem({
480
+ export function DropdownRadioItem({
471
481
  children,
472
482
  onClick,
473
483
  onSelect,
@@ -475,7 +485,7 @@ function DropdownRadioItem({
475
485
  value: itemValue,
476
486
  asChild = false,
477
487
  ...rest
478
- }: DropdownRadioItemProps) {
488
+ }: DropdownRadioItemProps): ReactElement {
479
489
  const { setOpen, triggerRef } = useDropdownContext();
480
490
  const closeSiblingSub = useCloseSiblingSub();
481
491
  const [highlighted, setHighlighted] = useState(false);
@@ -525,6 +535,7 @@ function DropdownRadioItem({
525
535
  );
526
536
  }
527
537
 
538
+ /** @internal */
528
539
  DropdownRadioItem.displayName = "DropdownRadioItem";
529
540
 
530
541
  /**
@@ -554,12 +565,12 @@ DropdownRadioItem.displayName = "DropdownRadioItem";
554
565
  * </Dropdown.CheckboxItem>
555
566
  * ```
556
567
  */
557
- function DropdownItemIndicator({
568
+ export function DropdownItemIndicator({
558
569
  children,
559
570
  asChild = false,
560
571
  forceMount = false,
561
572
  ...rest
562
- }: DropdownItemIndicatorProps) {
573
+ }: DropdownItemIndicatorProps): ReactElement | null {
563
574
  const context = useContext(DropdownItemIndicatorContext);
564
575
  if (!context) {
565
576
  throw new Error(
@@ -581,6 +592,7 @@ function DropdownItemIndicator({
581
592
  return <span {...indicatorProps}>{children}</span>;
582
593
  }
583
594
 
595
+ /** @internal */
584
596
  DropdownItemIndicator.displayName = "DropdownItemIndicator";
585
597
 
586
598
  /**
@@ -608,12 +620,12 @@ DropdownItemIndicator.displayName = "DropdownItemIndicator";
608
620
  * </Dropdown.Root>
609
621
  * ```
610
622
  */
611
- function DropdownSub({
623
+ export function DropdownSub({
612
624
  defaultOpen,
613
625
  open: controlledOpen,
614
626
  onOpenChange,
615
627
  children,
616
- }: DropdownSubProps) {
628
+ }: DropdownSubProps): ReactElement {
617
629
  const { open, setOpen } = useDropdownRoot({
618
630
  defaultOpen,
619
631
  open: controlledOpen,
@@ -650,6 +662,7 @@ function DropdownSub({
650
662
  );
651
663
  }
652
664
 
665
+ /** @internal */
653
666
  DropdownSub.displayName = "DropdownSub";
654
667
 
655
668
  /**
@@ -671,14 +684,14 @@ DropdownSub.displayName = "DropdownSub";
671
684
  * Disabled triggers receive `aria-disabled="true"` and ignore both click
672
685
  * and the open arrow key.
673
686
  */
674
- function DropdownSubTrigger({
687
+ export function DropdownSubTrigger({
675
688
  children,
676
689
  onClick,
677
690
  onKeyDown,
678
691
  disabled,
679
692
  asChild = false,
680
693
  ...rest
681
- }: DropdownSubTriggerProps) {
694
+ }: DropdownSubTriggerProps): ReactElement {
682
695
  const sub = useDropdownSubContext();
683
696
  const { dir } = useDropdownContext();
684
697
  const openKey = dir === "rtl" ? "ArrowLeft" : "ArrowRight";
@@ -720,6 +733,7 @@ function DropdownSubTrigger({
720
733
  return <li {...subTriggerProps}>{children}</li>;
721
734
  }
722
735
 
736
+ /** @internal */
723
737
  DropdownSubTrigger.displayName = "DropdownSubTrigger";
724
738
 
725
739
  /**
@@ -736,12 +750,12 @@ DropdownSubTrigger.displayName = "DropdownSubTrigger";
736
750
  * to the parent {@link DropdownContent | `Dropdown.Content`} so arrow
737
751
  * navigation and typeahead apply to the submenu's items.
738
752
  */
739
- function DropdownSubContent({
753
+ export function DropdownSubContent({
740
754
  children,
741
755
  onKeyDown,
742
756
  asChild = false,
743
757
  ...rest
744
- }: DropdownSubContentProps) {
758
+ }: DropdownSubContentProps): ReactElement {
745
759
  const sub = useDropdownSubContext();
746
760
  const { dir } = useDropdownContext();
747
761
  const closeKey = dir === "rtl" ? "ArrowRight" : "ArrowLeft";
@@ -801,9 +815,11 @@ function DropdownSubContent({
801
815
  );
802
816
  }
803
817
 
818
+ /** @internal */
804
819
  DropdownSubContent.displayName = "DropdownSubContent";
805
820
 
806
- type TDropdownCompound = typeof DropdownRoot & {
821
+ /** Type of the {@link Dropdown} compound: the root callable plus its attached sub-components. */
822
+ export type TDropdownCompound = typeof DropdownRoot & {
807
823
  Root: typeof DropdownRoot;
808
824
  Trigger: typeof DropdownTrigger;
809
825
  Content: typeof DropdownContent;
@@ -820,6 +836,15 @@ type TDropdownCompound = typeof DropdownRoot & {
820
836
  SubContent: typeof DropdownSubContent;
821
837
  };
822
838
 
839
+ /**
840
+ * Headless, accessible **Dropdown** menu — a compound component implementing the
841
+ * [WAI-ARIA menu-button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/)
842
+ * with submenus, checkbox and radio items, groups, labels and separators. Zero
843
+ * styles ship.
844
+ *
845
+ * The default export is the `Root`; sub-components are attached as static
846
+ * properties (`Dropdown.Trigger`, `Dropdown.Content`, …).
847
+ */
823
848
  const DropdownCompound: TDropdownCompound = Object.assign(DropdownRoot, {
824
849
  Root: DropdownRoot,
825
850
  Trigger: DropdownTrigger,
@@ -837,6 +862,7 @@ const DropdownCompound: TDropdownCompound = Object.assign(DropdownRoot, {
837
862
  SubContent: DropdownSubContent,
838
863
  });
839
864
 
865
+ /** @internal */
840
866
  DropdownCompound.displayName = "Dropdown";
841
867
 
842
868
  export { DropdownCompound as Dropdown };
@@ -1,7 +1,7 @@
1
1
  import { RefObject } from "react";
2
2
 
3
- import { Direction } from "../DirectionProvider";
4
- import { createStrictContext } from "../utils";
3
+ import { Direction } from "../DirectionProvider/index.ts";
4
+ import { createStrictContext } from "../utils/index.ts";
5
5
 
6
6
  export type DropdownContextValue = {
7
7
  open: boolean;
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from "react";
2
2
 
3
- import { createStrictContext } from "../utils";
3
+ import { createStrictContext } from "../utils/index.ts";
4
4
 
5
5
  export type DropdownSubContextValue = {
6
6
  open: boolean;
@@ -1,7 +1,7 @@
1
1
  import { render, screen } from "@testing-library/react";
2
2
  import userEvent from "@testing-library/user-event";
3
3
 
4
- import { DirectionProvider } from "../../DirectionProvider";
4
+ import { DirectionProvider } from "../../DirectionProvider/index.ts";
5
5
  import { Dropdown } from "../Dropdown";
6
6
 
7
7
  describe("Dropdown reading direction", () => {
@@ -1,5 +1,5 @@
1
1
  import { useRef, useEffect, useMemo, KeyboardEventHandler } from "react";
2
- import { composeEventHandlers } from "../../Slot";
2
+ import { composeEventHandlers } from "../../Slot/index.ts";
3
3
  import { MENUITEM_SELECTOR, TYPEAHEAD_RESET_MS } from "../constants";
4
4
  import { useDropdownContext } from "./useDropdownContext";
5
5
  import { DropdownContentProps } from "../types";
@@ -1,5 +1,5 @@
1
1
  import { MouseEventHandler, useState } from "react";
2
- import { composeEventHandlers, SlotProps } from "../../Slot";
2
+ import { composeEventHandlers, SlotProps } from "../../Slot/index.ts";
3
3
  import { useCloseSiblingSub } from "./useCloseSiblingSub";
4
4
  import { useDropdownContext } from "./useDropdownContext";
5
5
  import { DropdownItemProps } from "../types";
@@ -6,8 +6,8 @@ import {
6
6
  useRef,
7
7
  } from "react";
8
8
 
9
- import { Direction } from "../../DirectionProvider";
10
- import { useControllableState } from "../../hooks";
9
+ import { Direction } from "../../DirectionProvider/index.ts";
10
+ import { useControllableState } from "../../hooks/index.ts";
11
11
 
12
12
  type UseDropdownRootArgs = {
13
13
  defaultOpen?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { MouseEventHandler } from "react";
2
- import { composeEventHandlers } from "../../Slot";
2
+ import { composeEventHandlers } from "../../Slot/index.ts";
3
3
  import { DropdownTriggerProps } from "../types";
4
4
  import { useDropdownContext } from "./useDropdownContext";
5
5
 
@@ -1 +1,2 @@
1
- export { Dropdown } from "./Dropdown";
1
+ export * from "./Dropdown";
2
+ export * from "./types";