@univerjs/design 1.0.0-alpha.1 → 1.0.0-alpha.3
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 +119 -86
- package/lib/cjs/locale/ar-SA.js +1 -1
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/de-DE.js +1 -1
- package/lib/cjs/locale/es-ES.js +10 -10
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/id-ID.js +1 -1
- package/lib/cjs/locale/it-IT.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/pl-PL.js +1 -1
- package/lib/cjs/locale/pt-BR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/es/index.js +120 -88
- package/lib/es/locale/ar-SA.js +1 -1
- package/lib/es/locale/ca-ES.js +1 -1
- package/lib/es/locale/de-DE.js +1 -1
- package/lib/es/locale/es-ES.js +10 -10
- package/lib/es/locale/fa-IR.js +1 -1
- package/lib/es/locale/fr-FR.js +1 -1
- package/lib/es/locale/id-ID.js +1 -1
- package/lib/es/locale/it-IT.js +1 -1
- package/lib/es/locale/ja-JP.js +1 -1
- package/lib/es/locale/ko-KR.js +1 -1
- package/lib/es/locale/pl-PL.js +1 -1
- package/lib/es/locale/pt-BR.js +1 -1
- package/lib/es/locale/ru-RU.js +1 -1
- package/lib/es/locale/sk-SK.js +1 -1
- package/lib/es/locale/vi-VN.js +1 -1
- package/lib/index.css +78 -0
- package/lib/index.js +120 -88
- package/lib/locale/ar-SA.js +1 -1
- package/lib/locale/ca-ES.js +1 -1
- package/lib/locale/de-DE.js +1 -1
- package/lib/locale/es-ES.js +10 -10
- package/lib/locale/fa-IR.js +1 -1
- package/lib/locale/fr-FR.js +1 -1
- package/lib/locale/id-ID.js +1 -1
- package/lib/locale/it-IT.js +1 -1
- package/lib/locale/ja-JP.js +1 -1
- package/lib/locale/ko-KR.js +1 -1
- package/lib/locale/pl-PL.js +1 -1
- package/lib/locale/pt-BR.js +1 -1
- package/lib/locale/ru-RU.js +1 -1
- package/lib/locale/sk-SK.js +1 -1
- package/lib/locale/vi-VN.js +1 -1
- package/lib/types/components/accordion/Accordion.d.ts +4 -0
- package/lib/types/components/button/Button.d.ts +1 -1
- package/lib/types/components/dialog/DialogPrimitive.d.ts +1 -0
- package/lib/types/components/message/Message.d.ts +2 -2
- package/lib/types/components/segmented/Segmented.d.ts +2 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/umd/index.js +14 -18
- 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/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/package.json +11 -11
package/lib/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CalendarIcon, CheckMarkIcon, ClockIcon, CloseIcon, DeleteIcon, DownIcon,
|
|
1
|
+
import { CalendarIcon, CheckMarkIcon, ClockIcon, CloseIcon, DeleteIcon, DownIcon, ErrorIcon, InfoIcon, LoadingMultiIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, MoreUpIcon, OneToOneIcon, SuccessIcon, WarningIcon, ZoomInIcon, ZoomOutIcon } from "@univerjs/icons";
|
|
2
2
|
import { Children, cloneElement, createContext, forwardRef, isValidElement, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { clsx as clsx$1 } from "clsx";
|
|
4
|
-
import {
|
|
4
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { cva, cva as cva$1 } from "class-variance-authority";
|
|
7
7
|
import { Slot } from "@radix-ui/react-slot";
|
|
@@ -17,6 +17,7 @@ import { Root as Root$4 } from "@radix-ui/react-separator";
|
|
|
17
17
|
import { createRoot } from "react-dom/client";
|
|
18
18
|
|
|
19
19
|
//#region src/helper/clsx.ts
|
|
20
|
+
const twMerge = extendTailwindMerge({ prefix: "univer-" });
|
|
20
21
|
function clsx(...inputs) {
|
|
21
22
|
return twMerge(clsx$1(inputs));
|
|
22
23
|
}
|
|
@@ -24,35 +25,42 @@ function clsx(...inputs) {
|
|
|
24
25
|
//#endregion
|
|
25
26
|
//#region src/components/accordion/Accordion.tsx
|
|
26
27
|
function Accordion(props) {
|
|
27
|
-
|
|
28
|
-
const
|
|
28
|
+
var _props$openIndex;
|
|
29
|
+
const { className, defaultOpenIndex = null, items, onOpenIndexChange } = props;
|
|
30
|
+
const [innerOpenIndex, setInnerOpenIndex] = useState(defaultOpenIndex);
|
|
31
|
+
const openIndex = (_props$openIndex = props.openIndex) !== null && _props$openIndex !== void 0 ? _props$openIndex : innerOpenIndex;
|
|
29
32
|
const toggleItem = (index) => {
|
|
30
|
-
|
|
33
|
+
const nextOpenIndex = openIndex === index ? null : index;
|
|
34
|
+
if (props.openIndex === void 0) setInnerOpenIndex(nextOpenIndex);
|
|
35
|
+
onOpenIndexChange === null || onOpenIndexChange === void 0 || onOpenIndexChange(nextOpenIndex);
|
|
31
36
|
};
|
|
32
37
|
return /* @__PURE__ */ jsx("div", {
|
|
33
38
|
"data-u-comp": "accordion",
|
|
34
39
|
className: clsx("univer-divide-x-0 univer-divide-y univer-divide-solid univer-divide-gray-200 dark:!univer-divide-gray-600", className),
|
|
35
|
-
children: items.map((item, index) =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"univer-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"univer-max-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
children:
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
children: items.map((item, index) => {
|
|
41
|
+
var _item$id;
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("button", {
|
|
43
|
+
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-white",
|
|
44
|
+
type: "button",
|
|
45
|
+
onClick: () => toggleItem(index),
|
|
46
|
+
children: [/* @__PURE__ */ jsx(DownIcon, { className: clsx("univer-size-2.5 univer-flex-shrink-0 univer-transition-transform", {
|
|
47
|
+
"-univer-rotate-90": openIndex !== index,
|
|
48
|
+
"univer-rotate-0": openIndex === index
|
|
49
|
+
}) }), /* @__PURE__ */ jsx("span", {
|
|
50
|
+
className: "univer-font-medium",
|
|
51
|
+
children: item.label
|
|
52
|
+
})]
|
|
53
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
54
|
+
className: clsx("univer-overflow-hidden univer-transition-[max-height,opacity] univer-duration-500 univer-ease-in-out", {
|
|
55
|
+
"univer-max-h-screen": openIndex === index,
|
|
56
|
+
"univer-max-h-0": openIndex !== index
|
|
57
|
+
}),
|
|
58
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
59
|
+
className: "univer-box-border univer-px-4 univer-py-1.5",
|
|
60
|
+
children: item.children
|
|
61
|
+
})
|
|
62
|
+
})] }, (_item$id = item.id) !== null && _item$id !== void 0 ? _item$id : index);
|
|
63
|
+
})
|
|
56
64
|
});
|
|
57
65
|
}
|
|
58
66
|
|
|
@@ -143,6 +151,7 @@ const buttonVariants = cva$1("univer-box-border univer-inline-flex univer-cursor
|
|
|
143
151
|
ghost: "univer-border-transparent univer-bg-transparent univer-text-gray-900 hover:univer-bg-gray-100 active:univer-bg-gray-200 dark:!univer-text-white dark:hover:!univer-bg-gray-700 dark:active:!univer-bg-gray-600"
|
|
144
152
|
},
|
|
145
153
|
size: {
|
|
154
|
+
icon: "univer-size-8 !univer-p-0",
|
|
146
155
|
small: "univer-h-6 univer-rounded-md univer-px-1.5 univer-text-xs",
|
|
147
156
|
middle: "univer-h-8 univer-rounded-lg univer-px-2 univer-text-sm",
|
|
148
157
|
large: "univer-h-10 univer-rounded-lg univer-px-3 univer-text-sm"
|
|
@@ -167,32 +176,6 @@ const Button = forwardRef(({ className, variant, size, asChild = false, ...props
|
|
|
167
176
|
});
|
|
168
177
|
Button.displayName = "Button";
|
|
169
178
|
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region src/components/button/ButtonGroup.tsx
|
|
172
|
-
const ButtonGroup = ({ className, orientation = "horizontal", children }) => {
|
|
173
|
-
const totalButtons = Children.count(children);
|
|
174
|
-
const isHorizontal = orientation === "horizontal";
|
|
175
|
-
const isVertical = orientation === "vertical";
|
|
176
|
-
return /* @__PURE__ */ jsx("div", {
|
|
177
|
-
className: clsx("univer-grid", {
|
|
178
|
-
"univer-grid-flow-row": isVertical,
|
|
179
|
-
"univer-w-fit": isVertical
|
|
180
|
-
}, className),
|
|
181
|
-
children: Children.map(children, (child, index) => {
|
|
182
|
-
const isFirst = index === 0;
|
|
183
|
-
const isLast = index === totalButtons - 1;
|
|
184
|
-
return cloneElement(child, { className: clsx({
|
|
185
|
-
"!univer-rounded-l-none": isHorizontal && !isFirst,
|
|
186
|
-
"!univer-rounded-r-none": isHorizontal && !isLast,
|
|
187
|
-
"!univer-border-l-0": isHorizontal && !isFirst,
|
|
188
|
-
"!univer-rounded-t-none": isVertical && !isFirst,
|
|
189
|
-
"!univer-rounded-b-none": isVertical && !isLast,
|
|
190
|
-
"!univer-border-t-0": isVertical && !isFirst
|
|
191
|
-
}, child.props.className) });
|
|
192
|
-
})
|
|
193
|
-
});
|
|
194
|
-
};
|
|
195
|
-
|
|
196
179
|
//#endregion
|
|
197
180
|
//#region src/helper/is-browser.ts
|
|
198
181
|
/**
|
|
@@ -239,6 +222,35 @@ function ConfigProvider(props) {
|
|
|
239
222
|
});
|
|
240
223
|
}
|
|
241
224
|
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/components/button/ButtonGroup.tsx
|
|
227
|
+
const ButtonGroup = ({ className, orientation = "horizontal", children }) => {
|
|
228
|
+
const { direction } = useContext(ConfigContext);
|
|
229
|
+
const totalButtons = Children.count(children);
|
|
230
|
+
const isHorizontal = orientation === "horizontal";
|
|
231
|
+
const isVertical = orientation === "vertical";
|
|
232
|
+
const isRtl = direction === "rtl";
|
|
233
|
+
return /* @__PURE__ */ jsx("div", {
|
|
234
|
+
className: clsx("univer-grid", {
|
|
235
|
+
"univer-grid-flow-row": isVertical,
|
|
236
|
+
"univer-w-fit": isVertical
|
|
237
|
+
}, className),
|
|
238
|
+
children: Children.map(children, (child, index) => {
|
|
239
|
+
const isFirst = index === 0;
|
|
240
|
+
const isLast = index === totalButtons - 1;
|
|
241
|
+
return cloneElement(child, { className: clsx({
|
|
242
|
+
"!univer-rounded-l-none": isHorizontal && (isRtl ? !isLast : !isFirst),
|
|
243
|
+
"!univer-rounded-r-none": isHorizontal && (isRtl ? !isFirst : !isLast),
|
|
244
|
+
"!univer-border-l-0": isHorizontal && !isRtl && !isFirst,
|
|
245
|
+
"!univer-border-r-0": isHorizontal && isRtl && !isFirst,
|
|
246
|
+
"!univer-rounded-t-none": isVertical && !isFirst,
|
|
247
|
+
"!univer-rounded-b-none": isVertical && !isLast,
|
|
248
|
+
"!univer-border-t-0": isVertical && !isFirst
|
|
249
|
+
}, child.props.className) });
|
|
250
|
+
})
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
|
|
242
254
|
//#endregion
|
|
243
255
|
//#region src/helper/class-utilities.ts
|
|
244
256
|
/**
|
|
@@ -643,7 +655,7 @@ function DayButton(props) {
|
|
|
643
655
|
}
|
|
644
656
|
function Calendar(props) {
|
|
645
657
|
const { className, max, min, showTime = false, value, onValueChange } = props;
|
|
646
|
-
const { locale } = useContext(ConfigContext);
|
|
658
|
+
const { direction = "ltr", locale } = useContext(ConfigContext);
|
|
647
659
|
const { ariaLabels, year, weekDays, months } = locale === null || locale === void 0 ? void 0 : locale.Calendar;
|
|
648
660
|
const today = /* @__PURE__ */ new Date();
|
|
649
661
|
const [currentYear, setCurrentYear] = useState((value !== null && value !== void 0 ? value : today).getFullYear());
|
|
@@ -739,6 +751,7 @@ function Calendar(props) {
|
|
|
739
751
|
}
|
|
740
752
|
return /* @__PURE__ */ jsxs("div", {
|
|
741
753
|
"data-u-comp": "calendar",
|
|
754
|
+
dir: direction,
|
|
742
755
|
className: clsx("univer-mx-auto univer-max-w-xs univer-select-none univer-rounded univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-white", className),
|
|
743
756
|
children: [
|
|
744
757
|
/* @__PURE__ */ jsxs("nav", {
|
|
@@ -748,7 +761,7 @@ function Calendar(props) {
|
|
|
748
761
|
className: "univer-text-lg univer-text-gray-500 dark:!univer-text-gray-200",
|
|
749
762
|
"aria-label": ariaLabels.previousMonth,
|
|
750
763
|
onClick: prevMonth,
|
|
751
|
-
children: /* @__PURE__ */ jsx(MoreRightIcon, { className: "univer-rotate-180" })
|
|
764
|
+
children: /* @__PURE__ */ jsx(MoreRightIcon, { className: "univer-rotate-180 rtl:!univer-rotate-0" })
|
|
752
765
|
}),
|
|
753
766
|
/* @__PURE__ */ jsxs("span", {
|
|
754
767
|
className: "univer-flex univer-items-center univer-gap-0.5 univer-text-sm univer-font-medium",
|
|
@@ -793,7 +806,7 @@ function Calendar(props) {
|
|
|
793
806
|
className: "univer-text-lg univer-text-gray-500 dark:!univer-text-gray-200",
|
|
794
807
|
"aria-label": ariaLabels.nextMonth,
|
|
795
808
|
onClick: nextMonth,
|
|
796
|
-
children: /* @__PURE__ */ jsx(MoreRightIcon, {})
|
|
809
|
+
children: /* @__PURE__ */ jsx(MoreRightIcon, { className: "rtl:univer-rotate-180" })
|
|
797
810
|
})
|
|
798
811
|
]
|
|
799
812
|
}),
|
|
@@ -978,22 +991,27 @@ const DialogOverlay = forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
978
991
|
...props
|
|
979
992
|
}));
|
|
980
993
|
DialogOverlay.displayName = Overlay.displayName;
|
|
981
|
-
const DialogContent = forwardRef(({ className, children, closable = true, onClickClose, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
className: "univer-
|
|
990
|
-
|
|
994
|
+
const DialogContent = forwardRef(({ className, children, closable = true, onClickClose, mountContainer, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, {
|
|
995
|
+
container: mountContainer !== null && mountContainer !== void 0 ? mountContainer : void 0,
|
|
996
|
+
children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Content$2, {
|
|
997
|
+
ref,
|
|
998
|
+
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-white 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),
|
|
999
|
+
...props,
|
|
1000
|
+
children: [children, closable && /* @__PURE__ */ jsxs(Close, {
|
|
1001
|
+
"data-slot": "close",
|
|
1002
|
+
className: "univer-absolute univer-right-4 univer-top-4 univer-size-6 univer-cursor-pointer univer-rounded-sm univer-border-none univer-bg-transparent univer-p-0 univer-transition-opacity hover:univer-opacity-100 disabled:univer-pointer-events-none rtl:univer-left-4 rtl:univer-right-auto",
|
|
1003
|
+
onClick: onClickClose,
|
|
1004
|
+
children: [/* @__PURE__ */ jsx(CloseIcon, { className: "univer-size-4 univer-text-gray-400" }), /* @__PURE__ */ jsx("span", {
|
|
1005
|
+
className: "univer-sr-only",
|
|
1006
|
+
children: "Close"
|
|
1007
|
+
})]
|
|
991
1008
|
})]
|
|
992
1009
|
})]
|
|
993
|
-
})
|
|
1010
|
+
}));
|
|
994
1011
|
DialogContent.displayName = Content$2.displayName;
|
|
995
1012
|
const DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
996
|
-
|
|
1013
|
+
"data-slot": "dialog-header",
|
|
1014
|
+
className: clsx("univer-flex univer-flex-col univer-space-y-1.5 univer-text-center sm:!univer-text-left sm:rtl:!univer-text-right", className),
|
|
997
1015
|
...props
|
|
998
1016
|
});
|
|
999
1017
|
DialogHeader.displayName = "DialogHeader";
|
|
@@ -1136,7 +1154,7 @@ function useDraggable(options = {}) {
|
|
|
1136
1154
|
function Dialog(props) {
|
|
1137
1155
|
var _locale$Confirm$cance, _locale$Confirm, _locale$Confirm$confi, _locale$Confirm2;
|
|
1138
1156
|
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;
|
|
1139
|
-
const { locale } = useContext(ConfigContext);
|
|
1157
|
+
const { locale, mountContainer, direction } = useContext(ConfigContext);
|
|
1140
1158
|
const { position, isDragging, setElementRef, handleMouseDown } = useDraggable({
|
|
1141
1159
|
defaultPosition,
|
|
1142
1160
|
enabled: draggable
|
|
@@ -1186,6 +1204,8 @@ function Dialog(props) {
|
|
|
1186
1204
|
} : {}
|
|
1187
1205
|
},
|
|
1188
1206
|
closable,
|
|
1207
|
+
mountContainer,
|
|
1208
|
+
dir: direction,
|
|
1189
1209
|
onClickClose: handleClickClose,
|
|
1190
1210
|
onEscapeKeyDown: (e) => {
|
|
1191
1211
|
if (keyboard) handleClickClose();
|
|
@@ -1452,14 +1472,14 @@ function HexInput({ hsv, onChange }) {
|
|
|
1452
1472
|
if (!isValidHex(inputValue)) setInputValue(hexValue.replace(/^#/, ""));
|
|
1453
1473
|
};
|
|
1454
1474
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("input", {
|
|
1455
|
-
className: clsx("univer-w-full univer-px-2 !univer-pl-4 univer-uppercase focus:univer-border-primary-500 focus:univer-outline-none dark:!univer-text-white", borderClassName),
|
|
1475
|
+
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-white", borderClassName),
|
|
1456
1476
|
value: inputValue,
|
|
1457
1477
|
onChange: handleChange,
|
|
1458
1478
|
onBlur: handleBlur,
|
|
1459
1479
|
maxLength: 6,
|
|
1460
1480
|
spellCheck: false
|
|
1461
1481
|
}), /* @__PURE__ */ jsx("span", {
|
|
1462
|
-
className: "univer-absolute univer-left-1.5 univer-top-1/2 -univer-translate-y-1/2 univer-text-sm univer-text-gray-400",
|
|
1482
|
+
className: "univer-absolute univer-left-1.5 univer-top-1/2 -univer-translate-y-1/2 univer-text-sm univer-text-gray-400 rtl:univer-left-auto rtl:univer-right-1.5",
|
|
1463
1483
|
children: "#"
|
|
1464
1484
|
})] });
|
|
1465
1485
|
}
|
|
@@ -1895,7 +1915,7 @@ const MemoizedColorInput = memo(ColorInput);
|
|
|
1895
1915
|
const MemoizedColorPresets = memo(ColorPresets);
|
|
1896
1916
|
function ColorPicker({ format = "hex", value, onChange }) {
|
|
1897
1917
|
if (!isBrowser) return null;
|
|
1898
|
-
const { locale } = useContext(ConfigContext);
|
|
1918
|
+
const { direction, locale } = useContext(ConfigContext);
|
|
1899
1919
|
const [hsv, setHsv] = useState([
|
|
1900
1920
|
0,
|
|
1901
1921
|
100,
|
|
@@ -1964,6 +1984,7 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
1964
1984
|
}
|
|
1965
1985
|
return /* @__PURE__ */ jsxs("div", {
|
|
1966
1986
|
"data-u-comp": "color-picker",
|
|
1987
|
+
dir: direction,
|
|
1967
1988
|
className: "univer-cursor-default univer-space-y-2 univer-rounded-lg",
|
|
1968
1989
|
onClick: (e) => e.stopPropagation(),
|
|
1969
1990
|
children: [
|
|
@@ -1984,7 +2005,7 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
1984
2005
|
})
|
|
1985
2006
|
}),
|
|
1986
2007
|
/* @__PURE__ */ jsx(Dialog, {
|
|
1987
|
-
className: "!univer-w-fit !univer-p-2.5",
|
|
2008
|
+
className: "!univer-z-[1090] !univer-w-fit !univer-p-2.5",
|
|
1988
2009
|
closable: false,
|
|
1989
2010
|
maskClosable: false,
|
|
1990
2011
|
open: visible,
|
|
@@ -2440,11 +2461,11 @@ function Pager(props) {
|
|
|
2440
2461
|
children: hasValue ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2441
2462
|
/* @__PURE__ */ jsx("button", {
|
|
2442
2463
|
"data-u-comp": "pager-left-arrow",
|
|
2443
|
-
className: "univer-inline-flex univer-size-4 univer-cursor-pointer univer-items-center univer-rounded univer-border-none univer-bg-transparent univer-p-0 hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-600",
|
|
2464
|
+
className: "univer-inline-flex univer-size-4 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 dark:hover:!univer-bg-gray-600",
|
|
2444
2465
|
type: "button",
|
|
2445
2466
|
role: "button",
|
|
2446
2467
|
onClick: onClickLeftArrow,
|
|
2447
|
-
children: /* @__PURE__ */ jsx(MoreLeftIcon, {})
|
|
2468
|
+
children: /* @__PURE__ */ jsx(MoreLeftIcon, { className: "rtl:univer-rotate-180" })
|
|
2448
2469
|
}),
|
|
2449
2470
|
/* @__PURE__ */ jsx("span", {
|
|
2450
2471
|
className: "univer-mx-1",
|
|
@@ -2452,11 +2473,11 @@ function Pager(props) {
|
|
|
2452
2473
|
}),
|
|
2453
2474
|
/* @__PURE__ */ jsx("button", {
|
|
2454
2475
|
"data-u-comp": "pager-right-arrow",
|
|
2455
|
-
className: "univer-inline-flex univer-size-4 univer-cursor-pointer univer-items-center univer-rounded univer-border-none univer-bg-transparent univer-p-0 hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-600",
|
|
2476
|
+
className: "univer-inline-flex univer-size-4 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 dark:hover:!univer-bg-gray-600",
|
|
2456
2477
|
type: "button",
|
|
2457
2478
|
role: "button",
|
|
2458
2479
|
onClick: onClickRightArrow,
|
|
2459
|
-
children: /* @__PURE__ */ jsx(MoreRightIcon, {})
|
|
2480
|
+
children: /* @__PURE__ */ jsx(MoreRightIcon, { className: "rtl:univer-rotate-180" })
|
|
2460
2481
|
})
|
|
2461
2482
|
] }) : /* @__PURE__ */ jsx("div", {
|
|
2462
2483
|
className: "univer-mx-1",
|
|
@@ -2495,6 +2516,7 @@ function Gallery(props) {
|
|
|
2495
2516
|
const { direction } = useContext(ConfigContext);
|
|
2496
2517
|
const dialogRef = useRef(null);
|
|
2497
2518
|
const activeImage = useMemo(() => images[activeImageIndex], [activeImageIndex, images]);
|
|
2519
|
+
const hasPagination = images.length > 1;
|
|
2498
2520
|
useEffect(() => {
|
|
2499
2521
|
if (open && dialogRef.current) dialogRef.current.focus();
|
|
2500
2522
|
}, [open]);
|
|
@@ -2569,7 +2591,7 @@ function Gallery(props) {
|
|
|
2569
2591
|
/* @__PURE__ */ jsxs("footer", {
|
|
2570
2592
|
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",
|
|
2571
2593
|
children: [
|
|
2572
|
-
/* @__PURE__ */ jsx(Pager, {
|
|
2594
|
+
hasPagination && /* @__PURE__ */ jsx(Pager, {
|
|
2573
2595
|
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",
|
|
2574
2596
|
value: activeImageIndex + 1,
|
|
2575
2597
|
total: images.length,
|
|
@@ -2614,6 +2636,7 @@ const inputVariants = cva$1("univer-box-border univer-w-full univer-rounded-md u
|
|
|
2614
2636
|
defaultVariants: { size: "small" }
|
|
2615
2637
|
});
|
|
2616
2638
|
const Input = forwardRef(({ autoFocus = false, className, style, type = "text", placeholder, value, size = "small", allowClear = false, disabled = false, onClick, onKeyDown, onChange, onFocus, onBlur, slot, inputClass, inputStyle, ...props }, ref) => {
|
|
2639
|
+
const { direction } = useContext(ConfigContext);
|
|
2617
2640
|
const handleClear = (e) => {
|
|
2618
2641
|
e.stopPropagation();
|
|
2619
2642
|
onChange === null || onChange === void 0 || onChange("");
|
|
@@ -2648,6 +2671,13 @@ const Input = forwardRef(({ autoFocus = false, className, style, type = "text",
|
|
|
2648
2671
|
useEffect(() => {
|
|
2649
2672
|
if (allowClear && !(slot && slotRef.current)) setPaddingRight(26);
|
|
2650
2673
|
}, []);
|
|
2674
|
+
const mergedInputStyle = direction === "rtl" && paddingRight === 0 ? inputStyle : direction === "rtl" ? {
|
|
2675
|
+
...inputStyle,
|
|
2676
|
+
paddingLeft: paddingRight
|
|
2677
|
+
} : {
|
|
2678
|
+
...inputStyle,
|
|
2679
|
+
paddingRight
|
|
2680
|
+
};
|
|
2651
2681
|
return /* @__PURE__ */ jsxs("div", {
|
|
2652
2682
|
"data-u-comp": "input",
|
|
2653
2683
|
className: clsx("univer-relative univer-inline-flex univer-w-full univer-items-center univer-rounded-md", disabled && "univer-cursor-not-allowed", className),
|
|
@@ -2655,7 +2685,7 @@ const Input = forwardRef(({ autoFocus = false, className, style, type = "text",
|
|
|
2655
2685
|
children: [/* @__PURE__ */ jsx("input", {
|
|
2656
2686
|
ref,
|
|
2657
2687
|
type,
|
|
2658
|
-
className: clsx(inputVariants({ size }), borderClassName, disabled && "univer-cursor-not-allowed univer-bg-gray-50 univer-text-gray-400 dark:!univer-text-gray-500", allowClear && !slot && "univer-pr-8", inputClass),
|
|
2688
|
+
className: clsx(inputVariants({ size }), borderClassName, disabled && "univer-cursor-not-allowed univer-bg-gray-50 univer-text-gray-400 dark:!univer-text-gray-500", allowClear && !slot && (direction === "rtl" ? "univer-pl-8" : "univer-pr-8"), inputClass),
|
|
2659
2689
|
placeholder,
|
|
2660
2690
|
value,
|
|
2661
2691
|
disabled,
|
|
@@ -2665,13 +2695,10 @@ const Input = forwardRef(({ autoFocus = false, className, style, type = "text",
|
|
|
2665
2695
|
onChange: handleChange,
|
|
2666
2696
|
onFocus,
|
|
2667
2697
|
onBlur,
|
|
2668
|
-
style:
|
|
2669
|
-
...inputStyle,
|
|
2670
|
-
paddingRight
|
|
2671
|
-
},
|
|
2698
|
+
style: mergedInputStyle,
|
|
2672
2699
|
...props
|
|
2673
2700
|
}), hasSlotContent && /* @__PURE__ */ jsxs("div", {
|
|
2674
|
-
className: "univer-absolute univer-
|
|
2701
|
+
className: clsx("univer-absolute univer-flex univer-items-center univer-gap-1 univer-rounded-full", direction === "rtl" ? "univer-left-2" : "univer-right-2"),
|
|
2675
2702
|
ref: slotRef,
|
|
2676
2703
|
children: [slot, allowClear && value && !disabled && /* @__PURE__ */ jsx("button", {
|
|
2677
2704
|
type: "button",
|
|
@@ -2869,7 +2896,9 @@ const InputNumber = forwardRef(({ value, defaultValue, size = "small", min = Num
|
|
|
2869
2896
|
|
|
2870
2897
|
//#endregion
|
|
2871
2898
|
//#region src/components/segmented/Segmented.tsx
|
|
2899
|
+
const SEGMENTED_PADDING = 4;
|
|
2872
2900
|
function Segmented({ items, value, defaultValue, onChange, className = "" }) {
|
|
2901
|
+
const { direction } = useContext(ConfigContext);
|
|
2873
2902
|
const [selectedItem, setSelectedItem] = useState(value !== void 0 ? value : defaultValue || items[0].value);
|
|
2874
2903
|
const [slideStyle, setSlideStyle] = useState({});
|
|
2875
2904
|
const itemRefs = useRef(/* @__PURE__ */ new Map());
|
|
@@ -2883,14 +2912,16 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
|
|
|
2883
2912
|
if (newItemElement && containerRef.current) {
|
|
2884
2913
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
2885
2914
|
const newRect = newItemElement.getBoundingClientRect();
|
|
2886
|
-
const newLeft = newRect.left - containerRect.left -
|
|
2915
|
+
const newLeft = newRect.left - containerRect.left - SEGMENTED_PADDING;
|
|
2887
2916
|
if (oldItemElement) setSlideStyle({
|
|
2888
|
-
"--slide-from": `${oldItemElement.getBoundingClientRect().left - containerRect.left -
|
|
2917
|
+
"--slide-from": `${oldItemElement.getBoundingClientRect().left - containerRect.left - SEGMENTED_PADDING}px`,
|
|
2889
2918
|
"--slide-to": `${newLeft}px`,
|
|
2919
|
+
left: `${SEGMENTED_PADDING}px`,
|
|
2890
2920
|
width: `${newRect.width}px`,
|
|
2891
2921
|
transform: `translateX(${newLeft}px)`
|
|
2892
2922
|
});
|
|
2893
2923
|
else setSlideStyle({
|
|
2924
|
+
left: `${SEGMENTED_PADDING}px`,
|
|
2894
2925
|
width: `${newRect.width}px`,
|
|
2895
2926
|
transform: `translateX(${newLeft}px)`
|
|
2896
2927
|
});
|
|
@@ -2898,7 +2929,7 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
|
|
|
2898
2929
|
};
|
|
2899
2930
|
useEffect(() => {
|
|
2900
2931
|
updateSliderPosition(selectedItem);
|
|
2901
|
-
}, [selectedItem]);
|
|
2932
|
+
}, [direction, selectedItem]);
|
|
2902
2933
|
const handleClick = (itemValue) => {
|
|
2903
2934
|
const oldValue = selectedItem;
|
|
2904
2935
|
setSelectedItem(itemValue);
|
|
@@ -2907,6 +2938,7 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
|
|
|
2907
2938
|
};
|
|
2908
2939
|
return /* @__PURE__ */ jsxs("div", {
|
|
2909
2940
|
"data-u-comp": "segmented",
|
|
2941
|
+
dir: direction,
|
|
2910
2942
|
ref: containerRef,
|
|
2911
2943
|
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),
|
|
2912
2944
|
children: [/* @__PURE__ */ jsx("div", {
|
|
@@ -4373,7 +4405,7 @@ function Tree(props) {
|
|
|
4373
4405
|
e.stopPropagation();
|
|
4374
4406
|
handleExpendItem(treeItem);
|
|
4375
4407
|
},
|
|
4376
|
-
children: /* @__PURE__ */ jsx(
|
|
4408
|
+
children: /* @__PURE__ */ jsx(DownIcon, {})
|
|
4377
4409
|
}),
|
|
4378
4410
|
/* @__PURE__ */ jsx(Checkbox, {
|
|
4379
4411
|
checked: selected && !intermediated,
|
|
@@ -4479,4 +4511,4 @@ function resizeObserverCtor(callback) {
|
|
|
4479
4511
|
}
|
|
4480
4512
|
|
|
4481
4513
|
//#endregion
|
|
4482
|
-
export { Accordion, Avatar, Badge, Button, ButtonGroup, Calendar, CascaderList, Checkbox, CheckboxGroup, ColorPicker, ColorPresets, ConfigContext, ConfigProvider, Confirm, DatePicker, DateRangePicker, Dialog, DraggableList, Dropdown, DropdownMenu, FormDualColumnLayout, FormLayout, Gallery, GradientColorPicker, HoverCard, Input, InputNumber, KBD, MessageType, Messager, MultipleSelect, Pager, Panel, PanelField, PanelSection, Popup, Radio, RadioGroup, Segmented, Select, SelectList, Separator, Switch, Textarea, TimeInput, Toaster, Tooltip, Tree, TreeSelectionMode, borderBottomClassName, borderClassName, borderLeftBottomClassName, borderLeftClassName, borderRightClassName, borderTopClassName, clsx, cva, divideXClassName, divideYClassName, filterLeafNode, findNodePathFromTree, findSubTreeFromPath, isBrowser, mergeTreeSelected, message, removeMessage, render, resetButtonClassName, resizeObserverCtor, scrollbarClassName, toast, unmount };
|
|
4514
|
+
export { Accordion, Avatar, Badge, Button, ButtonGroup, Calendar, CascaderList, Checkbox, CheckboxGroup, ColorPicker, ColorPresets, ConfigContext, ConfigProvider, Confirm, DatePicker, DateRangePicker, Dialog, DraggableList, Dropdown, DropdownMenu, FormDualColumnLayout, FormLayout, Gallery, GradientColorPicker, HoverCard, Input, InputNumber, KBD, MessageType, Messager, MultipleSelect, Pager, Panel, PanelField, PanelSection, Popup, Radio, RadioGroup, Segmented, Select, SelectList, Separator, Switch, Textarea, TimeInput, Toaster, Tooltip, Tree, TreeSelectionMode, borderBottomClassName, borderClassName, borderLeftBottomClassName, borderLeftClassName, borderRightClassName, borderTopClassName, clsx, cva, divideXClassName, divideYClassName, filterLeafNode, findNodePathFromTree, findSubTreeFromPath, isBrowser, mergeTreeSelected, message, removeMessage, render, resetButtonClassName, resizeObserverCtor, scrollbarClassName, selectClassName, toast, unmount };
|
package/lib/es/locale/ar-SA.js
CHANGED
package/lib/es/locale/ca-ES.js
CHANGED
package/lib/es/locale/de-DE.js
CHANGED
package/lib/es/locale/es-ES.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
//#region src/locale/es-ES.ts
|
|
2
2
|
const locale = { design: {
|
|
3
3
|
Confirm: {
|
|
4
|
-
cancel: "
|
|
5
|
-
confirm: "
|
|
4
|
+
cancel: "Cancelar",
|
|
5
|
+
confirm: "Aceptar"
|
|
6
6
|
},
|
|
7
7
|
CascaderList: { empty: "Cap" },
|
|
8
8
|
Calendar: {
|
|
@@ -39,20 +39,20 @@ const locale = { design: {
|
|
|
39
39
|
},
|
|
40
40
|
Select: { empty: "Cap" },
|
|
41
41
|
ColorPicker: {
|
|
42
|
-
more: "
|
|
43
|
-
cancel: "
|
|
44
|
-
confirm: "
|
|
42
|
+
more: "Más colores",
|
|
43
|
+
cancel: "Cancelar",
|
|
44
|
+
confirm: "Aceptar"
|
|
45
45
|
},
|
|
46
46
|
GradientColorPicker: {
|
|
47
47
|
linear: "Lineal",
|
|
48
48
|
radial: "Radial",
|
|
49
49
|
angular: "Angular",
|
|
50
|
-
diamond: "
|
|
51
|
-
offset: "
|
|
52
|
-
angle: "
|
|
53
|
-
flip: "
|
|
50
|
+
diamond: "Diamante",
|
|
51
|
+
offset: "Desplazamiento",
|
|
52
|
+
angle: "Ángulo",
|
|
53
|
+
flip: "Invertir",
|
|
54
54
|
delete: "Eliminar",
|
|
55
|
-
transparency: "
|
|
55
|
+
transparency: "Transparencia"
|
|
56
56
|
}
|
|
57
57
|
} };
|
|
58
58
|
|
package/lib/es/locale/fa-IR.js
CHANGED
package/lib/es/locale/fr-FR.js
CHANGED
package/lib/es/locale/id-ID.js
CHANGED
package/lib/es/locale/it-IT.js
CHANGED
package/lib/es/locale/ja-JP.js
CHANGED
package/lib/es/locale/ko-KR.js
CHANGED
package/lib/es/locale/pl-PL.js
CHANGED
package/lib/es/locale/pt-BR.js
CHANGED
package/lib/es/locale/ru-RU.js
CHANGED
package/lib/es/locale/sk-SK.js
CHANGED