@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.
- package/dist/components/generic/CompanyBanner/CompanyBanner.d.ts +35 -0
- package/dist/components/generic/CompanyBanner/CompanyBanner.d.ts.map +1 -0
- package/dist/fairmint-ui.cjs +110 -10
- package/dist/fairmint-ui.cjs.map +1 -1
- package/dist/fairmint-ui.js +110 -10
- package/dist/fairmint-ui.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/utils/avatar.d.ts +14 -0
- package/dist/utils/avatar.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/fairmint-ui.js
CHANGED
|
@@ -15913,7 +15913,7 @@ function getInitialsColor(name, colors2 = defaultColors) {
|
|
|
15913
15913
|
const index2 = Math.abs(hash2) % colors2.length;
|
|
15914
15914
|
return colors2[index2];
|
|
15915
15915
|
}
|
|
15916
|
-
function getInitials(name, limit = 2) {
|
|
15916
|
+
function getInitials$1(name, limit = 2) {
|
|
15917
15917
|
const splitted = name.split(" ");
|
|
15918
15918
|
if (splitted.length === 1) {
|
|
15919
15919
|
return name.slice(0, limit).toUpperCase();
|
|
@@ -15987,7 +15987,7 @@ const Avatar$1 = polymorphicFactory((_props, ref) => {
|
|
|
15987
15987
|
mod: [{ "within-group": ctx.withinGroup }, mod],
|
|
15988
15988
|
ref,
|
|
15989
15989
|
...others,
|
|
15990
|
-
children: error2 || !src ? /* @__PURE__ */ jsx("span", { ...getStyles2("placeholder"), title: alt, children: children || typeof name === "string" && getInitials(name) || /* @__PURE__ */ jsx(AvatarPlaceholderIcon, {}) }) : /* @__PURE__ */ jsx(
|
|
15990
|
+
children: error2 || !src ? /* @__PURE__ */ jsx("span", { ...getStyles2("placeholder"), title: alt, children: children || typeof name === "string" && getInitials$1(name) || /* @__PURE__ */ jsx(AvatarPlaceholderIcon, {}) }) : /* @__PURE__ */ jsx(
|
|
15991
15991
|
"img",
|
|
15992
15992
|
{
|
|
15993
15993
|
...imageProps,
|
|
@@ -38114,6 +38114,112 @@ function ColorDot({ color, size: size2 = 8, style, ...rest }) {
|
|
|
38114
38114
|
};
|
|
38115
38115
|
return /* @__PURE__ */ jsx(Box, { "data-testid": "color-dot", style: [baseStyle, style], ...rest });
|
|
38116
38116
|
}
|
|
38117
|
+
function getAvatarColor(name) {
|
|
38118
|
+
if (!name) return AVATAR_PALETTE[0];
|
|
38119
|
+
let hash2 = 0;
|
|
38120
|
+
for (let i = 0; i < name.length; i++) {
|
|
38121
|
+
hash2 = hash2 * 31 + name.charCodeAt(i) >>> 0;
|
|
38122
|
+
}
|
|
38123
|
+
return AVATAR_PALETTE[hash2 % AVATAR_PALETTE.length];
|
|
38124
|
+
}
|
|
38125
|
+
function getInitials(name) {
|
|
38126
|
+
const words = name.trim().split(/\s+/).filter(Boolean);
|
|
38127
|
+
if (words.length >= 2) {
|
|
38128
|
+
return (words[0][0] + words[1][0]).toUpperCase();
|
|
38129
|
+
}
|
|
38130
|
+
if (words.length === 1) {
|
|
38131
|
+
return words[0][0].toUpperCase();
|
|
38132
|
+
}
|
|
38133
|
+
return "";
|
|
38134
|
+
}
|
|
38135
|
+
const BRAND_GRADIENT = `linear-gradient(90deg, ${brandColors.blue} 0%, ${brandColors.indigo} 50%, ${brandColors.purple} 100%)`;
|
|
38136
|
+
function CompanyBanner({
|
|
38137
|
+
companyName,
|
|
38138
|
+
companyLogoUrl,
|
|
38139
|
+
label,
|
|
38140
|
+
detail,
|
|
38141
|
+
avatarSize = 52
|
|
38142
|
+
}) {
|
|
38143
|
+
const trimmedName = companyName.trim();
|
|
38144
|
+
const initials = getInitials(companyName);
|
|
38145
|
+
const avatarColor = getAvatarColor(companyName);
|
|
38146
|
+
const labelEl = label ? /* @__PURE__ */ jsx(
|
|
38147
|
+
Text,
|
|
38148
|
+
{
|
|
38149
|
+
size: "xs",
|
|
38150
|
+
fw: 600,
|
|
38151
|
+
tt: "uppercase",
|
|
38152
|
+
c: fairmintVars.colorTextTertiary,
|
|
38153
|
+
style: {
|
|
38154
|
+
fontFamily: fairmintVars.fontHeadings,
|
|
38155
|
+
letterSpacing: "0.08em",
|
|
38156
|
+
lineHeight: 1
|
|
38157
|
+
},
|
|
38158
|
+
children: label
|
|
38159
|
+
}
|
|
38160
|
+
) : null;
|
|
38161
|
+
const gradientNameEl = /* @__PURE__ */ jsx(
|
|
38162
|
+
Text,
|
|
38163
|
+
{
|
|
38164
|
+
fw: 700,
|
|
38165
|
+
style: {
|
|
38166
|
+
fontFamily: fairmintVars.fontHeadings,
|
|
38167
|
+
fontSize: "1.375rem",
|
|
38168
|
+
lineHeight: 1.3,
|
|
38169
|
+
letterSpacing: "-0.025em",
|
|
38170
|
+
background: BRAND_GRADIENT,
|
|
38171
|
+
backgroundClip: "text",
|
|
38172
|
+
WebkitBackgroundClip: "text",
|
|
38173
|
+
// Firefox ignores -webkit-text-fill-color; `color: transparent`
|
|
38174
|
+
// is required for `background-clip: text` to show the gradient there.
|
|
38175
|
+
// Chrome/Safari still pick up WebkitTextFillColor (kept for historical safety).
|
|
38176
|
+
color: "transparent",
|
|
38177
|
+
WebkitTextFillColor: "transparent",
|
|
38178
|
+
wordBreak: "break-word"
|
|
38179
|
+
},
|
|
38180
|
+
children: companyName
|
|
38181
|
+
}
|
|
38182
|
+
);
|
|
38183
|
+
const hasDetail = detail != null && typeof detail !== "boolean";
|
|
38184
|
+
const detailEl = hasDetail ? /* @__PURE__ */ jsx(Text, { size: "sm", c: fairmintVars.colorTextSecondary, style: { lineHeight: 1.4 }, children: detail }) : null;
|
|
38185
|
+
if (companyLogoUrl) {
|
|
38186
|
+
return /* @__PURE__ */ jsxs(Box, { style: { display: "flex", alignItems: "stretch", gap: 16 }, children: [
|
|
38187
|
+
/* @__PURE__ */ jsx(
|
|
38188
|
+
Box,
|
|
38189
|
+
{
|
|
38190
|
+
style: {
|
|
38191
|
+
display: "flex",
|
|
38192
|
+
alignItems: "center",
|
|
38193
|
+
justifyContent: "center",
|
|
38194
|
+
paddingRight: 16,
|
|
38195
|
+
borderRight: `1px solid ${neutralColors[200]}`
|
|
38196
|
+
},
|
|
38197
|
+
children: /* @__PURE__ */ jsx(
|
|
38198
|
+
Avatar,
|
|
38199
|
+
{
|
|
38200
|
+
src: companyLogoUrl,
|
|
38201
|
+
alt: trimmedName ? `${trimmedName} logo` : "Company logo",
|
|
38202
|
+
radius: "xl",
|
|
38203
|
+
size: avatarSize,
|
|
38204
|
+
color: avatarColor,
|
|
38205
|
+
children: initials
|
|
38206
|
+
}
|
|
38207
|
+
)
|
|
38208
|
+
}
|
|
38209
|
+
),
|
|
38210
|
+
/* @__PURE__ */ jsxs(Stack, { gap: 2, justify: "center", style: { minWidth: 0 }, children: [
|
|
38211
|
+
labelEl,
|
|
38212
|
+
gradientNameEl,
|
|
38213
|
+
detailEl
|
|
38214
|
+
] })
|
|
38215
|
+
] });
|
|
38216
|
+
}
|
|
38217
|
+
return /* @__PURE__ */ jsxs(Stack, { align: "center", gap: 4, children: [
|
|
38218
|
+
labelEl,
|
|
38219
|
+
gradientNameEl,
|
|
38220
|
+
detailEl
|
|
38221
|
+
] });
|
|
38222
|
+
}
|
|
38117
38223
|
function ConfirmDialog({
|
|
38118
38224
|
title,
|
|
38119
38225
|
message,
|
|
@@ -40093,14 +40199,6 @@ function DocumentRow({
|
|
|
40093
40199
|
}
|
|
40094
40200
|
);
|
|
40095
40201
|
}
|
|
40096
|
-
function getAvatarColor(name) {
|
|
40097
|
-
if (!name) return AVATAR_PALETTE[0];
|
|
40098
|
-
let hash2 = 0;
|
|
40099
|
-
for (let i = 0; i < name.length; i++) {
|
|
40100
|
-
hash2 = hash2 * 31 + name.charCodeAt(i) >>> 0;
|
|
40101
|
-
}
|
|
40102
|
-
return AVATAR_PALETTE[hash2 % AVATAR_PALETTE.length];
|
|
40103
|
-
}
|
|
40104
40202
|
function EquityGrantCard({
|
|
40105
40203
|
companyName,
|
|
40106
40204
|
logoUrl,
|
|
@@ -40901,6 +40999,7 @@ export {
|
|
|
40901
40999
|
ClickableCard,
|
|
40902
41000
|
Collapse,
|
|
40903
41001
|
ColorDot,
|
|
41002
|
+
CompanyBanner,
|
|
40904
41003
|
ConfirmDialog,
|
|
40905
41004
|
Container,
|
|
40906
41005
|
Currency,
|
|
@@ -40991,6 +41090,7 @@ export {
|
|
|
40991
41090
|
formatPhoneDisplay,
|
|
40992
41091
|
formatPreciseWithCurrency,
|
|
40993
41092
|
getAvatarColor,
|
|
41093
|
+
getInitials,
|
|
40994
41094
|
getWalletDisplayName,
|
|
40995
41095
|
getWalletKindPill,
|
|
40996
41096
|
getWalletLabel,
|