@dloizides/ui-layout 1.54.0 → 1.55.2

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.55.2
4
+
5
+ - INV-QA-LOW-1 D-INV-QA-2 "Title heading role in the package". `AppText` with `TextKind.Title` renders `accessibilityRole="header"` and `aria-level` 1 (an `<h1>` on web), so screen titles are announced as headings. Other kinds unchanged.
6
+
3
7
  ## 1.54.0
4
8
 
5
9
  - MODC-1 D-MC-710 "Shared parts in packages", UI-PKG-FIRST-1. New `StickyActionBar`: page actions pinned to the bottom edge when narrow (web `position: sticky`, bottom padding 12 px + `bottomInset` + `env(safe-area-inset-bottom)`; native pads by the inset), an inline end-aligned row when wide (`breakpoint`, default 768); role toolbar with the caller's label. New `PageHead` (title + subtitle left, actions right, actions wrap below on narrow screens; testIDs `<id>-title`, `<id>-actions`). `DayCard` takes `badgeFill` (`DayBadgeFill` Solid, the default, or Tint: tone tint step 100 with deep ink, solid fallback) and `badgeIcon` (ui-icons name, e.g. `clock`); badge testID `<id>-badge`. `SectionIndexLayout` takes `indexWidth` (default `SECTION_INDEX_WIDTH` 200); `SectionIndex` takes `width`. `ToggleSection` takes controlled `open` + `onOpenChange`. `Section` takes `padding` (number or `{ vertical, horizontal }`). New export `resolveTintColors`. All additive; defaults unchanged.
