Skip to content

v1.4.0 #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 130 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
b47ec3d
SUProgressBar and ProgressBarVM
VislovIvan Dec 24, 2024
ac97dea
Documentation
VislovIvan Dec 24, 2024
04c3980
swiftlint fix
VislovIvan Dec 24, 2024
1070027
.self added
VislovIvan Dec 25, 2024
b2ac453
code style fix
VislovIvan Dec 26, 2024
4504026
ProgressBarPreview step fix
VislovIvan Dec 26, 2024
fd77126
padding fix
VislovIvan Dec 26, 2024
dd1158d
var fraction fix
VislovIvan Dec 26, 2024
0ff5aea
stripes fix
VislovIvan Dec 26, 2024
9b65fae
unused properties removed
VislovIvan Dec 26, 2024
3cec343
added innerCornerRadius
VislovIvan Dec 26, 2024
1f5ecd1
some minor fix
VislovIvan Dec 26, 2024
4d508f6
automatic progress in preview
VislovIvan Dec 26, 2024
e506856
UKProgressBar
VislovIvan Dec 30, 2024
484b972
Documentation
VislovIvan Dec 30, 2024
d9b9b81
swiftlint fix
VislovIvan Dec 30, 2024
5bafbbc
renamed layoutNeedsUpdate
VislovIvan Dec 30, 2024
34c6d87
some fix
VislovIvan Dec 30, 2024
f21599a
fix contentPaddings
VislovIvan Dec 31, 2024
b6470ff
code style fix
VislovIvan Dec 31, 2024
8a36501
fix self
VislovIvan Dec 31, 2024
a88172e
.onReceive code style fix
VislovIvan Dec 31, 2024
40d1a5f
swiftlint fix
VislovIvan Dec 31, 2024
4e8055d
minor code improvements
mikhailChelbaev Dec 31, 2024
c08d790
merge with dev
mikhailChelbaev Jan 2, 2025
99c9756
fix shouldUpdateLayout
VislovIvan Jan 2, 2025
ab22fe9
Preview fix
VislovIvan Jan 2, 2025
dc192aa
progress extracted
VislovIvan Jan 2, 2025
2779d70
updateBarWidth fix
VislovIvan Jan 2, 2025
3c963fa
intrinsicContentSize fix
VislovIvan Jan 2, 2025
ace276a
currentValue renamed to initialValue
VislovIvan Jan 2, 2025
9fcef79
horizontalPadding
VislovIvan Jan 2, 2025
49b8e91
corner radius fix
VislovIvan Jan 2, 2025
76516e9
renaming
VislovIvan Jan 2, 2025
faf4e54
style extension for UKProgressBar
VislovIvan Jan 2, 2025
50bdc32
swiftlint fix
VislovIvan Jan 2, 2025
78c07c7
fix layout metod
VislovIvan Jan 5, 2025
d921d2a
CAShapeLayer for stripedLayer instead of UIView
VislovIvan Jan 5, 2025
84abff2
fix animation
VislovIvan Jan 5, 2025
5f90099
code style fix
VislovIvan Jan 5, 2025
9a2c02e
some fix
VislovIvan Jan 7, 2025
1a7b716
Merge branch 'SUProgressBar' into UKProgressBar
VislovIvan Jan 7, 2025
058e95a
swiftlint fix
VislovIvan Jan 7, 2025
9d2ba44
Merge branch 'UKProgressBar' of https://github.com/componentskit/Comp…
VislovIvan Jan 7, 2025
cb9babd
fix merge conflicts
VislovIvan Jan 7, 2025
0d1b482
move ProgressBar folder into Components
mikhailChelbaev Jan 7, 2025
263a302
improve layout in UKProgressBar
mikhailChelbaev Jan 7, 2025
4e22f5b
fix progress bar preview
mikhailChelbaev Jan 7, 2025
c10bc32
improve helpers to calculate corner radius in progress bar
mikhailChelbaev Jan 7, 2025
fcc588d
simplify code in progress bar
mikhailChelbaev Jan 7, 2025
f8fab4d
improve method's name
mikhailChelbaev Jan 7, 2025
7ae6885
validate min max values in UKProgressBar
mikhailChelbaev Jan 8, 2025
06e613b
change animation style in progress bar to `linear`
mikhailChelbaev Jan 8, 2025
d6d9e83
Merge pull request #43 from componentskit/SUProgressBar
mikhailChelbaev Jan 8, 2025
035e486
Merge pull request #50 from componentskit/UKProgressBar
mikhailChelbaev Jan 8, 2025
b28aeb0
fix: properly calculate progress height
mikhailChelbaev Jan 8, 2025
ed16a8d
fix: do not display stripes outside of the progress bar
mikhailChelbaev Jan 8, 2025
cffc156
fix: update a method to calculate a corner radius for the selected se…
mikhailChelbaev Jan 8, 2025
0590f98
Merge pull request #53 from componentskit/fix-bugs
mikhailChelbaev Jan 8, 2025
03ee108
SUBadge
VislovIvan Jan 12, 2025
10bc937
UKBadge
VislovIvan Jan 12, 2025
ae7b7ef
swiftlint fix
VislovIvan Jan 12, 2025
b49bb88
swiftlint fix
VislovIvan Jan 12, 2025
0db1162
Merge branch 'main' into dev
mikhailChelbaev Jan 13, 2025
ede79ba
add avatar model
mikhailChelbaev Jan 13, 2025
87beac0
pr fix
VislovIvan Jan 13, 2025
b7b8f21
Merge branch 'SUBadge' into UKBadge
VislovIvan Jan 13, 2025
3baf924
pr fix
VislovIvan Jan 13, 2025
38a3c07
swiftlint fix
VislovIvan Jan 13, 2025
7fa7518
update custom corner radius in badge's preview
mikhailChelbaev Jan 14, 2025
7e99549
fix warning in `StripesShape` struct
mikhailChelbaev Jan 14, 2025
47c99d4
deleted traitCollectionDidChange
VislovIvan Jan 14, 2025
d53eef5
added paddings picker into preview
VislovIvan Jan 14, 2025
d28eebd
add suavatar implementation and avatar preview
mikhailChelbaev Jan 15, 2025
9ebe453
write docs for public types
mikhailChelbaev Jan 15, 2025
27ade83
fix: clip image after setting the size
mikhailChelbaev Jan 15, 2025
9a80d71
refactor: improve logic for displaying remote images
mikhailChelbaev Jan 15, 2025
cf8039d
add UKAvatar implementation
mikhailChelbaev Jan 15, 2025
69aae35
improve structure of SUAvatar
mikhailChelbaev Jan 15, 2025
6b4181e
refactor: extract logic for getting an avatar image into a separate m…
mikhailChelbaev Jan 15, 2025
6ca5054
remove unused helper
mikhailChelbaev Jan 15, 2025
fe0a5bc
Merge pull request #56 from componentskit/SUBadge
mikhailChelbaev Jan 15, 2025
4d66c7f
Merge pull request #57 from componentskit/UKBadge
mikhailChelbaev Jan 15, 2025
f70ae3b
replace avatar image for the demo app
mikhailChelbaev Jan 16, 2025
463cf9a
merge with SUAvatar
mikhailChelbaev Jan 16, 2025
afe81fa
add AvatarGroupVM and AvatarItemVM
mikhailChelbaev Jan 16, 2025
0149c7b
implement avatar group, add avatar group preview
mikhailChelbaev Jan 17, 2025
f09f40e
improve docs
mikhailChelbaev Jan 17, 2025
09eb230
fix: update placeholder when appearance style changes
mikhailChelbaev Jan 17, 2025
b3ed278
merge with UKAvatar
mikhailChelbaev Jan 17, 2025
78b63e8
update intrinsic content size value
mikhailChelbaev Jan 17, 2025
c30888f
implement UKAvatarGroup
mikhailChelbaev Jan 17, 2025
0107f14
update image manager when avatar content view appears
mikhailChelbaev Jan 17, 2025
2b7e81a
Merge branch 'SUAvatarGroup' into UKAvatarGroup
mikhailChelbaev Jan 17, 2025
12abeb5
set priority of avatar width in the container to `defaultHigh`
mikhailChelbaev Jan 17, 2025
9777cdc
remove unused code
mikhailChelbaev Jan 17, 2025
9eb04ed
improve layout in UKAlertGroup
mikhailChelbaev Jan 17, 2025
93d0d6a
remove unnecessary code
mikhailChelbaev Jan 17, 2025
41bb055
SUSlider
VislovIvan Jan 17, 2025
50b04b5
steppedValue calculation extracted into model
VislovIvan Jan 20, 2025
39166d6
merge with dev
mikhailChelbaev Jan 20, 2025
e3bebbe
Merge pull request #59 from componentskit/SUAvatar
mikhailChelbaev Jan 20, 2025
c0bfea1
cancel stream on deinit
mikhailChelbaev Jan 20, 2025
73f27c1
Merge pull request #60 from componentskit/UKAvatar
mikhailChelbaev Jan 20, 2025
ddf4f23
fix: add missing bracket
mikhailChelbaev Jan 20, 2025
2072440
fix: properly calculate blended colors
mikhailChelbaev Jan 20, 2025
d820223
small fix and documentation
VislovIvan Jan 20, 2025
0f5e875
suppressing the warning
VislovIvan Jan 20, 2025
2a2e011
suppressing the warning
VislovIvan Jan 20, 2025
8f3e2a3
added layout properties into model
VislovIvan Jan 20, 2025
4a0c6bc
Merge pull request #58 from componentskit/fix-warnings
mikhailChelbaev Jan 21, 2025
890627d
some fix
VislovIvan Jan 21, 2025
058dd67
.foregroundStyle fix
VislovIvan Jan 21, 2025
e80ac22
fix: set avatars distribution
mikhailChelbaev Jan 21, 2025
35611b2
merge with dev
mikhailChelbaev Jan 21, 2025
a14ab1d
Merge pull request #63 from componentskit/SUAvatarGroup
mikhailChelbaev Jan 21, 2025
2842132
Merge pull request #64 from componentskit/UKAvatarGroup
mikhailChelbaev Jan 21, 2025
45f3767
UKSlider
VislovIvan Jan 23, 2025
bdc708f
improve logic for calculating slider position in UKSlider
mikhailChelbaev Jan 23, 2025
e986110
added onValueChange
VislovIvan Jan 24, 2025
d2e5592
handleOverlayView
VislovIvan Jan 24, 2025
2812bd2
added stripedLayer
VislovIvan Jan 24, 2025
9ae7ed5
fix swiftui handle cornerRadius
VislovIvan Jan 24, 2025
9701c2c
Documentation
VislovIvan Jan 24, 2025
58e1ad5
improve `handleOverlay` styling and layout
mikhailChelbaev Jan 27, 2025
c22d663
Merge pull request #65 from componentskit/SUSlider
mikhailChelbaev Jan 27, 2025
6156d48
Merge pull request #66 from componentskit/UKSlider
mikhailChelbaev Jan 27, 2025
f10b6fe
fix mistakes in alert docs
mikhailChelbaev Jan 30, 2025
b3b6050
update initializers
mikhailChelbaev Feb 3, 2025
3446130
Merge pull request #68 from componentskit/refactor/inits
mikhailChelbaev Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "avatar.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "avatar_placeholder.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import ComponentsKit
import SwiftUI
import UIKit

