rsuite 5.6.6 → 5.8.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/CHANGELOG.md +31 -0
- package/cjs/Cascader/Cascader.d.ts +2 -0
- package/cjs/Cascader/Cascader.js +10 -7
- package/cjs/Checkbox/Checkbox.js +36 -25
- package/cjs/CheckboxGroup/CheckboxGroupContext.d.ts +1 -1
- package/cjs/CheckboxGroup/CheckboxGroupContext.js +1 -1
- package/cjs/DateRangePicker/index.d.ts +1 -0
- package/cjs/Dropdown/DropdownMenu.js +1 -9
- package/cjs/Form/Form.js +11 -12
- package/cjs/Form/index.d.ts +1 -0
- package/cjs/Form/index.js +9 -0
- package/cjs/Form/useFormClassNames.d.ts +5 -0
- package/cjs/Form/useFormClassNames.js +31 -0
- package/cjs/Menu/MenuItem.js +1 -0
- package/cjs/Picker/DropdownMenuCheckItem.js +2 -1
- package/cjs/RangeSlider/RangeSlider.js +3 -1
- package/cjs/SelectPicker/SelectPicker.d.ts +1 -1
- package/cjs/SelectPicker/SelectPicker.js +2 -1
- package/cjs/Toggle/Toggle.js +7 -2
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +5 -2
- package/dist/rsuite.js +23 -12
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Cascader/Cascader.d.ts +2 -0
- package/esm/Cascader/Cascader.js +10 -7
- package/esm/Checkbox/Checkbox.js +36 -26
- package/esm/CheckboxGroup/CheckboxGroupContext.d.ts +1 -1
- package/esm/CheckboxGroup/CheckboxGroupContext.js +1 -1
- package/esm/DateRangePicker/index.d.ts +1 -0
- package/esm/Dropdown/DropdownMenu.js +1 -9
- package/esm/Form/Form.js +10 -10
- package/esm/Form/index.d.ts +1 -0
- package/esm/Form/index.js +1 -0
- package/esm/Form/useFormClassNames.d.ts +5 -0
- package/esm/Form/useFormClassNames.js +26 -0
- package/esm/Menu/MenuItem.js +1 -0
- package/esm/Picker/DropdownMenuCheckItem.js +2 -1
- package/esm/RangeSlider/RangeSlider.js +3 -1
- package/esm/SelectPicker/SelectPicker.d.ts +1 -1
- package/esm/SelectPicker/SelectPicker.js +2 -1
- package/esm/Toggle/Toggle.js +8 -3
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/package.json +1 -1
|
@@ -18,6 +18,8 @@ export interface CascaderProps<T = ValueType> extends FormControlPickerProps<T |
|
|
|
18
18
|
renderMenu?: (items: ItemDataType[], menu: React.ReactNode, parentNode?: any, layer?: number) => React.ReactNode;
|
|
19
19
|
/** Custom render menu items */
|
|
20
20
|
renderMenuItem?: (itemLabel: React.ReactNode, item: ItemDataType) => React.ReactNode;
|
|
21
|
+
/** Custom render search items */
|
|
22
|
+
renderSearchItem?: (itemLabel: React.ReactNode, items: ItemDataType[]) => React.ReactNode;
|
|
21
23
|
/** Custom render selected items */
|
|
22
24
|
renderValue?: (value: T, selectedPaths: ItemDataType[], selectedElement: React.ReactNode) => React.ReactNode;
|
|
23
25
|
/** Called when the option is selected */
|
package/esm/Cascader/Cascader.js
CHANGED
|
@@ -51,6 +51,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
51
51
|
placement = _props$placement === void 0 ? 'bottomStart' : _props$placement,
|
|
52
52
|
id = props.id,
|
|
53
53
|
renderMenuItem = props.renderMenuItem,
|
|
54
|
+
renderSearchItem = props.renderSearchItem,
|
|
54
55
|
renderValue = props.renderValue,
|
|
55
56
|
renderMenu = props.renderMenu,
|
|
56
57
|
renderExtraFooter = props.renderExtraFooter,
|
|
@@ -63,7 +64,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
63
64
|
onClose = props.onClose,
|
|
64
65
|
onOpen = props.onOpen,
|
|
65
66
|
getChildren = props.getChildren,
|
|
66
|
-
rest = _objectWithoutPropertiesLoose(props, ["as", "data", "classPrefix", "childrenKey", "valueKey", "labelKey", "defaultValue", "placeholder", "disabled", "disabledItemValues", "appearance", "cleanable", "locale", "toggleAs", "style", "value", "inline", "menuClassName", "menuStyle", "menuWidth", "menuHeight", "searchable", "parentSelectable", "placement", "id", "renderMenuItem", "renderValue", "renderMenu", "renderExtraFooter", "onEnter", "onExited", "onClean", "onChange", "onSelect", "onSearch", "onClose", "onOpen", "getChildren"]); // Use component active state to support keyboard events.
|
|
67
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "data", "classPrefix", "childrenKey", "valueKey", "labelKey", "defaultValue", "placeholder", "disabled", "disabledItemValues", "appearance", "cleanable", "locale", "toggleAs", "style", "value", "inline", "menuClassName", "menuStyle", "menuWidth", "menuHeight", "searchable", "parentSelectable", "placement", "id", "renderMenuItem", "renderSearchItem", "renderValue", "renderMenu", "renderExtraFooter", "onEnter", "onExited", "onClean", "onChange", "onSelect", "onSearch", "onClose", "onOpen", "getChildren"]); // Use component active state to support keyboard events.
|
|
67
68
|
|
|
68
69
|
|
|
69
70
|
var _useState = useState(false),
|
|
@@ -357,6 +358,12 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
357
358
|
'cascader-row-disabled': disabled,
|
|
358
359
|
'cascader-row-focus': item[valueKey] === focusItemValue
|
|
359
360
|
});
|
|
361
|
+
var label = formattedNodes.map(function (node, index) {
|
|
362
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
363
|
+
key: "col-" + index,
|
|
364
|
+
className: prefix('cascader-col')
|
|
365
|
+
}, node[labelKey]);
|
|
366
|
+
});
|
|
360
367
|
return /*#__PURE__*/React.createElement("div", {
|
|
361
368
|
key: key,
|
|
362
369
|
"aria-disabled": disabled,
|
|
@@ -367,12 +374,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
367
374
|
handleSearchRowSelect(item, nodes, event);
|
|
368
375
|
}
|
|
369
376
|
}
|
|
370
|
-
},
|
|
371
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
372
|
-
key: "col-" + index,
|
|
373
|
-
className: prefix('cascader-col')
|
|
374
|
-
}, node[labelKey]);
|
|
375
|
-
}));
|
|
377
|
+
}, renderSearchItem ? renderSearchItem(label, nodes) : label);
|
|
376
378
|
};
|
|
377
379
|
|
|
378
380
|
var renderSearchResultPanel = function renderSearchResultPanel() {
|
|
@@ -510,6 +512,7 @@ Cascader.propTypes = _extends({}, listPickerPropTypes, {
|
|
|
510
512
|
onSearch: PropTypes.func,
|
|
511
513
|
cleanable: PropTypes.bool,
|
|
512
514
|
renderMenuItem: PropTypes.func,
|
|
515
|
+
renderSearchItem: PropTypes.func,
|
|
513
516
|
menuWidth: PropTypes.number,
|
|
514
517
|
menuHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
515
518
|
searchable: PropTypes.bool,
|
package/esm/Checkbox/Checkbox.js
CHANGED
|
@@ -4,20 +4,20 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
4
4
|
|
|
5
5
|
var _templateObject, _templateObject2, _templateObject3;
|
|
6
6
|
|
|
7
|
-
import React, { useContext, useCallback } from 'react';
|
|
7
|
+
import React, { useContext, useCallback, useMemo } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { useControlled, partitionHTMLProps, useClassNames, TypeChecker } from '../utils';
|
|
10
10
|
import { CheckboxGroupContext } from '../CheckboxGroup';
|
|
11
11
|
var Checkbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
onGroupChange =
|
|
12
|
+
var checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
13
|
+
|
|
14
|
+
var _ref = checkboxGroupContext !== null && checkboxGroupContext !== void 0 ? checkboxGroupContext : {},
|
|
15
|
+
inlineContext = _ref.inline,
|
|
16
|
+
nameContext = _ref.name,
|
|
17
|
+
disabledContext = _ref.disabled,
|
|
18
|
+
readOnlyContext = _ref.readOnly,
|
|
19
|
+
plaintextContext = _ref.plaintext,
|
|
20
|
+
onGroupChange = _ref.onChange;
|
|
21
21
|
|
|
22
22
|
var _props$as = props.as,
|
|
23
23
|
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
@@ -28,7 +28,8 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
28
28
|
classPrefix = _props$classPrefix === void 0 ? 'checkbox' : _props$classPrefix,
|
|
29
29
|
_props$checkable = props.checkable,
|
|
30
30
|
checkable = _props$checkable === void 0 ? true : _props$checkable,
|
|
31
|
-
defaultChecked = props.defaultChecked,
|
|
31
|
+
_props$defaultChecked = props.defaultChecked,
|
|
32
|
+
defaultChecked = _props$defaultChecked === void 0 ? false : _props$defaultChecked,
|
|
32
33
|
title = props.title,
|
|
33
34
|
inputRef = props.inputRef,
|
|
34
35
|
inputProps = props.inputProps,
|
|
@@ -51,19 +52,24 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
51
52
|
onChange = props.onChange,
|
|
52
53
|
rest = _objectWithoutPropertiesLoose(props, ["as", "checked", "className", "children", "classPrefix", "checkable", "defaultChecked", "title", "inputRef", "inputProps", "indeterminate", "tabIndex", "disabled", "readOnly", "plaintext", "inline", "name", "value", "onClick", "onCheckboxClick", "onChange"]);
|
|
53
54
|
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
var _useControlled = useControlled(controlledChecked, defaultChecked),
|
|
56
|
+
selfChecked = _useControlled[0],
|
|
57
|
+
setSelfChecked = _useControlled[1],
|
|
58
|
+
selfControlled = _useControlled[2]; // Either <Checkbox> is checked itself or by parent <CheckboxGroup>
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
var checked = useMemo(function () {
|
|
62
|
+
var _checkboxGroupContext, _checkboxGroupContext2;
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
if (!checkboxGroupContext) {
|
|
65
|
+
return selfChecked;
|
|
66
|
+
} // fixme value from group should not be nullable
|
|
63
67
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
|
|
69
|
+
return (_checkboxGroupContext = (_checkboxGroupContext2 = checkboxGroupContext.value) === null || _checkboxGroupContext2 === void 0 ? void 0 : _checkboxGroupContext2.some(function (checkedValue) {
|
|
70
|
+
return checkedValue === value;
|
|
71
|
+
})) !== null && _checkboxGroupContext !== void 0 ? _checkboxGroupContext : false;
|
|
72
|
+
}, [checkboxGroupContext, selfChecked, value]);
|
|
67
73
|
|
|
68
74
|
var _useClassNames = useClassNames(classPrefix),
|
|
69
75
|
merge = _useClassNames.merge,
|
|
@@ -79,7 +85,11 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
79
85
|
|
|
80
86
|
var _partitionHTMLProps = partitionHTMLProps(rest),
|
|
81
87
|
htmlInputProps = _partitionHTMLProps[0],
|
|
82
|
-
restProps = _partitionHTMLProps[1];
|
|
88
|
+
restProps = _partitionHTMLProps[1]; // If <Checkbox> is within a <CheckboxGroup>, it's bound to be controlled
|
|
89
|
+
// because its checked state is inferred from group's value, not retrieved from the DOM
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
var controlled = checkboxGroupContext ? true : selfControlled;
|
|
83
93
|
|
|
84
94
|
if (typeof controlled !== 'undefined') {
|
|
85
95
|
// In uncontrolled situations, use defaultChecked instead of checked
|
|
@@ -87,16 +97,16 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
87
97
|
}
|
|
88
98
|
|
|
89
99
|
var handleChange = useCallback(function (event) {
|
|
90
|
-
var nextChecked =
|
|
100
|
+
var nextChecked = event.target.checked;
|
|
91
101
|
|
|
92
102
|
if (disabled || readOnly) {
|
|
93
103
|
return;
|
|
94
104
|
}
|
|
95
105
|
|
|
96
|
-
|
|
106
|
+
setSelfChecked(nextChecked);
|
|
97
107
|
onChange === null || onChange === void 0 ? void 0 : onChange(value, nextChecked, event);
|
|
98
108
|
onGroupChange === null || onGroupChange === void 0 ? void 0 : onGroupChange(value, nextChecked, event);
|
|
99
|
-
}, [
|
|
109
|
+
}, [disabled, readOnly, setSelfChecked, onChange, value, onGroupChange]);
|
|
100
110
|
|
|
101
111
|
if (plaintext) {
|
|
102
112
|
return checked ? /*#__PURE__*/React.createElement(Component, _extends({}, restProps, {
|
|
@@ -10,4 +10,4 @@ export interface CheckboxGroupContextValue {
|
|
|
10
10
|
plaintext?: boolean;
|
|
11
11
|
onChange?: (value: any, checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
12
12
|
}
|
|
13
|
-
export declare const CheckboxGroupContext: React.Context<CheckboxGroupContextValue>;
|
|
13
|
+
export declare const CheckboxGroupContext: React.Context<CheckboxGroupContextValue | undefined>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export var CheckboxGroupContext = /*#__PURE__*/React.createContext(
|
|
2
|
+
export var CheckboxGroupContext = /*#__PURE__*/React.createContext(void 0);
|
|
@@ -87,15 +87,7 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
87
87
|
return /*#__PURE__*/React.createElement(DropdownContext.Provider, {
|
|
88
88
|
value: contextValue
|
|
89
89
|
}, /*#__PURE__*/React.createElement(Menubar, {
|
|
90
|
-
vertical: true
|
|
91
|
-
onActivateItem: function onActivateItem(event) {
|
|
92
|
-
var _dataset = event.target.dataset,
|
|
93
|
-
eventKey = _dataset.eventKey,
|
|
94
|
-
eventKeyType = _dataset.eventKeyType; // Only cast number type for now
|
|
95
|
-
|
|
96
|
-
var eventKeyToEmit = eventKeyType === 'number' ? Number(eventKey) : eventKey;
|
|
97
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(eventKeyToEmit, event);
|
|
98
|
-
}
|
|
90
|
+
vertical: true
|
|
99
91
|
}, function (menubar, menubarRef) {
|
|
100
92
|
return /*#__PURE__*/React.createElement("ul", _extends({
|
|
101
93
|
ref: mergeRefs(menubarRef, ref),
|
package/esm/Form/Form.js
CHANGED
|
@@ -5,13 +5,13 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import isUndefined from 'lodash/isUndefined';
|
|
6
6
|
import omit from 'lodash/omit';
|
|
7
7
|
import { SchemaModel } from 'schema-typed';
|
|
8
|
-
import { useClassNames } from '../utils';
|
|
9
8
|
import FormContext, { FormValueContext } from './FormContext';
|
|
10
9
|
import FormControl from '../FormControl';
|
|
11
10
|
import FormControlLabel from '../FormControlLabel';
|
|
12
11
|
import FormErrorMessage from '../FormErrorMessage';
|
|
13
12
|
import FormGroup from '../FormGroup';
|
|
14
13
|
import FormHelpText from '../FormHelpText';
|
|
14
|
+
import { useFormClassNames } from './useFormClassNames';
|
|
15
15
|
var Form = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
16
16
|
var _props$checkTrigger = props.checkTrigger,
|
|
17
17
|
checkTrigger = _props$checkTrigger === void 0 ? 'change' : _props$checkTrigger,
|
|
@@ -39,15 +39,15 @@ var Form = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
39
39
|
onChange = props.onChange,
|
|
40
40
|
rest = _objectWithoutPropertiesLoose(props, ["checkTrigger", "classPrefix", "errorFromContext", "formDefaultValue", "formValue", "formError", "fluid", "layout", "model", "readOnly", "plaintext", "className", "children", "disabled", "onSubmit", "onCheck", "onError", "onChange"]);
|
|
41
41
|
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
})
|
|
42
|
+
var classes = useFormClassNames({
|
|
43
|
+
classPrefix: classPrefix,
|
|
44
|
+
className: className,
|
|
45
|
+
fluid: fluid,
|
|
46
|
+
layout: layout,
|
|
47
|
+
readOnly: readOnly,
|
|
48
|
+
plaintext: plaintext,
|
|
49
|
+
disabled: disabled
|
|
50
|
+
});
|
|
51
51
|
|
|
52
52
|
var _useState = useState(formDefaultValue),
|
|
53
53
|
_formValue = _useState[0],
|
package/esm/Form/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export type { FormErrorMessageProps } from '../FormErrorMessage';
|
|
|
5
5
|
export type { FormControlLabelProps } from '../FormControlLabel';
|
|
6
6
|
export type { FormHelpTextProps } from '../FormHelpText';
|
|
7
7
|
export type { FormControlProps } from '../FormControl';
|
|
8
|
+
export * from './useFormClassNames';
|
|
8
9
|
export default Form;
|
package/esm/Form/index.js
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FormProps } from './Form';
|
|
2
|
+
/**
|
|
3
|
+
* Take <Form> props and return className for <Form> styles
|
|
4
|
+
*/
|
|
5
|
+
export declare function useFormClassNames({ classPrefix, className, fluid, layout, readOnly, plaintext, disabled }: Pick<FormProps, 'classPrefix' | 'className' | 'fluid' | 'layout' | 'readOnly' | 'plaintext' | 'disabled'>): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useClassNames } from '../utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Take <Form> props and return className for <Form> styles
|
|
5
|
+
*/
|
|
6
|
+
export function useFormClassNames(_ref) {
|
|
7
|
+
var _ref$classPrefix = _ref.classPrefix,
|
|
8
|
+
classPrefix = _ref$classPrefix === void 0 ? 'form' : _ref$classPrefix,
|
|
9
|
+
className = _ref.className,
|
|
10
|
+
fluid = _ref.fluid,
|
|
11
|
+
_ref$layout = _ref.layout,
|
|
12
|
+
layout = _ref$layout === void 0 ? 'vertical' : _ref$layout,
|
|
13
|
+
readOnly = _ref.readOnly,
|
|
14
|
+
plaintext = _ref.plaintext,
|
|
15
|
+
disabled = _ref.disabled;
|
|
16
|
+
|
|
17
|
+
var _useClassNames = useClassNames(classPrefix),
|
|
18
|
+
withClassPrefix = _useClassNames.withClassPrefix,
|
|
19
|
+
merge = _useClassNames.merge;
|
|
20
|
+
|
|
21
|
+
return merge(className, withClassPrefix(layout, fluid && layout === 'vertical' ? 'fluid' : 'fixed-width', {
|
|
22
|
+
readonly: readOnly,
|
|
23
|
+
disabled: disabled,
|
|
24
|
+
plaintext: plaintext
|
|
25
|
+
}));
|
|
26
|
+
}
|
package/esm/Menu/MenuItem.js
CHANGED
|
@@ -98,6 +98,7 @@ function MenuItem(props) {
|
|
|
98
98
|
|
|
99
99
|
if ((menuState === null || menuState === void 0 ? void 0 : menuState.role) === 'menubar') {
|
|
100
100
|
menuitemProps.onMouseDown = handleMouseDown;
|
|
101
|
+
menuitemProps.onMouseOver = handleMouseMove;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
return children(menuitemProps, menuitemRef);
|
|
@@ -5,7 +5,8 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import { useClassNames } from '../utils';
|
|
6
6
|
import Checkbox from '../Checkbox';
|
|
7
7
|
var DropdownMenuCheckItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
8
|
-
var active = props.active,
|
|
8
|
+
var _props$active = props.active,
|
|
9
|
+
active = _props$active === void 0 ? false : _props$active,
|
|
9
10
|
_props$as = props.as,
|
|
10
11
|
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
11
12
|
_props$checkboxAs = props.checkboxAs,
|
|
@@ -255,7 +255,9 @@ var RangeSlider = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
255
255
|
end = v;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
var nextValue = getValidValue([start, end].sort()
|
|
258
|
+
var nextValue = getValidValue([start, end].sort(function (a, b) {
|
|
259
|
+
return a - b;
|
|
260
|
+
}));
|
|
259
261
|
|
|
260
262
|
if (isRangeMatchingConstraint(nextValue)) {
|
|
261
263
|
setValue(nextValue);
|
|
@@ -32,7 +32,7 @@ export interface SelectProps<T> {
|
|
|
32
32
|
/** Called after clicking the group title */
|
|
33
33
|
onGroupTitleClick?: (event: React.SyntheticEvent) => void;
|
|
34
34
|
/** Called when searching */
|
|
35
|
-
onSearch?: (searchKeyword: string, event
|
|
35
|
+
onSearch?: (searchKeyword: string, event?: React.SyntheticEvent) => void;
|
|
36
36
|
/** Called when clean */
|
|
37
37
|
onClean?: (event: React.SyntheticEvent) => void;
|
|
38
38
|
}
|
|
@@ -182,8 +182,9 @@ var SelectPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
182
182
|
var handleExited = useCallback(function () {
|
|
183
183
|
setSearchKeyword('');
|
|
184
184
|
setActive(false);
|
|
185
|
+
onSearch === null || onSearch === void 0 ? void 0 : onSearch('');
|
|
185
186
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
186
|
-
}, [onClose, setSearchKeyword]);
|
|
187
|
+
}, [onClose, setSearchKeyword, onSearch]);
|
|
187
188
|
var handleEntered = useCallback(function () {
|
|
188
189
|
setActive(true);
|
|
189
190
|
setFocusItemValue(value);
|
package/esm/Toggle/Toggle.js
CHANGED
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import React, { useCallback, useRef } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { useClassNames, useControlled, useCustom } from '../utils';
|
|
5
|
+
import { partitionHTMLProps, useClassNames, useControlled, useCustom } from '../utils';
|
|
6
6
|
import Plaintext from '../Plaintext';
|
|
7
7
|
import Loader from '../Loader';
|
|
8
8
|
var Toggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -46,6 +46,11 @@ var Toggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
46
46
|
}));
|
|
47
47
|
var inner = checked ? checkedChildren : unCheckedChildren;
|
|
48
48
|
var label = checked ? locale.on : locale.off;
|
|
49
|
+
|
|
50
|
+
var _partitionHTMLProps = partitionHTMLProps(rest),
|
|
51
|
+
htmlInputProps = _partitionHTMLProps[0],
|
|
52
|
+
restProps = _partitionHTMLProps[1];
|
|
53
|
+
|
|
49
54
|
var handleInputChange = useCallback(function (e) {
|
|
50
55
|
if (disabled || readOnly || loading) {
|
|
51
56
|
return;
|
|
@@ -63,7 +68,7 @@ var Toggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
63
68
|
return /*#__PURE__*/React.createElement("label", _extends({
|
|
64
69
|
ref: ref,
|
|
65
70
|
className: classes
|
|
66
|
-
},
|
|
71
|
+
}, restProps), /*#__PURE__*/React.createElement("input", _extends({}, htmlInputProps, {
|
|
67
72
|
ref: inputRef,
|
|
68
73
|
type: "checkbox",
|
|
69
74
|
checked: checkedProp,
|
|
@@ -77,7 +82,7 @@ var Toggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
77
82
|
"aria-disabled": disabled,
|
|
78
83
|
"aria-label": typeof inner === 'string' ? inner : label,
|
|
79
84
|
"aria-busy": loading || undefined
|
|
80
|
-
}), /*#__PURE__*/React.createElement(Component, {
|
|
85
|
+
})), /*#__PURE__*/React.createElement(Component, {
|
|
81
86
|
className: prefix('presentation')
|
|
82
87
|
}, /*#__PURE__*/React.createElement("span", {
|
|
83
88
|
className: prefix('inner')
|
package/esm/index.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export { default as Steps } from './Steps';
|
|
|
50
50
|
export type { StepsProps, StepItemProps } from './Steps';
|
|
51
51
|
export { default as Toggle } from './Toggle';
|
|
52
52
|
export type { ToggleProps } from './Toggle';
|
|
53
|
-
export { default as Form } from './Form';
|
|
53
|
+
export { default as Form, useFormClassNames } from './Form';
|
|
54
54
|
export type { FormProps, FormGroupProps, FormErrorMessageProps, FormControlLabelProps, FormHelpTextProps, FormControlProps } from './Form';
|
|
55
55
|
export { default as Input } from './Input';
|
|
56
56
|
export type { InputProps } from './Input';
|
package/esm/index.js
CHANGED
|
@@ -27,7 +27,7 @@ export { default as Pagination } from './Pagination';
|
|
|
27
27
|
export { default as Steps } from './Steps';
|
|
28
28
|
// Data enter
|
|
29
29
|
export { default as Toggle } from './Toggle';
|
|
30
|
-
export { default as Form } from './Form';
|
|
30
|
+
export { default as Form, useFormClassNames } from './Form';
|
|
31
31
|
export { default as Input } from './Input';
|
|
32
32
|
export { default as MaskedInput } from './MaskedInput';
|
|
33
33
|
export { default as InputNumber } from './InputNumber';
|