fluent-styles 1.62.12 → 1.62.14
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/input/index.js +56 -37
- package/lib/commonjs/input/index.js.map +1 -1
- package/lib/commonjs/utiles/viewStyleVariants.js +139 -80
- package/lib/commonjs/utiles/viewStyleVariants.js.map +1 -1
- package/lib/module/input/index.js +56 -37
- package/lib/module/input/index.js.map +1 -1
- package/lib/module/utiles/viewStyleVariants.js +139 -80
- package/lib/module/utiles/viewStyleVariants.js.map +1 -1
- package/lib/typescript/divider/index.d.ts +0 -1
- package/lib/typescript/divider/index.d.ts.map +1 -1
- package/lib/typescript/input/index.d.ts +1 -7
- package/lib/typescript/input/index.d.ts.map +1 -1
- package/lib/typescript/portal/PortalContext.d.ts +0 -1
- package/lib/typescript/portal/PortalContext.d.ts.map +1 -1
- package/lib/typescript/pressable/index.d.ts +0 -1
- package/lib/typescript/pressable/index.d.ts.map +1 -1
- package/lib/typescript/safeAreaProvider/index.d.ts +0 -1
- package/lib/typescript/safeAreaProvider/index.d.ts.map +1 -1
- package/lib/typescript/safeAreaView/index.d.ts +0 -1
- package/lib/typescript/safeAreaView/index.d.ts.map +1 -1
- package/lib/typescript/scrollView/index.d.ts +0 -1
- package/lib/typescript/scrollView/index.d.ts.map +1 -1
- package/lib/typescript/shape/index.d.ts +0 -1
- package/lib/typescript/shape/index.d.ts.map +1 -1
- package/lib/typescript/spacer/index.d.ts +0 -1
- package/lib/typescript/spacer/index.d.ts.map +1 -1
- package/lib/typescript/stack/index.d.ts +0 -1
- package/lib/typescript/stack/index.d.ts.map +1 -1
- package/lib/typescript/text/index.d.ts +0 -1
- package/lib/typescript/text/index.d.ts.map +1 -1
- package/lib/typescript/utiles/viewStyleVariants.d.ts +61 -55
- package/lib/typescript/utiles/viewStyleVariants.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/input/index.tsx +56 -39
- package/src/utiles/viewStyleVariants.ts +225 -186
- package/lib/commonjs/portal/portal.test.js +0 -154
- package/lib/commonjs/portal/portal.test.js.map +0 -1
- package/lib/module/portal/portal.test.js +0 -155
- package/lib/module/portal/portal.test.js.map +0 -1
- package/lib/typescript/portal/portal.test.d.ts +0 -11
- package/lib/typescript/portal/portal.test.d.ts.map +0 -1
- package/src/portal/portal.test.ts +0 -157
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pressable/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pressable/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,cAAc,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGrD,KAAK,oBAAoB,GAAG,cAAc,GAAG,SAAS,CAAC;AAEvD,QAAA,MAAM,eAAe;;;;;CAOnB,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/safeAreaProvider/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/safeAreaProvider/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,qBAAqB,EACxB,MAAM,gCAAgC,CAAC;AAGxC,KAAK,2BAA2B,GAAG,qBAAqB,CAAC;AAEzD,QAAA,MAAM,sBAAsB;;;;;CAG1B,CAAC;AAEH,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,YAAY,EAAE,2BAA2B,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/safeAreaView/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/safeAreaView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEH,iBAAiB,EACpB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAGrE,KAAK,uBAAuB,GAAG,iBAAiB,GAAG,cAAc,CAAC;AAElE,QAAA,MAAM,kBAAkB;;;;;CAOtB,CAAC;AAEH,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scrollView/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scrollView/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,eAAe,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAErE,KAAK,qBAAqB,GAAG,eAAe,GAAG,cAAc,CAAC;AAE9D,QAAA,MAAM,gBAAgB;;;;;CAIpB,CAAC;AAEH,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shape/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shape/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI1D,KAAK,aAAa,GAAG;IACjB,KAAK,CAAC,EAAE,OAAO,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,SAAS,CAAC,CAAC;CACzD,CAAC;AAEF,KAAK,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,CAAC;AAExD,QAAA,MAAM,WAAW;;;;;CAyBf,CAAC;AAGH,OAAO,EAAE,WAAW,EAAE,WAAW,IAAI,UAAU,EAAE,CAAC;AAClD,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ViewProps } from 'react-native';
|
|
3
2
|
import { ViewStyleProps } from '../utiles/viewStyleProps';
|
|
4
3
|
type SpacerProps = ViewProps & (Pick<ViewStyleProps, 'margin' | 'marginTop' | 'marginBottom' | 'marginLeft' | 'marginRight' | 'marginHorizontal' | 'marginVertical' | 'backgroundColor' | 'borderRadius' | 'borderWidth' | 'borderColor' | 'flex' | 'width' | 'height'>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spacer/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spacer/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAErE,KAAK,WAAW,GAAI,SAAS,GAAG,CAAC,IAAI,CAAC,cAAc,EAChD,QAAQ,GACR,WAAW,GACX,cAAc,GACd,YAAY,GACZ,aAAa,GACb,kBAAkB,GAClB,gBAAgB,GAChB,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,aAAa,GACb,MAAM,GACN,OAAO,GACP,QAAQ,CAAC,CAAC,CAAC;AAEf,QAAA,MAAM,YAAY;;;;;CAIhB,CAAC;AAEH,OAAO,EAAG,YAAY,EAAE,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stack/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stack/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI1D;;;;;GAKG;AACH,KAAK,aAAa,GAAG;IACjB,UAAU,CAAC,EAAE,OAAO,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;CAC7C,CAAC;AAEF,KAAK,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,CAAC;AAExD;;;;GAIG;AACH,QAAA,MAAM,KAAK;;;;;CAoBT,CAAC;AAEH,QAAA,MAAM,MAAM;;;;;CASV,CAAC;AAEH,QAAA,MAAM,MAAM;;;;;CASV,CAAC;AAEH,OAAO,EAAG,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/text/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/text/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,SAAS,EACT,SAAS,EACZ,MAAM,cAAc,CAAC;AAItB,KAAK,YAAY,GAAG;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAE;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,eAAe,GAAG,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5D,QAAA,MAAM,UAAU;;;;;CAgDd,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,53 +1,58 @@
|
|
|
1
1
|
import { ViewStyle } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* A raw variant value as it arrives from a prop. Numeric props (e.g. `width={100}`)
|
|
4
|
+
* come through as `number`, string props (e.g. `width="100%"`) come through as `string`.
|
|
5
|
+
*/
|
|
6
|
+
type RawValue = string | number | null | undefined;
|
|
2
7
|
export declare const viewStyleVariants: {
|
|
3
|
-
width: (selected:
|
|
4
|
-
height: (selected:
|
|
5
|
-
minWidth: (selected:
|
|
6
|
-
maxWidth: (selected:
|
|
7
|
-
minHeight: (selected:
|
|
8
|
-
maxHeight: (selected:
|
|
9
|
-
top: (selected:
|
|
10
|
-
bottom: (selected:
|
|
11
|
-
left: (selected:
|
|
12
|
-
right: (selected:
|
|
13
|
-
margin: (selected:
|
|
14
|
-
marginTop: (selected:
|
|
15
|
-
marginBottom: (selected:
|
|
16
|
-
marginLeft: (selected:
|
|
17
|
-
marginRight: (selected:
|
|
18
|
-
marginHorizontal: (selected:
|
|
19
|
-
marginVertical: (selected:
|
|
20
|
-
padding: (selected:
|
|
21
|
-
paddingTop: (selected:
|
|
22
|
-
paddingBottom: (selected:
|
|
23
|
-
paddingLeft: (selected:
|
|
24
|
-
paddingRight: (selected:
|
|
25
|
-
paddingHorizontal: (selected:
|
|
26
|
-
paddingVertical: (selected:
|
|
27
|
-
borderWidth: (selected:
|
|
28
|
-
borderTopWidth: (selected:
|
|
29
|
-
borderBottomWidth: (selected:
|
|
30
|
-
borderLeftWidth: (selected:
|
|
31
|
-
borderRightWidth: (selected:
|
|
32
|
-
borderRadius: (selected:
|
|
33
|
-
borderTopLeftRadius: (selected:
|
|
34
|
-
borderTopRightRadius: (selected:
|
|
35
|
-
borderBottomLeftRadius: (selected:
|
|
36
|
-
borderBottomRightRadius: (selected:
|
|
37
|
-
borderColor: (selected:
|
|
38
|
-
borderTopColor: (selected:
|
|
39
|
-
borderBottomColor: (selected:
|
|
40
|
-
borderLeftColor: (selected:
|
|
41
|
-
borderRightColor: (selected:
|
|
42
|
-
backgroundColor: (selected:
|
|
43
|
-
opacity: (selected:
|
|
44
|
-
rotation: (selected:
|
|
45
|
-
scale: (selected:
|
|
46
|
-
shadowOpacity: (selected:
|
|
47
|
-
shadowRadius: (selected:
|
|
48
|
-
shadowColor: (selected:
|
|
49
|
-
elevation: (selected:
|
|
50
|
-
zIndex: (selected:
|
|
8
|
+
width: (selected: RawValue) => ViewStyle;
|
|
9
|
+
height: (selected: RawValue) => ViewStyle;
|
|
10
|
+
minWidth: (selected: RawValue) => ViewStyle;
|
|
11
|
+
maxWidth: (selected: RawValue) => ViewStyle;
|
|
12
|
+
minHeight: (selected: RawValue) => ViewStyle;
|
|
13
|
+
maxHeight: (selected: RawValue) => ViewStyle;
|
|
14
|
+
top: (selected: RawValue) => ViewStyle;
|
|
15
|
+
bottom: (selected: RawValue) => ViewStyle;
|
|
16
|
+
left: (selected: RawValue) => ViewStyle;
|
|
17
|
+
right: (selected: RawValue) => ViewStyle;
|
|
18
|
+
margin: (selected: RawValue) => ViewStyle;
|
|
19
|
+
marginTop: (selected: RawValue) => ViewStyle;
|
|
20
|
+
marginBottom: (selected: RawValue) => ViewStyle;
|
|
21
|
+
marginLeft: (selected: RawValue) => ViewStyle;
|
|
22
|
+
marginRight: (selected: RawValue) => ViewStyle;
|
|
23
|
+
marginHorizontal: (selected: RawValue) => ViewStyle;
|
|
24
|
+
marginVertical: (selected: RawValue) => ViewStyle;
|
|
25
|
+
padding: (selected: RawValue) => ViewStyle;
|
|
26
|
+
paddingTop: (selected: RawValue) => ViewStyle;
|
|
27
|
+
paddingBottom: (selected: RawValue) => ViewStyle;
|
|
28
|
+
paddingLeft: (selected: RawValue) => ViewStyle;
|
|
29
|
+
paddingRight: (selected: RawValue) => ViewStyle;
|
|
30
|
+
paddingHorizontal: (selected: RawValue) => ViewStyle;
|
|
31
|
+
paddingVertical: (selected: RawValue) => ViewStyle;
|
|
32
|
+
borderWidth: (selected: RawValue) => ViewStyle;
|
|
33
|
+
borderTopWidth: (selected: RawValue) => ViewStyle;
|
|
34
|
+
borderBottomWidth: (selected: RawValue) => ViewStyle;
|
|
35
|
+
borderLeftWidth: (selected: RawValue) => ViewStyle;
|
|
36
|
+
borderRightWidth: (selected: RawValue) => ViewStyle;
|
|
37
|
+
borderRadius: (selected: RawValue) => ViewStyle;
|
|
38
|
+
borderTopLeftRadius: (selected: RawValue) => ViewStyle;
|
|
39
|
+
borderTopRightRadius: (selected: RawValue) => ViewStyle;
|
|
40
|
+
borderBottomLeftRadius: (selected: RawValue) => ViewStyle;
|
|
41
|
+
borderBottomRightRadius: (selected: RawValue) => ViewStyle;
|
|
42
|
+
borderColor: (selected: RawValue) => ViewStyle;
|
|
43
|
+
borderTopColor: (selected: RawValue) => ViewStyle;
|
|
44
|
+
borderBottomColor: (selected: RawValue) => ViewStyle;
|
|
45
|
+
borderLeftColor: (selected: RawValue) => ViewStyle;
|
|
46
|
+
borderRightColor: (selected: RawValue) => ViewStyle;
|
|
47
|
+
backgroundColor: (selected: RawValue) => ViewStyle;
|
|
48
|
+
opacity: (selected: RawValue) => ViewStyle;
|
|
49
|
+
rotation: (selected: RawValue) => ViewStyle;
|
|
50
|
+
scale: (selected: RawValue) => ViewStyle;
|
|
51
|
+
shadowOpacity: (selected: RawValue) => ViewStyle;
|
|
52
|
+
shadowRadius: (selected: RawValue) => ViewStyle;
|
|
53
|
+
shadowColor: (selected: RawValue) => ViewStyle;
|
|
54
|
+
elevation: (selected: RawValue) => ViewStyle;
|
|
55
|
+
zIndex: (selected: RawValue) => ViewStyle;
|
|
51
56
|
};
|
|
52
57
|
export declare const viewStyleStringVariants: {
|
|
53
58
|
position: {
|
|
@@ -110,12 +115,13 @@ export declare const viewStyleStringVariants: {
|
|
|
110
115
|
dotted: ViewStyle;
|
|
111
116
|
dashed: ViewStyle;
|
|
112
117
|
};
|
|
113
|
-
flex: (selected:
|
|
114
|
-
flexBasis: (selected:
|
|
115
|
-
flexGrow: (selected:
|
|
116
|
-
flexShrink: (selected:
|
|
117
|
-
gap: (selected:
|
|
118
|
-
columnGap: (selected:
|
|
119
|
-
rowGap: (selected:
|
|
118
|
+
flex: (selected: RawValue) => ViewStyle;
|
|
119
|
+
flexBasis: (selected: RawValue) => ViewStyle;
|
|
120
|
+
flexGrow: (selected: RawValue) => ViewStyle;
|
|
121
|
+
flexShrink: (selected: RawValue) => ViewStyle;
|
|
122
|
+
gap: (selected: RawValue) => ViewStyle;
|
|
123
|
+
columnGap: (selected: RawValue) => ViewStyle;
|
|
124
|
+
rowGap: (selected: RawValue) => ViewStyle;
|
|
120
125
|
};
|
|
126
|
+
export {};
|
|
121
127
|
//# sourceMappingURL=viewStyleVariants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewStyleVariants.d.ts","sourceRoot":"","sources":["../../../src/utiles/viewStyleVariants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,iBAAiB;sBAEV,
|
|
1
|
+
{"version":3,"file":"viewStyleVariants.d.ts","sourceRoot":"","sources":["../../../src/utiles/viewStyleVariants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;GAGG;AACH,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAmCnD,eAAO,MAAM,iBAAiB;sBAEV,QAAQ;uBAMP,QAAQ;yBAMN,QAAQ;yBAMR,QAAQ;0BAMP,QAAQ;0BAMR,QAAQ;oBAOd,QAAQ;uBAML,QAAQ;qBAMV,QAAQ;sBAMP,QAAQ;uBAOP,QAAQ;0BAML,QAAQ;6BAML,QAAQ;2BAMV,QAAQ;4BAMP,QAAQ;iCAMH,QAAQ;+BAMV,QAAQ;wBAOf,QAAQ;2BAML,QAAQ;8BAML,QAAQ;4BAMV,QAAQ;6BAMP,QAAQ;kCAMH,QAAQ;gCAMV,QAAQ;4BAOZ,QAAQ;+BAML,QAAQ;kCAML,QAAQ;gCAMV,QAAQ;iCAMP,QAAQ;6BAOZ,QAAQ;oCAMD,QAAQ;qCAMP,QAAQ;uCAMN,QAAQ;wCAMP,QAAQ;4BAOpB,QAAQ;+BAKL,QAAQ;kCAKL,QAAQ;gCAKV,QAAQ;iCAKP,QAAQ;gCAMT,QAAQ;wBAKhB,QAAQ;yBAOP,QAAQ;sBAMX,QAAQ;8BAOA,QAAQ;6BAMT,QAAQ;4BAMT,QAAQ;0BAMV,QAAQ;uBAOX,QAAQ;CAK5B,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAuEjB,QAAQ;0BAMH,QAAQ;yBAMT,QAAQ;2BAMN,QAAQ;oBAOf,QAAQ;0BAMF,QAAQ;uBAMX,QAAQ;CAK5B,CAAC"}
|
package/package.json
CHANGED
package/src/input/index.tsx
CHANGED
|
@@ -15,13 +15,10 @@ import {
|
|
|
15
15
|
View,
|
|
16
16
|
} from 'react-native'
|
|
17
17
|
import type {
|
|
18
|
-
NativeSyntheticEvent,
|
|
19
|
-
TextInputFocusEventData,
|
|
20
18
|
TextStyle,
|
|
21
19
|
ViewStyle,
|
|
22
20
|
} from 'react-native'
|
|
23
21
|
|
|
24
|
-
import { styled } from '../utiles/styled'
|
|
25
22
|
import { theme } from '../utiles/theme'
|
|
26
23
|
import { viewStyleVariants, viewStyleStringVariants } from '../utiles/viewStyleVariants'
|
|
27
24
|
import { StyledText } from '../text'
|
|
@@ -132,38 +129,52 @@ export interface StyledTextInputProps
|
|
|
132
129
|
|
|
133
130
|
}
|
|
134
131
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (isNaN(Number(size))) {
|
|
153
|
-
// throw new Error('Invalid fontSize value');
|
|
154
|
-
}
|
|
155
|
-
return { fontSize: Number(size) };
|
|
156
|
-
},
|
|
132
|
+
// ─── Flat style-prop resolution ────────────────────────────────────────────────
|
|
133
|
+
// Replaces the generic `styled()` wrapper that used to sit around TextInput.
|
|
134
|
+
// Preserves its behaviour exactly: any flat ViewStyle/TextStyle prop (e.g.
|
|
135
|
+
// `opacity`, `padding`, `borderColor`) passed straight to StyledTextInput is
|
|
136
|
+
// resolved into a real style on the inner TextInput and stripped out of the
|
|
137
|
+
// props spread onto it — same variant maps `styled()` used, resolved locally
|
|
138
|
+
// instead of through the shared HOC.
|
|
139
|
+
const BASE_INPUT_STYLE: TextStyle = {
|
|
140
|
+
borderColor: theme.colors.gray[200],
|
|
141
|
+
backgroundColor: theme.colors.gray[1],
|
|
142
|
+
flex: 1,
|
|
143
|
+
color: theme.colors.gray[800],
|
|
144
|
+
paddingHorizontal: 16,
|
|
145
|
+
paddingVertical: 12,
|
|
146
|
+
fontSize: theme.fontSize.normal,
|
|
147
|
+
minHeight: 48,
|
|
148
|
+
}
|
|
157
149
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
150
|
+
const FLAT_STYLE_VARIANTS: Record<string, any> = {
|
|
151
|
+
...viewStyleVariants,
|
|
152
|
+
...viewStyleStringVariants,
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const resolveFlatStyle = (
|
|
156
|
+
props: Record<string, any>,
|
|
157
|
+
): { style: TextStyle; clean: Record<string, any> } => {
|
|
158
|
+
const style: TextStyle = { ...BASE_INPUT_STYLE }
|
|
159
|
+
const clean: Record<string, any> = { ...props }
|
|
160
|
+
|
|
161
|
+
Object.keys(FLAT_STYLE_VARIANTS).forEach((key) => {
|
|
162
|
+
if (!(key in clean)) return
|
|
163
|
+
const selected = clean[key]
|
|
164
|
+
delete clean[key]
|
|
165
|
+
|
|
166
|
+
const variant = FLAT_STYLE_VARIANTS[key]
|
|
167
|
+
if (typeof variant === 'function') {
|
|
168
|
+
const resolved = variant(selected, props)
|
|
169
|
+
if (resolved) Object.assign(style, resolved)
|
|
170
|
+
} else if (variant?.[selected]) {
|
|
171
|
+
const value = variant[selected]
|
|
172
|
+
Object.assign(style, typeof value === 'function' ? value(selected, props) : value)
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
return { style, clean }
|
|
177
|
+
}
|
|
167
178
|
|
|
168
179
|
export interface StyledTextInputHandle extends StyledTextInputProps {
|
|
169
180
|
focus: () => void
|
|
@@ -396,7 +407,7 @@ export const StyledTextInput = (
|
|
|
396
407
|
onBlur: onBlurProp,
|
|
397
408
|
ref,
|
|
398
409
|
...rest
|
|
399
|
-
}: StyledTextInputProps & { ref?: React.Ref<
|
|
410
|
+
}: StyledTextInputProps & { ref?: React.Ref<StyledTextInputHandle> },
|
|
400
411
|
) => {
|
|
401
412
|
const [focused, setFocused] = useState(false)
|
|
402
413
|
const [localValue, setLocalValue] = useState(defaultValue ?? '')
|
|
@@ -418,12 +429,12 @@ export const StyledTextInput = (
|
|
|
418
429
|
onChangeText?.(text)
|
|
419
430
|
}, [value, onChangeText])
|
|
420
431
|
|
|
421
|
-
const handleFocus = useCallback((e:
|
|
432
|
+
const handleFocus = useCallback((e: Parameters<NonNullable<TextInputProps['onFocus']>>[0]) => {
|
|
422
433
|
setFocused(true)
|
|
423
434
|
onFocusProp?.(e)
|
|
424
435
|
}, [onFocusProp])
|
|
425
436
|
|
|
426
|
-
const handleBlur = useCallback((e:
|
|
437
|
+
const handleBlur = useCallback((e: Parameters<NonNullable<TextInputProps['onBlur']>>[0]) => {
|
|
427
438
|
setFocused(false)
|
|
428
439
|
onBlurProp?.(e)
|
|
429
440
|
}, [onBlurProp])
|
|
@@ -451,6 +462,11 @@ export const StyledTextInput = (
|
|
|
451
462
|
const hasLeftAddon = !!leftAddon
|
|
452
463
|
const hasRightAddon = !!rightAddon
|
|
453
464
|
|
|
465
|
+
// Resolves any flat ViewStyle/TextStyle prop passed straight to
|
|
466
|
+
// StyledTextInput (e.g. `opacity`, `padding`) into a real style, and
|
|
467
|
+
// strips those keys out of what gets spread onto the native TextInput.
|
|
468
|
+
const { style: flatStyle, clean: cleanRest } = resolveFlatStyle(rest)
|
|
469
|
+
|
|
454
470
|
// ── Right-side icons (priority: loading > clear > rightIcon) ─────────
|
|
455
471
|
const resolvedRightNode = loading ? (
|
|
456
472
|
<ActivityIndicator size="small" color={theme.colors.gray[400]} />
|
|
@@ -535,7 +551,7 @@ export const StyledTextInput = (
|
|
|
535
551
|
) : null}
|
|
536
552
|
|
|
537
553
|
{/* Core TextInput */}
|
|
538
|
-
<
|
|
554
|
+
<TextInput
|
|
539
555
|
ref={inputRef}
|
|
540
556
|
value={value}
|
|
541
557
|
defaultValue={defaultValue}
|
|
@@ -549,6 +565,7 @@ export const StyledTextInput = (
|
|
|
549
565
|
numberOfLines={numberOfLines}
|
|
550
566
|
maxLength={maxLength}
|
|
551
567
|
style={[
|
|
568
|
+
flatStyle,
|
|
552
569
|
S.input,
|
|
553
570
|
{
|
|
554
571
|
fontSize: fontSizeProp ?? sz.fontSize,
|
|
@@ -562,7 +579,7 @@ export const StyledTextInput = (
|
|
|
562
579
|
},
|
|
563
580
|
inputStyle,
|
|
564
581
|
]}
|
|
565
|
-
{...
|
|
582
|
+
{...cleanRest}
|
|
566
583
|
/>
|
|
567
584
|
|
|
568
585
|
{/* Right icon / clear / spinner */}
|