@ankhorage/zora 28.0.0 → 28.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/features/bottom-sheet/adapters/inbound/BottomSheet.js.map +1 -1
  4. package/dist/features/color/ColorHexField.d.ts +1 -1
  5. package/dist/features/color/ColorHexField.d.ts.map +1 -1
  6. package/dist/features/color/ColorHexField.js +30 -3
  7. package/dist/features/color/ColorHexField.js.map +1 -1
  8. package/dist/features/color/ColorPicker.d.ts.map +1 -1
  9. package/dist/features/color/ColorPicker.js +124 -63
  10. package/dist/features/color/ColorPicker.js.map +1 -1
  11. package/dist/features/color/ColorWheel.d.ts.map +1 -1
  12. package/dist/features/color/ColorWheel.js +33 -22
  13. package/dist/features/color/ColorWheel.js.map +1 -1
  14. package/dist/features/color/ColorWheelKeyboardProxy.d.ts +1 -0
  15. package/dist/features/color/ColorWheelKeyboardProxy.d.ts.map +1 -1
  16. package/dist/features/color/ColorWheelKeyboardProxy.js.map +1 -1
  17. package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts +1 -1
  18. package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts.map +1 -1
  19. package/dist/features/color/ColorWheelKeyboardProxy.web.js +4 -4
  20. package/dist/features/color/ColorWheelKeyboardProxy.web.js.map +1 -1
  21. package/dist/features/color/ColorWheelPointerProxy.d.ts +1 -0
  22. package/dist/features/color/ColorWheelPointerProxy.d.ts.map +1 -1
  23. package/dist/features/color/ColorWheelPointerProxy.js.map +1 -1
  24. package/dist/features/color/ColorWheelPointerProxy.native.d.ts +3 -2
  25. package/dist/features/color/ColorWheelPointerProxy.native.d.ts.map +1 -1
  26. package/dist/features/color/ColorWheelPointerProxy.native.js +12 -3
  27. package/dist/features/color/ColorWheelPointerProxy.native.js.map +1 -1
  28. package/dist/features/color/ColorWheelPointerProxy.web.d.ts +1 -1
  29. package/dist/features/color/ColorWheelPointerProxy.web.d.ts.map +1 -1
  30. package/dist/features/color/ColorWheelPointerProxy.web.js +1 -1
  31. package/dist/features/color/ColorWheelPointerProxy.web.js.map +1 -1
  32. package/dist/features/color/resolveColorPickerGeometry.d.ts +31 -0
  33. package/dist/features/color/resolveColorPickerGeometry.d.ts.map +1 -0
  34. package/dist/features/color/resolveColorPickerGeometry.js +94 -0
  35. package/dist/features/color/resolveColorPickerGeometry.js.map +1 -0
  36. package/dist/features/color/utils/resolveWheelColor.d.ts +2 -2
  37. package/dist/features/color/utils/resolveWheelColor.d.ts.map +1 -1
  38. package/dist/features/color/utils/resolveWheelColor.js +2 -3
  39. package/dist/features/color/utils/resolveWheelColor.js.map +1 -1
  40. package/dist/features/form/select/adapters/inbound/Select.native.js.map +1 -1
  41. package/dist/features/form/select/composition/SelectTrigger.d.ts.map +1 -1
  42. package/dist/features/form/select/composition/SelectTrigger.js +2 -2
  43. package/dist/features/form/select/composition/SelectTrigger.js.map +1 -1
  44. package/dist/index.d.ts +2 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +1 -0
  47. package/dist/index.js.map +1 -1
  48. package/dist/types/color.d.ts +9 -1
  49. package/dist/types/color.d.ts.map +1 -1
  50. package/dist/types/color.js.map +1 -1
  51. package/dist/types/select.d.ts +2 -0
  52. package/dist/types/select.d.ts.map +1 -1
  53. package/dist/types/select.js.map +1 -1
  54. package/package.json +8 -8
  55. package/src/features/bottom-sheet/adapters/inbound/BottomSheet.tsx +1 -1
  56. package/src/features/color/ColorHexField.tsx +67 -21
  57. package/src/features/color/ColorPicker.layout.test.tsx +19 -10
  58. package/src/features/color/ColorPicker.tsx +319 -115
  59. package/src/features/color/ColorWheel.tsx +53 -51
  60. package/src/features/color/ColorWheelKeyboardProxy.tsx +1 -0
  61. package/src/features/color/ColorWheelKeyboardProxy.web.tsx +4 -3
  62. package/src/features/color/ColorWheelPointerProxy.native.tsx +25 -3
  63. package/src/features/color/ColorWheelPointerProxy.tsx +1 -0
  64. package/src/features/color/ColorWheelPointerProxy.web.tsx +1 -0
  65. package/src/features/color/resolveColorPickerGeometry.test.ts +43 -0
  66. package/src/features/color/resolveColorPickerGeometry.ts +116 -0
  67. package/src/features/color/utils/resolveWheelColor.ts +2 -3
  68. package/src/features/form/select/adapters/inbound/Select.native.tsx +1 -1
  69. package/src/features/form/select/composition/SelectTrigger.tsx +2 -1
  70. package/src/index.ts +6 -0
  71. package/src/types/color.ts +9 -1
  72. package/src/types/select.ts +2 -0
  73. package/web-dist/chunks/{Accordion-sn241nek.js → Accordion-01bsg7zt.js} +5 -5
  74. package/web-dist/chunks/{Accordion-jara9sqj.js → Accordion-01zvarrn.js} +8 -9
  75. package/web-dist/chunks/{Accordion-dxh9yn4f.js → Accordion-0dj1r7w3.js} +1 -1
  76. package/web-dist/chunks/{Accordion-nkppqfz4.js → Accordion-0xaq2k2h.js} +8 -8
  77. package/web-dist/chunks/{Accordion-3t2936t6.js → Accordion-15sxxjym.js} +4 -5
  78. package/web-dist/chunks/{Accordion-eq27a9ms.js → Accordion-1fz55hk4.js} +1 -1
  79. package/web-dist/chunks/{Accordion-q697hacs.js → Accordion-22cda3h5.js} +7 -8
  80. package/web-dist/chunks/{Accordion-3ar6p84m.js → Accordion-27yg9ktv.js} +3 -3
  81. package/web-dist/chunks/{Accordion-94vndckf.js → Accordion-34b3rwbc.js} +6 -8
  82. package/web-dist/chunks/{Accordion-8wm25z0h.js → Accordion-3zzzw7a8.js} +2 -2
  83. package/web-dist/chunks/{Accordion-00h253nv.js → Accordion-46n609yq.js} +13 -12
  84. package/web-dist/chunks/{Accordion-0t53jhx1.js → Accordion-4zb6dcys.js} +4 -7
  85. package/web-dist/chunks/{Accordion-dfv6p6gt.js → Accordion-5cjhz94e.js} +5 -5
  86. package/web-dist/chunks/{Accordion-5wx67nhg.js → Accordion-5mga7hty.js} +2 -2
  87. package/web-dist/chunks/{Accordion-kcx57mk5.js → Accordion-76b0qz8y.js} +24 -22
  88. package/web-dist/chunks/{Accordion-5adv6dv1.js → Accordion-78tknqmc.js} +4 -4
  89. package/web-dist/chunks/{Accordion-81rx3bh0.js → Accordion-7bd6zq4s.js} +9 -9
  90. package/web-dist/chunks/{Accordion-7ppf31tg.js → Accordion-8c4w7366.js} +5 -5
  91. package/web-dist/chunks/{Accordion-1b2t4k36.js → Accordion-8t6vh482.js} +3 -4
  92. package/web-dist/chunks/{Accordion-7d0e5vhe.js → Accordion-9d38cgqj.js} +87 -91
  93. package/web-dist/chunks/{Accordion-6wcbzxzb.js → Accordion-9k7ktksc.js} +212 -215
  94. package/web-dist/chunks/{Accordion-1dv8wytq.js → Accordion-afpjg1d6.js} +3 -4
  95. package/web-dist/chunks/{Accordion-j6hgazmz.js → Accordion-b1y5mjac.js} +1 -1
  96. package/web-dist/chunks/{Accordion-re4r47xn.js → Accordion-b8w0f8s0.js} +6 -7
  97. package/web-dist/chunks/{Accordion-9fhsfynt.js → Accordion-bexwrnfh.js} +3 -4
  98. package/web-dist/chunks/Accordion-chdbfcm6.js +93 -0
  99. package/web-dist/chunks/{Accordion-wbmzvfaw.js → Accordion-d405whfb.js} +2 -2
  100. package/web-dist/chunks/{Accordion-z9yw0xy9.js → Accordion-de8srt4x.js} +8 -8
  101. package/web-dist/chunks/{Accordion-dpkp0y4p.js → Accordion-epv5yhch.js} +3 -3
  102. package/web-dist/chunks/{Accordion-d4dp5ryp.js → Accordion-f4919ghm.js} +4 -4
  103. package/web-dist/chunks/{Accordion-0gae3kzr.js → Accordion-f8a49gy8.js} +19 -22
  104. package/web-dist/chunks/{Accordion-3s7zeagv.js → Accordion-fdzyyqe9.js} +1 -1
  105. package/web-dist/chunks/{Accordion-rev9ssd4.js → Accordion-gnxmybxx.js} +490 -205
  106. package/web-dist/chunks/{Accordion-36674tfw.js → Accordion-h1q243zq.js} +13 -11
  107. package/web-dist/chunks/{Accordion-dtt4qkrb.js → Accordion-h63c9k9k.js} +1 -1
  108. package/web-dist/chunks/{Accordion-43gp801f.js → Accordion-hdyzyw8q.js} +3 -3
  109. package/web-dist/chunks/{Accordion-phcp8d5v.js → Accordion-htvmkx8s.js} +118 -118
  110. package/web-dist/chunks/{Accordion-b41rev86.js → Accordion-jmxe6kw0.js} +9 -11
  111. package/web-dist/chunks/{Accordion-wpj8pd40.js → Accordion-kcm6jcpp.js} +2 -3
  112. package/web-dist/chunks/{Accordion-fcczvwgg.js → Accordion-mrstcjcm.js} +1 -0
  113. package/web-dist/chunks/{Accordion-6225tr9r.js → Accordion-mx7nkg85.js} +1 -1
  114. package/web-dist/chunks/{Accordion-pm2f2j32.js → Accordion-pdjhezmz.js} +2 -2
  115. package/web-dist/chunks/{Accordion-hbkzy0bg.js → Accordion-q046ws5p.js} +6 -6
  116. package/web-dist/chunks/{Accordion-tppk4vwt.js → Accordion-q11svb96.js} +19 -19
  117. package/web-dist/chunks/{Accordion-36j1fw8r.js → Accordion-qkkeyr18.js} +6 -8
  118. package/web-dist/chunks/{Accordion-c8mmgjtj.js → Accordion-qrt9xz0h.js} +7 -8
  119. package/web-dist/chunks/{Accordion-z1cq2mnx.js → Accordion-qsppnx7g.js} +10 -11
  120. package/web-dist/chunks/{Accordion-neg1cgeh.js → Accordion-rhjddvkh.js} +1 -2
  121. package/web-dist/chunks/{Accordion-238zba4h.js → Accordion-rtamzg9j.js} +47 -28
  122. package/web-dist/chunks/{Accordion-zzymcpty.js → Accordion-sfvqf4fz.js} +134 -132
  123. package/web-dist/chunks/{Accordion-ah1d9b6z.js → Accordion-sh79sr5g.js} +5 -5
  124. package/web-dist/chunks/{Accordion-wcw153f0.js → Accordion-t9n4ey2r.js} +5 -3
  125. package/web-dist/chunks/{Accordion-zte416jw.js → Accordion-tk8zf9ff.js} +3 -3
  126. package/web-dist/chunks/{Accordion-zypyr9xw.js → Accordion-tnyqv1xv.js} +296 -305
  127. package/web-dist/chunks/{Accordion-52s4t1aq.js → Accordion-v6vhyv31.js} +95 -165
  128. package/web-dist/chunks/{Accordion-m5baah44.js → Accordion-vkqqktc5.js} +3 -3
  129. package/web-dist/chunks/{Accordion-ytxgphds.js → Accordion-vzq344av.js} +2 -3
  130. package/web-dist/chunks/{Accordion-d2kg4729.js → Accordion-wb9pmykz.js} +5 -6
  131. package/web-dist/chunks/{Accordion-6r1e7k5r.js → Accordion-ww4f12ty.js} +1 -1
  132. package/web-dist/chunks/{Accordion-ec1tt3be.js → Accordion-xb9zhdhp.js} +42 -45
  133. package/web-dist/chunks/{Accordion-knb3e18b.js → Accordion-xfkg7dcw.js} +4 -5
  134. package/web-dist/chunks/{Accordion-6ec4gxv2.js → Accordion-xzaa9s7f.js} +12 -23
  135. package/web-dist/chunks/{Accordion-epwpdegg.js → Accordion-yrac5a7m.js} +1 -1
  136. package/web-dist/chunks/{zip-reader-f0yphjb9.js → zip-reader-5xrcmjr8.js} +1 -1
  137. package/web-dist/components/accordion/Accordion.js +11 -11
  138. package/web-dist/components/accordion-item/AccordionItem.js +11 -11
  139. package/web-dist/components/activity-indicator/ActivityIndicator.js +4 -4
  140. package/web-dist/components/app-bar/AppBar.js +18 -18
  141. package/web-dist/components/app-header/AppHeader.js +18 -18
  142. package/web-dist/components/app-shell/AppShell.js +5 -5
  143. package/web-dist/components/auth-screen/AuthScreen.js +21 -21
  144. package/web-dist/components/avatar/Avatar.js +11 -11
  145. package/web-dist/components/avatar-group/AvatarGroup.js +11 -11
  146. package/web-dist/components/badge/Badge.js +6 -6
  147. package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +19 -19
  148. package/web-dist/components/bottom-sheet/BottomSheet.js +10 -7
  149. package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +10 -7
  150. package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +10 -7
  151. package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +10 -7
  152. package/web-dist/components/bottom-sheet-view/BottomSheetView.js +10 -7
  153. package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +10 -7
  154. package/web-dist/components/breadcrumbs/Breadcrumbs.js +13 -13
  155. package/web-dist/components/button/Button.js +11 -11
  156. package/web-dist/components/button-group/ButtonGroup.js +11 -11
  157. package/web-dist/components/calendar/Calendar.js +14 -14
  158. package/web-dist/components/camera-permission-view/CameraPermissionView.js +19 -19
  159. package/web-dist/components/card/Card.js +18 -18
  160. package/web-dist/components/card-back/CardBack.js +5 -5
  161. package/web-dist/components/card-hand/CardHand.js +5 -5
  162. package/web-dist/components/carousel/Carousel.js +2 -2
  163. package/web-dist/components/chat-list-item/ChatListItem.js +15 -15
  164. package/web-dist/components/checkbox/Checkbox.js +11 -11
  165. package/web-dist/components/checkbox-group/CheckboxGroup.js +11 -11
  166. package/web-dist/components/chess-board/ChessBoard.js +6 -6
  167. package/web-dist/components/chip/Chip.js +12 -12
  168. package/web-dist/components/chip-group/ChipGroup.js +12 -12
  169. package/web-dist/components/collection-editor/CollectionEditor.js +18 -18
  170. package/web-dist/components/color-hue-scale/ColorHueScale.js +27 -27
  171. package/web-dist/components/color-picker/ColorPicker.js +27 -27
  172. package/web-dist/components/color-picker/ColorPicker.types-0.d.ts +9 -1
  173. package/web-dist/components/color-tone/ColorTone.js +27 -27
  174. package/web-dist/components/color-wheel/ColorWheel.js +27 -27
  175. package/web-dist/components/color-wheel/ColorWheel.types-0.d.ts +8 -0
  176. package/web-dist/components/content-rail/ContentRail.js +12 -12
  177. package/web-dist/components/data-table/DataTable.js +26 -26
  178. package/web-dist/components/date-picker/DatePicker.js +20 -20
  179. package/web-dist/components/dialog/Dialog.js +11 -11
  180. package/web-dist/components/divider/Divider.js +5 -5
  181. package/web-dist/components/empty-state/EmptyState.js +19 -19
  182. package/web-dist/components/explorer/Explorer.js +13 -13
  183. package/web-dist/components/field/Field.js +11 -11
  184. package/web-dist/components/file-explorer/FileExplorer.js +13 -13
  185. package/web-dist/components/flat-list/FlatList.js +12 -12
  186. package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +21 -21
  187. package/web-dist/components/form/Form.js +15 -15
  188. package/web-dist/components/form-actions/FormActions.js +15 -15
  189. package/web-dist/components/form-error/FormError.js +15 -15
  190. package/web-dist/components/game/Game.js +7 -6
  191. package/web-dist/components/game-entity/GameEntity.js +7 -6
  192. package/web-dist/components/game-field/GameField.js +7 -6
  193. package/web-dist/components/game-input-zone/GameInputZone.js +7 -6
  194. package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +7 -6
  195. package/web-dist/components/game-overlay/GameOverlay.js +7 -6
  196. package/web-dist/components/gradient/Gradient.js +6 -6
  197. package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +6 -6
  198. package/web-dist/components/graph-view/GraphView.js +2 -2
  199. package/web-dist/components/grid/Grid.js +5 -5
  200. package/web-dist/components/grid-interactions/GridInteractions.js +1 -1
  201. package/web-dist/components/grid-line-overlay/GridLineOverlay.js +5 -5
  202. package/web-dist/components/grid-ruler/GridRuler.js +5 -5
  203. package/web-dist/components/grid-view/GridView.js +1 -1
  204. package/web-dist/components/heading/Heading.js +6 -6
  205. package/web-dist/components/hero/Hero.js +18 -18
  206. package/web-dist/components/icon/Icon.js +5 -5
  207. package/web-dist/components/icon-button/IconButton.js +11 -11
  208. package/web-dist/components/image/Image.js +9 -9
  209. package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +4 -4
  210. package/web-dist/components/list/List.js +12 -12
  211. package/web-dist/components/list-item/ListItem.js +12 -12
  212. package/web-dist/components/list-section/ListSection.js +12 -12
  213. package/web-dist/components/master-detail/MasterDetail.js +5 -5
  214. package/web-dist/components/matrix-grid/MatrixGrid.js +9 -9
  215. package/web-dist/components/media-card/MediaCard.js +18 -18
  216. package/web-dist/components/media-explorer/MediaExplorer.js +13 -13
  217. package/web-dist/components/message-bubble/MessageBubble.js +15 -15
  218. package/web-dist/components/metric-card/MetricCard.js +18 -18
  219. package/web-dist/components/missing-element/MissingElement.js +10 -10
  220. package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +21 -21
  221. package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +21 -21
  222. package/web-dist/components/opening-book/OpeningBook.js +6 -6
  223. package/web-dist/components/otp-form/OtpForm.js +21 -21
  224. package/web-dist/components/pagination/Pagination.js +12 -12
  225. package/web-dist/components/palette-item/PaletteItem.js +18 -18
  226. package/web-dist/components/playing-card/PlayingCard.js +5 -5
  227. package/web-dist/components/poker-training-table/PokerTrainingTable.js +5 -5
  228. package/web-dist/components/popover-menu/PopoverMenu.js +13 -13
  229. package/web-dist/components/post-card/PostCard.js +18 -18
  230. package/web-dist/components/product-card/ProductCard.js +18 -18
  231. package/web-dist/components/progress/Progress.js +9 -9
  232. package/web-dist/components/progress-ring/ProgressRing.js +9 -9
  233. package/web-dist/components/radio/Radio.js +13 -13
  234. package/web-dist/components/radio-group/RadioGroup.js +13 -13
  235. package/web-dist/components/rating/Rating.js +8 -8
  236. package/web-dist/components/reader/Reader.js +34 -34
  237. package/web-dist/components/scan-overlay/ScanOverlay.js +19 -19
  238. package/web-dist/components/screen/Screen.js +5 -5
  239. package/web-dist/components/screen-section/ScreenSection.js +9 -9
  240. package/web-dist/components/scroll-view/ScrollView.js +5 -5
  241. package/web-dist/components/search-input/SearchInput.js +13 -13
  242. package/web-dist/components/section-header/SectionHeader.js +9 -9
  243. package/web-dist/components/section-list/SectionList.js +12 -12
  244. package/web-dist/components/select/Select.js +20 -20
  245. package/web-dist/components/select/Select.types-0.d.ts +2 -0
  246. package/web-dist/components/selectable-item/SelectableItem.js +4 -4
  247. package/web-dist/components/selection-provider/SelectionProvider.js +4 -4
  248. package/web-dist/components/sign-in-form/SignInForm.js +21 -21
  249. package/web-dist/components/sign-up-form/SignUpForm.js +21 -21
  250. package/web-dist/components/skeleton/Skeleton.js +21 -21
  251. package/web-dist/components/skeleton-card/SkeletonCard.js +21 -21
  252. package/web-dist/components/skeleton-list/SkeletonList.js +21 -21
  253. package/web-dist/components/skeleton-text/SkeletonText.js +21 -21
  254. package/web-dist/components/spatial-grid/SpatialGrid.js +1 -1
  255. package/web-dist/components/surface/Surface.js +6 -6
  256. package/web-dist/components/switch/Switch.js +8 -8
  257. package/web-dist/components/tab/Tab.js +6 -6
  258. package/web-dist/components/tab-list/TabList.js +6 -6
  259. package/web-dist/components/tab-panel/TabPanel.js +6 -6
  260. package/web-dist/components/tabletop-table/TabletopTable.js +5 -5
  261. package/web-dist/components/tabs/Tabs.js +6 -6
  262. package/web-dist/components/text/Text.js +6 -6
  263. package/web-dist/components/text-input/TextInput.js +13 -13
  264. package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +11 -11
  265. package/web-dist/components/tile-grid/TileGrid.js +1 -1
  266. package/web-dist/components/time-grid/TimeGrid.js +2 -2
  267. package/web-dist/components/time-picker/TimePicker.js +18 -18
  268. package/web-dist/components/timeline/Timeline.js +11 -11
  269. package/web-dist/components/toast/Toast.js +9 -9
  270. package/web-dist/components/toast-provider/ToastProvider.js +9 -9
  271. package/web-dist/components/toolbar/Toolbar.js +18 -18
  272. package/web-dist/components/tree-item/TreeItem.js +17 -17
  273. package/web-dist/components/tree-view/TreeView.js +1 -1
  274. package/web-dist/components/uploader/Uploader.js +23 -23
  275. package/web-dist/components/view/View.js +5 -5
  276. package/web-dist/manifest.json +1897 -1873
  277. package/web-dist/runtime/ZoraProvider.js +9 -9
  278. package/web-dist/chunks/{Accordion-vgkvvdvg.js → Accordion-ykk40jz9.js} +36 -36
