musae 0.2.24 → 0.2.26
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/bench/bench.d.ts +1 -1
- package/dist/components/bench/bench.js +5 -2
- package/dist/components/bench/hooks.d.ts +4 -3
- package/dist/components/bench/hooks.js +38 -21
- package/dist/components/bench/types.d.ts +7 -0
- package/dist/components/rich-text-editor/plugins/controlled-state/index.d.ts +4 -1
- package/dist/components/rich-text-editor/plugins/controlled-state/index.js +25 -5
- package/dist/components/rich-text-editor/plugins/markdown-shortcut/index.d.ts +3 -1
- package/dist/components/rich-text-editor/plugins/markdown-shortcut/index.js +6 -4
- package/dist/components/rich-text-editor/rich-text-editor.d.ts +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.js +31 -13
- package/dist/components/rich-text-editor/types.d.ts +14 -2
- package/dist/components/table/body.d.ts +1 -2
- package/dist/components/table/body.js +6 -3
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/types.d.ts +0 -5
- package/dist/index.d.ts +1 -0
- package/package.json +7 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { BenchProps } from "./types";
|
|
3
|
-
declare const Bench: ({ children, title, logo, navigations, className, style, trailing, onNavigate, location, defaultExpandedKeys, classNames: { main: mainClassName }, elevation, }: BenchProps) => React.JSX.Element;
|
|
3
|
+
declare const Bench: ({ children, title, logo, navigations, className, style, trailing, onNavigate, location, defaultExpandedKeys, classNames: { main: mainClassName }, elevation, guidance, }: BenchProps) => React.JSX.Element;
|
|
4
4
|
export default Bench;
|
|
@@ -91,13 +91,16 @@ var Bench = function Bench(_ref) {
|
|
|
91
91
|
_ref$classNames2 = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
92
92
|
mainClassName = _ref$classNames2.main,
|
|
93
93
|
_ref$elevation = _ref.elevation,
|
|
94
|
-
elevation = _ref$elevation === void 0 ? "xsmall" : _ref$elevation
|
|
94
|
+
elevation = _ref$elevation === void 0 ? "xsmall" : _ref$elevation,
|
|
95
|
+
_ref$guidance = _ref.guidance,
|
|
96
|
+
guidance = _ref$guidance === void 0 ? "top-side" : _ref$guidance;
|
|
95
97
|
var theme = useTheme();
|
|
96
98
|
var _logo = useLogo(logo);
|
|
97
99
|
var _useNavigations = useNavigations({
|
|
98
100
|
navigations: navigations,
|
|
99
101
|
onNavigate: onNavigate,
|
|
100
|
-
location: location
|
|
102
|
+
location: location,
|
|
103
|
+
guidance: guidance
|
|
101
104
|
}),
|
|
102
105
|
navigate = _useNavigations.navigate,
|
|
103
106
|
topMenuItems = _useNavigations.topMenuItems,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Key } from "react";
|
|
2
|
-
import type { BenchProps, Logo, NavigationItem } from "./types";
|
|
3
|
-
import { MenuItem } from "../menu";
|
|
2
|
+
import type { BenchProps, Guidance, Logo, NavigationItem } from "./types";
|
|
3
|
+
import type { MenuItem } from "../menu";
|
|
4
4
|
/**
|
|
5
5
|
* @description
|
|
6
6
|
* logo
|
|
@@ -10,10 +10,11 @@ export declare const useLogo: (logo?: string | Logo) => Logo | null;
|
|
|
10
10
|
* @description
|
|
11
11
|
* menu
|
|
12
12
|
*/
|
|
13
|
-
export declare const useNavigations: ({ navigations, onNavigate, location, }: {
|
|
13
|
+
export declare const useNavigations: ({ navigations, onNavigate, location, guidance, }: {
|
|
14
14
|
navigations: NavigationItem[];
|
|
15
15
|
onNavigate: BenchProps["onNavigate"];
|
|
16
16
|
location?: string;
|
|
17
|
+
guidance: Guidance;
|
|
17
18
|
}) => {
|
|
18
19
|
selectedKeys: [(Key | undefined)?, (Key | undefined)?];
|
|
19
20
|
topMenuItems: MenuItem[];
|
|
@@ -22,7 +22,7 @@ var useLogo = function useLogo(logo) {
|
|
|
22
22
|
return logo;
|
|
23
23
|
}, [logo]);
|
|
24
24
|
};
|
|
25
|
-
var _toMenuItem3 = function toMenuItem(_ref, parentKeys
|
|
25
|
+
var _toMenuItem3 = function toMenuItem(_ref, parentKeys) {
|
|
26
26
|
var path = _ref.path,
|
|
27
27
|
children = _ref.children,
|
|
28
28
|
item = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -31,13 +31,13 @@ var _toMenuItem3 = function toMenuItem(_ref, parentKeys, paths) {
|
|
|
31
31
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
32
32
|
_menuItems = _ref3[0],
|
|
33
33
|
_paths = _ref3[1];
|
|
34
|
-
var _toMenuItem = _toMenuItem3(child, [].concat(_toConsumableArray(parentKeys), [path])
|
|
34
|
+
var _toMenuItem = _toMenuItem3(child, [].concat(_toConsumableArray(parentKeys), [path])),
|
|
35
35
|
_toMenuItem2 = _slicedToArray(_toMenuItem, 2),
|
|
36
36
|
menuItem = _toMenuItem2[0],
|
|
37
37
|
paths = _toMenuItem2[1];
|
|
38
38
|
_menuItems.push(menuItem);
|
|
39
|
-
return [_menuItems, paths];
|
|
40
|
-
}, [[], new Map(
|
|
39
|
+
return [_menuItems, new Map([].concat(_toConsumableArray(_paths), _toConsumableArray(paths)))];
|
|
40
|
+
}, [[], new Map([[path, parentKeys]])]),
|
|
41
41
|
_reduce2 = _slicedToArray(_reduce, 2),
|
|
42
42
|
_menuItems = _reduce2[0],
|
|
43
43
|
_paths = _reduce2[1];
|
|
@@ -54,7 +54,8 @@ var _toMenuItem3 = function toMenuItem(_ref, parentKeys, paths) {
|
|
|
54
54
|
var useNavigations = function useNavigations(_ref4) {
|
|
55
55
|
var navigations = _ref4.navigations,
|
|
56
56
|
onNavigate = _ref4.onNavigate,
|
|
57
|
-
location = _ref4.location
|
|
57
|
+
location = _ref4.location,
|
|
58
|
+
guidance = _ref4.guidance;
|
|
58
59
|
// menu click handler => jump link
|
|
59
60
|
var navigate = useEvent(function (path) {
|
|
60
61
|
if (onNavigate) {
|
|
@@ -67,22 +68,29 @@ var useNavigations = function useNavigations(_ref4) {
|
|
|
67
68
|
var _useMemo = useMemo(function () {
|
|
68
69
|
return navigations.reduce(function (_ref5, item) {
|
|
69
70
|
var _ref6 = _slicedToArray(_ref5, 3),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var _toMenuItem4 = _toMenuItem3(item, []
|
|
71
|
+
_topNavigations = _ref6[0],
|
|
72
|
+
_sideNavigations = _ref6[1],
|
|
73
|
+
_paths = _ref6[2];
|
|
74
|
+
var _toMenuItem4 = _toMenuItem3(item, []),
|
|
74
75
|
_toMenuItem5 = _slicedToArray(_toMenuItem4, 2),
|
|
75
76
|
_toMenuItem5$ = _toMenuItem5[0],
|
|
76
77
|
children = _toMenuItem5$.children,
|
|
77
78
|
_menuItem = _objectWithoutProperties(_toMenuItem5$, _excluded2),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
___paths = _toMenuItem5[1];
|
|
80
|
+
var __paths = new Map([].concat(_toConsumableArray(___paths), _toConsumableArray(_paths)));
|
|
81
|
+
if (guidance === "side") {
|
|
82
|
+
_sideNavigations.set(item.path, [_objectSpread(_objectSpread({}, _menuItem), {}, {
|
|
83
|
+
children: children
|
|
84
|
+
})]);
|
|
85
|
+
return [_topNavigations, _sideNavigations, __paths];
|
|
86
|
+
}
|
|
87
|
+
_topNavigations.set(item.path, _menuItem);
|
|
88
|
+
_sideNavigations.set(item.path, children);
|
|
89
|
+
return [_topNavigations, _sideNavigations, __paths];
|
|
82
90
|
}, [new Map(), new Map(), new Map()]);
|
|
83
|
-
}, [navigations]),
|
|
91
|
+
}, [guidance, navigations]),
|
|
84
92
|
_useMemo2 = _slicedToArray(_useMemo, 3),
|
|
85
|
-
|
|
93
|
+
topNavigations = _useMemo2[0],
|
|
86
94
|
sideNavigations = _useMemo2[1],
|
|
87
95
|
paths = _useMemo2[2];
|
|
88
96
|
// menu selected keys
|
|
@@ -91,18 +99,27 @@ var useNavigations = function useNavigations(_ref4) {
|
|
|
91
99
|
if (isUndefined(location)) return [];
|
|
92
100
|
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
101
|
}, [location, paths]);
|
|
102
|
+
// side menu
|
|
94
103
|
var sideMenuItems = useMemo(function () {
|
|
95
104
|
var _sideNavigations$get;
|
|
96
|
-
|
|
97
|
-
|
|
105
|
+
// top menu items is empty, show all in side menu
|
|
106
|
+
if (topNavigations.size === 0) {
|
|
107
|
+
return Array.from(sideNavigations.values()).flatMap(function () {
|
|
108
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
109
|
+
return items;
|
|
110
|
+
}, []);
|
|
98
111
|
}
|
|
112
|
+
// top-side relation
|
|
113
|
+
if (!selectedKeys[0]) return [];
|
|
99
114
|
return (_sideNavigations$get = sideNavigations.get(selectedKeys[0])) !== null && _sideNavigations$get !== void 0 ? _sideNavigations$get : [];
|
|
100
|
-
}, [sideNavigations,
|
|
115
|
+
}, [selectedKeys, sideNavigations, topNavigations]);
|
|
116
|
+
// top menu items
|
|
117
|
+
var topMenuItems = useMemo(function () {
|
|
118
|
+
return Array.from(topNavigations.values());
|
|
119
|
+
}, [topNavigations]);
|
|
101
120
|
return {
|
|
102
121
|
selectedKeys: selectedKeys,
|
|
103
|
-
topMenuItems:
|
|
104
|
-
return Array.from(topMenuItems.values());
|
|
105
|
-
}, [topMenuItems]),
|
|
122
|
+
topMenuItems: topMenuItems,
|
|
106
123
|
sideMenuItems: sideMenuItems,
|
|
107
124
|
navigate: navigate
|
|
108
125
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Key, ReactNode } from "react";
|
|
2
2
|
import type { ComponentProps } from "../../types/element";
|
|
3
3
|
import type { ElevationToken } from "../theme/tokens.stylex";
|
|
4
|
+
export type Guidance = "top-side" | "side";
|
|
4
5
|
export type Logo = {
|
|
5
6
|
/**
|
|
6
7
|
* @description
|
|
@@ -81,4 +82,10 @@ export type BenchProps = ComponentProps & {
|
|
|
81
82
|
* elevation
|
|
82
83
|
*/
|
|
83
84
|
elevation?: ElevationToken;
|
|
85
|
+
/**
|
|
86
|
+
* @description
|
|
87
|
+
* guidance
|
|
88
|
+
* @default "top-side"
|
|
89
|
+
*/
|
|
90
|
+
guidance?: Guidance;
|
|
84
91
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
import type { Use } from "../../types";
|
|
2
3
|
interface Props {
|
|
3
4
|
value?: string;
|
|
5
|
+
onChange?: (value: string) => void;
|
|
6
|
+
use: Use;
|
|
4
7
|
}
|
|
5
|
-
declare const ControlledStatePlugin: ({ value }: Props) => ReactNode;
|
|
8
|
+
declare const ControlledStatePlugin: ({ value, use: _use, onChange }: Props) => ReactNode;
|
|
6
9
|
export default ControlledStatePlugin;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
-
import
|
|
3
|
-
import { isUndefined } from '@aiszlab/relax';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useUpdateEffect, isUndefined, useEvent } from '@aiszlab/relax';
|
|
4
4
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
5
|
+
import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
|
|
6
|
+
import { $convertToMarkdownString } from '@lexical/markdown';
|
|
7
|
+
import { TRANSFORMERS } from '../markdown-shortcut/index.js';
|
|
5
8
|
|
|
6
9
|
var ControlledStatePlugin = function ControlledStatePlugin(_ref) {
|
|
7
|
-
var value = _ref.value
|
|
10
|
+
var value = _ref.value,
|
|
11
|
+
_use = _ref.use,
|
|
12
|
+
onChange = _ref.onChange;
|
|
8
13
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
9
14
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
10
15
|
editor = _useLexicalComposerCo2[0];
|
|
11
|
-
|
|
16
|
+
useUpdateEffect(function () {
|
|
12
17
|
if (isUndefined(value)) return;
|
|
13
18
|
try {
|
|
14
19
|
var editorState = editor.parseEditorState(value);
|
|
@@ -17,7 +22,22 @@ var ControlledStatePlugin = function ControlledStatePlugin(_ref) {
|
|
|
17
22
|
console.error(error);
|
|
18
23
|
}
|
|
19
24
|
}, [value, editor]);
|
|
20
|
-
|
|
25
|
+
var change = useEvent(function (state, editor) {
|
|
26
|
+
var _value = JSON.stringify(state.toJSON());
|
|
27
|
+
onChange === null || onChange === void 0 || onChange(_value);
|
|
28
|
+
editor.read(function () {
|
|
29
|
+
var _value = JSON.stringify(state.toJSON());
|
|
30
|
+
if (_use === "serialized") {
|
|
31
|
+
onChange === null || onChange === void 0 || onChange(_value);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
var markdown = $convertToMarkdownString(TRANSFORMERS, state._nodeMap.get("root"));
|
|
35
|
+
onChange === null || onChange === void 0 || onChange(markdown);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
return /*#__PURE__*/React.createElement(OnChangePlugin, {
|
|
39
|
+
onChange: change
|
|
40
|
+
});
|
|
21
41
|
};
|
|
22
42
|
|
|
23
43
|
export { ControlledStatePlugin as default };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type Transformer } from "@lexical/markdown";
|
|
2
|
+
export declare const TRANSFORMERS: Transformer[];
|
|
1
3
|
declare const MarkdownShortcutPlugin: () => import("react").FunctionComponentElement<Readonly<{
|
|
2
|
-
transformers?: Array<
|
|
4
|
+
transformers?: Array<Transformer>;
|
|
3
5
|
}>>;
|
|
4
6
|
export default MarkdownShortcutPlugin;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
|
-
import { MarkdownShortcutPlugin as MarkdownShortcutPlugin$
|
|
2
|
+
import { MarkdownShortcutPlugin as MarkdownShortcutPlugin$2 } from '@lexical/react/LexicalMarkdownShortcutPlugin';
|
|
3
3
|
import { createElement } from 'react';
|
|
4
4
|
import { ELEMENT_TRANSFORMERS, TEXT_FORMAT_TRANSFORMERS, TEXT_MATCH_TRANSFORMERS } from '@lexical/markdown';
|
|
5
5
|
|
|
6
|
+
var TRANSFORMERS = [].concat(_toConsumableArray(ELEMENT_TRANSFORMERS), _toConsumableArray(TEXT_FORMAT_TRANSFORMERS), _toConsumableArray(TEXT_MATCH_TRANSFORMERS));
|
|
6
7
|
var MarkdownShortcutPlugin = function MarkdownShortcutPlugin() {
|
|
7
|
-
return /*#__PURE__*/createElement(MarkdownShortcutPlugin$
|
|
8
|
-
transformers:
|
|
8
|
+
return /*#__PURE__*/createElement(MarkdownShortcutPlugin$2, {
|
|
9
|
+
transformers: TRANSFORMERS
|
|
9
10
|
});
|
|
10
11
|
};
|
|
12
|
+
var MarkdownShortcutPlugin$1 = MarkdownShortcutPlugin;
|
|
11
13
|
|
|
12
|
-
export { MarkdownShortcutPlugin as default };
|
|
14
|
+
export { TRANSFORMERS, MarkdownShortcutPlugin$1 as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { RichTextEditorProps } from "./types";
|
|
3
|
-
declare const RichTextEditor: ({ placeholder, disabled, value, onChange, }: RichTextEditorProps) => React.JSX.Element;
|
|
3
|
+
declare const RichTextEditor: ({ placeholder, disabled, defaultValue, value, onChange, ...props }: RichTextEditorProps) => React.JSX.Element;
|
|
4
4
|
export default RichTextEditor;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { LexicalComposer } from '@lexical/react/LexicalComposer';
|
|
4
5
|
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
@@ -8,10 +9,9 @@ import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
|
|
|
8
9
|
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
|
|
9
10
|
import { ClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin';
|
|
10
11
|
import { ListPlugin } from '@lexical/react/LexicalListPlugin';
|
|
11
|
-
import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
|
|
12
12
|
import CheckListPlugin from './plugins/check-list/index.js';
|
|
13
13
|
import ControlledStatePlugin from './plugins/controlled-state/index.js';
|
|
14
|
-
import { useIdentity, useDefault
|
|
14
|
+
import { useIdentity, useDefault } from '@aiszlab/relax';
|
|
15
15
|
import { useMessage } from '../message/hooks.js';
|
|
16
16
|
import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
17
17
|
import { useTheme } from '../theme/hooks.js';
|
|
@@ -23,11 +23,13 @@ import { HorizontalRuleNode } from '@lexical/react/LexicalHorizontalRuleNode';
|
|
|
23
23
|
import { CodeNode } from '@lexical/code';
|
|
24
24
|
import { CheckableListItemNode, replacement } from './nodes/checkable-list-item.js';
|
|
25
25
|
import ToolbarPlugin from './plugins/toolbar/index.js';
|
|
26
|
-
import MarkdownShortcutPlugin from './plugins/markdown-shortcut/index.js';
|
|
26
|
+
import MarkdownShortcutPlugin, { TRANSFORMERS } from './plugins/markdown-shortcut/index.js';
|
|
27
27
|
import { typography } from '../theme/theme.js';
|
|
28
28
|
import '../checkbox/index.js';
|
|
29
|
+
import { $convertFromMarkdownString } from '@lexical/markdown';
|
|
29
30
|
import styles$1 from '../checkbox/styles.js';
|
|
30
31
|
|
|
32
|
+
var _excluded = ["placeholder", "disabled", "defaultValue", "value", "onChange"];
|
|
31
33
|
var styles = {
|
|
32
34
|
shell: function shell(props) {
|
|
33
35
|
return [{
|
|
@@ -70,11 +72,14 @@ var styles = {
|
|
|
70
72
|
}
|
|
71
73
|
};
|
|
72
74
|
var RichTextEditor = function RichTextEditor(_ref) {
|
|
75
|
+
var _props$ariaPlacehold;
|
|
73
76
|
var placeholder = _ref.placeholder,
|
|
74
77
|
_ref$disabled = _ref.disabled,
|
|
75
78
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
79
|
+
defaultValue = _ref.defaultValue,
|
|
76
80
|
value = _ref.value,
|
|
77
|
-
onChange = _ref.onChange
|
|
81
|
+
onChange = _ref.onChange,
|
|
82
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
78
83
|
var _useIdentity = useIdentity(),
|
|
79
84
|
_useIdentity2 = _slicedToArray(_useIdentity, 1),
|
|
80
85
|
id = _useIdentity2[0];
|
|
@@ -83,6 +88,10 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
83
88
|
messager = _useMessage2[0],
|
|
84
89
|
holder = _useMessage2[1];
|
|
85
90
|
var theme = useTheme();
|
|
91
|
+
var _use = useDefault(function () {
|
|
92
|
+
var _props$use;
|
|
93
|
+
return (_props$use = props.use) !== null && _props$use !== void 0 ? _props$use : "serialized";
|
|
94
|
+
});
|
|
86
95
|
var styled = {
|
|
87
96
|
shell: _stylex.props(styles.shell({
|
|
88
97
|
backgroundColor: theme.colors[ColorToken.SurfaceContainer]
|
|
@@ -158,13 +167,22 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
158
167
|
},
|
|
159
168
|
nodes: [HeadingNode, QuoteNode, CodeNode, LinkNode, ListNode, CheckableListItemNode, replacement, HorizontalRuleNode],
|
|
160
169
|
theme: theme,
|
|
161
|
-
editable: !disabled
|
|
170
|
+
editable: !disabled,
|
|
171
|
+
editorState: function editorState(editor) {
|
|
172
|
+
var _value = value !== null && value !== void 0 ? value : defaultValue;
|
|
173
|
+
if (!_value) return;
|
|
174
|
+
// different value usage, use different serialization
|
|
175
|
+
switch (_use) {
|
|
176
|
+
case "markdown":
|
|
177
|
+
$convertFromMarkdownString(_value, TRANSFORMERS);
|
|
178
|
+
break;
|
|
179
|
+
default:
|
|
180
|
+
editor.setEditorState(editor.parseEditorState(_value));
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
162
184
|
};
|
|
163
185
|
});
|
|
164
|
-
var change = useEvent(function (state) {
|
|
165
|
-
var _value = JSON.stringify(state.toJSON());
|
|
166
|
-
onChange === null || onChange === void 0 || onChange(_value);
|
|
167
|
-
});
|
|
168
186
|
return /*#__PURE__*/React.createElement(LexicalComposer, {
|
|
169
187
|
initialConfig: initialConfig
|
|
170
188
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -177,16 +195,16 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
177
195
|
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : function () {
|
|
178
196
|
return null;
|
|
179
197
|
},
|
|
180
|
-
"aria-placeholder": "
|
|
198
|
+
"aria-placeholder": (_props$ariaPlacehold = props["aria-placeholder"]) !== null && _props$ariaPlacehold !== void 0 ? _props$ariaPlacehold : ""
|
|
181
199
|
}),
|
|
182
200
|
ErrorBoundary: LexicalErrorBoundary
|
|
183
201
|
}), /*#__PURE__*/React.createElement(HistoryPlugin, null), /*#__PURE__*/React.createElement(MarkdownShortcutPlugin, null), /*#__PURE__*/React.createElement(LinkPlugin, null), /*#__PURE__*/React.createElement(ClickableLinkPlugin, {
|
|
184
202
|
disabled: !disabled,
|
|
185
203
|
newTab: true
|
|
186
204
|
}), /*#__PURE__*/React.createElement(ListPlugin, null), /*#__PURE__*/React.createElement(CheckListPlugin, null), /*#__PURE__*/React.createElement(ControlledStatePlugin, {
|
|
187
|
-
value: value
|
|
188
|
-
|
|
189
|
-
onChange:
|
|
205
|
+
value: value,
|
|
206
|
+
use: _use,
|
|
207
|
+
onChange: onChange
|
|
190
208
|
}), holder));
|
|
191
209
|
};
|
|
192
210
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type Props as ContentEditableProps } from "@lexical/react/LexicalContentEditable";
|
|
2
2
|
import { type EditorThemeClasses as _EditorThemeClasses } from "lexical";
|
|
3
3
|
import type { MenuItem } from "../menu";
|
|
4
|
-
import type { ReactNode } from "react";
|
|
4
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
5
|
+
export type Use = "markdown" | "serialized";
|
|
5
6
|
/**
|
|
6
7
|
* @description
|
|
7
8
|
* rich text editor props
|
|
8
9
|
*/
|
|
9
|
-
export type RichTextEditorProps = {
|
|
10
|
+
export type RichTextEditorProps = Pick<HTMLAttributes<HTMLDivElement>, "aria-placeholder"> & {
|
|
10
11
|
/**
|
|
11
12
|
* @description
|
|
12
13
|
* placeholder
|
|
@@ -17,11 +18,22 @@ export type RichTextEditorProps = {
|
|
|
17
18
|
* disabled
|
|
18
19
|
*/
|
|
19
20
|
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @description
|
|
23
|
+
* default value
|
|
24
|
+
*/
|
|
25
|
+
defaultValue?: string;
|
|
20
26
|
/**
|
|
21
27
|
* @description
|
|
22
28
|
* value
|
|
23
29
|
*/
|
|
24
30
|
value?: string;
|
|
31
|
+
/**
|
|
32
|
+
* @description
|
|
33
|
+
* use value type
|
|
34
|
+
* @default "serialized"
|
|
35
|
+
*/
|
|
36
|
+
use?: Use;
|
|
25
37
|
/**
|
|
26
38
|
* @description
|
|
27
39
|
* change handler
|
|
@@ -2,10 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { useTable } from './context.js';
|
|
3
3
|
import { flexRender } from '@tanstack/react-table';
|
|
4
4
|
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
|
|
5
|
-
import { clsx } from '@aiszlab/relax';
|
|
5
|
+
import { isEmpty, clsx } from '@aiszlab/relax';
|
|
6
6
|
import { typography } from '../theme/theme.js';
|
|
7
7
|
import { useTheme } from '../theme/hooks.js';
|
|
8
8
|
import { ColorToken } from '../../utils/colors.js';
|
|
9
|
+
import Empty from '../empty/empty.js';
|
|
9
10
|
|
|
10
11
|
var styles = {
|
|
11
12
|
cell: function cell(props) {
|
|
@@ -62,7 +63,7 @@ var styles = {
|
|
|
62
63
|
$$css: true
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
|
-
var Body = function Body(
|
|
66
|
+
var Body = function Body() {
|
|
66
67
|
var _useTable = useTable(),
|
|
67
68
|
table = _useTable.table,
|
|
68
69
|
bordered = _useTable.bordered;
|
|
@@ -71,7 +72,9 @@ var Body = function Body(props$1) {
|
|
|
71
72
|
var styled = props(bordered && styles.bordered, typography.body.small, styles.cell({
|
|
72
73
|
borderColor: theme.colors[ColorToken.OutlineVariant]
|
|
73
74
|
}));
|
|
74
|
-
|
|
75
|
+
var rows = table.getRowModel().rows;
|
|
76
|
+
var _isEmpty = isEmpty(rows);
|
|
77
|
+
return /*#__PURE__*/React.createElement("tbody", null, _isEmpty && (/*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(Empty, null)))), !_isEmpty && table.getRowModel().rows.map(function (row) {
|
|
75
78
|
return /*#__PURE__*/React.createElement("tr", {
|
|
76
79
|
key: row.id
|
|
77
80
|
}, row.getVisibleCells().map(function (cell) {
|
|
@@ -106,11 +106,6 @@ export type ContextValue<T> = {
|
|
|
106
106
|
* header props
|
|
107
107
|
*/
|
|
108
108
|
export type HeaderProps = ComponentProps;
|
|
109
|
-
/**
|
|
110
|
-
* @description
|
|
111
|
-
* body props
|
|
112
|
-
*/
|
|
113
|
-
export type BodyProps = ComponentProps;
|
|
114
109
|
/**
|
|
115
110
|
* @description
|
|
116
111
|
* header cell props
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "musae",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.26",
|
|
4
4
|
"description": "musae-ui",
|
|
5
5
|
"author": "tutu@fantufantu.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"prepublishOnly": "rm -rf dist && npm run build",
|
|
14
14
|
"preinstall": "npx @aiszlab/watchdog preinstall",
|
|
15
15
|
"authors": "zx scripts/contributors.mjs",
|
|
16
|
+
"changesets": "z cs",
|
|
16
17
|
"version": "z cs version"
|
|
17
18
|
},
|
|
18
19
|
"exports": {
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"pnpm": ">=9"
|
|
72
73
|
},
|
|
73
74
|
"dependencies": {
|
|
74
|
-
"@aiszlab/relax": "^1.3.
|
|
75
|
+
"@aiszlab/relax": "^1.3.13",
|
|
75
76
|
"@babel/runtime": "^7.25.6",
|
|
76
77
|
"@dnd-kit/core": "^6.1.0",
|
|
77
78
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
@@ -110,7 +111,7 @@
|
|
|
110
111
|
"@testing-library/react": "^16.0.1",
|
|
111
112
|
"@testing-library/user-event": "^14.5.2",
|
|
112
113
|
"@types/dom-view-transitions": "^1.0.5",
|
|
113
|
-
"@types/jest": "^29.5.
|
|
114
|
+
"@types/jest": "^29.5.13",
|
|
114
115
|
"@types/node": "^22.5.4",
|
|
115
116
|
"@types/react": "^18.3.5",
|
|
116
117
|
"@types/react-dom": "^18.3.0",
|
|
@@ -122,9 +123,9 @@
|
|
|
122
123
|
"jest-environment-jsdom": "^29.7.0",
|
|
123
124
|
"react": "^18.3.1",
|
|
124
125
|
"react-dom": "^18.3.1",
|
|
125
|
-
"rollup": "^4.21.
|
|
126
|
-
"typescript": "^5.
|
|
127
|
-
"zx": "^8.1.
|
|
126
|
+
"rollup": "^4.21.3",
|
|
127
|
+
"typescript": "^5.6.2",
|
|
128
|
+
"zx": "^8.1.6"
|
|
128
129
|
},
|
|
129
130
|
"peerDependencies": {
|
|
130
131
|
"react": "^18",
|