@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 28.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 86349f4: Update dependencies: `@ankhorage/contracts`, `@ankhorage/graph`, `@ankhorage/runtime`, `@ankhorage/surface`.
8
+
9
+ ## 28.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 29970ea: Add host-constrained ColorPicker sizing and synchronize controlled color input and wheel projection.
14
+
3
15
  ## 28.0.0
4
16
 
5
17
  ### Major Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # ZORA
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v28.0.0](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: configured](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v28.1.1](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: configured](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
7
7
 
8
8
  Provides opinionated React Native and React Native Web UI components, theme primitives, registries, and reader surfaces built on @ankhorage/surface.
9
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.js","sourceRoot":"","sources":["../../../../../src/features/bottom-sheet/adapters/inbound/BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAEzF,qFAAqF;AACrF,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AAEhE,yFAAyF;AACzF,SAAS,gBAAgB,CAAC,EACxB,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,QAAQ,EACjB,QAAQ,EACR,IAAI,GAAG,KAAK,EACZ,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D,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;SACrD,CAAC,CAAC;IACL,CAAC,EAAE;QACD,MAAM;QACN,QAAQ;QACR,sBAAsB;QACtB,mBAAmB;QACnB,oBAAoB;QACpB,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;QACpB,IAAI;QACJ,SAAS;QACT,aAAa;QACb,OAAO;QACP,UAAU;QACV,MAAM;QACN,OAAO;KACR,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { useBottomSheet } from '@ankhorage/surface/bottom-sheet';\nimport React from 'react';\n\nimport type { BottomSheetProps } from '../../../../types/manifest-bottom-sheet';\nimport { View } from '../../../layout/public';\nimport { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';\nimport { useZoraTheme } from '../../../theme/composition/useZoraTheme';\nimport { useZoraThemeRuntime } from '../../../theme/composition/ZoraThemeRuntimeContext';\n\n/*** Presents declarative manifest children through the shared Surface sheet host. */\nexport const BottomSheet = withZoraThemeScope(BottomSheetInner);\n\n/*** Bridges the declarative lifecycle and inherited theme into the shared modal host. */\nfunction BottomSheetInner({\n mode: _mode,\n themeId: _themeId,\n children,\n open = false,\n interactionPolicy,\n testID,\n snapPoints,\n initialIndex,\n enableDynamicSizing,\n enablePanDownToClose,\n dismissOnBackdropPress,\n keyboardBehavior,\n keyboardBlurBehavior,\n onDismiss,\n onIndexChange,\n}: BottomSheetProps) {\n const { present, dismiss } = useBottomSheet();\n const { mode } = useZoraTheme();\n const { themeId } = useZoraThemeRuntime();\n const active = open && interactionPolicy !== 'passive';\n const dismissed = React.useRef(false);\n\n React.useEffect(() => {\n dismissed.current = false;\n if (!active) return;\n return () => {\n dismiss();\n };\n }, [active, dismiss]);\n\n React.useEffect(() => {\n if (!active || dismissed.current) return;\n present({\n content: (\n <View mode={mode} themeId={themeId} testID={testID}>\n {children}\n </View>\n ),\n snapPoints,\n initialIndex,\n enableDynamicSizing,\n enablePanDownToClose,\n dismissOnBackdropPress,\n keyboardBehavior,\n keyboardBlurBehavior,\n onDismiss: () => {\n dismissed.current = true;\n onDismiss?.();\n },\n onIndexChange: (index) => onIndexChange?.({ index }),\n });\n }, [\n active,\n children,\n dismissOnBackdropPress,\n enableDynamicSizing,\n enablePanDownToClose,\n initialIndex,\n keyboardBehavior,\n keyboardBlurBehavior,\n mode,\n onDismiss,\n onIndexChange,\n present,\n snapPoints,\n testID,\n themeId,\n ]);\n\n return null;\n}\n"]}
1
+ {"version":3,"file":"BottomSheet.js","sourceRoot":"","sources":["../../../../../src/features/bottom-sheet/adapters/inbound/BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAEzF,qFAAqF;AACrF,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AAEhE,yFAAyF;AACzF,SAAS,gBAAgB,CAAC,EACxB,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,QAAQ,EACjB,QAAQ,EACR,IAAI,GAAG,KAAK,EACZ,iBAAiB,EACjB,MAAM,EACN,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,SAAS,EACT,aAAa,GACI;IACjB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IAC9C,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,EAAE,CAAC;IAChC,MAAM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QACP,UAAU;QACV,MAAM;QACN,OAAO;KACR,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { useBottomSheet } from '@ankhorage/surface/bottom-sheet';\nimport React from 'react';\n\nimport type { BottomSheetProps } from '../../../../types/manifest-bottom-sheet';\nimport { View } from '../../../layout/public';\nimport { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';\nimport { useZoraTheme } from '../../../theme/composition/useZoraTheme';\nimport { useZoraThemeRuntime } from '../../../theme/composition/ZoraThemeRuntimeContext';\n\n/*** Presents declarative manifest children through the shared Surface sheet host. */\nexport const BottomSheet = withZoraThemeScope(BottomSheetInner);\n\n/*** Bridges the declarative lifecycle and inherited theme into the shared modal host. */\nfunction BottomSheetInner({\n mode: _mode,\n themeId: _themeId,\n children,\n open = false,\n interactionPolicy,\n testID,\n snapPoints,\n initialIndex,\n enableDynamicSizing,\n enablePanDownToClose,\n dismissOnBackdropPress,\n keyboardBehavior,\n keyboardBlurBehavior,\n onDismiss,\n onIndexChange,\n}: BottomSheetProps) {\n const { present, dismiss } = useBottomSheet();\n const { mode } = useZoraTheme();\n const { themeId } = useZoraThemeRuntime();\n const active = open && interactionPolicy !== 'passive';\n const dismissed = React.useRef(false);\n\n React.useEffect(() => {\n dismissed.current = false;\n if (!active) return;\n return () => {\n dismiss();\n };\n }, [active, dismiss]);\n\n React.useEffect(() => {\n if (!active || dismissed.current) return;\n present({\n content: (\n <View mode={mode} themeId={themeId} testID={testID}>\n {children}\n </View>\n ),\n snapPoints,\n initialIndex,\n enableDynamicSizing,\n enablePanDownToClose,\n dismissOnBackdropPress,\n keyboardBehavior,\n keyboardBlurBehavior,\n onDismiss: () => {\n dismissed.current = true;\n onDismiss?.();\n },\n onIndexChange: (index: number) => onIndexChange?.({ index }),\n });\n }, [\n active,\n children,\n dismissOnBackdropPress,\n enableDynamicSizing,\n enablePanDownToClose,\n initialIndex,\n keyboardBehavior,\n keyboardBlurBehavior,\n mode,\n onDismiss,\n onIndexChange,\n present,\n snapPoints,\n testID,\n themeId,\n ]);\n\n return null;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { type HexColor } from '@ankhorage/color-theory';
2
2
  import React from 'react';
3
- /*** Edits one controlled HEX color until the host-backed clipboard capability is available. */
3
+ /*** Edits one controlled HEX color and delegates copying to the host-owned clipboard capability. */
4
4
  export declare function ColorHexField({ disabled, onChange, value, }: {
5
5
  readonly disabled: boolean;
6
6
  readonly onChange: (color: HexColor) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ColorHexField.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorHexField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAc,MAAM,yBAAyB,CAAC;AAEpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B,qBA0BA"}
1
+ {"version":3,"file":"ColorHexField.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorHexField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAc,MAAM,yBAAyB,CAAC;AAGpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,oGAAoG;AACpG,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B,qBAqEA"}
@@ -1,16 +1,43 @@
1
1
  import { isHexColor } from '@ankhorage/color-theory';
2
+ import { useClipboardWriter, writeClipboardTextAsync } from '@ankhorage/runtime';
2
3
  import { TextInput } from '@ankhorage/surface';
3
4
  import React from 'react';
5
+ import { IconButton } from '../button/public';
4
6
  import { View } from '../layout/public';
5
7
  import { useZoraTheme } from '../theme/composition/useZoraTheme';
6
- /*** Edits one controlled HEX color until the host-backed clipboard capability is available. */
8
+ import { Text } from '../typography/public';
9
+ /*** Edits one controlled HEX color and delegates copying to the host-owned clipboard capability. */
7
10
  export function ColorHexField({ disabled, onChange, value, }) {
8
11
  const [input, setInput] = React.useState(value);
12
+ const [previousValue, setPreviousValue] = React.useState(value);
13
+ const [copyFeedback, setCopyFeedback] = React.useState();
14
+ const clipboardWriter = useClipboardWriter();
9
15
  const { theme } = useZoraTheme();
10
- return (<TextInput accessibilityLabel="Color hex value" disabled={disabled} key={value} leadingAccessory={<View bg={value} borderColor={theme.semantics.border.default} borderWidth={1} height={30} radius="s" width={30}/>} onChangeText={(nextValue) => {
16
+ if (value !== previousValue) {
17
+ setPreviousValue(value);
18
+ setInput(value);
19
+ }
20
+ return (<View>
21
+ <TextInput accessibilityLabel="Color hex value" disabled={disabled} leadingAccessory={<View bg={value} borderColor={theme.semantics.border.default} borderWidth={1} height={30} radius="s" width={30}/>} onChangeText={(nextValue) => {
11
22
  setInput(nextValue);
12
23
  if (isHexColor(nextValue))
13
24
  onChange(nextValue);
14
- }} value={input}/>);
25
+ }} trailingAccessory={<IconButton iconName={copyFeedback === 'Color hex copied.'
26
+ ? 'checkmark'
27
+ : copyFeedback
28
+ ? 'warning'
29
+ : 'copy-outline'} label={copyFeedback ?? 'Copy color hex value'} disabled={disabled} onPress={() => {
30
+ void writeClipboardTextAsync(clipboardWriter, value).then((result) => {
31
+ setCopyFeedback(result === 'written'
32
+ ? 'Color hex copied.'
33
+ : result === 'denied'
34
+ ? 'Clipboard access was denied.'
35
+ : 'Clipboard is unavailable.');
36
+ });
37
+ }} variant="ghost"/>} value={input}/>
38
+ {copyFeedback ? (<Text accessibilityLiveRegion="polite" emphasis="muted" style={{ position: 'absolute', opacity: 0 }} variant="caption">
39
+ {copyFeedback}
40
+ </Text>) : null}
41
+ </View>);
15
42
  }
16
43
  //# sourceMappingURL=ColorHexField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorHexField.js","sourceRoot":"","sources":["../../../src/features/color/ColorHexField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,+FAA+F;AAC/F,MAAM,UAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,EACR,KAAK,GAKN;IACC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,KAAK,CAAC,CAAC;IACxD,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC;IAEjC,OAAO,CACL,CAAC,SAAS,CACR,kBAAkB,CAAC,iBAAiB,CACpC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,GAAG,CAAC,CAAC,KAAK,CAAC,CACX,gBAAgB,CAAC,CACf,CAAC,IAAI,CACH,EAAE,CAAC,CAAC,KAAK,CAAC,CACV,WAAW,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAC5C,WAAW,CAAC,CAAC,CAAC,CAAC,CACf,MAAM,CAAC,CAAC,EAAE,CAAC,CACX,MAAM,CAAC,GAAG,CACV,KAAK,CAAC,CAAC,EAAE,CAAC,EAEd,CAAC,CACD,YAAY,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE;YAC1B,QAAQ,CAAC,SAAS,CAAC,CAAC;YACpB,IAAI,UAAU,CAAC,SAAS,CAAC;gBAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;QACjD,CAAC,CAAC,CACF,KAAK,CAAC,CAAC,KAAK,CAAC,EACb,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { type HexColor, isHexColor } from '@ankhorage/color-theory';\nimport { TextInput } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { View } from '../layout/public';\nimport { useZoraTheme } from '../theme/composition/useZoraTheme';\n\n/*** Edits one controlled HEX color until the host-backed clipboard capability is available. */\nexport function ColorHexField({\n disabled,\n onChange,\n value,\n}: {\n readonly disabled: boolean;\n readonly onChange: (color: HexColor) => void;\n readonly value: HexColor;\n}) {\n const [input, setInput] = React.useState<string>(value);\n const { theme } = useZoraTheme();\n\n return (\n <TextInput\n accessibilityLabel=\"Color hex value\"\n disabled={disabled}\n key={value}\n leadingAccessory={\n <View\n bg={value}\n borderColor={theme.semantics.border.default}\n borderWidth={1}\n height={30}\n radius=\"s\"\n width={30}\n />\n }\n onChangeText={(nextValue) => {\n setInput(nextValue);\n if (isHexColor(nextValue)) onChange(nextValue);\n }}\n value={input}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"ColorHexField.js","sourceRoot":"","sources":["../../../src/features/color/ColorHexField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,IAAI,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,QAAQ,CAAC,CACP,YAAY,KAAK,mBAAmB;gBAClC,CAAC,CAAC,WAAW;gBACb,CAAC,CAAC,YAAY;oBACZ,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,cACR,CAAC,CACD,KAAK,CAAC,CAAC,YAAY,IAAI,sBAAsB,CAAC,CAC9C,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,OAAO,CAAC,CAAC,GAAG,EAAE;gBACZ,KAAK,uBAAuB,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;oBACnE,eAAe,CACb,MAAM,KAAK,SAAS;wBAClB,CAAC,CAAC,mBAAmB;wBACrB,CAAC,CAAC,MAAM,KAAK,QAAQ;4BACnB,CAAC,CAAC,8BAA8B;4BAChC,CAAC,CAAC,2BAA2B,CAClC,CAAC;gBACJ,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CACF,OAAO,CAAC,OAAO,EAEnB,CAAC,CACD,KAAK,CAAC,CAAC,KAAK,CAAC,EAEf;MAAA,CAAC,YAAY,CAAC,CAAC,CAAC,CACd,CAAC,IAAI,CACH,uBAAuB,CAAC,QAAQ,CAChC,QAAQ,CAAC,OAAO,CAChB,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAC5C,OAAO,CAAC,SAAS,CAEjB;UAAA,CAAC,YAAY,CACf;QAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { type HexColor, isHexColor } from '@ankhorage/color-theory';\nimport { useClipboardWriter, writeClipboardTextAsync } from '@ankhorage/runtime';\nimport { TextInput } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { IconButton } from '../button/public';\nimport { View } from '../layout/public';\nimport { useZoraTheme } from '../theme/composition/useZoraTheme';\nimport { Text } from '../typography/public';\n\n/*** Edits one controlled HEX color and delegates copying to the host-owned clipboard capability. */\nexport function ColorHexField({\n disabled,\n onChange,\n value,\n}: {\n readonly disabled: boolean;\n readonly onChange: (color: HexColor) => void;\n readonly value: HexColor;\n}) {\n const [input, setInput] = React.useState<string>(value);\n const [previousValue, setPreviousValue] = React.useState(value);\n const [copyFeedback, setCopyFeedback] = React.useState<string>();\n const clipboardWriter = useClipboardWriter();\n const { theme } = useZoraTheme();\n if (value !== previousValue) {\n setPreviousValue(value);\n setInput(value);\n }\n\n return (\n <View>\n <TextInput\n accessibilityLabel=\"Color hex value\"\n disabled={disabled}\n leadingAccessory={\n <View\n bg={value}\n borderColor={theme.semantics.border.default}\n borderWidth={1}\n height={30}\n radius=\"s\"\n width={30}\n />\n }\n onChangeText={(nextValue) => {\n setInput(nextValue);\n if (isHexColor(nextValue)) onChange(nextValue);\n }}\n trailingAccessory={\n <IconButton\n iconName={\n copyFeedback === 'Color hex copied.'\n ? 'checkmark'\n : copyFeedback\n ? 'warning'\n : 'copy-outline'\n }\n label={copyFeedback ?? 'Copy color hex value'}\n disabled={disabled}\n onPress={() => {\n void writeClipboardTextAsync(clipboardWriter, value).then((result) => {\n setCopyFeedback(\n result === 'written'\n ? 'Color hex copied.'\n : result === 'denied'\n ? 'Clipboard access was denied.'\n : 'Clipboard is unavailable.',\n );\n });\n }}\n variant=\"ghost\"\n />\n }\n value={input}\n />\n {copyFeedback ? (\n <Text\n accessibilityLiveRegion=\"polite\"\n emphasis=\"muted\"\n style={{ position: 'absolute', opacity: 0 }}\n variant=\"caption\"\n >\n {copyFeedback}\n </Text>\n ) : null}\n </View>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorPicker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,gBAAgB,EAAuC,MAAM,mBAAmB,CAAC;AAe/F,wFAAwF;AACxF,eAAO,MAAM,WAAW,wDAAuC,CAAC"}
1
+ {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorPicker.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,gBAAgB,EAAuC,MAAM,mBAAmB,CAAC;AAiB/F,wFAAwF;AACxF,eAAO,MAAM,WAAW,wDAAuC,CAAC"}
@@ -1,118 +1,179 @@
1
- import { COLOR_HARMONY_CATALOG } from '@ankhorage/color-theory';
1
+ import { COLOR_HARMONY_CATALOG, generateHarmonyRoleColors, } from '@ankhorage/color-theory';
2
2
  import { Pressable } from '@ankhorage/surface';
3
3
  import React from 'react';
4
+ import { View as NativeView } from 'react-native';
4
5
  import { IconButton } from '../button/public';
5
6
  import { Card } from '../card/public';
6
7
  import { Select } from '../form/select/public';
8
+ import { Gradient } from '../gradient/public';
9
+ import { Icon } from '../icon/public';
7
10
  import { Divider, View } from '../layout/public';
8
- import { Tab, TabList, TabPanel, Tabs } from '../tabs/public';
9
11
  import { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';
10
12
  import { useZoraTheme } from '../theme/composition/useZoraTheme';
11
- import { Heading } from '../typography/public';
13
+ import { Heading, Text } from '../typography/public';
12
14
  import { ColorHexField } from './ColorHexField';
13
15
  import { ColorWheel } from './ColorWheel';
16
+ import { resolveColorPickerGeometry } from './resolveColorPickerGeometry';
14
17
  import { resolveOklchColor } from './utils/resolveOklchColor';
15
18
  const DEFAULT_TABS = ['grid', 'wheel'];
16
19
  /*** Replaces the former Tone/Hue picker with one controlled Grid/Wheel presentation. */
17
20
  export const ColorPicker = withZoraThemeScope(ColorPickerInner);
18
21
  /*** Coordinates the shared colour, tone and harmony state across both picker presentations. */
19
- function ColorPickerInner({ themeId: _themeId, mode: _mode, inverted: _inverted, tabs = DEFAULT_TABS, primaryColor, harmony, tone, tones = [], width = 560, activeTab, onValueChange, onActiveTabChange, onDismiss, hideTabListWhenSingle = true, wheel, interactionPolicy, testID, }) {
22
+ function ColorPickerInner({ themeId: _themeId, mode: _mode, inverted: _inverted, tabs = DEFAULT_TABS, primaryColor, harmony, tone, tones = [], width = 560, height, infoLine, onInsufficientSpaceChange, activeTab, onValueChange, onActiveTabChange, onDismiss, hideTabListWhenSingle = true, wheel, interactionPolicy, testID, }) {
20
23
  const { theme } = useZoraTheme();
24
+ const [hostBounds, setHostBounds] = React.useState();
21
25
  const enabledTabs = resolveEnabledTabs(tabs);
22
26
  const firstTab = enabledTabs.at(0);
23
27
  if (!firstTab)
24
28
  throw new Error('ColorPicker requires at least one tab.');
25
- const resolvedTab = activeTab && enabledTabs.includes(activeTab) ? activeTab : firstTab;
26
- const geometry = resolveGeometry(width);
29
+ const [uncontrolledTab, setUncontrolledTab] = React.useState(firstTab);
30
+ const resolvedTab = activeTab && enabledTabs.includes(activeTab)
31
+ ? activeTab
32
+ : enabledTabs.includes(uncontrolledTab)
33
+ ? uncontrolledTab
34
+ : firstTab;
35
+ const geometry = resolveColorPickerGeometry({
36
+ height,
37
+ hostHeight: hostBounds && hostBounds.height > 0 ? hostBounds.height : undefined,
38
+ hostWidth: hostBounds && hostBounds.width > 0 ? hostBounds.width : undefined,
39
+ showTabs: enabledTabs.length > 1 || !hideTabListWhenSingle,
40
+ width,
41
+ });
27
42
  const selectedTone = tones.find((entry) => entry.id === tone);
28
43
  const emit = (next) => onValueChange({
29
44
  primaryColor: next.primaryColor ?? primaryColor,
30
- ...(next.harmony === undefined ? (harmony ? { harmony } : {}) : { harmony: next.harmony }),
31
- ...(next.tone === undefined ? (tone ? { tone } : {}) : { tone: next.tone }),
45
+ ...(Object.hasOwn(next, 'harmony') ? { harmony: next.harmony } : harmony ? { harmony } : {}),
46
+ ...(Object.hasOwn(next, 'tone') ? { tone: next.tone } : tone ? { tone } : {}),
32
47
  });
33
- const settings = (children) => (<PickerRow geometry={geometry} tone={tone} tones={tones} harmony={harmony} onHarmonyChange={(next) => emit({ harmony: next })} onToneChange={(next) => emit({ tone: next })}>
48
+ const settings = (children) => (<PickerRow geometry={geometry} tone={tone} tones={tones} harmony={harmony} interactionPolicy={interactionPolicy} onHarmonyChange={(next) => emit({ harmony: next })} onToneChange={(next) => emit({ tone: next })}>
34
49
  {children}
35
50
  </PickerRow>);
36
51
  React.useEffect(() => {
37
52
  if (activeTab && activeTab !== resolvedTab)
38
53
  onActiveTabChange?.(resolvedTab);
39
54
  }, [activeTab, onActiveTabChange, resolvedTab]);
40
- return (<View alignSelf="center" bg={theme.semantics.surface.raised} borderColor={theme.semantics.border.default} borderWidth={1} gap="m" maxWidth="100%" p={geometry.padding} radius="xl" testID={testID} width={geometry.width}>
41
- <View align="center" direction="row" justify="space-between" minHeight={48}>
42
- <Heading level={2}>Color</Heading>
43
- <View align="center" direction="row" gap="s">
44
- <View bg={primaryColor} borderColor={theme.semantics.border.default} borderWidth={1} height={36} radius="s" width={52}/>
45
- {onDismiss ? (<IconButton iconName="close" label="Close color picker" onPress={onDismiss}/>) : null}
46
- </View>
47
- </View>
48
- <Tabs onValueChange={(next) => {
49
- if (isColorPickerTab(next) && enabledTabs.includes(next))
50
- onActiveTabChange?.(next);
51
- }} value={resolvedTab} variant="attached">
52
- {enabledTabs.length > 1 || !hideTabListWhenSingle ? (<View borderColor={theme.semantics.border.default} borderWidth={1} overflow="hidden" radius="m">
53
- <TabList fill>
54
- {enabledTabs.map((tab) => (<Tab key={tab} label={tab === 'grid' ? 'Grid' : 'Wheel'} value={tab}/>))}
55
- </TabList>
56
- </View>) : null}
57
- {enabledTabs.includes('grid') ? (<TabPanel value="grid">
58
- {settings(<ColorGrid onSelect={(color) => emit({ primaryColor: color })} palette={resolvePalette(selectedTone)} selectionBorderColor={theme.semantics.content.default} selected={primaryColor} size={geometry.stage}/>)}
59
- </TabPanel>) : null}
60
- {enabledTabs.includes('wheel') ? (<TabPanel value="wheel">
61
- {settings(<ColorWheel {...wheel} harmony={harmony ?? null} onChange={(next) => emit({ primaryColor: next.color, harmony: next.harmony ?? undefined })} size={geometry.stage} value={primaryColor}/>)}
62
- </TabPanel>) : null}
63
- </Tabs>
64
- <Divider />
65
- <ColorHexField disabled={interactionPolicy === 'passive'} onChange={(color) => emit({ primaryColor: color })} value={primaryColor}/>
55
+ React.useEffect(() => {
56
+ onInsufficientSpaceChange?.(geometry.insufficientSpace);
57
+ }, [geometry.insufficientSpace, onInsufficientSpaceChange]);
58
+ return (<NativeView onLayout={(event) => setHostBounds({
59
+ height: event.nativeEvent.layout.height,
60
+ width: event.nativeEvent.layout.width,
61
+ })} style={{
62
+ alignSelf: 'stretch',
63
+ flexShrink: 1,
64
+ height: height ?? '100%',
65
+ maxHeight: '100%',
66
+ maxWidth: '100%',
67
+ width: '100%',
68
+ }}>
69
+ {!geometry.insufficientSpace ? (<View alignSelf="center" borderColor={theme.semantics.action.primary.base} borderWidth={geometry.border} radius="l" testID={testID} width={geometry.width}>
70
+ <Gradient colors={[theme.semantics.surface.raised, theme.semantics.neutral.surface]} end={{ x: 0, y: 1 }} radius="l" start={{ x: 0, y: 0 }}>
71
+ <View gap={geometry.footerGap} pb={geometry.footerInset} pt={geometry.padding} px={geometry.padding}>
72
+ <View gap={geometry.mainGap}>
73
+ <View align="center" direction="row" justify="space-between" minHeight={geometry.headerHeight}>
74
+ <Heading level={2}>Color</Heading>
75
+ <View align="center" direction="row" gap="s">
76
+ <View bg={primaryColor} borderColor={theme.semantics.border.default} borderWidth={1} height={36 * geometry.scale} radius="s" width={52 * geometry.scale}/>
77
+ {onDismiss ? (<IconButton iconName="close" label="Close color picker" onPress={onDismiss}/>) : null}
78
+ </View>
79
+ </View>
80
+ {enabledTabs.length > 1 || !hideTabListWhenSingle ? (<ColorPickerTabSelector activeTab={resolvedTab} geometry={geometry} interactionPolicy={interactionPolicy} tabs={enabledTabs} onChange={(next) => {
81
+ setUncontrolledTab(next);
82
+ onActiveTabChange?.(next);
83
+ }}/>) : null}
84
+ {resolvedTab === 'grid'
85
+ ? settings(<ColorGrid disabled={interactionPolicy === 'passive'} harmony={harmony} onSelect={(color) => emit({ primaryColor: color })} palette={resolvePalette(selectedTone, primaryColor, harmony)} primaryIndicatorColor={theme.semantics.action.primary.base} selectionBorderColor={theme.semantics.content.default} selected={primaryColor} size={geometry.stage}/>)
86
+ : settings(<ColorWheel {...wheel} harmony={harmony ?? null} interactionPolicy={interactionPolicy} onChange={(next) => emit({ primaryColor: next.color, harmony: next.harmony ?? undefined })} size={geometry.stage} toneTarget={selectedTone?.accentTarget} value={primaryColor}/>)}
87
+ <View height={geometry.infoLineHeight} justify="center">
88
+ {infoLine ? (<Text accessibilityLabel={infoLine} numberOfLines={1} variant="caption">
89
+ {infoLine}
90
+ </Text>) : null}
91
+ </View>
92
+ </View>
93
+ <View gap={geometry.footerGap}>
94
+ <Divider />
95
+ <View height={geometry.footerHeight} justify="center">
96
+ <ColorHexField disabled={interactionPolicy === 'passive'} onChange={(color) => emit({ primaryColor: color })} value={primaryColor}/>
97
+ </View>
98
+ </View>
99
+ </View>
100
+ </Gradient>
101
+ </View>) : (<View accessibilityLabel="Color picker needs more space" testID={testID ? `${testID}-insufficient-space` : undefined}/>)}
102
+ </NativeView>);
103
+ }
104
+ /*** Renders the ColorPicker's primary-accent tab choices without inheriting generic panel surfaces. */
105
+ function ColorPickerTabSelector({ activeTab, geometry, interactionPolicy, tabs, onChange, }) {
106
+ const { theme } = useZoraTheme();
107
+ return (<View borderColor={theme.semantics.border.default} borderWidth={1} direction="row" overflow="hidden" radius="m">
108
+ {tabs.map((tab) => {
109
+ const selected = tab === activeTab;
110
+ return (<Pressable accessibilityLabel={`${tab === 'grid' ? 'Grid' : 'Wheel'} color picker tab`} accessibilityRole="tab" accessibilityState={{ selected }} disabled={interactionPolicy === 'passive'} key={tab} onPress={() => onChange(tab)} style={{ flex: 1 }}>
111
+ <View align="center" bg={selected ? theme.semantics.action.primary.base : 'transparent'} direction="row" gap="xs" height={geometry.tabHeight - geometry.border * 2} justify="center" radius="s">
112
+ <Icon color={selected ? theme.semantics.action.primary.onSolidText : undefined} name={tab === 'grid' ? 'grid' : 'color-palette'} size={16 * geometry.scale}/>
113
+ <Text style={selected ? { color: theme.semantics.action.primary.onSolidText } : undefined} variant="label" weight="medium">
114
+ {tab === 'grid' ? 'Grid' : 'Wheel'}
115
+ </Text>
116
+ </View>
117
+ </Pressable>);
118
+ })}
66
119
  </View>);
67
120
  }
68
121
  /*** Keeps the settings rail identical while the stage changes presentation. */
69
- function PickerRow({ children, geometry, tone, tones, harmony, onToneChange, onHarmonyChange, }) {
122
+ function PickerRow({ children, geometry, tone, tones, harmony, interactionPolicy, onToneChange, onHarmonyChange, }) {
70
123
  return (<View align="flex-start" direction="row" gap={geometry.gap}>
71
- <View gap="m" width={geometry.rail}>
72
- <Card compact title="Tone">
73
- <Select onValueChange={onToneChange} options={tones.map((entry) => ({ label: entry.accent, value: entry.id }))} placeholder="Any tone" value={tone}/>
74
- </Card>
75
- <Card compact title="Harmony">
76
- <Select onValueChange={onHarmonyChange} options={COLOR_HARMONY_CATALOG.map((entry) => ({
124
+ <View gap={geometry.cardGap} width={geometry.rail}>
125
+ <SettingCard geometry={geometry} icon="diamond" interactionPolicy={interactionPolicy} label="Tone" onClear={tone ? () => onToneChange(undefined) : undefined}>
126
+ <Select compact interactionPolicy={interactionPolicy} onValueChange={onToneChange} options={tones.map((entry) => ({ label: entry.accent, value: entry.id }))} placeholder="Any tone" value={tone}/>
127
+ </SettingCard>
128
+ <SettingCard geometry={geometry} icon="color-palette" interactionPolicy={interactionPolicy} label="Harmony" onClear={harmony ? () => onHarmonyChange(undefined) : undefined}>
129
+ <Select compact interactionPolicy={interactionPolicy} onValueChange={onHarmonyChange} options={COLOR_HARMONY_CATALOG.map((entry) => ({
77
130
  label: entry.label,
78
131
  value: entry.id,
79
132
  }))} placeholder="None" value={harmony}/>
80
- </Card>
133
+ </SettingCard>
81
134
  </View>
82
135
  {children}
83
136
  </View>);
84
137
  }
138
+ /*** Renders one compact, geometry-owned Tone or Harmony setting control. */
139
+ function SettingCard({ children, geometry, icon, interactionPolicy, label, onClear, }) {
140
+ return (<Card compact minHeight={geometry.cardHeight} padding="s" radius="m" tone="subtle">
141
+ <View align="center" direction="row" gap="xs" justify="space-between">
142
+ <View align="center" direction="row" gap="xs">
143
+ <Icon name={icon} size={20 * geometry.scale}/>
144
+ <Text numberOfLines={1} variant="label" weight="medium">
145
+ {label}
146
+ </Text>
147
+ </View>
148
+ {onClear ? (<IconButton disabled={interactionPolicy === 'passive'} iconName="close" label={`Clear ${label}`} onPress={onClear} size="s"/>) : null}
149
+ </View>
150
+ {children}
151
+ </Card>);
152
+ }
85
153
  /*** Renders all 64 deterministic OKLCH candidates without scrolling or virtualisation. */
86
- function ColorGrid({ palette, selectionBorderColor, selected, size, onSelect, }) {
154
+ function ColorGrid({ palette, primaryIndicatorColor, selectionBorderColor, selected, size, onSelect, disabled = false, harmony, }) {
87
155
  const gap = Math.max(3, Math.round(size / 68));
88
156
  const cell = (size - 7 * gap) / 8;
157
+ const harmonyColors = new Set(harmony ? generateHarmonyRoleColors(selected, harmony).colors.map((role) => role.hex) : []);
89
158
  return (<View accessibilityLabel="Color grid" direction="row" gap={gap} width={size} wrap="wrap">
90
- {palette.map((color) => (<Pressable accessibilityLabel={`Select ${color}`} bg={color} borderColor={color === selected ? selectionBorderColor : 'transparent'} borderWidth={color === selected ? 3 : 1} height={cell} key={color} onPress={() => onSelect(color)} radius="s" width={cell}/>))}
159
+ {palette.map((color) => (<Pressable accessibilityLabel={`Select ${color}`} bg={color} borderColor={color === selected
160
+ ? selectionBorderColor
161
+ : harmonyColors.has(color)
162
+ ? primaryIndicatorColor
163
+ : 'transparent'} borderWidth={color === selected ? 3 : harmonyColors.has(color) ? 1 : 0} disabled={disabled} height={cell} key={color} onPress={() => onSelect(color)} radius="s" width={cell}/>))}
91
164
  </View>);
92
165
  }
93
166
  /*** Samples hue, chroma and lightness deterministically into the 8-by-8 grid. */
94
- function resolvePalette(tone) {
167
+ function resolvePalette(tone, primaryColor, harmony) {
95
168
  const target = tone?.accentTarget;
96
- return Array.from({ length: 64 }, (_, index) => resolveOklchColor({
169
+ const candidates = Array.from({ length: 64 }, (_, index) => resolveOklchColor({
97
170
  chroma: target?.chroma ?? 0.08 + (index % 8) * 0.018,
98
171
  lightness: target?.lightness ?? 0.35 + Math.floor(index / 8) * 0.065,
99
172
  }, (index * 137.508) % 360));
100
- }
101
- /*** Resolves continuous width-owned rail and stage geometry from the specified picker width. */
102
- function resolveGeometry(requestedWidth) {
103
- if (requestedWidth < 360)
104
- throw new Error('ColorPicker requires a host width of at least 360 logical pixels.');
105
- const scale = Math.max(0, (Math.min(requestedWidth, 560) - 360) / 200);
106
- const padding = 12 + scale * 12;
107
- const rail = 104 + scale * 46;
108
- const gap = 12 + scale * 8;
109
- return {
110
- width: requestedWidth,
111
- padding,
112
- rail,
113
- gap,
114
- stage: requestedWidth - 2 - 2 * padding - rail - gap,
115
- };
173
+ const roleColors = harmony
174
+ ? generateHarmonyRoleColors(primaryColor, harmony).colors.map((role) => role.hex)
175
+ : [];
176
+ return Array.from(new Set([primaryColor, ...roleColors, ...candidates])).slice(0, 64);
116
177
  }
117
178
  /*** Rejects empty and legacy tab configurations before they render focusable controls. */
118
179
  function resolveEnabledTabs(tabs) {
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/features/color/ColorPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAoC,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,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AA0F;AAC1F,SAAS,kBAAkB,CAAC,IAA+B;IACzD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACjF,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,sEAAsE;AACtE,SAAS,gBAAgB,CAAC,KAAa;IACrC,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,CAAC;AAC/C,CAAC","sourcesContent":["import { COLOR_HARMONY_CATALOG, type ColorHarmony, type HexColor } from '@ankhorage/color-theory';\nimport { Pressable } from '@ankhorage/surface';\nimport React from 'react';\n\nimport type { ColorPickerProps, ColorPickerTab, ColorToneDefinition } from '../../types/color';\nimport { IconButton } from '../button/public';\nimport { Card } from '../card/public';\nimport { Select } from '../form/select/public';\nimport { Divider, View } from '../layout/public';\nimport { Tab, TabList, TabPanel, Tabs } from '../tabs/public';\nimport { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';\nimport { useZoraTheme } from '../theme/composition/useZoraTheme';\nimport { Heading } from '../typography/public';\nimport { ColorHexField } from './ColorHexField';\nimport { ColorWheel } from './ColorWheel';\nimport { resolveOklchColor } from './utils/resolveOklchColor';\n\nconst DEFAULT_TABS: readonly ColorPickerTab[] = ['grid', 'wheel'];\n\n/*** Replaces the former Tone/Hue picker with one controlled Grid/Wheel presentation. */\nexport const ColorPicker = withZoraThemeScope(ColorPickerInner);\n\n/*** Coordinates the shared colour, tone and harmony state across both picker presentations. */\nfunction ColorPickerInner({\n themeId: _themeId,\n mode: _mode,\n inverted: _inverted,\n tabs = DEFAULT_TABS,\n primaryColor,\n harmony,\n tone,\n tones = [],\n width = 560,\n activeTab,\n onValueChange,\n onActiveTabChange,\n onDismiss,\n hideTabListWhenSingle = true,\n wheel,\n interactionPolicy,\n testID,\n}: ColorPickerProps) {\n const { theme } = useZoraTheme();\n const enabledTabs = resolveEnabledTabs(tabs);\n const firstTab = enabledTabs.at(0);\n if (!firstTab) throw new Error('ColorPicker requires at least one tab.');\n const resolvedTab = activeTab && enabledTabs.includes(activeTab) ? activeTab : firstTab;\n const geometry = resolveGeometry(width);\n const selectedTone = tones.find((entry) => entry.id === tone);\n const emit = (next: Partial<{ primaryColor: HexColor; harmony: ColorHarmony; tone: string }>) =>\n onValueChange({\n primaryColor: next.primaryColor ?? primaryColor,\n ...(next.harmony === undefined ? (harmony ? { harmony } : {}) : { harmony: next.harmony }),\n ...(next.tone === undefined ? (tone ? { tone } : {}) : { tone: next.tone }),\n });\n const settings = (children: React.ReactNode) => (\n <PickerRow\n geometry={geometry}\n tone={tone}\n tones={tones}\n harmony={harmony}\n onHarmonyChange={(next) => emit({ harmony: next })}\n onToneChange={(next) => emit({ tone: next })}\n >\n {children}\n </PickerRow>\n );\n React.useEffect(() => {\n if (activeTab && activeTab !== resolvedTab) onActiveTabChange?.(resolvedTab);\n }, [activeTab, onActiveTabChange, resolvedTab]);\n return (\n <View\n alignSelf=\"center\"\n bg={theme.semantics.surface.raised}\n borderColor={theme.semantics.border.default}\n borderWidth={1}\n gap=\"m\"\n maxWidth=\"100%\"\n p={geometry.padding}\n radius=\"xl\"\n testID={testID}\n width={geometry.width}\n >\n <View align=\"center\" direction=\"row\" justify=\"space-between\" minHeight={48}>\n <Heading level={2}>Color</Heading>\n <View align=\"center\" direction=\"row\" gap=\"s\">\n <View\n bg={primaryColor}\n borderColor={theme.semantics.border.default}\n borderWidth={1}\n height={36}\n radius=\"s\"\n width={52}\n />\n {onDismiss ? (\n <IconButton iconName=\"close\" label=\"Close color picker\" onPress={onDismiss} />\n ) : null}\n </View>\n </View>\n <Tabs\n onValueChange={(next) => {\n if (isColorPickerTab(next) && enabledTabs.includes(next)) onActiveTabChange?.(next);\n }}\n value={resolvedTab}\n variant=\"attached\"\n >\n {enabledTabs.length > 1 || !hideTabListWhenSingle ? (\n <View\n borderColor={theme.semantics.border.default}\n borderWidth={1}\n overflow=\"hidden\"\n radius=\"m\"\n >\n <TabList fill>\n {enabledTabs.map((tab) => (\n <Tab key={tab} label={tab === 'grid' ? 'Grid' : 'Wheel'} value={tab} />\n ))}\n </TabList>\n </View>\n ) : null}\n {enabledTabs.includes('grid') ? (\n <TabPanel value=\"grid\">\n {settings(\n <ColorGrid\n onSelect={(color) => emit({ primaryColor: color })}\n palette={resolvePalette(selectedTone)}\n selectionBorderColor={theme.semantics.content.default}\n selected={primaryColor}\n size={geometry.stage}\n />,\n )}\n </TabPanel>\n ) : null}\n {enabledTabs.includes('wheel') ? (\n <TabPanel value=\"wheel\">\n {settings(\n <ColorWheel\n {...wheel}\n harmony={harmony ?? null}\n onChange={(next) =>\n emit({ primaryColor: next.color, harmony: next.harmony ?? undefined })\n }\n size={geometry.stage}\n value={primaryColor}\n />,\n )}\n </TabPanel>\n ) : null}\n </Tabs>\n <Divider />\n <ColorHexField\n disabled={interactionPolicy === 'passive'}\n onChange={(color) => emit({ primaryColor: color })}\n value={primaryColor}\n />\n </View>\n );\n}\n\n/*** Keeps the settings rail identical while the stage changes presentation. */\nfunction PickerRow({\n children,\n geometry,\n tone,\n tones,\n harmony,\n onToneChange,\n onHarmonyChange,\n}: {\n readonly children: React.ReactNode;\n readonly geometry: ReturnType<typeof resolveGeometry>;\n readonly tone?: string;\n readonly tones: readonly ColorToneDefinition[];\n readonly harmony?: ColorHarmony;\n readonly onToneChange: (tone: string) => void;\n readonly onHarmonyChange: (harmony?: ColorHarmony) => void;\n}) {\n return (\n <View align=\"flex-start\" direction=\"row\" gap={geometry.gap}>\n <View gap=\"m\" width={geometry.rail}>\n <Card compact title=\"Tone\">\n <Select\n onValueChange={onToneChange}\n options={tones.map((entry) => ({ label: entry.accent, value: entry.id }))}\n placeholder=\"Any tone\"\n value={tone}\n />\n </Card>\n <Card compact title=\"Harmony\">\n <Select\n onValueChange={onHarmonyChange}\n options={COLOR_HARMONY_CATALOG.map((entry) => ({\n label: entry.label,\n value: entry.id,\n }))}\n placeholder=\"None\"\n value={harmony}\n />\n </Card>\n </View>\n {children}\n </View>\n );\n}\n\n/*** Renders all 64 deterministic OKLCH candidates without scrolling or virtualisation. */\nfunction ColorGrid({\n palette,\n selectionBorderColor,\n selected,\n size,\n onSelect,\n}: {\n readonly palette: readonly HexColor[];\n readonly selectionBorderColor: string;\n readonly selected: HexColor;\n readonly size: number;\n readonly onSelect: (color: HexColor) => void;\n}) {\n const gap = Math.max(3, Math.round(size / 68));\n const cell = (size - 7 * gap) / 8;\n return (\n <View accessibilityLabel=\"Color grid\" direction=\"row\" gap={gap} width={size} wrap=\"wrap\">\n {palette.map((color) => (\n <Pressable\n accessibilityLabel={`Select ${color}`}\n bg={color}\n borderColor={color === selected ? selectionBorderColor : 'transparent'}\n borderWidth={color === selected ? 3 : 1}\n height={cell}\n key={color}\n onPress={() => onSelect(color)}\n radius=\"s\"\n width={cell}\n />\n ))}\n </View>\n );\n}\n\n/*** Samples hue, chroma and lightness deterministically into the 8-by-8 grid. */\nfunction resolvePalette(tone?: ColorToneDefinition): readonly HexColor[] {\n const target = tone?.accentTarget;\n return Array.from({ length: 64 }, (_, index) =>\n resolveOklchColor(\n {\n chroma: target?.chroma ?? 0.08 + (index % 8) * 0.018,\n lightness: target?.lightness ?? 0.35 + Math.floor(index / 8) * 0.065,\n },\n (index * 137.508) % 360,\n ),\n );\n}\n\n/*** Resolves continuous width-owned rail and stage geometry from the specified picker width. */\nfunction resolveGeometry(requestedWidth: number) {\n if (requestedWidth < 360)\n throw new Error('ColorPicker requires a host width of at least 360 logical pixels.');\n const scale = Math.max(0, (Math.min(requestedWidth, 560) - 360) / 200);\n const padding = 12 + scale * 12;\n const rail = 104 + scale * 46;\n const gap = 12 + scale * 8;\n return {\n width: requestedWidth,\n padding,\n rail,\n gap,\n stage: requestedWidth - 2 - 2 * padding - rail - gap,\n };\n}\n\n/*** Rejects empty and legacy tab configurations before they render focusable controls. */\nfunction resolveEnabledTabs(tabs: readonly ColorPickerTab[]) {\n if (tabs.length === 0) throw new Error('ColorPicker requires at least one tab.');\n if (tabs.some((tab) => !isColorPickerTab(tab)))\n throw new Error('ColorPicker supports only Grid and Wheel tabs.');\n return tabs;\n}\n\n/*** Narrows a Surface tab value to the new ColorPicker vocabulary. */\nfunction isColorPickerTab(value: string): value is ColorPickerTab {\n return value === 'grid' || value === 'wheel';\n}\n"]}
1
+ {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/features/color/ColorPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAErB,yBAAyB,GAE1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C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C,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,sEAAsE;AACtE,SAAS,gBAAgB,CAAC,KAAa;IACrC,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,CAAC;AAC/C,CAAC","sourcesContent":["import {\n COLOR_HARMONY_CATALOG,\n type ColorHarmony,\n generateHarmonyRoleColors,\n type HexColor,\n} from '@ankhorage/color-theory';\nimport { Pressable } from '@ankhorage/surface';\nimport React from 'react';\nimport { View as NativeView } from 'react-native';\n\nimport type { ColorPickerProps, ColorPickerTab, ColorToneDefinition } from '../../types/color';\nimport { IconButton } from '../button/public';\nimport { Card } from '../card/public';\nimport { Select } from '../form/select/public';\nimport { Gradient } from '../gradient/public';\nimport { Icon } from '../icon/public';\nimport { Divider, View } from '../layout/public';\nimport { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';\nimport { useZoraTheme } from '../theme/composition/useZoraTheme';\nimport { Heading, Text } from '../typography/public';\nimport { ColorHexField } from './ColorHexField';\nimport { ColorWheel } from './ColorWheel';\nimport { resolveColorPickerGeometry } from './resolveColorPickerGeometry';\nimport { resolveOklchColor } from './utils/resolveOklchColor';\n\nconst DEFAULT_TABS: readonly ColorPickerTab[] = ['grid', 'wheel'];\n\n/*** Replaces the former Tone/Hue picker with one controlled Grid/Wheel presentation. */\nexport const ColorPicker = withZoraThemeScope(ColorPickerInner);\n\n/*** Coordinates the shared colour, tone and harmony state across both picker presentations. */\nfunction ColorPickerInner({\n themeId: _themeId,\n mode: _mode,\n inverted: _inverted,\n tabs = DEFAULT_TABS,\n primaryColor,\n harmony,\n tone,\n tones = [],\n width = 560,\n height,\n infoLine,\n onInsufficientSpaceChange,\n activeTab,\n onValueChange,\n onActiveTabChange,\n onDismiss,\n hideTabListWhenSingle = true,\n wheel,\n interactionPolicy,\n testID,\n}: ColorPickerProps) {\n const { theme } = useZoraTheme();\n const [hostBounds, setHostBounds] = React.useState<{\n readonly height: number;\n readonly width: number;\n }>();\n const enabledTabs = resolveEnabledTabs(tabs);\n const firstTab = enabledTabs.at(0);\n if (!firstTab) throw new Error('ColorPicker requires at least one tab.');\n const [uncontrolledTab, setUncontrolledTab] = React.useState<ColorPickerTab>(firstTab);\n const resolvedTab =\n activeTab && enabledTabs.includes(activeTab)\n ? activeTab\n : enabledTabs.includes(uncontrolledTab)\n ? uncontrolledTab\n : firstTab;\n const geometry = resolveColorPickerGeometry({\n height,\n hostHeight: hostBounds && hostBounds.height > 0 ? hostBounds.height : undefined,\n hostWidth: hostBounds && hostBounds.width > 0 ? hostBounds.width : undefined,\n showTabs: enabledTabs.length > 1 || !hideTabListWhenSingle,\n width,\n });\n const selectedTone = tones.find((entry) => entry.id === tone);\n const emit = (next: {\n readonly harmony?: ColorHarmony;\n readonly primaryColor?: HexColor;\n readonly tone?: string;\n }) =>\n onValueChange({\n primaryColor: next.primaryColor ?? primaryColor,\n ...(Object.hasOwn(next, 'harmony') ? { harmony: next.harmony } : harmony ? { harmony } : {}),\n ...(Object.hasOwn(next, 'tone') ? { tone: next.tone } : tone ? { tone } : {}),\n });\n const settings = (children: React.ReactNode) => (\n <PickerRow\n geometry={geometry}\n tone={tone}\n tones={tones}\n harmony={harmony}\n interactionPolicy={interactionPolicy}\n onHarmonyChange={(next) => emit({ harmony: next })}\n onToneChange={(next) => emit({ tone: next })}\n >\n {children}\n </PickerRow>\n );\n React.useEffect(() => {\n if (activeTab && activeTab !== resolvedTab) onActiveTabChange?.(resolvedTab);\n }, [activeTab, onActiveTabChange, resolvedTab]);\n React.useEffect(() => {\n onInsufficientSpaceChange?.(geometry.insufficientSpace);\n }, [geometry.insufficientSpace, onInsufficientSpaceChange]);\n return (\n <NativeView\n onLayout={(event) =>\n setHostBounds({\n height: event.nativeEvent.layout.height,\n width: event.nativeEvent.layout.width,\n })\n }\n style={{\n alignSelf: 'stretch',\n flexShrink: 1,\n height: height ?? '100%',\n maxHeight: '100%',\n maxWidth: '100%',\n width: '100%',\n }}\n >\n {!geometry.insufficientSpace ? (\n <View\n alignSelf=\"center\"\n borderColor={theme.semantics.action.primary.base}\n borderWidth={geometry.border}\n radius=\"l\"\n testID={testID}\n width={geometry.width}\n >\n <Gradient\n colors={[theme.semantics.surface.raised, theme.semantics.neutral.surface]}\n end={{ x: 0, y: 1 }}\n radius=\"l\"\n start={{ x: 0, y: 0 }}\n >\n <View\n gap={geometry.footerGap}\n pb={geometry.footerInset}\n pt={geometry.padding}\n px={geometry.padding}\n >\n <View gap={geometry.mainGap}>\n <View\n align=\"center\"\n direction=\"row\"\n justify=\"space-between\"\n minHeight={geometry.headerHeight}\n >\n <Heading level={2}>Color</Heading>\n <View align=\"center\" direction=\"row\" gap=\"s\">\n <View\n bg={primaryColor}\n borderColor={theme.semantics.border.default}\n borderWidth={1}\n height={36 * geometry.scale}\n radius=\"s\"\n width={52 * geometry.scale}\n />\n {onDismiss ? (\n <IconButton iconName=\"close\" label=\"Close color picker\" onPress={onDismiss} />\n ) : null}\n </View>\n </View>\n {enabledTabs.length > 1 || !hideTabListWhenSingle ? (\n <ColorPickerTabSelector\n activeTab={resolvedTab}\n geometry={geometry}\n interactionPolicy={interactionPolicy}\n tabs={enabledTabs}\n onChange={(next) => {\n setUncontrolledTab(next);\n onActiveTabChange?.(next);\n }}\n />\n ) : null}\n {resolvedTab === 'grid'\n ? settings(\n <ColorGrid\n disabled={interactionPolicy === 'passive'}\n harmony={harmony}\n onSelect={(color) => emit({ primaryColor: color })}\n palette={resolvePalette(selectedTone, primaryColor, harmony)}\n primaryIndicatorColor={theme.semantics.action.primary.base}\n selectionBorderColor={theme.semantics.content.default}\n selected={primaryColor}\n size={geometry.stage}\n />,\n )\n : settings(\n <ColorWheel\n {...wheel}\n harmony={harmony ?? null}\n interactionPolicy={interactionPolicy}\n onChange={(next) =>\n emit({ primaryColor: next.color, harmony: next.harmony ?? undefined })\n }\n size={geometry.stage}\n toneTarget={selectedTone?.accentTarget}\n value={primaryColor}\n />,\n )}\n <View height={geometry.infoLineHeight} justify=\"center\">\n {infoLine ? (\n <Text accessibilityLabel={infoLine} numberOfLines={1} variant=\"caption\">\n {infoLine}\n </Text>\n ) : null}\n </View>\n </View>\n <View gap={geometry.footerGap}>\n <Divider />\n <View height={geometry.footerHeight} justify=\"center\">\n <ColorHexField\n disabled={interactionPolicy === 'passive'}\n onChange={(color) => emit({ primaryColor: color })}\n value={primaryColor}\n />\n </View>\n </View>\n </View>\n </Gradient>\n </View>\n ) : (\n <View\n accessibilityLabel=\"Color picker needs more space\"\n testID={testID ? `${testID}-insufficient-space` : undefined}\n />\n )}\n </NativeView>\n );\n}\n\n/*** Renders the ColorPicker's primary-accent tab choices without inheriting generic panel surfaces. */\nfunction ColorPickerTabSelector({\n activeTab,\n geometry,\n interactionPolicy,\n tabs,\n onChange,\n}: {\n readonly activeTab: ColorPickerTab;\n readonly geometry: ReturnType<typeof resolveColorPickerGeometry>;\n readonly interactionPolicy?: ColorPickerProps['interactionPolicy'];\n readonly tabs: readonly ColorPickerTab[];\n readonly onChange: (tab: ColorPickerTab) => void;\n}) {\n const { theme } = useZoraTheme();\n return (\n <View\n borderColor={theme.semantics.border.default}\n borderWidth={1}\n direction=\"row\"\n overflow=\"hidden\"\n radius=\"m\"\n >\n {tabs.map((tab) => {\n const selected = tab === activeTab;\n return (\n <Pressable\n accessibilityLabel={`${tab === 'grid' ? 'Grid' : 'Wheel'} color picker tab`}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected }}\n disabled={interactionPolicy === 'passive'}\n key={tab}\n onPress={() => onChange(tab)}\n style={{ flex: 1 }}\n >\n <View\n align=\"center\"\n bg={selected ? theme.semantics.action.primary.base : 'transparent'}\n direction=\"row\"\n gap=\"xs\"\n height={geometry.tabHeight - geometry.border * 2}\n justify=\"center\"\n radius=\"s\"\n >\n <Icon\n color={selected ? theme.semantics.action.primary.onSolidText : undefined}\n name={tab === 'grid' ? 'grid' : 'color-palette'}\n size={16 * geometry.scale}\n />\n <Text\n style={selected ? { color: theme.semantics.action.primary.onSolidText } : undefined}\n variant=\"label\"\n weight=\"medium\"\n >\n {tab === 'grid' ? 'Grid' : 'Wheel'}\n </Text>\n </View>\n </Pressable>\n );\n })}\n </View>\n );\n}\n\n/*** Keeps the settings rail identical while the stage changes presentation. */\nfunction PickerRow({\n children,\n geometry,\n tone,\n tones,\n harmony,\n interactionPolicy,\n onToneChange,\n onHarmonyChange,\n}: {\n readonly children: React.ReactNode;\n readonly geometry: ReturnType<typeof resolveColorPickerGeometry>;\n readonly tone?: string;\n readonly tones: readonly ColorToneDefinition[];\n readonly harmony?: ColorHarmony;\n readonly interactionPolicy?: ColorPickerProps['interactionPolicy'];\n readonly onToneChange: (tone?: string) => void;\n readonly onHarmonyChange: (harmony?: ColorHarmony) => void;\n}) {\n return (\n <View align=\"flex-start\" direction=\"row\" gap={geometry.gap}>\n <View gap={geometry.cardGap} width={geometry.rail}>\n <SettingCard\n geometry={geometry}\n icon=\"diamond\"\n interactionPolicy={interactionPolicy}\n label=\"Tone\"\n onClear={tone ? () => onToneChange(undefined) : undefined}\n >\n <Select\n compact\n interactionPolicy={interactionPolicy}\n onValueChange={onToneChange}\n options={tones.map((entry) => ({ label: entry.accent, value: entry.id }))}\n placeholder=\"Any tone\"\n value={tone}\n />\n </SettingCard>\n <SettingCard\n geometry={geometry}\n icon=\"color-palette\"\n interactionPolicy={interactionPolicy}\n label=\"Harmony\"\n onClear={harmony ? () => onHarmonyChange(undefined) : undefined}\n >\n <Select\n compact\n interactionPolicy={interactionPolicy}\n onValueChange={onHarmonyChange}\n options={COLOR_HARMONY_CATALOG.map((entry) => ({\n label: entry.label,\n value: entry.id,\n }))}\n placeholder=\"None\"\n value={harmony}\n />\n </SettingCard>\n </View>\n {children}\n </View>\n );\n}\n\n/*** Renders one compact, geometry-owned Tone or Harmony setting control. */\nfunction SettingCard({\n children,\n geometry,\n icon,\n interactionPolicy,\n label,\n onClear,\n}: {\n readonly children: React.ReactNode;\n readonly geometry: ReturnType<typeof resolveColorPickerGeometry>;\n readonly icon: 'color-palette' | 'diamond';\n readonly interactionPolicy?: ColorPickerProps['interactionPolicy'];\n readonly label: string;\n readonly onClear?: () => void;\n}) {\n return (\n <Card compact minHeight={geometry.cardHeight} padding=\"s\" radius=\"m\" tone=\"subtle\">\n <View align=\"center\" direction=\"row\" gap=\"xs\" justify=\"space-between\">\n <View align=\"center\" direction=\"row\" gap=\"xs\">\n <Icon name={icon} size={20 * geometry.scale} />\n <Text numberOfLines={1} variant=\"label\" weight=\"medium\">\n {label}\n </Text>\n </View>\n {onClear ? (\n <IconButton\n disabled={interactionPolicy === 'passive'}\n iconName=\"close\"\n label={`Clear ${label}`}\n onPress={onClear}\n size=\"s\"\n />\n ) : null}\n </View>\n {children}\n </Card>\n );\n}\n\n/*** Renders all 64 deterministic OKLCH candidates without scrolling or virtualisation. */\nfunction ColorGrid({\n palette,\n primaryIndicatorColor,\n selectionBorderColor,\n selected,\n size,\n onSelect,\n disabled = false,\n harmony,\n}: {\n readonly palette: readonly HexColor[];\n readonly primaryIndicatorColor: string;\n readonly selectionBorderColor: string;\n readonly selected: HexColor;\n readonly size: number;\n readonly onSelect: (color: HexColor) => void;\n readonly disabled?: boolean;\n readonly harmony?: ColorHarmony;\n}) {\n const gap = Math.max(3, Math.round(size / 68));\n const cell = (size - 7 * gap) / 8;\n const harmonyColors = new Set(\n harmony ? generateHarmonyRoleColors(selected, harmony).colors.map((role) => role.hex) : [],\n );\n return (\n <View accessibilityLabel=\"Color grid\" direction=\"row\" gap={gap} width={size} wrap=\"wrap\">\n {palette.map((color) => (\n <Pressable\n accessibilityLabel={`Select ${color}`}\n bg={color}\n borderColor={\n color === selected\n ? selectionBorderColor\n : harmonyColors.has(color)\n ? primaryIndicatorColor\n : 'transparent'\n }\n borderWidth={color === selected ? 3 : harmonyColors.has(color) ? 1 : 0}\n disabled={disabled}\n height={cell}\n key={color}\n onPress={() => onSelect(color)}\n radius=\"s\"\n width={cell}\n />\n ))}\n </View>\n );\n}\n\n/*** Samples hue, chroma and lightness deterministically into the 8-by-8 grid. */\nfunction resolvePalette(\n tone: ColorToneDefinition | undefined,\n primaryColor: HexColor,\n harmony: ColorHarmony | undefined,\n): readonly HexColor[] {\n const target = tone?.accentTarget;\n const candidates = Array.from({ length: 64 }, (_, index) =>\n resolveOklchColor(\n {\n chroma: target?.chroma ?? 0.08 + (index % 8) * 0.018,\n lightness: target?.lightness ?? 0.35 + Math.floor(index / 8) * 0.065,\n },\n (index * 137.508) % 360,\n ),\n );\n const roleColors = harmony\n ? generateHarmonyRoleColors(primaryColor, harmony).colors.map((role) => role.hex)\n : [];\n return Array.from(new Set([primaryColor, ...roleColors, ...candidates])).slice(0, 64);\n}\n\n/*** Rejects empty and legacy tab configurations before they render focusable controls. */\nfunction resolveEnabledTabs(tabs: readonly ColorPickerTab[]) {\n if (tabs.length === 0) throw new Error('ColorPicker requires at least one tab.');\n if (tabs.some((tab) => !isColorPickerTab(tab)))\n throw new Error('ColorPicker supports only Grid and Wheel tabs.');\n return tabs;\n}\n\n/*** Narrows a Surface tab value to the new ColorPicker vocabulary. */\nfunction isColorPickerTab(value: string): value is ColorPickerTab {\n return value === 'grid' || value === 'wheel';\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWheel.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAgBzD,4FAA4F;AAC5F,eAAO,MAAM,UAAU,uDAAsC,CAAC"}
1
+ {"version":3,"file":"ColorWheel.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAezD,4FAA4F;AAC5F,eAAO,MAAM,UAAU,uDAAsC,CAAC"}