feat(IconButton): 토큰 기반 사이즈/인터랙션 정책 재구성 및 모디파이어·토큰 API 추가#497
Conversation
WalkthroughIconButton의 사용자 상호작용 제어 메서드(disableInteraction, interactionColor)를 추가하고 metrics 기반 레이아웃으로 재구성했습니다. 동시에 Dimension 등 5개 토큰 유틸리티에 allValues/min/max를 확장하고, 프리뷰의 사이즈 로직을 간결하게 정리하며, 한국어 로컬라이제이션과 문서를 정비했습니다. ChangesIconButton 상호작용 제어 및 레이아웃 재설계
토큰 유틸리티 allValues/min/max 확장
IconButton 프리뷰 및 상태 관리 재구성
한국어 로컬라이제이션 및 문서 정비
예상 코드 리뷰 노력🎯 4 (Complex) | ⏱️ ~50 분 관련 PR
추천 라벨
추천 리뷰어
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Refs: WRP-924
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/Montage/1` Components/2 Actions/IconButton.swift:
- Around line 170-172: interactionSize is calculated as variant.interactionSize
+ 2 * padding but the final .frame uses + padding only once, causing mismatch
between visual padding and touch area; update the .frame size calculations
(where .frame is using + padding) to add 2 * padding (or use interactionSize
directly) so it matches .padding(.all, variant.backgroundOutset + padding) and
the interactionSize definition; apply the same change to the other occurrence
that mirrors lines 212-213, ensuring consistency between interactionSize,
padding, and frame sizing.
- Around line 439-443: Variant.background can produce negative frame sizes when
size is small; update the calculation in IconButton.swift to clamp the inner
dimension so it never goes negative by computing an innerSize = max(0,
CGFloat(size) - backgroundOutset * 2) (or enforce size >= backgroundOutset*2)
and use innerSize for width and height; reference the Variant.background case
and the backgroundOutset constant when making the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2ea5c0d3-d657-45ad-b0f4-2249eb0ba241
📒 Files selected for processing (7)
Sources/Blueprint/Sources/Scene/Previews/IconButtonPreview.swiftSources/Montage/1 Components/2 Actions/IconButton.swiftSources/Montage/1 Components/9 Utilities/Dimension.swiftSources/Montage/Asset/Localizable.xcstringsdocumentation/components/actions/iconbutton/ios.mddocumentation/utilities/ios-extensions/corefoundation.mdpackages/montage-mcp/data/components.json
…in·max 노출 Refs: WRP-924
…SoT 참조 Refs: WRP-924
Refs: WRP-924
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/Blueprint/Sources/Scene/Previews/IconButtonPreview.swift`:
- Line 181: The preview Slider currently uses a range of 10...100 which doesn't
match IconButton's actual custom container limits; update the Slider range(s) in
IconButtonPreview where customSize is bound (the SwiftUI.Slider instances around
lines referencing customSize) to use 24...64 so the preview values match the
real IconButton container range and rendering; locate the SwiftUI.Slider(value:
$customSize, ...) usages in IconButtonPreview and change their in: parameter to
24...64.
In `@Sources/Montage/1` Components/9 Utilities/Primitive.swift:
- Around line 30-41: Primitive.max currently returns the last value from
allValues which includes .primitiveInfinity, causing max to be infinite and
unsuitable for range/slider calculations; change the implementation so max
returns the largest finite primitive token (e.g., compute the last finite
element of allValues or add a new property like maxFinite) by filtering out
infinite values (use isFinite) and falling back to 0 if none found; keep
Primitive.min unchanged and reference allValues and primitiveInfinity when
locating the code to update.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: aedba78b-8aff-454d-afd9-baeecca41db3
📒 Files selected for processing (15)
Sources/Blueprint/Sources/Scene/Previews/IconButtonPreview.swiftSources/Montage/1 Components/2 Actions/IconButton.swiftSources/Montage/1 Components/9 Utilities/Dimension.swiftSources/Montage/1 Components/9 Utilities/Opacity.swiftSources/Montage/1 Components/9 Utilities/Primitive.swiftSources/Montage/1 Components/9 Utilities/Radius.swiftSources/Montage/1 Components/9 Utilities/Spacing.swiftdocumentation/components/actions/iconbutton/ios.mddocumentation/utilities/ios-utility-components/dimension.mddocumentation/utilities/ios-utility-components/opacity.mddocumentation/utilities/ios-utility-components/primitive.mddocumentation/utilities/ios-utility-components/radius.mddocumentation/utilities/ios-utility-components/spacing.mdpackages/montage-mcp/data/components.jsonpackages/montage-mcp/data/tokens.json
✅ Files skipped from review due to trivial changes (3)
- Sources/Montage/1 Components/9 Utilities/Spacing.swift
- documentation/utilities/ios-utility-components/spacing.md
- documentation/utilities/ios-utility-components/primitive.md
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/montage-mcp/data/components.json
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Sources/Blueprint/Sources/Scene/Previews/IconButtonPreview.swift (1)
45-54: 💤 Low value
variantIndex == 1분기의isCustomSize는 사용되지 않는 경로입니다.background variant(
variantIndex == 1)에서는 커스텀 슬라이더가 Line 185-190에서isCustomSize와 무관하게 항상 렌더링됩니다. 따라서case 1: true분기는 실제로 참조되지 않는 죽은 로직입니다. 동작에는 영향이 없으나, 의도를 명확히 하려면 주석으로 표시하거나 background를 별도 처리하는 편이 읽기 쉽습니다.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Sources/Blueprint/Sources/Scene/Previews/IconButtonPreview.swift` around lines 45 - 54, The case for variantIndex == 1 in the isCustomSize computed property is dead code because the background variant renders the custom slider independently; update isCustomSize (or the surrounding logic) to remove or clarify this branch: either remove the `case 1: true` branch and let only the relevant branches decide custom sizing (keep `case 0` and `default` logic), or explicitly return false for `case 1` and add a short comment on why background is handled elsewhere (reference the isCustomSize computed property and the background variant behavior in IconButtonPreview).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Sources/Blueprint/Sources/Scene/Previews/IconButtonPreview.swift`:
- Around line 45-54: The case for variantIndex == 1 in the isCustomSize computed
property is dead code because the background variant renders the custom slider
independently; update isCustomSize (or the surrounding logic) to remove or
clarify this branch: either remove the `case 1: true` branch and let only the
relevant branches decide custom sizing (keep `case 0` and `default` logic), or
explicitly return false for `case 1` and add a short comment on why background
is handled elsewhere (reference the isCustomSize computed property and the
background variant behavior in IconButtonPreview).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ec23fae3-fcf4-460d-b748-deed52f83c95
📒 Files selected for processing (4)
Sources/Blueprint/Sources/Scene/Previews/IconButtonPreview.swiftSources/Montage/1 Components/9 Utilities/Primitive.swiftdocumentation/utilities/ios-utility-components/primitive.mdpackages/montage-mcp/data/tokens.json
🚧 Files skipped from review as they are similar to previous changes (2)
- documentation/utilities/ios-utility-components/primitive.md
- packages/montage-mcp/data/tokens.json
개요
IconButton의 사이즈/인터랙션 영역 산정을 하드코딩 방식에서 디자인 토큰 기반 icon-first 모델로 재구성하고, 이를 지원하는 모디파이어와 토큰 SSoT API를 함께 추가한다.
수정사항
IconButton 사이즈/인터랙션 정책
interactionExpansion제거 →interactionSize/interactionRadius도입normalvariant:iconSize × 1.5보다 큰 첫번째 dimension 토큰으로 interaction(터치) 영역 산정, WCAG 24×24 최소 영역 보장normalvariant:interactionSize × 0.3보다 작은 첫번째 radius 토큰으로 모서리 반경 산정backgroundvariant:size파라미터를 "음영 포함 전체 크기"로 정정 (Blueprint 기본값 24→20 조정)모디파이어 추가
disableInteraction/interactionColor모디파이어 추가 (토큰 SSoT 참조)토큰 SSoT API
allValues·min·max노출 (토큰 스냅·최대/최소 도출용)Primitive는allValues에primitiveInfinity가 포함되어, 유한 최대값이 필요한 범위·슬라이더 제약 계산을 위해max대신finiteMax제공dimension12토큰 추가버그 수정
normal+custom에서outlined전환 시 발생하던 크래시 수정backgroundvariant에서 지정한 크기가 음영을 포함한 전체 크기가 되도록 조정backgrounOutset오타를backgroundOutset으로 수정Blueprint / 문서
disableInteraction/interactionColor등)24...64)에 맞춤미리보기