Skip to content

1.5.0 #75

New issue

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

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

Already on GitHub? # to your account

Merged
merged 60 commits into from
Apr 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
509ec8a
fix: use superview's width in fullwidth components only when it's gre…
mikhailChelbaev Feb 11, 2025
96c2f39
Merge pull request #70 from componentskit/fix-fullwidth-components
mikhailChelbaev Feb 11, 2025
57ddce5
change default backaground color of modals to `secondaryBackground`
mikhailChelbaev Feb 17, 2025
2079126
change default color of the selected segment to `background`
mikhailChelbaev Feb 17, 2025
2bddd9d
add `accentBackground`, `successBackground`, `warningBackground` and …
mikhailChelbaev Feb 17, 2025
969d638
add `isEnabled` param to `Badge`
mikhailChelbaev Feb 17, 2025
3ca3775
improve code for `SUButton` and `UKButton`
mikhailChelbaev Feb 18, 2025
38f62e2
change large headline font size value from 28 to 24
mikhailChelbaev Feb 18, 2025
dc78c94
conform `ComponentsKitConfig` to `Equatable` protocol
mikhailChelbaev Feb 18, 2025
ccf8296
rename `ComponentsKitConfig` to `Theme`
mikhailChelbaev Feb 18, 2025
1cb7d20
change access level of type helpers to `public`
mikhailChelbaev Feb 19, 2025
cd9c1e7
revert change of selected segmented color and modal's background color
mikhailChelbaev Feb 19, 2025
a0a7f23
Merge pull request #71 from componentskit/components-improvements
mikhailChelbaev Feb 19, 2025
d7719c7
make UKCard generic over a content
mikhailChelbaev Feb 21, 2025
d7cb6cf
Merge pull request #72 from componentskit/card-generic-content
mikhailChelbaev Feb 21, 2025
c04f440
fix: modal not being presented on app launch
mikhailChelbaev Mar 10, 2025
18f53ba
change api of modals: calculate model with item
mikhailChelbaev Mar 10, 2025
dc8e9b3
added new api to present `suAlert` with an item
mikhailChelbaev Mar 10, 2025
e43d064
remove unused helpers
mikhailChelbaev Mar 11, 2025
3d7951f
Merge branch 'main' into dev
mikhailChelbaev Mar 11, 2025
303cbf0
send notification when the current theme changes
mikhailChelbaev Mar 13, 2025
a12d03f
add helpers to observe theme changes
mikhailChelbaev Mar 13, 2025
b31f71d
Update README.md
mikhailChelbaev Mar 13, 2025
8e5160a
update docs
mikhailChelbaev Mar 13, 2025
eb7a1c5
Merge pull request #73 from componentskit/alert-with-item
mikhailChelbaev Mar 13, 2025
8eeb592
run swiftlint
mikhailChelbaev Mar 13, 2025
1810098
Merge pull request #76 from componentskit/theme-observation
mikhailChelbaev Mar 14, 2025
889678f
make the light and dark color properties publicly accessible in `Univ…
mikhailChelbaev Mar 24, 2025
287d861
change default color for the selected segmented control
mikhailChelbaev Mar 25, 2025
e42e06e
improve method for calculating adapted corner radius for the text input
mikhailChelbaev Mar 27, 2025
4b98a2a
recalculate text input height when device rotates
mikhailChelbaev Mar 27, 2025
e539c85
make text input resistant to compression
mikhailChelbaev Mar 27, 2025
c55bc44
Merge pull request #78 from componentskit/fix-text-input-layout
mikhailChelbaev Mar 28, 2025
86f6420
force modal's content take all available width
mikhailChelbaev Mar 28, 2025
fa88454
Merge pull request #79 from componentskit/fix-sumodal-layout
mikhailChelbaev Mar 28, 2025
d4bf814
remove `Binding` from `currentValue` in `SUProgressBar`
mikhailChelbaev Mar 28, 2025
d62c05a
fix: do not update selected id if the item is disabled in `UKSegmente…
mikhailChelbaev Mar 28, 2025
87d7175
change previews order
mikhailChelbaev Mar 28, 2025
0bec5b1
add cotrast colors as `UniversalColor` extensions
mikhailChelbaev Mar 31, 2025
7652036
fix button's preferred font in the large size
mikhailChelbaev Mar 31, 2025
7128163
improve description for badge
mikhailChelbaev Apr 1, 2025
5ca7b7d
remove stroked style; add arc shape in the circular progress
mikhailChelbaev Apr 2, 2025
f1f5144
add `lineCap` param to circular progress
mikhailChelbaev Apr 2, 2025
8d4a46d
update initial model for circular progress in the demos
mikhailChelbaev Apr 2, 2025
57bb363
improve docs
mikhailChelbaev Apr 2, 2025
9f55031
improve docs for `UKCircularProgress`
mikhailChelbaev Apr 2, 2025
a776584
improve countdown docs
mikhailChelbaev Apr 2, 2025
01e29b3
remove `butt` line cap
mikhailChelbaev Apr 2, 2025
5b72522
Merge pull request #80 from componentskit/improve-circular-progress-s…
mikhailChelbaev Apr 2, 2025
4f1f441
Merge branch 'dev' of https://github.com/swiftcomponentsio/SwiftCompo…
mikhailChelbaev Apr 2, 2025
080603c
fix typo in the input field docs
mikhailChelbaev Apr 2, 2025
4a31807
add `currentValue` to `ProgressBarVM`
mikhailChelbaev Apr 2, 2025
c7bcd73
add `currentValue` to `CircularProgressVM`
mikhailChelbaev Apr 2, 2025
c76c414
remove default values from progress components' inits
mikhailChelbaev Apr 2, 2025
fdf880f
Merge pull request #81 from componentskit/improve-progress-components…
mikhailChelbaev Apr 3, 2025
774b976
improve radio group docs
mikhailChelbaev Apr 3, 2025
b4fbd90
improve segmented control docs
mikhailChelbaev Apr 3, 2025
e1add4f
improve slider docs
mikhailChelbaev Apr 3, 2025
30e9c69
fix typo in param name and docs
mikhailChelbaev Apr 3, 2025
03c1c5b
Merge branch 'dev' of https://github.com/swiftcomponentsio/SwiftCompo…
mikhailChelbaev Apr 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
Expand Up @@ -60,10 +60,10 @@ struct ModalPreviewHelpers {
Section("Properties") {
Picker("Background Color", selection: self.$model.backgroundColor) {
Text("Default").tag(Optional<UniversalColor>.none)
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)
Text("Accent Background").tag(UniversalColor.accentBackground)
Text("Success Background").tag(UniversalColor.successBackground)
Text("Warning Background").tag(UniversalColor.warningBackground)
Text("Danger Background").tag(UniversalColor.dangerBackground)
}
BorderWidthPicker(selection: self.$model.borderWidth)
Toggle("Closes On Overlay Tap", isOn: self.$model.closesOnOverlayTap)
Expand Down Expand Up @@ -203,16 +203,20 @@ Enim habitant laoreet inceptos scelerisque senectus, tellus molestie ut. Eros ri
}

