@react-stately/color 3.5.4-nightly.4552 → 3.5.4-nightly.4558

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 (212) hide show
  1. package/dist/Color.main.js +770 -0
  2. package/dist/Color.main.js.map +1 -0
  3. package/dist/Color.mjs +764 -0
  4. package/dist/Color.module.js +764 -0
  5. package/dist/Color.module.js.map +1 -0
  6. package/dist/ar-AE.main.js +2 -2
  7. package/dist/ar-AE.main.js.map +1 -1
  8. package/dist/ar-AE.mjs +3 -3
  9. package/dist/ar-AE.module.js +2 -2
  10. package/dist/ar-AE.module.js.map +1 -1
  11. package/dist/bg-BG.main.js +2 -2
  12. package/dist/bg-BG.main.js.map +1 -1
  13. package/dist/bg-BG.mjs +3 -3
  14. package/dist/bg-BG.module.js +2 -2
  15. package/dist/bg-BG.module.js.map +1 -1
  16. package/dist/cs-CZ.main.js +2 -2
  17. package/dist/cs-CZ.main.js.map +1 -1
  18. package/dist/cs-CZ.mjs +3 -3
  19. package/dist/cs-CZ.module.js +2 -2
  20. package/dist/cs-CZ.module.js.map +1 -1
  21. package/dist/da-DK.main.js +2 -2
  22. package/dist/da-DK.main.js.map +1 -1
  23. package/dist/da-DK.mjs +3 -3
  24. package/dist/da-DK.module.js +2 -2
  25. package/dist/da-DK.module.js.map +1 -1
  26. package/dist/de-DE.main.js +2 -2
  27. package/dist/de-DE.main.js.map +1 -1
  28. package/dist/de-DE.mjs +3 -3
  29. package/dist/de-DE.module.js +2 -2
  30. package/dist/de-DE.module.js.map +1 -1
  31. package/dist/el-GR.main.js +2 -2
  32. package/dist/el-GR.main.js.map +1 -1
  33. package/dist/el-GR.mjs +3 -3
  34. package/dist/el-GR.module.js +2 -2
  35. package/dist/el-GR.module.js.map +1 -1
  36. package/dist/en-US.main.js +2 -2
  37. package/dist/en-US.main.js.map +1 -1
  38. package/dist/en-US.mjs +3 -3
  39. package/dist/en-US.module.js +2 -2
  40. package/dist/en-US.module.js.map +1 -1
  41. package/dist/es-ES.main.js +2 -2
  42. package/dist/es-ES.main.js.map +1 -1
  43. package/dist/es-ES.mjs +3 -3
  44. package/dist/es-ES.module.js +2 -2
  45. package/dist/es-ES.module.js.map +1 -1
  46. package/dist/et-EE.main.js +2 -2
  47. package/dist/et-EE.main.js.map +1 -1
  48. package/dist/et-EE.mjs +3 -3
  49. package/dist/et-EE.module.js +2 -2
  50. package/dist/et-EE.module.js.map +1 -1
  51. package/dist/fi-FI.main.js +2 -2
  52. package/dist/fi-FI.main.js.map +1 -1
  53. package/dist/fi-FI.mjs +3 -3
  54. package/dist/fi-FI.module.js +2 -2
  55. package/dist/fi-FI.module.js.map +1 -1
  56. package/dist/fr-FR.main.js +2 -2
  57. package/dist/fr-FR.main.js.map +1 -1
  58. package/dist/fr-FR.mjs +3 -3
  59. package/dist/fr-FR.module.js +2 -2
  60. package/dist/fr-FR.module.js.map +1 -1
  61. package/dist/he-IL.main.js +2 -2
  62. package/dist/he-IL.main.js.map +1 -1
  63. package/dist/he-IL.mjs +3 -3
  64. package/dist/he-IL.module.js +2 -2
  65. package/dist/he-IL.module.js.map +1 -1
  66. package/dist/hr-HR.main.js +2 -2
  67. package/dist/hr-HR.main.js.map +1 -1
  68. package/dist/hr-HR.mjs +3 -3
  69. package/dist/hr-HR.module.js +2 -2
  70. package/dist/hr-HR.module.js.map +1 -1
  71. package/dist/hu-HU.main.js +2 -2
  72. package/dist/hu-HU.main.js.map +1 -1
  73. package/dist/hu-HU.mjs +3 -3
  74. package/dist/hu-HU.module.js +2 -2
  75. package/dist/hu-HU.module.js.map +1 -1
  76. package/dist/import.mjs +5 -1303
  77. package/dist/intlStrings.main.js +108 -0
  78. package/dist/intlStrings.main.js.map +1 -0
  79. package/dist/intlStrings.mjs +110 -0
  80. package/dist/intlStrings.module.js +110 -0
  81. package/dist/intlStrings.module.js.map +1 -0
  82. package/dist/it-IT.main.js +2 -2
  83. package/dist/it-IT.main.js.map +1 -1
  84. package/dist/it-IT.mjs +3 -3
  85. package/dist/it-IT.module.js +2 -2
  86. package/dist/it-IT.module.js.map +1 -1
  87. package/dist/ja-JP.main.js +2 -2
  88. package/dist/ja-JP.main.js.map +1 -1
  89. package/dist/ja-JP.mjs +3 -3
  90. package/dist/ja-JP.module.js +2 -2
  91. package/dist/ja-JP.module.js.map +1 -1
  92. package/dist/ko-KR.main.js +2 -2
  93. package/dist/ko-KR.main.js.map +1 -1
  94. package/dist/ko-KR.mjs +3 -3
  95. package/dist/ko-KR.module.js +2 -2
  96. package/dist/ko-KR.module.js.map +1 -1
  97. package/dist/lt-LT.main.js +2 -2
  98. package/dist/lt-LT.main.js.map +1 -1
  99. package/dist/lt-LT.mjs +3 -3
  100. package/dist/lt-LT.module.js +2 -2
  101. package/dist/lt-LT.module.js.map +1 -1
  102. package/dist/lv-LV.main.js +2 -2
  103. package/dist/lv-LV.main.js.map +1 -1
  104. package/dist/lv-LV.mjs +3 -3
  105. package/dist/lv-LV.module.js +2 -2
  106. package/dist/lv-LV.module.js.map +1 -1
  107. package/dist/main.js +10 -1308
  108. package/dist/main.js.map +1 -1
  109. package/dist/module.js +5 -1303
  110. package/dist/module.js.map +1 -1
  111. package/dist/nb-NO.main.js +2 -2
  112. package/dist/nb-NO.main.js.map +1 -1
  113. package/dist/nb-NO.mjs +3 -3
  114. package/dist/nb-NO.module.js +2 -2
  115. package/dist/nb-NO.module.js.map +1 -1
  116. package/dist/nl-NL.main.js +2 -2
  117. package/dist/nl-NL.main.js.map +1 -1
  118. package/dist/nl-NL.mjs +3 -3
  119. package/dist/nl-NL.module.js +2 -2
  120. package/dist/nl-NL.module.js.map +1 -1
  121. package/dist/pl-PL.main.js +2 -2
  122. package/dist/pl-PL.main.js.map +1 -1
  123. package/dist/pl-PL.mjs +3 -3
  124. package/dist/pl-PL.module.js +2 -2
  125. package/dist/pl-PL.module.js.map +1 -1
  126. package/dist/pt-BR.main.js +2 -2
  127. package/dist/pt-BR.main.js.map +1 -1
  128. package/dist/pt-BR.mjs +3 -3
  129. package/dist/pt-BR.module.js +2 -2
  130. package/dist/pt-BR.module.js.map +1 -1
  131. package/dist/pt-PT.main.js +2 -2
  132. package/dist/pt-PT.main.js.map +1 -1
  133. package/dist/pt-PT.mjs +3 -3
  134. package/dist/pt-PT.module.js +2 -2
  135. package/dist/pt-PT.module.js.map +1 -1
  136. package/dist/ro-RO.main.js +2 -2
  137. package/dist/ro-RO.main.js.map +1 -1
  138. package/dist/ro-RO.mjs +3 -3
  139. package/dist/ro-RO.module.js +2 -2
  140. package/dist/ro-RO.module.js.map +1 -1
  141. package/dist/ru-RU.main.js +2 -2
  142. package/dist/ru-RU.main.js.map +1 -1
  143. package/dist/ru-RU.mjs +3 -3
  144. package/dist/ru-RU.module.js +2 -2
  145. package/dist/ru-RU.module.js.map +1 -1
  146. package/dist/sk-SK.main.js +2 -2
  147. package/dist/sk-SK.main.js.map +1 -1
  148. package/dist/sk-SK.mjs +3 -3
  149. package/dist/sk-SK.module.js +2 -2
  150. package/dist/sk-SK.module.js.map +1 -1
  151. package/dist/sl-SI.main.js +2 -2
  152. package/dist/sl-SI.main.js.map +1 -1
  153. package/dist/sl-SI.mjs +3 -3
  154. package/dist/sl-SI.module.js +2 -2
  155. package/dist/sl-SI.module.js.map +1 -1
  156. package/dist/sr-SP.main.js +2 -2
  157. package/dist/sr-SP.main.js.map +1 -1
  158. package/dist/sr-SP.mjs +3 -3
  159. package/dist/sr-SP.module.js +2 -2
  160. package/dist/sr-SP.module.js.map +1 -1
  161. package/dist/sv-SE.main.js +2 -2
  162. package/dist/sv-SE.main.js.map +1 -1
  163. package/dist/sv-SE.mjs +3 -3
  164. package/dist/sv-SE.module.js +2 -2
  165. package/dist/sv-SE.module.js.map +1 -1
  166. package/dist/tr-TR.main.js +2 -2
  167. package/dist/tr-TR.main.js.map +1 -1
  168. package/dist/tr-TR.mjs +3 -3
  169. package/dist/tr-TR.module.js +2 -2
  170. package/dist/tr-TR.module.js.map +1 -1
  171. package/dist/uk-UA.main.js +2 -2
  172. package/dist/uk-UA.main.js.map +1 -1
  173. package/dist/uk-UA.mjs +3 -3
  174. package/dist/uk-UA.module.js +2 -2
  175. package/dist/uk-UA.module.js.map +1 -1
  176. package/dist/useColor.main.js +36 -0
  177. package/dist/useColor.main.js.map +1 -0
  178. package/dist/useColor.mjs +31 -0
  179. package/dist/useColor.module.js +31 -0
  180. package/dist/useColor.module.js.map +1 -0
  181. package/dist/useColorAreaState.main.js +124 -0
  182. package/dist/useColorAreaState.main.js.map +1 -0
  183. package/dist/useColorAreaState.mjs +119 -0
  184. package/dist/useColorAreaState.module.js +119 -0
  185. package/dist/useColorAreaState.module.js.map +1 -0
  186. package/dist/useColorFieldState.main.js +138 -0
  187. package/dist/useColorFieldState.main.js.map +1 -0
  188. package/dist/useColorFieldState.mjs +133 -0
  189. package/dist/useColorFieldState.module.js +133 -0
  190. package/dist/useColorFieldState.module.js.map +1 -0
  191. package/dist/useColorSliderState.main.js +75 -0
  192. package/dist/useColorSliderState.main.js.map +1 -0
  193. package/dist/useColorSliderState.mjs +70 -0
  194. package/dist/useColorSliderState.module.js +70 -0
  195. package/dist/useColorSliderState.module.js.map +1 -0
  196. package/dist/useColorWheelState.main.js +123 -0
  197. package/dist/useColorWheelState.main.js.map +1 -0
  198. package/dist/useColorWheelState.mjs +118 -0
  199. package/dist/useColorWheelState.module.js +118 -0
  200. package/dist/useColorWheelState.module.js.map +1 -0
  201. package/dist/zh-CN.main.js +2 -2
  202. package/dist/zh-CN.main.js.map +1 -1
  203. package/dist/zh-CN.mjs +3 -3
  204. package/dist/zh-CN.module.js +2 -2
  205. package/dist/zh-CN.module.js.map +1 -1
  206. package/dist/zh-TW.main.js +2 -2
  207. package/dist/zh-TW.main.js.map +1 -1
  208. package/dist/zh-TW.mjs +3 -3
  209. package/dist/zh-TW.module.js +2 -2
  210. package/dist/zh-TW.module.js.map +1 -1
  211. package/package.json +9 -9
  212. package/src/Color.ts +13 -10
