-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 💡 [JIRA:HCPSDKFIORIUIKIT-2880] ActionItems Refactor
- Loading branch information
1 parent
33d3788
commit 4d723f3
Showing
36 changed files
with
877 additions
and
103 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
50 changes: 50 additions & 0 deletions
50
Apps/Examples/Examples/FioriSwiftUICore/Views/_KeyValueItemExample.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,50 @@ | ||
import FioriSwiftUICore | ||
import SwiftUI | ||
|
||
struct _KeyValueItemExample: View { | ||
var body: some View { | ||
Text("_KeyValueItemExample") | ||
List { | ||
Text("Default Horizontal") | ||
_KeyValueItem { | ||
Text("Key 1") | ||
|
||
} value: { | ||
Text("Value 1") | ||
} | ||
|
||
Text("Vertical") | ||
_KeyValueItem(key: { | ||
Text("Vertical Axis") | ||
}, value: { | ||
Text("Value 2") | ||
}, axis: .vertical) | ||
|
||
Text("Custom Color and Font") | ||
_KeyValueItem { | ||
Text("Custom Color") | ||
.foregroundStyle(.red) | ||
.font(.fiori(forTextStyle: .title1)) | ||
} value: { | ||
Text("Value 3") | ||
.foregroundStyle(.brown) | ||
.font(.fiori(forTextStyle: .footnote)) | ||
} | ||
|
||
Text("Verticle Custom Color and Font") | ||
_KeyValueItem(key: { | ||
Text("Custom Color and Font Vertical Axis") | ||
.foregroundStyle(.red) | ||
.font(.fiori(forTextStyle: .title1)) | ||
}, value: { | ||
Text("Value 4") | ||
.foregroundStyle(.brown) | ||
.font(.fiori(forTextStyle: .footnote)) | ||
}, axis: .vertical) | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
_KeyValueItemExample() | ||
} |
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
23 changes: 23 additions & 0 deletions
23
Sources/FioriSwiftUICore/_FioriStyles/KeyStyle.fiori.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,23 @@ | ||
import FioriThemeManager | ||
import Foundation | ||
import SwiftUI | ||
|
||
// Base Layout style | ||
public struct KeyBaseStyle: KeyStyle { | ||
@ViewBuilder | ||
public func makeBody(_ configuration: KeyConfiguration) -> some View { | ||
// Add default layout here | ||
configuration.key | ||
} | ||
} | ||
|
||
// Default fiori styles | ||
public struct KeyFioriStyle: KeyStyle { | ||
@ViewBuilder | ||
public func makeBody(_ configuration: KeyConfiguration) -> some View { | ||
Key(configuration) | ||
// Add default style here | ||
// .foregroundStyle(Color.preferredColor(<#fiori color#>)) | ||
// .font(.fiori(forTextStyle: <#fiori font#>)) | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
Sources/FioriSwiftUICore/_FioriStyles/KeyValueItemStyle.fiori.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,76 @@ | ||
import FioriThemeManager | ||
import Foundation | ||
import SwiftUI | ||
|
||
// Base Layout style | ||
public struct KeyValueItemBaseStyle: KeyValueItemStyle { | ||
public func makeBody(_ configuration: KeyValueItemConfiguration) -> some View { | ||
CompactVStack(alignment: .leading) { | ||
switch configuration.axis { | ||
case .horizontal: | ||
HStack(spacing: 0) { | ||
configuration.key | ||
if configuration.isRequired { | ||
configuration.mandatoryFieldIndicator | ||
} | ||
Spacer() | ||
configuration.value | ||
} | ||
.frame(maxWidth: .infinity) | ||
case .vertical: | ||
HStack(spacing: 0) { | ||
configuration.key | ||
if configuration.isRequired { | ||
configuration.mandatoryFieldIndicator | ||
} | ||
} | ||
configuration.value | ||
} | ||
}.accessibilityElement(children: .combine) | ||
} | ||
} | ||
|
||
// Default fiori styles | ||
extension KeyValueItemFioriStyle { | ||
struct ContentFioriStyle: KeyValueItemStyle { | ||
func makeBody(_ configuration: KeyValueItemConfiguration) -> some View { | ||
KeyValueItem(configuration) | ||
.disabled(configuration.controlState == .disabled || configuration.controlState == .readOnly) | ||
} | ||
} | ||
|
||
public struct KeyFioriStyle: KeyStyle { | ||
let keyValueItemConfiguration: KeyValueItemConfiguration | ||
|
||
public func makeBody(_ configuration: KeyConfiguration) -> some View { | ||
Key(configuration) | ||
.foregroundStyle(Color.preferredColor(self.keyValueItemConfiguration.controlState == .disabled ? .separator : .primaryLabel)) | ||
} | ||
} | ||
|
||
struct ValueFioriStyle: ValueStyle { | ||
let keyValueItemConfiguration: KeyValueItemConfiguration | ||
|
||
func makeBody(_ configuration: ValueConfiguration) -> some View { | ||
Value(configuration) | ||
.foregroundStyle(Color.preferredColor(self.keyValueItemConfiguration.controlState == .disabled ? .separator : .primaryLabel)) | ||
} | ||
} | ||
|
||
struct MandatoryFieldIndicatorFioriStyle: MandatoryFieldIndicatorStyle { | ||
let keyValueItemConfiguration: KeyValueItemConfiguration | ||
func makeBody(_ configuration: MandatoryFieldIndicatorConfiguration) -> some View { | ||
MandatoryFieldIndicator(configuration) | ||
.font(.fiori(forTextStyle: .subheadline, weight: .semibold)) | ||
.foregroundStyle(Color.preferredColor(self.keyValueItemConfiguration.controlState == .disabled ? .separator : .primaryLabel)) | ||
} | ||
} | ||
|
||
struct FormViewFioriStyle: FormViewStyle { | ||
let keyValueItemConfiguration: KeyValueItemConfiguration | ||
|
||
func makeBody(_ configuration: FormViewConfiguration) -> some View { | ||
FormView(configuration) | ||
} | ||
} | ||
} |
Oops, something went wrong.