static func suBody(body: ContentBody) -> some View {
Group {
switch body {
case .shortText:
Text(self.bodyShortText)
case .longText:
Text(self.bodyLongText)
HStack {
Group {
switch body {
case .shortText:
Text(self.bodyShortText)
case .longText:
Text(self.bodyLongText)
}
}
.font(self.bodyFont.font)
.multilineTextAlignment(.leading)

Spacer()
}
.font(self.bodyFont.font)
.multilineTextAlignment(.leading)
}

static func suFooter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ struct AlertPreview: View {
Section("Main Properties") {
Picker("Background Color", selection: self.$model.backgroundColor) {
Text("Default").tag(Optional<UniversalColor>.none)
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)
Text("Accent Background").tag(UniversalColor.accentBackground)
Text("Success Background").tag(UniversalColor.successBackground)
Text("Warning Background").tag(UniversalColor.warningBackground)
Text("Danger Background").tag(UniversalColor.dangerBackground)
}
BorderWidthPicker(selection: self.$model.borderWidth)
Toggle("Closes On Overlay Tap", isOn: self.$model.closesOnOverlayTap)
Expand Down Expand Up @@ -154,7 +154,7 @@ Enim habitant laoreet inceptos scelerisque senectus, tellus molestie ut. Eros ri
}
static let initialSecondaryButton = AlertButtonVM {
$0.title = SecondaryButtonText.short.rawValue
$0.style = .light
$0.style = .plain
}

var primaryButtonVMOrDefault: Binding<AlertButtonVM> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,17 @@ struct BadgePreview: View {
SUBadge(model: self.model)
}
Form {
ComponentOptionalColorPicker(selection: self.$model.color)
ComponentRadiusPicker(selection: self.$model.cornerRadius) {
Text("Custom: 4px").tag(ComponentRadius.custom(4))
}
Toggle("Enabled", isOn: self.$model.isEnabled)
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))
Expand All @@ -40,6 +36,10 @@ struct BadgePreview: View {
Text("12px; 10px")
.tag(Paddings(top: 10, leading: 12, bottom: 10, trailing: 12))
}
Picker("Style", selection: self.$model.style) {
Text("Filled").tag(BadgeVM.Style.filled)
Text("Light").tag(BadgeVM.Style.light)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct BottomModalPreview: View {
footer: self.$contentFooter,
additionalPickers: {
Toggle("Draggable", isOn: self.$model.isDraggable)
Toggle("Hides On Swap", isOn: self.$model.hidesOnSwap)
Toggle("Hides On Swipe", isOn: self.$model.hidesOnSwipe)
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ struct CardPreview: View {
Picker("Background Color", selection: self.$model.backgroundColor) {
Text("Default").tag(Optional<UniversalColor>.none)
Text("Secondary Background").tag(UniversalColor.secondaryBackground)
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)
Text("Accent Background").tag(UniversalColor.accentBackground)
Text("Success Background").tag(UniversalColor.successBackground)
Text("Warning Background").tag(UniversalColor.warningBackground)
Text("Danger Background").tag(UniversalColor.dangerBackground)
}
BorderWidthPicker(selection: self.$model.borderWidth)
Picker("Content Paddings", selection: self.$model.contentPaddings) {
Expand All @@ -37,7 +37,7 @@ struct CardPreview: View {
Text("Small").tag(Shadow.small)
Text("Medium").tag(Shadow.medium)
Text("Large").tag(Shadow.large)
Text("Custom").tag(Shadow.custom(20.0, .zero, ComponentColor.accent.background))
Text("Custom").tag(Shadow.custom(20.0, .zero, UniversalColor.accentBackground))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ import UIKit

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

private let circularProgress = UKCircularProgress(
model: Self.initialModel
)
private let circularProgress = UKCircularProgress(model: Self.initialModel)

private let timer = Timer
.publish(every: 0.5, on: .main, in: .common)
Expand All @@ -20,58 +17,54 @@ struct CircularProgressPreview: View {
self.circularProgress
.preview
.onAppear {
self.circularProgress.currentValue = Self.initialValue
self.circularProgress.model = Self.initialModel
}
.onChange(of: model) { newModel in
self.circularProgress.model = newModel
}
.onChange(of: self.currentValue) { newValue in
self.circularProgress.currentValue = newValue
}
}
PreviewWrapper(title: "SwiftUI") {
SUCircularProgress(currentValue: self.currentValue, model: self.model)
SUCircularProgress(model: self.model)
}
Form {
ComponentColorPicker(selection: self.$model.color)
CaptionFontPicker(selection: self.$model.font)
Picker("Line Cap", selection: self.$model.lineCap) {
Text("Rounded").tag(CircularProgressVM.LineCap.rounded)
Text("Square").tag(CircularProgressVM.LineCap.square)
}
Picker("Line Width", selection: self.$model.lineWidth) {
Text("Default").tag(Optional<CGFloat>.none)
Text("2").tag(Optional<CGFloat>.some(2))
Text("4").tag(Optional<CGFloat>.some(4))
Text("8").tag(Optional<CGFloat>.some(8))
}
SizePicker(selection: self.$model.size)
Picker("Style", selection: self.$model.style) {
Text("Light").tag(CircularProgressVM.Style.light)
Text("Striped").tag(CircularProgressVM.Style.striped)
Picker("Shape", selection: self.$model.shape) {
Text("Circle").tag(CircularProgressVM.Shape.circle)
Text("Arc").tag(CircularProgressVM.Shape.arc)
}
SizePicker(selection: self.$model.size)
}
.onReceive(self.timer) { _ in
if self.currentValue < self.model.maxValue {
if self.model.currentValue < self.model.maxValue {
let step = (self.model.maxValue - self.model.minValue) / 100
self.currentValue = min(
self.model.currentValue = min(
self.model.maxValue,
self.currentValue + CGFloat(Int.random(in: 1...20)) * step
self.model.currentValue + CGFloat(Int.random(in: 1...20)) * step
)
} else {
self.currentValue = self.model.minValue
self.model.currentValue = self.model.minValue
}
self.model.label = "\(Int(self.currentValue))%"
self.model.label = "\(Int(self.model.currentValue))%"
}
}
}

// MARK: - Helpers

private static var initialValue: Double {
return 0.0
}

private static var initialModel = CircularProgressVM {
$0.label = "0%"
$0.style = .light
$0.currentValue = 0.0
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ 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 progressBar = UKProgressBar(model: Self.initialModel)

private let timer = Timer
.publish(every: 0.5, on: .main, in: .common)
.autoconnect()
Expand All @@ -18,15 +17,14 @@ struct ProgressBarPreview: View {
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)
SUProgressBar(model: self.model)
}
Form {
ComponentColorPicker(selection: self.$model.color)
Expand All @@ -42,25 +40,20 @@ struct ProgressBarPreview: View {
}
}
.onReceive(self.timer) { _ in
if self.currentValue < self.model.maxValue {
if self.model.currentValue < self.model.maxValue {
let step = (self.model.maxValue - self.model.minValue) / 100
self.currentValue = min(
self.model.currentValue = min(
self.model.maxValue,
self.currentValue + CGFloat(Int.random(in: 1...20)) * step
self.model.currentValue + CGFloat(Int.random(in: 1...20)) * step
)
} else {
self.currentValue = self.model.minValue
self.model.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()
}
Expand Down
6 changes: 3 additions & 3 deletions Examples/DemosApp/DemosApp/Core/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ struct App: View {
NavigationLinkWithTitle("Loading") {
LoadingPreview()
}
NavigationLinkWithTitle("Progress Bar") {
ProgressBarPreview()
}
NavigationLinkWithTitle("Modal (Bottom)") {
BottomModalPreview()
}
NavigationLinkWithTitle("Modal (Center)") {
CenterModalPreview()
}
NavigationLinkWithTitle("Progress Bar") {
ProgressBarPreview()
}
NavigationLinkWithTitle("Radio Group") {
RadioGroupPreview()
}
Expand Down
Loading