@janiscommerce/ui-web 0.12.0 → 0.14.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/CHANGELOG.md +16 -0
- package/dist/index.umd.js +51 -76
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.14.0] - 2024-04-22
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- New colors in theme
|
|
15
|
+
|
|
16
|
+
## [0.13.0] - 2024-03-09
|
|
17
|
+
|
|
18
|
+
### Removed
|
|
19
|
+
|
|
20
|
+
- util to get color in InitialAvatar
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- MainColor prop, now accept hex color
|
|
25
|
+
|
|
10
26
|
## [0.12.0] - 2024-03-08
|
|
11
27
|
|
|
12
28
|
### Added
|
package/dist/index.umd.js
CHANGED
|
@@ -552,9 +552,9 @@
|
|
|
552
552
|
blackHover: '#585858',
|
|
553
553
|
blackPressed: '#16232D',
|
|
554
554
|
blue: '#2979FF',
|
|
555
|
+
blueDisabled: '#93BBFF',
|
|
555
556
|
blueHover: '#5393FF',
|
|
556
557
|
bluePressed: '#1759FF',
|
|
557
|
-
blueDisabled: '#93BBFF',
|
|
558
558
|
darkGrey: '#939598',
|
|
559
559
|
darkGreyHover: '#A8AAAC',
|
|
560
560
|
darkGreyPressed: '#747679',
|
|
@@ -579,14 +579,18 @@
|
|
|
579
579
|
red: '#F13B70',
|
|
580
580
|
redHover: '#F3628C',
|
|
581
581
|
redPressed: '#EB2450',
|
|
582
|
+
skyBlue: '#02BFFB',
|
|
583
|
+
skyBluePressed: '#00A6FA',
|
|
582
584
|
statusRed: '#FF4343',
|
|
583
585
|
statusRedHover: '#FF6868',
|
|
584
586
|
statusRedPressed: '#FF2A2A',
|
|
587
|
+
transparentWhite: 'rgba(256, 256, 256, 0.5)',
|
|
588
|
+
violet: '#BB98F1',
|
|
589
|
+
violetPressed: '#8848E7',
|
|
585
590
|
white: '#FFF',
|
|
586
591
|
yellow: '#FFCE17',
|
|
587
592
|
yellowHover: '#FFD745',
|
|
588
|
-
yellowPressed: '#FFBA0C'
|
|
589
|
-
transparentWhite: 'rgba(256, 256, 256, 0.5)'
|
|
593
|
+
yellowPressed: '#FFBA0C'
|
|
590
594
|
};
|
|
591
595
|
|
|
592
596
|
/**
|
|
@@ -672,7 +676,8 @@
|
|
|
672
676
|
|
|
673
677
|
Skeleton.defaultProps = {
|
|
674
678
|
circle: false,
|
|
675
|
-
count: 1
|
|
679
|
+
count: 1,
|
|
680
|
+
width: '100%'
|
|
676
681
|
};
|
|
677
682
|
|
|
678
683
|
var styled$d = {
|
|
@@ -694,76 +699,6 @@
|
|
|
694
699
|
})
|
|
695
700
|
};
|
|
696
701
|
|
|
697
|
-
/**
|
|
698
|
-
* Checks if the name provided is single or compound and returns either the first two letters,
|
|
699
|
-
* or the initials of the two first names.
|
|
700
|
-
* @param {string} nameString
|
|
701
|
-
*/
|
|
702
|
-
|
|
703
|
-
var parseName = function parseName(nameString) {
|
|
704
|
-
var names = nameString.split(' ');
|
|
705
|
-
return names.length > 1 ? names.reduce(function (accum, name, idx) {
|
|
706
|
-
if (idx <= 1) return [].concat(_toConsumableArray(accum), [name.substring(0, 1)]);
|
|
707
|
-
return accum;
|
|
708
|
-
}, []) : nameString.substring(0, 2).split('');
|
|
709
|
-
};
|
|
710
|
-
/**
|
|
711
|
-
* If both firstname and lastname are provided, returns an array with each of their initials.
|
|
712
|
-
* If only a firstname or a lastname is provided, parses them to return either
|
|
713
|
-
* their initials (if it's a compound name) or first two letters.
|
|
714
|
-
* @param {string} firstname
|
|
715
|
-
* @param {string} lastname
|
|
716
|
-
*/
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
var getNamesToParse = function getNamesToParse(firstname, lastname) {
|
|
720
|
-
return !!firstname || !!lastname ? parseName(firstname || lastname) : null;
|
|
721
|
-
};
|
|
722
|
-
/**
|
|
723
|
-
* Assigns a color to the names or initials array provided.
|
|
724
|
-
* @param {array} name - Array containing the firstname and lastname strings
|
|
725
|
-
*/
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
var getUserColor = function getUserColor(name) {
|
|
729
|
-
var excludedColors = ['lightGreyHover', 'lightGrey', 'white', 'transparentWhite'];
|
|
730
|
-
var availableColors = Object.keys(viewsPalette).filter(function (color) {
|
|
731
|
-
return !excludedColors.includes(color);
|
|
732
|
-
});
|
|
733
|
-
var availableIndexes = availableColors.length;
|
|
734
|
-
|
|
735
|
-
var charCodes = _toConsumableArray(name).map(function (letter) {
|
|
736
|
-
return letter.charCodeAt(0);
|
|
737
|
-
});
|
|
738
|
-
|
|
739
|
-
var charCodesLength = charCodes.length;
|
|
740
|
-
var rotationFactor = charCodesLength % (availableIndexes - 1) + 1;
|
|
741
|
-
var sumOfCharacterCodes = charCodes.reduce(function (current, next) {
|
|
742
|
-
return current + next;
|
|
743
|
-
}) % availableIndexes;
|
|
744
|
-
var random = charCodes[0] % availableIndexes;
|
|
745
|
-
|
|
746
|
-
for (var i = 0; i < charCodesLength; i++) {
|
|
747
|
-
random = (rotationFactor * random + sumOfCharacterCodes) % availableIndexes;
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
var userColor = availableColors[random];
|
|
751
|
-
return viewsPalette[userColor];
|
|
752
|
-
};
|
|
753
|
-
/**
|
|
754
|
-
* If firstname or lastname (or both) are defined, will return an object with their initials and assigned color.
|
|
755
|
-
* If not, returns null.
|
|
756
|
-
* @param {string} firstname
|
|
757
|
-
* @param {string} lastname
|
|
758
|
-
*/
|
|
759
|
-
|
|
760
|
-
var getInitialsTheme = function getInitialsTheme() {
|
|
761
|
-
var firstname = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
762
|
-
var lastname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
763
|
-
if (!!firstname && !!lastname) return [firstname.substring(0, 1), lastname.substring(0, 1)];
|
|
764
|
-
return getNamesToParse(firstname, lastname);
|
|
765
|
-
};
|
|
766
|
-
|
|
767
702
|
var timingFunctions = {
|
|
768
703
|
standard: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
|
769
704
|
decelerate: 'cubic-bezier(0.0, 0.0, 0.2, 1)',
|
|
@@ -812,12 +747,51 @@
|
|
|
812
747
|
imageSize = _ref.imageSize,
|
|
813
748
|
rounded = _ref.rounded;
|
|
814
749
|
return /*#__PURE__*/React__default["default"].createElement(styled$c.Initials, {
|
|
815
|
-
color: mainColor
|
|
750
|
+
color: mainColor,
|
|
816
751
|
size: imageSize,
|
|
817
752
|
rounded: rounded
|
|
818
753
|
}, initials);
|
|
819
754
|
};
|
|
820
755
|
|
|
756
|
+
/**
|
|
757
|
+
* Checks if the name provided is single or compound and returns either the first two letters,
|
|
758
|
+
* or the initials of the two first names.
|
|
759
|
+
* @param {string} nameString
|
|
760
|
+
*/
|
|
761
|
+
var parseName = function parseName(nameString) {
|
|
762
|
+
var names = nameString.split(' ');
|
|
763
|
+
return names.length > 1 ? names.reduce(function (accum, name, idx) {
|
|
764
|
+
if (idx <= 1) return [].concat(_toConsumableArray(accum), [name.substring(0, 1)]);
|
|
765
|
+
return accum;
|
|
766
|
+
}, []) : nameString.substring(0, 2).split('');
|
|
767
|
+
};
|
|
768
|
+
/**
|
|
769
|
+
* If both firstname and lastname are provided, returns an array with each of their initials.
|
|
770
|
+
* If only a firstname or a lastname is provided, parses them to return either
|
|
771
|
+
* their initials (if it's a compound name) or first two letters.
|
|
772
|
+
* @param {string} firstname
|
|
773
|
+
* @param {string} lastname
|
|
774
|
+
*/
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
var getNamesToParse = function getNamesToParse(firstname, lastname) {
|
|
778
|
+
return !!firstname || !!lastname ? parseName(firstname || lastname) : null;
|
|
779
|
+
};
|
|
780
|
+
/**
|
|
781
|
+
* If firstname or lastname (or both) are defined, will return an object with their initials and assigned color.
|
|
782
|
+
* If not, returns null.
|
|
783
|
+
* @param {string} firstname
|
|
784
|
+
* @param {string} lastname
|
|
785
|
+
*/
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
var getInitialsTheme = function getInitialsTheme() {
|
|
789
|
+
var firstname = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
790
|
+
var lastname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
791
|
+
if (!!firstname && !!lastname) return [firstname.substring(0, 1), lastname.substring(0, 1)];
|
|
792
|
+
return getNamesToParse(firstname, lastname);
|
|
793
|
+
};
|
|
794
|
+
|
|
821
795
|
var Avatar = function Avatar(_ref) {
|
|
822
796
|
var firstname = _ref.firstname,
|
|
823
797
|
lastname = _ref.lastname,
|
|
@@ -882,7 +856,8 @@
|
|
|
882
856
|
lastname: '',
|
|
883
857
|
size: 'small',
|
|
884
858
|
url: '',
|
|
885
|
-
rounded: true
|
|
859
|
+
rounded: true,
|
|
860
|
+
mainColor: viewsPalette.grey
|
|
886
861
|
};
|
|
887
862
|
|
|
888
863
|
var API_key = {
|