musae 1.3.0 → 1.3.1-beta.2
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/__test__/table.test.d.ts +1 -0
- package/dist/components/search/search.cjs +3 -1
- package/dist/components/search/search.d.ts +1 -0
- package/dist/components/search/search.mjs +3 -1
- package/dist/components/sheet/sheet.cjs +13 -3
- package/dist/components/sheet/sheet.d.ts +1 -1
- package/dist/components/sheet/sheet.mjs +13 -3
- package/dist/components/side-sheet/__test__/index.test.d.ts +1 -0
- package/dist/components/side-sheet/context.cjs +15 -0
- package/dist/components/side-sheet/context.d.ts +11 -0
- package/dist/components/side-sheet/context.mjs +13 -0
- package/dist/components/side-sheet/index.d.ts +2 -0
- package/dist/components/side-sheet/side-sheet.cjs +140 -0
- package/dist/components/side-sheet/side-sheet.d.ts +16 -0
- package/dist/components/side-sheet/side-sheet.mjs +136 -0
- package/dist/components/side-sheet/styles.cjs +106 -0
- package/dist/components/side-sheet/styles.d.ts +83 -0
- package/dist/components/side-sheet/styles.mjs +104 -0
- package/dist/components/table/body.cjs +11 -20
- package/dist/components/table/body.mjs +12 -21
- package/dist/components/table/context.cjs +6 -1
- package/dist/components/table/context.d.ts +4 -0
- package/dist/components/table/context.mjs +6 -2
- package/dist/components/table/header/cell.cjs +7 -23
- package/dist/components/table/header/cell.mjs +7 -23
- package/dist/components/table/header/header.cjs +3 -31
- package/dist/components/table/header/header.mjs +4 -32
- package/dist/components/table/hooks.cjs +31 -9
- package/dist/components/table/hooks.d.ts +3 -2
- package/dist/components/table/hooks.mjs +31 -9
- package/dist/components/table/styles.cjs +99 -0
- package/dist/components/table/styles.d.ts +84 -0
- package/dist/components/table/styles.mjs +95 -0
- package/dist/components/table/table.cjs +49 -7
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.mjs +51 -9
- package/dist/components/theme/theme.cjs +31 -0
- package/dist/components/theme/theme.mjs +31 -1
- package/dist/components/theme/tokens.stylex.d.ts +7 -0
- package/dist/components/typography/body.cjs +31 -0
- package/dist/components/typography/body.d.ts +8 -0
- package/dist/components/typography/body.mjs +27 -0
- package/dist/components/typography/context.cjs +15 -0
- package/dist/components/typography/context.d.ts +11 -0
- package/dist/components/typography/context.mjs +13 -0
- package/dist/components/typography/display.cjs +31 -0
- package/dist/components/typography/display.d.ts +8 -0
- package/dist/components/typography/display.mjs +27 -0
- package/dist/components/typography/headline.cjs +31 -0
- package/dist/components/typography/headline.d.ts +8 -0
- package/dist/components/typography/headline.mjs +27 -0
- package/dist/components/typography/index.d.ts +2 -0
- package/dist/components/typography/label.cjs +31 -0
- package/dist/components/typography/label.d.ts +8 -0
- package/dist/components/typography/label.mjs +27 -0
- package/dist/components/typography/title.cjs +31 -0
- package/dist/components/typography/title.d.ts +8 -0
- package/dist/components/typography/title.mjs +27 -0
- package/dist/components/typography/typography.cjs +24 -0
- package/dist/components/typography/typography.d.ts +14 -0
- package/dist/components/typography/typography.mjs +15 -0
- package/dist/index.cjs +4 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +2 -1
- package/dist/styles.css +54 -0
- package/dist/types/search.d.ts +6 -0
- package/dist/types/sheet.d.ts +6 -0
- package/dist/types/side-sheet.d.ts +90 -0
- package/dist/types/table.d.ts +17 -0
- package/dist/types/typography.d.ts +15 -0
- package/package.json +2 -2
- package/dist/components/drawer/context.cjs +0 -14
- package/dist/components/drawer/context.d.ts +0 -10
- package/dist/components/drawer/context.mjs +0 -12
- package/dist/components/drawer/drawer.cjs +0 -92
- package/dist/components/drawer/drawer.d.ts +0 -9
- package/dist/components/drawer/drawer.mjs +0 -88
- package/dist/components/drawer/index.d.ts +0 -2
- package/dist/types/drawer.d.ts +0 -74
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
@@ -35,7 +35,8 @@ var Search = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
35
35
|
_ref$clearable = _ref.clearable,
|
|
36
36
|
clearable = _ref$clearable === void 0 ? true : _ref$clearable,
|
|
37
37
|
searchButton = _ref.searchButton,
|
|
38
|
-
onSearch = _ref.onSearch
|
|
38
|
+
onSearch = _ref.onSearch,
|
|
39
|
+
onClear = _ref.onClear;
|
|
39
40
|
var inputRef = React.useRef(null);
|
|
40
41
|
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
41
42
|
var themeColorVars = useThemeColorVars.useThemeColorVars(["primary", "outline", "surface-container-high", "on-surface-variant", ["on-surface-variant", tokens_stylex.OPACITY.thin], ["on-surface", tokens_stylex.OPACITY.thickest], ["on-surface", tokens_stylex.OPACITY.thin]]);
|
|
@@ -74,6 +75,7 @@ var Search = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
74
75
|
var handleClear = relax.useEvent(function () {
|
|
75
76
|
_setValue("");
|
|
76
77
|
onChange === null || onChange === void 0 || onChange("");
|
|
78
|
+
onClear === null || onClear === void 0 || onClear();
|
|
77
79
|
});
|
|
78
80
|
var handleKeyDown = React.useCallback(function (e) {
|
|
79
81
|
if (e.key === "Enter") {
|
|
@@ -13,5 +13,6 @@ declare const Search: React.ForwardRefExoticComponent<import("../../types/elemen
|
|
|
13
13
|
clearable?: boolean;
|
|
14
14
|
searchButton?: React.ReactNode;
|
|
15
15
|
onSearch?: (keyword?: string) => void;
|
|
16
|
+
onClear?: () => void;
|
|
16
17
|
} & React.RefAttributes<SearchRef>>;
|
|
17
18
|
export default Search;
|
|
@@ -31,7 +31,8 @@ var Search = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
31
31
|
_ref$clearable = _ref.clearable,
|
|
32
32
|
clearable = _ref$clearable === void 0 ? true : _ref$clearable,
|
|
33
33
|
searchButton = _ref.searchButton,
|
|
34
|
-
onSearch = _ref.onSearch
|
|
34
|
+
onSearch = _ref.onSearch,
|
|
35
|
+
onClear = _ref.onClear;
|
|
35
36
|
var inputRef = useRef(null);
|
|
36
37
|
var classNames = useClassNames(CLASS_NAMES);
|
|
37
38
|
var themeColorVars = useThemeColorVars(["primary", "outline", "surface-container-high", "on-surface-variant", ["on-surface-variant", OPACITY.thin], ["on-surface", OPACITY.thickest], ["on-surface", OPACITY.thin]]);
|
|
@@ -70,6 +71,7 @@ var Search = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
70
71
|
var handleClear = useEvent(function () {
|
|
71
72
|
_setValue("");
|
|
72
73
|
onChange === null || onChange === void 0 || onChange("");
|
|
74
|
+
onClear === null || onClear === void 0 || onClear();
|
|
73
75
|
});
|
|
74
76
|
var handleKeyDown = useCallback(function (e) {
|
|
75
77
|
if (e.key === "Enter") {
|
|
@@ -88,6 +88,15 @@ var styles = {
|
|
|
88
88
|
kVQacm: "musaex-ysyzu8",
|
|
89
89
|
kZeWKH: "musaex-ish69e",
|
|
90
90
|
$$css: true
|
|
91
|
+
},
|
|
92
|
+
panelFullscreen: {
|
|
93
|
+
kRDq7Z: "musaex-1ej3teu",
|
|
94
|
+
kllhKz: "musaex-1pzvw0h",
|
|
95
|
+
kIfGbc: "musaex-1se81xg",
|
|
96
|
+
kBJAon: "musaex-19wv56r",
|
|
97
|
+
kGHaHD: "musaex-1m33i82",
|
|
98
|
+
kYNdYH: "musaex-1uogugb",
|
|
99
|
+
$$css: true
|
|
91
100
|
}
|
|
92
101
|
};
|
|
93
102
|
/**
|
|
@@ -106,6 +115,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
106
115
|
_ref$closable = _ref.closable,
|
|
107
116
|
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
108
117
|
header = _ref.header,
|
|
118
|
+
footer = _ref.footer,
|
|
109
119
|
className$1 = _ref.className,
|
|
110
120
|
panelClassName = _ref.panelClassName,
|
|
111
121
|
panelStyle = _ref.panelStyle,
|
|
@@ -201,7 +211,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
201
211
|
overlay: {
|
|
202
212
|
className: "musaex-10l6tqk musaex-10a8y8t musaex-67bb7w musaex-g01cxk musaex-11we2rp"
|
|
203
213
|
},
|
|
204
|
-
panel: stylex.props(styles.panel, styles[placement]),
|
|
214
|
+
panel: stylex.props(styles.panel, styles[placement], styles.panelFullscreen),
|
|
205
215
|
body: {
|
|
206
216
|
className: "musaex-98rzlu musaex-ysyzu8 musaex-ish69e"
|
|
207
217
|
}
|
|
@@ -220,7 +230,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
220
230
|
className: className.stringify(classNames.sheet, className$1, styled.container.className),
|
|
221
231
|
style: _objectSpread(_objectSpread(_objectSpread({}, styled.container.style), themeColorVars), {}, {
|
|
222
232
|
"--default-position": relax.at(_placement, 0),
|
|
223
|
-
"--size": "".concat(size, "px")
|
|
233
|
+
"--size": typeof size === "number" ? "".concat(size, "px") : size
|
|
224
234
|
}),
|
|
225
235
|
onKeyDown: onKeyDown
|
|
226
236
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -235,7 +245,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
235
245
|
}, header, /*#__PURE__*/React.createElement("div", {
|
|
236
246
|
className: className.stringify(classNames.body, styled.body.className),
|
|
237
247
|
style: styled.body.style
|
|
238
|
-
}, children)))));
|
|
248
|
+
}, children), footer))));
|
|
239
249
|
};
|
|
240
250
|
|
|
241
251
|
exports.default = Sheet;
|
|
@@ -7,5 +7,5 @@ import type { SheetProps } from "../../types/sheet";
|
|
|
7
7
|
* placement-driven slide animation, focus management, and body scroll lock.
|
|
8
8
|
* Drawer and BottomSheet are thin wrappers around this component.
|
|
9
9
|
*/
|
|
10
|
-
declare const Sheet: ({ visible, onClose, placement, size, closable, header, className, panelClassName, panelStyle, modal, children, }: SheetProps) => React.JSX.Element;
|
|
10
|
+
declare const Sheet: ({ visible, onClose, placement, size, closable, header, footer, className, panelClassName, panelStyle, modal, children, }: SheetProps) => React.JSX.Element;
|
|
11
11
|
export default Sheet;
|
|
@@ -84,6 +84,15 @@ var styles = {
|
|
|
84
84
|
kVQacm: "musaex-ysyzu8",
|
|
85
85
|
kZeWKH: "musaex-ish69e",
|
|
86
86
|
$$css: true
|
|
87
|
+
},
|
|
88
|
+
panelFullscreen: {
|
|
89
|
+
kRDq7Z: "musaex-1ej3teu",
|
|
90
|
+
kllhKz: "musaex-1pzvw0h",
|
|
91
|
+
kIfGbc: "musaex-1se81xg",
|
|
92
|
+
kBJAon: "musaex-19wv56r",
|
|
93
|
+
kGHaHD: "musaex-1m33i82",
|
|
94
|
+
kYNdYH: "musaex-1uogugb",
|
|
95
|
+
$$css: true
|
|
87
96
|
}
|
|
88
97
|
};
|
|
89
98
|
/**
|
|
@@ -102,6 +111,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
102
111
|
_ref$closable = _ref.closable,
|
|
103
112
|
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
104
113
|
header = _ref.header,
|
|
114
|
+
footer = _ref.footer,
|
|
105
115
|
className = _ref.className,
|
|
106
116
|
panelClassName = _ref.panelClassName,
|
|
107
117
|
panelStyle = _ref.panelStyle,
|
|
@@ -197,7 +207,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
197
207
|
overlay: {
|
|
198
208
|
className: "musaex-10l6tqk musaex-10a8y8t musaex-67bb7w musaex-g01cxk musaex-11we2rp"
|
|
199
209
|
},
|
|
200
|
-
panel: props(styles.panel, styles[placement]),
|
|
210
|
+
panel: props(styles.panel, styles[placement], styles.panelFullscreen),
|
|
201
211
|
body: {
|
|
202
212
|
className: "musaex-98rzlu musaex-ysyzu8 musaex-ish69e"
|
|
203
213
|
}
|
|
@@ -216,7 +226,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
216
226
|
className: stringify(classNames.sheet, className, styled.container.className),
|
|
217
227
|
style: _objectSpread(_objectSpread(_objectSpread({}, styled.container.style), themeColorVars), {}, {
|
|
218
228
|
"--default-position": at(_placement, 0),
|
|
219
|
-
"--size": "".concat(size, "px")
|
|
229
|
+
"--size": typeof size === "number" ? "".concat(size, "px") : size
|
|
220
230
|
}),
|
|
221
231
|
onKeyDown: onKeyDown
|
|
222
232
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -231,7 +241,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
231
241
|
}, header, /*#__PURE__*/React.createElement("div", {
|
|
232
242
|
className: stringify(classNames.body, styled.body.className),
|
|
233
243
|
style: styled.body.style
|
|
234
|
-
}, children)))));
|
|
244
|
+
}, children), footer))));
|
|
235
245
|
};
|
|
236
246
|
|
|
237
247
|
export { Sheet as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @zh SideSheet 的 class 名称
|
|
5
|
+
* @en class names for SideSheet
|
|
6
|
+
*/
|
|
7
|
+
var CLASS_NAMES = {
|
|
8
|
+
sideSheet: "side-sheet",
|
|
9
|
+
header: "side-sheet__header",
|
|
10
|
+
title: "side-sheet__title",
|
|
11
|
+
content: "side-sheet__content",
|
|
12
|
+
actions: "side-sheet__actions"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.CLASS_NAMES = CLASS_NAMES;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zh SideSheet 的 class 名称
|
|
3
|
+
* @en class names for SideSheet
|
|
4
|
+
*/
|
|
5
|
+
export declare const CLASS_NAMES: {
|
|
6
|
+
readonly sideSheet: "side-sheet";
|
|
7
|
+
readonly header: "side-sheet__header";
|
|
8
|
+
readonly title: "side-sheet__title";
|
|
9
|
+
readonly content: "side-sheet__content";
|
|
10
|
+
readonly actions: "side-sheet__actions";
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zh SideSheet 的 class 名称
|
|
3
|
+
* @en class names for SideSheet
|
|
4
|
+
*/
|
|
5
|
+
var CLASS_NAMES = {
|
|
6
|
+
sideSheet: "side-sheet",
|
|
7
|
+
header: "side-sheet__header",
|
|
8
|
+
title: "side-sheet__title",
|
|
9
|
+
content: "side-sheet__content",
|
|
10
|
+
actions: "side-sheet__actions"
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { CLASS_NAMES };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var sheet = require('../sheet/sheet.cjs');
|
|
9
|
+
var divider = require('../divider/divider.cjs');
|
|
10
|
+
var button = require('../button/button.cjs');
|
|
11
|
+
var iconButton = require('../icon-button/icon-button.cjs');
|
|
12
|
+
var useClosable = require('../../hooks/use-closable.cjs');
|
|
13
|
+
var useClassNames = require('../../hooks/use-class-names.cjs');
|
|
14
|
+
var useThemeColorVars = require('../../hooks/use-theme-color-vars.cjs');
|
|
15
|
+
var useLocale = require('../../locale/use-locale.cjs');
|
|
16
|
+
var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
|
|
17
|
+
var className = require('@aiszlab/relax/class-name');
|
|
18
|
+
var theme = require('../theme/theme.cjs');
|
|
19
|
+
var context = require('./context.cjs');
|
|
20
|
+
var styles = require('./styles.cjs');
|
|
21
|
+
var arrowBack = require('../icon/icons/navigation/arrow-back.cjs');
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @zh SideSheet 组件。Material Design 3 侧边栏:承载补充内容或操作的面板,
|
|
25
|
+
* 支持从屏幕四边(left/right/top/bottom)滑入。`modal` 类型基于共享的 Sheet
|
|
26
|
+
* 基础组件构建(遮罩层 + 滑入动画),mobile 下全屏展示;`standard` 类型内嵌
|
|
27
|
+
* 在布局中展示(无遮罩层,停靠边缘带分割线)。
|
|
28
|
+
* @en SideSheet component. A Material Design 3 side sheet: a surface for
|
|
29
|
+
* supplementary content or actions, sliding in from any screen edge
|
|
30
|
+
* (left/right/top/bottom). The `modal` type is built on the shared Sheet base
|
|
31
|
+
* component (scrim + slide animation) and goes fullscreen on mobile;
|
|
32
|
+
* the `standard` type renders inline in the layout (no scrim, with a divider
|
|
33
|
+
* on the anchored edge).
|
|
34
|
+
*/
|
|
35
|
+
var SideSheet = function SideSheet(_ref) {
|
|
36
|
+
var open = _ref.open,
|
|
37
|
+
_ref$type = _ref.type,
|
|
38
|
+
type = _ref$type === void 0 ? "modal" : _ref$type,
|
|
39
|
+
title = _ref.title,
|
|
40
|
+
onBack = _ref.onBack,
|
|
41
|
+
onConfirm = _ref.onConfirm,
|
|
42
|
+
_ref$closable = _ref.closable,
|
|
43
|
+
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
44
|
+
onClose = _ref.onClose,
|
|
45
|
+
actions = _ref.actions,
|
|
46
|
+
_ref$size = _ref.size,
|
|
47
|
+
size = _ref$size === void 0 ? 400 : _ref$size,
|
|
48
|
+
_ref$placement = _ref.placement,
|
|
49
|
+
placement = _ref$placement === void 0 ? "right" : _ref$placement,
|
|
50
|
+
className$1 = _ref.className,
|
|
51
|
+
style = _ref.style,
|
|
52
|
+
children = _ref.children;
|
|
53
|
+
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
54
|
+
var themeColorVars = useThemeColorVars.useThemeColorVars(["surface", "surface-container-low", "on-surface-variant", "outline-variant"]);
|
|
55
|
+
var _useLocale = useLocale.useLocale("drawer"),
|
|
56
|
+
_useLocale2 = _slicedToArray(_useLocale, 1),
|
|
57
|
+
locale = _useLocale2[0];
|
|
58
|
+
var _useClosable = useClosable.useClosable({
|
|
59
|
+
closable: closable,
|
|
60
|
+
onClose: onClose
|
|
61
|
+
}),
|
|
62
|
+
closer = _useClosable.closer;
|
|
63
|
+
var styled = {
|
|
64
|
+
panel: stylex.props(styles.styles.panel["default"]),
|
|
65
|
+
standard: stylex.props(styles.styles.standard["default"], styles.styles.standard[placement]),
|
|
66
|
+
header: stylex.props(styles.styles.header["default"], onBack ? styles.styles.header.withBack : styles.styles.header.withTitle),
|
|
67
|
+
title: stylex.props(theme.$title.large, styles.styles.title["default"]),
|
|
68
|
+
content: stylex.props(styles.styles.content["default"]),
|
|
69
|
+
actions: stylex.props(styles.styles.actions["default"]),
|
|
70
|
+
actionsRow: stylex.props(styles.styles.actions.row)
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* @zh 头部栏:可选的返回按钮、标题和关闭按钮。
|
|
74
|
+
* 三者都不存在时不渲染头部,避免空置的占位空间。
|
|
75
|
+
* @en Header bar: optional back button, headline, and closer.
|
|
76
|
+
* Not rendered when all three are absent, avoiding empty placeholder space.
|
|
77
|
+
*/
|
|
78
|
+
var hasHeader = !!title || !!onBack || !!onConfirm || !!closer;
|
|
79
|
+
var header = hasHeader ? (/*#__PURE__*/React.createElement("div", {
|
|
80
|
+
className: className.stringify(classNames.header, styled.header.className),
|
|
81
|
+
style: styled.header.style
|
|
82
|
+
}, onBack && (/*#__PURE__*/React.createElement(iconButton.default, {
|
|
83
|
+
variant: "text",
|
|
84
|
+
onClick: onBack
|
|
85
|
+
}, /*#__PURE__*/React.createElement(arrowBack.default, null))), /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: className.stringify(classNames.title, styled.title.className),
|
|
87
|
+
style: styled.title.style
|
|
88
|
+
}, title), onConfirm && /*#__PURE__*/React.createElement(button.Button, {
|
|
89
|
+
onClick: onConfirm
|
|
90
|
+
}, locale.confirm), closer)) : null;
|
|
91
|
+
/**
|
|
92
|
+
* @zh 底部操作区:分割线 + 操作按钮行。
|
|
93
|
+
* @en Footer actions: a divider above the actions row.
|
|
94
|
+
*/
|
|
95
|
+
var footer = actions ? (/*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: className.stringify(classNames.actions, styled.actions.className),
|
|
97
|
+
style: styled.actions.style
|
|
98
|
+
}, /*#__PURE__*/React.createElement(divider.default, {
|
|
99
|
+
margin: 0
|
|
100
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: styled.actionsRow.className,
|
|
102
|
+
style: styled.actionsRow.style
|
|
103
|
+
}, actions))) : null;
|
|
104
|
+
/**
|
|
105
|
+
* @zh 标准类型:内嵌在布局中展示,无遮罩层,停靠边缘带分割线。
|
|
106
|
+
* @en Standard type: rendered inline in the layout, without a scrim,
|
|
107
|
+
* with a divider on the anchored edge.
|
|
108
|
+
*/
|
|
109
|
+
if (type === "standard") {
|
|
110
|
+
if (!open) return null;
|
|
111
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
className: className.stringify(classNames.sideSheet, className$1, styled.standard.className),
|
|
113
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, styled.standard.style), themeColorVars), {}, {
|
|
114
|
+
"--size": typeof size === "number" ? "".concat(size, "px") : size
|
|
115
|
+
}, style)
|
|
116
|
+
}, header, /*#__PURE__*/React.createElement("div", {
|
|
117
|
+
className: className.stringify(classNames.content, styled.content.className),
|
|
118
|
+
style: styled.content.style
|
|
119
|
+
}, children), footer);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @zh 模态类型:基于共享的 Sheet 基础组件,带遮罩层和滑入动画。
|
|
123
|
+
* @en Modal type: built on the shared Sheet base component, with a scrim
|
|
124
|
+
* and slide animation.
|
|
125
|
+
*/
|
|
126
|
+
return /*#__PURE__*/React.createElement(sheet.default, {
|
|
127
|
+
visible: open,
|
|
128
|
+
placement: placement,
|
|
129
|
+
size: size,
|
|
130
|
+
closable: closable,
|
|
131
|
+
onClose: onClose,
|
|
132
|
+
className: classNames.sideSheet,
|
|
133
|
+
header: header,
|
|
134
|
+
footer: footer,
|
|
135
|
+
panelClassName: styled.panel.className,
|
|
136
|
+
panelStyle: _objectSpread(_objectSpread({}, themeColorVars), styled.panel.style)
|
|
137
|
+
}, children);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
exports.default = SideSheet;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SideSheetProps } from "../../types/side-sheet";
|
|
3
|
+
/**
|
|
4
|
+
* @zh SideSheet 组件。Material Design 3 侧边栏:承载补充内容或操作的面板,
|
|
5
|
+
* 支持从屏幕四边(left/right/top/bottom)滑入。`modal` 类型基于共享的 Sheet
|
|
6
|
+
* 基础组件构建(遮罩层 + 滑入动画),mobile 下全屏展示;`standard` 类型内嵌
|
|
7
|
+
* 在布局中展示(无遮罩层,停靠边缘带分割线)。
|
|
8
|
+
* @en SideSheet component. A Material Design 3 side sheet: a surface for
|
|
9
|
+
* supplementary content or actions, sliding in from any screen edge
|
|
10
|
+
* (left/right/top/bottom). The `modal` type is built on the shared Sheet base
|
|
11
|
+
* component (scrim + slide animation) and goes fullscreen on mobile;
|
|
12
|
+
* the `standard` type renders inline in the layout (no scrim, with a divider
|
|
13
|
+
* on the anchored edge).
|
|
14
|
+
*/
|
|
15
|
+
declare const SideSheet: ({ open, type, title, onBack, onConfirm, closable, onClose, actions, size, placement, className, style, children, }: SideSheetProps) => React.JSX.Element | null;
|
|
16
|
+
export default SideSheet;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Sheet from '../sheet/sheet.mjs';
|
|
5
|
+
import Divider from '../divider/divider.mjs';
|
|
6
|
+
import { Button } from '../button/button.mjs';
|
|
7
|
+
import IconButton from '../icon-button/icon-button.mjs';
|
|
8
|
+
import { useClosable } from '../../hooks/use-closable.mjs';
|
|
9
|
+
import { useClassNames } from '../../hooks/use-class-names.mjs';
|
|
10
|
+
import { useThemeColorVars } from '../../hooks/use-theme-color-vars.mjs';
|
|
11
|
+
import { useLocale } from '../../locale/use-locale.mjs';
|
|
12
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
|
|
13
|
+
import { stringify } from '@aiszlab/relax/class-name';
|
|
14
|
+
import { $title } from '../theme/theme.mjs';
|
|
15
|
+
import { CLASS_NAMES } from './context.mjs';
|
|
16
|
+
import { styles } from './styles.mjs';
|
|
17
|
+
import IconArrowBack from '../icon/icons/navigation/arrow-back.mjs';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @zh SideSheet 组件。Material Design 3 侧边栏:承载补充内容或操作的面板,
|
|
21
|
+
* 支持从屏幕四边(left/right/top/bottom)滑入。`modal` 类型基于共享的 Sheet
|
|
22
|
+
* 基础组件构建(遮罩层 + 滑入动画),mobile 下全屏展示;`standard` 类型内嵌
|
|
23
|
+
* 在布局中展示(无遮罩层,停靠边缘带分割线)。
|
|
24
|
+
* @en SideSheet component. A Material Design 3 side sheet: a surface for
|
|
25
|
+
* supplementary content or actions, sliding in from any screen edge
|
|
26
|
+
* (left/right/top/bottom). The `modal` type is built on the shared Sheet base
|
|
27
|
+
* component (scrim + slide animation) and goes fullscreen on mobile;
|
|
28
|
+
* the `standard` type renders inline in the layout (no scrim, with a divider
|
|
29
|
+
* on the anchored edge).
|
|
30
|
+
*/
|
|
31
|
+
var SideSheet = function SideSheet(_ref) {
|
|
32
|
+
var open = _ref.open,
|
|
33
|
+
_ref$type = _ref.type,
|
|
34
|
+
type = _ref$type === void 0 ? "modal" : _ref$type,
|
|
35
|
+
title = _ref.title,
|
|
36
|
+
onBack = _ref.onBack,
|
|
37
|
+
onConfirm = _ref.onConfirm,
|
|
38
|
+
_ref$closable = _ref.closable,
|
|
39
|
+
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
40
|
+
onClose = _ref.onClose,
|
|
41
|
+
actions = _ref.actions,
|
|
42
|
+
_ref$size = _ref.size,
|
|
43
|
+
size = _ref$size === void 0 ? 400 : _ref$size,
|
|
44
|
+
_ref$placement = _ref.placement,
|
|
45
|
+
placement = _ref$placement === void 0 ? "right" : _ref$placement,
|
|
46
|
+
className = _ref.className,
|
|
47
|
+
style = _ref.style,
|
|
48
|
+
children = _ref.children;
|
|
49
|
+
var classNames = useClassNames(CLASS_NAMES);
|
|
50
|
+
var themeColorVars = useThemeColorVars(["surface", "surface-container-low", "on-surface-variant", "outline-variant"]);
|
|
51
|
+
var _useLocale = useLocale("drawer"),
|
|
52
|
+
_useLocale2 = _slicedToArray(_useLocale, 1),
|
|
53
|
+
locale = _useLocale2[0];
|
|
54
|
+
var _useClosable = useClosable({
|
|
55
|
+
closable: closable,
|
|
56
|
+
onClose: onClose
|
|
57
|
+
}),
|
|
58
|
+
closer = _useClosable.closer;
|
|
59
|
+
var styled = {
|
|
60
|
+
panel: props(styles.panel["default"]),
|
|
61
|
+
standard: props(styles.standard["default"], styles.standard[placement]),
|
|
62
|
+
header: props(styles.header["default"], onBack ? styles.header.withBack : styles.header.withTitle),
|
|
63
|
+
title: props($title.large, styles.title["default"]),
|
|
64
|
+
content: props(styles.content["default"]),
|
|
65
|
+
actions: props(styles.actions["default"]),
|
|
66
|
+
actionsRow: props(styles.actions.row)
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* @zh 头部栏:可选的返回按钮、标题和关闭按钮。
|
|
70
|
+
* 三者都不存在时不渲染头部,避免空置的占位空间。
|
|
71
|
+
* @en Header bar: optional back button, headline, and closer.
|
|
72
|
+
* Not rendered when all three are absent, avoiding empty placeholder space.
|
|
73
|
+
*/
|
|
74
|
+
var hasHeader = !!title || !!onBack || !!onConfirm || !!closer;
|
|
75
|
+
var header = hasHeader ? (/*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: stringify(classNames.header, styled.header.className),
|
|
77
|
+
style: styled.header.style
|
|
78
|
+
}, onBack && (/*#__PURE__*/React.createElement(IconButton, {
|
|
79
|
+
variant: "text",
|
|
80
|
+
onClick: onBack
|
|
81
|
+
}, /*#__PURE__*/React.createElement(IconArrowBack, null))), /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: stringify(classNames.title, styled.title.className),
|
|
83
|
+
style: styled.title.style
|
|
84
|
+
}, title), onConfirm && /*#__PURE__*/React.createElement(Button, {
|
|
85
|
+
onClick: onConfirm
|
|
86
|
+
}, locale.confirm), closer)) : null;
|
|
87
|
+
/**
|
|
88
|
+
* @zh 底部操作区:分割线 + 操作按钮行。
|
|
89
|
+
* @en Footer actions: a divider above the actions row.
|
|
90
|
+
*/
|
|
91
|
+
var footer = actions ? (/*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: stringify(classNames.actions, styled.actions.className),
|
|
93
|
+
style: styled.actions.style
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Divider, {
|
|
95
|
+
margin: 0
|
|
96
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: styled.actionsRow.className,
|
|
98
|
+
style: styled.actionsRow.style
|
|
99
|
+
}, actions))) : null;
|
|
100
|
+
/**
|
|
101
|
+
* @zh 标准类型:内嵌在布局中展示,无遮罩层,停靠边缘带分割线。
|
|
102
|
+
* @en Standard type: rendered inline in the layout, without a scrim,
|
|
103
|
+
* with a divider on the anchored edge.
|
|
104
|
+
*/
|
|
105
|
+
if (type === "standard") {
|
|
106
|
+
if (!open) return null;
|
|
107
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: stringify(classNames.sideSheet, className, styled.standard.className),
|
|
109
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, styled.standard.style), themeColorVars), {}, {
|
|
110
|
+
"--size": typeof size === "number" ? "".concat(size, "px") : size
|
|
111
|
+
}, style)
|
|
112
|
+
}, header, /*#__PURE__*/React.createElement("div", {
|
|
113
|
+
className: stringify(classNames.content, styled.content.className),
|
|
114
|
+
style: styled.content.style
|
|
115
|
+
}, children), footer);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @zh 模态类型:基于共享的 Sheet 基础组件,带遮罩层和滑入动画。
|
|
119
|
+
* @en Modal type: built on the shared Sheet base component, with a scrim
|
|
120
|
+
* and slide animation.
|
|
121
|
+
*/
|
|
122
|
+
return /*#__PURE__*/React.createElement(Sheet, {
|
|
123
|
+
visible: open,
|
|
124
|
+
placement: placement,
|
|
125
|
+
size: size,
|
|
126
|
+
closable: closable,
|
|
127
|
+
onClose: onClose,
|
|
128
|
+
className: classNames.sideSheet,
|
|
129
|
+
header: header,
|
|
130
|
+
footer: footer,
|
|
131
|
+
panelClassName: styled.panel.className,
|
|
132
|
+
panelStyle: _objectSpread(_objectSpread({}, themeColorVars), styled.panel.style)
|
|
133
|
+
}, children);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export { SideSheet as default };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var panel = {
|
|
4
|
+
"default": {
|
|
5
|
+
kWkggS: "musaex-1eai1fy",
|
|
6
|
+
kGO01o: "musaex-1oxn6w8",
|
|
7
|
+
$$css: true
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var standard = {
|
|
11
|
+
"default": {
|
|
12
|
+
k1xSpc: "musaex-78zum5",
|
|
13
|
+
kXwgrk: "musaex-dt5ytf",
|
|
14
|
+
kzqmXN: "musaex-1fjlwjz",
|
|
15
|
+
kZKoxP: "musaex-qg7gut",
|
|
16
|
+
kmuXW: "musaex-2lah0s",
|
|
17
|
+
kWkggS: "musaex-k7eln3",
|
|
18
|
+
kGO01o: "musaex-1oxn6w8",
|
|
19
|
+
$$css: true
|
|
20
|
+
},
|
|
21
|
+
right: {
|
|
22
|
+
kZ1KPB: "musaex-6vwjc",
|
|
23
|
+
k4WBpm: "musaex-19ypqd9",
|
|
24
|
+
kaZRDh: "musaex-svd4c5",
|
|
25
|
+
$$css: true
|
|
26
|
+
},
|
|
27
|
+
left: {
|
|
28
|
+
kWqL5O: "musaex-a640vs",
|
|
29
|
+
kSWEuD: "musaex-32b0ac",
|
|
30
|
+
k26BEO: "musaex-imfbgf",
|
|
31
|
+
$$css: true
|
|
32
|
+
},
|
|
33
|
+
top: {
|
|
34
|
+
kt9PQ7: "musaex-d1xpcx",
|
|
35
|
+
kfdmCh: "musaex-1q0q8m5",
|
|
36
|
+
kL6WhQ: "musaex-quqrak",
|
|
37
|
+
$$css: true
|
|
38
|
+
},
|
|
39
|
+
bottom: {
|
|
40
|
+
kEafiO: "musaex-uvson1",
|
|
41
|
+
kPef9Z: "musaex-13fuv20",
|
|
42
|
+
kLZC3w: "musaex-6ogecl",
|
|
43
|
+
$$css: true
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var header = {
|
|
47
|
+
"default": {
|
|
48
|
+
k1xSpc: "musaex-78zum5",
|
|
49
|
+
kGNEyG: "musaex-1cy8zhl",
|
|
50
|
+
kLKAdn: "musaex-h1u3e4",
|
|
51
|
+
kGO01o: "musaex-5ynjmo",
|
|
52
|
+
kwRFfy: "musaex-1max5gj",
|
|
53
|
+
$$css: true
|
|
54
|
+
},
|
|
55
|
+
withTitle: {
|
|
56
|
+
kZCmMZ: "musaex-150i2hq",
|
|
57
|
+
$$css: true
|
|
58
|
+
},
|
|
59
|
+
withBack: {
|
|
60
|
+
kZCmMZ: "musaex-1rl4tsp",
|
|
61
|
+
$$css: true
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var content = {
|
|
65
|
+
"default": {
|
|
66
|
+
kUk6DE: "musaex-98rzlu",
|
|
67
|
+
kAzted: "musaex-2lwn1j",
|
|
68
|
+
kVQacm: "musaex-ysyzu8",
|
|
69
|
+
kZeWKH: "musaex-ish69e",
|
|
70
|
+
$$css: true
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var title = {
|
|
74
|
+
"default": {
|
|
75
|
+
kUk6DE: "musaex-98rzlu",
|
|
76
|
+
k7Eaqz: "musaex-euugli",
|
|
77
|
+
kLKAdn: "musaex-h1u3e4",
|
|
78
|
+
kMwMTN: "musaex-bq1wot",
|
|
79
|
+
$$css: true
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var actions = {
|
|
83
|
+
"default": {
|
|
84
|
+
k1xSpc: "musaex-78zum5",
|
|
85
|
+
kXwgrk: "musaex-dt5ytf",
|
|
86
|
+
$$css: true
|
|
87
|
+
},
|
|
88
|
+
row: {
|
|
89
|
+
k1xSpc: "musaex-78zum5",
|
|
90
|
+
kGNEyG: "musaex-6s0dn4",
|
|
91
|
+
kOIVth: "musaex-1wm2zkp",
|
|
92
|
+
kLKAdn: "musaex-1oop6c3",
|
|
93
|
+
kg3NbH: "musaex-1pyhihf",
|
|
94
|
+
$$css: true
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var styles = {
|
|
98
|
+
panel: panel,
|
|
99
|
+
standard: standard,
|
|
100
|
+
header: header,
|
|
101
|
+
title: title,
|
|
102
|
+
content: content,
|
|
103
|
+
actions: actions
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
exports.styles = styles;
|