@fairmint/ui 0.2.20 → 0.2.22

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.
@@ -0,0 +1,35 @@
1
+ import { ReactNode } from 'react';
2
+ export interface CompanyBannerProps {
3
+ /** Company name — displayed as gradient text. */
4
+ companyName: string;
5
+ /**
6
+ * Logo URL. When present, renders a side-by-side layout (avatar | text).
7
+ * When absent, renders a centered text-only layout.
8
+ */
9
+ companyLogoUrl?: string | null;
10
+ /** Optional eyebrow label rendered above the company name (e.g. "Invited by"). */
11
+ label?: string;
12
+ /**
13
+ * Optional secondary content rendered below the company name (e.g. share count).
14
+ *
15
+ * Rendered values: non-boolean ReactNodes (including numeric `0` and strings).
16
+ * Hidden values: `null`, `undefined`, `true`, and `false` — matches React's
17
+ * rendering rules so `condition && "text"` patterns do not leave an empty
18
+ * row when `condition` is falsy.
19
+ */
20
+ detail?: ReactNode;
21
+ /** Avatar size in px. @default 52 */
22
+ avatarSize?: number;
23
+ }
24
+ /**
25
+ * Renders a branded company banner — used on invitation flows and welcome
26
+ * screens to anchor the user in the context of a specific company.
27
+ *
28
+ * Two visual modes:
29
+ * - **With logo**: side-by-side layout (avatar | label / name / detail) with a
30
+ * vertical divider.
31
+ * - **Without logo**: centered text-only layout with the gradient company name
32
+ * as the visual focal point.
33
+ */
34
+ export declare function CompanyBanner({ companyName, companyLogoUrl, label, detail, avatarSize, }: CompanyBannerProps): import("react/jsx-runtime").JSX.Element;
35
+ //# sourceMappingURL=CompanyBanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompanyBanner.d.ts","sourceRoot":"","sources":["../../../../src/components/generic/CompanyBanner/CompanyBanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAavC,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,EAC5B,WAAW,EACX,cAAc,EACd,KAAK,EACL,MAAM,EACN,UAAe,GAChB,EAAE,kBAAkB,2CA6FpB"}
@@ -15931,7 +15931,7 @@ function getInitialsColor(name, colors2 = defaultColors) {
15931
15931
  const index2 = Math.abs(hash2) % colors2.length;
15932
15932
  return colors2[index2];
15933
15933
  }
