@bigmath-ui-library/core 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/LICENSE.md +1 -0
- package/README.md +42 -0
- package/dist/cjs/index.css +11 -0
- package/dist/cjs/index.js +134365 -0
- package/dist/esm/index.css +11 -0
- package/dist/esm/index.js +134258 -0
- package/package.json +58 -0
- package/rollup.config.js +73 -0
- package/src/BMClassnameSetup.ts +3 -0
- package/src/assets/icons/Calendar.svg +6 -0
- package/src/assets/icons/Close.svg +40 -0
- package/src/assets/icons/Default-Loading-Circles.svg +31 -0
- package/src/assets/icons/alert.svg +6 -0
- package/src/assets/icons/aws.svg +19 -0
- package/src/assets/icons/caret-down.svg +3 -0
- package/src/assets/icons/check.svg +6 -0
- package/src/assets/icons/circle-check-solid.svg +7 -0
- package/src/assets/icons/circle-check.svg +6 -0
- package/src/assets/icons/circle-selected.svg +3 -0
- package/src/assets/icons/circle-unselected.svg +3 -0
- package/src/assets/icons/close-basic.svg +3 -0
- package/src/assets/icons/close_collapse.svg +3 -0
- package/src/assets/icons/copy.svg +3 -0
- package/src/assets/icons/drag.svg +3 -0
- package/src/assets/icons/expand-more.svg +3 -0
- package/src/assets/icons/failed-solid.svg +7 -0
- package/src/assets/icons/globe.svg +3 -0
- package/src/assets/icons/google-cloud.svg +6 -0
- package/src/assets/icons/in-active.svg +4 -0
- package/src/assets/icons/info-solid.svg +6 -0
- package/src/assets/icons/info.svg +6 -0
- package/src/assets/icons/k8s.svg +4 -0
- package/src/assets/icons/lock-locked.svg +5 -0
- package/src/assets/icons/microsoft-azure.svg +9 -0
- package/src/assets/icons/onprem.svg +3 -0
- package/src/assets/icons/pencil.svg +3 -0
- package/src/assets/icons/search.svg +6 -0
- package/src/assets/icons/shield.svg +4 -0
- package/src/assets/icons/star.svg +3 -0
- package/src/assets/icons/success-tick.svg +3 -0
- package/src/assets/icons/timer.svg +3 -0
- package/src/assets/icons/visibility-off.svg +6 -0
- package/src/assets/icons/visibility.svg +6 -0
- package/src/assets/icons/warning.svg +6 -0
- package/src/bma/components/BMButton/BMButton.tsx +34 -0
- package/src/bma/components/BMButton/index.ts +1 -0
- package/src/bma/components/BMInput/BMInput.tsx +13 -0
- package/src/bma/components/BMInput/BMInputField.tsx +7 -0
- package/src/bma/components/BMInput/BMSearch.tsx +6 -0
- package/src/bma/components/BMInput/index.ts +3 -0
- package/src/bma/index.ts +3 -0
- package/src/bma/package.json +4 -0
- package/src/bma/theme/BMAutocomplete.ts +12 -0
- package/src/bma/theme/BMInput.ts +46 -0
- package/src/bma/theme/theme.ts +15 -0
- package/src/bma/theme/themeUtils.ts +10 -0
- package/src/components/BMAccordion/BMAccordion.tsx +150 -0
- package/src/components/BMAccordion/index.ts +1 -0
- package/src/components/BMAddSection/BMAddSection.tsx +38 -0
- package/src/components/BMAddSection/index.ts +1 -0
- package/src/components/BMAlert/BMAlert.tsx +168 -0
- package/src/components/BMAlert/index.ts +1 -0
- package/src/components/BMAutoComplete/BMAutoComplete.tsx +86 -0
- package/src/components/BMAutoComplete/index.ts +1 -0
- package/src/components/BMAvatar/BMAvatar.tsx +45 -0
- package/src/components/BMAvatar/index.ts +1 -0
- package/src/components/BMButton/BMButton.tsx +46 -0
- package/src/components/BMButton/BMButtonGroup.tsx +46 -0
- package/src/components/BMButton/BMSplitButton.tsx +72 -0
- package/src/components/BMButton/index.ts +3 -0
- package/src/components/BMCheckbox/BMCheckbox.tsx +44 -0
- package/src/components/BMCheckbox/BMCheckboxField.tsx +41 -0
- package/src/components/BMCheckbox/index.ts +2 -0
- package/src/components/BMCloudSelect/BMCloudList.tsx +43 -0
- package/src/components/BMCloudSelect/BMCloudSelect.tsx +109 -0
- package/src/components/BMCloudSelect/BMCloudSelectField.tsx +46 -0
- package/src/components/BMCloudSelect/index.ts +3 -0
- package/src/components/BMCodeBlock/BMCodeBlock.tsx +233 -0
- package/src/components/BMCodeBlock/index.ts +1 -0
- package/src/components/BMDatePicker/BMDatePicker.tsx +187 -0
- package/src/components/BMDatePicker/index.ts +1 -0
- package/src/components/BMDropdown/BMDropdown.tsx +107 -0
- package/src/components/BMDropdown/index.ts +1 -0
- package/src/components/BMForm/BMFormControlLabel.tsx +23 -0
- package/src/components/BMForm/BMLabel.tsx +24 -0
- package/src/components/BMForm/index.ts +2 -0
- package/src/components/BMHelloBanner/BMHelloBanner.tsx +68 -0
- package/src/components/BMHelloBanner/index.ts +1 -0
- package/src/components/BMInput/BMInput.tsx +31 -0
- package/src/components/BMInput/BMInputEditableCode.tsx +120 -0
- package/src/components/BMInput/BMInputField.tsx +37 -0
- package/src/components/BMInput/BMSearch.tsx +17 -0
- package/src/components/BMInput/BMStripeInput.tsx +24 -0
- package/src/components/BMInput/index.ts +5 -0
- package/src/components/BMLoadingBox/BMLoadingBox.tsx +45 -0
- package/src/components/BMLoadingBox/index.ts +1 -0
- package/src/components/BMMaps/BMMapMarker.css +12 -0
- package/src/components/BMMaps/BMMapMarker.tsx +68 -0
- package/src/components/BMMaps/BMMaps.tsx +129 -0
- package/src/components/BMMaps/MapIcons.tsx +83 -0
- package/src/components/BMMaps/icons/GeoPartition.svg +19 -0
- package/src/components/BMMaps/icons/GeoPartitionHover.svg +20 -0
- package/src/components/BMMaps/icons/MasterPreferred.svg +19 -0
- package/src/components/BMMaps/icons/MasterPreferredHover.svg +20 -0
- package/src/components/BMMaps/icons/ReadReplica.svg +18 -0
- package/src/components/BMMaps/icons/ReadReplicaHover.svg +19 -0
- package/src/components/BMMaps/icons/RegionNotSelected.svg +18 -0
- package/src/components/BMMaps/icons/RegionNotSelectedHover.svg +19 -0
- package/src/components/BMMaps/icons/RegionPreferred.svg +18 -0
- package/src/components/BMMaps/icons/RegionPreferredHover.svg +19 -0
- package/src/components/BMMaps/icons/RegionSelected.svg +18 -0
- package/src/components/BMMaps/icons/RegionSelectedHover.svg +19 -0
- package/src/components/BMMaps/index.ts +5 -0
- package/src/components/BMMaps/legend/MapLegend.tsx +80 -0
- package/src/components/BMMaps/markerTypes.ts +8 -0
- package/src/components/BMModal/BMModal.tsx +313 -0
- package/src/components/BMModal/index.ts +1 -0
- package/src/components/BMMultiEntry/BMMultiEntry.tsx +328 -0
- package/src/components/BMMultiEntry/BMMultiEntryField.tsx +47 -0
- package/src/components/BMMultiEntry/index.ts +2 -0
- package/src/components/BMMultiLevelStepper/BMMultiLevelStepper.tsx +191 -0
- package/src/components/BMMultiLevelStepper/index.ts +1 -0
- package/src/components/BMPagination/BMPagination.tsx +64 -0
- package/src/components/BMPagination/index.ts +1 -0
- package/src/components/BMPassword/BMPassword.tsx +37 -0
- package/src/components/BMPassword/BMPasswordField.tsx +50 -0
- package/src/components/BMPassword/index.ts +2 -0
- package/src/components/BMProgress/BMProgress.tsx +43 -0
- package/src/components/BMProgress/index.ts +1 -0
- package/src/components/BMRadio/BMRadio.tsx +162 -0
- package/src/components/BMRadio/BMRadioGroupField.tsx +40 -0
- package/src/components/BMRadio/index.ts +2 -0
- package/src/components/BMSelect/BMSelect.tsx +70 -0
- package/src/components/BMSelect/BMSelectField.tsx +47 -0
- package/src/components/BMSelect/index.ts +2 -0
- package/src/components/BMSlider/BMSlider.tsx +16 -0
- package/src/components/BMSlider/index.ts +1 -0
- package/src/components/BMSmartStatus/BMSmartStatus.tsx +185 -0
- package/src/components/BMSmartStatus/index.tsx +1 -0
- package/src/components/BMStatus/BMStatus.tsx +98 -0
- package/src/components/BMStatus/index.ts +1 -0
- package/src/components/BMTable/BMTable.tsx +131 -0
- package/src/components/BMTable/index.ts +1 -0
- package/src/components/BMTabs/BMTabs.tsx +50 -0
- package/src/components/BMTabs/index.ts +1 -0
- package/src/components/BMTag/BMTag.tsx +47 -0
- package/src/components/BMTag/index.ts +1 -0
- package/src/components/BMTagv2/BMTagv2.tsx +250 -0
- package/src/components/BMTagv2/index.ts +1 -0
- package/src/components/BMToggle/BMMultiToggleButton.tsx +99 -0
- package/src/components/BMToggle/BMToggle.tsx +35 -0
- package/src/components/BMToggle/BMToggleField.tsx +28 -0
- package/src/components/BMToggle/index.ts +3 -0
- package/src/components/BMTooltip/BMTooltip.tsx +52 -0
- package/src/components/BMTooltip/index.ts +1 -0
- package/src/components/BMWarning/BMWarning.tsx +39 -0
- package/src/components/BMWarning/index.ts +1 -0
- package/src/components/GenericFailure/GenericFailure.tsx +28 -0
- package/src/components/GenericFailure/index.ts +1 -0
- package/src/components/NoAccess/NoAccess.tsx +40 -0
- package/src/components/NoAccess/NoAccessActionTooltip.tsx +53 -0
- package/src/components/NoAccess/NoPermissionModal.tsx +55 -0
- package/src/components/NoAccess/index.ts +3 -0
- package/src/components/index.ts +34 -0
- package/src/index.ts +9 -0
- package/src/theme/BMAutoComplete.ts +152 -0
- package/src/theme/BMAvatar.ts +5 -0
- package/src/theme/BMButton.ts +132 -0
- package/src/theme/BMButtonGroup.ts +49 -0
- package/src/theme/BMCheckbox.ts +16 -0
- package/src/theme/BMFormHelperText.ts +19 -0
- package/src/theme/BMInput.ts +120 -0
- package/src/theme/BMMaps.ts +9 -0
- package/src/theme/BMRadio.ts +10 -0
- package/src/theme/BMTabs.ts +79 -0
- package/src/theme/BMTag.ts +28 -0
- package/src/theme/BMToggle.ts +50 -0
- package/src/theme/BMTooltip.ts +34 -0
- package/src/theme/theme.ts +326 -0
- package/src/theme/variables.ts +152 -0
- package/src/types/custom.d.ts +9 -0
- package/src/types/svg.d.ts +5 -0
- package/stories/BMAButton.stories.tsx +67 -0
- package/stories/BMAccordion.stories.tsx +55 -0
- package/stories/BMAddSection.stories.tsx +40 -0
- package/stories/BMAlert.stories.tsx +33 -0
- package/stories/BMAutoComplete.stories.tsx +65 -0
- package/stories/BMAvatar.stories.tsx +76 -0
- package/stories/BMButton.stories.tsx +57 -0
- package/stories/BMButton2.stories.tsx +131 -0
- package/stories/BMCheckbox.stories.tsx +23 -0
- package/stories/BMCloudSelectField.stories.tsx +40 -0
- package/stories/BMCodeBlock.stories.tsx +57 -0
- package/stories/BMDatePicker.stories.tsx +88 -0
- package/stories/BMDropdown.stories.tsx +84 -0
- package/stories/BMGroupButton.stories.tsx +53 -0
- package/stories/BMHelloBanner.stories.tsx +33 -0
- package/stories/BMInput.stories.tsx +184 -0
- package/stories/BMInputEditableCode.stories.tsx +86 -0
- package/stories/BMInputField.stories.tsx +50 -0
- package/stories/BMLoadingBox.stories.tsx +45 -0
- package/stories/BMMaps.stories.tsx +29 -0
- package/stories/BMModal.stories.tsx +218 -0
- package/stories/BMMultiEntry.stories.tsx +93 -0
- package/stories/BMMultiLevelStepper.stories.tsx +87 -0
- package/stories/BMPagination.stories.tsx +41 -0
- package/stories/BMPassword.stories.tsx +133 -0
- package/stories/BMProgress.stories.tsx +60 -0
- package/stories/BMRadio.stories.tsx +71 -0
- package/stories/BMSelect.stories.tsx +160 -0
- package/stories/BMSlider.stories.tsx +74 -0
- package/stories/BMSmartStatus.stories.tsx +98 -0
- package/stories/BMSplitButton.stories.tsx +32 -0
- package/stories/BMStatus.stories.tsx +29 -0
- package/stories/BMTable.stories.tsx +350 -0
- package/stories/BMTabs.stories.tsx +25 -0
- package/stories/BMTag.stories.tsx +63 -0
- package/stories/BMTagv2.stories.tsx +288 -0
- package/stories/BMToggle.stories.tsx +123 -0
- package/stories/BMTooltip.stories.tsx +59 -0
- package/stories/BMTypography.stories.tsx +79 -0
- package/stories/BMWarning.stories.tsx +55 -0
- package/stories/GenericFailure.stories.tsx +47 -0
- package/stories/NoAccess.stories.tsx +19 -0
- package/stories/NoAccessActionTooltip.stories.tsx +50 -0
- package/stories/NoPermissionModal.stories.tsx +46 -0
- package/tsconfig.base.json +21 -0
- package/tsconfig.build.json +23 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import { FiberManualRecord } from "@mui/icons-material";
|
|
5
|
+
|
|
6
|
+
import CompletedIcon from "../../assets/icons/check.svg";
|
|
7
|
+
import FailedIcon from "../../assets/icons/failed-solid.svg";
|
|
8
|
+
import SuccessIcon from "../../assets/icons/circle-check-solid.svg";
|
|
9
|
+
import LoadingIcon from "../../assets/icons/Default-Loading-Circles.svg";
|
|
10
|
+
|
|
11
|
+
export enum STATUS_TYPES {
|
|
12
|
+
SUCCESS = "success",
|
|
13
|
+
FAILED = "failed",
|
|
14
|
+
COMPLETE = "completed",
|
|
15
|
+
ACTIVE = "active",
|
|
16
|
+
INACTIVE = "inactive",
|
|
17
|
+
PENDING = "running",
|
|
18
|
+
ABORTED = "aborted",
|
|
19
|
+
IN_PROGRESS = "in_progress",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface StatusProps {
|
|
23
|
+
label?: ReactNode;
|
|
24
|
+
type?: STATUS_TYPES;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Styled components
|
|
28
|
+
const StyledFailedIcon = styled(FailedIcon)(({ theme }) => ({
|
|
29
|
+
width: 24,
|
|
30
|
+
marginRight: theme.spacing(0.5),
|
|
31
|
+
color: theme.palette.error.main,
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
const StyledCompletedIcon = styled(CompletedIcon)(({ theme }) => ({
|
|
35
|
+
marginRight: theme.spacing(0.5),
|
|
36
|
+
color: theme.palette.success.main,
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
const StyledSuccessIcon = styled(SuccessIcon)(({ theme }) => ({
|
|
40
|
+
marginRight: theme.spacing(0.5),
|
|
41
|
+
color: theme.palette.success.main,
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
const StyledInactiveDot = styled(FiberManualRecord)(({ theme }) => ({
|
|
45
|
+
fontSize: 12,
|
|
46
|
+
color: theme.palette.grey[500],
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
const StyledActiveDot = styled(FiberManualRecord)(({ theme }) => ({
|
|
50
|
+
fontSize: 12,
|
|
51
|
+
marginRight: theme.spacing(0.5),
|
|
52
|
+
color: theme.palette.success.main,
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
const StyledPendingDot = styled(FiberManualRecord)(({ theme }) => ({
|
|
56
|
+
marginRight: theme.spacing(0.5),
|
|
57
|
+
width: 12,
|
|
58
|
+
color: theme.palette.warning[700],
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
const StyledLoadingIcon = styled(LoadingIcon)(({ theme }) => ({
|
|
62
|
+
width: 21,
|
|
63
|
+
height: 21,
|
|
64
|
+
marginRight: theme.spacing(1),
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
export const BMStatus: FC<StatusProps> = ({
|
|
68
|
+
label,
|
|
69
|
+
type = STATUS_TYPES.COMPLETE,
|
|
70
|
+
}) => {
|
|
71
|
+
const getIcon = () => {
|
|
72
|
+
switch (type) {
|
|
73
|
+
case STATUS_TYPES.FAILED:
|
|
74
|
+
return <StyledFailedIcon />;
|
|
75
|
+
case STATUS_TYPES.ACTIVE:
|
|
76
|
+
return <StyledActiveDot />;
|
|
77
|
+
case STATUS_TYPES.INACTIVE:
|
|
78
|
+
return <StyledInactiveDot />;
|
|
79
|
+
case STATUS_TYPES.SUCCESS:
|
|
80
|
+
return <StyledSuccessIcon />;
|
|
81
|
+
case STATUS_TYPES.PENDING:
|
|
82
|
+
return <StyledPendingDot />;
|
|
83
|
+
case STATUS_TYPES.IN_PROGRESS:
|
|
84
|
+
return <StyledLoadingIcon />;
|
|
85
|
+
default:
|
|
86
|
+
return <StyledCompletedIcon />;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<Box
|
|
92
|
+
sx={{ display: "flex", alignItems: "center", justifyContent: "center" }}
|
|
93
|
+
>
|
|
94
|
+
{getIcon()}
|
|
95
|
+
{label && <Box minWidth={35}>{label}</Box>}
|
|
96
|
+
</Box>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BMStatus";
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { HTMLAttributes } from "react";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
DataGrid,
|
|
6
|
+
type GridColDef,
|
|
7
|
+
type GridRowsProp,
|
|
8
|
+
type DataGridProps,
|
|
9
|
+
} from "@mui/x-data-grid";
|
|
10
|
+
|
|
11
|
+
import { styled } from "@mui/material/styles";
|
|
12
|
+
import { Paper, Box, useTheme } from "@mui/material";
|
|
13
|
+
|
|
14
|
+
type SelectableRows = "single" | "multiple" | "none";
|
|
15
|
+
|
|
16
|
+
export interface CustomTableOptions {
|
|
17
|
+
pagination?: boolean;
|
|
18
|
+
viewColumns?: boolean;
|
|
19
|
+
selectableRowsOnClick?: boolean;
|
|
20
|
+
setTableProps?: () => Partial<DataGridProps>;
|
|
21
|
+
filterType?: "dropdown" | "textField";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface BMTableProps
|
|
25
|
+
extends Omit<DataGridProps, "columns" | "rows">,
|
|
26
|
+
HTMLAttributes<unknown> {
|
|
27
|
+
tableTitle?: React.ReactNode;
|
|
28
|
+
selectableRows?: SelectableRows;
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
data: (Record<any, any> | number[] | string[])[];
|
|
31
|
+
columns: GridColDef[];
|
|
32
|
+
withBorder?: boolean;
|
|
33
|
+
dataTestId?: string;
|
|
34
|
+
options: CustomTableOptions;
|
|
35
|
+
customHeaderRenderer?: (col: GridColDef) => React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const StyledPaper = styled(Paper, {
|
|
39
|
+
shouldForwardProp: (prop) => prop !== "withBorder",
|
|
40
|
+
})<{ withBorder?: boolean }>(({ theme, withBorder }) => ({
|
|
41
|
+
border: withBorder ? `1px solid ${theme.palette.divider}` : "none",
|
|
42
|
+
boxShadow: "none",
|
|
43
|
+
backgroundColor: theme.palette.background.paper,
|
|
44
|
+
padding: theme.spacing(1, 2),
|
|
45
|
+
color: theme.palette.text.primary,
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
export const BMTable: React.FC<BMTableProps> = ({
|
|
49
|
+
tableTitle,
|
|
50
|
+
selectableRows = "none",
|
|
51
|
+
data,
|
|
52
|
+
columns,
|
|
53
|
+
withBorder = true,
|
|
54
|
+
dataTestId,
|
|
55
|
+
options,
|
|
56
|
+
customHeaderRenderer,
|
|
57
|
+
...rest
|
|
58
|
+
}) => {
|
|
59
|
+
const theme = useTheme();
|
|
60
|
+
|
|
61
|
+
const tablePropsFromOptions = options?.setTableProps?.() ?? {};
|
|
62
|
+
|
|
63
|
+
const getRowId = (row: any) => row.id ?? JSON.stringify(row);
|
|
64
|
+
|
|
65
|
+
const getCheckboxSelection = () =>
|
|
66
|
+
selectableRows === "multiple" ? true : undefined;
|
|
67
|
+
|
|
68
|
+
const getIsRowSelectable = () =>
|
|
69
|
+
selectableRows === "none" ? () => false : undefined;
|
|
70
|
+
|
|
71
|
+
const columnsWithCustomHeader = React.useMemo(() => {
|
|
72
|
+
if (!customHeaderRenderer) return columns;
|
|
73
|
+
|
|
74
|
+
return columns.map((col) => ({
|
|
75
|
+
...col,
|
|
76
|
+
renderHeader: () => customHeaderRenderer(col),
|
|
77
|
+
}));
|
|
78
|
+
}, [columns, customHeaderRenderer]);
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<StyledPaper withBorder={withBorder} data-testid={dataTestId}>
|
|
82
|
+
{tableTitle && (
|
|
83
|
+
<Box
|
|
84
|
+
sx={{
|
|
85
|
+
mb: 1,
|
|
86
|
+
fontWeight: 600,
|
|
87
|
+
fontSize: "1.1rem",
|
|
88
|
+
color: theme.palette.text.primary,
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
{tableTitle}
|
|
92
|
+
</Box>
|
|
93
|
+
)}
|
|
94
|
+
|
|
95
|
+
<DataGrid
|
|
96
|
+
autoHeight
|
|
97
|
+
density="compact"
|
|
98
|
+
rows={data as GridRowsProp}
|
|
99
|
+
columns={columnsWithCustomHeader}
|
|
100
|
+
checkboxSelection={getCheckboxSelection()}
|
|
101
|
+
isRowSelectable={getIsRowSelectable()}
|
|
102
|
+
sx={{
|
|
103
|
+
backgroundColor: theme.palette.background.paper,
|
|
104
|
+
border: "none",
|
|
105
|
+
"& .MuiDataGrid-columnHeaders": {
|
|
106
|
+
backgroundColor: 'transparent',
|
|
107
|
+
},
|
|
108
|
+
"& .MuiDataGrid-columnHeader": {
|
|
109
|
+
backgroundColor: theme.palette.background.paper,
|
|
110
|
+
fontWeight: 600,
|
|
111
|
+
fontSize: "0.875rem",
|
|
112
|
+
color: theme.palette.text.primary,
|
|
113
|
+
},
|
|
114
|
+
".MuiDataGrid-cell": {
|
|
115
|
+
fontSize: "0.875rem",
|
|
116
|
+
color: theme.palette.text.primary,
|
|
117
|
+
},
|
|
118
|
+
".MuiDataGrid-footerContainer": {
|
|
119
|
+
borderTop: `1px solid ${theme.palette.divider}`,
|
|
120
|
+
backgroundColor: theme.palette.background.paper,
|
|
121
|
+
color: theme.palette.text.secondary,
|
|
122
|
+
},
|
|
123
|
+
}}
|
|
124
|
+
getRowId={getRowId}
|
|
125
|
+
{...tablePropsFromOptions}
|
|
126
|
+
disableRowSelectionOnClick={!options?.selectableRowsOnClick}
|
|
127
|
+
{...rest}
|
|
128
|
+
/>
|
|
129
|
+
</StyledPaper>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BMTable";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Tabs, Tab, TabsProps, styled, tabsClasses, tabClasses } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export { Tab as BMTab };
|
|
4
|
+
|
|
5
|
+
export interface BMTabsProps extends TabsProps {
|
|
6
|
+
pill?: boolean;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// we are unable to override the variants of the Tabs component in theme file.
|
|
10
|
+
// so we are doing this in component level itself.
|
|
11
|
+
// see https://github.com/mui/material-ui/issues/33785
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const StyledTabs = styled(Tabs)<BMTabsProps>(({ theme, pill }) => ({
|
|
15
|
+
...(pill && {
|
|
16
|
+
[`& .${tabsClasses.indicator}`]: {
|
|
17
|
+
display: 'none'
|
|
18
|
+
},
|
|
19
|
+
[`& .${tabsClasses.fixed}`]: {
|
|
20
|
+
boxShadow: 'none'
|
|
21
|
+
},
|
|
22
|
+
[`& .${tabClasses.root}`]: {
|
|
23
|
+
textAlign: 'left',
|
|
24
|
+
marginRight: theme.spacing(1),
|
|
25
|
+
minHeight: theme.spacing(4),
|
|
26
|
+
maxHeight: theme.spacing(4),
|
|
27
|
+
marginBottom: theme.spacing(0.5),
|
|
28
|
+
padding: theme.spacing(0, 2),
|
|
29
|
+
boxSizing: 'border-box',
|
|
30
|
+
|
|
31
|
+
'&:hover': {
|
|
32
|
+
boxShadow: 'none',
|
|
33
|
+
borderRadius: theme.shape.borderRadius
|
|
34
|
+
},
|
|
35
|
+
'&.Mui-selected': {
|
|
36
|
+
background: theme.palette.grey[300],
|
|
37
|
+
borderRadius: theme.spacing(1)
|
|
38
|
+
},
|
|
39
|
+
'& .MuiTab-wrapper': {
|
|
40
|
+
alignItems: 'flex-start'
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
export const BMTabs = (props: BMTabsProps) => {
|
|
47
|
+
return (
|
|
48
|
+
<StyledTabs {...props} />
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BMTabs';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
|
|
5
|
+
export type BMPreviewTagProps = {
|
|
6
|
+
text: string;
|
|
7
|
+
noGradient?: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const TagContainer = styled(Box)(({ theme }) => ({
|
|
11
|
+
borderRadius: 4,
|
|
12
|
+
marginLeft: theme.spacing(1),
|
|
13
|
+
color: theme.palette.primary[200],
|
|
14
|
+
backgroundColor: theme.palette.common.white,
|
|
15
|
+
border: `1px solid ${theme.palette.grey[300]}`,
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
const GradientText = styled(Box)(({ theme }) => ({
|
|
19
|
+
fontSize: 11.5,
|
|
20
|
+
fontWeight: 700,
|
|
21
|
+
backgroundClip: "text",
|
|
22
|
+
WebkitBackgroundClip: "text",
|
|
23
|
+
padding: theme.spacing(0.25, 0.55),
|
|
24
|
+
WebkitTextFillColor: "transparent",
|
|
25
|
+
backgroundImage:
|
|
26
|
+
"linear-gradient(272.58deg, #ED35EC 5.14%, #ED35C5 38.93%, #7879F1 75.17%, #5E60F0 98.9%)",
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
const NoGradientText = styled(Box)(({ theme }) => ({
|
|
30
|
+
fontSize: 11.5,
|
|
31
|
+
fontWeight: 400,
|
|
32
|
+
color: theme.palette.grey[700],
|
|
33
|
+
padding: theme.spacing(0.25, 0.55),
|
|
34
|
+
background: theme.palette.grey[100],
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
export const BMTag: FC<BMPreviewTagProps> = ({ text, noGradient = false }) => {
|
|
38
|
+
return (
|
|
39
|
+
<TagContainer>
|
|
40
|
+
{noGradient ? (
|
|
41
|
+
<NoGradientText>{text}</NoGradientText>
|
|
42
|
+
) : (
|
|
43
|
+
<GradientText>{text}</GradientText>
|
|
44
|
+
)}
|
|
45
|
+
</TagContainer>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BMTag";
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Chip, ChipProps, styled } from "@mui/material";
|
|
3
|
+
import {
|
|
4
|
+
Language as LanguageIcon,
|
|
5
|
+
Star as StarIcon,
|
|
6
|
+
Close as CloseIcon,
|
|
7
|
+
Check as CheckIcon,
|
|
8
|
+
Warning as WarningIcon,
|
|
9
|
+
Info as InfoIcon,
|
|
10
|
+
Error as ErrorIcon,
|
|
11
|
+
} from "@mui/icons-material";
|
|
12
|
+
import { styled as muiStyled } from "@mui/material/styles";
|
|
13
|
+
|
|
14
|
+
// Predefined icon options
|
|
15
|
+
export type IconName =
|
|
16
|
+
| "language"
|
|
17
|
+
| "star"
|
|
18
|
+
| "close"
|
|
19
|
+
| "check"
|
|
20
|
+
| "warning"
|
|
21
|
+
| "info"
|
|
22
|
+
| "error";
|
|
23
|
+
|
|
24
|
+
const IconComponents: Record<IconName, React.ComponentType> = {
|
|
25
|
+
language: LanguageIcon,
|
|
26
|
+
star: StarIcon,
|
|
27
|
+
close: CloseIcon,
|
|
28
|
+
check: CheckIcon,
|
|
29
|
+
warning: WarningIcon,
|
|
30
|
+
info: InfoIcon,
|
|
31
|
+
error: ErrorIcon,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export interface BMTagv2Props
|
|
35
|
+
extends Omit<ChipProps, "size" | "variant" | "label"> {
|
|
36
|
+
text: string | React.ReactElement;
|
|
37
|
+
size?: "sm" | "md" | "lg";
|
|
38
|
+
variant?: "default" | "primary" | "success" | "warning" | "error" | "info";
|
|
39
|
+
noGradient?: boolean;
|
|
40
|
+
filled?: boolean;
|
|
41
|
+
prefixIcon?: IconName | React.ReactElement;
|
|
42
|
+
suffixIcon?: IconName | React.ReactElement;
|
|
43
|
+
customColor?: {
|
|
44
|
+
background?: string;
|
|
45
|
+
color?: string;
|
|
46
|
+
border?: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const StyledChip = styled(Chip)<{
|
|
51
|
+
$size?: "sm" | "md" | "lg";
|
|
52
|
+
$variant?: BMTagv2Props["variant"];
|
|
53
|
+
$noGradient?: boolean;
|
|
54
|
+
$filled?: boolean;
|
|
55
|
+
customColor?: {
|
|
56
|
+
background?: string;
|
|
57
|
+
color?: string;
|
|
58
|
+
border?: string;
|
|
59
|
+
};
|
|
60
|
+
}>(
|
|
61
|
+
({
|
|
62
|
+
theme,
|
|
63
|
+
$size = "md",
|
|
64
|
+
$variant = "default",
|
|
65
|
+
$noGradient = false,
|
|
66
|
+
$filled = false,
|
|
67
|
+
...props
|
|
68
|
+
}) => {
|
|
69
|
+
const sizeStyles = {
|
|
70
|
+
sm: {
|
|
71
|
+
height: 20,
|
|
72
|
+
fontSize: 11.5,
|
|
73
|
+
"& .MuiChip-icon, & .MuiChip-deleteIcon": {
|
|
74
|
+
marginLeft: theme.spacing(0.5),
|
|
75
|
+
marginRight: theme.spacing(-0.5),
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
md: {
|
|
79
|
+
height: 24,
|
|
80
|
+
fontSize: 11.5,
|
|
81
|
+
"& .MuiChip-icon, & .MuiChip-deleteIcon": {
|
|
82
|
+
marginLeft: theme.spacing(0.75),
|
|
83
|
+
marginRight: theme.spacing(-0.75),
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
lg: {
|
|
87
|
+
height: 28,
|
|
88
|
+
fontSize: 13,
|
|
89
|
+
"& .MuiChip-icon, & .MuiChip-deleteIcon": {
|
|
90
|
+
marginLeft: theme.spacing(1),
|
|
91
|
+
marginRight: theme.spacing(-1),
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
}[$size];
|
|
95
|
+
|
|
96
|
+
const getVariantStyles = () => {
|
|
97
|
+
let gradientStyles;
|
|
98
|
+
if (!$noGradient && !props?.customColor) {
|
|
99
|
+
gradientStyles = {
|
|
100
|
+
background:
|
|
101
|
+
"linear-gradient(282.49deg, #ed35c5 0.48%, #7879f1 93.17%)",
|
|
102
|
+
WebkitTextFillColor: "transparent",
|
|
103
|
+
WebkitBackgroundClip: "text",
|
|
104
|
+
color: "transparent",
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// If custom colors are provided, use them instead of variants
|
|
109
|
+
if (props?.customColor) {
|
|
110
|
+
return {
|
|
111
|
+
background:
|
|
112
|
+
props.customColor?.background || theme.palette.common.white,
|
|
113
|
+
color: props.customColor?.color || theme.palette.grey[900],
|
|
114
|
+
border:
|
|
115
|
+
props.customColor?.border || `1px solid ${theme.palette.grey[300]}`,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const variantColors = {
|
|
120
|
+
default: {
|
|
121
|
+
background: theme.palette.common.white,
|
|
122
|
+
color: theme.palette.grey[900],
|
|
123
|
+
border: $filled ? 0 : `1px solid ${theme.palette.grey[300]}`,
|
|
124
|
+
...(gradientStyles || {}),
|
|
125
|
+
},
|
|
126
|
+
primary: {
|
|
127
|
+
background: $filled
|
|
128
|
+
? theme.palette.primary[200]
|
|
129
|
+
: theme.palette.common.white,
|
|
130
|
+
color: theme.palette.primary[700],
|
|
131
|
+
border: $filled ? 0 : `1px solid ${theme.palette.primary[300]}`,
|
|
132
|
+
...(gradientStyles || {}),
|
|
133
|
+
},
|
|
134
|
+
success: {
|
|
135
|
+
background: $filled
|
|
136
|
+
? theme.palette.success[100]
|
|
137
|
+
: theme.palette.common.white,
|
|
138
|
+
color: theme.palette.success[700],
|
|
139
|
+
border: $filled ? 0 : `1px solid ${theme.palette.success[300]}`,
|
|
140
|
+
...(gradientStyles || {}),
|
|
141
|
+
},
|
|
142
|
+
warning: {
|
|
143
|
+
background: $filled
|
|
144
|
+
? theme.palette.warning[100]
|
|
145
|
+
: theme.palette.common.white,
|
|
146
|
+
color: theme.palette.grey[900],
|
|
147
|
+
border: $filled ? 0 : `1px solid ${theme.palette.warning[300]}`,
|
|
148
|
+
...(gradientStyles || {}),
|
|
149
|
+
},
|
|
150
|
+
error: {
|
|
151
|
+
background: $filled
|
|
152
|
+
? theme.palette.error[100]
|
|
153
|
+
: theme.palette.common.white,
|
|
154
|
+
color: theme.palette.error[700],
|
|
155
|
+
border: $filled ? 0 : `1px solid ${theme.palette.error[300]}`,
|
|
156
|
+
...(gradientStyles || {}),
|
|
157
|
+
},
|
|
158
|
+
info: {
|
|
159
|
+
background: $filled
|
|
160
|
+
? theme.palette.info[100]
|
|
161
|
+
: theme.palette.common.white,
|
|
162
|
+
color: theme.palette.info[700],
|
|
163
|
+
border: $filled ? 0 : `1px solid ${theme.palette.info[300]}`,
|
|
164
|
+
...(gradientStyles || {}),
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
return variantColors[$variant];
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
...sizeStyles,
|
|
173
|
+
...getVariantStyles(),
|
|
174
|
+
borderRadius: theme.shape.borderRadius - 4,
|
|
175
|
+
fontWeight: 500,
|
|
176
|
+
"& .MuiChip-icon, & .MuiChip-deleteIcon": {
|
|
177
|
+
color: "inherit",
|
|
178
|
+
margin: 0,
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
export const BMTagv2 = React.forwardRef<HTMLDivElement, BMTagv2Props>(
|
|
185
|
+
(
|
|
186
|
+
{
|
|
187
|
+
text,
|
|
188
|
+
size = "md",
|
|
189
|
+
variant = "default",
|
|
190
|
+
noGradient = false,
|
|
191
|
+
filled = false,
|
|
192
|
+
prefixIcon,
|
|
193
|
+
suffixIcon,
|
|
194
|
+
...props
|
|
195
|
+
},
|
|
196
|
+
ref,
|
|
197
|
+
) => {
|
|
198
|
+
// Add this styled component at the top level with other constants
|
|
199
|
+
const StyledIcon = muiStyled("span")<{ $size?: "sm" | "md" | "lg" }>(
|
|
200
|
+
({ $size = "md" }) => ({
|
|
201
|
+
display: "flex",
|
|
202
|
+
alignItems: "center",
|
|
203
|
+
"& > svg": {
|
|
204
|
+
fontSize: "inherit",
|
|
205
|
+
width:
|
|
206
|
+
$size === "sm"
|
|
207
|
+
? 11
|
|
208
|
+
: $size === "md"
|
|
209
|
+
? 14
|
|
210
|
+
: $size === "lg"
|
|
211
|
+
? 20
|
|
212
|
+
: undefined,
|
|
213
|
+
height: "auto",
|
|
214
|
+
},
|
|
215
|
+
}),
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
// Update the renderIcon function inside BMTagv2 component
|
|
219
|
+
const renderIcon = (icon: IconName | React.ReactElement | undefined) => {
|
|
220
|
+
if (!icon) return undefined;
|
|
221
|
+
if (React.isValidElement(icon)) {
|
|
222
|
+
return <StyledIcon $size={size}>{icon}</StyledIcon>;
|
|
223
|
+
}
|
|
224
|
+
const IconComponent = IconComponents[icon as IconName];
|
|
225
|
+
return IconComponent ? (
|
|
226
|
+
<StyledIcon $size={size}>
|
|
227
|
+
<IconComponent />
|
|
228
|
+
</StyledIcon>
|
|
229
|
+
) : undefined;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const prefixIconElement = renderIcon(prefixIcon);
|
|
233
|
+
const suffixIconElement = renderIcon(suffixIcon);
|
|
234
|
+
|
|
235
|
+
return (
|
|
236
|
+
<StyledChip
|
|
237
|
+
ref={ref}
|
|
238
|
+
$size={size}
|
|
239
|
+
$variant={variant}
|
|
240
|
+
$noGradient={noGradient}
|
|
241
|
+
$filled={filled}
|
|
242
|
+
label={text}
|
|
243
|
+
icon={prefixIconElement}
|
|
244
|
+
deleteIcon={suffixIconElement}
|
|
245
|
+
onDelete={suffixIconElement ? () => {} : undefined} // Prevents delete icon from being clickable if not provided
|
|
246
|
+
{...props}
|
|
247
|
+
/>
|
|
248
|
+
);
|
|
249
|
+
},
|
|
250
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BMTagv2";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { styled } from "@mui/material/styles";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ToggleButton,
|
|
6
|
+
ToggleButtonGroup,
|
|
7
|
+
ToggleButtonGroupProps,
|
|
8
|
+
} from "@mui/material";
|
|
9
|
+
|
|
10
|
+
interface ToggleButtonData<T> {
|
|
11
|
+
label: ReactElement | string;
|
|
12
|
+
value: T;
|
|
13
|
+
dataTestId?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface BMMultiToggleButtonProps<
|
|
17
|
+
T extends string | number | {} = string
|
|
18
|
+
> extends Omit<ToggleButtonGroupProps, "onChange"> {
|
|
19
|
+
dense?: boolean;
|
|
20
|
+
options: ToggleButtonData<T>[];
|
|
21
|
+
value: T;
|
|
22
|
+
onChange: (value: T) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Styled components
|
|
26
|
+
const StyledToggleButtonGroup = styled(ToggleButtonGroup)(({ theme }) => ({
|
|
27
|
+
border: `1px solid ${theme.palette.grey[300]}`,
|
|
28
|
+
height: theme.spacing(4),
|
|
29
|
+
backgroundColor: theme.palette.primary[100],
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
const getStyledToggleButton = (dense?: boolean) =>
|
|
33
|
+
styled(ToggleButton)(({ theme }) => ({
|
|
34
|
+
fontWeight: 400,
|
|
35
|
+
fontSize: 13,
|
|
36
|
+
padding: theme.spacing(0, dense ? 1 : 2),
|
|
37
|
+
color: theme.palette.grey[900],
|
|
38
|
+
textTransform: "none",
|
|
39
|
+
|
|
40
|
+
[`&:not(:first-of-type)`]: {
|
|
41
|
+
marginLeft: 0,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
"&:hover": {
|
|
45
|
+
backgroundColor: theme.palette.primary[100],
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
"&.Mui-selected": {
|
|
49
|
+
backgroundColor: theme.palette.background.paper,
|
|
50
|
+
color: theme.palette.primary.main,
|
|
51
|
+
fontWeight: 600,
|
|
52
|
+
borderColor: theme.palette.primary.main,
|
|
53
|
+
|
|
54
|
+
"&:hover": {
|
|
55
|
+
backgroundColor: theme.palette.background.paper,
|
|
56
|
+
},
|
|
57
|
+
"&:not(:first-of-type)": {
|
|
58
|
+
borderLeft: "1px solid",
|
|
59
|
+
},
|
|
60
|
+
"&:not(:last-of-type)": {
|
|
61
|
+
borderRight: "1px solid",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
export const BMMultiToggleButton = <T extends string | number | {}>({
|
|
67
|
+
options,
|
|
68
|
+
value,
|
|
69
|
+
onChange,
|
|
70
|
+
dense,
|
|
71
|
+
...rest
|
|
72
|
+
}: BMMultiToggleButtonProps<T>): ReactElement => {
|
|
73
|
+
const StyledToggleButton = getStyledToggleButton(dense);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<StyledToggleButtonGroup
|
|
77
|
+
exclusive
|
|
78
|
+
value={value}
|
|
79
|
+
onChange={(_event: React.MouseEvent<HTMLElement>, newValue: T | null) => {
|
|
80
|
+
if (newValue !== null) {
|
|
81
|
+
onChange(newValue);
|
|
82
|
+
}
|
|
83
|
+
}}
|
|
84
|
+
{...rest}
|
|
85
|
+
>
|
|
86
|
+
{options.map((option) => (
|
|
87
|
+
<StyledToggleButton
|
|
88
|
+
key={String(option.value)}
|
|
89
|
+
value={option.value}
|
|
90
|
+
data-testid={
|
|
91
|
+
option.dataTestId ?? `${option.label as string}ToggleButton`
|
|
92
|
+
}
|
|
93
|
+
>
|
|
94
|
+
{option.label}
|
|
95
|
+
</StyledToggleButton>
|
|
96
|
+
))}
|
|
97
|
+
</StyledToggleButtonGroup>
|
|
98
|
+
);
|
|
99
|
+
};
|