-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathComponent.kt
More file actions
117 lines (110 loc) · 4.14 KB
/
Copy pathComponent.kt
File metadata and controls
117 lines (110 loc) · 4.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* Software Name: OUDS Android
* SPDX-FileCopyrightText: Copyright (c) Orange SA
* SPDX-License-Identifier: MIT
*
* This software is distributed under the MIT license,
* the text of which is available at https://opensource.org/license/MIT/
* or see the "LICENSE" file for more details.
*
* Software description: Android library of reusable graphical components
*/
package com.orange.ouds.gradle
import com.orange.ouds.theme.OudsVersion
import org.gradle.api.Project
enum class Component {
AlertMessage,
AppBar,
Badge,
BadgeCount,
BadgeIcon,
BottomSheet,
BulletList,
Button,
Checkbox,
Divider,
Fab,
FilterChip,
InlineAlert,
InputTag,
Link,
NavigationBar,
NavigationButton,
PasswordInput,
PinCodeInput,
ProgressIndicator,
RadioButton,
SuggestionChip,
Switch,
Tag,
TextArea,
TextInput;
val version: String
get() = with(OudsVersion.Component) {
when (this@Component) {
Component.AlertMessage -> AlertMessage
Component.AppBar -> AppBar
Component.Badge -> Badge
Component.BadgeCount -> BadgeCount
Component.BadgeIcon -> BadgeIcon
Component.BottomSheet -> BottomSheet
Component.BulletList -> BulletList
Component.Button -> Button
Component.Checkbox -> Checkbox
Component.Divider -> Divider
Component.Fab -> Fab
Component.FilterChip -> FilterChip
Component.InlineAlert -> InlineAlert
Component.InputTag -> InputTag
Component.Link -> Link
Component.NavigationBar -> NavigationBar
Component.NavigationButton -> NavigationButton
Component.PasswordInput -> PasswordInput
Component.PinCodeInput -> PinCodeInput
Component.ProgressIndicator -> ProgressIndicator
Component.RadioButton -> RadioButton
Component.SuggestionChip -> SuggestionChip
Component.Switch -> Switch
Component.Tag -> Tag
Component.TextArea -> TextArea
Component.TextInput -> TextInput
}
}
val designName: String
get() {
// Convert enum name to design name (e.g., "BadgeIcon" -> "Badge Icon")
return name
.replace(Regex("([a-z])([A-Z])"), "$1 $2")
.replace("Pin", "PIN")
.replace("Fab", "FAB")
}
fun getSourceFilePaths(project: Project): List<String> {
val filenames = when (this) {
AlertMessage -> listOf("OudsAlertMessage")
AppBar -> listOf("OudsTopAppBar")
Badge, BadgeCount, BadgeIcon -> listOf("OudsBadge")
BottomSheet -> listOf("OudsBottomSheetScaffold", "OudsModalBottomSheet")
BulletList -> listOf("OudsBulletList")
Button -> listOf("OudsButton")
Checkbox -> listOf("OudsCheckbox", "OudsCheckboxItem")
Divider -> listOf("OudsDivider")
Fab -> listOf("OudsFloatingActionButton")
FilterChip -> listOf("OudsFilterChip")
InlineAlert -> listOf("OudsInlineAlert")
InputTag -> listOf("OudsInputTag")
Link -> listOf("OudsLink")
NavigationBar -> listOf("OudsNavigationBar")
NavigationButton -> listOf("OudsNavigationButton")
PasswordInput -> listOf("OudsPasswordInput")
PinCodeInput -> listOf("OudsPinCodeInput")
ProgressIndicator -> listOf("OudsCircularProgressIndicator", "OudsLinearProgressIndicator")
RadioButton -> listOf("OudsRadioButton", "OudsRadioButtonItem")
SuggestionChip -> listOf("OudsSuggestionChip")
Switch -> listOf("OudsSwitch", "OudsSwitchItem")
Tag -> listOf("OudsTag")
TextArea -> listOf("OudsTextArea")
TextInput -> listOf("OudsTextInput")
}
return filenames.map { "${project.rootProject.projectDir}/core/src/commonMain/kotlin/com/orange/ouds/core/component/$it.kt" }
}
}