@dloizides/ui-layout 1.55.2 → 1.56.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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.56.0
4
+
5
+ - `SectionIndexLayout` takes `activeColor`: the fill of the active chip (narrow) and the bar of the active index item (wide). `SectionChips` and `SectionIndex` take it too. Default unchanged (theme `colors.text`).
6
+
3
7
  ## 1.55.2
4
8
 
5
9
  - 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.
package/dist/index.d.mts CHANGED
@@ -1232,9 +1232,10 @@ interface SectionIndexLayoutProps {
1232
1232
  stickyIndex?: boolean;
1233
1233
  chipOverflow?: ChipOverflow;
1234
1234
  indexWidth?: number;
1235
+ activeColor?: string;
1235
1236
  testID?: string;
1236
1237
  }
1237
- declare const SectionIndexLayout: ({ sections, indexHeading, itemHint, initialKey, breakpoint, density, stickyIndex, chipOverflow, indexWidth, testID, }: SectionIndexLayoutProps) => React.ReactElement;
1238
+ declare const SectionIndexLayout: ({ sections, indexHeading, itemHint, initialKey, breakpoint, density, stickyIndex, chipOverflow, indexWidth, activeColor, testID, }: SectionIndexLayoutProps) => React.ReactElement;
1238
1239
 
1239
1240
  declare const SECTION_INDEX_WIDTH = 200;
