mac-human-design 0.1.12 → 0.1.14

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,32 @@
2
2
 
3
3
  This file tracks changes between published npm versions of `mac-human-design`.
4
4
 
5
+ ## 0.1.14
6
+
7
+ ### Added
8
+
9
+ - Added `SymbolIconButton` coverage to the macOS Base UI gallery, including a
10
+ fallback-only state for non-Tauri render paths.
11
+
12
+ ### Changed
13
+
14
+ - Added a `symbolEnabled` prop to `SymbolIconButton` so consumers and examples
15
+ can intentionally render fallback glyphs without invoking the Tauri symbol
16
+ bridge.
17
+ - Split masked SF Symbol and fallback glyph rendering into separate centered
18
+ elements, with fallback-specific typography and optical vertical correction.
19
+ - Bumped the package to `0.1.14`.
20
+
21
+ ## 0.1.13
22
+
23
+ ### Changed
24
+
25
+ - Refined shared control Motion defaults so buttons and icon buttons scale from
26
+ center without vertical hover or press translation.
27
+ - Added explicit center transform origins to macOS icon buttons and symbol
28
+ glyphs to keep animated icon-only controls visually anchored.
29
+ - Bumped the package to `0.1.13`.
30
+
5
31
  ## 0.1.12
6
32
 
7
33
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mac-human-design",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
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",
@@ -111,14 +111,22 @@ function isDisabled(props: Record<string, unknown>) {
111
111
  return Boolean(props.disabled || props["data-disabled"] || props["aria-disabled"]);
112
112
  }
113
113
 
114
- function interactiveControlDefaults(props: Record<string, unknown>): MotionDefaults {
114
+ function interactiveControlDefaults(macClassName: string, props: Record<string, unknown>): MotionDefaults {
115
115
  if (isDisabled(props)) {
116
116
  return {};
117
117
  }
118
118
 
119
+ if (includesAny(macClassName, ["hd-mac-icon-button", "hd-mac-help-button"])) {
120
+ return {
121
+ whileHover: { scale: 1.04 },
122
+ whileTap: { scale: 0.94 },
123
+ transition: macFastTransition,
124
+ };
125
+ }
126
+
119
127
  return {
120
- whileHover: { y: -0.5, scale: 1.012 },
121
- whileTap: { y: 1, scale: 0.985 },
128
+ whileHover: { scale: 1.006 },
129
+ whileTap: { scale: 0.982 },
122
130
  transition: macFastTransition,
123
131
  };
124
132
  }
@@ -147,7 +155,7 @@ function getMotionDefaults(macClassName: string, props: Record<string, unknown>)
147
155
  "hd-mac-disclosure-trigger",
148
156
  ])
149
157
  ) {
150
- return interactiveControlDefaults(props);
158
+ return interactiveControlDefaults(macClassName, props);
151
159
  }
152
160
 
