@telus-uds/components-base 1.14.2 → 1.16.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 +40 -2
- package/__tests17__/A11yText/A11yText.test.jsx +34 -0
- package/__tests17__/ActivityIndicator/ActivityIndicator.test.jsx +68 -0
- package/__tests17__/ActivityIndicator/__snapshots__/ActivityIndicator.test.jsx.snap +299 -0
- package/__tests17__/Box/Box.test.jsx +111 -0
- package/__tests17__/Button/Button.test.jsx +86 -0
- package/__tests17__/Button/ButtonBase.test.jsx +82 -0
- package/__tests17__/Button/ButtonGroup.test.jsx +347 -0
- package/__tests17__/Button/ButtonLink.test.jsx +61 -0
- package/__tests17__/Card/Card.test.jsx +63 -0
- package/__tests17__/Carousel/Carousel.test.jsx +128 -0
- package/__tests17__/Carousel/CarouselTabs.test.jsx +142 -0
- package/__tests17__/Checkbox/Checkbox.test.jsx +94 -0
- package/__tests17__/Checkbox/CheckboxGroup.test.jsx +246 -0
- package/__tests17__/Divider/Divider.test.jsx +91 -0
- package/__tests17__/ExpandCollapse/ExpandCollapse.test.jsx +109 -0
- package/__tests17__/Feedback/Feedback.test.jsx +42 -0
- package/__tests17__/FlexGrid/Col.test.jsx +261 -0
- package/__tests17__/FlexGrid/FlexGrid.test.jsx +136 -0
- package/__tests17__/FlexGrid/Row.test.jsx +273 -0
- package/__tests17__/HorizontalScroll/HorizontalScroll.test.jsx +165 -0
- package/__tests17__/Icon/Icon.test.jsx +61 -0
- package/__tests17__/IconButton/IconButton.test.jsx +52 -0
- package/__tests17__/InputLabel/InputLabel.test.jsx +28 -0
- package/__tests17__/InputLabel/__snapshots__/InputLabel.test.jsx.snap +3 -0
- package/__tests17__/InputSupports/InputSupports.test.jsx +60 -0
- package/__tests17__/Link/Link.test.jsx +63 -0
- package/__tests17__/Link/TextButton.test.jsx +35 -0
- package/__tests17__/List/List.test.jsx +82 -0
- package/__tests17__/Modal/Modal.test.jsx +47 -0
- package/__tests17__/Notification/Notification.test.jsx +20 -0
- package/__tests17__/Pagination/Pagination.test.jsx +160 -0
- package/__tests17__/Progress/Progress.test.jsx +79 -0
- package/__tests17__/Radio/Radio.test.jsx +87 -0
- package/__tests17__/Radio/RadioGroup.test.jsx +220 -0
- package/__tests17__/RadioCard/RadioCard.test.jsx +87 -0
- package/__tests17__/RadioCard/RadioCardGroup.test.jsx +246 -0
- package/__tests17__/Search/Search.test.jsx +87 -0
- package/__tests17__/Select/Select.test.jsx +94 -0
- package/__tests17__/SideNav/SideNav.test.jsx +110 -0
- package/__tests17__/Skeleton/Skeleton.test.jsx +61 -0
- package/__tests17__/SkipLink/SkipLink.test.jsx +61 -0
- package/__tests17__/Spacer/Spacer.test.jsx +63 -0
- package/__tests17__/StackView/StackView.test.jsx +211 -0
- package/__tests17__/StackView/StackWrap.test.jsx +47 -0
- package/__tests17__/StackView/getStackedContent.test.jsx +295 -0
- package/__tests17__/StepTracker/StepTracker.test.jsx +108 -0
- package/__tests17__/Tabs/Tabs.test.jsx +49 -0
- package/__tests17__/Tags/Tags.test.jsx +327 -0
- package/__tests17__/TextInput/TextArea.test.jsx +35 -0
- package/__tests17__/TextInput/TextInputBase.test.jsx +125 -0
- package/__tests17__/ThemeProvider/ThemeProvider.test.jsx +80 -0
- package/__tests17__/ThemeProvider/useThemeTokens.test.jsx +514 -0
- package/__tests17__/ThemeProvider/utils/theme-tokens.test.js +41 -0
- package/__tests17__/ToggleSwitch/ToggleSwitch.test.jsx +82 -0
- package/__tests17__/ToggleSwitch/ToggleSwitchGroup.test.jsx +192 -0
- package/__tests17__/Tooltip/Tooltip.test.jsx +65 -0
- package/__tests17__/Tooltip/getTooltipPosition.test.js +79 -0
- package/__tests17__/Typography/typography.test.jsx +90 -0
- package/__tests17__/utils/children.test.jsx +128 -0
- package/__tests17__/utils/containUniqueFields.test.js +25 -0
- package/__tests17__/utils/input.test.js +375 -0
- package/__tests17__/utils/props.test.js +36 -0
- package/__tests17__/utils/semantics.test.jsx +34 -0
- package/__tests17__/utils/useCopy.test.js +42 -0
- package/__tests17__/utils/useResponsiveProp.test.jsx +202 -0
- package/__tests17__/utils/useSpacingScale.test.jsx +273 -0
- package/__tests17__/utils/useUniqueId.test.js +31 -0
- package/component-docs.json +120 -85
- package/lib/A11yInfoProvider/index.js +14 -5
- package/lib/Button/ButtonGroup.js +3 -2
- package/lib/Carousel/Carousel.js +18 -2
- package/lib/Carousel/CarouselTabs/CarouselTabs.js +6 -7
- package/lib/Checkbox/Checkbox.js +9 -6
- package/lib/ExpandCollapse/Control.js +6 -5
- package/lib/ExpandCollapse/Panel.js +5 -4
- package/lib/List/ListItem.js +10 -236
- package/lib/List/ListItemBase.js +162 -0
- package/lib/List/ListItemContent.js +85 -0
- package/lib/List/ListItemMark.js +158 -0
- package/lib/List/PressableListItemBase.js +147 -0
- package/lib/Notification/Notification.js +2 -1
- package/lib/Pagination/Pagination.js +4 -3
- package/lib/Radio/Radio.js +9 -6
- package/lib/RadioCard/RadioCard.js +9 -6
- package/lib/Select/Select.js +1 -0
- package/lib/Skeleton/Skeleton.js +18 -13
- package/lib/Skeleton/useSkeletonNativeAnimation.js +4 -2
- package/lib/Tabs/Tabs.js +12 -3
- package/lib/Tags/Tags.js +3 -3
- package/lib/TextInput/TextInput.js +5 -4
- package/lib/ToggleSwitch/ToggleSwitch.js +24 -19
- package/lib/ViewportProvider/useViewportListener.js +11 -5
- package/lib/utils/hasOwnProperty.js +18 -0
- package/lib/utils/props/a11yProps.js +171 -1
- package/lib/utils/props/getPropSelector.js +47 -5
- package/lib/utils/ssr.js +116 -1
- package/lib/utils/useResponsiveProp.js +5 -3
- package/lib/utils/withLinkRouter.js +3 -5
- package/lib-module/A11yInfoProvider/index.js +14 -4
- package/lib-module/Button/ButtonGroup.js +3 -2
- package/lib-module/Carousel/Carousel.js +16 -2
- package/lib-module/Carousel/CarouselTabs/CarouselTabs.js +7 -6
- package/lib-module/Checkbox/Checkbox.js +9 -6
- package/lib-module/ExpandCollapse/Control.js +6 -5
- package/lib-module/ExpandCollapse/Panel.js +5 -4
- package/lib-module/List/ListItem.js +13 -235
- package/lib-module/List/ListItemBase.js +139 -0
- package/lib-module/List/ListItemContent.js +66 -0
- package/lib-module/List/ListItemMark.js +143 -0
- package/lib-module/List/PressableListItemBase.js +117 -0
- package/lib-module/Notification/Notification.js +2 -1
- package/lib-module/Pagination/Pagination.js +5 -3
- package/lib-module/Radio/Radio.js +9 -6
- package/lib-module/RadioCard/RadioCard.js +9 -6
- package/lib-module/Select/Select.js +1 -0
- package/lib-module/Skeleton/Skeleton.js +15 -13
- package/lib-module/Skeleton/useSkeletonNativeAnimation.js +3 -2
- package/lib-module/Tabs/Tabs.js +13 -4
- package/lib-module/Tags/Tags.js +3 -3
- package/lib-module/TextInput/TextInput.js +5 -4
- package/lib-module/ToggleSwitch/ToggleSwitch.js +24 -19
- package/lib-module/ViewportProvider/useViewportListener.js +10 -4
- package/lib-module/utils/hasOwnProperty.js +11 -0
- package/lib-module/utils/props/a11yProps.js +169 -1
- package/lib-module/utils/props/getPropSelector.js +44 -5
- package/lib-module/utils/ssr.js +106 -0
- package/lib-module/utils/useResponsiveProp.js +3 -4
- package/lib-module/utils/withLinkRouter.js +3 -5
- package/package.json +12 -17
- package/src/A11yInfoProvider/index.jsx +20 -4
- package/src/Button/ButtonGroup.jsx +4 -2
- package/src/Carousel/Carousel.jsx +15 -2
- package/src/Carousel/CarouselTabs/CarouselTabs.jsx +5 -3
- package/src/Checkbox/Checkbox.jsx +7 -3
- package/src/ExpandCollapse/Control.jsx +8 -5
- package/src/ExpandCollapse/Panel.jsx +7 -5
- package/src/List/ListItem.jsx +12 -191
- package/src/List/ListItemBase.jsx +118 -0
- package/src/List/ListItemContent.jsx +52 -0
- package/src/List/ListItemMark.jsx +99 -0
- package/src/List/PressableListItemBase.jsx +102 -0
- package/src/Notification/Notification.jsx +1 -1
- package/src/Pagination/Pagination.jsx +6 -1
- package/src/Radio/Radio.jsx +7 -3
- package/src/RadioCard/RadioCard.jsx +7 -3
- package/src/Select/Select.jsx +1 -1
- package/src/Skeleton/Skeleton.jsx +25 -19
- package/src/Skeleton/useSkeletonNativeAnimation.js +3 -3
- package/src/Tabs/Tabs.jsx +19 -2
- package/src/Tags/Tags.jsx +3 -3
- package/src/TextInput/TextInput.jsx +4 -4
- package/src/ToggleSwitch/ToggleSwitch.jsx +3 -3
- package/src/ViewportProvider/useViewportListener.js +10 -5
- package/src/utils/hasOwnProperty.js +11 -0
- package/src/utils/props/a11yProps.js +107 -1
- package/src/utils/props/getPropSelector.js +45 -4
- package/src/utils/ssr.jsx +124 -0
- package/src/utils/useResponsiveProp.js +3 -3
- package/src/utils/withLinkRouter.jsx +1 -3
- package/src/utils/ssr.js +0 -35
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tokenTypes = exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
13
|
+
|
|
14
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
15
|
+
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
const tokenTypes = {
|
|
21
|
+
itemIconSize: _propTypes.default.number.isRequired,
|
|
22
|
+
itemIconColor: _propTypes.default.string.isRequired,
|
|
23
|
+
listGutter: _propTypes.default.number.isRequired,
|
|
24
|
+
iconMarginTop: _propTypes.default.number.isRequired
|
|
25
|
+
};
|
|
26
|
+
exports.tokenTypes = tokenTypes;
|
|
27
|
+
|
|
28
|
+
const selectItemIconTokens = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
itemIconSize,
|
|
31
|
+
itemIconColor
|
|
32
|
+
} = _ref;
|
|
33
|
+
return {
|
|
34
|
+
size: itemIconSize,
|
|
35
|
+
color: itemIconColor
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const selectSideItemContainerStyles = _ref2 => {
|
|
40
|
+
let {
|
|
41
|
+
listGutter,
|
|
42
|
+
iconMarginTop
|
|
43
|
+
} = _ref2;
|
|
44
|
+
return {
|
|
45
|
+
marginTop: iconMarginTop,
|
|
46
|
+
marginRight: listGutter
|
|
47
|
+
};
|
|
48
|
+
}; // Align bullets with the top line of text the same way icons are aligned
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
const selectBulletPositioningStyles = _ref3 => {
|
|
52
|
+
let {
|
|
53
|
+
itemIconSize
|
|
54
|
+
} = _ref3;
|
|
55
|
+
return {
|
|
56
|
+
width: itemIconSize,
|
|
57
|
+
height: itemIconSize
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const selectBulletStyles = _ref4 => {
|
|
62
|
+
let {
|
|
63
|
+
itemBulletWidth,
|
|
64
|
+
itemBulletHeight,
|
|
65
|
+
itemBulletColor
|
|
66
|
+
} = _ref4;
|
|
67
|
+
return {
|
|
68
|
+
width: itemBulletWidth,
|
|
69
|
+
height: itemBulletHeight,
|
|
70
|
+
borderRadius: itemBulletHeight / 2,
|
|
71
|
+
backgroundColor: itemBulletColor
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const selectBulletContainerStyles = _ref5 => {
|
|
76
|
+
let {
|
|
77
|
+
itemBulletContainerWidth,
|
|
78
|
+
itemBulletContainerAlign
|
|
79
|
+
} = _ref5;
|
|
80
|
+
return {
|
|
81
|
+
width: itemBulletContainerWidth,
|
|
82
|
+
alignItems: itemBulletContainerAlign
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Subcomponent used within ListItem and similar components for rendering bullets or icons
|
|
87
|
+
* that sit alongside a ListIconContent in a { flexDirection: row } container.
|
|
88
|
+
*
|
|
89
|
+
* It's the responsibility of themes to make sure that the supplied tokens align the
|
|
90
|
+
* icon or bullet nicely against the first line of text in a ListIconContent.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
const ListItemMark = _ref6 => {
|
|
95
|
+
let {
|
|
96
|
+
icon,
|
|
97
|
+
iconColor,
|
|
98
|
+
iconSize,
|
|
99
|
+
tokens = {}
|
|
100
|
+
} = _ref6;
|
|
101
|
+
const IconComponent = icon || /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
|
102
|
+
const themeTokens = typeof tokens === 'function' ? tokens() : tokens;
|
|
103
|
+
const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens);
|
|
104
|
+
|
|
105
|
+
if (icon) {
|
|
106
|
+
const iconTokens = selectItemIconTokens(themeTokens);
|
|
107
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
108
|
+
style: sideItemContainerStyles,
|
|
109
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
110
|
+
size: iconSize || iconTokens.size,
|
|
111
|
+
color: iconColor || iconTokens.color
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
|
|
117
|
+
const itemBulletStyles = selectBulletStyles(themeTokens);
|
|
118
|
+
const itemBulletPositioningStyles = selectBulletPositioningStyles(themeTokens);
|
|
119
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
120
|
+
style: [sideItemContainerStyles, itemBulletContainerStyles],
|
|
121
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
122
|
+
style: [staticStyles.bulletPositioning, itemBulletPositioningStyles],
|
|
123
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
124
|
+
style: itemBulletStyles,
|
|
125
|
+
testID: "unordered-item-bullet"
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
ListItemMark.propTypes = {
|
|
132
|
+
tokens: _propTypes.default.shape(tokenTypes).isRequired,
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Renders side item icon
|
|
136
|
+
*/
|
|
137
|
+
icon: _propTypes.default.elementType,
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Will set display icon color
|
|
141
|
+
*/
|
|
142
|
+
iconColor: _propTypes.default.string,
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Allow the user define the icon size
|
|
146
|
+
*/
|
|
147
|
+
iconSize: _propTypes.default.number
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const staticStyles = _StyleSheet.default.create({
|
|
151
|
+
bulletPositioning: {
|
|
152
|
+
alignItems: 'center',
|
|
153
|
+
justifyContent: 'center'
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
var _default = ListItemMark;
|
|
158
|
+
exports.default = _default;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _airbnbPropTypes = _interopRequireDefault(require("airbnb-prop-types"));
|
|
13
|
+
|
|
14
|
+
var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
|
|
15
|
+
|
|
16
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
17
|
+
|
|
18
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
19
|
+
|
|
20
|
+
var _utils = require("../utils");
|
|
21
|
+
|
|
22
|
+
var _ListItemBase = _interopRequireDefault(require("./ListItemBase"));
|
|
23
|
+
|
|
24
|
+
var _ListItemContent = _interopRequireWildcard(require("./ListItemContent"));
|
|
25
|
+
|
|
26
|
+
var _ListItemMark = _interopRequireWildcard(require("./ListItemMark"));
|
|
27
|
+
|
|
28
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
32
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
const selectPressableStyles = _ref => {
|
|
37
|
+
let {
|
|
38
|
+
backgroundColor,
|
|
39
|
+
paddingLeft,
|
|
40
|
+
paddingRight,
|
|
41
|
+
paddingTop,
|
|
42
|
+
paddingBottom,
|
|
43
|
+
interItemMargin
|
|
44
|
+
} = _ref;
|
|
45
|
+
return {
|
|
46
|
+
backgroundColor,
|
|
47
|
+
paddingLeft,
|
|
48
|
+
paddingRight,
|
|
49
|
+
paddingTop,
|
|
50
|
+
paddingBottom,
|
|
51
|
+
marginBottom: interItemMargin,
|
|
52
|
+
..._Platform.default.select({
|
|
53
|
+
web: {
|
|
54
|
+
outline: 'none'
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const PressableListItemBase = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
61
|
+
let {
|
|
62
|
+
href,
|
|
63
|
+
tokens,
|
|
64
|
+
icon,
|
|
65
|
+
children,
|
|
66
|
+
listItemRef,
|
|
67
|
+
...rest
|
|
68
|
+
} = _ref2;
|
|
69
|
+
|
|
70
|
+
const {
|
|
71
|
+
onPress,
|
|
72
|
+
...props
|
|
73
|
+
} = _utils.clickProps.toPressProps(rest);
|
|
74
|
+
|
|
75
|
+
const {
|
|
76
|
+
hrefAttrs,
|
|
77
|
+
rest: listItemProps
|
|
78
|
+
} = _utils.hrefAttrsProp.bundle(props);
|
|
79
|
+
|
|
80
|
+
const handlePress = _utils.linkProps.handleHref({
|
|
81
|
+
href,
|
|
82
|
+
onPress
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemBase.default, {
|
|
86
|
+
ref: listItemRef,
|
|
87
|
+
tokens: tokens(),
|
|
88
|
+
...listItemProps,
|
|
89
|
+
children: _ref3 => {
|
|
90
|
+
let {
|
|
91
|
+
isLastItem
|
|
92
|
+
} = _ref3;
|
|
93
|
+
|
|
94
|
+
const getTokens = pressableState => (0, _utils.resolvePressableTokens)(tokens, pressableState, {
|
|
95
|
+
last: isLastItem
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const getPressableStyle = pressableState => [staticStyles.itemContainer, selectPressableStyles(getTokens(pressableState))];
|
|
99
|
+
|
|
100
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
101
|
+
onPress: handlePress,
|
|
102
|
+
href: href,
|
|
103
|
+
hrefAttrs: hrefAttrs,
|
|
104
|
+
style: getPressableStyle,
|
|
105
|
+
ref: ref,
|
|
106
|
+
children: pressableState => {
|
|
107
|
+
const themeTokens = getTokens(pressableState);
|
|
108
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
109
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemMark.default, {
|
|
110
|
+
icon: icon,
|
|
111
|
+
tokens: themeTokens
|
|
112
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemContent.default, {
|
|
113
|
+
tokens: themeTokens,
|
|
114
|
+
children: typeof children === 'function' ? children(pressableState) : children
|
|
115
|
+
})]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
PressableListItemBase.displayName = 'PressableListItemBase';
|
|
123
|
+
|
|
124
|
+
const staticStyles = _StyleSheet.default.create({
|
|
125
|
+
itemContainer: {
|
|
126
|
+
flexDirection: 'row',
|
|
127
|
+
flex: 1
|
|
128
|
+
},
|
|
129
|
+
tokens: { ..._ListItemContent.tokenTypes,
|
|
130
|
+
..._ListItemMark.tokenTypes
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
PressableListItemBase.propTypes = {
|
|
135
|
+
href: _propTypes.default.string,
|
|
136
|
+
onPress: _propTypes.default.func,
|
|
137
|
+
// TODO - type this better, maybe import the subcomponent token types and run it through util
|
|
138
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
139
|
+
tokens: _propTypes.default.any,
|
|
140
|
+
icon: _propTypes.default.elementType,
|
|
141
|
+
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
142
|
+
listItemRef: _airbnbPropTypes.default.ref()
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
var _default = (0, _utils.withLinkRouter)(PressableListItemBase);
|
|
146
|
+
|
|
147
|
+
exports.default = _default;
|
|
@@ -165,7 +165,8 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
165
165
|
|
|
166
166
|
const textStyles = selectTextStyles(themeTokens, themeOptions);
|
|
167
167
|
const content = (0, _utils.wrapStringsInText)(typeof children === 'function' ? children({
|
|
168
|
-
textStyles
|
|
168
|
+
textStyles,
|
|
169
|
+
variant
|
|
169
170
|
}) : children, {
|
|
170
171
|
style: textStyles
|
|
171
172
|
});
|
|
@@ -120,12 +120,13 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
if (shouldRenderButton(itemIndex)) {
|
|
123
|
-
return /*#__PURE__*/(0,
|
|
123
|
+
return /*#__PURE__*/(0, _react.createElement)(_PageButton.default, { ...itemProps,
|
|
124
124
|
LinkRouter: ItemLinkRouter,
|
|
125
125
|
linkRouterProps: itemLinkRouterProps,
|
|
126
126
|
label: buttonLabel,
|
|
127
127
|
copy: copy,
|
|
128
|
-
isActive: isItemActive(itemIndex)
|
|
128
|
+
isActive: isItemActive(itemIndex),
|
|
129
|
+
key: buttonLabel
|
|
129
130
|
});
|
|
130
131
|
}
|
|
131
132
|
|
|
@@ -133,7 +134,7 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
133
134
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
134
135
|
style: ellipsisTextStyles,
|
|
135
136
|
children: "..."
|
|
136
|
-
});
|
|
137
|
+
}, "...");
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
return null;
|
package/lib/Radio/Radio.js
CHANGED
|
@@ -175,17 +175,20 @@ const Radio = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
175
175
|
|
|
176
176
|
const uniqueId = (0, _utils.useUniqueId)('radio');
|
|
177
177
|
const inputId = id !== null && id !== void 0 ? id : uniqueId;
|
|
178
|
+
const selectedProps = selectProps({
|
|
179
|
+
accessibilityRole: 'radio',
|
|
180
|
+
accessibilityState: {
|
|
181
|
+
checked: isChecked,
|
|
182
|
+
disabled: inactive
|
|
183
|
+
},
|
|
184
|
+
...rest
|
|
185
|
+
});
|
|
178
186
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
179
187
|
ref: ref,
|
|
180
188
|
disabled: inactive,
|
|
181
189
|
onKeyDown: handleKeyDown,
|
|
182
190
|
onPress: handleChange,
|
|
183
|
-
|
|
184
|
-
accessibilityState: {
|
|
185
|
-
checked: isChecked,
|
|
186
|
-
disabled: inactive
|
|
187
|
-
},
|
|
188
|
-
...selectProps(rest),
|
|
191
|
+
...selectedProps,
|
|
189
192
|
children: _ref5 => {
|
|
190
193
|
let {
|
|
191
194
|
focused: focus,
|
|
@@ -110,18 +110,21 @@ const RadioCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
110
110
|
const {
|
|
111
111
|
themeOptions
|
|
112
112
|
} = (0, _ThemeProvider.useTheme)();
|
|
113
|
+
const selectedProps = selectProps({
|
|
114
|
+
accessibilityRole: 'radio',
|
|
115
|
+
accessibilityState: {
|
|
116
|
+
checked: isChecked,
|
|
117
|
+
disabled: inactive
|
|
118
|
+
},
|
|
119
|
+
...rest
|
|
120
|
+
});
|
|
113
121
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.PressableCardBase, {
|
|
114
122
|
ref: ref,
|
|
115
123
|
inactive: inactive,
|
|
116
124
|
checked: isChecked,
|
|
117
125
|
tokens: getCardTokens,
|
|
118
126
|
onPress: handleChange,
|
|
119
|
-
|
|
120
|
-
accessibilityState: {
|
|
121
|
-
checked: isChecked,
|
|
122
|
-
disabled: inactive
|
|
123
|
-
},
|
|
124
|
-
...selectProps(rest),
|
|
127
|
+
...selectedProps,
|
|
125
128
|
children: cardState => {
|
|
126
129
|
const {
|
|
127
130
|
radioSpace,
|
package/lib/Select/Select.js
CHANGED
|
@@ -258,6 +258,7 @@ const Select = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
|
|
|
258
258
|
} = (0, _ThemeProvider.useTheme)();
|
|
259
259
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputSupports.default, { ...supportsProps,
|
|
260
260
|
...selectedProps,
|
|
261
|
+
validation: validation,
|
|
261
262
|
children: _ref8 => {
|
|
262
263
|
let {
|
|
263
264
|
inputId,
|
package/lib/Skeleton/Skeleton.js
CHANGED
|
@@ -11,6 +11,10 @@ var _Animated = _interopRequireDefault(require("react-native-web/dist/cjs/export
|
|
|
11
11
|
|
|
12
12
|
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
13
13
|
|
|
14
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
15
|
+
|
|
16
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
17
|
+
|
|
14
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
19
|
|
|
16
20
|
var _StackView = _interopRequireDefault(require("../StackView"));
|
|
@@ -36,14 +40,12 @@ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_u
|
|
|
36
40
|
const selectSkeletonStyles = _ref => {
|
|
37
41
|
let {
|
|
38
42
|
color,
|
|
39
|
-
radius
|
|
40
|
-
fadeAnimation
|
|
43
|
+
radius
|
|
41
44
|
} = _ref;
|
|
42
45
|
return {
|
|
43
46
|
backgroundColor: color,
|
|
44
47
|
borderRadius: radius,
|
|
45
|
-
maxWidth: '100%'
|
|
46
|
-
...fadeAnimation
|
|
48
|
+
maxWidth: '100%'
|
|
47
49
|
};
|
|
48
50
|
};
|
|
49
51
|
|
|
@@ -101,12 +103,15 @@ const Skeleton = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
101
103
|
const skeletonHeight = (0, _utils.useSpacingScale)(spacingScaleValue);
|
|
102
104
|
const nativeAnimation = (0, _useSkeletonNativeAnimation.default)();
|
|
103
105
|
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
const getAnimationBasedOnPlatform = () => {
|
|
107
|
+
const animation = _Platform.default.OS === 'web' ? _skeletonWebAnimation.default : nativeAnimation; // We must pass the animation styles through `StyleSheet.create`
|
|
108
|
+
// @see https://github.com/necolas/react-native-web/issues/2387
|
|
109
|
+
|
|
110
|
+
const styles = _StyleSheet.default.create({
|
|
111
|
+
animation
|
|
112
|
+
});
|
|
108
113
|
|
|
109
|
-
return
|
|
114
|
+
return styles.animation;
|
|
110
115
|
};
|
|
111
116
|
|
|
112
117
|
const getLineWidth = () => {
|
|
@@ -140,11 +145,11 @@ const Skeleton = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
140
145
|
|
|
141
146
|
const renderSkeleton = function () {
|
|
142
147
|
let index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
143
|
-
|
|
148
|
+
// @see https://github.com/necolas/react-native-web/issues/2387
|
|
149
|
+
const Component = _Platform.default.OS === 'web' ? _View.default : _Animated.default.View;
|
|
150
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
144
151
|
testID: "skeleton",
|
|
145
|
-
style: [selectSkeletonStyles(
|
|
146
|
-
fadeAnimation: getAnimationBaseOnPlatform()
|
|
147
|
-
}), getStyledBasedOnShape()]
|
|
152
|
+
style: [selectSkeletonStyles(themeTokens), getAnimationBasedOnPlatform(), getStyledBasedOnShape()]
|
|
148
153
|
}, "skeleton-".concat(index + 1));
|
|
149
154
|
};
|
|
150
155
|
|
|
@@ -9,6 +9,8 @@ var _react = require("react");
|
|
|
9
9
|
|
|
10
10
|
var _Animated = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Animated"));
|
|
11
11
|
|
|
12
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
13
|
+
|
|
12
14
|
var _skeleton = require("./skeleton.constant");
|
|
13
15
|
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -19,11 +21,11 @@ const useSkeletonNativeAnimation = () => {
|
|
|
19
21
|
const fade = _Animated.default.sequence([_Animated.default.timing(fadeAnimation, {
|
|
20
22
|
toValue: _skeleton.OPACITY_STOP,
|
|
21
23
|
duration: _skeleton.ANIMATION_DURATION,
|
|
22
|
-
useNativeDriver:
|
|
24
|
+
useNativeDriver: _Platform.default.OS !== 'web'
|
|
23
25
|
}), _Animated.default.timing(fadeAnimation, {
|
|
24
26
|
toValue: _skeleton.DEFAULT_OPACITY,
|
|
25
27
|
duration: _skeleton.ANIMATION_DURATION,
|
|
26
|
-
useNativeDriver:
|
|
28
|
+
useNativeDriver: _Platform.default.OS !== 'web'
|
|
27
29
|
})]);
|
|
28
30
|
|
|
29
31
|
_Animated.default.loop(fade).start();
|
package/lib/Tabs/Tabs.js
CHANGED
|
@@ -30,6 +30,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
30
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; }
|
|
31
31
|
|
|
32
32
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
33
|
+
const [selectItemProps, selectedItemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.pressProps, _utils.viewProps]);
|
|
33
34
|
const {
|
|
34
35
|
selectHorizontalScrollTokens,
|
|
35
36
|
useItemPositions
|
|
@@ -116,15 +117,21 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
116
117
|
label,
|
|
117
118
|
id,
|
|
118
119
|
accessibilityRole = defaultTabItemAccessibiltyRole,
|
|
120
|
+
onPress,
|
|
119
121
|
ref: itemRef,
|
|
120
122
|
LinkRouter: ItemLinkRouter = LinkRouter,
|
|
121
|
-
linkRouterProps: itemLinkRouterProps
|
|
123
|
+
linkRouterProps: itemLinkRouterProps,
|
|
124
|
+
...itemRest
|
|
122
125
|
} = _ref3;
|
|
123
126
|
const itemId = id !== null && id !== void 0 ? id : label;
|
|
124
127
|
const isSelected = Boolean(currentValue && currentValue === itemId);
|
|
125
128
|
|
|
126
|
-
const handlePress = event =>
|
|
129
|
+
const handlePress = event => {
|
|
130
|
+
if (typeof onPress === 'function') onPress(event);
|
|
131
|
+
setValue(itemId, event);
|
|
132
|
+
};
|
|
127
133
|
|
|
134
|
+
const itemProps = selectItemProps(itemRest);
|
|
128
135
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_TabsItem.default, {
|
|
129
136
|
ref: itemRef,
|
|
130
137
|
href: href,
|
|
@@ -139,6 +146,7 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
139
146
|
linkRouterProps: { ...linkRouterProps,
|
|
140
147
|
...itemLinkRouterProps
|
|
141
148
|
},
|
|
149
|
+
...itemProps,
|
|
142
150
|
children: label
|
|
143
151
|
}, itemId);
|
|
144
152
|
})
|
|
@@ -148,7 +156,8 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
148
156
|
Tabs.displayName = 'Tabs';
|
|
149
157
|
Tabs.propTypes = { ...selectedSystemPropTypes,
|
|
150
158
|
..._utils.withLinkRouter.PropTypes,
|
|
151
|
-
items: _propTypes.default.arrayOf(_propTypes.default.shape({ ...
|
|
159
|
+
items: _propTypes.default.arrayOf(_propTypes.default.shape({ ...selectedItemPropTypes,
|
|
160
|
+
..._utils.withLinkRouter.PropTypes,
|
|
152
161
|
href: _propTypes.default.string,
|
|
153
162
|
label: _propTypes.default.string,
|
|
154
163
|
id: _propTypes.default.string,
|
package/lib/Tags/Tags.js
CHANGED
|
@@ -158,14 +158,14 @@ const Tags = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
158
158
|
toggleOneValue(id, event);
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
const itemProps = {
|
|
161
|
+
const itemProps = selectItemProps({
|
|
162
162
|
accessibilityState: {
|
|
163
163
|
checked: isSelected
|
|
164
164
|
},
|
|
165
165
|
accessibilityRole: itemA11yRole,
|
|
166
166
|
..._utils.a11yProps.getPositionInSet(items.length, index),
|
|
167
|
-
...
|
|
168
|
-
};
|
|
167
|
+
...itemRest
|
|
168
|
+
});
|
|
169
169
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
170
170
|
ref: itemRef,
|
|
171
171
|
...pressHandlers,
|
|
@@ -46,6 +46,7 @@ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_u
|
|
|
46
46
|
const TextInput = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
47
47
|
let {
|
|
48
48
|
tokens,
|
|
49
|
+
nativeID,
|
|
49
50
|
variant = {},
|
|
50
51
|
...rest
|
|
51
52
|
} = _ref;
|
|
@@ -60,18 +61,18 @@ const TextInput = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputSupports.default, {
|
|
63
|
-
nativeID:
|
|
64
|
+
nativeID: nativeID,
|
|
64
65
|
...supportsProps,
|
|
65
66
|
children: _ref2 => {
|
|
66
67
|
let {
|
|
67
68
|
inputId,
|
|
68
|
-
...
|
|
69
|
+
...propsFromInputSupports
|
|
69
70
|
} = _ref2;
|
|
70
71
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInputBase.default, {
|
|
71
72
|
ref: ref,
|
|
72
|
-
...inputProps,
|
|
73
73
|
nativeID: inputId,
|
|
74
|
-
...
|
|
74
|
+
...propsFromInputSupports,
|
|
75
|
+
...inputProps
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
});
|