@telus-uds/components-base 0.0.2-prerelease.6 → 0.0.2-prerelease.7

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 (155) hide show
  1. package/.ultra.cache.json +1 -1
  2. package/CHANGELOG.md +20 -0
  3. package/__fixtures__/testTheme.js +424 -37
  4. package/__tests__/Button/ButtonBase.test.jsx +2 -31
  5. package/__tests__/Checkbox/Checkbox.test.jsx +94 -0
  6. package/__tests__/InputSupports/InputSupports.test.jsx +50 -0
  7. package/__tests__/List/List.test.jsx +60 -0
  8. package/__tests__/Radio/Radio.test.jsx +87 -0
  9. package/__tests__/Select/Select.test.jsx +93 -0
  10. package/__tests__/Skeleton/Skeleton.test.jsx +61 -0
  11. package/__tests__/Tags/Tags.test.jsx +328 -0
  12. package/__tests__/TextInput/TextArea.test.jsx +34 -0
  13. package/__tests__/TextInput/{TextInput.test.jsx → TextInputBase.test.jsx} +20 -46
  14. package/jest.config.js +3 -1
  15. package/lib/Button/Button.js +10 -3
  16. package/lib/Button/ButtonBase.js +73 -59
  17. package/lib/Button/ButtonGroup.js +11 -27
  18. package/lib/Button/ButtonLink.js +5 -0
  19. package/lib/Checkbox/Checkbox.js +308 -0
  20. package/lib/Checkbox/CheckboxInput.native.js +6 -0
  21. package/lib/Checkbox/CheckboxInput.web.js +57 -0
  22. package/lib/Checkbox/index.js +2 -0
  23. package/lib/Feedback/Feedback.js +20 -3
  24. package/lib/Icon/Icon.js +8 -5
  25. package/lib/Icon/IconText.js +72 -0
  26. package/lib/Icon/index.js +2 -1
  27. package/lib/InputSupports/InputSupports.js +90 -0
  28. package/lib/InputSupports/index.js +2 -0
  29. package/lib/InputSupports/propTypes.js +55 -0
  30. package/lib/Link/ChevronLink.js +23 -20
  31. package/lib/Link/InlinePressable.native.js +78 -0
  32. package/lib/Link/InlinePressable.web.js +32 -0
  33. package/lib/Link/Link.js +11 -10
  34. package/lib/Link/LinkBase.js +62 -123
  35. package/lib/Link/TextButton.js +20 -9
  36. package/lib/Link/index.js +2 -1
  37. package/lib/List/List.js +52 -0
  38. package/lib/List/ListItem.js +207 -0
  39. package/lib/List/index.js +2 -0
  40. package/lib/Pagination/PageButton.js +2 -25
  41. package/lib/Pagination/SideButton.js +27 -37
  42. package/lib/Radio/Radio.js +291 -0
  43. package/lib/Radio/RadioInput.native.js +6 -0
  44. package/lib/Radio/RadioInput.web.js +59 -0
  45. package/lib/Radio/index.js +2 -0
  46. package/lib/Select/Group.native.js +14 -0
  47. package/lib/Select/Group.web.js +18 -0
  48. package/lib/Select/Item.native.js +9 -0
  49. package/lib/Select/Item.web.js +15 -0
  50. package/lib/Select/Picker.native.js +87 -0
  51. package/lib/Select/Picker.web.js +63 -0
  52. package/lib/Select/Select.js +272 -0
  53. package/lib/Select/index.js +6 -0
  54. package/lib/Skeleton/Skeleton.js +119 -0
  55. package/lib/Skeleton/index.js +2 -0
  56. package/lib/Tags/Tags.js +217 -0
  57. package/lib/Tags/index.js +2 -0
  58. package/lib/TextInput/TextArea.js +82 -0
  59. package/lib/TextInput/TextInput.js +23 -304
  60. package/lib/TextInput/TextInputBase.js +229 -0
  61. package/lib/TextInput/index.js +2 -1
  62. package/lib/TextInput/propTypes.js +31 -0
  63. package/lib/ThemeProvider/useThemeTokens.js +54 -3
  64. package/lib/ToggleSwitch/ToggleSwitch.js +1 -1
  65. package/lib/Typography/Typography.js +4 -19
  66. package/lib/index.js +8 -1
  67. package/lib/utils/a11y/index.js +1 -0
  68. package/lib/utils/a11y/textSize.js +33 -0
  69. package/lib/utils/index.js +3 -0
  70. package/lib/utils/info/index.js +7 -0
  71. package/lib/utils/info/platform/index.js +11 -0
  72. package/lib/utils/info/platform/platform.android.js +1 -0
  73. package/lib/utils/info/platform/platform.ios.js +1 -0
  74. package/lib/utils/info/platform/platform.native.js +4 -0
  75. package/lib/utils/info/platform/platform.web.js +1 -0
  76. package/lib/utils/info/versions.js +5 -0
  77. package/lib/utils/pressability.js +92 -0
  78. package/lib/utils/propTypes.js +78 -17
  79. package/package.json +5 -4
  80. package/release-context.json +4 -4
  81. package/src/Button/Button.jsx +6 -3
  82. package/src/Button/ButtonBase.jsx +66 -57
  83. package/src/Button/ButtonGroup.jsx +9 -22
  84. package/src/Button/ButtonLink.jsx +11 -2
  85. package/src/Checkbox/Checkbox.jsx +275 -0
  86. package/src/Checkbox/CheckboxInput.native.jsx +6 -0
  87. package/src/Checkbox/CheckboxInput.web.jsx +55 -0
  88. package/src/Checkbox/index.js +3 -0
  89. package/src/Feedback/Feedback.jsx +13 -4
  90. package/src/Icon/Icon.jsx +9 -5
  91. package/src/Icon/IconText.jsx +63 -0
  92. package/src/Icon/index.js +2 -1
  93. package/src/InputSupports/InputSupports.jsx +86 -0
  94. package/src/InputSupports/index.js +3 -0
  95. package/src/InputSupports/propTypes.js +44 -0
  96. package/src/Link/ChevronLink.jsx +20 -17
  97. package/src/Link/InlinePressable.native.jsx +73 -0
  98. package/src/Link/InlinePressable.web.jsx +37 -0
  99. package/src/Link/Link.jsx +17 -13
  100. package/src/Link/LinkBase.jsx +57 -140
  101. package/src/Link/TextButton.jsx +25 -11
  102. package/src/Link/index.js +2 -1
  103. package/src/List/List.jsx +47 -0
  104. package/src/List/ListItem.jsx +187 -0
  105. package/src/List/index.js +3 -0
  106. package/src/Pagination/PageButton.jsx +2 -16
  107. package/src/Pagination/SideButton.jsx +23 -34
  108. package/src/Radio/Radio.jsx +270 -0
  109. package/src/Radio/RadioInput.native.jsx +6 -0
  110. package/src/Radio/RadioInput.web.jsx +57 -0
  111. package/src/Radio/index.js +3 -0
  112. package/src/Select/Group.native.jsx +14 -0
  113. package/src/Select/Group.web.jsx +15 -0
  114. package/src/Select/Item.native.jsx +10 -0
  115. package/src/Select/Item.web.jsx +11 -0
  116. package/src/Select/Picker.native.jsx +95 -0
  117. package/src/Select/Picker.web.jsx +67 -0
  118. package/src/Select/Select.jsx +265 -0
  119. package/src/Select/index.js +8 -0
  120. package/src/Skeleton/Skeleton.jsx +101 -0
  121. package/src/Skeleton/index.js +3 -0
  122. package/src/Tags/Tags.jsx +206 -0
  123. package/src/Tags/index.js +3 -0
  124. package/src/TextInput/TextArea.jsx +78 -0
  125. package/src/TextInput/TextInput.jsx +17 -284
  126. package/src/TextInput/TextInputBase.jsx +220 -0
  127. package/src/TextInput/index.js +2 -1
  128. package/src/TextInput/propTypes.js +29 -0
  129. package/src/ThemeProvider/useThemeTokens.js +54 -3
  130. package/src/ToggleSwitch/ToggleSwitch.jsx +1 -1
  131. package/src/Typography/Typography.jsx +4 -15
  132. package/src/index.js +8 -1
  133. package/src/utils/a11y/index.js +1 -0
  134. package/src/utils/a11y/textSize.js +30 -0
  135. package/src/utils/index.js +3 -0
  136. package/src/utils/info/index.js +8 -0
  137. package/src/utils/info/platform/index.js +11 -0
  138. package/src/utils/info/platform/platform.android.js +1 -0
  139. package/src/utils/info/platform/platform.ios.js +1 -0
  140. package/src/utils/info/platform/platform.native.js +4 -0
  141. package/src/utils/info/platform/platform.web.js +1 -0
  142. package/src/utils/info/versions.js +6 -0
  143. package/src/utils/pressability.js +92 -0
  144. package/src/utils/propTypes.js +97 -22
  145. package/stories/Button/Button.stories.jsx +5 -0
  146. package/stories/Checkbox/Checkbox.stories.jsx +71 -0
  147. package/stories/Feedback/Feedback.stories.jsx +5 -6
  148. package/stories/Link/Link.stories.jsx +15 -1
  149. package/stories/List/List.stories.jsx +117 -0
  150. package/stories/Radio/Radio.stories.jsx +113 -0
  151. package/stories/Select/Select.stories.jsx +55 -0
  152. package/stories/Skeleton/Skeleton.stories.jsx +36 -0
  153. package/stories/Tags/Tags.stories.jsx +69 -0
  154. package/stories/TextInput/TextArea.stories.jsx +100 -0
  155. package/stories/supports.jsx +1 -1
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Platform, Text, View } from 'react-native';
3
+ import { Text, View } from 'react-native';
4
4
  import { useThemeTokens } from '../ThemeProvider';
