react-native-ui-lib 8.4.1 → 8.4.2-snapshot.7918
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/package.json +1 -1
- package/package.json +4 -5
- package/src/components/WheelPicker/usePresenter.d.ts +0 -1
- package/src/components/chipsInput/index.d.ts +2 -0
- package/src/components/colorPicker/ColorPickerPresenter.d.ts +1 -1
- package/src/components/floatingButton/index.js +8 -5
- package/src/components/screenFooter/index.js +10 -2
- package/src/components/textField/TextField.driver.new.js +7 -12
- package/src/components/textField/index.js +9 -31
- package/src/helpers/AvatarHelper.d.ts +1 -1
- package/src/incubator/slider/Thumb.js +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +14 -0
- package/src/testkit/Component.driver.d.ts +0 -1
- package/src/testkit/drivers/TestingLibraryDriver.d.ts +0 -1
package/lib/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-ui-lib",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.2-snapshot.7918",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"author": "Ethan Sharabi <ethan.shar@gmail.com>",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"date-fns": "^2.29.3",
|
|
35
35
|
"deprecated-react-native-prop-types": "^2.3.0",
|
|
36
36
|
"hoist-non-react-statics": "^3.0.0",
|
|
37
|
-
"lodash": "
|
|
37
|
+
"lodash": "4.18.1",
|
|
38
38
|
"memoize-one": "^5.0.5",
|
|
39
39
|
"prop-types": "^15.5.10",
|
|
40
40
|
"react-freeze": "^1.0.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@react-native/metro-config": "0.77.3",
|
|
67
67
|
"@react-native/typescript-config": "0.77.3",
|
|
68
68
|
"@shopify/flash-list": "1.7.6",
|
|
69
|
-
"@testing-library/react-native": "
|
|
69
|
+
"@testing-library/react-native": "12.9.0",
|
|
70
70
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
71
71
|
"@types/jest": "^29.5.13",
|
|
72
72
|
"@types/lodash": "^4.0.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"light-date": "^1.2.0",
|
|
83
83
|
"moment": "^2.24.0",
|
|
84
84
|
"object-hash": "^3.0.0",
|
|
85
|
-
"postcss": "^8.
|
|
85
|
+
"postcss": "^8.5.8",
|
|
86
86
|
"postcss-js": "^4.0.0",
|
|
87
87
|
"prettier": "^3.2.5",
|
|
88
88
|
"react": "18.3.1",
|
|
@@ -112,7 +112,6 @@
|
|
|
112
112
|
"react-native": ">=0.77.3",
|
|
113
113
|
"react-native-gesture-handler": ">=2.24.0",
|
|
114
114
|
"react-native-reanimated": ">=3.17.5",
|
|
115
|
-
"react-native-safe-area-context": ">=5.6.2",
|
|
116
115
|
"uilib-native": "^5.0.1"
|
|
117
116
|
},
|
|
118
117
|
"jest": {
|
|
@@ -5,6 +5,8 @@ export declare enum ChipsInputChangeReason {
|
|
|
5
5
|
Added = "added",
|
|
6
6
|
Removed = "removed"
|
|
7
7
|
}
|
|
8
|
+
type ChipsInputChangeReasonUnion = `${ChipsInputChangeReason}`;
|
|
9
|
+
export type ChipsInputChangeReasonProps = ChipsInputChangeReasonUnion | ChipsInputChangeReason;
|
|
8
10
|
export type ChipsInputChipProps = ChipProps & {
|
|
9
11
|
invalid?: boolean;
|
|
10
12
|
};
|
|
@@ -12,5 +12,5 @@ export declare function getValidColorString(text?: string): {
|
|
|
12
12
|
valid: boolean;
|
|
13
13
|
hex?: undefined;
|
|
14
14
|
};
|
|
15
|
-
export declare function getHexString(color: HSLColor): string
|
|
15
|
+
export declare function getHexString(color: HSLColor): Uppercase<string>;
|
|
16
16
|
export declare function getTextColor(color: string): string;
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useMemo } from 'react';
|
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
3
|
import { asBaseComponent, Constants } from "../../commons/new";
|
|
4
4
|
import { LogService } from "../../services";
|
|
5
|
-
import { Colors, Shadows } from "../../style";
|
|
5
|
+
import { Colors, Shadows, Spacings } from "../../style";
|
|
6
6
|
import Button from "../button";
|
|
7
7
|
import ScreenFooter, { ScreenFooterLayouts, ScreenFooterBackgrounds, KeyboardBehavior, ItemsFit } from "../screenFooter";
|
|
8
8
|
export let FloatingButtonLayouts = /*#__PURE__*/function (FloatingButtonLayouts) {
|
|
@@ -35,16 +35,19 @@ const FloatingButton = props => {
|
|
|
35
35
|
// eslint-disable-next-line max-len
|
|
36
36
|
LogService.warn('RNUILib FloatingButton now uses ScreenFooter internally, which requires a SafeAreaProvider. If you experience safe area issues, please wrap your app (or the relevant screen) with <SafeAreaProvider>.');
|
|
37
37
|
}, []);
|
|
38
|
+
const isSecondaryOnly = !!secondaryButton && !button;
|
|
39
|
+
const isHorizontal = buttonLayout === FloatingButtonLayouts.HORIZONTAL || isSecondaryOnly;
|
|
38
40
|
const footerContentContainerStyle = useMemo(() => {
|
|
39
41
|
if (bottomMargin !== undefined) {
|
|
40
42
|
return {
|
|
41
43
|
paddingBottom: bottomMargin
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const isSecondaryAtBottom = !!secondaryButton && (isSecondaryOnly || !isHorizontal);
|
|
47
|
+
return {
|
|
48
|
+
paddingBottom: isSecondaryAtBottom ? Spacings.s7 : Spacings.s8
|
|
49
|
+
};
|
|
50
|
+
}, [bottomMargin, secondaryButton, isSecondaryOnly, isHorizontal]);
|
|
48
51
|
if (!button && !secondaryButton) {
|
|
49
52
|
return null;
|
|
50
53
|
}
|
|
@@ -31,6 +31,7 @@ const ScreenFooter = props => {
|
|
|
31
31
|
isAndroidEdgeToEdge = !!androidVersion && androidVersion >= 35 ? true : undefined,
|
|
32
32
|
contentContainerStyle: contentContainerStyleOverride
|
|
33
33
|
} = props;
|
|
34
|
+
const withoutAnimation = animationDuration === 0;
|
|
34
35
|
const keyboard = useAnimatedKeyboard({
|
|
35
36
|
isNavigationBarTranslucentAndroid: isAndroidEdgeToEdge,
|
|
36
37
|
isStatusBarTranslucentAndroid: isAndroidEdgeToEdge
|
|
@@ -181,10 +182,17 @@ const ScreenFooter = props => {
|
|
|
181
182
|
</View>
|
|
182
183
|
</>;
|
|
183
184
|
}, [renderBackground, testID, contentContainerStyle, childrenArray]);
|
|
185
|
+
const Container = useMemo(() => {
|
|
186
|
+
return withoutAnimation ? View : Animated.View;
|
|
187
|
+
}, [withoutAnimation]);
|
|
188
|
+
const containerStyle = useMemo(() => {
|
|
189
|
+
return withoutAnimation ? styles.container : [styles.container, hoistedAnimatedStyle];
|
|
190
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
191
|
+
}, [withoutAnimation]);
|
|
184
192
|
if (keyboardBehavior === KeyboardBehavior.HOISTED) {
|
|
185
|
-
return <
|
|
193
|
+
return <Container style={containerStyle} pointerEvents={visible ? 'box-none' : 'none'}>
|
|
186
194
|
<Keyboard.KeyboardAccessoryView renderContent={renderFooterContent} kbInputRef={undefined} scrollBehavior={Keyboard.KeyboardAccessoryView.scrollBehaviors.FIXED_OFFSET} useSafeArea={false} manageScrollView={false} revealKeyboardInteractive onHeightChanged={setHeight} />
|
|
187
|
-
</
|
|
195
|
+
</Container>;
|
|
188
196
|
}
|
|
189
197
|
return <Animated.View testID={testID} onLayout={onLayout} style={[styles.container, stickyAnimatedStyle]}>
|
|
190
198
|
{renderFooterContent()}
|
|
@@ -9,10 +9,6 @@ import { ButtonDriver } from "../button/Button.driver.new";
|
|
|
9
9
|
import { ViewDriver } from "../view/View.driver.new";
|
|
10
10
|
export const TextFieldDriver = (props, options) => {
|
|
11
11
|
const driver = usePressableDriver(useComponentDriver(props, options));
|
|
12
|
-
const inputDriver = useComponentDriver({
|
|
13
|
-
renderTree: props.renderTree,
|
|
14
|
-
testID: `${props.testID}.input`
|
|
15
|
-
}, options);
|
|
16
12
|
const floatingPlaceholderDriver = TextDriver({
|
|
17
13
|
renderTree: props.renderTree,
|
|
18
14
|
testID: `${props.testID}.floatingPlaceholder`
|
|
@@ -45,31 +41,30 @@ export const TextFieldDriver = (props, options) => {
|
|
|
45
41
|
renderTree: props.renderTree,
|
|
46
42
|
testID: `${props.testID}.clearButton.container`
|
|
47
43
|
});
|
|
48
|
-
const getInputElement = () => inputDriver.queryElement() ?? driver.getElement();
|
|
49
44
|
const getValue = () => {
|
|
50
|
-
return
|
|
45
|
+
return driver.getElement().props.value ?? driver.getElement().props.defaultValue;
|
|
51
46
|
};
|
|
52
47
|
const changeText = text => {
|
|
53
|
-
fireEvent.changeText(
|
|
48
|
+
fireEvent.changeText(driver.getElement(), text);
|
|
54
49
|
};
|
|
55
50
|
const focus = () => {
|
|
56
|
-
fireEvent(
|
|
51
|
+
fireEvent(driver.getElement(), 'focus');
|
|
57
52
|
};
|
|
58
53
|
const blur = () => {
|
|
59
|
-
fireEvent(
|
|
54
|
+
fireEvent(driver.getElement(), 'blur');
|
|
60
55
|
};
|
|
61
56
|
const isEnabled = () => {
|
|
62
|
-
return !
|
|
57
|
+
return !driver.getElement().props.accessibilityState?.disabled;
|
|
63
58
|
};
|
|
64
59
|
const getPlaceholder = () => {
|
|
65
60
|
const exists = () => {
|
|
66
|
-
const hasPlaceholder = !!
|
|
61
|
+
const hasPlaceholder = !!driver.getElement().props.placeholder;
|
|
67
62
|
const hasText = !!getValue();
|
|
68
63
|
return hasPlaceholder && (!hasText || hasText && floatingPlaceholderDriver.exists());
|
|
69
64
|
};
|
|
70
65
|
const getText = () => {
|
|
71
66
|
if (exists()) {
|
|
72
|
-
return
|
|
67
|
+
return driver.getElement().props.placeholder;
|
|
73
68
|
}
|
|
74
69
|
};
|
|
75
70
|
return {
|
|
@@ -78,8 +78,6 @@ const TextField = props => {
|
|
|
78
78
|
readonly = false,
|
|
79
79
|
showMandatoryIndication,
|
|
80
80
|
clearButtonStyle,
|
|
81
|
-
testID,
|
|
82
|
-
accessibilityLabel: accessibilityLabelProp,
|
|
83
81
|
...others
|
|
84
82
|
} = usePreset(props);
|
|
85
83
|
const {
|
|
@@ -137,31 +135,11 @@ const TextField = props => {
|
|
|
137
135
|
const hasValue = fieldState.value !== undefined; // NOTE: not pressable if centered without a value (so can't center placeholder)
|
|
138
136
|
const inputStyle = useMemo(() => [typographyStyle, colorStyle, others.style, hasValue && centeredTextStyle], [typographyStyle, colorStyle, others.style, centeredTextStyle, hasValue]);
|
|
139
137
|
const dummyPlaceholderStyle = useMemo(() => [inputStyle, styles.dummyPlaceholder], [inputStyle]);
|
|
140
|
-
const defaultAccessibilityLabel = useMemo(() => {
|
|
141
|
-
const parts = [];
|
|
142
|
-
if (label) {
|
|
143
|
-
parts.push(label);
|
|
144
|
-
}
|
|
145
|
-
if (context.isMandatory) {
|
|
146
|
-
parts.push('required');
|
|
147
|
-
}
|
|
148
|
-
parts.push('textField');
|
|
149
|
-
if (helperText) {
|
|
150
|
-
parts.push(helperText);
|
|
151
|
-
} else if (placeholder) {
|
|
152
|
-
parts.push(placeholder);
|
|
153
|
-
}
|
|
154
|
-
if (showCharCounter && others.maxLength) {
|
|
155
|
-
parts.push(`you can enter up to ${others.maxLength} characters`);
|
|
156
|
-
}
|
|
157
|
-
return parts.join(', ');
|
|
158
|
-
}, [label, context.isMandatory, helperText, placeholder, showCharCounter, others.maxLength]);
|
|
159
|
-
const accessibilityLabel = accessibilityLabelProp ?? defaultAccessibilityLabel;
|
|
160
138
|
return <FieldContext.Provider value={context}>
|
|
161
|
-
<View {...containerProps}
|
|
139
|
+
<View {...containerProps} style={[margins, positionStyle, containerStyle, centeredContainerStyle]}>
|
|
162
140
|
<View row spread style={centeredContainerStyle}>
|
|
163
|
-
<Label label={label} labelColor={labelColor} labelStyle={_labelStyle} labelProps={labelProps} floatingPlaceholder={floatingPlaceholder} validationMessagePosition={validationMessagePosition} testID={`${testID}.label`} showMandatoryIndication={showMandatoryIndication} enableErrors={enableErrors} />
|
|
164
|
-
{validationMessagePosition === ValidationMessagePosition.TOP && <ValidationMessage enableErrors={enableErrors} validate={others.validate} validationMessage={others.validationMessage} validationMessageStyle={_validationMessageStyle} retainValidationSpace={retainValidationSpace && retainTopMessageSpace} testID={`${testID}.validationMessage`} />}
|
|
141
|
+
<Label label={label} labelColor={labelColor} labelStyle={_labelStyle} labelProps={labelProps} floatingPlaceholder={floatingPlaceholder} validationMessagePosition={validationMessagePosition} testID={`${props.testID}.label`} showMandatoryIndication={showMandatoryIndication} enableErrors={enableErrors} />
|
|
142
|
+
{validationMessagePosition === ValidationMessagePosition.TOP && <ValidationMessage enableErrors={enableErrors} validate={others.validate} validationMessage={others.validationMessage} validationMessageStyle={_validationMessageStyle} retainValidationSpace={retainValidationSpace && retainTopMessageSpace} testID={`${props.testID}.validationMessage`} />}
|
|
165
143
|
{topTrailingAccessory && <View>{topTrailingAccessory}</View>}
|
|
166
144
|
</View>
|
|
167
145
|
<View style={[paddings, fieldStyle]} row centerV centerH={centered}>
|
|
@@ -180,26 +158,26 @@ const TextField = props => {
|
|
|
180
158
|
{Constants.isAndroid && centered && <Text marginR-s1 style={dummyPlaceholderStyle}>
|
|
181
159
|
{placeholder}
|
|
182
160
|
</Text>}
|
|
183
|
-
{floatingPlaceholder && <FloatingPlaceholder defaultValue={others.defaultValue} placeholder={placeholder} floatingPlaceholderStyle={_floatingPlaceholderStyle} floatingPlaceholderColor={floatingPlaceholderColor} floatOnFocus={floatOnFocus} validationMessagePosition={validationMessagePosition} extraOffset={leadingAccessoryMeasurements?.width} testID={`${testID}.floatingPlaceholder`} showMandatoryIndication={showMandatoryIndication} />}
|
|
161
|
+
{floatingPlaceholder && <FloatingPlaceholder defaultValue={others.defaultValue} placeholder={placeholder} floatingPlaceholderStyle={_floatingPlaceholderStyle} floatingPlaceholderColor={floatingPlaceholderColor} floatOnFocus={floatOnFocus} validationMessagePosition={validationMessagePosition} extraOffset={leadingAccessoryMeasurements?.width} testID={`${props.testID}.floatingPlaceholder`} showMandatoryIndication={showMandatoryIndication} />}
|
|
184
162
|
<Input hitSlop={{
|
|
185
163
|
top: 20,
|
|
186
164
|
bottom: 20
|
|
187
|
-
}} placeholderTextColor={hidePlaceholder ? 'transparent' : placeholderTextColor} value={fieldState.value} {...others}
|
|
165
|
+
}} placeholderTextColor={hidePlaceholder ? 'transparent' : placeholderTextColor} value={fieldState.value} {...others} readonly={readonly} style={inputStyle} onFocus={onFocus} onBlur={onBlur} onChangeText={onChangeText} placeholder={placeholder} hint={hint} showMandatoryIndication={showMandatoryIndication && !label} />
|
|
188
166
|
</View>}
|
|
189
|
-
{showClearButton && <ClearButton onClear={onClear} testID={`${testID}.clearButton`} onChangeText={onChangeText} clearButtonStyle={clearButtonStyle} />}
|
|
167
|
+
{showClearButton && <ClearButton onClear={onClear} testID={`${props.testID}.clearButton`} onChangeText={onChangeText} clearButtonStyle={clearButtonStyle} />}
|
|
190
168
|
{trailingAccessory}
|
|
191
169
|
{/* </View> */}
|
|
192
170
|
</View>
|
|
193
171
|
<View row spread center={centered}>
|
|
194
172
|
<View flex={!centered} flexG={centered} marginR-s4={showCharCounter}>
|
|
195
|
-
{validationMessagePosition === ValidationMessagePosition.BOTTOM && <ValidationMessage enableErrors={enableErrors} validate={others.validate} validationMessage={others.validationMessage} validationIcon={validationIcon} validationMessageStyle={_validationMessageStyle} retainValidationSpace={retainValidationSpace} testID={`${testID}.validationMessage`} />}
|
|
196
|
-
{helperText && <Text $textNeutralHeavy subtext marginT-s1 testID={`${testID}.helperText`}>
|
|
173
|
+
{validationMessagePosition === ValidationMessagePosition.BOTTOM && <ValidationMessage enableErrors={enableErrors} validate={others.validate} validationMessage={others.validationMessage} validationIcon={validationIcon} validationMessageStyle={_validationMessageStyle} retainValidationSpace={retainValidationSpace} testID={`${props.testID}.validationMessage`} />}
|
|
174
|
+
{helperText && <Text $textNeutralHeavy subtext marginT-s1 testID={`${props.testID}.helperText`}>
|
|
197
175
|
{helperText}
|
|
198
176
|
</Text>}
|
|
199
177
|
{bottomAccessory}
|
|
200
178
|
</View>
|
|
201
179
|
<View>
|
|
202
|
-
{showCharCounter && <CharCounter maxLength={others.maxLength} charCounterStyle={charCounterStyle} testID={`${testID}.charCounter`} />}
|
|
180
|
+
{showCharCounter && <CharCounter maxLength={others.maxLength} charCounterStyle={charCounterStyle} testID={`${props.testID}.charCounter`} />}
|
|
203
181
|
</View>
|
|
204
182
|
</View>
|
|
205
183
|
</View>
|
|
@@ -2,7 +2,7 @@ export declare function getInitialsTypography(size: number): import("react-nativ
|
|
|
2
2
|
export declare function hashStringToNumber(str?: string): number;
|
|
3
3
|
export declare function getAvatarColors(): string[];
|
|
4
4
|
export declare function getColorById(id: string, avatarColors?: string[]): string;
|
|
5
|
-
export declare function getInitials(name?: string, limit?: number): string
|
|
5
|
+
export declare function getInitials(name?: string, limit?: number): Uppercase<string>;
|
|
6
6
|
export declare function getBackgroundColor(name?: string, avatarColors?: string[], hashFunction?: (name?: string) => number, defaultColor?: string): string | undefined;
|
|
7
7
|
export declare function isGravatarUrl(url: string): boolean;
|
|
8
8
|
export declare function isBlankGravatarUrl(url: string): boolean;
|
|
@@ -40,7 +40,7 @@ const Thumb = props => {
|
|
|
40
40
|
height: THUMB_SIZE
|
|
41
41
|
});
|
|
42
42
|
const lastOffset = useSharedValue(0);
|
|
43
|
-
const gesture = Gesture.Pan().onBegin(() => {
|
|
43
|
+
const gesture = Gesture.Pan().hitSlop(hitSlop).onBegin(() => {
|
|
44
44
|
onSeekStart?.();
|
|
45
45
|
isPressed.value = true;
|
|
46
46
|
lastOffset.value = offset.value;
|
package/src/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export { default as Button, ButtonProps, ButtonSize, ButtonAnimationDirection }
|
|
|
23
23
|
export { default as Card, CardProps, CardSectionProps, CardSelectionOptions } from './components/card';
|
|
24
24
|
export { default as Carousel, CarouselProps, PageControlPosition } from './components/carousel';
|
|
25
25
|
export { default as Checkbox, CheckboxProps, CheckboxRef } from './components/checkbox';
|
|
26
|
-
export { default as ChipsInput, ChipsInputProps, ChipsInputChipProps } from './components/chipsInput';
|
|
26
|
+
export { default as ChipsInput, ChipsInputProps, ChipsInputChipProps, ChipsInputChangeReason, ChipsInputChangeReasonProps } from './components/chipsInput';
|
|
27
27
|
export { default as Chip, ChipProps } from './components/chip';
|
|
28
28
|
export { default as ColorPicker, ColorPickerProps } from './components/colorPicker';
|
|
29
29
|
export { default as ColorPalette, ColorPaletteProps } from './components/colorPalette';
|
package/src/index.js
CHANGED
|
@@ -61,6 +61,8 @@ var _exportNames = {
|
|
|
61
61
|
ChipsInput: true,
|
|
62
62
|
ChipsInputProps: true,
|
|
63
63
|
ChipsInputChipProps: true,
|
|
64
|
+
ChipsInputChangeReason: true,
|
|
65
|
+
ChipsInputChangeReasonProps: true,
|
|
64
66
|
Chip: true,
|
|
65
67
|
ChipProps: true,
|
|
66
68
|
ColorPicker: true,
|
|
@@ -432,6 +434,18 @@ Object.defineProperty(exports, "ChipsInput", {
|
|
|
432
434
|
return _chipsInput().default;
|
|
433
435
|
}
|
|
434
436
|
});
|
|
437
|
+
Object.defineProperty(exports, "ChipsInputChangeReason", {
|
|
438
|
+
enumerable: true,
|
|
439
|
+
get: function () {
|
|
440
|
+
return _chipsInput().ChipsInputChangeReason;
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
Object.defineProperty(exports, "ChipsInputChangeReasonProps", {
|
|
444
|
+
enumerable: true,
|
|
445
|
+
get: function () {
|
|
446
|
+
return _chipsInput().ChipsInputChangeReasonProps;
|
|
447
|
+
}
|
|
448
|
+
});
|
|
435
449
|
Object.defineProperty(exports, "ChipsInputChipProps", {
|
|
436
450
|
enumerable: true,
|
|
437
451
|
get: function () {
|