@instructure/ui-color-picker 8.25.1-snapshot-20

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 (201) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +46 -0
  3. package/es/ColorContrast/ColorContrastLocator.js +54 -0
  4. package/es/ColorContrast/index.js +174 -0
  5. package/es/ColorContrast/props.js +40 -0
  6. package/es/ColorContrast/styles.js +99 -0
  7. package/es/ColorContrast/theme.js +55 -0
  8. package/es/ColorIndicator/ColorIndicatorLocator.js +40 -0
  9. package/es/ColorIndicator/index.js +91 -0
  10. package/es/ColorIndicator/props.js +31 -0
  11. package/es/ColorIndicator/styles.js +70 -0
  12. package/es/ColorIndicator/theme.js +53 -0
  13. package/es/ColorMixer/ColorMixerLocator.js +27 -0
  14. package/es/ColorMixer/ColorPalette/index.js +258 -0
  15. package/es/ColorMixer/ColorPalette/props.js +37 -0
  16. package/es/ColorMixer/ColorPalette/styles.js +81 -0
  17. package/es/ColorMixer/ColorPalette/theme.js +48 -0
  18. package/es/ColorMixer/RGBAInput/index.js +148 -0
  19. package/es/ColorMixer/RGBAInput/props.js +39 -0
  20. package/es/ColorMixer/RGBAInput/styles.js +63 -0
  21. package/es/ColorMixer/RGBAInput/theme.js +43 -0
  22. package/es/ColorMixer/Slider/index.js +218 -0
  23. package/es/ColorMixer/Slider/props.js +38 -0
  24. package/es/ColorMixer/Slider/styles.js +95 -0
  25. package/es/ColorMixer/Slider/theme.js +53 -0
  26. package/es/ColorMixer/index.js +232 -0
  27. package/es/ColorMixer/props.js +40 -0
  28. package/es/ColorMixer/styles.js +49 -0
  29. package/es/ColorMixer/utils/shallowCompare.js +32 -0
  30. package/es/ColorPicker/ColorPickerLocator.js +137 -0
  31. package/es/ColorPicker/index.js +487 -0
  32. package/es/ColorPicker/props.js +47 -0
  33. package/es/ColorPicker/styles.js +119 -0
  34. package/es/ColorPicker/theme.js +76 -0
  35. package/es/ColorPreset/ColorPresetLocator.js +27 -0
  36. package/es/ColorPreset/index.js +268 -0
  37. package/es/ColorPreset/props.js +36 -0
  38. package/es/ColorPreset/styles.js +102 -0
  39. package/es/ColorPreset/theme.js +53 -0
  40. package/es/index.js +28 -0
  41. package/lib/ColorContrast/ColorContrastLocator.js +66 -0
  42. package/lib/ColorContrast/index.js +169 -0
  43. package/lib/ColorContrast/props.js +51 -0
  44. package/lib/ColorContrast/styles.js +107 -0
  45. package/lib/ColorContrast/theme.js +63 -0
  46. package/lib/ColorIndicator/ColorIndicatorLocator.js +51 -0
  47. package/lib/ColorIndicator/index.js +82 -0
  48. package/lib/ColorIndicator/props.js +42 -0
  49. package/lib/ColorIndicator/styles.js +78 -0
  50. package/lib/ColorIndicator/theme.js +63 -0
  51. package/lib/ColorMixer/ColorMixerLocator.js +37 -0
  52. package/lib/ColorMixer/ColorPalette/index.js +252 -0
  53. package/lib/ColorMixer/ColorPalette/props.js +48 -0
  54. package/lib/ColorMixer/ColorPalette/styles.js +90 -0
  55. package/lib/ColorMixer/ColorPalette/theme.js +57 -0
  56. package/lib/ColorMixer/RGBAInput/index.js +142 -0
  57. package/lib/ColorMixer/RGBAInput/props.js +50 -0
  58. package/lib/ColorMixer/RGBAInput/styles.js +71 -0
  59. package/lib/ColorMixer/RGBAInput/theme.js +51 -0
  60. package/lib/ColorMixer/Slider/index.js +211 -0
  61. package/lib/ColorMixer/Slider/props.js +49 -0
  62. package/lib/ColorMixer/Slider/styles.js +103 -0
  63. package/lib/ColorMixer/Slider/theme.js +62 -0
  64. package/lib/ColorMixer/index.js +226 -0
  65. package/lib/ColorMixer/props.js +51 -0
  66. package/lib/ColorMixer/styles.js +57 -0
  67. package/lib/ColorMixer/utils/shallowCompare.js +40 -0
  68. package/lib/ColorPicker/ColorPickerLocator.js +151 -0
  69. package/lib/ColorPicker/index.js +500 -0
  70. package/lib/ColorPicker/props.js +58 -0
  71. package/lib/ColorPicker/styles.js +127 -0
  72. package/lib/ColorPicker/theme.js +85 -0
  73. package/lib/ColorPreset/ColorPresetLocator.js +37 -0
  74. package/lib/ColorPreset/index.js +274 -0
  75. package/lib/ColorPreset/props.js +47 -0
  76. package/lib/ColorPreset/styles.js +110 -0
  77. package/lib/ColorPreset/theme.js +61 -0
  78. package/lib/index.js +45 -0
  79. package/lib/package.json +1 -0
  80. package/package.json +62 -0
  81. package/src/ColorContrast/ColorContrastLocator.ts +51 -0
  82. package/src/ColorContrast/README.md +111 -0
  83. package/src/ColorContrast/index.tsx +189 -0
  84. package/src/ColorContrast/props.ts +140 -0
  85. package/src/ColorContrast/styles.ts +102 -0
  86. package/src/ColorContrast/theme.ts +62 -0
  87. package/src/ColorIndicator/ColorIndicatorLocator.ts +41 -0
  88. package/src/ColorIndicator/README.md +76 -0
  89. package/src/ColorIndicator/index.tsx +89 -0
  90. package/src/ColorIndicator/props.ts +68 -0
  91. package/src/ColorIndicator/styles.ts +88 -0
  92. package/src/ColorIndicator/theme.ts +58 -0
  93. package/src/ColorMixer/ColorMixerLocator.ts +29 -0
  94. package/src/ColorMixer/ColorPalette/index.tsx +250 -0
  95. package/src/ColorMixer/ColorPalette/props.ts +87 -0
  96. package/src/ColorMixer/ColorPalette/styles.ts +94 -0
  97. package/src/ColorMixer/ColorPalette/theme.ts +52 -0
  98. package/src/ColorMixer/README.md +98 -0
  99. package/src/ColorMixer/RGBAInput/index.tsx +172 -0
  100. package/src/ColorMixer/RGBAInput/props.ts +93 -0
  101. package/src/ColorMixer/RGBAInput/styles.ts +69 -0
  102. package/src/ColorMixer/RGBAInput/theme.ts +48 -0
  103. package/src/ColorMixer/Slider/index.tsx +242 -0
  104. package/src/ColorMixer/Slider/props.ts +94 -0
  105. package/src/ColorMixer/Slider/styles.ts +114 -0
  106. package/src/ColorMixer/Slider/theme.ts +59 -0
  107. package/src/ColorMixer/index.tsx +221 -0
  108. package/src/ColorMixer/props.ts +169 -0
  109. package/src/ColorMixer/styles.ts +51 -0
  110. package/src/ColorMixer/utils/shallowCompare.ts +35 -0
  111. package/src/ColorPicker/ColorPickerLocator.ts +124 -0
  112. package/src/ColorPicker/README.md +420 -0
  113. package/src/ColorPicker/index.tsx +609 -0
  114. package/src/ColorPicker/props.ts +293 -0
  115. package/src/ColorPicker/styles.ts +131 -0
  116. package/src/ColorPicker/theme.ts +80 -0
  117. package/src/ColorPreset/ColorPresetLocator.ts +29 -0
  118. package/src/ColorPreset/README.md +121 -0
  119. package/src/ColorPreset/index.tsx +328 -0
  120. package/src/ColorPreset/props.ts +162 -0
  121. package/src/ColorPreset/styles.ts +107 -0
  122. package/src/ColorPreset/theme.ts +58 -0
  123. package/src/index.ts +34 -0
  124. package/tsconfig.build.json +36 -0
  125. package/tsconfig.build.tsbuildinfo +1 -0
  126. package/types/ColorContrast/ColorContrastLocator.d.ts +592 -0
  127. package/types/ColorContrast/ColorContrastLocator.d.ts.map +1 -0
  128. package/types/ColorContrast/index.d.ts +61 -0
  129. package/types/ColorContrast/index.d.ts.map +1 -0
  130. package/types/ColorContrast/props.d.ts +62 -0
  131. package/types/ColorContrast/props.d.ts.map +1 -0
  132. package/types/ColorContrast/styles.d.ts +76 -0
  133. package/types/ColorContrast/styles.d.ts.map +1 -0
  134. package/types/ColorContrast/theme.d.ts +10 -0
  135. package/types/ColorContrast/theme.d.ts.map +1 -0
  136. package/types/ColorIndicator/ColorIndicatorLocator.d.ts +577 -0
  137. package/types/ColorIndicator/ColorIndicatorLocator.d.ts.map +1 -0
  138. package/types/ColorIndicator/index.d.ts +35 -0
  139. package/types/ColorIndicator/index.d.ts.map +1 -0
  140. package/types/ColorIndicator/props.d.ts +25 -0
  141. package/types/ColorIndicator/props.d.ts.map +1 -0
  142. package/types/ColorIndicator/styles.d.ts +15 -0
  143. package/types/ColorIndicator/styles.d.ts.map +1 -0
  144. package/types/ColorIndicator/theme.d.ts +11 -0
  145. package/types/ColorIndicator/theme.d.ts.map +1 -0
  146. package/types/ColorMixer/ColorMixerLocator.d.ts +566 -0
  147. package/types/ColorMixer/ColorMixerLocator.d.ts.map +1 -0
  148. package/types/ColorMixer/ColorPalette/index.d.ts +70 -0
  149. package/types/ColorMixer/ColorPalette/index.d.ts.map +1 -0
  150. package/types/ColorMixer/ColorPalette/props.d.ts +29 -0
  151. package/types/ColorMixer/ColorPalette/props.d.ts.map +1 -0
  152. package/types/ColorMixer/ColorPalette/styles.d.ts +15 -0
  153. package/types/ColorMixer/ColorPalette/styles.d.ts.map +1 -0
  154. package/types/ColorMixer/ColorPalette/theme.d.ts +10 -0
  155. package/types/ColorMixer/ColorPalette/theme.d.ts.map +1 -0
  156. package/types/ColorMixer/RGBAInput/index.d.ts +51 -0
  157. package/types/ColorMixer/RGBAInput/index.d.ts.map +1 -0
  158. package/types/ColorMixer/RGBAInput/props.d.ts +28 -0
  159. package/types/ColorMixer/RGBAInput/props.d.ts.map +1 -0
  160. package/types/ColorMixer/RGBAInput/styles.d.ts +15 -0
  161. package/types/ColorMixer/RGBAInput/styles.d.ts.map +1 -0
  162. package/types/ColorMixer/RGBAInput/theme.d.ts +10 -0
  163. package/types/ColorMixer/RGBAInput/theme.d.ts.map +1 -0
  164. package/types/ColorMixer/Slider/index.d.ts +64 -0
  165. package/types/ColorMixer/Slider/index.d.ts.map +1 -0
  166. package/types/ColorMixer/Slider/props.d.ts +26 -0
  167. package/types/ColorMixer/Slider/props.d.ts.map +1 -0
  168. package/types/ColorMixer/Slider/styles.d.ts +15 -0
  169. package/types/ColorMixer/Slider/styles.d.ts.map +1 -0
  170. package/types/ColorMixer/Slider/theme.d.ts +10 -0
  171. package/types/ColorMixer/Slider/theme.d.ts.map +1 -0
  172. package/types/ColorMixer/index.d.ts +59 -0
  173. package/types/ColorMixer/index.d.ts.map +1 -0
  174. package/types/ColorMixer/props.d.ts +91 -0
  175. package/types/ColorMixer/props.d.ts.map +1 -0
  176. package/types/ColorMixer/styles.d.ts +14 -0
  177. package/types/ColorMixer/styles.d.ts.map +1 -0
  178. package/types/ColorMixer/utils/shallowCompare.d.ts +3 -0
  179. package/types/ColorMixer/utils/shallowCompare.d.ts.map +1 -0
  180. package/types/ColorPicker/ColorPickerLocator.d.ts +4113 -0
  181. package/types/ColorPicker/ColorPickerLocator.d.ts.map +1 -0
  182. package/types/ColorPicker/index.d.ts +158 -0
  183. package/types/ColorPicker/index.d.ts.map +1 -0
  184. package/types/ColorPicker/props.d.ts +166 -0
  185. package/types/ColorPicker/props.d.ts.map +1 -0
  186. package/types/ColorPicker/styles.d.ts +17 -0
  187. package/types/ColorPicker/styles.d.ts.map +1 -0
  188. package/types/ColorPicker/theme.d.ts +10 -0
  189. package/types/ColorPicker/theme.d.ts.map +1 -0
  190. package/types/ColorPreset/ColorPresetLocator.d.ts +566 -0
  191. package/types/ColorPreset/ColorPresetLocator.d.ts.map +1 -0
  192. package/types/ColorPreset/index.d.ts +100 -0
  193. package/types/ColorPreset/index.d.ts.map +1 -0
  194. package/types/ColorPreset/props.d.ts +87 -0
  195. package/types/ColorPreset/props.d.ts.map +1 -0
  196. package/types/ColorPreset/styles.d.ts +77 -0
  197. package/types/ColorPreset/styles.d.ts.map +1 -0
  198. package/types/ColorPreset/theme.d.ts +10 -0
  199. package/types/ColorPreset/theme.d.ts.map +1 -0
  200. package/types/index.d.ts +11 -0
  201. package/types/index.d.ts.map +1 -0
