@instructure/ui-color-picker 11.6.0 → 11.6.1-snapshot-129

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 (354) hide show
  1. package/CHANGELOG.md +50 -308
  2. package/es/ColorContrast/{index.js → v1/index.js} +5 -5
  3. package/es/ColorContrast/v2/ColorContrast.test.js +229 -0
  4. package/es/ColorContrast/v2/index.js +196 -0
  5. package/es/ColorContrast/v2/props.js +26 -0
  6. package/es/ColorContrast/v2/styles.js +101 -0
  7. package/es/ColorIndicator/{index.js → v1/index.js} +1 -1
  8. package/es/ColorIndicator/v2/index.js +70 -0
  9. package/es/ColorIndicator/v2/props.js +26 -0
  10. package/es/ColorIndicator/v2/styles.js +68 -0
  11. package/es/ColorMixer/{ColorPalette → v1/ColorPalette}/index.js +2 -2
  12. package/es/ColorMixer/{RGBAInput → v1/RGBAInput}/index.js +2 -2
  13. package/es/ColorMixer/{Slider → v1/Slider}/index.js +2 -2
  14. package/es/ColorMixer/{index.js → v1/index.js} +1 -1
  15. package/es/ColorMixer/v2/ColorPalette/index.js +233 -0
  16. package/es/ColorMixer/v2/ColorPalette/props.js +26 -0
  17. package/es/ColorMixer/v2/ColorPalette/styles.js +81 -0
  18. package/es/ColorMixer/v2/RGBAInput/index.js +149 -0
  19. package/es/ColorMixer/v2/RGBAInput/props.js +26 -0
  20. package/es/ColorMixer/v2/RGBAInput/styles.js +63 -0
  21. package/es/ColorMixer/v2/Slider/index.js +193 -0
  22. package/es/ColorMixer/v2/Slider/props.js +26 -0
  23. package/es/ColorMixer/v2/Slider/styles.js +93 -0
  24. package/es/ColorMixer/v2/index.js +217 -0
  25. package/es/ColorMixer/v2/props.js +26 -0
  26. package/es/ColorMixer/v2/styles.js +48 -0
  27. package/es/ColorMixer/v2/utils/shallowCompare.js +31 -0
  28. package/es/ColorPicker/{index.js → v1/index.js} +9 -9
  29. package/es/ColorPicker/{styles.js → v1/styles.js} +2 -2
  30. package/es/ColorPicker/v2/ColorPicker.test.js +499 -0
  31. package/es/ColorPicker/v2/index.js +564 -0
  32. package/es/ColorPicker/v2/props.js +26 -0
  33. package/es/ColorPicker/v2/styles.js +126 -0
  34. package/es/ColorPreset/{index.js → v1/index.js} +10 -10
  35. package/es/ColorPreset/v2/index.js +289 -0
  36. package/es/ColorPreset/v2/props.js +26 -0
  37. package/es/ColorPreset/v2/styles.js +107 -0
  38. package/es/exports/a.js +28 -0
  39. package/es/exports/b.js +28 -0
  40. package/lib/ColorContrast/{index.js → v1/index.js} +10 -10
  41. package/lib/ColorContrast/v2/ColorContrast.test.js +231 -0
  42. package/lib/ColorContrast/v2/index.js +202 -0
  43. package/lib/ColorContrast/v2/props.js +31 -0
  44. package/lib/ColorContrast/v2/styles.js +107 -0
  45. package/lib/ColorIndicator/{index.js → v1/index.js} +1 -1
  46. package/lib/ColorIndicator/v2/index.js +75 -0
  47. package/lib/ColorIndicator/v2/props.js +31 -0
  48. package/lib/ColorIndicator/v2/styles.js +75 -0
  49. package/lib/ColorMixer/{ColorPalette → v1/ColorPalette}/index.js +3 -3
  50. package/lib/ColorMixer/v1/RGBAInput/index.js +156 -0
  51. package/lib/ColorMixer/{Slider → v1/Slider}/index.js +3 -3
  52. package/lib/ColorMixer/v1/index.js +222 -0
  53. package/lib/ColorMixer/v2/ColorPalette/index.js +239 -0
  54. package/lib/ColorMixer/v2/ColorPalette/props.js +31 -0
  55. package/lib/ColorMixer/v2/ColorPalette/styles.js +86 -0
  56. package/lib/ColorMixer/{RGBAInput → v2/RGBAInput}/index.js +6 -7
  57. package/lib/ColorMixer/v2/RGBAInput/props.js +31 -0
  58. package/lib/ColorMixer/v2/RGBAInput/styles.js +69 -0
  59. package/lib/ColorMixer/v2/Slider/index.js +199 -0
  60. package/lib/ColorMixer/v2/Slider/props.js +31 -0
  61. package/lib/ColorMixer/v2/Slider/styles.js +99 -0
  62. package/lib/ColorMixer/{index.js → v2/index.js} +1 -1
  63. package/lib/ColorMixer/v2/props.js +31 -0
  64. package/lib/ColorMixer/v2/styles.js +54 -0
  65. package/lib/ColorMixer/v2/utils/shallowCompare.js +37 -0
  66. package/lib/ColorPicker/{index.js → v1/index.js} +25 -26
  67. package/lib/ColorPicker/{styles.js → v1/styles.js} +1 -1
  68. package/lib/ColorPicker/v2/ColorPicker.test.js +501 -0
  69. package/lib/ColorPicker/v2/index.js +570 -0
  70. package/lib/ColorPicker/v2/props.js +31 -0
  71. package/lib/ColorPicker/v2/styles.js +132 -0
  72. package/lib/ColorPreset/{index.js → v1/index.js} +26 -27
  73. package/lib/ColorPreset/v2/index.js +294 -0
  74. package/lib/ColorPreset/v2/props.js +31 -0
  75. package/lib/ColorPreset/v2/styles.js +113 -0
  76. package/lib/{index.js → exports/a.js} +10 -10
  77. package/lib/exports/b.js +40 -0
  78. package/package.json +53 -31
  79. package/src/ColorContrast/{index.tsx → v1/index.tsx} +5 -5
  80. package/src/ColorContrast/v2/ColorContrast.test.tsx +263 -0
  81. package/src/ColorContrast/v2/README.md +104 -0
  82. package/src/ColorContrast/v2/index.tsx +236 -0
  83. package/src/ColorContrast/v2/props.ts +181 -0
  84. package/src/ColorContrast/v2/styles.ts +108 -0
  85. package/src/ColorIndicator/{index.tsx → v1/index.tsx} +1 -1
  86. package/src/ColorIndicator/v2/README.md +76 -0
  87. package/src/ColorIndicator/v2/index.tsx +84 -0
  88. package/src/ColorIndicator/v2/props.ts +58 -0
  89. package/src/ColorIndicator/v2/styles.ts +89 -0
  90. package/src/ColorMixer/{ColorPalette → v1/ColorPalette}/index.tsx +3 -3
  91. package/src/ColorMixer/{RGBAInput → v1/RGBAInput}/index.tsx +2 -2
  92. package/src/ColorMixer/{Slider → v1/Slider}/index.tsx +3 -3
  93. package/src/ColorMixer/v1/index.tsx +218 -0
  94. package/src/ColorMixer/v2/ColorPalette/index.tsx +263 -0
  95. package/src/ColorMixer/v2/ColorPalette/props.ts +75 -0
  96. package/src/ColorMixer/v2/ColorPalette/styles.ts +96 -0
  97. package/src/ColorMixer/v2/README.md +76 -0
  98. package/src/ColorMixer/v2/RGBAInput/index.tsx +169 -0
  99. package/src/ColorMixer/v2/RGBAInput/props.ts +77 -0
  100. package/src/ColorMixer/v2/RGBAInput/styles.ts +70 -0
  101. package/src/ColorMixer/v2/Slider/index.tsx +245 -0
  102. package/src/ColorMixer/v2/Slider/props.ts +77 -0
  103. package/src/ColorMixer/v2/Slider/styles.ts +115 -0
  104. package/src/ColorMixer/{index.tsx → v2/index.tsx} +1 -1
  105. package/src/ColorMixer/v2/props.ts +116 -0
  106. package/src/ColorMixer/v2/styles.ts +51 -0
  107. package/src/ColorMixer/v2/utils/shallowCompare.ts +35 -0
  108. package/src/ColorPicker/{README.md → v1/README.md} +6 -6
  109. package/src/ColorPicker/{index.tsx → v1/index.tsx} +13 -10
  110. package/src/ColorPicker/v1/props.ts +304 -0
  111. package/src/ColorPicker/{styles.ts → v1/styles.ts} +2 -2
  112. package/src/ColorPicker/v2/ColorPicker.test.tsx +618 -0
  113. package/src/ColorPicker/v2/README.md +410 -0
  114. package/src/ColorPicker/v2/index.tsx +742 -0
  115. package/src/ColorPicker/v2/styles.ts +141 -0
  116. package/src/ColorPreset/{index.tsx → v1/index.tsx} +11 -11
  117. package/src/ColorPreset/v2/README.md +112 -0
  118. package/src/ColorPreset/v2/index.tsx +370 -0
  119. package/src/ColorPreset/v2/props.ts +160 -0
  120. package/src/ColorPreset/v2/styles.ts +112 -0
  121. package/src/exports/a.ts +34 -0
  122. package/src/exports/b.ts +34 -0
  123. package/tsconfig.build.tsbuildinfo +1 -1
  124. package/types/ColorContrast/v1/index.d.ts.map +1 -0
  125. package/types/ColorContrast/v1/props.d.ts.map +1 -0
  126. package/types/ColorContrast/v1/styles.d.ts.map +1 -0
  127. package/types/ColorContrast/v1/theme.d.ts.map +1 -0
  128. package/types/ColorContrast/v2/ColorContrast.test.d.ts +2 -0
  129. package/types/ColorContrast/v2/ColorContrast.test.d.ts.map +1 -0
  130. package/types/ColorContrast/v2/index.d.ts +56 -0
  131. package/types/ColorContrast/v2/index.d.ts.map +1 -0
  132. package/types/ColorContrast/v2/props.d.ts +115 -0
  133. package/types/ColorContrast/v2/props.d.ts.map +1 -0
  134. package/types/ColorContrast/v2/styles.d.ts +79 -0
  135. package/types/ColorContrast/v2/styles.d.ts.map +1 -0
  136. package/types/ColorIndicator/v1/index.d.ts.map +1 -0
  137. package/types/ColorIndicator/v1/props.d.ts.map +1 -0
  138. package/types/ColorIndicator/v1/styles.d.ts.map +1 -0
  139. package/types/ColorIndicator/v1/theme.d.ts.map +1 -0
  140. package/types/ColorIndicator/v2/index.d.ts +26 -0
  141. package/types/ColorIndicator/v2/index.d.ts.map +1 -0
  142. package/types/ColorIndicator/v2/props.d.ts +24 -0
  143. package/types/ColorIndicator/v2/props.d.ts.map +1 -0
  144. package/types/ColorIndicator/v2/styles.d.ts +15 -0
  145. package/types/ColorIndicator/v2/styles.d.ts.map +1 -0
  146. package/types/ColorMixer/{ColorPalette → v1/ColorPalette}/index.d.ts +1 -1
  147. package/types/ColorMixer/v1/ColorPalette/index.d.ts.map +1 -0
  148. package/types/ColorMixer/v1/ColorPalette/props.d.ts.map +1 -0
  149. package/types/ColorMixer/v1/ColorPalette/styles.d.ts.map +1 -0
  150. package/types/ColorMixer/v1/ColorPalette/theme.d.ts.map +1 -0
  151. package/types/ColorMixer/v1/RGBAInput/index.d.ts.map +1 -0
  152. package/types/ColorMixer/v1/RGBAInput/props.d.ts.map +1 -0
  153. package/types/ColorMixer/v1/RGBAInput/styles.d.ts.map +1 -0
  154. package/types/ColorMixer/v1/RGBAInput/theme.d.ts.map +1 -0
  155. package/types/ColorMixer/{Slider → v1/Slider}/index.d.ts +1 -1
  156. package/types/ColorMixer/v1/Slider/index.d.ts.map +1 -0
  157. package/types/ColorMixer/v1/Slider/props.d.ts.map +1 -0
  158. package/types/ColorMixer/v1/Slider/styles.d.ts.map +1 -0
  159. package/types/ColorMixer/v1/Slider/theme.d.ts.map +1 -0
  160. package/types/ColorMixer/v1/index.d.ts.map +1 -0
  161. package/types/ColorMixer/v1/props.d.ts.map +1 -0
  162. package/types/ColorMixer/v1/styles.d.ts.map +1 -0
  163. package/types/ColorMixer/v1/utils/shallowCompare.d.ts.map +1 -0
  164. package/types/ColorMixer/v2/ColorPalette/index.d.ts +58 -0
  165. package/types/ColorMixer/v2/ColorPalette/index.d.ts.map +1 -0
  166. package/types/ColorMixer/v2/ColorPalette/props.d.ts +29 -0
  167. package/types/ColorMixer/v2/ColorPalette/props.d.ts.map +1 -0
  168. package/types/ColorMixer/v2/ColorPalette/styles.d.ts +15 -0
  169. package/types/ColorMixer/v2/ColorPalette/styles.d.ts.map +1 -0
  170. package/types/ColorMixer/v2/RGBAInput/index.d.ts +35 -0
  171. package/types/ColorMixer/v2/RGBAInput/index.d.ts.map +1 -0
  172. package/types/ColorMixer/v2/RGBAInput/props.d.ts +27 -0
  173. package/types/ColorMixer/v2/RGBAInput/props.d.ts.map +1 -0
  174. package/types/ColorMixer/v2/RGBAInput/styles.d.ts +15 -0
  175. package/types/ColorMixer/v2/RGBAInput/styles.d.ts.map +1 -0
  176. package/types/ColorMixer/v2/Slider/index.d.ts +49 -0
  177. package/types/ColorMixer/v2/Slider/index.d.ts.map +1 -0
  178. package/types/ColorMixer/v2/Slider/props.d.ts +25 -0
  179. package/types/ColorMixer/v2/Slider/props.d.ts.map +1 -0
  180. package/types/ColorMixer/v2/Slider/styles.d.ts +15 -0
  181. package/types/ColorMixer/v2/Slider/styles.d.ts.map +1 -0
  182. package/types/ColorMixer/v2/index.d.ts +43 -0
  183. package/types/ColorMixer/v2/index.d.ts.map +1 -0
  184. package/types/ColorMixer/v2/props.d.ts +69 -0
  185. package/types/ColorMixer/v2/props.d.ts.map +1 -0
  186. package/types/ColorMixer/v2/styles.d.ts +14 -0
  187. package/types/ColorMixer/v2/styles.d.ts.map +1 -0
  188. package/types/ColorMixer/v2/utils/shallowCompare.d.ts +3 -0
  189. package/types/ColorMixer/v2/utils/shallowCompare.d.ts.map +1 -0
  190. package/types/ColorPicker/{index.d.ts → v1/index.d.ts} +1 -1
  191. package/types/ColorPicker/v1/index.d.ts.map +1 -0
  192. package/types/ColorPicker/v1/props.d.ts +187 -0
  193. package/types/ColorPicker/v1/props.d.ts.map +1 -0
  194. package/types/ColorPicker/v1/styles.d.ts.map +1 -0
  195. package/types/ColorPicker/v1/theme.d.ts.map +1 -0
  196. package/types/ColorPicker/v2/ColorPicker.test.d.ts +2 -0
  197. package/types/ColorPicker/v2/ColorPicker.test.d.ts.map +1 -0
  198. package/types/ColorPicker/v2/index.d.ts +117 -0
  199. package/types/ColorPicker/v2/index.d.ts.map +1 -0
  200. package/types/ColorPicker/v2/props.d.ts.map +1 -0
  201. package/types/ColorPicker/v2/styles.d.ts +17 -0
  202. package/types/ColorPicker/v2/styles.d.ts.map +1 -0
  203. package/types/ColorPreset/{index.d.ts → v1/index.d.ts} +1 -1
  204. package/types/ColorPreset/v1/index.d.ts.map +1 -0
  205. package/types/ColorPreset/v1/props.d.ts.map +1 -0
  206. package/types/ColorPreset/v1/styles.d.ts.map +1 -0
  207. package/types/ColorPreset/v1/theme.d.ts.map +1 -0
  208. package/types/ColorPreset/v2/index.d.ts +71 -0
  209. package/types/ColorPreset/v2/index.d.ts.map +1 -0
  210. package/types/ColorPreset/v2/props.d.ts +98 -0
  211. package/types/ColorPreset/v2/props.d.ts.map +1 -0
  212. package/types/ColorPreset/v2/styles.d.ts +80 -0
  213. package/types/ColorPreset/v2/styles.d.ts.map +1 -0
  214. package/types/exports/a.d.ts +11 -0
  215. package/types/exports/a.d.ts.map +1 -0
  216. package/types/exports/b.d.ts +11 -0
  217. package/types/exports/b.d.ts.map +1 -0
  218. package/es/index.js +0 -28
  219. package/src/index.ts +0 -34
  220. package/types/ColorContrast/index.d.ts.map +0 -1
  221. package/types/ColorContrast/props.d.ts.map +0 -1
  222. package/types/ColorContrast/styles.d.ts.map +0 -1
  223. package/types/ColorContrast/theme.d.ts.map +0 -1
  224. package/types/ColorIndicator/index.d.ts.map +0 -1
  225. package/types/ColorIndicator/props.d.ts.map +0 -1
  226. package/types/ColorIndicator/styles.d.ts.map +0 -1
  227. package/types/ColorIndicator/theme.d.ts.map +0 -1
  228. package/types/ColorMixer/ColorPalette/index.d.ts.map +0 -1
  229. package/types/ColorMixer/ColorPalette/props.d.ts.map +0 -1
  230. package/types/ColorMixer/ColorPalette/styles.d.ts.map +0 -1
  231. package/types/ColorMixer/ColorPalette/theme.d.ts.map +0 -1
  232. package/types/ColorMixer/RGBAInput/index.d.ts.map +0 -1
  233. package/types/ColorMixer/RGBAInput/props.d.ts.map +0 -1
  234. package/types/ColorMixer/RGBAInput/styles.d.ts.map +0 -1
  235. package/types/ColorMixer/RGBAInput/theme.d.ts.map +0 -1
  236. package/types/ColorMixer/Slider/index.d.ts.map +0 -1
  237. package/types/ColorMixer/Slider/props.d.ts.map +0 -1
  238. package/types/ColorMixer/Slider/styles.d.ts.map +0 -1
  239. package/types/ColorMixer/Slider/theme.d.ts.map +0 -1
  240. package/types/ColorMixer/index.d.ts.map +0 -1
  241. package/types/ColorMixer/props.d.ts.map +0 -1
  242. package/types/ColorMixer/styles.d.ts.map +0 -1
  243. package/types/ColorMixer/utils/shallowCompare.d.ts.map +0 -1
  244. package/types/ColorPicker/index.d.ts.map +0 -1
  245. package/types/ColorPicker/props.d.ts.map +0 -1
  246. package/types/ColorPicker/styles.d.ts.map +0 -1
  247. package/types/ColorPicker/theme.d.ts.map +0 -1
  248. package/types/ColorPreset/index.d.ts.map +0 -1
  249. package/types/ColorPreset/props.d.ts.map +0 -1
  250. package/types/ColorPreset/styles.d.ts.map +0 -1
  251. package/types/ColorPreset/theme.d.ts.map +0 -1
  252. package/types/index.d.ts +0 -11
  253. package/types/index.d.ts.map +0 -1
  254. /package/es/ColorContrast/{props.js → v1/props.js} +0 -0
  255. /package/es/ColorContrast/{styles.js → v1/styles.js} +0 -0
  256. /package/es/ColorContrast/{theme.js → v1/theme.js} +0 -0
  257. /package/es/ColorIndicator/{props.js → v1/props.js} +0 -0
  258. /package/es/ColorIndicator/{styles.js → v1/styles.js} +0 -0
  259. /package/es/ColorIndicator/{theme.js → v1/theme.js} +0 -0
  260. /package/es/ColorMixer/{ColorPalette → v1/ColorPalette}/props.js +0 -0
  261. /package/es/ColorMixer/{ColorPalette → v1/ColorPalette}/styles.js +0 -0
  262. /package/es/ColorMixer/{ColorPalette → v1/ColorPalette}/theme.js +0 -0
  263. /package/es/ColorMixer/{RGBAInput → v1/RGBAInput}/props.js +0 -0
  264. /package/es/ColorMixer/{RGBAInput → v1/RGBAInput}/styles.js +0 -0
  265. /package/es/ColorMixer/{RGBAInput → v1/RGBAInput}/theme.js +0 -0
  266. /package/es/ColorMixer/{Slider → v1/Slider}/props.js +0 -0
  267. /package/es/ColorMixer/{Slider → v1/Slider}/styles.js +0 -0
  268. /package/es/ColorMixer/{Slider → v1/Slider}/theme.js +0 -0
  269. /package/es/ColorMixer/{props.js → v1/props.js} +0 -0
  270. /package/es/ColorMixer/{styles.js → v1/styles.js} +0 -0
  271. /package/es/ColorMixer/{utils → v1/utils}/shallowCompare.js +0 -0
  272. /package/es/ColorPicker/{props.js → v1/props.js} +0 -0
  273. /package/es/ColorPicker/{theme.js → v1/theme.js} +0 -0
  274. /package/es/ColorPreset/{props.js → v1/props.js} +0 -0
  275. /package/es/ColorPreset/{styles.js → v1/styles.js} +0 -0
  276. /package/es/ColorPreset/{theme.js → v1/theme.js} +0 -0
  277. /package/lib/ColorContrast/{props.js → v1/props.js} +0 -0
  278. /package/lib/ColorContrast/{styles.js → v1/styles.js} +0 -0
  279. /package/lib/ColorContrast/{theme.js → v1/theme.js} +0 -0
  280. /package/lib/ColorIndicator/{props.js → v1/props.js} +0 -0
  281. /package/lib/ColorIndicator/{styles.js → v1/styles.js} +0 -0
  282. /package/lib/ColorIndicator/{theme.js → v1/theme.js} +0 -0
  283. /package/lib/ColorMixer/{ColorPalette → v1/ColorPalette}/props.js +0 -0
  284. /package/lib/ColorMixer/{ColorPalette → v1/ColorPalette}/styles.js +0 -0
  285. /package/lib/ColorMixer/{ColorPalette → v1/ColorPalette}/theme.js +0 -0
  286. /package/lib/ColorMixer/{RGBAInput → v1/RGBAInput}/props.js +0 -0
  287. /package/lib/ColorMixer/{RGBAInput → v1/RGBAInput}/styles.js +0 -0
  288. /package/lib/ColorMixer/{RGBAInput → v1/RGBAInput}/theme.js +0 -0
  289. /package/lib/ColorMixer/{Slider → v1/Slider}/props.js +0 -0
  290. /package/lib/ColorMixer/{Slider → v1/Slider}/styles.js +0 -0
  291. /package/lib/ColorMixer/{Slider → v1/Slider}/theme.js +0 -0
  292. /package/lib/ColorMixer/{props.js → v1/props.js} +0 -0
  293. /package/lib/ColorMixer/{styles.js → v1/styles.js} +0 -0
  294. /package/lib/ColorMixer/{utils → v1/utils}/shallowCompare.js +0 -0
  295. /package/lib/ColorPicker/{props.js → v1/props.js} +0 -0
  296. /package/lib/ColorPicker/{theme.js → v1/theme.js} +0 -0
  297. /package/lib/ColorPreset/{props.js → v1/props.js} +0 -0
  298. /package/lib/ColorPreset/{styles.js → v1/styles.js} +0 -0
  299. /package/lib/ColorPreset/{theme.js → v1/theme.js} +0 -0
  300. /package/src/ColorContrast/{README.md → v1/README.md} +0 -0
  301. /package/src/ColorContrast/{props.ts → v1/props.ts} +0 -0
  302. /package/src/ColorContrast/{styles.ts → v1/styles.ts} +0 -0
  303. /package/src/ColorContrast/{theme.ts → v1/theme.ts} +0 -0
  304. /package/src/ColorIndicator/{README.md → v1/README.md} +0 -0
  305. /package/src/ColorIndicator/{props.ts → v1/props.ts} +0 -0
  306. /package/src/ColorIndicator/{styles.ts → v1/styles.ts} +0 -0
  307. /package/src/ColorIndicator/{theme.ts → v1/theme.ts} +0 -0
  308. /package/src/ColorMixer/{ColorPalette → v1/ColorPalette}/props.ts +0 -0
  309. /package/src/ColorMixer/{ColorPalette → v1/ColorPalette}/styles.ts +0 -0
  310. /package/src/ColorMixer/{ColorPalette → v1/ColorPalette}/theme.ts +0 -0
  311. /package/src/ColorMixer/{README.md → v1/README.md} +0 -0
  312. /package/src/ColorMixer/{RGBAInput → v1/RGBAInput}/props.ts +0 -0
  313. /package/src/ColorMixer/{RGBAInput → v1/RGBAInput}/styles.ts +0 -0
  314. /package/src/ColorMixer/{RGBAInput → v1/RGBAInput}/theme.ts +0 -0
  315. /package/src/ColorMixer/{Slider → v1/Slider}/props.ts +0 -0
  316. /package/src/ColorMixer/{Slider → v1/Slider}/styles.ts +0 -0
  317. /package/src/ColorMixer/{Slider → v1/Slider}/theme.ts +0 -0
  318. /package/src/ColorMixer/{props.ts → v1/props.ts} +0 -0
  319. /package/src/ColorMixer/{styles.ts → v1/styles.ts} +0 -0
  320. /package/src/ColorMixer/{utils → v1/utils}/shallowCompare.ts +0 -0
  321. /package/src/ColorPicker/{theme.ts → v1/theme.ts} +0 -0
  322. /package/src/ColorPicker/{props.ts → v2/props.ts} +0 -0
  323. /package/src/ColorPreset/{README.md → v1/README.md} +0 -0
  324. /package/src/ColorPreset/{props.ts → v1/props.ts} +0 -0
  325. /package/src/ColorPreset/{styles.ts → v1/styles.ts} +0 -0
  326. /package/src/ColorPreset/{theme.ts → v1/theme.ts} +0 -0
  327. /package/types/ColorContrast/{index.d.ts → v1/index.d.ts} +0 -0
  328. /package/types/ColorContrast/{props.d.ts → v1/props.d.ts} +0 -0
  329. /package/types/ColorContrast/{styles.d.ts → v1/styles.d.ts} +0 -0
  330. /package/types/ColorContrast/{theme.d.ts → v1/theme.d.ts} +0 -0
  331. /package/types/ColorIndicator/{index.d.ts → v1/index.d.ts} +0 -0
  332. /package/types/ColorIndicator/{props.d.ts → v1/props.d.ts} +0 -0
  333. /package/types/ColorIndicator/{styles.d.ts → v1/styles.d.ts} +0 -0
  334. /package/types/ColorIndicator/{theme.d.ts → v1/theme.d.ts} +0 -0
  335. /package/types/ColorMixer/{ColorPalette → v1/ColorPalette}/props.d.ts +0 -0
  336. /package/types/ColorMixer/{ColorPalette → v1/ColorPalette}/styles.d.ts +0 -0
  337. /package/types/ColorMixer/{ColorPalette → v1/ColorPalette}/theme.d.ts +0 -0
  338. /package/types/ColorMixer/{RGBAInput → v1/RGBAInput}/index.d.ts +0 -0
  339. /package/types/ColorMixer/{RGBAInput → v1/RGBAInput}/props.d.ts +0 -0
  340. /package/types/ColorMixer/{RGBAInput → v1/RGBAInput}/styles.d.ts +0 -0
  341. /package/types/ColorMixer/{RGBAInput → v1/RGBAInput}/theme.d.ts +0 -0
  342. /package/types/ColorMixer/{Slider → v1/Slider}/props.d.ts +0 -0
  343. /package/types/ColorMixer/{Slider → v1/Slider}/styles.d.ts +0 -0
  344. /package/types/ColorMixer/{Slider → v1/Slider}/theme.d.ts +0 -0
  345. /package/types/ColorMixer/{index.d.ts → v1/index.d.ts} +0 -0
  346. /package/types/ColorMixer/{props.d.ts → v1/props.d.ts} +0 -0
  347. /package/types/ColorMixer/{styles.d.ts → v1/styles.d.ts} +0 -0
  348. /package/types/ColorMixer/{utils → v1/utils}/shallowCompare.d.ts +0 -0
  349. /package/types/ColorPicker/{styles.d.ts → v1/styles.d.ts} +0 -0
  350. /package/types/ColorPicker/{theme.d.ts → v1/theme.d.ts} +0 -0
  351. /package/types/ColorPicker/{props.d.ts → v2/props.d.ts} +0 -0
  352. /package/types/ColorPreset/{props.d.ts → v1/props.d.ts} +0 -0
  353. /package/types/ColorPreset/{styles.d.ts → v1/styles.d.ts} +0 -0
  354. /package/types/ColorPreset/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,229 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import { render, screen } from '@testing-library/react';
