@react-aria/color 3.0.0-beta.2 → 3.0.0-beta.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.
- package/dist/import.mjs +1354 -0
- package/dist/main.js +1336 -492
- package/dist/main.js.map +1 -1
- package/dist/module.js +1336 -457
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +45 -18
- package/dist/types.d.ts.map +1 -1
- package/package.json +21 -14
- package/src/index.ts +9 -4
- package/src/useColorArea.ts +448 -0
- package/src/useColorAreaGradient.ts +254 -0
- package/src/useColorField.ts +4 -2
- package/src/useColorSlider.ts +16 -20
- package/src/useColorWheel.ts +91 -58
package/dist/main.js
CHANGED
|
@@ -1,517 +1,1361 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var {
|
|
10
|
-
useKeyboard,
|
|
11
|
-
useMove,
|
|
12
|
-
useFocusWithin,
|
|
13
|
-
useScrollWheel
|
|
14
|
-
} = require("@react-aria/interactions");
|
|
15
|
-
|
|
16
|
-
var {
|
|
17
|
-
useCallback,
|
|
18
|
-
useRef,
|
|
19
|
-
useState
|
|
20
|
-
} = require("react");
|
|
21
|
-
|
|
22
|
-
var {
|
|
23
|
-
useSlider,
|
|
24
|
-
useSliderThumb
|
|
25
|
-
} = require("@react-aria/slider");
|
|
26
|
-
|
|
27
|
-
var {
|
|
28
|
-
useLocale
|
|
29
|
-
} = require("@react-aria/i18n");
|
|
30
|
-
|
|
31
|
-
var {
|
|
32
|
-
mergeProps,
|
|
33
|
-
focusWithoutScrolling,
|
|
34
|
-
useGlobalListeners,
|
|
35
|
-
useLabels,
|
|
36
|
-
useId
|
|
37
|
-
} = require("@react-aria/utils");
|
|
38
|
-
|
|
39
|
-
var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
|
|
1
|
+
var $kZqDi$reactariautils = require("@react-aria/utils");
|
|
2
|
+
var $kZqDi$react = require("react");
|
|
3
|
+
var $kZqDi$reactariainteractions = require("@react-aria/interactions");
|
|
4
|
+
var $kZqDi$reactariai18n = require("@react-aria/i18n");
|
|
5
|
+
var $kZqDi$reactariavisuallyhidden = require("@react-aria/visually-hidden");
|
|
6
|
+
var $kZqDi$reactariaslider = require("@react-aria/slider");
|
|
7
|
+
var $kZqDi$reactariatextfield = require("@react-aria/textfield");
|
|
8
|
+
var $kZqDi$reactariaspinbutton = require("@react-aria/spinbutton");
|
|
40
9
|
|
|
10
|
+
function $parcel$export(e, n, v, s) {
|
|
11
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
|
+
}
|
|
41
13
|
function $parcel$interopDefault(a) {
|
|
42
14
|
return a && a.__esModule ? a.default : a;
|
|
43
15
|
}
|
|
44
16
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} = useSliderThumb({
|
|
79
|
-
index: 0,
|
|
80
|
-
orientation,
|
|
81
|
-
isDisabled: props.isDisabled,
|
|
82
|
-
trackRef,
|
|
83
|
-
inputRef
|
|
84
|
-
}, state);
|
|
85
|
-
|
|
86
|
-
let generateBackground = () => {
|
|
87
|
-
let value = state.getDisplayColor();
|
|
88
|
-
let to;
|
|
89
|
-
|
|
90
|
-
if (orientation === 'vertical') {
|
|
91
|
-
to = 'top';
|
|
92
|
-
} else if (direction === 'ltr') {
|
|
93
|
-
to = 'right';
|
|
94
|
-
} else {
|
|
95
|
-
to = 'left';
|
|
96
|
-
}
|
|
17
|
+
$parcel$export(module.exports, "useColorArea", () => $47925bd68062ac17$export$2f92a7a615a014f6);
|
|
18
|
+
$parcel$export(module.exports, "useColorSlider", () => $afbb9647440a7f5b$export$106b7a4e66508f66);
|
|
19
|
+
$parcel$export(module.exports, "useColorWheel", () => $1d29bf243d4a9a53$export$9064ff4e44b3729a);
|
|
20
|
+
$parcel$export(module.exports, "useColorField", () => $58c850037bc7a7ce$export$77e32ca575a28fdf);
|
|
21
|
+
/*
|
|
22
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
23
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
24
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
25
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
+
*
|
|
27
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
28
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
29
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
30
|
+
* governing permissions and limitations under the License.
|
|
31
|
+
*/ /*
|
|
32
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
33
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
34
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
35
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
36
|
+
*
|
|
37
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
38
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
39
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
40
|
+
* governing permissions and limitations under the License.
|
|
41
|
+
*/
|
|
42
|
+
var $4f97b428b4cbcd4e$exports = {};
|
|
43
|
+
var $f141a15c3076a67b$exports = {};
|
|
44
|
+
$f141a15c3076a67b$exports = {
|
|
45
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
46
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
47
|
+
"colorPicker": `أداة انتقاء اللون`,
|
|
48
|
+
"twoDimensionalSlider": `مُنزلق 2D`
|
|
49
|
+
};
|
|
97
50
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
51
|
+
|
|
52
|
+
var $435ac2a9fdd2ae5e$exports = {};
|
|
53
|
+
$435ac2a9fdd2ae5e$exports = {
|
|
54
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
55
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
56
|
+
"colorPicker": `Средство за избиране на цвят`,
|
|
57
|
+
"twoDimensionalSlider": `2D плъзгач`
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
var $6b29758b432284f5$exports = {};
|
|
62
|
+
$6b29758b432284f5$exports = {
|
|
63
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
64
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
65
|
+
"colorPicker": `Výběr barvy`,
|
|
66
|
+
"twoDimensionalSlider": `2D posuvník`
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
var $357597bcf4afd6fb$exports = {};
|
|
71
|
+
$357597bcf4afd6fb$exports = {
|
|
72
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
73
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
74
|
+
"colorPicker": `Farvevælger`,
|
|
75
|
+
"twoDimensionalSlider": `2D-skyder`
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
var $ddc6333960e2b591$exports = {};
|
|
80
|
+
$ddc6333960e2b591$exports = {
|
|
81
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
82
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
83
|
+
"colorPicker": `Farbwähler`,
|
|
84
|
+
"twoDimensionalSlider": `2D-Schieberegler`
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
var $417ee93d3ca474c0$exports = {};
|
|
89
|
+
$417ee93d3ca474c0$exports = {
|
|
90
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
91
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
92
|
+
"colorPicker": `Επιλογέας χρωμάτων`,
|
|
93
|
+
"twoDimensionalSlider": `Ρυθμιστικό 2D`
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
var $519561bc6dcff98b$exports = {};
|
|
98
|
+
$519561bc6dcff98b$exports = {
|
|
99
|
+
"colorPicker": `Color picker`,
|
|
100
|
+
"twoDimensionalSlider": `2D slider`,
|
|
101
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
102
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
var $7a34c3fcc03402b8$exports = {};
|
|
107
|
+
$7a34c3fcc03402b8$exports = {
|
|
108
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
109
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
110
|
+
"colorPicker": `Selector de color`,
|
|
111
|
+
"twoDimensionalSlider": `Regulador 2D`
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
var $860f86d6eae22cba$exports = {};
|
|
116
|
+
$860f86d6eae22cba$exports = {
|
|
117
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
118
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
119
|
+
"colorPicker": `Värvivalija`,
|
|
120
|
+
"twoDimensionalSlider": `2D-liugur`
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
var $8525d3c77b8a51b0$exports = {};
|
|
125
|
+
$8525d3c77b8a51b0$exports = {
|
|
126
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
127
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
128
|
+
"colorPicker": `Värimuokkain`,
|
|
129
|
+
"twoDimensionalSlider": `2D-liukusäädin`
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
var $8240fe6825e900ec$exports = {};
|
|
134
|
+
$8240fe6825e900ec$exports = {
|
|
135
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
136
|
+
"colorNameAndValue": (args)=>`${args.name} : ${args.value}`,
|
|
137
|
+
"colorPicker": `Sélecteur de couleurs`,
|
|
138
|
+
"twoDimensionalSlider": `Curseur 2D`
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
var $377849238307c673$exports = {};
|
|
143
|
+
$377849238307c673$exports = {
|
|
144
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
145
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
146
|
+
"colorPicker": `בוחר הצבעים`,
|
|
147
|
+
"twoDimensionalSlider": `מחוון דו מימדי`
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
var $5a6f44e0ec14b083$exports = {};
|
|
152
|
+
$5a6f44e0ec14b083$exports = {
|
|
153
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
154
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
155
|
+
"colorPicker": `Odabir boje`,
|
|
156
|
+
"twoDimensionalSlider": `2D klizač`
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
var $82327d6e71e3e273$exports = {};
|
|
161
|
+
$82327d6e71e3e273$exports = {
|
|
162
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
163
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
164
|
+
"colorPicker": `Színválasztó`,
|
|
165
|
+
"twoDimensionalSlider": `2D-csúszka`
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
var $b1e297275c248ab8$exports = {};
|
|
170
|
+
$b1e297275c248ab8$exports = {
|
|
171
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
172
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
173
|
+
"colorPicker": `Selettore colore`,
|
|
174
|
+
"twoDimensionalSlider": `Cursore 2D`
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
var $b39c9f2638b4d2b9$exports = {};
|
|
179
|
+
$b39c9f2638b4d2b9$exports = {
|
|
180
|
+
"colorInputLabel": (args)=>`${args.label}、${args.channelLabel}`,
|
|
181
|
+
"colorNameAndValue": (args)=>`${args.name} : ${args.value}`,
|
|
182
|
+
"colorPicker": `カラーピッカー`,
|
|
183
|
+
"twoDimensionalSlider": `2D スライダー`
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
var $2d2fbf4195848a62$exports = {};
|
|
188
|
+
$2d2fbf4195848a62$exports = {
|
|
189
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
190
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
191
|
+
"colorPicker": `색상 피커`,
|
|
192
|
+
"twoDimensionalSlider": `2D 슬라이더`
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
var $ea88350d0828fa2c$exports = {};
|
|
197
|
+
$ea88350d0828fa2c$exports = {
|
|
198
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
199
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
200
|
+
"colorPicker": `Spalvų parinkiklis`,
|
|
201
|
+
"twoDimensionalSlider": `2D slankiklis`
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
var $0e0acd541630120a$exports = {};
|
|
206
|
+
$0e0acd541630120a$exports = {
|
|
207
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
208
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
209
|
+
"colorPicker": `Krāsu atlasītājs`,
|
|
210
|
+
"twoDimensionalSlider": `2D slīdnis`
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
var $952a458224052046$exports = {};
|
|
215
|
+
$952a458224052046$exports = {
|
|
216
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
217
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
218
|
+
"colorPicker": `Fargevelger`,
|
|
219
|
+
"twoDimensionalSlider": `2D-glidebryter`
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
var $2d8e195bc5683483$exports = {};
|
|
224
|
+
$2d8e195bc5683483$exports = {
|
|
225
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
226
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
227
|
+
"colorPicker": `Kleurkiezer`,
|
|
228
|
+
"twoDimensionalSlider": `2D-schuifregelaar`
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
var $750d83f83c5f38d4$exports = {};
|
|
233
|
+
$750d83f83c5f38d4$exports = {
|
|
234
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
235
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
236
|
+
"colorPicker": `Próbnik kolorów`,
|
|
237
|
+
"twoDimensionalSlider": `Suwak 2D`
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
var $656b2846f611067c$exports = {};
|
|
242
|
+
$656b2846f611067c$exports = {
|
|
243
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
244
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
245
|
+
"colorPicker": `Seletor de cores`,
|
|
246
|
+
"twoDimensionalSlider": `Controle deslizante 2D`
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
var $58ce120874d069dd$exports = {};
|
|
251
|
+
$58ce120874d069dd$exports = {
|
|
252
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
253
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
254
|
+
"colorPicker": `Seletor de cores`,
|
|
255
|
+
"twoDimensionalSlider": `Controle deslizante 2D`
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
var $fd6c85b4eba18825$exports = {};
|
|
260
|
+
$fd6c85b4eba18825$exports = {
|
|
261
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
262
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
263
|
+
"colorPicker": `Selector de culori`,
|
|
264
|
+
"twoDimensionalSlider": `Glisor 2D`
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
var $8849a15ecc435984$exports = {};
|
|
269
|
+
$8849a15ecc435984$exports = {
|
|
270
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
271
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
272
|
+
"colorPicker": `Палитра цветов`,
|
|
273
|
+
"twoDimensionalSlider": `Ползунок 2D`
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
var $5192372f064be783$exports = {};
|
|
278
|
+
$5192372f064be783$exports = {
|
|
279
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
280
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
281
|
+
"colorPicker": `Výber farieb`,
|
|
282
|
+
"twoDimensionalSlider": `2D jazdec`
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
var $094525f9176df65d$exports = {};
|
|
287
|
+
$094525f9176df65d$exports = {
|
|
288
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
289
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
290
|
+
"colorPicker": `Izbirnik barv`,
|
|
291
|
+
"twoDimensionalSlider": `2D drsnik`
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
var $9795aa59b4ad40ed$exports = {};
|
|
296
|
+
$9795aa59b4ad40ed$exports = {
|
|
297
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
298
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
299
|
+
"colorPicker": `Birač boja`,
|
|
300
|
+
"twoDimensionalSlider": `2D klizač`
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
var $9ebaa0b485f13e4d$exports = {};
|
|
305
|
+
$9ebaa0b485f13e4d$exports = {
|
|
306
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
307
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
308
|
+
"colorPicker": `Färgväljaren`,
|
|
309
|
+
"twoDimensionalSlider": `2D-reglage`
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
var $ad58e2e4e0f2e750$exports = {};
|
|
314
|
+
$ad58e2e4e0f2e750$exports = {
|
|
315
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
316
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
317
|
+
"colorPicker": `Renk Seçici`,
|
|
318
|
+
"twoDimensionalSlider": `2D sürgü`
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
var $dafc19306f8b2dfc$exports = {};
|
|
323
|
+
$dafc19306f8b2dfc$exports = {
|
|
324
|
+
"colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
|
|
325
|
+
"colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
|
|
326
|
+
"colorPicker": `Палітра кольорів`,
|
|
327
|
+
"twoDimensionalSlider": `Повзунок 2D`
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
var $d31a8b80af5acc16$exports = {};
|
|
332
|
+
$d31a8b80af5acc16$exports = {
|
|
333
|
+
"colorInputLabel": (args)=>`${args.label}、${args.channelLabel}`,
|
|
334
|
+
"colorNameAndValue": (args)=>`${args.name}:${args.value}`,
|
|
335
|
+
"colorPicker": `拾色器`,
|
|
336
|
+
"twoDimensionalSlider": `2D 滑块`
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
var $7377d28aec5fa200$exports = {};
|
|
341
|
+
$7377d28aec5fa200$exports = {
|
|
342
|
+
"colorInputLabel": (args)=>`${args.label},${args.channelLabel}`,
|
|
343
|
+
"colorNameAndValue": (args)=>`${args.name}:${args.value}`,
|
|
344
|
+
"colorPicker": `檢色器`,
|
|
345
|
+
"twoDimensionalSlider": `2D 滑桿`
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
$4f97b428b4cbcd4e$exports = {
|
|
350
|
+
"ar-AE": $f141a15c3076a67b$exports,
|
|
351
|
+
"bg-BG": $435ac2a9fdd2ae5e$exports,
|
|
352
|
+
"cs-CZ": $6b29758b432284f5$exports,
|
|
353
|
+
"da-DK": $357597bcf4afd6fb$exports,
|
|
354
|
+
"de-DE": $ddc6333960e2b591$exports,
|
|
355
|
+
"el-GR": $417ee93d3ca474c0$exports,
|
|
356
|
+
"en-US": $519561bc6dcff98b$exports,
|
|
357
|
+
"es-ES": $7a34c3fcc03402b8$exports,
|
|
358
|
+
"et-EE": $860f86d6eae22cba$exports,
|
|
359
|
+
"fi-FI": $8525d3c77b8a51b0$exports,
|
|
360
|
+
"fr-FR": $8240fe6825e900ec$exports,
|
|
361
|
+
"he-IL": $377849238307c673$exports,
|
|
362
|
+
"hr-HR": $5a6f44e0ec14b083$exports,
|
|
363
|
+
"hu-HU": $82327d6e71e3e273$exports,
|
|
364
|
+
"it-IT": $b1e297275c248ab8$exports,
|
|
365
|
+
"ja-JP": $b39c9f2638b4d2b9$exports,
|
|
366
|
+
"ko-KR": $2d2fbf4195848a62$exports,
|
|
367
|
+
"lt-LT": $ea88350d0828fa2c$exports,
|
|
368
|
+
"lv-LV": $0e0acd541630120a$exports,
|
|
369
|
+
"nb-NO": $952a458224052046$exports,
|
|
370
|
+
"nl-NL": $2d8e195bc5683483$exports,
|
|
371
|
+
"pl-PL": $750d83f83c5f38d4$exports,
|
|
372
|
+
"pt-BR": $656b2846f611067c$exports,
|
|
373
|
+
"pt-PT": $58ce120874d069dd$exports,
|
|
374
|
+
"ro-RO": $fd6c85b4eba18825$exports,
|
|
375
|
+
"ru-RU": $8849a15ecc435984$exports,
|
|
376
|
+
"sk-SK": $5192372f064be783$exports,
|
|
377
|
+
"sl-SI": $094525f9176df65d$exports,
|
|
378
|
+
"sr-SP": $9795aa59b4ad40ed$exports,
|
|
379
|
+
"sv-SE": $9ebaa0b485f13e4d$exports,
|
|
380
|
+
"tr-TR": $ad58e2e4e0f2e750$exports,
|
|
381
|
+
"uk-UA": $dafc19306f8b2dfc$exports,
|
|
382
|
+
"zh-CN": $d31a8b80af5acc16$exports,
|
|
383
|
+
"zh-TW": $7377d28aec5fa200$exports
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
/*
|
|
389
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
390
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
391
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
392
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
393
|
+
*
|
|
394
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
395
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
396
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
397
|
+
* governing permissions and limitations under the License.
|
|
398
|
+
*/
|
|
399
|
+
const $99936ad0bf67c8c4$var$generateRGB_R = (orientation, dir, zValue)=>{
|
|
400
|
+
let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
401
|
+
let result = {
|
|
402
|
+
colorAreaStyles: {
|
|
403
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,0),rgb(${zValue},255,0))`
|
|
404
|
+
},
|
|
405
|
+
gradientStyles: {
|
|
406
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,255),rgb(${zValue},255,255))`,
|
|
407
|
+
"WebkitMaskImage": maskImage,
|
|
408
|
+
maskImage: maskImage
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
return result;
|
|
412
|
+
};
|
|
413
|
+
const $99936ad0bf67c8c4$var$generateRGB_G = (orientation, dir, zValue)=>{
|
|
414
|
+
let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
415
|
+
let result = {
|
|
416
|
+
colorAreaStyles: {
|
|
417
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},0),rgb(255,${zValue},0))`
|
|
418
|
+
},
|
|
419
|
+
gradientStyles: {
|
|
420
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},255),rgb(255,${zValue},255))`,
|
|
421
|
+
"WebkitMaskImage": maskImage,
|
|
422
|
+
maskImage: maskImage
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
return result;
|
|
426
|
+
};
|
|
427
|
+
const $99936ad0bf67c8c4$var$generateRGB_B = (orientation, dir, zValue)=>{
|
|
428
|
+
let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
429
|
+
let result = {
|
|
430
|
+
colorAreaStyles: {
|
|
431
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,0,${zValue}),rgb(255,0,${zValue}))`
|
|
432
|
+
},
|
|
433
|
+
gradientStyles: {
|
|
434
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,255,${zValue}),rgb(255,255,${zValue}))`,
|
|
435
|
+
"WebkitMaskImage": maskImage,
|
|
436
|
+
maskImage: maskImage
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
return result;
|
|
440
|
+
};
|
|
441
|
+
const $99936ad0bf67c8c4$var$generateHSL_H = (orientation, dir, zValue)=>{
|
|
442
|
+
let result = {
|
|
443
|
+
colorAreaStyles: {},
|
|
444
|
+
gradientStyles: {
|
|
445
|
+
background: [
|
|
446
|
+
`linear-gradient(to ${orientation[Number(dir)]}, hsla(0,0%,0%,1) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,1) 100%)`,
|
|
447
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,50%),hsla(0,0%,50%,0))`,
|
|
448
|
+
`hsl(${zValue}, 100%, 50%)`
|
|
449
|
+
].join(",")
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
return result;
|
|
453
|
+
};
|
|
454
|
+
const $99936ad0bf67c8c4$var$generateHSL_S = (orientation, dir, alphaValue)=>{
|
|
455
|
+
let result = {
|
|
456
|
+
colorAreaStyles: {},
|
|
457
|
+
gradientStyles: {
|
|
458
|
+
background: [
|
|
459
|
+
`linear-gradient(to ${orientation[Number(!dir)]}, hsla(0,0%,0%,${alphaValue}) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,${alphaValue}) 100%)`,
|
|
460
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
|
|
461
|
+
"hsl(0, 0%, 50%)"
|
|
462
|
+
].join(",")
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
return result;
|
|
466
|
+
};
|
|
467
|
+
const $99936ad0bf67c8c4$var$generateHSL_L = (orientation, dir, zValue)=>{
|
|
468
|
+
let result = {
|
|
469
|
+
colorAreaStyles: {},
|
|
470
|
+
gradientStyles: {
|
|
471
|
+
backgroundImage: [
|
|
472
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,${zValue}%),hsla(0,0%,${zValue}%,0))`,
|
|
473
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsl(0,100%,${zValue}%),hsl(60,100%,${zValue}%),hsl(120,100%,${zValue}%),hsl(180,100%,${zValue}%),hsl(240,100%,${zValue}%),hsl(300,100%,${zValue}%),hsl(360,100%,${zValue}%))`
|
|
474
|
+
].join(",")
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
return result;
|
|
478
|
+
};
|
|
479
|
+
const $99936ad0bf67c8c4$var$generateHSB_H = (orientation, dir, zValue)=>{
|
|
480
|
+
let result = {
|
|
481
|
+
colorAreaStyles: {},
|
|
482
|
+
gradientStyles: {
|
|
483
|
+
background: [
|
|
484
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsl(0,0%,0%),hsla(0,0%,0%,0))`,
|
|
485
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,100%),hsla(0,0%,100%,0))`,
|
|
486
|
+
`hsl(${zValue}, 100%, 50%)`
|
|
487
|
+
].join(",")
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
return result;
|
|
491
|
+
};
|
|
492
|
+
const $99936ad0bf67c8c4$var$generateHSB_S = (orientation, dir, alphaValue)=>{
|
|
493
|
+
let result = {
|
|
494
|
+
colorAreaStyles: {},
|
|
495
|
+
gradientStyles: {
|
|
496
|
+
background: [
|
|
497
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,0%,${alphaValue}),hsla(0,0%,0%,0))`,
|
|
498
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
|
|
499
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,0%),hsl(0,0%,100%))`
|
|
500
|
+
].join(",")
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
return result;
|
|
504
|
+
};
|
|
505
|
+
const $99936ad0bf67c8c4$var$generateHSB_B = (orientation, dir, alphaValue)=>{
|
|
506
|
+
let result = {
|
|
507
|
+
colorAreaStyles: {},
|
|
508
|
+
gradientStyles: {
|
|
509
|
+
background: [
|
|
510
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,100%,${alphaValue}),hsla(0,0%,100%,0))`,
|
|
511
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
|
|
512
|
+
"#000"
|
|
513
|
+
].join(",")
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
return result;
|
|
517
|
+
};
|
|
518
|
+
function $99936ad0bf67c8c4$export$dd62420467d245ca({ direction: direction , state: state , zChannel: zChannel , xChannel: xChannel , isDisabled: isDisabled }) {
|
|
519
|
+
let returnVal = (0, $kZqDi$react.useMemo)(()=>{
|
|
520
|
+
let orientation = [
|
|
521
|
+
"top",
|
|
522
|
+
direction === "rtl" ? "left" : "right"
|
|
523
|
+
];
|
|
524
|
+
let dir = false;
|
|
525
|
+
let background = {
|
|
526
|
+
colorAreaStyles: {},
|
|
527
|
+
gradientStyles: {}
|
|
528
|
+
};
|
|
529
|
+
let zValue = state.value.getChannelValue(zChannel);
|
|
530
|
+
let { minValue: zMin , maxValue: zMax } = state.value.getChannelRange(zChannel);
|
|
531
|
+
let alphaValue = (zValue - zMin) / (zMax - zMin);
|
|
532
|
+
let isHSL = state.value.getColorSpace() === "hsl";
|
|
533
|
+
if (!isDisabled) switch(zChannel){
|
|
534
|
+
case "red":
|
|
535
|
+
dir = xChannel === "green";
|
|
536
|
+
background = $99936ad0bf67c8c4$var$generateRGB_R(orientation, dir, zValue);
|
|
537
|
+
break;
|
|
538
|
+
case "green":
|
|
539
|
+
dir = xChannel === "red";
|
|
540
|
+
background = $99936ad0bf67c8c4$var$generateRGB_G(orientation, dir, zValue);
|
|
541
|
+
break;
|
|
542
|
+
case "blue":
|
|
543
|
+
dir = xChannel === "red";
|
|
544
|
+
background = $99936ad0bf67c8c4$var$generateRGB_B(orientation, dir, zValue);
|
|
545
|
+
break;
|
|
546
|
+
case "hue":
|
|
547
|
+
dir = xChannel !== "saturation";
|
|
548
|
+
if (isHSL) background = $99936ad0bf67c8c4$var$generateHSL_H(orientation, dir, zValue);
|
|
549
|
+
else background = $99936ad0bf67c8c4$var$generateHSB_H(orientation, dir, zValue);
|
|
550
|
+
break;
|
|
551
|
+
case "saturation":
|
|
552
|
+
dir = xChannel === "hue";
|
|
553
|
+
if (isHSL) background = $99936ad0bf67c8c4$var$generateHSL_S(orientation, dir, alphaValue);
|
|
554
|
+
else background = $99936ad0bf67c8c4$var$generateHSB_S(orientation, dir, alphaValue);
|
|
555
|
+
break;
|
|
556
|
+
case "brightness":
|
|
557
|
+
dir = xChannel === "hue";
|
|
558
|
+
background = $99936ad0bf67c8c4$var$generateHSB_B(orientation, dir, alphaValue);
|
|
559
|
+
break;
|
|
560
|
+
case "lightness":
|
|
561
|
+
dir = xChannel === "hue";
|
|
562
|
+
background = $99936ad0bf67c8c4$var$generateHSL_L(orientation, dir, zValue);
|
|
563
|
+
break;
|
|
564
|
+
}
|
|
565
|
+
let { x: x , y: y } = state.getThumbPosition();
|
|
566
|
+
if (direction === "rtl") x = 1 - x;
|
|
567
|
+
let forcedColorAdjustNoneStyle = {
|
|
568
|
+
forcedColorAdjust: "none"
|
|
569
|
+
};
|
|
570
|
+
return {
|
|
571
|
+
colorAreaStyleProps: {
|
|
572
|
+
style: {
|
|
573
|
+
position: "relative",
|
|
574
|
+
touchAction: "none",
|
|
575
|
+
...forcedColorAdjustNoneStyle,
|
|
576
|
+
...background.colorAreaStyles
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
gradientStyleProps: {
|
|
580
|
+
style: {
|
|
581
|
+
touchAction: "none",
|
|
582
|
+
...forcedColorAdjustNoneStyle,
|
|
583
|
+
...background.gradientStyles
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
thumbStyleProps: {
|
|
587
|
+
style: {
|
|
588
|
+
position: "absolute",
|
|
589
|
+
left: `${x * 100}%`,
|
|
590
|
+
top: `${y * 100}%`,
|
|
591
|
+
transform: "translate(0%, 0%)",
|
|
592
|
+
touchAction: "none",
|
|
593
|
+
...forcedColorAdjustNoneStyle
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
}, [
|
|
598
|
+
direction,
|
|
599
|
+
state,
|
|
600
|
+
zChannel,
|
|
601
|
+
xChannel,
|
|
602
|
+
isDisabled
|
|
603
|
+
]);
|
|
604
|
+
return returnVal;
|
|
157
605
|
}
|
|
158
606
|
|
|
159
|
-
exports.useColorSlider = useColorSlider;
|
|
160
|
-
const $c5e318998f160f365e09b073e8447c3d$var$PAGE_MIN_STEP_SIZE = 6;
|
|
161
|
-
/**
|
|
162
|
-
* Provides the behavior and accessibility implementation for a color wheel component.
|
|
163
|
-
* Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.
|
|
164
|
-
*/
|
|
165
|
-
|
|
166
|
-
function useColorWheel(props, state, inputRef) {
|
|
167
|
-
let {
|
|
168
|
-
isDisabled,
|
|
169
|
-
step = 1,
|
|
170
|
-
innerRadius,
|
|
171
|
-
outerRadius,
|
|
172
|
-
'aria-label': ariaLabel
|
|
173
|
-
} = props;
|
|
174
|
-
let {
|
|
175
|
-
addGlobalListener,
|
|
176
|
-
removeGlobalListener
|
|
177
|
-
} = useGlobalListeners();
|
|
178
|
-
let thumbRadius = (innerRadius + outerRadius) / 2;
|
|
179
|
-
let focusInput = useCallback(() => {
|
|
180
|
-
if (inputRef.current) {
|
|
181
|
-
focusWithoutScrolling(inputRef.current);
|
|
182
|
-
}
|
|
183
|
-
}, [inputRef]);
|
|
184
|
-
let stateRef = useRef(null);
|
|
185
|
-
stateRef.current = state;
|
|
186
|
-
let currentPosition = useRef(null);
|
|
187
|
-
let moveHandler = {
|
|
188
|
-
onMoveStart() {
|
|
189
|
-
currentPosition.current = null;
|
|
190
|
-
state.setDragging(true);
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
onMove(_ref) {
|
|
194
|
-
let {
|
|
195
|
-
deltaX,
|
|
196
|
-
deltaY,
|
|
197
|
-
pointerType
|
|
198
|
-
} = _ref;
|
|
199
|
-
|
|
200
|
-
if (currentPosition.current == null) {
|
|
201
|
-
currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
currentPosition.current.x += deltaX;
|
|
205
|
-
currentPosition.current.y += deltaY;
|
|
206
|
-
|
|
207
|
-
if (pointerType === 'keyboard') {
|
|
208
|
-
if (deltaX > 0 || deltaY < 0) {
|
|
209
|
-
state.increment();
|
|
210
|
-
} else if (deltaX < 0 || deltaY > 0) {
|
|
211
|
-
state.decrement();
|
|
212
|
-
}
|
|
213
|
-
} else {
|
|
214
|
-
stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
onMoveEnd() {
|
|
219
|
-
isOnTrack.current = undefined;
|
|
220
|
-
state.setDragging(false);
|
|
221
|
-
focusInput();
|
|
222
|
-
}
|
|
223
607
|
|
|
224
|
-
};
|
|
225
|
-
let {
|
|
226
|
-
moveProps: movePropsThumb
|
|
227
|
-
} = useMove(moveHandler);
|
|
228
|
-
let currentPointer = useRef(undefined);
|
|
229
|
-
let isOnTrack = useRef(false);
|
|
230
|
-
let {
|
|
231
|
-
moveProps: movePropsContainer
|
|
232
|
-
} = useMove({
|
|
233
|
-
onMoveStart() {
|
|
234
|
-
if (isOnTrack.current) {
|
|
235
|
-
moveHandler.onMoveStart();
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
onMove(e) {
|
|
240
|
-
if (isOnTrack.current) {
|
|
241
|
-
moveHandler.onMove(e);
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
|
|
245
|
-
onMoveEnd() {
|
|
246
|
-
if (isOnTrack.current) {
|
|
247
|
-
moveHandler.onMoveEnd();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
608
|
|
|
251
|
-
});
|
|
252
609
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
610
|
+
|
|
611
|
+
function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
|
|
612
|
+
let { isDisabled: isDisabled , inputXRef: inputXRef , inputYRef: inputYRef , containerRef: containerRef , "aria-label": ariaLabel } = props;
|
|
613
|
+
let stringFormatter = (0, $kZqDi$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($4f97b428b4cbcd4e$exports))));
|
|
614
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = (0, $kZqDi$reactariautils.useGlobalListeners)();
|
|
615
|
+
let { direction: direction , locale: locale } = (0, $kZqDi$reactariai18n.useLocale)();
|
|
616
|
+
let focusedInputRef = (0, $kZqDi$react.useRef)(null);
|
|
617
|
+
let focusInput = (0, $kZqDi$react.useCallback)((inputRef = inputXRef)=>{
|
|
618
|
+
if (inputRef.current) (0, $kZqDi$reactariautils.focusWithoutScrolling)(inputRef.current);
|
|
619
|
+
}, [
|
|
620
|
+
inputXRef
|
|
621
|
+
]);
|
|
622
|
+
let stateRef = (0, $kZqDi$react.useRef)(null);
|
|
623
|
+
stateRef.current = state;
|
|
624
|
+
let { xChannel: xChannel , yChannel: yChannel , zChannel: zChannel } = stateRef.current.channels;
|
|
625
|
+
let xChannelStep = stateRef.current.xChannelStep;
|
|
626
|
+
let yChannelStep = stateRef.current.yChannelStep;
|
|
627
|
+
let currentPosition = (0, $kZqDi$react.useRef)(null);
|
|
628
|
+
let { keyboardProps: keyboardProps } = (0, $kZqDi$reactariainteractions.useKeyboard)({
|
|
629
|
+
onKeyDown (e) {
|
|
630
|
+
// these are the cases that useMove doesn't handle
|
|
631
|
+
if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
|
|
632
|
+
e.continuePropagation();
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
// same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
|
|
636
|
+
e.preventDefault();
|
|
637
|
+
// remember to set this and unset it so that onChangeEnd is fired
|
|
638
|
+
stateRef.current.setDragging(true);
|
|
639
|
+
valueChangedViaKeyboard.current = true;
|
|
640
|
+
switch(e.key){
|
|
641
|
+
case "PageUp":
|
|
642
|
+
stateRef.current.incrementY(stateRef.current.yChannelPageStep);
|
|
643
|
+
focusedInputRef.current = inputYRef.current;
|
|
644
|
+
break;
|
|
645
|
+
case "PageDown":
|
|
646
|
+
stateRef.current.decrementY(stateRef.current.yChannelPageStep);
|
|
647
|
+
focusedInputRef.current = inputYRef.current;
|
|
648
|
+
break;
|
|
649
|
+
case "Home":
|
|
650
|
+
direction === "rtl" ? stateRef.current.incrementX(stateRef.current.xChannelPageStep) : stateRef.current.decrementX(stateRef.current.xChannelPageStep);
|
|
651
|
+
focusedInputRef.current = inputXRef.current;
|
|
652
|
+
break;
|
|
653
|
+
case "End":
|
|
654
|
+
direction === "rtl" ? stateRef.current.decrementX(stateRef.current.xChannelPageStep) : stateRef.current.incrementX(stateRef.current.xChannelPageStep);
|
|
655
|
+
focusedInputRef.current = inputXRef.current;
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
stateRef.current.setDragging(false);
|
|
659
|
+
if (focusedInputRef.current) focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
let moveHandler = {
|
|
663
|
+
onMoveStart () {
|
|
664
|
+
currentPosition.current = null;
|
|
665
|
+
stateRef.current.setDragging(true);
|
|
666
|
+
},
|
|
667
|
+
onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
|
|
668
|
+
let { incrementX: incrementX , decrementX: decrementX , incrementY: incrementY , decrementY: decrementY , xChannelPageStep: xChannelPageStep , xChannelStep: xChannelStep , yChannelPageStep: yChannelPageStep , yChannelStep: yChannelStep , getThumbPosition: getThumbPosition , setColorFromPoint: setColorFromPoint } = stateRef.current;
|
|
669
|
+
if (currentPosition.current == null) currentPosition.current = getThumbPosition();
|
|
670
|
+
let { width: width , height: height } = containerRef.current.getBoundingClientRect();
|
|
671
|
+
let valueChanged = deltaX !== 0 || deltaY !== 0;
|
|
672
|
+
if (pointerType === "keyboard") {
|
|
673
|
+
let deltaXValue = shiftKey && xChannelPageStep > xChannelStep ? xChannelPageStep : xChannelStep;
|
|
674
|
+
let deltaYValue = shiftKey && yChannelPageStep > yChannelStep ? yChannelPageStep : yChannelStep;
|
|
675
|
+
if (deltaX > 0 && direction === "ltr" || deltaX < 0 && direction === "rtl") incrementX(deltaXValue);
|
|
676
|
+
else if (deltaX < 0 && direction === "ltr" || deltaX > 0 && direction === "rtl") decrementX(deltaXValue);
|
|
677
|
+
else if (deltaY > 0) decrementY(deltaYValue);
|
|
678
|
+
else if (deltaY < 0) incrementY(deltaYValue);
|
|
679
|
+
valueChangedViaKeyboard.current = valueChanged;
|
|
680
|
+
// set the focused input based on which axis has the greater delta
|
|
681
|
+
focusedInputRef.current = valueChanged && Math.abs(deltaY) > Math.abs(deltaX) ? inputYRef.current : inputXRef.current;
|
|
682
|
+
} else {
|
|
683
|
+
currentPosition.current.x += (direction === "rtl" ? -1 : 1) * deltaX / width;
|
|
684
|
+
currentPosition.current.y += deltaY / height;
|
|
685
|
+
setColorFromPoint(currentPosition.current.x, currentPosition.current.y);
|
|
686
|
+
}
|
|
687
|
+
},
|
|
688
|
+
onMoveEnd () {
|
|
689
|
+
isOnColorArea.current = undefined;
|
|
690
|
+
stateRef.current.setDragging(false);
|
|
691
|
+
focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
let { moveProps: movePropsThumb } = (0, $kZqDi$reactariainteractions.useMove)(moveHandler);
|
|
695
|
+
let valueChangedViaKeyboard = (0, $kZqDi$react.useRef)(false);
|
|
696
|
+
let { focusWithinProps: focusWithinProps } = (0, $kZqDi$reactariainteractions.useFocusWithin)({
|
|
697
|
+
onFocusWithinChange: (focusWithin)=>{
|
|
698
|
+
if (!focusWithin) {
|
|
699
|
+
valueChangedViaKeyboard.current = false;
|
|
700
|
+
focusedInputRef.current;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
let currentPointer = (0, $kZqDi$react.useRef)(undefined);
|
|
705
|
+
let isOnColorArea = (0, $kZqDi$react.useRef)(false);
|
|
706
|
+
let { moveProps: movePropsContainer } = (0, $kZqDi$reactariainteractions.useMove)({
|
|
707
|
+
onMoveStart () {
|
|
708
|
+
if (isOnColorArea.current) moveHandler.onMoveStart();
|
|
709
|
+
},
|
|
710
|
+
onMove (e) {
|
|
711
|
+
if (isOnColorArea.current) moveHandler.onMove(e);
|
|
712
|
+
},
|
|
713
|
+
onMoveEnd () {
|
|
714
|
+
if (isOnColorArea.current) moveHandler.onMoveEnd();
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
let onThumbDown = (id)=>{
|
|
718
|
+
if (!state.isDragging) {
|
|
719
|
+
currentPointer.current = id;
|
|
720
|
+
valueChangedViaKeyboard.current = false;
|
|
721
|
+
focusInput();
|
|
722
|
+
state.setDragging(true);
|
|
723
|
+
if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onThumbUp, false);
|
|
724
|
+
else {
|
|
725
|
+
addGlobalListener(window, "mouseup", onThumbUp, false);
|
|
726
|
+
addGlobalListener(window, "touchend", onThumbUp, false);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
let onThumbUp = (e)=>{
|
|
731
|
+
var _e_changedTouches;
|
|
732
|
+
var _e_pointerId;
|
|
733
|
+
let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
|
|
734
|
+
if (id === currentPointer.current) {
|
|
735
|
+
valueChangedViaKeyboard.current = false;
|
|
736
|
+
focusInput();
|
|
737
|
+
state.setDragging(false);
|
|
738
|
+
currentPointer.current = undefined;
|
|
739
|
+
isOnColorArea.current = false;
|
|
740
|
+
if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onThumbUp, false);
|
|
741
|
+
else {
|
|
742
|
+
removeGlobalListener(window, "mouseup", onThumbUp, false);
|
|
743
|
+
removeGlobalListener(window, "touchend", onThumbUp, false);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
let onColorAreaDown = (colorArea, id, clientX, clientY)=>{
|
|
748
|
+
let rect = colorArea.getBoundingClientRect();
|
|
749
|
+
let { width: width , height: height } = rect;
|
|
750
|
+
let x = (clientX - rect.x) / width;
|
|
751
|
+
let y = (clientY - rect.y) / height;
|
|
752
|
+
if (direction === "rtl") x = 1 - x;
|
|
753
|
+
if (x >= 0 && x <= 1 && y >= 0 && y <= 1 && !state.isDragging && currentPointer.current === undefined) {
|
|
754
|
+
isOnColorArea.current = true;
|
|
755
|
+
valueChangedViaKeyboard.current = false;
|
|
756
|
+
currentPointer.current = id;
|
|
757
|
+
state.setColorFromPoint(x, y);
|
|
758
|
+
focusInput();
|
|
759
|
+
state.setDragging(true);
|
|
760
|
+
if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onColorAreaUp, false);
|
|
761
|
+
else {
|
|
762
|
+
addGlobalListener(window, "mouseup", onColorAreaUp, false);
|
|
763
|
+
addGlobalListener(window, "touchend", onColorAreaUp, false);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
let onColorAreaUp = (e)=>{
|
|
768
|
+
var _e_changedTouches;
|
|
769
|
+
var _e_pointerId;
|
|
770
|
+
let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
|
|
771
|
+
if (isOnColorArea.current && id === currentPointer.current) {
|
|
772
|
+
isOnColorArea.current = false;
|
|
773
|
+
valueChangedViaKeyboard.current = false;
|
|
774
|
+
currentPointer.current = undefined;
|
|
775
|
+
state.setDragging(false);
|
|
776
|
+
focusInput();
|
|
777
|
+
if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onColorAreaUp, false);
|
|
778
|
+
else {
|
|
779
|
+
removeGlobalListener(window, "mouseup", onColorAreaUp, false);
|
|
780
|
+
removeGlobalListener(window, "touchend", onColorAreaUp, false);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
let colorAreaInteractions = isDisabled ? {} : (0, $kZqDi$reactariautils.mergeProps)({
|
|
785
|
+
...typeof PointerEvent !== "undefined" ? {
|
|
786
|
+
onPointerDown: (e)=>{
|
|
787
|
+
if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
788
|
+
onColorAreaDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
|
|
789
|
+
}
|
|
790
|
+
} : {
|
|
791
|
+
onMouseDown: (e)=>{
|
|
792
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
793
|
+
onColorAreaDown(e.currentTarget, undefined, e.clientX, e.clientY);
|
|
794
|
+
},
|
|
795
|
+
onTouchStart: (e)=>{
|
|
796
|
+
onColorAreaDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}, movePropsContainer);
|
|
800
|
+
let thumbInteractions = isDisabled ? {} : (0, $kZqDi$reactariautils.mergeProps)({
|
|
801
|
+
...typeof PointerEvent !== "undefined" ? {
|
|
802
|
+
onPointerDown: (e)=>{
|
|
803
|
+
if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
804
|
+
onThumbDown(e.pointerId);
|
|
805
|
+
}
|
|
806
|
+
} : {
|
|
807
|
+
onMouseDown: (e)=>{
|
|
808
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
809
|
+
onThumbDown(undefined);
|
|
810
|
+
},
|
|
811
|
+
onTouchStart: (e)=>{
|
|
812
|
+
onThumbDown(e.changedTouches[0].identifier);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}, focusWithinProps, keyboardProps, movePropsThumb);
|
|
816
|
+
let { focusProps: xInputFocusProps } = (0, $kZqDi$reactariainteractions.useFocus)({
|
|
817
|
+
onFocus: ()=>{
|
|
818
|
+
focusedInputRef.current = inputXRef.current;
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
let { focusProps: yInputFocusProps } = (0, $kZqDi$reactariainteractions.useFocus)({
|
|
822
|
+
onFocus: ()=>{
|
|
823
|
+
focusedInputRef.current = inputYRef.current;
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
let isMobile = (0, $kZqDi$reactariautils.isIOS)() || (0, $kZqDi$reactariautils.isAndroid)();
|
|
827
|
+
function getAriaValueTextForChannel(channel) {
|
|
828
|
+
return valueChangedViaKeyboard.current ? stringFormatter.format("colorNameAndValue", {
|
|
829
|
+
name: state.value.getChannelName(channel, locale),
|
|
830
|
+
value: state.value.formatChannelValue(channel, locale)
|
|
831
|
+
}) : [
|
|
832
|
+
stringFormatter.format("colorNameAndValue", {
|
|
833
|
+
name: state.value.getChannelName(channel, locale),
|
|
834
|
+
value: state.value.formatChannelValue(channel, locale)
|
|
835
|
+
}),
|
|
836
|
+
stringFormatter.format("colorNameAndValue", {
|
|
837
|
+
name: state.value.getChannelName(channel === yChannel ? xChannel : yChannel, locale),
|
|
838
|
+
value: state.value.formatChannelValue(channel === yChannel ? xChannel : yChannel, locale)
|
|
839
|
+
})
|
|
840
|
+
].join(", ");
|
|
261
841
|
}
|
|
262
|
-
|
|
842
|
+
let colorPickerLabel = stringFormatter.format("colorPicker");
|
|
843
|
+
let xInputLabellingProps = (0, $kZqDi$reactariautils.useLabels)({
|
|
844
|
+
...props,
|
|
845
|
+
"aria-label": ariaLabel ? stringFormatter.format("colorInputLabel", {
|
|
846
|
+
label: ariaLabel,
|
|
847
|
+
channelLabel: colorPickerLabel
|
|
848
|
+
}) : colorPickerLabel
|
|
849
|
+
});
|
|
850
|
+
let yInputLabellingProps = (0, $kZqDi$reactariautils.useLabels)({
|
|
851
|
+
...props,
|
|
852
|
+
"aria-label": ariaLabel ? stringFormatter.format("colorInputLabel", {
|
|
853
|
+
label: ariaLabel,
|
|
854
|
+
channelLabel: colorPickerLabel
|
|
855
|
+
}) : colorPickerLabel
|
|
856
|
+
});
|
|
857
|
+
let colorAreaLabellingProps = (0, $kZqDi$reactariautils.useLabels)({
|
|
858
|
+
...props,
|
|
859
|
+
"aria-label": ariaLabel ? `${ariaLabel}, ${colorPickerLabel}` : undefined
|
|
860
|
+
}, isMobile ? colorPickerLabel : undefined);
|
|
861
|
+
let ariaRoleDescription = stringFormatter.format("twoDimensionalSlider");
|
|
862
|
+
let { visuallyHiddenProps: visuallyHiddenProps } = (0, $kZqDi$reactariavisuallyhidden.useVisuallyHidden)({
|
|
863
|
+
style: {
|
|
864
|
+
opacity: "0.0001",
|
|
865
|
+
width: "100%",
|
|
866
|
+
height: "100%",
|
|
867
|
+
pointerEvents: "none"
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
let { colorAreaStyleProps: colorAreaStyleProps , gradientStyleProps: gradientStyleProps , thumbStyleProps: thumbStyleProps } = (0, $99936ad0bf67c8c4$export$dd62420467d245ca)({
|
|
871
|
+
direction: direction,
|
|
872
|
+
state: state,
|
|
873
|
+
xChannel: xChannel,
|
|
874
|
+
zChannel: zChannel,
|
|
875
|
+
isDisabled: props.isDisabled
|
|
876
|
+
});
|
|
877
|
+
return {
|
|
878
|
+
colorAreaProps: {
|
|
879
|
+
...colorAreaLabellingProps,
|
|
880
|
+
...colorAreaInteractions,
|
|
881
|
+
...colorAreaStyleProps,
|
|
882
|
+
role: "group"
|
|
883
|
+
},
|
|
884
|
+
gradientProps: {
|
|
885
|
+
...gradientStyleProps,
|
|
886
|
+
role: "presentation"
|
|
887
|
+
},
|
|
888
|
+
thumbProps: {
|
|
889
|
+
...thumbInteractions,
|
|
890
|
+
...thumbStyleProps,
|
|
891
|
+
role: "presentation"
|
|
892
|
+
},
|
|
893
|
+
xInputProps: {
|
|
894
|
+
...xInputLabellingProps,
|
|
895
|
+
...visuallyHiddenProps,
|
|
896
|
+
...xInputFocusProps,
|
|
897
|
+
type: "range",
|
|
898
|
+
min: state.value.getChannelRange(xChannel).minValue,
|
|
899
|
+
max: state.value.getChannelRange(xChannel).maxValue,
|
|
900
|
+
step: xChannelStep,
|
|
901
|
+
"aria-roledescription": ariaRoleDescription,
|
|
902
|
+
"aria-valuetext": getAriaValueTextForChannel(xChannel),
|
|
903
|
+
disabled: isDisabled,
|
|
904
|
+
value: state.value.getChannelValue(xChannel),
|
|
905
|
+
tabIndex: isMobile || !focusedInputRef.current || focusedInputRef.current === inputXRef.current ? undefined : -1,
|
|
906
|
+
/*
|
|
907
|
+
So that only a single "2d slider" control shows up when listing form elements for screen readers,
|
|
908
|
+
add aria-hidden="true" to the unfocused control when the value has not changed via the keyboard,
|
|
909
|
+
but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
|
|
910
|
+
*/ "aria-hidden": isMobile || !focusedInputRef.current || focusedInputRef.current === inputXRef.current || valueChangedViaKeyboard.current ? undefined : "true",
|
|
911
|
+
onChange: (e)=>{
|
|
912
|
+
state.setXValue(parseFloat(e.target.value));
|
|
913
|
+
}
|
|
914
|
+
},
|
|
915
|
+
yInputProps: {
|
|
916
|
+
...yInputLabellingProps,
|
|
917
|
+
...visuallyHiddenProps,
|
|
918
|
+
...yInputFocusProps,
|
|
919
|
+
type: "range",
|
|
920
|
+
min: state.value.getChannelRange(yChannel).minValue,
|
|
921
|
+
max: state.value.getChannelRange(yChannel).maxValue,
|
|
922
|
+
step: yChannelStep,
|
|
923
|
+
"aria-roledescription": ariaRoleDescription,
|
|
924
|
+
"aria-valuetext": getAriaValueTextForChannel(yChannel),
|
|
925
|
+
"aria-orientation": "vertical",
|
|
926
|
+
disabled: isDisabled,
|
|
927
|
+
value: state.value.getChannelValue(yChannel),
|
|
928
|
+
tabIndex: isMobile || focusedInputRef.current && focusedInputRef.current === inputYRef.current ? undefined : -1,
|
|
929
|
+
/*
|
|
930
|
+
So that only a single "2d slider" control shows up when listing form elements for screen readers,
|
|
931
|
+
add aria-hidden="true" to the unfocused input when the value has not changed via the keyboard,
|
|
932
|
+
but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
|
|
933
|
+
*/ "aria-hidden": isMobile || focusedInputRef.current && focusedInputRef.current === inputYRef.current || valueChangedViaKeyboard.current ? undefined : "true",
|
|
934
|
+
onChange: (e)=>{
|
|
935
|
+
state.setYValue(parseFloat(e.target.value));
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
}
|
|
263
940
|
|
|
264
|
-
let onThumbUp = e => {
|
|
265
|
-
var _e$pointerId, _e$changedTouches;
|
|
266
941
|
|
|
267
|
-
|
|
942
|
+
/*
|
|
943
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
944
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
945
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
946
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
947
|
+
*
|
|
948
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
949
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
950
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
951
|
+
* governing permissions and limitations under the License.
|
|
952
|
+
*/
|
|
268
953
|
|
|
269
|
-
if (id === currentPointer.current) {
|
|
270
|
-
focusInput();
|
|
271
|
-
state.setDragging(false);
|
|
272
|
-
currentPointer.current = undefined;
|
|
273
|
-
isOnTrack.current = false;
|
|
274
|
-
removeGlobalListener(window, 'mouseup', onThumbUp, false);
|
|
275
|
-
removeGlobalListener(window, 'touchend', onThumbUp, false);
|
|
276
|
-
removeGlobalListener(window, 'pointerup', onThumbUp, false);
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
let onTrackDown = (track, id, pageX, pageY) => {
|
|
281
|
-
let rect = track.getBoundingClientRect();
|
|
282
|
-
let x = pageX - rect.x - rect.width / 2;
|
|
283
|
-
let y = pageY - rect.y - rect.height / 2;
|
|
284
|
-
let radius = Math.sqrt(x * x + y * y);
|
|
285
|
-
|
|
286
|
-
if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {
|
|
287
|
-
isOnTrack.current = true;
|
|
288
|
-
currentPointer.current = id;
|
|
289
|
-
stateRef.current.setHueFromPoint(x, y, radius);
|
|
290
|
-
focusInput();
|
|
291
|
-
state.setDragging(true);
|
|
292
|
-
addGlobalListener(window, 'mouseup', onTrackUp, false);
|
|
293
|
-
addGlobalListener(window, 'touchend', onTrackUp, false);
|
|
294
|
-
addGlobalListener(window, 'pointerup', onTrackUp, false);
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
954
|
|
|
298
|
-
|
|
299
|
-
|
|
955
|
+
function $afbb9647440a7f5b$export$106b7a4e66508f66(props, state) {
|
|
956
|
+
let { trackRef: trackRef , inputRef: inputRef , orientation: orientation , channel: channel , "aria-label": ariaLabel } = props;
|
|
957
|
+
let { locale: locale , direction: direction } = (0, $kZqDi$reactariai18n.useLocale)();
|
|
958
|
+
// Provide a default aria-label if there is no other label provided.
|
|
959
|
+
if (!props.label && !ariaLabel && !props["aria-labelledby"]) ariaLabel = state.value.getChannelName(channel, locale);
|
|
960
|
+
// @ts-ignore - ignore unused incompatible props
|
|
961
|
+
let { groupProps: groupProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = (0, $kZqDi$reactariaslider.useSlider)({
|
|
962
|
+
...props,
|
|
963
|
+
"aria-label": ariaLabel
|
|
964
|
+
}, state, trackRef);
|
|
965
|
+
let { inputProps: inputProps , thumbProps: thumbProps } = (0, $kZqDi$reactariaslider.useSliderThumb)({
|
|
966
|
+
index: 0,
|
|
967
|
+
orientation: orientation,
|
|
968
|
+
isDisabled: props.isDisabled,
|
|
969
|
+
trackRef: trackRef,
|
|
970
|
+
inputRef: inputRef
|
|
971
|
+
}, state);
|
|
972
|
+
let generateBackground = ()=>{
|
|
973
|
+
let value = state.getDisplayColor();
|
|
974
|
+
let to;
|
|
975
|
+
if (orientation === "vertical") to = "top";
|
|
976
|
+
else if (direction === "ltr") to = "right";
|
|
977
|
+
else to = "left";
|
|
978
|
+
switch(channel){
|
|
979
|
+
case "hue":
|
|
980
|
+
return `linear-gradient(to ${to}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;
|
|
981
|
+
case "lightness":
|
|
982
|
+
{
|
|
983
|
+
// We have to add an extra color stop in the middle so that the hue shows up at all.
|
|
984
|
+
// Otherwise it will always just be black to white.
|
|
985
|
+
let min = state.getThumbMinValue(0);
|
|
986
|
+
let max = state.getThumbMaxValue(0);
|
|
987
|
+
let start = value.withChannelValue(channel, min).toString("css");
|
|
988
|
+
let middle = value.withChannelValue(channel, (max - min) / 2).toString("css");
|
|
989
|
+
let end = value.withChannelValue(channel, max).toString("css");
|
|
990
|
+
return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;
|
|
991
|
+
}
|
|
992
|
+
case "saturation":
|
|
993
|
+
case "brightness":
|
|
994
|
+
case "red":
|
|
995
|
+
case "green":
|
|
996
|
+
case "blue":
|
|
997
|
+
case "alpha":
|
|
998
|
+
{
|
|
999
|
+
let start1 = value.withChannelValue(channel, state.getThumbMinValue(0)).toString("css");
|
|
1000
|
+
let end1 = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString("css");
|
|
1001
|
+
return `linear-gradient(to ${to}, ${start1}, ${end1})`;
|
|
1002
|
+
}
|
|
1003
|
+
default:
|
|
1004
|
+
throw new Error("Unknown color channel: " + channel);
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1007
|
+
let forcedColorAdjustNoneStyle = {
|
|
1008
|
+
forcedColorAdjust: "none"
|
|
1009
|
+
};
|
|
1010
|
+
return {
|
|
1011
|
+
trackProps: {
|
|
1012
|
+
...(0, $kZqDi$reactariautils.mergeProps)(groupProps, trackProps),
|
|
1013
|
+
style: {
|
|
1014
|
+
...trackProps.style,
|
|
1015
|
+
...forcedColorAdjustNoneStyle,
|
|
1016
|
+
background: generateBackground()
|
|
1017
|
+
}
|
|
1018
|
+
},
|
|
1019
|
+
inputProps: inputProps,
|
|
1020
|
+
thumbProps: {
|
|
1021
|
+
...thumbProps,
|
|
1022
|
+
style: {
|
|
1023
|
+
...thumbProps.style,
|
|
1024
|
+
...forcedColorAdjustNoneStyle
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
labelProps: labelProps,
|
|
1028
|
+
outputProps: outputProps
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
300
1031
|
|
|
301
|
-
let id = (_e$pointerId2 = e.pointerId) != null ? _e$pointerId2 : (_e$changedTouches2 = e.changedTouches) == null ? void 0 : _e$changedTouches2[0].identifier;
|
|
302
1032
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
let {
|
|
315
|
-
keyboardProps
|
|
316
|
-
} = useKeyboard({
|
|
317
|
-
onKeyDown(e) {
|
|
318
|
-
switch (e.key) {
|
|
319
|
-
case 'PageUp':
|
|
320
|
-
e.preventDefault();
|
|
321
|
-
state.increment($c5e318998f160f365e09b073e8447c3d$var$PAGE_MIN_STEP_SIZE);
|
|
322
|
-
break;
|
|
323
|
-
|
|
324
|
-
case 'PageDown':
|
|
325
|
-
e.preventDefault();
|
|
326
|
-
state.decrement($c5e318998f160f365e09b073e8447c3d$var$PAGE_MIN_STEP_SIZE);
|
|
327
|
-
break;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
1033
|
+
/*
|
|
1034
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
1035
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1036
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1037
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1038
|
+
*
|
|
1039
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1040
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1041
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1042
|
+
* governing permissions and limitations under the License.
|
|
1043
|
+
*/
|
|
330
1044
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
},
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
function $1d29bf243d4a9a53$export$9064ff4e44b3729a(props, state, inputRef) {
|
|
1048
|
+
let { isDisabled: isDisabled , innerRadius: innerRadius , outerRadius: outerRadius , "aria-label": ariaLabel } = props;
|
|
1049
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = (0, $kZqDi$reactariautils.useGlobalListeners)();
|
|
1050
|
+
let thumbRadius = (innerRadius + outerRadius) / 2;
|
|
1051
|
+
let focusInput = (0, $kZqDi$react.useCallback)(()=>{
|
|
1052
|
+
if (inputRef.current) (0, $kZqDi$reactariautils.focusWithoutScrolling)(inputRef.current);
|
|
1053
|
+
}, [
|
|
1054
|
+
inputRef
|
|
1055
|
+
]);
|
|
1056
|
+
let stateRef = (0, $kZqDi$react.useRef)(null);
|
|
1057
|
+
stateRef.current = state;
|
|
1058
|
+
let currentPosition = (0, $kZqDi$react.useRef)(null);
|
|
1059
|
+
let { keyboardProps: keyboardProps } = (0, $kZqDi$reactariainteractions.useKeyboard)({
|
|
1060
|
+
onKeyDown (e) {
|
|
1061
|
+
// these are the cases that useMove doesn't handle
|
|
1062
|
+
if (!/^(PageUp|PageDown)$/.test(e.key)) {
|
|
1063
|
+
e.continuePropagation();
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
// same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
|
|
1067
|
+
e.preventDefault();
|
|
1068
|
+
// remember to set this and unset it so that onChangeEnd is fired
|
|
1069
|
+
stateRef.current.setDragging(true);
|
|
1070
|
+
switch(e.key){
|
|
1071
|
+
case "PageUp":
|
|
1072
|
+
e.preventDefault();
|
|
1073
|
+
state.increment(stateRef.current.pageStep);
|
|
1074
|
+
break;
|
|
1075
|
+
case "PageDown":
|
|
1076
|
+
e.preventDefault();
|
|
1077
|
+
state.decrement(stateRef.current.pageStep);
|
|
1078
|
+
break;
|
|
1079
|
+
}
|
|
1080
|
+
stateRef.current.setDragging(false);
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
let moveHandler = {
|
|
1084
|
+
onMoveStart () {
|
|
1085
|
+
currentPosition.current = null;
|
|
1086
|
+
state.setDragging(true);
|
|
1087
|
+
},
|
|
1088
|
+
onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
|
|
1089
|
+
if (currentPosition.current == null) currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);
|
|
1090
|
+
currentPosition.current.x += deltaX;
|
|
1091
|
+
currentPosition.current.y += deltaY;
|
|
1092
|
+
if (pointerType === "keyboard") {
|
|
1093
|
+
if (deltaX > 0 || deltaY < 0) state.increment(shiftKey ? stateRef.current.pageStep : stateRef.current.step);
|
|
1094
|
+
else if (deltaX < 0 || deltaY > 0) state.decrement(shiftKey ? stateRef.current.pageStep : stateRef.current.step);
|
|
1095
|
+
} else stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
|
|
1096
|
+
},
|
|
1097
|
+
onMoveEnd () {
|
|
1098
|
+
isOnTrack.current = undefined;
|
|
1099
|
+
state.setDragging(false);
|
|
1100
|
+
focusInput();
|
|
1101
|
+
}
|
|
1102
|
+
};
|
|
1103
|
+
let { moveProps: movePropsThumb } = (0, $kZqDi$reactariainteractions.useMove)(moveHandler);
|
|
1104
|
+
let currentPointer = (0, $kZqDi$react.useRef)(undefined);
|
|
1105
|
+
let isOnTrack = (0, $kZqDi$react.useRef)(false);
|
|
1106
|
+
let { moveProps: movePropsContainer } = (0, $kZqDi$reactariainteractions.useMove)({
|
|
1107
|
+
onMoveStart () {
|
|
1108
|
+
if (isOnTrack.current) moveHandler.onMoveStart();
|
|
1109
|
+
},
|
|
1110
|
+
onMove (e) {
|
|
1111
|
+
if (isOnTrack.current) moveHandler.onMove(e);
|
|
1112
|
+
},
|
|
1113
|
+
onMoveEnd () {
|
|
1114
|
+
if (isOnTrack.current) moveHandler.onMoveEnd();
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
let onThumbDown = (id)=>{
|
|
1118
|
+
if (!state.isDragging) {
|
|
1119
|
+
currentPointer.current = id;
|
|
1120
|
+
focusInput();
|
|
1121
|
+
state.setDragging(true);
|
|
1122
|
+
if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onThumbUp, false);
|
|
1123
|
+
else {
|
|
1124
|
+
addGlobalListener(window, "mouseup", onThumbUp, false);
|
|
1125
|
+
addGlobalListener(window, "touchend", onThumbUp, false);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
let onThumbUp = (e)=>{
|
|
1130
|
+
var _e_changedTouches;
|
|
1131
|
+
var _e_pointerId;
|
|
1132
|
+
let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
|
|
1133
|
+
if (id === currentPointer.current) {
|
|
1134
|
+
focusInput();
|
|
1135
|
+
state.setDragging(false);
|
|
1136
|
+
currentPointer.current = undefined;
|
|
1137
|
+
isOnTrack.current = false;
|
|
1138
|
+
if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onThumbUp, false);
|
|
1139
|
+
else {
|
|
1140
|
+
removeGlobalListener(window, "mouseup", onThumbUp, false);
|
|
1141
|
+
removeGlobalListener(window, "touchend", onThumbUp, false);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
let onTrackDown = (track, id, pageX, pageY)=>{
|
|
1146
|
+
let rect = track.getBoundingClientRect();
|
|
1147
|
+
let x = pageX - rect.x - rect.width / 2;
|
|
1148
|
+
let y = pageY - rect.y - rect.height / 2;
|
|
1149
|
+
let radius = Math.sqrt(x * x + y * y);
|
|
1150
|
+
if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {
|
|
1151
|
+
isOnTrack.current = true;
|
|
1152
|
+
currentPointer.current = id;
|
|
1153
|
+
stateRef.current.setHueFromPoint(x, y, radius);
|
|
1154
|
+
focusInput();
|
|
1155
|
+
state.setDragging(true);
|
|
1156
|
+
if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onTrackUp, false);
|
|
1157
|
+
else {
|
|
1158
|
+
addGlobalListener(window, "mouseup", onTrackUp, false);
|
|
1159
|
+
addGlobalListener(window, "touchend", onTrackUp, false);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
let onTrackUp = (e)=>{
|
|
1164
|
+
var _e_changedTouches;
|
|
1165
|
+
var _e_pointerId;
|
|
1166
|
+
let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
|
|
1167
|
+
if (isOnTrack.current && id === currentPointer.current) {
|
|
1168
|
+
isOnTrack.current = false;
|
|
1169
|
+
currentPointer.current = undefined;
|
|
1170
|
+
state.setDragging(false);
|
|
1171
|
+
focusInput();
|
|
1172
|
+
if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onTrackUp, false);
|
|
1173
|
+
else {
|
|
1174
|
+
removeGlobalListener(window, "mouseup", onTrackUp, false);
|
|
1175
|
+
removeGlobalListener(window, "touchend", onTrackUp, false);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
let trackInteractions = isDisabled ? {} : (0, $kZqDi$reactariautils.mergeProps)({
|
|
1180
|
+
...typeof PointerEvent !== "undefined" ? {
|
|
1181
|
+
onPointerDown: (e)=>{
|
|
1182
|
+
if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
1183
|
+
onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
|
|
1184
|
+
}
|
|
1185
|
+
} : {
|
|
1186
|
+
onMouseDown: (e)=>{
|
|
1187
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
1188
|
+
onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);
|
|
1189
|
+
},
|
|
1190
|
+
onTouchStart: (e)=>{
|
|
1191
|
+
onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}, movePropsContainer);
|
|
1195
|
+
let thumbInteractions = isDisabled ? {} : (0, $kZqDi$reactariautils.mergeProps)({
|
|
1196
|
+
onMouseDown: (e)=>{
|
|
1197
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
1198
|
+
onThumbDown(undefined);
|
|
1199
|
+
},
|
|
1200
|
+
onPointerDown: (e)=>{
|
|
1201
|
+
if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
1202
|
+
onThumbDown(e.pointerId);
|
|
1203
|
+
},
|
|
1204
|
+
onTouchStart: (e)=>{
|
|
1205
|
+
onThumbDown(e.changedTouches[0].identifier);
|
|
1206
|
+
}
|
|
1207
|
+
}, keyboardProps, movePropsThumb);
|
|
1208
|
+
let { x: x , y: y } = state.getThumbPosition(thumbRadius);
|
|
1209
|
+
// Provide a default aria-label if none is given
|
|
1210
|
+
let { locale: locale } = (0, $kZqDi$reactariai18n.useLocale)();
|
|
1211
|
+
if (ariaLabel == null && props["aria-labelledby"] == null) ariaLabel = state.value.getChannelName("hue", locale);
|
|
1212
|
+
let inputLabellingProps = (0, $kZqDi$reactariautils.useLabels)({
|
|
1213
|
+
...props,
|
|
1214
|
+
"aria-label": ariaLabel
|
|
1215
|
+
});
|
|
1216
|
+
let { minValue: minValue , maxValue: maxValue , step: step } = state.value.getChannelRange("hue");
|
|
1217
|
+
let forcedColorAdjustNoneStyle = {
|
|
1218
|
+
forcedColorAdjust: "none"
|
|
1219
|
+
};
|
|
1220
|
+
return {
|
|
1221
|
+
trackProps: {
|
|
1222
|
+
...trackInteractions,
|
|
1223
|
+
style: {
|
|
1224
|
+
position: "relative",
|
|
1225
|
+
touchAction: "none",
|
|
1226
|
+
width: outerRadius * 2,
|
|
1227
|
+
height: outerRadius * 2,
|
|
1228
|
+
background: `
|
|
1229
|
+
conic-gradient(
|
|
1230
|
+
from 90deg,
|
|
1231
|
+
hsl(0, 100%, 50%),
|
|
1232
|
+
hsl(30, 100%, 50%),
|
|
1233
|
+
hsl(60, 100%, 50%),
|
|
1234
|
+
hsl(90, 100%, 50%),
|
|
1235
|
+
hsl(120, 100%, 50%),
|
|
1236
|
+
hsl(150, 100%, 50%),
|
|
1237
|
+
hsl(180, 100%, 50%),
|
|
1238
|
+
hsl(210, 100%, 50%),
|
|
1239
|
+
hsl(240, 100%, 50%),
|
|
1240
|
+
hsl(270, 100%, 50%),
|
|
1241
|
+
hsl(300, 100%, 50%),
|
|
1242
|
+
hsl(330, 100%, 50%),
|
|
1243
|
+
hsl(360, 100%, 50%)
|
|
1244
|
+
)
|
|
1245
|
+
`,
|
|
1246
|
+
clipPath: `path(evenodd, "${$1d29bf243d4a9a53$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$1d29bf243d4a9a53$var$circlePath(outerRadius, outerRadius, innerRadius)}")`,
|
|
1247
|
+
...forcedColorAdjustNoneStyle
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
thumbProps: {
|
|
1251
|
+
...thumbInteractions,
|
|
1252
|
+
style: {
|
|
1253
|
+
position: "absolute",
|
|
1254
|
+
left: "50%",
|
|
1255
|
+
top: "50%",
|
|
1256
|
+
transform: `translate(calc(${x}px - 50%), calc(${y}px - 50%))`,
|
|
1257
|
+
touchAction: "none",
|
|
1258
|
+
...forcedColorAdjustNoneStyle
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
inputProps: (0, $kZqDi$reactariautils.mergeProps)(inputLabellingProps, {
|
|
1262
|
+
type: "range",
|
|
1263
|
+
min: String(minValue),
|
|
1264
|
+
max: String(maxValue),
|
|
1265
|
+
step: String(step),
|
|
1266
|
+
"aria-valuetext": state.value.formatChannelValue("hue", locale),
|
|
1267
|
+
disabled: isDisabled,
|
|
1268
|
+
value: `${state.value.getChannelValue("hue")}`,
|
|
1269
|
+
onChange: (e)=>{
|
|
1270
|
+
state.setHue(parseFloat(e.target.value));
|
|
1271
|
+
}
|
|
1272
|
+
})
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1275
|
+
// Creates an SVG path string for a circle.
|
|
1276
|
+
function $1d29bf243d4a9a53$var$circlePath(cx, cy, r) {
|
|
1277
|
+
return `M ${cx}, ${cy} m ${-r}, 0 a ${r}, ${r}, 0, 1, 0, ${r * 2}, 0 a ${r}, ${r}, 0, 1, 0 ${-r * 2}, 0`;
|
|
426
1278
|
}
|
|
427
1279
|
|
|
428
|
-
/**
|
|
429
|
-
* Provides the behavior and accessibility implementation for a color field component.
|
|
430
|
-
* Color fields allow users to enter and adjust a hex color value.
|
|
431
|
-
*/
|
|
432
|
-
function useColorField(props, state, ref) {
|
|
433
|
-
let {
|
|
434
|
-
isDisabled,
|
|
435
|
-
isReadOnly,
|
|
436
|
-
isRequired
|
|
437
|
-
} = props;
|
|
438
|
-
let {
|
|
439
|
-
colorValue,
|
|
440
|
-
inputValue,
|
|
441
|
-
commit,
|
|
442
|
-
increment,
|
|
443
|
-
decrement,
|
|
444
|
-
incrementToMax,
|
|
445
|
-
decrementToMin
|
|
446
|
-
} = state;
|
|
447
|
-
let inputId = useId();
|
|
448
|
-
let {
|
|
449
|
-
spinButtonProps
|
|
450
|
-
} = useSpinButton({
|
|
451
|
-
isDisabled,
|
|
452
|
-
isReadOnly,
|
|
453
|
-
isRequired,
|
|
454
|
-
maxValue: 0xFFFFFF,
|
|
455
|
-
minValue: 0,
|
|
456
|
-
onIncrement: increment,
|
|
457
|
-
onIncrementToMax: incrementToMax,
|
|
458
|
-
onDecrement: decrement,
|
|
459
|
-
onDecrementToMin: decrementToMin,
|
|
460
|
-
value: colorValue ? colorValue.toHexInt() : undefined,
|
|
461
|
-
textValue: colorValue ? colorValue.toString('hex') : undefined
|
|
462
|
-
});
|
|
463
|
-
let [focusWithin, setFocusWithin] = useState(false);
|
|
464
|
-
let {
|
|
465
|
-
focusWithinProps
|
|
466
|
-
} = useFocusWithin({
|
|
467
|
-
isDisabled,
|
|
468
|
-
onFocusWithinChange: setFocusWithin
|
|
469
|
-
});
|
|
470
|
-
let onWheel = useCallback(e => {
|
|
471
|
-
if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
1280
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
1281
|
+
/*
|
|
1282
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
1283
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1284
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1285
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1286
|
+
*
|
|
1287
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1288
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1289
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1290
|
+
* governing permissions and limitations under the License.
|
|
1291
|
+
*/
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
function $58c850037bc7a7ce$export$77e32ca575a28fdf(props, state, ref) {
|
|
1297
|
+
let { isDisabled: isDisabled , isReadOnly: isReadOnly , isRequired: isRequired } = props;
|
|
1298
|
+
let { colorValue: colorValue , inputValue: inputValue , commit: commit , increment: increment , decrement: decrement , incrementToMax: incrementToMax , decrementToMin: decrementToMin } = state;
|
|
1299
|
+
let inputId = (0, $kZqDi$reactariautils.useId)();
|
|
1300
|
+
let { spinButtonProps: spinButtonProps } = (0, $kZqDi$reactariaspinbutton.useSpinButton)({
|
|
1301
|
+
isDisabled: isDisabled,
|
|
1302
|
+
isReadOnly: isReadOnly,
|
|
1303
|
+
isRequired: isRequired,
|
|
1304
|
+
maxValue: 0xFFFFFF,
|
|
1305
|
+
minValue: 0,
|
|
1306
|
+
onIncrement: increment,
|
|
1307
|
+
onIncrementToMax: incrementToMax,
|
|
1308
|
+
onDecrement: decrement,
|
|
1309
|
+
onDecrementToMin: decrementToMin,
|
|
1310
|
+
value: colorValue ? colorValue.toHexInt() : undefined,
|
|
1311
|
+
textValue: colorValue ? colorValue.toString("hex") : undefined
|
|
1312
|
+
});
|
|
1313
|
+
let [focusWithin, setFocusWithin] = (0, $kZqDi$react.useState)(false);
|
|
1314
|
+
let { focusWithinProps: focusWithinProps } = (0, $kZqDi$reactariainteractions.useFocusWithin)({
|
|
1315
|
+
isDisabled: isDisabled,
|
|
1316
|
+
onFocusWithinChange: setFocusWithin
|
|
1317
|
+
});
|
|
1318
|
+
let onWheel = (0, $kZqDi$react.useCallback)((e)=>{
|
|
1319
|
+
if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
|
|
1320
|
+
if (e.deltaY > 0) increment();
|
|
1321
|
+
else if (e.deltaY < 0) decrement();
|
|
1322
|
+
}, [
|
|
1323
|
+
decrement,
|
|
1324
|
+
increment
|
|
1325
|
+
]);
|
|
1326
|
+
// If the input isn't supposed to receive input, disable scrolling.
|
|
1327
|
+
let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
|
|
1328
|
+
(0, $kZqDi$reactariainteractions.useScrollWheel)({
|
|
1329
|
+
onScroll: onWheel,
|
|
1330
|
+
isDisabled: scrollingDisabled
|
|
1331
|
+
}, ref);
|
|
1332
|
+
let onChange = (value)=>{
|
|
1333
|
+
state.setInputValue(value);
|
|
1334
|
+
};
|
|
1335
|
+
let { labelProps: labelProps , inputProps: inputProps } = (0, $kZqDi$reactariatextfield.useFormattedTextField)((0, $kZqDi$reactariautils.mergeProps)(props, {
|
|
1336
|
+
id: inputId,
|
|
1337
|
+
value: inputValue,
|
|
1338
|
+
defaultValue: undefined,
|
|
1339
|
+
type: "text",
|
|
1340
|
+
autoComplete: "off",
|
|
1341
|
+
onChange: onChange
|
|
1342
|
+
}), state, ref);
|
|
1343
|
+
return {
|
|
1344
|
+
labelProps: labelProps,
|
|
1345
|
+
inputProps: (0, $kZqDi$reactariautils.mergeProps)(inputProps, spinButtonProps, focusWithinProps, {
|
|
1346
|
+
role: "textbox",
|
|
1347
|
+
"aria-valuemax": null,
|
|
1348
|
+
"aria-valuemin": null,
|
|
1349
|
+
"aria-valuenow": null,
|
|
1350
|
+
"aria-valuetext": null,
|
|
1351
|
+
autoCorrect: "off",
|
|
1352
|
+
spellCheck: "false",
|
|
1353
|
+
onBlur: commit
|
|
1354
|
+
})
|
|
1355
|
+
};
|
|
514
1356
|
}
|
|
515
1357
|
|
|
516
|
-
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
|
|
517
1361
|
//# sourceMappingURL=main.js.map
|