@ankhorage/zora 27.11.3 → 28.1.0

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 (288) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +4 -3
  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 -4
  7. package/dist/features/color/ColorHexField.js.map +1 -1
  8. package/dist/features/color/ColorPicker.d.ts +1 -1
  9. package/dist/features/color/ColorPicker.d.ts.map +1 -1
  10. package/dist/features/color/ColorPicker.js +174 -59
  11. package/dist/features/color/ColorPicker.js.map +1 -1
  12. package/dist/features/color/ColorWheel.d.ts +1 -1
  13. package/dist/features/color/ColorWheel.d.ts.map +1 -1
  14. package/dist/features/color/ColorWheel.js +61 -117
  15. package/dist/features/color/ColorWheel.js.map +1 -1
  16. package/dist/features/color/ColorWheelKeyboardProxy.d.ts +1 -0
  17. package/dist/features/color/ColorWheelKeyboardProxy.d.ts.map +1 -1
  18. package/dist/features/color/ColorWheelKeyboardProxy.js.map +1 -1
  19. package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts +1 -1
  20. package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts.map +1 -1
  21. package/dist/features/color/ColorWheelKeyboardProxy.web.js +4 -4
  22. package/dist/features/color/ColorWheelKeyboardProxy.web.js.map +1 -1
  23. package/dist/features/color/ColorWheelPointerProxy.d.ts +1 -0
  24. package/dist/features/color/ColorWheelPointerProxy.d.ts.map +1 -1
  25. package/dist/features/color/ColorWheelPointerProxy.js.map +1 -1
  26. package/dist/features/color/ColorWheelPointerProxy.native.d.ts +3 -2
  27. package/dist/features/color/ColorWheelPointerProxy.native.d.ts.map +1 -1
  28. package/dist/features/color/ColorWheelPointerProxy.native.js +12 -3
  29. package/dist/features/color/ColorWheelPointerProxy.native.js.map +1 -1
  30. package/dist/features/color/ColorWheelPointerProxy.web.d.ts +2 -2
  31. package/dist/features/color/ColorWheelPointerProxy.web.d.ts.map +1 -1
  32. package/dist/features/color/ColorWheelPointerProxy.web.js +8 -5
  33. package/dist/features/color/ColorWheelPointerProxy.web.js.map +1 -1
  34. package/dist/features/color/public.d.ts +1 -1
  35. package/dist/features/color/public.d.ts.map +1 -1
  36. package/dist/features/color/public.js.map +1 -1
  37. package/dist/features/color/resolveColorPickerGeometry.d.ts +31 -0
  38. package/dist/features/color/resolveColorPickerGeometry.d.ts.map +1 -0
  39. package/dist/features/color/resolveColorPickerGeometry.js +94 -0
  40. package/dist/features/color/resolveColorPickerGeometry.js.map +1 -0
  41. package/dist/features/color/utils/resolveWheelColor.d.ts +2 -2
  42. package/dist/features/color/utils/resolveWheelColor.d.ts.map +1 -1
  43. package/dist/features/color/utils/resolveWheelColor.js +2 -3
  44. package/dist/features/color/utils/resolveWheelColor.js.map +1 -1
  45. package/dist/features/form/select/adapters/inbound/Select.native.js.map +1 -1
  46. package/dist/features/form/select/composition/SelectTrigger.d.ts.map +1 -1
  47. package/dist/features/form/select/composition/SelectTrigger.js +2 -2
  48. package/dist/features/form/select/composition/SelectTrigger.js.map +1 -1
  49. package/dist/index.d.ts +3 -1
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +1 -0
  52. package/dist/index.js.map +1 -1
  53. package/dist/types/color.d.ts +34 -26
  54. package/dist/types/color.d.ts.map +1 -1
  55. package/dist/types/color.js.map +1 -1
  56. package/dist/types/select.d.ts +2 -0
  57. package/dist/types/select.d.ts.map +1 -1
  58. package/dist/types/select.js.map +1 -1
  59. package/package.json +6 -6
  60. package/src/features/bottom-sheet/adapters/inbound/BottomSheet.tsx +1 -1
  61. package/src/features/color/ColorHexField.tsx +67 -23
  62. package/src/features/color/ColorPicker.layout.test.tsx +28 -24
  63. package/src/features/color/ColorPicker.tsx +449 -121
  64. package/src/features/color/ColorWheel.tsx +124 -248
  65. package/src/features/color/ColorWheelKeyboardProxy.tsx +1 -0
  66. package/src/features/color/ColorWheelKeyboardProxy.web.tsx +4 -3
  67. package/src/features/color/ColorWheelPointerProxy.native.tsx +25 -3
  68. package/src/features/color/ColorWheelPointerProxy.tsx +1 -0
  69. package/src/features/color/ColorWheelPointerProxy.web.tsx +12 -5
  70. package/src/features/color/public.ts +0 -2
  71. package/src/features/color/resolveColorPickerGeometry.test.ts +43 -0
  72. package/src/features/color/resolveColorPickerGeometry.ts +116 -0
  73. package/src/features/color/utils/resolveWheelColor.ts +2 -3
  74. package/src/features/form/select/adapters/inbound/Select.native.tsx +1 -1
  75. package/src/features/form/select/composition/SelectTrigger.tsx +2 -1
  76. package/src/index.ts +6 -2
  77. package/src/types/color.ts +34 -22
  78. package/src/types/select.ts +2 -0
  79. package/web-dist/chunks/{Accordion-h2nd5y0z.js → Accordion-01bsg7zt.js} +5 -5
  80. package/web-dist/chunks/{Accordion-6nrpdbmb.js → Accordion-01zvarrn.js} +8 -9
  81. package/web-dist/chunks/{Accordion-pmfdf08d.js → Accordion-0dj1r7w3.js} +1 -1
  82. package/web-dist/chunks/{Accordion-3zw817fr.js → Accordion-0xaq2k2h.js} +8 -8
  83. package/web-dist/chunks/{Accordion-gezcm372.js → Accordion-15sxxjym.js} +4 -5
  84. package/web-dist/chunks/{Accordion-eq27a9ms.js → Accordion-1fz55hk4.js} +1 -1
  85. package/web-dist/chunks/{Accordion-j0zhpq4s.js → Accordion-22cda3h5.js} +7 -8
  86. package/web-dist/chunks/{Accordion-jd26f516.js → Accordion-27yg9ktv.js} +3 -3
  87. package/web-dist/chunks/{Accordion-f60g73bp.js → Accordion-34b3rwbc.js} +6 -8
  88. package/web-dist/chunks/{Accordion-1etqb3cj.js → Accordion-3zzzw7a8.js} +2 -2
  89. package/web-dist/chunks/Accordion-46n609yq.js +253 -0
  90. package/web-dist/chunks/{Accordion-3jkeydhb.js → Accordion-4zb6dcys.js} +4 -7
  91. package/web-dist/chunks/{Accordion-dfq04q82.js → Accordion-5cjhz94e.js} +5 -5
  92. package/web-dist/chunks/{Accordion-49w9bc2f.js → Accordion-5mga7hty.js} +2 -2
  93. package/web-dist/chunks/{Accordion-kcx57mk5.js → Accordion-76b0qz8y.js} +24 -22
  94. package/web-dist/chunks/{Accordion-vewhx028.js → Accordion-78tknqmc.js} +4 -4
  95. package/web-dist/chunks/{Accordion-5vs1k81g.js → Accordion-7bd6zq4s.js} +9 -9
  96. package/web-dist/chunks/{Accordion-phtyg3k4.js → Accordion-8c4w7366.js} +5 -5
  97. package/web-dist/chunks/{Accordion-vk2v1zwv.js → Accordion-8t6vh482.js} +3 -4
  98. package/web-dist/chunks/{Accordion-an5prgty.js → Accordion-9d38cgqj.js} +88 -92
  99. package/web-dist/chunks/{Accordion-1mxnyexh.js → Accordion-9k7ktksc.js} +212 -215
  100. package/web-dist/chunks/{Accordion-aws0caav.js → Accordion-afpjg1d6.js} +3 -4
  101. package/web-dist/chunks/{Accordion-c3nna2bz.js → Accordion-b1y5mjac.js} +1 -1
  102. package/web-dist/chunks/{Accordion-eak89n4n.js → Accordion-b8w0f8s0.js} +6 -7
  103. package/web-dist/chunks/{Accordion-ne91vwkd.js → Accordion-bexwrnfh.js} +3 -4
  104. package/web-dist/chunks/Accordion-chdbfcm6.js +93 -0
  105. package/web-dist/chunks/{Accordion-6yv4beha.js → Accordion-d405whfb.js} +2 -2
  106. package/web-dist/chunks/{Accordion-xb174981.js → Accordion-de8srt4x.js} +8 -8
  107. package/web-dist/chunks/{Accordion-e3r3573t.js → Accordion-epv5yhch.js} +3 -3
  108. package/web-dist/chunks/{Accordion-g451f3g9.js → Accordion-f4919ghm.js} +4 -4
  109. package/web-dist/chunks/{Accordion-qhn8z92r.js → Accordion-f8a49gy8.js} +19 -22
  110. package/web-dist/chunks/{Accordion-3s7zeagv.js → Accordion-fdzyyqe9.js} +1 -1
  111. package/web-dist/chunks/Accordion-gnxmybxx.js +1331 -0
  112. package/web-dist/chunks/{Accordion-z8ryq8cb.js → Accordion-h1q243zq.js} +13 -11
  113. package/web-dist/chunks/{Accordion-dtt4qkrb.js → Accordion-h63c9k9k.js} +1 -1
  114. package/web-dist/chunks/{Accordion-rzf52xq8.js → Accordion-hdyzyw8q.js} +3 -3
  115. package/web-dist/chunks/{Accordion-3wkd5x2q.js → Accordion-htvmkx8s.js} +118 -118
  116. package/web-dist/chunks/{Accordion-0kr0h68p.js → Accordion-jmxe6kw0.js} +9 -11
  117. package/web-dist/chunks/{Accordion-705yrq6w.js → Accordion-kcm6jcpp.js} +2 -3
  118. package/web-dist/chunks/{Accordion-fcczvwgg.js → Accordion-mrstcjcm.js} +1 -0
  119. package/web-dist/chunks/{Accordion-p29kmwh9.js → Accordion-mx7nkg85.js} +1 -1
  120. package/web-dist/chunks/{Accordion-x0p3wxfp.js → Accordion-pdjhezmz.js} +2 -2
  121. package/web-dist/chunks/{Accordion-8g9c7890.js → Accordion-q046ws5p.js} +6 -6
  122. package/web-dist/chunks/{Accordion-jbwey4za.js → Accordion-q11svb96.js} +19 -19
  123. package/web-dist/chunks/{Accordion-bd6q61s1.js → Accordion-qkkeyr18.js} +6 -8
  124. package/web-dist/chunks/{Accordion-q1tdazgq.js → Accordion-qrt9xz0h.js} +7 -8
  125. package/web-dist/chunks/{Accordion-h0e95qxp.js → Accordion-qsppnx7g.js} +10 -11
  126. package/web-dist/chunks/{Accordion-neg1cgeh.js → Accordion-rhjddvkh.js} +1 -2
  127. package/web-dist/chunks/{Accordion-ysmzrvhn.js → Accordion-rtamzg9j.js} +47 -28
  128. package/web-dist/chunks/{Accordion-xwstve3k.js → Accordion-sfvqf4fz.js} +134 -132
  129. package/web-dist/chunks/{Accordion-9c63jn3m.js → Accordion-sh79sr5g.js} +5 -5
  130. package/web-dist/chunks/{Accordion-4g54je0w.js → Accordion-t9n4ey2r.js} +5 -3
  131. package/web-dist/chunks/{Accordion-e5jr9ahb.js → Accordion-tk8zf9ff.js} +3 -3
  132. package/web-dist/chunks/{Accordion-zypyr9xw.js → Accordion-tnyqv1xv.js} +296 -305
  133. package/web-dist/chunks/{Accordion-c0a7mhq3.js → Accordion-v6vhyv31.js} +95 -165
  134. package/web-dist/chunks/{Accordion-6m3k4avp.js → Accordion-vkqqktc5.js} +3 -3
  135. package/web-dist/chunks/{Accordion-z4qakakw.js → Accordion-vzq344av.js} +2 -3
  136. package/web-dist/chunks/{Accordion-pcj256bc.js → Accordion-wb9pmykz.js} +5 -6
  137. package/web-dist/chunks/{Accordion-x7ynjdv7.js → Accordion-ww4f12ty.js} +1 -1
  138. package/web-dist/chunks/{Accordion-zx8gmww4.js → Accordion-xb9zhdhp.js} +42 -45
  139. package/web-dist/chunks/{Accordion-3ecnh8d0.js → Accordion-xfkg7dcw.js} +4 -5
  140. package/web-dist/chunks/{Accordion-6ec4gxv2.js → Accordion-xzaa9s7f.js} +12 -23
  141. package/web-dist/chunks/{Accordion-vnrqvfca.js → Accordion-yrac5a7m.js} +1 -1
  142. package/web-dist/chunks/{zip-reader-f0yphjb9.js → zip-reader-5xrcmjr8.js} +1 -1
  143. package/web-dist/components/accordion/Accordion.js +11 -11
  144. package/web-dist/components/accordion-item/AccordionItem.js +11 -11
  145. package/web-dist/components/activity-indicator/ActivityIndicator.js +4 -4
  146. package/web-dist/components/app-bar/AppBar.js +18 -18
  147. package/web-dist/components/app-header/AppHeader.js +18 -18
  148. package/web-dist/components/app-shell/AppShell.js +5 -5
  149. package/web-dist/components/auth-screen/AuthScreen.js +21 -21
  150. package/web-dist/components/avatar/Avatar.js +11 -11
  151. package/web-dist/components/avatar-group/AvatarGroup.js +11 -11
  152. package/web-dist/components/badge/Badge.js +6 -6
  153. package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +19 -19
  154. package/web-dist/components/bottom-sheet/BottomSheet.js +10 -7
  155. package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +10 -7
  156. package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +10 -7
  157. package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +10 -7
  158. package/web-dist/components/bottom-sheet-view/BottomSheetView.js +10 -7
  159. package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +10 -7
  160. package/web-dist/components/breadcrumbs/Breadcrumbs.js +13 -13
  161. package/web-dist/components/button/Button.js +11 -11
  162. package/web-dist/components/button-group/ButtonGroup.js +11 -11
  163. package/web-dist/components/calendar/Calendar.js +14 -14
  164. package/web-dist/components/camera-permission-view/CameraPermissionView.js +19 -19
  165. package/web-dist/components/card/Card.js +18 -18
  166. package/web-dist/components/card-back/CardBack.js +5 -5
  167. package/web-dist/components/card-hand/CardHand.js +5 -5
  168. package/web-dist/components/carousel/Carousel.js +2 -2
  169. package/web-dist/components/chat-list-item/ChatListItem.js +15 -15
  170. package/web-dist/components/checkbox/Checkbox.js +11 -11
  171. package/web-dist/components/checkbox-group/CheckboxGroup.js +11 -11
  172. package/web-dist/components/chess-board/ChessBoard.js +6 -6
  173. package/web-dist/components/chip/Chip.js +12 -12
  174. package/web-dist/components/chip-group/ChipGroup.js +12 -12
  175. package/web-dist/components/collection-editor/CollectionEditor.js +18 -18
  176. package/web-dist/components/color-hue-scale/ColorHueScale.js +28 -17
  177. package/web-dist/components/color-picker/ColorPicker.d.ts +2 -2
  178. package/web-dist/components/color-picker/ColorPicker.js +28 -17
  179. package/web-dist/components/color-picker/ColorPicker.types-0.d.ts +34 -45
  180. package/web-dist/components/color-picker/index.d.ts +1 -1
  181. package/web-dist/components/color-tone/ColorTone.js +28 -17
  182. package/web-dist/components/color-wheel/ColorWheel.d.ts +1 -1
  183. package/web-dist/components/color-wheel/ColorWheel.js +28 -17
  184. package/web-dist/components/color-wheel/ColorWheel.types-0.d.ts +10 -0
  185. package/web-dist/components/content-rail/ContentRail.js +12 -12
  186. package/web-dist/components/data-table/DataTable.js +26 -26
  187. package/web-dist/components/date-picker/DatePicker.js +20 -20
  188. package/web-dist/components/dialog/Dialog.js +11 -11
  189. package/web-dist/components/divider/Divider.js +5 -5
  190. package/web-dist/components/empty-state/EmptyState.js +19 -19
  191. package/web-dist/components/explorer/Explorer.js +13 -13
  192. package/web-dist/components/field/Field.js +11 -11
  193. package/web-dist/components/file-explorer/FileExplorer.js +13 -13
  194. package/web-dist/components/flat-list/FlatList.js +12 -12
  195. package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +21 -21
  196. package/web-dist/components/form/Form.js +15 -15
  197. package/web-dist/components/form-actions/FormActions.js +15 -15
  198. package/web-dist/components/form-error/FormError.js +15 -15
  199. package/web-dist/components/game/Game.js +7 -6
  200. package/web-dist/components/game-entity/GameEntity.js +7 -6
  201. package/web-dist/components/game-field/GameField.js +7 -6
  202. package/web-dist/components/game-input-zone/GameInputZone.js +7 -6
  203. package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +7 -6
  204. package/web-dist/components/game-overlay/GameOverlay.js +7 -6
  205. package/web-dist/components/gradient/Gradient.js +6 -6
  206. package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +6 -6
  207. package/web-dist/components/graph-view/GraphView.js +2 -2
  208. package/web-dist/components/grid/Grid.js +5 -5
  209. package/web-dist/components/grid-interactions/GridInteractions.js +1 -1
  210. package/web-dist/components/grid-line-overlay/GridLineOverlay.js +5 -5
  211. package/web-dist/components/grid-ruler/GridRuler.js +5 -5
  212. package/web-dist/components/grid-view/GridView.js +1 -1
  213. package/web-dist/components/heading/Heading.js +6 -6
  214. package/web-dist/components/hero/Hero.js +18 -18
  215. package/web-dist/components/icon/Icon.js +5 -5
  216. package/web-dist/components/icon-button/IconButton.js +11 -11
  217. package/web-dist/components/image/Image.js +9 -9
  218. package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +4 -4
  219. package/web-dist/components/list/List.js +12 -12
  220. package/web-dist/components/list-item/ListItem.js +12 -12
  221. package/web-dist/components/list-section/ListSection.js +12 -12
  222. package/web-dist/components/master-detail/MasterDetail.js +5 -5
  223. package/web-dist/components/matrix-grid/MatrixGrid.js +9 -9
  224. package/web-dist/components/media-card/MediaCard.js +18 -18
  225. package/web-dist/components/media-explorer/MediaExplorer.js +13 -13
  226. package/web-dist/components/message-bubble/MessageBubble.js +15 -15
  227. package/web-dist/components/metric-card/MetricCard.js +18 -18
  228. package/web-dist/components/missing-element/MissingElement.js +10 -10
  229. package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +21 -21
  230. package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +21 -21
  231. package/web-dist/components/opening-book/OpeningBook.js +6 -6
  232. package/web-dist/components/otp-form/OtpForm.js +21 -21
  233. package/web-dist/components/pagination/Pagination.js +12 -12
  234. package/web-dist/components/palette-item/PaletteItem.js +18 -18
  235. package/web-dist/components/playing-card/PlayingCard.js +5 -5
  236. package/web-dist/components/poker-training-table/PokerTrainingTable.js +5 -5
  237. package/web-dist/components/popover-menu/PopoverMenu.js +13 -13
  238. package/web-dist/components/post-card/PostCard.js +18 -18
  239. package/web-dist/components/product-card/ProductCard.js +18 -18
  240. package/web-dist/components/progress/Progress.js +9 -9
  241. package/web-dist/components/progress-ring/ProgressRing.js +9 -9
  242. package/web-dist/components/radio/Radio.js +13 -13
  243. package/web-dist/components/radio-group/RadioGroup.js +13 -13
  244. package/web-dist/components/rating/Rating.js +8 -8
  245. package/web-dist/components/reader/Reader.js +34 -34
  246. package/web-dist/components/scan-overlay/ScanOverlay.js +19 -19
  247. package/web-dist/components/screen/Screen.js +5 -5
  248. package/web-dist/components/screen-section/ScreenSection.js +9 -9
  249. package/web-dist/components/scroll-view/ScrollView.js +5 -5
  250. package/web-dist/components/search-input/SearchInput.js +13 -13
  251. package/web-dist/components/section-header/SectionHeader.js +9 -9
  252. package/web-dist/components/section-list/SectionList.js +12 -12
  253. package/web-dist/components/select/Select.js +23 -259
  254. package/web-dist/components/select/Select.types-0.d.ts +2 -0
  255. package/web-dist/components/selectable-item/SelectableItem.js +4 -4
  256. package/web-dist/components/selection-provider/SelectionProvider.js +4 -4
  257. package/web-dist/components/sign-in-form/SignInForm.js +21 -21
  258. package/web-dist/components/sign-up-form/SignUpForm.js +21 -21
  259. package/web-dist/components/skeleton/Skeleton.js +21 -21
  260. package/web-dist/components/skeleton-card/SkeletonCard.js +21 -21
  261. package/web-dist/components/skeleton-list/SkeletonList.js +21 -21
  262. package/web-dist/components/skeleton-text/SkeletonText.js +21 -21
  263. package/web-dist/components/spatial-grid/SpatialGrid.js +1 -1
  264. package/web-dist/components/surface/Surface.js +6 -6
  265. package/web-dist/components/switch/Switch.js +8 -8
  266. package/web-dist/components/tab/Tab.js +6 -6
  267. package/web-dist/components/tab-list/TabList.js +6 -6
  268. package/web-dist/components/tab-panel/TabPanel.js +6 -6
  269. package/web-dist/components/tabletop-table/TabletopTable.js +5 -5
  270. package/web-dist/components/tabs/Tabs.js +6 -6
  271. package/web-dist/components/text/Text.js +6 -6
  272. package/web-dist/components/text-input/TextInput.js +13 -13
  273. package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +11 -11
  274. package/web-dist/components/tile-grid/TileGrid.js +1 -1
  275. package/web-dist/components/time-grid/TimeGrid.js +2 -2
  276. package/web-dist/components/time-picker/TimePicker.js +18 -18
  277. package/web-dist/components/timeline/Timeline.js +11 -11
  278. package/web-dist/components/toast/Toast.js +9 -9
  279. package/web-dist/components/toast-provider/ToastProvider.js +9 -9
  280. package/web-dist/components/toolbar/Toolbar.js +18 -18
  281. package/web-dist/components/tree-item/TreeItem.js +17 -17
  282. package/web-dist/components/tree-view/TreeView.js +1 -1
  283. package/web-dist/components/uploader/Uploader.js +23 -23
  284. package/web-dist/components/view/View.js +5 -5
  285. package/web-dist/manifest.json +1950 -1877
  286. package/web-dist/runtime/ZoraProvider.js +9 -9
  287. package/web-dist/chunks/Accordion-r1wkgt7c.js +0 -1074
  288. package/web-dist/chunks/{Accordion-vgkvvdvg.js → Accordion-ykk40jz9.js} +36 -36
