From aa10c2d3c11fa14ce95ace76dbb911b88f737374 Mon Sep 17 00:00:00 2001 From: dyongxu <61523257+dyongxu@users.noreply.github.com> Date: Thu, 19 Sep 2024 07:36:19 +0800 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e2bb49c5..9d40dcd4b 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ We plan to progressively bring more Fiori UI components into this module in the | ProfileHeader | :white_check_mark: | | TimelineItem | :white_check_mark: | | SegmentedControlPicker | :white_check_mark: | -| TimelinePreviewItem | :x: | +| TimelinePreviewItem | :white_check_mark: | | ChartFloorplan | :x: | | CollectionItem | :x: | | BarcodeScanner | :x: | From 29f33b825bda13783fca0162175345e431f9df88 Mon Sep 17 00:00:00 2001 From: janhuachu <48767307+janhuachu@users.noreply.github.com> Date: Thu, 19 Sep 2024 14:01:10 -0700 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=F0=9F=90=9B=20[JIRA:FIORIDESIGN-122?= =?UTF-8?q?89]=20fix=20textinput=20review=20comments=20(#804)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormViews/NoteFormViewExample.swift | 4 ++-- .../FormViews/TitleFormViewExample.swift | 12 +++++++++++- .../KeyValueFormViewStyle.fiori.swift | 7 ++++++- .../_FioriStyles/NoteFormViewStyle.fiori.swift | 15 ++++++++------- .../PlaceholderTextEditorStyle.fiori.swift | 1 - .../PlaceholderTextFieldStyle.fiori.swift | 2 +- .../TextFieldFormViewStyle.fiori.swift | 9 ++++++++- .../TextInputInfoViewStyle.fiori.swift | 4 ++-- .../_FioriStyles/TitleFormViewStyle.fiori.swift | 6 +++--- 9 files changed, 41 insertions(+), 19 deletions(-) diff --git a/Apps/Examples/Examples/FioriSwiftUICore/FormViews/NoteFormViewExample.swift b/Apps/Examples/Examples/FioriSwiftUICore/FormViews/NoteFormViewExample.swift index 582e399d2..84582fb16 100755 --- a/Apps/Examples/Examples/FioriSwiftUICore/FormViews/NoteFormViewExample.swift +++ b/Apps/Examples/Examples/FioriSwiftUICore/FormViews/NoteFormViewExample.swift @@ -61,10 +61,10 @@ struct NoteFormViewExample: View { NoteFormView(text: self.$valueText3, placeholder: "Please enter something", errorMessage: self.getErrorMessage(), minTextEditorHeight: 50, maxTextEditorHeight: 100, maxTextLength: self.getMaxTextLength(), hintText: self.getHintText(), isCharCountEnabled: self.showsCharCount, allowsBeyondLimit: self.allowsBeyondLimit) Text("Disabled") - NoteFormView(text: self.$disabledText, placeholder: "Disabled", controlState: .disabled, minTextEditorHeight: 50, maxTextEditorHeight: 100) + NoteFormView(text: self.$disabledText, placeholder: "Disabled", controlState: .disabled, maxTextEditorHeight: 100) Text("Read-Only") - NoteFormView(text: self.$readOnlyText, placeholder: "Read-Only", controlState: .readOnly, minTextEditorHeight: 50, maxTextEditorHeight: 200, hidesReadOnlyHint: self.hidesReadonlyHint) + NoteFormView(text: self.$readOnlyText, placeholder: "Read-Only", controlState: .readOnly, maxTextEditorHeight: 200, hidesReadOnlyHint: self.hidesReadonlyHint) } #if !os(visionOS) .scrollDismissesKeyboard(.immediately) diff --git a/Apps/Examples/Examples/FioriSwiftUICore/FormViews/TitleFormViewExample.swift b/Apps/Examples/Examples/FioriSwiftUICore/FormViews/TitleFormViewExample.swift index 9924077d4..f77cd0fa0 100644 --- a/Apps/Examples/Examples/FioriSwiftUICore/FormViews/TitleFormViewExample.swift +++ b/Apps/Examples/Examples/FioriSwiftUICore/FormViews/TitleFormViewExample.swift @@ -46,20 +46,30 @@ struct TitleFormViewExample: View { Text("Default TitleForm") TitleFormView(text: self.$valueText1, placeholder: "TitleFormView", errorMessage: self.getErrorMessage(), maxTextLength: self.getMaxTextLength(), hintText: self.getHintText(), isCharCountEnabled: self.showsCharCount, allowsBeyondLimit: self.allowsBeyondLimit) - + .padding(.leading, -4) + .padding(.trailing, -4) + Text("Existing Text") .italic() TitleFormView(text: self.$valueText2, placeholder: "TitleFormView", errorMessage: self.getErrorMessage(), maxTextLength: self.getMaxTextLength(), hintText: self.getHintText(), isCharCountEnabled: self.showsCharCount, allowsBeyondLimit: self.allowsBeyondLimit) + .padding(.leading, -4) + .padding(.trailing, -4) Text("Empty Text") .italic() TitleFormView(text: self.$valueText3, placeholder: "Please enter something", errorMessage: self.getErrorMessage(), maxTextLength: self.getMaxTextLength(), hintText: self.getHintText(), isCharCountEnabled: self.showsCharCount, allowsBeyondLimit: self.allowsBeyondLimit) + .padding(.leading, -4) + .padding(.trailing, -4) Text("Disabled") TitleFormView(text: self.$disabledText, placeholder: "Disabled", controlState: .disabled) + .padding(.leading, -4) + .padding(.trailing, -4) Text("Read-Only") TitleFormView(text: self.$readOnlyText, placeholder: "Read-Only", controlState: .readOnly, hidesReadOnlyHint: self.hidesReadonlyHint) + .padding(.leading, -4) + .padding(.trailing, -4) } #if !os(visionOS) .scrollDismissesKeyboard(.immediately) diff --git a/Sources/FioriSwiftUICore/_FioriStyles/KeyValueFormViewStyle.fiori.swift b/Sources/FioriSwiftUICore/_FioriStyles/KeyValueFormViewStyle.fiori.swift index 5f3ea24d5..3ed787f1d 100755 --- a/Sources/FioriSwiftUICore/_FioriStyles/KeyValueFormViewStyle.fiori.swift +++ b/Sources/FioriSwiftUICore/_FioriStyles/KeyValueFormViewStyle.fiori.swift @@ -29,6 +29,11 @@ extension KeyValueFormViewFioriStyle { .foregroundStyle(self.getTitleColor(configuration)) .font(.fiori(forTextStyle: .subheadline, weight: .semibold)) } + .mandatoryFieldIndicatorStyle { indicatorConf in + MandatoryFieldIndicator(indicatorConf) + .foregroundStyle(self.getTitleColor(configuration)) + .font(.fiori(forTextStyle: .subheadline, weight: .semibold)) + } .focused(self.$isFocused) } @@ -90,7 +95,7 @@ extension KeyValueFormViewFioriStyle { func makeBody(_ configuration: MandatoryFieldIndicatorConfiguration) -> some View { MandatoryFieldIndicator(configuration) - .foregroundStyle(Color.preferredColor(self.keyValueFormViewConfiguration.controlState == .disabled ? .separator : .primaryLabel)) + .foregroundStyle(Color.preferredColor(self.keyValueFormViewConfiguration.controlState == .disabled ? .quaternaryLabel : .primaryLabel)) .font(.fiori(forTextStyle: .subheadline, weight: .semibold)) .padding(.bottom, -4) .padding(.top, 11) diff --git a/Sources/FioriSwiftUICore/_FioriStyles/NoteFormViewStyle.fiori.swift b/Sources/FioriSwiftUICore/_FioriStyles/NoteFormViewStyle.fiori.swift index 389664d22..f16b5d4ca 100755 --- a/Sources/FioriSwiftUICore/_FioriStyles/NoteFormViewStyle.fiori.swift +++ b/Sources/FioriSwiftUICore/_FioriStyles/NoteFormViewStyle.fiori.swift @@ -48,6 +48,7 @@ extension NoteFormViewFioriStyle { TextInputInfoView(config) .textInputInfoViewStyle(style) .typeErased + .padding(.top, -8) } .placeholderTextEditorStyle { config in PlaceholderTextEditor(config) @@ -62,14 +63,14 @@ extension NoteFormViewFioriStyle { .onChange(of: configuration.text) { s in self.checkCharCount(configuration, textString: s) } - .padding(.bottom, self.isInfoViewNeeded(configuration) ? 0 : 9) + .padding(.bottom, self.isInfoViewNeeded(configuration) ? 0 : 7) } .textViewStyle { config in TextView(config) .foregroundStyle(self.getTextColor(configuration)) .font(.fiori(forTextStyle: .body)) } - .padding(.top, 9) + .padding(.top, 7) } func getTextColor(_ configuration: NoteFormViewConfiguration) -> Color { @@ -101,15 +102,15 @@ extension NoteFormViewFioriStyle { } func getMinHeight(_ configuration: NoteFormViewConfiguration) -> CGFloat { - // Somehow, the minHeight is 14pt higher than the specified. Use this adjustment. - let minHeightAdjustMent = 14.0 + // TextEditor will add some other views that the minHeight is 16pt higher than the specified. Use this to adjust. + let minHeightAdjustment = 16.0 guard let minHeight = configuration.minTextEditorHeight else { - return 88 - minHeightAdjustMent + return 88 - minHeightAdjustment } guard minHeight > 44 else { - return 88 - minHeightAdjustMent + return 88 - minHeightAdjustment } - return minHeight - minHeightAdjustMent + return minHeight - minHeightAdjustment } func getMaxHeight(_ configuration: NoteFormViewConfiguration) -> CGFloat { diff --git a/Sources/FioriSwiftUICore/_FioriStyles/PlaceholderTextEditorStyle.fiori.swift b/Sources/FioriSwiftUICore/_FioriStyles/PlaceholderTextEditorStyle.fiori.swift index 98793bdd4..66e6bf46b 100755 --- a/Sources/FioriSwiftUICore/_FioriStyles/PlaceholderTextEditorStyle.fiori.swift +++ b/Sources/FioriSwiftUICore/_FioriStyles/PlaceholderTextEditorStyle.fiori.swift @@ -10,7 +10,6 @@ public struct PlaceholderTextEditorBaseStyle: PlaceholderTextEditorStyle { public func makeBody(_ configuration: PlaceholderTextEditorConfiguration) -> some View { ZStack(alignment: .topLeading) { configuration._textView.body - .focused(self.$isFocused) .focused(self.$isFocused) .onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardDidHideNotification)) { _ in DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { diff --git a/Sources/FioriSwiftUICore/_FioriStyles/PlaceholderTextFieldStyle.fiori.swift b/Sources/FioriSwiftUICore/_FioriStyles/PlaceholderTextFieldStyle.fiori.swift index 3bb6e2d4a..f41f5062d 100644 --- a/Sources/FioriSwiftUICore/_FioriStyles/PlaceholderTextFieldStyle.fiori.swift +++ b/Sources/FioriSwiftUICore/_FioriStyles/PlaceholderTextFieldStyle.fiori.swift @@ -30,7 +30,7 @@ public struct PlaceholderTextFieldBaseStyle: PlaceholderTextFieldStyle { Image(systemName: "xmark.circle") .font(.fiori(forTextStyle: .body)) .foregroundColor(.preferredColor(.tertiaryLabel)) - .padding(.trailing, 8) + .padding(.trailing, 1) } } } diff --git a/Sources/FioriSwiftUICore/_FioriStyles/TextFieldFormViewStyle.fiori.swift b/Sources/FioriSwiftUICore/_FioriStyles/TextFieldFormViewStyle.fiori.swift index 065d9cc84..ae9076252 100644 --- a/Sources/FioriSwiftUICore/_FioriStyles/TextFieldFormViewStyle.fiori.swift +++ b/Sources/FioriSwiftUICore/_FioriStyles/TextFieldFormViewStyle.fiori.swift @@ -5,7 +5,7 @@ import SwiftUI /// The base layout style for `TextFieldFormView`. public struct TextFieldFormViewBaseStyle: TextFieldFormViewStyle { public func makeBody(_ configuration: TextFieldFormViewConfiguration) -> some View { - VStack(alignment: .leading) { + VStack(alignment: .leading, spacing: 4) { HStack(spacing: 0) { configuration.title if configuration.isRequired { @@ -15,6 +15,12 @@ public struct TextFieldFormViewBaseStyle: TextFieldFormViewStyle { } configuration._titleFormView } + .padding(.top, -1) + .padding(.bottom, self.isInfoViewNeeded(configuration) ? 0 : 1) + } + + func isInfoViewNeeded(_ configuration: TextFieldFormViewConfiguration) -> Bool { + TextInputFormViewConfiguration(configuration, isFocused: false).isInfoViewNeeded() } } @@ -63,6 +69,7 @@ extension TextFieldFormViewFioriStyle { TextInputInfoView(config) .textInputInfoViewStyle(style) .typeErased + .padding(.top, -3) } } diff --git a/Sources/FioriSwiftUICore/_FioriStyles/TextInputInfoViewStyle.fiori.swift b/Sources/FioriSwiftUICore/_FioriStyles/TextInputInfoViewStyle.fiori.swift index bd92dc576..3bc854e5b 100755 --- a/Sources/FioriSwiftUICore/_FioriStyles/TextInputInfoViewStyle.fiori.swift +++ b/Sources/FioriSwiftUICore/_FioriStyles/TextInputInfoViewStyle.fiori.swift @@ -387,7 +387,7 @@ struct TextInputFormViewConfiguration { func getTextColor() -> Color { switch self.getControlState() { case .disabled: - return .preferredColor(.separator) + return .preferredColor(.quaternaryLabel) default: return .preferredColor(.primaryLabel) } @@ -417,7 +417,7 @@ struct TextInputFormViewConfiguration { } func getBackgroundColor() -> Color { - self.getEditable() ? .clear : .preferredColor(.tertiaryFill) + self.getEditable() ? .clear : .preferredColor(.quaternaryFill) } func getBorderWidth() -> CGFloat { diff --git a/Sources/FioriSwiftUICore/_FioriStyles/TitleFormViewStyle.fiori.swift b/Sources/FioriSwiftUICore/_FioriStyles/TitleFormViewStyle.fiori.swift index c9fcff5e9..a8ab7ad08 100644 --- a/Sources/FioriSwiftUICore/_FioriStyles/TitleFormViewStyle.fiori.swift +++ b/Sources/FioriSwiftUICore/_FioriStyles/TitleFormViewStyle.fiori.swift @@ -13,7 +13,8 @@ public struct TitleFormViewBaseStyle: TitleFormViewStyle { .disabled(self.getDisabled(configuration)) } .textInputInfoView(isPresented: Binding(get: { self.isInfoViewNeeded(configuration) }, set: { _ in }), description: self.getInfoString(configuration), counter: self.getCounterString(configuration)) - .backgroundStyle(.red) + .padding(.top, -1) + .padding(.bottom, self.isInfoViewNeeded(configuration) ? -12 : -1) } func getDisabled(_ configuration: TitleFormViewConfiguration) -> Bool { @@ -51,6 +52,7 @@ extension TitleFormViewFioriStyle { TextInputInfoView(config) .textInputInfoViewStyle(style) .typeErased + .padding(.top, -4) } .placeholderTextFieldStyle { config in PlaceholderTextField(config) @@ -59,8 +61,6 @@ extension TitleFormViewFioriStyle { } .background(self.getBackgroundColor(configuration)) } - .padding(.top, 0) - .padding(.bottom, self.isInfoViewNeeded(configuration) ? -9 : 0) } }