@dloizides/ui-layout 1.58.0 → 1.59.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 CHANGED
@@ -1343,14 +1343,17 @@ declare const StickyActionBar: ({ accessibilityLabel, accessibilityHint, childre
1343
1343
 
1344
1344
  interface PageHeadProps {
1345
1345
  title: string;
1346
+ /** A string is drawn in the secondary text style; any other node is drawn as given. */
1346
1347
  subtitle?: React.ReactNode;
1347
1348
  actions?: React.ReactNode;
1348
1349
  /** Focus the title when the page opens (FOCUS-1); default false. */
1349
1350
  initialFocus?: boolean;
1351
+ /** Phone head (22 px title, 12 px subtitle); default true below LAYOUT_COLLAPSE_BREAKPOINT. */
1352
+ compact?: boolean;
1350
1353
  testID?: string;
1351
1354
  }
1352
1355
  /** 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;
1356
+ declare const PageHead: ({ title, subtitle, actions, initialFocus, compact, testID }: PageHeadProps) => React.ReactElement;
1354
1357
 
1355
1358
  interface TimelineEntry {
1356
1359
  key: string;
package/dist/index.d.ts CHANGED
@@ -1343,14 +1343,17 @@ declare const StickyActionBar: ({ accessibilityLabel, accessibilityHint, childre
1343
1343
 
1344
1344
  interface PageHeadProps {
1345
1345
  title: string;
1346
+ /** A string is drawn in the secondary text style; any other node is drawn as given. */
1346
1347
  subtitle?: React.ReactNode;
1347
1348
  actions?: React.ReactNode;
1348
1349
  /** Focus the title when the page opens (FOCUS-1); default false. */
1349
1350
  initialFocus?: boolean;
1351
+ /** Phone head (22 px title, 12 px subtitle); default true below LAYOUT_COLLAPSE_BREAKPOINT. */
1352
+ compact?: boolean;
1350
1353
  testID?: string;
1351
1354
  }
1352
1355
  /** 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;
1356
+ declare const PageHead: ({ title, subtitle, actions, initialFocus, compact, testID }: PageHeadProps) => React.ReactElement;
1354
1357
 
1355
1358
  interface TimelineEntry {
1356
1359
  key: string;
package/dist/index.js CHANGED
@@ -3642,21 +3642,29 @@ var StickyActionBar = ({
3642
3642
  var TITLE_BASIS = 280;
3643
3643
  var styles36 = reactNative.StyleSheet.create({
3644
3644
  row: { flexDirection: "row", flexWrap: "wrap", alignItems: "flex-start", justifyContent: "space-between", gap: 12 },
3645
+ rowCompact: { gap: 10 },
3645
3646
  text: { gap: 4, flexGrow: 1, flexShrink: 1, flexBasis: TITLE_BASIS, minWidth: 0 },
3647
+ textCompact: { gap: 2 },
3646
3648
  title: { fontSize: 24, fontWeight: "800" },
3649
+ titleCompact: { fontSize: 22, lineHeight: 26, fontWeight: "700" },
3650
+ subtitle: { fontSize: 14, lineHeight: 20 },
3651
+ subtitleCompact: { fontSize: 12, lineHeight: 16 },
3647
3652
  actions: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8, maxWidth: "100%" }
3648
3653
  });
3649
3654
  function hasContent(node) {
3650
3655
  return node !== void 0 && node !== null && node !== false;
3651
3656
  }
3652
- var PageHead = ({ title, subtitle, actions, initialFocus = false, testID = LAYOUT_TEST_IDS.pageHead }) => {
3657
+ var PageHead = ({ title, subtitle, actions, initialFocus = false, compact, testID = LAYOUT_TEST_IDS.pageHead }) => {
3653
3658
  const { colors } = uiFeedback.useUi().theme;
3659
+ const { width } = reactNative.useWindowDimensions();
3660
+ const isCompact = compact ?? width < LAYOUT_COLLAPSE_BREAKPOINT;
3654
3661
  const titleRef = rnWebHooks.useInitialFocus();
3655
3662
  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
3663
+ 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;
3664
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles36.row, isCompact ? styles36.rowCompact : null], testID, children: [
3665
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles36.text, isCompact ? styles36.textCompact : null], children: [
3666
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { ...focusProps, accessibilityRole: "header", style: [isCompact ? styles36.titleCompact : styles36.title, { color: colors.text }], testID: `${testID}-title`, children: title }),
3667
+ subtitleNode
3660
3668
  ] }),
3661
3669
  hasContent(actions) ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles36.actions, testID: `${testID}-actions`, children: actions }) : null
3662
3670
  ] });