@primitiv-ui/react 0.1.1 → 0.1.3

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 (97) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +2 -1
  3. package/src/AccessibleIcon/AccessibleIcon.tsx +1 -0
  4. package/src/AccessibleIcon/types.ts +4 -0
  5. package/src/Accordion/Accordion.tsx +23 -0
  6. package/src/Accordion/index.ts +2 -1
  7. package/src/Accordion/types.ts +55 -13
  8. package/src/Alert/Alert.tsx +1 -0
  9. package/src/Alert/types.ts +1 -0
  10. package/src/Avatar/Avatar.tsx +8 -4
  11. package/src/Avatar/AvatarContext.ts +2 -0
  12. package/src/Breadcrumb/Breadcrumb.tsx +15 -7
  13. package/src/Button/Button.tsx +1 -0
  14. package/src/Button/types.ts +4 -0
  15. package/src/Carousel/Carousel.tsx +9 -0
  16. package/src/Carousel/CarouselContext.ts +5 -2
  17. package/src/Carousel/types.ts +8 -0
  18. package/src/Checkbox/Checkbox.tsx +7 -3
  19. package/src/Checkbox/index.ts +1 -0
  20. package/src/Checkbox/types.ts +30 -3
  21. package/src/CheckboxCard/CheckboxCard.tsx +9 -8
  22. package/src/CheckboxCard/CheckboxCardContext.ts +9 -1
  23. package/src/CheckboxCard/hooks/useCheckboxCardRoot.ts +1 -1
  24. package/src/CheckboxCard/types.ts +21 -5
  25. package/src/Collapsible/Collapsible.tsx +15 -0
  26. package/src/Collapsible/index.ts +1 -0
  27. package/src/Collapsible/types.ts +45 -12
  28. package/src/ContextMenu/ContextMenu.tsx +40 -15
  29. package/src/ContextMenu/index.ts +2 -1
  30. package/src/ContextMenu/types.ts +159 -16
  31. package/src/DirectionProvider/DirectionProvider.tsx +1 -0
  32. package/src/DirectionProvider/types.ts +1 -0
  33. package/src/Divider/Divider.tsx +1 -0
  34. package/src/Divider/index.ts +2 -1
  35. package/src/Divider/types.ts +5 -0
  36. package/src/Dropdown/Dropdown.tsx +40 -15
  37. package/src/Dropdown/index.ts +2 -1
  38. package/src/Dropdown/types.ts +152 -24
  39. package/src/EmptyState/EmptyState.tsx +26 -14
  40. package/src/EmptyState/types.ts +2 -1
  41. package/src/Field/Field.tsx +14 -5
  42. package/src/Field/types.ts +4 -0
  43. package/src/Fieldset/Fieldset.tsx +17 -10
  44. package/src/Fieldset/types.ts +2 -0
  45. package/src/Input/Input.tsx +1 -0
  46. package/src/Input/types.ts +4 -0
  47. package/src/InputGroup/InputGroup.tsx +9 -4
  48. package/src/InputGroup/types.ts +9 -0
  49. package/src/MillerColumns/MillerColumns.tsx +19 -0
  50. package/src/MillerColumns/index.ts +1 -1
  51. package/src/MillerColumns/types.ts +67 -14
  52. package/src/Modal/Modal.tsx +1 -0
  53. package/src/Modal/ModalContext.ts +5 -2
  54. package/src/Modal/types.ts +51 -2
  55. package/src/Portal/Portal.tsx +1 -0
  56. package/src/Portal/types.ts +4 -0
  57. package/src/Progress/Progress.tsx +7 -3
  58. package/src/Progress/ProgressContext.ts +7 -0
  59. package/src/RadioCard/RadioCard.tsx +9 -4
  60. package/src/RadioCard/RadioCardContext.ts +7 -0
  61. package/src/RadioCard/RadioCardItemContext.ts +8 -0
  62. package/src/RadioCard/types.ts +24 -3
  63. package/src/RadioGroup/RadioGroup.tsx +9 -4
  64. package/src/RadioGroup/index.ts +1 -0
  65. package/src/RadioGroup/types.ts +34 -3
  66. package/src/Select/Select.tsx +16 -5
  67. package/src/Select/index.ts +1 -1
  68. package/src/Select/types.ts +18 -3
  69. package/src/Slider/Slider.tsx +10 -5
  70. package/src/Slider/SliderContext.ts +3 -0
  71. package/src/Slider/types.ts +12 -3
  72. package/src/Status/Status.tsx +1 -0
  73. package/src/Status/types.ts +4 -0
  74. package/src/Switch/Switch.tsx +8 -3
  75. package/src/Switch/SwitchContext.ts +4 -0
  76. package/src/Switch/types.ts +24 -3
  77. package/src/Table/Table.tsx +44 -24
  78. package/src/Table/index.ts +2 -1
  79. package/src/Tabs/Tabs.tsx +7 -2
  80. package/src/Tabs/TabsContext.ts +7 -2
  81. package/src/Tabs/types.ts +35 -1
  82. package/src/Textarea/Textarea.tsx +1 -0
  83. package/src/Textarea/types.ts +4 -0
  84. package/src/Toggle/Toggle.tsx +1 -0
  85. package/src/Toggle/types.ts +7 -3
  86. package/src/ToggleGroup/ToggleGroup.tsx +9 -3
  87. package/src/ToggleGroup/types.ts +45 -5
  88. package/src/Tooltip/Tooltip.tsx +25 -7
  89. package/src/Tooltip/index.ts +1 -0
  90. package/src/Tooltip/types.ts +50 -2
  91. package/src/Tree/Tree.tsx +46 -1
  92. package/src/Tree/index.ts +1 -1
  93. package/src/Tree/types.ts +39 -7
  94. package/src/VisuallyHidden/VisuallyHidden.tsx +1 -0
  95. package/src/VisuallyHidden/types.ts +4 -0
  96. package/src/index.ts +1 -0
  97. package/src/types.ts +1 -0
