@telus-uds/components-base 1.61.0 → 1.62.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/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @telus-uds/components-base
2
2
 
3
- This log was last generated on Tue, 12 Sep 2023 23:35:19 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 15 Sep 2023 20:56:52 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.62.0
8
+
9
+ Fri, 15 Sep 2023 20:56:52 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - TextInputBase component changed to match with design intention for the IconButton (35577399+JoshHC@users.noreply.github.com)
14
+ - `Tooltip`: Add `onPress` callback function to be triggered when tooltip button is clicked (shahzaibkhalidmalik@outlook.com)
15
+
7
16
  ## 1.61.0
8
17
 
9
- Tue, 12 Sep 2023 23:35:19 GMT
18
+ Tue, 12 Sep 2023 23:39:14 GMT
10
19
 
11
20
  ### Minor changes
12
21
 
@@ -799,7 +799,9 @@
799
799
  "iconSize": "size",
800
800
  "iconScale": "iconScale",
801
801
  "iconTranslateX": "size",
802
- "iconTranslateY": "size"
802
+ "iconTranslateY": "size",
803
+ "height": "size",
804
+ "width": "size"
803
805
  },
804
806
  "Link": {
805
807
  "color": "color",
@@ -6527,7 +6529,9 @@
6527
6529
  "iconSize": "size",
6528
6530
  "iconScale": "iconScale",
6529
6531
  "iconTranslateX": "size",
6530
- "iconTranslateY": "size"
6532
+ "iconTranslateY": "size",
6533
+ "height": "size",
6534
+ "width": "size"
6531
6535
  }
6532
6536
  },
6533
6537
  "required": false,
