@chem-po/react-native 0.0.15 → 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.
Files changed (147) hide show
  1. package/lib/commonjs/components/form/Field.js +4 -2
  2. package/lib/commonjs/components/form/Field.js.map +1 -1
  3. package/lib/commonjs/components/form/Form.js +20 -7
  4. package/lib/commonjs/components/form/Form.js.map +1 -1
  5. package/lib/commonjs/components/form/input/Editable.js +24 -7
  6. package/lib/commonjs/components/form/input/Editable.js.map +1 -1
  7. package/lib/commonjs/components/form/input/common/InputClearButton.js +10 -5
  8. package/lib/commonjs/components/form/input/common/InputClearButton.js.map +1 -1
  9. package/lib/commonjs/components/form/input/date/index.js +23 -15
  10. package/lib/commonjs/components/form/input/date/index.js.map +1 -1
  11. package/lib/commonjs/components/form/input/datetime/index.js +22 -18
  12. package/lib/commonjs/components/form/input/datetime/index.js.map +1 -1
  13. package/lib/commonjs/components/form/input/hooks/index.js +4 -4
  14. package/lib/commonjs/components/form/input/hooks/index.js.map +1 -1
  15. package/lib/commonjs/components/form/input/hooks/useInputStyles.js +111 -0
  16. package/lib/commonjs/components/form/input/hooks/useInputStyles.js.map +1 -0
  17. package/lib/commonjs/components/form/input/input.js +49 -11
  18. package/lib/commonjs/components/form/input/input.js.map +1 -1
  19. package/lib/commonjs/components/form/input/multipleSelect/index.js +162 -44
  20. package/lib/commonjs/components/form/input/multipleSelect/index.js.map +1 -1
  21. package/lib/commonjs/components/form/input/number/index.js +10 -5
  22. package/lib/commonjs/components/form/input/number/index.js.map +1 -1
  23. package/lib/commonjs/components/form/input/select/index.js +84 -173
  24. package/lib/commonjs/components/form/input/select/index.js.map +1 -1
  25. package/lib/commonjs/components/form/input/text/index.js +7 -5
  26. package/lib/commonjs/components/form/input/text/index.js.map +1 -1
  27. package/lib/commonjs/components/form/input/text/textarea.js +10 -5
  28. package/lib/commonjs/components/form/input/text/textarea.js.map +1 -1
  29. package/lib/commonjs/components/form/input/time/index.js +22 -13
  30. package/lib/commonjs/components/form/input/time/index.js.map +1 -1
  31. package/lib/commonjs/components/form/view/file.js +18 -4
  32. package/lib/commonjs/components/form/view/file.js.map +1 -1
  33. package/lib/commonjs/components/form/view/index.js +24 -23
  34. package/lib/commonjs/components/form/view/index.js.map +1 -1
  35. package/lib/commonjs/components/form/view/multipleSelect.js +38 -10
  36. package/lib/commonjs/components/form/view/multipleSelect.js.map +1 -1
  37. package/lib/commonjs/components/form/view/select.js +24 -9
  38. package/lib/commonjs/components/form/view/select.js.map +1 -1
  39. package/lib/commonjs/components/form/view/styles.js +21 -0
  40. package/lib/commonjs/components/form/view/styles.js.map +1 -0
  41. package/lib/module/components/form/Field.js +4 -2
  42. package/lib/module/components/form/Field.js.map +1 -1
  43. package/lib/module/components/form/Form.js +20 -7
  44. package/lib/module/components/form/Form.js.map +1 -1
  45. package/lib/module/components/form/input/Editable.js +24 -7
  46. package/lib/module/components/form/input/Editable.js.map +1 -1
  47. package/lib/module/components/form/input/common/InputClearButton.js +11 -6
  48. package/lib/module/components/form/input/common/InputClearButton.js.map +1 -1
  49. package/lib/module/components/form/input/date/index.js +23 -15
  50. package/lib/module/components/form/input/date/index.js.map +1 -1
  51. package/lib/module/components/form/input/datetime/index.js +22 -18
  52. package/lib/module/components/form/input/datetime/index.js.map +1 -1
  53. package/lib/module/components/form/input/hooks/index.js +1 -1
  54. package/lib/module/components/form/input/hooks/index.js.map +1 -1
  55. package/lib/module/components/form/input/hooks/useInputStyles.js +104 -0
  56. package/lib/module/components/form/input/hooks/useInputStyles.js.map +1 -0
  57. package/lib/module/components/form/input/input.js +51 -13
  58. package/lib/module/components/form/input/input.js.map +1 -1
  59. package/lib/module/components/form/input/multipleSelect/index.js +163 -46
  60. package/lib/module/components/form/input/multipleSelect/index.js.map +1 -1
  61. package/lib/module/components/form/input/number/index.js +10 -5
  62. package/lib/module/components/form/input/number/index.js.map +1 -1
  63. package/lib/module/components/form/input/select/index.js +86 -175
  64. package/lib/module/components/form/input/select/index.js.map +1 -1
  65. package/lib/module/components/form/input/text/index.js +7 -5
  66. package/lib/module/components/form/input/text/index.js.map +1 -1
  67. package/lib/module/components/form/input/text/textarea.js +11 -6
  68. package/lib/module/components/form/input/text/textarea.js.map +1 -1
  69. package/lib/module/components/form/input/time/index.js +22 -13
  70. package/lib/module/components/form/input/time/index.js.map +1 -1
  71. package/lib/module/components/form/view/file.js +18 -4
  72. package/lib/module/components/form/view/file.js.map +1 -1
  73. package/lib/module/components/form/view/index.js +25 -24
  74. package/lib/module/components/form/view/index.js.map +1 -1
  75. package/lib/module/components/form/view/multipleSelect.js +38 -10
  76. package/lib/module/components/form/view/multipleSelect.js.map +1 -1
  77. package/lib/module/components/form/view/select.js +23 -9
  78. package/lib/module/components/form/view/select.js.map +1 -1
  79. package/lib/module/components/form/view/styles.js +15 -0
  80. package/lib/module/components/form/view/styles.js.map +1 -0
  81. package/lib/typescript/components/form/Field.d.ts +2 -1
  82. package/lib/typescript/components/form/Field.d.ts.map +1 -1
  83. package/lib/typescript/components/form/Form.d.ts +7 -4
  84. package/lib/typescript/components/form/Form.d.ts.map +1 -1
  85. package/lib/typescript/components/form/input/Editable.d.ts +1 -1
  86. package/lib/typescript/components/form/input/Editable.d.ts.map +1 -1
  87. package/lib/typescript/components/form/input/common/InputClearButton.d.ts +4 -2
  88. package/lib/typescript/components/form/input/common/InputClearButton.d.ts.map +1 -1
  89. package/lib/typescript/components/form/input/date/index.d.ts.map +1 -1
  90. package/lib/typescript/components/form/input/datetime/index.d.ts.map +1 -1
  91. package/lib/typescript/components/form/input/hooks/index.d.ts +1 -1
  92. package/lib/typescript/components/form/input/hooks/index.d.ts.map +1 -1
  93. package/lib/typescript/components/form/input/hooks/useInputStyles.d.ts +61 -0
  94. package/lib/typescript/components/form/input/hooks/useInputStyles.d.ts.map +1 -0
  95. package/lib/typescript/components/form/input/input.d.ts.map +1 -1
  96. package/lib/typescript/components/form/input/multipleSelect/index.d.ts +6 -1
  97. package/lib/typescript/components/form/input/multipleSelect/index.d.ts.map +1 -1
  98. package/lib/typescript/components/form/input/number/index.d.ts.map +1 -1
  99. package/lib/typescript/components/form/input/select/index.d.ts.map +1 -1
  100. package/lib/typescript/components/form/input/text/index.d.ts.map +1 -1
  101. package/lib/typescript/components/form/input/text/textarea.d.ts.map +1 -1
  102. package/lib/typescript/components/form/input/time/index.d.ts.map +1 -1
  103. package/lib/typescript/components/form/view/file.d.ts +3 -1
  104. package/lib/typescript/components/form/view/file.d.ts.map +1 -1
  105. package/lib/typescript/components/form/view/index.d.ts +3 -1
  106. package/lib/typescript/components/form/view/index.d.ts.map +1 -1
  107. package/lib/typescript/components/form/view/multipleSelect.d.ts +5 -3
  108. package/lib/typescript/components/form/view/multipleSelect.d.ts.map +1 -1
  109. package/lib/typescript/components/form/view/select.d.ts +4 -1
  110. package/lib/typescript/components/form/view/select.d.ts.map +1 -1
  111. package/lib/typescript/components/form/view/styles.d.ts +14 -0
  112. package/lib/typescript/components/form/view/styles.d.ts.map +1 -0
  113. package/package.json +5 -4
  114. package/src/components/form/Field.tsx +3 -2
  115. package/src/components/form/Form.tsx +41 -11
  116. package/src/components/form/input/Editable.tsx +23 -6
  117. package/src/components/form/input/common/InputClearButton.tsx +12 -4
  118. package/src/components/form/input/date/index.tsx +23 -12
  119. package/src/components/form/input/datetime/index.tsx +27 -14
  120. package/src/components/form/input/hooks/index.ts +1 -1
  121. package/src/components/form/input/hooks/useInputStyles.ts +124 -0
  122. package/src/components/form/input/input.tsx +57 -25
  123. package/src/components/form/input/multipleSelect/index.tsx +189 -60
  124. package/src/components/form/input/number/index.tsx +5 -4
  125. package/src/components/form/input/select/index.tsx +88 -166
  126. package/src/components/form/input/text/index.tsx +4 -9
  127. package/src/components/form/input/text/textarea.tsx +18 -16
  128. package/src/components/form/input/time/index.tsx +31 -11
  129. package/src/components/form/view/file.tsx +19 -4
  130. package/src/components/form/view/index.tsx +36 -22
  131. package/src/components/form/view/multipleSelect.tsx +42 -15
  132. package/src/components/form/view/select.tsx +28 -11
  133. package/src/components/form/view/styles.ts +15 -0
  134. package/lib/commonjs/components/form/input/hooks/useInputStyle.js +0 -50
  135. package/lib/commonjs/components/form/input/hooks/useInputStyle.js.map +0 -1
  136. package/lib/commonjs/components/form/input/styles.js +0 -17
  137. package/lib/commonjs/components/form/input/styles.js.map +0 -1
  138. package/lib/module/components/form/input/hooks/useInputStyle.js +0 -43
  139. package/lib/module/components/form/input/hooks/useInputStyle.js.map +0 -1
  140. package/lib/module/components/form/input/styles.js +0 -11
  141. package/lib/module/components/form/input/styles.js.map +0 -1
  142. package/lib/typescript/components/form/input/hooks/useInputStyle.d.ts +0 -9
  143. package/lib/typescript/components/form/input/hooks/useInputStyle.d.ts.map +0 -1
  144. package/lib/typescript/components/form/input/styles.d.ts +0 -10
  145. package/lib/typescript/components/form/input/styles.d.ts.map +0 -1
  146. package/src/components/form/input/hooks/useInputStyle.ts +0 -40
  147. 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
