@telus-uds/components-base 1.4.0 → 1.5.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,8 +1,8 @@
1
- @telus-uds/components-base:build: cache hit, replaying output 875a557dac68c9fc
1
+ @telus-uds/components-base:build: cache hit, replaying output 6a69e9bf21c07998
2
2
  @telus-uds/components-base:build: $ yarn build:code && yarn build:docs
3
3
  @telus-uds/components-base:build: $ yarn build:main && yarn build:module
4
4
  @telus-uds/components-base:build: $ babel src -d lib
5
- @telus-uds/components-base:build: Successfully compiled 215 files with Babel (7019ms).
5
+ @telus-uds/components-base:build: Successfully compiled 215 files with Babel (4882ms).
6
6
  @telus-uds/components-base:build: $ babel src -d lib-module --env-name module
7
- @telus-uds/components-base:build: Successfully compiled 215 files with Babel (5391ms).
7
+ @telus-uds/components-base:build: Successfully compiled 215 files with Babel (3426ms).
8
8
  @telus-uds/components-base:build: $ babel-node --plugins=react-docgen-alpha generate-component-docs.js
package/CHANGELOG.json CHANGED
@@ -2,7 +2,28 @@
2
2
  "name": "@telus-uds/components-base",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 01 Apr 2022 14:15:14 GMT",
5
+ "date": "Thu, 07 Apr 2022 20:33:50 GMT",
6
+ "tag": "@telus-uds/components-base_v1.5.0",
7
+ "version": "1.5.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "ruslan.bredikhin@nearform.com",
12
+ "package": "@telus-uds/components-base",
13
+ "commit": "63472330f9144ba99c34c7524dcc2d2f4f716e69",
14
+ "comment": "extend HorizontalScrollButton via IconButton"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@telus-uds/components-base",
19
+ "comment": "Bump @telus-uds/system-theme-tokens to v1.4.0",
20
+ "commit": "63472330f9144ba99c34c7524dcc2d2f4f716e69"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Fri, 01 Apr 2022 14:15:21 GMT",
6
27
  "tag": "@telus-uds/components-base_v1.4.0",
7
28
  "version": "1.4.0",
8
29
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @telus-uds/components-base
2
2
 
3
- This log was last generated on Fri, 01 Apr 2022 14:15:14 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 07 Apr 2022 20:33:50 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.5.0
8
+
9
+ Thu, 07 Apr 2022 20:33:50 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - extend HorizontalScrollButton via IconButton (ruslan.bredikhin@nearform.com)
14
+ - Bump @telus-uds/system-theme-tokens to v1.4.0
15
+
7
16
  ## 1.4.0
8
17
 
9
- Fri, 01 Apr 2022 14:15:14 GMT
18
+ Fri, 01 Apr 2022 14:15:21 GMT
10
19
 
11
20
  ### Minor changes
12
21
 
@@ -172,14 +172,20 @@
172
172
  "iconGap": "size"
173
173
  },
174
174
  "HorizontalScrollButton": {
175
- "borderRadius": "radius",
176
175
  "backgroundColor": "color",
176
+ "borderRadius": "radius",
177
177
  "borderColor": "color",
178
178
  "borderWidth": "border",
179
- "padding": "size",
180
- "shadow": "shadow",
179
+ "iconColor": "color",
181
180
  "iconSize": "size",
182
- "iconColor": "color"
181
+ "iconScale": "iconScale",
182
+ "iconTranslateX": "size",
183
+ "iconTranslateY": "size",
184
+ "outerBorderWidth": "border",
185
+ "outerBorderColor": "color",
186
+ "outerBorderGap": "size",
187
+ "padding": "size",
188
+ "shadow": "shadow"
183
189
  },
