An open source design system that's fully customizable and agent ready
TypeScript
// Generated by @astryxdesign/native. Do not edit.
public enum IconColor: String, CaseIterable, Codable, Sendable {
case primary = "primary"
case secondary = "secondary"
case tertiary = "tertiary"
case disabled = "disabled"
case accent = "accent"
case info = "info"
case success = "success"
case error = "error"
case warning = "warning"
case inherit = "inherit"
}
public enum IconSize: String, CaseIterable, Codable, Sendable {
case xsm = "xsm"
case sm = "sm"
case md = "md"
case lg = "lg"
}
#if os(iOS)
public struct IconProps {
/// Base props attach to this part on every platform.
public static let baseTarget: AstryxBaseTarget = .root
public var base: AstryxBaseProps
public var icon: IconName
public var color: IconColor?
public var size: IconSize?
public var label: String?
public init(icon: IconName, color: IconColor? = nil, size: IconSize? = nil, label: String? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
self.icon = icon
self.color = color
self.size = size
self.label = label
self.base = base
}
}
public struct IconNode: Decodable, Equatable, Sendable {
public struct Props: Decodable, Equatable, Sendable {
public var icon: IconName
public var color: IconColor?
public var size: IconSize?
public var label: String?
}
public let key: String
public let base: AstryxBaseProps?
public let props: Props
/// The callbacks the core listens to, by prop name.
public let events: [String]?
public func listens(_ event: String) -> Bool { events?.contains(event) ?? false }
/// The contract a Icon view takes; its callbacks send actions to the core.
public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> IconProps {
return IconProps(
icon: props.icon,
color: props.color,
size: props.size,
label: props.label,
base: base ?? AstryxBaseProps()
)
}
}
#endif
#if os(macOS)
public struct IconProps {
/// Base props attach to this part on every platform.
public static let baseTarget: AstryxBaseTarget = .root
public var base: AstryxBaseProps
public var icon: IconName
public var color: IconColor?
public var size: IconSize?
public var label: String?
public init(icon: IconName, color: IconColor? = nil, size: IconSize? = nil, label: String? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
self.icon = icon
self.color = color
self.size = size
self.label = label
self.base = base
}
}
public struct IconNode: Decodable, Equatable, Sendable {
public struct Props: Decodable, Equatable, Sendable {
public var icon: IconName
public var color: IconColor?
public var size: IconSize?
public var label: String?
}
public let key: String
public let base: AstryxBaseProps?
public let props: Props
/// The callbacks the core listens to, by prop name.
public let events: [String]?
public func listens(_ event: String) -> Bool { events?.contains(event) ?? false }
/// The contract a Icon view takes; its callbacks send actions to the core.
public func viewProps(send: @escaping @Sendable (AstryxAction) -> Void) -> IconProps {
return IconProps(
icon: props.icon,
color: props.color,
size: props.size,
label: props.label,
base: base ?? AstryxBaseProps()
)
}
}
#endif