@@ -86,6 +86,7 @@ public enum TextAreaValue: Equatable {
86
86
- style: Стиль текстового поля (`default`, `error`, `warning`, `success`).
87
87
- labelPlacement: Размещение метки (`outer`, `inner`, `none`).
88
88
- required: Флаг, указывающий, является ли поле обязательным.
89
+ - divider: Флаг, указывающий, показывать ли линию разделителя.
89
90
- requiredPlacement: Размещение обязательного индикатора (`left`, `right`).
90
91
- dynamicHeight: Флаг, указывающий, расширяется ли текстовое поле по высоте в зависимости от высоты текста.
91
92
- appearance: Параметры внешнего вида текстового поля.
@@ -108,6 +109,7 @@ public struct SDDSTextArea: View {
108
109
public let style : TextAreaStyle
109
110
public let labelPlacement : TextAreaLabelPlacement
110
111
public let required : Bool
112
+ public let divider : Bool
111
113
public let requiredPlacement : TextAreaRequiredPlacement
112
114
public let dynamicHeight : Bool
113
115
public let appearance : TextAreaAppearance
@@ -135,6 +137,7 @@ public struct SDDSTextArea: View {
135
137
style: TextAreaStyle = . default,
136
138
labelPlacement: TextAreaLabelPlacement = . outer,
137
139
required: Bool = false ,
140
+ divider: Bool = true ,
138
141
requiredPlacement: TextAreaRequiredPlacement = . left,
139
142
dynamicHeight: Bool = false ,
140
143
appearance: TextAreaAppearance ,
@@ -166,6 +169,7 @@ public struct SDDSTextArea: View {
166
169
self . readOnly = readOnly
167
170
self . style = style
168
171
self . required = required
172
+ self . divider = divider
169
173
self . requiredPlacement = requiredPlacement
170
174
self . title = title
171
175
self . optionalTitle = optionalTitle
@@ -287,14 +291,14 @@ public struct SDDSTextArea: View {
287
291
. padding ( . trailing, size. textInputPaddings. trailing)
288
292
289
293
iconActionView
290
- . padding ( . trailing, fieldHorizontalPadding )
294
+ . padding ( . trailing, boxTrailingPadding )
291
295
} else {
292
296
textEditor ( id: textAreaOuterTitleId)
293
297
. padding ( size. textInputPaddings)
294
298
295
299
iconActionView
296
300
. padding ( . top, size. textInputPaddings. top)
297
- . padding ( . trailing, fieldHorizontalPadding )
301
+ . padding ( . trailing, boxTrailingPadding )
298
302
}
299
303
}
300
304
case . multiple( _, let chips) :
@@ -310,7 +314,7 @@ public struct SDDSTextArea: View {
310
314
311
315
iconActionView
312
316
. padding ( . top, size. textInputPaddings. top)
313
- . padding ( . trailing, layout == . clear ? size. iconActionClearTrailingPadding : fieldHorizontalPadding )
317
+ . padding ( . trailing, layout == . clear ? size. iconActionClearTrailingPadding : boxTrailingPadding )
314
318
}
315
319
316
320
textEditor ( id: textAreaMultipleId)
@@ -431,8 +435,8 @@ public struct SDDSTextArea: View {
431
435
. frame ( maxWidth: . infinity)
432
436
}
433
437
. frame ( height: size. fieldHeight ( layout: layout) , debug: debugConfiguration. fieldHeight)
434
- . padding ( . leading, fieldHorizontalPadding , debug: debugConfiguration. fieldHorizontalPadding )
435
- . padding ( . trailing, fieldTrailingPadding, debug: debugConfiguration. fieldHorizontalPadding )
438
+ . padding ( . leading, boxLeadingPadding , debug: debugConfiguration. boxLeadingPadding )
439
+ . padding ( . trailing, fieldTrailingPadding, debug: debugConfiguration. boxTrailingPadding )
436
440
437
441
VStack ( alignment: . leading, spacing: 0 ) {
438
442
VStack ( alignment: . leading, spacing: 0 ) {
@@ -464,8 +468,8 @@ public struct SDDSTextArea: View {
464
468
bottomLineView
465
469
}
466
470
}
467
- . padding ( . leading, fieldHorizontalPadding , debug: debugConfiguration. fieldHorizontalPadding )
468
- . padding ( . trailing, fieldTrailingPadding, debug: debugConfiguration. fieldHorizontalPadding )
471
+ . padding ( . leading, boxLeadingPadding , debug: debugConfiguration. boxLeadingPadding )
472
+ . padding ( . trailing, fieldTrailingPadding, debug: debugConfiguration. boxTrailingPadding )
469
473
470
474
if shouldShowIndicatorForInnerLabelDefaultLayout || shouldShowIndicatorForNoneLabelDefaultLayout {
471
475
indicatorOverlayView
@@ -541,12 +545,15 @@ public struct SDDSTextArea: View {
541
545
}
542
546
543
547
private var counterColor : Color {
548
+ if readOnly {
549
+ return appearance. counterColorReadOnly. color ( for: colorScheme)
550
+ }
544
551
return appearance. counterColorDefault. color ( for: colorScheme)
545
552
}
546
553
547
554
private var backgroundColor : Color {
548
555
if readOnly {
549
- return appearance. backgroundColorDefault . color ( for: colorScheme)
556
+ return appearance. backgroundColorReadOnly . color ( for: colorScheme)
550
557
}
551
558
return appearance. backgroundColor ( for: style, isFocused: isFocused) . color ( for: colorScheme)
552
559
}
@@ -559,10 +566,16 @@ public struct SDDSTextArea: View {
559
566
}
560
567
561
568
private var placeholderColor : Color {
569
+ if readOnly {
570
+ return appearance. placeholderColorReadOnly. color ( for: colorScheme)
571
+ }
562
572
return appearance. placeholderColor ( for: isFocused ? . default : style, layout: layout) . color ( for: colorScheme)
563
573
}
564
574
565
575
private var textColor : Color {
576
+ if readOnly {
577
+ return appearance. textColorReadOnly. color ( for: colorScheme)
578
+ }
566
579
return appearance. textColor ( for: isFocused ? . default : style, layout: layout) . color ( for: colorScheme)
567
580
}
568
581
@@ -583,6 +596,7 @@ public struct SDDSTextArea: View {
583
596
private var iconActionView : some View {
584
597
if let rightView = iconActionViewProvider? . view {
585
598
rightView
599
+ . foregroundColor ( appearance. endContentColor. color ( for: colorScheme) )
586
600
. frame ( width: iconActionViewWidth, height: iconActionViewHeight, debug: debugConfiguration. iconAction)
587
601
. padding ( . leading, size. iconActionPadding, debug: debugConfiguration. iconAction)
588
602
} else {
@@ -639,9 +653,13 @@ public struct SDDSTextArea: View {
639
653
640
654
@ViewBuilder
641
655
private var bottomLineView : some View {
642
- Rectangle ( )
643
- . fill ( bottomLineColor)
644
- . frame ( height: size. lineWidth, debug: debugConfiguration. fieldView)
656
+ if divider {
657
+ Rectangle ( )
658
+ . fill ( bottomLineColor)
659
+ . frame ( height: size. lineWidth, debug: debugConfiguration. fieldView)
660
+ } else {
661
+ EmptyView ( )
662
+ }
645
663
}
646
664
647
665
// MARK: - Computed Properties for Conditions
@@ -663,7 +681,7 @@ public struct SDDSTextArea: View {
663
681
}
664
682
665
683
private var captionTrailingPadding : CGFloat {
666
- fieldHorizontalPadding
684
+ boxTrailingPadding
667
685
}
668
686
669
687
private var fieldTrailingPadding : CGFloat {
@@ -825,8 +843,16 @@ public struct SDDSTextArea: View {
825
843
return typography
826
844
}
827
845
828
- private var fieldHorizontalPadding : CGFloat {
829
- layout == . clear ? 0 : size. fieldHorizontalPadding
846
+ private var boxLeadingPadding : CGFloat {
847
+ if displayChips {
848
+ return size. chipsPadding
849
+ }
850
+
851
+ return layout == . clear ? 0 : size. boxLeadingPadding
852
+ }
853
+
854
+ private var boxTrailingPadding : CGFloat {
855
+ layout == . clear ? 0 : size. boxTrailingPadding
830
856
}
831
857
832
858
}
0 commit comments