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