add all frontend files

This commit is contained in:
2026-01-17 15:16:36 -05:00
parent ff16ae7858
commit e40287e4aa
25704 changed files with 1935289 additions and 0 deletions

9
node_modules/rc-mentions/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,9 @@
The MIT License (MIT)
Copyright (c) 2019-present alipay.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

136
node_modules/rc-mentions/README.md generated vendored Normal file
View File

@@ -0,0 +1,136 @@
# rc-mentions
[![NPM version][npm-image]][npm-url]
[![npm download][download-image]][download-url]
[![build status][github-actions-image]][github-actions-url]
[![Codecov][codecov-image]][codecov-url]
[![bundle size][bundlephobia-image]][bundlephobia-url]
[![dumi][dumi-image]][dumi-url]
[npm-image]: http://img.shields.io/npm/v/rc-mentions.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-mentions
[travis-image]: https://img.shields.io/travis/react-component/mentions/master?style=flat-square
[travis-url]: https://travis-ci.com/react-component/mentions
[github-actions-image]: https://github.com/react-component/mentions/workflows/CI/badge.svg
[github-actions-url]: https://github.com/react-component/mentions/actions
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/mentions/master.svg?style=flat-square
[codecov-url]: https://app.codecov.io/gh/react-component/mentions
[david-url]: https://david-dm.org/react-component/mentions
[david-image]: https://david-dm.org/react-component/mentions/status.svg?style=flat-square
[david-dev-url]: https://david-dm.org/react-component/mentions?type=dev
[david-dev-image]: https://david-dm.org/react-component/mentions/dev-status.svg?style=flat-square
[download-image]: https://img.shields.io/npm/dm/rc-mentions.svg?style=flat-square
[download-url]: https://npmjs.org/package/rc-mentions
[bundlephobia-url]: https://bundlephobia.com/package/rc-mentions
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-mentions
[dumi-url]: https://github.com/umijs/dumi
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
## Screenshots
<img src="https://user-images.githubusercontent.com/5378891/57270992-2fd48780-70c0-11e9-91ae-c614d0b49a45.png" />
## Feature
- support ie9,ie9+,chrome,firefox,safari
### Keyboard
- Open mentions (focus input || focus and click)
- KeyDown/KeyUp/Enter to navigate menu
## install
[![rc-mentions](https://nodei.co/npm/rc-mentions.png)](https://npmjs.org/package/rc-mentions)
## Usage
### basic use
```js
/**
* inline: true
*/
import Mentions from 'rc-mentions';
// Import the default styles
import './index.less';
const { Option } = Mentions;
var Demo = (
<Mentions>
<Option value="light">Light</Option>
<Option value="bamboo">Bamboo</Option>
<Option value="cat">Cat</Option>
</Mentions>
);
React.render(<Demo />, container);
```
**Note:** We use [index.less](https://github.com/react-component/mentions/blob/master/assets/index.less) for styling, you can convert them into css and properly reference them to the code above.
## API
### Mentions props
| name | description | type | default |
| ----------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | ----------- |
| autoFocus | Auto get focus when component mounted | `boolean` | `false` |
| defaultValue | Default value | `string` | - |
| filterOption | Customize filter option logic | `false \| (input: string, option: OptionProps) => boolean` | - |
| notFoundContent | Set mentions content when not match | `ReactNode` | 'Not Found' |
| placement | Set popup placement | `'top' \| 'bottom'` | 'bottom' |
| direction | Set popup direction | `'ltr' \| 'rtl'` | 'ltr' |
| prefix | Set trigger prefix keyword | `string \| string[]` | '@' |
| rows | Set row count | `number` | 1 |
| split | Set split string before and after selected mention | `string` | ' ' |
| silent | Used in transition phase, does not respond to keyboard enter events when equal to `true` | `boolean` | `false` |
| validateSearch | Customize trigger search logic | `(text: string, props: MentionsProps) => void` | - |
| value | Set value of mentions | `string` | - |
| onChange | Trigger when value changed | `(text: string) => void` | - |
| onKeyDown | Trigger when user hits a key | `React.KeyboardEventHandler<HTMLTextAreaElement>` | - |
| onKeyUp | Trigger when user releases a key | `React.KeyboardEventHandler<HTMLTextAreaElement>` | - |
| onSelect | Trigger when user select the option | `(option: OptionProps, prefix: string) => void` | - |
| onSearch | Trigger when prefix hit | `(text: string, prefix: string) => void` | - |
| onFocus | Trigger when mentions get focus | `React.FocusEventHandler<HTMLTextAreaElement>` | - |
| onBlur | Trigger when mentions lose focus | `React.FocusEventHandler<HTMLTextAreaElement>` | - |
| getPopupContainer | DOM Container for suggestions | `() => HTMLElement` | - |
| autoSize | Textarea height autosize feature, can be set to `true\|false` or an object `{ minRows: 2, maxRows: 6 }` | `boolean \| object` | - |
| onPressEnter | The callback function that is triggered when Enter key is pressed | `function(e)` | - |
| onResize | The callback function that is triggered when textarea resize | `function({ width, height })` | - |
### Methods
| name | description |
| ------- | -------------------- |
| focus() | Component get focus |
| blur() | Component lose focus |
## Development
```
npm install
npm start
```
## Example
http://localhost:9001/
online example: http://react-component.github.io/mentions/
## Test Case
```
npm test
```
## Coverage
```
npm run coverage
```
## License
rc-mentions is released under the MIT license.

12
node_modules/rc-mentions/es/DropdownMenu.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import * as React from 'react';
import type { DataDrivenOptionProps } from './Mentions';
interface DropdownMenuProps {
prefixCls?: string;
options: DataDrivenOptionProps[];
}
/**
* We only use Menu to display the candidate.
* The focus is controlled by textarea to make accessibility easy.
*/
declare function DropdownMenu(props: DropdownMenuProps): React.JSX.Element;
export default DropdownMenu;

53
node_modules/rc-mentions/es/DropdownMenu.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
import Menu, { MenuItem } from 'rc-menu';
import * as React from 'react';
import MentionsContext from "./MentionsContext";
/**
* We only use Menu to display the candidate.
* The focus is controlled by textarea to make accessibility easy.
*/
function DropdownMenu(props) {
var _React$useContext = React.useContext(MentionsContext),
notFoundContent = _React$useContext.notFoundContent,
activeIndex = _React$useContext.activeIndex,
setActiveIndex = _React$useContext.setActiveIndex,
selectOption = _React$useContext.selectOption,
onFocus = _React$useContext.onFocus,
onBlur = _React$useContext.onBlur,
onScroll = _React$useContext.onScroll;
var prefixCls = props.prefixCls,
options = props.options;
var activeOption = options[activeIndex] || {};
return /*#__PURE__*/React.createElement(Menu, {
prefixCls: "".concat(prefixCls, "-menu"),
activeKey: activeOption.key,
onSelect: function onSelect(_ref) {
var key = _ref.key;
var option = options.find(function (_ref2) {
var optionKey = _ref2.key;
return optionKey === key;
});
selectOption(option);
},
onFocus: onFocus,
onBlur: onBlur,
onScroll: onScroll
}, options.map(function (option, index) {
var key = option.key,
disabled = option.disabled,
className = option.className,
style = option.style,
label = option.label;
return /*#__PURE__*/React.createElement(MenuItem, {
key: key,
disabled: disabled,
className: className,
style: style,
onMouseEnter: function onMouseEnter() {
setActiveIndex(index);
}
}, label);
}), !options.length && /*#__PURE__*/React.createElement(MenuItem, {
disabled: true
}, notFoundContent));
}
export default DropdownMenu;

17
node_modules/rc-mentions/es/KeywordTrigger.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import type { FC } from 'react';
import * as React from 'react';
import type { DataDrivenOptionProps, Direction, Placement } from './Mentions';
interface KeywordTriggerProps {
loading?: boolean;
options: DataDrivenOptionProps[];
prefixCls?: string;
placement?: Placement;
direction?: Direction;
visible?: boolean;
transitionName?: string;
children?: React.ReactElement;
getPopupContainer?: () => HTMLElement;
dropdownClassName?: string;
}
declare const KeywordTrigger: FC<KeywordTriggerProps>;
export default KeywordTrigger;

74
node_modules/rc-mentions/es/KeywordTrigger.js generated vendored Normal file
View File

@@ -0,0 +1,74 @@
import Trigger from '@rc-component/trigger';
import * as React from 'react';
import { useMemo } from 'react';
import DropdownMenu from "./DropdownMenu";
var BUILT_IN_PLACEMENTS = {
bottomRight: {
points: ['tl', 'br'],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
bottomLeft: {
points: ['tr', 'bl'],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
topRight: {
points: ['bl', 'tr'],
offset: [0, -4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
topLeft: {
points: ['br', 'tl'],
offset: [0, -4],
overflow: {
adjustX: 1,
adjustY: 1
}
}
};
var KeywordTrigger = function KeywordTrigger(props) {
var prefixCls = props.prefixCls,
options = props.options,
children = props.children,
visible = props.visible,
transitionName = props.transitionName,
getPopupContainer = props.getPopupContainer,
dropdownClassName = props.dropdownClassName,
direction = props.direction,
placement = props.placement;
var dropdownPrefix = "".concat(prefixCls, "-dropdown");
var dropdownElement = /*#__PURE__*/React.createElement(DropdownMenu, {
prefixCls: dropdownPrefix,
options: options
});
var dropdownPlacement = useMemo(function () {
var popupPlacement;
if (direction === 'rtl') {
popupPlacement = placement === 'top' ? 'topLeft' : 'bottomLeft';
} else {
popupPlacement = placement === 'top' ? 'topRight' : 'bottomRight';
}
return popupPlacement;
}, [direction, placement]);
return /*#__PURE__*/React.createElement(Trigger, {
prefixCls: dropdownPrefix,
popupVisible: visible,
popup: dropdownElement,
popupPlacement: dropdownPlacement,
popupTransitionName: transitionName,
builtinPlacements: BUILT_IN_PLACEMENTS,
getPopupContainer: getPopupContainer,
popupClassName: dropdownClassName
}, children);
};
export default KeywordTrigger;

55
node_modules/rc-mentions/es/Mentions.d.ts generated vendored Normal file
View File

@@ -0,0 +1,55 @@
import type { CommonInputProps } from 'rc-input/lib/interface';
import type { TextAreaProps } from 'rc-textarea';
import React from 'react';
import type { OptionProps } from './Option';
import Option from './Option';
import { filterOption as defaultFilterOption, validateSearch as defaultValidateSearch } from './util';
type BaseTextareaAttrs = Omit<TextAreaProps, 'prefix' | 'onChange' | 'onSelect' | 'showCount' | 'classNames'>;
export type Placement = 'top' | 'bottom';
export type Direction = 'ltr' | 'rtl';
export interface DataDrivenOptionProps extends Omit<OptionProps, 'children'> {
label?: React.ReactNode;
}
export interface MentionsProps extends BaseTextareaAttrs {
autoFocus?: boolean;
className?: string;
defaultValue?: string;
notFoundContent?: React.ReactNode;
split?: string;
style?: React.CSSProperties;
transitionName?: string;
placement?: Placement;
direction?: Direction;
prefix?: string | string[];
prefixCls?: string;
value?: string;
silent?: boolean;
filterOption?: false | typeof defaultFilterOption;
validateSearch?: typeof defaultValidateSearch;
onChange?: (text: string) => void;
onSelect?: (option: OptionProps, prefix: string) => void;
onSearch?: (text: string, prefix: string) => void;
onFocus?: React.FocusEventHandler<HTMLTextAreaElement>;
onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;
getPopupContainer?: () => HTMLElement;
dropdownClassName?: string;
/** @private Testing usage. Do not use in prod. It will not work as your expect. */
open?: boolean;
children?: React.ReactNode;
options?: DataDrivenOptionProps[];
classNames?: CommonInputProps['classNames'] & {
mentions?: string;
};
onPopupScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
}
export interface MentionsRef {
focus: VoidFunction;
blur: VoidFunction;
/** @deprecated It may not work as expected */
textarea: HTMLTextAreaElement | null;
nativeElement: HTMLElement;
}
declare const Mentions: React.ForwardRefExoticComponent<MentionsProps & React.RefAttributes<MentionsRef>> & {
Option: typeof Option;
};
export default Mentions;

454
node_modules/rc-mentions/es/Mentions.js generated vendored Normal file
View File

@@ -0,0 +1,454 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["prefixCls", "className", "style", "prefix", "split", "notFoundContent", "value", "defaultValue", "children", "options", "open", "allowClear", "silent", "validateSearch", "filterOption", "onChange", "onKeyDown", "onKeyUp", "onPressEnter", "onSearch", "onSelect", "onFocus", "onBlur", "transitionName", "placement", "direction", "getPopupContainer", "dropdownClassName", "rows", "visible", "onPopupScroll"],
_excluded2 = ["suffix", "prefixCls", "defaultValue", "value", "allowClear", "onChange", "classNames", "className", "disabled", "onClear"];
import classNames from 'classnames';
import { BaseInput } from 'rc-input';
import TextArea from 'rc-textarea';
import toArray from "rc-util/es/Children/toArray";
import useMergedState from "rc-util/es/hooks/useMergedState";
import KeyCode from "rc-util/es/KeyCode";
import warning from "rc-util/es/warning";
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
import useEffectState from "./hooks/useEffectState";
import KeywordTrigger from "./KeywordTrigger";
import MentionsContext from "./MentionsContext";
import Option from "./Option";
import { filterOption as defaultFilterOption, validateSearch as defaultValidateSearch, getBeforeSelectionText, getLastMeasureIndex, replaceWithMeasure, setInputSelection } from "./util";
var InternalMentions = /*#__PURE__*/forwardRef(function (props, ref) {
var prefixCls = props.prefixCls,
className = props.className,
style = props.style,
_props$prefix = props.prefix,
prefix = _props$prefix === void 0 ? '@' : _props$prefix,
_props$split = props.split,
split = _props$split === void 0 ? ' ' : _props$split,
_props$notFoundConten = props.notFoundContent,
notFoundContent = _props$notFoundConten === void 0 ? 'Not Found' : _props$notFoundConten,
value = props.value,
defaultValue = props.defaultValue,
children = props.children,
options = props.options,
open = props.open,
allowClear = props.allowClear,
silent = props.silent,
_props$validateSearch = props.validateSearch,
validateSearch = _props$validateSearch === void 0 ? defaultValidateSearch : _props$validateSearch,
_props$filterOption = props.filterOption,
filterOption = _props$filterOption === void 0 ? defaultFilterOption : _props$filterOption,
onChange = props.onChange,
onKeyDown = props.onKeyDown,
onKeyUp = props.onKeyUp,
onPressEnter = props.onPressEnter,
onSearch = props.onSearch,
onSelect = props.onSelect,
onFocus = props.onFocus,
onBlur = props.onBlur,
transitionName = props.transitionName,
placement = props.placement,
direction = props.direction,
getPopupContainer = props.getPopupContainer,
dropdownClassName = props.dropdownClassName,
_props$rows = props.rows,
rows = _props$rows === void 0 ? 1 : _props$rows,
visible = props.visible,
onPopupScroll = props.onPopupScroll,
restProps = _objectWithoutProperties(props, _excluded);
var mergedPrefix = useMemo(function () {
return Array.isArray(prefix) ? prefix : [prefix];
}, [prefix]);
// =============================== Refs ===============================
var containerRef = useRef(null);
var textareaRef = useRef(null);
var measureRef = useRef(null);
var getTextArea = function getTextArea() {
var _textareaRef$current;
return (_textareaRef$current = textareaRef.current) === null || _textareaRef$current === void 0 || (_textareaRef$current = _textareaRef$current.resizableTextArea) === null || _textareaRef$current === void 0 ? void 0 : _textareaRef$current.textArea;
};
React.useImperativeHandle(ref, function () {
var _textareaRef$current4;
return {
focus: function focus() {
var _textareaRef$current2;
return (_textareaRef$current2 = textareaRef.current) === null || _textareaRef$current2 === void 0 ? void 0 : _textareaRef$current2.focus();
},
blur: function blur() {
var _textareaRef$current3;
return (_textareaRef$current3 = textareaRef.current) === null || _textareaRef$current3 === void 0 ? void 0 : _textareaRef$current3.blur();
},
textarea: (_textareaRef$current4 = textareaRef.current) === null || _textareaRef$current4 === void 0 || (_textareaRef$current4 = _textareaRef$current4.resizableTextArea) === null || _textareaRef$current4 === void 0 ? void 0 : _textareaRef$current4.textArea,
nativeElement: containerRef.current
};
});
// ============================== State ===============================
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
measuring = _useState2[0],
setMeasuring = _useState2[1];
var _useState3 = useState(''),
_useState4 = _slicedToArray(_useState3, 2),
measureText = _useState4[0],
setMeasureText = _useState4[1];
var _useState5 = useState(''),
_useState6 = _slicedToArray(_useState5, 2),
measurePrefix = _useState6[0],
setMeasurePrefix = _useState6[1];
var _useState7 = useState(0),
_useState8 = _slicedToArray(_useState7, 2),
measureLocation = _useState8[0],
setMeasureLocation = _useState8[1];
var _useState9 = useState(0),
_useState10 = _slicedToArray(_useState9, 2),
activeIndex = _useState10[0],
setActiveIndex = _useState10[1];
var _useState11 = useState(false),
_useState12 = _slicedToArray(_useState11, 2),
isFocus = _useState12[0],
setIsFocus = _useState12[1];
// ============================== Value ===============================
var _useMergedState = useMergedState('', {
defaultValue: defaultValue,
value: value
}),
_useMergedState2 = _slicedToArray(_useMergedState, 2),
mergedValue = _useMergedState2[0],
setMergedValue = _useMergedState2[1];
// =============================== Open ===============================
useEffect(function () {
// Sync measure div top with textarea for rc-trigger usage
if (measuring && measureRef.current) {
measureRef.current.scrollTop = getTextArea().scrollTop;
}
}, [measuring]);
var _React$useMemo = React.useMemo(function () {
if (open) {
if (process.env.NODE_ENV !== 'production') {
warning(false, '`open` of Mentions is only used for debug usage. Do not use in you production.');
}
for (var i = 0; i < mergedPrefix.length; i += 1) {
var curPrefix = mergedPrefix[i];
var index = mergedValue.lastIndexOf(curPrefix);
if (index >= 0) {
return [true, '', curPrefix, index];
}
}
}
return [measuring, measureText, measurePrefix, measureLocation];
}, [open, measuring, mergedPrefix, mergedValue, measureText, measurePrefix, measureLocation]),
_React$useMemo2 = _slicedToArray(_React$useMemo, 4),
mergedMeasuring = _React$useMemo2[0],
mergedMeasureText = _React$useMemo2[1],
mergedMeasurePrefix = _React$useMemo2[2],
mergedMeasureLocation = _React$useMemo2[3];
// ============================== Option ==============================
var getOptions = React.useCallback(function (targetMeasureText) {
var list;
if (options && options.length > 0) {
list = options.map(function (item) {
var _item$key;
return _objectSpread(_objectSpread({}, item), {}, {
key: (_item$key = item === null || item === void 0 ? void 0 : item.key) !== null && _item$key !== void 0 ? _item$key : item.value
});
});
} else {
list = toArray(children).map(function (_ref) {
var optionProps = _ref.props,
key = _ref.key;
return _objectSpread(_objectSpread({}, optionProps), {}, {
label: optionProps.children,
key: key || optionProps.value
});
});
}
return list.filter(function (option) {
/** Return all result if `filterOption` is false. */
if (filterOption === false) {
return true;
}
return filterOption(targetMeasureText, option);
});
}, [children, options, filterOption]);
var mergedOptions = React.useMemo(function () {
return getOptions(mergedMeasureText);
}, [getOptions, mergedMeasureText]);
// ============================= Measure ==============================
// Mark that we will reset input selection to target position when user select option
var onSelectionEffect = useEffectState();
var startMeasure = function startMeasure(nextMeasureText, nextMeasurePrefix, nextMeasureLocation) {
setMeasuring(true);
setMeasureText(nextMeasureText);
setMeasurePrefix(nextMeasurePrefix);
setMeasureLocation(nextMeasureLocation);
setActiveIndex(0);
};
var stopMeasure = function stopMeasure(callback) {
setMeasuring(false);
setMeasureLocation(0);
setMeasureText('');
onSelectionEffect(callback);
};
// ============================== Change ==============================
var triggerChange = function triggerChange(nextValue) {
setMergedValue(nextValue);
onChange === null || onChange === void 0 || onChange(nextValue);
};
var onInternalChange = function onInternalChange(_ref2) {
var nextValue = _ref2.target.value;
triggerChange(nextValue);
};
var selectOption = function selectOption(option) {
var _getTextArea;
var _option$value = option.value,
mentionValue = _option$value === void 0 ? '' : _option$value;
var _replaceWithMeasure = replaceWithMeasure(mergedValue, {
measureLocation: mergedMeasureLocation,
targetText: mentionValue,
prefix: mergedMeasurePrefix,
selectionStart: (_getTextArea = getTextArea()) === null || _getTextArea === void 0 ? void 0 : _getTextArea.selectionStart,
split: split
}),
text = _replaceWithMeasure.text,
selectionLocation = _replaceWithMeasure.selectionLocation;
triggerChange(text);
stopMeasure(function () {
// We need restore the selection position
setInputSelection(getTextArea(), selectionLocation);
});
onSelect === null || onSelect === void 0 || onSelect(option, mergedMeasurePrefix);
};
// ============================= KeyEvent =============================
// Check if hit the measure keyword
var onInternalKeyDown = function onInternalKeyDown(event) {
var which = event.which;
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
// Skip if not measuring
if (!mergedMeasuring) {
return;
}
if (which === KeyCode.UP || which === KeyCode.DOWN) {
// Control arrow function
var optionLen = mergedOptions.length;
var offset = which === KeyCode.UP ? -1 : 1;
var newActiveIndex = (activeIndex + offset + optionLen) % optionLen;
setActiveIndex(newActiveIndex);
event.preventDefault();
} else if (which === KeyCode.ESC) {
stopMeasure();
} else if (which === KeyCode.ENTER) {
// Measure hit
event.preventDefault();
// loading skip
if (silent) {
return;
}
if (!mergedOptions.length) {
stopMeasure();
return;
}
var _option = mergedOptions[activeIndex];
selectOption(_option);
}
};
/**
* When to start measure:
* 1. When user press `prefix`
* 2. When measureText !== prevMeasureText
* - If measure hit
* - If measuring
*
* When to stop measure:
* 1. Selection is out of range
* 2. Contains `space`
* 3. ESC or select one
*/
var onInternalKeyUp = function onInternalKeyUp(event) {
var key = event.key,
which = event.which;
var target = event.target;
var selectionStartText = getBeforeSelectionText(target);
var _getLastMeasureIndex = getLastMeasureIndex(selectionStartText, mergedPrefix),
measureIndex = _getLastMeasureIndex.location,
nextMeasurePrefix = _getLastMeasureIndex.prefix;
// If the client implements an onKeyUp handler, call it
onKeyUp === null || onKeyUp === void 0 || onKeyUp(event);
// Skip if match the white key list
if ([KeyCode.ESC, KeyCode.UP, KeyCode.DOWN, KeyCode.ENTER].indexOf(which) !== -1) {
return;
}
if (measureIndex !== -1) {
var nextMeasureText = selectionStartText.slice(measureIndex + nextMeasurePrefix.length);
var validateMeasure = validateSearch(nextMeasureText, split);
var matchOption = !!getOptions(nextMeasureText).length;
if (validateMeasure) {
// adding AltGraph also fort azert keyboard
if (key === nextMeasurePrefix || key === 'Shift' || which === KeyCode.ALT || key === 'AltGraph' || mergedMeasuring || nextMeasureText !== mergedMeasureText && matchOption) {
startMeasure(nextMeasureText, nextMeasurePrefix, measureIndex);
}
} else if (mergedMeasuring) {
// Stop if measureText is invalidate
stopMeasure();
}
/**
* We will trigger `onSearch` to developer since they may use for async update.
* If met `space` means user finished searching.
*/
if (onSearch && validateMeasure) {
onSearch(nextMeasureText, nextMeasurePrefix);
}
} else if (mergedMeasuring) {
stopMeasure();
}
};
var onInternalPressEnter = function onInternalPressEnter(event) {
if (!mergedMeasuring && onPressEnter) {
onPressEnter(event);
}
};
// ============================ Focus Blur ============================
var focusRef = useRef();
var onInternalFocus = function onInternalFocus(event) {
window.clearTimeout(focusRef.current);
if (!isFocus && event && onFocus) {
onFocus(event);
}
setIsFocus(true);
};
var onInternalBlur = function onInternalBlur(event) {
focusRef.current = window.setTimeout(function () {
setIsFocus(false);
stopMeasure();
onBlur === null || onBlur === void 0 || onBlur(event);
}, 0);
};
var onDropdownFocus = function onDropdownFocus() {
onInternalFocus();
};
var onDropdownBlur = function onDropdownBlur() {
onInternalBlur();
};
// ============================== Scroll ===============================
var onInternalPopupScroll = function onInternalPopupScroll(event) {
onPopupScroll === null || onPopupScroll === void 0 || onPopupScroll(event);
};
// ============================== Render ==============================
return /*#__PURE__*/React.createElement("div", {
className: classNames(prefixCls, className),
style: style,
ref: containerRef
}, /*#__PURE__*/React.createElement(TextArea, _extends({
ref: textareaRef,
value: mergedValue
}, restProps, {
rows: rows,
onChange: onInternalChange,
onKeyDown: onInternalKeyDown,
onKeyUp: onInternalKeyUp,
onPressEnter: onInternalPressEnter,
onFocus: onInternalFocus,
onBlur: onInternalBlur
})), mergedMeasuring && /*#__PURE__*/React.createElement("div", {
ref: measureRef,
className: "".concat(prefixCls, "-measure")
}, mergedValue.slice(0, mergedMeasureLocation), /*#__PURE__*/React.createElement(MentionsContext.Provider, {
value: {
notFoundContent: notFoundContent,
activeIndex: activeIndex,
setActiveIndex: setActiveIndex,
selectOption: selectOption,
onFocus: onDropdownFocus,
onBlur: onDropdownBlur,
onScroll: onInternalPopupScroll
}
}, /*#__PURE__*/React.createElement(KeywordTrigger, {
prefixCls: prefixCls,
transitionName: transitionName,
placement: placement,
direction: direction,
options: mergedOptions,
visible: true,
getPopupContainer: getPopupContainer,
dropdownClassName: dropdownClassName
}, /*#__PURE__*/React.createElement("span", null, mergedMeasurePrefix))), mergedValue.slice(mergedMeasureLocation + mergedMeasurePrefix.length)));
});
var Mentions = /*#__PURE__*/forwardRef(function (_ref3, ref) {
var suffix = _ref3.suffix,
_ref3$prefixCls = _ref3.prefixCls,
prefixCls = _ref3$prefixCls === void 0 ? 'rc-mentions' : _ref3$prefixCls,
defaultValue = _ref3.defaultValue,
customValue = _ref3.value,
allowClear = _ref3.allowClear,
onChange = _ref3.onChange,
classes = _ref3.classNames,
className = _ref3.className,
disabled = _ref3.disabled,
onClear = _ref3.onClear,
rest = _objectWithoutProperties(_ref3, _excluded2);
// =============================== Ref ================================
var holderRef = useRef(null);
var mentionRef = useRef(null);
useImperativeHandle(ref, function () {
var _holderRef$current, _mentionRef$current;
return _objectSpread(_objectSpread({}, mentionRef.current), {}, {
nativeElement: ((_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.nativeElement) || ((_mentionRef$current = mentionRef.current) === null || _mentionRef$current === void 0 ? void 0 : _mentionRef$current.nativeElement)
});
});
// ============================== Value ===============================
var _useMergedState3 = useMergedState('', {
defaultValue: defaultValue,
value: customValue
}),
_useMergedState4 = _slicedToArray(_useMergedState3, 2),
mergedValue = _useMergedState4[0],
setMergedValue = _useMergedState4[1];
// ============================== Change ==============================
var triggerChange = function triggerChange(currentValue) {
setMergedValue(currentValue);
onChange === null || onChange === void 0 || onChange(currentValue);
};
// ============================== Reset ===============================
var handleReset = function handleReset() {
triggerChange('');
};
return /*#__PURE__*/React.createElement(BaseInput, {
suffix: suffix,
prefixCls: prefixCls,
value: mergedValue,
allowClear: allowClear,
handleReset: handleReset,
className: className,
classNames: classes,
disabled: disabled,
ref: holderRef,
onClear: onClear
}, /*#__PURE__*/React.createElement(InternalMentions, _extends({
className: classes === null || classes === void 0 ? void 0 : classes.mentions,
prefixCls: prefixCls,
ref: mentionRef,
onChange: triggerChange,
disabled: disabled
}, rest)));
});
Mentions.Option = Option;
export default Mentions;

13
node_modules/rc-mentions/es/MentionsContext.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import * as React from 'react';
import type { OptionProps } from './Option';
export interface MentionsContextProps {
notFoundContent: React.ReactNode;
activeIndex: number;
setActiveIndex: (index: number) => void;
selectOption: (option: OptionProps) => void;
onFocus: React.FocusEventHandler<HTMLElement>;
onBlur: React.FocusEventHandler<HTMLElement>;
onScroll: React.UIEventHandler<HTMLElement>;
}
declare const MentionsContext: React.Context<MentionsContextProps>;
export default MentionsContext;

5
node_modules/rc-mentions/es/MentionsContext.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
/* tslint:disable: no-object-literal-type-assertion */
import * as React from 'react';
// We will never use default, here only to fix TypeScript warning
var MentionsContext = /*#__PURE__*/React.createContext(null);
export default MentionsContext;

11
node_modules/rc-mentions/es/Option.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import type * as React from 'react';
export interface OptionProps {
value?: string;
key?: string;
disabled?: boolean;
children?: React.ReactNode;
className?: string;
style?: React.CSSProperties;
}
declare const Option: React.FC<OptionProps>;
export default Option;

4
node_modules/rc-mentions/es/Option.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
var Option = function Option() {
return null;
};
export default Option;

View File

@@ -0,0 +1,5 @@
export type Trigger = (callback?: VoidFunction) => void;
/**
* Trigger a callback on state change
*/
export default function useEffectState(): Trigger;

28
node_modules/rc-mentions/es/hooks/useEffectState.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import { useState, useCallback, useEffect } from 'react';
/**
* Trigger a callback on state change
*/
export default function useEffectState() {
var _useState = useState({
id: 0,
callback: null
}),
_useState2 = _slicedToArray(_useState, 2),
effectId = _useState2[0],
setEffectId = _useState2[1];
var update = useCallback(function (callback) {
setEffectId(function (_ref) {
var id = _ref.id;
return {
id: id + 1,
callback: callback
};
});
}, []);
useEffect(function () {
var _effectId$callback;
(_effectId$callback = effectId.callback) === null || _effectId$callback === void 0 || _effectId$callback.call(effectId);
}, [effectId]);
return update;
}

4
node_modules/rc-mentions/es/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import Mentions from './Mentions';
import type { MentionsProps } from './Mentions';
export type { MentionsProps };
export default Mentions;

2
node_modules/rc-mentions/es/index.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import Mentions from "./Mentions";
export default Mentions;

35
node_modules/rc-mentions/es/util.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import type { MentionsProps } from './Mentions';
import type { OptionProps } from './Option';
/**
* Cut input selection into 2 part and return text before selection start
*/
export declare function getBeforeSelectionText(input: HTMLTextAreaElement): string;
interface MeasureIndex {
location: number;
prefix: string;
}
/**
* Find the last match prefix index
*/
export declare function getLastMeasureIndex(text: string, prefix: string[]): MeasureIndex;
interface MeasureConfig {
measureLocation: number;
prefix: string;
targetText: string;
selectionStart: number;
split: string;
}
/**
* Paint targetText into current text:
* text: little@litest
* targetText: light
* => little @light test
*/
export declare function replaceWithMeasure(text: string, measureConfig: MeasureConfig): {
text: string;
selectionLocation: number;
};
export declare function setInputSelection(input: HTMLTextAreaElement, location: number): void;
export declare function validateSearch(text: string, split: MentionsProps['split']): boolean;
export declare function filterOption(input: string, { value }: OptionProps): boolean;
export {};

100
node_modules/rc-mentions/es/util.js generated vendored Normal file
View File

@@ -0,0 +1,100 @@
/**
* Cut input selection into 2 part and return text before selection start
*/
export function getBeforeSelectionText(input) {
var selectionStart = input.selectionStart;
return input.value.slice(0, selectionStart);
}
/**
* Find the last match prefix index
*/
export function getLastMeasureIndex(text, prefix) {
return prefix.reduce(function (lastMatch, prefixStr) {
var lastIndex = text.lastIndexOf(prefixStr);
if (lastIndex > lastMatch.location) {
return {
location: lastIndex,
prefix: prefixStr
};
}
return lastMatch;
}, {
location: -1,
prefix: ''
});
}
function lower(char) {
return (char || '').toLowerCase();
}
function reduceText(text, targetText, split) {
var firstChar = text[0];
if (!firstChar || firstChar === split) {
return text;
}
// Reuse rest text as it can
var restText = text;
var targetTextLen = targetText.length;
for (var i = 0; i < targetTextLen; i += 1) {
if (lower(restText[i]) !== lower(targetText[i])) {
restText = restText.slice(i);
break;
} else if (i === targetTextLen - 1) {
restText = restText.slice(targetTextLen);
}
}
return restText;
}
/**
* Paint targetText into current text:
* text: little@litest
* targetText: light
* => little @light test
*/
export function replaceWithMeasure(text, measureConfig) {
var measureLocation = measureConfig.measureLocation,
prefix = measureConfig.prefix,
targetText = measureConfig.targetText,
selectionStart = measureConfig.selectionStart,
split = measureConfig.split;
// Before text will append one space if have other text
var beforeMeasureText = text.slice(0, measureLocation);
if (beforeMeasureText[beforeMeasureText.length - split.length] === split) {
beforeMeasureText = beforeMeasureText.slice(0, beforeMeasureText.length - split.length);
}
if (beforeMeasureText) {
beforeMeasureText = "".concat(beforeMeasureText).concat(split);
}
// Cut duplicate string with current targetText
var restText = reduceText(text.slice(selectionStart), targetText.slice(selectionStart - measureLocation - prefix.length), split);
if (restText.slice(0, split.length) === split) {
restText = restText.slice(split.length);
}
var connectedStartText = "".concat(beforeMeasureText).concat(prefix).concat(targetText).concat(split);
return {
text: "".concat(connectedStartText).concat(restText),
selectionLocation: connectedStartText.length
};
}
export function setInputSelection(input, location) {
input.setSelectionRange(location, location);
/**
* Reset caret into view.
* Since this function always called by user control, it's safe to focus element.
*/
input.blur();
input.focus();
}
export function validateSearch(text, split) {
return !split || text.indexOf(split) === -1;
}
export function filterOption(input, _ref) {
var _ref$value = _ref.value,
value = _ref$value === void 0 ? '' : _ref$value;
var lowerCase = input.toLowerCase();
return value.toLowerCase().indexOf(lowerCase) !== -1;
}

12
node_modules/rc-mentions/lib/DropdownMenu.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import * as React from 'react';
import type { DataDrivenOptionProps } from './Mentions';
interface DropdownMenuProps {
prefixCls?: string;
options: DataDrivenOptionProps[];
}
/**
* We only use Menu to display the candidate.
* The focus is controlled by textarea to make accessibility easy.
*/
declare function DropdownMenu(props: DropdownMenuProps): React.JSX.Element;
export default DropdownMenu;

61
node_modules/rc-mentions/lib/DropdownMenu.js generated vendored Normal file
View File

@@ -0,0 +1,61 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rcMenu = _interopRequireWildcard(require("rc-menu"));
var React = _interopRequireWildcard(require("react"));
var _MentionsContext = _interopRequireDefault(require("./MentionsContext"));
/**
* We only use Menu to display the candidate.
* The focus is controlled by textarea to make accessibility easy.
*/
function DropdownMenu(props) {
var _React$useContext = React.useContext(_MentionsContext.default),
notFoundContent = _React$useContext.notFoundContent,
activeIndex = _React$useContext.activeIndex,
setActiveIndex = _React$useContext.setActiveIndex,
selectOption = _React$useContext.selectOption,
onFocus = _React$useContext.onFocus,
onBlur = _React$useContext.onBlur,
onScroll = _React$useContext.onScroll;
var prefixCls = props.prefixCls,
options = props.options;
var activeOption = options[activeIndex] || {};
return /*#__PURE__*/React.createElement(_rcMenu.default, {
prefixCls: "".concat(prefixCls, "-menu"),
activeKey: activeOption.key,
onSelect: function onSelect(_ref) {
var key = _ref.key;
var option = options.find(function (_ref2) {
var optionKey = _ref2.key;
return optionKey === key;
});
selectOption(option);
},
onFocus: onFocus,
onBlur: onBlur,
onScroll: onScroll
}, options.map(function (option, index) {
var key = option.key,
disabled = option.disabled,
className = option.className,
style = option.style,
label = option.label;
return /*#__PURE__*/React.createElement(_rcMenu.MenuItem, {
key: key,
disabled: disabled,
className: className,
style: style,
onMouseEnter: function onMouseEnter() {
setActiveIndex(index);
}
}, label);
}), !options.length && /*#__PURE__*/React.createElement(_rcMenu.MenuItem, {
disabled: true
}, notFoundContent));
}
var _default = exports.default = DropdownMenu;

17
node_modules/rc-mentions/lib/KeywordTrigger.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import type { FC } from 'react';
import * as React from 'react';
import type { DataDrivenOptionProps, Direction, Placement } from './Mentions';
interface KeywordTriggerProps {
loading?: boolean;
options: DataDrivenOptionProps[];
prefixCls?: string;
placement?: Placement;
direction?: Direction;
visible?: boolean;
transitionName?: string;
children?: React.ReactElement;
getPopupContainer?: () => HTMLElement;
dropdownClassName?: string;
}
declare const KeywordTrigger: FC<KeywordTriggerProps>;
export default KeywordTrigger;

82
node_modules/rc-mentions/lib/KeywordTrigger.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _trigger = _interopRequireDefault(require("@rc-component/trigger"));
var _react = _interopRequireWildcard(require("react"));
var React = _react;
var _DropdownMenu = _interopRequireDefault(require("./DropdownMenu"));
var BUILT_IN_PLACEMENTS = {
bottomRight: {
points: ['tl', 'br'],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
bottomLeft: {
points: ['tr', 'bl'],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
topRight: {
points: ['bl', 'tr'],
offset: [0, -4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
topLeft: {
points: ['br', 'tl'],
offset: [0, -4],
overflow: {
adjustX: 1,
adjustY: 1
}
}
};
var KeywordTrigger = function KeywordTrigger(props) {
var prefixCls = props.prefixCls,
options = props.options,
children = props.children,
visible = props.visible,
transitionName = props.transitionName,
getPopupContainer = props.getPopupContainer,
dropdownClassName = props.dropdownClassName,
direction = props.direction,
placement = props.placement;
var dropdownPrefix = "".concat(prefixCls, "-dropdown");
var dropdownElement = /*#__PURE__*/React.createElement(_DropdownMenu.default, {
prefixCls: dropdownPrefix,
options: options
});
var dropdownPlacement = (0, _react.useMemo)(function () {
var popupPlacement;
if (direction === 'rtl') {
popupPlacement = placement === 'top' ? 'topLeft' : 'bottomLeft';
} else {
popupPlacement = placement === 'top' ? 'topRight' : 'bottomRight';
}
return popupPlacement;
}, [direction, placement]);
return /*#__PURE__*/React.createElement(_trigger.default, {
prefixCls: dropdownPrefix,
popupVisible: visible,
popup: dropdownElement,
popupPlacement: dropdownPlacement,
popupTransitionName: transitionName,
builtinPlacements: BUILT_IN_PLACEMENTS,
getPopupContainer: getPopupContainer,
popupClassName: dropdownClassName
}, children);
};
var _default = exports.default = KeywordTrigger;

55
node_modules/rc-mentions/lib/Mentions.d.ts generated vendored Normal file
View File

@@ -0,0 +1,55 @@
import type { CommonInputProps } from 'rc-input/lib/interface';
import type { TextAreaProps } from 'rc-textarea';
import React from 'react';
import type { OptionProps } from './Option';
import Option from './Option';
import { filterOption as defaultFilterOption, validateSearch as defaultValidateSearch } from './util';
type BaseTextareaAttrs = Omit<TextAreaProps, 'prefix' | 'onChange' | 'onSelect' | 'showCount' | 'classNames'>;
export type Placement = 'top' | 'bottom';
export type Direction = 'ltr' | 'rtl';
export interface DataDrivenOptionProps extends Omit<OptionProps, 'children'> {
label?: React.ReactNode;
}
export interface MentionsProps extends BaseTextareaAttrs {
autoFocus?: boolean;
className?: string;
defaultValue?: string;
notFoundContent?: React.ReactNode;
split?: string;
style?: React.CSSProperties;
transitionName?: string;
placement?: Placement;
direction?: Direction;
prefix?: string | string[];
prefixCls?: string;
value?: string;
silent?: boolean;
filterOption?: false | typeof defaultFilterOption;
validateSearch?: typeof defaultValidateSearch;
onChange?: (text: string) => void;
onSelect?: (option: OptionProps, prefix: string) => void;
onSearch?: (text: string, prefix: string) => void;
onFocus?: React.FocusEventHandler<HTMLTextAreaElement>;
onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;
getPopupContainer?: () => HTMLElement;
dropdownClassName?: string;
/** @private Testing usage. Do not use in prod. It will not work as your expect. */
open?: boolean;
children?: React.ReactNode;
options?: DataDrivenOptionProps[];
classNames?: CommonInputProps['classNames'] & {
mentions?: string;
};
onPopupScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
}
export interface MentionsRef {
focus: VoidFunction;
blur: VoidFunction;
/** @deprecated It may not work as expected */
textarea: HTMLTextAreaElement | null;
nativeElement: HTMLElement;
}
declare const Mentions: React.ForwardRefExoticComponent<MentionsProps & React.RefAttributes<MentionsRef>> & {
Option: typeof Option;
};
export default Mentions;

462
node_modules/rc-mentions/lib/Mentions.js generated vendored Normal file
View File

@@ -0,0 +1,462 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _classnames = _interopRequireDefault(require("classnames"));
var _rcInput = require("rc-input");
var _rcTextarea = _interopRequireDefault(require("rc-textarea"));
var _toArray = _interopRequireDefault(require("rc-util/lib/Children/toArray"));
var _useMergedState5 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
var _KeyCode = _interopRequireDefault(require("rc-util/lib/KeyCode"));
var _warning = _interopRequireDefault(require("rc-util/lib/warning"));
var _react = _interopRequireWildcard(require("react"));
var _useEffectState = _interopRequireDefault(require("./hooks/useEffectState"));
var _KeywordTrigger = _interopRequireDefault(require("./KeywordTrigger"));
var _MentionsContext = _interopRequireDefault(require("./MentionsContext"));
var _Option = _interopRequireDefault(require("./Option"));
var _util = require("./util");
var _excluded = ["prefixCls", "className", "style", "prefix", "split", "notFoundContent", "value", "defaultValue", "children", "options", "open", "allowClear", "silent", "validateSearch", "filterOption", "onChange", "onKeyDown", "onKeyUp", "onPressEnter", "onSearch", "onSelect", "onFocus", "onBlur", "transitionName", "placement", "direction", "getPopupContainer", "dropdownClassName", "rows", "visible", "onPopupScroll"],
_excluded2 = ["suffix", "prefixCls", "defaultValue", "value", "allowClear", "onChange", "classNames", "className", "disabled", "onClear"];
var InternalMentions = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
var prefixCls = props.prefixCls,
className = props.className,
style = props.style,
_props$prefix = props.prefix,
prefix = _props$prefix === void 0 ? '@' : _props$prefix,
_props$split = props.split,
split = _props$split === void 0 ? ' ' : _props$split,
_props$notFoundConten = props.notFoundContent,
notFoundContent = _props$notFoundConten === void 0 ? 'Not Found' : _props$notFoundConten,
value = props.value,
defaultValue = props.defaultValue,
children = props.children,
options = props.options,
open = props.open,
allowClear = props.allowClear,
silent = props.silent,
_props$validateSearch = props.validateSearch,
validateSearch = _props$validateSearch === void 0 ? _util.validateSearch : _props$validateSearch,
_props$filterOption = props.filterOption,
filterOption = _props$filterOption === void 0 ? _util.filterOption : _props$filterOption,
onChange = props.onChange,
onKeyDown = props.onKeyDown,
onKeyUp = props.onKeyUp,
onPressEnter = props.onPressEnter,
onSearch = props.onSearch,
onSelect = props.onSelect,
onFocus = props.onFocus,
onBlur = props.onBlur,
transitionName = props.transitionName,
placement = props.placement,
direction = props.direction,
getPopupContainer = props.getPopupContainer,
dropdownClassName = props.dropdownClassName,
_props$rows = props.rows,
rows = _props$rows === void 0 ? 1 : _props$rows,
visible = props.visible,
onPopupScroll = props.onPopupScroll,
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
var mergedPrefix = (0, _react.useMemo)(function () {
return Array.isArray(prefix) ? prefix : [prefix];
}, [prefix]);
// =============================== Refs ===============================
var containerRef = (0, _react.useRef)(null);
var textareaRef = (0, _react.useRef)(null);
var measureRef = (0, _react.useRef)(null);
var getTextArea = function getTextArea() {
var _textareaRef$current;
return (_textareaRef$current = textareaRef.current) === null || _textareaRef$current === void 0 || (_textareaRef$current = _textareaRef$current.resizableTextArea) === null || _textareaRef$current === void 0 ? void 0 : _textareaRef$current.textArea;
};
_react.default.useImperativeHandle(ref, function () {
var _textareaRef$current4;
return {
focus: function focus() {
var _textareaRef$current2;
return (_textareaRef$current2 = textareaRef.current) === null || _textareaRef$current2 === void 0 ? void 0 : _textareaRef$current2.focus();
},
blur: function blur() {
var _textareaRef$current3;
return (_textareaRef$current3 = textareaRef.current) === null || _textareaRef$current3 === void 0 ? void 0 : _textareaRef$current3.blur();
},
textarea: (_textareaRef$current4 = textareaRef.current) === null || _textareaRef$current4 === void 0 || (_textareaRef$current4 = _textareaRef$current4.resizableTextArea) === null || _textareaRef$current4 === void 0 ? void 0 : _textareaRef$current4.textArea,
nativeElement: containerRef.current
};
});
// ============================== State ===============================
var _useState = (0, _react.useState)(false),
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
measuring = _useState2[0],
setMeasuring = _useState2[1];
var _useState3 = (0, _react.useState)(''),
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
measureText = _useState4[0],
setMeasureText = _useState4[1];
var _useState5 = (0, _react.useState)(''),
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
measurePrefix = _useState6[0],
setMeasurePrefix = _useState6[1];
var _useState7 = (0, _react.useState)(0),
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
measureLocation = _useState8[0],
setMeasureLocation = _useState8[1];
var _useState9 = (0, _react.useState)(0),
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
activeIndex = _useState10[0],
setActiveIndex = _useState10[1];
var _useState11 = (0, _react.useState)(false),
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
isFocus = _useState12[0],
setIsFocus = _useState12[1];
// ============================== Value ===============================
var _useMergedState = (0, _useMergedState5.default)('', {
defaultValue: defaultValue,
value: value
}),
_useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2),
mergedValue = _useMergedState2[0],
setMergedValue = _useMergedState2[1];
// =============================== Open ===============================
(0, _react.useEffect)(function () {
// Sync measure div top with textarea for rc-trigger usage
if (measuring && measureRef.current) {
measureRef.current.scrollTop = getTextArea().scrollTop;
}
}, [measuring]);
var _React$useMemo = _react.default.useMemo(function () {
if (open) {
if (process.env.NODE_ENV !== 'production') {
(0, _warning.default)(false, '`open` of Mentions is only used for debug usage. Do not use in you production.');
}
for (var i = 0; i < mergedPrefix.length; i += 1) {
var curPrefix = mergedPrefix[i];
var index = mergedValue.lastIndexOf(curPrefix);
if (index >= 0) {
return [true, '', curPrefix, index];
}
}
}
return [measuring, measureText, measurePrefix, measureLocation];
}, [open, measuring, mergedPrefix, mergedValue, measureText, measurePrefix, measureLocation]),
_React$useMemo2 = (0, _slicedToArray2.default)(_React$useMemo, 4),
mergedMeasuring = _React$useMemo2[0],
mergedMeasureText = _React$useMemo2[1],
mergedMeasurePrefix = _React$useMemo2[2],
mergedMeasureLocation = _React$useMemo2[3];
// ============================== Option ==============================
var getOptions = _react.default.useCallback(function (targetMeasureText) {
var list;
if (options && options.length > 0) {
list = options.map(function (item) {
var _item$key;
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
key: (_item$key = item === null || item === void 0 ? void 0 : item.key) !== null && _item$key !== void 0 ? _item$key : item.value
});
});
} else {
list = (0, _toArray.default)(children).map(function (_ref) {
var optionProps = _ref.props,
key = _ref.key;
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, optionProps), {}, {
label: optionProps.children,
key: key || optionProps.value
});
});
}
return list.filter(function (option) {
/** Return all result if `filterOption` is false. */
if (filterOption === false) {
return true;
}
return filterOption(targetMeasureText, option);
});
}, [children, options, filterOption]);
var mergedOptions = _react.default.useMemo(function () {
return getOptions(mergedMeasureText);
}, [getOptions, mergedMeasureText]);
// ============================= Measure ==============================
// Mark that we will reset input selection to target position when user select option
var onSelectionEffect = (0, _useEffectState.default)();
var startMeasure = function startMeasure(nextMeasureText, nextMeasurePrefix, nextMeasureLocation) {
setMeasuring(true);
setMeasureText(nextMeasureText);
setMeasurePrefix(nextMeasurePrefix);
setMeasureLocation(nextMeasureLocation);
setActiveIndex(0);
};
var stopMeasure = function stopMeasure(callback) {
setMeasuring(false);
setMeasureLocation(0);
setMeasureText('');
onSelectionEffect(callback);
};
// ============================== Change ==============================
var triggerChange = function triggerChange(nextValue) {
setMergedValue(nextValue);
onChange === null || onChange === void 0 || onChange(nextValue);
};
var onInternalChange = function onInternalChange(_ref2) {
var nextValue = _ref2.target.value;
triggerChange(nextValue);
};
var selectOption = function selectOption(option) {
var _getTextArea;
var _option$value = option.value,
mentionValue = _option$value === void 0 ? '' : _option$value;
var _replaceWithMeasure = (0, _util.replaceWithMeasure)(mergedValue, {
measureLocation: mergedMeasureLocation,
targetText: mentionValue,
prefix: mergedMeasurePrefix,
selectionStart: (_getTextArea = getTextArea()) === null || _getTextArea === void 0 ? void 0 : _getTextArea.selectionStart,
split: split
}),
text = _replaceWithMeasure.text,
selectionLocation = _replaceWithMeasure.selectionLocation;
triggerChange(text);
stopMeasure(function () {
// We need restore the selection position
(0, _util.setInputSelection)(getTextArea(), selectionLocation);
});
onSelect === null || onSelect === void 0 || onSelect(option, mergedMeasurePrefix);
};
// ============================= KeyEvent =============================
// Check if hit the measure keyword
var onInternalKeyDown = function onInternalKeyDown(event) {
var which = event.which;
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
// Skip if not measuring
if (!mergedMeasuring) {
return;
}
if (which === _KeyCode.default.UP || which === _KeyCode.default.DOWN) {
// Control arrow function
var optionLen = mergedOptions.length;
var offset = which === _KeyCode.default.UP ? -1 : 1;
var newActiveIndex = (activeIndex + offset + optionLen) % optionLen;
setActiveIndex(newActiveIndex);
event.preventDefault();
} else if (which === _KeyCode.default.ESC) {
stopMeasure();
} else if (which === _KeyCode.default.ENTER) {
// Measure hit
event.preventDefault();
// loading skip
if (silent) {
return;
}
if (!mergedOptions.length) {
stopMeasure();
return;
}
var _option = mergedOptions[activeIndex];
selectOption(_option);
}
};
/**
* When to start measure:
* 1. When user press `prefix`
* 2. When measureText !== prevMeasureText
* - If measure hit
* - If measuring
*
* When to stop measure:
* 1. Selection is out of range
* 2. Contains `space`
* 3. ESC or select one
*/
var onInternalKeyUp = function onInternalKeyUp(event) {
var key = event.key,
which = event.which;
var target = event.target;
var selectionStartText = (0, _util.getBeforeSelectionText)(target);
var _getLastMeasureIndex = (0, _util.getLastMeasureIndex)(selectionStartText, mergedPrefix),
measureIndex = _getLastMeasureIndex.location,
nextMeasurePrefix = _getLastMeasureIndex.prefix;
// If the client implements an onKeyUp handler, call it
onKeyUp === null || onKeyUp === void 0 || onKeyUp(event);
// Skip if match the white key list
if ([_KeyCode.default.ESC, _KeyCode.default.UP, _KeyCode.default.DOWN, _KeyCode.default.ENTER].indexOf(which) !== -1) {
return;
}
if (measureIndex !== -1) {
var nextMeasureText = selectionStartText.slice(measureIndex + nextMeasurePrefix.length);
var validateMeasure = validateSearch(nextMeasureText, split);
var matchOption = !!getOptions(nextMeasureText).length;
if (validateMeasure) {
// adding AltGraph also fort azert keyboard
if (key === nextMeasurePrefix || key === 'Shift' || which === _KeyCode.default.ALT || key === 'AltGraph' || mergedMeasuring || nextMeasureText !== mergedMeasureText && matchOption) {
startMeasure(nextMeasureText, nextMeasurePrefix, measureIndex);
}
} else if (mergedMeasuring) {
// Stop if measureText is invalidate
stopMeasure();
}
/**
* We will trigger `onSearch` to developer since they may use for async update.
* If met `space` means user finished searching.
*/
if (onSearch && validateMeasure) {
onSearch(nextMeasureText, nextMeasurePrefix);
}
} else if (mergedMeasuring) {
stopMeasure();
}
};
var onInternalPressEnter = function onInternalPressEnter(event) {
if (!mergedMeasuring && onPressEnter) {
onPressEnter(event);
}
};
// ============================ Focus Blur ============================
var focusRef = (0, _react.useRef)();
var onInternalFocus = function onInternalFocus(event) {
window.clearTimeout(focusRef.current);
if (!isFocus && event && onFocus) {
onFocus(event);
}
setIsFocus(true);
};
var onInternalBlur = function onInternalBlur(event) {
focusRef.current = window.setTimeout(function () {
setIsFocus(false);
stopMeasure();
onBlur === null || onBlur === void 0 || onBlur(event);
}, 0);
};
var onDropdownFocus = function onDropdownFocus() {
onInternalFocus();
};
var onDropdownBlur = function onDropdownBlur() {
onInternalBlur();
};
// ============================== Scroll ===============================
var onInternalPopupScroll = function onInternalPopupScroll(event) {
onPopupScroll === null || onPopupScroll === void 0 || onPopupScroll(event);
};
// ============================== Render ==============================
return /*#__PURE__*/_react.default.createElement("div", {
className: (0, _classnames.default)(prefixCls, className),
style: style,
ref: containerRef
}, /*#__PURE__*/_react.default.createElement(_rcTextarea.default, (0, _extends2.default)({
ref: textareaRef,
value: mergedValue
}, restProps, {
rows: rows,
onChange: onInternalChange,
onKeyDown: onInternalKeyDown,
onKeyUp: onInternalKeyUp,
onPressEnter: onInternalPressEnter,
onFocus: onInternalFocus,
onBlur: onInternalBlur
})), mergedMeasuring && /*#__PURE__*/_react.default.createElement("div", {
ref: measureRef,
className: "".concat(prefixCls, "-measure")
}, mergedValue.slice(0, mergedMeasureLocation), /*#__PURE__*/_react.default.createElement(_MentionsContext.default.Provider, {
value: {
notFoundContent: notFoundContent,
activeIndex: activeIndex,
setActiveIndex: setActiveIndex,
selectOption: selectOption,
onFocus: onDropdownFocus,
onBlur: onDropdownBlur,
onScroll: onInternalPopupScroll
}
}, /*#__PURE__*/_react.default.createElement(_KeywordTrigger.default, {
prefixCls: prefixCls,
transitionName: transitionName,
placement: placement,
direction: direction,
options: mergedOptions,
visible: true,
getPopupContainer: getPopupContainer,
dropdownClassName: dropdownClassName
}, /*#__PURE__*/_react.default.createElement("span", null, mergedMeasurePrefix))), mergedValue.slice(mergedMeasureLocation + mergedMeasurePrefix.length)));
});
var Mentions = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
var suffix = _ref3.suffix,
_ref3$prefixCls = _ref3.prefixCls,
prefixCls = _ref3$prefixCls === void 0 ? 'rc-mentions' : _ref3$prefixCls,
defaultValue = _ref3.defaultValue,
customValue = _ref3.value,
allowClear = _ref3.allowClear,
onChange = _ref3.onChange,
classes = _ref3.classNames,
className = _ref3.className,
disabled = _ref3.disabled,
onClear = _ref3.onClear,
rest = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
// =============================== Ref ================================
var holderRef = (0, _react.useRef)(null);
var mentionRef = (0, _react.useRef)(null);
(0, _react.useImperativeHandle)(ref, function () {
var _holderRef$current, _mentionRef$current;
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, mentionRef.current), {}, {
nativeElement: ((_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.nativeElement) || ((_mentionRef$current = mentionRef.current) === null || _mentionRef$current === void 0 ? void 0 : _mentionRef$current.nativeElement)
});
});
// ============================== Value ===============================
var _useMergedState3 = (0, _useMergedState5.default)('', {
defaultValue: defaultValue,
value: customValue
}),
_useMergedState4 = (0, _slicedToArray2.default)(_useMergedState3, 2),
mergedValue = _useMergedState4[0],
setMergedValue = _useMergedState4[1];
// ============================== Change ==============================
var triggerChange = function triggerChange(currentValue) {
setMergedValue(currentValue);
onChange === null || onChange === void 0 || onChange(currentValue);
};
// ============================== Reset ===============================
var handleReset = function handleReset() {
triggerChange('');
};
return /*#__PURE__*/_react.default.createElement(_rcInput.BaseInput, {
suffix: suffix,
prefixCls: prefixCls,
value: mergedValue,
allowClear: allowClear,
handleReset: handleReset,
className: className,
classNames: classes,
disabled: disabled,
ref: holderRef,
onClear: onClear
}, /*#__PURE__*/_react.default.createElement(InternalMentions, (0, _extends2.default)({
className: classes === null || classes === void 0 ? void 0 : classes.mentions,
prefixCls: prefixCls,
ref: mentionRef,
onChange: triggerChange,
disabled: disabled
}, rest)));
});
Mentions.Option = _Option.default;
var _default = exports.default = Mentions;

13
node_modules/rc-mentions/lib/MentionsContext.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import * as React from 'react';
import type { OptionProps } from './Option';
export interface MentionsContextProps {
notFoundContent: React.ReactNode;
activeIndex: number;
setActiveIndex: (index: number) => void;
selectOption: (option: OptionProps) => void;
onFocus: React.FocusEventHandler<HTMLElement>;
onBlur: React.FocusEventHandler<HTMLElement>;
onScroll: React.UIEventHandler<HTMLElement>;
}
declare const MentionsContext: React.Context<MentionsContextProps>;
export default MentionsContext;

13
node_modules/rc-mentions/lib/MentionsContext.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
/* tslint:disable: no-object-literal-type-assertion */
// We will never use default, here only to fix TypeScript warning
var MentionsContext = /*#__PURE__*/React.createContext(null);
var _default = exports.default = MentionsContext;

11
node_modules/rc-mentions/lib/Option.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import type * as React from 'react';
export interface OptionProps {
value?: string;
key?: string;
disabled?: boolean;
children?: React.ReactNode;
className?: string;
style?: React.CSSProperties;
}
declare const Option: React.FC<OptionProps>;
export default Option;

10
node_modules/rc-mentions/lib/Option.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var Option = function Option() {
return null;
};
var _default = exports.default = Option;

View File

@@ -0,0 +1,5 @@
export type Trigger = (callback?: VoidFunction) => void;
/**
* Trigger a callback on state change
*/
export default function useEffectState(): Trigger;

35
node_modules/rc-mentions/lib/hooks/useEffectState.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useEffectState;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _react = require("react");
/**
* Trigger a callback on state change
*/
function useEffectState() {
var _useState = (0, _react.useState)({
id: 0,
callback: null
}),
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
effectId = _useState2[0],
setEffectId = _useState2[1];
var update = (0, _react.useCallback)(function (callback) {
setEffectId(function (_ref) {
var id = _ref.id;
return {
id: id + 1,
callback: callback
};
});
}, []);
(0, _react.useEffect)(function () {
var _effectId$callback;
(_effectId$callback = effectId.callback) === null || _effectId$callback === void 0 || _effectId$callback.call(effectId);
}, [effectId]);
return update;
}

4
node_modules/rc-mentions/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import Mentions from './Mentions';
import type { MentionsProps } from './Mentions';
export type { MentionsProps };
export default Mentions;

9
node_modules/rc-mentions/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _Mentions = _interopRequireDefault(require("./Mentions"));
var _default = exports.default = _Mentions.default;

35
node_modules/rc-mentions/lib/util.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import type { MentionsProps } from './Mentions';
import type { OptionProps } from './Option';
/**
* Cut input selection into 2 part and return text before selection start
*/
export declare function getBeforeSelectionText(input: HTMLTextAreaElement): string;
interface MeasureIndex {
location: number;
prefix: string;
}
/**
* Find the last match prefix index
*/
export declare function getLastMeasureIndex(text: string, prefix: string[]): MeasureIndex;
interface MeasureConfig {
measureLocation: number;
prefix: string;
targetText: string;
selectionStart: number;
split: string;
}
/**
* Paint targetText into current text:
* text: little@litest
* targetText: light
* => little @light test
*/
export declare function replaceWithMeasure(text: string, measureConfig: MeasureConfig): {
text: string;
selectionLocation: number;
};
export declare function setInputSelection(input: HTMLTextAreaElement, location: number): void;
export declare function validateSearch(text: string, split: MentionsProps['split']): boolean;
export declare function filterOption(input: string, { value }: OptionProps): boolean;
export {};

111
node_modules/rc-mentions/lib/util.js generated vendored Normal file
View File

@@ -0,0 +1,111 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.filterOption = filterOption;
exports.getBeforeSelectionText = getBeforeSelectionText;
exports.getLastMeasureIndex = getLastMeasureIndex;
exports.replaceWithMeasure = replaceWithMeasure;
exports.setInputSelection = setInputSelection;
exports.validateSearch = validateSearch;
/**
* Cut input selection into 2 part and return text before selection start
*/
function getBeforeSelectionText(input) {
var selectionStart = input.selectionStart;
return input.value.slice(0, selectionStart);
}
/**
* Find the last match prefix index
*/
function getLastMeasureIndex(text, prefix) {
return prefix.reduce(function (lastMatch, prefixStr) {
var lastIndex = text.lastIndexOf(prefixStr);
if (lastIndex > lastMatch.location) {
return {
location: lastIndex,
prefix: prefixStr
};
}
return lastMatch;
}, {
location: -1,
prefix: ''
});
}
function lower(char) {
return (char || '').toLowerCase();
}
function reduceText(text, targetText, split) {
var firstChar = text[0];
if (!firstChar || firstChar === split) {
return text;
}
// Reuse rest text as it can
var restText = text;
var targetTextLen = targetText.length;
for (var i = 0; i < targetTextLen; i += 1) {
if (lower(restText[i]) !== lower(targetText[i])) {
restText = restText.slice(i);
break;
} else if (i === targetTextLen - 1) {
restText = restText.slice(targetTextLen);
}
}
return restText;
}
/**
* Paint targetText into current text:
* text: little@litest
* targetText: light
* => little @light test
*/
function replaceWithMeasure(text, measureConfig) {
var measureLocation = measureConfig.measureLocation,
prefix = measureConfig.prefix,
targetText = measureConfig.targetText,
selectionStart = measureConfig.selectionStart,
split = measureConfig.split;
// Before text will append one space if have other text
var beforeMeasureText = text.slice(0, measureLocation);
if (beforeMeasureText[beforeMeasureText.length - split.length] === split) {
beforeMeasureText = beforeMeasureText.slice(0, beforeMeasureText.length - split.length);
}
if (beforeMeasureText) {
beforeMeasureText = "".concat(beforeMeasureText).concat(split);
}
// Cut duplicate string with current targetText
var restText = reduceText(text.slice(selectionStart), targetText.slice(selectionStart - measureLocation - prefix.length), split);
if (restText.slice(0, split.length) === split) {
restText = restText.slice(split.length);
}
var connectedStartText = "".concat(beforeMeasureText).concat(prefix).concat(targetText).concat(split);
return {
text: "".concat(connectedStartText).concat(restText),
selectionLocation: connectedStartText.length
};
}
function setInputSelection(input, location) {
input.setSelectionRange(location, location);
/**
* Reset caret into view.
* Since this function always called by user control, it's safe to focus element.
*/
input.blur();
input.focus();
}
function validateSearch(text, split) {
return !split || text.indexOf(split) === -1;
}
function filterOption(input, _ref) {
var _ref$value = _ref.value,
value = _ref$value === void 0 ? '' : _ref$value;
var lowerCase = input.toLowerCase();
return value.toLowerCase().indexOf(lowerCase) !== -1;
}

82
node_modules/rc-mentions/package.json generated vendored Normal file
View File

@@ -0,0 +1,82 @@
{
"name": "rc-mentions",
"version": "2.20.0",
"description": "React Mentions",
"keywords": [
"react",
"react-component",
"react-mentions",
"mentions"
],
"homepage": "http://github.com/react-component/mentions",
"bugs": {
"url": "http://github.com/react-component/mentions/issues"
},
"repository": {
"type": "git",
"url": "git@github.com:react-component/mentions.git"
},
"license": "MIT",
"main": "./lib/index",
"module": "./es/index",
"files": [
"assets/*.css",
"es",
"dist",
"lib"
],
"scripts": {
"compile": "father build",
"coverage": "rc-test --coverage",
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d .doc",
"gh-pages": "npm run docs:build && npm run docs:deploy",
"lint": "eslint src/ --ext .tsx,.ts",
"prepare": "husky install",
"prepublishOnly": "npm run compile && np --yolo --no-publish --branch=antd-5.x",
"postpublish": "npm run gh-pages",
"start": "dumi dev",
"test": "rc-test"
},
"lint-staged": {
"**/*.{js,jsx,tsx,ts,md,json}": [
"prettier --write",
"git add"
]
},
"dependencies": {
"@babel/runtime": "^7.22.5",
"@rc-component/trigger": "^2.0.0",
"classnames": "^2.2.6",
"rc-input": "~1.8.0",
"rc-menu": "~9.16.0",
"rc-textarea": "~1.10.0",
"rc-util": "^5.34.1"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@types/classnames": "^2.2.6",
"@types/react": "^18.0.8",
"@types/react-dom": "^18.0.3",
"@types/warning": "^3.0.0",
"@umijs/fabric": "^3.0.0",
"dumi": "^2.0.18",
"eslint": "^7.0.0",
"father": "^4.0.0",
"gh-pages": "^5.0.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.7",
"np": "^10.0.0",
"prettier": "^3.3.2",
"rc-test": "^7.0.14",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"typescript": "^5.0.4"
},
"peerDependencies": {
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
}
}