@univerjs/design 0.1.11 → 0.1.13

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.
@@ -1,27 +1,37 @@
1
+ import { CSSProperties, ReactElement } from 'react';
1
2
  import { IDisposable } from '../../type';
2
3
 
3
4
  export declare enum MessageType {
4
5
  Success = "success",
6
+ Info = "info",
5
7
  Warning = "warning",
6
- Error = "error"
8
+ Error = "error",
9
+ Loading = "loading"
7
10
  }
8
11
  export interface IMessageProps {
9
- key: number;
12
+ key: string;
10
13
  type: MessageType;
11
- content?: string;
12
- }
13
- export interface IMessageMethodOptions {
14
14
  content: string;
15
- delay?: number;
15
+ icon?: ReactElement;
16
+ style?: CSSProperties;
17
+ }
18
+ export interface IMessageOptions extends Partial<Pick<IMessageProps, 'key' | 'type'>>, Pick<IMessageProps, 'content'> {
19
+ /**
20
+ * After `duration` milliseconds, the message would be removed automatically. However, if `duration` is set to 0,
21
+ * the message would not be removed automatically.
22
+ */
23
+ duration?: number;
16
24
  }
17
25
  export declare class Message {
18
26
  protected _container: HTMLDivElement;
19
27
  protected _messages: IMessageProps[];
20
28
  constructor(container: HTMLElement);
21
- append(type: MessageType, options: IMessageMethodOptions): IDisposable;
22
- teardown(key: number): void;
29
+ append(type: MessageType, options: IMessageOptions): IDisposable;
30
+ teardown(key: string): void;
23
31
  render(): void;
24
- success(options: IMessageMethodOptions): IDisposable;
25
- warning(options: IMessageMethodOptions): IDisposable;
26
- error(options: IMessageMethodOptions): IDisposable;
32
+ success(options: IMessageOptions): IDisposable;
33
+ info(options: IMessageOptions): IDisposable;
34
+ warning(options: IMessageOptions): IDisposable;
35
+ error(options: IMessageOptions): IDisposable;
36
+ loading(options: IMessageOptions): IDisposable;
27
37
  }
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { type IMessageMethodOptions, type IMessageProps, Message, MessageType } from './Message';
16
+ export { type IMessageOptions, type IMessageProps, Message, MessageType } from './Message';
@@ -12,24 +12,23 @@ export interface IRectPopupProps {
12
12
  * the anchor element bounding rect
13
13
  */
14
14
  anchorRect: IAbsolutePosition;
15
- direction?: 'horizontal' | 'vertical';
15
+ direction?: 'vertical' | 'horizontal' | 'left' | 'top' | 'right' | 'left' | 'bottom';
16
16
  closeOnSelfTarget?: boolean;
17
17
  onClickOutside?: (e: MouseEvent) => void;
18
18
  excludeOutside?: HTMLElement[];
19
19
  }
20
- export interface IPopupLayoutInfo {
20
+ export interface IPopupLayoutInfo extends Pick<IRectPopupProps, 'direction'> {
21
21
  position: IAbsolutePosition;
22
22
  width: number;
23
23
  height: number;
24
24
  containerWidth: number;
25
25
  containerHeight: number;
26
- direction?: 'horizontal' | 'vertical';
27
26
  }
28
27
  declare function RectPopup(props: IRectPopupProps): React.JSX.Element;
29
28
  declare namespace RectPopup {
30
29
  var calcPopupPosition: (layout: IPopupLayoutInfo) => {
31
- left: number;
32
30
  top: number;
31
+ left: number;
33
32
  };
34
33
  var useContext: () => {
35
34
  top: number;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+
3
+ export interface ISwitchProps {
4
+ defaultChecked?: boolean;
5
+ onChange?: (checked: boolean) => void;
6
+ }
7
+ declare const Switch: (props: ISwitchProps) => React.JSX.Element;
8
+ export { Switch };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export { Switch } from './Switch';
@@ -29,7 +29,7 @@ export { FormDualColumnLayout, type IFormDualColumnLayoutProps, FormLayout, type
29
29
  export { type IInputProps, type IInputWithSlotProps, Input, InputWithSlot } from './components/input';
30
30
  export { type IInputNumberProps, InputNumber } from './components/input-number';
31
31
  export { type MenuRef, Menu, MenuItem, MenuItemGroup, SubMenu } from './components/menu';
32
- export { type IMessageMethodOptions, type IMessageProps, Message, MessageType } from './components/message';
32
+ export { type IMessageOptions, type IMessageProps, Message, MessageType } from './components/message';
33
33
  export { type IPagerProps, Pager } from './components/pager';
34
34
  export { type IPopupProps, Popup, RectPopup, type IRectPopupProps } from './components/popup';
35
35
  export { type IRadioProps, Radio } from './components/radio';
@@ -41,7 +41,12 @@ export { type ISegmentedProps, Segmented } from './components/segmented';
41
41
  export { type ISliderProps, Slider } from './components/slider';
42
42
  export { type ITooltipProps, Tooltip, resizeObserverCtor } from './components/tooltip';
43
43
  export { type ITreeNodeProps, type ITreeProps, Tree, TreeSelectionMode, mergeTreeSelected, findSubTreeFromPath, findNodePathFromTree, filterLeafNode } from './components/tree';
44
- export { enUS, zhCN, ruRU } from './locale';
44
+ export * as enUS from './locale/en-US';
45
+ export * as ruRU from './locale/ru-RU';
46
+ export * as zhCN from './locale/zh-CN';
47
+ export { Switch } from './components/switch';
45
48
  export { type ILocale } from './locale/interface';
46
49
  export { defaultTheme, greenTheme, themeInstance } from './themes';
47
50
  export { DraggableList, type IDraggableListProps } from './components/draggable-list';
51
+ export { Textarea, type ITextareaProps } from './components/textarea';
52
+ export { Mentions, type IMentionsProps, Mention, type MentionProps } from './components/mentions';