@hero-design/rn 8.70.0 → 8.71.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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +6 -0
- package/es/index.js +49 -11
- package/lib/index.js +49 -11
- package/package.json +1 -1
- package/src/components/Chip/StyledChip.tsx +44 -8
- package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +212 -2
- package/src/components/Chip/__tests__/index.spec.tsx +2 -0
- package/src/components/Chip/index.tsx +1 -1
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +4 -0
- package/src/theme/components/chip.ts +4 -0
- package/stats/8.71.0/rn-stats.html +4842 -0
- package/types/components/Chip/StyledChip.d.ts +1 -1
- package/types/components/Chip/index.d.ts +1 -1
- package/types/theme/components/chip.d.ts +4 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(node:
|
|
1
|
+
(node:3001) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
|
|
2
2
|
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
3
|
-
(node:
|
|
3
|
+
(node:3001) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
|
|
4
4
|
[36m
|
|
5
5
|
[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
6
6
|
[1m[33m(!) [plugin replace] @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
7
7
|
[1m[33m(!) [plugin node-resolve] preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.[39m[22m
|
|
8
|
-
[32mcreated [1mlib/index.js, es/index.js[22m in [
|
|
8
|
+
[32mcreated [1mlib/index.js, es/index.js[22m in [1m50.9s[22m[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @hero-design/rn
|
|
2
2
|
|
|
3
|
+
## 8.71.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#3422](https://github.com/Thinkei/hero-design/pull/3422) [`a55eee7cee159b592526b978db1eed3beee461c4`](https://github.com/Thinkei/hero-design/commit/a55eee7cee159b592526b978db1eed3beee461c4) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Chip] Add compact variant
|
|
8
|
+
|
|
3
9
|
## 8.70.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/es/index.js
CHANGED
|
@@ -2636,11 +2636,15 @@ var getChipTheme = function getChipTheme(theme) {
|
|
|
2636
2636
|
outlinedDefaultBackground: theme.colors.defaultGlobalSurface,
|
|
2637
2637
|
outlinedSelectedBackground: theme.colors.secondaryOutline,
|
|
2638
2638
|
outlinedSelectedBorder: theme.colors.primaryOutline,
|
|
2639
|
-
outlinedDefaultBorder: theme.colors.disabledOnDefaultGlobalSurface
|
|
2639
|
+
outlinedDefaultBorder: theme.colors.disabledOnDefaultGlobalSurface,
|
|
2640
|
+
compactDefaultBackground: theme.colors.defaultGlobalSurface,
|
|
2641
|
+
compactSelectedBackground: theme.colors.neutralGlobalSurface
|
|
2640
2642
|
};
|
|
2641
2643
|
var space = {
|
|
2642
2644
|
wrapperHorizontalPadding: theme.space.smallMedium,
|
|
2643
2645
|
wrapperVerticalPadding: theme.space.small,
|
|
2646
|
+
compactWrapperHorizontalPadding: theme.space.small,
|
|
2647
|
+
compactWrapperVerticalPadding: theme.space.xsmall,
|
|
2644
2648
|
iconWrapperHorizontalMargin: theme.space.small,
|
|
2645
2649
|
outlinedSelectedMarginTop: -theme.space.xxsmall
|
|
2646
2650
|
};
|
|
@@ -12886,6 +12890,7 @@ var StyledChipWrapper = index$9(TouchableOpacity)(function (_ref) {
|
|
|
12886
12890
|
theme = _ref.theme;
|
|
12887
12891
|
var getShadowStyles = function getShadowStyles() {
|
|
12888
12892
|
switch (themeVariant) {
|
|
12893
|
+
case 'compact':
|
|
12889
12894
|
case 'filled':
|
|
12890
12895
|
return _objectSpread2({}, theme.__hd__.chip.shadows.filledWrapper);
|
|
12891
12896
|
case 'outlined':
|
|
@@ -12901,6 +12906,7 @@ var StyledChipWrapper = index$9(TouchableOpacity)(function (_ref) {
|
|
|
12901
12906
|
borderWidth: themeSelected ? theme.__hd__.chip.sizes.outlinedSelectedBorder : theme.__hd__.chip.sizes.outlinedDefaultBorder
|
|
12902
12907
|
};
|
|
12903
12908
|
}
|
|
12909
|
+
case 'compact':
|
|
12904
12910
|
case 'filled':
|
|
12905
12911
|
{
|
|
12906
12912
|
return {
|
|
@@ -12919,9 +12925,17 @@ var StyledChipWrapper = index$9(TouchableOpacity)(function (_ref) {
|
|
|
12919
12925
|
};
|
|
12920
12926
|
}
|
|
12921
12927
|
case 'filled':
|
|
12922
|
-
|
|
12923
|
-
|
|
12924
|
-
|
|
12928
|
+
{
|
|
12929
|
+
return {
|
|
12930
|
+
backgroundColor: theme.__hd__.chip.colors.secondaryBackground
|
|
12931
|
+
};
|
|
12932
|
+
}
|
|
12933
|
+
case 'compact':
|
|
12934
|
+
{
|
|
12935
|
+
return {
|
|
12936
|
+
backgroundColor: theme.__hd__.chip.colors.compactSelectedBackground
|
|
12937
|
+
};
|
|
12938
|
+
}
|
|
12925
12939
|
}
|
|
12926
12940
|
} else {
|
|
12927
12941
|
switch (themeVariant) {
|
|
@@ -12932,22 +12946,46 @@ var StyledChipWrapper = index$9(TouchableOpacity)(function (_ref) {
|
|
|
12932
12946
|
};
|
|
12933
12947
|
}
|
|
12934
12948
|
case 'filled':
|
|
12949
|
+
{
|
|
12950
|
+
return {
|
|
12951
|
+
backgroundColor: theme.__hd__.chip.colors.filledBackground
|
|
12952
|
+
};
|
|
12953
|
+
}
|
|
12954
|
+
case 'compact':
|
|
12955
|
+
{
|
|
12956
|
+
return {
|
|
12957
|
+
backgroundColor: theme.__hd__.chip.colors.compactDefaultBackground
|
|
12958
|
+
};
|
|
12959
|
+
}
|
|
12960
|
+
}
|
|
12961
|
+
}
|
|
12962
|
+
};
|
|
12963
|
+
var getPaddingStyles = function getPaddingStyles() {
|
|
12964
|
+
switch (themeVariant) {
|
|
12965
|
+
case 'compact':
|
|
12966
|
+
{
|
|
12935
12967
|
return {
|
|
12936
|
-
|
|
12968
|
+
paddingHorizontal: theme.__hd__.chip.space.compactWrapperHorizontalPadding,
|
|
12969
|
+
paddingVertical: theme.__hd__.chip.space.compactWrapperVerticalPadding
|
|
12937
12970
|
};
|
|
12938
|
-
|
|
12971
|
+
}
|
|
12972
|
+
default:
|
|
12973
|
+
{
|
|
12974
|
+
return {
|
|
12975
|
+
paddingHorizontal: theme.__hd__.chip.space.wrapperHorizontalPadding,
|
|
12976
|
+
paddingVertical: theme.__hd__.chip.space.wrapperVerticalPadding
|
|
12977
|
+
};
|
|
12978
|
+
}
|
|
12939
12979
|
}
|
|
12940
12980
|
};
|
|
12941
|
-
return _objectSpread2(_objectSpread2(_objectSpread2({
|
|
12981
|
+
return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
12942
12982
|
alignSelf: 'flex-start',
|
|
12943
12983
|
flexDirection: 'row',
|
|
12944
12984
|
alignItems: 'center',
|
|
12945
12985
|
justifyContent: 'center',
|
|
12946
12986
|
borderRadius: theme.__hd__.chip.radii.wrapper,
|
|
12947
|
-
|
|
12948
|
-
|
|
12949
|
-
marginTop: themeSelected ? theme.__hd__.chip.space.outlinedSelectedMarginTop : undefined
|
|
12950
|
-
}, getShadowStyles()), getBorderStyles()), getBackgroundStyles());
|
|
12987
|
+
marginTop: themeSelected && themeVariant === 'outlined' ? theme.__hd__.chip.space.outlinedSelectedMarginTop : undefined
|
|
12988
|
+
}, getShadowStyles()), getBorderStyles()), getPaddingStyles()), getBackgroundStyles());
|
|
12951
12989
|
});
|
|
12952
12990
|
|
|
12953
12991
|
var _excluded$m = ["label", "variant", "selected", "icon", "onPress", "showSelectedIcon"];
|
package/lib/index.js
CHANGED
|
@@ -2663,11 +2663,15 @@ var getChipTheme = function getChipTheme(theme) {
|
|
|
2663
2663
|
outlinedDefaultBackground: theme.colors.defaultGlobalSurface,
|
|
2664
2664
|
outlinedSelectedBackground: theme.colors.secondaryOutline,
|
|
2665
2665
|
outlinedSelectedBorder: theme.colors.primaryOutline,
|
|
2666
|
-
outlinedDefaultBorder: theme.colors.disabledOnDefaultGlobalSurface
|
|
2666
|
+
outlinedDefaultBorder: theme.colors.disabledOnDefaultGlobalSurface,
|
|
2667
|
+
compactDefaultBackground: theme.colors.defaultGlobalSurface,
|
|
2668
|
+
compactSelectedBackground: theme.colors.neutralGlobalSurface
|
|
2667
2669
|
};
|
|
2668
2670
|
var space = {
|
|
2669
2671
|
wrapperHorizontalPadding: theme.space.smallMedium,
|
|
2670
2672
|
wrapperVerticalPadding: theme.space.small,
|
|
2673
|
+
compactWrapperHorizontalPadding: theme.space.small,
|
|
2674
|
+
compactWrapperVerticalPadding: theme.space.xsmall,
|
|
2671
2675
|
iconWrapperHorizontalMargin: theme.space.small,
|
|
2672
2676
|
outlinedSelectedMarginTop: -theme.space.xxsmall
|
|
2673
2677
|
};
|
|
@@ -12913,6 +12917,7 @@ var StyledChipWrapper = index$9(reactNative.TouchableOpacity)(function (_ref) {
|
|
|
12913
12917
|
theme = _ref.theme;
|
|
12914
12918
|
var getShadowStyles = function getShadowStyles() {
|
|
12915
12919
|
switch (themeVariant) {
|
|
12920
|
+
case 'compact':
|
|
12916
12921
|
case 'filled':
|
|
12917
12922
|
return _objectSpread2({}, theme.__hd__.chip.shadows.filledWrapper);
|
|
12918
12923
|
case 'outlined':
|
|
@@ -12928,6 +12933,7 @@ var StyledChipWrapper = index$9(reactNative.TouchableOpacity)(function (_ref) {
|
|
|
12928
12933
|
borderWidth: themeSelected ? theme.__hd__.chip.sizes.outlinedSelectedBorder : theme.__hd__.chip.sizes.outlinedDefaultBorder
|
|
12929
12934
|
};
|
|
12930
12935
|
}
|
|
12936
|
+
case 'compact':
|
|
12931
12937
|
case 'filled':
|
|
12932
12938
|
{
|
|
12933
12939
|
return {
|
|
@@ -12946,9 +12952,17 @@ var StyledChipWrapper = index$9(reactNative.TouchableOpacity)(function (_ref) {
|
|
|
12946
12952
|
};
|
|
12947
12953
|
}
|
|
12948
12954
|
case 'filled':
|
|
12949
|
-
|
|
12950
|
-
|
|
12951
|
-
|
|
12955
|
+
{
|
|
12956
|
+
return {
|
|
12957
|
+
backgroundColor: theme.__hd__.chip.colors.secondaryBackground
|
|
12958
|
+
};
|
|
12959
|
+
}
|
|
12960
|
+
case 'compact':
|
|
12961
|
+
{
|
|
12962
|
+
return {
|
|
12963
|
+
backgroundColor: theme.__hd__.chip.colors.compactSelectedBackground
|
|
12964
|
+
};
|
|
12965
|
+
}
|
|
12952
12966
|
}
|
|
12953
12967
|
} else {
|
|
12954
12968
|
switch (themeVariant) {
|
|
@@ -12959,22 +12973,46 @@ var StyledChipWrapper = index$9(reactNative.TouchableOpacity)(function (_ref) {
|
|
|
12959
12973
|
};
|
|
12960
12974
|
}
|
|
12961
12975
|
case 'filled':
|
|
12976
|
+
{
|
|
12977
|
+
return {
|
|
12978
|
+
backgroundColor: theme.__hd__.chip.colors.filledBackground
|
|
12979
|
+
};
|
|
12980
|
+
}
|
|
12981
|
+
case 'compact':
|
|
12982
|
+
{
|
|
12983
|
+
return {
|
|
12984
|
+
backgroundColor: theme.__hd__.chip.colors.compactDefaultBackground
|
|
12985
|
+
};
|
|
12986
|
+
}
|
|
12987
|
+
}
|
|
12988
|
+
}
|
|
12989
|
+
};
|
|
12990
|
+
var getPaddingStyles = function getPaddingStyles() {
|
|
12991
|
+
switch (themeVariant) {
|
|
12992
|
+
case 'compact':
|
|
12993
|
+
{
|
|
12962
12994
|
return {
|
|
12963
|
-
|
|
12995
|
+
paddingHorizontal: theme.__hd__.chip.space.compactWrapperHorizontalPadding,
|
|
12996
|
+
paddingVertical: theme.__hd__.chip.space.compactWrapperVerticalPadding
|
|
12964
12997
|
};
|
|
12965
|
-
|
|
12998
|
+
}
|
|
12999
|
+
default:
|
|
13000
|
+
{
|
|
13001
|
+
return {
|
|
13002
|
+
paddingHorizontal: theme.__hd__.chip.space.wrapperHorizontalPadding,
|
|
13003
|
+
paddingVertical: theme.__hd__.chip.space.wrapperVerticalPadding
|
|
13004
|
+
};
|
|
13005
|
+
}
|
|
12966
13006
|
}
|
|
12967
13007
|
};
|
|
12968
|
-
return _objectSpread2(_objectSpread2(_objectSpread2({
|
|
13008
|
+
return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
12969
13009
|
alignSelf: 'flex-start',
|
|
12970
13010
|
flexDirection: 'row',
|
|
12971
13011
|
alignItems: 'center',
|
|
12972
13012
|
justifyContent: 'center',
|
|
12973
13013
|
borderRadius: theme.__hd__.chip.radii.wrapper,
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
marginTop: themeSelected ? theme.__hd__.chip.space.outlinedSelectedMarginTop : undefined
|
|
12977
|
-
}, getShadowStyles()), getBorderStyles()), getBackgroundStyles());
|
|
13014
|
+
marginTop: themeSelected && themeVariant === 'outlined' ? theme.__hd__.chip.space.outlinedSelectedMarginTop : undefined
|
|
13015
|
+
}, getShadowStyles()), getBorderStyles()), getPaddingStyles()), getBackgroundStyles());
|
|
12978
13016
|
});
|
|
12979
13017
|
|
|
12980
13018
|
var _excluded$m = ["label", "variant", "selected", "icon", "onPress", "showSelectedIcon"];
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import styled from '@emotion/native';
|
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
|
|
4
4
|
type StyledChipWrapperProps = {
|
|
5
|
-
themeVariant?: 'outlined' | 'filled';
|
|
5
|
+
themeVariant?: 'outlined' | 'filled' | 'compact';
|
|
6
6
|
themeSelected?: boolean;
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -10,6 +10,7 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
|
|
|
10
10
|
({ themeVariant, themeSelected, theme }) => {
|
|
11
11
|
const getShadowStyles = () => {
|
|
12
12
|
switch (themeVariant) {
|
|
13
|
+
case 'compact':
|
|
13
14
|
case 'filled':
|
|
14
15
|
return {
|
|
15
16
|
...theme.__hd__.chip.shadows.filledWrapper,
|
|
@@ -31,6 +32,7 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
|
|
|
31
32
|
: theme.__hd__.chip.sizes.outlinedDefaultBorder,
|
|
32
33
|
};
|
|
33
34
|
}
|
|
35
|
+
case 'compact':
|
|
34
36
|
case 'filled': {
|
|
35
37
|
return {
|
|
36
38
|
borderColor: theme.__hd__.chip.colors.wrapperSelectedBorder,
|
|
@@ -49,10 +51,18 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
|
|
|
49
51
|
: theme.__hd__.chip.colors.outlinedDefaultBackground,
|
|
50
52
|
};
|
|
51
53
|
}
|
|
52
|
-
case 'filled':
|
|
54
|
+
case 'filled': {
|
|
53
55
|
return {
|
|
54
56
|
backgroundColor: theme.__hd__.chip.colors.secondaryBackground,
|
|
55
57
|
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
case 'compact': {
|
|
61
|
+
return {
|
|
62
|
+
backgroundColor:
|
|
63
|
+
theme.__hd__.chip.colors.compactSelectedBackground,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
56
66
|
}
|
|
57
67
|
} else {
|
|
58
68
|
switch (themeVariant) {
|
|
@@ -62,10 +72,36 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
|
|
|
62
72
|
theme.__hd__.chip.colors.outlinedDefaultBackground,
|
|
63
73
|
};
|
|
64
74
|
}
|
|
65
|
-
case 'filled':
|
|
75
|
+
case 'filled': {
|
|
66
76
|
return {
|
|
67
77
|
backgroundColor: theme.__hd__.chip.colors.filledBackground,
|
|
68
78
|
};
|
|
79
|
+
}
|
|
80
|
+
case 'compact': {
|
|
81
|
+
return {
|
|
82
|
+
backgroundColor:
|
|
83
|
+
theme.__hd__.chip.colors.compactDefaultBackground,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const getPaddingStyles = () => {
|
|
91
|
+
switch (themeVariant) {
|
|
92
|
+
case 'compact': {
|
|
93
|
+
return {
|
|
94
|
+
paddingHorizontal:
|
|
95
|
+
theme.__hd__.chip.space.compactWrapperHorizontalPadding,
|
|
96
|
+
paddingVertical:
|
|
97
|
+
theme.__hd__.chip.space.compactWrapperVerticalPadding,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
default: {
|
|
101
|
+
return {
|
|
102
|
+
paddingHorizontal: theme.__hd__.chip.space.wrapperHorizontalPadding,
|
|
103
|
+
paddingVertical: theme.__hd__.chip.space.wrapperVerticalPadding,
|
|
104
|
+
};
|
|
69
105
|
}
|
|
70
106
|
}
|
|
71
107
|
};
|
|
@@ -76,13 +112,13 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
|
|
|
76
112
|
alignItems: 'center',
|
|
77
113
|
justifyContent: 'center',
|
|
78
114
|
borderRadius: theme.__hd__.chip.radii.wrapper,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
: undefined,
|
|
115
|
+
marginTop:
|
|
116
|
+
themeSelected && themeVariant === 'outlined'
|
|
117
|
+
? theme.__hd__.chip.space.outlinedSelectedMarginTop
|
|
118
|
+
: undefined,
|
|
84
119
|
...getShadowStyles(),
|
|
85
120
|
...getBorderStyles(),
|
|
121
|
+
...getPaddingStyles(),
|
|
86
122
|
...getBackgroundStyles(),
|
|
87
123
|
};
|
|
88
124
|
}
|
|
@@ -496,7 +496,7 @@ exports[`Chip renders correctly with custom icon 2`] = `
|
|
|
496
496
|
"elevation": 3,
|
|
497
497
|
"flexDirection": "row",
|
|
498
498
|
"justifyContent": "center",
|
|
499
|
-
"marginTop":
|
|
499
|
+
"marginTop": undefined,
|
|
500
500
|
"opacity": 1,
|
|
501
501
|
"paddingHorizontal": 12,
|
|
502
502
|
"paddingVertical": 8,
|
|
@@ -805,6 +805,216 @@ exports[`Chip renders correctly with default icon 2`] = `
|
|
|
805
805
|
</View>
|
|
806
806
|
`;
|
|
807
807
|
|
|
808
|
+
exports[`Chip renders correctly with variant compact and selected false 1`] = `
|
|
809
|
+
<View
|
|
810
|
+
style={
|
|
811
|
+
{
|
|
812
|
+
"flex": 1,
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
>
|
|
816
|
+
<View
|
|
817
|
+
accessibilityState={
|
|
818
|
+
{
|
|
819
|
+
"busy": undefined,
|
|
820
|
+
"checked": undefined,
|
|
821
|
+
"disabled": undefined,
|
|
822
|
+
"expanded": undefined,
|
|
823
|
+
"selected": undefined,
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
accessibilityValue={
|
|
827
|
+
{
|
|
828
|
+
"max": undefined,
|
|
829
|
+
"min": undefined,
|
|
830
|
+
"now": undefined,
|
|
831
|
+
"text": undefined,
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
accessible={true}
|
|
835
|
+
collapsable={false}
|
|
836
|
+
focusable={false}
|
|
837
|
+
onClick={[Function]}
|
|
838
|
+
onResponderGrant={[Function]}
|
|
839
|
+
onResponderMove={[Function]}
|
|
840
|
+
onResponderRelease={[Function]}
|
|
841
|
+
onResponderTerminate={[Function]}
|
|
842
|
+
onResponderTerminationRequest={[Function]}
|
|
843
|
+
onStartShouldSetResponder={[Function]}
|
|
844
|
+
style={
|
|
845
|
+
{
|
|
846
|
+
"alignItems": "center",
|
|
847
|
+
"alignSelf": "flex-start",
|
|
848
|
+
"backgroundColor": "#ffffff",
|
|
849
|
+
"borderColor": "transparent",
|
|
850
|
+
"borderRadius": 999,
|
|
851
|
+
"elevation": 3,
|
|
852
|
+
"flexDirection": "row",
|
|
853
|
+
"justifyContent": "center",
|
|
854
|
+
"marginTop": undefined,
|
|
855
|
+
"opacity": 1,
|
|
856
|
+
"paddingHorizontal": 8,
|
|
857
|
+
"paddingVertical": 4,
|
|
858
|
+
"shadowColor": "#001f23",
|
|
859
|
+
"shadowOffset": {
|
|
860
|
+
"height": 2,
|
|
861
|
+
"width": 0,
|
|
862
|
+
},
|
|
863
|
+
"shadowOpacity": 0.12,
|
|
864
|
+
"shadowRadius": 4,
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
testID="chip"
|
|
868
|
+
>
|
|
869
|
+
<Text
|
|
870
|
+
allowFontScaling={false}
|
|
871
|
+
style={
|
|
872
|
+
[
|
|
873
|
+
{
|
|
874
|
+
"color": "#001f23",
|
|
875
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
876
|
+
"fontSize": 16,
|
|
877
|
+
"letterSpacing": 0.48,
|
|
878
|
+
"lineHeight": 24,
|
|
879
|
+
},
|
|
880
|
+
undefined,
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
themeIntent="body"
|
|
884
|
+
themeTypeface="neutral"
|
|
885
|
+
themeVariant="regular"
|
|
886
|
+
>
|
|
887
|
+
Cover my bills
|
|
888
|
+
</Text>
|
|
889
|
+
</View>
|
|
890
|
+
<View
|
|
891
|
+
pointerEvents="box-none"
|
|
892
|
+
position="bottom"
|
|
893
|
+
style={
|
|
894
|
+
[
|
|
895
|
+
{
|
|
896
|
+
"bottom": 0,
|
|
897
|
+
"elevation": 9999,
|
|
898
|
+
"flexDirection": "column-reverse",
|
|
899
|
+
"left": 0,
|
|
900
|
+
"paddingHorizontal": 24,
|
|
901
|
+
"paddingVertical": 16,
|
|
902
|
+
"position": "absolute",
|
|
903
|
+
"right": 0,
|
|
904
|
+
"top": 0,
|
|
905
|
+
},
|
|
906
|
+
undefined,
|
|
907
|
+
]
|
|
908
|
+
}
|
|
909
|
+
/>
|
|
910
|
+
</View>
|
|
911
|
+
`;
|
|
912
|
+
|
|
913
|
+
exports[`Chip renders correctly with variant compact and selected true 1`] = `
|
|
914
|
+
<View
|
|
915
|
+
style={
|
|
916
|
+
{
|
|
917
|
+
"flex": 1,
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
>
|
|
921
|
+
<View
|
|
922
|
+
accessibilityState={
|
|
923
|
+
{
|
|
924
|
+
"busy": undefined,
|
|
925
|
+
"checked": undefined,
|
|
926
|
+
"disabled": undefined,
|
|
927
|
+
"expanded": undefined,
|
|
928
|
+
"selected": undefined,
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
accessibilityValue={
|
|
932
|
+
{
|
|
933
|
+
"max": undefined,
|
|
934
|
+
"min": undefined,
|
|
935
|
+
"now": undefined,
|
|
936
|
+
"text": undefined,
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
accessible={true}
|
|
940
|
+
collapsable={false}
|
|
941
|
+
focusable={false}
|
|
942
|
+
onClick={[Function]}
|
|
943
|
+
onResponderGrant={[Function]}
|
|
944
|
+
onResponderMove={[Function]}
|
|
945
|
+
onResponderRelease={[Function]}
|
|
946
|
+
onResponderTerminate={[Function]}
|
|
947
|
+
onResponderTerminationRequest={[Function]}
|
|
948
|
+
onStartShouldSetResponder={[Function]}
|
|
949
|
+
style={
|
|
950
|
+
{
|
|
951
|
+
"alignItems": "center",
|
|
952
|
+
"alignSelf": "flex-start",
|
|
953
|
+
"backgroundColor": "#f6f6f7",
|
|
954
|
+
"borderColor": "transparent",
|
|
955
|
+
"borderRadius": 999,
|
|
956
|
+
"elevation": 3,
|
|
957
|
+
"flexDirection": "row",
|
|
958
|
+
"justifyContent": "center",
|
|
959
|
+
"marginTop": undefined,
|
|
960
|
+
"opacity": 1,
|
|
961
|
+
"paddingHorizontal": 8,
|
|
962
|
+
"paddingVertical": 4,
|
|
963
|
+
"shadowColor": "#001f23",
|
|
964
|
+
"shadowOffset": {
|
|
965
|
+
"height": 2,
|
|
966
|
+
"width": 0,
|
|
967
|
+
},
|
|
968
|
+
"shadowOpacity": 0.12,
|
|
969
|
+
"shadowRadius": 4,
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
testID="chip"
|
|
973
|
+
>
|
|
974
|
+
<Text
|
|
975
|
+
allowFontScaling={false}
|
|
976
|
+
style={
|
|
977
|
+
[
|
|
978
|
+
{
|
|
979
|
+
"color": "#001f23",
|
|
980
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
981
|
+
"fontSize": 16,
|
|
982
|
+
"letterSpacing": 0.48,
|
|
983
|
+
"lineHeight": 24,
|
|
984
|
+
},
|
|
985
|
+
undefined,
|
|
986
|
+
]
|
|
987
|
+
}
|
|
988
|
+
themeIntent="body"
|
|
989
|
+
themeTypeface="neutral"
|
|
990
|
+
themeVariant="regular"
|
|
991
|
+
>
|
|
992
|
+
Cover my bills
|
|
993
|
+
</Text>
|
|
994
|
+
</View>
|
|
995
|
+
<View
|
|
996
|
+
pointerEvents="box-none"
|
|
997
|
+
position="bottom"
|
|
998
|
+
style={
|
|
999
|
+
[
|
|
1000
|
+
{
|
|
1001
|
+
"bottom": 0,
|
|
1002
|
+
"elevation": 9999,
|
|
1003
|
+
"flexDirection": "column-reverse",
|
|
1004
|
+
"left": 0,
|
|
1005
|
+
"paddingHorizontal": 24,
|
|
1006
|
+
"paddingVertical": 16,
|
|
1007
|
+
"position": "absolute",
|
|
1008
|
+
"right": 0,
|
|
1009
|
+
"top": 0,
|
|
1010
|
+
},
|
|
1011
|
+
undefined,
|
|
1012
|
+
]
|
|
1013
|
+
}
|
|
1014
|
+
/>
|
|
1015
|
+
</View>
|
|
1016
|
+
`;
|
|
1017
|
+
|
|
808
1018
|
exports[`Chip renders correctly with variant filled and selected false 1`] = `
|
|
809
1019
|
<View
|
|
810
1020
|
style={
|
|
@@ -956,7 +1166,7 @@ exports[`Chip renders correctly with variant filled and selected true 1`] = `
|
|
|
956
1166
|
"elevation": 3,
|
|
957
1167
|
"flexDirection": "row",
|
|
958
1168
|
"justifyContent": "center",
|
|
959
|
-
"marginTop":
|
|
1169
|
+
"marginTop": undefined,
|
|
960
1170
|
"opacity": 1,
|
|
961
1171
|
"paddingHorizontal": 12,
|
|
962
1172
|
"paddingVertical": 8,
|
|
@@ -86,6 +86,8 @@ describe('Chip', () => {
|
|
|
86
86
|
${'filled'} | ${false}
|
|
87
87
|
${'outlined'} | ${true}
|
|
88
88
|
${'outlined'} | ${false}
|
|
89
|
+
${'compact'} | ${true}
|
|
90
|
+
${'compact'} | ${false}
|
|
89
91
|
`(
|
|
90
92
|
'renders correctly with variant $variant and selected $selected',
|
|
91
93
|
({ variant, selected }) => {
|
|
@@ -379,6 +379,8 @@ exports[`theme returns correct theme object 1`] = `
|
|
|
379
379
|
"wrapper": 1,
|
|
380
380
|
},
|
|
381
381
|
"colors": {
|
|
382
|
+
"compactDefaultBackground": "#ffffff",
|
|
383
|
+
"compactSelectedBackground": "#f6f6f7",
|
|
382
384
|
"filledBackground": "#ffffff",
|
|
383
385
|
"outlinedDefaultBackground": "#ffffff",
|
|
384
386
|
"outlinedDefaultBorder": "#bfc1c5",
|
|
@@ -407,6 +409,8 @@ exports[`theme returns correct theme object 1`] = `
|
|
|
407
409
|
"outlinedSelectedBorder": 2,
|
|
408
410
|
},
|
|
409
411
|
"space": {
|
|
412
|
+
"compactWrapperHorizontalPadding": 8,
|
|
413
|
+
"compactWrapperVerticalPadding": 4,
|
|
410
414
|
"iconWrapperHorizontalMargin": 8,
|
|
411
415
|
"outlinedSelectedMarginTop": -2,
|
|
412
416
|
"wrapperHorizontalPadding": 12,
|
|
@@ -9,11 +9,15 @@ const getChipTheme = (theme: GlobalTheme) => {
|
|
|
9
9
|
outlinedSelectedBackground: theme.colors.secondaryOutline,
|
|
10
10
|
outlinedSelectedBorder: theme.colors.primaryOutline,
|
|
11
11
|
outlinedDefaultBorder: theme.colors.disabledOnDefaultGlobalSurface,
|
|
12
|
+
compactDefaultBackground: theme.colors.defaultGlobalSurface,
|
|
13
|
+
compactSelectedBackground: theme.colors.neutralGlobalSurface,
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
const space = {
|
|
15
17
|
wrapperHorizontalPadding: theme.space.smallMedium,
|
|
16
18
|
wrapperVerticalPadding: theme.space.small,
|
|
19
|
+
compactWrapperHorizontalPadding: theme.space.small,
|
|
20
|
+
compactWrapperVerticalPadding: theme.space.xsmall,
|
|
17
21
|
iconWrapperHorizontalMargin: theme.space.small,
|
|
18
22
|
outlinedSelectedMarginTop: -theme.space.xxsmall,
|
|
19
23
|
};
|