Skip to content

Commit 33c1634

Browse files
committed
Add samples for rich text component APIs
1 parent 5776327 commit 33c1634

18 files changed

Lines changed: 589 additions & 60 deletions

core/src/main/java/com/orange/ouds/core/component/OudsAlertMessage.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,7 @@ fun OudsAlertMessage(
163163
* Add this list when you need to highlight multiple points, such as service features, plan details, or next steps. Each bullet should be short and written
164164
* as a clear phrase or fragment — avoid long sentences or complex structures.
165165
*
166-
* @sample com.orange.ouds.core.component.samples.OudsAlertMessageSample
167-
*
168-
* @sample com.orange.ouds.core.component.samples.OudsAlertMessageFunctionalWithTopEndActionLinkSample
166+
* @sample com.orange.ouds.core.component.samples.OudsAlertMessageWithAnnotatedTextSample
169167
*/
170168
@Composable
171169
fun OudsAlertMessage(

core/src/main/java/com/orange/ouds/core/component/OudsBulletList.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ private const val MaxLevelCount = 3
104104
* @sample com.orange.ouds.core.component.samples.OudsBulletListUnorderedSample
105105
* @sample com.orange.ouds.core.component.samples.OudsBulletListOrderedSample
106106
* @sample com.orange.ouds.core.component.samples.OudsBulletListBareSample
107+
* @sample com.orange.ouds.core.component.samples.OudsBulletListWithAnnotatedLabelsSample
107108
*/
108109
@Composable
109110
fun OudsBulletList(

core/src/main/java/com/orange/ouds/core/component/OudsCheckboxItem.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ import com.orange.ouds.theme.OudsThemeContract
8282
* is provided, interactions will still happen internally.
8383
*
8484
* @sample com.orange.ouds.core.component.samples.OudsCheckboxItemSample
85+
* @sample com.orange.ouds.core.component.samples.OudsCheckboxItemWithAnnotatedErrorMessageSample
8586
*/
8687
@Composable
8788
fun OudsCheckboxItem(
@@ -164,6 +165,7 @@ fun OudsCheckboxItem(
164165
* if `null` is provided, interactions will still happen internally.
165166
*
166167
* @sample com.orange.ouds.core.component.samples.OudsTriStateCheckboxItemSample
168+
* @sample com.orange.ouds.core.component.samples.OudsTriStateCheckboxItemWithAnnotatedErrorMessageSample
167169
*/
168170
@Composable
169171
fun OudsTriStateCheckboxItem(

core/src/main/java/com/orange/ouds/core/component/OudsPasswordInput.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ import com.orange.ouds.theme.OudsThemeSettings
9898
* is provided, interactions will still happen internally.
9999
*
100100
* @sample com.orange.ouds.core.component.samples.OudsPasswordInputSample
101-
*
102101
* @sample com.orange.ouds.core.component.samples.OudsPasswordInputErrorSample
103102
*/
104103
@Composable
@@ -192,8 +191,8 @@ fun OudsPasswordInput(
192191
* is provided, interactions will still happen internally.
193192
*
194193
* @sample com.orange.ouds.core.component.samples.OudsPasswordInputSample
195-
*
196-
* @sample com.orange.ouds.core.component.samples.OudsPasswordInputErrorSample
194+
* @sample com.orange.ouds.core.component.samples.OudsPasswordInputWithAnnotatedErrorMessageSample
195+
* @sample com.orange.ouds.core.component.samples.OudsPasswordInputWithAnnotatedHelperTextSample
197196
*/
198197
@Composable
199198
fun OudsPasswordInput(

core/src/main/java/com/orange/ouds/core/component/OudsPinCodeInput.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ import kotlinx.coroutines.launch
113113
* is provided, interactions will still happen internally.
114114
*
115115
* @sample com.orange.ouds.core.component.samples.OudsPinCodeInputSample
116-
*
117116
* @sample com.orange.ouds.core.component.samples.OudsPinCodeInputErrorSample
118117
*/
119118
@Composable
@@ -171,8 +170,8 @@ fun OudsPinCodeInput(
171170
* is provided, interactions will still happen internally.
172171
*
173172
* @sample com.orange.ouds.core.component.samples.OudsPinCodeInputSample
174-
*
175-
* @sample com.orange.ouds.core.component.samples.OudsPinCodeInputErrorSample
173+
* @sample com.orange.ouds.core.component.samples.OudsPinCodeInputWithAnnotatedErrorMessageSample
174+
* @sample com.orange.ouds.core.component.samples.OudsPinCodeInputWithAnnotatedHelperTextSample
176175
*/
177176
@Composable
178177
fun OudsPinCodeInput(

core/src/main/java/com/orange/ouds/core/component/OudsRadioButtonItem.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ import com.orange.ouds.theme.OudsThemeContract
8686
* is provided, interactions will still happen internally.
8787
*
8888
* @sample com.orange.ouds.core.component.samples.OudsRadioButtonItemSample
89+
* @sample com.orange.ouds.core.component.samples.OudsRadioButtonItemWithAnnotatedErrorMessageSample
8990
*/
9091
@Composable
9192
fun OudsRadioButtonItem(

core/src/main/java/com/orange/ouds/core/component/OudsSwitchItem.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ import com.orange.ouds.theme.OudsThemeContract
8181
* is provided, interactions will still happen internally.
8282
*
8383
* @sample com.orange.ouds.core.component.samples.OudsSwitchItemSample
84+
* @sample com.orange.ouds.core.component.samples.OudsSwitchItemWithAnnotatedErrorMessageSample
8485
*/
8586
@Composable
8687
fun OudsSwitchItem(

core/src/main/java/com/orange/ouds/core/component/OudsTextArea.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ import com.orange.ouds.theme.OudsThemeSettings
141141
* is provided, interactions will still happen internally.
142142
*
143143
* @sample com.orange.ouds.core.component.samples.OudsTextAreaStateBasedSample
144-
*
145144
* @sample com.orange.ouds.core.component.samples.OudsTextAreaStateBasedErrorSample
146145
*/
147146
@Composable
@@ -241,8 +240,8 @@ fun OudsTextArea(
241240
* is provided, interactions will still happen internally.
242241
*
243242
* @sample com.orange.ouds.core.component.samples.OudsTextAreaStateBasedSample
244-
*
245-
* @sample com.orange.ouds.core.component.samples.OudsTextAreaStateBasedErrorSample
243+
* @sample com.orange.ouds.core.component.samples.OudsTextAreaStateBasedWithAnnotatedErrorMessageSample
244+
* @sample com.orange.ouds.core.component.samples.OudsTextAreaStateBasedWithAnnotatedHelperTextSample
246245
*/
247246
@Composable
248247
fun OudsTextArea(
@@ -409,7 +408,6 @@ private fun OudsTextArea(
409408
* is provided, interactions will still happen internally.
410409
*
411410
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedSample
412-
*
413411
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedErrorSample
414412
*/
415413
@Composable
@@ -504,8 +502,8 @@ fun OudsTextArea(
504502
* is provided, interactions will still happen internally.
505503
*
506504
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedSample
507-
*
508-
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedErrorSample
505+
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedWithAnnotatedErrorMessageSample
506+
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedWithAnnotatedHelperTextSample
509507
*/
510508
@Composable
511509
fun OudsTextArea(
@@ -670,7 +668,6 @@ private fun OudsTextArea(
670668
* is provided, interactions will still happen internally.
671669
*
672670
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedSample
673-
*
674671
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedErrorSample
675672
*/
676673
@Composable
@@ -765,8 +762,8 @@ fun OudsTextArea(
765762
* is provided, interactions will still happen internally.
766763
*
767764
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedSample
768-
*
769-
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedErrorSample
765+
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedWithAnnotatedErrorMessageSample
766+
* @sample com.orange.ouds.core.component.samples.OudsTextAreaValueBasedWithAnnotatedHelperTextSample
770767
*/
771768
@Composable
772769
fun OudsTextArea(

core/src/main/java/com/orange/ouds/core/component/OudsTextInput.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ import com.orange.ouds.theme.OudsThemeSettings
159159
* is provided, interactions will still happen internally.
160160
*
161161
* @sample com.orange.ouds.core.component.samples.OudsTextInputStateBasedSample
162-
*
163162
* @sample com.orange.ouds.core.component.samples.OudsTextInputStateBasedErrorSample
164163
*/
165164
@Composable
@@ -271,8 +270,8 @@ fun OudsTextInput(
271270
* is provided, interactions will still happen internally.
272271
*
273272
* @sample com.orange.ouds.core.component.samples.OudsTextInputStateBasedSample
274-
*
275-
* @sample com.orange.ouds.core.component.samples.OudsTextInputStateBasedErrorSample
273+
* @sample com.orange.ouds.core.component.samples.OudsTextInputStateBasedWithAnnotatedErrorMessageSample
274+
* @sample com.orange.ouds.core.component.samples.OudsTextInputStateBasedWithAnnotatedHelperTextSample
276275
*/
277276
@Composable
278277
fun OudsTextInput(
@@ -454,7 +453,6 @@ private fun OudsTextInput(
454453
* is provided, interactions will still happen internally.
455454
*
456455
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedSample
457-
*
458456
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedErrorSample
459457
*/
460458
@Composable
@@ -560,8 +558,8 @@ fun OudsTextInput(
560558
* is provided, interactions will still happen internally.
561559
*
562560
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedSample
563-
*
564-
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedErrorSample
561+
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedWithAnnotatedErrorMessageSample
562+
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedWithAnnotatedHelperTextSample
565563
*/
566564
@Composable
567565
fun OudsTextInput(
@@ -743,7 +741,6 @@ private fun OudsTextInput(
743741
* is provided, interactions will still happen internally.
744742
*
745743
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedSample
746-
*
747744
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedErrorSample
748745
*/
749746
@Composable
@@ -849,8 +846,8 @@ fun OudsTextInput(
849846
* is provided, interactions will still happen internally.
850847
*
851848
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedSample
852-
*
853-
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedErrorSample
849+
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedWithAnnotatedErrorMessageSample
850+
* @sample com.orange.ouds.core.component.samples.OudsTextInputValueBasedWithAnnotatedHelperTextSample
854851
*/
855852
@Composable
856853
fun OudsTextInput(

core/src/main/java/com/orange/ouds/core/component/samples/OudsAlertMessageSamples.kt

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,87 @@ import androidx.compose.material.icons.Icons
1616
import androidx.compose.material.icons.filled.FavoriteBorder
1717
import androidx.compose.runtime.Composable
1818
import androidx.compose.ui.tooling.preview.PreviewLightDark
19-
import com.orange.ouds.core.component.OudsAlertMessage
2019
import com.orange.ouds.core.component.OudsAlertIcon
20+
import com.orange.ouds.core.component.OudsAlertMessage
2121
import com.orange.ouds.core.component.OudsAlertMessageActionLink
2222
import com.orange.ouds.core.component.OudsAlertMessageActionLinkPosition
2323
import com.orange.ouds.core.component.OudsAlertMessageStatus
24+
import com.orange.ouds.core.component.common.text.OudsLinkAnnotation
25+
import com.orange.ouds.core.component.common.text.buildOudsAnnotatedAlertMessageBulletListLabel
26+
import com.orange.ouds.core.component.common.text.buildOudsAnnotatedAlertMessageDescription
27+
import com.orange.ouds.core.component.common.text.withLink
28+
import com.orange.ouds.core.component.common.text.withStrong
2429
import com.orange.ouds.core.utilities.OudsPreview
2530

2631
@Composable
2732
internal fun OudsAlertMessageSample() {
2833
OudsAlertMessage(
29-
label = "Label",
30-
description = "Description of the alert message.",
34+
label = "New features available",
35+
description = "We've added exciting new features to improve your experience.",
3136
status = OudsAlertMessageStatus.Accent(OudsAlertIcon(imageVector = Icons.Filled.FavoriteBorder)),
3237
onClose = { /* Close the alert message */ },
33-
actionLink = OudsAlertMessageActionLink(label = "Action", onClick = { /* Do something */ }),
38+
actionLink = OudsAlertMessageActionLink(label = "Learn more", onClick = { /* Navigate to features page */ }),
3439
bulletList = listOf(
35-
"Bullet 1",
36-
"Bullet 2",
37-
"Bullet 3"
40+
"Enhanced security with biometric authentication",
41+
"Improved performance and faster load times",
42+
"New customization options for your dashboard"
3843
)
3944
)
4045
}
4146

4247
@Composable
4348
internal fun OudsAlertMessageFunctionalWithTopEndActionLinkSample() {
4449
OudsAlertMessage(
45-
label = "Label",
46-
description = "Description of the alert message.",
50+
label = "Account successfully verified",
51+
description = "Your account has been verified and is now fully activated.",
4752
status = OudsAlertMessageStatus.Positive,
4853
onClose = { /* Close the alert message */ },
49-
actionLink = OudsAlertMessageActionLink(label = "Action", onClick = { /* Do something */ }, position = OudsAlertMessageActionLinkPosition.TopEnd),
54+
actionLink = OudsAlertMessageActionLink(label = "Details", onClick = { /* Navigate to account details */ }, position = OudsAlertMessageActionLinkPosition.TopEnd),
5055
bulletList = listOf(
51-
"Bullet 1",
52-
"Bullet 2",
53-
"Bullet 3"
56+
"All features are now unlocked",
57+
"You can start using premium services",
58+
"Your data is fully synchronized"
5459
)
5560
)
5661
}
5762

63+
@Composable
64+
internal fun OudsAlertMessageWithAnnotatedTextSample() {
65+
val description = buildOudsAnnotatedAlertMessageDescription {
66+
withStrong { append("Important:") }
67+
append(" Please read the ")
68+
withLink(OudsLinkAnnotation.Url("https://example.com")) {
69+
append("terms and conditions")
70+
}
71+
append(" carefully before proceeding.")
72+
}
73+
74+
val bulletList = listOf(
75+
buildOudsAnnotatedAlertMessageBulletListLabel {
76+
withStrong { append("Data security:") }
77+
append(" Your information will be encrypted and stored securely")
78+
},
79+
buildOudsAnnotatedAlertMessageBulletListLabel {
80+
withStrong { append("Privacy policy:") }
81+
append(" We respect your privacy and will not share your data")
82+
},
83+
buildOudsAnnotatedAlertMessageBulletListLabel {
84+
append("For more information, visit our ")
85+
withLink(OudsLinkAnnotation.Url("https://help.example.com")) {
86+
append("help center")
87+
}
88+
}
89+
)
90+
91+
OudsAlertMessage(
92+
label = "Before you continue",
93+
description = description,
94+
status = OudsAlertMessageStatus.Accent(OudsAlertIcon(imageVector = Icons.Filled.FavoriteBorder)),
95+
onClose = { /* Close the alert message */ },
96+
bulletList = bulletList
97+
)
98+
}
99+
58100
@PreviewLightDark
59101
@Composable
60102
private fun PreviewOudsAlertMessageSample() = OudsPreview {
@@ -65,4 +107,10 @@ private fun PreviewOudsAlertMessageSample() = OudsPreview {
65107
@Composable
66108
private fun PreviewOudsAlertMessageFunctionalWithTopEndActionLinkSample() = OudsPreview {
67109
OudsAlertMessageFunctionalWithTopEndActionLinkSample()
110+
}
111+
112+
@PreviewLightDark
113+
@Composable
114+
private fun PreviewOudsAlertMessageWithAnnotatedTextSample() = OudsPreview {
115+
OudsAlertMessageWithAnnotatedTextSample()
68116
}

0 commit comments

Comments
 (0)