@moda/om 20.3.1 → 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/package.json +9 -9
- package/src/components/Breakpoint/Breakpoint.stories.tsx +3 -6
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { useState, createContext,
|
|
2
|
+
import React__default, { useState, createContext, forwardRef, useRef, useCallback, useEffect, useMemo, Fragment, PureComponent, Children, isValidElement, cloneElement, useContext, useReducer } from 'react';
|
|
3
3
|
import { Link, Prompt } from 'react-router-dom';
|
|
4
4
|
import require$$1, { createPortal } from 'react-dom';
|
|
5
5
|
|
|
@@ -7,6 +7,31 @@ function getDefaultExportFromCjs (x) {
|
|
|
7
7
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
function getAugmentedNamespace(n) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
|
|
12
|
+
var f = n.default;
|
|
13
|
+
if (typeof f == "function") {
|
|
14
|
+
var a = function a () {
|
|
15
|
+
if (this instanceof a) {
|
|
16
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
17
|
+
}
|
|
18
|
+
return f.apply(this, arguments);
|
|
19
|
+
};
|
|
20
|
+
a.prototype = f.prototype;
|
|
21
|
+
} else a = {};
|
|
22
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
23
|
+
Object.keys(n).forEach(function (k) {
|
|
24
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
25
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return n[k];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
return a;
|
|
33
|
+
}
|
|
34
|
+
|
|
10
35
|
var focusVisible$1 = {exports: {}};
|
|
11
36
|
|
|
12
37
|
var focusVisible = focusVisible$1.exports;
|
|
@@ -336,6 +361,9 @@ function requireColors() {
|
|
|
336
361
|
"teal": "rgb(0, 111, 98)",
|
|
337
362
|
"ivory": "rgb(242, 233, 219)",
|
|
338
363
|
"chatelle": "rgb(213, 194, 216)",
|
|
364
|
+
"edgewater": "rgb(198, 225, 209)",
|
|
365
|
+
"waikawa-gray": "rgb(86, 107, 136)",
|
|
366
|
+
"tuscany": "rgb(186, 83, 44)",
|
|
339
367
|
"klein-blue": "rgb(38, 48, 120)",
|
|
340
368
|
"persian-blue": "rgb(30, 34, 170)",
|
|
341
369
|
"brick": "rgb(147, 58, 32)",
|
|
@@ -360,7 +388,10 @@ function requireColors() {
|
|
|
360
388
|
"dark-fuchsia": "rgb(180, 60, 160)",
|
|
361
389
|
"teal": "rgb(0, 111, 98)",
|
|
362
390
|
"ivory": "rgb(242, 233, 219)",
|
|
363
|
-
"chatelle": "rgb(213, 194, 216)"
|
|
391
|
+
"chatelle": "rgb(213, 194, 216)",
|
|
392
|
+
"edgewater": "rgb(198, 225, 209)",
|
|
393
|
+
"waikawa-gray": "rgb(86, 107, 136)",
|
|
394
|
+
"tuscany": "rgb(186, 83, 44)"
|
|
364
395
|
},
|
|
365
396
|
"global": {
|
|
366
397
|
"klein-blue": "rgb(38, 48, 120)",
|
|
@@ -537,407 +568,347 @@ function requireBreakpoints() {
|
|
|
537
568
|
|
|
538
569
|
var helpers = {};
|
|
539
570
|
|
|
540
|
-
var
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
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
|
-
return obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && (obj.splice instanceof Function || Object.getOwnPropertyDescriptor(obj, obj.length - 1) && obj.constructor.name !== 'String');
|
|
712
|
-
};
|
|
713
|
-
return isArrayish;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
var hasRequiredSimpleSwizzle;
|
|
717
|
-
function requireSimpleSwizzle() {
|
|
718
|
-
if (hasRequiredSimpleSwizzle) return simpleSwizzle.exports;
|
|
719
|
-
hasRequiredSimpleSwizzle = 1;
|
|
720
|
-
var isArrayish = requireIsArrayish();
|
|
721
|
-
var concat = Array.prototype.concat;
|
|
722
|
-
var slice = Array.prototype.slice;
|
|
723
|
-
var swizzle = simpleSwizzle.exports = function swizzle(args) {
|
|
724
|
-
var results = [];
|
|
725
|
-
for (var i = 0, len = args.length; i < len; i++) {
|
|
726
|
-
var arg = args[i];
|
|
727
|
-
if (isArrayish(arg)) {
|
|
728
|
-
// http://jsperf.com/javascript-array-concat-vs-push/98
|
|
729
|
-
results = concat.call(results, slice.call(arg));
|
|
730
|
-
} else {
|
|
731
|
-
results.push(arg);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
return results;
|
|
735
|
-
};
|
|
736
|
-
swizzle.wrap = function (fn) {
|
|
737
|
-
return function () {
|
|
738
|
-
return fn(swizzle(arguments));
|
|
739
|
-
};
|
|
740
|
-
};
|
|
741
|
-
return simpleSwizzle.exports;
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
/* MIT license */
|
|
745
|
-
var hasRequiredColorString;
|
|
746
|
-
function requireColorString() {
|
|
747
|
-
if (hasRequiredColorString) return colorString.exports;
|
|
748
|
-
hasRequiredColorString = 1;
|
|
749
|
-
var colorNames = requireColorName();
|
|
750
|
-
var swizzle = requireSimpleSwizzle();
|
|
751
|
-
var hasOwnProperty = Object.hasOwnProperty;
|
|
752
|
-
var reverseNames = Object.create(null);
|
|
753
|
-
|
|
754
|
-
// create a list of reverse color names
|
|
755
|
-
for (var name in colorNames) {
|
|
756
|
-
if (hasOwnProperty.call(colorNames, name)) {
|
|
757
|
-
reverseNames[colorNames[name]] = name;
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
var cs = colorString.exports = {
|
|
761
|
-
to: {},
|
|
762
|
-
get: {}
|
|
763
|
-
};
|
|
764
|
-
cs.get = function (string) {
|
|
765
|
-
var prefix = string.substring(0, 3).toLowerCase();
|
|
766
|
-
var val;
|
|
767
|
-
var model;
|
|
768
|
-
switch (prefix) {
|
|
769
|
-
case 'hsl':
|
|
770
|
-
val = cs.get.hsl(string);
|
|
571
|
+
var colorNames = {
|
|
572
|
+
aliceblue: [240, 248, 255],
|
|
573
|
+
antiquewhite: [250, 235, 215],
|
|
574
|
+
aqua: [0, 255, 255],
|
|
575
|
+
aquamarine: [127, 255, 212],
|
|
576
|
+
azure: [240, 255, 255],
|
|
577
|
+
beige: [245, 245, 220],
|
|
578
|
+
bisque: [255, 228, 196],
|
|
579
|
+
black: [0, 0, 0],
|
|
580
|
+
blanchedalmond: [255, 235, 205],
|
|
581
|
+
blue: [0, 0, 255],
|
|
582
|
+
blueviolet: [138, 43, 226],
|
|
583
|
+
brown: [165, 42, 42],
|
|
584
|
+
burlywood: [222, 184, 135],
|
|
585
|
+
cadetblue: [95, 158, 160],
|
|
586
|
+
chartreuse: [127, 255, 0],
|
|
587
|
+
chocolate: [210, 105, 30],
|
|
588
|
+
coral: [255, 127, 80],
|
|
589
|
+
cornflowerblue: [100, 149, 237],
|
|
590
|
+
cornsilk: [255, 248, 220],
|
|
591
|
+
crimson: [220, 20, 60],
|
|
592
|
+
cyan: [0, 255, 255],
|
|
593
|
+
darkblue: [0, 0, 139],
|
|
594
|
+
darkcyan: [0, 139, 139],
|
|
595
|
+
darkgoldenrod: [184, 134, 11],
|
|
596
|
+
darkgray: [169, 169, 169],
|
|
597
|
+
darkgreen: [0, 100, 0],
|
|
598
|
+
darkgrey: [169, 169, 169],
|
|
599
|
+
darkkhaki: [189, 183, 107],
|
|
600
|
+
darkmagenta: [139, 0, 139],
|
|
601
|
+
darkolivegreen: [85, 107, 47],
|
|
602
|
+
darkorange: [255, 140, 0],
|
|
603
|
+
darkorchid: [153, 50, 204],
|
|
604
|
+
darkred: [139, 0, 0],
|
|
605
|
+
darksalmon: [233, 150, 122],
|
|
606
|
+
darkseagreen: [143, 188, 143],
|
|
607
|
+
darkslateblue: [72, 61, 139],
|
|
608
|
+
darkslategray: [47, 79, 79],
|
|
609
|
+
darkslategrey: [47, 79, 79],
|
|
610
|
+
darkturquoise: [0, 206, 209],
|
|
611
|
+
darkviolet: [148, 0, 211],
|
|
612
|
+
deeppink: [255, 20, 147],
|
|
613
|
+
deepskyblue: [0, 191, 255],
|
|
614
|
+
dimgray: [105, 105, 105],
|
|
615
|
+
dimgrey: [105, 105, 105],
|
|
616
|
+
dodgerblue: [30, 144, 255],
|
|
617
|
+
firebrick: [178, 34, 34],
|
|
618
|
+
floralwhite: [255, 250, 240],
|
|
619
|
+
forestgreen: [34, 139, 34],
|
|
620
|
+
fuchsia: [255, 0, 255],
|
|
621
|
+
gainsboro: [220, 220, 220],
|
|
622
|
+
ghostwhite: [248, 248, 255],
|
|
623
|
+
gold: [255, 215, 0],
|
|
624
|
+
goldenrod: [218, 165, 32],
|
|
625
|
+
gray: [128, 128, 128],
|
|
626
|
+
green: [0, 128, 0],
|
|
627
|
+
greenyellow: [173, 255, 47],
|
|
628
|
+
grey: [128, 128, 128],
|
|
629
|
+
honeydew: [240, 255, 240],
|
|
630
|
+
hotpink: [255, 105, 180],
|
|
631
|
+
indianred: [205, 92, 92],
|
|
632
|
+
indigo: [75, 0, 130],
|
|
633
|
+
ivory: [255, 255, 240],
|
|
634
|
+
khaki: [240, 230, 140],
|
|
635
|
+
lavender: [230, 230, 250],
|
|
636
|
+
lavenderblush: [255, 240, 245],
|
|
637
|
+
lawngreen: [124, 252, 0],
|
|
638
|
+
lemonchiffon: [255, 250, 205],
|
|
639
|
+
lightblue: [173, 216, 230],
|
|
640
|
+
lightcoral: [240, 128, 128],
|
|
641
|
+
lightcyan: [224, 255, 255],
|
|
642
|
+
lightgoldenrodyellow: [250, 250, 210],
|
|
643
|
+
lightgray: [211, 211, 211],
|
|
644
|
+
lightgreen: [144, 238, 144],
|
|
645
|
+
lightgrey: [211, 211, 211],
|
|
646
|
+
lightpink: [255, 182, 193],
|
|
647
|
+
lightsalmon: [255, 160, 122],
|
|
648
|
+
lightseagreen: [32, 178, 170],
|
|
649
|
+
lightskyblue: [135, 206, 250],
|
|
650
|
+
lightslategray: [119, 136, 153],
|
|
651
|
+
lightslategrey: [119, 136, 153],
|
|
652
|
+
lightsteelblue: [176, 196, 222],
|
|
653
|
+
lightyellow: [255, 255, 224],
|
|
654
|
+
lime: [0, 255, 0],
|
|
655
|
+
limegreen: [50, 205, 50],
|
|
656
|
+
linen: [250, 240, 230],
|
|
657
|
+
magenta: [255, 0, 255],
|
|
658
|
+
maroon: [128, 0, 0],
|
|
659
|
+
mediumaquamarine: [102, 205, 170],
|
|
660
|
+
mediumblue: [0, 0, 205],
|
|
661
|
+
mediumorchid: [186, 85, 211],
|
|
662
|
+
mediumpurple: [147, 112, 219],
|
|
663
|
+
mediumseagreen: [60, 179, 113],
|
|
664
|
+
mediumslateblue: [123, 104, 238],
|
|
665
|
+
mediumspringgreen: [0, 250, 154],
|
|
666
|
+
mediumturquoise: [72, 209, 204],
|
|
667
|
+
mediumvioletred: [199, 21, 133],
|
|
668
|
+
midnightblue: [25, 25, 112],
|
|
669
|
+
mintcream: [245, 255, 250],
|
|
670
|
+
mistyrose: [255, 228, 225],
|
|
671
|
+
moccasin: [255, 228, 181],
|
|
672
|
+
navajowhite: [255, 222, 173],
|
|
673
|
+
navy: [0, 0, 128],
|
|
674
|
+
oldlace: [253, 245, 230],
|
|
675
|
+
olive: [128, 128, 0],
|
|
676
|
+
olivedrab: [107, 142, 35],
|
|
677
|
+
orange: [255, 165, 0],
|
|
678
|
+
orangered: [255, 69, 0],
|
|
679
|
+
orchid: [218, 112, 214],
|
|
680
|
+
palegoldenrod: [238, 232, 170],
|
|
681
|
+
palegreen: [152, 251, 152],
|
|
682
|
+
paleturquoise: [175, 238, 238],
|
|
683
|
+
palevioletred: [219, 112, 147],
|
|
684
|
+
papayawhip: [255, 239, 213],
|
|
685
|
+
peachpuff: [255, 218, 185],
|
|
686
|
+
peru: [205, 133, 63],
|
|
687
|
+
pink: [255, 192, 203],
|
|
688
|
+
plum: [221, 160, 221],
|
|
689
|
+
powderblue: [176, 224, 230],
|
|
690
|
+
purple: [128, 0, 128],
|
|
691
|
+
rebeccapurple: [102, 51, 153],
|
|
692
|
+
red: [255, 0, 0],
|
|
693
|
+
rosybrown: [188, 143, 143],
|
|
694
|
+
royalblue: [65, 105, 225],
|
|
695
|
+
saddlebrown: [139, 69, 19],
|
|
696
|
+
salmon: [250, 128, 114],
|
|
697
|
+
sandybrown: [244, 164, 96],
|
|
698
|
+
seagreen: [46, 139, 87],
|
|
699
|
+
seashell: [255, 245, 238],
|
|
700
|
+
sienna: [160, 82, 45],
|
|
701
|
+
silver: [192, 192, 192],
|
|
702
|
+
skyblue: [135, 206, 235],
|
|
703
|
+
slateblue: [106, 90, 205],
|
|
704
|
+
slategray: [112, 128, 144],
|
|
705
|
+
slategrey: [112, 128, 144],
|
|
706
|
+
snow: [255, 250, 250],
|
|
707
|
+
springgreen: [0, 255, 127],
|
|
708
|
+
steelblue: [70, 130, 180],
|
|
709
|
+
tan: [210, 180, 140],
|
|
710
|
+
teal: [0, 128, 128],
|
|
711
|
+
thistle: [216, 191, 216],
|
|
712
|
+
tomato: [255, 99, 71],
|
|
713
|
+
turquoise: [64, 224, 208],
|
|
714
|
+
violet: [238, 130, 238],
|
|
715
|
+
wheat: [245, 222, 179],
|
|
716
|
+
white: [255, 255, 255],
|
|
717
|
+
whitesmoke: [245, 245, 245],
|
|
718
|
+
yellow: [255, 255, 0],
|
|
719
|
+
yellowgreen: [154, 205, 50]
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
var reverseNames = Object.create(null);
|
|
723
|
+
|
|
724
|
+
// Create a list of reverse color names
|
|
725
|
+
for (var name in colorNames) {
|
|
726
|
+
if (Object.hasOwn(colorNames, name)) {
|
|
727
|
+
reverseNames[colorNames[name]] = name;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
var cs = {
|
|
731
|
+
to: {},
|
|
732
|
+
get: {}
|
|
733
|
+
};
|
|
734
|
+
cs.get = function (string) {
|
|
735
|
+
var prefix = string.slice(0, 3).toLowerCase();
|
|
736
|
+
var value;
|
|
737
|
+
var model;
|
|
738
|
+
switch (prefix) {
|
|
739
|
+
case 'hsl':
|
|
740
|
+
{
|
|
741
|
+
value = cs.get.hsl(string);
|
|
771
742
|
model = 'hsl';
|
|
772
743
|
break;
|
|
773
|
-
|
|
774
|
-
|
|
744
|
+
}
|
|
745
|
+
case 'hwb':
|
|
746
|
+
{
|
|
747
|
+
value = cs.get.hwb(string);
|
|
775
748
|
model = 'hwb';
|
|
776
749
|
break;
|
|
777
|
-
|
|
778
|
-
|
|
750
|
+
}
|
|
751
|
+
default:
|
|
752
|
+
{
|
|
753
|
+
value = cs.get.rgb(string);
|
|
779
754
|
model = 'rgb';
|
|
780
755
|
break;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
if (!value) {
|
|
759
|
+
return null;
|
|
760
|
+
}
|
|
761
|
+
return {
|
|
762
|
+
model: model,
|
|
763
|
+
value: value
|
|
764
|
+
};
|
|
765
|
+
};
|
|
766
|
+
cs.get.rgb = function (string) {
|
|
767
|
+
if (!string) {
|
|
768
|
+
return null;
|
|
769
|
+
}
|
|
770
|
+
var abbr = /^#([a-f\d]{3,4})$/i;
|
|
771
|
+
var hex = /^#([a-f\d]{6})([a-f\d]{2})?$/i;
|
|
772
|
+
var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/;
|
|
773
|
+
var per = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/;
|
|
774
|
+
var keyword = /^(\w+)$/;
|
|
775
|
+
var rgb = [0, 0, 0, 1];
|
|
776
|
+
var match;
|
|
777
|
+
var i;
|
|
778
|
+
var hexAlpha;
|
|
779
|
+
if (match = string.match(hex)) {
|
|
780
|
+
hexAlpha = match[2];
|
|
781
|
+
match = match[1];
|
|
782
|
+
for (i = 0; i < 3; i++) {
|
|
783
|
+
// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
|
|
784
|
+
var i2 = i * 2;
|
|
785
|
+
rgb[i] = Number.parseInt(match.slice(i2, i2 + 2), 16);
|
|
781
786
|
}
|
|
782
|
-
if (
|
|
783
|
-
|
|
787
|
+
if (hexAlpha) {
|
|
788
|
+
rgb[3] = Number.parseInt(hexAlpha, 16) / 255;
|
|
784
789
|
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
cs.get.rgb = function (string) {
|
|
791
|
-
if (!string) {
|
|
792
|
-
return null;
|
|
790
|
+
} else if (match = string.match(abbr)) {
|
|
791
|
+
match = match[1];
|
|
792
|
+
hexAlpha = match[3];
|
|
793
|
+
for (i = 0; i < 3; i++) {
|
|
794
|
+
rgb[i] = Number.parseInt(match[i] + match[i], 16);
|
|
793
795
|
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
797
|
-
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
798
|
-
var keyword = /^(\w+)$/;
|
|
799
|
-
var rgb = [0, 0, 0, 1];
|
|
800
|
-
var match;
|
|
801
|
-
var i;
|
|
802
|
-
var hexAlpha;
|
|
803
|
-
if (match = string.match(hex)) {
|
|
804
|
-
hexAlpha = match[2];
|
|
805
|
-
match = match[1];
|
|
806
|
-
for (i = 0; i < 3; i++) {
|
|
807
|
-
// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
|
|
808
|
-
var i2 = i * 2;
|
|
809
|
-
rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
|
|
810
|
-
}
|
|
811
|
-
if (hexAlpha) {
|
|
812
|
-
rgb[3] = parseInt(hexAlpha, 16) / 255;
|
|
813
|
-
}
|
|
814
|
-
} else if (match = string.match(abbr)) {
|
|
815
|
-
match = match[1];
|
|
816
|
-
hexAlpha = match[3];
|
|
817
|
-
for (i = 0; i < 3; i++) {
|
|
818
|
-
rgb[i] = parseInt(match[i] + match[i], 16);
|
|
819
|
-
}
|
|
820
|
-
if (hexAlpha) {
|
|
821
|
-
rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
|
|
822
|
-
}
|
|
823
|
-
} else if (match = string.match(rgba)) {
|
|
824
|
-
for (i = 0; i < 3; i++) {
|
|
825
|
-
rgb[i] = parseInt(match[i + 1], 0);
|
|
826
|
-
}
|
|
827
|
-
if (match[4]) {
|
|
828
|
-
if (match[5]) {
|
|
829
|
-
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
830
|
-
} else {
|
|
831
|
-
rgb[3] = parseFloat(match[4]);
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
} else if (match = string.match(per)) {
|
|
835
|
-
for (i = 0; i < 3; i++) {
|
|
836
|
-
rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
|
|
837
|
-
}
|
|
838
|
-
if (match[4]) {
|
|
839
|
-
if (match[5]) {
|
|
840
|
-
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
841
|
-
} else {
|
|
842
|
-
rgb[3] = parseFloat(match[4]);
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
} else if (match = string.match(keyword)) {
|
|
846
|
-
if (match[1] === 'transparent') {
|
|
847
|
-
return [0, 0, 0, 0];
|
|
848
|
-
}
|
|
849
|
-
if (!hasOwnProperty.call(colorNames, match[1])) {
|
|
850
|
-
return null;
|
|
851
|
-
}
|
|
852
|
-
rgb = colorNames[match[1]];
|
|
853
|
-
rgb[3] = 1;
|
|
854
|
-
return rgb;
|
|
855
|
-
} else {
|
|
856
|
-
return null;
|
|
796
|
+
if (hexAlpha) {
|
|
797
|
+
rgb[3] = Number.parseInt(hexAlpha + hexAlpha, 16) / 255;
|
|
857
798
|
}
|
|
799
|
+
} else if (match = string.match(rgba)) {
|
|
858
800
|
for (i = 0; i < 3; i++) {
|
|
859
|
-
rgb[i] =
|
|
801
|
+
rgb[i] = Number.parseInt(match[i + 1], 10);
|
|
860
802
|
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
};
|
|
864
|
-
cs.get.hsl = function (string) {
|
|
865
|
-
if (!string) {
|
|
866
|
-
return null;
|
|
803
|
+
if (match[4]) {
|
|
804
|
+
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
867
805
|
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
var alpha = parseFloat(match[4]);
|
|
872
|
-
var h = (parseFloat(match[1]) % 360 + 360) % 360;
|
|
873
|
-
var s = clamp(parseFloat(match[2]), 0, 100);
|
|
874
|
-
var l = clamp(parseFloat(match[3]), 0, 100);
|
|
875
|
-
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
876
|
-
return [h, s, l, a];
|
|
806
|
+
} else if (match = string.match(per)) {
|
|
807
|
+
for (i = 0; i < 3; i++) {
|
|
808
|
+
rgb[i] = Math.round(Number.parseFloat(match[i + 1]) * 2.55);
|
|
877
809
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
cs.get.hwb = function (string) {
|
|
881
|
-
if (!string) {
|
|
882
|
-
return null;
|
|
810
|
+
if (match[4]) {
|
|
811
|
+
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
883
812
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
var alpha = parseFloat(match[4]);
|
|
888
|
-
var h = (parseFloat(match[1]) % 360 + 360) % 360;
|
|
889
|
-
var w = clamp(parseFloat(match[2]), 0, 100);
|
|
890
|
-
var b = clamp(parseFloat(match[3]), 0, 100);
|
|
891
|
-
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
892
|
-
return [h, w, b, a];
|
|
813
|
+
} else if (match = string.match(keyword)) {
|
|
814
|
+
if (match[1] === 'transparent') {
|
|
815
|
+
return [0, 0, 0, 0];
|
|
893
816
|
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
cs.to.hex = function () {
|
|
897
|
-
var rgba = swizzle(arguments);
|
|
898
|
-
return '#' + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : '');
|
|
899
|
-
};
|
|
900
|
-
cs.to.rgb = function () {
|
|
901
|
-
var rgba = swizzle(arguments);
|
|
902
|
-
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] + ')';
|
|
903
|
-
};
|
|
904
|
-
cs.to.rgb.percent = function () {
|
|
905
|
-
var rgba = swizzle(arguments);
|
|
906
|
-
var r = Math.round(rgba[0] / 255 * 100);
|
|
907
|
-
var g = Math.round(rgba[1] / 255 * 100);
|
|
908
|
-
var b = Math.round(rgba[2] / 255 * 100);
|
|
909
|
-
return rgba.length < 4 || rgba[3] === 1 ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)' : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
|
|
910
|
-
};
|
|
911
|
-
cs.to.hsl = function () {
|
|
912
|
-
var hsla = swizzle(arguments);
|
|
913
|
-
return hsla.length < 4 || hsla[3] === 1 ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)' : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
|
|
914
|
-
};
|
|
915
|
-
|
|
916
|
-
// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
|
|
917
|
-
// (hwb have alpha optional & 1 is default value)
|
|
918
|
-
cs.to.hwb = function () {
|
|
919
|
-
var hwba = swizzle(arguments);
|
|
920
|
-
var a = '';
|
|
921
|
-
if (hwba.length >= 4 && hwba[3] !== 1) {
|
|
922
|
-
a = ', ' + hwba[3];
|
|
817
|
+
if (!Object.hasOwn(colorNames, match[1])) {
|
|
818
|
+
return null;
|
|
923
819
|
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
820
|
+
rgb = colorNames[match[1]];
|
|
821
|
+
rgb[3] = 1;
|
|
822
|
+
return rgb;
|
|
823
|
+
} else {
|
|
824
|
+
return null;
|
|
825
|
+
}
|
|
826
|
+
for (i = 0; i < 3; i++) {
|
|
827
|
+
rgb[i] = clamp(rgb[i], 0, 255);
|
|
828
|
+
}
|
|
829
|
+
rgb[3] = clamp(rgb[3], 0, 1);
|
|
830
|
+
return rgb;
|
|
831
|
+
};
|
|
832
|
+
cs.get.hsl = function (string) {
|
|
833
|
+
if (!string) {
|
|
834
|
+
return null;
|
|
835
|
+
}
|
|
836
|
+
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*)?\)$/;
|
|
837
|
+
var match = string.match(hsl);
|
|
838
|
+
if (match) {
|
|
839
|
+
var alpha = Number.parseFloat(match[4]);
|
|
840
|
+
var h = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
841
|
+
var s = clamp(Number.parseFloat(match[2]), 0, 100);
|
|
842
|
+
var l = clamp(Number.parseFloat(match[3]), 0, 100);
|
|
843
|
+
var a = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
844
|
+
return [h, s, l, a];
|
|
845
|
+
}
|
|
846
|
+
return null;
|
|
847
|
+
};
|
|
848
|
+
cs.get.hwb = function (string) {
|
|
849
|
+
if (!string) {
|
|
850
|
+
return null;
|
|
851
|
+
}
|
|
852
|
+
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*)?\)$/;
|
|
853
|
+
var match = string.match(hwb);
|
|
854
|
+
if (match) {
|
|
855
|
+
var alpha = Number.parseFloat(match[4]);
|
|
856
|
+
var h = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
857
|
+
var w = clamp(Number.parseFloat(match[2]), 0, 100);
|
|
858
|
+
var b = clamp(Number.parseFloat(match[3]), 0, 100);
|
|
859
|
+
var a = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
860
|
+
return [h, w, b, a];
|
|
861
|
+
}
|
|
862
|
+
return null;
|
|
863
|
+
};
|
|
864
|
+
cs.to.hex = function () {
|
|
865
|
+
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)) : '');
|
|
866
|
+
};
|
|
867
|
+
cs.to.rgb = function () {
|
|
868
|
+
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]) + ')';
|
|
869
|
+
};
|
|
870
|
+
cs.to.rgb.percent = function () {
|
|
871
|
+
var r = Math.round((arguments.length <= 0 ? undefined : arguments[0]) / 255 * 100);
|
|
872
|
+
var g = Math.round((arguments.length <= 1 ? undefined : arguments[1]) / 255 * 100);
|
|
873
|
+
var b = Math.round((arguments.length <= 2 ? undefined : arguments[2]) / 255 * 100);
|
|
874
|
+
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]) + ')';
|
|
875
|
+
};
|
|
876
|
+
cs.to.hsl = function () {
|
|
877
|
+
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]) + ')';
|
|
878
|
+
};
|
|
929
879
|
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
880
|
+
// Hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
|
|
881
|
+
// (hwb have alpha optional & 1 is default value)
|
|
882
|
+
cs.to.hwb = function () {
|
|
883
|
+
var a = '';
|
|
884
|
+
if (arguments.length >= 4 && (arguments.length <= 3 ? undefined : arguments[3]) !== 1) {
|
|
885
|
+
a = ', ' + (arguments.length <= 3 ? undefined : arguments[3]);
|
|
933
886
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
887
|
+
return 'hwb(' + (arguments.length <= 0 ? undefined : arguments[0]) + ', ' + (arguments.length <= 1 ? undefined : arguments[1]) + '%, ' + (arguments.length <= 2 ? undefined : arguments[2]) + '%' + a + ')';
|
|
888
|
+
};
|
|
889
|
+
cs.to.keyword = function () {
|
|
890
|
+
for (var _len = arguments.length, rgb = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
891
|
+
rgb[_key] = arguments[_key];
|
|
937
892
|
}
|
|
938
|
-
return
|
|
893
|
+
return reverseNames[rgb.slice(0, 3)];
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
// Helpers
|
|
897
|
+
function clamp(number_, min, max) {
|
|
898
|
+
return Math.min(Math.max(min, number_), max);
|
|
899
|
+
}
|
|
900
|
+
function hexDouble(number_) {
|
|
901
|
+
var string_ = Math.round(number_).toString(16).toUpperCase();
|
|
902
|
+
return string_.length < 2 ? '0' + string_ : string_;
|
|
939
903
|
}
|
|
940
904
|
|
|
905
|
+
var colorString = /*#__PURE__*/Object.freeze({
|
|
906
|
+
__proto__: null,
|
|
907
|
+
default: cs
|
|
908
|
+
});
|
|
909
|
+
|
|
910
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(colorString);
|
|
911
|
+
|
|
941
912
|
var hasRequiredHelpers;
|
|
942
913
|
function requireHelpers() {
|
|
943
914
|
if (hasRequiredHelpers) return helpers;
|
|
@@ -954,20 +925,11 @@ function requireHelpers() {
|
|
|
954
925
|
};
|
|
955
926
|
return __assign.apply(this, arguments);
|
|
956
927
|
};
|
|
957
|
-
var __spreadArray = helpers && helpers.__spreadArray || function (to, from, pack) {
|
|
958
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
959
|
-
if (ar || !(i in from)) {
|
|
960
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
961
|
-
ar[i] = from[i];
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
965
|
-
};
|
|
966
928
|
Object.defineProperty(exports, "__esModule", {
|
|
967
929
|
value: true
|
|
968
930
|
});
|
|
969
931
|
exports.spacing = exports.colorInHex = exports.color = exports.remToUnitlessPx = exports.text = void 0;
|
|
970
|
-
var
|
|
932
|
+
var color_string_1 = require$$0;
|
|
971
933
|
var colors_1 = requireColors();
|
|
972
934
|
var space_1 = requireSpace();
|
|
973
935
|
var typography_1 = requireTypography();
|
|
@@ -989,13 +951,20 @@ function requireHelpers() {
|
|
|
989
951
|
var color = function color(name, alpha) {
|
|
990
952
|
var _a;
|
|
991
953
|
var color = colors_1.colors.all[name];
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
954
|
+
var _b = (_a = color_string_1["default"].get.rgb(color)) !== null && _a !== void 0 ? _a : [],
|
|
955
|
+
red = _b[0],
|
|
956
|
+
green = _b[1],
|
|
957
|
+
blue = _b[2];
|
|
958
|
+
return alpha != null ? color_string_1["default"].to.rgb(red, green, blue, alpha) : color;
|
|
995
959
|
};
|
|
996
960
|
exports.color = color;
|
|
997
961
|
var colorInHex = function colorInHex(name, alpha) {
|
|
998
|
-
|
|
962
|
+
var _a, _b, _c;
|
|
963
|
+
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 : [],
|
|
964
|
+
red = _d[0],
|
|
965
|
+
green = _d[1],
|
|
966
|
+
blue = _d[2];
|
|
967
|
+
return (_c = color_string_1["default"].to.hex(red, green, blue, alpha)) !== null && _c !== void 0 ? _c : '';
|
|
999
968
|
};
|
|
1000
969
|
exports.colorInHex = colorInHex;
|
|
1001
970
|
var spacing = function spacing(topY, rightX, bottom, left) {
|
|
@@ -1096,9 +1065,9 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
1096
1065
|
s: F,
|
|
1097
1066
|
n: function () {
|
|
1098
1067
|
return n >= r.length ? {
|
|
1099
|
-
done:
|
|
1068
|
+
done: true
|
|
1100
1069
|
} : {
|
|
1101
|
-
done:
|
|
1070
|
+
done: false,
|
|
1102
1071
|
value: r[n++]
|
|
1103
1072
|
};
|
|
1104
1073
|
},
|
|
@@ -1111,8 +1080,8 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
1111
1080
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1112
1081
|
}
|
|
1113
1082
|
var o,
|
|
1114
|
-
a =
|
|
1115
|
-
u =
|
|
1083
|
+
a = true,
|
|
1084
|
+
u = false;
|
|
1116
1085
|
return {
|
|
1117
1086
|
s: function () {
|
|
1118
1087
|
t = t.call(r);
|
|
@@ -1122,7 +1091,7 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
1122
1091
|
return a = r.done, r;
|
|
1123
1092
|
},
|
|
1124
1093
|
e: function (r) {
|
|
1125
|
-
u =
|
|
1094
|
+
u = true, o = r;
|
|
1126
1095
|
},
|
|
1127
1096
|
f: function () {
|
|
1128
1097
|
try {
|
|
@@ -1136,9 +1105,9 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
1136
1105
|
function _defineProperty$1(e, r, t) {
|
|
1137
1106
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1138
1107
|
value: t,
|
|
1139
|
-
enumerable:
|
|
1140
|
-
configurable:
|
|
1141
|
-
writable:
|
|
1108
|
+
enumerable: true,
|
|
1109
|
+
configurable: true,
|
|
1110
|
+
writable: true
|
|
1142
1111
|
}) : e[r] = t, e;
|
|
1143
1112
|
}
|
|
1144
1113
|
function _extends$1() {
|
|
@@ -1161,15 +1130,15 @@ function _iterableToArrayLimit(r, l) {
|
|
|
1161
1130
|
i,
|
|
1162
1131
|
u,
|
|
1163
1132
|
a = [],
|
|
1164
|
-
f =
|
|
1165
|
-
o =
|
|
1133
|
+
f = true,
|
|
1134
|
+
o = false;
|
|
1166
1135
|
try {
|
|
1167
1136
|
if (i = (t = t.call(r)).next, 0 === l) {
|
|
1168
1137
|
if (Object(t) !== t) return;
|
|
1169
1138
|
f = !1;
|
|
1170
1139
|
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
1171
1140
|
} catch (r) {
|
|
1172
|
-
o =
|
|
1141
|
+
o = true, n = r;
|
|
1173
1142
|
} finally {
|
|
1174
1143
|
try {
|
|
1175
1144
|
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
@@ -1202,7 +1171,7 @@ function ownKeys(e, r) {
|
|
|
1202
1171
|
function _objectSpread2(e) {
|
|
1203
1172
|
for (var r = 1; r < arguments.length; r++) {
|
|
1204
1173
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
1205
|
-
r % 2 ? ownKeys(Object(t),
|
|
1174
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
1206
1175
|
_defineProperty$1(e, r, t[r]);
|
|
1207
1176
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
1208
1177
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
@@ -1216,8 +1185,8 @@ function _objectWithoutProperties(e, t) {
|
|
|
1216
1185
|
r,
|
|
1217
1186
|
i = _objectWithoutPropertiesLoose(e, t);
|
|
1218
1187
|
if (Object.getOwnPropertySymbols) {
|
|
1219
|
-
var
|
|
1220
|
-
for (r = 0; r <
|
|
1188
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
1189
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
1221
1190
|
}
|
|
1222
1191
|
return i;
|
|
1223
1192
|
}
|
|
@@ -1225,7 +1194,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
1225
1194
|
if (null == r) return {};
|
|
1226
1195
|
var t = {};
|
|
1227
1196
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
1228
|
-
if (e.
|
|
1197
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
1229
1198
|
t[n] = r[n];
|
|
1230
1199
|
}
|
|
1231
1200
|
return t;
|
|
@@ -1240,7 +1209,7 @@ function _toPrimitive(t, r) {
|
|
|
1240
1209
|
if ("object" != typeof t || !t) return t;
|
|
1241
1210
|
var e = t[Symbol.toPrimitive];
|
|
1242
1211
|
if (void 0 !== e) {
|
|
1243
|
-
var i = e.call(t, r
|
|
1212
|
+
var i = e.call(t, r);
|
|
1244
1213
|
if ("object" != typeof i) return i;
|
|
1245
1214
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1246
1215
|
}
|
|
@@ -2993,16 +2962,16 @@ var mediumSidecar = createSidecarMedium({
|
|
|
2993
2962
|
var focusScope = /*#__PURE__*/createContext(undefined);
|
|
2994
2963
|
|
|
2995
2964
|
var emptyArray = [];
|
|
2996
|
-
var FocusLock = /*#__PURE__*/
|
|
2965
|
+
var FocusLock = /*#__PURE__*/forwardRef(function FocusLockUI(props, parentRef) {
|
|
2997
2966
|
var _extends2;
|
|
2998
|
-
var
|
|
2999
|
-
realObserved =
|
|
3000
|
-
setObserved =
|
|
3001
|
-
var observed =
|
|
3002
|
-
var isActive =
|
|
3003
|
-
var originalFocusedElement =
|
|
3004
|
-
var
|
|
3005
|
-
update =
|
|
2967
|
+
var _useState = useState(),
|
|
2968
|
+
realObserved = _useState[0],
|
|
2969
|
+
setObserved = _useState[1];
|
|
2970
|
+
var observed = useRef();
|
|
2971
|
+
var isActive = useRef(false);
|
|
2972
|
+
var originalFocusedElement = useRef(null);
|
|
2973
|
+
var _useState2 = useState({}),
|
|
2974
|
+
update = _useState2[1];
|
|
3006
2975
|
var children = props.children,
|
|
3007
2976
|
_props$disabled = props.disabled,
|
|
3008
2977
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
@@ -3031,9 +3000,9 @@ var FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parent
|
|
|
3031
3000
|
focusOptions = props.focusOptions,
|
|
3032
3001
|
onActivationCallback = props.onActivation,
|
|
3033
3002
|
onDeactivationCallback = props.onDeactivation;
|
|
3034
|
-
var
|
|
3035
|
-
id =
|
|
3036
|
-
var onActivation =
|
|
3003
|
+
var _useState3 = useState({}),
|
|
3004
|
+
id = _useState3[0];
|
|
3005
|
+
var onActivation = useCallback(function (_ref) {
|
|
3037
3006
|
var captureFocusRestore = _ref.captureFocusRestore;
|
|
3038
3007
|
if (!originalFocusedElement.current) {
|
|
3039
3008
|
var _document;
|
|
@@ -3049,14 +3018,14 @@ var FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parent
|
|
|
3049
3018
|
isActive.current = true;
|
|
3050
3019
|
update();
|
|
3051
3020
|
}, [onActivationCallback]);
|
|
3052
|
-
var onDeactivation =
|
|
3021
|
+
var onDeactivation = useCallback(function () {
|
|
3053
3022
|
isActive.current = false;
|
|
3054
3023
|
if (onDeactivationCallback) {
|
|
3055
3024
|
onDeactivationCallback(observed.current);
|
|
3056
3025
|
}
|
|
3057
3026
|
update();
|
|
3058
3027
|
}, [onDeactivationCallback]);
|
|
3059
|
-
var returnFocus =
|
|
3028
|
+
var returnFocus = useCallback(function (allowDefer) {
|
|
3060
3029
|
var focusRestore = originalFocusedElement.current;
|
|
3061
3030
|
if (focusRestore) {
|
|
3062
3031
|
var returnFocusTo = (typeof focusRestore === 'function' ? focusRestore() : focusRestore) || document.body;
|
|
@@ -3074,13 +3043,13 @@ var FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parent
|
|
|
3074
3043
|
}
|
|
3075
3044
|
}
|
|
3076
3045
|
}, [shouldReturnFocus]);
|
|
3077
|
-
var onFocus =
|
|
3046
|
+
var onFocus = useCallback(function (event) {
|
|
3078
3047
|
if (isActive.current) {
|
|
3079
3048
|
mediumFocus.useMedium(event);
|
|
3080
3049
|
}
|
|
3081
3050
|
}, []);
|
|
3082
3051
|
var onBlur = mediumBlur.useMedium;
|
|
3083
|
-
var setObserveNode =
|
|
3052
|
+
var setObserveNode = useCallback(function (newObserved) {
|
|
3084
3053
|
if (observed.current !== newObserved) {
|
|
3085
3054
|
observed.current = newObserved;
|
|
3086
3055
|
setObserved(newObserved);
|
|
@@ -3090,7 +3059,7 @@ var FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parent
|
|
|
3090
3059
|
if (typeof allowTextSelection !== 'undefined') {
|
|
3091
3060
|
console.warn('React-Focus-Lock: allowTextSelection is deprecated and enabled by default');
|
|
3092
3061
|
}
|
|
3093
|
-
|
|
3062
|
+
useEffect(function () {
|
|
3094
3063
|
if (!observed.current && typeof Container !== 'string') {
|
|
3095
3064
|
console.error('FocusLock: could not obtain ref to internal node');
|
|
3096
3065
|
}
|
|
@@ -3100,7 +3069,7 @@ var FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parent
|
|
|
3100
3069
|
var hasLeadingGuards = noFocusGuards !== true;
|
|
3101
3070
|
var hasTailingGuards = hasLeadingGuards && noFocusGuards !== 'tail';
|
|
3102
3071
|
var mergedRef = useMergeRefs([parentRef, setObserveNode]);
|
|
3103
|
-
var focusScopeValue =
|
|
3072
|
+
var focusScopeValue = useMemo(function () {
|
|
3104
3073
|
return {
|
|
3105
3074
|
observed: observed,
|
|
3106
3075
|
shards: shards,
|
|
@@ -3108,18 +3077,18 @@ var FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parent
|
|
|
3108
3077
|
active: isActive.current
|
|
3109
3078
|
};
|
|
3110
3079
|
}, [disabled, isActive.current, shards, realObserved]);
|
|
3111
|
-
return /*#__PURE__*/
|
|
3112
|
-
|
|
3080
|
+
return /*#__PURE__*/React__default.createElement(Fragment, null, hasLeadingGuards && [/*#__PURE__*/
|
|
3081
|
+
React__default.createElement("div", {
|
|
3113
3082
|
key: "guard-first",
|
|
3114
3083
|
"data-focus-guard": true,
|
|
3115
3084
|
tabIndex: disabled ? -1 : 0,
|
|
3116
3085
|
style: hiddenGuard
|
|
3117
|
-
}), hasPositiveIndices ? /*#__PURE__*/
|
|
3086
|
+
}), hasPositiveIndices ? /*#__PURE__*/React__default.createElement("div", {
|
|
3118
3087
|
key: "guard-nearest",
|
|
3119
3088
|
"data-focus-guard": true,
|
|
3120
3089
|
tabIndex: disabled ? -1 : 1,
|
|
3121
3090
|
style: hiddenGuard
|
|
3122
|
-
}) : null], !disabled && /*#__PURE__*/
|
|
3091
|
+
}) : null], !disabled && /*#__PURE__*/React__default.createElement(SideCar, {
|
|
3123
3092
|
id: id,
|
|
3124
3093
|
sideCar: mediumSidecar,
|
|
3125
3094
|
observed: realObserved,
|
|
@@ -3134,15 +3103,15 @@ var FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parent
|
|
|
3134
3103
|
returnFocus: returnFocus,
|
|
3135
3104
|
focusOptions: focusOptions,
|
|
3136
3105
|
noFocusGuards: noFocusGuards
|
|
3137
|
-
}), /*#__PURE__*/
|
|
3106
|
+
}), /*#__PURE__*/React__default.createElement(Container, _extends({
|
|
3138
3107
|
ref: mergedRef
|
|
3139
3108
|
}, lockProps, {
|
|
3140
3109
|
className: className,
|
|
3141
3110
|
onBlur: onBlur,
|
|
3142
3111
|
onFocus: onFocus
|
|
3143
|
-
}), /*#__PURE__*/
|
|
3112
|
+
}), /*#__PURE__*/React__default.createElement(focusScope.Provider, {
|
|
3144
3113
|
value: focusScopeValue
|
|
3145
|
-
}, children)), hasTailingGuards && /*#__PURE__*/
|
|
3114
|
+
}, children)), hasTailingGuards && /*#__PURE__*/React__default.createElement("div", {
|
|
3146
3115
|
"data-focus-guard": true,
|
|
3147
3116
|
tabIndex: disabled ? -1 : 0,
|
|
3148
3117
|
style: hiddenGuard
|
|
@@ -3269,7 +3238,7 @@ function toPrimitive(t, r) {
|
|
|
3269
3238
|
if ("object" != _typeof(t) || !t) return t;
|
|
3270
3239
|
var e = t[Symbol.toPrimitive];
|
|
3271
3240
|
if (void 0 !== e) {
|
|
3272
|
-
var i = e.call(t, r
|
|
3241
|
+
var i = e.call(t, r);
|
|
3273
3242
|
if ("object" != _typeof(i)) return i;
|
|
3274
3243
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3275
3244
|
}
|
|
@@ -3284,9 +3253,9 @@ function toPropertyKey(t) {
|
|
|
3284
3253
|
function _defineProperty(e, r, t) {
|
|
3285
3254
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
3286
3255
|
value: t,
|
|
3287
|
-
enumerable:
|
|
3288
|
-
configurable:
|
|
3289
|
-
writable:
|
|
3256
|
+
enumerable: true,
|
|
3257
|
+
configurable: true,
|
|
3258
|
+
writable: true
|
|
3290
3259
|
}) : e[r] = t, e;
|
|
3291
3260
|
}
|
|
3292
3261
|
|
|
@@ -3819,8 +3788,18 @@ var newFocus = function newFocus(innerNodes, innerTabbables, outerNodes, activeE
|
|
|
3819
3788
|
var firstNodeIndex = outerNodes.indexOf(firstFocus);
|
|
3820
3789
|
var lastNodeIndex = outerNodes.indexOf(lastFocus);
|
|
3821
3790
|
var correctedNodes = correctNodes(outerNodes);
|
|
3822
|
-
var
|
|
3823
|
-
var
|
|
3791
|
+
var currentFocusableIndex = activeElement !== undefined ? correctedNodes.indexOf(activeElement) : -1;
|
|
3792
|
+
var previousFocusableIndex = lastNode ? correctedNodes.indexOf(lastNode) : currentFocusableIndex;
|
|
3793
|
+
var tabbableNodes = correctedNodes.filter(function (node) {
|
|
3794
|
+
return node.tabIndex >= 0;
|
|
3795
|
+
});
|
|
3796
|
+
var currentTabbableIndex = activeElement !== undefined ? tabbableNodes.indexOf(activeElement) : -1;
|
|
3797
|
+
var previousTabbableIndex = lastNode ? tabbableNodes.indexOf(lastNode) : currentTabbableIndex;
|
|
3798
|
+
var focusIndexDiff = currentTabbableIndex >= 0 && previousTabbableIndex >= 0 ?
|
|
3799
|
+
// old/new are tabbables, measure distance in tabbable space
|
|
3800
|
+
previousTabbableIndex - currentTabbableIndex :
|
|
3801
|
+
// or else measure in focusable space
|
|
3802
|
+
previousFocusableIndex - currentFocusableIndex;
|
|
3824
3803
|
// old focus
|
|
3825
3804
|
if (!indexDiff && lastNodeInside >= 0) {
|
|
3826
3805
|
return lastNodeInside;
|
|
@@ -3843,7 +3822,7 @@ var newFocus = function newFocus(innerNodes, innerTabbables, outerNodes, activeE
|
|
|
3843
3822
|
return returnFirstNode;
|
|
3844
3823
|
}
|
|
3845
3824
|
// jump out, but not on the guard
|
|
3846
|
-
if (indexDiff && Math.abs(
|
|
3825
|
+
if (indexDiff && Math.abs(focusIndexDiff) > 1) {
|
|
3847
3826
|
return lastNodeInside;
|
|
3848
3827
|
}
|
|
3849
3828
|
// focus above lock
|
|
@@ -4399,9 +4378,8 @@ var activateTrap = function activateTrap() {
|
|
|
4399
4378
|
focusOptions = _lastActiveTrap.focusOptions,
|
|
4400
4379
|
noFocusGuards = _lastActiveTrap.noFocusGuards;
|
|
4401
4380
|
var workingNode = observed || lastPortaledElement && lastPortaledElement.portaledElement;
|
|
4402
|
-
if (focusOnBody() && lastActiveFocus) {
|
|
4381
|
+
if (focusOnBody() && lastActiveFocus && lastActiveFocus !== document.body) {
|
|
4403
4382
|
if (!document.body.contains(lastActiveFocus) || isNotFocusable(lastActiveFocus)) {
|
|
4404
|
-
lastActiveFocus = null;
|
|
4405
4383
|
var newTarget = tryRestoreFocus();
|
|
4406
4384
|
if (newTarget) {
|
|
4407
4385
|
newTarget.focus();
|
|
@@ -4437,9 +4415,11 @@ var activateTrap = function activateTrap() {
|
|
|
4437
4415
|
lastPortaledElement = {};
|
|
4438
4416
|
}
|
|
4439
4417
|
}
|
|
4440
|
-
focusWasOutsideWindow = false;
|
|
4441
4418
|
lastActiveFocus = document && document.activeElement;
|
|
4442
|
-
|
|
4419
|
+
if (lastActiveFocus !== document.body) {
|
|
4420
|
+
tryRestoreFocus = captureFocusRestore(lastActiveFocus);
|
|
4421
|
+
}
|
|
4422
|
+
focusWasOutsideWindow = false;
|
|
4443
4423
|
}
|
|
4444
4424
|
}
|
|
4445
4425
|
if (document && activeElement !== document.activeElement && document.querySelector('[data-focus-auto-guard]')) {
|
|
@@ -4458,7 +4438,7 @@ var activateTrap = function activateTrap() {
|
|
|
4458
4438
|
var node = _ref4.node;
|
|
4459
4439
|
return node.removeAttribute('tabIndex');
|
|
4460
4440
|
});
|
|
4461
|
-
autoGuard(focusedIndex, allNodes.length,
|
|
4441
|
+
autoGuard(focusedIndex, allNodes.length, 1, allNodes);
|
|
4462
4442
|
autoGuard(focusedIndex, -1, -1, allNodes);
|
|
4463
4443
|
}
|
|
4464
4444
|
}
|
|
@@ -4865,9 +4845,9 @@ var handleScroll = function handleScroll(axis, endTarget, event, sourceDelta, no
|
|
|
4865
4845
|
// self content
|
|
4866
4846
|
targetInLock && (endTarget.contains(target) || endTarget === target));
|
|
4867
4847
|
// handle epsilon around 0 (non standard zoom levels)
|
|
4868
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 ||
|
|
4848
|
+
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
4869
4849
|
shouldCancelScroll = true;
|
|
4870
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 ||
|
|
4850
|
+
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
4871
4851
|
shouldCancelScroll = true;
|
|
4872
4852
|
}
|
|
4873
4853
|
return shouldCancelScroll;
|
|
@@ -4952,7 +4932,7 @@ function RemoveScrollSideCar(props) {
|
|
|
4952
4932
|
return true;
|
|
4953
4933
|
}
|
|
4954
4934
|
var cancelingAxis = activeAxis.current || currentAxis;
|
|
4955
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY
|
|
4935
|
+
return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY);
|
|
4956
4936
|
}, []);
|
|
4957
4937
|
var shouldPrevent = React.useCallback(function (_event) {
|
|
4958
4938
|
var event = _event;
|
|
@@ -7908,7 +7888,7 @@ function requireReactInputMask_production_min() {
|
|
|
7908
7888
|
function setInputSelection(e, t, n) {
|
|
7909
7889
|
if ("selectionStart" in e && "selectionEnd" in e) e.selectionStart = t, e.selectionEnd = n;else {
|
|
7910
7890
|
var a = e.createTextRange();
|
|
7911
|
-
a.collapse(
|
|
7891
|
+
a.collapse(true), a.moveStart("character", t), a.moveEnd("character", n - t), a.select();
|
|
7912
7892
|
}
|
|
7913
7893
|
}
|
|
7914
7894
|
function getInputSelection(e) {
|
|
@@ -7943,9 +7923,9 @@ function requireReactInputMask_production_min() {
|
|
|
7943
7923
|
lastEditablePosition: null,
|
|
7944
7924
|
permanents: []
|
|
7945
7925
|
};
|
|
7946
|
-
var s =
|
|
7926
|
+
var s = false;
|
|
7947
7927
|
return e.split("").forEach(function (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,
|
|
7928
|
+
s = !s && "\\" === e || (s || !n[e] ? (o.push(a.length), a.length === o.length - 1 && (i += e)) : r = a.length + 1, a += e, false);
|
|
7949
7929
|
}), {
|
|
7950
7930
|
maskChar: t,
|
|
7951
7931
|
formatChars: n,
|
|
@@ -7961,7 +7941,7 @@ function requireReactInputMask_production_min() {
|
|
|
7961
7941
|
function isAllowedCharacter(e, t, n) {
|
|
7962
7942
|
var a = e.mask,
|
|
7963
7943
|
i = e.formatChars;
|
|
7964
|
-
if (!n) return
|
|
7944
|
+
if (!n) return false;
|
|
7965
7945
|
if (isPermanentCharacter(e, t)) return a[t] === n;
|
|
7966
7946
|
var r = i[a[t]];
|
|
7967
7947
|
return new RegExp(r).test(n);
|
|
@@ -8022,8 +8002,8 @@ function requireReactInputMask_production_min() {
|
|
|
8022
8002
|
h = isFilled(r, o);
|
|
8023
8003
|
return !u && s > o.length && (o += l.slice(o.length, s)), t.every(function (e) {
|
|
8024
8004
|
for (; i = e, isPermanentCharacter(r, a = s) && i !== l[a];) {
|
|
8025
|
-
if (s >= o.length && (o += l[s]), t = e, n = s, u && isPermanentCharacter(r, n) && t === u) return
|
|
8026
|
-
if (++s >= l.length) return
|
|
8005
|
+
if (s >= o.length && (o += l[s]), t = e, n = s, u && isPermanentCharacter(r, n) && t === u) return true;
|
|
8006
|
+
if (++s >= l.length) return false;
|
|
8027
8007
|
}
|
|
8028
8008
|
var t, n, a, i;
|
|
8029
8009
|
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);
|
|
@@ -8035,7 +8015,7 @@ function requireReactInputMask_production_min() {
|
|
|
8035
8015
|
n = t.split(""),
|
|
8036
8016
|
s = i;
|
|
8037
8017
|
return n.every(function (e) {
|
|
8038
|
-
for (; n = e, isPermanentCharacter(a, t = i) && n !== r[t];) if (++i >= r.length) return
|
|
8018
|
+
for (; n = e, isPermanentCharacter(a, t = i) && n !== r[t];) if (++i >= r.length) return false;
|
|
8039
8019
|
var t, n;
|
|
8040
8020
|
return (isAllowedCharacter(a, i, e) || e === o) && i++, i < r.length;
|
|
8041
8021
|
}), i - s;
|
|
@@ -8099,7 +8079,7 @@ function requireReactInputMask_production_min() {
|
|
|
8099
8079
|
var InputElement = function (c) {
|
|
8100
8080
|
function e(e) {
|
|
8101
8081
|
var f = c.call(this, e) || this;
|
|
8102
|
-
f.focused =
|
|
8082
|
+
f.focused = false, f.mounted = false, f.previousSelection = null, f.selectionDeferId = null, f.saveSelectionLoopDeferId = null, f.saveSelectionLoop = function () {
|
|
8103
8083
|
f.previousSelection = f.getSelection(), f.saveSelectionLoopDeferId = defer(f.saveSelectionLoop);
|
|
8104
8084
|
}, f.runSaveSelectionLoop = function () {
|
|
8105
8085
|
null === f.saveSelectionLoopDeferId && f.saveSelectionLoop();
|
|
@@ -8191,14 +8171,14 @@ function requireReactInputMask_production_min() {
|
|
|
8191
8171
|
c = h.value, u = h.selection;
|
|
8192
8172
|
}
|
|
8193
8173
|
f.setInputValue(c), isFunction(f.props.onChange) && f.props.onChange(e), f.isWindowsPhoneBrowser ? f.setSelection(u.start, u.end, {
|
|
8194
|
-
deferred:
|
|
8174
|
+
deferred: true
|
|
8195
8175
|
}) : f.setSelection(u.start, u.end);
|
|
8196
8176
|
}, f.onFocus = function (e) {
|
|
8197
8177
|
var t = f.props.beforeMaskedValueChange,
|
|
8198
8178
|
n = f.maskOptions,
|
|
8199
8179
|
a = n.mask,
|
|
8200
8180
|
i = n.prefix;
|
|
8201
|
-
if (f.focused =
|
|
8181
|
+
if (f.focused = true, f.mounted = true, a) {
|
|
8202
8182
|
if (f.value) getFilledLength(f.maskOptions, f.value) < f.maskOptions.mask.length && f.setCursorToEnd();else {
|
|
8203
8183
|
var r = formatValue(f.maskOptions, i),
|
|
8204
8184
|
o = formatValue(f.maskOptions, r),
|
|
@@ -8227,7 +8207,7 @@ function requireReactInputMask_production_min() {
|
|
|
8227
8207
|
}, f.onBlur = function (e) {
|
|
8228
8208
|
var t = f.props.beforeMaskedValueChange,
|
|
8229
8209
|
n = f.maskOptions.mask;
|
|
8230
|
-
if (f.stopSaveSelectionLoop(), f.focused =
|
|
8210
|
+
if (f.stopSaveSelectionLoop(), f.focused = false, n && !f.props.alwaysShowMask && isEmpty(f.maskOptions, f.value)) {
|
|
8231
8211
|
var a = "";
|
|
8232
8212
|
if (isFunction(t)) a = t({
|
|
8233
8213
|
value: a,
|
|
@@ -8287,7 +8267,7 @@ function requireReactInputMask_production_min() {
|
|
|
8287
8267
|
_inheritsLoose(e, c);
|
|
8288
8268
|
var t = e.prototype;
|
|
8289
8269
|
return t.componentDidMount = function () {
|
|
8290
|
-
this.mounted =
|
|
8270
|
+
this.mounted = true, this.getInputDOMNode() && (this.isWindowsPhoneBrowser = isWindowsPhoneBrowser(), this.maskOptions.mask && this.getInputValue() !== this.value && this.setInputValue(this.value));
|
|
8291
8271
|
}, t.componentDidUpdate = function () {
|
|
8292
8272
|
var e = this.previousSelection,
|
|
8293
8273
|
t = this.props,
|
|
@@ -8326,25 +8306,25 @@ function requireReactInputMask_production_min() {
|
|
|
8326
8306
|
this.value = c;
|
|
8327
8307
|
var g = this.getInputValue() !== this.value;
|
|
8328
8308
|
g ? (this.setInputValue(this.value), this.forceUpdate()) : f && this.forceUpdate();
|
|
8329
|
-
var v =
|
|
8309
|
+
var v = false;
|
|
8330
8310
|
null != d.start && null != d.end && (v = !e || e.start !== d.start || e.end !== d.end), (v || g) && this.setSelection(d.start, d.end);
|
|
8331
8311
|
} else s.mask && (this.stopSaveSelectionLoop(), this.forceUpdate());
|
|
8332
8312
|
}, t.componentWillUnmount = function () {
|
|
8333
|
-
this.mounted =
|
|
8313
|
+
this.mounted = false, null !== this.selectionDeferId && cancelDefer(this.selectionDeferId), this.stopSaveSelectionLoop();
|
|
8334
8314
|
}, t.render = function () {
|
|
8335
8315
|
var t,
|
|
8336
8316
|
e = this.props,
|
|
8337
8317
|
n = (e.mask, e.alwaysShowMask, e.maskChar, e.formatChars, e.inputRef, e.beforeMaskedValueChange, e.children),
|
|
8338
8318
|
a = _objectWithoutPropertiesLoose(e, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
8339
8319
|
if (n) {
|
|
8340
|
-
isFunction(n) || invariant_1(
|
|
8320
|
+
isFunction(n) || invariant_1(false);
|
|
8341
8321
|
var i = ["onChange", "onPaste", "onMouseDown", "onFocus", "onBlur", "value", "disabled", "readOnly"],
|
|
8342
8322
|
r = _extends({}, a);
|
|
8343
8323
|
i.forEach(function (e) {
|
|
8344
8324
|
return delete r[e];
|
|
8345
8325
|
}), t = n(r), i.filter(function (e) {
|
|
8346
8326
|
return null != t.props[e] && t.props[e] !== a[e];
|
|
8347
|
-
}).length && invariant_1(
|
|
8327
|
+
}).length && invariant_1(false);
|
|
8348
8328
|
} else t = React.createElement("input", _extends({
|
|
8349
8329
|
ref: this.handleRef
|
|
8350
8330
|
}, a));
|
|
@@ -10421,7 +10401,7 @@ var t = function t(_t) {
|
|
|
10421
10401
|
return !!e && (e.clientHeight < t.scrollHeight || e.clientWidth < t.scrollWidth);
|
|
10422
10402
|
}(t);
|
|
10423
10403
|
}
|
|
10424
|
-
return
|
|
10404
|
+
return false;
|
|
10425
10405
|
},
|
|
10426
10406
|
o$1 = function o(t, e, n, _o2, l, r, i, s) {
|
|
10427
10407
|
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;
|
|
@@ -10483,41 +10463,41 @@ var t = function t(_t) {
|
|
|
10483
10463
|
for (var _t2 = 0; _t2 < w.length; _t2++) {
|
|
10484
10464
|
var _e2 = w[_t2],
|
|
10485
10465
|
_e$getBoundingClientR2 = _e2.getBoundingClientRect(),
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
if ("if-needed" === c && x >= 0 && R >= 0 && I <= H && C <= b && x >=
|
|
10493
|
-
var
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
var
|
|
10499
|
-
|
|
10500
|
-
var
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
if (m === _e2)
|
|
10505
|
-
|
|
10466
|
+
_l = _e$getBoundingClientR2.height,
|
|
10467
|
+
_r = _e$getBoundingClientR2.width,
|
|
10468
|
+
_i = _e$getBoundingClientR2.top,
|
|
10469
|
+
_s = _e$getBoundingClientR2.right,
|
|
10470
|
+
_d = _e$getBoundingClientR2.bottom,
|
|
10471
|
+
_h = _e$getBoundingClientR2.left;
|
|
10472
|
+
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;
|
|
10473
|
+
var _a = getComputedStyle(_e2),
|
|
10474
|
+
_g = parseInt(_a.borderLeftWidth, 10),
|
|
10475
|
+
_p = parseInt(_a.borderTopWidth, 10),
|
|
10476
|
+
_W = parseInt(_a.borderRightWidth, 10),
|
|
10477
|
+
_T = parseInt(_a.borderBottomWidth, 10);
|
|
10478
|
+
var _B = 0,
|
|
10479
|
+
_F = 0;
|
|
10480
|
+
var _V = "offsetWidth" in _e2 ? _e2.offsetWidth - _e2.clientWidth - _g - _W : 0,
|
|
10481
|
+
S = "offsetHeight" in _e2 ? _e2.offsetHeight - _e2.clientHeight - _p - _T : 0,
|
|
10482
|
+
X = "offsetWidth" in _e2 ? 0 === _e2.offsetWidth ? 0 : _r / _e2.offsetWidth : 0,
|
|
10483
|
+
Y = "offsetHeight" in _e2 ? 0 === _e2.offsetHeight ? 0 : _l / _e2.offsetHeight : 0;
|
|
10484
|
+
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 {
|
|
10485
|
+
_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);
|
|
10506
10486
|
var _t3 = _e2.scrollLeft,
|
|
10507
|
-
|
|
10508
|
-
|
|
10487
|
+
_n2 = _e2.scrollTop;
|
|
10488
|
+
_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;
|
|
10509
10489
|
}
|
|
10510
10490
|
L.push({
|
|
10511
10491
|
el: _e2,
|
|
10512
|
-
top:
|
|
10513
|
-
left:
|
|
10492
|
+
top: _B,
|
|
10493
|
+
left: _F
|
|
10514
10494
|
});
|
|
10515
10495
|
}
|
|
10516
10496
|
return L;
|
|
10517
10497
|
};
|
|
10518
10498
|
|
|
10519
10499
|
var o = function o(t) {
|
|
10520
|
-
return
|
|
10500
|
+
return false === t ? {
|
|
10521
10501
|
block: "end",
|
|
10522
10502
|
inline: "nearest"
|
|
10523
10503
|
} : function (t) {
|
|
@@ -10531,10 +10511,10 @@ function e(e, r$1) {
|
|
|
10531
10511
|
if (!e.isConnected || !function (t) {
|
|
10532
10512
|
var o = t;
|
|
10533
10513
|
for (; o && o.parentNode;) {
|
|
10534
|
-
if (o.parentNode === document) return
|
|
10514
|
+
if (o.parentNode === document) return true;
|
|
10535
10515
|
o = o.parentNode instanceof ShadowRoot ? o.parentNode.host : o.parentNode;
|
|
10536
10516
|
}
|
|
10537
|
-
return
|
|
10517
|
+
return false;
|
|
10538
10518
|
}(e)) return;
|
|
10539
10519
|
var n = function (t) {
|
|
10540
10520
|
var o = window.getComputedStyle(t);
|