153
161
  if (macClassName.includes("hd-mac-input")) {
@@ -56,6 +56,7 @@ import {
56
56
  import { MacDataTable } from "./MacDataTable";
57
57
  import { MacSegmentedControl } from "./MacSegmentedControl";
58
58
  import { MacWindowToolbar } from "./MacWindowToolbar";
59
+ import { SymbolIconButton } from "./SymbolIconButton";
59
60
 
60
61
  const choices = [
61
62
  { label: "General", value: "general" },
@@ -93,6 +94,9 @@ export function MacBaseUIGallery() {
93
94
  <MacDestructiveButton>Delete</MacDestructiveButton>
94
95
  <MacPlainButton>Cancel</MacPlainButton>
95
96
  <MacIconButton aria-label="Add">+</MacIconButton>
97
+ <SymbolIconButton label="Refresh" symbolName="arrow.clockwise" fallback="↻" onClick={() => {}} />
98
+ <SymbolIconButton label="Upload" symbolName="square.and.arrow.up" fallback="↑" onClick={() => {}} />
99
+ <SymbolIconButton label="Fallback refresh" symbolName="arrow.clockwise" fallback="↻" onClick={() => {}} symbolEnabled={false} />
96
100
  <MacHelpButton aria-label="Help">?</MacHelpButton>
97
101
  </GallerySection>
98
102
 
@@ -9,6 +9,7 @@ type SymbolIconButtonProps = {
9
9
  disabled?: boolean;
10
10
  isLoading?: boolean;
11
11
  iconSizePx?: number;
12
+ symbolEnabled?: boolean;
12
13
  };
13
14
 
14
15
  const ICON_BUTTON_SIZE = "30px";
@@ -22,10 +23,12 @@ export function SymbolIconButton({
22
23
  disabled,
23
24
  isLoading,
24
25
  iconSizePx = 18,
26
+ symbolEnabled = true,
25
27
  }: SymbolIconButtonProps) {
26
28
  const { dataUrl: symbolDataUrl } = useSystemSymbol({
27
29
  symbolName,
28
30
  cssPixelSize: iconSizePx,
31
+ enabled: symbolEnabled,
29
32
  });
30
33
  const glyphPx = `${iconSizePx}px`;
31
34
 
@@ -48,30 +51,38 @@ export function SymbolIconButton({
48
51
  borderRadius: ICON_BUTTON_RADIUS,
49
52
  }}
50
53
  >
51
- <span
52
- aria-hidden
53
- className="hd-mac-symbol-icon"
54
- style={{
55
- width: glyphPx,
56
- height: glyphPx,
57
- color: "currentColor",
58
- backgroundColor: symbolDataUrl ? "currentColor" : "transparent",
59
- fontFamily: "-apple-system, BlinkMacSystemFont, sans-serif",
60
- fontSize: symbolDataUrl ? "0" : glyphPx,
61
- fontWeight: 500,
62
- lineHeight: "1",
63
- WebkitMaskImage: symbolDataUrl ? `url("${symbolDataUrl}")` : undefined,
64
- WebkitMaskPosition: symbolDataUrl ? "center" : undefined,
65
- WebkitMaskRepeat: symbolDataUrl ? "no-repeat" : undefined,
66
- WebkitMaskSize: symbolDataUrl ? "contain" : undefined,
67
- maskImage: symbolDataUrl ? `url("${symbolDataUrl}")` : undefined,
68
- maskPosition: symbolDataUrl ? "center" : undefined,
69
- maskRepeat: symbolDataUrl ? "no-repeat" : undefined,
70
- maskSize: symbolDataUrl ? "contain" : undefined,
71
- }}
72
- >
73
- {symbolDataUrl ? null : fallback}
74
- </span>
54
+ {symbolDataUrl ? (
55
+ <span
56
+ aria-hidden
57
+ className="hd-mac-symbol-icon hd-mac-symbol-icon-mask"
58
+ style={{
59
+ width: glyphPx,
60
+ height: glyphPx,
61
+ color: "currentColor",
62
+ backgroundColor: "currentColor",
63
+ WebkitMaskImage: `url("${symbolDataUrl}")`,
64
+ WebkitMaskPosition: "center",
65
+ WebkitMaskRepeat: "no-repeat",
66
+ WebkitMaskSize: "contain",
67
+ maskImage: `url("${symbolDataUrl}")`,
68
+ maskPosition: "center",
69
+ maskRepeat: "no-repeat",
70
+ maskSize: "contain",
71
+ }}
72
+ />
73
+ ) : (
74
+ <span
75
+ aria-hidden
76
+ className="hd-mac-symbol-icon hd-mac-symbol-icon-fallback"
77
+ style={{
78
+ width: glyphPx,
79
+ height: glyphPx,
80
+ fontSize: glyphPx,
81
+ }}
82
+ >
83
+ {fallback}
84
+ </span>
85
+ )}
75
86
  </MacIconButton>
76
87
  }
77
88
  />
@@ -235,6 +235,7 @@
235
235
  place-content: center;
236
236
  padding: 0;
237
237
  line-height: 0;
238
+ transform-origin: center;
238
239
  vertical-align: middle;
239
240
  }
240
241
 
@@ -261,6 +262,19 @@
261
262
  text-align: center;
262
263
  flex-shrink: 0;
263
264
  margin: auto;
265
+ transform-origin: center;
266
+ }
267
+
268
+ .hd-mac-symbol-icon-mask {
269
+ line-height: 0;
270
+ }
271
+
272
+ .hd-mac-symbol-icon-fallback {
273
+ color: currentColor;
274
+ font-family: -apple-system, BlinkMacSystemFont, sans-serif;
275
+ font-weight: 500;
276
+ line-height: 1;
277
+ transform: translateY(-0.04em);
264
278
  }
265
279
 
266
280
  .hd-mac-help-button {