struct AvatarGroupPreview: View {
@State private var model = AvatarGroupVM {
$0.items = [
.init {
$0.imageSrc = .remote(URL(string: "https://i.pravatar.cc/150?img=12")!)
},
.init {
$0.imageSrc = .remote(URL(string: "https://i.pravatar.cc/150?img=14")!)
},
.init {
$0.imageSrc = .remote(URL(string: "https://i.pravatar.cc/150?img=15")!)
},
.init(),
.init(),
.init {
$0.placeholder = .text("IM")
},
.init {
$0.placeholder = .sfSymbol("person.circle")
},
]
}

var body: some View {
VStack {
PreviewWrapper(title: "UIKit") {
UKAvatarGroup(model: self.model)
.preview
}
PreviewWrapper(title: "SwiftUI") {
SUAvatarGroup(model: self.model)
}
Form {
Picker("Border Color", selection: self.$model.borderColor) {
Text("Background").tag(UniversalColor.background)
Text("Accent Background").tag(ComponentColor.accent.background)
Text("Success Background").tag(ComponentColor.success.background)
Text("Warning Background").tag(ComponentColor.warning.background)
Text("Danger Background").tag(ComponentColor.danger.background)
}
ComponentOptionalColorPicker(selection: self.$model.color)
ComponentRadiusPicker(selection: self.$model.cornerRadius) {
Text("Custom: 4px").tag(ComponentRadius.custom(4))
}
Picker("Max Visible Avatars", selection: self.$model.maxVisibleAvatars) {
Text("3").tag(3)
Text("5").tag(5)
Text("7").tag(7)
}
SizePicker(selection: self.$model.size)
}
}
}
}

