@octanejs/aria 0.0.12 → 0.0.14

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/aria",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -46,10 +46,10 @@
46
46
  "clsx": "^2.1.1"
47
47
  },
48
48
  "peerDependencies": {
49
- "octane": "0.1.18"
49
+ "octane": "0.1.20"
50
50
  },
51
51
  "devDependencies": {
52
- "@tsrx/react": "^0.2.54",
52
+ "@tsrx/react": "^0.2.56",
53
53
  "esbuild": "^0.28.1",
54
54
  "react": "^19.2.7",
55
55
  "react-aria": "3.50.0",
@@ -57,7 +57,7 @@
57
57
  "react-dom": "^19.2.7",
58
58
  "react-stately": "3.48.0",
59
59
  "vitest": "^4.1.10",
60
- "octane": "0.1.18"
60
+ "octane": "0.1.20"
61
61
  },
62
62
  "scripts": {
63
63
  "test": "vitest run"
@@ -18,6 +18,7 @@ import {
18
18
  useContext,
19
19
  useMemo,
20
20
  useRef,
21
+ isChildrenBlock,
21
22
  useState,
22
23
  } from 'octane';
23
24
 
@@ -162,7 +163,7 @@ export const ComboBox: <T, M extends SelectionMode = 'single'>(
162
163
  createElement(ListBoxContext.Provider, {
163
164
  value: { items: props.items ?? props.defaultItems },
164
165
  children:
165
- typeof children === 'function'
166
+ typeof children === 'function' && !isChildrenBlock(children)
166
167
  ? children({
167
168
  isOpen: false,
168
169
  isDisabled,
@@ -15,6 +15,7 @@ import {
15
15
  useEffect,
16
16
  useMemo,
17
17
  useRef,
18
+ isChildrenBlock,
18
19
  useState,
19
20
  } from 'octane';
20
21
 
@@ -164,7 +165,9 @@ export function Popover(props: PopoverProps): any {
164
165
  // If we are in a hidden tree, we still need to preserve our children.
165
166
  if (isHidden) {
166
167
  let children = props.children;
167
- if (typeof children === 'function') {
168
+ // A `.tsrx` `@{ … }` body compiles children to a tagged BLOCK function,
169
+ // which is not a render prop; calling it here would throw.
170
+ if (typeof children === 'function' && !isChildrenBlock(children)) {
168
171
  children = children({
169
172
  trigger: props.trigger || null,
170
173
  placement: 'bottom',
@@ -13,7 +13,15 @@
13
13
  // RAC component needs the package dictionary). Hooks are hoisted out of argument object
14
14
  // literals per the binding convention; explicit dependency arrays are preserved verbatim.
15
15
  import type { Collection as ICollection, Node } from '@react-types/shared';
16
- import { Fragment, createContext, createElement, useContext, useMemo, useRef } from 'octane';
16
+ import {
17
+ Fragment,
18
+ createContext,
19
+ createElement,
20
+ useContext,
21
+ useMemo,
22
+ useRef,
23
+ isChildrenBlock,
24
+ } from 'octane';
17
25
 
18
26
  import { CollectionBuilder } from '../collections/CollectionBuilder';
19
27
  import { createHideableComponent } from '../collections/Hidden';
@@ -187,7 +195,7 @@ export const Select: <T, M extends SelectionMode = 'single'>(
187
195
  let { children, isDisabled = false, isInvalid = false, isRequired = false } = props;
188
196
  let content = useMemo(
189
197
  () =>
190
- typeof children === 'function'
198
+ typeof children === 'function' && !isChildrenBlock(children)
191
199
  ? children({
192
200
  isOpen: false,
193
201
  isDisabled,
@@ -20,7 +20,15 @@ import type {
20
20
  Orientation,
21
21
  PressEvents,
22
22
  } from '@react-types/shared';
23
- import { createContext, createElement, useContext, useMemo, useRef, useState } from 'octane';
23
+ import {
24
+ createContext,
25
+ createElement,
26
+ isChildrenBlock,
27
+ useContext,
28
+ useMemo,
29
+ useRef,
30
+ useState,
31
+ } from 'octane';
24
32
 
25
33
  import { CollectionNode } from '../collections/BaseCollection';
26
34
  import { CollectionBuilder, createLeafComponent } from '../collections/CollectionBuilder';
@@ -250,7 +258,12 @@ export function Tabs(props: TabsProps): any {
250
258
  let { children, orientation = 'horizontal' } = props;
251
259
  children = useMemo(
252
260
  () =>
253
- typeof children === 'function' ? children({ orientation, defaultChildren: null }) : children,
261
+ // A `.tsrx` `@{ … }` body compiles children to a tagged BLOCK function,
262
+ // which is not the render prop upstream expects here — calling it with
263
+ // render values instead of a scope throws.
264
+ typeof children === 'function' && !isChildrenBlock(children)
265
+ ? children({ orientation, defaultChildren: null })
266
+ : children,
254
267
  [children, orientation],
255
268
  subSlot(slot, 'children'),
256
269
  );
@@ -297,6 +297,11 @@ export type { DragAndDropHooks, DragAndDropOptions } from './useDragAndDrop';
297
297
  // re-exports from the hooks surface, as upstream's index does
298
298
  export { VisuallyHidden } from '../visually-hidden/VisuallyHidden';
299
299
  export type { VisuallyHiddenProps } from '../visually-hidden/VisuallyHidden';
300
+ // Upstream RAC's Focusable.d.ts is literally `export { Focusable } from
301
+ // 'react-aria/Focusable'` — the same component the hooks surface already
302
+ // exports, published under both entry points.
303
+ export { Focusable } from '../interactions/useFocusable';
304
+ export type { FocusableProps } from '../interactions/useFocusable';
300
305
  export type { Placement } from '../overlays/useOverlayPosition';
301
306
  export { useFilter } from '../i18n/useFilter';
302
307
  export type { Filter } from '../i18n/useFilter';
@@ -10,7 +10,7 @@
10
10
  // hook from `../utils/useSlot`; React's CSSProperties/ReactNode/JSX-intrinsics types → minimal
11
11
  // structural aliases (`E extends string`); explicit dep arrays are preserved verbatim.
12
12
  import type { AriaLabelingProps, DOMProps as SharedDOMProps } from '@react-types/shared';
13
- import { type Context, createElement, useContext, useMemo, useRef } from 'octane';
13
+ import { type Context, createElement, isChildrenBlock, useContext, useMemo, useRef } from 'octane';
14
14
 
15
15
  import { S, splitSlot, subSlot } from '../internal';
16
16
  import { type MergableRef, mergeRefs } from '../utils/mergeRefs';
@@ -246,7 +246,13 @@ export function useRenderProps(...args: any[]): RenderPropsHookRetVal<any, any>
246
246
  computedStyle = style;
247
247
  }
248
248
 
249
- if (typeof children === 'function') {
249
+ // A `.tsrx` component authored with `@{ … }` compiles its children to a
250
+ // BLOCK FUNCTION, which the compiler tags via markChildrenBlock. Upstream
251
+ // only ever sees a render prop here, so a bare typeof check would invoke
252
+ // that block with render values instead of a scope and crash — the
253
+ // idiomatic authoring form for every RAC component. Same guard the
254
+ // base-ui binding uses for its own render props.
255
+ if (typeof children === 'function' && !isChildrenBlock(children)) {
250
256
  computedChildren = children({ ...values, defaultChildren });
251
257
  } else if (children == null) {
252
258
  computedChildren = defaultChildren;
@@ -277,7 +283,15 @@ export function composeRenderProps<T, U, V extends T>(
277
283
  wrap: (prevValue: T, renderProps: U) => V,
278
284
  ): (renderProps: U) => V {
279
285
  return (renderProps) =>
280
- wrap(typeof value === 'function' ? (value as any)(renderProps) : value, renderProps);
286
+ wrap(
287
+ // Same guard as useRenderProps: a `.tsrx` component authored with
288
+ // `@{ … }` compiles its children to a tagged BLOCK function, which is
289
+ // not a render prop. Calling it with render values instead of a scope
290
+ // throws, and this helper is how components forward their own children
291
+ // (e.g. shadcn's Checkbox wrapping its indicator around them).
292
+ typeof value === 'function' && !isChildrenBlock(value) ? (value as any)(renderProps) : value,
293
+ renderProps,
294
+ );
281
295
  }
282
296
 
283
297
  export type WithRef<T, E> = T & { ref?: MergableRef<E> };