26
+ import { vi } from 'vitest';
27
+ import '@testing-library/jest-dom';
28
+ import { runAxeCheck } from '@instructure/ui-axe-check';
29
+ import { contrast } from '@instructure/ui-color-utils';
30
+ import { ColorContrast } from "./index.js";
31
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
32
+ const testColors = {
33
+ firstColor: '#FF0000',
34
+ secondColor: '#FFFF00'
35
+ };
36
+ const testLabels = {
37
+ label: 'Color Contrast Ratio',
38
+ successLabel: 'PASS',
39
+ failureLabel: 'FAIL',
40
+ normalTextLabel: 'Normal text',
41
+ largeTextLabel: 'Large text',
42
+ graphicsTextLabel: 'Graphics text',
43
+ firstColorLabel: 'Background',
44
+ secondColorLabel: 'Foreground'
45
+ };
46
+ describe('<ColorContrast />', () => {
47
+ describe('elementRef prop', () => {
48
+ it('should provide ref', async () => {
49
+ const elementRef = vi.fn();
50
+ const _render = render(_jsx(ColorContrast, {
51
+ ...testColors,
52
+ ...testLabels,
53
+ elementRef: elementRef
54
+ })),
55
+ container = _render.container;
56
+ expect(elementRef).toHaveBeenCalledWith(container.firstChild);
57
+ });
58
+ });
59
+ describe('labels are displayed:', () => {
60
+ Object.entries(testLabels).forEach(([label, text]) => {
61
+ it(label, async () => {
62
+ const _render2 = render(_jsx(ColorContrast, {
63
+ ...testColors,
64
+ ...testLabels
65
+ })),
66
+ container = _render2.container;
67
+ expect(container).toHaveTextContent(text);
68
+ });
69
+ });
70
+ });
71
+ describe('labelLevel prop', () => {
72
+ it('should render label as div when labelLevel is not provided', async () => {
73
+ render(_jsx(ColorContrast, {
74
+ ...testColors,
75
+ ...testLabels
76
+ }));
77
+ const heading = screen.queryByRole('heading', {
78
+ name: testLabels.label
79
+ });
80
+ expect(heading).not.toBeInTheDocument();
81
+ const labelText = screen.getByText(testLabels.label);
82
+ expect(labelText).toBeInTheDocument();
83
+ expect(labelText.tagName.toLowerCase()).toBe('div');
84
+ });
85
+ it('should render label as Heading when labelLevel is provided', async () => {
86
+ render(_jsx(ColorContrast, {
87
+ ...testColors,
88
+ ...testLabels,
89
+ labelLevel: "h2"
90
+ }));
91
+ const heading = screen.getByRole('heading', {
92
+ name: testLabels.label,
93
+ level: 2
94
+ });
95
+ expect(heading).toBeInTheDocument();
96
+ });
97
+ it('should render correct heading level', async () => {
98
+ const _render3 = render(_jsx(ColorContrast, {
99
+ ...testColors,
100
+ ...testLabels,
101
+ labelLevel: "h3"
102
+ })),
103
+ rerender = _render3.rerender;
104
+ let heading = screen.getByRole('heading', {
105
+ name: testLabels.label,
106
+ level: 3
107
+ });
108
+ expect(heading).toBeInTheDocument();
109
+ rerender(_jsx(ColorContrast, {
110
+ ...testColors,
111
+ ...testLabels,
112
+ labelLevel: "h1"
113
+ }));
114
+ heading = screen.getByRole('heading', {
115
+ name: testLabels.label,
116
+ level: 1
117
+ });
118
+ expect(heading).toBeInTheDocument();
119
+ });
120
+ });
121
+ describe('should calculate contrast correctly', () => {
122
+ it('on opaque colors', async () => {
123
+ const color1 = '#fff';
124
+ const color2 = '#088';
125
+ const _render4 = render(_jsx(ColorContrast, {
126
+ ...testLabels,
127
+ firstColor: color1,
128
+ secondColor: color2
129
+ })),
130
+ container = _render4.container;
131
+ const contrastResult = contrast(color1, color2, 2);
132
+ expect(container).toHaveTextContent(contrastResult + ':1');
133
+ });
134
+ it('on transparent colors', async () => {
135
+ const color1 = '#fff';
136
+ const color2 = '#00888880';
137
+ const _render5 = render(_jsx(ColorContrast, {
138
+ ...testLabels,
139
+ firstColor: color1,
140
+ secondColor: color2
141
+ })),
142
+ container = _render5.container;
143
+
144
+ // this is the result of a complicated "blended color" calculation
145
+ // in the component, not simple `contrast()` check
146
+ expect(container).toHaveTextContent('2:1');
147
+ });
148
+ });
149
+ describe('withoutColorPreview prop', () => {
150
+ it('should be false by default, should display preview', async () => {
151
+ const _render6 = render(_jsx(ColorContrast, {
152
+ ...testColors,
153
+ ...testLabels
154
+ })),
155
+ container = _render6.container;
156
+ const preview = container.querySelector("[class$='-colorContrast__colorPreview']");
157
+ expect(preview).toBeInTheDocument();
158
+ });
159
+ it('should hide preview', async () => {
160
+ const _render7 = render(_jsx(ColorContrast, {
161
+ ...testColors,
162
+ ...testLabels,
163
+ withoutColorPreview: true
164
+ })),
165
+ container = _render7.container;
166
+ const preview = container.querySelector("[class$='-colorContrast__colorPreview']");
167
+ expect(preview).not.toBeInTheDocument();
168
+ });
169
+ });
170
+ describe('contrast check', () => {
171
+ const checkContrastPills = (title, firstColor, secondColor, expectedResult) => {
172
+ describe(title, () => {
173
+ it(`normal text should ${expectedResult.normal.toLowerCase()}`, async () => {
174
+ const _render8 = render(_jsx(ColorContrast, {
175
+ ...testLabels,
176
+ firstColor: firstColor,
177
+ secondColor: secondColor
178
+ })),
179
+ container = _render8.container;
180
+ expect(container).toHaveTextContent(expectedResult.normal);
181
+ });
182
+ it(`large text should ${expectedResult.large.toLowerCase()}`, async () => {
183
+ const _render9 = render(_jsx(ColorContrast, {
184
+ ...testLabels,
185
+ firstColor: firstColor,
186
+ secondColor: secondColor
187
+ })),
188
+ container = _render9.container;
189
+ expect(container).toHaveTextContent(expectedResult.large);
190
+ });
191
+ it(`graphics should ${expectedResult.graphics.toLowerCase()}`, async () => {
192
+ const _render0 = render(_jsx(ColorContrast, {
193
+ ...testLabels,
194
+ firstColor: firstColor,
195
+ secondColor: secondColor
196
+ })),
197
+ container = _render0.container;
198
+ expect(container).toHaveTextContent(expectedResult.graphics);
199
+ });
200
+ });
201
+ };
202
+ checkContrastPills('on x < 3 contrast', '#fff', '#aaa', {
203
+ normal: 'FAIL',
204
+ large: 'FAIL',
205
+ graphics: 'FAIL'
206
+ });
207
+ checkContrastPills('on small 3 < x < 4.5 contrast', '#fff', '#0c89bf', {
208
+ normal: 'FAIL',
209
+ large: 'PASS',
210
+ graphics: 'PASS'
211
+ });
212
+ checkContrastPills('on small x > 4.5 contrast', '#fff', '#333', {
213
+ normal: 'PASS',
214
+ large: 'PASS',
215
+ graphics: 'PASS'
216
+ });
217
+ });
218
+ describe('should be accessible', () => {
219
+ it('a11y', async () => {
220
+ const _render1 = render(_jsx(ColorContrast, {
221
+ ...testColors,
222
+ ...testLabels
223
+ })),
224
+ container = _render1.container;
225
+ const axeCheck = await runAxeCheck(container);
226
+ expect(axeCheck).toBe(true);
227
+ });
228
+ });
229
+ });
@@ -0,0 +1,196 @@
1
+ var _dec, _class, _ColorContrast;
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2015 - present Instructure, Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ import { Component } from 'react';
27
+ import { omitProps } from '@instructure/ui-react-utils';
28
+ import { error } from '@instructure/console';
29
+ import { contrastWithAlpha, validateContrast } from '@instructure/ui-color-utils';
30
+ import { withStyle } from '@instructure/emotion';
31
+ import { Text } from '@instructure/ui-text/latest';
32
+ import { Heading } from '@instructure/ui-heading/latest';
33
+ import { Pill } from '@instructure/ui-pill/latest';
34
+ import ColorIndicator from "../../ColorIndicator/v2/index.js";
35
+ import { allowedProps } from "./props.js";
36
+ import generateStyle from "./styles.js";
37
+ /**
38
+ ---
39
+ category: components
40
+ ---
41
+ **/
42
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
43
+ let ColorContrast = (_dec = withStyle(generateStyle), _dec(_class = (_ColorContrast = class ColorContrast extends Component {
44
+ constructor(props) {
45
+ super(props);
46
+ this.ref = null;
47
+ this.handleRef = el => {
48
+ const elementRef = this.props.elementRef;
49
+ this.ref = el;
50
+ if (typeof elementRef === 'function') {
51
+ elementRef(el);
52
+ }
53
+ };
54
+ this.renderStatus = (pass, description) => {
55
+ const _this$props = this.props,
56
+ successLabel = _this$props.successLabel,
57
+ failureLabel = _this$props.failureLabel,
58
+ styles = _this$props.styles;
59
+ return _jsxs("div", {
60
+ css: styles === null || styles === void 0 ? void 0 : styles.statusWrapper,
61
+ children: [_jsx("div", {
62
+ css: pass ? styles === null || styles === void 0 ? void 0 : styles.successDescription : styles === null || styles === void 0 ? void 0 : styles.failureDescription,
63
+ children: description
64
+ }), _jsx("div", {
65
+ css: styles === null || styles === void 0 ? void 0 : styles.statusIndicatorWrapper,
66
+ children: _jsx(Pill, {
67
+ color: pass ? 'success' : 'error',
68
+ children: pass ? successLabel : failureLabel
69
+ })
70
+ })]
71
+ });
72
+ };
73
+ this.renderColorIndicator = (color, label) => {
74
+ var _this$props$styles, _this$props$styles2, _this$props$styles3;
75
+ return _jsxs(_Fragment, {
76
+ children: [_jsx("div", {
77
+ children: _jsx("div", {
78
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.colorIndicator,
79
+ children: _jsx(ColorIndicator, {
80
+ color: color
81
+ })
82
+ })
83
+ }), _jsxs("div", {
84
+ children: [_jsx("div", {
85
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.colorIndicatorLabel,
86
+ children: label
87
+ }), _jsx("div", {
88
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.pickedColorHex,
89
+ children: color
90
+ })]
91
+ })]
92
+ });
93
+ };
94
+ this.state = {
95
+ contrast: 1,
96
+ isValidNormalText: false,
97
+ isValidLargeText: false,
98
+ isValidGraphicsText: false
99
+ };
100
+ }
101
+ componentDidMount() {
102
+ var _this$props$makeStyle, _this$props2;
103
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
104
+ this.calcState();
105
+ }
106
+ componentDidUpdate(prevProps) {
107
+ var _this$props$makeStyle2, _this$props3, _this$props4, _this$props5, _this$props6;
108
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
109
+ if ((prevProps === null || prevProps === void 0 ? void 0 : prevProps.firstColor) !== ((_this$props4 = this.props) === null || _this$props4 === void 0 ? void 0 : _this$props4.firstColor) || (prevProps === null || prevProps === void 0 ? void 0 : prevProps.secondColor) !== ((_this$props5 = this.props) === null || _this$props5 === void 0 ? void 0 : _this$props5.secondColor) || (prevProps === null || prevProps === void 0 ? void 0 : prevProps.validationLevel) !== ((_this$props6 = this.props) === null || _this$props6 === void 0 ? void 0 : _this$props6.validationLevel)) {
110
+ var _this$props7, _this$props7$onContra;
111
+ const newState = this.calcState();
112
+ (_this$props7 = this.props) === null || _this$props7 === void 0 ? void 0 : (_this$props7$onContra = _this$props7.onContrastChange) === null || _this$props7$onContra === void 0 ? void 0 : _this$props7$onContra.call(_this$props7, {
113
+ contrast: newState.contrast,
114
+ isValidNormalText: newState.isValidNormalText,
115
+ isValidLargeText: newState.isValidLargeText,
116
+ isValidGraphicsText: newState.isValidGraphicsText,
117
+ firstColor: this.props.firstColor,
118
+ secondColor: this.props.secondColor
119
+ });
120
+ }
121
+ }
122
+ renderPreview() {
123
+ const _this$props8 = this.props,
124
+ styles = _this$props8.styles,
125
+ withoutColorPreview = _this$props8.withoutColorPreview,
126
+ firstColor = _this$props8.firstColor,
127
+ secondColor = _this$props8.secondColor,
128
+ firstColorLabel = _this$props8.firstColorLabel,
129
+ secondColorLabel = _this$props8.secondColorLabel;
130
+ if (withoutColorPreview) {
131
+ return null;
132
+ }
133
+ if (!firstColorLabel || !secondColorLabel) {
134
+ error(false, 'When `withoutColorPreview` is not set to true, the properties `firstColorLabel` and `secondColorLabel` are required!');
135
+ }
136
+ return !withoutColorPreview && _jsxs("div", {
137
+ css: styles === null || styles === void 0 ? void 0 : styles.colorPreview,
138
+ children: [_jsx("div", {
139
+ css: styles === null || styles === void 0 ? void 0 : styles.firstColorPreview,
140
+ children: this.renderColorIndicator(firstColor, firstColorLabel || '')
141
+ }), _jsx("div", {
142
+ css: styles === null || styles === void 0 ? void 0 : styles.secondColorPreview,
143
+ children: this.renderColorIndicator(secondColor, secondColorLabel || '')
144
+ })]
145
+ });
146
+ }
147
+ calcState() {
148
+ const contrast = contrastWithAlpha(this.props.firstColor, this.props.secondColor);
149
+ const newState = {
150
+ contrast,
151
+ ...validateContrast(contrast, this.props.validationLevel)
152
+ };
153
+ this.setState(newState);
154
+ return newState;
155
+ }
156
+ render() {
157
+ const _this$props9 = this.props,
158
+ styles = _this$props9.styles,
159
+ label = _this$props9.label,
160
+ labelLevel = _this$props9.labelLevel,
161
+ normalTextLabel = _this$props9.normalTextLabel,
162
+ largeTextLabel = _this$props9.largeTextLabel,
163
+ graphicsTextLabel = _this$props9.graphicsTextLabel;
164
+ const _this$state = this.state,
165
+ contrast = _this$state.contrast,
166
+ isValidNormalText = _this$state.isValidNormalText,
167
+ isValidLargeText = _this$state.isValidLargeText,
168
+ isValidGraphicsText = _this$state.isValidGraphicsText;
169
+ return _jsxs("div", {
170
+ ...omitProps(this.props, ColorContrast.allowedProps),
171
+ ref: this.handleRef,
172
+ css: styles === null || styles === void 0 ? void 0 : styles.colorContrast,
173
+ "data-cid": "ColorContrast",
174
+ children: [_jsx("div", {
175
+ css: styles === null || styles === void 0 ? void 0 : styles.label,
176
+ children: labelLevel ? _jsx(Heading, {
177
+ as: labelLevel,
178
+ level: "reset",
179
+ children: label
180
+ }) : _jsx(Text, {
181
+ weight: "bold",
182
+ as: "div",
183
+ children: label
184
+ })
185
+ }), _jsxs(Text, {
186
+ size: "x-large",
187
+ children: [contrast, ":1"]
188
+ }), this.renderPreview(), this.renderStatus(isValidNormalText, normalTextLabel), this.renderStatus(isValidLargeText, largeTextLabel), this.renderStatus(isValidGraphicsText, graphicsTextLabel)]
189
+ });
190
+ }
191
+ }, _ColorContrast.displayName = "ColorContrast", _ColorContrast.allowedProps = allowedProps, _ColorContrast.componentId = 'ColorContrast', _ColorContrast.defaultProps = {
192
+ withoutColorPreview: false,
193
+ validationLevel: 'AA'
194
+ }, _ColorContrast)) || _class);
195
+ export { ColorContrast };
196
+ export default ColorContrast;
@@ -0,0 +1,26 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ const allowedProps = ['elementRef', 'failureLabel', 'firstColor', 'firstColorLabel', 'graphicsTextLabel', 'withoutColorPreview', 'label', 'labelLevel', 'largeTextLabel', 'normalTextLabel', 'secondColor', 'secondColorLabel', 'successLabel', 'onContrastChange', 'validationLevel'];
26
+ export { allowedProps };
@@ -0,0 +1,101 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * ---
27
+ * private: true
28
+ * ---
29
+ * Generates the style object from the theme and provided additional information
30
+ * @param {Object} componentTheme The theme variable object.
31
+ * @param {Object} props the props of the component, the style is applied to
32
+ * @param {Object} state the state of the component, the style is applied to
33
+ * @return {Object} The final style object, which will be used in the component
34
+ */
35
+ const generateStyle = (componentTheme, props) => {
36
+ const statusDescriptionStyle = pass => ({
37
+ label: pass ? 'colorContrast__successDescription' : 'colorContrast__failureDescription',
38
+ flex: 1,
39
+ color: pass ? componentTheme.successColor : componentTheme.failureColor
40
+ });
41
+ return {
42
+ colorContrast: {
43
+ label: 'colorContrast',
44
+ width: componentTheme.width,
45
+ fontFamily: componentTheme.fontFamily,
46
+ fontWeight: componentTheme.fontWeight,
47
+ lineHeight: componentTheme.lineHeight,
48
+ fontSize: componentTheme.fontSize
49
+ },
50
+ statusWrapper: {
51
+ label: 'colorContrast__statusWrapper',
52
+ width: '100%',
53
+ display: 'flex',
54
+ marginBottom: componentTheme.statusWrapperBottomMargin
55
+ },
56
+ successDescription: statusDescriptionStyle(true),
57
+ failureDescription: statusDescriptionStyle(false),
58
+ colorIndicator: {
59
+ marginInlineEnd: componentTheme.colorIndicatorRightMargin
60
+ },
61
+ statusIndicatorWrapper: {
62
+ label: 'colorContrast__statusIndicatorWrapper',
63
+ flex: 1,
64
+ display: 'flex',
65
+ flexDirection: 'row-reverse'
66
+ },
67
+ colorIndicatorLabel: {
68
+ label: 'colorContrast__colorIndicatorLabel',
69
+ wordBreak: 'break-all',
70
+ color: componentTheme.colorIndicatorLabelColor
71
+ },
72
+ pickedColorHex: {
73
+ label: 'colorContrast__pickedColorHex',
74
+ color: componentTheme.pickedHexColor
75
+ },
76
+ colorPreview: {
77
+ label: 'colorContrast__colorPreview',
78
+ display: 'flex',
79
+ width: '100%',
80
+ marginBottom: componentTheme.colorPreviewBottomMargin,
81
+ marginTop: componentTheme.colorPreviewTopMargin
82
+ },
83
+ firstColorPreview: {
84
+ label: 'colorContrast__firstColorPreview',
85
+ display: 'flex',
86
+ flex: 1
87
+ },
88
+ secondColorPreview: {
89
+ label: 'colorContrast__secondColorPreview',
90
+ display: 'flex'
91
+ },
92
+ label: {
93
+ label: 'colorContrast__label',
94
+ marginBottom: componentTheme.labelBottomMargin,
95
+ ...(props.labelLevel && {
96
+ fontWeight: 'bold'
97
+ })
98
+ }
99
+ };
100
+ };
101
+ export default generateStyle;
@@ -25,7 +25,7 @@ var _dec, _class, _ColorIndicator;
25
25
 
