diff --git a/Sources/DashUIKit/Components/Icons/XmarkIcon.swift b/Sources/DashUIKit/Components/Icons/XmarkIcon.swift index 8887323..eea8d4c 100644 --- a/Sources/DashUIKit/Components/Icons/XmarkIcon.swift +++ b/Sources/DashUIKit/Components/Icons/XmarkIcon.swift @@ -22,12 +22,25 @@ import SwiftUI /// A code-drawn "✕" (close) icon. Mirrors the source SVG (9×9 viewBox, two diagonals /// inset from 0.75 to 7.75, round caps/joins). Scales cleanly to any `size`. @available(iOS 14, macOS 11, *) -struct XmarkIcon: View { - var size: CGFloat = 9 - var color: Color = Color.dash.primaryText - var lineWidth: CGFloat = 1.5 +public struct XmarkIcon: View { + public var size: CGFloat = 9 + public var color: Color = Color.dash.primaryText + public var lineWidth: CGFloat = 1.5 - var body: some View { + /// A public struct gets no public memberwise initializer, so this one is + /// written out to keep the call site unchanged for module-internal users + /// and available to app code. + public init( + size: CGFloat = 9, + color: Color = Color.dash.primaryText, + lineWidth: CGFloat = 1.5 + ) { + self.size = size + self.color = color + self.lineWidth = lineWidth + } + + public var body: some View { XmarkShape() .stroke(color, style: StrokeStyle(lineWidth: lineWidth, lineCap: .round, lineJoin: .round)) .frame(width: size, height: size) diff --git a/Sources/DashUIKit/Foundation/Icon_DashUI.swift b/Sources/DashUIKit/Foundation/Icon_DashUI.swift index 6c43553..3f5e278 100644 --- a/Sources/DashUIKit/Foundation/Icon_DashUI.swift +++ b/Sources/DashUIKit/Foundation/Icon_DashUI.swift @@ -156,6 +156,7 @@ public enum DashIcon { case security = "menu-security" case send = "menu-send" case sendAccount = "menu-send-account" + case sendAccountDisabled = "menu-send-account-disabled" case sendAddress = "menu-send-address" case sendDisabled = "menu-send-disabled" case settings = "menu-settings" diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/Contents.json b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/Contents.json new file mode 100644 index 0000000..7bdeb3f --- /dev/null +++ b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "menu-send-account-disabled.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "menu-send-account-disabled@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "menu-send-account-disabled@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/menu-send-account-disabled.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/menu-send-account-disabled.png new file mode 100644 index 0000000..35c922e Binary files /dev/null and b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/menu-send-account-disabled.png differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/menu-send-account-disabled@2x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/menu-send-account-disabled@2x.png new file mode 100644 index 0000000..5ba1813 Binary files /dev/null and b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/menu-send-account-disabled@2x.png differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/menu-send-account-disabled@3x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/menu-send-account-disabled@3x.png new file mode 100644 index 0000000..b41a15b Binary files /dev/null and b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Menu/menu-send-account-disabled.imageset/menu-send-account-disabled@3x.png differ diff --git a/docs/feedback.md b/docs/feedback.md index a50d614..cd08d4a 100644 --- a/docs/feedback.md +++ b/docs/feedback.md @@ -98,7 +98,7 @@ ErrorIllustration() ## XmarkIcon -File `Components/Icons/XmarkIcon.swift` · `@available(iOS 14, macOS 11, *)` · internal +File `Components/Icons/XmarkIcon.swift` · `@available(iOS 14, macOS 11, *)` · public A code-drawn "✕" close icon (a `Shape` with two round-capped diagonals, mirroring a 9×9 SVG), so it scales cleanly to any size without an asset. Used by `Toast`'s dismiss button. @@ -107,5 +107,8 @@ SVG), so it scales cleanly to any size without an asset. Used by `Toast`'s dismi XmarkIcon(size: 24, color: .white, lineWidth: 2) ``` -> Internal to the module (not part of the public API) — reach for the bundled -> `navigationbar-close` asset or an SF Symbol from app code. +> Prefer this over the bundled `navigationbar-close` asset when the close control +> is drawn at a non-standard size or needs to take the surrounding tint: being a +> `Shape`, it stays crisp at any `size` and honours `color` / `lineWidth`. The +> asset remains the right choice where the navigation bar's exact artwork is +> wanted.