@carbon/ibm-products 2.31.0-alpha.5 → 2.31.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. package/css/index-full-carbon.css +808 -517
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +54 -75
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +808 -517
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +737 -458
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/CreateModal/CreateModal.d.ts +66 -2
  18. package/es/components/CreateModal/CreateModal.js +1 -1
  19. package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  20. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +3 -1
  21. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  22. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +3 -15
  23. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +0 -7
  24. package/es/components/Decorator/Decorator.d.ts +1 -1
  25. package/es/components/Decorator/Decorator.js +16 -253
  26. package/es/components/DecoratorBase/DecoratorBase.d.ts +7 -0
  27. package/es/components/DecoratorBase/DecoratorBase.js +233 -0
  28. package/es/components/DecoratorBase/index.d.ts +1 -0
  29. package/{lib/components/Decorator → es/components/DecoratorBase}/utils.d.ts +1 -1
  30. package/es/components/{Decorator → DecoratorBase}/utils.js +19 -19
  31. package/es/components/DecoratorDualButton/DecoratorDualButton.d.ts +5 -0
  32. package/es/components/DecoratorDualButton/DecoratorDualButton.js +135 -0
  33. package/es/components/DecoratorDualButton/index.d.ts +1 -0
  34. package/es/components/DecoratorLink/DecoratorLink.d.ts +5 -0
  35. package/es/components/DecoratorLink/DecoratorLink.js +125 -0
  36. package/es/components/DecoratorLink/index.d.ts +1 -0
  37. package/es/components/DecoratorSingleButton/DecoratorSingleButton.d.ts +5 -0
  38. package/es/components/DecoratorSingleButton/DecoratorSingleButton.js +125 -0
  39. package/es/components/DecoratorSingleButton/index.d.ts +1 -0
  40. package/es/components/index.d.ts +3 -0
  41. package/es/global/js/hooks/useFocus.js +2 -1
  42. package/es/global/js/package-settings.d.ts +3 -0
  43. package/es/global/js/package-settings.js +3 -0
  44. package/es/index.js +3 -0
  45. package/es/settings.d.ts +3 -0
  46. package/lib/components/CreateModal/CreateModal.d.ts +66 -2
  47. package/lib/components/CreateModal/CreateModal.js +1 -1
  48. package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  49. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +3 -1
  50. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  51. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +3 -15
  52. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +0 -7
  53. package/lib/components/Decorator/Decorator.d.ts +1 -1
  54. package/lib/components/Decorator/Decorator.js +15 -253
  55. package/lib/components/DecoratorBase/DecoratorBase.d.ts +7 -0
  56. package/lib/components/DecoratorBase/DecoratorBase.js +242 -0
  57. package/lib/components/DecoratorBase/index.d.ts +1 -0
  58. package/{es/components/Decorator → lib/components/DecoratorBase}/utils.d.ts +1 -1
  59. package/lib/components/{Decorator → DecoratorBase}/utils.js +19 -19
  60. package/lib/components/DecoratorDualButton/DecoratorDualButton.d.ts +5 -0
  61. package/lib/components/DecoratorDualButton/DecoratorDualButton.js +141 -0
  62. package/lib/components/DecoratorDualButton/index.d.ts +1 -0
  63. package/lib/components/DecoratorLink/DecoratorLink.d.ts +5 -0
  64. package/lib/components/DecoratorLink/DecoratorLink.js +131 -0
  65. package/lib/components/DecoratorLink/index.d.ts +1 -0
  66. package/lib/components/DecoratorSingleButton/DecoratorSingleButton.d.ts +5 -0
  67. package/lib/components/DecoratorSingleButton/DecoratorSingleButton.js +131 -0
  68. package/lib/components/DecoratorSingleButton/index.d.ts +1 -0
  69. package/lib/components/index.d.ts +3 -0
  70. package/lib/global/js/hooks/useFocus.js +2 -1
  71. package/lib/global/js/package-settings.d.ts +3 -0
  72. package/lib/global/js/package-settings.js +3 -0
  73. package/lib/index.js +15 -0
  74. package/lib/settings.d.ts +3 -0
  75. package/package.json +9 -9
  76. package/scss/components/Card/_card.scss +2 -2
  77. package/scss/components/Datagrid/styles/_draggableElement.scss +5 -1
  78. package/scss/components/Decorator/_decorator.scss +3 -380
  79. package/scss/components/DecoratorBase/_carbon-imports.scss +9 -0
  80. package/scss/components/DecoratorBase/_decorator-base-mixins.scss +41 -0
  81. package/scss/components/DecoratorBase/_decorator-base.scss +146 -0
  82. package/scss/components/DecoratorBase/_index-with-carbon.scss +9 -0
  83. package/scss/components/DecoratorBase/_index.scss +8 -0
  84. package/scss/components/DecoratorDualButton/_carbon-imports.scss +9 -0
  85. package/scss/components/DecoratorDualButton/_decorator-dual-button.scss +112 -0
  86. package/scss/components/DecoratorDualButton/_index-with-carbon.scss +9 -0
  87. package/scss/components/DecoratorDualButton/_index.scss +8 -0
  88. package/scss/components/DecoratorLink/_carbon-imports.scss +9 -0
  89. package/scss/components/DecoratorLink/_decorator-link.scss +53 -0
  90. package/scss/components/DecoratorLink/_index-with-carbon.scss +9 -0
  91. package/scss/components/DecoratorLink/_index.scss +8 -0
  92. package/scss/components/DecoratorSingleButton/_carbon-imports.scss +9 -0
  93. package/scss/components/DecoratorSingleButton/_decorator-single-button.scss +117 -0
  94. package/scss/components/DecoratorSingleButton/_index-with-carbon.scss +9 -0
  95. package/scss/components/DecoratorSingleButton/_index.scss +8 -0
  96. package/scss/components/SidePanel/_side-panel.scss +1 -1
  97. package/scss/components/Tearsheet/_tearsheet.scss +1 -1
  98. package/scss/components/_index-with-carbon.scss +3 -0
  99. package/scss/components/_index.scss +3 -0
  100. /package/es/components/{Decorator → DecoratorBase}/DecoratorIcon.d.ts +0 -0
  101. /package/es/components/{Decorator → DecoratorBase}/DecoratorIcon.js +0 -0
  102. /package/lib/components/{Decorator → DecoratorBase}/DecoratorIcon.d.ts +0 -0
  103. /package/lib/components/{Decorator → DecoratorBase}/DecoratorIcon.js +0 -0
