@ankhorage/zora 27.3.6 → 27.3.7

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 (93) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/features/content-rail/adapters/inbound/ContentRail.d.ts.map +1 -1
  4. package/dist/features/content-rail/adapters/inbound/ContentRail.js.map +1 -1
  5. package/dist/features/form/radio/adapters/inbound/RadioGroup.d.ts.map +1 -1
  6. package/dist/features/form/radio/adapters/inbound/RadioGroup.js +20 -3
  7. package/dist/features/form/radio/adapters/inbound/RadioGroup.js.map +1 -1
  8. package/dist/features/form/radio/adapters/inbound/RadioOptionControl.d.ts +4 -0
  9. package/dist/features/form/radio/adapters/inbound/RadioOptionControl.d.ts.map +1 -1
  10. package/dist/features/form/radio/adapters/inbound/RadioOptionControl.js +4 -4
  11. package/dist/features/form/radio/adapters/inbound/RadioOptionControl.js.map +1 -1
  12. package/dist/features/form/radio/utils/handleRadioOptionKeyDown.d.ts +2 -12
  13. package/dist/features/form/radio/utils/handleRadioOptionKeyDown.d.ts.map +1 -1
  14. package/dist/features/form/radio/utils/handleRadioOptionKeyDown.js +8 -15
  15. package/dist/features/form/radio/utils/handleRadioOptionKeyDown.js.map +1 -1
  16. package/dist/features/game/adapters/inbound/GameEntity.d.ts.map +1 -1
  17. package/dist/features/game/adapters/inbound/GameEntity.js.map +1 -1
  18. package/dist/features/game/adapters/inbound/GameInputZone.js +7 -1
  19. package/dist/features/game/adapters/inbound/GameInputZone.js.map +1 -1
  20. package/dist/features/game/utils/measureGameEntity.d.ts +2 -1
  21. package/dist/features/game/utils/measureGameEntity.d.ts.map +1 -1
  22. package/dist/features/game/utils/measureGameEntity.js.map +1 -1
  23. package/dist/features/game/utils/useGameEntityMeasurement.d.ts +2 -1
  24. package/dist/features/game/utils/useGameEntityMeasurement.d.ts.map +1 -1
  25. package/dist/features/game/utils/useGameEntityMeasurement.js.map +1 -1
  26. package/dist/features/grid-interactions/adapters/inbound/GridInteractions.d.ts.map +1 -1
  27. package/dist/features/grid-interactions/adapters/inbound/GridInteractions.js.map +1 -1
  28. package/dist/features/grid-view/adapters/inbound/GridView.d.ts.map +1 -1
  29. package/dist/features/grid-view/adapters/inbound/GridView.js.map +1 -1
  30. package/dist/features/list/adapters/inbound/FlatList.js +1 -1
  31. package/dist/features/list/adapters/inbound/FlatList.js.map +1 -1
  32. package/dist/features/list/adapters/inbound/SectionList.js +1 -1
  33. package/dist/features/list/adapters/inbound/SectionList.js.map +1 -1
  34. package/dist/features/list/adapters/inbound/useListVisibility.d.ts +5 -2
  35. package/dist/features/list/adapters/inbound/useListVisibility.d.ts.map +1 -1
  36. package/dist/features/list/adapters/inbound/useListVisibility.js +1 -1
  37. package/dist/features/list/adapters/inbound/useListVisibility.js.map +1 -1
  38. package/dist/features/reader/composition/useReaderController.js +7 -2
  39. package/dist/features/reader/composition/useReaderController.js.map +1 -1
  40. package/dist/types/activity-indicator.d.ts +1 -1
  41. package/dist/types/activity-indicator.d.ts.map +1 -1
  42. package/dist/types/activity-indicator.js.map +1 -1
  43. package/dist/types/layout.d.ts +1 -1
  44. package/dist/types/layout.d.ts.map +1 -1
  45. package/dist/types/layout.js.map +1 -1
  46. package/dist/types/react-native.d.ts +6 -0
  47. package/dist/types/react-native.d.ts.map +1 -0
  48. package/dist/types/react-native.js +2 -0
  49. package/dist/types/react-native.js.map +1 -0
  50. package/package.json +1 -1
  51. package/src/features/content-rail/adapters/inbound/ContentRail.tsx +2 -1
  52. package/src/features/form/radio/adapters/inbound/RadioGroup.tsx +40 -2
  53. package/src/features/form/radio/adapters/inbound/RadioOptionControl.tsx +28 -7
  54. package/src/features/form/radio/utils/handleRadioOptionKeyDown.test.ts +16 -34
  55. package/src/features/form/radio/utils/handleRadioOptionKeyDown.ts +10 -28
  56. package/src/features/game/adapters/inbound/GameEntity.tsx +4 -2
  57. package/src/features/game/adapters/inbound/GameInputZone.tsx +14 -1
  58. package/src/features/game/utils/measureGameEntity.ts +2 -1
  59. package/src/features/game/utils/useGameEntityMeasurement.ts +2 -1
  60. package/src/features/grid-interactions/adapters/inbound/GridInteractions.tsx +2 -1
  61. package/src/features/grid-view/adapters/inbound/GridView.tsx +6 -3
  62. package/src/features/list/adapters/inbound/FlatList.tsx +3 -3
  63. package/src/features/list/adapters/inbound/SectionList.tsx +3 -3
  64. package/src/features/list/adapters/inbound/useListVisibility.ts +7 -3
  65. package/src/features/reader/composition/useReaderController.ts +8 -1
  66. package/src/types/activity-indicator.ts +1 -1
  67. package/src/types/layout.ts +1 -1
  68. package/src/types/react-native.ts +9 -0
  69. package/web-dist/chunks/{Accordion-19k3xdzb.js → Accordion-25xjvp3t.js} +7 -1
  70. package/web-dist/chunks/{Accordion-9a3a3nbw.js → Accordion-c1x8bqnr.js} +41 -17
  71. package/web-dist/chunks/{Accordion-cdyywh25.js → Accordion-vyr0wyp9.js} +7 -7
  72. package/web-dist/chunks/{Accordion-x8r4nhae.js → Accordion-x3shxr1k.js} +1 -1
  73. package/web-dist/components/data-table/DataTable.js +2 -2
  74. package/web-dist/components/flat-list/FlatList.js +1 -1
  75. package/web-dist/components/game/Game.js +1 -1
  76. package/web-dist/components/game-entity/GameEntity.js +1 -1
  77. package/web-dist/components/game-field/GameField.js +1 -1
  78. package/web-dist/components/game-input-zone/GameInputZone.js +1 -1
  79. package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +1 -1
  80. package/web-dist/components/game-overlay/GameOverlay.js +1 -1
  81. package/web-dist/components/list/List.js +1 -1
  82. package/web-dist/components/list-item/ListItem.js +1 -1
  83. package/web-dist/components/list-section/ListSection.js +1 -1
  84. package/web-dist/components/radio/Radio.js +1 -1
  85. package/web-dist/components/radio-group/RadioGroup.js +1 -1
  86. package/web-dist/components/reader/Reader.js +7 -3
  87. package/web-dist/components/section-list/SectionList.js +1 -1
  88. package/web-dist/components/skeleton/Skeleton.js +2 -2
  89. package/web-dist/components/skeleton-card/SkeletonCard.js +2 -2
  90. package/web-dist/components/skeleton-list/SkeletonList.js +2 -2
  91. package/web-dist/components/skeleton-text/SkeletonText.js +2 -2
  92. package/web-dist/components/tree-item/TreeItem.js +1 -1
  93. package/web-dist/manifest.json +24 -24
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 27.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 251c24b: Correct native component-ref type contracts while retaining the supported Expo 57 peer contract.
8
+
3
9
  ## 27.3.6
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # ZORA
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v27.3.6](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v27.3.7](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
7
7
 
8
8
  Provides opinionated React Native and React Native Web UI components, theme primitives, registries, and reader surfaces built on @ankhorage/surface.
9
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"ContentRail.d.ts","sourceRoot":"","sources":["../../../../../src/features/content-rail/adapters/inbound/ContentRail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,gCAAgC,CAAC;AAWxC;;;;;GAKG;AACH,eAAO,MAAM,WAAW,wDAAuC,CAAC"}
1
+ {"version":3,"file":"ContentRail.d.ts","sourceRoot":"","sources":["../../../../../src/features/content-rail/adapters/inbound/ContentRail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,gCAAgC,CAAC;AAYxC;;;;;GAKG;AACH,eAAO,MAAM,WAAW,wDAAuC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContentRail.js","sourceRoot":"","sources":["../../../../../src/features/content-rail/adapters/inbound/ContentRail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,WAAW,EAGX,UAAU,GAEX,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AAEhE,6DAA6D;AAC7D,SAAS,gBAAgB,CAAC,KAAuB;IAC/C,OAAO,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CACpC,CAAC,eAAe,CA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AAO,CAAC,CAAC,CAAC;IACpC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,EAAE,CAAC;IACtC,OAAO,OAAO,CAAC,CAAC,CAAC;AACnB,CAAC","sourcesContent":["import React from 'react';\nimport {\n I18nManager,\n type NativeScrollEvent,\n type NativeSyntheticEvent,\n ScrollView,\n type ViewStyle,\n} from 'react-native';\n\nimport type {\n ContentRailProps,\n ContentRailVisibleRangeChangeEvent,\n} from '../../../../types/content-rail';\nimport { IconButton } from '../../../button/public';\nimport { View } from '../../../layout/public';\nimport { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';\nimport { useZoraTheme } from '../../../theme/composition/useZoraTheme';\nimport { Text } from '../../../typography/public';\nimport { resolveContentRailItemWidth } from '../../utils/resolveContentRailItemWidth';\nimport { resolveContentRailPhysicalOffset } from '../../utils/resolveContentRailPhysicalOffset';\nimport { resolveContentRailState } from '../../utils/resolveContentRailState';\nimport { useContentRailReducedMotion } from '../../utils/useContentRailReducedMotion';\nimport { ContentRailFlow } from './ContentRailFlow';\n/**\n * Horizontally browsable, manifest-authorable content with responsive item sizing.\n *\n * ContentRail owns only presentation and scrolling. Apps retain ownership of item data,\n * navigation, recommendations, and route behavior.\n */\nexport const ContentRail = withZoraThemeScope(ContentRailInner);\n\n/*** Selects intrinsic scrolling or sized item navigation. */\nfunction ContentRailInner(props: ContentRailProps) {\n return props.itemSize === 'content' ? (\n <ContentRailFlow {...props} />\n ) : (\n <ContentRailCarousel {...props} />\n );\n}\n\n/*** Renders equal-width cards with responsive sizing and accessible previous/next controls. */\nfunction ContentRailCarousel({\n themeId: _themeId,\n mode: _mode,\n interactionPolicy,\n children,\n itemSize = 'responsive',\n gap = 'm',\n padding = 'm',\n peek = 32,\n showControls = true,\n bounces,\n showsScrollIndicator = false,\n direction = 'auto',\n motion = 'system',\n accessibilityLabel = 'Content rail',\n previousLabel = 'Previous items',\n nextLabel = 'Next items',\n onControlPress,\n onVisibleRangeChange,\n testID,\n}: ContentRailProps) {\n const { theme } = useZoraTheme();\n const items = React.Children.toArray(children);\n const scrollViewRef = React.useRef<ScrollView>(null);\n const lastRangeRef = React.useRef<ContentRailVisibleRangeChangeEvent | null>(null);\n const logicalOffsetRef = React.useRef(0);\n const rtlInitializedRef = React.useRef(false);\n const [viewportWidth, setViewportWidth] = React.useState(0);\n const [contentWidth, setContentWidth] = React.useState(0);\n const [logicalOffset, setLogicalOffset] = React.useState(0);\n const reducedMotion = useContentRailReducedMotion(motion);\n const isRtl = direction === 'rtl' || (direction === 'auto' && I18nManager.isRTL);\n const gapValue = resolveSpacingValue(theme.spacing, gap);\n const paddingValue = resolveSpacingValue(theme.spacing, padding);\n const itemWidth = resolveContentRailItemWidth({\n gap: gapValue,\n itemCount: items.length,\n itemSize,\n padding: paddingValue,\n peek,\n viewportWidth,\n });\n const railState = resolveContentRailState({\n contentWidth,\n gap: gapValue,\n itemCount: items.length,\n itemWidth,\n logicalOffset,\n viewportWidth,\n });\n const passive = interactionPolicy === 'passive';\n const hasOverflow = railState.maxOffset > 1;\n\n const emitVisibleRange = React.useCallback(\n (nextOffset: number) => {\n const next = resolveContentRailState({\n contentWidth,\n gap: gapValue,\n itemCount: items.length,\n itemWidth,\n logicalOffset: nextOffset,\n viewportWidth,\n });\n const event = {\n firstVisibleIndex: next.firstVisibleIndex,\n lastVisibleIndex: next.lastVisibleIndex,\n itemCount: items.length,\n };\n const previous = lastRangeRef.current;\n if (\n previous?.firstVisibleIndex === event.firstVisibleIndex &&\n previous.lastVisibleIndex === event.lastVisibleIndex &&\n previous.itemCount === event.itemCount\n ) {\n return;\n }\n lastRangeRef.current = event;\n void onVisibleRangeChange?.(event);\n },\n [contentWidth, gapValue, itemWidth, items.length, onVisibleRangeChange, viewportWidth],\n );\n\n React.useEffect(() => {\n emitVisibleRange(railState.offset);\n }, [emitVisibleRange, railState.offset]);\n\n React.useEffect(() => {\n rtlInitializedRef.current = !isRtl;\n }, [isRtl]);\n\n React.useEffect(() => {\n if (viewportWidth === 0 || contentWidth === 0) return;\n const nextOffset = Math.min(logicalOffsetRef.current, railState.maxOffset);\n scrollViewRef.current?.scrollTo({\n animated: false,\n x: resolveContentRailPhysicalOffset({\n isRtl,\n logicalOffset: nextOffset,\n maxOffset: railState.maxOffset,\n }),\n y: 0,\n });\n rtlInitializedRef.current = true;\n }, [contentWidth, isRtl, itemWidth, railState.maxOffset, viewportWidth]);\n\n const scrollToIndex = (targetIndex: number, controlDirection: 'previous' | 'next') => {\n if (passive || !hasOverflow) return;\n const clampedIndex = Math.min(Math.max(0, targetIndex), Math.max(0, items.length - 1));\n const targetOffset = Math.min(clampedIndex * railState.stride, railState.maxOffset);\n logicalOffsetRef.current = targetOffset;\n setLogicalOffset(targetOffset);\n scrollViewRef.current?.scrollTo({\n animated: !reducedMotion,\n x: resolveContentRailPhysicalOffset({\n isRtl,\n logicalOffset: targetOffset,\n maxOffset: railState.maxOffset,\n }),\n y: 0,\n });\n emitVisibleRange(targetOffset);\n void onControlPress?.({ direction: controlDirection, targetIndex: clampedIndex });\n };\n\n const handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n if (isRtl && !rtlInitializedRef.current) return;\n const physicalOffset = event.nativeEvent.contentOffset.x;\n const nextOffset = resolveContentRailPhysicalOffset({\n isRtl,\n logicalOffset: physicalOffset,\n maxOffset: railState.maxOffset,\n });\n const clampedOffset = Math.min(Math.max(0, nextOffset), railState.maxOffset);\n logicalOffsetRef.current = clampedOffset;\n setLogicalOffset(clampedOffset);\n emitVisibleRange(clampedOffset);\n };\n\n const rangeLabel =\n items.length === 0\n ? 'No items'\n : `Items ${railState.firstVisibleIndex + 1}–${railState.lastVisibleIndex + 1} of ${items.length}`;\n const contentStyle: ViewStyle = {\n direction: isRtl ? 'rtl' : 'ltr',\n flexDirection: 'row',\n gap: gapValue,\n paddingHorizontal: paddingValue,\n };\n\n return (\n <View gap=\"s\" testID={testID}>\n {showControls && hasOverflow ? (\n <View direction=\"row\" justify=\"space-between\" wrap=\"nowrap\">\n <Text accessibilityLiveRegion=\"polite\" emphasis=\"muted\" variant=\"caption\">\n {rangeLabel}\n </Text>\n <View direction=\"row\" gap=\"xs\" wrap=\"nowrap\">\n <IconButton\n disabled={passive || !railState.canGoPrevious}\n icon={{ name: isRtl ? 'chevron-forward' : 'chevron-back' }}\n interactionPolicy={interactionPolicy}\n label={previousLabel}\n onPress={() => scrollToIndex(railState.anchorIndex - 1, 'previous')}\n size=\"l\"\n />\n <IconButton\n disabled={passive || !railState.canGoNext}\n icon={{ name: isRtl ? 'chevron-back' : 'chevron-forward' }}\n interactionPolicy={interactionPolicy}\n label={nextLabel}\n onPress={() => scrollToIndex(railState.anchorIndex + 1, 'next')}\n size=\"l\"\n />\n </View>\n </View>\n ) : null}\n <ScrollView\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"list\"\n contentContainerStyle={contentStyle}\n decelerationRate=\"fast\"\n disableIntervalMomentum\n horizontal\n onContentSizeChange={(width) => {\n if (isRtl) rtlInitializedRef.current = false;\n setContentWidth(width);\n }}\n onLayout={(event) => {\n if (isRtl) rtlInitializedRef.current = false;\n setViewportWidth(event.nativeEvent.layout.width);\n }}\n onScroll={handleScroll}\n ref={scrollViewRef}\n scrollEnabled={!passive}\n scrollEventThrottle={16}\n bounces={bounces}\n showsHorizontalScrollIndicator={showsScrollIndicator}\n snapToInterval={itemWidth > 0 ? itemWidth + gapValue : undefined}\n >\n {items.map((item, index) => (\n <View key={index} style={{ flexShrink: 0, width: itemWidth || undefined }}>\n {item}\n </View>\n ))}\n </ScrollView>\n </View>\n );\n}\n\nfunction resolveSpacingValue(\n spacing: { none: number; xs: number; s: number; m: number; l: number; xl: number },\n token: NonNullable<ContentRailProps['gap']>,\n): number {\n if (token === 'none') return spacing.none;\n if (token === 'xs') return spacing.xs;\n if (token === 's') return spacing.s;\n if (token === 'l') return spacing.l;\n if (token === 'xl') return spacing.xl;\n return spacing.m;\n}\n"]}
1
+ {"version":3,"file":"ContentR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C,CAAC,OAAO,CAAC,CACxB,mBAAmB,CAAC,CAAC,EAAE,CAAC,CACxB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,8BAA8B,CAAC,CAAC,oBAAoB,CAAC,CACrD,cAAc,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAEjE;QAAA,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,IAAI,SAAS,EAAE,CAAC,CACxE;YAAA,CAAC,IAAI,CACP;UAAA,EAAE,IAAI,CAAC,CACR,CAAC,CACJ;MAAA,EAAE,UAAU,CACd;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,OAAkF,EAClF,KAA2C;IAE3C,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC;IAC1C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,EAAE,CAAC;IACtC,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,OAAO,CAAC,CAAC,CAAC;IACpC,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,OAAO,CAAC,CAAC,CAAC;IACpC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,EAAE,CAAC;IACtC,OAAO,OAAO,CAAC,CAAC,CAAC;AACnB,CAAC","sourcesContent":["import React from 'react';\nimport {\n I18nManager,\n type NativeScrollEvent,\n type NativeSyntheticEvent,\n ScrollView,\n type ViewStyle,\n} from 'react-native';\n\nimport type {\n ContentRailProps,\n ContentRailVisibleRangeChangeEvent,\n} from '../../../../types/content-rail';\nimport type { ReactNativeComponentInstance } from '../../../../types/react-native';\nimport { IconButton } from '../../../button/public';\nimport { View } from '../../../layout/public';\nimport { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';\nimport { useZoraTheme } from '../../../theme/composition/useZoraTheme';\nimport { Text } from '../../../typography/public';\nimport { resolveContentRailItemWidth } from '../../utils/resolveContentRailItemWidth';\nimport { resolveContentRailPhysicalOffset } from '../../utils/resolveContentRailPhysicalOffset';\nimport { resolveContentRailState } from '../../utils/resolveContentRailState';\nimport { useContentRailReducedMotion } from '../../utils/useContentRailReducedMotion';\nimport { ContentRailFlow } from './ContentRailFlow';\n/**\n * Horizontally browsable, manifest-authorable content with responsive item sizing.\n *\n * ContentRail owns only presentation and scrolling. Apps retain ownership of item data,\n * navigation, recommendations, and route behavior.\n */\nexport const ContentRail = withZoraThemeScope(ContentRailInner);\n\n/*** Selects intrinsic scrolling or sized item navigation. */\nfunction ContentRailInner(props: ContentRailProps) {\n return props.itemSize === 'content' ? (\n <ContentRailFlow {...props} />\n ) : (\n <ContentRailCarousel {...props} />\n );\n}\n\n/*** Renders equal-width cards with responsive sizing and accessible previous/next controls. */\nfunction ContentRailCarousel({\n themeId: _themeId,\n mode: _mode,\n interactionPolicy,\n children,\n itemSize = 'responsive',\n gap = 'm',\n padding = 'm',\n peek = 32,\n showControls = true,\n bounces,\n showsScrollIndicator = false,\n direction = 'auto',\n motion = 'system',\n accessibilityLabel = 'Content rail',\n previousLabel = 'Previous items',\n nextLabel = 'Next items',\n onControlPress,\n onVisibleRangeChange,\n testID,\n}: ContentRailProps) {\n const { theme } = useZoraTheme();\n const items = React.Children.toArray(children);\n const scrollViewRef = React.useRef<ReactNativeComponentInstance<typeof ScrollView>>(null);\n const lastRangeRef = React.useRef<ContentRailVisibleRangeChangeEvent | null>(null);\n const logicalOffsetRef = React.useRef(0);\n const rtlInitializedRef = React.useRef(false);\n const [viewportWidth, setViewportWidth] = React.useState(0);\n const [contentWidth, setContentWidth] = React.useState(0);\n const [logicalOffset, setLogicalOffset] = React.useState(0);\n const reducedMotion = useContentRailReducedMotion(motion);\n const isRtl = direction === 'rtl' || (direction === 'auto' && I18nManager.isRTL);\n const gapValue = resolveSpacingValue(theme.spacing, gap);\n const paddingValue = resolveSpacingValue(theme.spacing, padding);\n const itemWidth = resolveContentRailItemWidth({\n gap: gapValue,\n itemCount: items.length,\n itemSize,\n padding: paddingValue,\n peek,\n viewportWidth,\n });\n const railState = resolveContentRailState({\n contentWidth,\n gap: gapValue,\n itemCount: items.length,\n itemWidth,\n logicalOffset,\n viewportWidth,\n });\n const passive = interactionPolicy === 'passive';\n const hasOverflow = railState.maxOffset > 1;\n\n const emitVisibleRange = React.useCallback(\n (nextOffset: number) => {\n const next = resolveContentRailState({\n contentWidth,\n gap: gapValue,\n itemCount: items.length,\n itemWidth,\n logicalOffset: nextOffset,\n viewportWidth,\n });\n const event = {\n firstVisibleIndex: next.firstVisibleIndex,\n lastVisibleIndex: next.lastVisibleIndex,\n itemCount: items.length,\n };\n const previous = lastRangeRef.current;\n if (\n previous?.firstVisibleIndex === event.firstVisibleIndex &&\n previous.lastVisibleIndex === event.lastVisibleIndex &&\n previous.itemCount === event.itemCount\n ) {\n return;\n }\n lastRangeRef.current = event;\n void onVisibleRangeChange?.(event);\n },\n [contentWidth, gapValue, itemWidth, items.length, onVisibleRangeChange, viewportWidth],\n );\n\n React.useEffect(() => {\n emitVisibleRange(railState.offset);\n }, [emitVisibleRange, railState.offset]);\n\n React.useEffect(() => {\n rtlInitializedRef.current = !isRtl;\n }, [isRtl]);\n\n React.useEffect(() => {\n if (viewportWidth === 0 || contentWidth === 0) return;\n const nextOffset = Math.min(logicalOffsetRef.current, railState.maxOffset);\n scrollViewRef.current?.scrollTo({\n animated: false,\n x: resolveContentRailPhysicalOffset({\n isRtl,\n logicalOffset: nextOffset,\n maxOffset: railState.maxOffset,\n }),\n y: 0,\n });\n rtlInitializedRef.current = true;\n }, [contentWidth, isRtl, itemWidth, railState.maxOffset, viewportWidth]);\n\n const scrollToIndex = (targetIndex: number, controlDirection: 'previous' | 'next') => {\n if (passive || !hasOverflow) return;\n const clampedIndex = Math.min(Math.max(0, targetIndex), Math.max(0, items.length - 1));\n const targetOffset = Math.min(clampedIndex * railState.stride, railState.maxOffset);\n logicalOffsetRef.current = targetOffset;\n setLogicalOffset(targetOffset);\n scrollViewRef.current?.scrollTo({\n animated: !reducedMotion,\n x: resolveContentRailPhysicalOffset({\n isRtl,\n logicalOffset: targetOffset,\n maxOffset: railState.maxOffset,\n }),\n y: 0,\n });\n emitVisibleRange(targetOffset);\n void onControlPress?.({ direction: controlDirection, targetIndex: clampedIndex });\n };\n\n const handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n if (isRtl && !rtlInitializedRef.current) return;\n const physicalOffset = event.nativeEvent.contentOffset.x;\n const nextOffset = resolveContentRailPhysicalOffset({\n isRtl,\n logicalOffset: physicalOffset,\n maxOffset: railState.maxOffset,\n });\n const clampedOffset = Math.min(Math.max(0, nextOffset), railState.maxOffset);\n logicalOffsetRef.current = clampedOffset;\n setLogicalOffset(clampedOffset);\n emitVisibleRange(clampedOffset);\n };\n\n const rangeLabel =\n items.length === 0\n ? 'No items'\n : `Items ${railState.firstVisibleIndex + 1}–${railState.lastVisibleIndex + 1} of ${items.length}`;\n const contentStyle: ViewStyle = {\n direction: isRtl ? 'rtl' : 'ltr',\n flexDirection: 'row',\n gap: gapValue,\n paddingHorizontal: paddingValue,\n };\n\n return (\n <View gap=\"s\" testID={testID}>\n {showControls && hasOverflow ? (\n <View direction=\"row\" justify=\"space-between\" wrap=\"nowrap\">\n <Text accessibilityLiveRegion=\"polite\" emphasis=\"muted\" variant=\"caption\">\n {rangeLabel}\n </Text>\n <View direction=\"row\" gap=\"xs\" wrap=\"nowrap\">\n <IconButton\n disabled={passive || !railState.canGoPrevious}\n icon={{ name: isRtl ? 'chevron-forward' : 'chevron-back' }}\n interactionPolicy={interactionPolicy}\n label={previousLabel}\n onPress={() => scrollToIndex(railState.anchorIndex - 1, 'previous')}\n size=\"l\"\n />\n <IconButton\n disabled={passive || !railState.canGoNext}\n icon={{ name: isRtl ? 'chevron-back' : 'chevron-forward' }}\n interactionPolicy={interactionPolicy}\n label={nextLabel}\n onPress={() => scrollToIndex(railState.anchorIndex + 1, 'next')}\n size=\"l\"\n />\n </View>\n </View>\n ) : null}\n <ScrollView\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"list\"\n contentContainerStyle={contentStyle}\n decelerationRate=\"fast\"\n disableIntervalMomentum\n horizontal\n onContentSizeChange={(width) => {\n if (isRtl) rtlInitializedRef.current = false;\n setContentWidth(width);\n }}\n onLayout={(event) => {\n if (isRtl) rtlInitializedRef.current = false;\n setViewportWidth(event.nativeEvent.layout.width);\n }}\n onScroll={handleScroll}\n ref={scrollViewRef}\n scrollEnabled={!passive}\n scrollEventThrottle={16}\n bounces={bounces}\n showsHorizontalScrollIndicator={showsScrollIndicator}\n snapToInterval={itemWidth > 0 ? itemWidth + gapValue : undefined}\n >\n {items.map((item, index) => (\n <View key={index} style={{ flexShrink: 0, width: itemWidth || undefined }}>\n {item}\n </View>\n ))}\n </ScrollView>\n </View>\n );\n}\n\nfunction resolveSpacingValue(\n spacing: { none: number; xs: number; s: number; m: number; l: number; xl: number },\n token: NonNullable<ContentRailProps['gap']>,\n): number {\n if (token === 'none') return spacing.none;\n if (token === 'xs') return spacing.xs;\n if (token === 's') return spacing.s;\n if (token === 'l') return spacing.l;\n if (token === 'xl') return spacing.xl;\n return spacing.m;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/RadioGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AASlE,0FAA0F;AAC1F,eAAO,MAAM,UAAU,GAGE,MAAM,SAAS,MAAM,8DAHe,CAAC"}
1
+ {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/RadioGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAUlE,0FAA0F;AAC1F,eAAO,MAAM,UAAU,GAGE,MAAM,SAAS,MAAM,8DAHe,CAAC"}
@@ -13,11 +13,28 @@ export const RadioGroup = withZoraThemeScope(RadioGroupInner);
13
13
  /*** Resolve shared presentation once and preserve a single interaction boundary per option. */
14
14
  function RadioGroupInner({ themeId: _themeId, mode: _mode, ...props }) {
15
15
  const [localValue, setLocalValue] = React.useState(props.defaultValue);
16
+ const cardOptionRefs = React.useRef(new Map());
16
17
  const onValueChange = (next) => {
17
18
  if (props.value === undefined)
18
19
  setLocalValue(next);
19
20
  props.onValueChange?.(next);
20
21
  };
22
+ const onNavigateCardOption = (currentValue, direction) => {
23
+ const currentIndex = props.options.findIndex((option) => option.value === currentValue);
24
+ if (currentIndex < 0)
25
+ return;
26
+ const nextOption = Array.from({ length: props.options.length - 1 }, (_, offset) => props.options.at((currentIndex + direction * (offset + 1) + props.options.length) % props.options.length)).find((option) => option !== undefined && !props.disabled && !option.disabled);
27
+ if (nextOption === undefined)
28
+ return;
29
+ onValueChange(nextOption.value);
30
+ cardOptionRefs.current.get(nextOption.value)?.focus();
31
+ };
32
+ const onCardOptionRef = (value, element) => {
33
+ if (element === null)
34
+ cardOptionRefs.current.delete(value);
35
+ else
36
+ cardOptionRefs.current.set(value, element);
37
+ };
21
38
  const selectedProps = { ...props, value: props.value ?? localValue, onValueChange };
22
39
  const themeFields = useZoraThemeRecipe(radioGroupThemeRecipeMeta);
23
40
  const recipe = resolveRadioGroupThemeRecipe({ ...props, themeFields });
@@ -29,7 +46,7 @@ function RadioGroupInner({ themeId: _themeId, mode: _mode, ...props }) {
29
46
  <View gap={recipe.gap}>
30
47
  {rows.map((options, index) => (<View key={index} direction="row" gap={recipe.gap}>
31
48
  {options.map((option) => (<View key={option.value} style={styles.option}>
32
- <RadioGroupItem {...selectedProps} {...recipe} option={option}/>
49
+ <RadioGroupItem {...selectedProps} {...recipe} onNavigate={onNavigateCardOption} onOptionRef={onCardOptionRef} option={option}/>
33
50
  </View>))}
34
51
  {Array.from({ length: columns - options.length }, (_, slot) => (<View key={`empty-${slot}`} style={styles.option}/>))}
35
52
  </View>))}
@@ -46,7 +63,7 @@ function RadioGroupInline(props) {
46
63
  }
47
64
  /*** Delegate icon options to their composed radio boundary and ordinary options to Surface Radio. */
48
65
  function RadioGroupItem(props) {
49
- const { option, value, onValueChange, interactionPolicy, color, size } = props;
66
+ const { option, value, onValueChange, interactionPolicy, color, size, onNavigate, onOptionRef } = props;
50
67
  const checked = value === option.value;
51
68
  const inactive = props.disabled === true || option.disabled === true;
52
69
  const readOnly = props.readOnly === true;
@@ -56,7 +73,7 @@ function RadioGroupItem(props) {
56
73
  onValueChange?.(option.value);
57
74
  };
58
75
  if (props.presentation === 'card') {
59
- return (<RadioOptionControl {...props} checked={checked} disabled={inactive} readOnly={readOnly} invalid={invalid} layout={props.contentOrientation ?? 'horizontal'} onSelect={onSelect}/>);
76
+ return (<RadioOptionControl {...props} checked={checked} disabled={inactive} readOnly={readOnly} invalid={invalid} layout={props.contentOrientation ?? 'horizontal'} onNavigate={(direction) => onNavigate?.(option.value, direction)} onOptionRef={(element) => onOptionRef?.(option.value, element)} onSelect={onSelect}/>);
60
77
  }
61
78
  return (<Radio checked={checked} disabled={inactive} readOnly={readOnly} invalid={invalid} interactionPolicy={interactionPolicy} color={color} size={size} testID={option.testID} onCheckedChange={onSelect}>
62
79
  <View gap="xs">
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AA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b,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CACtB,eAAe,CAAC,CAAC,QAAQ,CAAC,CAE1B;MAAA,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CACZ;QAAA,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAC1B;QAAA,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CACtC;YAAA,CAAC,MAAM,CAAC,WAAW,CACrB;UAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import { Radio } from '@ankhorage/surface';\nimport React from 'react';\nimport { StyleSheet } from 'react-native';\n\nimport type { RadioGroupProps } from '../../../../../types/radio';\nimport { View } from '../../../../layout/public';\nimport { withZoraThemeScope } from '../../../../theme/adapters/inbound/withZoraThemeScope';\nimport { useZoraThemeRecipe } from '../../../../theme/composition/useZoraThemeRecipe';\nimport { Text } from '../../../../typography/public';\nimport { radioGroupThemeRecipeMeta } from '../../themeRecipeMeta';\nimport { resolveRadioGroupThemeRecipe } from '../../utils/resolveRadioGroupThemeRecipe';\nimport { RadioOptionControl } from './RadioOptionControl';\n\n/*** Present one controlled single-choice group as inline radios or icon radio options. */\nexport const RadioGroup = withZoraThemeScope(RadioGroupInner);\n\n/*** Resolve shared presentation once and preserve a single interaction boundary per option. */\nfunction RadioGroupInner<TValue extends string>({\n themeId: _themeId,\n mode: _mode,\n ...props\n}: RadioGroupProps<TValue>) {\n const [localValue, setLocalValue] = React.useState(props.defaultValue);\n const onValueChange = (next: TValue) => {\n if (props.value === undefined) setLocalValue(next);\n props.onValueChange?.(next);\n };\n const selectedProps = { ...props, value: props.value ?? localValue, onValueChange };\n const themeFields = useZoraThemeRecipe(radioGroupThemeRecipeMeta);\n const recipe = resolveRadioGroupThemeRecipe({ ...props, themeFields });\n if (props.presentation !== 'card') return <RadioGroupInline {...selectedProps} {...recipe} />;\n const columns =\n props.columns ?? (props.orientation === 'horizontal' ? Math.max(1, props.options.length) : 1);\n const rows = Array.from({ length: Math.ceil(props.options.length / columns) }, (_, index) =>\n props.options.slice(index * columns, (index + 1) * columns),\n );\n return (\n <View testID={props.testID} accessibilityRole=\"radiogroup\">\n <View gap={recipe.gap}>\n {rows.map((options, index) => (\n <View key={index} direction=\"row\" gap={recipe.gap}>\n {options.map((option) => (\n <View key={option.value} style={styles.option}>\n <RadioGroupItem {...selectedProps} {...recipe} option={option} />\n </View>\n ))}\n {Array.from({ length: columns - options.length }, (_, slot) => (\n <View key={`empty-${slot}`} style={styles.option} />\n ))}\n </View>\n ))}\n </View>\n </View>\n );\n}\n\n/*** Preserve ordinary radio wrapping independently of the icon-option grid. */\nfunction RadioGroupInline<TValue extends string>(props: RadioGroupProps<TValue>) {\n return (\n <View testID={props.testID} accessibilityRole=\"radiogroup\">\n <View\n direction={props.orientation === 'horizontal' ? 'row' : 'column'}\n gap={props.gap}\n wrap=\"wrap\"\n >\n {props.options.map((option) => (\n <RadioGroupItem key={option.value} {...props} option={option} />\n ))}\n </View>\n </View>\n );\n}\n\n/*** Delegate icon options to their composed radio boundary and ordinary options to Surface Radio. */\nfunction RadioGroupItem<TValue extends string>(\n props: RadioGroupProps<TValue> & {\n option: RadioGroupProps<TValue>['options'][number];\n },\n) {\n const { option, value, onValueChange, interactionPolicy, color, size } = props;\n const checked = value === option.value;\n const inactive = props.disabled === true || option.disabled === true;\n const readOnly = props.readOnly === true;\n const invalid = props.invalid === true;\n const onSelect = () => {\n if (!inactive && !readOnly && interactionPolicy !== 'passive' && !checked)\n onValueChange?.(option.value);\n };\n if (props.presentation === 'card') {\n return (\n <RadioOptionControl\n {...props}\n checked={checked}\n disabled={inactive}\n readOnly={readOnly}\n invalid={invalid}\n layout={props.contentOrientation ?? 'horizontal'}\n onSelect={onSelect}\n />\n );\n }\n return (\n <Radio\n checked={checked}\n disabled={inactive}\n readOnly={readOnly}\n invalid={invalid}\n interactionPolicy={interactionPolicy}\n color={color}\n size={size}\n testID={option.testID}\n onCheckedChange={onSelect}\n >\n <View gap=\"xs\">\n <Text>{option.label}</Text>\n {option.description ? (\n <Text emphasis=\"muted\" variant=\"caption\">\n {option.description}\n </Text>\n ) : null}\n </View>\n </Radio>\n );\n}\n\nconst styles = StyleSheet.create({ option: { flex: 1, minWidth: 0 } });\n"]}
1
+ {"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,0FAA0F;AAC1F,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAE9D,+FAA+F;AAC/F,SAAS,e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,IAAI,CAC1B;QAAA,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CACtC;YAAA,CAAC,MAAM,CAAC,WAAW,CACrB;UAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import { Radio } from '@ankhorage/surface';\nimport React from 'react';\nimport type { Pressable } from 'react-native';\nimport { StyleSheet } from 'react-native';\n\nimport type { RadioGroupProps } from '../../../../../types/radio';\nimport type { ReactNativeComponentInstance } from '../../../../../types/react-native';\nimport { View } from '../../../../layout/public';\nimport { withZoraThemeScope } from '../../../../theme/adapters/inbound/withZoraThemeScope';\nimport { useZoraThemeRecipe } from '../../../../theme/composition/useZoraThemeRecipe';\nimport { Text } from '../../../../typography/public';\nimport { radioGroupThemeRecipeMeta } from '../../themeRecipeMeta';\nimport { resolveRadioGroupThemeRecipe } from '../../utils/resolveRadioGroupThemeRecipe';\nimport { RadioOptionControl } from './RadioOptionControl';\n\n/*** Present one controlled single-choice group as inline radios or icon radio options. */\nexport const RadioGroup = withZoraThemeScope(RadioGroupInner);\n\n/*** Resolve shared presentation once and preserve a single interaction boundary per option. */\nfunction RadioGroupInner<TValue extends string>({\n themeId: _themeId,\n mode: _mode,\n ...props\n}: RadioGroupProps<TValue>) {\n const [localValue, setLocalValue] = React.useState(props.defaultValue);\n const cardOptionRefs = React.useRef<Map<TValue, ReactNativeComponentInstance<typeof Pressable>>>(\n new Map(),\n );\n const onValueChange = (next: TValue) => {\n if (props.value === undefined) setLocalValue(next);\n props.onValueChange?.(next);\n };\n const onNavigateCardOption = (currentValue: TValue, direction: -1 | 1) => {\n const currentIndex = props.options.findIndex((option) => option.value === currentValue);\n if (currentIndex < 0) return;\n const nextOption = Array.from({ length: props.options.length - 1 }, (_, offset) =>\n props.options.at(\n (currentIndex + direction * (offset + 1) + props.options.length) % props.options.length,\n ),\n ).find((option) => option !== undefined && !props.disabled && !option.disabled);\n if (nextOption === undefined) return;\n onValueChange(nextOption.value);\n cardOptionRefs.current.get(nextOption.value)?.focus();\n };\n const onCardOptionRef = (\n value: TValue,\n element: ReactNativeComponentInstance<typeof Pressable> | null,\n ) => {\n if (element === null) cardOptionRefs.current.delete(value);\n else cardOptionRefs.current.set(value, element);\n };\n const selectedProps = { ...props, value: props.value ?? localValue, onValueChange };\n const themeFields = useZoraThemeRecipe(radioGroupThemeRecipeMeta);\n const recipe = resolveRadioGroupThemeRecipe({ ...props, themeFields });\n if (props.presentation !== 'card') return <RadioGroupInline {...selectedProps} {...recipe} />;\n const columns =\n props.columns ?? (props.orientation === 'horizontal' ? Math.max(1, props.options.length) : 1);\n const rows = Array.from({ length: Math.ceil(props.options.length / columns) }, (_, index) =>\n props.options.slice(index * columns, (index + 1) * columns),\n );\n return (\n <View testID={props.testID} accessibilityRole=\"radiogroup\">\n <View gap={recipe.gap}>\n {rows.map((options, index) => (\n <View key={index} direction=\"row\" gap={recipe.gap}>\n {options.map((option) => (\n <View key={option.value} style={styles.option}>\n <RadioGroupItem\n {...selectedProps}\n {...recipe}\n onNavigate={onNavigateCardOption}\n onOptionRef={onCardOptionRef}\n option={option}\n />\n </View>\n ))}\n {Array.from({ length: columns - options.length }, (_, slot) => (\n <View key={`empty-${slot}`} style={styles.option} />\n ))}\n </View>\n ))}\n </View>\n </View>\n );\n}\n\n/*** Preserve ordinary radio wrapping independently of the icon-option grid. */\nfunction RadioGroupInline<TValue extends string>(props: RadioGroupProps<TValue>) {\n return (\n <View testID={props.testID} accessibilityRole=\"radiogroup\">\n <View\n direction={props.orientation === 'horizontal' ? 'row' : 'column'}\n gap={props.gap}\n wrap=\"wrap\"\n >\n {props.options.map((option) => (\n <RadioGroupItem key={option.value} {...props} option={option} />\n ))}\n </View>\n </View>\n );\n}\n\n/*** Delegate icon options to their composed radio boundary and ordinary options to Surface Radio. */\nfunction RadioGroupItem<TValue extends string>(\n props: RadioGroupProps<TValue> & {\n onNavigate?: (currentValue: TValue, direction: -1 | 1) => void;\n onOptionRef?: (\n value: TValue,\n element: ReactNativeComponentInstance<typeof Pressable> | null,\n ) => void;\n option: RadioGroupProps<TValue>['options'][number];\n },\n) {\n const { option, value, onValueChange, interactionPolicy, color, size, onNavigate, onOptionRef } =\n props;\n const checked = value === option.value;\n const inactive = props.disabled === true || option.disabled === true;\n const readOnly = props.readOnly === true;\n const invalid = props.invalid === true;\n const onSelect = () => {\n if (!inactive && !readOnly && interactionPolicy !== 'passive' && !checked)\n onValueChange?.(option.value);\n };\n if (props.presentation === 'card') {\n return (\n <RadioOptionControl\n {...props}\n checked={checked}\n disabled={inactive}\n readOnly={readOnly}\n invalid={invalid}\n layout={props.contentOrientation ?? 'horizontal'}\n onNavigate={(direction) => onNavigate?.(option.value, direction)}\n onOptionRef={(element) => onOptionRef?.(option.value, element)}\n onSelect={onSelect}\n />\n );\n }\n return (\n <Radio\n checked={checked}\n disabled={inactive}\n readOnly={readOnly}\n invalid={invalid}\n interactionPolicy={interactionPolicy}\n color={color}\n size={size}\n testID={option.testID}\n onCheckedChange={onSelect}\n >\n <View gap=\"xs\">\n <Text>{option.label}</Text>\n {option.description ? (\n <Text emphasis=\"muted\" variant=\"caption\">\n {option.description}\n </Text>\n ) : null}\n </View>\n </Radio>\n );\n}\n\nconst styles = StyleSheet.create({ option: { flex: 1, minWidth: 0 } });\n"]}
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
+ import { Pressable } from 'react-native';
2
3
  import type { RadioGroupProps } from '../../../../../types/radio';
4
+ import type { ReactNativeComponentInstance } from '../../../../../types/react-native';
3
5
  /*** Render a selectable icon radio option with one accessible radio target and a trailing check. */
4
6
  export declare function RadioOptionControl<TValue extends string>(props: RadioOptionControlProps<TValue>): React.JSX.Element;
5
7
  interface RadioOptionControlProps<TValue extends string> extends Pick<RadioGroupProps<TValue>, 'color' | 'size' | 'interactionPolicy'> {
@@ -9,6 +11,8 @@ interface RadioOptionControlProps<TValue extends string> extends Pick<RadioGroup
9
11
  readOnly: boolean;
10
12
  invalid: boolean;
11
13
  layout: 'horizontal' | 'vertical';
14
+ onNavigate: (direction: -1 | 1) => void;
15
+ onOptionRef: (element: ReactNativeComponentInstance<typeof Pressable> | null) => void;
12
16
  onSelect: () => void;
13
17
  }
14
18
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"RadioOptionControl.d.ts","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/RadioOptionControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AASlE,oGAAoG;AACpG,wBAAgB,kBAAkB,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC,qBAuC/F;AAqCD,UAAU,uBAAuB,CAAC,MAAM,SAAS,MAAM,CAAE,SAAQ,IAAI,CACnE,eAAe,CAAC,MAAM,CAAC,EACvB,OAAO,GAAG,MAAM,GAAG,mBAAmB,CACvC;IACC,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,YAAY,GAAG,UAAU,CAAC;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB"}
1
+ {"version":3,"file":"RadioOptionControl.d.ts","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/RadioOptionControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAY,SAAS,EAAoB,MAAM,cAAc,CAAC;AAErE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAMtF,oGAAoG;AACpG,wBAAgB,kBAAkB,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC,qBAsD/F;AAqCD,UAAU,uBAAuB,CAAC,MAAM,SAAS,MAAM,CAAE,SAAQ,IAAI,CACnE,eAAe,CAAC,MAAM,CAAC,EACvB,OAAO,GAAG,MAAM,GAAG,mBAAmB,CACvC;IACC,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,YAAY,GAAG,UAAU,CAAC;IAClC,UAAU,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;IACxC,WAAW,EAAE,CAAC,OAAO,EAAE,4BAA4B,CAAC,OAAO,SAAS,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACtF,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB"}
@@ -3,17 +3,17 @@ import React from 'react';
3
3
  import { Platform, Pressable, StyleSheet, View } from 'react-native';
4
4
  import { Icon } from '../../../../icon/public';
5
5
  import { Text } from '../../../../typography/public';
6
- import { handleRadioOptionKeyDown, } from '../../utils/handleRadioOptionKeyDown';
6
+ import { handleRadioOptionKeyDown } from '../../utils/handleRadioOptionKeyDown';
7
7
  import { resolveRadioOptionColors } from '../../utils/resolveRadioOptionColors';
8
8
  /*** Render a selectable icon radio option with one accessible radio target and a trailing check. */
9
9
  export function RadioOptionControl(props) {
10
10
  const { theme } = useTheme();
11
- const { option, checked, disabled, readOnly, interactionPolicy, onSelect } = props;
11
+ const { option, checked, disabled, readOnly, interactionPolicy, onNavigate, onOptionRef, onSelect, } = props;
12
12
  const colors = resolveRadioOptionColors(theme, props);
13
13
  const [focused, setFocused] = React.useState(false);
14
14
  const keyboardProps = Platform.OS === 'web' && !readOnly && !disabled && interactionPolicy !== 'passive'
15
15
  ? {
16
- onKeyDown: (event) => handleRadioOptionKeyDown(event, onSelect),
16
+ onKeyDown: (event) => handleRadioOptionKeyDown(event.nativeEvent?.key ?? event.key ?? '', () => event.preventDefault(), onSelect, onNavigate),
17
17
  }
18
18
  : {};
19
19
  const controlStyle = {
@@ -25,7 +25,7 @@ export function RadioOptionControl(props) {
25
25
  borderRadius: theme.radii.l,
26
26
  backgroundColor: colors.surface,
27
27
  };
28
- return (<Pressable {...keyboardProps} accessibilityRole="radio" accessibilityState={{ checked, disabled }} aria-checked={checked} aria-disabled={disabled} aria-readonly={readOnly} disabled={disabled} onPress={readOnly || interactionPolicy === 'passive' ? undefined : onSelect} onFocus={() => setFocused(true)} onBlur={() => setFocused(false)} testID={option.testID} style={controlStyle}>
28
+ return (<Pressable {...keyboardProps} ref={onOptionRef} accessibilityRole="radio" accessibilityState={{ checked, disabled }} aria-checked={checked} aria-disabled={disabled} aria-readonly={readOnly} disabled={disabled} onPress={readOnly || interactionPolicy === 'passive' ? undefined : onSelect} onFocus={() => setFocused(true)} onBlur={() => setFocused(false)} testID={option.testID} style={controlStyle}>
29
29
  {(state) => <RadioOptionControlBody {...props} pressed={state.pressed}/>}
30
30
  </Pressable>);
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RadioOptionControl.js","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/RadioOptionControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ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R,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE;IAC1C,UAAU,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE;IAC1D,QAAQ,EAAE;QACR,aAAa,EAAE,QAAQ;QACvB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,EAAE;KACf;IACD,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;IACvC,WAAW,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE;IAC7C,MAAM,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;IAClD,SAAS,EAAE;QACT,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,EAAE;QACV,gBAAgB,EAAE,GAAG;QACrB,iBAAiB,EAAE,GAAG;QACtB,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC;KACrD;CACF,CAAC,CAAC","sourcesContent":["import { useTheme } from '@ankhorage/surface';\nimport React from 'react';\nimport { Platform, Pressable, StyleSheet, View } from 'react-native';\n\nimport type { RadioGroupProps } from '../../../../../types/radio';\nimport { Icon } from '../../../../icon/public';\nimport { Text } from '../../../../typography/public';\nimport {\n handleRadioOptionKeyDown,\n type RadioOptionKeyboardTarget,\n} from '../../utils/handleRadioOptionKeyDown';\nimport { resolveRadioOptionColors } from '../../utils/resolveRadioOptionColors';\n\n/*** Render a selectable icon radio option with one accessible radio target and a trailing check. */\nexport function RadioOptionControl<TValue extends string>(props: RadioOptionControlProps<TValue>) {\n const { theme } = useTheme();\n const { option, checked, disabled, readOnly, interactionPolicy, onSelect } = props;\n const colors = resolveRadioOptionColors(theme, props);\n const [focused, setFocused] = React.useState(false);\n const keyboardProps =\n Platform.OS === 'web' && !readOnly && !disabled && interactionPolicy !== 'passive'\n ? {\n onKeyDown: (event: React.KeyboardEvent<RadioOptionKeyboardTarget>) =>\n handleRadioOptionKeyDown(event, onSelect),\n }\n : {};\n const controlStyle = {\n flex: 1,\n width: '100%' as const,\n minHeight: props.size === 'l' ? 84 : 44,\n borderWidth: checked || focused ? 2 : 1,\n borderColor: focused ? theme.semantics.border.focus : checked ? colors.accent : colors.border,\n borderRadius: theme.radii.l,\n backgroundColor: colors.surface,\n };\n return (\n <Pressable\n {...keyboardProps}\n accessibilityRole=\"radio\"\n accessibilityState={{ checked, disabled }}\n aria-checked={checked}\n aria-disabled={disabled}\n aria-readonly={readOnly}\n disabled={disabled}\n onPress={readOnly || interactionPolicy === 'passive' ? undefined : onSelect}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n testID={option.testID}\n style={controlStyle}\n >\n {(state) => <RadioOptionControlBody {...props} pressed={state.pressed} />}\n </Pressable>\n );\n}\n\n/*** Arrange the icon, label and passive indicator within the native radio press target. */\nfunction RadioOptionControlBody<TValue extends string>(\n props: RadioOptionControlProps<TValue> & { pressed: boolean },\n) {\n const { theme } = useTheme();\n const colors = resolveRadioOptionColors(theme, props);\n const contentStyle = {\n padding: props.size === 's' ? theme.spacing.s : props.size === 'm' ? 12 : theme.spacing.m,\n gap:\n props.layout === 'vertical' || !props.option.iconSource ? theme.spacing.s : theme.spacing.m,\n ...(!props.option.iconSource ? { flexDirection: 'row-reverse' as const } : {}),\n opacity: props.disabled ? 0.5 : props.pressed ? 0.7 : 1,\n };\n return (\n <View\n style={[\n styles.content,\n props.layout === 'vertical' ? styles.vertical : styles.horizontal,\n contentStyle,\n ]}\n >\n <RadioOptionControlContent {...props} />\n {props.option.iconSource || props.checked ? (\n <View style={props.layout === 'vertical' ? styles.corner : undefined}>\n <RadioOptionControlIndicator\n checked={props.checked}\n accent={colors.accent}\n onAccent={colors.onAccent}\n />\n </View>\n ) : null}\n </View>\n );\n}\n\ninterface RadioOptionControlProps<TValue extends string> extends Pick<\n RadioGroupProps<TValue>,\n 'color' | 'size' | 'interactionPolicy'\n> {\n option: RadioGroupProps<TValue>['options'][number];\n checked: boolean;\n disabled: boolean;\n readOnly: boolean;\n invalid: boolean;\n layout: 'horizontal' | 'vertical';\n onSelect: () => void;\n}\n\n/*** Keep decoration passive while allowing labels to wrap at narrow widths and large text sizes. */\nfunction RadioOptionControlContent<TValue extends string>({\n option,\n layout,\n size,\n color,\n invalid,\n disabled,\n}: RadioOptionControlProps<TValue>) {\n const { theme } = useTheme();\n const colors = resolveRadioOptionColors(theme, { color, invalid, disabled });\n return (\n <>\n {option.iconSource ? (\n <View accessibilityElementsHidden importantForAccessibility=\"no-hide-descendants\">\n <Icon source={option.iconSource} size={size === 'l' ? 36 : 28} color={colors.accent} />\n </View>\n ) : null}\n <View style={layout === 'horizontal' ? styles.label : styles.centerLabel}>\n <Text\n variant={size === 'l' ? 'body' : 'bodySmall'}\n weight=\"semiBold\"\n align={layout === 'vertical' || !option.iconSource ? 'center' : 'left'}\n >\n {option.label}\n </Text>\n {option.description ? (\n <Text\n emphasis=\"muted\"\n variant=\"bodySmall\"\n align={layout === 'vertical' || !option.iconSource ? 'center' : 'left'}\n >\n {option.description}\n </Text>\n ) : null}\n </View>\n </>\n );\n}\n\n/*** Draw a passive check using themed geometry without requiring an application media asset. */\nfunction RadioOptionControlIndicator({\n checked,\n accent,\n onAccent,\n}: {\n checked: boolean;\n accent: string;\n onAccent: string;\n}) {\n const indicatorStyle = { backgroundColor: checked ? accent : 'transparent' };\n return (\n <View\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n style={[styles.indicator, indicatorStyle]}\n >\n {checked ? <View style={[styles.check, { borderColor: onAccent }]} /> : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n content: { gap: 16, flex: 1, minWidth: 0 },\n horizontal: { flexDirection: 'row', alignItems: 'center' },\n vertical: {\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n paddingTop: 24,\n },\n label: { flex: 1, minWidth: 0, gap: 4 },\n centerLabel: { alignSelf: 'stretch', gap: 4 },\n corner: { position: 'absolute', right: 8, top: 8 },\n indicator: {\n width: 24,\n height: 24,\n borderRadius: 12,\n alignItems: 'center',\n justifyContent: 'center',\n },\n check: {\n width: 7,\n height: 12,\n borderRightWidth: 2.5,\n borderBottomWidth: 2.5,\n transform: [{ rotate: '45deg' }, { translateY: -2 }],\n },\n});\n"]}
1
+ {"version":3,"file":"RadioOptionControl.js","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/RadioOptionControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIrE,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,oGAAoG;AACpG,MAAM,UAAU,kBAAkB,CAAwB,KAAsC;IAC9F,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,EACJ,MAAM,EACN,OAAO,EACP,QAAQ,EACR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AE;KACf;IACD,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;IACvC,WAAW,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE;IAC7C,MAAM,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;IAClD,SAAS,EAAE;QACT,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,EAAE;QACV,gBAAgB,EAAE,GAAG;QACrB,iBAAiB,EAAE,GAAG;QACtB,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC;KACrD;CACF,CAAC,CAAC","sourcesContent":["import { useTheme } from '@ankhorage/surface';\nimport React from 'react';\nimport { Platform, Pressable, StyleSheet, View } from 'react-native';\n\nimport type { RadioGroupProps } from '../../../../../types/radio';\nimport type { ReactNativeComponentInstance } from '../../../../../types/react-native';\nimport { Icon } from '../../../../icon/public';\nimport { Text } from '../../../../typography/public';\nimport { handleRadioOptionKeyDown } from '../../utils/handleRadioOptionKeyDown';\nimport { resolveRadioOptionColors } from '../../utils/resolveRadioOptionColors';\n\n/*** Render a selectable icon radio option with one accessible radio target and a trailing check. */\nexport function RadioOptionControl<TValue extends string>(props: RadioOptionControlProps<TValue>) {\n const { theme } = useTheme();\n const {\n option,\n checked,\n disabled,\n readOnly,\n interactionPolicy,\n onNavigate,\n onOptionRef,\n onSelect,\n } = props;\n const colors = resolveRadioOptionColors(theme, props);\n const [focused, setFocused] = React.useState(false);\n const keyboardProps =\n Platform.OS === 'web' && !readOnly && !disabled && interactionPolicy !== 'passive'\n ? {\n onKeyDown: (event: RadioOptionKeyboardEvent) =>\n handleRadioOptionKeyDown(\n event.nativeEvent?.key ?? event.key ?? '',\n () => event.preventDefault(),\n onSelect,\n onNavigate,\n ),\n }\n : {};\n const controlStyle = {\n flex: 1,\n width: '100%' as const,\n minHeight: props.size === 'l' ? 84 : 44,\n borderWidth: checked || focused ? 2 : 1,\n borderColor: focused ? theme.semantics.border.focus : checked ? colors.accent : colors.border,\n borderRadius: theme.radii.l,\n backgroundColor: colors.surface,\n };\n return (\n <Pressable\n {...keyboardProps}\n ref={onOptionRef}\n accessibilityRole=\"radio\"\n accessibilityState={{ checked, disabled }}\n aria-checked={checked}\n aria-disabled={disabled}\n aria-readonly={readOnly}\n disabled={disabled}\n onPress={readOnly || interactionPolicy === 'passive' ? undefined : onSelect}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n testID={option.testID}\n style={controlStyle}\n >\n {(state) => <RadioOptionControlBody {...props} pressed={state.pressed} />}\n </Pressable>\n );\n}\n\n/*** Arrange the icon, label and passive indicator within the native radio press target. */\nfunction RadioOptionControlBody<TValue extends string>(\n props: RadioOptionControlProps<TValue> & { pressed: boolean },\n) {\n const { theme } = useTheme();\n const colors = resolveRadioOptionColors(theme, props);\n const contentStyle = {\n padding: props.size === 's' ? theme.spacing.s : props.size === 'm' ? 12 : theme.spacing.m,\n gap:\n props.layout === 'vertical' || !props.option.iconSource ? theme.spacing.s : theme.spacing.m,\n ...(!props.option.iconSource ? { flexDirection: 'row-reverse' as const } : {}),\n opacity: props.disabled ? 0.5 : props.pressed ? 0.7 : 1,\n };\n return (\n <View\n style={[\n styles.content,\n props.layout === 'vertical' ? styles.vertical : styles.horizontal,\n contentStyle,\n ]}\n >\n <RadioOptionControlContent {...props} />\n {props.option.iconSource || props.checked ? (\n <View style={props.layout === 'vertical' ? styles.corner : undefined}>\n <RadioOptionControlIndicator\n checked={props.checked}\n accent={colors.accent}\n onAccent={colors.onAccent}\n />\n </View>\n ) : null}\n </View>\n );\n}\n\ninterface RadioOptionControlProps<TValue extends string> extends Pick<\n RadioGroupProps<TValue>,\n 'color' | 'size' | 'interactionPolicy'\n> {\n option: RadioGroupProps<TValue>['options'][number];\n checked: boolean;\n disabled: boolean;\n readOnly: boolean;\n invalid: boolean;\n layout: 'horizontal' | 'vertical';\n onNavigate: (direction: -1 | 1) => void;\n onOptionRef: (element: ReactNativeComponentInstance<typeof Pressable> | null) => void;\n onSelect: () => void;\n}\n\ninterface RadioOptionKeyboardEvent {\n readonly key?: string;\n readonly nativeEvent?: { readonly key?: string };\n preventDefault(): void;\n}\n\n/*** Keep decoration passive while allowing labels to wrap at narrow widths and large text sizes. */\nfunction RadioOptionControlContent<TValue extends string>({\n option,\n layout,\n size,\n color,\n invalid,\n disabled,\n}: RadioOptionControlProps<TValue>) {\n const { theme } = useTheme();\n const colors = resolveRadioOptionColors(theme, { color, invalid, disabled });\n return (\n <>\n {option.iconSource ? (\n <View accessibilityElementsHidden importantForAccessibility=\"no-hide-descendants\">\n <Icon source={option.iconSource} size={size === 'l' ? 36 : 28} color={colors.accent} />\n </View>\n ) : null}\n <View style={layout === 'horizontal' ? styles.label : styles.centerLabel}>\n <Text\n variant={size === 'l' ? 'body' : 'bodySmall'}\n weight=\"semiBold\"\n align={layout === 'vertical' || !option.iconSource ? 'center' : 'left'}\n >\n {option.label}\n </Text>\n {option.description ? (\n <Text\n emphasis=\"muted\"\n variant=\"bodySmall\"\n align={layout === 'vertical' || !option.iconSource ? 'center' : 'left'}\n >\n {option.description}\n </Text>\n ) : null}\n </View>\n </>\n );\n}\n\n/*** Draw a passive check using themed geometry without requiring an application media asset. */\nfunction RadioOptionControlIndicator({\n checked,\n accent,\n onAccent,\n}: {\n checked: boolean;\n accent: string;\n onAccent: string;\n}) {\n const indicatorStyle = { backgroundColor: checked ? accent : 'transparent' };\n return (\n <View\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n style={[styles.indicator, indicatorStyle]}\n >\n {checked ? <View style={[styles.check, { borderColor: onAccent }]} /> : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n content: { gap: 16, flex: 1, minWidth: 0 },\n horizontal: { flexDirection: 'row', alignItems: 'center' },\n vertical: {\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n paddingTop: 24,\n },\n label: { flex: 1, minWidth: 0, gap: 4 },\n centerLabel: { alignSelf: 'stretch', gap: 4 },\n corner: { position: 'absolute', right: 8, top: 8 },\n indicator: {\n width: 24,\n height: 24,\n borderRadius: 12,\n alignItems: 'center',\n justifyContent: 'center',\n },\n check: {\n width: 7,\n height: 12,\n borderRightWidth: 2.5,\n borderBottomWidth: 2.5,\n transform: [{ rotate: '45deg' }, { translateY: -2 }],\n },\n});\n"]}
@@ -1,13 +1,3 @@
1
- import type { KeyboardEvent } from 'react';
2
- /*** Support Space and directional navigation for web radio options without affecting native presses. */
3
- export declare function handleRadioOptionKeyDown(event: KeyboardEvent<RadioOptionKeyboardTarget>, select: () => void): void;
4
- /** Minimal web target contract keeps the native build independent of DOM ambient libraries. */
5
- export interface RadioOptionKeyboardTarget {
6
- closest(selector: string): {
7
- querySelectorAll(selector: string): ArrayLike<RadioOptionKeyboardTarget>;
8
- } | null;
9
- getAttribute(name: string): string | null;
10
- focus(): void;
11
- click(): void;
12
- }
1
+ /*** Select a focused radio option through the React Native keyboard event contract. */
2
+ export declare function handleRadioOptionKeyDown(key: string, preventDefault: () => void, select: () => void, navigate: (direction: -1 | 1) => void): void;
13
3
  //# sourceMappingURL=handleRadioOptionKeyDown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleRadioOptionKeyDown.d.ts","sourceRoot":"","sources":["../../../../../src/features/form/radio/utils/handleRadioOptionKeyDown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,wGAAwG;AACxG,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,aAAa,CAAC,yBAAyB,CAAC,EAC/C,MAAM,EAAE,MAAM,IAAI,GACjB,IAAI,CAkBN;AAED,+FAA+F;AAC/F,MAAM,WAAW,yBAAyB;IACxC,OAAO,CACL,QAAQ,EAAE,MAAM,GACf;QAAE,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC,yBAAyB,CAAC,CAAA;KAAE,GAAG,IAAI,CAAC;IACvF,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC1C,KAAK,IAAI,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;CACf"}
1
+ {"version":3,"file":"handleRadioOptionKeyDown.d.ts","sourceRoot":"","sources":["../../../../../src/features/form/radio/utils/handleRadioOptionKeyDown.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,IAAI,EAC1B,MAAM,EAAE,MAAM,IAAI,EAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GACpC,IAAI,CAUN"}
@@ -1,22 +1,15 @@
1
1
  import { DIRECTION_MODIFIERS } from '../constants';
2
- /*** Support Space and directional navigation for web radio options without affecting native presses. */
3
- export function handleRadioOptionKeyDown(event, select) {
4
- if (event.key === ' ') {
5
- event.preventDefault();
2
+ /*** Select a focused radio option through the React Native keyboard event contract. */
3
+ export function handleRadioOptionKeyDown(key, preventDefault, select, navigate) {
4
+ if (key === ' ') {
5
+ preventDefault();
6
6
  select();
7
7
  return;
8
8
  }
9
- const direction = DIRECTION_MODIFIERS.get(event.key);
10
- if (direction === undefined)
9
+ const direction = DIRECTION_MODIFIERS.get(key);
10
+ if (direction !== -1 && direction !== 1)
11
11
  return;
12
- const group = event.currentTarget.closest('[role="radiogroup"]');
13
- const options = Array.from(group?.querySelectorAll('[role="radio"]') ?? []).filter((option) => option.getAttribute('aria-disabled') !== 'true');
14
- const index = options.indexOf(event.currentTarget);
15
- if (index < 0 || options.length === 0)
16
- return;
17
- event.preventDefault();
18
- const next = options.at((index + direction + options.length) % options.length);
19
- next?.focus();
20
- next?.click();
12
+ preventDefault();
13
+ navigate(direction);
21
14
  }
22
15
  //# sourceMappingURL=handleRadioOptionKeyDown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleRadioOptionKeyDown.js","sourceRoot":"","sources":["../../../../../src/features/form/radio/utils/handleRadioOptionKeyDown.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,wGAAwG;AACxG,MAAM,UAAU,wBAAwB,CACtC,KAA+C,EAC/C,MAAkB;IAElB,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;QACtB,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,MAAM,EAAE,CAAC;QACT,OAAO;IACT,CAAC;IACD,MAAM,SAAS,GAAG,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrD,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO;IACpC,MAAM,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAChF,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,KAAK,MAAM,CAC5D,CAAC;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACnD,IAAI,KAAK,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC9C,KAAK,CAAC,cAAc,EAAE,CAAC;IACvB,MAAM,IAAI,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/E,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,IAAI,EAAE,KAAK,EAAE,CAAC;AAChB,CAAC","sourcesContent":["import type { KeyboardEvent } from 'react';\n\nimport { DIRECTION_MODIFIERS } from '../constants';\n\n/*** Support Space and directional navigation for web radio options without affecting native presses. */\nexport function handleRadioOptionKeyDown(\n event: KeyboardEvent<RadioOptionKeyboardTarget>,\n select: () => void,\n): void {\n if (event.key === ' ') {\n event.preventDefault();\n select();\n return;\n }\n const direction = DIRECTION_MODIFIERS.get(event.key);\n if (direction === undefined) return;\n const group = event.currentTarget.closest('[role=\"radiogroup\"]');\n const options = Array.from(group?.querySelectorAll('[role=\"radio\"]') ?? []).filter(\n (option) => option.getAttribute('aria-disabled') !== 'true',\n );\n const index = options.indexOf(event.currentTarget);\n if (index < 0 || options.length === 0) return;\n event.preventDefault();\n const next = options.at((index + direction + options.length) % options.length);\n next?.focus();\n next?.click();\n}\n\n/** Minimal web target contract keeps the native build independent of DOM ambient libraries. */\nexport interface RadioOptionKeyboardTarget {\n closest(\n selector: string,\n ): { querySelectorAll(selector: string): ArrayLike<RadioOptionKeyboardTarget> } | null;\n getAttribute(name: string): string | null;\n focus(): void;\n click(): void;\n}\n"]}
1
+ {"version":3,"file":"handleRadioOptionKeyDown.js","sourceRoot":"","sources":["../../../../../src/features/form/radio/utils/handleRadioOptionKeyDown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,uFAAuF;AACvF,MAAM,UAAU,wBAAwB,CACtC,GAAW,EACX,cAA0B,EAC1B,MAAkB,EAClB,QAAqC;IAErC,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;QAChB,cAAc,EAAE,CAAC;QACjB,MAAM,EAAE,CAAC;QACT,OAAO;IACT,CAAC;IACD,MAAM,SAAS,GAAG,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,SAAS,KAAK,CAAC,CAAC,IAAI,SAAS,KAAK,CAAC;QAAE,OAAO;IAChD,cAAc,EAAE,CAAC;IACjB,QAAQ,CAAC,SAAS,CAAC,CAAC;AACtB,CAAC","sourcesContent":["import { DIRECTION_MODIFIERS } from '../constants';\n\n/*** Select a focused radio option through the React Native keyboard event contract. */\nexport function handleRadioOptionKeyDown(\n key: string,\n preventDefault: () => void,\n select: () => void,\n navigate: (direction: -1 | 1) => void,\n): void {\n if (key === ' ') {\n preventDefault();\n select();\n return;\n }\n const direction = DIRECTION_MODIFIERS.get(key);\n if (direction !== -1 && direction !== 1) return;\n preventDefault();\n navigate(direction);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"GameEntity.d.ts","sourceRoot":"","sources":["../../../../../src/features/game/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAK1E,oFAAoF;AACpF,eAAO,MAAM,UAAU,uDAAsC,CAAC"}
1
+ {"version":3,"file":"GameEntity.d.ts","sourceRoot":"","sources":["../../../../../src/features/game/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAM1E,oFAAoF;AACpF,eAAO,MAAM,UAAU,uDAAsC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"GameEntity.js","sourceRoot":"","sources":["../../../../../src/features/game/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAA6B,MAAM,cAAc,CAAC;AAG/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,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,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;QAC/D,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;KAC7D,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Animated, StyleSheet, type View, type ViewStyle } from 'react-native';\n\nimport type { GameEntityProps } from '../../../../types/gamePresentation';\nimport { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';\nimport { useGameEntityAnimatedStyle } from '../../utils/useGameEntityAnimatedStyle';\nimport { useGameEntityMeasurement } from '../../utils/useGameEntityMeasurement';\n\n/*** Render one generic positioned game entity without owning gameplay semantics. */\nexport const GameEntity = withZoraThemeScope(GameEntityInner);\n\n/*** Render the positioned entity inside the inherited ZORA theme scope. */\nfunction GameEntityInner(props: GameEntityProps) {\n const elementRef = React.useRef<View | null>(null);\n const animatedStyle = useGameEntityAnimatedStyle(props);\n useGameEntityMeasurement(elementRef, props.measurementId);\n\n return (\n <Animated.View\n ref={elementRef}\n accessibilityLabel={props.accessibilityLabel}\n testID={props.testID}\n pointerEvents={\n props.interactionPolicy === 'passive' ? 'none' : (props.pointerEvents ?? 'auto')\n }\n style={[styles.root, createEntityStaticStyle(props), animatedStyle]}\n >\n {props.children}\n </Animated.View>\n );\n}\n\n/*** Convert non-animated GameEntity presentation props into a React Native view style. */\nfunction createEntityStaticStyle(props: GameEntityProps): ViewStyle {\n return {\n display: props.hidden === true ? 'none' : 'flex',\n position: 'absolute',\n zIndex: props.zIndex ?? 0,\n ...(props.height === undefined ? {} : { height: props.height }),\n ...(props.width === undefined ? {} : { width: props.width }),\n };\n}\n\nconst styles = StyleSheet.create({\n root: {\n position: 'absolute',\n },\n});\n"]}
1
+ {"version":3,"file":"GameEntity.js","sourceRoot":"","sources":["../../../../../src/features/game/adapters/inbound/GameEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAIpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,oFAAoF;AACpF,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAE9D,2EAA2E;AAC3E,SAAS,eAAe,CAAC,KAAsB;IAC7C,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAmD,IAAI,CAAC,CAAC;IACxF,MAAM,aAAa,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAC;IACxD,wBAAwB,CAAC,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAE1D,OAAO,CACL,CAAC,QAAQ,CAAC,IAAI,CACZ,GAAG,CAAC,CAAC,UAAU,CAAC,CAChB,kBAAkB,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAC7C,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CACrB,aAAa,CAAC,CACZ,KAAK,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,IAAI,MAAM,CACjF,CAAC,CACD,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,CAAC,CAEpE;MAAA,CAAC,KAAK,CAAC,QAAQ,CACjB;IAAA,EAAE,QAAQ,CAAC,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC;AAED,0FAA0F;AAC1F,SAAS,uBAAuB,CAAC,KAAsB;IACrD,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;QAChD,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC;QACzB,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;QAC/D,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;KAC7D,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport type { View } from 'react-native';\nimport { Animated, StyleSheet, type ViewStyle } from 'react-native';\n\nimport type { GameEntityProps } from '../../../../types/gamePresentation';\nimport type { ReactNativeComponentInstance } from '../../../../types/react-native';\nimport { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';\nimport { useGameEntityAnimatedStyle } from '../../utils/useGameEntityAnimatedStyle';\nimport { useGameEntityMeasurement } from '../../utils/useGameEntityMeasurement';\n\n/*** Render one generic positioned game entity without owning gameplay semantics. */\nexport const GameEntity = withZoraThemeScope(GameEntityInner);\n\n/*** Render the positioned entity inside the inherited ZORA theme scope. */\nfunction GameEntityInner(props: GameEntityProps) {\n const elementRef = React.useRef<ReactNativeComponentInstance<typeof View> | null>(null);\n const animatedStyle = useGameEntityAnimatedStyle(props);\n useGameEntityMeasurement(elementRef, props.measurementId);\n\n return (\n <Animated.View\n ref={elementRef}\n accessibilityLabel={props.accessibilityLabel}\n testID={props.testID}\n pointerEvents={\n props.interactionPolicy === 'passive' ? 'none' : (props.pointerEvents ?? 'auto')\n }\n style={[styles.root, createEntityStaticStyle(props), animatedStyle]}\n >\n {props.children}\n </Animated.View>\n );\n}\n\n/*** Convert non-animated GameEntity presentation props into a React Native view style. */\nfunction createEntityStaticStyle(props: GameEntityProps): ViewStyle {\n return {\n display: props.hidden === true ? 'none' : 'flex',\n position: 'absolute',\n zIndex: props.zIndex ?? 0,\n ...(props.height === undefined ? {} : { height: props.height }),\n ...(props.width === undefined ? {} : { width: props.width }),\n };\n}\n\nconst styles = StyleSheet.create({\n root: {\n position: 'absolute',\n },\n});\n"]}
@@ -32,7 +32,13 @@ function createGameInputZoneKeyboardProps({ dispatchKeyboard, enabled, keyboardB
32
32
  return {};
33
33
  if (keyboardBindings.length === 0)
34
34
  return {};
35
- return { onKeyDown: dispatchKeyboard, tabIndex: 0 };
35
+ return {
36
+ onKeyDown: (event) => dispatchKeyboard({
37
+ key: event.nativeEvent?.key ?? event.key ?? '',
38
+ preventDefault: () => event.preventDefault(),
39
+ }),
40
+ tabIndex: 0,
41
+ };
36
42
  }
37
43
  /*** Convert field-relative input-zone props into one absolute React Native style. */
38
44
  function createInputZoneStyle({ x, y, width, height, zIndex }) {
@@ -1 +1 @@
1
- {"version":3,"file":"GameInputZone.js","sourceRoot":"","sources":["../../../../../src/features/game/adapters/inbound/GameInputZone.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAG1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,qGAAqG;AACrG,MAAM,CAAC,MAAM,aAA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ent":["import { Platform, StyleSheet, View, type ViewStyle } from 'react-native';\n\nimport type { GameInputZoneProps } from '../../../../types/gamePresentation';\nimport { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';\nimport { toGamePercentage } from '../../utils/toGamePercentage';\nimport { useGameInputZoneResponder } from './useGameInputZoneResponder';\n\n/*** Capture pointer/touch geometry and optional keyboard input as normalized generic Game events. */\nexport const GameInputZone = withZoraThemeScope(GameInputZoneInner);\n\n/*** Capture game input inside the inherited ZORA theme scope. */\nfunction GameInputZoneInner({\n x = 0,\n y = 0,\n width = 100,\n height = 100,\n zIndex = 0,\n enabled = true,\n continuous = true,\n keyboardBindings,\n accessibilityLabel,\n interactionPolicy,\n testID,\n ...inputProps\n}: GameInputZoneProps) {\n const { dispatchKeyboard, dispatchPointer, handleLayout, shouldSetResponder } =\n useGameInputZoneResponder({\n ...inputProps,\n x,\n y,\n width,\n height,\n enabled: enabled && interactionPolicy !== 'passive',\n interactionPolicy,\n continuous,\n ...(keyboardBindings === undefined ? {} : { keyboardBindings }),\n });\n const keyboardProps = createGameInputZoneKeyboardProps({\n dispatchKeyboard,\n enabled: enabled && interactionPolicy !== 'passive',\n keyboardBindings,\n });\n\n return (\n <View\n {...keyboardProps}\n {...(accessibilityLabel === undefined ? {} : { accessibilityLabel })}\n {...(testID === undefined ? {} : { testID })}\n {...(continuous\n ? { onResponderGrant: dispatchPointer, onResponderMove: dispatchPointer }\n : { onResponderRelease: dispatchPointer })}\n collapsable={false}\n onLayout={handleLayout}\n onStartShouldSetResponder={shouldSetResponder}\n pointerEvents={enabled && interactionPolicy !== 'passive' ? 'auto' : 'none'}\n style={createInputZoneStyle({ x, y, width, height, zIndex })}\n />\n );\n}\n\ninterface GameInputZoneKeyboardPropsInput {\n readonly dispatchKeyboard: (event: { readonly key: string; preventDefault(): void }) => void;\n readonly enabled: boolean;\n readonly keyboardBindings: GameInputZoneProps['keyboardBindings'];\n}\n\n/*** Add a focusable web keyboard target only when the input zone owns key bindings. */\nfunction createGameInputZoneKeyboardProps({\n dispatchKeyboard,\n enabled,\n keyboardBindings,\n}: GameInputZoneKeyboardPropsInput) {\n if (Platform.OS !== 'web' || !enabled || keyboardBindings === undefined) return {};\n if (keyboardBindings.length === 0) return {};\n\n return { onKeyDown: dispatchKeyboard, tabIndex: 0 as const };\n}\n\ninterface InputZoneStyleInput {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n readonly zIndex: number;\n}\n\n/*** Convert field-relative input-zone props into one absolute React Native style. */\nfunction createInputZoneStyle({ x, y, width, height, zIndex }: InputZoneStyleInput): ViewStyle {\n return {\n left: toGamePercentage(x),\n top: toGamePercentage(y),\n width: toGamePercentage(width),\n height: toGamePercentage(height),\n zIndex,\n ...styles.root,\n };\n}\n\nconst styles = StyleSheet.create({\n root: {\n position: 'absolute',\n },\n});\n"]}
1
+ {"version":3,"file":"GameInputZone.js","sourceRoot":"","sources":["../../../../../src/features/game/adapters/inbound/GameInputZone.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAG1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,qGAAqG;AACrG,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;AAEpE,iEAAiE;AACjE,SAAS,kBAAkB,CAAC,EAC1B,CAAC,GAAG,CAAC,EACL,CAAC,GAAG,CAAC,EACL,KAAK,GAAG,GAAG,EACX,MAAM,GAAG,GAAG,EACZ,MAAM,GAAG,CAAC,EACV,OAAO,GAAG,IAAI,EACd,UAAU,GAAG,IAAI,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,MAAM,EACN,GAAG,UAAU,EACM;IAC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AM,EAAE,MAAM,EAAE,CAAC,CAAC,EAC7D,CACH,CAAC;AACJ,CAAC;AAQD,uFAAuF;AACvF,SAAS,gCAAgC,CAAC,EACxC,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACgB;IAChC,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,OAAO,IAAI,gBAAgB,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACnF,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE7C,OAAO;QACL,SAAS,EAAE,CAAC,KAAiC,EAAE,EAAE,CAC/C,gBAAgB,CAAC;YACf,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE,GAAG,IAAI,KAAK,CAAC,GAAG,IAAI,EAAE;YAC9C,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE;SAC7C,CAAC;QACJ,QAAQ,EAAE,CAAU;KACrB,CAAC;AACJ,CAAC;AAgBD,qFAAqF;AACrF,SAAS,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAuB;IAChF,OAAO;QACL,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;QACzB,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC;QACxB,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC;QAC9B,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC;QAChC,MAAM;QACN,GAAG,MAAM,CAAC,IAAI;KACf,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC,CAAC","sourcesContent":["import { Platform, StyleSheet, View, type ViewStyle } from 'react-native';\n\nimport type { GameInputZoneProps } from '../../../../types/gamePresentation';\nimport { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';\nimport { toGamePercentage } from '../../utils/toGamePercentage';\nimport { useGameInputZoneResponder } from './useGameInputZoneResponder';\n\n/*** Capture pointer/touch geometry and optional keyboard input as normalized generic Game events. */\nexport const GameInputZone = withZoraThemeScope(GameInputZoneInner);\n\n/*** Capture game input inside the inherited ZORA theme scope. */\nfunction GameInputZoneInner({\n x = 0,\n y = 0,\n width = 100,\n height = 100,\n zIndex = 0,\n enabled = true,\n continuous = true,\n keyboardBindings,\n accessibilityLabel,\n interactionPolicy,\n testID,\n ...inputProps\n}: GameInputZoneProps) {\n const { dispatchKeyboard, dispatchPointer, handleLayout, shouldSetResponder } =\n useGameInputZoneResponder({\n ...inputProps,\n x,\n y,\n width,\n height,\n enabled: enabled && interactionPolicy !== 'passive',\n interactionPolicy,\n continuous,\n ...(keyboardBindings === undefined ? {} : { keyboardBindings }),\n });\n const keyboardProps = createGameInputZoneKeyboardProps({\n dispatchKeyboard,\n enabled: enabled && interactionPolicy !== 'passive',\n keyboardBindings,\n });\n\n return (\n <View\n {...keyboardProps}\n {...(accessibilityLabel === undefined ? {} : { accessibilityLabel })}\n {...(testID === undefined ? {} : { testID })}\n {...(continuous\n ? { onResponderGrant: dispatchPointer, onResponderMove: dispatchPointer }\n : { onResponderRelease: dispatchPointer })}\n collapsable={false}\n onLayout={handleLayout}\n onStartShouldSetResponder={shouldSetResponder}\n pointerEvents={enabled && interactionPolicy !== 'passive' ? 'auto' : 'none'}\n style={createInputZoneStyle({ x, y, width, height, zIndex })}\n />\n );\n}\n\ninterface GameInputZoneKeyboardPropsInput {\n readonly dispatchKeyboard: (event: { readonly key: string; preventDefault(): void }) => void;\n readonly enabled: boolean;\n readonly keyboardBindings: GameInputZoneProps['keyboardBindings'];\n}\n\n/*** Add a focusable web keyboard target only when the input zone owns key bindings. */\nfunction createGameInputZoneKeyboardProps({\n dispatchKeyboard,\n enabled,\n keyboardBindings,\n}: GameInputZoneKeyboardPropsInput) {\n if (Platform.OS !== 'web' || !enabled || keyboardBindings === undefined) return {};\n if (keyboardBindings.length === 0) return {};\n\n return {\n onKeyDown: (event: GameInputZoneKeyboardEvent) =>\n dispatchKeyboard({\n key: event.nativeEvent?.key ?? event.key ?? '',\n preventDefault: () => event.preventDefault(),\n }),\n tabIndex: 0 as const,\n };\n}\n\ninterface GameInputZoneKeyboardEvent {\n readonly key?: string;\n readonly nativeEvent?: { readonly key?: string };\n preventDefault(): void;\n}\n\ninterface InputZoneStyleInput {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n readonly zIndex: number;\n}\n\n/*** Convert field-relative input-zone props into one absolute React Native style. */\nfunction createInputZoneStyle({ x, y, width, height, zIndex }: InputZoneStyleInput): ViewStyle {\n return {\n left: toGamePercentage(x),\n top: toGamePercentage(y),\n width: toGamePercentage(width),\n height: toGamePercentage(height),\n zIndex,\n ...styles.root,\n };\n}\n\nconst styles = StyleSheet.create({\n root: {\n position: 'absolute',\n },\n});\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { View } from 'react-native';
2
2
  import type { GameMeasurementBounds } from '../../../types/gameRuntime';
3
+ import type { ReactNativeComponentInstance } from '../../../types/react-native';
3
4
  /*** Measure one rendered React Native or React Native Web game entity in window coordinates. */
4
- export declare function measureGameEntity(element: View | null): Promise<GameMeasurementBounds | undefined>;
5
+ export declare function measureGameEntity(element: ReactNativeComponentInstance<typeof View> | null): Promise<GameMeasurementBounds | undefined>;
5
6
  //# sourceMappingURL=measureGameEntity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"measureGameEntity.d.ts","sourceRoot":"","sources":["../../../../src/features/game/utils/measureGameEntity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,gGAAgG;AAChG,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,GAAG,IAAI,GACnB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAoB5C"}
1
+ {"version":3,"file":"measureGameEntity.d.ts","sourceRoot":"","sources":["../../../../src/features/game/utils/measureGameEntity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAEhF,gGAAgG;AAChG,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,4BAA4B,CAAC,OAAO,IAAI,CAAC,GAAG,IAAI,GACxD,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAoB5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"measureGameEntity.js","sourceRoot":"","sources":["../../../../src/features/game/utils/measureGameEntity.ts"],"names":[],"mappings":"AAIA,gGAAgG;AAChG,MAAM,UAAU,iBAAiB,CAC/B,OAAoB;IAEpB,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAExD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACnD,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClF,OAAO,CAAC,SAAS,CAAC,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,OAAO,CAAC;gBACN,IAAI;gBACJ,KAAK,EAAE,IAAI,GAAG,KAAK;gBACnB,GAAG;gBACH,MAAM,EAAE,GAAG,GAAG,MAAM;gBACpB,KAAK;gBACL,MAAM;aACP,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { View } from 'react-native';\n\nimport type { GameMeasurementBounds } from '../../../types/gameRuntime';\n\n/*** Measure one rendered React Native or React Native Web game entity in window coordinates. */\nexport function measureGameEntity(\n element: View | null,\n): Promise<GameMeasurementBounds | undefined> {\n if (element === null) return Promise.resolve(undefined);\n\n return new Promise((resolve) => {\n element.measureInWindow((left, top, width, height) => {\n if (![left, top, width, height].every(Number.isFinite) || width < 0 || height < 0) {\n resolve(undefined);\n return;\n }\n\n resolve({\n left,\n right: left + width,\n top,\n bottom: top + height,\n width,\n height,\n });\n });\n });\n}\n"]}
1
+ {"version":3,"file":"measureGameEntity.js","sourceRoot":"","sources":["../../../../src/features/game/utils/measureGameEntity.ts"],"names":[],"mappings":"AAKA,gGAAgG;AAChG,MAAM,UAAU,iBAAiB,CAC/B,OAAyD;IAEzD,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAExD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACnD,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClF,OAAO,CAAC,SAAS,CAAC,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,OAAO,CAAC;gBACN,IAAI;gBACJ,KAAK,EAAE,IAAI,GAAG,KAAK;gBACnB,GAAG;gBACH,MAAM,EAAE,GAAG,GAAG,MAAM;gBACpB,KAAK;gBACL,MAAM;aACP,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { View } from 'react-native';\n\nimport type { GameMeasurementBounds } from '../../../types/gameRuntime';\nimport type { ReactNativeComponentInstance } from '../../../types/react-native';\n\n/*** Measure one rendered React Native or React Native Web game entity in window coordinates. */\nexport function measureGameEntity(\n element: ReactNativeComponentInstance<typeof View> | null,\n): Promise<GameMeasurementBounds | undefined> {\n if (element === null) return Promise.resolve(undefined);\n\n return new Promise((resolve) => {\n element.measureInWindow((left, top, width, height) => {\n if (![left, top, width, height].every(Number.isFinite) || width < 0 || height < 0) {\n resolve(undefined);\n return;\n }\n\n resolve({\n left,\n right: left + width,\n top,\n bottom: top + height,\n width,\n height,\n });\n });\n });\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { View } from 'react-native';
3
+ import type { ReactNativeComponentInstance } from '../../../types/react-native';
3
4
  /*** Register one optional measurable GameEntity view inside its local Game scope. */
4
- export declare function useGameEntityMeasurement(elementRef: React.RefObject<View | null>, measurementId: string | undefined): void;
5
+ export declare function useGameEntityMeasurement(elementRef: React.RefObject<ReactNativeComponentInstance<typeof View> | null>, measurementId: string | undefined): void;
5
6
  //# sourceMappingURL=useGameEntityMeasurement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useGameEntityMeasurement.d.ts","sourceRoot":"","sources":["../../../../src/features/game/utils/useGameEntityMeasurement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAKzC,qFAAqF;AACrF,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EACxC,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,IAAI,CAQN"}
1
+ {"version":3,"file":"useGameEntityMeasurement.d.ts","sourceRoot":"","sources":["../../../../src/features/game/utils/useGameEntityMeasurement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAIhF,qFAAqF;AACrF,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,4BAA4B,CAAC,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,EAC7E,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,IAAI,CAQN"}
@@ -1 +1 @@
1
- {"version":3,"file":"useGameEntityMeasurement.js","sourceRoot":"","sources":["../../../../src/features/game/utils/useGameEntityMeasurement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qFAAqF;AACrF,MAAM,UAAU,wBAAwB,CACtC,UAAwC,EACxC,aAAiC;IAEjC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACrD,MAAM,mBAAmB,GAAG,OAAO,EAAE,mBAAmB,CAAC;IAEzD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,aAAa,KAAK,SAAS,IAAI,mBAAmB,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QACvF,OAAO,mBAAmB,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACzF,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import React from 'react';\nimport type { View } from 'react-native';\n\nimport { GameRuntimeContext } from '../composition/GameRuntimeContext';\nimport { measureGameEntity } from './measureGameEntity';\n\n/*** Register one optional measurable GameEntity view inside its local Game scope. */\nexport function useGameEntityMeasurement(\n elementRef: React.RefObject<View | null>,\n measurementId: string | undefined,\n): void {\n const runtime = React.useContext(GameRuntimeContext);\n const registerMeasurement = runtime?.registerMeasurement;\n\n React.useEffect(() => {\n if (measurementId === undefined || registerMeasurement === undefined) return undefined;\n return registerMeasurement(measurementId, () => measureGameEntity(elementRef.current));\n }, [elementRef, measurementId, registerMeasurement]);\n}\n"]}
1
+ {"version":3,"file":"useGameEntityMeasurement.js","sourceRoot":"","sources":["../../../../src/features/game/utils/useGameEntityMeasurement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qFAAqF;AACrF,MAAM,UAAU,wBAAwB,CACtC,UAA6E,EAC7E,aAAiC;IAEjC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACrD,MAAM,mBAAmB,GAAG,OAAO,EAAE,mBAAmB,CAAC;IAEzD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,aAAa,KAAK,SAAS,IAAI,mBAAmB,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QACvF,OAAO,mBAAmB,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACzF,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import React from 'react';\nimport type { View } from 'react-native';\n\nimport type { ReactNativeComponentInstance } from '../../../types/react-native';\nimport { GameRuntimeContext } from '../composition/GameRuntimeContext';\nimport { measureGameEntity } from './measureGameEntity';\n\n/*** Register one optional measurable GameEntity view inside its local Game scope. */\nexport function useGameEntityMeasurement(\n elementRef: React.RefObject<ReactNativeComponentInstance<typeof View> | null>,\n measurementId: string | undefined,\n): void {\n const runtime = React.useContext(GameRuntimeContext);\n const registerMeasurement = runtime?.registerMeasurement;\n\n React.useEffect(() => {\n if (measurementId === undefined || registerMeasurement === undefined) return undefined;\n return registerMeasurement(measurementId, () => measureGameEntity(elementRef.current));\n }, [elementRef, measurementId, registerMeasurement]);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"GridInteractions.d.ts","sourceRoot":"","sources":["../../../../../src/features/grid-interactions/adapters/inbound/GridInteractions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,qCAAqC,CAAC;AAO7C,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,MAAM,EACN,GAAG,KAAK,EACT,EAAE,qBAAqB,qBAyEvB"}
1
+ {"version":3,"file":"GridInteractions.d.ts","sourceRoot":"","sources":["../../../../../src/features/grid-interactions/adapters/inbound/GridInteractions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,qCAAqC,CAAC;AAQ7C,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,MAAM,EACN,GAAG,KAAK,EACT,EAAE,qBAAqB,qBAyEvB"}