@pingux/astro 2.33.0-alpha.4 → 2.33.0-alpha.6
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/lib/cjs/hooks/useNavBarPress/index.d.ts +1 -0
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.d.ts +20 -0
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.js +0 -8
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.test.d.ts +1 -0
- package/lib/cjs/hooks/useOverlayPanelState/index.d.ts +1 -0
- package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.d.ts +32 -0
- package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.js +0 -10
- package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.test.d.ts +1 -0
- package/lib/cjs/hooks/usePropWarning/index.d.ts +1 -0
- package/lib/cjs/hooks/usePropWarning/usePropWarning.d.ts +13 -0
- package/lib/cjs/hooks/usePropWarning/usePropWarning.js +0 -8
- package/lib/cjs/hooks/usePropWarning/usePropWarning.test.d.ts +1 -0
- package/lib/cjs/hooks/usePropWarning/usePropWarning.test.js +13 -9
- package/lib/cjs/hooks/useRockerButton/index.d.ts +1 -0
- package/lib/cjs/hooks/useRockerButton/useRockerButton.d.ts +241 -0
- package/lib/hooks/useNavBarPress/useNavBarPress.js +0 -8
- package/lib/hooks/useOverlayPanelState/useOverlayPanelState.js +0 -11
- package/lib/hooks/usePropWarning/usePropWarning.js +0 -8
- package/lib/hooks/usePropWarning/usePropWarning.test.js +13 -9
- package/package.json +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useNavBarPress';
|
@@ -0,0 +1,20 @@
|
|
1
|
+
interface UseNavBarPress {
|
2
|
+
/**
|
3
|
+
* A custom hook that will call an onPressCallback function, if the function is provided.
|
4
|
+
* @param {Object} params The accepted parameters object
|
5
|
+
* @param {string} props.key The unique identifier that is assigned to the element being pressed
|
6
|
+
* @param {Object} state The state object tracking selected keys
|
7
|
+
* @param {function} state.setSelectedKey The function that sets the selected keys
|
8
|
+
* @callback props.onPressCallback The callback that will be called only if provided
|
9
|
+
*/
|
10
|
+
(params: {
|
11
|
+
key: string;
|
12
|
+
onPressCallback?: () => void;
|
13
|
+
}, state: {
|
14
|
+
setSelectedKey: (key: string) => void;
|
15
|
+
}): {
|
16
|
+
onNavPress: () => void;
|
17
|
+
};
|
18
|
+
}
|
19
|
+
declare const useNavBarPress: UseNavBarPress;
|
20
|
+
export default useNavBarPress;
|
@@ -5,14 +5,6 @@ _Object$defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports["default"] = void 0;
|
8
|
-
/**
|
9
|
-
* A custom hook that will call an onPressCallback function, if the function is provided.
|
10
|
-
* @param {Object} params The accepted parameters object
|
11
|
-
* @param {string} props.key The unique identifier that is assigned to the element being pressed
|
12
|
-
* @param {Object} state The state object tracking selected keys
|
13
|
-
* @param {function} state.setSelectedKey The function that sets the selected keys
|
14
|
-
* @callback props.onPressCallback The callback that will be called only if provided
|
15
|
-
*/
|
16
8
|
var useNavBarPress = function useNavBarPress(_ref, state) {
|
17
9
|
var key = _ref.key,
|
18
10
|
onPressCallback = _ref.onPressCallback;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useOverlayPanelState';
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { OverlayTriggerState } from 'react-stately';
|
3
|
+
interface UseOverlayPanelStateProps {
|
4
|
+
isDefaultOpen?: boolean;
|
5
|
+
isOpen?: boolean;
|
6
|
+
onOpenChange?: (isOpen: boolean) => void;
|
7
|
+
transitionDuration?: number;
|
8
|
+
}
|
9
|
+
export interface UseOverlayPanelReturnState extends OverlayTriggerState {
|
10
|
+
isTransitioning?: boolean;
|
11
|
+
}
|
12
|
+
interface UseOverlayPanelStateReturnValues {
|
13
|
+
state: UseOverlayPanelReturnState;
|
14
|
+
onClose: (stateProp?: OverlayTriggerState, triggerRef?: React.RefObject<HTMLButtonElement>, onCloseProp?: VoidFunction) => void;
|
15
|
+
isTransitioning: boolean;
|
16
|
+
}
|
17
|
+
interface UseOverlayPanelState {
|
18
|
+
/**
|
19
|
+
* Returns state-related data and functions for use with a Modal component.
|
20
|
+
* @param {Object} [props] Properties provided to the state
|
21
|
+
*
|
22
|
+
* @param {boolean} [prop.isDefaultOpen] Whether the modal is open by default (uncontrolled).
|
23
|
+
* @param {boolean} [prop.isOpen] Whether the modal is currently open (controlled).
|
24
|
+
* @param {function} [prop.onOpenChange] Handler that is called when the open state changes.
|
25
|
+
* @param {number} [prop.transitionDuration] Number value of the length of the transition in ms.
|
26
|
+
*
|
27
|
+
* @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
|
28
|
+
*/
|
29
|
+
(props?: UseOverlayPanelStateProps): UseOverlayPanelStateReturnValues;
|
30
|
+
}
|
31
|
+
declare const useOverlayPanelState: UseOverlayPanelState;
|
32
|
+
export default useOverlayPanelState;
|
@@ -18,16 +18,6 @@ var _reactStately = require("react-stately");
|
|
18
18
|
var _useMountTransition = _interopRequireDefault(require("../useMountTransition"));
|
19
19
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
21
|
-
/**
|
22
|
-
* Returns state-related data and functions for use with a Modal component.
|
23
|
-
* @param {Object} [props] Properties provided to the state
|
24
|
-
* @param {Boolean} [props.isDefaultOpen] Whether the modal is open by default (uncontrolled).
|
25
|
-
* @param {Boolean} [props.isOpen] Whether the modal is currently open (controlled).
|
26
|
-
* @param {Function} [props.onOpenChange] Handler that is called when the open state changes.
|
27
|
-
* @param {Number} [props.transitionDuration] Number value of the length of the transition in ms.
|
28
|
-
* `(isOpen: boolean) => void`
|
29
|
-
* @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
|
30
|
-
*/
|
31
21
|
var useOverlayPanelState = function useOverlayPanelState() {
|
32
22
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
33
23
|
var isDefaultOpen = props.isDefaultOpen,
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './usePropWarning';
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
interface UsePropWarning {
|
3
|
+
/**
|
4
|
+
* Provides a development-only console warning for props that we don't want consumers to use
|
5
|
+
* @param {Object} props - The whole props object
|
6
|
+
* @param {String} propToWarn - Specify prop to warn not to use
|
7
|
+
* @param {String} propToUse - Specify prop that should be used instead
|
8
|
+
* @param {Boolean} [allowDuplicates] - If allow duplicate warning messages
|
9
|
+
*/
|
10
|
+
(props: React.ComponentProps<React.ComponentType>, propToWarn: string, propToUse: string, allowDuplicates?: boolean): void;
|
11
|
+
}
|
12
|
+
declare const usePropWarning: UsePropWarning;
|
13
|
+
export default usePropWarning;
|
@@ -10,14 +10,6 @@ var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable
|
|
10
10
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
11
11
|
var _react = require("react");
|
12
12
|
var alreadyShown = new _set["default"]();
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Provides a development-only console warning for props that we don't want consumers to use
|
16
|
-
* @param {Object} props - The whole props object
|
17
|
-
* @param {String} propToWarn - Specify prop to warn not to use
|
18
|
-
* @param {String} propToUse - Specify prop that should be used instead
|
19
|
-
* @param {Boolean} [allowDuplicates] - If allow duplicate warning messages
|
20
|
-
*/
|
21
13
|
var usePropWarning = function usePropWarning(props, propToWarn, propToUse, allowDuplicates) {
|
22
14
|
(0, _react.useEffect)(function () {
|
23
15
|
if (!allowDuplicates && alreadyShown.has(propToWarn)) {
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -7,7 +7,7 @@ describe('usePropWarning', function () {
|
|
7
7
|
beforeEach(function () {
|
8
8
|
process.env.NODE_ENV = 'development';
|
9
9
|
global.console.warn = function () {
|
10
|
-
return jest.
|
10
|
+
return jest.fn();
|
11
11
|
}; // eslint-disable-line no-console
|
12
12
|
});
|
13
13
|
|
@@ -16,8 +16,9 @@ describe('usePropWarning', function () {
|
|
16
16
|
jest.clearAllMocks();
|
17
17
|
});
|
18
18
|
test('default', function () {
|
19
|
-
var props = {
|
20
|
-
|
19
|
+
var props = {
|
20
|
+
disabled: true
|
21
|
+
};
|
21
22
|
var spy = jest.spyOn(console, 'warn');
|
22
23
|
expect(spy).not.toHaveBeenCalled();
|
23
24
|
(0, _reactHooks.renderHook)(function () {
|
@@ -26,8 +27,9 @@ describe('usePropWarning', function () {
|
|
26
27
|
expect(spy).toHaveBeenCalledTimes(1);
|
27
28
|
});
|
28
29
|
test('does not warn if prop does not exist', function () {
|
29
|
-
var props = {
|
30
|
-
|
30
|
+
var props = {
|
31
|
+
isDisabled: true
|
32
|
+
};
|
31
33
|
var spy = jest.spyOn(console, 'warn');
|
32
34
|
expect(spy).not.toHaveBeenCalled();
|
33
35
|
(0, _reactHooks.renderHook)(function () {
|
@@ -36,8 +38,9 @@ describe('usePropWarning', function () {
|
|
36
38
|
expect(spy).not.toHaveBeenCalled();
|
37
39
|
});
|
38
40
|
test('showns duplicated messages if explicitly allowed', function () {
|
39
|
-
var props = {
|
40
|
-
|
41
|
+
var props = {
|
42
|
+
disabled: true
|
43
|
+
};
|
41
44
|
var spy = jest.spyOn(console, 'warn');
|
42
45
|
(0, _reactHooks.renderHook)(function () {
|
43
46
|
return (0, _usePropWarning["default"])(props, 'disabled', 'isDisabled', true);
|
@@ -49,8 +52,9 @@ describe('usePropWarning', function () {
|
|
49
52
|
});
|
50
53
|
test('does not warn if it is in production environment', function () {
|
51
54
|
process.env.NODE_ENV = 'production';
|
52
|
-
var props = {
|
53
|
-
|
55
|
+
var props = {
|
56
|
+
disabled: true
|
57
|
+
};
|
54
58
|
var spy = jest.spyOn(console, 'warn');
|
55
59
|
expect(spy).not.toHaveBeenCalled();
|
56
60
|
(0, _reactHooks.renderHook)(function () {
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useRockerButton';
|
@@ -0,0 +1,241 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { MultipleSelectionManager } from 'react-stately';
|
3
|
+
import { FocusableElement } from '../../types';
|
4
|
+
interface RockerButtonProps {
|
5
|
+
item: {
|
6
|
+
key: string;
|
7
|
+
};
|
8
|
+
isDisabled: boolean;
|
9
|
+
isSelected: boolean;
|
10
|
+
}
|
11
|
+
declare const useRockerButton: (props: RockerButtonProps, state: {
|
12
|
+
selectionManager: MultipleSelectionManager;
|
13
|
+
}, ref: React.RefObject<FocusableElement>) => {
|
14
|
+
rockerButtonProps: {
|
15
|
+
id: string;
|
16
|
+
'aria-pressed': boolean;
|
17
|
+
'aria-disabled': true | undefined;
|
18
|
+
role?: React.AriaRole | undefined;
|
19
|
+
tabIndex?: number | undefined;
|
20
|
+
style?: React.CSSProperties | undefined;
|
21
|
+
className?: string | undefined;
|
22
|
+
'aria-activedescendant'?: string | undefined;
|
23
|
+
'aria-atomic'?: (boolean | "false" | "true") | undefined;
|
24
|
+
'aria-autocomplete'?: "list" | "none" | "both" | "inline" | undefined;
|
25
|
+
'aria-braillelabel'?: string | undefined;
|
26
|
+
'aria-brailleroledescription'?: string | undefined;
|
27
|
+
'aria-busy'?: (boolean | "false" | "true") | undefined;
|
28
|
+
'aria-checked'?: boolean | "mixed" | "false" | "true" | undefined;
|
29
|
+
'aria-colcount'?: number | undefined;
|
30
|
+
'aria-colindex'?: number | undefined;
|
31
|
+
'aria-colindextext'?: string | undefined;
|
32
|
+
'aria-colspan'?: number | undefined;
|
33
|
+
'aria-controls'?: string | undefined;
|
34
|
+
'aria-current'?: boolean | "time" | "page" | "false" | "true" | "step" | "location" | "date" | undefined;
|
35
|
+
'aria-describedby'?: string | undefined;
|
36
|
+
'aria-description'?: string | undefined;
|
37
|
+
'aria-details'?: string | undefined;
|
38
|
+
'aria-dropeffect'?: "link" | "copy" | "none" | "move" | "execute" | "popup" | undefined;
|
39
|
+
'aria-errormessage'?: string | undefined;
|
40
|
+
'aria-expanded'?: (boolean | "false" | "true") | undefined;
|
41
|
+
'aria-flowto'?: string | undefined;
|
42
|
+
'aria-grabbed'?: (boolean | "false" | "true") | undefined;
|
43
|
+
'aria-haspopup'?: boolean | "dialog" | "menu" | "grid" | "listbox" | "tree" | "false" | "true" | undefined;
|
44
|
+
'aria-hidden'?: (boolean | "false" | "true") | undefined;
|
45
|
+
'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
46
|
+
'aria-keyshortcuts'?: string | undefined;
|
47
|
+
'aria-label'?: string | undefined;
|
48
|
+
'aria-labelledby'?: string | undefined;
|
49
|
+
'aria-level'?: number | undefined;
|
50
|
+
'aria-live'?: "off" | "assertive" | "polite" | undefined;
|
51
|
+
'aria-modal'?: (boolean | "false" | "true") | undefined;
|
52
|
+
'aria-multiline'?: (boolean | "false" | "true") | undefined;
|
53
|
+
'aria-multiselectable'?: (boolean | "false" | "true") | undefined;
|
54
|
+
'aria-orientation'?: "horizontal" | "vertical" | undefined;
|
55
|
+
'aria-owns'?: string | undefined;
|
56
|
+
'aria-placeholder'?: string | undefined;
|
57
|
+
'aria-posinset'?: number | undefined;
|
58
|
+
'aria-readonly'?: (boolean | "false" | "true") | undefined;
|
59
|
+
'aria-relevant'?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
60
|
+
'aria-required'?: (boolean | "false" | "true") | undefined;
|
61
|
+
'aria-roledescription'?: string | undefined;
|
62
|
+
'aria-rowcount'?: number | undefined;
|
63
|
+
'aria-rowindex'?: number | undefined;
|
64
|
+
'aria-rowindextext'?: string | undefined;
|
65
|
+
'aria-rowspan'?: number | undefined;
|
66
|
+
'aria-selected'?: (boolean | "false" | "true") | undefined;
|
67
|
+
'aria-setsize'?: number | undefined;
|
68
|
+
'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
|
69
|
+
'aria-valuemax'?: number | undefined;
|
70
|
+
'aria-valuemin'?: number | undefined;
|
71
|
+
'aria-valuenow'?: number | undefined;
|
72
|
+
'aria-valuetext'?: string | undefined;
|
73
|
+
children?: React.ReactNode;
|
74
|
+
dangerouslySetInnerHTML?: {
|
75
|
+
__html: string | TrustedHTML;
|
76
|
+
} | undefined;
|
77
|
+
onCopy?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
78
|
+
onCopyCapture?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
79
|
+
onCut?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
80
|
+
onCutCapture?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
81
|
+
onPaste?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
82
|
+
onPasteCapture?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
83
|
+
onCompositionEnd?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
84
|
+
onCompositionEndCapture?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
85
|
+
onCompositionStart?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
86
|
+
onCompositionStartCapture?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
87
|
+
onCompositionUpdate?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
88
|
+
onCompositionUpdateCapture?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
89
|
+
onFocus?: React.FocusEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
90
|
+
onFocusCapture?: React.FocusEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
91
|
+
onBlur?: React.FocusEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
92
|
+
onBlurCapture?: React.FocusEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
93
|
+
onChange?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
94
|
+
onChangeCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
95
|
+
onBeforeInput?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
96
|
+
onBeforeInputCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
97
|
+
onInput?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
98
|
+
onInputCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
99
|
+
onReset?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
100
|
+
onResetCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
101
|
+
onSubmit?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
102
|
+
onSubmitCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
103
|
+
onInvalid?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
104
|
+
onInvalidCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
105
|
+
onLoad?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
106
|
+
onLoadCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
107
|
+
onError?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
108
|
+
onErrorCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
109
|
+
onKeyDown?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
110
|
+
onKeyDownCapture?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
111
|
+
onKeyPress?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
112
|
+
onKeyPressCapture?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
113
|
+
onKeyUp?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
114
|
+
onKeyUpCapture?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
115
|
+
onAbort?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
116
|
+
onAbortCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
117
|
+
onCanPlay?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
118
|
+
onCanPlayCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
119
|
+
onCanPlayThrough?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
120
|
+
onCanPlayThroughCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
121
|
+
onDurationChange?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
122
|
+
onDurationChangeCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
123
|
+
onEmptied?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
124
|
+
onEmptiedCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
125
|
+
onEncrypted?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
126
|
+
onEncryptedCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
127
|
+
onEnded?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
128
|
+
onEndedCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
129
|
+
onLoadedData?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
130
|
+
onLoadedDataCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
131
|
+
onLoadedMetadata?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
132
|
+
onLoadedMetadataCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
133
|
+
onLoadStart?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
134
|
+
onLoadStartCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
135
|
+
onPause?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
136
|
+
onPauseCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
137
|
+
onPlay?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
138
|
+
onPlayCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
139
|
+
onPlaying?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
140
|
+
onPlayingCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
141
|
+
onProgress?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
142
|
+
onProgressCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
143
|
+
onRateChange?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
144
|
+
onRateChangeCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
145
|
+
onResize?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
146
|
+
onResizeCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
147
|
+
onSeeked?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
148
|
+
onSeekedCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
149
|
+
onSeeking?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
150
|
+
onSeekingCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
151
|
+
onStalled?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
152
|
+
onStalledCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
153
|
+
onSuspend?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
154
|
+
onSuspendCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
155
|
+
onTimeUpdate?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
156
|
+
onTimeUpdateCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
157
|
+
onVolumeChange?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
158
|
+
onVolumeChangeCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
159
|
+
onWaiting?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
160
|
+
onWaitingCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
161
|
+
onAuxClick?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
162
|
+
onAuxClickCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
163
|
+
onClick?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
164
|
+
onClickCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
165
|
+
onContextMenu?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
166
|
+
onContextMenuCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
167
|
+
onDoubleClick?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
168
|
+
onDoubleClickCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
169
|
+
onDrag?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
170
|
+
onDragCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
171
|
+
onDragEnd?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
172
|
+
onDragEndCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
173
|
+
onDragEnter?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
174
|
+
onDragEnterCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
175
|
+
onDragExit?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
176
|
+
onDragExitCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
177
|
+
onDragLeave?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
178
|
+
onDragLeaveCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
179
|
+
onDragOver?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
180
|
+
onDragOverCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
181
|
+
onDragStart?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
182
|
+
onDragStartCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
183
|
+
onDrop?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
184
|
+
onDropCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
185
|
+
onMouseDown?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
186
|
+
onMouseDownCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
187
|
+
onMouseEnter?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
188
|
+
onMouseLeave?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
189
|
+
onMouseMove?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
190
|
+
onMouseMoveCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
191
|
+
onMouseOut?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
192
|
+
onMouseOutCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
193
|
+
onMouseOver?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
194
|
+
onMouseOverCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
195
|
+
onMouseUp?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
196
|
+
onMouseUpCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
197
|
+
onSelect?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
198
|
+
onSelectCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
199
|
+
onTouchCancel?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
200
|
+
onTouchCancelCapture?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
201
|
+
onTouchEnd?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
202
|
+
onTouchEndCapture?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
203
|
+
onTouchMove?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
204
|
+
onTouchMoveCapture?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
205
|
+
onTouchStart?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
206
|
+
onTouchStartCapture?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
207
|
+
onPointerDown?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
208
|
+
onPointerDownCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
209
|
+
onPointerMove?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
210
|
+
onPointerMoveCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
211
|
+
onPointerUp?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
212
|
+
onPointerUpCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
213
|
+
onPointerCancel?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
214
|
+
onPointerCancelCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
215
|
+
onPointerEnter?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
216
|
+
onPointerEnterCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
217
|
+
onPointerLeave?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
218
|
+
onPointerLeaveCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
219
|
+
onPointerOver?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
220
|
+
onPointerOverCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
221
|
+
onPointerOut?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
222
|
+
onPointerOutCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
223
|
+
onGotPointerCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
224
|
+
onGotPointerCaptureCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
225
|
+
onLostPointerCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
226
|
+
onLostPointerCaptureCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
227
|
+
onScroll?: React.UIEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
228
|
+
onScrollCapture?: React.UIEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
229
|
+
onWheel?: React.WheelEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
230
|
+
onWheelCapture?: React.WheelEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
231
|
+
onAnimationStart?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
232
|
+
onAnimationStartCapture?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
233
|
+
onAnimationEnd?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
234
|
+
onAnimationEndCapture?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
235
|
+
onAnimationIteration?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
236
|
+
onAnimationIterationCapture?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
237
|
+
onTransitionEnd?: React.TransitionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
238
|
+
onTransitionEndCapture?: React.TransitionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
239
|
+
};
|
240
|
+
};
|
241
|
+
export default useRockerButton;
|
@@ -1,11 +1,3 @@
|
|
1
|
-
/**
|
2
|
-
* A custom hook that will call an onPressCallback function, if the function is provided.
|
3
|
-
* @param {Object} params The accepted parameters object
|
4
|
-
* @param {string} props.key The unique identifier that is assigned to the element being pressed
|
5
|
-
* @param {Object} state The state object tracking selected keys
|
6
|
-
* @param {function} state.setSelectedKey The function that sets the selected keys
|
7
|
-
* @callback props.onPressCallback The callback that will be called only if provided
|
8
|
-
*/
|
9
1
|
var useNavBarPress = function useNavBarPress(_ref, state) {
|
10
2
|
var key = _ref.key,
|
11
3
|
onPressCallback = _ref.onPressCallback;
|
@@ -11,17 +11,6 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
11
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
12
12
|
import { useOverlayTriggerState } from 'react-stately';
|
13
13
|
import useMountTransition from '../useMountTransition';
|
14
|
-
|
15
|
-
/**
|
16
|
-
* Returns state-related data and functions for use with a Modal component.
|
17
|
-
* @param {Object} [props] Properties provided to the state
|
18
|
-
* @param {Boolean} [props.isDefaultOpen] Whether the modal is open by default (uncontrolled).
|
19
|
-
* @param {Boolean} [props.isOpen] Whether the modal is currently open (controlled).
|
20
|
-
* @param {Function} [props.onOpenChange] Handler that is called when the open state changes.
|
21
|
-
* @param {Number} [props.transitionDuration] Number value of the length of the transition in ms.
|
22
|
-
* `(isOpen: boolean) => void`
|
23
|
-
* @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
|
24
|
-
*/
|
25
14
|
var useOverlayPanelState = function useOverlayPanelState() {
|
26
15
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
27
16
|
var isDefaultOpen = props.isDefaultOpen,
|
@@ -2,14 +2,6 @@ import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
3
3
|
import { useEffect } from 'react';
|
4
4
|
var alreadyShown = new _Set();
|
5
|
-
|
6
|
-
/**
|
7
|
-
* Provides a development-only console warning for props that we don't want consumers to use
|
8
|
-
* @param {Object} props - The whole props object
|
9
|
-
* @param {String} propToWarn - Specify prop to warn not to use
|
10
|
-
* @param {String} propToUse - Specify prop that should be used instead
|
11
|
-
* @param {Boolean} [allowDuplicates] - If allow duplicate warning messages
|
12
|
-
*/
|
13
5
|
var usePropWarning = function usePropWarning(props, propToWarn, propToUse, allowDuplicates) {
|
14
6
|
useEffect(function () {
|
15
7
|
if (!allowDuplicates && alreadyShown.has(propToWarn)) {
|
@@ -4,7 +4,7 @@ describe('usePropWarning', function () {
|
|
4
4
|
beforeEach(function () {
|
5
5
|
process.env.NODE_ENV = 'development';
|
6
6
|
global.console.warn = function () {
|
7
|
-
return jest.
|
7
|
+
return jest.fn();
|
8
8
|
}; // eslint-disable-line no-console
|
9
9
|
});
|
10
10
|
|
@@ -13,8 +13,9 @@ describe('usePropWarning', function () {
|
|
13
13
|
jest.clearAllMocks();
|
14
14
|
});
|
15
15
|
test('default', function () {
|
16
|
-
var props = {
|
17
|
-
|
16
|
+
var props = {
|
17
|
+
disabled: true
|
18
|
+
};
|
18
19
|
var spy = jest.spyOn(console, 'warn');
|
19
20
|
expect(spy).not.toHaveBeenCalled();
|
20
21
|
renderHook(function () {
|
@@ -23,8 +24,9 @@ describe('usePropWarning', function () {
|
|
23
24
|
expect(spy).toHaveBeenCalledTimes(1);
|
24
25
|
});
|
25
26
|
test('does not warn if prop does not exist', function () {
|
26
|
-
var props = {
|
27
|
-
|
27
|
+
var props = {
|
28
|
+
isDisabled: true
|
29
|
+
};
|
28
30
|
var spy = jest.spyOn(console, 'warn');
|
29
31
|
expect(spy).not.toHaveBeenCalled();
|
30
32
|
renderHook(function () {
|
@@ -33,8 +35,9 @@ describe('usePropWarning', function () {
|
|
33
35
|
expect(spy).not.toHaveBeenCalled();
|
34
36
|
});
|
35
37
|
test('showns duplicated messages if explicitly allowed', function () {
|
36
|
-
var props = {
|
37
|
-
|
38
|
+
var props = {
|
39
|
+
disabled: true
|
40
|
+
};
|
38
41
|
var spy = jest.spyOn(console, 'warn');
|
39
42
|
renderHook(function () {
|
40
43
|
return usePropWarning(props, 'disabled', 'isDisabled', true);
|
@@ -46,8 +49,9 @@ describe('usePropWarning', function () {
|
|
46
49
|
});
|
47
50
|
test('does not warn if it is in production environment', function () {
|
48
51
|
process.env.NODE_ENV = 'production';
|
49
|
-
var props = {
|
50
|
-
|
52
|
+
var props = {
|
53
|
+
disabled: true
|
54
|
+
};
|
51
55
|
var spy = jest.spyOn(console, 'warn');
|
52
56
|
expect(spy).not.toHaveBeenCalled();
|
53
57
|
renderHook(function () {
|