@carbon/ibm-products 1.56.0 → 1.58.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/css/index-full-carbon.css +392 -895
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon.css +392 -895
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +392 -895
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- package/css/index.min.css.map +1 -1
- package/es/components/Checklist/Checklist.js +277 -0
- package/es/components/Checklist/ChecklistChart.js +104 -0
- package/es/components/Checklist/ChecklistIcon.js +105 -0
- package/es/components/Checklist/index.js +8 -0
- package/es/components/Datagrid/Datagrid/Datagrid.js +12 -7
- package/es/components/Datagrid/Datagrid/DatagridContent.js +6 -3
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +128 -7
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +1 -23
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +111 -0
- package/es/components/Datagrid/useDatagrid.js +5 -2
- package/es/components/Datagrid/utils/getColTitle.js +25 -0
- package/es/components/NonLinearReading/NonLinearReading.js +9 -4
- package/es/components/index.js +2 -1
- package/es/global/js/hooks/useResizeObserver.js +19 -3
- package/es/global/js/package-settings.js +1 -0
- package/lib/components/Checklist/Checklist.js +267 -0
- package/lib/components/Checklist/ChecklistChart.js +94 -0
- package/lib/components/Checklist/ChecklistIcon.js +92 -0
- package/lib/components/Checklist/index.js +12 -0
- package/lib/components/Datagrid/Datagrid/Datagrid.js +12 -7
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +6 -3
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +131 -7
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +4 -26
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +122 -0
- package/lib/components/Datagrid/useDatagrid.js +5 -2
- package/lib/components/Datagrid/utils/getColTitle.js +32 -0
- package/lib/components/NonLinearReading/NonLinearReading.js +8 -3
- package/lib/components/index.js +8 -1
- package/lib/global/js/hooks/useResizeObserver.js +19 -3
- package/lib/global/js/package-settings.js +1 -0
- package/package.json +2 -2
- package/scss/components/Checklist/_checklist.scss +231 -0
- package/scss/components/Checklist/_index.scss +8 -0
- package/scss/components/Checklist/_storybook-styles.scss +13 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +91 -0
- package/scss/components/NonLinearReading/_non-linear-reading.scss +76 -64
- package/scss/components/_index.scss +1 -0
@@ -0,0 +1,267 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.Checklist = void 0;
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
15
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
16
|
+
var _devtools = require("../../global/js/utils/devtools");
|
17
|
+
var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
|
18
|
+
var _settings = require("../../settings");
|
19
|
+
var _carbonComponentsReact = require("carbon-components-react");
|
20
|
+
var _iconsReact = require("@carbon/icons-react");
|
21
|
+
var _ChecklistIcon = require("./ChecklistIcon");
|
22
|
+
var _ChecklistChart = require("./ChecklistChart");
|
23
|
+
var _excluded = ["chartValue", "chartLabel", "checklistAriaLabel", "checklistToggleAriaLabel", "className", "onClickViewAll", "onToggle", "open", "showToggle", "taskLists", "theme", "title", "viewAllLabel"];
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
25
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
26
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
27
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--checklist");
|
28
|
+
var componentName = 'Checklist';
|
29
|
+
|
30
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
31
|
+
|
32
|
+
// Default values can be included here and then assigned to the prop params,
|
33
|
+
// e.g. prop = defaults.prop,
|
34
|
+
// This gathers default values together neatly and ensures non-primitive
|
35
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
36
|
+
// Note that default values are not required for props that are 'required',
|
37
|
+
// nor for props where the component can apply undefined values reasonably.
|
38
|
+
// Default values should be provided when the component needs to make a choice
|
39
|
+
// or assumption when a prop is not supplied.
|
40
|
+
|
41
|
+
// Default values for props
|
42
|
+
var defaults = {
|
43
|
+
checklistAriaLabel: 'Checklist',
|
44
|
+
checklistToggleAriaLabel: 'Checklist toggle',
|
45
|
+
onClickViewAll: function onClickViewAll() {},
|
46
|
+
onToggle: function onToggle() {},
|
47
|
+
open: true,
|
48
|
+
showToggle: true,
|
49
|
+
taskLists: [],
|
50
|
+
theme: 'light'
|
51
|
+
};
|
52
|
+
|
53
|
+
/**
|
54
|
+
* TODO: A description of the component.
|
55
|
+
*/
|
56
|
+
var Checklist = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
57
|
+
var chartValue = _ref.chartValue,
|
58
|
+
chartLabel = _ref.chartLabel,
|
59
|
+
_ref$checklistAriaLab = _ref.checklistAriaLabel,
|
60
|
+
checklistAriaLabel = _ref$checklistAriaLab === void 0 ? defaults.checklistAriaLabel : _ref$checklistAriaLab,
|
61
|
+
_ref$checklistToggleA = _ref.checklistToggleAriaLabel,
|
62
|
+
checklistToggleAriaLabel = _ref$checklistToggleA === void 0 ? defaults.checklistToggleAriaLabel : _ref$checklistToggleA,
|
63
|
+
className = _ref.className,
|
64
|
+
_ref$onClickViewAll = _ref.onClickViewAll,
|
65
|
+
onClickViewAll = _ref$onClickViewAll === void 0 ? defaults.onClickViewAll : _ref$onClickViewAll,
|
66
|
+
_ref$onToggle = _ref.onToggle,
|
67
|
+
onToggle = _ref$onToggle === void 0 ? defaults.onToggle : _ref$onToggle,
|
68
|
+
_ref$open = _ref.open,
|
69
|
+
open = _ref$open === void 0 ? defaults.open : _ref$open,
|
70
|
+
_ref$showToggle = _ref.showToggle,
|
71
|
+
showToggle = _ref$showToggle === void 0 ? defaults.showToggle : _ref$showToggle,
|
72
|
+
_ref$taskLists = _ref.taskLists,
|
73
|
+
taskLists = _ref$taskLists === void 0 ? defaults.taskLists : _ref$taskLists,
|
74
|
+
_ref$theme = _ref.theme,
|
75
|
+
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
76
|
+
title = _ref.title,
|
77
|
+
viewAllLabel = _ref.viewAllLabel,
|
78
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
79
|
+
var _useState = (0, _react.useState)(open),
|
80
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
81
|
+
isOpen = _useState2[0],
|
82
|
+
setIsOpen = _useState2[1];
|
83
|
+
var listContainerId = (0, _react.useRef)((0, _uuidv.default)()).current;
|
84
|
+
var chartLabelId = (0, _react.useRef)((0, _uuidv.default)()).current;
|
85
|
+
|
86
|
+
// Don't use this test: {chartValue && chartLabel && (render...)}.
|
87
|
+
// If `chartValue` is 0 (zero) - a valid value - then it will render 0 and skip the remaining statement.
|
88
|
+
// Use this test instead: {chartLabelAndValue && (render...)}.
|
89
|
+
// The ChecklistChart component will validate `chartValue`.
|
90
|
+
var chartLabelAndValue = typeof chartValue === 'number' && chartLabel;
|
91
|
+
var handleClickToggle = function handleClickToggle() {
|
92
|
+
setIsOpen(function (prevOpen) {
|
93
|
+
return !prevOpen;
|
94
|
+
});
|
95
|
+
};
|
96
|
+
var handleClickViewAll = function handleClickViewAll() {
|
97
|
+
onClickViewAll();
|
98
|
+
};
|
99
|
+
|
100
|
+
// If state changes, then trigger callback.
|
101
|
+
(0, _react.useEffect)(function () {
|
102
|
+
onToggle(isOpen);
|
103
|
+
}, [isOpen, onToggle]);
|
104
|
+
|
105
|
+
// If the "open" prop is changed after initialization,
|
106
|
+
// then update internal state.
|
107
|
+
(0, _react.useEffect)(function () {
|
108
|
+
setIsOpen(open);
|
109
|
+
}, [open]);
|
110
|
+
return /*#__PURE__*/_react.default.createElement("aside", (0, _extends2.default)({}, rest, {
|
111
|
+
"aria-label": checklistAriaLabel,
|
112
|
+
className: (0, _classnames.default)(blockClass,
|
113
|
+
// Apply the block class to the main HTML element
|
114
|
+
className, // Apply any supplied class names to the main HTML element.
|
115
|
+
// example: `${blockClass}__template-string-class-${kind}-n-${size}`,
|
116
|
+
(0, _defineProperty2.default)({}, "".concat(blockClass, "__closed"), !isOpen)),
|
117
|
+
ref: ref
|
118
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), (title || chartLabelAndValue) && /*#__PURE__*/_react.default.createElement("header", {
|
119
|
+
className: "".concat(blockClass, "__header")
|
120
|
+
}, chartLabelAndValue && /*#__PURE__*/_react.default.createElement(_ChecklistChart.ChecklistChart, {
|
121
|
+
ariaLabelledById: chartLabelId,
|
122
|
+
value: chartValue,
|
123
|
+
theme: theme
|
124
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
125
|
+
className: "".concat(blockClass, "__titles")
|
126
|
+
}, title && /*#__PURE__*/_react.default.createElement("h2", {
|
127
|
+
className: "".concat(blockClass, "__title")
|
128
|
+
}, title), chartLabelAndValue && /*#__PURE__*/_react.default.createElement("h3", {
|
129
|
+
id: chartLabelId,
|
130
|
+
className: "".concat(blockClass, "__chart-label")
|
131
|
+
}, chartLabel)), showToggle && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
132
|
+
"aria-controls": listContainerId,
|
133
|
+
"aria-expanded": isOpen,
|
134
|
+
"aria-label": checklistToggleAriaLabel,
|
135
|
+
className: "".concat(blockClass, "__toggle"),
|
136
|
+
kind: "ghost",
|
137
|
+
onClick: handleClickToggle,
|
138
|
+
size: "small"
|
139
|
+
}, /*#__PURE__*/_react.default.createElement(_iconsReact.ChevronUp16, {
|
140
|
+
className: (0, _classnames.default)("".concat(blockClass, "__chevron"))
|
141
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
142
|
+
id: listContainerId,
|
143
|
+
className: "".concat(blockClass, "__content-outer")
|
144
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
145
|
+
className: "".concat(blockClass, "__content-inner")
|
146
|
+
}, /*#__PURE__*/_react.default.createElement("section", {
|
147
|
+
className: (0, _classnames.default)("".concat(blockClass, "__body"))
|
148
|
+
}, taskLists.map(function (list, index) {
|
149
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
150
|
+
className: "".concat(blockClass, "__list-group"),
|
151
|
+
key: "".concat(list.title, "-").concat(index)
|
152
|
+
}, list.title && /*#__PURE__*/_react.default.createElement("h3", {
|
153
|
+
title: list.title,
|
154
|
+
className: "".concat(blockClass, "__list-title")
|
155
|
+
}, list.title), /*#__PURE__*/_react.default.createElement("ol", {
|
156
|
+
className: "".concat(blockClass, "__list")
|
157
|
+
}, list.tasks.map(function (item, index) {
|
158
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
159
|
+
className: "".concat(blockClass, "__list-item"),
|
160
|
+
key: "".concat(item.label, "-").concat(index)
|
161
|
+
}, /*#__PURE__*/_react.default.createElement(_ChecklistIcon.ChecklistIcon, {
|
162
|
+
kind: item.kind
|
163
|
+
}), typeof item.onClick === 'function' ? /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
164
|
+
className: (0, _classnames.default)("".concat(blockClass, "__button"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__button--error"), item.kind === 'error')),
|
165
|
+
onClick: function onClick() {
|
166
|
+
item.onClick(item);
|
167
|
+
},
|
168
|
+
size: "small"
|
169
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
170
|
+
title: item.label
|
171
|
+
}, item.label)) : /*#__PURE__*/_react.default.createElement("span", {
|
172
|
+
className: (0, _classnames.default)("".concat(blockClass, "__label"), "".concat(blockClass, "__label--").concat(item.kind)),
|
173
|
+
title: item.label
|
174
|
+
}, item.label));
|
175
|
+
})));
|
176
|
+
})), viewAllLabel && /*#__PURE__*/_react.default.createElement("footer", {
|
177
|
+
className: "".concat(blockClass, "__footer")
|
178
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
179
|
+
className: (0, _classnames.default)("".concat(blockClass, "__button"), "".concat(blockClass, "__view-all")),
|
180
|
+
onClick: handleClickViewAll,
|
181
|
+
size: "small"
|
182
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, viewAllLabel))))));
|
183
|
+
});
|
184
|
+
|
185
|
+
// Return a placeholder if not released and not enabled by feature flag
|
186
|
+
exports.Checklist = Checklist;
|
187
|
+
exports.Checklist = Checklist = _settings.pkg.checkComponentEnabled(Checklist, componentName);
|
188
|
+
|
189
|
+
// The display name of the component, used by React. Note that displayName
|
190
|
+
// is used in preference to relying on function.name.
|
191
|
+
Checklist.displayName = componentName;
|
192
|
+
|
193
|
+
// The types and DocGen commentary for the component props,
|
194
|
+
// in alphabetical order (for consistency).
|
195
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
196
|
+
Checklist.propTypes = {
|
197
|
+
/**
|
198
|
+
* Define both `chartLabel` and `chartValue` to show the chart and its label together.
|
199
|
+
*/
|
200
|
+
chartLabel: _propTypes.default.string,
|
201
|
+
/**
|
202
|
+
* A number between 0 and 1.
|
203
|
+
*
|
204
|
+
* Define both `chartLabel` and `chartValue` to show the chart and its label together.
|
205
|
+
*/
|
206
|
+
chartValue: _propTypes.default.number,
|
207
|
+
/**
|
208
|
+
* Aria-label for the Checklist component.
|
209
|
+
*/
|
210
|
+
checklistAriaLabel: _propTypes.default.string,
|
211
|
+
/**
|
212
|
+
* Aria-label for the Checklist's toggle component.
|
213
|
+
*/
|
214
|
+
checklistToggleAriaLabel: _propTypes.default.string,
|
215
|
+
/**
|
216
|
+
* Provide an optional class to be applied to the containing node.
|
217
|
+
*/
|
218
|
+
className: _propTypes.default.string,
|
219
|
+
/**
|
220
|
+
* Callback for the "View all" button. See also `viewAllLabel`.
|
221
|
+
*/
|
222
|
+
onClickViewAll: _propTypes.default.func,
|
223
|
+
/**
|
224
|
+
* Optional callback for when the list is opened/closed.
|
225
|
+
*/
|
226
|
+
onToggle: _propTypes.default.func,
|
227
|
+
/**
|
228
|
+
* Specifies whether the component is opened or closed.
|
229
|
+
* This can be set during initialization, or changed after being rendered.
|
230
|
+
*/
|
231
|
+
open: _propTypes.default.bool,
|
232
|
+
/**
|
233
|
+
* Whether or not to show the open/close toggle.
|
234
|
+
*/
|
235
|
+
showToggle: _propTypes.default.bool,
|
236
|
+
/**
|
237
|
+
* The task list can be broken down into sub-lists.
|
238
|
+
*
|
239
|
+
* Each sub-list can include an optional `title`.
|
240
|
+
*
|
241
|
+
* Each task must specify the appropriate icon (`kind`) and `label`.
|
242
|
+
*
|
243
|
+
* If any task has an `onClick` callback function defined,
|
244
|
+
* then the `label` will be rendered as a button,
|
245
|
+
* else the `label` will be rendered as plain text.
|
246
|
+
*/
|
247
|
+
taskLists: _propTypes.default.arrayOf(_propTypes.default.shape({
|
248
|
+
title: _propTypes.default.string,
|
249
|
+
tasks: _propTypes.default.arrayOf(_propTypes.default.shape({
|
250
|
+
kind: _propTypes.default.oneOf(['unchecked', 'indeterminate', 'checked', 'disabled', 'error']).isRequired,
|
251
|
+
label: _propTypes.default.string.isRequired,
|
252
|
+
onClick: _propTypes.default.func
|
253
|
+
})).isRequired
|
254
|
+
})).isRequired,
|
255
|
+
/**
|
256
|
+
* Determines the theme of the component.
|
257
|
+
*/
|
258
|
+
theme: _propTypes.default.oneOf(['light', 'dark']),
|
259
|
+
/**
|
260
|
+
* The title of the component.
|
261
|
+
*/
|
262
|
+
title: _propTypes.default.string,
|
263
|
+
/**
|
264
|
+
* If defined, will show and enable the "View all (#)" button at the bottom of the list.
|
265
|
+
*/
|
266
|
+
viewAllLabel: _propTypes.default.string
|
267
|
+
};
|
@@ -0,0 +1,94 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.ChecklistChart = void 0;
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
13
|
+
var _devtools = require("../../global/js/utils/devtools");
|
14
|
+
var _settings = require("../../settings");
|
15
|
+
var _clamp = _interopRequireDefault(require("lodash/clamp"));
|
16
|
+
var _excluded = ["className", "ariaLabelledById", "value", "theme"];
|
17
|
+
// Carbon and package components we use.
|
18
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
19
|
+
|
20
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
21
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--checklist__chart");
|
22
|
+
var componentName = 'ChecklistChart';
|
23
|
+
|
24
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
25
|
+
|
26
|
+
// Default values can be included here and then assigned to the prop params,
|
27
|
+
// e.g. prop = defaults.prop,
|
28
|
+
// This gathers default values together neatly and ensures non-primitive
|
29
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
30
|
+
// Note that default values are not required for props that are 'required',
|
31
|
+
// nor for props where the component can apply undefined values reasonably.
|
32
|
+
// Default values should be provided when the component needs to make a choice
|
33
|
+
// or assumption when a prop is not supplied.
|
34
|
+
|
35
|
+
// Default values for props
|
36
|
+
var defaults = {
|
37
|
+
theme: 'light'
|
38
|
+
};
|
39
|
+
|
40
|
+
/**
|
41
|
+
* TODO: A description of the component.
|
42
|
+
*/
|
43
|
+
var ChecklistChart = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
44
|
+
var className = _ref.className,
|
45
|
+
ariaLabelledById = _ref.ariaLabelledById,
|
46
|
+
value = _ref.value,
|
47
|
+
_ref$theme = _ref.theme,
|
48
|
+
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
49
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
50
|
+
var numDegrees = (0, _clamp.default)(value * 360, 0, 360);
|
51
|
+
var circleColor = theme === 'light' ? '#c6c6c6' : '#525252'; // $gray-30, $gray-70
|
52
|
+
var progressColor = theme === 'light' ? '#6929c4' : '#A56EFF'; // $purple-70, $purple-50
|
53
|
+
|
54
|
+
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
55
|
+
"aria-labelledby": ariaLabelledById,
|
56
|
+
className: (0, _classnames.default)(blockClass, className),
|
57
|
+
style: {
|
58
|
+
backgroundImage: "conic-gradient(".concat(progressColor, " ").concat(numDegrees, "deg, ").concat(circleColor, " ").concat(numDegrees, "deg 360deg)"),
|
59
|
+
borderRadius: '50%'
|
60
|
+
},
|
61
|
+
ref: ref,
|
62
|
+
role: "img"
|
63
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)));
|
64
|
+
});
|
65
|
+
|
66
|
+
// Return a placeholder if not released and not enabled by feature flag
|
67
|
+
// ChecklistChart = pkg.checkComponentEnabled(ChecklistChart, componentName);
|
68
|
+
|
69
|
+
// The display name of the component, used by React. Note that displayName
|
70
|
+
// is used in preference to relying on function.name.
|
71
|
+
// ChecklistChart.displayName = componentName;
|
72
|
+
|
73
|
+
// The types and DocGen commentary for the component props,
|
74
|
+
// in alphabetical order (for consistency).
|
75
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
76
|
+
exports.ChecklistChart = ChecklistChart;
|
77
|
+
ChecklistChart.propTypes = {
|
78
|
+
/**
|
79
|
+
* Id of the parent's aria-label for accessibility.
|
80
|
+
*/
|
81
|
+
ariaLabelledById: _propTypes.default.string.isRequired,
|
82
|
+
/**
|
83
|
+
* Optional class name for this component.
|
84
|
+
*/
|
85
|
+
className: _propTypes.default.string,
|
86
|
+
/**
|
87
|
+
* Determines the theme of the component.
|
88
|
+
*/
|
89
|
+
theme: _propTypes.default.oneOf(['light', 'dark']),
|
90
|
+
/**
|
91
|
+
* Number between 0 and 1.
|
92
|
+
*/
|
93
|
+
value: _propTypes.default.number.isRequired
|
94
|
+
};
|
@@ -0,0 +1,92 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.ChecklistIcon = void 0;
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
13
|
+
var _devtools = require("../../global/js/utils/devtools");
|
14
|
+
var _settings = require("../../settings");
|
15
|
+
var _iconsReact = require("@carbon/icons-react");
|
16
|
+
var _excluded = ["className", "kind", "theme"];
|
17
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
18
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--checklist__icon");
|
19
|
+
var componentName = 'ChecklistIcon';
|
20
|
+
|
21
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
22
|
+
|
23
|
+
// Default values can be included here and then assigned to the prop params,
|
24
|
+
// e.g. prop = defaults.prop,
|
25
|
+
// This gathers default values together neatly and ensures non-primitive
|
26
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
27
|
+
// Note that default values are not required for props that are 'required',
|
28
|
+
// nor for props where the component can apply undefined values reasonably.
|
29
|
+
// Default values should be provided when the component needs to make a choice
|
30
|
+
// or assumption when a prop is not supplied.
|
31
|
+
|
32
|
+
// Default values for props
|
33
|
+
var defaults = {
|
34
|
+
theme: 'light'
|
35
|
+
};
|
36
|
+
|
37
|
+
/**
|
38
|
+
* TODO: A description of the component.
|
39
|
+
*/
|
40
|
+
var ChecklistIcon = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
41
|
+
var className = _ref.className,
|
42
|
+
kind = _ref.kind,
|
43
|
+
_ref$theme = _ref.theme,
|
44
|
+
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
45
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
46
|
+
var Icon;
|
47
|
+
switch (kind) {
|
48
|
+
case 'error':
|
49
|
+
Icon = _iconsReact.Warning16;
|
50
|
+
break;
|
51
|
+
case 'indeterminate':
|
52
|
+
Icon = _iconsReact.Incomplete16;
|
53
|
+
break;
|
54
|
+
case 'checked':
|
55
|
+
Icon = _iconsReact.CheckmarkOutline16;
|
56
|
+
break;
|
57
|
+
default:
|
58
|
+
// "unchecked" or "disabled"
|
59
|
+
Icon = _iconsReact.CircleDash16;
|
60
|
+
break;
|
61
|
+
}
|
62
|
+
return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, rest, {
|
63
|
+
className: (0, _classnames.default)(blockClass, className, "".concat(blockClass, "--").concat(kind), "".concat(blockClass, "__").concat(theme)),
|
64
|
+
ref: ref
|
65
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(Icon, null));
|
66
|
+
});
|
67
|
+
|
68
|
+
// Return a placeholder if not released and not enabled by feature flag
|
69
|
+
// ChecklistIcon = pkg.checkComponentEnabled(ChecklistIcon, componentName);
|
70
|
+
|
71
|
+
// The display name of the component, used by React. Note that displayName
|
72
|
+
// is used in preference to relying on function.name.
|
73
|
+
// ChecklistIcon.displayName = componentName;
|
74
|
+
|
75
|
+
// The types and DocGen commentary for the component props,
|
76
|
+
// in alphabetical order (for consistency).
|
77
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
78
|
+
exports.ChecklistIcon = ChecklistIcon;
|
79
|
+
ChecklistIcon.propTypes = {
|
80
|
+
/**
|
81
|
+
* Provide an optional class to be applied to the containing node.
|
82
|
+
*/
|
83
|
+
className: _propTypes.default.string,
|
84
|
+
/**
|
85
|
+
* The icon to be displayed.
|
86
|
+
*/
|
87
|
+
kind: _propTypes.default.oneOf(['unchecked', 'indeterminate', 'checked', 'disabled', 'error']),
|
88
|
+
/**
|
89
|
+
* Determines the theme of the component.
|
90
|
+
*/
|
91
|
+
theme: _propTypes.default.oneOf(['light', 'dark'])
|
92
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "Checklist", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _Checklist.Checklist;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
var _Checklist = require("./Checklist");
|
@@ -16,11 +16,12 @@ var _pconsole = _interopRequireDefault(require("../../../global/js/utils/pconsol
|
|
16
16
|
var _InlineEditContext = require("./addons/InlineEdit/InlineEditContext");
|
17
17
|
var _DatagridContent = require("./DatagridContent");
|
18
18
|
var _FilterProvider = require("./addons/Filtering/FilterProvider");
|
19
|
-
var _excluded = ["datagridState"];
|
19
|
+
var _excluded = ["datagridState", "title"];
|
20
20
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
21
21
|
var componentName = 'Datagrid';
|
22
22
|
var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
23
23
|
var datagridState = _ref.datagridState,
|
24
|
+
title = _ref.title,
|
24
25
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
25
26
|
if (!datagridState) {
|
26
27
|
_pconsole.default.warn('Datagrid was not passed datagridState which is required to render this component.');
|
@@ -34,6 +35,10 @@ var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
34
35
|
className = datagridState.className,
|
35
36
|
filters = datagridState.state.filters;
|
36
37
|
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
38
|
+
var props = {
|
39
|
+
title: title,
|
40
|
+
datagridState: datagridState
|
41
|
+
};
|
37
42
|
return /*#__PURE__*/_react.default.createElement(_FilterProvider.FilterProvider, {
|
38
43
|
filters: filters
|
39
44
|
}, /*#__PURE__*/_react.default.createElement(_InlineEditContext.InlineEditProvider, null, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
@@ -42,11 +47,7 @@ var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
42
47
|
className: (0, _classnames.default)(className, blockClass, withVirtualScroll ? "".concat(blockClass, "__datagridWrap") : "".concat(blockClass, "__datagridWrap-simple"), !isFetching && rows.length === 0 ? "".concat(blockClass, "__empty-state") : '')
|
43
48
|
}, (0, _devtools.getDevtoolsProps)(componentName)), (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' ? /*#__PURE__*/_react.default.createElement("div", {
|
44
49
|
className: "".concat(blockClass, "__datagridWithPanel ").concat(blockClass, "__displayFlex ").concat(blockClass, "__leftPanel-position")
|
45
|
-
}, /*#__PURE__*/_react.default.createElement(_DatagridContent.DatagridContent,
|
46
|
-
datagridState: datagridState
|
47
|
-
})) : /*#__PURE__*/_react.default.createElement(_DatagridContent.DatagridContent, {
|
48
|
-
datagridState: datagridState
|
49
|
-
}))));
|
50
|
+
}, /*#__PURE__*/_react.default.createElement(_DatagridContent.DatagridContent, props)) : /*#__PURE__*/_react.default.createElement(_DatagridContent.DatagridContent, props))));
|
50
51
|
});
|
51
52
|
|
52
53
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -60,5 +61,9 @@ Datagrid.propTypes = {
|
|
60
61
|
/**
|
61
62
|
* The data grid state, much of it being supplied by the useDatagrid hook
|
62
63
|
*/
|
63
|
-
datagridState: _propTypes.default.object.isRequired
|
64
|
+
datagridState: _propTypes.default.object.isRequired,
|
65
|
+
/**
|
66
|
+
* Table title
|
67
|
+
*/
|
68
|
+
title: _propTypes.default.string
|
64
69
|
};
|
@@ -40,7 +40,8 @@ var TableContainer = _carbonComponentsReact.DataTable.TableContainer,
|
|
40
40
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
41
41
|
var DatagridContent = function DatagridContent(_ref) {
|
42
42
|
var _cx4;
|
43
|
-
var datagridState = _ref.datagridState
|
43
|
+
var datagridState = _ref.datagridState,
|
44
|
+
title = _ref.title;
|
44
45
|
var _useContext = (0, _react.useContext)(_InlineEditContext.InlineEditContext),
|
45
46
|
inlineEditState = _useContext.state,
|
46
47
|
dispatch = _useContext.dispatch;
|
@@ -108,7 +109,8 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
108
109
|
} : null,
|
109
110
|
onFocus: withInlineEdit ? function () {
|
110
111
|
return (0, _handleGridFocus.handleGridFocus)(inlineEditState, dispatch);
|
111
|
-
} : null
|
112
|
+
} : null,
|
113
|
+
title: title
|
112
114
|
}), !withVirtualScroll ? /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState) : null, /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
|
113
115
|
rows: rows
|
114
116
|
})));
|
@@ -191,5 +193,6 @@ DatagridContent.propTypes = {
|
|
191
193
|
setAllFilters: _propTypes.default.func,
|
192
194
|
getFilterProps: _propTypes.default.func,
|
193
195
|
state: _propTypes.default.object
|
194
|
-
})
|
196
|
+
}),
|
197
|
+
title: _propTypes.default.string
|
195
198
|
};
|