@verma-consulting/design-library 0.1.13 → 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/dist/index.mjs CHANGED
@@ -173,7 +173,7 @@ var TabPanel_default = TabPanel;
173
173
 
174
174
  // src/index.tsx
175
175
  import {
176
- useTheme as useTheme7,
176
+ useTheme as useTheme9,
177
177
  styled as styled5,
178
178
  createTheme,
179
179
  ThemeProvider
@@ -620,10 +620,121 @@ var Loader = ({ size = 48, color = "primary" }) => {
620
620
  };
621
621
  var Loader_default = Loader;
622
622
 
623
+ // src/SkeletonBar.tsx
624
+ import { Box as Box4, useTheme as useTheme4 } from "@mui/material";
625
+ import { jsx as jsx9 } from "react/jsx-runtime";
626
+ var SHIMMER_KEYFRAMES = {
627
+ "@keyframes skeletonShimmer": {
628
+ "0%": { backgroundPosition: "200% 0" },
629
+ "100%": { backgroundPosition: "-200% 0" }
630
+ }
631
+ };
632
+ var SkeletonBar = ({
633
+ width = "100%",
634
+ height = 24,
635
+ sx = {}
636
+ }) => {
637
+ var _a, _b, _c, _d, _e, _f, _g, _h;
638
+ const theme = useTheme4();
639
+ 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";
640
+ 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";
641
+ return /* @__PURE__ */ jsx9(
642
+ Box4,
643
+ {
644
+ sx: {
645
+ ...SHIMMER_KEYFRAMES,
646
+ borderRadius: 2,
647
+ height,
648
+ width,
649
+ maxWidth: "100%",
650
+ overflow: "hidden",
651
+ background: `linear-gradient(90deg, ${base} 0%, ${highlight} 20%, ${base} 40%, ${base} 100%)`,
652
+ backgroundSize: "200% 100%",
653
+ animation: "skeletonShimmer 1.4s ease-in-out infinite",
654
+ ...sx
655
+ }
656
+ }
657
+ );
658
+ };
659
+ var SkeletonBar_default = SkeletonBar;
660
+
661
+ // src/EmptyState.tsx
662
+ import React4 from "react";
663
+ import { Box as Box5, Typography as Typography3, useTheme as useTheme5 } from "@mui/material";
664
+ import { StorageOutlined } from "@mui/icons-material";
665
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
666
+ var EmptyState = ({ label, m = 8, icon }) => {
667
+ var _a, _b, _c, _d;
668
+ const theme = useTheme5();
669
+ const text = label != null ? label : "No data here";
670
+ 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)";
671
+ const iconEl = icon != null && React4.isValidElement(icon) ? icon : /* @__PURE__ */ jsx10(
672
+ StorageOutlined,
673
+ {
674
+ sx: {
675
+ fontSize: 72,
676
+ color: iconColor,
677
+ display: "block"
678
+ }
679
+ }
680
+ );
681
+ return /* @__PURE__ */ jsxs6(
682
+ Box5,
683
+ {
684
+ sx: {
685
+ display: "flex",
686
+ flexDirection: "column",
687
+ alignItems: "center",
688
+ justifyContent: "center",
689
+ minHeight: 140,
690
+ m,
691
+ position: "relative"
692
+ },
693
+ children: [
694
+ /* @__PURE__ */ jsx10(
695
+ Box5,
696
+ {
697
+ sx: {
698
+ position: "absolute",
699
+ top: "50%",
700
+ left: "50%",
701
+ transform: "translate(-50%, -50%)",
702
+ pointerEvents: "none",
703
+ display: "flex",
704
+ alignItems: "center",
705
+ justifyContent: "center"
706
+ },
707
+ children: iconEl
708
+ }
709
+ ),
710
+ /* @__PURE__ */ jsx10(
711
+ Typography3,
712
+ {
713
+ variant: "subtitle1",
714
+ align: "center",
715
+ sx: {
716
+ position: "relative",
717
+ zIndex: 1,
718
+ fontWeight: 600,
719
+ fontSize: "1rem",
720
+ letterSpacing: "0.01em",
721
+ color: "text.secondary",
722
+ maxWidth: 360,
723
+ lineHeight: 1.5
724
+ },
725
+ children: text
726
+ }
727
+ )
728
+ ]
729
+ }
730
+ );
731
+ };
732
+ var EmptyState_default = EmptyState;
733
+
623
734
  // src/Pill.tsx
624
- import { Button as Button2, Typography as Typography3, Icon, useTheme as useTheme4 } from "@mui/material";
735
+ import { Button as Button2, Typography as Typography4, Icon, useTheme as useTheme6 } from "@mui/material";
625
736
  import { makeStyles as makeStyles3 } from "@mui/styles";
