@verma-consulting/design-library 0.1.27 → 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 +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +229 -100
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +230 -97
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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: () =>
|
|
53
|
-
createTheme: () =>
|
|
54
|
-
makeStyles: () =>
|
|
55
|
-
styled: () =>
|
|
56
|
-
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);
|
|
@@ -298,7 +298,8 @@ var rootSx = {
|
|
|
298
298
|
},
|
|
299
299
|
[`& .${import_tablePaginationClasses.default.displayedRows}`]: {
|
|
300
300
|
typography: "body2",
|
|
301
|
-
|
|
301
|
+
fontWeight: 600,
|
|
302
|
+
color: "text.primary",
|
|
302
303
|
fontVariantNumeric: "tabular-nums",
|
|
303
304
|
m: 0,
|
|
304
305
|
whiteSpace: "nowrap"
|
|
@@ -308,8 +309,8 @@ var rootSx = {
|
|
|
308
309
|
marginRight: 0
|
|
309
310
|
},
|
|
310
311
|
[`& .${import_tablePaginationClasses.default.actions}`]: {
|
|
311
|
-
|
|
312
|
-
gap:
|
|
312
|
+
mx: 1,
|
|
313
|
+
gap: 1,
|
|
313
314
|
display: "flex",
|
|
314
315
|
alignItems: "center",
|
|
315
316
|
[`& .MuiIconButton-root`]: {
|
|
@@ -327,7 +328,7 @@ var rootSx = {
|
|
|
327
328
|
}
|
|
328
329
|
};
|
|
329
330
|
var TablePagination = React2.forwardRef(function TablePagination2(props, ref) {
|
|
330
|
-
var
|
|
331
|
+
var _a2, _b;
|
|
331
332
|
const {
|
|
332
333
|
sx,
|
|
333
334
|
slotProps,
|
|
@@ -341,7 +342,7 @@ var TablePagination = React2.forwardRef(function TablePagination2(props, ref) {
|
|
|
341
342
|
displayedRangeLabel,
|
|
342
343
|
...other
|
|
343
344
|
} = props;
|
|
344
|
-
const labelRowsPerPageResolved = (
|
|
345
|
+
const labelRowsPerPageResolved = (_a2 = labelRowsPerPageProp != null ? labelRowsPerPageProp : rowsPerPageLabel) != null ? _a2 : DEFAULT_ROWS_PER_PAGE_LABEL;
|
|
345
346
|
const labelDisplayedRowsResolved = (_b = labelDisplayedRowsProp != null ? labelDisplayedRowsProp : displayedRangeLabel) != null ? _b : defaultDisplayedRangeLabel;
|
|
346
347
|
const slotSelect = slotProps == null ? void 0 : slotProps.select;
|
|
347
348
|
const { sx: slotSelectSx, ...slotSelectRest } = slotSelect != null ? slotSelect : {};
|
|
@@ -397,8 +398,8 @@ var TablePagination = React2.forwardRef(function TablePagination2(props, ref) {
|
|
|
397
398
|
var TablePagination_default = TablePagination;
|
|
398
399
|
|
|
399
400
|
// src/index.tsx
|
|
400
|
-
var
|
|
401
|
-
var
|
|
401
|
+
var import_styles11 = require("@mui/material/styles");
|
|
402
|
+
var import_styles12 = require("@mui/styles");
|
|
402
403
|
|
|
403
404
|
// src/Logo.tsx
|
|
404
405
|
var import_react2 = require("react");
|
|
@@ -413,12 +414,12 @@ var Logo = (0, import_react2.memo)(
|
|
|
413
414
|
handleClick = () => null,
|
|
414
415
|
companyComponent = null
|
|
415
416
|
}) => {
|
|
416
|
-
var
|
|
417
|
+
var _a2;
|
|
417
418
|
const theme = (0, import_material3.useTheme)();
|
|
418
419
|
const mdMatches = (0, import_material3.useMediaQuery)(theme.breakpoints.down("md"));
|
|
419
420
|
const maxWidth = mdMatches ? 160 : 320;
|
|
420
421
|
const companyName = (organization == null ? void 0 : organization.name) || "\u2013";
|
|
421
|
-
const logoUrl = (
|
|
422
|
+
const logoUrl = (_a2 = organization == null ? void 0 : organization.logo) == null ? void 0 : _a2.url;
|
|
422
423
|
if (centered) {
|
|
423
424
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
424
425
|
import_material3.Grid,
|
|
@@ -720,8 +721,8 @@ var ImageUploadAvatar = ({
|
|
|
720
721
|
};
|
|
721
722
|
}, [internalSrc]);
|
|
722
723
|
const handlePick = (e) => {
|
|
723
|
-
var
|
|
724
|
-
const selected = (_b = (
|
|
724
|
+
var _a2, _b;
|
|
725
|
+
const selected = (_b = (_a2 = e.target.files) == null ? void 0 : _a2[0]) != null ? _b : null;
|
|
725
726
|
if (internalSrc == null ? void 0 : internalSrc.startsWith("blob:")) {
|
|
726
727
|
URL.revokeObjectURL(internalSrc);
|
|
727
728
|
}
|
|
@@ -736,8 +737,8 @@ var ImageUploadAvatar = ({
|
|
|
736
737
|
onChange == null ? void 0 : onChange(selected, preview);
|
|
737
738
|
};
|
|
738
739
|
const triggerPick = () => {
|
|
739
|
-
var
|
|
740
|
-
if (!disabled) (
|
|
740
|
+
var _a2;
|
|
741
|
+
if (!disabled) (_a2 = inputRef.current) == null ? void 0 : _a2.click();
|
|
741
742
|
};
|
|
742
743
|
const handleClear = (e) => {
|
|
743
744
|
e.stopPropagation();
|
|
@@ -768,44 +769,172 @@ var ImageUploadAvatar = ({
|
|
|
768
769
|
var ImageUploadAvatar_default = ImageUploadAvatar;
|
|
769
770
|
|
|
770
771
|
// src/FormSnackBar.tsx
|
|
772
|
+
var import_react4 = require("react");
|
|
771
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");
|
|
772
777
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
773
|
-
var
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
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
|
+
};
|
|
843
|
+
}
|
|
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
|
+
};
|
|
777
860
|
}
|
|
778
|
-
return {
|
|
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
|
+
};
|
|
779
867
|
};
|
|
780
868
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
781
|
-
|
|
869
|
+
"div",
|
|
782
870
|
{
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
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
|
+
})
|
|
809
938
|
}
|
|
810
939
|
);
|
|
811
940
|
};
|
|
@@ -813,9 +942,9 @@ var FormSnackBar_default = FormSnackBar;
|
|
|
813
942
|
|
|
814
943
|
// src/Loader.tsx
|
|
815
944
|
var import_material8 = require("@mui/material");
|
|
816
|
-
var
|
|
945
|
+
var import_styles7 = require("@mui/styles");
|
|
817
946
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
818
|
-
var useStyles2 = (0,
|
|
947
|
+
var useStyles2 = (0, import_styles7.makeStyles)({
|
|
819
948
|
"@keyframes pulse": {
|
|
820
949
|
"0%": { transform: "scale(1)", opacity: 0.9 },
|
|
821
950
|
"50%": { transform: "scale(1.05)", opacity: 1 },
|
|
@@ -856,9 +985,9 @@ var SkeletonBar = ({
|
|
|
856
985
|
height = 24,
|
|
857
986
|
sx = {}
|
|
858
987
|
}) => {
|
|
859
|
-
var
|
|
988
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
860
989
|
const theme = (0, import_material9.useTheme)();
|
|
861
|
-
const base = theme.palette.mode === "dark" ? (_b = (
|
|
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";
|
|
862
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";
|
|
863
992
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
864
993
|
import_material9.Box,
|
|
@@ -881,7 +1010,7 @@ var SkeletonBar = ({
|
|
|
881
1010
|
var SkeletonBar_default = SkeletonBar;
|
|
882
1011
|
|
|
883
1012
|
// src/EmptyState.tsx
|
|
884
|
-
var
|
|
1013
|
+
var import_react5 = __toESM(require("react"));
|
|
885
1014
|
var import_material10 = require("@mui/material");
|
|
886
1015
|
var import_icons_material5 = require("@mui/icons-material");
|
|
887
1016
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
@@ -890,7 +1019,7 @@ var EmptyState = ({ label, m = 8, icon }) => {
|
|
|
890
1019
|
const text = label != null ? label : "No data created yet";
|
|
891
1020
|
const iconColor = theme.palette.mode === "dark" ? "rgba(255,255,255,0.42)" : "rgba(0,0,0,0.42)";
|
|
892
1021
|
const labelColor = theme.palette.mode === "dark" ? "rgba(255,255,255,0.50)" : "rgba(0,0,0,0.38)";
|
|
893
|
-
const iconEl = icon != null &&
|
|
1022
|
+
const iconEl = icon != null && import_react5.default.isValidElement(icon) ? icon : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
894
1023
|
import_icons_material5.DatasetOutlined,
|
|
895
1024
|
{
|
|
896
1025
|
sx: {
|
|
@@ -940,9 +1069,9 @@ var EmptyState_default = EmptyState;
|
|
|
940
1069
|
|
|
941
1070
|
// src/Pill.tsx
|
|
942
1071
|
var import_material11 = require("@mui/material");
|
|
943
|
-
var
|
|
1072
|
+
var import_styles8 = require("@mui/styles");
|
|
944
1073
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
945
|
-
var useStyles3 = (0,
|
|
1074
|
+
var useStyles3 = (0, import_styles8.makeStyles)((theme) => ({
|
|
946
1075
|
button: {
|
|
947
1076
|
padding: "4px 8px 4px 8px",
|
|
948
1077
|
color: "black",
|
|
@@ -1007,10 +1136,10 @@ var Pill = ({
|
|
|
1007
1136
|
var Pill_default = Pill;
|
|
1008
1137
|
|
|
1009
1138
|
// src/IOSSwitch.tsx
|
|
1010
|
-
var
|
|
1139
|
+
var import_styles9 = require("@mui/material/styles");
|
|
1011
1140
|
var import_Switch = __toESM(require("@mui/material/Switch"));
|
|
1012
1141
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1013
|
-
var IOSSwitch = (0,
|
|
1142
|
+
var IOSSwitch = (0, import_styles9.styled)((props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Switch.default, { focusVisibleClassName: ".Mui-focusVisible", disableRipple: true, ...props }))(({ theme }) => ({
|
|
1014
1143
|
width: 46,
|
|
1015
1144
|
height: 30,
|
|
1016
1145
|
padding: 0,
|
|
@@ -1059,13 +1188,13 @@ var IOSSwitch_default = IOSSwitch;
|
|
|
1059
1188
|
|
|
1060
1189
|
// src/StatusPill.tsx
|
|
1061
1190
|
var import_material12 = require("@mui/material");
|
|
1062
|
-
var
|
|
1191
|
+
var import_common_library3 = require("@verma-consulting/common-library");
|
|
1063
1192
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1064
1193
|
var statusColorMap = {
|
|
1065
|
-
[
|
|
1066
|
-
[
|
|
1067
|
-
[
|
|
1068
|
-
[
|
|
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"
|
|
1069
1198
|
};
|
|
1070
1199
|
var StatusPill = ({ status }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1071
1200
|
import_material12.Chip,
|
|
@@ -1079,12 +1208,12 @@ var StatusPill = ({ status }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
|
1079
1208
|
var StatusPill_default = StatusPill;
|
|
1080
1209
|
|
|
1081
1210
|
// src/FormPopover.tsx
|
|
1082
|
-
var
|
|
1211
|
+
var import_react6 = require("react");
|
|
1083
1212
|
var import_material13 = require("@mui/material");
|
|
1084
1213
|
var import_icons_material6 = require("@mui/icons-material");
|
|
1085
1214
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1086
1215
|
var FormPopover = ({ row, children, title }) => {
|
|
1087
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
1216
|
+
const [anchorEl, setAnchorEl] = (0, import_react6.useState)(null);
|
|
1088
1217
|
const handleClick = (event) => {
|
|
1089
1218
|
setAnchorEl(event.currentTarget);
|
|
1090
1219
|
};
|
|
@@ -1129,12 +1258,12 @@ var FormPopover = ({ row, children, title }) => {
|
|
|
1129
1258
|
var FormPopover_default = FormPopover;
|
|
1130
1259
|
|
|
1131
1260
|
// src/SearchableSelect.tsx
|
|
1132
|
-
var
|
|
1261
|
+
var import_react7 = __toESM(require("react"));
|
|
1133
1262
|
var import_material14 = require("@mui/material");
|
|
1134
1263
|
var import_icons_material7 = require("@mui/icons-material");
|
|
1135
|
-
var
|
|
1264
|
+
var import_styles10 = require("@mui/styles");
|
|
1136
1265
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1137
|
-
var useStyles4 = (0,
|
|
1266
|
+
var useStyles4 = (0, import_styles10.makeStyles)(() => ({
|
|
1138
1267
|
defaultMode: {
|
|
1139
1268
|
padding: "14px 8px",
|
|
1140
1269
|
cursor: "pointer",
|
|
@@ -1152,7 +1281,7 @@ var useStyles4 = (0, import_styles9.makeStyles)(() => ({
|
|
|
1152
1281
|
whiteSpace: "pre-wrap"
|
|
1153
1282
|
}
|
|
1154
1283
|
}));
|
|
1155
|
-
var SearchableSelect =
|
|
1284
|
+
var SearchableSelect = import_react7.default.memo(
|
|
1156
1285
|
({
|
|
1157
1286
|
name,
|
|
1158
1287
|
label,
|
|
@@ -1167,11 +1296,11 @@ var SearchableSelect = import_react6.default.memo(
|
|
|
1167
1296
|
multiple = false
|
|
1168
1297
|
}) => {
|
|
1169
1298
|
const classes = useStyles4();
|
|
1170
|
-
const wrapperRef = (0,
|
|
1171
|
-
const inputRef = (0,
|
|
1172
|
-
const [editMode, setEditMode] = (0,
|
|
1173
|
-
const [open, setOpen] = (0,
|
|
1174
|
-
(0,
|
|
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)(() => {
|
|
1175
1304
|
function handleClickOutside(event) {
|
|
1176
1305
|
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
|
|
1177
1306
|
setEditMode(false);
|
|
@@ -1185,7 +1314,7 @@ var SearchableSelect = import_react6.default.memo(
|
|
|
1185
1314
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
1186
1315
|
};
|
|
1187
1316
|
}, [editMode]);
|
|
1188
|
-
(0,
|
|
1317
|
+
(0, import_react7.useEffect)(() => {
|
|
1189
1318
|
if (editMode && open && inputRef.current) {
|
|
1190
1319
|
inputRef.current.focus();
|
|
1191
1320
|
}
|
|
@@ -1200,23 +1329,23 @@ var SearchableSelect = import_react6.default.memo(
|
|
|
1200
1329
|
setEditMode(false);
|
|
1201
1330
|
setOpen(false);
|
|
1202
1331
|
};
|
|
1203
|
-
const selected = (0,
|
|
1204
|
-
var
|
|
1332
|
+
const selected = (0, import_react7.useMemo)(() => {
|
|
1333
|
+
var _a2;
|
|
1205
1334
|
if (multiple) {
|
|
1206
1335
|
if (!value.trim()) return [];
|
|
1207
1336
|
const selectedValues = value.split(", ").map((v) => v.trim());
|
|
1208
1337
|
return options.filter((opt) => selectedValues.includes(opt.value));
|
|
1209
1338
|
} else {
|
|
1210
|
-
return (
|
|
1339
|
+
return (_a2 = options.find((opt) => opt.value === value)) != null ? _a2 : null;
|
|
1211
1340
|
}
|
|
1212
1341
|
}, [value, options, multiple]);
|
|
1213
|
-
const displayValue = (0,
|
|
1214
|
-
var
|
|
1342
|
+
const displayValue = (0, import_react7.useMemo)(() => {
|
|
1343
|
+
var _a2;
|
|
1215
1344
|
if (multiple) {
|
|
1216
1345
|
if (!Array.isArray(selected)) return "";
|
|
1217
1346
|
return selected.map((opt) => opt.label).join(", ");
|
|
1218
1347
|
} else {
|
|
1219
|
-
return (
|
|
1348
|
+
return (_a2 = selected == null ? void 0 : selected.label) != null ? _a2 : "";
|
|
1220
1349
|
}
|
|
1221
1350
|
}, [selected, multiple]);
|
|
1222
1351
|
const isValueEmpty = !value.trim();
|
|
@@ -1231,7 +1360,7 @@ var SearchableSelect = import_react6.default.memo(
|
|
|
1231
1360
|
onOpen: () => setOpen(true),
|
|
1232
1361
|
onClose: () => setOpen(false),
|
|
1233
1362
|
onChange: (_, newValue) => {
|
|
1234
|
-
var
|
|
1363
|
+
var _a2;
|
|
1235
1364
|
if (multiple) {
|
|
1236
1365
|
if (Array.isArray(newValue)) {
|
|
1237
1366
|
let vals = newValue == null ? void 0 : newValue.map((opt) => opt == null ? void 0 : opt.value);
|
|
@@ -1242,7 +1371,7 @@ var SearchableSelect = import_react6.default.memo(
|
|
|
1242
1371
|
}
|
|
1243
1372
|
setOpen(true);
|
|
1244
1373
|
} else {
|
|
1245
|
-
onChange((
|
|
1374
|
+
onChange((_a2 = newValue == null ? void 0 : newValue.value) != null ? _a2 : "");
|
|
1246
1375
|
setOpen(false);
|
|
1247
1376
|
}
|
|
1248
1377
|
},
|
|
@@ -1370,9 +1499,9 @@ var FormDrawer = ({
|
|
|
1370
1499
|
var FormDrawer_default = FormDrawer;
|
|
1371
1500
|
|
|
1372
1501
|
// src/PhoneNumberField.tsx
|
|
1373
|
-
var
|
|
1502
|
+
var import_react8 = require("react");
|
|
1374
1503
|
var import_material16 = require("@mui/material");
|
|
1375
|
-
var
|
|
1504
|
+
var import_common_library4 = require("@verma-consulting/common-library");
|
|
1376
1505
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1377
1506
|
var PhoneNumberField = ({
|
|
1378
1507
|
value = "",
|
|
@@ -1386,14 +1515,14 @@ var PhoneNumberField = ({
|
|
|
1386
1515
|
}) => {
|
|
1387
1516
|
const theme = (0, import_material16.useTheme)();
|
|
1388
1517
|
const smMatches = (0, import_material16.useMediaQuery)(theme.breakpoints.down("sm"));
|
|
1389
|
-
const countries =
|
|
1390
|
-
const [country, setCountry] = (0,
|
|
1391
|
-
const [localNumber, setLocalNumber] = (0,
|
|
1392
|
-
const [isFocused, setIsFocused] = (0,
|
|
1393
|
-
const [selectOpen, setSelectOpen] = (0,
|
|
1394
|
-
const [ignoreNextOutsideClick, setIgnoreNextOutsideClick] = (0,
|
|
1395
|
-
const wrapperRef = (0,
|
|
1396
|
-
const parseE164 = (0,
|
|
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)(
|
|
1397
1526
|
(val) => {
|
|
1398
1527
|
const cleaned = (val || "").toString().replace(/\D/g, "");
|
|
1399
1528
|
if (!cleaned) return { dial: "", local: "" };
|
|
@@ -1410,7 +1539,7 @@ var PhoneNumberField = ({
|
|
|
1410
1539
|
},
|
|
1411
1540
|
[countries]
|
|
1412
1541
|
);
|
|
1413
|
-
(0,
|
|
1542
|
+
(0, import_react8.useEffect)(() => {
|
|
1414
1543
|
if (isFocused) return;
|
|
1415
1544
|
if (!value) {
|
|
1416
1545
|
setLocalNumber("");
|
|
@@ -1431,10 +1560,10 @@ var PhoneNumberField = ({
|
|
|
1431
1560
|
if (cleaned.length > 6) formatted += "-" + cleaned.slice(6, 10);
|
|
1432
1561
|
return formatted;
|
|
1433
1562
|
};
|
|
1434
|
-
const commitValue = (0,
|
|
1435
|
-
var
|
|
1563
|
+
const commitValue = (0, import_react8.useCallback)(() => {
|
|
1564
|
+
var _a2;
|
|
1436
1565
|
const sel = countries.find((c) => c.code === country);
|
|
1437
|
-
const dial = (
|
|
1566
|
+
const dial = (_a2 = sel == null ? void 0 : sel.phone) != null ? _a2 : "";
|
|
1438
1567
|
if (dial && localNumber) {
|
|
1439
1568
|
onChange(`+${dial}${localNumber}`);
|
|
1440
1569
|
} else {
|
|
@@ -1448,7 +1577,7 @@ var PhoneNumberField = ({
|
|
|
1448
1577
|
const handleCountryChange = (e) => {
|
|
1449
1578
|
setCountry(e.target.value);
|
|
1450
1579
|
};
|
|
1451
|
-
(0,
|
|
1580
|
+
(0, import_react8.useEffect)(() => {
|
|
1452
1581
|
const onDocMouseDown = (ev) => {
|
|
1453
1582
|
if (!wrapperRef.current) return;
|
|
1454
1583
|
if (wrapperRef.current.contains(ev.target)) return;
|