@adiraku/react-native-ui 1.2.8-canary-0 → 1.2.8-canary-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/CheckBoxInput/CheckBoxInput.component.js +3 -1
- package/lib/commonjs/components/CheckBoxInput/CheckBoxInput.component.js.map +1 -1
- package/lib/commonjs/components/CheckBoxInput/CheckBoxInput.style.js +2 -2
- package/lib/commonjs/components/CheckBoxInput/CheckBoxInput.style.js.map +1 -1
- package/lib/commonjs/components/RadioInput/RadioInput.component.js +3 -1
- package/lib/commonjs/components/RadioInput/RadioInput.component.js.map +1 -1
- package/lib/commonjs/components/RadioInput/RadioInput.style.js +2 -2
- package/lib/commonjs/components/RadioInput/RadioInput.style.js.map +1 -1
- package/lib/commonjs/components/TextArea/TextArea.component.js +6 -4
- package/lib/commonjs/components/TextArea/TextArea.component.js.map +1 -1
- package/lib/commonjs/components/TextInput/TextInput.component.js +45 -6
- package/lib/commonjs/components/TextInput/TextInput.component.js.map +1 -1
- package/lib/commonjs/components/calendars/calendars.component.js +215 -0
- package/lib/commonjs/components/calendars/calendars.component.js.map +1 -0
- package/lib/commonjs/components/calendars/calendars.service.js +68 -0
- package/lib/commonjs/components/calendars/calendars.service.js.map +1 -0
- package/lib/commonjs/components/calendars/calendars.style.js +126 -0
- package/lib/commonjs/components/calendars/calendars.style.js.map +1 -0
- package/lib/commonjs/components/calendars/calendars.type.js +14 -0
- package/lib/commonjs/components/calendars/calendars.type.js.map +1 -0
- package/lib/commonjs/components/calendars/month-picker-modal.component.js +104 -0
- package/lib/commonjs/components/calendars/month-picker-modal.component.js.map +1 -0
- package/lib/commonjs/components/index.js +7 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/typography/typography.style.js +181 -0
- package/lib/commonjs/components/typography/typography.style.js.map +1 -1
- package/lib/module/components/CheckBoxInput/CheckBoxInput.component.js +3 -1
- package/lib/module/components/CheckBoxInput/CheckBoxInput.component.js.map +1 -1
- package/lib/module/components/CheckBoxInput/CheckBoxInput.style.js +2 -2
- package/lib/module/components/CheckBoxInput/CheckBoxInput.style.js.map +1 -1
- package/lib/module/components/RadioInput/RadioInput.component.js +3 -1
- package/lib/module/components/RadioInput/RadioInput.component.js.map +1 -1
- package/lib/module/components/RadioInput/RadioInput.style.js +2 -2
- package/lib/module/components/RadioInput/RadioInput.style.js.map +1 -1
- package/lib/module/components/TextArea/TextArea.component.js +7 -5
- package/lib/module/components/TextArea/TextArea.component.js.map +1 -1
- package/lib/module/components/TextInput/TextInput.component.js +46 -7
- package/lib/module/components/TextInput/TextInput.component.js.map +1 -1
- package/lib/module/components/calendars/calendars.component.js +207 -0
- package/lib/module/components/calendars/calendars.component.js.map +1 -0
- package/lib/module/components/calendars/calendars.service.js +56 -0
- package/lib/module/components/calendars/calendars.service.js.map +1 -0
- package/lib/module/components/calendars/calendars.style.js +119 -0
- package/lib/module/components/calendars/calendars.style.js.map +1 -0
- package/lib/module/components/calendars/calendars.type.js +8 -0
- package/lib/module/components/calendars/calendars.type.js.map +1 -0
- package/lib/module/components/calendars/month-picker-modal.component.js +95 -0
- package/lib/module/components/calendars/month-picker-modal.component.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/typography/typography.style.js +181 -0
- package/lib/module/components/typography/typography.style.js.map +1 -1
- package/lib/typescript/components/CheckBoxInput/CheckBoxInput.component.d.ts.map +1 -1
- package/lib/typescript/components/RadioInput/RadioInput.component.d.ts.map +1 -1
- package/lib/typescript/components/TextArea/TextArea.component.d.ts.map +1 -1
- package/lib/typescript/components/TextInput/TextInput.component.d.ts.map +1 -1
- package/lib/typescript/components/TextInput/TextInput.type.d.ts +7 -0
- package/lib/typescript/components/TextInput/TextInput.type.d.ts.map +1 -1
- package/lib/typescript/components/calendars/calendars.component.d.ts +8 -0
- package/lib/typescript/components/calendars/calendars.component.d.ts.map +1 -0
- package/lib/typescript/components/calendars/calendars.service.d.ts +9 -0
- package/lib/typescript/components/calendars/calendars.service.d.ts.map +1 -0
- package/lib/typescript/components/calendars/calendars.style.d.ts +20 -0
- package/lib/typescript/components/calendars/calendars.style.d.ts.map +1 -0
- package/lib/typescript/components/calendars/calendars.type.d.ts +26 -0
- package/lib/typescript/components/calendars/calendars.type.d.ts.map +1 -0
- package/lib/typescript/components/calendars/month-picker-modal.component.d.ts +15 -0
- package/lib/typescript/components/calendars/month-picker-modal.component.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/information-box/information-box.type.d.ts +13 -2
- package/lib/typescript/components/information-box/information-box.type.d.ts.map +1 -1
- package/lib/typescript/components/typography/typography.style.d.ts +28 -0
- package/lib/typescript/components/typography/typography.style.d.ts.map +1 -1
- package/lib/typescript/components/typography/typography.type.d.ts +4 -4
- package/lib/typescript/components/typography/typography.type.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/components/CheckBoxInput/CheckBoxInput.component.tsx +8 -1
- package/src/components/CheckBoxInput/CheckBoxInput.style.tsx +2 -2
- package/src/components/RadioInput/RadioInput.component.tsx +8 -1
- package/src/components/RadioInput/RadioInput.style.tsx +2 -2
- package/src/components/TextArea/TextArea.component.tsx +9 -6
- package/src/components/TextInput/TextInput.component.tsx +114 -50
- package/src/components/TextInput/TextInput.type.ts +11 -0
- package/src/components/calendars/calendars.component.tsx +296 -0
- package/src/components/calendars/calendars.service.ts +64 -0
- package/src/components/calendars/calendars.style.ts +148 -0
- package/src/components/calendars/calendars.type.tsx +57 -0
- package/src/components/calendars/month-picker-modal.component.tsx +137 -0
- package/src/components/index.ts +1 -0
- package/src/components/information-box/information-box.type.ts +13 -5
- package/src/components/typography/typography.style.tsx +243 -0
- package/src/components/typography/typography.type.ts +31 -3
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { StyleSheet, type ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { Palettes, Radius, Spacing, Shadow } from '../../themes';
|
|
4
|
+
import { CalendarProps } from 'react-native-calendars';
|
|
5
|
+
|
|
6
|
+
interface ComputedStyleProps {
|
|
7
|
+
modalContainer?: ViewStyle;
|
|
8
|
+
container?: ViewStyle;
|
|
9
|
+
|
|
10
|
+
headerContainer?: ViewStyle;
|
|
11
|
+
headerArrowWrapper?: ViewStyle;
|
|
12
|
+
headerCenterWrapper?: ViewStyle;
|
|
13
|
+
headerCenterItem?: ViewStyle;
|
|
14
|
+
|
|
15
|
+
calendarContainer?: ViewStyle;
|
|
16
|
+
calendarBottomContainer?: ViewStyle;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const getStyle = () => {
|
|
20
|
+
const computedStyle: ComputedStyleProps = {};
|
|
21
|
+
|
|
22
|
+
computedStyle.modalContainer = {
|
|
23
|
+
height: '100%',
|
|
24
|
+
width: '100%',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
computedStyle.container = {
|
|
28
|
+
width: 350,
|
|
29
|
+
backgroundColor: Palettes.white[50],
|
|
30
|
+
paddingVertical: Spacing[24],
|
|
31
|
+
borderRadius: Radius[16],
|
|
32
|
+
overflow: 'hidden',
|
|
33
|
+
...Shadow['shadow-elevation-1'],
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
computedStyle.headerContainer = {
|
|
37
|
+
backgroundColor: Palettes.grey[50],
|
|
38
|
+
height: 40,
|
|
39
|
+
flexGrow: 1,
|
|
40
|
+
borderRadius: Radius[8],
|
|
41
|
+
marginBottom: Spacing[16],
|
|
42
|
+
overflow: 'hidden',
|
|
43
|
+
flexDirection: 'row',
|
|
44
|
+
marginHorizontal: Spacing[16],
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
computedStyle.headerArrowWrapper = {
|
|
48
|
+
height: 40,
|
|
49
|
+
width: 40,
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
computedStyle.headerCenterWrapper = {
|
|
55
|
+
flex: 1,
|
|
56
|
+
flexDirection: 'row',
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
computedStyle.headerCenterItem = {
|
|
60
|
+
flex: 1,
|
|
61
|
+
justifyContent: 'center',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
computedStyle.calendarContainer = {
|
|
66
|
+
height: 350,
|
|
67
|
+
justifyContent: 'space-between',
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
computedStyle.calendarBottomContainer = {
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
marginTop: Spacing[12],
|
|
73
|
+
paddingHorizontal: Spacing[16],
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return StyleSheet.create(computedStyle);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const calendarTheme: CalendarProps['theme'] & {
|
|
80
|
+
'stylesheet.day.basic': any;
|
|
81
|
+
'stylesheet.calendar.header': any;
|
|
82
|
+
'stylesheet.calendar.main': any;
|
|
83
|
+
} = {
|
|
84
|
+
'textDayStyle': {
|
|
85
|
+
height: 40,
|
|
86
|
+
width: 40,
|
|
87
|
+
borderRadius: 99,
|
|
88
|
+
borderWidth: 2,
|
|
89
|
+
borderColor: 'transparent',
|
|
90
|
+
textAlign: 'center',
|
|
91
|
+
verticalAlign: 'middle',
|
|
92
|
+
overflow: 'hidden',
|
|
93
|
+
},
|
|
94
|
+
'stylesheet.day.basic': {
|
|
95
|
+
base: {
|
|
96
|
+
width: 40,
|
|
97
|
+
height: 40,
|
|
98
|
+
alignItems: 'center',
|
|
99
|
+
marginTop: 4,
|
|
100
|
+
},
|
|
101
|
+
alignedText: {},
|
|
102
|
+
selected: {},
|
|
103
|
+
today: {},
|
|
104
|
+
todayText: {
|
|
105
|
+
borderColor: Palettes.yellow[600],
|
|
106
|
+
},
|
|
107
|
+
selectedText: {
|
|
108
|
+
borderColor: Palettes.yellow[600],
|
|
109
|
+
backgroundColor: Palettes.yellow[600],
|
|
110
|
+
},
|
|
111
|
+
disabledText: {
|
|
112
|
+
color: Palettes.grey[200],
|
|
113
|
+
},
|
|
114
|
+
inactiveText: {
|
|
115
|
+
color: Palettes.grey[200],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
'stylesheet.calendar.header': {
|
|
119
|
+
header: {
|
|
120
|
+
flexDirection: 'row',
|
|
121
|
+
justifyContent: 'space-between',
|
|
122
|
+
backgroundColor: 'red',
|
|
123
|
+
height: 0,
|
|
124
|
+
},
|
|
125
|
+
headerContainer: {
|
|
126
|
+
flexGrow: 1,
|
|
127
|
+
justifyContent: 'center',
|
|
128
|
+
},
|
|
129
|
+
week: {
|
|
130
|
+
flexDirection: 'row',
|
|
131
|
+
justifyContent: 'space-between',
|
|
132
|
+
borderBottomWidth: 1,
|
|
133
|
+
borderBottomColor: Palettes.grey[200],
|
|
134
|
+
paddingBottom: 12,
|
|
135
|
+
},
|
|
136
|
+
dayHeader: {
|
|
137
|
+
fontFamily: 'Montserrat-Regular',
|
|
138
|
+
fontSize: 14,
|
|
139
|
+
color: Palettes.black[900],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
'stylesheet.calendar.main': {
|
|
143
|
+
week: {
|
|
144
|
+
flexDirection: 'row',
|
|
145
|
+
justifyContent: 'space-around',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { CalendarProps as RNCalendarProps } from 'react-native-calendars';
|
|
2
|
+
import { ModalProps } from 'react-native-modal';
|
|
3
|
+
|
|
4
|
+
export const MonthID = {
|
|
5
|
+
monthNames: [
|
|
6
|
+
'Januari',
|
|
7
|
+
'Februari',
|
|
8
|
+
'Maret',
|
|
9
|
+
'April',
|
|
10
|
+
'Mei',
|
|
11
|
+
'Juni',
|
|
12
|
+
'Juli',
|
|
13
|
+
'Agustus',
|
|
14
|
+
'September',
|
|
15
|
+
'Oktober',
|
|
16
|
+
'November',
|
|
17
|
+
'Desember',
|
|
18
|
+
],
|
|
19
|
+
monthNamesShort: [
|
|
20
|
+
'Jan',
|
|
21
|
+
'Feb',
|
|
22
|
+
'Mar',
|
|
23
|
+
'Apr',
|
|
24
|
+
'Mei',
|
|
25
|
+
'Jun',
|
|
26
|
+
'Jul',
|
|
27
|
+
'Agu',
|
|
28
|
+
'Sep',
|
|
29
|
+
'Okt',
|
|
30
|
+
'Nov',
|
|
31
|
+
'Des',
|
|
32
|
+
],
|
|
33
|
+
dayNames: ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'],
|
|
34
|
+
dayNamesShort: ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
|
|
35
|
+
today: 'Hari ini',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type CalendarPropsAleph = Pick<ModalProps, 'onDismiss' | 'isVisible'> &
|
|
39
|
+
Omit<RNCalendarProps, 'initialDate'> & {
|
|
40
|
+
/**
|
|
41
|
+
* Initially visible month. Default now
|
|
42
|
+
*/
|
|
43
|
+
initialDate?: Date;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Selected date
|
|
47
|
+
*/
|
|
48
|
+
selectedDate?: Date;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* Callback when the submit button pressed
|
|
53
|
+
*/
|
|
54
|
+
onDateSave: (date: Date) => void;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type ModeSelect = 'calendar' | 'month' | 'year';
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { TouchableHighlight, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Palettes, Radius, Spacing } from '../../themes';
|
|
5
|
+
|
|
6
|
+
import { OnMonthChange } from './calendars.component';
|
|
7
|
+
import { Typography } from '../typography/typography.component';
|
|
8
|
+
import { CalendarPropsAleph, MonthID } from './calendars.type';
|
|
9
|
+
|
|
10
|
+
type MonthPickerModalProps = {
|
|
11
|
+
onMonthChange: OnMonthChange;
|
|
12
|
+
} & Pick<CalendarPropsAleph, 'initialDate'>;
|
|
13
|
+
|
|
14
|
+
export function MonthPickerModal({
|
|
15
|
+
initialDate,
|
|
16
|
+
onMonthChange,
|
|
17
|
+
}: MonthPickerModalProps) {
|
|
18
|
+
return (
|
|
19
|
+
<View
|
|
20
|
+
style={{
|
|
21
|
+
flex: 1,
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
padding: Spacing[24],
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
<View
|
|
28
|
+
style={{
|
|
29
|
+
width: '100%',
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
flexWrap: 'wrap',
|
|
32
|
+
justifyContent: 'space-between',
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
{MonthID.monthNames.map((month, index) => (
|
|
36
|
+
<TouchableHighlight
|
|
37
|
+
key={month}
|
|
38
|
+
onPressIn={() =>
|
|
39
|
+
onMonthChange({
|
|
40
|
+
num: index - (initialDate?.getMonth() || 0),
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
underlayColor={Palettes.black[900] + '33'}
|
|
44
|
+
style={{
|
|
45
|
+
width: '32%',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
justifyContent: 'center',
|
|
48
|
+
borderWidth: 1,
|
|
49
|
+
paddingVertical: Spacing[12],
|
|
50
|
+
borderColor: Palettes.grey[200],
|
|
51
|
+
borderRadius: Radius[8],
|
|
52
|
+
marginBottom: Spacing[8],
|
|
53
|
+
backgroundColor:
|
|
54
|
+
initialDate?.getMonth() === index
|
|
55
|
+
? Palettes.yellow[600]
|
|
56
|
+
: 'transparent',
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<Typography variant="button-small">{month}</Typography>
|
|
60
|
+
</TouchableHighlight>
|
|
61
|
+
))}
|
|
62
|
+
</View>
|
|
63
|
+
</View>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
type YearPickerProps = {
|
|
68
|
+
onYearChange: OnMonthChange;
|
|
69
|
+
yearPairSelectIndex: number;
|
|
70
|
+
yearIntervalPair: [number, number][];
|
|
71
|
+
} & Pick<CalendarPropsAleph, 'initialDate'>;
|
|
72
|
+
export function YearPicker({
|
|
73
|
+
initialDate,
|
|
74
|
+
onYearChange,
|
|
75
|
+
yearPairSelectIndex,
|
|
76
|
+
yearIntervalPair,
|
|
77
|
+
}: YearPickerProps) {
|
|
78
|
+
const yearArray = useMemo(() => {
|
|
79
|
+
const years: number[] = [];
|
|
80
|
+
const yearPair = yearIntervalPair[yearPairSelectIndex];
|
|
81
|
+
|
|
82
|
+
if (!yearPair) return [];
|
|
83
|
+
|
|
84
|
+
for (let year = yearPair[1]; year <= yearPair[0]; year++) {
|
|
85
|
+
years.push(year);
|
|
86
|
+
}
|
|
87
|
+
return years;
|
|
88
|
+
}, [yearPairSelectIndex, yearIntervalPair]);
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<View
|
|
92
|
+
style={{
|
|
93
|
+
flex: 1,
|
|
94
|
+
justifyContent: 'center',
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
padding: Spacing[24],
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
<View
|
|
100
|
+
style={{
|
|
101
|
+
width: '100%',
|
|
102
|
+
flexDirection: 'row',
|
|
103
|
+
flexWrap: 'wrap',
|
|
104
|
+
justifyContent: 'space-between',
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
{yearArray.map((year) => (
|
|
108
|
+
<TouchableHighlight
|
|
109
|
+
key={year}
|
|
110
|
+
onPressIn={() =>
|
|
111
|
+
onYearChange({
|
|
112
|
+
num: (year - (initialDate?.getFullYear() || 0)) * 12,
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
underlayColor={Palettes.black[900] + '33'}
|
|
116
|
+
style={{
|
|
117
|
+
width: '32%',
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
justifyContent: 'center',
|
|
120
|
+
borderWidth: 1,
|
|
121
|
+
paddingVertical: Spacing[12],
|
|
122
|
+
borderColor: Palettes.grey[200],
|
|
123
|
+
borderRadius: Radius[8],
|
|
124
|
+
marginBottom: Spacing[8],
|
|
125
|
+
backgroundColor:
|
|
126
|
+
initialDate?.getFullYear() === year
|
|
127
|
+
? Palettes.yellow[600]
|
|
128
|
+
: 'transparent',
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
<Typography variant="button-small">{year}</Typography>
|
|
132
|
+
</TouchableHighlight>
|
|
133
|
+
))}
|
|
134
|
+
</View>
|
|
135
|
+
</View>
|
|
136
|
+
);
|
|
137
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ActionList } from './ActionList/ActionList.component';
|
|
2
2
|
export { Button } from './button/button.component';
|
|
3
|
+
export { Calendars } from './calendars/calendars.component';
|
|
3
4
|
export { Label } from './label/label.component';
|
|
4
5
|
export { BaseComponent } from './base/base.component';
|
|
5
6
|
export { Typography } from './typography/typography.component';
|
|
@@ -5,16 +5,24 @@ export interface InformationBoxProps {
|
|
|
5
5
|
* The text content of the component
|
|
6
6
|
*/
|
|
7
7
|
text: string | ReactNode;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
subtitle?: string;
|
|
12
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Boolean for showing information icon
|
|
10
|
+
*/
|
|
13
11
|
showIcon?: boolean;
|
|
14
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Props for custom information icon
|
|
15
|
+
*/
|
|
15
16
|
informationIcon?: ReactNode;
|
|
16
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Props for adding additional component below text, use for action
|
|
20
|
+
*/
|
|
17
21
|
actionComponent?: ReactNode;
|
|
18
22
|
|
|
23
|
+
/**
|
|
24
|
+
* State for the component, as a indicator for message severity
|
|
25
|
+
* @default default
|
|
26
|
+
*/
|
|
19
27
|
severity?: 'critical' | 'default';
|
|
20
28
|
}
|
|
@@ -31,6 +31,42 @@ interface ComputedStyleProps {
|
|
|
31
31
|
'caption2'?: TextStyle;
|
|
32
32
|
'overline'?: TextStyle;
|
|
33
33
|
'overline-small'?: TextStyle;
|
|
34
|
+
|
|
35
|
+
// Heading
|
|
36
|
+
'text-heading-h1-semibold'?: TextStyle;
|
|
37
|
+
'text-heading-h1-regular'?: TextStyle;
|
|
38
|
+
'text-heading-h2-semibold'?: TextStyle;
|
|
39
|
+
'text-heading-h2-regular'?: TextStyle;
|
|
40
|
+
'text-heading-h3-bold'?: TextStyle;
|
|
41
|
+
'text-heading-h3-regular'?: TextStyle;
|
|
42
|
+
'text-heading-h4-semibold'?: TextStyle;
|
|
43
|
+
'text-heading-h4-regular'?: TextStyle;
|
|
44
|
+
'text-heading-h5-bold'?: TextStyle;
|
|
45
|
+
'text-heading-h5-semibold'?: TextStyle;
|
|
46
|
+
'text-heading-h5-regular'?: TextStyle;
|
|
47
|
+
'text-heading-h6-bold'?: TextStyle;
|
|
48
|
+
'text-heading-h6-semibold'?: TextStyle;
|
|
49
|
+
'text-heading-h6-regular'?: TextStyle;
|
|
50
|
+
// Subheading
|
|
51
|
+
'text-sub-heading-semibold'?: TextStyle;
|
|
52
|
+
// Subtitle
|
|
53
|
+
'text-subtitle-primary-semibold'?: TextStyle;
|
|
54
|
+
'text-subtitle-secondary-bold'?: TextStyle;
|
|
55
|
+
'text-subtitle-secondary-semibold'?: TextStyle;
|
|
56
|
+
// Button
|
|
57
|
+
'text-button-default-semibold'?: TextStyle;
|
|
58
|
+
'text-button-small-semibold'?: TextStyle;
|
|
59
|
+
// Caption
|
|
60
|
+
'text-caption-semibold'?: TextStyle;
|
|
61
|
+
'text-caption-regular'?: TextStyle;
|
|
62
|
+
// Overline
|
|
63
|
+
'text-overline-semibold'?: TextStyle;
|
|
64
|
+
'text-overline-regular'?: TextStyle;
|
|
65
|
+
'text-overline-strike'?: TextStyle;
|
|
66
|
+
// Body
|
|
67
|
+
'text-body-primary-regular'?: TextStyle;
|
|
68
|
+
'text-body-secondary-regular'?: TextStyle;
|
|
69
|
+
'text-body-tertiary-regular'?: TextStyle;
|
|
34
70
|
}
|
|
35
71
|
|
|
36
72
|
export const getStyle = (props: TypographyProps) => {
|
|
@@ -233,5 +269,212 @@ export const getStyle = (props: TypographyProps) => {
|
|
|
233
269
|
lineHeight: 15,
|
|
234
270
|
};
|
|
235
271
|
|
|
272
|
+
// -===== New Token update =====-
|
|
273
|
+
const textSemiboldV2: TextStyle = {
|
|
274
|
+
fontFamily:
|
|
275
|
+
fontStyle === 'italic'
|
|
276
|
+
? 'Montserrat-SemiBoldItalic'
|
|
277
|
+
: 'Montserrat-SemiBold',
|
|
278
|
+
fontSize: 600,
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
const textBoldV2: TextStyle = {
|
|
282
|
+
fontFamily:
|
|
283
|
+
fontStyle === 'italic' ? 'Montserrat-BoldItalic' : 'Montserrat-Bold',
|
|
284
|
+
fontSize: 700,
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
// Heading
|
|
288
|
+
computedStyle['text-heading-h1-semibold'] = {
|
|
289
|
+
...baseTextStyle,
|
|
290
|
+
...textSemiboldV2,
|
|
291
|
+
fontSize: 96,
|
|
292
|
+
lineHeight: 96,
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
computedStyle['text-heading-h1-regular'] = {
|
|
296
|
+
...baseTextStyle,
|
|
297
|
+
fontSize: 96,
|
|
298
|
+
lineHeight: 96,
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
computedStyle['text-heading-h2-semibold'] = {
|
|
302
|
+
...baseTextStyle,
|
|
303
|
+
...textSemiboldV2,
|
|
304
|
+
fontSize: 60,
|
|
305
|
+
lineHeight: 60,
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
computedStyle['text-heading-h2-regular'] = {
|
|
309
|
+
...baseTextStyle,
|
|
310
|
+
fontSize: 60,
|
|
311
|
+
lineHeight: 60,
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
computedStyle['text-heading-h3-bold'] = {
|
|
315
|
+
...baseTextStyle,
|
|
316
|
+
...textBoldV2,
|
|
317
|
+
fontSize: 48,
|
|
318
|
+
lineHeight: 48,
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
computedStyle['text-heading-h3-regular'] = {
|
|
322
|
+
...baseTextStyle,
|
|
323
|
+
fontSize: 48,
|
|
324
|
+
lineHeight: 48,
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
computedStyle['text-heading-h4-semibold'] = {
|
|
328
|
+
...baseTextStyle,
|
|
329
|
+
...textSemiboldV2,
|
|
330
|
+
fontSize: 34,
|
|
331
|
+
lineHeight: 34,
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
computedStyle['text-heading-h4-regular'] = {
|
|
335
|
+
...baseTextStyle,
|
|
336
|
+
fontSize: 34,
|
|
337
|
+
lineHeight: 34,
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
computedStyle['text-heading-h5-bold'] = {
|
|
341
|
+
...baseTextStyle,
|
|
342
|
+
...textBoldV2,
|
|
343
|
+
fontSize: 24,
|
|
344
|
+
lineHeight: 24,
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
computedStyle['text-heading-h5-semibold'] = {
|
|
348
|
+
...baseTextStyle,
|
|
349
|
+
...textSemiboldV2,
|
|
350
|
+
fontSize: 24,
|
|
351
|
+
lineHeight: 24,
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
computedStyle['text-heading-h5-regular'] = {
|
|
355
|
+
...baseTextStyle,
|
|
356
|
+
fontSize: 24,
|
|
357
|
+
lineHeight: 24,
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
computedStyle['text-heading-h6-bold'] = {
|
|
361
|
+
...baseTextStyle,
|
|
362
|
+
...textBoldV2,
|
|
363
|
+
fontSize: 20,
|
|
364
|
+
lineHeight: 20,
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
computedStyle['text-heading-h6-semibold'] = {
|
|
368
|
+
...baseTextStyle,
|
|
369
|
+
...textSemiboldV2,
|
|
370
|
+
fontSize: 20,
|
|
371
|
+
lineHeight: 20,
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
computedStyle['text-heading-h6-regular'] = {
|
|
375
|
+
...baseTextStyle,
|
|
376
|
+
fontSize: 20,
|
|
377
|
+
lineHeight: 20,
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
// Sub Heading
|
|
381
|
+
computedStyle['text-sub-heading-semibold'] = {
|
|
382
|
+
...baseTextStyle,
|
|
383
|
+
...textSemiboldV2,
|
|
384
|
+
fontSize: 14,
|
|
385
|
+
lineHeight: 14,
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// Subtitle
|
|
389
|
+
computedStyle['text-subtitle-primary-semibold'] = {
|
|
390
|
+
...baseTextStyle,
|
|
391
|
+
...textSemiboldV2,
|
|
392
|
+
fontSize: 16,
|
|
393
|
+
lineHeight: 16,
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
computedStyle['text-subtitle-secondary-bold'] = {
|
|
397
|
+
...baseTextStyle,
|
|
398
|
+
...textSemiboldV2,
|
|
399
|
+
fontSize: 14,
|
|
400
|
+
lineHeight: 14,
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
computedStyle['text-subtitle-secondary-semibold'] = {
|
|
404
|
+
...baseTextStyle,
|
|
405
|
+
...textSemiboldV2,
|
|
406
|
+
fontSize: 14,
|
|
407
|
+
lineHeight: 14,
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
// Button
|
|
411
|
+
computedStyle['text-button-default-semibold'] = {
|
|
412
|
+
...baseTextStyle,
|
|
413
|
+
...textSemiboldV2,
|
|
414
|
+
fontSize: 14,
|
|
415
|
+
lineHeight: 14,
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
computedStyle['text-button-small-semibold'] = {
|
|
419
|
+
...baseTextStyle,
|
|
420
|
+
...textSemiboldV2,
|
|
421
|
+
fontSize: 12,
|
|
422
|
+
lineHeight: 12,
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
// Caption
|
|
426
|
+
computedStyle['text-caption-semibold'] = {
|
|
427
|
+
...baseTextStyle,
|
|
428
|
+
...textSemiboldV2,
|
|
429
|
+
fontSize: 12,
|
|
430
|
+
lineHeight: 12,
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
computedStyle['text-caption-regular'] = {
|
|
434
|
+
...baseTextStyle,
|
|
435
|
+
fontSize: 12,
|
|
436
|
+
lineHeight: 12,
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
// Overline
|
|
440
|
+
computedStyle['text-overline-semibold'] = {
|
|
441
|
+
...baseTextStyle,
|
|
442
|
+
...textSemiboldV2,
|
|
443
|
+
fontSize: 10,
|
|
444
|
+
lineHeight: 10,
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
computedStyle['text-overline-regular'] = {
|
|
448
|
+
...baseTextStyle,
|
|
449
|
+
fontSize: 12,
|
|
450
|
+
lineHeight: 12,
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
computedStyle['text-overline-strike'] = {
|
|
454
|
+
...baseTextStyle,
|
|
455
|
+
textDecorationLine: 'line-through',
|
|
456
|
+
fontSize: 12,
|
|
457
|
+
lineHeight: 12,
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
// Body
|
|
461
|
+
computedStyle['text-body-primary-regular'] = {
|
|
462
|
+
...baseTextStyle,
|
|
463
|
+
fontSize: 16,
|
|
464
|
+
lineHeight: 16,
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
computedStyle['text-body-secondary-regular'] = {
|
|
468
|
+
...baseTextStyle,
|
|
469
|
+
fontSize: 14,
|
|
470
|
+
lineHeight: 14,
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
computedStyle['text-body-tertiary-regular'] = {
|
|
474
|
+
...baseTextStyle,
|
|
475
|
+
fontSize: 12,
|
|
476
|
+
lineHeight: 12,
|
|
477
|
+
};
|
|
478
|
+
|
|
236
479
|
return StyleSheet.create(computedStyle);
|
|
237
480
|
};
|
|
@@ -4,9 +4,37 @@ export interface TypographyProps extends TextProps {
|
|
|
4
4
|
// children: string | null;
|
|
5
5
|
/**
|
|
6
6
|
* The variant of the component
|
|
7
|
-
* @default
|
|
7
|
+
* @default body1
|
|
8
8
|
*/
|
|
9
9
|
variant?:
|
|
10
|
+
| 'text-heading-h1-semibold'
|
|
11
|
+
| 'text-heading-h1-regular'
|
|
12
|
+
| 'text-heading-h2-semibold'
|
|
13
|
+
| 'text-heading-h2-regular'
|
|
14
|
+
| 'text-heading-h3-bold'
|
|
15
|
+
| 'text-heading-h3-regular'
|
|
16
|
+
| 'text-heading-h4-semibold'
|
|
17
|
+
| 'text-heading-h4-regular'
|
|
18
|
+
| 'text-heading-h5-bold'
|
|
19
|
+
| 'text-heading-h5-semibold'
|
|
20
|
+
| 'text-heading-h5-regular'
|
|
21
|
+
| 'text-heading-h6-bold'
|
|
22
|
+
| 'text-heading-h6-semibold'
|
|
23
|
+
| 'text-heading-h6-regular'
|
|
24
|
+
| 'text-sub-heading-semibold'
|
|
25
|
+
| 'text-subtitle-primary-semibold'
|
|
26
|
+
| 'text-subtitle-secondary-bold'
|
|
27
|
+
| 'text-subtitle-secondary-semibold'
|
|
28
|
+
| 'text-button-default-semibold'
|
|
29
|
+
| 'text-button-small-semibold'
|
|
30
|
+
| 'text-caption-semibold'
|
|
31
|
+
| 'text-caption-regular'
|
|
32
|
+
| 'text-overline-semibold'
|
|
33
|
+
| 'text-overline-regular'
|
|
34
|
+
| 'text-overline-strike'
|
|
35
|
+
| 'text-body-primary-regular'
|
|
36
|
+
| 'text-body-secondary-regular'
|
|
37
|
+
| 'text-body-tertiary-regular'
|
|
10
38
|
| 'heading1-semibold'
|
|
11
39
|
| 'heading1-regular'
|
|
12
40
|
| 'heading2-semibold'
|
|
@@ -39,13 +67,13 @@ export interface TypographyProps extends TextProps {
|
|
|
39
67
|
* The style of the font
|
|
40
68
|
* - `italic`: Display text in italic
|
|
41
69
|
* - `normal`: Display text in normal
|
|
42
|
-
* @default
|
|
70
|
+
* @default normal
|
|
43
71
|
*/
|
|
44
72
|
fontStyle?: 'italic' | 'normal';
|
|
45
73
|
|
|
46
74
|
/**
|
|
47
75
|
* The color of the Text
|
|
48
|
-
* @default Palettes.Black.900 |
|
|
76
|
+
* @default Palettes.Black.900 | #112639
|
|
49
77
|
*/
|
|
50
78
|
fontColor?: ColorValue;
|
|
51
79
|
|