@hero-design/rn 8.69.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 +23 -0
- package/es/index.js +114 -89
- package/lib/index.js +114 -89
- package/package.json +2 -2
- package/src/components/Card/StyledCard.tsx +6 -2
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +1 -1
- package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +7 -0
- package/src/components/Card/__tests__/index.spec.tsx +12 -0
- package/src/components/Card/index.tsx +8 -2
- package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +4 -0
- package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +1 -0
- package/src/components/Chip/StyledChip.tsx +56 -50
- package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +302 -336
- package/src/components/Chip/__tests__/index.spec.tsx +8 -26
- package/src/components/Chip/index.tsx +27 -34
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +13 -6
- package/src/theme/components/card.ts +1 -0
- package/src/theme/components/chip.ts +12 -6
- package/src/theme/global/colors/__tests__/__snapshots__/swagLight.spec.ts.snap +5 -5
- package/src/theme/global/colors/__tests__/__snapshots__/swagLightGlobal.spec.ts.snap +39 -0
- package/src/theme/global/colors/__tests__/__snapshots__/swagLightJobs.spec.ts.snap +5 -5
- package/src/theme/global/colors/__tests__/swagLightGlobal.spec.ts +7 -0
- package/src/theme/global/colors/swagLight.ts +2 -2
- package/src/theme/global/colors/swagLightGlobal.ts +14 -0
- package/stats/8.70.0/rn-stats.html +4842 -0
- package/stats/8.71.0/rn-stats.html +4842 -0
- package/types/components/Card/StyledCard.d.ts +1 -0
- package/types/components/Card/index.d.ts +2 -1
- package/types/components/Chip/StyledChip.d.ts +2 -20
- package/types/components/Chip/index.d.ts +7 -3
- package/types/theme/components/card.d.ts +1 -0
- package/types/theme/components/chip.d.ts +12 -6
- package/types/theme/global/colors/swagLightGlobal.d.ts +3 -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,28 @@
|
|
|
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
|
+
|
|
9
|
+
## 8.70.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#3421](https://github.com/Thinkei/hero-design/pull/3421) [`1a36cbade6beba151ca794d950db19b3cd38f414`](https://github.com/Thinkei/hero-design/commit/1a36cbade6beba151ca794d950db19b3cd38f414) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Card] Add super-round variant
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#3409](https://github.com/Thinkei/hero-design/pull/3409) [`4566296654e11a8d6be117fb241d1d94e29c4750`](https://github.com/Thinkei/hero-design/commit/4566296654e11a8d6be117fb241d1d94e29c4750) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Chip] Allow hiding selected icon
|
|
18
|
+
|
|
19
|
+
- [#3396](https://github.com/Thinkei/hero-design/pull/3396) [`4fd2a3371237fe4d8dc306380a3575a35e6213f4`](https://github.com/Thinkei/hero-design/commit/4fd2a3371237fe4d8dc306380a3575a35e6213f4) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Chip] Update styling
|
|
20
|
+
|
|
21
|
+
- [#3419](https://github.com/Thinkei/hero-design/pull/3419) [`3b050b79e0cd915fad534c208044852aeb45210c`](https://github.com/Thinkei/hero-design/commit/3b050b79e0cd915fad534c208044852aeb45210c) Thanks [@ttkien](https://github.com/ttkien)! - Add global theme for swaglight
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`3b050b79e0cd915fad534c208044852aeb45210c`](https://github.com/Thinkei/hero-design/commit/3b050b79e0cd915fad534c208044852aeb45210c)]:
|
|
24
|
+
- @hero-design/colors@8.45.1
|
|
25
|
+
|
|
3
26
|
## 8.69.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/es/index.js
CHANGED
|
@@ -1358,7 +1358,8 @@ var BASE_COLORS = {
|
|
|
1358
1358
|
theatreGold: '#a56822',
|
|
1359
1359
|
uniformGreen: '#4d4628',
|
|
1360
1360
|
yellow: '#fadb14',
|
|
1361
|
-
windsorGrey: '#606065'
|
|
1361
|
+
windsorGrey: '#606065',
|
|
1362
|
+
woodsmoke: '#121214'
|
|
1362
1363
|
};
|
|
1363
1364
|
var colorScales = Object.entries(BASE_COLORS).reduce(function (acc, _ref16) {
|
|
1364
1365
|
var _ref17 = _slicedToArray(_ref16, 2),
|
|
@@ -1739,9 +1740,13 @@ var palette$4 = Object.assign(Object.assign({}, palette$9), {
|
|
|
1739
1740
|
violet: violet1$1.base,
|
|
1740
1741
|
mauve: mauve$1.base
|
|
1741
1742
|
});
|
|
1742
|
-
var violet$3 = colorScales.violet
|
|
1743
|
+
var violet$3 = colorScales.violet,
|
|
1744
|
+
woodsmoke = colorScales.woodsmoke;
|
|
1743
1745
|
var palette$3 = Object.assign(Object.assign({}, palette$9), {
|
|
1744
|
-
violetLight90: violet$3.lighten90
|
|
1746
|
+
violetLight90: violet$3.lighten90,
|
|
1747
|
+
offBlack: woodsmoke.base,
|
|
1748
|
+
offBlackLight30: woodsmoke.lighten30,
|
|
1749
|
+
offBlackLight50: woodsmoke.lighten50
|
|
1745
1750
|
});
|
|
1746
1751
|
var scarletGum = colorScales.scarletGum,
|
|
1747
1752
|
violet1 = colorScales.violet1,
|
|
@@ -1907,6 +1912,14 @@ var swagDarkBrandSystemPalette = {
|
|
|
1907
1912
|
};
|
|
1908
1913
|
var swagDarkSystemPalette = _objectSpread2(_objectSpread2({}, globalPalette), swagDarkBrandSystemPalette);
|
|
1909
1914
|
|
|
1915
|
+
var swagLightGlobalPalette = _objectSpread2(_objectSpread2({}, globalPalette$1), {}, {
|
|
1916
|
+
onDefaultGlobalSurface: palette$3.offBlack,
|
|
1917
|
+
mutedOnDefaultGlobalSurface: palette$3.offBlackLight30,
|
|
1918
|
+
inactiveOnDefaultGlobalSurface: palette$3.offBlackLight50,
|
|
1919
|
+
primaryOutline: palette$3.offBlack,
|
|
1920
|
+
inactiveOutline: palette$3.offBlackLight50
|
|
1921
|
+
});
|
|
1922
|
+
|
|
1910
1923
|
var swagBrandSystemPallete = {
|
|
1911
1924
|
primary: '#460078',
|
|
1912
1925
|
onPrimary: '#fdfbff',
|
|
@@ -1918,7 +1931,7 @@ var swagBrandSystemPallete = {
|
|
|
1918
1931
|
decorativePrimary: '#fdfbff',
|
|
1919
1932
|
decorativePrimarySurface: '#dacce4'
|
|
1920
1933
|
};
|
|
1921
|
-
var swagSystemPalette = _objectSpread2(_objectSpread2({},
|
|
1934
|
+
var swagSystemPalette = _objectSpread2(_objectSpread2({}, swagLightGlobalPalette), swagBrandSystemPallete);
|
|
1922
1935
|
|
|
1923
1936
|
var swagLightJobsSystemPalette = _objectSpread2(_objectSpread2({}, swagSystemPalette), {}, {
|
|
1924
1937
|
secondary: '#40d1ff',
|
|
@@ -2527,7 +2540,8 @@ var getCardTheme = function getCardTheme(theme) {
|
|
|
2527
2540
|
indicatorWidth: theme.sizes.medium
|
|
2528
2541
|
};
|
|
2529
2542
|
var radii = {
|
|
2530
|
-
"default": theme.radii.large
|
|
2543
|
+
"default": theme.radii.large,
|
|
2544
|
+
superRound: theme.radii.xxxlarge
|
|
2531
2545
|
};
|
|
2532
2546
|
return {
|
|
2533
2547
|
colors: colors,
|
|
@@ -2616,21 +2630,27 @@ var getCheckboxTheme = function getCheckboxTheme(theme) {
|
|
|
2616
2630
|
|
|
2617
2631
|
var getChipTheme = function getChipTheme(theme) {
|
|
2618
2632
|
var colors = {
|
|
2619
|
-
primaryBackground: theme.colors.darkGlobalSurface,
|
|
2620
2633
|
secondaryBackground: theme.colors.highlightedSurface,
|
|
2621
2634
|
filledBackground: theme.colors.defaultGlobalSurface,
|
|
2622
|
-
outlinedBackground: 'transparent',
|
|
2623
|
-
wrapperBorder: theme.colors.primaryOutline,
|
|
2624
2635
|
wrapperSelectedBorder: 'transparent',
|
|
2625
|
-
|
|
2636
|
+
outlinedDefaultBackground: theme.colors.defaultGlobalSurface,
|
|
2637
|
+
outlinedSelectedBackground: theme.colors.secondaryOutline,
|
|
2638
|
+
outlinedSelectedBorder: theme.colors.primaryOutline,
|
|
2639
|
+
outlinedDefaultBorder: theme.colors.disabledOnDefaultGlobalSurface,
|
|
2640
|
+
compactDefaultBackground: theme.colors.defaultGlobalSurface,
|
|
2641
|
+
compactSelectedBackground: theme.colors.neutralGlobalSurface
|
|
2626
2642
|
};
|
|
2627
2643
|
var space = {
|
|
2628
2644
|
wrapperHorizontalPadding: theme.space.smallMedium,
|
|
2629
2645
|
wrapperVerticalPadding: theme.space.small,
|
|
2630
|
-
|
|
2646
|
+
compactWrapperHorizontalPadding: theme.space.small,
|
|
2647
|
+
compactWrapperVerticalPadding: theme.space.xsmall,
|
|
2648
|
+
iconWrapperHorizontalMargin: theme.space.small,
|
|
2649
|
+
outlinedSelectedMarginTop: -theme.space.xxsmall
|
|
2631
2650
|
};
|
|
2632
2651
|
var sizes = {
|
|
2633
|
-
|
|
2652
|
+
outlinedDefaultBorder: theme.borderWidths.base,
|
|
2653
|
+
outlinedSelectedBorder: theme.borderWidths.medium
|
|
2634
2654
|
};
|
|
2635
2655
|
var radii = {
|
|
2636
2656
|
wrapper: theme.radii.rounded
|
|
@@ -7045,7 +7065,7 @@ var Caption = function Caption(_ref) {
|
|
|
7045
7065
|
}), children);
|
|
7046
7066
|
};
|
|
7047
7067
|
|
|
7048
|
-
var StyledLabel
|
|
7068
|
+
var StyledLabel = index$9(Text$1)(function (_ref) {
|
|
7049
7069
|
var themeIntent = _ref.themeIntent,
|
|
7050
7070
|
theme = _ref.theme;
|
|
7051
7071
|
return {
|
|
@@ -7064,7 +7084,7 @@ var Label = function Label(_ref) {
|
|
|
7064
7084
|
_ref$allowFontScaling = _ref.allowFontScaling,
|
|
7065
7085
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
7066
7086
|
nativeProps = _objectWithoutProperties(_ref, _excluded$D);
|
|
7067
|
-
return /*#__PURE__*/React__default.createElement(StyledLabel
|
|
7087
|
+
return /*#__PURE__*/React__default.createElement(StyledLabel, _extends$1({}, nativeProps, {
|
|
7068
7088
|
themeIntent: intent,
|
|
7069
7089
|
allowFontScaling: allowFontScaling
|
|
7070
7090
|
}), children);
|
|
@@ -7872,7 +7892,7 @@ var IconContainer$1 = index$9(View)(function (_ref2) {
|
|
|
7872
7892
|
paddingLeft: theme.__hd__.alert.space.iconLeftPadding
|
|
7873
7893
|
};
|
|
7874
7894
|
});
|
|
7875
|
-
var StyledIcon$
|
|
7895
|
+
var StyledIcon$1 = index$9(Icon)(function (_ref3) {
|
|
7876
7896
|
var theme = _ref3.theme,
|
|
7877
7897
|
themeIntent = _ref3.themeIntent;
|
|
7878
7898
|
return {
|
|
@@ -7931,7 +7951,7 @@ var AlertIcon = function AlertIcon(_ref) {
|
|
|
7931
7951
|
intent = _ref.intent;
|
|
7932
7952
|
return icon ? /*#__PURE__*/React__default.createElement(IconContainer$1, {
|
|
7933
7953
|
testID: "alert-left-icon"
|
|
7934
|
-
}, /*#__PURE__*/React__default.createElement(StyledIcon$
|
|
7954
|
+
}, /*#__PURE__*/React__default.createElement(StyledIcon$1, {
|
|
7935
7955
|
icon: icon,
|
|
7936
7956
|
size: "small",
|
|
7937
7957
|
themeIntent: intent
|
|
@@ -7972,7 +7992,7 @@ var Alert = function Alert(_ref2) {
|
|
|
7972
7992
|
}, typeof actionLabel === 'string' ? /*#__PURE__*/React__default.createElement(StyledBody, {
|
|
7973
7993
|
variant: "small-bold",
|
|
7974
7994
|
themeIntent: intent
|
|
7975
|
-
}, actionLabel) : /*#__PURE__*/React__default.createElement(StyledIcon$
|
|
7995
|
+
}, actionLabel) : /*#__PURE__*/React__default.createElement(StyledIcon$1, {
|
|
7976
7996
|
icon: "cancel",
|
|
7977
7997
|
size: "small",
|
|
7978
7998
|
themeIntent: intent
|
|
@@ -8925,7 +8945,7 @@ var StyledFooter = index$9(View)(function (_ref6) {
|
|
|
8925
8945
|
flexDirection: 'row'
|
|
8926
8946
|
};
|
|
8927
8947
|
});
|
|
8928
|
-
var StyledIconWrapper$
|
|
8948
|
+
var StyledIconWrapper$3 = index$9(View)(function (_ref7) {
|
|
8929
8949
|
var theme = _ref7.theme;
|
|
8930
8950
|
return {
|
|
8931
8951
|
alignItems: 'flex-end',
|
|
@@ -9454,7 +9474,7 @@ var Header = function Header(_ref) {
|
|
|
9454
9474
|
style: {
|
|
9455
9475
|
flex: 1
|
|
9456
9476
|
}
|
|
9457
|
-
}, content), showCloseButton ? /*#__PURE__*/React__default.createElement(StyledIconWrapper$
|
|
9477
|
+
}, content), showCloseButton ? /*#__PURE__*/React__default.createElement(StyledIconWrapper$3, null, variant === 'fixed' ? /*#__PURE__*/React__default.createElement(CompoundButton.Icon, {
|
|
9458
9478
|
icon: "cancel",
|
|
9459
9479
|
onPress: onRequestClose,
|
|
9460
9480
|
intent: "text",
|
|
@@ -12306,22 +12326,26 @@ var DataCard = function DataCard(_ref) {
|
|
|
12306
12326
|
|
|
12307
12327
|
var StyledCard$1 = index$9(View)(function (_ref) {
|
|
12308
12328
|
var theme = _ref.theme,
|
|
12309
|
-
themeIntent = _ref.themeIntent
|
|
12329
|
+
themeIntent = _ref.themeIntent,
|
|
12330
|
+
themeVariant = _ref.themeVariant;
|
|
12310
12331
|
return _objectSpread2(_objectSpread2({}, themeIntent !== undefined && {
|
|
12311
12332
|
backgroundColor: theme.__hd__.card.colors[themeIntent]
|
|
12312
12333
|
}), {}, {
|
|
12313
|
-
borderRadius: theme.__hd__.card.radii["default"],
|
|
12334
|
+
borderRadius: themeVariant === 'basic' ? theme.__hd__.card.radii["default"] : theme.__hd__.card.radii.superRound,
|
|
12314
12335
|
overflow: 'hidden'
|
|
12315
12336
|
});
|
|
12316
12337
|
});
|
|
12317
12338
|
|
|
12318
|
-
var _excluded$p = ["intent", "children"];
|
|
12339
|
+
var _excluded$p = ["intent", "children", "variant"];
|
|
12319
12340
|
var Card = function Card(_ref) {
|
|
12320
12341
|
var intent = _ref.intent,
|
|
12321
12342
|
children = _ref.children,
|
|
12343
|
+
_ref$variant = _ref.variant,
|
|
12344
|
+
variant = _ref$variant === void 0 ? 'basic' : _ref$variant,
|
|
12322
12345
|
nativeProps = _objectWithoutProperties(_ref, _excluded$p);
|
|
12323
12346
|
return /*#__PURE__*/React__default.createElement(StyledCard$1, _extends$1({}, nativeProps, {
|
|
12324
|
-
themeIntent: intent
|
|
12347
|
+
themeIntent: intent,
|
|
12348
|
+
themeVariant: variant
|
|
12325
12349
|
}), children);
|
|
12326
12350
|
};
|
|
12327
12351
|
var Card$1 = Object.assign(Card, {
|
|
@@ -12866,6 +12890,7 @@ var StyledChipWrapper = index$9(TouchableOpacity)(function (_ref) {
|
|
|
12866
12890
|
theme = _ref.theme;
|
|
12867
12891
|
var getShadowStyles = function getShadowStyles() {
|
|
12868
12892
|
switch (themeVariant) {
|
|
12893
|
+
case 'compact':
|
|
12869
12894
|
case 'filled':
|
|
12870
12895
|
return _objectSpread2({}, theme.__hd__.chip.shadows.filledWrapper);
|
|
12871
12896
|
case 'outlined':
|
|
@@ -12873,26 +12898,20 @@ var StyledChipWrapper = index$9(TouchableOpacity)(function (_ref) {
|
|
|
12873
12898
|
}
|
|
12874
12899
|
};
|
|
12875
12900
|
var getBorderStyles = function getBorderStyles() {
|
|
12876
|
-
var commonStyle = {
|
|
12877
|
-
borderWidth: theme.__hd__.chip.sizes.wrapperBorder
|
|
12878
|
-
};
|
|
12879
|
-
if (themeSelected) {
|
|
12880
|
-
return _objectSpread2(_objectSpread2({}, commonStyle), {}, {
|
|
12881
|
-
borderColor: theme.__hd__.chip.colors.wrapperSelectedBorder
|
|
12882
|
-
});
|
|
12883
|
-
}
|
|
12884
12901
|
switch (themeVariant) {
|
|
12885
12902
|
case 'outlined':
|
|
12886
12903
|
{
|
|
12887
|
-
return
|
|
12888
|
-
borderColor: theme.__hd__.chip.colors.
|
|
12889
|
-
|
|
12904
|
+
return {
|
|
12905
|
+
borderColor: themeSelected ? theme.__hd__.chip.colors.outlinedSelectedBorder : theme.__hd__.chip.colors.outlinedDefaultBorder,
|
|
12906
|
+
borderWidth: themeSelected ? theme.__hd__.chip.sizes.outlinedSelectedBorder : theme.__hd__.chip.sizes.outlinedDefaultBorder
|
|
12907
|
+
};
|
|
12890
12908
|
}
|
|
12909
|
+
case 'compact':
|
|
12891
12910
|
case 'filled':
|
|
12892
12911
|
{
|
|
12893
|
-
return
|
|
12912
|
+
return {
|
|
12894
12913
|
borderColor: theme.__hd__.chip.colors.wrapperSelectedBorder
|
|
12895
|
-
}
|
|
12914
|
+
};
|
|
12896
12915
|
}
|
|
12897
12916
|
}
|
|
12898
12917
|
};
|
|
@@ -12902,64 +12921,74 @@ var StyledChipWrapper = index$9(TouchableOpacity)(function (_ref) {
|
|
|
12902
12921
|
case 'outlined':
|
|
12903
12922
|
{
|
|
12904
12923
|
return {
|
|
12905
|
-
backgroundColor: theme.__hd__.chip.colors.
|
|
12924
|
+
backgroundColor: themeSelected ? theme.__hd__.chip.colors.outlinedSelectedBackground : theme.__hd__.chip.colors.outlinedDefaultBackground
|
|
12906
12925
|
};
|
|
12907
12926
|
}
|
|
12908
12927
|
case 'filled':
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
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
|
+
}
|
|
12912
12939
|
}
|
|
12913
12940
|
} else {
|
|
12914
12941
|
switch (themeVariant) {
|
|
12915
12942
|
case 'outlined':
|
|
12916
12943
|
{
|
|
12917
12944
|
return {
|
|
12918
|
-
backgroundColor: theme.__hd__.chip.colors.
|
|
12945
|
+
backgroundColor: theme.__hd__.chip.colors.outlinedDefaultBackground
|
|
12919
12946
|
};
|
|
12920
12947
|
}
|
|
12921
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
|
+
{
|
|
12922
12967
|
return {
|
|
12923
|
-
|
|
12968
|
+
paddingHorizontal: theme.__hd__.chip.space.compactWrapperHorizontalPadding,
|
|
12969
|
+
paddingVertical: theme.__hd__.chip.space.compactWrapperVerticalPadding
|
|
12924
12970
|
};
|
|
12925
|
-
|
|
12971
|
+
}
|
|
12972
|
+
default:
|
|
12973
|
+
{
|
|
12974
|
+
return {
|
|
12975
|
+
paddingHorizontal: theme.__hd__.chip.space.wrapperHorizontalPadding,
|
|
12976
|
+
paddingVertical: theme.__hd__.chip.space.wrapperVerticalPadding
|
|
12977
|
+
};
|
|
12978
|
+
}
|
|
12926
12979
|
}
|
|
12927
12980
|
};
|
|
12928
|
-
return _objectSpread2(_objectSpread2(_objectSpread2({
|
|
12981
|
+
return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
12929
12982
|
alignSelf: 'flex-start',
|
|
12930
12983
|
flexDirection: 'row',
|
|
12931
12984
|
alignItems: 'center',
|
|
12932
12985
|
justifyContent: 'center',
|
|
12933
12986
|
borderRadius: theme.__hd__.chip.radii.wrapper,
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
borderWidth: theme.__hd__.chip.sizes.wrapperBorder
|
|
12937
|
-
}, getShadowStyles()), getBorderStyles()), getBackgroundStyles());
|
|
12938
|
-
});
|
|
12939
|
-
var StyledIconWrapper$3 = index$9(Box)(function (_ref2) {
|
|
12940
|
-
var theme = _ref2.theme;
|
|
12941
|
-
return {
|
|
12942
|
-
marginRight: theme.__hd__.chip.space.iconWrapperMarginRight
|
|
12943
|
-
};
|
|
12944
|
-
});
|
|
12945
|
-
var StyledLabel = index$9(Typography.Body)(function (_ref3) {
|
|
12946
|
-
var themeSelected = _ref3.themeSelected,
|
|
12947
|
-
themeVariant = _ref3.themeVariant,
|
|
12948
|
-
theme = _ref3.theme;
|
|
12949
|
-
return {
|
|
12950
|
-
color: themeSelected && themeVariant === 'outlined' ? theme.__hd__.chip.colors.selectedPrimaryText : undefined
|
|
12951
|
-
};
|
|
12952
|
-
});
|
|
12953
|
-
var StyledIcon$1 = index$9(Icon)(function (_ref4) {
|
|
12954
|
-
var themeSelected = _ref4.themeSelected,
|
|
12955
|
-
themeVariant = _ref4.themeVariant,
|
|
12956
|
-
theme = _ref4.theme;
|
|
12957
|
-
return {
|
|
12958
|
-
color: themeSelected && themeVariant === 'outlined' ? theme.__hd__.chip.colors.selectedPrimaryText : undefined
|
|
12959
|
-
};
|
|
12987
|
+
marginTop: themeSelected && themeVariant === 'outlined' ? theme.__hd__.chip.space.outlinedSelectedMarginTop : undefined
|
|
12988
|
+
}, getShadowStyles()), getBorderStyles()), getPaddingStyles()), getBackgroundStyles());
|
|
12960
12989
|
});
|
|
12961
12990
|
|
|
12962
|
-
var _excluded$m = ["label", "variant", "selected", "icon", "onPress"];
|
|
12991
|
+
var _excluded$m = ["label", "variant", "selected", "icon", "onPress", "showSelectedIcon"];
|
|
12963
12992
|
var Chip = function Chip(_ref) {
|
|
12964
12993
|
var label = _ref.label,
|
|
12965
12994
|
_ref$variant = _ref.variant,
|
|
@@ -12968,31 +12997,27 @@ var Chip = function Chip(_ref) {
|
|
|
12968
12997
|
selected = _ref$selected === void 0 ? false : _ref$selected,
|
|
12969
12998
|
icon = _ref.icon,
|
|
12970
12999
|
onPress = _ref.onPress,
|
|
13000
|
+
_ref$showSelectedIcon = _ref.showSelectedIcon,
|
|
13001
|
+
showSelectedIcon = _ref$showSelectedIcon === void 0 ? true : _ref$showSelectedIcon,
|
|
12971
13002
|
otherProps = _objectWithoutProperties(_ref, _excluded$m);
|
|
12972
|
-
var
|
|
12973
|
-
if (icon && variant === 'filled') {
|
|
12974
|
-
return icon;
|
|
12975
|
-
}
|
|
12976
|
-
if (selected) {
|
|
12977
|
-
return 'checkmark';
|
|
12978
|
-
}
|
|
12979
|
-
return undefined;
|
|
12980
|
-
}, [icon, selected, variant]);
|
|
13003
|
+
var shouldShowSelectedIcon = variant === 'outlined' && selected && showSelectedIcon;
|
|
12981
13004
|
return /*#__PURE__*/React__default.createElement(StyledChipWrapper, _extends$1({
|
|
12982
13005
|
onPress: onPress,
|
|
12983
13006
|
themeVariant: variant,
|
|
12984
13007
|
themeSelected: selected
|
|
12985
|
-
}, otherProps),
|
|
13008
|
+
}, otherProps), icon && /*#__PURE__*/React__default.createElement(Box, {
|
|
13009
|
+
marginRight: "small"
|
|
13010
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
12986
13011
|
size: "xsmall",
|
|
12987
|
-
icon:
|
|
12988
|
-
|
|
12989
|
-
|
|
12990
|
-
|
|
12991
|
-
}
|
|
12992
|
-
|
|
12993
|
-
|
|
12994
|
-
|
|
12995
|
-
}
|
|
13012
|
+
icon: icon,
|
|
13013
|
+
testID: "chip-icon-".concat(icon)
|
|
13014
|
+
})), /*#__PURE__*/React__default.createElement(Typography.Body, null, label), shouldShowSelectedIcon && /*#__PURE__*/React__default.createElement(Box, {
|
|
13015
|
+
marginLeft: "small"
|
|
13016
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
13017
|
+
size: "xsmall",
|
|
13018
|
+
icon: "cancel",
|
|
13019
|
+
testID: "selected-chip-icon-cancel"
|
|
13020
|
+
})));
|
|
12996
13021
|
};
|
|
12997
13022
|
|
|
12998
13023
|
var StyledWrapper$7 = index$9(TouchableOpacity)(function (_ref) {
|