@rc-component/trigger 3.6.15 → 3.6.16
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/README.md +4 -4
- package/es/Popup/Arrow.js +2 -2
- package/es/Popup/Mask.js +2 -2
- package/es/Popup/index.js +2 -2
- package/es/UniqueProvider/UniqueContainer.js +2 -2
- package/es/UniqueProvider/index.js +4 -4
- package/es/index.js +3 -3
- package/lib/Popup/Arrow.js +2 -3
- package/lib/Popup/Mask.js +2 -2
- package/lib/Popup/index.js +2 -2
- package/lib/UniqueProvider/UniqueContainer.js +2 -2
- package/lib/UniqueProvider/index.js +4 -4
- package/lib/index.js +3 -3
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -9,10 +9,10 @@ React Trigger Component
|
|
|
9
9
|
[![bundle size][bundlephobia-image]][bundlephobia-url]
|
|
10
10
|
[![dumi][dumi-image]][dumi-url]
|
|
11
11
|
|
|
12
|
-
[npm-image]:
|
|
13
|
-
[npm-url]:
|
|
14
|
-
[github-actions-image]: https://github.com/react-component/trigger/workflows/
|
|
15
|
-
[github-actions-url]: https://github.com/react-component/trigger/actions
|
|
12
|
+
[npm-image]: https://img.shields.io/npm/v/@rc-component/trigger.svg?style=flat-square
|
|
13
|
+
[npm-url]: https://npmjs.org/package/@rc-component/trigger
|
|
14
|
+
[github-actions-image]: https://github.com/react-component/trigger/actions/workflows/main.yml/badge.svg
|
|
15
|
+
[github-actions-url]: https://github.com/react-component/trigger/actions/workflows/main.yml
|
|
16
16
|
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/trigger/master.svg?style=flat-square
|
|
17
17
|
[codecov-url]: https://codecov.io/gh/react-component/trigger/branch/master
|
|
18
18
|
[david-url]: https://david-dm.org/react-component/trigger
|
package/es/Popup/Arrow.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
export default function Arrow(props) {
|
|
4
4
|
const {
|
|
@@ -55,7 +55,7 @@ export default function Arrow(props) {
|
|
|
55
55
|
}
|
|
56
56
|
return /*#__PURE__*/React.createElement("div", {
|
|
57
57
|
ref: arrowRef,
|
|
58
|
-
className:
|
|
58
|
+
className: clsx(`${prefixCls}-arrow`, className),
|
|
59
59
|
style: {
|
|
60
60
|
...alignStyle,
|
|
61
61
|
...style
|
package/es/Popup/Mask.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
3
|
import CSSMotion from '@rc-component/motion';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
export default function Mask(props) {
|
|
@@ -24,6 +24,6 @@ export default function Mask(props) {
|
|
|
24
24
|
style: {
|
|
25
25
|
zIndex
|
|
26
26
|
},
|
|
27
|
-
className:
|
|
27
|
+
className: clsx(`${prefixCls}-mask`, mobile && `${prefixCls}-mobile-mask`, className)
|
|
28
28
|
}));
|
|
29
29
|
}
|
package/es/Popup/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
3
|
import CSSMotion from '@rc-component/motion';
|
|
4
4
|
import ResizeObserver from '@rc-component/resize-observer';
|
|
5
5
|
import useLayoutEffect from "@rc-component/util/es/hooks/useLayoutEffect";
|
|
@@ -151,7 +151,7 @@ const Popup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
151
151
|
className: motionClassName,
|
|
152
152
|
style: motionStyle
|
|
153
153
|
}, motionRef) => {
|
|
154
|
-
const cls =
|
|
154
|
+
const cls = clsx(prefixCls, motionClassName, className, {
|
|
155
155
|
[`${prefixCls}-mobile`]: isMobile
|
|
156
156
|
});
|
|
157
157
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import useOffsetStyle from "../hooks/useOffsetStyle";
|
|
4
|
-
import
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
5
|
import CSSMotion from '@rc-component/motion';
|
|
6
6
|
const UniqueContainer = props => {
|
|
7
7
|
const {
|
|
@@ -57,7 +57,7 @@ const UniqueContainer = props => {
|
|
|
57
57
|
className: motionClassName,
|
|
58
58
|
style: motionStyle
|
|
59
59
|
}) => {
|
|
60
|
-
const cls =
|
|
60
|
+
const cls = clsx(containerCls, motionClassName, uniqueContainerClassName, {
|
|
61
61
|
[`${containerCls}-visible`]: motionVisible
|
|
62
62
|
});
|
|
63
63
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -8,7 +8,7 @@ import { useEvent } from '@rc-component/util';
|
|
|
8
8
|
import useTargetState from "./useTargetState";
|
|
9
9
|
import { isDOM } from "@rc-component/util/es/Dom/findDOMNode";
|
|
10
10
|
import UniqueContainer from "./UniqueContainer";
|
|
11
|
-
import
|
|
11
|
+
import { clsx } from 'clsx';
|
|
12
12
|
import { getAlignPopupClassName } from "../util";
|
|
13
13
|
const UniqueProvider = ({
|
|
14
14
|
children,
|
|
@@ -82,7 +82,7 @@ const UniqueProvider = ({
|
|
|
82
82
|
}
|
|
83
83
|
const baseClassName = getAlignPopupClassName(mergedOptions.builtinPlacements || {}, mergedOptions.prefixCls || '', alignInfo, false // alignPoint is false for UniqueProvider
|
|
84
84
|
);
|
|
85
|
-
return
|
|
85
|
+
return clsx(baseClassName, mergedOptions.getPopupClassNameFromAlign?.(alignInfo));
|
|
86
86
|
}, [alignInfo, mergedOptions?.getPopupClassNameFromAlign, mergedOptions?.builtinPlacements, mergedOptions?.prefixCls]);
|
|
87
87
|
const contextValue = React.useMemo(() => ({
|
|
88
88
|
show,
|
|
@@ -121,7 +121,7 @@ const UniqueProvider = ({
|
|
|
121
121
|
portal: Portal,
|
|
122
122
|
prefixCls: prefixCls,
|
|
123
123
|
popup: mergedOptions.popup,
|
|
124
|
-
className:
|
|
124
|
+
className: clsx(mergedOptions.popupClassName, alignedClassName, `${prefixCls}-unique-controlled`),
|
|
125
125
|
style: mergedOptions.popupStyle,
|
|
126
126
|
target: mergedOptions.target,
|
|
127
127
|
open: open,
|
|
@@ -167,7 +167,7 @@ const UniqueProvider = ({
|
|
|
167
167
|
},
|
|
168
168
|
popupSize: popupSize,
|
|
169
169
|
motion: mergedOptions.popupMotion,
|
|
170
|
-
uniqueContainerClassName:
|
|
170
|
+
uniqueContainerClassName: clsx(mergedOptions.uniqueContainerClassName, alignedClassName),
|
|
171
171
|
uniqueContainerStyle: mergedOptions.uniqueContainerStyle
|
|
172
172
|
}))));
|
|
173
173
|
};
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Portal from '@rc-component/portal';
|
|
2
|
-
import
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
3
|
import ResizeObserver from '@rc-component/resize-observer';
|
|
4
4
|
import { isDOM } from "@rc-component/util/es/Dom/findDOMNode";
|
|
5
5
|
import { getShadowRoot } from "@rc-component/util/es/Dom/shadow";
|
|
@@ -281,7 +281,7 @@ export function generateTrigger(PortalComponent = Portal) {
|
|
|
281
281
|
}, [JSON.stringify(popupAlign)]);
|
|
282
282
|
const alignedClassName = React.useMemo(() => {
|
|
283
283
|
const baseClassName = getAlignPopupClassName(builtinPlacements, prefixCls, alignInfo, alignPoint);
|
|
284
|
-
return
|
|
284
|
+
return clsx(baseClassName, getPopupClassNameFromAlign?.(alignInfo));
|
|
285
285
|
}, [alignInfo, getPopupClassNameFromAlign, builtinPlacements, prefixCls, alignPoint]);
|
|
286
286
|
|
|
287
287
|
// ============================ Refs ============================
|
|
@@ -493,7 +493,7 @@ export function generateTrigger(PortalComponent = Portal) {
|
|
|
493
493
|
ref: setPopupRef,
|
|
494
494
|
prefixCls: prefixCls,
|
|
495
495
|
popup: popup,
|
|
496
|
-
className:
|
|
496
|
+
className: clsx(popupClassName, !isMobile && alignedClassName),
|
|
497
497
|
style: popupStyle,
|
|
498
498
|
target: targetEle,
|
|
499
499
|
onMouseEnter: onPopupMouseEnter,
|
package/lib/Popup/Arrow.js
CHANGED
|
@@ -4,11 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Arrow;
|
|
7
|
-
var
|
|
7
|
+
var _clsx = require("clsx");
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
10
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
11
|
function Arrow(props) {
|
|
13
12
|
const {
|
|
14
13
|
prefixCls,
|
|
@@ -64,7 +63,7 @@ function Arrow(props) {
|
|
|
64
63
|
}
|
|
65
64
|
return /*#__PURE__*/React.createElement("div", {
|
|
66
65
|
ref: arrowRef,
|
|
67
|
-
className: (0,
|
|
66
|
+
className: (0, _clsx.clsx)(`${prefixCls}-arrow`, className),
|
|
68
67
|
style: {
|
|
69
68
|
...alignStyle,
|
|
70
69
|
...style
|
package/lib/Popup/Mask.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Mask;
|
|
7
|
-
var
|
|
7
|
+
var _clsx = require("clsx");
|
|
8
8
|
var _motion = _interopRequireDefault(require("@rc-component/motion"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -33,6 +33,6 @@ function Mask(props) {
|
|
|
33
33
|
style: {
|
|
34
34
|
zIndex
|
|
35
35
|
},
|
|
36
|
-
className: (0,
|
|
36
|
+
className: (0, _clsx.clsx)(`${prefixCls}-mask`, mobile && `${prefixCls}-mobile-mask`, className)
|
|
37
37
|
}));
|
|
38
38
|
}
|
package/lib/Popup/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _clsx = require("clsx");
|
|
8
8
|
var _motion = _interopRequireDefault(require("@rc-component/motion"));
|
|
9
9
|
var _resizeObserver = _interopRequireDefault(require("@rc-component/resize-observer"));
|
|
10
10
|
var _useLayoutEffect = _interopRequireDefault(require("@rc-component/util/lib/hooks/useLayoutEffect"));
|
|
@@ -160,7 +160,7 @@ const Popup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
160
160
|
className: motionClassName,
|
|
161
161
|
style: motionStyle
|
|
162
162
|
}, motionRef) => {
|
|
163
|
-
const cls = (0,
|
|
163
|
+
const cls = (0, _clsx.clsx)(prefixCls, motionClassName, className, {
|
|
164
164
|
[`${prefixCls}-mobile`]: isMobile
|
|
165
165
|
});
|
|
166
166
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _useOffsetStyle = _interopRequireDefault(require("../hooks/useOffsetStyle"));
|
|
9
|
-
var
|
|
9
|
+
var _clsx = require("clsx");
|
|
10
10
|
var _motion = _interopRequireDefault(require("@rc-component/motion"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -64,7 +64,7 @@ const UniqueContainer = props => {
|
|
|
64
64
|
className: motionClassName,
|
|
65
65
|
style: motionStyle
|
|
66
66
|
}) => {
|
|
67
|
-
const cls = (0,
|
|
67
|
+
const cls = (0, _clsx.clsx)(containerCls, motionClassName, uniqueContainerClassName, {
|
|
68
68
|
[`${containerCls}-visible`]: motionVisible
|
|
69
69
|
});
|
|
70
70
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -14,7 +14,7 @@ var _util = require("@rc-component/util");
|
|
|
14
14
|
var _useTargetState = _interopRequireDefault(require("./useTargetState"));
|
|
15
15
|
var _findDOMNode = require("@rc-component/util/lib/Dom/findDOMNode");
|
|
16
16
|
var _UniqueContainer = _interopRequireDefault(require("./UniqueContainer"));
|
|
17
|
-
var
|
|
17
|
+
var _clsx = require("clsx");
|
|
18
18
|
var _util2 = require("../util");
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -91,7 +91,7 @@ const UniqueProvider = ({
|
|
|
91
91
|
}
|
|
92
92
|
const baseClassName = (0, _util2.getAlignPopupClassName)(mergedOptions.builtinPlacements || {}, mergedOptions.prefixCls || '', alignInfo, false // alignPoint is false for UniqueProvider
|
|
93
93
|
);
|
|
94
|
-
return (0,
|
|
94
|
+
return (0, _clsx.clsx)(baseClassName, mergedOptions.getPopupClassNameFromAlign?.(alignInfo));
|
|
95
95
|
}, [alignInfo, mergedOptions?.getPopupClassNameFromAlign, mergedOptions?.builtinPlacements, mergedOptions?.prefixCls]);
|
|
96
96
|
const contextValue = React.useMemo(() => ({
|
|
97
97
|
show,
|
|
@@ -130,7 +130,7 @@ const UniqueProvider = ({
|
|
|
130
130
|
portal: _portal.default,
|
|
131
131
|
prefixCls: prefixCls,
|
|
132
132
|
popup: mergedOptions.popup,
|
|
133
|
-
className: (0,
|
|
133
|
+
className: (0, _clsx.clsx)(mergedOptions.popupClassName, alignedClassName, `${prefixCls}-unique-controlled`),
|
|
134
134
|
style: mergedOptions.popupStyle,
|
|
135
135
|
target: mergedOptions.target,
|
|
136
136
|
open: open,
|
|
@@ -176,7 +176,7 @@ const UniqueProvider = ({
|
|
|
176
176
|
},
|
|
177
177
|
popupSize: popupSize,
|
|
178
178
|
motion: mergedOptions.popupMotion,
|
|
179
|
-
uniqueContainerClassName: (0,
|
|
179
|
+
uniqueContainerClassName: (0, _clsx.clsx)(mergedOptions.uniqueContainerClassName, alignedClassName),
|
|
180
180
|
uniqueContainerStyle: mergedOptions.uniqueContainerStyle
|
|
181
181
|
}))));
|
|
182
182
|
};
|
package/lib/index.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "UniqueProvider", {
|
|
|
12
12
|
exports.default = void 0;
|
|
13
13
|
exports.generateTrigger = generateTrigger;
|
|
14
14
|
var _portal = _interopRequireDefault(require("@rc-component/portal"));
|
|
15
|
-
var
|
|
15
|
+
var _clsx = require("clsx");
|
|
16
16
|
var _resizeObserver = _interopRequireDefault(require("@rc-component/resize-observer"));
|
|
17
17
|
var _findDOMNode = require("@rc-component/util/lib/Dom/findDOMNode");
|
|
18
18
|
var _shadow = require("@rc-component/util/lib/Dom/shadow");
|
|
@@ -295,7 +295,7 @@ function generateTrigger(PortalComponent = _portal.default) {
|
|
|
295
295
|
}, [JSON.stringify(popupAlign)]);
|
|
296
296
|
const alignedClassName = React.useMemo(() => {
|
|
297
297
|
const baseClassName = (0, _util.getAlignPopupClassName)(builtinPlacements, prefixCls, alignInfo, alignPoint);
|
|
298
|
-
return (0,
|
|
298
|
+
return (0, _clsx.clsx)(baseClassName, getPopupClassNameFromAlign?.(alignInfo));
|
|
299
299
|
}, [alignInfo, getPopupClassNameFromAlign, builtinPlacements, prefixCls, alignPoint]);
|
|
300
300
|
|
|
301
301
|
// ============================ Refs ============================
|
|
@@ -507,7 +507,7 @@ function generateTrigger(PortalComponent = _portal.default) {
|
|
|
507
507
|
ref: setPopupRef,
|
|
508
508
|
prefixCls: prefixCls,
|
|
509
509
|
popup: popup,
|
|
510
|
-
className: (0,
|
|
510
|
+
className: (0, _clsx.clsx)(popupClassName, !isMobile && alignedClassName),
|
|
511
511
|
style: popupStyle,
|
|
512
512
|
target: targetEle,
|
|
513
513
|
onMouseEnter: onPopupMouseEnter,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rc-component/trigger",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.16",
|
|
4
4
|
"description": "base abstract trigger component for react",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=8.x"
|
|
@@ -45,14 +45,13 @@
|
|
|
45
45
|
"@rc-component/portal": "^2.0.0",
|
|
46
46
|
"@rc-component/resize-observer": "^1.0.0",
|
|
47
47
|
"@rc-component/util": "^1.2.1",
|
|
48
|
-
"
|
|
48
|
+
"clsx": "^2.1.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@rc-component/father-plugin": "^2.0.0",
|
|
52
52
|
"@rc-component/np": "^1.0.3",
|
|
53
53
|
"@testing-library/jest-dom": "^6.1.4",
|
|
54
54
|
"@testing-library/react": "^16.0.0",
|
|
55
|
-
"@types/classnames": "^2.2.10",
|
|
56
55
|
"@types/jest": "^29.5.2",
|
|
57
56
|
"@types/node": "^24.0.3",
|
|
58
57
|
"@types/react": "^19.1.2",
|