@xsolla/xui-color-picker 0.89.0 → 0.91.0

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/native/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/index.tsx
@@ -39,7 +29,7 @@ __export(index_exports, {
39
29
  module.exports = __toCommonJS(index_exports);
40
30
 
41
31
  // src/ColorPicker.tsx
42
- var import_react9 = require("react");
32
+ var import_react6 = require("react");
43
33
 
44
34
  // ../primitives-native/src/Box.tsx
45
35
  var import_react_native = require("react-native");
@@ -207,270 +197,13 @@ var Box = ({
207
197
  );
208
198
  };
209
199
 
210
- // ../primitives-native/src/Text.tsx
211
- var import_react_native2 = require("react-native");
212
- var import_jsx_runtime2 = require("react/jsx-runtime");
213
-
214
- // ../primitives-native/src/Spinner.tsx
215
- var import_react_native3 = require("react-native");
216
- var import_jsx_runtime3 = require("react/jsx-runtime");
217
- var Spinner = ({
218
- color,
219
- size,
220
- role,
221
- "aria-label": ariaLabel,
222
- "aria-live": ariaLive,
223
- testID
224
- }) => {
225
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
226
- import_react_native3.View,
227
- {
228
- accessible: true,
229
- accessibilityRole: role === "status" ? "none" : void 0,
230
- accessibilityLabel: ariaLabel,
231
- accessibilityLiveRegion: ariaLive === "polite" ? "polite" : ariaLive === "assertive" ? "assertive" : "none",
232
- testID,
233
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
234
- import_react_native3.ActivityIndicator,
235
- {
236
- color,
237
- size: typeof size === "number" ? size : "small"
238
- }
239
- )
240
- }
241
- );
242
- };
243
- Spinner.displayName = "Spinner";
244
-
245
- // ../primitives-native/src/Icon.tsx
246
- var import_react = __toESM(require("react"));
247
- var import_react_native4 = require("react-native");
248
- var import_jsx_runtime4 = require("react/jsx-runtime");
249
-
250
- // ../primitives-native/src/Divider.tsx
251
- var import_react_native5 = require("react-native");
252
- var import_jsx_runtime5 = require("react/jsx-runtime");
253
-
254
- // ../primitives-native/src/Input.tsx
255
- var import_react2 = require("react");
256
- var import_react_native6 = require("react-native");
257
- var import_jsx_runtime6 = require("react/jsx-runtime");
258
- var keyboardTypeMap = {
259
- text: "default",
260
- number: "numeric",
261
- email: "email-address",
262
- tel: "phone-pad",
263
- url: "url",
264
- decimal: "decimal-pad"
265
- };
266
- var inputModeToKeyboardType = {
267
- none: "default",
268
- text: "default",
269
- decimal: "decimal-pad",
270
- numeric: "number-pad",
271
- tel: "phone-pad",
272
- search: "default",
273
- email: "email-address",
274
- url: "url"
275
- };
276
- var autoCompleteToTextContentType = {
277
- "one-time-code": "oneTimeCode",
278
- email: "emailAddress",
279
- username: "username",
280
- password: "password",
281
- "new-password": "newPassword",
282
- tel: "telephoneNumber",
283
- "postal-code": "postalCode",
284
- name: "name"
285
- };
286
- var InputPrimitive = (0, import_react2.forwardRef)(
287
- ({
288
- value,
289
- placeholder,
290
- onChange,
291
- onChangeText,
292
- onFocus,
293
- onBlur,
294
- onKeyDown,
295
- disabled,
296
- secureTextEntry,
297
- style,
298
- color,
299
- fontSize,
300
- placeholderTextColor,
301
- maxLength,
302
- type,
303
- inputMode,
304
- autoComplete,
305
- id,
306
- "aria-describedby": ariaDescribedBy,
307
- "aria-label": ariaLabel,
308
- "aria-disabled": ariaDisabled,
309
- "data-testid": dataTestId
310
- }, ref) => {
311
- const handleChangeText = (text) => {
312
- onChangeText?.(text);
313
- if (onChange) {
314
- const syntheticEvent = {
315
- target: { value: text },
316
- currentTarget: { value: text },
317
- type: "change",
318
- nativeEvent: { text },
319
- preventDefault: () => {
320
- },
321
- stopPropagation: () => {
322
- },
323
- isTrusted: false
324
- };
325
- onChange(syntheticEvent);
326
- }
327
- };
328
- const keyboardType = inputMode ? inputModeToKeyboardType[inputMode] || "default" : type ? keyboardTypeMap[type] || "default" : "default";
329
- const textContentType = autoComplete ? autoCompleteToTextContentType[autoComplete] : void 0;
330
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
331
- import_react_native6.TextInput,
332
- {
333
- ref,
334
- value,
335
- placeholder,
336
- onChangeText: handleChangeText,
337
- onFocus,
338
- onBlur,
339
- onKeyPress: (e) => {
340
- if (onKeyDown) {
341
- onKeyDown({
342
- key: e.nativeEvent.key,
343
- preventDefault: () => {
344
- }
345
- });
346
- }
347
- },
348
- editable: !disabled,
349
- secureTextEntry: secureTextEntry || type === "password",
350
- keyboardType,
351
- textContentType,
352
- style: [
353
- {
354
- color,
355
- fontSize: typeof fontSize === "number" ? fontSize : void 0,
356
- flex: 1,
357
- padding: 0,
358
- textAlign: style?.textAlign || "left"
359
- },
360
- style
361
- ],
362
- placeholderTextColor,
363
- maxLength,
364
- testID: dataTestId || id,
365
- accessibilityLabel: ariaLabel,
366
- accessibilityHint: ariaDescribedBy,
367
- accessibilityState: {
368
- disabled: disabled || ariaDisabled
369
- },
370
- accessible: true
371
- }
372
- );
373
- }
374
- );
375
- InputPrimitive.displayName = "InputPrimitive";
376
-
377
- // ../primitives-native/src/TextArea.tsx
378
- var import_react3 = require("react");
379
- var import_react_native7 = require("react-native");
380
- var import_jsx_runtime7 = require("react/jsx-runtime");
381
- var TextAreaPrimitive = (0, import_react3.forwardRef)(
382
- ({
383
- value,
384
- placeholder,
385
- onChange,
386
- onChangeText,
387
- onFocus,
388
- onBlur,
389
- onKeyDown,
390
- disabled,
391
- style,
392
- color,
393
- fontSize,
394
- placeholderTextColor,
395
- maxLength,
396
- rows,
397
- id,
398
- "aria-describedby": ariaDescribedBy,
399
- "aria-label": ariaLabel,
400
- "aria-disabled": ariaDisabled,
401
- "data-testid": dataTestId
402
- }, ref) => {
403
- const handleChangeText = (text) => {
404
- onChangeText?.(text);
405
- if (onChange) {
406
- const syntheticEvent = {
407
- target: { value: text },
408
- currentTarget: { value: text },
409
- type: "change",
410
- nativeEvent: { text },
411
- preventDefault: () => {
412
- },
413
- stopPropagation: () => {
414
- },
415
- isTrusted: false
416
- };
417
- onChange(syntheticEvent);
418
- }
419
- };
420
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
421
- import_react_native7.TextInput,
422
- {
423
- ref,
424
- value,
425
- placeholder,
426
- onChangeText: handleChangeText,
427
- onFocus,
428
- onBlur,
429
- onKeyPress: (e) => {
430
- if (onKeyDown) {
431
- onKeyDown({
432
- key: e.nativeEvent.key,
433
- preventDefault: () => {
434
- }
435
- });
436
- }
437
- },
438
- editable: !disabled,
439
- multiline: true,
440
- numberOfLines: rows || 4,
441
- style: [
442
- {
443
- color,
444
- fontSize: typeof fontSize === "number" ? fontSize : void 0,
445
- flex: 1,
446
- padding: 0,
447
- textAlignVertical: "top",
448
- textAlign: style?.textAlign || "left"
449
- },
450
- style
451
- ],
452
- placeholderTextColor,
453
- maxLength,
454
- testID: dataTestId || id,
455
- accessibilityLabel: ariaLabel,
456
- accessibilityHint: ariaDescribedBy,
457
- accessibilityState: {
458
- disabled: disabled || ariaDisabled
459
- },
460
- accessible: true
461
- }
462
- );
463
- }
464
- );
465
- TextAreaPrimitive.displayName = "TextAreaPrimitive";
466
-
467
200
  // src/ColorPicker.tsx
