@univerjs/design 0.6.1 → 0.6.2

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.
Files changed (59) hide show
  1. package/lib/cjs/index.js +156 -74
  2. package/lib/cjs/locale/en-US.js +1 -1
  3. package/lib/cjs/locale/fa-IR.js +1 -1
  4. package/lib/cjs/locale/fr-FR.js +1 -1
  5. package/lib/cjs/locale/ru-RU.js +1 -1
  6. package/lib/cjs/locale/vi-VN.js +1 -1
  7. package/lib/cjs/locale/zh-CN.js +1 -1
  8. package/lib/cjs/locale/zh-TW.js +1 -1
  9. package/lib/es/index.js +15220 -11356
  10. package/lib/es/locale/en-US.js +3 -6
  11. package/lib/es/locale/fa-IR.js +0 -3
  12. package/lib/es/locale/fr-FR.js +72 -75
  13. package/lib/es/locale/ru-RU.js +48 -51
  14. package/lib/es/locale/vi-VN.js +16 -19
  15. package/lib/es/locale/zh-CN.js +0 -3
  16. package/lib/es/locale/zh-TW.js +0 -3
  17. package/lib/index.css +1 -1
  18. package/lib/types/components/avatar/Avatar.d.ts +3 -3
  19. package/lib/types/components/button/Button.d.ts +4 -4
  20. package/lib/types/components/checkbox-group/CheckboxGroup.d.ts +3 -3
  21. package/lib/types/components/config-provider/ConfigProvider.d.ts +1 -1
  22. package/lib/types/components/dialog/Dialog.d.ts +5 -0
  23. package/lib/types/components/dropdown/Dropdown.d.ts +11 -0
  24. package/lib/types/components/dropdown/Dropdown.stories.d.ts +2 -2
  25. package/lib/types/components/dropdown/PopoverPrimitive.d.ts +7 -0
  26. package/lib/types/components/dropdown/index.d.ts +1 -3
  27. package/lib/types/components/dropdown-legacy/DropdownLegacy.d.ts +1 -0
  28. package/lib/types/components/dropdown-menu/DropdownMenu.d.ts +31 -0
  29. package/lib/types/components/dropdown-menu/DropdownMenuPrimitive.d.ts +25 -0
  30. package/lib/types/components/dropdown-menu/index.d.ts +16 -0
  31. package/lib/types/components/input/Input.d.ts +1 -0
  32. package/lib/types/components/message/Message.d.ts +16 -2
  33. package/lib/types/components/radio-group/RadioGroup.d.ts +3 -3
  34. package/lib/types/components/segmented/Segmented.d.ts +28 -4
  35. package/lib/types/components/segmented/index.d.ts +1 -1
  36. package/lib/types/components/select/Select.d.ts +6 -6
  37. package/lib/types/components/separator/Separator.d.ts +4 -0
  38. package/lib/types/components/{slider/__test__/index.spec.d.ts → separator/index.d.ts} +1 -1
  39. package/lib/types/components/tooltip/Tooltip.d.ts +2 -1
  40. package/lib/types/{components/slider/index.d.ts → helper/is-browser.d.ts} +1 -1
  41. package/lib/types/index.d.ts +6 -4
  42. package/lib/types/locale/interface.d.ts +0 -1
  43. package/lib/umd/index.js +155 -73
  44. package/lib/umd/locale/en-US.js +1 -1
  45. package/lib/umd/locale/fa-IR.js +1 -1
  46. package/lib/umd/locale/fr-FR.js +1 -1
  47. package/lib/umd/locale/ru-RU.js +1 -1
  48. package/lib/umd/locale/vi-VN.js +1 -1
  49. package/lib/umd/locale/zh-CN.js +1 -1
  50. package/lib/umd/locale/zh-TW.js +1 -1
  51. package/package.json +9 -11
  52. package/lib/types/components/dropdown/DropdownContext.d.ts +0 -11
  53. package/lib/types/components/dropdown/DropdownOverlay.d.ts +0 -14
  54. package/lib/types/components/dropdown/DropdownProvider.d.ts +0 -9
  55. package/lib/types/components/dropdown/DropdownTrigger.d.ts +0 -6
  56. package/lib/types/components/icon/Icon.stories.d.ts +0 -6
  57. package/lib/types/components/slider/Slider.d.ts +0 -47
  58. package/lib/types/components/slider/Slider.stories.d.ts +0 -7
  59. /package/lib/types/{utils/render.d.ts → helper/react-dom.d.ts} +0 -0
