@telus-uds/components-web 2.34.3 → 2.35.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,27 @@
1
1
  # Change Log - @telus-uds/components-web
2
2
 
3
- This log was last generated on Fri, 07 Jun 2024 22:36:16 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 24 Jun 2024 16:19:29 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.35.0
8
+
9
+ Mon, 24 Jun 2024 16:19:29 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - `ActionCard`: make interactive card render body function (guillermo.peitzner@telus.com)
14
+ - Bump @telus-uds/components-base to v1.87.0
15
+ - Bump @telus-uds/system-theme-tokens to v2.58.0
16
+
17
+ ### Patches
18
+
19
+ - `DatePicker`: fix focus life cycle (guillermo.peitzner@telus.com)
20
+ - List: misalignment issue fixed when the text was too long and the container has display: 'flex' (35577399+JoshHC@users.noreply.github.com)
21
+
7
22
  ## 2.34.3
8
23
 
9
- Fri, 07 Jun 2024 22:36:16 GMT
24
+ Fri, 07 Jun 2024 22:42:09 GMT
10
25
 
11
26
  ### Patches
12
27
 
package/lib/Card/Card.js CHANGED
@@ -110,7 +110,7 @@ const Card = /*#__PURE__*/_react.default.forwardRef(function () {
110
110
  dataSet: dataSet,
111
111
  onPress: onPress,
112
112
  ...selectProps(rest),
113
- children: interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body
113
+ children: typeof (interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body) === 'function' ? interactiveCard.body() : interactiveCard.body
114
114
  }) : null, children || fullBleedContentPosition !== 'none' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
115
115
  direction: contentStackDirection,
116
116
  tokens: {
@@ -185,7 +185,7 @@ Card.propTypes = {
185
185
  * Object to set interactive card's properties
186
186
  */
187
187
  interactiveCard: _propTypes.default.shape({
188
- body: _propTypes.default.node,
188
+ body: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
189
189
  tokens: (0, _componentsBase.getTokensPropType)('Card'),
190
190
  variant: _componentsBase.variantProp.propType
191
191
  })
@@ -119,6 +119,7 @@ const DatePicker = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
119
119
  const [inputDate, setInputDate] = _react.default.useState(date instanceof _moment.default ? date : undefined);
120
120
  const [inputText, setInputText] = _react.default.useState(date instanceof _moment.default ? date.format(dateFormat) : '');
121
121
  const textInputRef = _react.default.useRef();
122
+ const prevButtonRef = _react.default.useRef();
122
123
  const [datePickerPosition, setDatePickerPosition] = _react.default.useState({
123
124
  left: 0,
124
125
  top: 0
@@ -159,6 +160,19 @@ const DatePicker = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
159
160
  setInputText(date instanceof _moment.default ? date.format(dateFormat) : '');
160
161
  }
161
162
  }, [date, inputDate]);
163
+ _react.default.useEffect(() => {
164
+ let timeoutId;
165
+ if (prevButtonRef.current && isFocused) {
166
+ timeoutId = setTimeout(() => prevButtonRef.current.focus(), 100);
167
+ }
168
+ return () => clearTimeout(timeoutId);
169
+ }, [isFocused]);
170
+ _react.default.useEffect(() => {
171
+ if (inputText !== '' && inputDate !== undefined) {
172
+ var _textInputRef$current;
173
+ textInputRef === null || textInputRef === void 0 ? void 0 : (_textInputRef$current = textInputRef.current) === null || _textInputRef$current === void 0 ? void 0 : _textInputRef$current.focus();
174
+ }
175
+ }, [inputDate, inputText]);
162
176
  const onFocusChange = _ref4 => {
163
177
  let {
164
178
  focused
@@ -169,7 +183,7 @@ const DatePicker = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
169
183
  setIsClickedInside(false);
170
184
  };
171
185
  const handleFocus = event => {
172
- if (event.target.tagName === 'INPUT' && !disabled) {
186
+ if (event.target.tagName === 'INPUT' && !disabled && inputDate === undefined && inputText === '') {
173
187
  setIsFocused(true);
174
188
  }
175
189
  };
@@ -265,7 +279,8 @@ const DatePicker = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
265
279
  variant: {
266
280
  size: 'small'
267
281
  },
268
- testID: prevTestID
282
+ testID: prevTestID,
283
+ ref: prevButtonRef
269
284
  });
270
285
  };
