@veracity/vui 2.8.0 → 2.8.1
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/cjs/utils/styles.d.ts +1 -1
- package/dist/cjs/utils/styles.d.ts.map +1 -1
- package/dist/cjs/utils/styles.js +5 -3
- package/dist/esm/utils/styles.d.ts +1 -1
- package/dist/esm/utils/styles.d.ts.map +1 -1
- package/dist/esm/utils/styles.js +3 -1
- package/package.json +1 -1
- package/src/utils/styles.ts +3 -2
|
@@ -8,7 +8,7 @@ export declare function parseHSL(color: string): {
|
|
|
8
8
|
l: number;
|
|
9
9
|
};
|
|
10
10
|
/** Builds RGBA string. */
|
|
11
|
-
export declare
|
|
11
|
+
export declare function buildRGBA(r: number, g: number, b: number, alpha?: number): string;
|
|
12
12
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
13
13
|
export declare function hexToRGBA(hex: string, alpha?: number): string;
|
|
14
14
|
export declare function vuiColorToRGBA(color: string, alpha?: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAIlC,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,6BAA6B;AAC7B,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM;;;;EAIrC;AAED,0BAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAIlC,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,6BAA6B;AAC7B,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM;;;;EAIrC;AAED,0BAA0B;AAC1B,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAExE;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAgBpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAS3D;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UA0CxE;AAED,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA"}
|
package/dist/cjs/utils/styles.js
CHANGED
|
@@ -16,7 +16,9 @@ function parseHSL(color) {
|
|
|
16
16
|
}
|
|
17
17
|
exports.parseHSL = parseHSL;
|
|
18
18
|
/** Builds RGBA string. */
|
|
19
|
-
|
|
19
|
+
function buildRGBA(r, g, b, alpha) {
|
|
20
|
+
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
|
|
21
|
+
}
|
|
20
22
|
exports.buildRGBA = buildRGBA;
|
|
21
23
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
22
24
|
function hexToRGBA(hex, alpha) {
|
|
@@ -31,7 +33,7 @@ function hexToRGBA(hex, alpha) {
|
|
|
31
33
|
const r = parseInt(hexStr.slice(0, 2), 16);
|
|
32
34
|
const g = parseInt(hexStr.slice(2, 4), 16);
|
|
33
35
|
const b = parseInt(hexStr.slice(4, 6), 16);
|
|
34
|
-
return
|
|
36
|
+
return buildRGBA(r, g, b, alpha);
|
|
35
37
|
}
|
|
36
38
|
exports.hexToRGBA = hexToRGBA;
|
|
37
39
|
function vuiColorToRGBA(color, alpha) {
|
|
@@ -83,7 +85,7 @@ function HSLToRGBA(h, s, l, alpha) {
|
|
|
83
85
|
r = Math.round((r + m) * 255);
|
|
84
86
|
g = Math.round((g + m) * 255);
|
|
85
87
|
b = Math.round((b + m) * 255);
|
|
86
|
-
return
|
|
88
|
+
return buildRGBA(r, g, b, alpha);
|
|
87
89
|
}
|
|
88
90
|
exports.HSLToRGBA = HSLToRGBA;
|
|
89
91
|
/** Styling to add ellipsis for long texts. */
|
|
@@ -8,7 +8,7 @@ export declare function parseHSL(color: string): {
|
|
|
8
8
|
l: number;
|
|
9
9
|
};
|
|
10
10
|
/** Builds RGBA string. */
|
|
11
|
-
export declare
|
|
11
|
+
export declare function buildRGBA(r: number, g: number, b: number, alpha?: number): string;
|
|
12
12
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
13
13
|
export declare function hexToRGBA(hex: string, alpha?: number): string;
|
|
14
14
|
export declare function vuiColorToRGBA(color: string, alpha?: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAIlC,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,6BAA6B;AAC7B,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM;;;;EAIrC;AAED,0BAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAIlC,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,6BAA6B;AAC7B,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM;;;;EAIrC;AAED,0BAA0B;AAC1B,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAExE;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAgBpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAS3D;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UA0CxE;AAED,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA"}
|
package/dist/esm/utils/styles.js
CHANGED
|
@@ -10,7 +10,9 @@ export function parseHSL(color) {
|
|
|
10
10
|
return { h: Number(res?.[0]) || 0, s: Number(res?.[1]) || 0, l: Number(res?.[2]) || 0 };
|
|
11
11
|
}
|
|
12
12
|
/** Builds RGBA string. */
|
|
13
|
-
export
|
|
13
|
+
export function buildRGBA(r, g, b, alpha) {
|
|
14
|
+
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
|
|
15
|
+
}
|
|
14
16
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
15
17
|
export function hexToRGBA(hex, alpha) {
|
|
16
18
|
let hexStr = hex;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
package/src/utils/styles.ts
CHANGED
|
@@ -15,8 +15,9 @@ export function parseHSL(color: string) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/** Builds RGBA string. */
|
|
18
|
-
export
|
|
19
|
-
alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`
|
|
18
|
+
export function buildRGBA(r: number, g: number, b: number, alpha?: number) {
|
|
19
|
+
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`
|
|
20
|
+
}
|
|
20
21
|
|
|
21
22
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
22
23
|
export function hexToRGBA(hex: string, alpha?: number) {
|