@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.
@@ -1,5 +1,6 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import View from "react-native-web/dist/exports/View";
3
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
3
4
  import PropTypes from 'prop-types';
4
5
  import { useThemeTokens } from '../ThemeProvider';
5
6
  import { a11yProps, getTokensPropType, selectSystemProps, useMultipleInputValues, variantProp, viewProps } from '../utils';
@@ -45,16 +46,19 @@ const ExpandCollapse = /*#__PURE__*/forwardRef((_ref, ref) => {
45
46
  });
46
47
  const themeTokens = useThemeTokens('ExpandCollapse', tokens, variant);
47
48
  return /*#__PURE__*/_jsx(View, {
49
+ style: staticStyles.container,
48
50
  ref: ref,
49
- style: selectBorderStyles(themeTokens),
50
51
  ...selectProps(rest),
51
- children: typeof children === 'function' ? children({
52
- openIds,
53
- onToggle,
54
- resetValues,
55
- setValues,
56
- unsetValues
57
- }) : children
52
+ children: /*#__PURE__*/_jsx(View, {
53
+ style: selectBorderStyles(themeTokens),
54
+ children: typeof children === 'function' ? children({
55
+ openIds,
56
+ onToggle,
57
+ resetValues,
58
+ setValues,
59
+ unsetValues
60
+ }) : children
61
+ })
58
62
  });
59
63
  });
60
64
  ExpandCollapse.displayName = 'ExpandCollapse';
@@ -86,4 +90,9 @@ ExpandCollapse.propTypes = {
86
90
  */
87
91
  initialOpen: PropTypes.arrayOf(PropTypes.string)
88
92
  };
89
- export default ExpandCollapse;
93
+ export default ExpandCollapse;
94
+ const staticStyles = StyleSheet.create({
95
+ container: {
96
+ display: 'flex'
97
+ }
98
+ });
@@ -7,7 +7,8 @@ import PropTypes from 'prop-types';
7
7
  import ABBPropTypes from 'airbnb-prop-types';
8
8
  import ExpandCollapseControl from './Control';
9
9
  import { useThemeTokens } from '../ThemeProvider';
10
- import { a11yProps, getTokensPropType, selectSystemProps, useVerticalExpandAnimation, variantProp, viewProps } from '../utils';
10
+ import { a11yProps, getTokensPropType, selectSystemProps, useVerticalExpandAnimation, variantProp, viewProps, useCopy } from '../utils';
11
+ import dictionary from './dictionary';
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
14
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
@@ -100,10 +101,15 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref5, ref) => {
100
101
  variant,
101
102
  controlRef,
102
103
  content,
104
+ copy = 'en',
103
105
  ...rest
104
106
  } = _ref5;
105
107
  const [containerHeight, setContainerHeight] = useState(null);
106
108
  const isExpanded = openIds.includes(panelId);
