@verma-consulting/design-library 0.1.53 → 0.1.54

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
@@ -7,6 +7,7 @@ import MuiTablePagination, { LabelDisplayedRowsArgs } from '@mui/material/TableP
7
7
  import { SxProps, Theme } from '@mui/material/styles';
8
8
  export { ThemeProvider, createTheme, styled, useTheme } from '@mui/material/styles';
9
9
  export { makeStyles } from '@mui/styles';
10
+ import { ButtonProps } from '@mui/material/Button';
10
11
  import { SwitchProps } from '@mui/material/Switch';
11
12
  import { userStatus, GenericPayload } from '@verma-consulting/common-library';
12
13
 
@@ -127,14 +128,15 @@ declare const EmptyState: React__default.FC<EmptyStateProps>;
127
128
 
128
129
  type PillProps = {
129
130
  label?: string;
130
- leftIcon?: string;
131
- rightIcon?: string;
132
- color?: string;
131
+ leftIcon?: React__default.ReactNode;
132
+ rightIcon?: React__default.ReactNode;
133
+ color?: ButtonProps["color"];
133
134
  isSelected?: boolean;
134
135
  onClick?: () => void;
135
136
  disabled?: boolean;
137
+ variant?: string;
136
138
  };
137
- declare const Pill: ({ variant, leftIcon, rightIcon, color, isSelected, onClick, label, disabled, }: PillProps) => react_jsx_runtime.JSX.Element;
139
+ declare const Pill: ({ variant: _variant, leftIcon, rightIcon, color, isSelected, onClick, label, disabled, }: PillProps) => react_jsx_runtime.JSX.Element;
138
140
 
139
141
  declare const IOSSwitch: React__default.FC<SwitchProps>;
140
142
 
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import MuiTablePagination, { LabelDisplayedRowsArgs } from '@mui/material/TableP
7
7
  import { SxProps, Theme } from '@mui/material/styles';
8
8
  export { ThemeProvider, createTheme, styled, useTheme } from '@mui/material/styles';
9
9
  export { makeStyles } from '@mui/styles';
10
+ import { ButtonProps } from '@mui/material/Button';
10
11
  import { SwitchProps } from '@mui/material/Switch';
11
12
  import { userStatus, GenericPayload } from '@verma-consulting/common-library';
12
13
 
@@ -127,14 +128,15 @@ declare const EmptyState: React__default.FC<EmptyStateProps>;
127
128
 
128
129
  type PillProps = {
129
130
  label?: string;
130
- leftIcon?: string;
131
- rightIcon?: string;
132
- color?: string;
131
+ leftIcon?: React__default.ReactNode;
132
+ rightIcon?: React__default.ReactNode;
133
+ color?: ButtonProps["color"];
133
134
  isSelected?: boolean;
134
135
  onClick?: () => void;
135
136
  disabled?: boolean;
137
+ variant?: string;
136
138
  };
137
- declare const Pill: ({ variant, leftIcon, rightIcon, color, isSelected, onClick, label, disabled, }: PillProps) => react_jsx_runtime.JSX.Element;
139
+ declare const Pill: ({ variant: _variant, leftIcon, rightIcon, color, isSelected, onClick, label, disabled, }: PillProps) => react_jsx_runtime.JSX.Element;
138
140
 
139
141
  declare const IOSSwitch: React__default.FC<SwitchProps>;
140
142
 
package/dist/index.js CHANGED
@@ -1124,11 +1124,42 @@ var EmptyState_default = EmptyState;
1124
1124
  var import_material10 = require("@mui/material");
1125
1125
  var import_styles9 = require("@mui/material/styles");
1126
1126
  var import_jsx_runtime11 = require("react/jsx-runtime");
1127
+ function renderIconSlot(node, side) {
1128
+ if (node == null) return null;
1129
+ const spacing = side === "left" ? { pr: 1 } : { ml: 1 };
1130
+ if (typeof node === "string") {
1131
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1132
+ import_material10.Icon,
1133
+ {
1134
+ baseClassName: "material-icons",
1135
+ fontSize: "small",
1136
+ color: "inherit",
1137
+ sx: spacing,
1138
+ "data-testid": side === "left" ? "pill-left-icon" : "pill-right-icon",
1139
+ children: node
1140
+ }
1141
+ );
1142
+ }
1143
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1144
+ import_material10.Box,
1145
+ {
1146
+ component: "span",
1147
+ sx: {
1148
+ display: "inline-flex",
1149
+ alignItems: "center",
1150
+ color: "inherit",
1151
+ ...spacing
1152
+ },
1153
+ "data-testid": side === "left" ? "pill-left-icon" : "pill-right-icon",
1154
+ children: node
1155
+ }
1156
+ );
1157
+ }
1127
1158
  var Pill = ({
1128
- variant = "filter",
1159
+ variant: _variant = "filter",
1129
1160
  leftIcon = null,
1130
1161
  rightIcon = null,
1131
- color = null,
1162
+ color,
1132
1163
  isSelected = false,
1133
1164
  onClick = () => null,
1134
1165
  label = "",
@@ -1139,7 +1170,7 @@ var Pill = ({
1139
1170
  import_material10.Button,
1140
1171
  {
1141
1172
  variant: isSelected ? "contained" : "outlined",
1142
- color: color || "primary",
1173
+ color: color != null ? color : "primary",
1143
1174
  sx: {
1144
1175
  ...glassSurface(theme),
1145
1176
  borderRadius: 16,
@@ -1156,27 +1187,9 @@ var Pill = ({
1156
1187
  onClick,
1157
1188
  disabled,
1158
1189
  children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
1159
- leftIcon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1160
- import_material10.Icon,
1161
- {
1162
- className: leftIcon,
1163
- fontSize: 14,
1164
- color: "inherit",
1165
- style: { paddingRight: 8 },
1166
- "data-testid": "pill-left-icon"
1167
- }
1168
- ),
1190
+ renderIconSlot(leftIcon, "left"),
1169
1191
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material10.Typography, { variant: "subtitle2", color: "inherit", fontWeight: 700, children: label }),
1170
- rightIcon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1171
- import_material10.Icon,
1172
- {
1173
- className: rightIcon,
1174
- fontSize: 14,
1175
- color: "inherit",
1176
- style: { marginLeft: 8 },
1177
- "data-testid": "pill-right-icon"
1178
- }
1179
- )
1192
+ renderIconSlot(rightIcon, "right")
1180
1193
  ] })
1181
1194
  }
1182
1195
  );