@@ -0,0 +1,76 @@
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
+ import { colorIndicatorBorderColor } from '../ColorIndicator/theme';
25
+ /**
26
+ * Generates the theme object for the component from the theme and provided additional information
27
+ * @param {Object} theme The actual theme object.
28
+ * @return {Object} The final theme object with the overrides and component variables
29
+ */
30
+
31
+ const generateComponentTheme = theme => {
32
+ const colors = theme.colors,
33
+ borders = theme.borders,
34
+ spacing = theme.spacing,
35
+ typography = theme.typography;
36
+ const componentVariables = {
37
+ hashMarkColor: colors === null || colors === void 0 ? void 0 : colors.ash,
38
+ warningIconColor: colors === null || colors === void 0 ? void 0 : colors.textWarning,
39
+ errorIconColor: colors === null || colors === void 0 ? void 0 : colors.textDanger,
40
+ successIconColor: colors === null || colors === void 0 ? void 0 : colors.textSuccess,
41
+ popoverSeparatorColor: colors === null || colors === void 0 ? void 0 : colors.tiara,
42
+ popoverFooterColor: colors === null || colors === void 0 ? void 0 : colors.porcelain,
43
+ smallBorder: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
44
+ smallSpacing: spacing === null || spacing === void 0 ? void 0 : spacing.small,
45
+ xSmallSpacing: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
46
+ xxSmallSpacing: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
47
+ xxxSmallSpacing: spacing === null || spacing === void 0 ? void 0 : spacing.xxxSmall,
48
+ xLargeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeXLarge,
49
+ checkerboardBackgroundColor: colors.white,
50
+ checkerboardBackgroundImage: `linear-gradient(45deg, ${colors.tiara} 25%, transparent 25%),
51
+ linear-gradient(-45deg, ${colors.tiara} 25%, transparent 25%),
52
+ linear-gradient(45deg, transparent 75%, ${colors.tiara} 75%),
53
+ linear-gradient(-45deg, transparent 75%, ${colors.tiara} 75%)`,
54
+ checkerboardBackgroundSize: '.5rem .5rem',
55
+ checkerboardBackgroundPosition: '0 0, 0 .25rem, .25rem -0.25rem, -0.25rem 0px',
56
+ colorIndicatorBorderColor,
57
+ simpleColorContainerLeftPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
58
+ hashMarkContainerLineHeight: typography === null || typography === void 0 ? void 0 : typography.fontSizeXLarge,
59
+ hashMarkContainerLeftPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
60
+ hashMarkContainerRightPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xxxSmall,
61
+ errorIconsRightPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
62
+ successIconRightPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
63
+ labelRightMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
64
+ popoverContentPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
65
+ popoverContentBlockBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
66
+ popoverContentBlockTopMargin: spacing === null || spacing === void 0 ? void 0 : spacing.small,
67
+ popoverContentBlockBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.small,
68
+ popoverFooterPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
69
+ popoverFooterTopBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
70
+ colorMixerButtonContainerLeftMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall
71
+ };
72
+ return { ...componentVariables
73
+ };
74
+ };
75
+
76
+ export default generateComponentTheme;
@@ -0,0 +1,27 @@
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
+ import { locator } from '@instructure/ui-test-locator';
25
+ import { ColorPreset } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
26
+
27
+ export const ColorPresetLocator = locator(ColorPreset.selector);
@@ -0,0 +1,268 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ const _excluded = ["disabled", "onSelect", "selected", "styles", "label", "colorMixerSettings", "colors", "elementRef"];
3
+
4
+ var _dec, _dec2, _class, _class2, _IconAddLine, _Drilldown$Option, _Drilldown$Option2;
5
+
6
+ /*
7
+ * The MIT License (MIT)
8
+ *
9
+ * Copyright (c) 2015 - present Instructure, Inc.
10
+ *
11
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ * of this software and associated documentation files (the "Software"), to deal
13
+ * in the Software without restriction, including without limitation the rights
14
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ * copies of the Software, and to permit persons to whom the Software is
16
+ * furnished to do so, subject to the following conditions:
17
+ *
18
+ * The above copyright notice and this permission notice shall be included in all
19
+ * copies or substantial portions of the Software.
20
+ *
21
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ * SOFTWARE.
28
+ */
29
+
30
+ /** @jsx jsx */
31
+ import { Component } from 'react';
32
+ import { withStyle, jsx } from '@instructure/emotion';
33
+ import { passthroughProps } from '@instructure/ui-react-utils';
34
+ import { testable } from '@instructure/ui-testable';
35
+ import { colorToHex8, colorToRGB } from '@instructure/ui-color-utils';
36
+ import { IconButton, Button } from '@instructure/ui-buttons';
37
+ import { View } from '@instructure/ui-view';
38
+ import { Tooltip } from '@instructure/ui-tooltip';
39
+ import { Popover } from '@instructure/ui-popover';
40
+ import { Text } from '@instructure/ui-text';
41
+ import { Drilldown } from '@instructure/ui-drilldown';
42
+ import { IconAddLine, IconCheckDarkSolid } from '@instructure/ui-icons';
43
+ import { ColorIndicator } from '../ColorIndicator';
44
+ import { ColorMixer } from '../ColorMixer';
45
+ import { ColorContrast } from '../ColorContrast';
46
+ import generateStyle from './styles';
47
+ import generateComponentTheme from './theme';
48
+ import { propTypes, allowedProps } from './props';
49
+ /**
50
+ ---
51
+ category: components
52
+ ---
53
+ @tsProps
54
+ **/
55
+
56
+ let ColorPreset = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class ColorPreset extends Component {
57
+ constructor(props) {
58
+ super(props);
59
+ this.ref = null;
60
+
61
+ this.handleRef = el => {
62
+ const elementRef = this.props.elementRef;
63
+ this.ref = el;
64
+
65
+ if (typeof elementRef === 'function') {
66
+ elementRef(el);
67
+ }
68
+ };
69
+
70
+ this.onMenuItemSelected = color => (_e, args) => {
71
+ if (args.value === 'select') {
72
+ this.props.onSelect(color);
73
+ }
74
+
75
+ if (args.value === 'remove') {
76
+ var _this$props, _this$props$colorMixe;
77
+
78
+ (_this$props = this.props) === null || _this$props === void 0 ? void 0 : (_this$props$colorMixe = _this$props.colorMixerSettings) === null || _this$props$colorMixe === void 0 ? void 0 : _this$props$colorMixe.onPresetChange(this.props.colors.filter(clr => clr !== color));
79
+ }
80
+ };
81
+
82
+ this.renderAddNewPresetButton = () => {
83
+ var _this$props2, _this$props2$styles, _this$props$styles, _this$props3, _this$props3$colorMix, _this$props3$colorMix2, _this$props4, _this$props4$colorMix, _this$props$styles2, _this$props$styles3;
84
+
85
+ return jsx(Popover, {
86
+ renderTrigger: jsx("div", {
87
+ css: (_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$styles = _this$props2.styles) === null || _this$props2$styles === void 0 ? void 0 : _this$props2$styles.addNewPresetButton
88
+ }, jsx(IconButton, {
89
+ disabled: this.props.disabled,
90
+ screenReaderLabel: this.props.colorMixerSettings.addNewPresetButtonScreenReaderLabel
91
+ }, _IconAddLine || (_IconAddLine = jsx(IconAddLine, null)))),
92
+ isShowingContent: this.state.openAddNew,
93
+ onShowContent: () => {
94
+ if (this.props.disabled) return;
95
+ this.setState({
96
+ openAddNew: true
97
+ });
98
+ },
99
+ onHideContent: () => {
100
+ this.setState({
101
+ openAddNew: false
102
+ });
103
+ },
104
+ on: "click",
105
+ screenReaderLabel: this.props.popoverScreenReaderLabel,
106
+ shouldContainFocus: true,
107
+ shouldReturnFocus: true,
108
+ shouldCloseOnDocumentClick: true,
109
+ offsetY: 16,
110
+ mountNode: () => document.getElementById('main')
111
+ }, jsx("div", {
112
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.popoverContent
113
+ }, jsx(ColorMixer, {
114
+ value: colorToHex8(this.state.newColor),
115
+ onChange: newColor => this.setState({
116
+ newColor: colorToRGB(newColor)
117
+ }),
118
+ withAlpha: (_this$props3 = this.props) === null || _this$props3 === void 0 ? void 0 : (_this$props3$colorMix = _this$props3.colorMixerSettings) === null || _this$props3$colorMix === void 0 ? void 0 : (_this$props3$colorMix2 = _this$props3$colorMix.colorMixer) === null || _this$props3$colorMix2 === void 0 ? void 0 : _this$props3$colorMix2.withAlpha,
119
+ rgbRedInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbRedInputScreenReaderLabel,
120
+ rgbGreenInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbGreenInputScreenReaderLabel,
121
+ rgbBlueInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbBlueInputScreenReaderLabel,
122
+ rgbAlphaInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbAlphaInputScreenReaderLabel,
123
+ colorSliderNavigationExplanationScreenReaderLabel: this.props.colorMixerSettings.colorMixer.colorSliderNavigationExplanationScreenReaderLabel,
124
+ alphaSliderNavigationExplanationScreenReaderLabel: this.props.colorMixerSettings.colorMixer.alphaSliderNavigationExplanationScreenReaderLabel,
125
+ colorPaletteNavigationExplanationScreenReaderLabel: this.props.colorMixerSettings.colorMixer.colorPaletteNavigationExplanationScreenReaderLabel
126
+ }), ((_this$props4 = this.props) === null || _this$props4 === void 0 ? void 0 : (_this$props4$colorMix = _this$props4.colorMixerSettings) === null || _this$props4$colorMix === void 0 ? void 0 : _this$props4$colorMix.colorContrast) && jsx("div", {
127
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.popoverContrastBlock
128
+ }, jsx(ColorContrast, {
129
+ firstColor: this.props.colorMixerSettings.colorContrast.firstColor,
130
+ secondColor: colorToHex8(this.state.newColor),
131
+ label: this.props.colorMixerSettings.colorContrast.label,
132
+ successLabel: this.props.colorMixerSettings.colorContrast.successLabel,
133
+ failureLabel: this.props.colorMixerSettings.colorContrast.failureLabel,
134
+ normalTextLabel: this.props.colorMixerSettings.colorContrast.normalTextLabel,
135
+ largeTextLabel: this.props.colorMixerSettings.colorContrast.largeTextLabel,
136
+ graphicsTextLabel: this.props.colorMixerSettings.colorContrast.graphicsTextLabel,
137
+ firstColorLabel: this.props.colorMixerSettings.colorContrast.firstColorLabel,
138
+ secondColorLabel: this.props.colorMixerSettings.colorContrast.secondColorLabel
139
+ }))), jsx("div", {
140
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.popoverFooter
141
+ }, jsx(Button, {
142
+ onClick: () => {
143
+ var _this$props5, _this$props5$colorMix;
144
+
145
+ (_this$props5 = this.props) === null || _this$props5 === void 0 ? void 0 : (_this$props5$colorMix = _this$props5.colorMixerSettings) === null || _this$props5$colorMix === void 0 ? void 0 : _this$props5$colorMix.onPresetChange([colorToHex8(this.state.newColor), ...this.props.colors]);
146
+ this.setState({
147
+ openAddNew: false
148
+ });
149
+ },
150
+ color: "primary",
151
+ margin: "0 xx-small 0 xx-small"
152
+ }, "Add"), jsx(Button, {
153
+ onClick: () => this.setState({
154
+ openAddNew: false
155
+ }),
156
+ color: "secondary",
157
+ margin: "0 xx-small 0 xx-small"
158
+ }, "Close")));
159
+ };
160
+
161
+ this.renderColorIndicator = (color, selectOnClick) => {
162
+ var _this$props6, _this$props6$styles;
163
+
164
+ return jsx(Tooltip, {
165
+ renderTip: jsx("div", null, color)
166
+ }, jsx(View, Object.assign({
167
+ disabled: this.props.disabled,
168
+ position: "relative",
169
+ width: "2.375rem",
170
+ height: "2.375rem",
171
+ background: "transparent",
172
+ margin: "xx-small",
173
+ display: "inline-block",
174
+ borderRadius: "medium",
175
+ borderWidth: "0",
176
+ padding: "0",
177
+ as: "button"
178
+ }, selectOnClick ? {
179
+ onClick: () => this.props.onSelect(color)
180
+ } : {}, this.props.selected === color ? {
181
+ 'aria-label': 'selected'
182
+ } : {}, {
183
+ role: "presentation"
184
+ }), jsx("div", null, jsx(ColorIndicator, {
185
+ color: color,
186
+ shape: "rectangle"
187
+ }), this.props.selected === color && jsx("div", {
188
+ css: (_this$props6 = this.props) === null || _this$props6 === void 0 ? void 0 : (_this$props6$styles = _this$props6.styles) === null || _this$props6$styles === void 0 ? void 0 : _this$props6$styles.selectedIndicator
189
+ }, jsx(IconCheckDarkSolid, {
190
+ themeOverride: {
191
+ sizeXSmall: '0.8rem'
192
+ },
193
+ size: "x-small"
194
+ })))));
195
+ };
196
+
197
+ this.renderSettingsMenu = (color, index) => jsx(Drilldown, {
198
+ onSelect: this.onMenuItemSelected(color),
199
+ trigger: this.renderColorIndicator(color),
200
+ key: `color-preset-color-${index}`,
201
+ rootPageId: "root",
202
+ width: "10rem",
203
+ offsetY: "15rem"
204
+ }, jsx(Drilldown.Page, {
205
+ withoutHeaderSeparator: true,
206
+ id: "root",
207
+ renderTitle: color
208
+ }, _Drilldown$Option || (_Drilldown$Option = jsx(Drilldown.Option, {
209
+ value: "select",
210
+ id: "select"
211
+ }, "Select")), _Drilldown$Option2 || (_Drilldown$Option2 = jsx(Drilldown.Option, {
212
+ value: "remove",
213
+ id: "remove"
214
+ }, "Remove"))));
215
+
216
+ this.state = {
217
+ openEditor: false,
218
+ openAddNew: false,
219
+ newColor: {
220
+ r: 51,
221
+ g: 99,
222
+ b: 42,
223
+ a: 1
224
+ }
225
+ };
226
+ }
227
+
228
+ componentDidMount() {
229
+ var _this$props$makeStyle, _this$props7;
230
+
231
+ (_this$props$makeStyle = (_this$props7 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props7);
232
+ }
233
+
234
+ componentDidUpdate() {
235
+ var _this$props$makeStyle2, _this$props8;
236
+
237
+ (_this$props$makeStyle2 = (_this$props8 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props8);
238
+ }
239
+
240
+ render() {
241
+ const _this$props9 = this.props,
242
+ disabled = _this$props9.disabled,
243
+ onSelect = _this$props9.onSelect,
244
+ selected = _this$props9.selected,
245
+ styles = _this$props9.styles,
246
+ label = _this$props9.label,
247
+ colorMixerSettings = _this$props9.colorMixerSettings,
248
+ colors = _this$props9.colors,
249
+ elementRef = _this$props9.elementRef,
250
+ props = _objectWithoutProperties(_this$props9, _excluded);
251
+
252
+ return jsx("div", Object.assign({}, passthroughProps(props), {
253
+ ref: this.handleRef,
254
+ css: styles === null || styles === void 0 ? void 0 : styles.colorPreset
255
+ }), label && jsx("div", {
256
+ css: styles === null || styles === void 0 ? void 0 : styles.label
257
+ }, jsx(Text, {
258
+ weight: "bold"
259
+ }, label)), typeof (colorMixerSettings === null || colorMixerSettings === void 0 ? void 0 : colorMixerSettings.onPresetChange) === 'function' && this.renderAddNewPresetButton(), colors.map((color, index) => typeof (colorMixerSettings === null || colorMixerSettings === void 0 ? void 0 : colorMixerSettings.onPresetChange) === 'function' ? this.renderSettingsMenu(color, index) : jsx("div", {
260
+ key: `color-preset-color-${index}`
261
+ }, this.renderColorIndicator(color, true))));
262
+ }
263
+
264
+ }, _class2.displayName = "ColorPreset", _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.componentId = 'ColorPreset', _class2.defaultProps = {
265
+ disabled: false
266
+ }, _class2)) || _class) || _class);
267
+ export { ColorPreset };
268
+ export default ColorPreset;
@@ -0,0 +1,36 @@
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
+ import PropTypes from 'prop-types';
25
+ const propTypes = {
26
+ colors: PropTypes.array.isRequired,
27
+ disabled: PropTypes.bool,
28
+ elementRef: PropTypes.func,
29
+ label: PropTypes.string,
30
+ colorMixerSettings: PropTypes.object,
31
+ onSelect: PropTypes.func.isRequired,
32
+ popoverScreenReaderLabel: PropTypes.string,
33
+ selected: PropTypes.string.isRequired
34
+ };
35
+ const allowedProps = ['colors', 'disabled', 'elementRef', 'label', 'colorMixerSettings', 'onSelect', 'popoverScreenReaderLabel', 'selected'];
36
+ export { propTypes, allowedProps };
@@ -0,0 +1,102 @@
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 colorMixerSettings = props.colorMixerSettings;
37
+ return {
38
+ colorPreset: {
39
+ label: 'colorPreset',
40
+ display: 'flex',
41
+ flexWrap: 'wrap',
42
+ width: '17rem'
43
+ },
44
+ addNewPresetButton: {
45
+ label: 'colorPreset__addNewPresetButton',
46
+ width: '2.375rem',
47
+ height: '2.375rem',
48
+ margin: componentTheme.xxSmallSpacing
49
+ },
50
+ selectedIndicator: {
51
+ label: 'colorPreset__selectedIndicator',
52
+ width: '1.25rem',
53
+ height: '1.25rem',
54
+ borderStyle: 'solid',
55
+ borderColor: componentTheme.selectedIndicatorBorderColor,
56
+ borderWidth: componentTheme.smallBorder,
57
+ borderRadius: '1.25rem',
58
+ boxSizing: 'border-box',
59
+ position: 'relative',
60
+ insetInlineStart: '1.5rem',
61
+ bottom: '2.75rem',
62
+ backgroundColor: componentTheme.selectedIndicatorBackgroundColor,
63
+ display: 'flex',
64
+ alignItems: 'center',
65
+ justifyContent: 'center'
66
+ },
67
+ popoverContent: {
68
+ label: 'colorPreset__popoverContent',
69
+ padding: componentTheme.smallSpacing,
70
+ maxHeight: (colorMixerSettings === null || colorMixerSettings === void 0 ? void 0 : colorMixerSettings.maxHeight) || '100vh',
71
+ overflow: 'scroll'
72
+ },
73
+ popoverDivider: {
74
+ label: 'colorPreset__popoverDivider',
75
+ borderTop: 'solid',
76
+ borderWidth: componentTheme.smallBorder,
77
+ borderColor: componentTheme.popoverDividerColor,
78
+ margin: `${componentTheme.smallSpacing} 0 ${componentTheme.smallSpacing} 0`
79
+ },
80
+ popoverContrastBlock: {
81
+ label: 'colorPreset__popoverContrastBlock',
82
+ borderTop: 'solid',
83
+ borderWidth: componentTheme.smallBorder,
84
+ borderColor: componentTheme.popoverDividerColor,
85
+ margin: `${componentTheme.smallSpacing} 0 ${componentTheme.smallSpacing} 0`
86
+ },
87
+ popoverFooter: {
88
+ label: 'colorPreset__popoverFooter',
89
+ backgroundColor: componentTheme.popoverFooterColor,
90
+ display: 'flex',
91
+ flexDirection: 'row-reverse',
92
+ padding: componentTheme.smallSpacing
93
+ },
94
+ label: {
95
+ label: 'colorPreset__label',
96
+ width: '100%',
97
+ margin: componentTheme.xxSmallSpacing
98
+ }
99
+ };
100
+ };
101
+
102
+ export default generateStyle;
@@ -0,0 +1,53 @@
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
+ * Generates the theme object for the component from the theme and provided additional information
27
+ * @param {Object} theme The actual theme object.
28
+ * @return {Object} The final theme object with the overrides and component variables
29
+ */
30
+ const generateComponentTheme = theme => {
31
+ const colors = theme.colors,
32
+ borders = theme.borders,
33
+ spacing = theme.spacing;
34
+ const componentVariables = {
35
+ xxSmallSpacing: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
36
+ smallSpacing: spacing === null || spacing === void 0 ? void 0 : spacing.small,
37
+ selectedIndicatorBackgroundColor: colors.white,
38
+ selectedIndicatorBorderColor: colors.licorice,
39
+ popoverDividerColor: colors === null || colors === void 0 ? void 0 : colors.tiara,
40
+ smallBorder: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
41
+ popoverFooterColor: colors === null || colors === void 0 ? void 0 : colors.porcelain,
42
+ checkerboardBackgroundImage: `linear-gradient(45deg, ${colors.tiara} 25%, transparent 25%),
43
+ linear-gradient(-45deg, ${colors.tiara} 25%, transparent 25%),
44
+ linear-gradient(45deg, transparent 75%, ${colors.tiara} 75%),
45
+ linear-gradient(-45deg, transparent 75%, ${colors.tiara} 75%)`,
46
+ checkerboardBackgroundSize: '.5rem .5rem',
47
+ checkerboardBackgroundPosition: '0 0, 0 .25rem, .25rem -0.25rem, -0.25rem 0px'
48
+ };
49
+ return { ...componentVariables
50
+ };
51
+ };
52
+
53
+ export default generateComponentTheme;
package/es/index.js ADDED
@@ -0,0 +1,28 @@
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
+ export { ColorPicker } from './ColorPicker';
25
+ export { ColorMixer } from './ColorMixer';
26
+ export { ColorPreset } from './ColorPreset';
27
+ export { ColorContrast } from './ColorContrast';
28
+ export { ColorIndicator } from './ColorIndicator';
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ColorContrastLocator = void 0;
7
+
8
+ var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
+
10
+ var _uiTestQueries = require("@instructure/ui-test-queries");
11
+
12
+ var _PillLocator = require("@instructure/ui-pill/lib/Pill/PillLocator");
13
+
14
+ var _index = require("./index");
15
+
16
+ /*
17
+ * The MIT License (MIT)
18
+ *
19
+ * Copyright (c) 2015 - present Instructure, Inc.
20
+ *
21
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ * of this software and associated documentation files (the "Software"), to deal
23
+ * in the Software without restriction, including without limitation the rights
24
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ * copies of the Software, and to permit persons to whom the Software is
26
+ * furnished to do so, subject to the following conditions:
27
+ *
28
+ * The above copyright notice and this permission notice shall be included in all
29
+ * copies or substantial portions of the Software.
30
+ *
31
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ * SOFTWARE.
38
+ */
39
+
40
+ /* eslint-disable no-restricted-imports */
41
+ // @ts-expect-error bypass no type definition found error
42
+
43
+ /* eslint-enable no-restricted-imports */
44
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
45
+ const ColorContrastLocator = (0, _locator.locator)(_index.ColorContrast.selector, {
46
+ findPreview: function () {
47
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
+ args[_key] = arguments[_key];
49
+ }
50
+
51
+ return (0, _uiTestQueries.find)('[class$=-colorContrast__colorPreview]', ...args);
52
+ },
53
+ findNormalTextCheckPill: async () => {
54
+ const pills = await _PillLocator.PillLocator.findAll();
55
+ return pills[0];
56
+ },
57
+ findLargeTextCheckPill: async () => {
58
+ const pills = await _PillLocator.PillLocator.findAll();
59
+ return pills[1];
60
+ },
61
+ findGraphicsCheckPill: async () => {
62
+ const pills = await _PillLocator.PillLocator.findAll();
63
+ return pills[2];
64
+ }
65
+ });
66
+ exports.ColorContrastLocator = ColorContrastLocator;