@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.
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.json +22 -1
- package/CHANGELOG.md +11 -2
- package/component-docs.json +30 -12
- package/lib/HorizontalScroll/HorizontalScroll.js +0 -1
- package/lib/HorizontalScroll/HorizontalScrollButton.js +23 -49
- package/lib-module/HorizontalScroll/HorizontalScroll.js +0 -1
- package/lib-module/HorizontalScroll/HorizontalScrollButton.js +24 -49
- package/package.json +2 -2
- package/src/HorizontalScroll/HorizontalScroll.jsx +1 -1
- package/src/HorizontalScroll/HorizontalScrollButton.jsx +21 -58
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
@telus-uds/components-base:build: cache hit, replaying output
|
|
1
|
+
@telus-uds/components-base:build: cache hit, replaying output 6a69e9bf21c07998
|
|
2
2
|
@telus-uds/components-base:build: [2K[1G[2m$ yarn build:code && yarn build:docs[22m
|
|
3
3
|
@telus-uds/components-base:build: [2K[1G[2m$ yarn build:main && yarn build:module[22m
|
|
4
4
|
@telus-uds/components-base:build: [2K[1G[2m$ babel src -d lib[22m
|
|
5
|
-
@telus-uds/components-base:build: Successfully compiled 215 files with Babel (
|
|
5
|
+
@telus-uds/components-base:build: Successfully compiled 215 files with Babel (4882ms).
|
|
6
6
|
@telus-uds/components-base:build: [2K[1G[2m$ babel src -d lib-module --env-name module[22m
|
|
7
|
-
@telus-uds/components-base:build: Successfully compiled 215 files with Babel (
|
|
7
|
+
@telus-uds/components-base:build: Successfully compiled 215 files with Babel (3426ms).
|
|
8
8
|
@telus-uds/components-base:build: [2K[1G[2m$ babel-node --plugins=react-docgen-alpha generate-component-docs.js[22m
|
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,28 @@
|
|
|
2
2
|
"name": "@telus-uds/components-base",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
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
|
|
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:
|
|
18
|
+
Fri, 01 Apr 2022 14:15:21 GMT
|
|
10
19
|
|
|
11
20
|
### Minor changes
|
|
12
21
|
|
package/component-docs.json
CHANGED
|
@@ -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
|
-
"
|
|
180
|
-
"shadow": "shadow",
|
|
179
|
+
"iconColor": "color",
|
|
181
180
|
"iconSize": "size",
|
|
182
|
-
"
|
|
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
|
-
"
|
|
6977
|
-
"shadow": "shadow",
|
|
6982
|
+
"iconColor": "color",
|
|
6978
6983
|
"iconSize": "size",
|
|
6979
|
-
"
|
|
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
|
-
"
|
|
8286
|
-
"shadow": "shadow",
|
|
8297
|
+
"iconColor": "color",
|
|
8287
8298
|
"iconSize": "size",
|
|
8288
|
-
"
|
|
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
|
|
14
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
17
15
|
|
|
18
16
|
var _utils = require("../utils");
|
|
19
17
|
|
|
20
|
-
var
|
|
18
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
21
19
|
|
|
22
|
-
var
|
|
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
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
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)(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
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
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
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(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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.
|
|
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.
|
|
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
|
-
{
|
|
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 {
|
|
4
|
-
|
|
5
|
-
import {
|
|
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
|
|
20
|
-
|
|
21
|
-
|
|
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,
|
|
44
|
-
const
|
|
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
|
-
<
|
|
57
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
)
|