@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/cjs/index.js
CHANGED
|
@@ -18,42 +18,50 @@ let _radix_ui_react_separator = require("@radix-ui/react-separator");
|
|
|
18
18
|
let react_dom_client = require("react-dom/client");
|
|
19
19
|
|
|
20
20
|
//#region src/helper/clsx.ts
|
|
21
|
+
const twMerge = (0, tailwind_merge.extendTailwindMerge)({ prefix: "univer-" });
|
|
21
22
|
function clsx$1(...inputs) {
|
|
22
|
-
return
|
|
23
|
+
return twMerge((0, clsx.clsx)(inputs));
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
//#endregion
|
|
26
27
|
//#region src/components/accordion/Accordion.tsx
|
|
27
28
|
function Accordion(props) {
|
|
28
|
-
|
|
29
|
-
const
|
|
29
|
+
var _props$openIndex;
|
|
30
|
+
const { className, defaultOpenIndex = null, items, onOpenIndexChange } = props;
|
|
31
|
+
const [innerOpenIndex, setInnerOpenIndex] = (0, react.useState)(defaultOpenIndex);
|
|
32
|
+
const openIndex = (_props$openIndex = props.openIndex) !== null && _props$openIndex !== void 0 ? _props$openIndex : innerOpenIndex;
|
|
30
33
|
const toggleItem = (index) => {
|
|
31
|
-
|
|
34
|
+
const nextOpenIndex = openIndex === index ? null : index;
|
|
35
|
+
if (props.openIndex === void 0) setInnerOpenIndex(nextOpenIndex);
|
|
36
|
+
onOpenIndexChange === null || onOpenIndexChange === void 0 || onOpenIndexChange(nextOpenIndex);
|
|
32
37
|
};
|
|
33
38
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
34
39
|
"data-u-comp": "accordion",
|
|
35
40
|
className: clsx$1("univer-divide-x-0 univer-divide-y univer-divide-solid univer-divide-gray-200 dark:!univer-divide-gray-600", className),
|
|
36
|
-
children: items.map((item, index) =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"univer-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"univer-max-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
children:
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
children: items.map((item, index) => {
|
|
42
|
+
var _item$id;
|
|
43
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
44
|
+
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",
|
|
45
|
+
type: "button",
|
|
46
|
+
onClick: () => toggleItem(index),
|
|
47
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: clsx$1("univer-size-2.5 univer-flex-shrink-0 univer-transition-transform", {
|
|
48
|
+
"-univer-rotate-90": openIndex !== index,
|
|
49
|
+
"univer-rotate-0": openIndex === index
|
|
50
|
+
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
51
|
+
className: "univer-font-medium",
|
|
52
|
+
children: item.label
|
|
53
|
+
})]
|
|
54
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
55
|
+
className: clsx$1("univer-overflow-hidden univer-transition-[max-height,opacity] univer-duration-500 univer-ease-in-out", {
|
|
56
|
+
"univer-max-h-screen": openIndex === index,
|
|
57
|
+
"univer-max-h-0": openIndex !== index
|
|
58
|
+
}),
|
|
59
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
60
|
+
className: "univer-box-border univer-px-4 univer-py-1.5",
|
|
61
|
+
children: item.children
|
|
62
|
+
})
|
|
63
|
+
})] }, (_item$id = item.id) !== null && _item$id !== void 0 ? _item$id : index);
|
|
64
|
+
})
|
|
57
65
|
});
|
|
58
66
|
}
|
|
59
67
|
|
|
@@ -144,6 +152,7 @@ const buttonVariants = (0, class_variance_authority.cva)("univer-box-border univ
|
|
|
144
152
|
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"
|
|
145
153
|
},
|
|
146
154
|
size: {
|
|
155
|
+
icon: "univer-size-8 !univer-p-0",
|
|
147
156
|
small: "univer-h-6 univer-rounded-md univer-px-1.5 univer-text-xs",
|
|
148
157
|
middle: "univer-h-8 univer-rounded-lg univer-px-2 univer-text-sm",
|
|
149
158
|
large: "univer-h-10 univer-rounded-lg univer-px-3 univer-text-sm"
|
|
@@ -168,32 +177,6 @@ const Button = (0, react.forwardRef)(({ className, variant, size, asChild = fals
|
|
|
168
177
|
});
|
|
169
178
|
Button.displayName = "Button";
|
|
170
179
|
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region src/components/button/ButtonGroup.tsx
|
|
173
|
-
const ButtonGroup = ({ className, orientation = "horizontal", children }) => {
|
|
174
|
-
const totalButtons = react.Children.count(children);
|
|
175
|
-
const isHorizontal = orientation === "horizontal";
|
|
176
|
-
const isVertical = orientation === "vertical";
|
|
177
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
178
|
-
className: clsx$1("univer-grid", {
|
|
179
|
-
"univer-grid-flow-row": isVertical,
|
|
180
|
-
"univer-w-fit": isVertical
|
|
181
|
-
}, className),
|
|
182
|
-
children: react.Children.map(children, (child, index) => {
|
|
183
|
-
const isFirst = index === 0;
|
|
184
|
-
const isLast = index === totalButtons - 1;
|
|
185
|
-
return (0, react.cloneElement)(child, { className: clsx$1({
|
|
186
|
-
"!univer-rounded-l-none": isHorizontal && !isFirst,
|
|
187
|
-
"!univer-rounded-r-none": isHorizontal && !isLast,
|
|
188
|
-
"!univer-border-l-0": isHorizontal && !isFirst,
|
|
189
|
-
"!univer-rounded-t-none": isVertical && !isFirst,
|
|
190
|
-
"!univer-rounded-b-none": isVertical && !isLast,
|
|
191
|
-
"!univer-border-t-0": isVertical && !isFirst
|
|
192
|
-
}, child.props.className) });
|
|
193
|
-
})
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
|
|
197
180
|
//#endregion
|
|
198
181
|
//#region src/helper/is-browser.ts
|
|
199
182
|
/**
|
|
@@ -240,6 +223,35 @@ function ConfigProvider(props) {
|
|
|
240
223
|
});
|
|
241
224
|
}
|
|
242
225
|
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/components/button/ButtonGroup.tsx
|
|
228
|
+
const ButtonGroup = ({ className, orientation = "horizontal", children }) => {
|
|
229
|
+
const { direction } = (0, react.useContext)(ConfigContext);
|
|
230
|
+
const totalButtons = react.Children.count(children);
|
|
231
|
+
const isHorizontal = orientation === "horizontal";
|
|
232
|
+
const isVertical = orientation === "vertical";
|
|
233
|
+
const isRtl = direction === "rtl";
|
|
234
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
235
|
+
className: clsx$1("univer-grid", {
|
|
236
|
+
"univer-grid-flow-row": isVertical,
|
|
237
|
+
"univer-w-fit": isVertical
|
|
238
|
+
}, className),
|
|
239
|
+
children: react.Children.map(children, (child, index) => {
|
|
240
|
+
const isFirst = index === 0;
|
|
241
|
+
const isLast = index === totalButtons - 1;
|
|
242
|
+
return (0, react.cloneElement)(child, { className: clsx$1({
|
|
243
|
+
"!univer-rounded-l-none": isHorizontal && (isRtl ? !isLast : !isFirst),
|
|
244
|
+
"!univer-rounded-r-none": isHorizontal && (isRtl ? !isFirst : !isLast),
|
|
245
|
+
"!univer-border-l-0": isHorizontal && !isRtl && !isFirst,
|
|
246
|
+
"!univer-border-r-0": isHorizontal && isRtl && !isFirst,
|
|
247
|
+
"!univer-rounded-t-none": isVertical && !isFirst,
|
|
248
|
+
"!univer-rounded-b-none": isVertical && !isLast,
|
|
249
|
+
"!univer-border-t-0": isVertical && !isFirst
|
|
250
|
+
}, child.props.className) });
|
|
251
|
+
})
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
|
|
243
255
|
//#endregion
|
|
244
256
|
//#region src/helper/class-utilities.ts
|
|
245
257
|
/**
|
|
@@ -644,7 +656,7 @@ function DayButton(props) {
|
|
|
644
656
|
}
|
|
645
657
|
function Calendar(props) {
|
|
646
658
|
const { className, max, min, showTime = false, value, onValueChange } = props;
|
|
647
|
-
const { locale } = (0, react.useContext)(ConfigContext);
|
|
659
|
+
const { direction = "ltr", locale } = (0, react.useContext)(ConfigContext);
|
|
648
660
|
const { ariaLabels, year, weekDays, months } = locale === null || locale === void 0 ? void 0 : locale.Calendar;
|
|
649
661
|
const today = /* @__PURE__ */ new Date();
|
|
650
662
|
const [currentYear, setCurrentYear] = (0, react.useState)((value !== null && value !== void 0 ? value : today).getFullYear());
|
|
@@ -740,6 +752,7 @@ function Calendar(props) {
|
|
|
740
752
|
}
|
|
741
753
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
742
754
|
"data-u-comp": "calendar",
|
|
755
|
+
dir: direction,
|
|
743
756
|
className: clsx$1("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),
|
|
744
757
|
children: [
|
|
745
758
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("nav", {
|
|
@@ -749,7 +762,7 @@ function Calendar(props) {
|
|
|
749
762
|
className: "univer-text-lg univer-text-gray-500 dark:!univer-text-gray-200",
|
|
750
763
|
"aria-label": ariaLabels.previousMonth,
|
|
751
764
|
onClick: prevMonth,
|
|
752
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, { className: "univer-rotate-180" })
|
|
765
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, { className: "univer-rotate-180 rtl:!univer-rotate-0" })
|
|
753
766
|
}),
|
|
754
767
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
755
768
|
className: "univer-flex univer-items-center univer-gap-0.5 univer-text-sm univer-font-medium",
|
|
@@ -794,7 +807,7 @@ function Calendar(props) {
|
|
|
794
807
|
className: "univer-text-lg univer-text-gray-500 dark:!univer-text-gray-200",
|
|
795
808
|
"aria-label": ariaLabels.nextMonth,
|
|
796
809
|
onClick: nextMonth,
|
|
797
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, {})
|
|
810
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, { className: "rtl:univer-rotate-180" })
|
|
798
811
|
})
|
|
799
812
|
]
|
|
800
813
|
}),
|
|
@@ -979,22 +992,27 @@ const DialogOverlay = (0, react.forwardRef)(({ className, ...props }, ref) => /*
|
|
|
979
992
|
...props
|
|
980
993
|
}));
|
|
981
994
|
DialogOverlay.displayName = _radix_ui_react_dialog.Overlay.displayName;
|
|
982
|
-
const DialogContent = (0, react.forwardRef)(({ className, children, closable = true, onClickClose, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogPortal, {
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
className: "univer-
|
|
991
|
-
|
|
995
|
+
const DialogContent = (0, react.forwardRef)(({ className, children, closable = true, onClickClose, mountContainer, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogPortal, {
|
|
996
|
+
container: mountContainer !== null && mountContainer !== void 0 ? mountContainer : void 0,
|
|
997
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogOverlay, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dialog.Content, {
|
|
998
|
+
ref,
|
|
999
|
+
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-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),
|
|
1000
|
+
...props,
|
|
1001
|
+
children: [children, closable && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dialog.Close, {
|
|
1002
|
+
"data-slot": "close",
|
|
1003
|
+
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",
|
|
1004
|
+
onClick: onClickClose,
|
|
1005
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CloseIcon, { className: "univer-size-4 univer-text-gray-400" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1006
|
+
className: "univer-sr-only",
|
|
1007
|
+
children: "Close"
|
|
1008
|
+
})]
|
|
992
1009
|
})]
|
|
993
1010
|
})]
|
|
994
|
-
})
|
|
1011
|
+
}));
|
|
995
1012
|
DialogContent.displayName = _radix_ui_react_dialog.Content.displayName;
|
|
996
1013
|
const DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
997
|
-
|
|
1014
|
+
"data-slot": "dialog-header",
|
|
1015
|
+
className: clsx$1("univer-flex univer-flex-col univer-space-y-1.5 univer-text-center sm:!univer-text-left sm:rtl:!univer-text-right", className),
|
|
998
1016
|
...props
|
|
999
1017
|
});
|
|
1000
1018
|
DialogHeader.displayName = "DialogHeader";
|
|
@@ -1137,7 +1155,7 @@ function useDraggable(options = {}) {
|
|
|
1137
1155
|
function Dialog(props) {
|
|
1138
1156
|
var _locale$Confirm$cance, _locale$Confirm, _locale$Confirm$confi, _locale$Confirm2;
|
|
1139
1157
|
const { className, children, style, open = false, title, width, draggable = false, defaultPosition, footer: propFooter, mask = true, keyboard = true, closable = true, maskClosable = true, showOk, showCancel, onOpenChange, onClose, onOk, onCancel } = props;
|
|
1140
|
-
const { locale } = (0, react.useContext)(ConfigContext);
|
|
1158
|
+
const { locale, mountContainer, direction } = (0, react.useContext)(ConfigContext);
|
|
1141
1159
|
const { position, isDragging, setElementRef, handleMouseDown } = useDraggable({
|
|
1142
1160
|
defaultPosition,
|
|
1143
1161
|
enabled: draggable
|
|
@@ -1187,6 +1205,8 @@ function Dialog(props) {
|
|
|
1187
1205
|
} : {}
|
|
1188
1206
|
},
|
|
1189
1207
|
closable,
|
|
1208
|
+
mountContainer,
|
|
1209
|
+
dir: direction,
|
|
1190
1210
|
onClickClose: handleClickClose,
|
|
1191
1211
|
onEscapeKeyDown: (e) => {
|
|
1192
1212
|
if (keyboard) handleClickClose();
|
|
@@ -1453,14 +1473,14 @@ function HexInput({ hsv, onChange }) {
|
|
|
1453
1473
|
if (!isValidHex(inputValue)) setInputValue(hexValue.replace(/^#/, ""));
|
|
1454
1474
|
};
|
|
1455
1475
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1456
|
-
className: clsx$1("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),
|
|
1476
|
+
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-white", borderClassName),
|
|
1457
1477
|
value: inputValue,
|
|
1458
1478
|
onChange: handleChange,
|
|
1459
1479
|
onBlur: handleBlur,
|
|
1460
1480
|
maxLength: 6,
|
|
1461
1481
|
spellCheck: false
|
|
1462
1482
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1463
|
-
className: "univer-absolute univer-left-1.5 univer-top-1/2 -univer-translate-y-1/2 univer-text-sm univer-text-gray-400",
|
|
1483
|
+
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",
|
|
1464
1484
|
children: "#"
|
|
1465
1485
|
})] });
|
|
1466
1486
|
}
|
|
@@ -1896,7 +1916,7 @@ const MemoizedColorInput = (0, react.memo)(ColorInput);
|
|
|
1896
1916
|
const MemoizedColorPresets = (0, react.memo)(ColorPresets);
|
|
1897
1917
|
function ColorPicker({ format = "hex", value, onChange }) {
|
|
1898
1918
|
if (!isBrowser) return null;
|
|
1899
|
-
const { locale } = (0, react.useContext)(ConfigContext);
|
|
1919
|
+
const { direction, locale } = (0, react.useContext)(ConfigContext);
|
|
1900
1920
|
const [hsv, setHsv] = (0, react.useState)([
|
|
1901
1921
|
0,
|
|
1902
1922
|
100,
|
|
@@ -1965,6 +1985,7 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
1965
1985
|
}
|
|
1966
1986
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1967
1987
|
"data-u-comp": "color-picker",
|
|
1988
|
+
dir: direction,
|
|
1968
1989
|
className: "univer-cursor-default univer-space-y-2 univer-rounded-lg",
|
|
1969
1990
|
onClick: (e) => e.stopPropagation(),
|
|
1970
1991
|
children: [
|
|
@@ -1985,7 +2006,7 @@ function ColorPicker({ format = "hex", value, onChange }) {
|
|
|
1985
2006
|
})
|
|
1986
2007
|
}),
|
|
1987
2008
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dialog, {
|
|
1988
|
-
className: "!univer-w-fit !univer-p-2.5",
|
|
2009
|
+
className: "!univer-z-[1090] !univer-w-fit !univer-p-2.5",
|
|
1989
2010
|
closable: false,
|
|
1990
2011
|
maskClosable: false,
|
|
1991
2012
|
open: visible,
|
|
@@ -2441,11 +2462,11 @@ function Pager(props) {
|
|
|
2441
2462
|
children: hasValue ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
2442
2463
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2443
2464
|
"data-u-comp": "pager-left-arrow",
|
|
2444
|
-
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",
|
|
2465
|
+
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",
|
|
2445
2466
|
type: "button",
|
|
2446
2467
|
role: "button",
|
|
2447
2468
|
onClick: onClickLeftArrow,
|
|
2448
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreLeftIcon, {})
|
|
2469
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreLeftIcon, { className: "rtl:univer-rotate-180" })
|
|
2449
2470
|
}),
|
|
2450
2471
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2451
2472
|
className: "univer-mx-1",
|
|
@@ -2453,11 +2474,11 @@ function Pager(props) {
|
|
|
2453
2474
|
}),
|
|
2454
2475
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2455
2476
|
"data-u-comp": "pager-right-arrow",
|
|
2456
|
-
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",
|
|
2477
|
+
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",
|
|
2457
2478
|
type: "button",
|
|
2458
2479
|
role: "button",
|
|
2459
2480
|
onClick: onClickRightArrow,
|
|
2460
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, {})
|
|
2481
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, { className: "rtl:univer-rotate-180" })
|
|
2461
2482
|
})
|
|
2462
2483
|
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2463
2484
|
className: "univer-mx-1",
|
|
@@ -2496,6 +2517,7 @@ function Gallery(props) {
|
|
|
2496
2517
|
const { direction } = (0, react.useContext)(ConfigContext);
|
|
2497
2518
|
const dialogRef = (0, react.useRef)(null);
|
|
2498
2519
|
const activeImage = (0, react.useMemo)(() => images[activeImageIndex], [activeImageIndex, images]);
|
|
2520
|
+
const hasPagination = images.length > 1;
|
|
2499
2521
|
(0, react.useEffect)(() => {
|
|
2500
2522
|
if (open && dialogRef.current) dialogRef.current.focus();
|
|
2501
2523
|
}, [open]);
|
|
@@ -2570,7 +2592,7 @@ function Gallery(props) {
|
|
|
2570
2592
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
2571
2593
|
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",
|
|
2572
2594
|
children: [
|
|
2573
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pager, {
|
|
2595
|
+
hasPagination && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pager, {
|
|
2574
2596
|
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",
|
|
2575
2597
|
value: activeImageIndex + 1,
|
|
2576
2598
|
total: images.length,
|
|
@@ -2615,6 +2637,7 @@ const inputVariants = (0, class_variance_authority.cva)("univer-box-border unive
|
|
|
2615
2637
|
defaultVariants: { size: "small" }
|
|
2616
2638
|
});
|
|
2617
2639
|
const Input = (0, react.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) => {
|
|
2640
|
+
const { direction } = (0, react.useContext)(ConfigContext);
|
|
2618
2641
|
const handleClear = (e) => {
|
|
2619
2642
|
e.stopPropagation();
|
|
2620
2643
|
onChange === null || onChange === void 0 || onChange("");
|
|
@@ -2649,6 +2672,13 @@ const Input = (0, react.forwardRef)(({ autoFocus = false, className, style, type
|
|
|
2649
2672
|
(0, react.useEffect)(() => {
|
|
2650
2673
|
if (allowClear && !(slot && slotRef.current)) setPaddingRight(26);
|
|
2651
2674
|
}, []);
|
|
2675
|
+
const mergedInputStyle = direction === "rtl" && paddingRight === 0 ? inputStyle : direction === "rtl" ? {
|
|
2676
|
+
...inputStyle,
|
|
2677
|
+
paddingLeft: paddingRight
|
|
2678
|
+
} : {
|
|
2679
|
+
...inputStyle,
|
|
2680
|
+
paddingRight
|
|
2681
|
+
};
|
|
2652
2682
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2653
2683
|
"data-u-comp": "input",
|
|
2654
2684
|
className: clsx$1("univer-relative univer-inline-flex univer-w-full univer-items-center univer-rounded-md", disabled && "univer-cursor-not-allowed", className),
|
|
@@ -2656,7 +2686,7 @@ const Input = (0, react.forwardRef)(({ autoFocus = false, className, style, type
|
|
|
2656
2686
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2657
2687
|
ref,
|
|
2658
2688
|
type,
|
|
2659
|
-
className: clsx$1(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),
|
|
2689
|
+
className: clsx$1(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),
|
|
2660
2690
|
placeholder,
|
|
2661
2691
|
value,
|
|
2662
2692
|
disabled,
|
|
@@ -2666,13 +2696,10 @@ const Input = (0, react.forwardRef)(({ autoFocus = false, className, style, type
|
|
|
2666
2696
|
onChange: handleChange,
|
|
2667
2697
|
onFocus,
|
|
2668
2698
|
onBlur,
|
|
2669
|
-
style:
|
|
2670
|
-
...inputStyle,
|
|
2671
|
-
paddingRight
|
|
2672
|
-
},
|
|
2699
|
+
style: mergedInputStyle,
|
|
2673
2700
|
...props
|
|
2674
2701
|
}), hasSlotContent && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2675
|
-
className: "univer-absolute univer-
|
|
2702
|
+
className: clsx$1("univer-absolute univer-flex univer-items-center univer-gap-1 univer-rounded-full", direction === "rtl" ? "univer-left-2" : "univer-right-2"),
|
|
2676
2703
|
ref: slotRef,
|
|
2677
2704
|
children: [slot, allowClear && value && !disabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2678
2705
|
type: "button",
|
|
@@ -2870,7 +2897,9 @@ const InputNumber = (0, react.forwardRef)(({ value, defaultValue, size = "small"
|
|
|
2870
2897
|
|
|
2871
2898
|
//#endregion
|
|
2872
2899
|
//#region src/components/segmented/Segmented.tsx
|
|
2900
|
+
const SEGMENTED_PADDING = 4;
|
|
2873
2901
|
function Segmented({ items, value, defaultValue, onChange, className = "" }) {
|
|
2902
|
+
const { direction } = (0, react.useContext)(ConfigContext);
|
|
2874
2903
|
const [selectedItem, setSelectedItem] = (0, react.useState)(value !== void 0 ? value : defaultValue || items[0].value);
|
|
2875
2904
|
const [slideStyle, setSlideStyle] = (0, react.useState)({});
|
|
2876
2905
|
const itemRefs = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
@@ -2884,14 +2913,16 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
|
|
|
2884
2913
|
if (newItemElement && containerRef.current) {
|
|
2885
2914
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
2886
2915
|
const newRect = newItemElement.getBoundingClientRect();
|
|
2887
|
-
const newLeft = newRect.left - containerRect.left -
|
|
2916
|
+
const newLeft = newRect.left - containerRect.left - SEGMENTED_PADDING;
|
|
2888
2917
|
if (oldItemElement) setSlideStyle({
|
|
2889
|
-
"--slide-from": `${oldItemElement.getBoundingClientRect().left - containerRect.left -
|
|
2918
|
+
"--slide-from": `${oldItemElement.getBoundingClientRect().left - containerRect.left - SEGMENTED_PADDING}px`,
|
|
2890
2919
|
"--slide-to": `${newLeft}px`,
|
|
2920
|
+
left: `${SEGMENTED_PADDING}px`,
|
|
2891
2921
|
width: `${newRect.width}px`,
|
|
2892
2922
|
transform: `translateX(${newLeft}px)`
|
|
2893
2923
|
});
|
|
2894
2924
|
else setSlideStyle({
|
|
2925
|
+
left: `${SEGMENTED_PADDING}px`,
|
|
2895
2926
|
width: `${newRect.width}px`,
|
|
2896
2927
|
transform: `translateX(${newLeft}px)`
|
|
2897
2928
|
});
|
|
@@ -2899,7 +2930,7 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
|
|
|
2899
2930
|
};
|
|
2900
2931
|
(0, react.useEffect)(() => {
|
|
2901
2932
|
updateSliderPosition(selectedItem);
|
|
2902
|
-
}, [selectedItem]);
|
|
2933
|
+
}, [direction, selectedItem]);
|
|
2903
2934
|
const handleClick = (itemValue) => {
|
|
2904
2935
|
const oldValue = selectedItem;
|
|
2905
2936
|
setSelectedItem(itemValue);
|
|
@@ -2908,6 +2939,7 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
|
|
|
2908
2939
|
};
|
|
2909
2940
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2910
2941
|
"data-u-comp": "segmented",
|
|
2942
|
+
dir: direction,
|
|
2911
2943
|
ref: containerRef,
|
|
2912
2944
|
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),
|
|
2913
2945
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -4374,7 +4406,7 @@ function Tree(props) {
|
|
|
4374
4406
|
e.stopPropagation();
|
|
4375
4407
|
handleExpendItem(treeItem);
|
|
4376
4408
|
},
|
|
4377
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.
|
|
4409
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, {})
|
|
4378
4410
|
}),
|
|
4379
4411
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Checkbox, {
|
|
4380
4412
|
checked: selected && !intermediated,
|
|
@@ -4555,5 +4587,6 @@ exports.render = render;
|
|
|
4555
4587
|
exports.resetButtonClassName = resetButtonClassName;
|
|
4556
4588
|
exports.resizeObserverCtor = resizeObserverCtor;
|
|
4557
4589
|
exports.scrollbarClassName = scrollbarClassName;
|
|
4590
|
+
exports.selectClassName = selectClassName;
|
|
4558
4591
|
exports.toast = sonner.toast;
|
|
4559
4592
|
exports.unmount = unmount;
|
package/lib/cjs/locale/ar-SA.js
CHANGED
package/lib/cjs/locale/ca-ES.js
CHANGED
package/lib/cjs/locale/de-DE.js
CHANGED
package/lib/cjs/locale/es-ES.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
//#region src/locale/es-ES.ts
|
|
3
3
|
const locale = { design: {
|
|
4
4
|
Confirm: {
|
|
5
|
-
cancel: "
|
|
6
|
-
confirm: "
|
|
5
|
+
cancel: "Cancelar",
|
|
6
|
+
confirm: "Aceptar"
|
|
7
7
|
},
|
|
8
8
|
CascaderList: { empty: "Cap" },
|
|
9
9
|
Calendar: {
|
|
@@ -40,20 +40,20 @@ const locale = { design: {
|
|
|
40
40
|
},
|
|
41
41
|
Select: { empty: "Cap" },
|
|
42
42
|
ColorPicker: {
|
|
43
|
-
more: "
|
|
44
|
-
cancel: "
|
|
45
|
-
confirm: "
|
|
43
|
+
more: "Más colores",
|
|
44
|
+
cancel: "Cancelar",
|
|
45
|
+
confirm: "Aceptar"
|
|
46
46
|
},
|
|
47
47
|
GradientColorPicker: {
|
|
48
48
|
linear: "Lineal",
|
|
49
49
|
radial: "Radial",
|
|
50
50
|
angular: "Angular",
|
|
51
|
-
diamond: "
|
|
52
|
-
offset: "
|
|
53
|
-
angle: "
|
|
54
|
-
flip: "
|
|
51
|
+
diamond: "Diamante",
|
|
52
|
+
offset: "Desplazamiento",
|
|
53
|
+
angle: "Ángulo",
|
|
54
|
+
flip: "Invertir",
|
|
55
55
|
delete: "Eliminar",
|
|
56
|
-
transparency: "
|
|
56
|
+
transparency: "Transparencia"
|
|
57
57
|
}
|
|
58
58
|
} };
|
|
59
59
|
|
package/lib/cjs/locale/fa-IR.js
CHANGED
package/lib/cjs/locale/fr-FR.js
CHANGED
package/lib/cjs/locale/id-ID.js
CHANGED
package/lib/cjs/locale/it-IT.js
CHANGED
package/lib/cjs/locale/ja-JP.js
CHANGED
package/lib/cjs/locale/ko-KR.js
CHANGED
package/lib/cjs/locale/pl-PL.js
CHANGED
package/lib/cjs/locale/pt-BR.js
CHANGED
package/lib/cjs/locale/ru-RU.js
CHANGED
package/lib/cjs/locale/sk-SK.js
CHANGED