@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,65 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import type { Meta } from "@storybook/react";
|
|
4
|
+
import { BMAutoComplete, BMAutoCompleteProps } from "../src";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "BMAutoComplete",
|
|
8
|
+
component: BMAutoComplete,
|
|
9
|
+
parameters: {
|
|
10
|
+
controls: {
|
|
11
|
+
include: ["disabled", "size"],
|
|
12
|
+
sort: "alpha",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
} as Meta;
|
|
16
|
+
|
|
17
|
+
const args = {
|
|
18
|
+
options: [
|
|
19
|
+
{ label: "The Shawshank Redemption", year: 1994 },
|
|
20
|
+
{ label: "The Godfather", year: 1972 },
|
|
21
|
+
{ label: "The Godfather: Part II", year: 1974 },
|
|
22
|
+
{ label: "The Dark Knight", year: 2008 },
|
|
23
|
+
{ label: "12 Angry Men", year: 1957 },
|
|
24
|
+
{ label: "Schindler's List", year: 1993 },
|
|
25
|
+
{ label: "Pulp Fiction", year: 1994 },
|
|
26
|
+
{
|
|
27
|
+
label: "The Lord of the Rings: The Return of the King",
|
|
28
|
+
year: 2003,
|
|
29
|
+
},
|
|
30
|
+
{ label: "The Good, the Bad and the Ugly", year: 1966 },
|
|
31
|
+
{ label: "Fight Club", year: 1999 },
|
|
32
|
+
],
|
|
33
|
+
getOptionLabel: (option: Record<string, string>): string =>
|
|
34
|
+
option.label ?? "",
|
|
35
|
+
// tooltipText: "These are Top 10 films as rated by IMDb users.",
|
|
36
|
+
disabled: false,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const AutoComplete = (args: BMAutoCompleteProps) => {
|
|
40
|
+
const [value, setValue] = useState<any>(args.options[0]);
|
|
41
|
+
return (
|
|
42
|
+
<Box sx={{ width: 500 }}>
|
|
43
|
+
Medium :{" "}
|
|
44
|
+
<BMAutoComplete
|
|
45
|
+
{...args}
|
|
46
|
+
value={value}
|
|
47
|
+
onChange={(event, newVal) => {
|
|
48
|
+
setValue(newVal);
|
|
49
|
+
}}
|
|
50
|
+
bmInputProps={{ placeholder: "Select Movie", dataTestId: "bm-autocomplete" }}
|
|
51
|
+
/>
|
|
52
|
+
<br /> Multiple for BMA:
|
|
53
|
+
<BMAutoComplete
|
|
54
|
+
{...args}
|
|
55
|
+
openOnFocus={true}
|
|
56
|
+
// value={value}
|
|
57
|
+
multiple={true}
|
|
58
|
+
onChange={(event, newVal) => setValue(newVal)}
|
|
59
|
+
bmInputProps={{ placeholder: "Select Movie", dataTestId: "bm-autocomplete-multiple" }}
|
|
60
|
+
/>
|
|
61
|
+
</Box>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
AutoComplete.args = args;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Box, Typography } from "@mui/material";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import { BMAvatar, AvatarProps } from "../src";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<AvatarProps> = {
|
|
7
|
+
title: "InReview/BMAvatar",
|
|
8
|
+
component: BMAvatar,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
parameters: {
|
|
11
|
+
controls: { enabled: false },
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
export const AllVariants: StoryObj = {
|
|
18
|
+
render: () => (
|
|
19
|
+
<Box sx={{ display: "flex", gap: 4, alignItems: "center" }}>
|
|
20
|
+
<Box sx={{ alignItems: "center" }}>
|
|
21
|
+
<Typography variant="body2" gutterBottom sx={{ mb: 1 }}>
|
|
22
|
+
With Image (Large)
|
|
23
|
+
</Typography>
|
|
24
|
+
<BMAvatar
|
|
25
|
+
size="large"
|
|
26
|
+
imageUrl="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?q=80&w=3560&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
|
|
27
|
+
/>
|
|
28
|
+
</Box>
|
|
29
|
+
|
|
30
|
+
<Box sx={{ alignItems: "center" }}>
|
|
31
|
+
<Typography variant="body2" gutterBottom sx={{ mb: 1 }}>
|
|
32
|
+
With No Image (Medium)
|
|
33
|
+
</Typography>
|
|
34
|
+
<BMAvatar size="medium" />
|
|
35
|
+
</Box>
|
|
36
|
+
|
|
37
|
+
<Box sx={{ alignItems: "center" }}>
|
|
38
|
+
<Typography variant="body2" gutterBottom sx={{ mb: 1 }}>
|
|
39
|
+
Small Size
|
|
40
|
+
</Typography>
|
|
41
|
+
<BMAvatar size="small" />
|
|
42
|
+
</Box>
|
|
43
|
+
|
|
44
|
+
<Box sx={{ alignItems: "center" }}>
|
|
45
|
+
<Typography variant="body2" gutterBottom sx={{ mb: 1 }}>
|
|
46
|
+
Broken Image
|
|
47
|
+
</Typography>
|
|
48
|
+
<BMAvatar size="large" imageUrl="https://broken-link.jpg" />
|
|
49
|
+
</Box>
|
|
50
|
+
</Box>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const Default: StoryObj<AvatarProps> = {
|
|
55
|
+
argTypes: {
|
|
56
|
+
size: {
|
|
57
|
+
control: {
|
|
58
|
+
type: "radio",
|
|
59
|
+
options: ["small", "medium", "large"],
|
|
60
|
+
},
|
|
61
|
+
description: "Size of the avatar",
|
|
62
|
+
},
|
|
63
|
+
imageUrl: {
|
|
64
|
+
control: "text",
|
|
65
|
+
description: "URL for the image",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
render: (args) => (
|
|
69
|
+
<Box sx={{ alignItems: "center" }}>
|
|
70
|
+
<Typography variant="body2" gutterBottom sx={{ mb: 1 }}>
|
|
71
|
+
Default
|
|
72
|
+
</Typography>
|
|
73
|
+
<BMAvatar {...args} />
|
|
74
|
+
</Box>
|
|
75
|
+
),
|
|
76
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Search } from "@mui/icons-material";
|
|
2
|
+
import { Box, SpeedDialIcon, Typography } from "@mui/material";
|
|
3
|
+
import type { Meta } from "@storybook/react";
|
|
4
|
+
import { BMButton, type BMButtonProps } from "../src";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<BMButtonProps> = {
|
|
7
|
+
component: BMButton,
|
|
8
|
+
title: "Button",
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
|
|
12
|
+
const getButtons = (type: BMButtonProps["variant"], props: BMButtonProps) => (
|
|
13
|
+
<Box sx={{ display: "flex", gap: "18px", alignItems: "center" }}>
|
|
14
|
+
<Typography variant="body2">{type}</Typography>
|
|
15
|
+
<BMButton {...props} variant={type}>
|
|
16
|
+
Button
|
|
17
|
+
</BMButton>
|
|
18
|
+
<BMButton {...props} disabled variant={type}>
|
|
19
|
+
Disabled
|
|
20
|
+
</BMButton>
|
|
21
|
+
<BMButton {...props} variant={type} id="hover">
|
|
22
|
+
Hover
|
|
23
|
+
</BMButton>
|
|
24
|
+
<BMButton {...props} variant={type} id="active">
|
|
25
|
+
Active
|
|
26
|
+
</BMButton>
|
|
27
|
+
<BMButton {...props} variant={type} startIcon={<Search />}>
|
|
28
|
+
Search
|
|
29
|
+
</BMButton>
|
|
30
|
+
<BMButton {...props} variant={type} endIcon={<SpeedDialIcon />}>
|
|
31
|
+
End Icon
|
|
32
|
+
</BMButton>
|
|
33
|
+
</Box>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export const Button = (props: BMButtonProps) => (
|
|
37
|
+
<Box
|
|
38
|
+
sx={{
|
|
39
|
+
display: "flex",
|
|
40
|
+
gap: "18px",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
flexDirection: "column",
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
{getButtons("primary", props)}
|
|
46
|
+
{getButtons("secondary", props)}
|
|
47
|
+
{getButtons("ghost", props)}
|
|
48
|
+
{getButtons("gradient", props)}
|
|
49
|
+
</Box>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
Button.parameters = {
|
|
53
|
+
pseudo: {
|
|
54
|
+
hover: ["#hover"],
|
|
55
|
+
active: "#active",
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// storybook stories don't need i18n, so turning off corresponding eslint rule
|
|
2
|
+
/* eslint-disable react/jsx-no-literals */
|
|
3
|
+
|
|
4
|
+
import { Settings } from "@mui/icons-material";
|
|
5
|
+
import { BMButton } from "../src";
|
|
6
|
+
import CaretDownIcon from '../src/assets/icons/caret-down.svg';
|
|
7
|
+
import { BMButtonProps } from "../src";
|
|
8
|
+
import { Meta } from "@storybook/react";
|
|
9
|
+
export default {
|
|
10
|
+
title: 'BMButton2',
|
|
11
|
+
component: BMButton,
|
|
12
|
+
parameters: {
|
|
13
|
+
controls: {
|
|
14
|
+
include: ['children', 'variant', 'size', 'disabled', 'showSpinner', 'fullWidth', 'startIcon', 'endIcon'],
|
|
15
|
+
sort: 'alpha'
|
|
16
|
+
},
|
|
17
|
+
actions: {
|
|
18
|
+
handles: ['click']
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
argTypes: {
|
|
22
|
+
size: {
|
|
23
|
+
options: ['small', 'medium', 'large']
|
|
24
|
+
},
|
|
25
|
+
startIcon: {
|
|
26
|
+
control: { type: 'boolean' },
|
|
27
|
+
mapping: { true: <Settings />, false: null }
|
|
28
|
+
},
|
|
29
|
+
endIcon: {
|
|
30
|
+
control: { type: 'boolean' },
|
|
31
|
+
mapping: { true: <CaretDownIcon />, false: null }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
} as Meta;
|
|
35
|
+
|
|
36
|
+
export const Primary = (props: BMButtonProps) => (
|
|
37
|
+
<div>
|
|
38
|
+
<BMButton variant="primary" {...props}>Default</BMButton>
|
|
39
|
+
<p />
|
|
40
|
+
<BMButton variant="primary" startIcon={<Settings />} {...props}>
|
|
41
|
+
Start Icon
|
|
42
|
+
</BMButton>
|
|
43
|
+
<p />
|
|
44
|
+
<BMButton variant="primary" endIcon={<CaretDownIcon />} {...props}>
|
|
45
|
+
End Icon
|
|
46
|
+
</BMButton>
|
|
47
|
+
<p />
|
|
48
|
+
<BMButton variant="primary" startIcon={<Settings />} endIcon={<CaretDownIcon />} {...props}>
|
|
49
|
+
Both Icons
|
|
50
|
+
</BMButton>
|
|
51
|
+
<p />
|
|
52
|
+
<BMButton variant="primary" size="small" {...props}>
|
|
53
|
+
Small size
|
|
54
|
+
</BMButton>
|
|
55
|
+
<p />
|
|
56
|
+
<BMButton variant="primary" disabled {...props}>
|
|
57
|
+
Disabled
|
|
58
|
+
</BMButton>
|
|
59
|
+
<p />
|
|
60
|
+
<BMButton variant="primary" disabled showSpinner {...props}>
|
|
61
|
+
Loading
|
|
62
|
+
</BMButton>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
export const Secondary = (props: BMButtonProps) => (
|
|
67
|
+
<div>
|
|
68
|
+
<BMButton variant="secondary" {...props}>Default</BMButton>
|
|
69
|
+
<p />
|
|
70
|
+
<BMButton variant="secondary" startIcon={<Settings />} {...props}>
|
|
71
|
+
Start Icon
|
|
72
|
+
</BMButton>
|
|
73
|
+
<p />
|
|
74
|
+
<BMButton variant="secondary" endIcon={<CaretDownIcon />} {...props}>
|
|
75
|
+
End Icon
|
|
76
|
+
</BMButton>
|
|
77
|
+
<p />
|
|
78
|
+
<BMButton variant="secondary" startIcon={<Settings />} endIcon={<CaretDownIcon />} {...props}>
|
|
79
|
+
Both Icons
|
|
80
|
+
</BMButton>
|
|
81
|
+
<p />
|
|
82
|
+
<BMButton variant="secondary" size="small" {...props}>
|
|
83
|
+
Small size
|
|
84
|
+
</BMButton>
|
|
85
|
+
<p />
|
|
86
|
+
<BMButton variant="secondary" disabled {...props}>
|
|
87
|
+
Disabled
|
|
88
|
+
</BMButton>
|
|
89
|
+
<p />
|
|
90
|
+
<BMButton variant="secondary" disabled showSpinner {...props}>
|
|
91
|
+
Loading
|
|
92
|
+
</BMButton>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
export const Ghost = (props: BMButtonProps) => (
|
|
97
|
+
<div>
|
|
98
|
+
<BMButton variant="ghost" {...props}>Default</BMButton>
|
|
99
|
+
<p />
|
|
100
|
+
<BMButton variant="ghost" startIcon={<Settings />} {...props}>
|
|
101
|
+
Start Icon
|
|
102
|
+
</BMButton>
|
|
103
|
+
<p />
|
|
104
|
+
<BMButton variant="ghost" endIcon={<CaretDownIcon />} {...props}>
|
|
105
|
+
End Icon
|
|
106
|
+
</BMButton>
|
|
107
|
+
<p />
|
|
108
|
+
<BMButton variant="ghost" startIcon={<Settings />} endIcon={<CaretDownIcon />} {...props}>
|
|
109
|
+
Both Icons
|
|
110
|
+
</BMButton>
|
|
111
|
+
<p />
|
|
112
|
+
<BMButton variant="ghost" size="small" {...props}>
|
|
113
|
+
Small size
|
|
114
|
+
</BMButton>
|
|
115
|
+
<p />
|
|
116
|
+
<BMButton variant="ghost" disabled {...props}>
|
|
117
|
+
Disabled
|
|
118
|
+
</BMButton>
|
|
119
|
+
<p />
|
|
120
|
+
<BMButton variant="ghost" disabled showSpinner {...props}>
|
|
121
|
+
Loading
|
|
122
|
+
</BMButton>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
export const Configurable = (args: BMButtonProps) => <BMButton {...args} />;
|
|
127
|
+
Configurable.args = {
|
|
128
|
+
variant: 'primary',
|
|
129
|
+
size: 'medium',
|
|
130
|
+
children: 'Demo'
|
|
131
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Meta } from "@storybook/react";
|
|
2
|
+
import { BMCheckbox, BMCheckboxField, BMCheckboxProps } from "../src";
|
|
3
|
+
import { useForm, FormProvider } from "react-hook-form";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof BMCheckbox> = {
|
|
6
|
+
component: BMCheckbox,
|
|
7
|
+
title: "Checkbox",
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
|
|
11
|
+
export const Checkbox = (props: BMCheckboxProps) => (
|
|
12
|
+
<BMCheckbox {...props} label="This is a checkbox with label" dataTestId="bm-checkbox-test" />
|
|
13
|
+
);
|
|
14
|
+
interface FormProps {
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
export const CheckboxField = (props: BMCheckboxProps) => {
|
|
18
|
+
const methods = useForm<FormProps>();
|
|
19
|
+
return (
|
|
20
|
+
<FormProvider {...methods}>
|
|
21
|
+
<BMCheckboxField {...props} name="name" label="This is a checkbox with label" dataTestId="bm-checkbox-test" />
|
|
22
|
+
</FormProvider>);
|
|
23
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta } from "@storybook/react";
|
|
2
|
+
import { BMCloudSelectField, BMCloudSelectFieldProps } from "../src";
|
|
3
|
+
import { AWS_CLOUD_OPTION, AZURE_CLOUD_OPTION, GCP_CLOUD_OPTION, K8S_CLOUD_OPTION, ON_PREM_CLOUD_OPTION } from "../src/components/BMCloudSelect/BMCloudList";
|
|
4
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "BMCloudSelectField",
|
|
9
|
+
component: BMCloudSelectField,
|
|
10
|
+
argTypes: {
|
|
11
|
+
},
|
|
12
|
+
} as Meta;
|
|
13
|
+
|
|
14
|
+
interface FormProps {
|
|
15
|
+
cloud: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const BMCloudSelectFieldStory = (args: BMCloudSelectFieldProps<FormProps>) => {
|
|
19
|
+
|
|
20
|
+
const methods = useForm<FormProps>();
|
|
21
|
+
return (
|
|
22
|
+
<FormProvider {...methods}>
|
|
23
|
+
<BMCloudSelectField {...args} name="cloud" />
|
|
24
|
+
</FormProvider>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
BMCloudSelectFieldStory.args = {
|
|
30
|
+
options: [
|
|
31
|
+
AWS_CLOUD_OPTION,
|
|
32
|
+
GCP_CLOUD_OPTION,
|
|
33
|
+
AZURE_CLOUD_OPTION,
|
|
34
|
+
K8S_CLOUD_OPTION,
|
|
35
|
+
ON_PREM_CLOUD_OPTION,
|
|
36
|
+
],
|
|
37
|
+
label: "Select Cloud Provider",
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
BMCloudSelectFieldStory.storyName = "BM Cloud Select";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { BMCodeBlock } from '../src';
|
|
4
|
+
|
|
5
|
+
const sampleCode = `function greet(name) {
|
|
6
|
+
return "Hello, " + name + "!";
|
|
7
|
+
}
|
|
8
|
+
greet("World");`;
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof BMCodeBlock> = {
|
|
11
|
+
title: 'InReview/BMCodeBlock',
|
|
12
|
+
component: BMCodeBlock,
|
|
13
|
+
args: {
|
|
14
|
+
text: sampleCode,
|
|
15
|
+
lang: 'javascript',
|
|
16
|
+
showCopyButton: true,
|
|
17
|
+
enabledExpandCollapse: false,
|
|
18
|
+
copyLabel: 'Copy',
|
|
19
|
+
showAllLabel: 'Show All',
|
|
20
|
+
collapseLabel: 'Collapse',
|
|
21
|
+
onCopySuccess: () => alert('Code copied!'),
|
|
22
|
+
},
|
|
23
|
+
tags: ['autodocs']
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
|
|
28
|
+
type Story = StoryObj<typeof BMCodeBlock>;
|
|
29
|
+
|
|
30
|
+
export const Default: Story = {};
|
|
31
|
+
|
|
32
|
+
export const Expandable: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
enabledExpandCollapse: true,
|
|
35
|
+
collapseHeight: 60
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const MultiBlock: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
multiBlock: true,
|
|
42
|
+
text: [
|
|
43
|
+
'const a = 10;',
|
|
44
|
+
'const b = 20;',
|
|
45
|
+
'console.log(a + b);'
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const CustomLabels: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
copyLabel: 'Copy Code',
|
|
53
|
+
showAllLabel: 'Expand All',
|
|
54
|
+
collapseLabel: 'Collapse',
|
|
55
|
+
enabledExpandCollapse: true
|
|
56
|
+
}
|
|
57
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { BMDatePicker } from "../src";
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof BMDatePicker> = {
|
|
8
|
+
title: "InReview/BMDatePicker",
|
|
9
|
+
component: BMDatePicker,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
argTypes: {
|
|
12
|
+
label: { control: "text" },
|
|
13
|
+
value: { control: "date" },
|
|
14
|
+
readOnly: { control: "boolean" },
|
|
15
|
+
openOnInputClick: { control: "boolean" },
|
|
16
|
+
placeholder: { control: "text" },
|
|
17
|
+
minDate: { control: "date" },
|
|
18
|
+
maxDate: { control: "date" },
|
|
19
|
+
disabled: { control: "boolean" },
|
|
20
|
+
format: { control: "text" },
|
|
21
|
+
bottomNoteText: { control: "text" },
|
|
22
|
+
shouldDisableDate: { table: { disable: true } },
|
|
23
|
+
onChange: { action: "changed" },
|
|
24
|
+
popoverProps: { table: { disable: true } },
|
|
25
|
+
className: { control: "text" },
|
|
26
|
+
dataTestid: { control: "text" },
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default meta;
|
|
31
|
+
|
|
32
|
+
type Story = StoryObj<typeof BMDatePicker>;
|
|
33
|
+
|
|
34
|
+
export const Default: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
label: "Select date",
|
|
37
|
+
readOnly: false,
|
|
38
|
+
openOnInputClick: true,
|
|
39
|
+
placeholder: "YYYY-MM-DD",
|
|
40
|
+
disabled: false,
|
|
41
|
+
format: "yyyy-MM-dd",
|
|
42
|
+
bottomNoteText: "Pick your date here",
|
|
43
|
+
dataTestid: "bm-datepicker",
|
|
44
|
+
},
|
|
45
|
+
render: (args) => (
|
|
46
|
+
<Box sx={{ display: "flex", ml: 1, width: "160px" }}>
|
|
47
|
+
<BMDatePicker {...args} />
|
|
48
|
+
</Box>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const WithState: Story = {
|
|
53
|
+
args: {
|
|
54
|
+
label: "Select date",
|
|
55
|
+
value: null,
|
|
56
|
+
readOnly: false,
|
|
57
|
+
openOnInputClick: true,
|
|
58
|
+
placeholder: "YYYY-MM-DD",
|
|
59
|
+
disabled: false,
|
|
60
|
+
format: "yyyy-MM-dd",
|
|
61
|
+
bottomNoteText: "Pick your date here",
|
|
62
|
+
dataTestid: "bm-datepicker",
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
render: (args) => {
|
|
66
|
+
const [selectedDate, setSelectedDate] = useState<Date | null>(
|
|
67
|
+
args.value ?? null
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const minDate = args.minDate ? new Date(args.minDate) : undefined;
|
|
71
|
+
const maxDate = args.maxDate ? new Date(args.maxDate) : undefined;
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<Box sx={{ display: "flex", ml: 1, width: "160px" }}>
|
|
75
|
+
<BMDatePicker
|
|
76
|
+
{...args}
|
|
77
|
+
value={selectedDate}
|
|
78
|
+
onChange={(date) => {
|
|
79
|
+
setSelectedDate(date);
|
|
80
|
+
args.onChange?.(date);
|
|
81
|
+
}}
|
|
82
|
+
minDate={minDate}
|
|
83
|
+
maxDate={maxDate}
|
|
84
|
+
/>
|
|
85
|
+
</Box>
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Meta, StoryFn } from "@storybook/react";
|
|
2
|
+
import { Box, Button, Divider, MenuItem, Typography } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
import { BMDropdown, DropdownProps } from "../src";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof BMDropdown> = {
|
|
7
|
+
title: "InReview/BMDropdown",
|
|
8
|
+
component: BMDropdown,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
position: {
|
|
12
|
+
options: ["bottom", "right"],
|
|
13
|
+
control: { type: "radio" },
|
|
14
|
+
},
|
|
15
|
+
growDirection: {
|
|
16
|
+
options: ["up", "down", "left", "right"],
|
|
17
|
+
control: { type: "radio" },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
decorators: [
|
|
21
|
+
(Story) => (
|
|
22
|
+
<Box sx={{ margin: "4em auto", width: "250px" }}>
|
|
23
|
+
<Story />
|
|
24
|
+
</Box>
|
|
25
|
+
),
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
|
|
31
|
+
const defaultArgs: Partial<DropdownProps> = {
|
|
32
|
+
position: "bottom",
|
|
33
|
+
growDirection: "down",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Default: StoryFn<DropdownProps> = (props) => {
|
|
37
|
+
return (
|
|
38
|
+
<BMDropdown {...props} origin={<Button>Open Dropdown</Button>}>
|
|
39
|
+
<a href="https://google.com" key="link-option">
|
|
40
|
+
<MenuItem>Google</MenuItem>
|
|
41
|
+
</a>
|
|
42
|
+
<MenuItem
|
|
43
|
+
key="click-option"
|
|
44
|
+
onClick={() => alert("Alert Me button was clicked")}
|
|
45
|
+
>
|
|
46
|
+
Alert Me
|
|
47
|
+
</MenuItem>
|
|
48
|
+
</BMDropdown>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
Default.args = defaultArgs;
|
|
53
|
+
|
|
54
|
+
export const Popover: StoryFn<DropdownProps> = (props) => {
|
|
55
|
+
return (
|
|
56
|
+
<BMDropdown {...props} origin={<Button>Open Alerts</Button>}>
|
|
57
|
+
<Box sx={{ py: 1, px: 2 }}>
|
|
58
|
+
<Typography variant="h6" gutterBottom>
|
|
59
|
+
Notifications
|
|
60
|
+
</Typography>
|
|
61
|
+
|
|
62
|
+
<Divider sx={{ mb: 1 }} />
|
|
63
|
+
|
|
64
|
+
<Typography variant="body2">
|
|
65
|
+
You can put anything inside the popover
|
|
66
|
+
</Typography>
|
|
67
|
+
|
|
68
|
+
<ul style={{ paddingLeft: 16, marginTop: 8 }}>
|
|
69
|
+
<li>
|
|
70
|
+
<Box>Name of the alert</Box>
|
|
71
|
+
</li>
|
|
72
|
+
<li>
|
|
73
|
+
<Box>Name of the alert</Box>
|
|
74
|
+
</li>
|
|
75
|
+
<li>
|
|
76
|
+
<Box>Name of the alert</Box>
|
|
77
|
+
</li>
|
|
78
|
+
</ul>
|
|
79
|
+
</Box>
|
|
80
|
+
</BMDropdown>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
Popover.args = defaultArgs;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
|
+
import { BMButtonGroup, BMButton } from '../src/components';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'BMGroupButton',
|
|
6
|
+
component: BMButtonGroup,
|
|
7
|
+
argTypes: {
|
|
8
|
+
options: { control: 'array' },
|
|
9
|
+
selected: { control: 'text' },
|
|
10
|
+
onChange: { action: 'changed' },
|
|
11
|
+
},
|
|
12
|
+
} as ComponentMeta<typeof BMButtonGroup>;
|
|
13
|
+
|
|
14
|
+
const Template: ComponentStory<typeof BMButtonGroup> = (args) => <BMButtonGroup {...args} />;
|
|
15
|
+
|
|
16
|
+
export const Default = Template.bind({});
|
|
17
|
+
Default.args = {
|
|
18
|
+
buttons:[
|
|
19
|
+
{
|
|
20
|
+
label: '1',
|
|
21
|
+
onClick: () => console.log('Button 1 clicked'),
|
|
22
|
+
buttonProps: {
|
|
23
|
+
variant: 'secondary',
|
|
24
|
+
dataTestId: 'bm-group-button-1'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: '2',
|
|
29
|
+
onClick: () => console.log('Button 2 clicked'),
|
|
30
|
+
buttonProps: {
|
|
31
|
+
variant: 'secondary',
|
|
32
|
+
dataTestId: 'bm-group-button-2'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: '3',
|
|
37
|
+
onClick: () => console.log('Button 3 clicked'),
|
|
38
|
+
buttonProps: {
|
|
39
|
+
variant: 'secondary',
|
|
40
|
+
dataTestId: 'bm-group-button-3'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: '4',
|
|
45
|
+
onClick: () => console.log('Button 4 clicked'),
|
|
46
|
+
buttonProps: {
|
|
47
|
+
variant: 'secondary',
|
|
48
|
+
dataTestId: 'bm-group-button-4'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
active: '1',
|
|
53
|
+
};
|