#Preview {
AvatarGroupPreview()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import ComponentsKit
import SwiftUI
import UIKit

struct AvatarPreview: View {
@State private var model = AvatarVM {
$0.placeholder = .icon("avatar_placeholder")
}

var body: some View {
VStack {
PreviewWrapper(title: "UIKit") {
UKAvatar(model: self.model)
.preview
}
PreviewWrapper(title: "SwiftUI") {
SUAvatar(model: self.model)
}
Form {
ComponentOptionalColorPicker(selection: self.$model.color)
ComponentRadiusPicker(selection: self.$model.cornerRadius) {
Text("Custom: 4px").tag(ComponentRadius.custom(4))
}
Picker("Image Source", selection: self.$model.imageSrc) {
Text("Remote").tag(AvatarVM.ImageSource.remote(URL(string: "https://i.pravatar.cc/150?img=12")!))
Text("Local").tag(AvatarVM.ImageSource.local("avatar_image"))
Text("None").tag(Optional<AvatarVM.ImageSource>.none)
}
Picker("Placeholder", selection: self.$model.placeholder) {
Text("Text").tag(AvatarVM.Placeholder.text("IM"))
Text("SF Symbol").tag(AvatarVM.Placeholder.sfSymbol("person"))
Text("Icon").tag(AvatarVM.Placeholder.icon("avatar_placeholder"))
}
SizePicker(selection: self.$model.size)
}
}
}
}

