@verma-consulting/design-library 0.1.12 → 0.1.14
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/README.md +2 -0
- package/dist/index.d.mts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +246 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +209 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
var index_exports = {};
|
|
33
33
|
__export(index_exports, {
|
|
34
34
|
ClearableSelect: () => ClearableSelect_default,
|
|
35
|
+
EmptyState: () => EmptyState_default,
|
|
35
36
|
FormDialog: () => FormDialog_default,
|
|
36
37
|
FormDrawer: () => FormDrawer_default,
|
|
37
38
|
FormPopover: () => FormPopover_default,
|
|
@@ -44,6 +45,7 @@ __export(index_exports, {
|
|
|
44
45
|
PhoneNumberField: () => PhoneNumberField_default,
|
|
45
46
|
Pill: () => Pill_default,
|
|
46
47
|
SearchableSelect: () => SearchableSelect_default,
|
|
48
|
+
SkeletonBar: () => SkeletonBar_default,
|
|
47
49
|
StatusPill: () => StatusPill_default,
|
|
48
50
|
TabPanel: () => TabPanel_default,
|
|
49
51
|
ThemeProvider: () => import_styles10.ThemeProvider,
|
|
@@ -203,7 +205,16 @@ var import_material2 = require("@mui/material");
|
|
|
203
205
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
204
206
|
var TabPanel = (props) => {
|
|
205
207
|
const { children, value, index, ...other } = props;
|
|
206
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
role: "tabpanel",
|
|
212
|
+
hidden: value !== index,
|
|
213
|
+
id: `simple-tabpanel-${index}`,
|
|
214
|
+
...other,
|
|
215
|
+
children: value === index && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Box, { sx: { p: 1 }, children })
|
|
216
|
+
}
|
|
217
|
+
);
|
|
207
218
|
};
|
|
208
219
|
var TabPanel_default = TabPanel;
|
|
209
220
|
|
|
@@ -343,21 +354,37 @@ var BootstrapDialog = (0, import_styles2.styled)(import_material4.Dialog)(({ the
|
|
|
343
354
|
}));
|
|
344
355
|
var BootstrapDialogTitle = (props) => {
|
|
345
356
|
const { children, onClose, ...other } = props;
|
|
346
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
358
|
+
import_material4.DialogTitle,
|
|
359
|
+
{
|
|
360
|
+
sx: {
|
|
361
|
+
px: 3,
|
|
362
|
+
py: 3,
|
|
363
|
+
pt: 3.5,
|
|
364
|
+
pb: 2.5,
|
|
365
|
+
fontSize: "1.25rem",
|
|
366
|
+
fontWeight: 600,
|
|
367
|
+
letterSpacing: "0.02em",
|
|
368
|
+
lineHeight: 1.35
|
|
369
|
+
},
|
|
370
|
+
...other,
|
|
371
|
+
children: [
|
|
372
|
+
children,
|
|
373
|
+
onClose ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
374
|
+
import_material4.IconButton,
|
|
375
|
+
{
|
|
376
|
+
onClick: onClose,
|
|
377
|
+
sx: {
|
|
378
|
+
position: "absolute",
|
|
379
|
+
right: 16,
|
|
380
|
+
top: 16
|
|
381
|
+
},
|
|
382
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons_material2.Close, { color: "primary" })
|
|
383
|
+
}
|
|
384
|
+
) : null
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
);
|
|
361
388
|
};
|
|
362
389
|
var FormDialog = ({ open = false, setOpen, title = "", actions, children, maxWidth = "lg", ...props }) => {
|
|
363
390
|
const theme = (0, import_material4.useTheme)();
|
|
@@ -619,10 +646,121 @@ var Loader = ({ size = 48, color = "primary" }) => {
|
|
|
619
646
|
};
|
|
620
647
|
var Loader_default = Loader;
|
|
621
648
|
|
|
622
|
-
// src/
|
|
649
|
+
// src/SkeletonBar.tsx
|
|
623
650
|
var import_material9 = require("@mui/material");
|
|
624
|
-
var import_styles7 = require("@mui/styles");
|
|
625
651
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
652
|
+
var SHIMMER_KEYFRAMES = {
|
|
653
|
+
"@keyframes skeletonShimmer": {
|
|
654
|
+
"0%": { backgroundPosition: "200% 0" },
|
|
655
|
+
"100%": { backgroundPosition: "-200% 0" }
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
var SkeletonBar = ({
|
|
659
|
+
width = "100%",
|
|
660
|
+
height = 24,
|
|
661
|
+
sx = {}
|
|
662
|
+
}) => {
|
|
663
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
664
|
+
const theme = (0, import_material9.useTheme)();
|
|
665
|
+
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";
|
|
666
|
+
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";
|
|
667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
668
|
+
import_material9.Box,
|
|
669
|
+
{
|
|
670
|
+
sx: {
|
|
671
|
+
...SHIMMER_KEYFRAMES,
|
|
672
|
+
borderRadius: 2,
|
|
673
|
+
height,
|
|
674
|
+
width,
|
|
675
|
+
maxWidth: "100%",
|
|
676
|
+
overflow: "hidden",
|
|
677
|
+
background: `linear-gradient(90deg, ${base} 0%, ${highlight} 20%, ${base} 40%, ${base} 100%)`,
|
|
678
|
+
backgroundSize: "200% 100%",
|
|
679
|
+
animation: "skeletonShimmer 1.4s ease-in-out infinite",
|
|
680
|
+
...sx
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
);
|
|
684
|
+
};
|
|
685
|
+
var SkeletonBar_default = SkeletonBar;
|
|
686
|
+
|
|
687
|
+
// src/EmptyState.tsx
|
|
688
|
+
var import_react4 = __toESM(require("react"));
|
|
689
|
+
var import_material10 = require("@mui/material");
|
|
690
|
+
var import_icons_material5 = require("@mui/icons-material");
|
|
691
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
692
|
+
var EmptyState = ({ label, m = 8, icon }) => {
|
|
693
|
+
var _a, _b, _c, _d;
|
|
694
|
+
const theme = (0, import_material10.useTheme)();
|
|
695
|
+
const text = label != null ? label : "No data here";
|
|
696
|
+
const iconColor = theme.palette.mode === "dark" ? (_b = (_a = theme.palette.grey) == null ? void 0 : _a[600]) != null ? _b : "rgba(255,255,255,0.25)" : (_d = (_c = theme.palette.grey) == null ? void 0 : _c[300]) != null ? _d : "rgba(0,0,0,0.18)";
|
|
697
|
+
const iconEl = icon != null && import_react4.default.isValidElement(icon) ? icon : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
698
|
+
import_icons_material5.StorageOutlined,
|
|
699
|
+
{
|
|
700
|
+
sx: {
|
|
701
|
+
fontSize: 72,
|
|
702
|
+
color: iconColor,
|
|
703
|
+
display: "block"
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
);
|
|
707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
708
|
+
import_material10.Box,
|
|
709
|
+
{
|
|
710
|
+
sx: {
|
|
711
|
+
display: "flex",
|
|
712
|
+
flexDirection: "column",
|
|
713
|
+
alignItems: "center",
|
|
714
|
+
justifyContent: "center",
|
|
715
|
+
minHeight: 140,
|
|
716
|
+
m,
|
|
717
|
+
position: "relative"
|
|
718
|
+
},
|
|
719
|
+
children: [
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
721
|
+
import_material10.Box,
|
|
722
|
+
{
|
|
723
|
+
sx: {
|
|
724
|
+
position: "absolute",
|
|
725
|
+
top: "50%",
|
|
726
|
+
left: "50%",
|
|
727
|
+
transform: "translate(-50%, -50%)",
|
|
728
|
+
pointerEvents: "none",
|
|
729
|
+
display: "flex",
|
|
730
|
+
alignItems: "center",
|
|
731
|
+
justifyContent: "center"
|
|
732
|
+
},
|
|
733
|
+
children: iconEl
|
|
734
|
+
}
|
|
735
|
+
),
|
|
736
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
737
|
+
import_material10.Typography,
|
|
738
|
+
{
|
|
739
|
+
variant: "subtitle1",
|
|
740
|
+
align: "center",
|
|
741
|
+
sx: {
|
|
742
|
+
position: "relative",
|
|
743
|
+
zIndex: 1,
|
|
744
|
+
fontWeight: 600,
|
|
745
|
+
fontSize: "1rem",
|
|
746
|
+
letterSpacing: "0.01em",
|
|
747
|
+
color: "text.secondary",
|
|
748
|
+
maxWidth: 360,
|
|
749
|
+
lineHeight: 1.5
|
|
750
|
+
},
|
|
751
|
+
children: text
|
|
752
|
+
}
|
|
753
|
+
)
|
|
754
|
+
]
|
|
755
|
+
}
|
|
756
|
+
);
|
|
757
|
+
};
|
|
758
|
+
var EmptyState_default = EmptyState;
|
|
759
|
+
|
|
760
|
+
// src/Pill.tsx
|
|
761
|
+
var import_material11 = require("@mui/material");
|
|
762
|
+
var import_styles7 = require("@mui/styles");
|
|
763
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
626
764
|
var useStyles3 = (0, import_styles7.makeStyles)((theme) => ({
|
|
627
765
|
button: {
|
|
628
766
|
padding: "4px 8px 4px 8px",
|
|
@@ -646,10 +784,10 @@ var Pill = ({
|
|
|
646
784
|
label = "",
|
|
647
785
|
disabled = false
|
|
648
786
|
}) => {
|
|
649
|
-
const theme = (0,
|
|
787
|
+
const theme = (0, import_material11.useTheme)();
|
|
650
788
|
const classes = useStyles3();
|
|
651
|
-
return /* @__PURE__ */ (0,
|
|
652
|
-
|
|
789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
790
|
+
import_material11.Button,
|
|
653
791
|
{
|
|
654
792
|
variant: isSelected ? "contained" : "outlined",
|
|
655
793
|
color: color || "primary",
|
|
@@ -659,9 +797,9 @@ var Pill = ({
|
|
|
659
797
|
textTransform: "none"
|
|
660
798
|
},
|
|
661
799
|
onClick,
|
|
662
|
-
children: /* @__PURE__ */ (0,
|
|
663
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
664
|
-
|
|
800
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
801
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
802
|
+
import_material11.Icon,
|
|
665
803
|
{
|
|
666
804
|
className: leftIcon,
|
|
667
805
|
fontSize: 14,
|
|
@@ -670,9 +808,9 @@ var Pill = ({
|
|
|
670
808
|
"data-testid": "pill-left-icon"
|
|
671
809
|
}
|
|
672
810
|
),
|
|
673
|
-
/* @__PURE__ */ (0,
|
|
674
|
-
rightIcon && /* @__PURE__ */ (0,
|
|
675
|
-
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material11.Typography, { variant: "subtitle", color: "inherit", fontWeight: "bold", children: label }),
|
|
812
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
813
|
+
import_material11.Icon,
|
|
676
814
|
{
|
|
677
815
|
className: rightIcon,
|
|
678
816
|
fontSize: 14,
|
|
@@ -690,8 +828,8 @@ var Pill_default = Pill;
|
|
|
690
828
|
// src/IOSSwitch.tsx
|
|
691
829
|
var import_styles8 = require("@mui/material/styles");
|
|
692
830
|
var import_Switch = __toESM(require("@mui/material/Switch"));
|
|
693
|
-
var
|
|
694
|
-
var IOSSwitch = (0, import_styles8.styled)((props) => /* @__PURE__ */ (0,
|
|
831
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
832
|
+
var IOSSwitch = (0, import_styles8.styled)((props) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Switch.default, { focusVisibleClassName: ".Mui-focusVisible", disableRipple: true, ...props }))(({ theme }) => ({
|
|
695
833
|
width: 46,
|
|
696
834
|
height: 30,
|
|
697
835
|
padding: 0,
|
|
@@ -739,17 +877,17 @@ var IOSSwitch = (0, import_styles8.styled)((props) => /* @__PURE__ */ (0, import
|
|
|
739
877
|
var IOSSwitch_default = IOSSwitch;
|
|
740
878
|
|
|
741
879
|
// src/StatusPill.tsx
|
|
742
|
-
var
|
|
880
|
+
var import_material12 = require("@mui/material");
|
|
743
881
|
var import_common_library3 = require("@verma-consulting/common-library");
|
|
744
|
-
var
|
|
882
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
745
883
|
var statusColorMap = {
|
|
746
884
|
[import_common_library3.userStatus.Pending]: "warning",
|
|
747
885
|
[import_common_library3.userStatus.Active]: "success",
|
|
748
886
|
[import_common_library3.userStatus.Inactive]: "error",
|
|
749
887
|
[import_common_library3.userStatus.Invited]: "info"
|
|
750
888
|
};
|
|
751
|
-
var StatusPill = ({ status }) => /* @__PURE__ */ (0,
|
|
752
|
-
|
|
889
|
+
var StatusPill = ({ status }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
890
|
+
import_material12.Chip,
|
|
753
891
|
{
|
|
754
892
|
label: status,
|
|
755
893
|
color: statusColorMap[status],
|
|
@@ -760,12 +898,12 @@ var StatusPill = ({ status }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
|
760
898
|
var StatusPill_default = StatusPill;
|
|
761
899
|
|
|
762
900
|
// src/FormPopover.tsx
|
|
763
|
-
var
|
|
764
|
-
var
|
|
765
|
-
var
|
|
766
|
-
var
|
|
901
|
+
var import_react5 = require("react");
|
|
902
|
+
var import_material13 = require("@mui/material");
|
|
903
|
+
var import_icons_material6 = require("@mui/icons-material");
|
|
904
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
767
905
|
var FormPopover = ({ row, children, title }) => {
|
|
768
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
906
|
+
const [anchorEl, setAnchorEl] = (0, import_react5.useState)(null);
|
|
769
907
|
const handleClick = (event) => {
|
|
770
908
|
setAnchorEl(event.currentTarget);
|
|
771
909
|
};
|
|
@@ -773,9 +911,9 @@ var FormPopover = ({ row, children, title }) => {
|
|
|
773
911
|
setAnchorEl(null);
|
|
774
912
|
};
|
|
775
913
|
const open = Boolean(anchorEl);
|
|
776
|
-
return /* @__PURE__ */ (0,
|
|
777
|
-
/* @__PURE__ */ (0,
|
|
778
|
-
|
|
914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
915
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material13.Tooltip, { title, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
916
|
+
import_material13.IconButton,
|
|
779
917
|
{
|
|
780
918
|
onClick: handleClick,
|
|
781
919
|
size: "small",
|
|
@@ -789,11 +927,11 @@ var FormPopover = ({ row, children, title }) => {
|
|
|
789
927
|
backgroundColor: "#f0f0f0"
|
|
790
928
|
}
|
|
791
929
|
},
|
|
792
|
-
children: /* @__PURE__ */ (0,
|
|
930
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons_material6.MoreHoriz, { fontSize: "inherit", color: "primary" })
|
|
793
931
|
}
|
|
794
932
|
) }),
|
|
795
|
-
/* @__PURE__ */ (0,
|
|
796
|
-
|
|
933
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
934
|
+
import_material13.Popover,
|
|
797
935
|
{
|
|
798
936
|
open,
|
|
799
937
|
anchorEl,
|
|
@@ -810,11 +948,11 @@ var FormPopover = ({ row, children, title }) => {
|
|
|
810
948
|
var FormPopover_default = FormPopover;
|
|
811
949
|
|
|
812
950
|
// src/SearchableSelect.tsx
|
|
813
|
-
var
|
|
814
|
-
var
|
|
815
|
-
var
|
|
951
|
+
var import_react6 = __toESM(require("react"));
|
|
952
|
+
var import_material14 = require("@mui/material");
|
|
953
|
+
var import_icons_material7 = require("@mui/icons-material");
|
|
816
954
|
var import_styles9 = require("@mui/styles");
|
|
817
|
-
var
|
|
955
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
818
956
|
var useStyles4 = (0, import_styles9.makeStyles)(() => ({
|
|
819
957
|
defaultMode: {
|
|
820
958
|
padding: "14px 8px",
|
|
@@ -833,7 +971,7 @@ var useStyles4 = (0, import_styles9.makeStyles)(() => ({
|
|
|
833
971
|
whiteSpace: "pre-wrap"
|
|
834
972
|
}
|
|
835
973
|
}));
|
|
836
|
-
var SearchableSelect =
|
|
974
|
+
var SearchableSelect = import_react6.default.memo(
|
|
837
975
|
({
|
|
838
976
|
name,
|
|
839
977
|
label,
|
|
@@ -848,11 +986,11 @@ var SearchableSelect = import_react5.default.memo(
|
|
|
848
986
|
multiple = false
|
|
849
987
|
}) => {
|
|
850
988
|
const classes = useStyles4();
|
|
851
|
-
const wrapperRef = (0,
|
|
852
|
-
const inputRef = (0,
|
|
853
|
-
const [editMode, setEditMode] = (0,
|
|
854
|
-
const [open, setOpen] = (0,
|
|
855
|
-
(0,
|
|
989
|
+
const wrapperRef = (0, import_react6.useRef)(null);
|
|
990
|
+
const inputRef = (0, import_react6.useRef)(null);
|
|
991
|
+
const [editMode, setEditMode] = (0, import_react6.useState)(defaultEditMode);
|
|
992
|
+
const [open, setOpen] = (0, import_react6.useState)(defaultEditMode);
|
|
993
|
+
(0, import_react6.useEffect)(() => {
|
|
856
994
|
function handleClickOutside(event) {
|
|
857
995
|
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
|
|
858
996
|
setEditMode(false);
|
|
@@ -866,7 +1004,7 @@ var SearchableSelect = import_react5.default.memo(
|
|
|
866
1004
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
867
1005
|
};
|
|
868
1006
|
}, [editMode]);
|
|
869
|
-
(0,
|
|
1007
|
+
(0, import_react6.useEffect)(() => {
|
|
870
1008
|
if (editMode && open && inputRef.current) {
|
|
871
1009
|
inputRef.current.focus();
|
|
872
1010
|
}
|
|
@@ -881,7 +1019,7 @@ var SearchableSelect = import_react5.default.memo(
|
|
|
881
1019
|
setEditMode(false);
|
|
882
1020
|
setOpen(false);
|
|
883
1021
|
};
|
|
884
|
-
const selected = (0,
|
|
1022
|
+
const selected = (0, import_react6.useMemo)(() => {
|
|
885
1023
|
var _a;
|
|
886
1024
|
if (multiple) {
|
|
887
1025
|
if (!value.trim()) return [];
|
|
@@ -891,7 +1029,7 @@ var SearchableSelect = import_react5.default.memo(
|
|
|
891
1029
|
return (_a = options.find((opt) => opt.value === value)) != null ? _a : null;
|
|
892
1030
|
}
|
|
893
1031
|
}, [value, options, multiple]);
|
|
894
|
-
const displayValue = (0,
|
|
1032
|
+
const displayValue = (0, import_react6.useMemo)(() => {
|
|
895
1033
|
var _a;
|
|
896
1034
|
if (multiple) {
|
|
897
1035
|
if (!Array.isArray(selected)) return "";
|
|
@@ -901,8 +1039,8 @@ var SearchableSelect = import_react5.default.memo(
|
|
|
901
1039
|
}
|
|
902
1040
|
}, [selected, multiple]);
|
|
903
1041
|
const isValueEmpty = !value.trim();
|
|
904
|
-
return editMode ? /* @__PURE__ */ (0,
|
|
905
|
-
|
|
1042
|
+
return editMode ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material14.FormControl, { fullWidth: true, style, disabled, size, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1043
|
+
import_material14.Autocomplete,
|
|
906
1044
|
{
|
|
907
1045
|
multiple,
|
|
908
1046
|
disableCloseOnSelect: multiple,
|
|
@@ -931,8 +1069,8 @@ var SearchableSelect = import_react5.default.memo(
|
|
|
931
1069
|
autoHighlight: true,
|
|
932
1070
|
getOptionLabel: (option) => option.label,
|
|
933
1071
|
isOptionEqualToValue: (option, val) => option.value === val.value,
|
|
934
|
-
renderInput: (params) => /* @__PURE__ */ (0,
|
|
935
|
-
|
|
1072
|
+
renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1073
|
+
import_material14.TextField,
|
|
936
1074
|
{
|
|
937
1075
|
...params,
|
|
938
1076
|
label,
|
|
@@ -941,8 +1079,8 @@ var SearchableSelect = import_react5.default.memo(
|
|
|
941
1079
|
inputRef,
|
|
942
1080
|
InputProps: {
|
|
943
1081
|
...params.InputProps,
|
|
944
|
-
endAdornment: /* @__PURE__ */ (0,
|
|
945
|
-
|
|
1082
|
+
endAdornment: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: !isValueEmpty && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1083
|
+
import_material14.IconButton,
|
|
946
1084
|
{
|
|
947
1085
|
"aria-label": `clear ${name}`,
|
|
948
1086
|
onClick: handleClear,
|
|
@@ -951,7 +1089,7 @@ var SearchableSelect = import_react5.default.memo(
|
|
|
951
1089
|
backgroundColor: "transparent",
|
|
952
1090
|
boxShadow: "none"
|
|
953
1091
|
},
|
|
954
|
-
children: /* @__PURE__ */ (0,
|
|
1092
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons_material7.Clear, { fontSize: "inherit" })
|
|
955
1093
|
}
|
|
956
1094
|
) })
|
|
957
1095
|
}
|
|
@@ -962,7 +1100,7 @@ var SearchableSelect = import_react5.default.memo(
|
|
|
962
1100
|
setOpen(false);
|
|
963
1101
|
}
|
|
964
1102
|
}
|
|
965
|
-
) }) : /* @__PURE__ */ (0,
|
|
1103
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
966
1104
|
"div",
|
|
967
1105
|
{
|
|
968
1106
|
ref: wrapperRef,
|
|
@@ -975,8 +1113,8 @@ var SearchableSelect = import_react5.default.memo(
|
|
|
975
1113
|
className: classes.defaultMode,
|
|
976
1114
|
style,
|
|
977
1115
|
children: [
|
|
978
|
-
/* @__PURE__ */ (0,
|
|
979
|
-
/* @__PURE__ */ (0,
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material14.FormLabel, { className: classes.formLabel, children: label }),
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material14.Typography, { className: classes.formValue, children: displayValue })
|
|
980
1118
|
]
|
|
981
1119
|
}
|
|
982
1120
|
);
|
|
@@ -985,9 +1123,9 @@ var SearchableSelect = import_react5.default.memo(
|
|
|
985
1123
|
var SearchableSelect_default = SearchableSelect;
|
|
986
1124
|
|
|
987
1125
|
// src/FormDrawer.tsx
|
|
988
|
-
var
|
|
989
|
-
var
|
|
990
|
-
var
|
|
1126
|
+
var import_material15 = require("@mui/material");
|
|
1127
|
+
var import_icons_material8 = require("@mui/icons-material");
|
|
1128
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
991
1129
|
var FormDrawer = ({
|
|
992
1130
|
open,
|
|
993
1131
|
setOpen,
|
|
@@ -995,10 +1133,10 @@ var FormDrawer = ({
|
|
|
995
1133
|
actions,
|
|
996
1134
|
children
|
|
997
1135
|
}) => {
|
|
998
|
-
const theme = (0,
|
|
999
|
-
const mdMatches = (0,
|
|
1000
|
-
return /* @__PURE__ */ (0,
|
|
1001
|
-
|
|
1136
|
+
const theme = (0, import_material15.useTheme)();
|
|
1137
|
+
const mdMatches = (0, import_material15.useMediaQuery)(theme.breakpoints.down("md"));
|
|
1138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1139
|
+
import_material15.Drawer,
|
|
1002
1140
|
{
|
|
1003
1141
|
anchor: mdMatches ? "bottom" : "right",
|
|
1004
1142
|
open,
|
|
@@ -1013,10 +1151,10 @@ var FormDrawer = ({
|
|
|
1013
1151
|
}
|
|
1014
1152
|
},
|
|
1015
1153
|
children: [
|
|
1016
|
-
/* @__PURE__ */ (0,
|
|
1017
|
-
/* @__PURE__ */ (0,
|
|
1018
|
-
/* @__PURE__ */ (0,
|
|
1019
|
-
|
|
1154
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material15.Box, { p: 3, borderBottom: "1px solid #eee", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material15.Grid, { container: true, children: [
|
|
1155
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material15.Grid, { item: true, children: title && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material15.Typography, { variant: "h6", fontWeight: "bold", children: title }) }),
|
|
1156
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material15.Grid, { item: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1157
|
+
import_material15.IconButton,
|
|
1020
1158
|
{
|
|
1021
1159
|
size: "medium",
|
|
1022
1160
|
onClick: () => setOpen(false),
|
|
@@ -1026,13 +1164,13 @@ var FormDrawer = ({
|
|
|
1026
1164
|
right: 8,
|
|
1027
1165
|
zIndex: 2
|
|
1028
1166
|
},
|
|
1029
|
-
children: /* @__PURE__ */ (0,
|
|
1167
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons_material8.Close, { fontSize: "inherit" })
|
|
1030
1168
|
}
|
|
1031
1169
|
) })
|
|
1032
1170
|
] }) }),
|
|
1033
|
-
/* @__PURE__ */ (0,
|
|
1034
|
-
actions && /* @__PURE__ */ (0,
|
|
1035
|
-
|
|
1171
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material15.Box, { flex: 1, overflow: "auto", p: 3, children }),
|
|
1172
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1173
|
+
import_material15.Box,
|
|
1036
1174
|
{
|
|
1037
1175
|
p: 2,
|
|
1038
1176
|
borderTop: "1px solid #eee",
|
|
@@ -1051,10 +1189,10 @@ var FormDrawer = ({
|
|
|
1051
1189
|
var FormDrawer_default = FormDrawer;
|
|
1052
1190
|
|
|
1053
1191
|
// src/PhoneNumberField.tsx
|
|
1054
|
-
var
|
|
1055
|
-
var
|
|
1192
|
+
var import_react7 = require("react");
|
|
1193
|
+
var import_material16 = require("@mui/material");
|
|
1056
1194
|
var import_common_library4 = require("@verma-consulting/common-library");
|
|
1057
|
-
var
|
|
1195
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1058
1196
|
var PhoneNumberField = ({
|
|
1059
1197
|
value = "",
|
|
1060
1198
|
onChange,
|
|
@@ -1065,16 +1203,16 @@ var PhoneNumberField = ({
|
|
|
1065
1203
|
autoFocus = false,
|
|
1066
1204
|
onBlur
|
|
1067
1205
|
}) => {
|
|
1068
|
-
const theme = (0,
|
|
1069
|
-
const smMatches = (0,
|
|
1206
|
+
const theme = (0, import_material16.useTheme)();
|
|
1207
|
+
const smMatches = (0, import_material16.useMediaQuery)(theme.breakpoints.down("sm"));
|
|
1070
1208
|
const countries = import_common_library4.constants.COUNTRIES || [];
|
|
1071
|
-
const [country, setCountry] = (0,
|
|
1072
|
-
const [localNumber, setLocalNumber] = (0,
|
|
1073
|
-
const [isFocused, setIsFocused] = (0,
|
|
1074
|
-
const [selectOpen, setSelectOpen] = (0,
|
|
1075
|
-
const [ignoreNextOutsideClick, setIgnoreNextOutsideClick] = (0,
|
|
1076
|
-
const wrapperRef = (0,
|
|
1077
|
-
const parseE164 = (0,
|
|
1209
|
+
const [country, setCountry] = (0, import_react7.useState)(defaultCountry);
|
|
1210
|
+
const [localNumber, setLocalNumber] = (0, import_react7.useState)("");
|
|
1211
|
+
const [isFocused, setIsFocused] = (0, import_react7.useState)(false);
|
|
1212
|
+
const [selectOpen, setSelectOpen] = (0, import_react7.useState)(false);
|
|
1213
|
+
const [ignoreNextOutsideClick, setIgnoreNextOutsideClick] = (0, import_react7.useState)(false);
|
|
1214
|
+
const wrapperRef = (0, import_react7.useRef)(null);
|
|
1215
|
+
const parseE164 = (0, import_react7.useCallback)(
|
|
1078
1216
|
(val) => {
|
|
1079
1217
|
const cleaned = (val || "").toString().replace(/\D/g, "");
|
|
1080
1218
|
if (!cleaned) return { dial: "", local: "" };
|
|
@@ -1091,7 +1229,7 @@ var PhoneNumberField = ({
|
|
|
1091
1229
|
},
|
|
1092
1230
|
[countries]
|
|
1093
1231
|
);
|
|
1094
|
-
(0,
|
|
1232
|
+
(0, import_react7.useEffect)(() => {
|
|
1095
1233
|
if (isFocused) return;
|
|
1096
1234
|
if (!value) {
|
|
1097
1235
|
setLocalNumber("");
|
|
@@ -1112,7 +1250,7 @@ var PhoneNumberField = ({
|
|
|
1112
1250
|
if (cleaned.length > 6) formatted += "-" + cleaned.slice(6, 10);
|
|
1113
1251
|
return formatted;
|
|
1114
1252
|
};
|
|
1115
|
-
const commitValue = (0,
|
|
1253
|
+
const commitValue = (0, import_react7.useCallback)(() => {
|
|
1116
1254
|
var _a;
|
|
1117
1255
|
const sel = countries.find((c) => c.code === country);
|
|
1118
1256
|
const dial = (_a = sel == null ? void 0 : sel.phone) != null ? _a : "";
|
|
@@ -1129,7 +1267,7 @@ var PhoneNumberField = ({
|
|
|
1129
1267
|
const handleCountryChange = (e) => {
|
|
1130
1268
|
setCountry(e.target.value);
|
|
1131
1269
|
};
|
|
1132
|
-
(0,
|
|
1270
|
+
(0, import_react7.useEffect)(() => {
|
|
1133
1271
|
const onDocMouseDown = (ev) => {
|
|
1134
1272
|
if (!wrapperRef.current) return;
|
|
1135
1273
|
if (wrapperRef.current.contains(ev.target)) return;
|
|
@@ -1156,23 +1294,23 @@ var PhoneNumberField = ({
|
|
|
1156
1294
|
onBlur == null ? void 0 : onBlur();
|
|
1157
1295
|
}
|
|
1158
1296
|
};
|
|
1159
|
-
return /* @__PURE__ */ (0,
|
|
1160
|
-
|
|
1297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1298
|
+
import_material16.Box,
|
|
1161
1299
|
{
|
|
1162
1300
|
ref: wrapperRef,
|
|
1163
1301
|
onFocusCapture: () => setIsFocused(true),
|
|
1164
1302
|
onBlurCapture: handleWrapperBlur,
|
|
1165
1303
|
sx: { display: "flex", alignItems: "center", width: "100%" },
|
|
1166
|
-
children: /* @__PURE__ */ (0,
|
|
1167
|
-
|
|
1304
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1305
|
+
import_material16.Stack,
|
|
1168
1306
|
{
|
|
1169
1307
|
direction: "row",
|
|
1170
1308
|
spacing: 0,
|
|
1171
1309
|
alignItems: "center",
|
|
1172
1310
|
sx: { width: "100%" },
|
|
1173
1311
|
children: [
|
|
1174
|
-
/* @__PURE__ */ (0,
|
|
1175
|
-
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1313
|
+
import_material16.TextField,
|
|
1176
1314
|
{
|
|
1177
1315
|
select: true,
|
|
1178
1316
|
value: country,
|
|
@@ -1198,7 +1336,7 @@ var PhoneNumberField = ({
|
|
|
1198
1336
|
},
|
|
1199
1337
|
onClose: () => setSelectOpen(false)
|
|
1200
1338
|
},
|
|
1201
|
-
children: countries.map((option) => /* @__PURE__ */ (0,
|
|
1339
|
+
children: countries.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material16.MenuItem, { value: option.code, children: [
|
|
1202
1340
|
option.code,
|
|
1203
1341
|
" (+",
|
|
1204
1342
|
option.phone,
|
|
@@ -1206,8 +1344,8 @@ var PhoneNumberField = ({
|
|
|
1206
1344
|
] }, option.code))
|
|
1207
1345
|
}
|
|
1208
1346
|
),
|
|
1209
|
-
/* @__PURE__ */ (0,
|
|
1210
|
-
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1348
|
+
import_material16.TextField,
|
|
1211
1349
|
{
|
|
1212
1350
|
label,
|
|
1213
1351
|
value: localNumber ? formatLocalNumber(localNumber) : "",
|
|
@@ -1240,6 +1378,7 @@ var PhoneNumberField_default = PhoneNumberField;
|
|
|
1240
1378
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1241
1379
|
0 && (module.exports = {
|
|
1242
1380
|
ClearableSelect,
|
|
1381
|
+
EmptyState,
|
|
1243
1382
|
FormDialog,
|
|
1244
1383
|
FormDrawer,
|
|
1245
1384
|
FormPopover,
|
|
@@ -1252,6 +1391,7 @@ var PhoneNumberField_default = PhoneNumberField;
|
|
|
1252
1391
|
PhoneNumberField,
|
|
1253
1392
|
Pill,
|
|
1254
1393
|
SearchableSelect,
|
|
1394
|
+
SkeletonBar,
|
|
1255
1395
|
StatusPill,
|
|
1256
1396
|
TabPanel,
|
|
1257
1397
|
ThemeProvider,
|