@hero-design/rn 8.103.7 → 8.104.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 +12 -0
- package/es/index.js +215 -18
- package/lib/index.js +215 -17
- package/package.json +1 -1
- package/src/components/FilterTrigger/StyledFilterTrigger.tsx +104 -0
- package/src/components/FilterTrigger/__tests__/__snapshots__/index.spec.tsx.snap +637 -0
- package/src/components/FilterTrigger/__tests__/index.spec.tsx +161 -0
- package/src/components/FilterTrigger/index.tsx +106 -0
- package/src/components/Icon/HeroIcon/index.tsx +3 -1
- package/src/components/Icon/__tests__/__snapshots__/index.spec.tsx.snap +45 -0
- package/src/components/Icon/__tests__/index.spec.tsx +1 -0
- package/src/components/Icon/index.tsx +2 -1
- package/src/components/Toolbar/StyledToolbar.tsx +0 -1
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarMessage.spec.tsx.snap +0 -4
- package/src/index.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +71 -0
- package/src/theme/components/filterTrigger.ts +88 -0
- package/src/theme/components/icon.ts +1 -0
- package/src/theme/getTheme.ts +3 -0
- package/stats/8.104.0/rn-stats.html +4844 -0
- package/types/components/FilterTrigger/StyledFilterTrigger.d.ts +20 -0
- package/types/components/FilterTrigger/index.d.ts +39 -0
- package/types/components/Icon/HeroIcon/index.d.ts +1 -1
- package/types/components/Icon/index.d.ts +1 -1
- package/types/index.d.ts +2 -1
- package/types/theme/components/filterTrigger.d.ts +72 -0
- package/types/theme/components/icon.d.ts +1 -0
- package/types/theme/getTheme.d.ts +2 -0
package/lib/index.js
CHANGED
|
@@ -6277,7 +6277,8 @@ var getIconTheme = function getIconTheme(theme) {
|
|
|
6277
6277
|
warning: theme.colors.warning,
|
|
6278
6278
|
disabledText: theme.colors.disabledOnDefaultGlobalSurface,
|
|
6279
6279
|
invertedText: theme.colors.onDarkGlobalSurface,
|
|
6280
|
-
muted: theme.colors.mutedOnDefaultGlobalSurface
|
|
6280
|
+
muted: theme.colors.mutedOnDefaultGlobalSurface,
|
|
6281
|
+
inactive: theme.colors.inactiveOnDefaultGlobalSurface
|
|
6281
6282
|
};
|
|
6282
6283
|
var sizes = {
|
|
6283
6284
|
xxxsmall: theme.fontSizes.small,
|
|
@@ -7407,6 +7408,85 @@ var getAppCueTheme = function getAppCueTheme(theme) {
|
|
|
7407
7408
|
};
|
|
7408
7409
|
};
|
|
7409
7410
|
|
|
7411
|
+
var getFilterTriggerTheme = function getFilterTriggerTheme(theme) {
|
|
7412
|
+
var borderWidths = {
|
|
7413
|
+
wrapper: {
|
|
7414
|
+
filled: theme.borderWidths.medium,
|
|
7415
|
+
outlined: theme.borderWidths.medium,
|
|
7416
|
+
ghost: 0
|
|
7417
|
+
}
|
|
7418
|
+
};
|
|
7419
|
+
var colors = {
|
|
7420
|
+
wrapper: {
|
|
7421
|
+
activeBackground: theme.colors.highlightedSurface,
|
|
7422
|
+
inactiveBackground: theme.colors.neutralGlobalSurface,
|
|
7423
|
+
background: {
|
|
7424
|
+
active: {
|
|
7425
|
+
filled: theme.colors.highlightedSurface,
|
|
7426
|
+
outlined: 'transparent',
|
|
7427
|
+
ghost: 'transparent',
|
|
7428
|
+
filledLabeless: theme.colors.neutralGlobalSurface
|
|
7429
|
+
},
|
|
7430
|
+
inactive: {
|
|
7431
|
+
filled: theme.colors.neutralGlobalSurface,
|
|
7432
|
+
outlined: 'transparent',
|
|
7433
|
+
ghost: 'transparent'
|
|
7434
|
+
}
|
|
7435
|
+
},
|
|
7436
|
+
border: {
|
|
7437
|
+
active: {
|
|
7438
|
+
filled: theme.colors.highlightedSurface,
|
|
7439
|
+
outlined: theme.colors.primaryOutline,
|
|
7440
|
+
ghost: 'transparent',
|
|
7441
|
+
filledLabeless: theme.colors.neutralGlobalSurface
|
|
7442
|
+
},
|
|
7443
|
+
inactive: {
|
|
7444
|
+
filled: theme.colors.neutralGlobalSurface,
|
|
7445
|
+
outlined: theme.colors.secondaryOutline,
|
|
7446
|
+
ghost: 'transparent'
|
|
7447
|
+
}
|
|
7448
|
+
}
|
|
7449
|
+
}
|
|
7450
|
+
};
|
|
7451
|
+
var space = {
|
|
7452
|
+
wrapper: {
|
|
7453
|
+
"default": {
|
|
7454
|
+
paddingHorizontal: theme.space.smallMedium,
|
|
7455
|
+
paddingVertical: theme.space.xsmall
|
|
7456
|
+
},
|
|
7457
|
+
labeless: {
|
|
7458
|
+
paddingHorizontal: theme.space.small,
|
|
7459
|
+
paddingVertical: theme.space.xsmall
|
|
7460
|
+
},
|
|
7461
|
+
itemGap: theme.space.xsmall
|
|
7462
|
+
},
|
|
7463
|
+
badge: {
|
|
7464
|
+
labelessRight: theme.space.xxsmall,
|
|
7465
|
+
labelessBottom: theme.space.xxsmall
|
|
7466
|
+
}
|
|
7467
|
+
};
|
|
7468
|
+
var radii = {
|
|
7469
|
+
wrapper: {
|
|
7470
|
+
"default": theme.radii.xxxlarge,
|
|
7471
|
+
labeless: theme.radii.xlarge
|
|
7472
|
+
}
|
|
7473
|
+
};
|
|
7474
|
+
var sizes = {
|
|
7475
|
+
wrapperHeight: scale(36)
|
|
7476
|
+
};
|
|
7477
|
+
var lineHeights = {
|
|
7478
|
+
text: theme.lineHeights.small
|
|
7479
|
+
};
|
|
7480
|
+
return {
|
|
7481
|
+
colors: colors,
|
|
7482
|
+
space: space,
|
|
7483
|
+
radii: radii,
|
|
7484
|
+
borderWidths: borderWidths,
|
|
7485
|
+
sizes: sizes,
|
|
7486
|
+
lineHeights: lineHeights
|
|
7487
|
+
};
|
|
7488
|
+
};
|
|
7489
|
+
|
|
7410
7490
|
var getTheme = function getTheme() {
|
|
7411
7491
|
var scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : scale$1;
|
|
7412
7492
|
var systemPallete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : swagSystemPalette$2;
|
|
@@ -7439,6 +7519,7 @@ var getTheme = function getTheme() {
|
|
|
7439
7519
|
empty: getEmptyTheme(globalTheme),
|
|
7440
7520
|
error: getErrorTheme(globalTheme),
|
|
7441
7521
|
fab: getFABTheme(globalTheme),
|
|
7522
|
+
filterTrigger: getFilterTriggerTheme(globalTheme),
|
|
7442
7523
|
icon: getIconTheme(globalTheme),
|
|
7443
7524
|
image: getImageTheme(globalTheme),
|
|
7444
7525
|
list: getListTheme(globalTheme),
|
|
@@ -7644,7 +7725,7 @@ var FONTWEIGHT_MAP$2 = {
|
|
|
7644
7725
|
regular: 'regular',
|
|
7645
7726
|
'semi-bold': 'semiBold'
|
|
7646
7727
|
};
|
|
7647
|
-
var StyledText$
|
|
7728
|
+
var StyledText$4 = index$b(reactNative.Text)(function (_ref) {
|
|
7648
7729
|
var themeFontSize = _ref.themeFontSize,
|
|
7649
7730
|
themeFontWeight = _ref.themeFontWeight,
|
|
7650
7731
|
themeIntent = _ref.themeIntent,
|
|
@@ -7676,7 +7757,7 @@ var Text = function Text(_ref) {
|
|
|
7676
7757
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
7677
7758
|
nativeProps = _objectWithoutProperties(_ref, _excluded$O);
|
|
7678
7759
|
useDeprecation('Typography.Text is deprecated and will be removed in the next major release, please refer to https://design.employmenthero.com/mobile/Components/typography for the appropriate alternatives.');
|
|
7679
|
-
return /*#__PURE__*/React__namespace.default.createElement(StyledText$
|
|
7760
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledText$4, _extends$1({}, nativeProps, {
|
|
7680
7761
|
themeFontSize: fontSize,
|
|
7681
7762
|
themeFontWeight: fontWeight,
|
|
7682
7763
|
themeIntent: intent,
|
|
@@ -8406,7 +8487,8 @@ var COLOR_INTENTS = {
|
|
|
8406
8487
|
warning: 'warning',
|
|
8407
8488
|
'disabled-text': 'disabledText',
|
|
8408
8489
|
'text-inverted': 'invertedText',
|
|
8409
|
-
muted: 'muted'
|
|
8490
|
+
muted: 'muted',
|
|
8491
|
+
inactive: 'inactive'
|
|
8410
8492
|
};
|
|
8411
8493
|
var StyledHeroIcon = index$b(HeroIcon)(function (_ref) {
|
|
8412
8494
|
var themeIntent = _ref.themeIntent,
|
|
@@ -9133,7 +9215,7 @@ var StyledTextWrapper$1 = index$b(reactNative.View)(function () {
|
|
|
9133
9215
|
height: '100%'
|
|
9134
9216
|
};
|
|
9135
9217
|
});
|
|
9136
|
-
var StyledText$
|
|
9218
|
+
var StyledText$3 = index$b(Typography.Body)(function (_ref2) {
|
|
9137
9219
|
var themeSize = _ref2.themeSize,
|
|
9138
9220
|
theme = _ref2.theme;
|
|
9139
9221
|
return _objectSpread2({
|
|
@@ -9188,7 +9270,7 @@ var Avatar = function Avatar(_ref) {
|
|
|
9188
9270
|
themeIntent: intent,
|
|
9189
9271
|
themeSize: size,
|
|
9190
9272
|
style: style
|
|
9191
|
-
}, (source === undefined || hasImageError) && /*#__PURE__*/React__namespace.default.createElement(StyledTextWrapper$1, null, /*#__PURE__*/React__namespace.default.createElement(StyledText$
|
|
9273
|
+
}, (source === undefined || hasImageError) && /*#__PURE__*/React__namespace.default.createElement(StyledTextWrapper$1, null, /*#__PURE__*/React__namespace.default.createElement(StyledText$3, {
|
|
9192
9274
|
themeSize: size
|
|
9193
9275
|
}, title)), source !== undefined && /*#__PURE__*/React__namespace.default.createElement(StyledImage$1, {
|
|
9194
9276
|
resizeMode: "cover",
|
|
@@ -9713,7 +9795,7 @@ var StyledView$2 = index$b(reactNative.Animated.View)(function (_ref) {
|
|
|
9713
9795
|
borderColor: themeVariant === 'outlined' ? theme.__hd__.badge.colors.border : theme.__hd__.badge.colors[themeIntent]
|
|
9714
9796
|
};
|
|
9715
9797
|
});
|
|
9716
|
-
var StyledText$
|
|
9798
|
+
var StyledText$2 = index$b(Typography.Caption)(function (_ref2) {
|
|
9717
9799
|
var theme = _ref2.theme,
|
|
9718
9800
|
themeSize = _ref2.themeSize;
|
|
9719
9801
|
return {
|
|
@@ -9903,7 +9985,7 @@ var Badge = function Badge(_ref) {
|
|
|
9903
9985
|
icon: icon,
|
|
9904
9986
|
themeSize: size,
|
|
9905
9987
|
intent: "text-inverted"
|
|
9906
|
-
}) : /*#__PURE__*/React__namespace.default.createElement(StyledText$
|
|
9988
|
+
}) : /*#__PURE__*/React__namespace.default.createElement(StyledText$2, {
|
|
9907
9989
|
themeSize: size
|
|
9908
9990
|
}, content));
|
|
9909
9991
|
};
|
|
@@ -23700,7 +23782,7 @@ var StyledContent = index$b(reactNative.View)(function (_ref2) {
|
|
|
23700
23782
|
alignItems: 'center'
|
|
23701
23783
|
};
|
|
23702
23784
|
});
|
|
23703
|
-
var StyledBadge$
|
|
23785
|
+
var StyledBadge$2 = index$b(reactNative.View)(function (_ref3) {
|
|
23704
23786
|
var theme = _ref3.theme;
|
|
23705
23787
|
return {
|
|
23706
23788
|
right: theme.__hd__.mapPin.space.iconRight,
|
|
@@ -23788,7 +23870,7 @@ var MapPin = function MapPin(_ref) {
|
|
|
23788
23870
|
icon: icon,
|
|
23789
23871
|
size: "xsmall",
|
|
23790
23872
|
testID: testID ? "".concat(testID, "-icon") : undefined
|
|
23791
|
-
})), badgeIcon && /*#__PURE__*/React__namespace.default.createElement(StyledBadge$
|
|
23873
|
+
})), badgeIcon && /*#__PURE__*/React__namespace.default.createElement(StyledBadge$2, {
|
|
23792
23874
|
testID: testID ? "".concat(testID, "-badge") : undefined
|
|
23793
23875
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledBadgeIcon, {
|
|
23794
23876
|
icon: badgeIcon,
|
|
@@ -26728,7 +26810,7 @@ var StyledView = index$b(reactNative.View)(function (_ref) {
|
|
|
26728
26810
|
paddingHorizontal: theme.__hd__.tag.space.horizontalPadding
|
|
26729
26811
|
};
|
|
26730
26812
|
});
|
|
26731
|
-
var StyledText = index$b(Typography.Caption)(function (_ref2) {
|
|
26813
|
+
var StyledText$1 = index$b(Typography.Caption)(function (_ref2) {
|
|
26732
26814
|
var themeIntent = _ref2.themeIntent,
|
|
26733
26815
|
theme = _ref2.theme;
|
|
26734
26816
|
return {
|
|
@@ -26754,7 +26836,7 @@ var Tag = function Tag(_ref) {
|
|
|
26754
26836
|
themeIntent: intent,
|
|
26755
26837
|
style: style,
|
|
26756
26838
|
testID: testID
|
|
26757
|
-
}), typeof content === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledText, {
|
|
26839
|
+
}), typeof content === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledText$1, {
|
|
26758
26840
|
themeIntent: intent,
|
|
26759
26841
|
fontWeight: "semi-bold"
|
|
26760
26842
|
}, content) : content);
|
|
@@ -27045,8 +27127,7 @@ var StyledInputContainer$1 = index$b(reactNative.View)(function (_ref8) {
|
|
|
27045
27127
|
backgroundColor: theme.__hd__.toolbar.colors.inputContainerBackground,
|
|
27046
27128
|
borderRadius: theme.__hd__.toolbar.radii.messageContainer,
|
|
27047
27129
|
height: theme.__hd__.toolbar.sizes.messageInputHeight,
|
|
27048
|
-
paddingHorizontal: theme.__hd__.toolbar.space.messageInputPaddingHorizontal
|
|
27049
|
-
paddingVertical: theme.__hd__.toolbar.space.messageInputPaddingVertical
|
|
27130
|
+
paddingHorizontal: theme.__hd__.toolbar.space.messageInputPaddingHorizontal
|
|
27050
27131
|
};
|
|
27051
27132
|
});
|
|
27052
27133
|
var StyledInput$1 = index$b(reactNative.TextInput)(function (_ref9) {
|
|
@@ -46606,7 +46687,7 @@ var StyledHandlerContainer = index$b(reactNative.View)(function (_ref5) {
|
|
|
46606
46687
|
paddingVertical: theme.__hd__.search.space.inputVerticalPadding
|
|
46607
46688
|
};
|
|
46608
46689
|
});
|
|
46609
|
-
var StyledBadge = index$b(Badge$1)(function (_ref6) {
|
|
46690
|
+
var StyledBadge$1 = index$b(Badge$1)(function (_ref6) {
|
|
46610
46691
|
var theme = _ref6.theme;
|
|
46611
46692
|
return {
|
|
46612
46693
|
position: 'absolute',
|
|
@@ -46808,12 +46889,12 @@ var renderBadge = function renderBadge(props) {
|
|
|
46808
46889
|
var content = props.content,
|
|
46809
46890
|
icon = props.icon,
|
|
46810
46891
|
rest = _objectWithoutProperties(props, _excluded$1);
|
|
46811
|
-
if (content) return /*#__PURE__*/React__namespace.default.createElement(StyledBadge, _extends$1({
|
|
46892
|
+
if (content) return /*#__PURE__*/React__namespace.default.createElement(StyledBadge$1, _extends$1({
|
|
46812
46893
|
intent: "primary",
|
|
46813
46894
|
content: content,
|
|
46814
46895
|
size: "small"
|
|
46815
46896
|
}, rest));
|
|
46816
|
-
if (icon) return /*#__PURE__*/React__namespace.default.createElement(StyledBadge, _extends$1({
|
|
46897
|
+
if (icon) return /*#__PURE__*/React__namespace.default.createElement(StyledBadge$1, _extends$1({
|
|
46817
46898
|
intent: "primary",
|
|
46818
46899
|
icon: icon,
|
|
46819
46900
|
size: "small"
|
|
@@ -46923,6 +47004,122 @@ var FloatingIsland = function FloatingIsland(_ref2) {
|
|
|
46923
47004
|
}));
|
|
46924
47005
|
};
|
|
46925
47006
|
|
|
47007
|
+
var getBackgroundColor = function getBackgroundColor(theme, themeIsActive, themeHasLabel, themeVariant) {
|
|
47008
|
+
var colors = theme.__hd__.filterTrigger.colors;
|
|
47009
|
+
if (themeIsActive && !themeHasLabel && themeVariant === 'filled') {
|
|
47010
|
+
return colors.wrapper.background.active.filledLabeless;
|
|
47011
|
+
}
|
|
47012
|
+
var state = themeIsActive ? 'active' : 'inactive';
|
|
47013
|
+
return colors.wrapper.background[state][themeVariant];
|
|
47014
|
+
};
|
|
47015
|
+
var getBorderStyles = function getBorderStyles(theme, themeIsActive, themeHasLabel, themeVariant) {
|
|
47016
|
+
var _theme$__hd__$filterT = theme.__hd__.filterTrigger,
|
|
47017
|
+
colors = _theme$__hd__$filterT.colors,
|
|
47018
|
+
borderWidths = _theme$__hd__$filterT.borderWidths,
|
|
47019
|
+
radii = _theme$__hd__$filterT.radii;
|
|
47020
|
+
var borderColor;
|
|
47021
|
+
if (themeIsActive && !themeHasLabel && themeVariant === 'filled') {
|
|
47022
|
+
borderColor = colors.wrapper.border.active.filledLabeless;
|
|
47023
|
+
} else {
|
|
47024
|
+
var state = themeIsActive ? 'active' : 'inactive';
|
|
47025
|
+
borderColor = colors.wrapper.border[state][themeVariant];
|
|
47026
|
+
}
|
|
47027
|
+
return {
|
|
47028
|
+
borderWidth: borderWidths.wrapper[themeVariant],
|
|
47029
|
+
borderColor: borderColor,
|
|
47030
|
+
borderRadius: themeHasLabel ? radii.wrapper["default"] : radii.wrapper.labeless
|
|
47031
|
+
};
|
|
47032
|
+
};
|
|
47033
|
+
var getSpacingStyles = function getSpacingStyles(theme, themeHasLabel) {
|
|
47034
|
+
var space = theme.__hd__.filterTrigger.space;
|
|
47035
|
+
var paddingConfig = themeHasLabel ? space.wrapper["default"] : space.wrapper.labeless;
|
|
47036
|
+
return {
|
|
47037
|
+
gap: space.wrapper.itemGap,
|
|
47038
|
+
paddingHorizontal: paddingConfig.paddingHorizontal,
|
|
47039
|
+
paddingVertical: paddingConfig.paddingVertical
|
|
47040
|
+
};
|
|
47041
|
+
};
|
|
47042
|
+
var StyledFilterWrapper = index$b(reactNative.TouchableOpacity)(function (_ref) {
|
|
47043
|
+
var theme = _ref.theme,
|
|
47044
|
+
themeActive = _ref.themeActive,
|
|
47045
|
+
themeVariant = _ref.themeVariant,
|
|
47046
|
+
themeHasLabel = _ref.themeHasLabel;
|
|
47047
|
+
return _objectSpread2(_objectSpread2({
|
|
47048
|
+
position: 'relative',
|
|
47049
|
+
flexDirection: 'row',
|
|
47050
|
+
alignItems: 'center',
|
|
47051
|
+
justifyContent: 'center',
|
|
47052
|
+
alignSelf: 'flex-start',
|
|
47053
|
+
height: theme.__hd__.filterTrigger.sizes.wrapperHeight,
|
|
47054
|
+
backgroundColor: getBackgroundColor(theme, themeActive, themeHasLabel, themeVariant)
|
|
47055
|
+
}, getBorderStyles(theme, themeActive, themeHasLabel, themeVariant)), getSpacingStyles(theme, themeHasLabel));
|
|
47056
|
+
});
|
|
47057
|
+
var StyledBadge = index$b(Badge$1)(function (_ref2) {
|
|
47058
|
+
var theme = _ref2.theme,
|
|
47059
|
+
themeHasLabel = _ref2.themeHasLabel;
|
|
47060
|
+
return _objectSpread2({
|
|
47061
|
+
position: 'absolute'
|
|
47062
|
+
}, themeHasLabel ? {
|
|
47063
|
+
right: 0,
|
|
47064
|
+
bottom: 0
|
|
47065
|
+
} : {
|
|
47066
|
+
right: -theme.__hd__.filterTrigger.space.badge.labelessRight,
|
|
47067
|
+
bottom: -theme.__hd__.filterTrigger.space.badge.labelessBottom
|
|
47068
|
+
});
|
|
47069
|
+
});
|
|
47070
|
+
var StyledText = index$b(Typography.Body)(function (_ref3) {
|
|
47071
|
+
var theme = _ref3.theme;
|
|
47072
|
+
return {
|
|
47073
|
+
lineHeight: theme.__hd__.filterTrigger.lineHeights.text,
|
|
47074
|
+
textAlignVertical: 'center',
|
|
47075
|
+
includeFontPadding: false
|
|
47076
|
+
};
|
|
47077
|
+
});
|
|
47078
|
+
|
|
47079
|
+
var FilterTrigger = function FilterTrigger(_ref) {
|
|
47080
|
+
var label = _ref.label,
|
|
47081
|
+
_ref$active = _ref.active,
|
|
47082
|
+
active = _ref$active === void 0 ? false : _ref$active,
|
|
47083
|
+
_ref$filterCount = _ref.filterCount,
|
|
47084
|
+
filterCount = _ref$filterCount === void 0 ? 0 : _ref$filterCount,
|
|
47085
|
+
_ref$variant = _ref.variant,
|
|
47086
|
+
variant = _ref$variant === void 0 ? 'filled' : _ref$variant,
|
|
47087
|
+
suffix = _ref.suffix,
|
|
47088
|
+
onPress = _ref.onPress,
|
|
47089
|
+
testID = _ref.testID,
|
|
47090
|
+
style = _ref.style;
|
|
47091
|
+
var shouldShowBadge = filterCount > 0 && active;
|
|
47092
|
+
var iconIntent = active ? 'text' : 'inactive';
|
|
47093
|
+
var typographyVariant = active ? 'small-bold' : 'small';
|
|
47094
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledFilterWrapper, {
|
|
47095
|
+
testID: testID,
|
|
47096
|
+
style: style,
|
|
47097
|
+
themeActive: active,
|
|
47098
|
+
themeVariant: variant,
|
|
47099
|
+
onPress: onPress,
|
|
47100
|
+
themeHasLabel: !!label
|
|
47101
|
+
}, label ? /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(StyledText, {
|
|
47102
|
+
variant: typographyVariant
|
|
47103
|
+
}, label), shouldShowBadge && /*#__PURE__*/React__namespace.default.createElement(Badge$1, {
|
|
47104
|
+
content: filterCount,
|
|
47105
|
+
size: "small"
|
|
47106
|
+
}), suffix && /*#__PURE__*/React__namespace.default.createElement(Icon, {
|
|
47107
|
+
icon: suffix,
|
|
47108
|
+
size: "xxxsmall",
|
|
47109
|
+
intent: iconIntent,
|
|
47110
|
+
testID: "".concat(testID, "-suffix")
|
|
47111
|
+
})) : /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, suffix && /*#__PURE__*/React__namespace.default.createElement(Icon, {
|
|
47112
|
+
icon: suffix,
|
|
47113
|
+
size: "xsmall",
|
|
47114
|
+
intent: iconIntent,
|
|
47115
|
+
testID: "".concat(testID, "-suffix")
|
|
47116
|
+
}), shouldShowBadge && /*#__PURE__*/React__namespace.default.createElement(StyledBadge, {
|
|
47117
|
+
content: filterCount,
|
|
47118
|
+
size: "small",
|
|
47119
|
+
themeHasLabel: !!label
|
|
47120
|
+
})));
|
|
47121
|
+
};
|
|
47122
|
+
|
|
46926
47123
|
exports.Accordion = Accordion;
|
|
46927
47124
|
exports.Alert = Alert;
|
|
46928
47125
|
exports.AppCue = AppCue;
|
|
@@ -46947,6 +47144,7 @@ exports.Drawer = index$7;
|
|
|
46947
47144
|
exports.Empty = Empty;
|
|
46948
47145
|
exports.Error = ErrorComponent;
|
|
46949
47146
|
exports.FAB = FAB;
|
|
47147
|
+
exports.FilterTrigger = FilterTrigger;
|
|
46950
47148
|
exports.FlatListWithFAB = FlatListWithFAB;
|
|
46951
47149
|
exports.FloatingIsland = FloatingIsland;
|
|
46952
47150
|
exports.HeroDesignProvider = HeroDesignProvider;
|
package/package.json
CHANGED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import { Theme } from '../../theme';
|
|
4
|
+
import Badge from '../Badge';
|
|
5
|
+
import Typography from '../Typography';
|
|
6
|
+
|
|
7
|
+
type Variant = 'filled' | 'outlined' | 'ghost';
|
|
8
|
+
|
|
9
|
+
const getBackgroundColor = (
|
|
10
|
+
theme: Theme,
|
|
11
|
+
themeIsActive: boolean,
|
|
12
|
+
themeHasLabel: boolean,
|
|
13
|
+
themeVariant: Variant
|
|
14
|
+
): string => {
|
|
15
|
+
const { colors } = theme.__hd__.filterTrigger;
|
|
16
|
+
|
|
17
|
+
if (themeIsActive && !themeHasLabel && themeVariant === 'filled') {
|
|
18
|
+
return colors.wrapper.background.active.filledLabeless;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const state = themeIsActive ? 'active' : 'inactive';
|
|
22
|
+
return colors.wrapper.background[state][themeVariant];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const getBorderStyles = (
|
|
26
|
+
theme: Theme,
|
|
27
|
+
themeIsActive: boolean,
|
|
28
|
+
themeHasLabel: boolean,
|
|
29
|
+
themeVariant: Variant
|
|
30
|
+
) => {
|
|
31
|
+
const { colors, borderWidths, radii } = theme.__hd__.filterTrigger;
|
|
32
|
+
|
|
33
|
+
let borderColor: string;
|
|
34
|
+
if (themeIsActive && !themeHasLabel && themeVariant === 'filled') {
|
|
35
|
+
borderColor = colors.wrapper.border.active.filledLabeless;
|
|
36
|
+
} else {
|
|
37
|
+
const state = themeIsActive ? 'active' : 'inactive';
|
|
38
|
+
borderColor = colors.wrapper.border[state][themeVariant];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
borderWidth: borderWidths.wrapper[themeVariant],
|
|
43
|
+
borderColor,
|
|
44
|
+
borderRadius: themeHasLabel
|
|
45
|
+
? radii.wrapper.default
|
|
46
|
+
: radii.wrapper.labeless,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const getSpacingStyles = (theme: Theme, themeHasLabel: boolean) => {
|
|
51
|
+
const { space } = theme.__hd__.filterTrigger;
|
|
52
|
+
const paddingConfig = themeHasLabel
|
|
53
|
+
? space.wrapper.default
|
|
54
|
+
: space.wrapper.labeless;
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
gap: space.wrapper.itemGap,
|
|
58
|
+
paddingHorizontal: paddingConfig.paddingHorizontal,
|
|
59
|
+
paddingVertical: paddingConfig.paddingVertical,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const StyledFilterWrapper = styled(TouchableOpacity)<{
|
|
64
|
+
themeActive: boolean;
|
|
65
|
+
themeVariant: Variant;
|
|
66
|
+
themeHasLabel: boolean;
|
|
67
|
+
}>(({ theme, themeActive, themeVariant, themeHasLabel }) => ({
|
|
68
|
+
position: 'relative',
|
|
69
|
+
flexDirection: 'row',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
alignSelf: 'flex-start',
|
|
73
|
+
height: theme.__hd__.filterTrigger.sizes.wrapperHeight,
|
|
74
|
+
backgroundColor: getBackgroundColor(
|
|
75
|
+
theme,
|
|
76
|
+
themeActive,
|
|
77
|
+
themeHasLabel,
|
|
78
|
+
themeVariant
|
|
79
|
+
),
|
|
80
|
+
...getBorderStyles(theme, themeActive, themeHasLabel, themeVariant),
|
|
81
|
+
...getSpacingStyles(theme, themeHasLabel),
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
export const StyledBadge = styled(Badge)<{ themeHasLabel: boolean }>(
|
|
85
|
+
({ theme, themeHasLabel }) => ({
|
|
86
|
+
position: 'absolute',
|
|
87
|
+
|
|
88
|
+
...(themeHasLabel
|
|
89
|
+
? {
|
|
90
|
+
right: 0,
|
|
91
|
+
bottom: 0,
|
|
92
|
+
}
|
|
93
|
+
: {
|
|
94
|
+
right: -theme.__hd__.filterTrigger.space.badge.labelessRight,
|
|
95
|
+
bottom: -theme.__hd__.filterTrigger.space.badge.labelessBottom,
|
|
96
|
+
}),
|
|
97
|
+
})
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
export const StyledText = styled(Typography.Body)(({ theme }) => ({
|
|
101
|
+
lineHeight: theme.__hd__.filterTrigger.lineHeights.text,
|
|
102
|
+
textAlignVertical: 'center',
|
|
103
|
+
includeFontPadding: false,
|
|
104
|
+
}));
|