@react-aria/button 3.0.0-nightly.1998 → 3.0.0-nightly.2009
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/import.mjs +112 -0
- package/package.json +13 -8
package/dist/import.mjs
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {mergeProps as $cE0pI$mergeProps, filterDOMProps as $cE0pI$filterDOMProps, chain as $cE0pI$chain} from "@react-aria/utils";
|
|
2
|
+
import {useFocusable as $cE0pI$useFocusable} from "@react-aria/focus";
|
|
3
|
+
import {usePress as $cE0pI$usePress} from "@react-aria/interactions";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/ /*
|
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
+
* governing permissions and limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
|
|
30
|
+
let { elementType: elementType = "button" , isDisabled: isDisabled , onPress: onPress , onPressStart: onPressStart , onPressEnd: onPressEnd , onPressChange: onPressChange , preventFocusOnPress: // @ts-ignore - undocumented
|
|
31
|
+
preventFocusOnPress , allowFocusWhenDisabled: // @ts-ignore - undocumented
|
|
32
|
+
allowFocusWhenDisabled , // @ts-ignore
|
|
33
|
+
onClick: deprecatedOnClick , href: href , target: target , rel: rel , type: type = "button" } = props;
|
|
34
|
+
let additionalProps;
|
|
35
|
+
if (elementType === "button") additionalProps = {
|
|
36
|
+
type: type,
|
|
37
|
+
disabled: isDisabled
|
|
38
|
+
};
|
|
39
|
+
else additionalProps = {
|
|
40
|
+
role: "button",
|
|
41
|
+
tabIndex: isDisabled ? undefined : 0,
|
|
42
|
+
href: elementType === "a" && isDisabled ? undefined : href,
|
|
43
|
+
target: elementType === "a" ? target : undefined,
|
|
44
|
+
type: elementType === "input" ? type : undefined,
|
|
45
|
+
disabled: elementType === "input" ? isDisabled : undefined,
|
|
46
|
+
"aria-disabled": !isDisabled || elementType === "input" ? undefined : isDisabled,
|
|
47
|
+
rel: elementType === "a" ? rel : undefined
|
|
48
|
+
};
|
|
49
|
+
let { pressProps: pressProps , isPressed: isPressed } = (0, $cE0pI$usePress)({
|
|
50
|
+
onPressStart: onPressStart,
|
|
51
|
+
onPressEnd: onPressEnd,
|
|
52
|
+
onPressChange: onPressChange,
|
|
53
|
+
onPress: onPress,
|
|
54
|
+
isDisabled: isDisabled,
|
|
55
|
+
preventFocusOnPress: preventFocusOnPress,
|
|
56
|
+
ref: ref
|
|
57
|
+
});
|
|
58
|
+
let { focusableProps: focusableProps } = (0, $cE0pI$useFocusable)(props, ref);
|
|
59
|
+
if (allowFocusWhenDisabled) focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;
|
|
60
|
+
let buttonProps = (0, $cE0pI$mergeProps)(focusableProps, pressProps, (0, $cE0pI$filterDOMProps)(props, {
|
|
61
|
+
labelable: true
|
|
62
|
+
}));
|
|
63
|
+
return {
|
|
64
|
+
isPressed: isPressed,
|
|
65
|
+
buttonProps: (0, $cE0pI$mergeProps)(additionalProps, buttonProps, {
|
|
66
|
+
"aria-haspopup": props["aria-haspopup"],
|
|
67
|
+
"aria-expanded": props["aria-expanded"],
|
|
68
|
+
"aria-controls": props["aria-controls"],
|
|
69
|
+
"aria-pressed": props["aria-pressed"],
|
|
70
|
+
onClick: (e)=>{
|
|
71
|
+
if (deprecatedOnClick) {
|
|
72
|
+
deprecatedOnClick(e);
|
|
73
|
+
console.warn("onClick is deprecated, please use onPress");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
/*
|
|
82
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
83
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
84
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
85
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
86
|
+
*
|
|
87
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
88
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
89
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
90
|
+
* governing permissions and limitations under the License.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
function $55f54f7887471b58$export$51e84d46ca0bc451(props, state, ref) {
|
|
95
|
+
const { isSelected: isSelected } = state;
|
|
96
|
+
const { isPressed: isPressed , buttonProps: buttonProps } = (0, $701a24aa0da5b062$export$ea18c227d4417cc3)({
|
|
97
|
+
...props,
|
|
98
|
+
onPress: (0, $cE0pI$chain)(state.toggle, props.onPress)
|
|
99
|
+
}, ref);
|
|
100
|
+
return {
|
|
101
|
+
isPressed: isPressed,
|
|
102
|
+
buttonProps: (0, $cE0pI$mergeProps)(buttonProps, {
|
|
103
|
+
"aria-pressed": isSelected
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
export {$701a24aa0da5b062$export$ea18c227d4417cc3 as useButton, $55f54f7887471b58$export$51e84d46ca0bc451 as useToggleButton};
|
|
112
|
+
//# sourceMappingURL=module.js.map
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/button",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.2009+0f953cac8",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"types": "./dist/types.d.ts",
|
|
10
|
+
"import": "./dist/import.mjs",
|
|
11
|
+
"require": "./dist/main.js"
|
|
12
|
+
},
|
|
8
13
|
"types": "dist/types.d.ts",
|
|
9
14
|
"source": "src/index.ts",
|
|
10
15
|
"files": [
|
|
@@ -17,12 +22,12 @@
|
|
|
17
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
18
23
|
},
|
|
19
24
|
"dependencies": {
|
|
20
|
-
"@react-aria/focus": "3.0.0-nightly.
|
|
21
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
22
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
23
|
-
"@react-stately/toggle": "3.0.0-nightly.
|
|
24
|
-
"@react-types/button": "3.7.1-nightly.
|
|
25
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
25
|
+
"@react-aria/focus": "3.0.0-nightly.2009+0f953cac8",
|
|
26
|
+
"@react-aria/interactions": "3.0.0-nightly.2009+0f953cac8",
|
|
27
|
+
"@react-aria/utils": "3.0.0-nightly.2009+0f953cac8",
|
|
28
|
+
"@react-stately/toggle": "3.0.0-nightly.2009+0f953cac8",
|
|
29
|
+
"@react-types/button": "3.7.1-nightly.3709+0f953cac8",
|
|
30
|
+
"@react-types/shared": "3.0.0-nightly.2009+0f953cac8",
|
|
26
31
|
"@swc/helpers": "^0.4.14"
|
|
27
32
|
},
|
|
28
33
|
"peerDependencies": {
|
|
@@ -31,5 +36,5 @@
|
|
|
31
36
|
"publishConfig": {
|
|
32
37
|
"access": "public"
|
|
33
38
|
},
|
|
34
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "0f953cac84f98cdff29f2348c120ce541ebb6da8"
|
|
35
40
|
}
|