react-native-ui-lib 7.39.0-snapshot.6543 → 7.39.0-snapshot.6546
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/package.json
CHANGED
|
@@ -88,9 +88,13 @@ function processComponents(components) {
|
|
|
88
88
|
content += `sidebar_label: ${componentName}\n`;
|
|
89
89
|
content += '---\n\n';
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
if (component.docs) {
|
|
92
|
+
content += `import ComponentPage from '@site/src/components/ComponentPage';\n\n`;
|
|
93
|
+
const componentObject = JSON.stringify(component);
|
|
94
|
+
content += `<ComponentPage component={${componentObject}}/>\n`;
|
|
95
|
+
} else {
|
|
96
|
+
content += `${buildOldDocs(component)}\n`;
|
|
97
|
+
}
|
|
94
98
|
|
|
95
99
|
let dirPath;
|
|
96
100
|
switch (component.category) {
|
|
@@ -149,4 +153,84 @@ function logStatistics(components) {
|
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
155
|
|
|
156
|
+
function buildOldDocs(component) {
|
|
157
|
+
let content = '';
|
|
158
|
+
content += `import UILivePreview from '@site/src/components/UILivePreview';\n\n`;
|
|
159
|
+
|
|
160
|
+
/* General Info */
|
|
161
|
+
content += `${component.description} \n`;
|
|
162
|
+
if (typeof component.example === 'string') {
|
|
163
|
+
content += `[(code example)](${component.example})\n`;
|
|
164
|
+
} else if (Array.isArray(component.example)) {
|
|
165
|
+
content += '(code examples: ';
|
|
166
|
+
component.example.forEach((example, index) => {
|
|
167
|
+
const slashIndex = example.lastIndexOf('/');
|
|
168
|
+
const dotIndex = example.lastIndexOf('.');
|
|
169
|
+
content += `${index > 0 ? ', ' : ''}[${example.slice(slashIndex + 1, dotIndex)}](${example})`;
|
|
170
|
+
});
|
|
171
|
+
content += ')\n';
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (component.extends) {
|
|
175
|
+
let extendsText = component.extends?.join(', ');
|
|
176
|
+
if (component.extendsLink) {
|
|
177
|
+
extendsText = `[${extendsText}](${component.extendsLink})`;
|
|
178
|
+
} else {
|
|
179
|
+
extendsText = _.map(component.extends, generateExtendsLink).join(', ');
|
|
180
|
+
}
|
|
181
|
+
content += ':::info\n';
|
|
182
|
+
content += `This component extends **${extendsText}** props.\n`;
|
|
183
|
+
content += ':::\n';
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (component.modifiers) {
|
|
187
|
+
content += ':::tip\n';
|
|
188
|
+
content += `This component support **${component.modifiers?.join(', ')}** modifiers.\n`;
|
|
189
|
+
content += ':::\n';
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (component.caution) {
|
|
193
|
+
content += ':::caution\n';
|
|
194
|
+
content += `${component.caution}\n`;
|
|
195
|
+
content += ':::\n';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (component.note) {
|
|
199
|
+
content += ':::note\n';
|
|
200
|
+
content += `${component.note}\n`;
|
|
201
|
+
content += ':::\n';
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* Images */
|
|
205
|
+
content += `<div style={{display: 'flex', flexDirection: 'row', overflowX: 'auto', maxHeight: '500px', alignItems: 'center'}}>`;
|
|
206
|
+
component.images?.forEach(image => {
|
|
207
|
+
content += `<img style={{maxHeight: '420px'}} src={'${image}'}/>`;
|
|
208
|
+
content += '\n\n';
|
|
209
|
+
});
|
|
210
|
+
content += '</div>\n\n';
|
|
211
|
+
|
|
212
|
+
/* Snippet */
|
|
213
|
+
if (component.snippet) {
|
|
214
|
+
content += `### Usage\n`;
|
|
215
|
+
content += `<UILivePreview componentName={"${component.name}"} code={\`${component.snippet
|
|
216
|
+
?.map(item => _.replace(item, new RegExp(/\$[1-9]/, 'g'), ''))
|
|
217
|
+
.join('\n')
|
|
218
|
+
.toString()}\`}/>\n\n`;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* Props */
|
|
222
|
+
content += '## API\n';
|
|
223
|
+
_.sortBy(component.props, p => p.name)?.forEach(prop => {
|
|
224
|
+
content += `### ${prop.name}\n`;
|
|
225
|
+
if (prop.note) {
|
|
226
|
+
content += `#### ${prop.note}\n`;
|
|
227
|
+
}
|
|
228
|
+
content += `${prop.description}\n`;
|
|
229
|
+
// content += `<span style={{color: 'grey'}}>${_.escape(prop.type)}</span>\n\n`;
|
|
230
|
+
content += `\`${prop.type} \` \n\n`;
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
return content;
|
|
234
|
+
}
|
|
235
|
+
|
|
152
236
|
module.exports = {buildDocs};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle, ImagePropsBase, ImageStyle, TextStyle, AccessibilityProps } from 'react-native';
|
|
2
|
+
import { StyleProp, ViewStyle, ImagePropsBase, ImageStyle, TextStyle, TextProps, AccessibilityProps } from 'react-native';
|
|
3
3
|
import { BadgeProps } from '../badge';
|
|
4
4
|
import { ImageProps } from '../image';
|
|
5
5
|
import { AnimatedImageProps } from '../animatedImage';
|
|
@@ -95,6 +95,7 @@ export type AvatarProps = Pick<AccessibilityProps, 'accessibilityLabel'> & Props
|
|
|
95
95
|
* The label color
|
|
96
96
|
*/
|
|
97
97
|
labelColor?: string;
|
|
98
|
+
labelEllipsizeMode?: TextProps['ellipsizeMode'];
|
|
98
99
|
/**
|
|
99
100
|
* ribbon label to display on the avatar
|
|
100
101
|
*/
|
|
@@ -162,21 +163,14 @@ declare const Avatar: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "
|
|
|
162
163
|
* Image props object
|
|
163
164
|
*/
|
|
164
165
|
imageProps?: Partial<Omit<import("react-native").ImageProps, "source"> & Pick<import("react-native").ImageBackgroundProps, "imageStyle"> & Partial<Record<"margin" | "marginL" | "marginT" | "marginR" | "marginB" | "marginH" | "marginV", boolean>> & import("../..").RecorderProps & {
|
|
165
|
-
/**
|
|
166
|
-
* Avatar colors to be used when useAutoColors is true
|
|
167
|
-
*/
|
|
168
166
|
sourceTransformer?: ((props: any) => import("../image").ImageSourceType) | undefined;
|
|
169
167
|
assetName?: string | undefined;
|
|
170
168
|
assetGroup?: string | undefined;
|
|
171
169
|
tintColor?: string | undefined;
|
|
172
|
-
supportRTL?: boolean | undefined;
|
|
173
|
-
* Background color for Avatar
|
|
174
|
-
*/
|
|
170
|
+
supportRTL?: boolean | undefined;
|
|
175
171
|
cover?: boolean | undefined;
|
|
176
172
|
aspectRatio?: number | undefined;
|
|
177
|
-
overlayType?: string | undefined;
|
|
178
|
-
* Image props object
|
|
179
|
-
*/
|
|
173
|
+
overlayType?: string | undefined;
|
|
180
174
|
overlayIntensity?: import("../overlay").OverlayIntensityType | undefined;
|
|
181
175
|
overlayColor?: string | undefined;
|
|
182
176
|
customOverlayContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
|
|
@@ -230,6 +224,7 @@ declare const Avatar: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "
|
|
|
230
224
|
* The label color
|
|
231
225
|
*/
|
|
232
226
|
labelColor?: string | undefined;
|
|
227
|
+
labelEllipsizeMode?: TextProps['ellipsizeMode'];
|
|
233
228
|
/**
|
|
234
229
|
* ribbon label to display on the avatar
|
|
235
230
|
*/
|
|
@@ -291,21 +286,14 @@ declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps,
|
|
|
291
286
|
* Image props object
|
|
292
287
|
*/
|
|
293
288
|
imageProps?: Partial<Omit<import("react-native").ImageProps, "source"> & Pick<import("react-native").ImageBackgroundProps, "imageStyle"> & Partial<Record<"margin" | "marginL" | "marginT" | "marginR" | "marginB" | "marginH" | "marginV", boolean>> & import("../..").RecorderProps & {
|
|
294
|
-
/**
|
|
295
|
-
* Avatar colors to be used when useAutoColors is true
|
|
296
|
-
*/
|
|
297
289
|
sourceTransformer?: ((props: any) => import("../image").ImageSourceType) | undefined;
|
|
298
290
|
assetName?: string | undefined;
|
|
299
291
|
assetGroup?: string | undefined;
|
|
300
292
|
tintColor?: string | undefined;
|
|
301
|
-
supportRTL?: boolean | undefined;
|
|
302
|
-
* Background color for Avatar
|
|
303
|
-
*/
|
|
293
|
+
supportRTL?: boolean | undefined;
|
|
304
294
|
cover?: boolean | undefined;
|
|
305
295
|
aspectRatio?: number | undefined;
|
|
306
|
-
overlayType?: string | undefined;
|
|
307
|
-
* Image props object
|
|
308
|
-
*/
|
|
296
|
+
overlayType?: string | undefined;
|
|
309
297
|
overlayIntensity?: import("../overlay").OverlayIntensityType | undefined;
|
|
310
298
|
overlayColor?: string | undefined;
|
|
311
299
|
customOverlayContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
|
|
@@ -359,6 +347,7 @@ declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps,
|
|
|
359
347
|
* The label color
|
|
360
348
|
*/
|
|
361
349
|
labelColor?: string | undefined;
|
|
350
|
+
labelEllipsizeMode?: "middle" | "head" | "tail" | "clip" | undefined;
|
|
362
351
|
/**
|
|
363
352
|
* ribbon label to display on the avatar
|
|
364
353
|
*/
|
|
@@ -56,6 +56,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
56
56
|
useAutoColors,
|
|
57
57
|
autoColorsConfig,
|
|
58
58
|
containerStyle,
|
|
59
|
+
labelEllipsizeMode = 'clip',
|
|
59
60
|
onPress,
|
|
60
61
|
children
|
|
61
62
|
} = themeProps;
|
|
@@ -178,7 +179,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
178
179
|
const Container = onPress ? TouchableOpacity : View;
|
|
179
180
|
return <Container style={_containerStyle} ref={ref} testID={testID} onPress={onPress} accessible={!_isUndefined(onPress)} accessibilityLabel={'Avatar'} accessibilityRole={onPress ? 'button' : 'image'} hitSlop={onPress ? hitTargetPadding : undefined} {...accessibilityProps}>
|
|
180
181
|
<View testID={`${testID}.container`} style={textContainerStyle}>
|
|
181
|
-
{!_isUndefined(text) && <Text numberOfLines={1} style={textStyle} testID={`${testID}.label`}>
|
|
182
|
+
{!_isUndefined(text) && <Text numberOfLines={1} ellipsizeMode={labelEllipsizeMode} style={textStyle} testID={`${testID}.label`}>
|
|
182
183
|
{text}
|
|
183
184
|
</Text>}
|
|
184
185
|
</View>
|
|
@@ -194,7 +195,8 @@ const styles = StyleSheet.create({
|
|
|
194
195
|
...StyleSheet.absoluteFillObject,
|
|
195
196
|
alignItems: 'center',
|
|
196
197
|
justifyContent: 'center',
|
|
197
|
-
borderRadius: BorderRadiuses.br100
|
|
198
|
+
borderRadius: BorderRadiuses.br100,
|
|
199
|
+
overflow: 'hidden'
|
|
198
200
|
},
|
|
199
201
|
initialsContainerWithInset: {
|
|
200
202
|
top: 1,
|