musae 1.0.27-beta.32 → 1.0.27-beta.34
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/components/bottom-sheet/bottom-sheet.cjs +46 -25
- package/dist/components/bottom-sheet/bottom-sheet.d.ts +7 -1
- package/dist/components/bottom-sheet/bottom-sheet.mjs +47 -26
- package/dist/components/bottom-sheet/context.cjs +3 -6
- package/dist/components/bottom-sheet/context.d.ts +2 -5
- package/dist/components/bottom-sheet/context.mjs +3 -6
- package/dist/components/dialog/dialog.cjs +1 -1
- package/dist/components/dialog/dialog.mjs +1 -1
- package/dist/components/drawer/context.cjs +4 -5
- package/dist/components/drawer/context.d.ts +3 -4
- package/dist/components/drawer/context.mjs +4 -5
- package/dist/components/drawer/drawer.cjs +67 -23
- package/dist/components/drawer/drawer.d.ts +5 -0
- package/dist/components/drawer/drawer.mjs +69 -25
- package/dist/components/image/preview/operations.cjs +1 -1
- package/dist/components/image/preview/operations.mjs +1 -1
- package/dist/components/portal/portal.cjs +3 -3
- package/dist/components/portal/portal.mjs +3 -3
- package/dist/components/sheet/context.cjs +14 -0
- package/dist/components/sheet/context.d.ts +10 -0
- package/dist/components/sheet/context.mjs +12 -0
- package/dist/components/sheet/hooks.cjs +17 -0
- package/dist/components/sheet/hooks.d.ts +9 -0
- package/dist/components/sheet/hooks.mjs +15 -0
- package/dist/components/sheet/index.d.ts +2 -0
- package/dist/components/{drawer/popup.cjs → sheet/sheet.cjs} +88 -82
- package/dist/components/sheet/sheet.d.ts +11 -0
- package/dist/components/{drawer/popup.mjs → sheet/sheet.mjs} +89 -83
- package/dist/components/theme/tokens.stylex.cjs +0 -1
- package/dist/components/theme/tokens.stylex.mjs +0 -1
- package/dist/components/tour/tour.cjs +1 -1
- package/dist/components/tour/tour.mjs +1 -1
- package/dist/contexts/stack-level.context.mjs +1 -1
- package/dist/styles.css +4 -8
- package/dist/types/bottom-sheet.d.ts +7 -0
- package/dist/types/portal.d.ts +2 -2
- package/dist/types/sheet.d.ts +75 -0
- package/package.json +1 -1
- package/dist/components/bottom-sheet/sheet.cjs +0 -137
- package/dist/components/bottom-sheet/sheet.d.ts +0 -8
- package/dist/components/bottom-sheet/sheet.mjs +0 -133
- package/dist/components/drawer/hooks.cjs +0 -10
- package/dist/components/drawer/hooks.d.ts +0 -2
- package/dist/components/drawer/hooks.mjs +0 -8
- package/dist/components/drawer/popup.d.ts +0 -4
|
@@ -3,43 +3,64 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
7
6
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
7
|
var React = require('react');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
8
|
+
var sheet = require('../sheet/sheet.cjs');
|
|
9
|
+
var useClassNames = require('../../hooks/use-class-names.cjs');
|
|
10
|
+
var className = require('@aiszlab/relax/class-name');
|
|
11
|
+
var useThemeColorVars = require('../../hooks/use-theme-color-vars.cjs');
|
|
12
|
+
var context = require('./context.cjs');
|
|
12
13
|
|
|
13
|
-
var _excluded = ["open", "height", "closable"];
|
|
14
|
+
var _excluded = ["open", "height", "closable", "modal"];
|
|
15
|
+
/**
|
|
16
|
+
* @zh BottomSheet 专用样式:居中的拖拽手柄条,以及面板背景和圆角。
|
|
17
|
+
* @en BottomSheet-specific styles: a centered drag handle pill, and panel background/border-radius.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @zh BottomSheet 组件。从底部滑入的模态面板,带有拖拽手柄指示器。
|
|
22
|
+
* 基于共享的 Sheet 基础组件构建。
|
|
23
|
+
* @en BottomSheet component. A modal panel that slides up from the bottom
|
|
24
|
+
* with a drag handle indicator. Built on the shared Sheet base component.
|
|
25
|
+
*/
|
|
14
26
|
var BottomSheet = function BottomSheet(_ref) {
|
|
15
27
|
var open = _ref.open,
|
|
16
28
|
_ref$height = _ref.height,
|
|
17
29
|
height = _ref$height === void 0 ? "50vh" : _ref$height,
|
|
18
30
|
_ref$closable = _ref.closable,
|
|
19
31
|
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
32
|
+
_ref$modal = _ref.modal,
|
|
33
|
+
modal = _ref$modal === void 0 ? true : _ref$modal,
|
|
20
34
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (open) {
|
|
30
|
-
turnOn();
|
|
35
|
+
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
36
|
+
var themeColorVars = useThemeColorVars.useThemeColorVars(["on-surface-variant"]);
|
|
37
|
+
var styled = {
|
|
38
|
+
handle: {
|
|
39
|
+
className: "musaex-1po6ib musaex-rntz3j musaex-1xa9b2s musaex-9ip8r5 musaex-1eodh35 musaex-19i5tse musaex-vueqy4 musaex-2lah0s"
|
|
40
|
+
},
|
|
41
|
+
panel: {
|
|
42
|
+
className: "musaex-17o6occ musaex-zbxit7 musaex-1ei9pc5 musaex-15q9lfd"
|
|
31
43
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* @zh BottomSheet 专用头部:居中的拖拽手柄条。
|
|
47
|
+
* @en BottomSheet-specific header: a centered drag handle pill.
|
|
48
|
+
*/
|
|
49
|
+
var header = /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: className.stringify(classNames.handle, styled.handle.className),
|
|
51
|
+
style: _objectSpread(_objectSpread({}, styled.handle.style), themeColorVars)
|
|
52
|
+
});
|
|
53
|
+
return /*#__PURE__*/React.createElement(sheet.default, {
|
|
54
|
+
visible: open,
|
|
55
|
+
placement: "bottom",
|
|
56
|
+
size: height,
|
|
40
57
|
closable: closable,
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
modal: modal,
|
|
59
|
+
onClose: props.onClose,
|
|
60
|
+
className: classNames.sheet,
|
|
61
|
+
header: header,
|
|
62
|
+
panelClassName: styled.panel.className
|
|
63
|
+
}, props.children);
|
|
43
64
|
};
|
|
44
65
|
|
|
45
66
|
exports.default = BottomSheet;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { BottomSheetProps } from "../../types/bottom-sheet";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @zh BottomSheet 组件。从底部滑入的模态面板,带有拖拽手柄指示器。
|
|
5
|
+
* 基于共享的 Sheet 基础组件构建。
|
|
6
|
+
* @en BottomSheet component. A modal panel that slides up from the bottom
|
|
7
|
+
* with a drag handle indicator. Built on the shared Sheet base component.
|
|
8
|
+
*/
|
|
9
|
+
declare const BottomSheet: ({ open, height, closable, modal, ...props }: BottomSheetProps) => React.JSX.Element;
|
|
4
10
|
export default BottomSheet;
|
|
@@ -1,41 +1,62 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
|
-
import React
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Sheet from '../sheet/sheet.mjs';
|
|
5
|
+
import { useClassNames } from '../../hooks/use-class-names.mjs';
|
|
6
|
+
import { stringify } from '@aiszlab/relax/class-name';
|
|
7
|
+
import { useThemeColorVars } from '../../hooks/use-theme-color-vars.mjs';
|
|
8
|
+
import { CLASS_NAMES } from './context.mjs';
|
|
8
9
|
|
|
9
|
-
var _excluded = ["open", "height", "closable"];
|
|
10
|
+
var _excluded = ["open", "height", "closable", "modal"];
|
|
11
|
+
/**
|
|
12
|
+
* @zh BottomSheet 专用样式:居中的拖拽手柄条,以及面板背景和圆角。
|
|
13
|
+
* @en BottomSheet-specific styles: a centered drag handle pill, and panel background/border-radius.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @zh BottomSheet 组件。从底部滑入的模态面板,带有拖拽手柄指示器。
|
|
18
|
+
* 基于共享的 Sheet 基础组件构建。
|
|
19
|
+
* @en BottomSheet component. A modal panel that slides up from the bottom
|
|
20
|
+
* with a drag handle indicator. Built on the shared Sheet base component.
|
|
21
|
+
*/
|
|
10
22
|
var BottomSheet = function BottomSheet(_ref) {
|
|
11
23
|
var open = _ref.open,
|
|
12
24
|
_ref$height = _ref.height,
|
|
13
25
|
height = _ref$height === void 0 ? "50vh" : _ref$height,
|
|
14
26
|
_ref$closable = _ref.closable,
|
|
15
27
|
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
28
|
+
_ref$modal = _ref.modal,
|
|
29
|
+
modal = _ref$modal === void 0 ? true : _ref$modal,
|
|
16
30
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (open) {
|
|
26
|
-
turnOn();
|
|
31
|
+
var classNames = useClassNames(CLASS_NAMES);
|
|
32
|
+
var themeColorVars = useThemeColorVars(["on-surface-variant"]);
|
|
33
|
+
var styled = {
|
|
34
|
+
handle: {
|
|
35
|
+
className: "musaex-1po6ib musaex-rntz3j musaex-1xa9b2s musaex-9ip8r5 musaex-1eodh35 musaex-19i5tse musaex-vueqy4 musaex-2lah0s"
|
|
36
|
+
},
|
|
37
|
+
panel: {
|
|
38
|
+
className: "musaex-17o6occ musaex-zbxit7 musaex-1ei9pc5 musaex-15q9lfd"
|
|
27
39
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @zh BottomSheet 专用头部:居中的拖拽手柄条。
|
|
43
|
+
* @en BottomSheet-specific header: a centered drag handle pill.
|
|
44
|
+
*/
|
|
45
|
+
var header = /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: stringify(classNames.handle, styled.handle.className),
|
|
47
|
+
style: _objectSpread(_objectSpread({}, styled.handle.style), themeColorVars)
|
|
48
|
+
});
|
|
49
|
+
return /*#__PURE__*/React.createElement(Sheet, {
|
|
50
|
+
visible: open,
|
|
51
|
+
placement: "bottom",
|
|
52
|
+
size: height,
|
|
36
53
|
closable: closable,
|
|
37
|
-
|
|
38
|
-
|
|
54
|
+
modal: modal,
|
|
55
|
+
onClose: props.onClose,
|
|
56
|
+
className: classNames.sheet,
|
|
57
|
+
header: header,
|
|
58
|
+
panelClassName: styled.panel.className
|
|
59
|
+
}, props.children);
|
|
39
60
|
};
|
|
40
61
|
|
|
41
62
|
export { BottomSheet as default };
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
5
|
-
* class names for BottomSheet
|
|
4
|
+
* @zh BottomSheet 的 class 名称
|
|
5
|
+
* @en class names for BottomSheet
|
|
6
6
|
*/
|
|
7
7
|
var CLASS_NAMES = {
|
|
8
8
|
sheet: "bottom-sheet",
|
|
9
|
-
|
|
10
|
-
panel: "bottom-sheet__panel",
|
|
11
|
-
handle: "bottom-sheet__drag-handle",
|
|
12
|
-
body: "bottom-sheet__body"
|
|
9
|
+
handle: "bottom-sheet__drag-handle"
|
|
13
10
|
};
|
|
14
11
|
|
|
15
12
|
exports.CLASS_NAMES = CLASS_NAMES;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* class names for BottomSheet
|
|
2
|
+
* @zh BottomSheet 的 class 名称
|
|
3
|
+
* @en class names for BottomSheet
|
|
4
4
|
*/
|
|
5
5
|
export declare const CLASS_NAMES: {
|
|
6
6
|
readonly sheet: "bottom-sheet";
|
|
7
|
-
readonly overlay: "bottom-sheet__overlay";
|
|
8
|
-
readonly panel: "bottom-sheet__panel";
|
|
9
7
|
readonly handle: "bottom-sheet__drag-handle";
|
|
10
|
-
readonly body: "bottom-sheet__body";
|
|
11
8
|
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* class names for BottomSheet
|
|
2
|
+
* @zh BottomSheet 的 class 名称
|
|
3
|
+
* @en class names for BottomSheet
|
|
4
4
|
*/
|
|
5
5
|
var CLASS_NAMES = {
|
|
6
6
|
sheet: "bottom-sheet",
|
|
7
|
-
|
|
8
|
-
panel: "bottom-sheet__panel",
|
|
9
|
-
handle: "bottom-sheet__drag-handle",
|
|
10
|
-
body: "bottom-sheet__body"
|
|
7
|
+
handle: "bottom-sheet__drag-handle"
|
|
11
8
|
};
|
|
12
9
|
|
|
13
10
|
export { CLASS_NAMES };
|
|
@@ -40,7 +40,7 @@ var Dialog = function Dialog(_ref) {
|
|
|
40
40
|
}
|
|
41
41
|
}, /*#__PURE__*/React.createElement(portal.default, {
|
|
42
42
|
open: open || _isVisible,
|
|
43
|
-
|
|
43
|
+
modal: true
|
|
44
44
|
}, /*#__PURE__*/React.createElement(popup.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
45
45
|
closable: closable,
|
|
46
46
|
open: open,
|
|
@@ -36,7 +36,7 @@ var Dialog = function Dialog(_ref) {
|
|
|
36
36
|
}
|
|
37
37
|
}, /*#__PURE__*/React.createElement(Portal, {
|
|
38
38
|
open: open || _isVisible,
|
|
39
|
-
|
|
39
|
+
modal: true
|
|
40
40
|
}, /*#__PURE__*/React.createElement(Popup, _objectSpread(_objectSpread({}, props), {}, {
|
|
41
41
|
closable: closable,
|
|
42
42
|
open: open,
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
5
|
-
* class names
|
|
4
|
+
* @zh Drawer 的 class 名称
|
|
5
|
+
* @en class names for Drawer
|
|
6
6
|
*/
|
|
7
7
|
var CLASS_NAMES = {
|
|
8
8
|
drawer: "drawer",
|
|
9
|
-
overlay: "drawer__overlay",
|
|
10
|
-
panel: "drawer__panel",
|
|
11
9
|
header: "drawer__header",
|
|
12
|
-
body: "drawer__body"
|
|
10
|
+
body: "drawer__body",
|
|
11
|
+
actions: "drawer__actions"
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
exports.CLASS_NAMES = CLASS_NAMES;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* class names
|
|
2
|
+
* @zh Drawer 的 class 名称
|
|
3
|
+
* @en class names for Drawer
|
|
4
4
|
*/
|
|
5
5
|
export declare const CLASS_NAMES: {
|
|
6
6
|
readonly drawer: "drawer";
|
|
7
|
-
readonly overlay: "drawer__overlay";
|
|
8
|
-
readonly panel: "drawer__panel";
|
|
9
7
|
readonly header: "drawer__header";
|
|
10
8
|
readonly body: "drawer__body";
|
|
9
|
+
readonly actions: "drawer__actions";
|
|
11
10
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* class names
|
|
2
|
+
* @zh Drawer 的 class 名称
|
|
3
|
+
* @en class names for Drawer
|
|
4
4
|
*/
|
|
5
5
|
var CLASS_NAMES = {
|
|
6
6
|
drawer: "drawer",
|
|
7
|
-
overlay: "drawer__overlay",
|
|
8
|
-
panel: "drawer__panel",
|
|
9
7
|
header: "drawer__header",
|
|
10
|
-
body: "drawer__body"
|
|
8
|
+
body: "drawer__body",
|
|
9
|
+
actions: "drawer__actions"
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
export { CLASS_NAMES };
|
|
@@ -6,11 +6,41 @@ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
|
6
6
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
7
7
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
8
|
var React = require('react');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
9
|
+
var sheet = require('../sheet/sheet.cjs');
|
|
10
|
+
var button = require('../button/button.cjs');
|
|
11
|
+
var space = require('../space/space.cjs');
|
|
12
|
+
var useLocale = require('../../locale/use-locale.cjs');
|
|
13
|
+
var useClosable = require('../../hooks/use-closable.cjs');
|
|
14
|
+
var useClassNames = require('../../hooks/use-class-names.cjs');
|
|
15
|
+
var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.18.3/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
|
|
16
|
+
var className = require('@aiszlab/relax/class-name');
|
|
17
|
+
var useThemeColorVars = require('../../hooks/use-theme-color-vars.cjs');
|
|
18
|
+
var theme = require('../theme/theme.cjs');
|
|
19
|
+
var context = require('./context.cjs');
|
|
12
20
|
|
|
13
21
|
var _excluded = ["open", "size", "closable", "placement"];
|
|
22
|
+
/**
|
|
23
|
+
* @zh Drawer 专用样式:包含关闭按钮、标题和确认按钮的头部栏,以及面板背景。
|
|
24
|
+
* @en Drawer-specific styles: header bar with closer, title, confirm button, and panel background.
|
|
25
|
+
*/
|
|
26
|
+
var styles = {
|
|
27
|
+
header: {
|
|
28
|
+
k1xSpc: "musaex-78zum5",
|
|
29
|
+
kg3NbH: "musaex-1v4gb6w",
|
|
30
|
+
k8WAf4: "musaex-1aur8i7",
|
|
31
|
+
kGNEyG: "musaex-6s0dn4",
|
|
32
|
+
kOIVth: "musaex-wcf3z5",
|
|
33
|
+
kt9PQ7: "musaex-d1xpcx",
|
|
34
|
+
kfdmCh: "musaex-1q0q8m5",
|
|
35
|
+
kL6WhQ: "musaex-quqrak",
|
|
36
|
+
$$css: true
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @zh Drawer 组件。从屏幕任意边缘滑入的模态面板。基于共享的 Sheet 基础组件构建。
|
|
41
|
+
* @en Drawer component. A modal panel that slides in from any screen edge.
|
|
42
|
+
* Built on the shared Sheet base component.
|
|
43
|
+
*/
|
|
14
44
|
var Drawer = function Drawer(_ref) {
|
|
15
45
|
var open = _ref.open,
|
|
16
46
|
_ref$size = _ref.size,
|
|
@@ -20,29 +50,43 @@ var Drawer = function Drawer(_ref) {
|
|
|
20
50
|
_ref$placement = _ref.placement,
|
|
21
51
|
placement = _ref$placement === void 0 ? "right" : _ref$placement,
|
|
22
52
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
53
|
+
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
54
|
+
var _useLocale = useLocale.useLocale("drawer"),
|
|
55
|
+
_useLocale2 = _slicedToArray(_useLocale, 1),
|
|
56
|
+
locale = _useLocale2[0];
|
|
57
|
+
var themeColorVars = useThemeColorVars.useThemeColorVars(["outline-variant"]);
|
|
58
|
+
var _useClosable = useClosable.useClosable({
|
|
59
|
+
closable: closable,
|
|
60
|
+
onClose: props.onClose
|
|
61
|
+
}),
|
|
62
|
+
closer = _useClosable.closer;
|
|
63
|
+
var styled = {
|
|
64
|
+
header: stylex.props(theme.$body.large, styles.header),
|
|
65
|
+
actions: {
|
|
66
|
+
className: "musaex-vc5jky"
|
|
67
|
+
},
|
|
68
|
+
panel: {
|
|
69
|
+
className: "musaex-1q2mt7c"
|
|
33
70
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
lockable: true
|
|
39
|
-
}, /*#__PURE__*/React.createElement(popup.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
40
|
-
onClosed: turnOff,
|
|
71
|
+
};
|
|
72
|
+
return /*#__PURE__*/React.createElement(sheet.default, {
|
|
73
|
+
visible: open,
|
|
74
|
+
placement: placement,
|
|
41
75
|
size: size,
|
|
42
|
-
open: open,
|
|
43
76
|
closable: closable,
|
|
44
|
-
|
|
45
|
-
|
|
77
|
+
onClose: props.onClose,
|
|
78
|
+
className: classNames.drawer,
|
|
79
|
+
header: /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
className: className.stringify(classNames.header, styled.header.className),
|
|
81
|
+
style: _objectSpread(_objectSpread({}, styled.header.style), themeColorVars)
|
|
82
|
+
}, closer, props.title, props.onConfirm && (/*#__PURE__*/React.createElement(space.default, {
|
|
83
|
+
className: styled.actions.className,
|
|
84
|
+
style: styled.actions.style
|
|
85
|
+
}, /*#__PURE__*/React.createElement(button.Button, {
|
|
86
|
+
onClick: props.onConfirm
|
|
87
|
+
}, locale.confirm)))),
|
|
88
|
+
panelClassName: styled.panel.className
|
|
89
|
+
}, props.children);
|
|
46
90
|
};
|
|
47
91
|
|
|
48
92
|
exports.default = Drawer;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { DrawerProps } from "../../types/drawer";
|
|
3
|
+
/**
|
|
4
|
+
* @zh Drawer 组件。从屏幕任意边缘滑入的模态面板。基于共享的 Sheet 基础组件构建。
|
|
5
|
+
* @en Drawer component. A modal panel that slides in from any screen edge.
|
|
6
|
+
* Built on the shared Sheet base component.
|
|
7
|
+
*/
|
|
3
8
|
declare const Drawer: ({ open, size, closable, placement, ...props }: DrawerProps) => React.JSX.Element;
|
|
4
9
|
export default Drawer;
|
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
|
-
import React
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Sheet from '../sheet/sheet.mjs';
|
|
6
|
+
import { Button } from '../button/button.mjs';
|
|
7
|
+
import Space from '../space/space.mjs';
|
|
8
|
+
import { useLocale } from '../../locale/use-locale.mjs';
|
|
9
|
+
import { useClosable } from '../../hooks/use-closable.mjs';
|
|
10
|
+
import { useClassNames } from '../../hooks/use-class-names.mjs';
|
|
11
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.18.3/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
|
|
12
|
+
import { stringify } from '@aiszlab/relax/class-name';
|
|
13
|
+
import { useThemeColorVars } from '../../hooks/use-theme-color-vars.mjs';
|
|
14
|
+
import { $body } from '../theme/theme.mjs';
|
|
15
|
+
import { CLASS_NAMES } from './context.mjs';
|
|
8
16
|
|
|
9
17
|
var _excluded = ["open", "size", "closable", "placement"];
|
|
18
|
+
/**
|
|
19
|
+
* @zh Drawer 专用样式:包含关闭按钮、标题和确认按钮的头部栏,以及面板背景。
|
|
20
|
+
* @en Drawer-specific styles: header bar with closer, title, confirm button, and panel background.
|
|
21
|
+
*/
|
|
22
|
+
var styles = {
|
|
23
|
+
header: {
|
|
24
|
+
k1xSpc: "musaex-78zum5",
|
|
25
|
+
kg3NbH: "musaex-1v4gb6w",
|
|
26
|
+
k8WAf4: "musaex-1aur8i7",
|
|
27
|
+
kGNEyG: "musaex-6s0dn4",
|
|
28
|
+
kOIVth: "musaex-wcf3z5",
|
|
29
|
+
kt9PQ7: "musaex-d1xpcx",
|
|
30
|
+
kfdmCh: "musaex-1q0q8m5",
|
|
31
|
+
kL6WhQ: "musaex-quqrak",
|
|
32
|
+
$$css: true
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @zh Drawer 组件。从屏幕任意边缘滑入的模态面板。基于共享的 Sheet 基础组件构建。
|
|
37
|
+
* @en Drawer component. A modal panel that slides in from any screen edge.
|
|
38
|
+
* Built on the shared Sheet base component.
|
|
39
|
+
*/
|
|
10
40
|
var Drawer = function Drawer(_ref) {
|
|
11
41
|
var open = _ref.open,
|
|
12
42
|
_ref$size = _ref.size,
|
|
@@ -15,30 +45,44 @@ var Drawer = function Drawer(_ref) {
|
|
|
15
45
|
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
16
46
|
_ref$placement = _ref.placement,
|
|
17
47
|
placement = _ref$placement === void 0 ? "right" : _ref$placement,
|
|
18
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
48
|
+
props$1 = _objectWithoutProperties(_ref, _excluded);
|
|
49
|
+
var classNames = useClassNames(CLASS_NAMES);
|
|
50
|
+
var _useLocale = useLocale("drawer"),
|
|
51
|
+
_useLocale2 = _slicedToArray(_useLocale, 1),
|
|
52
|
+
locale = _useLocale2[0];
|
|
53
|
+
var themeColorVars = useThemeColorVars(["outline-variant"]);
|
|
54
|
+
var _useClosable = useClosable({
|
|
55
|
+
closable: closable,
|
|
56
|
+
onClose: props$1.onClose
|
|
57
|
+
}),
|
|
58
|
+
closer = _useClosable.closer;
|
|
59
|
+
var styled = {
|
|
60
|
+
header: props($body.large, styles.header),
|
|
61
|
+
actions: {
|
|
62
|
+
className: "musaex-vc5jky"
|
|
63
|
+
},
|
|
64
|
+
panel: {
|
|
65
|
+
className: "musaex-1q2mt7c"
|
|
29
66
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
lockable: true
|
|
35
|
-
}, /*#__PURE__*/React.createElement(Popup, _objectSpread(_objectSpread({}, props), {}, {
|
|
36
|
-
onClosed: turnOff,
|
|
67
|
+
};
|
|
68
|
+
return /*#__PURE__*/React.createElement(Sheet, {
|
|
69
|
+
visible: open,
|
|
70
|
+
placement: placement,
|
|
37
71
|
size: size,
|
|
38
|
-
open: open,
|
|
39
72
|
closable: closable,
|
|
40
|
-
|
|
41
|
-
|
|
73
|
+
onClose: props$1.onClose,
|
|
74
|
+
className: classNames.drawer,
|
|
75
|
+
header: /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: stringify(classNames.header, styled.header.className),
|
|
77
|
+
style: _objectSpread(_objectSpread({}, styled.header.style), themeColorVars)
|
|
78
|
+
}, closer, props$1.title, props$1.onConfirm && (/*#__PURE__*/React.createElement(Space, {
|
|
79
|
+
className: styled.actions.className,
|
|
80
|
+
style: styled.actions.style
|
|
81
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
82
|
+
onClick: props$1.onConfirm
|
|
83
|
+
}, locale.confirm)))),
|
|
84
|
+
panelClassName: styled.panel.className
|
|
85
|
+
}, props$1.children);
|
|
42
86
|
};
|
|
43
87
|
|
|
44
88
|
export { Drawer as default };
|
|
@@ -55,7 +55,7 @@ var Operations = function Operations(_ref) {
|
|
|
55
55
|
total = _ref2$total === void 0 ? 1 : _ref2$total;
|
|
56
56
|
var isMultiple = total > 1;
|
|
57
57
|
return /*#__PURE__*/React.createElement(portal.default, {
|
|
58
|
-
|
|
58
|
+
modal: true
|
|
59
59
|
}, /*#__PURE__*/React.createElement("div", {
|
|
60
60
|
className: styled.operations.className,
|
|
61
61
|
style: _objectSpread(_objectSpread({}, styled.operations.style), {}, {
|
|
@@ -51,7 +51,7 @@ var Operations = function Operations(_ref) {
|
|
|
51
51
|
total = _ref2$total === void 0 ? 1 : _ref2$total;
|
|
52
52
|
var isMultiple = total > 1;
|
|
53
53
|
return /*#__PURE__*/React.createElement(Portal, {
|
|
54
|
-
|
|
54
|
+
modal: true
|
|
55
55
|
}, /*#__PURE__*/React.createElement("div", {
|
|
56
56
|
className: styled.operations.className,
|
|
57
57
|
style: _objectSpread(_objectSpread({}, styled.operations.style), {}, {
|
|
@@ -14,8 +14,8 @@ var Portal = function Portal(_ref) {
|
|
|
14
14
|
open = _ref$open === void 0 ? true : _ref$open,
|
|
15
15
|
_ref$destroyable = _ref.destroyable,
|
|
16
16
|
destroyable = _ref$destroyable === void 0 ? false : _ref$destroyable,
|
|
17
|
-
_ref$
|
|
18
|
-
|
|
17
|
+
_ref$modal = _ref.modal,
|
|
18
|
+
modal = _ref$modal === void 0 ? false : _ref$modal,
|
|
19
19
|
container = _ref.container;
|
|
20
20
|
var _useState = React.useState(false),
|
|
21
21
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -32,7 +32,7 @@ var Portal = function Portal(_ref) {
|
|
|
32
32
|
setShouldRender(open);
|
|
33
33
|
}
|
|
34
34
|
}, [destroyable, open]);
|
|
35
|
-
relax.useScrollLocker(relax.isDomUsable() &&
|
|
35
|
+
relax.useScrollLocker(relax.isDomUsable() && modal && open);
|
|
36
36
|
if (!(shouldRender || open)) return null;
|
|
37
37
|
if (!_container) return null;
|
|
38
38
|
return /*#__PURE__*/reactDom.createPortal(children, _container);
|
|
@@ -10,8 +10,8 @@ var Portal = function Portal(_ref) {
|
|
|
10
10
|
open = _ref$open === void 0 ? true : _ref$open,
|
|
11
11
|
_ref$destroyable = _ref.destroyable,
|
|
12
12
|
destroyable = _ref$destroyable === void 0 ? false : _ref$destroyable,
|
|
13
|
-
_ref$
|
|
14
|
-
|
|
13
|
+
_ref$modal = _ref.modal,
|
|
14
|
+
modal = _ref$modal === void 0 ? false : _ref$modal,
|
|
15
15
|
container = _ref.container;
|
|
16
16
|
var _useState = useState(false),
|
|
17
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -28,7 +28,7 @@ var Portal = function Portal(_ref) {
|
|
|
28
28
|
setShouldRender(open);
|
|
29
29
|
}
|
|
30
30
|
}, [destroyable, open]);
|
|
31
|
-
useScrollLocker(isDomUsable() &&
|
|
31
|
+
useScrollLocker(isDomUsable() && modal && open);
|
|
32
32
|
if (!(shouldRender || open)) return null;
|
|
33
33
|
if (!_container) return null;
|
|
34
34
|
return /*#__PURE__*/createPortal(children, _container);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @zh 共享的 Sheet 基础组件 BEM 类名。
|
|
5
|
+
* @en Shared BEM class names for the Sheet base component.
|
|
6
|
+
*/
|
|
7
|
+
var CLASS_NAMES = {
|
|
8
|
+
sheet: "sheet",
|
|
9
|
+
overlay: "sheet__overlay",
|
|
10
|
+
panel: "sheet__panel",
|
|
11
|
+
body: "sheet__body"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.CLASS_NAMES = CLASS_NAMES;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zh 共享的 Sheet 基础组件 BEM 类名。
|
|
3
|
+
* @en Shared BEM class names for the Sheet base component.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CLASS_NAMES: {
|
|
6
|
+
readonly sheet: "sheet";
|
|
7
|
+
readonly overlay: "sheet__overlay";
|
|
8
|
+
readonly panel: "sheet__panel";
|
|
9
|
+
readonly body: "sheet__body";
|
|
10
|
+
};
|