26
26
  import { Component } from 'react';
27
27
  import { omitProps } from '@instructure/ui-react-utils';
28
- import { withStyle } from '@instructure/emotion';
28
+ import { withStyleLegacy as withStyle } from '@instructure/emotion';
29
29
  import generateStyle from "./styles.js";
30
30
  import generateComponentTheme from "./theme.js";
31
31
  import { allowedProps } from "./props.js";
@@ -0,0 +1,70 @@
1
+ var _dec, _class, _ColorIndicator;
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2015 - present Instructure, Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ import { Component } from 'react';
27
+ import { omitProps } from '@instructure/ui-react-utils';
28
+ import { withStyle } from '@instructure/emotion';
29
+ import generateStyle from "./styles.js";
30
+ import { allowedProps } from "./props.js";
31
+ /**
32
+ ---
33
+ category: components
34
+ ---
35
+ **/
36
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
37
+ let ColorIndicator = (_dec = withStyle(generateStyle), _dec(_class = (_ColorIndicator = class ColorIndicator extends Component {
38
+ constructor(...args) {
39
+ super(...args);
40
+ this.ref = null;
41
+ this.handleRef = el => {
42
+ const elementRef = this.props.elementRef;
43
+ this.ref = el;
44
+ if (typeof elementRef === 'function') {
45
+ elementRef(el);
46
+ }
47
+ };
48
+ }
49
+ componentDidMount() {
50
+ var _this$props$makeStyle, _this$props;
51
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
52
+ }
53
+ componentDidUpdate() {
54
+ var _this$props$makeStyle2, _this$props2;
55
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
56
+ }
57
+ render() {
58
+ const styles = this.props.styles;
59
+ return _jsx("div", {
60
+ ...omitProps(this.props, ColorIndicator.allowedProps),
61
+ ref: this.handleRef,
62
+ css: styles === null || styles === void 0 ? void 0 : styles.colorIndicator,
63
+ "data-cid": "ColorIndicator"
64
+ });
65
+ }
66
+ }, _ColorIndicator.displayName = "ColorIndicator", _ColorIndicator.allowedProps = allowedProps, _ColorIndicator.componentId = 'ColorIndicator', _ColorIndicator.defaultProps = {
67
+ shape: 'circle'
68
+ }, _ColorIndicator)) || _class);
69
+ export default ColorIndicator;
70
+ export { ColorIndicator };
@@ -0,0 +1,26 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ const allowedProps = ['color', 'elementRef', 'shape'];
26
+ export { allowedProps };