@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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.60.1
4
+
5
+ - Ships the 1.60.0 `SectionIndexLayout` `collapsedKey` change; 1.60.0 never reached npm (its test used a wrong index testID).
6
+
7
+ ## 1.60.0
8
+
9
+ - MODC-1 D-MC-743 "S-7 owner sighting findings" F1. `SectionIndexLayout` takes `collapsedKey`: the section the collapsed (chips) layout opens on, so a screen whose primary section differs from its first index entry keeps it on screen below the index breakpoint. `initialKey` still marks the wide index. The picked key stays unset until the user picks, so resizing across the breakpoint follows the layout. Optional, default unchanged.
10
+
3
11
  ## 1.58.0
4
12
 
5
13
  - MODC-1 D-MC-728 "Layout gaps in the package". All new props optional, defaults unchanged.
package/dist/index.d.mts CHANGED
@@ -1240,6 +1240,7 @@ interface SectionIndexLayoutProps {
1240
1240
  indexHeading: string;
1241
1241
  itemHint: string;
1242
1242
  initialKey?: string;
1243
+ collapsedKey?: string;
1243
1244
  breakpoint?: number;
1244
1245
  density?: SectionDensity;
1245
1246
  stickyIndex?: boolean;
@@ -1248,7 +1249,7 @@ interface SectionIndexLayoutProps {
1248
1249
  activeColor?: string;
1249
1250
  testID?: string;
1250
1251
  }
1251
- declare const SectionIndexLayout: ({ sections, indexHeading, itemHint, initialKey, breakpoint, density, stickyIndex, chipOverflow, indexWidth, activeColor, testID, }: SectionIndexLayoutProps) => React.ReactElement;
1252
+ declare const SectionIndexLayout: ({ sections, indexHeading, itemHint, initialKey, collapsedKey, breakpoint, density, stickyIndex, chipOverflow, indexWidth, activeColor, testID, }: SectionIndexLayoutProps) => React.ReactElement;
1252
1253
 
1253
1254
  declare const SECTION_INDEX_WIDTH = 200;
1254
1255
  interface SectionIndexProps {
@@ -1343,14 +1344,17 @@ declare const StickyActionBar: ({ accessibilityLabel, accessibilityHint, childre
1343
1344
 
1344
1345
  interface PageHeadProps {
1345
1346
  title: string;
1347
+ /** A string is drawn in the secondary text style; any other node is drawn as given. */
1346
1348
  subtitle?: React.ReactNode;
1347
1349
  actions?: React.ReactNode;
1348
1350
  /** Focus the title when the page opens (FOCUS-1); default false. */
1349
1351
  initialFocus?: boolean;
1352
+ /** Phone head (22 px title, 12 px subtitle); default true below LAYOUT_COLLAPSE_BREAKPOINT. */
1353
+ compact?: boolean;
1350
1354
  testID?: string;
1351
1355
  }
1352
1356
  /** Page title row: heading and subtitle on the left, page actions on the right; actions wrap below on narrow screens. */
1353
- declare const PageHead: ({ title, subtitle, actions, initialFocus, testID }: PageHeadProps) => React.ReactElement;
1357
+ declare const PageHead: ({ title, subtitle, actions, initialFocus, compact, testID }: PageHeadProps) => React.ReactElement;
1354
1358
 
1355
1359
  interface TimelineEntry {
1356
1360
  key: string;
package/dist/index.d.ts CHANGED
@@ -1240,6 +1240,7 @@ interface SectionIndexLayoutProps {
1240
1240
  indexHeading: string;
1241
1241
  itemHint: string;
1242
1242
  initialKey?: string;
1243
+ collapsedKey?: string;
1243
1244
  breakpoint?: number;
1244
1245
  density?: SectionDensity;
1245
1246
  stickyIndex?: boolean;
@@ -1248,7 +1249,7 @@ interface SectionIndexLayoutProps {
1248
1249
  activeColor?: string;
1249
1250
  testID?: string;
1250
1251
  }
1251
- declare const SectionIndexLayout: ({ sections, indexHeading, itemHint, initialKey, breakpoint, density, stickyIndex, chipOverflow, indexWidth, activeColor, testID, }: SectionIndexLayoutProps) => React.ReactElement;
1252
+ declare const SectionIndexLayout: ({ sections, indexHeading, itemHint, initialKey, collapsedKey, breakpoint, density, stickyIndex, chipOverflow, indexWidth, activeColor, testID, }: SectionIndexLayoutProps) => React.ReactElement;
1252
1253
 
1253
1254
  declare const SECTION_INDEX_WIDTH = 200;
1254
1255
  interface SectionIndexProps {
@@ -1343,14 +1344,17 @@ declare const StickyActionBar: ({ accessibilityLabel, accessibilityHint, childre
1343
1344
 
1344
1345
  interface PageHeadProps {
1345
1346
  title: string;
1347
+ /** A string is drawn in the secondary text style; any other node is drawn as given. */
1346
1348
  subtitle?: React.ReactNode;
1347
1349
  actions?: React.ReactNode;
1348
1350
  /** Focus the title when the page opens (FOCUS-1); default false. */
1349
1351
  initialFocus?: boolean;
1352
+ /** Phone head (22 px title, 12 px subtitle); default true below LAYOUT_COLLAPSE_BREAKPOINT. */
1353
+ compact?: boolean;
1350
1354
  testID?: string;
1351
1355
  }
1352
1356
  /** Page title row: heading and subtitle on the left, page actions on the right; actions wrap below on narrow screens. */
1353
- declare const PageHead: ({ title, subtitle, actions, initialFocus, testID }: PageHeadProps) => React.ReactElement;
1357
+ declare const PageHead: ({ title, subtitle, actions, initialFocus, compact, testID }: PageHeadProps) => React.ReactElement;
1354
1358
 
1355
1359
  interface TimelineEntry {
1356
1360
  key: string;
package/dist/index.js CHANGED
@@ -3488,6 +3488,7 @@ var SectionIndexLayout = ({
3488
3488
  indexHeading,
3489
3489
  itemHint,
3490
3490
  initialKey,
3491
+ collapsedKey,
3491
3492
  breakpoint = SECTION_INDEX_BREAKPOINT,
3492
3493
  density = "comfortable" /* Comfortable */,
3493
3494
  stickyIndex = false,
@@ -3497,8 +3498,8 @@ var SectionIndexLayout = ({
3497
3498
  testID = "section-index"
3498
3499
  }) => {
3499
3500
  const wide = useIsWideViewport(breakpoint);
3500
- const [picked, setPicked] = React16.useState(initialKey);
3501
- const activeKey = resolveActiveKey(sections, picked);
3501
+ const [picked, setPicked] = React16.useState(void 0);
3502
+ const activeKey = resolveActiveKey(sections, picked ?? (wide ? initialKey : collapsedKey ?? initialKey));
3502
3503
  const gap = { gap: density === "dense" /* Dense */ ? DENSE_GAP : COMFORTABLE_GAP };
3503
3504
  if (sections.length < 2) return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID, children: sections[0]?.content });
3504
3505
  if (!wide) {
@@ -3642,21 +3643,29 @@ var StickyActionBar = ({
3642
3643
  var TITLE_BASIS = 280;
3643
3644
  var styles36 = reactNative.StyleSheet.create({
3644
3645
  row: { flexDirection: "row", flexWrap: "wrap", alignItems: "flex-start", justifyContent: "space-between", gap: 12 },
3646
+ rowCompact: { gap: 10 },
3645
3647
  text: { gap: 4, flexGrow: 1, flexShrink: 1, flexBasis: TITLE_BASIS, minWidth: 0 },
3648
+ textCompact: { gap: 2 },
3646
3649
  title: { fontSize: 24, fontWeight: "800" },
3650
+ titleCompact: { fontSize: 22, lineHeight: 26, fontWeight: "700" },
3651
+ subtitle: { fontSize: 14, lineHeight: 20 },
3652
+ subtitleCompact: { fontSize: 12, lineHeight: 16 },
3647
3653
  actions: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8, maxWidth: "100%" }
3648
3654
  });
3649
3655
  function hasContent(node) {
3650
3656
  return node !== void 0 && node !== null && node !== false;
3651
3657
  }
3652
- var PageHead = ({ title, subtitle, actions, initialFocus = false, testID = LAYOUT_TEST_IDS.pageHead }) => {
3658
+ var PageHead = ({ title, subtitle, actions, initialFocus = false, compact, testID = LAYOUT_TEST_IDS.pageHead }) => {
3653
3659
  const { colors } = uiFeedback.useUi().theme;
3660
+ const { width } = reactNative.useWindowDimensions();
3661
+ const isCompact = compact ?? width < LAYOUT_COLLAPSE_BREAKPOINT;
3654
3662
  const titleRef = rnWebHooks.useInitialFocus();
3655
3663
  const focusProps = initialFocus ? { ref: titleRef, ...rnWebHooks.INITIAL_FOCUS_PROPS } : {};
3656
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles36.row, testID, children: [
3657
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles36.text, children: [
3658
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { ...focusProps, accessibilityRole: "header", style: [styles36.title, { color: colors.text }], testID: `${testID}-title`, children: title }),
3659
- subtitle
3664
+ const subtitleNode = typeof subtitle === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [isCompact ? styles36.subtitleCompact : styles36.subtitle, { color: colors.textSecondary }], testID: `${testID}-subtitle`, children: subtitle }) : subtitle;
3665
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles36.row, isCompact ? styles36.rowCompact : null], testID, children: [
3666
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles36.text, isCompact ? styles36.textCompact : null], children: [
3667
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { ...focusProps, accessibilityRole: "header", style: [isCompact ? styles36.titleCompact : styles36.title, { color: colors.text }], testID: `${testID}-title`, children: title }),
3668
+ subtitleNode
3660
3669
  ] }),
3661
3670
  hasContent(actions) ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles36.actions, testID: `${testID}-actions`, children: actions }) : null
3662
3671
  ] });