@planningcenter/tapestry-react 2.2.0 → 2.4.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 +6 -3
- package/dist/cjs/Scrim/Scrim.js +1 -1
- package/dist/cjs/Sidebar/Sidebar.js +1 -1
- package/dist/esm/Button/Button.js +6 -3
- package/dist/esm/Scrim/Scrim.js +1 -1
- package/dist/esm/Sidebar/Sidebar.js +1 -1
- package/package.json +2 -2
- package/src/Button/Button.tsx +6 -3
- package/src/Scrim/Scrim.tsx +1 -1
- package/src/Sidebar/Sidebar.js +3 -2
- package/src/.DS_Store +0 -0
|
@@ -68,7 +68,7 @@ function Button(_ref) {
|
|
|
68
68
|
|
|
69
69
|
var buttonProps = {
|
|
70
70
|
alignment: 'center',
|
|
71
|
-
as: restProps.href || to ? 'a' : '
|
|
71
|
+
as: restProps.href || to ? 'a' : 'button',
|
|
72
72
|
axis: 'horizontal',
|
|
73
73
|
distribution: 'center',
|
|
74
74
|
fontSize: fontSize,
|
|
@@ -77,7 +77,6 @@ function Button(_ref) {
|
|
|
77
77
|
lineHeight: lineHeight,
|
|
78
78
|
position: 'relative',
|
|
79
79
|
radius: 3,
|
|
80
|
-
role: 'button',
|
|
81
80
|
strokeAlign: 'inside',
|
|
82
81
|
strokeWeight: 1,
|
|
83
82
|
userSelect: 'none',
|
|
@@ -192,7 +191,6 @@ function Button(_ref) {
|
|
|
192
191
|
};
|
|
193
192
|
buttonProps.cursor = 'pointer';
|
|
194
193
|
buttonProps.touchAction = 'manipulation';
|
|
195
|
-
buttonProps.tabIndex = 0;
|
|
196
194
|
buttonProps.onClick = onClick;
|
|
197
195
|
|
|
198
196
|
buttonProps.onKeyDown = function (event) {
|
|
@@ -232,6 +230,11 @@ function Button(_ref) {
|
|
|
232
230
|
|
|
233
231
|
if (restProps.as) {
|
|
234
232
|
buttonProps.to = to;
|
|
233
|
+
} // set button type to prevent nested buttons from unintentionally submiting forms
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
if (buttonProps.as === "button") {
|
|
237
|
+
buttonProps.type = "button";
|
|
235
238
|
}
|
|
236
239
|
|
|
237
240
|
if (process.env.NODE_ENV !== 'production') {
|
package/dist/cjs/Scrim/Scrim.js
CHANGED
|
@@ -42,7 +42,7 @@ function Sidebar(_ref) {
|
|
|
42
42
|
}, restProps), (0, _react.jsx)(_reactStickyBox["default"], {
|
|
43
43
|
css: flexColumnCss
|
|
44
44
|
}, _react2.Children.map(children, function (child) {
|
|
45
|
-
if (child && child.type !== Sidebar.List
|
|
45
|
+
if (child && child.type !== Sidebar.List && child.type !== Sidebar.Item) {
|
|
46
46
|
console.warn("Invalid component nesting. " + child.type + " cannot appear as a child of <Sidebar>. Only <Sidebar.List/> or <Sidebar.Item/> may be used.");
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -61,7 +61,7 @@ export function Button(_ref) {
|
|
|
61
61
|
|
|
62
62
|
var buttonProps = {
|
|
63
63
|
alignment: 'center',
|
|
64
|
-
as: restProps.href || to ? 'a' : '
|
|
64
|
+
as: restProps.href || to ? 'a' : 'button',
|
|
65
65
|
axis: 'horizontal',
|
|
66
66
|
distribution: 'center',
|
|
67
67
|
fontSize: fontSize,
|
|
@@ -70,7 +70,6 @@ export function Button(_ref) {
|
|
|
70
70
|
lineHeight: lineHeight,
|
|
71
71
|
position: 'relative',
|
|
72
72
|
radius: 3,
|
|
73
|
-
role: 'button',
|
|
74
73
|
strokeAlign: 'inside',
|
|
75
74
|
strokeWeight: 1,
|
|
76
75
|
userSelect: 'none',
|
|
@@ -185,7 +184,6 @@ export function Button(_ref) {
|
|
|
185
184
|
};
|
|
186
185
|
buttonProps.cursor = 'pointer';
|
|
187
186
|
buttonProps.touchAction = 'manipulation';
|
|
188
|
-
buttonProps.tabIndex = 0;
|
|
189
187
|
buttonProps.onClick = onClick;
|
|
190
188
|
|
|
191
189
|
buttonProps.onKeyDown = function (event) {
|
|
@@ -225,6 +223,11 @@ export function Button(_ref) {
|
|
|
225
223
|
|
|
226
224
|
if (restProps.as) {
|
|
227
225
|
buttonProps.to = to;
|
|
226
|
+
} // set button type to prevent nested buttons from unintentionally submiting forms
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
if (buttonProps.as === "button") {
|
|
230
|
+
buttonProps.type = "button";
|
|
228
231
|
}
|
|
229
232
|
|
|
230
233
|
if (process.env.NODE_ENV !== 'production') {
|
package/dist/esm/Scrim/Scrim.js
CHANGED
|
@@ -28,7 +28,7 @@ function Sidebar(_ref) {
|
|
|
28
28
|
}, restProps), jsx(StickyBox, {
|
|
29
29
|
css: flexColumnCss
|
|
30
30
|
}, Children.map(children, function (child) {
|
|
31
|
-
if (child && child.type !== Sidebar.List
|
|
31
|
+
if (child && child.type !== Sidebar.List && child.type !== Sidebar.Item) {
|
|
32
32
|
console.warn("Invalid component nesting. " + child.type + " cannot appear as a child of <Sidebar>. Only <Sidebar.List/> or <Sidebar.Item/> may be used.");
|
|
33
33
|
}
|
|
34
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/tapestry-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.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",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"typescript": "^4.1.5"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@planningcenter/icons": "^14.
|
|
91
|
+
"@planningcenter/icons": "^14.11.0",
|
|
92
92
|
"@planningcenter/react-beautiful-dnd": "^13.2.1",
|
|
93
93
|
"@popmotion/popcorn": "^0.4.4",
|
|
94
94
|
"@popperjs/core": "^2.11.6",
|
package/src/Button/Button.tsx
CHANGED
|
@@ -140,7 +140,7 @@ export function Button({
|
|
|
140
140
|
|
|
141
141
|
let buttonProps: any = {
|
|
142
142
|
alignment: 'center',
|
|
143
|
-
as: (restProps as any).href || to ? 'a' : '
|
|
143
|
+
as: (restProps as any).href || to ? 'a' : 'button',
|
|
144
144
|
axis: 'horizontal',
|
|
145
145
|
distribution: 'center',
|
|
146
146
|
fontSize,
|
|
@@ -149,7 +149,6 @@ export function Button({
|
|
|
149
149
|
lineHeight,
|
|
150
150
|
position: 'relative',
|
|
151
151
|
radius: 3,
|
|
152
|
-
role: 'button',
|
|
153
152
|
strokeAlign: 'inside',
|
|
154
153
|
strokeWeight: 1,
|
|
155
154
|
userSelect: 'none',
|
|
@@ -258,7 +257,6 @@ export function Button({
|
|
|
258
257
|
buttonProps.focus = { zIndex: 5 }
|
|
259
258
|
buttonProps.cursor = 'pointer'
|
|
260
259
|
buttonProps.touchAction = 'manipulation'
|
|
261
|
-
buttonProps.tabIndex = 0
|
|
262
260
|
buttonProps.onClick = onClick
|
|
263
261
|
buttonProps.onKeyDown = (event) => {
|
|
264
262
|
if (onClick && (event.key === 'Enter' || event.key === ' ')) {
|
|
@@ -300,6 +298,11 @@ export function Button({
|
|
|
300
298
|
buttonProps.to = to
|
|
301
299
|
}
|
|
302
300
|
|
|
301
|
+
// set button type to prevent nested buttons from unintentionally submiting forms
|
|
302
|
+
if (buttonProps.as === "button") {
|
|
303
|
+
buttonProps.type = "button"
|
|
304
|
+
}
|
|
305
|
+
|
|
303
306
|
if (process.env.NODE_ENV !== 'production') {
|
|
304
307
|
if (icon && !(title || (tooltip && (tooltip as any).title))) {
|
|
305
308
|
const { tooltipProps, wrapperProps } = useAccessibilityViolation(
|
package/src/Scrim/Scrim.tsx
CHANGED
package/src/Sidebar/Sidebar.js
CHANGED
|
@@ -30,8 +30,9 @@ function Sidebar({ children, ...restProps }: Props) {
|
|
|
30
30
|
<StickyBox css={flexColumnCss}>
|
|
31
31
|
{Children.map(children, (child) => {
|
|
32
32
|
if (
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
child &&
|
|
34
|
+
child.type !== Sidebar.List &&
|
|
35
|
+
child.type !== Sidebar.Item
|
|
35
36
|
) {
|
|
36
37
|
console.warn(
|
|
37
38
|
`Invalid component nesting. ${child.type} cannot appear as a child of <Sidebar>. Only <Sidebar.List/> or <Sidebar.Item/> may be used.`
|
package/src/.DS_Store
DELETED
|
Binary file
|