@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.
Files changed (229) hide show
  1. package/LICENSE +7 -0
  2. package/LICENSE.md +1 -0
  3. package/README.md +42 -0
  4. package/dist/cjs/index.css +11 -0
  5. package/dist/cjs/index.js +134365 -0
  6. package/dist/esm/index.css +11 -0
  7. package/dist/esm/index.js +134258 -0
  8. package/package.json +58 -0
  9. package/rollup.config.js +73 -0
  10. package/src/BMClassnameSetup.ts +3 -0
  11. package/src/assets/icons/Calendar.svg +6 -0
  12. package/src/assets/icons/Close.svg +40 -0
  13. package/src/assets/icons/Default-Loading-Circles.svg +31 -0
  14. package/src/assets/icons/alert.svg +6 -0
  15. package/src/assets/icons/aws.svg +19 -0
  16. package/src/assets/icons/caret-down.svg +3 -0
  17. package/src/assets/icons/check.svg +6 -0
  18. package/src/assets/icons/circle-check-solid.svg +7 -0
  19. package/src/assets/icons/circle-check.svg +6 -0
  20. package/src/assets/icons/circle-selected.svg +3 -0
  21. package/src/assets/icons/circle-unselected.svg +3 -0
  22. package/src/assets/icons/close-basic.svg +3 -0
  23. package/src/assets/icons/close_collapse.svg +3 -0
  24. package/src/assets/icons/copy.svg +3 -0
  25. package/src/assets/icons/drag.svg +3 -0
  26. package/src/assets/icons/expand-more.svg +3 -0
  27. package/src/assets/icons/failed-solid.svg +7 -0
  28. package/src/assets/icons/globe.svg +3 -0
  29. package/src/assets/icons/google-cloud.svg +6 -0
  30. package/src/assets/icons/in-active.svg +4 -0
  31. package/src/assets/icons/info-solid.svg +6 -0
  32. package/src/assets/icons/info.svg +6 -0
  33. package/src/assets/icons/k8s.svg +4 -0
  34. package/src/assets/icons/lock-locked.svg +5 -0
  35. package/src/assets/icons/microsoft-azure.svg +9 -0
  36. package/src/assets/icons/onprem.svg +3 -0
  37. package/src/assets/icons/pencil.svg +3 -0
  38. package/src/assets/icons/search.svg +6 -0
  39. package/src/assets/icons/shield.svg +4 -0
  40. package/src/assets/icons/star.svg +3 -0
  41. package/src/assets/icons/success-tick.svg +3 -0
  42. package/src/assets/icons/timer.svg +3 -0
  43. package/src/assets/icons/visibility-off.svg +6 -0
  44. package/src/assets/icons/visibility.svg +6 -0
  45. package/src/assets/icons/warning.svg +6 -0
  46. package/src/bma/components/BMButton/BMButton.tsx +34 -0
  47. package/src/bma/components/BMButton/index.ts +1 -0
  48. package/src/bma/components/BMInput/BMInput.tsx +13 -0
  49. package/src/bma/components/BMInput/BMInputField.tsx +7 -0
  50. package/src/bma/components/BMInput/BMSearch.tsx +6 -0
  51. package/src/bma/components/BMInput/index.ts +3 -0
  52. package/src/bma/index.ts +3 -0
  53. package/src/bma/package.json +4 -0
  54. package/src/bma/theme/BMAutocomplete.ts +12 -0
  55. package/src/bma/theme/BMInput.ts +46 -0
  56. package/src/bma/theme/theme.ts +15 -0
  57. package/src/bma/theme/themeUtils.ts +10 -0
  58. package/src/components/BMAccordion/BMAccordion.tsx +150 -0
  59. package/src/components/BMAccordion/index.ts +1 -0
  60. package/src/components/BMAddSection/BMAddSection.tsx +38 -0
  61. package/src/components/BMAddSection/index.ts +1 -0
  62. package/src/components/BMAlert/BMAlert.tsx +168 -0
  63. package/src/components/BMAlert/index.ts +1 -0
  64. package/src/components/BMAutoComplete/BMAutoComplete.tsx +86 -0
  65. package/src/components/BMAutoComplete/index.ts +1 -0
  66. package/src/components/BMAvatar/BMAvatar.tsx +45 -0
  67. package/src/components/BMAvatar/index.ts +1 -0
  68. package/src/components/BMButton/BMButton.tsx +46 -0
  69. package/src/components/BMButton/BMButtonGroup.tsx +46 -0
  70. package/src/components/BMButton/BMSplitButton.tsx +72 -0
  71. package/src/components/BMButton/index.ts +3 -0
  72. package/src/components/BMCheckbox/BMCheckbox.tsx +44 -0
  73. package/src/components/BMCheckbox/BMCheckboxField.tsx +41 -0
  74. package/src/components/BMCheckbox/index.ts +2 -0
  75. package/src/components/BMCloudSelect/BMCloudList.tsx +43 -0
  76. package/src/components/BMCloudSelect/BMCloudSelect.tsx +109 -0
  77. package/src/components/BMCloudSelect/BMCloudSelectField.tsx +46 -0
  78. package/src/components/BMCloudSelect/index.ts +3 -0
  79. package/src/components/BMCodeBlock/BMCodeBlock.tsx +233 -0
  80. package/src/components/BMCodeBlock/index.ts +1 -0
  81. package/src/components/BMDatePicker/BMDatePicker.tsx +187 -0
  82. package/src/components/BMDatePicker/index.ts +1 -0
  83. package/src/components/BMDropdown/BMDropdown.tsx +107 -0
  84. package/src/components/BMDropdown/index.ts +1 -0
  85. package/src/components/BMForm/BMFormControlLabel.tsx +23 -0
  86. package/src/components/BMForm/BMLabel.tsx +24 -0
  87. package/src/components/BMForm/index.ts +2 -0
  88. package/src/components/BMHelloBanner/BMHelloBanner.tsx +68 -0
  89. package/src/components/BMHelloBanner/index.ts +1 -0
  90. package/src/components/BMInput/BMInput.tsx +31 -0
  91. package/src/components/BMInput/BMInputEditableCode.tsx +120 -0
  92. package/src/components/BMInput/BMInputField.tsx +37 -0
  93. package/src/components/BMInput/BMSearch.tsx +17 -0
  94. package/src/components/BMInput/BMStripeInput.tsx +24 -0
  95. package/src/components/BMInput/index.ts +5 -0
  96. package/src/components/BMLoadingBox/BMLoadingBox.tsx +45 -0
  97. package/src/components/BMLoadingBox/index.ts +1 -0
  98. package/src/components/BMMaps/BMMapMarker.css +12 -0
  99. package/src/components/BMMaps/BMMapMarker.tsx +68 -0
  100. package/src/components/BMMaps/BMMaps.tsx +129 -0
  101. package/src/components/BMMaps/MapIcons.tsx +83 -0
  102. package/src/components/BMMaps/icons/GeoPartition.svg +19 -0
  103. package/src/components/BMMaps/icons/GeoPartitionHover.svg +20 -0
  104. package/src/components/BMMaps/icons/MasterPreferred.svg +19 -0
  105. package/src/components/BMMaps/icons/MasterPreferredHover.svg +20 -0
  106. package/src/components/BMMaps/icons/ReadReplica.svg +18 -0
  107. package/src/components/BMMaps/icons/ReadReplicaHover.svg +19 -0
  108. package/src/components/BMMaps/icons/RegionNotSelected.svg +18 -0
  109. package/src/components/BMMaps/icons/RegionNotSelectedHover.svg +19 -0
  110. package/src/components/BMMaps/icons/RegionPreferred.svg +18 -0
  111. package/src/components/BMMaps/icons/RegionPreferredHover.svg +19 -0
  112. package/src/components/BMMaps/icons/RegionSelected.svg +18 -0
  113. package/src/components/BMMaps/icons/RegionSelectedHover.svg +19 -0
  114. package/src/components/BMMaps/index.ts +5 -0
  115. package/src/components/BMMaps/legend/MapLegend.tsx +80 -0
  116. package/src/components/BMMaps/markerTypes.ts +8 -0
  117. package/src/components/BMModal/BMModal.tsx +313 -0
  118. package/src/components/BMModal/index.ts +1 -0
  119. package/src/components/BMMultiEntry/BMMultiEntry.tsx +328 -0
  120. package/src/components/BMMultiEntry/BMMultiEntryField.tsx +47 -0
  121. package/src/components/BMMultiEntry/index.ts +2 -0
  122. package/src/components/BMMultiLevelStepper/BMMultiLevelStepper.tsx +191 -0
  123. package/src/components/BMMultiLevelStepper/index.ts +1 -0
  124. package/src/components/BMPagination/BMPagination.tsx +64 -0
  125. package/src/components/BMPagination/index.ts +1 -0
  126. package/src/components/BMPassword/BMPassword.tsx +37 -0
  127. package/src/components/BMPassword/BMPasswordField.tsx +50 -0
  128. package/src/components/BMPassword/index.ts +2 -0
  129. package/src/components/BMProgress/BMProgress.tsx +43 -0
  130. package/src/components/BMProgress/index.ts +1 -0
  131. package/src/components/BMRadio/BMRadio.tsx +162 -0
  132. package/src/components/BMRadio/BMRadioGroupField.tsx +40 -0
  133. package/src/components/BMRadio/index.ts +2 -0
  134. package/src/components/BMSelect/BMSelect.tsx +70 -0
  135. package/src/components/BMSelect/BMSelectField.tsx +47 -0
  136. package/src/components/BMSelect/index.ts +2 -0
  137. package/src/components/BMSlider/BMSlider.tsx +16 -0
  138. package/src/components/BMSlider/index.ts +1 -0
  139. package/src/components/BMSmartStatus/BMSmartStatus.tsx +185 -0
  140. package/src/components/BMSmartStatus/index.tsx +1 -0
  141. package/src/components/BMStatus/BMStatus.tsx +98 -0
  142. package/src/components/BMStatus/index.ts +1 -0
  143. package/src/components/BMTable/BMTable.tsx +131 -0
  144. package/src/components/BMTable/index.ts +1 -0
  145. package/src/components/BMTabs/BMTabs.tsx +50 -0
  146. package/src/components/BMTabs/index.ts +1 -0
  147. package/src/components/BMTag/BMTag.tsx +47 -0
  148. package/src/components/BMTag/index.ts +1 -0
  149. package/src/components/BMTagv2/BMTagv2.tsx +250 -0
  150. package/src/components/BMTagv2/index.ts +1 -0
  151. package/src/components/BMToggle/BMMultiToggleButton.tsx +99 -0
  152. package/src/components/BMToggle/BMToggle.tsx +35 -0
  153. package/src/components/BMToggle/BMToggleField.tsx +28 -0
  154. package/src/components/BMToggle/index.ts +3 -0
  155. package/src/components/BMTooltip/BMTooltip.tsx +52 -0
  156. package/src/components/BMTooltip/index.ts +1 -0
  157. package/src/components/BMWarning/BMWarning.tsx +39 -0
  158. package/src/components/BMWarning/index.ts +1 -0
  159. package/src/components/GenericFailure/GenericFailure.tsx +28 -0
  160. package/src/components/GenericFailure/index.ts +1 -0
  161. package/src/components/NoAccess/NoAccess.tsx +40 -0
  162. package/src/components/NoAccess/NoAccessActionTooltip.tsx +53 -0
  163. package/src/components/NoAccess/NoPermissionModal.tsx +55 -0
  164. package/src/components/NoAccess/index.ts +3 -0
  165. package/src/components/index.ts +34 -0
  166. package/src/index.ts +9 -0
  167. package/src/theme/BMAutoComplete.ts +152 -0
  168. package/src/theme/BMAvatar.ts +5 -0
  169. package/src/theme/BMButton.ts +132 -0
  170. package/src/theme/BMButtonGroup.ts +49 -0
  171. package/src/theme/BMCheckbox.ts +16 -0
  172. package/src/theme/BMFormHelperText.ts +19 -0
  173. package/src/theme/BMInput.ts +120 -0
  174. package/src/theme/BMMaps.ts +9 -0
  175. package/src/theme/BMRadio.ts +10 -0
  176. package/src/theme/BMTabs.ts +79 -0
  177. package/src/theme/BMTag.ts +28 -0
  178. package/src/theme/BMToggle.ts +50 -0
  179. package/src/theme/BMTooltip.ts +34 -0
  180. package/src/theme/theme.ts +326 -0
  181. package/src/theme/variables.ts +152 -0
  182. package/src/types/custom.d.ts +9 -0
  183. package/src/types/svg.d.ts +5 -0
  184. package/stories/BMAButton.stories.tsx +67 -0
  185. package/stories/BMAccordion.stories.tsx +55 -0
  186. package/stories/BMAddSection.stories.tsx +40 -0
  187. package/stories/BMAlert.stories.tsx +33 -0
  188. package/stories/BMAutoComplete.stories.tsx +65 -0
  189. package/stories/BMAvatar.stories.tsx +76 -0
  190. package/stories/BMButton.stories.tsx +57 -0
  191. package/stories/BMButton2.stories.tsx +131 -0
  192. package/stories/BMCheckbox.stories.tsx +23 -0
  193. package/stories/BMCloudSelectField.stories.tsx +40 -0
  194. package/stories/BMCodeBlock.stories.tsx +57 -0
  195. package/stories/BMDatePicker.stories.tsx +88 -0
  196. package/stories/BMDropdown.stories.tsx +84 -0
  197. package/stories/BMGroupButton.stories.tsx +53 -0
  198. package/stories/BMHelloBanner.stories.tsx +33 -0
  199. package/stories/BMInput.stories.tsx +184 -0
  200. package/stories/BMInputEditableCode.stories.tsx +86 -0
  201. package/stories/BMInputField.stories.tsx +50 -0
  202. package/stories/BMLoadingBox.stories.tsx +45 -0
  203. package/stories/BMMaps.stories.tsx +29 -0
  204. package/stories/BMModal.stories.tsx +218 -0
  205. package/stories/BMMultiEntry.stories.tsx +93 -0
  206. package/stories/BMMultiLevelStepper.stories.tsx +87 -0
  207. package/stories/BMPagination.stories.tsx +41 -0
  208. package/stories/BMPassword.stories.tsx +133 -0
  209. package/stories/BMProgress.stories.tsx +60 -0
  210. package/stories/BMRadio.stories.tsx +71 -0
  211. package/stories/BMSelect.stories.tsx +160 -0
  212. package/stories/BMSlider.stories.tsx +74 -0
  213. package/stories/BMSmartStatus.stories.tsx +98 -0
  214. package/stories/BMSplitButton.stories.tsx +32 -0
  215. package/stories/BMStatus.stories.tsx +29 -0
  216. package/stories/BMTable.stories.tsx +350 -0
  217. package/stories/BMTabs.stories.tsx +25 -0
  218. package/stories/BMTag.stories.tsx +63 -0
  219. package/stories/BMTagv2.stories.tsx +288 -0
  220. package/stories/BMToggle.stories.tsx +123 -0
  221. package/stories/BMTooltip.stories.tsx +59 -0
  222. package/stories/BMTypography.stories.tsx +79 -0
  223. package/stories/BMWarning.stories.tsx +55 -0
  224. package/stories/GenericFailure.stories.tsx +47 -0
  225. package/stories/NoAccess.stories.tsx +19 -0
  226. package/stories/NoAccessActionTooltip.stories.tsx +50 -0
  227. package/stories/NoPermissionModal.stories.tsx +46 -0
  228. package/tsconfig.base.json +21 -0
  229. package/tsconfig.build.json +23 -0
