@chem-po/react-native 0.0.14 → 0.0.16
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/form/Field.js +4 -2
- package/lib/commonjs/components/form/Field.js.map +1 -1
- package/lib/commonjs/components/form/Form.js +20 -7
- package/lib/commonjs/components/form/Form.js.map +1 -1
- package/lib/commonjs/components/form/input/Editable.js +24 -7
- package/lib/commonjs/components/form/input/Editable.js.map +1 -1
- package/lib/commonjs/components/form/input/common/InputClearButton.js +10 -5
- package/lib/commonjs/components/form/input/common/InputClearButton.js.map +1 -1
- package/lib/commonjs/components/form/input/date/index.js +23 -15
- package/lib/commonjs/components/form/input/date/index.js.map +1 -1
- package/lib/commonjs/components/form/input/datetime/index.js +22 -18
- package/lib/commonjs/components/form/input/datetime/index.js.map +1 -1
- package/lib/commonjs/components/form/input/hooks/index.js +4 -4
- package/lib/commonjs/components/form/input/hooks/index.js.map +1 -1
- package/lib/commonjs/components/form/input/hooks/useInputStyles.js +111 -0
- package/lib/commonjs/components/form/input/hooks/useInputStyles.js.map +1 -0
- package/lib/commonjs/components/form/input/input.js +49 -11
- package/lib/commonjs/components/form/input/input.js.map +1 -1
- package/lib/commonjs/components/form/input/multipleSelect/index.js +162 -44
- package/lib/commonjs/components/form/input/multipleSelect/index.js.map +1 -1
- package/lib/commonjs/components/form/input/number/index.js +10 -5
- package/lib/commonjs/components/form/input/number/index.js.map +1 -1
- package/lib/commonjs/components/form/input/select/index.js +84 -173
- package/lib/commonjs/components/form/input/select/index.js.map +1 -1
- package/lib/commonjs/components/form/input/text/index.js +7 -5
- package/lib/commonjs/components/form/input/text/index.js.map +1 -1
- package/lib/commonjs/components/form/input/text/textarea.js +10 -5
- package/lib/commonjs/components/form/input/text/textarea.js.map +1 -1
- package/lib/commonjs/components/form/input/time/index.js +22 -13
- package/lib/commonjs/components/form/input/time/index.js.map +1 -1
- package/lib/commonjs/components/form/view/file.js +18 -4
- package/lib/commonjs/components/form/view/file.js.map +1 -1
- package/lib/commonjs/components/form/view/index.js +24 -23
- package/lib/commonjs/components/form/view/index.js.map +1 -1
- package/lib/commonjs/components/form/view/multipleSelect.js +38 -10
- package/lib/commonjs/components/form/view/multipleSelect.js.map +1 -1
- package/lib/commonjs/components/form/view/select.js +24 -9
- package/lib/commonjs/components/form/view/select.js.map +1 -1
- package/lib/commonjs/components/form/view/styles.js +21 -0
- package/lib/commonjs/components/form/view/styles.js.map +1 -0
- package/lib/commonjs/contexts/root.js +6 -0
- package/lib/commonjs/contexts/root.js.map +1 -1
- package/lib/module/components/form/Field.js +4 -2
- package/lib/module/components/form/Field.js.map +1 -1
- package/lib/module/components/form/Form.js +20 -7
- package/lib/module/components/form/Form.js.map +1 -1
- package/lib/module/components/form/input/Editable.js +24 -7
- package/lib/module/components/form/input/Editable.js.map +1 -1
- package/lib/module/components/form/input/common/InputClearButton.js +11 -6
- package/lib/module/components/form/input/common/InputClearButton.js.map +1 -1
- package/lib/module/components/form/input/date/index.js +23 -15
- package/lib/module/components/form/input/date/index.js.map +1 -1
- package/lib/module/components/form/input/datetime/index.js +22 -18
- package/lib/module/components/form/input/datetime/index.js.map +1 -1
- package/lib/module/components/form/input/hooks/index.js +1 -1
- package/lib/module/components/form/input/hooks/index.js.map +1 -1
- package/lib/module/components/form/input/hooks/useInputStyles.js +104 -0
- package/lib/module/components/form/input/hooks/useInputStyles.js.map +1 -0
- package/lib/module/components/form/input/input.js +51 -13
- package/lib/module/components/form/input/input.js.map +1 -1
- package/lib/module/components/form/input/multipleSelect/index.js +163 -46
- package/lib/module/components/form/input/multipleSelect/index.js.map +1 -1
- package/lib/module/components/form/input/number/index.js +10 -5
- package/lib/module/components/form/input/number/index.js.map +1 -1
- package/lib/module/components/form/input/select/index.js +86 -175
- package/lib/module/components/form/input/select/index.js.map +1 -1
- package/lib/module/components/form/input/text/index.js +7 -5
- package/lib/module/components/form/input/text/index.js.map +1 -1
- package/lib/module/components/form/input/text/textarea.js +11 -6
- package/lib/module/components/form/input/text/textarea.js.map +1 -1
- package/lib/module/components/form/input/time/index.js +22 -13
- package/lib/module/components/form/input/time/index.js.map +1 -1
- package/lib/module/components/form/view/file.js +18 -4
- package/lib/module/components/form/view/file.js.map +1 -1
- package/lib/module/components/form/view/index.js +25 -24
- package/lib/module/components/form/view/index.js.map +1 -1
- package/lib/module/components/form/view/multipleSelect.js +38 -10
- package/lib/module/components/form/view/multipleSelect.js.map +1 -1
- package/lib/module/components/form/view/select.js +23 -9
- package/lib/module/components/form/view/select.js.map +1 -1
- package/lib/module/components/form/view/styles.js +15 -0
- package/lib/module/components/form/view/styles.js.map +1 -0
- package/lib/module/contexts/root.js +6 -0
- package/lib/module/contexts/root.js.map +1 -1
- package/lib/typescript/components/form/Field.d.ts +2 -1
- package/lib/typescript/components/form/Field.d.ts.map +1 -1
- package/lib/typescript/components/form/Form.d.ts +7 -4
- package/lib/typescript/components/form/Form.d.ts.map +1 -1
- package/lib/typescript/components/form/input/Editable.d.ts +1 -1
- package/lib/typescript/components/form/input/Editable.d.ts.map +1 -1
- package/lib/typescript/components/form/input/common/InputClearButton.d.ts +4 -2
- package/lib/typescript/components/form/input/common/InputClearButton.d.ts.map +1 -1
- package/lib/typescript/components/form/input/date/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/datetime/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/hooks/index.d.ts +1 -1
- package/lib/typescript/components/form/input/hooks/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/hooks/useInputStyles.d.ts +61 -0
- package/lib/typescript/components/form/input/hooks/useInputStyles.d.ts.map +1 -0
- package/lib/typescript/components/form/input/input.d.ts.map +1 -1
- package/lib/typescript/components/form/input/multipleSelect/index.d.ts +6 -1
- package/lib/typescript/components/form/input/multipleSelect/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/number/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/select/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/text/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/text/textarea.d.ts.map +1 -1
- package/lib/typescript/components/form/input/time/index.d.ts.map +1 -1
- package/lib/typescript/components/form/view/file.d.ts +3 -1
- package/lib/typescript/components/form/view/file.d.ts.map +1 -1
- package/lib/typescript/components/form/view/index.d.ts +3 -1
- package/lib/typescript/components/form/view/index.d.ts.map +1 -1
- package/lib/typescript/components/form/view/multipleSelect.d.ts +5 -3
- package/lib/typescript/components/form/view/multipleSelect.d.ts.map +1 -1
- package/lib/typescript/components/form/view/select.d.ts +4 -1
- package/lib/typescript/components/form/view/select.d.ts.map +1 -1
- package/lib/typescript/components/form/view/styles.d.ts +14 -0
- package/lib/typescript/components/form/view/styles.d.ts.map +1 -0
- package/lib/typescript/contexts/root.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/components/form/Field.tsx +3 -2
- package/src/components/form/Form.tsx +41 -11
- package/src/components/form/input/Editable.tsx +23 -6
- package/src/components/form/input/common/InputClearButton.tsx +12 -4
- package/src/components/form/input/date/index.tsx +23 -12
- package/src/components/form/input/datetime/index.tsx +27 -14
- package/src/components/form/input/hooks/index.ts +1 -1
- package/src/components/form/input/hooks/useInputStyles.ts +124 -0
- package/src/components/form/input/input.tsx +57 -25
- package/src/components/form/input/multipleSelect/index.tsx +189 -60
- package/src/components/form/input/number/index.tsx +5 -4
- package/src/components/form/input/select/index.tsx +88 -166
- package/src/components/form/input/text/index.tsx +4 -9
- package/src/components/form/input/text/textarea.tsx +18 -16
- package/src/components/form/input/time/index.tsx +31 -11
- package/src/components/form/view/file.tsx +19 -4
- package/src/components/form/view/index.tsx +36 -22
- package/src/components/form/view/multipleSelect.tsx +42 -15
- package/src/components/form/view/select.tsx +28 -11
- package/src/components/form/view/styles.ts +15 -0
- package/src/contexts/root.tsx +7 -0
- package/lib/commonjs/components/form/input/hooks/useInputStyle.js +0 -50
- package/lib/commonjs/components/form/input/hooks/useInputStyle.js.map +0 -1
- package/lib/commonjs/components/form/input/styles.js +0 -17
- package/lib/commonjs/components/form/input/styles.js.map +0 -1
- package/lib/module/components/form/input/hooks/useInputStyle.js +0 -43
- package/lib/module/components/form/input/hooks/useInputStyle.js.map +0 -1
- package/lib/module/components/form/input/styles.js +0 -11
- package/lib/module/components/form/input/styles.js.map +0 -1
- package/lib/typescript/components/form/input/hooks/useInputStyle.d.ts +0 -9
- package/lib/typescript/components/form/input/hooks/useInputStyle.d.ts.map +0 -1
- package/lib/typescript/components/form/input/styles.d.ts +0 -10
- package/lib/typescript/components/form/input/styles.d.ts.map +0 -1
- package/src/components/form/input/hooks/useInputStyle.ts +0 -40
- package/src/components/form/input/styles.ts +0 -11
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { InputSize } from '@chem-po/core'
|
|
1
2
|
import { MultipleSelectField, useColorMode } from '@chem-po/react'
|
|
3
|
+
import { useMemo } from 'react'
|
|
2
4
|
import React, { StyleSheet, Text, View, ViewStyle } from 'react-native'
|
|
5
|
+
import { useInputStyles } from '../input/hooks/useInputStyles'
|
|
6
|
+
import { SelectedOptionContainer } from '../input/multipleSelect'
|
|
7
|
+
import { DefaultRenderOption } from './select'
|
|
3
8
|
|
|
4
9
|
const styles = StyleSheet.create({
|
|
5
10
|
container: {
|
|
@@ -13,41 +18,63 @@ const styles = StyleSheet.create({
|
|
|
13
18
|
opacity: 0.7,
|
|
14
19
|
fontWeight: '600',
|
|
15
20
|
},
|
|
16
|
-
|
|
21
|
+
optionsContainer: {
|
|
17
22
|
padding: 2,
|
|
23
|
+
flexDirection: 'row',
|
|
24
|
+
flexWrap: 'wrap',
|
|
25
|
+
},
|
|
26
|
+
optionContainer: {
|
|
27
|
+
marginTop: 2,
|
|
28
|
+
marginHorizontal: 2,
|
|
18
29
|
},
|
|
19
30
|
emptyText: {
|
|
20
31
|
opacity: 0.6,
|
|
21
32
|
},
|
|
22
33
|
})
|
|
23
34
|
|
|
24
|
-
export const MultipleSelectFieldView = ({
|
|
35
|
+
export const MultipleSelectFieldView = <F extends MultipleSelectField>({
|
|
25
36
|
field,
|
|
26
37
|
value,
|
|
27
38
|
noLabel,
|
|
39
|
+
size: sizeProp,
|
|
28
40
|
style,
|
|
29
41
|
}: {
|
|
30
|
-
field:
|
|
31
|
-
value
|
|
42
|
+
field: F
|
|
43
|
+
value?: F['defaultValue']
|
|
32
44
|
noLabel?: boolean
|
|
45
|
+
size?: InputSize
|
|
33
46
|
style?: ViewStyle
|
|
34
47
|
}) => {
|
|
35
|
-
const { placeholder, renderOption:
|
|
48
|
+
const { placeholder, renderOption: customRender, options } = field
|
|
49
|
+
const selectedOptions = options.filter(o => value?.includes(o.value))
|
|
36
50
|
const colorMode = useColorMode()
|
|
37
|
-
|
|
51
|
+
const { size, container: inputStyles, text } = useInputStyles(undefined, field.size, sizeProp)
|
|
52
|
+
const selectedOptionStyle = useMemo<ViewStyle>(() => {
|
|
53
|
+
return {
|
|
54
|
+
paddingHorizontal: inputStyles.paddingHorizontal,
|
|
55
|
+
paddingVertical: inputStyles.paddingVertical,
|
|
56
|
+
}
|
|
57
|
+
}, [inputStyles])
|
|
58
|
+
const RenderOption = useMemo(() => customRender ?? DefaultRenderOption, [customRender])
|
|
38
59
|
return (
|
|
39
60
|
<View style={[styles.container, style]}>
|
|
40
61
|
{!noLabel && <Text style={styles.label}>{placeholder}</Text>}
|
|
41
|
-
{value ? (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
62
|
+
{value?.length ? (
|
|
63
|
+
<View style={styles.optionsContainer}>
|
|
64
|
+
{selectedOptions.map(o => (
|
|
65
|
+
<SelectedOptionContainer key={o.value} style={selectedOptionStyle}>
|
|
66
|
+
<RenderOption
|
|
67
|
+
option={o}
|
|
68
|
+
value={o.value}
|
|
69
|
+
colorMode={colorMode}
|
|
70
|
+
isSelected
|
|
71
|
+
size={size}
|
|
72
|
+
/>
|
|
73
|
+
</SelectedOptionContainer>
|
|
74
|
+
))}
|
|
75
|
+
</View>
|
|
49
76
|
) : (
|
|
50
|
-
<Text style={styles.emptyText}>None</Text>
|
|
77
|
+
<Text style={[styles.emptyText, text]}>None</Text>
|
|
51
78
|
)}
|
|
52
79
|
</View>
|
|
53
80
|
)
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { RenderSelectOptionProps } from '@chem-po/core'
|
|
1
|
+
import { BaseSelectOption, InputSize, RenderSelectOptionProps } from '@chem-po/core'
|
|
2
2
|
import { SelectField, useColorMode, usePlaceholderColor } from '@chem-po/react'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { StyleSheet, Text, View, ViewStyle } from 'react-native'
|
|
5
5
|
import { Txt } from '../../text'
|
|
6
|
+
import { useInputStyles } from '../input/hooks/useInputStyles'
|
|
7
|
+
import { inputViewStyles } from './styles'
|
|
6
8
|
|
|
7
9
|
const styles = StyleSheet.create({
|
|
8
10
|
container: {
|
|
@@ -15,10 +17,13 @@ const styles = StyleSheet.create({
|
|
|
15
17
|
},
|
|
16
18
|
})
|
|
17
19
|
|
|
18
|
-
const DefaultRenderOption = <
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
export const DefaultRenderOption = <
|
|
21
|
+
Value = string,
|
|
22
|
+
Option extends BaseSelectOption<Value> = BaseSelectOption<Value>,
|
|
23
|
+
>({
|
|
24
|
+
option,
|
|
25
|
+
}: RenderSelectOptionProps<Value, Option>) => {
|
|
26
|
+
return <Txt style={inputViewStyles.value}>{option.label}</Txt>
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
export const SelectFieldView = ({
|
|
@@ -26,24 +31,36 @@ export const SelectFieldView = ({
|
|
|
26
31
|
value,
|
|
27
32
|
noLabel,
|
|
28
33
|
style,
|
|
34
|
+
size: sizeProp,
|
|
29
35
|
}: {
|
|
30
36
|
field: SelectField
|
|
31
37
|
value: any
|
|
32
38
|
noLabel?: boolean
|
|
33
39
|
style?: ViewStyle
|
|
40
|
+
size?: InputSize
|
|
34
41
|
}) => {
|
|
35
42
|
const { placeholder, renderOption: customRender } = field
|
|
36
43
|
const colorMode = useColorMode()
|
|
37
44
|
const placeholderColor = usePlaceholderColor()
|
|
45
|
+
const { size, text } = useInputStyles(false, field.size, sizeProp)
|
|
46
|
+
const selectedOption = field.options.find(o => o.value === value)
|
|
38
47
|
const RenderOption = customRender ?? DefaultRenderOption
|
|
39
48
|
return (
|
|
40
49
|
<View style={[styles.container, style]}>
|
|
41
|
-
{!noLabel &&
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
{!noLabel && (
|
|
51
|
+
<Text style={[styles.label, text, { color: placeholderColor }]}>{placeholder}</Text>
|
|
52
|
+
)}
|
|
53
|
+
{selectedOption ? (
|
|
54
|
+
<RenderOption
|
|
55
|
+
value={selectedOption.value}
|
|
56
|
+
option={selectedOption}
|
|
57
|
+
colorMode={colorMode}
|
|
58
|
+
isSelected={true}
|
|
59
|
+
size={size}
|
|
60
|
+
/>
|
|
61
|
+
) : (
|
|
62
|
+
<Txt style={inputViewStyles.valueEmpty}>None</Txt>
|
|
63
|
+
)}
|
|
47
64
|
</View>
|
|
48
65
|
)
|
|
49
66
|
}
|
package/src/contexts/root.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BackendAdapterInterface, ColorMode, Theme } from '@chem-po/core'
|
|
2
2
|
import { ChempoProps, ChempoProvider } from '@chem-po/react'
|
|
3
3
|
import React, { PropsWithChildren, useMemo } from 'react'
|
|
4
|
+
import { StyleSheet } from 'react-native'
|
|
4
5
|
import { NotifierWrapper } from 'react-native-notifier'
|
|
5
6
|
import { en, registerTranslation } from 'react-native-paper-dates'
|
|
6
7
|
import { nativeToast } from '../constants/toast'
|
|
@@ -37,3 +38,9 @@ export const ChempoNativeProvider = ({
|
|
|
37
38
|
</NotifierWrapper>
|
|
38
39
|
)
|
|
39
40
|
}
|
|
41
|
+
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
notifier: {
|
|
44
|
+
flex: 1,
|
|
45
|
+
},
|
|
46
|
+
})
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useInputStyle = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
const inputPaddingY = {
|
|
10
|
-
xs: 4,
|
|
11
|
-
// 0.25rem * 16
|
|
12
|
-
sm: 6,
|
|
13
|
-
// 0.35rem * 16
|
|
14
|
-
md: 8,
|
|
15
|
-
// 0.5rem * 16
|
|
16
|
-
lg: 8,
|
|
17
|
-
// 0.5rem * 16
|
|
18
|
-
xl: 8 // 0.5rem * 16
|
|
19
|
-
};
|
|
20
|
-
const inputPaddingX = {
|
|
21
|
-
xs: 8,
|
|
22
|
-
// 0.5rem * 16
|
|
23
|
-
sm: 12,
|
|
24
|
-
// 0.75rem * 16
|
|
25
|
-
md: 12,
|
|
26
|
-
// 0.75rem * 16
|
|
27
|
-
lg: 12,
|
|
28
|
-
// 0.75rem * 16
|
|
29
|
-
xl: 12 // 0.75rem * 16
|
|
30
|
-
};
|
|
31
|
-
const fontSize = {
|
|
32
|
-
xs: 12,
|
|
33
|
-
// 0.75rem * 16
|
|
34
|
-
sm: 14,
|
|
35
|
-
// 0.875rem * 16
|
|
36
|
-
md: 16,
|
|
37
|
-
// 1rem * 16
|
|
38
|
-
lg: 18,
|
|
39
|
-
// 1.125rem * 16
|
|
40
|
-
xl: 20 // 1.25rem * 16
|
|
41
|
-
};
|
|
42
|
-
const useInputStyle = size => (0, _react.useMemo)(() => _reactNative.StyleSheet.create({
|
|
43
|
-
style: {
|
|
44
|
-
paddingVertical: inputPaddingY[size ?? 'md'],
|
|
45
|
-
paddingHorizontal: inputPaddingX[size ?? 'md'],
|
|
46
|
-
fontSize: fontSize[size ?? 'md']
|
|
47
|
-
}
|
|
48
|
-
}), [size]);
|
|
49
|
-
exports.useInputStyle = useInputStyle;
|
|
50
|
-
//# sourceMappingURL=useInputStyle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","inputPaddingY","xs","sm","md","lg","xl","inputPaddingX","fontSize","useInputStyle","size","useMemo","StyleSheet","create","style","paddingVertical","paddingHorizontal","exports"],"sourceRoot":"..\\..\\..\\..\\..\\..\\src","sources":["components/form/input/hooks/useInputStyle.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,MAAME,aAAwC,GAAG;EAC/CC,EAAE,EAAE,CAAC;EAAE;EACPC,EAAE,EAAE,CAAC;EAAE;EACPC,EAAE,EAAE,CAAC;EAAE;EACPC,EAAE,EAAE,CAAC;EAAE;EACPC,EAAE,EAAE,CAAC,CAAE;AACT,CAAC;AAED,MAAMC,aAAwC,GAAG;EAC/CL,EAAE,EAAE,CAAC;EAAE;EACPC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE,CAAE;AACV,CAAC;AAED,MAAME,QAAmC,GAAG;EAC1CN,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE,CAAE;AACV,CAAC;AAEM,MAAMG,aAAa,GAAIC,IAAgB,IAC5C,IAAAC,cAAO,EACL,MACEC,uBAAU,CAACC,MAAM,CAAC;EAChBC,KAAK,EAAE;IACLC,eAAe,EAAEd,aAAa,CAACS,IAAI,IAAI,IAAI,CAAC;IAC5CM,iBAAiB,EAAET,aAAa,CAACG,IAAI,IAAI,IAAI,CAAC;IAC9CF,QAAQ,EAAEA,QAAQ,CAACE,IAAI,IAAI,IAAI;EACjC;AACF,CAAC,CAAC,EACJ,CAACA,IAAI,CACP,CAAC;AAAAO,OAAA,CAAAR,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.inputStyles = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
const inputStyles = exports.inputStyles = _reactNative.StyleSheet.create({
|
|
9
|
-
input: {
|
|
10
|
-
width: '100%',
|
|
11
|
-
paddingHorizontal: 6,
|
|
12
|
-
fontSize: 16,
|
|
13
|
-
paddingVertical: 4,
|
|
14
|
-
outlineWidth: 0
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","inputStyles","exports","StyleSheet","create","input","width","paddingHorizontal","fontSize","paddingVertical","outlineWidth"],"sourceRoot":"..\\..\\..\\..\\..\\src","sources":["components/form/input/styles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAGE,uBAAU,CAACC,MAAM,CAAC;EAC3CC,KAAK,EAAE;IACLC,KAAK,EAAE,MAAM;IACbC,iBAAiB,EAAE,CAAC;IACpBC,QAAQ,EAAE,EAAE;IACZC,eAAe,EAAE,CAAC;IAClBC,YAAY,EAAE;EAChB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { StyleSheet } from 'react-native';
|
|
3
|
-
const inputPaddingY = {
|
|
4
|
-
xs: 4,
|
|
5
|
-
// 0.25rem * 16
|
|
6
|
-
sm: 6,
|
|
7
|
-
// 0.35rem * 16
|
|
8
|
-
md: 8,
|
|
9
|
-
// 0.5rem * 16
|
|
10
|
-
lg: 8,
|
|
11
|
-
// 0.5rem * 16
|
|
12
|
-
xl: 8 // 0.5rem * 16
|
|
13
|
-
};
|
|
14
|
-
const inputPaddingX = {
|
|
15
|
-
xs: 8,
|
|
16
|
-
// 0.5rem * 16
|
|
17
|
-
sm: 12,
|
|
18
|
-
// 0.75rem * 16
|
|
19
|
-
md: 12,
|
|
20
|
-
// 0.75rem * 16
|
|
21
|
-
lg: 12,
|
|
22
|
-
// 0.75rem * 16
|
|
23
|
-
xl: 12 // 0.75rem * 16
|
|
24
|
-
};
|
|
25
|
-
const fontSize = {
|
|
26
|
-
xs: 12,
|
|
27
|
-
// 0.75rem * 16
|
|
28
|
-
sm: 14,
|
|
29
|
-
// 0.875rem * 16
|
|
30
|
-
md: 16,
|
|
31
|
-
// 1rem * 16
|
|
32
|
-
lg: 18,
|
|
33
|
-
// 1.125rem * 16
|
|
34
|
-
xl: 20 // 1.25rem * 16
|
|
35
|
-
};
|
|
36
|
-
export const useInputStyle = size => useMemo(() => StyleSheet.create({
|
|
37
|
-
style: {
|
|
38
|
-
paddingVertical: inputPaddingY[size ?? 'md'],
|
|
39
|
-
paddingHorizontal: inputPaddingX[size ?? 'md'],
|
|
40
|
-
fontSize: fontSize[size ?? 'md']
|
|
41
|
-
}
|
|
42
|
-
}), [size]);
|
|
43
|
-
//# sourceMappingURL=useInputStyle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","StyleSheet","inputPaddingY","xs","sm","md","lg","xl","inputPaddingX","fontSize","useInputStyle","size","create","style","paddingVertical","paddingHorizontal"],"sourceRoot":"..\\..\\..\\..\\..\\..\\src","sources":["components/form/input/hooks/useInputStyle.ts"],"mappings":"AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AAEzC,MAAMC,aAAwC,GAAG;EAC/CC,EAAE,EAAE,CAAC;EAAE;EACPC,EAAE,EAAE,CAAC;EAAE;EACPC,EAAE,EAAE,CAAC;EAAE;EACPC,EAAE,EAAE,CAAC;EAAE;EACPC,EAAE,EAAE,CAAC,CAAE;AACT,CAAC;AAED,MAAMC,aAAwC,GAAG;EAC/CL,EAAE,EAAE,CAAC;EAAE;EACPC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE,CAAE;AACV,CAAC;AAED,MAAME,QAAmC,GAAG;EAC1CN,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE;EAAE;EACRC,EAAE,EAAE,EAAE,CAAE;AACV,CAAC;AAED,OAAO,MAAMG,aAAa,GAAIC,IAAgB,IAC5CX,OAAO,CACL,MACEC,UAAU,CAACW,MAAM,CAAC;EAChBC,KAAK,EAAE;IACLC,eAAe,EAAEZ,aAAa,CAACS,IAAI,IAAI,IAAI,CAAC;IAC5CI,iBAAiB,EAAEP,aAAa,CAACG,IAAI,IAAI,IAAI,CAAC;IAC9CF,QAAQ,EAAEA,QAAQ,CAACE,IAAI,IAAI,IAAI;EACjC;AACF,CAAC,CAAC,EACJ,CAACA,IAAI,CACP,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","inputStyles","create","input","width","paddingHorizontal","fontSize","paddingVertical","outlineWidth"],"sourceRoot":"..\\..\\..\\..\\..\\src","sources":["components/form/input/styles.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,OAAO,MAAMC,WAAW,GAAGD,UAAU,CAACE,MAAM,CAAC;EAC3CC,KAAK,EAAE;IACLC,KAAK,EAAE,MAAM;IACbC,iBAAiB,EAAE,CAAC;IACpBC,QAAQ,EAAE,EAAE;IACZC,eAAe,EAAE,CAAC;IAClBC,YAAY,EAAE;EAChB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInputStyle.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/hooks/useInputStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AA4B1C,eAAO,MAAM,aAAa,GAAI,OAAO,SAAS;;;;;;CAW3C,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/input/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;;;;;;CAQtB,CAAA"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { InputSize } from '@chem-po/react'
|
|
2
|
-
import { useMemo } from 'react'
|
|
3
|
-
import { StyleSheet } from 'react-native'
|
|
4
|
-
|
|
5
|
-
const inputPaddingY: Record<InputSize, number> = {
|
|
6
|
-
xs: 4, // 0.25rem * 16
|
|
7
|
-
sm: 6, // 0.35rem * 16
|
|
8
|
-
md: 8, // 0.5rem * 16
|
|
9
|
-
lg: 8, // 0.5rem * 16
|
|
10
|
-
xl: 8, // 0.5rem * 16
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const inputPaddingX: Record<InputSize, number> = {
|
|
14
|
-
xs: 8, // 0.5rem * 16
|
|
15
|
-
sm: 12, // 0.75rem * 16
|
|
16
|
-
md: 12, // 0.75rem * 16
|
|
17
|
-
lg: 12, // 0.75rem * 16
|
|
18
|
-
xl: 12, // 0.75rem * 16
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const fontSize: Record<InputSize, number> = {
|
|
22
|
-
xs: 12, // 0.75rem * 16
|
|
23
|
-
sm: 14, // 0.875rem * 16
|
|
24
|
-
md: 16, // 1rem * 16
|
|
25
|
-
lg: 18, // 1.125rem * 16
|
|
26
|
-
xl: 20, // 1.25rem * 16
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const useInputStyle = (size?: InputSize) =>
|
|
30
|
-
useMemo(
|
|
31
|
-
() =>
|
|
32
|
-
StyleSheet.create({
|
|
33
|
-
style: {
|
|
34
|
-
paddingVertical: inputPaddingY[size ?? 'md'],
|
|
35
|
-
paddingHorizontal: inputPaddingX[size ?? 'md'],
|
|
36
|
-
fontSize: fontSize[size ?? 'md'],
|
|
37
|
-
},
|
|
38
|
-
}),
|
|
39
|
-
[size],
|
|
40
|
-
)
|