@lobehub/editor 1.27.1 → 1.28.0
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/es/react/FloatActions/FloatActions.d.ts +4 -0
- package/es/react/FloatActions/FloatActions.js +68 -0
- package/es/react/FloatActions/components/ActionItem.d.ts +12 -0
- package/es/react/FloatActions/components/ActionItem.js +65 -0
- package/es/react/FloatActions/components/ActionRender.d.ts +9 -0
- package/es/react/FloatActions/components/ActionRender.js +71 -0
- package/es/react/FloatActions/components/CollapsedActions.d.ts +4 -0
- package/es/react/FloatActions/components/CollapsedActions.js +82 -0
- package/es/react/FloatActions/index.d.ts +2 -0
- package/es/react/FloatActions/index.js +1 -0
- package/es/react/FloatActions/style.d.ts +4 -0
- package/es/react/FloatActions/style.js +10 -0
- package/es/react/FloatActions/type.d.ts +38 -0
- package/es/react/FloatActions/type.js +1 -0
- package/es/react/index.d.ts +1 -0
- package/es/react/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _excluded = ["gap", "disabled", "items", "onActionClick", "className", "defaultGroupCollapse", "onGroupCollapseChange", "groupCollapse"];
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
+
import { memo } from 'react';
|
|
19
|
+
import { Flexbox } from 'react-layout-kit';
|
|
20
|
+
import useMergeState from 'use-merge-value';
|
|
21
|
+
import ActionItem from "./components/ActionItem";
|
|
22
|
+
import { useStyles } from "./style";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
var FloatActions = /*#__PURE__*/memo(function (_ref) {
|
|
25
|
+
var _ref$gap = _ref.gap,
|
|
26
|
+
gap = _ref$gap === void 0 ? 2 : _ref$gap,
|
|
27
|
+
disabled = _ref.disabled,
|
|
28
|
+
_ref$items = _ref.items,
|
|
29
|
+
items = _ref$items === void 0 ? [] : _ref$items,
|
|
30
|
+
onActionClick = _ref.onActionClick,
|
|
31
|
+
className = _ref.className,
|
|
32
|
+
_ref$defaultGroupColl = _ref.defaultGroupCollapse,
|
|
33
|
+
defaultGroupCollapse = _ref$defaultGroupColl === void 0 ? false : _ref$defaultGroupColl,
|
|
34
|
+
onGroupCollapseChange = _ref.onGroupCollapseChange,
|
|
35
|
+
groupCollapse = _ref.groupCollapse,
|
|
36
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
var _useStyles = useStyles(),
|
|
38
|
+
cx = _useStyles.cx,
|
|
39
|
+
styles = _useStyles.styles;
|
|
40
|
+
var _useMergeState = useMergeState(defaultGroupCollapse, {
|
|
41
|
+
defaultValue: defaultGroupCollapse,
|
|
42
|
+
onChange: onGroupCollapseChange,
|
|
43
|
+
value: groupCollapse
|
|
44
|
+
}),
|
|
45
|
+
_useMergeState2 = _slicedToArray(_useMergeState, 2),
|
|
46
|
+
groupCollapsed = _useMergeState2[0],
|
|
47
|
+
setGroupCollapsed = _useMergeState2[1];
|
|
48
|
+
return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
|
|
49
|
+
align: 'center',
|
|
50
|
+
className: cx(styles.container, className),
|
|
51
|
+
flex: 1,
|
|
52
|
+
gap: gap,
|
|
53
|
+
horizontal: true
|
|
54
|
+
}, rest), {}, {
|
|
55
|
+
children: items.map(function (item, index) {
|
|
56
|
+
return /*#__PURE__*/_jsx(ActionItem, {
|
|
57
|
+
disabled: disabled,
|
|
58
|
+
gap: gap,
|
|
59
|
+
groupCollapsed: groupCollapsed,
|
|
60
|
+
item: item,
|
|
61
|
+
onActionClick: onActionClick,
|
|
62
|
+
setGroupCollapsed: setGroupCollapsed
|
|
63
|
+
}, item.key || index);
|
|
64
|
+
})
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
FloatActions.displayName = 'FloatActions';
|
|
68
|
+
export default FloatActions;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FloatActionsItem, FloatActionsProps } from '../type';
|
|
3
|
+
interface FloatActionsItemProps {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
gap?: string | number;
|
|
6
|
+
groupCollapsed?: boolean;
|
|
7
|
+
item: FloatActionsItem;
|
|
8
|
+
onActionClick: FloatActionsProps['onActionClick'];
|
|
9
|
+
setGroupCollapsed?: (collapse: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const ActionItem: import("react").NamedExoticComponent<FloatActionsItemProps>;
|
|
12
|
+
export default ActionItem;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
import { ActionIcon, Dropdown } from '@lobehub/ui';
|
|
10
|
+
import { memo } from 'react';
|
|
11
|
+
import ActionRender from "./ActionRender";
|
|
12
|
+
import CollapsedActions from "./CollapsedActions";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
var ActionItem = /*#__PURE__*/memo(function (_ref) {
|
|
15
|
+
var item = _ref.item,
|
|
16
|
+
disabled = _ref.disabled,
|
|
17
|
+
onActionClick = _ref.onActionClick,
|
|
18
|
+
groupCollapsed = _ref.groupCollapsed,
|
|
19
|
+
gap = _ref.gap,
|
|
20
|
+
setGroupCollapsed = _ref.setGroupCollapsed;
|
|
21
|
+
if (item.type === 'collapse') {
|
|
22
|
+
return /*#__PURE__*/_jsx(CollapsedActions, {
|
|
23
|
+
gap: gap,
|
|
24
|
+
groupCollapse: groupCollapsed,
|
|
25
|
+
mode: 'default',
|
|
26
|
+
onGroupCollapseChange: setGroupCollapsed,
|
|
27
|
+
children: item.children.map(function (child, childIndex) {
|
|
28
|
+
return /*#__PURE__*/_jsx(ActionRender, {
|
|
29
|
+
disabled: disabled,
|
|
30
|
+
item: child,
|
|
31
|
+
onActionClick: onActionClick
|
|
32
|
+
}, (child === null || child === void 0 ? void 0 : child.key) || "action-".concat(childIndex));
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (item.type === 'dropdown') {
|
|
37
|
+
return /*#__PURE__*/_jsx(Dropdown, {
|
|
38
|
+
menu: {
|
|
39
|
+
items: item.children
|
|
40
|
+
},
|
|
41
|
+
children: /*#__PURE__*/_jsx(ActionIcon, {
|
|
42
|
+
active: item.active,
|
|
43
|
+
danger: item.danger,
|
|
44
|
+
disabled: disabled || item.loading || (item === null || item === void 0 ? void 0 : item.disabled),
|
|
45
|
+
icon: item.icon,
|
|
46
|
+
loading: item.loading,
|
|
47
|
+
size: {
|
|
48
|
+
blockSize: 36,
|
|
49
|
+
size: 20
|
|
50
|
+
},
|
|
51
|
+
title: item.label,
|
|
52
|
+
tooltipProps: _objectSpread({
|
|
53
|
+
placement: 'top'
|
|
54
|
+
}, item.tooltipProps)
|
|
55
|
+
})
|
|
56
|
+
}, item.key);
|
|
57
|
+
}
|
|
58
|
+
return /*#__PURE__*/_jsx(ActionRender, {
|
|
59
|
+
disabled: disabled,
|
|
60
|
+
item: item,
|
|
61
|
+
onActionClick: onActionClick
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
ActionItem.displayName = 'FloatActionsItem';
|
|
65
|
+
export default ActionItem;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FloatActionsItem, FloatActionsProps } from '../type';
|
|
3
|
+
interface ActionRenderProps {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
item: FloatActionsItem;
|
|
6
|
+
onActionClick: FloatActionsProps['onActionClick'];
|
|
7
|
+
}
|
|
8
|
+
declare const ActionRender: import("react").NamedExoticComponent<ActionRenderProps>;
|
|
9
|
+
export default ActionRender;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["wrapper", "icon", "key", "label", "onClick", "danger", "loading", "active", "tooltipProps"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
import { ActionIcon } from '@lobehub/ui';
|
|
11
|
+
import { Divider } from 'antd';
|
|
12
|
+
import { isValidElement, memo } from 'react';
|
|
13
|
+
import { useStyles } from "../style";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
var ActionRender = /*#__PURE__*/memo(function (_ref) {
|
|
16
|
+
var item = _ref.item,
|
|
17
|
+
onActionClick = _ref.onActionClick,
|
|
18
|
+
disabled = _ref.disabled;
|
|
19
|
+
var _useStyles = useStyles(),
|
|
20
|
+
styles = _useStyles.styles;
|
|
21
|
+
if (item.type === 'divider') {
|
|
22
|
+
return /*#__PURE__*/_jsx(Divider, {
|
|
23
|
+
className: styles.divider,
|
|
24
|
+
style: {
|
|
25
|
+
height: 20
|
|
26
|
+
},
|
|
27
|
+
type: 'vertical'
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
var _ref2 = item,
|
|
31
|
+
wrapper = _ref2.wrapper,
|
|
32
|
+
icon = _ref2.icon,
|
|
33
|
+
key = _ref2.key,
|
|
34
|
+
label = _ref2.label,
|
|
35
|
+
_onClick = _ref2.onClick,
|
|
36
|
+
danger = _ref2.danger,
|
|
37
|
+
loading = _ref2.loading,
|
|
38
|
+
active = _ref2.active,
|
|
39
|
+
tooltipProps = _ref2.tooltipProps,
|
|
40
|
+
itemRest = _objectWithoutProperties(_ref2, _excluded);
|
|
41
|
+
if (item.children && /*#__PURE__*/isValidElement(item.children)) {
|
|
42
|
+
if (!wrapper) return item.children;
|
|
43
|
+
return wrapper(item.children);
|
|
44
|
+
}
|
|
45
|
+
var action = /*#__PURE__*/_jsx(ActionIcon, {
|
|
46
|
+
active: active,
|
|
47
|
+
danger: danger,
|
|
48
|
+
disabled: disabled || loading || (itemRest === null || itemRest === void 0 ? void 0 : itemRest.disabled),
|
|
49
|
+
icon: icon,
|
|
50
|
+
loading: loading,
|
|
51
|
+
onClick: function onClick(e) {
|
|
52
|
+
onActionClick === null || onActionClick === void 0 || onActionClick({
|
|
53
|
+
domEvent: e,
|
|
54
|
+
key: String(key),
|
|
55
|
+
keyPath: [String(key)]
|
|
56
|
+
});
|
|
57
|
+
_onClick === null || _onClick === void 0 || _onClick(e);
|
|
58
|
+
},
|
|
59
|
+
size: {
|
|
60
|
+
blockSize: 36,
|
|
61
|
+
size: 20
|
|
62
|
+
},
|
|
63
|
+
title: label,
|
|
64
|
+
tooltipProps: _objectSpread({
|
|
65
|
+
placement: 'top'
|
|
66
|
+
}, tooltipProps)
|
|
67
|
+
});
|
|
68
|
+
if (!wrapper) return action;
|
|
69
|
+
return wrapper(action);
|
|
70
|
+
});
|
|
71
|
+
export default ActionRender;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ActionIcon } from '@lobehub/ui';
|
|
4
|
+
import { Popover } from 'antd';
|
|
5
|
+
import { motion } from 'framer-motion';
|
|
6
|
+
import { CircleChevronLeftIcon, CircleChevronRightIcon, CircleChevronUpIcon } from 'lucide-react';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { Flexbox } from 'react-layout-kit';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
var CollapsedActions = /*#__PURE__*/memo(function (_ref) {
|
|
12
|
+
var children = _ref.children,
|
|
13
|
+
_ref$groupCollapse = _ref.groupCollapse,
|
|
14
|
+
groupCollapse = _ref$groupCollapse === void 0 ? false : _ref$groupCollapse,
|
|
15
|
+
onGroupCollapseChange = _ref.onGroupCollapseChange,
|
|
16
|
+
gap = _ref.gap,
|
|
17
|
+
mode = _ref.mode;
|
|
18
|
+
if (mode === 'popup') {
|
|
19
|
+
return /*#__PURE__*/_jsx(Popover, {
|
|
20
|
+
arrow: false,
|
|
21
|
+
content: /*#__PURE__*/_jsx(Flexbox, {
|
|
22
|
+
align: 'center',
|
|
23
|
+
gap: gap,
|
|
24
|
+
horizontal: true,
|
|
25
|
+
children: children
|
|
26
|
+
}),
|
|
27
|
+
styles: {
|
|
28
|
+
body: {
|
|
29
|
+
padding: 4
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
children: /*#__PURE__*/_jsx(ActionIcon, {
|
|
33
|
+
icon: CircleChevronUpIcon,
|
|
34
|
+
size: {
|
|
35
|
+
blockSize: 36,
|
|
36
|
+
size: 20
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
42
|
+
align: 'center',
|
|
43
|
+
flex: 'none',
|
|
44
|
+
gap: gap,
|
|
45
|
+
horizontal: true,
|
|
46
|
+
children: [/*#__PURE__*/_jsx(motion.div, {
|
|
47
|
+
animate: groupCollapse ? 'closed' : 'open',
|
|
48
|
+
initial: groupCollapse ? 'closed' : 'open',
|
|
49
|
+
style: {
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
display: 'flex',
|
|
52
|
+
gap: gap,
|
|
53
|
+
overflow: 'hidden'
|
|
54
|
+
},
|
|
55
|
+
transition: {
|
|
56
|
+
duration: 0.2
|
|
57
|
+
},
|
|
58
|
+
variants: {
|
|
59
|
+
closed: {
|
|
60
|
+
opacity: 0,
|
|
61
|
+
width: 0
|
|
62
|
+
},
|
|
63
|
+
open: {
|
|
64
|
+
opacity: 1,
|
|
65
|
+
width: 'auto'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
children: children
|
|
69
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
70
|
+
icon: groupCollapse ? CircleChevronRightIcon : CircleChevronLeftIcon,
|
|
71
|
+
onClick: function onClick() {
|
|
72
|
+
return onGroupCollapseChange === null || onGroupCollapseChange === void 0 ? void 0 : onGroupCollapseChange(!groupCollapse);
|
|
73
|
+
},
|
|
74
|
+
size: {
|
|
75
|
+
blockSize: 36,
|
|
76
|
+
size: 20
|
|
77
|
+
}
|
|
78
|
+
})]
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
CollapsedActions.displayName = 'FloatActionsCollapse';
|
|
82
|
+
export default CollapsedActions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./FloatActions";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css;
|
|
6
|
+
return {
|
|
7
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n "]))),
|
|
8
|
+
divider: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-inline: 4px;\n "])))
|
|
9
|
+
};
|
|
10
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { MenuInfo, MenuItemType, TooltipProps } from '@lobehub/ui';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { FlexboxProps } from 'react-layout-kit';
|
|
4
|
+
export type FloatActionsEvent = Pick<MenuInfo, 'key' | 'keyPath' | 'domEvent'>;
|
|
5
|
+
export interface ActionItem extends MenuItemType {
|
|
6
|
+
active?: boolean;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
tooltipProps?: TooltipProps;
|
|
9
|
+
wrapper?: (dom: ReactNode) => ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export type DividerItem = {
|
|
12
|
+
type: 'divider';
|
|
13
|
+
};
|
|
14
|
+
export type CollapseItem = {
|
|
15
|
+
children: (ActionItem | DividerItem)[];
|
|
16
|
+
type: 'collapse';
|
|
17
|
+
};
|
|
18
|
+
export type DropdownItem = Omit<ActionItem, 'children' | 'type'> & {
|
|
19
|
+
children: MenuItemType[];
|
|
20
|
+
type: 'dropdown';
|
|
21
|
+
};
|
|
22
|
+
export type FloatActionsItem = ActionItem | DividerItem | CollapseItem | DropdownItem;
|
|
23
|
+
export interface FloatActionsProps extends Omit<FlexboxProps, 'children'> {
|
|
24
|
+
defaultGroupCollapse?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
groupCollapse?: boolean;
|
|
27
|
+
items?: FloatActionsItem[];
|
|
28
|
+
onActionClick?: (action: FloatActionsEvent) => void;
|
|
29
|
+
onGroupCollapseChange?: (collapse: boolean) => void;
|
|
30
|
+
}
|
|
31
|
+
export interface FloatActionsCollapseProps {
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
collapse?: boolean;
|
|
34
|
+
gap?: FlexboxProps['gap'];
|
|
35
|
+
groupCollapse?: boolean;
|
|
36
|
+
mode?: 'default' | 'popup';
|
|
37
|
+
onGroupCollapseChange?: (collapse: boolean) => void;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/react/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { type ChatInputActionEvent, default as ChatInputActions, type ChatInputA
|
|
|
4
4
|
export { default as CodeLanguageSelect, type CodeLanguageSelectProps } from './CodeLanguageSelect';
|
|
5
5
|
export { default as Editor, type EditorProps, withProps } from './Editor';
|
|
6
6
|
export { EditorProvider, type EditorProviderConfig, type EditorProviderProps, useEditorContent, } from './EditorProvider';
|
|
7
|
+
export { default as FloatActions, type FloatActionsProps } from './FloatActions';
|
|
7
8
|
export { default as FloatMenu, type FloatMenuProps } from './FloatMenu';
|
|
8
9
|
export { useEditor } from './hooks/useEditor';
|
|
9
10
|
export { type EditorState, useEditorState } from './hooks/useEditorState';
|
package/es/react/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { default as ChatInputActions } from "./ChatInputActions";
|
|
|
4
4
|
export { default as CodeLanguageSelect } from "./CodeLanguageSelect";
|
|
5
5
|
export { default as Editor, withProps } from "./Editor";
|
|
6
6
|
export { EditorProvider, useEditorContent } from "./EditorProvider";
|
|
7
|
+
export { default as FloatActions } from "./FloatActions";
|
|
7
8
|
export { default as FloatMenu } from "./FloatMenu";
|
|
8
9
|
export { useEditor } from "./hooks/useEditor";
|
|
9
10
|
export { useEditorState } from "./hooks/useEditorState";
|
package/package.json
CHANGED