109
+ const getCopy = useCopy({
110
+ dictionary,
111
+ copy
112
+ });
107
113
  const selectedProps = selectProps({
108
114
  ...rest,
109
115
  accessibilityState: {
@@ -134,15 +140,20 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref5, ref) => {
134
140
  tokens: themeTokens
135
141
  });
136
142
  const focusabilityProps = isExpanded ? {} : a11yProps.nonFocusableProps;
143
+ const panelAccessibilityLabel = `${panelId} ${getCopy('panel')}`;
144
+ const subPanelAccessibilityLabel = `${panelId} ${getCopy('subPanel')}`;
137
145
  return content ? /*#__PURE__*/_jsx(View, {
138
146
  style: selectContentPanelStyles(themeTokens),
147
+ accessibilityLabel: panelAccessibilityLabel,
139
148
  children: typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
140
149
  style: selectTextStyles(themeTokens),
150
+ accessibilityLabel: subPanelAccessibilityLabel,
141
151
  children: children
142
152
  }) : children
143
153
  }) : /*#__PURE__*/_jsxs(View, {
144
154
  ref: ref,
145
155
  style: themeTokens,
156
+ accessibilityLabel: panelAccessibilityLabel,
146
157
  children: [/*#__PURE__*/_jsx(View, {
147
158
  style: selectControlPanelStyles(themeTokens),
148
159
  children: /*#__PURE__*/_jsx(ExpandCollapseControl, {
@@ -177,6 +188,7 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref5, ref) => {
177
188
  },
178
189
  children: /*#__PURE__*/_jsx(View, {
179
190
  style: selectContainerStyles(themeTokens),
191
+ accessibilityLabel: subPanelAccessibilityLabel,
180
192
  children: children
181
193
  })
182
194
  })
@@ -0,0 +1,10 @@
1
+ export default {
2
+ en: {
3
+ panel: 'Panel',
4
+ subPanel: 'SubPanel'
5
+ },
6
+ fr: {
7
+ panel: 'Panneau',
8
+ subPanel: 'Sous-Panneau'
9
+ }
10
+ };
@@ -41,10 +41,10 @@ const IconText = /*#__PURE__*/forwardRef((_ref, ref) => {
41
41
  * The issue was mainly on IOS, the translateY style didn't match with the old calculations.
42
42
  */
43
43
  const resultY = valueTranslateY ? Math.floor(-1 * (valueTranslateY - 4)) : 0;
44
- const iconAdjustedAndriod = /*#__PURE__*/_jsx(View, {
44
+ const iconAdjustedAndroid = /*#__PURE__*/_jsx(View, {
45
45
  style: {
46
46
  transform: [{
47
- translateY: size * 0.2
47
+ translateY: valueTranslateY ? size * 0.2 : size * 0.01
48
48
  }]
49
49
  },
50
50
  children: iconContent
@@ -57,7 +57,7 @@ const IconText = /*#__PURE__*/forwardRef((_ref, ref) => {
57
57
  },
58
58
  children: iconContent
59
59
  });
60
- const mobile = Platform.OS === 'android' ? iconAdjustedAndriod : iconAdjustedIOS;
60
+ const mobile = Platform.OS === 'android' ? iconAdjustedAndroid : iconAdjustedIOS;
61
61
  const adjustedContainer = Platform.OS === 'web' ? iconContent : mobile;
62
62
  return getStackedContent(iconPosition === 'left' ? [adjustedContainer, children] : [children, adjustedContainer], {
63
63
  space,
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react';
1
+ import React, { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import View from "react-native-web/dist/exports/View";
4
4
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
@@ -19,7 +19,7 @@ const styles = StyleSheet.create({
19
19
  }
20
20
  });
21
21
  const getInitialOpen = (items, selectedId) => items.filter(item => item.items && item.items.some(nestedItem => (nestedItem.id ?? nestedItem.label) === selectedId)).map(item => item.id ?? item.label);
22
- const Listbox = _ref => {
22
+ const Listbox = /*#__PURE__*/forwardRef((_ref, ref) => {
23
23
  let {
24
24
  items = [],
25
25
  firstItemRef = null,
@@ -98,6 +98,7 @@ const Listbox = _ref => {
98
98
  children: /*#__PURE__*/_jsx(ExpandCollapse, {
99
99
  initialOpen: initialOpen,
100
100
  maxOpen: 1,
101
+ ref: ref,
101
102
  children: expandProps => /*#__PURE__*/_jsx(View, {
102
103
  style: [styles.list, {
103
104
  minHeight,
@@ -113,9 +114,9 @@ const Listbox = _ref => {
113
114
  const itemId = id ?? label;
114
115
 
115
116
  // Give the list of refs.
116
- const itemRef = ref => {
117
- itemRefs.current[index] = ref;
118
- return ref;
117
+ const itemRef = currentItemRef => {
118
+ itemRefs.current[index] = currentItemRef;
119
+ return currentItemRef;
119
120
  };
120
121
  return nestedItems ? /*#__PURE__*/_createElement(ListboxGroup, {
121
122
  ...item,
@@ -140,7 +141,8 @@ const Listbox = _ref => {
140
141
  })
141
142
  })
142
143
  });
143
- };
144
+ });
145
+ Listbox.displayName = 'Listbox';
144
146
  Listbox.propTypes = {
145
147
  ...withLinkRouter.propTypes,
146
148
  tokens: getTokensPropType('Listbox'),
@@ -24,6 +24,7 @@ const WebModal = _ref => {
24
24
  ...selectProps(rest),
25
25
  children: /*#__PURE__*/_jsx(View, {
26
26
  style: staticStyles.content,
27
+ accessibilityRole: "dialog",
27
28
  children: children
28
29
  })
29
30
  });
@@ -52,14 +53,15 @@ const staticStyles = StyleSheet.create({
52
53
  minHeight: 0,
53
54
  minWidth: 0,
54
55
  padding: 0,
55
- textDecoration: 'none',
56
- zIndex: 1
56
+ textDecorationLine: 'none',
57
+ zIndex: 1000
57
58
  },
58
59
  content: {
59
60
  flex: 1,
60
61
  flexGrow: 1,
61
62
  flexShrink: 1,
62
- flexBasis: 0
63
+ flexBasis: 0,
64
+ zIndex: 1000
63
65
  }
64
66
  });
65
67
  export default WebModal;
@@ -64,7 +64,7 @@ const selectDismissButtonContainerStyles = _ref4 => {
64
64
  };
65
65
  };
66
66
  const selectContentContainerStyle = maxWidth => ({
67
- width: maxWidth || '100%'
67
+ maxWidth: maxWidth || '100%'
68
68
  });
69
69
  const getMediaQueryStyles = (themeTokens, themeOptions, viewport, mediaIdsRef, dismissible) => {
70
70
  const transformedSelectContainerStyles = Object.entries(themeTokens).reduce((acc, _ref5) => {
@@ -240,7 +240,7 @@ Radio.propTypes = {
240
240
  /**
241
241
  * The label.
242
242
  */
243
- label: PropTypes.string,
243
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
244
244
  /**
245
245
  * Associate this radio button with a group (set as the name attribute).
246
246
  */
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "@floating-ui/react-native": "^0.8.1",
12
12
  "@gorhom/portal": "^1.0.14",
13
13
  "@telus-uds/system-constants": "^1.3.0",
14
- "@telus-uds/system-theme-tokens": "^2.54.0",
14
+ "@telus-uds/system-theme-tokens": "^2.55.0",
15
15
  "airbnb-prop-types": "^2.16.0",
16
16
  "css-mediaquery": "^0.1.2",
17
17
  "expo-linear-gradient": "^12.5.0",
@@ -85,6 +85,6 @@
85
85
  "standard-engine": {
86
86
  "skip": true
87
87
  },
88
- "version": "1.82.0",
88
+ "version": "1.84.0",
89
89
  "types": "types/index.d.ts"
90
90
  }
@@ -34,6 +34,7 @@ const ButtonGroup = forwardRef(
34
34
  (
35
35
  {
36
36
  variant,
37
+ buttonVariant,
37
38
  tokens,
38
39
  items = [],
39
40
  values,
@@ -140,6 +141,7 @@ const ButtonGroup = forwardRef(
140
141
  <ButtonBase
141
142
  ref={itemRef}
142
143
  key={id}
144
+ variant={buttonVariant}
143
145
  {...pressHandlers}
144
146
  onPress={handlePress}
145
147
  tokens={getButtonTokens}
@@ -167,6 +169,13 @@ ButtonGroup.displayName = 'ButtonGroup'
167
169
  ButtonGroup.propTypes = {
168
170
  ...selectedSystemPropTypes,
169
171
  tokens: getTokensPropType('ButtonGroup'),
172
+ /**
173
+ * To allow Button specific variant
174
+ */
175
+ buttonVariant: variantProp.propType,
176
+ /**
177
+ * Default variant prop
178
+ */
170
179
  variant: variantProp.propType,
171
180
  /**
172
181
  * The maximum number of items a user may select at once. Defaults to 1 and behaves