@@ -0,0 +1,74 @@
1
+ import { Box } from "@mui/material";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+
4
+ import { BMSlider, Mark } from "../src";
5
+
6
+ const meta: Meta<typeof BMSlider> = {
7
+ title: "InReview/BMSlider",
8
+ component: BMSlider,
9
+ tags: ["autodocs"],
10
+ decorators: [
11
+ (StoryContent) => (
12
+ <Box sx={{ m: 6 }}>
13
+ <StoryContent />
14
+ </Box>
15
+ ),
16
+ ],
17
+ argTypes: {
18
+ min: {
19
+ control: { type: "number" },
20
+ defaultValue: 1,
21
+ description: "Minimum value for the slider",
22
+ },
23
+ max: {
24
+ control: { type: "number" },
25
+ defaultValue: 7,
26
+ description: "Maximum value for the slider",
27
+ },
28
+ step: {
29
+ control: { type: "number" },
30
+ defaultValue: 1,
31
+ description: "Step value for the slider",
32
+ },
33
+ value: {
34
+ control: { type: "number" },
35
+ defaultValue: 3,
36
+ description: "Current slider value",
37
+ },
38
+ },
39
+ };
40
+
41
+ export default meta;
42
+
43
+ export const Default: StoryObj<typeof BMSlider> = {
44
+ args: {
45
+ min: 1,
46
+ max: 7,
47
+ step: 1,
48
+ value: 3,
49
+ },
50
+ render: (args) => {
51
+ const { min = 1, max = 7, step = 1, value = 3 } = args;
52
+
53
+ const length = (max - min) / (step ?? 1) + 1;
54
+ const marksList: Mark[] = Array.from({ length }, (_, i) => {
55
+ const val = min + i * (step ?? 1);
56
+ return {
57
+ value: val,
58
+ label: val === min || val === max ? val.toString() : "",
59
+ };
60
+ });
61
+
62
+ return (
63
+ <BMSlider
64
+ min={min}
65
+ max={max}
66
+ step={step}
67
+ value={value}
68
+ marksList={marksList}
69
+ onChange={() => {}}
70
+ dataTestId="bm-slider"
71
+ />
72
+ );
73
+ },
74
+ };
@@ -0,0 +1,98 @@
1
+ import React from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { IconPosition, StatusType, BMSmartStatus } from '../src/components/BMSmartStatus';
4
+
5
+ const meta = {
6
+ title: 'InReview/BMSmartStatus',
7
+ component: BMSmartStatus,
8
+ tags: ['autodocs'],
9
+ argTypes: {
10
+ type: {
11
+ control: 'select',
12
+ options: [StatusType.SUCCESS, StatusType.IN_PROGRESS, StatusType.PENDING, StatusType.ERROR, StatusType.WARNING, StatusType.OTHER, StatusType.INACTIVE],
13
+ description: 'The type of status to display',
14
+ table: {
15
+ defaultValue: { summary: StatusType.SUCCESS },
16
+ },
17
+ },
18
+ label: {
19
+ control: 'text',
20
+ description: 'Custom label text. If not provided, will use a capitalized version of the type',
21
+ },
22
+ iconPosition: {
23
+ control: 'radio',
24
+ options: [IconPosition.PREFIX, IconPosition.SUFFIX],
25
+ description: 'Position of the status icon',
26
+ table: {
27
+ defaultValue: { summary: IconPosition.SUFFIX },
28
+ },
29
+ },
30
+ },
31
+ };
32
+
33
+ export default meta;
34
+
35
+ type Story = StoryObj<typeof BMSmartStatus>;
36
+
37
+ export const Default: Story = {
38
+ args: {
39
+ type: StatusType.SUCCESS,
40
+ label: 'Success',
41
+ },
42
+ };
43
+
44
+ export const InProgress: Story = {
45
+ args: {
46
+ type: StatusType.IN_PROGRESS,
47
+ label: 'Processing',
48
+ },
49
+ };
50
+
51
+ export const WithSuffixIcon: Story = {
52
+ args: {
53
+ type: StatusType.SUCCESS,
54
+ label: 'Completed',
55
+ iconPosition: IconPosition.SUFFIX,
56
+ },
57
+ };
58
+
59
+ export const AllStatuses: Story = {
60
+ render: () => (
61
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
62
+ <BMSmartStatus type={StatusType.SUCCESS} />
63
+ <BMSmartStatus type={StatusType.IN_PROGRESS} />
64
+ <BMSmartStatus type={StatusType.PENDING} />
65
+ <BMSmartStatus type={StatusType.ERROR} />
66
+ <BMSmartStatus type={StatusType.WARNING} />
67
+ <BMSmartStatus type={StatusType.OTHER} />
68
+ <BMSmartStatus type={StatusType.INACTIVE} />
69
+ </div>
70
+ ),
71
+ };
72
+
73
+ export const IconPositions: Story = {
74
+ render: () => (
75
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
76
+ <BMSmartStatus type={StatusType.SUCCESS} label="Prefix Icon" />
77
+ <BMSmartStatus type={StatusType.SUCCESS} label="Suffix Icon (Default)" iconPosition={IconPosition.SUFFIX} />
78
+ <BMSmartStatus type={StatusType.IN_PROGRESS} label="Prefix Icon" />
79
+ <BMSmartStatus type={StatusType.IN_PROGRESS} label="Suffix Icon (Default)" iconPosition={IconPosition.SUFFIX} />
80
+ <BMSmartStatus type={StatusType.ERROR} label="Prefix Icon" />
81
+ <BMSmartStatus type={StatusType.ERROR} label="Suffix Icon (Default)" iconPosition={IconPosition.SUFFIX} />
82
+ </div>
83
+ ),
84
+ };
85
+
86
+ export const CustomLabels: Story = {
87
+ render: () => (
88
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
89
+ <BMSmartStatus type={StatusType.SUCCESS} label="Task Completed" />
90
+ <BMSmartStatus type={StatusType.IN_PROGRESS} label="Processing Data" />
91
+ <BMSmartStatus type={StatusType.PENDING} label="Awaiting Review" />
92
+ <BMSmartStatus type={StatusType.ERROR} label="Failed" />
93
+ <BMSmartStatus type={StatusType.WARNING} label="Needs Attention" />
94
+ <BMSmartStatus type={StatusType.OTHER} label="Custom Status" />
95
+ <BMSmartStatus type={StatusType.INACTIVE} label="Disabled" />
96
+ </div>
97
+ ),
98
+ };
@@ -0,0 +1,32 @@
1
+
2
+ import type { Meta } from "@storybook/react";
3
+ import { BMSplitButton, type BMSplitButtonProps } from "../src";
4
+ import { Box } from "@mui/material";
5
+
6
+ const meta: Meta<BMSplitButtonProps> = {
7
+ component: BMSplitButton,
8
+ title: "Split Button",
9
+ };
10
+ export default meta;
11
+
12
+ const getButtons = (type: BMSplitButtonProps["variant"], props: BMSplitButtonProps) => (
13
+ <div style={{ display: 'flex', gap: '18px', alignItems: 'center' }}>
14
+ <BMSplitButton {...props} variant={type}
15
+ label={`${props.disabled ? 'disabled' : type} split button`}
16
+ options={
17
+ [
18
+ { label: "Option 1", onClick: () => alert("Option 1 clicked") },
19
+ { label: "Option 2", onClick: () => alert("Option 2 clicked") }
20
+ ]} />
21
+ </div>
22
+ );
23
+
24
+ export const SplitButton = (props: BMSplitButtonProps) => {
25
+ return <Box sx={{ display: 'flex', direction: 'row', gap: '18px', alignItems: 'center' }}>
26
+ {getButtons("primary", props)}
27
+ {getButtons("secondary", props)}
28
+ {getButtons("gradient", props)}
29
+ {getButtons("ghost", props)}
30
+ {getButtons("primary", { ...props, disabled: true })}
31
+ </Box>
32
+ };
@@ -0,0 +1,29 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Stack, Typography } from "@mui/material";
3
+
4
+ import { BMStatus, STATUS_TYPES } from "../src";
5
+
6
+ const meta: Meta<typeof BMStatus> = {
7
+ title: "InReview/BMStatus",
8
+ component: BMStatus,
9
+ tags: ["autodocs"],
10
+ };
11
+
12
+ export default meta;
13
+
14
+ type Story = StoryObj<typeof BMStatus>;
15
+
16
+ export const AllStatuses: Story = {
17
+ render: () => (
18
+ <Stack spacing={2}>
19
+ <Typography variant="h6">All Status Types</Typography>
20
+ <BMStatus label="Complete" type={STATUS_TYPES.COMPLETE} />
21
+ <BMStatus label="Success" type={STATUS_TYPES.SUCCESS} />
22
+ <BMStatus label="Failed" type={STATUS_TYPES.FAILED} />
23
+ <BMStatus label="Active" type={STATUS_TYPES.ACTIVE} />
24
+ <BMStatus label="Inactive" type={STATUS_TYPES.INACTIVE} />
25
+ <BMStatus label="Pending" type={STATUS_TYPES.PENDING} />
26
+ <BMStatus label="In Progress" type={STATUS_TYPES.IN_PROGRESS} />
27
+ </Stack>
28
+ ),
29
+ };
@@ -0,0 +1,350 @@
1
+ import React from "react";
2
+ import { Meta, StoryObj } from "@storybook/react";
3
+ import { type GridColDef } from "@mui/x-data-grid";
4
+
5
+ import { BMTable } from "../src";
6
+ import { Box, Typography } from "@mui/material";
7
+
8
+ const meta: Meta<typeof BMTable> = {
9
+ title: "InReview/BMTable",
10
+ component: BMTable,
11
+ tags: ["autodocs"],
12
+ };
13
+
14
+ export default meta;
15
+
16
+ type Story = StoryObj<typeof BMTable>;
17
+
18
+ const sampleColumns: GridColDef[] = [
19
+ {
20
+ field: "email",
21
+ headerName: "Email",
22
+ flex: 1.5,
23
+ renderCell: (params) => (
24
+ <a
25
+ href={`mailto:${params.value}`}
26
+ style={{ textDecoration: "none", color: "inherit" }}
27
+ >
28
+ {params.value}
29
+ </a>
30
+ ), // Custom render for email links
31
+ },
32
+ { field: "name", headerName: "Display Name", flex: 1 },
33
+ { field: "role", headerName: "User Role", flex: 1 },
34
+ { field: "status", headerName: "Status", flex: 1 },
35
+ ];
36
+
37
+ const sampleRows = [
38
+ {
39
+ id: 1,
40
+ email: "alice@example.com",
41
+ name: "Alice",
42
+ role: "Admin",
43
+ status: "Active",
44
+ },
45
+ {
46
+ id: 2,
47
+ email: "bob@example.com",
48
+ name: "Bob",
49
+ role: "Developer",
50
+ status: "Invited",
51
+ },
52
+ {
53
+ id: 3,
54
+ email: "carol@example.com",
55
+ name: "Carol",
56
+ role: "Viewer",
57
+ status: "Active",
58
+ },
59
+ ];
60
+
61
+ // Default table
62
+ export const Default: Story = {
63
+ args: {
64
+ columns: sampleColumns,
65
+ data: sampleRows,
66
+ },
67
+ };
68
+
69
+ // With table title
70
+ export const WithTitle: Story = {
71
+ args: {
72
+ tableTitle: "User List",
73
+ columns: sampleColumns,
74
+ data: sampleRows,
75
+ },
76
+ };
77
+
78
+ // With border off
79
+ export const WithoutBorder: Story = {
80
+ args: {
81
+ withBorder: false,
82
+ tableTitle: "No Border Table",
83
+ columns: sampleColumns,
84
+ data: sampleRows,
85
+ },
86
+ };
87
+
88
+ // Single selectable row (radio)
89
+ export const SingleSelectableRow: Story = {
90
+ args: {
91
+ selectableRows: "single",
92
+ tableTitle: "Single Row Select",
93
+ columns: sampleColumns,
94
+ data: sampleRows,
95
+ },
96
+ };
97
+
98
+ // Multiple selectable rows (checkbox)
99
+ export const MultipleSelectableRows: Story = {
100
+ args: {
101
+ selectableRows: "multiple",
102
+ tableTitle: "Multiple Row Select",
103
+ columns: sampleColumns,
104
+ data: sampleRows,
105
+ },
106
+ };
107
+
108
+ // Custom column alignment and widths
109
+ export const CustomColumns: Story = {
110
+ args: {
111
+ tableTitle: "Custom Column Layout",
112
+ columns: [
113
+ {
114
+ field: "email",
115
+ headerName: "Email",
116
+ width: 250,
117
+ },
118
+ {
119
+ field: "name",
120
+ headerName: "Name",
121
+ align: "center",
122
+ headerAlign: "center",
123
+ flex: 1,
124
+ },
125
+ {
126
+ field: "role",
127
+ headerName: "Role",
128
+ align: "right",
129
+ headerAlign: "right",
130
+ flex: 1,
131
+ },
132
+ ],
133
+ data: sampleRows,
134
+ },
135
+ };
136
+
137
+ // Custom cell renderers
138
+ const displayCreated = (params: any) =>
139
+ new Date(params.row.created_on).toLocaleString();
140
+
141
+ const displaySize = (params: any) =>
142
+ `${(params.row.size_in_bytes / 1024).toFixed(1)} KB`;
143
+
144
+ const displayStatus = (params: any) => (
145
+ <Box
146
+ sx={{
147
+ display: "flex",
148
+ alignItems: "center",
149
+ height: "100%",
150
+ width: "100%",
151
+ }}
152
+ >
153
+ <Box
154
+ sx={{
155
+ height: "25px",
156
+ backgroundColor: params.row.state === "COMPLETED" ? "#d0f0c0" : "#fdd",
157
+ px: 1,
158
+ borderRadius: "4px",
159
+ display: "flex",
160
+ alignItems: "center",
161
+ justifyContent: "center",
162
+ fontSize: "0.7rem",
163
+ fontWeight: 500,
164
+ }}
165
+ >
166
+ {params.row.state}
167
+ </Box>
168
+ </Box>
169
+ );
170
+
171
+ const customTableColumns: GridColDef[] = [
172
+ {
173
+ field: "id",
174
+ headerName: "",
175
+ },
176
+ {
177
+ field: "created_on",
178
+ headerName: "Created On",
179
+ renderCell: displayCreated,
180
+ minWidth: 126,
181
+ flex: 1,
182
+ headerClassName: "header--created_on",
183
+ cellClassName: "cell--created_on",
184
+ },
185
+ {
186
+ field: "size_in_bytes",
187
+ headerName: "Size",
188
+ renderCell: displaySize,
189
+ minWidth: 75,
190
+ flex: 1,
191
+ headerClassName: "header--size",
192
+ cellClassName: "cell--size",
193
+ },
194
+ {
195
+ field: "state",
196
+ headerName: "Status",
197
+ renderCell: displayStatus,
198
+ minWidth: 140,
199
+ flex: 1,
200
+ headerClassName: "header--status",
201
+ cellClassName: "cell--status",
202
+ },
203
+ {
204
+ field: "action",
205
+ headerName: "Action",
206
+ sortable: false,
207
+ filterable: false,
208
+ disableColumnMenu: true,
209
+ minWidth: 50,
210
+ headerAlign: "right",
211
+ align: "right",
212
+ flex: 1,
213
+ renderCell: (params) => (
214
+ <Box
215
+ sx={{
216
+ textAlign: "right",
217
+ width: "100%",
218
+ color: "#1976d2",
219
+ cursor: "pointer",
220
+ }}
221
+ onClick={() => alert(`Clicked action for row ${params.id}`)}
222
+ >
223
+ Restore
224
+ </Box>
225
+ ),
226
+ },
227
+ ];
228
+
229
+ const customData = [
230
+ {
231
+ id: 1,
232
+ created_on: "2023-10-01T12:00:00Z",
233
+ size_in_bytes: 204800,
234
+ state: "COMPLETED",
235
+ action: "Restore",
236
+ },
237
+ {
238
+ id: 2,
239
+ created_on: "2023-10-02T14:30:00Z",
240
+ size_in_bytes: 102400,
241
+ state: "FAILED",
242
+ action: "Restore",
243
+ },
244
+ {
245
+ id: 3,
246
+ created_on: "2023-10-03T09:15:00Z",
247
+ size_in_bytes: 51200,
248
+ state: "COMPLETED",
249
+ action: "Restore",
250
+ },
251
+ {
252
+ id: 4,
253
+ created_on: "2023-10-04T16:45:00Z",
254
+ size_in_bytes: 307200,
255
+ state: "IN_PROGRESS",
256
+ action: "Restore",
257
+ },
258
+ {
259
+ id: 5,
260
+ created_on: "2023-10-05T11:20:00Z",
261
+ size_in_bytes: 153600,
262
+ state: "COMPLETED",
263
+ action: "Restore",
264
+ },
265
+ {
266
+ id: 6,
267
+ created_on: "2023-10-06T08:00:00Z",
268
+ size_in_bytes: 409600,
269
+ state: "FAILED",
270
+ action: "Restore",
271
+ },
272
+ {
273
+ id: 7,
274
+ created_on: "2023-10-07T13:30:00Z",
275
+ size_in_bytes: 256000,
276
+ state: "COMPLETED",
277
+ action: "Restore",
278
+ },
279
+ ];
280
+
281
+ const customColumnsWithCustomHeader = (col: any) => {
282
+ return (
283
+ <Box
284
+ sx={{
285
+ flex: 1,
286
+ display: "flex",
287
+ alignItems: "center",
288
+ width: "100%",
289
+ height: "100%",
290
+ boxSizing: "border-box",
291
+ }}
292
+ >
293
+ <Typography variant="subtitle2" sx={{ fontWeight: "bold" }}>
294
+ {col.headerName}
295
+ </Typography>
296
+ </Box>
297
+ );
298
+ };
299
+
300
+ export const CustomCellRender: Story = {
301
+ args: {
302
+ tableTitle: "Custom Cell Render",
303
+ columns: customTableColumns,
304
+ data: customData,
305
+ withBorder: true,
306
+ dataTestId: "custom-cell-render-table",
307
+ customHeaderRenderer: customColumnsWithCustomHeader,
308
+ columnVisibilityModel: {
309
+ id: false, // hide `id`
310
+ },
311
+ rowHeight: 68,
312
+ density: "compact",
313
+ autoHeight: true,
314
+ options: {
315
+ setTableProps: () => ({
316
+ sx: {
317
+ backgroundColor: "#fff",
318
+ "& .MuiDataGrid-cell:focus, & .MuiDataGrid-cell:focus-within": {
319
+ outline: "none",
320
+ },
321
+ "& .MuiDataGrid-columnHeader:focus, & .MuiDataGrid-columnHeader:focus-within":
322
+ {
323
+ outline: "none",
324
+ },
325
+ "& .MuiDataGrid-row.Mui-selected": {
326
+ backgroundColor: "transparent !important",
327
+ },
328
+ "& .MuiDataGrid-cell.Mui-selected": {
329
+ backgroundColor: "transparent !important",
330
+ },
331
+ "& .MuiDataGrid-row": {
332
+ borderBottom: "1px solid #e0e0e0",
333
+ // p: 2
334
+ },
335
+ "& .MuiDataGrid-columnHeaders": {
336
+ borderBottom: "1px solid #e0e0e0",
337
+ },
338
+ "& .MuiDataGrid-columnHeader": {
339
+ backgroundColor: "#fff",
340
+ },
341
+ "& .MuiDataGrid-cell": {
342
+ fontSize: "0.75rem",
343
+ fontWeight: 500,
344
+ color: "#333",
345
+ },
346
+ },
347
+ }),
348
+ },
349
+ },
350
+ };
@@ -0,0 +1,25 @@
1
+ import { Meta } from "@storybook/react";
2
+ import { BMTab, BMTabs, BMTabsProps } from "../src/components/BMTabs";
3
+ import { useState } from "react";
4
+
5
+ const meta: Meta<BMTabsProps> = {
6
+ component: BMTabs,
7
+ title: "BMTabs",
8
+ };
9
+
10
+ export default meta;
11
+
12
+ export const Tabs = (args: BMTabsProps) => {
13
+ const [value, setValue] = useState(0);
14
+ const handleChange = (_event: React.SyntheticEvent, newValue: number) => {
15
+ setValue(newValue);
16
+ };
17
+ return (
18
+ <BMTabs value={value} {...args} onChange={handleChange}>
19
+ <BMTab value={0} label="Usage" />
20
+ <BMTab value={1} label="Plan" />
21
+ <BMTab value={2} label="Invoices" />
22
+ <BMTab value={3} label="Billing Information" />
23
+ </BMTabs>
24
+ );
25
+ }
@@ -0,0 +1,63 @@
1
+ import { Box } from "@mui/material";
2
+ import type { Meta, StoryFn } from "@storybook/react";
3
+
4
+ import { BMTag, BMPreviewTagProps } from "../src";
5
+
6
+ const meta: Meta<typeof BMTag> = {
7
+ title: "InReview/BMTag",
8
+ component: BMTag,
9
+ tags: ["autodocs"],
10
+ argTypes: {
11
+ text: { control: "text" },
12
+ noGradient: { control: "boolean" },
13
+ },
14
+ decorators: [
15
+ (StoryContent) => (
16
+ <div style={{ margin: "3em" }}>
17
+ <StoryContent />
18
+ </div>
19
+ ),
20
+ ],
21
+ };
22
+
23
+ export default meta;
24
+
25
+ export const AllVariants: StoryFn<BMPreviewTagProps> = () => {
26
+ return (
27
+ <Box sx={{ display: "flex", flexDirection: "column", gap: 2 }}>
28
+ {/* Default Gradient Tag */}
29
+ <Box sx={{ display: "flex" }}>
30
+ <BMTag text="Default Gradient Tag" />
31
+ </Box>
32
+
33
+ {/* No Gradient Tag */}
34
+ <Box sx={{ display: "flex" }}>
35
+ <BMTag text="No Gradient Tag" noGradient />
36
+ </Box>
37
+
38
+ {/* Multiple Tags Layout */}
39
+ <Box sx={{ display: "flex", flexDirection: "column", gap: 2 }}>
40
+ <Box sx={{ display: "flex" }}>
41
+ <BMTag text="Tag 1" />
42
+ <BMTag text="Tag 2" noGradient />
43
+ </Box>
44
+ <Box sx={{ display: "flex" }}>
45
+ <BMTag text="Tag 3" />
46
+ <BMTag text="Tag 4" noGradient />
47
+ </Box>
48
+ </Box>
49
+ </Box>
50
+ );
51
+ };
52
+
53
+ export const Default: StoryFn<BMPreviewTagProps> = (args) => {
54
+ return (
55
+ <Box sx={{ width: 580, p: 2, ml: 0.5, display: "flex" }}>
56
+ <BMTag {...args} />
57
+ </Box>
58
+ );
59
+ };
60
+
61
+ Default.args = {
62
+ text: "Default Tag Text",
63
+ };