468
201
  var import_xui_select = require("@xsolla/xui-select");
469
202
  var import_xui_button2 = require("@xsolla/xui-button");
470
203
  var import_xui_core3 = require("@xsolla/xui-core");
471
204
 
472
205
  // src/ColorPickerArea.tsx
473
- var import_react5 = require("react");
206
+ var import_react2 = require("react");
474
207
  var import_xui_core = require("@xsolla/xui-core");
475
208
 
476
209
  // src/colorUtils.ts
@@ -663,7 +396,7 @@ function createColorFromHsb(h, s, b, a = 1) {
663
396
  }
664
397
 
665
398
  // src/utils.ts
666
- var import_react4 = require("react");
399
+ var import_react = require("react");
667
400
  function clamp(value, min, max) {
668
401
  return Math.min(Math.max(value, min), max);
669
402
  }
@@ -678,7 +411,7 @@ function snapValueToStep(value, min, max, step) {
678
411
  return snappedValue;
679
412
  }
680
413
  function useMergedRefs(...refs) {
681
- return (0, import_react4.useCallback)((node) => {
414
+ return (0, import_react.useCallback)((node) => {
682
415
  refs.forEach((ref) => {
683
416
  if (typeof ref === "function") {
684
417
  ref(node);
@@ -689,9 +422,9 @@ function useMergedRefs(...refs) {
689
422
  }, refs);
690
423
  }
691
424
  function useUpdatableState(updater, deps, initialUpdate = false) {
692
- const [state, setState] = (0, import_react4.useState)(() => updater(void 0));
693
- const isFirstRender = (0, import_react4.useRef)(true);
694
- (0, import_react4.useEffect)(() => {
425
+ const [state, setState] = (0, import_react.useState)(() => updater(void 0));
426
+ const isFirstRender = (0, import_react.useRef)(true);
427
+ (0, import_react.useEffect)(() => {
695
428
  if (isFirstRender.current && !initialUpdate) {
696
429
  isFirstRender.current = false;
697
430
  return;
@@ -702,8 +435,8 @@ function useUpdatableState(updater, deps, initialUpdate = false) {
702
435
  }
703
436
 
704
437
  // src/ColorPickerArea.tsx
705
- var import_jsx_runtime8 = require("react/jsx-runtime");
706
- var ColorPickerArea = (0, import_react5.forwardRef)(function CustomColorArea(props, ref) {
438
+ var import_jsx_runtime2 = require("react/jsx-runtime");
439
+ var ColorPickerArea = (0, import_react2.forwardRef)(function CustomColorArea(props, ref) {
707
440
  const {
708
441
  xChannelStep = 0.1,
709
442
  yChannelStep = 0.1,
@@ -713,15 +446,15 @@ var ColorPickerArea = (0, import_react5.forwardRef)(function CustomColorArea(pro
713
446
  onChangeEnd,
714
447
  className
715
448
  } = props;
716
- const internalRef = (0, import_react5.useRef)(null);
449
+ const internalRef = (0, import_react2.useRef)(null);
717
450
  const containerRef = useMergedRefs(ref, internalRef);
718
- const [layout, setLayout] = (0, import_react5.useState)({ width: 0, height: 0 });
719
- const [isDragging, setIsDragging] = (0, import_react5.useState)(false);
720
- const [currentColor, setCurrentColor] = (0, import_react5.useState)(() => {
451
+ const [layout, setLayout] = (0, import_react2.useState)({ width: 0, height: 0 });
452
+ const [isDragging, setIsDragging] = (0, import_react2.useState)(false);
453
+ const [currentColor, setCurrentColor] = (0, import_react2.useState)(() => {
721
454
  const initialValue = value || defaultValue || "#ffffff";
722
455
  return parseColor(initialValue);
723
456
  });
724
- (0, import_react5.useEffect)(() => {
457
+ (0, import_react2.useEffect)(() => {
725
458
  if (value !== void 0) {
726
459
  setCurrentColor(parseColor(value));
727
460
  }
@@ -732,7 +465,7 @@ var ColorPickerArea = (0, import_react5.forwardRef)(function CustomColorArea(pro
732
465
  const brightness = hsb.b * 100;
733
466
  const thumbX = saturation / 100 * 100;
734
467
  const thumbY = 100 - brightness / 100 * 100;
735
- const updateColor = (0, import_react5.useCallback)(
468
+ const updateColor = (0, import_react2.useCallback)(
736
469
  (x, y) => {
737
470
  const newSaturation = snapValueToStep(x * 100, 0, 100, xChannelStep);
738
471
  const newBrightness = snapValueToStep(
@@ -753,7 +486,7 @@ var ColorPickerArea = (0, import_react5.forwardRef)(function CustomColorArea(pro
753
486
  },
754
487
  [hue, hsb.a, xChannelStep, yChannelStep, onChange]
755
488
  );
756
- const handleMouseDown = (0, import_react5.useCallback)(
489
+ const handleMouseDown = (0, import_react2.useCallback)(
757
490
  (e) => {
758
491
  if (import_xui_core.isNative) return;
759
492
  setIsDragging(true);
@@ -764,7 +497,7 @@ var ColorPickerArea = (0, import_react5.forwardRef)(function CustomColorArea(pro
764
497
  },
765
498
  [updateColor]
766
499
  );
767
- const handleMouseMove = (0, import_react5.useCallback)(
500
+ const handleMouseMove = (0, import_react2.useCallback)(
768
501
  (e) => {
769
502
  if (!isDragging || import_xui_core.isNative) return;
770
503
  const rect = internalRef.current?.getBoundingClientRect?.();
@@ -775,13 +508,13 @@ var ColorPickerArea = (0, import_react5.forwardRef)(function CustomColorArea(pro
775
508
  },
776
509
  [isDragging, updateColor]
777
510
  );
778
- const handleMouseUp = (0, import_react5.useCallback)(() => {
511
+ const handleMouseUp = (0, import_react2.useCallback)(() => {
779
512
  if (isDragging) {
780
513
  setIsDragging(false);
781
514
  onChangeEnd?.(currentColor.toString());
782
515
  }
783
516
  }, [isDragging, currentColor, onChangeEnd]);
784
- (0, import_react5.useEffect)(() => {
517
+ (0, import_react2.useEffect)(() => {
785
518
  if (import_xui_core.isWeb && isDragging) {
786
519
  document.addEventListener("mousemove", handleMouseMove);
787
520
  document.addEventListener("mouseup", handleMouseUp);
@@ -791,7 +524,7 @@ var ColorPickerArea = (0, import_react5.forwardRef)(function CustomColorArea(pro
791
524
  };
792
525
  }
793
526
  }, [isDragging, handleMouseMove, handleMouseUp]);
794
- const handleResponderMove = (0, import_react5.useCallback)(
527
+ const handleResponderMove = (0, import_react2.useCallback)(
795
528
  (e) => {
796
529
  const { locationX, locationY } = e.nativeEvent;
797
530
  const x = clamp(locationX / layout.width, 0, 1);
@@ -800,7 +533,7 @@ var ColorPickerArea = (0, import_react5.forwardRef)(function CustomColorArea(pro
800
533
  },
801
534
  [layout, updateColor]
802
535
  );
803
- const handleResponderRelease = (0, import_react5.useCallback)(() => {
536
+ const handleResponderRelease = (0, import_react2.useCallback)(() => {
804
537
  setIsDragging(false);
805
538
  onChangeEnd?.(currentColor.toString());
806
539
  }, [currentColor, onChangeEnd]);
@@ -816,7 +549,7 @@ var ColorPickerArea = (0, import_react5.forwardRef)(function CustomColorArea(pro
816
549
  // Fallback for native without LinearGradient
817
550
  };
818
551
  const thumbColor = currentColor.toString("hex");
819
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
552
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
820
553
  Box,
821
554
  {
822
555
  "data-testid": "color-picker-color-area",
@@ -841,7 +574,7 @@ var ColorPickerArea = (0, import_react5.forwardRef)(function CustomColorArea(pro
841
574
  onResponderMove: handleResponderMove,
842
575
  onResponderRelease: handleResponderRelease,
843
576
  onResponderTerminate: handleResponderRelease,
844
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { width: "100%", height: "100%", position: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
577
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box, { width: "100%", height: "100%", position: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
845
578
  Box,
846
579
  {
847
580
  "data-testid": "color-picker-color-area-thumb",
@@ -865,9 +598,9 @@ var ColorPickerArea = (0, import_react5.forwardRef)(function CustomColorArea(pro
865
598
  });
866
599
 
867
600
  // src/ColorPickerSlider.tsx
868
- var import_react6 = require("react");
601
+ var import_react3 = require("react");
869
602
  var import_xui_core2 = require("@xsolla/xui-core");
870
- var import_jsx_runtime9 = require("react/jsx-runtime");
603
+ var import_jsx_runtime3 = require("react/jsx-runtime");
871
604
  var ColorPickerSlider = ({
872
605
  channel,
873
606
  value,
@@ -875,9 +608,9 @@ var ColorPickerSlider = ({
875
608
  onChangeEnd
876
609
  }) => {
877
610
  const { theme } = (0, import_xui_core2.useDesignSystem)();
878
- const trackRef = (0, import_react6.useRef)(null);
879
- const [layout, setLayout] = (0, import_react6.useState)({ width: 0, height: 0 });
880
- const [isDragging, setIsDragging] = (0, import_react6.useState)(false);
611
+ const trackRef = (0, import_react3.useRef)(null);
612
+ const [layout, setLayout] = (0, import_react3.useState)({ width: 0, height: 0 });
613
+ const [isDragging, setIsDragging] = (0, import_react3.useState)(false);
881
614
  const currentColor = parseColor(value);
882
615
  const hsb = currentColor.toHsb();
883
616
  const getChannelValue = () => {
@@ -888,7 +621,7 @@ var ColorPickerSlider = ({
888
621
  const channelValue = getChannelValue();
889
622
  const maxValue = getMaxValue();
890
623
  const thumbPosition = channelValue / maxValue * 100;
891
- const updateColor = (0, import_react6.useCallback)(
624
+ const updateColor = (0, import_react3.useCallback)(
892
625
  (x) => {
893
626
  const newValue = snapValueToStep(x * maxValue, 0, maxValue, 1);
894
627
  let newColor;
@@ -912,7 +645,7 @@ var ColorPickerSlider = ({
912
645
  },
913
646
  [channel, maxValue, hsb, onChange]
914
647
  );
915
- const handleMouseDown = (0, import_react6.useCallback)(
648
+ const handleMouseDown = (0, import_react3.useCallback)(
916
649
  (e) => {
917
650
  if (import_xui_core2.isNative) return;
918
651
  setIsDragging(true);
@@ -922,7 +655,7 @@ var ColorPickerSlider = ({
922
655
  },
923
656
  [updateColor]
924
657
  );
925
- const handleMouseMove = (0, import_react6.useCallback)(
658
+ const handleMouseMove = (0, import_react3.useCallback)(
926
659
  (e) => {
927
660
  if (!isDragging || import_xui_core2.isNative) return;
928
661
  const rect = trackRef.current?.getBoundingClientRect?.();
@@ -932,13 +665,13 @@ var ColorPickerSlider = ({
932
665
  },
933
666
  [isDragging, updateColor]
934
667
  );
935
- const handleMouseUp = (0, import_react6.useCallback)(() => {
668
+ const handleMouseUp = (0, import_react3.useCallback)(() => {
936
669
  if (isDragging) {
937
670
  setIsDragging(false);
938
671
  onChangeEnd?.(currentColor.toString());
939
672
  }
940
673
  }, [isDragging, currentColor, onChangeEnd]);
941
- (0, import_react6.useEffect)(() => {
674
+ (0, import_react3.useEffect)(() => {
942
675
  if (import_xui_core2.isWeb && isDragging) {
943
676
  document.addEventListener("mousemove", handleMouseMove);
944
677
  document.addEventListener("mouseup", handleMouseUp);
@@ -948,7 +681,7 @@ var ColorPickerSlider = ({
948
681
  };
949
682
  }
950
683
  }, [isDragging, handleMouseMove, handleMouseUp]);
951
- const handleResponderMove = (0, import_react6.useCallback)(
684
+ const handleResponderMove = (0, import_react3.useCallback)(
952
685
  (e) => {
953
686
  const { locationX } = e.nativeEvent;
954
687
  const x = clamp(locationX / layout.width, 0, 1);
@@ -956,7 +689,7 @@ var ColorPickerSlider = ({
956
689
  },
957
690
  [layout, updateColor]
958
691
  );
959
- const handleResponderRelease = (0, import_react6.useCallback)(() => {
692
+ const handleResponderRelease = (0, import_react3.useCallback)(() => {
960
693
  setIsDragging(false);
961
694
  onChangeEnd?.(currentColor.toString());
962
695
  }, [currentColor, onChangeEnd]);
@@ -968,7 +701,7 @@ var ColorPickerSlider = ({
968
701
  return `linear-gradient(to right, transparent 0%, ${colorHex} 100%)`;
969
702
  };
970
703
  const thumbColor = channel === "hue" ? createColorFromHsb(channelValue, 100, 100, 1).toString("hex") : currentColor.toString("hex");
971
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
704
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
972
705
  Box,
973
706
  {
974
707
  height: 12,
@@ -989,7 +722,7 @@ var ColorPickerSlider = ({
989
722
  onResponderMove: handleResponderMove,
990
723
  onResponderRelease: handleResponderRelease,
991
724
  onResponderTerminate: handleResponderRelease,
992
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { ref: trackRef, width: "100%", height: "100%", position: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
725
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box, { ref: trackRef, width: "100%", height: "100%", position: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
993
726
  Box,
994
727
  {
995
728
  position: "absolute",
@@ -1012,9 +745,9 @@ var ColorPickerSlider = ({
1012
745
  };
1013
746
 
1014
747
  // src/ColorPickerInput.tsx
1015
- var import_react7 = require("react");
748
+ var import_react4 = require("react");
1016
749
  var import_xui_input = require("@xsolla/xui-input");
1017
- var import_jsx_runtime10 = require("react/jsx-runtime");
750
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1018
751
  var ColorPickerInput = ({
1019
752
  value,
1020
753
  valueType,
@@ -1025,8 +758,8 @@ var ColorPickerInput = ({
1025
758
  const channelRange = value.getChannelRange(channel);
1026
759
  const intValue = channel === "alpha" ? channelValue * 100 : channelValue;
1027
760
  const roundedValue = Math.round(intValue);
1028
- const [inputValue, setInputValue] = (0, import_react7.useState)(String(roundedValue));
1029
- (0, import_react7.useEffect)(() => {
761
+ const [inputValue, setInputValue] = (0, import_react4.useState)(String(roundedValue));
762
+ (0, import_react4.useEffect)(() => {
1030
763
  setInputValue(String(roundedValue));
1031
764
  }, [roundedValue]);
1032
765
  const handleChange = (e) => {
@@ -1045,7 +778,7 @@ var ColorPickerInput = ({
1045
778
  const handleBlur = () => {
1046
779
  setInputValue(String(roundedValue));
1047
780
  };
1048
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { flex: 1, minWidth: 40, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
781
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box, { flex: 1, minWidth: 40, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1049
782
  import_xui_input.Input,
1050
783
  {
1051
784
  size: "sm",
@@ -1057,15 +790,15 @@ var ColorPickerInput = ({
1057
790
  };
1058
791
 
1059
792
  // src/ColorPickerHexInput.tsx
1060
- var import_react8 = require("react");
793
+ var import_react5 = require("react");
1061
794
  var import_xui_input2 = require("@xsolla/xui-input");
1062
- var import_jsx_runtime11 = require("react/jsx-runtime");
795
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1063
796
  var ColorPickerHexInput = ({
1064
797
  value,
1065
798
  onChange
1066
799
  }) => {
1067
- const [inputValue, setInputValue] = (0, import_react8.useState)(value);
1068
- (0, import_react8.useEffect)(() => {
800
+ const [inputValue, setInputValue] = (0, import_react5.useState)(value);
801
+ (0, import_react5.useEffect)(() => {
1069
802
  setInputValue(value);
1070
803
  }, [value]);
1071
804
  const handleChange = (e) => {
@@ -1091,7 +824,7 @@ var ColorPickerHexInput = ({
1091
824
  setInputValue(value);
1092
825
  }
1093
826
  };
1094
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { flex: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
827
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box, { flex: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1095
828
  import_xui_input2.Input,
1096
829
  {
1097
830
  size: "sm",
@@ -1104,8 +837,8 @@ var ColorPickerHexInput = ({
1104
837
 
1105
838
  // src/ColorPickerEyedropper.tsx
1106
839
  var import_xui_button = require("@xsolla/xui-button");
1107
- var import_jsx_runtime12 = require("react/jsx-runtime");
1108
- var DropletIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
840
+ var import_jsx_runtime6 = require("react/jsx-runtime");
841
+ var DropletIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1109
842
  "svg",
1110
843
  {
1111
844
  viewBox: "0 0 24 24",
@@ -1116,7 +849,7 @@ var DropletIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1116
849
  strokeWidth: "2",
1117
850
  strokeLinecap: "round",
1118
851
  strokeLinejoin: "round",
1119
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5s-3 3.5-3 5.5a7 7 0 0 0 7 7z" })
852
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5s-3 3.5-3 5.5a7 7 0 0 0 7 7z" })
1120
853
  }
1121
854
  );
1122
855
  var ColorPickerEyedropper = ({ onColorPick }) => {
@@ -1131,26 +864,26 @@ var ColorPickerEyedropper = ({ onColorPick }) => {
1131
864
  }
1132
865
  };
1133
866
  if (typeof EyeDropper === "undefined") return null;
1134
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
867
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1135
868
  import_xui_button.IconButton,
1136
869
  {
1137
870
  size: "sm",
1138
871
  variant: "secondary",
1139
872
  tone: "mono",
1140
873
  onPress: onEyedropperButtonClick,
1141
- icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropletIcon, {}),
874
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropletIcon, {}),
1142
875
  "aria-label": "Pick color from screen"
1143
876
  }
1144
877
  );
1145
878
  };
1146
879
 
1147
880
  // src/ColorPicker.tsx
1148
- var import_jsx_runtime13 = require("react/jsx-runtime");
881
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1149
882
  var DEFAULT_VALUE = "#66E6FFFF";
1150
883
  var supportedFormats = ["hex", "hsl", "rgb", "hsb"];
1151
884
  var addAlfaToChannel = (channelName, alpha) => alpha ? `${channelName}a` : channelName;
1152
885
  var removeAlfaFromChannel = (channelName) => channelName.slice(0, 3);
1153
- var CopyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
886
+ var CopyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1154
887
  "svg",
1155
888
  {
1156
889
  viewBox: "0 0 24 24",
@@ -1162,12 +895,12 @@ var CopyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1162
895
  strokeLinecap: "round",
1163
896
  strokeLinejoin: "round",
1164
897
  children: [
1165
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
1166
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
898
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
899
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
1167
900
  ]
1168
901
  }
1169
902
  );
1170
- var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
903
+ var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1171
904
  "svg",
1172
905
  {
1173
906
  viewBox: "0 0 24 24",
@@ -1178,10 +911,10 @@ var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1178
911
  strokeWidth: "2",
1179
912
  strokeLinecap: "round",
1180
913
  strokeLinejoin: "round",
1181
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("polyline", { points: "20 6 9 17 4 12" })
914
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "20 6 9 17 4 12" })
1182
915
  }
1183
916
  );
1184
- var ResetIcon = () => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
917
+ var ResetIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1185
918
  "svg",
1186
919
  {
1187
920
  viewBox: "0 0 24 24",
@@ -1193,12 +926,12 @@ var ResetIcon = () => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1193
926
  strokeLinecap: "round",
1194
927
  strokeLinejoin: "round",
1195
928
  children: [
1196
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
1197
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("polyline", { points: "3 3 3 8 8 8" })
929
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
930
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "3 3 3 8 8 8" })
1198
931
  ]
1199
932
  }
1200
933
  );
1201
- var ColorPicker = (0, import_react9.forwardRef)(
934
+ var ColorPicker = (0, import_react6.forwardRef)(
1202
935
  ({
1203
936
  colorFormat: defaultColorFormat = "hex",
1204
937
  alpha = true,
@@ -1211,7 +944,7 @@ var ColorPicker = (0, import_react9.forwardRef)(
1211
944
  testID
1212
945
  }, ref) => {
1213
946
  const { theme } = (0, import_xui_core3.useDesignSystem)();
1214
- const prevColorRef = (0, import_react9.useRef)(propValue);
947
+ const prevColorRef = (0, import_react6.useRef)(propValue);
1215
948
  const [innerValue, setInnerValue] = useUpdatableState(
1216
949
  (prevState) => {
1217
950
  if (prevColorRef.current === propValue && prevState) return prevState;
@@ -1221,8 +954,8 @@ var ColorPicker = (0, import_react9.forwardRef)(
1221
954
  [propValue],
1222
955
  true
1223
956
  );
1224
- const [initialValue] = (0, import_react9.useState)(() => innerValue);
1225
- const [isValueCopied, setValueCopied] = (0, import_react9.useState)(false);
957
+ const [initialValue] = (0, import_react6.useState)(() => innerValue);
958
+ const [isValueCopied, setValueCopied] = (0, import_react6.useState)(false);
1226
959
  const [colorFormat, setColorFormat] = useUpdatableState(
1227
960
  () => addAlfaToChannel(defaultColorFormat, alpha),
1228
961
  [defaultColorFormat, alpha],
@@ -1266,7 +999,7 @@ var ColorPicker = (0, import_react9.forwardRef)(
1266
999
  value: f
1267
1000
  }));
1268
1001
  const channels = colorFormat.includes("hex") ? [] : colorFormat.includes("rgb") ? ["red", "green", "blue"] : colorFormat.includes("hsl") ? ["hue", "saturation", "lightness"] : ["hue", "saturation", "brightness"];
1269
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1002
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1270
1003
  Box,
1271
1004
  {
1272
1005
  ref,
@@ -1278,17 +1011,17 @@ var ColorPicker = (0, import_react9.forwardRef)(
1278
1011
  width: 312,
1279
1012
  style: { boxShadow: "0px 4px 16px 0px rgba(7, 7, 8, 0.1)" },
1280
1013
  children: [
1281
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1014
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1282
1015
  ColorPickerArea,
1283
1016
  {
1284
1017
  value: innerValue.toString(),
1285
1018
  onChange: handleChange
1286
1019
  }
1287
1020
  ),
1288
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box, { flexDirection: "row", gap: 8, alignItems: "center", children: [
1289
- eyedropper && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ColorPickerEyedropper, { onColorPick: handleChange }),
1290
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box, { flex: 1, gap: 8, children: [
1291
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1021
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box, { flexDirection: "row", gap: 8, alignItems: "center", children: [
1022
+ eyedropper && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ColorPickerEyedropper, { onColorPick: handleChange }),
1023
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box, { flex: 1, gap: 8, children: [
1024
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1292
1025
  ColorPickerSlider,
1293
1026
  {
1294
1027
  channel: "hue",
@@ -1296,7 +1029,7 @@ var ColorPicker = (0, import_react9.forwardRef)(
1296
1029
  onChange: handleChange
1297
1030
  }
1298
1031
  ),
1299
- alpha && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1032
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1300
1033
  ColorPickerSlider,
1301
1034
  {
1302
1035
  channel: "alpha",
@@ -1306,8 +1039,8 @@ var ColorPicker = (0, import_react9.forwardRef)(
1306
1039
  )
1307
1040
  ] })
1308
1041
  ] }),
1309
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box, { flexDirection: "row", gap: 8, alignItems: "center", children: [
1310
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box, { width: 80, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1042
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box, { flexDirection: "row", gap: 8, alignItems: "center", children: [
1043
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box, { width: 80, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1311
1044
  import_xui_select.Select,
1312
1045
  {
1313
1046
  size: "sm",
@@ -1316,14 +1049,14 @@ var ColorPicker = (0, import_react9.forwardRef)(
1316
1049
  onChange: handleChangeFormat
1317
1050
  }
1318
1051
  ) }),
1319
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box, { flex: 1, flexDirection: "row", gap: 4, children: [
1320
- colorFormat.includes("hex") ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1052
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box, { flex: 1, flexDirection: "row", gap: 4, children: [
1053
+ colorFormat.includes("hex") ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1321
1054
  ColorPickerHexInput,
1322
1055
  {
1323
1056
  value: innerValue.toString(colorFormat),
1324
1057
  onChange: handleChange
1325
1058
  }
1326
- ) : channels.map((channel) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1059
+ ) : channels.map((channel) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1327
1060
  ColorPickerInput,
1328
1061
  {
1329
1062
  value: innerValue,
@@ -1333,7 +1066,7 @@ var ColorPicker = (0, import_react9.forwardRef)(
1333
1066
  },
1334
1067
  channel
1335
1068
  )),
1336
- alpha && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1069
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1337
1070
  ColorPickerInput,
1338
1071
  {
1339
1072
  channel: "alpha",
@@ -1343,26 +1076,26 @@ var ColorPicker = (0, import_react9.forwardRef)(
1343
1076
  }
1344
1077
  )
1345
1078
  ] }),
1346
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box, { flexDirection: "row", gap: 4, children: [
1347
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1079
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box, { flexDirection: "row", gap: 4, children: [
1080
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1348
1081
  import_xui_button2.IconButton,
1349
1082
  {
1350
1083
  size: "sm",
1351
1084
  variant: "secondary",
1352
1085
  tone: "mono",
1353
1086
  onPress: onCopy,
1354
- icon: isValueCopied ? copiedIcon || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CheckIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CopyIcon, {}),
1087
+ icon: isValueCopied ? copiedIcon || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CheckIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopyIcon, {}),
1355
1088
  "aria-label": "Copy color"
1356
1089
  }
1357
1090
  ),
1358
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1091
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1359
1092
  import_xui_button2.IconButton,
1360
1093
  {
1361
1094
  size: "sm",
1362
1095
  variant: "secondary",
1363
1096
  tone: "mono",
1364
1097
  onPress: onReset,
1365
- icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ResetIcon, {}),
1098
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ResetIcon, {}),
1366
1099
  "aria-label": "Reset color"
1367
1100
  }
1368
1101
  )