mac-human-design 0.1.25 → 0.1.26
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,21 @@
|
|
|
2
2
|
|
|
3
3
|
This file tracks changes between published npm versions of `mac-human-design`.
|
|
4
4
|
|
|
5
|
+
## 0.1.26
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added safe `className`, `style`, and `tooltipSideOffset` pass-through props
|
|
10
|
+
to `SymbolIconButton`.
|
|
11
|
+
- Added verifier coverage for `SymbolIconButton` pass-through props, fixed
|
|
12
|
+
geometry preservation, tooltip offset handling, and explicit `type="button"`.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- `SymbolIconButton` now sets `type="button"` so toolbar icon buttons do not
|
|
17
|
+
accidentally submit surrounding forms.
|
|
18
|
+
- Bumped the package to `0.1.26`.
|
|
19
|
+
|
|
5
20
|
## 0.1.25
|
|
6
21
|
|
|
7
22
|
### Added
|
package/package.json
CHANGED
|
@@ -193,7 +193,12 @@ if (/\by\s*:/.test(iconMotionBranch)) {
|
|
|
193
193
|
const symbolIconRequirements = [
|
|
194
194
|
["SymbolIconButton imports MacIconButton", /import\s+\{\s*MacIconButton,\s*MacTooltip\s*\}\s+from\s+["']\.\/MacBaseUI["']/],
|
|
195
195
|
["SymbolIconButton render element is MacIconButton", /render=\{\s*<MacIconButton\b/],
|
|
196
|
-
["SymbolIconButton applies hd-mac-symbol-icon-button class", /
|
|
196
|
+
["SymbolIconButton applies hd-mac-symbol-icon-button class", /joinClasses\("hd-mac-symbol-icon-button", className\)/],
|
|
197
|
+
["SymbolIconButton defaults to button type", /type=["']button["']/],
|
|
198
|
+
["SymbolIconButton supports className pass-through", /\bclassName,\s*\n\s*style,/],
|
|
199
|
+
["SymbolIconButton supports style pass-through after fixed geometry", /\.\.\.style/],
|
|
200
|
+
["SymbolIconButton supports tooltip offset", /tooltipSideOffset = 5/],
|
|
201
|
+
["SymbolIconButton applies tooltip offset", /sideOffset=\{tooltipSideOffset\}/],
|
|
197
202
|
["SymbolIconButton exposes aria-busy loading state", /aria-busy=\{isLoading \|\| undefined\}/],
|
|
198
203
|
["masked symbol class path", /className=["']hd-mac-symbol-icon hd-mac-symbol-icon-mask["']/],
|
|
199
204
|
["fallback symbol class path", /className=["']hd-mac-symbol-icon hd-mac-symbol-icon-fallback["']/],
|
|
@@ -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={
|
|
104
|
+
<MacTooltip.Positioner sideOffset={tooltipSideOffset}>
|
|
92
105
|
<MacTooltip.Popup>{label}</MacTooltip.Popup>
|
|
93
106
|
</MacTooltip.Positioner>
|
|
94
107
|
</MacTooltip.Portal>
|