@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.
Files changed (87) hide show
  1. package/dist/components/Button/index.js +1 -1
  2. package/dist/components/Button/index.js.map +1 -1
  3. package/dist/components/Button/styles.js +1 -4
  4. package/dist/components/Button/styles.js.map +1 -1
  5. package/dist/components/Checkbox/index.js +19 -16
  6. package/dist/components/Checkbox/index.js.map +1 -1
  7. package/dist/components/Checkbox/styles.d.ts +2 -1
  8. package/dist/components/Checkbox/styles.js +3 -6
  9. package/dist/components/Checkbox/styles.js.map +1 -1
  10. package/dist/components/ContentView/index.d.ts +1 -1
  11. package/dist/components/ContentView/index.js +2 -2
  12. package/dist/components/ContentView/index.js.map +1 -1
  13. package/dist/components/ContentView/styles.js +3 -3
  14. package/dist/components/ContentView/styles.js.map +1 -1
  15. package/dist/components/EmptyPlaceholder/index.d.ts +1 -1
  16. package/dist/components/FileInput/index.d.ts +2 -11
  17. package/dist/components/FileInput/index.js +2 -30
  18. package/dist/components/FileInput/index.js.map +1 -1
  19. package/dist/components/InputLabel/index.d.ts +12 -0
  20. package/dist/components/InputLabel/index.js +62 -0
  21. package/dist/components/InputLabel/index.js.map +1 -0
  22. package/dist/components/InputLabel/styles.d.ts +4 -0
  23. package/dist/components/InputLabel/styles.js +26 -0
  24. package/dist/components/InputLabel/styles.js.map +1 -0
  25. package/dist/components/Pager/index.d.ts +1 -1
  26. package/dist/components/RadioInput/index.d.ts +1 -0
  27. package/dist/components/RadioInput/index.js +5 -4
  28. package/dist/components/RadioInput/index.js.map +1 -1
  29. package/dist/components/RadioInput/styles.d.ts +2 -1
  30. package/dist/components/RadioInput/styles.js.map +1 -1
  31. package/dist/components/SegmentedControl/index.d.ts +2 -1
  32. package/dist/components/SegmentedControl/index.js +8 -14
  33. package/dist/components/SegmentedControl/index.js.map +1 -1
  34. package/dist/components/SegmentedControl/styles.d.ts +2 -1
  35. package/dist/components/SegmentedControl/styles.js.map +1 -1
  36. package/dist/components/Slider/index.js +6 -5
  37. package/dist/components/Slider/index.js.map +1 -1
  38. package/dist/components/Slider/styles.d.ts +2 -1
  39. package/dist/components/Slider/styles.js.map +1 -1
  40. package/dist/components/Switch/index.js +6 -1
  41. package/dist/components/Switch/index.js.map +1 -1
  42. package/dist/components/Switch/styles.d.ts +2 -1
  43. package/dist/components/Switch/styles.js +1 -1
  44. package/dist/components/Switch/styles.js.map +1 -1
  45. package/dist/components/TextInput/Label.d.ts +1 -1
  46. package/dist/components/TextInput/Label.js +1 -1
  47. package/dist/components/TextInput/Label.js.map +1 -1
  48. package/dist/components/TextInput/index.d.ts +0 -1
  49. package/dist/components/TextInput/index.js +7 -5
  50. package/dist/components/TextInput/index.js.map +1 -1
  51. package/dist/components/TextInput/styles.d.ts +2 -1
  52. package/dist/components/TextInput/styles.js +3 -6
  53. package/dist/components/TextInput/styles.js.map +1 -1
  54. package/dist/components/Touchable/index.js +5 -5
  55. package/dist/components/Touchable/index.js.map +1 -1
  56. package/dist/components/components.d.ts +1 -0
  57. package/dist/components/components.js +1 -0
  58. package/dist/components/components.js.map +1 -1
  59. package/dist/components/defaultStyles.d.ts +3 -0
  60. package/dist/components/defaultStyles.js +2 -0
  61. package/dist/components/defaultStyles.js.map +1 -1
  62. package/package.json +1 -1
  63. package/src/components/Button/index.tsx +1 -1
  64. package/src/components/Button/styles.ts +1 -0
  65. package/src/components/Checkbox/index.tsx +19 -18
  66. package/src/components/Checkbox/styles.ts +7 -7
  67. package/src/components/ContentView/index.tsx +3 -3
  68. package/src/components/ContentView/styles.ts +2 -3
  69. package/src/components/EmptyPlaceholder/index.tsx +1 -1
  70. package/src/components/FileInput/index.tsx +6 -52
  71. package/src/components/InputLabel/index.tsx +38 -0
  72. package/src/components/InputLabel/styles.ts +19 -0
  73. package/src/components/Pager/index.tsx +1 -1
  74. package/src/components/RadioInput/index.tsx +7 -3
  75. package/src/components/RadioInput/styles.ts +2 -1
  76. package/src/components/SegmentedControl/index.tsx +9 -3
  77. package/src/components/SegmentedControl/styles.ts +3 -1
  78. package/src/components/Slider/index.tsx +12 -7
  79. package/src/components/Slider/styles.ts +2 -1
  80. package/src/components/Switch/index.tsx +7 -2
  81. package/src/components/Switch/styles.ts +3 -2
  82. package/src/components/TextInput/index.tsx +6 -9
  83. package/src/components/TextInput/styles.ts +8 -11
  84. package/src/components/Touchable/index.tsx +6 -5
  85. package/src/components/components.ts +1 -0
  86. package/src/components/defaultStyles.ts +2 -0
  87. 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
- | 'requiredAsterisk'
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
- label: {
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
- 'label:error': {
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
- requiredAsterisk: {
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
- 'position!',
132
- 'top!',
133
- 'left!',
134
- 'right!',
135
- 'bottom!',
136
+
136
137
  ]
137
138
 
138
139
  const wrapperStyle = {} as any
@@ -31,6 +31,7 @@ export * from './Drawer'
31
31
  export * from './MultiSelect'
32
32
  export * from './AutoComplete'
33
33
  export * from './Grid'
34
+ export * from './InputLabel'
34
35
  export * from './ActionIcon'
35
36
 
36
37
  import * as Legacy from './legacy'
@@ -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
-