@verma-consulting/design-library 0.1.28 → 0.1.30

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,147 @@ 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
- }
779
- return {};
778
+ var _a;
779
+ var SNACKBAR_TYPES = (_a = import_common_library2.constants) == null ? void 0 : _a.SNACKBAR_TYPES;
780
+ var DULL_SNACKBAR_COLORS = {
781
+ success: "#6B8E6B",
782
+ warning: "#C97B4B",
783
+ // dull orange soda
784
+ info: "#4A5E8A",
785
+ error: "#9B4444"
786
+ };
787
+ function isSnackbarType(val) {
788
+ if (typeof val !== "string") return false;
789
+ if (!SNACKBAR_TYPES) {
790
+ return ["success", "error", "warning", "info"].includes(
791
+ val
792
+ );
793
+ }
794
+ const values = Object.values(SNACKBAR_TYPES);
795
+ return values.includes(val);
796
+ }
797
+ var FormSnackBar = ({
798
+ snackBar = {},
799
+ setSnackBar = () => null,
800
+ autoHideDuration = 3500
801
+ }) => {
802
+ var _a2, _b;
803
+ const theme = (0, import_styles6.useTheme)();
804
+ const [queue, setQueue] = (0, import_react4.useState)([]);
805
+ const idRef = (0, import_react4.useRef)(0);
806
+ const prevOpenRef = (0, import_react4.useRef)(!!(snackBar == null ? void 0 : snackBar.open));
807
+ const prevSignatureRef = (0, import_react4.useRef)("");
808
+ const timersRef = (0, import_react4.useRef)(
809
+ {}
810
+ );
811
+ const type = (_a2 = snackBar.type) != null ? _a2 : "";
812
+ const message = (_b = snackBar.message) != null ? _b : "";
813
+ const severity = isSnackbarType(type) ? type : "info";
814
+ const enqueueFromProp = () => {
815
+ if (!(snackBar == null ? void 0 : snackBar.open)) return;
816
+ if (!message) return;
817
+ const signature = `${type}::${message}`;
818
+ const openRose = !prevOpenRef.current && !!(snackBar == null ? void 0 : snackBar.open);
819
+ const signatureChanged = signature !== prevSignatureRef.current;
820
+ if (!openRose && !signatureChanged) return;
821
+ prevSignatureRef.current = signature;
822
+ const id = String(++idRef.current);
823
+ setQueue((q) => [...q, { id, type, message }]);
824
+ timersRef.current[id] = setTimeout(() => {
825
+ setQueue((q) => q.filter((item) => item.id !== id));
826
+ delete timersRef.current[id];
827
+ }, autoHideDuration);
828
+ setSnackBar({ open: false, message: "", type: "" });
829
+ };
830
+ (0, import_react4.useEffect)(() => {
831
+ const nextOpen = !!(snackBar == null ? void 0 : snackBar.open);
832
+ enqueueFromProp();
833
+ prevOpenRef.current = nextOpen;
834
+ }, [snackBar == null ? void 0 : snackBar.open, snackBar == null ? void 0 : snackBar.message, snackBar == null ? void 0 : snackBar.type]);
835
+ const handleDismiss = (id) => {
836
+ const t = timersRef.current[id];
837
+ if (t) clearTimeout(t);
838
+ delete timersRef.current[id];
839
+ setQueue((q) => q.filter((item) => item.id !== id));
840
+ };
841
+ (0, import_react4.useEffect)(() => {
842
+ return () => {
843
+ Object.values(timersRef.current).forEach((t) => clearTimeout(t));
844
+ timersRef.current = {};
845
+ };
846
+ }, []);
847
+ const typeStyles = (severity2) => {
848
+ const baseHex = severity2 === "success" ? DULL_SNACKBAR_COLORS.success : severity2 === "error" ? DULL_SNACKBAR_COLORS.error : severity2 === "warning" ? DULL_SNACKBAR_COLORS.warning : DULL_SNACKBAR_COLORS.info;
849
+ return {
850
+ bg: theme.palette.mode === "dark" ? (0, import_styles6.alpha)(baseHex, 0.26) : (0, import_styles6.alpha)(baseHex, 0.14),
851
+ text: theme.palette.mode === "dark" ? "rgba(255,255,255,0.92)" : baseHex,
852
+ icon: baseHex
853
+ };
780
854
  };
781
855
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
782
- import_material7.Snackbar,
856
+ "div",
783
857
  {
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
- )
858
+ "aria-live": "polite",
859
+ "aria-atomic": "true",
860
+ style: {
861
+ position: "fixed",
862
+ top: 12,
863
+ right: 12,
864
+ zIndex: 1400,
865
+ display: "flex",
866
+ flexDirection: "column",
867
+ gap: 8,
868
+ width: "min(420px, calc(100vw - 24px))",
869
+ pointerEvents: "none"
870
+ },
871
+ children: queue.map((item) => {
872
+ const localSeverity = isSnackbarType(item.type) ? item.type : "info";
873
+ const colors = typeStyles(localSeverity);
874
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material7.Grow, { in: true, timeout: 280, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
875
+ import_material7.Alert,
876
+ {
877
+ variant: "filled",
878
+ severity: localSeverity,
879
+ sx: {
880
+ width: "100%",
881
+ pointerEvents: "auto",
882
+ borderRadius: 3,
883
+ px: { xs: 1.25, sm: 1.5 },
884
+ py: 0.875,
885
+ alignItems: "center",
886
+ boxShadow: 2,
887
+ backgroundColor: colors.bg,
888
+ color: colors.text,
889
+ "& .MuiAlert-icon": {
890
+ color: colors.icon
891
+ },
892
+ "& .MuiAlert-message": {
893
+ m: 0,
894
+ p: 0,
895
+ fontWeight: 600,
896
+ letterSpacing: "-0.01em"
897
+ }
898
+ },
899
+ action: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
900
+ import_material7.IconButton,
901
+ {
902
+ "aria-label": "close",
903
+ color: "inherit",
904
+ size: "small",
905
+ onClick: () => handleDismiss(item.id),
906
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_Close.default, { fontSize: "small" })
907
+ }
908
+ ),
909
+ children: item.message
910
+ }
911
+ ) }, item.id);
912
+ })
810
913
  }
