@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Simon Revill
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@primitiv-ui/react",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
+ "description": "Headless, accessible React components built on the WAI-ARIA authoring patterns. Zero styles ship with this package — bring your own (CSS, Tailwind, CSS-in-JS, design tokens).",
4
5
  "type": "module",
5
6
  "main": "./src/index.ts",
6
7
  "types": "./src/index.ts",
@@ -40,4 +40,5 @@ export function AccessibleIcon({
40
40
  );
41
41
  }
42
42
 
43
+ /** @internal */
43
44
  AccessibleIcon.displayName = "AccessibleIcon";
@@ -1,5 +1,9 @@
1
1
  import { ReactElement } from "react";
2
2
 
3
+ /**
4
+ * Props for {@link AccessibleIcon} — a single icon element plus the
5
+ * visually-hidden `label` announced as its accessible name.
6
+ */
3
7
  export type AccessibleIconProps = {
4
8
  /** Text announced by assistive technology as the icon's accessible name. */
5
9
  label: string;
@@ -99,6 +99,7 @@ export function AccordionRoot({
99
99
  );
100
100
  }
101
101
 
102
+ /** @internal */
102
103
  AccordionRoot.displayName = "AccordionRoot";
103
104
 
104
105
  /**
@@ -135,6 +136,7 @@ export function AccordionItem({
135
136
  );
136
137
  }
137
138
 
139
+ /** @internal */
138
140
  AccordionItem.displayName = "AccordionItem";
139
141
 
140
142
  /**
@@ -164,6 +166,7 @@ export function AccordionHeader({
164
166
  return <HeadingTag {...rest}>{children}</HeadingTag>;
165
167
  }
166
168
 
169
+ /** @internal */
167
170
  AccordionHeader.displayName = "AccordionHeader";
168
171
 
169
172
  /**
@@ -260,6 +263,7 @@ export function AccordionTrigger<T extends HTMLElement = HTMLButtonElement>({
260
263
  );
261
264
  }
262
265
 
266
+ /** @internal */
263
267
  AccordionTrigger.displayName = "AccordionTrigger";
264
268
 
265
269
  /**
@@ -329,6 +333,7 @@ export function AccordionContent({
329
333
  );
330
334
  }
331
335
 
336
+ /** @internal */
332
337
  AccordionContent.displayName = "AccordionContent";
333
338
 
334
339
  /**
@@ -386,8 +391,10 @@ export function AccordionTriggerIcon({
386
391
  );
387
392
  }
388
393
 
394
+ /** @internal */
389
395
  AccordionTriggerIcon.displayName = "AccordionTriggerIcon";
390
396
 
397
+ /** @internal */
391
398
  type AccordionCompound = typeof AccordionRoot & {
392
399
  Root: typeof AccordionRoot;
393
400
  Item: typeof AccordionItem;
@@ -397,6 +404,22 @@ type AccordionCompound = typeof AccordionRoot & {
397
404
  TriggerIcon: typeof AccordionTriggerIcon;
398
405
  };
399
406
 
407
+ /**
408
+ * Headless, accessible **Accordion** — a compound component for a vertically
409
+ * (or horizontally) stacked set of collapsible sections, following the
410
+ * [WAI-ARIA Accordion pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/)
411
+ * with zero styles.
412
+ *
413
+ * `Accordion` is both callable (an alias of {@link AccordionRoot | `Accordion.Root`})
414
+ * and carries its sub-components as static properties:
415
+ *
416
+ * - {@link AccordionRoot | `Accordion.Root`} — state owner and context provider.
417
+ * - {@link AccordionItem | `Accordion.Item`} — one collapsible section.
418
+ * - {@link AccordionHeader | `Accordion.Header`} — heading wrapper for the trigger.
419
+ * - {@link AccordionTrigger | `Accordion.Trigger`} — button that toggles the section.
420
+ * - {@link AccordionContent | `Accordion.Content`} — the collapsible panel.
421
+ * - {@link AccordionTriggerIcon | `Accordion.TriggerIcon`} — decorative state indicator.
422
+ */
400
423
  const AccordionCompound: AccordionCompound = Object.assign(AccordionRoot, {
401
424
  Root: AccordionRoot,
402
425
  Item: AccordionItem,
@@ -1 +1,2 @@
1
- export * from './Accordion';
1
+ export * from "./Accordion";
2
+ export * from "./types";
@@ -1,81 +1,123 @@
1
1
  import { ComponentProps, ReactNode, Ref } from "react";
2
2
  import { HeadingLevel } from "../types";
3
3
 
4
- type AccordionRootBaseProps = ComponentProps<"div"> & {
4
+ /** Props shared by both control modes of `Accordion.Root`. */
5
+ export type AccordionRootBaseProps = ComponentProps<"div"> & {
6
+ /** Allow more than one section to be expanded at a time. */
5
7
  multiple?: boolean;
8
+ /** Layout axis, controlling arrow-key navigation. Defaults to `"vertical"`. */
6
9
  orientation?: "vertical" | "horizontal";
10
+ /** Reading direction, controlling left/right key semantics. */
7
11
  dir?: AccordionReadingDirection;
8
12
  };
9
13
 
10
- type AccordionRootUncontrolledProps = AccordionRootBaseProps & {
14
+ /** `Accordion.Root` props for the uncontrolled (self-managed) expanded state. */
15
+ export type AccordionRootUncontrolledProps = AccordionRootBaseProps & {
16
+ /** Initially expanded item value when uncontrolled. */
11
17
  defaultValue?: string;
12
18
  value?: never;
13
19
  onValueChange?: never;
14
20
  };
15
21
 
16
- type AccordionRootControlledProps = AccordionRootBaseProps & {
22
+ /** `Accordion.Root` props for the controlled expanded state. */
23
+ export type AccordionRootControlledProps = AccordionRootBaseProps & {
17
24
  defaultValue?: never;
25
+ /** Controlled set of expanded item values. */
18
26
  value: string[];
27
+ /** Called whenever the set of expanded item values changes. */
19
28
  onValueChange: (values: string[]) => void;
20
29
  };
21
30
 
31
+ /** Reading direction for an accordion. */
22
32
  export type AccordionReadingDirection = "ltr" | "rtl";
23
33
 
34
+ /** Props for `Accordion.Root`, in either the controlled or uncontrolled mode. */
24
35
  export type AccordionRootProps =
25
36
  | AccordionRootUncontrolledProps
26
37
  | AccordionRootControlledProps;
27
38
 
39
+ /** Props for `Accordion.Item` — a single collapsible section. */
28
40
  export type AccordionItemProps = ComponentProps<"div"> & {
41
+ /** Section contents — typically a `Header` + `Content` pair. */
29
42
  children: ReactNode;
43
+ /** Stable value identifying the item; auto-generated via `useId()` when omitted. */
30
44
  value?: string; // Optional - if not provided, useId() will generate one
31
45
  };
32
46
 
33
- export type AccordionTriggerProps<
34
- T extends HTMLElement = HTMLButtonElement,
35
- > = Omit<ComponentProps<"button">, "disabled" | "ref"> & {
36
- children: ReactNode;
37
- disabled?: boolean;
38
- asChild?: boolean;
39
- /** Ref to the rendered element. Defaults to `HTMLButtonElement`; when using
40
- * `asChild`, specify the child's element type (e.g. `HTMLAnchorElement`). */
41
- ref?: Ref<T>;
42
- };
47
+ /** Props for `Accordion.Trigger` — the button that toggles a section. */
48
+ export type AccordionTriggerProps<T extends HTMLElement = HTMLButtonElement> =
49
+ Omit<ComponentProps<"button">, "disabled" | "ref"> & {
50
+ /** Trigger label / contents. */
51
+ children: ReactNode;
52
+ /** Disable the trigger, removing it from keyboard navigation. */
53
+ disabled?: boolean;
54
+ /** Render into the consumer's own element instead of a `<button>`. */
55
+ asChild?: boolean;
56
+ /** Ref to the rendered element. Defaults to `HTMLButtonElement`; when using
57
+ * `asChild`, specify the child's element type (e.g. `HTMLAnchorElement`). */
58
+ ref?: Ref<T>;
59
+ };
43
60
 
61
+ /** Props for `Accordion.Header` — the heading wrapping a trigger. */
44
62
  export type AccordionHeaderProps = ComponentProps<"h3"> & {
63
+ /** Header contents — typically an `Accordion.Trigger`. */
45
64
  children: ReactNode;
65
+ /** Heading level rendered (`h1`–`h6`). Defaults to `3`. */
46
66
  level?: HeadingLevel;
47
67
  };
48
68
 
69
+ /** Props for `Accordion.Content` — the collapsible panel. */
49
70
  export type AccordionContentProps = ComponentProps<"div"> & {
71
+ /** Panel contents. */
50
72
  children: ReactNode;
73
+ /** Keep the panel mounted even while collapsed. */
51
74
  forceMount?: boolean;
52
75
  };
53
76
 
77
+ /** Props for `Accordion.TriggerIcon` — a decorative open/closed indicator. */
54
78
  export type AccordionTriggerIconProps = ComponentProps<"span"> & {
79
+ /** Icon contents. */
55
80
  children: ReactNode;
56
81
  };
57
82
 
83
+ /** Context value published by `Accordion.Root` to coordinate its sections. */
58
84
  export type AccordionContextValue = {
85
+ /** Generated id namespacing the accordion's element ids. */
59
86
  accordionId: string;
87
+ /** Set of currently expanded item values. */
60
88
  expandedItems: Set<string>;
89
+ /** Layout axis used for arrow-key navigation. */
61
90
  orientation: "vertical" | "horizontal";
91
+ /** Reading direction used for left/right key semantics. */
62
92
  dir: AccordionReadingDirection;
93
+ /** Toggles the expanded state of the given item. */
63
94
  toggleItem: (itemId: string) => void;
95
+ /** Registers a trigger element so roving focus can reach it. */
64
96
  registerTrigger: (
65
97
  itemId: string,
66
98
  element: HTMLButtonElement | null,
67
99
  disabled?: boolean,
68
100
  ) => void;
101
+ /** Ordered ids of registered triggers, used for focus movement. */
69
102
  registeredTriggerItemIds: string[];
103
+ /** Set of item ids whose triggers are disabled. */
70
104
  disabledItemIds: Set<string>;
105
+ /** Moves focus to the given item's trigger. */
71
106
  focusTrigger: (itemId: string) => void;
107
+ /** Registers a content panel as mounted. */
72
108
  registerPanel: (itemId: string) => void;
109
+ /** Removes a previously registered content panel. */
73
110
  unregisterPanel: (itemId: string) => void;
74
111
  };
75
112
 
113
+ /** Context value published by `Accordion.Item` to its header and content. */
76
114
  export type AccordionItemContextValue = {
115
+ /** Id of the trigger button. */
77
116
  buttonId: string;
117
+ /** Id of the content panel. */
78
118
  panelId: string;
119
+ /** Stable value identifying this item. */
79
120
  itemId: string;
121
+ /** Whether this item is currently expanded. */
80
122
  isExpanded: boolean;
81
123
  };
@@ -46,4 +46,5 @@ export function Alert({
46
46
  return <div {...rootProps}>{children}</div>;
47
47
  }
48
48
 
49
+ /** @internal */
49
50
  Alert.displayName = "Alert";
@@ -1,5 +1,6 @@
1
1
  import { ComponentProps } from "react";
2
2
 
3
+ /** Props for the `Alert` — a live-region `<div role="alert">`; native `<div>` props plus `asChild`. */
3
4
  export type AlertProps = ComponentProps<"div"> & {
4
5
  asChild?: boolean;
5
6
  };
@@ -23,7 +23,7 @@ import {
23
23
  * **`asChild` prop.** Pass `asChild` to render the consumer's own element as
24
24
  * the container, with the `data-status` hook merged in.
25
25
  */
26
- function AvatarRoot({
26
+ export function AvatarRoot({
27
27
  asChild = false,
28
28
  children,
29
29
  ...rest
@@ -45,6 +45,7 @@ function AvatarRoot({
45
45
  );
46
46
  }
47
47
 
48
+ /** @internal */
48
49
  AvatarRoot.displayName = "AvatarRoot";
49
50
 
50
51
  /**
@@ -60,7 +61,7 @@ AvatarRoot.displayName = "AvatarRoot";
60
61
  *
61
62
  * @throws if rendered outside an `Avatar.Root`.
62
63
  */
63
- function AvatarImage({
64
+ export function AvatarImage({
64
65
  asChild = false,
65
66
  children,
66
67
  ...rest
@@ -86,6 +87,7 @@ function AvatarImage({
86
87
  return <img {...imageProps} ref={ref} />;
87
88
  }
88
89
 
90
+ /** @internal */
89
91
  AvatarImage.displayName = "AvatarImage";
90
92
 
91
93
  /**
@@ -101,7 +103,7 @@ AvatarImage.displayName = "AvatarImage";
101
103
  *
102
104
  * @throws if rendered outside an `Avatar.Root`.
103
105
  */
104
- function AvatarFallback({
106
+ export function AvatarFallback({
105
107
  delayMs,
106
108
  asChild = false,
107
109
  children,
@@ -131,9 +133,11 @@ function AvatarFallback({
131
133
  return <span {...fallbackProps}>{children}</span>;
132
134
  }
133
135
 
136
+ /** @internal */
134
137
  AvatarFallback.displayName = "AvatarFallback";
135
138
 
136
- type TAvatarCompound = typeof AvatarRoot & {
139
+ /** Static-property shape of the compound {@link Avatar} export: the callable {@link AvatarRoot} plus its namespaced sub-components. */
140
+ export type TAvatarCompound = typeof AvatarRoot & {
137
141
  Root: typeof AvatarRoot;
138
142
  Image: typeof AvatarImage;
139
143
  Fallback: typeof AvatarFallback;
@@ -19,6 +19,8 @@ const avatarContextPair = createStrictContext<AvatarContextValue>(
19
19
  "AvatarContext",
20
20
  );
21
21
 
22
+ /** React context carrying the {@link AvatarContextValue} shared by the avatar's sub-components. */
22
23
  export const AvatarContext: Context<AvatarContextValue | null> =
23
24
  avatarContextPair[0];
25
+ /** Hook returning the {@link AvatarContextValue}; throws when used outside an `<Avatar.Root>`. */
24
26
  export const useAvatarContext: () => AvatarContextValue = avatarContextPair[1];
@@ -26,7 +26,7 @@ import {
26
26
  * </Breadcrumb.Root>
27
27
  * ```
28
28
  */
29
- function BreadcrumbRoot({
29
+ export function BreadcrumbRoot({
30
30
  children,
31
31
  ...rest
32
32
  }: BreadcrumbRootProps): ReactElement {
@@ -37,6 +37,7 @@ function BreadcrumbRoot({
37
37
  );
38
38
  }
39
39
 
40
+ /** @internal */
40
41
  BreadcrumbRoot.displayName = "BreadcrumbRoot";
41
42
 
42
43
  /**
@@ -56,13 +57,14 @@ BreadcrumbRoot.displayName = "BreadcrumbRoot";
56
57
  * </Breadcrumb.List>
57
58
  * ```
58
59
  */
59
- function BreadcrumbList({
60
+ export function BreadcrumbList({
60
61
  children,
61
62
  ...rest
62
63
  }: BreadcrumbListProps): ReactElement {
63
64
  return <ol {...rest}>{children}</ol>;
64
65
  }
65
66
 
67
+ /** @internal */
66
68
  BreadcrumbList.displayName = "BreadcrumbList";
67
69
 
68
70
  /**
@@ -78,13 +80,14 @@ BreadcrumbList.displayName = "BreadcrumbList";
78
80
  * </Breadcrumb.Item>
79
81
  * ```
80
82
  */
81
- function BreadcrumbItem({
83
+ export function BreadcrumbItem({
82
84
  children,
83
85
  ...rest
84
86
  }: BreadcrumbItemProps): ReactElement {
85
87
  return <li {...rest}>{children}</li>;
86
88
  }
87
89
 
90
+ /** @internal */
88
91
  BreadcrumbItem.displayName = "BreadcrumbItem";
89
92
 
90
93
  /**
@@ -109,7 +112,7 @@ BreadcrumbItem.displayName = "BreadcrumbItem";
109
112
  * </Breadcrumb.Link>
110
113
  * ```
111
114
  */
112
- function BreadcrumbLink({
115
+ export function BreadcrumbLink({
113
116
  children,
114
117
  asChild = false,
115
118
  ...rest
@@ -120,6 +123,7 @@ function BreadcrumbLink({
120
123
  return <a {...rest}>{children}</a>;
121
124
  }
122
125
 
126
+ /** @internal */
123
127
  BreadcrumbLink.displayName = "BreadcrumbLink";
124
128
 
125
129
  /**
@@ -136,7 +140,7 @@ BreadcrumbLink.displayName = "BreadcrumbLink";
136
140
  * </Breadcrumb.Item>
137
141
  * ```
138
142
  */
139
- function BreadcrumbPage({
143
+ export function BreadcrumbPage({
140
144
  children,
141
145
  ...rest
142
146
  }: BreadcrumbPageProps): ReactElement {
@@ -147,6 +151,7 @@ function BreadcrumbPage({
147
151
  );
148
152
  }
149
153
 
154
+ /** @internal */
150
155
  BreadcrumbPage.displayName = "BreadcrumbPage";
151
156
 
152
157
  /**
@@ -171,7 +176,7 @@ BreadcrumbPage.displayName = "BreadcrumbPage";
171
176
  * <Breadcrumb.Separator><ChevronRight /></Breadcrumb.Separator>
172
177
  * ```
173
178
  */
174
- function BreadcrumbSeparator({
179
+ export function BreadcrumbSeparator({
175
180
  children = "/",
176
181
  ...rest
177
182
  }: BreadcrumbSeparatorProps): ReactElement {
@@ -182,9 +187,11 @@ function BreadcrumbSeparator({
182
187
  );
183
188
  }
184
189
 
190
+ /** @internal */
185
191
  BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
186
192
 
187
- type TBreadcrumbCompound = typeof BreadcrumbRoot & {
193
+ /** Type of the {@link Breadcrumb} compound: the root callable plus its attached sub-components. */
194
+ export type TBreadcrumbCompound = typeof BreadcrumbRoot & {
188
195
  Root: typeof BreadcrumbRoot;
189
196
  List: typeof BreadcrumbList;
190
197
  Item: typeof BreadcrumbItem;
@@ -243,6 +250,7 @@ const BreadcrumbCompound: TBreadcrumbCompound = Object.assign(BreadcrumbRoot, {
243
250
  Separator: BreadcrumbSeparator,
244
251
  });
245
252
 
253
+ /** @internal */
246
254
  BreadcrumbCompound.displayName = "Breadcrumb";
247
255
 
248
256
  export { BreadcrumbCompound as Breadcrumb };
@@ -94,4 +94,5 @@ export function Button({
94
94
  );
95
95
  }
96
96
 
97
+ /** @internal */
97
98
  Button.displayName = "Button";
@@ -1,5 +1,9 @@
1
1
  import { ComponentProps, ReactNode, Ref } from "react";
2
2
 
3
+ /**
4
+ * Props for {@link Button} — all native `<button>` attributes (with `type`
5
+ * defaulting to `"button"`) plus the `asChild` escape hatch and a typed `ref`.
6
+ */
3
7
  export type ButtonProps = Omit<ComponentProps<"button">, "type"> & {
4
8
  type?: "button" | "submit" | "reset";
5
9
  asChild?: boolean;
@@ -210,6 +210,7 @@ export function CarouselViewport({
210
210
  );
211
211
  }
212
212
 
213
+ /** @internal */
213
214
  CarouselViewport.displayName = "CarouselViewport";
214
215
 
215
216
  /**
@@ -286,6 +287,7 @@ export function CarouselSlide({
286
287
  );
287
288
  }
288
289
 
290
+ /** @internal */
289
291
  CarouselSlide.displayName = "CarouselSlide";
290
292
 
291
293
  /**
@@ -353,6 +355,7 @@ export function CarouselNextTrigger({
353
355
  );
354
356
  }
355
357
 
358
+ /** @internal */
356
359
  CarouselNextTrigger.displayName = "CarouselNextTrigger";
357
360
 
358
361
  /**
@@ -415,6 +418,7 @@ export function CarouselPreviousTrigger({
415
418
  );
416
419
  }
417
420
 
421
+ /** @internal */
418
422
  CarouselPreviousTrigger.displayName = "CarouselPreviousTrigger";
419
423
 
420
424
  /**
@@ -469,6 +473,7 @@ export function CarouselIndicatorGroup({
469
473
  );
470
474
  }
471
475
 
476
+ /** @internal */
472
477
  CarouselIndicatorGroup.displayName = "CarouselIndicatorGroup";
473
478
 
474
479
  /**
@@ -535,6 +540,7 @@ export function CarouselIndicator({
535
540
  );
536
541
  }
537
542
 
543
+ /** @internal */
538
544
  CarouselIndicator.displayName = "CarouselIndicator";
539
545
 
540
546
  /**
@@ -571,6 +577,7 @@ export function CarouselIndicators(
571
577
  );
572
578
  }
573
579
 
580
+ /** @internal */
574
581
  CarouselIndicators.displayName = "CarouselIndicators";
575
582
 
576
583
  /**
@@ -644,8 +651,10 @@ export function CarouselPlayPauseTrigger({
644
651
  );
645
652
  }
646
653
 
654
+ /** @internal */
647
655
  CarouselPlayPauseTrigger.displayName = "CarouselPlayPauseTrigger";
648
656
 
657
+ /** Static-property shape of the compound {@link Carousel} export: the callable {@link CarouselRoot} plus its namespaced sub-components. */
649
658
  type CarouselCompound = typeof CarouselRoot & {
650
659
  Root: typeof CarouselRoot;
651
660
  Viewport: typeof CarouselViewport;
@@ -1,12 +1,15 @@
1
- import { createContext, type Context } from "react";
1
+ import { createContext, type Context, type Provider } from "react";
2
2
 
3
3
  import type { CarouselContextValue } from "./types";
4
4
 
5
+ /** React context carrying the {@link CarouselContextValue} shared by the carousel's sub-components. */
5
6
  export const CarouselContext: Context<CarouselContextValue | null> =
6
7
  createContext<CarouselContextValue | null>(null);
7
8
 
8
9
  CarouselContext.displayName = "CarouselContext";
9
10
 
10
- const CarouselProvider = CarouselContext.Provider;
11
+ /** Provider for {@link CarouselContext}; wraps the carousel subtree with its shared state. */
12
+ const CarouselProvider: Provider<CarouselContextValue | null> =
13
+ CarouselContext.Provider;
11
14
 
12
15
  export { CarouselProvider };
@@ -153,6 +153,7 @@ export type CarouselTranslations = {
153
153
  stopSlideshow?: string;
154
154
  };
155
155
 
156
+ /** Props for `Carousel.Root` — the labelled `<section>` wrapping the whole widget; combines label, page-state, and playing-state shapes with autoplay, transition, and layout options. */
156
157
  export type CarouselRootProps = Omit<
157
158
  ComponentProps<"section">,
158
159
  "aria-label" | "aria-labelledby"
@@ -278,8 +279,10 @@ export type CarouselContextValue = {
278
279
  isProgrammaticScrollRef: RefObject<boolean>;
279
280
  };
280
281
 
282
+ /** Props for `Carousel.Viewport` — the scroll-snap slide container; accepts all native `<div>` props. */
281
283
  export type CarouselViewportProps = ComponentProps<"div">;
282
284
 
285
+ /** Props for `Carousel.Slide` — an individual slide that self-registers with the Root; native `<div>` props plus an optional accessible-label override. */
283
286
  export type CarouselSlideProps = Omit<ComponentProps<"div">, "aria-label"> & {
284
287
  /** Override the auto-generated `"N of M"` `aria-label`. Use this when
285
288
  * the slide has a more meaningful description than its position
@@ -288,6 +291,7 @@ export type CarouselSlideProps = Omit<ComponentProps<"div">, "aria-label"> & {
288
291
  ariaLabel?: string;
289
292
  };
290
293
 
294
+ /** Props for `Carousel.NextTrigger` — the button that advances one page; native `<button>` props plus `asChild`. */
291
295
  export type CarouselNextTriggerProps = ComponentProps<"button"> & {
292
296
  /** Render the child element instead of the default `<button>`. All
293
297
  * trigger props (onClick, disabled, ids.nextTrigger, …) are merged
@@ -295,6 +299,7 @@ export type CarouselNextTriggerProps = ComponentProps<"button"> & {
295
299
  asChild?: boolean;
296
300
  };
297
301
 
302
+ /** Props for `Carousel.PreviousTrigger` — the button that retreats one page; native `<button>` props plus `asChild`. */
298
303
  export type CarouselPreviousTriggerProps = ComponentProps<"button"> & {
299
304
  /** See `CarouselNextTriggerProps.asChild`. */
300
305
  asChild?: boolean;
@@ -315,6 +320,7 @@ export type CarouselIndicatorGroupProps = Omit<
315
320
  | { label?: never; ariaLabelledBy: string }
316
321
  );
317
322
 
323
+ /** Props for `Carousel.Indicator` — a button that jumps to its target page; native `<button>` props plus the target `index` and `asChild`. */
318
324
  export type CarouselIndicatorProps = ComponentProps<"button"> & {
319
325
  /** Zero-based page this indicator targets. Clicking jumps to it. */
320
326
  index: number;
@@ -357,6 +363,7 @@ export type CarouselImperativeApi = {
357
363
  isInView: (slideIndex: number) => boolean;
358
364
  };
359
365
 
366
+ /** Live progress snapshot reported by the carousel: the active page, the total page count, and a normalised `value` in `[0, 1]`. */
360
367
  export type CarouselProgress = {
361
368
  page: number;
362
369
  totalPages: number;
@@ -388,6 +395,7 @@ export type CarouselPlayPauseTriggerChildren =
388
395
  | ReactNode
389
396
  | ((state: { playing: boolean }) => ReactNode);
390
397
 
398
+ /** Props for `Carousel.PlayPauseTrigger` — toggles autoplay; native `<button>` props with a state-aware render-prop `children` and `asChild`. */
391
399
  export type CarouselPlayPauseTriggerProps = Omit<
392
400
  ComponentProps<"button">,
393
401
  "children"
@@ -77,7 +77,7 @@ function dataStateOf(checked: CheckedState) {
77
77
  * </Checkbox.Root>
78
78
  * ```
79
79
  */
80
- function CheckboxRoot(props: CheckboxRootProps): ReactElement {
80
+ export function CheckboxRoot(props: CheckboxRootProps): ReactElement {
81
81
  const {
82
82
  defaultChecked,
83
83
  checked,
@@ -119,6 +119,7 @@ function CheckboxRoot(props: CheckboxRootProps): ReactElement {
119
119
  );
120
120
  }
121
121
 
122
+ /** @internal */
122
123
  CheckboxRoot.displayName = "CheckboxRoot";
123
124
 
124
125
  /**
@@ -165,7 +166,7 @@ CheckboxRoot.displayName = "CheckboxRoot";
165
166
  *
166
167
  * @throws if rendered outside a `Checkbox.Root`.
167
168
  */
168
- function CheckboxIndicator({
169
+ export function CheckboxIndicator({
169
170
  children,
170
171
  forceMount,
171
172
  asChild = false,
@@ -185,9 +186,11 @@ function CheckboxIndicator({
185
186
  return <span {...indicatorProps}>{children}</span>;
186
187
  }
187
188
 
189
+ /** @internal */
188
190
  CheckboxIndicator.displayName = "CheckboxIndicator";
189
191
 
190
- type TCheckboxCompound = typeof CheckboxRoot & {
192
+ /** Type of the {@link Checkbox} compound: the root callable plus its attached sub-components. */
193
+ export type TCheckboxCompound = typeof CheckboxRoot & {
191
194
  Root: typeof CheckboxRoot;
192
195
  Indicator: typeof CheckboxIndicator;
193
196
  };
@@ -224,6 +227,7 @@ const CheckboxCompound: TCheckboxCompound = Object.assign(CheckboxRoot, {
224
227
  Indicator: CheckboxIndicator,
225
228
  });
226
229
 
230
+ /** @internal */
227
231
  CheckboxCompound.displayName = "Checkbox";
228
232
 
229
233
  export { CheckboxCompound as Checkbox };
@@ -1 +1,2 @@
1
1
  export * from "./Checkbox";
2
+ export * from "./types";