@@ -0,0 +1,233 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default from 'react';
10
+ import PropTypes from '../../node_modules/prop-types/index.js';
11
+ import cx from 'classnames';
12
+ import { pkg } from '../../settings.js';
13
+ import { getMagnitude, truncate } from './utils.js';
14
+ import { DecoratorIcon } from './DecoratorIcon.js';
15
+
16
+ var _excluded = ["className", "disabled", "hideIcon", "href", "kind", "label", "setLabelTitle", "onClick", "onClickLabel", "onClickValue", "onContextMenu", "onContextMenuLabel", "onContextMenuValue", "score", "scoreThresholds", "small", "theme", "truncateValue", "value", "valueTitle"];
17
+ var blockClass = "".concat(pkg.prefix, "--decorator");
18
+ var componentName = 'DecoratorBase';
19
+ var defaults = {
20
+ onClick: function onClick() {},
21
+ onClickLabel: function onClickLabel() {},
22
+ onClickValue: function onClickValue() {},
23
+ onContextMenu: function onContextMenu() {},
24
+ onContextMenuLabel: function onContextMenuLabel() {},
25
+ onContextMenuValue: function onContextMenuValue() {},
26
+ scoreThresholds: [0, 4, 7, 10],
27
+ theme: 'light'
28
+ };
29
+
30
+ /**
31
+ * The DecoratorBase groups a key/value pair to look and behave like a single UI element.
32
+ *
33
+ * DecoratorBase is for internal use only. Refer to the other Decorator types as components for your app.
34
+ */
35
+ var DecoratorBase = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
36
+ var className = _ref.className,
37
+ disabled = _ref.disabled,
38
+ hideIcon = _ref.hideIcon,
39
+ href = _ref.href,
40
+ kind = _ref.kind,
41
+ label = _ref.label,
42
+ setLabelTitle = _ref.setLabelTitle,
43
+ _ref$onClick = _ref.onClick,
44
+ onClick = _ref$onClick === void 0 ? defaults.onClick : _ref$onClick,
45
+ _ref$onClickLabel = _ref.onClickLabel,
46
+ onClickLabel = _ref$onClickLabel === void 0 ? defaults.onClickLabel : _ref$onClickLabel,
47
+ _ref$onClickValue = _ref.onClickValue,
48
+ onClickValue = _ref$onClickValue === void 0 ? defaults.onClickValue : _ref$onClickValue,
49
+ _ref$onContextMenu = _ref.onContextMenu,
50
+ onContextMenu = _ref$onContextMenu === void 0 ? defaults.onContextMenu : _ref$onContextMenu,
51
+ _ref$onContextMenuLab = _ref.onContextMenuLabel,
52
+ onContextMenuLabel = _ref$onContextMenuLab === void 0 ? defaults.onContextMenuLabel : _ref$onContextMenuLab,
53
+ _ref$onContextMenuVal = _ref.onContextMenuValue,
54
+ onContextMenuValue = _ref$onContextMenuVal === void 0 ? defaults.onContextMenuValue : _ref$onContextMenuVal,
55
+ score = _ref.score,
56
+ _ref$scoreThresholds = _ref.scoreThresholds,
57
+ scoreThresholds = _ref$scoreThresholds === void 0 ? defaults.scoreThresholds : _ref$scoreThresholds,
58
+ small = _ref.small,
59
+ _ref$theme = _ref.theme,
60
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
61
+ truncateValue = _ref.truncateValue,
62
+ value = _ref.value,
63
+ valueTitle = _ref.valueTitle,
64
+ rest = _objectWithoutProperties(_ref, _excluded);
65
+ var magnitude = getMagnitude(score, scoreThresholds);
66
+ var _labelTitle = setLabelTitle && setLabelTitle(score, scoreThresholds, magnitude);
67
+ var _value = truncate(value, truncateValue);
68
+
69
+ // These class names apply to all types of DecoratorBase.
70
+ var classNames = cx(blockClass, className, "".concat(blockClass, "--").concat(theme), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "--sm"), small), "".concat(blockClass, "--truncate-end"), truncateValue === 'end'), "".concat(blockClass, "--truncate-start"), truncateValue === 'start'), "".concat(blockClass, "--truncate-midline"), truncateValue === null || truncateValue === void 0 ? void 0 : truncateValue.maxLength));
71
+
72
+ // These properties apply to all <DecoratorIcons>.
73
+ var decoratorIconsProps = {
74
+ className: "".concat(blockClass, "__icon"),
75
+ magnitude: magnitude.toLowerCase(),
76
+ // e.g. "Medium" -> "medium"
77
+ small: small
78
+ };
79
+
80
+ // Optional callback functions specific to "link" or "single-button".
81
+ var handleOnClick = function handleOnClick(event) {
82
+ onClick(event, {
83
+ score: score,
84
+ label: label,
85
+ value: value,
86
+ magnitude: magnitude
87
+ });
88
+ };
89
+ var handleOnContextMenu = function handleOnContextMenu(event) {
90
+ onContextMenu(event, {
91
+ score: score,
92
+ label: label,
93
+ value: value,
94
+ magnitude: magnitude
95
+ });
96
+ };
97
+
98
+ // RETURN DUAL BUTTONS
99
+ if (kind === 'dual-button') {
100
+ // Optional callback functions specific to "dual-button".
101
+ var handleOnClickLabel = function handleOnClickLabel(event) {
102
+ onClickLabel(event, {
103
+ score: score,
104
+ label: label,
105
+ value: value,
106
+ magnitude: magnitude
107
+ });
108
+ };
109
+ var handleOnClickValue = function handleOnClickValue(event) {
110
+ onClickValue(event, {
111
+ score: score,
112
+ label: label,
113
+ value: value,
114
+ magnitude: magnitude
115
+ });
116
+ };
117
+ var handleOnContextMenuLabel = function handleOnContextMenuLabel(event) {
118
+ onContextMenuLabel(event, {
119
+ score: score,
120
+ label: label,
121
+ value: value,
122
+ magnitude: magnitude
123
+ });
124
+ };
125
+ var handleOnContextMenuValue = function handleOnContextMenuValue(event) {
126
+ onContextMenuValue(event, {
127
+ score: score,
128
+ label: label,
129
+ value: value,
130
+ magnitude: magnitude
131
+ });
132
+ };
133
+ return /*#__PURE__*/React__default.createElement("span", _extends({}, rest, {
134
+ className: cx(classNames, "".concat(blockClass, "--dual-button"), _defineProperty({}, "".concat(blockClass, "-disabled"), disabled)),
135
+ ref: ref
136
+ }), /*#__PURE__*/React__default.createElement("button", {
137
+ className: "".concat(blockClass, "__label"),
138
+ disabled: disabled,
139
+ onClick: !disabled && handleOnClickLabel,
140
+ onContextMenu: !disabled && handleOnContextMenuLabel,
141
+ title: _labelTitle || label,
142
+ type: "button"
143
+ }, !hideIcon && /*#__PURE__*/React__default.createElement(DecoratorIcon, decoratorIconsProps), !!label && label), /*#__PURE__*/React__default.createElement("button", {
144
+ className: "".concat(blockClass, "__value"),
145
+ disabled: disabled,
146
+ onClick: !disabled && handleOnClickValue,
147
+ onContextMenu: !disabled && handleOnContextMenuValue,
148
+ title: valueTitle || value,
149
+ type: "button"
150
+ }, _value));
151
+ }
152
+
153
+ // RETURN SINGLE BUTTON
154
+ if (kind === 'single-button') {
155
+ return /*#__PURE__*/React__default.createElement("button", _extends({}, rest, {
156
+ className: cx(classNames, "".concat(blockClass, "--single-button"), _defineProperty({}, "".concat(blockClass, "-disabled"), disabled)),
157
+ disabled: disabled,
158
+ onClick: !disabled && handleOnClick,
159
+ onContextMenu: !disabled && handleOnContextMenu,
160
+ ref: ref,
161
+ type: "button"
162
+ }), /*#__PURE__*/React__default.createElement("span", {
163
+ className: "".concat(blockClass, "__label"),
164
+ title: _labelTitle || label
165
+ }, !hideIcon && /*#__PURE__*/React__default.createElement(DecoratorIcon, decoratorIconsProps), !!label && label), /*#__PURE__*/React__default.createElement("span", {
166
+ className: "".concat(blockClass, "__value"),
167
+ title: valueTitle || value
168
+ }, _value));
169
+ }
170
+
171
+ // RETURN LINK
172
+ if (kind === 'link') {
173
+ return /*#__PURE__*/React__default.createElement("a", _extends({}, rest, {
174
+ href: href,
175
+ className: cx(classNames, "".concat(blockClass, "--link")),
176
+ onClick: handleOnClick,
177
+ onContextMenu: handleOnContextMenu,
178
+ ref: ref
179
+ }), /*#__PURE__*/React__default.createElement("span", {
180
+ className: "".concat(blockClass, "__label"),
181
+ title: _labelTitle || label
182
+ }, !hideIcon && /*#__PURE__*/React__default.createElement(DecoratorIcon, decoratorIconsProps), !!label && label), /*#__PURE__*/React__default.createElement("span", {
183
+ className: "".concat(blockClass, "__value"),
184
+ title: valueTitle || value
185
+ }, _value));
186
+ }
187
+
188
+ // RETURN DEFAULT (NON-INTERACTIVE)
189
+ return /*#__PURE__*/React__default.createElement("span", _extends({}, rest, {
190
+ className: cx(classNames, "".concat(blockClass, "--default")),
191
+ ref: ref
192
+ }), /*#__PURE__*/React__default.createElement("span", {
193
+ className: "".concat(blockClass, "__label"),
194
+ title: _labelTitle || label
195
+ }, !hideIcon && /*#__PURE__*/React__default.createElement(DecoratorIcon, decoratorIconsProps), !!label && label), /*#__PURE__*/React__default.createElement("span", {
196
+ className: "".concat(blockClass, "__value"),
197
+ title: valueTitle || value
198
+ }, _value));
199
+ });
200
+ DecoratorBase.displayName = componentName;
201
+
202
+ // See the other Decorator types for detailed, context-specific comments.
203
+ DecoratorBase.propTypes = {
204
+ className: PropTypes.string,
205
+ disabled: PropTypes.bool,
206
+ hideIcon: PropTypes.bool,
207
+ href: PropTypes.string,
208
+ /**
209
+ * `kind` differentiates between each type of Decorator, and is for internal use only.
210
+ */
211
+ kind: PropTypes.oneOf(['default', 'link', 'single-button', 'dual-button']),
212
+ label: PropTypes.string,
213
+ onClick: PropTypes.func,
214
+ onClickLabel: PropTypes.func,
215
+ onClickValue: PropTypes.func,
216
+ onContextMenu: PropTypes.func,
217
+ onContextMenuLabel: PropTypes.func,
218
+ onContextMenuValue: PropTypes.func,
219
+ score: PropTypes.number,
220
+ scoreThresholds: PropTypes.arrayOf(PropTypes.number),
221
+ setLabelTitle: PropTypes.func,
222
+ small: PropTypes.bool,
223
+ theme: PropTypes.oneOf(['light', 'dark']),
224
+ truncateValue: PropTypes.oneOfType([PropTypes.oneOf(['end', 'start']), PropTypes.shape({
225
+ maxLength: PropTypes.number,
226
+ front: PropTypes.number,
227
+ back: PropTypes.number
228
+ })]),
229
+ value: PropTypes.string.isRequired,
230
+ valueTitle: PropTypes.string
231
+ };
232
+
233
+ export { DecoratorBase };
@@ -0,0 +1 @@
1
+ export { DecoratorBase } from "./DecoratorBase";
@@ -5,4 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  export function getMagnitude(score: any, thresholds: any): "Medium" | "Unknown" | "Benign" | "Low" | "High" | "Critical";
8
- export function truncate(inputText: any, truncateValue?: {}): any;
8
+ export function truncate(inputText: any, truncateValue: any): any;
@@ -6,31 +6,31 @@
6
6
  */
