@dloizides/ui-layout 1.60.2 → 1.61.0
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.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3427,16 +3427,17 @@ var SECTION_INDEX_WIDTH = 200;
|
|
|
3427
3427
|
var ACTIVE_BAR = 3;
|
|
3428
3428
|
var TRANSPARENT3 = "transparent";
|
|
3429
3429
|
var DENSE_TARGET_PX = 24;
|
|
3430
|
+
var DENSE_LINE = 19;
|
|
3430
3431
|
var styles30 = StyleSheet.create({
|
|
3431
3432
|
root: { flexShrink: 0, gap: 2, alignSelf: "flex-start" },
|
|
3432
3433
|
heading: { fontSize: 12, fontWeight: "700", letterSpacing: 0.6, textTransform: "uppercase", paddingHorizontal: 10, paddingBottom: 6 },
|
|
3433
3434
|
item: { minHeight: MIN_TARGET_PX, justifyContent: "center", paddingHorizontal: 10, borderLeftWidth: ACTIVE_BAR, borderRadius: 6 },
|
|
3434
3435
|
label: { fontSize: 14 },
|
|
3435
3436
|
labelActive: { fontWeight: "700" },
|
|
3436
|
-
denseRoot: { gap:
|
|
3437
|
-
denseHeading: { fontSize: 11, fontWeight: "600", paddingBottom:
|
|
3438
|
-
denseItem: { minHeight: DENSE_TARGET_PX, paddingVertical: 7,
|
|
3439
|
-
denseLabel: { fontSize: 13, lineHeight:
|
|
3437
|
+
denseRoot: { gap: 2 },
|
|
3438
|
+
denseHeading: { fontSize: 11, fontWeight: "600", letterSpacing: 0.66, lineHeight: 16, paddingBottom: 6 },
|
|
3439
|
+
denseItem: { minHeight: DENSE_TARGET_PX, paddingVertical: 6, paddingLeft: 7, paddingRight: 10, borderRadius: 7 },
|
|
3440
|
+
denseLabel: { fontSize: 13, lineHeight: DENSE_LINE },
|
|
3440
3441
|
denseLabelActive: { fontWeight: "600" }
|
|
3441
3442
|
});
|
|
3442
3443
|
function ariaCurrent(active) {
|
|
@@ -3485,12 +3486,17 @@ function scrollToSection(anchorId) {
|
|
|
3485
3486
|
}
|
|
3486
3487
|
var COMFORTABLE_GAP = 12;
|
|
3487
3488
|
var DENSE_GAP = 8;
|
|
3488
|
-
var DENSE_WIDE_GAP =
|
|
3489
|
+
var DENSE_WIDE_GAP = 16;
|
|
3489
3490
|
var WEB_STICKY = { position: "sticky", top: 0 };
|
|
3491
|
+
var NO_STACK = Number.POSITIVE_INFINITY;
|
|
3490
3492
|
var styles31 = StyleSheet.create({
|
|
3491
3493
|
wide: { flexDirection: "row", alignItems: "flex-start", gap: 20 },
|
|
3492
3494
|
column: { flex: 1, minWidth: 0 }
|
|
3493
3495
|
});
|
|
3496
|
+
function toFold(breakpoint) {
|
|
3497
|
+
return typeof breakpoint === "number" ? { wide: breakpoint, stackFrom: NO_STACK } : breakpoint;
|
|
3498
|
+
}
|
|
3499
|
+
var SectionColumn = ({ sections, testID, style }) => /* @__PURE__ */ jsx(View, { style, testID: `${testID}-column`, children: sections.map((entry) => /* @__PURE__ */ jsx(View, { nativeID: sectionAnchorId(testID, entry.key), testID: sectionAnchorId(testID, entry.key), children: entry.content }, entry.key)) });
|
|
3494
3500
|
var SectionIndexLayout = ({
|
|
3495
3501
|
sections,
|
|
3496
3502
|
indexHeading,
|
|
@@ -3505,12 +3511,15 @@ var SectionIndexLayout = ({
|
|
|
3505
3511
|
activeColor,
|
|
3506
3512
|
testID = "section-index"
|
|
3507
3513
|
}) => {
|
|
3508
|
-
const
|
|
3514
|
+
const fold = toFold(breakpoint);
|
|
3515
|
+
const wide = useIsWideViewport(fold.wide);
|
|
3516
|
+
const stacked = useIsWideViewport(fold.stackFrom);
|
|
3509
3517
|
const [picked, setPicked] = useState(void 0);
|
|
3510
3518
|
const activeKey = resolveActiveKey(sections, picked ?? (wide ? initialKey : collapsedKey ?? initialKey));
|
|
3511
3519
|
const dense = density === "dense" /* Dense */;
|
|
3512
3520
|
const gap = { gap: dense ? DENSE_GAP : COMFORTABLE_GAP };
|
|
3513
3521
|
if (sections.length < 2) return /* @__PURE__ */ jsx(View, { testID, children: sections[0]?.content });
|
|
3522
|
+
if (!wide && stacked) return /* @__PURE__ */ jsx(View, { testID, children: /* @__PURE__ */ jsx(SectionColumn, { sections, style: gap, testID }) });
|
|
3514
3523
|
if (!wide) {
|
|
3515
3524
|
const active = sections.find((entry) => entry.key === activeKey);
|
|
3516
3525
|
return /* @__PURE__ */ jsxs(View, { style: gap, testID, children: [
|
|
@@ -3538,7 +3547,7 @@ var SectionIndexLayout = ({
|
|
|
3538
3547
|
const sticky = stickyIndex && Platform.OS === "web" ? WEB_STICKY : null;
|
|
3539
3548
|
return /* @__PURE__ */ jsxs(View, { style: [styles31.wide, dense && { gap: DENSE_WIDE_GAP }], testID, children: [
|
|
3540
3549
|
/* @__PURE__ */ jsx(View, { style: sticky, children: /* @__PURE__ */ jsx(SectionIndex, { activeColor, activeKey, dense, heading: indexHeading, itemHint, sections, testID, width: indexWidth, onSelect: select }) }),
|
|
3541
|
-
/* @__PURE__ */ jsx(
|
|
3550
|
+
/* @__PURE__ */ jsx(SectionColumn, { sections, style: StyleSheet.flatten([styles31.column, gap]), testID })
|
|
3542
3551
|
] });
|
|
3543
3552
|
};
|
|
3544
3553
|
|