@telus-uds/components-base 1.47.0 → 1.49.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 +27 -2
- package/component-docs.json +32 -35
- package/lib/Button/ButtonBase.js +6 -3
- package/lib/ExpandCollapse/Control.js +40 -13
- package/lib/ExpandCollapse/Panel.js +1 -3
- package/lib/List/ListItemBase.js +22 -3
- package/lib/SideNav/Item.js +11 -3
- package/lib/SideNav/ItemContent.js +2 -1
- package/lib/SideNav/ItemsGroup.js +11 -1
- package/lib/Skeleton/Skeleton.js +10 -3
- package/lib/Skeleton/skeleton.constant.js +2 -4
- package/lib/Skeleton/skeletonWebAnimation.js +13 -17
- package/lib/Skeleton/useSkeletonNativeAnimation.js +8 -3
- package/lib-module/Button/ButtonBase.js +6 -3
- package/lib-module/ExpandCollapse/Control.js +39 -13
- package/lib-module/ExpandCollapse/Panel.js +1 -3
- package/lib-module/List/ListItemBase.js +21 -3
- package/lib-module/SideNav/Item.js +10 -3
- package/lib-module/SideNav/ItemContent.js +2 -1
- package/lib-module/SideNav/ItemsGroup.js +11 -1
- package/lib-module/Skeleton/Skeleton.js +10 -3
- package/lib-module/Skeleton/skeleton.constant.js +1 -2
- package/lib-module/Skeleton/skeletonWebAnimation.js +14 -17
- package/lib-module/Skeleton/useSkeletonNativeAnimation.js +9 -4
- package/package.json +2 -2
- package/src/Button/ButtonBase.jsx +6 -2
- package/src/ExpandCollapse/Control.jsx +33 -27
- package/src/ExpandCollapse/Panel.jsx +3 -10
- package/src/Link/LinkBase.jsx +1 -0
- package/src/List/ListItemBase.jsx +18 -4
- package/src/SideNav/Item.jsx +8 -5
- package/src/SideNav/ItemContent.jsx +10 -6
- package/src/SideNav/ItemsGroup.jsx +10 -2
- package/src/SideNav/SideNav.jsx +2 -0
- package/src/Skeleton/Skeleton.jsx +9 -2
- package/src/Skeleton/skeleton.constant.js +0 -1
- package/src/Skeleton/skeletonWebAnimation.js +11 -11
- package/src/Skeleton/useSkeletonNativeAnimation.js +5 -4
- package/src/utils/a11y/semantics.js +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri,
|
|
3
|
+
This log was last generated on Fri, 09 Jun 2023 00:18:16 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.49.0
|
|
8
|
+
|
|
9
|
+
Fri, 09 Jun 2023 00:18:16 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- refactored SideNav component for alignment to design intentions (kyle.king2@telus.com)
|
|
14
|
+
- Fixed bullet alignment within ListItemBase (wlsdud194@hotmail.com)
|
|
15
|
+
- expand collpase mini variant introduced (akshay.pandey1@telus.com)
|
|
16
|
+
- Bump @telus-uds/system-theme-tokens to v2.31.0
|
|
17
|
+
|
|
18
|
+
## 1.48.0
|
|
19
|
+
|
|
20
|
+
Tue, 06 Jun 2023 20:46:12 GMT
|
|
21
|
+
|
|
22
|
+
### Minor changes
|
|
23
|
+
|
|
24
|
+
- add new story for 'ButtonDropdown' (kyle.king2@telus.com)
|
|
25
|
+
- change animation to skeleton component (mauricio.batresmontejo@telus.com)
|
|
26
|
+
- Bump @telus-uds/system-theme-tokens to v2.30.0
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- Fix an issue where `Button` may not align as expected in a flex container (shahzaibkhalidmalik@outlook.com)
|
|
31
|
+
|
|
7
32
|
## 1.47.0
|
|
8
33
|
|
|
9
|
-
Fri, 02 Jun 2023 00:
|
|
34
|
+
Fri, 02 Jun 2023 00:34:55 GMT
|
|
10
35
|
|
|
11
36
|
### Minor changes
|
|
12
37
|
|
package/component-docs.json
CHANGED
|
@@ -307,7 +307,6 @@
|
|
|
307
307
|
"color": "color",
|
|
308
308
|
"lineHeight": "lineHeight",
|
|
309
309
|
"textAlign": "flexJustifyContent",
|
|
310
|
-
"alignSelf": "flexAlign",
|
|
311
310
|
"fontName": "fontName",
|
|
312
311
|
"fontWeight": "fontWeight",
|
|
313
312
|
"backgroundColor": "color",
|
|
@@ -595,7 +594,12 @@
|
|
|
595
594
|
"paddingBottom": "size",
|
|
596
595
|
"borderWidth": "border",
|
|
597
596
|
"borderColor": "color",
|
|
598
|
-
"backgroundColor": "color"
|
|
597
|
+
"backgroundColor": "color",
|
|
598
|
+
"borderTopLeftRadius": "radius",
|
|
599
|
+
"borderBottomLeftRadius": "radius",
|
|
600
|
+
"borderTopRightRadius": "radius",
|
|
601
|
+
"borderBottomRightRadius": "radius",
|
|
602
|
+
"textLine": "textLine"
|
|
599
603
|
},
|
|
600
604
|
"ExpandCollapseMiniControl": {
|
|
601
605
|
"size": "size",
|
|
@@ -629,20 +633,6 @@
|
|
|
629
633
|
"expandDividerColor": "color",
|
|
630
634
|
"expandDividerWidth": "size"
|
|
631
635
|
},
|
|
632
|
-
"ExpandCollapseMiniPanel": {
|
|
633
|
-
"expandDuration": "duration",
|
|
634
|
-
"collapseDuration": "duration",
|
|
635
|
-
"contentPaddingLeft": "size",
|
|
636
|
-
"contentPaddingRight": "size",
|
|
637
|
-
"contentPaddingTop": "size",
|
|
638
|
-
"contentPaddingBottom": "size",
|
|
639
|
-
"marginBottom": "size",
|
|
640
|
-
"borderColor": "color",
|
|
641
|
-
"borderRadius": "radius",
|
|
642
|
-
"borderWidth": "border",
|
|
643
|
-
"expandDividerColor": "color",
|
|
644
|
-
"expandDividerWidth": "size"
|
|
645
|
-
},
|
|
646
636
|
"Feedback": {
|
|
647
637
|
"backgroundColor": "color",
|
|
648
638
|
"borderColor": "color",
|
|
@@ -1683,6 +1673,8 @@
|
|
|
1683
1673
|
},
|
|
1684
1674
|
"Skeleton": {
|
|
1685
1675
|
"color": "color",
|
|
1676
|
+
"secondColor": "color",
|
|
1677
|
+
"animationDuration": "integer",
|
|
1686
1678
|
"size": "size",
|
|
1687
1679
|
"radius": "radius",
|
|
1688
1680
|
"baseWidth": "size",
|
|
@@ -2691,6 +2683,16 @@
|
|
|
2691
2683
|
"platforms": [
|
|
2692
2684
|
"rn"
|
|
2693
2685
|
]
|
|
2686
|
+
},
|
|
2687
|
+
"focus": {
|
|
2688
|
+
"description": "Currently only web has good support for this. Applies when an interactive component's focus handler is triggered, such as keyboard tabbing or selection.",
|
|
2689
|
+
"values": [
|
|
2690
|
+
true
|
|
2691
|
+
],
|
|
2692
|
+
"type": "state",
|
|
2693
|
+
"platforms": [
|
|
2694
|
+
"rn"
|
|
2695
|
+
]
|
|
2694
2696
|
}
|
|
2695
2697
|
},
|
|
2696
2698
|
"SideNavItemGroup": {
|
|
@@ -3360,13 +3362,6 @@
|
|
|
3360
3362
|
"required": false,
|
|
3361
3363
|
"description": "Array of the ids of currently open groups"
|
|
3362
3364
|
},
|
|
3363
|
-
"isMiniExpandCollapse": {
|
|
3364
|
-
"defaultValue": {
|
|
3365
|
-
"value": "false",
|
|
3366
|
-
"computed": false
|
|
3367
|
-
},
|
|
3368
|
-
"required": false
|
|
3369
|
-
},
|
|
3370
3365
|
"variant": {
|
|
3371
3366
|
"type": {
|
|
3372
3367
|
"name": "objectOf",
|
|
@@ -3471,7 +3466,12 @@
|
|
|
3471
3466
|
"paddingBottom": "size",
|
|
3472
3467
|
"borderWidth": "border",
|
|
3473
3468
|
"borderColor": "color",
|
|
3474
|
-
"backgroundColor": "color"
|
|
3469
|
+
"backgroundColor": "color",
|
|
3470
|
+
"borderTopLeftRadius": "radius",
|
|
3471
|
+
"borderBottomLeftRadius": "radius",
|
|
3472
|
+
"borderTopRightRadius": "radius",
|
|
3473
|
+
"borderBottomRightRadius": "radius",
|
|
3474
|
+
"textLine": "textLine"
|
|
3475
3475
|
}
|
|
3476
3476
|
},
|
|
3477
3477
|
"required": false,
|
|
@@ -4305,13 +4305,6 @@
|
|
|
4305
4305
|
"required": false,
|
|
4306
4306
|
"description": "Array of the ids of currently open groups"
|
|
4307
4307
|
},
|
|
4308
|
-
"isMiniExpandCollapse": {
|
|
4309
|
-
"defaultValue": {
|
|
4310
|
-
"value": "false",
|
|
4311
|
-
"computed": false
|
|
4312
|
-
},
|
|
4313
|
-
"required": false
|
|
4314
|
-
},
|
|
4315
4308
|
"variant": {
|
|
4316
4309
|
"type": {
|
|
4317
4310
|
"name": "objectOf",
|
|
@@ -4416,7 +4409,12 @@
|
|
|
4416
4409
|
"paddingBottom": "size",
|
|
4417
4410
|
"borderWidth": "border",
|
|
4418
4411
|
"borderColor": "color",
|
|
4419
|
-
"backgroundColor": "color"
|
|
4412
|
+
"backgroundColor": "color",
|
|
4413
|
+
"borderTopLeftRadius": "radius",
|
|
4414
|
+
"borderBottomLeftRadius": "radius",
|
|
4415
|
+
"borderTopRightRadius": "radius",
|
|
4416
|
+
"borderBottomRightRadius": "radius",
|
|
4417
|
+
"textLine": "textLine"
|
|
4420
4418
|
}
|
|
4421
4419
|
},
|
|
4422
4420
|
"required": false,
|
|
@@ -9186,6 +9184,8 @@
|
|
|
9186
9184
|
"name": "custom",
|
|
9187
9185
|
"raw": {
|
|
9188
9186
|
"color": "color",
|
|
9187
|
+
"secondColor": "color",
|
|
9188
|
+
"animationDuration": "integer",
|
|
9189
9189
|
"size": "size",
|
|
9190
9190
|
"radius": "radius",
|
|
9191
9191
|
"baseWidth": "size",
|
|
@@ -10873,7 +10873,6 @@
|
|
|
10873
10873
|
"color": "color",
|
|
10874
10874
|
"lineHeight": "lineHeight",
|
|
10875
10875
|
"textAlign": "flexJustifyContent",
|
|
10876
|
-
"alignSelf": "flexAlign",
|
|
10877
10876
|
"fontName": "fontName",
|
|
10878
10877
|
"fontWeight": "fontWeight",
|
|
10879
10878
|
"backgroundColor": "color",
|
|
@@ -11072,7 +11071,6 @@
|
|
|
11072
11071
|
"color": "color",
|
|
11073
11072
|
"lineHeight": "lineHeight",
|
|
11074
11073
|
"textAlign": "flexJustifyContent",
|
|
11075
|
-
"alignSelf": "flexAlign",
|
|
11076
11074
|
"fontName": "fontName",
|
|
11077
11075
|
"fontWeight": "fontWeight",
|
|
11078
11076
|
"backgroundColor": "color",
|
|
@@ -11498,7 +11496,6 @@
|
|
|
11498
11496
|
"color": "color",
|
|
11499
11497
|
"lineHeight": "lineHeight",
|
|
11500
11498
|
"textAlign": "flexJustifyContent",
|
|
11501
|
-
"alignSelf": "flexAlign",
|
|
11502
11499
|
"fontName": "fontName",
|
|
11503
11500
|
"fontWeight": "fontWeight",
|
|
11504
11501
|
"backgroundColor": "color",
|
package/lib/Button/ButtonBase.js
CHANGED
|
@@ -45,7 +45,6 @@ const getOuterBorderOffset = _ref => {
|
|
|
45
45
|
|
|
46
46
|
const selectOuterContainerStyles = _ref2 => {
|
|
47
47
|
let {
|
|
48
|
-
alignSelf,
|
|
49
48
|
opacity,
|
|
50
49
|
outerBorderColor,
|
|
51
50
|
outerBorderWidth,
|
|
@@ -53,8 +52,11 @@ const selectOuterContainerStyles = _ref2 => {
|
|
|
53
52
|
borderRadius,
|
|
54
53
|
outerBackgroundColor
|
|
55
54
|
} = _ref2;
|
|
56
|
-
return {
|
|
57
|
-
|
|
55
|
+
return { ..._Platform.default.select({
|
|
56
|
+
native: {
|
|
57
|
+
alignSelf: 'flex-start'
|
|
58
|
+
}
|
|
59
|
+
}),
|
|
58
60
|
backgroundColor: outerBackgroundColor,
|
|
59
61
|
opacity,
|
|
60
62
|
...(0, _ThemeProvider.applyOuterBorder)({
|
|
@@ -221,6 +223,7 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref8) => {
|
|
|
221
223
|
web: {
|
|
222
224
|
// if it would overflow the container, wraps instead
|
|
223
225
|
maxWidth: `calc(100% + ${getOuterBorderOffset(themeTokens) * 2}px)`,
|
|
226
|
+
width: 'fit-content',
|
|
224
227
|
outline: 'none',
|
|
225
228
|
// removes the default browser :focus outline
|
|
226
229
|
...(0, _utils.getCursorStyle)(inactive, accessibilityRole)
|
|
@@ -11,6 +11,8 @@ var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/expor
|
|
|
11
11
|
|
|
12
12
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
13
13
|
|
|
14
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
15
|
+
|
|
14
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
17
|
|
|
16
18
|
var _ThemeProvider = require("../ThemeProvider");
|
|
@@ -32,25 +34,34 @@ function selectContainerStyles(_ref) {
|
|
|
32
34
|
backgroundColor,
|
|
33
35
|
borderColor,
|
|
34
36
|
borderWidth,
|
|
35
|
-
borderStyle,
|
|
37
|
+
borderStyle = 'solid',
|
|
36
38
|
paddingLeft,
|
|
37
39
|
paddingRight,
|
|
38
40
|
paddingTop,
|
|
39
41
|
paddingBottom,
|
|
40
42
|
justifyContent,
|
|
41
43
|
verticalAlign,
|
|
42
|
-
iconPosition
|
|
44
|
+
iconPosition,
|
|
45
|
+
borderTopRightRadius,
|
|
46
|
+
borderBottomRightRadius,
|
|
47
|
+
borderTopLeftRadius,
|
|
48
|
+
borderBottomLeftRadius
|
|
43
49
|
} = _ref;
|
|
44
50
|
return {
|
|
51
|
+
boxSizing: 'border-box',
|
|
45
52
|
backgroundColor,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
borderColor,
|
|
54
|
+
borderWidth,
|
|
55
|
+
borderStyle,
|
|
49
56
|
paddingLeft,
|
|
50
57
|
paddingRight,
|
|
51
58
|
paddingTop,
|
|
52
59
|
paddingBottom,
|
|
53
60
|
justifyContent,
|
|
61
|
+
borderTopRightRadius,
|
|
62
|
+
borderBottomRightRadius,
|
|
63
|
+
borderTopLeftRadius,
|
|
64
|
+
borderBottomLeftRadius,
|
|
54
65
|
...(0, _ThemeProvider.verticalAlignRow)(verticalAlign, iconPosition === 'right')
|
|
55
66
|
};
|
|
56
67
|
} // TODO: use stack / spacer when available
|
|
@@ -69,6 +80,16 @@ function selectIconContainerStyles(_ref2) {
|
|
|
69
80
|
};
|
|
70
81
|
}
|
|
71
82
|
|
|
83
|
+
function selectTextContainerStyles(_ref3) {
|
|
84
|
+
let {
|
|
85
|
+
textLine
|
|
86
|
+
} = _ref3;
|
|
87
|
+
return {
|
|
88
|
+
textDecorationLine: textLine,
|
|
89
|
+
flex: 1
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
72
93
|
function selectIconTokens(tokens) {
|
|
73
94
|
return {
|
|
74
95
|
color: tokens.iconColor,
|
|
@@ -76,7 +97,7 @@ function selectIconTokens(tokens) {
|
|
|
76
97
|
};
|
|
77
98
|
}
|
|
78
99
|
|
|
79
|
-
const ExpandCollapseControl = /*#__PURE__*/(0, _react.forwardRef)((
|
|
100
|
+
const ExpandCollapseControl = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
80
101
|
let {
|
|
81
102
|
onPress,
|
|
82
103
|
isExpanded,
|
|
@@ -84,10 +105,9 @@ const ExpandCollapseControl = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) =
|
|
|
84
105
|
tokens,
|
|
85
106
|
accessibilityRole = 'button',
|
|
86
107
|
variant,
|
|
87
|
-
isMiniExpandCollapse = false,
|
|
88
108
|
...rest
|
|
89
|
-
} =
|
|
90
|
-
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)(
|
|
109
|
+
} = _ref4;
|
|
110
|
+
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('ExpandCollapseControl', tokens, variant);
|
|
91
111
|
const selectedProps = selectProps({
|
|
92
112
|
accessibilityRole,
|
|
93
113
|
...rest,
|
|
@@ -96,12 +116,12 @@ const ExpandCollapseControl = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) =
|
|
|
96
116
|
}
|
|
97
117
|
});
|
|
98
118
|
|
|
99
|
-
const getControlState =
|
|
119
|
+
const getControlState = _ref5 => {
|
|
100
120
|
let {
|
|
101
121
|
pressed,
|
|
102
122
|
hovered,
|
|
103
123
|
focused
|
|
104
|
-
} =
|
|
124
|
+
} = _ref5;
|
|
105
125
|
return {
|
|
106
126
|
pressed,
|
|
107
127
|
hover: hovered,
|
|
@@ -112,7 +132,11 @@ const ExpandCollapseControl = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) =
|
|
|
112
132
|
|
|
113
133
|
const getControlTokens = pressableState => getTokens(getControlState(pressableState));
|
|
114
134
|
|
|
115
|
-
const getPressableStyle = pressableState => selectContainerStyles(getControlTokens(pressableState))
|
|
135
|
+
const getPressableStyle = pressableState => ({ ...selectContainerStyles(getControlTokens(pressableState)),
|
|
136
|
+
...(_Platform.default.OS === 'web' ? {
|
|
137
|
+
outline: 'none'
|
|
138
|
+
} : {})
|
|
139
|
+
});
|
|
116
140
|
|
|
117
141
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
118
142
|
ref: ref,
|
|
@@ -129,7 +153,10 @@ const ExpandCollapseControl = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) =
|
|
|
129
153
|
style: selectIconContainerStyles(themeTokens),
|
|
130
154
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, { ...selectIconTokens(themeTokens)
|
|
131
155
|
})
|
|
132
|
-
}),
|
|
156
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
157
|
+
style: selectTextContainerStyles(themeTokens),
|
|
158
|
+
children: typeof children === 'function' ? children(getControlState(pressableState)) : children
|
|
159
|
+
})]
|
|
133
160
|
});
|
|
134
161
|
}
|
|
135
162
|
});
|
|
@@ -70,7 +70,6 @@ const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
70
70
|
children,
|
|
71
71
|
tokens,
|
|
72
72
|
variant,
|
|
73
|
-
isMiniExpandCollapse = false,
|
|
74
73
|
controlRef,
|
|
75
74
|
...rest
|
|
76
75
|
} = _ref2;
|
|
@@ -81,7 +80,7 @@ const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
81
80
|
expanded: isExpanded
|
|
82
81
|
}
|
|
83
82
|
});
|
|
84
|
-
const themeTokens = (0, _ThemeProvider.useThemeTokens)(
|
|
83
|
+
const themeTokens = (0, _ThemeProvider.useThemeTokens)('ExpandCollapsePanel', tokens, variant, {
|
|
85
84
|
expanded: isExpanded
|
|
86
85
|
});
|
|
87
86
|
|
|
@@ -117,7 +116,6 @@ const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
117
116
|
variant: variant,
|
|
118
117
|
onPress: handleControlPress,
|
|
119
118
|
ref: controlRef,
|
|
120
|
-
isMiniExpandCollapse: isMiniExpandCollapse,
|
|
121
119
|
children: control
|
|
122
120
|
}), isExpanded && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
123
121
|
style: {
|
package/lib/List/ListItemBase.js
CHANGED
|
@@ -23,6 +23,8 @@ var _ListItemMark = _interopRequireDefault(require("./ListItemMark"));
|
|
|
23
23
|
|
|
24
24
|
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
25
25
|
|
|
26
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
27
|
+
|
|
26
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
29
|
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -79,12 +81,29 @@ const ListItemBase = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
79
81
|
const themeTokens = typeof tokens === 'function' ? tokens() : tokens;
|
|
80
82
|
const itemBlockStyles = selectItemBlockStyles(themeTokens);
|
|
81
83
|
const dividerStyles = selectDividerStyles(themeTokens);
|
|
84
|
+
const {
|
|
85
|
+
iconMarginTop,
|
|
86
|
+
itemIconSize
|
|
87
|
+
} = themeTokens;
|
|
88
|
+
let adjustedIconMarginTop = iconMarginTop;
|
|
89
|
+
const {
|
|
90
|
+
fontSize,
|
|
91
|
+
lineHeight: lineHeightRatio
|
|
92
|
+
} = (0, _ThemeProvider.useThemeTokens)('Typography', {}, {
|
|
93
|
+
size: 'h4',
|
|
94
|
+
bold: true
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
if (title) {
|
|
98
|
+
adjustedIconMarginTop = (fontSize * lineHeightRatio - itemIconSize) / 2;
|
|
99
|
+
}
|
|
82
100
|
/**
|
|
83
101
|
* Function responsible returning styling, in case the item is the last shouldn't
|
|
84
102
|
* add extra margin on the bottom, if "showDivider" is true it should add a divider
|
|
85
103
|
* and custom margin and padding, otherwise just adds a margin to the bottom
|
|
86
104
|
*/
|
|
87
105
|
|
|
106
|
+
|
|
88
107
|
const getContainerStyle = () => {
|
|
89
108
|
if (isLastItem) {
|
|
90
109
|
return undefined;
|
|
@@ -112,11 +131,11 @@ const ListItemBase = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
112
131
|
style: [{
|
|
113
132
|
flex: 1,
|
|
114
133
|
flexDirection: 'row'
|
|
115
|
-
}, !title && {
|
|
116
|
-
alignItems: 'center'
|
|
117
134
|
}],
|
|
118
135
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemMark.default, {
|
|
119
|
-
tokens: tokens,
|
|
136
|
+
tokens: { ...tokens,
|
|
137
|
+
iconMarginTop: adjustedIconMarginTop
|
|
138
|
+
},
|
|
120
139
|
icon: icon,
|
|
121
140
|
iconColor: iconColor,
|
|
122
141
|
iconSize: iconSize
|
package/lib/SideNav/Item.js
CHANGED
|
@@ -9,6 +9,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
|
|
11
11
|
|
|
12
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
13
|
+
|
|
12
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
15
|
|
|
14
16
|
var _utils = require("../utils");
|
|
@@ -94,16 +96,22 @@ const Item = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
94
96
|
|
|
95
97
|
const getAppearanceState = _ref3 => {
|
|
96
98
|
let {
|
|
97
|
-
hovered
|
|
99
|
+
hovered,
|
|
100
|
+
focused
|
|
98
101
|
} = _ref3;
|
|
99
102
|
return {
|
|
100
103
|
hover: hovered,
|
|
101
104
|
active: isActive,
|
|
102
|
-
expanded: isExpanded
|
|
105
|
+
expanded: isExpanded,
|
|
106
|
+
focus: focused
|
|
103
107
|
};
|
|
104
108
|
};
|
|
105
109
|
|
|
106
|
-
const getPressableStyle = pressableState => selectItemStyles(getTokens(getAppearanceState(pressableState)))
|
|
110
|
+
const getPressableStyle = pressableState => ({ ...selectItemStyles(getTokens(getAppearanceState(pressableState))),
|
|
111
|
+
...(_Platform.default.OS === 'web' ? {
|
|
112
|
+
outline: 'none'
|
|
113
|
+
} : {})
|
|
114
|
+
});
|
|
107
115
|
|
|
108
116
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
109
117
|
ref: ref,
|
|
@@ -42,9 +42,10 @@ const ItemContent = _ref => {
|
|
|
42
42
|
children,
|
|
43
43
|
tokens
|
|
44
44
|
} = _ref;
|
|
45
|
+
const typographyTokens = (0, _utils.selectTokens)('Typography', tokens);
|
|
45
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
46
47
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
47
|
-
tokens:
|
|
48
|
+
tokens: typographyTokens,
|
|
48
49
|
children: children
|
|
49
50
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
50
51
|
style: [staticStyles.absolute, selectAccentStyles(tokens)]
|
|
@@ -61,7 +61,17 @@ const ItemsGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
61
61
|
|
|
62
62
|
const getGroupTokens = (0, _ThemeProvider.useThemeTokensCallback)('SideNavItemsGroup', tokens, variant);
|
|
63
63
|
|
|
64
|
-
const getPanelTokens = appearance =>
|
|
64
|
+
const getPanelTokens = appearance => {
|
|
65
|
+
const {
|
|
66
|
+
panelBorderColor,
|
|
67
|
+
...itemsGroupTokens
|
|
68
|
+
} = getGroupTokens(getAppearance(appearance));
|
|
69
|
+
const groupTokens = { ...itemsGroupTokens,
|
|
70
|
+
borderWidth: 0,
|
|
71
|
+
marginBottom: 0
|
|
72
|
+
};
|
|
73
|
+
return (0, _utils.selectTokens)('ExpandCollapsePanel', groupTokens);
|
|
74
|
+
};
|
|
65
75
|
|
|
66
76
|
const getItemTokens = (0, _ThemeProvider.useThemeTokensCallback)('SideNavItem', itemTokens, variant);
|
|
67
77
|
|
package/lib/Skeleton/Skeleton.js
CHANGED
|
@@ -100,11 +100,18 @@ const Skeleton = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
100
100
|
}
|
|
101
101
|
} : // Size by an index on the spacing scale (getting default index from theme if none provided)
|
|
102
102
|
sizeIndex || themeTokens.size;
|
|
103
|
-
const skeletonHeight = (0, _utils.useSpacingScale)(spacingScaleValue);
|
|
104
|
-
|
|
103
|
+
const skeletonHeight = (0, _utils.useSpacingScale)(spacingScaleValue); // Animation color and animation duration
|
|
104
|
+
|
|
105
|
+
const {
|
|
106
|
+
secondColor,
|
|
107
|
+
animationDuration
|
|
108
|
+
} = themeTokens;
|
|
109
|
+
const nativeAnimation = (0, _useSkeletonNativeAnimation.default)({
|
|
110
|
+
animationDuration
|
|
111
|
+
});
|
|
105
112
|
|
|
106
113
|
const getAnimationBasedOnPlatform = () => {
|
|
107
|
-
const animation = _Platform.default.OS === 'web' ? _skeletonWebAnimation.default : nativeAnimation; // We must pass the animation styles through `StyleSheet.create`
|
|
114
|
+
const animation = _Platform.default.OS === 'web' ? (0, _skeletonWebAnimation.default)(secondColor, animationDuration) : nativeAnimation; // We must pass the animation styles through `StyleSheet.create`
|
|
108
115
|
// @see https://github.com/necolas/react-native-web/issues/2387
|
|
109
116
|
|
|
110
117
|
const styles = _StyleSheet.default.create({
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.OPACITY_STOP = exports.DEFAULT_OPACITY =
|
|
6
|
+
exports.OPACITY_STOP = exports.DEFAULT_OPACITY = void 0;
|
|
7
7
|
const DEFAULT_OPACITY = 1;
|
|
8
8
|
exports.DEFAULT_OPACITY = DEFAULT_OPACITY;
|
|
9
9
|
const OPACITY_STOP = 0.4;
|
|
10
|
-
exports.OPACITY_STOP = OPACITY_STOP;
|
|
11
|
-
const ANIMATION_DURATION = 1500;
|
|
12
|
-
exports.ANIMATION_DURATION = ANIMATION_DURATION;
|
|
10
|
+
exports.OPACITY_STOP = OPACITY_STOP;
|
|
@@ -5,23 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
'50%': {
|
|
20
|
-
opacity: _skeleton.OPACITY_STOP
|
|
21
|
-
},
|
|
22
|
-
'100%': {
|
|
23
|
-
opacity: _skeleton.DEFAULT_OPACITY
|
|
8
|
+
const skeletonWebAnimation = (secondColor, animationTime) => {
|
|
9
|
+
return {
|
|
10
|
+
animationDuration: `${animationTime}ms`,
|
|
11
|
+
animationTimingFunction: 'ease-in-out',
|
|
12
|
+
animationDelay: '0.5s',
|
|
13
|
+
animationIterationCount: 'infinite',
|
|
14
|
+
animationKeyframes: {
|
|
15
|
+
'50%': {
|
|
16
|
+
backgroundColor: secondColor
|
|
17
|
+
}
|
|
24
18
|
}
|
|
25
|
-
}
|
|
19
|
+
};
|
|
26
20
|
};
|
|
21
|
+
|
|
22
|
+
var _default = skeletonWebAnimation;
|
|
27
23
|
exports.default = _default;
|
|
@@ -15,16 +15,21 @@ var _skeleton = require("./skeleton.constant");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
const useSkeletonNativeAnimation =
|
|
18
|
+
const useSkeletonNativeAnimation = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
animationDuration
|
|
21
|
+
} = _ref;
|
|
19
22
|
const fadeAnimation = (0, _react.useRef)(new _Animated.default.Value(_skeleton.DEFAULT_OPACITY)).current;
|
|
23
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
24
|
+
|
|
20
25
|
(0, _react.useEffect)(() => {
|
|
21
26
|
const fade = _Animated.default.sequence([_Animated.default.timing(fadeAnimation, {
|
|
22
27
|
toValue: _skeleton.OPACITY_STOP,
|
|
23
|
-
duration:
|
|
28
|
+
duration: animationDuration,
|
|
24
29
|
useNativeDriver: _Platform.default.OS !== 'web'
|
|
25
30
|
}), _Animated.default.timing(fadeAnimation, {
|
|
26
31
|
toValue: _skeleton.DEFAULT_OPACITY,
|
|
27
|
-
duration:
|
|
32
|
+
duration: animationDuration,
|
|
28
33
|
useNativeDriver: _Platform.default.OS !== 'web'
|
|
29
34
|
})]);
|
|
30
35
|
|
|
@@ -21,7 +21,6 @@ const getOuterBorderOffset = _ref => {
|
|
|
21
21
|
|
|
22
22
|
const selectOuterContainerStyles = _ref2 => {
|
|
23
23
|
let {
|
|
24
|
-
alignSelf,
|
|
25
24
|
opacity,
|
|
26
25
|
outerBorderColor,
|
|
27
26
|
outerBorderWidth,
|
|
@@ -29,8 +28,11 @@ const selectOuterContainerStyles = _ref2 => {
|
|
|
29
28
|
borderRadius,
|
|
30
29
|
outerBackgroundColor
|
|
31
30
|
} = _ref2;
|
|
32
|
-
return {
|
|
33
|
-
|
|
31
|
+
return { ...Platform.select({
|
|
32
|
+
native: {
|
|
33
|
+
alignSelf: 'flex-start'
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
34
36
|
backgroundColor: outerBackgroundColor,
|
|
35
37
|
opacity,
|
|
36
38
|
...applyOuterBorder({
|
|
@@ -197,6 +199,7 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref8) => {
|
|
|
197
199
|
web: {
|
|
198
200
|
// if it would overflow the container, wraps instead
|
|
199
201
|
maxWidth: `calc(100% + ${getOuterBorderOffset(themeTokens) * 2}px)`,
|
|
202
|
+
width: 'fit-content',
|
|
200
203
|
outline: 'none',
|
|
201
204
|
// removes the default browser :focus outline
|
|
202
205
|
...getCursorStyle(inactive, accessibilityRole)
|