@verma-consulting/design-library 0.1.57 → 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
  );
@@ -2513,6 +2571,7 @@ export {
2513
2571
  IOSSwitch_default as IOSSwitch,
2514
2572
  ImageUploadAvatar_default as ImageUploadAvatar,
2515
2573
  InputFileUpload_default as InputFileUpload,
2574
+ LOGO_FONT_STACK,
2516
2575
  Loader_default as Loader,
2517
2576
  Logo_default as Logo,
2518
2577
  OTPField_default as OTPField,