@fairmint/ui 0.2.32 → 0.2.33
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/specific/EquityRibbonChart/EquityRibbonChart.d.ts +12 -1
- package/dist/components/specific/EquityRibbonChart/EquityRibbonChart.d.ts.map +1 -1
- package/dist/components/specific/EquityRibbonChart/FairmintRibbonMark.d.ts +3 -1
- package/dist/components/specific/EquityRibbonChart/FairmintRibbonMark.d.ts.map +1 -1
- package/dist/components/specific/EquityRibbonChart/ribbonGeometry.d.ts +19 -1
- package/dist/components/specific/EquityRibbonChart/ribbonGeometry.d.ts.map +1 -1
- package/dist/fairmint-ui.cjs +58 -5
- package/dist/fairmint-ui.cjs.map +1 -1
- package/dist/fairmint-ui.js +58 -5
- package/dist/fairmint-ui.js.map +1 -1
- package/dist/styles.css +6 -12
- package/package.json +1 -1
package/dist/fairmint-ui.js
CHANGED
|
@@ -45022,6 +45022,8 @@ const DEFAULT_RIBBON_CONFIG = {
|
|
|
45022
45022
|
samples: 72
|
|
45023
45023
|
};
|
|
45024
45024
|
const MARK_RIBBON_RIGHT_EDGE = 0.936;
|
|
45025
|
+
const HERO_WIDE_TOP_END = DEFAULT_RIBBON_CONFIG.xEndDraw[DEFAULT_RIBBON_CONFIG.xEndDraw.length - 1];
|
|
45026
|
+
const RIBBON_END_STAGGER_X = DEFAULT_RIBBON_CONFIG.xEndStagger * 1e3 / (1e3 - 500);
|
|
45025
45027
|
const MARK_FIT_HORIZONTAL_COMPRESS = 0.78;
|
|
45026
45028
|
const MARK_RIBBON_CONFIG = {
|
|
45027
45029
|
...DEFAULT_RIBBON_CONFIG,
|
|
@@ -45140,6 +45142,45 @@ function clampBandCount(count2, max2 = 5) {
|
|
|
45140
45142
|
if (!Number.isFinite(count2)) return max2;
|
|
45141
45143
|
return Math.min(max2, Math.max(1, Math.round(count2)));
|
|
45142
45144
|
}
|
|
45145
|
+
function resolveChartGeometryWidth(containerWidth, containerHeight, chartWidth) {
|
|
45146
|
+
const layoutWidth = Number.isFinite(containerWidth) && containerWidth > 0 ? containerWidth : 0;
|
|
45147
|
+
const layoutHeight = Number.isFinite(containerHeight) && containerHeight > 0 ? containerHeight : 0;
|
|
45148
|
+
if (chartWidth != null && Number.isFinite(chartWidth) && chartWidth > 0) {
|
|
45149
|
+
const nominal = Math.max(chartWidth, layoutHeight);
|
|
45150
|
+
if (layoutWidth > 0) {
|
|
45151
|
+
return Math.min(nominal, layoutWidth);
|
|
45152
|
+
}
|
|
45153
|
+
return nominal;
|
|
45154
|
+
}
|
|
45155
|
+
if (layoutWidth > 0) {
|
|
45156
|
+
return layoutWidth;
|
|
45157
|
+
}
|
|
45158
|
+
return layoutHeight;
|
|
45159
|
+
}
|
|
45160
|
+
function nominalChartWidthPx(chartWidth, renderedHeightPx) {
|
|
45161
|
+
const heightPx = Number.isFinite(renderedHeightPx) && renderedHeightPx > 0 ? renderedHeightPx : 0;
|
|
45162
|
+
return Math.max(chartWidth, heightPx);
|
|
45163
|
+
}
|
|
45164
|
+
function ribbonEndStaggerNorm(chartWidth, height) {
|
|
45165
|
+
const w = Math.max(chartWidth, height);
|
|
45166
|
+
if (w <= height) return 0;
|
|
45167
|
+
const intPx = (w - height) * RIBBON_END_STAGGER_X;
|
|
45168
|
+
return intPx / w;
|
|
45169
|
+
}
|
|
45170
|
+
function buildStaggeredEndDraw(bandCount, chartWidth, height) {
|
|
45171
|
+
const validBandCount = clampBandCount(bandCount);
|
|
45172
|
+
const intNorm = ribbonEndStaggerNorm(chartWidth, height);
|
|
45173
|
+
const t = DEFAULT_RIBBON_CONFIG.xEndStagger > 0 ? Math.min(1, intNorm / DEFAULT_RIBBON_CONFIG.xEndStagger) : 0;
|
|
45174
|
+
const rightAnchor = MARK_RIBBON_RIGHT_EDGE - t * (MARK_RIBBON_RIGHT_EDGE - HERO_WIDE_TOP_END);
|
|
45175
|
+
const last = validBandCount - 1;
|
|
45176
|
+
return Array.from({ length: validBandCount }, (_, i) => rightAnchor - (last - i) * intNorm);
|
|
45177
|
+
}
|
|
45178
|
+
function configWithChartDimensions(base, chartWidth, height) {
|
|
45179
|
+
return {
|
|
45180
|
+
...base,
|
|
45181
|
+
xEndDraw: buildStaggeredEndDraw(base.xStart.length, chartWidth, height)
|
|
45182
|
+
};
|
|
45183
|
+
}
|
|
45143
45184
|
function buildRibbonGeometry(width, height, labels, config2 = DEFAULT_RIBBON_CONFIG, bandCount = config2.xStart.length, layout = "hero") {
|
|
45144
45185
|
const totalBands = config2.xStart.length;
|
|
45145
45186
|
const visibleBands = clampBandCount(bandCount, totalBands);
|
|
@@ -45253,10 +45294,12 @@ function EquityRibbonChart({
|
|
|
45253
45294
|
animated = true,
|
|
45254
45295
|
hideLabels = false,
|
|
45255
45296
|
background = "transparent",
|
|
45297
|
+
gapColor,
|
|
45256
45298
|
layout = "hero",
|
|
45257
45299
|
labelColor = ribbonChartLabelDefault,
|
|
45258
45300
|
className,
|
|
45259
45301
|
height,
|
|
45302
|
+
chartWidth,
|
|
45260
45303
|
style
|
|
45261
45304
|
}) {
|
|
45262
45305
|
const bandCount = clampBandCount(bandCountProp);
|
|
@@ -45286,11 +45329,13 @@ function EquityRibbonChart({
|
|
|
45286
45329
|
cancelRevealAnimation();
|
|
45287
45330
|
const el = rootRef.current;
|
|
45288
45331
|
if (!el) return;
|
|
45289
|
-
const
|
|
45332
|
+
const containerWidth = el.clientWidth;
|
|
45290
45333
|
const heightPx = el.clientHeight;
|
|
45291
|
-
const
|
|
45334
|
+
const geometryWidth = resolveChartGeometryWidth(containerWidth, heightPx, chartWidth);
|
|
45335
|
+
const baseConfig = layout === "mark" ? MARK_RIBBON_CONFIG : DEFAULT_RIBBON_CONFIG;
|
|
45336
|
+
const config2 = configWithChartDimensions(baseConfig, geometryWidth, heightPx);
|
|
45292
45337
|
const built = buildRibbonGeometry(
|
|
45293
|
-
|
|
45338
|
+
geometryWidth,
|
|
45294
45339
|
heightPx,
|
|
45295
45340
|
labelsRef.current,
|
|
45296
45341
|
config2,
|
|
@@ -45307,7 +45352,7 @@ function EquityRibbonChart({
|
|
|
45307
45352
|
}))
|
|
45308
45353
|
);
|
|
45309
45354
|
}
|
|
45310
|
-
}, [animated, bandCount, cancelRevealAnimation, labelsKey, layout]);
|
|
45355
|
+
}, [animated, bandCount, cancelRevealAnimation, chartWidth, labelsKey, layout]);
|
|
45311
45356
|
useLayoutEffect(() => {
|
|
45312
45357
|
playedRef.current = false;
|
|
45313
45358
|
revealScheduleRef.current = 0;
|
|
@@ -45414,17 +45459,23 @@ function EquityRibbonChart({
|
|
|
45414
45459
|
}, [geometry, runReveal]);
|
|
45415
45460
|
const suppressLabels = hideLabels || layout === "mark";
|
|
45416
45461
|
const activeGeometry = geometry && geometry.bandCount === bandCount ? geometry : null;
|
|
45462
|
+
const hasExplicitWidth = chartWidth != null && Number.isFinite(chartWidth) && chartWidth > 0;
|
|
45417
45463
|
const rootClass = [
|
|
45418
45464
|
"fairmint-equity-ribbon",
|
|
45419
45465
|
RIBBON_BACKGROUND_CLASS[background],
|
|
45420
45466
|
layout === "mark" ? "fairmint-equity-ribbon--layout-mark" : "",
|
|
45467
|
+
hasExplicitWidth ? "fairmint-equity-ribbon--has-chart-width" : "",
|
|
45421
45468
|
suppressLabels ? "fairmint-equity-ribbon--hidden-labels" : "",
|
|
45422
45469
|
className ?? ""
|
|
45423
45470
|
].filter(Boolean).join(" ");
|
|
45471
|
+
const resolvedGapColor = gapColor ?? (background === "white" ? ribbonChartSurface.white : background === "black" ? ribbonChartSurface.black : ribbonChartSurface.black);
|
|
45472
|
+
const nominalWidthPx = hasExplicitWidth && chartWidth ? nominalChartWidthPx(chartWidth, activeGeometry?.height ?? 0) : null;
|
|
45424
45473
|
const rootStyle = {
|
|
45425
45474
|
...RIBBON_SURFACE_CSS_VARS,
|
|
45475
|
+
"--fairmint-ribbon-gap-color": resolvedGapColor,
|
|
45426
45476
|
...style,
|
|
45427
|
-
...height ? { height } : {}
|
|
45477
|
+
...height ? { height } : {},
|
|
45478
|
+
...nominalWidthPx != null ? { "--fairmint-ribbon-nominal-width": `${nominalWidthPx}px` } : {}
|
|
45428
45479
|
};
|
|
45429
45480
|
return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: rootClass, style: rootStyle, children: [
|
|
45430
45481
|
/* @__PURE__ */ jsxs(
|
|
@@ -45497,6 +45548,7 @@ function FairmintRibbonMark({
|
|
|
45497
45548
|
bandCount = 5,
|
|
45498
45549
|
gradients,
|
|
45499
45550
|
background = "black",
|
|
45551
|
+
gapColor,
|
|
45500
45552
|
labelColor,
|
|
45501
45553
|
className,
|
|
45502
45554
|
style
|
|
@@ -45508,6 +45560,7 @@ function FairmintRibbonMark({
|
|
|
45508
45560
|
bandCount,
|
|
45509
45561
|
gradients,
|
|
45510
45562
|
background,
|
|
45563
|
+
gapColor,
|
|
45511
45564
|
labelColor,
|
|
45512
45565
|
layout: "mark",
|
|
45513
45566
|
animated: false,
|