@telus-uds/components-base 1.85.1 → 1.87.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/CHANGELOG.md +34 -2
- package/lib/ActionCard/ActionCard.js +350 -0
- package/lib/ActionCard/index.js +10 -0
- package/lib/Card/Card.js +3 -3
- package/lib/Card/PressableCardBase.js +1 -1
- package/lib/Checkbox/Checkbox.js +4 -0
- package/lib/Link/TextButton.js +17 -7
- package/lib/List/List.js +9 -2
- package/lib/List/ListItemContent.js +3 -2
- package/lib/Modal/ModalContent.js +6 -8
- package/lib/Modal/WebModal.js +2 -1
- package/lib/Notification/Notification.js +20 -15
- package/lib/Radio/Radio.js +4 -0
- package/lib/Select/Picker.js +4 -0
- package/lib/Select/Select.js +1 -1
- package/lib/Tabs/Tabs.js +4 -1
- package/lib/Tabs/TabsItem.js +7 -1
- package/lib/index.js +8 -0
- package/lib/utils/animation/useVerticalExpandAnimation.js +3 -3
- package/lib/utils/props/tokens.js +2 -2
- package/lib-module/ActionCard/ActionCard.js +343 -0
- package/lib-module/ActionCard/index.js +2 -0
- package/lib-module/Card/Card.js +4 -4
- package/lib-module/Card/PressableCardBase.js +1 -1
- package/lib-module/Checkbox/Checkbox.js +4 -0
- package/lib-module/Link/TextButton.js +17 -7
- package/lib-module/List/List.js +9 -2
- package/lib-module/List/ListItemContent.js +3 -2
- package/lib-module/Modal/ModalContent.js +6 -8
- package/lib-module/Modal/WebModal.js +2 -1
- package/lib-module/Notification/Notification.js +20 -15
- package/lib-module/Radio/Radio.js +4 -0
- package/lib-module/Select/Picker.js +5 -1
- package/lib-module/Select/Select.js +2 -2
- package/lib-module/Tabs/Tabs.js +4 -1
- package/lib-module/Tabs/TabsItem.js +7 -1
- package/lib-module/index.js +1 -0
- package/lib-module/utils/animation/useVerticalExpandAnimation.js +3 -3
- package/lib-module/utils/props/tokens.js +2 -2
- package/package.json +2 -2
- package/src/ActionCard/ActionCard.jsx +306 -0
- package/src/ActionCard/index.js +3 -0
- package/src/Card/Card.jsx +6 -4
- package/src/Card/PressableCardBase.jsx +1 -1
- package/src/Checkbox/Checkbox.jsx +3 -1
- package/src/Link/TextButton.jsx +17 -9
- package/src/List/List.jsx +7 -2
- package/src/List/ListItemContent.jsx +2 -2
- package/src/Modal/ModalContent.jsx +3 -5
- package/src/Modal/WebModal.jsx +2 -1
- package/src/Notification/Notification.jsx +36 -16
- package/src/Radio/Radio.jsx +3 -1
- package/src/Select/Picker.jsx +6 -1
- package/src/Select/Select.jsx +4 -2
- package/src/Tabs/Tabs.jsx +4 -1
- package/src/Tabs/TabsItem.jsx +5 -1
- package/src/index.js +1 -0
- package/src/utils/animation/useVerticalExpandAnimation.js +3 -3
- package/src/utils/props/tokens.js +4 -2
package/lib/Select/Picker.js
CHANGED
|
@@ -9,6 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _utils = require("../utils");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.htmlAttrs]);
|
|
12
13
|
const Picker = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
13
14
|
let {
|
|
14
15
|
value,
|
|
@@ -25,6 +26,7 @@ const Picker = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
25
26
|
testID,
|
|
26
27
|
...rest
|
|
27
28
|
} = _ref;
|
|
29
|
+
const selectedProps = selectProps(rest);
|
|
28
30
|
const {
|
|
29
31
|
accessibilityLabel,
|
|
30
32
|
accessibilityDescribedBy,
|
|
@@ -45,6 +47,7 @@ const Picker = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
45
47
|
"aria-describedby": accessibilityDescribedBy,
|
|
46
48
|
"aria-invalid": accessibilityInvalid,
|
|
47
49
|
"data-testid": testID,
|
|
50
|
+
...selectedProps,
|
|
48
51
|
children: [placeholder !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
49
52
|
value: placeholder.value,
|
|
50
53
|
disabled: true,
|
|
@@ -57,6 +60,7 @@ Picker.displayName = 'Picker';
|
|
|
57
60
|
var _default = Picker;
|
|
58
61
|
exports.default = _default;
|
|
59
62
|
Picker.propTypes = {
|
|
63
|
+
...selectedSystemPropTypes,
|
|
60
64
|
value: _propTypes.default.string,
|
|
61
65
|
onChange: _propTypes.default.func,
|
|
62
66
|
onFocus: _propTypes.default.func,
|
package/lib/Select/Select.js
CHANGED
|
@@ -16,7 +16,7 @@ var _InputSupports = _interopRequireDefault(require("../InputSupports"));
|
|
|
16
16
|
var _constants = require("./constants");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.inputSupportsProps, _utils.viewProps]);
|
|
19
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.inputSupportsProps, _utils.viewProps, _utils.htmlAttrs]);
|
|
20
20
|
const selectInputStyles = (_ref, themeOptions, inactive) => {
|
|
21
21
|
let {
|
|
22
22
|
backgroundColor,
|
package/lib/Tabs/Tabs.js
CHANGED
|
@@ -115,6 +115,7 @@ const Tabs = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
115
115
|
ref: itemRef,
|
|
116
116
|
LinkRouter: ItemLinkRouter = LinkRouter,
|
|
117
117
|
linkRouterProps: itemLinkRouterProps,
|
|
118
|
+
render,
|
|
118
119
|
...itemRest
|
|
119
120
|
} = _ref3;
|
|
120
121
|
const itemId = id ?? label;
|
|
@@ -140,6 +141,7 @@ const Tabs = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
140
141
|
...linkRouterProps,
|
|
141
142
|
...itemLinkRouterProps
|
|
142
143
|
},
|
|
144
|
+
render: render,
|
|
143
145
|
...itemProps,
|
|
144
146
|
children: label
|
|
145
147
|
}, itemId);
|
|
@@ -160,7 +162,8 @@ Tabs.propTypes = {
|
|
|
160
162
|
href: _propTypes.default.string,
|
|
161
163
|
label: _propTypes.default.string,
|
|
162
164
|
id: _propTypes.default.string,
|
|
163
|
-
ref: _airbnbPropTypes.default.ref()
|
|
165
|
+
ref: _airbnbPropTypes.default.ref(),
|
|
166
|
+
render: _propTypes.default.func
|
|
164
167
|
})),
|
|
165
168
|
/**
|
|
166
169
|
* `id` property of the current tab in the items array
|
package/lib/Tabs/TabsItem.js
CHANGED
|
@@ -101,6 +101,7 @@ const TabsItem = /*#__PURE__*/_react.default.forwardRef((_ref4, ref) => {
|
|
|
101
101
|
selected
|
|
102
102
|
} : undefined,
|
|
103
103
|
id,
|
|
104
|
+
render,
|
|
104
105
|
...rawRest
|
|
105
106
|
} = _ref4;
|
|
106
107
|
// Convert onClick etc to onPress etc if used in an integration
|
|
@@ -156,6 +157,10 @@ const TabsItem = /*#__PURE__*/_react.default.forwardRef((_ref4, ref) => {
|
|
|
156
157
|
}
|
|
157
158
|
// itemPositions is a ref object so this should only re-run when `selected` (or `index`) change
|
|
158
159
|
}, [selected, index, itemPositions]);
|
|
160
|
+
if (render) return render({
|
|
161
|
+
selected,
|
|
162
|
+
handlePress
|
|
163
|
+
});
|
|
159
164
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
160
165
|
ref: ref,
|
|
161
166
|
onPress: handlePress,
|
|
@@ -213,7 +218,8 @@ TabsItem.propTypes = {
|
|
|
213
218
|
selected: _propTypes.default.bool,
|
|
214
219
|
itemPositions: itemPositionsPropType,
|
|
215
220
|
children: _propTypes.default.string,
|
|
216
|
-
id: _propTypes.default.string
|
|
221
|
+
id: _propTypes.default.string,
|
|
222
|
+
render: _propTypes.default.func
|
|
217
223
|
};
|
|
218
224
|
const staticStyles = _StyleSheet.default.create({
|
|
219
225
|
center: {
|
package/lib/index.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
A11yText: true,
|
|
8
|
+
ActionCard: true,
|
|
8
9
|
ActivityIndicator: true,
|
|
9
10
|
Autocomplete: true,
|
|
10
11
|
Box: true,
|
|
@@ -97,6 +98,12 @@ Object.defineProperty(exports, "Accordion", {
|
|
|
97
98
|
return _ExpandCollapse.Accordion;
|
|
98
99
|
}
|
|
99
100
|
});
|
|
101
|
+
Object.defineProperty(exports, "ActionCard", {
|
|
102
|
+
enumerable: true,
|
|
103
|
+
get: function () {
|
|
104
|
+
return _ActionCard.default;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
100
107
|
Object.defineProperty(exports, "ActivityIndicator", {
|
|
101
108
|
enumerable: true,
|
|
102
109
|
get: function () {
|
|
@@ -524,6 +531,7 @@ Object.defineProperty(exports, "useViewport", {
|
|
|
524
531
|
}
|
|
525
532
|
});
|
|
526
533
|
var _A11yText = _interopRequireDefault(require("./A11yText"));
|
|
534
|
+
var _ActionCard = _interopRequireDefault(require("./ActionCard"));
|
|
527
535
|
var _ActivityIndicator = _interopRequireDefault(require("./ActivityIndicator"));
|
|
528
536
|
var _Autocomplete = _interopRequireDefault(require("./Autocomplete"));
|
|
529
537
|
var _Box = _interopRequireDefault(require("./Box"));
|
|
@@ -58,8 +58,8 @@ function useVerticalExpandAnimation(_ref) {
|
|
|
58
58
|
if (isAnimating || expandStateChanged) containerStyles.overflow = 'hidden';
|
|
59
59
|
if (!isExpanded && !isAnimating && !expandStateChanged) {
|
|
60
60
|
if (_Platform.default.OS === 'web') {
|
|
61
|
-
// Without `
|
|
62
|
-
containerStyles.
|
|
61
|
+
// Without `display: 'none', descendents are focusable on web even when collapsed.
|
|
62
|
+
containerStyles.display = 'none';
|
|
63
63
|
} else {
|
|
64
64
|
// There's no `visibility: hidden` in React Native, and display: none causes a flicker on expand.
|
|
65
65
|
// Without some form of hiding, some children leak through even when closed e.g. `List.Item` bullets.
|
|
@@ -73,7 +73,7 @@ function useVerticalExpandAnimation(_ref) {
|
|
|
73
73
|
// on web we can hide the contents until we have the container measured and avoid occasional jitter
|
|
74
74
|
// this won't work on native platforms
|
|
75
75
|
containerStyles.height = 0;
|
|
76
|
-
containerStyles.
|
|
76
|
+
containerStyles.display = 'none';
|
|
77
77
|
}
|
|
78
78
|
} else if (_Platform.default.OS === 'web') {
|
|
79
79
|
const transitionDuration = isExpanded ? expandDuration : collapseDuration;
|
|
@@ -113,7 +113,7 @@ const getTokensPropType = function () {
|
|
|
113
113
|
* For example, for a set of tokens used in a common style, or for a set of tokens required by
|
|
114
114
|
* a themeless component whose tokens are set by a parent but requires tokens of a certain shape.
|
|
115
115
|
*
|
|
116
|
-
* By default, requires an object with a complete set of tokens (allowing `null
|
|
116
|
+
* By default, requires an object with a complete set of tokens (allowing `null` and `undefined`).
|
|
117
117
|
*
|
|
118
118
|
* @param {string[]} componentTokenKeys - array of strings of token names
|
|
119
119
|
* @param {object} [options]
|
|
@@ -133,7 +133,7 @@ const getTokensSetPropType = function (componentTokenKeys) {
|
|
|
133
133
|
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
134
134
|
args[_key2 - 2] = arguments[_key2];
|
|
135
135
|
}
|
|
136
|
-
return props[propName] !== null && tokenValueType.isRequired(props, propName, ...args);
|
|
136
|
+
return props[propName] !== null && props[propName] !== undefined && tokenValueType.isRequired(props, propName, ...args);
|
|
137
137
|
}])));
|
|
138
138
|
return allowFunction ? _propTypes.default.oneOfType([tokensObjectValidator, _propTypes.default.func]) : tokensObjectValidator;
|
|
139
139
|
};
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Animated from "react-native-web/dist/exports/Animated";
|
|
3
|
+
import View from "react-native-web/dist/exports/View";
|
|
4
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
|
+
import Text from "react-native-web/dist/exports/Text";
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
|
|
8
|
+
import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps, wrapStringsInText, clickProps, hrefAttrsProp, linkProps } from '../utils';
|
|
9
|
+
import Icon from '../Icon';
|
|
10
|
+
import Card from '../Card';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, linkProps, viewProps]);
|
|
14
|
+
const selectCardStyles = styles => ['borderColor', 'borderRadius', 'borderWidth'].reduce((acc, key) => {
|
|
15
|
+
if (styles[key]) acc[key] = styles[key];
|
|
16
|
+
return acc;
|
|
17
|
+
}, {});
|
|
18
|
+
const selectInteractiveCardStyles = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
backgroundColor,
|
|
21
|
+
paddingBottom,
|
|
22
|
+
paddingLeft,
|
|
23
|
+
paddingRight,
|
|
24
|
+
paddingTop
|
|
25
|
+
} = _ref;
|
|
26
|
+
return {
|
|
27
|
+
...(backgroundColor && {
|
|
28
|
+
backgroundColor
|
|
29
|
+
}),
|
|
30
|
+
paddingBottom,
|
|
31
|
+
paddingLeft,
|
|
32
|
+
paddingRight,
|
|
33
|
+
paddingTop
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const selectIconStyles = _ref2 => {
|
|
37
|
+
let {
|
|
38
|
+
iconMarginBottom,
|
|
39
|
+
iconMarginLeft,
|
|
40
|
+
iconMarginRight,
|
|
41
|
+
iconMarginTop
|
|
42
|
+
} = _ref2;
|
|
43
|
+
return {
|
|
44
|
+
marginBottom: iconMarginBottom,
|
|
45
|
+
marginLeft: iconMarginLeft,
|
|
46
|
+
marginRight: iconMarginRight,
|
|
47
|
+
marginTop: iconMarginTop
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const selectIconProps = _ref3 => {
|
|
51
|
+
let {
|
|
52
|
+
icon,
|
|
53
|
+
iconBackgroundColor,
|
|
54
|
+
iconColor
|
|
55
|
+
} = _ref3;
|
|
56
|
+
return {
|
|
57
|
+
icon,
|
|
58
|
+
variant: {
|
|
59
|
+
background: true,
|
|
60
|
+
padding: 'small'
|
|
61
|
+
},
|
|
62
|
+
tokens: {
|
|
63
|
+
backgroundColor: iconBackgroundColor,
|
|
64
|
+
color: iconColor
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const selectTitleStyles = _ref4 => {
|
|
69
|
+
let {
|
|
70
|
+
titleMarginBottom,
|
|
71
|
+
titleMarginLeft,
|
|
72
|
+
titleMarginRight,
|
|
73
|
+
titleMarginTop
|
|
74
|
+
} = _ref4;
|
|
75
|
+
return {
|
|
76
|
+
marginBottom: titleMarginBottom,
|
|
77
|
+
marginLeft: titleMarginLeft,
|
|
78
|
+
marginRight: titleMarginRight,
|
|
79
|
+
marginTop: titleMarginTop
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
const selectTitleTextStyles = _ref5 => {
|
|
83
|
+
let {
|
|
84
|
+
titleFontColor,
|
|
85
|
+
titleFontName,
|
|
86
|
+
titleFontSize,
|
|
87
|
+
titleFontWeight,
|
|
88
|
+
titleLineHeight
|
|
89
|
+
} = _ref5;
|
|
90
|
+
return applyTextStyles({
|
|
91
|
+
fontColor: titleFontColor,
|
|
92
|
+
fontName: titleFontName,
|
|
93
|
+
fontSize: titleFontSize,
|
|
94
|
+
fontWeight: titleFontWeight,
|
|
95
|
+
lineHeight: titleLineHeight
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
const selectContentStyles = _ref6 => {
|
|
99
|
+
let {
|
|
100
|
+
contentMarginBottom,
|
|
101
|
+
contentMarginLeft,
|
|
102
|
+
contentMarginRight,
|
|
103
|
+
contentMarginTop
|
|
104
|
+
} = _ref6;
|
|
105
|
+
return {
|
|
106
|
+
marginBottom: contentMarginBottom,
|
|
107
|
+
marginLeft: contentMarginLeft,
|
|
108
|
+
marginRight: contentMarginRight,
|
|
109
|
+
marginTop: contentMarginTop
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
const selectContentTextStyles = _ref7 => {
|
|
113
|
+
let {
|
|
114
|
+
contentFontColor,
|
|
115
|
+
contentFontName,
|
|
116
|
+
contentFontSize,
|
|
117
|
+
contentFontWeight,
|
|
118
|
+
contentLineHeight
|
|
119
|
+
} = _ref7;
|
|
120
|
+
return applyTextStyles({
|
|
121
|
+
fontColor: contentFontColor,
|
|
122
|
+
fontName: contentFontName,
|
|
123
|
+
fontSize: contentFontSize,
|
|
124
|
+
fontWeight: contentFontWeight,
|
|
125
|
+
lineHeight: contentLineHeight
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const selectStatusIconProps = _ref8 => {
|
|
129
|
+
let {
|
|
130
|
+
statusIcon,
|
|
131
|
+
statusIconColor
|
|
132
|
+
} = _ref8;
|
|
133
|
+
return {
|
|
134
|
+
icon: statusIcon,
|
|
135
|
+
tokens: {
|
|
136
|
+
color: statusIconColor
|
|
137
|
+
},
|
|
138
|
+
variant: {
|
|
139
|
+
size: 'micro'
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
const selectActionIconStyles = _ref9 => {
|
|
144
|
+
let {
|
|
145
|
+
actionIconMarginBottom,
|
|
146
|
+
actionIconMarginLeft,
|
|
147
|
+
actionIconMarginRight,
|
|
148
|
+
actionIconMarginTop
|
|
149
|
+
} = _ref9;
|
|
150
|
+
return {
|
|
151
|
+
marginBottom: actionIconMarginBottom,
|
|
152
|
+
marginLeft: actionIconMarginLeft,
|
|
153
|
+
marginRight: actionIconMarginRight,
|
|
154
|
+
marginTop: actionIconMarginTop
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
const selectActionIconProps = _ref10 => {
|
|
158
|
+
let {
|
|
159
|
+
actionIcon,
|
|
160
|
+
actionIconColor
|
|
161
|
+
} = _ref10;
|
|
162
|
+
return {
|
|
163
|
+
icon: actionIcon,
|
|
164
|
+
tokens: {
|
|
165
|
+
color: actionIconColor
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
const ACTION_ICON_ANIMATION_DURATION = 100;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* ActionCard component represents a card with an action that can be triggered by the user.
|
|
173
|
+
*
|
|
174
|
+
* @component
|
|
175
|
+
* @example
|
|
176
|
+
* return (
|
|
177
|
+
* <ActionCard
|
|
178
|
+
* icon={<Icon icon={Icons.EyeMasked} />}
|
|
179
|
+
* title="Like"
|
|
180
|
+
* href="/like"
|
|
181
|
+
* accessibilityRole="link"
|
|
182
|
+
* tokens={themeTokens}
|
|
183
|
+
* variant={{validation: 'warning'}}
|
|
184
|
+
* onPress={() => handleLike()}
|
|
185
|
+
* >
|
|
186
|
+
* Click here to like the post
|
|
187
|
+
* </ActionCard>
|
|
188
|
+
* )
|
|
189
|
+
*/
|
|
190
|
+
const ActionCard = /*#__PURE__*/React.forwardRef((_ref11, ref) => {
|
|
191
|
+
let {
|
|
192
|
+
icon,
|
|
193
|
+
title,
|
|
194
|
+
children,
|
|
195
|
+
href,
|
|
196
|
+
direction = true,
|
|
197
|
+
accessibilityRole,
|
|
198
|
+
tokens,
|
|
199
|
+
variant,
|
|
200
|
+
...rest
|
|
201
|
+
} = _ref11;
|
|
202
|
+
const themeTokens = useThemeTokens('ActionCard', tokens, variant);
|
|
203
|
+
const actionIconAnimation = React.useRef(new Animated.Value(0)).current;
|
|
204
|
+
const {
|
|
205
|
+
onPress,
|
|
206
|
+
...props
|
|
207
|
+
} = clickProps.toPressProps(rest);
|
|
208
|
+
const {
|
|
209
|
+
hrefAttrs,
|
|
210
|
+
rawRest
|
|
211
|
+
} = hrefAttrsProp.bundle(props);
|
|
212
|
+
const selectedProps = selectProps({
|
|
213
|
+
accessibilityRole,
|
|
214
|
+
href,
|
|
215
|
+
onPress: linkProps.handleHref({
|
|
216
|
+
href,
|
|
217
|
+
onPress
|
|
218
|
+
}),
|
|
219
|
+
hrefAttrs,
|
|
220
|
+
...rawRest
|
|
221
|
+
});
|
|
222
|
+
return /*#__PURE__*/_jsx(Card, {
|
|
223
|
+
ref: ref,
|
|
224
|
+
interactiveCard: {
|
|
225
|
+
body: pressableState => {
|
|
226
|
+
const animate = pressableState.pressed || pressableState.hover || pressableState.focus;
|
|
227
|
+
Animated.timing(actionIconAnimation, {
|
|
228
|
+
toValue: animate ? themeTokens.actionIconTranslate : 0,
|
|
229
|
+
duration: ACTION_ICON_ANIMATION_DURATION,
|
|
230
|
+
useNativeDriver: false
|
|
231
|
+
}).start();
|
|
232
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
233
|
+
style: staticStyles.container,
|
|
234
|
+
children: [icon && /*#__PURE__*/_jsx(View, {
|
|
235
|
+
style: selectIconStyles(themeTokens),
|
|
236
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
237
|
+
...selectIconProps({
|
|
238
|
+
icon,
|
|
239
|
+
...themeTokens
|
|
240
|
+
})
|
|
241
|
+
})
|
|
242
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
243
|
+
style: staticStyles.content,
|
|
244
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
245
|
+
style: staticStyles.header,
|
|
246
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
247
|
+
style: [selectTitleStyles(themeTokens), staticStyles.title],
|
|
248
|
+
children: /*#__PURE__*/_jsxs(Text, {
|
|
249
|
+
children: [wrapStringsInText(title, {
|
|
250
|
+
style: selectTitleTextStyles(themeTokens)
|
|
251
|
+
}), themeTokens.statusIcon && /*#__PURE__*/_jsx(View, {
|
|
252
|
+
style: staticStyles.statusIcon,
|
|
253
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
254
|
+
...selectStatusIconProps(themeTokens)
|
|
255
|
+
})
|
|
256
|
+
})]
|
|
257
|
+
})
|
|
258
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
259
|
+
style: staticStyles.icons,
|
|
260
|
+
children: direction && /*#__PURE__*/_jsx(Animated.View, {
|
|
261
|
+
style: [selectActionIconStyles(themeTokens), {
|
|
262
|
+
transform: [{
|
|
263
|
+
translateX: actionIconAnimation
|
|
264
|
+
}]
|
|
265
|
+
}],
|
|
266
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
267
|
+
...selectActionIconProps(themeTokens)
|
|
268
|
+
})
|
|
269
|
+
})
|
|
270
|
+
})]
|
|
271
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
272
|
+
style: [staticStyles.body, selectContentStyles(themeTokens)],
|
|
273
|
+
children: typeof children === 'string' ? wrapStringsInText(children, {
|
|
274
|
+
style: selectContentTextStyles(themeTokens)
|
|
275
|
+
}) : children
|
|
276
|
+
})]
|
|
277
|
+
})]
|
|
278
|
+
});
|
|
279
|
+
},
|
|
280
|
+
tokens: selectInteractiveCardStyles(themeTokens)
|
|
281
|
+
},
|
|
282
|
+
tokens: selectCardStyles(themeTokens),
|
|
283
|
+
...selectedProps
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
ActionCard.displayName = 'ActionCard';
|
|
287
|
+
ActionCard.propTypes = {
|
|
288
|
+
...selectedSystemPropTypes,
|
|
289
|
+
tokens: getTokensPropType('ActionCard'),
|
|
290
|
+
variant: variantProp.propType,
|
|
291
|
+
/**
|
|
292
|
+
* Icon for the ActionCard
|
|
293
|
+
*/
|
|
294
|
+
icon: PropTypes.elementType,
|
|
295
|
+
/**
|
|
296
|
+
* Title for the ActionCard
|
|
297
|
+
*/
|
|
298
|
+
title: PropTypes.string,
|
|
299
|
+
/**
|
|
300
|
+
* Children for the ActionCard
|
|
301
|
+
*/
|
|
302
|
+
children: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
303
|
+
/**
|
|
304
|
+
* href for the ActionCard
|
|
305
|
+
*/
|
|
306
|
+
href: PropTypes.string,
|
|
307
|
+
/**
|
|
308
|
+
* Enable or disable the direction of the ActionCard
|
|
309
|
+
*/
|
|
310
|
+
direction: PropTypes.bool,
|
|
311
|
+
/**
|
|
312
|
+
* AccesibilityRole for the ActionCard
|
|
313
|
+
*/
|
|
314
|
+
accessibilityRole: PropTypes.string
|
|
315
|
+
};
|
|
316
|
+
const staticStyles = StyleSheet.create({
|
|
317
|
+
body: {
|
|
318
|
+
flexDirection: 'column'
|
|
319
|
+
},
|
|
320
|
+
container: {
|
|
321
|
+
flex: 1,
|
|
322
|
+
flexDirection: 'row'
|
|
323
|
+
},
|
|
324
|
+
content: {
|
|
325
|
+
flex: 1,
|
|
326
|
+
flexDirection: 'column'
|
|
327
|
+
},
|
|
328
|
+
icons: {
|
|
329
|
+
flexDirection: 'row',
|
|
330
|
+
alignItems: 'center'
|
|
331
|
+
},
|
|
332
|
+
header: {
|
|
333
|
+
flexDirection: 'row',
|
|
334
|
+
justifyContent: 'space-between'
|
|
335
|
+
},
|
|
336
|
+
title: {
|
|
337
|
+
flexShrink: 1
|
|
338
|
+
},
|
|
339
|
+
statusIcon: {
|
|
340
|
+
marginLeft: 4
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
export default ActionCard;
|
package/lib-module/Card/Card.js
CHANGED
|
@@ -4,7 +4,7 @@ import View from "react-native-web/dist/exports/View";
|
|
|
4
4
|
import { useThemeTokens, useThemeTokensCallback, useResponsiveThemeTokens, useTheme } from '../ThemeProvider';
|
|
5
5
|
import { getTokensPropType, variantProp, StyleSheet, createMediaQueryStyles } from '../utils';
|
|
6
6
|
import { useViewport } from '../ViewportProvider';
|
|
7
|
-
import { a11yProps, selectSystemProps, viewProps } from '../utils/props';
|
|
7
|
+
import { a11yProps, linkProps, selectSystemProps, viewProps } from '../utils/props';
|
|
8
8
|
import CardBase from './CardBase';
|
|
9
9
|
import PressableCardBase from './PressableCardBase';
|
|
10
10
|
import CheckboxButton from '../Checkbox/CheckboxButton';
|
|
@@ -12,7 +12,7 @@ import RadioButton from '../Radio/RadioButton';
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
15
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps, linkProps]);
|
|
16
16
|
const SelectionType = {
|
|
17
17
|
Checkbox: 'checkbox',
|
|
18
18
|
Radio: 'radiogroup',
|
|
@@ -267,7 +267,7 @@ const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
267
267
|
isChecked: selected || (cardState === null || cardState === void 0 ? void 0 : cardState.hover),
|
|
268
268
|
isInactive: inactive,
|
|
269
269
|
onPress
|
|
270
|
-
})), interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body]
|
|
270
|
+
})), typeof (interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body) === 'function' ? interactiveCard.body(cardState) : interactiveCard.body]
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
}), children && selectionType !== SelectionType.None ? renderNoSelectionView() : null]
|
|
@@ -309,7 +309,7 @@ Card.propTypes = {
|
|
|
309
309
|
* - variant: The variant to be used for the interactive card
|
|
310
310
|
*/
|
|
311
311
|
interactiveCard: PropTypes.shape({
|
|
312
|
-
body: PropTypes.node,
|
|
312
|
+
body: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
313
313
|
tokens: getTokensPropType('Card'),
|
|
314
314
|
selectionType: PropTypes.oneOf(Object.values(SelectionType)),
|
|
315
315
|
variant: variantProp.propType
|
|
@@ -104,7 +104,7 @@ PressableCardBase.propTypes = {
|
|
|
104
104
|
...selectedSystemPropTypes,
|
|
105
105
|
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
106
106
|
tokens: getTokensSetPropType(tokenKeys, {
|
|
107
|
-
|
|
107
|
+
partial: true,
|
|
108
108
|
allowFunction: true
|
|
109
109
|
}),
|
|
110
110
|
variant: variantProp.propType
|
|
@@ -204,6 +204,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
|
204
204
|
onKeyDown: handleKeyDown,
|
|
205
205
|
onPress: handleChange,
|
|
206
206
|
...selectedProps,
|
|
207
|
+
style: staticStyles.removeOutline,
|
|
207
208
|
children: _ref6 => {
|
|
208
209
|
let {
|
|
209
210
|
focused: focus,
|
|
@@ -335,5 +336,8 @@ const staticStyles = StyleSheet.create({
|
|
|
335
336
|
alignWithLabel: {
|
|
336
337
|
alignSelf: 'flex-start',
|
|
337
338
|
justifyContent: 'center'
|
|
339
|
+
},
|
|
340
|
+
removeOutline: {
|
|
341
|
+
outlineStyle: 'none'
|
|
338
342
|
}
|
|
339
343
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import View from "react-native-web/dist/exports/View";
|
|
4
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
3
5
|
import { useThemeTokensCallback } from '../ThemeProvider';
|
|
4
6
|
import LinkBase from './LinkBase';
|
|
5
7
|
import { variantProp } from '../utils';
|
|
@@ -20,15 +22,23 @@ const TextButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
20
22
|
...linkProps
|
|
21
23
|
} = _ref;
|
|
22
24
|
const getTokens = useThemeTokensCallback('Link', tokens, variant);
|
|
23
|
-
return /*#__PURE__*/_jsx(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
return /*#__PURE__*/_jsx(View, {
|
|
26
|
+
style: styles.textButton,
|
|
27
|
+
children: /*#__PURE__*/_jsx(LinkBase, {
|
|
28
|
+
onPress: onPress,
|
|
29
|
+
accessibilityRole: accessibilityRole,
|
|
30
|
+
tokens: getTokens,
|
|
31
|
+
ref: ref,
|
|
32
|
+
...linkProps,
|
|
33
|
+
children: children
|
|
34
|
+
})
|
|
30
35
|
});
|
|
31
36
|
});
|
|
37
|
+
const styles = StyleSheet.create({
|
|
38
|
+
textButton: {
|
|
39
|
+
flex: 1
|
|
40
|
+
}
|
|
41
|
+
});
|
|
32
42
|
TextButton.displayName = 'TextButton';
|
|
33
43
|
TextButton.propTypes = {
|
|
34
44
|
...LinkBase.propTypes,
|
package/lib-module/List/List.js
CHANGED
|
@@ -42,15 +42,22 @@ const List = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
42
42
|
}
|
|
43
43
|
return child;
|
|
44
44
|
});
|
|
45
|
-
|
|
46
|
-
ref: ref,
|
|
45
|
+
const content = /*#__PURE__*/_jsx(View, {
|
|
47
46
|
style: styles.list,
|
|
48
47
|
accessibilityRole: accessibilityRole,
|
|
48
|
+
ref: ref,
|
|
49
49
|
...selectProps(rest),
|
|
50
50
|
children: items
|
|
51
51
|
});
|
|
52
|
+
return Platform.OS === 'web' ? /*#__PURE__*/_jsx("div", {
|
|
53
|
+
style: styles.container,
|
|
54
|
+
children: content
|
|
55
|
+
}) : content;
|
|
52
56
|
});
|
|
53
57
|
const styles = StyleSheet.create({
|
|
58
|
+
container: {
|
|
59
|
+
display: 'block'
|
|
60
|
+
},
|
|
54
61
|
list: {
|
|
55
62
|
flex: 1,
|
|
56
63
|
flexShrink: 1
|
|
@@ -18,10 +18,11 @@ const selectItemTextStyles = (_ref, themeOptions) => {
|
|
|
18
18
|
itemFontSize,
|
|
19
19
|
itemLineHeight,
|
|
20
20
|
itemFontName,
|
|
21
|
-
itemFontColor
|
|
21
|
+
itemFontColor,
|
|
22
|
+
itemTextColor
|
|
22
23
|
} = _ref;
|
|
23
24
|
return applyTextStyles({
|
|
24
|
-
fontColor: itemFontColor,
|
|
25
|
+
fontColor: itemFontColor || itemTextColor,
|
|
25
26
|
fontWeight: itemFontWeight,
|
|
26
27
|
fontSize: itemFontSize,
|
|
27
28
|
lineHeight: itemLineHeight,
|
|
@@ -135,14 +135,12 @@ const ModalContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
135
135
|
},
|
|
136
136
|
onPress: onConfirm,
|
|
137
137
|
children: confirmButtonText
|
|
138
|
-
}), hasCancelButton ? /*#__PURE__*/_jsx(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
children: cancelButtonText
|
|
145
|
-
})
|
|
138
|
+
}), hasCancelButton ? /*#__PURE__*/_jsx(CancelButton, {
|
|
139
|
+
tokens: {
|
|
140
|
+
color: cancelButtonColor
|
|
141
|
+
},
|
|
142
|
+
onPress: onCancel,
|
|
143
|
+
children: cancelButtonText
|
|
146
144
|
}) : null]
|
|
147
145
|
})]
|
|
148
146
|
});
|