626
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
737
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
627
738
  var useStyles3 = makeStyles3((theme) => ({
628
739
  button: {
629
740
  padding: "4px 8px 4px 8px",
@@ -647,9 +758,9 @@ var Pill = ({
647
758
  label = "",
648
759
  disabled = false
649
760
  }) => {
650
- const theme = useTheme4();
761
+ const theme = useTheme6();
651
762
  const classes = useStyles3();
652
- return /* @__PURE__ */ jsx9(
763
+ return /* @__PURE__ */ jsx11(
653
764
  Button2,
654
765
  {
655
766
  variant: isSelected ? "contained" : "outlined",
@@ -660,8 +771,8 @@ var Pill = ({
660
771
  textTransform: "none"
661
772
  },
662
773
  onClick,
663
- children: /* @__PURE__ */ jsxs6("div", { style: { display: "flex", alignItems: "center" }, children: [
664
- leftIcon && /* @__PURE__ */ jsx9(
774
+ children: /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center" }, children: [
775
+ leftIcon && /* @__PURE__ */ jsx11(
665
776
  Icon,
666
777
  {
667
778
  className: leftIcon,
@@ -671,8 +782,8 @@ var Pill = ({
671
782
  "data-testid": "pill-left-icon"
672
783
  }
673
784
  ),
674
- /* @__PURE__ */ jsx9(Typography3, { variant: "subtitle", color: "inherit", fontWeight: "bold", children: label }),
675
- rightIcon && /* @__PURE__ */ jsx9(
785
+ /* @__PURE__ */ jsx11(Typography4, { variant: "subtitle", color: "inherit", fontWeight: "bold", children: label }),
786
+ rightIcon && /* @__PURE__ */ jsx11(
676
787
  Icon,
677
788
  {
678
789
  className: rightIcon,
@@ -691,8 +802,8 @@ var Pill_default = Pill;
691
802
  // src/IOSSwitch.tsx
692
803
  import { styled as styled4 } from "@mui/material/styles";
693
804
  import Switch from "@mui/material/Switch";
694
- import { jsx as jsx10 } from "react/jsx-runtime";
695
- var IOSSwitch = styled4((props) => /* @__PURE__ */ jsx10(Switch, { focusVisibleClassName: ".Mui-focusVisible", disableRipple: true, ...props }))(({ theme }) => ({
805
+ import { jsx as jsx12 } from "react/jsx-runtime";
806
+ var IOSSwitch = styled4((props) => /* @__PURE__ */ jsx12(Switch, { focusVisibleClassName: ".Mui-focusVisible", disableRipple: true, ...props }))(({ theme }) => ({
696
807
  width: 46,
697
808
  height: 30,
698
809
  padding: 0,
@@ -742,14 +853,14 @@ var IOSSwitch_default = IOSSwitch;
742
853
  // src/StatusPill.tsx
743
854
  import { Chip } from "@mui/material";
744
855
  import { userStatus } from "@verma-consulting/common-library";
745
- import { jsx as jsx11 } from "react/jsx-runtime";
856
+ import { jsx as jsx13 } from "react/jsx-runtime";
746
857
  var statusColorMap = {
747
858
  [userStatus.Pending]: "warning",
748
859
  [userStatus.Active]: "success",
749
860
  [userStatus.Inactive]: "error",
750
861
  [userStatus.Invited]: "info"
751
862
  };
752
- var StatusPill = ({ status }) => /* @__PURE__ */ jsx11(
863
+ var StatusPill = ({ status }) => /* @__PURE__ */ jsx13(
753
864
  Chip,
754
865
  {
755
866
  label: status,
@@ -764,7 +875,7 @@ var StatusPill_default = StatusPill;
764
875
  import { useState as useState2 } from "react";
765
876
  import { Tooltip as Tooltip2, IconButton as IconButton4, Popover } from "@mui/material";
766
877
  import { MoreHoriz } from "@mui/icons-material";
767
- import { Fragment, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
878
+ import { Fragment, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
768
879
  var FormPopover = ({ row, children, title }) => {
769
880
  const [anchorEl, setAnchorEl] = useState2(null);
770
881
  const handleClick = (event) => {
@@ -774,8 +885,8 @@ var FormPopover = ({ row, children, title }) => {
774
885
  setAnchorEl(null);
775
886
  };
776
887
  const open = Boolean(anchorEl);
777
- return /* @__PURE__ */ jsxs7(Fragment, { children: [
778
- /* @__PURE__ */ jsx12(Tooltip2, { title, children: /* @__PURE__ */ jsx12(
888
+ return /* @__PURE__ */ jsxs8(Fragment, { children: [
889
+ /* @__PURE__ */ jsx14(Tooltip2, { title, children: /* @__PURE__ */ jsx14(
779
890
  IconButton4,
780
891
  {
781
892
  onClick: handleClick,
@@ -790,10 +901,10 @@ var FormPopover = ({ row, children, title }) => {
790
901
  backgroundColor: "#f0f0f0"
791
902
  }
792
903
  },
793
- children: /* @__PURE__ */ jsx12(MoreHoriz, { fontSize: "inherit", color: "primary" })
904
+ children: /* @__PURE__ */ jsx14(MoreHoriz, { fontSize: "inherit", color: "primary" })
794
905
  }
795
906
  ) }),
796
- /* @__PURE__ */ jsx12(
907
+ /* @__PURE__ */ jsx14(
797
908
  Popover,
798
909
  {
799
910
  open,
@@ -811,18 +922,18 @@ var FormPopover = ({ row, children, title }) => {
811
922
  var FormPopover_default = FormPopover;
812
923
 
813
924
  // src/SearchableSelect.tsx
814
- import React5, { useEffect as useEffect2, useRef as useRef2, useState as useState3, useMemo } from "react";
925
+ import React6, { useEffect as useEffect2, useRef as useRef2, useState as useState3, useMemo } from "react";
815
926
  import {
816
927
  Autocomplete,
817
928
  TextField,
818
- Typography as Typography4,
929
+ Typography as Typography5,
819
930
  FormLabel as FormLabel2,
820
931
  FormControl as FormControl2,
821
932
  IconButton as IconButton5
822
933
  } from "@mui/material";
823
934
  import { Clear as Clear2 } from "@mui/icons-material";
824
935
  import { makeStyles as makeStyles4 } from "@mui/styles";
825
- import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
936
+ import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
826
937
  var useStyles4 = makeStyles4(() => ({
827
938
  defaultMode: {
828
939
  padding: "14px 8px",
@@ -841,7 +952,7 @@ var useStyles4 = makeStyles4(() => ({
841
952
  whiteSpace: "pre-wrap"
842
953
  }
843
954
  }));
844
- var SearchableSelect = React5.memo(
955
+ var SearchableSelect = React6.memo(
845
956
  ({
846
957
  name,
847
958
  label,
@@ -909,7 +1020,7 @@ var SearchableSelect = React5.memo(
909
1020
  }
910
1021
  }, [selected, multiple]);
911
1022
  const isValueEmpty = !value.trim();
912
- return editMode ? /* @__PURE__ */ jsx13(FormControl2, { fullWidth: true, style, disabled, size, children: /* @__PURE__ */ jsx13(
1023
+ return editMode ? /* @__PURE__ */ jsx15(FormControl2, { fullWidth: true, style, disabled, size, children: /* @__PURE__ */ jsx15(
913
1024
  Autocomplete,
914
1025
  {
915
1026
  multiple,
@@ -939,7 +1050,7 @@ var SearchableSelect = React5.memo(
939
1050
  autoHighlight: true,
940
1051
  getOptionLabel: (option) => option.label,
941
1052
  isOptionEqualToValue: (option, val) => option.value === val.value,
942
- renderInput: (params) => /* @__PURE__ */ jsx13(
1053
+ renderInput: (params) => /* @__PURE__ */ jsx15(
943
1054
  TextField,
944
1055
  {
945
1056
  ...params,
@@ -949,7 +1060,7 @@ var SearchableSelect = React5.memo(
949
1060
  inputRef,
950
1061
  InputProps: {
951
1062
  ...params.InputProps,
952
- endAdornment: /* @__PURE__ */ jsx13(Fragment2, { children: !isValueEmpty && /* @__PURE__ */ jsx13(
1063
+ endAdornment: /* @__PURE__ */ jsx15(Fragment2, { children: !isValueEmpty && /* @__PURE__ */ jsx15(
953
1064
  IconButton5,
954
1065
  {
955
1066
  "aria-label": `clear ${name}`,
@@ -959,7 +1070,7 @@ var SearchableSelect = React5.memo(
959
1070
  backgroundColor: "transparent",
960
1071
  boxShadow: "none"
961
1072
  },
962
- children: /* @__PURE__ */ jsx13(Clear2, { fontSize: "inherit" })
1073
+ children: /* @__PURE__ */ jsx15(Clear2, { fontSize: "inherit" })
963
1074
  }
964
1075
  ) })
965
1076
  }
@@ -970,7 +1081,7 @@ var SearchableSelect = React5.memo(
970
1081
  setOpen(false);
971
1082
  }
972
1083
  }
973
- ) }) : /* @__PURE__ */ jsxs8(
1084
+ ) }) : /* @__PURE__ */ jsxs9(
974
1085
  "div",
975
1086
  {
976
1087
  ref: wrapperRef,
@@ -983,8 +1094,8 @@ var SearchableSelect = React5.memo(
983
1094
  className: classes.defaultMode,
984
1095
  style,
985
1096
  children: [
986
- /* @__PURE__ */ jsx13(FormLabel2, { className: classes.formLabel, children: label }),
987
- /* @__PURE__ */ jsx13(Typography4, { className: classes.formValue, children: displayValue })
1097
+ /* @__PURE__ */ jsx15(FormLabel2, { className: classes.formLabel, children: label }),
1098
+ /* @__PURE__ */ jsx15(Typography5, { className: classes.formValue, children: displayValue })
988
1099
  ]
989
1100
  }
990
1101
  );
@@ -995,15 +1106,15 @@ var SearchableSelect_default = SearchableSelect;
995
1106
  // src/FormDrawer.tsx
996
1107
  import {
997
1108
  Drawer,
998
- Typography as Typography5,
999
- Box as Box4,
1109
+ Typography as Typography6,
1110
+ Box as Box6,
1000
1111
  IconButton as IconButton6,
1001
1112
  Grid as Grid2,
1002
- useTheme as useTheme5,
1113
+ useTheme as useTheme7,
1003
1114
  useMediaQuery as useMediaQuery3
1004
1115
  } from "@mui/material";
1005
1116
  import { Close as Close2 } from "@mui/icons-material";
1006
- import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
1117
+ import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
1007
1118
  var FormDrawer = ({
1008
1119
  open,
1009
1120
  setOpen,
@@ -1011,9 +1122,9 @@ var FormDrawer = ({
1011
1122
  actions,
1012
1123
  children
1013
1124
  }) => {
1014
- const theme = useTheme5();
1125
+ const theme = useTheme7();
1015
1126
  const mdMatches = useMediaQuery3(theme.breakpoints.down("md"));
1016
- return /* @__PURE__ */ jsxs9(
1127
+ return /* @__PURE__ */ jsxs10(
1017
1128
  Drawer,
1018
1129
  {
1019
1130
  anchor: mdMatches ? "bottom" : "right",
@@ -1029,9 +1140,9 @@ var FormDrawer = ({
1029
1140
  }
1030
1141
  },
1031
1142
  children: [
1032
- /* @__PURE__ */ jsx14(Box4, { p: 3, borderBottom: "1px solid #eee", children: /* @__PURE__ */ jsxs9(Grid2, { container: true, children: [
1033
- /* @__PURE__ */ jsx14(Grid2, { item: true, children: title && /* @__PURE__ */ jsx14(Typography5, { variant: "h6", fontWeight: "bold", children: title }) }),
1034
- /* @__PURE__ */ jsx14(Grid2, { item: true, children: /* @__PURE__ */ jsx14(
1143
+ /* @__PURE__ */ jsx16(Box6, { p: 3, borderBottom: "1px solid #eee", children: /* @__PURE__ */ jsxs10(Grid2, { container: true, children: [
1144
+ /* @__PURE__ */ jsx16(Grid2, { item: true, children: title && /* @__PURE__ */ jsx16(Typography6, { variant: "h6", fontWeight: "bold", children: title }) }),
1145
+ /* @__PURE__ */ jsx16(Grid2, { item: true, children: /* @__PURE__ */ jsx16(
1035
1146
  IconButton6,
1036
1147
  {
1037
1148
  size: "medium",
@@ -1042,13 +1153,13 @@ var FormDrawer = ({
1042
1153
  right: 8,
1043
1154
  zIndex: 2
1044
1155
  },
1045
- children: /* @__PURE__ */ jsx14(Close2, { fontSize: "inherit" })
1156
+ children: /* @__PURE__ */ jsx16(Close2, { fontSize: "inherit" })
1046
1157
  }
1047
1158
  ) })
1048
1159
  ] }) }),
1049
- /* @__PURE__ */ jsx14(Box4, { flex: 1, overflow: "auto", p: 3, children }),
1050
- actions && /* @__PURE__ */ jsx14(
1051
- Box4,
1160
+ /* @__PURE__ */ jsx16(Box6, { flex: 1, overflow: "auto", p: 3, children }),
1161
+ actions && /* @__PURE__ */ jsx16(
1162
+ Box6,
1052
1163
  {
1053
1164
  p: 2,
1054
1165
  borderTop: "1px solid #eee",
@@ -1074,15 +1185,15 @@ import {
1074
1185
  useState as useState4
1075
1186
  } from "react";
1076
1187
  import {
1077
- Box as Box5,
1188
+ Box as Box7,
1078
1189
  Stack,
1079
1190
  TextField as TextField2,
1080
1191
  MenuItem,
1081
- useTheme as useTheme6,
1192
+ useTheme as useTheme8,
1082
1193
  useMediaQuery as useMediaQuery4
1083
1194
  } from "@mui/material";
1084
1195
  import { constants } from "@verma-consulting/common-library";
1085
- import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
1196
+ import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
1086
1197
  var PhoneNumberField = ({
1087
1198
  value = "",
1088
1199
  onChange,
@@ -1093,7 +1204,7 @@ var PhoneNumberField = ({
1093
1204
  autoFocus = false,
1094
1205
  onBlur
1095
1206
  }) => {
1096
- const theme = useTheme6();
1207
+ const theme = useTheme8();
1097
1208
  const smMatches = useMediaQuery4(theme.breakpoints.down("sm"));
1098
1209
  const countries = constants.COUNTRIES || [];
1099
1210
  const [country, setCountry] = useState4(defaultCountry);
@@ -1184,14 +1295,14 @@ var PhoneNumberField = ({
1184
1295
  onBlur == null ? void 0 : onBlur();
1185
1296
  }
1186
1297
  };
1187
- return /* @__PURE__ */ jsx15(
1188
- Box5,
1298
+ return /* @__PURE__ */ jsx17(
1299
+ Box7,
1189
1300
  {
1190
1301
  ref: wrapperRef,
1191
1302
  onFocusCapture: () => setIsFocused(true),
1192
1303
  onBlurCapture: handleWrapperBlur,
1193
1304
  sx: { display: "flex", alignItems: "center", width: "100%" },
1194
- children: /* @__PURE__ */ jsxs10(
1305
+ children: /* @__PURE__ */ jsxs11(
1195
1306
  Stack,
1196
1307
  {
1197
1308
  direction: "row",
@@ -1199,7 +1310,7 @@ var PhoneNumberField = ({
1199
1310
  alignItems: "center",
1200
1311
  sx: { width: "100%" },
1201
1312
  children: [
1202
- /* @__PURE__ */ jsx15(
1313
+ /* @__PURE__ */ jsx17(
1203
1314
  TextField2,
1204
1315
  {
1205
1316
  select: true,
@@ -1226,7 +1337,7 @@ var PhoneNumberField = ({
1226
1337
  },
1227
1338
  onClose: () => setSelectOpen(false)
1228
1339
  },
1229
- children: countries.map((option) => /* @__PURE__ */ jsxs10(MenuItem, { value: option.code, children: [
1340
+ children: countries.map((option) => /* @__PURE__ */ jsxs11(MenuItem, { value: option.code, children: [
1230
1341
  option.code,
1231
1342
  " (+",
1232
1343
  option.phone,
@@ -1234,7 +1345,7 @@ var PhoneNumberField = ({
1234
1345
  ] }, option.code))
1235
1346
  }
1236
1347
  ),
1237
- /* @__PURE__ */ jsx15(
1348
+ /* @__PURE__ */ jsx17(
1238
1349
  TextField2,
1239
1350
  {
1240
1351
  label,
@@ -1267,6 +1378,7 @@ var PhoneNumberField = ({
1267
1378
  var PhoneNumberField_default = PhoneNumberField;
1268
1379
  export {
1269
1380
  ClearableSelect_default as ClearableSelect,
1381
+ EmptyState_default as EmptyState,
1270
1382
  FormDialog_default as FormDialog,
1271
1383
  FormDrawer_default as FormDrawer,
1272
1384
  FormPopover_default as FormPopover,
@@ -1279,12 +1391,13 @@ export {
1279
1391
  PhoneNumberField_default as PhoneNumberField,
1280
1392
  Pill_default as Pill,
1281
1393
  SearchableSelect_default as SearchableSelect,
1394
+ SkeletonBar_default as SkeletonBar,
1282
1395
  StatusPill_default as StatusPill,
1283
1396
  TabPanel_default as TabPanel,
1284
1397
  ThemeProvider,
1285
1398
  createTheme,
1286
1399
  makeStyles5 as makeStyles,
1287
1400
  styled5 as styled,
1288
- useTheme7 as useTheme
1401
+ useTheme9 as useTheme
1289
1402
  };
1290
1403
  //# sourceMappingURL=index.mjs.map