@@ -7,8 +7,8 @@ module.exports = {
7
7
  "lightness": `\u{41E}\u{441}\u{432}\u{456}\u{442}\u{43B}\u{435}\u{43D}\u{456}\u{441}\u{442}\u{44C}`,
8
8
  "red": `\u{427}\u{435}\u{440}\u{432}\u{43E}\u{43D}\u{438}\u{439}`,
9
9
  "saturation": `\u{41D}\u{430}\u{441}\u{438}\u{447}\u{435}\u{43D}\u{456}\u{441}\u{442}\u{44C}`,
10
- "colorName": (args)=>`${args.transparency} ${args.lightness} ${args.chroma} ${args.hue}`,
11
- "transparency": (args)=>`${args.percent} transparent`,
10
+ "colorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}`,
11
+ "transparentColorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}, ${args.percentTransparent} transparent`,
12
12
  "very dark": `very dark`,
13
13
  "dark": `dark`,
14
14
  "light": `light`,
@@ -1 +1 @@
1
- {"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,mCAAK,CAAC;IAClC,QAAQ,CAAC,mCAAK,CAAC;IACf,cAAc,CAAC,sEAAU,CAAC;IAC1B,SAAS,CAAC,iDAAO,CAAC;IAClB,OAAO,CAAC,qBAAG,CAAC;IACZ,aAAa,CAAC,oFAAY,CAAC;IAC3B,OAAO,CAAC,wDAAQ,CAAC;IACjB,cAAc,CAAC,6EAAW,CAAC;IAC3B,aAAa,CAAC,OAAS,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;IAC1F,gBAAgB,CAAC,OAAS,CAAC,EAAE,KAAK,OAAO,CAAC,YAAY,CAAC;IACvD,aAAa,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC;IACd,SAAS,CAAC,KAAK,CAAC;IAChB,cAAc,CAAC,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC;IACd,WAAW,CAAC,OAAO,CAAC;IACpB,WAAW,CAAC,OAAO,CAAC;IACpB,SAAS,CAAC,KAAK,CAAC;IAChB,SAAS,CAAC,KAAK,CAAC;IAChB,QAAQ,CAAC,IAAI,CAAC;IACd,QAAQ,CAAC,IAAI,CAAC;IACd,YAAY,CAAC,QAAQ,CAAC;IACtB,cAAc,CAAC,UAAU,CAAC;IAC1B,SAAS,CAAC,KAAK,CAAC;IAChB,UAAU,CAAC,MAAM,CAAC;IAClB,iBAAiB,CAAC,aAAa,CAAC;IAChC,gBAAgB,CAAC,YAAY,CAAC;IAC9B,UAAU,CAAC,MAAM,CAAC;IAClB,gBAAgB,CAAC,YAAY,CAAC;IAC9B,cAAc,CAAC,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC;IACd,aAAa,CAAC,SAAS,CAAC;IACxB,eAAe,CAAC,WAAW,CAAC;IAC5B,UAAU,CAAC,MAAM,CAAC;IAClB,kBAAkB,CAAC,cAAc,CAAC;IAClC,WAAW,CAAC,OAAO,CAAC;IACpB,gBAAgB,CAAC,YAAY,CAAC;AAChC","sources":["packages/@react-stately/color/intl/uk-UA.json"],"sourcesContent":["{\n \"alpha\": \"Альфа\",\n \"blue\": \"Синій\",\n \"brightness\": \"Яскравість\",\n \"green\": \"Зелений\",\n \"hue\": \"Тон\",\n \"lightness\": \"Освітленість\",\n \"red\": \"Червоний\",\n \"saturation\": \"Насиченість\",\n \"colorName\": \"{transparency} {lightness} {chroma} {hue}\",\n \"transparency\": \"{percent} transparent\",\n \"very dark\": \"very dark\",\n \"dark\": \"dark\",\n \"light\": \"light\",\n \"very light\": \"very light\",\n \"pale\": \"pale\",\n \"grayish\": \"grayish\",\n \"vibrant\": \"vibrant\",\n \"black\": \"black\",\n \"white\": \"white\",\n \"gray\": \"gray\",\n \"pink\": \"pink\",\n \"pink red\": \"pink red\",\n \"red orange\": \"red orange\",\n \"brown\": \"brown\",\n \"orange\": \"orange\",\n \"orange yellow\": \"orange yellow\",\n \"brown yellow\": \"brown yellow\",\n \"yellow\": \"yellow\",\n \"yellow green\": \"yellow green\",\n \"green cyan\": \"green cyan\",\n \"cyan\": \"cyan\",\n \"cyan blue\": \"cyan blue\",\n \"blue purple\": \"blue purple\",\n \"purple\": \"purple\",\n \"purple magenta\": \"purple magenta\",\n \"magenta\": \"magenta\",\n \"magenta pink\": \"magenta pink\"\n}\n"],"names":[],"version":3,"file":"uk-UA.main.js.map"}
1
+ {"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,mCAAK,CAAC;IAClC,QAAQ,CAAC,mCAAK,CAAC;IACf,cAAc,CAAC,sEAAU,CAAC;IAC1B,SAAS,CAAC,iDAAO,CAAC;IAClB,OAAO,CAAC,qBAAG,CAAC;IACZ,aAAa,CAAC,oFAAY,CAAC;IAC3B,OAAO,CAAC,wDAAQ,CAAC;IACjB,cAAc,CAAC,6EAAW,CAAC;IAC3B,aAAa,CAAC,OAAS,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;IACrE,wBAAwB,CAAC,OAAS,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,KAAK,kBAAkB,CAAC,YAAY,CAAC;IACxH,aAAa,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC;IACd,SAAS,CAAC,KAAK,CAAC;IAChB,cAAc,CAAC,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC;IACd,WAAW,CAAC,OAAO,CAAC;IACpB,WAAW,CAAC,OAAO,CAAC;IACpB,SAAS,CAAC,KAAK,CAAC;IAChB,SAAS,CAAC,KAAK,CAAC;IAChB,QAAQ,CAAC,IAAI,CAAC;IACd,QAAQ,CAAC,IAAI,CAAC;IACd,YAAY,CAAC,QAAQ,CAAC;IACtB,cAAc,CAAC,UAAU,CAAC;IAC1B,SAAS,CAAC,KAAK,CAAC;IAChB,UAAU,CAAC,MAAM,CAAC;IAClB,iBAAiB,CAAC,aAAa,CAAC;IAChC,gBAAgB,CAAC,YAAY,CAAC;IAC9B,UAAU,CAAC,MAAM,CAAC;IAClB,gBAAgB,CAAC,YAAY,CAAC;IAC9B,cAAc,CAAC,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC;IACd,aAAa,CAAC,SAAS,CAAC;IACxB,eAAe,CAAC,WAAW,CAAC;IAC5B,UAAU,CAAC,MAAM,CAAC;IAClB,kBAAkB,CAAC,cAAc,CAAC;IAClC,WAAW,CAAC,OAAO,CAAC;IACpB,gBAAgB,CAAC,YAAY,CAAC;AAChC","sources":["packages/@react-stately/color/intl/uk-UA.json"],"sourcesContent":["{\n \"alpha\": \"Альфа\",\n \"blue\": \"Синій\",\n \"brightness\": \"Яскравість\",\n \"green\": \"Зелений\",\n \"hue\": \"Тон\",\n \"lightness\": \"Освітленість\",\n \"red\": \"Червоний\",\n \"saturation\": \"Насиченість\",\n \"colorName\": \"{lightness} {chroma} {hue}\",\n \"transparentColorName\": \"{lightness} {chroma} {hue}, {percentTransparent} transparent\",\n \"very dark\": \"very dark\",\n \"dark\": \"dark\",\n \"light\": \"light\",\n \"very light\": \"very light\",\n \"pale\": \"pale\",\n \"grayish\": \"grayish\",\n \"vibrant\": \"vibrant\",\n \"black\": \"black\",\n \"white\": \"white\",\n \"gray\": \"gray\",\n \"pink\": \"pink\",\n \"pink red\": \"pink red\",\n \"red orange\": \"red orange\",\n \"brown\": \"brown\",\n \"orange\": \"orange\",\n \"orange yellow\": \"orange yellow\",\n \"brown yellow\": \"brown yellow\",\n \"yellow\": \"yellow\",\n \"yellow green\": \"yellow green\",\n \"green cyan\": \"green cyan\",\n \"cyan\": \"cyan\",\n \"cyan blue\": \"cyan blue\",\n \"blue purple\": \"blue purple\",\n \"purple\": \"purple\",\n \"purple magenta\": \"purple magenta\",\n \"magenta\": \"magenta\",\n \"magenta pink\": \"magenta pink\"\n}\n"],"names":[],"version":3,"file":"uk-UA.main.js.map"}
package/dist/uk-UA.mjs CHANGED
@@ -8,8 +8,8 @@ $0f9b1074d04f4954$exports = {
8
8
  "lightness": `\u{41E}\u{441}\u{432}\u{456}\u{442}\u{43B}\u{435}\u{43D}\u{456}\u{441}\u{442}\u{44C}`,
9
9
  "red": `\u{427}\u{435}\u{440}\u{432}\u{43E}\u{43D}\u{438}\u{439}`,
10
10
  "saturation": `\u{41D}\u{430}\u{441}\u{438}\u{447}\u{435}\u{43D}\u{456}\u{441}\u{442}\u{44C}`,
11
- "colorName": (args)=>`${args.transparency} ${args.lightness} ${args.chroma} ${args.hue}`,
12
- "transparency": (args)=>`${args.percent} transparent`,
11
+ "colorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}`,
12
+ "transparentColorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}, ${args.percentTransparent} transparent`,
13
13
  "very dark": `very dark`,
14
14
  "dark": `dark`,
15
15
  "light": `light`,
@@ -41,4 +41,4 @@ $0f9b1074d04f4954$exports = {
41
41
 
42
42
 
43
43
  export {$0f9b1074d04f4954$exports as default};
44
- //# sourceMappingURL=uk-UA.module.js.map
44
+ //# sourceMappingURL=uk-UA.mjs.map
@@ -8,8 +8,8 @@ $0f9b1074d04f4954$exports = {
8
8
  "lightness": `\u{41E}\u{441}\u{432}\u{456}\u{442}\u{43B}\u{435}\u{43D}\u{456}\u{441}\u{442}\u{44C}`,
9
9
  "red": `\u{427}\u{435}\u{440}\u{432}\u{43E}\u{43D}\u{438}\u{439}`,
10
10
  "saturation": `\u{41D}\u{430}\u{441}\u{438}\u{447}\u{435}\u{43D}\u{456}\u{441}\u{442}\u{44C}`,
11
- "colorName": (args)=>`${args.transparency} ${args.lightness} ${args.chroma} ${args.hue}`,
12
- "transparency": (args)=>`${args.percent} transparent`,
11
+ "colorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}`,
12
+ "transparentColorName": (args)=>`${args.lightness} ${args.chroma} ${args.hue}, ${args.percentTransparent} transparent`,
13
13
  "very dark":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C;IACxB,eAAe,CAAC,WAAW,CAAC;IAC5B,UAAU,CAAC,MAAM,CAAC;IAClB,kBAAkB,CAAC,cAAc,CAAC;IAClC,WAAW,CAAC,OAAO,CAAC;IACpB,gBAAgB,CAAC,YAAY,CAAC;AAChC","sources":["packages/@react-stately/color/intl/uk-UA.json"],"sourcesContent":["{\n \"alpha\": \"Альфа\",\n \"blue\": \"Синій\",\n \"brightness\": \"Яскравість\",\n \"green\": \"Зелений\",\n \"hue\": \"Тон\",\n \"lightness\": \"Освітленість\",\n \"red\": \"Червоний\",\n \"saturation\": \"Насиченість\",\n \"colorName\": \"{transparency} {lightness} {chroma} {hue}\",\n \"transparency\": \"{percent} transparent\",\n \"very dark\": \"very dark\",\n \"dark\": \"dark\",\n \"light\": \"light\",\n \"very light\": \"very light\",\n \"pale\": \"pale\",\n \"grayish\": \"grayish\",\n \"vibrant\": \"vibrant\",\n \"black\": \"black\",\n \"white\": \"white\",\n \"gray\": \"gray\",\n \"pink\": \"pink\",\n \"pink red\": \"pink red\",\n \"red orange\": \"red orange\",\n \"brown\": \"brown\",\n \"orange\": \"orange\",\n \"orange yellow\": \"orange yellow\",\n \"brown yellow\": \"brown yellow\",\n \"yellow\": \"yellow\",\n \"yellow green\": \"yellow green\",\n \"green cyan\": \"green cyan\",\n \"cyan\": \"cyan\",\n \"cyan blue\": \"cyan blue\",\n \"blue purple\": \"blue purple\",\n \"purple\": \"purple\",\n \"purple magenta\": \"purple magenta\",\n \"magenta\": \"magenta\",\n \"magenta pink\": \"magenta pink\"\n}\n"],"names":[],"version":3,"file":"uk-UA.module.js.map"}
1
+ {"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,mCAAK,CAAC;IAClC,QAAQ,CAAC,mCAAK,CAAC;IACf,cAAc,CAAC,sEAAU,CAAC;IAC1B,SAAS,CAAC,iDAAO,CAAC;IAClB,OAAO,CAAC,qBAAG,CAAC;IACZ,aAAa,CAAC,oFAAY,CAAC;IAC3B,OAAO,CAAC,wDAA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blue\": \"Синій\",\n \"brightness\": \"Яскравість\",\n \"green\": \"Зелений\",\n \"hue\": \"Тон\",\n \"lightness\": \"Освітленість\",\n \"red\": \"Червоний\",\n \"saturation\": \"Насиченість\",\n \"colorName\": \"{lightness} {chroma} {hue}\",\n \"transparentColorName\": \"{lightness} {chroma} {hue}, {percentTransparent} transparent\",\n \"very dark\": \"very dark\",\n \"dark\": \"dark\",\n \"light\": \"light\",\n \"very light\": \"very light\",\n \"pale\": \"pale\",\n \"grayish\": \"grayish\",\n \"vibrant\": \"vibrant\",\n \"black\": \"black\",\n \"white\": \"white\",\n \"gray\": \"gray\",\n \"pink\": \"pink\",\n \"pink red\": \"pink red\",\n \"red orange\": \"red orange\",\n \"brown\": \"brown\",\n \"orange\": \"orange\",\n \"orange yellow\": \"orange yellow\",\n \"brown yellow\": \"brown yellow\",\n \"yellow\": \"yellow\",\n \"yellow green\": \"yellow green\",\n \"green cyan\": \"green cyan\",\n \"cyan\": \"cyan\",\n \"cyan blue\": \"cyan blue\",\n \"blue purple\": \"blue purple\",\n \"purple\": \"purple\",\n \"purple magenta\": \"purple magenta\",\n \"magenta\": \"magenta\",\n \"magenta pink\": \"magenta pink\"\n}\n"],"names":[],"version":3,"file":"uk-UA.module.js.map"}
@@ -0,0 +1,36 @@
1
+ var $83fe1a57d631223b$exports = require("./Color.main.js");
2
+ var $bTjYY$react = require("react");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "useColor", () => $f8b3be23ba4462b1$export$5aadd9c0606af5c2);
10
+ /*
11
+ * Copyright 2020 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+
22
+ function $f8b3be23ba4462b1$export$5aadd9c0606af5c2(value) {
23
+ return (0, $bTjYY$react.useMemo)(()=>{
24
+ if (typeof value === "string") try {
25
+ return (0, $83fe1a57d631223b$exports.parseColor)(value);
26
+ } catch (err) {
27
+ return undefined;
28
+ }
29
+ return value;
30
+ }, [
31
+ value
32
+ ]);
33
+ }
34
+
35
+
36
+ //# sourceMappingURL=useColor.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAS,KAAwC;IAC/D,OAAO,CAAA,GAAA,oBAAM,EAAE;QACb,IAAI,OAAO,UAAU,UACnB,IAAI;YACF,OAAO,CAAA,GAAA,oCAAS,EAAE;QACpB,EAAE,OAAO,KAAK;YACZ,OAAO;QACT;QAEF,OAAO;IACT,GAAG;QAAC;KAAM;AACZ","sources":["packages/@react-stately/color/src/useColor.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Color} from '@react-types/color';\nimport {parseColor} from './Color';\nimport {useMemo} from 'react';\n\nexport function useColor(value: string | Color | undefined | null) {\n return useMemo(() => {\n if (typeof value === 'string') {\n try {\n return parseColor(value);\n } catch (err) {\n return undefined;\n }\n }\n return value;\n }, [value]);\n}\n"],"names":[],"version":3,"file":"useColor.main.js.map"}
@@ -0,0 +1,31 @@
1
+ import {parseColor as $799cddbef784668f$export$6e865ea70d7724f} from "./Color.mjs";
2
+ import {useMemo as $2sEeQ$useMemo} from "react";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $aa90ad8b2b1d015f$export$5aadd9c0606af5c2(value) {
17
+ return (0, $2sEeQ$useMemo)(()=>{
18
+ if (typeof value === "string") try {
19
+ return (0, $799cddbef784668f$export$6e865ea70d7724f)(value);
20
+ } catch (err) {
21
+ return undefined;
22
+ }
23
+ return value;
24
+ }, [
25
+ value
26
+ ]);
27
+ }
28
+
29
+
30
+ export {$aa90ad8b2b1d015f$export$5aadd9c0606af5c2 as useColor};
31
+ //# sourceMappingURL=useColor.mjs.map
@@ -0,0 +1,31 @@
1
+ import {parseColor as $799cddbef784668f$export$6e865ea70d7724f} from "./Color.module.js";
2
+ import {useMemo as $2sEeQ$useMemo} from "react";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $aa90ad8b2b1d015f$export$5aadd9c0606af5c2(value) {
17
+ return (0, $2sEeQ$useMemo)(()=>{
18
+ if (typeof value === "string") try {
19
+ return (0, $799cddbef784668f$export$6e865ea70d7724f)(value);
20
+ } catch (err) {
21
+ return undefined;
22
+ }
23
+ return value;
24
+ }, [
25
+ value
26
+ ]);
27
+ }
28
+
29
+
30
+ export {$aa90ad8b2b1d015f$export$5aadd9c0606af5c2 as useColor};
31
+ //# sourceMappingURL=useColor.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAS,KAAwC;IAC/D,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,IAAI,OAAO,UAAU,UACnB,IAAI;YACF,OAAO,CAAA,GAAA,wCAAS,EAAE;QACpB,EAAE,OAAO,KAAK;YACZ,OAAO;QACT;QAEF,OAAO;IACT,GAAG;QAAC;KAAM;AACZ","sources":["packages/@react-stately/color/src/useColor.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Color} from '@react-types/color';\nimport {parseColor} from './Color';\nimport {useMemo} from 'react';\n\nexport function useColor(value: string | Color | undefined | null) {\n return useMemo(() => {\n if (typeof value === 'string') {\n try {\n return parseColor(value);\n } catch (err) {\n return undefined;\n }\n }\n return value;\n }, [value]);\n}\n"],"names":[],"version":3,"file":"useColor.module.js.map"}
@@ -0,0 +1,124 @@
1
+ var $83fe1a57d631223b$exports = require("./Color.main.js");
2
+ var $318Do$reactstatelyutils = require("@react-stately/utils");
3
+ var $318Do$react = require("react");
4
+
5
+
6
+ function $parcel$export(e, n, v, s) {
7
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
+ }
9
+
10
+ $parcel$export(module.exports, "useColorAreaState", () => $af2d7ac9990cfee2$export$6df7f0e2cabc7eef);
11
+ /*
12
+ * Copyright 2020 Adobe. All rights reserved.
13
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License. You may obtain a copy
15
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software distributed under
18
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
+ * OF ANY KIND, either express or implied. See the License for the specific language
20
+ * governing permissions and limitations under the License.
21
+ */
22
+
23
+
24
+ const $af2d7ac9990cfee2$var$DEFAULT_COLOR = (0, $83fe1a57d631223b$exports.parseColor)("#ffffff");
25
+ function $af2d7ac9990cfee2$export$6df7f0e2cabc7eef(props) {
26
+ let { value: value, defaultValue: defaultValue, xChannel: xChannel, yChannel: yChannel, onChange: onChange, onChangeEnd: onChangeEnd } = props;
27
+ if (!value && !defaultValue) defaultValue = $af2d7ac9990cfee2$var$DEFAULT_COLOR;
28
+ let [color, setColorState] = (0, $318Do$reactstatelyutils.useControlledState)(value && (0, $83fe1a57d631223b$exports.normalizeColor)(value), defaultValue && (0, $83fe1a57d631223b$exports.normalizeColor)(defaultValue), onChange);
29
+ let valueRef = (0, $318Do$react.useRef)(color);
30
+ let setColor = (color)=>{
31
+ valueRef.current = color;
32
+ setColorState(color);
33
+ };
34
+ let channels = (0, $318Do$react.useMemo)(()=>color.getColorSpaceAxes({
35
+ xChannel: xChannel,
36
+ yChannel: yChannel
37
+ }), [
38
+ color,
39
+ xChannel,
40
+ yChannel
41
+ ]);
42
+ let xChannelRange = color.getChannelRange(channels.xChannel);
43
+ let yChannelRange = color.getChannelRange(channels.yChannel);
44
+ let { minValue: minValueX, maxValue: maxValueX, step: stepX, pageSize: pageSizeX } = xChannelRange;
45
+ let { minValue: minValueY, maxValue: maxValueY, step: stepY, pageSize: pageSizeY } = yChannelRange;
46
+ let [isDragging, setDragging] = (0, $318Do$react.useState)(false);
47
+ let isDraggingRef = (0, $318Do$react.useRef)(false);
48
+ let xValue = color.getChannelValue(channels.xChannel);
49
+ let yValue = color.getChannelValue(channels.yChannel);
50
+ let setXValue = (v)=>{
51
+ if (v === xValue) return;
52
+ let newColor = color.withChannelValue(channels.xChannel, v);
53
+ setColor(newColor);
54
+ };
55
+ let setYValue = (v)=>{
56
+ if (v === yValue) return;
57
+ let newColor = color.withChannelValue(channels.yChannel, v);
58
+ setColor(newColor);
59
+ };
60
+ return {
61
+ channels: channels,
62
+ xChannelStep: stepX,
63
+ yChannelStep: stepY,
64
+ xChannelPageStep: pageSizeX,
65
+ yChannelPageStep: pageSizeY,
66
+ value: color,
67
+ setValue (value) {
68
+ setColor((0, $83fe1a57d631223b$exports.normalizeColor)(value));
69
+ },
70
+ xValue: xValue,
71
+ setXValue: setXValue,
72
+ yValue: yValue,
73
+ setYValue: setYValue,
74
+ setColorFromPoint (x, y) {
75
+ let newXValue = minValueX + (0, $318Do$reactstatelyutils.clamp)(x, 0, 1) * (maxValueX - minValueX);
76
+ let newYValue = minValueY + (1 - (0, $318Do$reactstatelyutils.clamp)(y, 0, 1)) * (maxValueY - minValueY);
77
+ let newColor;
78
+ if (newXValue !== xValue) {
79
+ // Round new value to multiple of step, clamp value between min and max
80
+ newXValue = (0, $318Do$reactstatelyutils.snapValueToStep)(newXValue, minValueX, maxValueX, stepX);
81
+ newColor = color.withChannelValue(channels.xChannel, newXValue);
82
+ }
83
+ if (newYValue !== yValue) {
84
+ // Round new value to multiple of step, clamp value between min and max
85
+ newYValue = (0, $318Do$reactstatelyutils.snapValueToStep)(newYValue, minValueY, maxValueY, stepY);
86
+ newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);
87
+ }
88
+ if (newColor) setColor(newColor);
89
+ },
90
+ getThumbPosition () {
91
+ let x = (xValue - minValueX) / (maxValueX - minValueX);
92
+ let y = 1 - (yValue - minValueY) / (maxValueY - minValueY);
93
+ return {
94
+ x: x,
95
+ y: y
96
+ };
97
+ },
98
+ incrementX (stepSize) {
99
+ setXValue(xValue + stepSize > maxValueX ? maxValueX : (0, $318Do$reactstatelyutils.snapValueToStep)(xValue + stepSize, minValueX, maxValueX, stepX));
100
+ },
101
+ incrementY (stepSize) {
102
+ setYValue(yValue + stepSize > maxValueY ? maxValueY : (0, $318Do$reactstatelyutils.snapValueToStep)(yValue + stepSize, minValueY, maxValueY, stepY));
103
+ },
104
+ decrementX (stepSize) {
105
+ setXValue((0, $318Do$reactstatelyutils.snapValueToStep)(xValue - stepSize, minValueX, maxValueX, stepX));
106
+ },
107
+ decrementY (stepSize) {
108
+ setYValue((0, $318Do$reactstatelyutils.snapValueToStep)(yValue - stepSize, minValueY, maxValueY, stepY));
109
+ },
110
+ setDragging (isDragging) {
111
+ let wasDragging = isDraggingRef.current;
112
+ isDraggingRef.current = isDragging;
113
+ if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
114
+ setDragging(isDragging);
115
+ },
116
+ isDragging: isDragging,
117
+ getDisplayColor () {
118
+ return color.withChannelValue("alpha", 1);
119
+ }
120
+ };
121
+ }
122
+
123
+
124
+ //# sourceMappingURL=useColorAreaState.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA0DD,MAAM,sCAAgB,CAAA,GAAA,oCAAS,EAAE;AAK1B,SAAS,0CAAkB,KAAqB;IACrD,IAAI,SACF,KAAK,gBACL,YAAY,YACZ,QAAQ,YACR,QAAQ,YACR,QAAQ,eACR,WAAW,EACZ,GAAG;IAEJ,IAAI,CAAC,SAAS,CAAC,cACb,eAAe;IAGjB,IAAI,CAAC,OAAO,cAAc,GAAG,CAAA,GAAA,2CAAiB,EAAE,SAAS,CAAA,GAAA,wCAAa,EAAE,QAAQ,gBAAgB,CAAA,GAAA,wCAAa,EAAE,eAAe;IAC9H,IAAI,WAAW,CAAA,GAAA,mBAAK,EAA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AC,SAAS;QACzC;IACF;AACF","sources":["packages/@react-stately/color/src/useColorAreaState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {clamp, snapValueToStep, useControlledState} from '@react-stately/utils';\nimport {Color, ColorAreaProps, ColorChannel} from '@react-types/color';\nimport {normalizeColor, parseColor} from './Color';\nimport {useMemo, useRef, useState} from 'react';\n\nexport interface ColorAreaState {\n /** The current color value displayed by the color area. */\n readonly value: Color,\n /** Sets the current color value. If a string is passed, it will be parsed to a Color. */\n setValue(value: string | Color): void,\n\n /** The current value of the horizontal axis channel displayed by the color area. */\n xValue: number,\n /** Sets the value for the horizontal axis channel displayed by the color area, and triggers `onChange`. */\n setXValue(value: number): void,\n\n /** The current value of the vertical axis channel displayed by the color area. */\n yValue: number,\n /** Sets the value for the vertical axis channel displayed by the color area, and triggers `onChange`. */\n setYValue(value: number): void,\n\n /** Sets the x and y channels of the current color value based on a percentage of the width and height of the color area, and triggers `onChange`. */\n setColorFromPoint(x: number, y: number): void,\n /** Returns the coordinates of the thumb relative to the upper left corner of the color area as a percentage. */\n getThumbPosition(): {x: number, y: number},\n\n /** Increments the value of the horizontal axis channel by the channel step or page amount. */\n incrementX(stepSize?: number): void,\n /** Decrements the value of the horizontal axis channel by the channel step or page amount. */\n decrementX(stepSize?: number): void,\n\n /** Increments the value of the vertical axis channel by the channel step or page amount. */\n incrementY(stepSize?: number): void,\n /** Decrements the value of the vertical axis channel by the channel step or page amount. */\n decrementY(stepSize?: number): void,\n\n /** Whether the color area is currently being dragged. */\n readonly isDragging: boolean,\n /** Sets whether the color area is being dragged. */\n setDragging(value: boolean): void,\n\n /** Returns the xChannel, yChannel and zChannel names based on the color value. */\n channels: {xChannel: ColorChannel, yChannel: ColorChannel, zChannel: ColorChannel},\n /** The step value of the xChannel, used when incrementing and decrementing. */\n xChannelStep: number,\n /** The step value of the yChannel, used when incrementing and decrementing. */\n yChannelStep: number,\n /** The page step value of the xChannel, used when incrementing and decrementing. */\n xChannelPageStep: number,\n /** The page step value of the yChannel, used when incrementing and decrementing. */\n yChannelPageStep: number,\n\n /** Returns the color that should be displayed in the color area thumb instead of `value`. */\n getDisplayColor(): Color\n}\n\nconst DEFAULT_COLOR = parseColor('#ffffff');\n/**\n * Provides state management for a color area component.\n * Color area allows users to adjust two channels of an HSL, HSB or RGB color value against a two-dimensional gradient background.\n */\nexport function useColorAreaState(props: ColorAreaProps): ColorAreaState {\n let {\n value,\n defaultValue,\n xChannel,\n yChannel,\n onChange,\n onChangeEnd\n } = props;\n\n if (!value && !defaultValue) {\n defaultValue = DEFAULT_COLOR;\n }\n\n let [color, setColorState] = useControlledState(value && normalizeColor(value), defaultValue && normalizeColor(defaultValue), onChange);\n let valueRef = useRef(color);\n let setColor = (color: Color) => {\n valueRef.current = color;\n setColorState(color);\n };\n\n let channels = useMemo(() =>\n color.getColorSpaceAxes({xChannel, yChannel}),\n [color, xChannel, yChannel]\n );\n\n let xChannelRange = color.getChannelRange(channels.xChannel);\n let yChannelRange = color.getChannelRange(channels.yChannel);\n let {minValue: minValueX, maxValue: maxValueX, step: stepX, pageSize: pageSizeX} = xChannelRange;\n let {minValue: minValueY, maxValue: maxValueY, step: stepY, pageSize: pageSizeY} = yChannelRange;\n\n let [isDragging, setDragging] = useState(false);\n let isDraggingRef = useRef(false);\n\n let xValue = color.getChannelValue(channels.xChannel);\n let yValue = color.getChannelValue(channels.yChannel);\n let setXValue = (v: number) => {\n if (v === xValue) {\n return;\n }\n let newColor = color.withChannelValue(channels.xChannel, v);\n setColor(newColor);\n };\n let setYValue = (v: number) => {\n if (v === yValue) {\n return;\n }\n let newColor = color.withChannelValue(channels.yChannel, v);\n setColor(newColor);\n };\n\n return {\n channels,\n xChannelStep: stepX,\n yChannelStep: stepY,\n xChannelPageStep: pageSizeX,\n yChannelPageStep: pageSizeY,\n value: color,\n setValue(value) {\n setColor(normalizeColor(value));\n },\n xValue,\n setXValue,\n yValue,\n setYValue,\n setColorFromPoint(x: number, y: number) {\n let newXValue = minValueX + clamp(x, 0, 1) * (maxValueX - minValueX);\n let newYValue = minValueY + (1 - clamp(y, 0, 1)) * (maxValueY - minValueY);\n let newColor:Color;\n if (newXValue !== xValue) {\n // Round new value to multiple of step, clamp value between min and max\n newXValue = snapValueToStep(newXValue, minValueX, maxValueX, stepX);\n newColor = color.withChannelValue(channels.xChannel, newXValue);\n }\n if (newYValue !== yValue) {\n // Round new value to multiple of step, clamp value between min and max\n newYValue = snapValueToStep(newYValue, minValueY, maxValueY, stepY);\n newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);\n }\n if (newColor) {\n setColor(newColor);\n }\n },\n getThumbPosition() {\n let x = (xValue - minValueX) / (maxValueX - minValueX);\n let y = 1 - (yValue - minValueY) / (maxValueY - minValueY);\n return {x, y};\n },\n incrementX(stepSize) {\n setXValue(xValue + stepSize > maxValueX ? maxValueX : snapValueToStep(xValue + stepSize, minValueX, maxValueX, stepX));\n },\n incrementY(stepSize) {\n setYValue(yValue + stepSize > maxValueY ? maxValueY : snapValueToStep(yValue + stepSize, minValueY, maxValueY, stepY));\n },\n decrementX(stepSize) {\n setXValue(snapValueToStep(xValue - stepSize, minValueX, maxValueX, stepX));\n },\n decrementY(stepSize) {\n setYValue(snapValueToStep(yValue - stepSize, minValueY, maxValueY, stepY));\n },\n setDragging(isDragging) {\n let wasDragging = isDraggingRef.current;\n isDraggingRef.current = isDragging;\n\n if (onChangeEnd && !isDragging && wasDragging) {\n onChangeEnd(valueRef.current);\n }\n\n setDragging(isDragging);\n },\n isDragging,\n getDisplayColor() {\n return color.withChannelValue('alpha', 1);\n }\n };\n}\n"],"names":[],"version":3,"file":"useColorAreaState.main.js.map"}
@@ -0,0 +1,119 @@
1
+ import {normalizeColor as $799cddbef784668f$export$4cde5df63f53f473, parseColor as $799cddbef784668f$export$6e865ea70d7724f} from "./Color.mjs";
2
+ import {useControlledState as $5ShDH$useControlledState, clamp as $5ShDH$clamp, snapValueToStep as $5ShDH$snapValueToStep} from "@react-stately/utils";
3
+ import {useRef as $5ShDH$useRef, useMemo as $5ShDH$useMemo, useState as $5ShDH$useState} from "react";
4
+
5
+ /*
6
+ * Copyright 2020 Adobe. All rights reserved.
7
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License. You may obtain a copy
9
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software distributed under
12
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ * OF ANY KIND, either express or implied. See the License for the specific language
14
+ * governing permissions and limitations under the License.
15
+ */
16
+
17
+
18
+ const $6e14a98a7f67141d$var$DEFAULT_COLOR = (0, $799cddbef784668f$export$6e865ea70d7724f)("#ffffff");
19
+ function $6e14a98a7f67141d$export$6df7f0e2cabc7eef(props) {
20
+ let { value: value, defaultValue: defaultValue, xChannel: xChannel, yChannel: yChannel, onChange: onChange, onChangeEnd: onChangeEnd } = props;
21
+ if (!value && !defaultValue) defaultValue = $6e14a98a7f67141d$var$DEFAULT_COLOR;
22
+ let [color, setColorState] = (0, $5ShDH$useControlledState)(value && (0, $799cddbef784668f$export$4cde5df63f53f473)(value), defaultValue && (0, $799cddbef784668f$export$4cde5df63f53f473)(defaultValue), onChange);
23
+ let valueRef = (0, $5ShDH$useRef)(color);
24
+ let setColor = (color)=>{
25
+ valueRef.current = color;
26
+ setColorState(color);
27
+ };
28
+ let channels = (0, $5ShDH$useMemo)(()=>color.getColorSpaceAxes({
29
+ xChannel: xChannel,
30
+ yChannel: yChannel
31
+ }), [
32
+ color,
33
+ xChannel,
34
+ yChannel
35
+ ]);
36
+ let xChannelRange = color.getChannelRange(channels.xChannel);
37
+ let yChannelRange = color.getChannelRange(channels.yChannel);
38
+ let { minValue: minValueX, maxValue: maxValueX, step: stepX, pageSize: pageSizeX } = xChannelRange;
39
+ let { minValue: minValueY, maxValue: maxValueY, step: stepY, pageSize: pageSizeY } = yChannelRange;
40
+ let [isDragging, setDragging] = (0, $5ShDH$useState)(false);
41
+ let isDraggingRef = (0, $5ShDH$useRef)(false);
42
+ let xValue = color.getChannelValue(channels.xChannel);
43
+ let yValue = color.getChannelValue(channels.yChannel);
44
+ let setXValue = (v)=>{
45
+ if (v === xValue) return;
46
+ let newColor = color.withChannelValue(channels.xChannel, v);
47
+ setColor(newColor);
48
+ };
49
+ let setYValue = (v)=>{
50
+ if (v === yValue) return;
51
+ let newColor = color.withChannelValue(channels.yChannel, v);
52
+ setColor(newColor);
53
+ };
54
+ return {
55
+ channels: channels,
56
+ xChannelStep: stepX,
57
+ yChannelStep: stepY,
58
+ xChannelPageStep: pageSizeX,
59
+ yChannelPageStep: pageSizeY,
60
+ value: color,
61
+ setValue (value) {
62
+ setColor((0, $799cddbef784668f$export$4cde5df63f53f473)(value));
63
+ },
64
+ xValue: xValue,
65
+ setXValue: setXValue,
66
+ yValue: yValue,
67
+ setYValue: setYValue,
68
+ setColorFromPoint (x, y) {
69
+ let newXValue = minValueX + (0, $5ShDH$clamp)(x, 0, 1) * (maxValueX - minValueX);
70
+ let newYValue = minValueY + (1 - (0, $5ShDH$clamp)(y, 0, 1)) * (maxValueY - minValueY);
71
+ let newColor;
72
+ if (newXValue !== xValue) {
73
+ // Round new value to multiple of step, clamp value between min and max
74
+ newXValue = (0, $5ShDH$snapValueToStep)(newXValue, minValueX, maxValueX, stepX);
75
+ newColor = color.withChannelValue(channels.xChannel, newXValue);
76
+ }
77
+ if (newYValue !== yValue) {
78
+ // Round new value to multiple of step, clamp value between min and max
79
+ newYValue = (0, $5ShDH$snapValueToStep)(newYValue, minValueY, maxValueY, stepY);
80
+ newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);
81
+ }
82
+ if (newColor) setColor(newColor);
83
+ },
84
+ getThumbPosition () {
85
+ let x = (xValue - minValueX) / (maxValueX - minValueX);
86
+ let y = 1 - (yValue - minValueY) / (maxValueY - minValueY);
87
+ return {
88
+ x: x,
89
+ y: y
90
+ };
91
+ },
92
+ incrementX (stepSize) {
93
+ setXValue(xValue + stepSize > maxValueX ? maxValueX : (0, $5ShDH$snapValueToStep)(xValue + stepSize, minValueX, maxValueX, stepX));
94
+ },
95
+ incrementY (stepSize) {
96
+ setYValue(yValue + stepSize > maxValueY ? maxValueY : (0, $5ShDH$snapValueToStep)(yValue + stepSize, minValueY, maxValueY, stepY));
97
+ },
98
+ decrementX (stepSize) {
99
+ setXValue((0, $5ShDH$snapValueToStep)(xValue - stepSize, minValueX, maxValueX, stepX));
100
+ },
101
+ decrementY (stepSize) {
102
+ setYValue((0, $5ShDH$snapValueToStep)(yValue - stepSize, minValueY, maxValueY, stepY));
103
+ },
104
+ setDragging (isDragging) {
105
+ let wasDragging = isDraggingRef.current;
106
+ isDraggingRef.current = isDragging;
107
+ if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
108
+ setDragging(isDragging);
109
+ },
110
+ isDragging: isDragging,
111
+ getDisplayColor () {
112
+ return color.withChannelValue("alpha", 1);
113
+ }
114
+ };
115
+ }
116
+
117
+
118
+ export {$6e14a98a7f67141d$export$6df7f0e2cabc7eef as useColorAreaState};
119
+ //# sourceMappingURL=useColorAreaState.mjs.map
@@ -0,0 +1,119 @@
1
+ import {normalizeColor as $799cddbef784668f$export$4cde5df63f53f473, parseColor as $799cddbef784668f$export$6e865ea70d7724f} from "./Color.module.js";
2
+ import {useControlledState as $5ShDH$useControlledState, clamp as $5ShDH$clamp, snapValueToStep as $5ShDH$snapValueToStep} from "@react-stately/utils";
3
+ import {useRef as $5ShDH$useRef, useMemo as $5ShDH$useMemo, useState as $5ShDH$useState} from "react";
4
+
5
+ /*
6
+ * Copyright 2020 Adobe. All rights reserved.
7
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License. You may obtain a copy
9
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software distributed under
12
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ * OF ANY KIND, either express or implied. See the License for the specific language
14
+ * governing permissions and limitations under the License.
15
+ */
16
+
17
+
18
+ const $6e14a98a7f67141d$var$DEFAULT_COLOR = (0, $799cddbef784668f$export$6e865ea70d7724f)("#ffffff");
19
+ function $6e14a98a7f67141d$export$6df7f0e2cabc7eef(props) {
20
+ let { value: value, defaultValue: defaultValue, xChannel: xChannel, yChannel: yChannel, onChange: onChange, onChangeEnd: onChangeEnd } = props;
21
+ if (!value && !defaultValue) defaultValue = $6e14a98a7f67141d$var$DEFAULT_COLOR;
22
+ let [color, setColorState] = (0, $5ShDH$useControlledState)(value && (0, $799cddbef784668f$export$4cde5df63f53f473)(value), defaultValue && (0, $799cddbef784668f$export$4cde5df63f53f473)(defaultValue), onChange);
23
+ let valueRef = (0, $5ShDH$useRef)(color);
24
+ let setColor = (color)=>{
25
+ valueRef.current = color;
26
+ setColorState(color);
27
+ };
28
+ let channels = (0, $5ShDH$useMemo)(()=>color.getColorSpaceAxes({
29
+ xChannel: xChannel,
30
+ yChannel: yChannel
31
+ }), [
32
+ color,
33
+ xChannel,
34
+ yChannel
35
+ ]);
36
+ let xChannelRange = color.getChannelRange(channels.xChannel);
37
+ let yChannelRange = color.getChannelRange(channels.yChannel);
38
+ let { minValue: minValueX, maxValue: maxValueX, step: stepX, pageSize: pageSizeX } = xChannelRange;
39
+ let { minValue: minValueY, maxValue: maxValueY, step: stepY, pageSize: pageSizeY } = yChannelRange;
40
+ let [isDragging, setDragging] = (0, $5ShDH$useState)(false);
41
+ let isDraggingRef = (0, $5ShDH$useRef)(false);
42
+ let xValue = color.getChannelValue(channels.xChannel);
43
+ let yValue = color.getChannelValue(channels.yChannel);
44
+ let setXValue = (v)=>{
45
+ if (v === xValue) return;
46
+ let newColor = color.withChannelValue(channels.xChannel, v);
47
+ setColor(newColor);
48
+ };
49
+ let setYValue = (v)=>{
50
+ if (v === yValue) return;
51
+ let newColor = color.withChannelValue(channels.yChannel, v);
52
+ setColor(newColor);
53
+ };
54
+ return {
55
+ channels: channels,
56
+ xChannelStep: stepX,
57
+ yChannelStep: stepY,
58
+ xChannelPageStep: pageSizeX,
59
+ yChannelPageStep: pageSizeY,
60
+ value: color,
61
+ setValue (value) {
62
+ setColor((0, $799cddbef784668f$export$4cde5df63f53f473)(value));
63
+ },
64
+ xValue: xValue,
65
+ setXValue: setXValue,
66
+ yValue: yValue,
67
+ setYValue: setYValue,
68
+ setColorFromPoint (x, y) {
69
+ let newXValue = minValueX + (0, $5ShDH$clamp)(x, 0, 1) * (maxValueX - minValueX);
70
+ let newYValue = minValueY + (1 - (0, $5ShDH$clamp)(y, 0, 1)) * (maxValueY - minValueY);
71
+ let newColor;
72
+ if (newXValue !== xValue) {
73
+ // Round new value to multiple of step, clamp value between min and max
74
+ newXValue = (0, $5ShDH$snapValueToStep)(newXValue, minValueX, maxValueX, stepX);
75
+ newColor = color.withChannelValue(channels.xChannel, newXValue);
76
+ }
77
+ if (newYValue !== yValue) {
78
+ // Round new value to multiple of step, clamp value between min and max
79
+ newYValue = (0, $5ShDH$snapValueToStep)(newYValue, minValueY, maxValueY, stepY);
80
+ newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);
81
+ }
82
+ if (newColor) setColor(newColor);
83
+ },
84
+ getThumbPosition () {
85
+ let x = (xValue - minValueX) / (maxValueX - minValueX);
86
+ let y = 1 - (yValue - minValueY) / (maxValueY - minValueY);
87
+ return {
88
+ x: x,
89
+ y: y
90
+ };
91
+ },
92
+ incrementX (stepSize) {
93
+ setXValue(xValue + stepSize > maxValueX ? maxValueX : (0, $5ShDH$snapValueToStep)(xValue + stepSize, minValueX, maxValueX, stepX));
94
+ },
95
+ incrementY (stepSize) {
96
+ setYValue(yValue + stepSize > maxValueY ? maxValueY : (0, $5ShDH$snapValueToStep)(yValue + stepSize, minValueY, maxValueY, stepY));
97
+ },
98
+ decrementX (stepSize) {
99
+ setXValue((0, $5ShDH$snapValueToStep)(xValue - stepSize, minValueX, maxValueX, stepX));
100
+ },
101
+ decrementY (stepSize) {
102
+ setYValue((0, $5ShDH$snapValueToStep)(yValue - stepSize, minValueY, maxValueY, stepY));
103
+ },
104
+ setDragging (isDragging) {
105
+ let wasDragging = isDraggingRef.current;
106
+ isDraggingRef.current = isDragging;
107
+ if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
108
+ setDragging(isDragging);
109
+ },
110
+ isDragging: isDragging,
111
+ getDisplayColor () {
112
+ return color.withChannelValue("alpha", 1);
113
+ }
114
+ };
115
+ }
116
+
117
+
118
+ export {$6e14a98a7f67141d$export$6df7f0e2cabc7eef as useColorAreaState};
119
+ //# sourceMappingURL=useColorAreaState.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA0DD,MAAM,sCAAgB,CAAA,GAAA,wCAAS,EAAE;AAK1B,SAAS,0CAAkB,KAAqB;IACrD,IAAI,SACF,KAAK,gBACL,YAAY,YACZ,QAAQ,YACR,QAAQ,YACR,QAAQ,eACR,WAAW,EACZ,GAAG;IAEJ,IAAI,CAAC,SAAS,CAAC,cACb,eAAe;IAGjB,IAAI,CAAC,OAAO,cAAc,GAAG,CAAA,GAAA,yBAAiB,EAAE,SAAS,CAAA,GAAA,yCAAa,EAAE,QAAQ,gBAAgB,CAAA,GAAA,yCAAa,EAAE,eAAe;IAC9H,IAAI,WAAW,CAAA,GAAA,aAAK,EAAE;IACtB,IAAI,WAAW,CAAC;QACd,SAAS,OAAO,GAAG;QACnB,cAAc;IACh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/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {clamp, snapValueToStep, useControlledState} from '@react-stately/utils';\nimport {Color, ColorAreaProps, ColorChannel} from '@react-types/color';\nimport {normalizeColor, parseColor} from './Color';\nimport {useMemo, useRef, useState} from 'react';\n\nexport interface ColorAreaState {\n /** The current color value displayed by the color area. */\n readonly value: Color,\n /** Sets the current color value. If a string is passed, it will be parsed to a Color. */\n setValue(value: string | Color): void,\n\n /** The current value of the horizontal axis channel displayed by the color area. */\n xValue: number,\n /** Sets the value for the horizontal axis channel displayed by the color area, and triggers `onChange`. */\n setXValue(value: number): void,\n\n /** The current value of the vertical axis channel displayed by the color area. */\n yValue: number,\n /** Sets the value for the vertical axis channel displayed by the color area, and triggers `onChange`. */\n setYValue(value: number): void,\n\n /** Sets the x and y channels of the current color value based on a percentage of the width and height of the color area, and triggers `onChange`. */\n setColorFromPoint(x: number, y: number): void,\n /** Returns the coordinates of the thumb relative to the upper left corner of the color area as a percentage. */\n getThumbPosition(): {x: number, y: number},\n\n /** Increments the value of the horizontal axis channel by the channel step or page amount. */\n incrementX(stepSize?: number): void,\n /** Decrements the value of the horizontal axis channel by the channel step or page amount. */\n decrementX(stepSize?: number): void,\n\n /** Increments the value of the vertical axis channel by the channel step or page amount. */\n incrementY(stepSize?: number): void,\n /** Decrements the value of the vertical axis channel by the channel step or page amount. */\n decrementY(stepSize?: number): void,\n\n /** Whether the color area is currently being dragged. */\n readonly isDragging: boolean,\n /** Sets whether the color area is being dragged. */\n setDragging(value: boolean): void,\n\n /** Returns the xChannel, yChannel and zChannel names based on the color value. */\n channels: {xChannel: ColorChannel, yChannel: ColorChannel, zChannel: ColorChannel},\n /** The step value of the xChannel, used when incrementing and decrementing. */\n xChannelStep: number,\n /** The step value of the yChannel, used when incrementing and decrementing. */\n yChannelStep: number,\n /** The page step value of the xChannel, used when incrementing and decrementing. */\n xChannelPageStep: number,\n /** The page step value of the yChannel, used when incrementing and decrementing. */\n yChannelPageStep: number,\n\n /** Returns the color that should be displayed in the color area thumb instead of `value`. */\n getDisplayColor(): Color\n}\n\nconst DEFAULT_COLOR = parseColor('#ffffff');\n/**\n * Provides state management for a color area component.\n * Color area allows users to adjust two channels of an HSL, HSB or RGB color value against a two-dimensional gradient background.\n */\nexport function useColorAreaState(props: ColorAreaProps): ColorAreaState {\n let {\n value,\n defaultValue,\n xChannel,\n yChannel,\n onChange,\n onChangeEnd\n } = props;\n\n if (!value && !defaultValue) {\n defaultValue = DEFAULT_COLOR;\n }\n\n let [color, setColorState] = useControlledState(value && normalizeColor(value), defaultValue && normalizeColor(defaultValue), onChange);\n let valueRef = useRef(color);\n let setColor = (color: Color) => {\n valueRef.current = color;\n setColorState(color);\n };\n\n let channels = useMemo(() =>\n color.getColorSpaceAxes({xChannel, yChannel}),\n [color, xChannel, yChannel]\n );\n\n let xChannelRange = color.getChannelRange(channels.xChannel);\n let yChannelRange = color.getChannelRange(channels.yChannel);\n let {minValue: minValueX, maxValue: maxValueX, step: stepX, pageSize: pageSizeX} = xChannelRange;\n let {minValue: minValueY, maxValue: maxValueY, step: stepY, pageSize: pageSizeY} = yChannelRange;\n\n let [isDragging, setDragging] = useState(false);\n let isDraggingRef = useRef(false);\n\n let xValue = color.getChannelValue(channels.xChannel);\n let yValue = color.getChannelValue(channels.yChannel);\n let setXValue = (v: number) => {\n if (v === xValue) {\n return;\n }\n let newColor = color.withChannelValue(channels.xChannel, v);\n setColor(newColor);\n };\n let setYValue = (v: number) => {\n if (v === yValue) {\n return;\n }\n let newColor = color.withChannelValue(channels.yChannel, v);\n setColor(newColor);\n };\n\n return {\n channels,\n xChannelStep: stepX,\n yChannelStep: stepY,\n xChannelPageStep: pageSizeX,\n yChannelPageStep: pageSizeY,\n value: color,\n setValue(value) {\n setColor(normalizeColor(value));\n },\n xValue,\n setXValue,\n yValue,\n setYValue,\n setColorFromPoint(x: number, y: number) {\n let newXValue = minValueX + clamp(x, 0, 1) * (maxValueX - minValueX);\n let newYValue = minValueY + (1 - clamp(y, 0, 1)) * (maxValueY - minValueY);\n let newColor:Color;\n if (newXValue !== xValue) {\n // Round new value to multiple of step, clamp value between min and max\n newXValue = snapValueToStep(newXValue, minValueX, maxValueX, stepX);\n newColor = color.withChannelValue(channels.xChannel, newXValue);\n }\n if (newYValue !== yValue) {\n // Round new value to multiple of step, clamp value between min and max\n newYValue = snapValueToStep(newYValue, minValueY, maxValueY, stepY);\n newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);\n }\n if (newColor) {\n setColor(newColor);\n }\n },\n getThumbPosition() {\n let x = (xValue - minValueX) / (maxValueX - minValueX);\n let y = 1 - (yValue - minValueY) / (maxValueY - minValueY);\n return {x, y};\n },\n incrementX(stepSize) {\n setXValue(xValue + stepSize > maxValueX ? maxValueX : snapValueToStep(xValue + stepSize, minValueX, maxValueX, stepX));\n },\n incrementY(stepSize) {\n setYValue(yValue + stepSize > maxValueY ? maxValueY : snapValueToStep(yValue + stepSize, minValueY, maxValueY, stepY));\n },\n decrementX(stepSize) {\n setXValue(snapValueToStep(xValue - stepSize, minValueX, maxValueX, stepX));\n },\n decrementY(stepSize) {\n setYValue(snapValueToStep(yValue - stepSize, minValueY, maxValueY, stepY));\n },\n setDragging(isDragging) {\n let wasDragging = isDraggingRef.current;\n isDraggingRef.current = isDragging;\n\n if (onChangeEnd && !isDragging && wasDragging) {\n onChangeEnd(valueRef.current);\n }\n\n setDragging(isDragging);\n },\n isDragging,\n getDisplayColor() {\n return color.withChannelValue('alpha', 1);\n }\n };\n}\n"],"names":[],"version":3,"file":"useColorAreaState.module.js.map"}