@planningcenter/tapestry-react 2.1.0 → 2.1.2
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/dist/cjs/Avatar/Avatar.js +11 -9
- package/dist/cjs/Calendar/Day.js +32 -38
- package/dist/cjs/Pagination/Pagination.js +17 -11
- package/dist/cjs/system/box-sizes.js +3 -3
- package/dist/esm/Avatar/Avatar.js +11 -7
- package/dist/esm/Calendar/Day.js +32 -39
- package/dist/esm/Pagination/Pagination.js +16 -11
- package/dist/esm/system/box-sizes.js +3 -3
- package/dist/types/Button/Button.d.ts +4 -0
- package/package.json +1 -1
- package/src/Avatar/Avatar.tsx +15 -8
- package/src/Button/Button.tsx +5 -0
- package/src/Calendar/Day.js +13 -10
- package/src/Icon/Status.js +1 -1
- package/src/Pagination/Pagination.tsx +22 -12
- package/src/system/box-sizes.js +3 -3
|
@@ -14,8 +14,14 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
14
14
|
|
|
15
15
|
var _Box = _interopRequireDefault(require("../Box"));
|
|
16
16
|
|
|
17
|
-
var
|
|
18
|
-
|
|
17
|
+
var avatarSizes = {
|
|
18
|
+
xs: 2.5,
|
|
19
|
+
sm: 3,
|
|
20
|
+
md: 4.5,
|
|
21
|
+
lg: 6,
|
|
22
|
+
xl: 9,
|
|
23
|
+
xxl: 14
|
|
24
|
+
};
|
|
19
25
|
var borderSizes = {
|
|
20
26
|
xs: 2,
|
|
21
27
|
sm: 2,
|
|
@@ -34,16 +40,12 @@ function Avatar(_ref) {
|
|
|
34
40
|
source = _ref.source,
|
|
35
41
|
status = _ref.status,
|
|
36
42
|
restProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, ["size", "source", "status"]);
|
|
37
|
-
|
|
38
|
-
var _useBoxSize = (0, _system.useBoxSize)(size),
|
|
39
|
-
boxSize = _useBoxSize.boxSize;
|
|
40
|
-
|
|
41
43
|
return /*#__PURE__*/_react["default"].createElement(_Box["default"], (0, _extends2["default"])({
|
|
42
44
|
as: "img",
|
|
43
45
|
src: source,
|
|
44
|
-
width:
|
|
45
|
-
height:
|
|
46
|
-
flexBasis:
|
|
46
|
+
width: avatarSizes[size],
|
|
47
|
+
height: avatarSizes[size],
|
|
48
|
+
flexBasis: avatarSizes[size],
|
|
47
49
|
flexShrink: 0,
|
|
48
50
|
flexGrow: 0,
|
|
49
51
|
objectFit: "cover",
|
package/dist/cjs/Calendar/Day.js
CHANGED
|
@@ -17,38 +17,29 @@ var _StackView = _interopRequireDefault(require("../StackView"));
|
|
|
17
17
|
|
|
18
18
|
var _Text = _interopRequireDefault(require("../Text"));
|
|
19
19
|
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
selectDate = _ref2.selectDate,
|
|
44
|
-
_ref2$selectedColor = _ref2.selectedColor,
|
|
45
|
-
selectedColor = _ref2$selectedColor === void 0 ? 'primary' : _ref2$selectedColor,
|
|
46
|
-
_ref2$statusColor = _ref2.statusColor,
|
|
47
|
-
statusColor = _ref2$statusColor === void 0 ? 'transparent' : _ref2$statusColor,
|
|
48
|
-
statuses = _ref2.statuses,
|
|
49
|
-
_ref2$statusOffset = _ref2.statusOffset,
|
|
50
|
-
statusOffset = _ref2$statusOffset === void 0 ? '15%' : _ref2$statusOffset,
|
|
51
|
-
restProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref2, ["backgroundColor", "cellSize", "children", "color", "date", "disabled", "fontSize", "fontWeight", "inSameMonth", "isMinDate", "isMaxDate", "isSelected", "isToday", "selectDate", "selectedColor", "statusColor", "statuses", "statusOffset"]);
|
|
20
|
+
var Day = function Day(_ref) {
|
|
21
|
+
var backgroundColor = _ref.backgroundColor,
|
|
22
|
+
cellSize = _ref.cellSize,
|
|
23
|
+
children = _ref.children,
|
|
24
|
+
color = _ref.color,
|
|
25
|
+
date = _ref.date,
|
|
26
|
+
disabled = _ref.disabled,
|
|
27
|
+
fontSize = _ref.fontSize,
|
|
28
|
+
fontWeight = _ref.fontWeight,
|
|
29
|
+
inSameMonth = _ref.inSameMonth,
|
|
30
|
+
isMinDate = _ref.isMinDate,
|
|
31
|
+
isMaxDate = _ref.isMaxDate,
|
|
32
|
+
isSelected = _ref.isSelected,
|
|
33
|
+
isToday = _ref.isToday,
|
|
34
|
+
selectDate = _ref.selectDate,
|
|
35
|
+
_ref$selectedColor = _ref.selectedColor,
|
|
36
|
+
selectedColor = _ref$selectedColor === void 0 ? 'primary' : _ref$selectedColor,
|
|
37
|
+
_ref$statusColor = _ref.statusColor,
|
|
38
|
+
statusColor = _ref$statusColor === void 0 ? 'transparent' : _ref$statusColor,
|
|
39
|
+
statuses = _ref.statuses,
|
|
40
|
+
_ref$statusOffset = _ref.statusOffset,
|
|
41
|
+
statusOffset = _ref$statusOffset === void 0 ? '15%' : _ref$statusOffset,
|
|
42
|
+
restProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, ["backgroundColor", "cellSize", "children", "color", "date", "disabled", "fontSize", "fontWeight", "inSameMonth", "isMinDate", "isMaxDate", "isSelected", "isToday", "selectDate", "selectedColor", "statusColor", "statuses", "statusOffset"]);
|
|
52
43
|
var affordance = !disabled && !isMinDate && !isMaxDate && (selectDate || restProps.onClick || restProps.onMouseDown);
|
|
53
44
|
return /*#__PURE__*/_react["default"].createElement(_StackView["default"], {
|
|
54
45
|
width: cellSize,
|
|
@@ -70,13 +61,14 @@ var Day = function Day(_ref2) {
|
|
|
70
61
|
hover: affordance && {
|
|
71
62
|
backgroundColor: 'highlight'
|
|
72
63
|
}
|
|
73
|
-
}, restProps), (isSelected || isToday || statusColor) && /*#__PURE__*/_react["default"].createElement(_Icon["default"]
|
|
74
|
-
size: cellSize,
|
|
64
|
+
}, restProps), (isSelected || isToday || statusColor) && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
75
65
|
color: isSelected ? selectedColor : isToday ? 'surfaceTertiary' : statusColor,
|
|
66
|
+
left: "50%",
|
|
76
67
|
position: "absolute",
|
|
77
68
|
top: "50%",
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
transform: "translate(-50%, -50%)",
|
|
70
|
+
name: "tapestry.radio0",
|
|
71
|
+
size: cellSize
|
|
80
72
|
}), /*#__PURE__*/_react["default"].createElement(_Text["default"], {
|
|
81
73
|
as: "span",
|
|
82
74
|
fontSize: fontSize,
|
|
@@ -92,9 +84,11 @@ var Day = function Day(_ref2) {
|
|
|
92
84
|
right: 0,
|
|
93
85
|
spacing: 0.25
|
|
94
86
|
}, statuses.map(function (color, index) {
|
|
95
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
87
|
+
return /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
88
|
+
color: isSelected ? 'white' : color,
|
|
96
89
|
key: index,
|
|
97
|
-
|
|
90
|
+
name: "tapestry.radio0",
|
|
91
|
+
size: "5px"
|
|
98
92
|
});
|
|
99
93
|
}))));
|
|
100
94
|
};
|
|
@@ -23,6 +23,8 @@ var _StackView = _interopRequireDefault(require("../StackView"));
|
|
|
23
23
|
|
|
24
24
|
var _utils = require("../utils");
|
|
25
25
|
|
|
26
|
+
var _utils2 = require("../system/utils");
|
|
27
|
+
|
|
26
28
|
var _windowSize = require("@react-hook/window-size");
|
|
27
29
|
|
|
28
30
|
var _system = require("../system");
|
|
@@ -100,28 +102,32 @@ function Pagination(_ref2) {
|
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
function renderPageLink(number) {
|
|
103
|
-
var
|
|
105
|
+
var isCurrentPage = currentPage === number;
|
|
106
|
+
var activeBackgroundColor = (0, _utils2.parseColor)({
|
|
107
|
+
base: activeColor,
|
|
108
|
+
alpha: 0.1
|
|
109
|
+
});
|
|
104
110
|
var outlineStyle = {
|
|
105
|
-
border:
|
|
106
|
-
color: '#
|
|
111
|
+
border: "1px solid " + activeColor,
|
|
112
|
+
color: isCurrentPage ? '#fff' : activeColor
|
|
107
113
|
};
|
|
108
114
|
return /*#__PURE__*/_react["default"].createElement(_Button["default"], (0, _extends2["default"])({
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
backgroundColor: '#f4f8fd'
|
|
115
|
+
active: _objectSpread({
|
|
116
|
+
backgroundColor: isCurrentPage ? activeColor : activeBackgroundColor
|
|
112
117
|
}, outlineStyle),
|
|
118
|
+
key: number,
|
|
113
119
|
fontWeight: 500,
|
|
114
120
|
hover: _objectSpread({
|
|
115
|
-
backgroundColor: '#
|
|
121
|
+
backgroundColor: isCurrentPage ? activeColor : '#fff'
|
|
116
122
|
}, outlineStyle),
|
|
117
123
|
onClick: onPageChange.bind(null, number),
|
|
118
124
|
shrink: 0,
|
|
119
125
|
square: true,
|
|
120
126
|
title: number,
|
|
121
|
-
variant:
|
|
122
|
-
},
|
|
123
|
-
backgroundColor:
|
|
124
|
-
color: '
|
|
127
|
+
variant: isCurrentPage ? 'fill' : 'naked'
|
|
128
|
+
}, isCurrentPage && {
|
|
129
|
+
backgroundColor: activeColor,
|
|
130
|
+
color: '#fff'
|
|
125
131
|
}));
|
|
126
132
|
}
|
|
127
133
|
|
|
@@ -23,7 +23,7 @@ var boxSizes = {
|
|
|
23
23
|
radius: 3
|
|
24
24
|
},
|
|
25
25
|
md: {
|
|
26
|
-
boxSize: 4
|
|
26
|
+
boxSize: 4,
|
|
27
27
|
fontSize: 4,
|
|
28
28
|
lineHeight: 3,
|
|
29
29
|
paddingHorizontalDense: 1,
|
|
@@ -32,7 +32,7 @@ var boxSizes = {
|
|
|
32
32
|
radius: 4
|
|
33
33
|
},
|
|
34
34
|
lg: {
|
|
35
|
-
boxSize:
|
|
35
|
+
boxSize: 5,
|
|
36
36
|
fontSize: 3,
|
|
37
37
|
lineHeight: 4,
|
|
38
38
|
paddingHorizontalDense: 1,
|
|
@@ -41,7 +41,7 @@ var boxSizes = {
|
|
|
41
41
|
radius: 5
|
|
42
42
|
},
|
|
43
43
|
xl: {
|
|
44
|
-
boxSize:
|
|
44
|
+
boxSize: 8,
|
|
45
45
|
fontSize: 1,
|
|
46
46
|
lineHeight: 5,
|
|
47
47
|
paddingHorizontalDense: 2,
|
|
@@ -2,7 +2,14 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import Box from '../Box';
|
|
5
|
-
|
|
5
|
+
var avatarSizes = {
|
|
6
|
+
xs: 2.5,
|
|
7
|
+
sm: 3,
|
|
8
|
+
md: 4.5,
|
|
9
|
+
lg: 6,
|
|
10
|
+
xl: 9,
|
|
11
|
+
xxl: 14
|
|
12
|
+
};
|
|
6
13
|
var borderSizes = {
|
|
7
14
|
xs: 2,
|
|
8
15
|
sm: 2,
|
|
@@ -22,15 +29,12 @@ export function Avatar(_ref) {
|
|
|
22
29
|
status = _ref.status,
|
|
23
30
|
restProps = _objectWithoutPropertiesLoose(_ref, ["size", "source", "status"]);
|
|
24
31
|
|
|
25
|
-
var _useBoxSize = useBoxSize(size),
|
|
26
|
-
boxSize = _useBoxSize.boxSize;
|
|
27
|
-
|
|
28
32
|
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
29
33
|
as: "img",
|
|
30
34
|
src: source,
|
|
31
|
-
width:
|
|
32
|
-
height:
|
|
33
|
-
flexBasis:
|
|
35
|
+
width: avatarSizes[size],
|
|
36
|
+
height: avatarSizes[size],
|
|
37
|
+
flexBasis: avatarSizes[size],
|
|
34
38
|
flexShrink: 0,
|
|
35
39
|
flexGrow: 0,
|
|
36
40
|
objectFit: "cover",
|
package/dist/esm/Calendar/Day.js
CHANGED
|
@@ -5,39 +5,29 @@ import Icon from '../Icon';
|
|
|
5
5
|
import StackView from '../StackView';
|
|
6
6
|
import Text from '../Text';
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
isToday = _ref2.isToday,
|
|
32
|
-
selectDate = _ref2.selectDate,
|
|
33
|
-
_ref2$selectedColor = _ref2.selectedColor,
|
|
34
|
-
selectedColor = _ref2$selectedColor === void 0 ? 'primary' : _ref2$selectedColor,
|
|
35
|
-
_ref2$statusColor = _ref2.statusColor,
|
|
36
|
-
statusColor = _ref2$statusColor === void 0 ? 'transparent' : _ref2$statusColor,
|
|
37
|
-
statuses = _ref2.statuses,
|
|
38
|
-
_ref2$statusOffset = _ref2.statusOffset,
|
|
39
|
-
statusOffset = _ref2$statusOffset === void 0 ? '15%' : _ref2$statusOffset,
|
|
40
|
-
restProps = _objectWithoutPropertiesLoose(_ref2, ["backgroundColor", "cellSize", "children", "color", "date", "disabled", "fontSize", "fontWeight", "inSameMonth", "isMinDate", "isMaxDate", "isSelected", "isToday", "selectDate", "selectedColor", "statusColor", "statuses", "statusOffset"]);
|
|
8
|
+
var Day = function Day(_ref) {
|
|
9
|
+
var backgroundColor = _ref.backgroundColor,
|
|
10
|
+
cellSize = _ref.cellSize,
|
|
11
|
+
children = _ref.children,
|
|
12
|
+
color = _ref.color,
|
|
13
|
+
date = _ref.date,
|
|
14
|
+
disabled = _ref.disabled,
|
|
15
|
+
fontSize = _ref.fontSize,
|
|
16
|
+
fontWeight = _ref.fontWeight,
|
|
17
|
+
inSameMonth = _ref.inSameMonth,
|
|
18
|
+
isMinDate = _ref.isMinDate,
|
|
19
|
+
isMaxDate = _ref.isMaxDate,
|
|
20
|
+
isSelected = _ref.isSelected,
|
|
21
|
+
isToday = _ref.isToday,
|
|
22
|
+
selectDate = _ref.selectDate,
|
|
23
|
+
_ref$selectedColor = _ref.selectedColor,
|
|
24
|
+
selectedColor = _ref$selectedColor === void 0 ? 'primary' : _ref$selectedColor,
|
|
25
|
+
_ref$statusColor = _ref.statusColor,
|
|
26
|
+
statusColor = _ref$statusColor === void 0 ? 'transparent' : _ref$statusColor,
|
|
27
|
+
statuses = _ref.statuses,
|
|
28
|
+
_ref$statusOffset = _ref.statusOffset,
|
|
29
|
+
statusOffset = _ref$statusOffset === void 0 ? '15%' : _ref$statusOffset,
|
|
30
|
+
restProps = _objectWithoutPropertiesLoose(_ref, ["backgroundColor", "cellSize", "children", "color", "date", "disabled", "fontSize", "fontWeight", "inSameMonth", "isMinDate", "isMaxDate", "isSelected", "isToday", "selectDate", "selectedColor", "statusColor", "statuses", "statusOffset"]);
|
|
41
31
|
|
|
42
32
|
var affordance = !disabled && !isMinDate && !isMaxDate && (selectDate || restProps.onClick || restProps.onMouseDown);
|
|
43
33
|
return /*#__PURE__*/React.createElement(StackView, {
|
|
@@ -60,13 +50,14 @@ var Day = function Day(_ref2) {
|
|
|
60
50
|
hover: affordance && {
|
|
61
51
|
backgroundColor: 'highlight'
|
|
62
52
|
}
|
|
63
|
-
}, restProps), (isSelected || isToday || statusColor) && /*#__PURE__*/React.createElement(Icon
|
|
64
|
-
size: cellSize,
|
|
53
|
+
}, restProps), (isSelected || isToday || statusColor) && /*#__PURE__*/React.createElement(Icon, {
|
|
65
54
|
color: isSelected ? selectedColor : isToday ? 'surfaceTertiary' : statusColor,
|
|
55
|
+
left: "50%",
|
|
66
56
|
position: "absolute",
|
|
67
57
|
top: "50%",
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
transform: "translate(-50%, -50%)",
|
|
59
|
+
name: "tapestry.radio0",
|
|
60
|
+
size: cellSize
|
|
70
61
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
71
62
|
as: "span",
|
|
72
63
|
fontSize: fontSize,
|
|
@@ -82,9 +73,11 @@ var Day = function Day(_ref2) {
|
|
|
82
73
|
right: 0,
|
|
83
74
|
spacing: 0.25
|
|
84
75
|
}, statuses.map(function (color, index) {
|
|
85
|
-
return /*#__PURE__*/React.createElement(
|
|
76
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
77
|
+
color: isSelected ? 'white' : color,
|
|
86
78
|
key: index,
|
|
87
|
-
|
|
79
|
+
name: "tapestry.radio0",
|
|
80
|
+
size: "5px"
|
|
88
81
|
});
|
|
89
82
|
}))));
|
|
90
83
|
};
|
|
@@ -12,6 +12,7 @@ import Button from '../Button';
|
|
|
12
12
|
import Group from '../Group';
|
|
13
13
|
import StackView from '../StackView';
|
|
14
14
|
import { range } from '../utils';
|
|
15
|
+
import { parseColor } from '../system/utils';
|
|
15
16
|
import { useWindowWidth } from '@react-hook/window-size';
|
|
16
17
|
import { useThemeValue } from '../system';
|
|
17
18
|
|
|
@@ -85,28 +86,32 @@ export default function Pagination(_ref2) {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
function renderPageLink(number) {
|
|
88
|
-
var
|
|
89
|
+
var isCurrentPage = currentPage === number;
|
|
90
|
+
var activeBackgroundColor = parseColor({
|
|
91
|
+
base: activeColor,
|
|
92
|
+
alpha: 0.1
|
|
93
|
+
});
|
|
89
94
|
var outlineStyle = {
|
|
90
|
-
border:
|
|
91
|
-
color: '#
|
|
95
|
+
border: "1px solid " + activeColor,
|
|
96
|
+
color: isCurrentPage ? '#fff' : activeColor
|
|
92
97
|
};
|
|
93
98
|
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
backgroundColor: '#f4f8fd'
|
|
99
|
+
active: _objectSpread({
|
|
100
|
+
backgroundColor: isCurrentPage ? activeColor : activeBackgroundColor
|
|
97
101
|
}, outlineStyle),
|
|
102
|
+
key: number,
|
|
98
103
|
fontWeight: 500,
|
|
99
104
|
hover: _objectSpread({
|
|
100
|
-
backgroundColor: '#
|
|
105
|
+
backgroundColor: isCurrentPage ? activeColor : '#fff'
|
|
101
106
|
}, outlineStyle),
|
|
102
107
|
onClick: onPageChange.bind(null, number),
|
|
103
108
|
shrink: 0,
|
|
104
109
|
square: true,
|
|
105
110
|
title: number,
|
|
106
|
-
variant:
|
|
107
|
-
},
|
|
108
|
-
backgroundColor:
|
|
109
|
-
color: '
|
|
111
|
+
variant: isCurrentPage ? 'fill' : 'naked'
|
|
112
|
+
}, isCurrentPage && {
|
|
113
|
+
backgroundColor: activeColor,
|
|
114
|
+
color: '#fff'
|
|
110
115
|
}));
|
|
111
116
|
}
|
|
112
117
|
|
|
@@ -18,7 +18,7 @@ export var boxSizes = {
|
|
|
18
18
|
radius: 3
|
|
19
19
|
},
|
|
20
20
|
md: {
|
|
21
|
-
boxSize: 4
|
|
21
|
+
boxSize: 4,
|
|
22
22
|
fontSize: 4,
|
|
23
23
|
lineHeight: 3,
|
|
24
24
|
paddingHorizontalDense: 1,
|
|
@@ -27,7 +27,7 @@ export var boxSizes = {
|
|
|
27
27
|
radius: 4
|
|
28
28
|
},
|
|
29
29
|
lg: {
|
|
30
|
-
boxSize:
|
|
30
|
+
boxSize: 5,
|
|
31
31
|
fontSize: 3,
|
|
32
32
|
lineHeight: 4,
|
|
33
33
|
paddingHorizontalDense: 1,
|
|
@@ -36,7 +36,7 @@ export var boxSizes = {
|
|
|
36
36
|
radius: 5
|
|
37
37
|
},
|
|
38
38
|
xl: {
|
|
39
|
-
boxSize:
|
|
39
|
+
boxSize: 8,
|
|
40
40
|
fontSize: 1,
|
|
41
41
|
lineHeight: 5,
|
|
42
42
|
paddingHorizontalDense: 2,
|
|
@@ -11,6 +11,10 @@ declare type ButtonProps = {
|
|
|
11
11
|
* Opens the linked destination in a new window or tab.
|
|
12
12
|
*/
|
|
13
13
|
external?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Pass styles for when the button is active.
|
|
16
|
+
*/
|
|
17
|
+
active?: object;
|
|
14
18
|
/**
|
|
15
19
|
* Pass styles for when the button is focused.
|
|
16
20
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/tapestry-react",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "A collection of flexible React components to help you build resilient, accessible user interfaces quickly and effectively.",
|
|
5
5
|
"author": "Front End Systems Engineering <frontend@pco.bz>",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
package/src/Avatar/Avatar.tsx
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
3
|
import Box from '../Box'
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
const avatarSizes = {
|
|
6
|
+
xs: 2.5,
|
|
7
|
+
sm: 3,
|
|
8
|
+
md: 4.5,
|
|
9
|
+
lg: 6,
|
|
10
|
+
xl: 9,
|
|
11
|
+
xxl: 14,
|
|
12
|
+
}
|
|
5
13
|
|
|
6
14
|
const borderSizes = {
|
|
7
15
|
xs: 2,
|
|
@@ -16,15 +24,15 @@ type AvatarProps = {
|
|
|
16
24
|
/**
|
|
17
25
|
* Controls the size of the avatar.
|
|
18
26
|
*/
|
|
19
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
|
|
27
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
|
|
20
28
|
/**
|
|
21
29
|
* The source of the image to display.
|
|
22
30
|
*/
|
|
23
|
-
source?: string
|
|
31
|
+
source?: string
|
|
24
32
|
/**
|
|
25
33
|
* Adds a colored ring with padding around the avatar. Accepts a valid color string.
|
|
26
34
|
*/
|
|
27
|
-
status?: string
|
|
35
|
+
status?: string
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
/**
|
|
@@ -36,14 +44,13 @@ export function Avatar({
|
|
|
36
44
|
status,
|
|
37
45
|
...restProps
|
|
38
46
|
}: AvatarProps) {
|
|
39
|
-
const { boxSize } = useBoxSize(size)
|
|
40
47
|
return (
|
|
41
48
|
<Box
|
|
42
49
|
as="img"
|
|
43
50
|
src={source}
|
|
44
|
-
width={
|
|
45
|
-
height={
|
|
46
|
-
flexBasis={
|
|
51
|
+
width={avatarSizes[size]}
|
|
52
|
+
height={avatarSizes[size]}
|
|
53
|
+
flexBasis={avatarSizes[size]}
|
|
47
54
|
flexShrink={0}
|
|
48
55
|
flexGrow={0}
|
|
49
56
|
objectFit="cover"
|
package/src/Button/Button.tsx
CHANGED
package/src/Calendar/Day.js
CHANGED
|
@@ -4,10 +4,6 @@ import Icon from '../Icon'
|
|
|
4
4
|
import StackView from '../StackView'
|
|
5
5
|
import Text from '../Text'
|
|
6
6
|
|
|
7
|
-
const DayStatus = ({ color, ...restProps }) => (
|
|
8
|
-
<Icon.Status size="5px" color={color} {...restProps} />
|
|
9
|
-
)
|
|
10
|
-
|
|
11
7
|
export type PublicProps = {
|
|
12
8
|
children?: any,
|
|
13
9
|
/**
|
|
@@ -39,11 +35,11 @@ export type PublicProps = {
|
|
|
39
35
|
*/
|
|
40
36
|
statusColor?: string,
|
|
41
37
|
/**
|
|
42
|
-
* Specifies the `bottom` offset of the
|
|
38
|
+
* Specifies the `bottom` offset of the status dots, defaults to `15%`.
|
|
43
39
|
*/
|
|
44
40
|
statusOffset: string | number,
|
|
45
41
|
/**
|
|
46
|
-
* Accepts an array of color names (theme token or valid html) which render as small
|
|
42
|
+
* Accepts an array of color names (theme token or valid html) which render as small colorized dots below the date.
|
|
47
43
|
*/
|
|
48
44
|
statuses?: array,
|
|
49
45
|
}
|
|
@@ -101,8 +97,7 @@ const Day = ({
|
|
|
101
97
|
{...restProps}
|
|
102
98
|
>
|
|
103
99
|
{(isSelected || isToday || statusColor) && (
|
|
104
|
-
<Icon
|
|
105
|
-
size={cellSize}
|
|
100
|
+
<Icon
|
|
106
101
|
color={
|
|
107
102
|
isSelected
|
|
108
103
|
? selectedColor
|
|
@@ -110,10 +105,12 @@ const Day = ({
|
|
|
110
105
|
? 'surfaceTertiary'
|
|
111
106
|
: statusColor
|
|
112
107
|
}
|
|
108
|
+
left="50%"
|
|
113
109
|
position="absolute"
|
|
114
110
|
top="50%"
|
|
115
|
-
left="50%"
|
|
116
111
|
transform="translate(-50%, -50%)"
|
|
112
|
+
name="tapestry.radio0"
|
|
113
|
+
size={cellSize}
|
|
117
114
|
/>
|
|
118
115
|
)}
|
|
119
116
|
<Text
|
|
@@ -136,7 +133,12 @@ const Day = ({
|
|
|
136
133
|
spacing={0.25}
|
|
137
134
|
>
|
|
138
135
|
{statuses.map((color, index) => (
|
|
139
|
-
<
|
|
136
|
+
<Icon
|
|
137
|
+
color={isSelected ? 'white' : color}
|
|
138
|
+
key={index}
|
|
139
|
+
name="tapestry.radio0"
|
|
140
|
+
size="5px"
|
|
141
|
+
/>
|
|
140
142
|
))}
|
|
141
143
|
</StackView>
|
|
142
144
|
)}
|
|
@@ -144,5 +146,6 @@ const Day = ({
|
|
|
144
146
|
</StackView>
|
|
145
147
|
)
|
|
146
148
|
}
|
|
149
|
+
|
|
147
150
|
Day.displayName = 'Calendar.Day'
|
|
148
151
|
export default Day
|
package/src/Icon/Status.js
CHANGED
|
@@ -24,7 +24,7 @@ const STATUS_VARIANTS = {
|
|
|
24
24
|
|
|
25
25
|
export type Props = {
|
|
26
26
|
/** The name of the status icon to render. */
|
|
27
|
-
variant
|
|
27
|
+
variant: 'confirmed' | 'unconfirmed' | 'declined',
|
|
28
28
|
/** Uses the filled version of the icon. */
|
|
29
29
|
variantFilled?: boolean,
|
|
30
30
|
/** Pass any valid color from [colors](/colors). Defaults to variant color. */
|
|
@@ -5,6 +5,7 @@ import Button from '../Button'
|
|
|
5
5
|
import Group from '../Group'
|
|
6
6
|
import StackView from '../StackView'
|
|
7
7
|
import { range } from '../utils'
|
|
8
|
+
import { parseColor } from '../system/utils'
|
|
8
9
|
import { useWindowWidth } from '@react-hook/window-size'
|
|
9
10
|
import { useThemeValue } from '../system'
|
|
10
11
|
|
|
@@ -39,27 +40,27 @@ export type PaginationProps = {
|
|
|
39
40
|
/**
|
|
40
41
|
* Change the color of the active page
|
|
41
42
|
*/
|
|
42
|
-
activeColor: string
|
|
43
|
+
activeColor: string
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
46
|
* Current visible page number
|
|
46
47
|
*/
|
|
47
|
-
currentPage: number
|
|
48
|
+
currentPage: number
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
51
|
* Callback when new page is requested
|
|
51
52
|
*/
|
|
52
|
-
onPageChange: (nextPage: number) => undefined
|
|
53
|
+
onPageChange: (nextPage: number) => undefined
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* Total available pages
|
|
56
57
|
*/
|
|
57
|
-
totalPages: number
|
|
58
|
+
totalPages: number
|
|
58
59
|
|
|
59
60
|
/**
|
|
60
61
|
* Amount of visible pages
|
|
61
62
|
*/
|
|
62
|
-
visiblePages?: number
|
|
63
|
+
visiblePages?: number
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
const NavButton = ({ disabled, iconName, ...props }) => {
|
|
@@ -98,22 +99,31 @@ export default function Pagination({
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
function renderPageLink(number) {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
const outlineStyle = {
|
|
102
|
+
const isCurrentPage = currentPage === number
|
|
103
|
+
const activeBackgroundColor = parseColor({ base: activeColor, alpha: 0.1 })
|
|
104
|
+
const outlineStyle = {
|
|
105
|
+
border: `1px solid ${activeColor}`,
|
|
106
|
+
color: isCurrentPage ? '#fff' : activeColor,
|
|
107
|
+
}
|
|
104
108
|
|
|
105
109
|
return (
|
|
106
110
|
<Button
|
|
111
|
+
active={{
|
|
112
|
+
backgroundColor: isCurrentPage ? activeColor : activeBackgroundColor,
|
|
113
|
+
...outlineStyle,
|
|
114
|
+
}}
|
|
107
115
|
key={number}
|
|
108
|
-
focus={{ backgroundColor: '#f4f8fd', ...outlineStyle }}
|
|
109
116
|
fontWeight={500}
|
|
110
|
-
hover={{
|
|
117
|
+
hover={{
|
|
118
|
+
backgroundColor: isCurrentPage ? activeColor : '#fff',
|
|
119
|
+
...outlineStyle,
|
|
120
|
+
}}
|
|
111
121
|
onClick={onPageChange.bind(null, number)}
|
|
112
122
|
shrink={0}
|
|
113
123
|
square
|
|
114
124
|
title={number}
|
|
115
|
-
variant={
|
|
116
|
-
{...(
|
|
125
|
+
variant={isCurrentPage ? 'fill' : 'naked'}
|
|
126
|
+
{...(isCurrentPage && { backgroundColor: activeColor, color: '#fff' })}
|
|
117
127
|
/>
|
|
118
128
|
)
|
|
119
129
|
}
|
package/src/system/box-sizes.js
CHANGED
|
@@ -18,7 +18,7 @@ export const boxSizes = {
|
|
|
18
18
|
radius: 3,
|
|
19
19
|
},
|
|
20
20
|
md: {
|
|
21
|
-
boxSize: 4
|
|
21
|
+
boxSize: 4,
|
|
22
22
|
fontSize: 4,
|
|
23
23
|
lineHeight: 3,
|
|
24
24
|
paddingHorizontalDense: 1,
|
|
@@ -27,7 +27,7 @@ export const boxSizes = {
|
|
|
27
27
|
radius: 4,
|
|
28
28
|
},
|
|
29
29
|
lg: {
|
|
30
|
-
boxSize:
|
|
30
|
+
boxSize: 5,
|
|
31
31
|
fontSize: 3,
|
|
32
32
|
lineHeight: 4,
|
|
33
33
|
paddingHorizontalDense: 1,
|
|
@@ -36,7 +36,7 @@ export const boxSizes = {
|
|
|
36
36
|
radius: 5,
|
|
37
37
|
},
|
|
38
38
|
xl: {
|
|
39
|
-
boxSize:
|
|
39
|
+
boxSize: 8,
|
|
40
40
|
fontSize: 1,
|
|
41
41
|
lineHeight: 5,
|
|
42
42
|
paddingHorizontalDense: 2,
|