@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 +4 -0
- package/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3342,9 +3342,10 @@ var styles28 = StyleSheet.create({
|
|
|
3342
3342
|
function ariaSelected(selected) {
|
|
3343
3343
|
return { "aria-selected": selected };
|
|
3344
3344
|
}
|
|
3345
|
-
var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wrap" /* Wrap */, onSelect, testID }) => {
|
|
3345
|
+
var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wrap" /* Wrap */, activeColor, onSelect, testID }) => {
|
|
3346
3346
|
const { theme } = useUi();
|
|
3347
3347
|
const { colors } = theme;
|
|
3348
|
+
const fill = activeColor ?? colors.text;
|
|
3348
3349
|
const scroll = overflow === "scroll" /* Scroll */;
|
|
3349
3350
|
const row = /* @__PURE__ */ jsx(View, { accessibilityRole: "tablist", accessibilityLabel: groupLabel, style: scroll ? styles28.scrollRow : styles28.root, testID: `${testID}-chips`, children: sections.map((entry) => {
|
|
3350
3351
|
const active = entry.key === activeKey;
|
|
@@ -3355,7 +3356,7 @@ var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wra
|
|
|
3355
3356
|
accessibilityRole: "tab",
|
|
3356
3357
|
accessibilityLabel: entry.title,
|
|
3357
3358
|
accessibilityHint: itemHint,
|
|
3358
|
-
style: [styles28.chip, { borderColor: colors.border, backgroundColor: active ?
|
|
3359
|
+
style: [styles28.chip, { borderColor: colors.border, backgroundColor: active ? fill : colors.background }],
|
|
3359
3360
|
testID: `${testID}-chip-${entry.key}`,
|
|
3360
3361
|
onPress: () => onSelect(entry.key),
|
|
3361
3362
|
children: /* @__PURE__ */ jsx(Text, { style: [styles28.label, { color: active ? colors.background : colors.text }], children: entry.title })
|
|
@@ -3385,9 +3386,10 @@ var styles29 = StyleSheet.create({
|
|
|
3385
3386
|
function ariaCurrent(active) {
|
|
3386
3387
|
return active ? { "aria-current": "location" } : {};
|
|
3387
3388
|
}
|
|
3388
|
-
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 }) => {
|
|
3389
3390
|
const { theme } = useUi();
|
|
3390
3391
|
const { colors } = theme;
|
|
3392
|
+
const bar = activeColor ?? colors.text;
|
|
3391
3393
|
return /* @__PURE__ */ jsxs(View, { role: "navigation", accessibilityLabel: heading, style: [styles29.root, { width }], testID: `${testID}-index`, children: [
|
|
3392
3394
|
/* @__PURE__ */ jsx(Text, { style: [styles29.heading, { color: colors.textSecondary }], children: heading }),
|
|
3393
3395
|
sections.map((entry) => {
|
|
@@ -3399,7 +3401,7 @@ var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID,
|
|
|
3399
3401
|
accessibilityRole: "link",
|
|
3400
3402
|
accessibilityLabel: entry.title,
|
|
3401
3403
|
accessibilityHint: itemHint,
|
|
3402
|
-
style: [styles29.item, { borderLeftColor: active ?
|
|
3404
|
+
style: [styles29.item, { borderLeftColor: active ? bar : TRANSPARENT3, backgroundColor: active ? colors.surface : TRANSPARENT3 }],
|
|
3403
3405
|
testID: `${testID}-index-${entry.key}`,
|
|
3404
3406
|
onPress: () => onSelect(entry.key),
|
|
3405
3407
|
children: /* @__PURE__ */ jsx(Text, { style: [styles29.label, active && styles29.labelActive, { color: active ? colors.text : colors.textSecondary }], children: entry.title })
|
|
@@ -3442,6 +3444,7 @@ var SectionIndexLayout = ({
|
|
|
3442
3444
|
stickyIndex = false,
|
|
3443
3445
|
chipOverflow = "wrap" /* Wrap */,
|
|
3444
3446
|
indexWidth = SECTION_INDEX_WIDTH,
|
|
3447
|
+
activeColor,
|
|
3445
3448
|
testID = "section-index"
|
|
3446
3449
|
}) => {
|
|
3447
3450
|
const wide = useIsWideViewport(breakpoint);
|
|
@@ -3455,6 +3458,7 @@ var SectionIndexLayout = ({
|
|
|
3455
3458
|
/* @__PURE__ */ jsx(
|
|
3456
3459
|
SectionChips,
|
|
3457
3460
|
{
|
|
3461
|
+
activeColor,
|
|
3458
3462
|
activeKey,
|
|
3459
3463
|
groupLabel: indexHeading,
|
|
3460
3464
|
itemHint,
|
|
@@ -3473,7 +3477,7 @@ var SectionIndexLayout = ({
|
|
|
3473
3477
|
};
|
|
3474
3478
|
const sticky = stickyIndex && Platform.OS === "web" ? WEB_STICKY : null;
|
|
3475
3479
|
return /* @__PURE__ */ jsxs(View, { style: styles30.wide, testID, children: [
|
|
3476
|
-
/* @__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 }) }),
|
|
3477
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)) })
|
|
3478
3482
|
] });
|
|
3479
3483
|
};
|