@codeleap/mobile 2.0.5 → 2.1.0
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/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Button/styles.js +1 -4
- package/dist/components/Button/styles.js.map +1 -1
- package/dist/components/Checkbox/index.js +19 -16
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/styles.d.ts +2 -1
- package/dist/components/Checkbox/styles.js +3 -6
- package/dist/components/Checkbox/styles.js.map +1 -1
- package/dist/components/ContentView/index.d.ts +1 -1
- package/dist/components/ContentView/index.js +2 -2
- package/dist/components/ContentView/index.js.map +1 -1
- package/dist/components/ContentView/styles.js +3 -3
- package/dist/components/ContentView/styles.js.map +1 -1
- package/dist/components/EmptyPlaceholder/index.d.ts +1 -1
- package/dist/components/FileInput/index.d.ts +2 -11
- package/dist/components/FileInput/index.js +2 -30
- package/dist/components/FileInput/index.js.map +1 -1
- package/dist/components/InputLabel/index.d.ts +12 -0
- package/dist/components/InputLabel/index.js +62 -0
- package/dist/components/InputLabel/index.js.map +1 -0
- package/dist/components/InputLabel/styles.d.ts +4 -0
- package/dist/components/InputLabel/styles.js +26 -0
- package/dist/components/InputLabel/styles.js.map +1 -0
- package/dist/components/Pager/index.d.ts +1 -1
- package/dist/components/RadioInput/index.d.ts +1 -0
- package/dist/components/RadioInput/index.js +5 -4
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/styles.d.ts +2 -1
- package/dist/components/RadioInput/styles.js.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts +2 -1
- package/dist/components/SegmentedControl/index.js +8 -14
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/SegmentedControl/styles.d.ts +2 -1
- package/dist/components/SegmentedControl/styles.js.map +1 -1
- package/dist/components/Slider/index.js +6 -5
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/styles.d.ts +2 -1
- package/dist/components/Slider/styles.js.map +1 -1
- package/dist/components/Switch/index.js +6 -1
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/styles.d.ts +2 -1
- package/dist/components/Switch/styles.js +1 -1
- package/dist/components/Switch/styles.js.map +1 -1
- package/dist/components/TextInput/Label.d.ts +1 -1
- package/dist/components/TextInput/Label.js +1 -1
- package/dist/components/TextInput/Label.js.map +1 -1
- package/dist/components/TextInput/index.d.ts +0 -1
- package/dist/components/TextInput/index.js +7 -5
- package/dist/components/TextInput/index.js.map +1 -1
- package/dist/components/TextInput/styles.d.ts +2 -1
- package/dist/components/TextInput/styles.js +3 -6
- package/dist/components/TextInput/styles.js.map +1 -1
- package/dist/components/Touchable/index.js +5 -5
- package/dist/components/Touchable/index.js.map +1 -1
- package/dist/components/components.d.ts +1 -0
- package/dist/components/components.js +1 -0
- package/dist/components/components.js.map +1 -1
- package/dist/components/defaultStyles.d.ts +3 -0
- package/dist/components/defaultStyles.js +2 -0
- package/dist/components/defaultStyles.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +1 -1
- package/src/components/Button/styles.ts +1 -0
- package/src/components/Checkbox/index.tsx +19 -18
- package/src/components/Checkbox/styles.ts +7 -7
- package/src/components/ContentView/index.tsx +3 -3
- package/src/components/ContentView/styles.ts +2 -3
- package/src/components/EmptyPlaceholder/index.tsx +1 -1
- package/src/components/FileInput/index.tsx +6 -52
- package/src/components/InputLabel/index.tsx +38 -0
- package/src/components/InputLabel/styles.ts +19 -0
- package/src/components/Pager/index.tsx +1 -1
- package/src/components/RadioInput/index.tsx +7 -3
- package/src/components/RadioInput/styles.ts +2 -1
- package/src/components/SegmentedControl/index.tsx +9 -3
- package/src/components/SegmentedControl/styles.ts +3 -1
- package/src/components/Slider/index.tsx +12 -7
- package/src/components/Slider/styles.ts +2 -1
- package/src/components/Switch/index.tsx +7 -2
- package/src/components/Switch/styles.ts +3 -2
- package/src/components/TextInput/index.tsx +6 -9
- package/src/components/TextInput/styles.ts +8 -11
- package/src/components/Touchable/index.tsx +6 -5
- package/src/components/components.ts +1 -0
- package/src/components/defaultStyles.ts +2 -0
- package/src/components/TextInput/Label.tsx +0 -26
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { assignTextStyle, createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
2
|
import { ActionIconParts } from '../ActionIcon'
|
|
3
|
+
import { InputLabelComposition } from '../InputLabel'
|
|
3
4
|
|
|
4
5
|
export type IconParts = Exclude<ActionIconParts, 'icon' | 'icon:disabled'>
|
|
5
6
|
type InputIcons = 'icon' | 'leftIcon' | 'rightIcon'
|
|
@@ -11,15 +12,13 @@ type TextInputParts =
|
|
|
11
12
|
| 'wrapper'
|
|
12
13
|
| InputIconComposition
|
|
13
14
|
| 'textField'
|
|
14
|
-
| 'label'
|
|
15
15
|
| 'innerWrapper'
|
|
16
16
|
| 'error'
|
|
17
17
|
| 'subtitle'
|
|
18
18
|
| 'subtitleWrapper'
|
|
19
19
|
| 'placeholder'
|
|
20
20
|
| 'selection'
|
|
21
|
-
|
|
|
22
|
-
| 'labelWrapper'
|
|
21
|
+
| `label${Capitalize<InputLabelComposition>}`
|
|
23
22
|
|
|
24
23
|
export type TextInputComposition =
|
|
25
24
|
| `${TextInputParts}:error`
|
|
@@ -62,8 +61,11 @@ export const TextInputStyles = {
|
|
|
62
61
|
alignItems: 'center',
|
|
63
62
|
},
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
labelWrapper: {
|
|
66
65
|
...theme.spacing.marginBottom(1),
|
|
66
|
+
|
|
67
|
+
},
|
|
68
|
+
labelText: {
|
|
67
69
|
...assignTextStyle('h5')(theme).text,
|
|
68
70
|
},
|
|
69
71
|
'icon': {
|
|
@@ -94,7 +96,7 @@ export const TextInputStyles = {
|
|
|
94
96
|
subtitle: {
|
|
95
97
|
...theme.presets.textRight,
|
|
96
98
|
},
|
|
97
|
-
'
|
|
99
|
+
'labelText:error': {
|
|
98
100
|
color: theme.colors.negative,
|
|
99
101
|
},
|
|
100
102
|
|
|
@@ -104,12 +106,7 @@ export const TextInputStyles = {
|
|
|
104
106
|
'innerWrapper:focus': {
|
|
105
107
|
...theme.border.primary(1),
|
|
106
108
|
},
|
|
107
|
-
|
|
108
|
-
color: theme.colors.negative,
|
|
109
|
-
},
|
|
110
|
-
labelWrapper: {
|
|
111
|
-
...theme.presets.row,
|
|
112
|
-
},
|
|
109
|
+
|
|
113
110
|
})),
|
|
114
111
|
line: createTextInputStyle((theme) => ({
|
|
115
112
|
innerWrapper: {
|
|
@@ -122,17 +122,18 @@ export const Touchable: React.FC<TouchableProps> = forwardRef<
|
|
|
122
122
|
'margin',
|
|
123
123
|
'alignSelf',
|
|
124
124
|
'border',
|
|
125
|
+
'top!',
|
|
126
|
+
'left!',
|
|
127
|
+
'right!',
|
|
128
|
+
'bottom!',
|
|
129
|
+
'position!',
|
|
125
130
|
// 'flex!',
|
|
126
131
|
]
|
|
127
132
|
const sharedKeys = [
|
|
128
133
|
'width!',
|
|
129
134
|
'height!',
|
|
130
135
|
'flex!',
|
|
131
|
-
|
|
132
|
-
'top!',
|
|
133
|
-
'left!',
|
|
134
|
-
'right!',
|
|
135
|
-
'bottom!',
|
|
136
|
+
|
|
136
137
|
]
|
|
137
138
|
|
|
138
139
|
const wrapperStyle = {} as any
|
|
@@ -26,6 +26,7 @@ import { MultiSelectStyles } from './MultiSelect'
|
|
|
26
26
|
import { ScrollStyles } from './Scroll'
|
|
27
27
|
import { ActionIconStyles } from './ActionIcon'
|
|
28
28
|
import { GridStyles } from './Grid'
|
|
29
|
+
import { InputLabelStyles } from './InputLabel'
|
|
29
30
|
|
|
30
31
|
export const defaultStyles = {
|
|
31
32
|
View: ViewStyles,
|
|
@@ -57,4 +58,5 @@ export const defaultStyles = {
|
|
|
57
58
|
PaginationIndicator: PaginationIndicatorStyles,
|
|
58
59
|
ActionIcon: ActionIconStyles,
|
|
59
60
|
Grid: GridStyles,
|
|
61
|
+
InputLabel: InputLabelStyles,
|
|
60
62
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useDefaultComponentStyle } from '@codeleap/common'
|
|
3
|
-
import { StyleSheet } from 'react-native'
|
|
4
|
-
import { Text } from '../Text'
|
|
5
|
-
import { View } from '../View'
|
|
6
|
-
|
|
7
|
-
export const InputLabel = ({ label, variants = [], styles = {}, style, asteriskStyle = null, required = false, wrapperStyle = null }) => {
|
|
8
|
-
const labelStyles = useDefaultComponentStyle('TextInput', {
|
|
9
|
-
variants, styles, transform: StyleSheet.flatten,
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
if (!label) return null
|
|
13
|
-
|
|
14
|
-
switch (typeof label) {
|
|
15
|
-
case 'string':
|
|
16
|
-
return <View style={ wrapperStyle || labelStyles.labelWrapper}>
|
|
17
|
-
<Text style={style || labelStyles.label} text={label} />
|
|
18
|
-
{required && <Text style={asteriskStyle || labelStyles.requiredAsterisk} text={' *'} />}
|
|
19
|
-
</View>
|
|
20
|
-
case 'object':
|
|
21
|
-
return label
|
|
22
|
-
default:
|
|
23
|
-
return null
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|