azure-boards-ui 2.264.2 → 2.266.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/Common/ColorUtilities.js +5 -7
- package/Common/ColorUtilities.min.js +1 -1
- package/Components/WorkItemState/WorkItemState.js +16 -17
- package/Components/WorkItemState/WorkItemState.min.js +1 -1
- package/Components/WorkItemTypeIcon/Constants.js +1 -1
- package/Components/WorkItemTypeIcon/Constants.min.js +1 -1
- package/Components/WorkItemTypeIcon/WorkItemTypeIcon.js +11 -13
- package/Components/WorkItemTypeIcon/WorkItemTypeIcon.min.js +1 -1
- package/package.json +2 -2
package/Common/ColorUtilities.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
export const COLOR_TRANSPARENT = "transparent";
|
|
2
|
+
export const COLOR_WHITE = "ffffff";
|
|
3
|
+
const hexColorMatcher = /^[0-9a-fA-F]+$/;
|
|
4
4
|
/**
|
|
5
5
|
* Parse color to format #aabbcc
|
|
6
6
|
* @param rawColor Raw string for color
|
|
7
7
|
* @param defaultColor will be changed to default one if rawColor is not fulfilled
|
|
8
8
|
* @param alphaRequired Color has alpha and don't need to remove it in result
|
|
9
9
|
*/
|
|
10
|
-
export function parseColor(rawColor, alphaRequired, defaultColor) {
|
|
11
|
-
if (alphaRequired === void 0) { alphaRequired = false; }
|
|
12
|
-
if (defaultColor === void 0) { defaultColor = COLOR_WHITE; }
|
|
10
|
+
export function parseColor(rawColor, alphaRequired = false, defaultColor = COLOR_WHITE) {
|
|
13
11
|
if (!rawColor) {
|
|
14
12
|
rawColor = defaultColor;
|
|
15
13
|
}
|
|
@@ -30,7 +28,7 @@ export function parseColor(rawColor, alphaRequired, defaultColor) {
|
|
|
30
28
|
}
|
|
31
29
|
else {
|
|
32
30
|
// remove transparency
|
|
33
|
-
rawColor =
|
|
31
|
+
rawColor = `#${rawColor.substring(rawColor.length - 6)}`;
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
34
|
return rawColor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const COLOR_TRANSPARENT="transparent",COLOR_WHITE="ffffff",hexColorMatcher=/^[0-9a-fA-F]+$/;function parseColor(t,r=!1,e=COLOR_WHITE){return t=8===(t=3!==(t="undefined"===(t="#"===(t=t||e)[0]?t.substring(1):t)?e:t).length&&4!==t.length&&6!==t.length||!hexColorMatcher.test(t)?t:"#"+t).length&&hexColorMatcher.test(t)?r?"#"+t:"#"+t.substring(t.length-6):t}function hexToRgb(t){if(7!==t.length||"#"!==t[0])throw new Error("Expected color in format #aabbcc");return[parseInt(t.substr(1,2),16),parseInt(t.substr(3,2),16),parseInt(t.substr(5,2),16)]}export{COLOR_TRANSPARENT,COLOR_WHITE,parseColor,hexToRgb};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import "azure-devops-ui/CommonImports";
|
|
3
2
|
import "azure-devops-ui/Core/core.css";
|
|
4
3
|
import "./WorkItemState.css";
|
|
@@ -8,29 +7,29 @@ import { Observer } from "azure-devops-ui/Observer";
|
|
|
8
7
|
import { Tooltip } from "azure-devops-ui/TooltipEx";
|
|
9
8
|
import { css } from "azure-devops-ui/Util";
|
|
10
9
|
import { COLOR_TRANSPARENT, COLOR_WHITE, hexToRgb, parseColor } from "../../Common/ColorUtilities";
|
|
11
|
-
|
|
10
|
+
const DefaultWorkItemStateColor = "5688E0";
|
|
12
11
|
/**
|
|
13
12
|
* Component to display work item state value with the state color.
|
|
14
13
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
14
|
+
export const WorkItemState = (props) => {
|
|
15
|
+
const { data, className, hideText } = props;
|
|
17
16
|
if (!data) {
|
|
18
17
|
// Render nothing if state and color data is not passed.
|
|
19
18
|
return null;
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
return (React.createElement(Observer, { data: data },
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
const tooltipHostId = getId("work-item-state-color-tooltip");
|
|
21
|
+
return (React.createElement(Observer, { data: data }, (props) => {
|
|
22
|
+
const stateName = props.data.name;
|
|
23
|
+
const fill = props.data.fill || DefaultWorkItemStateColor;
|
|
24
|
+
const fillColor = parseColor(fill);
|
|
25
|
+
const borderColor = getBorderColor(fill);
|
|
27
26
|
// when state name is hidden, we need aria information on the circle
|
|
28
|
-
|
|
27
|
+
const stateCircleAriaProps = hideText
|
|
29
28
|
? {
|
|
30
29
|
"aria-label": stateName
|
|
31
30
|
}
|
|
32
31
|
: undefined;
|
|
33
|
-
|
|
32
|
+
const stateCircle = (React.createElement("div", Object.assign({ className: css("work-item-state-circle", !hideText && "withText"), style: { backgroundColor: fillColor, borderColor: borderColor } }, stateCircleAriaProps)));
|
|
34
33
|
return (React.createElement("div", { className: css("wit-ui-control work-item-state", className) },
|
|
35
34
|
hideText ? (React.createElement(Tooltip, { id: tooltipHostId, text: stateName, addAriaDescribedBy: true }, stateCircle)) : (stateCircle),
|
|
36
35
|
!hideText && (React.createElement(Tooltip, { id: tooltipHostId, overflowOnly: true, text: stateName },
|
|
@@ -39,16 +38,16 @@ export var WorkItemState = function (props) {
|
|
|
39
38
|
}));
|
|
40
39
|
};
|
|
41
40
|
function getBorderColor(stateFillColor) {
|
|
42
|
-
|
|
41
|
+
const border = stateFillColor === COLOR_WHITE || stateFillColor === COLOR_TRANSPARENT ? DefaultWorkItemStateColor : stateFillColor;
|
|
43
42
|
return parseStateBorderColor(border);
|
|
44
43
|
}
|
|
45
44
|
function parseStateBorderColor(rawColor) {
|
|
46
45
|
if (rawColor.startsWith("var(")) {
|
|
47
|
-
return
|
|
46
|
+
return `rgba(${rawColor}, 0.3)`;
|
|
48
47
|
}
|
|
49
48
|
else {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return
|
|
49
|
+
const borderColorHex = parseColor(rawColor);
|
|
50
|
+
const borderColorRGB = hexToRgb(borderColorHex);
|
|
51
|
+
return `rgba(${borderColorRGB[0]}, ${borderColorRGB[1]}, ${borderColorRGB[2]}, 0.3)`;
|
|
53
52
|
}
|
|
54
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"azure-devops-ui/CommonImports";import"azure-devops-ui/Core/core.css";import"./WorkItemState.css";import*as React from"react";import{getId}from"azure-devops-ui/Core/Util/Object";import{Observer}from"azure-devops-ui/Observer";import{Tooltip}from"azure-devops-ui/TooltipEx";import{css}from"azure-devops-ui/Util";import{COLOR_TRANSPARENT,COLOR_WHITE,hexToRgb,parseColor}from"../../Common/ColorUtilities";const DefaultWorkItemStateColor="5688E0",WorkItemState=e=>{const{data:t,className:a,hideText:i}=e;if(!t)return null;const l=getId("work-item-state-color-tooltip");return React.createElement(Observer,{data:t},e=>{var t=e.data.name,e=e.data.fill||DefaultWorkItemStateColor,r=parseColor(e),e=getBorderColor(e),o=i?{"aria-label":t}:void 0,r=React.createElement("div",Object.assign({className:css("work-item-state-circle",!i&&"withText"),style:{backgroundColor:r,borderColor:e}},o));return React.createElement("div",{className:css("wit-ui-control work-item-state",a)},i?React.createElement(Tooltip,{id:l,text:t,addAriaDescribedBy:!0},r):r,!i&&React.createElement(Tooltip,{id:l,overflowOnly:!0,text:t},React.createElement("div",{className:"work-item-state-name"},React.createElement("span",null,t))))})};function getBorderColor(e){return parseStateBorderColor(e===COLOR_WHITE||e===COLOR_TRANSPARENT?DefaultWorkItemStateColor:e)}function parseStateBorderColor(e){return e.startsWith("var(")?`rgba(${e}, 0.3)`:(e=parseColor(e),`rgba(${(e=hexToRgb(e))[0]}, ${e[1]}, ${e[2]}, 0.3)`)}export{WorkItemState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const DEFAULT_WORKITEMTYPE_COLOR_AND_ICON={color:"__default__",icon:"__default__",workItemTypeName:"",isDisabled:!1};export{DEFAULT_WORKITEMTYPE_COLOR_AND_ICON};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import "azure-devops-ui/CommonImports";
|
|
3
2
|
import "azure-devops-ui/Core/core.css";
|
|
4
3
|
import "./WorkItemTypeIcon.css";
|
|
@@ -12,23 +11,22 @@ import { TypeIconSize } from "./WorkItemTypeIcon.Props";
|
|
|
12
11
|
/**
|
|
13
12
|
* Display an icon for a work item type.
|
|
14
13
|
*/
|
|
15
|
-
export
|
|
16
|
-
return (React.createElement(Observer, { data: props.data },
|
|
17
|
-
|
|
18
|
-
return React.createElement(Icon, __assign({}, getWorkItemTypeIconProps(__assign(__assign({}, props), { data: data }))));
|
|
14
|
+
export const WorkItemTypeIcon = (props) => {
|
|
15
|
+
return (React.createElement(Observer, { data: props.data }, ({ data }) => {
|
|
16
|
+
return React.createElement(Icon, Object.assign({}, getWorkItemTypeIconProps(Object.assign(Object.assign({}, props), { data }))));
|
|
19
17
|
}));
|
|
20
18
|
};
|
|
21
19
|
/**
|
|
22
20
|
* Gets the IIconProps to pass to <Icon> to show a WorkItemTypeIcon
|
|
23
21
|
*/
|
|
24
22
|
export function getWorkItemTypeIconProps(props) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
const { data, className, size, suppressAriaLabel, suppressTooltip } = props;
|
|
24
|
+
const showDefault = !data || data.icon === "__default__" || data.color === "__default__";
|
|
25
|
+
const iconClassName = data && ICONNAME_TO_CLASSNAME_MAPPINGS[data.icon];
|
|
26
|
+
const iconName = showDefault || !iconClassName ? "ClipboardSolid" : `bowtie-icon bowtie-${iconClassName}`;
|
|
27
|
+
const iconColor = (!showDefault && parseColor(data.color)) || undefined;
|
|
28
|
+
const workItemTypeName = (data && data.workItemTypeName) || "";
|
|
29
|
+
const tooltipHostId = getId("work-item-type-icon-tooltip");
|
|
32
30
|
return {
|
|
33
31
|
iconName: showDefault || !iconClassName ? iconName : undefined,
|
|
34
32
|
className: css("work-item-type-icon", className, getSizeCssClass(size), showDefault ? "default" : iconName),
|
|
@@ -57,7 +55,7 @@ function getSizeCssClass(size) {
|
|
|
57
55
|
return "normal";
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
|
-
|
|
58
|
+
const ICONNAME_TO_CLASSNAME_MAPPINGS = {
|
|
61
59
|
icon_crown: "symbol-crown",
|
|
62
60
|
icon_trophy: "symbol-trophy",
|
|
63
61
|
icon_list: "symbol-list",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"azure-devops-ui/CommonImports";import"azure-devops-ui/Core/core.css";import"./WorkItemTypeIcon.css";import*as React from"react";import{getId}from"azure-devops-ui/Core/Util/Object";import{Icon}from"azure-devops-ui/Icon";import{Observer}from"azure-devops-ui/Observer";import{css}from"azure-devops-ui/Util";import{parseColor}from"../../Common/ColorUtilities";import{TypeIconSize}from"./WorkItemTypeIcon.Props";const WorkItemTypeIcon=o=>React.createElement(Observer,{data:o.data},({data:e})=>React.createElement(Icon,Object.assign({},getWorkItemTypeIconProps(Object.assign(Object.assign({},o),{data:e})))));function getWorkItemTypeIconProps(e){var{data:o,className:s,size:t,suppressAriaLabel:i,suppressTooltip:r}=e,c=!o||"__default__"===o.icon||"__default__"===o.color,a=o&&ICONNAME_TO_CLASSNAME_MAPPINGS[o.icon],n=c||!a?"ClipboardSolid":"bowtie-icon bowtie-"+a,l=!c&&parseColor(o.color)||void 0,o=o&&o.workItemTypeName||"",m=getId("work-item-type-icon-tooltip");return{iconName:c||!a?n:void 0,className:css("work-item-type-icon",s,getSizeCssClass(t),c?"default":n),ariaDescribedBy:m,ariaLabel:i?void 0:o,style:{color:l},tooltipProps:r?void 0:{id:m,text:o},wrapperClass:e.iconWrapperClass}}function getSizeCssClass(e){switch(e){case TypeIconSize.small:return"small";case TypeIconSize.large:return"large";default:TypeIconSize.normal;return"normal"}}const ICONNAME_TO_CLASSNAME_MAPPINGS={icon_crown:"symbol-crown",icon_trophy:"symbol-trophy",icon_list:"symbol-list",icon_book:"symbol-book",icon_sticky_note:"symbol-stickynote",icon_clipboard:"symbol-task",icon_insect:"symbol-bug",icon_traffic_cone:"symbol-impediment",icon_chat_bubble:"symbol-review",icon_flame:"symbol-flame",icon_megaphone:"symbol-ask",icon_test_plan:"test-plan",icon_test_suite:"test-suite",icon_test_case:"test-case",icon_test_step:"test-step",icon_test_parameter:"test-parameter",icon_code_review:"symbol-review-request",icon_code_response:"symbol-review-response",icon_review:"symbol-feedback-request",icon_response:"symbol-feedback-response",icon_ribbon:"symbol-ribbon",icon_chart:"symbol-finance",icon_headphone:"symbol-headphone",icon_key:"symbol-key",icon_airplane:"symbol-airplane",icon_car:"symbol-car",icon_diamond:"symbol-diamond",icon_asterisk:"symbol-asterisk",icon_database_storage:"symbol-storage-database",icon_government:"symbol-government",icon_gavel:"symbol-decision",icon_parachute:"symbol-parachute",icon_paint_brush:"symbol-paint-brush",icon_palette:"symbol-color-palette",icon_gear:"settings-gear",icon_check_box:"status-success-box",icon_gift:"package-fill",icon_test_beaker:"test-fill",icon_broken_lightbulb:"symbol-defect",icon_clipboard_issue:"symbol-issue",icon_github:"brand-github",icon_pull_request:"tfvc-pull-request",icon_github_issue:"status-error-outline"};export{WorkItemTypeIcon,getWorkItemTypeIconProps};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-boards-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.266.0",
|
|
4
4
|
"description": "React components for building web UI in Azure Boards",
|
|
5
5
|
"author": "Microsoft Corporation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"homepage": "https://developer.microsoft.com/azure-devops",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"azure-devops-ui": "2.
|
|
13
|
+
"azure-devops-ui": "2.266.0",
|
|
14
14
|
"tslib": "~2.6.2"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|