@verma-consulting/design-library 0.1.56 → 0.1.58

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
@@ -231,6 +231,66 @@ import {
231
231
  useMediaQuery
232
232
  } from "@mui/material";
233
233
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
234
+ var LOGO_FONT_STACK = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"';
235
+ var wordmarkCore = {
236
+ fontFamily: LOGO_FONT_STACK,
237
+ fontWeight: 600,
238
+ letterSpacing: "-0.015em",
239
+ lineHeight: 1.35,
240
+ color: "text.primary"
241
+ };
242
+ function wordmarkSx(centered) {
243
+ return {
244
+ ...wordmarkCore,
245
+ ...centered ? {
246
+ fontSize: "1.0625rem",
247
+ textAlign: "center",
248
+ wordBreak: "break-word"
249
+ } : {
250
+ fontSize: "0.9375rem",
251
+ overflow: "hidden",
252
+ textOverflow: "ellipsis",
253
+ whiteSpace: "nowrap"
254
+ }
255
+ };
256
+ }
257
+ function companySlotTypographySx(centered) {
258
+ return {
259
+ "& .MuiTypography-root": {
260
+ ...wordmarkCore,
261
+ fontSize: centered ? "1.0625rem" : "0.9375rem",
262
+ textAlign: centered ? "center" : "inherit",
263
+ overflow: "hidden",
264
+ textOverflow: "ellipsis",
265
+ whiteSpace: "nowrap",
266
+ maxWidth: "100%"
267
+ }
268
+ };
269
+ }
270
+ function CompanySlot({
271
+ centered,
272
+ maxWidth,
273
+ harmonizeCompanyTypography,
274
+ companySlotSx,
275
+ children
276
+ }) {
277
+ return /* @__PURE__ */ jsx3(
278
+ Box2,
279
+ {
280
+ sx: {
281
+ width: "100%",
282
+ maxWidth,
283
+ minWidth: 0,
284
+ display: "flex",
285
+ justifyContent: centered ? "center" : "flex-start",
286
+ alignItems: "center",
287
+ ...harmonizeCompanyTypography ? companySlotTypographySx(centered) : null,
288
+ ...companySlotSx
289
+ },
290
+ children
291
+ }
292
+ );
293
+ }
234
294
  var Logo = memo(
235
295
  ({
236
296
  loggedIn = false,
@@ -238,7 +298,9 @@ var Logo = memo(
238
298
  organization = null,
239
299
  defaultLogo = null,
240
300
  handleClick = () => null,
241
- companyComponent = null
301
+ companyComponent = null,
302
+ harmonizeCompanyTypography = true,
303
+ companySlotSx
242
304
  }) => {
243
305
  var _a2;
244
306
  const theme = useTheme();
@@ -246,6 +308,13 @@ var Logo = memo(
246
308
  const maxWidth = mdMatches ? 160 : 320;
247
309
  const companyName = (organization == null ? void 0 : organization.name) || "\u2013";
248
310
  const logoUrl = (_a2 = organization == null ? void 0 : organization.logo) == null ? void 0 : _a2.url;
311
+ const avatarSx = {
312
+ fontFamily: LOGO_FONT_STACK,
313
+ bgcolor: "primary.main",
314
+ fontWeight: 600,
315
+ letterSpacing: "-0.02em"
316
+ };
317
+ const wm = wordmarkSx(centered);
249
318
  if (centered) {
250
319
  return /* @__PURE__ */ jsxs(
251
320
  Grid,
@@ -258,35 +327,31 @@ var Logo = memo(
258
327
  sx: { cursor: "pointer" },
259
328
  onClick: handleClick,
260
329
  children: [
261
- (logoUrl || defaultLogo) && /* @__PURE__ */ jsx3(Grid, { item: true, children: logoUrl ? /* @__PURE__ */ jsx3(
330
+ (logoUrl || defaultLogo) && /* @__PURE__ */ jsx3(Grid, { item: true, sx: { display: "flex", justifyContent: "center" }, children: logoUrl ? /* @__PURE__ */ jsx3(
262
331
  Avatar,
263
332
  {
264
333
  alt: companyName || "avatar",
265
334
  src: logoUrl,
266
335
  sx: {
267
336
  width: 64,
268
- // slightly bigger
269
337
  height: 64,
270
- bgcolor: "primary.main",
271
- fontSize: 20,
272
- fontWeight: "bold"
338
+ fontSize: "1.125rem",
339
+ ...avatarSx
273
340
  },
274
341
  imgProps: { loading: "lazy" },
275
342
  children: (companyName == null ? void 0 : companyName.charAt(0)) || "?"
276
343
  }
277
344
  ) : defaultLogo }),
278
- /* @__PURE__ */ jsx3(Grid, { item: true, sx: { maxWidth, textAlign: "center" }, children: loggedIn ? /* @__PURE__ */ jsx3(Tooltip, { title: companyName, placement: "top", arrow: true, children: /* @__PURE__ */ jsx3(
279
- Typography,
345
+ /* @__PURE__ */ jsx3(Grid, { item: true, sx: { maxWidth, width: "100%", textAlign: "center" }, children: loggedIn ? /* @__PURE__ */ jsx3(Tooltip, { title: companyName, placement: "top", arrow: true, children: /* @__PURE__ */ jsx3(Typography, { component: "span", sx: wm, children: companyName }) }) : /* @__PURE__ */ jsx3(
346
+ CompanySlot,
280
347
  {
281
- variant: "h6",
282
- sx: {
283
- fontFamily: "Courier, monospace",
284
- fontWeight: "bold",
285
- color: "primary.main"
286
- },
287
- children: companyName
348
+ centered: true,
349
+ maxWidth,
350
+ harmonizeCompanyTypography,
351
+ companySlotSx,
352
+ children: companyComponent
288
353
  }
289
- ) }) : /* @__PURE__ */ jsx3(Box2, { sx: { display: "flex", justifyContent: "center" }, children: companyComponent }) })
354
+ ) })
290
355
  ]
291
356
  }
292
357
  );
@@ -303,7 +368,7 @@ var Logo = memo(
303
368
  },
304
369
  onClick: handleClick,
305
370
  children: [
306
- (logoUrl || defaultLogo) && /* @__PURE__ */ jsx3(Box2, { sx: { mr: 1, display: "flex", alignItems: "center" }, children: logoUrl ? /* @__PURE__ */ jsx3(
371
+ (logoUrl || defaultLogo) && /* @__PURE__ */ jsx3(Box2, { sx: { mr: 1.25, display: "flex", alignItems: "center" }, children: logoUrl ? /* @__PURE__ */ jsx3(
307
372
  Avatar,
308
373
  {
309
374
  alt: companyName || "avatar",
@@ -311,30 +376,23 @@ var Logo = memo(
311
376
  sx: {
312
377
  width: 36,
313
378
  height: 36,
314
- bgcolor: "primary.main",
315
- fontSize: 14,
316
- fontWeight: "bold"
379
+ fontSize: "0.875rem",
380
+ ...avatarSx
317
381
  },
318
382
  imgProps: { loading: "lazy" },
319
383
  children: (companyName == null ? void 0 : companyName.charAt(0)) || "?"
320
384
  }
321
385
  ) : defaultLogo }),
322
- /* @__PURE__ */ jsx3(Box2, { sx: { maxWidth, flexShrink: 1, minWidth: 0 }, children: loggedIn ? /* @__PURE__ */ jsx3(Tooltip, { title: companyName, placement: "top", arrow: true, children: /* @__PURE__ */ jsx3(
323
- Typography,
386
+ /* @__PURE__ */ jsx3(Box2, { sx: { maxWidth, flexShrink: 1, minWidth: 0 }, children: loggedIn ? /* @__PURE__ */ jsx3(Tooltip, { title: companyName, placement: "top", arrow: true, children: /* @__PURE__ */ jsx3(Typography, { component: "span", sx: wm, children: companyName }) }) : /* @__PURE__ */ jsx3(
387
+ CompanySlot,
324
388
  {
325
- variant: "h6",
326
- noWrap: true,
327
- sx: {
328
- textOverflow: "ellipsis",
329
- overflow: "hidden",
330
- whiteSpace: "nowrap",
331
- fontFamily: "Courier, monospace",
332
- fontWeight: "bold",
333
- color: "primary.main"
334
- },
335
- children: companyName
389
+ centered: false,
390
+ maxWidth,
391
+ harmonizeCompanyTypography,
392
+ companySlotSx,
393
+ children: companyComponent
336
394
  }
337
- ) }) : companyComponent })
395
+ ) })
338
396
  ]
339
397
  }
340
398
  );
@@ -1087,6 +1145,16 @@ var EmptyState_default = EmptyState;
1087
1145
  import { Box as Box7, Button, Icon, Typography as Typography4 } from "@mui/material";
1088
1146
  import { alpha as alpha8, useTheme as useTheme7 } from "@mui/material/styles";
1089
1147
  import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1148
+ function glassSurface2(theme) {
1149
+ return {
1150
+ backdropFilter: "blur(12px)",
1151
+ WebkitBackdropFilter: "blur(12px)",
1152
+ backgroundColor: theme.palette.mode === "dark" ? "rgba(255,255,255,0.06)" : "rgba(255,255,255,0.88)"
1153
+ };
1154
+ }
1155
+ function isSemanticColor(c) {
1156
+ return c === "warning" || c === "success" || c === "error" || c === "secondary" || c === "info";
1157
+ }
1090
1158
  function renderIconSlot(node, side) {
1091
1159
  if (node == null) return null;
1092
1160
  const spacing = side === "left" ? { pr: 1 } : { ml: 1 };
@@ -1129,23 +1197,46 @@ var Pill = ({
1129
1197
  disabled = false
1130
1198
  }) => {
1131
1199
  const theme = useTheme7();
1200
+ const semantic = isSemanticColor(color);
1201
+ const buttonColor = semantic ? color : color === "inherit" ? "inherit" : color != null ? color : "primary";
1202
+ const neutralChrome = !semantic;
1203
+ const hoverShadow = theme.palette.mode === "dark" ? "0 10px 22px rgba(0,0,0,0.34)" : "0 10px 20px rgba(15,23,42,0.14)";
1204
+ let chromeSx;
1205
+ if (neutralChrome) {
1206
+ chromeSx = {
1207
+ borderColor: isSelected ? alpha8(theme.palette.primary.main, 0.34) : alpha8(theme.palette.text.primary, 0.18),
1208
+ color: isSelected ? "primary.main" : "text.primary",
1209
+ "&:hover": {
1210
+ ...glassSurface2(theme),
1211
+ borderColor: alpha8(theme.palette.primary.main, 0.42),
1212
+ boxShadow: hoverShadow
1213
+ }
1214
+ };
1215
+ } else {
1216
+ const c = color;
1217
+ const main = theme.palette[c].main;
1218
+ chromeSx = {
1219
+ borderColor: isSelected ? alpha8(main, 0.34) : alpha8(main, 0.18),
1220
+ color: `${c}.main`,
1221
+ "&:hover": {
1222
+ ...glassSurface2(theme),
1223
+ borderColor: alpha8(main, 0.42),
1224
+ boxShadow: hoverShadow
1225
+ }
1226
+ };
1227
+ }
1132
1228
  return /* @__PURE__ */ jsx11(
1133
1229
  Button,
1134
1230
  {
1135
1231
  variant: isSelected ? "contained" : "outlined",
1136
- color: color != null ? color : "primary",
1232
+ color: buttonColor,
1137
1233
  sx: {
1138
- ...glassSurface(theme),
1234
+ ...glassSurface2(theme),
1139
1235
  borderRadius: 16,
1140
1236
  padding: "8px 16px",
1141
1237
  minHeight: 38,
1142
1238
  textTransform: "none",
1143
- borderColor: isSelected ? alpha8(theme.palette.primary.main, 0.34) : alpha8(theme.palette.text.primary, 0.18),
1144
- color: isSelected ? "primary.main" : "text.primary",
1145
- "&:hover": {
1146
- borderColor: alpha8(theme.palette.primary.main, 0.42),
1147
- boxShadow: theme.palette.mode === "dark" ? "0 10px 22px rgba(0,0,0,0.34)" : "0 10px 20px rgba(15,23,42,0.14)"
1148
- }
1239
+ ...chromeSx
1149
1240
  },
1150
1241
  onClick,
1151
1242
  disabled,
@@ -2480,6 +2571,7 @@ export {
2480
2571
  IOSSwitch_default as IOSSwitch,
2481
2572
  ImageUploadAvatar_default as ImageUploadAvatar,
2482
2573
  InputFileUpload_default as InputFileUpload,
2574
+ LOGO_FONT_STACK,
2483
2575
  Loader_default as Loader,
2484
2576
  Logo_default as Logo,
2485
2577
  OTPField_default as OTPField,