@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,8 +1,9 @@
1
1
  import { useEffect, useMemo, useRef } from "react";
2
+ import type { ReactElement } from "react";
2
3
 
3
- import { useDirection } from "../DirectionProvider";
4
- import { useRovingTabindex } from "../hooks";
5
- import { Slot, composeEventHandlers, composeRefs } from "../Slot";
4
+ import { useDirection } from "../DirectionProvider/index.ts";
5
+ import { useRovingTabindex } from "../hooks/index.ts";
6
+ import { Slot, composeEventHandlers, composeRefs } from "../Slot/index.ts";
6
7
 
7
8
  import { RadioCardContext } from "./RadioCardContext";
8
9
  import { RadioCardItemContext } from "./RadioCardItemContext";
@@ -10,7 +11,7 @@ import {
10
11
  useRadioCardContext,
11
12
  useRadioCardItemContext,
12
13
  useRadioCardRoot,
13
- } from "./hooks";
14
+ } from "./hooks/index.ts";
14
15
  import {
15
16
  RadioCardIndicatorProps,
16
17
  RadioCardItemProps,
@@ -81,7 +82,7 @@ function RadioCardRoot({
81
82
  asChild = false,
82
83
  children,
83
84
  ...rest
84
- }: RadioCardRootProps) {
85
+ }: RadioCardRootProps): ReactElement {
85
86
  const resolvedDir = dir ?? useDirection();
86
87
  const { value, select, registerItem, itemValues, disabledValues, focusItem } =
87
88
  useRadioCardRoot({
@@ -166,7 +167,7 @@ function RadioCardItem({
166
167
  asChild = false,
167
168
  ref,
168
169
  ...rest
169
- }: RadioCardItemProps) {
170
+ }: RadioCardItemProps): ReactElement {
170
171
  const {
171
172
  value: selectedValue,
172
173
  select,
@@ -264,7 +265,7 @@ function RadioCardIndicator({
264
265
  forceMount,
265
266
  asChild = false,
266
267
  ...rest
267
- }: RadioCardIndicatorProps) {
268
+ }: RadioCardIndicatorProps): ReactElement | null {
268
269
  const { checked } = useRadioCardItemContext();
269
270
  if (!checked && !forceMount) return null;
270
271
  const indicatorProps = {
@@ -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 { RadioCardOrientation, RadioCardReadingDirection } from "./types";
4
5
 
@@ -17,7 +18,11 @@ export type RadioCardContextValue = {
17
18
  dir: RadioCardReadingDirection;
18
19
  };
19
20
 
20
- export const [RadioCardContext, useRadioCardContext] =
21
- createStrictContext<RadioCardContextValue>(
22
- "RadioCard sub-components must be rendered inside a <RadioCard.Root>.",
23
- );
21
+ const radioCardContextPair = createStrictContext<RadioCardContextValue>(
22
+ "RadioCard sub-components must be rendered inside a <RadioCard.Root>.",
23
+ );
24
+
25
+ export const RadioCardContext: Context<RadioCardContextValue | null> =
26
+ radioCardContextPair[0];
27
+ export const useRadioCardContext: () => RadioCardContextValue =
28
+ radioCardContextPair[1];
@@ -1,10 +1,15 @@
1
- import { createStrictContext } from "../utils";
1
+ import type { Context } from "react";
2
+ import { createStrictContext } from "../utils/index.ts";
2
3
 
3
4
  export type RadioCardItemContextValue = {
4
5
  checked: boolean;
5
6
  };
6
7
 
7
- export const [RadioCardItemContext, useRadioCardItemContext] =
8
- createStrictContext<RadioCardItemContextValue>(
9
- "RadioCard.Indicator must be rendered inside a <RadioCard.Item>.",
10
- );
8
+ const radioCardItemContextPair = createStrictContext<RadioCardItemContextValue>(
9
+ "RadioCard.Indicator must be rendered inside a <RadioCard.Item>.",
10
+ );
11
+
12
+ export const RadioCardItemContext: Context<RadioCardItemContextValue | null> =
13
+ radioCardItemContextPair[0];
14
+ export const useRadioCardItemContext: () => RadioCardItemContextValue =
15
+ radioCardItemContextPair[1];
@@ -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 { RadioCard } from "../RadioCard";
6
6
 
7
7
  describe("RadioCard reading direction", () => {
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useMemo } from "react";
2
2
 
3
- import { useCollection, useControllableState } from "../../hooks";
3
+ import { useCollection, useControllableState } from "../../hooks/index.ts";
4
4
 
5
5
  type UseRadioCardRootArgs = {
6
6
  defaultValue?: string;
@@ -1,8 +1,9 @@
1
1
  import { useEffect, useMemo, useRef } from "react";
2
+ import type { ReactElement } from "react";
2
3
 
3
- import { useDirection } from "../DirectionProvider";
4
- import { useRovingTabindex } from "../hooks";
5
- import { Slot, composeEventHandlers, composeRefs } from "../Slot";
4
+ import { useDirection } from "../DirectionProvider/index.ts";
5
+ import { useRovingTabindex } from "../hooks/index.ts";
6
+ import { Slot, composeEventHandlers, composeRefs } from "../Slot/index.ts";
6
7
 
7
8
  import { RadioGroupContext } from "./RadioGroupContext";
8
9
  import { RadioGroupItemContext } from "./RadioGroupItemContext";
@@ -10,7 +11,7 @@ import {
10
11
  useRadioGroupContext,
11
12
  useRadioGroupItemContext,
12
13
  useRadioGroupRoot,
13
- } from "./hooks";
14
+ } from "./hooks/index.ts";
14
15
  import {
15
16
  RadioGroupIndicatorProps,
16
17
  RadioGroupItemProps,
@@ -82,7 +83,7 @@ function RadioGroupRoot({
82
83
  asChild = false,
83
84
  children,
84
85
  ...rest
85
- }: RadioGroupRootProps) {
86
+ }: RadioGroupRootProps): ReactElement {
86
87
  const resolvedDir = dir ?? useDirection();
87
88
  const { value, select, registerItem, itemValues, disabledValues, focusItem } =
88
89
  useRadioGroupRoot({
@@ -172,7 +173,7 @@ function RadioGroupItem({
172
173
  asChild = false,
173
174
  ref,
174
175
  ...rest
175
- }: RadioGroupItemProps) {
176
+ }: RadioGroupItemProps): ReactElement {
176
177
  const {
177
178
  value: selectedValue,
178
179
  select,
@@ -282,7 +283,7 @@ function RadioGroupIndicator({
282
283
  forceMount,
283
284
  asChild = false,
284
285
  ...rest
285
- }: RadioGroupIndicatorProps) {
286
+ }: RadioGroupIndicatorProps): ReactElement | null {
286
287
  const { checked } = useRadioGroupItemContext();
287
288
  if (!checked && !forceMount) return null;
288
289
  const indicatorProps = {
@@ -1,4 +1,4 @@
1
- import { createStrictContext } from "../utils";
1
+ import { createStrictContext } from "../utils/index.ts";
2
2
 
3
3
  import { RadioGroupOrientation, RadioGroupReadingDirection } from "./types";
4
4
 
@@ -1,4 +1,4 @@
1
- import { createStrictContext } from "../utils";
1
+ import { createStrictContext } from "../utils/index.ts";
2
2
 
3
3
  export type RadioGroupItemContextValue = {
4
4
  checked: 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 { RadioGroup } from "../RadioGroup";
6
6
 
7
7
  describe("RadioGroup reading direction", () => {
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useMemo } from "react";
2
2
 
3
- import { useCollection, useControllableState } from "../../hooks";
3
+ import { useCollection, useControllableState } from "../../hooks/index.ts";
4
4
 
5
5
  type UseRadioGroupRootArgs = {
6
6
  defaultValue?: string;
@@ -1,7 +1,8 @@
1
1
  import { ChangeEvent, Children, isValidElement, ReactNode } from "react";
2
+ import type { ReactElement } from "react";
2
3
 
3
- import { useFieldProps } from "../Field/hooks";
4
- import { Slot } from "../Slot";
4
+ import { useFieldProps } from "../Field/hooks/index.ts";
5
+ import { Slot } from "../Slot/index.ts";
5
6
 
6
7
  import {
7
8
  SelectGroupProps,
@@ -59,7 +60,7 @@ function SelectRoot({
59
60
  value,
60
61
  defaultValue,
61
62
  ...consumer
62
- }: SelectRootProps) {
63
+ }: SelectRootProps): ReactElement {
63
64
  const merged = useFieldProps(consumer);
64
65
 
65
66
  const handleChange = (event: ChangeEvent<HTMLSelectElement>) => {
@@ -104,7 +105,7 @@ SelectRoot.displayName = "SelectRoot";
104
105
  * Native `<option>` only renders text; rich content (icons, descriptions)
105
106
  * is not supported.
106
107
  */
107
- function SelectOption({ children, ...rest }: SelectOptionProps) {
108
+ function SelectOption({ children, ...rest }: SelectOptionProps): ReactElement {
108
109
  return <option {...rest}>{children}</option>;
109
110
  }
110
111
 
@@ -115,7 +116,7 @@ SelectOption.displayName = "SelectOption";
115
116
  * native `<optgroup>` element. The `label` is shown by the browser as a
116
117
  * non-selectable heading and is announced as the group's accessible name.
117
118
  */
118
- function SelectGroup({ children, ...rest }: SelectGroupProps) {
119
+ function SelectGroup({ children, ...rest }: SelectGroupProps): ReactElement {
119
120
  return <optgroup {...rest}>{children}</optgroup>;
120
121
  }
121
122
 
@@ -131,7 +132,10 @@ SelectGroup.displayName = "SelectGroup";
131
132
  * Pair with `required` on {@link Select.Root} to make the browser's
132
133
  * native form validation catch an unchosen value at submission.
133
134
  */
134
- function SelectPlaceholder({ children, ...rest }: SelectPlaceholderProps) {
135
+ function SelectPlaceholder({
136
+ children,
137
+ ...rest
138
+ }: SelectPlaceholderProps): ReactElement {
135
139
  return (
136
140
  <option {...rest} value="" disabled hidden>
137
141
  {children}
@@ -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 { Select } from "../Select";
5
5
 
6
6
  function renderSelect(children?: React.ReactNode) {
@@ -1,3 +1,5 @@
1
+ import type { ReactElement } from "react";
2
+
1
3
  import { SkipNavContentProps, SkipNavLinkProps } from "./types";
2
4
 
3
5
  const DEFAULT_CONTENT_ID = "primitiv-skip-nav";
@@ -34,7 +36,7 @@ function SkipNavLink({
34
36
  children,
35
37
  contentId = DEFAULT_CONTENT_ID,
36
38
  ...rest
37
- }: SkipNavLinkProps) {
39
+ }: SkipNavLinkProps): ReactElement {
38
40
  return (
39
41
  <a href={`#${contentId}`} {...rest}>
40
42
  {children}
@@ -63,7 +65,10 @@ SkipNavLink.displayName = "SkipNavLink";
63
65
  * </SkipNav.Content>
64
66
  * ```
65
67
  */
66
- function SkipNavContent({ children, ...rest }: SkipNavContentProps) {
68
+ function SkipNavContent({
69
+ children,
70
+ ...rest
71
+ }: SkipNavContentProps): ReactElement {
67
72
  return (
68
73
  <div id={DEFAULT_CONTENT_ID} tabIndex={-1} {...rest}>
69
74
  {children}
@@ -1,4 +1,4 @@
1
- import { SkipNav } from "..";
1
+ import { SkipNav } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("SkipNav id wiring", () => {
@@ -1,8 +1,14 @@
1
- import { useDirection } from "../DirectionProvider";
2
- import { Slot, composeEventHandlers, composeRefs } from "../Slot";
1
+ import type { ReactElement } from "react";
2
+
3
+ import { useDirection } from "../DirectionProvider/index.ts";
4
+ import { Slot, composeEventHandlers, composeRefs } from "../Slot/index.ts";
3
5
 
4
6
  import { SliderContext } from "./SliderContext";
5
- import { useSliderContext, useSliderRoot, useSliderThumb } from "./hooks";
7
+ import {
8
+ useSliderContext,
9
+ useSliderRoot,
10
+ useSliderThumb,
11
+ } from "./hooks/index.ts";
6
12
  import type {
7
13
  SliderRangeProps,
8
14
  SliderRootProps,
@@ -87,7 +93,7 @@ function SliderRoot({
87
93
  ref,
88
94
  children,
89
95
  ...rest
90
- }: SliderRootProps) {
96
+ }: SliderRootProps): ReactElement {
91
97
  const resolvedDir = dir ?? useDirection();
92
98
  const {
93
99
  contextValue,
@@ -147,7 +153,11 @@ SliderRoot.displayName = "SliderRoot";
147
153
  *
148
154
  * @throws if rendered outside a `Slider.Root`.
149
155
  */
150
- function SliderTrack({ children, asChild = false, ...rest }: SliderTrackProps) {
156
+ function SliderTrack({
157
+ children,
158
+ asChild = false,
159
+ ...rest
160
+ }: SliderTrackProps): ReactElement {
151
161
  const { orientation, disabled } = useSliderContext();
152
162
  const trackProps = {
153
163
  ...rest,
@@ -178,7 +188,7 @@ function SliderRange({
178
188
  asChild = false,
179
189
  children,
180
190
  ...rest
181
- }: SliderRangeProps) {
191
+ }: SliderRangeProps): ReactElement {
182
192
  const { values, min, max, orientation, dir, inverted, disabled } =
183
193
  useSliderContext();
184
194
  const rangeProps = {
@@ -227,7 +237,7 @@ function SliderThumb({
227
237
  asChild = false,
228
238
  children,
229
239
  ...rest
230
- }: SliderThumbProps) {
240
+ }: SliderThumbProps): ReactElement {
231
241
  const {
232
242
  ref,
233
243
  value,
@@ -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 type { SliderDirection, SliderOrientation } from "./types";
4
5
 
@@ -17,8 +18,11 @@ export type SliderContextValue = {
17
18
  commit: (values: number[]) => void;
18
19
  };
19
20
 
20
- export const [SliderContext, useSliderContext] =
21
- createStrictContext<SliderContextValue>(
22
- "Slider sub-components must be rendered inside a <Slider.Root>.",
23
- "SliderContext",
24
- );
21
+ const sliderContextPair = createStrictContext<SliderContextValue>(
22
+ "Slider sub-components must be rendered inside a <Slider.Root>.",
23
+ "SliderContext",
24
+ );
25
+
26
+ export const SliderContext: Context<SliderContextValue | null> =
27
+ sliderContextPair[0];
28
+ export const useSliderContext: () => SliderContextValue = sliderContextPair[1];
@@ -1,7 +1,7 @@
1
1
  import { fireEvent, 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 { Slider } from "../Slider";
6
6
 
7
7
  import { rtlKeyboardCases } from "./Slider.fixtures";
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useEffect, useMemo, useRef } from "react";
2
2
  import type { PointerEvent as ReactPointerEvent } from "react";
3
3
 
4
- import { useCollection, useControllableState } from "../../hooks";
4
+ import { useCollection, useControllableState } from "../../hooks/index.ts";
5
5
  import type { SliderContextValue } from "../SliderContext";
6
6
  import type { SliderDirection, SliderOrientation } from "../types";
7
7
  import { clamp, getClosestThumbIndex, getPointerValue } from "../utils";
@@ -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 { StatusProps } from "./types";
3
5
 
4
6
  /**
@@ -31,7 +33,11 @@ import { StatusProps } from "./types";
31
33
  * </Status>
32
34
  * ```
33
35
  */
34
- export function Status({ asChild = false, children, ...rest }: StatusProps) {
36
+ export function Status({
37
+ asChild = false,
38
+ children,
39
+ ...rest
40
+ }: StatusProps): ReactElement {
35
41
  const rootProps = { role: "status", ...rest };
36
42
 
37
43
  if (asChild) {
@@ -1,4 +1,4 @@
1
- import { Status } from "..";
1
+ import { Status } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("Status component", () => {
@@ -1,9 +1,10 @@
1
1
  import { useMemo } from "react";
2
+ import type { ReactElement } from "react";
2
3
 
3
- import { Slot, composeEventHandlers } from "../Slot";
4
+ import { Slot, composeEventHandlers } from "../Slot/index.ts";
4
5
 
5
6
  import { SwitchContext } from "./SwitchContext";
6
- import { useSwitchContext, useSwitchRoot } from "./hooks";
7
+ import { useSwitchContext, useSwitchRoot } from "./hooks/index.ts";
7
8
  import { SwitchRootProps, SwitchThumbProps } from "./types";
8
9
 
9
10
  /**
@@ -58,7 +59,7 @@ function SwitchRoot({
58
59
  children,
59
60
  ref,
60
61
  ...rest
61
- }: SwitchRootProps) {
62
+ }: SwitchRootProps): ReactElement {
62
63
  const { checked: isChecked, toggle } = useSwitchRoot({
63
64
  defaultChecked,
64
65
  checked,
@@ -111,7 +112,11 @@ SwitchRoot.displayName = "SwitchRoot";
111
112
  *
112
113
  * @throws if rendered outside a `Switch.Root`.
113
114
  */
114
- function SwitchThumb({ children, asChild = false, ...rest }: SwitchThumbProps) {
115
+ function SwitchThumb({
116
+ children,
117
+ asChild = false,
118
+ ...rest
119
+ }: SwitchThumbProps): ReactElement {
115
120
  const { checked } = useSwitchContext();
116
121
  const thumbProps = {
117
122
  ...rest,
@@ -1,10 +1,14 @@
1
- import { createStrictContext } from "../utils";
1
+ import type { Context } from "react";
2
+ import { createStrictContext } from "../utils/index.ts";
2
3
 
3
4
  export type SwitchContextValue = {
4
5
  checked: boolean;
5
6
  };
6
7
 
7
- export const [SwitchContext, useSwitchContext] =
8
- createStrictContext<SwitchContextValue>(
9
- "Switch.Thumb must be rendered inside a <Switch.Root>.",
10
- );
8
+ const switchContextPair = createStrictContext<SwitchContextValue>(
9
+ "Switch.Thumb must be rendered inside a <Switch.Root>.",
10
+ );
11
+
12
+ export const SwitchContext: Context<SwitchContextValue | null> =
13
+ switchContextPair[0];
14
+ export const useSwitchContext: () => SwitchContextValue = switchContextPair[1];
@@ -1,6 +1,6 @@
1
1
  import { useCallback } from "react";
2
2
 
3
- import { useControllableState } from "../../hooks";
3
+ import { useControllableState } from "../../hooks/index.ts";
4
4
 
5
5
  type UseSwitchRootArgs = {
6
6
  defaultChecked?: boolean;
@@ -1,3 +1,5 @@
1
+ import type { ReactElement } from "react";
2
+
1
3
  import {
2
4
  TableBodyProps,
3
5
  TableCaptionProps,
@@ -40,7 +42,7 @@ import {
40
42
  * </Table.Root>
41
43
  * ```
42
44
  */
43
- function Table({ children, ...rest }: TableRootProps) {
45
+ function Table({ children, ...rest }: TableRootProps): ReactElement {
44
46
  return <table {...rest}>{children}</table>;
45
47
  }
46
48
 
@@ -63,7 +65,7 @@ Table.displayName = "Table";
63
65
  * </Table.Head>
64
66
  * ```
65
67
  */
66
- function TableHead({ children, ...rest }: TableHeadProps) {
68
+ function TableHead({ children, ...rest }: TableHeadProps): ReactElement {
67
69
  return <thead {...rest}>{children}</thead>;
68
70
  }
69
71
 
@@ -87,7 +89,7 @@ TableHead.displayName = "TableHead";
87
89
  * </Table.Body>
88
90
  * ```
89
91
  */
90
- function TableBody({ children, ...rest }: TableBodyProps) {
92
+ function TableBody({ children, ...rest }: TableBodyProps): ReactElement {
91
93
  return <tbody {...rest}>{children}</tbody>;
92
94
  }
93
95
 
@@ -110,7 +112,7 @@ TableBody.displayName = "TableBody";
110
112
  * </Table.Footer>
111
113
  * ```
112
114
  */
113
- function TableFooter({ children, ...rest }: TableFooterProps) {
115
+ function TableFooter({ children, ...rest }: TableFooterProps): ReactElement {
114
116
  return <tfoot {...rest}>{children}</tfoot>;
115
117
  }
116
118
 
@@ -132,7 +134,7 @@ TableFooter.displayName = "TableFooter";
132
134
  * </Table.Row>
133
135
  * ```
134
136
  */
135
- function TableRow({ children, ...rest }: TableRowProps) {
137
+ function TableRow({ children, ...rest }: TableRowProps): ReactElement {
136
138
  return <tr {...rest}>{children}</tr>;
137
139
  }
138
140
 
@@ -166,7 +168,7 @@ TableRow.displayName = "TableRow";
166
168
  * <Table.Header scope="row">Alice</Table.Header>
167
169
  * ```
168
170
  */
169
- function TableHeader({ children, ...rest }: TableHeaderProps) {
171
+ function TableHeader({ children, ...rest }: TableHeaderProps): ReactElement {
170
172
  return <th {...rest}>{children}</th>;
171
173
  }
172
174
 
@@ -188,7 +190,7 @@ TableHeader.displayName = "TableHeader";
188
190
  * <Table.Cell colSpan={2}>Full-width note</Table.Cell>
189
191
  * ```
190
192
  */
191
- function TableCell({ children, ...rest }: TableCellProps) {
193
+ function TableCell({ children, ...rest }: TableCellProps): ReactElement {
192
194
  return <td {...rest}>{children}</td>;
193
195
  }
194
196
 
@@ -222,7 +224,11 @@ TableCell.displayName = "TableCell";
222
224
  * </Table.ScrollArea>
223
225
  * ```
224
226
  */
225
- function TableScrollArea({ children, style, ...rest }: TableScrollAreaProps) {
227
+ function TableScrollArea({
228
+ children,
229
+ style,
230
+ ...rest
231
+ }: TableScrollAreaProps): ReactElement {
226
232
  return (
227
233
  <div
228
234
  style={{
@@ -277,7 +283,7 @@ function TableCaption({
277
283
  children,
278
284
  captionSide = "bottom",
279
285
  ...rest
280
- }: TableCaptionProps) {
286
+ }: TableCaptionProps): ReactElement {
281
287
  return (
282
288
  <caption style={{ captionSide }} {...rest}>
283
289
  {children}
@@ -1,4 +1,4 @@
1
- import { Table } from "..";
1
+ import { Table } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("Table.Body rendering", () => {
@@ -1,4 +1,4 @@
1
- import { Table } from "..";
1
+ import { Table } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("Table.Caption rendering", () => {
@@ -1,4 +1,4 @@
1
- import { Table } from "..";
1
+ import { Table } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("Table.Cell rendering", () => {
@@ -1,4 +1,4 @@
1
- import { Table } from "..";
1
+ import { Table } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("Table.Footer rendering", () => {
@@ -1,4 +1,4 @@
1
- import { Table } from "..";
1
+ import { Table } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("Table.Head rendering", () => {
@@ -1,4 +1,4 @@
1
- import { Table } from "..";
1
+ import { Table } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("Table.Header rendering", () => {
@@ -1,4 +1,4 @@
1
- import { Table } from "..";
1
+ import { Table } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("Table.Root rendering", () => {
@@ -1,4 +1,4 @@
1
- import { Table } from "..";
1
+ import { Table } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("Table.Row rendering", () => {
@@ -1,4 +1,4 @@
1
- import { Table } from "..";
1
+ import { Table } from "../index.ts";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
4
  describe("Table.ScrollArea rendering", () => {