diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index fdfe2b15..c17e971e 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -1523,7 +1523,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 66; + CURRENT_PROJECT_VERSION = 67; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1561,7 +1561,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 66; + CURRENT_PROJECT_VERSION = 67; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; diff --git a/VDS/Components/Calendar/Calendar.swift b/VDS/Components/Calendar/Calendar.swift index 2b0ba57b..cd1c783b 100644 --- a/VDS/Components/Calendar/Calendar.swift +++ b/VDS/Components/Calendar/Calendar.swift @@ -160,7 +160,7 @@ open class CalendarBase: Control, Changeable { if (minDate <= maxDate) { // Check if current date falls between min & max dates. let fallsBetween = displayDate.isBetweeen(date: minDate, andDate: maxDate) - displayDate = fallsBetween ? displayDate : minDate + displayDate = fallsBetween ? displayDate : (displayDate.monthInt == minDate.monthInt) ? minDate : maxDate fetchDates(with: displayDate) } containerView.backgroundColor = transparentBackground ? .clear : backgroundColorConfiguration.getColor(self) @@ -201,7 +201,7 @@ open class CalendarBase: Control, Changeable { } } updateViewConstraints() - } + } func updateViewConstraints() { collectionView.reloadData() @@ -331,38 +331,28 @@ extension CalendarBase: UICollectionViewDelegate, UICollectionViewDataSource, UI } } - - public func collectionView(_ collectionView: UICollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool { - if let cell = collectionView.cellForItem(at: indexPath) as? CalendarDateViewCell { - let isEnabled: Bool = cell.isDateEnabled() - if isEnabled { - cell.activeModeStart() - } - } - return true - } - public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { // reload selected index, if it is in enabled state. if let cell = collectionView.cellForItem(at: indexPath) as? CalendarDateViewCell { - let isEnabled: Bool = cell.isDateEnabled() - if isEnabled { - cell.activeModeEnd() - - // Callback to pass selected date if it is enabled only. - selectedDate = dates[indexPath.row] - sendActions(for: .valueChanged) - displayDate = selectedDate - - var reloadIndexPaths = [indexPath] - - // If an cell is already selected, then it needs to be deselected. - // Add its index path to the array of index paths to be reloaded. - if let deselectIndexPath = selectedIndexPath { - reloadIndexPaths.append(deselectIndexPath) + let hasDate: Bool = cell.hasText() + if hasDate { + let isEnabled: Bool = cell.isDateEnabled() + if isEnabled { + // Callback to pass selected date if it is enabled only. + selectedDate = dates[indexPath.row] + sendActions(for: .valueChanged) + displayDate = selectedDate + + var reloadIndexPaths = [indexPath] + + // If an cell is already selected, then it needs to be deselected. + // Add its index path to the array of index paths to be reloaded. + if let deselectIndexPath = selectedIndexPath { + reloadIndexPaths.append(deselectIndexPath) + } + + collectionView.reloadItems(at: reloadIndexPaths) } - - collectionView.reloadItems(at: reloadIndexPaths) } } } diff --git a/VDS/Components/Calendar/CalendarDateViewCell.swift b/VDS/Components/Calendar/CalendarDateViewCell.swift index 4b6f400d..607eac76 100644 --- a/VDS/Components/Calendar/CalendarDateViewCell.swift +++ b/VDS/Components/Calendar/CalendarDateViewCell.swift @@ -41,6 +41,21 @@ final class CalendarDateViewCell: UICollectionViewCell { $0.textStyle = .bodySmall } + override var isHighlighted: Bool { + didSet{ + if self.isHighlighted && hasText() && isDateEnabled() { + self.contentView.layer.borderColor = activeBorderColorConfiguration.getColor(surface).cgColor + self.contentView.layer.borderWidth = VDSFormControls.borderWidth + self.contentView.layer.cornerRadius = VDSFormControls.borderRadius + } else { + self.contentView.layer.borderColor = nil + self.contentView.layer.borderWidth = 0 + self.contentView.layer.cornerRadius = 0 + } + } + } + + private var isEnabled = false private lazy var shapeLayer = CAShapeLayer() private var surface: Surface = .light private let selectedTextColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryInverseOnlight, VDSColor.elementsPrimaryInverseOndark) @@ -120,20 +135,21 @@ final class CalendarDateViewCell: UICollectionViewCell { } } - // update text color, bg color, corner radius. - if numberLabel.text == selectedDate.getDay() - && selectedDate.monthInt == displayDate.monthInt - && selectedDate.yearInt == displayDate.yearInt - && numberLabel.isEnabled { - - numberLabel.textColor = selectedTextColorConfiguration.getColor(surface) - layer.backgroundColor = selectedBackgroundColor.getColor(surface).cgColor - layer.cornerRadius = VDSFormControls.borderRadius - - } else { - numberLabel.textColor = unselectedTextColorConfiguration.getColor(surface) - layer.backgroundColor = nil - layer.cornerRadius = 0 + // Set selected/unselected state text color, bg color, corner radius if cell is in enabled state. + if isEnabled { + if numberLabel.text == selectedDate.getDay() + && selectedDate.monthInt == displayDate.monthInt + && selectedDate.yearInt == displayDate.yearInt { + + numberLabel.textColor = selectedTextColorConfiguration.getColor(surface) + layer.backgroundColor = selectedBackgroundColor.getColor(surface).cgColor + layer.cornerRadius = VDSFormControls.borderRadius + + } else { + numberLabel.textColor = unselectedTextColorConfiguration.getColor(surface) + layer.backgroundColor = nil + layer.cornerRadius = 0 + } } // add indicators. @@ -155,26 +171,18 @@ final class CalendarDateViewCell: UICollectionViewCell { numberLabel.textStyle = .bodySmall } } - + + func hasText() -> Bool { + return !numberLabel.text.isEmpty + } + // returns cell enabled state. func isDateEnabled() -> Bool { - return numberLabel.isEnabled - } - - func activeModeStart() { - numberLabel.layer.borderColor = activeBorderColorConfiguration.getColor(surface).cgColor - numberLabel.layer.borderWidth = VDSFormControls.borderWidth - numberLabel.layer.cornerRadius = VDSFormControls.borderRadius - } - - func activeModeEnd() { - numberLabel.layer.borderColor = nil - numberLabel.layer.borderWidth = 0 - numberLabel.layer.cornerRadius = 0 + return isEnabled } func disableLabel(with surface: Surface) { - numberLabel.isEnabled = false + isEnabled = false numberLabel.textColor = disabledTextColorConfiguration.getColor(surface) layer.backgroundColor = disabledBackgroundColor.getColor(surface).cgColor } @@ -183,7 +191,7 @@ final class CalendarDateViewCell: UICollectionViewCell { for x in 0...activeDates.count-1 { if activeDates[x].monthInt == displayDate.monthInt && activeDates[x].yearInt == displayDate.yearInt { if let day:Int = Int(numberLabel.text), day == activeDates[x].dayInt { - numberLabel.isEnabled = true + isEnabled = true } } } @@ -194,7 +202,7 @@ final class CalendarDateViewCell: UICollectionViewCell { if activeDates.count > 0 && inactiveDates.count == 0 { showActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates) } else { - numberLabel.isEnabled = true + isEnabled = true } } @@ -204,7 +212,7 @@ final class CalendarDateViewCell: UICollectionViewCell { disableLabel(with: surface) showActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates) } else { - numberLabel.isEnabled = true + isEnabled = true } } @@ -213,7 +221,7 @@ final class CalendarDateViewCell: UICollectionViewCell { if let day = Int(numberLabel.text), day < minDate.dayInt { disableLabel(with: surface) } else { - numberLabel.isEnabled = false + isEnabled = false handleActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates) } } @@ -223,7 +231,7 @@ final class CalendarDateViewCell: UICollectionViewCell { if let day = Int(numberLabel.text), day > maxDate.dayInt { disableLabel(with: surface) } else { - numberLabel.isEnabled = false + isEnabled = false handleActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates) } } @@ -233,7 +241,7 @@ final class CalendarDateViewCell: UICollectionViewCell { if let day = Int(numberLabel.text), day < minDate.dayInt || day > maxDate.dayInt { disableLabel(with: surface) } else { - numberLabel.isEnabled = false + isEnabled = false handleActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates) } } diff --git a/VDS/Components/Calendar/CalendarFooterReusableView.swift b/VDS/Components/Calendar/CalendarFooterReusableView.swift index 263cd83e..020655ea 100644 --- a/VDS/Components/Calendar/CalendarFooterReusableView.swift +++ b/VDS/Components/Calendar/CalendarFooterReusableView.swift @@ -224,7 +224,7 @@ private class LegendCollectionViewCell: UICollectionViewCell { title.text = text title.textColor = textColorConfiguration.getColor(surface) - legendIndicator.backgroundColor = drawSemiCircle ? .clear : (clearFullcircle ? .clear : color) + legendIndicator.backgroundColor = drawSemiCircle ? .clear : (clearFullcircle ? .clear : indicatorColorConfiguration.getColor(surface)) legendIndicator.layer.borderColor = indicatorColorConfiguration.getColor(surface).cgColor self.layoutIfNeeded() @@ -239,7 +239,7 @@ private class LegendCollectionViewCell: UICollectionViewCell { path.addArc(withCenter: center, radius: center.x, startAngle: 2 * .pi, endAngle: .pi, clockwise: true) path.close() shapeLayer.path = path.cgPath - shapeLayer.fillColor = color.cgColor + shapeLayer.fillColor = indicatorColorConfiguration.getColor(surface).cgColor guard legendIndicator.layer.sublayers?.contains(shapeLayer) ?? true else { return } legendIndicator.layer.addSublayer(shapeLayer) diff --git a/VDS/Components/Calendar/CalendarHeaderReusableView.swift b/VDS/Components/Calendar/CalendarHeaderReusableView.swift index d3da2dca..218f5471 100644 --- a/VDS/Components/Calendar/CalendarHeaderReusableView.swift +++ b/VDS/Components/Calendar/CalendarHeaderReusableView.swift @@ -68,16 +68,16 @@ class CalendarHeaderReusableView: UICollectionReusableView { $0.kind = .ghost $0.iconName = .leftCaret $0.iconOffset = .init(x: -2, y: 0) - $0.icon.size = .small - $0.size = .small + $0.customContainerSize = 40 + $0.icon.customSize = 16 } internal var nextButton = ButtonIcon().with { $0.kind = .ghost $0.iconName = .rightCaret $0.iconOffset = .init(x: 2, y: 0) - $0.icon.size = .small - $0.size = .small + $0.customContainerSize = 40 + $0.icon.customSize = 16 } internal var headerTitle = Label().with { diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index dc3c936e..d600f5dd 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -69,6 +69,7 @@ open class TileContainerBase: Control where Padding case secondary case white case black + case token(UIColor.VDSColor) case custom(UIColor) private var reflectedValue: String { String(reflecting: self) } @@ -484,6 +485,8 @@ extension TileContainerBase { return whiteColorConfig.getColor(object.surface) case .black: return blackColorConfig.getColor(object.surface) + case .token(let vdsColor): + return vdsColor.uiColor case .custom(let color): return color } diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 326146fb..cd4712b2 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,6 +1,14 @@ 1.0.67 ---------------- +- CXTDT-568463 - Calendar - On long press, hover randomizes +- CXTDT-568412 - Calendar - Incorrect side nav icon size +- CXTDT-568422 - Calendar - DarkMode Legend icon fill using Light mode color - CXTDT-553663 - DropdownSelect - Accessibility - has popup +- CXTDT-565796 - DropdownSelect - Accessibility +- CXTDT-560458 - Dropdown/TextArea - Different voiceover +- CXTDT-565106 - InputField - CreditCard - Icons +- CXTDT-546821 - TextArea - Accessibility +- CXTDT-560823 - TextArea - Accessibility 1.0.66 ----------------