@telus-uds/components-base 1.19.0 → 1.21.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 (97) hide show
  1. package/CHANGELOG.md +34 -2
  2. package/__tests17__/ThemeProvider/ThemeProvider.test.jsx +3 -1
  3. package/component-docs.json +838 -125
  4. package/lib/BaseProvider/index.js +2 -1
  5. package/lib/Box/Box.js +14 -1
  6. package/lib/Button/ButtonDropdown.js +207 -0
  7. package/lib/Button/index.js +8 -0
  8. package/lib/Carousel/Carousel.js +2 -2
  9. package/lib/Carousel/CarouselItem/CarouselItem.js +7 -1
  10. package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +21 -4
  11. package/lib/FlexGrid/Col/Col.js +1 -3
  12. package/lib/FlexGrid/FlexGrid.js +3 -5
  13. package/lib/FlexGrid/Row/Row.js +3 -3
  14. package/lib/IconButton/IconButton.js +12 -4
  15. package/lib/MultiSelectFilter/MultiSelectFilter.js +276 -0
  16. package/lib/MultiSelectFilter/dictionary.js +19 -0
  17. package/lib/MultiSelectFilter/index.js +13 -0
  18. package/lib/Search/Search.js +4 -1
  19. package/lib/Select/Picker.native.js +16 -13
  20. package/lib/Select/Select.js +7 -1
  21. package/lib/Select/constants.js +15 -0
  22. package/lib/StepTracker/Step.js +2 -1
  23. package/lib/TextInput/TextInput.js +9 -2
  24. package/lib/TextInput/TextInputBase.js +52 -8
  25. package/lib/TextInput/dictionary.js +15 -0
  26. package/lib/ThemeProvider/ThemeProvider.js +24 -7
  27. package/lib/ThemeProvider/utils/styles.js +3 -1
  28. package/lib/index.js +18 -0
  29. package/lib/utils/BaseView/BaseView.js +64 -0
  30. package/lib/utils/BaseView/BaseView.native.js +16 -0
  31. package/lib/utils/BaseView/index.js +13 -0
  32. package/lib/utils/index.js +10 -1
  33. package/lib/utils/input.js +11 -3
  34. package/lib/utils/props/handlerProps.js +5 -0
  35. package/lib-module/BaseProvider/index.js +2 -1
  36. package/lib-module/Box/Box.js +14 -1
  37. package/lib-module/Button/ButtonDropdown.js +181 -0
  38. package/lib-module/Button/index.js +2 -1
  39. package/lib-module/Carousel/Carousel.js +2 -2
  40. package/lib-module/Carousel/CarouselItem/CarouselItem.js +8 -2
  41. package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +23 -6
  42. package/lib-module/FlexGrid/Col/Col.js +2 -3
  43. package/lib-module/FlexGrid/FlexGrid.js +2 -3
  44. package/lib-module/FlexGrid/Row/Row.js +2 -2
  45. package/lib-module/IconButton/IconButton.js +14 -4
  46. package/lib-module/MultiSelectFilter/MultiSelectFilter.js +248 -0
  47. package/lib-module/MultiSelectFilter/dictionary.js +12 -0
  48. package/lib-module/MultiSelectFilter/index.js +2 -0
  49. package/lib-module/Search/Search.js +4 -1
  50. package/lib-module/Select/Picker.native.js +15 -13
  51. package/lib-module/Select/Select.js +6 -1
  52. package/lib-module/Select/constants.js +5 -0
  53. package/lib-module/StepTracker/Step.js +2 -1
  54. package/lib-module/TextInput/TextInput.js +6 -0
  55. package/lib-module/TextInput/TextInputBase.js +52 -10
  56. package/lib-module/TextInput/dictionary.js +8 -0
  57. package/lib-module/ThemeProvider/ThemeProvider.js +24 -7
  58. package/lib-module/ThemeProvider/utils/styles.js +3 -1
  59. package/lib-module/index.js +2 -0
  60. package/lib-module/utils/BaseView/BaseView.js +43 -0
  61. package/lib-module/utils/BaseView/BaseView.native.js +6 -0
  62. package/lib-module/utils/BaseView/index.js +2 -0
  63. package/lib-module/utils/index.js +2 -1
  64. package/lib-module/utils/input.js +11 -3
  65. package/lib-module/utils/props/handlerProps.js +5 -0
  66. package/package.json +3 -3
  67. package/src/BaseProvider/index.jsx +4 -1
  68. package/src/Box/Box.jsx +14 -1
  69. package/src/Button/ButtonDropdown.jsx +179 -0
  70. package/src/Button/index.js +2 -1
  71. package/src/Carousel/Carousel.jsx +6 -3
  72. package/src/Carousel/CarouselItem/CarouselItem.jsx +9 -2
  73. package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +19 -5
  74. package/src/FlexGrid/Col/Col.jsx +4 -4
  75. package/src/FlexGrid/FlexGrid.jsx +11 -10
  76. package/src/FlexGrid/Row/Row.jsx +4 -3
  77. package/src/IconButton/IconButton.jsx +3 -1
  78. package/src/MultiSelectFilter/MultiSelectFilter.jsx +227 -0
  79. package/src/MultiSelectFilter/dictionary.js +12 -0
  80. package/src/MultiSelectFilter/index.js +3 -0
  81. package/src/Search/Search.jsx +2 -1
  82. package/src/Select/Picker.native.jsx +29 -14
  83. package/src/Select/Select.jsx +7 -1
  84. package/src/Select/constants.js +5 -0
  85. package/src/StepTracker/Step.jsx +5 -1
  86. package/src/TextInput/TextInput.jsx +5 -0
  87. package/src/TextInput/TextInputBase.jsx +43 -8
  88. package/src/TextInput/dictionary.js +8 -0
  89. package/src/ThemeProvider/ThemeProvider.jsx +23 -6
  90. package/src/ThemeProvider/utils/styles.js +3 -1
  91. package/src/index.js +2 -0
  92. package/src/utils/BaseView/BaseView.jsx +38 -0
  93. package/src/utils/BaseView/BaseView.native.jsx +6 -0
  94. package/src/utils/BaseView/index.js +3 -0
  95. package/src/utils/index.js +1 -0
  96. package/src/utils/input.js +9 -4
  97. package/src/utils/props/handlerProps.js +4 -0
