@ucloud-fe/react-components 1.3.4 → 1.3.8
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 +29 -0
- package/README.md +4 -2
- package/dist/main.min.js +4 -4
- package/index.d.ts +29 -24
- package/lib/components/ActionList/ActionList.d.ts +9 -4
- package/lib/components/ActionList/index.d.ts +4 -2
- package/lib/components/Badge/Badge.d.ts +1 -1
- package/lib/components/Badge/index.d.ts +7 -2
- package/lib/components/Badge/index.js +6 -2
- package/lib/components/Breadcrumb/Item.d.ts +2 -2
- package/lib/components/Breadcrumb/index.d.ts +1 -1
- package/lib/components/Checkbox/index.d.ts +4 -2
- package/lib/components/Modal/Modal.js +2 -2
- package/lib/components/Modal/method.js +6 -1
- package/lib/components/Notice/Notice.d.ts +16 -33
- package/lib/components/Notice/Notice.js +81 -130
- package/lib/components/Notice/index.d.ts +16 -2
- package/lib/components/Notice/index.js +13 -3
- package/lib/components/Notice/style/index.d.ts +12 -9
- package/lib/components/Notice/style/index.js +53 -112
- package/lib/components/NumberInput/style/index.js +5 -5
- package/lib/components/Switch/Switch.d.ts +1 -1
- package/lib/components/Switch/index.d.ts +2 -1
- package/lib/components/Tabs/Pane.d.ts +3 -2
- package/lib/components/Tabs/index.d.ts +5 -3
- package/lib/hooks/useUncontrolled.js +7 -7
- package/package.json +1 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
export interface
|
|
1
|
+
import React, { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface DefinedTabPaneProps {
|
|
3
3
|
/** @ignore */
|
|
4
4
|
className?: string;
|
|
5
5
|
/**
|
|
@@ -25,5 +25,6 @@ export interface TabPaneProps {
|
|
|
25
25
|
/** tab 的 key,由于 react 会在某些情况下改变传递的 key,顾直接使用 key 是不安全的,如发现 key 被修改,可使用 tabKey 来替换 */
|
|
26
26
|
tabKey?: string;
|
|
27
27
|
}
|
|
28
|
+
export declare type TabPaneProps = DefinedTabPaneProps & Omit<HTMLAttributes<HTMLDivElement>, keyof DefinedTabPaneProps>;
|
|
28
29
|
declare const _default: React.MemoExoticComponent<({ className, active, destroyInactiveTabPane, forceRender, placeholder, children, tabKey, ...rest }: TabPaneProps) => JSX.Element>;
|
|
29
30
|
export default _default;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
2
|
+
import { TabsProps } from './Tabs';
|
|
3
|
+
import Pane, { TabPaneProps } from './Pane';
|
|
3
4
|
import { TabBarPositions, Sizes, StyleTypes } from './shared';
|
|
4
|
-
declare const ExportTabs: import("react").NamedExoticComponent<
|
|
5
|
-
readonly type: ({ activeKey: _activeKey, defaultActiveKey, onChange: _onChange, destroyInactiveTabPane, children, className, tabBarPosition, direction, styleType, size, ...restProps }:
|
|
5
|
+
declare const ExportTabs: import("react").NamedExoticComponent<TabsProps> & {
|
|
6
|
+
readonly type: ({ activeKey: _activeKey, defaultActiveKey, onChange: _onChange, destroyInactiveTabPane, children, className, tabBarPosition, direction, styleType, size, ...restProps }: TabsProps) => JSX.Element;
|
|
6
7
|
} & {
|
|
7
8
|
Pane: typeof Pane;
|
|
8
9
|
/** @private 请勿使用 */
|
|
@@ -19,3 +20,4 @@ declare const ExportTabs: import("react").NamedExoticComponent<import("./Tabs").
|
|
|
19
20
|
Position: typeof TabBarPositions;
|
|
20
21
|
};
|
|
21
22
|
export default ExportTabs;
|
|
23
|
+
export type { TabsProps, TabPaneProps };
|
|
@@ -60,25 +60,25 @@ var useUncontrolled = function useUncontrolled(value, defaultValue, onChange, op
|
|
|
60
60
|
|
|
61
61
|
var cacheVRef = (0, _react.useRef)(v);
|
|
62
62
|
var finalValue = isControlled ? value : cacheVRef.current;
|
|
63
|
-
var
|
|
63
|
+
var updateValueWithoutCallOnChange = (0, _react.useCallback)(function (v) {
|
|
64
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
64
65
|
var r = options !== null && options !== void 0 && options.setter ? options === null || options === void 0 ? void 0 : options.setter(v) : v; // save value for controlled change to be uncontrolled
|
|
65
66
|
// don't use state for reduce necessary update
|
|
66
67
|
// still keep state for uncontrolled update
|
|
67
68
|
|
|
68
69
|
cacheVRef.current = r;
|
|
69
70
|
if (!isControlled) setV(r);
|
|
71
|
+
}.bind(this), [isControlled, options]);
|
|
72
|
+
var callOnChange = (0, _react.useCallback)(function (v) {
|
|
73
|
+
updateValueWithoutCallOnChange(v);
|
|
70
74
|
|
|
71
75
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
72
76
|
rest[_key - 1] = arguments[_key];
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [v].concat(rest));
|
|
76
|
-
}, [
|
|
77
|
-
|
|
78
|
-
(0, _newArrowCheck2.default)(this, _this2);
|
|
79
|
-
if (!isControlled) setV(v);
|
|
80
|
-
}.bind(this), [isControlled]);
|
|
81
|
-
return [finalValue, o, updateValueWithoutCallOnChange];
|
|
80
|
+
}, [updateValueWithoutCallOnChange, onChange]);
|
|
81
|
+
return [finalValue, callOnChange, updateValueWithoutCallOnChange];
|
|
82
82
|
}.bind(void 0);
|
|
83
83
|
|
|
84
84
|
var _default = useUncontrolled;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ucloud-fe/react-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"title": "UCloud react components",
|
|
5
5
|
"description": "UCloud react components",
|
|
6
6
|
"keywords": [
|
|
@@ -95,7 +95,6 @@
|
|
|
95
95
|
"@babel/preset-typescript": "^7.10.4",
|
|
96
96
|
"@commitlint/cli": "^7.1.2",
|
|
97
97
|
"@commitlint/config-conventional": "^7.1.2",
|
|
98
|
-
"@rapiop/mod": "^1.1.2",
|
|
99
98
|
"@testing-library/jest-dom": "^5.11.4",
|
|
100
99
|
"@testing-library/react": "^11.0.0",
|
|
101
100
|
"@types/classnames": "^2.2.11",
|
|
@@ -145,10 +144,7 @@
|
|
|
145
144
|
"react-resizable": "^2.0.0",
|
|
146
145
|
"react-styleguidist": "^11.1.5",
|
|
147
146
|
"react-test-renderer": "^16",
|
|
148
|
-
"recodo-compiler": "^0.1.1",
|
|
149
|
-
"recodo-doc": "^0.1.6",
|
|
150
147
|
"recodo-gen": "^0.0.5",
|
|
151
|
-
"recodo-live": "^0.1.2",
|
|
152
148
|
"standard-version": "^8.0.2",
|
|
153
149
|
"style-loader": "^0.20.3",
|
|
154
150
|
"stylelint": "^9.9.0",
|