15934
- function getInitials(name, limit = 2) {
15934
+ function getInitials$1(name, limit = 2) {
15935
15935
  const splitted = name.split(" ");
15936
15936
  if (splitted.length === 1) {
15937
15937
  return name.slice(0, limit).toUpperCase();
@@ -16005,7 +16005,7 @@ const Avatar$1 = polymorphicFactory((_props, ref) => {
16005
16005
  mod: [{ "within-group": ctx.withinGroup }, mod],
16006
16006
  ref,
16007
16007
  ...others,
16008
- children: error2 || !src ? /* @__PURE__ */ jsxRuntime.jsx("span", { ...getStyles2("placeholder"), title: alt, children: children || typeof name === "string" && getInitials(name) || /* @__PURE__ */ jsxRuntime.jsx(AvatarPlaceholderIcon, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(
16008
+ children: error2 || !src ? /* @__PURE__ */ jsxRuntime.jsx("span", { ...getStyles2("placeholder"), title: alt, children: children || typeof name === "string" && getInitials$1(name) || /* @__PURE__ */ jsxRuntime.jsx(AvatarPlaceholderIcon, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(
16009
16009
  "img",
16010
16010
  {
16011
16011
  ...imageProps,
@@ -38132,6 +38132,112 @@ function ColorDot({ color, size: size2 = 8, style, ...rest }) {
38132
38132
  };
38133
38133
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-testid": "color-dot", style: [baseStyle, style], ...rest });
38134
38134
  }
38135
+ function getAvatarColor(name) {
38136
+ if (!name) return AVATAR_PALETTE[0];
38137
+ let hash2 = 0;
38138
+ for (let i = 0; i < name.length; i++) {
38139
+ hash2 = hash2 * 31 + name.charCodeAt(i) >>> 0;
38140
+ }
38141
+ return AVATAR_PALETTE[hash2 % AVATAR_PALETTE.length];
38142
+ }
38143
+ function getInitials(name) {
38144
+ const words = name.trim().split(/\s+/).filter(Boolean);
38145
+ if (words.length >= 2) {
38146
+ return (words[0][0] + words[1][0]).toUpperCase();
38147
+ }
38148
+ if (words.length === 1) {
38149
+ return words[0][0].toUpperCase();
38150
+ }
38151
+ return "";
38152
+ }
38153
+ const BRAND_GRADIENT = `linear-gradient(90deg, ${brandColors.blue} 0%, ${brandColors.indigo} 50%, ${brandColors.purple} 100%)`;
38154
+ function CompanyBanner({
38155
+ companyName,
38156
+ companyLogoUrl,
38157
+ label,
38158
+ detail,
38159
+ avatarSize = 52
38160
+ }) {
38161
+ const trimmedName = companyName.trim();
38162
+ const initials = getInitials(companyName);
38163
+ const avatarColor = getAvatarColor(companyName);
38164
+ const labelEl = label ? /* @__PURE__ */ jsxRuntime.jsx(
38165
+ Text,
38166
+ {
38167
+ size: "xs",
38168
+ fw: 600,
38169
+ tt: "uppercase",
38170
+ c: fairmintVars.colorTextTertiary,
38171
+ style: {
38172
+ fontFamily: fairmintVars.fontHeadings,
38173
+ letterSpacing: "0.08em",
38174
+ lineHeight: 1
38175
+ },
38176
+ children: label
38177
+ }
38178
+ ) : null;
38179
+ const gradientNameEl = /* @__PURE__ */ jsxRuntime.jsx(
38180
+ Text,
38181
+ {
38182
+ fw: 700,
38183
+ style: {
38184
+ fontFamily: fairmintVars.fontHeadings,
38185
+ fontSize: "1.375rem",
38186
+ lineHeight: 1.3,
38187
+ letterSpacing: "-0.025em",
38188
+ background: BRAND_GRADIENT,
38189
+ backgroundClip: "text",
38190
+ WebkitBackgroundClip: "text",
38191
+ // Firefox ignores -webkit-text-fill-color; `color: transparent`
38192
+ // is required for `background-clip: text` to show the gradient there.
38193
+ // Chrome/Safari still pick up WebkitTextFillColor (kept for historical safety).
38194
+ color: "transparent",
38195
+ WebkitTextFillColor: "transparent",
38196
+ wordBreak: "break-word"
38197
+ },
38198
+ children: companyName
38199
+ }
38200
+ );
38201
+ const hasDetail = detail != null && typeof detail !== "boolean";
38202
+ const detailEl = hasDetail ? /* @__PURE__ */ jsxRuntime.jsx(Text, { size: "sm", c: fairmintVars.colorTextSecondary, style: { lineHeight: 1.4 }, children: detail }) : null;
38203
+ if (companyLogoUrl) {
38204
+ return /* @__PURE__ */ jsxRuntime.jsxs(Box, { style: { display: "flex", alignItems: "stretch", gap: 16 }, children: [
38205
+ /* @__PURE__ */ jsxRuntime.jsx(
38206
+ Box,
38207
+ {
38208
+ style: {
38209
+ display: "flex",
38210
+ alignItems: "center",
38211
+ justifyContent: "center",
38212
+ paddingRight: 16,
38213
+ borderRight: `1px solid ${neutralColors[200]}`
38214
+ },
38215
+ children: /* @__PURE__ */ jsxRuntime.jsx(
38216
+ Avatar,
38217
+ {
38218
+ src: companyLogoUrl,
38219
+ alt: trimmedName ? `${trimmedName} logo` : "Company logo",
38220
+ radius: "xl",
38221
+ size: avatarSize,
38222
+ color: avatarColor,
38223
+ children: initials
38224
+ }
38225
+ )
38226
+ }
38227
+ ),
38228
+ /* @__PURE__ */ jsxRuntime.jsxs(Stack, { gap: 2, justify: "center", style: { minWidth: 0 }, children: [
38229
+ labelEl,
38230
+ gradientNameEl,
38231
+ detailEl
38232
+ ] })
38233
+ ] });
38234
+ }
38235
+ return /* @__PURE__ */ jsxRuntime.jsxs(Stack, { align: "center", gap: 4, children: [
38236
+ labelEl,
38237
+ gradientNameEl,
38238
+ detailEl
38239
+ ] });
38240
+ }
38135
38241
  function ConfirmDialog({
38136
38242
  title,
38137
38243
  message,
@@ -40111,14 +40217,6 @@ function DocumentRow({
40111
40217
  }
40112
40218
  );
40113
40219
  }
40114
- function getAvatarColor(name) {
40115
- if (!name) return AVATAR_PALETTE[0];
40116
- let hash2 = 0;
40117
- for (let i = 0; i < name.length; i++) {
40118
- hash2 = hash2 * 31 + name.charCodeAt(i) >>> 0;
40119
- }
40120
- return AVATAR_PALETTE[hash2 % AVATAR_PALETTE.length];
40121
- }
40122
40220
  function EquityGrantCard({
40123
40221
  companyName,
40124
40222
  logoUrl,
@@ -40918,6 +41016,7 @@ exports.Checkbox = Checkbox;
40918
41016
  exports.ClickableCard = ClickableCard;
40919
41017
  exports.Collapse = Collapse;
40920
41018
  exports.ColorDot = ColorDot;
41019
+ exports.CompanyBanner = CompanyBanner;
40921
41020
  exports.ConfirmDialog = ConfirmDialog;
40922
41021
  exports.Container = Container;
40923
41022
  exports.Currency = Currency;
@@ -41008,6 +41107,7 @@ exports.formatPhone = formatPhone;
41008
41107
  exports.formatPhoneDisplay = formatPhoneDisplay;
41009
41108
  exports.formatPreciseWithCurrency = formatPreciseWithCurrency;
41010
41109
  exports.getAvatarColor = getAvatarColor;
41110
+ exports.getInitials = getInitials;
41011
41111
  exports.getWalletDisplayName = getWalletDisplayName;
41012
41112
  exports.getWalletKindPill = getWalletKindPill;
41013
41113
  exports.getWalletLabel = getWalletLabel;