@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,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type FormControlLabelProps,
|
|
3
|
+
type InputProps,
|
|
4
|
+
Switch,
|
|
5
|
+
type SwitchProps,
|
|
6
|
+
} from "@mui/material";
|
|
7
|
+
import type { FC } from "react";
|
|
8
|
+
import { BMFormControlLabel } from "../BMForm/BMFormControlLabel";
|
|
9
|
+
|
|
10
|
+
export interface BMToggleProps extends SwitchProps {
|
|
11
|
+
label?: string;
|
|
12
|
+
formControlLabelProps?: Partial<FormControlLabelProps>;
|
|
13
|
+
inputProps?: InputProps["inputProps"];
|
|
14
|
+
dataTestId: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const BMToggle: FC<BMToggleProps> = ({
|
|
18
|
+
label,
|
|
19
|
+
formControlLabelProps,
|
|
20
|
+
...switchProps
|
|
21
|
+
}: BMToggleProps) => {
|
|
22
|
+
return (
|
|
23
|
+
<BMFormControlLabel
|
|
24
|
+
control={
|
|
25
|
+
<Switch
|
|
26
|
+
color={switchProps.disabled ? "default" : "primary"}
|
|
27
|
+
{...switchProps}
|
|
28
|
+
/>
|
|
29
|
+
}
|
|
30
|
+
labelPlacement="end"
|
|
31
|
+
label={label}
|
|
32
|
+
{...formControlLabelProps}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import {
|
|
3
|
+
type FieldValues,
|
|
4
|
+
type UseControllerProps,
|
|
5
|
+
useController,
|
|
6
|
+
} from "react-hook-form";
|
|
7
|
+
import { BMToggle, type BMToggleProps } from "./BMToggle";
|
|
8
|
+
|
|
9
|
+
type BMInputFieldProps<T extends FieldValues> = UseControllerProps<T> &
|
|
10
|
+
BMToggleProps;
|
|
11
|
+
|
|
12
|
+
export const BMToggleField = <T extends FieldValues>(
|
|
13
|
+
props: BMInputFieldProps<T>,
|
|
14
|
+
): ReactElement => {
|
|
15
|
+
const {
|
|
16
|
+
name,
|
|
17
|
+
rules,
|
|
18
|
+
defaultValue,
|
|
19
|
+
control,
|
|
20
|
+
shouldUnregister,
|
|
21
|
+
...bmToggleProps
|
|
22
|
+
} = props;
|
|
23
|
+
const {
|
|
24
|
+
field: { ref, value, ...fieldProps },
|
|
25
|
+
} = useController({ name, rules, defaultValue, control, shouldUnregister });
|
|
26
|
+
|
|
27
|
+
return <BMToggle {...fieldProps} {...bmToggleProps} checked={!!value} />;
|
|
28
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { FC, ReactElement, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
import { Box, Tooltip, TooltipProps, PopperProps } from "@mui/material";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import InfoSolidIcon from "../../assets/icons/info-solid.svg";
|
|
5
|
+
|
|
6
|
+
// make children optional and add dark style
|
|
7
|
+
export type BMTooltipProps = {
|
|
8
|
+
children?: ReactElement;
|
|
9
|
+
smart?: boolean; // don't show tooltip on hover if content is not truncated and fits in the container
|
|
10
|
+
PopperProps?: Partial<PopperProps> & { "data-testid"?: string };
|
|
11
|
+
} & Omit<TooltipProps, "children">;
|
|
12
|
+
|
|
13
|
+
const InfoStyledIcon = styled(InfoSolidIcon)(({ theme }) => ({
|
|
14
|
+
width: 14,
|
|
15
|
+
height: 14,
|
|
16
|
+
cursor: "pointer",
|
|
17
|
+
color: theme.palette.grey[500],
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export const BMTooltip: FC<BMTooltipProps> = ({
|
|
21
|
+
children,
|
|
22
|
+
smart,
|
|
23
|
+
...props
|
|
24
|
+
}) => {
|
|
25
|
+
const childrenRef = useRef<HTMLElement>(null);
|
|
26
|
+
const [fitsContainer, setFitsContainer] = useState(false);
|
|
27
|
+
|
|
28
|
+
// make child measurements after all DOM mutations and update tooltip visibility via state change and re-render
|
|
29
|
+
useLayoutEffect(() => {
|
|
30
|
+
if (smart && childrenRef.current) {
|
|
31
|
+
setFitsContainer(
|
|
32
|
+
childrenRef.current.scrollWidth <= childrenRef.current.clientWidth
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}, [smart, childrenRef]);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Tooltip
|
|
39
|
+
ref={childrenRef}
|
|
40
|
+
disableHoverListener={smart ? fitsContainer : false}
|
|
41
|
+
arrow
|
|
42
|
+
placement="top-start"
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
{children ?? (
|
|
46
|
+
<Box sx={{ lineHeight: 0, ml: 0.5 }}>
|
|
47
|
+
<InfoStyledIcon />
|
|
48
|
+
</Box>
|
|
49
|
+
)}
|
|
50
|
+
</Tooltip>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BMTooltip";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { Box, BoxProps, styled } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
interface BMWarningProps extends BoxProps {
|
|
5
|
+
chipText: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const Root = styled(Box)(({ theme }) => ({
|
|
9
|
+
display: "flex",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
color: theme.palette.grey[700],
|
|
12
|
+
"& a": {
|
|
13
|
+
color: theme.palette.grey[700],
|
|
14
|
+
textDecoration: "none",
|
|
15
|
+
},
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
const Chip = styled(Box)(({ theme }) => ({
|
|
19
|
+
...theme.typography.subtitle1,
|
|
20
|
+
fontWeight: 500,
|
|
21
|
+
padding: `${theme.spacing(0.6)} ${theme.spacing(0.8)}`,
|
|
22
|
+
borderRadius: 6,
|
|
23
|
+
color: theme.palette.warning[900],
|
|
24
|
+
backgroundColor: theme.palette.warning[100],
|
|
25
|
+
marginRight: theme.spacing(1.25),
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
export const BMWarning: FC<BMWarningProps> = ({
|
|
29
|
+
chipText,
|
|
30
|
+
children,
|
|
31
|
+
...boxProps
|
|
32
|
+
}) => {
|
|
33
|
+
return (
|
|
34
|
+
<Root {...boxProps}>
|
|
35
|
+
<Chip>{chipText}</Chip>
|
|
36
|
+
{children}
|
|
37
|
+
</Root>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BMWarning";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { Box, BoxProps } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
import { AlertVariant, BMAlert } from "../BMAlert";
|
|
5
|
+
|
|
6
|
+
interface GenericFailureProps extends BoxProps {
|
|
7
|
+
text?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const GenericFailure: FC<GenericFailureProps> = ({
|
|
11
|
+
text,
|
|
12
|
+
sx,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
return (
|
|
16
|
+
<Box
|
|
17
|
+
sx={{
|
|
18
|
+
p: 4,
|
|
19
|
+
maxWidth: 1024,
|
|
20
|
+
mx: "auto",
|
|
21
|
+
...sx,
|
|
22
|
+
}}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
<BMAlert open text={text} variant={AlertVariant.Error} />
|
|
26
|
+
</Box>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./GenericFailure";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { FC, HTMLAttributes } from "react";
|
|
2
|
+
import { Paper, Box, Typography, styled } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
import LockIcon from "../../assets/icons/lock-locked.svg";
|
|
5
|
+
|
|
6
|
+
export interface NoAccessProps extends HTMLAttributes<unknown> {
|
|
7
|
+
title: string;
|
|
8
|
+
subtitle: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const StyledPaper = styled(Paper)(({ theme }) => ({
|
|
13
|
+
backgroundColor: theme.palette.primary[100],
|
|
14
|
+
border: `1px dashed ${theme.palette.primary[300]}`,
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
export const NoAccess: FC<NoAccessProps> = ({
|
|
18
|
+
className,
|
|
19
|
+
title,
|
|
20
|
+
subtitle,
|
|
21
|
+
...rest
|
|
22
|
+
}) => {
|
|
23
|
+
return (
|
|
24
|
+
<StyledPaper className={className} {...rest}>
|
|
25
|
+
<Box sx={{ mt: 3, mb: 3, textAlign: "center" }} data-testid="NoAccess">
|
|
26
|
+
<LockIcon width={48} height={48} data-testid="NoAccessIcon" />
|
|
27
|
+
<Box sx={{ mt: 2 }}>
|
|
28
|
+
<Typography variant="body1" data-testid="NoAccessTitle">
|
|
29
|
+
{title}
|
|
30
|
+
</Typography>
|
|
31
|
+
</Box>
|
|
32
|
+
<Box sx={{ mt: 0.75 }}>
|
|
33
|
+
<Typography variant="subtitle1" data-testid="NoAccessSubtitle">
|
|
34
|
+
{subtitle}
|
|
35
|
+
</Typography>
|
|
36
|
+
</Box>
|
|
37
|
+
</Box>
|
|
38
|
+
</StyledPaper>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Box } from "@mui/material";
|
|
2
|
+
import { ReactElement, FC } from "react";
|
|
3
|
+
|
|
4
|
+
import { BMTooltip } from "../BMTooltip";
|
|
5
|
+
|
|
6
|
+
export interface NoAccessActionTooltipProps {
|
|
7
|
+
placement?:
|
|
8
|
+
| "bottom-end"
|
|
9
|
+
| "bottom-start"
|
|
10
|
+
| "bottom"
|
|
11
|
+
| "left-end"
|
|
12
|
+
| "left-start"
|
|
13
|
+
| "left"
|
|
14
|
+
| "right-end"
|
|
15
|
+
| "right-start"
|
|
16
|
+
| "right"
|
|
17
|
+
| "top-end"
|
|
18
|
+
| "top-start"
|
|
19
|
+
| "top";
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
primaryText: string;
|
|
22
|
+
secondaryText?: string;
|
|
23
|
+
children: ReactElement;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const NoAccessActionTooltip: FC<NoAccessActionTooltipProps> = ({
|
|
27
|
+
placement = "top",
|
|
28
|
+
enabled,
|
|
29
|
+
primaryText,
|
|
30
|
+
secondaryText,
|
|
31
|
+
children,
|
|
32
|
+
}) => {
|
|
33
|
+
if (!enabled) return children;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<BMTooltip
|
|
37
|
+
placement={placement}
|
|
38
|
+
title={
|
|
39
|
+
<Box sx={{ width: 190 }}>
|
|
40
|
+
<Box>{primaryText}</Box>
|
|
41
|
+
{secondaryText && <Box sx={{ mt: 2 }}>{secondaryText}</Box>}
|
|
42
|
+
</Box>
|
|
43
|
+
}
|
|
44
|
+
slotProps={{
|
|
45
|
+
popper: {
|
|
46
|
+
style: { pointerEvents: "none" },
|
|
47
|
+
},
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<span>{children}</span>
|
|
51
|
+
</BMTooltip>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { Box, Typography } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
import { BMModal } from "../BMModal";
|
|
5
|
+
|
|
6
|
+
import LockIcon from "../../assets/icons/lock-locked.svg";
|
|
7
|
+
|
|
8
|
+
export interface NoPermissionModalProps {
|
|
9
|
+
open: boolean;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onSubmit: () => void;
|
|
12
|
+
title: string;
|
|
13
|
+
description: string;
|
|
14
|
+
submitLabel?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const NoPermissionModal: FC<NoPermissionModalProps> = ({
|
|
18
|
+
open,
|
|
19
|
+
onClose,
|
|
20
|
+
onSubmit,
|
|
21
|
+
title,
|
|
22
|
+
description,
|
|
23
|
+
submitLabel = "OK",
|
|
24
|
+
}) => {
|
|
25
|
+
return (
|
|
26
|
+
<BMModal
|
|
27
|
+
open={open}
|
|
28
|
+
size="sm"
|
|
29
|
+
enableBackdropDismiss
|
|
30
|
+
titleIcon={<LockIcon width={24} height={24} />}
|
|
31
|
+
title={title}
|
|
32
|
+
onClose={onClose}
|
|
33
|
+
submitLabel={submitLabel}
|
|
34
|
+
onSubmit={onSubmit}
|
|
35
|
+
titleSeparator
|
|
36
|
+
overrideHeight={252}
|
|
37
|
+
overrideWidth={480}
|
|
38
|
+
>
|
|
39
|
+
<Box
|
|
40
|
+
sx={{
|
|
41
|
+
mt: 2,
|
|
42
|
+
ml: 1,
|
|
43
|
+
display: "flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
justifyContent: "center",
|
|
46
|
+
flexDirection: "column",
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<Typography variant="body2">
|
|
50
|
+
{description}
|
|
51
|
+
</Typography>
|
|
52
|
+
</Box>
|
|
53
|
+
</BMModal>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export * from "./BMAlert";
|
|
2
|
+
export * from "./BMAutoComplete";
|
|
3
|
+
export * from "./BMButton";
|
|
4
|
+
export * from "./BMCheckbox";
|
|
5
|
+
export * from "./BMInput";
|
|
6
|
+
export * from "./BMModal";
|
|
7
|
+
export * from "./BMMultiEntry";
|
|
8
|
+
export * from "./BMMultiLevelStepper";
|
|
9
|
+
export * from "./BMPassword";
|
|
10
|
+
export * from "./BMProgress";
|
|
11
|
+
export * from "./BMRadio";
|
|
12
|
+
export * from "./BMSelect";
|
|
13
|
+
export * from "./BMToggle";
|
|
14
|
+
export * from "./BMTooltip";
|
|
15
|
+
export * from "./BMHelloBanner";
|
|
16
|
+
export * from "./BMCloudSelect";
|
|
17
|
+
export * from "./BMForm";
|
|
18
|
+
export * from "./BMMaps";
|
|
19
|
+
export * from "./BMDropdown";
|
|
20
|
+
export * from "./BMAvatar";
|
|
21
|
+
export * from "./BMSlider";
|
|
22
|
+
export * from "./BMTag";
|
|
23
|
+
export * from "./BMTagv2";
|
|
24
|
+
export * from "./BMLoadingBox";
|
|
25
|
+
export * from "./BMAccordion";
|
|
26
|
+
export * from "./BMPagination";
|
|
27
|
+
export * from "./BMStatus";
|
|
28
|
+
export * from "./BMAddSection";
|
|
29
|
+
export * from "./BMWarning";
|
|
30
|
+
export * from "./GenericFailure";
|
|
31
|
+
export * from "./BMCodeBlock";
|
|
32
|
+
export * from "./NoAccess";
|
|
33
|
+
export * from "./BMDatePicker";
|
|
34
|
+
export * from "./BMTable";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./BMClassnameSetup";
|
|
2
|
+
|
|
3
|
+
export { ThemeProvider as BMThemeProvider } from "@mui/material/styles";
|
|
4
|
+
export { CssBaseline as BMCssBaseline } from "@mui/material";
|
|
5
|
+
export * from "./components";
|
|
6
|
+
export * from "./theme/theme";
|
|
7
|
+
export * as mui from '@mui/material';
|
|
8
|
+
export * as bma from './bma';
|
|
9
|
+
export * from './components/BMSmartStatus';
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { Components } from "@mui/material";
|
|
2
|
+
import { colors, themeVariables as variables} from "./variables";
|
|
3
|
+
|
|
4
|
+
declare module "@mui/material/Autocomplete" {
|
|
5
|
+
interface AutocompletePropsSizeOverrides {
|
|
6
|
+
large: true;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const BMAutoComplete: Components["MuiAutocomplete"] = {
|
|
11
|
+
defaultProps: {},
|
|
12
|
+
styleOverrides: {
|
|
13
|
+
popupIndicator: {
|
|
14
|
+
marginRight: 0,
|
|
15
|
+
"&:hover": {
|
|
16
|
+
backgroundColor: "transparent",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
inputRoot: {
|
|
20
|
+
overflow: "hidden",
|
|
21
|
+
padding: "0px",
|
|
22
|
+
height: variables.inputHeight,
|
|
23
|
+
color: colors.grey[900],
|
|
24
|
+
backgroundColor: colors.background.paper,
|
|
25
|
+
borderRadius: variables.borderRadius,
|
|
26
|
+
border: `1px solid ${colors.grey[300]}`,
|
|
27
|
+
"&:hover": {
|
|
28
|
+
borderColor: `${colors.primary[300]}!important`,
|
|
29
|
+
"&$disabled": {
|
|
30
|
+
borderColor: `${colors.grey[300]}!important`,
|
|
31
|
+
cursor: "not-allowed",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
"&$focused": {
|
|
35
|
+
borderColor: `${colors.primary[300]}!important`,
|
|
36
|
+
boxShadow: `0 0 0 2px ${colors.primary[200]}`,
|
|
37
|
+
},
|
|
38
|
+
"&$error": {
|
|
39
|
+
color: colors.error[500],
|
|
40
|
+
backgroundColor: colors.error[100],
|
|
41
|
+
borderColor: colors.error[500],
|
|
42
|
+
"&:hover": {
|
|
43
|
+
borderColor: colors.error[500],
|
|
44
|
+
},
|
|
45
|
+
"&$focused": {
|
|
46
|
+
boxShadow: `0 0 0 2px ${colors.error[100]}`,
|
|
47
|
+
},
|
|
48
|
+
"&$disabled": {
|
|
49
|
+
backgroundColor: colors.grey[200],
|
|
50
|
+
borderColor: colors.grey[300],
|
|
51
|
+
boxShadow: "none",
|
|
52
|
+
cursor: "not-allowed",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
"&$disabled": {
|
|
56
|
+
color: `${colors.grey[600]}!important`,
|
|
57
|
+
backgroundColor: colors.grey[200],
|
|
58
|
+
borderColor: `${colors.grey[300]}!important`,
|
|
59
|
+
"&:hover": {
|
|
60
|
+
backgroundColor: colors.grey[200],
|
|
61
|
+
borderColor: `${colors.grey[300]}!important`,
|
|
62
|
+
boxShadow: "none",
|
|
63
|
+
cursor: "not-allowed",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
"&$multiline": {
|
|
67
|
+
height: "auto",
|
|
68
|
+
padding: 0,
|
|
69
|
+
},
|
|
70
|
+
variants: [
|
|
71
|
+
{
|
|
72
|
+
props: { size: "large" },
|
|
73
|
+
style: {
|
|
74
|
+
height: 40,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
input: {
|
|
80
|
+
border: 0,
|
|
81
|
+
boxShadow: "none",
|
|
82
|
+
"&::placeholder": {
|
|
83
|
+
opacity: 1,
|
|
84
|
+
color: colors.grey[600],
|
|
85
|
+
},
|
|
86
|
+
"&:focus": {
|
|
87
|
+
outline: "none",
|
|
88
|
+
},
|
|
89
|
+
marginLeft: 2,
|
|
90
|
+
},
|
|
91
|
+
tag: {
|
|
92
|
+
backgroundColor: colors.primary[200],
|
|
93
|
+
borderRadius: 6,
|
|
94
|
+
"&:hover": {
|
|
95
|
+
backgroundColor: colors.primary[100],
|
|
96
|
+
},
|
|
97
|
+
"& .MuiChip-deleteIcon": {
|
|
98
|
+
width: 16,
|
|
99
|
+
height: 16,
|
|
100
|
+
},
|
|
101
|
+
fontSize: 11.5,
|
|
102
|
+
lineHeight: 16,
|
|
103
|
+
fontWeight: 400,
|
|
104
|
+
height: 24,
|
|
105
|
+
margin: "0 4px 0 0",
|
|
106
|
+
border: 0,
|
|
107
|
+
},
|
|
108
|
+
option: {
|
|
109
|
+
fontSize: 13,
|
|
110
|
+
fontWeight: 400,
|
|
111
|
+
fontFamily: '"Inter", sans-serif',
|
|
112
|
+
paddingTop: 6,
|
|
113
|
+
paddingBottom: 6,
|
|
114
|
+
height: 32,
|
|
115
|
+
minHeight: 32,
|
|
116
|
+
lineHeight: 1.25,
|
|
117
|
+
"&:focus": {
|
|
118
|
+
backgroundColor: colors.primary[100],
|
|
119
|
+
},
|
|
120
|
+
"&[aria-selected=true]": {
|
|
121
|
+
backgroundColor: colors.primary[200],
|
|
122
|
+
},
|
|
123
|
+
paddingLeft: "16px !important",
|
|
124
|
+
"&[aria-disabled=true]": {
|
|
125
|
+
pointerEvents: "inherit",
|
|
126
|
+
cursor: "not-allowed",
|
|
127
|
+
},
|
|
128
|
+
"&[aria-disabled=true]:active": {
|
|
129
|
+
pointerEvents: "none",
|
|
130
|
+
cursor: "not-allowed",
|
|
131
|
+
},
|
|
132
|
+
"&.Mui-focusVisible": {
|
|
133
|
+
backgroundColor: "unset",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
groupLabel: {
|
|
137
|
+
fontSize: 13,
|
|
138
|
+
fontWeight: 400,
|
|
139
|
+
paddingTop: 6,
|
|
140
|
+
paddingBottom: 6,
|
|
141
|
+
minHeight: 32,
|
|
142
|
+
lineHeight: 1.25,
|
|
143
|
+
paddingLeft: "16px !important",
|
|
144
|
+
},
|
|
145
|
+
listbox: {
|
|
146
|
+
boxShadow: "none",
|
|
147
|
+
border: `1px solid ${colors.grey[300]}`,
|
|
148
|
+
borderRadius: variables.borderRadius,
|
|
149
|
+
lineHeight: "32px",
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { Components } from "@mui/material";
|
|
2
|
+
declare module "@mui/material/Button" {
|
|
3
|
+
interface ButtonPropsVariantOverrides {
|
|
4
|
+
primary: true;
|
|
5
|
+
secondary: true;
|
|
6
|
+
ghost: true;
|
|
7
|
+
gradient: true;
|
|
8
|
+
}
|
|
9
|
+
interface ButtonPropsSizeOverrides {
|
|
10
|
+
small: true;
|
|
11
|
+
large: true;
|
|
12
|
+
medium: true;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export const BMButton: Components["MuiButton"] = {
|
|
16
|
+
defaultProps: {
|
|
17
|
+
disableRipple: true,
|
|
18
|
+
disableElevation: true,
|
|
19
|
+
size: "medium",
|
|
20
|
+
},
|
|
21
|
+
styleOverrides: {
|
|
22
|
+
// biome-ignore lint: TODO for any
|
|
23
|
+
root: ({ theme }: { theme: any; ownerState: any }) => ({
|
|
24
|
+
minWidth: 12,
|
|
25
|
+
height: 32,
|
|
26
|
+
fontSize: 13,
|
|
27
|
+
fontWeight: 600,
|
|
28
|
+
textTransform: "none",
|
|
29
|
+
padding: "0 16px",
|
|
30
|
+
'&.Mui-disabled': {
|
|
31
|
+
cursor: 'not-allowed',
|
|
32
|
+
backgroundColor: `${theme.palette.grey[300]} !important`,
|
|
33
|
+
color: `${theme.palette.grey[500]} !important`,
|
|
34
|
+
pointerEvents: 'unset',
|
|
35
|
+
border: '0 !important',
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
variants: [
|
|
39
|
+
{
|
|
40
|
+
props: { variant: "primary" },
|
|
41
|
+
style: {
|
|
42
|
+
color: theme.palette.common.white,
|
|
43
|
+
backgroundColor: theme.palette.primary[600],
|
|
44
|
+
":hover": {
|
|
45
|
+
backgroundColor: theme.palette.primary[500],
|
|
46
|
+
},
|
|
47
|
+
":active": {
|
|
48
|
+
backgroundColor: theme.palette.primary[700],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
props: { variant: "secondary" },
|
|
54
|
+
style: {
|
|
55
|
+
color: theme.palette.primary[600],
|
|
56
|
+
backgroundColor: theme.palette.background.paper,
|
|
57
|
+
border: `1px solid ${theme.palette.primary[600]}`,
|
|
58
|
+
":hover": {
|
|
59
|
+
borderColor: theme.palette.primary[500],
|
|
60
|
+
color: theme.palette.primary[500],
|
|
61
|
+
},
|
|
62
|
+
":active": {
|
|
63
|
+
borderColor: theme.palette.primary[700],
|
|
64
|
+
color: theme.palette.primary[700],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
props: { variant: "ghost" },
|
|
70
|
+
style: {
|
|
71
|
+
color: theme.palette.primary[600],
|
|
72
|
+
backgroundColor: "transparent !important",
|
|
73
|
+
border: "1px solid transparent",
|
|
74
|
+
":hover": {
|
|
75
|
+
border: `1px solid ${theme.palette.primary[500]}`,
|
|
76
|
+
color: theme.palette.primary[500],
|
|
77
|
+
},
|
|
78
|
+
":active": {
|
|
79
|
+
border: `1px solid ${theme.palette.primary[700]}`,
|
|
80
|
+
color: theme.palette.primary[700],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
props: { variant: "gradient" },
|
|
86
|
+
style: {
|
|
87
|
+
color: theme.palette.common.white,
|
|
88
|
+
background:
|
|
89
|
+
"linear-gradient(272.58deg, #7879F1 1.06%, #7879F1 33.24%, #5D5FEF 56.4%)",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
props: { disabled: true },
|
|
94
|
+
style: {
|
|
95
|
+
background: theme.palette.grey[300],
|
|
96
|
+
color: `${theme.palette.grey[500]} !important`,
|
|
97
|
+
cursor: "not-allowed",
|
|
98
|
+
border: "none",
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
props: (props) => props.startIcon || props.endIcon,
|
|
103
|
+
style: {
|
|
104
|
+
padding: "0 11.2px",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
}),
|
|
109
|
+
// biome-ignore lint: TODO for any
|
|
110
|
+
sizeSmall: {
|
|
111
|
+
height: 24,
|
|
112
|
+
padding: "0 11.2px",
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
sizeLarge: {
|
|
116
|
+
height: 40,
|
|
117
|
+
fontSize: 13,
|
|
118
|
+
},
|
|
119
|
+
startIcon: {
|
|
120
|
+
marginRight: 4,
|
|
121
|
+
"&.MuiButton-icon.MuiButtonSizeLarge": {
|
|
122
|
+
marginRight: 8,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
endIcon: {
|
|
126
|
+
marginLeft: 4,
|
|
127
|
+
".MuiButton-icon.MuiButtonSizeLarge": {
|
|
128
|
+
marginLeft: 8,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
};
|