@telus-uds/components-base 1.94.0 → 1.96.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +41 -2
  2. package/lib/Autocomplete/Autocomplete.js +38 -3
  3. package/lib/Card/CardBase.js +4 -0
  4. package/lib/DownloadApp/DownloadApp.js +168 -0
  5. package/lib/DownloadApp/dictionary.js +17 -0
  6. package/lib/DownloadApp/index.js +10 -0
  7. package/lib/Icon/IconText.js +19 -2
  8. package/lib/Link/LinkBase.js +2 -2
  9. package/lib/List/ListItemBase.js +2 -1
  10. package/lib/Modal/Modal.js +34 -13
  11. package/lib/Modal/ModalContent.js +1 -1
  12. package/lib/Modal/WebModal.js +1 -0
  13. package/lib/Notification/Notification.js +5 -5
  14. package/lib/PriceLockup/PriceLockup.js +11 -3
  15. package/lib/Progress/Progress.js +5 -2
  16. package/lib/Progress/ProgressBar.js +4 -1
  17. package/lib/TabBar/TabBar.js +133 -0
  18. package/lib/TabBar/TabBarItem.js +184 -0
  19. package/lib/TabBar/index.js +10 -0
  20. package/lib/TextInput/TextInputBase.js +2 -1
  21. package/lib/Tooltip/getTooltipPosition.js +8 -9
  22. package/lib/Typography/Typography.js +42 -19
  23. package/lib/index.js +23 -0
  24. package/lib-module/Autocomplete/Autocomplete.js +38 -3
  25. package/lib-module/Card/CardBase.js +4 -0
  26. package/lib-module/DownloadApp/DownloadApp.js +160 -0
  27. package/lib-module/DownloadApp/dictionary.js +10 -0
  28. package/lib-module/DownloadApp/index.js +2 -0
  29. package/lib-module/Icon/IconText.js +19 -2
  30. package/lib-module/Link/LinkBase.js +2 -2
  31. package/lib-module/List/ListItemBase.js +2 -1
  32. package/lib-module/Modal/Modal.js +34 -13
  33. package/lib-module/Modal/ModalContent.js +1 -1
  34. package/lib-module/Modal/WebModal.js +1 -0
  35. package/lib-module/Notification/Notification.js +5 -5
  36. package/lib-module/PriceLockup/PriceLockup.js +11 -3
  37. package/lib-module/Progress/Progress.js +6 -3
  38. package/lib-module/Progress/ProgressBar.js +5 -2
  39. package/lib-module/TabBar/TabBar.js +125 -0
  40. package/lib-module/TabBar/TabBarItem.js +177 -0
  41. package/lib-module/TabBar/index.js +2 -0
  42. package/lib-module/TextInput/TextInputBase.js +2 -1
  43. package/lib-module/Tooltip/getTooltipPosition.js +8 -9
  44. package/lib-module/Typography/Typography.js +42 -19
  45. package/lib-module/index.js +3 -1
  46. package/package.json +2 -2
  47. package/src/Autocomplete/Autocomplete.jsx +43 -3
  48. package/src/Card/CardBase.jsx +6 -0
  49. package/src/DownloadApp/DownloadApp.jsx +165 -0
  50. package/src/DownloadApp/dictionary.js +10 -0
  51. package/src/DownloadApp/index.js +3 -0
  52. package/src/Icon/IconText.jsx +21 -4
  53. package/src/Link/LinkBase.jsx +2 -2
  54. package/src/List/ListItemBase.jsx +1 -1
  55. package/src/Modal/Modal.jsx +40 -14
  56. package/src/Modal/ModalContent.jsx +1 -1
  57. package/src/Modal/WebModal.jsx +1 -1
  58. package/src/Notification/Notification.jsx +5 -5
  59. package/src/PriceLockup/PriceLockup.jsx +9 -1
  60. package/src/Progress/Progress.jsx +6 -3
  61. package/src/Progress/ProgressBar.jsx +4 -2
  62. package/src/TabBar/TabBar.jsx +123 -0
  63. package/src/TabBar/TabBarItem.jsx +149 -0
  64. package/src/TabBar/index.js +3 -0
  65. package/src/TextInput/TextInputBase.jsx +1 -1
  66. package/src/Tooltip/getTooltipPosition.js +11 -12
  67. package/src/Typography/Typography.jsx +37 -13
  68. package/src/index.js +4 -1
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
10
+ var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
11
+ var _TabBarItem = _interopRequireDefault(require("./TabBarItem"));
12
+ var _ThemeProvider = require("../ThemeProvider");
13
+ var _utils = require("../utils");
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ const selectTabBarContainerStyles = _ref => {
17
+ let {
18
+ paddingTop,
19
+ paddingBottom,
20
+ borderTopWidth,
21
+ borderTopColor,
22
+ backgroundColor
23
+ } = _ref;
24
+ return {
25
+ paddingTop,
26
+ paddingBottom,
27
+ borderTopWidth,
28
+ borderTopColor,
29
+ backgroundColor
30
+ };
31
+ };
32
+ const selectTabBarItemContainerStyles = _ref2 => {
33
+ let {
34
+ paddingLeft,
35
+ paddingRight,
36
+ gap
37
+ } = _ref2;
38
+ return {
39
+ paddingLeft,
40
+ paddingRight,
41
+ gap
42
+ };
43
+ };
44
+ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
45
+
46
+ /**
47
+ * TabBar component renders a navigation bar with multiple TabBarItems.
48
+ * It allows users to switch between different views or sections.
49
+ *
50
+ * @component
51
+ * @example
52
+ * const items = [
53
+ * { id: '1', label: 'Home', icon: <HomeIcon />, iconActive: <HomeActiveIcon /> },
54
+ * { id: '2', label: 'Profile', icon: <ProfileIcon />, iconActive: <ProfileActiveIcon /> },
55
+ * ]
56
+ * return (
57
+ * <TabBar
58
+ * items={items}
59
+ * initiallySelectedItem="1"
60
+ * onChange={(itemId) => console.log(itemId)}
61
+ * />
62
+ * )
63
+ */
64
+
65
+ const TabBar = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
66
+ let {
67
+ items = [],
68
+ initiallySelectedItem = '0',
69
+ onChange,
70
+ variant,
71
+ tokens,
72
+ ...rest
73
+ } = _ref3;
74
+ const [isSelected, setIsSelected] = _react.default.useState(initiallySelectedItem);
75
+ const themeTokens = (0, _ThemeProvider.useThemeTokens)('TabBar', tokens, variant);
76
+ const handlePress = itemId => {
77
+ setIsSelected(itemId);
78
+ onChange === null || onChange === void 0 ? void 0 : onChange(itemId);
79
+ };
80
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
81
+ ref: ref,
82
+ style: [styles.tabBar, selectTabBarContainerStyles(themeTokens)],
83
+ ...selectProps(rest),
84
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
85
+ style: [styles.tabBarItem, selectTabBarItemContainerStyles(themeTokens)],
86
+ children: items.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TabBarItem.default, {
87
+ label: item.label,
88
+ href: item.href,
89
+ isSelected: isSelected === item.id,
90
+ icon: item.icon,
91
+ iconActive: item.iconActive,
92
+ onPress: () => handlePress(item.id),
93
+ id: `tab-item-${index}`,
94
+ accessibilityRole: "tablist"
95
+ }, item.id))
96
+ })
97
+ });
98
+ });
99
+ TabBar.displayName = 'TabBar';
100
+ TabBar.propTypes = {
101
+ ...selectedSystemPropTypes,
102
+ /** Array of TabBarItems to be displayed in TabBar */
103
+ items: _propTypes.default.arrayOf(_propTypes.default.shape({
104
+ id: _propTypes.default.string.isRequired,
105
+ icon: _propTypes.default.node,
106
+ iconActive: _propTypes.default.node,
107
+ label: _propTypes.default.string.isRequired,
108
+ href: _propTypes.default.string
109
+ })).isRequired,
110
+ /** Id of the initially selected item. */
111
+ initiallySelectedItem: _propTypes.default.number,
112
+ /** Callback function to handle item selection change. */
113
+ onChange: _propTypes.default.func,
114
+ /** Variant of TabBar for styling purposes. */
115
+ variant: _utils.variantProp.propType,
116
+ /** Tokens for theming and styling. */
117
+ tokens: (0, _utils.getTokensPropType)('TabBar')
118
+ };
119
+ const styles = _StyleSheet.default.create({
120
+ tabBar: {
121
+ flex: 1,
122
+ justifyContent: 'center',
123
+ alignItems: 'center'
124
+ },
125
+ tabBarItem: {
126
+ flex: 1,
127
+ flexDirection: 'row',
128
+ justifyContent: 'space-between',
129
+ width: '100%'
130
+ }
131
+ });
132
+ var _default = TabBar;
133
+ exports.default = _default;
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
10
+ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
11
+ var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
12
+ var _utils = require("../utils");
13
+ var _ThemeProvider = require("../ThemeProvider");
14
+ var _Typography = _interopRequireDefault(require("../Typography"));
15
+ var _Spacer = _interopRequireDefault(require("../Spacer"));
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+ const selectTypographyStyles = (_ref, isSelected) => {
19
+ let {
20
+ fontWeight,
21
+ color,
22
+ lineHeight,
23
+ fontName,
24
+ activeColor
25
+ } = _ref;
26
+ return {
27
+ fontWeight,
28
+ color: isSelected ? activeColor : color,
29
+ lineHeight,
30
+ fontName
31
+ };
32
+ };
33
+ const selectIconContainerStyles = _ref2 => {
34
+ let {
35
+ paddingTop,
36
+ paddingBottom
37
+ } = _ref2;
38
+ return {
39
+ paddingTop,
40
+ paddingBottom,
41
+ alignItems: 'center'
42
+ };
43
+ };
44
+ const selectIconStyles = (_ref3, isSelected) => {
45
+ let {
46
+ iconSize,
47
+ iconColor,
48
+ activeColor
49
+ } = _ref3;
50
+ return {
51
+ size: iconSize,
52
+ color: isSelected ? activeColor : iconColor
53
+ };
54
+ };
55
+ const selectContainerStyles = _ref4 => {
56
+ let {
57
+ borderRadius,
58
+ backgroundColor
59
+ } = _ref4;
60
+ return {
61
+ borderRadius,
62
+ backgroundColor,
63
+ alignSelf: 'center',
64
+ alignItems: 'center'
65
+ };
66
+ };
67
+ const TabBarItem = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
68
+ let {
69
+ href,
70
+ variant,
71
+ tokens,
72
+ label,
73
+ isSelected,
74
+ id,
75
+ onPress,
76
+ icon: IconComponent,
77
+ iconActive: IconActiveComponent,
78
+ accessibilityRole = 'tab'
79
+ } = _ref5;
80
+ const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('TabBarItem', tokens, variant);
81
+ const getPressableStyle = _ref6 => {
82
+ let {
83
+ pressed,
84
+ focused,
85
+ hovered
86
+ } = _ref6;
87
+ const resolvedTokens = (0, _utils.resolvePressableTokens)(getTokens, {
88
+ pressed,
89
+ focused,
90
+ hovered
91
+ }, {
92
+ isSelected
93
+ });
94
+ return {
95
+ ...resolvedTokens,
96
+ outline: 'none' // removes the default browser :focus outline
97
+ };
98
+ };
99
+
100
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
101
+ ref: ref,
102
+ href: href,
103
+ nativeID: id,
104
+ onPress: onPress,
105
+ style: _ref7 => {
106
+ let {
107
+ pressed,
108
+ focused,
109
+ hovered
110
+ } = _ref7;
111
+ return [styles.flexContainer, getPressableStyle({
112
+ pressed,
113
+ focused,
114
+ hovered
115
+ })];
116
+ },
117
+ accessibilityRole: accessibilityRole,
118
+ testID: id,
119
+ children: pressableState => {
120
+ const resolvedTokens = getPressableStyle(pressableState);
121
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
122
+ style: selectContainerStyles(resolvedTokens),
123
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
124
+ style: [selectIconContainerStyles(resolvedTokens), styles.iconContainer],
125
+ children: isSelected ? IconActiveComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(IconActiveComponent, {
126
+ ...selectIconStyles(resolvedTokens, isSelected)
127
+ }) : IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
128
+ ...selectIconStyles(resolvedTokens)
129
+ })
130
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
131
+ space: 1
132
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
133
+ variant: {
134
+ size: 'micro'
135
+ },
136
+ tokens: selectTypographyStyles(resolvedTokens, isSelected),
137
+ align: "center",
138
+ children: label
139
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
140
+ space: 1
141
+ })]
142
+ });
143
+ }
144
+ });
145
+ });
146
+ TabBarItem.displayName = 'TabBarItem';
147
+ TabBarItem.propTypes = {
148
+ /** The icon to be displayed when the item is not selected. */
149
+ icon: _propTypes.default.elementType,
150
+ /** The icon to be displayed when the item is selected. */
151
+ iconActive: _propTypes.default.elementType,
152
+ /** Tokens for theming and styling the TabBarItem. */
153
+ tokens: (0, _utils.getTokensPropType)('TabBarItem'),
154
+ /** Variant of the TabBarItem for styling purposes. */
155
+ variant: _utils.variantProp.propType,
156
+ /** Callback function to handle press events. */
157
+ onPress: _propTypes.default.func,
158
+ /** URL to navigate to when the item is pressed. */
159
+ href: _propTypes.default.string,
160
+ /** Indicates whether the item is selected. */
161
+ isSelected: _propTypes.default.bool,
162
+ /** Unique identifier for the item. */
163
+ id: _propTypes.default.string,
164
+ /** Label text for the item. */
165
+ label: _propTypes.default.string.isRequired,
166
+ /** Accessibility role for the item. */
167
+ accessibilityRole: _propTypes.default.string
168
+ };
169
+ const styles = _StyleSheet.default.create({
170
+ flexContainer: {
171
+ flex: 1,
172
+ alignItems: 'center'
173
+ },
174
+ iconContainer: {
175
+ flex: 1,
176
+ justifyContent: 'center',
177
+ alignItems: 'center',
178
+ minWidth: 44,
179
+ minHeight: 40,
180
+ aspectRatio: 1.1
181
+ }
182
+ });
183
+ var _default = TabBarItem;
184
+ exports.default = _default;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _TabBar = _interopRequireDefault(require("./TabBar"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ var _default = _TabBar.default;
10
+ exports.default = _default;
@@ -48,7 +48,8 @@ const selectInputStyles = function (_ref, themeOptions, inactive, type) {
48
48
  // jump around if the border width changes (avoiding NaN and negative padding)
49
49
  const offsetBorder = value => typeof value === 'number' ? Math.max(0, value - borderWidth) : value;
50
50
  const textStyles = (0, _ThemeProvider.applyTextStyles)({
51
- fontName,
51
+ fontName: isPassword ? undefined : fontName,
52
+ // In this case, we don't want to apply the fontName to the input if it's a password because Monotype don't have support for the masked characters in mobile.
52
53
  fontSize,
53
54
  lineHeight,
54
55
  fontWeight,
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- function normalizePosition(position) {
7
+ function getAbsolutePosition(position) {
8
8
  const {
9
9
  left,
10
10
  right,
@@ -15,7 +15,7 @@ function normalizePosition(position) {
15
15
  } = position;
16
16
 
17
17
  // adjust the coordinates so that it fits within the window
18
- const normalized = {
18
+ const finalPosition = {
19
19
  left: Math.max(0, left),
20
20
  right: Math.max(0, right),
21
21
  top: Math.max(0, top),
@@ -25,15 +25,14 @@ function normalizePosition(position) {
25
25
  const getAbsoluteDiff = (value1, value2) => Math.abs(Math.abs(value1) - Math.abs(value2));
26
26
 
27
27
  // adjust the width by whatever has been subtracted from left or right
28
- normalized.width = width - Math.abs(getAbsoluteDiff(left, normalized.left) - getAbsoluteDiff(right, normalized.right));
29
- if (normalized.top !== top) {
30
- normalized.bottom += normalized.top - top;
28
+ finalPosition.width = width - Math.abs(getAbsoluteDiff(left, finalPosition.left) - getAbsoluteDiff(right, finalPosition.right));
29
+ if (finalPosition.top !== top) {
30
+ finalPosition.bottom += finalPosition.top - top;
31
31
  }
32
- const isNormalized = normalized.right !== right || normalized.left !== left || normalized.top !== top;
33
32
  return {
34
- ...normalized,
33
+ ...finalPosition,
35
34
  ...rest,
36
- isNormalized
35
+ isNormalized: false
37
36
  };
38
37
  }
39
38
  function invertPosition(position) {
@@ -172,7 +171,7 @@ function getTooltipPosition(position, _ref2) {
172
171
 
173
172
  // prefer 'below' over 'above', since we can always expand the document downwards,
174
173
  // and 'above' might cause issues on small viewports with large tooltips
175
- return normalizePosition(leastOverflowing.position === 'above' ? findRectByPosition('below', boundingRects) : leastOverflowing);
174
+ return getAbsolutePosition(leastOverflowing.position === 'above' ? findRectByPosition('below', boundingRects) : leastOverflowing);
176
175
  }
177
176
  var _default = getTooltipPosition;
178
177
  exports.default = _default;
@@ -8,6 +8,7 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
10
10
  var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
11
+ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
11
12
  var _ThemeProvider = require("../ThemeProvider");
12
13
  var _utils = require("../ThemeProvider/utils");
13
14
  var _utils2 = require("../utils");
@@ -45,9 +46,22 @@ const selectTextStyles = (_ref, themeOptions) => {
45
46
  gradient
46
47
  });
47
48
  };
49
+ const HALF_FONT_SIZE = 2;
50
+ const QUARTER_FONT_SIZE = 4;
51
+ const selectMobileSubSupStyles = (_ref2, type) => {
52
+ let {
53
+ fontSize
54
+ } = _ref2;
55
+ return {
56
+ fontSize: fontSize / HALF_FONT_SIZE,
57
+ lineHeight: fontSize,
58
+ position: 'relative',
59
+ top: type === 'sub' ? fontSize / QUARTER_FONT_SIZE : -fontSize / QUARTER_FONT_SIZE
60
+ };
61
+ };
48
62
 
49
63
  // General-purpose flexible theme-neutral base component for text
50
- const Typography = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
64
+ const Typography = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
51
65
  let {
52
66
  children,
53
67
  variant,
@@ -60,7 +74,7 @@ const Typography = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
60
74
  dataSet,
61
75
  strikeThrough = false,
62
76
  ...rest
63
- } = _ref2;
77
+ } = _ref3;
64
78
  const viewport = (0, _ViewportProvider.useViewport)();
65
79
  const {
66
80
  themeOptions
@@ -107,8 +121,8 @@ const Typography = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
107
121
  let textStyles;
108
122
  let mediaIds;
109
123
  if (enableMediaQueryStyleSheet) {
110
- const transformedThemeTokens = Object.entries(themeTokens).reduce((acc, _ref3) => {
111
- let [vp, viewportTokens] = _ref3;
124
+ const transformedThemeTokens = Object.entries(themeTokens).reduce((acc, _ref4) => {
125
+ let [vp, viewportTokens] = _ref4;
112
126
  acc[vp] = selectTextStyles({
113
127
  textAlign: align,
114
128
  textDecorationLine,
@@ -142,22 +156,31 @@ const Typography = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
142
156
  ...selectContainerProps(rest)
143
157
  };
144
158
  const resetTagStyling = child => {
145
- if (typeof child === 'object' && ((child === null || child === void 0 ? void 0 : child.type) === 'sub' || (child === null || child === void 0 ? void 0 : child.type) === 'sup')) {
146
- var _child$props;
147
- const childStyles = (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.style) || {};
148
- const supFontSize = childStyles.fontSize ?? themeTokens.superScriptFontSize;
149
- const sanitizedChild = /*#__PURE__*/_react.default.cloneElement(child, {
150
- style: {
151
- ...childStyles,
152
- ...(supFontSize ? {
153
- fontSize: supFontSize
154
- } : {}),
155
- lineHeight: 0
156
- }
157
- });
158
- return sanitizedChild;
159
+ var _child$props;
160
+ if (typeof child !== 'object' || !((child === null || child === void 0 ? void 0 : child.type) === 'sub' || (child === null || child === void 0 ? void 0 : child.type) === 'sup')) {
161
+ return child;
159
162
  }
160
- return child;
163
+ const childStyles = (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.style) || {};
164
+ const supFontSize = childStyles.fontSize ?? themeTokens.superScriptFontSize;
165
+ const isMobile = _Platform.default.OS === 'ios' || _Platform.default.OS === 'android';
166
+ const isSubSup = (child === null || child === void 0 ? void 0 : child.type) === 'sub' || (child === null || child === void 0 ? void 0 : child.type) === 'sup';
167
+ const mobileStyles = isMobile && isSubSup ? selectMobileSubSupStyles(themeTokens, child === null || child === void 0 ? void 0 : child.type) : {};
168
+ const defaultStyles = !isMobile && isSubSup ? {
169
+ fontSize: supFontSize,
170
+ lineHeight: 0
171
+ } : {};
172
+ const sanitizedChild = /*#__PURE__*/_react.default.cloneElement(isMobile && isSubSup ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
173
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
174
+ style: [childStyles, mobileStyles],
175
+ children: child.props.children
176
+ })
177
+ }) : child, {
178
+ style: {
179
+ ...childStyles,
180
+ ...defaultStyles
181
+ }
182
+ });
183
+ return sanitizedChild;
161
184
  };
162
185
  const sanitizeChildren = () => {
163
186
  if (Array.isArray(children)) {
package/lib/index.js CHANGED
@@ -19,6 +19,7 @@ var _exportNames = {
19
19
  CheckboxCard: true,
20
20
  CheckboxCardGroup: true,
21
21
  ColourToggle: true,
22
+ DownloadApp: true,
22
23
  Divider: true,
23
24
  ExpandCollapse: true,
24
25
  Accordion: true,
@@ -58,6 +59,7 @@ var _exportNames = {
58
59
  Status: true,
59
60
  StepTracker: true,
60
61
  Tabs: true,
62
+ TabBar: true,
61
63
  Tags: true,
62
64
  Timeline: true,
63
65
  Tooltip: true,
@@ -80,6 +82,7 @@ var _exportNames = {
80
82
  applyOuterBorder: true,
81
83
  applyTextStyles: true,
82
84
  applyShadowToken: true,
85
+ useResponsiveThemeTokens: true,
83
86
  Portal: true
84
87
  };
85
88
  Object.defineProperty(exports, "A11yInfoProvider", {
@@ -178,6 +181,12 @@ Object.defineProperty(exports, "Divider", {
178
181
  return _Divider.default;
179
182
  }
180
183
  });
184
+ Object.defineProperty(exports, "DownloadApp", {
185
+ enumerable: true,
186
+ get: function () {
187
+ return _DownloadApp.default;
188
+ }
189
+ });
181
190
  Object.defineProperty(exports, "ExpandCollapse", {
182
191
  enumerable: true,
183
192
  get: function () {
@@ -418,6 +427,12 @@ Object.defineProperty(exports, "StepTracker", {
418
427
  return _StepTracker.default;
419
428
  }
420
429
  });
430
+ Object.defineProperty(exports, "TabBar", {
431
+ enumerable: true,
432
+ get: function () {
433
+ return _TabBar.default;
434
+ }
435
+ });
421
436
  Object.defineProperty(exports, "Tabs", {
422
437
  enumerable: true,
423
438
  get: function () {
@@ -514,6 +529,12 @@ Object.defineProperty(exports, "useHydrationContext", {
514
529
  return _HydrationContext.useHydrationContext;
515
530
  }
516
531
  });
532
+ Object.defineProperty(exports, "useResponsiveThemeTokens", {
533
+ enumerable: true,
534
+ get: function () {
535
+ return _ThemeProvider.useResponsiveThemeTokens;
536
+ }
537
+ });
517
538
  Object.defineProperty(exports, "useSetTheme", {
518
539
  enumerable: true,
519
540
  get: function () {
@@ -593,6 +614,7 @@ Object.keys(_Checkbox).forEach(function (key) {
593
614
  var _CheckboxCard = _interopRequireDefault(require("./CheckboxCard"));
594
615
  var _CheckboxCardGroup = _interopRequireDefault(require("./CheckboxCardGroup"));
595
616
  var _ColourToggle = _interopRequireDefault(require("./ColourToggle"));
617
+ var _DownloadApp = _interopRequireDefault(require("./DownloadApp"));
596
618
  var _Divider = _interopRequireDefault(require("./Divider"));
597
619
  var _ExpandCollapse = _interopRequireWildcard(require("./ExpandCollapse"));
598
620
  var _Feedback = _interopRequireDefault(require("./Feedback"));
@@ -696,6 +718,7 @@ Object.keys(_StackView).forEach(function (key) {
696
718
  var _Status = _interopRequireDefault(require("./Status"));
697
719
  var _StepTracker = _interopRequireDefault(require("./StepTracker"));
698
720
  var _Tabs = _interopRequireDefault(require("./Tabs"));
721
+ var _TabBar = _interopRequireDefault(require("./TabBar"));
699
722
  var _Tags = _interopRequireDefault(require("./Tags"));
700
723
  var _TextInput = require("./TextInput");
701
724
  Object.keys(_TextInput).forEach(function (key) {
@@ -106,6 +106,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
106
106
  validation,
107
107
  value,
108
108
  helpText = '',
109
+ loadingLabel,
109
110
  ...rest
110
111
  } = _ref2;
111
112
  const {
@@ -138,6 +139,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
138
139
 
139
140
  // When it's nested, selected value
140
141
  const [nestedSelectedValue, setNestedSelectedValue] = React.useState(null);
142
+ const [isInputVisible, setIsInputVisible] = React.useState(true);
141
143
  const {
142
144
  supportsProps,
143
145
  ...selectedProps
@@ -263,6 +265,27 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
263
265
  }));
264
266
  }
265
267
  }, [nestedSelectedValue, items]);
268
+ React.useEffect(() => {
269
+ if (Platform.OS === 'ios' || Platform.OS === 'android') {
270
+ return undefined;
271
+ }
272
+ const observer = new IntersectionObserver(entries => {
273
+ const [entry] = entries;
274
+ setIsInputVisible(entry.isIntersecting);
275
+ if (!entry.isIntersecting) {
276
+ setIsExpanded(false);
277
+ }
278
+ });
279
+ const currentInputRef = inputRef.current;
280
+ if (currentInputRef) {
281
+ observer.observe(currentInputRef);
282
+ }
283
+ return () => {
284
+ if (currentInputRef) {
285
+ observer.unobserve(currentInputRef);
286
+ }
287
+ };
288
+ }, [inputRef]);
266
289
  const handleClose = event => {
267
290
  var _openOverlayRef$curre, _openOverlayRef$curre2;
268
291
  if (event.type === 'keydown' && (event.key === 'Escape' || event.key === '27') || event.type === 'click' && !(openOverlayRef !== null && openOverlayRef !== void 0 && (_openOverlayRef$curre = openOverlayRef.current) !== null && _openOverlayRef$curre !== void 0 && _openOverlayRef$curre.contains(event.target)) || event.type === 'touchstart' && openOverlayRef !== null && openOverlayRef !== void 0 && openOverlayRef.current && event.touches[0].target && !(openOverlayRef !== null && openOverlayRef !== void 0 && (_openOverlayRef$curre2 = openOverlayRef.current) !== null && _openOverlayRef$curre2 !== void 0 && _openOverlayRef$curre2.contains(event.touches[0].target))) {
@@ -319,7 +342,19 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
319
342
  readOnly: readOnly,
320
343
  ref: inputRef,
321
344
  ...(Platform.OS !== 'web' ? {
322
- onLayout: event => setSourceLayout(event.nativeEvent.layout)
345
+ onLayout: event => {
346
+ setSourceLayout(event.nativeEvent.layout);
347
+ const {
348
+ y,
349
+ height
350
+ } = event.nativeEvent.layout;
351
+ if (y >= 0 && height > 0) {
352
+ setIsInputVisible(true);
353
+ } else {
354
+ setIsInputVisible(false);
355
+ setIsExpanded(false);
356
+ }
357
+ }
323
358
  } : {}),
324
359
  tokens: inputTokens,
325
360
  validation: validation,
@@ -332,7 +367,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
332
367
  })
333
368
  });
334
369
  }
335
- }), (isExpanded || hintExpansionEnabled) && /*#__PURE__*/_jsxs(_Fragment, {
370
+ }), (isExpanded || hintExpansionEnabled) && isInputVisible && /*#__PURE__*/_jsxs(_Fragment, {
336
371
  children: [/*#__PURE__*/_jsx(Listbox.Overlay, {
337
372
  overlaidPosition: overlaidPosition,
338
373
  isReady: isReady,
@@ -341,7 +376,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
341
376
  onLayout: handleMeasure,
342
377
  ref: openOverlayRef,
343
378
  children: isLoading ? /*#__PURE__*/_jsx(Loading, {
344
- label: getCopy('loading')
379
+ label: loadingLabel ?? getCopy('loading')
345
380
  }) : /*#__PURE__*/_jsx(Suggestions, {
346
381
  hasResults: getCopy('hasResults'),
347
382
  id: "autocomplete",
@@ -24,6 +24,7 @@ const selectStyles = _ref => {
24
24
  paddingTop,
25
25
  minWidth,
26
26
  shadow,
27
+ backgroundGradient,
27
28
  gradient
28
29
  } = _ref;
29
30
  return {
@@ -43,6 +44,9 @@ const selectStyles = _ref => {
43
44
  backgroundOrigin: `border-box`,
44
45
  boxShadow: `inset 0 1000px white`,
45
46
  border: `${borderWidth}px solid transparent`
47
+ } : {}),
48
+ ...(backgroundGradient && Platform.OS === 'web' ? {
49
+ backgroundImage: `linear-gradient(${backgroundGradient.angle}deg, ${backgroundGradient.stops[0].color}, ${backgroundGradient.stops[1].color})`
46
50
  } : {})
47
51
  };
48
52
  };