@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,33 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import type { Meta, Story } from '@storybook/react';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import { BMHelloBanner } from '../src';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'BMHelloBanner',
|
|
9
|
+
component: BMHelloBanner,
|
|
10
|
+
decorators: [
|
|
11
|
+
(StoryContent: any) => (
|
|
12
|
+
<div style={{ margin: '3em', width: 538 }}>
|
|
13
|
+
<StoryContent />
|
|
14
|
+
</div>
|
|
15
|
+
)
|
|
16
|
+
]
|
|
17
|
+
} as Meta;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = () => {
|
|
20
|
+
const [showBanner, setShowBanner] = useState<boolean>(true);
|
|
21
|
+
return (
|
|
22
|
+
<Box width={780} p={2} ml={0.5} display="flex">
|
|
23
|
+
<Box width="100%">
|
|
24
|
+
<BMHelloBanner
|
|
25
|
+
title={'Complete the setup...'}
|
|
26
|
+
subTitle={'Use our “Setup Guide” to create an “Interface Endpoint” on AWS for each region in this cluster.'}
|
|
27
|
+
setShowBanner={setShowBanner}
|
|
28
|
+
showBanner={showBanner}
|
|
29
|
+
/>
|
|
30
|
+
</Box>
|
|
31
|
+
</Box>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import type { Meta } from "@storybook/react";
|
|
3
|
+
import { BMInput, BMSearch, BMStripeInput, type BMInputProps } from "../src";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Input",
|
|
7
|
+
component: BMInput,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
parameters: {
|
|
10
|
+
controls: {
|
|
11
|
+
include: [
|
|
12
|
+
"value",
|
|
13
|
+
"placeholder",
|
|
14
|
+
"label",
|
|
15
|
+
"tooltip",
|
|
16
|
+
"error",
|
|
17
|
+
"disabled",
|
|
18
|
+
"helperText",
|
|
19
|
+
"fullWidth",
|
|
20
|
+
],
|
|
21
|
+
sort: "alpha",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
argTypes: {
|
|
25
|
+
tooltip: {
|
|
26
|
+
control: { type: "text" },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
} as Meta;
|
|
30
|
+
|
|
31
|
+
const defaultArgs: Partial<BMInputProps> = {
|
|
32
|
+
label: "This is a label",
|
|
33
|
+
tooltip: "This is a tooltip",
|
|
34
|
+
placeholder: "This is a placeholder",
|
|
35
|
+
error: false,
|
|
36
|
+
helperText: "Helper message",
|
|
37
|
+
disabled: false,
|
|
38
|
+
fullWidth: false,
|
|
39
|
+
dataTestId: "input-field",
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Input = (args: BMInputProps) => (
|
|
43
|
+
<>
|
|
44
|
+
Medium : <br />
|
|
45
|
+
<BMInput {...args} label="THIS IS A LABEL" />
|
|
46
|
+
<br />
|
|
47
|
+
<br /> Large : <br />
|
|
48
|
+
<BMInput {...args} size="large" />
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
Input.args = defaultArgs;
|
|
52
|
+
|
|
53
|
+
export const TextArea = (args: BMInputProps) => <BMInput {...args} />;
|
|
54
|
+
|
|
55
|
+
TextArea.args = {
|
|
56
|
+
...defaultArgs,
|
|
57
|
+
multiline: true,
|
|
58
|
+
rows: 5,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Search = (args: BMInputProps) => <BMSearch {...args} />;
|
|
62
|
+
|
|
63
|
+
export const BMInputNumber = (args: BMInputProps) => (
|
|
64
|
+
<BMInput type="number" {...args} defaultValue={0} />
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const getInputProps = (
|
|
68
|
+
InputComponent: React.ElementType,
|
|
69
|
+
StripeElementComponent: React.ElementType
|
|
70
|
+
) => {
|
|
71
|
+
return {
|
|
72
|
+
components: {
|
|
73
|
+
Input: InputComponent,
|
|
74
|
+
},
|
|
75
|
+
componentsProps: {
|
|
76
|
+
input: {
|
|
77
|
+
component: StripeElementComponent,
|
|
78
|
+
handleOnChange: () => {},
|
|
79
|
+
handleOnBlur: () => {},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Mock components simulating Stripe card number input
|
|
86
|
+
interface MockCardNumberElementProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
87
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
88
|
+
handleOnChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
89
|
+
handleOnBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const formatCardNumber = (value: string) => {
|
|
93
|
+
// Remove all non-digit characters
|
|
94
|
+
const digits = value.replace(/\D/g, "");
|
|
95
|
+
// Limit to max 16 digits
|
|
96
|
+
const limited = digits.slice(0, 16);
|
|
97
|
+
// Insert space every 4 digits
|
|
98
|
+
return limited.replace(/(.{4})/g, "$1 ").trim();
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const MockCardNumberElement = React.forwardRef<HTMLInputElement, MockCardNumberElementProps>(
|
|
102
|
+
({ inputRef, handleOnChange, handleOnBlur, value: propValue, ...rest }, ref) => {
|
|
103
|
+
// internal state to show formatted value
|
|
104
|
+
const [value, setValue] = useState(() => {
|
|
105
|
+
if (typeof propValue === "string") return formatCardNumber(propValue);
|
|
106
|
+
return "";
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// When parent changes value prop, update internal state
|
|
110
|
+
React.useEffect(() => {
|
|
111
|
+
if (typeof propValue === "string") {
|
|
112
|
+
setValue(formatCardNumber(propValue));
|
|
113
|
+
}
|
|
114
|
+
}, [propValue]);
|
|
115
|
+
|
|
116
|
+
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
117
|
+
const rawValue = e.target.value;
|
|
118
|
+
const formatted = formatCardNumber(rawValue);
|
|
119
|
+
setValue(formatted);
|
|
120
|
+
|
|
121
|
+
// Create a synthetic event to pass only digits without spaces to onChange handler
|
|
122
|
+
const syntheticEvent = {
|
|
123
|
+
...e,
|
|
124
|
+
target: {
|
|
125
|
+
...e.target,
|
|
126
|
+
value: formatted.replace(/\s/g, ""),
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
if (handleOnChange) handleOnChange(syntheticEvent as React.ChangeEvent<HTMLInputElement>);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const onBlur = (e: React.FocusEvent<HTMLInputElement>) => {
|
|
133
|
+
if (handleOnBlur) handleOnBlur(e);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Compose ref handlers
|
|
137
|
+
const combinedRef = (node: HTMLInputElement) => {
|
|
138
|
+
if (typeof inputRef === "function") inputRef(node);
|
|
139
|
+
else if (inputRef) (inputRef as React.MutableRefObject<HTMLInputElement | null>).current = node;
|
|
140
|
+
|
|
141
|
+
if (typeof ref === "function") ref(node);
|
|
142
|
+
else if (ref) (ref as React.MutableRefObject<HTMLInputElement | null>).current = node;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<input
|
|
147
|
+
{...rest}
|
|
148
|
+
ref={combinedRef}
|
|
149
|
+
onChange={onChange}
|
|
150
|
+
onBlur={onBlur}
|
|
151
|
+
value={value}
|
|
152
|
+
placeholder="XXXX XXXX XXXX XXXX"
|
|
153
|
+
maxLength={19} // 16 digits + 3 spaces
|
|
154
|
+
inputMode="numeric"
|
|
155
|
+
pattern="[0-9\s]*"
|
|
156
|
+
style={{
|
|
157
|
+
width: "100%",
|
|
158
|
+
padding: "8px",
|
|
159
|
+
fontSize: "16px",
|
|
160
|
+
letterSpacing: "2px",
|
|
161
|
+
}}
|
|
162
|
+
/>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
export const StripeCardNumber = (args: Partial<BMInputProps>) => {
|
|
168
|
+
return (
|
|
169
|
+
<BMInput
|
|
170
|
+
{...args}
|
|
171
|
+
dataTestId="stripe-card-number-input"
|
|
172
|
+
fullWidth
|
|
173
|
+
autoFocus
|
|
174
|
+
name="cardNumber"
|
|
175
|
+
label="Card Number"
|
|
176
|
+
disabled={args.disabled}
|
|
177
|
+
InputProps={getInputProps(BMStripeInput, MockCardNumberElement)}
|
|
178
|
+
/>
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
StripeCardNumber.args = {
|
|
183
|
+
...defaultArgs,
|
|
184
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { ThemeProvider, createTheme, CssBaseline, Box } from "@mui/material";
|
|
4
|
+
|
|
5
|
+
import { BMInputEditableCode } from "../src";
|
|
6
|
+
|
|
7
|
+
const theme = createTheme();
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof BMInputEditableCode> = {
|
|
10
|
+
title: "Input",
|
|
11
|
+
component: BMInputEditableCode,
|
|
12
|
+
decorators: [
|
|
13
|
+
(StoryFn) => (
|
|
14
|
+
<ThemeProvider theme={theme}>
|
|
15
|
+
<CssBaseline />
|
|
16
|
+
<div style={{ padding: 24, fontFamily: "Menlo, monospace" }}>
|
|
17
|
+
<StoryFn />
|
|
18
|
+
</div>
|
|
19
|
+
</ThemeProvider>
|
|
20
|
+
),
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
|
|
26
|
+
type Story = StoryObj<typeof BMInputEditableCode>;
|
|
27
|
+
|
|
28
|
+
export const InputEditableCode: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
placeholder: "<DB USER>",
|
|
31
|
+
tooltip: "Enter DB username",
|
|
32
|
+
multiline: true,
|
|
33
|
+
},
|
|
34
|
+
render: (args) => {
|
|
35
|
+
const [sqlConnectionStringVars, setSqlConnectionStringVars] = useState({
|
|
36
|
+
dbUser: "admin_user",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Box
|
|
41
|
+
component="pre"
|
|
42
|
+
sx={{
|
|
43
|
+
fontFamily: "Menlo, monospace",
|
|
44
|
+
backgroundColor: "#f5f5f5",
|
|
45
|
+
padding: 2,
|
|
46
|
+
borderRadius: 2,
|
|
47
|
+
overflowX: "auto",
|
|
48
|
+
whiteSpace: "pre-wrap",
|
|
49
|
+
fontSize: "0.875rem",
|
|
50
|
+
lineHeight: 1.5,
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<Box component="span" sx={{ display: "inline" }}>
|
|
54
|
+
{`./sqlsh "host=myhost \\\nuser=`}
|
|
55
|
+
</Box>
|
|
56
|
+
|
|
57
|
+
<Box
|
|
58
|
+
component="span"
|
|
59
|
+
sx={{
|
|
60
|
+
display: "inline-flex",
|
|
61
|
+
alignItems: "center",
|
|
62
|
+
verticalAlign: "bottom",
|
|
63
|
+
fontFamily: "inherit",
|
|
64
|
+
fontSize: "inherit",
|
|
65
|
+
lineHeight: "inherit",
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<BMInputEditableCode
|
|
69
|
+
{...args}
|
|
70
|
+
content={sqlConnectionStringVars.dbUser}
|
|
71
|
+
onSave={(savedString) =>
|
|
72
|
+
setSqlConnectionStringVars((prev) => ({
|
|
73
|
+
...prev,
|
|
74
|
+
dbUser: savedString,
|
|
75
|
+
}))
|
|
76
|
+
}
|
|
77
|
+
/>
|
|
78
|
+
</Box>
|
|
79
|
+
|
|
80
|
+
<Box component="span" sx={{ display: "inline" }}>
|
|
81
|
+
{` \\\ndbname=bigmath"`}
|
|
82
|
+
</Box>
|
|
83
|
+
</Box>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Meta } from "@storybook/react";
|
|
2
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
3
|
+
import { BMInputField, type BMInputFieldProps } from "../src";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Input",
|
|
7
|
+
component: BMInputField,
|
|
8
|
+
parameters: {
|
|
9
|
+
controls: {
|
|
10
|
+
include: [
|
|
11
|
+
"value",
|
|
12
|
+
"placeholder",
|
|
13
|
+
"label",
|
|
14
|
+
"tooltip",
|
|
15
|
+
"error",
|
|
16
|
+
"disabled",
|
|
17
|
+
"helperText",
|
|
18
|
+
"fullWidth",
|
|
19
|
+
],
|
|
20
|
+
sort: "alpha",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
tooltip: {
|
|
25
|
+
control: { type: "text" },
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
} as Meta;
|
|
29
|
+
|
|
30
|
+
interface FormProps {
|
|
31
|
+
name: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const InputField = (args: BMInputFieldProps<FormProps>) => {
|
|
35
|
+
const methods = useForm<FormProps>();
|
|
36
|
+
return (
|
|
37
|
+
<FormProvider {...methods}>
|
|
38
|
+
<BMInputField {...args} name="name" />
|
|
39
|
+
</FormProvider>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
InputField.args = {
|
|
43
|
+
label: "This is a label",
|
|
44
|
+
tooltip: "This is a tooltip",
|
|
45
|
+
placeholder: "This is a placeholder",
|
|
46
|
+
helperText: "Helper message",
|
|
47
|
+
disabled: false,
|
|
48
|
+
fullWidth: false,
|
|
49
|
+
dataTestId: "input-field",
|
|
50
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Box, Typography } from "@mui/material";
|
|
2
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import { BMLoadingBox } from "../src";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof BMLoadingBox> = {
|
|
7
|
+
title: "InReview/BMLoadingBox",
|
|
8
|
+
component: BMLoadingBox,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
args: {
|
|
11
|
+
children: <Typography>Loading content...</Typography>,
|
|
12
|
+
theme: "default",
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
theme: {
|
|
16
|
+
control: { type: "radio" },
|
|
17
|
+
options: ["default", "light"],
|
|
18
|
+
},
|
|
19
|
+
className: {
|
|
20
|
+
control: false,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
|
|
27
|
+
type Story = StoryObj<typeof BMLoadingBox>;
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {};
|
|
30
|
+
|
|
31
|
+
export const LightTheme: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
theme: "light",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const WithCustomContent: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
children: (
|
|
40
|
+
<Box>
|
|
41
|
+
<Typography variant="h6">Please wait…</Typography>
|
|
42
|
+
</Box>
|
|
43
|
+
),
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Meta } from "@storybook/react";
|
|
2
|
+
import { MarkerType, BMMapMarker, BMMaps, BMMapsProps } from "../src/components/BMMaps";
|
|
3
|
+
import { MapLegend, MapLegendItem } from "../src/components/BMMaps/legend/MapLegend";
|
|
4
|
+
import SelectedIcon from "../src/components/BMMaps/icons/RegionSelectedHover.svg";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "BMMaps",
|
|
8
|
+
component: BMMaps,
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
export const Maps = (args: BMMapsProps) => {
|
|
12
|
+
return <BMMaps {...args} >
|
|
13
|
+
<BMMapMarker position={[12.9716, 77.5946]} type={MarkerType.REGION_SELECTED} tooltip={<>Bengaluru India</>} />
|
|
14
|
+
<MapLegend mapLegendItems={[
|
|
15
|
+
<MapLegendItem icon={<SelectedIcon />} label="Region 1" subText='9 regions, 9 AZs, 9 nodes' />,
|
|
16
|
+
]} />
|
|
17
|
+
</BMMaps>
|
|
18
|
+
};
|
|
19
|
+
Maps.args = {
|
|
20
|
+
mapWidth: 1200,
|
|
21
|
+
mapHeight: 680,
|
|
22
|
+
coordinates: [[12.9716, 77.5946], [12.9716, 77.5946]],
|
|
23
|
+
initialBounds: undefined,
|
|
24
|
+
mapContainerProps: {
|
|
25
|
+
zoom: 2,
|
|
26
|
+
center: [0, 0]
|
|
27
|
+
},
|
|
28
|
+
dataTestId: "bm-maps",
|
|
29
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { BMButton, BMCheckbox } from "../src";
|
|
4
|
+
import {
|
|
5
|
+
BMModal,
|
|
6
|
+
type BMModalProps,
|
|
7
|
+
} from "../src/components/BMModal";
|
|
8
|
+
import { BMSidePanel, BMSidePanelProps } from "../src/components/BMModal";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "BMModal",
|
|
12
|
+
component: BMModal,
|
|
13
|
+
argTypes: {
|
|
14
|
+
title: {
|
|
15
|
+
control: { type: "text" },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
} as Meta;
|
|
19
|
+
|
|
20
|
+
export const Basic = (args: BMModalProps) => (
|
|
21
|
+
<BMModal {...args}>
|
|
22
|
+
<div>
|
|
23
|
+
<p>
|
|
24
|
+
BMModal component requires a <code>size</code>
|
|
25
|
+
prop to determine the correct height and width. The height and width are
|
|
26
|
+
fixed and will scroll on overflow.
|
|
27
|
+
</p>
|
|
28
|
+
<p>
|
|
29
|
+
BMModalProps extends Material UI's DialogProps, so most of the
|
|
30
|
+
props will be exactly the same.
|
|
31
|
+
</p>
|
|
32
|
+
</div>
|
|
33
|
+
</BMModal>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
Basic.args = {
|
|
37
|
+
title: "Simple Modal Title",
|
|
38
|
+
size: "sm",
|
|
39
|
+
open: true,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Confirmation: Story<BMModalProps> = (args: BMModalProps) => (
|
|
43
|
+
<BMModal {...args} title={args.title}>
|
|
44
|
+
<div>
|
|
45
|
+
<p>This modal has a submit and cancel button.</p>
|
|
46
|
+
</div>
|
|
47
|
+
</BMModal>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
Confirmation.args = {
|
|
51
|
+
title: "Confirmation Modal",
|
|
52
|
+
size: "xs",
|
|
53
|
+
titleSeparator: true,
|
|
54
|
+
submitLabel: "Submit",
|
|
55
|
+
cancelLabel: "Cancel",
|
|
56
|
+
actionsInfo: <BMCheckbox dataTestId="modal-checkbox" label={"More action information"} />,
|
|
57
|
+
open: true,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const SidePanel = (args: BMSidePanelProps) => (
|
|
61
|
+
<BMSidePanel {...args}>
|
|
62
|
+
<div>
|
|
63
|
+
<p>This modal opens from the right side and scrolls on overflow.</p>
|
|
64
|
+
<p>
|
|
65
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
66
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
67
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
68
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
69
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
70
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
71
|
+
mollit anim id est laborum.
|
|
72
|
+
</p>
|
|
73
|
+
<p>
|
|
74
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
75
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
76
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
77
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
78
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
79
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
80
|
+
mollit anim id est laborum.
|
|
81
|
+
</p>
|
|
82
|
+
<p>
|
|
83
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
84
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
85
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
86
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
87
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
88
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
89
|
+
mollit anim id est laborum.
|
|
90
|
+
</p>
|
|
91
|
+
<p>
|
|
92
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
93
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
94
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
95
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
96
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
97
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
98
|
+
mollit anim id est laborum.
|
|
99
|
+
</p>
|
|
100
|
+
<p>
|
|
101
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
102
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
103
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
104
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
105
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
106
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
107
|
+
mollit anim id est laborum.
|
|
108
|
+
</p>
|
|
109
|
+
<p>
|
|
110
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
111
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
112
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
113
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
114
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
115
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
116
|
+
mollit anim id est laborum.
|
|
117
|
+
</p>
|
|
118
|
+
<p>
|
|
119
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
120
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
121
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
122
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
123
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
124
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
125
|
+
mollit anim id est laborum.
|
|
126
|
+
</p>
|
|
127
|
+
<p>
|
|
128
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
129
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
130
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
131
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
132
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
133
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
134
|
+
mollit anim id est laborum.
|
|
135
|
+
</p>
|
|
136
|
+
<p>
|
|
137
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
138
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
139
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
140
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
141
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
142
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
143
|
+
mollit anim id est laborum.
|
|
144
|
+
</p>
|
|
145
|
+
<p>
|
|
146
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
147
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
148
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
149
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
150
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
151
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
152
|
+
mollit anim id est laborum.
|
|
153
|
+
</p>
|
|
154
|
+
<p>
|
|
155
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
156
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
157
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
158
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
159
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
160
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
161
|
+
mollit anim id est laborum.
|
|
162
|
+
</p>
|
|
163
|
+
<p>
|
|
164
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
165
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
166
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
|
167
|
+
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
|
168
|
+
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
|
169
|
+
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
|
170
|
+
mollit anim id est laborum.
|
|
171
|
+
</p>
|
|
172
|
+
</div>
|
|
173
|
+
</BMSidePanel>
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
SidePanel.args = {
|
|
177
|
+
title: "Side Panel Modal",
|
|
178
|
+
submitLabel: "Save",
|
|
179
|
+
cancelLabel: "Cancel",
|
|
180
|
+
open: true,
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export const SidePanelWithModal: Story<BMSidePanelProps> = (
|
|
184
|
+
args: BMSidePanelProps,
|
|
185
|
+
) => {
|
|
186
|
+
const [sideOpen, setOpen] = useState(args.open);
|
|
187
|
+
const [openSecond, setSecond] = useState(false);
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<div>
|
|
191
|
+
<BMButton dataTestId="modal-open" variant="primary" onClick={() => setOpen(true)}>
|
|
192
|
+
Open Side Panel
|
|
193
|
+
</BMButton>
|
|
194
|
+
<BMSidePanel {...args} onClose={() => setOpen(false)} open={sideOpen}>
|
|
195
|
+
<h4>This is a side panel</h4>
|
|
196
|
+
<p>As an example, we can even open a modal on top of the side panel.</p>
|
|
197
|
+
<BMButton dataTestId="openAdditionalModal" variant="primary" onClick={() => setSecond(true)}>
|
|
198
|
+
Open Additional Modal
|
|
199
|
+
</BMButton>
|
|
200
|
+
<BMModal
|
|
201
|
+
title="This is a Modal"
|
|
202
|
+
size="sm"
|
|
203
|
+
open={openSecond}
|
|
204
|
+
onClose={() => setSecond(false)}
|
|
205
|
+
>
|
|
206
|
+
<div>Modal opens on top of existing Side Panel</div>
|
|
207
|
+
</BMModal>
|
|
208
|
+
</BMSidePanel>
|
|
209
|
+
</div>
|
|
210
|
+
);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
SidePanelWithModal.args = {
|
|
214
|
+
title: "Side Panel Modal",
|
|
215
|
+
submitLabel: "Save",
|
|
216
|
+
cancelLabel: "Cancel",
|
|
217
|
+
open: true,
|
|
218
|
+
};
|