@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/dist/index.mjs
CHANGED
|
@@ -192,6 +192,7 @@ var TextKind = /* @__PURE__ */ ((TextKind2) => {
|
|
|
192
192
|
TextKind2["Small"] = "small";
|
|
193
193
|
return TextKind2;
|
|
194
194
|
})(TextKind || {});
|
|
195
|
+
var TITLE_HEADING_LEVEL = 1;
|
|
195
196
|
var SIZES = {
|
|
196
197
|
["title" /* Title */]: { fontSize: 24, fontWeight: "700", lineHeight: 30 },
|
|
197
198
|
["heading" /* Heading */]: { fontSize: 17, fontWeight: "700", lineHeight: 24 },
|
|
@@ -209,9 +210,12 @@ var AppText = ({
|
|
|
209
210
|
}) => {
|
|
210
211
|
const { theme } = useUi();
|
|
211
212
|
const quiet = kind === "muted" /* Muted */ || kind === "small" /* Small */;
|
|
213
|
+
const isTitle = kind === "title" /* Title */;
|
|
212
214
|
return /* @__PURE__ */ jsx(
|
|
213
215
|
Text,
|
|
214
216
|
{
|
|
217
|
+
accessibilityRole: isTitle ? "header" : void 0,
|
|
218
|
+
"aria-level": isTitle ? TITLE_HEADING_LEVEL : void 0,
|
|
215
219
|
style: [
|
|
216
220
|
SIZES[kind],
|
|
217
221
|
{ color: color ?? (quiet ? theme.colors.textSecondary : theme.colors.text) },
|
|
@@ -3338,9 +3342,10 @@ var styles28 = StyleSheet.create({
|
|
|
3338
3342
|
function ariaSelected(selected) {
|
|
3339
3343
|
return { "aria-selected": selected };
|
|
3340
3344
|
}
|
|
3341
|
-
var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wrap" /* Wrap */, onSelect, testID }) => {
|
|
3345
|
+
var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wrap" /* Wrap */, activeColor, onSelect, testID }) => {
|
|
3342
3346
|
const { theme } = useUi();
|
|
3343
3347
|
const { colors } = theme;
|
|
3348
|
+
const fill = activeColor ?? colors.text;
|
|
3344
3349
|
const scroll = overflow === "scroll" /* Scroll */;
|
|
3345
3350
|
const row = /* @__PURE__ */ jsx(View, { accessibilityRole: "tablist", accessibilityLabel: groupLabel, style: scroll ? styles28.scrollRow : styles28.root, testID: `${testID}-chips`, children: sections.map((entry) => {
|
|
3346
3351
|
const active = entry.key === activeKey;
|
|
@@ -3351,7 +3356,7 @@ var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wra
|
|
|
3351
3356
|
accessibilityRole: "tab",
|
|
3352
3357
|
accessibilityLabel: entry.title,
|
|
3353
3358
|
accessibilityHint: itemHint,
|
|
3354
|
-
style: [styles28.chip, { borderColor: colors.border, backgroundColor: active ?
|
|
3359
|
+
style: [styles28.chip, { borderColor: colors.border, backgroundColor: active ? fill : colors.background }],
|
|
3355
3360
|
testID: `${testID}-chip-${entry.key}`,
|
|
3356
3361
|
onPress: () => onSelect(entry.key),
|
|
3357
3362
|
children: /* @__PURE__ */ jsx(Text, { style: [styles28.label, { color: active ? colors.background : colors.text }], children: entry.title })
|
|
@@ -3381,9 +3386,10 @@ var styles29 = StyleSheet.create({
|
|
|
3381
3386
|
function ariaCurrent(active) {
|
|
3382
3387
|
return active ? { "aria-current": "location" } : {};
|
|
3383
3388
|
}
|
|
3384
|
-
var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID, width = SECTION_INDEX_WIDTH }) => {
|
|
3389
|
+
var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID, width = SECTION_INDEX_WIDTH, activeColor }) => {
|
|
3385
3390
|
const { theme } = useUi();
|
|
3386
3391
|
const { colors } = theme;
|
|
3392
|
+
const bar = activeColor ?? colors.text;
|
|
3387
3393
|
return /* @__PURE__ */ jsxs(View, { role: "navigation", accessibilityLabel: heading, style: [styles29.root, { width }], testID: `${testID}-index`, children: [
|
|
3388
3394
|
/* @__PURE__ */ jsx(Text, { style: [styles29.heading, { color: colors.textSecondary }], children: heading }),
|
|
3389
3395
|
sections.map((entry) => {
|
|
@@ -3395,7 +3401,7 @@ var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID,
|
|
|
3395
3401
|
accessibilityRole: "link",
|
|
3396
3402
|
accessibilityLabel: entry.title,
|
|
3397
3403
|
accessibilityHint: itemHint,
|
|
3398
|
-
style: [styles29.item, { borderLeftColor: active ?
|
|
3404
|
+
style: [styles29.item, { borderLeftColor: active ? bar : TRANSPARENT3, backgroundColor: active ? colors.surface : TRANSPARENT3 }],
|
|
3399
3405
|
testID: `${testID}-index-${entry.key}`,
|
|
3400
3406
|
onPress: () => onSelect(entry.key),
|
|
3401
3407
|
children: /* @__PURE__ */ jsx(Text, { style: [styles29.label, active && styles29.labelActive, { color: active ? colors.text : colors.textSecondary }], children: entry.title })
|
|
@@ -3438,6 +3444,7 @@ var SectionIndexLayout = ({
|
|
|
3438
3444
|
stickyIndex = false,
|
|
3439
3445
|
chipOverflow = "wrap" /* Wrap */,
|
|
3440
3446
|
indexWidth = SECTION_INDEX_WIDTH,
|
|
3447
|
+
activeColor,
|
|
3441
3448
|
testID = "section-index"
|
|
3442
3449
|
}) => {
|
|
3443
3450
|
const wide = useIsWideViewport(breakpoint);
|
|
@@ -3451,6 +3458,7 @@ var SectionIndexLayout = ({
|
|
|
3451
3458
|
/* @__PURE__ */ jsx(
|
|
3452
3459
|
SectionChips,
|
|
3453
3460
|
{
|
|
3461
|
+
activeColor,
|
|
3454
3462
|
activeKey,
|
|
3455
3463
|
groupLabel: indexHeading,
|
|
3456
3464
|
itemHint,
|
|
@@ -3469,7 +3477,7 @@ var SectionIndexLayout = ({
|
|
|
3469
3477
|
};
|
|
3470
3478
|
const sticky = stickyIndex && Platform.OS === "web" ? WEB_STICKY : null;
|
|
3471
3479
|
return /* @__PURE__ */ jsxs(View, { style: styles30.wide, testID, children: [
|
|
3472
|
-
/* @__PURE__ */ jsx(View, { style: sticky, children: /* @__PURE__ */ jsx(SectionIndex, { activeKey, heading: indexHeading, itemHint, sections, testID, width: indexWidth, onSelect: select }) }),
|
|
3480
|
+
/* @__PURE__ */ jsx(View, { style: sticky, children: /* @__PURE__ */ jsx(SectionIndex, { activeColor, activeKey, heading: indexHeading, itemHint, sections, testID, width: indexWidth, onSelect: select }) }),
|
|
3473
3481
|
/* @__PURE__ */ jsx(View, { style: [styles30.column, gap], children: sections.map((entry) => /* @__PURE__ */ jsx(View, { nativeID: sectionAnchorId(testID, entry.key), testID: sectionAnchorId(testID, entry.key), children: entry.content }, entry.key)) })
|
|
3474
3482
|
] });
|
|
3475
3483
|
};
|