1240
1241
  interface SectionIndexProps {
@@ -1245,8 +1246,9 @@ interface SectionIndexProps {
1245
1246
  onSelect: (key: string) => void;
1246
1247
  testID: string;
1247
1248
  width?: number;
1249
+ activeColor?: string;
1248
1250
  }
1249
- declare const SectionIndex: ({ sections, activeKey, heading, itemHint, onSelect, testID, width }: SectionIndexProps) => React.ReactElement;
1251
+ declare const SectionIndex: ({ sections, activeKey, heading, itemHint, onSelect, testID, width, activeColor }: SectionIndexProps) => React.ReactElement;
1250
1252
 
1251
1253
  interface SectionChipsProps {
1252
1254
  sections: ReadonlyArray<SectionIndexEntry>;
@@ -1254,10 +1256,11 @@ interface SectionChipsProps {
1254
1256
  groupLabel: string;
1255
1257
  itemHint: string;
1256
1258
  overflow?: ChipOverflow;
1259
+ activeColor?: string;
1257
1260
  onSelect: (key: string) => void;
1258
1261
  testID: string;
1259
1262
  }
1260
- declare const SectionChips: ({ sections, activeKey, groupLabel, itemHint, overflow, onSelect, testID }: SectionChipsProps) => React.ReactElement;
1263
+ declare const SectionChips: ({ sections, activeKey, groupLabel, itemHint, overflow, activeColor, onSelect, testID }: SectionChipsProps) => React.ReactElement;
1261
1264
 
1262
1265
  declare const SECTION_INDEX_BREAKPOINT = 1024;
1263
1266
  declare function resolveActiveKey(sections: ReadonlyArray<SectionIndexEntry>, wanted: string | undefined): string;
package/dist/index.d.ts CHANGED
@@ -1232,9 +1232,10 @@ interface SectionIndexLayoutProps {
1232
1232
  stickyIndex?: boolean;
1233
1233
  chipOverflow?: ChipOverflow;
1234
1234
  indexWidth?: number;
1235
+ activeColor?: string;
1235
1236
  testID?: string;
1236
1237
  }
1237
- declare const SectionIndexLayout: ({ sections, indexHeading, itemHint, initialKey, breakpoint, density, stickyIndex, chipOverflow, indexWidth, testID, }: SectionIndexLayoutProps) => React.ReactElement;
1238
+ declare const SectionIndexLayout: ({ sections, indexHeading, itemHint, initialKey, breakpoint, density, stickyIndex, chipOverflow, indexWidth, activeColor, testID, }: SectionIndexLayoutProps) => React.ReactElement;
1238
1239
 
1239
1240
  declare const SECTION_INDEX_WIDTH = 200;
1240
1241
  interface SectionIndexProps {
@@ -1245,8 +1246,9 @@ interface SectionIndexProps {
1245
1246
  onSelect: (key: string) => void;
1246
1247
  testID: string;
1247
1248
  width?: number;
1249
+ activeColor?: string;
1248
1250
  }
1249
- declare const SectionIndex: ({ sections, activeKey, heading, itemHint, onSelect, testID, width }: SectionIndexProps) => React.ReactElement;
1251
+ declare const SectionIndex: ({ sections, activeKey, heading, itemHint, onSelect, testID, width, activeColor }: SectionIndexProps) => React.ReactElement;
1250
1252
 
1251
1253
  interface SectionChipsProps {
1252
1254
  sections: ReadonlyArray<SectionIndexEntry>;
@@ -1254,10 +1256,11 @@ interface SectionChipsProps {
1254
1256
  groupLabel: string;
1255
1257
  itemHint: string;
1256
1258
  overflow?: ChipOverflow;
1259
+ activeColor?: string;
1257
1260
  onSelect: (key: string) => void;
1258
1261
  testID: string;
1259
1262
  }
1260
- declare const SectionChips: ({ sections, activeKey, groupLabel, itemHint, overflow, onSelect, testID }: SectionChipsProps) => React.ReactElement;
1263
+ declare const SectionChips: ({ sections, activeKey, groupLabel, itemHint, overflow, activeColor, onSelect, testID }: SectionChipsProps) => React.ReactElement;
1261
1264
 
1262
1265
  declare const SECTION_INDEX_BREAKPOINT = 1024;
1263
1266
  declare function resolveActiveKey(sections: ReadonlyArray<SectionIndexEntry>, wanted: string | undefined): string;
package/dist/index.js CHANGED
@@ -3348,9 +3348,10 @@ var styles28 = reactNative.StyleSheet.create({
3348
3348
  function ariaSelected(selected) {
3349
3349
  return { "aria-selected": selected };
3350
3350
  }
3351
- var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wrap" /* Wrap */, onSelect, testID }) => {
3351
+ var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wrap" /* Wrap */, activeColor, onSelect, testID }) => {
3352
3352
  const { theme } = uiFeedback.useUi();
3353
3353
  const { colors } = theme;
3354
+ const fill = activeColor ?? colors.text;
3354
3355
  const scroll = overflow === "scroll" /* Scroll */;
3355
3356
  const row = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "tablist", accessibilityLabel: groupLabel, style: scroll ? styles28.scrollRow : styles28.root, testID: `${testID}-chips`, children: sections.map((entry) => {
3356
3357
  const active = entry.key === activeKey;
@@ -3361,7 +3362,7 @@ var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wra
3361
3362
  accessibilityRole: "tab",
3362
3363
  accessibilityLabel: entry.title,
3363
3364
  accessibilityHint: itemHint,
3364
- style: [styles28.chip, { borderColor: colors.border, backgroundColor: active ? colors.text : colors.background }],
3365
+ style: [styles28.chip, { borderColor: colors.border, backgroundColor: active ? fill : colors.background }],
3365
3366
  testID: `${testID}-chip-${entry.key}`,
3366
3367
  onPress: () => onSelect(entry.key),
3367
3368
  children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles28.label, { color: active ? colors.background : colors.text }], children: entry.title })
@@ -3391,9 +3392,10 @@ var styles29 = reactNative.StyleSheet.create({
3391
3392
  function ariaCurrent(active) {
3392
3393
  return active ? { "aria-current": "location" } : {};
3393
3394
  }
3394
- var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID, width = SECTION_INDEX_WIDTH }) => {
3395
+ var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID, width = SECTION_INDEX_WIDTH, activeColor }) => {
3395
3396
  const { theme } = uiFeedback.useUi();
3396
3397
  const { colors } = theme;
3398
+ const bar = activeColor ?? colors.text;
3397
3399
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { role: "navigation", accessibilityLabel: heading, style: [styles29.root, { width }], testID: `${testID}-index`, children: [
3398
3400
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles29.heading, { color: colors.textSecondary }], children: heading }),
3399
3401
  sections.map((entry) => {
@@ -3405,7 +3407,7 @@ var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID,
3405
3407
  accessibilityRole: "link",
3406
3408
  accessibilityLabel: entry.title,
3407
3409
  accessibilityHint: itemHint,
3408
- style: [styles29.item, { borderLeftColor: active ? colors.text : TRANSPARENT3, backgroundColor: active ? colors.surface : TRANSPARENT3 }],
3410
+ style: [styles29.item, { borderLeftColor: active ? bar : TRANSPARENT3, backgroundColor: active ? colors.surface : TRANSPARENT3 }],
3409
3411
  testID: `${testID}-index-${entry.key}`,
3410
3412
  onPress: () => onSelect(entry.key),
3411
3413
  children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles29.label, active && styles29.labelActive, { color: active ? colors.text : colors.textSecondary }], children: entry.title })
@@ -3448,6 +3450,7 @@ var SectionIndexLayout = ({
3448
3450
  stickyIndex = false,
3449
3451
  chipOverflow = "wrap" /* Wrap */,
3450
3452
  indexWidth = SECTION_INDEX_WIDTH,
3453
+ activeColor,
3451
3454
  testID = "section-index"
3452
3455
  }) => {
3453
3456
  const wide = useIsWideViewport(breakpoint);
@@ -3461,6 +3464,7 @@ var SectionIndexLayout = ({
3461
3464
  /* @__PURE__ */ jsxRuntime.jsx(
3462
3465
  SectionChips,
3463
3466
  {
3467
+ activeColor,
3464
3468
  activeKey,
3465
3469
  groupLabel: indexHeading,
3466
3470
  itemHint,
@@ -3479,7 +3483,7 @@ var SectionIndexLayout = ({
3479
3483
  };
3480
3484
  const sticky = stickyIndex && reactNative.Platform.OS === "web" ? WEB_STICKY : null;
3481
3485
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles30.wide, testID, children: [
3482
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: sticky, children: /* @__PURE__ */ jsxRuntime.jsx(SectionIndex, { activeKey, heading: indexHeading, itemHint, sections, testID, width: indexWidth, onSelect: select }) }),
3486
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: sticky, children: /* @__PURE__ */ jsxRuntime.jsx(SectionIndex, { activeColor, activeKey, heading: indexHeading, itemHint, sections, testID, width: indexWidth, onSelect: select }) }),
3483
3487
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles30.column, gap], children: sections.map((entry) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { nativeID: sectionAnchorId(testID, entry.key), testID: sectionAnchorId(testID, entry.key), children: entry.content }, entry.key)) })
3484
3488
  ] });
3485
3489
  };