@@ -3,7 +3,11 @@ import { ComponentProps, ReactNode, Ref } from "react";
3
3
  import { CheckedState } from "../Checkbox/types";
4
4
  import { Direction } from "../DirectionProvider/index.ts";
5
5
 
6
- type ContextMenuRootBaseProps = {
6
+ /**
7
+ * Shared base for both {@link ContextMenuRootProps} variants — `children`
8
+ * plus the reading-direction control.
9
+ */
10
+ export type ContextMenuRootBaseProps = {
7
11
  children?: ReactNode;
8
12
  /**
9
13
  * Reading direction for the menu. Affects which arrow key opens / closes
@@ -14,22 +18,43 @@ type ContextMenuRootBaseProps = {
14
18
  dir?: Direction;
15
19
  };
16
20
 
17
- type ContextMenuRootUncontrolledProps = ContextMenuRootBaseProps & {
21
+ /**
22
+ * Uncontrolled variant of {@link ContextMenuRootProps}: the component owns
23
+ * the open state. Pass `defaultOpen` (or omit it); `onOpenChange` is
24
+ * optional and `open` is forbidden.
25
+ */
26
+ export type ContextMenuRootUncontrolledProps = ContextMenuRootBaseProps & {
18
27
  defaultOpen?: boolean;
19
28
  open?: never;
20
29
  onOpenChange?: (open: boolean) => void;
21
30
  };
22
31
 
23
- type ContextMenuRootControlledProps = ContextMenuRootBaseProps & {
32
+ /**
33
+ * Controlled variant of {@link ContextMenuRootProps}: the parent owns the
34
+ * open state. Pass `open` and `onOpenChange` together; `defaultOpen` is
35
+ * forbidden.
36
+ */
37
+ export type ContextMenuRootControlledProps = ContextMenuRootBaseProps & {
24
38
  defaultOpen?: never;
25
39
  open: boolean;
26
40
  onOpenChange: (open: boolean) => void;
27
41
  };
28
42
 
43
+ /**
44
+ * Props for {@link ContextMenu.Root} — the open-state owner and
45
+ * direction provider. A discriminated union of the uncontrolled
46
+ * ({@link ContextMenuRootUncontrolledProps}) and controlled
47
+ * ({@link ContextMenuRootControlledProps}) variants.
48
+ */
29
49
  export type ContextMenuRootProps =
30
50
  | ContextMenuRootUncontrolledProps
31
51
  | ContextMenuRootControlledProps;
32
52
 
53
+ /**
54
+ * Props for {@link ContextMenu.Trigger} — the `<span>` whose right-click
55
+ * (context menu) gesture opens the menu. Supports `asChild` to merge
56
+ * onto a custom element and `disabled` to suppress the gesture.
57
+ */
33
58
  export type ContextMenuTriggerProps = ComponentProps<"span"> & {
34
59
  children?: ReactNode;
35
60
  ref?: Ref<HTMLSpanElement>;
@@ -37,6 +62,11 @@ export type ContextMenuTriggerProps = ComponentProps<"span"> & {
37
62
  disabled?: boolean;
38
63
  };
39
64
 
65
+ /**
66
+ * Props for {@link ContextMenu.Content} — the `<menu>` popover holding the
67
+ * menu items. The managed `role`, `popover`, and `id` attributes are
68
+ * omitted; `asChild` merges the props onto a custom element.
69
+ */
40
70
  export type ContextMenuContentProps = Omit<
41
71
  ComponentProps<"menu">,
42
72
  "role" | "popover" | "id"
@@ -46,6 +76,11 @@ export type ContextMenuContentProps = Omit<
46
76
  asChild?: boolean;
47
77
  };
48
78
 
79
+ /**
80
+ * Props for {@link ContextMenu.Item} — a selectable `<li>` menu item. The
81
+ * managed `role`, `tabIndex`, and `onSelect` are omitted from the host
82
+ * props; `disabled` skips activation and `onSelect` fires on activation.
83
+ */
49
84
  export type ContextMenuItemProps = Omit<
50
85
  ComponentProps<"li">,
51
86
  "role" | "tabIndex" | "onSelect"
@@ -62,25 +97,46 @@ export type ContextMenuItemProps = Omit<
62
97
  onSelect?: (event: Event) => void;
63
98
  };
64
99
 
100
+ /**
101
+ * Props for {@link ContextMenu.Separator} — a non-interactive `<li>`
102
+ * divider between groups of items. The managed `role` is omitted;
103
+ * `asChild` merges the props onto a custom element.
104
+ */
65
105
  export type ContextMenuSeparatorProps = Omit<ComponentProps<"li">, "role"> & {
66
106
  children?: ReactNode;
67
107
  ref?: Ref<HTMLLIElement>;
68
108
  asChild?: boolean;
69
109
  };
70
110
 
111
+ /**
112
+ * Props for {@link ContextMenu.Group} — an `<li>` that groups related
113
+ * items, optionally labelled by a {@link ContextMenu.Label}. The managed
114
+ * `role` is omitted; `asChild` merges the props onto a custom element.
115
+ */
71
116
  export type ContextMenuGroupProps = Omit<ComponentProps<"li">, "role"> & {
72
117
  children?: ReactNode;
73
118
  ref?: Ref<HTMLLIElement>;
74
119
  asChild?: boolean;
75
120
  };
76
121
 
122
+ /**
123
+ * Props for {@link ContextMenu.Label} — a non-interactive `<li>` caption
124
+ * for a {@link ContextMenu.Group}. Supports `asChild` to merge the props
125
+ * onto a custom element.
126
+ */
77
127
  export type ContextMenuLabelProps = ComponentProps<"li"> & {
78
128
  children?: ReactNode;
79
129
  ref?: Ref<HTMLLIElement>;
80
130
  asChild?: boolean;
81
131
  };
82
132
 
83
- type ContextMenuCheckboxItemBaseProps = Omit<
133
+ /**
134
+ * Shared base for both {@link ContextMenuCheckboxItemProps} variants —
135
+ * the `<li>` host props plus `children`, `ref`, `asChild`, `disabled`,
136
+ * and `onSelect`. The managed `role`, `tabIndex`, `aria-checked`,
137
+ * `defaultChecked`, and `onSelect` host attributes are omitted.
138
+ */
139
+ export type ContextMenuCheckboxItemBaseProps = Omit<
84
140
  ComponentProps<"li">,
85
141
  "role" | "tabIndex" | "aria-checked" | "defaultChecked" | "onSelect"
86
142
  > & {
@@ -95,24 +151,47 @@ type ContextMenuCheckboxItemBaseProps = Omit<
95
151
  onSelect?: (event: Event) => void;
96
152
  };
97
153
 
98
- type ContextMenuCheckboxItemUncontrolledProps =
154
+ /**
155
+ * Uncontrolled variant of {@link ContextMenuCheckboxItemProps}: the
156
+ * component owns the checked state. Pass `defaultChecked` (or omit it);
157
+ * `onCheckedChange` is optional and the controlled `checked` prop is
158
+ * forbidden.
159
+ */
160
+ export type ContextMenuCheckboxItemUncontrolledProps =
99
161
  ContextMenuCheckboxItemBaseProps & {
100
162
  defaultChecked?: CheckedState;
101
163
  checked?: never;
102
164
  onCheckedChange?: (checked: boolean) => void;
103
165
  };
104
166
 
105
- type ContextMenuCheckboxItemControlledProps =
167
+ /**
168
+ * Controlled variant of {@link ContextMenuCheckboxItemProps}: the parent
169
+ * owns the checked state. Pass `checked` and `onCheckedChange` together;
170
+ * `defaultChecked` is forbidden.
171
+ */
172
+ export type ContextMenuCheckboxItemControlledProps =
106
173
  ContextMenuCheckboxItemBaseProps & {
107
174
  defaultChecked?: never;
108
175
  checked: CheckedState;
109
176
  onCheckedChange: (checked: boolean) => void;
110
177
  };
111
178
 
179
+ /**
180
+ * Props for {@link ContextMenu.CheckboxItem} — a toggleable menu item. A
181
+ * discriminated union of the uncontrolled
182
+ * ({@link ContextMenuCheckboxItemUncontrolledProps}) and controlled
183
+ * ({@link ContextMenuCheckboxItemControlledProps}) variants.
184
+ */
112
185
  export type ContextMenuCheckboxItemProps =
113
186
  | ContextMenuCheckboxItemUncontrolledProps
114
187
  | ContextMenuCheckboxItemControlledProps;
115
188
 
189
+ /**
190
+ * Props for {@link ContextMenu.ItemIndicator} — the `<span>` that renders
191
+ * inside a checkbox or radio item to show its checked state. Set
192
+ * `forceMount` to render even when unchecked; `asChild` merges the props
193
+ * onto a custom element.
194
+ */
116
195
  export type ContextMenuItemIndicatorProps = ComponentProps<"span"> & {
117
196
  children?: ReactNode;
118
197
  ref?: Ref<HTMLSpanElement>;
@@ -124,29 +203,61 @@ export type ContextMenuItemIndicatorProps = ComponentProps<"span"> & {
124
203
  forceMount?: boolean;
125
204
  };
126
205
 
127
- type ContextMenuRadioGroupBaseProps = Omit<ComponentProps<"li">, "role"> & {
206
+ /**
207
+ * Shared base for both {@link ContextMenuRadioGroupProps} variants — the
208
+ * `<li>` host props plus `children`, `ref`, and `asChild`. The managed
209
+ * `role` host attribute is omitted.
210
+ */
211
+ export type ContextMenuRadioGroupBaseProps = Omit<
212
+ ComponentProps<"li">,
213
+ "role"
214
+ > & {
128
215
  children?: ReactNode;
129
216
  ref?: Ref<HTMLLIElement>;
130
217
  asChild?: boolean;
131
218
  };
132
219
 
133
- type ContextMenuRadioGroupUncontrolledProps =
220
+ /**
221
+ * Uncontrolled variant of {@link ContextMenuRadioGroupProps}: the
222
+ * component owns the selected-value state. Pass `defaultValue` (or omit
223
+ * it); `onValueChange` is optional and the controlled `value` prop is
224
+ * forbidden.
225
+ */
226
+ export type ContextMenuRadioGroupUncontrolledProps =
134
227
  ContextMenuRadioGroupBaseProps & {
135
228
  defaultValue?: string;
136
229
  value?: never;
137
230
  onValueChange?: (value: string) => void;
138
231
  };
139
232
 
140
- type ContextMenuRadioGroupControlledProps = ContextMenuRadioGroupBaseProps & {
141
- defaultValue?: never;
142
- value: string;
143
- onValueChange: (value: string) => void;
144
- };
233
+ /**
234
+ * Controlled variant of {@link ContextMenuRadioGroupProps}: the parent
235
+ * owns the selected-value state. Pass `value` and `onValueChange`
236
+ * together; `defaultValue` is forbidden.
237
+ */
238
+ export type ContextMenuRadioGroupControlledProps =
239
+ ContextMenuRadioGroupBaseProps & {
240
+ defaultValue?: never;
241
+ value: string;
242
+ onValueChange: (value: string) => void;
243
+ };
145
244
 
245
+ /**
246
+ * Props for {@link ContextMenu.RadioGroup} — the container that tracks
247
+ * which {@link ContextMenu.RadioItem} is selected. A discriminated union
248
+ * of the uncontrolled ({@link ContextMenuRadioGroupUncontrolledProps})
249
+ * and controlled ({@link ContextMenuRadioGroupControlledProps}) variants.
250
+ */
146
251
  export type ContextMenuRadioGroupProps =
147
252
  | ContextMenuRadioGroupUncontrolledProps
148
253
  | ContextMenuRadioGroupControlledProps;
149
254
 
255
+ /**
256
+ * Props for {@link ContextMenu.RadioItem} — a mutually-exclusive choice
257
+ * within a {@link ContextMenu.RadioGroup}, identified by its required
258
+ * `value`. The managed `role`, `tabIndex`, `aria-checked`, and `onSelect`
259
+ * host attributes are omitted.
260
+ */
150
261
  export type ContextMenuRadioItemProps = Omit<
151
262
  ComponentProps<"li">,
152
263
  "role" | "tabIndex" | "aria-checked" | "onSelect"
@@ -159,26 +270,52 @@ export type ContextMenuRadioItemProps = Omit<
159
270
  onSelect?: (event: Event) => void;
160
271
  };
161
272
 
162
- type ContextMenuSubBaseProps = {
273
+ /**
274
+ * Shared base for both {@link ContextMenuSubProps} variants — just the
275
+ * `children` of the submenu.
276
+ */
277
+ export type ContextMenuSubBaseProps = {
163
278
  children?: ReactNode;
164
279
  };
165
280
 
166
- type ContextMenuSubUncontrolledProps = ContextMenuSubBaseProps & {
281
+ /**
282
+ * Uncontrolled variant of {@link ContextMenuSubProps}: the component owns
283
+ * the submenu open state. Pass `defaultOpen` (or omit it); `onOpenChange`
284
+ * is optional and the controlled `open` prop is forbidden.
285
+ */
286
+ export type ContextMenuSubUncontrolledProps = ContextMenuSubBaseProps & {
167
287
  defaultOpen?: boolean;
168
288
  open?: never;
169
289
  onOpenChange?: (open: boolean) => void;
170
290
  };
171
291
 
172
- type ContextMenuSubControlledProps = ContextMenuSubBaseProps & {
292
+ /**
293
+ * Controlled variant of {@link ContextMenuSubProps}: the parent owns the
294
+ * submenu open state. Pass `open` and `onOpenChange` together;
295
+ * `defaultOpen` is forbidden.
296
+ */
297
+ export type ContextMenuSubControlledProps = ContextMenuSubBaseProps & {
173
298
  defaultOpen?: never;
174
299
  open: boolean;
175
300
  onOpenChange: (open: boolean) => void;
176
301
  };
177
302
 
303
+ /**
304
+ * Props for {@link ContextMenu.Sub} — a nested submenu's open-state
305
+ * owner. A discriminated union of the uncontrolled
306
+ * ({@link ContextMenuSubUncontrolledProps}) and controlled
307
+ * ({@link ContextMenuSubControlledProps}) variants.
308
+ */
178
309
  export type ContextMenuSubProps =
179
310
  | ContextMenuSubUncontrolledProps
180
311
  | ContextMenuSubControlledProps;
181
312
 
313
+ /**
314
+ * Props for {@link ContextMenu.SubTrigger} — the `<li>` that opens its
315
+ * parent {@link ContextMenu.Sub} on hover or arrow key. The managed
316
+ * `role`, `tabIndex`, `aria-haspopup`, `aria-expanded`, and
317
+ * `aria-controls` host attributes are omitted; `disabled` suppresses it.
318
+ */
182
319
  export type ContextMenuSubTriggerProps = Omit<
183
320
  ComponentProps<"li">,
184
321
  "role" | "tabIndex" | "aria-haspopup" | "aria-expanded" | "aria-controls"
@@ -189,6 +326,12 @@ export type ContextMenuSubTriggerProps = Omit<
189
326
  disabled?: boolean;
190
327
  };
191
328
 
329
+ /**
330
+ * Props for {@link ContextMenu.SubContent} — the `<menu>` popover for a
331
+ * nested submenu's items. The managed `role`, `popover`, and `id`
332
+ * attributes are omitted; `asChild` merges the props onto a custom
333
+ * element.
334
+ */
192
335
  export type ContextMenuSubContentProps = Omit<
193
336
  ComponentProps<"menu">,
194
337
  "role" | "popover" | "id"
@@ -33,4 +33,5 @@ export function DirectionProvider({
33
33
  );
34
34
  }
35
35
 
36
+ /** @internal */
36
37
  DirectionProvider.displayName = "DirectionProvider";
@@ -3,6 +3,7 @@ import { ReactNode } from "react";
3
3
  /** A reading direction — left-to-right or right-to-left. */
4
4
  export type Direction = "ltr" | "rtl";
5
5
 
6
+ /** Props for {@link DirectionProvider} — the `dir` broadcast to descendants. */
6
7
  export type DirectionProviderProps = {
7
8
  /** The reading direction broadcast to every descendant. */
8
9
  dir: Direction;
@@ -56,4 +56,5 @@ export function Divider({
56
56
  );
57
57
  }
58
58
 
59
+ /** @internal */
59
60
  Divider.displayName = "Divider";
@@ -1 +1,2 @@
1
- export * from './Divider';
1
+ export * from "./Divider";
2
+ export * from "./types";
@@ -1,5 +1,10 @@
1
1
  import { ComponentProps } from "react";
2
2
 
3
+ /**
4
+ * Props for the {@link Divider} component. Extends the native `<span>` props
5
+ * with an optional `orientation`.
6
+ */
3
7
  export type DividerProps = ComponentProps<"span"> & {
8
+ /** Axis the separator runs along. Defaults to `"horizontal"`. */
4
9
  orientation?: "horizontal" | "vertical";
5
10
  };
@@ -85,7 +85,7 @@ import { MENUITEM_SELECTOR } from "./constants";
85
85
  * </Dropdown.Root>
86
86
  * ```
87
87
  */
88
- function DropdownRoot({
88
+ export function DropdownRoot({
89
89
  defaultOpen,
90
90
  open,
91
91
  onOpenChange,
@@ -107,6 +107,7 @@ function DropdownRoot({
107
107
  );
108
108
  }
109
109
 
110
+ /** @internal */
110
111
  DropdownRoot.displayName = "DropdownRoot";
111
112
 
112
113
  /**
@@ -127,7 +128,7 @@ DropdownRoot.displayName = "DropdownRoot";
127
128
  * </Dropdown.Trigger>
128
129
  * ```
129
130
  */
130
- function DropdownTrigger({
131
+ export function DropdownTrigger({
131
132
  children,
132
133
  onClick,
133
134
  asChild = false,
@@ -146,6 +147,7 @@ function DropdownTrigger({
146
147
  );
147
148
  }
148
149
 
150
+ /** @internal */
149
151
  DropdownTrigger.displayName = "DropdownTrigger";
150
152
 
151
153
  /**
@@ -179,7 +181,7 @@ DropdownTrigger.displayName = "DropdownTrigger";
179
181
  * lands on the next sibling item in the parent rather than getting
180
182
  * stuck on a non-focusable item inside a closed sub-popover.
181
183
  */
182
- function DropdownContent({
184
+ export function DropdownContent({
183
185
  children,
184
186
  onKeyDown,
185
187
  asChild = false,
@@ -201,6 +203,7 @@ function DropdownContent({
201
203
  );
202
204
  }
203
205
 
206
+ /** @internal */
204
207
  DropdownContent.displayName = "DropdownContent";
205
208
 
206
209
  /**
@@ -216,7 +219,7 @@ DropdownContent.displayName = "DropdownContent";
216
219
  * Disabled items receive `aria-disabled="true"` and are skipped by arrow
217
220
  * navigation, typeahead, and activation handlers.
218
221
  */
219
- function DropdownItem({
222
+ export function DropdownItem({
220
223
  children,
221
224
  onClick,
222
225
  onSelect,
@@ -238,6 +241,7 @@ function DropdownItem({
238
241
  return <li {...itemProps}>{children}</li>;
239
242
  }
240
243
 
244
+ /** @internal */
241
245
  DropdownItem.displayName = "DropdownItem";
242
246
 
243
247
  /**
@@ -245,7 +249,7 @@ DropdownItem.displayName = "DropdownItem";
245
249
  * by default; pass `asChild` to render any element with separator semantics.
246
250
  * Non-interactive — skipped by focus, arrow navigation, and typeahead.
247
251
  */
248
- function DropdownSeparator({
252
+ export function DropdownSeparator({
249
253
  asChild = false,
250
254
  children,
251
255
  ...rest
@@ -259,6 +263,7 @@ function DropdownSeparator({
259
263
  return <li {...separatorProps} />;
260
264
  }
261
265
 
266
+ /** @internal */
262
267
  DropdownSeparator.displayName = "DropdownSeparator";
263
268
 
264
269
  /**
@@ -271,7 +276,7 @@ DropdownSeparator.displayName = "DropdownSeparator";
271
276
  * first child to provide the accessible name; screen readers will announce
272
277
  * the group when arrowing into it.
273
278
  */
274
- function DropdownGroup({
279
+ export function DropdownGroup({
275
280
  children,
276
281
  asChild = false,
277
282
  ...rest
@@ -291,6 +296,7 @@ function DropdownGroup({
291
296
  );
292
297
  }
293
298
 
299
+ /** @internal */
294
300
  DropdownGroup.displayName = "DropdownGroup";
295
301
 
296
302
  /**
@@ -302,7 +308,7 @@ DropdownGroup.displayName = "DropdownGroup";
302
308
  * Renders a `<li>` by default; pass `asChild` to render any element. A
303
309
  * caller-supplied `id` takes precedence over the auto-generated one.
304
310
  */
305
- function DropdownLabel({
311
+ export function DropdownLabel({
306
312
  id,
307
313
  children,
308
314
  asChild = false,
@@ -316,6 +322,7 @@ function DropdownLabel({
316
322
  return <li {...labelProps}>{children}</li>;
317
323
  }
318
324
 
325
+ /** @internal */
319
326
  DropdownLabel.displayName = "DropdownLabel";
320
327
 
321
328
  /**
@@ -344,7 +351,7 @@ DropdownLabel.displayName = "DropdownLabel";
344
351
  *
345
352
  * Disabled items receive `aria-disabled="true"` and no-op on activation.
346
353
  */
347
- function DropdownCheckboxItem({
354
+ export function DropdownCheckboxItem({
348
355
  children,
349
356
  onClick,
350
357
  onSelect,
@@ -404,6 +411,7 @@ function DropdownCheckboxItem({
404
411
  );
405
412
  }
406
413
 
414
+ /** @internal */
407
415
  DropdownCheckboxItem.displayName = "DropdownCheckboxItem";
408
416
 
409
417
  /**
@@ -418,7 +426,7 @@ DropdownCheckboxItem.displayName = "DropdownCheckboxItem";
418
426
  * Optional `onValueChange` observes selections.
419
427
  * - **Controlled** — pass `value` *and* `onValueChange` together.
420
428
  */
421
- function DropdownRadioGroup({
429
+ export function DropdownRadioGroup({
422
430
  defaultValue,
423
431
  value: controlledValue,
424
432
  onValueChange,
@@ -446,6 +454,7 @@ function DropdownRadioGroup({
446
454
  );
447
455
  }
448
456
 
457
+ /** @internal */
449
458
  DropdownRadioGroup.displayName = "DropdownRadioGroup";
450
459
 
451
460
  /**
@@ -468,7 +477,7 @@ DropdownRadioGroup.displayName = "DropdownRadioGroup";
468
477
  *
469
478
  * Disabled items receive `aria-disabled="true"` and no-op on activation.
470
479
  */
471
- function DropdownRadioItem({
480
+ export function DropdownRadioItem({
472
481
  children,
473
482
  onClick,
474
483
  onSelect,
@@ -526,6 +535,7 @@ function DropdownRadioItem({
526
535
  );
527
536
  }
528
537
 
538
+ /** @internal */
529
539
  DropdownRadioItem.displayName = "DropdownRadioItem";
530
540
 
531
541
  /**
@@ -555,7 +565,7 @@ DropdownRadioItem.displayName = "DropdownRadioItem";
555
565
  * </Dropdown.CheckboxItem>
556
566
  * ```
557
567
  */
558
- function DropdownItemIndicator({
568
+ export function DropdownItemIndicator({
559
569
  children,
560
570
  asChild = false,
561
571
  forceMount = false,
@@ -582,6 +592,7 @@ function DropdownItemIndicator({
582
592
  return <span {...indicatorProps}>{children}</span>;
583
593
  }
584
594
 
595
+ /** @internal */
585
596
  DropdownItemIndicator.displayName = "DropdownItemIndicator";
586
597
 
587
598
  /**
@@ -609,7 +620,7 @@ DropdownItemIndicator.displayName = "DropdownItemIndicator";
609
620
  * </Dropdown.Root>
610
621
  * ```
611
622
  */
612
- function DropdownSub({
623
+ export function DropdownSub({
613
624
  defaultOpen,
614
625
  open: controlledOpen,
615
626
  onOpenChange,
@@ -651,6 +662,7 @@ function DropdownSub({
651
662
  );
652
663
  }
653
664
 
665
+ /** @internal */
654
666
  DropdownSub.displayName = "DropdownSub";
655
667
 
656
668
  /**
@@ -672,7 +684,7 @@ DropdownSub.displayName = "DropdownSub";
672
684
  * Disabled triggers receive `aria-disabled="true"` and ignore both click
673
685
  * and the open arrow key.
674
686
  */
675
- function DropdownSubTrigger({
687
+ export function DropdownSubTrigger({
676
688
  children,
677
689
  onClick,
678
690
  onKeyDown,
@@ -721,6 +733,7 @@ function DropdownSubTrigger({
721
733
  return <li {...subTriggerProps}>{children}</li>;
722
734
  }
723
735
 
736
+ /** @internal */
724
737
  DropdownSubTrigger.displayName = "DropdownSubTrigger";
725
738
 
726
739
  /**
@@ -737,7 +750,7 @@ DropdownSubTrigger.displayName = "DropdownSubTrigger";
737
750
  * to the parent {@link DropdownContent | `Dropdown.Content`} so arrow
738
751
  * navigation and typeahead apply to the submenu's items.
739
752
  */
740
- function DropdownSubContent({
753
+ export function DropdownSubContent({
741
754
  children,
742
755
  onKeyDown,
743
756
  asChild = false,
@@ -802,9 +815,11 @@ function DropdownSubContent({
802
815
  );
803
816
  }
804
817
 
818
+ /** @internal */
805
819
  DropdownSubContent.displayName = "DropdownSubContent";
806
820
 
807
- 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 & {
808
823
  Root: typeof DropdownRoot;
809
824
  Trigger: typeof DropdownTrigger;
810
825
  Content: typeof DropdownContent;
@@ -821,6 +836,15 @@ type TDropdownCompound = typeof DropdownRoot & {
821
836
  SubContent: typeof DropdownSubContent;
822
837
  };
823
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
+ */
824
848
  const DropdownCompound: TDropdownCompound = Object.assign(DropdownRoot, {
825
849
  Root: DropdownRoot,
826
850
  Trigger: DropdownTrigger,
@@ -838,6 +862,7 @@ const DropdownCompound: TDropdownCompound = Object.assign(DropdownRoot, {
838
862
  SubContent: DropdownSubContent,
839
863
  });
840
864
 
865
+ /** @internal */
841
866
  DropdownCompound.displayName = "Dropdown";
842
867
 
843
868
  export { DropdownCompound as Dropdown };
@@ -1 +1,2 @@
1
- export { Dropdown } from "./Dropdown";
1
+ export * from "./Dropdown";
2
+ export * from "./types";