@veracity/vui 2.8.4-rc.0 → 2.8.4
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 +24 -1
- package/dist/cjs/checkbox/checkbox.d.ts.map +1 -1
- package/dist/cjs/checkbox/checkbox.js +4 -4
- package/dist/cjs/image/image.d.ts.map +1 -1
- package/dist/cjs/image/image.js +2 -2
- package/dist/esm/button/button.d.ts.map +1 -1
- package/dist/esm/button/button.js +24 -1
- package/dist/esm/checkbox/checkbox.d.ts.map +1 -1
- package/dist/esm/checkbox/checkbox.js +4 -4
- package/dist/esm/image/image.d.ts.map +1 -1
- package/dist/esm/image/image.js +2 -2
- package/package.json +1 -1
- package/src/button/button.tsx +20 -1
- package/src/checkbox/checkbox.tsx +4 -3
- package/src/image/image.tsx +11 -2
|
@@ -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;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;
|
|
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;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;UA0IX,iBAAiB;UACjB,iBAAiB;CACxB,CAAA;AAKD,eAAe,MAAM,CAAA"}
|
|
@@ -102,6 +102,29 @@ exports.Button = (0, core_1.vui)((props, ref) => {
|
|
|
102
102
|
const iconRightMl = isSplit ? 'auto' : spaceXItem + 1 + 'px';
|
|
103
103
|
const pl = (icon || iconLeft ? spaceXItem : spaceXText) + 'px';
|
|
104
104
|
const pr = (icon || iconRight ? spaceXItem : spaceXText) + 'px';
|
|
105
|
+
let ariaLabel = 'vui-button';
|
|
106
|
+
if (title) {
|
|
107
|
+
ariaLabel = title;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
if ((0, utils_1.isString)(text)) {
|
|
111
|
+
ariaLabel = text;
|
|
112
|
+
}
|
|
113
|
+
else if ((0, utils_1.isReactText)(text)) {
|
|
114
|
+
ariaLabel = text.toString();
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
if ((0, utils_1.isString)(icon)) {
|
|
118
|
+
ariaLabel = icon;
|
|
119
|
+
}
|
|
120
|
+
else if ((0, utils_1.isString)(iconLeft)) {
|
|
121
|
+
ariaLabel = iconLeft;
|
|
122
|
+
}
|
|
123
|
+
else if ((0, utils_1.isString)(iconRight)) {
|
|
124
|
+
ariaLabel = iconRight;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
105
128
|
const disabledProps = disabled
|
|
106
129
|
? {
|
|
107
130
|
'aria-disabled': disabled,
|
|
@@ -123,7 +146,7 @@ exports.Button = (0, core_1.vui)((props, ref) => {
|
|
|
123
146
|
w: isFullWidth ? '100%' : undefined
|
|
124
147
|
});
|
|
125
148
|
return (react_1.default.createElement(context_2.ButtonProvider, { value: context },
|
|
126
|
-
react_1.default.createElement(exports.ButtonBase, Object.assign({ "aria-label":
|
|
149
|
+
react_1.default.createElement(exports.ButtonBase, Object.assign({ "aria-label": ariaLabel, 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, title: title, type: "button", variant: variant }, buttonStyles, disabledProps, aliasedProps, rest),
|
|
127
150
|
hasState && (react_1.default.createElement(StateWrapper, Object.assign({ onClick: (e) => e.stopPropagation() }, stateProps),
|
|
128
151
|
react_1.default.createElement(buttonIcon_1.default, Object.assign({ m: "auto" }, stateIconProps)))),
|
|
129
152
|
react_1.default.createElement(Content, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/checkbox/checkbox.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAyBpE,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/checkbox/checkbox.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAyBpE,eAAO,MAAM,YAAY,ulJAiBxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,uDAuFnB,CAAA;AAEF,eAAe,QAAQ,CAAA"}
|
|
@@ -65,7 +65,6 @@ const CheckboxInput = core_1.styled.input `
|
|
|
65
65
|
z-index: 1;
|
|
66
66
|
`;
|
|
67
67
|
exports.CheckboxBase = core_1.styled.labelBox `
|
|
68
|
-
align-items: center;
|
|
69
68
|
cursor: pointer;
|
|
70
69
|
display: inline-flex;
|
|
71
70
|
width: fit-content;
|
|
@@ -96,9 +95,10 @@ exports.Checkbox = (0, core_1.vui)((props, ref) => {
|
|
|
96
95
|
const styles = (0, core_1.useStyleConfig)('Checkbox', mergedProps);
|
|
97
96
|
const _d = styles.control, { color: controlColor, hoverColor } = _d, controlStyles = __rest(_d, ["color", "hoverColor"]);
|
|
98
97
|
const icon = isIndeterminate ? iconIndeterminate : isChecked ? iconChecked : iconProp;
|
|
99
|
-
const controlMr = children || label ?
|
|
98
|
+
const controlMr = children || label ? '12px' : 0;
|
|
100
99
|
const color = controlColor ? controlColor : consts_1.checkboxColors.main;
|
|
101
100
|
const controlHoverColor = hoverColor ? hoverColor : consts_1.checkboxColors.hover;
|
|
101
|
+
const isLongLabel = label && (label === null || label === void 0 ? void 0 : label.length) >= 60;
|
|
102
102
|
(0, react_1.useEffect)(() => {
|
|
103
103
|
checked !== undefined && setIsChecked(checked);
|
|
104
104
|
}, [checked]);
|
|
@@ -109,9 +109,9 @@ exports.Checkbox = (0, core_1.vui)((props, ref) => {
|
|
|
109
109
|
const aliasedProps = (0, utils_1.filterUndefined)({
|
|
110
110
|
'aria-disabled': disabled
|
|
111
111
|
});
|
|
112
|
-
return (react_1.default.createElement(exports.CheckboxBase, Object.assign({ className: (0, utils_1.cs)('vui-checkbox', className), controlHoverColor: controlHoverColor, ref: ref }, styles.container, aliasedProps, rest),
|
|
112
|
+
return (react_1.default.createElement(exports.CheckboxBase, Object.assign({ alignItems: isLongLabel ? 'flex-start' : 'center', className: (0, utils_1.cs)('vui-checkbox', className), controlHoverColor: controlHoverColor, ref: ref }, styles.container, aliasedProps, rest),
|
|
113
113
|
react_1.default.createElement(CheckboxControl, Object.assign({ bg: "white", className: "vui-checkboxControl", color: color, focusWithinRing: 3, mr: controlMr, role: "none" }, controlStyles),
|
|
114
114
|
react_1.default.createElement(CheckboxInput, Object.assign({ "aria-label": label ? label : 'input-checkbox', className: "vui-checkboxInput", onChange: handleOnChange, ref: inputRef, type: "checkbox" }, { checked, defaultChecked, disabled, id, name, required, value }, inputProps)),
|
|
115
|
-
react_1.default.createElement(icon_1.default, { className: "vui-checkboxIcon", h: "100%", name: icon, w: "100%" })), children !== null && children !== void 0 ? children : (label && (react_1.default.createElement(t_1.default, Object.assign({ className: "vui-checkboxLabel", lineHeight:
|
|
115
|
+
react_1.default.createElement(icon_1.default, { className: "vui-checkboxIcon", h: "100%", name: icon, w: "100%" })), children !== null && children !== void 0 ? children : (label && (react_1.default.createElement(t_1.default, Object.assign({ className: "vui-checkboxLabel", lineHeight: isLongLabel ? '26px' : 'normal' }, styles.label), label)))));
|
|
116
116
|
});
|
|
117
117
|
exports.default = exports.Checkbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/image/image.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,eAAO,MAAM,SAAS,+HAIrB,CAAA;AAED,gDAAgD;AAChD,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/image/image.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,eAAO,MAAM,SAAS,+HAIrB,CAAA;AAED,gDAAgD;AAChD,eAAO,MAAM,KAAK,mDAchB,CAAA;AAEF,eAAe,KAAK,CAAA"}
|
package/dist/cjs/image/image.js
CHANGED
|
@@ -25,8 +25,8 @@ exports.ImageBase = core_1.styled.imgBox `
|
|
|
25
25
|
`;
|
|
26
26
|
/** Displays an image. Includes base styling. */
|
|
27
27
|
exports.Image = (0, core_1.vui)((props, ref) => {
|
|
28
|
-
const _a = (0, core_1.omitThemingProps)(props), { className } = _a, rest = __rest(_a, ["className"]);
|
|
28
|
+
const _a = (0, core_1.omitThemingProps)(props), { alt, className, title } = _a, rest = __rest(_a, ["alt", "className", "title"]);
|
|
29
29
|
const styles = (0, core_1.useStyleConfig)('Image', props);
|
|
30
|
-
return react_1.default.createElement(exports.ImageBase, Object.assign({ alt:
|
|
30
|
+
return (react_1.default.createElement(exports.ImageBase, Object.assign({ alt: alt ? alt : title ? title : '', className: (0, utils_1.cs)('vui-image', className), ref: ref, title: title }, styles, rest)));
|
|
31
31
|
});
|
|
32
32
|
exports.default = exports.Image;
|
|
@@ -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;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;
|
|
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;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;UA0IX,iBAAiB;UACjB,iBAAiB;CACxB,CAAA;AAKD,eAAe,MAAM,CAAA"}
|
|
@@ -61,6 +61,29 @@ export const Button = vui((props, ref) => {
|
|
|
61
61
|
const iconRightMl = isSplit ? 'auto' : spaceXItem + 1 + 'px';
|
|
62
62
|
const pl = (icon || iconLeft ? spaceXItem : spaceXText) + 'px';
|
|
63
63
|
const pr = (icon || iconRight ? spaceXItem : spaceXText) + 'px';
|
|
64
|
+
let ariaLabel = 'vui-button';
|
|
65
|
+
if (title) {
|
|
66
|
+
ariaLabel = title;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
if (isString(text)) {
|
|
70
|
+
ariaLabel = text;
|
|
71
|
+
}
|
|
72
|
+
else if (isReactText(text)) {
|
|
73
|
+
ariaLabel = text.toString();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
if (isString(icon)) {
|
|
77
|
+
ariaLabel = icon;
|
|
78
|
+
}
|
|
79
|
+
else if (isString(iconLeft)) {
|
|
80
|
+
ariaLabel = iconLeft;
|
|
81
|
+
}
|
|
82
|
+
else if (isString(iconRight)) {
|
|
83
|
+
ariaLabel = iconRight;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
64
87
|
const disabledProps = disabled
|
|
65
88
|
? {
|
|
66
89
|
'aria-disabled': disabled,
|
|
@@ -82,7 +105,7 @@ export const Button = vui((props, ref) => {
|
|
|
82
105
|
w: isFullWidth ? '100%' : undefined
|
|
83
106
|
});
|
|
84
107
|
return (React.createElement(ButtonProvider, { value: context },
|
|
85
|
-
React.createElement(ButtonBase, { "aria-label":
|
|
108
|
+
React.createElement(ButtonBase, { "aria-label": ariaLabel, borderWidth: border, className: cs('vui-button', className, isActive && activeClassName), disabled: disabled, focusRing: 3, h: h, pl: pl, pr: isDropDown ? 0 : pr, ref: ref, title: title, type: "button", variant: variant, ...buttonStyles, ...disabledProps, ...aliasedProps, ...rest },
|
|
86
109
|
hasState && (React.createElement(StateWrapper, { onClick: (e) => e.stopPropagation(), ...stateProps },
|
|
87
110
|
React.createElement(ButtonIcon, { m: "auto", ...stateIconProps }))),
|
|
88
111
|
React.createElement(Content, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/checkbox/checkbox.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAyBpE,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/checkbox/checkbox.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAyBpE,eAAO,MAAM,YAAY,ulJAiBxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,uDAuFnB,CAAA;AAEF,eAAe,QAAQ,CAAA"}
|
|
@@ -25,7 +25,6 @@ const CheckboxInput = styled.input `
|
|
|
25
25
|
z-index: 1;
|
|
26
26
|
`;
|
|
27
27
|
export const CheckboxBase = styled.labelBox `
|
|
28
|
-
align-items: center;
|
|
29
28
|
cursor: pointer;
|
|
30
29
|
display: inline-flex;
|
|
31
30
|
width: fit-content;
|
|
@@ -55,9 +54,10 @@ export const Checkbox = vui((props, ref) => {
|
|
|
55
54
|
const styles = useStyleConfig('Checkbox', mergedProps);
|
|
56
55
|
const { color: controlColor, hoverColor, ...controlStyles } = styles.control;
|
|
57
56
|
const icon = isIndeterminate ? iconIndeterminate : isChecked ? iconChecked : iconProp;
|
|
58
|
-
const controlMr = children || label ?
|
|
57
|
+
const controlMr = children || label ? '12px' : 0;
|
|
59
58
|
const color = controlColor ? controlColor : checkboxColors.main;
|
|
60
59
|
const controlHoverColor = hoverColor ? hoverColor : checkboxColors.hover;
|
|
60
|
+
const isLongLabel = label && label?.length >= 60;
|
|
61
61
|
useEffect(() => {
|
|
62
62
|
checked !== undefined && setIsChecked(checked);
|
|
63
63
|
}, [checked]);
|
|
@@ -68,11 +68,11 @@ export const Checkbox = vui((props, ref) => {
|
|
|
68
68
|
const aliasedProps = filterUndefined({
|
|
69
69
|
'aria-disabled': disabled
|
|
70
70
|
});
|
|
71
|
-
return (React.createElement(CheckboxBase, { className: cs('vui-checkbox', className), controlHoverColor: controlHoverColor, ref: ref, ...styles.container, ...aliasedProps, ...rest },
|
|
71
|
+
return (React.createElement(CheckboxBase, { alignItems: isLongLabel ? 'flex-start' : 'center', className: cs('vui-checkbox', className), controlHoverColor: controlHoverColor, ref: ref, ...styles.container, ...aliasedProps, ...rest },
|
|
72
72
|
React.createElement(CheckboxControl, { bg: "white", className: "vui-checkboxControl", color: color, focusWithinRing: 3, mr: controlMr, role: "none", ...controlStyles },
|
|
73
73
|
React.createElement(CheckboxInput, { "aria-label": label ? label : 'input-checkbox', className: "vui-checkboxInput", onChange: handleOnChange, ref: inputRef, type: "checkbox", ...{ checked, defaultChecked, disabled, id, name, required, value }, ...inputProps }),
|
|
74
74
|
React.createElement(Icon, { className: "vui-checkboxIcon", h: "100%", name: icon, w: "100%" })),
|
|
75
75
|
children ??
|
|
76
|
-
(label && (React.createElement(T, { className: "vui-checkboxLabel", lineHeight:
|
|
76
|
+
(label && (React.createElement(T, { className: "vui-checkboxLabel", lineHeight: isLongLabel ? '26px' : 'normal', ...styles.label }, label)))));
|
|
77
77
|
});
|
|
78
78
|
export default Checkbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/image/image.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,eAAO,MAAM,SAAS,+HAIrB,CAAA;AAED,gDAAgD;AAChD,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/image/image.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,eAAO,MAAM,SAAS,+HAIrB,CAAA;AAED,gDAAgD;AAChD,eAAO,MAAM,KAAK,mDAchB,CAAA;AAEF,eAAe,KAAK,CAAA"}
|
package/dist/esm/image/image.js
CHANGED
|
@@ -8,8 +8,8 @@ export const ImageBase = styled.imgBox `
|
|
|
8
8
|
`;
|
|
9
9
|
/** Displays an image. Includes base styling. */
|
|
10
10
|
export const Image = vui((props, ref) => {
|
|
11
|
-
const { className, ...rest } = omitThemingProps(props);
|
|
11
|
+
const { alt, className, title, ...rest } = omitThemingProps(props);
|
|
12
12
|
const styles = useStyleConfig('Image', props);
|
|
13
|
-
return React.createElement(ImageBase, { alt:
|
|
13
|
+
return (React.createElement(ImageBase, { alt: alt ? alt : title ? title : '', className: cs('vui-image', className), ref: ref, title: title, ...styles, ...rest }));
|
|
14
14
|
});
|
|
15
15
|
export default Image;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "2.8.4
|
|
3
|
+
"version": "2.8.4",
|
|
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
|
@@ -98,6 +98,25 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
98
98
|
const pl = (icon || iconLeft ? spaceXItem : spaceXText) + 'px'
|
|
99
99
|
const pr = (icon || iconRight ? spaceXItem : spaceXText) + 'px'
|
|
100
100
|
|
|
101
|
+
let ariaLabel = 'vui-button'
|
|
102
|
+
if (title) {
|
|
103
|
+
ariaLabel = title
|
|
104
|
+
} else {
|
|
105
|
+
if (isString(text)) {
|
|
106
|
+
ariaLabel = text
|
|
107
|
+
} else if (isReactText(text)) {
|
|
108
|
+
ariaLabel = text.toString()
|
|
109
|
+
} else {
|
|
110
|
+
if (isString(icon)) {
|
|
111
|
+
ariaLabel = icon
|
|
112
|
+
} else if (isString(iconLeft)) {
|
|
113
|
+
ariaLabel = iconLeft
|
|
114
|
+
} else if (isString(iconRight)) {
|
|
115
|
+
ariaLabel = iconRight
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
101
120
|
const disabledProps = disabled
|
|
102
121
|
? {
|
|
103
122
|
'aria-disabled': disabled,
|
|
@@ -123,7 +142,7 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
123
142
|
return (
|
|
124
143
|
<ButtonProvider value={context}>
|
|
125
144
|
<ButtonBase
|
|
126
|
-
aria-label={
|
|
145
|
+
aria-label={ariaLabel}
|
|
127
146
|
borderWidth={border}
|
|
128
147
|
className={cs('vui-button', className, isActive && activeClassName)}
|
|
129
148
|
disabled={disabled}
|
|
@@ -30,7 +30,6 @@ const CheckboxInput = styled.input`
|
|
|
30
30
|
`
|
|
31
31
|
|
|
32
32
|
export const CheckboxBase = styled.labelBox<CheckboxStyleProps>`
|
|
33
|
-
align-items: center;
|
|
34
33
|
cursor: pointer;
|
|
35
34
|
display: inline-flex;
|
|
36
35
|
width: fit-content;
|
|
@@ -82,9 +81,10 @@ export const Checkbox = vui<'span', CheckboxProps>((props, ref) => {
|
|
|
82
81
|
const { color: controlColor, hoverColor, ...controlStyles } = styles.control
|
|
83
82
|
|
|
84
83
|
const icon = isIndeterminate ? iconIndeterminate : isChecked ? iconChecked : iconProp
|
|
85
|
-
const controlMr = children || label ?
|
|
84
|
+
const controlMr = children || label ? '12px' : 0
|
|
86
85
|
const color = controlColor ? controlColor : checkboxColors.main
|
|
87
86
|
const controlHoverColor = hoverColor ? hoverColor : checkboxColors.hover
|
|
87
|
+
const isLongLabel = label && label?.length >= 60
|
|
88
88
|
|
|
89
89
|
useEffect(() => {
|
|
90
90
|
checked !== undefined && setIsChecked(checked)
|
|
@@ -101,6 +101,7 @@ export const Checkbox = vui<'span', CheckboxProps>((props, ref) => {
|
|
|
101
101
|
|
|
102
102
|
return (
|
|
103
103
|
<CheckboxBase
|
|
104
|
+
alignItems={isLongLabel ? 'flex-start' : 'center'}
|
|
104
105
|
className={cs('vui-checkbox', className)}
|
|
105
106
|
controlHoverColor={controlHoverColor}
|
|
106
107
|
ref={ref}
|
|
@@ -132,7 +133,7 @@ export const Checkbox = vui<'span', CheckboxProps>((props, ref) => {
|
|
|
132
133
|
|
|
133
134
|
{children ??
|
|
134
135
|
(label && (
|
|
135
|
-
<T className="vui-checkboxLabel" lineHeight=
|
|
136
|
+
<T className="vui-checkboxLabel" lineHeight={isLongLabel ? '26px' : 'normal'} {...styles.label}>
|
|
136
137
|
{label}
|
|
137
138
|
</T>
|
|
138
139
|
))}
|
package/src/image/image.tsx
CHANGED
|
@@ -12,10 +12,19 @@ export const ImageBase = styled.imgBox`
|
|
|
12
12
|
|
|
13
13
|
/** Displays an image. Includes base styling. */
|
|
14
14
|
export const Image = vui<'img', ImageProps>((props, ref) => {
|
|
15
|
-
const { className, ...rest } = omitThemingProps(props)
|
|
15
|
+
const { alt, className, title, ...rest } = omitThemingProps(props)
|
|
16
16
|
const styles = useStyleConfig('Image', props)
|
|
17
17
|
|
|
18
|
-
return
|
|
18
|
+
return (
|
|
19
|
+
<ImageBase
|
|
20
|
+
alt={alt ? alt : title ? title : ''}
|
|
21
|
+
className={cs('vui-image', className)}
|
|
22
|
+
ref={ref}
|
|
23
|
+
title={title}
|
|
24
|
+
{...styles}
|
|
25
|
+
{...rest}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
19
28
|
})
|
|
20
29
|
|
|
21
30
|
export default Image
|