@univerjs/design 1.0.0-alpha.6 → 1.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +74 -1
- package/lib/es/index.js +68 -3
- package/lib/index.css +59 -3
- package/lib/index.js +68 -3
- package/lib/types/components/command/Command.d.ts +25 -0
- package/lib/types/components/input-number/InputNumber.d.ts +1 -0
- package/lib/types/components/input-number/InputNumber.stories.d.ts +3 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/umd/index.js +14 -14
- package/package.json +4 -3
package/lib/cjs/index.js
CHANGED
|
@@ -10,6 +10,7 @@ let _radix_ui_react_slot = require("@radix-ui/react-slot");
|
|
|
10
10
|
let _radix_ui_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
11
11
|
let _radix_ui_react_popover = require("@radix-ui/react-popover");
|
|
12
12
|
let _radix_ui_react_dialog = require("@radix-ui/react-dialog");
|
|
13
|
+
let cmdk = require("cmdk");
|
|
13
14
|
let react_dom = require("react-dom");
|
|
14
15
|
let _radix_ui_react_hover_card = require("@radix-ui/react-hover-card");
|
|
15
16
|
let sonner = require("sonner");
|
|
@@ -2062,6 +2063,69 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
2062
2063
|
});
|
|
2063
2064
|
}
|
|
2064
2065
|
|
|
2066
|
+
//#endregion
|
|
2067
|
+
//#region src/components/command/Command.tsx
|
|
2068
|
+
function Command({ className, ...props }) {
|
|
2069
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(cmdk.Command, {
|
|
2070
|
+
"data-slot": "command",
|
|
2071
|
+
className: clsx$1("univer-flex univer-h-full univer-w-full univer-flex-col univer-overflow-hidden univer-rounded-md univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-700 dark:!univer-text-white", className),
|
|
2072
|
+
...props
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
function CommandInput({ className, ...props }) {
|
|
2076
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2077
|
+
"data-slot": "command-input-wrapper",
|
|
2078
|
+
className: "univer-flex univer-h-10 univer-items-center univer-gap-2 univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-px-3 dark:!univer-border-gray-600 [&>svg]:univer-size-4 [&>svg]:univer-shrink-0 [&>svg]:univer-text-gray-400",
|
|
2079
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.SearchIcon, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(cmdk.Command.Input, {
|
|
2080
|
+
"data-slot": "command-input",
|
|
2081
|
+
className: clsx$1("univer-h-10 univer-w-full univer-border-none univer-bg-transparent univer-text-sm univer-outline-none placeholder:univer-text-gray-400", className),
|
|
2082
|
+
...props
|
|
2083
|
+
})]
|
|
2084
|
+
});
|
|
2085
|
+
}
|
|
2086
|
+
function CommandList({ className, ...props }) {
|
|
2087
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(cmdk.Command.List, {
|
|
2088
|
+
"data-slot": "command-list",
|
|
2089
|
+
className: clsx$1("univer-max-h-[300px] univer-overflow-y-auto univer-overflow-x-hidden univer-p-1 [scroll-padding-block:4px]", className),
|
|
2090
|
+
...props
|
|
2091
|
+
});
|
|
2092
|
+
}
|
|
2093
|
+
function CommandEmpty({ className, ...props }) {
|
|
2094
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(cmdk.Command.Empty, {
|
|
2095
|
+
"data-slot": "command-empty",
|
|
2096
|
+
className: clsx$1("univer-py-6 univer-text-center univer-text-sm univer-text-gray-500", className),
|
|
2097
|
+
...props
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
function CommandGroup({ className, ...props }) {
|
|
2101
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(cmdk.Command.Group, {
|
|
2102
|
+
"data-slot": "command-group",
|
|
2103
|
+
className: clsx$1("univer-overflow-hidden univer-p-1 [&_[cmdk-group-heading]]:univer-px-2 [&_[cmdk-group-heading]]:univer-py-1.5 [&_[cmdk-group-heading]]:univer-text-xs [&_[cmdk-group-heading]]:univer-font-medium [&_[cmdk-group-heading]]:univer-text-gray-500", className),
|
|
2104
|
+
...props
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2107
|
+
function CommandItem({ className, ...props }) {
|
|
2108
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(cmdk.Command.Item, {
|
|
2109
|
+
"data-slot": "command-item",
|
|
2110
|
+
className: clsx$1("univer-relative univer-flex univer-cursor-default univer-select-none univer-items-center univer-gap-2 univer-rounded univer-px-2 univer-py-1.5 univer-text-sm univer-outline-none data-[disabled=true]:univer-pointer-events-none data-[selected=true]:univer-bg-gray-100 data-[disabled=true]:univer-opacity-50 dark:data-[selected=true]:!univer-bg-gray-600", className),
|
|
2111
|
+
...props
|
|
2112
|
+
});
|
|
2113
|
+
}
|
|
2114
|
+
function CommandSeparator({ className, ...props }) {
|
|
2115
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(cmdk.Command.Separator, {
|
|
2116
|
+
"data-slot": "command-separator",
|
|
2117
|
+
className: clsx$1("univer-my-1 univer-h-px univer-bg-gray-200 dark:!univer-bg-gray-600", className),
|
|
2118
|
+
...props
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
function CommandShortcut({ className, ...props }) {
|
|
2122
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2123
|
+
"data-slot": "command-shortcut",
|
|
2124
|
+
className: clsx$1("univer-ml-auto univer-text-xs univer-tracking-widest univer-text-gray-400 rtl:univer-ml-0 rtl:univer-mr-auto", className),
|
|
2125
|
+
...props
|
|
2126
|
+
});
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2065
2129
|
//#endregion
|
|
2066
2130
|
//#region src/components/confirm/Confirm.tsx
|
|
2067
2131
|
function Footer(props) {
|
|
@@ -2709,7 +2773,7 @@ const Input = (0, react.forwardRef)(({ autoFocus = false, className, style, type
|
|
|
2709
2773
|
|
|
2710
2774
|
//#endregion
|
|
2711
2775
|
//#region src/components/input-number/InputNumber.tsx
|
|
2712
|
-
const InputNumber = (0, react.forwardRef)(({ value, defaultValue, size = "small", min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, step = 1, precision, formatter, parser, controls = true, className, inputClassName, controlsClassName, disabled, onChange, onKeyDown, onPressEnter, onFocus, onBlur, allowEmpty = false }, ref) => {
|
|
2776
|
+
const InputNumber = (0, react.forwardRef)(({ value, defaultValue, size = "small", min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, step = 1, precision, formatter, parser, controls = true, className, inputClassName, controlsClassName, disabled, onChange, onKeyDown, onPressEnter, onFocus, onBlur, allowEmpty = false, allowClear = false }, ref) => {
|
|
2713
2777
|
const { locale } = (0, react.useContext)(ConfigContext);
|
|
2714
2778
|
const [internalValue, setInternalValue] = (0, react.useState)(value !== void 0 ? value : defaultValue !== void 0 ? defaultValue : null);
|
|
2715
2779
|
const lastValidValueRef = (0, react.useRef)(internalValue);
|
|
@@ -2855,6 +2919,7 @@ const InputNumber = (0, react.forwardRef)(({ value, defaultValue, size = "small"
|
|
|
2855
2919
|
className: clsx$1("univer-box-border", inputClassName),
|
|
2856
2920
|
size,
|
|
2857
2921
|
value: inputValue,
|
|
2922
|
+
allowClear,
|
|
2858
2923
|
disabled,
|
|
2859
2924
|
onChange: handleInputChange,
|
|
2860
2925
|
onFocus,
|
|
@@ -4520,6 +4585,14 @@ exports.Checkbox = Checkbox;
|
|
|
4520
4585
|
exports.CheckboxGroup = CheckboxGroup;
|
|
4521
4586
|
exports.ColorPicker = ColorPicker;
|
|
4522
4587
|
exports.ColorPresets = ColorPresets;
|
|
4588
|
+
exports.Command = Command;
|
|
4589
|
+
exports.CommandEmpty = CommandEmpty;
|
|
4590
|
+
exports.CommandGroup = CommandGroup;
|
|
4591
|
+
exports.CommandInput = CommandInput;
|
|
4592
|
+
exports.CommandItem = CommandItem;
|
|
4593
|
+
exports.CommandList = CommandList;
|
|
4594
|
+
exports.CommandSeparator = CommandSeparator;
|
|
4595
|
+
exports.CommandShortcut = CommandShortcut;
|
|
4523
4596
|
exports.ConfigContext = ConfigContext;
|
|
4524
4597
|
exports.ConfigProvider = ConfigProvider;
|
|
4525
4598
|
exports.Confirm = Confirm;
|
package/lib/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CalendarIcon, CheckMarkIcon, ClockIcon, CloseIcon, DeleteIcon, DownIcon, ErrorIcon, InfoIcon, LoadingMultiIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, MoreUpIcon, OneToOneIcon, SuccessIcon, WarningIcon, ZoomInIcon, ZoomOutIcon } from "@univerjs/icons";
|
|
1
|
+
import { CalendarIcon, CheckMarkIcon, ClockIcon, CloseIcon, DeleteIcon, DownIcon, ErrorIcon, InfoIcon, LoadingMultiIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, MoreUpIcon, OneToOneIcon, SearchIcon, SuccessIcon, WarningIcon, ZoomInIcon, ZoomOutIcon } from "@univerjs/icons";
|
|
2
2
|
import { Children, cloneElement, createContext, forwardRef, isValidElement, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { clsx as clsx$1 } from "clsx";
|
|
4
4
|
import { extendTailwindMerge } from "tailwind-merge";
|
|
@@ -9,6 +9,7 @@ import { Slot } from "@radix-ui/react-slot";
|
|
|
9
9
|
import { CheckboxItem, Content, Item, ItemIndicator, Portal, RadioGroup as RadioGroup$1, RadioItem, Root, Separator as Separator$1, Sub, SubContent, SubTrigger, Trigger } from "@radix-ui/react-dropdown-menu";
|
|
10
10
|
import { Content as Content$1, Portal as Portal$1, Root as Root$1, Trigger as Trigger$1 } from "@radix-ui/react-popover";
|
|
11
11
|
import { Close, Content as Content$2, Description, Overlay, Portal as Portal$2, Root as Root$2, Title } from "@radix-ui/react-dialog";
|
|
12
|
+
import { Command as Command$1 } from "cmdk";
|
|
12
13
|
import { createPortal } from "react-dom";
|
|
13
14
|
import { Content as Content$3, Portal as Portal$3, Root as Root$3, Trigger as Trigger$2 } from "@radix-ui/react-hover-card";
|
|
14
15
|
import { Toaster as Toaster$1, toast, toast as toast$1 } from "sonner";
|
|
@@ -2061,6 +2062,69 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
2061
2062
|
});
|
|
2062
2063
|
}
|
|
2063
2064
|
|
|
2065
|
+
//#endregion
|
|
2066
|
+
//#region src/components/command/Command.tsx
|
|
2067
|
+
function Command({ className, ...props }) {
|
|
2068
|
+
return /* @__PURE__ */ jsx(Command$1, {
|
|
2069
|
+
"data-slot": "command",
|
|
2070
|
+
className: clsx("univer-flex univer-h-full univer-w-full univer-flex-col univer-overflow-hidden univer-rounded-md univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-700 dark:!univer-text-white", className),
|
|
2071
|
+
...props
|
|
2072
|
+
});
|
|
2073
|
+
}
|
|
2074
|
+
function CommandInput({ className, ...props }) {
|
|
2075
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2076
|
+
"data-slot": "command-input-wrapper",
|
|
2077
|
+
className: "univer-flex univer-h-10 univer-items-center univer-gap-2 univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-px-3 dark:!univer-border-gray-600 [&>svg]:univer-size-4 [&>svg]:univer-shrink-0 [&>svg]:univer-text-gray-400",
|
|
2078
|
+
children: [/* @__PURE__ */ jsx(SearchIcon, {}), /* @__PURE__ */ jsx(Command$1.Input, {
|
|
2079
|
+
"data-slot": "command-input",
|
|
2080
|
+
className: clsx("univer-h-10 univer-w-full univer-border-none univer-bg-transparent univer-text-sm univer-outline-none placeholder:univer-text-gray-400", className),
|
|
2081
|
+
...props
|
|
2082
|
+
})]
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
function CommandList({ className, ...props }) {
|
|
2086
|
+
return /* @__PURE__ */ jsx(Command$1.List, {
|
|
2087
|
+
"data-slot": "command-list",
|
|
2088
|
+
className: clsx("univer-max-h-[300px] univer-overflow-y-auto univer-overflow-x-hidden univer-p-1 [scroll-padding-block:4px]", className),
|
|
2089
|
+
...props
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
function CommandEmpty({ className, ...props }) {
|
|
2093
|
+
return /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
2094
|
+
"data-slot": "command-empty",
|
|
2095
|
+
className: clsx("univer-py-6 univer-text-center univer-text-sm univer-text-gray-500", className),
|
|
2096
|
+
...props
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
function CommandGroup({ className, ...props }) {
|
|
2100
|
+
return /* @__PURE__ */ jsx(Command$1.Group, {
|
|
2101
|
+
"data-slot": "command-group",
|
|
2102
|
+
className: clsx("univer-overflow-hidden univer-p-1 [&_[cmdk-group-heading]]:univer-px-2 [&_[cmdk-group-heading]]:univer-py-1.5 [&_[cmdk-group-heading]]:univer-text-xs [&_[cmdk-group-heading]]:univer-font-medium [&_[cmdk-group-heading]]:univer-text-gray-500", className),
|
|
2103
|
+
...props
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
function CommandItem({ className, ...props }) {
|
|
2107
|
+
return /* @__PURE__ */ jsx(Command$1.Item, {
|
|
2108
|
+
"data-slot": "command-item",
|
|
2109
|
+
className: clsx("univer-relative univer-flex univer-cursor-default univer-select-none univer-items-center univer-gap-2 univer-rounded univer-px-2 univer-py-1.5 univer-text-sm univer-outline-none data-[disabled=true]:univer-pointer-events-none data-[selected=true]:univer-bg-gray-100 data-[disabled=true]:univer-opacity-50 dark:data-[selected=true]:!univer-bg-gray-600", className),
|
|
2110
|
+
...props
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
function CommandSeparator({ className, ...props }) {
|
|
2114
|
+
return /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
2115
|
+
"data-slot": "command-separator",
|
|
2116
|
+
className: clsx("univer-my-1 univer-h-px univer-bg-gray-200 dark:!univer-bg-gray-600", className),
|
|
2117
|
+
...props
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2120
|
+
function CommandShortcut({ className, ...props }) {
|
|
2121
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2122
|
+
"data-slot": "command-shortcut",
|
|
2123
|
+
className: clsx("univer-ml-auto univer-text-xs univer-tracking-widest univer-text-gray-400 rtl:univer-ml-0 rtl:univer-mr-auto", className),
|
|
2124
|
+
...props
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2064
2128
|
//#endregion
|
|
2065
2129
|
//#region src/components/confirm/Confirm.tsx
|
|
2066
2130
|
function Footer(props) {
|
|
@@ -2708,7 +2772,7 @@ const Input = forwardRef(({ autoFocus = false, className, style, type = "text",
|
|
|
2708
2772
|
|
|
2709
2773
|
//#endregion
|
|
2710
2774
|
//#region src/components/input-number/InputNumber.tsx
|
|
2711
|
-
const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, step = 1, precision, formatter, parser, controls = true, className, inputClassName, controlsClassName, disabled, onChange, onKeyDown, onPressEnter, onFocus, onBlur, allowEmpty = false }, ref) => {
|
|
2775
|
+
const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, step = 1, precision, formatter, parser, controls = true, className, inputClassName, controlsClassName, disabled, onChange, onKeyDown, onPressEnter, onFocus, onBlur, allowEmpty = false, allowClear = false }, ref) => {
|
|
2712
2776
|
const { locale } = useContext(ConfigContext);
|
|
2713
2777
|
const [internalValue, setInternalValue] = useState(value !== void 0 ? value : defaultValue !== void 0 ? defaultValue : null);
|
|
2714
2778
|
const lastValidValueRef = useRef(internalValue);
|
|
@@ -2854,6 +2918,7 @@ const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Num
|
|
|
2854
2918
|
className: clsx("univer-box-border", inputClassName),
|
|
2855
2919
|
size,
|
|
2856
2920
|
value: inputValue,
|
|
2921
|
+
allowClear,
|
|
2857
2922
|
disabled,
|
|
2858
2923
|
onChange: handleInputChange,
|
|
2859
2924
|
onFocus,
|
|
@@ -4508,4 +4573,4 @@ function resizeObserverCtor(callback) {
|
|
|
4508
4573
|
}
|
|
4509
4574
|
|
|
4510
4575
|
//#endregion
|
|
4511
|
-
export { Accordion, Avatar, Badge, Button, ButtonGroup, Calendar, CascaderList, Checkbox, CheckboxGroup, ColorPicker, ColorPresets, ConfigContext, ConfigProvider, Confirm, DatePicker, DateRangePicker, Dialog, DraggableList, Dropdown, DropdownMenu, FormDualColumnLayout, FormLayout, Gallery, GradientColorPicker, HoverCard, Input, InputNumber, KBD, MessageType, Messager, MultipleSelect, Pager, Panel, PanelField, PanelSection, Popup, Radio, RadioGroup, Segmented, Select, SelectList, Separator, Switch, Textarea, TimeInput, Toaster, Tooltip, Tree, TreeSelectionMode, borderBottomClassName, borderClassName, borderLeftBottomClassName, borderLeftClassName, borderRightClassName, borderTopClassName, clsx, cva, divideXClassName, divideYClassName, filterLeafNode, findNodePathFromTree, findSubTreeFromPath, isBrowser, mergeTreeSelected, message, removeMessage, render, resetButtonClassName, resizeObserverCtor, scrollbarClassName, selectClassName, toast, unmount };
|
|
4576
|
+
export { Accordion, Avatar, Badge, Button, ButtonGroup, Calendar, CascaderList, Checkbox, CheckboxGroup, ColorPicker, ColorPresets, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfigContext, ConfigProvider, Confirm, DatePicker, DateRangePicker, Dialog, DraggableList, Dropdown, DropdownMenu, FormDualColumnLayout, FormLayout, Gallery, GradientColorPicker, HoverCard, Input, InputNumber, KBD, MessageType, Messager, MultipleSelect, Pager, Panel, PanelField, PanelSection, Popup, Radio, RadioGroup, Segmented, Select, SelectList, Separator, Switch, Textarea, TimeInput, Toaster, Tooltip, Tree, TreeSelectionMode, borderBottomClassName, borderClassName, borderLeftBottomClassName, borderLeftClassName, borderRightClassName, borderTopClassName, clsx, cva, divideXClassName, divideYClassName, filterLeafNode, findNodePathFromTree, findSubTreeFromPath, isBrowser, mergeTreeSelected, message, removeMessage, render, resetButtonClassName, resizeObserverCtor, scrollbarClassName, selectClassName, toast, unmount };
|
package/lib/index.css
CHANGED
|
@@ -456,6 +456,10 @@
|
|
|
456
456
|
max-height: 1000px;
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
+
.univer-max-h-\[300px\] {
|
|
460
|
+
max-height: 300px;
|
|
461
|
+
}
|
|
462
|
+
|
|
459
463
|
.univer-max-h-full {
|
|
460
464
|
max-height: 100%;
|
|
461
465
|
}
|
|
@@ -867,6 +871,10 @@
|
|
|
867
871
|
overflow-y: auto;
|
|
868
872
|
}
|
|
869
873
|
|
|
874
|
+
.univer-overflow-x-hidden {
|
|
875
|
+
overflow-x: hidden;
|
|
876
|
+
}
|
|
877
|
+
|
|
870
878
|
.univer-truncate {
|
|
871
879
|
text-overflow: ellipsis;
|
|
872
880
|
white-space: nowrap;
|
|
@@ -1280,6 +1288,11 @@
|
|
|
1280
1288
|
padding-bottom: .75rem;
|
|
1281
1289
|
}
|
|
1282
1290
|
|
|
1291
|
+
.univer-py-6 {
|
|
1292
|
+
padding-top: 1.5rem;
|
|
1293
|
+
padding-bottom: 1.5rem;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1283
1296
|
.\!univer-pl-4 {
|
|
1284
1297
|
padding-left: 1rem !important;
|
|
1285
1298
|
}
|
|
@@ -1884,6 +1897,10 @@
|
|
|
1884
1897
|
animation-timing-function: cubic-bezier(0, 0, .2, 1);
|
|
1885
1898
|
}
|
|
1886
1899
|
|
|
1900
|
+
.\[scroll-padding-block\:4px\] {
|
|
1901
|
+
scroll-padding-block: 4px;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1887
1904
|
.placeholder\:univer-text-gray-200::placeholder {
|
|
1888
1905
|
color: var(--univer-gray-200);
|
|
1889
1906
|
}
|
|
@@ -1939,7 +1956,7 @@
|
|
|
1939
1956
|
margin-bottom: 0;
|
|
1940
1957
|
}
|
|
1941
1958
|
|
|
1942
|
-
.data-\[disabled\]\:univer-pointer-events-none[data-disabled] {
|
|
1959
|
+
.data-\[disabled\=true\]\:univer-pointer-events-none[data-disabled="true"], .data-\[disabled\]\:univer-pointer-events-none[data-disabled] {
|
|
1943
1960
|
pointer-events: none;
|
|
1944
1961
|
}
|
|
1945
1962
|
|
|
@@ -1959,7 +1976,7 @@
|
|
|
1959
1976
|
width: 1px;
|
|
1960
1977
|
}
|
|
1961
1978
|
|
|
1962
|
-
.data-\[state\=open\]\:univer-bg-gray-100[data-state="open"] {
|
|
1979
|
+
.data-\[selected\=true\]\:univer-bg-gray-100[data-selected="true"], .data-\[state\=open\]\:univer-bg-gray-100[data-state="open"] {
|
|
1963
1980
|
background-color: var(--univer-gray-100);
|
|
1964
1981
|
}
|
|
1965
1982
|
|
|
@@ -1967,7 +1984,7 @@
|
|
|
1967
1984
|
color: var(--univer-red-600);
|
|
1968
1985
|
}
|
|
1969
1986
|
|
|
1970
|
-
.data-\[disabled\]\:univer-opacity-50[data-disabled] {
|
|
1987
|
+
.data-\[disabled\=true\]\:univer-opacity-50[data-disabled="true"], .data-\[disabled\]\:univer-opacity-50[data-disabled] {
|
|
1971
1988
|
opacity: .5;
|
|
1972
1989
|
}
|
|
1973
1990
|
|
|
@@ -2221,6 +2238,14 @@
|
|
|
2221
2238
|
right: auto;
|
|
2222
2239
|
}
|
|
2223
2240
|
|
|
2241
|
+
.rtl\:univer-ml-0:where([dir="rtl"], [dir="rtl"] *) {
|
|
2242
|
+
margin-left: 0;
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
.rtl\:univer-mr-auto:where([dir="rtl"], [dir="rtl"] *) {
|
|
2246
|
+
margin-right: auto;
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2224
2249
|
.rtl\:\!univer-rotate-0:where([dir="rtl"], [dir="rtl"] *) {
|
|
2225
2250
|
--univer-tw-rotate: 0deg !important;
|
|
2226
2251
|
transform: translate(var(--univer-tw-translate-x), var(--univer-tw-translate-y)) rotate(0deg) skewX(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y)) !important;
|
|
@@ -2395,6 +2420,10 @@
|
|
|
2395
2420
|
background-color: var(--univer-gray-600) !important;
|
|
2396
2421
|
}
|
|
2397
2422
|
|
|
2423
|
+
.dark\:data-\[selected\=true\]\:\!univer-bg-gray-600[data-selected="true"]:where(.univer-dark, .univer-dark *) {
|
|
2424
|
+
background-color: var(--univer-gray-600) !important;
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2398
2427
|
.dark\:data-\[state\=open\]\:\!univer-bg-gray-600[data-state="open"]:where(.univer-dark, .univer-dark *) {
|
|
2399
2428
|
background-color: var(--univer-gray-600) !important;
|
|
2400
2429
|
}
|
|
@@ -2485,6 +2514,10 @@
|
|
|
2485
2514
|
flex-shrink: 0;
|
|
2486
2515
|
}
|
|
2487
2516
|
|
|
2517
|
+
.\[\&\>svg\]\:univer-text-gray-400 > svg {
|
|
2518
|
+
color: var(--univer-gray-400);
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2488
2521
|
.\[\&\>ul\:not\(\:last-child\)\]\:univer-border-0 > ul:not(:last-child) {
|
|
2489
2522
|
border-width: 0;
|
|
2490
2523
|
}
|
|
@@ -2501,6 +2534,29 @@
|
|
|
2501
2534
|
border-right-color: var(--univer-gray-200);
|
|
2502
2535
|
}
|
|
2503
2536
|
|
|
2537
|
+
.\[\&_\[cmdk-group-heading\]\]\:univer-px-2 [cmdk-group-heading] {
|
|
2538
|
+
padding-left: .5rem;
|
|
2539
|
+
padding-right: .5rem;
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
.\[\&_\[cmdk-group-heading\]\]\:univer-py-1\.5 [cmdk-group-heading] {
|
|
2543
|
+
padding-top: .375rem;
|
|
2544
|
+
padding-bottom: .375rem;
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
.\[\&_\[cmdk-group-heading\]\]\:univer-text-xs [cmdk-group-heading] {
|
|
2548
|
+
font-size: .75rem;
|
|
2549
|
+
line-height: 1rem;
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
.\[\&_\[cmdk-group-heading\]\]\:univer-font-medium [cmdk-group-heading] {
|
|
2553
|
+
font-weight: 500;
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
.\[\&_\[cmdk-group-heading\]\]\:univer-text-gray-500 [cmdk-group-heading] {
|
|
2557
|
+
color: var(--univer-gray-500);
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2504
2560
|
.\[\&_\[data-description\]\]\:univer-text-sm [data-description] {
|
|
2505
2561
|
font-size: .875rem;
|
|
2506
2562
|
line-height: 1.25rem;
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CalendarIcon, CheckMarkIcon, ClockIcon, CloseIcon, DeleteIcon, DownIcon, ErrorIcon, InfoIcon, LoadingMultiIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, MoreUpIcon, OneToOneIcon, SuccessIcon, WarningIcon, ZoomInIcon, ZoomOutIcon } from "@univerjs/icons";
|
|
1
|
+
import { CalendarIcon, CheckMarkIcon, ClockIcon, CloseIcon, DeleteIcon, DownIcon, ErrorIcon, InfoIcon, LoadingMultiIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, MoreUpIcon, OneToOneIcon, SearchIcon, SuccessIcon, WarningIcon, ZoomInIcon, ZoomOutIcon } from "@univerjs/icons";
|
|
2
2
|
import { Children, cloneElement, createContext, forwardRef, isValidElement, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { clsx as clsx$1 } from "clsx";
|
|
4
4
|
import { extendTailwindMerge } from "tailwind-merge";
|
|
@@ -9,6 +9,7 @@ import { Slot } from "@radix-ui/react-slot";
|
|
|
9
9
|
import { CheckboxItem, Content, Item, ItemIndicator, Portal, RadioGroup as RadioGroup$1, RadioItem, Root, Separator as Separator$1, Sub, SubContent, SubTrigger, Trigger } from "@radix-ui/react-dropdown-menu";
|
|
10
10
|
import { Content as Content$1, Portal as Portal$1, Root as Root$1, Trigger as Trigger$1 } from "@radix-ui/react-popover";
|
|
11
11
|
import { Close, Content as Content$2, Description, Overlay, Portal as Portal$2, Root as Root$2, Title } from "@radix-ui/react-dialog";
|
|
12
|
+
import { Command as Command$1 } from "cmdk";
|
|
12
13
|
import { createPortal } from "react-dom";
|
|
13
14
|
import { Content as Content$3, Portal as Portal$3, Root as Root$3, Trigger as Trigger$2 } from "@radix-ui/react-hover-card";
|
|
14
15
|
import { Toaster as Toaster$1, toast, toast as toast$1 } from "sonner";
|
|
@@ -2061,6 +2062,69 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
2061
2062
|
});
|
|
2062
2063
|
}
|
|
2063
2064
|
|
|
2065
|
+
//#endregion
|
|
2066
|
+
//#region src/components/command/Command.tsx
|
|
2067
|
+
function Command({ className, ...props }) {
|
|
2068
|
+
return /* @__PURE__ */ jsx(Command$1, {
|
|
2069
|
+
"data-slot": "command",
|
|
2070
|
+
className: clsx("univer-flex univer-h-full univer-w-full univer-flex-col univer-overflow-hidden univer-rounded-md univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-700 dark:!univer-text-white", className),
|
|
2071
|
+
...props
|
|
2072
|
+
});
|
|
2073
|
+
}
|
|
2074
|
+
function CommandInput({ className, ...props }) {
|
|
2075
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2076
|
+
"data-slot": "command-input-wrapper",
|
|
2077
|
+
className: "univer-flex univer-h-10 univer-items-center univer-gap-2 univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-px-3 dark:!univer-border-gray-600 [&>svg]:univer-size-4 [&>svg]:univer-shrink-0 [&>svg]:univer-text-gray-400",
|
|
2078
|
+
children: [/* @__PURE__ */ jsx(SearchIcon, {}), /* @__PURE__ */ jsx(Command$1.Input, {
|
|
2079
|
+
"data-slot": "command-input",
|
|
2080
|
+
className: clsx("univer-h-10 univer-w-full univer-border-none univer-bg-transparent univer-text-sm univer-outline-none placeholder:univer-text-gray-400", className),
|
|
2081
|
+
...props
|
|
2082
|
+
})]
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
function CommandList({ className, ...props }) {
|
|
2086
|
+
return /* @__PURE__ */ jsx(Command$1.List, {
|
|
2087
|
+
"data-slot": "command-list",
|
|
2088
|
+
className: clsx("univer-max-h-[300px] univer-overflow-y-auto univer-overflow-x-hidden univer-p-1 [scroll-padding-block:4px]", className),
|
|
2089
|
+
...props
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
function CommandEmpty({ className, ...props }) {
|
|
2093
|
+
return /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
2094
|
+
"data-slot": "command-empty",
|
|
2095
|
+
className: clsx("univer-py-6 univer-text-center univer-text-sm univer-text-gray-500", className),
|
|
2096
|
+
...props
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
function CommandGroup({ className, ...props }) {
|
|
2100
|
+
return /* @__PURE__ */ jsx(Command$1.Group, {
|
|
2101
|
+
"data-slot": "command-group",
|
|
2102
|
+
className: clsx("univer-overflow-hidden univer-p-1 [&_[cmdk-group-heading]]:univer-px-2 [&_[cmdk-group-heading]]:univer-py-1.5 [&_[cmdk-group-heading]]:univer-text-xs [&_[cmdk-group-heading]]:univer-font-medium [&_[cmdk-group-heading]]:univer-text-gray-500", className),
|
|
2103
|
+
...props
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
function CommandItem({ className, ...props }) {
|
|
2107
|
+
return /* @__PURE__ */ jsx(Command$1.Item, {
|
|
2108
|
+
"data-slot": "command-item",
|
|
2109
|
+
className: clsx("univer-relative univer-flex univer-cursor-default univer-select-none univer-items-center univer-gap-2 univer-rounded univer-px-2 univer-py-1.5 univer-text-sm univer-outline-none data-[disabled=true]:univer-pointer-events-none data-[selected=true]:univer-bg-gray-100 data-[disabled=true]:univer-opacity-50 dark:data-[selected=true]:!univer-bg-gray-600", className),
|
|
2110
|
+
...props
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
function CommandSeparator({ className, ...props }) {
|
|
2114
|
+
return /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
2115
|
+
"data-slot": "command-separator",
|
|
2116
|
+
className: clsx("univer-my-1 univer-h-px univer-bg-gray-200 dark:!univer-bg-gray-600", className),
|
|
2117
|
+
...props
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2120
|
+
function CommandShortcut({ className, ...props }) {
|
|
2121
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2122
|
+
"data-slot": "command-shortcut",
|
|
2123
|
+
className: clsx("univer-ml-auto univer-text-xs univer-tracking-widest univer-text-gray-400 rtl:univer-ml-0 rtl:univer-mr-auto", className),
|
|
2124
|
+
...props
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2064
2128
|
//#endregion
|
|
2065
2129
|
//#region src/components/confirm/Confirm.tsx
|
|
2066
2130
|
function Footer(props) {
|
|
@@ -2708,7 +2772,7 @@ const Input = forwardRef(({ autoFocus = false, className, style, type = "text",
|
|
|
2708
2772
|
|
|
2709
2773
|
//#endregion
|
|
2710
2774
|
//#region src/components/input-number/InputNumber.tsx
|
|
2711
|
-
const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, step = 1, precision, formatter, parser, controls = true, className, inputClassName, controlsClassName, disabled, onChange, onKeyDown, onPressEnter, onFocus, onBlur, allowEmpty = false }, ref) => {
|
|
2775
|
+
const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, step = 1, precision, formatter, parser, controls = true, className, inputClassName, controlsClassName, disabled, onChange, onKeyDown, onPressEnter, onFocus, onBlur, allowEmpty = false, allowClear = false }, ref) => {
|
|
2712
2776
|
const { locale } = useContext(ConfigContext);
|
|
2713
2777
|
const [internalValue, setInternalValue] = useState(value !== void 0 ? value : defaultValue !== void 0 ? defaultValue : null);
|
|
2714
2778
|
const lastValidValueRef = useRef(internalValue);
|
|
@@ -2854,6 +2918,7 @@ const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Num
|
|
|
2854
2918
|
className: clsx("univer-box-border", inputClassName),
|
|
2855
2919
|
size,
|
|
2856
2920
|
value: inputValue,
|
|
2921
|
+
allowClear,
|
|
2857
2922
|
disabled,
|
|
2858
2923
|
onChange: handleInputChange,
|
|
2859
2924
|
onFocus,
|
|
@@ -4508,4 +4573,4 @@ function resizeObserverCtor(callback) {
|
|
|
4508
4573
|
}
|
|
4509
4574
|
|
|
4510
4575
|
//#endregion
|
|
4511
|
-
export { Accordion, Avatar, Badge, Button, ButtonGroup, Calendar, CascaderList, Checkbox, CheckboxGroup, ColorPicker, ColorPresets, ConfigContext, ConfigProvider, Confirm, DatePicker, DateRangePicker, Dialog, DraggableList, Dropdown, DropdownMenu, FormDualColumnLayout, FormLayout, Gallery, GradientColorPicker, HoverCard, Input, InputNumber, KBD, MessageType, Messager, MultipleSelect, Pager, Panel, PanelField, PanelSection, Popup, Radio, RadioGroup, Segmented, Select, SelectList, Separator, Switch, Textarea, TimeInput, Toaster, Tooltip, Tree, TreeSelectionMode, borderBottomClassName, borderClassName, borderLeftBottomClassName, borderLeftClassName, borderRightClassName, borderTopClassName, clsx, cva, divideXClassName, divideYClassName, filterLeafNode, findNodePathFromTree, findSubTreeFromPath, isBrowser, mergeTreeSelected, message, removeMessage, render, resetButtonClassName, resizeObserverCtor, scrollbarClassName, selectClassName, toast, unmount };
|
|
4576
|
+
export { Accordion, Avatar, Badge, Button, ButtonGroup, Calendar, CascaderList, Checkbox, CheckboxGroup, ColorPicker, ColorPresets, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfigContext, ConfigProvider, Confirm, DatePicker, DateRangePicker, Dialog, DraggableList, Dropdown, DropdownMenu, FormDualColumnLayout, FormLayout, Gallery, GradientColorPicker, HoverCard, Input, InputNumber, KBD, MessageType, Messager, MultipleSelect, Pager, Panel, PanelField, PanelSection, Popup, Radio, RadioGroup, Segmented, Select, SelectList, Separator, Switch, Textarea, TimeInput, Toaster, Tooltip, Tree, TreeSelectionMode, borderBottomClassName, borderClassName, borderLeftBottomClassName, borderLeftClassName, borderRightClassName, borderTopClassName, clsx, cva, divideXClassName, divideYClassName, filterLeafNode, findNodePathFromTree, findSubTreeFromPath, isBrowser, mergeTreeSelected, message, removeMessage, render, resetButtonClassName, resizeObserverCtor, scrollbarClassName, selectClassName, toast, unmount };
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
import type { ComponentProps } from 'react';
|
|
17
|
+
import { Command as CommandPrimitive } from 'cmdk';
|
|
18
|
+
export declare function Command({ className, ...props }: ComponentProps<typeof CommandPrimitive>): import("react").JSX.Element;
|
|
19
|
+
export declare function CommandInput({ className, ...props }: ComponentProps<typeof CommandPrimitive.Input>): import("react").JSX.Element;
|
|
20
|
+
export declare function CommandList({ className, ...props }: ComponentProps<typeof CommandPrimitive.List>): import("react").JSX.Element;
|
|
21
|
+
export declare function CommandEmpty({ className, ...props }: ComponentProps<typeof CommandPrimitive.Empty>): import("react").JSX.Element;
|
|
22
|
+
export declare function CommandGroup({ className, ...props }: ComponentProps<typeof CommandPrimitive.Group>): import("react").JSX.Element;
|
|
23
|
+
export declare function CommandItem({ className, ...props }: ComponentProps<typeof CommandPrimitive.Item>): import("react").JSX.Element;
|
|
24
|
+
export declare function CommandSeparator({ className, ...props }: ComponentProps<typeof CommandPrimitive.Separator>): import("react").JSX.Element;
|
|
25
|
+
export declare function CommandShortcut({ className, ...props }: ComponentProps<'span'>): import("react").JSX.Element;
|
|
@@ -32,5 +32,6 @@ export interface IInputNumberProps extends Omit<InputHTMLAttributes<HTMLInputEle
|
|
|
32
32
|
onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
33
33
|
onPressEnter?: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
34
34
|
allowEmpty?: boolean;
|
|
35
|
+
allowClear?: boolean;
|
|
35
36
|
}
|
|
36
37
|
export declare const InputNumber: import("react").ForwardRefExoticComponent<IInputNumberProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -26,6 +26,9 @@ export declare const InputNumberDisabled: {
|
|
|
26
26
|
export declare const InputNumberHideControls: {
|
|
27
27
|
render(): import("react").JSX.Element;
|
|
28
28
|
};
|
|
29
|
+
export declare const InputNumberAllowClear: {
|
|
30
|
+
render(): import("react").JSX.Element;
|
|
31
|
+
};
|
|
29
32
|
export declare const InputNumberRtl: {
|
|
30
33
|
render(): import("react").JSX.Element;
|
|
31
34
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export type { ICheckboxProps } from './components/checkbox/Checkbox';
|
|
|
34
34
|
export { ColorPicker } from './components/color-picker/ColorPicker';
|
|
35
35
|
export type { IColorPickerProps } from './components/color-picker/ColorPicker';
|
|
36
36
|
export { ColorPresets } from './components/color-picker/ColorPresets';
|
|
37
|
+
export { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, } from './components/command/Command';
|
|
37
38
|
export { ConfigContext, ConfigProvider } from './components/config-provider/ConfigProvider';
|
|
38
39
|
export type { IConfigProviderProps } from './components/config-provider/ConfigProvider';
|
|
39
40
|
export { Confirm } from './components/confirm/Confirm';
|