Skip to content

Commit

Permalink
feat: 🎸 [JIRA:HCPSDKFIORIUIKIT-2458]Linear Progress Indicator and Tex…
Browse files Browse the repository at this point in the history
…tInputInfoView (#639)

* feat: 🎸 [JIRA:HCPSDKFIORIUIKIT-2458]Linear Progress Indicator

feat: [JIRA:HCPSDKFIORIUIKIT-2458]Linear Progress Indicator and
TextInputInfoView

✅ Closes: HCPSDKFIORIUIKIT-2458

* feat: 🎸 [JIRA:HCPSDKFIORIUIKIT-2458]Linear Progress Indicator

[JIRA:HCPSDKFIORIUIKIT-2458]Linear Progress Indicator and
TextInputInfoView

✅ Closes: HCPSDKFIORIUIKIT-2458

* feat: 🎸 [JIRA:HCPSDKFIORIUIKIT-2458]Linear Progress Indicator

[JIRA:HCPSDKFIORIUIKIT-2458]Linear Progress Indicator and
TextInputInfoView

✅ Closes: HCPSDKFIORIUIKIT-2458

---------

Co-authored-by: I824136 <xiaoqing.he@sap.com>
  • Loading branch information
xiaoqinggrace and xiaoqinggracehe committed Feb 20, 2024
1 parent 96b6220 commit a6c77ea
Show file tree
Hide file tree
Showing 24 changed files with 1,390 additions and 15 deletions.
16 changes: 16 additions & 0 deletions Apps/Examples/Examples.xcodeproj/project.pbxproj
Expand Up @@ -64,12 +64,14 @@
993A122E26A726AC0018028B /* PrivacyText.html in Resources */ = {isa = PBXBuildFile; fileRef = 993A122C26A726AC0018028B /* PrivacyText.html */; };
993A122F26A726AC0018028B /* PrivacyText.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 993A122D26A726AC0018028B /* PrivacyText.rtf */; };
993B55BE29DF7EC70002B065 /* IconLibraryExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 993B55BD29DF7EC70002B065 /* IconLibraryExample.swift */; };
99658F882B7C359D0026A743 /* LinearProgressIndicatorExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99658F872B7C359D0026A743 /* LinearProgressIndicatorExample.swift */; };
99942D572616980A001912C5 /* OnboardingExamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99942D562616980A001912C5 /* OnboardingExamples.swift */; };
99942D59261698FC001912C5 /* InfoViewSample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99942D58261698FC001912C5 /* InfoViewSample.swift */; };
9996CCFF262EB4E8001B99AE /* EULAText.html in Resources */ = {isa = PBXBuildFile; fileRef = 9996CCFD262EB4E7001B99AE /* EULAText.html */; };
9996CD00262EB4E8001B99AE /* EULAViewSample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9996CCFE262EB4E7001B99AE /* EULAViewSample.swift */; };
9996CD03262FFEBE001B99AE /* EULA2.html in Resources */ = {isa = PBXBuildFile; fileRef = 9996CD02262FFEBD001B99AE /* EULA2.html */; };
99B6EF8C2672224D00515E8E /* UserConsentSample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99B6EF8B2672224C00515E8E /* UserConsentSample.swift */; };
99F3D88D2B82119900802603 /* TextInputInfoViewExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99F3D88C2B82119900802603 /* TextInputInfoViewExample.swift */; };
AB988B102631270300483D87 /* DataTableExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB988B0F2631270300483D87 /* DataTableExample.swift */; };
B100639329C0624D00AF0CA2 /* StepProgressIndicatorExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B100639229C0624D00AF0CA2 /* StepProgressIndicatorExample.swift */; };
B13408922B01FA0700600331 /* NavigationBarExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B13408912B01FA0700600331 /* NavigationBarExample.swift */; };
Expand Down Expand Up @@ -223,12 +225,14 @@
993A122C26A726AC0018028B /* PrivacyText.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = PrivacyText.html; sourceTree = "<group>"; };
993A122D26A726AC0018028B /* PrivacyText.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = PrivacyText.rtf; sourceTree = "<group>"; };
993B55BD29DF7EC70002B065 /* IconLibraryExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconLibraryExample.swift; sourceTree = "<group>"; };
99658F872B7C359D0026A743 /* LinearProgressIndicatorExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinearProgressIndicatorExample.swift; sourceTree = "<group>"; };
99942D562616980A001912C5 /* OnboardingExamples.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingExamples.swift; sourceTree = "<group>"; };
99942D58261698FC001912C5 /* InfoViewSample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InfoViewSample.swift; sourceTree = "<group>"; };
9996CCFD262EB4E7001B99AE /* EULAText.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = EULAText.html; sourceTree = "<group>"; };
9996CCFE262EB4E7001B99AE /* EULAViewSample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EULAViewSample.swift; sourceTree = "<group>"; };
9996CD02262FFEBD001B99AE /* EULA2.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = EULA2.html; sourceTree = "<group>"; };
99B6EF8B2672224C00515E8E /* UserConsentSample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserConsentSample.swift; sourceTree = "<group>"; };
99F3D88C2B82119900802603 /* TextInputInfoViewExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextInputInfoViewExample.swift; sourceTree = "<group>"; };
AB988B0F2631270300483D87 /* DataTableExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataTableExample.swift; sourceTree = "<group>"; };
B100639229C0624D00AF0CA2 /* StepProgressIndicatorExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepProgressIndicatorExample.swift; sourceTree = "<group>"; };
B13408912B01FA0700600331 /* NavigationBarExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarExample.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -314,6 +318,7 @@
1F3C92F025DF12C100A99A07 /* ListPicker.swift */,
B141D6BA29261F9E008A8BD6 /* SearchableListViewExample.swift */,
99193C842B719B8800F33BAF /* InformationViewExample.swift */,
99F3D88C2B82119900802603 /* TextInputInfoViewExample.swift */,
);
path = FormCells;
sourceTree = "<group>";
Expand Down Expand Up @@ -462,6 +467,7 @@
8A5579C824C1293C0098003A /* FioriSwiftUICore */ = {
isa = PBXGroup;
children = (
99658F862B7C35630026A743 /* Indicator */,
C18868CF2B3252F400F865F7 /* SearchBar */,
B1BA1F902B19A8B500E6C052 /* TabViewExample */,
B1CC61C52AFA0856002078C1 /* NavigationBar */,
Expand Down Expand Up @@ -533,6 +539,14 @@
path = SignatureView;
sourceTree = "<group>";
};
99658F862B7C35630026A743 /* Indicator */ = {
isa = PBXGroup;
children = (
99658F872B7C359D0026A743 /* LinearProgressIndicatorExample.swift */,
);
path = Indicator;
sourceTree = "<group>";
};
AB988B11263128C400483D87 /* DataTable */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -820,6 +834,7 @@
B80DA9C2260D04FB00C0B2E9 /* SingleActionLongFollowButton.swift in Sources */,
8A6D64BA25AE714100D2D76C /* ExampleHighlightingStyle.swift in Sources */,
99942D572616980A001912C5 /* OnboardingExamples.swift in Sources */,
99658F882B7C359D0026A743 /* LinearProgressIndicatorExample.swift in Sources */,
8A557A2424C12F380098003A /* ChartDetailView.swift in Sources */,
8A5579D024C1293C0098003A /* SettingsLine.swift in Sources */,
1FC30412270540FB004BEE00 /* 72-Fonts.swift in Sources */,
Expand All @@ -843,6 +858,7 @@
8A5579CF24C1293C0098003A /* SettingsAxis.swift in Sources */,
B80DA9BC260BED9400C0B2E9 /* SingleActionCollectionView.swift in Sources */,
8A5579D924C1293C0098003A /* SettingsSelection.swift in Sources */,
99F3D88D2B82119900802603 /* TextInputInfoViewExample.swift in Sources */,
B80DA9C62612A54E00C0B2E9 /* ActivationScreenSample.swift in Sources */,
B8D437732609479E0024EE7D /* SingleActionFollowButton.swift in Sources */,
C18868D32B32580800F865F7 /* ColorEntity.swift in Sources */,
Expand Down
26 changes: 19 additions & 7 deletions Apps/Examples/Examples/FioriSwiftUICore/CoreContentView.swift
Expand Up @@ -132,14 +132,26 @@ struct CoreContentView: View {
NavigationLink(destination: SearchDemos()) {
Text("Search Demos")
}

NavigationLink(
destination: InformationViewExample(),
label: {
Text("InformationViewExample")
}
)
}

NavigationLink(
destination: InformationViewExample(),
label: {
Text("InformationViewExample")
}
)
NavigationLink(
destination: TextInputInfoViewExample(),
label: {
Text("TextInputInfoViewExample")
}
)
NavigationLink(
destination: LinearProgressIndicatorExample(),
label: {
Text("Linear Progress Indicator")
}
)
}.navigationBarTitle("FioriSwiftUICore")
}
}
Expand Down
@@ -0,0 +1,49 @@
import FioriSwiftUICore
import SwiftUI