5
5
  import { useViewport } from '../ViewportProvider';
6
6
  import { applyTextStyles } from '../ThemeProvider/utils';
7
- import { a11yProps, variantProp, getTokensPropType } from '../utils/propTypes';
7
+ import { a11yProps, variantProp, getTokensPropType, getMaxFontMultiplier } from '../utils';
8
8
  /**
9
9
  * If passed a string like 'h1', 'h2' etc, returns the heading number as a string,
10
10
  * else returns false
@@ -14,21 +14,6 @@ function getHeadingLevel(heading) {
14
14
  const match = typeof heading === 'string' && heading.match(/^h(\d)$/);
15
15
  return match && match[1];
16
16
  }
17
- /**
18
- * Enforces `fontScaleCap` theme tokens as the maximum font size text can become
19
- * after iOS or Android font scaling, to give consistent accessible maximum sizes
20
- * that don't make the content unusable
21
- */
22
-
23
-
24
- function getMaxFontMultiplier({
25
- fontSize,
26
- fontScaleCap
27
- }) {
28
- if (!fontScaleCap || !fontSize) return undefined;
29
- if (fontScaleCap <= fontSize) return 1;
30
- return fontScaleCap / fontSize;
31
- }
32
17
 
33
18
  const selectTextStyles = ({
34
19
  fontWeight,
@@ -66,9 +51,9 @@ const Typography = ({
66
51
  const textProps = {
67
52
  style: selectTextStyles(align ? { ...themeTokens,
68
53
  textAlign: align
69
- } : themeTokens)
54
+ } : themeTokens),
55
+ maxFontSizeMultiplier: getMaxFontMultiplier(themeTokens)
70
56
  };
71
- if (Platform.OS !== 'web') textProps.maxFontSizeMultiplier = getMaxFontMultiplier(themeTokens);
72
57
  const headingLevel = getHeadingLevel(heading);
73
58
  const a11y = { ...a11yProps.select(rest),
74
59
  accessibilityRole,
package/lib/index.js CHANGED
@@ -1,7 +1,9 @@
1
+ export { default as A11yText } from './A11yText';
1
2
  export { default as ActivityIndicator } from './ActivityIndicator';
2
3
  export { default as Box } from './Box';
3
4
  export * from './Button';
4
5
  export { default as Card } from './Card';
6
+ export { default as Checkbox } from './Checkbox';
5
7
  export { default as Divider } from './Divider';
6
8
  export { default as ExpandCollapse, Accordion } from './ExpandCollapse';
7
9
  export { default as Feedback } from './Feedback';
@@ -9,12 +11,17 @@ export { default as FlexGrid } from './FlexGrid';
9
11
  export { default as Icon } from './Icon';
10
12
  export * from './Icon';
11
13
  export * from './Link';
14
+ export { default as List } from './List';
12
15
  export { default as Pagination } from './Pagination';
16
+ export { default as Radio } from './Radio';
17
+ export { default as Select } from './Select';
13
18
  export { default as SideNav } from './SideNav';
19
+ export { default as Skeleton } from './Skeleton';
14
20
  export { default as Spacer } from './Spacer';
15
21
  export { default as StackView } from './StackView';
16
22
  export * from './StackView';
17
- export { default as TextInput } from './TextInput';
23
+ export { default as Tags } from './Tags';
24
+ export * from './TextInput';
18
25
  export { default as ToggleSwitch } from './ToggleSwitch';
19
26
  export { default as Tooltip } from './Tooltip';
20
27
  export { default as TooltipButton } from './TooltipButton';
@@ -0,0 +1 @@
1
+ export * from './textSize';
@@ -0,0 +1,33 @@
1
+ import { PixelRatio, Platform } from 'react-native';
2
+ /**
3
+ * When a user increases text size using device accessibility settings, some elements
4
+ * should also scale, such as icons alongside text and space between paragraphs.
5
+ *
6
+ * @param {number} [value] - the value to multiply; defaults to system default font size
7
+ * @param {number} [maxScale] - the maximum multiplier to apply; defaults to no maximum
8
+ */
9
+
10
+ export const scaleWithText = (value, maxScale = Infinity) => {
11
+ if (!value) return value;
12
+ const scale = Math.min(PixelRatio.getFontScale(), maxScale) || 1;
13
+ return value * scale;
14
+ };
15
+ /**
16
+ * Native only, returns `undefined` on Web.
17
+ *
18
+ * Enforces `fontScaleCap` theme tokens as the maximum font size text can become
19
+ * after iOS or Android font scaling, to give consistent accessible maximum sizes
20
+ * that don't make the content unusable.
21
+ *
22
+ * The return value of this function can be used as a React Native `Text` element's
23
+ * `maxFontSizeMultiplier` prop value.
24
+ */
25
+
26
+ export const getMaxFontMultiplier = ({
27
+ fontSize,
28
+ fontScaleCap
29
+ }) => {
30
+ if (Platform.OS === 'web' || !fontScaleCap || !fontSize) return undefined;
31
+ if (fontScaleCap <= fontSize) return 1;
32
+ return fontScaleCap / fontSize;
33
+ };
@@ -1,6 +1,9 @@
1
+ export * from './a11y';
1
2
  export * from './animation';
2
3
  export * from './input';
4
+ export * from './pressability';
3
5
  export * from './propTypes';
6
+ export { default as info } from './info';
4
7
  export { default as useSpacingScale } from './useSpacingScale';
5
8
  export { default as useResponsiveProp } from './useResponsiveProp';
6
9
  export * from './useResponsiveProp';
@@ -0,0 +1,7 @@
1
+ import platform from './platform';
2
+ import versions from './versions'; // export an object accessed like info.platform.OS, info.version.uds, etc
3
+
4
+ export default {
5
+ platform,
6
+ versions
7
+ };
@@ -0,0 +1,11 @@
1
+ import { Platform } from 'react-native';
2
+ import fileSuffix from './platform'; // Allows consuming libraries that might not have a direct dependency on
3
+ // React Native to check what the current platform is.
4
+ // Particularly useful for validating Jest config: it is possible for Jest to
5
+ // get configured such that Platform.OS returns a different mocked value to the
6
+ // OS being used to select files by platform suffix (e.g. .web, .native).
7
+
8
+ export default {
9
+ OS: Platform.OS,
10
+ fileSuffix
11
+ };
@@ -0,0 +1 @@
1
+ export default '.android';
@@ -0,0 +1 @@
1
+ export default '.ios';
@@ -0,0 +1,4 @@
1
+ // This shouldn't ever be chosen, as the more specific '.ios' and '.android' are available.
2
+ // If this gets picked, either an unsupported React Native platform is being used somehow
3
+ // (e.g. a native Windows app), or there's a serious config problem somewhere.
4
+ export default '.native';
@@ -0,0 +1 @@
1
+ export default '.web';
@@ -0,0 +1,5 @@
1
+ import { version } from '../../../package.json'; // Add more versions if they are useful e.g. theme schema version
2
+
3
+ export default {
4
+ uds: version
5
+ };
@@ -0,0 +1,92 @@
1
+ import { Platform, StyleSheet } from 'react-native';
2
+ import { pressProps } from './propTypes'; // These roles should result in cursor: pointer but don't in current RNW releases
3
+
4
+ const shouldUseCursor = ['checkbox', 'radio', 'switch'];
5
+ /**
6
+ * React Native Web has some built-in logic for applying cursor styles based on accessibility roles;
7
+ * however, it misses certain cases. This fills in known cases where widely used versions of RNW
8
+ * fail to apply an expected cursor style.
9
+ *
10
+ * @param {object} props
11
+ * @param {boolean} [props.inactive]
12
+ * @param {boolean} [props.disabled]
13
+ * @param {string} [props.accessibilityRole]
14
+ * @returns
15
+ */
16
+
17
+ export const getCursorStyle = ({
18
+ inactive,
19
+ disabled,
20
+ accessibilityRole
21
+ }) => {
22
+ if (Platform.OS !== 'web') return undefined;
23
+ if (inactive || disabled) return staticStyles.notAllowed;
24
+ if (shouldUseCursor.includes(accessibilityRole)) return staticStyles.pointer;
25
+ return undefined; // allows React Native Web's built-in logic to apply
26
+ };
27
+ /**
28
+ * @typedef {{ pressed: boolean, focused: boolean, hovered?: boolean }} PressableState
29
+ */
30
+
31
+ /**
32
+ * Maps the state object given by the React Native `Pressable` component to the set of
33
+ * equivalent appearance names used in UDS.
34
+ *
35
+ * @param {PressableState} pressableState - state object passed by React Native's `<Pressable>` into
36
+ * render functions passed to its `style` or `children` props.
37
+ * @param {object} [additionalState] - properties specific to the current component,
38
+ * such as `inactive`, `selected`, etc.
39
+ * @returns {object}
40
+ */
41
+
42
+ export const resolvePressableState = ({
43
+ pressed = false,
44
+ focused = false,
45
+ hovered = false
46
+ } = {}, additionalState) => ({ ...additionalState,
47
+ focus: focused,
48
+ hover: hovered,
49
+ pressed
50
+ });
51
+ /**
52
+ * Takes a UDS `tokens` prop and, if it is a function, resolves it based on a state
53
+ * object passed from the React Native `Pressable` component and optional extra properties.
54
+ *
55
+ * @param {object|function} tokens - UDS system tokens prop
56
+ * @param {PressableState} pressableState - state object passed by React Native's `<Pressable>`
57
+ * @param {object} [additionalState] - properties specific to the current component
58
+ * @returns {object} - resolved tokens object
59
+ */
60
+
61
+ export const resolvePressableTokens = (tokens, pressableState, additionalState) => {
62
+ if (typeof tokens !== 'function') return tokens;
63
+ const udsPressableState = resolvePressableState(pressableState, additionalState);
64
+ return tokens(udsPressableState);
65
+ };
66
+ const staticStyles = StyleSheet.create(Platform.select({
67
+ web: {
68
+ notAllowed: {
69
+ cursor: 'not-allowed'
70
+ },
71
+ pointer: {
72
+ cursor: 'pointer'
73
+ }
74
+ },
75
+ default: {}
76
+ }));
77
+ /**
78
+ * From an object of props, extracts any platform-appropriate press handler functions and wraps
79
+ * them in a function that passes in some provided args. Allows components containing a Pressable
80
+ * to pass in press handlers that are then called with state or values that is otherwise internal.
81
+ */
82
+
83
+ export const getPressHandlersWithArgs = (pressableProps = {}, args = []) => {
84
+ // Allow handlers to be passed down for blur, hover, focus, pressIn, etc
85
+ const pressHandlers = Object.fromEntries(Object.entries(pressProps.selectHandlers(pressableProps)).map(([key, handler]) => ({
86
+ [key]: (...defaultArgs) => {
87
+ // Pass each handler data on this button and current selection
88
+ handler(...args, ...defaultArgs);
89
+ }
90
+ })));
91
+ return pressHandlers;
92
+ };
@@ -1,6 +1,22 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import { Linking, Platform } from 'react-native';
3
- import { tokenKeys } from '@telus-uds/tools-theme';
3
+ import { components as tokenKeys } from '@telus-uds/system-themes/schema';
4
+ export const paddingProp = {
5
+ propType: PropTypes.shape({
6
+ paddingBottom: PropTypes.number,
7
+ paddingLeft: PropTypes.number,
8
+ paddingRight: PropTypes.number,
9
+ paddingTop: PropTypes.number
10
+ })
11
+ };
12
+ export const rectProp = {
13
+ propType: PropTypes.shape({
14
+ bottom: PropTypes.number,
15
+ left: PropTypes.number,
16
+ right: PropTypes.number,
17
+ top: PropTypes.number
18
+ })
19
+ };
4
20
  /**
5
21
  * @typedef {{[key: string]: string|number|boolean}} AppearanceSet
6
22
  * @typedef {AppearanceSet} VariantProp
@@ -27,7 +43,7 @@ const getTokenNames = componentName => {
27
43
  const componentTokenNames = tokenKeys[componentName];
28
44
 
29
45
  if (!componentTokenNames) {
30
- throw new Error(`No "${componentName}" tokenKeys in @telus-uds/tools-theme`);
46
+ throw new Error(`No "${componentName}" tokenKeys in @telus-uds/system-themes/schema`);
31
47
  }
32
48
 
33
49
  return componentTokenNames;
@@ -57,10 +73,33 @@ export const selectTokens = (componentName, tokens) => {
57
73
  *
58
74
  * This prop is intended to be used as an 'escape hatch' for difficult or exceptional cases
59
75
  * where the main theming system doesn't apply. It is intentionally permissive about values.
76
+ *
77
+ * @param {...string} componentsNames - one or more ComponentName, which tokens keys are accepted
78
+ * @return {function} - a custom PropTypes validator
79
+ *
80
+ * @example
81
+ * Component.propTypes = {
82
+ * // accepts all tokens keys defined in Component schema
83
+ * tokens: getTokensPropType('Component')
84
+ * }
85
+ *
86
+ * Component.propTypes = {
87
+ * // accepts all tokens keys defined in schemas for Component1 and Component2
88
+ * tokens: getTokensPropType('Component1', 'Component2')
89
+ * }
60
90
  */
61
91
 
62
- export const getTokensPropType = componentName => PropTypes.oneOfType([PropTypes.shape(Object.fromEntries(getTokenNames(componentName).map(key => [key, tokenValueType]))), PropTypes.func // function that takes current appearances and returns above shape
63
- ]);
92
+ export const getTokensPropType = (...componentsNames) => (props, propName, componentName) => {
93
+ PropTypes.checkPropTypes({
94
+ [propName]: PropTypes.oneOfType([PropTypes.object, PropTypes.func])
95
+ }, props, propName, componentName);
96
+
97
+ if (typeof props[propName] !== 'function') {
98
+ PropTypes.checkPropTypes({
99
+ [propName]: PropTypes.exact(Object.fromEntries(componentsNames.flatMap(component => getTokenNames(component).map(key => [key, tokenValueType]))))
100
+ }, props, propName, componentName);
101
+ }
102
+ };
64
103
 
65
104
  function getPropSelector(propTypes, regexp) {
66
105
  const keys = Object.keys(propTypes);
@@ -140,7 +179,27 @@ export const a11yProps = {
140
179
  accessibilityElementsHidden: true
141
180
  }
142
181
  })
143
- }
182
+ },
183
+
184
+ /**
185
+ * Generates an object of platform-appropriate a11y props describing an item that has an
186
+ * ordered position in a set. Examples of usage by accessibility tools includes screenreaders
187
+ * saying "Item X of Y" when this item is select.
188
+ *
189
+ * @param {number} itemsCount - the number of items in the set
190
+ * @param {number} index - the current item's index in the set
191
+ * @returns {object} - platform-applicable a11y props describing this position (if available)
192
+ */
193
+ getPositionInSet: (itemsCount, index) => Platform.select({
194
+ web: {
195
+ // accessibilityPosInSet etc exists in React Native Web main branch
196
+ // but not in a release compatible with Expo etc; just use `aria-*`
197
+ 'aria-setsize': itemsCount,
198
+ 'aria-posinset': index + 1
199
+ },
200
+ // No equivalents exist on the native side
201
+ default: {}
202
+ })
144
203
  }; // Props related to HTML <a> anchor link attributes.
