@primitiv-ui/react 0.1.0 → 0.1.1

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 (162) hide show
  1. package/package.json +1 -1
  2. package/src/AccessibleIcon/AccessibleIcon.tsx +5 -2
  3. package/src/AccessibleIcon/__tests__/AccessibleIcon.test.tsx +1 -1
  4. package/src/Accordion/Accordion.tsx +11 -12
  5. package/src/Accordion/AccordionContext.ts +1 -1
  6. package/src/Accordion/__tests__/Accordion.reading-direction.test.tsx +1 -1
  7. package/src/Accordion/hooks/useAccordionItem.ts +1 -1
  8. package/src/Accordion/hooks/useAccordionRoot.ts +1 -1
  9. package/src/Accordion/hooks/useAccordionTrigger.ts +2 -2
  10. package/src/Alert/Alert.tsx +8 -2
  11. package/src/Alert/__tests__/Alert.test.tsx +1 -1
  12. package/src/Avatar/Avatar.tsx +14 -5
  13. package/src/Avatar/AvatarContext.ts +10 -6
  14. package/src/Breadcrumb/Breadcrumb.tsx +21 -7
  15. package/src/Button/Button.tsx +4 -2
  16. package/src/Carousel/Carousel.tsx +21 -14
  17. package/src/Carousel/CarouselContext.ts +3 -2
  18. package/src/Carousel/__tests__/Carousel.asChild.test.tsx +1 -1
  19. package/src/Carousel/__tests__/Carousel.auto-play.test.tsx +1 -1
  20. package/src/Carousel/__tests__/Carousel.basic-rendering.test.tsx +1 -1
  21. package/src/Carousel/__tests__/Carousel.controlled-state.test.tsx +1 -1
  22. package/src/Carousel/__tests__/Carousel.error-handling.test.tsx +1 -1
  23. package/src/Carousel/__tests__/Carousel.ids.test.tsx +1 -1
  24. package/src/Carousel/__tests__/Carousel.imperative-api.test.tsx +2 -2
  25. package/src/Carousel/__tests__/Carousel.indicators.test.tsx +1 -1
  26. package/src/Carousel/__tests__/Carousel.intersection-observer.test.tsx +2 -2
  27. package/src/Carousel/__tests__/Carousel.keyboard-navigation.test.tsx +1 -1
  28. package/src/Carousel/__tests__/Carousel.play-pause.test.tsx +1 -1
  29. package/src/Carousel/__tests__/Carousel.prev-next.test.tsx +1 -1
  30. package/src/Carousel/__tests__/Carousel.reduced-motion.test.tsx +1 -1
  31. package/src/Carousel/__tests__/Carousel.refresh-progress.test.tsx +2 -2
  32. package/src/Carousel/__tests__/Carousel.scroll-snap-change.test.tsx +1 -1
  33. package/src/Carousel/__tests__/Carousel.scroll-sync.test.tsx +1 -1
  34. package/src/Carousel/__tests__/Carousel.slides-per-move.test.tsx +1 -1
  35. package/src/Carousel/__tests__/Carousel.slides-per-page.test.tsx +1 -1
  36. package/src/Carousel/__tests__/Carousel.touch-interaction.test.tsx +1 -1
  37. package/src/Carousel/__tests__/Carousel.transition-modes.test.tsx +1 -1
  38. package/src/Carousel/__tests__/Carousel.translations.test.tsx +1 -1
  39. package/src/Carousel/__tests__/Carousel.uncontrolled-state.test.tsx +1 -1
  40. package/src/Checkbox/Checkbox.tsx +5 -4
  41. package/src/Checkbox/CheckboxContext.ts +1 -1
  42. package/src/Checkbox/hooks/useCheckboxRoot.ts +1 -1
  43. package/src/CheckboxCard/CheckboxCard.tsx +5 -4
  44. package/src/CheckboxCard/CheckboxCardContext.ts +10 -5
  45. package/src/CheckboxCard/hooks/useCheckboxCardRoot.ts +1 -1
  46. package/src/Collapsible/Collapsible.tsx +22 -21
  47. package/src/Collapsible/CollapsibleContext.ts +1 -1
  48. package/src/Collapsible/hooks/useCollapsibleRoot.ts +1 -1
  49. package/src/Collapsible/hooks/useCollapsibleTrigger.ts +1 -1
  50. package/src/ContextMenu/ContextMenu.tsx +20 -19
  51. package/src/ContextMenu/ContextMenuContext.ts +2 -2
  52. package/src/ContextMenu/ContextMenuSubContext.ts +1 -1
  53. package/src/ContextMenu/__tests__/ContextMenu.reading-direction.test.tsx +1 -1
  54. package/src/ContextMenu/types.ts +1 -1
  55. package/src/DirectionProvider/DirectionProvider.tsx +6 -1
  56. package/src/DirectionProvider/__tests__/DirectionProvider.test.tsx +1 -1
  57. package/src/Divider/Divider.tsx +3 -1
  58. package/src/Divider/__tests__/Divider.test.tsx +1 -1
  59. package/src/Dropdown/Dropdown.tsx +20 -19
  60. package/src/Dropdown/DropdownContext.ts +2 -2
  61. package/src/Dropdown/DropdownSubContext.ts +1 -1
  62. package/src/Dropdown/__tests__/Dropdown.reading-direction.test.tsx +1 -1
  63. package/src/Dropdown/hooks/useDropdownContent.ts +1 -1
  64. package/src/Dropdown/hooks/useDropdownItem.ts +1 -1
  65. package/src/Dropdown/hooks/useDropdownRoot.ts +2 -2
  66. package/src/Dropdown/hooks/useDropdownTrigger.ts +1 -1
  67. package/src/Dropdown/types.ts +1 -1
  68. package/src/EmptyState/EmptyState.tsx +8 -6
  69. package/src/EmptyState/__tests__/EmptyState.Actions.test.tsx +1 -1
  70. package/src/EmptyState/__tests__/EmptyState.Description.test.tsx +1 -1
  71. package/src/EmptyState/__tests__/EmptyState.Media.test.tsx +1 -1
  72. package/src/EmptyState/__tests__/EmptyState.Root.test.tsx +1 -1
  73. package/src/EmptyState/__tests__/EmptyState.Title.test.tsx +1 -1
  74. package/src/Field/Field.tsx +11 -6
  75. package/src/Field/FieldContext.ts +1 -1
  76. package/src/Fieldset/Fieldset.tsx +11 -2
  77. package/src/Input/Input.tsx +5 -3
  78. package/src/Input/__tests__/Input.field-integration.test.tsx +1 -1
  79. package/src/InputGroup/InputGroup.tsx +6 -4
  80. package/src/MillerColumns/MillerColumns.tsx +9 -8
  81. package/src/MillerColumns/MillerColumnsContext.ts +1 -1
  82. package/src/MillerColumns/hooks/useMillerColumnsItem.ts +2 -2
  83. package/src/MillerColumns/hooks/useMillerColumnsRoot.ts +0 -0
  84. package/src/MillerColumns/useMillerColumnsSelection.ts +1 -1
  85. package/src/Modal/Modal.tsx +24 -11
  86. package/src/Modal/ModalContext.ts +10 -6
  87. package/src/Modal/hooks/useModalRoot.ts +1 -1
  88. package/src/Modal/hooks/useModalTrigger.ts +2 -2
  89. package/src/Portal/Portal.tsx +2 -1
  90. package/src/Progress/Progress.tsx +5 -4
  91. package/src/Progress/ProgressContext.ts +11 -6
  92. package/src/RadioCard/RadioCard.tsx +8 -7
  93. package/src/RadioCard/RadioCardContext.ts +10 -5
  94. package/src/RadioCard/RadioCardItemContext.ts +10 -5
  95. package/src/RadioCard/__tests__/RadioCard.reading-direction.test.tsx +1 -1
  96. package/src/RadioCard/hooks/useRadioCardRoot.ts +1 -1
  97. package/src/RadioGroup/RadioGroup.tsx +8 -7
  98. package/src/RadioGroup/RadioGroupContext.ts +1 -1
  99. package/src/RadioGroup/RadioGroupItemContext.ts +1 -1
  100. package/src/RadioGroup/__tests__/RadioGroup.reading-direction.test.tsx +1 -1
  101. package/src/RadioGroup/hooks/useRadioGroupRoot.ts +1 -1
  102. package/src/Select/Select.tsx +10 -6
  103. package/src/Select/__tests__/Select.field-integration.test.tsx +1 -1
  104. package/src/SkipNav/SkipNav.tsx +7 -2
  105. package/src/SkipNav/__tests__/SkipNav.ids.test.tsx +1 -1
  106. package/src/Slider/Slider.tsx +17 -7
  107. package/src/Slider/SliderContext.ts +10 -6
  108. package/src/Slider/__tests__/Slider.reading-direction.test.tsx +1 -1
  109. package/src/Slider/hooks/useSliderRoot.ts +1 -1
  110. package/src/Status/Status.tsx +8 -2
  111. package/src/Status/__tests__/Status.test.tsx +1 -1
  112. package/src/Switch/Switch.tsx +9 -4
  113. package/src/Switch/SwitchContext.ts +9 -5
  114. package/src/Switch/hooks/useSwitchRoot.ts +1 -1
  115. package/src/Table/Table.tsx +15 -9
  116. package/src/Table/__tests__/Table.Body.test.tsx +1 -1
  117. package/src/Table/__tests__/Table.Caption.test.tsx +1 -1
  118. package/src/Table/__tests__/Table.Cell.test.tsx +1 -1
  119. package/src/Table/__tests__/Table.Footer.test.tsx +1 -1
  120. package/src/Table/__tests__/Table.Head.test.tsx +1 -1
  121. package/src/Table/__tests__/Table.Header.test.tsx +1 -1
  122. package/src/Table/__tests__/Table.Root.test.tsx +1 -1
  123. package/src/Table/__tests__/Table.Row.test.tsx +1 -1
  124. package/src/Table/__tests__/Table.ScrollArea.test.tsx +1 -1
  125. package/src/Tabs/Tabs.tsx +24 -9
  126. package/src/Tabs/TabsContext.ts +9 -6
  127. package/src/Tabs/__tests__/Tabs.asChild.test.tsx +1 -1
  128. package/src/Tabs/__tests__/Tabs.basic-rendering.test.tsx +1 -1
  129. package/src/Tabs/__tests__/Tabs.change-event-callbacks.test.tsx +1 -1
  130. package/src/Tabs/__tests__/Tabs.controlled-state.test.tsx +1 -1
  131. package/src/Tabs/__tests__/Tabs.error-handling.test.tsx +1 -1
  132. package/src/Tabs/__tests__/Tabs.imperative-api.test.tsx +1 -1
  133. package/src/Tabs/__tests__/Tabs.keyboard-interaction.test.tsx +1 -1
  134. package/src/Tabs/__tests__/Tabs.lazy-mount.test.tsx +1 -1
  135. package/src/Tabs/__tests__/Tabs.mouse-interaction.test.tsx +1 -1
  136. package/src/Tabs/__tests__/Tabs.reading-direction.test.tsx +1 -1
  137. package/src/Tabs/__tests__/Tabs.uncontrolled-state.test.tsx +1 -1
  138. package/src/Tabs/hooks/useTabsContent.ts +1 -1
  139. package/src/Tabs/hooks/useTabsRoot.ts +1 -1
  140. package/src/Tabs/hooks/useTabsTrigger.ts +1 -1
  141. package/src/Tabs/utils.ts +1 -1
  142. package/src/Textarea/Textarea.tsx +5 -3
  143. package/src/Textarea/__tests__/Textarea.field-integration.test.tsx +1 -1
  144. package/src/Toggle/Toggle.tsx +10 -4
  145. package/src/ToggleGroup/ToggleGroup.tsx +14 -10
  146. package/src/ToggleGroup/ToggleGroupContext.ts +1 -1
  147. package/src/ToggleGroup/__tests__/ToggleGroup.reading-direction.test.tsx +1 -1
  148. package/src/ToggleGroup/hooks/useToggleGroupRoot.ts +1 -1
  149. package/src/Tooltip/Tooltip.tsx +23 -10
  150. package/src/Tooltip/TooltipContext.ts +1 -1
  151. package/src/Tooltip/hooks/useTooltipContent.ts +1 -1
  152. package/src/Tooltip/hooks/useTooltipRoot.ts +1 -1
  153. package/src/Tooltip/hooks/useTooltipTrigger.ts +1 -1
  154. package/src/Tree/Tree.tsx +12 -11
  155. package/src/Tree/TreeContext.ts +1 -1
  156. package/src/Tree/__tests__/Tree.selection-path.test.tsx +2 -2
  157. package/src/Tree/hooks/useTreeItemKeyboard.ts +1 -1
  158. package/src/Tree/hooks/useTreeRoot.ts +1 -1
  159. package/src/VisuallyHidden/VisuallyHidden.tsx +3 -2
  160. package/src/VisuallyHidden/__tests__/VisuallyHidden.test.tsx +1 -1
  161. package/src/index.ts +38 -38
  162. package/src/utils/createStrictContext.ts +9 -5