7
7
 
8
8
  var getMagnitude = function getMagnitude(score, thresholds) {
9
- if (typeof score === 'number') {
10
- if (score <= thresholds[0]) {
11
- return 'Benign';
12
- }
13
- if (score < thresholds[1]) {
14
- return 'Low';
15
- }
16
- if (score < thresholds[2]) {
17
- return 'Medium';
18
- }
19
- if (score < thresholds[3]) {
20
- return 'High';
21
- }
22
- if (score >= thresholds[3]) {
23
- return 'Critical';
24
- }
9
+ if (typeof score !== 'number') {
10
+ return 'Unknown';
25
11
  }
26
- return 'Unknown';
12
+ if (score <= thresholds[0]) {
13
+ return 'Benign';
14
+ }
15
+ if (score < thresholds[1]) {
16
+ return 'Low';
17
+ }
18
+ if (score < thresholds[2]) {
19
+ return 'Medium';
20
+ }
21
+ if (score < thresholds[3]) {
22
+ return 'High';
23
+ }
24
+ return 'Critical';
27
25
  };
28
26
 
29
27
  // If a "midline" truncation has been defined,
30
28
  // then return the formatted midline value generated here,
31
29
  // else return to the original value.
32
- var truncate = function truncate(inputText) {
33
- var truncateValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
30
+ var truncate = function truncate(inputText, truncateValue) {
31
+ if (!truncateValue) {
32
+ return inputText;
33
+ }
34
34
  var maxLength = truncateValue.maxLength,
35
35
  front = truncateValue.front,
36
36
  back = truncateValue.back;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The DecoratorDualButton groups a key/value pair where the key and value each behave like a button.
3
+ */
4
+ export let DecoratorDualButton: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
+ import React from 'react';
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default from 'react';
10
+ import PropTypes from '../../node_modules/prop-types/index.js';
11
+ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
12
+ import { prepareProps } from '../../global/js/utils/props-helper.js';
13
+ import { pkg } from '../../settings.js';
14
+ import { DecoratorBase } from '../DecoratorBase/DecoratorBase.js';
15
+
16
+ var componentName = 'DecoratorDualButton';
17
+
18
+ /**
19
+ * The DecoratorDualButton groups a key/value pair where the key and value each behave like a button.
20
+ */
21
+ var DecoratorDualButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
22
+ var validProps = prepareProps(props, ['href', 'kind', 'onClick', 'onContextMenu']);
23
+ return /*#__PURE__*/React__default.createElement(DecoratorBase, _extends({
24
+ ref: ref
25
+ }, validProps, {
26
+ kind: "dual-button"
27
+ }, getDevtoolsProps(componentName)));
28
+ });
29
+
30
+ // Return a placeholder if not released and not enabled by feature flag
31
+ DecoratorDualButton = pkg.checkComponentEnabled(DecoratorDualButton, componentName);
32
+
33
+ // The display name of the component, used by React. Note that displayName
34
+ // is used in preference to relying on function.name.
35
+ DecoratorDualButton.displayName = componentName;
36
+
37
+ // The types and DocGen commentary for the component props,
38
+ // in alphabetical order (for consistency).
39
+ // See https://www.npmjs.com/package/prop-types#usage.
40
+ DecoratorDualButton.propTypes = {
41
+ /**
42
+ * Provide an optional class to be applied to the containing node.
43
+ */
44
+ className: PropTypes.string,
45
+ /**
46
+ * `disabled` only applies if `kind` is "single-button" or "dual-button".
47
+ */
48
+ disabled: PropTypes.bool,
49
+ /**
50
+ * Do not show the icon, regardless of score.
51
+ */
52
+ hideIcon: PropTypes.bool,
53
+ /**
54
+ * The label for the data.
55
+ */
56
+ label: PropTypes.string,
57
+ /**
58
+ * Optional callback function.
59
+ * Returns two objects: `event` and `{ score, label, value, magnitude }`
60
+ */
61
+ onClickLabel: PropTypes.func,
62
+ /**
63
+ * Optional callback function.
64
+ * Returns two objects: `event` and `{ score, label, value, magnitude }`
65
+ */
66
+ onClickValue: PropTypes.func,
67
+ /**
68
+ * Optional callback function.
69
+ * Returns two objects: `event` and `{ score, label, value, magnitude }`
70
+ */
71
+ onContextMenuLabel: PropTypes.func,
72
+ /**
73
+ * Optional callback function.
74
+ * Returns two objects: `event` and `{ score, label, value, magnitude }`
75
+ */
76
+ onContextMenuValue: PropTypes.func,
77
+ /**
78
+ * Used in conjunction with `scoreThresholds`, determines the color, shape, and type of magnitude of the icon.
79
+ *
80
+ * If you don't want to show the icon at all, set `hideIcon={true}`.
81
+ */
82
+ score: PropTypes.number,
83
+ /**
84
+ * Used in conjunction with `score`, determines the color, shape, and type of magnitude of the icon.
85
+ *
86
+ * An array of 4 numbers determines the range of thresholds.
87
+ *
88
+ * Example using `[0, 4, 7, 10]`:
89
+ * <br/>- `<= 0` "Benign"
90
+ * <br/>- `1-3` "Low"
91
+ * <br/>- `4-6` "Medium"
92
+ * <br/>- `7-9` "High"
93
+ * <br/>- `>= 10` "Critical"
94
+ * <br/>- `NaN` "Unknown"
95
+ */
96
+ scoreThresholds: PropTypes.arrayOf(PropTypes.number),
97
+ /**
98
+ * Optional callback function for building a more detailed descriptive text.
99
+ * Returns `score`, `scoreThresholds`, `magnitude`.
100
+ *
101
+ * Typical description is in the form of
102
+ * '"(magnitude)" magnitude: score (score) out of (last element of scoreThresholds array)'.
103
+ *
104
+ * E.g. `"Medium" magnitude: score 5 out of 10`.
105
+ *
106
+ * If not defined, the title will default to the `label` prop.
107
+ */
108
+ setLabelTitle: PropTypes.func,
109
+ /**
110
+ * Styled smaller to better fit inline with text.
111
+ */
112
+ small: PropTypes.bool,
113
+ /**
114
+ * Determines the theme of the component.
115
+ */
116
+ theme: PropTypes.oneOf(['light', 'dark']),
117
+ /**
118
+ * If not defined, it will behave as `display:inline-block`.
119
+ */
120
+ truncateValue: PropTypes.oneOfType([PropTypes.oneOf(['end', 'start']), PropTypes.shape({
121
+ maxLength: PropTypes.number,
122
+ front: PropTypes.number,
123
+ back: PropTypes.number
124
+ })]),
125
+ /**
126
+ * The value of the data.
127
+ */
128
+ value: PropTypes.string.isRequired,
129
+ /**
130
+ * Overrides the default title for the Decorator's value.
131
+ */
132
+ valueTitle: PropTypes.string
133
+ };
134
+
135
+ export { DecoratorDualButton };
@@ -0,0 +1 @@
1
+ export { DecoratorDualButton } from "./DecoratorDualButton";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The DecoratorLink groups a key/value pair to behave like a link.
3
+ */
4
+ export let DecoratorLink: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
+ import React from 'react';
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default from 'react';
10
+ import PropTypes from '../../node_modules/prop-types/index.js';
11
+ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
12
+ import { prepareProps } from '../../global/js/utils/props-helper.js';
13
+ import { pkg } from '../../settings.js';
14
+ import { DecoratorBase } from '../DecoratorBase/DecoratorBase.js';
15
+
16
+ var componentName = 'DecoratorLink';
17
+
18
+ /**
19
+ * The DecoratorLink groups a key/value pair to behave like a link.
20
+ */
21
+ var DecoratorLink = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
22
+ var validProps = prepareProps(props, ['disabled', 'kind', 'onClickLabel', 'onClickValue', 'onContextMenuLabel', 'onContextMenuValue']);
23
+ return /*#__PURE__*/React__default.createElement(DecoratorBase, _extends({
24
+ ref: ref
25
+ }, validProps, {
26
+ kind: "link"
27
+ }, getDevtoolsProps(componentName)));
28
+ });
29
+
30
+ // Return a placeholder if not released and not enabled by feature flag
31
+ DecoratorLink = pkg.checkComponentEnabled(DecoratorLink, componentName);
32
+
33
+ // The display name of the component, used by React. Note that displayName
34
+ // is used in preference to relying on function.name.
35
+ DecoratorLink.displayName = componentName;
36
+
37
+ // The types and DocGen commentary for the component props,
38
+ // in alphabetical order (for consistency).
39
+ // See https://www.npmjs.com/package/prop-types#usage.
40
+ DecoratorLink.propTypes = {
41
+ /**
42
+ * Provide an optional class to be applied to the containing node.
43
+ */
44
+ className: PropTypes.string,
45
+ /**
46
+ * Do not show the icon, regardless of score.
47
+ */
48
+ hideIcon: PropTypes.bool,
49
+ /**
50
+ * The component's URL.
51
+ */
52
+ href: PropTypes.string.isRequired,
53
+ /**
54
+ * The label for the data.
55
+ */
56
+ label: PropTypes.string,
57
+ /**
58
+ * Optional callback function.
59
+ * Returns two objects: `event` and `{ score, label, value, magnitude }`
60
+ */
61
+ onClick: PropTypes.func,
62
+ /**
63
+ * Optional callback function.
64
+ * Returns two objects: `event` and `{ score, label, value, magnitude }`
65
+ */
66
+ onContextMenu: PropTypes.func,
67
+ /**
68
+ * Used in conjunction with `scoreThresholds`, determines the color, shape, and type of magnitude of the icon.
69
+ *
70
+ * If you don't want to show the icon at all, set `hideIcon={true}`.
71
+ */
72
+ score: PropTypes.number,
73
+ /**
74
+ * Used in conjunction with `score`, determines the color, shape, and type of magnitude of the icon.
75
+ *
76
+ * An array of 4 numbers determines the range of thresholds.
77
+ *
78
+ * Example using `[0, 4, 7, 10]`:
79
+ * <br/>- `<= 0` "Benign"
80
+ * <br/>- `1-3` "Low"
81
+ * <br/>- `4-6` "Medium"
82
+ * <br/>- `7-9` "High"
83
+ * <br/>- `>= 10` "Critical"
84
+ * <br/>- `NaN` "Unknown"
85
+ */
86
+ scoreThresholds: PropTypes.arrayOf(PropTypes.number),
87
+ /**
88
+ * Optional callback function for building a more detailed descriptive text.
89
+ * Returns `score`, `scoreThresholds`, `magnitude`.
90
+ *
91
+ * Typical description is in the form of
92
+ * '"(magnitude)" magnitude: score (score) out of (last element of scoreThresholds array)'.
93
+ *
94
+ * E.g. `"Medium" magnitude: score 5 out of 10`.
95
+ *
96
+ * If not defined, the title will default to the `label` prop.
97
+ */
98
+ setLabelTitle: PropTypes.func,
99
+ /**
100
+ * Styled smaller to better fit inline with text.
101
+ */
102
+ small: PropTypes.bool,
103
+ /**
104
+ * Determines the theme of the component.
105
+ */
106
+ theme: PropTypes.oneOf(['light', 'dark']),
107
+ /**
108
+ * If not defined, it will behave as `display:inline-block`.
109
+ */
110
+ truncateValue: PropTypes.oneOfType([PropTypes.oneOf(['end', 'start']), PropTypes.shape({
111
+ maxLength: PropTypes.number,
112
+ front: PropTypes.number,
113
+ back: PropTypes.number
114
+ })]),
115
+ /**
116
+ * The value of the data.
117
+ */
118
+ value: PropTypes.string.isRequired,
119
+ /**
120
+ * Overrides the default title for the Decorator's value.
121
+ */
122
+ valueTitle: PropTypes.string
123
+ };
124
+
125
+ export { DecoratorLink };
@@ -0,0 +1 @@
1
+ export { DecoratorLink } from "./DecoratorLink";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The DecoratorSingleButton groups a key/value pair to behave like a button.
3
+ */
4
+ export let DecoratorSingleButton: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
+ import React from 'react';