@hero-design/rn 8.81.0 → 8.81.1
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 +2 -2
- package/CHANGELOG.md +6 -0
- package/es/index.js +26 -7
- package/lib/index.js +26 -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/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/theme/components/chip.d.ts +3 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(node:
|
|
1
|
+
(node:2927) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
|
|
2
2
|
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
3
3
|
[36m
|
|
4
4
|
[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
5
5
|
[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
|
|
6
6
|
[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
|
|
7
|
-
[32mcreated [1mlib/index.js, es/index.js[22m in [
|
|
7
|
+
[32mcreated [1mlib/index.js, es/index.js[22m in [1m49.7s[22m[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @hero-design/rn
|
|
2
2
|
|
|
3
|
+
## 8.81.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3518](https://github.com/Thinkei/hero-design/pull/3518) [`b571a2a4e544551d3ed0cfb1baea6da4f2ae33e2`](https://github.com/Thinkei/hero-design/commit/b571a2a4e544551d3ed0cfb1baea6da4f2ae33e2) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Chip] Update styling and allow custom label
|
|
8
|
+
|
|
3
9
|
## 8.81.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/es/index.js
CHANGED
|
@@ -2671,12 +2671,16 @@ var getChipTheme = function getChipTheme(theme) {
|
|
|
2671
2671
|
var shadows = {
|
|
2672
2672
|
filledWrapper: theme.shadows["default"]
|
|
2673
2673
|
};
|
|
2674
|
+
var fontSizes = {
|
|
2675
|
+
icon: theme.fontSizes.small
|
|
2676
|
+
};
|
|
2674
2677
|
return {
|
|
2675
2678
|
colors: colors,
|
|
2676
2679
|
space: space,
|
|
2677
2680
|
radii: radii,
|
|
2678
2681
|
borderWidths: borderWidths,
|
|
2679
|
-
shadows: shadows
|
|
2682
|
+
shadows: shadows,
|
|
2683
|
+
fontSizes: fontSizes
|
|
2680
2684
|
};
|
|
2681
2685
|
};
|
|
2682
2686
|
|
|
@@ -13172,8 +13176,22 @@ var StyledChipWrapper = index$a(TouchableOpacity)(function (_ref) {
|
|
|
13172
13176
|
borderRadius: theme.__hd__.chip.radii.wrapper
|
|
13173
13177
|
}, getShadowStyles()), getBorderStyles()), getPaddingStyles()), getBackgroundStyles());
|
|
13174
13178
|
});
|
|
13179
|
+
var StyledChipIcon = index$a(Icon)(function (_ref2) {
|
|
13180
|
+
var theme = _ref2.theme;
|
|
13181
|
+
return {
|
|
13182
|
+
fontSize: theme.__hd__.chip.fontSizes.icon
|
|
13183
|
+
};
|
|
13184
|
+
});
|
|
13175
13185
|
|
|
13176
13186
|
var _excluded$s = ["label", "variant", "selected", "icon", "onPress", "showSelectedIcon"];
|
|
13187
|
+
var getChipLabel = function getChipLabel(label) {
|
|
13188
|
+
if (typeof label === 'string') {
|
|
13189
|
+
return /*#__PURE__*/React__default.createElement(Typography.Body, {
|
|
13190
|
+
variant: "small"
|
|
13191
|
+
}, label);
|
|
13192
|
+
}
|
|
13193
|
+
return label;
|
|
13194
|
+
};
|
|
13177
13195
|
var Chip = function Chip(_ref) {
|
|
13178
13196
|
var label = _ref.label,
|
|
13179
13197
|
_ref$variant = _ref.variant,
|
|
@@ -13185,21 +13203,22 @@ var Chip = function Chip(_ref) {
|
|
|
13185
13203
|
_ref$showSelectedIcon = _ref.showSelectedIcon,
|
|
13186
13204
|
showSelectedIcon = _ref$showSelectedIcon === void 0 ? true : _ref$showSelectedIcon,
|
|
13187
13205
|
otherProps = _objectWithoutProperties(_ref, _excluded$s);
|
|
13188
|
-
var shouldShowSelectedIcon = variant === 'outlined' && selected && showSelectedIcon;
|
|
13206
|
+
var shouldShowSelectedIcon = (variant === 'outlined' || variant === 'compact-outlined') && selected && showSelectedIcon;
|
|
13207
|
+
var chipLabel = useMemo(function () {
|
|
13208
|
+
return getChipLabel(label);
|
|
13209
|
+
}, [label]);
|
|
13189
13210
|
return /*#__PURE__*/React__default.createElement(StyledChipWrapper, _extends$1({
|
|
13190
13211
|
onPress: onPress,
|
|
13191
13212
|
themeVariant: variant,
|
|
13192
13213
|
themeSelected: selected
|
|
13193
13214
|
}, otherProps), icon && /*#__PURE__*/React__default.createElement(Box, {
|
|
13194
13215
|
marginRight: "small"
|
|
13195
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
13196
|
-
size: "xsmall",
|
|
13216
|
+
}, /*#__PURE__*/React__default.createElement(StyledChipIcon, {
|
|
13197
13217
|
icon: icon,
|
|
13198
13218
|
testID: "chip-icon-".concat(icon)
|
|
13199
|
-
})),
|
|
13219
|
+
})), chipLabel, shouldShowSelectedIcon && /*#__PURE__*/React__default.createElement(Box, {
|
|
13200
13220
|
marginLeft: "small"
|
|
13201
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
13202
|
-
size: "xsmall",
|
|
13221
|
+
}, /*#__PURE__*/React__default.createElement(StyledChipIcon, {
|
|
13203
13222
|
icon: "cancel",
|
|
13204
13223
|
testID: "selected-chip-icon-cancel"
|
|
13205
13224
|
})));
|
package/lib/index.js
CHANGED
|
@@ -2698,12 +2698,16 @@ var getChipTheme = function getChipTheme(theme) {
|
|
|
2698
2698
|
var shadows = {
|
|
2699
2699
|
filledWrapper: theme.shadows["default"]
|
|
2700
2700
|
};
|
|
2701
|
+
var fontSizes = {
|
|
2702
|
+
icon: theme.fontSizes.small
|
|
2703
|
+
};
|
|
2701
2704
|
return {
|
|
2702
2705
|
colors: colors,
|
|
2703
2706
|
space: space,
|
|
2704
2707
|
radii: radii,
|
|
2705
2708
|
borderWidths: borderWidths,
|
|
2706
|
-
shadows: shadows
|
|
2709
|
+
shadows: shadows,
|
|
2710
|
+
fontSizes: fontSizes
|
|
2707
2711
|
};
|
|
2708
2712
|
};
|
|
2709
2713
|
|
|
@@ -13199,8 +13203,22 @@ var StyledChipWrapper = index$a(reactNative.TouchableOpacity)(function (_ref) {
|
|
|
13199
13203
|
borderRadius: theme.__hd__.chip.radii.wrapper
|
|
13200
13204
|
}, getShadowStyles()), getBorderStyles()), getPaddingStyles()), getBackgroundStyles());
|
|
13201
13205
|
});
|
|
13206
|
+
var StyledChipIcon = index$a(Icon)(function (_ref2) {
|
|
13207
|
+
var theme = _ref2.theme;
|
|
13208
|
+
return {
|
|
13209
|
+
fontSize: theme.__hd__.chip.fontSizes.icon
|
|
13210
|
+
};
|
|
13211
|
+
});
|
|
13202
13212
|
|
|
13203
13213
|
var _excluded$s = ["label", "variant", "selected", "icon", "onPress", "showSelectedIcon"];
|
|
13214
|
+
var getChipLabel = function getChipLabel(label) {
|
|
13215
|
+
if (typeof label === 'string') {
|
|
13216
|
+
return /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
|
|
13217
|
+
variant: "small"
|
|
13218
|
+
}, label);
|
|
13219
|
+
}
|
|
13220
|
+
return label;
|
|
13221
|
+
};
|
|
13204
13222
|
var Chip = function Chip(_ref) {
|
|
13205
13223
|
var label = _ref.label,
|
|
13206
13224
|
_ref$variant = _ref.variant,
|
|
@@ -13212,21 +13230,22 @@ var Chip = function Chip(_ref) {
|
|
|
13212
13230
|
_ref$showSelectedIcon = _ref.showSelectedIcon,
|
|
13213
13231
|
showSelectedIcon = _ref$showSelectedIcon === void 0 ? true : _ref$showSelectedIcon,
|
|
13214
13232
|
otherProps = _objectWithoutProperties(_ref, _excluded$s);
|
|
13215
|
-
var shouldShowSelectedIcon = variant === 'outlined' && selected && showSelectedIcon;
|
|
13233
|
+
var shouldShowSelectedIcon = (variant === 'outlined' || variant === 'compact-outlined') && selected && showSelectedIcon;
|
|
13234
|
+
var chipLabel = React.useMemo(function () {
|
|
13235
|
+
return getChipLabel(label);
|
|
13236
|
+
}, [label]);
|
|
13216
13237
|
return /*#__PURE__*/React__namespace.default.createElement(StyledChipWrapper, _extends$1({
|
|
13217
13238
|
onPress: onPress,
|
|
13218
13239
|
themeVariant: variant,
|
|
13219
13240
|
themeSelected: selected
|
|
13220
13241
|
}, otherProps), icon && /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13221
13242
|
marginRight: "small"
|
|
13222
|
-
}, /*#__PURE__*/React__namespace.default.createElement(
|
|
13223
|
-
size: "xsmall",
|
|
13243
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledChipIcon, {
|
|
13224
13244
|
icon: icon,
|
|
13225
13245
|
testID: "chip-icon-".concat(icon)
|
|
13226
|
-
})),
|
|
13246
|
+
})), chipLabel, shouldShowSelectedIcon && /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
13227
13247
|
marginLeft: "small"
|
|
13228
|
-
}, /*#__PURE__*/React__namespace.default.createElement(
|
|
13229
|
-
size: "xsmall",
|
|
13248
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledChipIcon, {
|
|
13230
13249
|
icon: "cancel",
|
|
13231
13250
|
testID: "selected-chip-icon-cancel"
|
|
13232
13251
|
})));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.81.
|
|
3
|
+
"version": "8.81.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -93,5 +93,6 @@
|
|
|
93
93
|
"ts-jest": "^29.1.1",
|
|
94
94
|
"typescript": "4.8.4"
|
|
95
95
|
},
|
|
96
|
-
"prettier": "prettier-config-hd"
|
|
96
|
+
"prettier": "prettier-config-hd",
|
|
97
|
+
"react-native": "src/index.ts"
|
|
97
98
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import Icon from '../Icon';
|
|
3
4
|
|
|
4
5
|
type StyledChipWrapperProps = {
|
|
5
6
|
themeVariant?: 'outlined' | 'filled' | 'compact' | 'compact-outlined';
|
|
@@ -112,4 +113,8 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
|
|
|
112
113
|
}
|
|
113
114
|
);
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
const StyledChipIcon = styled(Icon)(({ theme }) => ({
|
|
117
|
+
fontSize: theme.__hd__.chip.fontSizes.icon,
|
|
118
|
+
}));
|
|
119
|
+
|
|
120
|
+
export { StyledChipWrapper, StyledChipIcon };
|
|
@@ -59,16 +59,16 @@ exports[`Chip does not render selected icon when showSelectedIcon is false 1`] =
|
|
|
59
59
|
{
|
|
60
60
|
"color": "#001f23",
|
|
61
61
|
"fontFamily": "BeVietnamPro-Regular",
|
|
62
|
-
"fontSize":
|
|
62
|
+
"fontSize": 14,
|
|
63
63
|
"letterSpacing": 0.48,
|
|
64
|
-
"lineHeight":
|
|
64
|
+
"lineHeight": 22,
|
|
65
65
|
},
|
|
66
66
|
undefined,
|
|
67
67
|
]
|
|
68
68
|
}
|
|
69
69
|
themeIntent="body"
|
|
70
70
|
themeTypeface="neutral"
|
|
71
|
-
themeVariant="
|
|
71
|
+
themeVariant="small"
|
|
72
72
|
>
|
|
73
73
|
Chip
|
|
74
74
|
</Text>
|
|
@@ -155,16 +155,16 @@ exports[`Chip renders correctly when selected is false 1`] = `
|
|
|
155
155
|
{
|
|
156
156
|
"color": "#001f23",
|
|
157
157
|
"fontFamily": "BeVietnamPro-Regular",
|
|
158
|
-
"fontSize":
|
|
158
|
+
"fontSize": 14,
|
|
159
159
|
"letterSpacing": 0.48,
|
|
160
|
-
"lineHeight":
|
|
160
|
+
"lineHeight": 22,
|
|
161
161
|
},
|
|
162
162
|
undefined,
|
|
163
163
|
]
|
|
164
164
|
}
|
|
165
165
|
themeIntent="body"
|
|
166
166
|
themeTypeface="neutral"
|
|
167
|
-
themeVariant="
|
|
167
|
+
themeVariant="small"
|
|
168
168
|
>
|
|
169
169
|
Cover my bills
|
|
170
170
|
</Text>
|
|
@@ -251,16 +251,16 @@ exports[`Chip renders correctly when selected is true 1`] = `
|
|
|
251
251
|
{
|
|
252
252
|
"color": "#001f23",
|
|
253
253
|
"fontFamily": "BeVietnamPro-Regular",
|
|
254
|
-
"fontSize":
|
|
254
|
+
"fontSize": 14,
|
|
255
255
|
"letterSpacing": 0.48,
|
|
256
|
-
"lineHeight":
|
|
256
|
+
"lineHeight": 22,
|
|
257
257
|
},
|
|
258
258
|
undefined,
|
|
259
259
|
]
|
|
260
260
|
}
|
|
261
261
|
themeIntent="body"
|
|
262
262
|
themeTypeface="neutral"
|
|
263
|
-
themeVariant="
|
|
263
|
+
themeVariant="small"
|
|
264
264
|
>
|
|
265
265
|
Cover my bills
|
|
266
266
|
</Text>
|
|
@@ -281,14 +281,19 @@ exports[`Chip renders correctly when selected is true 1`] = `
|
|
|
281
281
|
[
|
|
282
282
|
{
|
|
283
283
|
"color": "#001f23",
|
|
284
|
-
"fontSize":
|
|
284
|
+
"fontSize": 24,
|
|
285
285
|
},
|
|
286
|
-
|
|
286
|
+
[
|
|
287
|
+
{
|
|
288
|
+
"fontSize": 12,
|
|
289
|
+
},
|
|
290
|
+
undefined,
|
|
291
|
+
],
|
|
287
292
|
]
|
|
288
293
|
}
|
|
289
294
|
testID="selected-chip-icon-cancel"
|
|
290
295
|
themeIntent="text"
|
|
291
|
-
themeSize="
|
|
296
|
+
themeSize="medium"
|
|
292
297
|
/>
|
|
293
298
|
</View>
|
|
294
299
|
</View>
|
|
@@ -392,14 +397,19 @@ exports[`Chip renders correctly with custom icon 1`] = `
|
|
|
392
397
|
[
|
|
393
398
|
{
|
|
394
399
|
"color": "#001f23",
|
|
395
|
-
"fontSize":
|
|
400
|
+
"fontSize": 24,
|
|
396
401
|
},
|
|
397
|
-
|
|
402
|
+
[
|
|
403
|
+
{
|
|
404
|
+
"fontSize": 12,
|
|
405
|
+
},
|
|
406
|
+
undefined,
|
|
407
|
+
],
|
|
398
408
|
]
|
|
399
409
|
}
|
|
400
410
|
testID="chip-icon-charging-station-outlined"
|
|
401
411
|
themeIntent="text"
|
|
402
|
-
themeSize="
|
|
412
|
+
themeSize="medium"
|
|
403
413
|
/>
|
|
404
414
|
</View>
|
|
405
415
|
<Text
|
|
@@ -409,16 +419,16 @@ exports[`Chip renders correctly with custom icon 1`] = `
|
|
|
409
419
|
{
|
|
410
420
|
"color": "#001f23",
|
|
411
421
|
"fontFamily": "BeVietnamPro-Regular",
|
|
412
|
-
"fontSize":
|
|
422
|
+
"fontSize": 14,
|
|
413
423
|
"letterSpacing": 0.48,
|
|
414
|
-
"lineHeight":
|
|
424
|
+
"lineHeight": 22,
|
|
415
425
|
},
|
|
416
426
|
undefined,
|
|
417
427
|
]
|
|
418
428
|
}
|
|
419
429
|
themeIntent="body"
|
|
420
430
|
themeTypeface="neutral"
|
|
421
|
-
themeVariant="
|
|
431
|
+
themeVariant="small"
|
|
422
432
|
>
|
|
423
433
|
Cover my bills
|
|
424
434
|
</Text>
|
|
@@ -523,14 +533,19 @@ exports[`Chip renders correctly with custom icon 2`] = `
|
|
|
523
533
|
[
|
|
524
534
|
{
|
|
525
535
|
"color": "#001f23",
|
|
526
|
-
"fontSize":
|
|
536
|
+
"fontSize": 24,
|
|
527
537
|
},
|
|
528
|
-
|
|
538
|
+
[
|
|
539
|
+
{
|
|
540
|
+
"fontSize": 12,
|
|
541
|
+
},
|
|
542
|
+
undefined,
|
|
543
|
+
],
|
|
529
544
|
]
|
|
530
545
|
}
|
|
531
546
|
testID="chip-icon-charging-station-outlined"
|
|
532
547
|
themeIntent="text"
|
|
533
|
-
themeSize="
|
|
548
|
+
themeSize="medium"
|
|
534
549
|
/>
|
|
535
550
|
</View>
|
|
536
551
|
<Text
|
|
@@ -540,16 +555,16 @@ exports[`Chip renders correctly with custom icon 2`] = `
|
|
|
540
555
|
{
|
|
541
556
|
"color": "#001f23",
|
|
542
557
|
"fontFamily": "BeVietnamPro-Regular",
|
|
543
|
-
"fontSize":
|
|
558
|
+
"fontSize": 14,
|
|
544
559
|
"letterSpacing": 0.48,
|
|
545
|
-
"lineHeight":
|
|
560
|
+
"lineHeight": 22,
|
|
546
561
|
},
|
|
547
562
|
undefined,
|
|
548
563
|
]
|
|
549
564
|
}
|
|
550
565
|
themeIntent="body"
|
|
551
566
|
themeTypeface="neutral"
|
|
552
|
-
themeVariant="
|
|
567
|
+
themeVariant="small"
|
|
553
568
|
>
|
|
554
569
|
Cover my bills
|
|
555
570
|
</Text>
|
|
@@ -637,16 +652,16 @@ exports[`Chip renders correctly with default icon 1`] = `
|
|
|
637
652
|
{
|
|
638
653
|
"color": "#001f23",
|
|
639
654
|
"fontFamily": "BeVietnamPro-Regular",
|
|
640
|
-
"fontSize":
|
|
655
|
+
"fontSize": 14,
|
|
641
656
|
"letterSpacing": 0.48,
|
|
642
|
-
"lineHeight":
|
|
657
|
+
"lineHeight": 22,
|
|
643
658
|
},
|
|
644
659
|
undefined,
|
|
645
660
|
]
|
|
646
661
|
}
|
|
647
662
|
themeIntent="body"
|
|
648
663
|
themeTypeface="neutral"
|
|
649
|
-
themeVariant="
|
|
664
|
+
themeVariant="small"
|
|
650
665
|
>
|
|
651
666
|
Cover my bills
|
|
652
667
|
</Text>
|
|
@@ -734,16 +749,16 @@ exports[`Chip renders correctly with default icon 2`] = `
|
|
|
734
749
|
{
|
|
735
750
|
"color": "#001f23",
|
|
736
751
|
"fontFamily": "BeVietnamPro-Regular",
|
|
737
|
-
"fontSize":
|
|
752
|
+
"fontSize": 14,
|
|
738
753
|
"letterSpacing": 0.48,
|
|
739
|
-
"lineHeight":
|
|
754
|
+
"lineHeight": 22,
|
|
740
755
|
},
|
|
741
756
|
undefined,
|
|
742
757
|
]
|
|
743
758
|
}
|
|
744
759
|
themeIntent="body"
|
|
745
760
|
themeTypeface="neutral"
|
|
746
|
-
themeVariant="
|
|
761
|
+
themeVariant="small"
|
|
747
762
|
>
|
|
748
763
|
Cover my bills
|
|
749
764
|
</Text>
|
|
@@ -764,14 +779,19 @@ exports[`Chip renders correctly with default icon 2`] = `
|
|
|
764
779
|
[
|
|
765
780
|
{
|
|
766
781
|
"color": "#001f23",
|
|
767
|
-
"fontSize":
|
|
782
|
+
"fontSize": 24,
|
|
768
783
|
},
|
|
769
|
-
|
|
784
|
+
[
|
|
785
|
+
{
|
|
786
|
+
"fontSize": 12,
|
|
787
|
+
},
|
|
788
|
+
undefined,
|
|
789
|
+
],
|
|
770
790
|
]
|
|
771
791
|
}
|
|
772
792
|
testID="selected-chip-icon-cancel"
|
|
773
793
|
themeIntent="text"
|
|
774
|
-
themeSize="
|
|
794
|
+
themeSize="medium"
|
|
775
795
|
/>
|
|
776
796
|
</View>
|
|
777
797
|
</View>
|
|
@@ -865,16 +885,16 @@ exports[`Chip renders correctly with variant compact and selected false 1`] = `
|
|
|
865
885
|
{
|
|
866
886
|
"color": "#001f23",
|
|
867
887
|
"fontFamily": "BeVietnamPro-Regular",
|
|
868
|
-
"fontSize":
|
|
888
|
+
"fontSize": 14,
|
|
869
889
|
"letterSpacing": 0.48,
|
|
870
|
-
"lineHeight":
|
|
890
|
+
"lineHeight": 22,
|
|
871
891
|
},
|
|
872
892
|
undefined,
|
|
873
893
|
]
|
|
874
894
|
}
|
|
875
895
|
themeIntent="body"
|
|
876
896
|
themeTypeface="neutral"
|
|
877
|
-
themeVariant="
|
|
897
|
+
themeVariant="small"
|
|
878
898
|
>
|
|
879
899
|
Cover my bills
|
|
880
900
|
</Text>
|
|
@@ -969,16 +989,16 @@ exports[`Chip renders correctly with variant compact and selected true 1`] = `
|
|
|
969
989
|
{
|
|
970
990
|
"color": "#001f23",
|
|
971
991
|
"fontFamily": "BeVietnamPro-Regular",
|
|
972
|
-
"fontSize":
|
|
992
|
+
"fontSize": 14,
|
|
973
993
|
"letterSpacing": 0.48,
|
|
974
|
-
"lineHeight":
|
|
994
|
+
"lineHeight": 22,
|
|
975
995
|
},
|
|
976
996
|
undefined,
|
|
977
997
|
]
|
|
978
998
|
}
|
|
979
999
|
themeIntent="body"
|
|
980
1000
|
themeTypeface="neutral"
|
|
981
|
-
themeVariant="
|
|
1001
|
+
themeVariant="small"
|
|
982
1002
|
>
|
|
983
1003
|
Cover my bills
|
|
984
1004
|
</Text>
|
|
@@ -1066,16 +1086,16 @@ exports[`Chip renders correctly with variant compact-outlined and selected false
|
|
|
1066
1086
|
{
|
|
1067
1087
|
"color": "#001f23",
|
|
1068
1088
|
"fontFamily": "BeVietnamPro-Regular",
|
|
1069
|
-
"fontSize":
|
|
1089
|
+
"fontSize": 14,
|
|
1070
1090
|
"letterSpacing": 0.48,
|
|
1071
|
-
"lineHeight":
|
|
1091
|
+
"lineHeight": 22,
|
|
1072
1092
|
},
|
|
1073
1093
|
undefined,
|
|
1074
1094
|
]
|
|
1075
1095
|
}
|
|
1076
1096
|
themeIntent="body"
|
|
1077
1097
|
themeTypeface="neutral"
|
|
1078
|
-
themeVariant="
|
|
1098
|
+
themeVariant="small"
|
|
1079
1099
|
>
|
|
1080
1100
|
Cover my bills
|
|
1081
1101
|
</Text>
|
|
@@ -1163,19 +1183,51 @@ exports[`Chip renders correctly with variant compact-outlined and selected true
|
|
|
1163
1183
|
{
|
|
1164
1184
|
"color": "#001f23",
|
|
1165
1185
|
"fontFamily": "BeVietnamPro-Regular",
|
|
1166
|
-
"fontSize":
|
|
1186
|
+
"fontSize": 14,
|
|
1167
1187
|
"letterSpacing": 0.48,
|
|
1168
|
-
"lineHeight":
|
|
1188
|
+
"lineHeight": 22,
|
|
1169
1189
|
},
|
|
1170
1190
|
undefined,
|
|
1171
1191
|
]
|
|
1172
1192
|
}
|
|
1173
1193
|
themeIntent="body"
|
|
1174
1194
|
themeTypeface="neutral"
|
|
1175
|
-
themeVariant="
|
|
1195
|
+
themeVariant="small"
|
|
1176
1196
|
>
|
|
1177
1197
|
Cover my bills
|
|
1178
1198
|
</Text>
|
|
1199
|
+
<View
|
|
1200
|
+
marginLeft="small"
|
|
1201
|
+
style={
|
|
1202
|
+
[
|
|
1203
|
+
{
|
|
1204
|
+
"marginLeft": 8,
|
|
1205
|
+
},
|
|
1206
|
+
undefined,
|
|
1207
|
+
]
|
|
1208
|
+
}
|
|
1209
|
+
>
|
|
1210
|
+
<HeroIcon
|
|
1211
|
+
name="cancel"
|
|
1212
|
+
style={
|
|
1213
|
+
[
|
|
1214
|
+
{
|
|
1215
|
+
"color": "#001f23",
|
|
1216
|
+
"fontSize": 24,
|
|
1217
|
+
},
|
|
1218
|
+
[
|
|
1219
|
+
{
|
|
1220
|
+
"fontSize": 12,
|
|
1221
|
+
},
|
|
1222
|
+
undefined,
|
|
1223
|
+
],
|
|
1224
|
+
]
|
|
1225
|
+
}
|
|
1226
|
+
testID="selected-chip-icon-cancel"
|
|
1227
|
+
themeIntent="text"
|
|
1228
|
+
themeSize="medium"
|
|
1229
|
+
/>
|
|
1230
|
+
</View>
|
|
1179
1231
|
</View>
|
|
1180
1232
|
<View
|
|
1181
1233
|
pointerEvents="box-none"
|
|
@@ -1267,16 +1319,16 @@ exports[`Chip renders correctly with variant filled and selected false 1`] = `
|
|
|
1267
1319
|
{
|
|
1268
1320
|
"color": "#001f23",
|
|
1269
1321
|
"fontFamily": "BeVietnamPro-Regular",
|
|
1270
|
-
"fontSize":
|
|
1322
|
+
"fontSize": 14,
|
|
1271
1323
|
"letterSpacing": 0.48,
|
|
1272
|
-
"lineHeight":
|
|
1324
|
+
"lineHeight": 22,
|
|
1273
1325
|
},
|
|
1274
1326
|
undefined,
|
|
1275
1327
|
]
|
|
1276
1328
|
}
|
|
1277
1329
|
themeIntent="body"
|
|
1278
1330
|
themeTypeface="neutral"
|
|
1279
|
-
themeVariant="
|
|
1331
|
+
themeVariant="small"
|
|
1280
1332
|
>
|
|
1281
1333
|
Cover my bills
|
|
1282
1334
|
</Text>
|
|
@@ -1371,16 +1423,16 @@ exports[`Chip renders correctly with variant filled and selected true 1`] = `
|
|
|
1371
1423
|
{
|
|
1372
1424
|
"color": "#001f23",
|
|
1373
1425
|
"fontFamily": "BeVietnamPro-Regular",
|
|
1374
|
-
"fontSize":
|
|
1426
|
+
"fontSize": 14,
|
|
1375
1427
|
"letterSpacing": 0.48,
|
|
1376
|
-
"lineHeight":
|
|
1428
|
+
"lineHeight": 22,
|
|
1377
1429
|
},
|
|
1378
1430
|
undefined,
|
|
1379
1431
|
]
|
|
1380
1432
|
}
|
|
1381
1433
|
themeIntent="body"
|
|
1382
1434
|
themeTypeface="neutral"
|
|
1383
|
-
themeVariant="
|
|
1435
|
+
themeVariant="small"
|
|
1384
1436
|
>
|
|
1385
1437
|
Cover my bills
|
|
1386
1438
|
</Text>
|
|
@@ -1468,16 +1520,16 @@ exports[`Chip renders correctly with variant outlined and selected false 1`] = `
|
|
|
1468
1520
|
{
|
|
1469
1521
|
"color": "#001f23",
|
|
1470
1522
|
"fontFamily": "BeVietnamPro-Regular",
|
|
1471
|
-
"fontSize":
|
|
1523
|
+
"fontSize": 14,
|
|
1472
1524
|
"letterSpacing": 0.48,
|
|
1473
|
-
"lineHeight":
|
|
1525
|
+
"lineHeight": 22,
|
|
1474
1526
|
},
|
|
1475
1527
|
undefined,
|
|
1476
1528
|
]
|
|
1477
1529
|
}
|
|
1478
1530
|
themeIntent="body"
|
|
1479
1531
|
themeTypeface="neutral"
|
|
1480
|
-
themeVariant="
|
|
1532
|
+
themeVariant="small"
|
|
1481
1533
|
>
|
|
1482
1534
|
Cover my bills
|
|
1483
1535
|
</Text>
|
|
@@ -1565,16 +1617,16 @@ exports[`Chip renders correctly with variant outlined and selected true 1`] = `
|
|
|
1565
1617
|
{
|
|
1566
1618
|
"color": "#001f23",
|
|
1567
1619
|
"fontFamily": "BeVietnamPro-Regular",
|
|
1568
|
-
"fontSize":
|
|
1620
|
+
"fontSize": 14,
|
|
1569
1621
|
"letterSpacing": 0.48,
|
|
1570
|
-
"lineHeight":
|
|
1622
|
+
"lineHeight": 22,
|
|
1571
1623
|
},
|
|
1572
1624
|
undefined,
|
|
1573
1625
|
]
|
|
1574
1626
|
}
|
|
1575
1627
|
themeIntent="body"
|
|
1576
1628
|
themeTypeface="neutral"
|
|
1577
|
-
themeVariant="
|
|
1629
|
+
themeVariant="small"
|
|
1578
1630
|
>
|
|
1579
1631
|
Cover my bills
|
|
1580
1632
|
</Text>
|
|
@@ -1595,14 +1647,19 @@ exports[`Chip renders correctly with variant outlined and selected true 1`] = `
|
|
|
1595
1647
|
[
|
|
1596
1648
|
{
|
|
1597
1649
|
"color": "#001f23",
|
|
1598
|
-
"fontSize":
|
|
1650
|
+
"fontSize": 24,
|
|
1599
1651
|
},
|
|
1600
|
-
|
|
1652
|
+
[
|
|
1653
|
+
{
|
|
1654
|
+
"fontSize": 12,
|
|
1655
|
+
},
|
|
1656
|
+
undefined,
|
|
1657
|
+
],
|
|
1601
1658
|
]
|
|
1602
1659
|
}
|
|
1603
1660
|
testID="selected-chip-icon-cancel"
|
|
1604
1661
|
themeIntent="text"
|
|
1605
|
-
themeSize="
|
|
1662
|
+
themeSize="medium"
|
|
1606
1663
|
/>
|
|
1607
1664
|
</View>
|
|
1608
1665
|
</View>
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { fireEvent } from '@testing-library/react-native';
|
|
3
3
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
4
|
import Chip from '..';
|
|
5
|
+
import Typography from '../../Typography';
|
|
5
6
|
|
|
6
7
|
describe('Chip', () => {
|
|
7
8
|
it.each`
|
|
@@ -106,6 +107,18 @@ describe('Chip', () => {
|
|
|
106
107
|
}
|
|
107
108
|
);
|
|
108
109
|
|
|
110
|
+
it('renders custom label correctly', () => {
|
|
111
|
+
const { getByText } = renderWithTheme(
|
|
112
|
+
<Chip
|
|
113
|
+
label={
|
|
114
|
+
<Typography.Body variant="small">Cover my bills</Typography.Body>
|
|
115
|
+
}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
expect(getByText('Cover my bills')).toBeVisible();
|
|
120
|
+
});
|
|
121
|
+
|
|
109
122
|
it('calls onPress when pressed', () => {
|
|
110
123
|
const onPress = jest.fn();
|
|
111
124
|
|