-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tokens section (border, elevation, opacity, typography) in …
…demo app (#120) (#137) Co-authored-by: Ludovic PINEL <[email protected]> Co-authored-by: Pierre-Yves Lapersonne <[email protected]> Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
- Loading branch information
Showing
82 changed files
with
1,792 additions
and
488 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,8 +66,14 @@ Any use or displaying shall constitute an infringement under intellectual proper | |
./Showcase/Showcase/Resources/Assets.xcassets/AppIconQualif.appiconset/[email protected] | ||
./Showcase/Showcase/Resources/Assets.xcassets/AppIconQualif.appiconset/[email protected] | ||
|
||
./Showcase/Showcase/Resources/Assets.xcassets/ic_guideline_dna.imageset/ic_guideline_dna.svg | ||
./Showcase/Showcase/Resources/Assets.xcassets/ic_token.imageset/ic_token.svg | ||
./Showcase/Showcase/Resources/Assets.xcassets/ic_component_atom.imageset/ic_component_atom.svg | ||
./Showcase/Showcase/Resources/Assets.xcassets/ic_info.imageset/ic_info.svg | ||
./Showcase/Showcase/Resources/Assets.xcassets/Illustrations/il_empty_screen.imageset/il_empty_screen.svg | ||
./Showcase/Showcase/Resources/Assets.xcassets/Tokens/ic_border.imageset/ic_border.svg | ||
./Showcase/Showcase/Resources/Assets.xcassets/Tokens/ic_filter_effects.imageset/ic_filter_effects.svg | ||
./Showcase/Showcase/Resources/Assets.xcassets/Tokens/ic_layers.imageset/ic_layers.svg | ||
./Showcase/Showcase/Resources/Assets.xcassets/Tokens/ic_typography.imageset/ic_typography.svg | ||
./Showcase/Showcase/Resources/Assets.xcassets/Tokens/ic_union.imageset/ic_union.svg | ||
|
||
End of the parts list under Orange SA Copyright |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 0 additions & 80 deletions
80
OUDS/Core/Components/Sources/Forms/TextInput/OUDSFormsTextInput.swift
This file was deleted.
Oops, something went wrong.
86 changes: 86 additions & 0 deletions
86
OUDS/Core/Components/Sources/ViewModifiers/AccessibleModifiers/AccessibleModifiers.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// | ||
// Software Name: OUDS iOS | ||
// SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// This software is distributed under the MIT license, | ||
// the text of which is available at https://opensource.org/license/MIT/ | ||
// or see the "LICENSE" file for more details. | ||
// | ||
// Authors: See CONTRIBUTORS.txt | ||
// Software description: A SwiftUI components library with code examples for Orange Unified Design System | ||
// | ||
|
||
import SwiftUI | ||
|
||
// MARK: - Accessible Navigation Title Modifier | ||
|
||
/// `ViewModifier` which defines a navigation title for the calling `View` and also uses `UIAccessibility` to notify for screen changed. | ||
struct AccessibleNavigationTitleModifier: ViewModifier { | ||
|
||
/// The title used as a `LocalizedStringKey` to add as navigation title | ||
let title: String | ||
|
||
/// Elapsed time to wait before sending an accessibility notification of a screen change with the `title` in argument | ||
let deadline: DispatchTime | ||
|
||
func body(content: Content) -> some View { | ||
content | ||
.navigationTitle(LocalizedStringKey(title)) | ||
.onAppear { | ||
DispatchQueue.main.asyncAfter(deadline: deadline) { | ||
UIAccessibility.post(notification: .screenChanged, argument: title) | ||
} | ||
} | ||
} | ||
} | ||
|
||
// MARK: - Request Accessible Focus Modifier | ||
|
||
/// `ViewModifier` to apply on a a `View` so as to request the focus after a given time. | ||
struct RequestAccessibleFocusModifier: ViewModifier { | ||
|
||
/// Flag to listen saying wether or not the `View` got the focus | ||
@AccessibilityFocusState var requestFocus: Bool | ||
|
||
/// Elapsed time to wait before requesting the focus | ||
let deadline: DispatchTime | ||
|
||
func body(content: Content) -> some View { | ||
content.onAppear { | ||
DispatchQueue.main.asyncAfter(deadline: deadline) { | ||
requestFocus = true | ||
} | ||
} | ||
} | ||
} | ||
|
||
// MARK: - Accessibility Focusable | ||
|
||
public enum AccessibilityFocusable: Hashable { | ||
case none | ||
case some(id: String) | ||
} | ||
|
||
// MARK: - Restricted Request Accessible Focus Modifier | ||
|
||
/// `ViewModifier` to apply on a `View` to request the focus on that `View` after a given time | ||
struct RestrictedRequestAccessibleFocusModifier: ViewModifier { | ||
|
||
/// Flag to listen saying wether or not the `View` got the focus | ||
@AccessibilityFocusState var requestFocus: AccessibilityFocusable? | ||
|
||
/// The target to give the focus after the deadLine` delay | ||
let target: AccessibilityFocusable | ||
|
||
/// Elapsed time to wait before requesting the focus | ||
let deadline: DispatchTime | ||
|
||
func body(content: Content) -> some View { | ||
content.onAppear { | ||
DispatchQueue.main.asyncAfter(deadline: deadline) { | ||
requestFocus = target | ||
} | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
OUDS/Core/Components/Sources/ViewModifiers/AccessibleModifiers/View+extensions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// Software Name: OUDS iOS | ||
// SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// This software is distributed under the MIT license, | ||
// the text of which is available at https://opensource.org/license/MIT/ | ||
// or see the "LICENSE" file for more details. | ||
// | ||
// Authors: See CONTRIBUTORS.txt | ||
// Software description: A SwiftUI components library with code examples for Orange Unified Design System | ||
// | ||
|
||
import SwiftUI | ||
|
||
// MARK: - Accessibility Delay | ||
|
||
/// Contains some delays to apply to view modifiers' deadlines for vocalizations or accessibility notifications | ||
private enum AccessibilityDelay: Double { | ||
// Must be lower than accesibleFocusRequestDelay to start before | ||
case accessibleTitleNotificationDelay = 0.0 | ||
// Must be greater than accessibleTitleNotificationDelay to start after | ||
case accessibleFocusRequestDelay = 1.0 | ||
} | ||
|
||
// MARK: - View extension | ||
|
||
extension View { | ||
|
||
/// Adds a modifier to the current `View` so as to define a navigation title using the current `title` | ||
/// and also send a notification for accessibility layers for a change of screen when appeared. | ||
/// - Parameter title: The navigation title | ||
/// - Returns View: The view with a new modifier | ||
public func oudsNavigationTitle(_ title: String) -> some View { | ||
self.modifier(AccessibleNavigationTitleModifier(title: title, | ||
deadline: .now() + AccessibilityDelay.accessibleTitleNotificationDelay.rawValue)) | ||
} | ||
|
||
/// Adds a modifier to the current `View` so as to defer a focus request after the view is displayed | ||
/// - Parameter requestFocus: The boolean binding (e.g. the `AccessibilityFocusState`) | ||
/// - Returns View: The view with a new modifier | ||
public func oudsRequestAccessibleFocus(_ requestFocus: AccessibilityFocusState<Bool>) -> some View { | ||
self.modifier(RequestAccessibleFocusModifier(requestFocus: requestFocus, | ||
deadline: .now() + AccessibilityDelay.accessibleFocusRequestDelay.rawValue)) | ||
} | ||
|
||
/// Adds a modifier to the current `View` so as to defer a focus request after the view is displayed for the given element | ||
/// - Parameters: | ||
/// - requestFocus: The boolean binding (e.g. the `AccessibilityFocusState`) | ||
/// - target: The item which will get the focus | ||
/// - Returns View: The view with a new modifier | ||
public func oudsRequestAccessibleFocus(_ requestFocus: AccessibilityFocusState<AccessibilityFocusable?>, for target: AccessibilityFocusable) -> some View { | ||
self.modifier(RestrictedRequestAccessibleFocusModifier(requestFocus: requestFocus, | ||
target: target, | ||
deadline: .now() + AccessibilityDelay.accessibleFocusRequestDelay.rawValue)) | ||
} | ||
} |
Oops, something went wrong.