@ai-matrx/design-system 0.86.364 → 0.86.365
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/CHANGELOG.md +10 -2
- package/dist/index.cjs +52 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +52 -10
- package/dist/index.js.map +1 -1
- package/dist/swipe-deck.cjs +12 -3
- package/dist/swipe-deck.cjs.map +1 -1
- package/dist/swipe-deck.css +6 -0
- package/dist/swipe-deck.d.cts +11 -0
- package/dist/swipe-deck.d.ts +11 -0
- package/dist/swipe-deck.js +12 -3
- package/dist/swipe-deck.js.map +1 -1
- package/package.json +2 -2
package/dist/swipe-deck.cjs
CHANGED
|
@@ -469,6 +469,10 @@ function fitText(box, inner, text2, min, max) {
|
|
|
469
469
|
else box.removeAttribute("data-sd-overflow");
|
|
470
470
|
return size;
|
|
471
471
|
}
|
|
472
|
+
function markOverflow(box, inner) {
|
|
473
|
+
if (inner.offsetHeight > box.clientHeight + 1) box.setAttribute("data-sd-overflow", "");
|
|
474
|
+
else box.removeAttribute("data-sd-overflow");
|
|
475
|
+
}
|
|
472
476
|
function keepFitted(box, run) {
|
|
473
477
|
run();
|
|
474
478
|
let alive = true;
|
|
@@ -2416,7 +2420,8 @@ function SwipeDeck(props) {
|
|
|
2416
2420
|
conflict,
|
|
2417
2421
|
labels,
|
|
2418
2422
|
suggestedDir,
|
|
2419
|
-
more: cardMoreShown,
|
|
2423
|
+
more: props.moreOnCard === false ? [] : cardMoreShown,
|
|
2424
|
+
titleSize: props.titleSize ?? "fit",
|
|
2420
2425
|
detail: detailNow,
|
|
2421
2426
|
onDetail: (d) => setCardDetail({ id: step.item.id, detail: d }),
|
|
2422
2427
|
body: cardContext && props.renderCardBody ? props.renderCardBody(cardContext) : null,
|
|
@@ -2516,6 +2521,7 @@ function CardView({
|
|
|
2516
2521
|
onChoose,
|
|
2517
2522
|
more,
|
|
2518
2523
|
onChooseMore,
|
|
2524
|
+
titleSize,
|
|
2519
2525
|
detail,
|
|
2520
2526
|
onDetail,
|
|
2521
2527
|
body,
|
|
@@ -2548,9 +2554,11 @@ function CardView({
|
|
|
2548
2554
|
const box = layer.current;
|
|
2549
2555
|
if (!box || !inner.current || !hero.current) return;
|
|
2550
2556
|
return keepFitted(box, () => {
|
|
2551
|
-
if (inner.current
|
|
2557
|
+
if (!inner.current || !hero.current) return;
|
|
2558
|
+
if (titleSize === "fit") fitText(box, inner.current, hero.current, 20, heroMax(box));
|
|
2559
|
+
else markOverflow(box, inner.current);
|
|
2552
2560
|
});
|
|
2553
|
-
}, [item.text, partsKey, item.members?.length, more.length]);
|
|
2561
|
+
}, [item.text, partsKey, item.members?.length, more.length, titleSize]);
|
|
2554
2562
|
const nodes = [];
|
|
2555
2563
|
for (let i = 0; i < tokens.length; ) {
|
|
2556
2564
|
const p = parts.find((x) => x.start === i);
|
|
@@ -2581,6 +2589,7 @@ function CardView({
|
|
|
2581
2589
|
ref: layer,
|
|
2582
2590
|
className: "matrx-sd-layer",
|
|
2583
2591
|
"data-sd-item": item.id,
|
|
2592
|
+
"data-sd-title": titleSize === "page" ? "page" : void 0,
|
|
2584
2593
|
"aria-label": [item.kicker, item.text].filter(Boolean).join(": "),
|
|
2585
2594
|
onDoubleClick: (e) => {
|
|
2586
2595
|
const t = e.target instanceof Element ? e.target.closest("[data-sd-t]") : null;
|