musae 0.2.14 → 0.2.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/dist/components/avatar/group.d.ts +1 -1
- package/dist/components/avatar/group.js +10 -8
- package/dist/components/bench/bench.d.ts +4 -0
- package/dist/components/bench/bench.js +150 -0
- package/dist/components/bench/hooks.d.ts +22 -0
- package/dist/components/bench/hooks.js +111 -0
- package/dist/components/bench/index.d.ts +4 -0
- package/dist/components/bench/types.d.ts +78 -0
- package/dist/components/dialog/dialog.js +1 -1
- package/dist/components/dialog/popup.js +2 -2
- package/dist/components/dialog/types.d.ts +5 -0
- package/dist/components/divider/divider.d.ts +1 -1
- package/dist/components/divider/divider.js +4 -4
- package/dist/components/drawer/drawer.js +1 -1
- package/dist/components/highlight/highlight.d.ts +2 -2
- package/dist/components/highlight/highlight.js +54 -0
- package/dist/components/highlight/types.d.ts +5 -0
- package/dist/components/layout/header.js +2 -2
- package/dist/components/layout/sider.d.ts +2 -2
- package/dist/components/layout/sider.js +7 -9
- package/dist/components/menu/context.js +0 -1
- package/dist/components/menu/hooks.d.ts +2 -3
- package/dist/components/menu/hooks.js +2 -4
- package/dist/components/menu/item.js +91 -109
- package/dist/components/menu/menu.js +0 -3
- package/dist/components/menu/types.d.ts +0 -8
- package/dist/hooks/use-class-names.d.ts +4 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/stylex.css +13 -2
- package/dist/utils/class-name.d.ts +14 -1
- package/dist/utils/class-name.js +8 -2
- package/package.json +7 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type AvatarGroupProps } from "./types";
|
|
3
|
-
declare const Group: ({ children: _children, shape, size, max }: AvatarGroupProps) => React.JSX.Element;
|
|
3
|
+
declare const Group: ({ children: _children, shape, size, max, }: AvatarGroupProps) => React.JSX.Element;
|
|
4
4
|
export default Group;
|
|
@@ -5,6 +5,7 @@ import { useClassNames } from '../../hooks/use-class-names.js';
|
|
|
5
5
|
import { ComponentToken, AvatarClassToken } from '../../utils/class-name.js';
|
|
6
6
|
import Popover from '../popover/popover.js';
|
|
7
7
|
import Avatar from './avatar.js';
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
|
|
9
10
|
var _Group = function Group(_ref) {
|
|
10
11
|
var _children = _ref.children,
|
|
@@ -14,13 +15,12 @@ var _Group = function Group(_ref) {
|
|
|
14
15
|
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
15
16
|
_ref$max = _ref.max,
|
|
16
17
|
max = _ref$max === void 0 ? 3 : _ref$max;
|
|
18
|
+
var classNames = useClassNames(ComponentToken.Avatar);
|
|
17
19
|
var styled = {
|
|
18
20
|
className: "musae-3nfvp2 musae-87ps6o"
|
|
19
21
|
};
|
|
20
|
-
var classNames = useClassNames(ComponentToken.Avatar);
|
|
21
22
|
var children = useMemo(function () {
|
|
22
|
-
var
|
|
23
|
-
var _children$reduce = __children.reduce(function (prev, child, index) {
|
|
23
|
+
var _Children$toArray$red = Children.toArray(_children).reduce(function (prev, child, index) {
|
|
24
24
|
// @ts-ignore
|
|
25
25
|
var element = /*#__PURE__*/cloneElement(child, {
|
|
26
26
|
key: "avatars-".concat(index)
|
|
@@ -33,13 +33,15 @@ var _Group = function Group(_ref) {
|
|
|
33
33
|
}
|
|
34
34
|
return prev;
|
|
35
35
|
}, [[], []]),
|
|
36
|
-
|
|
37
|
-
visible =
|
|
38
|
-
hidden =
|
|
36
|
+
_Children$toArray$red2 = _slicedToArray(_Children$toArray$red, 2),
|
|
37
|
+
visible = _Children$toArray$red2[0],
|
|
38
|
+
hidden = _Children$toArray$red2[1];
|
|
39
39
|
// got hidden nodes, show ellipse node
|
|
40
40
|
if (hidden.length > 0) {
|
|
41
41
|
visible.push( /*#__PURE__*/React.createElement(Popover, {
|
|
42
|
-
description: /*#__PURE__*/React.createElement(_Group,
|
|
42
|
+
description: /*#__PURE__*/React.createElement(_Group, {
|
|
43
|
+
max: Infinity
|
|
44
|
+
}, hidden),
|
|
43
45
|
key: "avatars-hidden",
|
|
44
46
|
placement: "top"
|
|
45
47
|
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
@@ -54,7 +56,7 @@ var _Group = function Group(_ref) {
|
|
|
54
56
|
size: size
|
|
55
57
|
}
|
|
56
58
|
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
-
className: (classNames[AvatarClassToken.Group], styled.className),
|
|
59
|
+
className: clsx(classNames[AvatarClassToken.Group], styled.className),
|
|
58
60
|
style: styled.style
|
|
59
61
|
}, children));
|
|
60
62
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BenchProps } from "./types";
|
|
3
|
+
declare const Bench: ({ children, title, logo, navigations, className, style, trailing, onNavigate, location, defaultExpandedKeys, classNames: { main: mainClassName }, }: BenchProps) => React.JSX.Element;
|
|
4
|
+
export default Bench;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Layout } from '../layout/index.js';
|
|
4
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
|
+
import Divider from '../divider/divider.js';
|
|
6
|
+
import { useLogo, useNavigations } from './hooks.js';
|
|
7
|
+
import Menu from '../menu/menu.js';
|
|
8
|
+
import { useTheme } from '../theme/hooks.js';
|
|
9
|
+
import { ColorToken } from '../../utils/colors.js';
|
|
10
|
+
import { typography } from '../theme/theme.js';
|
|
11
|
+
import clsx from 'clsx';
|
|
12
|
+
|
|
13
|
+
var Header = Layout.Header,
|
|
14
|
+
Main = Layout.Main,
|
|
15
|
+
Sider = Layout.Sider;
|
|
16
|
+
var styles = {
|
|
17
|
+
bench: {
|
|
18
|
+
"default": {
|
|
19
|
+
$$css: true
|
|
20
|
+
},
|
|
21
|
+
sider: function sider(props) {
|
|
22
|
+
return [{
|
|
23
|
+
borderRightWidth: "musae-1xkobc8",
|
|
24
|
+
borderInlineStartWidth: null,
|
|
25
|
+
borderInlineEndWidth: null,
|
|
26
|
+
borderRightStyle: "musae-32b0ac",
|
|
27
|
+
borderInlineStartStyle: null,
|
|
28
|
+
borderInlineEndStyle: null,
|
|
29
|
+
borderRightColor: "musae-104k1kx",
|
|
30
|
+
borderInlineStartColor: null,
|
|
31
|
+
borderInlineEndColor: null,
|
|
32
|
+
paddingInline: "musae-gj1dgu",
|
|
33
|
+
paddingStart: null,
|
|
34
|
+
paddingLeft: null,
|
|
35
|
+
paddingEnd: null,
|
|
36
|
+
paddingRight: null,
|
|
37
|
+
position: "musae-7wzq59",
|
|
38
|
+
height: "musae-1r05exa",
|
|
39
|
+
top: "musae-kwake1",
|
|
40
|
+
overflowY: "musae-10wlt62 musae-r8ctv5",
|
|
41
|
+
$$css: true
|
|
42
|
+
}, {
|
|
43
|
+
"--borderRightColor": props.outlineColor != null ? props.outlineColor : "initial"
|
|
44
|
+
}];
|
|
45
|
+
},
|
|
46
|
+
main: {
|
|
47
|
+
$$css: true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
header: {
|
|
51
|
+
"default": {
|
|
52
|
+
gap: "musae-vbka3v",
|
|
53
|
+
rowGap: null,
|
|
54
|
+
columnGap: null,
|
|
55
|
+
boxShadow: "musae-ezd0au",
|
|
56
|
+
$$css: true
|
|
57
|
+
},
|
|
58
|
+
navigation: {
|
|
59
|
+
marginLeft: "musae-19i9eir",
|
|
60
|
+
marginInlineStart: null,
|
|
61
|
+
marginInlineEnd: null,
|
|
62
|
+
marginRight: "musae-ack27t",
|
|
63
|
+
height: "musae-b27hse",
|
|
64
|
+
$$css: true
|
|
65
|
+
},
|
|
66
|
+
divider: {
|
|
67
|
+
height: "musae-lry4nc",
|
|
68
|
+
$$css: true
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var Bench = function Bench(_ref) {
|
|
73
|
+
var children = _ref.children,
|
|
74
|
+
title = _ref.title,
|
|
75
|
+
logo = _ref.logo,
|
|
76
|
+
_ref$navigations = _ref.navigations,
|
|
77
|
+
navigations = _ref$navigations === void 0 ? [] : _ref$navigations,
|
|
78
|
+
className = _ref.className,
|
|
79
|
+
style = _ref.style,
|
|
80
|
+
trailing = _ref.trailing,
|
|
81
|
+
onNavigate = _ref.onNavigate,
|
|
82
|
+
location = _ref.location,
|
|
83
|
+
defaultExpandedKeys = _ref.defaultExpandedKeys,
|
|
84
|
+
_ref$classNames = _ref.classNames,
|
|
85
|
+
_ref$classNames2 = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
86
|
+
mainClassName = _ref$classNames2.main;
|
|
87
|
+
var theme = useTheme();
|
|
88
|
+
var _logo = useLogo(logo);
|
|
89
|
+
var _useNavigations = useNavigations({
|
|
90
|
+
navigations: navigations,
|
|
91
|
+
onNavigate: onNavigate,
|
|
92
|
+
location: location
|
|
93
|
+
}),
|
|
94
|
+
navigate = _useNavigations.navigate,
|
|
95
|
+
topMenuItems = _useNavigations.topMenuItems,
|
|
96
|
+
sideMenuItems = _useNavigations.sideMenuItems,
|
|
97
|
+
selectedKeys = _useNavigations.selectedKeys;
|
|
98
|
+
var styled = {
|
|
99
|
+
bench: _stylex.props(styles.bench["default"]),
|
|
100
|
+
header: _stylex.props(styles.header["default"]),
|
|
101
|
+
main: _stylex.props(styles.bench.main),
|
|
102
|
+
sider: _stylex.props(styles.bench.sider({
|
|
103
|
+
outlineColor: theme.colors[ColorToken.OutlineVariant]
|
|
104
|
+
})),
|
|
105
|
+
title: _stylex.props(typography.title.large),
|
|
106
|
+
divider: _stylex.props(styles.header.divider),
|
|
107
|
+
headerNavigation: _stylex.props(styles.header.navigation)
|
|
108
|
+
};
|
|
109
|
+
return /*#__PURE__*/React.createElement(Layout, {
|
|
110
|
+
className: clsx(styled.bench.className, className),
|
|
111
|
+
style: _objectSpread(_objectSpread({}, styled.bench.style), style)
|
|
112
|
+
}, /*#__PURE__*/React.createElement(Header, {
|
|
113
|
+
className: styled.header.className,
|
|
114
|
+
style: styled.header.style
|
|
115
|
+
}, !!_logo && /*#__PURE__*/React.createElement("img", {
|
|
116
|
+
src: _logo === null || _logo === void 0 ? void 0 : _logo.url,
|
|
117
|
+
alt: "logo"
|
|
118
|
+
}), !!_logo && ( /*#__PURE__*/React.createElement("div", {
|
|
119
|
+
className: styled.divider.className,
|
|
120
|
+
style: styled.divider.style
|
|
121
|
+
}, /*#__PURE__*/React.createElement(Divider, {
|
|
122
|
+
type: "vertical"
|
|
123
|
+
}))), /*#__PURE__*/React.createElement("span", {
|
|
124
|
+
className: styled.title.className,
|
|
125
|
+
style: styled.title.style
|
|
126
|
+
}, title), /*#__PURE__*/React.createElement(Menu, _objectSpread({
|
|
127
|
+
items: topMenuItems,
|
|
128
|
+
onClick: navigate,
|
|
129
|
+
mode: "horizontal",
|
|
130
|
+
className: styled.headerNavigation.className,
|
|
131
|
+
style: styled.headerNavigation.style
|
|
132
|
+
}, !!selectedKeys[0] && {
|
|
133
|
+
selectedKeys: [selectedKeys[0]]
|
|
134
|
+
})), trailing), sideMenuItems.length > 0 && ( /*#__PURE__*/React.createElement(Sider, {
|
|
135
|
+
className: styled.sider.className,
|
|
136
|
+
style: styled.sider.style
|
|
137
|
+
}, /*#__PURE__*/React.createElement(Menu, _objectSpread({
|
|
138
|
+
items: sideMenuItems,
|
|
139
|
+
onClick: navigate,
|
|
140
|
+
defaultExpandedKeys: defaultExpandedKeys
|
|
141
|
+
}, !!selectedKeys[1] && {
|
|
142
|
+
selectedKeys: [selectedKeys[1]]
|
|
143
|
+
})))), /*#__PURE__*/React.createElement(Main, {
|
|
144
|
+
className: clsx(mainClassName, styled.main.className),
|
|
145
|
+
style: styled.main.style
|
|
146
|
+
}, children));
|
|
147
|
+
};
|
|
148
|
+
var Bench$1 = Bench;
|
|
149
|
+
|
|
150
|
+
export { Bench$1 as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Key } from "react";
|
|
2
|
+
import type { BenchProps, Logo, NavigationItem } from "./types";
|
|
3
|
+
import { MenuItem } from "../menu";
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* logo
|
|
7
|
+
*/
|
|
8
|
+
export declare const useLogo: (logo?: string | Logo) => Logo | null;
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* menu
|
|
12
|
+
*/
|
|
13
|
+
export declare const useNavigations: ({ navigations, onNavigate, location, }: {
|
|
14
|
+
navigations: NavigationItem[];
|
|
15
|
+
onNavigate: BenchProps["onNavigate"];
|
|
16
|
+
location?: string;
|
|
17
|
+
}) => {
|
|
18
|
+
selectedKeys: [(Key | undefined)?, (Key | undefined)?];
|
|
19
|
+
topMenuItems: MenuItem[];
|
|
20
|
+
sideMenuItems: MenuItem[];
|
|
21
|
+
navigate: (path: Key) => void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { useEvent, isUndefined } from '@aiszlab/relax';
|
|
7
|
+
|
|
8
|
+
var _excluded = ["path", "children"],
|
|
9
|
+
_excluded2 = ["children"];
|
|
10
|
+
/**
|
|
11
|
+
* @description
|
|
12
|
+
* logo
|
|
13
|
+
*/
|
|
14
|
+
var useLogo = function useLogo(logo) {
|
|
15
|
+
return useMemo(function () {
|
|
16
|
+
if (!logo) return null;
|
|
17
|
+
if (typeof logo === "string") {
|
|
18
|
+
return {
|
|
19
|
+
url: logo
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return logo;
|
|
23
|
+
}, [logo]);
|
|
24
|
+
};
|
|
25
|
+
var _toMenuItem3 = function toMenuItem(_ref, parentKeys, paths) {
|
|
26
|
+
var path = _ref.path,
|
|
27
|
+
children = _ref.children,
|
|
28
|
+
item = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
+
// convert children
|
|
30
|
+
var _reduce = (children !== null && children !== void 0 ? children : []).reduce(function (_ref2, child) {
|
|
31
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
32
|
+
_menuItems = _ref3[0],
|
|
33
|
+
_paths = _ref3[1];
|
|
34
|
+
var _toMenuItem = _toMenuItem3(child, [].concat(_toConsumableArray(parentKeys), [path]), _paths),
|
|
35
|
+
_toMenuItem2 = _slicedToArray(_toMenuItem, 2),
|
|
36
|
+
menuItem = _toMenuItem2[0],
|
|
37
|
+
paths = _toMenuItem2[1];
|
|
38
|
+
_menuItems.push(menuItem);
|
|
39
|
+
return [_menuItems, paths];
|
|
40
|
+
}, [[], new Map(paths.set(path, parentKeys))]),
|
|
41
|
+
_reduce2 = _slicedToArray(_reduce, 2),
|
|
42
|
+
_menuItems = _reduce2[0],
|
|
43
|
+
_paths = _reduce2[1];
|
|
44
|
+
// return with paths
|
|
45
|
+
return [_objectSpread({
|
|
46
|
+
key: path,
|
|
47
|
+
children: _menuItems
|
|
48
|
+
}, item), _paths];
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* @description
|
|
52
|
+
* menu
|
|
53
|
+
*/
|
|
54
|
+
var useNavigations = function useNavigations(_ref4) {
|
|
55
|
+
var navigations = _ref4.navigations,
|
|
56
|
+
onNavigate = _ref4.onNavigate,
|
|
57
|
+
location = _ref4.location;
|
|
58
|
+
// menu click handler => jump link
|
|
59
|
+
var navigate = useEvent(function (path) {
|
|
60
|
+
if (onNavigate) {
|
|
61
|
+
onNavigate(path.toString());
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
window.open(path.toString(), "_self");
|
|
65
|
+
});
|
|
66
|
+
// convert navigations into diff menus
|
|
67
|
+
var _useMemo = useMemo(function () {
|
|
68
|
+
return navigations.reduce(function (_ref5, item) {
|
|
69
|
+
var _ref6 = _slicedToArray(_ref5, 3),
|
|
70
|
+
topMenuItems = _ref6[0],
|
|
71
|
+
sideNavigations = _ref6[1],
|
|
72
|
+
paths = _ref6[2];
|
|
73
|
+
var _toMenuItem4 = _toMenuItem3(item, [], paths),
|
|
74
|
+
_toMenuItem5 = _slicedToArray(_toMenuItem4, 2),
|
|
75
|
+
_toMenuItem5$ = _toMenuItem5[0],
|
|
76
|
+
children = _toMenuItem5$.children,
|
|
77
|
+
_menuItem = _objectWithoutProperties(_toMenuItem5$, _excluded2),
|
|
78
|
+
_paths = _toMenuItem5[1];
|
|
79
|
+
topMenuItems.set(item.path, _menuItem);
|
|
80
|
+
sideNavigations.set(item.path, children);
|
|
81
|
+
return [topMenuItems, sideNavigations, _paths];
|
|
82
|
+
}, [new Map(), new Map(), new Map()]);
|
|
83
|
+
}, [navigations]),
|
|
84
|
+
_useMemo2 = _slicedToArray(_useMemo, 3),
|
|
85
|
+
topMenuItems = _useMemo2[0],
|
|
86
|
+
sideNavigations = _useMemo2[1],
|
|
87
|
+
paths = _useMemo2[2];
|
|
88
|
+
// menu selected keys
|
|
89
|
+
var selectedKeys = useMemo(function () {
|
|
90
|
+
var _paths$get$at, _paths$get;
|
|
91
|
+
if (isUndefined(location)) return [];
|
|
92
|
+
return [(_paths$get$at = (_paths$get = paths.get(location)) === null || _paths$get === void 0 ? void 0 : _paths$get.at(0)) !== null && _paths$get$at !== void 0 ? _paths$get$at : location, location];
|
|
93
|
+
}, [location, paths]);
|
|
94
|
+
var sideMenuItems = useMemo(function () {
|
|
95
|
+
var _sideNavigations$get;
|
|
96
|
+
if (!selectedKeys[0]) {
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
return (_sideNavigations$get = sideNavigations.get(selectedKeys[0])) !== null && _sideNavigations$get !== void 0 ? _sideNavigations$get : [];
|
|
100
|
+
}, [sideNavigations, selectedKeys]);
|
|
101
|
+
return {
|
|
102
|
+
selectedKeys: selectedKeys,
|
|
103
|
+
topMenuItems: useMemo(function () {
|
|
104
|
+
return Array.from(topMenuItems.values());
|
|
105
|
+
}, [topMenuItems]),
|
|
106
|
+
sideMenuItems: sideMenuItems,
|
|
107
|
+
navigate: navigate
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export { useLogo, useNavigations };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Key, ReactNode } from "react";
|
|
2
|
+
import { ComponentProps } from "../../types/element";
|
|
3
|
+
export type Logo = {
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* url
|
|
7
|
+
*/
|
|
8
|
+
url: string;
|
|
9
|
+
};
|
|
10
|
+
export type NavigationItem = {
|
|
11
|
+
/**
|
|
12
|
+
* @description
|
|
13
|
+
* path
|
|
14
|
+
*/
|
|
15
|
+
path: string;
|
|
16
|
+
/**
|
|
17
|
+
* @description
|
|
18
|
+
* label
|
|
19
|
+
* @default void 0
|
|
20
|
+
*/
|
|
21
|
+
label: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* @description
|
|
24
|
+
* children
|
|
25
|
+
*/
|
|
26
|
+
children?: NavigationItem[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @description
|
|
30
|
+
* workbench props
|
|
31
|
+
*/
|
|
32
|
+
export type BenchProps = ComponentProps & {
|
|
33
|
+
/**
|
|
34
|
+
* @description
|
|
35
|
+
* logo
|
|
36
|
+
*/
|
|
37
|
+
logo?: string | Logo;
|
|
38
|
+
/**
|
|
39
|
+
* @description
|
|
40
|
+
* title
|
|
41
|
+
*/
|
|
42
|
+
title?: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* @description
|
|
45
|
+
* children
|
|
46
|
+
*/
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* @description
|
|
50
|
+
* navigations
|
|
51
|
+
*/
|
|
52
|
+
navigations?: NavigationItem[];
|
|
53
|
+
/**
|
|
54
|
+
* @description
|
|
55
|
+
* trailing
|
|
56
|
+
*/
|
|
57
|
+
trailing?: ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* @description
|
|
60
|
+
* navigate handler
|
|
61
|
+
*/
|
|
62
|
+
onNavigate?: (path: string) => void;
|
|
63
|
+
/**
|
|
64
|
+
* @description
|
|
65
|
+
* location
|
|
66
|
+
*/
|
|
67
|
+
location?: string;
|
|
68
|
+
/**
|
|
69
|
+
* @description
|
|
70
|
+
* default expanded keys
|
|
71
|
+
*/
|
|
72
|
+
defaultExpandedKeys?: Key[];
|
|
73
|
+
/**
|
|
74
|
+
* @description
|
|
75
|
+
* class names
|
|
76
|
+
*/
|
|
77
|
+
classNames?: Partial<Record<"main", string>>;
|
|
78
|
+
};
|
|
@@ -12,7 +12,7 @@ var Dialog = function Dialog(_ref) {
|
|
|
12
12
|
_ref$closable = _ref.closable,
|
|
13
13
|
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
14
14
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
-
/// `Portal` should disappear after `Dialog` disappear completely
|
|
15
|
+
/// `Portal` should disappear after `Dialog` disappear animation completely
|
|
16
16
|
var _useBoolean = useBoolean(false),
|
|
17
17
|
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
18
18
|
_isVisible = _useBoolean2[0],
|
|
@@ -114,7 +114,7 @@ var Popup = function Popup(_ref) {
|
|
|
114
114
|
var theme = useTheme();
|
|
115
115
|
var panelRef = useRef(null);
|
|
116
116
|
var overlayRef = useRef(null);
|
|
117
|
-
|
|
117
|
+
// children render hooks
|
|
118
118
|
var footer = useFooter([props$1.footer, props$1.onConfirm, onClose]);
|
|
119
119
|
var _useClosable = useClosable({
|
|
120
120
|
closable: closable,
|
|
@@ -159,7 +159,7 @@ var Popup = function Popup(_ref) {
|
|
|
159
159
|
}))();
|
|
160
160
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
161
161
|
}, [open]);
|
|
162
|
-
|
|
162
|
+
// when open, try focus dialog
|
|
163
163
|
useEffect(function () {
|
|
164
164
|
if (!open) return;
|
|
165
165
|
if (contains(scope.current, document.activeElement)) return;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import type { Closable } from "../../hooks/use-closable";
|
|
3
3
|
import { RequiredIn } from "@aiszlab/relax/types";
|
|
4
|
+
import { PortalProps } from "../portal/types";
|
|
4
5
|
/**
|
|
5
6
|
* @description
|
|
6
7
|
* dialog props
|
|
@@ -62,6 +63,10 @@ export interface DialogProps {
|
|
|
62
63
|
* @default void 0
|
|
63
64
|
*/
|
|
64
65
|
onClose?: VoidFunction;
|
|
66
|
+
/**
|
|
67
|
+
* @link {PortalProps.container}
|
|
68
|
+
*/
|
|
69
|
+
container?: PortalProps["container"];
|
|
65
70
|
}
|
|
66
71
|
/**
|
|
67
72
|
* @description
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type DividerProps } from "./types";
|
|
2
2
|
import React from "react";
|
|
3
|
-
declare const Divider: ({ align, children, type, className, style }: DividerProps) => React.JSX.Element;
|
|
3
|
+
declare const Divider: ({ align, children, type, className, style, }: DividerProps) => React.JSX.Element;
|
|
4
4
|
export default Divider;
|
|
@@ -32,7 +32,7 @@ var styles = {
|
|
|
32
32
|
},
|
|
33
33
|
vertical: function vertical(props) {
|
|
34
34
|
return [{
|
|
35
|
-
|
|
35
|
+
width: "musae-131wp52",
|
|
36
36
|
backgroundColor: "musae-q1mx2j",
|
|
37
37
|
$$css: true
|
|
38
38
|
}, {
|
|
@@ -132,13 +132,13 @@ var Divider = function Divider(_ref) {
|
|
|
132
132
|
backgroundColor: theme.colors[ColorToken.OutlineVariant],
|
|
133
133
|
offset: offset
|
|
134
134
|
})),
|
|
135
|
-
label: props(
|
|
135
|
+
label: props(styles.label[type], typography.body.small)
|
|
136
136
|
};
|
|
137
137
|
return /*#__PURE__*/React.createElement("div", {
|
|
138
|
-
className: clsx(
|
|
138
|
+
className: clsx(classNames[DividerClassToken.Divider], className, styled.divider.className),
|
|
139
139
|
style: _objectSpread(_objectSpread({}, styled.divider.style), style)
|
|
140
140
|
}, !!children && ( /*#__PURE__*/React.createElement("span", {
|
|
141
|
-
className: clsx(
|
|
141
|
+
className: clsx(classNames[DividerClassToken.Label], styled.label.className),
|
|
142
142
|
style: styled.label.style
|
|
143
143
|
}, children)));
|
|
144
144
|
};
|
|
@@ -16,7 +16,7 @@ var Drawer = function Drawer(_ref) {
|
|
|
16
16
|
_ref$placement = _ref.placement,
|
|
17
17
|
placement = _ref$placement === void 0 ? "right" : _ref$placement,
|
|
18
18
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
-
/// `Portal` should disappear after `
|
|
19
|
+
/// `Portal` should disappear after `Drawer` disappear animation completely
|
|
20
20
|
var _useBoolean = useBoolean(false),
|
|
21
21
|
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
22
22
|
_isVisible = _useBoolean2[0],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { HighlightProps } from "./types";
|
|
3
|
-
declare const
|
|
4
|
-
export default
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ children, capture }: HighlightProps) => React.JSX.Element>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import React, { memo, useMemo } from 'react';
|
|
3
|
+
import { useClassNames } from '../../hooks/use-class-names.js';
|
|
4
|
+
import { ComponentToken, HighlightClassToken } from '../../utils/class-name.js';
|
|
5
|
+
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
6
|
+
import { useTheme } from '../theme/hooks.js';
|
|
7
|
+
import { ColorToken } from '../../utils/colors.js';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
|
|
10
|
+
var styles = {
|
|
11
|
+
capture: function capture(props) {
|
|
12
|
+
return [{
|
|
13
|
+
color: "musae-19dipnz",
|
|
14
|
+
$$css: true
|
|
15
|
+
}, {
|
|
16
|
+
"--color": props.color != null ? props.color : "initial"
|
|
17
|
+
}];
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var Highlight = function Highlight(_ref) {
|
|
21
|
+
var children = _ref.children,
|
|
22
|
+
capture = _ref.capture;
|
|
23
|
+
var classNames = useClassNames(ComponentToken.Highlight);
|
|
24
|
+
var theme = useTheme();
|
|
25
|
+
var _children = useMemo(function () {
|
|
26
|
+
if (!capture) return [children];
|
|
27
|
+
var styled = _stylex.props(styles.capture({
|
|
28
|
+
color: theme.colors[ColorToken.Primary]
|
|
29
|
+
}));
|
|
30
|
+
// 1. use regex match
|
|
31
|
+
// 2. replace with custom node
|
|
32
|
+
var _Array$from$reduce = Array.from(children.matchAll(new RegExp(capture, "g"))).reduce(function (prev, item) {
|
|
33
|
+
prev[0].push(children.slice(prev[1], item.index));
|
|
34
|
+
prev[0].push( /*#__PURE__*/React.createElement("span", {
|
|
35
|
+
className: clsx(classNames[HighlightClassToken.Capture], styled.className),
|
|
36
|
+
style: styled.style,
|
|
37
|
+
key: item.index
|
|
38
|
+
}, item[0]));
|
|
39
|
+
prev[1] = item.index + item[0].length;
|
|
40
|
+
return prev;
|
|
41
|
+
}, [[], 0]),
|
|
42
|
+
_Array$from$reduce2 = _slicedToArray(_Array$from$reduce, 2),
|
|
43
|
+
_children = _Array$from$reduce2[0],
|
|
44
|
+
end = _Array$from$reduce2[1];
|
|
45
|
+
_children.push(children.slice(end));
|
|
46
|
+
return _children;
|
|
47
|
+
}, [capture, children, theme, classNames]);
|
|
48
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
49
|
+
className: classNames[HighlightClassToken.Highlight]
|
|
50
|
+
}, _children);
|
|
51
|
+
};
|
|
52
|
+
var highlight = /*#__PURE__*/memo(Highlight);
|
|
53
|
+
|
|
54
|
+
export { highlight as default };
|
|
@@ -8,6 +8,8 @@ import clsx from 'clsx';
|
|
|
8
8
|
var styles = {
|
|
9
9
|
header: function header(props) {
|
|
10
10
|
return [{
|
|
11
|
+
display: "musae-78zum5",
|
|
12
|
+
alignItems: "musae-6s0dn4",
|
|
11
13
|
height: "musae-b4kbli",
|
|
12
14
|
paddingInline: "musae-1mmg125",
|
|
13
15
|
paddingStart: null,
|
|
@@ -18,8 +20,6 @@ var styles = {
|
|
|
18
20
|
position: "musae-7wzq59",
|
|
19
21
|
top: "musae-13vifvy",
|
|
20
22
|
zIndex: "musae-1ac462h",
|
|
21
|
-
display: "musae-78zum5",
|
|
22
|
-
alignItems: "musae-6s0dn4",
|
|
23
23
|
backgroundColor: "musae-q1mx2j",
|
|
24
24
|
$$css: true
|
|
25
25
|
}, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SiderProps } from "./types";
|
|
1
|
+
import type { SiderProps } from "./types";
|
|
2
2
|
import React from "react";
|
|
3
|
-
declare const Sider: (
|
|
3
|
+
declare const Sider: ({ style, children, className }: SiderProps) => React.JSX.Element;
|
|
4
4
|
export default Sider;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
1
|
import { Grid } from '../grid/index.js';
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import clsx from 'clsx';
|
|
5
3
|
|
|
6
|
-
var Sider = function Sider(
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var Sider = function Sider(_ref) {
|
|
5
|
+
var style = _ref.style,
|
|
6
|
+
children = _ref.children,
|
|
7
|
+
className = _ref.className;
|
|
10
8
|
return /*#__PURE__*/React.createElement(Grid.Col, {
|
|
11
|
-
style:
|
|
12
|
-
className:
|
|
9
|
+
style: style,
|
|
10
|
+
className: className,
|
|
13
11
|
span: 5,
|
|
14
12
|
as: "aside"
|
|
15
|
-
},
|
|
13
|
+
}, children);
|
|
16
14
|
};
|
|
17
15
|
|
|
18
16
|
export { Sider as default };
|