react-native-terra-ui 0.11.4 → 0.11.6
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/CHANGELOG.md +15 -0
- package/lib/module/components/chip/Chip.js +25 -8
- package/lib/module/components/chip/Chip.js.map +1 -1
- package/lib/module/components/chip/utils.js +1 -1
- package/lib/module/components/chip/utils.js.map +1 -1
- package/lib/module/components/header/index.js.map +1 -1
- package/lib/module/components/header/parts/HeaderAccessory.js +55 -0
- package/lib/module/components/header/parts/HeaderAccessory.js.map +1 -0
- package/lib/module/components/header/parts/HeaderSurface.js +65 -0
- package/lib/module/components/header/parts/HeaderSurface.js.map +1 -0
- package/lib/module/components/header/types.js +2 -0
- package/lib/module/components/header/types.js.map +1 -0
- package/lib/module/components/header/utils.js +20 -0
- package/lib/module/components/header/utils.js.map +1 -0
- package/lib/module/components/header/variants/LargeTitleHeader/index.js +33 -30
- package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
- package/lib/module/components/header/variants/TitleHeader/index.js +29 -27
- package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/input/Input.js +32 -0
- package/lib/module/components/input/Input.js.map +1 -0
- package/lib/module/components/input/index.js +5 -0
- package/lib/module/components/input/index.js.map +1 -0
- package/lib/module/components/input/parts/InputField.js +161 -0
- package/lib/module/components/input/parts/InputField.js.map +1 -0
- package/lib/module/components/input/types.js +4 -0
- package/lib/module/components/input/types.js.map +1 -0
- package/lib/module/components/input/variants/SearchInput/index.js +100 -0
- package/lib/module/components/input/variants/SearchInput/index.js.map +1 -0
- package/lib/module/components/screen/ScreenContext.js +10 -1
- package/lib/module/components/screen/ScreenContext.js.map +1 -1
- package/lib/module/components/screen/ScreenList.js +5 -3
- package/lib/module/components/screen/ScreenList.js.map +1 -1
- package/lib/module/components/screen/ScreenScrollView.js +5 -3
- package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
- package/lib/module/components/toolbar/Toolbar.js +12 -5
- package/lib/module/components/toolbar/Toolbar.js.map +1 -1
- package/lib/module/theme/defaults/icons.js +21 -0
- package/lib/module/theme/defaults/icons.js.map +1 -1
- package/lib/typescript/src/components/chip/Chip.d.ts +8 -0
- package/lib/typescript/src/components/chip/Chip.d.ts.map +1 -1
- package/lib/typescript/src/components/chip/utils.d.ts +6 -1
- package/lib/typescript/src/components/chip/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/header/index.d.ts +1 -0
- package/lib/typescript/src/components/header/index.d.ts.map +1 -1
- package/lib/typescript/src/components/header/parts/HeaderAccessory.d.ts +19 -0
- package/lib/typescript/src/components/header/parts/HeaderAccessory.d.ts.map +1 -0
- package/lib/typescript/src/components/header/parts/HeaderSurface.d.ts +24 -0
- package/lib/typescript/src/components/header/parts/HeaderSurface.d.ts.map +1 -0
- package/lib/typescript/src/components/header/types.d.ts +11 -0
- package/lib/typescript/src/components/header/types.d.ts.map +1 -0
- package/lib/typescript/src/components/header/utils.d.ts +14 -0
- package/lib/typescript/src/components/header/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +1 -1
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -1
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +21 -2
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
- package/lib/typescript/src/components/index.d.ts +1 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/components/input/Input.d.ts +28 -0
- package/lib/typescript/src/components/input/Input.d.ts.map +1 -0
- package/lib/typescript/src/components/input/index.d.ts +4 -0
- package/lib/typescript/src/components/input/index.d.ts.map +1 -0
- package/lib/typescript/src/components/input/parts/InputField.d.ts +8 -0
- package/lib/typescript/src/components/input/parts/InputField.d.ts.map +1 -0
- package/lib/typescript/src/components/input/types.d.ts +29 -0
- package/lib/typescript/src/components/input/types.d.ts.map +1 -0
- package/lib/typescript/src/components/input/variants/SearchInput/index.d.ts +24 -0
- package/lib/typescript/src/components/input/variants/SearchInput/index.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/ScreenContext.d.ts +15 -0
- package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts +8 -3
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/typescript/src/theme/defaults/icons.d.ts.map +1 -1
- package/lib/typescript/src/theme/types.d.ts +1 -1
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/chip/Chip.tsx +22 -9
- package/src/components/chip/utils.ts +7 -2
- package/src/components/header/index.ts +1 -0
- package/src/components/header/parts/HeaderAccessory.tsx +57 -0
- package/src/components/header/parts/HeaderSurface.tsx +65 -0
- package/src/components/header/types.ts +10 -0
- package/src/components/header/utils.ts +19 -0
- package/src/components/header/variants/LargeTitleHeader/index.tsx +43 -28
- package/src/components/header/variants/TitleHeader/index.tsx +42 -18
- package/src/components/index.ts +1 -0
- package/src/components/input/Input.tsx +36 -0
- package/src/components/input/index.ts +3 -0
- package/src/components/input/parts/InputField.tsx +138 -0
- package/src/components/input/types.ts +31 -0
- package/src/components/input/variants/SearchInput/index.tsx +118 -0
- package/src/components/screen/ScreenContext.tsx +26 -0
- package/src/components/screen/ScreenList.tsx +8 -3
- package/src/components/screen/ScreenScrollView.tsx +12 -3
- package/src/components/toolbar/Toolbar.tsx +17 -7
- package/src/theme/defaults/icons.tsx +13 -0
- package/src/theme/types.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","StyleSheet","useUnistyles","resolveThemeColor","FONT_WEIGHT_VALUE","useHeaderBackground","ScreenContext","Toolbar","HeaderDismissButton","
|
|
1
|
+
{"version":3,"names":["useContext","StyleSheet","useUnistyles","resolveThemeColor","FONT_WEIGHT_VALUE","useHeaderBackground","ScreenContext","Toolbar","HeaderDismissButton","HeaderAccessory","HeaderSurface","isCustomTitle","isTextTitle","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TitleHeader","title","leadingActions","trailingActions","LeftToolbar","RightToolbar","accessory","accessoryPadding","dismissAction","navigation","onDismiss","titleAlignment","background","bg","theme","screen","colorToken","bgColor","color","leadingContent","undefined","trailingContent","isTransparent","gradientColor","_styles","styles","useVariants","leading","children","trailing","View","style","container","safeArea","barGroup","bar","titleContainer","pointerEvents","String","trim","length","Text","padding","create","runtime","position","top","left","right","zIndex","withinScreen","height","insets","backgroundColor","uni__dependencies","layout","header","flexDirection","alignItems","paddingHorizontal","x","gap","spacing","justifyContent","variants","center","marginLeft","flex","fontSize","typography","lineHeight","letterSpacing","fontWeight","textAlign"],"sourceRoot":"../../../../../../src","sources":["components/header/variants/TitleHeader/index.tsx"],"mappings":";;;;AAAA,SAAyBA,UAAU,QAAQ,OAAO;AAGlD,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;AAGjE,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,aAAa;AACtB,SAASC,OAAO;AAChB,SAASC,mBAAmB;AAC5B,SAASC,eAAe;AACxB,SAASC,aAAa;AAEtB,SAASC,aAAa,EAAEC,WAAW;AAAsB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AA4CzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAC;EAC1BC,KAAK;EACLC,cAAc;EACdC,eAAe;EACfC,WAAW;EACXC,YAAY;EACZC,SAAS;EACTC,gBAAgB,GAAG,GAAG;EACtBC,aAAa,G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E;QACdsD,MAAM,EAAE;UACNpB,QAAQ,EAAE,UAAU;UACpBE,IAAI,EAAE,CAAC;UACPC,KAAK,EAAE,CAAC;UACRU,UAAU,EAAE;QACd,CAAC;QACDX,IAAI,EAAE;UACJoB,IAAI,EAAE,CAAC;UACPT,UAAU,EAAE;QACd;MACF;IACF,CAAC;IAAAJ,iBAAA;EACH,CAAC;EACDrD,KAAK,EAAE;IACLmE,QAAQ,EAAEtD,KAAK,CAACuD,UAAU,CAACL,QAAQ,CAAC,UAAU,CAAC,CAACI,QAAQ;IACxDE,UAAU,EAAExD,KAAK,CAACuD,UAAU,CAACL,QAAQ,CAAC,UAAU,CAAC,CAACM,UAAU;IAC5DC,aAAa,EAAEzD,KAAK,CAACuD,UAAU,CAACL,QAAQ,CAAC,UAAU,CAAC,CAACO,aAAa;IAClEC,UAAU,EAAEvF,iBAAiB,CAAC6B,KAAK,CAACuD,UAAU,CAACL,QAAQ,CAAC,UAAU,CAAC,CAACQ,UAAU,CAAC;IAC/EtD,KAAK,EAAGJ,KAAK,CAACI,KAAK,CAAmD,cAAc,CAAC,IAAI,EAAE;IAC3F8C,QAAQ,EAAE;MACRrD,cAAc,EAAE;QACdsD,MAAM,EAAE;UAAEQ,SAAS,EAAE;QAAS,CAAC;QAC/B1B,IAAI,EAAE;UAAE0B,SAAS,EAAE;QAAO;MAC5B;IACF,CAAC;IAAAnB,iBAAA;EACH;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ export * from "./empty-state/index.js";
|
|
|
10
10
|
export * from "./header/index.js";
|
|
11
11
|
export * from "./icon/index.js";
|
|
12
12
|
export * from "./image/index.js";
|
|
13
|
+
export * from "./input/index.js";
|
|
13
14
|
export * from "./page-indicator/index.js";
|
|
14
15
|
export * from "./portal/index.js";
|
|
15
16
|
export * from "./pressable/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { InputField } from "./parts/InputField.js";
|
|
5
|
+
import { SearchInput } from "./variants/SearchInput/index.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* A themed single-line text field. Wraps React Native's `TextInput`, so every
|
|
9
|
+
* one of its props still applies; `style` reaches the container instead, and
|
|
10
|
+
* the text is themed from `size`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Input placeholder="Your name" value={name} onChangeText={setName} />
|
|
15
|
+
* <Input size="lg" leading={<Icon name="terra.person" color="text.tertiary" />} />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
const InputRoot = /*#__PURE__*/forwardRef(function Input(props, ref) {
|
|
19
|
+
return /*#__PURE__*/_jsx(InputField, {
|
|
20
|
+
ref: ref,
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Input namespace.
|
|
26
|
+
*
|
|
27
|
+
* - `Input` — the plain text field.
|
|
28
|
+
* - `Input.Search` — a search field with a leading glyph and a clear button.
|
|
29
|
+
*/
|
|
30
|
+
export const Input = InputRoot;
|
|
31
|
+
Input.Search = SearchInput;
|
|
32
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","InputField","SearchInput","jsx","_jsx","InputRoot","Input","props","ref","Search"],"sourceRoot":"../../../../src","sources":["components/input/Input.tsx"],"mappings":";;AAAA,SAA4BA,UAAU,QAAQ,OAAO;AAGrD,SAASC,UAAU;AAEnB,SAASC,WAAW;AAAiC,SAAAC,GAAA,IAAAC,IAAA;AAIrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAAS,gBAAGL,UAAU,CAA6C,SAASM,KAAKA,CAACC,KAAK,EAAEC,GAAG,EAAE;EAClG,oBAAOJ,IAAA,CAACH,UAAU;IAACO,GAAG,EAAEA,GAAI;IAAA,GAAKD;EAAK,CAAG,CAAC;AAC5C,CAAC,CAAC;AAMF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMD,KAAK,GAAGD,SAA2B;AAChDC,KAAK,CAACG,MAAM,GAAGP,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Input","SearchInput"],"sourceRoot":"../../../../src","sources":["components/input/index.ts"],"mappings":";;AAAA,SAASA,KAAK;AAEd,SAASC,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { View } from "react-native-unistyles/components/native/View";
|
|
4
|
+
import { TextInput } from "react-native-unistyles/components/native/TextInput";
|
|
5
|
+
import { forwardRef, useCallback, useState } from "react";
|
|
6
|
+
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
|
7
|
+
import { resolveThemeColor } from "../../../utils/resolve-theme-color.js";
|
|
8
|
+
import { FONT_WEIGHT_VALUE } from "../../../utils/typography.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
/** Typographic role of the text, per size. */
|
|
11
|
+
const TEXT_VARIANT = {
|
|
12
|
+
sm: "body-sm",
|
|
13
|
+
md: "body-md",
|
|
14
|
+
lg: "body-lg"
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The field every input in the family renders: a themed container with optional
|
|
19
|
+
* leading and trailing slots around a native `TextInput`. Internal — consumers
|
|
20
|
+
* reach it through `Input` or one of its variants.
|
|
21
|
+
*/
|
|
22
|
+
export const InputField = /*#__PURE__*/forwardRef(function InputField({
|
|
23
|
+
size = "md",
|
|
24
|
+
isDisabled = false,
|
|
25
|
+
isInvalid = false,
|
|
26
|
+
leading,
|
|
27
|
+
trailing,
|
|
28
|
+
background = "surface.sunken",
|
|
29
|
+
radius = "lg",
|
|
30
|
+
style,
|
|
31
|
+
onFocus,
|
|
32
|
+
onBlur,
|
|
33
|
+
...rest
|
|
34
|
+
}, ref) {
|
|
35
|
+
// The focus ring is a style decision, so it stays a variant; only the
|
|
36
|
+
// placeholder colour has to leave the stylesheet, because `TextInput` takes it
|
|
37
|
+
// as a prop rather than as a style.
|
|
38
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
39
|
+
const {
|
|
40
|
+
theme
|
|
41
|
+
} = useUnistyles();
|
|
42
|
+
const handleFocus = useCallback(event => {
|
|
43
|
+
setIsFocused(true);
|
|
44
|
+
onFocus?.(event);
|
|
45
|
+
}, [onFocus]);
|
|
46
|
+
const handleBlur = useCallback(event => {
|
|
47
|
+
setIsFocused(false);
|
|
48
|
+
onBlur?.(event);
|
|
49
|
+
}, [onBlur]);
|
|
50
|
+
const _styles = styles;
|
|
51
|
+
{
|
|
52
|
+
const styles = _styles.useVariants({
|
|
53
|
+
size,
|
|
54
|
+
disabled: isDisabled,
|
|
55
|
+
invalid: isInvalid,
|
|
56
|
+
focused: isFocused && !isDisabled
|
|
57
|
+
});
|
|
58
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
59
|
+
style: [styles.container, styles.fill(background, radius), style],
|
|
60
|
+
children: [leading, /*#__PURE__*/_jsx(TextInput, {
|
|
61
|
+
ref: ref,
|
|
62
|
+
editable: !isDisabled,
|
|
63
|
+
placeholderTextColor: theme.color["text.tertiary"],
|
|
64
|
+
style: styles.input,
|
|
65
|
+
onFocus: handleFocus,
|
|
66
|
+
onBlur: handleBlur,
|
|
67
|
+
...rest
|
|
68
|
+
}), trailing]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const styles = StyleSheet.create(theme => ({
|
|
73
|
+
container: {
|
|
74
|
+
flexDirection: "row",
|
|
75
|
+
alignItems: "center",
|
|
76
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
77
|
+
borderColor: theme.color["border.subtle"],
|
|
78
|
+
variants: {
|
|
79
|
+
size: {
|
|
80
|
+
sm: {
|
|
81
|
+
height: 36,
|
|
82
|
+
paddingHorizontal: theme.spacing["4"],
|
|
83
|
+
gap: 6
|
|
84
|
+
},
|
|
85
|
+
md: {
|
|
86
|
+
height: 44,
|
|
87
|
+
paddingHorizontal: theme.spacing["4"],
|
|
88
|
+
gap: 6
|
|
89
|
+
},
|
|
90
|
+
lg: {
|
|
91
|
+
height: 52,
|
|
92
|
+
paddingHorizontal: theme.spacing["4"],
|
|
93
|
+
gap: 6
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
focused: {
|
|
97
|
+
true: {
|
|
98
|
+
borderColor: theme.color["accent.border"]
|
|
99
|
+
},
|
|
100
|
+
false: {}
|
|
101
|
+
},
|
|
102
|
+
invalid: {
|
|
103
|
+
true: {
|
|
104
|
+
borderColor: theme.color["danger.text"]
|
|
105
|
+
},
|
|
106
|
+
false: {}
|
|
107
|
+
},
|
|
108
|
+
disabled: {
|
|
109
|
+
true: {
|
|
110
|
+
opacity: theme.opacity.disabled
|
|
111
|
+
},
|
|
112
|
+
false: {}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
uni__dependencies: [0, 4]
|
|
116
|
+
},
|
|
117
|
+
// `background` is an open `ColorToken` and `radius` an eight-step scale, so
|
|
118
|
+
// both resolve in a dynamic function rather than enumerating as variants.
|
|
119
|
+
fill: (background, radius) => ({
|
|
120
|
+
backgroundColor: resolveThemeColor(background, theme),
|
|
121
|
+
borderRadius: theme.radius[radius],
|
|
122
|
+
uni__dependencies: [0]
|
|
123
|
+
}),
|
|
124
|
+
input: {
|
|
125
|
+
flex: 1,
|
|
126
|
+
// Android centres text in a taller box by default; zeroing the padding lets
|
|
127
|
+
// the container's own height own the geometry on both platforms.
|
|
128
|
+
paddingVertical: 0,
|
|
129
|
+
color: theme.color["text.primary"],
|
|
130
|
+
variants: {
|
|
131
|
+
size: {
|
|
132
|
+
sm: {
|
|
133
|
+
fontSize: theme.typography.variants[TEXT_VARIANT.sm].fontSize,
|
|
134
|
+
fontWeight: FONT_WEIGHT_VALUE[theme.typography.variants[TEXT_VARIANT.sm].fontWeight]
|
|
135
|
+
},
|
|
136
|
+
md: {
|
|
137
|
+
fontSize: theme.typography.variants[TEXT_VARIANT.md].fontSize,
|
|
138
|
+
fontWeight: FONT_WEIGHT_VALUE[theme.typography.variants[TEXT_VARIANT.md].fontWeight]
|
|
139
|
+
},
|
|
140
|
+
lg: {
|
|
141
|
+
fontSize: theme.typography.variants[TEXT_VARIANT.lg].fontSize,
|
|
142
|
+
fontWeight: FONT_WEIGHT_VALUE[theme.typography.variants[TEXT_VARIANT.lg].fontWeight]
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
focused: {
|
|
146
|
+
true: {},
|
|
147
|
+
false: {}
|
|
148
|
+
},
|
|
149
|
+
invalid: {
|
|
150
|
+
true: {},
|
|
151
|
+
false: {}
|
|
152
|
+
},
|
|
153
|
+
disabled: {
|
|
154
|
+
true: {},
|
|
155
|
+
false: {}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
uni__dependencies: [0, 4]
|
|
159
|
+
}
|
|
160
|
+
}));
|
|
161
|
+
//# sourceMappingURL=InputField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useCallback","useState","StyleSheet","useUnistyles","resolveThemeColor","FONT_WEIGHT_VALUE","jsx","_jsx","jsxs","_jsxs","TEXT_VARIANT","sm","md","lg","InputField","size","isDisabled","isInvalid","leading","trailing","background","radius","style","onFocus","onBlur","rest","ref","isFocused","setIsFocused","theme","handleFocus","event","handleBlur","_styles","styles","useVariants","disabled","invalid","focused","View","container","fill","children","TextInput","editable","placeholderTextColor","color","input","create","flexDirection","alignItems","borderWidth","hairlineWidth","borderColor","variants","height","paddingHorizontal","spacing","gap","true","false","opacity","uni__dependencies","backgroundColor","borderRadius","flex","paddingVertical","fontSize","typography","fontWeight"],"sourceRoot":"../../../../../src","sources":["components/input/parts/InputField.tsx"],"mappings":";;;;AAAA,SAA4BA,UAAU,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAG5E,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;AAGjE,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAA4B,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGtD;AACA,MAAMC,YAAkE,GAAG;EACzEC,EAAE,EAAE,SAAS;EACbC,EAAE,EAAE,SAAS;EACbC,EAAE,EAAE;AACN,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,gBAAGf,UAAU,CAAiD,SAASe,UAAUA,CACtG;EACEC,IAAI,GAAG,IAAI;EACXC,UAAU,GAAG,KAAK;EAClBC,SAAS,GAAG,KAAK;EACjBC,OAAO;EACPC,QAAQ;EACRC,UAAU,GAAG,gBAAgB;EAC7BC,MAAM,GAAG,IAAI;EACbC,KAAK;EACLC,OAAO;EACPC,MAAM;EACN,GAAGC;AACL,CAAC,EACDC,GAAG,EACH;EACA;EACA;EACA;EACA,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAG3B,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM;IAAE4B;EAAM,CAAC,GAAG1B,YAAY,CAAC,CAAC;EAEhC,MAAM2B,WAAW,GAAG9B,WAAW,CAC5B+B,KA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","sources":["components/input/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Pressable } from "react-native-unistyles/components/native/Pressable";
|
|
4
|
+
import { forwardRef, useCallback, useState } from "react";
|
|
5
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
6
|
+
import { Icon } from "../../../icon/index.js";
|
|
7
|
+
import { InputField } from "../../parts/InputField.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
/** Glyph size per field size, in dp. */
|
|
10
|
+
const ICON_SIZE = {
|
|
11
|
+
sm: 16,
|
|
12
|
+
md: 18,
|
|
13
|
+
lg: 20
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** Touch expansion around the clear button, in dp — it is smaller than a cell. */
|
|
17
|
+
const CLEAR_HIT_SLOP = 8;
|
|
18
|
+
/**
|
|
19
|
+
* A search field: a leading magnifier, and a clear button that appears as soon
|
|
20
|
+
* as there is text. Controlled through `value` or left to manage its own, and
|
|
21
|
+
* it defaults to the search return key so the keyboard reads correctly.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <Input.Search value={query} onChangeText={setQuery} onSubmitEditing={run} />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export const SearchInput = /*#__PURE__*/forwardRef(function SearchInput({
|
|
29
|
+
value,
|
|
30
|
+
defaultValue,
|
|
31
|
+
onChangeText,
|
|
32
|
+
onClear,
|
|
33
|
+
isClearable = true,
|
|
34
|
+
clearAccessibilityLabel = "Clear search",
|
|
35
|
+
placeholder = "Search",
|
|
36
|
+
isDisabled = false,
|
|
37
|
+
size = "md",
|
|
38
|
+
radius = "full",
|
|
39
|
+
returnKeyType = "search",
|
|
40
|
+
clearButtonMode = "never",
|
|
41
|
+
...rest
|
|
42
|
+
}, ref) {
|
|
43
|
+
// The clear button only exists while there is text, so an uncontrolled field
|
|
44
|
+
// still has to be tracked. That state also has to drive the native input:
|
|
45
|
+
// resetting it alone would hide the button while the text stayed on screen,
|
|
46
|
+
// so `TextInput` is always handed a `value`, seeded from `defaultValue` when
|
|
47
|
+
// the caller does not own one.
|
|
48
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue ?? "");
|
|
49
|
+
const isControlled = value !== undefined;
|
|
50
|
+
const text = isControlled ? value : uncontrolledValue;
|
|
51
|
+
const handleChangeText = useCallback(next => {
|
|
52
|
+
if (!isControlled) setUncontrolledValue(next);
|
|
53
|
+
onChangeText?.(next);
|
|
54
|
+
}, [isControlled, onChangeText]);
|
|
55
|
+
const handleClear = useCallback(() => {
|
|
56
|
+
if (!isControlled) setUncontrolledValue("");
|
|
57
|
+
onChangeText?.("");
|
|
58
|
+
onClear?.();
|
|
59
|
+
}, [isControlled, onChangeText, onClear]);
|
|
60
|
+
const hasText = text.length > 0;
|
|
61
|
+
return /*#__PURE__*/_jsx(InputField, {
|
|
62
|
+
ref: ref,
|
|
63
|
+
size: size,
|
|
64
|
+
radius: radius,
|
|
65
|
+
isDisabled: isDisabled,
|
|
66
|
+
placeholder: placeholder,
|
|
67
|
+
returnKeyType: returnKeyType
|
|
68
|
+
// iOS's native clear button would sit beside ours; ours is the
|
|
69
|
+
// cross-platform one, so the native affordance stays off by default.
|
|
70
|
+
,
|
|
71
|
+
clearButtonMode: clearButtonMode,
|
|
72
|
+
value: text,
|
|
73
|
+
onChangeText: handleChangeText,
|
|
74
|
+
leading: /*#__PURE__*/_jsx(Icon, {
|
|
75
|
+
name: "terra.search",
|
|
76
|
+
size: ICON_SIZE[size],
|
|
77
|
+
color: "text.tertiary"
|
|
78
|
+
}),
|
|
79
|
+
trailing: isClearable && hasText && !isDisabled ? /*#__PURE__*/_jsx(Pressable, {
|
|
80
|
+
accessibilityLabel: clearAccessibilityLabel,
|
|
81
|
+
accessibilityRole: "button",
|
|
82
|
+
hitSlop: CLEAR_HIT_SLOP,
|
|
83
|
+
onPress: handleClear,
|
|
84
|
+
style: styles.clear,
|
|
85
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
86
|
+
name: "terra.x",
|
|
87
|
+
size: ICON_SIZE[size],
|
|
88
|
+
color: "text.tertiary"
|
|
89
|
+
})
|
|
90
|
+
}) : undefined,
|
|
91
|
+
...rest
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
const styles = StyleSheet.create(() => ({
|
|
95
|
+
clear: {
|
|
96
|
+
alignItems: "center",
|
|
97
|
+
justifyContent: "center"
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useCallback","useState","StyleSheet","Icon","InputField","jsx","_jsx","ICON_SIZE","sm","md","lg","CLEAR_HIT_SLOP","SearchInput","value","defaultValue","onChangeText","onClear","isClearable","clearAccessibilityLabel","placeholder","isDisabled","size","radius","returnKeyType","clearButtonMode","rest","ref","uncontrolledValue","setUncontrolledValue","isControlled","undefined","text","handleChangeText","next","handleClear","hasText","length","leading","name","color","trailing","Pressable","accessibilityLabel","accessibilityRole","hitSlop","onPress","style","styles","clear","children","create","alignItems","justifyContent"],"sourceRoot":"../../../../../../src","sources":["components/input/variants/SearchInput/index.tsx"],"mappings":";;;AAAA,SAA4BA,UAAU,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAG5E,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,IAAI;AACb,SAASC,UAAU;AAAiC,SAAAC,GAAA,IAAAC,IAAA;AAGpD;AACA,MAAMC,SAAS,GAAG;EAAEC,EAAE,EAAE,EAAE;EAAEC,EAAE,EAAE,EAAE;EAAEC,EAAE,EAAE;AAAG,CAAU;;AAErD;AACA,MAAMC,cAAc,GAAG,CAAC;AAcxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,gBAAGb,UAAU,CAAmD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;IAAA;IACAC,eAAe,EAAEA,eAAgB;IACjCX,KAAK,EAAEkB,IAAK;IACZhB,YAAY,EAAEiB,gBAAiB;IAC/BK,OAAO,eAAE/B,IAAA,CAACH,IAAI;MAACmC,IAAI,EAAC,cAAc;MAACjB,IAAI,EAAEd,SAAS,CAACc,IAAI,CAAE;MAACkB,KAAK,EAAC;IAAe,CAAE,CAAE;IACnFC,QAAQ,EACNvB,WAAW,IAAIkB,OAAO,IAAI,CAACf,UAAU,gBACnCd,IAAA,CAACmC,SAAS;MACRC,kBAAkB,EAAExB,uBAAwB;MAC5CyB,iBAAiB,EAAC,QAAQ;MAC1BC,OAAO,EAAEjC,cAAe;MACxBkC,OAAO,EAAEX,WAAY;MACrBY,KAAK,EAAEC,MAAM,CAACC,KAAM;MAAAC,QAAA,eAEpB3C,IAAA,CAACH,IAAI;QAACmC,IAAI,EAAC,SAAS;QAACjB,IAAI,EAAEd,SAAS,CAACc,IAAI,CAAE;QAACkB,KAAK,EAAC;MAAe,CAAE;IAAC,CAC3D,CAAC,GACVT,SACL;IAAA,GACGL;EAAI,CACT,CAAC;AAEN,CAAC,CAAC;AAEF,MAAMsB,MAAM,GAAG7C,UAAU,CAACgD,MAAM,CAAC,OAAO;EACtCF,KAAK,EAAE;IACLG,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -29,6 +29,7 @@ export function ScreenScrollProvider({
|
|
|
29
29
|
hasHeader = false
|
|
30
30
|
}) {
|
|
31
31
|
const scrollY = useSharedValue(0);
|
|
32
|
+
const [headerAccessoryHeight, setAccessoryHeight] = useState(0);
|
|
32
33
|
const headerCollapseHeight = useSharedValue(0);
|
|
33
34
|
const [headerSnapOffsets, setHeaderSnapOffsets] = useState();
|
|
34
35
|
const scrollRef = useAnimatedRef();
|
|
@@ -37,6 +38,12 @@ export function ScreenScrollProvider({
|
|
|
37
38
|
headerCollapseHeight.value = rounded;
|
|
38
39
|
setHeaderSnapOffsets(rounded > 0 ? [0, rounded] : undefined);
|
|
39
40
|
}, [headerCollapseHeight]);
|
|
41
|
+
|
|
42
|
+
// Rounded so a subpixel layout measurement cannot loop the content padding
|
|
43
|
+
// against the layout that produced it.
|
|
44
|
+
const setHeaderAccessoryHeight = useCallback(height => {
|
|
45
|
+
setAccessoryHeight(Math.max(0, Math.round(height)));
|
|
46
|
+
}, []);
|
|
40
47
|
const scrollHandler = useAnimatedScrollHandler({
|
|
41
48
|
onScroll: event => {
|
|
42
49
|
scrollY.value = event.contentOffset.y;
|
|
@@ -51,13 +58,15 @@ export function ScreenScrollProvider({
|
|
|
51
58
|
platformInsetsEligible,
|
|
52
59
|
margins: contentPadding,
|
|
53
60
|
hasHeader,
|
|
61
|
+
headerAccessoryHeight,
|
|
62
|
+
setHeaderAccessoryHeight,
|
|
54
63
|
scrollY,
|
|
55
64
|
headerCollapseHeight,
|
|
56
65
|
headerSnapOffsets,
|
|
57
66
|
setHeaderCollapseHeight,
|
|
58
67
|
scrollRef,
|
|
59
68
|
scrollHandler
|
|
60
|
-
}), [background, contentPadding, safeArea, contentOwnsBottomInset, platformAdjustsInsets, platformInsetsEligible, hasHeader, scrollY, headerCollapseHeight, headerSnapOffsets, setHeaderCollapseHeight, scrollRef, scrollHandler]);
|
|
69
|
+
}), [background, contentPadding, safeArea, contentOwnsBottomInset, platformAdjustsInsets, platformInsetsEligible, hasHeader, headerAccessoryHeight, setHeaderAccessoryHeight, scrollY, headerCollapseHeight, headerSnapOffsets, setHeaderCollapseHeight, scrollRef, scrollHandler]);
|
|
61
70
|
return /*#__PURE__*/_jsx(ScreenContext.Provider, {
|
|
62
71
|
value: value,
|
|
63
72
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useCallback","useContext","useMemo","useState","useAnimatedRef","useAnimatedScrollHandler","useSharedValue","jsx","_jsx","SCREEN_HEADER_PORTAL_HOST","ScreenContext","ScreenScrollProvider","background","children","contentPadding","safeArea","contentOwnsBottomInset","platformAdjustsInsets","platformInsetsEligible","hasHeader","scrollY","headerCollapseHeight","headerSnapOffsets","setHeaderSnapOffsets","scrollRef","setHeaderCollapseHeight","height","rounded","Math","round","value","undefined","scrollHandler","onScroll","event","contentOffset","y","margins","Provider","useScreen","context","Error"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAkBC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEjG,SAIEC,cAAc,EACdC,wBAAwB,EACxBC,cAAc,QACT,yBAAyB;;AAIhC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGA;AACA,OAAO,MAAMC,yBAAyB,GAAG,eAAe;;AAExD;;
|
|
1
|
+
{"version":3,"names":["createContext","useCallback","useContext","useMemo","useState","useAnimatedRef","useAnimatedScrollHandler","useSharedValue","jsx","_jsx","SCREEN_HEADER_PORTAL_HOST","ScreenContext","ScreenScrollProvider","background","children","contentPadding","safeArea","contentOwnsBottomInset","platformAdjustsInsets","platformInsetsEligible","hasHeader","scrollY","headerAccessoryHeight","setAccessoryHeight","headerCollapseHeight","headerSnapOffsets","setHeaderSnapOffsets","scrollRef","setHeaderCollapseHeight","height","rounded","Math","round","value","undefined","setHeaderAccessoryHeight","max","scrollHandler","onScroll","event","contentOffset","y","margins","Provider","useScreen","context","Error"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAkBC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEjG,SAIEC,cAAc,EACdC,wBAAwB,EACxBC,cAAc,QACT,yBAAyB;;AAIhC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGA;AACA,OAAO,MAAMC,yBAAyB,GAAG,eAAe;;AAExD;;AAwFA,OAAO,MAAMC,aAAa,gBAAGX,aAAa,CAA4B,IAAI,CAAC;;AA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CAACC,CAAC;IACvC;EACF,CAAC,CAAC;EAEF,MAAMR,KAAK,GAAG9B,OAAO,CACnB,OAAO;IACLU,UAAU;IACVE,cAAc;IACdC,QAAQ;IACRC,sBAAsB;IACtBC,qBAAqB;IACrBC,sBAAsB;IACtBuB,OAAO,EAAE3B,cAAc;IACvBK,SAAS;IACTE,qBAAqB;IACrBa,wBAAwB;IACxBd,OAAO;IACPG,oBAAoB;IACpBC,iBAAiB;IACjBG,uBAAuB;IACvBD,SAAS;IACTU;EACF,CAAC,CAAC,EACF,CACExB,UAAU,EACVE,cAAc,EACdC,QAAQ,EACRC,sBAAsB,EACtBC,qBAAqB,EACrBC,sBAAsB,EACtBC,SAAS,EACTE,qBAAqB,EACrBa,wBAAwB,EACxBd,OAAO,EACPG,oBAAoB,EACpBC,iBAAiB,EACjBG,uBAAuB,EACvBD,SAAS,EACTU,aAAa,CAEjB,CAAC;EAED,oBAAO5B,IAAA,CAACE,aAAa,CAACgC,QAAQ;IAACV,KAAK,EAAEA,KAAM;IAAAnB,QAAA,EAAEA;EAAQ,CAAyB,CAAC;AAClF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS8B,SAASA,CAAA,EAAuB;EAC9C,MAAMC,OAAO,GAAG3C,UAAU,CAACS,aAAa,CAAC;EACzC,IAAI,CAACkC,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,kDAAkD,CAAC;EACrE;EACA,OAAOD,OAAO;AAChB","ignoreList":[]}
|
|
@@ -62,6 +62,7 @@ const ScreenListBase = /*#__PURE__*/forwardRef(function ScreenList({
|
|
|
62
62
|
headerSnapOffsets,
|
|
63
63
|
contentPadding: screenPadding,
|
|
64
64
|
hasHeader,
|
|
65
|
+
headerAccessoryHeight,
|
|
65
66
|
contentOwnsBottomInset,
|
|
66
67
|
platformAdjustsInsets
|
|
67
68
|
} = useScreen();
|
|
@@ -106,7 +107,7 @@ const ScreenListBase = /*#__PURE__*/forwardRef(function ScreenList({
|
|
|
106
107
|
contentInsetAdjustmentBehavior: platformAdjustsInsets ? "automatic" : "never",
|
|
107
108
|
automaticallyAdjustContentInsets: false,
|
|
108
109
|
automaticallyAdjustsScrollIndicatorInsets: false,
|
|
109
|
-
contentContainerStyle: [styles.content(resolvedPadding, hasHeader, bottomInset, extraBottomPadding), contentContainerStyle],
|
|
110
|
+
contentContainerStyle: [styles.content(resolvedPadding, hasHeader, bottomInset, extraBottomPadding, headerAccessoryHeight), contentContainerStyle],
|
|
110
111
|
ListHeaderComponent: header,
|
|
111
112
|
ListFooterComponent: footer,
|
|
112
113
|
ListEmptyComponent: placeholder ?? ListEmptyComponent,
|
|
@@ -139,14 +140,15 @@ const ScreenListBase = /*#__PURE__*/forwardRef(function ScreenList({
|
|
|
139
140
|
export const ScreenList = ScreenListBase;
|
|
140
141
|
ScreenList.displayName = "Screen.List";
|
|
141
142
|
const styles = StyleSheet.create((theme, runtime) => ({
|
|
142
|
-
content: (padding, hasHeader, bottomInset, extraBottomPadding) => {
|
|
143
|
+
content: (padding, hasHeader, bottomInset, extraBottomPadding, accessoryHeight) => {
|
|
143
144
|
const {
|
|
144
145
|
x,
|
|
145
146
|
y
|
|
146
147
|
} = resolveScreenPadding(theme, runtime.breakpoint);
|
|
147
148
|
return {
|
|
148
149
|
flexGrow: 1,
|
|
149
|
-
|
|
150
|
+
// The theme height covers the bar; an accessory pinned under it is extra.
|
|
151
|
+
paddingTop: (hasHeader ? theme.layout.header.height + accessoryHeight : 0) + (hasVerticalPadding(padding) ? y : 0),
|
|
150
152
|
paddingHorizontal: hasHorizontalPadding(padding) ? x : 0,
|
|
151
153
|
paddingBottom: (bottomInset ?? (hasVerticalPadding(padding) ? y : 0)) + extraBottomPadding,
|
|
152
154
|
uni__dependencies: [0, 3]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useMemo","Animated","StyleSheet","resolveScreenPadding","PortalHost","useNestedContainerWarning","useScreenRef","useScreenScrollHandler","ScreenBottomInset","renderScreenPlaceholder","SCREEN_HEADER_PORTAL_HOST","useScreen","hasHorizontalPadding","hasVerticalPadding","renderListComponent","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ScreenListBase","ScreenList","as","data","renderItem","style","contentContainerStyle","ListHeaderComponent","ListFooterComponent","ListEmptyComponent","horizontal","isLoading","loading","loadingContent","LoadingComponent","emptyContent","EmptyComponent","contentPadding","margins","bottomInset","extraBottomPadding","scrollHandler","externalScrollHandler","onScroll","rest","ref","isDefaultFlatList","undefined","FlatList","Component","AnimatedComponent","createAnimatedComponent","background","scrollRef","headerSnapOffsets","screenPadding","hasHeader","contentOwnsBottomInset","platformAdjustsInsets","ownsBottomInset","mergedRef","resolvedPadding","resolvedLoading","placeholder","isEmpty","length","composedScrollHandler","header","children","View","styles","headerWrapper","name","footer","backgroundColor","contentInsetAdjustmentBehavior","automaticallyAdjustContentInsets","automaticallyAdjustsScrollIndicatorInsets","content","showsVerticalScrollIndicator","scrollEventThrottle","snapToOffsets","displayName","create","theme","runtime","padding","x","y","breakpoint","flexGrow","paddingTop","layout","height","paddingHorizontal","paddingBottom","uni__dependencies","marginHorizontal"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenList.tsx"],"mappings":";;;;AAAA,SAKEA,UAAU,EAIVC,OAAO,QACF,OAAO;AAGd,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,oBAAoB;AAC7B,SAASC,UAAU;AACnB,SAASC,yBAAyB;AAClC,SAASC,YAAY;AACrB,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAC1B,SAASC,uBAAuB;AAChC,SAASC,yBAAyB,EAAEC,SAAS;AAE7C,SAASC,oBAAoB,EAAEC,kBAAkB,EAAEC,mBAAmB;;AAEtE;;AAKA;;AAgBA;;AAyBA;;AA+BA;;AAiBA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAiBA,MAAMC,cAAc,gBAAGtB,UAAU,CAAC,SAASuB,UAAUA,CACnD;EACEC,EAAE;EACFC,IAAI;EACJC,UAAU;EACVC,KAAK;EACLC,qBAAqB;EACrBC,mBAAmB;EACnBC,mBAAmB;EACnBC,kBAAkB;EAClBC,UAAU,GAAG,KAAK;EAClBC,SAAS;EACTC,OAAO,GAAG,KAAK;EACfC,cAAc;EACdC,gBAAgB;EAChBC,YAAY;EACZC,cAAc;EACdC,cAAc;EACdC,OAAO;EACPC,WAAW;EACXC,kBAAkB,GAAG,CAAC;EACtBC,aAAa,EAAEC,qBAAqB;EACpCC,QAAQ;EACR,GAAGC;AACgB,CAAC,EACtBC,GAAiB,EACjB;EACA,MAAMC,iBAAiB,GAAGxB,EAAE,KAAKyB,SAAS,IAAIzB,EAAE,KAAK0B,QAAQ;EAC7D,MAAMC,SAAS,GAAI3B,EAAE,IAAI0B,QAAmD;EAC5E;EACA,MAAME,iBAAiB,GAAGnD,OAAO,CAAC,MAAMC,QAAQ,CAACmD,uBAAuB,CAACF,SAAS,CAAC,EAAE,CAACA,SAAS,CAAC,CAAC;EACjG,MAAM;IACJG,UAAU;IACVC,SAAS;IACTZ,aAAa;IACba,iBAAiB;IACjBjB,cAAc,EAAEkB,aAAa;IAC7BC,SAAS;IACTC,sBAAsB;IACtBC;EACF,CAAC,
|
|
1
|
+
{"version":3,"names":["forwardRef","useMemo","Animated","StyleSheet","resolveScreenPadding","PortalHost","useNestedContainerWarning","useScreenRef","useScreenScrollHandler","ScreenBottomInset","renderScreenPlaceholder","SCREEN_HEADER_PORTAL_HOST","useScreen","hasHorizontalPadding","hasVerticalPadding","renderListComponent","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ScreenListBase","ScreenList","as","data","renderItem","style","contentContainerStyle","ListHeaderComponent","ListFooterComponent","ListEmptyComponent","horizontal","isLoading","loading","loadingContent","LoadingComponent","emptyContent","EmptyComponent","contentPadding","margins","bottomInset","extraBottomPadding","scrollHandler","externalScrollHandler","onScroll","rest","ref","isDefaultFlatList","undefined","FlatList","Component","AnimatedComponent","createAnimatedComponent","background","scrollRef","headerSnapOffsets","screenPadding","hasHeader","headerAccessoryHeight","contentOwnsBottomInset","platformAdjustsInsets","ownsBottomInset","mergedRef","resolvedPadding","resolvedLoading","placeholder","isEmpty","length","composedScrollHandler","header","children","View","styles","headerWrapper","name","footer","backgroundColor","contentInsetAdjustmentBehavior","automaticallyAdjustContentInsets","automaticallyAdjustsScrollIndicatorInsets","content","showsVerticalScrollIndicator","scrollEventThrottle","snapToOffsets","displayName","create","theme","runtime","padding","accessoryHeight","x","y","breakpoint","flexGrow","paddingTop","layout","height","paddingHorizontal","paddingBottom","uni__dependencies","marginHorizontal"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenList.tsx"],"mappings":";;;;AAAA,SAKEA,UAAU,EAIVC,OAAO,QACF,OAAO;AAGd,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,oBAAoB;AAC7B,SAASC,UAAU;AACnB,SAASC,yBAAyB;AAClC,SAASC,YAAY;AACrB,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAC1B,SAASC,uBAAuB;AAChC,SAASC,yBAAyB,EAAEC,SAAS;AAE7C,SAASC,oBAAoB,EAAEC,kBAAkB,EAAEC,mBAAmB;;AAEtE;;AAKA;;AAgBA;;AAyBA;;AA+BA;;AAiBA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAiBA,MAAMC,cAAc,gBAAGtB,UAAU,CAAC,SAASuB,UAAUA,CACnD;EACEC,EAAE;EACFC,IAAI;EACJC,UAAU;EACVC,KAAK;EACLC,qBAAqB;EACrBC,mBAAmB;EACnBC,mBAAmB;EACnBC,kBAAkB;EAClBC,UAA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,oBAAoB,CAAC4E,OAAO,CAAC,GAAG,CAACrF,oBAAoB,CAACmF,KAAK,EAAEC,OAAO,CAACK,UAAU,CAAC,CAACF,CAAC,GAAG,CAAC;IAAAS,iBAAA;EAC1G,CAAC;AACH,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -58,6 +58,7 @@ export const ScreenScrollView = /*#__PURE__*/forwardRef(function ScreenScrollVie
|
|
|
58
58
|
scrollHandler,
|
|
59
59
|
contentPadding: screenPadding,
|
|
60
60
|
hasHeader,
|
|
61
|
+
headerAccessoryHeight,
|
|
61
62
|
background,
|
|
62
63
|
contentOwnsBottomInset,
|
|
63
64
|
platformAdjustsInsets
|
|
@@ -91,7 +92,7 @@ export const ScreenScrollView = /*#__PURE__*/forwardRef(function ScreenScrollVie
|
|
|
91
92
|
automaticallyAdjustsScrollIndicatorInsets: false,
|
|
92
93
|
showsVerticalScrollIndicator: false,
|
|
93
94
|
scrollEventThrottle: 16,
|
|
94
|
-
contentContainerStyle: [styles.scrollContent(hasHeader, resolvedPadding, extraBottomPadding), contentContainerStyle],
|
|
95
|
+
contentContainerStyle: [styles.scrollContent(hasHeader, resolvedPadding, extraBottomPadding, headerAccessoryHeight), contentContainerStyle],
|
|
95
96
|
...rest,
|
|
96
97
|
onScroll: composedScrollHandler,
|
|
97
98
|
children: [/*#__PURE__*/_jsx(View, {
|
|
@@ -107,14 +108,15 @@ export const ScreenScrollView = /*#__PURE__*/forwardRef(function ScreenScrollVie
|
|
|
107
108
|
});
|
|
108
109
|
ScreenScrollView.displayName = "Screen.ScrollView";
|
|
109
110
|
const styles = StyleSheet.create((theme, runtime) => ({
|
|
110
|
-
scrollContent: (hasHeader, padding, extraBottomPadding) => {
|
|
111
|
+
scrollContent: (hasHeader, padding, extraBottomPadding, accessoryHeight) => {
|
|
111
112
|
const {
|
|
112
113
|
x,
|
|
113
114
|
y
|
|
114
115
|
} = resolveScreenPadding(theme, runtime.breakpoint);
|
|
115
116
|
return {
|
|
116
117
|
flexGrow: 1,
|
|
117
|
-
|
|
118
|
+
// The theme height covers the bar; an accessory pinned under it is extra.
|
|
119
|
+
paddingTop: (hasHeader ? theme.layout.header.height + accessoryHeight : 0) + (hasVerticalPadding(padding) ? y : 0),
|
|
118
120
|
paddingHorizontal: hasHorizontalPadding(padding) ? x : 0,
|
|
119
121
|
paddingBottom: (hasVerticalPadding(padding) ? y : 0) + extraBottomPadding,
|
|
120
122
|
uni__dependencies: [0, 3]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Children","forwardRef","Animated","StyleSheet","resolveScreenPadding","PortalHost","useNestedContainerWarning","useScreenRef","useScreenScrollHandler","ScreenBottomInset","renderScreenPlaceholder","SCREEN_HEADER_PORTAL_HOST","useScreen","hasHorizontalPadding","hasVerticalPadding","jsx","_jsx","jsxs","_jsxs","ScreenScrollView","children","style","contentContainerStyle","contentStyle","scrollHandler","externalScrollHandler","onScroll","horizontal","isLoading","loading","loadingContent","LoadingComponent","emptyContent","EmptyComponent","contentPadding","margins","extraBottomPadding","isEmpty","rest","ref","scrollRef","screenPadding","hasHeader","background","contentOwnsBottomInset","platformAdjustsInsets","ownsBottomInset","resolvedPadding","mergedRef","placeholder","undefined","toArray","length","composedScrollHandler","ScrollView","backgroundColor","contentInsetAdjustmentBehavior","automaticallyAdjustContentInsets","automaticallyAdjustsScrollIndicatorInsets","showsVerticalScrollIndicator","scrollEventThrottle","styles","scrollContent","View","headerWrapper","name","content","displayName","create","theme","runtime","padding","x","y","breakpoint","flexGrow","paddingTop","layout","header","height","paddingHorizontal","paddingBottom","uni__dependencies","marginHorizontal","flexDirection"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenScrollView.tsx"],"mappings":";;;AAAA,SAASA,QAAQ,EAAqBC,UAAU,QAAwB,OAAO;AAG/E,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,oBAAoB;AAC7B,SAASC,UAAU;AACnB,SAASC,yBAAyB;AAClC,SAASC,YAAY;AACrB,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAC1B,SAASC,uBAAuB;AAChC,SAASC,yBAAyB,EAAEC,SAAS;AAE7C,SAASC,oBAAoB,EAAEC,kBAAkB;;AAEjD;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,gBAAGlB,UAAU,CACxC,SAASkB,gBAAgBA,CACvB;EACEC,QAAQ;EACRC,KAAK;EACLC,qBAAqB;EACrBC,YAAY;EACZC,aAAa,EAAEC,qBAAqB;EACpCC,QAAQ;EACRC,UAAU,GAAG,KAAK;EAClBC,SAAS;EACTC,OAAO,GAAG,KAAK;EACfC,cAAc;EACdC,gBAAgB;EAChBC,YAAY;EACZC,cAAc;EACdC,cAAc;EACdC,OAAO;EACPC,kBAAkB,GAAG,CAAC;EACtBC,OAAO;EACP,GAAGC;AACL,CAAC,EACDC,GAAG,EACH;EACA,MAAM;IACJC,SAAS;IACThB,aAAa;IACbU,cAAc,EAAEO,aAAa;IAC7BC,SAAS;IACTC,UAAU;IACVC,sBAAsB;IACtBC;EACF,CAAC,
|
|
1
|
+
{"version":3,"names":["Children","forwardRef","Animated","StyleSheet","resolveScreenPadding","PortalHost","useNestedContainerWarning","useScreenRef","useScreenScrollHandler","ScreenBottomInset","renderScreenPlaceholder","SCREEN_HEADER_PORTAL_HOST","useScreen","hasHorizontalPadding","hasVerticalPadding","jsx","_jsx","jsxs","_jsxs","ScreenScrollView","children","style","contentContainerStyle","contentStyle","scrollHandler","externalScrollHandler","onScroll","horizontal","isLoading","loading","loadingContent","LoadingComponent","emptyContent","EmptyComponent","contentPadding","margins","extraBottomPadding","isEmpty","rest","ref","scrollRef","screenPadding","hasHeader","headerAccessoryHeight","background","contentOwnsBottomInset","platformAdjustsInsets","ownsBottomInset","resolvedPadding","mergedRef","placeholder","undefined","toArray","length","composedScrollHandler","ScrollView","backgroundColor","contentInsetAdjustmentBehavior","automaticallyAdjustContentInsets","automaticallyAdjustsScrollIndicatorInsets","showsVerticalScrollIndicator","scrollEventThrottle","styles","scrollContent","View","headerWrapper","name","content","displayName","create","theme","runtime","padding","accessoryHeight","x","y","breakpoint","flexGrow","paddingTop","layout","header","height","paddingHorizontal","paddingBottom","uni__dependencies","marginHorizontal","flexDirection"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenScrollView.tsx"],"mappings":";;;AAAA,SAASA,QAAQ,EAAqBC,UAAU,QAAwB,OAAO;AAG/E,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,oBAAoB;AAC7B,SAASC,UAAU;AACnB,SAASC,yBAAyB;AAClC,SAASC,YAAY;AACrB,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAC1B,SAASC,uBAAuB;AAChC,SAASC,yBAAyB,EAAEC,SAAS;AAE7C,SAASC,oBAAoB,EAAEC,kBAAkB;;AAEjD;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,gBAAGlB,UAAU,CACxC,SAASkB,gBAAgBA,CACvB;EACEC,QAAQ;EACRC,KAAK;EACLC,qBAAqB;EACrBC,YAAY;EACZC,aAAa,EAAEC,qBAAqB;EACpCC,QAAQ;EACRC,UAAU,GAAG,KAAK;EAClBC,SAAS;EACTC,OAAO,GAAG,KAAK;EACfC,cAAc;EACdC,gBAAgB;EAChBC,YAAY;EACZC,cAAc;EACdC,cAAc;EACdC,OAAO;EACPC,kBAAkB,GAAG,CAAC;EACtBC,OAAO;EACP,GAAGC;AACL,CAAC,EACDC,GAAG,EACH;EACA,MAA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