package/dist/index.d.mts CHANGED
@@ -1308,22 +1308,25 @@ declare const ToggleSection: ({ wide, title, toggleLabel, toggleHint, forceOpen,
1308
1308
 
1309
1309
  interface StickyActionBarProps {
1310
1310
  accessibilityLabel: string;
1311
+ accessibilityHint?: string;
1311
1312
  children: React.ReactNode;
1312
1313
  breakpoint?: number;
1313
1314
  bottomInset?: number;
1314
1315
  testID?: string;
1315
1316
  }
1316
1317
  /** Page actions: pinned to the bottom edge above the safe area when narrow, an inline end-aligned row when wide. */
1317
- declare const StickyActionBar: ({ accessibilityLabel, children, breakpoint, bottomInset, testID, }: StickyActionBarProps) => React.ReactElement;
1318
+ declare const StickyActionBar: ({ accessibilityLabel, accessibilityHint, children, breakpoint, bottomInset, testID, }: StickyActionBarProps) => React.ReactElement;
1318
1319
 
1319
1320
  interface PageHeadProps {
1320
1321
  title: string;
1321
1322
  subtitle?: React.ReactNode;
1322
1323
  actions?: React.ReactNode;
1324
+ /** Focus the title when the page opens (FOCUS-1); default false. */
1325
+ initialFocus?: boolean;
1323
1326
  testID?: string;
1324
1327
  }
1325
1328
  /** Page title row: heading and subtitle on the left, page actions on the right; actions wrap below on narrow screens. */
1326
- declare const PageHead: ({ title, subtitle, actions, testID }: PageHeadProps) => React.ReactElement;
1329
+ declare const PageHead: ({ title, subtitle, actions, initialFocus, testID }: PageHeadProps) => React.ReactElement;
1327
1330
 
1328
1331
  interface TimelineEntry {
1329
1332
  key: string;
package/dist/index.d.ts CHANGED
@@ -1308,22 +1308,25 @@ declare const ToggleSection: ({ wide, title, toggleLabel, toggleHint, forceOpen,
1308
1308
 
1309
1309
  interface StickyActionBarProps {
1310
1310
  accessibilityLabel: string;
1311
+ accessibilityHint?: string;
1311
1312
  children: React.ReactNode;
1312
1313
  breakpoint?: number;
1313
1314
  bottomInset?: number;
1314
1315
  testID?: string;
1315
1316
  }
1316
1317
  /** Page actions: pinned to the bottom edge above the safe area when narrow, an inline end-aligned row when wide. */
1317
- declare const StickyActionBar: ({ accessibilityLabel, children, breakpoint, bottomInset, testID, }: StickyActionBarProps) => React.ReactElement;
1318
+ declare const StickyActionBar: ({ accessibilityLabel, accessibilityHint, children, breakpoint, bottomInset, testID, }: StickyActionBarProps) => React.ReactElement;
1318
1319
 
1319
1320
  interface PageHeadProps {
1320
1321
  title: string;
1321
1322
  subtitle?: React.ReactNode;
1322
1323
  actions?: React.ReactNode;
1324
+ /** Focus the title when the page opens (FOCUS-1); default false. */
1325
+ initialFocus?: boolean;
1323
1326
  testID?: string;
1324
1327
  }
1325
1328
  /** Page title row: heading and subtitle on the left, page actions on the right; actions wrap below on narrow screens. */
1326
- declare const PageHead: ({ title, subtitle, actions, testID }: PageHeadProps) => React.ReactElement;
1329
+ declare const PageHead: ({ title, subtitle, actions, initialFocus, testID }: PageHeadProps) => React.ReactElement;
1327
1330
 
1328
1331
  interface TimelineEntry {
1329
1332
  key: string;
package/dist/index.js CHANGED
@@ -198,6 +198,7 @@ var TextKind = /* @__PURE__ */ ((TextKind2) => {
198
198
  TextKind2["Small"] = "small";
199
199
  return TextKind2;
200
200
  })(TextKind || {});
201
+ var TITLE_HEADING_LEVEL = 1;
201
202
  var SIZES = {
202
203
  ["title" /* Title */]: { fontSize: 24, fontWeight: "700", lineHeight: 30 },
203
204
  ["heading" /* Heading */]: { fontSize: 17, fontWeight: "700", lineHeight: 24 },
@@ -215,9 +216,12 @@ var AppText = ({
215
216
  }) => {
216
217
  const { theme } = uiFeedback.useUi();
217
218
  const quiet = kind === "muted" /* Muted */ || kind === "small" /* Small */;
219
+ const isTitle = kind === "title" /* Title */;
218
220
  return /* @__PURE__ */ jsxRuntime.jsx(
219
221
  reactNative.Text,
220
222
  {
223
+ accessibilityRole: isTitle ? "header" : void 0,
224
+ "aria-level": isTitle ? TITLE_HEADING_LEVEL : void 0,
221
225
  style: [
222
226
  SIZES[kind],
223
227
  { color: color ?? (quiet ? theme.colors.textSecondary : theme.colors.text) },
@@ -3562,6 +3566,7 @@ var styles34 = reactNative.StyleSheet.create({
3562
3566
  });
3563
3567
  var StickyActionBar = ({
3564
3568
  accessibilityLabel,
3569
+ accessibilityHint,
3565
3570
  children,
3566
3571
  breakpoint = LAYOUT_COLLAPSE_BREAKPOINT,
3567
3572
  bottomInset = 0,
@@ -3569,9 +3574,9 @@ var StickyActionBar = ({
3569
3574
  }) => {
3570
3575
  const wide = useIsWideViewport(breakpoint);
3571
3576
  const { colors } = uiFeedback.useUi().theme;
3572
- if (wide) return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityLabel, role: "toolbar", style: styles34.inline, testID, children });
3577
+ if (wide) return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityHint, accessibilityLabel, role: "toolbar", style: styles34.inline, testID, children });
3573
3578
  const surface = { backgroundColor: colors.surface, borderTopColor: colors.border };
3574
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityLabel, role: "toolbar", style: [styles34.bar, surface, stickyEdgeStyle(reactNative.Platform.OS, bottomInset)], testID, children });
3579
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityHint, accessibilityLabel, role: "toolbar", style: [styles34.bar, surface, stickyEdgeStyle(reactNative.Platform.OS, bottomInset)], testID, children });
3575
3580
  };
3576
3581
  var TITLE_BASIS = 280;
3577
3582
  var styles35 = reactNative.StyleSheet.create({
@@ -3583,11 +3588,13 @@ var styles35 = reactNative.StyleSheet.create({
3583
3588
  function hasContent(node) {
3584
3589
  return node !== void 0 && node !== null && node !== false;
3585
3590
  }
3586
- var PageHead = ({ title, subtitle, actions, testID = LAYOUT_TEST_IDS.pageHead }) => {
3591
+ var PageHead = ({ title, subtitle, actions, initialFocus = false, testID = LAYOUT_TEST_IDS.pageHead }) => {
3587
3592
  const { colors } = uiFeedback.useUi().theme;
3593
+ const titleRef = rnWebHooks.useInitialFocus();
3594
+ const focusProps = initialFocus ? { ref: titleRef, ...rnWebHooks.INITIAL_FOCUS_PROPS } : {};
3588
3595
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles35.row, testID, children: [
3589
3596
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles35.text, children: [
3590
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { accessibilityRole: "header", style: [styles35.title, { color: colors.text }], testID: `${testID}-title`, children: title }),
3597
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { ...focusProps, accessibilityRole: "header", style: [styles35.title, { color: colors.text }], testID: `${testID}-title`, children: title }),
3591
3598
  subtitle
3592
3599
  ] }),
3593
3600
  hasContent(actions) ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles35.actions, testID: `${testID}-actions`, children: actions }) : null