@verma-consulting/design-library 0.1.28 → 0.1.29

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/dist/index.d.mts CHANGED
@@ -102,10 +102,18 @@ type ImageUploadAvatarProps = {
102
102
  };
103
103
  declare const ImageUploadAvatar: React__default.FC<ImageUploadAvatarProps>;
104
104
 
105
- declare const FormSnackBar: ({ snackBar, setSnackBar }: {
106
- snackBar?: {} | undefined;
107
- setSnackBar?: (() => null) | undefined;
108
- }) => react_jsx_runtime.JSX.Element;
105
+ type SnackbarType = "success" | "error" | "warning" | "info" | "";
106
+ interface FormSnackBarState {
107
+ open?: boolean;
108
+ message?: string;
109
+ type?: SnackbarType;
110
+ }
111
+ interface FormSnackBarProps {
112
+ snackBar?: FormSnackBarState;
113
+ setSnackBar?: (state: FormSnackBarState) => void;
114
+ autoHideDuration?: number;
115
+ }
116
+ declare const FormSnackBar: React__default.FC<FormSnackBarProps>;
109
117
 
110
118
  interface LoaderProps {
111
119
  size?: number;
package/dist/index.d.ts CHANGED
@@ -102,10 +102,18 @@ type ImageUploadAvatarProps = {
102
102
  };
103
103
  declare const ImageUploadAvatar: React__default.FC<ImageUploadAvatarProps>;
104
104
 
105
- declare const FormSnackBar: ({ snackBar, setSnackBar }: {
106
- snackBar?: {} | undefined;
107
- setSnackBar?: (() => null) | undefined;
108
- }) => react_jsx_runtime.JSX.Element;
105
+ type SnackbarType = "success" | "error" | "warning" | "info" | "";
106
+ interface FormSnackBarState {
107
+ open?: boolean;
108
+ message?: string;
109
+ type?: SnackbarType;
110
+ }
111
+ interface FormSnackBarProps {
112
+ snackBar?: FormSnackBarState;
113
+ setSnackBar?: (state: FormSnackBarState) => void;
114
+ autoHideDuration?: number;
115
+ }
116
+ declare const FormSnackBar: React__default.FC<FormSnackBarProps>;
109
117
 
110
118
  interface LoaderProps {
111
119
  size?: number;
package/dist/index.js CHANGED
@@ -49,11 +49,11 @@ __export(index_exports, {
49
49
  StatusPill: () => StatusPill_default,
50
50
  TabPanel: () => TabPanel_default,
51
51
  TablePagination: () => TablePagination_default,
52
- ThemeProvider: () => import_styles10.ThemeProvider,
53
- createTheme: () => import_styles10.createTheme,
54
- makeStyles: () => import_styles11.makeStyles,
55
- styled: () => import_styles10.styled,
56
- useTheme: () => import_styles10.useTheme
52
+ ThemeProvider: () => import_styles11.ThemeProvider,
53
+ createTheme: () => import_styles11.createTheme,
54
+ makeStyles: () => import_styles12.makeStyles,
55
+ styled: () => import_styles11.styled,
56
+ useTheme: () => import_styles11.useTheme
57
57
  });
58
58
  module.exports = __toCommonJS(index_exports);
59
59
  __reExport(index_exports, require("@mui/material"), module.exports);
@@ -328,7 +328,7 @@ var rootSx = {
328
328
  }
329
329
  };
330
330
  var TablePagination = React2.forwardRef(function TablePagination2(props, ref) {
331
- var _a, _b;
331
+ var _a2, _b;
332
332
  const {
333
333
  sx,
334
334
  slotProps,
@@ -342,7 +342,7 @@ var TablePagination = React2.forwardRef(function TablePagination2(props, ref) {
342
342
  displayedRangeLabel,
343
343
  ...other
344
344
  } = props;
345
- const labelRowsPerPageResolved = (_a = labelRowsPerPageProp != null ? labelRowsPerPageProp : rowsPerPageLabel) != null ? _a : DEFAULT_ROWS_PER_PAGE_LABEL;
345
+ const labelRowsPerPageResolved = (_a2 = labelRowsPerPageProp != null ? labelRowsPerPageProp : rowsPerPageLabel) != null ? _a2 : DEFAULT_ROWS_PER_PAGE_LABEL;
346
346
  const labelDisplayedRowsResolved = (_b = labelDisplayedRowsProp != null ? labelDisplayedRowsProp : displayedRangeLabel) != null ? _b : defaultDisplayedRangeLabel;
347
347
  const slotSelect = slotProps == null ? void 0 : slotProps.select;
348
348
  const { sx: slotSelectSx, ...slotSelectRest } = slotSelect != null ? slotSelect : {};
@@ -398,8 +398,8 @@ var TablePagination = React2.forwardRef(function TablePagination2(props, ref) {
398
398
  var TablePagination_default = TablePagination;
399
399
 
400
400
  // src/index.tsx
401
- var import_styles10 = require("@mui/material/styles");
402
- var import_styles11 = require("@mui/styles");
401
+ var import_styles11 = require("@mui/material/styles");
402
+ var import_styles12 = require("@mui/styles");
403
403
 
404
404
  // src/Logo.tsx
405
405
  var import_react2 = require("react");
@@ -414,12 +414,12 @@ var Logo = (0, import_react2.memo)(
414
414
  handleClick = () => null,
415
415
  companyComponent = null
416
416
  }) => {
417
- var _a;
417
+ var _a2;
418
418
  const theme = (0, import_material3.useTheme)();
419
419
  const mdMatches = (0, import_material3.useMediaQuery)(theme.breakpoints.down("md"));
420
420
  const maxWidth = mdMatches ? 160 : 320;
421
421
  const companyName = (organization == null ? void 0 : organization.name) || "\u2013";
422
- const logoUrl = (_a = organization == null ? void 0 : organization.logo) == null ? void 0 : _a.url;
422
+ const logoUrl = (_a2 = organization == null ? void 0 : organization.logo) == null ? void 0 : _a2.url;
423
423
  if (centered) {
424
424
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
425
425
  import_material3.Grid,
@@ -721,8 +721,8 @@ var ImageUploadAvatar = ({
721
721
  };
722
722
  }, [internalSrc]);
723
723
  const handlePick = (e) => {
724
- var _a, _b;
725
- const selected = (_b = (_a = e.target.files) == null ? void 0 : _a[0]) != null ? _b : null;
724
+ var _a2, _b;
725
+ const selected = (_b = (_a2 = e.target.files) == null ? void 0 : _a2[0]) != null ? _b : null;
726
726
  if (internalSrc == null ? void 0 : internalSrc.startsWith("blob:")) {
727
727
  URL.revokeObjectURL(internalSrc);
728
728
  }
@@ -737,8 +737,8 @@ var ImageUploadAvatar = ({
737
737
  onChange == null ? void 0 : onChange(selected, preview);
738
738
  };
739
739
  const triggerPick = () => {
740
- var _a;
741
- if (!disabled) (_a = inputRef.current) == null ? void 0 : _a.click();
740
+ var _a2;
741
+ if (!disabled) (_a2 = inputRef.current) == null ? void 0 : _a2.click();
742
742
  };
743
743
  const handleClear = (e) => {
744
744
  e.stopPropagation();
@@ -769,44 +769,172 @@ var ImageUploadAvatar = ({
769
769
  var ImageUploadAvatar_default = ImageUploadAvatar;
770
770
 
771
771
  // src/FormSnackBar.tsx
772
+ var import_react4 = require("react");
772
773
  var import_material7 = require("@mui/material");
774
+ var import_styles6 = require("@mui/material/styles");
775
+ var import_Close = __toESM(require("@mui/icons-material/Close"));
776
+ var import_common_library2 = require("@verma-consulting/common-library");
773
777
  var import_jsx_runtime8 = require("react/jsx-runtime");
774
- var FormSnackBar = ({ snackBar = {}, setSnackBar = () => null }) => {
775
- const getAlertStyles = () => {
776
- if ((snackBar == null ? void 0 : snackBar.type) === "success") {
777
- return { backgroundColor: "#65C466", color: "white" };
778
+ var _a;
779
+ var SNACKBAR_TYPES = (_a = import_common_library2.constants) == null ? void 0 : _a.SNACKBAR_TYPES;
780
+ function isSnackbarType(val) {
781
+ if (!SNACKBAR_TYPES) return false;
782
+ const values = Object.values(SNACKBAR_TYPES);
783
+ return typeof val === "string" && values.includes(val);
784
+ }
785
+ var FormSnackBar = ({
786
+ snackBar = {},
787
+ setSnackBar = () => null,
788
+ autoHideDuration = 3500
789
+ }) => {
790
+ var _a2, _b;
791
+ const theme = (0, import_styles6.useTheme)();
792
+ const [queue, setQueue] = (0, import_react4.useState)([]);
793
+ const idRef = (0, import_react4.useRef)(0);
794
+ const prevOpenRef = (0, import_react4.useRef)(!!(snackBar == null ? void 0 : snackBar.open));
795
+ const prevSignatureRef = (0, import_react4.useRef)("");
796
+ const timersRef = (0, import_react4.useRef)(
797
+ {}
798
+ );
799
+ const type = (_a2 = snackBar.type) != null ? _a2 : "";
800
+ const message = (_b = snackBar.message) != null ? _b : "";
801
+ const severity = isSnackbarType(type) ? type : "info";
802
+ const enqueueFromProp = () => {
803
+ if (!(snackBar == null ? void 0 : snackBar.open)) return;
804
+ if (!message) return;
805
+ const signature = `${type}::${message}`;
806
+ const openRose = !prevOpenRef.current && !!(snackBar == null ? void 0 : snackBar.open);
807
+ const signatureChanged = signature !== prevSignatureRef.current;
808
+ if (!openRose && !signatureChanged) return;
809
+ prevSignatureRef.current = signature;
810
+ const id = String(++idRef.current);
811
+ setQueue((q) => [...q, { id, type, message }]);
812
+ timersRef.current[id] = setTimeout(() => {
813
+ setQueue((q) => q.filter((item) => item.id !== id));
814
+ delete timersRef.current[id];
815
+ }, autoHideDuration);
816
+ setSnackBar({ open: false, message: "", type: "" });
817
+ };
818
+ (0, import_react4.useEffect)(() => {
819
+ const nextOpen = !!(snackBar == null ? void 0 : snackBar.open);
820
+ enqueueFromProp();
821
+ prevOpenRef.current = nextOpen;
822
+ }, [snackBar == null ? void 0 : snackBar.open, snackBar == null ? void 0 : snackBar.message, snackBar == null ? void 0 : snackBar.type]);
823
+ const handleDismiss = (id) => {
824
+ const t = timersRef.current[id];
825
+ if (t) clearTimeout(t);
826
+ delete timersRef.current[id];
827
+ setQueue((q) => q.filter((item) => item.id !== id));
828
+ };
829
+ (0, import_react4.useEffect)(() => {
830
+ return () => {
831
+ Object.values(timersRef.current).forEach((t) => clearTimeout(t));
832
+ timersRef.current = {};
833
+ };
834
+ }, []);
835
+ const typeStyles = (severity2) => {
836
+ if (severity2 === "success") {
837
+ return {
838
+ stripe: (0, import_styles6.alpha)(theme.palette.success.main, theme.palette.mode === "dark" ? 0.35 : 0.22),
839
+ bg: theme.palette.mode === "dark" ? (0, import_styles6.alpha)(theme.palette.success.main, 0.18) : "#EAF7EE",
840
+ text: theme.palette.mode === "dark" ? theme.palette.success.light : "#1B5E20",
841
+ icon: theme.palette.mode === "dark" ? theme.palette.success.light : "#2E7D32"
842
+ };
778
843
  }
779
- return {};
844
+ if (severity2 === "error") {
845
+ return {
846
+ stripe: (0, import_styles6.alpha)(theme.palette.error.main, theme.palette.mode === "dark" ? 0.35 : 0.22),
847
+ bg: theme.palette.mode === "dark" ? (0, import_styles6.alpha)(theme.palette.error.main, 0.18) : "#FDECEC",
848
+ text: theme.palette.mode === "dark" ? theme.palette.error.light : "#8B1D1D",
849
+ icon: theme.palette.mode === "dark" ? theme.palette.error.light : "#D32F2F"
850
+ };
851
+ }
852
+ if (severity2 === "warning") {
853
+ return {
854
+ // cream soda orange
855
+ stripe: (0, import_styles6.alpha)(theme.palette.warning.main, theme.palette.mode === "dark" ? 0.35 : 0.22),
856
+ bg: theme.palette.mode === "dark" ? (0, import_styles6.alpha)(theme.palette.warning.main, 0.2) : "#FFF3E0",
857
+ text: theme.palette.mode === "dark" ? theme.palette.warning.light : "#9A5B00",
858
+ icon: theme.palette.mode === "dark" ? theme.palette.warning.light : "#F59E0B"
859
+ };
860
+ }
861
+ return {
862
+ stripe: (0, import_styles6.alpha)(theme.palette.info.main, theme.palette.mode === "dark" ? 0.35 : 0.22),
863
+ bg: theme.palette.mode === "dark" ? (0, import_styles6.alpha)(theme.palette.info.main, 0.18) : "#E8F3FF",
864
+ text: theme.palette.mode === "dark" ? theme.palette.info.light : "#0B3A63",
865
+ icon: theme.palette.mode === "dark" ? theme.palette.info.light : "#3B82F6"
866
+ };
780
867
  };
781
868
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
782
- import_material7.Snackbar,
869
+ "div",
783
870
  {
784
- sx: { width: "100%" },
785
- autoHideDuration: 1e3,
786
- anchorOrigin: { vertical: "top", horizontal: "center" },
787
- open: (snackBar == null ? void 0 : snackBar.open) || false,
788
- onClose: () => setSnackBar({
789
- open: false,
790
- message: "",
791
- type: ""
792
- }),
793
- TransitionComponent: import_material7.Slide,
794
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
795
- import_material7.Alert,
796
- {
797
- sx: {
798
- width: "100%",
799
- display: "flex",
800
- alignItems: "center",
801
- justifyContent: "center",
802
- textAlign: "center",
803
- ...getAlertStyles()
804
- },
805
- variant: "filled",
806
- severity: snackBar == null ? void 0 : snackBar.type,
807
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material7.AlertTitle, { sx: { m: 0, p: 0 }, children: snackBar == null ? void 0 : snackBar.message })
808
- }
809
- )
871
+ "aria-live": "polite",
872
+ "aria-atomic": "true",
873
+ style: {
874
+ position: "fixed",
875
+ top: 12,
876
+ right: 12,
877
+ zIndex: 1400,
878
+ display: "flex",
879
+ flexDirection: "column",
880
+ gap: 8,
881
+ width: "min(420px, calc(100vw - 24px))",
882
+ pointerEvents: "none"
883
+ },
884
+ children: queue.map((item) => {
885
+ const localSeverity = isSnackbarType(item.type) ? item.type : "info";
886
+ const colors = typeStyles(localSeverity);
887
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material7.Grow, { in: true, timeout: 280, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
888
+ import_material7.Alert,
889
+ {
890
+ variant: "filled",
891
+ severity: localSeverity,
892
+ sx: {
893
+ width: "100%",
894
+ pointerEvents: "auto",
895
+ borderRadius: 2,
896
+ px: { xs: 1.25, sm: 1.5 },
897
+ py: 0.875,
898
+ alignItems: "center",
899
+ boxShadow: 2,
900
+ position: "relative",
901
+ backgroundColor: colors.bg,
902
+ color: colors.text,
903
+ "& .MuiAlert-icon": {
904
+ color: colors.icon
905
+ },
906
+ "& .MuiAlert-message": {
907
+ m: 0,
908
+ p: 0,
909
+ fontWeight: 600,
910
+ letterSpacing: "-0.01em"
911
+ },
912
+ "&::before": {
913
+ content: '""',
914
+ position: "absolute",
915
+ left: 0,
916
+ top: 0,
917
+ bottom: 0,
918
+ width: 4,
919
+ backgroundColor: colors.stripe,
920
+ borderTopLeftRadius: 2,
921
+ borderBottomLeftRadius: 2
922
+ }
923
+ },
924
+ action: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
925
+ import_material7.IconButton,
926
+ {
927
+ "aria-label": "close",
928
+ color: "inherit",
929
+ size: "small",
930
+ onClick: () => handleDismiss(item.id),
931
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_Close.default, { fontSize: "small" })
932
+ }
933
+ ),
934
+ children: item.message
935
+ }
936
+ ) }, item.id);
937
+ })
810
938
  }
811
939
  );
812
940
  };
@@ -814,9 +942,9 @@ var FormSnackBar_default = FormSnackBar;
814
942
 
815
943
  // src/Loader.tsx
816
944
  var import_material8 = require("@mui/material");
817
- var import_styles6 = require("@mui/styles");
945
+ var import_styles7 = require("@mui/styles");
818
946
  var import_jsx_runtime9 = require("react/jsx-runtime");
819
- var useStyles2 = (0, import_styles6.makeStyles)({
947
+ var useStyles2 = (0, import_styles7.makeStyles)({
820
948
  "@keyframes pulse": {
821
949
  "0%": { transform: "scale(1)", opacity: 0.9 },
822
950
  "50%": { transform: "scale(1.05)", opacity: 1 },
@@ -857,9 +985,9 @@ var SkeletonBar = ({
857
985
  height = 24,
858
986
  sx = {}
859
987
  }) => {
860
- var _a, _b, _c, _d, _e, _f, _g, _h;
988
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
861
989
  const theme = (0, import_material9.useTheme)();
862
- const base = theme.palette.mode === "dark" ? (_b = (_a = theme.palette.grey) == null ? void 0 : _a[700]) != null ? _b : "#424242" : (_d = (_c = theme.palette.grey) == null ? void 0 : _c[200]) != null ? _d : "#e0e0e0";
990
+ const base = theme.palette.mode === "dark" ? (_b = (_a2 = theme.palette.grey) == null ? void 0 : _a2[700]) != null ? _b : "#424242" : (_d = (_c = theme.palette.grey) == null ? void 0 : _c[200]) != null ? _d : "#e0e0e0";
863
991
  const highlight = theme.palette.mode === "dark" ? (_f = (_e = theme.palette.grey) == null ? void 0 : _e[600]) != null ? _f : "#616161" : (_h = (_g = theme.palette.grey) == null ? void 0 : _g[100]) != null ? _h : "#f5f5f5";
864
992
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
865
993
  import_material9.Box,
@@ -882,7 +1010,7 @@ var SkeletonBar = ({
882
1010
  var SkeletonBar_default = SkeletonBar;
883
1011
 
884
1012
  // src/EmptyState.tsx
885
- var import_react4 = __toESM(require("react"));
1013
+ var import_react5 = __toESM(require("react"));
886
1014
  var import_material10 = require("@mui/material");
887
1015
  var import_icons_material5 = require("@mui/icons-material");
888
1016
  var import_jsx_runtime11 = require("react/jsx-runtime");
@@ -891,7 +1019,7 @@ var EmptyState = ({ label, m = 8, icon }) => {
891
1019
  const text = label != null ? label : "No data created yet";
892
1020
  const iconColor = theme.palette.mode === "dark" ? "rgba(255,255,255,0.42)" : "rgba(0,0,0,0.42)";
893
1021
  const labelColor = theme.palette.mode === "dark" ? "rgba(255,255,255,0.50)" : "rgba(0,0,0,0.38)";
894
- const iconEl = icon != null && import_react4.default.isValidElement(icon) ? icon : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1022
+ const iconEl = icon != null && import_react5.default.isValidElement(icon) ? icon : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
895
1023
  import_icons_material5.DatasetOutlined,
896
1024
  {
897
1025
  sx: {
@@ -941,9 +1069,9 @@ var EmptyState_default = EmptyState;
941
1069
 
942
1070
  // src/Pill.tsx
943
1071
  var import_material11 = require("@mui/material");
944
- var import_styles7 = require("@mui/styles");
1072
+ var import_styles8 = require("@mui/styles");
945
1073
  var import_jsx_runtime12 = require("react/jsx-runtime");
946
- var useStyles3 = (0, import_styles7.makeStyles)((theme) => ({
1074
+ var useStyles3 = (0, import_styles8.makeStyles)((theme) => ({
947
1075
  button: {
948
1076
  padding: "4px 8px 4px 8px",
949
1077
  color: "black",
@@ -1008,10 +1136,10 @@ var Pill = ({
1008
1136
  var Pill_default = Pill;
1009
1137
 
1010
1138
  // src/IOSSwitch.tsx
1011
- var import_styles8 = require("@mui/material/styles");
1139
+ var import_styles9 = require("@mui/material/styles");
1012
1140
  var import_Switch = __toESM(require("@mui/material/Switch"));
1013
1141
  var import_jsx_runtime13 = require("react/jsx-runtime");
1014
- var IOSSwitch = (0, import_styles8.styled)((props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Switch.default, { focusVisibleClassName: ".Mui-focusVisible", disableRipple: true, ...props }))(({ theme }) => ({
1142
+ var IOSSwitch = (0, import_styles9.styled)((props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Switch.default, { focusVisibleClassName: ".Mui-focusVisible", disableRipple: true, ...props }))(({ theme }) => ({
1015
1143
  width: 46,
1016
1144
  height: 30,
1017
1145
  padding: 0,
@@ -1060,13 +1188,13 @@ var IOSSwitch_default = IOSSwitch;
1060
1188
 
1061
1189
  // src/StatusPill.tsx
1062
1190
  var import_material12 = require("@mui/material");
1063
- var import_common_library2 = require("@verma-consulting/common-library");
1191
+ var import_common_library3 = require("@verma-consulting/common-library");
1064
1192
  var import_jsx_runtime14 = require("react/jsx-runtime");
1065
1193
  var statusColorMap = {
1066
- [import_common_library2.userStatus.Pending]: "warning",
1067
- [import_common_library2.userStatus.Active]: "success",
1068
- [import_common_library2.userStatus.Inactive]: "error",
1069
- [import_common_library2.userStatus.Invited]: "info"
1194
+ [import_common_library3.userStatus.Pending]: "warning",
1195
+ [import_common_library3.userStatus.Active]: "success",
1196
+ [import_common_library3.userStatus.Inactive]: "error",
1197
+ [import_common_library3.userStatus.Invited]: "info"
1070
1198
  };
1071
1199
  var StatusPill = ({ status }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1072
1200
  import_material12.Chip,
@@ -1080,12 +1208,12 @@ var StatusPill = ({ status }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1080
1208
  var StatusPill_default = StatusPill;
1081
1209
 
1082
1210
  // src/FormPopover.tsx
1083
- var import_react5 = require("react");
1211
+ var import_react6 = require("react");
1084
1212
  var import_material13 = require("@mui/material");
1085
1213
  var import_icons_material6 = require("@mui/icons-material");
1086
1214
  var import_jsx_runtime15 = require("react/jsx-runtime");
1087
1215
  var FormPopover = ({ row, children, title }) => {
1088
- const [anchorEl, setAnchorEl] = (0, import_react5.useState)(null);
1216
+ const [anchorEl, setAnchorEl] = (0, import_react6.useState)(null);
1089
1217
  const handleClick = (event) => {
1090
1218
  setAnchorEl(event.currentTarget);
1091
1219
  };
@@ -1130,12 +1258,12 @@ var FormPopover = ({ row, children, title }) => {
1130
1258
  var FormPopover_default = FormPopover;
1131
1259
 
1132
1260
  // src/SearchableSelect.tsx
1133
- var import_react6 = __toESM(require("react"));
1261
+ var import_react7 = __toESM(require("react"));
1134
1262
  var import_material14 = require("@mui/material");
1135
1263
  var import_icons_material7 = require("@mui/icons-material");
1136
- var import_styles9 = require("@mui/styles");
1264
+ var import_styles10 = require("@mui/styles");
1137
1265
  var import_jsx_runtime16 = require("react/jsx-runtime");
1138
- var useStyles4 = (0, import_styles9.makeStyles)(() => ({
1266
+ var useStyles4 = (0, import_styles10.makeStyles)(() => ({
1139
1267
  defaultMode: {
1140
1268
  padding: "14px 8px",
1141
1269
  cursor: "pointer",
@@ -1153,7 +1281,7 @@ var useStyles4 = (0, import_styles9.makeStyles)(() => ({
1153
1281
  whiteSpace: "pre-wrap"
1154
1282
  }
1155
1283
  }));
1156
- var SearchableSelect = import_react6.default.memo(
1284
+ var SearchableSelect = import_react7.default.memo(
1157
1285
  ({
1158
1286
  name,
1159
1287
  label,
@@ -1168,11 +1296,11 @@ var SearchableSelect = import_react6.default.memo(
1168
1296
  multiple = false
1169
1297
  }) => {
1170
1298
  const classes = useStyles4();
1171
- const wrapperRef = (0, import_react6.useRef)(null);
1172
- const inputRef = (0, import_react6.useRef)(null);
1173
- const [editMode, setEditMode] = (0, import_react6.useState)(defaultEditMode);
1174
- const [open, setOpen] = (0, import_react6.useState)(defaultEditMode);
1175
- (0, import_react6.useEffect)(() => {
1299
+ const wrapperRef = (0, import_react7.useRef)(null);
1300
+ const inputRef = (0, import_react7.useRef)(null);
1301
+ const [editMode, setEditMode] = (0, import_react7.useState)(defaultEditMode);
1302
+ const [open, setOpen] = (0, import_react7.useState)(defaultEditMode);
1303
+ (0, import_react7.useEffect)(() => {
1176
1304
  function handleClickOutside(event) {
1177
1305
  if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
1178
1306
  setEditMode(false);
@@ -1186,7 +1314,7 @@ var SearchableSelect = import_react6.default.memo(
1186
1314
  document.removeEventListener("mousedown", handleClickOutside);
1187
1315
  };
1188
1316
  }, [editMode]);
1189
- (0, import_react6.useEffect)(() => {
1317
+ (0, import_react7.useEffect)(() => {
1190
1318
  if (editMode && open && inputRef.current) {
1191
1319
  inputRef.current.focus();
1192
1320
  }
@@ -1201,23 +1329,23 @@ var SearchableSelect = import_react6.default.memo(
1201
1329
  setEditMode(false);
1202
1330
  setOpen(false);
1203
1331
  };
1204
- const selected = (0, import_react6.useMemo)(() => {
1205
- var _a;
1332
+ const selected = (0, import_react7.useMemo)(() => {
1333
+ var _a2;
1206
1334
  if (multiple) {
1207
1335
  if (!value.trim()) return [];
1208
1336
  const selectedValues = value.split(", ").map((v) => v.trim());
1209
1337
  return options.filter((opt) => selectedValues.includes(opt.value));
1210
1338
  } else {
1211
- return (_a = options.find((opt) => opt.value === value)) != null ? _a : null;
1339
+ return (_a2 = options.find((opt) => opt.value === value)) != null ? _a2 : null;
1212
1340
  }
1213
1341
  }, [value, options, multiple]);
1214
- const displayValue = (0, import_react6.useMemo)(() => {
1215
- var _a;
1342
+ const displayValue = (0, import_react7.useMemo)(() => {
1343
+ var _a2;
1216
1344
  if (multiple) {
1217
1345
  if (!Array.isArray(selected)) return "";
1218
1346
  return selected.map((opt) => opt.label).join(", ");
1219
1347
  } else {
1220
- return (_a = selected == null ? void 0 : selected.label) != null ? _a : "";
1348
+ return (_a2 = selected == null ? void 0 : selected.label) != null ? _a2 : "";
1221
1349
  }
1222
1350
  }, [selected, multiple]);
1223
1351
  const isValueEmpty = !value.trim();
@@ -1232,7 +1360,7 @@ var SearchableSelect = import_react6.default.memo(
1232
1360
  onOpen: () => setOpen(true),
1233
1361
  onClose: () => setOpen(false),
1234
1362
  onChange: (_, newValue) => {
1235
- var _a;
1363
+ var _a2;
1236
1364
  if (multiple) {
1237
1365
  if (Array.isArray(newValue)) {
1238
1366
  let vals = newValue == null ? void 0 : newValue.map((opt) => opt == null ? void 0 : opt.value);
@@ -1243,7 +1371,7 @@ var SearchableSelect = import_react6.default.memo(
1243
1371
  }
1244
1372
  setOpen(true);
1245
1373
  } else {
1246
- onChange((_a = newValue == null ? void 0 : newValue.value) != null ? _a : "");
1374
+ onChange((_a2 = newValue == null ? void 0 : newValue.value) != null ? _a2 : "");
1247
1375
  setOpen(false);
1248
1376
  }
1249
1377
  },
@@ -1371,9 +1499,9 @@ var FormDrawer = ({
1371
1499
  var FormDrawer_default = FormDrawer;
1372
1500
 
1373
1501
  // src/PhoneNumberField.tsx
1374
- var import_react7 = require("react");
1502
+ var import_react8 = require("react");
1375
1503
  var import_material16 = require("@mui/material");
1376
- var import_common_library3 = require("@verma-consulting/common-library");
1504
+ var import_common_library4 = require("@verma-consulting/common-library");
1377
1505
  var import_jsx_runtime18 = require("react/jsx-runtime");
1378
1506
  var PhoneNumberField = ({
1379
1507
  value = "",
@@ -1387,14 +1515,14 @@ var PhoneNumberField = ({
1387
1515
  }) => {
1388
1516
  const theme = (0, import_material16.useTheme)();
1389
1517
  const smMatches = (0, import_material16.useMediaQuery)(theme.breakpoints.down("sm"));
1390
- const countries = import_common_library3.constants.COUNTRIES || [];
1391
- const [country, setCountry] = (0, import_react7.useState)(defaultCountry);
1392
- const [localNumber, setLocalNumber] = (0, import_react7.useState)("");
1393
- const [isFocused, setIsFocused] = (0, import_react7.useState)(false);
1394
- const [selectOpen, setSelectOpen] = (0, import_react7.useState)(false);
1395
- const [ignoreNextOutsideClick, setIgnoreNextOutsideClick] = (0, import_react7.useState)(false);
1396
- const wrapperRef = (0, import_react7.useRef)(null);
1397
- const parseE164 = (0, import_react7.useCallback)(
1518
+ const countries = import_common_library4.constants.COUNTRIES || [];
1519
+ const [country, setCountry] = (0, import_react8.useState)(defaultCountry);
1520
+ const [localNumber, setLocalNumber] = (0, import_react8.useState)("");
1521
+ const [isFocused, setIsFocused] = (0, import_react8.useState)(false);
1522
+ const [selectOpen, setSelectOpen] = (0, import_react8.useState)(false);
1523
+ const [ignoreNextOutsideClick, setIgnoreNextOutsideClick] = (0, import_react8.useState)(false);
1524
+ const wrapperRef = (0, import_react8.useRef)(null);
1525
+ const parseE164 = (0, import_react8.useCallback)(
1398
1526
  (val) => {
1399
1527
  const cleaned = (val || "").toString().replace(/\D/g, "");
1400
1528
  if (!cleaned) return { dial: "", local: "" };
@@ -1411,7 +1539,7 @@ var PhoneNumberField = ({
1411
1539
  },
1412
1540
  [countries]
1413
1541
  );
1414
- (0, import_react7.useEffect)(() => {
1542
+ (0, import_react8.useEffect)(() => {
1415
1543
  if (isFocused) return;
1416
1544
  if (!value) {
1417
1545
  setLocalNumber("");
@@ -1432,10 +1560,10 @@ var PhoneNumberField = ({
1432
1560
  if (cleaned.length > 6) formatted += "-" + cleaned.slice(6, 10);
1433
1561
  return formatted;
1434
1562
  };
1435
- const commitValue = (0, import_react7.useCallback)(() => {
1436
- var _a;
1563
+ const commitValue = (0, import_react8.useCallback)(() => {
1564
+ var _a2;
1437
1565
  const sel = countries.find((c) => c.code === country);
1438
- const dial = (_a = sel == null ? void 0 : sel.phone) != null ? _a : "";
1566
+ const dial = (_a2 = sel == null ? void 0 : sel.phone) != null ? _a2 : "";
1439
1567
  if (dial && localNumber) {
1440
1568
  onChange(`+${dial}${localNumber}`);
1441
1569
  } else {
@@ -1449,7 +1577,7 @@ var PhoneNumberField = ({
1449
1577
  const handleCountryChange = (e) => {
1450
1578
  setCountry(e.target.value);
1451
1579
  };
1452
- (0, import_react7.useEffect)(() => {
1580
+ (0, import_react8.useEffect)(() => {
1453
1581
  const onDocMouseDown = (ev) => {
1454
1582
  if (!wrapperRef.current) return;
1455
1583
  if (wrapperRef.current.contains(ev.target)) return;