@telus-uds/components-base 3.26.0 → 3.28.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 +35 -2
- package/lib/cjs/Card/Card.js +34 -13
- package/lib/cjs/Card/CardBase.js +90 -14
- package/lib/cjs/Card/PressableCardBase.js +147 -8
- package/lib/cjs/Carousel/Carousel.js +105 -50
- package/lib/cjs/Carousel/CarouselContext.js +10 -4
- package/lib/cjs/Carousel/CarouselItem/CarouselItem.js +11 -7
- package/lib/cjs/Carousel/Constants.js +11 -2
- package/lib/cjs/Checkbox/Checkbox.js +43 -13
- package/lib/cjs/ExpandCollapse/Control.js +5 -1
- package/lib/cjs/ExpandCollapse/ExpandCollapse.js +17 -8
- package/lib/cjs/ExpandCollapse/Panel.js +7 -2
- package/lib/cjs/IconButton/IconButton.js +10 -5
- package/lib/cjs/List/List.js +24 -9
- package/lib/cjs/List/ListItem.js +18 -1
- package/lib/cjs/List/ListItemBase.js +27 -8
- package/lib/cjs/List/ListItemMark.js +33 -62
- package/lib/cjs/List/PressableListItemBase.js +1 -0
- package/lib/cjs/Modal/Modal.js +21 -11
- package/lib/cjs/Progress/Progress.js +19 -5
- package/lib/cjs/Progress/ProgressBar.js +22 -4
- package/lib/cjs/Progress/ProgressContext.js +11 -0
- package/lib/cjs/SideNav/Item.js +3 -3
- package/lib/cjs/SideNav/ItemsGroup.js +46 -19
- package/lib/cjs/SideNav/SideNav.js +29 -13
- package/lib/esm/Card/Card.js +34 -13
- package/lib/esm/Card/CardBase.js +90 -14
- package/lib/esm/Card/PressableCardBase.js +148 -9
- package/lib/esm/Carousel/Carousel.js +106 -51
- package/lib/esm/Carousel/CarouselContext.js +10 -4
- package/lib/esm/Carousel/CarouselItem/CarouselItem.js +11 -7
- package/lib/esm/Carousel/Constants.js +10 -1
- package/lib/esm/Checkbox/Checkbox.js +43 -13
- package/lib/esm/ExpandCollapse/Control.js +5 -1
- package/lib/esm/ExpandCollapse/ExpandCollapse.js +17 -8
- package/lib/esm/ExpandCollapse/Panel.js +7 -2
- package/lib/esm/IconButton/IconButton.js +10 -5
- package/lib/esm/List/List.js +24 -9
- package/lib/esm/List/ListItem.js +19 -2
- package/lib/esm/List/ListItemBase.js +27 -8
- package/lib/esm/List/ListItemMark.js +33 -62
- package/lib/esm/List/PressableListItemBase.js +1 -0
- package/lib/esm/Modal/Modal.js +21 -11
- package/lib/esm/Progress/Progress.js +19 -5
- package/lib/esm/Progress/ProgressBar.js +22 -4
- package/lib/esm/Progress/ProgressContext.js +5 -0
- package/lib/esm/SideNav/Item.js +3 -3
- package/lib/esm/SideNav/ItemsGroup.js +45 -20
- package/lib/esm/SideNav/SideNav.js +29 -13
- package/lib/package.json +2 -2
- package/package.json +2 -2
- package/src/Card/Card.jsx +29 -7
- package/src/Card/CardBase.jsx +97 -11
- package/src/Card/PressableCardBase.jsx +135 -9
- package/src/Carousel/Carousel.jsx +119 -64
- package/src/Carousel/CarouselContext.jsx +12 -4
- package/src/Carousel/CarouselItem/CarouselItem.jsx +10 -6
- package/src/Carousel/Constants.js +10 -0
- package/src/Checkbox/Checkbox.jsx +29 -7
- package/src/ExpandCollapse/Control.jsx +1 -1
- package/src/ExpandCollapse/ExpandCollapse.jsx +9 -8
- package/src/ExpandCollapse/Panel.jsx +10 -2
- package/src/IconButton/IconButton.jsx +40 -28
- package/src/List/List.jsx +33 -9
- package/src/List/ListItem.jsx +33 -11
- package/src/List/ListItemBase.jsx +33 -9
- package/src/List/ListItemMark.jsx +32 -53
- package/src/List/PressableListItemBase.jsx +1 -0
- package/src/Modal/Modal.jsx +23 -11
- package/src/Progress/Progress.jsx +18 -7
- package/src/Progress/ProgressBar.jsx +19 -14
- package/src/Progress/ProgressContext.js +5 -0
- package/src/SideNav/Item.jsx +3 -3
- package/src/SideNav/ItemsGroup.jsx +36 -16
- package/src/SideNav/SideNav.jsx +22 -8
|
@@ -85,6 +85,11 @@ const selectInnerStyle = (_ref2, password) => {
|
|
|
85
85
|
width,
|
|
86
86
|
height
|
|
87
87
|
} = _ref2;
|
|
88
|
+
const basePadding = calculatePadding(padding, borderWidth);
|
|
89
|
+
const calculateSpecificPadding = (specificPadding, specificBorderWidth) => {
|
|
90
|
+
const calculated = calculatePadding(specificPadding ?? padding, specificBorderWidth ?? borderWidth);
|
|
91
|
+
return calculated !== basePadding && calculated !== undefined ? calculated : undefined;
|
|
92
|
+
};
|
|
88
93
|
return {
|
|
89
94
|
// Inner borders animate with the icon and should be treated like a themable feature of the icon
|
|
90
95
|
borderColor,
|
|
@@ -98,11 +103,11 @@ const selectInnerStyle = (_ref2, password) => {
|
|
|
98
103
|
borderRightWidth,
|
|
99
104
|
borderBottomWidth,
|
|
100
105
|
borderLeftWidth,
|
|
101
|
-
padding:
|
|
102
|
-
paddingLeft:
|
|
103
|
-
paddingRight:
|
|
104
|
-
paddingTop:
|
|
105
|
-
paddingBottom:
|
|
106
|
+
padding: basePadding,
|
|
107
|
+
paddingLeft: calculateSpecificPadding(paddingLeft, borderLeftWidth),
|
|
108
|
+
paddingRight: calculateSpecificPadding(paddingRight, borderRightWidth),
|
|
109
|
+
paddingTop: calculateSpecificPadding(paddingTop, borderTopWidth),
|
|
110
|
+
paddingBottom: calculateSpecificPadding(paddingBottom, borderBottomWidth),
|
|
106
111
|
..._Platform.default.select({
|
|
107
112
|
web: {
|
|
108
113
|
pointerEvents: 'none',
|
package/lib/cjs/List/List.js
CHANGED
|
@@ -13,10 +13,15 @@ var _utils = require("../utils");
|
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
16
|
+
const LIST_ITEM_TYPE = 'ListItem';
|
|
17
|
+
const LINKS_ITEM_TYPE = 'LinksItem';
|
|
16
18
|
const isListItem = element => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
if (!element?.type) return false;
|
|
20
|
+
if (element.type.__UDS_COMPONENT_TYPE__ === LIST_ITEM_TYPE) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
const elementName = element.type.displayName || element.type.name || '';
|
|
24
|
+
return elementName === LIST_ITEM_TYPE || elementName.includes(LIST_ITEM_TYPE) || elementName.includes(LINKS_ITEM_TYPE);
|
|
20
25
|
};
|
|
21
26
|
|
|
22
27
|
/**
|
|
@@ -29,6 +34,7 @@ const List = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
29
34
|
showDivider,
|
|
30
35
|
tokens,
|
|
31
36
|
variant,
|
|
37
|
+
iconVerticalAlign,
|
|
32
38
|
accessibilityRole = _Platform.default.select({
|
|
33
39
|
web: 'list',
|
|
34
40
|
default: undefined
|
|
@@ -38,13 +44,17 @@ const List = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
38
44
|
const items = _react.default.Children.map(children, (child, index) => {
|
|
39
45
|
// Pass ListItem-specific props to children (by name so teams can add their own ListItems)
|
|
40
46
|
if (isListItem(child)) {
|
|
41
|
-
|
|
42
|
-
showDivider,
|
|
43
|
-
isLastItem: index + 1 === _react.default.Children.count(children),
|
|
47
|
+
const childProps = {
|
|
44
48
|
tokens,
|
|
45
49
|
variant,
|
|
46
|
-
...child.props
|
|
47
|
-
|
|
50
|
+
...child.props,
|
|
51
|
+
showDivider,
|
|
52
|
+
isLastItem: index + 1 === _react.default.Children.count(children)
|
|
53
|
+
};
|
|
54
|
+
if (!child.props.iconVerticalAlign && iconVerticalAlign) {
|
|
55
|
+
childProps.iconVerticalAlign = iconVerticalAlign;
|
|
56
|
+
}
|
|
57
|
+
return /*#__PURE__*/_react.default.cloneElement(child, childProps);
|
|
48
58
|
}
|
|
49
59
|
return child;
|
|
50
60
|
});
|
|
@@ -78,6 +88,11 @@ List.propTypes = {
|
|
|
78
88
|
/**
|
|
79
89
|
* In case it is not the last item allow display divider
|
|
80
90
|
*/
|
|
81
|
-
showDivider: _propTypes.default.bool
|
|
91
|
+
showDivider: _propTypes.default.bool,
|
|
92
|
+
/**
|
|
93
|
+
* The vertical alignment of the icon in ListItems.
|
|
94
|
+
* This prop is passed down to ListItem components and can be overridden in individual List.Item components.
|
|
95
|
+
*/
|
|
96
|
+
iconVerticalAlign: _propTypes.default.oneOf(['top', 'center', 'bottom'])
|
|
82
97
|
};
|
|
83
98
|
var _default = exports.default = List;
|
package/lib/cjs/List/ListItem.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
9
|
var _ListItemBase = _interopRequireDefault(require("./ListItemBase"));
|
|
9
10
|
var _ThemeProvider = require("../ThemeProvider");
|
|
10
11
|
var _utils = require("../utils");
|
|
@@ -18,6 +19,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
18
19
|
variant,
|
|
19
20
|
children,
|
|
20
21
|
title,
|
|
22
|
+
iconVerticalAlign = 'top',
|
|
21
23
|
...listItemProps
|
|
22
24
|
} = _ref;
|
|
23
25
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('List', tokens, variant);
|
|
@@ -26,12 +28,27 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
26
28
|
ref: ref,
|
|
27
29
|
...listItemProps,
|
|
28
30
|
title: title,
|
|
31
|
+
iconVerticalAlign: iconVerticalAlign,
|
|
29
32
|
children: children
|
|
30
33
|
});
|
|
31
34
|
});
|
|
32
35
|
ListItem.displayName = 'ListItem';
|
|
33
36
|
ListItem.propTypes = {
|
|
37
|
+
/** Theme tokens for styling */
|
|
38
|
+
tokens: (0, _utils.getTokensPropType)('List'),
|
|
39
|
+
/** Variant configuration for the component */
|
|
34
40
|
variant: _utils.variantProp.propType,
|
|
35
|
-
|
|
41
|
+
/** Content to be rendered within the list item */
|
|
42
|
+
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
43
|
+
/** Title of the list item */
|
|
44
|
+
title: _propTypes.default.node,
|
|
45
|
+
/** Controls the vertical alignment of the icon */
|
|
46
|
+
iconVerticalAlign: _propTypes.default.oneOf(['top', 'center', 'bottom']),
|
|
47
|
+
/** Icon to be displayed */
|
|
48
|
+
icon: _propTypes.default.elementType,
|
|
49
|
+
/** Color of the icon */
|
|
50
|
+
iconColor: _propTypes.default.string,
|
|
51
|
+
/** Size of the icon */
|
|
52
|
+
iconSize: _propTypes.default.number
|
|
36
53
|
};
|
|
37
54
|
var _default = exports.default = ListItem;
|
|
@@ -17,6 +17,12 @@ var _ThemeProvider = require("../ThemeProvider");
|
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
20
|
+
const VERTICAL_CENTERING_DIVISOR = 2;
|
|
21
|
+
const alignmentMap = {
|
|
22
|
+
top: 'flex-start',
|
|
23
|
+
center: 'center',
|
|
24
|
+
bottom: 'flex-end'
|
|
25
|
+
};
|
|
20
26
|
const selectItemBlockStyles = _ref => {
|
|
21
27
|
let {
|
|
22
28
|
interItemMargin
|
|
@@ -38,10 +44,16 @@ const selectDividerStyles = _ref2 => {
|
|
|
38
44
|
paddingBottom: interItemMarginWithDivider
|
|
39
45
|
};
|
|
40
46
|
};
|
|
47
|
+
const selectAlignmentStyles = iconVerticalAlign => ({
|
|
48
|
+
alignItems: alignmentMap[iconVerticalAlign]
|
|
49
|
+
});
|
|
41
50
|
|
|
42
51
|
/**
|
|
43
52
|
* ListItem is responsible for rendering icon or a bullet as side item
|
|
44
53
|
*/
|
|
54
|
+
const calculateIconMarginTop = (itemIconSize, fontSize, lineHeightRatio) => {
|
|
55
|
+
return (fontSize * lineHeightRatio - itemIconSize) / VERTICAL_CENTERING_DIVISOR;
|
|
56
|
+
};
|
|
45
57
|
const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
46
58
|
let {
|
|
47
59
|
tokens,
|
|
@@ -52,6 +64,7 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
52
64
|
children,
|
|
53
65
|
title,
|
|
54
66
|
isLastItem,
|
|
67
|
+
iconVerticalAlign = 'top',
|
|
55
68
|
accessibilityRole = _Platform.default.select({
|
|
56
69
|
web: 'listitem',
|
|
57
70
|
default: undefined
|
|
@@ -65,7 +78,6 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
65
78
|
iconMarginTop,
|
|
66
79
|
itemIconSize
|
|
67
80
|
} = themeTokens;
|
|
68
|
-
let adjustedIconMarginTop = iconMarginTop;
|
|
69
81
|
const {
|
|
70
82
|
fontSize,
|
|
71
83
|
lineHeight: lineHeightRatio
|
|
@@ -73,9 +85,8 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
73
85
|
size: 'h4',
|
|
74
86
|
bold: true
|
|
75
87
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
88
|
+
const adjustedIconMarginTop = title ? calculateIconMarginTop(itemIconSize, fontSize, lineHeightRatio) : iconMarginTop;
|
|
89
|
+
|
|
79
90
|
/**
|
|
80
91
|
* Function responsible returning styling, in case the item is the last shouldn't
|
|
81
92
|
* add extra margin on the bottom, if "showDivider" is true it should add a divider
|
|
@@ -102,7 +113,7 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
102
113
|
iconSize,
|
|
103
114
|
isLastItem
|
|
104
115
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
105
|
-
style: staticStyles.
|
|
116
|
+
style: [staticStyles.innerContainer, selectAlignmentStyles(iconVerticalAlign)],
|
|
106
117
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemMark.default, {
|
|
107
118
|
tokens: {
|
|
108
119
|
...tokens,
|
|
@@ -112,7 +123,7 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
112
123
|
iconColor: iconColor,
|
|
113
124
|
iconSize: iconSize
|
|
114
125
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
115
|
-
style: staticStyles.titleAndContentContainer,
|
|
126
|
+
style: [staticStyles.titleAndContentContainer],
|
|
116
127
|
children: [Boolean(title) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
117
128
|
variant: {
|
|
118
129
|
size: 'h4',
|
|
@@ -128,15 +139,21 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
128
139
|
});
|
|
129
140
|
});
|
|
130
141
|
ListItemBase.displayName = 'ListItem';
|
|
142
|
+
ListItemBase.__UDS_COMPONENT_TYPE__ = 'ListItem';
|
|
131
143
|
const staticStyles = _StyleSheet.default.create({
|
|
132
144
|
container: {
|
|
145
|
+
flexDirection: 'row',
|
|
146
|
+
width: '100%'
|
|
147
|
+
},
|
|
148
|
+
innerContainer: {
|
|
133
149
|
flex: 1,
|
|
134
150
|
flexDirection: 'row'
|
|
135
151
|
},
|
|
136
152
|
titleAndContentContainer: {
|
|
137
153
|
flexDirection: 'column',
|
|
138
|
-
|
|
139
|
-
flexGrow: 1
|
|
154
|
+
flex: 1,
|
|
155
|
+
flexGrow: 1,
|
|
156
|
+
flexShrink: 1
|
|
140
157
|
}
|
|
141
158
|
});
|
|
142
159
|
ListItemBase.propTypes = {
|
|
@@ -144,6 +161,8 @@ ListItemBase.propTypes = {
|
|
|
144
161
|
tokens: (0, _utils.getTokensPropType)('List'),
|
|
145
162
|
variant: _utils.variantProp.propType,
|
|
146
163
|
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
164
|
+
/** Controls the vertical alignment of the icon */
|
|
165
|
+
iconVerticalAlign: _propTypes.default.oneOf(['top', 'center', 'bottom']),
|
|
147
166
|
/**
|
|
148
167
|
* Renders side item icon
|
|
149
168
|
*/
|
|
@@ -7,7 +7,6 @@ exports.tokenTypes = exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
10
|
-
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
11
10
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
12
11
|
var _utils = require("../utils");
|
|
13
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -16,49 +15,29 @@ const tokenTypes = exports.tokenTypes = {
|
|
|
16
15
|
itemIconSize: _propTypes.default.number.isRequired,
|
|
17
16
|
itemIconColor: _propTypes.default.string.isRequired,
|
|
18
17
|
listGutter: _propTypes.default.number.isRequired,
|
|
19
|
-
iconMarginTop: _propTypes.default.number.isRequired
|
|
18
|
+
iconMarginTop: _propTypes.default.number.isRequired,
|
|
19
|
+
bulletIcon: _propTypes.default.elementType.isRequired
|
|
20
20
|
};
|
|
21
|
-
const
|
|
21
|
+
const selectContainerStyles = _ref => {
|
|
22
22
|
let {
|
|
23
|
-
|
|
24
|
-
itemIconColor
|
|
23
|
+
listGutter
|
|
25
24
|
} = _ref;
|
|
26
25
|
return {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
const selectSideItemContainerStyles = _ref2 => {
|
|
32
|
-
let {
|
|
33
|
-
listGutter,
|
|
34
|
-
iconMarginTop
|
|
35
|
-
} = _ref2;
|
|
36
|
-
return {
|
|
37
|
-
marginTop: iconMarginTop,
|
|
38
|
-
marginRight: listGutter
|
|
26
|
+
marginInlineEnd: listGutter,
|
|
27
|
+
display: 'flex',
|
|
28
|
+
alignItems: 'flex-start'
|
|
39
29
|
};
|
|
40
30
|
};
|
|
41
|
-
|
|
42
|
-
// Align bullets with the top line of text the same way icons are aligned
|
|
43
|
-
const selectBulletPositioningStyles = _ref3 => {
|
|
31
|
+
const selectBulletStyles = _ref2 => {
|
|
44
32
|
let {
|
|
45
33
|
itemIconSize
|
|
46
|
-
} =
|
|
34
|
+
} = _ref2;
|
|
47
35
|
return {
|
|
48
36
|
width: itemIconSize,
|
|
49
|
-
height: itemIconSize
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
let {
|
|
54
|
-
itemBulletContainerWidth,
|
|
55
|
-
itemBulletContainerHeight,
|
|
56
|
-
itemBulletContainerAlign
|
|
57
|
-
} = _ref4;
|
|
58
|
-
return {
|
|
59
|
-
width: itemBulletContainerWidth,
|
|
60
|
-
height: itemBulletContainerHeight,
|
|
61
|
-
alignItems: itemBulletContainerAlign
|
|
37
|
+
height: itemIconSize,
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
flexShrink: 0
|
|
62
41
|
};
|
|
63
42
|
};
|
|
64
43
|
const getIconColorVariants = iconVariants => iconVariants?.filter(variant => variant[0] === 'color').map(variant => variant[1]);
|
|
@@ -70,31 +49,31 @@ const getIconColorVariants = iconVariants => iconVariants?.filter(variant => var
|
|
|
70
49
|
* It's the responsibility of themes to make sure that the supplied tokens align the
|
|
71
50
|
* icon or bullet nicely against the first line of text in a ListIconContent.
|
|
72
51
|
*/
|
|
73
|
-
const ListItemMark = /*#__PURE__*/_react.default.forwardRef((
|
|
52
|
+
const ListItemMark = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
74
53
|
let {
|
|
75
54
|
icon,
|
|
76
55
|
iconColor,
|
|
77
56
|
iconSize,
|
|
78
57
|
tokens = {}
|
|
79
|
-
} =
|
|
58
|
+
} = _ref3;
|
|
80
59
|
const themeTokens = typeof tokens === 'function' ? tokens() : tokens;
|
|
81
|
-
const
|
|
82
|
-
const bulletContainerStyles = selectBulletContainerStyles(themeTokens);
|
|
83
|
-
|
|
84
|
-
// TODO: Remove it when iconColor custom colors are deprecated.
|
|
60
|
+
const containerStyles = selectContainerStyles(themeTokens);
|
|
85
61
|
const iconVariants = (0, _utils.useVariants)('Icon');
|
|
86
62
|
const iconColorVariants = getIconColorVariants(iconVariants);
|
|
87
63
|
if (icon) {
|
|
88
|
-
const
|
|
64
|
+
const {
|
|
65
|
+
itemIconSize,
|
|
66
|
+
itemIconColor
|
|
67
|
+
} = themeTokens;
|
|
68
|
+
const finalIconSize = iconSize ?? itemIconSize;
|
|
69
|
+
const finalIconColor = iconColor && !iconColorVariants?.includes(iconColor) ? iconColor : itemIconColor;
|
|
89
70
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
90
|
-
style:
|
|
71
|
+
style: containerStyles,
|
|
91
72
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
92
73
|
icon: icon,
|
|
93
74
|
tokens: {
|
|
94
|
-
size:
|
|
95
|
-
|
|
96
|
-
color: iconColor && !iconColorVariants?.includes(iconColor) ? iconColor : iconTokens.color
|
|
97
|
-
})
|
|
75
|
+
size: finalIconSize,
|
|
76
|
+
color: finalIconColor
|
|
98
77
|
},
|
|
99
78
|
variant: {
|
|
100
79
|
...(iconColorVariants?.includes(iconColor) && {
|
|
@@ -104,23 +83,21 @@ const ListItemMark = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
|
|
|
104
83
|
})
|
|
105
84
|
});
|
|
106
85
|
}
|
|
107
|
-
const bulletColor = themeTokens.itemBulletColor;
|
|
108
86
|
const {
|
|
109
|
-
|
|
87
|
+
itemIconSize,
|
|
88
|
+
itemIconColor
|
|
110
89
|
} = themeTokens;
|
|
111
|
-
const
|
|
112
|
-
const itemBulletPositioningStyles = selectBulletPositioningStyles(themeTokens);
|
|
90
|
+
const bulletStyles = selectBulletStyles(themeTokens);
|
|
113
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
114
|
-
style:
|
|
92
|
+
style: containerStyles,
|
|
115
93
|
ref: ref,
|
|
116
94
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
117
|
-
style:
|
|
118
|
-
testID: "unordered-item-bullet",
|
|
95
|
+
style: bulletStyles,
|
|
119
96
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
120
|
-
icon: bulletIcon,
|
|
97
|
+
icon: themeTokens.bulletIcon,
|
|
121
98
|
tokens: {
|
|
122
|
-
color:
|
|
123
|
-
size:
|
|
99
|
+
color: itemIconColor,
|
|
100
|
+
size: itemIconSize
|
|
124
101
|
}
|
|
125
102
|
})
|
|
126
103
|
})
|
|
@@ -142,10 +119,4 @@ ListItemMark.propTypes = {
|
|
|
142
119
|
*/
|
|
143
120
|
iconSize: _propTypes.default.number
|
|
144
121
|
};
|
|
145
|
-
const staticStyles = _StyleSheet.default.create({
|
|
146
|
-
bulletPositioning: {
|
|
147
|
-
alignItems: 'center',
|
|
148
|
-
justifyContent: 'center'
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
122
|
var _default = exports.default = ListItemMark;
|
|
@@ -98,6 +98,7 @@ const PressableListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref2, ref
|
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
100
|
PressableListItemBase.displayName = 'PressableListItemBase';
|
|
101
|
+
PressableListItemBase.__UDS_COMPONENT_TYPE__ = 'ListItem';
|
|
101
102
|
const staticStyles = _StyleSheet.default.create({
|
|
102
103
|
itemContainer: {
|
|
103
104
|
flexDirection: 'row',
|
package/lib/cjs/Modal/Modal.js
CHANGED
|
@@ -71,11 +71,15 @@ const selectModalStyles = _ref2 => {
|
|
|
71
71
|
const selectBackdropStyles = _ref3 => {
|
|
72
72
|
let {
|
|
73
73
|
backdropColor,
|
|
74
|
-
backdropOpacity
|
|
74
|
+
backdropOpacity,
|
|
75
|
+
backdropCursor
|
|
75
76
|
} = _ref3;
|
|
76
77
|
return {
|
|
77
78
|
backgroundColor: backdropColor,
|
|
78
|
-
opacity: backdropOpacity
|
|
79
|
+
opacity: backdropOpacity,
|
|
80
|
+
...(_Platform.default.OS === 'web' && backdropCursor ? {
|
|
81
|
+
cursor: backdropCursor
|
|
82
|
+
} : {})
|
|
79
83
|
};
|
|
80
84
|
};
|
|
81
85
|
const selectCloseButtonContainerStyles = _ref4 => {
|
|
@@ -128,12 +132,15 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
|
|
|
128
132
|
cancelButtonText,
|
|
129
133
|
cancelButtonType,
|
|
130
134
|
footer,
|
|
135
|
+
backgroundDismissible = true,
|
|
131
136
|
...rest
|
|
132
137
|
} = _ref5;
|
|
133
138
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
139
|
+
const isBackdropClickable = onClose && backgroundDismissible;
|
|
134
140
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Modal', tokens, variant, {
|
|
135
141
|
viewport,
|
|
136
|
-
maxWidth
|
|
142
|
+
maxWidth,
|
|
143
|
+
backdropCursor: isBackdropClickable ? 'pointer' : 'default'
|
|
137
144
|
});
|
|
138
145
|
const modalRef = (0, _useScrollBlocking.default)(isOpen);
|
|
139
146
|
const modalBodyRef = _react.default.useRef(ref);
|
|
@@ -239,7 +246,7 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
|
|
|
239
246
|
})]
|
|
240
247
|
})
|
|
241
248
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TouchableWithoutFeedback.default, {
|
|
242
|
-
onPress: handleClose,
|
|
249
|
+
onPress: isBackdropClickable && handleClose,
|
|
243
250
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
244
251
|
style: [staticStyles.backdrop, selectBackdropStyles(themeTokens)]
|
|
245
252
|
})
|
|
@@ -336,7 +343,15 @@ Modal.propTypes = {
|
|
|
336
343
|
/**
|
|
337
344
|
* Receive a react node or an array of nodes to render at the bottom of the modal, above the action buttons.
|
|
338
345
|
*/
|
|
339
|
-
footer: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.arrayOf(_propTypes.default.node)])
|
|
346
|
+
footer: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.arrayOf(_propTypes.default.node)]),
|
|
347
|
+
/**
|
|
348
|
+
* Controls whether the modal can be dismissed by clicking on the backdrop.
|
|
349
|
+
* When set to `false`, clicking the backdrop will not close the modal.
|
|
350
|
+
* The backdrop cursor automatically changes to 'default' to indicate it's not clickable.
|
|
351
|
+
* Note: Backdrop dismissal requires `onClose` to be defined.
|
|
352
|
+
* @default true
|
|
353
|
+
*/
|
|
354
|
+
backgroundDismissible: _propTypes.default.bool
|
|
340
355
|
};
|
|
341
356
|
var _default = exports.default = Modal;
|
|
342
357
|
const staticStyles = _StyleSheet.default.create({
|
|
@@ -346,12 +361,7 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
346
361
|
left: 0,
|
|
347
362
|
right: 0,
|
|
348
363
|
bottom: 0,
|
|
349
|
-
zIndex: -1
|
|
350
|
-
..._Platform.default.select({
|
|
351
|
-
web: {
|
|
352
|
-
cursor: 'pointer'
|
|
353
|
-
}
|
|
354
|
-
})
|
|
364
|
+
zIndex: -1
|
|
355
365
|
},
|
|
356
366
|
positioningContainer: {
|
|
357
367
|
flexBasis: '100%',
|
|
@@ -10,6 +10,7 @@ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Vi
|
|
|
10
10
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
11
11
|
var _ThemeProvider = require("../ThemeProvider");
|
|
12
12
|
var _utils = require("../utils");
|
|
13
|
+
var _ProgressContext = _interopRequireDefault(require("./ProgressContext"));
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
@@ -54,6 +55,12 @@ const selectProgressStyles = _ref => {
|
|
|
54
55
|
*
|
|
55
56
|
* - Use the `size` variant to control the height of your progress bars: passing `'mini'` will make your
|
|
56
57
|
* progress bar container narrower.
|
|
58
|
+
* - Use the `layers` variant to control how multiple progress bars are positioned:
|
|
59
|
+
* - `false` (default): bars are positioned vertically one below the other.
|
|
60
|
+
* - `true`: bars overlay on top of each other (layered/stacked on z-axis).
|
|
61
|
+
* Note: The `layers` prop is deprecated. After August 2026, `layers: true` will become the permanent
|
|
62
|
+
* default behavior and the `layers` prop will be removed. To maintain vertical layout after removal,
|
|
63
|
+
* use separate individual Progress components.
|
|
57
64
|
*
|
|
58
65
|
* ## Usability and A11y guidelines
|
|
59
66
|
*
|
|
@@ -70,11 +77,18 @@ const Progress = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
70
77
|
...rest
|
|
71
78
|
} = _ref2;
|
|
72
79
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Progress', tokens, variant);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
// Default to false (vertical layout) to preserve existing behavior and avoid breaking changes
|
|
81
|
+
const layers = variant?.layers ?? false;
|
|
82
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressContext.default.Provider, {
|
|
83
|
+
value: {
|
|
84
|
+
layers
|
|
85
|
+
},
|
|
86
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
87
|
+
ref: ref,
|
|
88
|
+
style: [staticStyles.progressContainer, selectProgressStyles(themeTokens)],
|
|
89
|
+
...selectProps(rest),
|
|
90
|
+
children: children
|
|
91
|
+
})
|
|
78
92
|
});
|
|
79
93
|
});
|
|
80
94
|
Progress.displayName = 'Progress';
|
|
@@ -13,17 +13,24 @@ var _ProgressBarBackground = _interopRequireDefault(require("./ProgressBarBackgr
|
|
|
13
13
|
var _ThemeProvider = require("../ThemeProvider");
|
|
14
14
|
var _utils = require("../utils");
|
|
15
15
|
var _constants = require("./constants");
|
|
16
|
+
var _ProgressContext = _interopRequireDefault(require("./ProgressContext"));
|
|
16
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
19
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
19
|
-
const selectBarStyles =
|
|
20
|
+
const selectBarStyles = _ref => {
|
|
20
21
|
let {
|
|
22
|
+
themeTokens,
|
|
23
|
+
calculatedPercentage,
|
|
24
|
+
barPosition,
|
|
25
|
+
layers
|
|
26
|
+
} = _ref;
|
|
27
|
+
const {
|
|
21
28
|
backgroundColor,
|
|
22
29
|
borderRadius,
|
|
23
30
|
outlineWidth,
|
|
24
31
|
outlineColor,
|
|
25
32
|
shadow
|
|
26
|
-
} =
|
|
33
|
+
} = themeTokens;
|
|
27
34
|
return {
|
|
28
35
|
backgroundColor,
|
|
29
36
|
borderRadius,
|
|
@@ -31,7 +38,10 @@ const selectBarStyles = (_ref, calculatedPercentage, barPosition) => {
|
|
|
31
38
|
outlineColor,
|
|
32
39
|
...(0, _ThemeProvider.applyShadowToken)(shadow),
|
|
33
40
|
width: `${calculatedPercentage}%`,
|
|
34
|
-
left: `${barPosition}
|
|
41
|
+
left: `${barPosition}%`,
|
|
42
|
+
...(layers ? {
|
|
43
|
+
position: 'absolute'
|
|
44
|
+
} : {})
|
|
35
45
|
};
|
|
36
46
|
};
|
|
37
47
|
|
|
@@ -82,6 +92,9 @@ const ProgressBar = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
82
92
|
},
|
|
83
93
|
...rest
|
|
84
94
|
} = _ref2;
|
|
95
|
+
const {
|
|
96
|
+
layers
|
|
97
|
+
} = _react.default.useContext(_ProgressContext.default);
|
|
85
98
|
const {
|
|
86
99
|
items,
|
|
87
100
|
current
|
|
@@ -114,7 +127,12 @@ const ProgressBar = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
114
127
|
});
|
|
115
128
|
return percentage > _constants.MIN_PERCENT_VALUE || items ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
116
129
|
ref: ref,
|
|
117
|
-
style: [staticStyles.bar, selectBarStyles(
|
|
130
|
+
style: [staticStyles.bar, selectBarStyles({
|
|
131
|
+
themeTokens,
|
|
132
|
+
calculatedPercentage,
|
|
133
|
+
barPosition,
|
|
134
|
+
layers
|
|
135
|
+
})],
|
|
118
136
|
...selectedProps,
|
|
119
137
|
children: children ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressBarBackground.default, {
|
|
120
138
|
variant: variant
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
const ProgressContext = /*#__PURE__*/(0, _react.createContext)({
|
|
9
|
+
layers: false
|
|
10
|
+
});
|
|
11
|
+
var _default = exports.default = ProgressContext;
|
package/lib/cjs/SideNav/Item.js
CHANGED
|
@@ -29,9 +29,9 @@ function selectItemStyles(_ref) {
|
|
|
29
29
|
} = _ref;
|
|
30
30
|
return {
|
|
31
31
|
backgroundColor,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
borderBottomColor: borderColor,
|
|
33
|
+
borderBottomWidth: borderWidth,
|
|
34
|
+
borderBottomStyle: borderStyle,
|
|
35
35
|
paddingLeft,
|
|
36
36
|
paddingRight,
|
|
37
37
|
paddingTop,
|