mac-human-design 0.1.23 → 0.1.24

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
@@ -2,6 +2,23 @@
2
2
 
3
3
  This file tracks changes between published npm versions of `mac-human-design`.
4
4
 
5
+ ## 0.1.24
6
+
7
+ ### Added
8
+
9
+ - Added `role="toolbar"`, optional accessible labels, labelled control groups,
10
+ and title accessibility handling to `MacWindowToolbar`.
11
+ - Added gallery coverage for an explicitly labelled `MacWindowToolbar`.
12
+ - Extended the macOS design verifier to protect toolbar accessibility and
13
+ Tauri drag-region invariants.
14
+
15
+ ### Changed
16
+
17
+ - `MacWindowToolbar` now gives leading, content, and trailing control groups
18
+ stable accessible labels while preserving no-drag regions around interactive
19
+ controls.
20
+ - Bumped the package to `0.1.24`.
21
+
5
22
  ## 0.1.23
6
23
 
7
24
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mac-human-design",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "Reusable macOS-oriented UI primitives and SF Symbols bridge for Tauri apps.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -9,6 +9,7 @@ const wrapperPath = path.join(repoRoot, "src", "components", "MacBaseUI.tsx");
9
9
  const symbolIconButtonPath = path.join(repoRoot, "src", "components", "SymbolIconButton.tsx");
10
10
  const galleryPath = path.join(repoRoot, "src", "components", "MacBaseUIGallery.tsx");
11
11
  const dataTablePath = path.join(repoRoot, "src", "components", "MacDataTable.tsx");
12
+ const windowToolbarPath = path.join(repoRoot, "src", "components", "MacWindowToolbar.tsx");
12
13
  const symbolServicePath = path.join(repoRoot, "src", "symbols", "systemSymbolService.ts");
13
14
 
14
15
  function readText(filePath) {
@@ -50,6 +51,7 @@ const wrapperSource = readText(wrapperPath);
50
51
  const symbolIconButtonSource = readText(symbolIconButtonPath);
51
52
  const gallerySource = readText(galleryPath);
52
53
  const dataTableSource = readText(dataTablePath);
54
+ const windowToolbarSource = readText(windowToolbarPath);
53
55
  const symbolServiceSource = readText(symbolServicePath);
54
56
 
55
57
  function getCssRuleBody(selector) {
@@ -277,6 +279,25 @@ requireCssDeclarations(".hd-mac-data-table-row-interactive:focus-visible", [
277
279
  ["focus ring", /var\(--hd-mac-focus-ring\)/],
278
280
  ]);
279
281
 
282
+ const missingToolbarRequirements = [
283
+ ["toolbar role", /role=["']toolbar["']/],
284
+ ["optional aria label", /aria-label=\{ariaLabel\}/],
285
+ ["optional aria labelledby", /aria-labelledby=\{ariaLabelledBy\}/],
286
+ ["leading group role", /role=["']group["'][\s\S]*?aria-label=\{leadingLabel\}/],
287
+ ["children group role", /role=["']group["'][\s\S]*?aria-label=\{childrenLabel\}/],
288
+ ["trailing group role", /role=["']group["'][\s\S]*?aria-label=\{trailingLabel\}/],
289
+ ["drag region root", /data-tauri-drag-region/],
290
+ ["interactive groups no-drag", /data-tauri-no-drag-region/],
291
+ ["gallery toolbar accessible label", /<MacWindowToolbar[\s\S]*?ariaLabel=["']Library toolbar["']/],
292
+ ].filter(([, pattern]) => !pattern.test(windowToolbarSource) && !pattern.test(gallerySource));
293
+
294
+ if (missingToolbarRequirements.length > 0) {
295
+ fail(
296
+ "Missing MacWindowToolbar accessibility and drag-region invariants.",
297
+ missingToolbarRequirements.map(([label]) => label),
298
+ );
299
+ }
300
+
280
301
  const missingSymbolServiceRequirements = [
281
302
  ["transparent symbol padding trim", /trimTransparentSymbolPadding/],
282
303
  ["alpha threshold trim", /TRANSPARENT_ALPHA_THRESHOLD/],
@@ -416,6 +416,7 @@ export function MacBaseUIGallery() {
416
416
  <MacAvatar.Fallback>HD</MacAvatar.Fallback>
417
417
  </MacAvatar.Root>
418
418
  <MacWindowToolbar
419
+ ariaLabel="Library toolbar"
419
420
  leading={<MacSegmentedControl options={choices} value={segment} onChange={setSegment} />}
420
421
  title="Library"
421
422
  trailing={<MacIconButton aria-label="Refresh">↻</MacIconButton>}
@@ -3,9 +3,14 @@ import { motion, type Transition } from "motion/react";
3
3
 
4
4
  export type MacWindowToolbarProps = {
5
5
  leading?: React.ReactNode;
6
+ leadingLabel?: string;
6
7
  title?: React.ReactNode;
7
8
  trailing?: React.ReactNode;
9
+ trailingLabel?: string;
8
10
  children?: React.ReactNode;
11
+ childrenLabel?: string;
12
+ ariaLabel?: string;
13
+ ariaLabelledBy?: string;
9
14
  className?: string;
10
15
  style?: React.CSSProperties;
11
16
  };
@@ -21,9 +26,14 @@ const toolbarTransition: Transition = {
21
26
 
22
27
  export function MacWindowToolbar({
23
28
  leading,
29
+ leadingLabel = "Primary toolbar controls",
24
30
  title,
25
31
  trailing,
32
+ trailingLabel = "Secondary toolbar controls",
26
33
  children,
34
+ childrenLabel = "Toolbar controls",
35
+ ariaLabel,
36
+ ariaLabelledBy,
27
37
  className,
28
38
  style,
29
39
  }: MacWindowToolbarProps) {
@@ -33,6 +43,9 @@ export function MacWindowToolbar({
33
43
  animate={{ opacity: 1, y: 0 }}
34
44
  transition={toolbarTransition}
35
45
  className={joinClasses("hd-mac-window-toolbar", className)}
46
+ role="toolbar"
47
+ aria-label={ariaLabel}
48
+ aria-labelledby={ariaLabelledBy}
36
49
  data-tauri-drag-region
37
50
  style={style}
38
51
  >
@@ -40,6 +53,8 @@ export function MacWindowToolbar({
40
53
  <motion.div
41
54
  layout
42
55
  className="hd-mac-window-toolbar-group"
56
+ role="group"
57
+ aria-label={leadingLabel}
43
58
  data-tauri-no-drag-region
44
59
  transition={toolbarTransition}
45
60
  >
@@ -50,6 +65,7 @@ export function MacWindowToolbar({
50
65
  <motion.div
51
66
  layout
52
67
  className="hd-mac-window-toolbar-title"
68
+ aria-hidden={typeof title === "string" ? undefined : true}
53
69
  data-tauri-drag-region
54
70
  transition={toolbarTransition}
55
71
  >
@@ -60,6 +76,8 @@ export function MacWindowToolbar({
60
76
  <motion.div
61
77
  layout
62
78
  className="hd-mac-window-toolbar-content"
79
+ role="group"
80
+ aria-label={childrenLabel}
63
81
  data-tauri-no-drag-region
64
82
  transition={toolbarTransition}
65
83
  >
@@ -70,6 +88,8 @@ export function MacWindowToolbar({
70
88
  <motion.div
71
89
  layout
72
90
  className="hd-mac-window-toolbar-group"
91
+ role="group"
92
+ aria-label={trailingLabel}
73
93
  data-tauri-no-drag-region
74
94
  transition={toolbarTransition}
75
95
  >