@planningcenter/tapestry-react 2.6.2 → 2.7.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/dist/cjs/Button/Button.js +16 -4
- package/dist/cjs/Button/Button.test.js +35 -14
- package/dist/cjs/DataTable/DataTable.js +3 -2
- package/dist/cjs/system/colors/colors.js +18 -15
- package/dist/esm/Button/Button.js +16 -4
- package/dist/esm/Button/Button.test.js +45 -18
- package/dist/esm/DataTable/DataTable.js +3 -2
- package/dist/esm/system/colors/colors.js +18 -15
- package/package.json +3 -4
- package/src/Button/Button.test.tsx +14 -0
- package/src/Button/Button.tsx +9 -3
- package/src/DataTable/DataTable.js +2 -1
- package/src/Icon/Icon.mdx +12 -11
- package/src/system/colors/colors.js +18 -15
|
@@ -175,13 +175,25 @@ function Button(_ref) {
|
|
|
175
175
|
if (iconRight) {
|
|
176
176
|
iconRight['color'] = 'transparent';
|
|
177
177
|
}
|
|
178
|
-
}
|
|
179
|
-
|
|
178
|
+
}
|
|
180
179
|
|
|
181
180
|
if (disabled) {
|
|
182
|
-
buttonProps['aria-disabled'] = true;
|
|
183
|
-
buttonProps.cursor = 'not-allowed';
|
|
184
181
|
buttonProps.opacity = 0.65;
|
|
182
|
+
|
|
183
|
+
if (buttonProps.type === "button" || buttonProps.type === "reset") {
|
|
184
|
+
buttonProps.disabled = true;
|
|
185
|
+
} else if (buttonProps.type === "submit") {
|
|
186
|
+
buttonProps['aria-disabled'] = true;
|
|
187
|
+
buttonProps.cursor = 'not-allowed';
|
|
188
|
+
|
|
189
|
+
buttonProps.onClick = function (event) {
|
|
190
|
+
return event.preventDefault();
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
buttonProps.onKeyDown = function (event) {
|
|
194
|
+
return event.preventDefault();
|
|
195
|
+
};
|
|
196
|
+
}
|
|
185
197
|
} // don't apply hover/active styles or events when disabled or spinner is present
|
|
186
198
|
|
|
187
199
|
|
|
@@ -24,39 +24,60 @@ it("should render as <button> with type=\"submit\"", function () {
|
|
|
24
24
|
var button = container.querySelector('button');
|
|
25
25
|
expect(button.getAttribute('type')).toEqual('submit');
|
|
26
26
|
});
|
|
27
|
+
it("should render \"disabled\" attribute, if <button> is disabled", function () {
|
|
28
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
29
|
+
disabled: true
|
|
30
|
+
})),
|
|
31
|
+
container = _render3.container;
|
|
32
|
+
|
|
33
|
+
var button = container.querySelector('button');
|
|
34
|
+
expect(button.getAttribute("aria-disabled")).toEqual(null);
|
|
35
|
+
expect(button.disabled).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
it("should render \"aria-disabled\" attribute, if <button type=\"submit\"> is disabled", function () {
|
|
38
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
39
|
+
type: "submit",
|
|
40
|
+
disabled: true
|
|
41
|
+
})),
|
|
42
|
+
container = _render4.container;
|
|
43
|
+
|
|
44
|
+
var button = container.querySelector('button');
|
|
45
|
+
expect(button.getAttribute("aria-disabled")).toEqual("true");
|
|
46
|
+
expect(button.disabled).toBe(false);
|
|
47
|
+
});
|
|
27
48
|
it("should render title", function () {
|
|
28
49
|
var title = 'Hello';
|
|
29
50
|
|
|
30
|
-
var
|
|
51
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
31
52
|
title: title
|
|
32
53
|
})),
|
|
33
|
-
getByText =
|
|
54
|
+
getByText = _render5.getByText;
|
|
34
55
|
|
|
35
56
|
getByText(title);
|
|
36
57
|
});
|
|
37
58
|
it("should render <a> without a type if \"to\" is provided", function () {
|
|
38
|
-
var
|
|
59
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
39
60
|
to: "#"
|
|
40
61
|
})),
|
|
41
|
-
container =
|
|
62
|
+
container = _render6.container;
|
|
42
63
|
|
|
43
64
|
var button = container.querySelector('a');
|
|
44
65
|
expect(button.getAttribute('type')).toBeNull();
|
|
45
66
|
});
|
|
46
67
|
it("should render <a> without a type if \"href\" is provided", function () {
|
|
47
|
-
var
|
|
68
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
48
69
|
href: "#"
|
|
49
70
|
})),
|
|
50
|
-
container =
|
|
71
|
+
container = _render7.container;
|
|
51
72
|
|
|
52
73
|
var button = container.querySelector('a');
|
|
53
74
|
expect(button.getAttribute('type')).toBeNull();
|
|
54
75
|
});
|
|
55
76
|
it("should render <a> with \"href\" if \"to\" is specifed", function () {
|
|
56
|
-
var
|
|
77
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
57
78
|
to: "#"
|
|
58
79
|
})),
|
|
59
|
-
container =
|
|
80
|
+
container = _render8.container;
|
|
60
81
|
|
|
61
82
|
var button = container.querySelector('a');
|
|
62
83
|
expect(button.getAttribute('href')).toEqual('#');
|
|
@@ -64,12 +85,12 @@ it("should render <a> with \"href\" if \"to\" is specifed", function () {
|
|
|
64
85
|
it("should render href and external link values", function () {
|
|
65
86
|
var title = 'Hello';
|
|
66
87
|
|
|
67
|
-
var
|
|
88
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
68
89
|
external: true,
|
|
69
90
|
title: title,
|
|
70
91
|
to: "https://www.planningcenter.com"
|
|
71
92
|
})),
|
|
72
|
-
getByText =
|
|
93
|
+
getByText = _render9.getByText;
|
|
73
94
|
|
|
74
95
|
var button = getByText(title);
|
|
75
96
|
expect(button.getAttribute('href')).toEqual('https://www.planningcenter.com');
|
|
@@ -79,18 +100,18 @@ it("should render href and external link values", function () {
|
|
|
79
100
|
it("should call onClick when clicked or Enter or Space key is pressed", function () {
|
|
80
101
|
var onClick = jest.fn();
|
|
81
102
|
|
|
82
|
-
var
|
|
103
|
+
var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
83
104
|
onClick: onClick
|
|
84
105
|
})),
|
|
85
|
-
container =
|
|
106
|
+
container = _render10.container;
|
|
86
107
|
|
|
87
108
|
_react2.fireEvent.click(container.firstChild);
|
|
88
109
|
|
|
89
110
|
expect(onClick).toHaveBeenCalledTimes(1);
|
|
90
111
|
});
|
|
91
112
|
it("should not call onClick when Enter or Space key is pressed and onClick isn't present", function () {
|
|
92
|
-
var
|
|
93
|
-
container =
|
|
113
|
+
var _render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button.Button, null)),
|
|
114
|
+
container = _render11.container;
|
|
94
115
|
|
|
95
116
|
_react2.fireEvent.keyDown(container.firstChild, {
|
|
96
117
|
key: 'Enter'
|
|
@@ -171,12 +171,13 @@ var DataTable = function DataTable(props) {
|
|
|
171
171
|
onDrop: onDrop
|
|
172
172
|
}, function (provided) {
|
|
173
173
|
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
174
|
+
className: css(getVariant('body')),
|
|
175
|
+
"data-dnd-ignore-scrollable": true,
|
|
174
176
|
ref: function ref(_ref2) {
|
|
175
177
|
bodyRef.current = _ref2;
|
|
176
178
|
provided.innerRef(_ref2);
|
|
177
179
|
},
|
|
178
|
-
role: "rowgroup"
|
|
179
|
-
className: css(getVariant('body'))
|
|
180
|
+
role: "rowgroup"
|
|
180
181
|
}, provided.droppableProps), /*#__PURE__*/_react["default"].createElement(_components.BodyRows, bodyRowsProps), provided.placeholder);
|
|
181
182
|
}));
|
|
182
183
|
} else {
|
|
@@ -17,25 +17,28 @@ var palette = {
|
|
|
17
17
|
darkest: 'hsl(88, 72%, 20%)'
|
|
18
18
|
},
|
|
19
19
|
warning: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
lightest: 'hsl(42, 87%, 97%)',
|
|
21
|
+
lighter: 'hsl(42, 87%, 94%)',
|
|
22
|
+
light: 'hsl(42, 87%, 90%)',
|
|
23
|
+
base: 'hsl(42, 84%, 63%)',
|
|
24
|
+
dark: 'hsl(42, 84%, 55%)',
|
|
25
|
+
darker: 'hsl(42, 84%, 49%)'
|
|
25
26
|
},
|
|
26
27
|
error: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
lightest: 'hsl(7, 60%, 97%)',
|
|
29
|
+
lighter: 'hsl(9, 59%, 93%)',
|
|
30
|
+
light: 'hsl(8, 60%, 85%)',
|
|
31
|
+
base: 'hsl(8, 60%, 47%)',
|
|
32
|
+
dark: 'hsl(8, 60%, 45%)',
|
|
33
|
+
darker: 'hsl(9, 61%, 43%)'
|
|
32
34
|
},
|
|
33
35
|
success: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
lightest: 'hsl(93, 53%, 97%)',
|
|
37
|
+
lighter: 'hsl(95, 50%, 91%)',
|
|
38
|
+
light: 'hsl(86, 91%, 35%)',
|
|
39
|
+
base: 'hsl(86, 91%, 27%)',
|
|
40
|
+
dark: 'hsl(86, 91%, 25%)',
|
|
41
|
+
darker: 'hsl(86, 91%, 23%)'
|
|
39
42
|
},
|
|
40
43
|
red: ['hsl(8, 73%, 96%)', 'hsl(8, 74%, 92%)', 'hsl(8, 75%, 88%)', 'hsl(8, 76%, 68%)', 'hsl(8, 77%, 60%)', 'hsl(8, 78%, 56%)', 'hsl(8, 79%, 52%)', 'hsl(8, 80%, 48%)', 'hsl(8, 81%, 40%)', 'hsl(8, 82%, 30%)'],
|
|
41
44
|
blue: ['hsl(197, 56%, 92%)', 'hsl(197, 56%, 88%)', 'hsl(197, 56%, 72%)', 'hsl(197, 56%, 64%)', 'hsl(197, 56%, 52%)', 'hsl(197, 56%, 44%)', 'hsl(197, 56%, 40%)', 'hsl(197, 56%, 32%)', 'hsl(197, 56%, 24%)', 'hsl(197, 56%, 20%)'],
|
|
@@ -168,13 +168,25 @@ export function Button(_ref) {
|
|
|
168
168
|
if (iconRight) {
|
|
169
169
|
iconRight['color'] = 'transparent';
|
|
170
170
|
}
|
|
171
|
-
}
|
|
172
|
-
|
|
171
|
+
}
|
|
173
172
|
|
|
174
173
|
if (disabled) {
|
|
175
|
-
buttonProps['aria-disabled'] = true;
|
|
176
|
-
buttonProps.cursor = 'not-allowed';
|
|
177
174
|
buttonProps.opacity = 0.65;
|
|
175
|
+
|
|
176
|
+
if (buttonProps.type === "button" || buttonProps.type === "reset") {
|
|
177
|
+
buttonProps.disabled = true;
|
|
178
|
+
} else if (buttonProps.type === "submit") {
|
|
179
|
+
buttonProps['aria-disabled'] = true;
|
|
180
|
+
buttonProps.cursor = 'not-allowed';
|
|
181
|
+
|
|
182
|
+
buttonProps.onClick = function (event) {
|
|
183
|
+
return event.preventDefault();
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
buttonProps.onKeyDown = function (event) {
|
|
187
|
+
return event.preventDefault();
|
|
188
|
+
};
|
|
189
|
+
}
|
|
178
190
|
} // don't apply hover/active styles or events when disabled or spinner is present
|
|
179
191
|
|
|
180
192
|
|
|
@@ -23,48 +23,75 @@ it("should render as <button> with type=\"submit\"", function () {
|
|
|
23
23
|
var button = container.querySelector('button');
|
|
24
24
|
expect(button.getAttribute('type')).toEqual('submit');
|
|
25
25
|
});
|
|
26
|
+
|
|
27
|
+
var _ref3 = /*#__PURE__*/React.createElement(Button, {
|
|
28
|
+
disabled: true
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should render \"disabled\" attribute, if <button> is disabled", function () {
|
|
32
|
+
var _render3 = render(_ref3),
|
|
33
|
+
container = _render3.container;
|
|
34
|
+
|
|
35
|
+
var button = container.querySelector('button');
|
|
36
|
+
expect(button.getAttribute("aria-disabled")).toEqual(null);
|
|
37
|
+
expect(button.disabled).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
var _ref4 = /*#__PURE__*/React.createElement(Button, {
|
|
41
|
+
type: "submit",
|
|
42
|
+
disabled: true
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("should render \"aria-disabled\" attribute, if <button type=\"submit\"> is disabled", function () {
|
|
46
|
+
var _render4 = render(_ref4),
|
|
47
|
+
container = _render4.container;
|
|
48
|
+
|
|
49
|
+
var button = container.querySelector('button');
|
|
50
|
+
expect(button.getAttribute("aria-disabled")).toEqual("true");
|
|
51
|
+
expect(button.disabled).toBe(false);
|
|
52
|
+
});
|
|
26
53
|
it("should render title", function () {
|
|
27
54
|
var title = 'Hello';
|
|
28
55
|
|
|
29
|
-
var
|
|
56
|
+
var _render5 = render( /*#__PURE__*/React.createElement(Button, {
|
|
30
57
|
title: title
|
|
31
58
|
})),
|
|
32
|
-
getByText =
|
|
59
|
+
getByText = _render5.getByText;
|
|
33
60
|
|
|
34
61
|
getByText(title);
|
|
35
62
|
});
|
|
36
63
|
|
|
37
|
-
var
|
|
64
|
+
var _ref5 = /*#__PURE__*/React.createElement(Button, {
|
|
38
65
|
to: "#"
|
|
39
66
|
});
|
|
40
67
|
|
|
41
68
|
it("should render <a> without a type if \"to\" is provided", function () {
|
|
42
|
-
var
|
|
43
|
-
container =
|
|
69
|
+
var _render6 = render(_ref5),
|
|
70
|
+
container = _render6.container;
|
|
44
71
|
|
|
45
72
|
var button = container.querySelector('a');
|
|
46
73
|
expect(button.getAttribute('type')).toBeNull();
|
|
47
74
|
});
|
|
48
75
|
|
|
49
|
-
var
|
|
76
|
+
var _ref6 = /*#__PURE__*/React.createElement(Button, {
|
|
50
77
|
href: "#"
|
|
51
78
|
});
|
|
52
79
|
|
|
53
80
|
it("should render <a> without a type if \"href\" is provided", function () {
|
|
54
|
-
var
|
|
55
|
-
container =
|
|
81
|
+
var _render7 = render(_ref6),
|
|
82
|
+
container = _render7.container;
|
|
56
83
|
|
|
57
84
|
var button = container.querySelector('a');
|
|
58
85
|
expect(button.getAttribute('type')).toBeNull();
|
|
59
86
|
});
|
|
60
87
|
|
|
61
|
-
var
|
|
88
|
+
var _ref7 = /*#__PURE__*/React.createElement(Button, {
|
|
62
89
|
to: "#"
|
|
63
90
|
});
|
|
64
91
|
|
|
65
92
|
it("should render <a> with \"href\" if \"to\" is specifed", function () {
|
|
66
|
-
var
|
|
67
|
-
container =
|
|
93
|
+
var _render8 = render(_ref7),
|
|
94
|
+
container = _render8.container;
|
|
68
95
|
|
|
69
96
|
var button = container.querySelector('a');
|
|
70
97
|
expect(button.getAttribute('href')).toEqual('#');
|
|
@@ -72,12 +99,12 @@ it("should render <a> with \"href\" if \"to\" is specifed", function () {
|
|
|
72
99
|
it("should render href and external link values", function () {
|
|
73
100
|
var title = 'Hello';
|
|
74
101
|
|
|
75
|
-
var
|
|
102
|
+
var _render9 = render( /*#__PURE__*/React.createElement(Button, {
|
|
76
103
|
external: true,
|
|
77
104
|
title: title,
|
|
78
105
|
to: "https://www.planningcenter.com"
|
|
79
106
|
})),
|
|
80
|
-
getByText =
|
|
107
|
+
getByText = _render9.getByText;
|
|
81
108
|
|
|
82
109
|
var button = getByText(title);
|
|
83
110
|
expect(button.getAttribute('href')).toEqual('https://www.planningcenter.com');
|
|
@@ -87,20 +114,20 @@ it("should render href and external link values", function () {
|
|
|
87
114
|
it("should call onClick when clicked or Enter or Space key is pressed", function () {
|
|
88
115
|
var onClick = jest.fn();
|
|
89
116
|
|
|
90
|
-
var
|
|
117
|
+
var _render10 = render( /*#__PURE__*/React.createElement(Button, {
|
|
91
118
|
onClick: onClick
|
|
92
119
|
})),
|
|
93
|
-
container =
|
|
120
|
+
container = _render10.container;
|
|
94
121
|
|
|
95
122
|
fireEvent.click(container.firstChild);
|
|
96
123
|
expect(onClick).toHaveBeenCalledTimes(1);
|
|
97
124
|
});
|
|
98
125
|
|
|
99
|
-
var
|
|
126
|
+
var _ref8 = /*#__PURE__*/React.createElement(Button, null);
|
|
100
127
|
|
|
101
128
|
it("should not call onClick when Enter or Space key is pressed and onClick isn't present", function () {
|
|
102
|
-
var
|
|
103
|
-
container =
|
|
129
|
+
var _render11 = render(_ref8),
|
|
130
|
+
container = _render11.container;
|
|
104
131
|
|
|
105
132
|
fireEvent.keyDown(container.firstChild, {
|
|
106
133
|
key: 'Enter'
|
|
@@ -150,12 +150,13 @@ var DataTable = function DataTable(props) {
|
|
|
150
150
|
onDrop: onDrop
|
|
151
151
|
}, function (provided) {
|
|
152
152
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
153
|
+
className: css(getVariant('body')),
|
|
154
|
+
"data-dnd-ignore-scrollable": true,
|
|
153
155
|
ref: function ref(_ref2) {
|
|
154
156
|
bodyRef.current = _ref2;
|
|
155
157
|
provided.innerRef(_ref2);
|
|
156
158
|
},
|
|
157
|
-
role: "rowgroup"
|
|
158
|
-
className: css(getVariant('body'))
|
|
159
|
+
role: "rowgroup"
|
|
159
160
|
}, provided.droppableProps), /*#__PURE__*/React.createElement(BodyRows, bodyRowsProps), provided.placeholder);
|
|
160
161
|
}));
|
|
161
162
|
} else {
|
|
@@ -10,25 +10,28 @@ export var palette = {
|
|
|
10
10
|
darkest: 'hsl(88, 72%, 20%)'
|
|
11
11
|
},
|
|
12
12
|
warning: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
lightest: 'hsl(42, 87%, 97%)',
|
|
14
|
+
lighter: 'hsl(42, 87%, 94%)',
|
|
15
|
+
light: 'hsl(42, 87%, 90%)',
|
|
16
|
+
base: 'hsl(42, 84%, 63%)',
|
|
17
|
+
dark: 'hsl(42, 84%, 55%)',
|
|
18
|
+
darker: 'hsl(42, 84%, 49%)'
|
|
18
19
|
},
|
|
19
20
|
error: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
lightest: 'hsl(7, 60%, 97%)',
|
|
22
|
+
lighter: 'hsl(9, 59%, 93%)',
|
|
23
|
+
light: 'hsl(8, 60%, 85%)',
|
|
24
|
+
base: 'hsl(8, 60%, 47%)',
|
|
25
|
+
dark: 'hsl(8, 60%, 45%)',
|
|
26
|
+
darker: 'hsl(9, 61%, 43%)'
|
|
25
27
|
},
|
|
26
28
|
success: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
lightest: 'hsl(93, 53%, 97%)',
|
|
30
|
+
lighter: 'hsl(95, 50%, 91%)',
|
|
31
|
+
light: 'hsl(86, 91%, 35%)',
|
|
32
|
+
base: 'hsl(86, 91%, 27%)',
|
|
33
|
+
dark: 'hsl(86, 91%, 25%)',
|
|
34
|
+
darker: 'hsl(86, 91%, 23%)'
|
|
32
35
|
},
|
|
33
36
|
red: ['hsl(8, 73%, 96%)', 'hsl(8, 74%, 92%)', 'hsl(8, 75%, 88%)', 'hsl(8, 76%, 68%)', 'hsl(8, 77%, 60%)', 'hsl(8, 78%, 56%)', 'hsl(8, 79%, 52%)', 'hsl(8, 80%, 48%)', 'hsl(8, 81%, 40%)', 'hsl(8, 82%, 30%)'],
|
|
34
37
|
blue: ['hsl(197, 56%, 92%)', 'hsl(197, 56%, 88%)', 'hsl(197, 56%, 72%)', 'hsl(197, 56%, 64%)', 'hsl(197, 56%, 52%)', 'hsl(197, 56%, 44%)', 'hsl(197, 56%, 40%)', 'hsl(197, 56%, 32%)', 'hsl(197, 56%, 24%)', 'hsl(197, 56%, 20%)'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/tapestry-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
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",
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"@types/react-dom": "^18.0.8",
|
|
64
64
|
"babel-eslint": "10.1.0",
|
|
65
65
|
"chokidar-cli": "^2.1.0",
|
|
66
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
67
66
|
"dotenv": "^8.2.0",
|
|
68
67
|
"eslint": "7.20.0",
|
|
69
68
|
"eslint-config-react-app": "6.0.0",
|
|
@@ -88,8 +87,8 @@
|
|
|
88
87
|
"typescript": "^4.1.5"
|
|
89
88
|
},
|
|
90
89
|
"dependencies": {
|
|
91
|
-
"@planningcenter/icons": "^14.
|
|
92
|
-
"@planningcenter/react-beautiful-dnd": "^13.
|
|
90
|
+
"@planningcenter/icons": "^14.18.1",
|
|
91
|
+
"@planningcenter/react-beautiful-dnd": "^13.3.0",
|
|
93
92
|
"@popmotion/popcorn": "^0.4.4",
|
|
94
93
|
"@popperjs/core": "^2.11.6",
|
|
95
94
|
"@react-hook/window-size": "^3.1.1",
|
|
@@ -14,6 +14,20 @@ it(`should render as <button> with type="submit"`, () => {
|
|
|
14
14
|
expect(button.getAttribute('type')).toEqual('submit')
|
|
15
15
|
})
|
|
16
16
|
|
|
17
|
+
it(`should render "disabled" attribute, if <button> is disabled`, () => {
|
|
18
|
+
const { container } = render(<Button disabled />)
|
|
19
|
+
const button = container.querySelector('button')
|
|
20
|
+
expect(button.getAttribute("aria-disabled")).toEqual(null)
|
|
21
|
+
expect(button.disabled).toBe(true)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it(`should render "aria-disabled" attribute, if <button type="submit"> is disabled`, () => {
|
|
25
|
+
const { container } = render(<Button type="submit" disabled />)
|
|
26
|
+
const button = container.querySelector('button')
|
|
27
|
+
expect(button.getAttribute("aria-disabled")).toEqual("true")
|
|
28
|
+
expect(button.disabled).toBe(false)
|
|
29
|
+
})
|
|
30
|
+
|
|
17
31
|
it(`should render title`, () => {
|
|
18
32
|
const title = 'Hello'
|
|
19
33
|
const { getByText } = render(<Button title={title} />)
|
package/src/Button/Button.tsx
CHANGED
|
@@ -254,11 +254,17 @@ export function Button({
|
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
// don't allow interacting with button when disabled
|
|
258
257
|
if (disabled) {
|
|
259
|
-
buttonProps['aria-disabled'] = true
|
|
260
|
-
buttonProps.cursor = 'not-allowed'
|
|
261
258
|
buttonProps.opacity = 0.65
|
|
259
|
+
|
|
260
|
+
if (buttonProps.type === "button" || buttonProps.type === "reset") {
|
|
261
|
+
buttonProps.disabled = true
|
|
262
|
+
} else if (buttonProps.type === "submit") {
|
|
263
|
+
buttonProps['aria-disabled'] = true
|
|
264
|
+
buttonProps.cursor = 'not-allowed'
|
|
265
|
+
buttonProps.onClick = (event) => event.preventDefault()
|
|
266
|
+
buttonProps.onKeyDown = (event) => event.preventDefault()
|
|
267
|
+
}
|
|
262
268
|
}
|
|
263
269
|
|
|
264
270
|
// don't apply hover/active styles or events when disabled or spinner is present
|
|
@@ -436,12 +436,13 @@ const DataTable = (props: Props) => {
|
|
|
436
436
|
>
|
|
437
437
|
{(provided) => (
|
|
438
438
|
<div
|
|
439
|
+
className={css(getVariant('body'))}
|
|
440
|
+
data-dnd-ignore-scrollable
|
|
439
441
|
ref={(ref) => {
|
|
440
442
|
bodyRef.current = ref
|
|
441
443
|
provided.innerRef(ref)
|
|
442
444
|
}}
|
|
443
445
|
role="rowgroup"
|
|
444
|
-
className={css(getVariant('body'))}
|
|
445
446
|
{...provided.droppableProps}
|
|
446
447
|
>
|
|
447
448
|
<BodyRows {...bodyRowsProps} />
|
package/src/Icon/Icon.mdx
CHANGED
|
@@ -68,8 +68,9 @@ Preview all of the available icon sets and their icon's names from `@planningcen
|
|
|
68
68
|
|
|
69
69
|
```jsx live
|
|
70
70
|
render(() => {
|
|
71
|
-
const
|
|
72
|
-
const [
|
|
71
|
+
const iconSets = Object.keys(icons).filter(icons => icons !== "tapestry")
|
|
72
|
+
const [searchValue, setSearchValue] = React.useState('')
|
|
73
|
+
const [selectedIconSet, setSelectedIconSet] = React.useState('general')
|
|
73
74
|
|
|
74
75
|
return (
|
|
75
76
|
<StackView grow={1}>
|
|
@@ -77,12 +78,12 @@ render(() => {
|
|
|
77
78
|
<Select
|
|
78
79
|
basis={26}
|
|
79
80
|
emptyValue="Choose icon set"
|
|
80
|
-
onChange={(event) =>
|
|
81
|
-
defaultValue={
|
|
81
|
+
onChange={(event) => setSelectedIconSet(event.value)}
|
|
82
|
+
defaultValue={selectedIconSet}
|
|
82
83
|
>
|
|
83
|
-
{
|
|
84
|
-
<Select.Option key={
|
|
85
|
-
{
|
|
84
|
+
{iconSets.map((icons) => (
|
|
85
|
+
<Select.Option key={icons} value={icons}>
|
|
86
|
+
{icons}
|
|
86
87
|
</Select.Option>
|
|
87
88
|
))}
|
|
88
89
|
</Select>
|
|
@@ -91,14 +92,14 @@ render(() => {
|
|
|
91
92
|
autoFocus
|
|
92
93
|
renderLeft={<Icon name="general.search" />}
|
|
93
94
|
placeholder="Search by icon name"
|
|
94
|
-
value={
|
|
95
|
-
onChange={(e) =>
|
|
95
|
+
value={searchValue}
|
|
96
|
+
onChange={(e) => setSearchValue(e.target.value)}
|
|
96
97
|
/>
|
|
97
98
|
</StackView>
|
|
98
99
|
<TileView minCellWidth={16} spacing={4} margin={4}>
|
|
99
|
-
{matchSorter(Object.keys(icons[
|
|
100
|
+
{matchSorter(Object.keys(icons[selectedIconSet]), searchValue).map((iconName) => (
|
|
100
101
|
<StackView key={iconName} alignment="center" spacing={1}>
|
|
101
|
-
<Icon key={iconName} name={`${
|
|
102
|
+
<Icon key={iconName} name={`${selectedIconSet}.${iconName}`} size="xl" />
|
|
102
103
|
<Text fontSize={5} color="foregroundSecondary">
|
|
103
104
|
{iconName}
|
|
104
105
|
</Text>
|
|
@@ -12,27 +12,30 @@ export const palette = {
|
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
warning: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
lightest: 'hsl(42, 87%, 97%)',
|
|
16
|
+
lighter: 'hsl(42, 87%, 94%)',
|
|
17
|
+
light: 'hsl(42, 87%, 90%)',
|
|
18
|
+
base: 'hsl(42, 84%, 63%)',
|
|
19
|
+
dark: 'hsl(42, 84%, 55%)',
|
|
20
|
+
darker: 'hsl(42, 84%, 49%)',
|
|
20
21
|
},
|
|
21
22
|
|
|
22
23
|
error: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
lightest: 'hsl(7, 60%, 97%)',
|
|
25
|
+
lighter: 'hsl(9, 59%, 93%)',
|
|
26
|
+
light: 'hsl(8, 60%, 85%)',
|
|
27
|
+
base: 'hsl(8, 60%, 47%)',
|
|
28
|
+
dark: 'hsl(8, 60%, 45%)',
|
|
29
|
+
darker: 'hsl(9, 61%, 43%)',
|
|
28
30
|
},
|
|
29
31
|
|
|
30
32
|
success: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
lightest: 'hsl(93, 53%, 97%)',
|
|
34
|
+
lighter: 'hsl(95, 50%, 91%)',
|
|
35
|
+
light: 'hsl(86, 91%, 35%)',
|
|
36
|
+
base: 'hsl(86, 91%, 27%)',
|
|
37
|
+
dark: 'hsl(86, 91%, 25%)',
|
|
38
|
+
darker: 'hsl(86, 91%, 23%)',
|
|
36
39
|
},
|
|
37
40
|
|
|
38
41
|
red: [
|