184
190
  "Icon": {
185
191
  "size": "size",
@@ -6969,14 +6975,20 @@
6969
6975
  "type": {
6970
6976
  "name": "custom",
6971
6977
  "raw": {
6972
- "borderRadius": "radius",
6973
6978
  "backgroundColor": "color",
6979
+ "borderRadius": "radius",
6974
6980
  "borderColor": "color",
6975
6981
  "borderWidth": "border",
6976
- "padding": "size",
6977
- "shadow": "shadow",
6982
+ "iconColor": "color",
6978
6983
  "iconSize": "size",
6979
- "iconColor": "color"
6984
+ "iconScale": "iconScale",
6985
+ "iconTranslateX": "size",
6986
+ "iconTranslateY": "size",
6987
+ "outerBorderWidth": "border",
6988
+ "outerBorderColor": "color",
6989
+ "outerBorderGap": "size",
6990
+ "padding": "size",
6991
+ "shadow": "shadow"
6980
6992
  }
6981
6993
  },
6982
6994
  "required": false,
@@ -8278,14 +8290,20 @@
8278
8290
  "type": {
8279
8291
  "name": "custom",
8280
8292
  "raw": {
8281
- "borderRadius": "radius",
8282
8293
  "backgroundColor": "color",
8294
+ "borderRadius": "radius",
8283
8295
  "borderColor": "color",
8284
8296
  "borderWidth": "border",
8285
- "padding": "size",
8286
- "shadow": "shadow",
8297
+ "iconColor": "color",
8287
8298
  "iconSize": "size",
8288
- "iconColor": "color"
8299
+ "iconScale": "iconScale",
8300
+ "iconTranslateX": "size",
8301
+ "iconTranslateY": "size",
8302
+ "outerBorderWidth": "border",
8303
+ "outerBorderColor": "color",
8304
+ "outerBorderGap": "size",
8305
+ "padding": "size",
8306
+ "shadow": "shadow"
8289
8307
  }
8290
8308
  },
8291
8309
  "required": false,
@@ -154,7 +154,6 @@ const HorizontalScroll = /*#__PURE__*/(0, _react.forwardRef)(({
154
154
  onLayout: handleContainerLayout,
155
155
  showsHorizontalScrollIndicator: false,
156
156
  contentContainerStyle: [staticStyles.scrollContainer, {
157
- marginBottom: gutter,
158
157
  borderBottomWidth,
159
158
  borderBottomColor
160
159
  }],
@@ -9,17 +9,15 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
- var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
13
-
14
12
  var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
15
13
 
16
- var _ThemeProvider = require("../ThemeProvider");
14
+ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
17
15
 
18
16
  var _utils = require("../utils");
19
17
 
20
- var _Icon = _interopRequireDefault(require("../Icon"));
18
+ var _ThemeProvider = require("../ThemeProvider");
21
19
 
22
- var _Typography = _interopRequireDefault(require("../Typography"));
20
+ var _IconButton = _interopRequireDefault(require("../IconButton"));
23
21
 
24
22
  var _dictionary = _interopRequireDefault(require("./dictionary"));
25
23
 
@@ -31,19 +29,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
31
29
 
32
30
  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; }
33
31
 
34
- const selectButtonStyles = ({
35
- borderRadius,
36
- backgroundColor,
37
- borderColor,
38
- borderWidth,
39
- padding
40
- }, direction) => [staticStyles.absolute, staticStyles[direction], {
41
- borderRadius,
42
- backgroundColor,
43
- borderColor,
44
- borderWidth,
45
- padding
46
- }];
32
+ const selectContainerStyles = ({
33
+ offset
34
+ }) => ({
35
+ marginTop: offset ? -offset : 0
36
+ });
47
37
  /**
48
38
  * Button within a Tabs component showing users that content is available to the left or
49
39
  * right, scrolling a screen's worth of content left or right when pressed.
@@ -57,47 +47,31 @@ const selectButtonStyles = ({
57
47
  const HorizontalScrollButton = /*#__PURE__*/(0, _react.forwardRef)(({
58
48
  direction = 'next',
59
49
  icon,
60
- onPress,
61
50
  offset,
51
+ onPress,
62
52
  variant,
63
53
  tokens,
64
54
  copy
65
55
  }, ref) => {
66
- const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('HorizontalScrollButton', tokens, variant);
67
-
68
- const resolveButtonTokens = pressableState => (0, _utils.resolvePressableTokens)(getTokens, pressableState);
69
-
70
- const getPressableStyle = pressableState => [selectButtonStyles(resolveButtonTokens(pressableState), direction), {
71
- marginTop: -1 * (offset || 0)
72
- }];
73
-
56
+ const themeTokens = (0, _ThemeProvider.useThemeTokens)('HorizontalScrollButton', tokens, variant);
74
57
  const getCopy = (0, _utils.useCopy)({
75
58
  dictionary: _dictionary.default,
76
59
  copy
77
60
  });
78
61
  const label = direction === 'previous' ? getCopy('previousText') : getCopy('nextText');
79
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
80
- ref: ref,
81
- style: getPressableStyle,
82
- onPress: onPress,
83
- accessibilityLabel: label,
84
- accessibilityRole: "button" // For keyboard-tab or screenreader-swipe navigation, users can just go through all items
85
- ,
86
- ..._utils.a11yProps.nonFocusableProps,
87
- children: pressableState => {
88
- const iconTokens = (0, _utils.selectTokens)('Icon', resolveButtonTokens(pressableState), 'icon');
89
- return icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
90
- icon: icon,
91
- tokens: iconTokens
92
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
93
- tokens: {
94
- fontSize: iconTokens.size,
95
- lineHeight: 1,
96
- color: iconTokens.color
97
- },
98
- children: direction === 'next' ? '→' : '←'
99
- });
100
- }
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
63
+ style: [staticStyles.absolute, staticStyles[direction], selectContainerStyles({
64
+ offset
65
+ })],
66
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
67
+ accessibilityLabel: label,
68
+ icon: icon,
69
+ onPress: onPress,
70
+ ref: ref,
71
+ tokens: themeTokens,
72
+ variant: variant,
73
+ ..._utils.a11yProps.nonFocusableProps
74
+ })
101
75
  });