struct TextInputInfoViewExample: View {
var body: some View {
VStack(alignment: .leading) {
Text("Default Fiori style, no icon")
.textInputInfoView(description: AttributedString("test message"), counter: AttributedString("10/100"))

Text("Error style")
.textInputInfoView(description: AttributedString("test message, long messag long message long message long message long message long message long message long message"), counter: AttributedString("12/10"))
.textInputInfoViewStyle(.error)

Text("Warning style")
.textInputInfoView(description: AttributedString("test message, long messag long message long message long message long message long message long message long message"), counter: AttributedString("10/10"))
.textInputInfoViewStyle(.warning)

Text("Informational style")
.textInputInfoView(description: AttributedString("test message"), counter: AttributedString("0/10"))
.textInputInfoViewStyle(.informational)

Text("Success style")
.textInputInfoView(description: AttributedString("test message"), counter: AttributedString("10/100"))
.textInputInfoViewStyle(.success)

Text("Customized icon")
.textInputInfoView(icon: Image(systemName: "heart"), description: AttributedString("test message, long messag long message long message long message long message long message long message long message"), counter: AttributedString("10/100"))

Text("Customized font and color")
.textInputInfoView(icon: Image(systemName: "diamond"), description: AttributedString("test message"), counter: AttributedString("10/100"))
.iconStyle(content: { iconConfiguration in
iconConfiguration.icon
.foregroundStyle(Color.preferredColor(.tintColor))
})
.descriptionStyle(content: { descriptionConfiguration in
descriptionConfiguration.description
.foregroundStyle(Color.preferredColor(.criticalLabel))
.font(.fiori(forTextStyle: .title2))
})
.counterStyle(content: { counterConfiguration in
counterConfiguration.counter
.foregroundStyle(Color.preferredColor(.criticalLabel))
.font(.fiori(forTextStyle: .title2))
})

Spacer()
}
}
}
@@ -0,0 +1,75 @@
import FioriSwiftUICore
import SwiftUI