145
204
 
146
205
  const targetValues = ['_self', '_blank', '_parent', '_top'];
@@ -194,7 +253,7 @@ export const hrefAttrsProp = {
194
253
 
195
254
  })
196
255
  };
197
- const pressPropTypes = {
256
+ const pressHandlerPropTypes = {
198
257
  onPress: PropTypes.func,
199
258
  onPressIn: PropTypes.func,
200
259
  onPressOut: PropTypes.func,
@@ -205,7 +264,16 @@ const pressPropTypes = {
205
264
  onFocus: PropTypes.func,
206
265
  onBlur: PropTypes.func
207
266
  },
208
- default: {}
267
+ default: {
268
+ onLongPress: PropTypes.func
269
+ }
270
+ })
271
+ };
272
+ const pressPropTypes = { ...pressHandlerPropTypes,
273
+ disabled: PropTypes.bool,
274
+ ...Platform.select({
275
+ hitSlop: PropTypes.number,
276
+ pressRetentionOffset: PropTypes.oneOfType([PropTypes.number, rectProp.propType])
209
277
  })
210
278
  };
211
279
  export const pressProps = {
@@ -217,7 +285,8 @@ export const pressProps = {
217
285
  /**
218
286
  * Filters a props object, returning only the platform-relevant press props defined above
219
287
  */
220
- select: getPropSelector(pressPropTypes)
288
+ select: getPropSelector(pressPropTypes),
289
+ selectHandlers: getPropSelector(pressHandlerPropTypes)
221
290
  };
222
291
  const linkPropTypes = { ...pressPropTypes,
223
292
  href: PropTypes.string,
@@ -405,12 +474,4 @@ export const componentPropType = (passedName, checkDisplayName = false) => {
405
474
  validate.isRequired = createValidate(true);
406
475
  return validate;
407
476
  };
408
- export const copyPropTypes = PropTypes.oneOf(['en', 'fr']);
409
- export const paddingProp = {
410
- propType: PropTypes.shape({
411
- paddingBottom: PropTypes.number,
412
- paddingLeft: PropTypes.number,
413
- paddingRight: PropTypes.number,
414
- paddingTop: PropTypes.number
415
- })
416
- };
477
+ export const copyPropTypes = PropTypes.oneOf(['en', 'fr']);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telus-uds/components-base",
3
- "version": "0.0.2-prerelease.6",
3
+ "version": "0.0.2-prerelease.7",
4
4
  "description": "Base components",
5
5
  "keywords": [
6
6
  "base"
@@ -47,9 +47,10 @@
47
47
  "react-test-renderer": "^16.3.2"
48
48
  },
49
49
  "dependencies": {
50
- "@telus-uds/system-constants": "^0.0.2-prerelease.1",
51
- "@telus-uds/tools-theme": "^0.0.2-prerelease.4",
50
+ "@telus-uds/system-constants": "^0.0.2-prerelease.2",
51
+ "@telus-uds/system-themes": "^0.0.2-prerelease.0",
52
52
  "lodash.merge": "^4.6.2",
53
- "prop-types": "^15.7.2"
53
+ "prop-types": "^15.7.2",
54
+ "react-native-picker-select": "^8.0.4"
54
55
  }
55
56
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "previousReleaseTag": "@telus-uds/components-base/v0.0.2-prerelease.5",
3
- "changelog": "### [0.0.2-prerelease.6](https://github.com/telus/universal-design-system/compare/@telus-uds/components-base/v0.0.2-prerelease.5...@telus-uds/components-base/v0.0.2-prerelease.6) (2021-11-08)\n\n\n### Features\n\n* **base:** add Tooltip component ([#687](https://github.com/telus/universal-design-system/issues/687)) ([38aaad4](https://github.com/telus/universal-design-system/commit/38aaad43d664b76e85a264901df5e1ca045a0304))\n* **base:** responsive directions with `useResponsiveProp` ([#677](https://github.com/telus/universal-design-system/issues/677)) ([b61e6a7](https://github.com/telus/universal-design-system/commit/b61e6a75159ce3fbd81758148ff8d10ab73cb409))\n\n\n### Bug Fixes\n\n* **base:** fix Tooltip positioning when page scrollbar is rendered ([#728](https://github.com/telus/universal-design-system/issues/728)) ([c52167d](https://github.com/telus/universal-design-system/commit/c52167d94b1306749f2755ed2c4fb39bedd5dbf6))\n* **base:** refresh viewport on first render, for SSR ([#712](https://github.com/telus/universal-design-system/issues/712)) ([b6288c0](https://github.com/telus/universal-design-system/commit/b6288c0e003a73f88e3fa5743ee085a767c53a0b))\n",
4
- "releaseTag": "@telus-uds/components-base/v0.0.2-prerelease.6",
5
- "newVersion": "0.0.2-prerelease.6",
2
+ "previousReleaseTag": "@telus-uds/components-base/v0.0.2-prerelease.6",
3
+ "changelog": "### [0.0.2-prerelease.7](https://github.com/telus/universal-design-system/compare/@telus-uds/components-base/v0.0.2-prerelease.6...@telus-uds/components-base/v0.0.2-prerelease.7) (2021-11-23)\n\n\n### Features\n\n* **base:** add `Radio` button ([#731](https://github.com/telus/universal-design-system/issues/731)) ([ad1613c](https://github.com/telus/universal-design-system/commit/ad1613c547fe3b0cdf1490a92267f32045356133))\n* **base:** add base `Checkbox` component ([#706](https://github.com/telus/universal-design-system/issues/706)) ([a3fa01a](https://github.com/telus/universal-design-system/commit/a3fa01ad0da342be02c15284a103c22d7b315ae9))\n* **base:** add Tags component ([#785](https://github.com/telus/universal-design-system/issues/785)) ([90bbf40](https://github.com/telus/universal-design-system/commit/90bbf4035a0bc0a8cdf319d9b366c8498c0dfb56))\n* **base:** add TextArea ([#720](https://github.com/telus/universal-design-system/issues/720)) ([b18cae3](https://github.com/telus/universal-design-system/commit/b18cae3357375019ecc4e24e78ed9a2345b26139))\n* **base:** add the Select component ([#759](https://github.com/telus/universal-design-system/issues/759)) ([9cfdf84](https://github.com/telus/universal-design-system/commit/9cfdf846b7a273dd140537b60e08f30a70c13a66))\n* **base:** adding list component ([#296](https://github.com/telus/universal-design-system/issues/296)) ([#703](https://github.com/telus/universal-design-system/issues/703)) ([50e474d](https://github.com/telus/universal-design-system/commit/50e474d3d7f1988f5971a10be8416c8ac510626f))\n* **base:** implementing base Skeleton component ([#770](https://github.com/telus/universal-design-system/issues/770)) ([1138f08](https://github.com/telus/universal-design-system/commit/1138f08885f4cf67fc0fb7273758d20cc0a989c1)), closes [#296](https://github.com/telus/universal-design-system/issues/296) [#296](https://github.com/telus/universal-design-system/issues/296) [#296](https://github.com/telus/universal-design-system/issues/296) [#296](https://github.com/telus/universal-design-system/issues/296) [#296](https://github.com/telus/universal-design-system/issues/296) [#296](https://github.com/telus/universal-design-system/issues/296) [#296](https://github.com/telus/universal-design-system/issues/296)\n\n\n### Bug Fixes\n\n* **base:** adjust event handlers for checkbox / radio inputs on Web ([#820](https://github.com/telus/universal-design-system/issues/820)) ([87624d2](https://github.com/telus/universal-design-system/commit/87624d29166ce85aeaf7dc1db4dc5b60ecd170a5))\n* **base:** fix button text alignment ([#794](https://github.com/telus/universal-design-system/issues/794)) ([9671087](https://github.com/telus/universal-design-system/commit/9671087477eb45b0d3c872b47f1d24cdd43a727f))\n* **base:** various visual fixes for native/app ([#797](https://github.com/telus/universal-design-system/issues/797)) ([a00ab12](https://github.com/telus/universal-design-system/commit/a00ab124c40e1ea46441270acfd64ae0f37b0a68))\n* export a11ytext [prerelease-components-base] ([#830](https://github.com/telus/universal-design-system/issues/830)) ([af627a2](https://github.com/telus/universal-design-system/commit/af627a2b4fa4cbf78983521bbb66b86ab9f87601))\n* **jest:** pick .web files in -allium-web tests ([#765](https://github.com/telus/universal-design-system/issues/765)) ([e0b1bd5](https://github.com/telus/universal-design-system/commit/e0b1bd5edcc52b916685f8c5dcd8d2901d2ecdbd))\n",
4
+ "releaseTag": "@telus-uds/components-base/v0.0.2-prerelease.7",
5
+ "newVersion": "0.0.2-prerelease.7",
6
6
  "packageName": "@telus-uds/components-base"
7
7
  }
@@ -1,11 +1,14 @@
1
1
  import React from 'react'
2
+
2
3
  import ButtonBase from './ButtonBase'
3
4
  import buttonPropTypes from './propTypes'
5
+ import { useThemeTokensCallback } from '../ThemeProvider'
4
6
  import { a11yProps } from '../utils/propTypes'
5
7
 
6
- const Button = ({ accessibilityRole = 'button', ...props }) => (
7
- <ButtonBase {...props} accessibilityRole={accessibilityRole} />
8
- )
8
+ const Button = ({ accessibilityRole = 'button', tokens, variant, ...props }) => {
9
+ const getTokens = useThemeTokensCallback('Button', tokens, variant)
10
+ return <ButtonBase {...props} tokens={getTokens} accessibilityRole={accessibilityRole} />
11
+ }
9
12
 
10
13
  Button.propTypes = {
11
14
  ...a11yProps.types,