102
76
  });
103
77
  HorizontalScrollButton.displayName = 'HorizontalScrollButton';
@@ -129,7 +129,6 @@ const HorizontalScroll = /*#__PURE__*/forwardRef(({
129
129
  onLayout: handleContainerLayout,
130
130
  showsHorizontalScrollIndicator: false,
131
131
  contentContainerStyle: [staticStyles.scrollContainer, {
132
- marginBottom: gutter,
133
132
  borderBottomWidth,
134
133
  borderBottomColor
135
134
  }],
@@ -1,27 +1,18 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import Pressable from "react-native-web/dist/exports/Pressable";
4
3
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
- import { useThemeTokensCallback } from '../ThemeProvider';
6
- import { resolvePressableTokens, selectTokens, variantProp, getTokensPropType, useCopy, copyPropTypes, a11yProps } from '../utils';
7
- import Icon from '../Icon';
8
- import Typography from '../Typography';
4
+ import View from "react-native-web/dist/exports/View";
5
+ import { variantProp, getTokensPropType, useCopy, copyPropTypes, a11yProps } from '../utils';
6
+ import { useThemeTokens } from '../ThemeProvider';
7
+ import IconButton from '../IconButton';
9
8
  import dictionary from './dictionary';
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
11
10
 
12
- const selectButtonStyles = ({
13
- borderRadius,
14
- backgroundColor,
15
- borderColor,
16
- borderWidth,
17
- padding
18
- }, direction) => [staticStyles.absolute, staticStyles[direction], {
19
- borderRadius,
20
- backgroundColor,
21
- borderColor,
22
- borderWidth,
23
- padding
24
- }];
11
+ const selectContainerStyles = ({
12
+ offset
13
+ }) => ({
14
+ marginTop: offset ? -offset : 0
15
+ });
25
16
  /**
26
17
  * Button within a Tabs component showing users that content is available to the left or
27
18
  * right, scrolling a screen's worth of content left or right when pressed.
@@ -35,47 +26,31 @@ const selectButtonStyles = ({
35
26
  const HorizontalScrollButton = /*#__PURE__*/forwardRef(({
36
27
  direction = 'next',
37
28
  icon,
38
- onPress,
39
29
  offset,
30
+ onPress,
40
31
  variant,
41
32
  tokens,
42
33
  copy
43
34
  }, ref) => {
44
- const getTokens = useThemeTokensCallback('HorizontalScrollButton', tokens, variant);
45
-
46
- const resolveButtonTokens = pressableState => resolvePressableTokens(getTokens, pressableState);
47
-
48
- const getPressableStyle = pressableState => [selectButtonStyles(resolveButtonTokens(pressableState), direction), {
49
- marginTop: -1 * (offset || 0)
50
- }];
51
-
35
+ const themeTokens = useThemeTokens('HorizontalScrollButton', tokens, variant);
52
36
  const getCopy = useCopy({
53
37
  dictionary,
54
38
  copy
55
39
  });
56
40
  const label = direction === 'previous' ? getCopy('previousText') : getCopy('nextText');
57
- return /*#__PURE__*/_jsx(Pressable, {
58
- ref: ref,
59
- style: getPressableStyle,
60
- onPress: onPress,
61
- accessibilityLabel: label,
62
- accessibilityRole: "button" // For keyboard-tab or screenreader-swipe navigation, users can just go through all items
63
- ,
64
- ...a11yProps.nonFocusableProps,
65
- children: pressableState => {
66
- const iconTokens = selectTokens('Icon', resolveButtonTokens(pressableState), 'icon');
67
- return icon ? /*#__PURE__*/_jsx(Icon, {
68
- icon: icon,
69
- tokens: iconTokens
70
- }) : /*#__PURE__*/_jsx(Typography, {
71
- tokens: {
72
- fontSize: iconTokens.size,
73
- lineHeight: 1,
74
- color: iconTokens.color
75
- },
76
- children: direction === 'next' ? '→' : '←'
77
- });
78
- }
41
+ return /*#__PURE__*/_jsx(View, {
42
+ style: [staticStyles.absolute, staticStyles[direction], selectContainerStyles({
43
+ offset
44
+ })],
45
+ children: /*#__PURE__*/_jsx(IconButton, {
46
+ accessibilityLabel: label,
47
+ icon: icon,
48
+ onPress: onPress,
49
+ ref: ref,
50
+ tokens: themeTokens,
51
+ variant: variant,
52
+ ...a11yProps.nonFocusableProps
53
+ })
79
54
  });
80
55
  });
81
56
  HorizontalScrollButton.displayName = 'HorizontalScrollButton';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telus-uds/components-base",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Base components",
5
5
  "keywords": [
6
6
  "base"
@@ -59,7 +59,7 @@
59
59
  "dependencies": {
60
60
  "airbnb-prop-types": "^2.16.0",
61
61
  "@telus-uds/system-constants": "^1.0.2",
62
- "@telus-uds/system-theme-tokens": "^1.3.0",
62
+ "@telus-uds/system-theme-tokens": "^1.4.0",
63
63
  "lodash.debounce": "^4.0.8",
64
64
  "lodash.merge": "^4.6.2",
65
65
  "prop-types": "^15.7.2",
@@ -129,7 +129,7 @@ const HorizontalScroll = forwardRef(
129
129
  showsHorizontalScrollIndicator={false}
130
130
  contentContainerStyle={[
131
131
  staticStyles.scrollContainer,
132
- { marginBottom: gutter, borderBottomWidth, borderBottomColor }
132
+ { borderBottomWidth, borderBottomColor }
133
133
  ]}
134
134
  {...selectProps(rest)}
135
135
  >
@@ -1,35 +1,14 @@
1
1
  import React, { forwardRef } from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import { Pressable, StyleSheet } from 'react-native'
4
-
5
- import { useThemeTokensCallback } from '../ThemeProvider'
6
- import {
7
- resolvePressableTokens,
8
- selectTokens,
9
- variantProp,
10
- getTokensPropType,
11
- useCopy,
12
- copyPropTypes,
13
- a11yProps
14
- } from '../utils'
15
- import Icon from '../Icon'
16
- import Typography from '../Typography'
3
+ import { StyleSheet, View } from 'react-native'
4
+ import { variantProp, getTokensPropType, useCopy, copyPropTypes, a11yProps } from '../utils'
5
+ import { useThemeTokens } from '../ThemeProvider'
6
+ import IconButton from '../IconButton'
17
7
  import dictionary from './dictionary'
18
8
 
19
- const selectButtonStyles = (
20
- { borderRadius, backgroundColor, borderColor, borderWidth, padding },
21
- direction
22
- ) => [
23
- staticStyles.absolute,
24
- staticStyles[direction],
25
- {
26
- borderRadius,
27
- backgroundColor,
28
- borderColor,
29
- borderWidth,
30
- padding
31
- }
32
- ]
9
+ const selectContainerStyles = ({ offset }) => ({
10
+ marginTop: offset ? -offset : 0
11
+ })
33
12
 
34
13
  /**
35
14
  * Button within a Tabs component showing users that content is available to the left or
@@ -40,41 +19,25 @@ const selectButtonStyles = (
40
19
  * @TODO when IconButton is complete and stable revisit this and update interaction state styles.
41
20
  */
42
21
  const HorizontalScrollButton = forwardRef(
43
- ({ direction = 'next', icon, onPress, offset, variant, tokens, copy }, ref) => {
44
- const getTokens = useThemeTokensCallback('HorizontalScrollButton', tokens, variant)
45
- const resolveButtonTokens = (pressableState) =>
46
- resolvePressableTokens(getTokens, pressableState)
47
- const getPressableStyle = (pressableState) => [
48
- selectButtonStyles(resolveButtonTokens(pressableState), direction),
49
- { marginTop: -1 * (offset || 0) }
50
- ]
51
-
22
+ ({ direction = 'next', icon, offset, onPress, variant, tokens, copy }, ref) => {
23
+ const themeTokens = useThemeTokens('HorizontalScrollButton', tokens, variant)
52
24
  const getCopy = useCopy({ dictionary, copy })
53
25
  const label = direction === 'previous' ? getCopy('previousText') : getCopy('nextText')
54
26
 
55
27
  return (
56
- <Pressable
57
- ref={ref}
58
- style={getPressableStyle}
59
- onPress={onPress}
60
- accessibilityLabel={label}
61
- accessibilityRole="button"
62
- // For keyboard-tab or screenreader-swipe navigation, users can just go through all items
63
- {...a11yProps.nonFocusableProps}
28
+ <View
29
+ style={[staticStyles.absolute, staticStyles[direction], selectContainerStyles({ offset })]}
64
30
  >
65
- {(pressableState) => {
66
- const iconTokens = selectTokens('Icon', resolveButtonTokens(pressableState), 'icon')
67
- return icon ? (
68
- <Icon icon={icon} tokens={iconTokens} />
69
- ) : (
70
- <Typography
71
- tokens={{ fontSize: iconTokens.size, lineHeight: 1, color: iconTokens.color }}
72
- >
73
- {direction === 'next' ? '→' : '←'}
74
- </Typography>
75
- )
76
- }}
77
- </Pressable>
31
+ <IconButton
32
+ accessibilityLabel={label}
33
+ icon={icon}
34
+ onPress={onPress}
35
+ ref={ref}
36
+ tokens={themeTokens}
37
+ variant={variant}
38
+ {...a11yProps.nonFocusableProps}
39
+ />
40
+ </View>
78
41
  )
79
42
  }
80
43
  )