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