diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index d63b3cad..592871f9 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -1389,7 +1389,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 55; + CURRENT_PROJECT_VERSION = 57; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1426,7 +1426,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 55; + CURRENT_PROJECT_VERSION = 57; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; diff --git a/VDS/Components/BadgeIndicator/BadgeIndicator.swift b/VDS/Components/BadgeIndicator/BadgeIndicator.swift index 45432458..6547580c 100644 --- a/VDS/Components/BadgeIndicator/BadgeIndicator.swift +++ b/VDS/Components/BadgeIndicator/BadgeIndicator.swift @@ -84,14 +84,14 @@ open class BadgeIndicator: View { /// Dynamic TextStyle for the size. public var textStyle: TextStyle { - let style = TextStyle.bodySmall + var font: Font = .edsRegular var pointSize: CGFloat = VDSTypography.fontSizeBody12 var letterSpacing: CGFloat = 0.0 + switch self { case .xxlarge: pointSize = VDSTypography.fontSizeTitle24 - letterSpacing = VDSTypography.letterSpacingWide - + case .xlarge: pointSize = VDSTypography.fontSizeTitle20 @@ -102,12 +102,14 @@ open class BadgeIndicator: View { case .medium: pointSize = VDSTypography.fontSizeBody14 letterSpacing = VDSTypography.letterSpacingWide - case .small: - pointSize = VDSTypography.fontSizeBody12 + case .small: + font = .etxRegular + pointSize = VDSTypography.fontSizeBody12 } + return TextStyle(rawValue: "\(self.rawValue)BadgeIndicator", - fontFace: style.fontFace, + fontFace: font, pointSize: pointSize, lineHeight: 0, letterSpacing: letterSpacing) @@ -115,16 +117,16 @@ open class BadgeIndicator: View { //EdgeInsets for the label. public var edgeInset: UIEdgeInsets { - var horizontalPadding: CGFloat = VDSLayout.Spacing.space1X.value - let verticalPadding: CGFloat = 0 + var horizontalPadding: CGFloat = 0.0 + let verticalPadding: CGFloat = 0.0 switch self { case .xxlarge: horizontalPadding = VDSLayout.Spacing.space2X.value - case .xlarge, .large,.medium: + case .xlarge, .large, .medium: horizontalPadding = 6.0 case .small: - break + horizontalPadding = VDSLayout.Spacing.space1X.value } return .axis(horizontal: horizontalPadding, vertical: verticalPadding) } @@ -268,10 +270,10 @@ open class BadgeIndicator: View { /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. open override func setup() { super.setup() - + isAccessibilityElement = true + addSubview(badgeView) badgeView.addSubview(label) - accessibilityElements = [label] heightConstraint = badgeView.heightGreaterThanEqualTo(constant: badgeSize) widthConstraint = badgeView.widthGreaterThanEqualTo(constant: badgeSize) @@ -347,6 +349,15 @@ open class BadgeIndicator: View { layoutIfNeeded() } + open override func updateAccessibility() { + super.updateAccessibility() + if kind == .numbered { + accessibilityLabel = label.text + } else { + accessibilityLabel = "Simple" + } + } + open override func layoutSubviews() { super.layoutSubviews() @@ -356,10 +367,9 @@ open class BadgeIndicator: View { //border if hideBorder { - layer.borderWidth = 0 + removeBezierPathBorder() } else { - layer.borderWidth = borderWidth - layer.borderColor = borderColorConfiguration.getColor(surface).cgColor + bezierPathBorder(borderColorConfiguration.getColor(surface), width: borderWidth) } //dot @@ -444,5 +454,4 @@ open class BadgeIndicator: View { let maxNumber = Int(pow(10.0, Double(maxDigits))) - 1 return min(number, maxNumber) } - } diff --git a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift index 65968214..738881e3 100644 --- a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift +++ b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift @@ -108,7 +108,10 @@ open class ButtonIcon: Control, Changeable, FormFieldable { open var badgeIndicatorModel: BadgeIndicatorModel? { didSet { setNeedsUpdate() } } /// Icon object used to render out the Icon for this ButtonIcon. - open var icon = Icon().with { $0.isUserInteractionEnabled = false } + open var icon = Icon().with { + $0.isUserInteractionEnabled = false + $0.accessibilityTraits = .button + } /// Determines the type of button based on the contrast. open var kind: Kind = .ghost { didSet { setNeedsUpdate() } } @@ -342,9 +345,8 @@ open class ButtonIcon: Control, Changeable, FormFieldable { /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. open override func setup() { super.setup() - isAccessibilityElement = true - accessibilityTraits = .button - accessibilityElements = [badgeIndicator] + isAccessibilityElement = false + accessibilityElements = [icon, badgeIndicator] //create a layoutGuide for the icon to key off of let iconLayoutGuide = UILayoutGuide() diff --git a/VDS/Components/Notification/Notification.swift b/VDS/Components/Notification/Notification.swift index cc011249..7dd36b4c 100644 --- a/VDS/Components/Notification/Notification.swift +++ b/VDS/Components/Notification/Notification.swift @@ -247,6 +247,11 @@ open class Notification: View { subTitleLabel.textColorConfiguration = textColorConfiguration.eraseToAnyColorable() //TODO: Need to add setup animation for displaying the Notification view for iOS. + isAccessibilityElement = false + accessibilityElements = [closeButton, typeIcon, titleLabel, subTitleLabel, buttonGroup] + closeButton.accessibilityTraits = [.button] + closeButton.accessibilityLabel = "Close Notification" + } /// Resets to default settings. @@ -298,17 +303,7 @@ open class Notification: View { super.layoutSubviews() layer.cornerRadius = UIScreen.main.bounds.width == bounds.width ? 0 : 4.0 } - - ///Updating the accessiblity values i.e elements, label, value other items for the component. - open override func updateAccessibility() { - super.updateAccessibility() - accessibilityElements = [closeButton, typeIcon, titleLabel, subTitleLabel, buttonGroup] - typeIcon.accessibilityLabel = style.rawValue - typeIcon.imageView.image?.isAccessibilityElement = false - closeButton.accessibilityTraits = [.button] - closeButton.accessibilityLabel = "Close Notification" - } - + //-------------------------------------------------- // MARK: - Private Methods //-------------------------------------------------- diff --git a/VDS/Extensions/UIView+CALayer.swift b/VDS/Extensions/UIView+CALayer.swift index acc5ddab..2158b18e 100644 --- a/VDS/Extensions/UIView+CALayer.swift +++ b/VDS/Extensions/UIView+CALayer.swift @@ -148,3 +148,44 @@ extension UIView { } } } + +extension UIView { + + fileprivate var bezierPathIdentifier: String { return "bezierPathBorderLayer" } + + fileprivate var bezierPathBorder: CAShapeLayer? { + return (self.layer.sublayers?.filter({ (layer) -> Bool in + return layer.name == self.bezierPathIdentifier && (layer as? CAShapeLayer) != nil + }) as? [CAShapeLayer])?.first + } + + public func bezierPathBorder(_ color: UIColor = .white, width: CGFloat = 1) { + + var border = self.bezierPathBorder + let path = UIBezierPath(roundedRect: self.bounds, cornerRadius:self.layer.cornerRadius) + let mask = CAShapeLayer() + mask.path = path.cgPath + self.layer.mask = mask + + if (border == nil) { + border = CAShapeLayer() + border!.name = self.bezierPathIdentifier + self.layer.addSublayer(border!) + } + + border!.frame = self.bounds + let pathUsingCorrectInsetIfAny = + UIBezierPath(roundedRect: border!.bounds, cornerRadius:self.layer.cornerRadius) + + border!.path = pathUsingCorrectInsetIfAny.cgPath + border!.fillColor = UIColor.clear.cgColor + border!.strokeColor = color.cgColor + border!.lineWidth = width * 2 + } + + public func removeBezierPathBorder() { + self.layer.mask = nil + self.bezierPathBorder?.removeFromSuperlayer() + } + +} diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index e1cd12fd..94d304a7 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,3 +1,16 @@ +1.0.57 +---------------- +- CXTDT-540077 - BadgeIndicator Font +- CXTDT-540084 - BadgeIndicator Border + +1.0.56 +---------------- +- ONEAPP-7190 - Breadcrumbs - Finished Development +- ONEAPP-6830 - CarouselScrollbar - Finished Development +- ONEAPP-6978 - Pagination - Finished Development +- ONEAPP-6984 - Tilelet - Finished Development +- ONEAPP-6682 - TextArea - Finished Development + 1.0.55 ---------------- - ONEAPP-6305 - BadgeIndicator - Finished Development