#Preview {
AvatarPreview()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import ComponentsKit
import SwiftUI
import UIKit

struct BadgePreview: View {
@State private var model = BadgeVM {
$0.title = "Badge"
}

var body: some View {
VStack {
PreviewWrapper(title: "UIKit") {
UKBadge(model: self.model)
.preview
}
PreviewWrapper(title: "SwiftUI") {
SUBadge(model: self.model)
}
Form {
Picker("Font", selection: self.$model.font) {
Text("Default").tag(Optional<UniversalFont>.none)
Text("Small").tag(UniversalFont.smButton)
Text("Medium").tag(UniversalFont.mdButton)
Text("Large").tag(UniversalFont.lgButton)
Text("Custom: system bold of size 16").tag(UniversalFont.system(size: 16, weight: .bold))
}
ComponentOptionalColorPicker(selection: self.$model.color)
ComponentRadiusPicker(selection: self.$model.cornerRadius) {
Text("Custom: 4px").tag(ComponentRadius.custom(4))
}
Picker("Style", selection: self.$model.style) {
Text("Filled").tag(BadgeVM.Style.filled)
Text("Light").tag(BadgeVM.Style.light)
}
Picker("Paddings", selection: self.$model.paddings) {
Text("8px; 6px")
.tag(Paddings(top: 6, leading: 8, bottom: 6, trailing: 8))
Text("10px; 8px")
.tag(Paddings(top: 8, leading: 10, bottom: 8, trailing: 10))
Text("12px; 10px")
.tag(Paddings(top: 10, leading: 12, bottom: 10, trailing: 12))
}
}
}
}
}

#Preview {
BadgePreview()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import ComponentsKit
import SwiftUI
import UIKit

