@univerjs/design 1.0.0-alpha.8 → 1.0.0-beta.1
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 +187 -189
- package/lib/cjs/locale/ar-SA.js +0 -2
- package/lib/cjs/locale/ca-ES.js +0 -2
- package/lib/cjs/locale/de-DE.js +0 -2
- package/lib/cjs/locale/en-US.js +0 -2
- package/lib/cjs/locale/es-ES.js +0 -2
- package/lib/cjs/locale/fa-IR.js +0 -2
- package/lib/cjs/locale/fr-FR.js +0 -2
- package/lib/cjs/locale/id-ID.js +0 -2
- package/lib/cjs/locale/it-IT.js +0 -2
- package/lib/cjs/locale/ja-JP.js +0 -2
- package/lib/cjs/locale/ko-KR.js +0 -2
- package/lib/cjs/locale/pl-PL.js +0 -2
- package/lib/cjs/locale/pt-BR.js +0 -2
- package/lib/cjs/locale/ru-RU.js +0 -2
- package/lib/cjs/locale/sk-SK.js +0 -2
- package/lib/cjs/locale/vi-VN.js +0 -2
- package/lib/cjs/locale/zh-CN.js +0 -2
- package/lib/cjs/locale/zh-HK.js +0 -2
- package/lib/cjs/locale/zh-TW.js +0 -2
- package/lib/es/index.js +187 -189
- package/lib/es/locale/ar-SA.js +0 -2
- package/lib/es/locale/ca-ES.js +0 -2
- package/lib/es/locale/de-DE.js +0 -2
- package/lib/es/locale/en-US.js +0 -2
- package/lib/es/locale/es-ES.js +0 -2
- package/lib/es/locale/fa-IR.js +0 -2
- package/lib/es/locale/fr-FR.js +0 -2
- package/lib/es/locale/id-ID.js +0 -2
- package/lib/es/locale/it-IT.js +0 -2
- package/lib/es/locale/ja-JP.js +0 -2
- package/lib/es/locale/ko-KR.js +0 -2
- package/lib/es/locale/pl-PL.js +0 -2
- package/lib/es/locale/pt-BR.js +0 -2
- package/lib/es/locale/ru-RU.js +0 -2
- package/lib/es/locale/sk-SK.js +0 -2
- package/lib/es/locale/vi-VN.js +0 -2
- package/lib/es/locale/zh-CN.js +0 -2
- package/lib/es/locale/zh-HK.js +0 -2
- package/lib/es/locale/zh-TW.js +0 -2
- package/lib/index.css +56 -49
- package/lib/index.js +187 -189
- package/lib/locale/ar-SA.js +0 -2
- package/lib/locale/ca-ES.js +0 -2
- package/lib/locale/de-DE.js +0 -2
- package/lib/locale/en-US.js +0 -2
- package/lib/locale/es-ES.js +0 -2
- package/lib/locale/fa-IR.js +0 -2
- package/lib/locale/fr-FR.js +0 -2
- package/lib/locale/id-ID.js +0 -2
- package/lib/locale/it-IT.js +0 -2
- package/lib/locale/ja-JP.js +0 -2
- package/lib/locale/ko-KR.js +0 -2
- package/lib/locale/pl-PL.js +0 -2
- package/lib/locale/pt-BR.js +0 -2
- package/lib/locale/ru-RU.js +0 -2
- package/lib/locale/sk-SK.js +0 -2
- package/lib/locale/vi-VN.js +0 -2
- package/lib/locale/zh-CN.js +0 -2
- package/lib/locale/zh-HK.js +0 -2
- package/lib/locale/zh-TW.js +0 -2
- package/lib/types/components/dialog/Dialog.d.ts +4 -0
- package/lib/types/components/dialog/DialogPrimitive.d.ts +1 -0
- package/lib/types/components/select/Select.d.ts +5 -0
- package/lib/types/locale/en-US.d.ts +0 -4
- package/lib/umd/index.js +6 -6
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +4 -4
package/lib/cjs/index.js
CHANGED
|
@@ -26,10 +26,9 @@ function clsx$1(...inputs) {
|
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/components/accordion/Accordion.tsx
|
|
28
28
|
function Accordion(props) {
|
|
29
|
-
var _props$openIndex;
|
|
30
29
|
const { className, defaultOpenIndex = null, items, onOpenIndexChange } = props;
|
|
31
30
|
const [innerOpenIndex, setInnerOpenIndex] = (0, react.useState)(defaultOpenIndex);
|
|
32
|
-
const openIndex =
|
|
31
|
+
const openIndex = props.openIndex ?? innerOpenIndex;
|
|
33
32
|
const toggleItem = (index) => {
|
|
34
33
|
const nextOpenIndex = openIndex === index ? null : index;
|
|
35
34
|
if (props.openIndex === void 0) setInnerOpenIndex(nextOpenIndex);
|
|
@@ -38,36 +37,36 @@ function Accordion(props) {
|
|
|
38
37
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
39
38
|
"data-u-comp": "accordion",
|
|
40
39
|
className: clsx$1("univer-divide-x-0 univer-divide-y univer-divide-solid univer-divide-gray-200 dark:!univer-divide-gray-600", className),
|
|
41
|
-
children: items.map((item, index) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"-univer-rotate-90": openIndex !== index,
|
|
40
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
41
|
+
className: "univer-box-border univer-flex univer-w-full univer-cursor-pointer univer-items-center univer-gap-1.5 univer-border-none univer-bg-transparent univer-p-4 univer-text-left univer-text-gray-700 hover:univer-text-gray-900 focus:univer-outline-none dark:!univer-text-gray-200 dark:hover:!univer-text-gray-0",
|
|
42
|
+
type: "button",
|
|
43
|
+
onClick: () => toggleItem(index),
|
|
44
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, {
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
className: clsx$1("univer-size-2.5 univer-flex-shrink-0 univer-transition-transform", {
|
|
47
|
+
"-univer-rotate-90 rtl:univer-rotate-90": openIndex !== index,
|
|
49
48
|
"univer-rotate-0": openIndex === index
|
|
50
|
-
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
51
|
-
className: "univer-font-medium",
|
|
52
|
-
children: item.label
|
|
53
|
-
})]
|
|
54
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
55
|
-
className: clsx$1("univer-overflow-hidden univer-transition-[max-height,opacity] univer-duration-500 univer-ease-in-out", {
|
|
56
|
-
"univer-max-h-screen": openIndex === index,
|
|
57
|
-
"univer-max-h-0": openIndex !== index
|
|
58
|
-
}),
|
|
59
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
60
|
-
className: "univer-box-border univer-px-4 univer-py-1.5",
|
|
61
|
-
children: item.children
|
|
62
49
|
})
|
|
63
|
-
})
|
|
64
|
-
|
|
50
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
51
|
+
className: "univer-font-medium",
|
|
52
|
+
children: item.label
|
|
53
|
+
})]
|
|
54
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
55
|
+
className: clsx$1("univer-overflow-hidden univer-transition-[max-height,opacity] univer-duration-500 univer-ease-in-out", {
|
|
56
|
+
"univer-max-h-screen": openIndex === index,
|
|
57
|
+
"univer-max-h-0": openIndex !== index
|
|
58
|
+
}),
|
|
59
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
60
|
+
className: "univer-box-border univer-px-4 univer-py-1.5",
|
|
61
|
+
children: item.children
|
|
62
|
+
})
|
|
63
|
+
})] }, item.id ?? index))
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
//#endregion
|
|
69
68
|
//#region src/components/avatar/Avatar.tsx
|
|
70
|
-
const avatarVariants = (0, class_variance_authority.cva)("univer-relative univer-inline-block univer-overflow-hidden univer-whitespace-nowrap univer-bg-gray-200 univer-text-center univer-align-middle univer-text-
|
|
69
|
+
const avatarVariants = (0, class_variance_authority.cva)("univer-relative univer-inline-block univer-overflow-hidden univer-whitespace-nowrap univer-bg-gray-200 univer-text-center univer-align-middle univer-text-gray-0", {
|
|
71
70
|
variants: {
|
|
72
71
|
/**
|
|
73
72
|
* The shape of the avatar
|
|
@@ -159,7 +158,7 @@ function ConfigProvider(props) {
|
|
|
159
158
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConfigContext.Provider, {
|
|
160
159
|
value,
|
|
161
160
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_direction.DirectionProvider, {
|
|
162
|
-
dir: direction
|
|
161
|
+
dir: direction ?? "ltr",
|
|
163
162
|
children
|
|
164
163
|
})
|
|
165
164
|
});
|
|
@@ -191,12 +190,12 @@ function Badge(props) {
|
|
|
191
190
|
const buttonVariants = (0, class_variance_authority.cva)("univer-box-border univer-inline-flex univer-cursor-pointer univer-select-none univer-items-center univer-justify-center univer-gap-2 univer-whitespace-nowrap univer-rounded-md univer-border univer-border-solid univer-text-sm univer-font-medium univer-transition-colors disabled:univer-pointer-events-none disabled:univer-cursor-not-allowed disabled:univer-opacity-50 [&_svg]:univer-pointer-events-none [&_svg]:univer-size-4 [&_svg]:univer-shrink-0", {
|
|
192
191
|
variants: {
|
|
193
192
|
variant: {
|
|
194
|
-
default: "univer-border-gray-200 univer-bg-
|
|
195
|
-
primary: "univer-border-primary-600 univer-bg-primary-600 univer-text-
|
|
196
|
-
danger: "univer-border-red-500 univer-bg-red-500 univer-text-
|
|
197
|
-
text: "univer-border-transparent univer-bg-transparent univer-text-gray-900 hover:univer-bg-gray-100 active:univer-bg-gray-200 dark:!univer-text-
|
|
193
|
+
default: "univer-border-gray-200 univer-bg-gray-0 univer-text-gray-700 hover:univer-bg-gray-100 active:univer-bg-gray-200 dark:!univer-border-gray-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-600 dark:active:!univer-bg-gray-700",
|
|
194
|
+
primary: "univer-border-primary-600 univer-bg-primary-600 univer-text-gray-0 hover:univer-bg-primary-500 active:univer-bg-primary-700",
|
|
195
|
+
danger: "univer-border-red-500 univer-bg-red-500 univer-text-gray-0 hover:univer-border-red-400 hover:univer-bg-red-400 active:univer-border-red-600 active:univer-bg-red-600",
|
|
196
|
+
text: "univer-border-transparent univer-bg-transparent univer-text-gray-900 hover:univer-bg-gray-100 active:univer-bg-gray-200 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700 dark:active:!univer-bg-gray-600",
|
|
198
197
|
link: "univer-underline-current univer-border-transparent univer-bg-transparent univer-text-primary-600 univer-underline-offset-4 hover:univer-text-primary-500 hover:univer-underline active:univer-text-primary-700",
|
|
199
|
-
ghost: "univer-border-transparent univer-bg-transparent univer-text-gray-900 hover:univer-bg-gray-100 active:univer-bg-gray-200 dark:!univer-text-
|
|
198
|
+
ghost: "univer-border-transparent univer-bg-transparent univer-text-gray-900 hover:univer-bg-gray-100 active:univer-bg-gray-200 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700 dark:active:!univer-bg-gray-600"
|
|
200
199
|
},
|
|
201
200
|
size: {
|
|
202
201
|
icon: "univer-size-8 !univer-p-0",
|
|
@@ -327,7 +326,7 @@ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
|
327
326
|
function DropdownMenuSubContent({ className, ...props }) {
|
|
328
327
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.SubContent, {
|
|
329
328
|
"data-slot": "dropdown-menu-sub-content",
|
|
330
|
-
className: clsx$1("data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[side=bottom]:univer-slide-in-from-top-2 data-[side=left]:univer-slide-in-from-right-2 data-[side=right]:univer-slide-in-from-left-2 data-[side=top]:univer-slide-in-from-bottom-2 univer-z-[1080] univer-box-border univer-max-h-[--radix-popper-available-height] univer-overflow-y-auto univer-rounded-md univer-bg-
|
|
329
|
+
className: clsx$1("data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[side=bottom]:univer-slide-in-from-top-2 data-[side=left]:univer-slide-in-from-right-2 data-[side=right]:univer-slide-in-from-left-2 data-[side=top]:univer-slide-in-from-bottom-2 univer-z-[1080] univer-box-border univer-max-h-[--radix-popper-available-height] univer-overflow-y-auto univer-rounded-md univer-bg-gray-0 univer-p-1.5 univer-text-gray-900 univer-shadow-md dark:!univer-bg-gray-700 dark:!univer-text-gray-0", borderClassName, scrollbarClassName, className),
|
|
331
330
|
...props
|
|
332
331
|
});
|
|
333
332
|
}
|
|
@@ -335,7 +334,7 @@ function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
|
335
334
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Content, {
|
|
336
335
|
"data-slot": "dropdown-menu-content",
|
|
337
336
|
sideOffset,
|
|
338
|
-
className: clsx$1("data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[side=bottom]:univer-slide-in-from-top-2 data-[side=left]:univer-slide-in-from-right-2 data-[side=right]:univer-slide-in-from-left-2 data-[side=top]:univer-slide-in-from-bottom-2 univer-z-[1080] univer-box-border univer-max-h-[--radix-popper-available-height] univer-overflow-y-auto univer-rounded-md univer-bg-
|
|
337
|
+
className: clsx$1("data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[side=bottom]:univer-slide-in-from-top-2 data-[side=left]:univer-slide-in-from-right-2 data-[side=right]:univer-slide-in-from-left-2 data-[side=top]:univer-slide-in-from-bottom-2 univer-z-[1080] univer-box-border univer-max-h-[--radix-popper-available-height] univer-overflow-y-auto univer-rounded-md univer-bg-gray-0 univer-p-1.5 univer-text-gray-900 univer-shadow-md dark:!univer-bg-gray-700 dark:!univer-text-gray-0", borderClassName, scrollbarClassName, className),
|
|
339
338
|
...props
|
|
340
339
|
}) });
|
|
341
340
|
}
|
|
@@ -489,7 +488,7 @@ function PopoverContent({ className, align = "center", sideOffset = 4, ...props
|
|
|
489
488
|
"data-slot": "popover-content",
|
|
490
489
|
align,
|
|
491
490
|
sideOffset,
|
|
492
|
-
className: clsx$1("univer-outline-hidden data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[side=bottom]:univer-slide-in-from-top-2 data-[side=left]:univer-slide-in-from-right-2 data-[side=right]:univer-slide-in-from-left-2 data-[side=top]:univer-slide-in-from-bottom-2 univer-z-[1080] univer-max-h-[--radix-popper-available-height] univer-overflow-y-auto univer-rounded-md univer-bg-
|
|
491
|
+
className: clsx$1("univer-outline-hidden data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[side=bottom]:univer-slide-in-from-top-2 data-[side=left]:univer-slide-in-from-right-2 data-[side=right]:univer-slide-in-from-left-2 data-[side=top]:univer-slide-in-from-bottom-2 univer-z-[1080] univer-max-h-[--radix-popper-available-height] univer-overflow-y-auto univer-rounded-md univer-bg-gray-0 univer-text-gray-900 univer-shadow-md dark:!univer-bg-gray-900 dark:!univer-text-gray-0 dark:focus-visible:!univer-border-gray-600", borderClassName, scrollbarClassName, className),
|
|
493
492
|
...props
|
|
494
493
|
}) });
|
|
495
494
|
}
|
|
@@ -540,7 +539,7 @@ function pad(value, length = 2) {
|
|
|
540
539
|
return String(value).padStart(length, "0");
|
|
541
540
|
}
|
|
542
541
|
function formatDateWithPattern(value, pattern) {
|
|
543
|
-
const date = value
|
|
542
|
+
const date = value ?? /* @__PURE__ */ new Date();
|
|
544
543
|
if (Number.isNaN(date.getTime())) return "Invalid Date";
|
|
545
544
|
const tokenMap = {
|
|
546
545
|
YYYY: String(date.getFullYear()),
|
|
@@ -550,10 +549,7 @@ function formatDateWithPattern(value, pattern) {
|
|
|
550
549
|
mm: pad(date.getMinutes()),
|
|
551
550
|
ss: pad(date.getSeconds())
|
|
552
551
|
};
|
|
553
|
-
return pattern.replace(/YYYY|MM|DD|HH|mm|ss/g, (token) =>
|
|
554
|
-
var _tokenMap$token;
|
|
555
|
-
return (_tokenMap$token = tokenMap[token]) !== null && _tokenMap$token !== void 0 ? _tokenMap$token : token;
|
|
556
|
-
});
|
|
552
|
+
return pattern.replace(/YYYY|MM|DD|HH|mm|ss/g, (token) => tokenMap[token] ?? token);
|
|
557
553
|
}
|
|
558
554
|
|
|
559
555
|
//#endregion
|
|
@@ -562,7 +558,7 @@ function TimeInput(props) {
|
|
|
562
558
|
const { className, value, onValueChange } = props;
|
|
563
559
|
function handleChangeTime(event) {
|
|
564
560
|
const [hours, minutes, seconds] = event.target.value.split(":").map(Number);
|
|
565
|
-
const newValue = new Date(value
|
|
561
|
+
const newValue = new Date(value ?? Date.now());
|
|
566
562
|
newValue.setHours(hours, minutes, seconds, 0);
|
|
567
563
|
onValueChange === null || onValueChange === void 0 || onValueChange(newValue);
|
|
568
564
|
}
|
|
@@ -570,7 +566,7 @@ function TimeInput(props) {
|
|
|
570
566
|
"data-u-comp": "time-input",
|
|
571
567
|
className: "univer-relative univer-mx-auto univer-mt-1 univer-w-fit",
|
|
572
568
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.ClockIcon, { className: "univer-absolute univer-left-2 univer-top-1/2 -univer-translate-y-1/2 univer-text-gray-600 dark:!univer-text-gray-400" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
573
|
-
className: clsx$1("univer-block univer-h-7 univer-w-fit univer-appearance-none univer-rounded-md univer-bg-transparent univer-pl-6 univer-pr-2 univer-text-center univer-text-gray-800 univer-shadow univer-outline-none univer-transition-all univer-duration-200 focus:univer-border-primary-600 dark:!univer-text-
|
|
569
|
+
className: clsx$1("univer-block univer-h-7 univer-w-fit univer-appearance-none univer-rounded-md univer-bg-transparent univer-pl-6 univer-pr-2 univer-text-center univer-text-gray-800 univer-shadow univer-outline-none univer-transition-all univer-duration-200 focus:univer-border-primary-600 dark:!univer-text-gray-0 dark:focus:!univer-border-primary-500 [&::-webkit-calendar-picker-indicator]:univer-hidden [&::-webkit-calendar-picker-indicator]:univer-appearance-none", borderClassName, className),
|
|
574
570
|
type: "time",
|
|
575
571
|
step: "1",
|
|
576
572
|
value: formatDateWithPattern(value, "HH:mm:ss"),
|
|
@@ -660,8 +656,8 @@ function Calendar(props) {
|
|
|
660
656
|
const { direction = "ltr", locale } = (0, react.useContext)(ConfigContext);
|
|
661
657
|
const { ariaLabels, year, weekDays, months } = locale === null || locale === void 0 ? void 0 : locale.Calendar;
|
|
662
658
|
const today = /* @__PURE__ */ new Date();
|
|
663
|
-
const [currentYear, setCurrentYear] = (0, react.useState)((value
|
|
664
|
-
const [currentMonth, setCurrentMonth] = (0, react.useState)((value
|
|
659
|
+
const [currentYear, setCurrentYear] = (0, react.useState)((value ?? today).getFullYear());
|
|
660
|
+
const [currentMonth, setCurrentMonth] = (0, react.useState)((value ?? today).getMonth());
|
|
665
661
|
const [yearDropdownOpen, setYearDropdownOpen] = (0, react.useState)(false);
|
|
666
662
|
function prevMonth() {
|
|
667
663
|
setCurrentMonth((prev) => {
|
|
@@ -689,9 +685,8 @@ function Calendar(props) {
|
|
|
689
685
|
setYearDropdownOpen(false);
|
|
690
686
|
}
|
|
691
687
|
const yearOptions = (0, react.useMemo)(() => {
|
|
692
|
-
|
|
693
|
-
const
|
|
694
|
-
const endYear = (_max$getFullYear = max === null || max === void 0 ? void 0 : max.getFullYear()) !== null && _max$getFullYear !== void 0 ? _max$getFullYear : currentYear + DEFAULT_YEAR_RANGE;
|
|
688
|
+
const startYear = (min === null || min === void 0 ? void 0 : min.getFullYear()) ?? currentYear - DEFAULT_YEAR_RANGE;
|
|
689
|
+
const endYear = (max === null || max === void 0 ? void 0 : max.getFullYear()) ?? currentYear + DEFAULT_YEAR_RANGE;
|
|
695
690
|
return Array.from({ length: Math.max(0, endYear - startYear + 1) }, (_, index) => ({ year: startYear + index }));
|
|
696
691
|
}, [
|
|
697
692
|
currentYear,
|
|
@@ -724,37 +719,34 @@ function Calendar(props) {
|
|
|
724
719
|
return day && currentYear === today.getFullYear() && currentMonth === today.getMonth() && day === today.getDate();
|
|
725
720
|
}
|
|
726
721
|
function isDisabled(day) {
|
|
727
|
-
var _value$getHours, _value$getMinutes, _value$getSeconds;
|
|
728
722
|
if (!day) return false;
|
|
729
|
-
const hours = (
|
|
730
|
-
const minutes = (
|
|
731
|
-
const seconds = (
|
|
723
|
+
const hours = (value === null || value === void 0 ? void 0 : value.getHours()) ?? today.getHours();
|
|
724
|
+
const minutes = (value === null || value === void 0 ? void 0 : value.getMinutes()) ?? today.getMinutes();
|
|
725
|
+
const seconds = (value === null || value === void 0 ? void 0 : value.getSeconds()) ?? today.getSeconds();
|
|
732
726
|
const d = new Date(currentYear, currentMonth, day, hours, minutes, seconds);
|
|
733
727
|
if (min && d < min) return true;
|
|
734
728
|
if (max && d > max) return true;
|
|
735
729
|
return false;
|
|
736
730
|
}
|
|
737
731
|
function handleChangeDate(day) {
|
|
738
|
-
var _value$getHours2, _value$getMinutes2, _value$getSeconds2;
|
|
739
732
|
if (isDisabled(day)) return;
|
|
740
|
-
const hours = (
|
|
741
|
-
const minutes = (
|
|
742
|
-
const seconds = (
|
|
733
|
+
const hours = (value === null || value === void 0 ? void 0 : value.getHours()) ?? today.getHours();
|
|
734
|
+
const minutes = (value === null || value === void 0 ? void 0 : value.getMinutes()) ?? today.getMinutes();
|
|
735
|
+
const seconds = (value === null || value === void 0 ? void 0 : value.getSeconds()) ?? today.getSeconds();
|
|
743
736
|
const selectedDate = new Date(currentYear, currentMonth, day, hours, minutes, seconds);
|
|
744
737
|
onValueChange === null || onValueChange === void 0 || onValueChange(selectedDate);
|
|
745
738
|
}
|
|
746
739
|
function handleChangeTime(time) {
|
|
747
|
-
var _value$getDate;
|
|
748
740
|
const hours = time.getHours();
|
|
749
741
|
const minutes = time.getMinutes();
|
|
750
742
|
const seconds = time.getSeconds();
|
|
751
|
-
const updatedDate = new Date(currentYear, currentMonth, (
|
|
743
|
+
const updatedDate = new Date(currentYear, currentMonth, (value === null || value === void 0 ? void 0 : value.getDate()) ?? today.getDate(), hours, minutes, seconds);
|
|
752
744
|
onValueChange === null || onValueChange === void 0 || onValueChange(updatedDate);
|
|
753
745
|
}
|
|
754
746
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
755
747
|
"data-u-comp": "calendar",
|
|
756
748
|
dir: direction,
|
|
757
|
-
className: clsx$1("univer-mx-auto univer-max-w-xs univer-select-none univer-rounded univer-bg-
|
|
749
|
+
className: clsx$1("univer-mx-auto univer-max-w-xs univer-select-none univer-rounded univer-bg-gray-0 univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-gray-0", className),
|
|
758
750
|
children: [
|
|
759
751
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("nav", {
|
|
760
752
|
className: "univer-mb-4 univer-flex univer-items-center univer-justify-between",
|
|
@@ -779,7 +771,7 @@ function Calendar(props) {
|
|
|
779
771
|
itemHeight: YEAR_ITEM_HEIGHT,
|
|
780
772
|
itemKey: "year",
|
|
781
773
|
children: (item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
782
|
-
className: clsx$1("univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-center univer-rounded univer-border-none univer-bg-transparent univer-px-2 univer-text-sm univer-text-gray-900 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-
|
|
774
|
+
className: clsx$1("univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-center univer-rounded univer-border-none univer-bg-transparent univer-px-2 univer-text-sm univer-text-gray-900 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-600", { "univer-bg-gray-200 dark:!univer-bg-gray-500": item.year === currentYear }),
|
|
783
775
|
type: "button",
|
|
784
776
|
onClick: () => handleChangeYear(item.year),
|
|
785
777
|
children: item.year
|
|
@@ -820,9 +812,9 @@ function Calendar(props) {
|
|
|
820
812
|
className: "univer-grid univer-grid-cols-7 univer-gap-1 univer-text-center",
|
|
821
813
|
children: days.map((day, idx) => day ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DayButton, {
|
|
822
814
|
className: clsx$1({
|
|
823
|
-
"!univer-bg-primary-600 univer-font-bold univer-text-
|
|
824
|
-
"dark:!univer-text-
|
|
825
|
-
"!univer-bg-primary-600 univer-text-
|
|
815
|
+
"!univer-bg-primary-600 univer-font-bold univer-text-gray-0": !isToday(day) && isSelected(day),
|
|
816
|
+
"dark:!univer-text-gray-0": !isToday(day) && !isSelected(day),
|
|
817
|
+
"!univer-bg-primary-600 univer-text-gray-0": isToday(day) && isSelected(day),
|
|
826
818
|
"univer-font-semibold univer-text-primary-600 dark:!univer-text-primary-500": isToday(day) && !isSelected(day),
|
|
827
819
|
"univer-cursor-not-allowed univer-opacity-40": isDisabled(day),
|
|
828
820
|
"univer-hover:bg-primary-100 univer-cursor-pointer univer-text-gray-800": !isSelected(day) && !isDisabled(day)
|
|
@@ -888,7 +880,7 @@ function CascaderList(props) {
|
|
|
888
880
|
}
|
|
889
881
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
890
882
|
"data-u-comp": "cascader-list",
|
|
891
|
-
className: clsx$1("univer-overflow-auto-y univer-grid univer-h-full univer-max-h-80 univer-grid-flow-col univer-rounded univer-py-2 univer-text-gray-900 dark:!univer-text-
|
|
883
|
+
className: clsx$1("univer-overflow-auto-y univer-grid univer-h-full univer-max-h-80 univer-grid-flow-col univer-rounded univer-py-2 univer-text-gray-900 dark:!univer-text-gray-0 [&>ul:not(:last-child)]:univer-border-0 [&>ul:not(:last-child)]:univer-border-r [&>ul:not(:last-child)]:univer-border-solid [&>ul:not(:last-child)]:univer-border-r-gray-200", borderClassName, scrollbarClassName, wrapperClassName),
|
|
892
884
|
children: [activeOptions.map((options, index) => options.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
893
885
|
className: clsx$1("univer-m-0 univer-h-full univer-max-h-full univer-list-none univer-overflow-auto univer-px-2", scrollbarClassName, contentClassName),
|
|
894
886
|
children: options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
@@ -926,7 +918,7 @@ function CheckboxGroup(props) {
|
|
|
926
918
|
key: index,
|
|
927
919
|
children: child.props.children,
|
|
928
920
|
checked: child.props.value ? value.includes(child.props.value) : false,
|
|
929
|
-
disabled: disabled
|
|
921
|
+
disabled: disabled ?? child.props.disabled,
|
|
930
922
|
onChange: handleChange
|
|
931
923
|
});
|
|
932
924
|
return child;
|
|
@@ -947,15 +939,15 @@ function Checkbox(props) {
|
|
|
947
939
|
if (!onChange || disabled) return;
|
|
948
940
|
if (typeof value !== "undefined") onChange === null || onChange === void 0 || onChange(value);
|
|
949
941
|
else {
|
|
950
|
-
var _inputRef$current
|
|
951
|
-
const checked = (
|
|
942
|
+
var _inputRef$current;
|
|
943
|
+
const checked = (inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.checked) ?? false;
|
|
952
944
|
onChange === null || onChange === void 0 || onChange(checked);
|
|
953
945
|
}
|
|
954
946
|
}
|
|
955
947
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
956
948
|
"data-u-comp": "checkbox",
|
|
957
949
|
className: clsx$1("univer-box-border univer-inline-flex univer-items-center univer-gap-2 univer-text-sm", {
|
|
958
|
-
"univer-cursor-pointer univer-text-gray-900 dark:!univer-text-
|
|
950
|
+
"univer-cursor-pointer univer-text-gray-900 dark:!univer-text-gray-0": !disabled,
|
|
959
951
|
"univer-text-gray-400": disabled
|
|
960
952
|
}, className),
|
|
961
953
|
style,
|
|
@@ -974,7 +966,7 @@ function Checkbox(props) {
|
|
|
974
966
|
"univer-border-primary-600 univer-bg-primary-600": checked || indeterminate,
|
|
975
967
|
"univer-border-gray-300 univer-bg-gray-50 dark:!univer-border-gray-500 dark:!univer-bg-gray-600": !checked && !indeterminate
|
|
976
968
|
}),
|
|
977
|
-
children: [checked && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CheckMarkIcon, { className: "univer-absolute univer-left-1/2 univer-top-1/2 univer-block univer-size-3 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-text-
|
|
969
|
+
children: [checked && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CheckMarkIcon, { className: "univer-absolute univer-left-1/2 univer-top-1/2 univer-block univer-size-3 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-text-gray-0" }), indeterminate && !checked && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "univer-absolute univer-left-1/2 univer-top-1/2 univer-block univer-h-0.5 univer-w-2.5 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-rounded univer-bg-gray-0" })]
|
|
978
970
|
})]
|
|
979
971
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
980
972
|
className: clsx$1("univer-select-none", contentClassName),
|
|
@@ -993,11 +985,11 @@ const DialogOverlay = (0, react.forwardRef)(({ className, ...props }, ref) => /*
|
|
|
993
985
|
...props
|
|
994
986
|
}));
|
|
995
987
|
DialogOverlay.displayName = _radix_ui_react_dialog.Overlay.displayName;
|
|
996
|
-
const DialogContent = (0, react.forwardRef)(({ className, children, closable = true, onClickClose, mountContainer, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogPortal, {
|
|
997
|
-
container: mountContainer
|
|
998
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogOverlay, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dialog.Content, {
|
|
988
|
+
const DialogContent = (0, react.forwardRef)(({ className, children, closable = true, onClickClose, mountContainer, overlayClassName, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogPortal, {
|
|
989
|
+
container: mountContainer ?? void 0,
|
|
990
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogOverlay, { className: overlayClassName }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dialog.Content, {
|
|
999
991
|
ref,
|
|
1000
|
-
className: clsx$1("data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=open]:univer-slide-in-from-left-1/2 data-[state=open]:univer-slide-in-from-top-[48%] data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[state=closed]:univer-slide-out-to-left-1/2 data-[state=closed]:univer-slide-out-to-top-[48%] univer-fixed univer-left-1/2 univer-top-1/2 univer-z-[1080] univer-box-border univer-grid univer-w-full univer-max-w-lg -univer-translate-x-1/2 -univer-translate-y-1/2 univer-gap-4 univer-bg-
|
|
992
|
+
className: clsx$1("data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=open]:univer-slide-in-from-left-1/2 data-[state=open]:univer-slide-in-from-top-[48%] data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[state=closed]:univer-slide-out-to-left-1/2 data-[state=closed]:univer-slide-out-to-top-[48%] univer-fixed univer-left-1/2 univer-top-1/2 univer-z-[1080] univer-box-border univer-grid univer-w-full univer-max-w-lg -univer-translate-x-1/2 -univer-translate-y-1/2 univer-gap-4 univer-bg-gray-0 univer-p-4 univer-text-gray-500 univer-shadow-md univer-duration-200 sm:!univer-rounded-lg dark:!univer-bg-gray-700 dark:!univer-text-gray-400", borderClassName, className),
|
|
1001
993
|
...props,
|
|
1002
994
|
children: [children, closable && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dialog.Close, {
|
|
1003
995
|
"data-slot": "close",
|
|
@@ -1024,7 +1016,7 @@ const DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_
|
|
|
1024
1016
|
DialogFooter.displayName = "DialogFooter";
|
|
1025
1017
|
const DialogTitle = (0, react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Title, {
|
|
1026
1018
|
ref,
|
|
1027
|
-
className: clsx$1("univer-my-0 univer-text-lg univer-font-semibold univer-leading-none univer-tracking-tight univer-text-gray-900 dark:!univer-text-
|
|
1019
|
+
className: clsx$1("univer-my-0 univer-text-lg univer-font-semibold univer-leading-none univer-tracking-tight univer-text-gray-900 dark:!univer-text-gray-0", className),
|
|
1028
1020
|
...props
|
|
1029
1021
|
}));
|
|
1030
1022
|
DialogTitle.displayName = _radix_ui_react_dialog.Title.displayName;
|
|
@@ -1155,13 +1147,13 @@ function useDraggable(options = {}) {
|
|
|
1155
1147
|
};
|
|
1156
1148
|
}
|
|
1157
1149
|
function Dialog(props) {
|
|
1158
|
-
const { className, children, style, open = false, title, width, draggable = false, defaultPosition, footer: propFooter, mask = true, keyboard = true, closable = true, maskClosable = true, showOk, showCancel, onOpenChange, onClose, onOk, onCancel } = props;
|
|
1150
|
+
const { className, overlayClassName, children, style, open = false, title, width, draggable = false, defaultPosition, footer: propFooter, mask = true, keyboard = true, closable = true, maskClosable = true, showOk, showCancel, onOpenChange, onClose, onOk, onCancel } = props;
|
|
1159
1151
|
const { locale, mountContainer, direction } = (0, react.useContext)(ConfigContext);
|
|
1160
1152
|
const { position, isDragging, setElementRef, handleMouseDown } = useDraggable({
|
|
1161
1153
|
defaultPosition,
|
|
1162
1154
|
enabled: draggable
|
|
1163
1155
|
});
|
|
1164
|
-
const footer = propFooter
|
|
1156
|
+
const footer = propFooter ?? (showOk || showCancel ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1165
1157
|
className: "univer-flex univer-justify-end univer-gap-2",
|
|
1166
1158
|
children: [showCancel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
1167
1159
|
onClick: onCancel,
|
|
@@ -1171,7 +1163,7 @@ function Dialog(props) {
|
|
|
1171
1163
|
onClick: onOk,
|
|
1172
1164
|
children: locale === null || locale === void 0 ? void 0 : locale.Confirm.confirm
|
|
1173
1165
|
})]
|
|
1174
|
-
}) : null;
|
|
1166
|
+
}) : null);
|
|
1175
1167
|
const handleContentRef = (0, react.useCallback)((node) => {
|
|
1176
1168
|
if (node && draggable) setElementRef(node);
|
|
1177
1169
|
}, [draggable, setElementRef]);
|
|
@@ -1207,6 +1199,7 @@ function Dialog(props) {
|
|
|
1207
1199
|
},
|
|
1208
1200
|
closable,
|
|
1209
1201
|
mountContainer,
|
|
1202
|
+
overlayClassName,
|
|
1210
1203
|
dir: direction,
|
|
1211
1204
|
onClickClose: handleClickClose,
|
|
1212
1205
|
onEscapeKeyDown: (e) => {
|
|
@@ -1367,10 +1360,10 @@ function AlphaSlider({ hsv, alpha, onChange, onChanged }) {
|
|
|
1367
1360
|
const thumbRef = (0, react.useRef)(null);
|
|
1368
1361
|
const alphaRef = (0, react.useRef)(alpha);
|
|
1369
1362
|
const calculateAlpha = (0, react.useCallback)((clientX) => {
|
|
1370
|
-
var _thumbRef$current
|
|
1363
|
+
var _thumbRef$current;
|
|
1371
1364
|
const slider = sliderRef.current;
|
|
1372
1365
|
if (!slider) return;
|
|
1373
|
-
const thumbSize = (
|
|
1366
|
+
const thumbSize = ((_thumbRef$current = thumbRef.current) === null || _thumbRef$current === void 0 ? void 0 : _thumbRef$current.clientWidth) ?? 0;
|
|
1374
1367
|
const rect = slider.getBoundingClientRect();
|
|
1375
1368
|
const maxX = rect.width - thumbSize;
|
|
1376
1369
|
if (maxX <= 0) {
|
|
@@ -1408,10 +1401,10 @@ function AlphaSlider({ hsv, alpha, onChange, onChanged }) {
|
|
|
1408
1401
|
handlePointerUp
|
|
1409
1402
|
]);
|
|
1410
1403
|
const getThumbPosition = () => {
|
|
1411
|
-
var _thumbRef$
|
|
1404
|
+
var _thumbRef$current2, _sliderRef$current;
|
|
1412
1405
|
const safeAlpha = Math.min(Math.max(alpha * 100, 0), 100);
|
|
1413
|
-
const thumbSize = (
|
|
1414
|
-
const sliderWidth = (
|
|
1406
|
+
const thumbSize = ((_thumbRef$current2 = thumbRef.current) === null || _thumbRef$current2 === void 0 ? void 0 : _thumbRef$current2.clientWidth) ?? 0;
|
|
1407
|
+
const sliderWidth = ((_sliderRef$current = sliderRef.current) === null || _sliderRef$current === void 0 ? void 0 : _sliderRef$current.clientWidth) ?? 0;
|
|
1415
1408
|
const thumbOffsetPercent = sliderWidth > 0 ? thumbSize / sliderWidth * 100 : 0;
|
|
1416
1409
|
return `${safeAlpha / 100 * (100 - thumbOffsetPercent)}%`;
|
|
1417
1410
|
};
|
|
@@ -1438,7 +1431,7 @@ function AlphaSlider({ hsv, alpha, onChange, onChanged }) {
|
|
|
1438
1431
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1439
1432
|
ref: thumbRef,
|
|
1440
1433
|
"data-u-comp": "color-picker-alpha-slider-thumb",
|
|
1441
|
-
className: "univer-absolute univer-top-1/2 univer-box-border univer-size-2 univer-rounded-full univer-bg-transparent univer-shadow-md univer-ring-2 univer-ring-
|
|
1434
|
+
className: "univer-absolute univer-top-1/2 univer-box-border univer-size-2 univer-rounded-full univer-bg-transparent univer-shadow-md univer-ring-2 univer-ring-gray-0 univer-transition-transform univer-duration-75 univer-will-change-transform",
|
|
1442
1435
|
style: {
|
|
1443
1436
|
left: getThumbPosition(),
|
|
1444
1437
|
transform: "translateY(-50%)",
|
|
@@ -1474,7 +1467,7 @@ function HexInput({ hsv, onChange }) {
|
|
|
1474
1467
|
if (!isValidHex(inputValue)) setInputValue(hexValue.replace(/^#/, ""));
|
|
1475
1468
|
};
|
|
1476
1469
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1477
|
-
className: clsx$1("univer-w-full univer-px-2 !univer-pl-4 univer-uppercase focus:univer-border-primary-500 focus:univer-outline-none rtl:!univer-pl-2 rtl:!univer-pr-4 dark:!univer-text-
|
|
1470
|
+
className: clsx$1("univer-w-full univer-px-2 !univer-pl-4 univer-uppercase focus:univer-border-primary-500 focus:univer-outline-none rtl:!univer-pl-2 rtl:!univer-pr-4 dark:!univer-text-gray-0", borderClassName),
|
|
1478
1471
|
value: inputValue,
|
|
1479
1472
|
onChange: handleChange,
|
|
1480
1473
|
onBlur: handleBlur,
|
|
@@ -1498,7 +1491,7 @@ function RgbInput({ hsv, alpha, format, onChange }) {
|
|
|
1498
1491
|
r: Math.round(r),
|
|
1499
1492
|
g: Math.round(g),
|
|
1500
1493
|
b: Math.round(b),
|
|
1501
|
-
a: alpha
|
|
1494
|
+
a: alpha ?? 1
|
|
1502
1495
|
});
|
|
1503
1496
|
}, [hsv, alpha]);
|
|
1504
1497
|
const handleChange = (color, value) => {
|
|
@@ -1530,11 +1523,11 @@ function RgbInput({ hsv, alpha, format, onChange }) {
|
|
|
1530
1523
|
r: Math.round(r),
|
|
1531
1524
|
g: Math.round(g),
|
|
1532
1525
|
b: Math.round(b),
|
|
1533
|
-
a: alpha
|
|
1526
|
+
a: alpha ?? 1
|
|
1534
1527
|
});
|
|
1535
1528
|
};
|
|
1536
1529
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1537
|
-
className: "univer-flex univer-items-center univer-gap-2 [&>input]:univer-w-11 [&>input]:univer-border-gray-200 [&>input]:focus:univer-border-primary-500 dark:[&>input]:!univer-border-gray-600 dark:[&>input]:!univer-text-
|
|
1530
|
+
className: "univer-flex univer-items-center univer-gap-2 [&>input]:univer-w-11 [&>input]:univer-border-gray-200 [&>input]:focus:univer-border-primary-500 dark:[&>input]:!univer-border-gray-600 dark:[&>input]:!univer-text-gray-0",
|
|
1538
1531
|
children: [
|
|
1539
1532
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1540
1533
|
value: localValues.r,
|
|
@@ -1565,7 +1558,7 @@ function RgbInput({ hsv, alpha, format, onChange }) {
|
|
|
1565
1558
|
}
|
|
1566
1559
|
function ColorInput({ hsv, alpha, format, onChange }) {
|
|
1567
1560
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1568
|
-
className: "dark:![&_input]:univer-border-gray-600 dark:![&_input]:univer-text-
|
|
1561
|
+
className: "dark:![&_input]:univer-border-gray-600 dark:![&_input]:univer-text-gray-0 univer-flex univer-gap-2 [&_input]:univer-box-border [&_input]:univer-flex [&_input]:univer-h-7 [&_input]:univer-items-center [&_input]:univer-rounded [&_input]:univer-border [&_input]:univer-border-solid [&_input]:univer-border-gray-200 [&_input]:univer-bg-transparent [&_input]:univer-px-1.5 [&_input]:univer-text-sm [&_input]:univer-text-gray-700 [&_input]:univer-outline-none",
|
|
1569
1562
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1570
1563
|
className: "univer-relative univer-flex univer-flex-1 univer-gap-2",
|
|
1571
1564
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HexInput, {
|
|
@@ -1687,7 +1680,7 @@ function ColorPresets({ hsv, onChange }) {
|
|
|
1687
1680
|
children: row.map((color, j) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1688
1681
|
type: "button",
|
|
1689
1682
|
className: clsx$1("univer-box-border univer-size-5 univer-cursor-pointer univer-rounded-full univer-border univer-border-solid univer-border-transparent univer-bg-gray-300 univer-transition-shadow", {
|
|
1690
|
-
"univer-ring-2 univer-ring-offset-2 univer-ring-offset-
|
|
1683
|
+
"univer-ring-2 univer-ring-offset-2 univer-ring-offset-gray-0 dark:!univer-ring-primary-600 dark:!univer-ring-offset-gray-600": color.toUpperCase() === currentColor.toUpperCase(),
|
|
1691
1684
|
"!univer-border-gray-200": i === 0 && j === 0
|
|
1692
1685
|
}),
|
|
1693
1686
|
style: { backgroundColor: color },
|
|
@@ -1749,10 +1742,10 @@ function ColorSpectrum({ hsv, onChange, onChanged }) {
|
|
|
1749
1742
|
};
|
|
1750
1743
|
}, [hsv]);
|
|
1751
1744
|
const getIndicatorStyles = () => {
|
|
1752
|
-
var _containerRef$current3, _containerRef$current4
|
|
1745
|
+
var _containerRef$current3, _containerRef$current4;
|
|
1753
1746
|
const halfIndicatorSize = 16 / 2;
|
|
1754
|
-
const w = (_containerRef$current3 =
|
|
1755
|
-
const h = (
|
|
1747
|
+
const w = ((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.clientWidth) ?? 0;
|
|
1748
|
+
const h = ((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.clientHeight) ?? 0;
|
|
1756
1749
|
return {
|
|
1757
1750
|
transform: `translate(${hsv[1] / 100 * w - halfIndicatorSize}px, ${(100 - hsv[2]) / 100 * h - halfIndicatorSize}px)`,
|
|
1758
1751
|
transition: isDragging ? "none" : "transform 0.1s ease-out"
|
|
@@ -1783,7 +1776,7 @@ function ColorSpectrum({ hsv, onChange, onChanged }) {
|
|
|
1783
1776
|
},
|
|
1784
1777
|
onPointerMove: (e) => isDragging && handlePointerEvent(e)
|
|
1785
1778
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1786
|
-
className: "univer-pointer-events-none univer-absolute univer-left-0 univer-top-0 univer-size-4 univer-rounded-full univer-border-2 univer-border-
|
|
1779
|
+
className: "univer-pointer-events-none univer-absolute univer-left-0 univer-top-0 univer-size-4 univer-rounded-full univer-border-2 univer-border-gray-0 univer-shadow-md univer-ring-2 univer-ring-gray-0 univer-will-change-transform",
|
|
1787
1780
|
style: getIndicatorStyles()
|
|
1788
1781
|
})]
|
|
1789
1782
|
});
|
|
@@ -1812,10 +1805,10 @@ function HueSlider({ hsv, onChange, onChanged }) {
|
|
|
1812
1805
|
const thumbRef = (0, react.useRef)(null);
|
|
1813
1806
|
const hsvRef = (0, react.useRef)(hsv);
|
|
1814
1807
|
const calculateHue = (0, react.useCallback)((clientX) => {
|
|
1815
|
-
var _thumbRef$current
|
|
1808
|
+
var _thumbRef$current;
|
|
1816
1809
|
const slider = sliderRef.current;
|
|
1817
1810
|
if (!slider) return;
|
|
1818
|
-
const thumbSize = (
|
|
1811
|
+
const thumbSize = ((_thumbRef$current = thumbRef.current) === null || _thumbRef$current === void 0 ? void 0 : _thumbRef$current.clientWidth) ?? 0;
|
|
1819
1812
|
const rect = slider.getBoundingClientRect();
|
|
1820
1813
|
const maxX = rect.width - thumbSize;
|
|
1821
1814
|
if (maxX <= 0) {
|
|
@@ -1855,10 +1848,10 @@ function HueSlider({ hsv, onChange, onChanged }) {
|
|
|
1855
1848
|
handlePointerUp
|
|
1856
1849
|
]);
|
|
1857
1850
|
const getThumbPosition = () => {
|
|
1858
|
-
var _thumbRef$
|
|
1851
|
+
var _thumbRef$current2, _sliderRef$current;
|
|
1859
1852
|
const safeHue = Math.min(Math.max(hsv[0], 0), 360);
|
|
1860
|
-
const thumbSize = (
|
|
1861
|
-
const sliderWidth = (
|
|
1853
|
+
const thumbSize = ((_thumbRef$current2 = thumbRef.current) === null || _thumbRef$current2 === void 0 ? void 0 : _thumbRef$current2.clientWidth) ?? 0;
|
|
1854
|
+
const sliderWidth = ((_sliderRef$current = sliderRef.current) === null || _sliderRef$current === void 0 ? void 0 : _sliderRef$current.clientWidth) ?? 0;
|
|
1862
1855
|
const thumbOffsetPercent = sliderWidth > 0 ? thumbSize / sliderWidth * 100 : 0;
|
|
1863
1856
|
return `${safeHue / 360 * (100 - thumbOffsetPercent)}%`;
|
|
1864
1857
|
};
|
|
@@ -1883,7 +1876,7 @@ function HueSlider({ hsv, onChange, onChanged }) {
|
|
|
1883
1876
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1884
1877
|
ref: thumbRef,
|
|
1885
1878
|
"data-u-comp": "color-picker-hue-slider-thumb",
|
|
1886
|
-
className: "univer-absolute univer-top-1/2 univer-box-border univer-size-2 univer-rounded-full univer-bg-transparent univer-shadow-md univer-ring-2 univer-ring-
|
|
1879
|
+
className: "univer-absolute univer-top-1/2 univer-box-border univer-size-2 univer-rounded-full univer-bg-transparent univer-shadow-md univer-ring-2 univer-ring-gray-0 univer-transition-transform univer-duration-75 univer-will-change-transform",
|
|
1887
1880
|
style: {
|
|
1888
1881
|
left: getThumbPosition(),
|
|
1889
1882
|
transform: "translateY(-50%)",
|
|
@@ -2002,13 +1995,14 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
2002
1995
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2003
1996
|
className: "univer-flex univer-h-7 univer-items-center",
|
|
2004
1997
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
2005
|
-
className: "univer-cursor-pointer univer-gap-2 univer-text-sm univer-text-gray-900 univer-transition-opacity hover:univer-opacity-80 dark:!univer-text-
|
|
1998
|
+
className: "univer-cursor-pointer univer-gap-2 univer-text-sm univer-text-gray-900 univer-transition-opacity hover:univer-opacity-80 dark:!univer-text-gray-0",
|
|
2006
1999
|
onClick: () => setVisible(true),
|
|
2007
2000
|
children: locale === null || locale === void 0 ? void 0 : locale.ColorPicker.more
|
|
2008
2001
|
})
|
|
2009
2002
|
}),
|
|
2010
2003
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dialog, {
|
|
2011
2004
|
className: "!univer-z-[1090] !univer-w-fit !univer-p-2.5",
|
|
2005
|
+
overlayClassName: "!univer-z-[1090]",
|
|
2012
2006
|
closable: false,
|
|
2013
2007
|
maskClosable: false,
|
|
2014
2008
|
open: visible,
|
|
@@ -2069,7 +2063,7 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
2069
2063
|
function Command({ className, ...props }) {
|
|
2070
2064
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(cmdk.Command, {
|
|
2071
2065
|
"data-slot": "command",
|
|
2072
|
-
className: clsx$1("univer-flex univer-h-full univer-w-full univer-flex-col univer-overflow-hidden univer-rounded-md univer-bg-
|
|
2066
|
+
className: clsx$1("univer-flex univer-h-full univer-w-full univer-flex-col univer-overflow-hidden univer-rounded-md univer-bg-gray-0 univer-text-gray-900 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", className),
|
|
2073
2067
|
...props
|
|
2074
2068
|
});
|
|
2075
2069
|
}
|
|
@@ -2135,11 +2129,11 @@ function Footer(props) {
|
|
|
2135
2129
|
className: "univer-flex univer-items-center univer-justify-end univer-gap-2",
|
|
2136
2130
|
children: [closable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
2137
2131
|
onClick: onClose,
|
|
2138
|
-
children: cancelText
|
|
2132
|
+
children: cancelText ?? (locale === null || locale === void 0 ? void 0 : locale.Confirm.cancel)
|
|
2139
2133
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
2140
2134
|
variant: "primary",
|
|
2141
2135
|
onClick: onConfirm,
|
|
2142
|
-
children: confirmText
|
|
2136
|
+
children: confirmText ?? (locale === null || locale === void 0 ? void 0 : locale.Confirm.confirm)
|
|
2143
2137
|
})]
|
|
2144
2138
|
});
|
|
2145
2139
|
}
|
|
@@ -2201,7 +2195,7 @@ function DatePicker(props) {
|
|
|
2201
2195
|
open,
|
|
2202
2196
|
onOpenChange: setOpen,
|
|
2203
2197
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2204
|
-
className: clsx$1("univer-flex univer-h-8 univer-items-center univer-justify-between univer-gap-2 univer-rounded-md univer-bg-transparent univer-px-2 univer-text-sm univer-text-gray-800 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-
|
|
2198
|
+
className: clsx$1("univer-flex univer-h-8 univer-items-center univer-justify-between univer-gap-2 univer-rounded-md univer-bg-transparent univer-px-2 univer-text-sm univer-text-gray-800 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-0", borderClassName, className),
|
|
2205
2199
|
type: "button",
|
|
2206
2200
|
children: [formatDateWithPattern(value, "YYYY-MM-DD"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CalendarIcon, { className: "univer-text-gray-600 dark:!univer-text-gray-400" })]
|
|
2207
2201
|
})
|
|
@@ -2255,7 +2249,7 @@ function DateRangePicker(props) {
|
|
|
2255
2249
|
open,
|
|
2256
2250
|
onOpenChange: setOpen,
|
|
2257
2251
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2258
|
-
className: clsx$1("univer-flex univer-h-8 univer-items-center univer-justify-between univer-gap-2 univer-rounded-md univer-bg-transparent univer-px-2 univer-text-sm univer-text-gray-800 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-
|
|
2252
|
+
className: clsx$1("univer-flex univer-h-8 univer-items-center univer-justify-between univer-gap-2 univer-rounded-md univer-bg-transparent univer-px-2 univer-text-sm univer-text-gray-800 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-0", borderClassName, className),
|
|
2259
2253
|
type: "button",
|
|
2260
2254
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2261
2255
|
className: "univer-flex univer-gap-1",
|
|
@@ -2432,7 +2426,7 @@ function DraggableList(props) {
|
|
|
2432
2426
|
})
|
|
2433
2427
|
}), canUsePortal && draggingItem && ghostPosition && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2434
2428
|
dir: direction,
|
|
2435
|
-
className: clsx$1("univer-pointer-events-none univer-fixed univer-rounded-md univer-border univer-border-gray-200 univer-bg-
|
|
2429
|
+
className: clsx$1("univer-pointer-events-none univer-fixed univer-rounded-md univer-border univer-border-gray-200 univer-bg-gray-0 univer-shadow-lg dark:!univer-border-gray-700 dark:!univer-bg-gray-800"),
|
|
2436
2430
|
style: {
|
|
2437
2431
|
zIndex: 2147483647,
|
|
2438
2432
|
left: `${ghostPosition.x}px`,
|
|
@@ -2458,7 +2452,7 @@ const FormLayout = (props) => {
|
|
|
2458
2452
|
className: clsx$1("univer-mb-3 univer-flex univer-flex-col", className),
|
|
2459
2453
|
style,
|
|
2460
2454
|
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2461
|
-
className: clsx$1("univer-mb-2 univer-flex univer-min-h-3.5 univer-items-center univer-text-sm univer-text-gray-900 dark:!univer-text-
|
|
2455
|
+
className: clsx$1("univer-mb-2 univer-flex univer-min-h-3.5 univer-items-center univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0", { "univer-cursor-pointer": collapsable }),
|
|
2462
2456
|
onClick: () => setCollapsed(!collapsed),
|
|
2463
2457
|
children: [label, collapsable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreUpIcon, { className: clsx$1("univer-ml-1 univer-transition-transform", { "univer-rotate-180": collapsed }) })]
|
|
2464
2458
|
}), collapsed && collapsable ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [desc && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -2508,7 +2502,7 @@ const FormDualColumnLayout = (props) => {
|
|
|
2508
2502
|
*/
|
|
2509
2503
|
function Pager(props) {
|
|
2510
2504
|
const { className, value: current = 0, total: count = 0, loop, text: propText, onChange } = props;
|
|
2511
|
-
const text = propText
|
|
2505
|
+
const text = propText ?? `${current}/${count}`;
|
|
2512
2506
|
const hasValue = count > 0;
|
|
2513
2507
|
const onClickLeftArrow = () => {
|
|
2514
2508
|
if (current === 1) {
|
|
@@ -2571,7 +2565,7 @@ function Pager(props) {
|
|
|
2571
2565
|
const buttonClassName = `
|
|
2572
2566
|
univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-border-none
|
|
2573
2567
|
univer-bg-transparent univer-p-0 univer-text-current
|
|
2574
|
-
hover:univer-text-
|
|
2568
|
+
hover:univer-text-gray-0
|
|
2575
2569
|
`;
|
|
2576
2570
|
function Gallery(props) {
|
|
2577
2571
|
const { className, images, open, onOpenChange } = props;
|
|
@@ -2654,7 +2648,7 @@ function Gallery(props) {
|
|
|
2654
2648
|
})
|
|
2655
2649
|
}),
|
|
2656
2650
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
2657
|
-
className: "univer-absolute univer-bottom-6 univer-left-1/2 univer-flex -univer-translate-x-1/2 univer-items-center univer-gap-3 univer-rounded-full univer-bg-gray-800 univer-px-6 univer-py-3 univer-text-gray-400",
|
|
2651
|
+
className: "univer-absolute univer-bottom-6 univer-left-1/2 univer-flex -univer-translate-x-1/2 univer-items-center univer-gap-3 univer-rounded-full univer-bg-gray-800 univer-px-6 univer-py-3 univer-text-gray-400 rtl:univer-flex-row-reverse",
|
|
2658
2652
|
children: [
|
|
2659
2653
|
hasPagination && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pager, {
|
|
2660
2654
|
className: "!univer-text-gray-400 [&_[data-u-comp=pager-left-arrow]:hover]:!univer-bg-gray-600 [&_[data-u-comp=pager-right-arrow]:hover]:!univer-bg-gray-600",
|
|
@@ -2691,7 +2685,7 @@ function Gallery(props) {
|
|
|
2691
2685
|
|
|
2692
2686
|
//#endregion
|
|
2693
2687
|
//#region src/components/input/Input.tsx
|
|
2694
|
-
const inputVariants = (0, class_variance_authority.cva)("univer-box-border univer-w-full univer-rounded-md univer-bg-
|
|
2688
|
+
const inputVariants = (0, class_variance_authority.cva)("univer-box-border univer-w-full univer-rounded-md univer-bg-gray-0 univer-text-gray-900 univer-transition-colors univer-duration-200 placeholder:univer-text-gray-400 focus:univer-border-primary-600 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-50 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 dark:focus:!univer-ring-primary-900", {
|
|
2695
2689
|
variants: { size: {
|
|
2696
2690
|
mini: "univer-h-7 univer-px-1.5 univer-text-sm",
|
|
2697
2691
|
small: "univer-h-8 univer-px-2 univer-text-sm",
|
|
@@ -2932,7 +2926,7 @@ const InputNumber = (0, react.forwardRef)(({ value, defaultValue, size = "small"
|
|
|
2932
2926
|
}), controls && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2933
2927
|
className: clsx$1("univer-absolute univer-right-px univer-top-px univer-flex univer-h-[calc(100%-2px)] univer-flex-col univer-overflow-hidden univer-rounded-r-md before:univer-absolute before:univer-top-1/2 before:univer-block before:univer-h-px before:univer-w-full before:-univer-translate-y-1/2 before:univer-bg-gray-200 before:univer-content-[\"\"] rtl:univer-left-px rtl:univer-right-auto rtl:univer-rounded-l-md rtl:univer-rounded-r-none dark:before:!univer-bg-gray-600", borderLeftClassName, borderLeftRTLClassName, controlsClassName),
|
|
2934
2928
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2935
|
-
className: clsx$1("univer-box-border univer-flex univer-h-1/2 univer-w-5 univer-cursor-pointer univer-items-center univer-justify-center univer-border-none univer-bg-transparent univer-p-0 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-
|
|
2929
|
+
className: clsx$1("univer-box-border univer-flex univer-h-1/2 univer-w-5 univer-cursor-pointer univer-items-center univer-justify-center univer-border-none univer-bg-transparent univer-p-0 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-600", incrementDisabled && "univer-cursor-not-allowed univer-opacity-60"),
|
|
2936
2930
|
role: "button",
|
|
2937
2931
|
"aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.increment,
|
|
2938
2932
|
"aria-disabled": incrementDisabled,
|
|
@@ -2944,7 +2938,7 @@ const InputNumber = (0, react.forwardRef)(({ value, defaultValue, size = "small"
|
|
|
2944
2938
|
},
|
|
2945
2939
|
children: "+"
|
|
2946
2940
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2947
|
-
className: clsx$1("univer-box-border univer-flex univer-h-1/2 univer-w-5 univer-cursor-pointer univer-items-center univer-justify-center univer-border-none univer-bg-transparent univer-p-0 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-
|
|
2941
|
+
className: clsx$1("univer-box-border univer-flex univer-h-1/2 univer-w-5 univer-cursor-pointer univer-items-center univer-justify-center univer-border-none univer-bg-transparent univer-p-0 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-600", decrementDisabled && "univer-cursor-not-allowed univer-opacity-60"),
|
|
2948
2942
|
role: "button",
|
|
2949
2943
|
"aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.decrement,
|
|
2950
2944
|
"aria-disabled": decrementDisabled,
|
|
@@ -3011,15 +3005,15 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
|
|
|
3011
3005
|
ref: containerRef,
|
|
3012
3006
|
className: clsx$1("univer-relative univer-box-border univer-flex univer-min-w-0 univer-gap-1 univer-rounded-lg univer-bg-gray-100 univer-p-1 dark:!univer-bg-gray-800", className),
|
|
3013
3007
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3014
|
-
className: "univer-animate-univer-slide univer-absolute univer-h-6 univer-rounded-md univer-bg-
|
|
3008
|
+
className: "univer-animate-univer-slide univer-absolute univer-h-6 univer-rounded-md univer-bg-gray-0 univer-shadow-sm univer-transition-all univer-duration-200 dark:!univer-bg-gray-700 dark:!univer-text-gray-400",
|
|
3015
3009
|
style: slideStyle
|
|
3016
3010
|
}), items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3017
3011
|
ref: (el) => {
|
|
3018
3012
|
if (el) itemRefs.current.set(item.value, el);
|
|
3019
3013
|
},
|
|
3020
3014
|
className: clsx$1("univer-relative univer-box-border univer-min-w-0 univer-flex-1 univer-cursor-pointer univer-truncate univer-border-none univer-bg-transparent univer-px-3 univer-py-1 univer-text-xs univer-font-medium univer-transition-colors", {
|
|
3021
|
-
"univer-text-gray-900 dark:!univer-text-
|
|
3022
|
-
"univer-text-gray-500 hover:univer-text-gray-900 dark:hover:!univer-text-
|
|
3015
|
+
"univer-text-gray-900 dark:!univer-text-gray-0": selectedItem === item.value,
|
|
3016
|
+
"univer-text-gray-500 hover:univer-text-gray-900 dark:hover:!univer-text-gray-0": selectedItem !== item.value
|
|
3023
3017
|
}),
|
|
3024
3018
|
type: "button",
|
|
3025
3019
|
onClick: () => handleClick(item.value),
|
|
@@ -3171,50 +3165,47 @@ function Tooltip(props) {
|
|
|
3171
3165
|
children
|
|
3172
3166
|
});
|
|
3173
3167
|
let tooltipNode = null;
|
|
3174
|
-
if (typeof document !== "undefined" && visible && title && document.body) {
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3168
|
+
if (typeof document !== "undefined" && visible && title && document.body) tooltipNode = (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3169
|
+
ref: tooltipRef,
|
|
3170
|
+
dir: direction,
|
|
3171
|
+
role: "tooltip",
|
|
3172
|
+
className: clsx$1("univer-animate-in univer-fade-in-0 univer-zoom-in-95 univer-pointer-events-auto univer-absolute univer-z-[1081] univer-box-border univer-w-fit univer-max-w-sm univer-text-balance univer-rounded-lg univer-bg-gray-700 univer-px-2.5 univer-py-2 univer-text-xs univer-font-medium univer-text-gray-0 univer-shadow-lg univer-drop-shadow-sm dark:!univer-bg-gray-100 dark:!univer-text-gray-900", className),
|
|
3173
|
+
style: {
|
|
3174
|
+
top: (coords === null || coords === void 0 ? void 0 : coords.top) ?? -9999,
|
|
3175
|
+
left: (coords === null || coords === void 0 ? void 0 : coords.left) ?? -9999
|
|
3176
|
+
},
|
|
3177
|
+
onMouseEnter: () => showTooltip(),
|
|
3178
|
+
onMouseLeave: () => hideTooltip(),
|
|
3179
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3180
|
+
className: "univer-break-words",
|
|
3181
|
+
children: title
|
|
3182
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3183
|
+
ref: arrowRef,
|
|
3184
|
+
className: "univer-absolute univer-size-2.5 univer-rotate-45 univer-rounded-sm univer-bg-gray-700 dark:!univer-bg-gray-100",
|
|
3181
3185
|
style: {
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
left: "50%",
|
|
3202
|
-
transform: "translateX(-50%) rotate(45deg)"
|
|
3203
|
-
},
|
|
3204
|
-
...currentPlacement === "left" && {
|
|
3205
|
-
right: -5,
|
|
3206
|
-
top: "50%",
|
|
3207
|
-
transform: "translateY(-50%) rotate(45deg)"
|
|
3208
|
-
},
|
|
3209
|
-
...currentPlacement === "right" && {
|
|
3210
|
-
left: -5,
|
|
3211
|
-
top: "50%",
|
|
3212
|
-
transform: "translateY(-50%) rotate(45deg)"
|
|
3213
|
-
}
|
|
3186
|
+
...currentPlacement === "bottom" && {
|
|
3187
|
+
top: -5,
|
|
3188
|
+
left: "50%",
|
|
3189
|
+
transform: "translateX(-50%) rotate(45deg)"
|
|
3190
|
+
},
|
|
3191
|
+
...currentPlacement === "top" && {
|
|
3192
|
+
bottom: -5,
|
|
3193
|
+
left: "50%",
|
|
3194
|
+
transform: "translateX(-50%) rotate(45deg)"
|
|
3195
|
+
},
|
|
3196
|
+
...currentPlacement === "left" && {
|
|
3197
|
+
right: -5,
|
|
3198
|
+
top: "50%",
|
|
3199
|
+
transform: "translateY(-50%) rotate(45deg)"
|
|
3200
|
+
},
|
|
3201
|
+
...currentPlacement === "right" && {
|
|
3202
|
+
left: -5,
|
|
3203
|
+
top: "50%",
|
|
3204
|
+
transform: "translateY(-50%) rotate(45deg)"
|
|
3214
3205
|
}
|
|
3215
|
-
}
|
|
3216
|
-
})
|
|
3217
|
-
}
|
|
3206
|
+
}
|
|
3207
|
+
})]
|
|
3208
|
+
}), document.body);
|
|
3218
3209
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [triggerElement, tooltipNode] });
|
|
3219
3210
|
}
|
|
3220
3211
|
|
|
@@ -3250,8 +3241,7 @@ function clamp(value, min, max) {
|
|
|
3250
3241
|
return Math.max(min, Math.min(max, value));
|
|
3251
3242
|
}
|
|
3252
3243
|
function getStopOpacity(stop) {
|
|
3253
|
-
|
|
3254
|
-
return clamp((_stop$opacity = stop === null || stop === void 0 ? void 0 : stop.opacity) !== null && _stop$opacity !== void 0 ? _stop$opacity : 1, 0, 1);
|
|
3244
|
+
return clamp((stop === null || stop === void 0 ? void 0 : stop.opacity) ?? 1, 0, 1);
|
|
3255
3245
|
}
|
|
3256
3246
|
function getColorWithOpacity(color, opacity) {
|
|
3257
3247
|
if (opacity >= 1) return color;
|
|
@@ -3274,8 +3264,7 @@ function getStopColor(stop) {
|
|
|
3274
3264
|
return getColorWithOpacity(stop.color, getStopOpacity(stop));
|
|
3275
3265
|
}
|
|
3276
3266
|
function getGradientAngle(value) {
|
|
3277
|
-
|
|
3278
|
-
return (_ref = (_value$angle = value.angle) !== null && _value$angle !== void 0 ? _value$angle : DEFAULT_VALUE.angle) !== null && _ref !== void 0 ? _ref : 0;
|
|
3267
|
+
return value.angle ?? DEFAULT_VALUE.angle ?? 0;
|
|
3279
3268
|
}
|
|
3280
3269
|
function getCssLinearGradientAngle(value) {
|
|
3281
3270
|
return (getGradientAngle(value) + 90) % 360;
|
|
@@ -3324,7 +3313,7 @@ function GradientColorPicker(props) {
|
|
|
3324
3313
|
const handleAngleChange = (angle) => {
|
|
3325
3314
|
emitChange({
|
|
3326
3315
|
...valueRef.current,
|
|
3327
|
-
angle: angle
|
|
3316
|
+
angle: angle ?? 0
|
|
3328
3317
|
});
|
|
3329
3318
|
};
|
|
3330
3319
|
const handleStopColorChange = (color) => {
|
|
@@ -3351,7 +3340,7 @@ function GradientColorPicker(props) {
|
|
|
3351
3340
|
});
|
|
3352
3341
|
};
|
|
3353
3342
|
const handleStopTransparencyChange = (transparency) => {
|
|
3354
|
-
const nextTransparency = clamp(transparency
|
|
3343
|
+
const nextTransparency = clamp(transparency ?? 0, 0, 100);
|
|
3355
3344
|
const newStops = [...valueRef.current.stops];
|
|
3356
3345
|
newStops[selectedIndex] = {
|
|
3357
3346
|
...newStops[selectedIndex],
|
|
@@ -3403,7 +3392,7 @@ function GradientColorPicker(props) {
|
|
|
3403
3392
|
}, [draftValue, stops]);
|
|
3404
3393
|
const showAngleEditor = draftValue.type === "linear" || draftValue.type === "angular";
|
|
3405
3394
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3406
|
-
className: clsx$1(compact ? "univer-flex univer-w-full univer-min-w-0 univer-flex-col univer-gap-3 univer-rounded-md univer-bg-transparent univer-p-0 dark:!univer-bg-transparent" : "univer-flex univer-w-full univer-min-w-0 univer-max-w-80 univer-flex-col univer-gap-4 univer-rounded-lg univer-bg-
|
|
3395
|
+
className: clsx$1(compact ? "univer-flex univer-w-full univer-min-w-0 univer-flex-col univer-gap-3 univer-rounded-md univer-bg-transparent univer-p-0 dark:!univer-bg-transparent" : "univer-flex univer-w-full univer-min-w-0 univer-max-w-80 univer-flex-col univer-gap-4 univer-rounded-lg univer-bg-gray-0 univer-p-4 univer-shadow-lg dark:!univer-bg-gray-800", className),
|
|
3407
3396
|
onClick: (e) => e.stopPropagation(),
|
|
3408
3397
|
onPointerDown: (e) => e.stopPropagation(),
|
|
3409
3398
|
children: [
|
|
@@ -3430,7 +3419,7 @@ function GradientColorPicker(props) {
|
|
|
3430
3419
|
const selected = draftValue.type === item.value;
|
|
3431
3420
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3432
3421
|
type: "button",
|
|
3433
|
-
className: clsx$1("univer-relative univer-min-w-0 univer-flex-1 univer-cursor-pointer univer-truncate univer-border-none univer-bg-transparent univer-px-0 univer-pb-2 univer-pt-0 univer-text-xs univer-transition-colors", selected ? "univer-font-medium univer-text-primary-600 dark:!univer-text-primary-300" : "univer-text-gray-500 hover:univer-text-gray-900 dark:hover:!univer-text-
|
|
3422
|
+
className: clsx$1("univer-relative univer-min-w-0 univer-flex-1 univer-cursor-pointer univer-truncate univer-border-none univer-bg-transparent univer-px-0 univer-pb-2 univer-pt-0 univer-text-xs univer-transition-colors", selected ? "univer-font-medium univer-text-primary-600 dark:!univer-text-primary-300" : "univer-text-gray-500 hover:univer-text-gray-900 dark:hover:!univer-text-gray-0"),
|
|
3434
3423
|
onClick: () => handleTypeChange(item.value),
|
|
3435
3424
|
children: [item.label, selected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "univer-absolute univer-inset-x-2 -univer-bottom-px univer-h-0.5 univer-rounded-full univer-bg-primary-600 dark:!univer-bg-primary-300" })]
|
|
3436
3425
|
}, item.value);
|
|
@@ -3488,7 +3477,7 @@ function GradientColorPicker(props) {
|
|
|
3488
3477
|
}), draftValue.stops.map((stop, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3489
3478
|
"data-u-comp": "gradient-color-picker-stop",
|
|
3490
3479
|
"data-selected": selectedIndex === index,
|
|
3491
|
-
className: clsx$1("univer-absolute univer-top-1/2 univer-size-4 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-cursor-pointer univer-rounded-full univer-border-2 univer-border-
|
|
3480
|
+
className: clsx$1("univer-absolute univer-top-1/2 univer-size-4 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-cursor-pointer univer-rounded-full univer-border-2 univer-border-gray-0 univer-shadow-md", selectedIndex === index ? "univer-z-10 univer-ring-2 univer-ring-primary-500" : "univer-z-0"),
|
|
3492
3481
|
style: {
|
|
3493
3482
|
left: `${stop.offset}%`,
|
|
3494
3483
|
backgroundColor: getStopColor(stop)
|
|
@@ -3595,7 +3584,7 @@ const HoverCardContent = (0, react.forwardRef)(({ className, align = "center", s
|
|
|
3595
3584
|
ref,
|
|
3596
3585
|
align,
|
|
3597
3586
|
sideOffset,
|
|
3598
|
-
className: clsx$1("data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[side=bottom]:univer-slide-in-from-top-2 data-[side=left]:univer-slide-in-from-right-2 data-[side=right]:univer-slide-in-from-left-2 data-[side=top]:univer-slide-in-from-bottom-2 univer-z-[1080] univer-w-64 univer-origin-[--radix-hover-card-content-transform-origin] univer-rounded-md univer-bg-
|
|
3587
|
+
className: clsx$1("data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[side=bottom]:univer-slide-in-from-top-2 data-[side=left]:univer-slide-in-from-right-2 data-[side=right]:univer-slide-in-from-left-2 data-[side=top]:univer-slide-in-from-bottom-2 univer-z-[1080] univer-w-64 univer-origin-[--radix-hover-card-content-transform-origin] univer-rounded-md univer-bg-gray-0 univer-text-gray-900 univer-shadow-md univer-outline-none dark:!univer-bg-gray-900 dark:!univer-text-gray-0", borderClassName, className),
|
|
3599
3588
|
...props
|
|
3600
3589
|
}));
|
|
3601
3590
|
HoverCardContent.displayName = _radix_ui_react_hover_card.Content.displayName;
|
|
@@ -3647,7 +3636,7 @@ function KBD(props) {
|
|
|
3647
3636
|
const { keyboard, className } = props;
|
|
3648
3637
|
const keys = keyboard.split("+");
|
|
3649
3638
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3650
|
-
className: clsx$1("univer-inline-block univer-h-6 univer-select-none univer-whitespace-nowrap univer-rounded-md univer-bg-gray-50 univer-px-2 univer-font-mono univer-text-xs/6 univer-font-medium univer-text-gray-700 dark:!univer-bg-gray-700 dark:!univer-text-
|
|
3639
|
+
className: clsx$1("univer-inline-block univer-h-6 univer-select-none univer-whitespace-nowrap univer-rounded-md univer-bg-gray-50 univer-px-2 univer-font-mono univer-text-xs/6 univer-font-medium univer-text-gray-700 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", borderClassName, className),
|
|
3651
3640
|
children: keys.map((text, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("kbd", {
|
|
3652
3641
|
className: "univer-inline-block univer-h-full",
|
|
3653
3642
|
children: text
|
|
@@ -3709,7 +3698,7 @@ const Messager = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runt
|
|
|
3709
3698
|
expand: false,
|
|
3710
3699
|
icons: { loading: loadingIcon },
|
|
3711
3700
|
offset: { top: 16 },
|
|
3712
|
-
className: clsx$1("[&_[data-sonner-toast]]:univer-bg-
|
|
3701
|
+
className: clsx$1("[&_[data-sonner-toast]]:univer-bg-gray-0/95 dark:[&_[data-sonner-toast]]:!univer-bg-gray-800/95 [&_[data-sonner-toast]]:univer-rounded-2xl [&_[data-sonner-toast]]:univer-border [&_[data-sonner-toast]]:univer-border-solid [&_[data-sonner-toast]]:univer-border-gray-200 [&_[data-sonner-toast]]:univer-shadow-[0_16px_40px_-20px_rgba(15,23,42,0.55)] [&_[data-sonner-toast]]:univer-backdrop-blur-sm dark:[&_[data-sonner-toast]]:!univer-border-gray-600", className),
|
|
3713
3702
|
toastOptions: {
|
|
3714
3703
|
duration: DEFAULT_MESSAGE_DURATION,
|
|
3715
3704
|
classNames: {
|
|
@@ -3733,7 +3722,7 @@ const Messager = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runt
|
|
|
3733
3722
|
...props
|
|
3734
3723
|
});
|
|
3735
3724
|
const message = ({ content, duration, id, onClose, type = "info" }) => {
|
|
3736
|
-
const messageId = id
|
|
3725
|
+
const messageId = id ?? createMessageId();
|
|
3737
3726
|
const method = resolveToastMethod(type);
|
|
3738
3727
|
let closed = false;
|
|
3739
3728
|
const handleClose = () => {
|
|
@@ -3745,7 +3734,7 @@ const message = ({ content, duration, id, onClose, type = "info" }) => {
|
|
|
3745
3734
|
method(content, {
|
|
3746
3735
|
id: messageId,
|
|
3747
3736
|
toasterId: MESSAGE_TOASTER_ID,
|
|
3748
|
-
duration: duration
|
|
3737
|
+
duration: duration ?? DEFAULT_MESSAGE_DURATION,
|
|
3749
3738
|
icon: type === "loading" ? void 0 : iconMap[type],
|
|
3750
3739
|
onDismiss: handleClose,
|
|
3751
3740
|
onAutoClose: handleClose
|
|
@@ -3795,10 +3784,13 @@ function PanelSection(props) {
|
|
|
3795
3784
|
"univer-cursor-default": !collapsible
|
|
3796
3785
|
}),
|
|
3797
3786
|
onClick: () => collapsible && setExpanded((v) => !v),
|
|
3798
|
-
children: [collapsible && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, {
|
|
3799
|
-
"-
|
|
3800
|
-
"univer-
|
|
3801
|
-
|
|
3787
|
+
children: [collapsible && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, {
|
|
3788
|
+
"aria-hidden": "true",
|
|
3789
|
+
className: clsx$1("univer-size-2.5 univer-flex-shrink-0 univer-transition-transform", {
|
|
3790
|
+
"-univer-rotate-90 rtl:univer-rotate-90": !expanded,
|
|
3791
|
+
"univer-rotate-0": expanded
|
|
3792
|
+
})
|
|
3793
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: title })]
|
|
3802
3794
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3803
3795
|
id: contentId,
|
|
3804
3796
|
role: "region",
|
|
@@ -3927,7 +3919,7 @@ function RadioGroup(props) {
|
|
|
3927
3919
|
children: child.props.children,
|
|
3928
3920
|
value: child.props.value,
|
|
3929
3921
|
checked: value === child.props.value,
|
|
3930
|
-
disabled: disabled
|
|
3922
|
+
disabled: disabled ?? child.props.disabled,
|
|
3931
3923
|
onChange: handleChange
|
|
3932
3924
|
});
|
|
3933
3925
|
return child;
|
|
@@ -3955,7 +3947,7 @@ function Radio(props) {
|
|
|
3955
3947
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
3956
3948
|
"data-u-comp": "radio",
|
|
3957
3949
|
className: clsx$1("univer-box-border univer-inline-flex univer-items-center univer-gap-2 univer-text-sm", {
|
|
3958
|
-
"univer-cursor-pointer univer-text-gray-900 dark:!univer-text-
|
|
3950
|
+
"univer-cursor-pointer univer-text-gray-900 dark:!univer-text-gray-0": !disabled,
|
|
3959
3951
|
"univer-text-gray-400": disabled
|
|
3960
3952
|
}),
|
|
3961
3953
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
@@ -3973,7 +3965,7 @@ function Radio(props) {
|
|
|
3973
3965
|
"univer-border-primary-600 univer-bg-primary-600 dark:!univer-bg-primary-600": checked,
|
|
3974
3966
|
"univer-border-gray-300 univer-bg-gray-50 dark:!univer-border-gray-500 dark:!univer-bg-gray-600": !checked
|
|
3975
3967
|
}),
|
|
3976
|
-
children: checked && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "univer-absolute univer-left-1/2 univer-top-1/2 univer-block univer-size-2 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-rounded-full univer-bg-
|
|
3968
|
+
children: checked && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "univer-absolute univer-left-1/2 univer-top-1/2 univer-block univer-size-2 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-rounded-full univer-bg-gray-0" })
|
|
3977
3969
|
})]
|
|
3978
3970
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children })]
|
|
3979
3971
|
});
|
|
@@ -4011,7 +4003,7 @@ function SelectList(props) {
|
|
|
4011
4003
|
children: options.map((option, index) => {
|
|
4012
4004
|
const checked = value.indexOf(option.value) > -1;
|
|
4013
4005
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
4014
|
-
className: clsx$1("univer-relative univer-block univer-cursor-pointer univer-select-none univer-rounded univer-py-1.5 univer-pl-8 univer-pr-2 univer-text-sm univer-text-gray-900 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-
|
|
4006
|
+
className: clsx$1("univer-relative univer-block univer-cursor-pointer univer-select-none univer-rounded univer-py-1.5 univer-pl-8 univer-pr-2 univer-text-sm univer-text-gray-900 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-600", optionClassName, { "univer-bg-gray-200 dark:!univer-bg-gray-500": checked }),
|
|
4015
4007
|
onClick: () => handleSelect(option.value),
|
|
4016
4008
|
children: [!hideCheckMark && checked && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CheckMarkIcon, { className: "univer-absolute univer-left-0 univer-top-1/2 -univer-translate-y-1/2 univer-pl-2 univer-text-primary-600" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4017
4009
|
style: { color: option.color },
|
|
@@ -4024,9 +4016,9 @@ function SelectList(props) {
|
|
|
4024
4016
|
|
|
4025
4017
|
//#endregion
|
|
4026
4018
|
//#region src/components/select/Select.tsx
|
|
4027
|
-
const selectClassName = clsx$1("univer-box-border univer-inline-flex univer-h-8 univer-min-w-36 univer-items-center univer-justify-between univer-gap-2 univer-rounded-lg univer-bg-
|
|
4019
|
+
const selectClassName = clsx$1("univer-box-border univer-inline-flex univer-h-8 univer-min-w-36 univer-items-center univer-justify-between univer-gap-2 univer-rounded-lg univer-bg-gray-0 univer-px-2.5 univer-transition-colors univer-duration-200 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", borderClassName);
|
|
4028
4020
|
function Select(props) {
|
|
4029
|
-
const { className, value, disabled = false, options = [], borderless = false, onChange } = props;
|
|
4021
|
+
const { className, value, disabled = false, options = [], borderless = false, side, avoidCollisions, onChange } = props;
|
|
4030
4022
|
const [open, setOpen] = (0, react.useState)(false);
|
|
4031
4023
|
function handleOpenChange(open) {
|
|
4032
4024
|
setOpen(open);
|
|
@@ -4076,6 +4068,8 @@ function Select(props) {
|
|
|
4076
4068
|
open,
|
|
4077
4069
|
items,
|
|
4078
4070
|
disabled,
|
|
4071
|
+
side,
|
|
4072
|
+
avoidCollisions,
|
|
4079
4073
|
onOpenChange: handleOpenChange,
|
|
4080
4074
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4081
4075
|
"data-u-comp": "select",
|
|
@@ -4087,9 +4081,9 @@ function Select(props) {
|
|
|
4087
4081
|
"univer-cursor-pointer": !disabled && !open
|
|
4088
4082
|
}, className),
|
|
4089
4083
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4090
|
-
className: "univer-flex-1 univer-truncate univer-text-sm univer-text-gray-500 dark:!univer-text-
|
|
4084
|
+
className: "univer-flex-1 univer-truncate univer-text-sm univer-text-gray-500 dark:!univer-text-gray-0",
|
|
4091
4085
|
children: displayValue
|
|
4092
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "univer-flex-shrink-0 dark:!univer-text-
|
|
4086
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "univer-flex-shrink-0 dark:!univer-text-gray-0" })]
|
|
4093
4087
|
})
|
|
4094
4088
|
});
|
|
4095
4089
|
}
|
|
@@ -4116,7 +4110,11 @@ function MultipleSelect(props) {
|
|
|
4116
4110
|
}
|
|
4117
4111
|
};
|
|
4118
4112
|
});
|
|
4119
|
-
}, [
|
|
4113
|
+
}, [
|
|
4114
|
+
onChange,
|
|
4115
|
+
options,
|
|
4116
|
+
value
|
|
4117
|
+
]);
|
|
4120
4118
|
function handleClose(item) {
|
|
4121
4119
|
const newValue = value.filter((v) => v !== item);
|
|
4122
4120
|
onChange(newValue);
|
|
@@ -4148,7 +4146,7 @@ function MultipleSelect(props) {
|
|
|
4148
4146
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4149
4147
|
className: "univer-box-border univer-flex univer-w-[calc(100%-16px)] univer-gap-2 univer-pr-2",
|
|
4150
4148
|
children: displayValue
|
|
4151
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "univer-flex-shrink-0 dark:!univer-text-
|
|
4149
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "univer-flex-shrink-0 dark:!univer-text-gray-0" })]
|
|
4152
4150
|
})
|
|
4153
4151
|
});
|
|
4154
4152
|
}
|
|
@@ -4207,7 +4205,7 @@ const Switch = (props) => {
|
|
|
4207
4205
|
"univer-bg-primary-600": checked,
|
|
4208
4206
|
"univer-bg-gray-200 dark:!univer-bg-gray-600": !checked
|
|
4209
4207
|
}),
|
|
4210
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: clsx$1("univer-absolute univer-bottom-0.5 univer-left-0.5 univer-size-3 univer-rounded-full univer-bg-
|
|
4208
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: clsx$1("univer-absolute univer-bottom-0.5 univer-left-0.5 univer-size-3 univer-rounded-full univer-bg-gray-0 univer-transition-transform univer-duration-200", { "univer-translate-x-3": checked }) })
|
|
4211
4209
|
})]
|
|
4212
4210
|
})
|
|
4213
4211
|
});
|
|
@@ -4252,7 +4250,7 @@ const Textarea = (0, react.forwardRef)((props, ref) => {
|
|
|
4252
4250
|
ref: textareaRef,
|
|
4253
4251
|
"data-u-comp": "textarea",
|
|
4254
4252
|
"data-slot": "textarea",
|
|
4255
|
-
className: clsx$1("univer-box-border univer-flex univer-w-full univer-resize univer-rounded-md univer-bg-transparent univer-p-2 univer-text-base univer-text-gray-900 univer-outline-none univer-transition-[color,box-shadow] placeholder:univer-text-gray-200 disabled:univer-cursor-not-allowed disabled:univer-opacity-50 dark:!univer-text-
|
|
4253
|
+
className: clsx$1("univer-box-border univer-flex univer-w-full univer-resize univer-rounded-md univer-bg-transparent univer-p-2 univer-text-base univer-text-gray-900 univer-outline-none univer-transition-[color,box-shadow] placeholder:univer-text-gray-200 disabled:univer-cursor-not-allowed disabled:univer-opacity-50 dark:!univer-text-gray-0", borderClassName, scrollbarClassName, className),
|
|
4256
4254
|
onChange: handleChange,
|
|
4257
4255
|
...restProps
|
|
4258
4256
|
});
|
|
@@ -4270,7 +4268,7 @@ function Toaster({ visibleToasts, ...props }) {
|
|
|
4270
4268
|
error: "[&_[data-icon]]:univer-text-red-500",
|
|
4271
4269
|
warning: "[&_[data-icon]]:univer-text-yellow-500"
|
|
4272
4270
|
} },
|
|
4273
|
-
visibleToasts: visibleToasts
|
|
4271
|
+
visibleToasts: visibleToasts ?? 5,
|
|
4274
4272
|
...props
|
|
4275
4273
|
});
|
|
4276
4274
|
}
|
|
@@ -4292,7 +4290,7 @@ const findNodePathFromTree = (tree, key) => {
|
|
|
4292
4290
|
return result;
|
|
4293
4291
|
};
|
|
4294
4292
|
const createCacheWithFindNodePathFromTree = (tree, defaultCache) => {
|
|
4295
|
-
const cache = defaultCache
|
|
4293
|
+
const cache = defaultCache ?? /* @__PURE__ */ new Map();
|
|
4296
4294
|
let cacheTree = tree;
|
|
4297
4295
|
return {
|
|
4298
4296
|
findNodePathFromTreeWithCache: (key) => {
|
|
@@ -4498,7 +4496,7 @@ function Tree(props) {
|
|
|
4498
4496
|
}, key);
|
|
4499
4497
|
}
|
|
4500
4498
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
4501
|
-
className: "univer-relative univer-select-none univer-text-gray-900 dark:!univer-text-
|
|
4499
|
+
className: "univer-relative univer-select-none univer-text-gray-900 dark:!univer-text-gray-0",
|
|
4502
4500
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4503
4501
|
className: "univer-m-0 univer-h-full univer-list-none univer-p-0",
|
|
4504
4502
|
style,
|