@@ -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,7 +1,7 @@
1
1
  import { ComponentProps, ReactNode, Ref } from "react";
2
2
 
3
3
  import { CheckedState } from "../Checkbox/types";
4
- import { Direction } from "../DirectionProvider";
4
+ import { Direction } from "../DirectionProvider/index.ts";
5
5
 
6
6
  type DropdownRootBaseProps = {
7
7
  children?: ReactNode;
@@ -1,4 +1,6 @@
1
- import { Slot } from "../Slot";
1
+ import type { ReactElement } from "react";
2
+
3
+ import { Slot } from "../Slot/index.ts";
2
4
  import {
3
5
  EmptyStateActionsProps,
4
6
  EmptyStateDescriptionProps,
@@ -38,7 +40,7 @@ function EmptyStateRoot({
38
40
  asChild = false,
39
41
  children,
40
42
  ...rest
41
- }: EmptyStateRootProps) {
43
+ }: EmptyStateRootProps): ReactElement {
42
44
  const rootProps = { role: "status", ...rest };
43
45
 
44
46
  if (asChild) {
@@ -76,7 +78,7 @@ function EmptyStateMedia({
76
78
  asChild = false,
77
79
  children,
78
80
  ...rest
79
- }: EmptyStateMediaProps) {
81
+ }: EmptyStateMediaProps): ReactElement {
80
82
  const mediaProps = { "aria-hidden": true, ...rest };
81
83
 
82
84
  if (asChild) {
@@ -111,7 +113,7 @@ function EmptyStateTitle({
111
113
  asChild = false,
112
114
  children,
113
115
  ...rest
114
- }: EmptyStateTitleProps) {
116
+ }: EmptyStateTitleProps): ReactElement {
115
117
  if (asChild) {
116
118
  return <Slot {...rest}>{children}</Slot>;
117
119
  }
@@ -141,7 +143,7 @@ function EmptyStateDescription({
141
143
  asChild = false,
142
144
  children,
143
145
  ...rest
144
- }: EmptyStateDescriptionProps) {
146
+ }: EmptyStateDescriptionProps): ReactElement {
145
147
  if (asChild) {
146
148
  return <Slot {...rest}>{children}</Slot>;
147
149
  }
@@ -175,7 +177,7 @@ function EmptyStateActions({
175
177
  asChild = false,
176
178
  children,
177
179
  ...rest
178
- }: EmptyStateActionsProps) {
180
+ }: EmptyStateActionsProps): ReactElement {
179
181
  if (asChild) {
180
182
  return <Slot {...rest}>{children}</Slot>;
181
183
  }
@@ -1,4 +1,4 @@
1
- import { EmptyState } from "..";
1
+ import { EmptyState } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("EmptyState.Actions component", () => {
@@ -1,4 +1,4 @@
1
- import { EmptyState } from "..";
1
+ import { EmptyState } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("EmptyState.Description component", () => {
@@ -1,4 +1,4 @@
1
- import { EmptyState } from "..";
1
+ import { EmptyState } from "../index.ts";
2
2
  import { render } from "@testing-library/react";
3
3
 
4
4
  describe("EmptyState.Media component", () => {
@@ -1,4 +1,4 @@
1
- import { EmptyState } from "..";
1
+ import { EmptyState } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("EmptyState.Root component", () => {
@@ -1,4 +1,4 @@
1
- import { EmptyState } from "..";
1
+ import { EmptyState } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("EmptyState.Title component", () => {
@@ -1,8 +1,9 @@
1
1
  import { useId, useMemo } from "react";
2
+ import type { ReactElement } from "react";
2
3
 
3
- import { Slot } from "../Slot";
4
+ import { Slot } from "../Slot/index.ts";
4
5
  import { FieldContext } from "./FieldContext";
5
- import { useFieldContext } from "./hooks";
6
+ import { useFieldContext } from "./hooks/index.ts";
6
7
  import {
7
8
  FieldDescriptionProps,
8
9
  FieldErrorTextProps,
@@ -53,7 +54,7 @@ function FieldRoot({
53
54
  asChild = false,
54
55
  children,
55
56
  ...rest
56
- }: FieldRootProps) {
57
+ }: FieldRootProps): ReactElement {
57
58
  const autoId = useId();
58
59
  const id = idProp ?? autoId;
59
60
  const descriptionId = `${id}-description`;
@@ -94,7 +95,11 @@ FieldRoot.displayName = "FieldRoot";
94
95
  *
95
96
  * @throws If rendered outside a `<Field.Root>`.
96
97
  */
97
- function FieldLabel({ asChild = false, children, ...rest }: FieldLabelProps) {
98
+ function FieldLabel({
99
+ asChild = false,
100
+ children,
101
+ ...rest
102
+ }: FieldLabelProps): ReactElement {
98
103
  const { id } = useFieldContext();
99
104
  const labelProps = { ...rest, htmlFor: id };
100
105
 
@@ -121,7 +126,7 @@ function FieldDescription({
121
126
  asChild = false,
122
127
  children,
123
128
  ...rest
124
- }: FieldDescriptionProps) {
129
+ }: FieldDescriptionProps): ReactElement {
125
130
  const { descriptionId } = useFieldContext();
126
131
  const descriptionProps = { ...rest, id: descriptionId };
127
132
 
@@ -155,7 +160,7 @@ function FieldErrorText({
155
160
  asChild = false,
156
161
  children,
157
162
  ...rest
158
- }: FieldErrorTextProps) {
163
+ }: FieldErrorTextProps): ReactElement | null {
159
164
  const { errorId, invalid } = useFieldContext();
160
165
  if (!invalid) return null;
161
166
  const errorProps = { ...rest, id: errorId, role: "alert" as const };
@@ -1,4 +1,4 @@
1
- import { createStrictContext } from "../utils";
1
+ import { createStrictContext } from "../utils/index.ts";
2
2
 
3
3
  export type FieldContextValue = {
4
4
  /** Stable id for the control wired to this field. */
@@ -1,3 +1,5 @@
1
+ import type { ReactElement } from "react";
2
+
1
3
  import { FieldsetLegendProps, FieldsetProps } from "./types";
2
4
 
3
5
  /**
@@ -27,7 +29,11 @@ import { FieldsetLegendProps, FieldsetProps } from "./types";
27
29
  * </Fieldset.Root>
28
30
  * ```
29
31
  */
30
- function Fieldset({ disabled, children, ...rest }: FieldsetProps) {
32
+ function Fieldset({
33
+ disabled,
34
+ children,
35
+ ...rest
36
+ }: FieldsetProps): ReactElement {
31
37
  return (
32
38
  <fieldset
33
39
  {...rest}
@@ -53,7 +59,10 @@ Fieldset.displayName = "Fieldset";
53
59
  * <Fieldset.Legend>Shipping address</Fieldset.Legend>
54
60
  * ```
55
61
  */
56
- function FieldsetLegend({ children, ...rest }: FieldsetLegendProps) {
62
+ function FieldsetLegend({
63
+ children,
64
+ ...rest
65
+ }: FieldsetLegendProps): ReactElement {
57
66
  return <legend {...rest}>{children}</legend>;
58
67
  }
59
68
 
@@ -1,5 +1,7 @@
1
- import { useFieldProps } from "../Field/hooks";
2
- import { Slot } from "../Slot";
1
+ import type { ReactElement } from "react";
2
+
3
+ import { useFieldProps } from "../Field/hooks/index.ts";
4
+ import { Slot } from "../Slot/index.ts";
3
5
  import { InputProps } from "./types";
4
6
 
5
7
  /**
@@ -101,7 +103,7 @@ export function Input({
101
103
  children,
102
104
  ref,
103
105
  ...consumer
104
- }: InputProps) {
106
+ }: InputProps): ReactElement {
105
107
  const merged = useFieldProps(consumer);
106
108
 
107
109
  const rootProps = {
@@ -1,6 +1,6 @@
1
1
  import { render, screen } from "@testing-library/react";
2
2
 
3
- import { Field } from "../../Field";
3
+ import { Field } from "../../Field/index.ts";
4
4
  import { Input } from "../Input";
5
5
 
6
6
  describe("Input — Field integration", () => {
@@ -1,4 +1,6 @@
1
- import { Slot } from "../Slot";
1
+ import type { ReactElement } from "react";
2
+
3
+ import { Slot } from "../Slot/index.ts";
2
4
  import { InputGroupAdornmentProps, InputGroupRootProps } from "./types";
3
5
 
4
6
  /**
@@ -39,7 +41,7 @@ function InputGroupRoot({
39
41
  children,
40
42
  ref,
41
43
  ...rest
42
- }: InputGroupRootProps) {
44
+ }: InputGroupRootProps): ReactElement {
43
45
  const rootProps = {
44
46
  ...rest,
45
47
  ref,
@@ -94,7 +96,7 @@ function InputGroupLeadingAdornment({
94
96
  children,
95
97
  ref,
96
98
  ...rest
97
- }: InputGroupAdornmentProps) {
99
+ }: InputGroupAdornmentProps): ReactElement {
98
100
  const adornmentProps = {
99
101
  ...rest,
100
102
  ref,
@@ -141,7 +143,7 @@ function InputGroupTrailingAdornment({
141
143
  children,
142
144
  ref,
143
145
  ...rest
144
- }: InputGroupAdornmentProps) {
146
+ }: InputGroupAdornmentProps): ReactElement {
145
147
  const adornmentProps = {
146
148
  ...rest,
147
149
  ref,
@@ -1,7 +1,8 @@
1
1
  import { Ref } from "react";
2
+ import type { ReactElement, ReactPortal } from "react";
2
3
  import { createPortal } from "react-dom";
3
4
 
4
- import { Slot } from "../Slot";
5
+ import { Slot } from "../Slot/index.ts";
5
6
 
6
7
  import {
7
8
  MillerColumnsContext,
@@ -15,7 +16,7 @@ import {
15
16
  useMillerColumnsItemContext,
16
17
  useMillerColumnsResizeHandle,
17
18
  useMillerColumnsRoot,
18
- } from "./hooks";
19
+ } from "./hooks/index.ts";
19
20
 
20
21
  import { partitionItemChildren } from "./utils";
21
22
 
@@ -53,7 +54,7 @@ export function MillerColumnsRoot({
53
54
  value,
54
55
  onValueChange,
55
56
  ...rest
56
- }: MillerColumnsRootProps) {
57
+ }: MillerColumnsRootProps): ReactElement {
57
58
  const { contextValue, columnCount, registerSlotRef, stripRef } =
58
59
  useMillerColumnsRoot(value, defaultValue, onValueChange);
59
60
 
@@ -99,7 +100,7 @@ export function MillerColumnsColumn({
99
100
  children,
100
101
  style,
101
102
  ...rest
102
- }: MillerColumnsColumnProps) {
103
+ }: MillerColumnsColumnProps): ReactPortal | null {
103
104
  const { slot, depth, width, columnContextValue } = useMillerColumnsColumn();
104
105
 
105
106
  if (!slot) {
@@ -166,7 +167,7 @@ export function MillerColumnsItem<T extends HTMLElement = HTMLDivElement>({
166
167
  ref,
167
168
  asChild = false,
168
169
  ...props
169
- }: MillerColumnsItemProps<T>) {
170
+ }: MillerColumnsItemProps<T>): ReactElement {
170
171
  const { cell, column } = partitionItemChildren(children);
171
172
  const { itemProps, selected, itemContextValue } = useMillerColumnsItem(
172
173
  { ref: ref as Ref<HTMLDivElement>, ...props },
@@ -212,7 +213,7 @@ MillerColumnsItem.displayName = "MillerColumnsItem";
212
213
  export function MillerColumnsItemIndicator({
213
214
  children,
214
215
  ...rest
215
- }: MillerColumnsItemIndicatorProps) {
216
+ }: MillerColumnsItemIndicatorProps): ReactElement | null {
216
217
  const { selected, hasChildren } = useMillerColumnsItemContext();
217
218
 
218
219
  if (!hasChildren) {
@@ -252,7 +253,7 @@ MillerColumnsItemIndicator.displayName = "MillerColumnsItemIndicator";
252
253
  */
253
254
  export function MillerColumnsResizeHandle(
254
255
  props: MillerColumnsResizeHandleProps,
255
- ) {
256
+ ): ReactElement {
256
257
  const { handleProps } = useMillerColumnsResizeHandle(props);
257
258
 
258
259
  return <div {...handleProps} />;
@@ -291,7 +292,7 @@ MillerColumnsResizeHandle.displayName = "MillerColumnsResizeHandle";
291
292
  export function MillerColumnsPreviewPanel({
292
293
  children,
293
294
  ...rest
294
- }: MillerColumnsPreviewPanelProps) {
295
+ }: MillerColumnsPreviewPanelProps): ReactElement {
295
296
  useMillerColumnsContext();
296
297
 
297
298
  return (
@@ -1,4 +1,4 @@
1
- import { createStrictContext } from "../utils";
1
+ import { createStrictContext } from "../utils/index.ts";
2
2
 
3
3
  import type {
4
4
  MillerColumnsContextValue,
@@ -7,8 +7,8 @@ import {
7
7
  useRef,
8
8
  } from "react";
9
9
 
10
- import { useRovingTabindex } from "../../hooks";
11
- import { composeRefs } from "../../Slot";
10
+ import { useRovingTabindex } from "../../hooks/index.ts";
11
+ import { composeRefs } from "../../Slot/index.ts";
12
12
 
13
13
  import type {
14
14
  MillerColumnsItemContextValue,
@@ -1,4 +1,4 @@
1
- import { useMillerColumnsContext } from "./hooks";
1
+ import { useMillerColumnsContext } from "./hooks/index.ts";
2
2
 
3
3
  import type { MillerColumnsSelection } from "./types";
4
4
 
@@ -1,7 +1,8 @@
1
1
  import { Ref, useEffect, useId } from "react";
2
+ import type { ReactElement } from "react";
2
3
 
3
- import { Portal } from "../Portal";
4
- import { Slot, composeEventHandlers, composeRefs } from "../Slot";
4
+ import { Portal } from "../Portal/index.ts";
5
+ import { Slot, composeEventHandlers, composeRefs } from "../Slot/index.ts";
5
6
 
6
7
  import { ModalProvider } from "./ModalContext";
7
8
  import {
@@ -9,7 +10,7 @@ import {
9
10
  useModalContext,
10
11
  useModalRoot,
11
12
  useModalTrigger,
12
- } from "./hooks";
13
+ } from "./hooks/index.ts";
13
14
  import {
14
15
  ModalCloseProps,
15
16
  ModalContentProps,
@@ -73,7 +74,7 @@ function ModalRoot({
73
74
  defaultOpen,
74
75
  open,
75
76
  onOpenChange,
76
- }: ModalRootProps) {
77
+ }: ModalRootProps): ReactElement {
77
78
  const { contextValue } = useModalRoot(
78
79
  { defaultOpen, open, onOpenChange },
79
80
  ref,
@@ -110,7 +111,7 @@ function ModalTrigger({
110
111
  type,
111
112
  asChild = false,
112
113
  ...rest
113
- }: ModalTriggerProps) {
114
+ }: ModalTriggerProps): ReactElement {
114
115
  const { getTriggerProps } = useModalTrigger(onClick, rest);
115
116
 
116
117
  if (asChild) {
@@ -141,7 +142,11 @@ ModalTrigger.displayName = "ModalTrigger";
141
142
  * </Modal.Portal>
142
143
  * ```
143
144
  */
144
- function ModalPortal({ children, container, forceMount }: ModalPortalProps) {
145
+ function ModalPortal({
146
+ children,
147
+ container,
148
+ forceMount,
149
+ }: ModalPortalProps): ReactElement | null {
145
150
  const { open } = useModalContext();
146
151
 
147
152
  if (!open && !forceMount) return null;
@@ -189,7 +194,7 @@ function ModalOverlay({
189
194
  asChild = false,
190
195
  forceMount,
191
196
  ...rest
192
- }: ModalOverlayProps) {
197
+ }: ModalOverlayProps): ReactElement | null {
193
198
  const { open } = useModalContext();
194
199
  if (!open && !forceMount) return null;
195
200
  const overlayProps = {
@@ -252,7 +257,7 @@ function ModalContent({
252
257
  onPointerDownOutside,
253
258
  ref: externalRef,
254
259
  ...rest
255
- }: ModalContentProps & { ref?: Ref<HTMLDialogElement> }) {
260
+ }: ModalContentProps & { ref?: Ref<HTMLDialogElement> }): ReactElement {
256
261
  const { ref: innerRef, open, contentId } = useModalContent();
257
262
  const { contentCallbacksRef, titleId, descriptionId } = useModalContext();
258
263
  // Keep the ref pointed at the latest callbacks so event handlers wired
@@ -297,7 +302,11 @@ ModalContent.displayName = "ModalContent";
297
302
  * </Modal.Title>
298
303
  * ```
299
304
  */
300
- function ModalTitle({ children, asChild = false, ...rest }: ModalTitleProps) {
305
+ function ModalTitle({
306
+ children,
307
+ asChild = false,
308
+ ...rest
309
+ }: ModalTitleProps): ReactElement {
301
310
  const { registerTitle } = useModalContext();
302
311
  const id = useId();
303
312
 
@@ -342,7 +351,7 @@ function ModalDescription({
342
351
  children,
343
352
  asChild = false,
344
353
  ...rest
345
- }: ModalDescriptionProps) {
354
+ }: ModalDescriptionProps): ReactElement {
346
355
  const { registerDescription } = useModalContext();
347
356
  const id = useId();
348
357
 
@@ -386,7 +395,11 @@ ModalDescription.displayName = "ModalDescription";
386
395
  * </Modal.Close>
387
396
  * ```
388
397
  */
389
- function ModalClose({ onClick, asChild = false, ...rest }: ModalCloseProps) {
398
+ function ModalClose({
399
+ onClick,
400
+ asChild = false,
401
+ ...rest
402
+ }: ModalCloseProps): ReactElement {
390
403
  const { setOpen } = useModalContext();
391
404
  const closeProps = {
392
405
  ...rest,
@@ -1,12 +1,16 @@
1
- import { createStrictContext } from "../utils";
1
+ import type { Context } from "react";
2
+ import { createStrictContext } from "../utils/index.ts";
2
3
 
3
4
  import { ModalContextValue } from "./types";
4
5
 
5
- export const [ModalContext, useModalContext] =
6
- createStrictContext<ModalContextValue>(
7
- "Component must be rendered as a child of Modal.Root",
8
- "ModalContext",
9
- );
6
+ const modalContextPair = createStrictContext<ModalContextValue>(
7
+ "Component must be rendered as a child of Modal.Root",
8
+ "ModalContext",
9
+ );
10
+
11
+ export const ModalContext: Context<ModalContextValue | null> =
12
+ modalContextPair[0];
13
+ export const useModalContext: () => ModalContextValue = modalContextPair[1];
10
14
 
11
15
  const ModalProvider = ModalContext.Provider;
12
16
 
@@ -8,7 +8,7 @@ import {
8
8
  useState,
9
9
  } from "react";
10
10
 
11
- import { useControllableState } from "../../hooks";
11
+ import { useControllableState } from "../../hooks/index.ts";
12
12
 
13
13
  import {
14
14
  ModalContentCallbacks,
@@ -1,6 +1,6 @@
1
1
  import { MouseEventHandler } from "react";
2
- import { useModalContext } from ".";
3
- import { composeEventHandlers } from "../../Slot";
2
+ import { useModalContext } from "./index.ts";
3
+ import { composeEventHandlers } from "../../Slot/index.ts";
4
4
  import type { ModalTriggerProps } from "../types";
5
5
 
6
6
  export function useModalTrigger(
@@ -1,3 +1,4 @@
1
+ import type { ReactPortal } from "react";
1
2
  import { createPortal } from "react-dom";
2
3
 
3
4
  import type { PortalProps } from "./types";
@@ -19,7 +20,7 @@ import type { PortalProps } from "./types";
19
20
  * <div role="dialog">…</div>
20
21
  * </Portal>
21
22
  */
22
- function Portal({ children, container }: PortalProps) {
23
+ function Portal({ children, container }: PortalProps): ReactPortal {
23
24
  return createPortal(children, container ?? document.body);
24
25
  }
25
26
 
@@ -1,9 +1,10 @@
1
1
  import { useMemo } from "react";
2
+ import type { ReactElement } from "react";
2
3
 
3
- import { Slot } from "../Slot";
4
+ import { Slot } from "../Slot/index.ts";
4
5
 
5
6
  import { ProgressContext } from "./ProgressContext";
6
- import { useProgressContext, useProgressRoot } from "./hooks";
7
+ import { useProgressContext, useProgressRoot } from "./hooks/index.ts";
7
8
  import { ProgressIndicatorProps, ProgressRootProps } from "./types";
8
9
 
9
10
  function defaultGetValueLabel(value: number, max: number): string {
@@ -53,7 +54,7 @@ function ProgressRoot({
53
54
  asChild = false,
54
55
  children,
55
56
  ...rest
56
- }: ProgressRootProps) {
57
+ }: ProgressRootProps): ReactElement {
57
58
  const resolved = useProgressRoot({ value, max });
58
59
  const { state } = resolved;
59
60
 
@@ -120,7 +121,7 @@ function ProgressIndicator({
120
121
  asChild = false,
121
122
  children,
122
123
  ...rest
123
- }: ProgressIndicatorProps) {
124
+ }: ProgressIndicatorProps): ReactElement {
124
125
  const { value, max, state } = useProgressContext();
125
126
  const indicatorProps = {
126
127
  ...rest,
@@ -1,4 +1,5 @@
1
- import { createStrictContext } from "../utils";
1
+ import type { Context } from "react";
2
+ import { createStrictContext } from "../utils/index.ts";
2
3
 
3
4
  import { ProgressState } from "./types";
4
5
 
@@ -8,8 +9,12 @@ export type ProgressContextValue = {
8
9
  state: ProgressState;
9
10
  };
10
11
 
11
- export const [ProgressContext, useProgressContext] =
12
- createStrictContext<ProgressContextValue>(
13
- "Progress.Indicator must be rendered inside a <Progress.Root>.",
14
- "ProgressContext",
15
- );
12
+ const progressContextPair = createStrictContext<ProgressContextValue>(
13
+ "Progress.Indicator must be rendered inside a <Progress.Root>.",
14
+ "ProgressContext",
15
+ );
16
+
17
+ export const ProgressContext: Context<ProgressContextValue | null> =
18
+ progressContextPair[0];
19
+ export const useProgressContext: () => ProgressContextValue =
20
+ progressContextPair[1];