@@ -9718,28 +9722,6 @@
9718
9722
  "docs": {
9719
9723
  "description": "`SideNav.Item` is a navigational element that is used within `SideNav` or `SideNav.ItemsGroup`.\n\n This component can only be accessed as a name-spaced component: `SideNav.Item`.",
9720
9724
  "props": {
9721
- "isActive": {
9722
- "defaultValue": {
9723
- "value": "false",
9724
- "computed": false
9725
- },
9726
- "type": {
9727
- "name": "bool"
9728
- },
9729
- "required": false,
9730
- "description": "Set internally in `SideNav` render function."
9731
- },
9732
- "isExpanded": {
9733
- "defaultValue": {
9734
- "value": "false",
9735
- "computed": false
9736
- },
9737
- "type": {
9738
- "name": "bool"
9739
- },
9740
- "required": false,
9741
- "description": "Set internally in `SideNav.ItemsGroup` render function. Used to mark expanded `ItemsGroup` parent."
9742
- },
9743
9725
  "accessibilityRole": {
9744
9726
  "defaultValue": {
9745
9727
  "value": "'link'",
@@ -9749,7 +9731,7 @@
9749
9731
  "name": "string"
9750
9732
  },
9751
9733
  "required": false,
9752
- "description": "Accesibility Role"
9734
+ "description": ""
9753
9735
  },
9754
9736
  "children": {
9755
9737
  "type": {
@@ -9758,20 +9740,6 @@
9758
9740
  "required": true,
9759
9741
  "description": "Text content of the `Item`."
9760
9742
  },
9761
- "itemId": {
9762
- "type": {
9763
- "name": "string"
9764
- },
9765
- "required": false,
9766
- "description": "Set internally in `SideNav` render function - used to keep track of active item."
9767
- },
9768
- "groupId": {
9769
- "type": {
9770
- "name": "string"
9771
- },
9772
- "required": false,
9773
- "description": "Set internally in `SideNav` render function - used to keep track of expanded items groups."
9774
- },
9775
9743
  "onPress": {
9776
9744
  "type": {
9777
9745
  "name": "func"
@@ -9825,6 +9793,13 @@
9825
9793
  "required": false,
9826
9794
  "description": "On Web if href is passed, React Native Web maps this object's props to\n`rel`, `target` and `download` attrs."
9827
9795
  },
9796
+ "testID": {
9797
+ "type": {
9798
+ "name": "number"
9799
+ },
9800
+ "required": false,
9801
+ "description": ""
9802
+ },
9828
9803
  "tokens": {
9829
9804
  "type": {
9830
9805
  "name": "custom",
@@ -9872,13 +9847,6 @@
9872
9847
  },
9873
9848
  "required": false,
9874
9849
  "description": ""
9875
- },
9876
- "testID": {
9877
- "type": {
9878
- "name": "number"
9879
- },
9880
- "required": false,
9881
- "description": "test ID"
9882
9850
  }
9883
9851
  },
9884
9852
  "attributes": {
@@ -11291,6 +11259,17 @@
11291
11259
  "required": false,
11292
11260
  "description": "Select English or French copy for the accessible label."
11293
11261
  },
11262
+ "onPress": {
11263
+ "defaultValue": {
11264
+ "value": "() => {}",
11265
+ "computed": false
11266
+ },
11267
+ "type": {
11268
+ "name": "func"
11269
+ },
11270
+ "required": false,
11271
+ "description": "Callback function triggered when the tooltip is pressed."
11272
+ },
11294
11273
  "inline": {
11295
11274
  "defaultValue": {
11296
11275
  "value": "false",
@@ -31,9 +31,17 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
31
31
 
32
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
33
 
34
+ // function to get the dimentionals of the conditionals
35
+ const getPasswordDimensions = (password, width, height) => {
36
+ return password ? {
37
+ width,
38
+ height
39
+ } : {};
40
+ };
41
+
34
42
  const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
35
43
 
36
- const selectOuterStyle = _ref => {
44
+ const selectOuterStyle = (_ref, password) => {
37
45
  let {
38
46
  backgroundColor,
39
47
  outerBorderWidth,
@@ -44,7 +52,9 @@ const selectOuterStyle = _ref => {
44
52
  borderTopRightRadius,
45
53
  borderBottomLeftRadius,
46
54
  borderBottomRightRadius,
47
- shadow
55
+ shadow,
56
+ width,
57
+ height
48
58
  } = _ref;
49
59
  return [{
50
60
  backgroundColor,
@@ -59,10 +69,13 @@ const selectOuterStyle = _ref => {
59
69
  outerBorderColor,
60
70
  outerBorderGap
61
71
  }),
72
+ ...getPasswordDimensions(password, width, height),
62
73
  ..._Platform.default.select({
63
74
  web: {
64
75
  outline: 'none',
65
- display: 'inline-flex'
76
+ display: 'inline-flex',
77
+ alignItems: 'center',
78
+ justifyContent: 'center'
66
79
  }
67
80
  })
68
81
  }, staticStyles.outer];
@@ -71,7 +84,7 @@ const selectOuterStyle = _ref => {
71
84
  const calculatePadding = (padding, borderWidth) => padding && Math.max(0, padding - borderWidth); // Stable size as border changes
72
85
 
73
86
 
74
- const selectInnerStyle = _ref2 => {
87
+ const selectInnerStyle = (_ref2, password) => {
75
88
  let {
76
89
  borderColor,
77
90
  borderWidth,
@@ -88,7 +101,9 @@ const selectInnerStyle = _ref2 => {
88
101
  paddingLeft,
89
102
  paddingRight,
90
103
  paddingTop,
91
- paddingBottom
104
+ paddingBottom,
105
+ width,
106
+ height
92
107
  } = _ref2;
93
108
  return {
94
109
  // Inner borders animate with the icon and should be treated like a themable feature of the icon
@@ -110,9 +125,13 @@ const selectInnerStyle = _ref2 => {
110
125
  paddingBottom: calculatePadding(paddingBottom, borderBottomWidth),
111
126
  ..._Platform.default.select({
112
127
  web: {
113
- pointerEvents: 'none'
128
+ pointerEvents: 'none',
129
+ display: 'inline-flex',
130
+ alignItems: 'center',
131
+ justifyContent: 'center'
114
132
  }
115
- })
133
+ }),
134
+ ...getPasswordDimensions(password, width, height)
116
135
  };
117
136
  };
118
137
  /**
@@ -158,7 +177,7 @@ const IconButton = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
158
177
 
159
178
  const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('IconButton', tokens, variant);
160
179
 
161
- const getOuterStyle = pressableState => selectOuterStyle(getTokens((0, _utils.resolvePressableState)(pressableState)));
180
+ const getOuterStyle = pressableState => selectOuterStyle(getTokens((0, _utils.resolvePressableState)(pressableState), variant.password));
162
181
 
163
182
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
164
183
  ref: ref,
@@ -171,7 +190,7 @@ const IconButton = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
171
190
  children: pressableState => {
172
191
  const themeTokens = getTokens((0, _utils.resolvePressableState)(pressableState));
173
192
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
174
- style: selectInnerStyle(themeTokens),
193
+ style: selectInnerStyle(themeTokens, variant.password),
175
194
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
176
195
  icon: IconComponent || themeTokens.icon,
177
196
  title: selectedProps.accessibilityLabel,
@@ -138,13 +138,13 @@ Item.propTypes = { ...selectedSystemPropTypes,
138
138
  children: _propTypes.default.node.isRequired,
139
139
 
140
140
  /**
141
- *
141
+ * @ignore
142
142
  * Set internally in `SideNav` render function - used to keep track of active item.
143
143
  */
144
144
  itemId: _propTypes.default.string,
145
145
 
146
146
  /**
147
- *
147
+ * @ignore
148
148
  * Set internally in `SideNav` render function - used to keep track of expanded items groups.
149
149
  */
150
150
  groupId: _propTypes.default.string,
@@ -158,28 +158,20 @@ Item.propTypes = { ...selectedSystemPropTypes,
158
158
  hrefAttrs: _propTypes.default.shape(_utils.hrefAttrsProp.types),
159
159
 
160
160
  /**
161
- *
161
+ * @ignore
162
162
  * Set internally in `SideNav` render function.
163
163
  */
164
164
  isActive: _propTypes.default.bool,
165
165
 
166
166
  /**
167
- *
167
+ * @ignore
168
168
  * Set internally in `SideNav.ItemsGroup` render function. Used to mark expanded `ItemsGroup` parent.
169
169
  */
170
170
  isExpanded: _propTypes.default.bool,
171
- tokens: (0, _utils.getTokensPropType)('SideNavItem'),
172
- variant: _utils.variantProp.propType,
173
-
174
- /**
175
- * Accesibility Role
176
- */
177
171
  accessibilityRole: _propTypes.default.string,
178
-
179
- /**
180
- * test ID
181
- */
182
- testID: _propTypes.default.number
172
+ testID: _propTypes.default.number,
173
+ tokens: (0, _utils.getTokensPropType)('SideNavItem'),
174
+ variant: _utils.variantProp.propType
183
175
  };
184
176
  var _default = Item;
185
177
  exports.default = _default;
@@ -295,7 +295,12 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
295
295
  variant: {
296
296
  compact: true,
297
297
  password: true,
298
- inactive: !!variant.inactive
298
+ inactive: variant.inactive,
299
+ size: 'large'
300
+ },
301
+ tokens: {
302
+ width: 40,
303
+ height: 40
299
304
  }
300
305
  }, !showPassword ? 'hide' : 'show'));
301
306
  }
@@ -149,6 +149,7 @@ const Tooltip = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
149
149
  content,
150
150
  position = 'auto',
151
151
  copy = 'en',
152
+ onPress = () => {},
152
153
  tokens,
153
154
  variant,
154
155
  inline = false,
@@ -189,7 +190,10 @@ const Tooltip = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
189
190
  });
190
191
  const themeTokens = (0, _ThemeProvider.useThemeTokens)('Tooltip', tokens, variant);
191
192
 
192
- const toggleIsOpen = () => setIsOpen(!isOpen);
193
+ const toggleIsOpen = () => {
194
+ onPress();
195
+ setIsOpen(!isOpen);
196
+ };
193
197
 
194
198
  const close = () => setIsOpen(false);
195
199
 
@@ -178,6 +178,7 @@ const Tooltip = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
178
178
  content,
179
179
  position = 'auto',
180
180
  copy = 'en',
181
+ onPress = () => {},
181
182
  tokens,
182
183
  variant,
183
184
  inline = false,
@@ -209,7 +210,10 @@ const Tooltip = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
209
210
  return () => subscription === null || subscription === void 0 ? void 0 : subscription.remove();
210
211
  });
211
212
 
212
- const toggleIsOpen = () => setIsOpen(!isOpen);
213
+ const toggleIsOpen = () => {
214
+ onPress();
215
+ setIsOpen(!isOpen);
216
+ };
213
217
 
214
218
  const close = () => setIsOpen(false);
215
219
 
@@ -37,6 +37,11 @@ const propTypes = {
37
37
  * Display tooltip icon button as an inline element.
38
38
  */
39
39
  inline: _propTypes.default.bool,
40
+
41
+ /**
42
+ * Callback function triggered when the tooltip is pressed.
43
+ */
44
+ onPress: _propTypes.default.func,
40
45
  tokens: (0, _utils.getTokensPropType)('Tooltip'),
41
46
  variant: _utils.variantProp.propType
42
47
  };
@@ -6,11 +6,20 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
6
6
  import View from "react-native-web/dist/exports/View";
7
7
  import { applyOuterBorder, useThemeTokensCallback, applyShadowToken } from '../ThemeProvider';
8
8
  import { a11yProps, clickProps, getTokensPropType, hrefAttrsProp, linkProps, resolvePressableState, selectSystemProps, selectTokens, variantProp, viewProps, withLinkRouter } from '../utils';
9
- import Icon from '../Icon';
9
+ import Icon from '../Icon'; // function to get the dimentionals of the conditionals
10
+
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
+
13
+ const getPasswordDimensions = (password, width, height) => {
14
+ return password ? {
15
+ width,
16
+ height
17
+ } : {};
18
+ };
19
+
11
20
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
12
21
 
13
- const selectOuterStyle = _ref => {
22
+ const selectOuterStyle = (_ref, password) => {
14
23
  let {
15
24
  backgroundColor,
16
25
  outerBorderWidth,
@@ -21,7 +30,9 @@ const selectOuterStyle = _ref => {
21
30
  borderTopRightRadius,
22
31
  borderBottomLeftRadius,
23
32
  borderBottomRightRadius,
24
- shadow
33
+ shadow,
34
+ width,
35
+ height
25
36
  } = _ref;
26
37
  return [{
27
38
  backgroundColor,
@@ -36,10 +47,13 @@ const selectOuterStyle = _ref => {
36
47
  outerBorderColor,
37
48
  outerBorderGap
38
49
  }),
50
+ ...getPasswordDimensions(password, width, height),
39
51
  ...Platform.select({
40
52
  web: {
41
53
  outline: 'none',
42
- display: 'inline-flex'
54
+ display: 'inline-flex',
55
+ alignItems: 'center',
56
+ justifyContent: 'center'
43
57
  }
44
58
  })
45
59
  }, staticStyles.outer];
@@ -48,7 +62,7 @@ const selectOuterStyle = _ref => {
48
62
  const calculatePadding = (padding, borderWidth) => padding && Math.max(0, padding - borderWidth); // Stable size as border changes
49
63
 
50
64
 
51
- const selectInnerStyle = _ref2 => {
65
+ const selectInnerStyle = (_ref2, password) => {
52
66
  let {
53
67
  borderColor,
54
68
  borderWidth,
@@ -65,7 +79,9 @@ const selectInnerStyle = _ref2 => {
65
79
  paddingLeft,
66
80
  paddingRight,
67
81
  paddingTop,
68
- paddingBottom
82
+ paddingBottom,
83
+ width,
84
+ height
69
85
  } = _ref2;
70
86
  return {
71
87
  // Inner borders animate with the icon and should be treated like a themable feature of the icon
@@ -87,9 +103,13 @@ const selectInnerStyle = _ref2 => {
87
103
  paddingBottom: calculatePadding(paddingBottom, borderBottomWidth),
88
104
  ...Platform.select({
89
105
  web: {
90
- pointerEvents: 'none'
106
+ pointerEvents: 'none',
107
+ display: 'inline-flex',
108
+ alignItems: 'center',
109
+ justifyContent: 'center'
91
110
  }
92
- })
111
+ }),
112
+ ...getPasswordDimensions(password, width, height)
93
113
  };
94
114
  };
95
115
  /**
@@ -133,7 +153,7 @@ const IconButton = /*#__PURE__*/forwardRef((_ref3, ref) => {
133
153
 
134
154
  const getTokens = useThemeTokensCallback('IconButton', tokens, variant);
135
155
 
136
- const getOuterStyle = pressableState => selectOuterStyle(getTokens(resolvePressableState(pressableState)));
156
+ const getOuterStyle = pressableState => selectOuterStyle(getTokens(resolvePressableState(pressableState), variant.password));
137
157
 
138
158
  return /*#__PURE__*/_jsx(Pressable, {
139
159
  ref: ref,
@@ -146,7 +166,7 @@ const IconButton = /*#__PURE__*/forwardRef((_ref3, ref) => {
146
166
  children: pressableState => {
147
167
  const themeTokens = getTokens(resolvePressableState(pressableState));
148
168
  return /*#__PURE__*/_jsx(View, {
149
- style: selectInnerStyle(themeTokens),
169
+ style: selectInnerStyle(themeTokens, variant.password),
150
170
  children: /*#__PURE__*/_jsx(Icon, {
151
171
  icon: IconComponent || themeTokens.icon,
152
172
  title: selectedProps.accessibilityLabel,
@@ -116,13 +116,13 @@ Item.propTypes = { ...selectedSystemPropTypes,
116
116
  children: PropTypes.node.isRequired,
117
117
 
118
118
  /**
119
- *
119
+ * @ignore
120
120
  * Set internally in `SideNav` render function - used to keep track of active item.
121
121
  */
122
122
  itemId: PropTypes.string,
123
123
 
124
124
  /**
125
- *
125
+ * @ignore
126
126
  * Set internally in `SideNav` render function - used to keep track of expanded items groups.
127
127
  */
128
128
  groupId: PropTypes.string,
@@ -136,27 +136,19 @@ Item.propTypes = { ...selectedSystemPropTypes,
136
136
  hrefAttrs: PropTypes.shape(hrefAttrsProp.types),
137
137
 
138
138
  /**
139
- *
139
+ * @ignore
140
140
  * Set internally in `SideNav` render function.
141
141
  */
142
142
  isActive: PropTypes.bool,
143
143
 
144
144
  /**
145
- *
145
+ * @ignore
146
146
  * Set internally in `SideNav.ItemsGroup` render function. Used to mark expanded `ItemsGroup` parent.
147
147
  */
148
148
  isExpanded: PropTypes.bool,
149
- tokens: getTokensPropType('SideNavItem'),
150
- variant: variantProp.propType,
151
-
152
- /**
153
- * Accesibility Role
154
- */
155
149
  accessibilityRole: PropTypes.string,
156
-
157
- /**
158
- * test ID
159
- */
160
- testID: PropTypes.number
150
+ testID: PropTypes.number,
151
+ tokens: getTokensPropType('SideNavItem'),
152
+ variant: variantProp.propType
161
153
  };
162
154
  export default Item;
@@ -269,7 +269,12 @@ const TextInputBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
269
269
  variant: {
270
270
  compact: true,
271
271
  password: true,
272
- inactive: !!variant.inactive
272
+ inactive: variant.inactive,
273
+ size: 'large'
274
+ },
275
+ tokens: {
276
+ width: 40,
277
+ height: 40
273
278
  }
274
279
  }, !showPassword ? 'hide' : 'show'));
275
280
  }
@@ -123,6 +123,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
123
123
  content,
124
124
  position = 'auto',
125
125
  copy = 'en',
126
+ onPress = () => {},
126
127
  tokens,
127
128
  variant,
128
129
  inline = false,
@@ -163,7 +164,10 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
163
164
  });
164
165
  const themeTokens = useThemeTokens('Tooltip', tokens, variant);
165
166
 
166
- const toggleIsOpen = () => setIsOpen(!isOpen);
167
+ const toggleIsOpen = () => {
168
+ onPress();
169
+ setIsOpen(!isOpen);
170
+ };
167
171
 
168
172
  const close = () => setIsOpen(false);
169
173
 
@@ -150,6 +150,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
150
150
  content,
151
151
  position = 'auto',
152
152
  copy = 'en',
153
+ onPress = () => {},
153
154
  tokens,
154
155
  variant,
155
156
  inline = false,
@@ -180,7 +181,10 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
180
181
  return () => subscription === null || subscription === void 0 ? void 0 : subscription.remove();
181
182
  });
182
183
 
183
- const toggleIsOpen = () => setIsOpen(!isOpen);
184
+ const toggleIsOpen = () => {
185
+ onPress();
186
+ setIsOpen(!isOpen);
187
+ };
184
188
 
185
189
  const close = () => setIsOpen(false);
186
190
 
@@ -26,6 +26,11 @@ const propTypes = {
26
26
  * Display tooltip icon button as an inline element.
27
27
  */
28
28
  inline: PropTypes.bool,
29
+
30
+ /**
31
+ * Callback function triggered when the tooltip is pressed.
32
+ */
33
+ onPress: PropTypes.func,
29
34
  tokens: getTokensPropType('Tooltip'),
30
35
  variant: variantProp.propType
31
36
  };
package/package.json CHANGED
@@ -74,5 +74,5 @@
74
74
  "standard-engine": {
75
75
  "skip": true
76
76
  },
77
- "version": "1.61.0"
77
+ "version": "1.62.0"
78
78
  }
@@ -18,20 +18,30 @@ import {
18
18
  } from '../utils'
19
19
  import Icon from '../Icon'
20
20
 
21
+ // function to get the dimentionals of the conditionals
22
+ const getPasswordDimensions = (password, width, height) => {
23
+ return password ? { width, height } : {}
24
+ }
25
+
21
26
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
22
27
 
23
- const selectOuterStyle = ({
24
- backgroundColor,
25
- outerBorderWidth,
26
- outerBorderColor,
27
- outerBorderGap,
28
- borderRadius,
29
- borderTopLeftRadius,
30
- borderTopRightRadius,
31
- borderBottomLeftRadius,
32
- borderBottomRightRadius,
33
- shadow
34
- }) => [
28
+ const selectOuterStyle = (
29
+ {
30
+ backgroundColor,
31
+ outerBorderWidth,
32
+ outerBorderColor,
33
+ outerBorderGap,
34
+ borderRadius,
35
+ borderTopLeftRadius,
36
+ borderTopRightRadius,
37
+ borderBottomLeftRadius,
38
+ borderBottomRightRadius,
39
+ shadow,
40
+ width,
41
+ height
42
+ },
43
+ password
44
+ ) => [
35
45
  {
36
46
  backgroundColor,
37
47
  ...applyShadowToken(shadow),
@@ -45,31 +55,44 @@ const selectOuterStyle = ({
45
55
  outerBorderColor,
46
56
  outerBorderGap
47
57
  }),
48
- ...Platform.select({ web: { outline: 'none', display: 'inline-flex' } })
58
+ ...getPasswordDimensions(password, width, height),
59
+ ...Platform.select({
60
+ web: {
61
+ outline: 'none',
62
+ display: 'inline-flex',
63
+ alignItems: 'center',
64
+ justifyContent: 'center'
65
+ }
66
+ })
49
67
  },
50
68
  staticStyles.outer
51
69
  ]
52
70
 
53
71
  const calculatePadding = (padding, borderWidth) => padding && Math.max(0, padding - borderWidth) // Stable size as border changes
54
72
 
55
- const selectInnerStyle = ({
56
- borderColor,
57
- borderWidth,
58
- borderTopLeftRadius,
59
- borderTopRightRadius,
60
- borderBottomLeftRadius,
61
- borderBottomRightRadius,
62
- borderRadius,
63
- padding = 0,
64
- borderTopWidth,
65
- borderRightWidth,
66
- borderBottomWidth,
67
- borderLeftWidth,
68
- paddingLeft,
69
- paddingRight,
70
- paddingTop,
71
- paddingBottom
72
- }) => ({
73
+ const selectInnerStyle = (
74
+ {
75
+ borderColor,
76
+ borderWidth,
77
+ borderTopLeftRadius,
78
+ borderTopRightRadius,
79
+ borderBottomLeftRadius,
80
+ borderBottomRightRadius,
81
+ borderRadius,
82
+ padding = 0,
83
+ borderTopWidth,
84
+ borderRightWidth,
85
+ borderBottomWidth,
86
+ borderLeftWidth,
87
+ paddingLeft,
88
+ paddingRight,
89
+ paddingTop,
90
+ paddingBottom,
91
+ width,
92
+ height
93
+ },
94
+ password
95
+ ) => ({
73
96
  // Inner borders animate with the icon and should be treated like a themable feature of the icon
74
97
  borderColor,
75
98
  borderRadius,
@@ -89,9 +112,13 @@ const selectInnerStyle = ({
89
112
  paddingBottom: calculatePadding(paddingBottom, borderBottomWidth),
90
113
  ...Platform.select({
91
114
  web: {
92
- pointerEvents: 'none'
115
+ pointerEvents: 'none',
116
+ display: 'inline-flex',
117
+ alignItems: 'center',
118
+ justifyContent: 'center'
93
119
  }
94
- })
120
+ }),
121
+ ...getPasswordDimensions(password, width, height)
95
122
  })
96
123
 
97
124
  /**
@@ -124,7 +151,7 @@ const IconButton = forwardRef(
124
151
 
125
152
  const getTokens = useThemeTokensCallback('IconButton', tokens, variant)
126
153
  const getOuterStyle = (pressableState) =>
127
- selectOuterStyle(getTokens(resolvePressableState(pressableState)))
154
+ selectOuterStyle(getTokens(resolvePressableState(pressableState), variant.password))
128
155
 
129
156
  return (
130
157
  <Pressable
@@ -139,7 +166,7 @@ const IconButton = forwardRef(
139
166
  {(pressableState) => {
140
167
  const themeTokens = getTokens(resolvePressableState(pressableState))
141
168
  return (
142
- <View style={selectInnerStyle(themeTokens)}>
169
+ <View style={selectInnerStyle(themeTokens, variant.password)}>
143
170
  <Icon
144
171
  icon={IconComponent || themeTokens.icon}
145
172
  title={selectedProps.accessibilityLabel}
@@ -111,12 +111,12 @@ Item.propTypes = {
111
111
  */
112
112
  children: PropTypes.node.isRequired,
113
113
  /**
114
- *
114
+ * @ignore
115
115
  * Set internally in `SideNav` render function - used to keep track of active item.
116
116
  */
117
117
  itemId: PropTypes.string,
118
118
  /**
119
- *
119
+ * @ignore
120
120
  * Set internally in `SideNav` render function - used to keep track of expanded items groups.
121
121
  */
122
122
  groupId: PropTypes.string,
@@ -128,25 +128,19 @@ Item.propTypes = {
128
128
  */
129
129
  hrefAttrs: PropTypes.shape(hrefAttrsProp.types),
130
130
  /**
131
- *
131
+ * @ignore
132
132
  * Set internally in `SideNav` render function.
133
133
  */
134
134
  isActive: PropTypes.bool,
135
135
  /**
136
- *
136
+ * @ignore
137
137
  * Set internally in `SideNav.ItemsGroup` render function. Used to mark expanded `ItemsGroup` parent.
138
138
  */
139
139
  isExpanded: PropTypes.bool,
140
- tokens: getTokensPropType('SideNavItem'),
141
- variant: variantProp.propType,
142
- /**
143
- * Accesibility Role
144
- */
145
140
  accessibilityRole: PropTypes.string,
146
- /**
147
- * test ID
148
- */
149
- testID: PropTypes.number
141
+ testID: PropTypes.number,
142
+ tokens: getTokensPropType('SideNavItem'),
143
+ variant: variantProp.propType
150
144
  }
151
145
 
152
146
  export default Item
@@ -253,7 +253,8 @@ const TextInputBase = forwardRef(
253
253
  icon={!showPassword ? passwordShowButtonIcon : passwordHideButtonIcon}
254
254
  key={!showPassword ? 'hide' : 'show'}
255
255
  onPress={handleShowOrHide}
256
- variant={{ compact: true, password: true, inactive: !!variant.inactive }}
256
+ variant={{ compact: true, password: true, inactive: variant.inactive, size: 'large' }}
257
+ tokens={{ width: 40, height: 40 }}
257
258
  />
258
259
  )
259
260
  }
@@ -83,7 +83,17 @@ const defaultControl = (pressableState, variant) => (
83
83
  */
84
84
  const Tooltip = forwardRef(
85
85
  (
86
- { children, content, position = 'auto', copy = 'en', tokens, variant, inline = false, ...rest },
86
+ {
87
+ children,
88
+ content,
89
+ position = 'auto',
90
+ copy = 'en',
91
+ onPress = () => {},
92
+ tokens,
93
+ variant,
94
+ inline = false,
95
+ ...rest
96
+ },
87
97
  ref
88
98
  ) => {
89
99
  const [isOpen, setIsOpen] = useState(false)
@@ -118,7 +128,10 @@ const Tooltip = forwardRef(
118
128
  const getCopy = useCopy({ dictionary, copy })
119
129
  const themeTokens = useThemeTokens('Tooltip', tokens, variant)
120
130
 
121
- const toggleIsOpen = () => setIsOpen(!isOpen)
131
+ const toggleIsOpen = () => {
132
+ onPress()
133
+ setIsOpen(!isOpen)
134
+ }
122
135
  const close = () => setIsOpen(false)
123
136
 
124
137
  const getPressableState = ({ pressed, hovered, focused }) => ({
@@ -109,7 +109,17 @@ const defaultControl = (pressableState, variant) => (
109
109
  */
110
110
  const Tooltip = forwardRef(
111
111
  (
112
- { children, content, position = 'auto', copy = 'en', tokens, variant, inline = false, ...rest },
112
+ {
113
+ children,
114
+ content,
115
+ position = 'auto',
116
+ copy = 'en',
117
+ onPress = () => {},
118
+ tokens,
119
+ variant,
120
+ inline = false,
121
+ ...rest
122
+ },
113
123
  ref
114
124
  ) => {
115
125
  const [isOpen, setIsOpen] = useState(false)
@@ -133,7 +143,10 @@ const Tooltip = forwardRef(
133
143
  return () => subscription?.remove()
134
144
  })
135
145
 
136
- const toggleIsOpen = () => setIsOpen(!isOpen)
146
+ const toggleIsOpen = () => {
147
+ onPress()
148
+ setIsOpen(!isOpen)
149
+ }
137
150
  const close = () => setIsOpen(false)
138
151
 
139
152
  const getPressableState = ({ pressed, hovered, focused }) => ({
@@ -24,6 +24,10 @@ const propTypes = {
24
24
  * Display tooltip icon button as an inline element.
25
25
  */
26
26
  inline: PropTypes.bool,
27
+ /**
28
+ * Callback function triggered when the tooltip is pressed.
29
+ */
30
+ onPress: PropTypes.func,
27
31
  tokens: getTokensPropType('Tooltip'),
28
32
  variant: variantProp.propType
29
33
  }