struct LinearProgressIndicatorExample: View {
@State var progress1: Double = 0.3
@State var progress2: Double = 0.1
@State var progress3: Double = 0.0
@State var progress4: Double = 1.0

var body: some View {
VStack {
Text("Determinate without Label")
LinearProgressIndicator(indicatorProgress: $progress1)
.linearProgressIndicatorStyle(.determinate)
.padding(.bottom, 20)

Text("Determinate with Label")
LinearProgressIndicatorView(indicatorProgress: $progress2, icon: Image(systemName: "heart"), description: AttributedString("Loading..."))
.linearProgressIndicatorStyle(.determinate)
.padding(.bottom, 20)

FioriButton(
action: { _ in
if progress2 > 0.9 {
progress2 = 0
} else {
progress2 += 0.1
}
},
label: { _ in
Text("Increment Progress")
}
)
.disabled(false)
.fioriButtonStyle(FioriPrimaryButtonStyle().eraseToAnyFioriButtonStyle())
.padding(.bottom, 20)

Text("Error style")
LinearProgressIndicatorView(indicatorProgress: $progress4, description: AttributedString("Loading..."))
.linearProgressIndicatorViewStyle(.error)
.padding(.bottom, 20)

Text("Success style")
LinearProgressIndicatorView(indicatorProgress: $progress4, description: AttributedString("Loading complete successfully. Please see the user registration view for more detail information."))
.linearProgressIndicatorViewStyle(.success)
.padding(.bottom, 20)

Text("Indeterminate without Label")
LinearProgressIndicator(indicatorProgress: $progress3)
.linearProgressIndicatorStyle(.indeterminate)
.padding(.bottom, 20)

Text("Indeterminate with Label")
LinearProgressIndicatorView(indicatorProgress: $progress3, icon: Image(systemName: "heart"), description: AttributedString("Loading..."))
.linearProgressIndicatorStyle(.indeterminate)
.padding(.bottom, 20)

Text("Indeterminate customized")
LinearProgressIndicatorView(indicatorProgress: $progress3, icon: Image(systemName: "clock"), description: AttributedString("Downloading..."))
.iconStyle { iconConfiguration in
iconConfiguration.icon
.font(.fiori(forTextStyle: .headline)).bold()
.foregroundColor(.green)
}
.descriptionStyle { descriptionConfiguration in
descriptionConfiguration.description
.font(.fiori(forTextStyle: .headline))
.foregroundColor(.green)
}
.linearProgressIndicatorStyle(.indeterminate)
.padding(.bottom, 20)
}
.padding()
}
}
Expand Up @@ -77,6 +77,12 @@ protocol _IconComponent {
var icon: Image? { get }
}

// sourcery: BaseComponent
protocol _LinearProgressIndicatorComponent {
// sourcery: @Binding
var indicatorProgress: Double { get }
}

// TODO: rename to _ActionComponent after resolving the conflict.
// sourcery: BaseComponent
protocol _ActionComponent {
Expand Down
Expand Up @@ -31,3 +31,9 @@ protocol _InformationViewComponent: _IconComponent, _DescriptionComponent {
@ViewBuilder
var content: () -> any View { get }
}

// sourcery: CompositeComponent
protocol _TextInputInfoViewComponent: _InformationViewComponent, _CounterComponent {}

// sourcery: CompositeComponent
protocol _LinearProgressIndicatorViewComponent: _LinearProgressIndicatorComponent, _IconComponent, _DescriptionComponent {}

0 comments on commit a6c77ea

Please sign in to comment.