@verma-consulting/design-library 0.1.57 → 0.1.59

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
@@ -228,9 +228,70 @@ import {
228
228
  Tooltip,
229
229
  Box as Box2,
230
230
  useTheme,
231
- useMediaQuery
231
+ useMediaQuery,
232
+ Stack
232
233
  } from "@mui/material";
233
234
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
235
+ 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"';
236
+ var wordmarkCore = {
237
+ fontFamily: LOGO_FONT_STACK,
238
+ fontWeight: 600,
239
+ letterSpacing: "-0.015em",
240
+ lineHeight: 1.35,
241
+ color: "text.primary"
242
+ };
243
+ function wordmarkSx(centered) {
244
+ return {
245
+ ...wordmarkCore,
246
+ ...centered ? {
247
+ fontSize: "1.0625rem",
248
+ textAlign: "center",
249
+ wordBreak: "break-word"
250
+ } : {
251
+ fontSize: "0.9375rem",
252
+ overflow: "hidden",
253
+ textOverflow: "ellipsis",
254
+ whiteSpace: "nowrap"
255
+ }
256
+ };
257
+ }
258
+ function companySlotTypographySx(centered) {
259
+ return {
260
+ "& .MuiTypography-root": {
261
+ ...wordmarkCore,
262
+ fontSize: centered ? "1.0625rem" : "0.9375rem",
263
+ textAlign: centered ? "center" : "inherit",
264
+ overflow: "hidden",
265
+ textOverflow: "ellipsis",
266
+ whiteSpace: "nowrap",
267
+ maxWidth: "100%"
268
+ }
269
+ };
270
+ }
271
+ function CompanySlot({
272
+ centered,
273
+ maxWidth,
274
+ harmonizeCompanyTypography,
275
+ companySlotSx,
276
+ children
277
+ }) {
278
+ return /* @__PURE__ */ jsx3(
279
+ Box2,
280
+ {
281
+ sx: {
282
+ width: "100%",
283
+ maxWidth,
284
+ minWidth: 0,
285
+ display: "flex",
286
+ justifyContent: centered ? "center" : "flex-start",
287
+ alignItems: "center",
288
+ ...harmonizeCompanyTypography ? companySlotTypographySx(centered) : null,
289
+ ...companySlotSx
290
+ },
291
+ children
292
+ }
293
+ );
294
+ }
234
295
  var Logo = memo(
235
296
  ({
236
297
  loggedIn = false,
@@ -238,7 +299,9 @@ var Logo = memo(
238
299
  organization = null,
239
300
  defaultLogo = null,
240
301
  handleClick = () => null,
241
- companyComponent = null
302
+ companyComponent = null,
303
+ harmonizeCompanyTypography = true,
304
+ companySlotSx
242
305
  }) => {
243
306
  var _a2;
244
307
  const theme = useTheme();
@@ -246,47 +309,75 @@ var Logo = memo(
246
309
  const maxWidth = mdMatches ? 160 : 320;
247
310
  const companyName = (organization == null ? void 0 : organization.name) || "\u2013";
248
311
  const logoUrl = (_a2 = organization == null ? void 0 : organization.logo) == null ? void 0 : _a2.url;
312
+ const avatarSx = {
313
+ fontFamily: LOGO_FONT_STACK,
314
+ bgcolor: "primary.main",
315
+ fontWeight: 600,
316
+ letterSpacing: "-0.02em"
317
+ };
318
+ const wm = wordmarkSx(centered);
249
319
  if (centered) {
250
320
  return /* @__PURE__ */ jsxs(
251
- Grid,
321
+ Stack,
252
322
  {
253
- container: true,
254
- direction: "column",
255
- alignItems: "center",
256
- justifyContent: "center",
257
323
  spacing: 1,
258
- sx: { cursor: "pointer" },
259
324
  onClick: handleClick,
325
+ sx: {
326
+ cursor: "pointer",
327
+ alignItems: "stretch",
328
+ width: "100%",
329
+ maxWidth,
330
+ minWidth: 0
331
+ },
260
332
  children: [
261
- (logoUrl || defaultLogo) && /* @__PURE__ */ jsx3(Grid, { item: true, children: logoUrl ? /* @__PURE__ */ jsx3(
262
- Avatar,
333
+ (logoUrl || defaultLogo) && /* @__PURE__ */ jsx3(
334
+ Box2,
263
335
  {
264
- alt: companyName || "avatar",
265
- src: logoUrl,
266
336
  sx: {
267
- width: 64,
268
- // slightly bigger
269
- height: 64,
270
- bgcolor: "primary.main",
271
- fontSize: 20,
272
- fontWeight: "bold"
337
+ display: "flex",
338
+ justifyContent: "center",
339
+ alignItems: "center",
340
+ width: "100%"
273
341
  },
274
- imgProps: { loading: "lazy" },
275
- children: (companyName == null ? void 0 : companyName.charAt(0)) || "?"
342
+ children: logoUrl ? /* @__PURE__ */ jsx3(
343
+ Avatar,
344
+ {
345
+ alt: companyName || "avatar",
346
+ src: logoUrl,
347
+ sx: {
348
+ width: 64,
349
+ height: 64,
350
+ fontSize: "1.125rem",
351
+ ...avatarSx
352
+ },
353
+ imgProps: { loading: "lazy" },
354
+ children: (companyName == null ? void 0 : companyName.charAt(0)) || "?"
355
+ }
356
+ ) : defaultLogo
276
357
  }
277
- ) : 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,
358
+ ),
359
+ /* @__PURE__ */ jsx3(
360
+ Box2,
280
361
  {
281
- variant: "h6",
282
362
  sx: {
283
- fontFamily: "Courier, monospace",
284
- fontWeight: "bold",
285
- color: "primary.main"
363
+ width: "100%",
364
+ minWidth: 0,
365
+ display: "flex",
366
+ justifyContent: "center",
367
+ textAlign: "center"
286
368
  },
287
- children: companyName
369
+ children: loggedIn ? /* @__PURE__ */ jsx3(Tooltip, { title: companyName, placement: "top", arrow: true, children: /* @__PURE__ */ jsx3(Typography, { component: "span", sx: wm, children: companyName }) }) : /* @__PURE__ */ jsx3(
370
+ CompanySlot,
371
+ {
372
+ centered: true,
373
+ maxWidth,
374
+ harmonizeCompanyTypography,
375
+ companySlotSx,
376
+ children: companyComponent
377
+ }
378
+ )
288
379
  }
289
- ) }) : /* @__PURE__ */ jsx3(Box2, { sx: { display: "flex", justifyContent: "center" }, children: companyComponent }) })
380
+ )
290
381
  ]
291
382
  }
292
383
  );
@@ -303,7 +394,7 @@ var Logo = memo(
303
394
  },
304
395
  onClick: handleClick,
305
396
  children: [
306
- (logoUrl || defaultLogo) && /* @__PURE__ */ jsx3(Box2, { sx: { mr: 1, display: "flex", alignItems: "center" }, children: logoUrl ? /* @__PURE__ */ jsx3(
397
+ (logoUrl || defaultLogo) && /* @__PURE__ */ jsx3(Box2, { sx: { mr: 1.25, display: "flex", alignItems: "center" }, children: logoUrl ? /* @__PURE__ */ jsx3(
307
398
  Avatar,
308
399
  {
309
400
  alt: companyName || "avatar",
@@ -311,30 +402,23 @@ var Logo = memo(
311
402
  sx: {
312
403
  width: 36,
313
404
  height: 36,
314
- bgcolor: "primary.main",
315
- fontSize: 14,
316
- fontWeight: "bold"
405
+ fontSize: "0.875rem",
406
+ ...avatarSx
317
407
  },
318
408
  imgProps: { loading: "lazy" },
319
409
  children: (companyName == null ? void 0 : companyName.charAt(0)) || "?"
320
410
  }
321
411
  ) : 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,
412
+ /* @__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(
413
+ CompanySlot,
324
414
  {
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
415
+ centered: false,
416
+ maxWidth,
417
+ harmonizeCompanyTypography,
418
+ companySlotSx,
419
+ children: companyComponent
336
420
  }
337
- ) }) : companyComponent })
421
+ ) })
338
422
  ]
339
423
  }
340
424
  );
@@ -1753,7 +1837,7 @@ import {
1753
1837
  import {
1754
1838
  Autocomplete as Autocomplete2,
1755
1839
  Box as Box9,
1756
- Stack,
1840
+ Stack as Stack2,
1757
1841
  TextField as TextField2,
1758
1842
  useTheme as useTheme11,
1759
1843
  useMediaQuery as useMediaQuery4
@@ -2002,7 +2086,7 @@ var PhoneNumberField = ({
2002
2086
  onBlurCapture: handleWrapperBlur,
2003
2087
  sx: { display: "flex", alignItems: "center", width: "100%" },
2004
2088
  children: /* @__PURE__ */ jsxs10(
2005
- Stack,
2089
+ Stack2,
2006
2090
  {
2007
2091
  direction: "row",
2008
2092
  spacing: 0,
@@ -2513,6 +2597,7 @@ export {
2513
2597
  IOSSwitch_default as IOSSwitch,
2514
2598
  ImageUploadAvatar_default as ImageUploadAvatar,
2515
2599
  InputFileUpload_default as InputFileUpload,
2600
+ LOGO_FONT_STACK,
2516
2601
  Loader_default as Loader,
2517
2602
  Logo_default as Logo,
2518
2603
  OTPField_default as OTPField,