@@ -0,0 +1,7 @@
1
+ import { ComponentProps } from 'react';
2
+ import { Anchor, Content, Root, Trigger } from '@radix-ui/react-popover';
3
+ declare function PopoverPrimitive({ ...props }: ComponentProps<typeof Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function PopoverTrigger({ ...props }: ComponentProps<typeof Trigger>): import("react/jsx-runtime").JSX.Element;
5
+ declare function PopoverContent({ className, align, sideOffset, ...props }: ComponentProps<typeof Content>): import("react/jsx-runtime").JSX.Element;
6
+ declare function PopoverAnchor({ ...props }: ComponentProps<typeof Anchor>): import("react/jsx-runtime").JSX.Element;
7
+ export { PopoverAnchor, PopoverContent, PopoverPrimitive, PopoverTrigger };
@@ -13,6 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { DropdownOverlay, type IDropdownOverlayProps } from './DropdownOverlay';
17
- export { DropdownProvider } from './DropdownProvider';
18
- export { DropdownTrigger } from './DropdownTrigger';
16
+ export { Dropdown } from './Dropdown';
@@ -47,4 +47,5 @@ export interface IDropdownLegacyProps {
47
47
  /** Disable dropdown from showing up. */
48
48
  disabled?: boolean;
49
49
  }
50
+ /** @deprecated */
50
51
  export declare function DropdownLegacy(props: IDropdownLegacyProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,31 @@
1
+ import { Content } from '@radix-ui/react-popover';
2
+ import { ComponentProps, ReactNode } from 'react';
3
+ type DropdownMenu = {
4
+ type: 'item';
5
+ className?: string;
6
+ children: ReactNode;
7
+ disabled?: boolean;
8
+ onSelect?: (item: DropdownMenu) => void;
9
+ } | {
10
+ type?: 'separator';
11
+ className?: string;
12
+ } | {
13
+ type?: 'radio';
14
+ className?: string;
15
+ value: string;
16
+ options: {
17
+ value: string;
18
+ label: ReactNode;
19
+ disabled?: boolean;
20
+ }[];
21
+ onSelect?: (item: string) => void;
22
+ };
23
+ export interface IDropdownProps {
24
+ children: ReactNode;
25
+ items: DropdownMenu[];
26
+ disabled?: boolean;
27
+ open?: boolean;
28
+ onOpenChange?: (open: boolean) => void;
29
+ }
30
+ export declare function DropdownMenu(props: IDropdownProps & ComponentProps<typeof Content>): import("react/jsx-runtime").JSX.Element;
31
+ export {};
@@ -0,0 +1,25 @@
1
+ import { ComponentProps } from 'react';
2
+ import { CheckboxItem, Content, Group, Item, Label, Portal, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, Trigger } from '@radix-ui/react-dropdown-menu';
3
+ declare function DropdownMenuPrimitive({ ...props }: ComponentProps<typeof Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function DropdownMenuPortal({ ...props }: ComponentProps<typeof Portal>): import("react/jsx-runtime").JSX.Element;
5
+ declare function DropdownMenuTrigger({ ...props }: ComponentProps<typeof Trigger>): import("react/jsx-runtime").JSX.Element;
6
+ declare function DropdownMenuGroup({ ...props }: ComponentProps<typeof Group>): import("react/jsx-runtime").JSX.Element;
7
+ declare function DropdownMenuSub({ ...props }: ComponentProps<typeof Sub>): import("react/jsx-runtime").JSX.Element;
8
+ declare function DropdownMenuRadioGroup({ ...props }: ComponentProps<typeof RadioGroup>): import("react/jsx-runtime").JSX.Element;
9
+ declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: ComponentProps<typeof SubTrigger> & {
10
+ inset?: boolean;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ declare function DropdownMenuSubContent({ className, ...props }: ComponentProps<typeof SubContent>): import("react/jsx-runtime").JSX.Element;
13
+ declare function DropdownMenuContent({ className, sideOffset, ...props }: ComponentProps<typeof Content>): import("react/jsx-runtime").JSX.Element;
14
+ declare function DropdownMenuItem({ className, inset, variant, ...props }: ComponentProps<typeof Item> & {
15
+ inset?: boolean;
16
+ variant?: 'default' | 'destructive';
17
+ }): import("react/jsx-runtime").JSX.Element;
18
+ declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: ComponentProps<typeof CheckboxItem>): import("react/jsx-runtime").JSX.Element;
19
+ declare function DropdownMenuRadioItem({ className, children, ...props }: ComponentProps<typeof RadioItem>): import("react/jsx-runtime").JSX.Element;
20
+ declare function DropdownMenuLabel({ className, inset, ...props }: ComponentProps<typeof Label> & {
21
+ inset?: boolean;
22
+ }): import("react/jsx-runtime").JSX.Element;
23
+ declare function DropdownMenuSeparator({ className, ...props }: ComponentProps<typeof Separator>): import("react/jsx-runtime").JSX.Element;
24
+ declare function DropdownMenuShortcut({ className, ...props }: ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
25
+ export { DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuPrimitive, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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 { DropdownMenu, type IDropdownProps } from './DropdownMenu';
@@ -13,6 +13,7 @@ export interface IInputProps extends Pick<InputProps, 'onFocus' | 'onBlur'> {
13
13
  onClick?: (e: React.MouseEvent<HTMLInputElement>) => void;
14
14
  onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
15
15
  onChange?: (value: string) => void;
16
+ style?: React.CSSProperties;
16
17
  }
17
18
  export declare const Input: ({ autoFocus, className, affixWrapperStyle, type, placeholder, value, size, allowClear, disabled, onClick, onKeyDown, onChange, onFocus, onBlur, ...props }: IInputProps) => import("react/jsx-runtime").JSX.Element;
18
19
  export {};
@@ -1,4 +1,18 @@
1
- import { default as React } from 'react';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ */
2
16
  export declare enum MessageType {
3
17
  Success = "success",
4
18
  Info = "info",
@@ -13,4 +27,4 @@ export interface IMessageProps {
13
27
  type?: MessageType;
14
28
  onClose?: () => void;
15
29
  }
16
- export declare const Messager: () => React.ReactPortal | null, message: (props: Omit<IMessageProps, "id">) => void, removeMessage: (id?: string) => void;
30
+ export declare const Messager: () => import('react').ReactPortal | null, message: (props: Omit<IMessageProps, "id">) => void, removeMessage: (id?: string) => void;
@@ -1,6 +1,6 @@
1
- import { default as React } from 'react';
1
+ import { CSSProperties, ReactNode } from 'react';
2
2
  export interface IRadioGroupProps {
3
- children: React.ReactNode[];
3
+ children: ReactNode[];
4
4
  /**
5
5
  * The class name of the checkbox group
6
6
  */
@@ -8,7 +8,7 @@ export interface IRadioGroupProps {
8
8
  /**
9
9
  * The style of the checkbox group
10
10
  */
11
- style?: React.CSSProperties;
11
+ style?: CSSProperties;
12
12
  /**
13
13
  * Define which radio is selected
14
14
  */
@@ -1,5 +1,29 @@
1
- import { default as React } from 'react';
2
- import { SegmentedProps } from 'rc-segmented';
3
- export interface ISegmentedProps extends Omit<SegmentedProps, 'prefixCls'> {
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ type ItemValue = string | number;
17
+ interface ISegmentedItem<T extends ItemValue = ItemValue> {
18
+ label: string;
19
+ value: T;
4
20
  }
5
- export declare const Segmented: React.ForwardRefExoticComponent<Omit<ISegmentedProps, "ref"> & React.RefAttributes<HTMLDivElement | null>>;
21
+ interface ISegmentedProps<T extends ItemValue = ItemValue> {
22
+ items: ISegmentedItem<T>[];
23
+ value?: T;
24
+ defaultValue?: T;
25
+ onChange?: (value: T) => void;
26
+ className?: string;
27
+ }
28
+ export declare function Segmented<T extends ItemValue = ItemValue>({ items, value, defaultValue, onChange, className, }: ISegmentedProps<T>): import("react/jsx-runtime").JSX.Element;
29
+ export {};
@@ -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 { Segmented, type ISegmentedProps } from './Segmented';
16
+ export { Segmented } from './Segmented';
@@ -1,7 +1,7 @@
1
- import { default as React } from 'react';
2
1
  import { LabelInValueType } from 'rc-select/lib/Select';
2
+ import { CSSProperties, JSXElementConstructor, ReactElement, ReactNode } from 'react';
3
3
  interface IOption {
4
- label?: string | React.ReactNode;
4
+ label?: string | ReactNode;
5
5
  value?: string;
6
6
  options?: IOption[];
7
7
  }
@@ -19,7 +19,7 @@ export interface ISelectProps {
19
19
  * The callback function that is triggered when the value is changed
20
20
  */
21
21
  onChange: (value: string) => void;
22
- style?: React.CSSProperties;
22
+ style?: CSSProperties;
23
23
  /**
24
24
  * Whether the borderless style is used
25
25
  * @default false
@@ -30,10 +30,10 @@ export interface ISelectProps {
30
30
  * select mode
31
31
  */
32
32
  mode?: 'combobox' | 'multiple' | 'tags' | undefined;
33
- dropdownRender?: (menu: React.ReactElement<any, string | React.JSXElementConstructor<any>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
34
- labelRender?: ((props: LabelInValueType) => React.ReactNode) | undefined;
33
+ dropdownRender?: (menu: ReactElement<any, string | JSXElementConstructor<any>>) => ReactElement<any, string | JSXElementConstructor<any>>;
34
+ labelRender?: ((props: LabelInValueType) => ReactNode) | undefined;
35
35
  open?: boolean;
36
- dropdownStyle?: React.CSSProperties;
36
+ dropdownStyle?: CSSProperties;
37
37
  onDropdownVisibleChange?: (open: boolean) => void;
38
38
  disabled?: boolean;
39
39
  }
@@ -0,0 +1,4 @@
1
+ import { ComponentProps } from 'react';
2
+ import { Root } from '@radix-ui/react-separator';
3
+ declare function Separator({ className, orientation, decorative, ...props }: ComponentProps<typeof Root>): import("react/jsx-runtime").JSX.Element;
4
+ export { Separator };
@@ -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 {};
16
+ export { Separator } from './Separator';
@@ -33,5 +33,6 @@ export interface ITooltipProps {
33
33
  * Callback when the visibility of the tooltip changes
34
34
  */
35
35
  onVisibleChange?: (visible: boolean) => void;
36
+ className?: string;
36
37
  }
37
- export declare function Tooltip({ visible, asChild, title, children, placement, showIfEllipsis, onVisibleChange }: ITooltipProps): import("react/jsx-runtime").JSX.Element | null;
38
+ export declare function Tooltip(props: ITooltipProps): import("react/jsx-runtime").JSX.Element | undefined;
@@ -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 ISliderProps, Slider } from './Slider';
16
+ export declare function isBrowser(): boolean;
@@ -25,7 +25,7 @@ export { Confirm, type IConfirmProps } from './components/confirm';
25
25
  export { DatePanel, DatePicker, type IDatePanelProps, type IDatePickerProps } from './components/date-picker';
26
26
  export { Dialog, type IDialogProps } from './components/dialog';
27
27
  export { DropdownLegacy, type IDropdownLegacyProps } from './components/dropdown-legacy';
28
- export { DropdownOverlay, DropdownProvider, DropdownTrigger, type IDropdownOverlayProps } from './components/dropdown';
28
+ export { Dropdown } from './components/dropdown';
29
29
  export { FormDualColumnLayout, FormLayout, type IFormDualColumnLayoutProps, type IFormLayoutProps } from './components/form-layout';
30
30
  export { type IInputProps, type IInputWithSlotProps, Input, InputWithSlot } from './components/input';
31
31
  export { type IInputNumberProps, InputNumber } from './components/input-number';
@@ -38,8 +38,7 @@ export { type IRadioGroupProps, RadioGroup } from './components/radio-group';
38
38
  export { type IScrollbarProps, Scrollbar } from './components/scrollbar';
39
39
  export { type ISelectProps, Select } from './components/select';
40
40
  export { type ISelectListProps, SelectList } from './components/select-list';
41
- export { type ISegmentedProps, Segmented } from './components/segmented';
42
- export { type ISliderProps, Slider } from './components/slider';
41
+ export { Segmented } from './components/segmented';
43
42
  export { type ITooltipProps, Tooltip } from './components/tooltip';
44
43
  export { filterLeafNode, findNodePathFromTree, findSubTreeFromPath, type ITreeNodeProps, type ITreeProps, mergeTreeSelected, Tree, TreeSelectionMode } from './components/tree';
45
44
  export { Switch } from './components/switch';
@@ -48,4 +47,7 @@ export { defaultTheme, greenTheme, themeInstance } from './themes';
48
47
  export { DraggableList, type IDraggableListProps } from './components/draggable-list';
49
48
  export { clsx } from './helper/clsx';
50
49
  export { resizeObserverCtor } from './helper/resize-observer';
51
- export { render, unmount } from './utils/render';
50
+ export { render, unmount } from './helper/react-dom';
51
+ export { isBrowser } from './helper/is-browser';
52
+ export { DropdownMenu, type IDropdownProps } from './components/dropdown-menu';
53
+ export { Separator } from './components/separator';
@@ -2,7 +2,6 @@ import { default as PickerZhCN } from 'rc-picker/lib/locale/zh_CN';
2
2
  export interface ILocale {
3
3
  design: {
4
4
  Confirm: Record<string, any>;
5
- Slider: Record<string, any>;
6
5
  Picker: typeof PickerZhCN;
7
6
  CascaderList: Record<string, any>;
8
7
  Select: Record<string, any>;