@camunda/camunda-composite-components 0.20.2 → 0.20.3
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/lib/esm/package.json +27 -28
- package/lib/esm/src/api/clusters.js +1 -1
- package/lib/esm/src/api/endpoints.const.js +2 -0
- package/lib/esm/src/api/help-center.d.ts +1 -1
- package/lib/esm/src/api/status.js +1 -1
- package/lib/esm/src/assets/c3-icons.d.ts +4 -4
- package/lib/esm/src/assets/c3-icons.js +5 -14
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards.d.ts +1 -1
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards.js +10 -19
- package/lib/esm/src/components/c3-app-teaser/app-teaster-card.d.ts +1 -1
- package/lib/esm/src/components/c3-app-teaser/app-teaster-card.js +4 -8
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.d.ts +1 -1
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.js +2 -2
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser.d.ts +1 -1
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser.js +8 -9
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.d.ts +2 -1
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.js +9 -8
- package/lib/esm/src/components/c3-data-table/c3-data-table.js +84 -70
- package/lib/esm/src/components/c3-data-table/c3-data-table.types.d.ts +3 -2
- package/lib/esm/src/components/c3-data-table/link-button/link-button.js +2 -4
- package/lib/esm/src/components/c3-data-table/link-button/link-button.types.d.ts +0 -1
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.js +9 -29
- package/lib/esm/src/components/c3-help-center/c3-help-center-provider.js +3 -2
- package/lib/esm/src/components/c3-help-center/c3-help-center.js +3 -7
- package/lib/esm/src/components/c3-help-center/help-center-hint.d.ts +1 -1
- package/lib/esm/src/components/c3-help-center/help-center-hint.js +6 -10
- package/lib/esm/src/components/c3-help-center/help-center.d.ts +1 -1
- package/lib/esm/src/components/c3-help-center/help-center.js +69 -102
- package/lib/esm/src/components/c3-help-center/tabs/feedback.js +41 -89
- package/lib/esm/src/components/c3-help-center/tabs/tabContent.js +2 -5
- package/lib/esm/src/components/c3-help-center/tabs/tabContentSkeleton.js +4 -5
- package/lib/esm/src/components/c3-help-center/tile.js +16 -30
- package/lib/esm/src/components/c3-navigation/c3-info-button.d.ts +1 -1
- package/lib/esm/src/components/c3-navigation/c3-info-button.js +2 -3
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.d.ts +1 -1
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.js +9 -9
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/c3-navigation-appbar.js +72 -87
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/components.d.ts +1 -5
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/components.js +1 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.d.ts +1 -1
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.js +20 -28
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.d.ts +1 -1
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.js +23 -27
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.d.ts +1 -1
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.js +29 -37
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.js +18 -24
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.js +3 -2
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.js +13 -37
- package/lib/esm/src/components/c3-navigation/c3-navigation.js +78 -120
- package/lib/esm/src/components/c3-navigation/c3-navigation.types.d.ts +5 -6
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-container.d.ts +1 -1
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-container.js +10 -18
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-provider.js +4 -4
- package/lib/esm/src/components/c3-navigation/c3-org-name.js +2 -4
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/c3-org-sidebar.js +48 -60
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/components.js +23 -13
- package/lib/esm/src/components/c3-navigation/helpers.d.ts +2 -3
- package/lib/esm/src/components/c3-navigation/index.d.ts +1 -2
- package/lib/esm/src/components/c3-navigation/stories/story-helpers.js +3 -5
- package/lib/esm/src/components/c3-navigation/stories/story-templates.d.ts +1 -1
- package/lib/esm/src/components/c3-navigation/stories/story-templates.js +23 -29
- package/lib/esm/src/components/c3-onboarding-survey/c3-onboarding-survey.js +2 -1
- package/lib/esm/src/components/c3-onboarding-survey/elements/dropdownSelect.js +25 -38
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupMulti.js +45 -56
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupSingle.js +24 -34
- package/lib/esm/src/components/c3-onboarding-survey/elements/textField.js +4 -9
- package/lib/esm/src/components/c3-onboarding-survey/onboardingModal.d.ts +9 -9
- package/lib/esm/src/components/c3-onboarding-survey/onboardingModal.js +31 -42
- package/lib/esm/src/components/c3-onboarding-survey/onboardingPage.d.ts +9 -9
- package/lib/esm/src/components/c3-onboarding-survey/onboardingPage.js +27 -39
- package/lib/esm/src/components/c3-onboarding-survey/onboardingSurvey.js +9 -13
- package/lib/esm/src/components/c3-onboarding-survey/step.js +27 -27
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.js +8 -17
- package/lib/esm/src/components/c3-page/c3-page.js +2 -9
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.js +4 -5
- package/lib/esm/src/components/c3-responsive-stack/c3-responsive-stack.d.ts +2 -0
- package/lib/esm/src/components/c3-responsive-stack/c3-responsive-stack.js +13 -0
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.d.ts +1 -1
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.js +5 -4
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/carbon-theme-provider.js +3 -2
- package/lib/esm/src/components/c3-user-configuration/c3-user-configuration-provider.js +3 -4
- package/lib/esm/src/contexts/c3-cluster-update-manager.d.ts +1 -1
- package/lib/esm/src/contexts/c3-cluster-update-manager.js +3 -2
- package/lib/esm/src/hooks/useApi.d.ts +4 -5
- package/lib/esm/src/index.d.ts +1 -0
- package/lib/esm/src/index.js +1 -0
- package/package.json +20 -27
- package/README.md +0 -197
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
import { Button, CodeSnippet, DataTableSkeleton, Link, MultiSelect, OverflowMenu, OverflowMenuItem, Pagination, Table, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableToolbar, TableToolbarContent, TableToolbarSearch, Select, SelectItem, } from "@carbon/react";
|
|
2
3
|
import React, { useEffect, useRef, useState } from "react";
|
|
3
4
|
import { LinkButton } from "./link-button/link-button";
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
const ToolbarWrapper = styled(TableToolbarContent) `
|
|
7
|
+
@media (max-width: 768px) {
|
|
8
|
+
flex-wrap: wrap !important;
|
|
9
|
+
block-size: auto !important;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
4
12
|
const overrideHistoryMethods = (onChange) => {
|
|
5
13
|
const originalReplaceState = window.history.replaceState;
|
|
6
14
|
window.history.replaceState = function (...args) {
|
|
@@ -29,7 +37,7 @@ export const C3DataTable = ({ data, headers, options, toolbar: singleToolbar, to
|
|
|
29
37
|
actionsUseOverflowMenuMinItems: options?.actionsUseOverflowMenuMinItems || 3,
|
|
30
38
|
};
|
|
31
39
|
const headerKeys = headers.map((header) => header.key);
|
|
32
|
-
let component = (
|
|
40
|
+
let component = (_jsx(DataTableSkeleton, { headers: headers.map((header) => {
|
|
33
41
|
return { header: header.label };
|
|
34
42
|
}) }));
|
|
35
43
|
const [currentPage, setCurrentPage] = useState(1);
|
|
@@ -282,30 +290,30 @@ export const C3DataTable = ({ data, headers, options, toolbar: singleToolbar, to
|
|
|
282
290
|
if (toolbars && toolbars.length > 0) {
|
|
283
291
|
toolbars.forEach((toolbar, index) => {
|
|
284
292
|
let toolbarComponent = null;
|
|
293
|
+
let searchComponent = null;
|
|
285
294
|
const toolbarComponents = [];
|
|
286
295
|
if (toolbar && toolbar.length > 0) {
|
|
287
296
|
for (const toolbarElement of toolbar) {
|
|
288
297
|
if (toolbarElement.type === "singleSelect") {
|
|
289
298
|
const element = toolbarElement;
|
|
290
299
|
const defaultValue = currentFilters.current.get(element.id)?.selectedItem;
|
|
291
|
-
toolbarComponents.push(
|
|
292
|
-
React.createElement(Select, { size: "lg", id: element.id, inline: true, value: defaultValue ?? element.defaultValue, disabled: element.disabled, labelText: element.label, onChange: (event) => {
|
|
300
|
+
toolbarComponents.push(_jsx("div", { style: { width: "auto" }, children: _jsx(Select, { size: "lg", id: element.id, inline: true, value: defaultValue ?? element.defaultValue, disabled: element.disabled, labelText: element.label, onChange: (event) => {
|
|
293
301
|
currentFilters.current.set(element.id, {
|
|
294
302
|
selectedItem: event.target.value,
|
|
295
303
|
});
|
|
296
304
|
updateFilteredData();
|
|
297
305
|
updateFilterURLState(element.queryName ?? element.id, event.target.value);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
306
|
+
}, children: element.items?.map((item) => {
|
|
307
|
+
return (_jsx(SelectItem, { value: item.id, text: item.label }, item.id));
|
|
308
|
+
}) }) }, "toolbar-singleSelect"));
|
|
301
309
|
}
|
|
302
310
|
if (toolbarElement.type === "multiItemButton") {
|
|
303
311
|
const multiItemElement = toolbarElement;
|
|
304
|
-
toolbarComponents.push(
|
|
312
|
+
toolbarComponents.push(_jsx(Button, { onClick: () => {
|
|
305
313
|
multiItemElement.multiOnClick(inputData.filter((row) => selectedItems.includes(row.id)));
|
|
306
314
|
}, renderIcon: multiItemElement.icon, disabled: (multiItemElement.disabled &&
|
|
307
315
|
multiItemElement.disabled(inputData.filter((row) => selectedItems.includes(row.id)))) ||
|
|
308
|
-
selectedItems.length === 0, kind: multiItemElement.kind }, multiItemElement.
|
|
316
|
+
selectedItems.length === 0, kind: multiItemElement.kind, children: multiItemElement.label }, multiItemElement.id));
|
|
309
317
|
}
|
|
310
318
|
else if (toolbarElement.type === "multiSelect") {
|
|
311
319
|
const multiSelectElement = toolbarElement;
|
|
@@ -313,7 +321,7 @@ export const C3DataTable = ({ data, headers, options, toolbar: singleToolbar, to
|
|
|
313
321
|
const selectedItems = multiSelectElement.items?.filter((item) => {
|
|
314
322
|
return multiSelectItemsInFilter?.some((id) => item.id === id);
|
|
315
323
|
});
|
|
316
|
-
toolbarComponents.push(
|
|
324
|
+
toolbarComponents.push(_jsx(MultiSelect, { type: "inline", size: "lg", titleText: multiSelectElement?.label, useTitleInItem: true, hideLabel: true, label: multiSelectElement.label ?? "", id: multiSelectElement.id, items: multiSelectElement.items, selectedItems: selectedItems ?? [], onChange: ({ selectedItems }) => {
|
|
317
325
|
const value = selectedItems.map((item) => item.id);
|
|
318
326
|
currentFilters.current.set(multiSelectElement.id, {
|
|
319
327
|
id: multiSelectElement.id,
|
|
@@ -321,13 +329,13 @@ export const C3DataTable = ({ data, headers, options, toolbar: singleToolbar, to
|
|
|
321
329
|
});
|
|
322
330
|
updateFilteredData();
|
|
323
331
|
updateFilterURLState(multiSelectElement.queryName ?? multiSelectElement.id, value);
|
|
324
|
-
} }));
|
|
332
|
+
} }, multiSelectElement.id));
|
|
325
333
|
}
|
|
326
334
|
else if (toolbarElement.type === "search") {
|
|
327
335
|
const searchElement = toolbarElement;
|
|
328
336
|
const filterId = searchElement.id ?? searchElement.queryName;
|
|
329
337
|
const defaultValue = currentFilters.current.get(filterId);
|
|
330
|
-
|
|
338
|
+
searchComponent = (_jsx(TableToolbarSearch, { onFocus: (event, handleExpand) => {
|
|
331
339
|
handleExpand(event, true);
|
|
332
340
|
if (searchElement.queryName) {
|
|
333
341
|
updateFilterURLState(searchElement?.queryName, "");
|
|
@@ -342,21 +350,28 @@ export const C3DataTable = ({ data, headers, options, toolbar: singleToolbar, to
|
|
|
342
350
|
searchTerm: event.target?.value ?? defaultValue?.searchTerm,
|
|
343
351
|
});
|
|
344
352
|
updateFilteredData();
|
|
345
|
-
} }));
|
|
353
|
+
} }, searchElement.id));
|
|
346
354
|
}
|
|
347
355
|
else if (toolbarElement.type === "button") {
|
|
348
356
|
const buttonElement = toolbarElement;
|
|
349
|
-
toolbarComponents.push(
|
|
357
|
+
toolbarComponents.push(_jsx(Button, { id: buttonElement.id, onClick: async () => {
|
|
350
358
|
if (buttonElement.onClick) {
|
|
351
|
-
buttonElement.onClick();
|
|
359
|
+
await buttonElement.onClick();
|
|
352
360
|
}
|
|
353
|
-
}, renderIcon: buttonElement.icon, disabled: buttonElement.disabled, kind: buttonElement.kind }, buttonElement.
|
|
361
|
+
}, renderIcon: buttonElement.icon, disabled: buttonElement.disabled, kind: buttonElement.kind, children: buttonElement.label }, buttonElement.id));
|
|
354
362
|
}
|
|
355
363
|
}
|
|
356
364
|
}
|
|
357
|
-
if (toolbarComponents.length > 0) {
|
|
358
|
-
toolbarComponent = (
|
|
359
|
-
|
|
365
|
+
if (toolbarComponents.length > 0 || !!searchComponent) {
|
|
366
|
+
toolbarComponent = (_jsx(TableToolbar, { "aria-label": "data table toolbar", children: _jsxs(ToolbarWrapper, { style: {
|
|
367
|
+
justifyContent: toolbarComponents.length > 5 ? "normal" : "end",
|
|
368
|
+
flexWrap: toolbarComponents.length > 5 ? "wrap" : undefined,
|
|
369
|
+
blockSize: toolbarComponents.length > 5 ? "auto" : "3rem",
|
|
370
|
+
}, children: [searchComponent && (_jsx("div", { style: {
|
|
371
|
+
display: "flex",
|
|
372
|
+
justifyContent: "end",
|
|
373
|
+
width: toolbarComponents.length > 5 ? "420px" : "100%",
|
|
374
|
+
}, children: searchComponent })), toolbarComponents] }) }, `toolbarcomponent-${id}-${index}`));
|
|
360
375
|
}
|
|
361
376
|
toolbarRows.push(toolbarComponent);
|
|
362
377
|
});
|
|
@@ -370,25 +385,35 @@ export const C3DataTable = ({ data, headers, options, toolbar: singleToolbar, to
|
|
|
370
385
|
if (actions.filter((action) => action.visible === undefined || action.visible(row)).length < tableOptions.actionsUseOverflowMenuMinItems) {
|
|
371
386
|
for (const action of actions.filter((action) => action.visible === undefined || action.visible(row))) {
|
|
372
387
|
if (action.icon) {
|
|
373
|
-
actionCell.push(
|
|
388
|
+
actionCell.push(_jsx(Button, { "data-cy": action.id, kind: action.kind, disabled: action.disabled !== undefined
|
|
374
389
|
? action.disabled(row)
|
|
375
|
-
: undefined, iconDescription: action.label
|
|
390
|
+
: undefined, iconDescription: typeof action.label === "function"
|
|
391
|
+
? action.label(row)
|
|
392
|
+
: action.label, hasIconOnly: true, renderIcon: typeof action.icon === "function"
|
|
393
|
+
? action.icon(row)
|
|
394
|
+
: action.icon, onClick: (event) => action.onClick(row, event) }, action.id));
|
|
376
395
|
}
|
|
377
396
|
else {
|
|
378
|
-
actionCell.push(
|
|
397
|
+
actionCell.push(_jsx(Button, { "data-cy": action.id, kind: action.kind, disabled: action.disabled !== undefined
|
|
379
398
|
? action.disabled(row)
|
|
380
|
-
: undefined, "aria-label": action.label
|
|
399
|
+
: undefined, "aria-label": typeof action.label === "function"
|
|
400
|
+
? action.label(row)
|
|
401
|
+
: action.label, onClick: (event) => action.onClick(row, event), children: typeof action.label === "function"
|
|
402
|
+
? action.label(row)
|
|
403
|
+
: action.label }, action.id));
|
|
381
404
|
}
|
|
382
405
|
}
|
|
383
406
|
}
|
|
384
407
|
else {
|
|
385
408
|
const overflowMenuItems = [];
|
|
386
409
|
for (const action of actions.filter((action) => action.visible === undefined || action.visible(row))) {
|
|
387
|
-
overflowMenuItems.push(
|
|
410
|
+
overflowMenuItems.push(_jsx(OverflowMenuItem, { itemText: typeof action.label === "function"
|
|
411
|
+
? action.label(row)
|
|
412
|
+
: action.label, isDelete: action.kind === "danger", disabled: action.disabled !== undefined
|
|
388
413
|
? action.disabled(row)
|
|
389
|
-
: undefined, onClick: (event) => action.onClick(row, event), hasDivider: action.hasDivider }));
|
|
414
|
+
: undefined, onClick: (event) => action.onClick(row, event), hasDivider: action.hasDivider }, action.id));
|
|
390
415
|
}
|
|
391
|
-
actionCell.push(
|
|
416
|
+
actionCell.push(_jsx(OverflowMenu, { flipped: true, children: overflowMenuItems }, "overflow-menu"));
|
|
392
417
|
}
|
|
393
418
|
}
|
|
394
419
|
return actionCell;
|
|
@@ -396,19 +421,14 @@ export const C3DataTable = ({ data, headers, options, toolbar: singleToolbar, to
|
|
|
396
421
|
// ==== CONTENT ====
|
|
397
422
|
const hasExpansion = getDataForCurrentPage().find((row) => row.expansion) !== undefined;
|
|
398
423
|
const renderHeaders = () => {
|
|
399
|
-
let regularHeaders = headers.map((header) => (
|
|
424
|
+
let regularHeaders = headers.map((header) => (_jsx(TableHeader, { isSortable: header.sorting !== undefined, sortDirection: currentSortDirection(header.key), isSortHeader: header.sorting !== undefined, onClick: () => updateSortDirection(header.key), children: header.label }, header.key)));
|
|
400
425
|
if (allToolbarItems?.find((toolbarItem) => toolbarItem.type === "multiItemButton")) {
|
|
401
426
|
regularHeaders = [
|
|
402
|
-
|
|
427
|
+
_jsx(TableSelectAll, { checked: selectedItems.length >= currentPageSize, indeterminate: selectedItems.length > 0 && selectedItems.length < currentPageSize, onSelect: () => toggleSelectAllOnPage(), id: "allcluster-select-all", name: "multi-select-all-header" }, "allcluster-select-all"),
|
|
403
428
|
...regularHeaders,
|
|
404
429
|
];
|
|
405
430
|
}
|
|
406
|
-
return (
|
|
407
|
-
hasExpansion && (React.createElement(TableExpandHeader, null,
|
|
408
|
-
React.createElement("span", { style: { height: "0px", width: "0px", fontSize: "0px" } }, "expand"))),
|
|
409
|
-
regularHeaders,
|
|
410
|
-
hasActions && (React.createElement(TableHeader, null,
|
|
411
|
-
React.createElement("span", { style: { height: "0px", width: "0px", fontSize: "0px" } }, "actions")))));
|
|
431
|
+
return (_jsxs(_Fragment, { children: [hasExpansion && (_jsx(TableExpandHeader, { children: _jsx("span", { style: { height: "0px", width: "0px", fontSize: "0px" }, children: "expand" }) })), regularHeaders, hasActions && (_jsx(TableHeader, { style: { textAlign: "right" }, children: _jsx("span", { style: { height: "0px", width: "0px", fontSize: "0px" }, children: "actions" }) }))] }));
|
|
412
432
|
};
|
|
413
433
|
const someSelectRow = allToolbarItems?.some((toolBarItem) => toolBarItem.type === "multiItemButton");
|
|
414
434
|
const renderRow = (row) => {
|
|
@@ -419,54 +439,54 @@ export const C3DataTable = ({ data, headers, options, toolbar: singleToolbar, to
|
|
|
419
439
|
if (foundHeader?.type) {
|
|
420
440
|
switch (foundHeader.type.type) {
|
|
421
441
|
case "code":
|
|
422
|
-
content = (
|
|
423
|
-
"inline"
|
|
442
|
+
content = (_jsx(CodeSnippet, { type: foundHeader.type.options?.codeOptions?.type ??
|
|
443
|
+
"inline", children: defaultContent }));
|
|
424
444
|
break;
|
|
425
445
|
case "link":
|
|
426
|
-
content = (
|
|
446
|
+
content = (_jsx(Link, { href: foundHeader.type.options.linkOptions.href(row), target: foundHeader.type.options.linkOptions?.target ?? "_self", children: defaultContent }));
|
|
427
447
|
break;
|
|
428
448
|
case "link-button":
|
|
429
|
-
|
|
449
|
+
if (foundHeader.type.options.linkButtonOptions.disabled &&
|
|
450
|
+
foundHeader.type.options.linkButtonOptions.disabled(row)) {
|
|
451
|
+
content = _jsx("strong", { children: defaultContent });
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
content = (_jsx(LinkButton, { label: defaultContent, onClick: () => foundHeader.type.options.linkButtonOptions.onClick(row) }));
|
|
455
|
+
}
|
|
430
456
|
break;
|
|
431
457
|
case "wrapper":
|
|
432
458
|
content = foundHeader.type.options.wrapperOptions.wrapper(row);
|
|
433
459
|
break;
|
|
434
460
|
}
|
|
435
461
|
}
|
|
436
|
-
return (
|
|
462
|
+
return (_jsx(TableCell, { onClick: row.onClick ? () => row.onClick() : undefined, style: { cursor: row.onClick ? "pointer" : undefined }, children: content }, `${row.id}-${key}`));
|
|
437
463
|
};
|
|
438
|
-
let rowComponent = (
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
hasActions && (React.createElement(TableCell, { style: { textAlign: "right" } },
|
|
448
|
-
React.createElement("div", { style: {
|
|
449
|
-
display: "flex",
|
|
450
|
-
alignItems: "center",
|
|
451
|
-
} }, renderActions(row))))));
|
|
464
|
+
let rowComponent = (_jsxs(TableRow, { children: [hasExpansion && someSelectRow && (_jsx(TableCell, { className: "cds--table-expand" })), allToolbarItems?.find((toolBarItem) => toolBarItem.type === "multiItemButton") && (_jsx(TableSelectRow, { "aria-label": `select all ${row.id}`, checked: itemIsSelected(row.id), name: `multiselect-row-${row.id}`, id: `multiselect-row-${row.id}`, onSelect: () => {
|
|
465
|
+
toggleSelectedItem(row.id);
|
|
466
|
+
} })), hasExpansion && !row.expansion && !someSelectRow && _jsx(TableCell, {}), headerKeys.map((key) => {
|
|
467
|
+
return rowCell(key);
|
|
468
|
+
}), hasActions && (_jsx(TableCell, { children: _jsx("div", { style: {
|
|
469
|
+
display: "flex",
|
|
470
|
+
justifyContent: "flex-end",
|
|
471
|
+
alignItems: "center",
|
|
472
|
+
}, children: renderActions(row) }) }))] }, `${row.id}-${row.originalIndex}`));
|
|
452
473
|
if (row.expansion) {
|
|
453
|
-
rowComponent = (
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
React.createElement(TableExpandedRow, { colSpan: headers.length + (hasActions ? 2 : 1) }, row.expansion)));
|
|
474
|
+
rowComponent = (_jsxs(React.Fragment, { children: [_jsxs(TableExpandRow, { isExpanded: isRowExpanded(row), "aria-label": `row ${row.id}`, onExpand: () => {
|
|
475
|
+
updateRowExpansion(row);
|
|
476
|
+
}, children: [someSelectRow && (_jsx(TableSelectRow, { "aria-label": `select all ${row.id}`, checked: itemIsSelected(row.id), name: `multiselect-row-${row.id}`, id: `multiselect-row-${row.id}`, onSelect: () => {
|
|
477
|
+
toggleSelectedItem(row.id);
|
|
478
|
+
} })), headerKeys.map((key) => rowCell(key)), hasActions && (_jsx(TableCell, { children: _jsx("div", { style: {
|
|
479
|
+
display: "flex",
|
|
480
|
+
justifyContent: "flex-end",
|
|
481
|
+
alignItems: "center",
|
|
482
|
+
}, children: renderActions(row) }) }))] }, row.id), _jsx(TableExpandedRow, { colSpan: headers.length + (hasActions ? 2 : 1), children: row.expansion })] }, row.id));
|
|
463
483
|
}
|
|
464
484
|
return rowComponent;
|
|
465
485
|
};
|
|
466
486
|
// ==== PAGINATION ====
|
|
467
487
|
let paginationComponent = null;
|
|
468
488
|
if (tableOptions.showPagination) {
|
|
469
|
-
paginationComponent = (
|
|
489
|
+
paginationComponent = (_jsx(Pagination, { page: currentPage, totalItems: filteredData.length, pageSize: currentPageSize, pageSizes: tableOptions.pageSizes, onChange: (event) => {
|
|
470
490
|
const { page, pageSize } = event;
|
|
471
491
|
setCurrentPage(page);
|
|
472
492
|
setCurrentPageSize(pageSize);
|
|
@@ -474,13 +494,7 @@ export const C3DataTable = ({ data, headers, options, toolbar: singleToolbar, to
|
|
|
474
494
|
} }));
|
|
475
495
|
}
|
|
476
496
|
// ==== RENDER ====
|
|
477
|
-
component = (
|
|
478
|
-
toolbarRows.map((toolbarComponent) => toolbarComponent),
|
|
479
|
-
React.createElement(Table, { size: tableOptions.tableSize, useZebraStyles: tableOptions.useZebraStyles, key: `table-${id}` },
|
|
480
|
-
React.createElement(TableHead, { key: `tablehead-${id}` },
|
|
481
|
-
React.createElement(TableRow, { key: `tablerow-${id}` }, renderHeaders())),
|
|
482
|
-
React.createElement(TableBody, { key: `tablebody-${id}` }, getDataForCurrentPage().map((row) => renderRow(row)))),
|
|
483
|
-
paginationComponent));
|
|
497
|
+
component = (_jsxs(TableContainer, { title: title, description: description, children: [toolbarRows.map((toolbarComponent) => toolbarComponent), _jsxs(Table, { size: tableOptions.tableSize, useZebraStyles: tableOptions.useZebraStyles, children: [_jsx(TableHead, { children: _jsx(TableRow, { children: renderHeaders() }, `tablerow-${id}`) }, `tablehead-${id}`), _jsx(TableBody, { children: getDataForCurrentPage().map((row) => renderRow(row)) }, `tablebody-${id}`)] }, `table-${id}`), paginationComponent] }, `tablecontainer-${id}`));
|
|
484
498
|
}
|
|
485
499
|
return component;
|
|
486
500
|
};
|
|
@@ -58,8 +58,8 @@ export interface C3DataTableToolbarMultiItemButtonProps<T extends RowBaseProps>
|
|
|
58
58
|
export interface C3DataTableActionProps<T extends RowBaseProps> {
|
|
59
59
|
id: string;
|
|
60
60
|
kind: any;
|
|
61
|
-
label: string;
|
|
62
|
-
icon?: any;
|
|
61
|
+
label: ((row: T) => string) | string;
|
|
62
|
+
icon?: ((row: T) => any) | any;
|
|
63
63
|
disabled?: (row: T) => boolean;
|
|
64
64
|
visible?: (row: T) => boolean;
|
|
65
65
|
hasDivider?: boolean;
|
|
@@ -77,6 +77,7 @@ export interface C3DataTableHeaderContentType<T extends RowBaseProps> {
|
|
|
77
77
|
};
|
|
78
78
|
linkButtonOptions?: {
|
|
79
79
|
onClick: (row: T) => void;
|
|
80
|
+
disabled?: (row: T) => boolean;
|
|
80
81
|
};
|
|
81
82
|
wrapperOptions?: {
|
|
82
83
|
wrapper: (row: T) => React.ReactNode;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { Link } from "@carbon/react";
|
|
2
|
-
import React from "react";
|
|
3
3
|
export const LinkButton = ({ label, onClick, style, inline, icon, disabled, }) => {
|
|
4
4
|
if (disabled === undefined) {
|
|
5
5
|
disabled = false;
|
|
6
6
|
}
|
|
7
7
|
const customStyle = style ? style : {};
|
|
8
|
-
const component = (
|
|
9
|
-
label,
|
|
10
|
-
icon && (React.createElement("span", { style: { marginLeft: "0.5rem", marginBottom: "-0.2rem" } }, icon))));
|
|
8
|
+
const component = (_jsxs(Link, { onClick: () => !disabled && onClick(), inline: inline, style: { cursor: "pointer", ...customStyle }, disabled: disabled, children: [label, icon && (_jsx("span", { style: { marginLeft: "0.5rem", marginBottom: "-0.2rem" }, children: icon }))] }));
|
|
11
9
|
return component;
|
|
12
10
|
};
|
|
@@ -1,30 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { Stack, Tile, Button, Link, MenuButton, MenuItem } from "@carbon/react";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
export const C3EmptyState = ({ icon, heading, description, button, link, }) => (React.createElement(Tile, { style: {
|
|
14
|
-
paddingLeft: "5rem",
|
|
15
|
-
paddingTop: "3rem",
|
|
16
|
-
paddingBottom: "3rem",
|
|
17
|
-
} },
|
|
18
|
-
React.createElement(ResponsiveStack, { orientation: "horizontal", gap: "1.5rem" },
|
|
19
|
-
icon && (React.createElement("div", { style: { maxWidth: "80px" } },
|
|
20
|
-
React.createElement("img", { src: icon.path, alt: icon.altText, style: { width: "100%" } }))),
|
|
21
|
-
React.createElement(Stack, { gap: 3 },
|
|
22
|
-
React.createElement("h2", null, heading),
|
|
23
|
-
React.createElement(Stack, { gap: 6 },
|
|
24
|
-
React.createElement("p", { style: { maxWidth: "400px" } }, description),
|
|
25
|
-
React.createElement(Stack, { gap: 5 },
|
|
26
|
-
button && (React.createElement(React.Fragment, null, "items" in button ? (React.createElement(MenuButton, { size: "md", disabled: button.disabled, label: button.label, menuAlignment: "bottom" }, button.items.map((menuItem) => {
|
|
27
|
-
return (React.createElement(MenuItem, { key: menuItem.id, onClick: menuItem.onClick, renderIcon: menuItem.icon, disabled: menuItem.disabled, label: menuItem.label }));
|
|
28
|
-
}))) : (React.createElement(Button, { id: button.id, size: "md", onClick: button.onClick, renderIcon: button.icon, disabled: button.disabled }, button.label)))),
|
|
29
|
-
link && (React.createElement("div", null,
|
|
30
|
-
React.createElement(Link, { target: "_blank", href: link.href, onClick: link.onClick }, link.label)))))))));
|
|
3
|
+
import { C3ResponsiveStack } from "../c3-responsive-stack/c3-responsive-stack";
|
|
4
|
+
export const C3EmptyState = ({ icon, heading, description, button, link, }) => (_jsx(_Fragment, { children: _jsx(Tile, { style: {
|
|
5
|
+
paddingLeft: "5rem",
|
|
6
|
+
paddingTop: "3rem",
|
|
7
|
+
paddingBottom: "3rem",
|
|
8
|
+
}, children: _jsxs(C3ResponsiveStack, { orientation: "horizontal", gap: "1.5rem", children: [icon && (_jsx("div", { style: { maxWidth: "80px" }, children: _jsx("img", { src: icon.path, alt: icon.altText, style: { width: "100%" } }) })), _jsxs(Stack, { gap: 3, children: [_jsx("h2", { children: heading }), _jsxs(Stack, { gap: 6, children: [_jsx("p", { style: { maxWidth: "400px" }, children: description }), _jsxs(Stack, { gap: 5, children: [button && (_jsx(_Fragment, { children: "items" in button ? (_jsx(MenuButton, { size: "md", disabled: button.disabled, label: button.label, menuAlignment: "bottom", children: button.items.map((menuItem) => {
|
|
9
|
+
return (_jsx(MenuItem, { onClick: menuItem.onClick, renderIcon: menuItem.icon, disabled: menuItem.disabled, label: menuItem.label }, menuItem.id));
|
|
10
|
+
}) })) : (_jsx(Button, { id: button.id, size: "md", onClick: button.onClick, renderIcon: button.icon, disabled: button.disabled, children: button.label })) })), link && (_jsx("div", { children: _jsx(Link, { target: "_blank", href: link.href, onClick: link.onClick, children: link.label }) }))] })] })] })] }) }) }));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { useCallback, useEffect, useRef, useState, } from "react";
|
|
2
3
|
import { getConfig, getOnboardingConfig, getTiles } from "../../api/help-center";
|
|
3
4
|
import { useC3UserConfiguration } from "../c3-user-configuration/c3-user-configuration-provider";
|
|
@@ -141,7 +142,7 @@ export const C3HelpCenterProvider = ({ children }) => {
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
}, [isHelpCenterOpen]);
|
|
144
|
-
return (
|
|
145
|
+
return (_jsx(C3HelpCenterContext.Provider, { value: {
|
|
145
146
|
openHelpCenter,
|
|
146
147
|
setIsHelpCenterOpen,
|
|
147
148
|
isHelpCenterOpen,
|
|
@@ -163,6 +164,6 @@ export const C3HelpCenterProvider = ({ children }) => {
|
|
|
163
164
|
isLoadingOnboardingConfig,
|
|
164
165
|
updateAutoStartSurvey,
|
|
165
166
|
getOnboadingSurveyConfig,
|
|
166
|
-
}
|
|
167
|
+
}, children: children }));
|
|
167
168
|
};
|
|
168
169
|
export const useC3HelpCenter = () => React.useContext(C3HelpCenterContext);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { ActionableNotification, ComposedModal, Layer, ModalBody, ModalHeader, } from "@carbon/react";
|
|
2
3
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
3
4
|
import { HelpCenter } from "./help-center";
|
|
@@ -169,12 +170,7 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, mixpanelTrack: cu
|
|
|
169
170
|
setShowSurvey(false);
|
|
170
171
|
}, 400);
|
|
171
172
|
};
|
|
172
|
-
return (
|
|
173
|
-
React.createElement(StyledComposedModal, { open: isOpen, size: "lg", onClose: closeFn, className: "help-center", "aria-label": "HelpCenter", style: showSurvey || !persona?.wasShown
|
|
173
|
+
return (_jsx(Layer, { children: _jsx(StyledComposedModal, { open: isOpen, size: "lg", onClose: closeFn, className: "help-center", "aria-label": "HelpCenter", style: showSurvey || !persona?.wasShown
|
|
174
174
|
? { backgroundColor: "rgba(22,22,22, 0.8)" }
|
|
175
|
-
: {} },
|
|
176
|
-
React.createElement(ErrorBoundary, { fallbackRender: () => (React.createElement(React.Fragment, null,
|
|
177
|
-
React.createElement(ModalHeader, { title: "Help Center", closeModal: closeFn }),
|
|
178
|
-
React.createElement(ModalBody, null,
|
|
179
|
-
React.createElement(ActionableNotification, { inline: true, hideCloseButton: true, lowContrast: true, kind: "error", title: "Something went wrong.", subtitle: "Try reloading the page.", actionButtonLabel: "Reload", onActionButtonClick: () => window.location.reload() })))) }, showSurvey || (persona && !persona?.wasShown) ? (React.createElement(C3OnboardingSurvey, { personaCallback: personaCallback, persona: persona, mixpanelTrack: mixpanelTrack, onRequestClose: closeFn, onRequestSkip: onRequestSkipSurvey, theme: resolvedTheme, origin: hostApp, modal: true })) : (React.createElement(HelpCenter, { configuration: helpCenterConfig, persona: persona ?? {}, audience: decodedAudience || "", flags: flags, onRequestResumeSurvey: onRequestResumeSurvey, onRequestRetakeSurvey: onRequestRetakeSurvey, onRequestClose: closeFn, mixpanelTrack: mixpanelTrack, email: email, theme: resolvedTheme, origin: hostApp, initialTab: activeTab }))))));
|
|
175
|
+
: {}, children: _jsx(ErrorBoundary, { fallbackRender: () => (_jsxs(_Fragment, { children: [_jsx(ModalHeader, { title: "Help Center", closeModal: closeFn }), _jsx(ModalBody, { children: _jsx(ActionableNotification, { inline: true, hideCloseButton: true, lowContrast: true, kind: "error", title: "Something went wrong.", subtitle: "Try reloading the page.", actionButtonLabel: "Reload", onActionButtonClick: () => window.location.reload() }) })] })), children: showSurvey || (persona && !persona?.wasShown) ? (_jsx(C3OnboardingSurvey, { personaCallback: personaCallback, persona: persona, mixpanelTrack: mixpanelTrack, onRequestClose: closeFn, onRequestSkip: onRequestSkipSurvey, theme: resolvedTheme, origin: hostApp, modal: true })) : (_jsx(HelpCenter, { configuration: helpCenterConfig, persona: persona ?? {}, audience: decodedAudience || "", flags: flags, onRequestResumeSurvey: onRequestResumeSurvey, onRequestRetakeSurvey: onRequestRetakeSurvey, onRequestClose: closeFn, mixpanelTrack: mixpanelTrack, email: email, theme: resolvedTheme, origin: hostApp, initialTab: activeTab })) }) }) }));
|
|
180
176
|
};
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// React import not required with automatic JSX runtime
|
|
2
3
|
import { Button, Toggletip, ToggletipActions, ToggletipContent, } from "@carbon/react";
|
|
3
4
|
import { HelpCenterHintType, useC3HelpCenter } from "./c3-help-center-provider";
|
|
4
5
|
export const HelpCenterHint = ({ children }) => {
|
|
5
6
|
const { showHint, setShowHint, hintType } = useC3HelpCenter();
|
|
6
|
-
return showHint ? (
|
|
7
|
+
return showHint ? (_jsxs(Toggletip, { defaultOpen: true,
|
|
7
8
|
// eslint-disable-next-line
|
|
8
9
|
// @ts-ignore
|
|
9
|
-
align: "bottom-right"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
React.createElement("p", null, hintType === HelpCenterHintType.HelpCenter
|
|
13
|
-
? "Access the Help Center at any time to see your recommendations, discover guides, tutorials, or to share feedback."
|
|
14
|
-
: "Access the onboarding survey from the Help Center to get personalized next steps and educational content."),
|
|
15
|
-
React.createElement(ToggletipActions, null,
|
|
16
|
-
React.createElement(Button, { size: "sm", onClick: () => setShowHint(false) }, "Got it"))))) : (children);
|
|
10
|
+
align: "bottom-right", children: [children, _jsxs(ToggletipContent, { children: [_jsx("p", { children: hintType === HelpCenterHintType.HelpCenter
|
|
11
|
+
? "Access the Help Center at any time to see your recommendations, discover guides, tutorials, or to share feedback."
|
|
12
|
+
: "Access the onboarding survey from the Help Center to get personalized next steps and educational content." }), _jsx(ToggletipActions, { children: _jsx(Button, { size: "sm", onClick: () => setShowHint(false), children: "Got it" }) })] })] })) : (children);
|
|
17
13
|
};
|