@pedidopago/ui 1.3.13 → 1.3.14
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/components/Button/styles.js +1 -1
- package/dist/components/ColorPicker/utils/parsers.js +18 -18
- package/dist/components/Dropzone/utils/accepts.js +8 -8
- package/dist/components/Icon/scripts/build.js +2 -2
- package/dist/components/Icon/scripts/extractor.js +5 -5
- package/dist/components/Icon/scripts/writers.js +9 -9
- package/dist/components/Rating/components/GradientIcon/scripts/build.js +4 -4
- package/dist/components/Rating/components/GradientIcon/scripts/extractor.js +5 -5
- package/dist/components/Rating/components/GradientIcon/scripts/writers.js +9 -9
- package/dist/components/Skeleton/styles.d.ts.map +1 -1
- package/dist/components/Skeleton/styles.js +3 -3
- package/dist/shared/hooks/useBreakpoint.js +5 -5
- package/dist/utils/GenerateKey.js +6 -6
- package/dist/utils/brightnessColorChange.js +6 -6
- package/dist/utils/colorCheck.js +24 -24
- package/dist/utils/getColorValue.js +8 -8
- package/dist/utils/invertColor.js +5 -5
- package/package.json +1 -1
|
@@ -58,7 +58,7 @@ var ButtonContainer = _styled.default.button(_templateObject || (_templateObject
|
|
|
58
58
|
|
|
59
59
|
switch (variant) {
|
|
60
60
|
case 'solid':
|
|
61
|
-
return (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &:is(&:hover, &:focus):not(:disabled) {\n box-shadow: inset 0 0 40px 40px rgba(0, 0, 0, 0.
|
|
61
|
+
return (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &:is(&:hover, &:focus):not(:disabled) {\n box-shadow: inset 0 0 40px 40px rgba(0, 0, 0, 0.08);\n }\n "])));
|
|
62
62
|
|
|
63
63
|
case 'outline':
|
|
64
64
|
return (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-color: transparent;\n color: ", ";\n border: 3px ", " solid;\n box-shadow: none;\n &:is(&:hover, &:focus):not(:disabled) {\n filter: var(--button-brightness);\n }\n "])), textColor || bgColor || theme.colors.primary.default, bgColor || textColor || theme.colors.primary.default);
|
|
@@ -15,10 +15,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* This function converts a string color to a hsva color object
|
|
20
|
-
* @param color : Color to convert to hsva;
|
|
21
|
-
* @returns : hsva color object
|
|
18
|
+
/**
|
|
19
|
+
* This function converts a string color to a hsva color object
|
|
20
|
+
* @param color : Color to convert to hsva;
|
|
21
|
+
* @returns : hsva color object
|
|
22
22
|
*/
|
|
23
23
|
var colorToHsva = function colorToHsva(color) {
|
|
24
24
|
// Check if the color is a hex string and convert it to rgba and then to hsva
|
|
@@ -53,10 +53,10 @@ var colorToHsva = function colorToHsva(color) {
|
|
|
53
53
|
a: 1
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
|
-
/**
|
|
57
|
-
* This function gets the color mode from the color string
|
|
58
|
-
* @param color : Color to check your output mode
|
|
59
|
-
* @returns : Color mode
|
|
56
|
+
/**
|
|
57
|
+
* This function gets the color mode from the color string
|
|
58
|
+
* @param color : Color to check your output mode
|
|
59
|
+
* @returns : Color mode
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
62
|
|
|
@@ -85,11 +85,11 @@ var colorMode = function colorMode(color) {
|
|
|
85
85
|
|
|
86
86
|
return 'unknown';
|
|
87
87
|
};
|
|
88
|
-
/**
|
|
89
|
-
* This function converts a hsva color object to a string color
|
|
90
|
-
* @param hsva : hsva color object
|
|
91
|
-
* @param colorMode : Color output mode
|
|
92
|
-
* @returns : Color string
|
|
88
|
+
/**
|
|
89
|
+
* This function converts a hsva color object to a string color
|
|
90
|
+
* @param hsva : hsva color object
|
|
91
|
+
* @param colorMode : Color output mode
|
|
92
|
+
* @returns : Color string
|
|
93
93
|
*/
|
|
94
94
|
|
|
95
95
|
|
|
@@ -116,11 +116,11 @@ var colorFromHsva = function colorFromHsva(hsva, colorMode) {
|
|
|
116
116
|
return 'unknown';
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
-
/**
|
|
120
|
-
* This function converts a color string to output color mode
|
|
121
|
-
* @param color : Color string;
|
|
122
|
-
* @param outputMode : Color output mode;
|
|
123
|
-
* @returns : Color string
|
|
119
|
+
/**
|
|
120
|
+
* This function converts a color string to output color mode
|
|
121
|
+
* @param color : Color string;
|
|
122
|
+
* @param outputMode : Color output mode;
|
|
123
|
+
* @returns : Color string
|
|
124
124
|
*/
|
|
125
125
|
|
|
126
126
|
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.accepts = void 0;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Verify if the given file can be accepted by the dropzone.
|
|
10
|
-
*
|
|
11
|
-
* Code abstration of: https://github.com/react-dropzone/attr-accept
|
|
12
|
-
*
|
|
13
|
-
* @param file The file to verify
|
|
14
|
-
* @param acceptedFiles The accepted files
|
|
15
|
-
* @returns true if the file can be accepted, false otherwise
|
|
8
|
+
/**
|
|
9
|
+
* Verify if the given file can be accepted by the dropzone.
|
|
10
|
+
*
|
|
11
|
+
* Code abstration of: https://github.com/react-dropzone/attr-accept
|
|
12
|
+
*
|
|
13
|
+
* @param file The file to verify
|
|
14
|
+
* @param acceptedFiles The accepted files
|
|
15
|
+
* @returns true if the file can be accepted, false otherwise
|
|
16
16
|
*/
|
|
17
17
|
var accepts = function accepts(file, acceptedFormats) {
|
|
18
18
|
if (file && acceptedFormats) {
|
|
@@ -11,11 +11,11 @@ var _fs = require("fs");
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Extractor is a function that extracts the svg content from the icon file.
|
|
16
|
-
* @param files - The directory with the files to extract.
|
|
17
|
-
* @param currentPath - The current path of the file
|
|
18
|
-
* @returns Array of objects with the name and the content of the icon svg.
|
|
14
|
+
/**
|
|
15
|
+
* Extractor is a function that extracts the svg content from the icon file.
|
|
16
|
+
* @param files - The directory with the files to extract.
|
|
17
|
+
* @param currentPath - The current path of the file
|
|
18
|
+
* @returns Array of objects with the name and the content of the icon svg.
|
|
19
19
|
*/
|
|
20
20
|
var extractor = function extractor(files, currentPath) {
|
|
21
21
|
return files.map(function (file) {
|
|
@@ -11,10 +11,10 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* This function generates the types file for the Icon component
|
|
16
|
-
* @param iconsList - The list of icons
|
|
17
|
-
* @param overwrite - If true, the file will be overwritten
|
|
14
|
+
/**
|
|
15
|
+
* This function generates the types file for the Icon component
|
|
16
|
+
* @param iconsList - The list of icons
|
|
17
|
+
* @param overwrite - If true, the file will be overwritten
|
|
18
18
|
*/
|
|
19
19
|
var writeTypesFile = function writeTypesFile(iconsList) {
|
|
20
20
|
var overwrite = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -27,11 +27,11 @@ var writeTypesFile = function writeTypesFile(iconsList) {
|
|
|
27
27
|
}).join(' | '), ";\n\n export type IIconComponentProps = {\n name: IconName;\n size?: number | string;\n color?: GlobalColorsProps | (string & {});\n secondColor?: GlobalColorsProps | (string & {});\n }\n "));
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
/**
|
|
31
|
-
* This function generates the icons json file for the Icon component
|
|
32
|
-
* @param iconsList - The list of icons
|
|
33
|
-
* @param jsonFileName - The name of the json file
|
|
34
|
-
* @param overwrite - If true, the file will be overwritten
|
|
30
|
+
/**
|
|
31
|
+
* This function generates the icons json file for the Icon component
|
|
32
|
+
* @param iconsList - The list of icons
|
|
33
|
+
* @param jsonFileName - The name of the json file
|
|
34
|
+
* @param overwrite - If true, the file will be overwritten
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
|
|
@@ -35,10 +35,10 @@ var twirlTimer = function twirlTimer() {
|
|
|
35
35
|
x &= 3;
|
|
36
36
|
}, 250);
|
|
37
37
|
};
|
|
38
|
-
/**
|
|
39
|
-
* Builds the icons and types files.
|
|
40
|
-
* To run this script, you need to call this at the test file:
|
|
41
|
-
* `require('./scripts/build')` or `import build from './scripts/build'`
|
|
38
|
+
/**
|
|
39
|
+
* Builds the icons and types files.
|
|
40
|
+
* To run this script, you need to call this at the test file:
|
|
41
|
+
* `require('./scripts/build')` or `import build from './scripts/build'`
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
|
|
@@ -11,11 +11,11 @@ var _fs = require("fs");
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Extractor is a function that extracts the svg content from the icon file.
|
|
16
|
-
* @param files - The directory with the files to extract.
|
|
17
|
-
* @param currentPath - The current path of the file
|
|
18
|
-
* @returns Array of objects with the name and the content of the icon svg.
|
|
14
|
+
/**
|
|
15
|
+
* Extractor is a function that extracts the svg content from the icon file.
|
|
16
|
+
* @param files - The directory with the files to extract.
|
|
17
|
+
* @param currentPath - The current path of the file
|
|
18
|
+
* @returns Array of objects with the name and the content of the icon svg.
|
|
19
19
|
*/
|
|
20
20
|
var extractor = function extractor(files, currentPath) {
|
|
21
21
|
return files.map(function (file) {
|
|
@@ -11,10 +11,10 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* This function generates the types file for the Icon component
|
|
16
|
-
* @param iconsList - The list of icons
|
|
17
|
-
* @param overwrite - If true, the file will be overwritten
|
|
14
|
+
/**
|
|
15
|
+
* This function generates the types file for the Icon component
|
|
16
|
+
* @param iconsList - The list of icons
|
|
17
|
+
* @param overwrite - If true, the file will be overwritten
|
|
18
18
|
*/
|
|
19
19
|
var writeTypesFile = function writeTypesFile(iconsList) {
|
|
20
20
|
var overwrite = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -27,11 +27,11 @@ var writeTypesFile = function writeTypesFile(iconsList) {
|
|
|
27
27
|
}).join(' | '), ";\n\n export type IIconComponentProps = {\n name: IconName;\n size?: number | string;\n color?: GlobalColorsProps | (string & {});\n secondColor?: GlobalColorsProps | (string & {});\n }\n "));
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
/**
|
|
31
|
-
* This function generates the icons json file for the Icon component
|
|
32
|
-
* @param iconsList - The list of icons
|
|
33
|
-
* @param jsonFileName - The name of the json file
|
|
34
|
-
* @param overwrite - If true, the file will be overwritten
|
|
30
|
+
/**
|
|
31
|
+
* This function generates the icons json file for the Icon component
|
|
32
|
+
* @param iconsList - The list of icons
|
|
33
|
+
* @param jsonFileName - The name of the json file
|
|
34
|
+
* @param overwrite - If true, the file will be overwritten
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton/styles.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,eAAO,MAAM,eAAe;;;+
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton/styles.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,eAAO,MAAM,eAAe;;;+IAmG1B,CAAC"}
|
|
@@ -15,7 +15,7 @@ var _colorCheck = require("../../utils/colorCheck");
|
|
|
15
15
|
|
|
16
16
|
var _invertColor = require("../../utils/invertColor");
|
|
17
17
|
|
|
18
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
18
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
@@ -34,9 +34,9 @@ var SkeletonElement = _styled.default.div(function (props) {
|
|
|
34
34
|
wave: (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n transform-origin: 0px 55%;\n\n &::after {\n content: '';\n inset: 0px;\n position: absolute;\n animation: 1.6s linear 0.5s infinite normal none running move;\n transform: translateX(-100%);\n background: linear-gradient(\n 90deg,\n transparent,\n ", ",\n transparent\n );\n }\n\n @keyframes move {\n 0% {\n transform: translateX(-100%);\n }\n 40% {\n transform: translateX(100%);\n }\n 100% {\n transform: translateX(100%);\n }\n }\n "])), (0, _colorCheck.parseHexColorToRgba)(waveColor, waveColorOpacity)),
|
|
35
35
|
pulse: (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n animation: 1.6s linear 0.5s infinite normal none running pulse;\n\n @keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.4;\n }\n 100% {\n opacity: 1;\n }\n }\n "])))
|
|
36
36
|
};
|
|
37
|
-
var unloadedCss = (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: block;\n position: relative;\n user-select: none;\n pointer-events: none;\n cursor: default;\n background: padding-box ", ";\n border-radius: ", ";\n
|
|
37
|
+
var unloadedCss = (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: block;\n position: relative;\n user-select: none;\n pointer-events: none;\n cursor: default;\n background: padding-box ", ";\n border-radius: ", ";\n height: ", ";\n color: transparent;\n\n ", ";\n\n * {\n visibility: hidden;\n color: transparent;\n }\n "])), skeletonColor, borderRadiusByVariant[props.variant || 'text'], typeof props.height === 'number' ? props.height + 'px' : props.height || '', props.animation !== 'static' ? animationsCss[props.animation || 'wave'] : '');
|
|
38
38
|
var loadedCss = (0, _react.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: block;\n background: transparent;\n\n transition: all 300ms ease;\n "])));
|
|
39
|
-
return props.isLoaded ? loadedCss : unloadedCss;
|
|
39
|
+
return (0, _react.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: ", ";\n\n ", "\n "])), props.fullWidth ? '100%' : typeof props.width === 'number' ? props.width + 'px' : props.width || '', props.isLoaded ? loadedCss : unloadedCss);
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
exports.SkeletonElement = SkeletonElement;
|
|
@@ -21,11 +21,11 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
21
21
|
|
|
22
22
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Checks if the screen width matches the breakpoint in a certain direction everytime the screen resizes.
|
|
26
|
-
* @param breakpoint The target breakpoint to compare. Can use one of the specified breakpoints or a custom one passing a number.
|
|
27
|
-
* @param direction The direction to compare. "Down" will return true if the screen width is shorter than the breakpoint. "Up" will return true if it's larger.
|
|
28
|
-
* @returns If the screen width matches the breakpoint in a certain direction.
|
|
24
|
+
/**
|
|
25
|
+
* Checks if the screen width matches the breakpoint in a certain direction everytime the screen resizes.
|
|
26
|
+
* @param breakpoint The target breakpoint to compare. Can use one of the specified breakpoints or a custom one passing a number.
|
|
27
|
+
* @param direction The direction to compare. "Down" will return true if the screen width is shorter than the breakpoint. "Up" will return true if it's larger.
|
|
28
|
+
* @returns If the screen width matches the breakpoint in a certain direction.
|
|
29
29
|
*/
|
|
30
30
|
function useBreakpoint(breakpoint) {
|
|
31
31
|
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'down';
|
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.generateKey = generateKey;
|
|
7
7
|
exports.s4 = s4;
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Generates a random hexadecimal string with length 4.
|
|
11
|
-
* @returns hexadecimal string.
|
|
9
|
+
/**
|
|
10
|
+
* Generates a random hexadecimal string with length 4.
|
|
11
|
+
* @returns hexadecimal string.
|
|
12
12
|
*/
|
|
13
13
|
function s4() {
|
|
14
14
|
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Generates a unique key using Date and pseudo random numbers.
|
|
18
|
-
* @returns A unique key.
|
|
16
|
+
/**
|
|
17
|
+
* Generates a unique key using Date and pseudo random numbers.
|
|
18
|
+
* @returns A unique key.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
|
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.brightnessColorChange = brightnessColorChange;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Change the brightness of a color
|
|
10
|
-
* @param color : color to change;
|
|
11
|
-
* @param percent : percent of brightness;
|
|
12
|
-
* @returns : new color with changed brightness;
|
|
13
|
-
* @see https://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors
|
|
8
|
+
/**
|
|
9
|
+
* Change the brightness of a color
|
|
10
|
+
* @param color : color to change;
|
|
11
|
+
* @param percent : percent of brightness;
|
|
12
|
+
* @returns : new color with changed brightness;
|
|
13
|
+
* @see https://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors
|
|
14
14
|
*/
|
|
15
15
|
function brightnessColorChange(color, percent) {
|
|
16
16
|
var f = parseInt(color.slice(1), 16);
|
package/dist/utils/colorCheck.js
CHANGED
|
@@ -17,22 +17,22 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
17
17
|
|
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* Verifies if the provided color is a valid hex color.
|
|
22
|
-
* @param color : color value;
|
|
23
|
-
* @returns : true if color is valid, false otherwise;
|
|
24
|
-
* @see https://stackoverflow.com/questions/8027423/how-to-check-if-a-string-is-a-valid-hex-color-representation/8027444#8027444
|
|
20
|
+
/**
|
|
21
|
+
* Verifies if the provided color is a valid hex color.
|
|
22
|
+
* @param color : color value;
|
|
23
|
+
* @returns : true if color is valid, false otherwise;
|
|
24
|
+
* @see https://stackoverflow.com/questions/8027423/how-to-check-if-a-string-is-a-valid-hex-color-representation/8027444#8027444
|
|
25
25
|
*/
|
|
26
26
|
var isHexColor = function isHexColor(color) {
|
|
27
27
|
var hexColorWithSixLetters = /^#[0-9A-F]{6}$/i;
|
|
28
28
|
var hexColorWithThreeLetters = /^#([0-9A-F]{3}){1,2}$/i;
|
|
29
29
|
return hexColorWithSixLetters.test(color) || hexColorWithThreeLetters.test(color);
|
|
30
30
|
};
|
|
31
|
-
/**
|
|
32
|
-
* Verifies if the provided color is a valid rgb or hsl color.
|
|
33
|
-
* @param color : color value;
|
|
34
|
-
* @returns : true if color is valid, false otherwise;
|
|
35
|
-
* @see https://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion
|
|
31
|
+
/**
|
|
32
|
+
* Verifies if the provided color is a valid rgb or hsl color.
|
|
33
|
+
* @param color : color value;
|
|
34
|
+
* @returns : true if color is valid, false otherwise;
|
|
35
|
+
* @see https://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
|
|
@@ -42,11 +42,11 @@ var isRgbHslColor = function isRgbHslColor(color) {
|
|
|
42
42
|
var regexModel = /^(rgb|hsl)(a?)[(]\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*(?:,\s*([\d.]+)\s*)?[)]$/;
|
|
43
43
|
return regexModel.test(color);
|
|
44
44
|
};
|
|
45
|
-
/**
|
|
46
|
-
* Verifies if the provided color is a valid theme color and returns the theme color value.
|
|
47
|
-
* @param color : theme color tag value;
|
|
48
|
-
* @param themeColors : theme colors object;
|
|
49
|
-
* @returns : theme color value if color is valid, null otherwise;
|
|
45
|
+
/**
|
|
46
|
+
* Verifies if the provided color is a valid theme color and returns the theme color value.
|
|
47
|
+
* @param color : theme color tag value;
|
|
48
|
+
* @param themeColors : theme colors object;
|
|
49
|
+
* @returns : theme color value if color is valid, null otherwise;
|
|
50
50
|
*/
|
|
51
51
|
|
|
52
52
|
|
|
@@ -65,11 +65,11 @@ var stripThemeColors = function stripThemeColors(color, themeColors) {
|
|
|
65
65
|
|
|
66
66
|
return null;
|
|
67
67
|
};
|
|
68
|
-
/**
|
|
69
|
-
* Convert a hex color to rgba color.
|
|
70
|
-
* @param color : hex color value;
|
|
71
|
-
* @param opacity : opacity value;
|
|
72
|
-
* @returns : rgba color value;
|
|
68
|
+
/**
|
|
69
|
+
* Convert a hex color to rgba color.
|
|
70
|
+
* @param color : hex color value;
|
|
71
|
+
* @param opacity : opacity value;
|
|
72
|
+
* @returns : rgba color value;
|
|
73
73
|
*/
|
|
74
74
|
|
|
75
75
|
|
|
@@ -82,10 +82,10 @@ var parseHexColorToRgba = function parseHexColorToRgba(color, opacity) {
|
|
|
82
82
|
|
|
83
83
|
return 'rgba(0, 0, 0, 0)';
|
|
84
84
|
};
|
|
85
|
-
/**
|
|
86
|
-
* Convert a hsl array color to string
|
|
87
|
-
* @param color : hsl color array;
|
|
88
|
-
* @returns : hsl color value;
|
|
85
|
+
/**
|
|
86
|
+
* Convert a hsl array color to string
|
|
87
|
+
* @param color : hsl color array;
|
|
88
|
+
* @returns : hsl color value;
|
|
89
89
|
*/
|
|
90
90
|
|
|
91
91
|
|
|
@@ -7,14 +7,14 @@ exports.getColorValue = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _colorCheck = require("../utils/colorCheck");
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* This function takes a color string and returns the color value related to the theme or the original color string
|
|
12
|
-
* @param color : color value;
|
|
13
|
-
* @param theme : theme object;
|
|
14
|
-
* @param defaultValue : default value if color is not valid;
|
|
15
|
-
* @returns color value;
|
|
16
|
-
* @example
|
|
17
|
-
* getColorValue('primary.default', props.theme); // returns '#22E0A1'
|
|
10
|
+
/**
|
|
11
|
+
* This function takes a color string and returns the color value related to the theme or the original color string
|
|
12
|
+
* @param color : color value;
|
|
13
|
+
* @param theme : theme object;
|
|
14
|
+
* @param defaultValue : default value if color is not valid;
|
|
15
|
+
* @returns color value;
|
|
16
|
+
* @example
|
|
17
|
+
* getColorValue('primary.default', props.theme); // returns '#22E0A1'
|
|
18
18
|
*/
|
|
19
19
|
var getColorValue = function getColorValue(color, theme, defaultValue) {
|
|
20
20
|
if ((0, _colorCheck.isHexColor)(color) || (0, _colorCheck.isRgbHslColor)(color)) return color;
|
|
@@ -11,11 +11,11 @@ var padZero = function padZero(str) {
|
|
|
11
11
|
var zeros = new Array(len).join('0');
|
|
12
12
|
return (zeros + str).slice(-len);
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
15
|
-
* Invert the provided color or return black or white if the color is darken or lighten
|
|
16
|
-
* @param hex : hex color
|
|
17
|
-
* @param bw : black or white
|
|
18
|
-
* @returns : hex color
|
|
14
|
+
/**
|
|
15
|
+
* Invert the provided color or return black or white if the color is darken or lighten
|
|
16
|
+
* @param hex : hex color
|
|
17
|
+
* @param bw : black or white
|
|
18
|
+
* @returns : hex color
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
|