@dloizides/ui-layout 1.58.0 → 1.60.1

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.mjs CHANGED
@@ -3482,6 +3482,7 @@ var SectionIndexLayout = ({
3482
3482
  indexHeading,
3483
3483
  itemHint,
3484
3484
  initialKey,
3485
+ collapsedKey,
3485
3486
  breakpoint = SECTION_INDEX_BREAKPOINT,
3486
3487
  density = "comfortable" /* Comfortable */,
3487
3488
  stickyIndex = false,
@@ -3491,8 +3492,8 @@ var SectionIndexLayout = ({
3491
3492
  testID = "section-index"
3492
3493
  }) => {
3493
3494
  const wide = useIsWideViewport(breakpoint);
3494
- const [picked, setPicked] = useState(initialKey);
3495
- const activeKey = resolveActiveKey(sections, picked);
3495
+ const [picked, setPicked] = useState(void 0);
3496
+ const activeKey = resolveActiveKey(sections, picked ?? (wide ? initialKey : collapsedKey ?? initialKey));
3496
3497
  const gap = { gap: density === "dense" /* Dense */ ? DENSE_GAP : COMFORTABLE_GAP };
3497
3498
  if (sections.length < 2) return /* @__PURE__ */ jsx(View, { testID, children: sections[0]?.content });
3498
3499
  if (!wide) {
@@ -3636,21 +3637,29 @@ var StickyActionBar = ({
3636
3637
  var TITLE_BASIS = 280;
3637
3638
  var styles36 = StyleSheet.create({
3638
3639
  row: { flexDirection: "row", flexWrap: "wrap", alignItems: "flex-start", justifyContent: "space-between", gap: 12 },
3640
+ rowCompact: { gap: 10 },
3639
3641
  text: { gap: 4, flexGrow: 1, flexShrink: 1, flexBasis: TITLE_BASIS, minWidth: 0 },
3642
+ textCompact: { gap: 2 },
3640
3643
  title: { fontSize: 24, fontWeight: "800" },
3644
+ titleCompact: { fontSize: 22, lineHeight: 26, fontWeight: "700" },
3645
+ subtitle: { fontSize: 14, lineHeight: 20 },
3646
+ subtitleCompact: { fontSize: 12, lineHeight: 16 },
3641
3647
  actions: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8, maxWidth: "100%" }
3642
3648
  });
3643
3649
  function hasContent(node) {
3644
3650
  return node !== void 0 && node !== null && node !== false;
3645
3651
  }
3646
- var PageHead = ({ title, subtitle, actions, initialFocus = false, testID = LAYOUT_TEST_IDS.pageHead }) => {
3652
+ var PageHead = ({ title, subtitle, actions, initialFocus = false, compact, testID = LAYOUT_TEST_IDS.pageHead }) => {
3647
3653
  const { colors } = useUi().theme;
3654
+ const { width } = useWindowDimensions();
3655
+ const isCompact = compact ?? width < LAYOUT_COLLAPSE_BREAKPOINT;
3648
3656
  const titleRef = useInitialFocus();
3649
3657
  const focusProps = initialFocus ? { ref: titleRef, ...INITIAL_FOCUS_PROPS } : {};
3650
- return /* @__PURE__ */ jsxs(View, { style: styles36.row, testID, children: [
3651
- /* @__PURE__ */ jsxs(View, { style: styles36.text, children: [
3652
- /* @__PURE__ */ jsx(Text, { ...focusProps, accessibilityRole: "header", style: [styles36.title, { color: colors.text }], testID: `${testID}-title`, children: title }),
3653
- subtitle
3658
+ const subtitleNode = typeof subtitle === "string" ? /* @__PURE__ */ jsx(Text, { style: [isCompact ? styles36.subtitleCompact : styles36.subtitle, { color: colors.textSecondary }], testID: `${testID}-subtitle`, children: subtitle }) : subtitle;
3659
+ return /* @__PURE__ */ jsxs(View, { style: [styles36.row, isCompact ? styles36.rowCompact : null], testID, children: [
3660
+ /* @__PURE__ */ jsxs(View, { style: [styles36.text, isCompact ? styles36.textCompact : null], children: [
3661
+ /* @__PURE__ */ jsx(Text, { ...focusProps, accessibilityRole: "header", style: [isCompact ? styles36.titleCompact : styles36.title, { color: colors.text }], testID: `${testID}-title`, children: title }),
3662
+ subtitleNode
3654
3663
  ] }),
3655
3664
  hasContent(actions) ? /* @__PURE__ */ jsx(View, { style: styles36.actions, testID: `${testID}-actions`, children: actions }) : null
3656
3665
  ] });