@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 +4 -0
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { SvgIcon } from '@dloizides/ui-icons';
|
|
|
8
8
|
import { useEnterExit, Collapse } from '@dloizides/ui-motion';
|
|
9
9
|
import { MIN_TOUCH_TARGET_PX, useA11y } from '@dloizides/a11y';
|
|
10
10
|
import { createPortal } from 'react-dom';
|
|
11
|
-
import { useReducedMotion } from '@dloizides/rn-web-hooks';
|
|
11
|
+
import { useReducedMotion, useInitialFocus, INITIAL_FOCUS_PROPS } from '@dloizides/rn-web-hooks';
|
|
12
12
|
|
|
13
13
|
// src/Section/Section.tsx
|
|
14
14
|
|
|
@@ -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) },
|
|
@@ -3556,6 +3560,7 @@ var styles34 = StyleSheet.create({
|
|
|
3556
3560
|
});
|
|
3557
3561
|
var StickyActionBar = ({
|
|
3558
3562
|
accessibilityLabel,
|
|
3563
|
+
accessibilityHint,
|
|
3559
3564
|
children,
|
|
3560
3565
|
breakpoint = LAYOUT_COLLAPSE_BREAKPOINT,
|
|
3561
3566
|
bottomInset = 0,
|
|
@@ -3563,9 +3568,9 @@ var StickyActionBar = ({
|
|
|
3563
3568
|
}) => {
|
|
3564
3569
|
const wide = useIsWideViewport(breakpoint);
|
|
3565
3570
|
const { colors } = useUi().theme;
|
|
3566
|
-
if (wide) return /* @__PURE__ */ jsx(View, { accessibilityLabel, role: "toolbar", style: styles34.inline, testID, children });
|
|
3571
|
+
if (wide) return /* @__PURE__ */ jsx(View, { accessibilityHint, accessibilityLabel, role: "toolbar", style: styles34.inline, testID, children });
|
|
3567
3572
|
const surface = { backgroundColor: colors.surface, borderTopColor: colors.border };
|
|
3568
|
-
return /* @__PURE__ */ jsx(View, { accessibilityLabel, role: "toolbar", style: [styles34.bar, surface, stickyEdgeStyle(Platform.OS, bottomInset)], testID, children });
|
|
3573
|
+
return /* @__PURE__ */ jsx(View, { accessibilityHint, accessibilityLabel, role: "toolbar", style: [styles34.bar, surface, stickyEdgeStyle(Platform.OS, bottomInset)], testID, children });
|
|
3569
3574
|
};
|
|
3570
3575
|
var TITLE_BASIS = 280;
|
|
3571
3576
|
var styles35 = StyleSheet.create({
|
|
@@ -3577,11 +3582,13 @@ var styles35 = StyleSheet.create({
|
|
|
3577
3582
|
function hasContent(node) {
|
|
3578
3583
|
return node !== void 0 && node !== null && node !== false;
|
|
3579
3584
|
}
|
|
3580
|
-
var PageHead = ({ title, subtitle, actions, testID = LAYOUT_TEST_IDS.pageHead }) => {
|
|
3585
|
+
var PageHead = ({ title, subtitle, actions, initialFocus = false, testID = LAYOUT_TEST_IDS.pageHead }) => {
|
|
3581
3586
|
const { colors } = useUi().theme;
|
|
3587
|
+
const titleRef = useInitialFocus();
|
|
3588
|
+
const focusProps = initialFocus ? { ref: titleRef, ...INITIAL_FOCUS_PROPS } : {};
|
|
3582
3589
|
return /* @__PURE__ */ jsxs(View, { style: styles35.row, testID, children: [
|
|
3583
3590
|
/* @__PURE__ */ jsxs(View, { style: styles35.text, children: [
|
|
3584
|
-
/* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles35.title, { color: colors.text }], testID: `${testID}-title`, children: title }),
|
|
3591
|
+
/* @__PURE__ */ jsx(Text, { ...focusProps, accessibilityRole: "header", style: [styles35.title, { color: colors.text }], testID: `${testID}-title`, children: title }),
|
|
3585
3592
|
subtitle
|
|
3586
3593
|
] }),
|
|
3587
3594
|
hasContent(actions) ? /* @__PURE__ */ jsx(View, { style: styles35.actions, testID: `${testID}-actions`, children: actions }) : null
|