struct ProgressBarPreview: View {
@State private var model = Self.initialModel
@State private var currentValue: CGFloat = Self.initialValue

private let progressBar = UKProgressBar(initialValue: Self.initialValue, model: Self.initialModel)

private let timer = Timer
.publish(every: 0.1, on: .main, in: .common)
.autoconnect()

var body: some View {
VStack {
PreviewWrapper(title: "UIKit") {
self.progressBar
.preview
.onAppear {
self.progressBar.currentValue = self.currentValue
self.progressBar.model = Self.initialModel
}
.onChange(of: self.model) { newValue in
self.progressBar.model = newValue
}
}
PreviewWrapper(title: "SwiftUI") {
SUProgressBar(currentValue: self.$currentValue, model: self.model)
}
Form {
ComponentColorPicker(selection: self.$model.color)
ComponentRadiusPicker(selection: self.$model.cornerRadius) {
Text("Custom: 2px").tag(ComponentRadius.custom(2))
}
SizePicker(selection: self.$model.size)
Picker("Style", selection: self.$model.style) {
Text("Light").tag(ProgressBarVM.Style.light)
Text("Filled").tag(ProgressBarVM.Style.filled)
Text("Striped").tag(ProgressBarVM.Style.striped)
}
}
}
.onReceive(self.timer) { _ in
if self.currentValue < self.model.maxValue {
self.currentValue += (self.model.maxValue - self.model.minValue) / 100
} else {
self.currentValue = self.model.minValue
}

self.progressBar.currentValue = self.currentValue
}
}

// MARK: - Helpers

private static var initialValue: Double {
return 0.0
}
private static var initialModel: ProgressBarVM {
return .init()
}
}

#Preview {
ProgressBarPreview()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import SwiftUI
import ComponentsKit

struct SliderPreview: View {
@State private var model = SliderVM {
$0.style = .light
$0.minValue = 0
$0.maxValue = 100
$0.cornerRadius = .full
}
@State private var currentValue: CGFloat = 30

var body: some View {
VStack {
PreviewWrapper(title: "UIKit") {
UKSlider(initialValue: self.currentValue, model: self.model)
.preview
}
PreviewWrapper(title: "SwiftUI") {
SUSlider(currentValue: self.$currentValue, model: self.model)
}
Form {
ComponentColorPicker(selection: self.$model.color)
ComponentRadiusPicker(selection: self.$model.cornerRadius) {
Text("Custom: 2px").tag(ComponentRadius.custom(2))
}
SizePicker(selection: self.$model.size)
Picker("Step", selection: self.$model.step) {
Text("1").tag(CGFloat(1))
Text("5").tag(CGFloat(5))
Text("10").tag(CGFloat(10))
Text("25").tag(CGFloat(25))
Text("50").tag(CGFloat(50))
}
Picker("Style", selection: self.$model.style) {
Text("Light").tag(SliderVM.Style.light)
Text("Striped").tag(SliderVM.Style.striped)
}
}
}
}
}

#Preview {
SliderPreview()
}
15 changes: 15 additions & 0 deletions Examples/DemosApp/DemosApp/Core/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ struct App: View {
NavigationLinkWithTitle("Alert") {
AlertPreview()
}
NavigationLinkWithTitle("Avatar") {
AvatarPreview()
}
NavigationLinkWithTitle("Avatar Group") {
AvatarGroupPreview()
}
NavigationLinkWithTitle("Badge") {
BadgePreview()
}
NavigationLinkWithTitle("Button") {
ButtonPreview()
}
Expand All @@ -29,6 +38,9 @@ struct App: View {
NavigationLinkWithTitle("Loading") {
LoadingPreview()
}
NavigationLinkWithTitle("Progress Bar") {
ProgressBarPreview()
}
NavigationLinkWithTitle("Modal (Bottom)") {
BottomModalPreview()
}
Expand All @@ -41,6 +53,9 @@ struct App: View {
NavigationLinkWithTitle("Segmented Control") {
SegmentedControlPreview()
}
NavigationLinkWithTitle("Slider") {
SliderPreview()
}
NavigationLinkWithTitle("Text Input") {
TextInputPreviewPreview()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ struct AlertButtonsOrientationCalculator {
case horizontal
}

private static let primaryButton = UKButton()
private static let secondaryButton = UKButton()
private static let primaryButton = UKButton(model: .init())
private static let secondaryButton = UKButton(model: .init())

private init() {}

Expand Down
Loading