@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,226 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = exports.ColorMixer = void 0;
9
+
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+
12
+ var _react = require("react");
13
+
14
+ var _emotion = require("@instructure/emotion");
15
+
16
+ var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
17
+
18
+ var _testable = require("@instructure/ui-testable/lib/testable.js");
19
+
20
+ var _uiColorUtils = require("@instructure/ui-color-utils");
21
+
22
+ var _ColorPalette = _interopRequireDefault(require("./ColorPalette"));
23
+
24
+ var _Slider = _interopRequireDefault(require("./Slider"));
25
+
26
+ var _RGBAInput = _interopRequireDefault(require("./RGBAInput"));
27
+
28
+ var _props = require("./props");
29
+
30
+ var _styles = _interopRequireDefault(require("./styles"));
31
+
32
+ const _excluded = ["disabled", "onChange", "value", "elementRef", "styles", "withAlpha", "rgbRedInputScreenReaderLabel", "rgbGreenInputScreenReaderLabel", "rgbBlueInputScreenReaderLabel", "rgbAlphaInputScreenReaderLabel", "colorSliderNavigationExplanationScreenReaderLabel", "alphaSliderNavigationExplanationScreenReaderLabel", "colorPaletteNavigationExplanationScreenReaderLabel"];
33
+
34
+ var _dec, _dec2, _class, _class2;
35
+
36
+ /**
37
+ ---
38
+ category: components
39
+ ---
40
+ @tsProps
41
+ **/
42
+ let ColorMixer = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class ColorMixer extends _react.Component {
43
+ constructor(props) {
44
+ super(props);
45
+ this.ref = null;
46
+ this._width = 272;
47
+ this._paletteHeight = 160;
48
+ this._sliderHeight = 8;
49
+ this._sliderIndicatorRadius = 6;
50
+ this._paletteIndicatorRadius = 6;
51
+
52
+ this.handleRef = el => {
53
+ const elementRef = this.props.elementRef;
54
+ this.ref = el;
55
+
56
+ if (typeof elementRef === 'function') {
57
+ elementRef(el);
58
+ }
59
+ };
60
+
61
+ this.state = {
62
+ h: 0,
63
+ s: 0,
64
+ v: 0,
65
+ a: 1
66
+ };
67
+ }
68
+
69
+ componentDidMount() {
70
+ var _this$props$makeStyle, _this$props;
71
+
72
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
73
+
74
+ if (this.props.value) {
75
+ this.setState({ ...(0, _uiColorUtils.colorToHsva)(this.props.value)
76
+ });
77
+ }
78
+ }
79
+
80
+ componentDidUpdate(prevProps, prevState) {
81
+ var _this$props$makeStyle2, _this$props2;
82
+
83
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
84
+ const _this$state = this.state,
85
+ h = _this$state.h,
86
+ s = _this$state.s,
87
+ v = _this$state.v,
88
+ a = _this$state.a;
89
+
90
+ if (prevState.h !== h || prevState.s !== s || prevState.v !== v || prevState.a !== a) {
91
+ this.props.onChange((0, _uiColorUtils.colorToHex8)({
92
+ h,
93
+ s,
94
+ v,
95
+ a
96
+ }));
97
+ }
98
+
99
+ if (prevProps.value !== this.props.value && (0, _uiColorUtils.colorToHex8)({
100
+ h,
101
+ s,
102
+ v,
103
+ a
104
+ }) !== this.props.value) {
105
+ this.setState({ ...(0, _uiColorUtils.colorToHsva)(this.props.value)
106
+ });
107
+ }
108
+ }
109
+
110
+ render() {
111
+ const _this$props3 = this.props,
112
+ disabled = _this$props3.disabled,
113
+ onChange = _this$props3.onChange,
114
+ value = _this$props3.value,
115
+ elementRef = _this$props3.elementRef,
116
+ styles = _this$props3.styles,
117
+ withAlpha = _this$props3.withAlpha,
118
+ rgbRedInputScreenReaderLabel = _this$props3.rgbRedInputScreenReaderLabel,
119
+ rgbGreenInputScreenReaderLabel = _this$props3.rgbGreenInputScreenReaderLabel,
120
+ rgbBlueInputScreenReaderLabel = _this$props3.rgbBlueInputScreenReaderLabel,
121
+ rgbAlphaInputScreenReaderLabel = _this$props3.rgbAlphaInputScreenReaderLabel,
122
+ colorSliderNavigationExplanationScreenReaderLabel = _this$props3.colorSliderNavigationExplanationScreenReaderLabel,
123
+ alphaSliderNavigationExplanationScreenReaderLabel = _this$props3.alphaSliderNavigationExplanationScreenReaderLabel,
124
+ colorPaletteNavigationExplanationScreenReaderLabel = _this$props3.colorPaletteNavigationExplanationScreenReaderLabel,
125
+ props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
126
+ const _this$state2 = this.state,
127
+ h = _this$state2.h,
128
+ s = _this$state2.s,
129
+ v = _this$state2.v,
130
+ a = _this$state2.a;
131
+ return (0, _emotion.jsx)("div", Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
132
+ "aria-disabled": disabled,
133
+ ref: this.handleRef,
134
+ css: styles === null || styles === void 0 ? void 0 : styles.colorMixer
135
+ }), (0, _emotion.jsx)("span", {
136
+ css: styles === null || styles === void 0 ? void 0 : styles.sliderAndPaletteContainer,
137
+ "aria-label": `${(0, _uiColorUtils.colorToHex8)({
138
+ h,
139
+ s,
140
+ v,
141
+ a
142
+ })}`,
143
+ "aria-live": "polite"
144
+ }, (0, _emotion.jsx)(_ColorPalette.default, {
145
+ disabled: disabled,
146
+ width: this._width,
147
+ height: this._paletteHeight,
148
+ indicatorRadius: this._paletteIndicatorRadius,
149
+ hue: h,
150
+ color: {
151
+ h,
152
+ s,
153
+ v
154
+ },
155
+ onChange: color => {
156
+ this.setState({
157
+ s: color.s,
158
+ v: color.v
159
+ });
160
+ },
161
+ navigationExplanationScreenReaderLabel: colorPaletteNavigationExplanationScreenReaderLabel
162
+ }), (0, _emotion.jsx)(_Slider.default, {
163
+ disabled: disabled,
164
+ isColorSlider: true,
165
+ width: this._width,
166
+ height: this._sliderHeight,
167
+ indicatorRadius: this._sliderIndicatorRadius,
168
+ value: h,
169
+ minValue: 0,
170
+ maxValue: 359,
171
+ color: (0, _uiColorUtils.colorToHex8)({
172
+ h,
173
+ s,
174
+ v,
175
+ a
176
+ }),
177
+ onChange: hue => {
178
+ this.setState({
179
+ h: hue
180
+ });
181
+ },
182
+ navigationExplanationScreenReaderLabel: colorSliderNavigationExplanationScreenReaderLabel
183
+ }), withAlpha && (0, _emotion.jsx)(_Slider.default, {
184
+ disabled: disabled,
185
+ width: this._width,
186
+ height: this._sliderHeight,
187
+ indicatorRadius: this._sliderIndicatorRadius,
188
+ color: (0, _uiColorUtils.colorToHex8)({
189
+ h,
190
+ s,
191
+ v
192
+ }),
193
+ value: a,
194
+ minValue: 0,
195
+ maxValue: 1,
196
+ onChange: opacity => this.setState({
197
+ a: opacity / 100
198
+ }),
199
+ navigationExplanationScreenReaderLabel: alphaSliderNavigationExplanationScreenReaderLabel
200
+ })), (0, _emotion.jsx)(_RGBAInput.default, {
201
+ disabled: disabled,
202
+ label: withAlpha ? 'RGBA' : 'RGB',
203
+ width: this._width,
204
+ value: (0, _uiColorUtils.colorToRGB)({
205
+ h,
206
+ s,
207
+ v,
208
+ a
209
+ }),
210
+ onChange: color => this.setState({ ...(0, _uiColorUtils.colorToHsva)(color)
211
+ }),
212
+ withAlpha: withAlpha,
213
+ rgbRedInputScreenReaderLabel: rgbRedInputScreenReaderLabel,
214
+ rgbGreenInputScreenReaderLabel: rgbGreenInputScreenReaderLabel,
215
+ rgbBlueInputScreenReaderLabel: rgbBlueInputScreenReaderLabel,
216
+ rgbAlphaInputScreenReaderLabel: rgbAlphaInputScreenReaderLabel
217
+ }));
218
+ }
219
+
220
+ }, _class2.displayName = "ColorMixer", _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.componentId = 'ColorMixer', _class2.defaultProps = {
221
+ withAlpha: false,
222
+ disabled: false
223
+ }, _class2)) || _class) || _class);
224
+ exports.ColorMixer = ColorMixer;
225
+ var _default = ColorMixer;
226
+ exports.default = _default;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.propTypes = exports.allowedProps = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ /*
13
+ * The MIT License (MIT)
14
+ *
15
+ * Copyright (c) 2015 - present Instructure, Inc.
16
+ *
17
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ * of this software and associated documentation files (the "Software"), to deal
19
+ * in the Software without restriction, including without limitation the rights
20
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ * copies of the Software, and to permit persons to whom the Software is
22
+ * furnished to do so, subject to the following conditions:
23
+ *
24
+ * The above copyright notice and this permission notice shall be included in all
25
+ * copies or substantial portions of the Software.
26
+ *
27
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ * SOFTWARE.
34
+ */
35
+ const propTypes = {
36
+ disabled: _propTypes.default.bool,
37
+ elementRef: _propTypes.default.func,
38
+ value: _propTypes.default.string,
39
+ onChange: _propTypes.default.func,
40
+ withAlpha: _propTypes.default.bool,
41
+ rgbRedInputScreenReaderLabel: _propTypes.default.string.isRequired,
42
+ rgbGreenInputScreenReaderLabel: _propTypes.default.string.isRequired,
43
+ rgbBlueInputScreenReaderLabel: _propTypes.default.string.isRequired,
44
+ rgbAlphaInputScreenReaderLabel: _propTypes.default.string.isRequired,
45
+ colorSliderNavigationExplanationScreenReaderLabel: _propTypes.default.string.isRequired,
46
+ alphaSliderNavigationExplanationScreenReaderLabel: _propTypes.default.string.isRequired,
47
+ colorPaletteNavigationExplanationScreenReaderLabel: _propTypes.default.string.isRequired
48
+ };
49
+ exports.propTypes = propTypes;
50
+ const allowedProps = ['disabled', 'elementRef', 'value', 'onChange', 'withAlpha', 'rgbRedInputScreenReaderLabel', 'rgbGreenInputScreenReaderLabel', 'rgbBlueInputScreenReaderLabel', 'rgbAlphaInputScreenReaderLabel', 'colorSliderNavigationExplanationScreenReaderLabel', 'alphaSliderNavigationExplanationScreenReaderLabel', 'colorPaletteNavigationExplanationScreenReaderLabel'];
51
+ exports.allowedProps = allowedProps;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ /*
9
+ * The MIT License (MIT)
10
+ *
11
+ * Copyright (c) 2015 - present Instructure, Inc.
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in all
21
+ * copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+
32
+ /**
33
+ * ---
34
+ * private: true
35
+ * ---
36
+ * Generates the style object from the theme and provided additional information
37
+ * @param {Object} componentTheme The theme variable object.
38
+ * @param {Object} props the props of the component, the style is applied to
39
+ * @param {Object} state the state of the component, the style is applied to
40
+ * @return {Object} The final style object, which will be used in the component
41
+ */
42
+ const generateStyle = () => {
43
+ return {
44
+ colorMixer: {
45
+ label: 'colorMixer',
46
+ width: '17rem'
47
+ },
48
+ sliderAndPaletteContainer: {
49
+ label: 'colorMixer__sliderAndPaletteContainer',
50
+ display: 'flex',
51
+ flexDirection: 'column'
52
+ }
53
+ };
54
+ };
55
+
56
+ var _default = generateStyle;
57
+ exports.default = _default;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ /*
9
+ * The MIT License (MIT)
10
+ *
11
+ * Copyright (c) 2015 - present Instructure, Inc.
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in all
21
+ * copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+ const shallowCompare = (newObj, prevObj) => {
32
+ for (const key in newObj) {
33
+ if (newObj[key] !== prevObj[key]) return true;
34
+ }
35
+
36
+ return false;
37
+ };
38
+
39
+ var _default = shallowCompare;
40
+ exports.default = _default;
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ColorPickerLocator = void 0;
7
+
8
+ var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
+
10
+ var _uiTestUtils = require("@instructure/ui-test-utils");
11
+
12
+ var _ = require(".");
13
+
14
+ var _PopoverLocator = require("@instructure/ui-popover/lib/Popover/PopoverLocator");
15
+
16
+ var _ColorIndicatorLocator = require("../ColorIndicator/ColorIndicatorLocator");
17
+
18
+ var _ColorMixerLocator = require("../ColorMixer/ColorMixerLocator");
19
+
20
+ var _ColorPresetLocator = require("../ColorPreset/ColorPresetLocator");
21
+
22
+ /*
23
+ * The MIT License (MIT)
24
+ *
25
+ * Copyright (c) 2015 - present Instructure, Inc.
26
+ *
27
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
28
+ * of this software and associated documentation files (the "Software"), to deal
29
+ * in the Software without restriction, including without limitation the rights
30
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31
+ * copies of the Software, and to permit persons to whom the Software is
32
+ * furnished to do so, subject to the following conditions:
33
+ *
34
+ * The above copyright notice and this permission notice shall be included in all
35
+ * copies or substantial portions of the Software.
36
+ *
37
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
43
+ * SOFTWARE.
44
+ */
45
+
46
+ /* eslint-disable no-restricted-imports */
47
+ // @ts-expect-error bypass no type definition found error
48
+
49
+ /* eslint-enable no-restricted-imports */
50
+ async function _findColorPreset() {
51
+ const popoverContent = await _PopoverLocator.PopoverLocator.findContent(...arguments);
52
+ const colorPreset = await _ColorPresetLocator.ColorPresetLocator.find(popoverContent.getDOMNode());
53
+ return _ColorIndicatorLocator.ColorIndicatorLocator.findAll(colorPreset.getDOMNode());
54
+ }
55
+
56
+ const customMethods = {
57
+ findTextInput: function () {
58
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
59
+ args[_key] = arguments[_key];
60
+ }
61
+
62
+ return (0, _uiTestUtils.find)('[id^=TextInput_]', ...args);
63
+ },
64
+ findColorIndicator: function () {
65
+ return _ColorIndicatorLocator.ColorIndicatorLocator.find(...arguments);
66
+ },
67
+ findInputAfterIcon: function () {
68
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
69
+ args[_key2] = arguments[_key2];
70
+ }
71
+
72
+ return (0, _uiTestUtils.find)('[class$=-textInput__afterElement]', ...args);
73
+ },
74
+ findFormMessages: function () {
75
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
76
+ args[_key3] = arguments[_key3];
77
+ }
78
+
79
+ return (0, _uiTestUtils.findAll)('[class$=-formFieldMessage]', ...args);
80
+ },
81
+ findPopoverRoot: function () {
82
+ return _PopoverLocator.PopoverLocator.find(...arguments);
83
+ },
84
+ findPopoverTrigger: function () {
85
+ return _PopoverLocator.PopoverLocator.findTrigger(...arguments);
86
+ },
87
+ findColorMixer: function () {
88
+ return _ColorMixerLocator.ColorMixerLocator.find(...arguments);
89
+ },
90
+ findPopoverContent: function () {
91
+ const _parseQueryArguments = (0, _uiTestUtils.parseQueryArguments)(...arguments),
92
+ element = _parseQueryArguments.element,
93
+ selector = _parseQueryArguments.selector,
94
+ options = _parseQueryArguments.options;
95
+
96
+ return _PopoverLocator.PopoverLocator.findContent(element, selector, { ...options,
97
+ customMethods: { ...options.customMethods,
98
+ ...customMethods
99
+ }
100
+ });
101
+ },
102
+ findRGBAInputs: async function () {
103
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
104
+ args[_key4] = arguments[_key4];
105
+ }
106
+
107
+ const rgbaInputs = await (0, _uiTestUtils.findAll)('[class$=-RGBAInput__rgbInput]', ...args);
108
+ return Promise.all(rgbaInputs.map(span => span.find('input')));
109
+ },
110
+ findPopoverButtonWithText: async function () {
111
+ let el = await (0, _uiTestUtils.findWithText)(...arguments);
112
+
113
+ while (el.getTagName() !== 'button') {
114
+ const parentNode = el.getParentNode();
115
+
116
+ if (!parentNode) {
117
+ break;
118
+ }
119
+
120
+ el = (0, _uiTestUtils.within)(parentNode);
121
+ }
122
+
123
+ return el;
124
+ },
125
+ findColorPreset: async function () {
126
+ return _findColorPreset(...arguments);
127
+ },
128
+ findColorPresetButtons: async function () {
129
+ const colorPresets = await _findColorPreset(...arguments);
130
+ const colorPresetButtons = [];
131
+
132
+ for (let el of colorPresets) {
133
+ while (el.getTagName() !== 'button') {
134
+ const parentNode = el.getParentNode();
135
+
136
+ if (!parentNode) {
137
+ break;
138
+ }
139
+
140
+ el = (0, _uiTestUtils.within)(parentNode);
141
+ }
142
+
143
+ colorPresetButtons.push(el);
144
+ }
145
+
146
+ return colorPresetButtons;
147
+ }
148
+ }; //@ts-expect-error no selector on class
149
+
150
+ const ColorPickerLocator = (0, _locator.locator)(_.ColorPicker.selector, customMethods);
151
+ exports.ColorPickerLocator = ColorPickerLocator;