@verma-consulting/design-library 0.1.53 → 0.1.55

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
@@ -1084,14 +1084,45 @@ var EmptyState = ({ label, m = 8, icon }) => {
1084
1084
  var EmptyState_default = EmptyState;
1085
1085
 
1086
1086
  // src/Pill.tsx
1087
- import { Button, Typography as Typography4, Icon } from "@mui/material";
1087
+ import { Box as Box7, Button, Icon, Typography as Typography4 } from "@mui/material";
1088
1088
  import { alpha as alpha8, useTheme as useTheme7 } from "@mui/material/styles";
1089
1089
  import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1090
+ function renderIconSlot(node, side) {
1091
+ if (node == null) return null;
1092
+ const spacing = side === "left" ? { pr: 1 } : { ml: 1 };
1093
+ if (typeof node === "string") {
1094
+ return /* @__PURE__ */ jsx11(
1095
+ Icon,
1096
+ {
1097
+ baseClassName: "material-icons",
1098
+ fontSize: "small",
1099
+ color: "inherit",
1100
+ sx: spacing,
1101
+ "data-testid": side === "left" ? "pill-left-icon" : "pill-right-icon",
1102
+ children: node
1103
+ }
1104
+ );
1105
+ }
1106
+ return /* @__PURE__ */ jsx11(
1107
+ Box7,
1108
+ {
1109
+ component: "span",
1110
+ sx: {
1111
+ display: "inline-flex",
1112
+ alignItems: "center",
1113
+ color: "inherit",
1114
+ ...spacing
1115
+ },
1116
+ "data-testid": side === "left" ? "pill-left-icon" : "pill-right-icon",
1117
+ children: node
1118
+ }
1119
+ );
1120
+ }
1090
1121
  var Pill = ({
1091
- variant = "filter",
1122
+ variant: _variant = "filter",
1092
1123
  leftIcon = null,
1093
1124
  rightIcon = null,
1094
- color = null,
1125
+ color,
1095
1126
  isSelected = false,
1096
1127
  onClick = () => null,
1097
1128
  label = "",
@@ -1102,7 +1133,7 @@ var Pill = ({
1102
1133
  Button,
1103
1134
  {
1104
1135
  variant: isSelected ? "contained" : "outlined",
1105
- color: color || "primary",
1136
+ color: color != null ? color : "primary",
1106
1137
  sx: {
1107
1138
  ...glassSurface(theme),
1108
1139
  borderRadius: 16,
@@ -1119,27 +1150,9 @@ var Pill = ({
1119
1150
  onClick,
1120
1151
  disabled,
1121
1152
  children: /* @__PURE__ */ jsxs6("div", { style: { display: "flex", alignItems: "center" }, children: [
1122
- leftIcon && /* @__PURE__ */ jsx11(
1123
- Icon,
1124
- {
1125
- className: leftIcon,
1126
- fontSize: 14,
1127
- color: "inherit",
1128
- style: { paddingRight: 8 },
1129
- "data-testid": "pill-left-icon"
1130
- }
1131
- ),
1153
+ renderIconSlot(leftIcon, "left"),
1132
1154
  /* @__PURE__ */ jsx11(Typography4, { variant: "subtitle2", color: "inherit", fontWeight: 700, children: label }),
1133
- rightIcon && /* @__PURE__ */ jsx11(
1134
- Icon,
1135
- {
1136
- className: rightIcon,
1137
- fontSize: 14,
1138
- color: "inherit",
1139
- style: { marginLeft: 8 },
1140
- "data-testid": "pill-right-icon"
1141
- }
1142
- )
1155
+ renderIconSlot(rightIcon, "right")
1143
1156
  ] })
1144
1157
  }
1145
1158
  );
@@ -1578,7 +1591,7 @@ var SearchableSelect_default = SearchableSelect;
1578
1591
  import {
1579
1592
  Drawer,
1580
1593
  Typography as Typography6,
1581
- Box as Box7,
1594
+ Box as Box8,
1582
1595
  IconButton as IconButton6,
1583
1596
  Grid as Grid2,
1584
1597
  useTheme as useTheme10,
@@ -1636,7 +1649,7 @@ var FormDrawer = ({
1636
1649
  ],
1637
1650
  children: [
1638
1651
  /* @__PURE__ */ jsx16(
1639
- Box7,
1652
+ Box8,
1640
1653
  {
1641
1654
  sx: {
1642
1655
  position: "relative",
@@ -1667,7 +1680,7 @@ var FormDrawer = ({
1667
1680
  }
1668
1681
  ),
1669
1682
  /* @__PURE__ */ jsx16(
1670
- Box7,
1683
+ Box8,
1671
1684
  {
1672
1685
  sx: {
1673
1686
  flex: 1,
@@ -1680,7 +1693,7 @@ var FormDrawer = ({
1680
1693
  }
1681
1694
  ),
1682
1695
  actions != null ? /* @__PURE__ */ jsx16(
1683
- Box7,
1696
+ Box8,
1684
1697
  {
1685
1698
  sx: {
1686
1699
  flexShrink: 0,
@@ -1706,7 +1719,7 @@ import {
1706
1719
  } from "react";
1707
1720
  import {
1708
1721
  Autocomplete as Autocomplete2,
1709
- Box as Box8,
1722
+ Box as Box9,
1710
1723
  Stack,
1711
1724
  TextField as TextField2,
1712
1725
  useTheme as useTheme11,
@@ -1949,7 +1962,7 @@ var PhoneNumberField = ({
1949
1962
  };
1950
1963
  const selectedCountry = countries.find((c) => c.code === country);
1951
1964
  return /* @__PURE__ */ jsx17(
1952
- Box8,
1965
+ Box9,
1953
1966
  {
1954
1967
  ref: wrapperRef,
1955
1968
  onFocusCapture: () => setIsFocused(true),
@@ -1998,8 +2011,8 @@ var PhoneNumberField = ({
1998
2011
  whiteSpace: "nowrap"
1999
2012
  }
2000
2013
  },
2001
- renderOption: (props, option) => /* @__PURE__ */ createElement(Box8, { component: "li", ...props, key: option.code }, /* @__PURE__ */ jsx17(
2002
- Box8,
2014
+ renderOption: (props, option) => /* @__PURE__ */ createElement(Box9, { component: "li", ...props, key: option.code }, /* @__PURE__ */ jsx17(
2015
+ Box9,
2003
2016
  {
2004
2017
  component: "img",
2005
2018
  loading: "lazy",
@@ -2064,7 +2077,7 @@ var PhoneNumberField_default = PhoneNumberField;
2064
2077
  import { useEffect as useEffect5, useState as useState6 } from "react";
2065
2078
  import {
2066
2079
  Autocomplete as Autocomplete3,
2067
- Box as Box9,
2080
+ Box as Box10,
2068
2081
  TextField as TextField3,
2069
2082
  Typography as Typography7,
2070
2083
  FormLabel as FormLabel2
@@ -2122,7 +2135,7 @@ var CountrySelect = ({
2122
2135
  const selectedOption = COUNTRIES.find((country) => country.code === value);
2123
2136
  if (!editMode) {
2124
2137
  return /* @__PURE__ */ jsxs11(
2125
- Box9,
2138
+ Box10,
2126
2139
  {
2127
2140
  component: "div",
2128
2141
  onClick: () => {
@@ -2136,7 +2149,7 @@ var CountrySelect = ({
2136
2149
  children: [
2137
2150
  /* @__PURE__ */ jsx18(FormLabel2, { className: classes.formLabel, children: label }),
2138
2151
  /* @__PURE__ */ jsxs11(
2139
- Box9,
2152
+ Box10,
2140
2153
  {
2141
2154
  sx: {
2142
2155
  display: "flex",
@@ -2146,7 +2159,7 @@ var CountrySelect = ({
2146
2159
  },
2147
2160
  children: [
2148
2161
  selectedOption ? /* @__PURE__ */ jsx18(
2149
- Box9,
2162
+ Box10,
2150
2163
  {
2151
2164
  component: "img",
2152
2165
  loading: "lazy",
@@ -2211,7 +2224,7 @@ var CountrySelect = ({
2211
2224
  }
2212
2225
  }
2213
2226
  },
2214
- renderOption: (props, option) => /* @__PURE__ */ createElement2(Box9, { component: "li", ...props, key: option.code }, /* @__PURE__ */ jsx18(
2227
+ renderOption: (props, option) => /* @__PURE__ */ createElement2(Box10, { component: "li", ...props, key: option.code }, /* @__PURE__ */ jsx18(
2215
2228
  "img",
2216
2229
  {
2217
2230
  loading: "lazy",
@@ -2238,7 +2251,7 @@ var CountrySelect = ({
2238
2251
  ...params.InputProps,
2239
2252
  startAdornment: /* @__PURE__ */ jsxs11(Fragment3, { children: [
2240
2253
  selectedOption ? /* @__PURE__ */ jsx18(
2241
- Box9,
2254
+ Box10,
2242
2255
  {
2243
2256
  component: "img",
2244
2257
  loading: "lazy",
@@ -2288,7 +2301,7 @@ import {
2288
2301
  useRef as useRef5,
2289
2302
  useState as useState7
2290
2303
  } from "react";
2291
- import { Box as Box10, TextField as TextField4 } from "@mui/material";
2304
+ import { Box as Box11, TextField as TextField4 } from "@mui/material";
2292
2305
  import { jsx as jsx19 } from "react/jsx-runtime";
2293
2306
  function toCells(s, len) {
2294
2307
  const slice = (s || "").slice(0, len);
@@ -2408,7 +2421,7 @@ var OTPField = ({
2408
2421
  };
2409
2422
  const inputType = secret ? "password" : type === "numeric" ? "tel" : "text";
2410
2423
  return /* @__PURE__ */ jsx19(
2411
- Box10,
2424
+ Box11,
2412
2425
  {
2413
2426
  sx: [
2414
2427
  {