mac-human-design 0.1.28 → 0.1.29
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,22 @@
|
|
|
2
2
|
|
|
3
3
|
This file tracks changes between published npm versions of `mac-human-design`.
|
|
4
4
|
|
|
5
|
+
## 0.1.29
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added `SymbolIconButton` optical centering support through default
|
|
10
|
+
per-symbol offsets and an `opticalOffset` override prop.
|
|
11
|
+
- Added verifier coverage for symbol optical offset props, default offsets, and
|
|
12
|
+
CSS variable-based glyph translation.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Tuned common toolbar SF Symbols such as refresh, upload, download, back,
|
|
17
|
+
trash, and folder-plus so their visual weight sits closer to the center of
|
|
18
|
+
the fixed macOS icon button.
|
|
19
|
+
- Bumped the package to `0.1.29`.
|
|
20
|
+
|
|
5
21
|
## 0.1.28
|
|
6
22
|
|
|
7
23
|
### Added
|
|
@@ -94,7 +94,7 @@ be reimplemented in consuming apps:
|
|
|
94
94
|
| Finder-style grid/table primitive | `MacDataTable` | Uses `table` semantics for static rows, upgrades to `grid` semantics for interactive rows, exposes row/column metadata, busy state, keyboard activation, selected row state, and focus-visible row styling. |
|
|
95
95
|
| Tauri window toolbar | `MacWindowToolbar` | Provides a labelled `toolbar` landmark, labelled leading/content/trailing control groups, a root drag region, and no-drag regions around interactive controls. |
|
|
96
96
|
| Segmented control | `MacSegmentedControl` | Wraps the shared macOS segmented toggle styling with accessible labels, stable class names, full-width layout support, and class/style pass-through. |
|
|
97
|
-
| Centered SF Symbols icon button | `SymbolIconButton` | Renders through `MacIconButton`, defaults to `type="button"`, preserves fixed geometry while allowing style/class pass-through, supports tooltip offsets, and exposes loading state with `aria-busy`. |
|
|
97
|
+
| Centered SF Symbols icon button | `SymbolIconButton` | Renders through `MacIconButton`, defaults to `type="button"`, preserves fixed geometry while allowing style/class pass-through, supports tooltip offsets and per-symbol optical offsets, and exposes loading state with `aria-busy`. |
|
|
98
98
|
|
|
99
99
|
## Icon Button Alignment Guarantees
|
|
100
100
|
|
|
@@ -102,8 +102,8 @@ Icon-only buttons use fixed-size grid containers with zero padding, zero
|
|
|
102
102
|
line-height, centered grid content, middle inline alignment, and center transform
|
|
103
103
|
origins. `SymbolIconButton` keeps the SF Symbol and loading spinner in the same
|
|
104
104
|
grid cell, centers generated symbol masks, trims transparent symbol padding in
|
|
105
|
-
the native symbol service,
|
|
106
|
-
controls.
|
|
105
|
+
the native symbol service, applies per-symbol optical offsets for asymmetric
|
|
106
|
+
SF Symbols, and avoids vertical Motion offsets for icon-only controls.
|
|
107
107
|
|
|
108
108
|
The gallery at `examples/macos-base-ui-gallery` renders these wrappers across
|
|
109
109
|
normal, selected, disabled, mixed, popup, dialog, and narrow-width states.
|
package/package.json
CHANGED
|
@@ -159,6 +159,10 @@ requireCssDeclarations(".hd-mac-symbol-icon", [
|
|
|
159
159
|
["horizontal glyph centering", /justify-content\s*:\s*center\s*;/],
|
|
160
160
|
["automatic optical centering margin", /margin\s*:\s*auto\s*;/],
|
|
161
161
|
["center transform origin", /transform-origin\s*:\s*center\s*;/],
|
|
162
|
+
[
|
|
163
|
+
"symbol optical centering translate",
|
|
164
|
+
/translate\s*:\s*var\(--hd-mac-symbol-offset-x,\s*0px\)\s*var\(--hd-mac-symbol-offset-y,\s*0px\)\s*;/,
|
|
165
|
+
],
|
|
162
166
|
]);
|
|
163
167
|
|
|
164
168
|
const sharedIconButtonRule = stylesSource.match(
|
|
@@ -199,6 +203,9 @@ const symbolIconRequirements = [
|
|
|
199
203
|
["SymbolIconButton render element is MacIconButton", /render=\{\s*<MacIconButton\b/],
|
|
200
204
|
["SymbolIconButton applies hd-mac-symbol-icon-button class", /joinClasses\("hd-mac-symbol-icon-button", className\)/],
|
|
201
205
|
["SymbolIconButton defaults to button type", /type=["']button["']/],
|
|
206
|
+
["SymbolIconButton supports optical offset prop", /opticalOffset\?: SymbolIconOpticalOffset/],
|
|
207
|
+
["SymbolIconButton includes default optical offsets", /DEFAULT_SYMBOL_OPTICAL_OFFSETS/],
|
|
208
|
+
["SymbolIconButton sets symbol offset CSS variable", /"--hd-mac-symbol-offset-x": offsetToCssValue/],
|
|
202
209
|
["SymbolIconButton supports className pass-through", /\bclassName,\s*\n\s*style,/],
|
|
203
210
|
["SymbolIconButton supports style pass-through after fixed geometry", /\.\.\.style/],
|
|
204
211
|
["SymbolIconButton supports tooltip offset", /tooltipSideOffset = 5/],
|
|
@@ -10,6 +10,7 @@ type SymbolIconButtonProps = {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
isLoading?: boolean;
|
|
12
12
|
iconSizePx?: number;
|
|
13
|
+
opticalOffset?: SymbolIconOpticalOffset;
|
|
13
14
|
symbolEnabled?: boolean;
|
|
14
15
|
className?: string;
|
|
15
16
|
style?: CSSProperties;
|
|
@@ -19,10 +20,31 @@ type SymbolIconButtonProps = {
|
|
|
19
20
|
const ICON_BUTTON_SIZE = "30px";
|
|
20
21
|
const ICON_BUTTON_RADIUS = "7px";
|
|
21
22
|
|
|
23
|
+
type SymbolIconOpticalOffset = {
|
|
24
|
+
x?: number | string;
|
|
25
|
+
y?: number | string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const DEFAULT_SYMBOL_OPTICAL_OFFSETS: Record<string, SymbolIconOpticalOffset> = {
|
|
29
|
+
"arrow.clockwise": { y: 0.5 },
|
|
30
|
+
"square.and.arrow.up": { y: 0.35 },
|
|
31
|
+
"square.and.arrow.down": { y: 0.35 },
|
|
32
|
+
"folder.badge.plus": { x: -0.65 },
|
|
33
|
+
"chevron.left": { x: 0.6 },
|
|
34
|
+
trash: { y: 0.25 },
|
|
35
|
+
};
|
|
36
|
+
|
|
22
37
|
function joinClasses(...classes: Array<string | undefined | false>) {
|
|
23
38
|
return classes.filter(Boolean).join(" ");
|
|
24
39
|
}
|
|
25
40
|
|
|
41
|
+
function offsetToCssValue(value: number | string | undefined) {
|
|
42
|
+
if (typeof value === "number") {
|
|
43
|
+
return `${value}px`;
|
|
44
|
+
}
|
|
45
|
+
return value ?? "0px";
|
|
46
|
+
}
|
|
47
|
+
|
|
26
48
|
export function SymbolIconButton({
|
|
27
49
|
label,
|
|
28
50
|
symbolName,
|
|
@@ -31,6 +53,7 @@ export function SymbolIconButton({
|
|
|
31
53
|
disabled,
|
|
32
54
|
isLoading,
|
|
33
55
|
iconSizePx = 18,
|
|
56
|
+
opticalOffset,
|
|
34
57
|
symbolEnabled = true,
|
|
35
58
|
className,
|
|
36
59
|
style,
|
|
@@ -42,6 +65,13 @@ export function SymbolIconButton({
|
|
|
42
65
|
enabled: symbolEnabled,
|
|
43
66
|
});
|
|
44
67
|
const glyphPx = `${iconSizePx}px`;
|
|
68
|
+
const resolvedOpticalOffset = opticalOffset ?? DEFAULT_SYMBOL_OPTICAL_OFFSETS[symbolName];
|
|
69
|
+
const iconStyle = {
|
|
70
|
+
width: glyphPx,
|
|
71
|
+
height: glyphPx,
|
|
72
|
+
"--hd-mac-symbol-offset-x": offsetToCssValue(resolvedOpticalOffset?.x),
|
|
73
|
+
"--hd-mac-symbol-offset-y": offsetToCssValue(resolvedOpticalOffset?.y),
|
|
74
|
+
} as CSSProperties;
|
|
45
75
|
|
|
46
76
|
return (
|
|
47
77
|
<MacTooltip.Root>
|
|
@@ -70,8 +100,7 @@ export function SymbolIconButton({
|
|
|
70
100
|
aria-hidden
|
|
71
101
|
className="hd-mac-symbol-icon hd-mac-symbol-icon-mask"
|
|
72
102
|
style={{
|
|
73
|
-
|
|
74
|
-
height: glyphPx,
|
|
103
|
+
...iconStyle,
|
|
75
104
|
color: "currentColor",
|
|
76
105
|
backgroundColor: "currentColor",
|
|
77
106
|
WebkitMaskImage: `url("${symbolDataUrl}")`,
|
|
@@ -89,8 +118,7 @@ export function SymbolIconButton({
|
|
|
89
118
|
aria-hidden
|
|
90
119
|
className="hd-mac-symbol-icon hd-mac-symbol-icon-fallback"
|
|
91
120
|
style={{
|
|
92
|
-
|
|
93
|
-
height: glyphPx,
|
|
121
|
+
...iconStyle,
|
|
94
122
|
fontSize: glyphPx,
|
|
95
123
|
}}
|
|
96
124
|
>
|