@veracity/vui 2.8.1 → 2.8.2
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/button/button.d.ts.map +1 -1
- package/dist/cjs/button/button.js +4 -1
- package/dist/cjs/utils/styles.d.ts +0 -2
- package/dist/cjs/utils/styles.d.ts.map +1 -1
- package/dist/cjs/utils/styles.js +3 -8
- package/dist/esm/button/button.d.ts.map +1 -1
- package/dist/esm/button/button.js +4 -1
- package/dist/esm/utils/styles.d.ts +0 -2
- package/dist/esm/utils/styles.d.ts.map +1 -1
- package/dist/esm/utils/styles.js +2 -6
- package/package.json +1 -1
- package/src/button/button.tsx +6 -0
- package/src/utils/styles.ts +2 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAGtC,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,UAAU,MAAM,cAAc,CAAA;AACrC,OAAO,UAAU,MAAM,cAAc,CAAA;AAiBrC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;SAatB,CAAA;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAGtC,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,UAAU,MAAM,cAAc,CAAA;AACrC,OAAO,UAAU,MAAM,cAAc,CAAA;AAiBrC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;SAatB,CAAA;AAMD;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;UAqHX,iBAAiB;UACjB,iBAAiB;CACxB,CAAA;AAKD,eAAe,MAAM,CAAA"}
|
|
@@ -71,6 +71,9 @@ exports.ButtonBase = core_1.styled.buttonBox `
|
|
|
71
71
|
user-select: none;
|
|
72
72
|
width: fit-content;
|
|
73
73
|
`;
|
|
74
|
+
const ariaProps = {
|
|
75
|
+
'aria-label': 'button'
|
|
76
|
+
};
|
|
74
77
|
/**
|
|
75
78
|
* Triggers given actions on click. Supports multiple states, sizes and variants.
|
|
76
79
|
*
|
|
@@ -123,7 +126,7 @@ exports.Button = (0, core_1.vui)((props, ref) => {
|
|
|
123
126
|
w: isFullWidth ? '100%' : undefined
|
|
124
127
|
});
|
|
125
128
|
return (react_1.default.createElement(context_2.ButtonProvider, { value: context },
|
|
126
|
-
react_1.default.createElement(exports.ButtonBase, Object.assign({ borderWidth: border, className: (0, utils_1.cs)('vui-button', className, isActive && utils_1.activeClassName), disabled: disabled, focusRing: 3, h: h, pl: pl, pr: isDropDown ? 0 : pr, ref: ref, type: "button", variant: variant }, buttonStyles, disabledProps, aliasedProps, rest),
|
|
129
|
+
react_1.default.createElement(exports.ButtonBase, Object.assign({ borderWidth: border, className: (0, utils_1.cs)('vui-button', className, isActive && utils_1.activeClassName), disabled: disabled, focusRing: 3, h: h, pl: pl, pr: isDropDown ? 0 : pr, ref: ref, type: "button", variant: variant }, ariaProps, buttonStyles, disabledProps, aliasedProps, rest),
|
|
127
130
|
hasState && (react_1.default.createElement(StateWrapper, Object.assign({ onClick: (e) => e.stopPropagation() }, stateProps),
|
|
128
131
|
react_1.default.createElement(buttonIcon_1.default, Object.assign({ m: "auto" }, stateIconProps)))),
|
|
129
132
|
react_1.default.createElement(Content, null,
|
|
@@ -7,8 +7,6 @@ export declare function parseHSL(color: string): {
|
|
|
7
7
|
s: number;
|
|
8
8
|
l: number;
|
|
9
9
|
};
|
|
10
|
-
/** Builds RGBA string. */
|
|
11
|
-
export declare function buildRGBA(r: number, g: number, b: number, alpha?: number): string;
|
|
12
10
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
13
11
|
export declare function hexToRGBA(hex: string, alpha?: number): string;
|
|
14
12
|
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,
|
|
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,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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ellipsisOverflow = exports.HSLToRGBA = exports.vuiColorToRGBA = exports.hexToRGBA = exports.
|
|
3
|
+
exports.ellipsisOverflow = exports.HSLToRGBA = exports.vuiColorToRGBA = exports.hexToRGBA = exports.parseHSL = exports.cs = void 0;
|
|
4
4
|
const theme_1 = require("../theme");
|
|
5
5
|
/** Concatenates individual className arguments and returns a single string. */
|
|
6
6
|
function cs(...classNames) {
|
|
@@ -15,11 +15,6 @@ function parseHSL(color) {
|
|
|
15
15
|
return { h: Number(res === null || res === void 0 ? void 0 : res[0]) || 0, s: Number(res === null || res === void 0 ? void 0 : res[1]) || 0, l: Number(res === null || res === void 0 ? void 0 : res[2]) || 0 };
|
|
16
16
|
}
|
|
17
17
|
exports.parseHSL = parseHSL;
|
|
18
|
-
/** Builds RGBA string. */
|
|
19
|
-
function buildRGBA(r, g, b, alpha) {
|
|
20
|
-
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
|
|
21
|
-
}
|
|
22
|
-
exports.buildRGBA = buildRGBA;
|
|
23
18
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
24
19
|
function hexToRGBA(hex, alpha) {
|
|
25
20
|
let hexStr = hex;
|
|
@@ -33,7 +28,7 @@ function hexToRGBA(hex, alpha) {
|
|
|
33
28
|
const r = parseInt(hexStr.slice(0, 2), 16);
|
|
34
29
|
const g = parseInt(hexStr.slice(2, 4), 16);
|
|
35
30
|
const b = parseInt(hexStr.slice(4, 6), 16);
|
|
36
|
-
return
|
|
31
|
+
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
|
|
37
32
|
}
|
|
38
33
|
exports.hexToRGBA = hexToRGBA;
|
|
39
34
|
function vuiColorToRGBA(color, alpha) {
|
|
@@ -85,7 +80,7 @@ function HSLToRGBA(h, s, l, alpha) {
|
|
|
85
80
|
r = Math.round((r + m) * 255);
|
|
86
81
|
g = Math.round((g + m) * 255);
|
|
87
82
|
b = Math.round((b + m) * 255);
|
|
88
|
-
return
|
|
83
|
+
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
|
|
89
84
|
}
|
|
90
85
|
exports.HSLToRGBA = HSLToRGBA;
|
|
91
86
|
/** Styling to add ellipsis for long texts. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAGtC,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,UAAU,MAAM,cAAc,CAAA;AACrC,OAAO,UAAU,MAAM,cAAc,CAAA;AAiBrC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;SAatB,CAAA;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAGtC,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,UAAU,MAAM,cAAc,CAAA;AACrC,OAAO,UAAU,MAAM,cAAc,CAAA;AAiBrC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;SAatB,CAAA;AAMD;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;UAqHX,iBAAiB;UACjB,iBAAiB;CACxB,CAAA;AAKD,eAAe,MAAM,CAAA"}
|
|
@@ -31,6 +31,9 @@ export const ButtonBase = styled.buttonBox `
|
|
|
31
31
|
user-select: none;
|
|
32
32
|
width: fit-content;
|
|
33
33
|
`;
|
|
34
|
+
const ariaProps = {
|
|
35
|
+
'aria-label': 'button'
|
|
36
|
+
};
|
|
34
37
|
/**
|
|
35
38
|
* Triggers given actions on click. Supports multiple states, sizes and variants.
|
|
36
39
|
*
|
|
@@ -82,7 +85,7 @@ export const Button = vui((props, ref) => {
|
|
|
82
85
|
w: isFullWidth ? '100%' : undefined
|
|
83
86
|
});
|
|
84
87
|
return (React.createElement(ButtonProvider, { value: context },
|
|
85
|
-
React.createElement(ButtonBase, { borderWidth: border, className: cs('vui-button', className, isActive && activeClassName), disabled: disabled, focusRing: 3, h: h, pl: pl, pr: isDropDown ? 0 : pr, ref: ref, type: "button", variant: variant, ...buttonStyles, ...disabledProps, ...aliasedProps, ...rest },
|
|
88
|
+
React.createElement(ButtonBase, { borderWidth: border, className: cs('vui-button', className, isActive && activeClassName), disabled: disabled, focusRing: 3, h: h, pl: pl, pr: isDropDown ? 0 : pr, ref: ref, type: "button", variant: variant, ...ariaProps, ...buttonStyles, ...disabledProps, ...aliasedProps, ...rest },
|
|
86
89
|
hasState && (React.createElement(StateWrapper, { onClick: (e) => e.stopPropagation(), ...stateProps },
|
|
87
90
|
React.createElement(ButtonIcon, { m: "auto", ...stateIconProps }))),
|
|
88
91
|
React.createElement(Content, null,
|
|
@@ -7,8 +7,6 @@ export declare function parseHSL(color: string): {
|
|
|
7
7
|
s: number;
|
|
8
8
|
l: number;
|
|
9
9
|
};
|
|
10
|
-
/** Builds RGBA string. */
|
|
11
|
-
export declare function buildRGBA(r: number, g: number, b: number, alpha?: number): string;
|
|
12
10
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
13
11
|
export declare function hexToRGBA(hex: string, alpha?: number): string;
|
|
14
12
|
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,
|
|
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,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
|
@@ -9,10 +9,6 @@ export function parseHSL(color) {
|
|
|
9
9
|
const res = regexp?.exec?.(color)?.slice?.(1);
|
|
10
10
|
return { h: Number(res?.[0]) || 0, s: Number(res?.[1]) || 0, l: Number(res?.[2]) || 0 };
|
|
11
11
|
}
|
|
12
|
-
/** Builds RGBA string. */
|
|
13
|
-
export function buildRGBA(r, g, b, alpha) {
|
|
14
|
-
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
|
|
15
|
-
}
|
|
16
12
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
17
13
|
export function hexToRGBA(hex, alpha) {
|
|
18
14
|
let hexStr = hex;
|
|
@@ -26,7 +22,7 @@ export function hexToRGBA(hex, alpha) {
|
|
|
26
22
|
const r = parseInt(hexStr.slice(0, 2), 16);
|
|
27
23
|
const g = parseInt(hexStr.slice(2, 4), 16);
|
|
28
24
|
const b = parseInt(hexStr.slice(4, 6), 16);
|
|
29
|
-
return
|
|
25
|
+
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
|
|
30
26
|
}
|
|
31
27
|
export function vuiColorToRGBA(color, alpha) {
|
|
32
28
|
if (!color.includes('.'))
|
|
@@ -76,7 +72,7 @@ export function HSLToRGBA(h, s, l, alpha) {
|
|
|
76
72
|
r = Math.round((r + m) * 255);
|
|
77
73
|
g = Math.round((g + m) * 255);
|
|
78
74
|
b = Math.round((b + m) * 255);
|
|
79
|
-
return
|
|
75
|
+
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
|
|
80
76
|
}
|
|
81
77
|
/** Styling to add ellipsis for long texts. */
|
|
82
78
|
export const ellipsisOverflow = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
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/button/button.tsx
CHANGED
|
@@ -36,6 +36,11 @@ export const ButtonBase = styled.buttonBox<ButtonProps>`
|
|
|
36
36
|
user-select: none;
|
|
37
37
|
width: fit-content;
|
|
38
38
|
`
|
|
39
|
+
|
|
40
|
+
const ariaProps = {
|
|
41
|
+
'aria-label': 'button'
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
/**
|
|
40
45
|
* Triggers given actions on click. Supports multiple states, sizes and variants.
|
|
41
46
|
*
|
|
@@ -131,6 +136,7 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
131
136
|
ref={ref}
|
|
132
137
|
type="button"
|
|
133
138
|
variant={variant}
|
|
139
|
+
{...ariaProps}
|
|
134
140
|
{...buttonStyles}
|
|
135
141
|
{...disabledProps}
|
|
136
142
|
{...aliasedProps}
|
package/src/utils/styles.ts
CHANGED
|
@@ -14,11 +14,6 @@ export function parseHSL(color: string) {
|
|
|
14
14
|
return { h: Number(res?.[0]) || 0, s: Number(res?.[1]) || 0, l: Number(res?.[2]) || 0 }
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
/** Builds RGBA string. */
|
|
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
|
-
}
|
|
21
|
-
|
|
22
17
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
23
18
|
export function hexToRGBA(hex: string, alpha?: number) {
|
|
24
19
|
let hexStr = hex
|
|
@@ -35,7 +30,7 @@ export function hexToRGBA(hex: string, alpha?: number) {
|
|
|
35
30
|
const g = parseInt(hexStr.slice(2, 4), 16)
|
|
36
31
|
const b = parseInt(hexStr.slice(4, 6), 16)
|
|
37
32
|
|
|
38
|
-
return
|
|
33
|
+
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`
|
|
39
34
|
}
|
|
40
35
|
|
|
41
36
|
export function vuiColorToRGBA(color: string, alpha?: number) {
|
|
@@ -91,7 +86,7 @@ export function HSLToRGBA(h: number, s: number, l: number, alpha?: number) {
|
|
|
91
86
|
g = Math.round((g + m) * 255)
|
|
92
87
|
b = Math.round((b + m) * 255)
|
|
93
88
|
|
|
94
|
-
return
|
|
89
|
+
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`
|
|
95
90
|
}
|
|
96
91
|
|
|
97
92
|
/** Styling to add ellipsis for long texts. */
|