@@ -1,26 +1,9 @@
1
1
  import { generateHarmonyRoleColors, type HexColor } from '@ankhorage/color-theory';
2
- import { Button } from '@ankhorage/surface';
3
2
  import React from 'react';
4
- import {
5
- Circle,
6
- Defs,
7
- Line,
8
- LinearGradient,
9
- Path,
10
- Polygon,
11
- RadialGradient,
12
- Rect,
13
- Stop,
14
- Svg,
15
- } from 'react-native-svg';
3
+ import { Circle, Defs, Line, Path, Polygon, RadialGradient, Stop, Svg } from 'react-native-svg';
16
4
 
17
5
  import type { ColorWheelProps } from '../../types/color';
18
- import { View } from '../layout/public';
19
6
  import { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';
20
- import { useZoraTheme } from '../theme/composition/useZoraTheme';
21
- import { Text } from '../typography/public';
22
- import { ColorHexField } from './ColorHexField';
23
- import { ColorHorizontalPointerProxy } from './ColorHorizontalPointerProxy';
24
7
  import { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy';
25
8
  import { ColorWheelPointerProxy } from './ColorWheelPointerProxy';
26
9
  import { resolveColorHue } from './utils/resolveColorHue';
@@ -28,16 +11,16 @@ import { resolveOklchColor } from './utils/resolveOklchColor';
28
11
  import { resolveWheelColor } from './utils/resolveWheelColor';
29
12
  import { resolveWheelColorComponents } from './utils/resolveWheelColorComponents';
30
13
 
31
- const WHEEL_SIZE = 280;
32
- const WHEEL_CENTER = WHEEL_SIZE / 2;
33
- const WHEEL_RADIUS = 128;
34
- const WHEEL_SEGMENT_COUNT = 72;
35
- const WHEEL_MAX_CHROMA = 0.2;
14
+ const VIEWBOX = 1000;
15
+ const CENTER = VIEWBOX / 2;
16
+ const RADIUS = 480;
17
+ const SEGMENTS = 720;
18
+ const MAX_CHROMA = 0.2;
36
19
 
37
- /*** Selects an OKLCH hue and optionally visualizes the existing color-theory harmony. */
20
+ /*** Renders a size-owned, filled OKLCH wheel with controlled primary and harmony points. */
38
21
  export const ColorWheel = withZoraThemeScope(ColorWheelInner);
39
22
 
40
- /*** Renders a directly manipulable hue wheel and harmony controls without returning derived colors. */
23
+ /*** Maps pointer and keyboard input through one viewBox into the controlled selected colour. */
41
24
  function ColorWheelInner({
42
25
  themeId: _themeId,
43
26
  mode: _mode,
@@ -45,264 +28,163 @@ function ColorWheelInner({
45
28
  interactionPolicy,
46
29
  value,
47
30
  harmony = null,
48
- harmonies,
31
+ toneTarget,
49
32
  onChange,
33
+ size = 340,
50
34
  testID,
51
35
  }: ColorWheelProps) {
52
- const { theme } = useZoraTheme();
53
36
  const hue = resolveColorHue(value);
54
37
  const { chroma, lightness } = resolveWheelColorComponents(value);
55
- const harmonyColors = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];
56
- const selectedPoint = resolveWheelPoint(hue, Math.min(1, chroma / WHEEL_MAX_CHROMA));
57
- const harmonyPoints = harmonyColors.map((color) => resolveWheelPoint(color.hueDegrees));
58
- const harmonyLines = resolveHarmonyLines(
59
- harmonyPoints,
60
- selectedPoint,
61
- theme.semantics.content.default,
62
- );
63
- const wheelGradientId = `color-wheel-${React.useId().replaceAll(':', '')}`;
64
- const changeColorAt = (x: number, y: number) => {
65
- if (interactionPolicy === 'passive') return;
66
- onChange({
67
- color: resolveWheelColor(value, x, y, WHEEL_CENTER, WHEEL_RADIUS, WHEEL_MAX_CHROMA),
68
- harmony,
69
- });
38
+ const targetLightness = toneTarget?.lightness ?? lightness;
39
+ const maximumChroma = toneTarget?.chroma ?? MAX_CHROMA;
40
+ const primaryPoint = pointFor(hue, Math.min(1, chroma / maximumChroma));
41
+ const harmonyRoles = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];
42
+ const harmonyPoints = harmonyRoles.map((role) => ({
43
+ color: role.hex,
44
+ ...pointFor(
45
+ role.hueDegrees,
46
+ Math.min(1, resolveWheelColorComponents(role.hex).chroma / maximumChroma),
47
+ ),
48
+ }));
49
+ const gradientId = `color-wheel-${React.useId().replaceAll(':', '')}`;
50
+ const changeAt = (x: number, y: number) => {
51
+ if (interactionPolicy !== 'passive')
52
+ onChange({
53
+ color: resolveWheelColor(value, x, y, CENTER, RADIUS, maximumChroma, targetLightness),
54
+ harmony,
55
+ });
70
56
  };
71
- const changeLightness = (nextLightness: number) =>
72
- onChange({
73
- color: resolveOklchColor({ chroma, lightness: Math.max(0, Math.min(1, nextLightness)) }, hue),
74
- harmony,
75
- });
76
-
77
57
  return (
78
- <View align="center" gap="s" testID={testID}>
79
- <ColorWheelKeyboardProxy
80
- chroma={chroma}
58
+ <ColorWheelKeyboardProxy
59
+ chroma={chroma}
60
+ disabled={interactionPolicy === 'passive'}
61
+ hue={hue}
62
+ maxChroma={maximumChroma}
63
+ onChange={(nextHue, nextChroma) =>
64
+ onChange({
65
+ color: resolveOklchColor({ chroma: nextChroma, lightness: targetLightness }, nextHue),
66
+ harmony,
67
+ })
68
+ }
69
+ >
70
+ <ColorWheelPointerProxy
81
71
  disabled={interactionPolicy === 'passive'}
82
- hue={hue}
83
- onChange={(nextHue, nextChroma) =>
84
- onChange({
85
- color: resolveOklchColor(
86
- { lightness: resolveWheelLightness(value), chroma: nextChroma },
87
- nextHue,
88
- ),
89
- harmony,
90
- })
91
- }
72
+ height={VIEWBOX}
73
+ onChange={changeAt}
74
+ renderedSize={size}
75
+ width={VIEWBOX}
92
76
  >
93
- <ColorWheelPointerProxy
94
- disabled={interactionPolicy === 'passive'}
95
- height={WHEEL_SIZE}
96
- onChange={changeColorAt}
97
- width={WHEEL_SIZE}
77
+ <Svg
78
+ accessibilityLabel="Color wheel"
79
+ height={size}
80
+ testID={testID}
81
+ viewBox={`0 0 ${VIEWBOX} ${VIEWBOX}`}
82
+ width={size}
98
83
  >
99
- <Svg
100
- accessibilityLabel="Color wheel"
101
- height={WHEEL_SIZE}
102
- onResponderGrant={(event) => {
103
- const { locationX, locationY } = event.nativeEvent;
104
- changeColorAt(locationX, locationY);
105
- }}
106
- onResponderMove={(event) => {
107
- const { locationX, locationY } = event.nativeEvent;
108
- changeColorAt(locationX, locationY);
109
- }}
110
- onResponderRelease={(event) => {
111
- const { locationX, locationY } = event.nativeEvent;
112
- changeColorAt(locationX, locationY);
113
- }}
114
- onStartShouldSetResponder={() => interactionPolicy !== 'passive'}
115
- width={WHEEL_SIZE}
116
- >
117
- <Defs>
118
- {resolveWheelSegments().map((segment) => (
119
- <RadialGradient
120
- cx={WHEEL_CENTER}
121
- cy={WHEEL_CENTER}
122
- id={`${wheelGradientId}-${segment.hue}`}
123
- key={segment.hue}
124
- r={WHEEL_RADIUS}
125
- >
126
- <Stop
127
- offset="0"
128
- stopColor={resolveOklchColor({ lightness: 0.65, chroma: 0 }, segment.hue)}
129
- />
130
- <Stop offset="1" stopColor={segment.color} />
131
- </RadialGradient>
132
- ))}
133
- </Defs>
134
- {resolveWheelSegments().map((segment) => (
135
- <Path
136
- d={segment.path}
137
- fill={`url(#${wheelGradientId}-${segment.hue})`}
84
+ <Defs>
85
+ {segments(targetLightness, maximumChroma).map((segment) => (
86
+ <RadialGradient
87
+ cx={CENTER}
88
+ cy={CENTER}
89
+ gradientUnits="userSpaceOnUse"
90
+ id={`${gradientId}-${segment.hue}`}
138
91
  key={segment.hue}
139
- />
92
+ r={RADIUS}
93
+ >
94
+ <Stop offset="0" stopColor={segment.centerColor} />
95
+ <Stop offset="1" stopColor={segment.color} />
96
+ </RadialGradient>
140
97
  ))}
141
- {harmony === 'triadic' && harmonyPoints.length === 3 ? (
142
- <Polygon
143
- fill="none"
144
- points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')}
145
- stroke={theme.semantics.content.default}
146
- strokeWidth={2}
147
- />
148
- ) : (
149
- harmonyLines
150
- )}
151
- {harmonyPoints.map((point) => (
98
+ </Defs>
99
+ {segments(targetLightness, maximumChroma).map((segment) => (
100
+ <Path d={segment.path} fill={`url(#${gradientId}-${segment.hue})`} key={segment.hue} />
101
+ ))}
102
+ {harmonyPoints.length >= 3 ? (
103
+ <Polygon
104
+ fill="none"
105
+ points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')}
106
+ stroke="white"
107
+ strokeWidth={6}
108
+ />
109
+ ) : (
110
+ linesFor(harmonyPoints, primaryPoint, 'white')
111
+ )}
112
+ {harmonyPoints
113
+ .filter((point) => point.color !== value)
114
+ .map((point) => (
152
115
  <Circle
153
116
  cx={point.x}
154
117
  cy={point.y}
155
- fill={theme.semantics.content.default}
118
+ fill={point.color}
156
119
  key={`${point.x}-${point.y}`}
157
- r={5}
120
+ stroke="white"
121
+ strokeWidth={6}
122
+ r={26}
158
123
  />
159
124
  ))}
160
- <Circle
161
- cx={selectedPoint.x}
162
- cy={selectedPoint.y}
163
- fill="none"
164
- r={9}
165
- stroke={theme.semantics.content.default}
166
- strokeWidth={3}
167
- />
168
- </Svg>
169
- </ColorWheelPointerProxy>
170
- </ColorWheelKeyboardProxy>
171
- <ColorLightnessSlider
172
- chroma={chroma}
173
- disabled={interactionPolicy === 'passive'}
174
- hue={hue}
175
- lightness={lightness}
176
- onChange={changeLightness}
177
- selectionBorderColor={theme.semantics.content.default}
178
- />
179
- <ColorHexField
180
- disabled={interactionPolicy === 'passive'}
181
- key={value}
182
- onChange={(color) => onChange({ color, harmony })}
183
- value={value}
184
- />
185
- {harmonies ? (
186
- <View direction="row" gap="xs" wrap="wrap">
187
- <Button
188
- disabled={interactionPolicy === 'passive'}
189
- onPress={() => onChange({ color: value, harmony: null })}
190
- variant={harmony === null ? 'solid' : 'outline'}
191
- >
192
- None
193
- </Button>
194
- {harmonies.map((candidate) => (
195
- <Button
196
- key={candidate}
197
- disabled={interactionPolicy === 'passive'}
198
- onPress={() => onChange({ color: value, harmony: candidate })}
199
- variant={harmony === candidate ? 'solid' : 'outline'}
200
- >
201
- {candidate}
202
- </Button>
203
- ))}
204
- </View>
205
- ) : null}
206
- </View>
207
- );
208
- }
209
-
210
- /*** Renders a continuous OKLCH lightness track without adding a second color persistence model. */
211
- function ColorLightnessSlider({
212
- chroma,
213
- disabled,
214
- hue,
215
- lightness,
216
- onChange,
217
- selectionBorderColor,
218
- }: {
219
- readonly chroma: number;
220
- readonly disabled: boolean;
221
- readonly hue: number;
222
- readonly lightness: number;
223
- readonly onChange: (lightness: number) => void;
224
- readonly selectionBorderColor: string;
225
- }) {
226
- const changeAt = (locationX: number) => {
227
- if (!disabled) onChange(Math.max(0, Math.min(1, locationX / WHEEL_SIZE)));
228
- };
229
- return (
230
- <View gap="xxs" width={WHEEL_SIZE}>
231
- <View direction="row" justify="space-between">
232
- <Text variant="label">Lightness</Text>
233
- <Text variant="label">{`${Math.round(lightness * 100)}%`}</Text>
234
- </View>
235
- <ColorHorizontalPointerProxy disabled={disabled} onChange={changeAt} width={WHEEL_SIZE}>
236
- <Svg accessibilityLabel="Color lightness" height={36} width={WHEEL_SIZE}>
237
- <Defs>
238
- <LinearGradient id="color-lightness" x1="0" x2="1" y1="0" y2="0">
239
- <Stop offset="0" stopColor={resolveOklchColor({ chroma, lightness: 0 }, hue)} />
240
- <Stop offset="1" stopColor={resolveOklchColor({ chroma, lightness: 1 }, hue)} />
241
- </LinearGradient>
242
- </Defs>
243
- <Rect fill="url(#color-lightness)" height={10} rx={5} y={13} width={WHEEL_SIZE} />
244
125
  <Circle
245
- cx={lightness * WHEEL_SIZE}
246
- cy={18}
247
- fill="white"
248
- r={10}
249
- stroke={selectionBorderColor}
250
- strokeWidth={2}
126
+ cx={primaryPoint.x}
127
+ cy={primaryPoint.y}
128
+ fill={value}
129
+ r={36}
130
+ stroke="white"
131
+ strokeWidth={12}
251
132
  />
252
- <Rect
253
- fill="transparent"
254
- height={36}
255
- onResponderGrant={(event) => changeAt(event.nativeEvent.locationX)}
256
- onResponderMove={(event) => changeAt(event.nativeEvent.locationX)}
257
- onResponderRelease={(event) => changeAt(event.nativeEvent.locationX)}
258
- onStartShouldSetResponder={() => !disabled}
259
- width={WHEEL_SIZE}
133
+ <Circle
134
+ cx={primaryPoint.x}
135
+ cy={primaryPoint.y}
136
+ fill="none"
137
+ r={42}
138
+ stroke="white"
139
+ strokeWidth={6}
260
140
  />
261
141
  </Svg>
262
- </ColorHorizontalPointerProxy>
263
- </View>
142
+ </ColorWheelPointerProxy>
143
+ </ColorWheelKeyboardProxy>
264
144
  );
265
145
  }
266
146
 
267
- /*** Build the wheel's OKLCH segments from the existing conversion tool. */
268
- function resolveWheelSegments(): readonly {
147
+ /*** Creates fine radial hue segments from the same OKLCH projection used for interaction. */
148
+ function segments(
149
+ lightness: number,
150
+ maximumChroma: number,
151
+ ): readonly {
152
+ readonly centerColor: HexColor;
269
153
  readonly color: HexColor;
270
154
  readonly hue: number;
271
155
  readonly path: string;
272
156
  }[] {
273
- return Array.from({ length: WHEEL_SEGMENT_COUNT }, (_, index) => {
274
- const hue = (index * 360) / WHEEL_SEGMENT_COUNT;
157
+ return Array.from({ length: SEGMENTS }, (_, index) => {
158
+ const hue = (index * 360) / SEGMENTS;
275
159
  return {
276
- color: resolveOklchColor({ lightness: 0.65, chroma: WHEEL_MAX_CHROMA }, hue),
160
+ centerColor: resolveOklchColor({ chroma: 0, lightness }, hue),
161
+ color: resolveOklchColor({ chroma: maximumChroma, lightness }, hue),
277
162
  hue,
278
- path: resolveSegmentPath(hue, hue + 360 / WHEEL_SEGMENT_COUNT),
163
+ path: segmentPath(hue, hue + 360 / SEGMENTS),
279
164
  };
280
165
  });
281
166
  }
282
167
 
283
- /*** Describe one wedge in the visual hue wheel. */
284
- function resolveSegmentPath(startHue: number, endHue: number): string {
285
- const start = resolveWheelPoint(startHue);
286
- const end = resolveWheelPoint(endHue);
287
- return `M ${WHEEL_CENTER} ${WHEEL_CENTER} L ${start.x} ${start.y} A ${WHEEL_RADIUS} ${WHEEL_RADIUS} 0 0 1 ${end.x} ${end.y} Z`;
168
+ /*** Describes one filled wheel segment in the stable coordinate system. */
169
+ function segmentPath(start: number, end: number) {
170
+ const startPoint = pointFor(start);
171
+ const endPoint = pointFor(end);
172
+ return `M ${CENTER} ${CENTER} L ${startPoint.x} ${startPoint.y} A ${RADIUS} ${RADIUS} 0 0 1 ${endPoint.x} ${endPoint.y} Z`;
288
173
  }
289
174
 
290
- /*** Convert a hue degree to the corresponding visual wheel coordinate. */
291
- function resolveWheelPoint(
292
- hue: number,
293
- radiusRatio = 1,
294
- ): { readonly x: number; readonly y: number } {
175
+ /*** Projects an OKLCH hue and chroma ratio into the wheel coordinate system. */
176
+ function pointFor(hue: number, ratio = 1) {
295
177
  const radians = ((hue - 90) * Math.PI) / 180;
296
178
  return {
297
- x: WHEEL_CENTER + WHEEL_RADIUS * radiusRatio * Math.cos(radians),
298
- y: WHEEL_CENTER + WHEEL_RADIUS * radiusRatio * Math.sin(radians),
179
+ x: CENTER + RADIUS * ratio * Math.cos(radians),
180
+ y: CENTER + RADIUS * ratio * Math.sin(radians),
299
181
  };
300
182
  }
301
183
 
302
- /*** Connect consecutive harmony points without dynamic collection indexing. */
303
- function resolveHarmonyLines(
184
+ /*** Connects derived harmony points behind their corresponding knobs. */
185
+ function linesFor(
304
186
  points: readonly { readonly x: number; readonly y: number }[],
305
- selectedPoint: { readonly x: number; readonly y: number },
187
+ primary: { readonly x: number; readonly y: number },
306
188
  stroke: string,
307
189
  ) {
308
190
  return points.slice(1).reduce(
@@ -312,7 +194,7 @@ function resolveHarmonyLines(
312
194
  <Line
313
195
  key={`${previous.x}-${previous.y}-${point.x}-${point.y}`}
314
196
  stroke={stroke}
315
- strokeWidth={2}
197
+ strokeWidth={6}
316
198
  x1={previous.x}
317
199
  x2={point.x}
318
200
  y1={previous.y}
@@ -321,12 +203,6 @@ function resolveHarmonyLines(
321
203
  ],
322
204
  previous: point,
323
205
  }),
324
- { lines: [] as React.ReactNode[], previous: points.at(0) ?? selectedPoint },
206
+ { lines: [] as React.ReactNode[], previous: points.at(0) ?? primary },
325
207
  ).lines;
326
208
  }
327
-
328
- /*** Read the selected color's lightness for wheel-only hue and chroma changes. */
329
- function resolveWheelLightness(color: HexColor): number {
330
- const { lightness } = resolveWheelColorComponents(color);
331
- return lightness;
332
- }
@@ -7,5 +7,6 @@ export interface ColorWheelKeyboardProxyProps {
7
7
  readonly chroma: number;
8
8
  readonly disabled: boolean;
9
9
  readonly hue: number;
10
+ readonly maxChroma?: number;
10
11
  readonly onChange: (hue: number, chroma: number) => void;
11
12
  }
@@ -8,6 +8,7 @@ export function ColorWheelKeyboardProxy({
8
8
  chroma,
9
9
  disabled,
10
10
  hue,
11
+ maxChroma = 0.2,
11
12
  onChange,
12
13
  }: ColorWheelKeyboardProxyProps) {
13
14
  return (
@@ -19,7 +20,7 @@ export function ColorWheelKeyboardProxy({
19
20
  aria-valuetext={`Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`}
20
21
  aria-disabled={disabled}
21
22
  onKeyDown={(event) => {
22
- const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma);
23
+ const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma, maxChroma);
23
24
  if (!nextValue || disabled) return;
24
25
  event.preventDefault();
25
26
  onChange(nextValue.hue, nextValue.chroma);
@@ -33,11 +34,11 @@ export function ColorWheelKeyboardProxy({
33
34
  }
34
35
 
35
36
  /*** Resolve portable arrow keys into bounded color-wheel increments. */
36
- function resolveKeyboardWheelValue(key: string, hue: number, chroma: number) {
37
+ function resolveKeyboardWheelValue(key: string, hue: number, chroma: number, maxChroma: number) {
37
38
  if (key === 'ArrowLeft') return { chroma, hue: normalizeHue(hue - 5) };
38
39
  if (key === 'ArrowRight') return { chroma, hue: normalizeHue(hue + 5) };
39
40
  if (key === 'ArrowDown') return { chroma: Math.max(0, chroma - 0.02), hue };
40
- if (key === 'ArrowUp') return { chroma: Math.min(0.2, chroma + 0.02), hue };
41
+ if (key === 'ArrowUp') return { chroma: Math.min(maxChroma, chroma + 0.02), hue };
41
42
  return undefined;
42
43
  }
43
44
 
@@ -1,6 +1,28 @@
1
+ import React from 'react';
2
+
1
3
  import type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';
2
4
 
3
- /*** Leaves native SVG responders in charge of direct color-wheel gestures. */
4
- export function ColorWheelPointerProxy({ children }: ColorWheelPointerProxyProps) {
5
- return children;
5
+ /*** Adds the sole native responder path to the SVG wheel. */
6
+ export function ColorWheelPointerProxy({
7
+ children,
8
+ disabled,
9
+ height,
10
+ onChange,
11
+ width,
12
+ renderedSize = width,
13
+ }: ColorWheelPointerProxyProps) {
14
+ if (!React.isValidElement(children)) return children;
15
+ const changeAt = (event: {
16
+ readonly nativeEvent: { readonly locationX: number; readonly locationY: number };
17
+ }) =>
18
+ onChange(
19
+ (event.nativeEvent.locationX / renderedSize) * width,
20
+ (event.nativeEvent.locationY / renderedSize) * height,
21
+ );
22
+ return React.cloneElement(children as React.ReactElement<Record<string, unknown>>, {
23
+ onResponderGrant: disabled ? undefined : changeAt,
24
+ onResponderMove: disabled ? undefined : changeAt,
25
+ onResponderRelease: disabled ? undefined : changeAt,
26
+ onStartShouldSetResponder: () => !disabled,
27
+ });
6
28
  }
@@ -7,5 +7,6 @@ export interface ColorWheelPointerProxyProps {
7
7
  readonly disabled: boolean;
8
8
  readonly height: number;
9
9
  readonly onChange: (x: number, y: number) => void;
10
+ readonly renderedSize?: number;
10
11
  readonly width: number;
11
12
  }
@@ -2,16 +2,17 @@ import React from 'react';
2
2
 
3
3
  import type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';
4
4
 
5
- /*** Maps browser pointer coordinates into the fixed SVG wheel viewport for click and drag selection. */
5
+ /*** Maps mouse, pen and touch coordinates into the wheel viewBox for click and drag selection. */
6
6
  export function ColorWheelPointerProxy({
7
7
  children,
8
8
  disabled,
9
9
  height,
10
10
  onChange,
11
+ renderedSize: _renderedSize,
11
12
  width,
12
13
  }: ColorWheelPointerProxyProps) {
13
14
  const dragging = React.useRef(false);
14
- const changeAt = (event: React.MouseEvent<HTMLDivElement>) => {
15
+ const changeAt = (event: React.PointerEvent<HTMLDivElement>) => {
15
16
  const target = event.currentTarget as unknown as BrowserPointerTarget;
16
17
  const rect = target.getBoundingClientRect();
17
18
  onChange(
@@ -22,18 +23,24 @@ export function ColorWheelPointerProxy({
22
23
 
23
24
  return (
24
25
  <div
25
- onMouseDown={(event) => {
26
+ onPointerDown={(event) => {
26
27
  if (disabled) return;
27
28
  dragging.current = true;
29
+ (
30
+ event.currentTarget as unknown as { setPointerCapture: (pointerId: number) => void }
31
+ ).setPointerCapture(event.pointerId);
28
32
  changeAt(event);
29
33
  }}
30
- onMouseMove={(event) => {
34
+ onPointerMove={(event) => {
31
35
  if (!disabled && dragging.current) changeAt(event);
32
36
  }}
33
- onMouseUp={(event) => {
37
+ onPointerUp={(event) => {
34
38
  if (!disabled && dragging.current) changeAt(event);
35
39
  dragging.current = false;
36
40
  }}
41
+ onPointerCancel={() => {
42
+ dragging.current = false;
43
+ }}
37
44
  style={{ touchAction: 'none' }}
38
45
  >
39
46
  {children}
@@ -1,9 +1,7 @@
1
1
  export type {
2
2
  ColorHueScaleProps,
3
3
  ColorPickerProps,
4
- ColorPickerSelection,
5
4
  ColorPickerTab,
6
- ColorPickerValue,
7
5
  ColorToneDefinition,
8
6
  ColorToneProps,
9
7
  ColorToneSelection,
@@ -0,0 +1,43 @@
1
+ import { expect, test } from 'bun:test';
2
+
3
+ import { resolveColorPickerGeometry } from './resolveColorPickerGeometry';
4
+
5
+ test('keeps the reference Grid and Wheel stage geometry at the approved width', () => {
6
+ const geometry = resolveColorPickerGeometry({
7
+ height: 700,
8
+ hostHeight: 700,
9
+ hostWidth: 560,
10
+ showTabs: true,
11
+ width: 560,
12
+ });
13
+
14
+ expect(geometry.insufficientSpace).toBe(false);
15
+ expect(geometry.footerInset).toBe(12);
16
+ expect(geometry.stage).toBe(340);
17
+ expect(geometry.width).toBe(560);
18
+ });
19
+
20
+ test('uses the largest coherent geometry that fits a height-constrained host', () => {
21
+ const geometry = resolveColorPickerGeometry({
22
+ hostHeight: 500,
23
+ hostWidth: 560,
24
+ showTabs: true,
25
+ });
26
+
27
+ expect(geometry.insufficientSpace).toBe(false);
28
+ expect(geometry.height).toBeLessThanOrEqual(500);
29
+ expect(geometry.stage).toBeGreaterThanOrEqual(218);
30
+ expect(geometry.stage).toBeLessThan(340);
31
+ });
32
+
33
+ test('reports insufficient host height instead of hiding a shrunken unusable picker', () => {
34
+ const geometry = resolveColorPickerGeometry({
35
+ hostHeight: 360,
36
+ hostWidth: 560,
37
+ showTabs: true,
38
+ });
39
+
40
+ expect(geometry.insufficientSpace).toBe(true);
41
+ expect(geometry.stage).toBeGreaterThanOrEqual(218);
42
+ expect(geometry.minimumHeight).toBeGreaterThan(360);
43
+ });