@yuntijs/ui 1.1.0-beta.13 → 1.1.0-beta.15

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.
@@ -16,7 +16,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
16
16
  editing = _ref2.editing,
17
17
  time = _ref2.time,
18
18
  isLatest = _ref2.isLatest;
19
- var blockStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-block: 4px;\n padding-inline: 8px;\n\n background-color: ", ";\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n "])), primary ? isDarkMode ? token.colorFill : token.colorBgElevated : isDarkMode ? token.colorFillSecondary : token.colorBgContainer, token.borderRadius, token.motionEaseOut);
19
+ var blockStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-block: 4px;\n padding-inline: 8px;\n\n background-color: ", ";\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n "])), primary ? isDarkMode ? token.colorFill : '#F6F6F6' : isDarkMode ? token.colorFillSecondary : token.colorBgContainer, token.borderRadius, token.motionEaseOut);
20
20
  var pureStylish = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-block-start: ", ";\n "])), title ? 0 : '6px');
21
21
  var pureContainerStylish = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-block-end: -16px;\n transition: background-color 100ms ", ";\n "])), token.motionEaseOut);
22
22
  var typeStylish = type === 'block' ? blockStylish : pureStylish;
@@ -25,6 +25,10 @@ export interface MentionsProps extends MentionPickerPluginProps {
25
25
  onPressEnter?: (value: string, { event }: {
26
26
  event: KeyboardEvent | null;
27
27
  }) => void;
28
+ /**
29
+ * 用户输入 trigger 后的回调
30
+ */
31
+ onTrigger?: (trigger: string) => void;
28
32
  variant?: 'outlined' | 'filled' | 'borderless';
29
33
  autoSize?: AutoSize;
30
34
  code?: boolean;
@@ -53,7 +53,8 @@ export var Mentions = /*#__PURE__*/forwardRef(function (_ref, ref) {
53
53
  _ref$code = _ref.code,
54
54
  code = _ref$code === void 0 ? false : _ref$code,
55
55
  getPopContainer = _ref.getPopContainer,
56
- onPressEnter = _ref.onPressEnter;
56
+ onPressEnter = _ref.onPressEnter,
57
+ onTrigger = _ref.onTrigger;
57
58
  var _ConfigProvider$useCo = ConfigProvider.useConfig(),
58
59
  componentDisabled = _ConfigProvider$useCo.componentDisabled;
59
60
  var _useStyles = useStyles({
@@ -146,6 +147,10 @@ export var Mentions = /*#__PURE__*/forwardRef(function (_ref, ref) {
146
147
  })
147
148
  }), editable && /*#__PURE__*/_jsx(MentionPickerPlugin, {
148
149
  allowSpaces: allowSpaces,
150
+ onOpen: function onOpen(resolution) {
151
+ var _resolution$match$rep, _resolution$match;
152
+ return onTrigger === null || onTrigger === void 0 ? void 0 : onTrigger((_resolution$match$rep = (_resolution$match = resolution.match) === null || _resolution$match === void 0 ? void 0 : _resolution$match.replaceableString) !== null && _resolution$match$rep !== void 0 ? _resolution$match$rep : triggers[0]);
153
+ },
149
154
  onSelect: onSelect,
150
155
  options: options,
151
156
  overlayClassName: classNames === null || classNames === void 0 ? void 0 : classNames.menuOverlay,
@@ -1,7 +1,8 @@
1
+ import type { MenuOption, TypeaheadMenuPluginProps } from '@lexical/react/LexicalTypeaheadMenuPlugin';
1
2
  import React from 'react';
2
3
  import type { MentionOption } from '../../types';
3
4
  import { type MentionMenuOption } from './utils';
4
- export interface MentionPickerPluginProps {
5
+ export interface MentionPickerPluginProps extends Pick<TypeaheadMenuPluginProps<MenuOption>, 'onOpen'> {
5
6
  /** The className of menu overlay */
6
7
  overlayClassName?: string;
7
8
  /** The options of menu */
@@ -27,6 +27,7 @@ export var MentionPickerPlugin = /*#__PURE__*/memo(function (_ref) {
27
27
  _ref$preTriggerChars = _ref.preTriggerChars,
28
28
  preTriggerChars = _ref$preTriggerChars === void 0 ? PRE_TRIGGER_CHARS : _ref$preTriggerChars,
29
29
  onSelect = _ref.onSelect,
30
+ onOpen = _ref.onOpen,
30
31
  parent = _ref.parent;
31
32
  var _useStyles = useStyles({}),
32
33
  cx = _useStyles.cx,
@@ -169,6 +170,7 @@ export var MentionPickerPlugin = /*#__PURE__*/memo(function (_ref) {
169
170
  ,
170
171
  commandPriority: COMMAND_PRIORITY_NORMAL,
171
172
  menuRenderFn: renderMenu,
173
+ onOpen: onOpen,
172
174
  onQueryChange: setQueryString,
173
175
  onSelectOption: onSelectOption,
174
176
  options: flatOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuntijs/ui",
3
- "version": "1.1.0-beta.13",
3
+ "version": "1.1.0-beta.15",
4
4
  "description": "☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps",
5
5
  "keywords": [
6
6
  "yuntijs",