@react-stately/color 3.2.2-nightly.3599 → 3.2.2-nightly.3600

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/main.js CHANGED
@@ -1,3 +1,4 @@
1
+ require("@swc/helpers/lib/_define_property.js");
1
2
  var $4tN2K$reactstatelyutils = require("@react-stately/utils");
2
3
  var $4tN2K$internationalizedstring = require("@internationalized/string");
3
4
  var $4tN2K$internationalizednumber = require("@internationalized/number");
@@ -16,6 +17,27 @@ $parcel$export(module.exports, "useColorAreaState", () => $af2d7ac9990cfee2$expo
16
17
  $parcel$export(module.exports, "useColorSliderState", () => $5386a492cfd3234c$export$57bc203e1c9c6d44);
17
18
  $parcel$export(module.exports, "useColorWheelState", () => $9d7d8736d45f74b8$export$f4301076d9336137);
18
19
  $parcel$export(module.exports, "useColorFieldState", () => $d59d0c2b2ce1568f$export$d52a01683abdfcd6);
20
+ /*
21
+ * Copyright 2020 Adobe. All rights reserved.
22
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
23
+ * you may not use this file except in compliance with the License. You may obtain a copy
24
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
25
+ *
26
+ * Unless required by applicable law or agreed to in writing, software distributed under
27
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
28
+ * OF ANY KIND, either express or implied. See the License for the specific language
29
+ * governing permissions and limitations under the License.
30
+ */ /*
31
+ * Copyright 2020 Adobe. All rights reserved.
32
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
33
+ * you may not use this file except in compliance with the License. You may obtain a copy
34
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
35
+ *
36
+ * Unless required by applicable law or agreed to in writing, software distributed under
37
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
38
+ * OF ANY KIND, either express or implied. See the License for the specific language
39
+ * governing permissions and limitations under the License.
40
+ */
19
41
 
20
42
  var $c0b600cf8eafdee9$exports = {};
21
43
  var $b044e7150534af04$exports = {};
@@ -500,23 +522,23 @@ $c0b600cf8eafdee9$exports = {
500
522
 
501
523
 
502
524
 
503
- const $83fe1a57d631223b$var$strings = new $4tN2K$internationalizedstring.LocalizedStringDictionary((/*@__PURE__*/$parcel$interopDefault($c0b600cf8eafdee9$exports)));
525
+ const $83fe1a57d631223b$var$strings = new (0, $4tN2K$internationalizedstring.LocalizedStringDictionary)((0, (/*@__PURE__*/$parcel$interopDefault($c0b600cf8eafdee9$exports))));
504
526
  function $83fe1a57d631223b$export$6e865ea70d7724f(value) {
505
527
  let res = $83fe1a57d631223b$var$RGBColor.parse(value) || $83fe1a57d631223b$var$HSBColor.parse(value) || $83fe1a57d631223b$var$HSLColor.parse(value);
506
528
  if (res) return res;
507
- throw new Error('Invalid color value: ' + value);
529
+ throw new Error("Invalid color value: " + value);
508
530
  }
509
531
  function $83fe1a57d631223b$export$4cde5df63f53f473(v) {
510
- if (typeof v === 'string') return $83fe1a57d631223b$export$6e865ea70d7724f(v);
532
+ if (typeof v === "string") return $83fe1a57d631223b$export$6e865ea70d7724f(v);
511
533
  else return v;
512
534
  }
513
535
  class $83fe1a57d631223b$var$Color {
514
536
  toHexInt() {
515
- return this.toFormat('rgb').toHexInt();
537
+ return this.toFormat("rgb").toHexInt();
516
538
  }
517
539
  getChannelValue(channel) {
518
540
  if (channel in this) return this[channel];
519
- throw new Error('Unsupported color channel: ' + channel);
541
+ throw new Error("Unsupported color channel: " + channel);
520
542
  }
521
543
  withChannelValue(channel, value) {
522
544
  if (channel in this) {
@@ -524,19 +546,16 @@ class $83fe1a57d631223b$var$Color {
524
546
  x[channel] = value;
525
547
  return x;
526
548
  }
527
- throw new Error('Unsupported color channel: ' + channel);
549
+ throw new Error("Unsupported color channel: " + channel);
528
550
  }
529
551
  getChannelName(channel, locale) {
530
552
  return $83fe1a57d631223b$var$strings.getStringForLocale(channel, locale);
531
553
  }
532
554
  getColorSpaceAxes(xyChannels) {
533
555
  let { xChannel: xChannel , yChannel: yChannel } = xyChannels;
534
- let xCh = xChannel || this.getColorChannels().find((c)=>c !== yChannel
535
- );
536
- let yCh = yChannel || this.getColorChannels().find((c)=>c !== xCh
537
- );
538
- let zCh = this.getColorChannels().find((c)=>c !== xCh && c !== yCh
539
- );
556
+ let xCh = xChannel || this.getColorChannels().find((c)=>c !== yChannel);
557
+ let yCh = yChannel || this.getColorChannels().find((c)=>c !== xCh);
558
+ let zCh = this.getColorChannels().find((c)=>c !== xCh && c !== yCh);
540
559
  return {
541
560
  xChannel: xCh,
542
561
  yChannel: yCh,
@@ -545,40 +564,38 @@ class $83fe1a57d631223b$var$Color {
545
564
  }
546
565
  }
547
566
  class $83fe1a57d631223b$var$RGBColor extends $83fe1a57d631223b$var$Color {
548
- static parse(value1) {
567
+ static parse(value) {
549
568
  let colors = [];
550
569
  // matching #rgb, #rgba, #rrggbb, #rrggbbaa
551
- if (/^#[\da-f]+$/i.test(value1) && [
570
+ if (/^#[\da-f]+$/i.test(value) && [
552
571
  4,
553
572
  5,
554
573
  7,
555
574
  9
556
- ].includes(value1.length)) {
557
- const values = (value1.length < 6 ? value1.replace(/[^#]/gi, '$&$&') : value1).slice(1).split('');
558
- while(values.length > 0)colors.push(parseInt(values.splice(0, 2).join(''), 16));
575
+ ].includes(value.length)) {
576
+ const values = (value.length < 6 ? value.replace(/[^#]/gi, "$&$&") : value).slice(1).split("");
577
+ while(values.length > 0)colors.push(parseInt(values.splice(0, 2).join(""), 16));
559
578
  colors[3] = colors[3] !== undefined ? colors[3] / 255 : undefined;
560
579
  }
561
580
  // matching rgb(rrr, ggg, bbb), rgba(rrr, ggg, bbb, 0.a)
562
- const match = value1.match(/^rgba?\((.*)\)$/);
581
+ const match = value.match(/^rgba?\((.*)\)$/);
563
582
  if (match === null || match === void 0 ? void 0 : match[1]) {
564
- colors = match[1].split(',').map((value)=>Number(value.trim())
565
- );
566
- colors = colors.map((num, i)=>$4tN2K$reactstatelyutils.clamp(num, 0, i < 3 ? 255 : 1)
567
- );
583
+ colors = match[1].split(",").map((value)=>Number(value.trim()));
584
+ colors = colors.map((num, i)=>(0, $4tN2K$reactstatelyutils.clamp)(num, 0, i < 3 ? 255 : 1));
568
585
  }
569
586
  var ref;
570
587
  return colors.length < 3 ? undefined : new $83fe1a57d631223b$var$RGBColor(colors[0], colors[1], colors[2], (ref = colors[3]) !== null && ref !== void 0 ? ref : 1);
571
588
  }
572
589
  toString(format) {
573
590
  switch(format){
574
- case 'hex':
575
- return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0')).toUpperCase();
576
- case 'hexa':
577
- return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0') + Math.round(this.alpha * 255).toString(16).padStart(2, '0')).toUpperCase();
578
- case 'rgb':
591
+ case "hex":
592
+ return "#" + (this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0")).toUpperCase();
593
+ case "hexa":
594
+ return "#" + (this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0") + Math.round(this.alpha * 255).toString(16).padStart(2, "0")).toUpperCase();
595
+ case "rgb":
579
596
  return `rgb(${this.red}, ${this.green}, ${this.blue})`;
580
- case 'css':
581
- case 'rgba':
597
+ case "css":
598
+ case "rgba":
582
599
  return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
583
600
  default:
584
601
  return this.toFormat(format).toString(format);
@@ -586,19 +603,19 @@ class $83fe1a57d631223b$var$RGBColor extends $83fe1a57d631223b$var$Color {
586
603
  }
587
604
  toFormat(format) {
588
605
  switch(format){
589
- case 'hex':
590
- case 'hexa':
591
- case 'rgb':
592
- case 'rgba':
606
+ case "hex":
607
+ case "hexa":
608
+ case "rgb":
609
+ case "rgba":
593
610
  return this;
594
- case 'hsb':
595
- case 'hsba':
611
+ case "hsb":
612
+ case "hsba":
596
613
  return this.toHSB();
597
- case 'hsl':
598
- case 'hsla':
614
+ case "hsl":
615
+ case "hsla":
599
616
  return this.toHSL();
600
617
  default:
601
- throw new Error('Unsupported color conversion: rgb -> ' + format);
618
+ throw new Error("Unsupported color conversion: rgb -> " + format);
602
619
  }
603
620
  }
604
621
  toHexInt() {
@@ -631,7 +648,7 @@ class $83fe1a57d631223b$var$RGBColor extends $83fe1a57d631223b$var$Color {
631
648
  }
632
649
  hue /= 6;
633
650
  }
634
- return new $83fe1a57d631223b$var$HSBColor($4tN2K$reactstatelyutils.toFixedNumber(hue * 360, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(brightness * 100, 2), this.alpha);
651
+ return new $83fe1a57d631223b$var$HSBColor((0, $4tN2K$reactstatelyutils.toFixedNumber)(hue * 360, 2), (0, $4tN2K$reactstatelyutils.toFixedNumber)(saturation * 100, 2), (0, $4tN2K$reactstatelyutils.toFixedNumber)(brightness * 100, 2), this.alpha);
635
652
  }
636
653
  /**
637
654
  * Converts an RGB color value to HSL.
@@ -649,7 +666,7 @@ class $83fe1a57d631223b$var$RGBColor extends $83fe1a57d631223b$var$Color {
649
666
  let saturation;
650
667
  if (chroma === 0) hue = saturation = 0; // achromatic
651
668
  else {
652
- saturation = chroma / (lightness < 0.5 ? max + min : 2 - max - min);
669
+ saturation = chroma / (lightness < .5 ? max + min : 2 - max - min);
653
670
  switch(max){
654
671
  case red:
655
672
  hue = (green - blue) / chroma + (green < blue ? 6 : 0);
@@ -663,23 +680,23 @@ class $83fe1a57d631223b$var$RGBColor extends $83fe1a57d631223b$var$Color {
663
680
  }
664
681
  hue /= 6;
665
682
  }
666
- return new $83fe1a57d631223b$var$HSLColor($4tN2K$reactstatelyutils.toFixedNumber(hue * 360, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(lightness * 100, 2), this.alpha);
683
+ return new $83fe1a57d631223b$var$HSLColor((0, $4tN2K$reactstatelyutils.toFixedNumber)(hue * 360, 2), (0, $4tN2K$reactstatelyutils.toFixedNumber)(saturation * 100, 2), (0, $4tN2K$reactstatelyutils.toFixedNumber)(lightness * 100, 2), this.alpha);
667
684
  }
668
685
  clone() {
669
686
  return new $83fe1a57d631223b$var$RGBColor(this.red, this.green, this.blue, this.alpha);
670
687
  }
671
688
  getChannelRange(channel) {
672
689
  switch(channel){
673
- case 'red':
674
- case 'green':
675
- case 'blue':
690
+ case "red":
691
+ case "green":
692
+ case "blue":
676
693
  return {
677
- minValue: 0,
678
- maxValue: 255,
679
- step: 1,
680
- pageSize: 17
694
+ minValue: 0x0,
695
+ maxValue: 0xFF,
696
+ step: 0x1,
697
+ pageSize: 0x11
681
698
  };
682
- case 'alpha':
699
+ case "alpha":
683
700
  return {
684
701
  minValue: 0,
685
702
  maxValue: 1,
@@ -687,32 +704,32 @@ class $83fe1a57d631223b$var$RGBColor extends $83fe1a57d631223b$var$Color {
687
704
  pageSize: 0.1
688
705
  };
689
706
  default:
690
- throw new Error('Unknown color channel: ' + channel);
707
+ throw new Error("Unknown color channel: " + channel);
691
708
  }
692
709
  }
693
710
  formatChannelValue(channel, locale) {
694
711
  let options;
695
712
  let value = this.getChannelValue(channel);
696
713
  switch(channel){
697
- case 'red':
698
- case 'green':
699
- case 'blue':
714
+ case "red":
715
+ case "green":
716
+ case "blue":
700
717
  options = {
701
- style: 'decimal'
718
+ style: "decimal"
702
719
  };
703
720
  break;
704
- case 'alpha':
721
+ case "alpha":
705
722
  options = {
706
- style: 'percent'
723
+ style: "percent"
707
724
  };
708
725
  break;
709
726
  default:
710
- throw new Error('Unknown color channel: ' + channel);
727
+ throw new Error("Unknown color channel: " + channel);
711
728
  }
712
- return new $4tN2K$internationalizednumber.NumberFormatter(locale, options).format(value);
729
+ return new (0, $4tN2K$internationalizednumber.NumberFormatter)(locale, options).format(value);
713
730
  }
714
731
  getColorSpace() {
715
- return 'rgb';
732
+ return "rgb";
716
733
  }
717
734
  getColorChannels() {
718
735
  return $83fe1a57d631223b$var$RGBColor.colorChannels;
@@ -725,11 +742,11 @@ class $83fe1a57d631223b$var$RGBColor extends $83fe1a57d631223b$var$Color {
725
742
  this.alpha = alpha;
726
743
  }
727
744
  }
728
- $83fe1a57d631223b$var$RGBColor.colorChannels = [
729
- 'red',
730
- 'green',
731
- 'blue'
732
- ];
745
+ (0, $83fe1a57d631223b$import$d76420afe0f7f8c4$2e2bcd8739ae039)($83fe1a57d631223b$var$RGBColor, "colorChannels", [
746
+ "red",
747
+ "green",
748
+ "blue"
749
+ ]);
733
750
  // X = <negative/positive number with/without decimal places>
734
751
  // before/after a comma, 0 or more whitespaces are allowed
735
752
  // - hsb(X, X%, X%)
@@ -740,40 +757,39 @@ class $83fe1a57d631223b$var$HSBColor extends $83fe1a57d631223b$var$Color {
740
757
  let m;
741
758
  if (m = value.match($83fe1a57d631223b$var$HSB_REGEX)) {
742
759
  var ref;
743
- const [h, s, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
744
- );
745
- return new $83fe1a57d631223b$var$HSBColor($83fe1a57d631223b$var$mod(h, 360), $4tN2K$reactstatelyutils.clamp(s, 0, 100), $4tN2K$reactstatelyutils.clamp(b, 0, 100), $4tN2K$reactstatelyutils.clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
760
+ const [h, s, b, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(",").map((n)=>Number(n.trim().replace("%", "")));
761
+ return new $83fe1a57d631223b$var$HSBColor($83fe1a57d631223b$var$mod(h, 360), (0, $4tN2K$reactstatelyutils.clamp)(s, 0, 100), (0, $4tN2K$reactstatelyutils.clamp)(b, 0, 100), (0, $4tN2K$reactstatelyutils.clamp)(a !== null && a !== void 0 ? a : 1, 0, 1));
746
762
  }
747
763
  }
748
764
  toString(format) {
749
765
  switch(format){
750
- case 'css':
751
- return this.toHSL().toString('css');
752
- case 'hex':
753
- return this.toRGB().toString('hex');
754
- case 'hexa':
755
- return this.toRGB().toString('hexa');
756
- case 'hsb':
757
- return `hsb(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.brightness, 2)}%)`;
758
- case 'hsba':
759
- return `hsba(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.brightness, 2)}%, ${this.alpha})`;
766
+ case "css":
767
+ return this.toHSL().toString("css");
768
+ case "hex":
769
+ return this.toRGB().toString("hex");
770
+ case "hexa":
771
+ return this.toRGB().toString("hexa");
772
+ case "hsb":
773
+ return `hsb(${this.hue}, ${(0, $4tN2K$reactstatelyutils.toFixedNumber)(this.saturation, 2)}%, ${(0, $4tN2K$reactstatelyutils.toFixedNumber)(this.brightness, 2)}%)`;
774
+ case "hsba":
775
+ return `hsba(${this.hue}, ${(0, $4tN2K$reactstatelyutils.toFixedNumber)(this.saturation, 2)}%, ${(0, $4tN2K$reactstatelyutils.toFixedNumber)(this.brightness, 2)}%, ${this.alpha})`;
760
776
  default:
761
777
  return this.toFormat(format).toString(format);
762
778
  }
763
779
  }
764
780
  toFormat(format) {
765
781
  switch(format){
766
- case 'hsb':
767
- case 'hsba':
782
+ case "hsb":
783
+ case "hsba":
768
784
  return this;
769
- case 'hsl':
770
- case 'hsla':
785
+ case "hsl":
786
+ case "hsla":
771
787
  return this.toHSL();
772
- case 'rgb':
773
- case 'rgba':
788
+ case "rgb":
789
+ case "rgba":
774
790
  return this.toRGB();
775
791
  default:
776
- throw new Error('Unsupported color conversion: hsb -> ' + format);
792
+ throw new Error("Unsupported color conversion: hsb -> " + format);
777
793
  }
778
794
  }
779
795
  /**
@@ -785,7 +801,7 @@ class $83fe1a57d631223b$var$HSBColor extends $83fe1a57d631223b$var$Color {
785
801
  let brightness = this.brightness / 100;
786
802
  let lightness = brightness * (1 - saturation / 2);
787
803
  saturation = lightness === 0 || lightness === 1 ? 0 : (brightness - lightness) / Math.min(lightness, 1 - lightness);
788
- return new $83fe1a57d631223b$var$HSLColor($4tN2K$reactstatelyutils.toFixedNumber(this.hue, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(lightness * 100, 2), this.alpha);
804
+ return new $83fe1a57d631223b$var$HSLColor((0, $4tN2K$reactstatelyutils.toFixedNumber)(this.hue, 2), (0, $4tN2K$reactstatelyutils.toFixedNumber)(saturation * 100, 2), (0, $4tN2K$reactstatelyutils.toFixedNumber)(lightness * 100, 2), this.alpha);
789
805
  }
790
806
  /**
791
807
  * Converts a HSV color value to RGB.
@@ -795,8 +811,7 @@ class $83fe1a57d631223b$var$HSBColor extends $83fe1a57d631223b$var$Color {
795
811
  let hue = this.hue;
796
812
  let saturation = this.saturation / 100;
797
813
  let brightness = this.brightness / 100;
798
- let fn = (n, k = (n + hue / 60) % 6)=>brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0)
799
- ;
814
+ let fn = (n, k = (n + hue / 60) % 6)=>brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0);
800
815
  return new $83fe1a57d631223b$var$RGBColor(Math.round(fn(5) * 255), Math.round(fn(3) * 255), Math.round(fn(1) * 255), this.alpha);
801
816
  }
802
817
  clone() {
@@ -804,22 +819,22 @@ class $83fe1a57d631223b$var$HSBColor extends $83fe1a57d631223b$var$Color {
804
819
  }
805
820
  getChannelRange(channel) {
806
821
  switch(channel){
807
- case 'hue':
822
+ case "hue":
808
823
  return {
809
824
  minValue: 0,
810
825
  maxValue: 360,
811
826
  step: 1,
812
827
  pageSize: 15
813
828
  };
814
- case 'saturation':
815
- case 'brightness':
829
+ case "saturation":
830
+ case "brightness":
816
831
  return {
817
832
  minValue: 0,
818
833
  maxValue: 100,
819
834
  step: 1,
820
835
  pageSize: 10
821
836
  };
822
- case 'alpha':
837
+ case "alpha":
823
838
  return {
824
839
  minValue: 0,
825
840
  maxValue: 1,
@@ -827,39 +842,39 @@ class $83fe1a57d631223b$var$HSBColor extends $83fe1a57d631223b$var$Color {
827
842
  pageSize: 0.1
828
843
  };
829
844
  default:
830
- throw new Error('Unknown color channel: ' + channel);
845
+ throw new Error("Unknown color channel: " + channel);
831
846
  }
832
847
  }
833
848
  formatChannelValue(channel, locale) {
834
849
  let options;
835
850
  let value = this.getChannelValue(channel);
836
851
  switch(channel){
837
- case 'hue':
852
+ case "hue":
838
853
  options = {
839
- style: 'unit',
840
- unit: 'degree',
841
- unitDisplay: 'narrow'
854
+ style: "unit",
855
+ unit: "degree",
856
+ unitDisplay: "narrow"
842
857
  };
843
858
  break;
844
- case 'saturation':
845
- case 'brightness':
859
+ case "saturation":
860
+ case "brightness":
846
861
  options = {
847
- style: 'percent'
862
+ style: "percent"
848
863
  };
849
864
  value /= 100;
850
865
  break;
851
- case 'alpha':
866
+ case "alpha":
852
867
  options = {
853
- style: 'percent'
868
+ style: "percent"
854
869
  };
855
870
  break;
856
871
  default:
857
- throw new Error('Unknown color channel: ' + channel);
872
+ throw new Error("Unknown color channel: " + channel);
858
873
  }
859
- return new $4tN2K$internationalizednumber.NumberFormatter(locale, options).format(value);
874
+ return new (0, $4tN2K$internationalizednumber.NumberFormatter)(locale, options).format(value);
860
875
  }
861
876
  getColorSpace() {
862
- return 'hsb';
877
+ return "hsb";
863
878
  }
864
879
  getColorChannels() {
865
880
  return $83fe1a57d631223b$var$HSBColor.colorChannels;
@@ -872,11 +887,11 @@ class $83fe1a57d631223b$var$HSBColor extends $83fe1a57d631223b$var$Color {
872
887
  this.alpha = alpha;
873
888
  }
874
889
  }
875
- $83fe1a57d631223b$var$HSBColor.colorChannels = [
876
- 'hue',
877
- 'saturation',
878
- 'brightness'
879
- ];
890
+ (0, $83fe1a57d631223b$import$d76420afe0f7f8c4$2e2bcd8739ae039)($83fe1a57d631223b$var$HSBColor, "colorChannels", [
891
+ "hue",
892
+ "saturation",
893
+ "brightness"
894
+ ]);
880
895
  // X = <negative/positive number with/without decimal places>
881
896
  // before/after a comma, 0 or more whitespaces are allowed
882
897
  // - hsl(X, X%, X%)
@@ -890,39 +905,38 @@ class $83fe1a57d631223b$var$HSLColor extends $83fe1a57d631223b$var$Color {
890
905
  let m;
891
906
  if (m = value.match($83fe1a57d631223b$var$HSL_REGEX)) {
892
907
  var ref;
893
- const [h, s, l, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(',').map((n)=>Number(n.trim().replace('%', ''))
894
- );
895
- return new $83fe1a57d631223b$var$HSLColor($83fe1a57d631223b$var$mod(h, 360), $4tN2K$reactstatelyutils.clamp(s, 0, 100), $4tN2K$reactstatelyutils.clamp(l, 0, 100), $4tN2K$reactstatelyutils.clamp(a !== null && a !== void 0 ? a : 1, 0, 1));
908
+ const [h, s, l, a] = ((ref = m[1]) !== null && ref !== void 0 ? ref : m[2]).split(",").map((n)=>Number(n.trim().replace("%", "")));
909
+ return new $83fe1a57d631223b$var$HSLColor($83fe1a57d631223b$var$mod(h, 360), (0, $4tN2K$reactstatelyutils.clamp)(s, 0, 100), (0, $4tN2K$reactstatelyutils.clamp)(l, 0, 100), (0, $4tN2K$reactstatelyutils.clamp)(a !== null && a !== void 0 ? a : 1, 0, 1));
896
910
  }
897
911
  }
898
912
  toString(format) {
899
913
  switch(format){
900
- case 'hex':
901
- return this.toRGB().toString('hex');
902
- case 'hexa':
903
- return this.toRGB().toString('hexa');
904
- case 'hsl':
905
- return `hsl(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.lightness, 2)}%)`;
906
- case 'css':
907
- case 'hsla':
908
- return `hsla(${this.hue}, ${$4tN2K$reactstatelyutils.toFixedNumber(this.saturation, 2)}%, ${$4tN2K$reactstatelyutils.toFixedNumber(this.lightness, 2)}%, ${this.alpha})`;
914
+ case "hex":
915
+ return this.toRGB().toString("hex");
916
+ case "hexa":
917
+ return this.toRGB().toString("hexa");
918
+ case "hsl":
919
+ return `hsl(${this.hue}, ${(0, $4tN2K$reactstatelyutils.toFixedNumber)(this.saturation, 2)}%, ${(0, $4tN2K$reactstatelyutils.toFixedNumber)(this.lightness, 2)}%)`;
920
+ case "css":
921
+ case "hsla":
922
+ return `hsla(${this.hue}, ${(0, $4tN2K$reactstatelyutils.toFixedNumber)(this.saturation, 2)}%, ${(0, $4tN2K$reactstatelyutils.toFixedNumber)(this.lightness, 2)}%, ${this.alpha})`;
909
923
  default:
910
924
  return this.toFormat(format).toString(format);
911
925
  }
912
926
  }
913
927
  toFormat(format) {
914
928
  switch(format){
915
- case 'hsl':
916
- case 'hsla':
929
+ case "hsl":
930
+ case "hsla":
917
931
  return this;
918
- case 'hsb':
919
- case 'hsba':
932
+ case "hsb":
933
+ case "hsba":
920
934
  return this.toHSB();
921
- case 'rgb':
922
- case 'rgba':
935
+ case "rgb":
936
+ case "rgba":
923
937
  return this.toRGB();
924
938
  default:
925
- throw new Error('Unsupported color conversion: hsl -> ' + format);
939
+ throw new Error("Unsupported color conversion: hsl -> " + format);
926
940
  }
927
941
  }
928
942
  /**
@@ -934,7 +948,7 @@ class $83fe1a57d631223b$var$HSLColor extends $83fe1a57d631223b$var$Color {
934
948
  let lightness = this.lightness / 100;
935
949
  let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
936
950
  saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
937
- return new $83fe1a57d631223b$var$HSBColor($4tN2K$reactstatelyutils.toFixedNumber(this.hue, 2), $4tN2K$reactstatelyutils.toFixedNumber(saturation * 100, 2), $4tN2K$reactstatelyutils.toFixedNumber(brightness * 100, 2), this.alpha);
951
+ return new $83fe1a57d631223b$var$HSBColor((0, $4tN2K$reactstatelyutils.toFixedNumber)(this.hue, 2), (0, $4tN2K$reactstatelyutils.toFixedNumber)(saturation * 100, 2), (0, $4tN2K$reactstatelyutils.toFixedNumber)(brightness * 100, 2), this.alpha);
938
952
  }
939
953
  /**
940
954
  * Converts a HSL color to RGB.
@@ -945,8 +959,7 @@ class $83fe1a57d631223b$var$HSLColor extends $83fe1a57d631223b$var$Color {
945
959
  let saturation = this.saturation / 100;
946
960
  let lightness = this.lightness / 100;
947
961
  let a = saturation * Math.min(lightness, 1 - lightness);
948
- let fn = (n, k = (n + hue / 30) % 12)=>lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)
949
- ;
962
+ let fn = (n, k = (n + hue / 30) % 12)=>lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
950
963
  return new $83fe1a57d631223b$var$RGBColor(Math.round(fn(0) * 255), Math.round(fn(8) * 255), Math.round(fn(4) * 255), this.alpha);
951
964
  }
952
965
  clone() {
@@ -954,22 +967,22 @@ class $83fe1a57d631223b$var$HSLColor extends $83fe1a57d631223b$var$Color {
954
967
  }
955
968
  getChannelRange(channel) {
956
969
  switch(channel){
957
- case 'hue':
970
+ case "hue":
958
971
  return {
959
972
  minValue: 0,
960
973
  maxValue: 360,
961
974
  step: 1,
962
975
  pageSize: 15
963
976
  };
964
- case 'saturation':
965
- case 'lightness':
977
+ case "saturation":
978
+ case "lightness":
966
979
  return {
967
980
  minValue: 0,
968
981
  maxValue: 100,
969
982
  step: 1,
970
983
  pageSize: 10
971
984
  };
972
- case 'alpha':
985
+ case "alpha":
973
986
  return {
974
987
  minValue: 0,
975
988
  maxValue: 1,
@@ -977,39 +990,39 @@ class $83fe1a57d631223b$var$HSLColor extends $83fe1a57d631223b$var$Color {
977
990
  pageSize: 0.1
978
991
  };
979
992
  default:
980
- throw new Error('Unknown color channel: ' + channel);
993
+ throw new Error("Unknown color channel: " + channel);
981
994
  }
982
995
  }
983
996
  formatChannelValue(channel, locale) {
984
997
  let options;
985
998
  let value = this.getChannelValue(channel);
986
999
  switch(channel){
987
- case 'hue':
1000
+ case "hue":
988
1001
  options = {
989
- style: 'unit',
990
- unit: 'degree',
991
- unitDisplay: 'narrow'
1002
+ style: "unit",
1003
+ unit: "degree",
1004
+ unitDisplay: "narrow"
992
1005
  };
993
1006
  break;
994
- case 'saturation':
995
- case 'lightness':
1007
+ case "saturation":
1008
+ case "lightness":
996
1009
  options = {
997
- style: 'percent'
1010
+ style: "percent"
998
1011
  };
999
1012
  value /= 100;
1000
1013
  break;
1001
- case 'alpha':
1014
+ case "alpha":
1002
1015
  options = {
1003
- style: 'percent'
1016
+ style: "percent"
1004
1017
  };
1005
1018
  break;
1006
1019
  default:
1007
- throw new Error('Unknown color channel: ' + channel);
1020
+ throw new Error("Unknown color channel: " + channel);
1008
1021
  }
1009
- return new $4tN2K$internationalizednumber.NumberFormatter(locale, options).format(value);
1022
+ return new (0, $4tN2K$internationalizednumber.NumberFormatter)(locale, options).format(value);
1010
1023
  }
1011
1024
  getColorSpace() {
1012
- return 'hsl';
1025
+ return "hsl";
1013
1026
  }
1014
1027
  getColorChannels() {
1015
1028
  return $83fe1a57d631223b$var$HSLColor.colorChannels;
@@ -1022,28 +1035,37 @@ class $83fe1a57d631223b$var$HSLColor extends $83fe1a57d631223b$var$Color {
1022
1035
  this.alpha = alpha;
1023
1036
  }
1024
1037
  }
1025
- $83fe1a57d631223b$var$HSLColor.colorChannels = [
1026
- 'hue',
1027
- 'saturation',
1028
- 'lightness'
1029
- ];
1030
-
1031
-
1032
-
1033
-
1034
-
1035
- const $af2d7ac9990cfee2$var$DEFAULT_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('#ffffff');
1038
+ (0, $83fe1a57d631223b$import$d76420afe0f7f8c4$2e2bcd8739ae039)($83fe1a57d631223b$var$HSLColor, "colorChannels", [
1039
+ "hue",
1040
+ "saturation",
1041
+ "lightness"
1042
+ ]);
1043
+
1044
+
1045
+ /*
1046
+ * Copyright 2020 Adobe. All rights reserved.
1047
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1048
+ * you may not use this file except in compliance with the License. You may obtain a copy
1049
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1050
+ *
1051
+ * Unless required by applicable law or agreed to in writing, software distributed under
1052
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1053
+ * OF ANY KIND, either express or implied. See the License for the specific language
1054
+ * governing permissions and limitations under the License.
1055
+ */
1056
+
1057
+
1058
+ const $af2d7ac9990cfee2$var$DEFAULT_COLOR = (0, $83fe1a57d631223b$export$6e865ea70d7724f)("#ffffff");
1036
1059
  function $af2d7ac9990cfee2$export$6df7f0e2cabc7eef(props) {
1037
- let { value: value1 , defaultValue: defaultValue , xChannel: xChannel , yChannel: yChannel , onChange: onChange , onChangeEnd: onChangeEnd } = props;
1038
- if (!value1 && !defaultValue) defaultValue = $af2d7ac9990cfee2$var$DEFAULT_COLOR;
1039
- let [color, setColor] = $4tN2K$reactstatelyutils.useControlledState(value1 && $83fe1a57d631223b$export$4cde5df63f53f473(value1), defaultValue && $83fe1a57d631223b$export$4cde5df63f53f473(defaultValue), onChange);
1040
- let valueRef = $4tN2K$react.useRef(color);
1060
+ let { value: value , defaultValue: defaultValue , xChannel: xChannel , yChannel: yChannel , onChange: onChange , onChangeEnd: onChangeEnd } = props;
1061
+ if (!value && !defaultValue) defaultValue = $af2d7ac9990cfee2$var$DEFAULT_COLOR;
1062
+ let [color, setColor] = (0, $4tN2K$reactstatelyutils.useControlledState)(value && (0, $83fe1a57d631223b$export$4cde5df63f53f473)(value), defaultValue && (0, $83fe1a57d631223b$export$4cde5df63f53f473)(defaultValue), onChange);
1063
+ let valueRef = (0, $4tN2K$react.useRef)(color);
1041
1064
  valueRef.current = color;
1042
- let channels = $4tN2K$react.useMemo(()=>valueRef.current.getColorSpaceAxes({
1065
+ let channels = (0, $4tN2K$react.useMemo)(()=>valueRef.current.getColorSpaceAxes({
1043
1066
  xChannel: xChannel,
1044
1067
  yChannel: yChannel
1045
- })
1046
- , [
1068
+ }), [
1047
1069
  xChannel,
1048
1070
  yChannel
1049
1071
  ]);
@@ -1051,8 +1073,8 @@ function $af2d7ac9990cfee2$export$6df7f0e2cabc7eef(props) {
1051
1073
  let yChannelRange = color.getChannelRange(channels.yChannel);
1052
1074
  let { minValue: minValueX , maxValue: maxValueX , step: stepX , pageSize: pageSizeX } = xChannelRange;
1053
1075
  let { minValue: minValueY , maxValue: maxValueY , step: stepY , pageSize: pageSizeY } = yChannelRange;
1054
- let [isDragging1, setDragging] = $4tN2K$react.useState(false);
1055
- let isDraggingRef = $4tN2K$react.useRef(false).current;
1076
+ let [isDragging, setDragging] = (0, $4tN2K$react.useState)(false);
1077
+ let isDraggingRef = (0, $4tN2K$react.useRef)(false).current;
1056
1078
  let xValue = color.getChannelValue(channels.xChannel);
1057
1079
  let yValue = color.getChannelValue(channels.yChannel);
1058
1080
  let setXValue = (v)=>{
@@ -1073,7 +1095,7 @@ function $af2d7ac9990cfee2$export$6df7f0e2cabc7eef(props) {
1073
1095
  yChannelPageStep: pageSizeY,
1074
1096
  value: color,
1075
1097
  setValue (value) {
1076
- let c = $83fe1a57d631223b$export$4cde5df63f53f473(value);
1098
+ let c = (0, $83fe1a57d631223b$export$4cde5df63f53f473)(value);
1077
1099
  valueRef.current = c;
1078
1100
  setColor(c);
1079
1101
  },
@@ -1082,17 +1104,17 @@ function $af2d7ac9990cfee2$export$6df7f0e2cabc7eef(props) {
1082
1104
  yValue: yValue,
1083
1105
  setYValue: setYValue,
1084
1106
  setColorFromPoint (x, y) {
1085
- let newXValue = minValueX + $4tN2K$reactstatelyutils.clamp(x, 0, 1) * (maxValueX - minValueX);
1086
- let newYValue = minValueY + (1 - $4tN2K$reactstatelyutils.clamp(y, 0, 1)) * (maxValueY - minValueY);
1107
+ let newXValue = minValueX + (0, $4tN2K$reactstatelyutils.clamp)(x, 0, 1) * (maxValueX - minValueX);
1108
+ let newYValue = minValueY + (1 - (0, $4tN2K$reactstatelyutils.clamp)(y, 0, 1)) * (maxValueY - minValueY);
1087
1109
  let newColor;
1088
1110
  if (newXValue !== xValue) {
1089
1111
  // Round new value to multiple of step, clamp value between min and max
1090
- newXValue = $4tN2K$reactstatelyutils.snapValueToStep(newXValue, minValueX, maxValueX, stepX);
1112
+ newXValue = (0, $4tN2K$reactstatelyutils.snapValueToStep)(newXValue, minValueX, maxValueX, stepX);
1091
1113
  newColor = color.withChannelValue(channels.xChannel, newXValue);
1092
1114
  }
1093
1115
  if (newYValue !== yValue) {
1094
1116
  // Round new value to multiple of step, clamp value between min and max
1095
- newYValue = $4tN2K$reactstatelyutils.snapValueToStep(newYValue, minValueY, maxValueY, stepY);
1117
+ newYValue = (0, $4tN2K$reactstatelyutils.snapValueToStep)(newYValue, minValueY, maxValueY, stepY);
1096
1118
  newColor = (newColor || color).withChannelValue(channels.yChannel, newYValue);
1097
1119
  }
1098
1120
  if (newColor) setColor(newColor);
@@ -1106,16 +1128,16 @@ function $af2d7ac9990cfee2$export$6df7f0e2cabc7eef(props) {
1106
1128
  };
1107
1129
  },
1108
1130
  incrementX (stepSize) {
1109
- setXValue(xValue + stepSize > maxValueX ? maxValueX : $4tN2K$reactstatelyutils.snapValueToStep(xValue + stepSize, minValueX, maxValueX, stepX));
1131
+ setXValue(xValue + stepSize > maxValueX ? maxValueX : (0, $4tN2K$reactstatelyutils.snapValueToStep)(xValue + stepSize, minValueX, maxValueX, stepX));
1110
1132
  },
1111
1133
  incrementY (stepSize) {
1112
- setYValue(yValue + stepSize > maxValueY ? maxValueY : $4tN2K$reactstatelyutils.snapValueToStep(yValue + stepSize, minValueY, maxValueY, stepY));
1134
+ setYValue(yValue + stepSize > maxValueY ? maxValueY : (0, $4tN2K$reactstatelyutils.snapValueToStep)(yValue + stepSize, minValueY, maxValueY, stepY));
1113
1135
  },
1114
1136
  decrementX (stepSize) {
1115
- setXValue($4tN2K$reactstatelyutils.snapValueToStep(xValue - stepSize, minValueX, maxValueX, stepX));
1137
+ setXValue((0, $4tN2K$reactstatelyutils.snapValueToStep)(xValue - stepSize, minValueX, maxValueX, stepX));
1116
1138
  },
1117
1139
  decrementY (stepSize) {
1118
- setYValue($4tN2K$reactstatelyutils.snapValueToStep(yValue - stepSize, minValueY, maxValueY, stepY));
1140
+ setYValue((0, $4tN2K$reactstatelyutils.snapValueToStep)(yValue - stepSize, minValueY, maxValueY, stepY));
1119
1141
  },
1120
1142
  setDragging (isDragging) {
1121
1143
  let wasDragging = isDraggingRef;
@@ -1123,22 +1145,32 @@ function $af2d7ac9990cfee2$export$6df7f0e2cabc7eef(props) {
1123
1145
  if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
1124
1146
  setDragging(isDragging);
1125
1147
  },
1126
- isDragging: isDragging1,
1148
+ isDragging: isDragging,
1127
1149
  getDisplayColor () {
1128
- return color.withChannelValue('alpha', 1);
1150
+ return color.withChannelValue("alpha", 1);
1129
1151
  }
1130
1152
  };
1131
1153
  }
1132
1154
 
1133
1155
 
1134
-
1156
+ /*
1157
+ * Copyright 2020 Adobe. All rights reserved.
1158
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1159
+ * you may not use this file except in compliance with the License. You may obtain a copy
1160
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1161
+ *
1162
+ * Unless required by applicable law or agreed to in writing, software distributed under
1163
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1164
+ * OF ANY KIND, either express or implied. See the License for the specific language
1165
+ * governing permissions and limitations under the License.
1166
+ */
1135
1167
 
1136
1168
 
1137
1169
  function $5386a492cfd3234c$export$57bc203e1c9c6d44(props) {
1138
- let { channel: channel , value: value1 , defaultValue: defaultValue , onChange: onChange , locale: locale , ...otherProps } = props;
1139
- if (value1 == null && defaultValue == null) throw new Error('useColorSliderState requires a value or defaultValue');
1140
- let [color, setColor] = $4tN2K$reactstatelyutils.useControlledState(value1 && $83fe1a57d631223b$export$4cde5df63f53f473(value1), defaultValue && $83fe1a57d631223b$export$4cde5df63f53f473(defaultValue), onChange);
1141
- let sliderState = $4tN2K$reactstatelyslider.useSliderState({
1170
+ let { channel: channel , value: value , defaultValue: defaultValue , onChange: onChange , locale: locale , ...otherProps } = props;
1171
+ if (value == null && defaultValue == null) throw new Error("useColorSliderState requires a value or defaultValue");
1172
+ let [color, setColor] = (0, $4tN2K$reactstatelyutils.useControlledState)(value && (0, $83fe1a57d631223b$export$4cde5df63f53f473)(value), defaultValue && (0, $83fe1a57d631223b$export$4cde5df63f53f473)(defaultValue), onChange);
1173
+ let sliderState = (0, $4tN2K$reactstatelyslider.useSliderState)({
1142
1174
  ...color.getChannelRange(channel),
1143
1175
  ...otherProps,
1144
1176
  // Unused except in getThumbValueLabel, which is overridden below. null to appease TypeScript.
@@ -1157,23 +1189,23 @@ function $5386a492cfd3234c$export$57bc203e1c9c6d44(props) {
1157
1189
  ...sliderState,
1158
1190
  value: color,
1159
1191
  setValue (value) {
1160
- setColor($83fe1a57d631223b$export$4cde5df63f53f473(value));
1192
+ setColor((0, $83fe1a57d631223b$export$4cde5df63f53f473)(value));
1161
1193
  },
1162
1194
  getDisplayColor () {
1163
1195
  switch(channel){
1164
- case 'hue':
1165
- return $83fe1a57d631223b$export$6e865ea70d7724f(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);
1166
- case 'lightness':
1167
- case 'brightness':
1168
- case 'saturation':
1169
- case 'red':
1170
- case 'green':
1171
- case 'blue':
1172
- return color.withChannelValue('alpha', 1);
1173
- case 'alpha':
1196
+ case "hue":
1197
+ return (0, $83fe1a57d631223b$export$6e865ea70d7724f)(`hsl(${color.getChannelValue("hue")}, 100%, 50%)`);
1198
+ case "lightness":
1199
+ case "brightness":
1200
+ case "saturation":
1201
+ case "red":
1202
+ case "green":
1203
+ case "blue":
1204
+ return color.withChannelValue("alpha", 1);
1205
+ case "alpha":
1174
1206
  return color;
1175
1207
  default:
1176
- throw new Error('Unknown color channel: ' + channel);
1208
+ throw new Error("Unknown color channel: " + channel);
1177
1209
  }
1178
1210
  },
1179
1211
  getThumbValueLabel () {
@@ -1185,10 +1217,20 @@ function $5386a492cfd3234c$export$57bc203e1c9c6d44(props) {
1185
1217
  }
1186
1218
 
1187
1219
 
1220
+ /*
1221
+ * Copyright 2020 Adobe. All rights reserved.
1222
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1223
+ * you may not use this file except in compliance with the License. You may obtain a copy
1224
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1225
+ *
1226
+ * Unless required by applicable law or agreed to in writing, software distributed under
1227
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1228
+ * OF ANY KIND, either express or implied. See the License for the specific language
1229
+ * governing permissions and limitations under the License.
1230
+ */
1188
1231
 
1189
1232
 
1190
-
1191
- const $9d7d8736d45f74b8$var$DEFAULT_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('hsl(0, 100%, 50%)');
1233
+ const $9d7d8736d45f74b8$var$DEFAULT_COLOR = (0, $83fe1a57d631223b$export$6e865ea70d7724f)("hsl(0, 100%, 50%)");
1192
1234
  function $9d7d8736d45f74b8$var$roundToStep(value, step) {
1193
1235
  return Math.round(value / step) * step;
1194
1236
  }
@@ -1223,20 +1265,20 @@ function $9d7d8736d45f74b8$var$cartesianToAngle(x, y, radius) {
1223
1265
  function $9d7d8736d45f74b8$export$f4301076d9336137(props) {
1224
1266
  let { defaultValue: defaultValue , onChange: onChange , onChangeEnd: onChangeEnd } = props;
1225
1267
  if (!props.value && !defaultValue) defaultValue = $9d7d8736d45f74b8$var$DEFAULT_COLOR;
1226
- let [value, setValue] = $4tN2K$reactstatelyutils.useControlledState($83fe1a57d631223b$export$4cde5df63f53f473(props.value), $83fe1a57d631223b$export$4cde5df63f53f473(defaultValue), onChange);
1227
- let valueRef = $4tN2K$react.useRef(value);
1268
+ let [value, setValue] = (0, $4tN2K$reactstatelyutils.useControlledState)((0, $83fe1a57d631223b$export$4cde5df63f53f473)(props.value), (0, $83fe1a57d631223b$export$4cde5df63f53f473)(defaultValue), onChange);
1269
+ let valueRef = (0, $4tN2K$react.useRef)(value);
1228
1270
  valueRef.current = value;
1229
- let channelRange = value.getChannelRange('hue');
1271
+ let channelRange = value.getChannelRange("hue");
1230
1272
  let { minValue: minValueX , maxValue: maxValueX , step: step , pageSize: pageStep } = channelRange;
1231
- let [isDragging1, setDragging] = $4tN2K$react.useState(false);
1232
- let isDraggingRef = $4tN2K$react.useRef(false).current;
1233
- let hue = value.getChannelValue('hue');
1273
+ let [isDragging, setDragging] = (0, $4tN2K$react.useState)(false);
1274
+ let isDraggingRef = (0, $4tN2K$react.useRef)(false).current;
1275
+ let hue = value.getChannelValue("hue");
1234
1276
  function setHue(v) {
1235
1277
  if (v > 360) // Make sure you can always get back to 0.
1236
1278
  v = 0;
1237
1279
  v = $9d7d8736d45f74b8$var$roundToStep($9d7d8736d45f74b8$var$mod(v, 360), step);
1238
1280
  if (hue !== v) {
1239
- let color = value.withChannelValue('hue', v);
1281
+ let color = value.withChannelValue("hue", v);
1240
1282
  valueRef.current = color;
1241
1283
  setValue(color);
1242
1284
  }
@@ -1246,7 +1288,7 @@ function $9d7d8736d45f74b8$export$f4301076d9336137(props) {
1246
1288
  step: step,
1247
1289
  pageStep: pageStep,
1248
1290
  setValue (v) {
1249
- let color = $83fe1a57d631223b$export$4cde5df63f53f473(v);
1291
+ let color = (0, $83fe1a57d631223b$export$4cde5df63f53f473)(v);
1250
1292
  valueRef.current = color;
1251
1293
  setValue(color);
1252
1294
  },
@@ -1256,7 +1298,7 @@ function $9d7d8736d45f74b8$export$f4301076d9336137(props) {
1256
1298
  setHue($9d7d8736d45f74b8$var$cartesianToAngle(x, y, radius));
1257
1299
  },
1258
1300
  getThumbPosition (radius) {
1259
- return $9d7d8736d45f74b8$var$angleToCartesian(value.getChannelValue('hue'), radius);
1301
+ return $9d7d8736d45f74b8$var$angleToCartesian(value.getChannelValue("hue"), radius);
1260
1302
  },
1261
1303
  increment (stepSize = 1) {
1262
1304
  let s = Math.max(stepSize, step);
@@ -1278,21 +1320,41 @@ function $9d7d8736d45f74b8$export$f4301076d9336137(props) {
1278
1320
  if (onChangeEnd && !isDragging && wasDragging) onChangeEnd(valueRef.current);
1279
1321
  setDragging(isDragging);
1280
1322
  },
1281
- isDragging: isDragging1,
1323
+ isDragging: isDragging,
1282
1324
  getDisplayColor () {
1283
- return value.toFormat('hsl').withChannelValue('saturation', 100).withChannelValue('lightness', 50).withChannelValue('alpha', 1);
1325
+ return value.toFormat("hsl").withChannelValue("saturation", 100).withChannelValue("lightness", 50).withChannelValue("alpha", 1);
1284
1326
  }
1285
1327
  };
1286
1328
  }
1287
1329
 
1288
1330
 
1289
-
1290
-
1331
+ /*
1332
+ * Copyright 2020 Adobe. All rights reserved.
1333
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1334
+ * you may not use this file except in compliance with the License. You may obtain a copy
1335
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1336
+ *
1337
+ * Unless required by applicable law or agreed to in writing, software distributed under
1338
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1339
+ * OF ANY KIND, either express or implied. See the License for the specific language
1340
+ * governing permissions and limitations under the License.
1341
+ */
1342
+ /*
1343
+ * Copyright 2020 Adobe. All rights reserved.
1344
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1345
+ * you may not use this file except in compliance with the License. You may obtain a copy
1346
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1347
+ *
1348
+ * Unless required by applicable law or agreed to in writing, software distributed under
1349
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1350
+ * OF ANY KIND, either express or implied. See the License for the specific language
1351
+ * governing permissions and limitations under the License.
1352
+ */
1291
1353
 
1292
1354
  function $f8b3be23ba4462b1$export$5aadd9c0606af5c2(value) {
1293
- return $4tN2K$react.useMemo(()=>{
1294
- if (typeof value === 'string') try {
1295
- return $83fe1a57d631223b$export$6e865ea70d7724f(value);
1355
+ return (0, $4tN2K$react.useMemo)(()=>{
1356
+ if (typeof value === "string") try {
1357
+ return (0, $83fe1a57d631223b$export$6e865ea70d7724f)(value);
1296
1358
  } catch (err) {
1297
1359
  return undefined;
1298
1360
  }
@@ -1305,18 +1367,17 @@ function $f8b3be23ba4462b1$export$5aadd9c0606af5c2(value) {
1305
1367
 
1306
1368
 
1307
1369
 
1308
- const $d59d0c2b2ce1568f$var$MIN_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('#000000');
1309
- const $d59d0c2b2ce1568f$var$MAX_COLOR = $83fe1a57d631223b$export$6e865ea70d7724f('#FFFFFF');
1370
+ const $d59d0c2b2ce1568f$var$MIN_COLOR = (0, $83fe1a57d631223b$export$6e865ea70d7724f)("#000000");
1371
+ const $d59d0c2b2ce1568f$var$MAX_COLOR = (0, $83fe1a57d631223b$export$6e865ea70d7724f)("#FFFFFF");
1310
1372
  const $d59d0c2b2ce1568f$var$MIN_COLOR_INT = $d59d0c2b2ce1568f$var$MIN_COLOR.toHexInt();
1311
1373
  const $d59d0c2b2ce1568f$var$MAX_COLOR_INT = $d59d0c2b2ce1568f$var$MAX_COLOR.toHexInt();
1312
1374
  function $d59d0c2b2ce1568f$export$d52a01683abdfcd6(props) {
1313
- let { value: value1 , defaultValue: defaultValue , onChange: onChange } = props;
1314
- let { step: step } = $d59d0c2b2ce1568f$var$MIN_COLOR.getChannelRange('red');
1315
- let initialValue = $f8b3be23ba4462b1$export$5aadd9c0606af5c2(value1);
1316
- let initialDefaultValue = $f8b3be23ba4462b1$export$5aadd9c0606af5c2(defaultValue);
1317
- let [colorValue, setColorValue] = $4tN2K$reactstatelyutils.useControlledState(initialValue, initialDefaultValue, onChange);
1318
- let [inputValue, setInputValue] = $4tN2K$react.useState(()=>(value1 || defaultValue) && colorValue ? colorValue.toString('hex') : ''
1319
- );
1375
+ let { value: value , defaultValue: defaultValue , onChange: onChange } = props;
1376
+ let { step: step } = $d59d0c2b2ce1568f$var$MIN_COLOR.getChannelRange("red");
1377
+ let initialValue = (0, $f8b3be23ba4462b1$export$5aadd9c0606af5c2)(value);
1378
+ let initialDefaultValue = (0, $f8b3be23ba4462b1$export$5aadd9c0606af5c2)(defaultValue);
1379
+ let [colorValue, setColorValue] = (0, $4tN2K$reactstatelyutils.useControlledState)(initialValue, initialDefaultValue, onChange);
1380
+ let [inputValue, setInputValue] = (0, $4tN2K$react.useState)(()=>(value || defaultValue) && colorValue ? colorValue.toString("hex") : "");
1320
1381
  let safelySetColorValue = (newColor)=>{
1321
1382
  if (!colorValue || !newColor) {
1322
1383
  setColorValue(newColor);
@@ -1327,15 +1388,15 @@ function $d59d0c2b2ce1568f$export$d52a01683abdfcd6(props) {
1327
1388
  return;
1328
1389
  }
1329
1390
  };
1330
- let prevValue = $4tN2K$react.useRef(colorValue);
1391
+ let prevValue = (0, $4tN2K$react.useRef)(colorValue);
1331
1392
  if (prevValue.current !== colorValue) {
1332
- setInputValue(colorValue ? colorValue.toString('hex') : '');
1393
+ setInputValue(colorValue ? colorValue.toString("hex") : "");
1333
1394
  prevValue.current = colorValue;
1334
1395
  }
1335
- let parsedValue = $4tN2K$react.useMemo(()=>{
1396
+ let parsedValue = (0, $4tN2K$react.useMemo)(()=>{
1336
1397
  let color;
1337
1398
  try {
1338
- color = $83fe1a57d631223b$export$6e865ea70d7724f(inputValue.startsWith('#') ? inputValue : `#${inputValue}`);
1399
+ color = (0, $83fe1a57d631223b$export$6e865ea70d7724f)(inputValue.startsWith("#") ? inputValue : `#${inputValue}`);
1339
1400
  } catch (err) {
1340
1401
  color = null;
1341
1402
  }
@@ -1343,24 +1404,24 @@ function $d59d0c2b2ce1568f$export$d52a01683abdfcd6(props) {
1343
1404
  }, [
1344
1405
  inputValue
1345
1406
  ]);
1346
- let parsed = $4tN2K$react.useRef(null);
1407
+ let parsed = (0, $4tN2K$react.useRef)(null);
1347
1408
  parsed.current = parsedValue;
1348
1409
  let commit = ()=>{
1349
1410
  // Set to empty state if input value is empty
1350
1411
  if (!inputValue.length) {
1351
1412
  safelySetColorValue(null);
1352
- setInputValue(value1 === undefined ? '' : colorValue.toString('hex'));
1413
+ setInputValue(value === undefined ? "" : colorValue.toString("hex"));
1353
1414
  return;
1354
1415
  }
1355
1416
  // if it failed to parse, then reset input to formatted version of current number
1356
1417
  if (parsed.current == null) {
1357
- setInputValue(colorValue ? colorValue.toString('hex') : '');
1418
+ setInputValue(colorValue ? colorValue.toString("hex") : "");
1358
1419
  return;
1359
1420
  }
1360
1421
  safelySetColorValue(parsed.current);
1361
1422
  // in a controlled state, the numberValue won't change, so we won't go back to our old input without help
1362
- let newColorValue = '';
1363
- if (colorValue) newColorValue = colorValue.toString('hex');
1423
+ let newColorValue = "";
1424
+ if (colorValue) newColorValue = colorValue.toString("hex");
1364
1425
  setInputValue(newColorValue);
1365
1426
  };
1366
1427
  let increment = ()=>{
@@ -1369,7 +1430,7 @@ function $d59d0c2b2ce1568f$export$d52a01683abdfcd6(props) {
1369
1430
  // input value should be updated to match
1370
1431
  // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
1371
1432
  // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
1372
- if (newValue === colorValue) setInputValue(newValue.toString('hex'));
1433
+ if (newValue === colorValue) setInputValue(newValue.toString("hex"));
1373
1434
  safelySetColorValue(newValue);
1374
1435
  };
1375
1436
  let decrement = ()=>{
@@ -1378,16 +1439,14 @@ function $d59d0c2b2ce1568f$export$d52a01683abdfcd6(props) {
1378
1439
  // input value should be updated to match
1379
1440
  // ex type 4, press increment, highlight the number in the input, type 4 again, press increment
1380
1441
  // you'd be at 5, then incrementing to 5 again, so no re-render would happen and 4 would be left in the input
1381
- if (newValue === colorValue) setInputValue(newValue.toString('hex'));
1442
+ if (newValue === colorValue) setInputValue(newValue.toString("hex"));
1382
1443
  safelySetColorValue(newValue);
1383
1444
  };
1384
- let incrementToMax = ()=>safelySetColorValue($d59d0c2b2ce1568f$var$MAX_COLOR)
1385
- ;
1386
- let decrementToMin = ()=>safelySetColorValue($d59d0c2b2ce1568f$var$MIN_COLOR)
1387
- ;
1445
+ let incrementToMax = ()=>safelySetColorValue($d59d0c2b2ce1568f$var$MAX_COLOR);
1446
+ let decrementToMin = ()=>safelySetColorValue($d59d0c2b2ce1568f$var$MIN_COLOR);
1388
1447
  let validate = (value)=>{
1389
1448
  var ref;
1390
- return value === '' || !!((ref = value.match(/^#?[0-9a-f]{0,6}$/i)) === null || ref === void 0 ? void 0 : ref[0]);
1449
+ return value === "" || !!((ref = value.match(/^#?[0-9a-f]{0,6}$/i)) === null || ref === void 0 ? void 0 : ref[0]);
1391
1450
  };
1392
1451
  return {
1393
1452
  validate: validate,
@@ -1406,8 +1465,8 @@ function $d59d0c2b2ce1568f$var$addColorValue(color, step) {
1406
1465
  let colorInt = newColor.toHexInt();
1407
1466
  let clampInt = Math.min(Math.max(colorInt + step, $d59d0c2b2ce1568f$var$MIN_COLOR_INT), $d59d0c2b2ce1568f$var$MAX_COLOR_INT);
1408
1467
  if (clampInt !== colorInt) {
1409
- let newColorString = `#${clampInt.toString(16).padStart(6, '0').toUpperCase()}`;
1410
- newColor = $83fe1a57d631223b$export$6e865ea70d7724f(newColorString);
1468
+ let newColorString = `#${clampInt.toString(16).padStart(6, "0").toUpperCase()}`;
1469
+ newColor = (0, $83fe1a57d631223b$export$6e865ea70d7724f)(newColorString);
1411
1470
  }
1412
1471
  return newColor;
1413
1472
  }