@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
@@ -0,0 +1,1331 @@
1
+ 'use client';
2
+ import {
3
+ isHexColor,
4
+ parseHexColorOrThrow,
5
+ converter_default,
6
+ formatHex,
7
+ COLOR_HARMONY_CATALOG,
8
+ generateHarmonyRoleColors,
9
+ generateColorSwatch
10
+ } from "./Accordion-9d38cgqj.js";
11
+ import {
12
+ Pressable
13
+ } from "./Accordion-hdyzyw8q.js";
14
+ import {
15
+ withZoraThemeScope
16
+ } from "./Accordion-tk8zf9ff.js";
17
+ import {
18
+ View2,
19
+ Divider2
20
+ } from "./Accordion-f8a49gy8.js";
21
+ import {
22
+ Heading2,
23
+ Text3
24
+ } from "./Accordion-afpjg1d6.js";
25
+ import {
26
+ useClipboardWriter,
27
+ writeClipboardTextAsync
28
+ } from "./Accordion-chdbfcm6.js";
29
+ import {
30
+ TextInput3
31
+ } from "./Accordion-d405whfb.js";
32
+ import {
33
+ Button2,
34
+ Circle,
35
+ Defs,
36
+ Line,
37
+ LinearGradient,
38
+ Path,
39
+ Polygon,
40
+ RadialGradient,
41
+ Rect,
42
+ Stop,
43
+ Svg,
44
+ IconButton2
45
+ } from "./Accordion-jmxe6kw0.js";
46
+ import {
47
+ Card2
48
+ } from "./Accordion-9k7ktksc.js";
49
+ import {
50
+ Icon2
51
+ } from "./Accordion-3zzzw7a8.js";
52
+ import {
53
+ Select2
54
+ } from "./Accordion-46n609yq.js";
55
+ import {
56
+ Gradient2
57
+ } from "./Accordion-t9n4ey2r.js";
58
+ import {
59
+ useZoraTheme2
60
+ } from "./Accordion-b1y5mjac.js";
61
+ import {
62
+ require_cjs
63
+ } from "./Accordion-xgpzh4wq.js";
64
+ import {
65
+ __toESM
66
+ } from "./Accordion-nh0cs9hq.js";
67
+
68
+ // src/features/color/ColorHexField.tsx
69
+ import React from "react";
70
+ import { jsx, jsxs } from "react/jsx-runtime";
71
+ function ColorHexField({
72
+ disabled,
73
+ onChange,
74
+ value
75
+ }) {
76
+ const [input, setInput] = React.useState(value);
77
+ const [previousValue, setPreviousValue] = React.useState(value);
78
+ const [copyFeedback, setCopyFeedback] = React.useState();
79
+ const clipboardWriter = useClipboardWriter();
80
+ const { theme } = useZoraTheme2();
81
+ if (value !== previousValue) {
82
+ setPreviousValue(value);
83
+ setInput(value);
84
+ }
85
+ return /* @__PURE__ */ jsxs(View2, {
86
+ children: [
87
+ /* @__PURE__ */ jsx(TextInput3, {
88
+ accessibilityLabel: "Color hex value",
89
+ disabled,
90
+ leadingAccessory: /* @__PURE__ */ jsx(View2, {
91
+ bg: value,
92
+ borderColor: theme.semantics.border.default,
93
+ borderWidth: 1,
94
+ height: 30,
95
+ radius: "s",
96
+ width: 30
97
+ }),
98
+ onChangeText: (nextValue) => {
99
+ setInput(nextValue);
100
+ if (isHexColor(nextValue))
101
+ onChange(nextValue);
102
+ },
103
+ trailingAccessory: /* @__PURE__ */ jsx(IconButton2, {
104
+ iconName: copyFeedback === "Color hex copied." ? "checkmark" : copyFeedback ? "warning" : "copy-outline",
105
+ label: copyFeedback ?? "Copy color hex value",
106
+ disabled,
107
+ onPress: () => {
108
+ writeClipboardTextAsync(clipboardWriter, value).then((result) => {
109
+ setCopyFeedback(result === "written" ? "Color hex copied." : result === "denied" ? "Clipboard access was denied." : "Clipboard is unavailable.");
110
+ });
111
+ },
112
+ variant: "ghost"
113
+ }),
114
+ value: input
115
+ }),
116
+ copyFeedback ? /* @__PURE__ */ jsx(Text3, {
117
+ accessibilityLiveRegion: "polite",
118
+ emphasis: "muted",
119
+ style: { position: "absolute", opacity: 0 },
120
+ variant: "caption",
121
+ children: copyFeedback
122
+ }) : null
123
+ ]
124
+ });
125
+ }
126
+
127
+ // src/features/color/ColorSpectrumSlider.tsx
128
+ import React3 from "react";
129
+
130
+ // src/features/color/ColorHorizontalPointerProxy.web.tsx
131
+ import React2 from "react";
132
+ import { jsx as jsx2 } from "react/jsx-runtime";
133
+ function ColorHorizontalPointerProxy({
134
+ children,
135
+ disabled,
136
+ onChange,
137
+ width
138
+ }) {
139
+ const dragging = React2.useRef(false);
140
+ const changeAt = (event) => {
141
+ const target = event.currentTarget;
142
+ const rect = target.getBoundingClientRect();
143
+ onChange((event.clientX - rect.left) / rect.width * width);
144
+ };
145
+ return /* @__PURE__ */ jsx2("div", {
146
+ onMouseDown: (event) => {
147
+ if (disabled)
148
+ return;
149
+ dragging.current = true;
150
+ changeAt(event);
151
+ },
152
+ onMouseMove: (event) => {
153
+ if (!disabled && dragging.current)
154
+ changeAt(event);
155
+ },
156
+ onMouseUp: (event) => {
157
+ if (!disabled && dragging.current)
158
+ changeAt(event);
159
+ dragging.current = false;
160
+ },
161
+ style: { touchAction: "none" },
162
+ children
163
+ });
164
+ }
165
+ // src/features/color/utils/resolveOklchColor.ts
166
+ function resolveOklchColor(target, hue) {
167
+ const formatted = formatHex({ mode: "oklch", l: target.lightness, c: target.chroma, h: hue });
168
+ if (!formatted)
169
+ throw new Error("The supplied OKLCH target cannot be represented as a hex color.");
170
+ return parseHexColorOrThrow(formatted);
171
+ }
172
+
173
+ // src/features/color/ColorSpectrumSlider.tsx
174
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
175
+ var SPECTRUM_WIDTH = 280;
176
+ var SPECTRUM_HUES = [0, 60, 120, 180, 240, 300, 360];
177
+ function ColorSpectrumSlider({
178
+ disabled,
179
+ hue,
180
+ label = "Hue",
181
+ onChange
182
+ }) {
183
+ const { theme } = useZoraTheme2();
184
+ const [trackWidth, setTrackWidth] = React3.useState(SPECTRUM_WIDTH);
185
+ const gradientId = `color-spectrum-${React3.useId().replaceAll(":", "")}`;
186
+ const changeAt = (locationX) => {
187
+ if (!disabled)
188
+ onChange(Math.max(0, Math.min(360, locationX / trackWidth * 360)));
189
+ };
190
+ return /* @__PURE__ */ jsxs2(View2, {
191
+ gap: "xxs",
192
+ width: "100%",
193
+ children: [
194
+ /* @__PURE__ */ jsxs2(View2, {
195
+ direction: "row",
196
+ justify: "space-between",
197
+ children: [
198
+ /* @__PURE__ */ jsx3(Text3, {
199
+ variant: "label",
200
+ children: label
201
+ }),
202
+ /* @__PURE__ */ jsx3(Text3, {
203
+ variant: "label",
204
+ children: `${Math.round(hue)}°`
205
+ })
206
+ ]
207
+ }),
208
+ /* @__PURE__ */ jsx3(ColorHorizontalPointerProxy, {
209
+ disabled,
210
+ onChange: changeAt,
211
+ width: SPECTRUM_WIDTH,
212
+ children: /* @__PURE__ */ jsxs2(Svg, {
213
+ accessibilityLabel: `${label} spectrum`,
214
+ height: 36,
215
+ onLayout: (event) => setTrackWidth(Math.max(1, event.nativeEvent.layout.width)),
216
+ viewBox: `0 0 ${SPECTRUM_WIDTH} 36`,
217
+ width: "100%",
218
+ children: [
219
+ /* @__PURE__ */ jsx3(Defs, {
220
+ children: /* @__PURE__ */ jsx3(LinearGradient, {
221
+ id: gradientId,
222
+ x1: "0",
223
+ x2: "1",
224
+ y1: "0",
225
+ y2: "0",
226
+ children: SPECTRUM_HUES.map((stopHue, index) => /* @__PURE__ */ jsx3(Stop, {
227
+ offset: String(index / (SPECTRUM_HUES.length - 1)),
228
+ stopColor: resolveOklchColor({ lightness: 0.65, chroma: 0.2 }, stopHue)
229
+ }, stopHue))
230
+ })
231
+ }),
232
+ /* @__PURE__ */ jsx3(Rect, {
233
+ fill: `url(#${gradientId})`,
234
+ height: 12,
235
+ rx: 6,
236
+ width: SPECTRUM_WIDTH,
237
+ y: 12
238
+ }),
239
+ /* @__PURE__ */ jsx3(Circle, {
240
+ cx: hue / 360 * SPECTRUM_WIDTH,
241
+ cy: 18,
242
+ fill: "white",
243
+ r: 10,
244
+ stroke: theme.semantics.content.default,
245
+ strokeWidth: 2
246
+ }),
247
+ /* @__PURE__ */ jsx3(Rect, {
248
+ fill: "transparent",
249
+ height: 36,
250
+ onResponderGrant: (event) => changeAt(event.nativeEvent.locationX),
251
+ onResponderMove: (event) => changeAt(event.nativeEvent.locationX),
252
+ onResponderRelease: (event) => changeAt(event.nativeEvent.locationX),
253
+ onStartShouldSetResponder: () => !disabled,
254
+ width: SPECTRUM_WIDTH
255
+ })
256
+ ]
257
+ })
258
+ })
259
+ ]
260
+ });
261
+ }
262
+
263
+ // src/features/color/utils/resolveColorAtHue.ts
264
+ var toOklch = converter_default("oklch");
265
+ function resolveColorAtHue(color, hue) {
266
+ const parsed = toOklch(color);
267
+ if (!parsed || typeof parsed.l !== "number" || typeof parsed.c !== "number")
268
+ return color;
269
+ const formatted = formatHex({ mode: "oklch", l: parsed.l, c: parsed.c, h: hue });
270
+ return formatted ? parseHexColorOrThrow(formatted) : color;
271
+ }
272
+
273
+ // src/features/color/utils/resolveColorHue.ts
274
+ var toOklch2 = converter_default("oklch");
275
+ function resolveColorHue(color) {
276
+ const parsed = toOklch2(color);
277
+ return typeof parsed?.h === "number" ? parsed.h : 0;
278
+ }
279
+
280
+ // src/features/color/ColorHueScale.tsx
281
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
282
+ var ColorHueScale2 = withZoraThemeScope(ColorHueScaleInner);
283
+ function ColorHueScaleInner({
284
+ themeId: _themeId,
285
+ mode: _mode,
286
+ inverted: _inverted,
287
+ interactionPolicy,
288
+ value,
289
+ onChange,
290
+ testID
291
+ }) {
292
+ const { theme } = useZoraTheme2();
293
+ const { swatch } = generateColorSwatch(value);
294
+ const swatches = Object.entries(swatch);
295
+ return /* @__PURE__ */ jsxs3(View2, {
296
+ gap: "m",
297
+ testID,
298
+ children: [
299
+ /* @__PURE__ */ jsx4(ColorSpectrumSlider, {
300
+ disabled: interactionPolicy === "passive",
301
+ hue: resolveColorHue(value),
302
+ onChange: (nextHue) => onChange(resolveColorAtHue(value, nextHue))
303
+ }),
304
+ /* @__PURE__ */ jsx4(Text3, {
305
+ variant: "label",
306
+ children: "Intensity"
307
+ }),
308
+ /* @__PURE__ */ jsx4(View2, {
309
+ accessibilityLabel: "Color scale previews; choose a preview as the next 500 base color",
310
+ direction: "row",
311
+ gap: "xs",
312
+ wrap: "wrap",
313
+ children: swatches.map(([step, color]) => /* @__PURE__ */ jsx4(Pressable, {
314
+ accessibilityLabel: Number(step) === 500 ? `Current editable base color 500: ${color}` : `Use generated ${step} preview ${color} as the next base color 500`,
315
+ bg: color,
316
+ borderColor: theme.semantics.border.default,
317
+ borderWidth: Number(step) === 500 ? 3 : 1,
318
+ disabled: interactionPolicy === "passive",
319
+ height: 48,
320
+ onPress: () => onChange(color),
321
+ radius: "s",
322
+ width: "18%",
323
+ children: /* @__PURE__ */ jsx4(Text3, {
324
+ align: "center",
325
+ variant: "caption",
326
+ children: step
327
+ })
328
+ }, step))
329
+ }),
330
+ /* @__PURE__ */ jsx4(ColorHexField, {
331
+ disabled: interactionPolicy === "passive",
332
+ onChange,
333
+ value
334
+ }, value)
335
+ ]
336
+ });
337
+ }
338
+ // src/features/color/ColorPicker.tsx
339
+ var import_react_native = __toESM(require_cjs(), 1);
340
+ import React6 from "react";
341
+
342
+ // src/features/color/ColorWheel.tsx
343
+ import React5 from "react";
344
+
345
+ // src/features/color/ColorWheelKeyboardProxy.web.tsx
346
+ import { jsx as jsx5 } from "react/jsx-runtime";
347
+ function ColorWheelKeyboardProxy({
348
+ children,
349
+ chroma,
350
+ disabled,
351
+ hue,
352
+ maxChroma = 0.2,
353
+ onChange
354
+ }) {
355
+ return /* @__PURE__ */ jsx5("div", {
356
+ "aria-label": `Color wheel, hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`,
357
+ "aria-valuemax": 360,
358
+ "aria-valuemin": 0,
359
+ "aria-valuenow": Math.round(hue),
360
+ "aria-valuetext": `Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`,
361
+ "aria-disabled": disabled,
362
+ onKeyDown: (event) => {
363
+ const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma, maxChroma);
364
+ if (!nextValue || disabled)
365
+ return;
366
+ event.preventDefault();
367
+ onChange(nextValue.hue, nextValue.chroma);
368
+ },
369
+ role: "slider",
370
+ tabIndex: disabled ? -1 : 0,
371
+ children
372
+ });
373
+ }
374
+ function resolveKeyboardWheelValue(key, hue, chroma, maxChroma) {
375
+ if (key === "ArrowLeft")
376
+ return { chroma, hue: normalizeHue(hue - 5) };
377
+ if (key === "ArrowRight")
378
+ return { chroma, hue: normalizeHue(hue + 5) };
379
+ if (key === "ArrowDown")
380
+ return { chroma: Math.max(0, chroma - 0.02), hue };
381
+ if (key === "ArrowUp")
382
+ return { chroma: Math.min(maxChroma, chroma + 0.02), hue };
383
+ return;
384
+ }
385
+ function normalizeHue(hue) {
386
+ return hue < 0 ? hue + 360 : hue >= 360 ? hue - 360 : hue;
387
+ }
388
+
389
+ // src/features/color/ColorWheelPointerProxy.web.tsx
390
+ import React4 from "react";
391
+ import { jsx as jsx6 } from "react/jsx-runtime";
392
+ function ColorWheelPointerProxy({
393
+ children,
394
+ disabled,
395
+ height,
396
+ onChange,
397
+ renderedSize: _renderedSize,
398
+ width
399
+ }) {
400
+ const dragging = React4.useRef(false);
401
+ const changeAt = (event) => {
402
+ const target = event.currentTarget;
403
+ const rect = target.getBoundingClientRect();
404
+ onChange((event.clientX - rect.left) / rect.width * width, (event.clientY - rect.top) / rect.height * height);
405
+ };
406
+ return /* @__PURE__ */ jsx6("div", {
407
+ onPointerDown: (event) => {
408
+ if (disabled)
409
+ return;
410
+ dragging.current = true;
411
+ event.currentTarget.setPointerCapture(event.pointerId);
412
+ changeAt(event);
413
+ },
414
+ onPointerMove: (event) => {
415
+ if (!disabled && dragging.current)
416
+ changeAt(event);
417
+ },
418
+ onPointerUp: (event) => {
419
+ if (!disabled && dragging.current)
420
+ changeAt(event);
421
+ dragging.current = false;
422
+ },
423
+ onPointerCancel: () => {
424
+ dragging.current = false;
425
+ },
426
+ style: { touchAction: "none" },
427
+ children
428
+ });
429
+ }
430
+
431
+ // src/features/color/utils/resolveWheelColorComponents.ts
432
+ var toOklch3 = converter_default("oklch");
433
+ function resolveWheelColorComponents(color) {
434
+ const parsed = toOklch3(color);
435
+ return {
436
+ chroma: typeof parsed?.c === "number" ? parsed.c : 0,
437
+ lightness: typeof parsed?.l === "number" ? parsed.l : 0.65
438
+ };
439
+ }
440
+
441
+ // src/features/color/utils/resolveWheelColor.ts
442
+ function resolveWheelColor(color, x, y, center, radius, maxChroma, lightness = resolveWheelColorComponents(color).lightness) {
443
+ const deltaX = x - center;
444
+ const deltaY = y - center;
445
+ const distance = Math.min(Math.hypot(deltaX, deltaY), radius);
446
+ const hue = normalizeHue2(Math.atan2(deltaY, deltaX) * 180 / Math.PI + 90);
447
+ const chroma = distance / radius * maxChroma;
448
+ return resolveOklchColor({ lightness, chroma }, hue);
449
+ }
450
+ function normalizeHue2(hue) {
451
+ return hue < 0 ? hue + 360 : hue;
452
+ }
453
+
454
+ // src/features/color/ColorWheel.tsx
455
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
456
+ var VIEWBOX = 1000;
457
+ var CENTER = VIEWBOX / 2;
458
+ var RADIUS = 480;
459
+ var SEGMENTS = 720;
460
+ var MAX_CHROMA = 0.2;
461
+ var ColorWheel2 = withZoraThemeScope(ColorWheelInner);
462
+ function ColorWheelInner({
463
+ themeId: _themeId,
464
+ mode: _mode,
465
+ inverted: _inverted,
466
+ interactionPolicy,
467
+ value,
468
+ harmony = null,
469
+ toneTarget,
470
+ onChange,
471
+ size = 340,
472
+ testID
473
+ }) {
474
+ const hue = resolveColorHue(value);
475
+ const { chroma, lightness } = resolveWheelColorComponents(value);
476
+ const targetLightness = toneTarget?.lightness ?? lightness;
477
+ const maximumChroma = toneTarget?.chroma ?? MAX_CHROMA;
478
+ const primaryPoint = pointFor(hue, Math.min(1, chroma / maximumChroma));
479
+ const harmonyRoles = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];
480
+ const harmonyPoints = harmonyRoles.map((role) => ({
481
+ color: role.hex,
482
+ ...pointFor(role.hueDegrees, Math.min(1, resolveWheelColorComponents(role.hex).chroma / maximumChroma))
483
+ }));
484
+ const gradientId = `color-wheel-${React5.useId().replaceAll(":", "")}`;
485
+ const changeAt = (x, y) => {
486
+ if (interactionPolicy !== "passive")
487
+ onChange({
488
+ color: resolveWheelColor(value, x, y, CENTER, RADIUS, maximumChroma, targetLightness),
489
+ harmony
490
+ });
491
+ };
492
+ return /* @__PURE__ */ jsx7(ColorWheelKeyboardProxy, {
493
+ chroma,
494
+ disabled: interactionPolicy === "passive",
495
+ hue,
496
+ maxChroma: maximumChroma,
497
+ onChange: (nextHue, nextChroma) => onChange({
498
+ color: resolveOklchColor({ chroma: nextChroma, lightness: targetLightness }, nextHue),
499
+ harmony
500
+ }),
501
+ children: /* @__PURE__ */ jsx7(ColorWheelPointerProxy, {
502
+ disabled: interactionPolicy === "passive",
503
+ height: VIEWBOX,
504
+ onChange: changeAt,
505
+ renderedSize: size,
506
+ width: VIEWBOX,
507
+ children: /* @__PURE__ */ jsxs4(Svg, {
508
+ accessibilityLabel: "Color wheel",
509
+ height: size,
510
+ testID,
511
+ viewBox: `0 0 ${VIEWBOX} ${VIEWBOX}`,
512
+ width: size,
513
+ children: [
514
+ /* @__PURE__ */ jsx7(Defs, {
515
+ children: segments(targetLightness, maximumChroma).map((segment) => /* @__PURE__ */ jsxs4(RadialGradient, {
516
+ cx: CENTER,
517
+ cy: CENTER,
518
+ gradientUnits: "userSpaceOnUse",
519
+ id: `${gradientId}-${segment.hue}`,
520
+ r: RADIUS,
521
+ children: [
522
+ /* @__PURE__ */ jsx7(Stop, {
523
+ offset: "0",
524
+ stopColor: segment.centerColor
525
+ }),
526
+ /* @__PURE__ */ jsx7(Stop, {
527
+ offset: "1",
528
+ stopColor: segment.color
529
+ })
530
+ ]
531
+ }, segment.hue))
532
+ }),
533
+ segments(targetLightness, maximumChroma).map((segment) => /* @__PURE__ */ jsx7(Path, {
534
+ d: segment.path,
535
+ fill: `url(#${gradientId}-${segment.hue})`
536
+ }, segment.hue)),
537
+ harmonyPoints.length >= 3 ? /* @__PURE__ */ jsx7(Polygon, {
538
+ fill: "none",
539
+ points: harmonyPoints.map((point) => `${point.x},${point.y}`).join(" "),
540
+ stroke: "white",
541
+ strokeWidth: 6
542
+ }) : linesFor(harmonyPoints, primaryPoint, "white"),
543
+ harmonyPoints.filter((point) => point.color !== value).map((point) => /* @__PURE__ */ jsx7(Circle, {
544
+ cx: point.x,
545
+ cy: point.y,
546
+ fill: point.color,
547
+ stroke: "white",
548
+ strokeWidth: 6,
549
+ r: 26
550
+ }, `${point.x}-${point.y}`)),
551
+ /* @__PURE__ */ jsx7(Circle, {
552
+ cx: primaryPoint.x,
553
+ cy: primaryPoint.y,
554
+ fill: value,
555
+ r: 36,
556
+ stroke: "white",
557
+ strokeWidth: 12
558
+ }),
559
+ /* @__PURE__ */ jsx7(Circle, {
560
+ cx: primaryPoint.x,
561
+ cy: primaryPoint.y,
562
+ fill: "none",
563
+ r: 42,
564
+ stroke: "white",
565
+ strokeWidth: 6
566
+ })
567
+ ]
568
+ })
569
+ })
570
+ });
571
+ }
572
+ function segments(lightness, maximumChroma) {
573
+ return Array.from({ length: SEGMENTS }, (_, index) => {
574
+ const hue = index * 360 / SEGMENTS;
575
+ return {
576
+ centerColor: resolveOklchColor({ chroma: 0, lightness }, hue),
577
+ color: resolveOklchColor({ chroma: maximumChroma, lightness }, hue),
578
+ hue,
579
+ path: segmentPath(hue, hue + 360 / SEGMENTS)
580
+ };
581
+ });
582
+ }
583
+ function segmentPath(start, end) {
584
+ const startPoint = pointFor(start);
585
+ const endPoint = pointFor(end);
586
+ return `M ${CENTER} ${CENTER} L ${startPoint.x} ${startPoint.y} A ${RADIUS} ${RADIUS} 0 0 1 ${endPoint.x} ${endPoint.y} Z`;
587
+ }
588
+ function pointFor(hue, ratio = 1) {
589
+ const radians = (hue - 90) * Math.PI / 180;
590
+ return {
591
+ x: CENTER + RADIUS * ratio * Math.cos(radians),
592
+ y: CENTER + RADIUS * ratio * Math.sin(radians)
593
+ };
594
+ }
595
+ function linesFor(points, primary, stroke) {
596
+ return points.slice(1).reduce(({ lines, previous }, point) => ({
597
+ lines: [
598
+ ...lines,
599
+ /* @__PURE__ */ jsx7(Line, {
600
+ stroke,
601
+ strokeWidth: 6,
602
+ x1: previous.x,
603
+ x2: point.x,
604
+ y1: previous.y,
605
+ y2: point.y
606
+ }, `${previous.x}-${previous.y}-${point.x}-${point.y}`)
607
+ ],
608
+ previous: point
609
+ }), { lines: [], previous: points.at(0) ?? primary }).lines;
610
+ }
611
+
612
+ // src/features/color/resolveColorPickerGeometry.ts
613
+ var MINIMUM_WIDTH = 360;
614
+ var REFERENCE_WIDTH = 560;
615
+ function resolveColorPickerGeometry(input) {
616
+ const availableWidth = Math.min(input.width ?? REFERENCE_WIDTH, input.hostWidth ?? REFERENCE_WIDTH);
617
+ const availableHeight = Math.min(input.height ?? Number.POSITIVE_INFINITY, input.hostHeight ?? Number.POSITIVE_INFINITY);
618
+ const minimum = resolveGeometryAtWidth(MINIMUM_WIDTH, input.showTabs);
619
+ const maximum = resolveGeometryAtWidth(Math.max(MINIMUM_WIDTH, availableWidth), input.showTabs);
620
+ const resolved = resolveLargestGeometry(maximum, availableHeight, input.showTabs);
621
+ return {
622
+ ...resolved,
623
+ insufficientSpace: availableWidth < MINIMUM_WIDTH || availableHeight < minimum.height,
624
+ minimumHeight: minimum.height,
625
+ minimumWidth: MINIMUM_WIDTH
626
+ };
627
+ }
628
+ function resolveGeometryAtWidth(width, showTabs) {
629
+ const progress = Math.max(0, Math.min(1, (width - MINIMUM_WIDTH) / (REFERENCE_WIDTH - MINIMUM_WIDTH)));
630
+ const padding = interpolate(12, 24, progress);
631
+ const rail = interpolate(104, 150, progress);
632
+ const gap = interpolate(12, 20, progress);
633
+ const scale = interpolate(0.75, 1, progress);
634
+ const border = 1;
635
+ const stage = width - border * 2 - padding * 2 - rail - gap;
636
+ const headerHeight = 48 * scale;
637
+ const tabHeight = showTabs ? 48 * scale : 0;
638
+ const cardGap = 16 * scale;
639
+ const cardHeight = 52 * scale;
640
+ const settingsHeight = cardHeight * 2 + cardGap;
641
+ const mainHeight = Math.max(stage, settingsHeight);
642
+ const infoLineHeight = 20 * scale;
643
+ const mainGap = 16 * scale;
644
+ const footerGap = 10 * scale;
645
+ const footerHeight = 52 * scale;
646
+ const footerInset = 12 * scale;
647
+ const height = border * 2 + padding + headerHeight + mainGap + tabHeight + (showTabs ? mainGap : 0) + mainHeight + mainGap + infoLineHeight + footerGap + 1 + footerGap + footerHeight + footerInset;
648
+ return {
649
+ border,
650
+ cardGap,
651
+ cardHeight,
652
+ footerGap,
653
+ footerHeight,
654
+ footerInset,
655
+ gap,
656
+ headerHeight,
657
+ height,
658
+ infoLineHeight,
659
+ mainGap,
660
+ padding,
661
+ rail,
662
+ scale,
663
+ settingsHeight,
664
+ stage,
665
+ tabHeight,
666
+ width
667
+ };
668
+ }
669
+ function resolveLargestGeometry(maximum, height, showTabs) {
670
+ if (!Number.isFinite(height) || maximum.height <= height)
671
+ return maximum;
672
+ const minimum = resolveGeometryAtWidth(MINIMUM_WIDTH, showTabs);
673
+ if (height < minimum.height)
674
+ return minimum;
675
+ let lower = MINIMUM_WIDTH;
676
+ let upper = maximum.width;
677
+ for (let iteration = 0;iteration < 20; iteration += 1) {
678
+ const midpoint = (lower + upper) / 2;
679
+ if (resolveGeometryAtWidth(midpoint, showTabs).height <= height)
680
+ lower = midpoint;
681
+ else
682
+ upper = midpoint;
683
+ }
684
+ return resolveGeometryAtWidth(lower, showTabs);
685
+ }
686
+ function interpolate(minimum, reference, progress) {
687
+ return minimum + (reference - minimum) * progress;
688
+ }
689
+
690
+ // src/features/color/ColorPicker.tsx
691
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
692
+ var DEFAULT_TABS = ["grid", "wheel"];
693
+ var ColorPicker2 = withZoraThemeScope(ColorPickerInner);
694
+ function ColorPickerInner({
695
+ themeId: _themeId,
696
+ mode: _mode,
697
+ inverted: _inverted,
698
+ tabs = DEFAULT_TABS,
699
+ primaryColor,
700
+ harmony,
701
+ tone,
702
+ tones = [],
703
+ width = 560,
704
+ height,
705
+ infoLine,
706
+ onInsufficientSpaceChange,
707
+ activeTab,
708
+ onValueChange,
709
+ onActiveTabChange,
710
+ onDismiss,
711
+ hideTabListWhenSingle = true,
712
+ wheel,
713
+ interactionPolicy,
714
+ testID
715
+ }) {
716
+ const { theme } = useZoraTheme2();
717
+ const [hostBounds, setHostBounds] = React6.useState();
718
+ const enabledTabs = resolveEnabledTabs(tabs);
719
+ const firstTab = enabledTabs.at(0);
720
+ if (!firstTab)
721
+ throw new Error("ColorPicker requires at least one tab.");
722
+ const [uncontrolledTab, setUncontrolledTab] = React6.useState(firstTab);
723
+ const resolvedTab = activeTab && enabledTabs.includes(activeTab) ? activeTab : enabledTabs.includes(uncontrolledTab) ? uncontrolledTab : firstTab;
724
+ const geometry = resolveColorPickerGeometry({
725
+ height,
726
+ hostHeight: hostBounds && hostBounds.height > 0 ? hostBounds.height : undefined,
727
+ hostWidth: hostBounds && hostBounds.width > 0 ? hostBounds.width : undefined,
728
+ showTabs: enabledTabs.length > 1 || !hideTabListWhenSingle,
729
+ width
730
+ });
731
+ const selectedTone = tones.find((entry) => entry.id === tone);
732
+ const emit = (next) => onValueChange({
733
+ primaryColor: next.primaryColor ?? primaryColor,
734
+ ...Object.hasOwn(next, "harmony") ? { harmony: next.harmony } : harmony ? { harmony } : {},
735
+ ...Object.hasOwn(next, "tone") ? { tone: next.tone } : tone ? { tone } : {}
736
+ });
737
+ const settings = (children) => /* @__PURE__ */ jsx8(PickerRow, {
738
+ geometry,
739
+ tone,
740
+ tones,
741
+ harmony,
742
+ interactionPolicy,
743
+ onHarmonyChange: (next) => emit({ harmony: next }),
744
+ onToneChange: (next) => emit({ tone: next }),
745
+ children
746
+ });
747
+ React6.useEffect(() => {
748
+ if (activeTab && activeTab !== resolvedTab)
749
+ onActiveTabChange?.(resolvedTab);
750
+ }, [activeTab, onActiveTabChange, resolvedTab]);
751
+ React6.useEffect(() => {
752
+ onInsufficientSpaceChange?.(geometry.insufficientSpace);
753
+ }, [geometry.insufficientSpace, onInsufficientSpaceChange]);
754
+ return /* @__PURE__ */ jsx8(import_react_native.View, {
755
+ onLayout: (event) => setHostBounds({
756
+ height: event.nativeEvent.layout.height,
757
+ width: event.nativeEvent.layout.width
758
+ }),
759
+ style: {
760
+ alignSelf: "stretch",
761
+ flexShrink: 1,
762
+ height: height ?? "100%",
763
+ maxHeight: "100%",
764
+ maxWidth: "100%",
765
+ width: "100%"
766
+ },
767
+ children: !geometry.insufficientSpace ? /* @__PURE__ */ jsx8(View2, {
768
+ alignSelf: "center",
769
+ borderColor: theme.semantics.action.primary.base,
770
+ borderWidth: geometry.border,
771
+ radius: "l",
772
+ testID,
773
+ width: geometry.width,
774
+ children: /* @__PURE__ */ jsx8(Gradient2, {
775
+ colors: [theme.semantics.surface.raised, theme.semantics.neutral.surface],
776
+ end: { x: 0, y: 1 },
777
+ radius: "l",
778
+ start: { x: 0, y: 0 },
779
+ children: /* @__PURE__ */ jsxs5(View2, {
780
+ gap: geometry.footerGap,
781
+ pb: geometry.footerInset,
782
+ pt: geometry.padding,
783
+ px: geometry.padding,
784
+ children: [
785
+ /* @__PURE__ */ jsxs5(View2, {
786
+ gap: geometry.mainGap,
787
+ children: [
788
+ /* @__PURE__ */ jsxs5(View2, {
789
+ align: "center",
790
+ direction: "row",
791
+ justify: "space-between",
792
+ minHeight: geometry.headerHeight,
793
+ children: [
794
+ /* @__PURE__ */ jsx8(Heading2, {
795
+ level: 2,
796
+ children: "Color"
797
+ }),
798
+ /* @__PURE__ */ jsxs5(View2, {
799
+ align: "center",
800
+ direction: "row",
801
+ gap: "s",
802
+ children: [
803
+ /* @__PURE__ */ jsx8(View2, {
804
+ bg: primaryColor,
805
+ borderColor: theme.semantics.border.default,
806
+ borderWidth: 1,
807
+ height: 36 * geometry.scale,
808
+ radius: "s",
809
+ width: 52 * geometry.scale
810
+ }),
811
+ onDismiss ? /* @__PURE__ */ jsx8(IconButton2, {
812
+ iconName: "close",
813
+ label: "Close color picker",
814
+ onPress: onDismiss
815
+ }) : null
816
+ ]
817
+ })
818
+ ]
819
+ }),
820
+ enabledTabs.length > 1 || !hideTabListWhenSingle ? /* @__PURE__ */ jsx8(ColorPickerTabSelector, {
821
+ activeTab: resolvedTab,
822
+ geometry,
823
+ interactionPolicy,
824
+ tabs: enabledTabs,
825
+ onChange: (next) => {
826
+ setUncontrolledTab(next);
827
+ onActiveTabChange?.(next);
828
+ }
829
+ }) : null,
830
+ resolvedTab === "grid" ? settings(/* @__PURE__ */ jsx8(ColorGrid, {
831
+ disabled: interactionPolicy === "passive",
832
+ harmony,
833
+ onSelect: (color) => emit({ primaryColor: color }),
834
+ palette: resolvePalette(selectedTone, primaryColor, harmony),
835
+ primaryIndicatorColor: theme.semantics.action.primary.base,
836
+ selectionBorderColor: theme.semantics.content.default,
837
+ selected: primaryColor,
838
+ size: geometry.stage
839
+ })) : settings(/* @__PURE__ */ jsx8(ColorWheel2, {
840
+ ...wheel,
841
+ harmony: harmony ?? null,
842
+ interactionPolicy,
843
+ onChange: (next) => emit({ primaryColor: next.color, harmony: next.harmony ?? undefined }),
844
+ size: geometry.stage,
845
+ toneTarget: selectedTone?.accentTarget,
846
+ value: primaryColor
847
+ })),
848
+ /* @__PURE__ */ jsx8(View2, {
849
+ height: geometry.infoLineHeight,
850
+ justify: "center",
851
+ children: infoLine ? /* @__PURE__ */ jsx8(Text3, {
852
+ accessibilityLabel: infoLine,
853
+ numberOfLines: 1,
854
+ variant: "caption",
855
+ children: infoLine
856
+ }) : null
857
+ })
858
+ ]
859
+ }),
860
+ /* @__PURE__ */ jsxs5(View2, {
861
+ gap: geometry.footerGap,
862
+ children: [
863
+ /* @__PURE__ */ jsx8(Divider2, {}),
864
+ /* @__PURE__ */ jsx8(View2, {
865
+ height: geometry.footerHeight,
866
+ justify: "center",
867
+ children: /* @__PURE__ */ jsx8(ColorHexField, {
868
+ disabled: interactionPolicy === "passive",
869
+ onChange: (color) => emit({ primaryColor: color }),
870
+ value: primaryColor
871
+ })
872
+ })
873
+ ]
874
+ })
875
+ ]
876
+ })
877
+ })
878
+ }) : /* @__PURE__ */ jsx8(View2, {
879
+ accessibilityLabel: "Color picker needs more space",
880
+ testID: testID ? `${testID}-insufficient-space` : undefined
881
+ })
882
+ });
883
+ }
884
+ function ColorPickerTabSelector({
885
+ activeTab,
886
+ geometry,
887
+ interactionPolicy,
888
+ tabs,
889
+ onChange
890
+ }) {
891
+ const { theme } = useZoraTheme2();
892
+ return /* @__PURE__ */ jsx8(View2, {
893
+ borderColor: theme.semantics.border.default,
894
+ borderWidth: 1,
895
+ direction: "row",
896
+ overflow: "hidden",
897
+ radius: "m",
898
+ children: tabs.map((tab) => {
899
+ const selected = tab === activeTab;
900
+ return /* @__PURE__ */ jsx8(Pressable, {
901
+ accessibilityLabel: `${tab === "grid" ? "Grid" : "Wheel"} color picker tab`,
902
+ accessibilityRole: "tab",
903
+ accessibilityState: { selected },
904
+ disabled: interactionPolicy === "passive",
905
+ onPress: () => onChange(tab),
906
+ style: { flex: 1 },
907
+ children: /* @__PURE__ */ jsxs5(View2, {
908
+ align: "center",
909
+ bg: selected ? theme.semantics.action.primary.base : "transparent",
910
+ direction: "row",
911
+ gap: "xs",
912
+ height: geometry.tabHeight - geometry.border * 2,
913
+ justify: "center",
914
+ radius: "s",
915
+ children: [
916
+ /* @__PURE__ */ jsx8(Icon2, {
917
+ color: selected ? theme.semantics.action.primary.onSolidText : undefined,
918
+ name: tab === "grid" ? "grid" : "color-palette",
919
+ size: 16 * geometry.scale
920
+ }),
921
+ /* @__PURE__ */ jsx8(Text3, {
922
+ style: selected ? { color: theme.semantics.action.primary.onSolidText } : undefined,
923
+ variant: "label",
924
+ weight: "medium",
925
+ children: tab === "grid" ? "Grid" : "Wheel"
926
+ })
927
+ ]
928
+ })
929
+ }, tab);
930
+ })
931
+ });
932
+ }
933
+ function PickerRow({
934
+ children,
935
+ geometry,
936
+ tone,
937
+ tones,
938
+ harmony,
939
+ interactionPolicy,
940
+ onToneChange,
941
+ onHarmonyChange
942
+ }) {
943
+ return /* @__PURE__ */ jsxs5(View2, {
944
+ align: "flex-start",
945
+ direction: "row",
946
+ gap: geometry.gap,
947
+ children: [
948
+ /* @__PURE__ */ jsxs5(View2, {
949
+ gap: geometry.cardGap,
950
+ width: geometry.rail,
951
+ children: [
952
+ /* @__PURE__ */ jsx8(SettingCard, {
953
+ geometry,
954
+ icon: "diamond",
955
+ interactionPolicy,
956
+ label: "Tone",
957
+ onClear: tone ? () => onToneChange(undefined) : undefined,
958
+ children: /* @__PURE__ */ jsx8(Select2, {
959
+ compact: true,
960
+ interactionPolicy,
961
+ onValueChange: onToneChange,
962
+ options: tones.map((entry) => ({ label: entry.accent, value: entry.id })),
963
+ placeholder: "Any tone",
964
+ value: tone
965
+ })
966
+ }),
967
+ /* @__PURE__ */ jsx8(SettingCard, {
968
+ geometry,
969
+ icon: "color-palette",
970
+ interactionPolicy,
971
+ label: "Harmony",
972
+ onClear: harmony ? () => onHarmonyChange(undefined) : undefined,
973
+ children: /* @__PURE__ */ jsx8(Select2, {
974
+ compact: true,
975
+ interactionPolicy,
976
+ onValueChange: onHarmonyChange,
977
+ options: COLOR_HARMONY_CATALOG.map((entry) => ({
978
+ label: entry.label,
979
+ value: entry.id
980
+ })),
981
+ placeholder: "None",
982
+ value: harmony
983
+ })
984
+ })
985
+ ]
986
+ }),
987
+ children
988
+ ]
989
+ });
990
+ }
991
+ function SettingCard({
992
+ children,
993
+ geometry,
994
+ icon,
995
+ interactionPolicy,
996
+ label,
997
+ onClear
998
+ }) {
999
+ return /* @__PURE__ */ jsxs5(Card2, {
1000
+ compact: true,
1001
+ minHeight: geometry.cardHeight,
1002
+ padding: "s",
1003
+ radius: "m",
1004
+ tone: "subtle",
1005
+ children: [
1006
+ /* @__PURE__ */ jsxs5(View2, {
1007
+ align: "center",
1008
+ direction: "row",
1009
+ gap: "xs",
1010
+ justify: "space-between",
1011
+ children: [
1012
+ /* @__PURE__ */ jsxs5(View2, {
1013
+ align: "center",
1014
+ direction: "row",
1015
+ gap: "xs",
1016
+ children: [
1017
+ /* @__PURE__ */ jsx8(Icon2, {
1018
+ name: icon,
1019
+ size: 20 * geometry.scale
1020
+ }),
1021
+ /* @__PURE__ */ jsx8(Text3, {
1022
+ numberOfLines: 1,
1023
+ variant: "label",
1024
+ weight: "medium",
1025
+ children: label
1026
+ })
1027
+ ]
1028
+ }),
1029
+ onClear ? /* @__PURE__ */ jsx8(IconButton2, {
1030
+ disabled: interactionPolicy === "passive",
1031
+ iconName: "close",
1032
+ label: `Clear ${label}`,
1033
+ onPress: onClear,
1034
+ size: "s"
1035
+ }) : null
1036
+ ]
1037
+ }),
1038
+ children
1039
+ ]
1040
+ });
1041
+ }
1042
+ function ColorGrid({
1043
+ palette,
1044
+ primaryIndicatorColor,
1045
+ selectionBorderColor,
1046
+ selected,
1047
+ size,
1048
+ onSelect,
1049
+ disabled = false,
1050
+ harmony
1051
+ }) {
1052
+ const gap = Math.max(3, Math.round(size / 68));
1053
+ const cell = (size - 7 * gap) / 8;
1054
+ const harmonyColors = new Set(harmony ? generateHarmonyRoleColors(selected, harmony).colors.map((role) => role.hex) : []);
1055
+ return /* @__PURE__ */ jsx8(View2, {
1056
+ accessibilityLabel: "Color grid",
1057
+ direction: "row",
1058
+ gap,
1059
+ width: size,
1060
+ wrap: "wrap",
1061
+ children: palette.map((color) => /* @__PURE__ */ jsx8(Pressable, {
1062
+ accessibilityLabel: `Select ${color}`,
1063
+ bg: color,
1064
+ borderColor: color === selected ? selectionBorderColor : harmonyColors.has(color) ? primaryIndicatorColor : "transparent",
1065
+ borderWidth: color === selected ? 3 : harmonyColors.has(color) ? 1 : 0,
1066
+ disabled,
1067
+ height: cell,
1068
+ onPress: () => onSelect(color),
1069
+ radius: "s",
1070
+ width: cell
1071
+ }, color))
1072
+ });
1073
+ }
1074
+ function resolvePalette(tone, primaryColor, harmony) {
1075
+ const target = tone?.accentTarget;
1076
+ const candidates = Array.from({ length: 64 }, (_, index) => resolveOklchColor({
1077
+ chroma: target?.chroma ?? 0.08 + index % 8 * 0.018,
1078
+ lightness: target?.lightness ?? 0.35 + Math.floor(index / 8) * 0.065
1079
+ }, index * 137.508 % 360));
1080
+ const roleColors = harmony ? generateHarmonyRoleColors(primaryColor, harmony).colors.map((role) => role.hex) : [];
1081
+ return Array.from(new Set([primaryColor, ...roleColors, ...candidates])).slice(0, 64);
1082
+ }
1083
+ function resolveEnabledTabs(tabs) {
1084
+ if (tabs.length === 0)
1085
+ throw new Error("ColorPicker requires at least one tab.");
1086
+ if (tabs.some((tab) => !isColorPickerTab(tab)))
1087
+ throw new Error("ColorPicker supports only Grid and Wheel tabs.");
1088
+ return tabs;
1089
+ }
1090
+ function isColorPickerTab(value) {
1091
+ return value === "grid" || value === "wheel";
1092
+ }
1093
+ // src/features/color/ColorTone.tsx
1094
+ import React7 from "react";
1095
+ import { jsx as jsx9, jsxs as jsxs6, Fragment } from "react/jsx-runtime";
1096
+ var MAX_TONE_COLORS = 4;
1097
+ var TONE_MAP_WIDTH = 280;
1098
+ var TONE_MAP_HEIGHT = 220;
1099
+ var TONE_MAX_CHROMA = 0.2;
1100
+ var ColorTone2 = withZoraThemeScope(ColorToneInner);
1101
+ function ColorToneInner({
1102
+ themeId: _themeId,
1103
+ mode: _mode,
1104
+ inverted: _inverted,
1105
+ interactionPolicy,
1106
+ tones,
1107
+ selectionMode = "single",
1108
+ value,
1109
+ onChange,
1110
+ testID
1111
+ }) {
1112
+ const { theme } = useZoraTheme2();
1113
+ const [editingColorIndex, setEditingColorIndex] = React7.useState(0);
1114
+ const selectedTone = tones.find((tone) => tone.id === value?.toneId);
1115
+ const colors = value ? selectionMode === "single" ? value.colors.slice(0, 1) : value.colors.slice(0, MAX_TONE_COLORS) : [];
1116
+ const currentEditingColorIndex = Math.min(editingColorIndex, Math.max(0, colors.length - 1));
1117
+ const selectedColor = colors.at(currentEditingColorIndex);
1118
+ const selectTone = (tone) => {
1119
+ const hue = selectedColor ? resolveColorHue(selectedColor) : 0;
1120
+ setEditingColorIndex(0);
1121
+ onChange({ toneId: tone.id, colors: [resolveOklchColor(tone.accentTarget, hue)] });
1122
+ };
1123
+ return /* @__PURE__ */ jsxs6(View2, {
1124
+ gap: "m",
1125
+ testID,
1126
+ children: [
1127
+ /* @__PURE__ */ jsxs6(View2, {
1128
+ gap: "xs",
1129
+ children: [
1130
+ /* @__PURE__ */ jsx9(Text3, {
1131
+ variant: "label",
1132
+ children: "Tone"
1133
+ }),
1134
+ /* @__PURE__ */ jsx9(Text3, {
1135
+ emphasis: "muted",
1136
+ variant: "caption",
1137
+ children: "Choose a catalog tone"
1138
+ })
1139
+ ]
1140
+ }),
1141
+ /* @__PURE__ */ jsx9(View2, {
1142
+ direction: "row",
1143
+ gap: "s",
1144
+ wrap: "wrap",
1145
+ children: tones.map((tone) => {
1146
+ const selected = value?.toneId === tone.id;
1147
+ const color = selected && selectedColor ? selectedColor : resolveOklchColor(tone.accentTarget, 0);
1148
+ return /* @__PURE__ */ jsx9(Pressable, {
1149
+ accessibilityLabel: tone.accent,
1150
+ accessibilityRole: "radio",
1151
+ accessibilityState: { checked: selected },
1152
+ bg: color,
1153
+ borderColor: theme.semantics.border.default,
1154
+ borderWidth: selected ? 3 : 1,
1155
+ disabled: interactionPolicy === "passive",
1156
+ height: 56,
1157
+ onPress: () => selectTone(tone),
1158
+ radius: "m",
1159
+ width: 56,
1160
+ children: /* @__PURE__ */ jsx9(Text3, {
1161
+ align: "center",
1162
+ variant: "caption",
1163
+ children: tone.accent
1164
+ })
1165
+ }, tone.id);
1166
+ })
1167
+ }),
1168
+ selectedTone && selectedColor && value ? /* @__PURE__ */ jsxs6(Fragment, {
1169
+ children: [
1170
+ /* @__PURE__ */ jsx9(ColorToneMap, {
1171
+ color: selectedColor,
1172
+ disabled: interactionPolicy === "passive",
1173
+ onChange: (lightness, chroma) => onChange({
1174
+ toneId: selectedTone.id,
1175
+ colors: colors.map((entry, index) => index === currentEditingColorIndex ? resolveOklchColor({ chroma, lightness }, resolveColorHue(entry)) : entry)
1176
+ })
1177
+ }),
1178
+ /* @__PURE__ */ jsxs6(View2, {
1179
+ direction: "row",
1180
+ gap: "xs",
1181
+ wrap: "wrap",
1182
+ children: [
1183
+ colors.map((color, index) => /* @__PURE__ */ jsx9(Pressable, {
1184
+ accessibilityLabel: `Selected ${selectedTone.accent} color ${index + 1}: ${color}`,
1185
+ accessibilityRole: "radio",
1186
+ accessibilityState: { checked: currentEditingColorIndex === index },
1187
+ bg: color,
1188
+ borderColor: theme.semantics.border.default,
1189
+ borderWidth: currentEditingColorIndex === index ? 3 : 1,
1190
+ disabled: interactionPolicy === "passive",
1191
+ height: 44,
1192
+ onPress: () => setEditingColorIndex(index),
1193
+ radius: "m",
1194
+ width: 44
1195
+ }, `${color}-${index}`)),
1196
+ selectionMode === "multiple" ? /* @__PURE__ */ jsx9(Button2, {
1197
+ disabled: interactionPolicy === "passive" || colors.length >= MAX_TONE_COLORS,
1198
+ onPress: () => {
1199
+ setEditingColorIndex(colors.length);
1200
+ onChange({
1201
+ toneId: selectedTone.id,
1202
+ colors: [...colors, resolveOklchColor(selectedTone.accentTarget, 0)]
1203
+ });
1204
+ },
1205
+ children: "Add color"
1206
+ }) : null,
1207
+ selectionMode === "multiple" && colors.length > 1 ? /* @__PURE__ */ jsx9(Button2, {
1208
+ disabled: interactionPolicy === "passive",
1209
+ onPress: () => {
1210
+ const nextColors = colors.filter((_, index) => index !== currentEditingColorIndex);
1211
+ setEditingColorIndex(Math.min(currentEditingColorIndex, nextColors.length - 1));
1212
+ onChange({ toneId: selectedTone.id, colors: nextColors });
1213
+ },
1214
+ children: "Remove color"
1215
+ }) : null
1216
+ ]
1217
+ }),
1218
+ /* @__PURE__ */ jsx9(ColorSpectrumSlider, {
1219
+ disabled: interactionPolicy === "passive",
1220
+ hue: resolveColorHue(selectedColor),
1221
+ onChange: (nextHue) => onChange({
1222
+ toneId: selectedTone.id,
1223
+ colors: colors.map((entry, index) => index === currentEditingColorIndex ? resolveOklchColor(selectedTone.accentTarget, nextHue) : entry)
1224
+ })
1225
+ }),
1226
+ /* @__PURE__ */ jsx9(ColorHexField, {
1227
+ disabled: interactionPolicy === "passive",
1228
+ onChange: (color) => onChange({
1229
+ toneId: selectedTone.id,
1230
+ colors: colors.map((entry, index) => index === currentEditingColorIndex ? color : entry)
1231
+ }),
1232
+ value: selectedColor
1233
+ }, selectedColor)
1234
+ ]
1235
+ }) : null
1236
+ ]
1237
+ });
1238
+ }
1239
+ function ColorToneMap({
1240
+ color,
1241
+ disabled,
1242
+ onChange
1243
+ }) {
1244
+ const hue = resolveColorHue(color);
1245
+ const { chroma, lightness } = resolveWheelColorComponents(color);
1246
+ const gradientId = `color-tone-${React7.useId().replaceAll(":", "")}`;
1247
+ const changeAt = (x, y) => {
1248
+ if (disabled)
1249
+ return;
1250
+ onChange(Math.max(0, Math.min(1, 1 - y / TONE_MAP_HEIGHT)), Math.max(0, Math.min(TONE_MAX_CHROMA, x / TONE_MAP_WIDTH * TONE_MAX_CHROMA)));
1251
+ };
1252
+ return /* @__PURE__ */ jsx9(ColorWheelPointerProxy, {
1253
+ disabled,
1254
+ height: TONE_MAP_HEIGHT,
1255
+ onChange: changeAt,
1256
+ width: TONE_MAP_WIDTH,
1257
+ children: /* @__PURE__ */ jsxs6(Svg, {
1258
+ accessibilityLabel: "Tone color plane",
1259
+ height: TONE_MAP_HEIGHT,
1260
+ width: TONE_MAP_WIDTH,
1261
+ children: [
1262
+ /* @__PURE__ */ jsxs6(Defs, {
1263
+ children: [
1264
+ /* @__PURE__ */ jsxs6(LinearGradient, {
1265
+ id: `${gradientId}-white`,
1266
+ x1: "0",
1267
+ x2: "1",
1268
+ y1: "0",
1269
+ y2: "0",
1270
+ children: [
1271
+ /* @__PURE__ */ jsx9(Stop, {
1272
+ offset: "0",
1273
+ stopColor: "white"
1274
+ }),
1275
+ /* @__PURE__ */ jsx9(Stop, {
1276
+ offset: "1",
1277
+ stopColor: resolveOklchColor({ chroma: TONE_MAX_CHROMA, lightness: 0.65 }, hue)
1278
+ })
1279
+ ]
1280
+ }),
1281
+ /* @__PURE__ */ jsxs6(LinearGradient, {
1282
+ id: `${gradientId}-black`,
1283
+ x1: "0",
1284
+ x2: "0",
1285
+ y1: "0",
1286
+ y2: "1",
1287
+ children: [
1288
+ /* @__PURE__ */ jsx9(Stop, {
1289
+ offset: "0",
1290
+ stopColor: "transparent"
1291
+ }),
1292
+ /* @__PURE__ */ jsx9(Stop, {
1293
+ offset: "1",
1294
+ stopColor: "black"
1295
+ })
1296
+ ]
1297
+ })
1298
+ ]
1299
+ }),
1300
+ /* @__PURE__ */ jsx9(Rect, {
1301
+ fill: `url(#${gradientId}-white)`,
1302
+ height: TONE_MAP_HEIGHT,
1303
+ width: TONE_MAP_WIDTH
1304
+ }),
1305
+ /* @__PURE__ */ jsx9(Rect, {
1306
+ fill: `url(#${gradientId}-black)`,
1307
+ height: TONE_MAP_HEIGHT,
1308
+ width: TONE_MAP_WIDTH
1309
+ }),
1310
+ /* @__PURE__ */ jsx9(Circle, {
1311
+ cx: chroma / TONE_MAX_CHROMA * TONE_MAP_WIDTH,
1312
+ cy: (1 - lightness) * TONE_MAP_HEIGHT,
1313
+ fill: "none",
1314
+ r: 10,
1315
+ stroke: "white",
1316
+ strokeWidth: 3
1317
+ }),
1318
+ /* @__PURE__ */ jsx9(Rect, {
1319
+ fill: "transparent",
1320
+ height: TONE_MAP_HEIGHT,
1321
+ onResponderGrant: (event) => changeAt(event.nativeEvent.locationX, event.nativeEvent.locationY),
1322
+ onResponderMove: (event) => changeAt(event.nativeEvent.locationX, event.nativeEvent.locationY),
1323
+ onResponderRelease: (event) => changeAt(event.nativeEvent.locationX, event.nativeEvent.locationY),
1324
+ onStartShouldSetResponder: () => !disabled,
1325
+ width: TONE_MAP_WIDTH
1326
+ })
1327
+ ]
1328
+ })
1329
+ });
1330
+ }
1331
+ export { ColorHueScale2, ColorWheel2, ColorPicker2, ColorTone2 };