271
286
  const renderNextButton = _ref6 => {
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "A11yText", {
15
15
  return _componentsBase.A11yText;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "ActionCard", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _componentsBase.ActionCard;
22
+ }
23
+ });
18
24
  Object.defineProperty(exports, "ActivityIndicator", {
19
25
  enumerable: true,
20
26
  get: function () {
@@ -103,7 +103,7 @@ const Card = /*#__PURE__*/React.forwardRef(function () {
103
103
  dataSet: dataSet,
104
104
  onPress: onPress,
105
105
  ...selectProps(rest),
106
- children: interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body
106
+ children: typeof (interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body) === 'function' ? interactiveCard.body() : interactiveCard.body
107
107
  }) : null, children || fullBleedContentPosition !== 'none' ? /*#__PURE__*/_jsxs(StackView, {
108
108
  direction: contentStackDirection,
109
109
  tokens: {
@@ -178,7 +178,7 @@ Card.propTypes = {
178
178
  * Object to set interactive card's properties
179
179
  */
180
180
  interactiveCard: PropTypes.shape({
181
- body: PropTypes.node,
181
+ body: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
182
182
  tokens: getTokensPropType('Card'),
183
183
  variant: variantProp.propType
184
184
  })
@@ -114,6 +114,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
114
114
  const [inputDate, setInputDate] = React.useState(date instanceof moment ? date : undefined);
115
115
  const [inputText, setInputText] = React.useState(date instanceof moment ? date.format(dateFormat) : '');
116
116
  const textInputRef = React.useRef();
117
+ const prevButtonRef = React.useRef();
117
118
  const [datePickerPosition, setDatePickerPosition] = React.useState({
118
119
  left: 0,
119
120
  top: 0
@@ -154,6 +155,19 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
154
155
  setInputText(date instanceof moment ? date.format(dateFormat) : '');
155
156
  }
156
157
  }, [date, inputDate]);
158
+ React.useEffect(() => {
159
+ let timeoutId;
160
+ if (prevButtonRef.current && isFocused) {
161
+ timeoutId = setTimeout(() => prevButtonRef.current.focus(), 100);
162
+ }
163
+ return () => clearTimeout(timeoutId);
164
+ }, [isFocused]);
165
+ React.useEffect(() => {
166
+ if (inputText !== '' && inputDate !== undefined) {
167
+ var _textInputRef$current;
168
+ textInputRef === null || textInputRef === void 0 ? void 0 : (_textInputRef$current = textInputRef.current) === null || _textInputRef$current === void 0 ? void 0 : _textInputRef$current.focus();
169
+ }
170
+ }, [inputDate, inputText]);
157
171
  const onFocusChange = _ref4 => {
158
172
  let {
159
173
  focused
@@ -164,7 +178,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
164
178
  setIsClickedInside(false);
165
179
  };
166
180
  const handleFocus = event => {
167
- if (event.target.tagName === 'INPUT' && !disabled) {
181
+ if (event.target.tagName === 'INPUT' && !disabled && inputDate === undefined && inputText === '') {
168
182
  setIsFocused(true);
169
183
  }
170
184
  };
@@ -260,7 +274,8 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
260
274
  variant: {
261
275
  size: 'small'
262
276
  },
263
- testID: prevTestID
277
+ testID: prevTestID,
278
+ ref: prevButtonRef
264
279
  });
265
280
  };
266
281
  const renderNextButton = _ref6 => {
@@ -5,7 +5,7 @@ export {
5
5
  /**
6
6
  * Most base components should be re-exported as-is.
7
7
  */
8
- A11yText, ActivityIndicator, Autocomplete, Box, Button, BaseProvider, A11yInfoProvider, ViewportProvider, ThemeProvider, ButtonDropdown, ButtonGroup, ButtonLink, CardGroup, Carousel, CarouselTabs, Checkbox, CheckboxGroup, ChevronLink, ColourToggle, Divider, ExpandCollapse, Feedback, FlexGrid, Icon, InputLabel, InputSupports, Link, Listbox, Modal, MultiSelectFilter, Notification, Pagination, Portal, QuickLinks, QuickLinksFeature, Radio, RadioGroup, RadioCard, RadioCardGroup, Responsive, Search, Select, SideNav, Skeleton, SkipLink, Spacer, StackView, StackWrap, StepTracker, Tabs, Tags, TextButton, TextArea, TextInput, Timeline, ToggleSwitch, ToggleSwitchGroup, TooltipButton, Tooltip, Typography, Validator,
8
+ ActionCard, A11yText, ActivityIndicator, Autocomplete, Box, Button, BaseProvider, A11yInfoProvider, ViewportProvider, ThemeProvider, ButtonDropdown, ButtonGroup, ButtonLink, CardGroup, Carousel, CarouselTabs, Checkbox, CheckboxGroup, ChevronLink, ColourToggle, Divider, ExpandCollapse, Feedback, FlexGrid, Icon, InputLabel, InputSupports, Link, Listbox, Modal, MultiSelectFilter, Notification, Pagination, Portal, QuickLinks, QuickLinksFeature, Radio, RadioGroup, RadioCard, RadioCardGroup, Responsive, Search, Select, SideNav, Skeleton, SkipLink, Spacer, StackView, StackWrap, StepTracker, Tabs, Tags, TextButton, TextArea, TextInput, Timeline, ToggleSwitch, ToggleSwitchGroup, TooltipButton, Tooltip, Typography, Validator,
9
9
  /*
10
10
  * Most utilities exported from @telus-uds/components-base are for building systems, not apps.
11
11
  * Re-export only those utilities with a stable API and known use cases within apps / pages.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  ],
6
6
  "dependencies": {
7
7
  "@gorhom/portal": "^1.0.14",
8
- "@telus-uds/components-base": "1.86.0",
8
+ "@telus-uds/components-base": "1.87.0",
9
9
  "@telus-uds/system-constants": "^1.3.0",
10
10
  "fscreen": "^1.2.0",
11
11
  "lodash.omit": "^4.5.0",
@@ -13,7 +13,7 @@
13
13
  "react-dates": "^21.8.0",
14
14
  "react-helmet-async": "^1.3.0",
15
15
  "react-moment-proptypes": "^1.8.1",
16
- "@telus-uds/system-theme-tokens": "^2.57.0",
16
+ "@telus-uds/system-theme-tokens": "^2.58.0",
17
17
  "prop-types": "^15.7.2",
18
18
  "lodash.throttle": "^4.1.1",
19
19
  "react-youtube": "^10.1.0",
@@ -83,5 +83,5 @@
83
83
  "skip": true
84
84
  },
85
85
  "types": "types/index.d.ts",
86
- "version": "2.34.3"
86
+ "version": "2.35.0"
87
87
  }
package/src/Card/Card.jsx CHANGED
@@ -116,7 +116,9 @@ const Card = React.forwardRef(
116
116
  onPress={onPress}
117
117
  {...selectProps(rest)}
118
118
  >
119
- {interactiveCard?.body}
119
+ {typeof interactiveCard?.body === 'function'
120
+ ? interactiveCard.body()
121
+ : interactiveCard.body}
120
122
  </PressableCardBase>
121
123
  ) : null}
122
124
  {children || fullBleedContentPosition !== 'none' ? (
@@ -197,7 +199,7 @@ Card.propTypes = {
197
199
  * Object to set interactive card's properties
198
200
  */
199
201
  interactiveCard: PropTypes.shape({
200
- body: PropTypes.node,
202
+ body: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
201
203
  tokens: getTokensPropType('Card'),
202
204
  variant: variantProp.propType
203
205
  })
@@ -109,6 +109,7 @@ const DatePicker = React.forwardRef(
109
109
  date instanceof moment ? date.format(dateFormat) : ''
110
110
  )
111
111
  const textInputRef = React.useRef()
112
+ const prevButtonRef = React.useRef()
112
113
  const [datePickerPosition, setDatePickerPosition] = React.useState({ left: 0, top: 0 })
113
114
 
114
115
  useSafeLayoutEffect(() => {
@@ -130,6 +131,7 @@ const DatePicker = React.forwardRef(
130
131
  const [isFocused, setIsFocused] = React.useState(false)
131
132
  const [isClickedInside, setIsClickedInside] = React.useState(false)
132
133
  const getCopy = useCopy({ dictionary, copy })
134
+
133
135
  React.useEffect(() => {
134
136
  /**
135
137
  * `date` could be passed as `null` to reset the value so explicitly
@@ -140,6 +142,23 @@ const DatePicker = React.forwardRef(
140
142
  setInputText(date instanceof moment ? date.format(dateFormat) : '')
141
143
  }
142
144
  }, [date, inputDate])
145
+
146
+ React.useEffect(() => {
147
+ let timeoutId
148
+
149
+ if (prevButtonRef.current && isFocused) {
150
+ timeoutId = setTimeout(() => prevButtonRef.current.focus(), 100)
151
+ }
152
+
153
+ return () => clearTimeout(timeoutId)
154
+ }, [isFocused])
155
+
156
+ React.useEffect(() => {
157
+ if (inputText !== '' && inputDate !== undefined) {
158
+ textInputRef?.current?.focus()
159
+ }
160
+ }, [inputDate, inputText])
161
+
143
162
  const onFocusChange = ({ focused }) => {
144
163
  if (!isClickedInside) {
145
164
  setIsFocused(focused)
@@ -147,7 +166,12 @@ const DatePicker = React.forwardRef(
147
166
  setIsClickedInside(false)
148
167
  }
149
168
  const handleFocus = (event) => {
150
- if (event.target.tagName === 'INPUT' && !disabled) {
169
+ if (
170
+ event.target.tagName === 'INPUT' &&
171
+ !disabled &&
172
+ inputDate === undefined &&
173
+ inputText === ''
174
+ ) {
151
175
  setIsFocused(true)
152
176
  }
153
177
  }
@@ -248,6 +272,7 @@ const DatePicker = React.forwardRef(
248
272
  icon={previousIcon}
249
273
  variant={{ size: 'small' }}
250
274
  testID={prevTestID}
275
+ ref={prevButtonRef}
251
276
  />
252
277
  )
253
278
  const renderNextButton = ({ onClick }) => (
@@ -5,6 +5,7 @@ export {
5
5
  /**
6
6
  * Most base components should be re-exported as-is.
7
7
  */
8
+ ActionCard,
8
9
  A11yText,
9
10
  ActivityIndicator,
10
11
  Autocomplete,