@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,93 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import type { Meta } from "@storybook/react";
|
|
4
|
+
import {
|
|
5
|
+
BMMultiEntry,
|
|
6
|
+
BMMultiEntryProps,
|
|
7
|
+
} from "../src/components/BMMultiEntry/BMMultiEntry";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "InReview/BMMultiEntry",
|
|
11
|
+
component: BMMultiEntry,
|
|
12
|
+
parameters: {
|
|
13
|
+
controls: {
|
|
14
|
+
include: [
|
|
15
|
+
"label",
|
|
16
|
+
"placeholderText",
|
|
17
|
+
"disabled",
|
|
18
|
+
"lowercaseEntry",
|
|
19
|
+
"helperText",
|
|
20
|
+
"error",
|
|
21
|
+
"overrideHeight",
|
|
22
|
+
"overrideWidth",
|
|
23
|
+
"subLabel",
|
|
24
|
+
"multiEntryHitEnterMsg",
|
|
25
|
+
"removeInvalidEntriesMsg",
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
argTypes: {
|
|
30
|
+
error: {
|
|
31
|
+
control: "boolean",
|
|
32
|
+
},
|
|
33
|
+
disabled: {
|
|
34
|
+
control: "boolean",
|
|
35
|
+
},
|
|
36
|
+
label: {
|
|
37
|
+
control: "text",
|
|
38
|
+
},
|
|
39
|
+
helperText: {
|
|
40
|
+
control: "text",
|
|
41
|
+
},
|
|
42
|
+
placeholderText: {
|
|
43
|
+
control: "text",
|
|
44
|
+
},
|
|
45
|
+
overrideHeight: {
|
|
46
|
+
control: "number",
|
|
47
|
+
},
|
|
48
|
+
overrideWidth: {
|
|
49
|
+
control: "number",
|
|
50
|
+
},
|
|
51
|
+
lowercaseEntry: {
|
|
52
|
+
control: "boolean",
|
|
53
|
+
},
|
|
54
|
+
subLabel: {
|
|
55
|
+
control: "text",
|
|
56
|
+
},
|
|
57
|
+
removeInvalidEntriesMsg: {
|
|
58
|
+
control: "text",
|
|
59
|
+
},
|
|
60
|
+
multiEntryHitEnterMsg: {
|
|
61
|
+
control: "text",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
} as Meta;
|
|
65
|
+
|
|
66
|
+
export const MultiEntry = (args: BMMultiEntryProps) => {
|
|
67
|
+
const [value, setValue] = useState<string[]>((args.value as string[]) ?? []);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Box width="600px" p={3}>
|
|
71
|
+
<BMMultiEntry
|
|
72
|
+
{...args}
|
|
73
|
+
value={value}
|
|
74
|
+
onChange={(val) => {
|
|
75
|
+
setValue(val);
|
|
76
|
+
}}
|
|
77
|
+
overrideHeight={154}
|
|
78
|
+
overrideWidth={572}
|
|
79
|
+
/>
|
|
80
|
+
</Box>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
MultiEntry.args = {
|
|
85
|
+
label: "Enter Tags",
|
|
86
|
+
placeholderText: "Type and hit enter...",
|
|
87
|
+
value: ["one", "two"],
|
|
88
|
+
lowercaseEntry: false,
|
|
89
|
+
disabled: false,
|
|
90
|
+
removeInvalidEntriesMsg: "Please remove invalid entries.",
|
|
91
|
+
multiEntryHitEnterMsg: "Press Enter to confirm your entry.",
|
|
92
|
+
subLabel: "Separate multiple values by pressing Enter, Space, or Comma.",
|
|
93
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Box } from "@mui/material";
|
|
2
|
+
import type { Meta } from "@storybook/react";
|
|
3
|
+
import { BMMultiLevelStepper, BMStepperProps } from "../src";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "BMMultiLevelStepper",
|
|
7
|
+
component: BMMultiLevelStepper,
|
|
8
|
+
parameters: {
|
|
9
|
+
controls: {
|
|
10
|
+
include: ["activeStep"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
} as Meta;
|
|
14
|
+
|
|
15
|
+
export const MultiLevelStepper = (args: BMStepperProps) => (
|
|
16
|
+
<Box
|
|
17
|
+
display="flex"
|
|
18
|
+
sx={{
|
|
19
|
+
width: "300px",
|
|
20
|
+
border: "1px solid #E9EEF2",
|
|
21
|
+
bgColor: "#FBFCFD",
|
|
22
|
+
height: "100vh",
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
<BMMultiLevelStepper {...args} />
|
|
26
|
+
</Box>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
MultiLevelStepper.args = {
|
|
30
|
+
steps: [
|
|
31
|
+
{
|
|
32
|
+
groupTitle: "General",
|
|
33
|
+
subSteps: [
|
|
34
|
+
{
|
|
35
|
+
title: "General Settings",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
groupTitle: "Placement",
|
|
41
|
+
subSteps: [
|
|
42
|
+
{
|
|
43
|
+
title: "Resilience and Regions",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
title: "Nodes and Availability Zones",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
groupTitle: "Hardware",
|
|
52
|
+
subSteps: [
|
|
53
|
+
{
|
|
54
|
+
title: "Instance Settings",
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
groupTitle: "Database",
|
|
60
|
+
subSteps: [
|
|
61
|
+
{
|
|
62
|
+
title: "Database Settings",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
groupTitle: "Security",
|
|
68
|
+
subSteps: [
|
|
69
|
+
{
|
|
70
|
+
title: "Security Settings",
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
groupTitle: "Advanced",
|
|
76
|
+
subSteps: [
|
|
77
|
+
{
|
|
78
|
+
title: "Proxy Settings",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
title: "Other Advanced Settings",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
activeStep: 5,
|
|
87
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Box, Typography } from "@mui/material";
|
|
3
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { BMPagination } from "../src";
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof BMPagination> = {
|
|
8
|
+
title: "InReview/BMPagination",
|
|
9
|
+
component: BMPagination,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
parameters: {
|
|
12
|
+
controls: { expanded: true },
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
|
|
18
|
+
type Story = StoryObj<typeof BMPagination>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
render: (args) => {
|
|
22
|
+
const [currentPage, setCurrentPage] = useState<number>(1);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Box sx={{ padding: 2 }}>
|
|
26
|
+
<Typography variant="subtitle1" sx={{ mb: 2 }}>
|
|
27
|
+
Current Page: {currentPage}
|
|
28
|
+
</Typography>
|
|
29
|
+
<BMPagination
|
|
30
|
+
{...args}
|
|
31
|
+
currentPage={currentPage}
|
|
32
|
+
onPageSelect={(page) => setCurrentPage(page)}
|
|
33
|
+
/>
|
|
34
|
+
</Box>
|
|
35
|
+
);
|
|
36
|
+
},
|
|
37
|
+
args: {
|
|
38
|
+
pageSize: 5,
|
|
39
|
+
hasMore: true,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Grid, Paper } from "@mui/material";
|
|
2
|
+
import type { Meta } from "@storybook/react";
|
|
3
|
+
import { Controller, useForm } from "react-hook-form";
|
|
4
|
+
import { BMButton, type BMInputProps, BMPassword } from "../src";
|
|
5
|
+
|
|
6
|
+
const PASSWORD_REGEX =
|
|
7
|
+
/^(?=.*[0-9])(?=.*[!@#$%^&*])(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9!@#$%^&*]{8,256}$/;
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "BMPassword",
|
|
11
|
+
component: BMPassword,
|
|
12
|
+
parameters: {
|
|
13
|
+
controls: {
|
|
14
|
+
include: [
|
|
15
|
+
"value",
|
|
16
|
+
"placeholder",
|
|
17
|
+
"label",
|
|
18
|
+
"error",
|
|
19
|
+
"disabled",
|
|
20
|
+
"helperText",
|
|
21
|
+
"fullWidth",
|
|
22
|
+
],
|
|
23
|
+
sort: "alpha",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
} as Meta;
|
|
27
|
+
|
|
28
|
+
const defaultArgs: Partial<BMInputProps> = {
|
|
29
|
+
label: "",
|
|
30
|
+
placeholder: "Password",
|
|
31
|
+
error: false,
|
|
32
|
+
helperText:
|
|
33
|
+
"Password must contain at least 1 digit, 1 capital, 1 lowercase and one of the !@#$%^&* (special) characters.",
|
|
34
|
+
disabled: false,
|
|
35
|
+
fullWidth: true,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
interface FormData {
|
|
39
|
+
password: string;
|
|
40
|
+
repeatPassword: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const defaultValues: FormData = {
|
|
44
|
+
password: "",
|
|
45
|
+
repeatPassword: "",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Password = (args: BMInputProps) => {
|
|
49
|
+
const { control, watch, handleSubmit } = useForm<FormData>({ defaultValues });
|
|
50
|
+
|
|
51
|
+
const pwd = watch("password");
|
|
52
|
+
|
|
53
|
+
const onSubmit = handleSubmit((data: FormData) =>
|
|
54
|
+
// eslint-disable-next-line implicit-arrow-linebreak
|
|
55
|
+
alert(
|
|
56
|
+
`password: ${data.password} , Repeat Password : ${data.repeatPassword}`,
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Grid
|
|
62
|
+
container
|
|
63
|
+
sx={{
|
|
64
|
+
justifyContent: "center",
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<Grid item sm={12} md={6} lg={5} xl={4}>
|
|
69
|
+
<Paper style={{ padding: 15 }}>
|
|
70
|
+
<form noValidate onSubmit={onSubmit}>
|
|
71
|
+
<Grid container spacing={2}>
|
|
72
|
+
<Grid item xs={12}>
|
|
73
|
+
<Controller
|
|
74
|
+
name={"password"}
|
|
75
|
+
control={control}
|
|
76
|
+
rules={{
|
|
77
|
+
required: "You must specify a password",
|
|
78
|
+
minLength: 8,
|
|
79
|
+
pattern: PASSWORD_REGEX,
|
|
80
|
+
}}
|
|
81
|
+
render={({ field, fieldState }) => (
|
|
82
|
+
<BMPassword
|
|
83
|
+
{...args}
|
|
84
|
+
error={!!fieldState.error}
|
|
85
|
+
helperText={
|
|
86
|
+
fieldState.error?.message === ""
|
|
87
|
+
? args.helperText
|
|
88
|
+
: fieldState.error?.message
|
|
89
|
+
}
|
|
90
|
+
{...field}
|
|
91
|
+
/>
|
|
92
|
+
)}
|
|
93
|
+
/>
|
|
94
|
+
</Grid>
|
|
95
|
+
<Grid item xs={12}>
|
|
96
|
+
<Controller
|
|
97
|
+
name="repeatPassword"
|
|
98
|
+
control={control}
|
|
99
|
+
rules={{
|
|
100
|
+
required: "You must specify a password",
|
|
101
|
+
validate: (value) =>
|
|
102
|
+
value === pwd || "The passwords do not match",
|
|
103
|
+
}}
|
|
104
|
+
render={({ field, fieldState }) => (
|
|
105
|
+
<BMPassword
|
|
106
|
+
{...args}
|
|
107
|
+
error={!!fieldState.error}
|
|
108
|
+
placeholder={"Repeat Password"}
|
|
109
|
+
helperText={fieldState.error?.message}
|
|
110
|
+
{...field}
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
113
|
+
/>
|
|
114
|
+
</Grid>
|
|
115
|
+
<Grid item xs={12}>
|
|
116
|
+
<BMButton
|
|
117
|
+
type="submit"
|
|
118
|
+
variant="primary"
|
|
119
|
+
color="primary"
|
|
120
|
+
fullWidth
|
|
121
|
+
dataTestId="submit-password-form"
|
|
122
|
+
>
|
|
123
|
+
{" Submit"}
|
|
124
|
+
</BMButton>
|
|
125
|
+
</Grid>
|
|
126
|
+
</Grid>
|
|
127
|
+
</form>
|
|
128
|
+
</Paper>
|
|
129
|
+
</Grid>
|
|
130
|
+
</Grid>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
Password.args = defaultArgs;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Box, Typography } from "@mui/material";
|
|
2
|
+
import type { Meta } from "@storybook/react";
|
|
3
|
+
import { type ProgressProps, BMProgress } from "../src/components/BMProgress";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "BMProgress",
|
|
7
|
+
component: BMProgress,
|
|
8
|
+
decorators: [
|
|
9
|
+
// biome-ignore lint: TODO
|
|
10
|
+
(Story: any) => (
|
|
11
|
+
<div style={{ margin: "1em", width: "200px" }}>
|
|
12
|
+
<Story />
|
|
13
|
+
</div>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
} as Meta;
|
|
17
|
+
|
|
18
|
+
export const Primary = (props: ProgressProps) => {
|
|
19
|
+
return <BMProgress color="primary" value={70} {...props} />;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Secondary = (props: ProgressProps) => {
|
|
23
|
+
return <BMProgress color="secondary" value={70} {...props} />;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Info = (props: ProgressProps) => {
|
|
27
|
+
return <BMProgress color="info" value={50} {...props} />;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Warning = (props: ProgressProps) => {
|
|
31
|
+
return <BMProgress color="warning" value={70} {...props} />;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const toastError = (props: ProgressProps) => {
|
|
35
|
+
return <BMProgress color="error" value={90} {...props} />;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Success = (props: ProgressProps) => {
|
|
39
|
+
return <BMProgress color="success" value={20} {...props} />;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const CustomColor = (props: ProgressProps) => {
|
|
43
|
+
return <BMProgress color="#f0bcba" value={60} {...props} />;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const ProgressWithLabel = (props: ProgressProps) => {
|
|
47
|
+
return (
|
|
48
|
+
<Box display="flex" alignItems="center">
|
|
49
|
+
<Box width="200px" mr={1}>
|
|
50
|
+
<BMProgress value={20} {...props} />
|
|
51
|
+
</Box>
|
|
52
|
+
<Box minWidth={35}>
|
|
53
|
+
<Typography
|
|
54
|
+
variant="body2"
|
|
55
|
+
color="textSecondary"
|
|
56
|
+
>{`${Math.round(20)}%`}</Typography>
|
|
57
|
+
</Box>
|
|
58
|
+
</Box>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useForm } from "react-hook-form";
|
|
2
|
+
import type { Meta } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
BMRadio,
|
|
6
|
+
BMRadioGroup,
|
|
7
|
+
BMRadioGroupField,
|
|
8
|
+
type BMRadioGroupProps,
|
|
9
|
+
type BMRadioProps,
|
|
10
|
+
} from "../src";
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: "BMRadio",
|
|
14
|
+
component: BMRadio,
|
|
15
|
+
tags: ['autodocs']
|
|
16
|
+
} as Meta;
|
|
17
|
+
|
|
18
|
+
export const Radio = (args: BMRadioProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<div style={{ display: "flex", gap: 16 }}>
|
|
21
|
+
<BMRadio {...args} label="Unchecked" />
|
|
22
|
+
<BMRadio {...args} disabled label="Disabled" />
|
|
23
|
+
<BMRadio {...args} checked label="Checked" />
|
|
24
|
+
<BMRadio {...args} checked disabled label="checked Disabled" />
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const RadioGroup = (args: BMRadioGroupProps) => (
|
|
30
|
+
<BMRadioGroup {...args} />
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
RadioGroup.args = {
|
|
34
|
+
options: [
|
|
35
|
+
{ value: "a", label: "Option A" },
|
|
36
|
+
{ value: "b", label: "Option B", disabled: true },
|
|
37
|
+
{ value: "c", label: "Option C" },
|
|
38
|
+
{ value: "d", label: "Option D", defaultChecked: true, disabled: true },
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
RadioGroup.argTypes = {
|
|
42
|
+
value: {
|
|
43
|
+
options: [undefined, "a", "b", "c"],
|
|
44
|
+
control: { type: "radio" },
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const RadioGroupField = () => {
|
|
49
|
+
const { control } = useForm({
|
|
50
|
+
defaultValues: {
|
|
51
|
+
choice: "c",
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<BMRadioGroupField
|
|
57
|
+
dataTestId="bm-radio-group-field"
|
|
58
|
+
name="choice"
|
|
59
|
+
label="Choose an option"
|
|
60
|
+
control={control}
|
|
61
|
+
options={[
|
|
62
|
+
{ value: "a", label: "Option A" },
|
|
63
|
+
{ value: "b", label: "Option B", disabled: true },
|
|
64
|
+
{ value: "c", label: "Option C" },
|
|
65
|
+
{ value: "d", label: "Option D", disabled: true },
|
|
66
|
+
]}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
RadioGroupField.storyName = "Radio Group Field";
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-no-literals */
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { MenuItem, Box } from "@mui/material";
|
|
5
|
+
import type { Meta } from "@storybook/react";
|
|
6
|
+
import { useForm, FormProvider } from "react-hook-form";
|
|
7
|
+
|
|
8
|
+
import { BMSelect, BMSelectProps, BMCheckbox, BMSelectField } from "../src";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "BMSelect",
|
|
12
|
+
component: BMSelect,
|
|
13
|
+
tags: ["autodocs"],
|
|
14
|
+
parameters: {
|
|
15
|
+
controls: {
|
|
16
|
+
include: ["size", "label", "error", "disabled", "helperText"],
|
|
17
|
+
sort: "alpha",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
} as Meta;
|
|
21
|
+
|
|
22
|
+
const args = {
|
|
23
|
+
label: "THIS IS A LABEL",
|
|
24
|
+
error: false,
|
|
25
|
+
helperText: "Helper message",
|
|
26
|
+
disabled: false,
|
|
27
|
+
fullWidth: false,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Select = (args: BMSelectProps) => {
|
|
31
|
+
const [value, setValue] = useState("");
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Box display="flex" flexDirection={"column"}>
|
|
35
|
+
<BMSelect
|
|
36
|
+
{...args}
|
|
37
|
+
sx={{ width: 300 }}
|
|
38
|
+
value={value}
|
|
39
|
+
onChange={(event) => setValue(event.target.value)}
|
|
40
|
+
selectProps={{ placeholder: "Select smth" }}
|
|
41
|
+
>
|
|
42
|
+
<MenuItem value="" sx={{ display: "none" }}>
|
|
43
|
+
Select smth
|
|
44
|
+
</MenuItem>
|
|
45
|
+
<MenuItem value="111">Option 1</MenuItem>
|
|
46
|
+
<MenuItem value="222">Option 2</MenuItem>
|
|
47
|
+
<MenuItem value="333">Option 3</MenuItem>
|
|
48
|
+
<MenuItem value="444">Option 4</MenuItem>
|
|
49
|
+
</BMSelect>
|
|
50
|
+
</Box>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
Select.args = args;
|
|
54
|
+
|
|
55
|
+
//Multi Select list
|
|
56
|
+
const options: string[] = ["Option-1", "Option-2", "Option-3"];
|
|
57
|
+
export const MultiSelect = (args: BMSelectProps) => {
|
|
58
|
+
const [selected, setSelected] = useState<string[]>([]);
|
|
59
|
+
|
|
60
|
+
const isAllSelected = selected.length === options.length;
|
|
61
|
+
|
|
62
|
+
const handleChange = (event: any) => {
|
|
63
|
+
const value = event.target.value;
|
|
64
|
+
if (value[value.length - 1] === "ALL") {
|
|
65
|
+
setSelected(selected.length === options.length ? [] : options);
|
|
66
|
+
} else setSelected(value);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const renderInputValue = (values: any) => {
|
|
70
|
+
if (values.length === 0) return "Select Option";
|
|
71
|
+
if (values.length === 1) return values[0];
|
|
72
|
+
if (values.length === 2) return "2 options";
|
|
73
|
+
if (values.length === 3) return "All options";
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<BMSelect
|
|
78
|
+
sx={{ width: 300 }}
|
|
79
|
+
{...args}
|
|
80
|
+
value={selected}
|
|
81
|
+
onChange={handleChange}
|
|
82
|
+
selectProps={{ multiple: true }}
|
|
83
|
+
menuProps={{ variant: "menu" }}
|
|
84
|
+
renderValue={renderInputValue}
|
|
85
|
+
>
|
|
86
|
+
<MenuItem key={"Select-All"} value={"ALL"} sx={{ paddingLeft: 1 }}>
|
|
87
|
+
<BMCheckbox checked={isAllSelected} label={""} disableRipple dataTestId="all-selected"/>
|
|
88
|
+
Select All
|
|
89
|
+
</MenuItem>
|
|
90
|
+
{options.map((option) => (
|
|
91
|
+
<MenuItem key={option} value={option} sx={{ paddingLeft: 1 }}>
|
|
92
|
+
<BMCheckbox
|
|
93
|
+
checked={selected.indexOf(option as never) > -1}
|
|
94
|
+
label={""}
|
|
95
|
+
disableRipple
|
|
96
|
+
dataTestId="bm-multi-select-checkbox"
|
|
97
|
+
/>
|
|
98
|
+
{option}
|
|
99
|
+
</MenuItem>
|
|
100
|
+
))}
|
|
101
|
+
</BMSelect>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
MultiSelect.args = args;
|
|
105
|
+
|
|
106
|
+
type FormValues = {
|
|
107
|
+
country: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// BMSelectField Story
|
|
111
|
+
export const SelectField = (args: BMSelectProps) => {
|
|
112
|
+
const methods = useForm<FormValues>({
|
|
113
|
+
defaultValues: {
|
|
114
|
+
country: "",
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<FormProvider {...methods}>
|
|
120
|
+
<Box
|
|
121
|
+
component="form"
|
|
122
|
+
onSubmit={methods.handleSubmit(console.log)}
|
|
123
|
+
sx={{ width: 300 }}
|
|
124
|
+
>
|
|
125
|
+
<BMSelectField<FormValues>
|
|
126
|
+
name="country"
|
|
127
|
+
fullWidth
|
|
128
|
+
control={methods.control}
|
|
129
|
+
label="Country"
|
|
130
|
+
rules={{ required: "Required field" }}
|
|
131
|
+
selectProps={{
|
|
132
|
+
displayEmpty: true,
|
|
133
|
+
}}
|
|
134
|
+
sx={{
|
|
135
|
+
minWidth: 320,
|
|
136
|
+
"& .MuiSelect-select": {
|
|
137
|
+
display: "flex",
|
|
138
|
+
alignItems: "center",
|
|
139
|
+
paddingRight: "32px",
|
|
140
|
+
},
|
|
141
|
+
}}
|
|
142
|
+
{...args}
|
|
143
|
+
>
|
|
144
|
+
<MenuItem value="" disabled>
|
|
145
|
+
Select Country
|
|
146
|
+
</MenuItem>
|
|
147
|
+
<MenuItem value="IN">India</MenuItem>
|
|
148
|
+
<MenuItem value="US">USA</MenuItem>
|
|
149
|
+
<MenuItem value="UK">UK</MenuItem>
|
|
150
|
+
</BMSelectField>
|
|
151
|
+
</Box>
|
|
152
|
+
</FormProvider>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
SelectField.args = {
|
|
157
|
+
...args,
|
|
158
|
+
label: "Country",
|
|
159
|
+
helperText: "Choose your country",
|
|
160
|
+
};
|