811
914
  );
812
915
  };
@@ -814,9 +917,9 @@ var FormSnackBar_default = FormSnackBar;
814
917
 
815
918
  // src/Loader.tsx
816
919
  var import_material8 = require("@mui/material");
817
- var import_styles6 = require("@mui/styles");
920
+ var import_styles7 = require("@mui/styles");
818
921
  var import_jsx_runtime9 = require("react/jsx-runtime");
819
- var useStyles2 = (0, import_styles6.makeStyles)({
922
+ var useStyles2 = (0, import_styles7.makeStyles)({
820
923
  "@keyframes pulse": {
821
924
  "0%": { transform: "scale(1)", opacity: 0.9 },
822
925
  "50%": { transform: "scale(1.05)", opacity: 1 },
@@ -857,9 +960,9 @@ var SkeletonBar = ({
857
960
  height = 24,
858
961
  sx = {}
859
962
  }) => {
860
- var _a, _b, _c, _d, _e, _f, _g, _h;
963
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
861
964
  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";
965
+ 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
966
  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
967
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
865
968
  import_material9.Box,
@@ -882,7 +985,7 @@ var SkeletonBar = ({
882
985
  var SkeletonBar_default = SkeletonBar;
883
986
 
884
987
  // src/EmptyState.tsx
885
- var import_react4 = __toESM(require("react"));
988
+ var import_react5 = __toESM(require("react"));
886
989
  var import_material10 = require("@mui/material");
887
990
  var import_icons_material5 = require("@mui/icons-material");
888
991
  var import_jsx_runtime11 = require("react/jsx-runtime");
@@ -891,7 +994,7 @@ var EmptyState = ({ label, m = 8, icon }) => {
891
994
  const text = label != null ? label : "No data created yet";
892
995
  const iconColor = theme.palette.mode === "dark" ? "rgba(255,255,255,0.42)" : "rgba(0,0,0,0.42)";
893
996
  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)(
997
+ const iconEl = icon != null && import_react5.default.isValidElement(icon) ? icon : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
895
998
  import_icons_material5.DatasetOutlined,
896
999
  {
897
1000
  sx: {
@@ -941,9 +1044,9 @@ var EmptyState_default = EmptyState;
941
1044
 
942
1045
  // src/Pill.tsx
943
1046
  var import_material11 = require("@mui/material");
944
- var import_styles7 = require("@mui/styles");
1047
+ var import_styles8 = require("@mui/styles");
945
1048
  var import_jsx_runtime12 = require("react/jsx-runtime");
946
- var useStyles3 = (0, import_styles7.makeStyles)((theme) => ({
1049
+ var useStyles3 = (0, import_styles8.makeStyles)((theme) => ({
947
1050
  button: {
948
1051
  padding: "4px 8px 4px 8px",
949
1052
  color: "black",
@@ -1008,10 +1111,10 @@ var Pill = ({
1008
1111
  var Pill_default = Pill;
1009
1112
 
1010
1113
  // src/IOSSwitch.tsx
1011
- var import_styles8 = require("@mui/material/styles");
1114
+ var import_styles9 = require("@mui/material/styles");
1012
1115
  var import_Switch = __toESM(require("@mui/material/Switch"));
1013
1116
  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 }) => ({
1117
+ var IOSSwitch = (0, import_styles9.styled)((props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Switch.default, { focusVisibleClassName: ".Mui-focusVisible", disableRipple: true, ...props }))(({ theme }) => ({
1015
1118
  width: 46,
1016
1119
  height: 30,
1017
1120
  padding: 0,
@@ -1060,13 +1163,13 @@ var IOSSwitch_default = IOSSwitch;
1060
1163
 
1061
1164
  // src/StatusPill.tsx
1062
1165
  var import_material12 = require("@mui/material");
1063
- var import_common_library2 = require("@verma-consulting/common-library");
1166
+ var import_common_library3 = require("@verma-consulting/common-library");
1064
1167
  var import_jsx_runtime14 = require("react/jsx-runtime");
1065
1168
  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"
1169
+ [import_common_library3.userStatus.Pending]: "warning",
1170
+ [import_common_library3.userStatus.Active]: "success",
1171
+ [import_common_library3.userStatus.Inactive]: "error",
1172
+ [import_common_library3.userStatus.Invited]: "info"
1070
1173
  };
1071
1174
  var StatusPill = ({ status }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1072
1175
  import_material12.Chip,
@@ -1080,12 +1183,12 @@ var StatusPill = ({ status }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1080
1183
  var StatusPill_default = StatusPill;
1081
1184
 
1082
1185
  // src/FormPopover.tsx
1083
- var import_react5 = require("react");
1186
+ var import_react6 = require("react");
1084
1187
  var import_material13 = require("@mui/material");
1085
1188
  var import_icons_material6 = require("@mui/icons-material");
1086
1189
  var import_jsx_runtime15 = require("react/jsx-runtime");
1087
1190
  var FormPopover = ({ row, children, title }) => {
1088
- const [anchorEl, setAnchorEl] = (0, import_react5.useState)(null);
1191
+ const [anchorEl, setAnchorEl] = (0, import_react6.useState)(null);
1089
1192
  const handleClick = (event) => {
1090
1193
  setAnchorEl(event.currentTarget);
1091
1194
  };
@@ -1130,12 +1233,12 @@ var FormPopover = ({ row, children, title }) => {
1130
1233
  var FormPopover_default = FormPopover;
1131
1234
 
1132
1235
  // src/SearchableSelect.tsx
1133
- var import_react6 = __toESM(require("react"));
1236
+ var import_react7 = __toESM(require("react"));
1134
1237
  var import_material14 = require("@mui/material");
1135
1238
  var import_icons_material7 = require("@mui/icons-material");
1136
- var import_styles9 = require("@mui/styles");
1239
+ var import_styles10 = require("@mui/styles");
1137
1240
  var import_jsx_runtime16 = require("react/jsx-runtime");
1138
- var useStyles4 = (0, import_styles9.makeStyles)(() => ({
1241
+ var useStyles4 = (0, import_styles10.makeStyles)(() => ({
1139
1242
  defaultMode: {
1140
1243
  padding: "14px 8px",
1141
1244
  cursor: "pointer",
@@ -1153,7 +1256,7 @@ var useStyles4 = (0, import_styles9.makeStyles)(() => ({
1153
1256
  whiteSpace: "pre-wrap"
1154
1257
  }
1155
1258
  }));
1156
- var SearchableSelect = import_react6.default.memo(
1259
+ var SearchableSelect = import_react7.default.memo(
1157
1260
  ({
1158
1261
  name,
1159
1262
  label,
@@ -1168,11 +1271,11 @@ var SearchableSelect = import_react6.default.memo(
1168
1271
  multiple = false
1169
1272
  }) => {
1170
1273
  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)(() => {
1274
+ const wrapperRef = (0, import_react7.useRef)(null);
1275
+ const inputRef = (0, import_react7.useRef)(null);
1276
+ const [editMode, setEditMode] = (0, import_react7.useState)(defaultEditMode);
1277
+ const [open, setOpen] = (0, import_react7.useState)(defaultEditMode);
1278
+ (0, import_react7.useEffect)(() => {
1176
1279
  function handleClickOutside(event) {
1177
1280
  if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
1178
1281
  setEditMode(false);
@@ -1186,7 +1289,7 @@ var SearchableSelect = import_react6.default.memo(
1186
1289
  document.removeEventListener("mousedown", handleClickOutside);
1187
1290
  };
1188
1291
  }, [editMode]);
1189
- (0, import_react6.useEffect)(() => {
1292
+ (0, import_react7.useEffect)(() => {
1190
1293
  if (editMode && open && inputRef.current) {
1191
1294
  inputRef.current.focus();
1192
1295
  }
@@ -1201,23 +1304,23 @@ var SearchableSelect = import_react6.default.memo(
1201
1304
  setEditMode(false);
1202
1305
  setOpen(false);
1203
1306
  };
1204
- const selected = (0, import_react6.useMemo)(() => {
1205
- var _a;
1307
+ const selected = (0, import_react7.useMemo)(() => {
1308
+ var _a2;
1206
1309
  if (multiple) {
1207
1310
  if (!value.trim()) return [];
1208
1311
  const selectedValues = value.split(", ").map((v) => v.trim());
1209
1312
  return options.filter((opt) => selectedValues.includes(opt.value));
1210
1313
  } else {
1211
- return (_a = options.find((opt) => opt.value === value)) != null ? _a : null;
1314
+ return (_a2 = options.find((opt) => opt.value === value)) != null ? _a2 : null;
1212
1315
  }
1213
1316
  }, [value, options, multiple]);
1214
- const displayValue = (0, import_react6.useMemo)(() => {
1215
- var _a;
1317
+ const displayValue = (0, import_react7.useMemo)(() => {
1318
+ var _a2;
1216
1319
  if (multiple) {
1217
1320
  if (!Array.isArray(selected)) return "";
1218
1321
  return selected.map((opt) => opt.label).join(", ");
1219
1322
  } else {
1220
- return (_a = selected == null ? void 0 : selected.label) != null ? _a : "";
1323
+ return (_a2 = selected == null ? void 0 : selected.label) != null ? _a2 : "";
1221
1324
  }
1222
1325
  }, [selected, multiple]);
1223
1326
  const isValueEmpty = !value.trim();
@@ -1232,7 +1335,7 @@ var SearchableSelect = import_react6.default.memo(
1232
1335
  onOpen: () => setOpen(true),
1233
1336
  onClose: () => setOpen(false),
1234
1337
  onChange: (_, newValue) => {
1235
- var _a;
1338
+ var _a2;
1236
1339
  if (multiple) {
1237
1340
  if (Array.isArray(newValue)) {
1238
1341
  let vals = newValue == null ? void 0 : newValue.map((opt) => opt == null ? void 0 : opt.value);
@@ -1243,7 +1346,7 @@ var SearchableSelect = import_react6.default.memo(
1243
1346
  }
1244
1347
  setOpen(true);
1245
1348
  } else {
1246
- onChange((_a = newValue == null ? void 0 : newValue.value) != null ? _a : "");
1349
+ onChange((_a2 = newValue == null ? void 0 : newValue.value) != null ? _a2 : "");
1247
1350
  setOpen(false);
1248
1351
  }
1249
1352
  },
@@ -1371,9 +1474,9 @@ var FormDrawer = ({
1371
1474
  var FormDrawer_default = FormDrawer;
1372
1475
 
1373
1476
  // src/PhoneNumberField.tsx
1374
- var import_react7 = require("react");
1477
+ var import_react8 = require("react");
1375
1478
  var import_material16 = require("@mui/material");
1376
- var import_common_library3 = require("@verma-consulting/common-library");
1479
+ var import_common_library4 = require("@verma-consulting/common-library");
1377
1480
  var import_jsx_runtime18 = require("react/jsx-runtime");
1378
1481
  var PhoneNumberField = ({
1379
1482
  value = "",
@@ -1387,14 +1490,14 @@ var PhoneNumberField = ({
1387
1490
  }) => {
1388
1491
  const theme = (0, import_material16.useTheme)();
1389
1492
  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)(
1493
+ const countries = import_common_library4.constants.COUNTRIES || [];
1494
+ const [country, setCountry] = (0, import_react8.useState)(defaultCountry);
1495
+ const [localNumber, setLocalNumber] = (0, import_react8.useState)("");
1496
+ const [isFocused, setIsFocused] = (0, import_react8.useState)(false);
1497
+ const [selectOpen, setSelectOpen] = (0, import_react8.useState)(false);
1498
+ const [ignoreNextOutsideClick, setIgnoreNextOutsideClick] = (0, import_react8.useState)(false);
1499
+ const wrapperRef = (0, import_react8.useRef)(null);
1500
+ const parseE164 = (0, import_react8.useCallback)(
1398
1501
  (val) => {
1399
1502
  const cleaned = (val || "").toString().replace(/\D/g, "");
1400
1503
  if (!cleaned) return { dial: "", local: "" };
@@ -1411,7 +1514,7 @@ var PhoneNumberField = ({
1411
1514
  },
1412
1515
  [countries]
1413
1516
  );
1414
- (0, import_react7.useEffect)(() => {
1517
+ (0, import_react8.useEffect)(() => {
1415
1518
  if (isFocused) return;
1416
1519
  if (!value) {
1417
1520
  setLocalNumber("");
@@ -1432,10 +1535,10 @@ var PhoneNumberField = ({
1432
1535
  if (cleaned.length > 6) formatted += "-" + cleaned.slice(6, 10);
1433
1536
  return formatted;
1434
1537
  };
1435
- const commitValue = (0, import_react7.useCallback)(() => {
1436
- var _a;
1538
+ const commitValue = (0, import_react8.useCallback)(() => {
1539
+ var _a2;
1437
1540
  const sel = countries.find((c) => c.code === country);
1438
- const dial = (_a = sel == null ? void 0 : sel.phone) != null ? _a : "";
1541
+ const dial = (_a2 = sel == null ? void 0 : sel.phone) != null ? _a2 : "";
1439
1542
  if (dial && localNumber) {
1440
1543
  onChange(`+${dial}${localNumber}`);
1441
1544
  } else {
@@ -1449,7 +1552,7 @@ var PhoneNumberField = ({
1449
1552
  const handleCountryChange = (e) => {
1450
1553
  setCountry(e.target.value);
1451
1554
  };
1452
- (0, import_react7.useEffect)(() => {
1555
+ (0, import_react8.useEffect)(() => {
1453
1556
  const onDocMouseDown = (ev) => {
1454
1557
  if (!wrapperRef.current) return;
1455
1558
  if (wrapperRef.current.contains(ev.target)) return;