@@ -59,7 +59,9 @@ function applyTextStyles(_ref) {
59
59
  // Don't set undefined font families. May need some validation here that the font is available.
60
60
  // Android doesn't recognise font weights natively so apply custom font weights via `fontFamily`.
61
61
  styles.fontFamily = "".concat(fontName).concat(fontWeight).concat(fontStyle);
62
- } else if (fontWeight) {
62
+ }
63
+
64
+ if (fontWeight) {
63
65
  // If using system default font, apply the font weight directly.
64
66
  // Font weight support in Android is limited to 'bold' or anything else === 'normal'.
65
67
  styles.fontWeight = _Platform.default.OS === 'android' && Number(fontWeight) > 400 ? 'bold' : fontWeight;
package/lib/index.js CHANGED
@@ -25,6 +25,7 @@ var _exportNames = {
25
25
  ListItem: true,
26
26
  ListBase: true,
27
27
  Modal: true,
28
+ MultiSelectFilter: true,
28
29
  Notification: true,
29
30
  Pagination: true,
30
31
  Progress: true,
@@ -49,6 +50,7 @@ var _exportNames = {
49
50
  A11yInfoProvider: true,
50
51
  useA11yInfo: true,
51
52
  BaseProvider: true,
53
+ useHydrationContext: true,
52
54
  ViewportProvider: true,
53
55
  useViewport: true,
54
56
  ViewportContext: true,
@@ -194,6 +196,12 @@ Object.defineProperty(exports, "Modal", {
194
196
  return _Modal.default;
195
197
  }
196
198
  });
199
+ Object.defineProperty(exports, "MultiSelectFilter", {
200
+ enumerable: true,
201
+ get: function () {
202
+ return _MultiSelectFilter.default;
203
+ }
204
+ });
197
205
  Object.defineProperty(exports, "Notification", {
198
206
  enumerable: true,
199
207
  get: function () {
@@ -380,6 +388,12 @@ Object.defineProperty(exports, "useA11yInfo", {
380
388
  return _A11yInfoProvider.useA11yInfo;
381
389
  }
382
390
  });
391
+ Object.defineProperty(exports, "useHydrationContext", {
392
+ enumerable: true,
393
+ get: function () {
394
+ return _HydrationContext.useHydrationContext;
395
+ }
396
+ });
383
397
  Object.defineProperty(exports, "useSetTheme", {
384
398
  enumerable: true,
385
399
  get: function () {
@@ -517,6 +531,8 @@ var _List = _interopRequireWildcard(require("./List"));
517
531
 
518
532
  var _Modal = _interopRequireDefault(require("./Modal"));
519
533
 
534
+ var _MultiSelectFilter = _interopRequireDefault(require("./MultiSelectFilter"));
535
+
520
536
  var _Notification = _interopRequireDefault(require("./Notification"));
521
537
 
522
538
  var _Pagination = _interopRequireDefault(require("./Pagination"));
@@ -627,6 +643,8 @@ var _A11yInfoProvider = _interopRequireWildcard(require("./A11yInfoProvider"));
627
643
 
628
644
  var _BaseProvider = _interopRequireDefault(require("./BaseProvider"));
629
645
 
646
+ var _HydrationContext = require("./BaseProvider/HydrationContext");
647
+
630
648
  var _ViewportProvider = _interopRequireWildcard(require("./ViewportProvider"));
631
649
 
632
650
  var _ThemeProvider = _interopRequireWildcard(require("./ThemeProvider"));
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
11
+
12
+ var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
13
+
14
+ var _propTypes = _interopRequireDefault(require("prop-types"));
15
+
16
+ var _ThemeProvider = require("../../ThemeProvider");
17
+
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ 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; }
25
+
26
+ /**
27
+ * Identical to React Native's View and supporting all the same props, but with:
28
+ * - a zIndex: 'auto' style added to prevent unexpectedly causing children to overlap other elements from other stacking contexts
29
+ */
30
+ const BaseView = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
31
+ let {
32
+ children,
33
+ style,
34
+ ...rest
35
+ } = _ref;
36
+ const {
37
+ themeOptions
38
+ } = (0, _ThemeProvider.useTheme)();
39
+ const styleProp = Array.isArray(style) ? [...style] : [style];
40
+
41
+ if (!themeOptions.forceZIndex) {
42
+ styleProp.unshift(styles.resetZIndex);
43
+ }
44
+
45
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, { ...rest,
46
+ style: styleProp,
47
+ ref: ref,
48
+ children: children
49
+ });
50
+ });
51
+ BaseView.displayName = 'BaseView';
52
+
53
+ const styles = _StyleSheet.default.create({
54
+ resetZIndex: {
55
+ zIndex: 'auto'
56
+ }
57
+ });
58
+
59
+ BaseView.propTypes = {
60
+ children: _propTypes.default.node,
61
+ style: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.array])
62
+ };
63
+ var _default = BaseView;
64
+ exports.default = _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ /**
13
+ * Android crashes on non-standard style properties like `zIndex` so adding a `BaseView` for native platforms
14
+ */
15
+ var _default = _View.default;
16
+ exports.default = _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _BaseView = _interopRequireDefault(require("./BaseView"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = _BaseView.default;
13
+ exports.default = _default;
@@ -13,8 +13,15 @@ var _exportNames = {
13
13
  useScrollBlocking: true,
14
14
  useUniqueId: true,
15
15
  withLinkRouter: true,
16
- containUniqueFields: true
16
+ containUniqueFields: true,
17
+ BaseView: true
17
18
  };
19
+ Object.defineProperty(exports, "BaseView", {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _BaseView.default;
23
+ }
24
+ });
18
25
  Object.defineProperty(exports, "containUniqueFields", {
19
26
  enumerable: true,
20
27
  get: function () {
@@ -206,6 +213,8 @@ Object.keys(_ssr).forEach(function (key) {
206
213
 
207
214
  var _containUniqueFields = _interopRequireDefault(require("./containUniqueFields"));
208
215
 
216
+ var _BaseView = _interopRequireDefault(require("./BaseView"));
217
+
209
218
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
210
219
 
211
220
  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; }
@@ -84,6 +84,7 @@ const useInputValue = function () {
84
84
  const {
85
85
  value,
86
86
  initialValue,
87
+ inputRef,
87
88
  onChange,
88
89
  readOnly = false
89
90
  } = props;
@@ -97,19 +98,26 @@ const useInputValue = function () {
97
98
  }); // Make current value accessible inside useCallback without rememoizing every time the value changes
98
99
 
99
100
  valueRef.current.value = currentValue;
101
+ const isDirty = currentValue !== valueRef.current.initial;
100
102
  const setValue = (0, _react.useCallback)((arg, event) => {
101
103
  if (readOnly) return;
102
104
  const newValue = typeof arg === 'function' ? arg(valueRef.current.value) : arg;
103
- if (!isControlled) setOwnValue(newValue); // Call onChange handler if there's something for it to handle (event or a changed value)
105
+
106
+ if (!isControlled) {
107
+ setOwnValue(newValue);
108
+ if (inputRef !== null && inputRef !== void 0 && inputRef.current) inputRef.current.value = newValue !== null && newValue !== void 0 ? newValue : '';
109
+ } // Call onChange handler if there's something for it to handle (event or a changed value)
110
+
104
111
 
105
112
  if (onChange && (event || valueRef.current.value !== newValue)) onChange(newValue, event);
106
- }, [isControlled, onChange, readOnly]);
113
+ }, [inputRef, isControlled, onChange, readOnly]);
107
114
  const resetValue = (0, _react.useCallback)(event => setValue(valueRef.current.initial, event), [setValue]);
108
115
  return {
109
116
  currentValue,
110
117
  setValue,
111
118
  resetValue,
112
- isControlled
119
+ isControlled,
120
+ isDirty
113
121
  };
114
122
  };
115
123
  /**
@@ -40,6 +40,11 @@ const textInputHandlerProps = {
40
40
  */
41
41
  onChangeText: _propTypes.default.func,
42
42
 
43
+ /**
44
+ * onClear handler
45
+ */
46
+ onClear: _propTypes.default.func,
47
+
43
48
  /**
44
49
  * onSubmit handler
45
50
  */
@@ -34,7 +34,8 @@ BaseProvider.propTypes = {
34
34
  children: PropTypes.node.isRequired,
35
35
  defaultTheme: (_ThemeProvider$propTy = ThemeProvider.propTypes) === null || _ThemeProvider$propTy === void 0 ? void 0 : _ThemeProvider$propTy.defaultTheme,
36
36
  themeOptions: PropTypes.shape({
37
- forceAbsoluteFontSizing: PropTypes.bool
37
+ forceAbsoluteFontSizing: PropTypes.bool,
38
+ forceZIndex: PropTypes.bool
38
39
  })
39
40
  };
40
41
  export default BaseProvider;
@@ -14,9 +14,22 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
14
14
  */
15
15
 
16
16
  const selectBoxStyles = tokens => {
17
- const styles = {
17
+ let styles = {
18
18
  backgroundColor: tokens.backgroundColor
19
19
  };
20
+
21
+ if (tokens.gradient) {
22
+ const {
23
+ gradient: {
24
+ angle,
25
+ stops: [stopOne, stopTwo]
26
+ }
27
+ } = tokens;
28
+ styles = { ...styles,
29
+ backgroundImage: "linear-gradient(".concat(angle, "deg, ").concat(stopOne.color, ", 75% , ").concat(stopTwo.color, ")")
30
+ };
31
+ }
32
+
20
33
  const paddings = ['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom']; // Only set on styles if token provided because we spread this object after the spacing scale values
21
34
 
22
35
  paddings.forEach(side => {
@@ -0,0 +1,181 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Platform from "react-native-web/dist/exports/Platform";
4
+ import Text from "react-native-web/dist/exports/Text";
5
+ import View from "react-native-web/dist/exports/View";
6
+ import buttonPropTypes, { textAndA11yText } from './propTypes';
7
+ import ButtonBase from './ButtonBase';
8
+ import { useThemeTokensCallback } from '../ThemeProvider';
9
+ import { a11yProps, focusHandlerProps, resolvePressableState, selectTokens, useInputValue } from '../utils';
10
+ import Icon from '../Icon';
11
+ import { getStackedContent } from '../StackView';
12
+ import { getPressHandlersWithArgs } from '../utils/pressability';
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+
15
+ const selectIconTokens = _ref => {
16
+ let {
17
+ icon,
18
+ iconPosition,
19
+ iconSpace,
20
+ iconSize,
21
+ iconColor,
22
+ iconBackground,
23
+ iconBorderRadius,
24
+ iconAlignSelf,
25
+ iconPadding,
26
+ iconTranslateX,
27
+ iconTranslateY
28
+ } = _ref;
29
+ return {
30
+ icon,
31
+ iconPosition,
32
+ iconSpace,
33
+ iconWrapperStyle: {
34
+ backgroundColor: iconBackground,
35
+ borderRadius: iconBorderRadius,
36
+ alignSelf: iconAlignSelf,
37
+ padding: iconPadding,
38
+ ...Platform.select({
39
+ // TODO: https://github.com/telus/universal-design-system/issues/487
40
+ web: {
41
+ transition: 'color 200ms, background 200ms'
42
+ }
43
+ })
44
+ },
45
+ iconTokens: {
46
+ size: iconSize,
47
+ color: iconColor,
48
+ translateX: iconTranslateX,
49
+ translateY: iconTranslateY
50
+ }
51
+ };
52
+ };
53
+
54
+ const ButtonDropdown = /*#__PURE__*/forwardRef((_ref2, ref) => {
55
+ let {
56
+ value,
57
+ initialValue,
58
+ onChange,
59
+ label,
60
+ tokens,
61
+ variant,
62
+ inactive = false,
63
+ readOnly = false,
64
+ children = null,
65
+ accessibilityRole = 'radio',
66
+ ...props
67
+ } = _ref2;
68
+ const {
69
+ currentValue: isOpen,
70
+ setValue: setIsOpen
71
+ } = useInputValue({
72
+ value,
73
+ initialValue,
74
+ onChange,
75
+ readOnly
76
+ }, 'useButtonDropdownValues');
77
+ const extraState = {
78
+ open: isOpen,
79
+ inactive,
80
+ ...variant
81
+ };
82
+ const getTokens = useThemeTokensCallback('ButtonDropdown', tokens, extraState);
83
+
84
+ const getButtonTokens = buttonState => selectTokens('Button', getTokens(buttonState)); // Pass an object of relevant component state as first argument for any passed-in press handlers
85
+
86
+
87
+ const pressHandlers = getPressHandlersWithArgs(props, [{
88
+ label,
89
+ open: isOpen
90
+ }]);
91
+
92
+ const handlePress = event => {
93
+ if (!inactive) {
94
+ if (pressHandlers.onPress) pressHandlers === null || pressHandlers === void 0 ? void 0 : pressHandlers.onPress(event);
95
+ setIsOpen(!isOpen, event);
96
+ }
97
+ };
98
+
99
+ return /*#__PURE__*/_jsx(ButtonBase, {
100
+ ref: ref,
101
+ ...pressHandlers,
102
+ onPress: handlePress,
103
+ tokens: getButtonTokens,
104
+ inactive: inactive,
105
+ icon: () => null,
106
+ accessibilityRole: accessibilityRole,
107
+ ...props,
108
+ children: _ref3 => {
109
+ let {
110
+ textStyles,
111
+ ...buttonState
112
+ } = _ref3;
113
+ // TODO: once Icon/IconButton designs are stable, see if this sort of styling around
114
+ // an icon should go in Icon itself, or possibly via an IconText token set. Related issues:
115
+ // - Icon: https://github.com/telus/universal-design-system/issues/327
116
+ // - IconButton: https://github.com/telus/universal-design-system/issues/281
117
+ // - Token sets: https://github.com/telus/universal-design-system/issues/782
118
+ const itemTokens = getTokens(buttonState);
119
+ const {
120
+ iconTokens,
121
+ iconPosition,
122
+ iconSpace,
123
+ iconWrapperStyle,
124
+ icon: IconComponent
125
+ } = selectIconTokens(itemTokens);
126
+ const iconContent = IconComponent ? /*#__PURE__*/_jsx(View, {
127
+ style: iconWrapperStyle,
128
+ children: /*#__PURE__*/_jsx(Icon, {
129
+ icon: IconComponent,
130
+ tokens: iconTokens
131
+ })
132
+ }) : null;
133
+
134
+ const childrenContent = () => typeof children === 'function' ? children({ ...resolvePressableState(buttonState, extraState),
135
+ textStyles
136
+ }) : children;
137
+
138
+ const content = children ? childrenContent() : /*#__PURE__*/_jsx(Text, {
139
+ style: textStyles,
140
+ children: label
141
+ });
142
+ return getStackedContent(iconPosition === 'left' ? [iconContent, content] : [content, iconContent], {
143
+ space: iconSpace,
144
+ direction: 'row'
145
+ });
146
+ }
147
+ });
148
+ });
149
+ ButtonDropdown.displayName = 'ButtonDropdown';
150
+ ButtonDropdown.propTypes = { ...a11yProps.types,
151
+ ...focusHandlerProps.types,
152
+ ...buttonPropTypes,
153
+ children: textAndA11yText,
154
+
155
+ /**
156
+ * Callback called when a controlled ButtonDropdown gets interacted with.
157
+ */
158
+ onChange: PropTypes.func,
159
+
160
+ /**
161
+ * `value` prop is being used to set the 'open' state of ButtonDropdown. Use it for
162
+ * controlled ButtonDropdown. For uncontrolled ButtonDropdown, use `initialValue`.
163
+ */
164
+ value: PropTypes.bool,
165
+
166
+ /**
167
+ * Use `initialValue` to provide the initial value for an uncontrolled version.
168
+ */
169
+ initialValue: PropTypes.bool,
170
+
171
+ /**
172
+ * The label of ButtonDropdown.
173
+ */
174
+ label: PropTypes.string,
175
+
176
+ /**
177
+ * By default, `ButtonDropdown` is treated by accessibility tools as a radio button.
178
+ */
179
+ accessibilityRole: PropTypes.string
180
+ };
181
+ export default ButtonDropdown;
@@ -1,4 +1,5 @@
1
1
  import Button from './Button';
2
2
  import ButtonLink from './ButtonLink';
3
3
  import ButtonGroup from './ButtonGroup';
4
- export { Button, ButtonGroup, ButtonLink };
4
+ import ButtonDropdown from './ButtonDropdown';
5
+ export { Button, ButtonDropdown, ButtonGroup, ButtonLink };
@@ -298,7 +298,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
298
298
  setActiveIndex(index);
299
299
  toValue.x = containerLayout.width * -1 * calcDelta;
300
300
  animate(toValue, index);
301
- if (onIndexChanged) onIndexChanged(calcDelta);
301
+ if (onIndexChanged) onIndexChanged(calcDelta, index);
302
302
  return calcDelta;
303
303
  }, [containerLayout.width, activeIndex, animate, children.length, onIndexChanged]);
304
304
  const fixOffsetAndGo = React.useCallback(delta => {
@@ -559,7 +559,7 @@ Carousel.propTypes = { ...selectedSystemPropTypes,
559
559
  * This function is also provided with a parameter indicating changed index (either 1, or -1)
560
560
  * Use it as follows:
561
561
  * ```js
562
- * const onIndexChangedCallback = React.useCallback((changedIndex) => {
562
+ * const onIndexChangedCallback = React.useCallback((changedIndex, currentActiveIndex) => {
563
563
  * console.log(changedIndex)
564
564
  * }, []) // pass local dependencies as per your component
565
565
  * <Carousel
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import View from "react-native-web/dist/exports/View";
4
4
  import Platform from "react-native-web/dist/exports/Platform";
5
- import { layoutTags, getA11yPropsFromHtmlTag, selectSystemProps, a11yProps, viewProps } from '../../utils';
5
+ import { layoutTags, getA11yPropsFromHtmlTag, selectSystemProps, a11yProps, viewProps, variantProp } from '../../utils';
6
6
  import { useCarousel } from '../CarouselContext';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
@@ -45,6 +45,7 @@ const CarouselItem = _ref => {
45
45
  };
46
46
 
47
47
  CarouselItem.propTypes = { ...selectedSystemPropTypes,
48
+ variant: variantProp.propType,
48
49
 
49
50
  /**
50
51
  * Index of the current slide
@@ -69,7 +70,12 @@ CarouselItem.propTypes = { ...selectedSystemPropTypes,
69
70
  * Carousel's innermost container defaults to `'ul'` which can be overridden. If the tag of either
70
71
  * `Carousel` or `Carousel.Item` is overriden, the other should be too, to avoid producing invalid HTML.
71
72
  */
72
- tag: PropTypes.oneOf(layoutTags)
73
+ tag: PropTypes.oneOf(layoutTags),
74
+
75
+ /**
76
+ * Function to set carousel content background color when slide is being display
77
+ */
78
+ setContentBackgroundColor: PropTypes.func
73
79
  };
74
80
  CarouselItem.displayName = 'Carousel.Item';
75
81
  export default CarouselItem;
@@ -1,12 +1,16 @@
1
- import React, { forwardRef, useRef } from 'react';
1
+ import React, { forwardRef, useEffect, useRef, useState } from 'react';
2
2
  import View from "react-native-web/dist/exports/View";
3
3
  import PropTypes from 'prop-types';
4
4
  import StackView from '../../StackView';
5
5
  import { useCarousel } from '../CarouselContext';
6
6
  import CarouselTabsPanelItem from './CarouselTabsPanelItem';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
- import { Fragment as _Fragment } from "react/jsx-runtime";
9
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
+
10
+ const selectTabPanelStyle = () => ({
11
+ backgroundColor: 'transparent'
12
+ });
13
+
10
14
  const CarouselTabsPanel = /*#__PURE__*/forwardRef((_ref, ref) => {
11
15
  let {
12
16
  items
@@ -16,15 +20,22 @@ const CarouselTabsPanel = /*#__PURE__*/forwardRef((_ref, ref) => {
16
20
  goTo
17
21
  } = useCarousel();
18
22
  const nextFocusRef = useRef();
19
- const firstTabRef = useRef(); // TODO: figure out a better cross-brand way to specify subcomponent variants.
23
+ const firstTabRef = useRef();
24
+ const [isInverse, setIsInverse] = useState(false); // TODO: figure out a better cross-brand way to specify subcomponent variants.
20
25
  // For now, this picks an Allium variant, and does nothing in brands that lack it.
21
26
  // See similar comment in Carousel and https://github.com/telus/universal-design-system/issues/1549
22
27
 
23
28
  const dividerVariant = {
24
29
  decorative: true
25
30
  };
26
- const lastTabSelected = activeIndex === items.length - 1;
27
- return /*#__PURE__*/_jsxs(_Fragment, {
31
+ const lastTabSelected = activeIndex === items.length - 1; // Get current select tab style
32
+
33
+ useEffect(() => {
34
+ const [selectedVariantIsInverse] = items.filter((_, index) => index === activeIndex);
35
+ setIsInverse(selectedVariantIsInverse === null || selectedVariantIsInverse === void 0 ? void 0 : selectedVariantIsInverse.inverse);
36
+ }, [items, activeIndex]);
37
+ return /*#__PURE__*/_jsxs(View, {
38
+ style: selectTabPanelStyle(),
28
39
  children: [/*#__PURE__*/_jsx(StackView, {
29
40
  direction: "row",
30
41
  space: 3,
@@ -36,6 +47,7 @@ const CarouselTabsPanel = /*#__PURE__*/forwardRef((_ref, ref) => {
36
47
  let {
37
48
  title,
38
49
  onPress,
50
+ inverse,
39
51
  ...panelItemProps
40
52
  } = _ref2;
41
53
  const selected = index === activeIndex;
@@ -50,6 +62,9 @@ const CarouselTabsPanel = /*#__PURE__*/forwardRef((_ref, ref) => {
50
62
  title: title,
51
63
  selected: selected,
52
64
  onPress: handlePress,
65
+ variant: {
66
+ inverse: isInverse
67
+ },
53
68
  ...panelItemProps
54
69
  }, title);
55
70
  })
@@ -62,6 +77,8 @@ const CarouselTabsPanel = /*#__PURE__*/forwardRef((_ref, ref) => {
62
77
  });
63
78
  CarouselTabsPanel.displayName = 'CarouselTabsPanel';
64
79
  CarouselTabsPanel.propTypes = {
65
- items: PropTypes.arrayOf(PropTypes.shape(CarouselTabsPanelItem.propTypes || {}))
80
+ items: PropTypes.arrayOf(PropTypes.shape(CarouselTabsPanelItem.propTypes || {})),
81
+ // Color defined by `Carousel.item` variant otherwise fallback to transparent
82
+ contentBackgroundColor: PropTypes.string
66
83
  };
67
84
  export default CarouselTabsPanel;
@@ -2,12 +2,11 @@ import React, { forwardRef, useContext } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Platform from "react-native-web/dist/exports/Platform";
4
4
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
- import View from "react-native-web/dist/exports/View";
6
5
  import { viewports } from '@telus-uds/system-constants';
7
6
  import GutterContext from '../providers/GutterContext';
8
7
  import { useViewport } from '../../ViewportProvider';
9
8
  import applyInheritance from '../helpers';
10
- import { responsiveProps } from '../../utils';
9
+ import { responsiveProps, BaseView } from '../../utils';
11
10
  import { jsx as _jsx } from "react/jsx-runtime";
12
11
  const Col = /*#__PURE__*/forwardRef((_ref, ref) => {
13
12
  let {
@@ -156,7 +155,7 @@ const Col = /*#__PURE__*/forwardRef((_ref, ref) => {
156
155
  lg: offsetsWithIheritance[3],
157
156
  xl: offsetsWithIheritance[4]
158
157
  };
159
- return /*#__PURE__*/_jsx(View, {
158
+ return /*#__PURE__*/_jsx(BaseView, {
160
159
  ref: ref,
161
160
  ...viewProps,
162
161
  style: [styles.col, gutterPadding, offsetStyles(offsets), sizeStyles(sizes), { ...hidingStyles
@@ -1,14 +1,13 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import View from "react-native-web/dist/exports/View";
4
3
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
4
  import { viewports } from '@telus-uds/system-constants';
5
+ import { a11yProps, viewProps, getA11yPropsFromHtmlTag, layoutTags, selectSystemProps, BaseView } from '../utils';
6
6
  import Row from './Row';
7
7
  import Col from './Col';
8
8
  import { useViewport } from '../ViewportProvider';
9
9
  import GutterContext from './providers/GutterContext';
10
10
  import applyInheritance from './helpers';
11
- import { a11yProps, viewProps, getA11yPropsFromHtmlTag, layoutTags, selectSystemProps } from '../utils';
12
11
  import { jsx as _jsx } from "react/jsx-runtime";
13
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
14
13
  /**
@@ -68,7 +67,7 @@ const FlexGrid = /*#__PURE__*/forwardRef((_ref, ref) => {
68
67
  };
69
68
  return /*#__PURE__*/_jsx(GutterContext.Provider, {
70
69
  value: gutter,
71
- children: /*#__PURE__*/_jsx(View, {
70
+ children: /*#__PURE__*/_jsx(BaseView, {
72
71
  ref: ref,
73
72
  ...props,
74
73
  style: [styles.grid, {
@@ -1,10 +1,10 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import View from "react-native-web/dist/exports/View";
4
3
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
4
  import { viewports } from '@telus-uds/system-constants';
6
5
  import { useViewport } from '../../ViewportProvider';
7
6
  import applyInheritance from '../helpers';
7
+ import { BaseView } from '../../utils';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
 
10
10
  const horizontalAlignStyles = horizontalAlign => {
@@ -114,7 +114,7 @@ const Row = /*#__PURE__*/forwardRef((_ref, ref) => {
114
114
  flexWrap = reverseLevel[4] ? 'wrap-reverse' : 'wrap';
115
115
  }
116
116
 
117
- return /*#__PURE__*/_jsx(View, {
117
+ return /*#__PURE__*/_jsx(BaseView, {
118
118
  ref: ref,
119
119
  ...rest,
120
120
  style: [styles.row, {