- optionContainer: {
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: MultipleSelectField
31
- value: any[]
42
+ field: F
43
+ value?: F['defaultValue']
32
44
  noLabel?: boolean
45
+ size?: InputSize
33
46
  style?: ViewStyle
34
47
  }) => {
35
- const { placeholder, renderOption: RenderOption } = field
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
- value.map((v: any) => (
43
- <View
44
- // key={getOptionKey ? getOptionKey(v) : v}
45
- style={styles.optionContainer}>
46
- <RenderOption value={v} colorMode={colorMode} isSelected={true} />
47
- </View>
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 = <T extends SelectField>({
19
- value,
20
- }: RenderSelectOptionProps<T['defaultValue']>) => {
21
- return <Txt>{typeof value === 'string' ? value : JSON.stringify(value)}</Txt>
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 && <Text style={[styles.label, { color: placeholderColor }]}>{placeholder}</Text>}
42
- <RenderOption
43
- value={value && value !== '' ? value : 'None'}
44
- colorMode={colorMode}
45
- isSelected={true}
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
  }
@@ -0,0 +1,15 @@
1
+ import { StyleSheet } from 'react-native'
2
+
3
+ export const inputViewStyles = StyleSheet.create({
4
+ label: {
5
+ paddingRight: 8,
6
+ opacity: 0.7,
7
+ fontWeight: '600',
8
+ },
9
+ value: {
10
+ opacity: 1,
11
+ },
12
+ valueEmpty: {
13
+ opacity: 0.6,
14
+ },
15
+ })
@@ -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,11 +0,0 @@
1
- import { StyleSheet } from 'react-native';
2
- export const inputStyles = StyleSheet.create({
3
- input: {
4
- width: '100%',
5
- paddingHorizontal: 6,
6
- fontSize: 16,
7
- paddingVertical: 4,
8
- outlineWidth: 0
9
- }
10
- });
11
- //# sourceMappingURL=styles.js.map
@@ -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,9 +0,0 @@
1
- import { InputSize } from '@chem-po/react';
2
- export declare const useInputStyle: (size?: InputSize) => {
3
- style: {
4
- paddingVertical: number;
5
- paddingHorizontal: number;
6
- fontSize: number;
7
- };
8
- };
9
- //# sourceMappingURL=useInputStyle.d.ts.map
@@ -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,10 +0,0 @@
1
- export declare const inputStyles: {
2
- input: {
3
- width: "100%";
4
- paddingHorizontal: number;
5
- fontSize: number;
6
- paddingVertical: number;
7
- outlineWidth: number;
8
- };
9
- };
10
- //# sourceMappingURL=styles.d.ts.map
@@ -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
- )
@@ -1,11 +0,0 @@
1
- import { StyleSheet } from 'react-native'
2
-
3
- export const inputStyles = StyleSheet.create({
4
- input: {
5
- width: '100%',
6
- paddingHorizontal: 6,
7
- fontSize: 16,
8
- paddingVertical: 4,
9
- outlineWidth: 0,
10
- },
11
- })