@@ -2,7 +2,6 @@ import { generateHarmonyRoleColors } from '@ankhorage/color-theory';
2
2
  import React from 'react';
3
3
  import { Circle, Defs, Line, Path, Polygon, RadialGradient, Stop, Svg } from 'react-native-svg';
4
4
  import { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';
5
- import { useZoraTheme } from '../theme/composition/useZoraTheme';
6
5
  import { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy';
7
6
  import { ColorWheelPointerProxy } from './ColorWheelPointerProxy';
8
7
  import { resolveColorHue } from './utils/resolveColorHue';
@@ -12,48 +11,60 @@ import { resolveWheelColorComponents } from './utils/resolveWheelColorComponents
12
11
  const VIEWBOX = 1000;
13
12
  const CENTER = VIEWBOX / 2;
14
13
  const RADIUS = 480;
15
- const SEGMENTS = 96;
14
+ const SEGMENTS = 720;
16
15
  const MAX_CHROMA = 0.2;
17
16
  /*** Renders a size-owned, filled OKLCH wheel with controlled primary and harmony points. */
18
17
  export const ColorWheel = withZoraThemeScope(ColorWheelInner);
19
18
  /*** Maps pointer and keyboard input through one viewBox into the controlled selected colour. */
20
- function ColorWheelInner({ themeId: _themeId, mode: _mode, inverted: _inverted, interactionPolicy, value, harmony = null, onChange, size = 340, testID, }) {
21
- const { theme } = useZoraTheme();
19
+ function ColorWheelInner({ themeId: _themeId, mode: _mode, inverted: _inverted, interactionPolicy, value, harmony = null, toneTarget, onChange, size = 340, testID, }) {
22
20
  const hue = resolveColorHue(value);
23
21
  const { chroma, lightness } = resolveWheelColorComponents(value);
24
- const primaryPoint = pointFor(hue, Math.min(1, chroma / MAX_CHROMA));
25
- const harmonyPoints = harmony
26
- ? generateHarmonyRoleColors(value, harmony).colors.map((color) => pointFor(color.hueDegrees))
27
- : [];
22
+ const targetLightness = toneTarget?.lightness ?? lightness;
23
+ const maximumChroma = toneTarget?.chroma ?? MAX_CHROMA;
24
+ const primaryPoint = pointFor(hue, Math.min(1, chroma / maximumChroma));
25
+ const harmonyRoles = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];
26
+ const harmonyPoints = harmonyRoles.map((role) => ({
27
+ color: role.hex,
28
+ ...pointFor(role.hueDegrees, Math.min(1, resolveWheelColorComponents(role.hex).chroma / maximumChroma)),
29
+ }));
28
30
  const gradientId = `color-wheel-${React.useId().replaceAll(':', '')}`;
29
31
  const changeAt = (x, y) => {
30
32
  if (interactionPolicy !== 'passive')
31
- onChange({ color: resolveWheelColor(value, x, y, CENTER, RADIUS, MAX_CHROMA), harmony });
33
+ onChange({
34
+ color: resolveWheelColor(value, x, y, CENTER, RADIUS, maximumChroma, targetLightness),
35
+ harmony,
36
+ });
32
37
  };
33
- return (<ColorWheelKeyboardProxy chroma={chroma} disabled={interactionPolicy === 'passive'} hue={hue} onChange={(nextHue, nextChroma) => onChange({ color: resolveOklchColor({ chroma: nextChroma, lightness }, nextHue), harmony })}>
34
- <ColorWheelPointerProxy disabled={interactionPolicy === 'passive'} height={VIEWBOX} onChange={changeAt} width={VIEWBOX}>
35
- <Svg accessibilityLabel="Color wheel" height={size} onResponderGrant={(event) => changeAt((event.nativeEvent.locationX / size) * VIEWBOX, (event.nativeEvent.locationY / size) * VIEWBOX)} onResponderMove={(event) => changeAt((event.nativeEvent.locationX / size) * VIEWBOX, (event.nativeEvent.locationY / size) * VIEWBOX)} onResponderRelease={(event) => changeAt((event.nativeEvent.locationX / size) * VIEWBOX, (event.nativeEvent.locationY / size) * VIEWBOX)} onStartShouldSetResponder={() => interactionPolicy !== 'passive'} testID={testID} viewBox={`0 0 ${VIEWBOX} ${VIEWBOX}`} width={size}>
38
+ return (<ColorWheelKeyboardProxy chroma={chroma} disabled={interactionPolicy === 'passive'} hue={hue} maxChroma={maximumChroma} onChange={(nextHue, nextChroma) => onChange({
39
+ color: resolveOklchColor({ chroma: nextChroma, lightness: targetLightness }, nextHue),
40
+ harmony,
41
+ })}>
42
+ <ColorWheelPointerProxy disabled={interactionPolicy === 'passive'} height={VIEWBOX} onChange={changeAt} renderedSize={size} width={VIEWBOX}>
43
+ <Svg accessibilityLabel="Color wheel" height={size} testID={testID} viewBox={`0 0 ${VIEWBOX} ${VIEWBOX}`} width={size}>
36
44
  <Defs>
37
- {segments().map((segment) => (<RadialGradient cx={CENTER} cy={CENTER} id={`${gradientId}-${segment.hue}`} key={segment.hue} r={RADIUS}>
38
- <Stop offset="0" stopColor={resolveOklchColor({ chroma: 0, lightness: 0.72 }, segment.hue)}/>
45
+ {segments(targetLightness, maximumChroma).map((segment) => (<RadialGradient cx={CENTER} cy={CENTER} gradientUnits="userSpaceOnUse" id={`${gradientId}-${segment.hue}`} key={segment.hue} r={RADIUS}>
46
+ <Stop offset="0" stopColor={segment.centerColor}/>
39
47
  <Stop offset="1" stopColor={segment.color}/>
40
48
  </RadialGradient>))}
41
49
  </Defs>
42
- {segments().map((segment) => (<Path d={segment.path} fill={`url(#${gradientId}-${segment.hue})`} key={segment.hue}/>))}
43
- {harmonyPoints.length === 3 ? (<Polygon fill="none" points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')} stroke={theme.semantics.content.default} strokeWidth={6}/>) : (linesFor(harmonyPoints, primaryPoint, theme.semantics.content.default))}
44
- {harmonyPoints.map((point) => (<Circle cx={point.x} cy={point.y} fill={theme.semantics.content.default} key={`${point.x}-${point.y}`} r={26}/>))}
45
- <Circle cx={primaryPoint.x} cy={primaryPoint.y} fill="none" r={36} stroke="white" strokeWidth={12}/>
46
- <Circle cx={primaryPoint.x} cy={primaryPoint.y} fill="none" r={42} stroke={theme.semantics.content.default} strokeWidth={6}/>
50
+ {segments(targetLightness, maximumChroma).map((segment) => (<Path d={segment.path} fill={`url(#${gradientId}-${segment.hue})`} key={segment.hue}/>))}
51
+ {harmonyPoints.length >= 3 ? (<Polygon fill="none" points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')} stroke="white" strokeWidth={6}/>) : (linesFor(harmonyPoints, primaryPoint, 'white'))}
52
+ {harmonyPoints
53
+ .filter((point) => point.color !== value)
54
+ .map((point) => (<Circle cx={point.x} cy={point.y} fill={point.color} key={`${point.x}-${point.y}`} stroke="white" strokeWidth={6} r={26}/>))}
55
+ <Circle cx={primaryPoint.x} cy={primaryPoint.y} fill={value} r={36} stroke="white" strokeWidth={12}/>
56
+ <Circle cx={primaryPoint.x} cy={primaryPoint.y} fill="none" r={42} stroke="white" strokeWidth={6}/>
47
57
  </Svg>
48
58
  </ColorWheelPointerProxy>
49
59
  </ColorWheelKeyboardProxy>);
50
60
  }
51
- /*** Creates continuous-looking radial hue segments for the wheel viewBox. */
52
- function segments() {
61
+ /*** Creates fine radial hue segments from the same OKLCH projection used for interaction. */
62
+ function segments(lightness, maximumChroma) {
53
63
  return Array.from({ length: SEGMENTS }, (_, index) => {
54
64
  const hue = (index * 360) / SEGMENTS;
55
65
  return {
56
- color: resolveOklchColor({ chroma: MAX_CHROMA, lightness: 0.65 }, hue),
66
+ centerColor: resolveOklchColor({ chroma: 0, lightness }, hue),
67
+ color: resolveOklchColor({ chroma: maximumChroma, lightness }, hue),
57
68
  hue,
58
69
  path: segmentPath(hue, hue + 360 / SEGMENTS),
59
70
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheel.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAiB,MAAM,yBAAyB,CAAC;AACnF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAGhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAElF,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,MAAM,GAAG,OAAO,GAAG,CAAC,CAAC;AAC3B,MAAM,MAAM,GAAG,GAAG,CAAC;AACnB,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,UAAU,GAAG,GAAG,C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AAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IAC7C,OAAO;QACL,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;QAC9C,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;KAC/C,CAAC;AACJ,CAAC;AAED,yEAAyE;AACzE,SAAS,QAAQ,CACf,MAA6D,EAC7D,OAAmD,EACnD,MAAc;IAEd,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAC3B,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC/B,KAAK,EAAE;YACL,GAAG,KAAK;YACR,CAAC,IAAI,CACH,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CACzD,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,WAAW,CAAC,CAAC,CAAC,CAAC,CACf,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACf,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CACZ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACf,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EACZ;SACH;QACD,QAAQ,EAAE,KAAK;KAChB,CAAC,EACF,EAAE,KAAK,EAAE,EAAuB,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CACtE,CAAC,KAAK,CAAC;AACV,CAAC","sourcesContent":["import { generateHarmonyRoleColors, type HexColor } from '@ankhorage/color-theory';\nimport React from 'react';\nimport { Circle, Defs, Line, Path, Polygon, RadialGradient, Stop, Svg } from 'react-native-svg';\n\nimport type { ColorWheelProps } from '../../types/color';\nimport { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';\nimport { useZoraTheme } from '../theme/composition/useZoraTheme';\nimport { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy';\nimport { ColorWheelPointerProxy } from './ColorWheelPointerProxy';\nimport { resolveColorHue } from './utils/resolveColorHue';\nimport { resolveOklchColor } from './utils/resolveOklchColor';\nimport { resolveWheelColor } from './utils/resolveWheelColor';\nimport { resolveWheelColorComponents } from './utils/resolveWheelColorComponents';\n\nconst VIEWBOX = 1000;\nconst CENTER = VIEWBOX / 2;\nconst RADIUS = 480;\nconst SEGMENTS = 96;\nconst MAX_CHROMA = 0.2;\n\n/*** Renders a size-owned, filled OKLCH wheel with controlled primary and harmony points. */\nexport const ColorWheel = withZoraThemeScope(ColorWheelInner);\n\n/*** Maps pointer and keyboard input through one viewBox into the controlled selected colour. */\nfunction ColorWheelInner({\n themeId: _themeId,\n mode: _mode,\n inverted: _inverted,\n interactionPolicy,\n value,\n harmony = null,\n onChange,\n size = 340,\n testID,\n}: ColorWheelProps) {\n const { theme } = useZoraTheme();\n const hue = resolveColorHue(value);\n const { chroma, lightness } = resolveWheelColorComponents(value);\n const primaryPoint = pointFor(hue, Math.min(1, chroma / MAX_CHROMA));\n const harmonyPoints = harmony\n ? generateHarmonyRoleColors(value, harmony).colors.map((color) => pointFor(color.hueDegrees))\n : [];\n const gradientId = `color-wheel-${React.useId().replaceAll(':', '')}`;\n const changeAt = (x: number, y: number) => {\n if (interactionPolicy !== 'passive')\n onChange({ color: resolveWheelColor(value, x, y, CENTER, RADIUS, MAX_CHROMA), harmony });\n };\n return (\n <ColorWheelKeyboardProxy\n chroma={chroma}\n disabled={interactionPolicy === 'passive'}\n hue={hue}\n onChange={(nextHue, nextChroma) =>\n onChange({ color: resolveOklchColor({ chroma: nextChroma, lightness }, nextHue), harmony })\n }\n >\n <ColorWheelPointerProxy\n disabled={interactionPolicy === 'passive'}\n height={VIEWBOX}\n onChange={changeAt}\n width={VIEWBOX}\n >\n <Svg\n accessibilityLabel=\"Color wheel\"\n height={size}\n onResponderGrant={(event) =>\n changeAt(\n (event.nativeEvent.locationX / size) * VIEWBOX,\n (event.nativeEvent.locationY / size) * VIEWBOX,\n )\n }\n onResponderMove={(event) =>\n changeAt(\n (event.nativeEvent.locationX / size) * VIEWBOX,\n (event.nativeEvent.locationY / size) * VIEWBOX,\n )\n }\n onResponderRelease={(event) =>\n changeAt(\n (event.nativeEvent.locationX / size) * VIEWBOX,\n (event.nativeEvent.locationY / size) * VIEWBOX,\n )\n }\n onStartShouldSetResponder={() => interactionPolicy !== 'passive'}\n testID={testID}\n viewBox={`0 0 ${VIEWBOX} ${VIEWBOX}`}\n width={size}\n >\n <Defs>\n {segments().map((segment) => (\n <RadialGradient\n cx={CENTER}\n cy={CENTER}\n id={`${gradientId}-${segment.hue}`}\n key={segment.hue}\n r={RADIUS}\n >\n <Stop\n offset=\"0\"\n stopColor={resolveOklchColor({ chroma: 0, lightness: 0.72 }, segment.hue)}\n />\n <Stop offset=\"1\" stopColor={segment.color} />\n </RadialGradient>\n ))}\n </Defs>\n {segments().map((segment) => (\n <Path d={segment.path} fill={`url(#${gradientId}-${segment.hue})`} key={segment.hue} />\n ))}\n {harmonyPoints.length === 3 ? (\n <Polygon\n fill=\"none\"\n points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')}\n stroke={theme.semantics.content.default}\n strokeWidth={6}\n />\n ) : (\n linesFor(harmonyPoints, primaryPoint, theme.semantics.content.default)\n )}\n {harmonyPoints.map((point) => (\n <Circle\n cx={point.x}\n cy={point.y}\n fill={theme.semantics.content.default}\n key={`${point.x}-${point.y}`}\n r={26}\n />\n ))}\n <Circle\n cx={primaryPoint.x}\n cy={primaryPoint.y}\n fill=\"none\"\n r={36}\n stroke=\"white\"\n strokeWidth={12}\n />\n <Circle\n cx={primaryPoint.x}\n cy={primaryPoint.y}\n fill=\"none\"\n r={42}\n stroke={theme.semantics.content.default}\n strokeWidth={6}\n />\n </Svg>\n </ColorWheelPointerProxy>\n </ColorWheelKeyboardProxy>\n );\n}\n\n/*** Creates continuous-looking radial hue segments for the wheel viewBox. */\nfunction segments(): readonly {\n readonly color: HexColor;\n readonly hue: number;\n readonly path: string;\n}[] {\n return Array.from({ length: SEGMENTS }, (_, index) => {\n const hue = (index * 360) / SEGMENTS;\n return {\n color: resolveOklchColor({ chroma: MAX_CHROMA, lightness: 0.65 }, hue),\n hue,\n path: segmentPath(hue, hue + 360 / SEGMENTS),\n };\n });\n}\n\n/*** Describes one filled wheel segment in the stable coordinate system. */\nfunction segmentPath(start: number, end: number) {\n const startPoint = pointFor(start);\n const endPoint = pointFor(end);\n return `M ${CENTER} ${CENTER} L ${startPoint.x} ${startPoint.y} A ${RADIUS} ${RADIUS} 0 0 1 ${endPoint.x} ${endPoint.y} Z`;\n}\n\n/*** Projects an OKLCH hue and chroma ratio into the wheel coordinate system. */\nfunction pointFor(hue: number, ratio = 1) {\n const radians = ((hue - 90) * Math.PI) / 180;\n return {\n x: CENTER + RADIUS * ratio * Math.cos(radians),\n y: CENTER + RADIUS * ratio * Math.sin(radians),\n };\n}\n\n/*** Connects derived harmony points behind their corresponding knobs. */\nfunction linesFor(\n points: readonly { readonly x: number; readonly y: number }[],\n primary: { readonly x: number; readonly y: number },\n stroke: string,\n) {\n return points.slice(1).reduce(\n ({ lines, previous }, point) => ({\n lines: [\n ...lines,\n <Line\n key={`${previous.x}-${previous.y}-${point.x}-${point.y}`}\n stroke={stroke}\n strokeWidth={6}\n x1={previous.x}\n x2={point.x}\n y1={previous.y}\n y2={point.y}\n />,\n ],\n previous: point,\n }),\n { lines: [] as React.ReactNode[], previous: points.at(0) ?? primary },\n ).lines;\n}\n"]}
1
+ {"version":3,"file":"ColorWheel.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAiB,MAAM,yBAAyB,CAA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E,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACf,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CACZ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACf,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EACZ;SACH;QACD,QAAQ,EAAE,KAAK;KAChB,CAAC,EACF,EAAE,KAAK,EAAE,EAAuB,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CACtE,CAAC,KAAK,CAAC;AACV,CAAC","sourcesContent":["import { generateHarmonyRoleColors, type HexColor } from '@ankhorage/color-theory';\nimport React from 'react';\nimport { Circle, Defs, Line, Path, Polygon, RadialGradient, Stop, Svg } from 'react-native-svg';\n\nimport type { ColorWheelProps } from '../../types/color';\nimport { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';\nimport { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy';\nimport { ColorWheelPointerProxy } from './ColorWheelPointerProxy';\nimport { resolveColorHue } from './utils/resolveColorHue';\nimport { resolveOklchColor } from './utils/resolveOklchColor';\nimport { resolveWheelColor } from './utils/resolveWheelColor';\nimport { resolveWheelColorComponents } from './utils/resolveWheelColorComponents';\n\nconst VIEWBOX = 1000;\nconst CENTER = VIEWBOX / 2;\nconst RADIUS = 480;\nconst SEGMENTS = 720;\nconst MAX_CHROMA = 0.2;\n\n/*** Renders a size-owned, filled OKLCH wheel with controlled primary and harmony points. */\nexport const ColorWheel = withZoraThemeScope(ColorWheelInner);\n\n/*** Maps pointer and keyboard input through one viewBox into the controlled selected colour. */\nfunction ColorWheelInner({\n themeId: _themeId,\n mode: _mode,\n inverted: _inverted,\n interactionPolicy,\n value,\n harmony = null,\n toneTarget,\n onChange,\n size = 340,\n testID,\n}: ColorWheelProps) {\n const hue = resolveColorHue(value);\n const { chroma, lightness } = resolveWheelColorComponents(value);\n const targetLightness = toneTarget?.lightness ?? lightness;\n const maximumChroma = toneTarget?.chroma ?? MAX_CHROMA;\n const primaryPoint = pointFor(hue, Math.min(1, chroma / maximumChroma));\n const harmonyRoles = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];\n const harmonyPoints = harmonyRoles.map((role) => ({\n color: role.hex,\n ...pointFor(\n role.hueDegrees,\n Math.min(1, resolveWheelColorComponents(role.hex).chroma / maximumChroma),\n ),\n }));\n const gradientId = `color-wheel-${React.useId().replaceAll(':', '')}`;\n const changeAt = (x: number, y: number) => {\n if (interactionPolicy !== 'passive')\n onChange({\n color: resolveWheelColor(value, x, y, CENTER, RADIUS, maximumChroma, targetLightness),\n harmony,\n });\n };\n return (\n <ColorWheelKeyboardProxy\n chroma={chroma}\n disabled={interactionPolicy === 'passive'}\n hue={hue}\n maxChroma={maximumChroma}\n onChange={(nextHue, nextChroma) =>\n onChange({\n color: resolveOklchColor({ chroma: nextChroma, lightness: targetLightness }, nextHue),\n harmony,\n })\n }\n >\n <ColorWheelPointerProxy\n disabled={interactionPolicy === 'passive'}\n height={VIEWBOX}\n onChange={changeAt}\n renderedSize={size}\n width={VIEWBOX}\n >\n <Svg\n accessibilityLabel=\"Color wheel\"\n height={size}\n testID={testID}\n viewBox={`0 0 ${VIEWBOX} ${VIEWBOX}`}\n width={size}\n >\n <Defs>\n {segments(targetLightness, maximumChroma).map((segment) => (\n <RadialGradient\n cx={CENTER}\n cy={CENTER}\n gradientUnits=\"userSpaceOnUse\"\n id={`${gradientId}-${segment.hue}`}\n key={segment.hue}\n r={RADIUS}\n >\n <Stop offset=\"0\" stopColor={segment.centerColor} />\n <Stop offset=\"1\" stopColor={segment.color} />\n </RadialGradient>\n ))}\n </Defs>\n {segments(targetLightness, maximumChroma).map((segment) => (\n <Path d={segment.path} fill={`url(#${gradientId}-${segment.hue})`} key={segment.hue} />\n ))}\n {harmonyPoints.length >= 3 ? (\n <Polygon\n fill=\"none\"\n points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')}\n stroke=\"white\"\n strokeWidth={6}\n />\n ) : (\n linesFor(harmonyPoints, primaryPoint, 'white')\n )}\n {harmonyPoints\n .filter((point) => point.color !== value)\n .map((point) => (\n <Circle\n cx={point.x}\n cy={point.y}\n fill={point.color}\n key={`${point.x}-${point.y}`}\n stroke=\"white\"\n strokeWidth={6}\n r={26}\n />\n ))}\n <Circle\n cx={primaryPoint.x}\n cy={primaryPoint.y}\n fill={value}\n r={36}\n stroke=\"white\"\n strokeWidth={12}\n />\n <Circle\n cx={primaryPoint.x}\n cy={primaryPoint.y}\n fill=\"none\"\n r={42}\n stroke=\"white\"\n strokeWidth={6}\n />\n </Svg>\n </ColorWheelPointerProxy>\n </ColorWheelKeyboardProxy>\n );\n}\n\n/*** Creates fine radial hue segments from the same OKLCH projection used for interaction. */\nfunction segments(\n lightness: number,\n maximumChroma: number,\n): readonly {\n readonly centerColor: HexColor;\n readonly color: HexColor;\n readonly hue: number;\n readonly path: string;\n}[] {\n return Array.from({ length: SEGMENTS }, (_, index) => {\n const hue = (index * 360) / SEGMENTS;\n return {\n centerColor: resolveOklchColor({ chroma: 0, lightness }, hue),\n color: resolveOklchColor({ chroma: maximumChroma, lightness }, hue),\n hue,\n path: segmentPath(hue, hue + 360 / SEGMENTS),\n };\n });\n}\n\n/*** Describes one filled wheel segment in the stable coordinate system. */\nfunction segmentPath(start: number, end: number) {\n const startPoint = pointFor(start);\n const endPoint = pointFor(end);\n return `M ${CENTER} ${CENTER} L ${startPoint.x} ${startPoint.y} A ${RADIUS} ${RADIUS} 0 0 1 ${endPoint.x} ${endPoint.y} Z`;\n}\n\n/*** Projects an OKLCH hue and chroma ratio into the wheel coordinate system. */\nfunction pointFor(hue: number, ratio = 1) {\n const radians = ((hue - 90) * Math.PI) / 180;\n return {\n x: CENTER + RADIUS * ratio * Math.cos(radians),\n y: CENTER + RADIUS * ratio * Math.sin(radians),\n };\n}\n\n/*** Connects derived harmony points behind their corresponding knobs. */\nfunction linesFor(\n points: readonly { readonly x: number; readonly y: number }[],\n primary: { readonly x: number; readonly y: number },\n stroke: string,\n) {\n return points.slice(1).reduce(\n ({ lines, previous }, point) => ({\n lines: [\n ...lines,\n <Line\n key={`${previous.x}-${previous.y}-${point.x}-${point.y}`}\n stroke={stroke}\n strokeWidth={6}\n x1={previous.x}\n x2={point.x}\n y1={previous.y}\n y2={point.y}\n />,\n ],\n previous: point,\n }),\n { lines: [] as React.ReactNode[], previous: points.at(0) ?? primary },\n ).lines;\n}\n"]}
@@ -5,6 +5,7 @@ export interface ColorWheelKeyboardProxyProps {
5
5
  readonly chroma: number;
6
6
  readonly disabled: boolean;
7
7
  readonly hue: number;
8
+ readonly maxChroma?: number;
8
9
  readonly onChange: (hue: number, chroma: number) => void;
9
10
  }
10
11
  //# sourceMappingURL=ColorWheelKeyboardProxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheelKeyboardProxy.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1D"}
1
+ {"version":3,"file":"ColorWheelKeyboardProxy.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheelKeyboardProxy.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC","sourcesContent":["import type React from 'react';\n\nexport { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy.native';\n\nexport interface ColorWheelKeyboardProxyProps {\n readonly children: React.ReactNode;\n readonly chroma: number;\n readonly disabled: boolean;\n readonly hue: number;\n readonly onChange: (hue: number, chroma: number) => void;\n}\n"]}
1
+ {"version":3,"file":"ColorWheelKeyboardProxy.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC","sourcesContent":["import type React from 'react';\n\nexport { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy.native';\n\nexport interface ColorWheelKeyboardProxyProps {\n readonly children: React.ReactNode;\n readonly chroma: number;\n readonly disabled: boolean;\n readonly hue: number;\n readonly maxChroma?: number;\n readonly onChange: (hue: number, chroma: number) => void;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
2
  import type { ColorWheelKeyboardProxyProps } from './ColorWheelKeyboardProxy';
3
3
  /*** Bridges browser keyboard input to controlled OKLCH wheel hue and chroma changes. */
4
- export declare function ColorWheelKeyboardProxy({ children, chroma, disabled, hue, onChange, }: ColorWheelKeyboardProxyProps): React.JSX.Element;
4
+ export declare function ColorWheelKeyboardProxy({ children, chroma, disabled, hue, maxChroma, onChange, }: ColorWheelKeyboardProxyProps): React.JSX.Element;
5
5
  //# sourceMappingURL=ColorWheelKeyboardProxy.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheelKeyboardProxy.web.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAE9E,wFAAwF;AACxF,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,GAAG,EACH,QAAQ,GACT,EAAE,4BAA4B,qBAqB9B"}
1
+ {"version":3,"file":"ColorWheelKeyboardProxy.web.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAE9E,wFAAwF;AACxF,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,GAAG,EACH,SAAe,EACf,QAAQ,GACT,EAAE,4BAA4B,qBAqB9B"}
@@ -1,7 +1,7 @@
1
1
  /*** Bridges browser keyboard input to controlled OKLCH wheel hue and chroma changes. */
2
- export function ColorWheelKeyboardProxy({ children, chroma, disabled, hue, onChange, }) {
2
+ export function ColorWheelKeyboardProxy({ children, chroma, disabled, hue, maxChroma = 0.2, onChange, }) {
3
3
  return (<div aria-label={`Color wheel, hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`} aria-valuemax={360} aria-valuemin={0} aria-valuenow={Math.round(hue)} aria-valuetext={`Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`} aria-disabled={disabled} onKeyDown={(event) => {
4
- const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma);
4
+ const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma, maxChroma);
5
5
  if (!nextValue || disabled)
6
6
  return;
7
7
  event.preventDefault();
@@ -11,7 +11,7 @@ export function ColorWheelKeyboardProxy({ children, chroma, disabled, hue, onCha
11
11
  </div>);
12
12
  }
13
13
  /*** Resolve portable arrow keys into bounded color-wheel increments. */
14
- function resolveKeyboardWheelValue(key, hue, chroma) {
14
+ function resolveKeyboardWheelValue(key, hue, chroma, maxChroma) {
15
15
  if (key === 'ArrowLeft')
16
16
  return { chroma, hue: normalizeHue(hue - 5) };
17
17
  if (key === 'ArrowRight')
@@ -19,7 +19,7 @@ function resolveKeyboardWheelValue(key, hue, chroma) {
19
19
  if (key === 'ArrowDown')
20
20
  return { chroma: Math.max(0, chroma - 0.02), hue };
21
21
  if (key === 'ArrowUp')
22
- return { chroma: Math.min(0.2, chroma + 0.02), hue };
22
+ return { chroma: Math.min(maxChroma, chroma + 0.02), hue };
23
23
  return undefined;
24
24
  }
25
25
  /*** Normalize keyboard hue increments to the slider's documented range. */
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheelKeyboardProxy.web.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.web.tsx"],"names":[],"mappings":"AAIA,wFAAwF;AACxF,MAAM,UAAU,uBAAuB,CAAC,EACtC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,GAAG,EACH,QAAQ,GACqB;IAC7B,OAAO,CACL,CAAC,GAAG,CACF,UAAU,CAAC,CAAC,oBAAoB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/E,aAAa,CAAC,CAAC,GAAG,CAAC,CACnB,aAAa,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AAG,KAAK,SAAS;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAC5E,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,2EAA2E;AAC3E,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC5D,CAAC","sourcesContent":["import type React from 'react';\n\nimport type { ColorWheelKeyboardProxyProps } from './ColorWheelKeyboardProxy';\n\n/*** Bridges browser keyboard input to controlled OKLCH wheel hue and chroma changes. */\nexport function ColorWheelKeyboardProxy({\n children,\n chroma,\n disabled,\n hue,\n onChange,\n}: ColorWheelKeyboardProxyProps) {\n return (\n <div\n aria-label={`Color wheel, hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`}\n aria-valuemax={360}\n aria-valuemin={0}\n aria-valuenow={Math.round(hue)}\n aria-valuetext={`Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`}\n aria-disabled={disabled}\n onKeyDown={(event) => {\n const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma);\n if (!nextValue || disabled) return;\n event.preventDefault();\n onChange(nextValue.hue, nextValue.chroma);\n }}\n role=\"slider\"\n tabIndex={disabled ? -1 : 0}\n >\n {children}\n </div>\n );\n}\n\n/*** Resolve portable arrow keys into bounded color-wheel increments. */\nfunction resolveKeyboardWheelValue(key: string, hue: number, chroma: number) {\n if (key === 'ArrowLeft') return { chroma, hue: normalizeHue(hue - 5) };\n if (key === 'ArrowRight') return { chroma, hue: normalizeHue(hue + 5) };\n if (key === 'ArrowDown') return { chroma: Math.max(0, chroma - 0.02), hue };\n if (key === 'ArrowUp') return { chroma: Math.min(0.2, chroma + 0.02), hue };\n return undefined;\n}\n\n/*** Normalize keyboard hue increments to the slider's documented range. */\nfunction normalizeHue(hue: number): number {\n return hue < 0 ? hue + 360 : hue >= 360 ? hue - 360 : hue;\n}\n"]}
1
+ {"version":3,"file":"ColorWheelKeyboardProxy.web.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.web.tsx"],"names":[],"mappings":"AAIA,wFAAwF;AACxF,MAAM,UAAU,uBAAuB,CAAC,EACtC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,GAAG,EACH,SAAS,GAAG,GAAG,EACf,QAAQ,GACqB;IAC7B,OAAO,CACL,CAAC,GAAG,CACF,UAAU,CAAC,CAAC,oBAAoB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/E,aAAa,CAAC,CAAC,GAAG,CAAC,CACnB,aAAa,CAAC,CAAC,CAAC,CAAC,CACjB,aAAa,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAC/B,cAAc,CAAC,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CACtE,aAAa,CAAC,CAAC,QAAQ,CAAC,CACxB,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACnB,MAAM,SAAS,GAAG,yBAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;YAC/E,IAAI,CAAC,SAAS,IAAI,QAAQ;gBAAE,OAAO;YACnC,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC,CAAC,CACF,IAAI,CAAC,QAAQ,CACb,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAE5B;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC;AAED,wEAAwE;AACxE,SAAS,yBAAyB,CAAC,GAAW,EAAE,GAAW,EAAE,MAAc,EAAE,SAAiB;IAC5F,IAAI,GAAG,KAAK,WAAW;QAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;IACvE,IAAI,GAAG,KAAK,YAAY;QAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;IACxE,IAAI,GAAG,KAAK,WAAW;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAC5E,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAClF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,2EAA2E;AAC3E,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC5D,CAAC","sourcesContent":["import type React from 'react';\n\nimport type { ColorWheelKeyboardProxyProps } from './ColorWheelKeyboardProxy';\n\n/*** Bridges browser keyboard input to controlled OKLCH wheel hue and chroma changes. */\nexport function ColorWheelKeyboardProxy({\n children,\n chroma,\n disabled,\n hue,\n maxChroma = 0.2,\n onChange,\n}: ColorWheelKeyboardProxyProps) {\n return (\n <div\n aria-label={`Color wheel, hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`}\n aria-valuemax={360}\n aria-valuemin={0}\n aria-valuenow={Math.round(hue)}\n aria-valuetext={`Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`}\n aria-disabled={disabled}\n onKeyDown={(event) => {\n const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma, maxChroma);\n if (!nextValue || disabled) return;\n event.preventDefault();\n onChange(nextValue.hue, nextValue.chroma);\n }}\n role=\"slider\"\n tabIndex={disabled ? -1 : 0}\n >\n {children}\n </div>\n );\n}\n\n/*** Resolve portable arrow keys into bounded color-wheel increments. */\nfunction resolveKeyboardWheelValue(key: string, hue: number, chroma: number, maxChroma: number) {\n if (key === 'ArrowLeft') return { chroma, hue: normalizeHue(hue - 5) };\n if (key === 'ArrowRight') return { chroma, hue: normalizeHue(hue + 5) };\n if (key === 'ArrowDown') return { chroma: Math.max(0, chroma - 0.02), hue };\n if (key === 'ArrowUp') return { chroma: Math.min(maxChroma, chroma + 0.02), hue };\n return undefined;\n}\n\n/*** Normalize keyboard hue increments to the slider's documented range. */\nfunction normalizeHue(hue: number): number {\n return hue < 0 ? hue + 360 : hue >= 360 ? hue - 360 : hue;\n}\n"]}
@@ -5,6 +5,7 @@ export interface ColorWheelPointerProxyProps {
5
5
  readonly disabled: boolean;
6
6
  readonly height: number;
7
7
  readonly onChange: (x: number, y: number) => void;
8
+ readonly renderedSize?: number;
8
9
  readonly width: number;
9
10
  }
10
11
  //# sourceMappingURL=ColorWheelPointerProxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheelPointerProxy.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB"}
1
+ {"version":3,"file":"ColorWheelPointerProxy.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheelPointerProxy.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC","sourcesContent":["import type React from 'react';\n\nexport { ColorWheelPointerProxy } from './ColorWheelPointerProxy.native';\n\nexport interface ColorWheelPointerProxyProps {\n readonly children: React.ReactNode;\n readonly disabled: boolean;\n readonly height: number;\n readonly onChange: (x: number, y: number) => void;\n readonly width: number;\n}\n"]}
1
+ {"version":3,"file":"ColorWheelPointerProxy.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC","sourcesContent":["import type React from 'react';\n\nexport { ColorWheelPointerProxy } from './ColorWheelPointerProxy.native';\n\nexport interface ColorWheelPointerProxyProps {\n readonly children: React.ReactNode;\n readonly disabled: boolean;\n readonly height: number;\n readonly onChange: (x: number, y: number) => void;\n readonly renderedSize?: number;\n readonly width: number;\n}\n"]}
@@ -1,4 +1,5 @@
1
+ import React from 'react';
1
2
  import type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';
2
- /*** Leaves native SVG responders in charge of direct color-wheel gestures. */
3
- export declare function ColorWheelPointerProxy({ children }: ColorWheelPointerProxyProps): import("react").ReactNode;
3
+ /*** Adds the sole native responder path to the SVG wheel. */
4
+ export declare function ColorWheelPointerProxy({ children, disabled, height, onChange, width, renderedSize, }: ColorWheelPointerProxyProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.ReactElement<Record<string, unknown>, string | React.JSXElementConstructor<any>> | null | undefined;
4
5
  //# sourceMappingURL=ColorWheelPointerProxy.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheelPointerProxy.native.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,8EAA8E;AAC9E,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,EAAE,2BAA2B,6BAE/E"}
1
+ {"version":3,"file":"ColorWheelPointerProxy.native.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,6DAA6D;AAC7D,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,KAAK,EACL,YAAoB,GACrB,EAAE,2BAA2B,wWAe7B"}
@@ -1,5 +1,14 @@
1
- /*** Leaves native SVG responders in charge of direct color-wheel gestures. */
2
- export function ColorWheelPointerProxy({ children }) {
3
- return children;
1
+ import React from 'react';
2
+ /*** Adds the sole native responder path to the SVG wheel. */
3
+ export function ColorWheelPointerProxy({ children, disabled, height, onChange, width, renderedSize = width, }) {
4
+ if (!React.isValidElement(children))
5
+ return children;
6
+ const changeAt = (event) => onChange((event.nativeEvent.locationX / renderedSize) * width, (event.nativeEvent.locationY / renderedSize) * height);
7
+ return React.cloneElement(children, {
8
+ onResponderGrant: disabled ? undefined : changeAt,
9
+ onResponderMove: disabled ? undefined : changeAt,
10
+ onResponderRelease: disabled ? undefined : changeAt,
11
+ onStartShouldSetResponder: () => !disabled,
12
+ });
4
13
  }
5
14
  //# sourceMappingURL=ColorWheelPointerProxy.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheelPointerProxy.native.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.native.tsx"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,MAAM,UAAU,sBAAsB,CAAC,EAAE,QAAQ,EAA+B;IAC9E,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';\n\n/*** Leaves native SVG responders in charge of direct color-wheel gestures. */\nexport function ColorWheelPointerProxy({ children }: ColorWheelPointerProxyProps) {\n return children;\n}\n"]}
1
+ {"version":3,"file":"ColorWheelPointerProxy.native.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,KAAK,EACL,YAAY,GAAG,KAAK,GACQ;IAC5B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IACrD,MAAM,QAAQ,GAAG,CAAC,KAEjB,EAAE,EAAE,CACH,QAAQ,CACN,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,GAAG,YAAY,CAAC,GAAG,KAAK,EACpD,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,GAAG,YAAY,CAAC,GAAG,MAAM,CACtD,CAAC;IACJ,OAAO,KAAK,CAAC,YAAY,CAAC,QAAuD,EAAE;QACjF,gBAAgB,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;QACjD,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;QAChD,kBAAkB,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;QACnD,yBAAyB,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ;KAC3C,CAAC,CAAC;AACL,CAAC","sourcesContent":["import React from 'react';\n\nimport type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';\n\n/*** Adds the sole native responder path to the SVG wheel. */\nexport function ColorWheelPointerProxy({\n children,\n disabled,\n height,\n onChange,\n width,\n renderedSize = width,\n}: ColorWheelPointerProxyProps) {\n if (!React.isValidElement(children)) return children;\n const changeAt = (event: {\n readonly nativeEvent: { readonly locationX: number; readonly locationY: number };\n }) =>\n onChange(\n (event.nativeEvent.locationX / renderedSize) * width,\n (event.nativeEvent.locationY / renderedSize) * height,\n );\n return React.cloneElement(children as React.ReactElement<Record<string, unknown>>, {\n onResponderGrant: disabled ? undefined : changeAt,\n onResponderMove: disabled ? undefined : changeAt,\n onResponderRelease: disabled ? undefined : changeAt,\n onStartShouldSetResponder: () => !disabled,\n });\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';
3
3
  /*** Maps mouse, pen and touch coordinates into the wheel viewBox for click and drag selection. */
4
- export declare function ColorWheelPointerProxy({ children, disabled, height, onChange, width, }: ColorWheelPointerProxyProps): React.JSX.Element;
4
+ export declare function ColorWheelPointerProxy({ children, disabled, height, onChange, renderedSize: _renderedSize, width, }: ColorWheelPointerProxyProps): React.JSX.Element;
5
5
  //# sourceMappingURL=ColorWheelPointerProxy.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheelPointerProxy.web.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,kGAAkG;AAClG,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,KAAK,GACN,EAAE,2BAA2B,qBAoC7B"}
1
+ {"version":3,"file":"ColorWheelPointerProxy.web.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,kGAAkG;AAClG,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EAAE,aAAa,EAC3B,KAAK,GACN,EAAE,2BAA2B,qBAoC7B"}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  /*** Maps mouse, pen and touch coordinates into the wheel viewBox for click and drag selection. */
3
- export function ColorWheelPointerProxy({ children, disabled, height, onChange, width, }) {
3
+ export function ColorWheelPointerProxy({ children, disabled, height, onChange, renderedSize: _renderedSize, width, }) {
4
4
  const dragging = React.useRef(false);
5
5
  const changeAt = (event) => {
6
6
  const target = event.currentTarget;
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheelPointerProxy.web.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,kGAAkG;AAClG,MAAM,UAAU,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,KAAK,GACuB;IAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,CAAC,KAAyC,EAAE,EAAE;QAC7D,MAAM,MAAM,GAAG,KAAK,CAAC,aAAgD,CAAC;QACtE,MAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAC5C,QAAQ,CACN,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,EAClD,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CACpD,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,GAAG,CACF,aAAa,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YAEtB,KAAK,CAAC,aACP,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACrC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,CAAC,CACF,aAAa,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO;gBAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrD,CAAC,CAAC,CACF,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACrB,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO;gBAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnD,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CACF,eAAe,CAAC,CAAC,GAAG,EAAE;YACpB,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CACF,KAAK,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAE/B;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';\n\n/*** Maps mouse, pen and touch coordinates into the wheel viewBox for click and drag selection. */\nexport function ColorWheelPointerProxy({\n children,\n disabled,\n height,\n onChange,\n width,\n}: ColorWheelPointerProxyProps) {\n const dragging = React.useRef(false);\n const changeAt = (event: React.PointerEvent<HTMLDivElement>) => {\n const target = event.currentTarget as unknown as BrowserPointerTarget;\n const rect = target.getBoundingClientRect();\n onChange(\n ((event.clientX - rect.left) / rect.width) * width,\n ((event.clientY - rect.top) / rect.height) * height,\n );\n };\n\n return (\n <div\n onPointerDown={(event) => {\n if (disabled) return;\n dragging.current = true;\n (\n event.currentTarget as unknown as { setPointerCapture: (pointerId: number) => void }\n ).setPointerCapture(event.pointerId);\n changeAt(event);\n }}\n onPointerMove={(event) => {\n if (!disabled && dragging.current) changeAt(event);\n }}\n onPointerUp={(event) => {\n if (!disabled && dragging.current) changeAt(event);\n dragging.current = false;\n }}\n onPointerCancel={() => {\n dragging.current = false;\n }}\n style={{ touchAction: 'none' }}\n >\n {children}\n </div>\n );\n}\n\ninterface BrowserPointerTarget {\n readonly getBoundingClientRect: () => {\n readonly height: number;\n readonly left: number;\n readonly top: number;\n readonly width: number;\n };\n}\n"]}
1
+ {"version":3,"file":"ColorWheelPointerProxy.web.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,kGAAkG;AAClG,MAAM,UAAU,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EAAE,aAAa,EAC3B,KAAK,GACuB;IAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,CAAC,KAAyC,EAAE,EAAE;QAC7D,MAAM,MAAM,GAAG,KAAK,CAAC,aAAgD,CAAC;QACtE,MAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAC5C,QAAQ,CACN,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,EAClD,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CACpD,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,GAAG,CACF,aAAa,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YAEtB,KAAK,CAAC,aACP,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACrC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,CAAC,CACF,aAAa,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO;gBAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrD,CAAC,CAAC,CACF,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACrB,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO;gBAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnD,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CACF,eAAe,CAAC,CAAC,GAAG,EAAE;YACpB,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CACF,KAAK,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAE/B;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';\n\n/*** Maps mouse, pen and touch coordinates into the wheel viewBox for click and drag selection. */\nexport function ColorWheelPointerProxy({\n children,\n disabled,\n height,\n onChange,\n renderedSize: _renderedSize,\n width,\n}: ColorWheelPointerProxyProps) {\n const dragging = React.useRef(false);\n const changeAt = (event: React.PointerEvent<HTMLDivElement>) => {\n const target = event.currentTarget as unknown as BrowserPointerTarget;\n const rect = target.getBoundingClientRect();\n onChange(\n ((event.clientX - rect.left) / rect.width) * width,\n ((event.clientY - rect.top) / rect.height) * height,\n );\n };\n\n return (\n <div\n onPointerDown={(event) => {\n if (disabled) return;\n dragging.current = true;\n (\n event.currentTarget as unknown as { setPointerCapture: (pointerId: number) => void }\n ).setPointerCapture(event.pointerId);\n changeAt(event);\n }}\n onPointerMove={(event) => {\n if (!disabled && dragging.current) changeAt(event);\n }}\n onPointerUp={(event) => {\n if (!disabled && dragging.current) changeAt(event);\n dragging.current = false;\n }}\n onPointerCancel={() => {\n dragging.current = false;\n }}\n style={{ touchAction: 'none' }}\n >\n {children}\n </div>\n );\n}\n\ninterface BrowserPointerTarget {\n readonly getBoundingClientRect: () => {\n readonly height: number;\n readonly left: number;\n readonly top: number;\n readonly width: number;\n };\n}\n"]}
@@ -0,0 +1,31 @@
1
+ /*** Resolves one coherent ColorPicker geometry from the host's actual available bounds. */
2
+ export declare function resolveColorPickerGeometry(input: {
3
+ readonly height?: number;
4
+ readonly hostHeight?: number;
5
+ readonly hostWidth?: number;
6
+ readonly showTabs: boolean;
7
+ readonly width?: number;
8
+ }): {
9
+ insufficientSpace: boolean;
10
+ minimumHeight: number;
11
+ minimumWidth: number;
12
+ border: number;
13
+ cardGap: number;
14
+ cardHeight: number;
15
+ footerGap: number;
16
+ footerHeight: number;
17
+ footerInset: number;
18
+ gap: number;
19
+ headerHeight: number;
20
+ height: number;
21
+ infoLineHeight: number;
22
+ mainGap: number;
23
+ padding: number;
24
+ rail: number;
25
+ scale: number;
26
+ settingsHeight: number;
27
+ stage: number;
28
+ tabHeight: number;
29
+ width: number;
30
+ };
31
+ //# sourceMappingURL=resolveColorPickerGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveColorPickerGeometry.d.ts","sourceRoot":"","sources":["../../../src/features/color/resolveColorPickerGeometry.ts"],"names":[],"mappings":"AAGA,2FAA2F;AAC3F,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;;;;;;;;;;;;;;;;;;;;;;EAmBA"}
@@ -0,0 +1,94 @@
1
+ const MINIMUM_WIDTH = 360;
2
+ const REFERENCE_WIDTH = 560;
3
+ /*** Resolves one coherent ColorPicker geometry from the host's actual available bounds. */
4
+ export function resolveColorPickerGeometry(input) {
5
+ const availableWidth = Math.min(input.width ?? REFERENCE_WIDTH, input.hostWidth ?? REFERENCE_WIDTH);
6
+ const availableHeight = Math.min(input.height ?? Number.POSITIVE_INFINITY, input.hostHeight ?? Number.POSITIVE_INFINITY);
7
+ const minimum = resolveGeometryAtWidth(MINIMUM_WIDTH, input.showTabs);
8
+ const maximum = resolveGeometryAtWidth(Math.max(MINIMUM_WIDTH, availableWidth), input.showTabs);
9
+ const resolved = resolveLargestGeometry(maximum, availableHeight, input.showTabs);
10
+ return {
11
+ ...resolved,
12
+ insufficientSpace: availableWidth < MINIMUM_WIDTH || availableHeight < minimum.height,
13
+ minimumHeight: minimum.height,
14
+ minimumWidth: MINIMUM_WIDTH,
15
+ };
16
+ }
17
+ /*** Calculates every descendant measurement from a single continuous logical width. */
18
+ function resolveGeometryAtWidth(width, showTabs) {
19
+ const progress = Math.max(0, Math.min(1, (width - MINIMUM_WIDTH) / (REFERENCE_WIDTH - MINIMUM_WIDTH)));
20
+ const padding = interpolate(12, 24, progress);
21
+ const rail = interpolate(104, 150, progress);
22
+ const gap = interpolate(12, 20, progress);
23
+ const scale = interpolate(0.75, 1, progress);
24
+ const border = 1;
25
+ const stage = width - border * 2 - padding * 2 - rail - gap;
26
+ const headerHeight = 48 * scale;
27
+ const tabHeight = showTabs ? 48 * scale : 0;
28
+ const cardGap = 16 * scale;
29
+ const cardHeight = 52 * scale;
30
+ const settingsHeight = cardHeight * 2 + cardGap;
31
+ const mainHeight = Math.max(stage, settingsHeight);
32
+ const infoLineHeight = 20 * scale;
33
+ const mainGap = 16 * scale;
34
+ const footerGap = 10 * scale;
35
+ const footerHeight = 52 * scale;
36
+ const footerInset = 12 * scale;
37
+ const height = border * 2 +
38
+ padding +
39
+ headerHeight +
40
+ mainGap +
41
+ tabHeight +
42
+ (showTabs ? mainGap : 0) +
43
+ mainHeight +
44
+ mainGap +
45
+ infoLineHeight +
46
+ footerGap +
47
+ 1 +
48
+ footerGap +
49
+ footerHeight +
50
+ footerInset;
51
+ return {
52
+ border,
53
+ cardGap,
54
+ cardHeight,
55
+ footerGap,
56
+ footerHeight,
57
+ footerInset,
58
+ gap,
59
+ headerHeight,
60
+ height,
61
+ infoLineHeight,
62
+ mainGap,
63
+ padding,
64
+ rail,
65
+ scale,
66
+ settingsHeight,
67
+ stage,
68
+ tabHeight,
69
+ width,
70
+ };
71
+ }
72
+ /*** Finds the largest coherent width geometry that fits the available host height. */
73
+ function resolveLargestGeometry(maximum, height, showTabs) {
74
+ if (!Number.isFinite(height) || maximum.height <= height)
75
+ return maximum;
76
+ const minimum = resolveGeometryAtWidth(MINIMUM_WIDTH, showTabs);
77
+ if (height < minimum.height)
78
+ return minimum;
79
+ let lower = MINIMUM_WIDTH;
80
+ let upper = maximum.width;
81
+ for (let iteration = 0; iteration < 20; iteration += 1) {
82
+ const midpoint = (lower + upper) / 2;
83
+ if (resolveGeometryAtWidth(midpoint, showTabs).height <= height)
84
+ lower = midpoint;
85
+ else
86
+ upper = midpoint;
87
+ }
88
+ return resolveGeometryAtWidth(lower, showTabs);
89
+ }
90
+ /*** Interpolates a reference measurement without changing component hierarchy. */
91
+ function interpolate(minimum, reference, progress) {
92
+ return minimum + (reference - minimum) * progress;
93
+ }
94
+ //# sourceMappingURL=resolveColorPickerGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveColorPickerGeometry.js","sourceRoot":"","sources":["../../../src/features/color/resolveColorPickerGeometry.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,2FAA2F;AAC3F,MAAM,UAAU,0BAA0B,CAAC,KAM1C;IACC,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAC7B,KAAK,CAAC,KAAK,IAAI,eAAe,EAC9B,KAAK,CAAC,SAAS,IAAI,eAAe,CACnC,CAAC;IACF,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAC9B,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,iBAAiB,EACxC,KAAK,CAAC,UAA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CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,OAAO,CAAC;IACzE,MAAM,OAAO,GAAG,sBAAsB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAChE,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM;QAAE,OAAO,OAAO,CAAC;IAE5C,IAAI,KAAK,GAAG,aAAa,CAAC;IAC1B,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC1B,KAAK,IAAI,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,SAAS,IAAI,CAAC,EAAE,CAAC;QACvD,MAAM,QAAQ,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,MAAM,IAAI,MAAM;YAAE,KAAK,GAAG,QAAQ,CAAC;;YAC7E,KAAK,GAAG,QAAQ,CAAC;IACxB,CAAC;IACD,OAAO,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC;AAED,kFAAkF;AAClF,SAAS,WAAW,CAAC,OAAe,EAAE,SAAiB,EAAE,QAAgB;IACvE,OAAO,OAAO,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,QAAQ,CAAC;AACpD,CAAC","sourcesContent":["const MINIMUM_WIDTH = 360;\nconst REFERENCE_WIDTH = 560;\n\n/*** Resolves one coherent ColorPicker geometry from the host's actual available bounds. */\nexport function resolveColorPickerGeometry(input: {\n readonly height?: number;\n readonly hostHeight?: number;\n readonly hostWidth?: number;\n readonly showTabs: boolean;\n readonly width?: number;\n}) {\n const availableWidth = Math.min(\n input.width ?? REFERENCE_WIDTH,\n input.hostWidth ?? REFERENCE_WIDTH,\n );\n const availableHeight = Math.min(\n input.height ?? Number.POSITIVE_INFINITY,\n input.hostHeight ?? Number.POSITIVE_INFINITY,\n );\n const minimum = resolveGeometryAtWidth(MINIMUM_WIDTH, input.showTabs);\n const maximum = resolveGeometryAtWidth(Math.max(MINIMUM_WIDTH, availableWidth), input.showTabs);\n const resolved = resolveLargestGeometry(maximum, availableHeight, input.showTabs);\n\n return {\n ...resolved,\n insufficientSpace: availableWidth < MINIMUM_WIDTH || availableHeight < minimum.height,\n minimumHeight: minimum.height,\n minimumWidth: MINIMUM_WIDTH,\n };\n}\n\n/*** Calculates every descendant measurement from a single continuous logical width. */\nfunction resolveGeometryAtWidth(width: number, showTabs: boolean) {\n const progress = Math.max(\n 0,\n Math.min(1, (width - MINIMUM_WIDTH) / (REFERENCE_WIDTH - MINIMUM_WIDTH)),\n );\n const padding = interpolate(12, 24, progress);\n const rail = interpolate(104, 150, progress);\n const gap = interpolate(12, 20, progress);\n const scale = interpolate(0.75, 1, progress);\n const border = 1;\n const stage = width - border * 2 - padding * 2 - rail - gap;\n const headerHeight = 48 * scale;\n const tabHeight = showTabs ? 48 * scale : 0;\n const cardGap = 16 * scale;\n const cardHeight = 52 * scale;\n const settingsHeight = cardHeight * 2 + cardGap;\n const mainHeight = Math.max(stage, settingsHeight);\n const infoLineHeight = 20 * scale;\n const mainGap = 16 * scale;\n const footerGap = 10 * scale;\n const footerHeight = 52 * scale;\n const footerInset = 12 * scale;\n const height =\n border * 2 +\n padding +\n headerHeight +\n mainGap +\n tabHeight +\n (showTabs ? mainGap : 0) +\n mainHeight +\n mainGap +\n infoLineHeight +\n footerGap +\n 1 +\n footerGap +\n footerHeight +\n footerInset;\n\n return {\n border,\n cardGap,\n cardHeight,\n footerGap,\n footerHeight,\n footerInset,\n gap,\n headerHeight,\n height,\n infoLineHeight,\n mainGap,\n padding,\n rail,\n scale,\n settingsHeight,\n stage,\n tabHeight,\n width,\n };\n}\n\n/*** Finds the largest coherent width geometry that fits the available host height. */\nfunction resolveLargestGeometry(\n maximum: ReturnType<typeof resolveGeometryAtWidth>,\n height: number,\n showTabs: boolean,\n) {\n if (!Number.isFinite(height) || maximum.height <= height) return maximum;\n const minimum = resolveGeometryAtWidth(MINIMUM_WIDTH, showTabs);\n if (height < minimum.height) return minimum;\n\n let lower = MINIMUM_WIDTH;\n let upper = maximum.width;\n for (let iteration = 0; iteration < 20; iteration += 1) {\n const midpoint = (lower + upper) / 2;\n if (resolveGeometryAtWidth(midpoint, showTabs).height <= height) lower = midpoint;\n else upper = midpoint;\n }\n return resolveGeometryAtWidth(lower, showTabs);\n}\n\n/*** Interpolates a reference measurement without changing component hierarchy. */\nfunction interpolate(minimum: number, reference: number, progress: number) {\n return minimum + (reference - minimum) * progress;\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  import type { HexColor } from '@ankhorage/color-theory';
2
- /*** Resolve a wheel coordinate into a bounded OKLCH color while retaining the selected lightness. */
3
- export declare function resolveWheelColor(color: HexColor, x: number, y: number, center: number, radius: number, maxChroma: number): HexColor;
2
+ /*** Resolve a wheel coordinate into the same bounded OKLCH projection rendered by the wheel. */
3
+ export declare function resolveWheelColor(color: HexColor, x: number, y: number, center: number, radius: number, maxChroma: number, lightness?: number): HexColor;
4
4
  //# sourceMappingURL=resolveWheelColor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveWheelColor.d.ts","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveWheelColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAKxD,qGAAqG;AACrG,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,QAAQ,EACf,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,QAAQ,CASV"}
1
+ {"version":3,"file":"resolveWheelColor.d.ts","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveWheelColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAKxD,gGAAgG;AAChG,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,QAAQ,EACf,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,SAAS,SAA+C,GACvD,QAAQ,CAOV"}
@@ -1,8 +1,7 @@
1
1
  import { resolveOklchColor } from './resolveOklchColor';
2
2
  import { resolveWheelColorComponents } from './resolveWheelColorComponents';
3
- /*** Resolve a wheel coordinate into a bounded OKLCH color while retaining the selected lightness. */
4
- export function resolveWheelColor(color, x, y, center, radius, maxChroma) {
5
- const { lightness } = resolveWheelColorComponents(color);
3
+ /*** Resolve a wheel coordinate into the same bounded OKLCH projection rendered by the wheel. */
4
+ export function resolveWheelColor(color, x, y, center, radius, maxChroma, lightness = resolveWheelColorComponents(color).lightness) {
6
5
  const deltaX = x - center;
7
6
  const deltaY = y - center;
8
7
  const distance = Math.min(Math.hypot(deltaX, deltaY), radius);
@@ -1 +1 @@
1
- {"version":3,"file":"resolveWheelColor.js","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveWheelColor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,qGAAqG;AACrG,MAAM,UAAU,iBAAiB,CAC/B,KAAe,EACf,CAAS,EACT,CAAS,EACT,MAAc,EACd,MAAc,EACd,SAAiB;IAEjB,MAAM,EAAE,SAAS,EAAE,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC;IAEzD,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC;IAC1B,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC;IAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IAC9D,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,GAAG,SAAS,CAAC;IAC/C,OAAO,iBAAiB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC;AACvD,CAAC;AAED,qEAAqE;AACrE,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACnC,CAAC","sourcesContent":["import type { HexColor } from '@ankhorage/color-theory';\n\nimport { resolveOklchColor } from './resolveOklchColor';\nimport { resolveWheelColorComponents } from './resolveWheelColorComponents';\n\n/*** Resolve a wheel coordinate into a bounded OKLCH color while retaining the selected lightness. */\nexport function resolveWheelColor(\n color: HexColor,\n x: number,\n y: number,\n center: number,\n radius: number,\n maxChroma: number,\n): HexColor {\n const { lightness } = resolveWheelColorComponents(color);\n\n const deltaX = x - center;\n const deltaY = y - center;\n const distance = Math.min(Math.hypot(deltaX, deltaY), radius);\n const hue = normalizeHue((Math.atan2(deltaY, deltaX) * 180) / Math.PI + 90);\n const chroma = (distance / radius) * maxChroma;\n return resolveOklchColor({ lightness, chroma }, hue);\n}\n\n/*** Normalize an angular wheel coordinate to the OKLCH hue range. */\nfunction normalizeHue(hue: number): number {\n return hue < 0 ? hue + 360 : hue;\n}\n"]}
1
+ {"version":3,"file":"resolveWheelColor.js","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveWheelColor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,gGAAgG;AAChG,MAAM,UAAU,iBAAiB,CAC/B,KAAe,EACf,CAAS,EACT,CAAS,EACT,MAAc,EACd,MAAc,EACd,SAAiB,EACjB,SAAS,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC,SAAS;IAExD,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC;IAC1B,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC;IAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IAC9D,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,GAAG,SAAS,CAAC;IAC/C,OAAO,iBAAiB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC;AACvD,CAAC;AAED,qEAAqE;AACrE,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACnC,CAAC","sourcesContent":["import type { HexColor } from '@ankhorage/color-theory';\n\nimport { resolveOklchColor } from './resolveOklchColor';\nimport { resolveWheelColorComponents } from './resolveWheelColorComponents';\n\n/*** Resolve a wheel coordinate into the same bounded OKLCH projection rendered by the wheel. */\nexport function resolveWheelColor(\n color: HexColor,\n x: number,\n y: number,\n center: number,\n radius: number,\n maxChroma: number,\n lightness = resolveWheelColorComponents(color).lightness,\n): HexColor {\n const deltaX = x - center;\n const deltaY = y - center;\n const distance = Math.min(Math.hypot(deltaX, deltaY), radius);\n const hue = normalizeHue((Math.atan2(deltaY, deltaX) * 180) / Math.PI + 90);\n const chroma = (distance / radius) * maxChroma;\n return resolveOklchColor({ lightness, chroma }, hue);\n}\n\n/*** Normalize an angular wheel coordinate to the OKLCH hue range. */\nfunction normalizeHue(hue: number): number {\n return hue < 0 ? hue + 360 : hue;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Select.native.js","sourceRoot":"","sources":["../../../../../../src/features/form/select/adapters/inbound/Select.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA2B,UAAU,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC,iFAAiF;AACjF,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAEtD,iFAAiF;AACjF,SAAS,WAAW,CAAiC,EACnD,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,GAAG,KAAK,EACY;IACpB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IAC9C,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,KAAK,CAAC,iBAAiB,KAAK,SAAS,CAAC;IACtD,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;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AAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IAEnE,OAAO,CACL,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CACxB;MAAA,CAAC,aAAa,CACZ,YAAY,CAAC,CAAC,cAAc,EAAE,KAAK,CAAC,CACpC,YAAY,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,CAC3C,OAAO,CAAC,CAAC,UAAU,CAAC,CACpB,KAAK,CAAC,CAAC,KAAK,CAAC,EAEjB;IAAA,EAAE,WAAW,CAAC,CACf,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,WAAW,EAAE;QACX,OAAO,EAAE,EAAE;KACZ;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { type ListRenderItemInfo, StyleSheet } from 'react-native';\n\nimport type { SelectOption, SelectProps } from '../../../../../types/select';\nimport { BottomSheetFlatList, useBottomSheet } from '../../../../bottom-sheet/public';\nimport { withZoraThemeScope } from '../../../../theme/adapters/inbound/withZoraThemeScope';\nimport { SelectField } from '../../composition/SelectField';\nimport { SelectOptionRow } from '../../composition/SelectOptionRow';\nimport { SelectTrigger } from '../../composition/SelectTrigger';\nimport { useSelectController } from '../../composition/useSelectController';\n\nconst SELECT_SHEET_MAX_HEIGHT = 480;\n\n/*** Renders Select with BottomSheetFlatList presentation on native platforms. */\nexport const Select = withZoraThemeScope(SelectInner);\n\n/*** Connects shared Select state and controls to the native BottomSheet host. */\nfunction SelectInner<TValue extends string = string>({\n themeId: _themeId,\n mode: _mode,\n ...props\n}: SelectProps<TValue>) {\n const { dismiss, present } = useBottomSheet();\n const { select, selectedOption, value } = useSelectController(props);\n const passive = props.interactionPolicy === 'passive';\n const { disabled, interactionPolicy, options, readOnly, testID } = props;\n const listData = React.useMemo(() => [...options], [options]);\n\n const handleSelect = React.useCallback(\n (nextValue: TValue) => {\n select(nextValue);\n dismiss();\n },\n [dismiss, select],\n );\n\n const renderOption = React.useCallback(\n ({ item }: ListRenderItemInfo<SelectOption<TValue>>) => (\n <SelectOptionRow\n interactionPolicy={interactionPolicy}\n onSelect={handleSelect}\n option={item}\n selected={value === item.value}\n testID={testID}\n />\n ),\n [handleSelect, interactionPolicy, testID, value],\n );\n\n const openSelect = React.useCallback(() => {\n if (disabled || readOnly || passive) return;\n\n present({\n contentMode: 'direct',\n maxDynamicContentSize: SELECT_SHEET_MAX_HEIGHT,\n content: (\n <BottomSheetFlatList\n contentContainerStyle={styles.listContent}\n data={listData}\n keyExtractor={(item) => item.value}\n renderItem={renderOption}\n />\n ),\n });\n }, [disabled, listData, passive, present, readOnly, renderOption]);\n\n return (\n <SelectField props={props}>\n <SelectTrigger\n displayLabel={selectedOption?.label}\n leadingMedia={selectedOption?.leadingMedia}\n onPress={openSelect}\n props={props}\n />\n </SelectField>\n );\n}\n\nconst styles = StyleSheet.create({\n listContent: {\n padding: 16,\n },\n});\n"]}
1
+ {"version":3,"file":"Select.native.js","sourceRoot":"","sources":["../../../../../../src/features/form/select/adapters/inbound/Select.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA2B,UAAU,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC,iFAAiF;AACjF,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAE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Q,IAAI,QAAQ,IAAI,OAAO;YAAE,OAAO;QAE5C,OAAO,CAAC;YACN,WAAW,EAAE,QAAQ;YACrB,qBAAqB,EAAE,uBAAuB;YAC9C,OAAO,EAAE,CACP,CAAC,mBAAmB,CAClB,qBAAqB,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAC1C,IAAI,CAAC,CAAC,QAAQ,CAAC,CACf,YAAY,CAAC,CAAC,CAAC,IAA0B,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CACzD,UAAU,CAAC,CAAC,YAAY,CAAC,EACzB,CACH;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IAEnE,OAAO,CACL,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CACxB;MAAA,CAAC,aAAa,CACZ,YAAY,CAAC,CAAC,cAAc,EAAE,KAAK,CAAC,CACpC,YAAY,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,CAC3C,OAAO,CAAC,CAAC,UAAU,CAAC,CACpB,KAAK,CAAC,CAAC,KAAK,CAAC,EAEjB;IAAA,EAAE,WAAW,CAAC,CACf,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,WAAW,EAAE;QACX,OAAO,EAAE,EAAE;KACZ;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { type ListRenderItemInfo, StyleSheet } from 'react-native';\n\nimport type { SelectOption, SelectProps } from '../../../../../types/select';\nimport { BottomSheetFlatList, useBottomSheet } from '../../../../bottom-sheet/public';\nimport { withZoraThemeScope } from '../../../../theme/adapters/inbound/withZoraThemeScope';\nimport { SelectField } from '../../composition/SelectField';\nimport { SelectOptionRow } from '../../composition/SelectOptionRow';\nimport { SelectTrigger } from '../../composition/SelectTrigger';\nimport { useSelectController } from '../../composition/useSelectController';\n\nconst SELECT_SHEET_MAX_HEIGHT = 480;\n\n/*** Renders Select with BottomSheetFlatList presentation on native platforms. */\nexport const Select = withZoraThemeScope(SelectInner);\n\n/*** Connects shared Select state and controls to the native BottomSheet host. */\nfunction SelectInner<TValue extends string = string>({\n themeId: _themeId,\n mode: _mode,\n ...props\n}: SelectProps<TValue>) {\n const { dismiss, present } = useBottomSheet();\n const { select, selectedOption, value } = useSelectController(props);\n const passive = props.interactionPolicy === 'passive';\n const { disabled, interactionPolicy, options, readOnly, testID } = props;\n const listData = React.useMemo(() => [...options], [options]);\n\n const handleSelect = React.useCallback(\n (nextValue: TValue) => {\n select(nextValue);\n dismiss();\n },\n [dismiss, select],\n );\n\n const renderOption = React.useCallback(\n ({ item }: ListRenderItemInfo<SelectOption<TValue>>) => (\n <SelectOptionRow\n interactionPolicy={interactionPolicy}\n onSelect={handleSelect}\n option={item}\n selected={value === item.value}\n testID={testID}\n />\n ),\n [handleSelect, interactionPolicy, testID, value],\n );\n\n const openSelect = React.useCallback(() => {\n if (disabled || readOnly || passive) return;\n\n present({\n contentMode: 'direct',\n maxDynamicContentSize: SELECT_SHEET_MAX_HEIGHT,\n content: (\n <BottomSheetFlatList\n contentContainerStyle={styles.listContent}\n data={listData}\n keyExtractor={(item: SelectOption<TValue>) => item.value}\n renderItem={renderOption}\n />\n ),\n });\n }, [disabled, listData, passive, present, readOnly, renderOption]);\n\n return (\n <SelectField props={props}>\n <SelectTrigger\n displayLabel={selectedOption?.label}\n leadingMedia={selectedOption?.leadingMedia}\n onPress={openSelect}\n props={props}\n />\n </SelectField>\n );\n}\n\nconst styles = StyleSheet.create({\n listContent: {\n padding: 16,\n },\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectTrigger.d.ts","sourceRoot":"","sources":["../../../../../src/features/form/select/composition/SelectTrigger.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAU5D,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,MAAM,SAAS,MAAM,EAAE,EACnD,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,KAAK,GACN,EAAE,kBAAkB,CAAC,MAAM,CAAC,+BA0D5B;AAED,UAAU,kBAAkB,CAAC,MAAM,SAAS,MAAM;IAChD,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;IAClD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC5B"}
1
+ {"version":3,"file":"SelectTrigger.d.ts","sourceRoot":"","sources":["../../../../../src/features/form/select/composition/SelectTrigger.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAU5D,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,MAAM,SAAS,MAAM,EAAE,EACnD,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,KAAK,GACN,EAAE,kBAAkB,CAAC,MAAM,CAAC,+BA2D5B;AAED,UAAU,kBAAkB,CAAC,MAAM,SAAS,MAAM;IAChD,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;IAClD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC5B"}