@moda/om 20.3.0 → 20.4.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/dist/index.cjs.js +474 -494
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +475 -495
- package/dist/index.esm.js.map +1 -1
- package/dist/src/index.d.ts +6 -0
- package/dist/styles.css +1 -1
- package/package.json +9 -9
- package/src/components/Breakpoint/Breakpoint.stories.tsx +3 -6
- package/src/components/Text/Text.scss +1 -1
- package/src/index.scss +0 -1
- package/src/functions/_functions.scss +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -27,6 +27,31 @@ function getDefaultExportFromCjs (x) {
|
|
|
27
27
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
function getAugmentedNamespace(n) {
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
|
|
32
|
+
var f = n.default;
|
|
33
|
+
if (typeof f == "function") {
|
|
34
|
+
var a = function a () {
|
|
35
|
+
if (this instanceof a) {
|
|
36
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
37
|
+
}
|
|
38
|
+
return f.apply(this, arguments);
|
|
39
|
+
};
|
|
40
|
+
a.prototype = f.prototype;
|
|
41
|
+
} else a = {};
|
|
42
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
43
|
+
Object.keys(n).forEach(function (k) {
|
|
44
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
45
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () {
|
|
48
|
+
return n[k];
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return a;
|
|
53
|
+
}
|
|
54
|
+
|
|
30
55
|
var focusVisible$1 = {exports: {}};
|
|
31
56
|
|
|
32
57
|
var focusVisible = focusVisible$1.exports;
|
|
@@ -356,6 +381,9 @@ function requireColors() {
|
|
|
356
381
|
"teal": "rgb(0, 111, 98)",
|
|
357
382
|
"ivory": "rgb(242, 233, 219)",
|
|
358
383
|
"chatelle": "rgb(213, 194, 216)",
|
|
384
|
+
"edgewater": "rgb(198, 225, 209)",
|
|
385
|
+
"waikawa-gray": "rgb(86, 107, 136)",
|
|
386
|
+
"tuscany": "rgb(186, 83, 44)",
|
|
359
387
|
"klein-blue": "rgb(38, 48, 120)",
|
|
360
388
|
"persian-blue": "rgb(30, 34, 170)",
|
|
361
389
|
"brick": "rgb(147, 58, 32)",
|
|
@@ -380,7 +408,10 @@ function requireColors() {
|
|
|
380
408
|
"dark-fuchsia": "rgb(180, 60, 160)",
|
|
381
409
|
"teal": "rgb(0, 111, 98)",
|
|
382
410
|
"ivory": "rgb(242, 233, 219)",
|
|
383
|
-
"chatelle": "rgb(213, 194, 216)"
|
|
411
|
+
"chatelle": "rgb(213, 194, 216)",
|
|
412
|
+
"edgewater": "rgb(198, 225, 209)",
|
|
413
|
+
"waikawa-gray": "rgb(86, 107, 136)",
|
|
414
|
+
"tuscany": "rgb(186, 83, 44)"
|
|
384
415
|
},
|
|
385
416
|
"global": {
|
|
386
417
|
"klein-blue": "rgb(38, 48, 120)",
|
|
@@ -557,407 +588,347 @@ function requireBreakpoints() {
|
|
|
557
588
|
|
|
558
589
|
var helpers = {};
|
|
559
590
|
|
|
560
|
-
var
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
return obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && (obj.splice instanceof Function || Object.getOwnPropertyDescriptor(obj, obj.length - 1) && obj.constructor.name !== 'String');
|
|
732
|
-
};
|
|
733
|
-
return isArrayish;
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
var hasRequiredSimpleSwizzle;
|
|
737
|
-
function requireSimpleSwizzle() {
|
|
738
|
-
if (hasRequiredSimpleSwizzle) return simpleSwizzle.exports;
|
|
739
|
-
hasRequiredSimpleSwizzle = 1;
|
|
740
|
-
var isArrayish = requireIsArrayish();
|
|
741
|
-
var concat = Array.prototype.concat;
|
|
742
|
-
var slice = Array.prototype.slice;
|
|
743
|
-
var swizzle = simpleSwizzle.exports = function swizzle(args) {
|
|
744
|
-
var results = [];
|
|
745
|
-
for (var i = 0, len = args.length; i < len; i++) {
|
|
746
|
-
var arg = args[i];
|
|
747
|
-
if (isArrayish(arg)) {
|
|
748
|
-
// http://jsperf.com/javascript-array-concat-vs-push/98
|
|
749
|
-
results = concat.call(results, slice.call(arg));
|
|
750
|
-
} else {
|
|
751
|
-
results.push(arg);
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
return results;
|
|
755
|
-
};
|
|
756
|
-
swizzle.wrap = function (fn) {
|
|
757
|
-
return function () {
|
|
758
|
-
return fn(swizzle(arguments));
|
|
759
|
-
};
|
|
760
|
-
};
|
|
761
|
-
return simpleSwizzle.exports;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
/* MIT license */
|
|
765
|
-
var hasRequiredColorString;
|
|
766
|
-
function requireColorString() {
|
|
767
|
-
if (hasRequiredColorString) return colorString.exports;
|
|
768
|
-
hasRequiredColorString = 1;
|
|
769
|
-
var colorNames = requireColorName();
|
|
770
|
-
var swizzle = requireSimpleSwizzle();
|
|
771
|
-
var hasOwnProperty = Object.hasOwnProperty;
|
|
772
|
-
var reverseNames = Object.create(null);
|
|
773
|
-
|
|
774
|
-
// create a list of reverse color names
|
|
775
|
-
for (var name in colorNames) {
|
|
776
|
-
if (hasOwnProperty.call(colorNames, name)) {
|
|
777
|
-
reverseNames[colorNames[name]] = name;
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
var cs = colorString.exports = {
|
|
781
|
-
to: {},
|
|
782
|
-
get: {}
|
|
783
|
-
};
|
|
784
|
-
cs.get = function (string) {
|
|
785
|
-
var prefix = string.substring(0, 3).toLowerCase();
|
|
786
|
-
var val;
|
|
787
|
-
var model;
|
|
788
|
-
switch (prefix) {
|
|
789
|
-
case 'hsl':
|
|
790
|
-
val = cs.get.hsl(string);
|
|
591
|
+
var colorNames = {
|
|
592
|
+
aliceblue: [240, 248, 255],
|
|
593
|
+
antiquewhite: [250, 235, 215],
|
|
594
|
+
aqua: [0, 255, 255],
|
|
595
|
+
aquamarine: [127, 255, 212],
|
|
596
|
+
azure: [240, 255, 255],
|
|
597
|
+
beige: [245, 245, 220],
|
|
598
|
+
bisque: [255, 228, 196],
|
|
599
|
+
black: [0, 0, 0],
|
|
600
|
+
blanchedalmond: [255, 235, 205],
|
|
601
|
+
blue: [0, 0, 255],
|
|
602
|
+
blueviolet: [138, 43, 226],
|
|
603
|
+
brown: [165, 42, 42],
|
|
604
|
+
burlywood: [222, 184, 135],
|
|
605
|
+
cadetblue: [95, 158, 160],
|
|
606
|
+
chartreuse: [127, 255, 0],
|
|
607
|
+
chocolate: [210, 105, 30],
|
|
608
|
+
coral: [255, 127, 80],
|
|
609
|
+
cornflowerblue: [100, 149, 237],
|
|
610
|
+
cornsilk: [255, 248, 220],
|
|
611
|
+
crimson: [220, 20, 60],
|
|
612
|
+
cyan: [0, 255, 255],
|
|
613
|
+
darkblue: [0, 0, 139],
|
|
614
|
+
darkcyan: [0, 139, 139],
|
|
615
|
+
darkgoldenrod: [184, 134, 11],
|
|
616
|
+
darkgray: [169, 169, 169],
|
|
617
|
+
darkgreen: [0, 100, 0],
|
|
618
|
+
darkgrey: [169, 169, 169],
|
|
619
|
+
darkkhaki: [189, 183, 107],
|
|
620
|
+
darkmagenta: [139, 0, 139],
|
|
621
|
+
darkolivegreen: [85, 107, 47],
|
|
622
|
+
darkorange: [255, 140, 0],
|
|
623
|
+
darkorchid: [153, 50, 204],
|
|
624
|
+
darkred: [139, 0, 0],
|
|
625
|
+
darksalmon: [233, 150, 122],
|
|
626
|
+
darkseagreen: [143, 188, 143],
|
|
627
|
+
darkslateblue: [72, 61, 139],
|
|
628
|
+
darkslategray: [47, 79, 79],
|
|
629
|
+
darkslategrey: [47, 79, 79],
|
|
630
|
+
darkturquoise: [0, 206, 209],
|
|
631
|
+
darkviolet: [148, 0, 211],
|
|
632
|
+
deeppink: [255, 20, 147],
|
|
633
|
+
deepskyblue: [0, 191, 255],
|
|
634
|
+
dimgray: [105, 105, 105],
|
|
635
|
+
dimgrey: [105, 105, 105],
|
|
636
|
+
dodgerblue: [30, 144, 255],
|
|
637
|
+
firebrick: [178, 34, 34],
|
|
638
|
+
floralwhite: [255, 250, 240],
|
|
639
|
+
forestgreen: [34, 139, 34],
|
|
640
|
+
fuchsia: [255, 0, 255],
|
|
641
|
+
gainsboro: [220, 220, 220],
|
|
642
|
+
ghostwhite: [248, 248, 255],
|
|
643
|
+
gold: [255, 215, 0],
|
|
644
|
+
goldenrod: [218, 165, 32],
|
|
645
|
+
gray: [128, 128, 128],
|
|
646
|
+
green: [0, 128, 0],
|
|
647
|
+
greenyellow: [173, 255, 47],
|
|
648
|
+
grey: [128, 128, 128],
|
|
649
|
+
honeydew: [240, 255, 240],
|
|
650
|
+
hotpink: [255, 105, 180],
|
|
651
|
+
indianred: [205, 92, 92],
|
|
652
|
+
indigo: [75, 0, 130],
|
|
653
|
+
ivory: [255, 255, 240],
|
|
654
|
+
khaki: [240, 230, 140],
|
|
655
|
+
lavender: [230, 230, 250],
|
|
656
|
+
lavenderblush: [255, 240, 245],
|
|
657
|
+
lawngreen: [124, 252, 0],
|
|
658
|
+
lemonchiffon: [255, 250, 205],
|
|
659
|
+
lightblue: [173, 216, 230],
|
|
660
|
+
lightcoral: [240, 128, 128],
|
|
661
|
+
lightcyan: [224, 255, 255],
|
|
662
|
+
lightgoldenrodyellow: [250, 250, 210],
|
|
663
|
+
lightgray: [211, 211, 211],
|
|
664
|
+
lightgreen: [144, 238, 144],
|
|
665
|
+
lightgrey: [211, 211, 211],
|
|
666
|
+
lightpink: [255, 182, 193],
|
|
667
|
+
lightsalmon: [255, 160, 122],
|
|
668
|
+
lightseagreen: [32, 178, 170],
|
|
669
|
+
lightskyblue: [135, 206, 250],
|
|
670
|
+
lightslategray: [119, 136, 153],
|
|
671
|
+
lightslategrey: [119, 136, 153],
|
|
672
|
+
lightsteelblue: [176, 196, 222],
|
|
673
|
+
lightyellow: [255, 255, 224],
|
|
674
|
+
lime: [0, 255, 0],
|
|
675
|
+
limegreen: [50, 205, 50],
|
|
676
|
+
linen: [250, 240, 230],
|
|
677
|
+
magenta: [255, 0, 255],
|
|
678
|
+
maroon: [128, 0, 0],
|
|
679
|
+
mediumaquamarine: [102, 205, 170],
|
|
680
|
+
mediumblue: [0, 0, 205],
|
|
681
|
+
mediumorchid: [186, 85, 211],
|
|
682
|
+
mediumpurple: [147, 112, 219],
|
|
683
|
+
mediumseagreen: [60, 179, 113],
|
|
684
|
+
mediumslateblue: [123, 104, 238],
|
|
685
|
+
mediumspringgreen: [0, 250, 154],
|
|
686
|
+
mediumturquoise: [72, 209, 204],
|
|
687
|
+
mediumvioletred: [199, 21, 133],
|
|
688
|
+
midnightblue: [25, 25, 112],
|
|
689
|
+
mintcream: [245, 255, 250],
|
|
690
|
+
mistyrose: [255, 228, 225],
|
|
691
|
+
moccasin: [255, 228, 181],
|
|
692
|
+
navajowhite: [255, 222, 173],
|
|
693
|
+
navy: [0, 0, 128],
|
|
694
|
+
oldlace: [253, 245, 230],
|
|
695
|
+
olive: [128, 128, 0],
|
|
696
|
+
olivedrab: [107, 142, 35],
|
|
697
|
+
orange: [255, 165, 0],
|
|
698
|
+
orangered: [255, 69, 0],
|
|
699
|
+
orchid: [218, 112, 214],
|
|
700
|
+
palegoldenrod: [238, 232, 170],
|
|
701
|
+
palegreen: [152, 251, 152],
|
|
702
|
+
paleturquoise: [175, 238, 238],
|
|
703
|
+
palevioletred: [219, 112, 147],
|
|
704
|
+
papayawhip: [255, 239, 213],
|
|
705
|
+
peachpuff: [255, 218, 185],
|
|
706
|
+
peru: [205, 133, 63],
|
|
707
|
+
pink: [255, 192, 203],
|
|
708
|
+
plum: [221, 160, 221],
|
|
709
|
+
powderblue: [176, 224, 230],
|
|
710
|
+
purple: [128, 0, 128],
|
|
711
|
+
rebeccapurple: [102, 51, 153],
|
|
712
|
+
red: [255, 0, 0],
|
|
713
|
+
rosybrown: [188, 143, 143],
|
|
714
|
+
royalblue: [65, 105, 225],
|
|
715
|
+
saddlebrown: [139, 69, 19],
|
|
716
|
+
salmon: [250, 128, 114],
|
|
717
|
+
sandybrown: [244, 164, 96],
|
|
718
|
+
seagreen: [46, 139, 87],
|
|
719
|
+
seashell: [255, 245, 238],
|
|
720
|
+
sienna: [160, 82, 45],
|
|
721
|
+
silver: [192, 192, 192],
|
|
722
|
+
skyblue: [135, 206, 235],
|
|
723
|
+
slateblue: [106, 90, 205],
|
|
724
|
+
slategray: [112, 128, 144],
|
|
725
|
+
slategrey: [112, 128, 144],
|
|
726
|
+
snow: [255, 250, 250],
|
|
727
|
+
springgreen: [0, 255, 127],
|
|
728
|
+
steelblue: [70, 130, 180],
|
|
729
|
+
tan: [210, 180, 140],
|
|
730
|
+
teal: [0, 128, 128],
|
|
731
|
+
thistle: [216, 191, 216],
|
|
732
|
+
tomato: [255, 99, 71],
|
|
733
|
+
turquoise: [64, 224, 208],
|
|
734
|
+
violet: [238, 130, 238],
|
|
735
|
+
wheat: [245, 222, 179],
|
|
736
|
+
white: [255, 255, 255],
|
|
737
|
+
whitesmoke: [245, 245, 245],
|
|
738
|
+
yellow: [255, 255, 0],
|
|
739
|
+
yellowgreen: [154, 205, 50]
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
var reverseNames = Object.create(null);
|
|
743
|
+
|
|
744
|
+
// Create a list of reverse color names
|
|
745
|
+
for (var name in colorNames) {
|
|
746
|
+
if (Object.hasOwn(colorNames, name)) {
|
|
747
|
+
reverseNames[colorNames[name]] = name;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
var cs = {
|
|
751
|
+
to: {},
|
|
752
|
+
get: {}
|
|
753
|
+
};
|
|
754
|
+
cs.get = function (string) {
|
|
755
|
+
var prefix = string.slice(0, 3).toLowerCase();
|
|
756
|
+
var value;
|
|
757
|
+
var model;
|
|
758
|
+
switch (prefix) {
|
|
759
|
+
case 'hsl':
|
|
760
|
+
{
|
|
761
|
+
value = cs.get.hsl(string);
|
|
791
762
|
model = 'hsl';
|
|
792
763
|
break;
|
|
793
|
-
|
|
794
|
-
|
|
764
|
+
}
|
|
765
|
+
case 'hwb':
|
|
766
|
+
{
|
|
767
|
+
value = cs.get.hwb(string);
|
|
795
768
|
model = 'hwb';
|
|
796
769
|
break;
|
|
797
|
-
|
|
798
|
-
|
|
770
|
+
}
|
|
771
|
+
default:
|
|
772
|
+
{
|
|
773
|
+
value = cs.get.rgb(string);
|
|
799
774
|
model = 'rgb';
|
|
800
775
|
break;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
if (!value) {
|
|
779
|
+
return null;
|
|
780
|
+
}
|
|
781
|
+
return {
|
|
782
|
+
model: model,
|
|
783
|
+
value: value
|
|
784
|
+
};
|
|
785
|
+
};
|
|
786
|
+
cs.get.rgb = function (string) {
|
|
787
|
+
if (!string) {
|
|
788
|
+
return null;
|
|
789
|
+
}
|
|
790
|
+
var abbr = /^#([a-f\d]{3,4})$/i;
|
|
791
|
+
var hex = /^#([a-f\d]{6})([a-f\d]{2})?$/i;
|
|
792
|
+
var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/;
|
|
793
|
+
var per = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/;
|
|
794
|
+
var keyword = /^(\w+)$/;
|
|
795
|
+
var rgb = [0, 0, 0, 1];
|
|
796
|
+
var match;
|
|
797
|
+
var i;
|
|
798
|
+
var hexAlpha;
|
|
799
|
+
if (match = string.match(hex)) {
|
|
800
|
+
hexAlpha = match[2];
|
|
801
|
+
match = match[1];
|
|
802
|
+
for (i = 0; i < 3; i++) {
|
|
803
|
+
// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
|
|
804
|
+
var i2 = i * 2;
|
|
805
|
+
rgb[i] = Number.parseInt(match.slice(i2, i2 + 2), 16);
|
|
801
806
|
}
|
|
802
|
-
if (
|
|
803
|
-
|
|
807
|
+
if (hexAlpha) {
|
|
808
|
+
rgb[3] = Number.parseInt(hexAlpha, 16) / 255;
|
|
804
809
|
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
cs.get.rgb = function (string) {
|
|
811
|
-
if (!string) {
|
|
812
|
-
return null;
|
|
810
|
+
} else if (match = string.match(abbr)) {
|
|
811
|
+
match = match[1];
|
|
812
|
+
hexAlpha = match[3];
|
|
813
|
+
for (i = 0; i < 3; i++) {
|
|
814
|
+
rgb[i] = Number.parseInt(match[i] + match[i], 16);
|
|
813
815
|
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
817
|
-
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
818
|
-
var keyword = /^(\w+)$/;
|
|
819
|
-
var rgb = [0, 0, 0, 1];
|
|
820
|
-
var match;
|
|
821
|
-
var i;
|
|
822
|
-
var hexAlpha;
|
|
823
|
-
if (match = string.match(hex)) {
|
|
824
|
-
hexAlpha = match[2];
|
|
825
|
-
match = match[1];
|
|
826
|
-
for (i = 0; i < 3; i++) {
|
|
827
|
-
// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
|
|
828
|
-
var i2 = i * 2;
|
|
829
|
-
rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
|
|
830
|
-
}
|
|
831
|
-
if (hexAlpha) {
|
|
832
|
-
rgb[3] = parseInt(hexAlpha, 16) / 255;
|
|
833
|
-
}
|
|
834
|
-
} else if (match = string.match(abbr)) {
|
|
835
|
-
match = match[1];
|
|
836
|
-
hexAlpha = match[3];
|
|
837
|
-
for (i = 0; i < 3; i++) {
|
|
838
|
-
rgb[i] = parseInt(match[i] + match[i], 16);
|
|
839
|
-
}
|
|
840
|
-
if (hexAlpha) {
|
|
841
|
-
rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
|
|
842
|
-
}
|
|
843
|
-
} else if (match = string.match(rgba)) {
|
|
844
|
-
for (i = 0; i < 3; i++) {
|
|
845
|
-
rgb[i] = parseInt(match[i + 1], 0);
|
|
846
|
-
}
|
|
847
|
-
if (match[4]) {
|
|
848
|
-
if (match[5]) {
|
|
849
|
-
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
850
|
-
} else {
|
|
851
|
-
rgb[3] = parseFloat(match[4]);
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
} else if (match = string.match(per)) {
|
|
855
|
-
for (i = 0; i < 3; i++) {
|
|
856
|
-
rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
|
|
857
|
-
}
|
|
858
|
-
if (match[4]) {
|
|
859
|
-
if (match[5]) {
|
|
860
|
-
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
861
|
-
} else {
|
|
862
|
-
rgb[3] = parseFloat(match[4]);
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
} else if (match = string.match(keyword)) {
|
|
866
|
-
if (match[1] === 'transparent') {
|
|
867
|
-
return [0, 0, 0, 0];
|
|
868
|
-
}
|
|
869
|
-
if (!hasOwnProperty.call(colorNames, match[1])) {
|
|
870
|
-
return null;
|
|
871
|
-
}
|
|
872
|
-
rgb = colorNames[match[1]];
|
|
873
|
-
rgb[3] = 1;
|
|
874
|
-
return rgb;
|
|
875
|
-
} else {
|
|
876
|
-
return null;
|
|
816
|
+
if (hexAlpha) {
|
|
817
|
+
rgb[3] = Number.parseInt(hexAlpha + hexAlpha, 16) / 255;
|
|
877
818
|
}
|
|
819
|
+
} else if (match = string.match(rgba)) {
|
|
878
820
|
for (i = 0; i < 3; i++) {
|
|
879
|
-
rgb[i] =
|
|
821
|
+
rgb[i] = Number.parseInt(match[i + 1], 10);
|
|
880
822
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
};
|
|
884
|
-
cs.get.hsl = function (string) {
|
|
885
|
-
if (!string) {
|
|
886
|
-
return null;
|
|
823
|
+
if (match[4]) {
|
|
824
|
+
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
887
825
|
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
var alpha = parseFloat(match[4]);
|
|
892
|
-
var h = (parseFloat(match[1]) % 360 + 360) % 360;
|
|
893
|
-
var s = clamp(parseFloat(match[2]), 0, 100);
|
|
894
|
-
var l = clamp(parseFloat(match[3]), 0, 100);
|
|
895
|
-
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
896
|
-
return [h, s, l, a];
|
|
826
|
+
} else if (match = string.match(per)) {
|
|
827
|
+
for (i = 0; i < 3; i++) {
|
|
828
|
+
rgb[i] = Math.round(Number.parseFloat(match[i + 1]) * 2.55);
|
|
897
829
|
}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
cs.get.hwb = function (string) {
|
|
901
|
-
if (!string) {
|
|
902
|
-
return null;
|
|
830
|
+
if (match[4]) {
|
|
831
|
+
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
903
832
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
var alpha = parseFloat(match[4]);
|
|
908
|
-
var h = (parseFloat(match[1]) % 360 + 360) % 360;
|
|
909
|
-
var w = clamp(parseFloat(match[2]), 0, 100);
|
|
910
|
-
var b = clamp(parseFloat(match[3]), 0, 100);
|
|
911
|
-
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
912
|
-
return [h, w, b, a];
|
|
833
|
+
} else if (match = string.match(keyword)) {
|
|
834
|
+
if (match[1] === 'transparent') {
|
|
835
|
+
return [0, 0, 0, 0];
|
|
913
836
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
cs.to.hex = function () {
|
|
917
|
-
var rgba = swizzle(arguments);
|
|
918
|
-
return '#' + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : '');
|
|
919
|
-
};
|
|
920
|
-
cs.to.rgb = function () {
|
|
921
|
-
var rgba = swizzle(arguments);
|
|
922
|
-
return rgba.length < 4 || rgba[3] === 1 ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')' : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
|
|
923
|
-
};
|
|
924
|
-
cs.to.rgb.percent = function () {
|
|
925
|
-
var rgba = swizzle(arguments);
|
|
926
|
-
var r = Math.round(rgba[0] / 255 * 100);
|
|
927
|
-
var g = Math.round(rgba[1] / 255 * 100);
|
|
928
|
-
var b = Math.round(rgba[2] / 255 * 100);
|
|
929
|
-
return rgba.length < 4 || rgba[3] === 1 ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)' : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
|
|
930
|
-
};
|
|
931
|
-
cs.to.hsl = function () {
|
|
932
|
-
var hsla = swizzle(arguments);
|
|
933
|
-
return hsla.length < 4 || hsla[3] === 1 ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)' : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
|
|
934
|
-
};
|
|
935
|
-
|
|
936
|
-
// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
|
|
937
|
-
// (hwb have alpha optional & 1 is default value)
|
|
938
|
-
cs.to.hwb = function () {
|
|
939
|
-
var hwba = swizzle(arguments);
|
|
940
|
-
var a = '';
|
|
941
|
-
if (hwba.length >= 4 && hwba[3] !== 1) {
|
|
942
|
-
a = ', ' + hwba[3];
|
|
837
|
+
if (!Object.hasOwn(colorNames, match[1])) {
|
|
838
|
+
return null;
|
|
943
839
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
840
|
+
rgb = colorNames[match[1]];
|
|
841
|
+
rgb[3] = 1;
|
|
842
|
+
return rgb;
|
|
843
|
+
} else {
|
|
844
|
+
return null;
|
|
845
|
+
}
|
|
846
|
+
for (i = 0; i < 3; i++) {
|
|
847
|
+
rgb[i] = clamp(rgb[i], 0, 255);
|
|
848
|
+
}
|
|
849
|
+
rgb[3] = clamp(rgb[3], 0, 1);
|
|
850
|
+
return rgb;
|
|
851
|
+
};
|
|
852
|
+
cs.get.hsl = function (string) {
|
|
853
|
+
if (!string) {
|
|
854
|
+
return null;
|
|
855
|
+
}
|
|
856
|
+
var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
|
|
857
|
+
var match = string.match(hsl);
|
|
858
|
+
if (match) {
|
|
859
|
+
var alpha = Number.parseFloat(match[4]);
|
|
860
|
+
var h = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
861
|
+
var s = clamp(Number.parseFloat(match[2]), 0, 100);
|
|
862
|
+
var l = clamp(Number.parseFloat(match[3]), 0, 100);
|
|
863
|
+
var a = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
864
|
+
return [h, s, l, a];
|
|
865
|
+
}
|
|
866
|
+
return null;
|
|
867
|
+
};
|
|
868
|
+
cs.get.hwb = function (string) {
|
|
869
|
+
if (!string) {
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
|
|
873
|
+
var match = string.match(hwb);
|
|
874
|
+
if (match) {
|
|
875
|
+
var alpha = Number.parseFloat(match[4]);
|
|
876
|
+
var h = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
877
|
+
var w = clamp(Number.parseFloat(match[2]), 0, 100);
|
|
878
|
+
var b = clamp(Number.parseFloat(match[3]), 0, 100);
|
|
879
|
+
var a = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
880
|
+
return [h, w, b, a];
|
|
881
|
+
}
|
|
882
|
+
return null;
|
|
883
|
+
};
|
|
884
|
+
cs.to.hex = function () {
|
|
885
|
+
return '#' + hexDouble(arguments.length <= 0 ? undefined : arguments[0]) + hexDouble(arguments.length <= 1 ? undefined : arguments[1]) + hexDouble(arguments.length <= 2 ? undefined : arguments[2]) + ((arguments.length <= 3 ? undefined : arguments[3]) < 1 ? hexDouble(Math.round((arguments.length <= 3 ? undefined : arguments[3]) * 255)) : '');
|
|
886
|
+
};
|
|
887
|
+
cs.to.rgb = function () {
|
|
888
|
+
return arguments.length < 4 || (arguments.length <= 3 ? undefined : arguments[3]) === 1 ? 'rgb(' + Math.round(arguments.length <= 0 ? undefined : arguments[0]) + ', ' + Math.round(arguments.length <= 1 ? undefined : arguments[1]) + ', ' + Math.round(arguments.length <= 2 ? undefined : arguments[2]) + ')' : 'rgba(' + Math.round(arguments.length <= 0 ? undefined : arguments[0]) + ', ' + Math.round(arguments.length <= 1 ? undefined : arguments[1]) + ', ' + Math.round(arguments.length <= 2 ? undefined : arguments[2]) + ', ' + (arguments.length <= 3 ? undefined : arguments[3]) + ')';
|
|
889
|
+
};
|
|
890
|
+
cs.to.rgb.percent = function () {
|
|
891
|
+
var r = Math.round((arguments.length <= 0 ? undefined : arguments[0]) / 255 * 100);
|
|
892
|
+
var g = Math.round((arguments.length <= 1 ? undefined : arguments[1]) / 255 * 100);
|
|
893
|
+
var b = Math.round((arguments.length <= 2 ? undefined : arguments[2]) / 255 * 100);
|
|
894
|
+
return arguments.length < 4 || (arguments.length <= 3 ? undefined : arguments[3]) === 1 ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)' : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + (arguments.length <= 3 ? undefined : arguments[3]) + ')';
|
|
895
|
+
};
|
|
896
|
+
cs.to.hsl = function () {
|
|
897
|
+
return arguments.length < 4 || (arguments.length <= 3 ? undefined : arguments[3]) === 1 ? 'hsl(' + (arguments.length <= 0 ? undefined : arguments[0]) + ', ' + (arguments.length <= 1 ? undefined : arguments[1]) + '%, ' + (arguments.length <= 2 ? undefined : arguments[2]) + '%)' : 'hsla(' + (arguments.length <= 0 ? undefined : arguments[0]) + ', ' + (arguments.length <= 1 ? undefined : arguments[1]) + '%, ' + (arguments.length <= 2 ? undefined : arguments[2]) + '%, ' + (arguments.length <= 3 ? undefined : arguments[3]) + ')';
|
|
898
|
+
};
|
|
949
899
|
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
900
|
+
// Hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
|
|
901
|
+
// (hwb have alpha optional & 1 is default value)
|
|
902
|
+
cs.to.hwb = function () {
|
|
903
|
+
var a = '';
|
|
904
|
+
if (arguments.length >= 4 && (arguments.length <= 3 ? undefined : arguments[3]) !== 1) {
|
|
905
|
+
a = ', ' + (arguments.length <= 3 ? undefined : arguments[3]);
|
|
953
906
|
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
907
|
+
return 'hwb(' + (arguments.length <= 0 ? undefined : arguments[0]) + ', ' + (arguments.length <= 1 ? undefined : arguments[1]) + '%, ' + (arguments.length <= 2 ? undefined : arguments[2]) + '%' + a + ')';
|
|
908
|
+
};
|
|
909
|
+
cs.to.keyword = function () {
|
|
910
|
+
for (var _len = arguments.length, rgb = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
911
|
+
rgb[_key] = arguments[_key];
|
|
957
912
|
}
|
|
958
|
-
return
|
|
913
|
+
return reverseNames[rgb.slice(0, 3)];
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
// Helpers
|
|
917
|
+
function clamp(number_, min, max) {
|
|
918
|
+
return Math.min(Math.max(min, number_), max);
|
|
919
|
+
}
|
|
920
|
+
function hexDouble(number_) {
|
|
921
|
+
var string_ = Math.round(number_).toString(16).toUpperCase();
|
|
922
|
+
return string_.length < 2 ? '0' + string_ : string_;
|
|
959
923
|
}
|
|
960
924
|
|
|
925
|
+
var colorString = /*#__PURE__*/Object.freeze({
|
|
926
|
+
__proto__: null,
|
|
927
|
+
default: cs
|
|
928
|
+
});
|
|
929
|
+
|
|
930
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(colorString);
|
|
931
|
+
|
|
961
932
|
var hasRequiredHelpers;
|
|
962
933
|
function requireHelpers() {
|
|
963
934
|
if (hasRequiredHelpers) return helpers;
|
|
@@ -974,20 +945,11 @@ function requireHelpers() {
|
|
|
974
945
|
};
|
|
975
946
|
return __assign.apply(this, arguments);
|
|
976
947
|
};
|
|
977
|
-
var __spreadArray = helpers && helpers.__spreadArray || function (to, from, pack) {
|
|
978
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
979
|
-
if (ar || !(i in from)) {
|
|
980
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
981
|
-
ar[i] = from[i];
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
985
|
-
};
|
|
986
948
|
Object.defineProperty(exports, "__esModule", {
|
|
987
949
|
value: true
|
|
988
950
|
});
|
|
989
951
|
exports.spacing = exports.colorInHex = exports.color = exports.remToUnitlessPx = exports.text = void 0;
|
|
990
|
-
var
|
|
952
|
+
var color_string_1 = require$$0;
|
|
991
953
|
var colors_1 = requireColors();
|
|
992
954
|
var space_1 = requireSpace();
|
|
993
955
|
var typography_1 = requireTypography();
|
|
@@ -1009,13 +971,20 @@ function requireHelpers() {
|
|
|
1009
971
|
var color = function color(name, alpha) {
|
|
1010
972
|
var _a;
|
|
1011
973
|
var color = colors_1.colors.all[name];
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
974
|
+
var _b = (_a = color_string_1["default"].get.rgb(color)) !== null && _a !== void 0 ? _a : [],
|
|
975
|
+
red = _b[0],
|
|
976
|
+
green = _b[1],
|
|
977
|
+
blue = _b[2];
|
|
978
|
+
return alpha != null ? color_string_1["default"].to.rgb(red, green, blue, alpha) : color;
|
|
1015
979
|
};
|
|
1016
980
|
exports.color = color;
|
|
1017
981
|
var colorInHex = function colorInHex(name, alpha) {
|
|
1018
|
-
|
|
982
|
+
var _a, _b, _c;
|
|
983
|
+
var _d = (_b = color_string_1["default"].get.rgb((_a = (0, exports.color)(name, alpha)) !== null && _a !== void 0 ? _a : '')) !== null && _b !== void 0 ? _b : [],
|
|
984
|
+
red = _d[0],
|
|
985
|
+
green = _d[1],
|
|
986
|
+
blue = _d[2];
|
|
987
|
+
return (_c = color_string_1["default"].to.hex(red, green, blue, alpha)) !== null && _c !== void 0 ? _c : '';
|
|
1019
988
|
};
|
|
1020
989
|
exports.colorInHex = colorInHex;
|
|
1021
990
|
var spacing = function spacing(topY, rightX, bottom, left) {
|
|
@@ -1116,9 +1085,9 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
1116
1085
|
s: F,
|
|
1117
1086
|
n: function () {
|
|
1118
1087
|
return n >= r.length ? {
|
|
1119
|
-
done:
|
|
1088
|
+
done: true
|
|
1120
1089
|
} : {
|
|
1121
|
-
done:
|
|
1090
|
+
done: false,
|
|
1122
1091
|
value: r[n++]
|
|
1123
1092
|
};
|
|
1124
1093
|
},
|
|
@@ -1131,8 +1100,8 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
1131
1100
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1132
1101
|
}
|
|
1133
1102
|
var o,
|
|
1134
|
-
a =
|
|
1135
|
-
u =
|
|
1103
|
+
a = true,
|
|
1104
|
+
u = false;
|
|
1136
1105
|
return {
|
|
1137
1106
|
s: function () {
|
|
1138
1107
|
t = t.call(r);
|
|
@@ -1142,7 +1111,7 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
1142
1111
|
return a = r.done, r;
|
|
1143
1112
|
},
|
|
1144
1113
|
e: function (r) {
|
|
1145
|
-
u =
|
|
1114
|
+
u = true, o = r;
|
|
1146
1115
|
},
|
|
1147
1116
|
f: function () {
|
|
1148
1117
|
try {
|
|
@@ -1156,9 +1125,9 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
1156
1125
|
function _defineProperty$1(e, r, t) {
|
|
1157
1126
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1158
1127
|
value: t,
|
|
1159
|
-
enumerable:
|
|
1160
|
-
configurable:
|
|
1161
|
-
writable:
|
|
1128
|
+
enumerable: true,
|
|
1129
|
+
configurable: true,
|
|
1130
|
+
writable: true
|
|
1162
1131
|
}) : e[r] = t, e;
|
|
1163
1132
|
}
|
|
1164
1133
|
function _extends$1() {
|
|
@@ -1181,15 +1150,15 @@ function _iterableToArrayLimit(r, l) {
|
|
|
1181
1150
|
i,
|
|
1182
1151
|
u,
|
|
1183
1152
|
a = [],
|
|
1184
|
-
f =
|
|
1185
|
-
o =
|
|
1153
|
+
f = true,
|
|
1154
|
+
o = false;
|
|
1186
1155
|
try {
|
|
1187
1156
|
if (i = (t = t.call(r)).next, 0 === l) {
|
|
1188
1157
|
if (Object(t) !== t) return;
|
|
1189
1158
|
f = !1;
|
|
1190
1159
|
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
1191
1160
|
} catch (r) {
|
|
1192
|
-
o =
|
|
1161
|
+
o = true, n = r;
|
|
1193
1162
|
} finally {
|
|
1194
1163
|
try {
|
|
1195
1164
|
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
@@ -1222,7 +1191,7 @@ function ownKeys(e, r) {
|
|
|
1222
1191
|
function _objectSpread2(e) {
|
|
1223
1192
|
for (var r = 1; r < arguments.length; r++) {
|
|
1224
1193
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
1225
|
-
r % 2 ? ownKeys(Object(t),
|
|
1194
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
1226
1195
|
_defineProperty$1(e, r, t[r]);
|
|
1227
1196
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
1228
1197
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
@@ -1236,8 +1205,8 @@ function _objectWithoutProperties(e, t) {
|
|
|
1236
1205
|
r,
|
|
1237
1206
|
i = _objectWithoutPropertiesLoose(e, t);
|
|
1238
1207
|
if (Object.getOwnPropertySymbols) {
|
|
1239
|
-
var
|
|
1240
|
-
for (r = 0; r <
|
|
1208
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
1209
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
1241
1210
|
}
|
|
1242
1211
|
return i;
|
|
1243
1212
|
}
|
|
@@ -1245,7 +1214,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
1245
1214
|
if (null == r) return {};
|
|
1246
1215
|
var t = {};
|
|
1247
1216
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
1248
|
-
if (e.
|
|
1217
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
1249
1218
|
t[n] = r[n];
|
|
1250
1219
|
}
|
|
1251
1220
|
return t;
|
|
@@ -1260,7 +1229,7 @@ function _toPrimitive(t, r) {
|
|
|
1260
1229
|
if ("object" != typeof t || !t) return t;
|
|
1261
1230
|
var e = t[Symbol.toPrimitive];
|
|
1262
1231
|
if (void 0 !== e) {
|
|
1263
|
-
var i = e.call(t, r
|
|
1232
|
+
var i = e.call(t, r);
|
|
1264
1233
|
if ("object" != typeof i) return i;
|
|
1265
1234
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1266
1235
|
}
|
|
@@ -3013,16 +2982,16 @@ var mediumSidecar = createSidecarMedium({
|
|
|
3013
2982
|
var focusScope = /*#__PURE__*/React.createContext(undefined);
|
|
3014
2983
|
|
|
3015
2984
|
var emptyArray = [];
|
|
3016
|
-
var FocusLock = /*#__PURE__*/
|
|
2985
|
+
var FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parentRef) {
|
|
3017
2986
|
var _extends2;
|
|
3018
|
-
var
|
|
3019
|
-
realObserved =
|
|
3020
|
-
setObserved =
|
|
3021
|
-
var observed =
|
|
3022
|
-
var isActive =
|
|
3023
|
-
var originalFocusedElement =
|
|
3024
|
-
var
|
|
3025
|
-
update =
|
|
2987
|
+
var _useState = React.useState(),
|
|
2988
|
+
realObserved = _useState[0],
|
|
2989
|
+
setObserved = _useState[1];
|
|
2990
|
+
var observed = React.useRef();
|
|
2991
|
+
var isActive = React.useRef(false);
|
|
2992
|
+
var originalFocusedElement = React.useRef(null);
|
|
2993
|
+
var _useState2 = React.useState({}),
|
|
2994
|
+
update = _useState2[1];
|
|
3026
2995
|
var children = props.children,
|
|
3027
2996
|
_props$disabled = props.disabled,
|
|
3028
2997
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
@@ -3051,9 +3020,9 @@ var FocusLock = /*#__PURE__*/React__namespace.forwardRef(function FocusLockUI(pr
|
|
|
3051
3020
|
focusOptions = props.focusOptions,
|
|
3052
3021
|
onActivationCallback = props.onActivation,
|
|
3053
3022
|
onDeactivationCallback = props.onDeactivation;
|
|
3054
|
-
var
|
|
3055
|
-
id =
|
|
3056
|
-
var onActivation =
|
|
3023
|
+
var _useState3 = React.useState({}),
|
|
3024
|
+
id = _useState3[0];
|
|
3025
|
+
var onActivation = React.useCallback(function (_ref) {
|
|
3057
3026
|
var captureFocusRestore = _ref.captureFocusRestore;
|
|
3058
3027
|
if (!originalFocusedElement.current) {
|
|
3059
3028
|
var _document;
|
|
@@ -3069,14 +3038,14 @@ var FocusLock = /*#__PURE__*/React__namespace.forwardRef(function FocusLockUI(pr
|
|
|
3069
3038
|
isActive.current = true;
|
|
3070
3039
|
update();
|
|
3071
3040
|
}, [onActivationCallback]);
|
|
3072
|
-
var onDeactivation =
|
|
3041
|
+
var onDeactivation = React.useCallback(function () {
|
|
3073
3042
|
isActive.current = false;
|
|
3074
3043
|
if (onDeactivationCallback) {
|
|
3075
3044
|
onDeactivationCallback(observed.current);
|
|
3076
3045
|
}
|
|
3077
3046
|
update();
|
|
3078
3047
|
}, [onDeactivationCallback]);
|
|
3079
|
-
var returnFocus =
|
|
3048
|
+
var returnFocus = React.useCallback(function (allowDefer) {
|
|
3080
3049
|
var focusRestore = originalFocusedElement.current;
|
|
3081
3050
|
if (focusRestore) {
|
|
3082
3051
|
var returnFocusTo = (typeof focusRestore === 'function' ? focusRestore() : focusRestore) || document.body;
|
|
@@ -3094,13 +3063,13 @@ var FocusLock = /*#__PURE__*/React__namespace.forwardRef(function FocusLockUI(pr
|
|
|
3094
3063
|
}
|
|
3095
3064
|
}
|
|
3096
3065
|
}, [shouldReturnFocus]);
|
|
3097
|
-
var onFocus =
|
|
3066
|
+
var onFocus = React.useCallback(function (event) {
|
|
3098
3067
|
if (isActive.current) {
|
|
3099
3068
|
mediumFocus.useMedium(event);
|
|
3100
3069
|
}
|
|
3101
3070
|
}, []);
|
|
3102
3071
|
var onBlur = mediumBlur.useMedium;
|
|
3103
|
-
var setObserveNode =
|
|
3072
|
+
var setObserveNode = React.useCallback(function (newObserved) {
|
|
3104
3073
|
if (observed.current !== newObserved) {
|
|
3105
3074
|
observed.current = newObserved;
|
|
3106
3075
|
setObserved(newObserved);
|
|
@@ -3110,7 +3079,7 @@ var FocusLock = /*#__PURE__*/React__namespace.forwardRef(function FocusLockUI(pr
|
|
|
3110
3079
|
if (typeof allowTextSelection !== 'undefined') {
|
|
3111
3080
|
console.warn('React-Focus-Lock: allowTextSelection is deprecated and enabled by default');
|
|
3112
3081
|
}
|
|
3113
|
-
|
|
3082
|
+
React.useEffect(function () {
|
|
3114
3083
|
if (!observed.current && typeof Container !== 'string') {
|
|
3115
3084
|
console.error('FocusLock: could not obtain ref to internal node');
|
|
3116
3085
|
}
|
|
@@ -3120,7 +3089,7 @@ var FocusLock = /*#__PURE__*/React__namespace.forwardRef(function FocusLockUI(pr
|
|
|
3120
3089
|
var hasLeadingGuards = noFocusGuards !== true;
|
|
3121
3090
|
var hasTailingGuards = hasLeadingGuards && noFocusGuards !== 'tail';
|
|
3122
3091
|
var mergedRef = useMergeRefs([parentRef, setObserveNode]);
|
|
3123
|
-
var focusScopeValue =
|
|
3092
|
+
var focusScopeValue = React.useMemo(function () {
|
|
3124
3093
|
return {
|
|
3125
3094
|
observed: observed,
|
|
3126
3095
|
shards: shards,
|
|
@@ -3128,18 +3097,18 @@ var FocusLock = /*#__PURE__*/React__namespace.forwardRef(function FocusLockUI(pr
|
|
|
3128
3097
|
active: isActive.current
|
|
3129
3098
|
};
|
|
3130
3099
|
}, [disabled, isActive.current, shards, realObserved]);
|
|
3131
|
-
return /*#__PURE__*/
|
|
3132
|
-
|
|
3100
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, hasLeadingGuards && [/*#__PURE__*/
|
|
3101
|
+
React.createElement("div", {
|
|
3133
3102
|
key: "guard-first",
|
|
3134
3103
|
"data-focus-guard": true,
|
|
3135
3104
|
tabIndex: disabled ? -1 : 0,
|
|
3136
3105
|
style: hiddenGuard
|
|
3137
|
-
}), hasPositiveIndices ? /*#__PURE__*/
|
|
3106
|
+
}), hasPositiveIndices ? /*#__PURE__*/React.createElement("div", {
|
|
3138
3107
|
key: "guard-nearest",
|
|
3139
3108
|
"data-focus-guard": true,
|
|
3140
3109
|
tabIndex: disabled ? -1 : 1,
|
|
3141
3110
|
style: hiddenGuard
|
|
3142
|
-
}) : null], !disabled && /*#__PURE__*/
|
|
3111
|
+
}) : null], !disabled && /*#__PURE__*/React.createElement(SideCar, {
|
|
3143
3112
|
id: id,
|
|
3144
3113
|
sideCar: mediumSidecar,
|
|
3145
3114
|
observed: realObserved,
|
|
@@ -3154,15 +3123,15 @@ var FocusLock = /*#__PURE__*/React__namespace.forwardRef(function FocusLockUI(pr
|
|
|
3154
3123
|
returnFocus: returnFocus,
|
|
3155
3124
|
focusOptions: focusOptions,
|
|
3156
3125
|
noFocusGuards: noFocusGuards
|
|
3157
|
-
}), /*#__PURE__*/
|
|
3126
|
+
}), /*#__PURE__*/React.createElement(Container, _extends({
|
|
3158
3127
|
ref: mergedRef
|
|
3159
3128
|
}, lockProps, {
|
|
3160
3129
|
className: className,
|
|
3161
3130
|
onBlur: onBlur,
|
|
3162
3131
|
onFocus: onFocus
|
|
3163
|
-
}), /*#__PURE__*/
|
|
3132
|
+
}), /*#__PURE__*/React.createElement(focusScope.Provider, {
|
|
3164
3133
|
value: focusScopeValue
|
|
3165
|
-
}, children)), hasTailingGuards && /*#__PURE__*/
|
|
3134
|
+
}, children)), hasTailingGuards && /*#__PURE__*/React.createElement("div", {
|
|
3166
3135
|
"data-focus-guard": true,
|
|
3167
3136
|
tabIndex: disabled ? -1 : 0,
|
|
3168
3137
|
style: hiddenGuard
|
|
@@ -3289,7 +3258,7 @@ function toPrimitive(t, r) {
|
|
|
3289
3258
|
if ("object" != _typeof(t) || !t) return t;
|
|
3290
3259
|
var e = t[Symbol.toPrimitive];
|
|
3291
3260
|
if (void 0 !== e) {
|
|
3292
|
-
var i = e.call(t, r
|
|
3261
|
+
var i = e.call(t, r);
|
|
3293
3262
|
if ("object" != _typeof(i)) return i;
|
|
3294
3263
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3295
3264
|
}
|
|
@@ -3304,9 +3273,9 @@ function toPropertyKey(t) {
|
|
|
3304
3273
|
function _defineProperty(e, r, t) {
|
|
3305
3274
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
3306
3275
|
value: t,
|
|
3307
|
-
enumerable:
|
|
3308
|
-
configurable:
|
|
3309
|
-
writable:
|
|
3276
|
+
enumerable: true,
|
|
3277
|
+
configurable: true,
|
|
3278
|
+
writable: true
|
|
3310
3279
|
}) : e[r] = t, e;
|
|
3311
3280
|
}
|
|
3312
3281
|
|
|
@@ -3839,8 +3808,18 @@ var newFocus = function newFocus(innerNodes, innerTabbables, outerNodes, activeE
|
|
|
3839
3808
|
var firstNodeIndex = outerNodes.indexOf(firstFocus);
|
|
3840
3809
|
var lastNodeIndex = outerNodes.indexOf(lastFocus);
|
|
3841
3810
|
var correctedNodes = correctNodes(outerNodes);
|
|
3842
|
-
var
|
|
3843
|
-
var
|
|
3811
|
+
var currentFocusableIndex = activeElement !== undefined ? correctedNodes.indexOf(activeElement) : -1;
|
|
3812
|
+
var previousFocusableIndex = lastNode ? correctedNodes.indexOf(lastNode) : currentFocusableIndex;
|
|
3813
|
+
var tabbableNodes = correctedNodes.filter(function (node) {
|
|
3814
|
+
return node.tabIndex >= 0;
|
|
3815
|
+
});
|
|
3816
|
+
var currentTabbableIndex = activeElement !== undefined ? tabbableNodes.indexOf(activeElement) : -1;
|
|
3817
|
+
var previousTabbableIndex = lastNode ? tabbableNodes.indexOf(lastNode) : currentTabbableIndex;
|
|
3818
|
+
var focusIndexDiff = currentTabbableIndex >= 0 && previousTabbableIndex >= 0 ?
|
|
3819
|
+
// old/new are tabbables, measure distance in tabbable space
|
|
3820
|
+
previousTabbableIndex - currentTabbableIndex :
|
|
3821
|
+
// or else measure in focusable space
|
|
3822
|
+
previousFocusableIndex - currentFocusableIndex;
|
|
3844
3823
|
// old focus
|
|
3845
3824
|
if (!indexDiff && lastNodeInside >= 0) {
|
|
3846
3825
|
return lastNodeInside;
|
|
@@ -3863,7 +3842,7 @@ var newFocus = function newFocus(innerNodes, innerTabbables, outerNodes, activeE
|
|
|
3863
3842
|
return returnFirstNode;
|
|
3864
3843
|
}
|
|
3865
3844
|
// jump out, but not on the guard
|
|
3866
|
-
if (indexDiff && Math.abs(
|
|
3845
|
+
if (indexDiff && Math.abs(focusIndexDiff) > 1) {
|
|
3867
3846
|
return lastNodeInside;
|
|
3868
3847
|
}
|
|
3869
3848
|
// focus above lock
|
|
@@ -4419,9 +4398,8 @@ var activateTrap = function activateTrap() {
|
|
|
4419
4398
|
focusOptions = _lastActiveTrap.focusOptions,
|
|
4420
4399
|
noFocusGuards = _lastActiveTrap.noFocusGuards;
|
|
4421
4400
|
var workingNode = observed || lastPortaledElement && lastPortaledElement.portaledElement;
|
|
4422
|
-
if (focusOnBody() && lastActiveFocus) {
|
|
4401
|
+
if (focusOnBody() && lastActiveFocus && lastActiveFocus !== document.body) {
|
|
4423
4402
|
if (!document.body.contains(lastActiveFocus) || isNotFocusable(lastActiveFocus)) {
|
|
4424
|
-
lastActiveFocus = null;
|
|
4425
4403
|
var newTarget = tryRestoreFocus();
|
|
4426
4404
|
if (newTarget) {
|
|
4427
4405
|
newTarget.focus();
|
|
@@ -4457,9 +4435,11 @@ var activateTrap = function activateTrap() {
|
|
|
4457
4435
|
lastPortaledElement = {};
|
|
4458
4436
|
}
|
|
4459
4437
|
}
|
|
4460
|
-
focusWasOutsideWindow = false;
|
|
4461
4438
|
lastActiveFocus = document && document.activeElement;
|
|
4462
|
-
|
|
4439
|
+
if (lastActiveFocus !== document.body) {
|
|
4440
|
+
tryRestoreFocus = captureFocusRestore(lastActiveFocus);
|
|
4441
|
+
}
|
|
4442
|
+
focusWasOutsideWindow = false;
|
|
4463
4443
|
}
|
|
4464
4444
|
}
|
|
4465
4445
|
if (document && activeElement !== document.activeElement && document.querySelector('[data-focus-auto-guard]')) {
|
|
@@ -4478,7 +4458,7 @@ var activateTrap = function activateTrap() {
|
|
|
4478
4458
|
var node = _ref4.node;
|
|
4479
4459
|
return node.removeAttribute('tabIndex');
|
|
4480
4460
|
});
|
|
4481
|
-
autoGuard(focusedIndex, allNodes.length,
|
|
4461
|
+
autoGuard(focusedIndex, allNodes.length, 1, allNodes);
|
|
4482
4462
|
autoGuard(focusedIndex, -1, -1, allNodes);
|
|
4483
4463
|
}
|
|
4484
4464
|
}
|
|
@@ -4885,9 +4865,9 @@ var handleScroll = function handleScroll(axis, endTarget, event, sourceDelta, no
|
|
|
4885
4865
|
// self content
|
|
4886
4866
|
targetInLock && (endTarget.contains(target) || endTarget === target));
|
|
4887
4867
|
// handle epsilon around 0 (non standard zoom levels)
|
|
4888
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 ||
|
|
4868
|
+
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
4889
4869
|
shouldCancelScroll = true;
|
|
4890
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 ||
|
|
4870
|
+
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
4891
4871
|
shouldCancelScroll = true;
|
|
4892
4872
|
}
|
|
4893
4873
|
return shouldCancelScroll;
|
|
@@ -4972,7 +4952,7 @@ function RemoveScrollSideCar(props) {
|
|
|
4972
4952
|
return true;
|
|
4973
4953
|
}
|
|
4974
4954
|
var cancelingAxis = activeAxis.current || currentAxis;
|
|
4975
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY
|
|
4955
|
+
return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY);
|
|
4976
4956
|
}, []);
|
|
4977
4957
|
var shouldPrevent = React__namespace.useCallback(function (_event) {
|
|
4978
4958
|
var event = _event;
|
|
@@ -7928,7 +7908,7 @@ function requireReactInputMask_production_min() {
|
|
|
7928
7908
|
function setInputSelection(e, t, n) {
|
|
7929
7909
|
if ("selectionStart" in e && "selectionEnd" in e) e.selectionStart = t, e.selectionEnd = n;else {
|
|
7930
7910
|
var a = e.createTextRange();
|
|
7931
|
-
a.collapse(
|
|
7911
|
+
a.collapse(true), a.moveStart("character", t), a.moveEnd("character", n - t), a.select();
|
|
7932
7912
|
}
|
|
7933
7913
|
}
|
|
7934
7914
|
function getInputSelection(e) {
|
|
@@ -7963,9 +7943,9 @@ function requireReactInputMask_production_min() {
|
|
|
7963
7943
|
lastEditablePosition: null,
|
|
7964
7944
|
permanents: []
|
|
7965
7945
|
};
|
|
7966
|
-
var s =
|
|
7946
|
+
var s = false;
|
|
7967
7947
|
return e.split("").forEach(function (e) {
|
|
7968
|
-
s = !s && "\\" === e || (s || !n[e] ? (o.push(a.length), a.length === o.length - 1 && (i += e)) : r = a.length + 1, a += e,
|
|
7948
|
+
s = !s && "\\" === e || (s || !n[e] ? (o.push(a.length), a.length === o.length - 1 && (i += e)) : r = a.length + 1, a += e, false);
|
|
7969
7949
|
}), {
|
|
7970
7950
|
maskChar: t,
|
|
7971
7951
|
formatChars: n,
|
|
@@ -7981,7 +7961,7 @@ function requireReactInputMask_production_min() {
|
|
|
7981
7961
|
function isAllowedCharacter(e, t, n) {
|
|
7982
7962
|
var a = e.mask,
|
|
7983
7963
|
i = e.formatChars;
|
|
7984
|
-
if (!n) return
|
|
7964
|
+
if (!n) return false;
|
|
7985
7965
|
if (isPermanentCharacter(e, t)) return a[t] === n;
|
|
7986
7966
|
var r = i[a[t]];
|
|
7987
7967
|
return new RegExp(r).test(n);
|
|
@@ -8042,8 +8022,8 @@ function requireReactInputMask_production_min() {
|
|
|
8042
8022
|
h = isFilled(r, o);
|
|
8043
8023
|
return !u && s > o.length && (o += l.slice(o.length, s)), t.every(function (e) {
|
|
8044
8024
|
for (; i = e, isPermanentCharacter(r, a = s) && i !== l[a];) {
|
|
8045
|
-
if (s >= o.length && (o += l[s]), t = e, n = s, u && isPermanentCharacter(r, n) && t === u) return
|
|
8046
|
-
if (++s >= l.length) return
|
|
8025
|
+
if (s >= o.length && (o += l[s]), t = e, n = s, u && isPermanentCharacter(r, n) && t === u) return true;
|
|
8026
|
+
if (++s >= l.length) return false;
|
|
8047
8027
|
}
|
|
8048
8028
|
var t, n, a, i;
|
|
8049
8029
|
return !isAllowedCharacter(r, s, e) && e !== u || (s < o.length ? o = u || h || s < c.length ? o.slice(0, s) + e + o.slice(s + 1) : (o = o.slice(0, s) + e + o.slice(s), formatValue(r, o)) : u || (o += e), ++s < l.length);
|
|
@@ -8055,7 +8035,7 @@ function requireReactInputMask_production_min() {
|
|
|
8055
8035
|
n = t.split(""),
|
|
8056
8036
|
s = i;
|
|
8057
8037
|
return n.every(function (e) {
|
|
8058
|
-
for (; n = e, isPermanentCharacter(a, t = i) && n !== r[t];) if (++i >= r.length) return
|
|
8038
|
+
for (; n = e, isPermanentCharacter(a, t = i) && n !== r[t];) if (++i >= r.length) return false;
|
|
8059
8039
|
var t, n;
|
|
8060
8040
|
return (isAllowedCharacter(a, i, e) || e === o) && i++, i < r.length;
|
|
8061
8041
|
}), i - s;
|
|
@@ -8119,7 +8099,7 @@ function requireReactInputMask_production_min() {
|
|
|
8119
8099
|
var InputElement = function (c) {
|
|
8120
8100
|
function e(e) {
|
|
8121
8101
|
var f = c.call(this, e) || this;
|
|
8122
|
-
f.focused =
|
|
8102
|
+
f.focused = false, f.mounted = false, f.previousSelection = null, f.selectionDeferId = null, f.saveSelectionLoopDeferId = null, f.saveSelectionLoop = function () {
|
|
8123
8103
|
f.previousSelection = f.getSelection(), f.saveSelectionLoopDeferId = defer(f.saveSelectionLoop);
|
|
8124
8104
|
}, f.runSaveSelectionLoop = function () {
|
|
8125
8105
|
null === f.saveSelectionLoopDeferId && f.saveSelectionLoop();
|
|
@@ -8211,14 +8191,14 @@ function requireReactInputMask_production_min() {
|
|
|
8211
8191
|
c = h.value, u = h.selection;
|
|
8212
8192
|
}
|
|
8213
8193
|
f.setInputValue(c), isFunction(f.props.onChange) && f.props.onChange(e), f.isWindowsPhoneBrowser ? f.setSelection(u.start, u.end, {
|
|
8214
|
-
deferred:
|
|
8194
|
+
deferred: true
|
|
8215
8195
|
}) : f.setSelection(u.start, u.end);
|
|
8216
8196
|
}, f.onFocus = function (e) {
|
|
8217
8197
|
var t = f.props.beforeMaskedValueChange,
|
|
8218
8198
|
n = f.maskOptions,
|
|
8219
8199
|
a = n.mask,
|
|
8220
8200
|
i = n.prefix;
|
|
8221
|
-
if (f.focused =
|
|
8201
|
+
if (f.focused = true, f.mounted = true, a) {
|
|
8222
8202
|
if (f.value) getFilledLength(f.maskOptions, f.value) < f.maskOptions.mask.length && f.setCursorToEnd();else {
|
|
8223
8203
|
var r = formatValue(f.maskOptions, i),
|
|
8224
8204
|
o = formatValue(f.maskOptions, r),
|
|
@@ -8247,7 +8227,7 @@ function requireReactInputMask_production_min() {
|
|
|
8247
8227
|
}, f.onBlur = function (e) {
|
|
8248
8228
|
var t = f.props.beforeMaskedValueChange,
|
|
8249
8229
|
n = f.maskOptions.mask;
|
|
8250
|
-
if (f.stopSaveSelectionLoop(), f.focused =
|
|
8230
|
+
if (f.stopSaveSelectionLoop(), f.focused = false, n && !f.props.alwaysShowMask && isEmpty(f.maskOptions, f.value)) {
|
|
8251
8231
|
var a = "";
|
|
8252
8232
|
if (isFunction(t)) a = t({
|
|
8253
8233
|
value: a,
|
|
@@ -8307,7 +8287,7 @@ function requireReactInputMask_production_min() {
|
|
|
8307
8287
|
_inheritsLoose(e, c);
|
|
8308
8288
|
var t = e.prototype;
|
|
8309
8289
|
return t.componentDidMount = function () {
|
|
8310
|
-
this.mounted =
|
|
8290
|
+
this.mounted = true, this.getInputDOMNode() && (this.isWindowsPhoneBrowser = isWindowsPhoneBrowser(), this.maskOptions.mask && this.getInputValue() !== this.value && this.setInputValue(this.value));
|
|
8311
8291
|
}, t.componentDidUpdate = function () {
|
|
8312
8292
|
var e = this.previousSelection,
|
|
8313
8293
|
t = this.props,
|
|
@@ -8346,25 +8326,25 @@ function requireReactInputMask_production_min() {
|
|
|
8346
8326
|
this.value = c;
|
|
8347
8327
|
var g = this.getInputValue() !== this.value;
|
|
8348
8328
|
g ? (this.setInputValue(this.value), this.forceUpdate()) : f && this.forceUpdate();
|
|
8349
|
-
var v =
|
|
8329
|
+
var v = false;
|
|
8350
8330
|
null != d.start && null != d.end && (v = !e || e.start !== d.start || e.end !== d.end), (v || g) && this.setSelection(d.start, d.end);
|
|
8351
8331
|
} else s.mask && (this.stopSaveSelectionLoop(), this.forceUpdate());
|
|
8352
8332
|
}, t.componentWillUnmount = function () {
|
|
8353
|
-
this.mounted =
|
|
8333
|
+
this.mounted = false, null !== this.selectionDeferId && cancelDefer(this.selectionDeferId), this.stopSaveSelectionLoop();
|
|
8354
8334
|
}, t.render = function () {
|
|
8355
8335
|
var t,
|
|
8356
8336
|
e = this.props,
|
|
8357
8337
|
n = (e.mask, e.alwaysShowMask, e.maskChar, e.formatChars, e.inputRef, e.beforeMaskedValueChange, e.children),
|
|
8358
8338
|
a = _objectWithoutPropertiesLoose(e, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
8359
8339
|
if (n) {
|
|
8360
|
-
isFunction(n) || invariant_1(
|
|
8340
|
+
isFunction(n) || invariant_1(false);
|
|
8361
8341
|
var i = ["onChange", "onPaste", "onMouseDown", "onFocus", "onBlur", "value", "disabled", "readOnly"],
|
|
8362
8342
|
r = _extends({}, a);
|
|
8363
8343
|
i.forEach(function (e) {
|
|
8364
8344
|
return delete r[e];
|
|
8365
8345
|
}), t = n(r), i.filter(function (e) {
|
|
8366
8346
|
return null != t.props[e] && t.props[e] !== a[e];
|
|
8367
|
-
}).length && invariant_1(
|
|
8347
|
+
}).length && invariant_1(false);
|
|
8368
8348
|
} else t = React$1.createElement("input", _extends({
|
|
8369
8349
|
ref: this.handleRef
|
|
8370
8350
|
}, a));
|
|
@@ -10441,7 +10421,7 @@ var t = function t(_t) {
|
|
|
10441
10421
|
return !!e && (e.clientHeight < t.scrollHeight || e.clientWidth < t.scrollWidth);
|
|
10442
10422
|
}(t);
|
|
10443
10423
|
}
|
|
10444
|
-
return
|
|
10424
|
+
return false;
|
|
10445
10425
|
},
|
|
10446
10426
|
o$1 = function o(t, e, n, _o2, l, r, i, s) {
|
|
10447
10427
|
return r < t && i > e || r > t && i < e ? 0 : r <= t && s <= n || i >= e && s >= n ? r - t - _o2 : i > e && s < n || r < t && s > n ? i - e + l : 0;
|
|
@@ -10503,41 +10483,41 @@ var t = function t(_t) {
|
|
|
10503
10483
|
for (var _t2 = 0; _t2 < w.length; _t2++) {
|
|
10504
10484
|
var _e2 = w[_t2],
|
|
10505
10485
|
_e$getBoundingClientR2 = _e2.getBoundingClientRect(),
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
|
|
10512
|
-
if ("if-needed" === c && x >= 0 && R >= 0 && I <= H && C <= b && x >=
|
|
10513
|
-
var
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
var
|
|
10519
|
-
|
|
10520
|
-
var
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
if (m === _e2)
|
|
10525
|
-
|
|
10486
|
+
_l = _e$getBoundingClientR2.height,
|
|
10487
|
+
_r = _e$getBoundingClientR2.width,
|
|
10488
|
+
_i = _e$getBoundingClientR2.top,
|
|
10489
|
+
_s = _e$getBoundingClientR2.right,
|
|
10490
|
+
_d = _e$getBoundingClientR2.bottom,
|
|
10491
|
+
_h = _e$getBoundingClientR2.left;
|
|
10492
|
+
if ("if-needed" === c && x >= 0 && R >= 0 && I <= H && C <= b && (_e2 === m && !n(_e2) || x >= _i && I <= _d && R >= _h && C <= _s)) return L;
|
|
10493
|
+
var _a = getComputedStyle(_e2),
|
|
10494
|
+
_g = parseInt(_a.borderLeftWidth, 10),
|
|
10495
|
+
_p = parseInt(_a.borderTopWidth, 10),
|
|
10496
|
+
_W = parseInt(_a.borderRightWidth, 10),
|
|
10497
|
+
_T = parseInt(_a.borderBottomWidth, 10);
|
|
10498
|
+
var _B = 0,
|
|
10499
|
+
_F = 0;
|
|
10500
|
+
var _V = "offsetWidth" in _e2 ? _e2.offsetWidth - _e2.clientWidth - _g - _W : 0,
|
|
10501
|
+
S = "offsetHeight" in _e2 ? _e2.offsetHeight - _e2.clientHeight - _p - _T : 0,
|
|
10502
|
+
X = "offsetWidth" in _e2 ? 0 === _e2.offsetWidth ? 0 : _r / _e2.offsetWidth : 0,
|
|
10503
|
+
Y = "offsetHeight" in _e2 ? 0 === _e2.offsetHeight ? 0 : _l / _e2.offsetHeight : 0;
|
|
10504
|
+
if (m === _e2) _B = "start" === f ? k : "end" === f ? k - H : "nearest" === f ? o$1(M, M + H, H, _p, _T, M + k, M + k + v, v) : k - H / 2, _F = "start" === u ? D : "center" === u ? D - b / 2 : "end" === u ? D - b : o$1(y, y + b, b, _g, _W, y + D, y + D + E, E), _B = Math.max(0, _B + M), _F = Math.max(0, _F + y);else {
|
|
10505
|
+
_B = "start" === f ? k - _i - _p : "end" === f ? k - _d + _T + S : "nearest" === f ? o$1(_i, _d, _l, _p, _T + S, k, k + v, v) : k - (_i + _l / 2) + S / 2, _F = "start" === u ? D - _h - _g : "center" === u ? D - (_h + _r / 2) + _V / 2 : "end" === u ? D - _s + _W + _V : o$1(_h, _s, _r, _g, _W + _V, D, D + E, E);
|
|
10526
10506
|
var _t3 = _e2.scrollLeft,
|
|
10527
|
-
|
|
10528
|
-
|
|
10507
|
+
_n2 = _e2.scrollTop;
|
|
10508
|
+
_B = 0 === Y ? 0 : Math.max(0, Math.min(_n2 + _B / Y, _e2.scrollHeight - _l / Y + S)), _F = 0 === X ? 0 : Math.max(0, Math.min(_t3 + _F / X, _e2.scrollWidth - _r / X + _V)), k += _n2 - _B, D += _t3 - _F;
|
|
10529
10509
|
}
|
|
10530
10510
|
L.push({
|
|
10531
10511
|
el: _e2,
|
|
10532
|
-
top:
|
|
10533
|
-
left:
|
|
10512
|
+
top: _B,
|
|
10513
|
+
left: _F
|
|
10534
10514
|
});
|
|
10535
10515
|
}
|
|
10536
10516
|
return L;
|
|
10537
10517
|
};
|
|
10538
10518
|
|
|
10539
10519
|
var o = function o(t) {
|
|
10540
|
-
return
|
|
10520
|
+
return false === t ? {
|
|
10541
10521
|
block: "end",
|
|
10542
10522
|
inline: "nearest"
|
|
10543
10523
|
} : function (t) {
|
|
@@ -10551,10 +10531,10 @@ function e(e, r$1) {
|
|
|
10551
10531
|
if (!e.isConnected || !function (t) {
|
|
10552
10532
|
var o = t;
|
|
10553
10533
|
for (; o && o.parentNode;) {
|
|
10554
|
-
if (o.parentNode === document) return
|
|
10534
|
+
if (o.parentNode === document) return true;
|
|
10555
10535
|
o = o.parentNode instanceof ShadowRoot ? o.parentNode.host : o.parentNode;
|
|
10556
10536
|
}
|
|
10557
|
-
return
|
|
10537
|
+
return false;
|
|
10558
10538
|
}(e)) return;
|
|
10559
10539
|
var n = function (t) {
|
|
10560
10540
|
var o = window.getComputedStyle(t);
|