@hero-design/rn 8.81.0 → 8.81.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/es/index.js +29 -7
- package/lib/index.js +29 -7
- package/package.json +3 -2
- package/src/components/Chip/StyledChip.tsx +6 -1
- package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +117 -60
- package/src/components/Chip/__tests__/index.spec.tsx +13 -0
- package/src/components/Chip/index.tsx +20 -12
- package/src/components/TimePicker/TimePickerIOS.tsx +5 -1
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +3 -0
- package/src/theme/components/chip.ts +5 -0
- package/stats/8.81.1/rn-stats.html +4842 -0
- package/types/components/Chip/StyledChip.d.ts +5 -1
- package/types/components/Chip/index.d.ts +2 -2
- package/types/components/CompoundSearch/CompoundSearchHandler.d.ts +31 -0
- package/types/components/CompoundSearch/CompoundSearchTextInput.d.ts +60 -0
- package/types/components/CompoundSearch/StyledCompoundSearch.d.ts +40 -0
- package/types/components/CompoundSearch/index.d.ts +8 -0
- package/types/components/CompoundSearch/utils.d.ts +8 -0
- package/types/components/FloatingIsland/SingleLine/StyledSingleLine.d.ts +15 -0
- package/types/components/FloatingIsland/SingleLine/index.d.ts +24 -0
- package/types/components/FloatingIsland/StyledFloatingIsland.d.ts +2 -2
- package/types/theme/components/chip.d.ts +3 -0
- package/types/theme/components/compoundSearch.d.ts +36 -0
- package/.turbo/turbo-build.log +0 -7
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode, useMemo } from 'react';
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
3
|
import Box from '../Box';
|
|
4
|
-
import
|
|
4
|
+
import { IconName } from '../Icon';
|
|
5
5
|
import Typography from '../Typography';
|
|
6
|
-
import { StyledChipWrapper } from './StyledChip';
|
|
6
|
+
import { StyledChipIcon, StyledChipWrapper } from './StyledChip';
|
|
7
7
|
|
|
8
8
|
export interface ChipProps extends ViewProps {
|
|
9
9
|
/**
|
|
10
10
|
* The label of the chip.
|
|
11
11
|
*/
|
|
12
|
-
label: string;
|
|
12
|
+
label: string | ReactNode;
|
|
13
13
|
/**
|
|
14
14
|
* Variant of the chip.
|
|
15
15
|
*/
|
|
@@ -32,6 +32,14 @@ export interface ChipProps extends ViewProps {
|
|
|
32
32
|
showSelectedIcon?: boolean;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
const getChipLabel = (label: string | ReactNode) => {
|
|
36
|
+
if (typeof label === 'string') {
|
|
37
|
+
return <Typography.Body variant="small">{label}</Typography.Body>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return label;
|
|
41
|
+
};
|
|
42
|
+
|
|
35
43
|
const Chip = ({
|
|
36
44
|
label,
|
|
37
45
|
variant = 'outlined',
|
|
@@ -42,7 +50,11 @@ const Chip = ({
|
|
|
42
50
|
...otherProps
|
|
43
51
|
}: ChipProps) => {
|
|
44
52
|
const shouldShowSelectedIcon =
|
|
45
|
-
variant === 'outlined'
|
|
53
|
+
(variant === 'outlined' || variant === 'compact-outlined') &&
|
|
54
|
+
selected &&
|
|
55
|
+
showSelectedIcon;
|
|
56
|
+
|
|
57
|
+
const chipLabel = useMemo(() => getChipLabel(label), [label]);
|
|
46
58
|
|
|
47
59
|
return (
|
|
48
60
|
<StyledChipWrapper
|
|
@@ -53,19 +65,15 @@ const Chip = ({
|
|
|
53
65
|
>
|
|
54
66
|
{icon && (
|
|
55
67
|
<Box marginRight="small">
|
|
56
|
-
<
|
|
68
|
+
<StyledChipIcon icon={icon} testID={`chip-icon-${icon}`} />
|
|
57
69
|
</Box>
|
|
58
70
|
)}
|
|
59
71
|
|
|
60
|
-
|
|
72
|
+
{chipLabel}
|
|
61
73
|
|
|
62
74
|
{shouldShowSelectedIcon && (
|
|
63
75
|
<Box marginLeft="small">
|
|
64
|
-
<
|
|
65
|
-
size="xsmall"
|
|
66
|
-
icon="cancel"
|
|
67
|
-
testID="selected-chip-icon-cancel"
|
|
68
|
-
/>
|
|
76
|
+
<StyledChipIcon icon="cancel" testID="selected-chip-icon-cancel" />
|
|
69
77
|
</Box>
|
|
70
78
|
)}
|
|
71
79
|
</StyledChipWrapper>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import DateTimePicker from '@react-native-community/datetimepicker';
|
|
2
|
-
import React, { useState } from 'react';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import { TouchableOpacity, View } from 'react-native';
|
|
4
4
|
import formatTime from 'date-fns/fp/format';
|
|
5
5
|
|
|
@@ -33,6 +33,10 @@ const TimePickerIOS = ({
|
|
|
33
33
|
const displayValue = value ? formatTime(displayFormat, value) : '';
|
|
34
34
|
const theme = useTheme();
|
|
35
35
|
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
setSelectingDate(value || new Date());
|
|
38
|
+
}, [value]);
|
|
39
|
+
|
|
36
40
|
return (
|
|
37
41
|
<TouchableOpacity onPress={() => setOpen(true)} disabled={disabled}>
|
|
38
42
|
<View pointerEvents="none" testID="timePickerInputIOS">
|
|
@@ -33,12 +33,17 @@ const getChipTheme = (theme: GlobalTheme) => {
|
|
|
33
33
|
filledWrapper: theme.shadows.default,
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
const fontSizes = {
|
|
37
|
+
icon: theme.fontSizes.small,
|
|
38
|
+
};
|
|
39
|
+
|
|
36
40
|
return {
|
|
37
41
|
colors,
|
|
38
42
|
space,
|
|
39
43
|
radii,
|
|
40
44
|
borderWidths,
|
|
41
45
|
shadows,
|
|
46
|
+
fontSizes,
|
|
42
47
|
};
|
|
43
48
|
};
|
|
44
49
|
|