Skip to content
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

RELEASE: 1.3.1 #33

Merged
merged 4 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "1.3.0",
"release_notes": "From now on `PBAttentionView` will be named `PBInfoBar`"
"version": "1.3.1",
"release_notes": "Enhancements to `PBRowView` and `PBUITextField` components"
}
24 changes: 16 additions & 8 deletions Sources/PashaKit/PBRowView/PBRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,16 @@ open class PBRowView: UIView, PBSkeletonable {
self.subtitleLabel.text = subtitleText
self.isChevronIconVisible = isChevronIconVisible

self.layoutMargins = UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)

self.setupViews()
}

init() {
super.init(frame: .zero)
self.layoutMargins = UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)
}

/// Sets data for a row view.
///
/// - Parameters:
Expand Down Expand Up @@ -577,20 +584,16 @@ open class PBRowView: UIView, PBSkeletonable {

private func setupConstraints() {
NSLayoutConstraint.activate([
self.primaryStackView.topAnchor.constraint(equalTo: self.topAnchor, constant: 8.0),
self.primaryStackView.leftAnchor.constraint(equalTo: self.leftAnchor, constant: 16.0),
self.primaryStackView.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -8.0),
self.primaryStackView.rightAnchor.constraint(equalTo: self.rightAnchor, constant: -16.0)
self.primaryStackView.topAnchor.constraint(equalTo: self.layoutMarginsGuide.topAnchor),
self.primaryStackView.leftAnchor.constraint(equalTo: self.layoutMarginsGuide.leftAnchor),
self.primaryStackView.bottomAnchor.constraint(equalTo: self.layoutMarginsGuide.bottomAnchor),
self.primaryStackView.rightAnchor.constraint(equalTo: self.layoutMarginsGuide.rightAnchor)
])

self.setupLeftIconWrapperConstraints(for: self.leftViewSize)
self.setupLeftIconConstraints()
self.setupIsNewConstraints()

NSLayoutConstraint.activate([
self.subtitleLabel.widthAnchor.constraint(greaterThanOrEqualToConstant: 100.0)
])

NSLayoutConstraint.activate([
self.rightIconView.topAnchor.constraint(equalTo: self.rightIconWrapperView.topAnchor, constant: 3.0),
self.rightIconView.leftAnchor.constraint(equalTo: self.rightIconWrapperView.leftAnchor, constant: 6.0),
Expand Down Expand Up @@ -668,5 +671,10 @@ open class PBRowView: UIView, PBSkeletonable {
self.subtitleLabel.numberOfLines = 0
}
}

open override func safeAreaInsetsDidChange() {
super.safeAreaInsetsDidChange()
self.setupConstraints()
}
}

17 changes: 15 additions & 2 deletions Sources/PashaKit/PBUITextField/PBUITextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,21 @@ public class PBUITextField: UIView {
///
public var disableManualInput: Bool = false {
didSet {
self.customTextField.isUserInteractionEnabled = false
self.customTextField.isUserInteractionEnabled = !self.disableManualInput
}
}

public var shouldGrayifyBackgroundWhenDisabled: Bool = false {
didSet {
if self.disableManualInput && shouldGrayifyBackgroundWhenDisabled {
self.performAnimation {
self.customBorder.backgroundColor = .black.withAlphaComponent(0.06)
}
} else {
self.performAnimation {
self.customBorder.backgroundColor = .white
}
}
}
}

Expand Down Expand Up @@ -404,7 +418,6 @@ public class PBUITextField: UIView {
customBorder.layer.cornerRadius = 12.0
customBorder.layer.borderWidth = 1.0
customBorder.layer.borderColor = self.defaultBorderColor.cgColor
customBorder.backgroundColor = .clear

return customBorder
}()
Expand Down