@telus-uds/components-base 1.82.0 → 1.84.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.
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
9
+ var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
9
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
11
  var _ThemeProvider = require("../ThemeProvider");
11
12
  var _utils = require("../utils");
@@ -54,16 +55,19 @@ const ExpandCollapse = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
54
55
  });
55
56
  const themeTokens = (0, _ThemeProvider.useThemeTokens)('ExpandCollapse', tokens, variant);
56
57
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
58
+ style: staticStyles.container,
57
59
  ref: ref,
58
- style: selectBorderStyles(themeTokens),
59
60
  ...selectProps(rest),
60
- children: typeof children === 'function' ? children({
61
- openIds,
62
- onToggle,
63
- resetValues,
64
- setValues,
65
- unsetValues
66
- }) : children
61
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
62
+ style: selectBorderStyles(themeTokens),
63
+ children: typeof children === 'function' ? children({
64
+ openIds,
65
+ onToggle,
66
+ resetValues,
67
+ setValues,
68
+ unsetValues
69
+ }) : children
70
+ })
67
71
  });
68
72
  });
69
73
  ExpandCollapse.displayName = 'ExpandCollapse';
@@ -96,4 +100,9 @@ ExpandCollapse.propTypes = {
96
100
  initialOpen: _propTypes.default.arrayOf(_propTypes.default.string)
97
101
  };
98
102
  var _default = ExpandCollapse;
99
- exports.default = _default;
103
+ exports.default = _default;
104
+ const staticStyles = _StyleSheet.default.create({
105
+ container: {
106
+ display: 'flex'
107
+ }
108
+ });
@@ -14,6 +14,7 @@ var _airbnbPropTypes = _interopRequireDefault(require("airbnb-prop-types"));
14
14
  var _Control = _interopRequireDefault(require("./Control"));
15
15
  var _ThemeProvider = require("../ThemeProvider");
16
16
  var _utils = require("../utils");
17
+ var _dictionary = _interopRequireDefault(require("./dictionary"));
17
18
  var _jsxRuntime = require("react/jsx-runtime");
18
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
20
  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); }
@@ -108,10 +109,15 @@ const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) =>
108
109
  variant,
109
110
  controlRef,
110
111
  content,
112
+ copy = 'en',
111
113
  ...rest
112
114
  } = _ref5;
113
115
  const [containerHeight, setContainerHeight] = (0, _react.useState)(null);
114
116
  const isExpanded = openIds.includes(panelId);
117
+ const getCopy = (0, _utils.useCopy)({
118
+ dictionary: _dictionary.default,
119
+ copy
120
+ });
115
121
  const selectedProps = selectProps({
116
122
  ...rest,
117
123
  accessibilityState: {
@@ -142,15 +148,20 @@ const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) =>
142
148
  tokens: themeTokens
143
149
  });
144
150
  const focusabilityProps = isExpanded ? {} : _utils.a11yProps.nonFocusableProps;
151
+ const panelAccessibilityLabel = `${panelId} ${getCopy('panel')}`;
152
+ const subPanelAccessibilityLabel = `${panelId} ${getCopy('subPanel')}`;
145
153
  return content ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
146
154
  style: selectContentPanelStyles(themeTokens),
155
+ accessibilityLabel: panelAccessibilityLabel,
147
156
  children: typeof children === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
148
157
  style: selectTextStyles(themeTokens),
158
+ accessibilityLabel: subPanelAccessibilityLabel,
149
159
  children: children
150
160
  }) : children
151
161
  }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
152
162
  ref: ref,
153
163
  style: themeTokens,
164
+ accessibilityLabel: panelAccessibilityLabel,
154
165
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
155
166
  style: selectControlPanelStyles(themeTokens),
156
167
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Control.default, {
@@ -185,6 +196,7 @@ const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) =>
185
196
  },
186
197
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
187
198
  style: selectContainerStyles(themeTokens),
199
+ accessibilityLabel: subPanelAccessibilityLabel,
188
200
  children: children
189
201
  })
190
202
  })
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {
8
+ en: {
9
+ panel: 'Panel',
10
+ subPanel: 'SubPanel'
11
+ },
12
+ fr: {
13
+ panel: 'Panneau',
14
+ subPanel: 'Sous-Panneau'
15
+ }
16
+ };
17
+ exports.default = _default;
@@ -48,10 +48,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
48
48
  * The issue was mainly on IOS, the translateY style didn't match with the old calculations.
49
49
  */
50
50
  const resultY = valueTranslateY ? Math.floor(-1 * (valueTranslateY - 4)) : 0;
51
- const iconAdjustedAndriod = /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
51
+ const iconAdjustedAndroid = /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
52
52
  style: {
53
53
  transform: [{
54
- translateY: size * 0.2
54
+ translateY: valueTranslateY ? size * 0.2 : size * 0.01
55
55
  }]
56
56
  },
57
57
  children: iconContent
@@ -64,7 +64,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
64
64
  },
65
65
  children: iconContent
66
66
  });
