@univerjs/design 1.0.0-beta.0 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +203 -109
- package/lib/cjs/locale/ar-SA.js +3 -2
- package/lib/cjs/locale/ca-ES.js +3 -2
- package/lib/cjs/locale/de-DE.js +3 -2
- package/lib/cjs/locale/en-US.js +3 -2
- package/lib/cjs/locale/es-ES.js +3 -2
- package/lib/cjs/locale/fa-IR.js +3 -2
- package/lib/cjs/locale/fr-FR.js +3 -2
- package/lib/cjs/locale/id-ID.js +3 -2
- package/lib/cjs/locale/it-IT.js +3 -2
- package/lib/cjs/locale/ja-JP.js +3 -2
- package/lib/cjs/locale/ko-KR.js +3 -2
- package/lib/cjs/locale/pl-PL.js +3 -2
- package/lib/cjs/locale/pt-BR.js +3 -2
- package/lib/cjs/locale/ru-RU.js +3 -2
- package/lib/cjs/locale/sk-SK.js +3 -2
- package/lib/cjs/locale/vi-VN.js +3 -2
- package/lib/cjs/locale/zh-CN.js +3 -2
- package/lib/cjs/locale/zh-HK.js +3 -2
- package/lib/cjs/locale/zh-TW.js +3 -2
- package/lib/es/index.js +203 -109
- package/lib/es/locale/ar-SA.js +3 -2
- package/lib/es/locale/ca-ES.js +3 -2
- package/lib/es/locale/de-DE.js +3 -2
- package/lib/es/locale/en-US.js +3 -2
- package/lib/es/locale/es-ES.js +3 -2
- package/lib/es/locale/fa-IR.js +3 -2
- package/lib/es/locale/fr-FR.js +3 -2
- package/lib/es/locale/id-ID.js +3 -2
- package/lib/es/locale/it-IT.js +3 -2
- package/lib/es/locale/ja-JP.js +3 -2
- package/lib/es/locale/ko-KR.js +3 -2
- package/lib/es/locale/pl-PL.js +3 -2
- package/lib/es/locale/pt-BR.js +3 -2
- package/lib/es/locale/ru-RU.js +3 -2
- package/lib/es/locale/sk-SK.js +3 -2
- package/lib/es/locale/vi-VN.js +3 -2
- package/lib/es/locale/zh-CN.js +3 -2
- package/lib/es/locale/zh-HK.js +3 -2
- package/lib/es/locale/zh-TW.js +3 -2
- package/lib/index.css +123 -38
- package/lib/index.js +203 -109
- package/lib/locale/ar-SA.js +3 -2
- package/lib/locale/ca-ES.js +3 -2
- package/lib/locale/de-DE.js +3 -2
- package/lib/locale/en-US.js +3 -2
- package/lib/locale/es-ES.js +3 -2
- package/lib/locale/fa-IR.js +3 -2
- package/lib/locale/fr-FR.js +3 -2
- package/lib/locale/id-ID.js +3 -2
- package/lib/locale/it-IT.js +3 -2
- package/lib/locale/ja-JP.js +3 -2
- package/lib/locale/ko-KR.js +3 -2
- package/lib/locale/pl-PL.js +3 -2
- package/lib/locale/pt-BR.js +3 -2
- package/lib/locale/ru-RU.js +3 -2
- package/lib/locale/sk-SK.js +3 -2
- package/lib/locale/vi-VN.js +3 -2
- package/lib/locale/zh-CN.js +3 -2
- package/lib/locale/zh-HK.js +3 -2
- package/lib/locale/zh-TW.js +3 -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/pager/Pager.d.ts +2 -0
- package/lib/types/components/select/Select.d.ts +5 -0
- package/lib/types/locale/en-US.d.ts +3 -4
- package/lib/umd/index.js +20 -17
- 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 +3 -3
package/lib/index.js
CHANGED
|
@@ -37,13 +37,16 @@ function Accordion(props) {
|
|
|
37
37
|
"data-u-comp": "accordion",
|
|
38
38
|
className: clsx("univer-divide-x-0 univer-divide-y univer-divide-solid univer-divide-gray-200 dark:!univer-divide-gray-600", className),
|
|
39
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-
|
|
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
41
|
type: "button",
|
|
42
42
|
onClick: () => toggleItem(index),
|
|
43
|
-
children: [/* @__PURE__ */ jsx(DownIcon, {
|
|
44
|
-
"-
|
|
45
|
-
"univer-
|
|
46
|
-
|
|
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,
|
|
47
|
+
"univer-rotate-0": openIndex === index
|
|
48
|
+
})
|
|
49
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
47
50
|
className: "univer-font-medium",
|
|
48
51
|
children: item.label
|
|
49
52
|
})]
|
|
@@ -62,7 +65,7 @@ function Accordion(props) {
|
|
|
62
65
|
|
|
63
66
|
//#endregion
|
|
64
67
|
//#region src/components/avatar/Avatar.tsx
|
|
65
|
-
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", {
|
|
66
69
|
variants: {
|
|
67
70
|
/**
|
|
68
71
|
* The shape of the avatar
|
|
@@ -186,12 +189,12 @@ function Badge(props) {
|
|
|
186
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", {
|
|
187
190
|
variants: {
|
|
188
191
|
variant: {
|
|
189
|
-
default: "univer-border-gray-200 univer-bg-
|
|
190
|
-
primary: "univer-border-primary-600 univer-bg-primary-600 univer-text-
|
|
191
|
-
danger: "univer-border-red-500 univer-bg-red-500 univer-text-
|
|
192
|
-
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",
|
|
193
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",
|
|
194
|
-
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"
|
|
195
198
|
},
|
|
196
199
|
size: {
|
|
197
200
|
icon: "univer-size-8 !univer-p-0",
|
|
@@ -322,7 +325,7 @@ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
|
322
325
|
function DropdownMenuSubContent({ className, ...props }) {
|
|
323
326
|
return /* @__PURE__ */ jsx(SubContent, {
|
|
324
327
|
"data-slot": "dropdown-menu-sub-content",
|
|
325
|
-
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),
|
|
326
329
|
...props
|
|
327
330
|
});
|
|
328
331
|
}
|
|
@@ -330,7 +333,7 @@ function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
|
330
333
|
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, {
|
|
331
334
|
"data-slot": "dropdown-menu-content",
|
|
332
335
|
sideOffset,
|
|
333
|
-
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),
|
|
334
337
|
...props
|
|
335
338
|
}) });
|
|
336
339
|
}
|
|
@@ -484,7 +487,7 @@ function PopoverContent({ className, align = "center", sideOffset = 4, ...props
|
|
|
484
487
|
"data-slot": "popover-content",
|
|
485
488
|
align,
|
|
486
489
|
sideOffset,
|
|
487
|
-
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),
|
|
488
491
|
...props
|
|
489
492
|
}) });
|
|
490
493
|
}
|
|
@@ -562,7 +565,7 @@ function TimeInput(props) {
|
|
|
562
565
|
"data-u-comp": "time-input",
|
|
563
566
|
className: "univer-relative univer-mx-auto univer-mt-1 univer-w-fit",
|
|
564
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", {
|
|
565
|
-
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),
|
|
566
569
|
type: "time",
|
|
567
570
|
step: "1",
|
|
568
571
|
value: formatDateWithPattern(value, "HH:mm:ss"),
|
|
@@ -742,7 +745,7 @@ function Calendar(props) {
|
|
|
742
745
|
return /* @__PURE__ */ jsxs("div", {
|
|
743
746
|
"data-u-comp": "calendar",
|
|
744
747
|
dir: direction,
|
|
745
|
-
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),
|
|
746
749
|
children: [
|
|
747
750
|
/* @__PURE__ */ jsxs("nav", {
|
|
748
751
|
className: "univer-mb-4 univer-flex univer-items-center univer-justify-between",
|
|
@@ -767,7 +770,7 @@ function Calendar(props) {
|
|
|
767
770
|
itemHeight: YEAR_ITEM_HEIGHT,
|
|
768
771
|
itemKey: "year",
|
|
769
772
|
children: (item) => /* @__PURE__ */ jsx("button", {
|
|
770
|
-
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 }),
|
|
771
774
|
type: "button",
|
|
772
775
|
onClick: () => handleChangeYear(item.year),
|
|
773
776
|
children: item.year
|
|
@@ -808,9 +811,9 @@ function Calendar(props) {
|
|
|
808
811
|
className: "univer-grid univer-grid-cols-7 univer-gap-1 univer-text-center",
|
|
809
812
|
children: days.map((day, idx) => day ? /* @__PURE__ */ jsx(DayButton, {
|
|
810
813
|
className: clsx({
|
|
811
|
-
"!univer-bg-primary-600 univer-font-bold univer-text-
|
|
812
|
-
"dark:!univer-text-
|
|
813
|
-
"!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),
|
|
814
817
|
"univer-font-semibold univer-text-primary-600 dark:!univer-text-primary-500": isToday(day) && !isSelected(day),
|
|
815
818
|
"univer-cursor-not-allowed univer-opacity-40": isDisabled(day),
|
|
816
819
|
"univer-hover:bg-primary-100 univer-cursor-pointer univer-text-gray-800": !isSelected(day) && !isDisabled(day)
|
|
@@ -876,7 +879,7 @@ function CascaderList(props) {
|
|
|
876
879
|
}
|
|
877
880
|
return /* @__PURE__ */ jsxs("section", {
|
|
878
881
|
"data-u-comp": "cascader-list",
|
|
879
|
-
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),
|
|
880
883
|
children: [activeOptions.map((options, index) => options.length ? /* @__PURE__ */ jsx("ul", {
|
|
881
884
|
className: clsx("univer-m-0 univer-h-full univer-max-h-full univer-list-none univer-overflow-auto univer-px-2", scrollbarClassName, contentClassName),
|
|
882
885
|
children: options.map((option) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("a", {
|
|
@@ -943,7 +946,7 @@ function Checkbox(props) {
|
|
|
943
946
|
return /* @__PURE__ */ jsxs("label", {
|
|
944
947
|
"data-u-comp": "checkbox",
|
|
945
948
|
className: clsx("univer-box-border univer-inline-flex univer-items-center univer-gap-2 univer-text-sm", {
|
|
946
|
-
"univer-cursor-pointer univer-text-gray-900 dark:!univer-text-
|
|
949
|
+
"univer-cursor-pointer univer-text-gray-900 dark:!univer-text-gray-0": !disabled,
|
|
947
950
|
"univer-text-gray-400": disabled
|
|
948
951
|
}, className),
|
|
949
952
|
style,
|
|
@@ -962,7 +965,7 @@ function Checkbox(props) {
|
|
|
962
965
|
"univer-border-primary-600 univer-bg-primary-600": checked || indeterminate,
|
|
963
966
|
"univer-border-gray-300 univer-bg-gray-50 dark:!univer-border-gray-500 dark:!univer-bg-gray-600": !checked && !indeterminate
|
|
964
967
|
}),
|
|
965
|
-
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" })]
|
|
966
969
|
})]
|
|
967
970
|
}), /* @__PURE__ */ jsx("span", {
|
|
968
971
|
className: clsx("univer-select-none", contentClassName),
|
|
@@ -981,11 +984,11 @@ const DialogOverlay = forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
981
984
|
...props
|
|
982
985
|
}));
|
|
983
986
|
DialogOverlay.displayName = Overlay.displayName;
|
|
984
|
-
const DialogContent = forwardRef(({ className, children, closable = true, onClickClose, mountContainer, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, {
|
|
987
|
+
const DialogContent = forwardRef(({ className, children, closable = true, onClickClose, mountContainer, overlayClassName, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, {
|
|
985
988
|
container: mountContainer ?? void 0,
|
|
986
|
-
children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Content$2, {
|
|
989
|
+
children: [/* @__PURE__ */ jsx(DialogOverlay, { className: overlayClassName }), /* @__PURE__ */ jsxs(Content$2, {
|
|
987
990
|
ref,
|
|
988
|
-
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),
|
|
989
992
|
...props,
|
|
990
993
|
children: [children, closable && /* @__PURE__ */ jsxs(Close, {
|
|
991
994
|
"data-slot": "close",
|
|
@@ -1012,7 +1015,7 @@ const DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
|
1012
1015
|
DialogFooter.displayName = "DialogFooter";
|
|
1013
1016
|
const DialogTitle = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Title, {
|
|
1014
1017
|
ref,
|
|
1015
|
-
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),
|
|
1016
1019
|
...props
|
|
1017
1020
|
}));
|
|
1018
1021
|
DialogTitle.displayName = Title.displayName;
|
|
@@ -1143,7 +1146,7 @@ function useDraggable(options = {}) {
|
|
|
1143
1146
|
};
|
|
1144
1147
|
}
|
|
1145
1148
|
function Dialog(props) {
|
|
1146
|
-
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;
|
|
1147
1150
|
const { locale, mountContainer, direction } = useContext(ConfigContext);
|
|
1148
1151
|
const { position, isDragging, setElementRef, handleMouseDown } = useDraggable({
|
|
1149
1152
|
defaultPosition,
|
|
@@ -1195,6 +1198,7 @@ function Dialog(props) {
|
|
|
1195
1198
|
},
|
|
1196
1199
|
closable,
|
|
1197
1200
|
mountContainer,
|
|
1201
|
+
overlayClassName,
|
|
1198
1202
|
dir: direction,
|
|
1199
1203
|
onClickClose: handleClickClose,
|
|
1200
1204
|
onEscapeKeyDown: (e) => {
|
|
@@ -1426,7 +1430,7 @@ function AlphaSlider({ hsv, alpha, onChange, onChanged }) {
|
|
|
1426
1430
|
children: /* @__PURE__ */ jsx("div", {
|
|
1427
1431
|
ref: thumbRef,
|
|
1428
1432
|
"data-u-comp": "color-picker-alpha-slider-thumb",
|
|
1429
|
-
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",
|
|
1430
1434
|
style: {
|
|
1431
1435
|
left: getThumbPosition(),
|
|
1432
1436
|
transform: "translateY(-50%)",
|
|
@@ -1462,7 +1466,7 @@ function HexInput({ hsv, onChange }) {
|
|
|
1462
1466
|
if (!isValidHex(inputValue)) setInputValue(hexValue.replace(/^#/, ""));
|
|
1463
1467
|
};
|
|
1464
1468
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("input", {
|
|
1465
|
-
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),
|
|
1466
1470
|
value: inputValue,
|
|
1467
1471
|
onChange: handleChange,
|
|
1468
1472
|
onBlur: handleBlur,
|
|
@@ -1522,7 +1526,7 @@ function RgbInput({ hsv, alpha, format, onChange }) {
|
|
|
1522
1526
|
});
|
|
1523
1527
|
};
|
|
1524
1528
|
return /* @__PURE__ */ jsxs("div", {
|
|
1525
|
-
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",
|
|
1526
1530
|
children: [
|
|
1527
1531
|
/* @__PURE__ */ jsx("input", {
|
|
1528
1532
|
value: localValues.r,
|
|
@@ -1553,7 +1557,7 @@ function RgbInput({ hsv, alpha, format, onChange }) {
|
|
|
1553
1557
|
}
|
|
1554
1558
|
function ColorInput({ hsv, alpha, format, onChange }) {
|
|
1555
1559
|
return /* @__PURE__ */ jsx("div", {
|
|
1556
|
-
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",
|
|
1557
1561
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1558
1562
|
className: "univer-relative univer-flex univer-flex-1 univer-gap-2",
|
|
1559
1563
|
children: [/* @__PURE__ */ jsx(HexInput, {
|
|
@@ -1675,7 +1679,7 @@ function ColorPresets({ hsv, onChange }) {
|
|
|
1675
1679
|
children: row.map((color, j) => /* @__PURE__ */ jsx("button", {
|
|
1676
1680
|
type: "button",
|
|
1677
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", {
|
|
1678
|
-
"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(),
|
|
1679
1683
|
"!univer-border-gray-200": i === 0 && j === 0
|
|
1680
1684
|
}),
|
|
1681
1685
|
style: { backgroundColor: color },
|
|
@@ -1771,7 +1775,7 @@ function ColorSpectrum({ hsv, onChange, onChanged }) {
|
|
|
1771
1775
|
},
|
|
1772
1776
|
onPointerMove: (e) => isDragging && handlePointerEvent(e)
|
|
1773
1777
|
}), /* @__PURE__ */ jsx("div", {
|
|
1774
|
-
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",
|
|
1775
1779
|
style: getIndicatorStyles()
|
|
1776
1780
|
})]
|
|
1777
1781
|
});
|
|
@@ -1871,7 +1875,7 @@ function HueSlider({ hsv, onChange, onChanged }) {
|
|
|
1871
1875
|
children: /* @__PURE__ */ jsx("div", {
|
|
1872
1876
|
ref: thumbRef,
|
|
1873
1877
|
"data-u-comp": "color-picker-hue-slider-thumb",
|
|
1874
|
-
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",
|
|
1875
1879
|
style: {
|
|
1876
1880
|
left: getThumbPosition(),
|
|
1877
1881
|
transform: "translateY(-50%)",
|
|
@@ -1990,13 +1994,14 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
1990
1994
|
/* @__PURE__ */ jsx("div", {
|
|
1991
1995
|
className: "univer-flex univer-h-7 univer-items-center",
|
|
1992
1996
|
children: /* @__PURE__ */ jsx("a", {
|
|
1993
|
-
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",
|
|
1994
1998
|
onClick: () => setVisible(true),
|
|
1995
1999
|
children: locale === null || locale === void 0 ? void 0 : locale.ColorPicker.more
|
|
1996
2000
|
})
|
|
1997
2001
|
}),
|
|
1998
2002
|
/* @__PURE__ */ jsx(Dialog, {
|
|
1999
2003
|
className: "!univer-z-[1090] !univer-w-fit !univer-p-2.5",
|
|
2004
|
+
overlayClassName: "!univer-z-[1090]",
|
|
2000
2005
|
closable: false,
|
|
2001
2006
|
maskClosable: false,
|
|
2002
2007
|
open: visible,
|
|
@@ -2057,7 +2062,7 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
2057
2062
|
function Command({ className, ...props }) {
|
|
2058
2063
|
return /* @__PURE__ */ jsx(Command$1, {
|
|
2059
2064
|
"data-slot": "command",
|
|
2060
|
-
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),
|
|
2061
2066
|
...props
|
|
2062
2067
|
});
|
|
2063
2068
|
}
|
|
@@ -2189,7 +2194,7 @@ function DatePicker(props) {
|
|
|
2189
2194
|
open,
|
|
2190
2195
|
onOpenChange: setOpen,
|
|
2191
2196
|
children: /* @__PURE__ */ jsxs("button", {
|
|
2192
|
-
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),
|
|
2193
2198
|
type: "button",
|
|
2194
2199
|
children: [formatDateWithPattern(value, "YYYY-MM-DD"), /* @__PURE__ */ jsx(CalendarIcon, { className: "univer-text-gray-600 dark:!univer-text-gray-400" })]
|
|
2195
2200
|
})
|
|
@@ -2243,7 +2248,7 @@ function DateRangePicker(props) {
|
|
|
2243
2248
|
open,
|
|
2244
2249
|
onOpenChange: setOpen,
|
|
2245
2250
|
children: /* @__PURE__ */ jsxs("button", {
|
|
2246
|
-
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),
|
|
2247
2252
|
type: "button",
|
|
2248
2253
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
2249
2254
|
className: "univer-flex univer-gap-1",
|
|
@@ -2420,7 +2425,7 @@ function DraggableList(props) {
|
|
|
2420
2425
|
})
|
|
2421
2426
|
}), canUsePortal && draggingItem && ghostPosition && createPortal(/* @__PURE__ */ jsx("div", {
|
|
2422
2427
|
dir: direction,
|
|
2423
|
-
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"),
|
|
2424
2429
|
style: {
|
|
2425
2430
|
zIndex: 2147483647,
|
|
2426
2431
|
left: `${ghostPosition.x}px`,
|
|
@@ -2446,7 +2451,7 @@ const FormLayout = (props) => {
|
|
|
2446
2451
|
className: clsx("univer-mb-3 univer-flex univer-flex-col", className),
|
|
2447
2452
|
style,
|
|
2448
2453
|
children: [label && /* @__PURE__ */ jsxs("div", {
|
|
2449
|
-
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 }),
|
|
2450
2455
|
onClick: () => setCollapsed(!collapsed),
|
|
2451
2456
|
children: [label, collapsable && /* @__PURE__ */ jsx(MoreUpIcon, { className: clsx("univer-ml-1 univer-transition-transform", { "univer-rotate-180": collapsed }) })]
|
|
2452
2457
|
}), collapsed && collapsable ? null : /* @__PURE__ */ jsxs(Fragment, { children: [desc && /* @__PURE__ */ jsx("div", {
|
|
@@ -2495,9 +2500,12 @@ const FormDualColumnLayout = (props) => {
|
|
|
2495
2500
|
* limitations under the License.
|
|
2496
2501
|
*/
|
|
2497
2502
|
function Pager(props) {
|
|
2498
|
-
const { className, value: current = 0, total: count = 0, loop, text: propText, onChange } = props;
|
|
2503
|
+
const { className, value: current = 0, total: count = 0, loop, text: propText, previousButtonAriaLabel, nextButtonAriaLabel, onChange } = props;
|
|
2504
|
+
const { locale } = useContext(ConfigContext);
|
|
2499
2505
|
const text = propText ?? `${current}/${count}`;
|
|
2500
2506
|
const hasValue = count > 0;
|
|
2507
|
+
const previousButtonDisabled = !loop && current <= 1;
|
|
2508
|
+
const nextButtonDisabled = !loop && current >= count;
|
|
2501
2509
|
const onClickLeftArrow = () => {
|
|
2502
2510
|
if (current === 1) {
|
|
2503
2511
|
if (loop) onChange === null || onChange === void 0 || onChange(count);
|
|
@@ -2514,23 +2522,33 @@ function Pager(props) {
|
|
|
2514
2522
|
children: hasValue ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2515
2523
|
/* @__PURE__ */ jsx("button", {
|
|
2516
2524
|
"data-u-comp": "pager-left-arrow",
|
|
2517
|
-
className: "univer-inline-flex univer-size-
|
|
2525
|
+
className: "univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-rounded univer-border-none univer-bg-transparent univer-p-0 univer-text-current hover:univer-bg-gray-50 focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-primary-500 disabled:univer-cursor-default disabled:univer-opacity-40 dark:hover:!univer-bg-gray-600",
|
|
2518
2526
|
type: "button",
|
|
2519
|
-
|
|
2527
|
+
"aria-label": previousButtonAriaLabel ?? (locale === null || locale === void 0 ? void 0 : locale.Accessibility.previous) ?? "Previous",
|
|
2528
|
+
disabled: previousButtonDisabled,
|
|
2520
2529
|
onClick: onClickLeftArrow,
|
|
2521
|
-
children: /* @__PURE__ */ jsx(MoreLeftIcon, {
|
|
2530
|
+
children: /* @__PURE__ */ jsx(MoreLeftIcon, {
|
|
2531
|
+
className: "rtl:univer-rotate-180",
|
|
2532
|
+
"aria-hidden": "true"
|
|
2533
|
+
})
|
|
2522
2534
|
}),
|
|
2523
2535
|
/* @__PURE__ */ jsx("span", {
|
|
2524
2536
|
className: "univer-mx-1",
|
|
2537
|
+
"aria-live": "polite",
|
|
2538
|
+
"aria-atomic": "true",
|
|
2525
2539
|
children: text
|
|
2526
2540
|
}),
|
|
2527
2541
|
/* @__PURE__ */ jsx("button", {
|
|
2528
2542
|
"data-u-comp": "pager-right-arrow",
|
|
2529
|
-
className: "univer-inline-flex univer-size-
|
|
2543
|
+
className: "univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-rounded univer-border-none univer-bg-transparent univer-p-0 univer-text-current hover:univer-bg-gray-50 focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-primary-500 disabled:univer-cursor-default disabled:univer-opacity-40 dark:hover:!univer-bg-gray-600",
|
|
2530
2544
|
type: "button",
|
|
2531
|
-
|
|
2545
|
+
"aria-label": nextButtonAriaLabel ?? (locale === null || locale === void 0 ? void 0 : locale.Accessibility.next) ?? "Next",
|
|
2546
|
+
disabled: nextButtonDisabled,
|
|
2532
2547
|
onClick: onClickRightArrow,
|
|
2533
|
-
children: /* @__PURE__ */ jsx(MoreRightIcon, {
|
|
2548
|
+
children: /* @__PURE__ */ jsx(MoreRightIcon, {
|
|
2549
|
+
className: "rtl:univer-rotate-180",
|
|
2550
|
+
"aria-hidden": "true"
|
|
2551
|
+
})
|
|
2534
2552
|
})
|
|
2535
2553
|
] }) : /* @__PURE__ */ jsx("div", {
|
|
2536
2554
|
className: "univer-mx-1",
|
|
@@ -2556,40 +2574,83 @@ function Pager(props) {
|
|
|
2556
2574
|
* See the License for the specific language governing permissions and
|
|
2557
2575
|
* limitations under the License.
|
|
2558
2576
|
*/
|
|
2559
|
-
const
|
|
2560
|
-
univer-
|
|
2561
|
-
univer-bg-
|
|
2562
|
-
|
|
2577
|
+
const toolbarButtonClassName = `
|
|
2578
|
+
!univer-border-transparent !univer-bg-transparent !univer-text-gray-300
|
|
2579
|
+
hover:!univer-bg-gray-600 hover:!univer-text-gray-0
|
|
2580
|
+
focus-visible:!univer-outline-none focus-visible:!univer-ring-2 focus-visible:!univer-ring-gray-0
|
|
2581
|
+
`;
|
|
2582
|
+
const focusableElementSelector = `
|
|
2583
|
+
button:not([disabled]), [href], input:not([disabled]), select:not([disabled]),
|
|
2584
|
+
textarea:not([disabled]), [tabindex]:not([tabindex="-1"])
|
|
2563
2585
|
`;
|
|
2564
2586
|
function Gallery(props) {
|
|
2587
|
+
var _locale$Accessibility;
|
|
2565
2588
|
const { className, images, open, onOpenChange } = props;
|
|
2566
|
-
const [isVisible, setIsVisible] = useState(
|
|
2589
|
+
const [isVisible, setIsVisible] = useState(Boolean(open));
|
|
2567
2590
|
const [activeImageIndex, setActiveImageIndex] = useState(0);
|
|
2568
2591
|
const [zoomLevel, setZoomLevel] = useState(1);
|
|
2569
2592
|
const { direction, locale } = useContext(ConfigContext);
|
|
2570
2593
|
const dialogRef = useRef(null);
|
|
2594
|
+
const closeButtonRef = useRef(null);
|
|
2595
|
+
const previouslyFocusedElementRef = useRef(null);
|
|
2571
2596
|
const activeImage = images[activeImageIndex];
|
|
2572
2597
|
const hasPagination = images.length > 1;
|
|
2598
|
+
const imageLabel = (locale === null || locale === void 0 || (_locale$Accessibility = locale.Accessibility.image) === null || _locale$Accessibility === void 0 ? void 0 : _locale$Accessibility.replace("{0}", String(activeImageIndex + 1)).replace("{1}", String(images.length))) ?? `Image ${activeImageIndex + 1} of ${images.length}`;
|
|
2573
2599
|
useEffect(() => {
|
|
2574
|
-
|
|
2600
|
+
const timer = setTimeout(() => {
|
|
2601
|
+
var _previouslyFocusedEle;
|
|
2602
|
+
setIsVisible(Boolean(open));
|
|
2603
|
+
if (!open && ((_previouslyFocusedEle = previouslyFocusedElementRef.current) === null || _previouslyFocusedEle === void 0 ? void 0 : _previouslyFocusedEle.isConnected)) previouslyFocusedElementRef.current.focus();
|
|
2604
|
+
if (!open) previouslyFocusedElementRef.current = null;
|
|
2605
|
+
}, open ? 0 : 150);
|
|
2606
|
+
return () => clearTimeout(timer);
|
|
2575
2607
|
}, [open]);
|
|
2576
2608
|
useEffect(() => {
|
|
2609
|
+
var _closeButtonRef$curre;
|
|
2577
2610
|
if (!open) return;
|
|
2578
|
-
|
|
2579
|
-
|
|
2611
|
+
previouslyFocusedElementRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
2612
|
+
(_closeButtonRef$curre = closeButtonRef.current) === null || _closeButtonRef$curre === void 0 || _closeButtonRef$curre.focus();
|
|
2613
|
+
}, [open]);
|
|
2614
|
+
useEffect(() => {
|
|
2615
|
+
if (!open && !isVisible) return;
|
|
2616
|
+
const handler = (event) => {
|
|
2617
|
+
if (event.key === "Escape" && open) {
|
|
2618
|
+
event.preventDefault();
|
|
2619
|
+
event.stopPropagation();
|
|
2620
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(false);
|
|
2621
|
+
return;
|
|
2622
|
+
}
|
|
2623
|
+
if (event.key !== "Tab" || !dialogRef.current) return;
|
|
2624
|
+
const focusableElements = Array.from(dialogRef.current.querySelectorAll(focusableElementSelector));
|
|
2625
|
+
if (focusableElements.length === 0) {
|
|
2626
|
+
event.preventDefault();
|
|
2627
|
+
dialogRef.current.focus();
|
|
2628
|
+
return;
|
|
2629
|
+
}
|
|
2630
|
+
const firstElement = focusableElements[0];
|
|
2631
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
2632
|
+
const activeElement = document.activeElement;
|
|
2633
|
+
if (event.shiftKey && (activeElement === firstElement || !dialogRef.current.contains(activeElement))) {
|
|
2634
|
+
event.preventDefault();
|
|
2635
|
+
lastElement.focus();
|
|
2636
|
+
} else if (!event.shiftKey && (activeElement === lastElement || !dialogRef.current.contains(activeElement))) {
|
|
2637
|
+
event.preventDefault();
|
|
2638
|
+
firstElement.focus();
|
|
2639
|
+
}
|
|
2580
2640
|
};
|
|
2581
2641
|
window.addEventListener("keydown", handler);
|
|
2582
2642
|
return () => window.removeEventListener("keydown", handler);
|
|
2583
|
-
}, [
|
|
2643
|
+
}, [
|
|
2644
|
+
isVisible,
|
|
2645
|
+
onOpenChange,
|
|
2646
|
+
open
|
|
2647
|
+
]);
|
|
2584
2648
|
useEffect(() => {
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
return () => clearTimeout(timer);
|
|
2591
|
-
}
|
|
2592
|
-
}, [open]);
|
|
2649
|
+
return () => {
|
|
2650
|
+
var _previouslyFocusedEle2;
|
|
2651
|
+
if ((_previouslyFocusedEle2 = previouslyFocusedElementRef.current) === null || _previouslyFocusedEle2 === void 0 ? void 0 : _previouslyFocusedEle2.isConnected) previouslyFocusedElementRef.current.focus();
|
|
2652
|
+
};
|
|
2653
|
+
}, []);
|
|
2593
2654
|
useEffect(() => {
|
|
2594
2655
|
if (!open) return;
|
|
2595
2656
|
const handleWheel = (e) => {
|
|
@@ -2608,17 +2669,17 @@ function Gallery(props) {
|
|
|
2608
2669
|
setZoomLevel(1);
|
|
2609
2670
|
return;
|
|
2610
2671
|
}
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2672
|
+
setZoomLevel((previousZoomLevel) => Math.min(Math.max(.5, previousZoomLevel + ratio), 2));
|
|
2673
|
+
}
|
|
2674
|
+
function handleClose() {
|
|
2675
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(false);
|
|
2615
2676
|
}
|
|
2616
2677
|
return createPortal(/* @__PURE__ */ jsxs("div", {
|
|
2617
2678
|
"data-u-comp": "gallery",
|
|
2618
2679
|
dir: direction,
|
|
2619
2680
|
role: "dialog",
|
|
2620
2681
|
"aria-modal": "true",
|
|
2621
|
-
"aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.imageGallery,
|
|
2682
|
+
"aria-label": (locale === null || locale === void 0 ? void 0 : locale.Accessibility.imageGallery) ?? "Image gallery",
|
|
2622
2683
|
tabIndex: -1,
|
|
2623
2684
|
ref: dialogRef,
|
|
2624
2685
|
className: clsx("univer-fixed univer-inset-0 univer-z-[1080] univer-flex univer-h-screen univer-w-screen univer-select-none univer-items-center univer-justify-center", {
|
|
@@ -2629,7 +2690,18 @@ function Gallery(props) {
|
|
|
2629
2690
|
/* @__PURE__ */ jsx("div", {
|
|
2630
2691
|
className: "univer-absolute univer-inset-0 univer-size-full univer-bg-gray-900 univer-opacity-80",
|
|
2631
2692
|
"aria-hidden": "true",
|
|
2632
|
-
onClick:
|
|
2693
|
+
onClick: handleClose
|
|
2694
|
+
}),
|
|
2695
|
+
/* @__PURE__ */ jsx(Button, {
|
|
2696
|
+
ref: closeButtonRef,
|
|
2697
|
+
"data-u-comp": "gallery-close",
|
|
2698
|
+
type: "button",
|
|
2699
|
+
variant: "ghost",
|
|
2700
|
+
size: "icon",
|
|
2701
|
+
"aria-label": (locale === null || locale === void 0 ? void 0 : locale.Accessibility.close) ?? "Close",
|
|
2702
|
+
className: "univer-absolute univer-right-4 univer-top-4 univer-z-10 univer-size-10 univer-rounded-full !univer-border-gray-500 !univer-bg-gray-800 !univer-text-gray-0 hover:!univer-bg-gray-700 focus-visible:!univer-outline-none focus-visible:!univer-ring-2 focus-visible:!univer-ring-gray-0 rtl:univer-left-4 rtl:univer-right-auto",
|
|
2703
|
+
onClick: handleClose,
|
|
2704
|
+
children: /* @__PURE__ */ jsx(CloseIcon, { "aria-hidden": "true" })
|
|
2633
2705
|
}),
|
|
2634
2706
|
/* @__PURE__ */ jsx("div", {
|
|
2635
2707
|
className: "univer-relative univer-flex univer-w-fit univer-items-center univer-justify-center",
|
|
@@ -2637,10 +2709,16 @@ function Gallery(props) {
|
|
|
2637
2709
|
className: "univer-h-full univer-w-full univer-object-contain univer-transition-transform univer-duration-300 univer-ease-out",
|
|
2638
2710
|
style: { transform: `scale(${zoomLevel})` },
|
|
2639
2711
|
src: activeImage,
|
|
2640
|
-
alt:
|
|
2712
|
+
alt: imageLabel,
|
|
2641
2713
|
draggable: false
|
|
2642
2714
|
})
|
|
2643
2715
|
}),
|
|
2716
|
+
/* @__PURE__ */ jsx("span", {
|
|
2717
|
+
className: "univer-sr-only",
|
|
2718
|
+
"aria-live": "polite",
|
|
2719
|
+
"aria-atomic": "true",
|
|
2720
|
+
children: imageLabel
|
|
2721
|
+
}),
|
|
2644
2722
|
/* @__PURE__ */ jsxs("footer", {
|
|
2645
2723
|
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",
|
|
2646
2724
|
children: [
|
|
@@ -2648,26 +2726,37 @@ function Gallery(props) {
|
|
|
2648
2726
|
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",
|
|
2649
2727
|
value: activeImageIndex + 1,
|
|
2650
2728
|
total: images.length,
|
|
2729
|
+
previousButtonAriaLabel: (locale === null || locale === void 0 ? void 0 : locale.Accessibility.previous) ?? "Previous",
|
|
2730
|
+
nextButtonAriaLabel: (locale === null || locale === void 0 ? void 0 : locale.Accessibility.next) ?? "Next",
|
|
2651
2731
|
onChange: (value) => setActiveImageIndex(value - 1)
|
|
2652
2732
|
}),
|
|
2653
|
-
/* @__PURE__ */ jsx(
|
|
2733
|
+
/* @__PURE__ */ jsx(Button, {
|
|
2654
2734
|
type: "button",
|
|
2655
|
-
"
|
|
2656
|
-
|
|
2735
|
+
variant: "ghost",
|
|
2736
|
+
size: "icon",
|
|
2737
|
+
"aria-label": (locale === null || locale === void 0 ? void 0 : locale.Accessibility.zoomIn) ?? "Zoom in",
|
|
2738
|
+
className: toolbarButtonClassName,
|
|
2739
|
+
disabled: zoomLevel >= 2,
|
|
2657
2740
|
onClick: () => handleToggleZoom(.25),
|
|
2658
2741
|
children: /* @__PURE__ */ jsx(ZoomInIcon, { "aria-hidden": "true" })
|
|
2659
2742
|
}),
|
|
2660
|
-
/* @__PURE__ */ jsx(
|
|
2743
|
+
/* @__PURE__ */ jsx(Button, {
|
|
2661
2744
|
type: "button",
|
|
2662
|
-
"
|
|
2663
|
-
|
|
2745
|
+
variant: "ghost",
|
|
2746
|
+
size: "icon",
|
|
2747
|
+
"aria-label": (locale === null || locale === void 0 ? void 0 : locale.Accessibility.zoomOut) ?? "Zoom out",
|
|
2748
|
+
className: toolbarButtonClassName,
|
|
2749
|
+
disabled: zoomLevel <= .5,
|
|
2664
2750
|
onClick: () => handleToggleZoom(-.25),
|
|
2665
2751
|
children: /* @__PURE__ */ jsx(ZoomOutIcon, { "aria-hidden": "true" })
|
|
2666
2752
|
}),
|
|
2667
|
-
/* @__PURE__ */ jsx(
|
|
2753
|
+
/* @__PURE__ */ jsx(Button, {
|
|
2668
2754
|
type: "button",
|
|
2669
|
-
"
|
|
2670
|
-
|
|
2755
|
+
variant: "ghost",
|
|
2756
|
+
size: "icon",
|
|
2757
|
+
"aria-label": (locale === null || locale === void 0 ? void 0 : locale.Accessibility.resetZoom) ?? "Reset zoom",
|
|
2758
|
+
className: toolbarButtonClassName,
|
|
2759
|
+
disabled: zoomLevel === 1,
|
|
2671
2760
|
onClick: () => handleToggleZoom("reset"),
|
|
2672
2761
|
children: /* @__PURE__ */ jsx(OneToOneIcon, { "aria-hidden": "true" })
|
|
2673
2762
|
})
|
|
@@ -2679,7 +2768,7 @@ function Gallery(props) {
|
|
|
2679
2768
|
|
|
2680
2769
|
//#endregion
|
|
2681
2770
|
//#region src/components/input/Input.tsx
|
|
2682
|
-
const inputVariants = cva$1("univer-box-border univer-w-full univer-rounded-md univer-bg-
|
|
2771
|
+
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", {
|
|
2683
2772
|
variants: { size: {
|
|
2684
2773
|
mini: "univer-h-7 univer-px-1.5 univer-text-sm",
|
|
2685
2774
|
small: "univer-h-8 univer-px-2 univer-text-sm",
|
|
@@ -2920,7 +3009,7 @@ const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Num
|
|
|
2920
3009
|
}), controls && /* @__PURE__ */ jsxs("div", {
|
|
2921
3010
|
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),
|
|
2922
3011
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2923
|
-
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-
|
|
3012
|
+
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"),
|
|
2924
3013
|
role: "button",
|
|
2925
3014
|
"aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.increment,
|
|
2926
3015
|
"aria-disabled": incrementDisabled,
|
|
@@ -2932,7 +3021,7 @@ const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Num
|
|
|
2932
3021
|
},
|
|
2933
3022
|
children: "+"
|
|
2934
3023
|
}), /* @__PURE__ */ jsx("span", {
|
|
2935
|
-
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-
|
|
3024
|
+
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"),
|
|
2936
3025
|
role: "button",
|
|
2937
3026
|
"aria-label": locale === null || locale === void 0 ? void 0 : locale.Accessibility.decrement,
|
|
2938
3027
|
"aria-disabled": decrementDisabled,
|
|
@@ -2999,15 +3088,15 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
|
|
|
2999
3088
|
ref: containerRef,
|
|
3000
3089
|
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),
|
|
3001
3090
|
children: [/* @__PURE__ */ jsx("div", {
|
|
3002
|
-
className: "univer-animate-univer-slide univer-absolute univer-h-6 univer-rounded-md univer-bg-
|
|
3091
|
+
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",
|
|
3003
3092
|
style: slideStyle
|
|
3004
3093
|
}), items.map((item) => /* @__PURE__ */ jsx("button", {
|
|
3005
3094
|
ref: (el) => {
|
|
3006
3095
|
if (el) itemRefs.current.set(item.value, el);
|
|
3007
3096
|
},
|
|
3008
3097
|
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", {
|
|
3009
|
-
"univer-text-gray-900 dark:!univer-text-
|
|
3010
|
-
"univer-text-gray-500 hover:univer-text-gray-900 dark:hover:!univer-text-
|
|
3098
|
+
"univer-text-gray-900 dark:!univer-text-gray-0": selectedItem === item.value,
|
|
3099
|
+
"univer-text-gray-500 hover:univer-text-gray-900 dark:hover:!univer-text-gray-0": selectedItem !== item.value
|
|
3011
3100
|
}),
|
|
3012
3101
|
type: "button",
|
|
3013
3102
|
onClick: () => handleClick(item.value),
|
|
@@ -3163,7 +3252,7 @@ function Tooltip(props) {
|
|
|
3163
3252
|
ref: tooltipRef,
|
|
3164
3253
|
dir: direction,
|
|
3165
3254
|
role: "tooltip",
|
|
3166
|
-
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-
|
|
3255
|
+
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),
|
|
3167
3256
|
style: {
|
|
3168
3257
|
top: (coords === null || coords === void 0 ? void 0 : coords.top) ?? -9999,
|
|
3169
3258
|
left: (coords === null || coords === void 0 ? void 0 : coords.left) ?? -9999
|
|
@@ -3386,7 +3475,7 @@ function GradientColorPicker(props) {
|
|
|
3386
3475
|
}, [draftValue, stops]);
|
|
3387
3476
|
const showAngleEditor = draftValue.type === "linear" || draftValue.type === "angular";
|
|
3388
3477
|
return /* @__PURE__ */ jsxs("div", {
|
|
3389
|
-
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-
|
|
3478
|
+
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),
|
|
3390
3479
|
onClick: (e) => e.stopPropagation(),
|
|
3391
3480
|
onPointerDown: (e) => e.stopPropagation(),
|
|
3392
3481
|
children: [
|
|
@@ -3413,7 +3502,7 @@ function GradientColorPicker(props) {
|
|
|
3413
3502
|
const selected = draftValue.type === item.value;
|
|
3414
3503
|
return /* @__PURE__ */ jsxs("button", {
|
|
3415
3504
|
type: "button",
|
|
3416
|
-
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-
|
|
3505
|
+
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"),
|
|
3417
3506
|
onClick: () => handleTypeChange(item.value),
|
|
3418
3507
|
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" })]
|
|
3419
3508
|
}, item.value);
|
|
@@ -3471,7 +3560,7 @@ function GradientColorPicker(props) {
|
|
|
3471
3560
|
}), draftValue.stops.map((stop, index) => /* @__PURE__ */ jsx("div", {
|
|
3472
3561
|
"data-u-comp": "gradient-color-picker-stop",
|
|
3473
3562
|
"data-selected": selectedIndex === index,
|
|
3474
|
-
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-
|
|
3563
|
+
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"),
|
|
3475
3564
|
style: {
|
|
3476
3565
|
left: `${stop.offset}%`,
|
|
3477
3566
|
backgroundColor: getStopColor(stop)
|
|
@@ -3578,7 +3667,7 @@ const HoverCardContent = forwardRef(({ className, align = "center", sideOffset =
|
|
|
3578
3667
|
ref,
|
|
3579
3668
|
align,
|
|
3580
3669
|
sideOffset,
|
|
3581
|
-
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-
|
|
3670
|
+
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),
|
|
3582
3671
|
...props
|
|
3583
3672
|
}));
|
|
3584
3673
|
HoverCardContent.displayName = Content$3.displayName;
|
|
@@ -3630,7 +3719,7 @@ function KBD(props) {
|
|
|
3630
3719
|
const { keyboard, className } = props;
|
|
3631
3720
|
const keys = keyboard.split("+");
|
|
3632
3721
|
return /* @__PURE__ */ jsx("span", {
|
|
3633
|
-
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-
|
|
3722
|
+
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),
|
|
3634
3723
|
children: keys.map((text, index) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("kbd", {
|
|
3635
3724
|
className: "univer-inline-block univer-h-full",
|
|
3636
3725
|
children: text
|
|
@@ -3692,7 +3781,7 @@ const Messager = ({ className, ...props }) => /* @__PURE__ */ jsx(Toaster$1, {
|
|
|
3692
3781
|
expand: false,
|
|
3693
3782
|
icons: { loading: loadingIcon },
|
|
3694
3783
|
offset: { top: 16 },
|
|
3695
|
-
className: clsx("[&_[data-sonner-toast]]:univer-bg-
|
|
3784
|
+
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),
|
|
3696
3785
|
toastOptions: {
|
|
3697
3786
|
duration: DEFAULT_MESSAGE_DURATION,
|
|
3698
3787
|
classNames: {
|
|
@@ -3778,10 +3867,13 @@ function PanelSection(props) {
|
|
|
3778
3867
|
"univer-cursor-default": !collapsible
|
|
3779
3868
|
}),
|
|
3780
3869
|
onClick: () => collapsible && setExpanded((v) => !v),
|
|
3781
|
-
children: [collapsible && /* @__PURE__ */ jsx(DownIcon, {
|
|
3782
|
-
"-
|
|
3783
|
-
"univer-
|
|
3784
|
-
|
|
3870
|
+
children: [collapsible && /* @__PURE__ */ jsx(DownIcon, {
|
|
3871
|
+
"aria-hidden": "true",
|
|
3872
|
+
className: clsx("univer-size-2.5 univer-flex-shrink-0 univer-transition-transform", {
|
|
3873
|
+
"-univer-rotate-90 rtl:univer-rotate-90": !expanded,
|
|
3874
|
+
"univer-rotate-0": expanded
|
|
3875
|
+
})
|
|
3876
|
+
}), /* @__PURE__ */ jsx("span", { children: title })]
|
|
3785
3877
|
}), /* @__PURE__ */ jsx("div", {
|
|
3786
3878
|
id: contentId,
|
|
3787
3879
|
role: "region",
|
|
@@ -3938,7 +4030,7 @@ function Radio(props) {
|
|
|
3938
4030
|
return /* @__PURE__ */ jsxs("label", {
|
|
3939
4031
|
"data-u-comp": "radio",
|
|
3940
4032
|
className: clsx("univer-box-border univer-inline-flex univer-items-center univer-gap-2 univer-text-sm", {
|
|
3941
|
-
"univer-cursor-pointer univer-text-gray-900 dark:!univer-text-
|
|
4033
|
+
"univer-cursor-pointer univer-text-gray-900 dark:!univer-text-gray-0": !disabled,
|
|
3942
4034
|
"univer-text-gray-400": disabled
|
|
3943
4035
|
}),
|
|
3944
4036
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
@@ -3956,7 +4048,7 @@ function Radio(props) {
|
|
|
3956
4048
|
"univer-border-primary-600 univer-bg-primary-600 dark:!univer-bg-primary-600": checked,
|
|
3957
4049
|
"univer-border-gray-300 univer-bg-gray-50 dark:!univer-border-gray-500 dark:!univer-bg-gray-600": !checked
|
|
3958
4050
|
}),
|
|
3959
|
-
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-
|
|
4051
|
+
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" })
|
|
3960
4052
|
})]
|
|
3961
4053
|
}), /* @__PURE__ */ jsx("span", { children })]
|
|
3962
4054
|
});
|
|
@@ -3994,7 +4086,7 @@ function SelectList(props) {
|
|
|
3994
4086
|
children: options.map((option, index) => {
|
|
3995
4087
|
const checked = value.indexOf(option.value) > -1;
|
|
3996
4088
|
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("a", {
|
|
3997
|
-
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-
|
|
4089
|
+
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 }),
|
|
3998
4090
|
onClick: () => handleSelect(option.value),
|
|
3999
4091
|
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", {
|
|
4000
4092
|
style: { color: option.color },
|
|
@@ -4007,9 +4099,9 @@ function SelectList(props) {
|
|
|
4007
4099
|
|
|
4008
4100
|
//#endregion
|
|
4009
4101
|
//#region src/components/select/Select.tsx
|
|
4010
|
-
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-
|
|
4102
|
+
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);
|
|
4011
4103
|
function Select(props) {
|
|
4012
|
-
const { className, value, disabled = false, options = [], borderless = false, onChange } = props;
|
|
4104
|
+
const { className, value, disabled = false, options = [], borderless = false, side, avoidCollisions, onChange } = props;
|
|
4013
4105
|
const [open, setOpen] = useState(false);
|
|
4014
4106
|
function handleOpenChange(open) {
|
|
4015
4107
|
setOpen(open);
|
|
@@ -4059,6 +4151,8 @@ function Select(props) {
|
|
|
4059
4151
|
open,
|
|
4060
4152
|
items,
|
|
4061
4153
|
disabled,
|
|
4154
|
+
side,
|
|
4155
|
+
avoidCollisions,
|
|
4062
4156
|
onOpenChange: handleOpenChange,
|
|
4063
4157
|
children: /* @__PURE__ */ jsxs("div", {
|
|
4064
4158
|
"data-u-comp": "select",
|
|
@@ -4070,9 +4164,9 @@ function Select(props) {
|
|
|
4070
4164
|
"univer-cursor-pointer": !disabled && !open
|
|
4071
4165
|
}, className),
|
|
4072
4166
|
children: [/* @__PURE__ */ jsx("div", {
|
|
4073
|
-
className: "univer-flex-1 univer-truncate univer-text-sm univer-text-gray-500 dark:!univer-text-
|
|
4167
|
+
className: "univer-flex-1 univer-truncate univer-text-sm univer-text-gray-500 dark:!univer-text-gray-0",
|
|
4074
4168
|
children: displayValue
|
|
4075
|
-
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "univer-flex-shrink-0 dark:!univer-text-
|
|
4169
|
+
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "univer-flex-shrink-0 dark:!univer-text-gray-0" })]
|
|
4076
4170
|
})
|
|
4077
4171
|
});
|
|
4078
4172
|
}
|
|
@@ -4135,7 +4229,7 @@ function MultipleSelect(props) {
|
|
|
4135
4229
|
children: [/* @__PURE__ */ jsx("div", {
|
|
4136
4230
|
className: "univer-box-border univer-flex univer-w-[calc(100%-16px)] univer-gap-2 univer-pr-2",
|
|
4137
4231
|
children: displayValue
|
|
4138
|
-
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "univer-flex-shrink-0 dark:!univer-text-
|
|
4232
|
+
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "univer-flex-shrink-0 dark:!univer-text-gray-0" })]
|
|
4139
4233
|
})
|
|
4140
4234
|
});
|
|
4141
4235
|
}
|
|
@@ -4194,7 +4288,7 @@ const Switch = (props) => {
|
|
|
4194
4288
|
"univer-bg-primary-600": checked,
|
|
4195
4289
|
"univer-bg-gray-200 dark:!univer-bg-gray-600": !checked
|
|
4196
4290
|
}),
|
|
4197
|
-
children: /* @__PURE__ */ jsx("span", { className: clsx("univer-absolute univer-bottom-0.5 univer-left-0.5 univer-size-3 univer-rounded-full univer-bg-
|
|
4291
|
+
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 }) })
|
|
4198
4292
|
})]
|
|
4199
4293
|
})
|
|
4200
4294
|
});
|
|
@@ -4239,7 +4333,7 @@ const Textarea = forwardRef((props, ref) => {
|
|
|
4239
4333
|
ref: textareaRef,
|
|
4240
4334
|
"data-u-comp": "textarea",
|
|
4241
4335
|
"data-slot": "textarea",
|
|
4242
|
-
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-
|
|
4336
|
+
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),
|
|
4243
4337
|
onChange: handleChange,
|
|
4244
4338
|
...restProps
|
|
4245
4339
|
});
|
|
@@ -4485,7 +4579,7 @@ function Tree(props) {
|
|
|
4485
4579
|
}, key);
|
|
4486
4580
|
}
|
|
4487
4581
|
return /* @__PURE__ */ jsx("section", {
|
|
4488
|
-
className: "univer-relative univer-select-none univer-text-gray-900 dark:!univer-text-
|
|
4582
|
+
className: "univer-relative univer-select-none univer-text-gray-900 dark:!univer-text-gray-0",
|
|
4489
4583
|
children: /* @__PURE__ */ jsx("div", {
|
|
4490
4584
|
className: "univer-m-0 univer-h-full univer-list-none univer-p-0",
|
|
4491
4585
|
style,
|