mac-human-design 0.1.25 → 0.1.27

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/README.md CHANGED
@@ -56,7 +56,15 @@ fn main() {
56
56
 
57
57
  ```ts
58
58
  import { useState } from "react";
59
- import { MacButton, MacMotionProvider, MacSegmentedControl, MacSelect } from "mac-human-design";
59
+ import {
60
+ MacButton,
61
+ MacDataTable,
62
+ MacMotionProvider,
63
+ MacSegmentedControl,
64
+ MacSelect,
65
+ MacWindowToolbar,
66
+ SymbolIconButton,
67
+ } from "mac-human-design";
60
68
  import { SystemSymbolImage } from "mac-human-design/symbols";
61
69
  import "mac-human-design/styles/macos-base-ui.css";
62
70
 
@@ -65,14 +73,36 @@ export function Demo() {
65
73
 
66
74
  return (
67
75
  <MacMotionProvider>
76
+ <MacWindowToolbar
77
+ ariaLabel="Demo toolbar"
78
+ leading={
79
+ <MacSegmentedControl
80
+ options={[
81
+ { value: "files", label: "Files" },
82
+ { value: "settings", label: "Settings" },
83
+ ]}
84
+ value={tab}
85
+ onChange={setTab}
86
+ />
87
+ }
88
+ trailing={
89
+ <SymbolIconButton
90
+ label="Refresh"
91
+ symbolName="arrow.clockwise"
92
+ fallback="↻"
93
+ onClick={() => {}}
94
+ />
95
+ }
96
+ />
68
97
  <SystemSymbolImage symbolName="folder" sizePx={18} fallback="▢" />
69
- <MacSegmentedControl
70
- options={[
71
- { value: "files", label: "Files" },
72
- { value: "settings", label: "Settings" },
98
+ <MacDataTable
99
+ ariaLabel="Demo files"
100
+ columns={[
101
+ { id: "name", header: "Name", width: "minmax(120px, 1fr)", render: (row) => row.name },
102
+ { id: "kind", header: "Kind", width: "90px", render: (row) => row.kind },
73
103
  ]}
74
- value={tab}
75
- onChange={setTab}
104
+ rows={[{ name: "Documents", kind: "Folder" }]}
105
+ getRowKey={(row) => row.name}
76
106
  />
77
107
  <MacButton data-variant="primary">Continue</MacButton>
78
108
  <MacSelect.Root items={[{ label: "Files", value: "files" }]}>
@@ -118,8 +148,15 @@ The following components are now in the shared library and can be imported by an
118
148
  `MacTabs`, `MacToast`, `MacToggle`, `MacToolbarToggle`,
119
149
  `MacToggleGroup`, `MacSegmentedToggleGroup`,
120
150
  `MacSeparatedSegmentedToggleGroup`, `MacToolbar`, `MacTooltip`
151
+ - `MacDataTable`, a Finder-style grid/table primitive with loading, empty,
152
+ selected, keyboard, and interactive-row states
153
+ - `MacSegmentedControl`, a compact macOS segmented control wrapper with
154
+ accessible labels and full-width support
155
+ - `MacWindowToolbar`, a Motion-backed Tauri window toolbar with drag-region
156
+ and no-drag control group handling
121
157
  - `StatusMessage`
122
- - `SymbolIconButton`
158
+ - `SymbolIconButton`, a centered SF Symbols icon button with fallback glyphs,
159
+ loading state, tooltips, and pass-through styling hooks
123
160
  - `ViewDragRegion`
124
161
  - `isDraggableAreaTarget` utility
125
162
 
@@ -128,6 +165,9 @@ Example import:
128
165
  ```ts
129
166
  import {
130
167
  AppWindowShell,
168
+ MacDataTable,
169
+ MacSegmentedControl,
170
+ MacWindowToolbar,
131
171
  StatusMessage,
132
172
  SymbolIconButton,
133
173
  ViewDragRegion,
package/changelog.md CHANGED
@@ -2,6 +2,36 @@
2
2
 
3
3
  This file tracks changes between published npm versions of `mac-human-design`.
4
4
 
5
+ ## 0.1.27
6
+
7
+ ### Added
8
+
9
+ - Added README usage and export documentation for `MacDataTable`,
10
+ `MacWindowToolbar`, `MacSegmentedControl`, and `SymbolIconButton`.
11
+ - Extended the macOS design verifier to require README coverage for shared
12
+ app-level macOS components and their labelled toolbar/table examples.
13
+
14
+ ### Changed
15
+
16
+ - The main README example now demonstrates a toolbar with a segmented control,
17
+ centered `SymbolIconButton`, and `MacDataTable` usage.
18
+ - Bumped the package to `0.1.27`.
19
+
20
+ ## 0.1.26
21
+
22
+ ### Added
23
+
24
+ - Added safe `className`, `style`, and `tooltipSideOffset` pass-through props
25
+ to `SymbolIconButton`.
26
+ - Added verifier coverage for `SymbolIconButton` pass-through props, fixed
27
+ geometry preservation, tooltip offset handling, and explicit `type="button"`.
28
+
29
+ ### Changed
30
+
31
+ - `SymbolIconButton` now sets `type="button"` so toolbar icon buttons do not
32
+ accidentally submit surrounding forms.
33
+ - Bumped the package to `0.1.26`.
34
+
5
35
  ## 0.1.25
6
36
 
7
37
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mac-human-design",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
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",
@@ -5,6 +5,7 @@ import { fileURLToPath } from "node:url";
5
5
  const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
6
6
  const stylesPath = path.join(repoRoot, "src", "styles", "macosBaseUi.css");
7
7
  const packageJsonPath = path.join(repoRoot, "package.json");
8
+ const readmePath = path.join(repoRoot, "README.md");
8
9
  const wrapperPath = path.join(repoRoot, "src", "components", "MacBaseUI.tsx");
9
10
  const symbolIconButtonPath = path.join(repoRoot, "src", "components", "SymbolIconButton.tsx");
10
11
  const galleryPath = path.join(repoRoot, "src", "components", "MacBaseUIGallery.tsx");
@@ -48,6 +49,7 @@ const sources = new Map(
48
49
  );
49
50
  const stylesSource = readText(stylesPath);
50
51
  const packageJson = JSON.parse(readText(packageJsonPath));
52
+ const readmeSource = readText(readmePath);
51
53
  const wrapperSource = readText(wrapperPath);
52
54
  const symbolIconButtonSource = readText(symbolIconButtonPath);
53
55
  const gallerySource = readText(galleryPath);
@@ -193,7 +195,12 @@ if (/\by\s*:/.test(iconMotionBranch)) {
193
195
  const symbolIconRequirements = [
194
196
  ["SymbolIconButton imports MacIconButton", /import\s+\{\s*MacIconButton,\s*MacTooltip\s*\}\s+from\s+["']\.\/MacBaseUI["']/],
195
197
  ["SymbolIconButton render element is MacIconButton", /render=\{\s*<MacIconButton\b/],
196
- ["SymbolIconButton applies hd-mac-symbol-icon-button class", /className=["']hd-mac-symbol-icon-button["']/],
198
+ ["SymbolIconButton applies hd-mac-symbol-icon-button class", /joinClasses\("hd-mac-symbol-icon-button", className\)/],
199
+ ["SymbolIconButton defaults to button type", /type=["']button["']/],
200
+ ["SymbolIconButton supports className pass-through", /\bclassName,\s*\n\s*style,/],
201
+ ["SymbolIconButton supports style pass-through after fixed geometry", /\.\.\.style/],
202
+ ["SymbolIconButton supports tooltip offset", /tooltipSideOffset = 5/],
203
+ ["SymbolIconButton applies tooltip offset", /sideOffset=\{tooltipSideOffset\}/],
197
204
  ["SymbolIconButton exposes aria-busy loading state", /aria-busy=\{isLoading \|\| undefined\}/],
198
205
  ["masked symbol class path", /className=["']hd-mac-symbol-icon hd-mac-symbol-icon-mask["']/],
199
206
  ["fallback symbol class path", /className=["']hd-mac-symbol-icon hd-mac-symbol-icon-fallback["']/],
@@ -300,6 +307,24 @@ if (missingToolbarRequirements.length > 0) {
300
307
  );
301
308
  }
302
309
 
310
+ const missingPublicDocs = [
311
+ ["README documents MacDataTable", /`MacDataTable`[\s\S]*Finder-style grid\/table primitive/],
312
+ ["README documents MacWindowToolbar", /`MacWindowToolbar`[\s\S]*Tauri window toolbar/],
313
+ ["README documents SymbolIconButton", /`SymbolIconButton`[\s\S]*centered SF Symbols icon button/],
314
+ ["README usage imports MacDataTable", /import\s+\{[\s\S]*MacDataTable[\s\S]*\}\s+from\s+["']mac-human-design["']/],
315
+ ["README usage imports MacWindowToolbar", /import\s+\{[\s\S]*MacWindowToolbar[\s\S]*\}\s+from\s+["']mac-human-design["']/],
316
+ ["README usage imports SymbolIconButton", /import\s+\{[\s\S]*SymbolIconButton[\s\S]*\}\s+from\s+["']mac-human-design["']/],
317
+ ["README shows labelled toolbar", /<MacWindowToolbar[\s\S]*ariaLabel=["']Demo toolbar["']/],
318
+ ["README shows labelled data table", /<MacDataTable[\s\S]*ariaLabel=["']Demo files["']/],
319
+ ].filter(([, pattern]) => !pattern.test(readmeSource));
320
+
321
+ if (missingPublicDocs.length > 0) {
322
+ fail(
323
+ "Missing README coverage for shared macOS component exports.",
324
+ missingPublicDocs.map(([label]) => label),
325
+ );
326
+ }
327
+
303
328
  const missingSegmentedControlRequirements = [
304
329
  ["stable segmented control class", /"hd-mac-segmented-control"/],
305
330
  ["default accessible label", /ariaLabel = "Segmented control"/],
@@ -1,3 +1,4 @@
1
+ import type { CSSProperties } from "react";
1
2
  import { MacIconButton, MacTooltip } from "./MacBaseUI";
2
3
  import { useSystemSymbol } from "../symbols/useSystemSymbol";
3
4
 
@@ -10,11 +11,18 @@ type SymbolIconButtonProps = {
10
11
  isLoading?: boolean;
11
12
  iconSizePx?: number;
12
13
  symbolEnabled?: boolean;
14
+ className?: string;
15
+ style?: CSSProperties;
16
+ tooltipSideOffset?: number;
13
17
  };
14
18
 
15
19
  const ICON_BUTTON_SIZE = "30px";
16
20
  const ICON_BUTTON_RADIUS = "7px";
17
21
 
22
+ function joinClasses(...classes: Array<string | undefined | false>) {
23
+ return classes.filter(Boolean).join(" ");
24
+ }
25
+
18
26
  export function SymbolIconButton({
19
27
  label,
20
28
  symbolName,
@@ -24,6 +32,9 @@ export function SymbolIconButton({
24
32
  isLoading,
25
33
  iconSizePx = 18,
26
34
  symbolEnabled = true,
35
+ className,
36
+ style,
37
+ tooltipSideOffset = 5,
27
38
  }: SymbolIconButtonProps) {
28
39
  const { dataUrl: symbolDataUrl } = useSystemSymbol({
29
40
  symbolName,
@@ -40,9 +51,10 @@ export function SymbolIconButton({
40
51
  aria-label={label}
41
52
  aria-busy={isLoading || undefined}
42
53
  title={label}
54
+ type="button"
43
55
  disabled={disabled || isLoading}
44
56
  onClick={onClick}
45
- className="hd-mac-symbol-icon-button"
57
+ className={joinClasses("hd-mac-symbol-icon-button", className)}
46
58
  data-loading={isLoading || undefined}
47
59
  style={{
48
60
  width: ICON_BUTTON_SIZE,
@@ -50,6 +62,7 @@ export function SymbolIconButton({
50
62
  height: ICON_BUTTON_SIZE,
51
63
  minHeight: ICON_BUTTON_SIZE,
52
64
  borderRadius: ICON_BUTTON_RADIUS,
65
+ ...style,
53
66
  }}
54
67
  >
55
68
  {symbolDataUrl ? (
@@ -88,7 +101,7 @@ export function SymbolIconButton({
88
101
  }
89
102
  />
90
103
  <MacTooltip.Portal>
91
- <MacTooltip.Positioner sideOffset={5}>
104
+ <MacTooltip.Positioner sideOffset={tooltipSideOffset}>
92
105
  <MacTooltip.Popup>{label}</MacTooltip.Popup>
93
106
  </MacTooltip.Positioner>
94
107
  </MacTooltip.Portal>