67
- const mobile = _Platform.default.OS === 'android' ? iconAdjustedAndriod : iconAdjustedIOS;
67
+ const mobile = _Platform.default.OS === 'android' ? iconAdjustedAndroid : iconAdjustedIOS;
68
68
  const adjustedContainer = _Platform.default.OS === 'web' ? iconContent : mobile;
69
69
  return (0, _StackView.getStackedContent)(iconPosition === 'left' ? [adjustedContainer, children] : [children, adjustedContainer], {
70
70
  space,
@@ -27,7 +27,7 @@ const styles = _StyleSheet.default.create({
27
27
  }
28
28
  });
29
29
  const getInitialOpen = (items, selectedId) => items.filter(item => item.items && item.items.some(nestedItem => (nestedItem.id ?? nestedItem.label) === selectedId)).map(item => item.id ?? item.label);
30
- const Listbox = _ref => {
30
+ const Listbox = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
31
31
  let {
32
32
  items = [],
33
33
  firstItemRef = null,
@@ -106,6 +106,7 @@ const Listbox = _ref => {
106
106
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandCollapse.default, {
107
107
  initialOpen: initialOpen,
108
108
  maxOpen: 1,
109
+ ref: ref,
109
110
  children: expandProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
110
111
  style: [styles.list, {
111
112
  minHeight,
@@ -121,9 +122,9 @@ const Listbox = _ref => {
121
122
  const itemId = id ?? label;
122
123
 
123
124
  // Give the list of refs.
124
- const itemRef = ref => {
125
- itemRefs.current[index] = ref;
126
- return ref;
125
+ const itemRef = currentItemRef => {
126
+ itemRefs.current[index] = currentItemRef;
127
+ return currentItemRef;
127
128
  };
128
129
  return nestedItems ? /*#__PURE__*/(0, _react.createElement)(_ListboxGroup.default, {
129
130
  ...item,
@@ -148,7 +149,8 @@ const Listbox = _ref => {
148
149
  })
149
150
  })
150
151
  });
151
- };
152
+ });
153
+ Listbox.displayName = 'Listbox';
152
154
  Listbox.propTypes = {
153
155
  ..._utils.withLinkRouter.propTypes,
154
156
  tokens: (0, _utils.getTokensPropType)('Listbox'),
@@ -31,6 +31,7 @@ const WebModal = _ref => {
31
31
  ...selectProps(rest),
32
32
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
33
33
  style: staticStyles.content,
34
+ accessibilityRole: "dialog",
34
35
  children: children
35
36
  })
36
37
  });
@@ -59,14 +60,15 @@ const staticStyles = _StyleSheet.default.create({
59
60
  minHeight: 0,
60
61
  minWidth: 0,
61
62
  padding: 0,
62
- textDecoration: 'none',
63
- zIndex: 1
63
+ textDecorationLine: 'none',
64
+ zIndex: 1000
64
65
  },
65
66
  content: {
66
67
  flex: 1,
67
68
  flexGrow: 1,
68
69
  flexShrink: 1,
69
- flexBasis: 0
70
+ flexBasis: 0,
71
+ zIndex: 1000
70
72
  }
71
73
  });
72
74
  var _default = WebModal;
@@ -72,7 +72,7 @@ const selectDismissButtonContainerStyles = _ref4 => {
72
72
  };
73
73
  };
74
74
  const selectContentContainerStyle = maxWidth => ({
75
- width: maxWidth || '100%'
75
+ maxWidth: maxWidth || '100%'
76
76
  });
77
77
  const getMediaQueryStyles = (themeTokens, themeOptions, viewport, mediaIdsRef, dismissible) => {
78
78
  const transformedSelectContainerStyles = Object.entries(themeTokens).reduce((acc, _ref5) => {
@@ -248,7 +248,7 @@ Radio.propTypes = {
248
248
  /**
249
249
  * The label.
250
250
  */
251
- label: _propTypes.default.string,
251
+ label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
252
252
  /**
253
253
  * Associate this radio button with a group (set as the name attribute).
254
254
  */
@@ -15,6 +15,7 @@ const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, f
15
15
  const ButtonGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
16
16
  let {
17
17
  variant,
18
+ buttonVariant,
18
19
  tokens,
19
20
  items = [],
20
21
  values,
@@ -127,6 +128,7 @@ const ButtonGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
127
128
  // "radio" if it's a direct child of "radiogroup", even if aria-posinset etc exists
128
129
  return /*#__PURE__*/_jsx(ButtonBase, {
129
130
  ref: itemRef,
131
+ variant: buttonVariant,
130
132
  ...pressHandlers,
131
133
  onPress: handlePress,
132
134
  tokens: getButtonTokens,
@@ -148,6 +150,13 @@ ButtonGroup.displayName = 'ButtonGroup';
148
150
  ButtonGroup.propTypes = {
149
151
  ...selectedSystemPropTypes,
150
152
  tokens: getTokensPropType('ButtonGroup'),
153
+ /**
154
+ * To allow Button specific variant
155
+ */
156
+ buttonVariant: variantProp.propType,
157
+ /**
158
+ * Default variant prop
159
+ */
151
160
  variant: variantProp.propType,
152
161
  /**
153
162
  * The maximum number of items a user may select at once. Defaults to 1 and behaves