@dloizides/ui-layout 1.55.1 → 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 +8 -0
- package/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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
|
+
|
|
7
|
+
## 1.55.2
|
|
8
|
+
|
|
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.
|
|
10
|
+
|
|
3
11
|
## 1.54.0
|
|
4
12
|
|
|
5
13
|
- 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
|
@@ -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
|
@@ -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) },
|
|
@@ -3344,9 +3348,10 @@ var styles28 = reactNative.StyleSheet.create({
|
|
|
3344
3348
|
function ariaSelected(selected) {
|
|
3345
3349
|
return { "aria-selected": selected };
|
|
3346
3350
|
}
|
|
3347
|
-
var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wrap" /* Wrap */, onSelect, testID }) => {
|
|
3351
|
+
var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wrap" /* Wrap */, activeColor, onSelect, testID }) => {
|
|
3348
3352
|
const { theme } = uiFeedback.useUi();
|
|
3349
3353
|
const { colors } = theme;
|
|
3354
|
+
const fill = activeColor ?? colors.text;
|
|
3350
3355
|
const scroll = overflow === "scroll" /* Scroll */;
|
|
3351
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) => {
|
|
3352
3357
|
const active = entry.key === activeKey;
|
|
@@ -3357,7 +3362,7 @@ var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wra
|
|
|
3357
3362
|
accessibilityRole: "tab",
|
|
3358
3363
|
accessibilityLabel: entry.title,
|
|
3359
3364
|
accessibilityHint: itemHint,
|
|
3360
|
-
style: [styles28.chip, { borderColor: colors.border, backgroundColor: active ?
|
|
3365
|
+
style: [styles28.chip, { borderColor: colors.border, backgroundColor: active ? fill : colors.background }],
|
|
3361
3366
|
testID: `${testID}-chip-${entry.key}`,
|
|
3362
3367
|
onPress: () => onSelect(entry.key),
|
|
3363
3368
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles28.label, { color: active ? colors.background : colors.text }], children: entry.title })
|
|
@@ -3387,9 +3392,10 @@ var styles29 = reactNative.StyleSheet.create({
|
|
|
3387
3392
|
function ariaCurrent(active) {
|
|
3388
3393
|
return active ? { "aria-current": "location" } : {};
|
|
3389
3394
|
}
|
|
3390
|
-
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 }) => {
|
|
3391
3396
|
const { theme } = uiFeedback.useUi();
|
|
3392
3397
|
const { colors } = theme;
|
|
3398
|
+
const bar = activeColor ?? colors.text;
|
|
3393
3399
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { role: "navigation", accessibilityLabel: heading, style: [styles29.root, { width }], testID: `${testID}-index`, children: [
|
|
3394
3400
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles29.heading, { color: colors.textSecondary }], children: heading }),
|
|
3395
3401
|
sections.map((entry) => {
|
|
@@ -3401,7 +3407,7 @@ var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID,
|
|
|
3401
3407
|
accessibilityRole: "link",
|
|
3402
3408
|
accessibilityLabel: entry.title,
|
|
3403
3409
|
accessibilityHint: itemHint,
|
|
3404
|
-
style: [styles29.item, { borderLeftColor: active ?
|
|
3410
|
+
style: [styles29.item, { borderLeftColor: active ? bar : TRANSPARENT3, backgroundColor: active ? colors.surface : TRANSPARENT3 }],
|
|
3405
3411
|
testID: `${testID}-index-${entry.key}`,
|
|
3406
3412
|
onPress: () => onSelect(entry.key),
|
|
3407
3413
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles29.label, active && styles29.labelActive, { color: active ? colors.text : colors.textSecondary }], children: entry.title })
|
|
@@ -3444,6 +3450,7 @@ var SectionIndexLayout = ({
|
|
|
3444
3450
|
stickyIndex = false,
|
|
3445
3451
|
chipOverflow = "wrap" /* Wrap */,
|
|
3446
3452
|
indexWidth = SECTION_INDEX_WIDTH,
|
|
3453
|
+
activeColor,
|
|
3447
3454
|
testID = "section-index"
|
|
3448
3455
|
}) => {
|
|
3449
3456
|
const wide = useIsWideViewport(breakpoint);
|
|
@@ -3457,6 +3464,7 @@ var SectionIndexLayout = ({
|
|
|
3457
3464
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3458
3465
|
SectionChips,
|
|
3459
3466
|
{
|
|
3467
|
+
activeColor,
|
|
3460
3468
|
activeKey,
|
|
3461
3469
|
groupLabel: indexHeading,
|
|
3462
3470
|
itemHint,
|
|
@@ -3475,7 +3483,7 @@ var SectionIndexLayout = ({
|
|
|
3475
3483
|
};
|
|
3476
3484
|
const sticky = stickyIndex && reactNative.Platform.OS === "web" ? WEB_STICKY : null;
|
|
3477
3485
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles30.wide, testID, children: [
|
|
3478
|
-
/* @__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 }) }),
|
|
3479
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)) })
|
|
3480
3488
|
] });
|
|
3481
3489
|
};
|